From 691669d03ed4510e998bc4eec4e21bf635cc603e Mon Sep 17 00:00:00 2001 From: EkaterinaVu Date: Thu, 12 Nov 2020 10:30:34 +0100 Subject: [PATCH 1/7] Add date input field --- examples/questionnaire/Example.vue | 9 ++++ src/assets/css/common.css | 4 ++ src/assets/css/themes/theme-green.css | 1 + src/assets/css/themes/theme-minimal.css | 1 + src/assets/css/themes/theme-purple.css | 1 + src/components/Question.vue | 4 +- src/components/QuestionTypes/DateType.vue | 52 +++++++++++++++++++++++ src/models/QuestionModel.js | 5 ++- 8 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 src/components/QuestionTypes/DateType.vue diff --git a/examples/questionnaire/Example.vue b/examples/questionnaire/Example.vue index 75f8dfa3..75b61e18 100644 --- a/examples/questionnaire/Example.vue +++ b/examples/questionnaire/Example.vue @@ -87,6 +87,15 @@ language: new LanguageModel(), // Create question list with QuestionModel instances questions: [ + new QuestionModel({ + id: 'date', + tagline: 'Hi! Welcome to our demo survey 😊', + title: 'Enter your birthday', + type: QuestionType.Date, + required: true, + min: '2019-10-01', + max: '2020-11-20' + }), new QuestionModel({ id: 'first_name', tagline: 'Hi! Welcome to our demo survey 😊', diff --git a/src/assets/css/common.css b/src/assets/css/common.css index 1d5c975c..ec4f91b0 100644 --- a/src/assets/css/common.css +++ b/src/assets/css/common.css @@ -355,6 +355,7 @@ header.vff-header svg.f-logo { .vff input[type=email], .vff input[type=url], .vff input[type=password], +.vff input[type=date], .vff textarea { -webkit-appearance: none; -moz-appearance: none; @@ -384,6 +385,7 @@ header.vff-header svg.f-logo { .vff .f-full-width input[type=email], .vff .f-full-width input[type=url], .vff .f-full-width input[type=password], +.vff .f-full-width input[type=date], .vff .f-full-width textarea, .vff .f-full-width span.faux-form{ width: 100%; @@ -825,6 +827,7 @@ header.vff-header svg.f-logo { .vff input[type=email], .vff input[type=url], .vff input[type=password], + .vff input[type=date], .vff textarea{ font-size: .78em; } @@ -870,6 +873,7 @@ header.vff-header svg.f-logo { .vff input[type=email], .vff input[type=url], .vff input[type=password], + .vff input[type=date], .vff textarea { line-height: 1.4; padding: .16em .2em; diff --git a/src/assets/css/themes/theme-green.css b/src/assets/css/themes/theme-green.css index 7ffcc936..50232ea0 100644 --- a/src/assets/css/themes/theme-green.css +++ b/src/assets/css/themes/theme-green.css @@ -69,6 +69,7 @@ header.vff-header svg.f-logo { .vff input[type=email], .vff input[type=url], .vff input[type=password], +.vff input[type=date], .vff textarea, .vff span.faux-form { border-bottom-color: var(--vff-secondary-text-color); diff --git a/src/assets/css/themes/theme-minimal.css b/src/assets/css/themes/theme-minimal.css index 3ad22cd1..b1701fd8 100644 --- a/src/assets/css/themes/theme-minimal.css +++ b/src/assets/css/themes/theme-minimal.css @@ -57,6 +57,7 @@ header.vff-header svg.f-logo{ .vff input[type=email], .vff input[type=url], .vff input[type=password], +.vff input[type=date], .vff textarea, .vff span.faux-form { border-bottom-color: var(--vff-secondary-text-color); diff --git a/src/assets/css/themes/theme-purple.css b/src/assets/css/themes/theme-purple.css index 26969929..df77f462 100644 --- a/src/assets/css/themes/theme-purple.css +++ b/src/assets/css/themes/theme-purple.css @@ -73,6 +73,7 @@ header.vff-header svg.f-logo{ .vff input[type=email], .vff input[type=url], .vff input[type=password], +.vff input[type=date], .vff textarea, .vff span.faux-form { border-bottom-color: var(--vff-secondary-text-color); diff --git a/src/components/Question.vue b/src/components/Question.vue index 9a99c4f9..900ca4a3 100644 --- a/src/components/Question.vue +++ b/src/components/Question.vue @@ -106,6 +106,7 @@ import FlowFormSectionBreakType from './QuestionTypes/SectionBreakType.vue' import FlowFormTextType from './QuestionTypes/TextType.vue' import FlowFormUrlType from './QuestionTypes/UrlType.vue' + import FlowFormDateType from './QuestionTypes/DateType.vue' import { IsMobile } from '../mixins/IsMobile' @@ -121,7 +122,8 @@ FlowFormPhoneType, FlowFormSectionBreakType, FlowFormTextType, - FlowFormUrlType + FlowFormUrlType, + FlowFormDateType }, props: { question: QuestionModel, diff --git a/src/components/QuestionTypes/DateType.vue b/src/components/QuestionTypes/DateType.vue new file mode 100644 index 00000000..b903b5f3 --- /dev/null +++ b/src/components/QuestionTypes/DateType.vue @@ -0,0 +1,52 @@ + + + \ No newline at end of file diff --git a/src/models/QuestionModel.js b/src/models/QuestionModel.js index 83c8a056..bb242ec1 100644 --- a/src/models/QuestionModel.js +++ b/src/models/QuestionModel.js @@ -16,7 +16,8 @@ export const QuestionType = Object.freeze({ Phone: 'FlowFormPhoneType', SectionBreak: 'FlowFormSectionBreakType', Text: 'FlowFormTextType', - Url: 'FlowFormUrlType' + Url: 'FlowFormUrlType', + Date: 'FlowFormDateType' }) export const DropdownOptionBlank = Object.freeze({ @@ -84,6 +85,8 @@ export default class QuestionModel { this.helpText = null this.helpTextShow = true this.descriptionLink = [] + this.min = null + this.max = null Object.assign(this, options) From 6d420cab86197fc039a0699fbf4762d1b1606d28 Mon Sep 17 00:00:00 2001 From: EkaterinaVu Date: Thu, 12 Nov 2020 11:01:24 +0100 Subject: [PATCH 2/7] Remove console.log --- src/components/QuestionTypes/DateType.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/QuestionTypes/DateType.vue b/src/components/QuestionTypes/DateType.vue index b903b5f3..e5b28e71 100644 --- a/src/components/QuestionTypes/DateType.vue +++ b/src/components/QuestionTypes/DateType.vue @@ -40,7 +40,6 @@ }, methods: { validate() { - console.log(this.dataValue) if (this.dataValue < this.question.min || this.dataValue > this.question.max) { return false } From 51b93819c1b67577f88fcb3c05e7775f7fc5f0e4 Mon Sep 17 00:00:00 2001 From: EkaterinaVu Date: Thu, 12 Nov 2020 13:24:15 +0100 Subject: [PATCH 3/7] Test alternative date input --- examples/questionnaire/Example.vue | 8 ++++++ src/components/QuestionTypes/DateType.vue | 32 ++++++----------------- src/components/QuestionTypes/TextType.vue | 28 +++++++++++++++++++- src/tokens.js | 0 4 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 src/tokens.js diff --git a/examples/questionnaire/Example.vue b/examples/questionnaire/Example.vue index 75b61e18..cfed9456 100644 --- a/examples/questionnaire/Example.vue +++ b/examples/questionnaire/Example.vue @@ -87,6 +87,14 @@ language: new LanguageModel(), // Create question list with QuestionModel instances questions: [ + new QuestionModel({ + id: 'phone', + title: 'Doing great! 👍 Go ahead and try with a masked date input.', + type: QuestionType.Phone, + required: true, + mask:'Dd.Mm.yyyy.', + placeholder: 'dd.mm.yyyy.' + }), new QuestionModel({ id: 'date', tagline: 'Hi! Welcome to our demo survey 😊', diff --git a/src/components/QuestionTypes/DateType.vue b/src/components/QuestionTypes/DateType.vue index e5b28e71..8d36b8f8 100644 --- a/src/components/QuestionTypes/DateType.vue +++ b/src/components/QuestionTypes/DateType.vue @@ -1,23 +1,3 @@ - -