18
18
:key =" field .name "
19
19
>
20
20
<input
21
- v-if =" field.type === 'hidden'"
21
+ v-if =" field.type === 'hidden' || !field.type "
22
22
v-model =" modelValue[field.name]"
23
+ :name =" field.name"
23
24
type =" hidden"
24
25
/>
25
26
30
31
v-model =" modelValue[field.name]"
31
32
:field =" field"
32
33
:settings =" settings"
34
+ @update:modelValue =" callback()"
33
35
/>
34
36
35
37
<Fields .VSFCheckbox
51
53
v-model =" modelValue[field.name]"
52
54
:field =" field"
53
55
:settings =" settings"
56
+ @update:modelValue =" callback()"
54
57
/>
55
58
56
59
<Fields .VSFFileInput
67
70
:settings =" settings"
68
71
/>
69
72
70
- <!-- <v-radio-group
71
- v-if="field.type === 'radio'"
72
- v-model="modelValue[field.name]"
73
- :inline="field.inline"
74
- >
75
- <template #label>
76
- {{ field.label }} <span
77
- v-if="field.required"
78
- class="text-error ms-1"
79
- >*</span>
80
- </template>
81
- <v-radio
82
- v-for="option in field.options"
83
- :key="option.value"
84
- :density="field.density || stepperSettings.density"
85
- :label="option.label"
86
- :value="option.value"></v-radio>
87
- </v-radio-group> -->
88
-
89
-
90
-
91
-
73
+ <!-- TODO: Select Field -->
74
+ <!-- TODO: Color Picker Field -->
75
+ <!-- TODO: User Select Field -->
76
+ <!-- TODO: Autocomplete Field -->
77
+ <!-- TODO: Date Field -->
78
+ <!-- TODO: Combobox Field (tbd) -->
92
79
93
80
<Fields .VSFSwitch
94
81
v-if =" field.type === 'switch'"
@@ -114,6 +101,7 @@ import {
114
101
import componentEmits from ' ./utils/emits' ;
115
102
import * as Fields from ' ./components/index' ;
116
103
import { globalOptions } from ' @/plugin/' ;
104
+ // import { watchDeep } from '@vueuse/core';
117
105
118
106
119
107
@@ -126,6 +114,8 @@ const injectedOptions = inject(globalOptions, {});
126
114
127
115
// -------------------------------------------------- Props //
128
116
const props = withDefaults (defineProps <Props >(), { ... AllProps });
117
+
118
+ const { fields } = toRefs (props );
129
119
// console.log('AllProps', props);
130
120
// console.log('props', AllProps);
131
121
const stepperSettings = reactive ({ ... attrs , ... props , ... injectedOptions });
@@ -144,7 +134,35 @@ const settings = ref({
144
134
const modelValue = defineModel <any >();
145
135
146
136
137
+ onMounted (() => {
138
+ callback ();
139
+ });
140
+
141
+
142
+
143
+ // watch(() => fields.value, () => {
144
+ // console.log('xxxxxxxxxxxxx fields update', fields.value);
145
+ // }), {
146
+ // deep: true,
147
+ // };
148
+
149
+ // watchDeep(fields.value, () => {
150
+ // console.log('xxxxxxxxxxxxx fields update', fields.value);
151
+ // });
152
+
153
+
154
+ function callback() {
155
+ Object .values (fields .value ).forEach ((field ) => {
156
+ if (field .when ) {
157
+ const response = field .when (modelValue .value );
158
+ const fieldIdx = fields .value .findIndex ((f ) => f .name === field .name );
147
159
160
+ if (fields .value [fieldIdx ]) {
161
+ fields .value [fieldIdx ].disabled = response ;
162
+ }
163
+ }
164
+ });
165
+ }
148
166
149
167
console .log ({
150
168
emit ,
0 commit comments