@vc-shell/framework 1.0.94 → 1.0.95

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.
Files changed (32) hide show
  1. package/dist/framework.mjs +3706 -3670
  2. package/dist/ui/components/molecules/vc-editor/index.d.ts +10 -0
  3. package/dist/ui/components/molecules/vc-editor/index.d.ts.map +1 -1
  4. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +1 -0
  5. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
  6. package/dist/ui/components/molecules/vc-input/index.d.ts +20 -0
  7. package/dist/ui/components/molecules/vc-input/index.d.ts.map +1 -1
  8. package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts +8 -0
  9. package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts.map +1 -1
  10. package/dist/ui/components/molecules/vc-multivalue/index.d.ts +2 -0
  11. package/dist/ui/components/molecules/vc-multivalue/index.d.ts.map +1 -1
  12. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +4 -0
  13. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
  14. package/dist/ui/components/molecules/vc-select/index.d.ts +8 -0
  15. package/dist/ui/components/molecules/vc-select/index.d.ts.map +1 -1
  16. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +8 -0
  17. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
  18. package/dist/ui/components/molecules/vc-textarea/index.d.ts +20 -0
  19. package/dist/ui/components/molecules/vc-textarea/index.d.ts.map +1 -1
  20. package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts +2 -0
  21. package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts.map +1 -1
  22. package/dist/ui/components/organisms/vc-dynamic-property/index.d.ts +15 -4
  23. package/dist/ui/components/organisms/vc-dynamic-property/index.d.ts.map +1 -1
  24. package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts +15 -4
  25. package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
  26. package/package.json +3 -3
  27. package/ui/components/molecules/vc-editor/vc-editor.vue +3 -9
  28. package/ui/components/molecules/vc-input/vc-input.vue +10 -0
  29. package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +14 -4
  30. package/ui/components/molecules/vc-select/vc-select.vue +4 -0
  31. package/ui/components/molecules/vc-textarea/vc-textarea.vue +4 -0
  32. package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +31 -9
@@ -16,6 +16,8 @@
16
16
  v-if="label"
17
17
  class="tw-mb-2"
18
18
  :required="required"
19
+ :multilanguage="multilanguage"
20
+ :current-language="currentLanguage"
19
21
  >
20
22
  <span>{{ label }}</span>
21
23
  <template
@@ -249,6 +251,14 @@ export interface Props {
249
251
  * Input required state
250
252
  */
251
253
  required?: boolean;
254
+ /**
255
+ * Input multilanguage state
256
+ */
257
+ multilanguage?: boolean;
258
+ /**
259
+ * Input current language
260
+ */
261
+ currentLanguage?: string;
252
262
  }
253
263
 
254
264
  export interface Emits {
@@ -15,6 +15,8 @@
15
15
  v-if="label"
16
16
  class="tw-mb-2"
17
17
  :required="required"
18
+ :multilanguage="multilanguage"
19
+ :current-language="currentLanguage"
18
20
  >
19
21
  <span>{{ label }}</span>
20
22
  <template
@@ -31,10 +33,13 @@
31
33
  >
32
34
  <div
33
35
  v-for="(item, i) in modelValue"
34
- :key="`${item.id}_${generateId()}`"
36
+ :key="`${item?.id}_${generateId()}`"
35
37
  class="vc-multivalue__field-value-wrapper"
36
38
  >
37
- <div class="vc-multivalue__field-value">
39
+ <div
40
+ v-if="item"
41
+ class="vc-multivalue__field-value"
42
+ >
38
43
  <span class="tw-truncate">{{
39
44
  type === "number" ? Number(item[props.emitLabel]).toFixed(3) : item[props.emitLabel]
40
45
  }}</span>
@@ -113,7 +118,7 @@
113
118
  </div>
114
119
  </template>
115
120
 
116
- <script lang="ts" setup generic="T extends {id?: string; alias?: string}">
121
+ <script lang="ts" setup generic="T extends {id?: string; alias?: string, languageCode?: string, value?:string}">
117
122
  import { unref, nextTick, ref, computed } from "vue";
118
123
  import { vOnClickOutside } from "@vueuse/components";
119
124
  import { useFloating, UseFloatingReturn, offset, flip, shift, autoUpdate } from "@floating-ui/vue";
@@ -136,6 +141,8 @@ export interface Props<T> {
136
141
  multivalue?: boolean;
137
142
  error?: boolean;
138
143
  errorMessage?: string;
144
+ multilanguage?: boolean;
145
+ currentLanguage?: string;
139
146
  }
140
147
 
141
148
  export interface Emits<T> {
@@ -203,7 +210,10 @@ const slicedDictionary = computed(() => {
203
210
  // Handle input event to propertly validate value and emit changes
204
211
  function onInput(e: KeyboardEvent) {
205
212
  const newValue = (e.target as HTMLInputElement).value;
206
- emit("update:model-value", [...props.modelValue, { [props.emitLabel]: newValue } as T]);
213
+ emit("update:model-value", [
214
+ ...props.modelValue,
215
+ { [props.emitLabel]: newValue, languageCode: props.currentLanguage } as T,
216
+ ]);
207
217
  value.value = undefined;
208
218
  }
209
219
 
@@ -13,6 +13,8 @@
13
13
  v-if="label"
14
14
  class="tw-mb-2"
15
15
  :required="required"
16
+ :multilanguage="multilanguage"
17
+ :current-language="currentLanguage"
16
18
  >
17
19
  <span>{{ label }}</span>
18
20
  <template
@@ -478,6 +480,8 @@ const props = withDefaults(
478
480
  * Input search activation
479
481
  */
480
482
  searchable?: boolean;
483
+ multilanguage?: boolean;
484
+ currentLanguage?: string;
481
485
  }>(),
482
486
  {
483
487
  optionValue: "id",
@@ -11,6 +11,8 @@
11
11
  v-if="label"
12
12
  class="tw-mb-2"
13
13
  :required="required"
14
+ :multilanguage="multilanguage"
15
+ :current-language="currentLanguage"
14
16
  >
15
17
  <span>{{ label }}</span>
16
18
  <template
@@ -58,6 +60,8 @@ export interface Props {
58
60
  name?: string;
59
61
  maxchars?: string;
60
62
  errorMessage?: string;
63
+ multilanguage?: boolean;
64
+ currentLanguage?: string;
61
65
  }
62
66
 
63
67
  export interface Emits {
@@ -20,6 +20,8 @@
20
20
  :option-label="computedProperty.optionLabel"
21
21
  :disabled="disabled"
22
22
  searchable
23
+ :multilanguage="multilanguage"
24
+ :current-language="currentLanguage"
23
25
  @search="onSearch"
24
26
  @close="onClose"
25
27
  ></VcSelect>
@@ -44,6 +46,8 @@
44
46
  :required="computedProperty.required"
45
47
  placeholder="Add value"
46
48
  :disabled="disabled"
49
+ :multilanguage="multilanguage"
50
+ :current-language="currentLanguage"
47
51
  ></VcMultivalue>
48
52
  </Field>
49
53
 
@@ -64,10 +68,13 @@
64
68
  :required="computedProperty.required"
65
69
  placeholder="Add value"
66
70
  :disabled="disabled"
71
+ :multilanguage="multilanguage"
72
+ :current-language="currentLanguage"
67
73
  :options="items"
68
- option-label="alias"
74
+ :option-label="multilanguage ? 'value' : 'alias'"
69
75
  option-value="id"
70
76
  :multivalue="computedProperty.multivalue"
77
+ :emit-label="multilanguage ? 'value' : 'alias'"
71
78
  @search="onSearch"
72
79
  @close="onClose"
73
80
  ></VcMultivalue>
@@ -91,6 +98,8 @@
91
98
  :required="computedProperty.required"
92
99
  :placeholder="computedProperty.displayName || 'Add value'"
93
100
  :disabled="disabled"
101
+ :multilanguage="multilanguage"
102
+ :current-language="currentLanguage"
94
103
  ></VcInput>
95
104
  </Field>
96
105
 
@@ -220,6 +229,8 @@
220
229
  :required="computedProperty.required"
221
230
  :placeholder="computedProperty.placeholder"
222
231
  :disabled="disabled"
232
+ :multilanguage="multilanguage"
233
+ :current-language="currentLanguage"
223
234
  ></VcTextarea>
224
235
  </Field>
225
236
 
@@ -261,9 +272,11 @@ const props = withDefaults(
261
272
  defineProps<{
262
273
  property: T;
263
274
  modelValue: any;
264
- optionsGetter: (property: T, keyword?: string) => Promise<unknown[]> | unknown[];
275
+ optionsGetter: (property: T, keyword?: string, locale?: string) => Promise<unknown[]> | unknown[];
265
276
  required: boolean;
266
277
  multivalue?: boolean;
278
+ multilanguage?: boolean;
279
+ currentLanguage?: string;
267
280
  valueType: string;
268
281
  dictionary?: boolean;
269
282
  name: string;
@@ -283,13 +296,15 @@ const props = withDefaults(
283
296
  }>(),
284
297
  {
285
298
  optionsValue: "id",
286
- optionsLabel: "alias",
299
+ optionsLabel: "value",
287
300
  disabled: false,
288
301
  }
289
302
  );
290
303
 
291
304
  const emit = defineEmits<{
292
- "update:model-value": [data: { readonly property: T; readonly value: any; readonly dictionary?: any[] }];
305
+ "update:model-value": [
306
+ data: { readonly property: T; readonly value: any; readonly dictionary?: any[]; readonly locale?: string }
307
+ ];
293
308
  }>();
294
309
 
295
310
  const { locale, te, t } = useI18n({ useScope: "global" });
@@ -319,6 +334,8 @@ const computedProperty = computed(() => {
319
334
  ? t(propertyDisplayName.toUpperCase())
320
335
  : propertyDisplayName;
321
336
 
337
+ const optionLabelField = props.multilanguage ? "value" : "alias";
338
+
322
339
  return {
323
340
  rules,
324
341
  valueType: props.valueType,
@@ -327,7 +344,7 @@ const computedProperty = computed(() => {
327
344
  name: props.name,
328
345
  displayName: propertyDisplayNameLocalized, //|| setting?.displayName || setting?.defaultValue,
329
346
  optionValue: props.optionsValue,
330
- optionLabel: props.optionsLabel,
347
+ optionLabel: optionLabelField,
331
348
  required: props.required,
332
349
  placeholder: props.placeholder || propertyDisplayNameLocalized,
333
350
  };
@@ -338,25 +355,30 @@ const value = computed({
338
355
  return props.modelValue;
339
356
  },
340
357
  set(newValue) {
341
- emit("update:model-value", { property: props.property, value: newValue, dictionary: items.value });
358
+ emit("update:model-value", {
359
+ property: props.property,
360
+ value: newValue,
361
+ dictionary: items.value,
362
+ locale: props.currentLanguage,
363
+ });
342
364
  },
343
365
  });
344
366
 
345
367
  onMounted(async () => {
346
368
  if (props.optionsGetter) {
347
- items.value = await props.optionsGetter(props.property);
369
+ items.value = await props.optionsGetter(props.property, null, props.currentLanguage);
348
370
  }
349
371
  });
350
372
 
351
373
  async function onSearch(keyword: string) {
352
374
  if (props.optionsGetter) {
353
- items.value = await props.optionsGetter(props.property, keyword);
375
+ items.value = await props.optionsGetter(props.property, keyword, props.currentLanguage);
354
376
  }
355
377
  }
356
378
 
357
379
  async function onClose() {
358
380
  if (props.optionsGetter) {
359
- items.value = await props.optionsGetter(props.property);
381
+ items.value = await props.optionsGetter(props.property, null, props.currentLanguage);
360
382
  }
361
383
  }
362
384
  </script>