ditdot-dev / vue-flow-form

Create conversational conditional-logic forms with Vue.js.
https://www.ditdot.hr/en/vue-flow-form
MIT License
779 stars 174 forks source link

New Features: Custom Mask Tokens and Reference Answers in question text #283

Closed LeoTheLegion closed 10 months ago

LeoTheLegion commented 11 months ago

This is my first pull request into a public repo. Please show no mercy. I want to learn and help.

Custom Mask Tokens

Users can now add extra tokens for use for masks.

const extraTokens: MaskModel = new MaskModel(
  [
    {
      token: 'L',
      pattern: /[a-zA-Z]/,
      optional: true,
      transform: (v: string) => v.toLocaleUpperCase()
    }
  ]
)

//The tokens could be passed into a new FlowForm prop called "extraTokens"
<FlowForm v-bind:questions="questions" v-bind:language="language" v-bind:extraTokens="extraTokens" @answer ="onAnswer">

Reference Answers in question text

Users could reference answer text in their questions

var questions = [
new QuestionModel({
  id: 'first_name',
  tagline: 'Hi! Welcome to our demo survey 😊',
  title: 'What is your first name?',
  type: QuestionType.Text,
  required: true,
  placeholder: 'Start typing here...'
}),
new QuestionModel({
  id: 'last_name',
  tagline: 'Nice to meet you, ${first_name}',
  title: 'What is your last name?',
  type: QuestionType.Text,
  required: true,
  placeholder: 'Start typing here...'
})
]
spinn commented 10 months ago

Hi @LeoTheLegion - thanks for the pull request, the functionality you're wanting to add in is interesting but your pull request should only contain changes related to the functionality you want to add in and should follow existing code style. Your pull request completely changes how the components are structured and how the code is formatted and as such can't be merged in.

If you wish to create a new PR that follows existing code style and contains only the necessary changes, we can take another look.

Forgot to mention but each PR should be related to only one change so eg. custom mask tokens should be in its own PR.