9
9
#[` field.slotField ` ]=" props "
10
10
>
11
11
<v-text-field
12
- v-model =" allFieldsExample.answers.slotField"
13
12
v-bind =" props.field"
14
13
@blur =" props.blur()"
15
14
@change =" props.change()"
16
15
@input =" props.input()"
16
+ @update:modelValue =" props.onUpdate($event)"
17
17
>
18
18
<template #label >
19
19
<component
@@ -66,6 +66,9 @@ const keys = [
66
66
' conditionalPage' ,
67
67
];
68
68
69
+
70
+
71
+
69
72
// ? Change the key to test different examples //
70
73
const answerAndPagesKey = keys [0 ];
71
74
@@ -283,33 +286,7 @@ const customSlots = [
283
286
// & ------------------------- All Fields Example //
284
287
const allFieldsExample = reactive ({
285
288
answers: {
286
- autocomplete: undefined ,
287
- // autocomplete: 'foo',
288
- buttonField: [],
289
- checkboxMultiple: undefined ,
290
- // checkboxMultiple: ['option1', 'option3'],
291
- checkboxSingle: null ,
292
- // checkboxSingle: 'yes',
293
- color: ' #ff0000' ,
294
- // combobox: null,
295
- // combobox: 'Foo',
296
- // combobox: 'foo',
297
- combobox: null ,
298
- // combobox: { title: 'Foo', value: 'foo' },
299
-
300
- customBar: null ,
301
- desc: ' Hello World' ,
302
- email: null ,
303
- file: null ,
304
- name: null ,
305
- // radio: 'option1',
306
- radio: null ,
307
- // radioMultiple: ['option1', 'option3'],
308
- // selectField: null,
309
- selectField: ' foo' ,
310
289
slotField: null ,
311
- switchQuestion: true ,
312
- // switchQuestion: 'yes',
313
290
},
314
291
formSettings: {
315
292
fieldColumns: {
@@ -319,7 +296,7 @@ const allFieldsExample = reactive({
319
296
xl: 6 ,
320
297
},
321
298
// headerTooltips: true,
322
- jumpAhead: true ,
299
+ // jumpAhead: true,
323
300
summaryColumns: { sm: 6 },
324
301
// tooltipLocation: 'bottom',
325
302
// tooltipTransition: 'fab-transition',
@@ -346,11 +323,11 @@ const allFieldsExample = reactive({
346
323
{ ... autocompleteProps },
347
324
{ ... comboboxProps },
348
325
{ ... colorFieldProps },
349
-
350
326
],
351
327
title: ' Less Common Fields' ,
352
328
},
353
329
{
330
+ editable: false ,
354
331
fields: [
355
332
{ ... checkboxMultipleProps },
356
333
{ ... checkboxSingleProps },
@@ -557,14 +534,14 @@ const conditionalPageExample = reactive({
557
534
}),
558
535
});
559
536
560
- // & v Conditional Field Example //
561
- const conditionalExample = reactive ({
537
+ // & ------------------------- Conditional Field Example //
538
+ const conditionalFieldExample = reactive ({
562
539
answers: {
563
- aConditional: null ,
564
- bConditional: null ,
565
- cConditional: null ,
566
- conditionalParent: null ,
567
- fooQuestion: null ,
540
+ aConditional: undefined ,
541
+ bConditional: undefined ,
542
+ cConditional: undefined ,
543
+ conditionalParent: undefined ,
544
+ fooQuestion: undefined ,
568
545
},
569
546
formSettings: {
570
547
title: ' Conditional Field Example' ,
@@ -629,6 +606,9 @@ const conditionalExample = reactive({
629
606
whenParentName: ' conditionalParent' ,
630
607
},
631
608
],
609
+ when(answers : any ) {
610
+ return answers ?.conditionalParent === ' c' ;
611
+ },
632
612
},
633
613
],
634
614
validation: yupObject ({
@@ -657,26 +637,29 @@ function isRequired(field: string) {
657
637
}
658
638
659
639
const formAnswers = reactive ({
660
- allFields: { ... allFieldsExample .answers , ... DATA .answers },
661
- conditionalField: { ... conditionalExample .answers , ... DATA .answers },
662
- conditionalPage: { ... conditionalPageExample .answers , ... DATA .answers },
640
+ allFields: {
641
+ ... allFieldsExample .answers ,
642
+ // ...DATA.answers,
643
+ },
644
+ conditionalField: conditionalFieldExample .answers ,
645
+ conditionalPage: conditionalPageExample .answers ,
663
646
});
664
647
665
648
const formPages = {
666
649
allFields: allFieldsExample .pages ,
667
- conditionalField: conditionalExample .pages ,
650
+ conditionalField: conditionalFieldExample .pages ,
668
651
conditionalPage: conditionalPageExample .pages ,
669
652
};
670
653
671
654
const formSchemas = {
672
655
allFields: allFieldsExample .validation ,
673
- conditionalField: conditionalExample .validation ,
656
+ conditionalField: conditionalFieldExample .validation ,
674
657
conditionalPage: conditionalPageExample .validation ,
675
658
};
676
659
677
660
const formFormSettings = {
678
661
allFields: allFieldsExample .formSettings ,
679
- conditionalField: conditionalExample .formSettings ,
662
+ conditionalField: conditionalFieldExample .formSettings ,
680
663
conditionalPage: conditionalPageExample .formSettings ,
681
664
};
682
665
0 commit comments