Git Product home page Git Product logo

vue-flow-form's Introduction

Vue Flow Form

Create conversational conditional-logic forms with Vue.js.

License Version cdnjs

v-form screenshots

Starting with v2.0.0, Vue Flow Form has migrated from Vue 2 to Vue 3. If you're looking for README for Vue Flow Form v1.1.7, which works with Vue 2, check it out here.

Live Demos

Project Documentation

Example Project

Requirements:

  • Node.js version 10.0.0 or above (12.0.0+ recommended)
  • npm version 5+ (or yarn version 1.16+)
  • Git

After checking the prerequisites, follow these simple steps to install and use Vue Form:

# clone the repo
$ git clone https://github.com/ditdot-dev/vue-flow-form.git myproject

# go into app's directory and install dependencies:
$ cd myproject

If you use npm:

$ npm install

# serve with hot reload at localhost:8080 by default.
$ npm run serve

# build for production
$ npm run build

If you use yarn:

$ yarn install

# serve with hot reload at localhost:8080 by default.
$ yarn serve

# build for production
$ yarn build

Made with Vue.js

Usage as npm Package

If you don't already have an existing Vue project, the easiest way to create one is to use Vue CLI:

(For issues with Vue 3.13 and CLI 4 check here)

$ npm install -g @vue/cli
# OR
$ yarn global add @vue/cli

And then create a project (refer to Vue CLI documentation and issue tracker for potential problems on Windows):

$ vue create my-project
$ cd my-project

To add Vue Flow Form as a dependency to your Vue project, use the following:

$ npm install @ditdot-dev/vue-flow-form --save

And then in your App.vue file:

<template>
  <flow-form v-bind:questions="questions" v-bind:language="language" />
</template>

<script>
  // Import necessary components and classes
  import { FlowForm, QuestionModel, QuestionType, ChoiceOption, LanguageModel } from '@ditdot-dev/vue-flow-form'

  export default {
    name: 'example',
    components: {
      FlowForm
    },
    data() {
      return {
        language: new LanguageModel({
          // Your language definitions here (optional).
          // You can leave out this prop if you want to use the default definitions.
        }),
        questions: [
          // QuestionModel array
          new QuestionModel({
            title: 'Question',
            type: QuestionType.MultipleChoice,
            options: [
              new ChoiceOption({
                label: 'Answer'
              })
            ]
          })
        ]
      }
    }
  }
</script>

<style>
  /* Import Vue Flow Form base CSS */
  @import '~@ditdot-dev/vue-flow-form/dist/vue-flow-form.css';
  /* Import one of the Vue Flow Form CSS themes (optional) */
  @import '~@ditdot-dev/vue-flow-form/dist/vue-flow-form.theme-minimal.css';
  /* @import '~@ditdot-dev/vue-flow-form/dist/vue-flow-form.theme-green.css'; */
  /* @import '~@ditdot-dev/vue-flow-form/dist/vue-flow-form.theme-purple.css'; */
</style>

Usage with Plain JavaScript via CDN

HTML:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <!-- Requires Vue version 3.x -->
    <script src="https://unpkg.com/vue@next"></script>
    <!-- Flow Form -->
    <script src="https://unpkg.com/@ditdot-dev/[email protected]"></script>
    <!-- Flow Form base CSS -->
    <link rel="stylesheet" href="https://unpkg.com/@ditdot-dev/[email protected]/dist/vue-flow-form.min.css">
    <!-- Optional theme.css -->
    <link rel="stylesheet" href="https://unpkg.com/@ditdot-dev/[email protected]/dist/vue-flow-form.theme-minimal.min.css">
    <!-- Optional font -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;900&amp;display=swap">
  </head>
  <body>
    <div id="app"></div>
    <script src="app.js"></script>
  </body>
</html>

JavaScript (content of app.js):

var app = Vue.createApp({
  el: '#app',
  template: '<flow-form v-bind:questions="questions" v-bind:language="language" />',
  data: function() {
    return {
      language: new VueFlowForm.LanguageModel({
        // Your language definitions here (optional).
        // You can leave out this prop if you want to use the default definitions.
      }),
      questions: [
        new VueFlowForm.QuestionModel({
          title: 'Question',
          type: VueFlowForm.QuestionType.MultipleChoice,
          options: [
            new VueFlowForm.ChoiceOption({
              label: 'Answer'
            })
          ]
        })
      ]
    }
  }
}).component('FlowForm', VueFlowForm.FlowForm);

const vm = app.mount('#app');

Changelog

Changes for each release are documented in the release notes.

Stay in Touch

License

MIT license.

Copyright (c) 2020 - present, DITDOT Ltd.

vue-flow-form's People

Contributors

coxlr avatar dependabot[bot] avatar eddydpyl avatar ekaterinavu avatar lgmchessfan avatar mgd722 avatar phre1 avatar spinn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-flow-form's Issues

bug : questions after jump not excluded

Hi,

I noticed that, when using the jump-option, there is a slight issue for the answers that follow.
example:

first question (Q1) has 2 possible options : A or B
When choosing A, you need to fill in Q2, Q3, Q4, Q7 > submit
When choosing B, you jump to Q5, Q6, Q7 > submit
the issue is that option A is also taking Q5 & Q6 in account, which is only for B answer

How can I avoid that QuestionModels are dedicated for certain option?

Bug: Year input in pull request Feature/date input field #132

Describe the bug
The first digit of the year input gets overwritten by the second when using the keyboard to input

To Reproduce
When entering a year (eg. 1993)

  1. Starting state of year input. (yyyy)
  2. Enter the first input. (0001). Press '1' key on the keyboard
  3. Enter the second input. (0009). Press '9' key on the keyboard

Expected behaviour
After entering the second input the state should look like this (0019)

Screenshots
image

Desktop (please complete the following information):

  • Device: Dell Inspiron Laptop
  • OS: Windows 10 Home
  • Browser: Chrome

Bug:mask with array

Describe the bug
If I use the mask in new QuestionModel with an array like this: mask: ['###.###.###-##', '###.###.###/#####'] the input don't work appropriately. They recognize just 2 numbers and don't recognize the format of the mask that was expected (###.###.###-## or ###.###.###/#####).

To Reproduce
Clone and run the vue-flow-form and in file examples/questionnaire/Example.vue change the fisrt question to this:

new QuestionModel({
  id: 'first_name',
  tagline: 'Hi! Welcome to our demo survey ๐Ÿ˜Š',
  title: 'CPF?',
  type: QuestionType.Phone,
  required: true,
  mask: ['###.###.###-##', '###.###.###/#####'],
}),

Expected behavior
I expect to be able to press ok if the format is correct in the both cases of the mask (###.###.###-## or ###.###.###/#####).

Screenshots
image
image
image
image

Desktop (please complete the following information):

  • Device: PC
  • OS: Windows 10
  • Browser: chrome
  • Version: 88.0.4324.150 64 bits

Feature request: Positive validation notes for each entry

Is your feature request related to a problem? Please describe.
I love it when apps are encouraging to the user and adds gamification elements. One such element that is useful is the idea of positive validation. So that after each user's input, there's a comment that shows up like "that's great!".

Describe the solution you'd like
In the QuestionModal instance, include a new feature where devs can add positiveValidation: to incorporate a specific positiveValidation for each multipleChoice answer, or a single text response.

Describe alternatives you've considered
Animation with a positive reinforcement sound that is activated after each question. Although this is a slightly more complex to integrate.

Additional context
We're building an app right now to help users understand financial & tax issues for the gig economy. Many of them find this topic highly anxiety inducing and thus would want to encourage them with these positive validation notes. This is likely applicable for many other topics that are challenging or complex as well. eg. healthcare / legal.

Nuxt Support

First of all, thank you to the developers for making such a beautiful form component.

Is your feature request related to a problem? Please describe.
Using vue-flow-form following the recommended npm integration is not possible because nuxt will try to render it on the server, and the component has client dependencies. navigator is not defined is the problem I kept running into when trying to get this to work.

Describe the solution you'd like
I'd love to see a clear guide on how to use vue-flow-form with nuxt.

Describe alternatives you've considered
I spent an afternoon trying to wrap vue-flow-form in a plugin and disabling ssr for it in nuxt.config. The problem I ran into was using QuestionModel, QuestionType, etc... These models seem to have client side dependencies and I couldn't figure out how to make this all work with Nuxt.

Feature request: Progress bar, disable option

The standard UX recommendation is not to use the progress bar if the multi-step form has many logic jumps, to prevent confusing the user, so the global option to disable/not show is needed.

Feature request: Show question if 'x'

Is your feature request related to a problem? Please describe.
Currently, paths feel 1 dimensional. It'd be great if questions could be displayed if certain things occur.

Describe the solution you'd like
QuestionModel option 'showIf' with values relating to previous answers.
Eg:
new QuestionModel({
id: 'multiple_choices',
type: QuestionType.MultipleChoice,
multiple: true,
options: [
new ChoiceOption({
label: 'Answer 1'
}),
new ChoiceOption({
label: 'Answer 2'
})
]
}),
new QuestionModel({
id: 'answer_1',
showIf: 'multiple_choices.answers.contains("Answer 1")
})

Feature request: QuestionType.Number should return a number instead of a string

Is your feature request related to a problem? Please describe.
QuestionType.Number answers are returned as strings, despite them only allowing users to enter numbers.

Describe the solution you'd like
I think it would make more sense and be more useful to return a Number type instead. For example:

How many pets do you have?

  • <QuestionType.Number>

If a number is returned, I could use it either in a string or for mathematics and both will work:

let sentence = `Wow, ${question.answer} pets is a lot!`

let pawCount = question.answer * 4

Describe alternatives you've considered
I currently have to parse all these answers to numbers, but since they can only ever be numbers they should just be automatically returned that way.

Feature request: Making autofocus optional

Is your feature request related to a problem? Please describe.
Autofocus makes mobile users' life harder when text is long enough.

Describe the solution you'd like
It would be nice to have the option to disable autofocus

Describe alternatives you've considered
Declaring a function to clear focus on the "step" event can also solve the problem however step event is not fired for the first question displayed I guess

Feature request: Programmatic Navigation Between Questions

Is your feature request related to a problem? Please describe.
Currently, Flow form doesn't have an option to navigate between questions and sections programmatically, this will be useful when using it along with Vue-router or any other Vue components and libraries.

Describe the solution you'd like
Add a method to navigate between questions based on a key or index in the questions array.

Favorite movies section

Isn't very mobile friendly on this specific section. A button should appear to add the movie and then perform the line break, followed by an X button to delete that movie from the list, etc.

Feature request: Dynamic questions

How can I access values from previous questions?

I would like to customise the form so for example if I ask name as the first question then I can be like "{name}, some question?"

Feature request: It will be good to set Min and Max select number at multiplechoice question

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.
Thanks.. your solution..I like this beautify UI.

I want to set choice number in multiplechoice (multiple=true) question.
when i set MIN number.. surveyer must choice more than the MIN number.
when i set MAX number..surveyer can choice equal or less than the MAX number.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Feature request:

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
when make survey page,
A page which contains two or more dropdown element is needed.
when I want to survey of elementary student, i should have to ask 'school name' + 'grade' + 'class' + 'number'..
when i use vue-flow-form..i should have to use 4 dropdown page..
if these things is in 1 page.. surveyer will happy.....

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Feature request: Datepicker type question

Is your feature request related to a problem? Please describe.
An additional question type for date picker would be great in scenarios where dates are required like birthdates.

Describe the solution you'd like
A simple date picker might work. Alternatively, the existing dropdown question might be tweaked to act like date, month and year dropdown selection.

Way to restore state from previously started form

Problem

Currently, there is no way to restore the previous state of a form that has been started by a returning user.
If the user doesn't submit the form and goes away, his progress is lost.

Current workaround

We can implement a way to save answers from the user with the onAnswer event. This is useful when the user only forgets to submit the form. If he leaves in the middle of the form, there seems to be no way to bring him back to his last unanswered question.

In order to restore user progress, we need 3 things:

  1. know what his previous answers were and fill them back in
  2. know if the question was answered of not (so the progress bar displays the right percentage)
  3. know at which question index the user has left

How to do it:

  1. There's already answer in QuestionModel
  2. There's already answered in QuestionModel
  3. I suggest adding a prop called activeQuestion on FlowForm component in order to be able to automatically go to a specific question

Here's what I suggest doing in FlowForm.vue from line 206 (woking on my project)

    timerStartStep: [String, Number],
    timerStopStep: [String, Number],
    // new prop, default to 0 if not provided 
    activeQuestion: {
      type: Number,
      default: 0
    }
  },

  mixins: [IsMobile, ComponentInstance],

  data() {
    return {
      questionRefs: [],
      completed: false,
      submitted: false,
      // Instead of hardcoding 0, previsouly defined prop could be used
      activeQuestionIndex: this.$props.activeQuestion,
      questionList: [],
      questionListActivePath: [],

Feature request: Callback to get another question from the server based on an answer

Describe the solution you'd like
I would like to have an option to send an ajax callback to the server with the answer to a question to get the next question based on the selected answer.

Additional context
I cannot use the jump alternative because the options for the next questions depend on what the user selects on the previous question. Ex. Question 1 - What is the car's make? --- go grab all the models for the selected make and display them as options of the next question. 2 - What's the model? .... etc.

Bug: Refreshing on a mobile browser does not show warning prompt and causes data to be lost

Describe the bug
When you refresh the page using a mobile browser after the first question it does not show warning prompt and therefore refreshes and data is lost.
This happens If you use pull to refresh using chrome mobile browser, or using the refresh button in the URL bar on Safari and FireFox

To Reproduce
Take a survey on a mobile device and answer the first question, this will take you to the next question. If you refresh/reload the page it will not show a warning prompt and will lose your data.

Expected behavior
If on any question apart from the first one and the page is refreshed/reloaded, it should prompt and warn the user that their data will be lost if they continue, and give them the option to cancel.

Screenshots
Here is a video showing what currently happens on Chrome when you pull to refresh on the second question.

RPReplay_Final1633041777.MP4

Here is a video showing what currently happens on Safari when you click the reload button in the URL bar.

RPReplay_Final1633041819.MP4

Desktop (please complete the following information):

  • Device: iPhone 12mini
  • OS: iOS
  • Browser Chrome, Safari and FireFox
  • Version: latest version of each

Bug: jump on past question

Describe the bug
I need the ability to jump back on past questions, but Firefox or Chrome crash after press "ok".

I tried to update support example, simply add a jump to "multiple choice" adding the choice faq_yes.

As i say the browser hangs for a while, and fater crash the tab. No one message or error appers on the console.

I've also try creating a questionare with QuestionModel() but the results is the same. Is it a bug or i'm make some mistake?

To Reproduce
this is the questions array
https://pastebin.com/GcN8B74B

Feature request: previous answer specific select options

Is your feature request related to a problem? Please describe.
I currently have a form with 2 select option questions, but multiple other questions (before and after).
The first select question has 3 options and when the user selects one of those, the options in the next question should be related to the selection in the first question. As far as I can see there is no way, except jumping to a duplicated question. But this is in fact a dirty hack

Describe the solution you'd like
If the user selects option 1 in the first select question > select question 2 should have options A and B
if the user selects option 2 in the first select question > select question 2 should have options C and D
etc...
But when the first select question is followed by a few other normal questions and then you get the second select question, this should also be working.

Describe alternatives you've considered
Duplicating the select question, but as said, a dirty hack

Bug: When using nextStepOnAnswer if an answer is double clicked is skips too many questions

Describe the bug
When setting nextStepOnAnswer to true if an answer option is then clicked multiple times, it skips multiple questions.

To Reproduce
For the support-page example in Example.vue if you set the first question to use nextStepOnAnswer as true, and then click an answer option multiple times, it will trigger the nextStepOnAnswer action multiple times and cause too many questions to be skipped.

questions: [
          {
            type: 'multiplechoice',
            id: 'multiple_choice',
            tagline: 'Welcome to our demo support page!',
            title: 'Hi ๐Ÿ‘‹, how can we help you today?',
            multiple: false,
            required: true,
            helpTextShow: false,
            options: [
              {
                label: 'I have a technical issue',
                value: 'technical_issue'
              },
              {
                label: 'I wish to check my ticket status',
                value: 'enter_ticket'
              },
            ],
            jump: {
              technical_issue: 'technical_issue', 
              enter_ticket: 'enter_ticket'
            },
            model: '',
            nextStepOnAnswer: true, //add this line
          },
...
],

Expected behavior
The nextStepOnAnswer action should only be triggered once for a question, if an answer option is clicked multiple times the nextStepOnAnswer action shouldn't be triggered each time. This could potentially be resolved by disabling the question form once an answer is selected when nextStepOnAnswer is set as true till the next question has rendered.

Screenshots
Here is a video showing what currently happens, I have shown an example where each answer option on the first question is double clicked which then causes the next question to also be be skipped without being answered.

Screen.Recording.2021-05-13.at.10.57.10.AM.mp4

Desktop (please complete the following information):

  • Device: MacBook Pro
  • OS: IOS
  • Browser chrome
  • Version 90.0.4430.212 (Official Build) (x86_64)

Ranking Questionnaire from most to least

It would be great if possible to rank answers from most to least. It is helpful in getting an accurate response from Users. Is it possible to warp QuestionType with Vue.Draggable or Sortable.js. Sorry I am new to Vue js so I don't know if it is possible.

Feature request: Multi-input question type

Is your feature request related to a problem? Please describe.
Sometimes a question requires more than one input to be answered. For example, I am writing a tax calculator and I need to account for both you and your partner's responses to what are essentially the same questions. For example:

Currently I ask:

  • What is your monthly income?
  • What is your partner's monthly income?

I have 10 questions like this, but with a partner it is doubled so married users have to answer 20 questions while single users only answer 10.

Describe the solution you'd like
Allow a multi-input question type that accepts inputs from multiple number or text inputs.

Example:

  • What is your monthly income?
    You: <number input for your monthly income>
    Partner: <number input for your partner's monthly income>

Describe alternatives you've considered
Currently I do this as two separate questions. I understand that having two inputs on the same page isn't as clean as one input per page, but this seems like the lesser of two evils.

Additional context
I love the library so far!

Feature request: Isolating CSS global styles

First of all, great work on this project! I really appreciate it.

I have tried importing it in as a dependency in one of my Vuetify projects but sadly, all the global styles of Vuetify and flow-form are colliding when I use it inside my app. :root styles of flow-form are breaking my frontend, and Vuetify's font sizes, default colors etc. also leak into flow-form component.

I would really appreciate if you could find a way to scope all the CSS for the flow-form so that it does not interact with the parent applications with global CSS files, such as Vuetify's CSS reset and body, title, p, ::before modifications.

I have considered:

  • Forking and rewriting the flow-form project using CSS modules,
  • Somehow using block level imports and adding a prefix to all flow-form components so they don't collide with parent's global CSS (didn't work for me)
  • Using BEM approach and modularizing flow-form CSS via class names.

I could really appreciate a feature that would allow both theming & scoping the CSS away from any wrappers or parent global CSS styles.

If you already know a solution to this problem, please let me know!

Update cdnjs documentation

The documentation on cdnjs still refers to the old v1.x version, we should update this to point to the new/v2.x version.

Bug: Uncaught (in promise) TypeError: Cannot read property '_c' of undefined

Describe the bug
Whenever I try to use the package, I get the following error in my console:
Uncaught (in promise) TypeError: Cannot read property '_c' of undefined
I tried each of the examples and get the error with each of them. I'm on Vue 3.0.5 and I'm using it with Laravel, I'm not sure if that makes a difference. What confuses me the most is that I had this working on an earlier project just fine.

To Reproduce
Copy and paste one of the examples and try to refresh the page, I see this error in the console.

Desktop (please complete the following information):

  • Device: Macbook pro 2015
  • OS: macOS big sur
  • Browser chrome

Keyboard & accessibility navigation issues

Just checked out your questionnaire demo, there are some (rather serious) navigation issues.

  1. Pressing tab does not focus the buttons (don't use <a> tags, use <button type="button">)
  2. Multi-select is also not accessible.
  3. Up/down arrow are also only accessible with a mouse, keyboard arrows should also send you to the next/prev section.
  4. Sometimes tab takes me to the next section instead of navigating the current section.

e.g.

<a href="#" role="button" aria-label="Press to continue" class="animate fade-in-up f-enter">
  <div class="o-btn-action"><span>OK</span></div><span class="f-enter-desc">Press ENTER</span>
</a>

should be

<div class="flex">
  <button type="button" class="o-btn-action">
    OK
  </button>
  <span>
    Press <span class="f-enter-desc uppercase">Enter</span>
  </span>
</div>

Also for accessibility, please style the :focus state of everything that is focusable, so a keyboard user will know where he is situated on the screen.

image
As you can see, chrome also detects buttons as generic and non-keyboard focusable.

Also a small note: screen readers will read ENTER as E N T E R, while Enter with uppercase css styling will be read like normal.

Feature request: An easier way to include answers from previous questions in later questions

Is your feature request related to a problem? Please describe.
Often, later questions in the survey depend on answers from previous questions. Example:

  1. What is your favorite food?
    <QuestionType.Text>

  2. What is your second favorite food?
    <QuestionType.Text>

  3. Which of your favorite foods is saltier?
    <QuestionType.MultipleChoice>
    <ChoiceOption answer_1>
    <ChoiceOption answer_2>

Describe alternatives you've considered
Currently I have my questions array as a computed property that can update question choices based on listening to previous answers. This is awkward and not very robust. I have to iterate through the questions array, find the question with a given id that I'm looking for, get the answer, do the same thing for the second question, then find the question I want to update, and finally create a new array of ChoiceOption objects for it. It works but it feels hacky and way more verbose than it should be.

Describe the solution you'd like
There should be some easy way to rely on answers from previous questions. The current system of instantiating a new ChoiceOption in the component's data object makes this difficult. After reviewing the source code, I think allowing developers to pass flow-form-questions directly to the flow-form component as a slot would allow for the most extensibility and would be most Vue-like. Developers could still use the existing data-based method of passing questions if they wanted, but an option for something like this would be very powerful and (in my opinion) easier for devs to create different question tracks as well:

<flow-form
    // ...your regular flowform options
>
    <question
        v-model="favoriteFood"
        type="Text"
        // ...include any other QuestionModel parameters
    />
    <question
        v-model="secondFavoriteFood"
        type="Text"
    />
    <question
        v-model="saltierFood"
        type="MultipleChoice"
        :options="{label: favoriteFood}, {label: secondFavoriteFood}"
    />
</flow-form>

Bug: The screen starts to shake after typing an answer on Android devices.

Describe the bug
When using an android device (it does not happen o iOS) the screen blinks/shakes whenever we finish typing a answer. I've demontrated that behavior on the video attached.

To Reproduce
Steps to reproduce the behavior:
1 - Clone the repo.
2 - Start the project.
3 - Open any example
4 - Type the answer

Expected behavior
I expect the screen not to blink/shake.

Screenshots
I've uploaded a video.

Desktop (please complete the following information):

  • Device: REDMI 8, SAMSUNG GALAXY S10e, Motorola G5,G6
  • OS: Android
  • Browser: Chrome (it works just fine on firefox)
  • Version: most recent

Additional context
Video:
https://user-images.githubusercontent.com/37699234/112041090-bfed1000-8b24-11eb-9a95-831d84993a2b.mp4

Feature request: matrix question

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
When asking different questions of the same option multiple times.
I need 'matrix question type'.
vue flow form use best UI, so matrix question type is not fit in this concept.
but..when PC..matrix question type is good.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Bug: rollup --config build/rollup.config.js fails - [name] is not exported by [module]

Describe the bug
When attempting to build an npm package using rollup (or npm run build:npm), the script fails with the following:

rollup --config build/rollup.config.js

src/main.js โ†’ dist/vue-flow-form.umd.js...
(!) Error when using sourcemap for reporting an error: Can't resolve original location of error.
src/components/QuestionTypes/DropdownType.vue?vue&type=template&id=96838bd2&lang.js: (1:9)
[!] Error: 'createVNode' is not exported by node_modules/vue/dist/vue.runtime.esm.js, imported by src/components/QuestionTypes/DropdownType.vue?vue&type=template&id=96838bd2&lang.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
src/components/QuestionTypes/DropdownType.vue?vue&type=template&id=96838bd2&lang.js (1:9)

Seems like there are failed import/export sequences required for rollup to do its job. I initially thought this was a commonJS issue but seems its an issue with the vue plugin itself and can't really pinpoint the issue. How was the initial NPM package being compiled? Is there an undocumented workaround I'm missing?

To Reproduce
run npm run build:npm

Expected behavior
dist directory created with the expected JS/CSS files to consumption.

Feature request: Allow values to be booleans

Is your feature request related to a problem? Please describe.
This is a fairly common scenario:

new ChoiceOption({
    label: 'yes',
    value: true
}),
new ChoiceOption({
    label: 'no',
    value: false
})

I have a yes/no question and I would like the answer to be a boolean so that I don't need to coerce it to a boolean later. Currently, doing this results in this error:

[Vue warn]: Invalid prop: type check failed for prop "value". Expected String, Array, got Boolean with value true.

Because of the way the value prop is configured in Question.vue..

Describe the solution you'd like
Allow booleans to be accepted as values.

Describe alternatives you've considered
let booleanAnswer = question.answer === 'true' ? true : false

Bug: MultipleChoiceType answers not being marked as selected when navigating through pages

Describe the bug
When using the question component method as described here #136 (comment) the answers for MultipleChoiceType are not populated when using the navigation link to click through the questions to check answers.

To Reproduce
I have created an example repo here coxlr/vue-flow-form and updated the Example.vue file in the examples/questionnaire' directory. Example.vue

To reproduce

# clone the repo and install dependancies
git clone https://github.com/coxlr/vue-flow-form.git vue-flow-form
cd vue-flow-form
npm install
npm run dev

Answer the first few MultipleChoiceType questions, then use the back button in the progress bar to navigate back through the questions. You can see that the MultipleChoiceType questions do not get re marked as selected.

Expected behavior
The selected answer options should be selected when navigating back and forwards between pages.

Desktop (please complete the following information):

  • Device: MacBook
  • OS: IOS
  • Browser chrome, safari & firefox

Additional context
Digging in to it a little, it looks like the toggleAnswer function that currently gets called in the mounted hook needs to be called. I tried replicating the code in the active method in the watch function in the MultipleChoiceType.vue component and this worked to mark the answer options a selected, when click back to a page, but not when going forward to a page. I also did not repopulate the 'Other' option if selected.

Bug: Skipping longtext question on mobile devices shows blank page

Describe the bug
When a longtext question has required set as false as show below, when clicking skip the next question is not show and a blank page is displayed. This occurs when using the question component, as used in the support page example.

{
            type: 'longtext',
            id: "faq_no",
            tagline: 'Submit issue > Step 2/3',
            title: 'Please describe your problem.',
            required: false,
            placeholder: 'Start typing here...',
            model: ''
},

To Reproduce
For the support-page example in Example.vue set the longtext question to use required as false, and add an additional question that follows this question. Then click skip for this question when completing the survey and it display a blank page and not the expected question.

Expected behavior
The next question should be displayed in the same way it is when the question is answered and not skipped.

Screenshots
Here is a video showing what currently happens. I have set the longtext question to use required as false, and add an additional question that follows this question on the support-page example.

Screen.Recording.2021-09-22.at.6.18.00.PM.mov

Desktop (please complete the following information):
Device: MacBook Pro
OS: IOS
Browser chrome using devtools as a mobile device
Version 93.0.4577.82 (Official Build) (x86_64)

Also tested and experience the same issue on the following mobile device:
Device: iPhone 12 mini
OS: IOS 14
Browser chrome and safari

Update documentation to include answer field

We currently have an undocumented field of QuestionModel - answer which holds the user's answer after replying to a question. This can for example be used to pre-fill the answer to any of the questions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.