@vc-shell/framework 1.0.92 → 1.0.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/core/utilities/camelize.ts +5 -0
- package/core/utilities/generateId.ts +3 -0
- package/core/utilities/index.ts +2 -0
- package/core/utilities/kebabToCamel.ts +1 -1
- package/dist/core/utilities/camelize.d.ts +2 -0
- package/dist/core/utilities/camelize.d.ts.map +1 -0
- package/dist/core/utilities/generateId.d.ts +2 -0
- package/dist/core/utilities/generateId.d.ts.map +1 -0
- package/dist/core/utilities/index.d.ts +2 -0
- package/dist/core/utilities/index.d.ts.map +1 -1
- package/dist/core/utilities/kebabToCamel.d.ts +1 -0
- package/dist/core/utilities/kebabToCamel.d.ts.map +1 -1
- package/dist/framework.mjs +14119 -13897
- package/dist/index.css +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/vc-label/index.d.ts +20 -0
- package/dist/ui/components/atoms/vc-label/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-label/vc-label.vue.d.ts +2 -0
- package/dist/ui/components/atoms/vc-label/vc-label.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/index.d.ts +1 -0
- package/dist/ui/components/molecules/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-editor/index.d.ts +10 -0
- package/dist/ui/components/molecules/vc-editor/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +1 -0
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-multivalue/index.d.ts +42 -0
- package/dist/ui/components/molecules/vc-multivalue/index.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +66 -0
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -0
- package/dist/ui/components/organisms/vc-dynamic-property/index.d.ts +129 -69
- package/dist/ui/components/organisms/vc-dynamic-property/index.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts +126 -40
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
- package/dist/ui/types/index.d.ts +1 -0
- package/dist/ui/types/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/ui/components/atoms/vc-label/vc-label.vue +9 -1
- package/ui/components/molecules/index.ts +1 -0
- package/ui/components/molecules/vc-editor/vc-editor.vue +34 -13
- package/ui/components/molecules/vc-multivalue/index.ts +3 -0
- package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +396 -0
- package/ui/components/organisms/vc-dynamic-property/index.ts +1 -1
- package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +210 -295
- package/ui/types/index.ts +1 -0
|
@@ -1,369 +1,254 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Field
|
|
3
|
-
v-if="
|
|
4
|
-
v-slot="{ errorMessage,
|
|
5
|
-
:label="
|
|
6
|
-
:name="
|
|
7
|
-
:model-value="
|
|
8
|
-
:rules="rules"
|
|
3
|
+
v-if="computedProperty.dictionary && !computedProperty.multivalue"
|
|
4
|
+
v-slot="{ errorMessage, errors }"
|
|
5
|
+
:label="computedProperty.displayName"
|
|
6
|
+
:name="computedProperty.name"
|
|
7
|
+
:model-value="value"
|
|
8
|
+
:rules="computedProperty.rules"
|
|
9
9
|
>
|
|
10
10
|
<VcSelect
|
|
11
11
|
v-bind="$attrs"
|
|
12
|
+
v-model="value"
|
|
12
13
|
:error="!!errors.length"
|
|
13
14
|
:error-message="errorMessage"
|
|
14
|
-
:label="
|
|
15
|
-
:
|
|
16
|
-
:
|
|
17
|
-
:placeholder="handleDisplayName || property.defaultValue"
|
|
15
|
+
:label="computedProperty.displayName"
|
|
16
|
+
:required="computedProperty.required"
|
|
17
|
+
:placeholder="computedProperty.placeholder"
|
|
18
18
|
:options="items"
|
|
19
|
-
option-value="
|
|
20
|
-
:option-label="
|
|
19
|
+
:option-value="computedProperty.optionValue"
|
|
20
|
+
:option-label="computedProperty.optionLabel"
|
|
21
21
|
:disabled="disabled"
|
|
22
22
|
searchable
|
|
23
|
-
@update:model-value="
|
|
24
|
-
(e) => {
|
|
25
|
-
handleChange(e);
|
|
26
|
-
setter(property, e, items);
|
|
27
|
-
}
|
|
28
|
-
"
|
|
29
23
|
@search="onSearch"
|
|
30
24
|
@close="onClose"
|
|
31
25
|
></VcSelect>
|
|
32
26
|
</Field>
|
|
33
|
-
|
|
34
27
|
<Field
|
|
35
28
|
v-else-if="
|
|
36
|
-
|
|
29
|
+
computedProperty.valueType === 'ShortText' && computedProperty.multivalue && !computedProperty.dictionary
|
|
37
30
|
"
|
|
38
|
-
v-slot="{ errorMessage,
|
|
39
|
-
:name="
|
|
40
|
-
:model-value="
|
|
41
|
-
:label="
|
|
42
|
-
:rules="rules"
|
|
31
|
+
v-slot="{ errorMessage, errors }"
|
|
32
|
+
:name="computedProperty.name"
|
|
33
|
+
:model-value="value"
|
|
34
|
+
:label="computedProperty.displayName"
|
|
35
|
+
:rules="computedProperty.rules"
|
|
43
36
|
>
|
|
44
|
-
<
|
|
37
|
+
<VcMultivalue
|
|
45
38
|
v-bind="$attrs"
|
|
39
|
+
v-model="value"
|
|
40
|
+
:name="computedProperty.name"
|
|
46
41
|
:error="!!errors.length"
|
|
47
42
|
:error-message="errorMessage"
|
|
48
|
-
:label="
|
|
49
|
-
:
|
|
50
|
-
:required="property.required || property.isRequired"
|
|
43
|
+
:label="computedProperty.displayName"
|
|
44
|
+
:required="computedProperty.required"
|
|
51
45
|
placeholder="Add value"
|
|
52
46
|
:disabled="disabled"
|
|
53
|
-
|
|
54
|
-
option-value="id"
|
|
55
|
-
:display-label="displayedValueLabel.label"
|
|
56
|
-
:display-value="displayedValueLabel.value"
|
|
57
|
-
:multiple="true"
|
|
58
|
-
:emit-value="false"
|
|
59
|
-
@update:model-value="
|
|
60
|
-
(e) => {
|
|
61
|
-
handleChange(e);
|
|
62
|
-
setter(property, e);
|
|
63
|
-
}
|
|
64
|
-
"
|
|
65
|
-
></VcSelect>
|
|
47
|
+
></VcMultivalue>
|
|
66
48
|
</Field>
|
|
67
49
|
|
|
68
50
|
<Field
|
|
69
|
-
v-else-if="
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
:
|
|
74
|
-
:
|
|
75
|
-
:model-value="property.values"
|
|
76
|
-
:rules="rules"
|
|
51
|
+
v-else-if="computedProperty.valueType === 'ShortText' && computedProperty.multivalue && computedProperty.dictionary"
|
|
52
|
+
v-slot="{ errorMessage, errors }"
|
|
53
|
+
:name="computedProperty.name"
|
|
54
|
+
:label="computedProperty.displayName"
|
|
55
|
+
:model-value="value"
|
|
56
|
+
:rules="computedProperty.rules"
|
|
77
57
|
>
|
|
78
|
-
<
|
|
58
|
+
<VcMultivalue
|
|
79
59
|
v-bind="$attrs"
|
|
60
|
+
v-model="value"
|
|
80
61
|
:error="!!errors.length"
|
|
81
62
|
:error-message="errorMessage"
|
|
82
|
-
:label="
|
|
83
|
-
:
|
|
84
|
-
:required="property.required || property.isRequired"
|
|
63
|
+
:label="computedProperty.displayName"
|
|
64
|
+
:required="computedProperty.required"
|
|
85
65
|
placeholder="Add value"
|
|
86
66
|
:disabled="disabled"
|
|
87
67
|
:options="items"
|
|
88
68
|
option-label="alias"
|
|
89
69
|
option-value="id"
|
|
90
|
-
:
|
|
91
|
-
:display-value="displayedValueLabel.value"
|
|
92
|
-
:multiple="property.multivalue"
|
|
93
|
-
:emit-value="false"
|
|
94
|
-
@update:model-value="
|
|
95
|
-
(e) => {
|
|
96
|
-
handleChange(e);
|
|
97
|
-
setter(property, e, items);
|
|
98
|
-
}
|
|
99
|
-
"
|
|
70
|
+
:multivalue="computedProperty.multivalue"
|
|
100
71
|
@search="onSearch"
|
|
101
72
|
@close="onClose"
|
|
102
|
-
></
|
|
73
|
+
></VcMultivalue>
|
|
103
74
|
</Field>
|
|
104
75
|
|
|
105
76
|
<Field
|
|
106
|
-
v-else-if="
|
|
107
|
-
v-slot="{ errorMessage,
|
|
108
|
-
:name="
|
|
109
|
-
:label="
|
|
110
|
-
:model-value="
|
|
111
|
-
:rules="rules"
|
|
77
|
+
v-else-if="computedProperty.valueType === 'ShortText'"
|
|
78
|
+
v-slot="{ errorMessage, errors }"
|
|
79
|
+
:name="computedProperty.name"
|
|
80
|
+
:label="computedProperty.displayName"
|
|
81
|
+
:model-value="value"
|
|
82
|
+
:rules="computedProperty.rules"
|
|
112
83
|
>
|
|
113
84
|
<VcInput
|
|
114
85
|
v-bind="$attrs"
|
|
86
|
+
v-model="value"
|
|
115
87
|
:error="!!errors.length"
|
|
116
88
|
:error-message="errorMessage"
|
|
117
|
-
:label="
|
|
118
|
-
:model-value="(getter(property) as string | number | Date)"
|
|
89
|
+
:label="computedProperty.displayName"
|
|
119
90
|
clearable
|
|
120
|
-
:required="
|
|
121
|
-
:placeholder="
|
|
91
|
+
:required="computedProperty.required"
|
|
92
|
+
:placeholder="computedProperty.displayName || 'Add value'"
|
|
122
93
|
:disabled="disabled"
|
|
123
|
-
@update:model-value="
|
|
124
|
-
(e) => {
|
|
125
|
-
handleChange(e);
|
|
126
|
-
setter(property, e as Record<string, unknown> | string | number | boolean);
|
|
127
|
-
}
|
|
128
|
-
"
|
|
129
94
|
></VcInput>
|
|
130
95
|
</Field>
|
|
131
96
|
|
|
132
97
|
<Field
|
|
133
|
-
v-else-if="
|
|
134
|
-
v-slot="{ errorMessage,
|
|
135
|
-
:name="
|
|
136
|
-
:model-value="
|
|
137
|
-
:label="
|
|
138
|
-
:rules="rules"
|
|
98
|
+
v-else-if="computedProperty.valueType === 'Number' && computedProperty.multivalue"
|
|
99
|
+
v-slot="{ errorMessage, errors }"
|
|
100
|
+
:name="computedProperty.name"
|
|
101
|
+
:model-value="value"
|
|
102
|
+
:label="computedProperty.displayName"
|
|
103
|
+
:rules="computedProperty.rules"
|
|
139
104
|
>
|
|
140
|
-
<
|
|
105
|
+
<VcMultivalue
|
|
141
106
|
v-bind="$attrs"
|
|
142
|
-
|
|
143
|
-
:
|
|
144
|
-
:required="
|
|
107
|
+
v-model="value"
|
|
108
|
+
:label="computedProperty.displayName"
|
|
109
|
+
:required="computedProperty.required"
|
|
145
110
|
placeholder="Add value"
|
|
146
111
|
:disabled="disabled"
|
|
112
|
+
type="number"
|
|
147
113
|
:error="!!errors.length"
|
|
148
114
|
:error-message="errorMessage"
|
|
149
115
|
:options="items"
|
|
150
|
-
|
|
151
|
-
:option-label="handleDisplayProperty"
|
|
152
|
-
:display-label="displayedValueLabel.label"
|
|
153
|
-
:display-value="displayedValueLabel.value"
|
|
154
|
-
multiple
|
|
155
|
-
@update:model-value="
|
|
156
|
-
(e) => {
|
|
157
|
-
handleChange(e);
|
|
158
|
-
setter(property, e);
|
|
159
|
-
}
|
|
160
|
-
"
|
|
161
|
-
></VcSelect>
|
|
116
|
+
></VcMultivalue>
|
|
162
117
|
</Field>
|
|
163
118
|
|
|
164
119
|
<Field
|
|
165
|
-
v-else-if="
|
|
166
|
-
v-slot="{ errorMessage,
|
|
167
|
-
:name="
|
|
168
|
-
:
|
|
169
|
-
:
|
|
170
|
-
:rules="rules"
|
|
120
|
+
v-else-if="computedProperty.valueType === 'Integer' && computedProperty.multivalue"
|
|
121
|
+
v-slot="{ errorMessage, errors }"
|
|
122
|
+
:name="computedProperty.name"
|
|
123
|
+
:model-value="value"
|
|
124
|
+
:label="computedProperty.displayName"
|
|
125
|
+
:rules="computedProperty.rules"
|
|
126
|
+
>
|
|
127
|
+
<VcMultivalue
|
|
128
|
+
v-bind="$attrs"
|
|
129
|
+
v-model="value"
|
|
130
|
+
:label="computedProperty.displayName"
|
|
131
|
+
:required="computedProperty.required"
|
|
132
|
+
placeholder="Add value"
|
|
133
|
+
:disabled="disabled"
|
|
134
|
+
type="number"
|
|
135
|
+
:error="!!errors.length"
|
|
136
|
+
:error-message="errorMessage"
|
|
137
|
+
:options="items"
|
|
138
|
+
></VcMultivalue>
|
|
139
|
+
</Field>
|
|
140
|
+
|
|
141
|
+
<Field
|
|
142
|
+
v-else-if="computedProperty.valueType === 'Number'"
|
|
143
|
+
v-slot="{ errorMessage, errors }"
|
|
144
|
+
:name="computedProperty.name"
|
|
145
|
+
:label="computedProperty.displayName"
|
|
146
|
+
:model-value="value"
|
|
147
|
+
:rules="computedProperty.rules"
|
|
171
148
|
>
|
|
172
149
|
<VcInput
|
|
173
150
|
v-bind="$attrs"
|
|
151
|
+
v-model="value"
|
|
174
152
|
:error="!!errors.length"
|
|
175
153
|
:error-message="errorMessage"
|
|
176
|
-
:label="
|
|
177
|
-
:model-value="(getter(property) as string | number | Date)"
|
|
154
|
+
:label="computedProperty.displayName"
|
|
178
155
|
clearable
|
|
179
156
|
type="number"
|
|
180
|
-
:required="
|
|
181
|
-
:placeholder="
|
|
157
|
+
:required="computedProperty.required"
|
|
158
|
+
:placeholder="computedProperty.placeholder"
|
|
182
159
|
:disabled="disabled"
|
|
183
|
-
@update:model-value="
|
|
184
|
-
(e) => {
|
|
185
|
-
handleChange(e);
|
|
186
|
-
setter(property, e as Record<string, unknown> | string | number | boolean);
|
|
187
|
-
}
|
|
188
|
-
"
|
|
189
160
|
></VcInput>
|
|
190
161
|
</Field>
|
|
191
162
|
|
|
192
163
|
<Field
|
|
193
|
-
v-else-if="
|
|
194
|
-
v-slot="{ errorMessage,
|
|
195
|
-
:name="
|
|
196
|
-
:label="
|
|
197
|
-
:model-value="
|
|
198
|
-
:rules="rules"
|
|
164
|
+
v-else-if="computedProperty.valueType === 'Integer'"
|
|
165
|
+
v-slot="{ errorMessage, errors }"
|
|
166
|
+
:name="computedProperty.name"
|
|
167
|
+
:label="computedProperty.displayName"
|
|
168
|
+
:model-value="value"
|
|
169
|
+
:rules="computedProperty.rules"
|
|
199
170
|
>
|
|
200
171
|
<VcInput
|
|
201
172
|
v-bind="$attrs"
|
|
173
|
+
v-model="value"
|
|
202
174
|
:error="!!errors.length"
|
|
203
175
|
:error-message="errorMessage"
|
|
204
|
-
:label="
|
|
205
|
-
:model-value="(getter(property) as string | number | Date)"
|
|
176
|
+
:label="computedProperty.displayName"
|
|
206
177
|
clearable
|
|
207
178
|
type="number"
|
|
208
179
|
step="1"
|
|
209
|
-
:required="
|
|
210
|
-
:placeholder="
|
|
180
|
+
:required="computedProperty.required"
|
|
181
|
+
:placeholder="computedProperty.placeholder"
|
|
211
182
|
:disabled="disabled"
|
|
212
|
-
@update:model-value="
|
|
213
|
-
(e) => {
|
|
214
|
-
handleChange(e);
|
|
215
|
-
setter(property, e as Record<string, unknown> | string | number | boolean);
|
|
216
|
-
}
|
|
217
|
-
"
|
|
218
183
|
></VcInput>
|
|
219
184
|
</Field>
|
|
220
185
|
|
|
221
186
|
<Field
|
|
222
|
-
v-else-if="
|
|
223
|
-
v-slot="{ errorMessage,
|
|
224
|
-
:name="
|
|
225
|
-
:label="
|
|
226
|
-
:model-value="
|
|
227
|
-
:rules="rules"
|
|
187
|
+
v-else-if="computedProperty.valueType === 'DateTime'"
|
|
188
|
+
v-slot="{ errorMessage, errors }"
|
|
189
|
+
:name="computedProperty.name"
|
|
190
|
+
:label="computedProperty.displayName"
|
|
191
|
+
:model-value="value"
|
|
192
|
+
:rules="computedProperty.rules"
|
|
228
193
|
>
|
|
229
194
|
<VcInput
|
|
230
195
|
v-bind="$attrs"
|
|
196
|
+
v-model="value"
|
|
231
197
|
:error="!!errors.length"
|
|
232
198
|
:error-message="errorMessage"
|
|
233
|
-
:label="
|
|
234
|
-
:model-value="(getter(property) as string | number | Date)"
|
|
199
|
+
:label="computedProperty.displayName"
|
|
235
200
|
type="datetime-local"
|
|
236
|
-
:required="
|
|
237
|
-
:placeholder="
|
|
201
|
+
:required="computedProperty.required"
|
|
202
|
+
:placeholder="computedProperty.placeholder"
|
|
238
203
|
:disabled="disabled"
|
|
239
|
-
@update:model-value="
|
|
240
|
-
(e) => {
|
|
241
|
-
handleChange(e);
|
|
242
|
-
setter(property, e as Record<string, unknown> | string | number | boolean);
|
|
243
|
-
}
|
|
244
|
-
"
|
|
245
204
|
></VcInput>
|
|
246
205
|
</Field>
|
|
247
206
|
|
|
248
207
|
<Field
|
|
249
|
-
v-else-if="
|
|
250
|
-
v-slot="{ errorMessage
|
|
251
|
-
:name="
|
|
252
|
-
:label="
|
|
253
|
-
:model-value="
|
|
254
|
-
:rules="rules"
|
|
208
|
+
v-else-if="computedProperty.valueType === 'LongText'"
|
|
209
|
+
v-slot="{ errorMessage }"
|
|
210
|
+
:name="computedProperty.name"
|
|
211
|
+
:label="computedProperty.displayName"
|
|
212
|
+
:model-value="value"
|
|
213
|
+
:rules="computedProperty.rules"
|
|
255
214
|
>
|
|
256
215
|
<VcTextarea
|
|
257
216
|
v-bind="$attrs"
|
|
217
|
+
v-model="value"
|
|
258
218
|
:error-message="errorMessage"
|
|
259
|
-
:label="
|
|
260
|
-
:
|
|
261
|
-
:
|
|
262
|
-
:placeholder="handleDisplayName || property.defaultValue"
|
|
219
|
+
:label="computedProperty.displayName"
|
|
220
|
+
:required="computedProperty.required"
|
|
221
|
+
:placeholder="computedProperty.placeholder"
|
|
263
222
|
:disabled="disabled"
|
|
264
|
-
@update:model-value="
|
|
265
|
-
(e) => {
|
|
266
|
-
handleChange(e);
|
|
267
|
-
setter(property, e);
|
|
268
|
-
}
|
|
269
|
-
"
|
|
270
223
|
></VcTextarea>
|
|
271
224
|
</Field>
|
|
272
225
|
|
|
273
226
|
<Field
|
|
274
|
-
v-else-if="
|
|
275
|
-
v-slot="{ errorMessage
|
|
276
|
-
:name="
|
|
277
|
-
:label="
|
|
278
|
-
:model-value="
|
|
279
|
-
:rules="rules"
|
|
227
|
+
v-else-if="computedProperty.valueType === 'Boolean'"
|
|
228
|
+
v-slot="{ errorMessage }"
|
|
229
|
+
:name="computedProperty.name"
|
|
230
|
+
:label="computedProperty.displayName"
|
|
231
|
+
:model-value="value"
|
|
232
|
+
:rules="computedProperty.rules"
|
|
280
233
|
>
|
|
281
234
|
<VcCheckbox
|
|
282
235
|
v-bind="$attrs"
|
|
236
|
+
v-model="value"
|
|
283
237
|
:error-message="errorMessage"
|
|
284
|
-
:
|
|
285
|
-
:required="property.required || property.isRequired"
|
|
238
|
+
:required="computedProperty.required"
|
|
286
239
|
:disabled="disabled"
|
|
287
|
-
:name="
|
|
288
|
-
@update:model-value="
|
|
289
|
-
(e) => {
|
|
290
|
-
handleChange(e);
|
|
291
|
-
setter(property, e);
|
|
292
|
-
}
|
|
293
|
-
"
|
|
240
|
+
:name="computedProperty.name"
|
|
294
241
|
>
|
|
295
|
-
{{
|
|
242
|
+
{{ computedProperty.displayName }}
|
|
296
243
|
</VcCheckbox>
|
|
297
244
|
</Field>
|
|
298
|
-
|
|
299
|
-
<Field
|
|
300
|
-
v-else-if="property.valueType === 'Html'"
|
|
301
|
-
v-slot="{ errorMessage, handleChange }"
|
|
302
|
-
:name="property.displayName || property.name"
|
|
303
|
-
:label="handleDisplayName || property.displayName"
|
|
304
|
-
:model-value="getter(property)"
|
|
305
|
-
:rules="rules"
|
|
306
|
-
>
|
|
307
|
-
<VcCodeEditor
|
|
308
|
-
v-bind="$attrs"
|
|
309
|
-
:label="handleDisplayName || property.displayName"
|
|
310
|
-
:model-value="(getter(property) as string | number | Date)"
|
|
311
|
-
:required="property.required || property.isRequired"
|
|
312
|
-
:placeholder="handleDisplayName || 'Add value'"
|
|
313
|
-
:disabled="disabled"
|
|
314
|
-
:name="property.displayName || property.name"
|
|
315
|
-
:error-message="errorMessage"
|
|
316
|
-
@update:model-value="
|
|
317
|
-
(e) => {
|
|
318
|
-
handleChange(e);
|
|
319
|
-
setter(property, e as Record<string, unknown> | string | number | boolean);
|
|
320
|
-
}
|
|
321
|
-
"
|
|
322
|
-
>
|
|
323
|
-
</VcCodeEditor>
|
|
324
|
-
</Field>
|
|
325
245
|
</template>
|
|
326
|
-
|
|
327
|
-
<script lang="ts" setup>
|
|
246
|
+
<!-- eslint-disable @typescript-eslint/no-explicit-any -->
|
|
247
|
+
<script lang="ts" setup generic="T">
|
|
328
248
|
import { ref, onMounted, computed } from "vue";
|
|
329
249
|
import { Field } from "vee-validate";
|
|
330
250
|
import { useI18n } from "vue-i18n";
|
|
331
|
-
import { VcSelect, VcInput, VcTextarea, VcCheckbox
|
|
332
|
-
|
|
333
|
-
export interface Props {
|
|
334
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
335
|
-
property: any;
|
|
336
|
-
dictionaries?: Record<string, unknown>;
|
|
337
|
-
getter: (
|
|
338
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
339
|
-
property: Record<string, any>,
|
|
340
|
-
isDictionary?: boolean
|
|
341
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
342
|
-
) => Record<string, any> | string | number | boolean | Date;
|
|
343
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
344
|
-
optionsGetter: (property: Record<string, any>, keyword?: string) => Promise<any[] | undefined> | any[];
|
|
345
|
-
setter: (
|
|
346
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
347
|
-
property: Record<string, any>,
|
|
348
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
349
|
-
value: Record<string, any> | string | number | boolean,
|
|
350
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
351
|
-
dictionary?: any[]
|
|
352
|
-
) => void | undefined;
|
|
353
|
-
culture?: string;
|
|
354
|
-
disabled?: boolean;
|
|
355
|
-
/**
|
|
356
|
-
* @description Used only with multiple selection **only** in rare cases, where we need to display selection with other value-label pair
|
|
357
|
-
*/
|
|
358
|
-
displayedValueLabel?: {
|
|
359
|
-
value: string;
|
|
360
|
-
label: string;
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
export interface PropertyItem {
|
|
365
|
-
alias: string;
|
|
366
|
-
}
|
|
251
|
+
import { VcSelect, VcInput, VcTextarea, VcCheckbox } from "./../../";
|
|
367
252
|
|
|
368
253
|
type IValidationRules = {
|
|
369
254
|
required?: boolean;
|
|
@@ -372,37 +257,89 @@ type IValidationRules = {
|
|
|
372
257
|
regex?: RegExp;
|
|
373
258
|
};
|
|
374
259
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
260
|
+
const props = withDefaults(
|
|
261
|
+
defineProps<{
|
|
262
|
+
property: T;
|
|
263
|
+
modelValue: any;
|
|
264
|
+
optionsGetter: (property: T, keyword?: string) => Promise<unknown[]> | unknown[];
|
|
265
|
+
required: boolean;
|
|
266
|
+
multivalue?: boolean;
|
|
267
|
+
valueType: string;
|
|
268
|
+
dictionary?: boolean;
|
|
269
|
+
name: string;
|
|
270
|
+
optionsValue?: string;
|
|
271
|
+
optionsLabel?: string;
|
|
272
|
+
displayNames?: {
|
|
273
|
+
name?: string;
|
|
274
|
+
languageCode?: string;
|
|
275
|
+
}[];
|
|
276
|
+
rules?: {
|
|
277
|
+
min: number;
|
|
278
|
+
max: number;
|
|
279
|
+
regex: string;
|
|
280
|
+
};
|
|
281
|
+
disabled?: boolean;
|
|
282
|
+
placeholder?: string;
|
|
283
|
+
}>(),
|
|
284
|
+
{
|
|
285
|
+
optionsValue: "id",
|
|
286
|
+
optionsLabel: "alias",
|
|
287
|
+
disabled: false,
|
|
288
|
+
}
|
|
289
|
+
);
|
|
379
290
|
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
});
|
|
291
|
+
const emit = defineEmits<{
|
|
292
|
+
"update:model-value": [data: { readonly property: T; readonly value: any; readonly dictionary?: any[] }];
|
|
293
|
+
}>();
|
|
383
294
|
|
|
384
295
|
const { locale, te, t } = useI18n({ useScope: "global" });
|
|
385
296
|
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
let localized: string;
|
|
393
|
-
const isLocaleExists = props.property.displayNames?.find((x: IDisplayName) =>
|
|
394
|
-
x.languageCode?.toLowerCase().startsWith((locale.value as string)?.toLowerCase())
|
|
395
|
-
);
|
|
396
|
-
if (isLocaleExists && isLocaleExists.name) {
|
|
397
|
-
localized = isLocaleExists.name;
|
|
398
|
-
} else {
|
|
399
|
-
const fallback = props.property.displayNames?.find((x: IDisplayName) =>
|
|
400
|
-
x.languageCode?.toLowerCase().includes(props.culture?.toLowerCase())
|
|
401
|
-
);
|
|
402
|
-
localized = fallback && fallback?.name ? fallback.name : props.property.name;
|
|
297
|
+
const items = ref([]);
|
|
298
|
+
|
|
299
|
+
const computedProperty = computed(() => {
|
|
300
|
+
const rules: IValidationRules = {};
|
|
301
|
+
if (props.required) {
|
|
302
|
+
rules["required"] = true;
|
|
403
303
|
}
|
|
304
|
+
if (props.rules?.min) {
|
|
305
|
+
rules["min"] = Number(props.rules.min);
|
|
306
|
+
}
|
|
307
|
+
if (props.rules?.max) {
|
|
308
|
+
rules["max"] = Number(props.rules.max);
|
|
309
|
+
}
|
|
310
|
+
if (props.rules?.regex) {
|
|
311
|
+
rules["regex"] = new RegExp(props.rules.regex);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const propertyDisplayName =
|
|
315
|
+
props.displayNames?.find((displayName) => displayName.languageCode?.startsWith(locale.value as string))?.name ||
|
|
316
|
+
props.name;
|
|
317
|
+
const propertyDisplayNameLocalized =
|
|
318
|
+
propertyDisplayName && te(propertyDisplayName.toUpperCase())
|
|
319
|
+
? t(propertyDisplayName.toUpperCase())
|
|
320
|
+
: propertyDisplayName;
|
|
321
|
+
|
|
322
|
+
return {
|
|
323
|
+
rules,
|
|
324
|
+
valueType: props.valueType,
|
|
325
|
+
dictionary: props.dictionary || false,
|
|
326
|
+
multivalue: props.multivalue || false,
|
|
327
|
+
name: props.name,
|
|
328
|
+
displayName: propertyDisplayNameLocalized, //|| setting?.displayName || setting?.defaultValue,
|
|
329
|
+
optionValue: props.optionsValue,
|
|
330
|
+
optionLabel: props.optionsLabel,
|
|
331
|
+
required: props.required,
|
|
332
|
+
placeholder: props.placeholder || propertyDisplayNameLocalized,
|
|
333
|
+
};
|
|
334
|
+
});
|
|
404
335
|
|
|
405
|
-
|
|
336
|
+
const value = computed({
|
|
337
|
+
get() {
|
|
338
|
+
return props.modelValue;
|
|
339
|
+
},
|
|
340
|
+
set(newValue) {
|
|
341
|
+
emit("update:model-value", { property: props.property, value: newValue, dictionary: items.value });
|
|
342
|
+
},
|
|
406
343
|
});
|
|
407
344
|
|
|
408
345
|
onMounted(async () => {
|
|
@@ -411,28 +348,6 @@ onMounted(async () => {
|
|
|
411
348
|
}
|
|
412
349
|
});
|
|
413
350
|
|
|
414
|
-
if (props.property.required || props.property.isRequired) {
|
|
415
|
-
rules.required = true;
|
|
416
|
-
}
|
|
417
|
-
if (props.property.validationRule?.charCountMin) {
|
|
418
|
-
rules.min = Number(props.property.validationRule.charCountMin);
|
|
419
|
-
}
|
|
420
|
-
if (props.property.validationRule?.charCountMax) {
|
|
421
|
-
rules.max = Number(props.property.validationRule.charCountMax);
|
|
422
|
-
}
|
|
423
|
-
if (props.property.validationRule?.regExp) {
|
|
424
|
-
rules.regex = new RegExp(props.property.validationRule?.regExp);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
/*function getLabel() {
|
|
428
|
-
return (
|
|
429
|
-
(props.property.displayNames as { culture: string }[]).find(
|
|
430
|
-
(item) => item.culture === props.culture
|
|
431
|
-
) || props.property.name
|
|
432
|
-
);
|
|
433
|
-
}
|
|
434
|
-
*/
|
|
435
|
-
|
|
436
351
|
async function onSearch(keyword: string) {
|
|
437
352
|
if (props.optionsGetter) {
|
|
438
353
|
items.value = await props.optionsGetter(props.property, keyword);
|
package/ui/types/index.ts
CHANGED
|
@@ -38,6 +38,7 @@ declare module "@vue/runtime-core" {
|
|
|
38
38
|
VcSelect: (typeof VcShellComponents)["VcSelect"];
|
|
39
39
|
VcSlider: (typeof VcShellComponents)["VcSlider"];
|
|
40
40
|
VcTextarea: (typeof VcShellComponents)["VcTextarea"];
|
|
41
|
+
VcMultivalue: (typeof VcShellComponents)["VcMultivalue"];
|
|
41
42
|
|
|
42
43
|
// organisms
|
|
43
44
|
VcApp: (typeof VcShellComponents)["VcApp"];
|