@vc-shell/framework 1.1.15 → 1.1.16

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 (35) hide show
  1. package/core/composables/useDynamicProperties/index.ts +19 -0
  2. package/dist/core/composables/useDynamicProperties/index.d.ts +10 -2
  3. package/dist/core/composables/useDynamicProperties/index.d.ts.map +1 -1
  4. package/dist/framework.js +1 -1
  5. package/dist/{index-rcb9yEYF.js → index-BM57ACvV.js} +1 -1
  6. package/dist/{index-DNbY7P_u.js → index-BNnWb4d2.js} +1 -1
  7. package/dist/{index-co8q_PFD.js → index-BX16sgSt.js} +1 -1
  8. package/dist/{index-BISLgAEB.js → index-BcycCrhu.js} +1 -1
  9. package/dist/{index-DlPhVze5.js → index-BsgNPf1t.js} +1 -1
  10. package/dist/{index-DGCGoJoH.js → index-Bu2q0_3Y.js} +1 -1
  11. package/dist/{index-3A2Hnqrq.js → index-C29QNU9R.js} +1 -1
  12. package/dist/{index-DqBypt_Z.js → index-C4hgh3UO.js} +1 -1
  13. package/dist/{index-CQo65M-u.js → index-CZUA_odG.js} +2866 -2832
  14. package/dist/{index-BWbFkDa0.js → index-DCpm6RA0.js} +1 -1
  15. package/dist/{index-ChjkjQKO.js → index-DLq0u-Q_.js} +1 -1
  16. package/dist/{index-B3iU8-A1.js → index-DMnyda0K.js} +1 -1
  17. package/dist/{index-gSGyS2U2.js → index-DUFYvPbO.js} +1 -1
  18. package/dist/{index-DakkJ0Cz.js → index-DaUvPRtj.js} +1 -1
  19. package/dist/{index-CBQlnj-B.js → index-DcBib1nM.js} +1 -1
  20. package/dist/{index-vztMiylq.js → index-IcBXwZve.js} +1 -1
  21. package/dist/{index-CzDc-mia.js → index-bDzs_LWh.js} +1 -1
  22. package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
  23. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts +9 -4
  24. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts.map +1 -1
  25. package/dist/shared/modules/dynamic/factories/types/index.d.ts +2 -13
  26. package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
  27. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +18 -8
  28. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts +1 -0
  31. package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
  32. package/package.json +4 -4
  33. package/shared/modules/dynamic/components/fields/DynamicProperty.ts +6 -0
  34. package/shared/modules/dynamic/factories/types/index.ts +8 -17
  35. package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +39 -0
@@ -12,6 +12,7 @@ declare const _default: <T extends {
12
12
  property: T;
13
13
  modelValue: any;
14
14
  optionsGetter: (propertyId: string, keyword?: string, locale?: string) => Promise<any[] | undefined> | any[] | undefined;
15
+ measurementsGetter?: (measureId: string, locale?: string) => Promise<any[] | undefined> | any[] | undefined;
15
16
  required: boolean;
16
17
  multivalue?: boolean;
17
18
  multilanguage?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"vc-dynamic-property.vue.d.ts","sourceRoot":"","sources":["../../../../../ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue"],"names":[],"mappings":"yBAmXiB,CAAC,SAAS;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,EAC3D,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,eAAe,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EACjE;WAmlBO,mBAAmB,CAAC;;4BApiBqB,GAAG;kCAAwB,GAAG,EAAE;8BAAoB,MAAM;;;kBAtC7F,CAAC;oBACC,GAAG;uBACA,CACb,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,KACZ,OAAO,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,GAAG,EAAE,GAAG,SAAS;kBACzC,OAAO;qBACJ,OAAO;wBACJ,OAAO;0BACL,MAAM;mBACb,MAAM;qBACJ,OAAO;cACd,MAAM;uBACG,MAAM;uBACN,MAAM;uBACN;YACb,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,YAAY,CAAC,EAAE,MAAM,CAAC;SACvB,EAAE;gBACK;YACN,GAAG,CAAC,EAAE,MAAM,CAAC;YACb,GAAG,CAAC,EAAE,MAAM,CAAC;YACb,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB;mBACU,OAAO;sBACJ,MAAM;QAgjByC,OAAO,IAAsB,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;wBAtiBsC,GAAG;8BAAwB,GAAG,EAAE;0BAAoB,MAAM;;EA0iBvG,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AA9lBzE,wBA8lB4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"vc-dynamic-property.vue.d.ts","sourceRoot":"","sources":["../../../../../ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue"],"names":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AK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;wBA9lBsC,GAAG;8BAAwB,GAAG,EAAE;0BAAoB,MAAM;;EAkmBvG,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AAvpBzE,wBAupB4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vc-shell/framework",
3
- "version": "1.1.15",
3
+ "version": "1.1.16",
4
4
  "type": "module",
5
5
  "main": "./dist/framework.js",
6
6
  "types": "./dist/index.d.ts",
@@ -70,9 +70,9 @@
70
70
  "devDependencies": {
71
71
  "@fullhuman/postcss-purgecss": "^7.0.2",
72
72
  "@types/dompurify": "^3.0.5",
73
- "@vc-shell/api-client-generator": "^1.1.15",
74
- "@vc-shell/config-generator": "^1.1.15",
75
- "@vc-shell/ts-config": "^1.1.15",
73
+ "@vc-shell/api-client-generator": "^1.1.16",
74
+ "@vc-shell/config-generator": "^1.1.16",
75
+ "@vc-shell/ts-config": "^1.1.16",
76
76
  "@vitejs/plugin-vue": "^5.2.3",
77
77
  "@vue/test-utils": "^2.4.5",
78
78
  "cypress-signalr-mock": "^1.5.0",
@@ -74,6 +74,8 @@ export default {
74
74
  const initialProps = _.cloneDeep(dynamicProps.value);
75
75
 
76
76
  const properties: UnwrapNestedRefs<IDynamicProperties[]> = reactiveComputed(() => {
77
+ console.log("props.bladeContext.scope?.dynamicProperties: ", props.bladeContext.scope?.dynamicProperties);
78
+ console.log("dynamicProps.value: ", dynamicProps.value);
77
79
  return (dynamicProps.value || [])?.map((prop) =>
78
80
  DynamicProperties({
79
81
  props: {
@@ -91,6 +93,10 @@ export default {
91
93
  keyword?: string | undefined,
92
94
  locale?: string | undefined,
93
95
  ) => Promise<Record<string, any>[]>,
96
+ measurementsGetter: props.bladeContext.scope?.dynamicProperties?.loadMeasurements as (
97
+ measureId: string,
98
+ locale?: string | undefined,
99
+ ) => Promise<Record<string, any>[]>,
94
100
  "onUpdate:model-value": (args: {
95
101
  value: string | Record<string, any>[];
96
102
  dictionary?: Record<string, any>[];
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import { ComputedRef, MaybeRef, Ref, UnwrapNestedRefs } from "vue";
3
- import { AsyncAction } from "../../../../../core/composables";
3
+ import { AsyncAction, IUseDynamicProperties } from "../../../../../core/composables";
4
4
  import { SettingsDetails, SettingsGrid, SettingsSchema } from "../../types";
5
5
  import {
6
6
  AssetsHandler,
@@ -155,22 +155,13 @@ export interface DetailsBaseBladeScope<Item = Record<string, any>> extends BaseB
155
155
  localesOptions: Ref<{ label: string | undefined; value: string }[]>;
156
156
  getLanguages: AsyncAction<void, void>;
157
157
  };
158
- dynamicProperties?: {
159
- loading: ComputedRef<boolean>;
160
- loadDictionaries: (
161
- propertyId: string,
162
- keyword?: string,
163
- locale?: string,
164
- ) => Promise<Record<string, any>[] | undefined>;
165
- getPropertyValue: (property: Record<string, any>, locale: string) => any;
166
- setPropertyValue: (data: {
167
- property: Record<string, any>;
168
- value: string | Record<string, any>[];
169
- dictionary?: Record<string, any>[];
170
- locale?: string;
171
- initialProp?: Record<string, any>;
172
- }) => void;
173
- };
158
+ dynamicProperties?: IUseDynamicProperties<
159
+ Record<string, any>,
160
+ Record<string, any>,
161
+ Record<string, any>,
162
+ Record<string, any>,
163
+ Record<string, any>
164
+ >;
174
165
  assetsHandler?: {
175
166
  assets?: AssetsHandler<ICommonAsset>;
176
167
  images?: AssetsHandler<ICommonAsset>;
@@ -189,6 +189,22 @@
189
189
  >
190
190
  </VcSwitch>
191
191
  </template>
192
+ <template v-else-if="computedProperty.valueType === 'Measure'">
193
+ <VcInputDropdown
194
+ v-bind="$attrs"
195
+ v-model="value"
196
+ v-model:option="defaultMeasurementOption"
197
+ :options="measurementOptions"
198
+ :loading="measurementLoading"
199
+ option-label="displayName"
200
+ option-value="displaySymbol"
201
+ input-type="number"
202
+ :label="computedProperty.displayName"
203
+ :placeholder="computedProperty.placeholder"
204
+ :required="computedProperty.required"
205
+ :disabled="disabled"
206
+ />
207
+ </template>
192
208
  </Field>
193
209
  </template>
194
210
 
@@ -216,6 +232,7 @@ const props = withDefaults(
216
232
  keyword?: string,
217
233
  locale?: string,
218
234
  ) => Promise<any[] | undefined> | any[] | undefined;
235
+ measurementsGetter?: (measureId: string, locale?: string) => Promise<any[] | undefined> | any[] | undefined;
219
236
  required: boolean;
220
237
  multivalue?: boolean;
221
238
  multilanguage?: boolean;
@@ -255,6 +272,9 @@ const loading = ref(false);
255
272
  const initialOptions = ref<any[]>([]);
256
273
  const internalProperty = ref(props.property) as Ref<typeof props.property>;
257
274
  const internalModel = ref(props.modelValue) as Ref<typeof props.modelValue>;
275
+ const measurementOptions = ref<any[]>([]);
276
+ const measurementLoading = ref(false);
277
+ const defaultMeasurementOption = ref();
258
278
 
259
279
  watch(
260
280
  () => props.property,
@@ -333,6 +353,7 @@ const value = computed({
333
353
 
334
354
  onMounted(async () => {
335
355
  await getOptions();
356
+ await getMeasurements();
336
357
  initialOptions.value = items.value;
337
358
  });
338
359
 
@@ -351,6 +372,24 @@ async function getOptions(keyword: string | undefined = undefined) {
351
372
  }
352
373
  }
353
374
 
375
+ async function getMeasurements() {
376
+ if (props.measurementsGetter && internalProperty.value.valueType === "Measure" && internalProperty.value.measureId) {
377
+ try {
378
+ measurementLoading.value = true;
379
+ const measurements = await props.measurementsGetter(
380
+ internalProperty.value.measureId,
381
+ props.currentLanguage ?? "en-US",
382
+ );
383
+ if (measurements) {
384
+ measurementOptions.value = measurements;
385
+ defaultMeasurementOption.value = measurements.filter((x) => x.isDefault)[0].displaySymbol;
386
+ }
387
+ } finally {
388
+ measurementLoading.value = false;
389
+ }
390
+ }
391
+ }
392
+
354
393
  async function onSearch(keyword: string) {
355
394
  getOptions(keyword);
356
395
  }