@vc-shell/framework 1.1.56 → 1.1.57

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 (28) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/core/services/widget-service.ts +21 -0
  3. package/dist/core/services/widget-service.d.ts +11 -0
  4. package/dist/core/services/widget-service.d.ts.map +1 -1
  5. package/dist/framework.js +1153 -1186
  6. package/dist/index.css +1 -1
  7. package/dist/shared/composables/index.d.ts +0 -1
  8. package/dist/shared/composables/index.d.ts.map +1 -1
  9. package/dist/shared/composables/useExternalWidgets.d.ts +1 -6
  10. package/dist/shared/composables/useExternalWidgets.d.ts.map +1 -1
  11. package/dist/tsconfig.tsbuildinfo +1 -1
  12. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +4 -4
  13. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-desktop.vue.d.ts.map +1 -1
  14. package/dist/ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue.d.ts +1 -1
  15. package/dist/ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue.d.ts.map +1 -1
  16. package/dist/ui/components/organisms/vc-table/types.d.ts +1 -1
  17. package/dist/ui/components/organisms/vc-table/types.d.ts.map +1 -1
  18. package/package.json +4 -4
  19. package/shared/composables/index.ts +0 -1
  20. package/shared/composables/useExternalWidgets.ts +38 -86
  21. package/ui/components/molecules/vc-editor/vc-editor.vue +2 -2
  22. package/ui/components/molecules/vc-select/vc-select.vue +1 -1
  23. package/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-desktop.vue +1 -0
  24. package/ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue +1 -1
  25. package/ui/components/organisms/vc-table/types.ts +1 -1
  26. package/dist/shared/composables/useBladeMultilanguage.d.ts +0 -28
  27. package/dist/shared/composables/useBladeMultilanguage.d.ts.map +0 -1
  28. package/shared/composables/useBladeMultilanguage.ts +0 -75
@@ -8,10 +8,10 @@ declare const _default: <T, P extends {
8
8
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
9
9
  readonly onSearch?: ((inputValue: string) => any) | undefined;
10
10
  readonly onClose?: (() => any) | undefined;
11
- readonly "onUpdate:modelValue"?: ((inputValue: MaybeArray<string | (P extends {
11
+ readonly "onUpdate:modelValue"?: ((inputValue: MaybeArray<P extends {
12
12
  results?: T[];
13
13
  totalCount?: number;
14
- } ? T & (Required<P>["results"] extends infer T_1 ? T_1 extends Required<P>["results"] ? T_1 extends (infer V)[] ? V : never : never : never) : T)> | null) => any) | undefined;
14
+ } ? T & (Required<P>["results"] extends infer T_1 ? T_1 extends Required<P>["results"] ? T_1 extends (infer V)[] ? V : never : never : never) : T> | MaybeArray<string> | null) => any) | undefined;
15
15
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onClose" | "onUpdate:modelValue" | "onSearch"> & {
16
16
  /**
17
17
  * Name of select
@@ -215,10 +215,10 @@ declare const _default: <T, P extends {
215
215
  }) => any;
216
216
  "no-options": (props: any) => any;
217
217
  };
218
- emit: ((evt: "search", inputValue: string) => void) & ((evt: "close") => void) & ((evt: "update:modelValue", inputValue: MaybeArray<string | (P extends {
218
+ emit: ((evt: "search", inputValue: string) => void) & ((evt: "close") => void) & ((evt: "update:modelValue", inputValue: MaybeArray<P extends {
219
219
  results?: T[];
220
220
  totalCount?: number;
221
- } ? T & (Required<P>["results"] extends infer T_3 ? T_3 extends Required<P>["results"] ? T_3 extends (infer V)[] ? V : never : never : never) : T)> | null) => void);
221
+ } ? T & (Required<P>["results"] extends infer T_3 ? T_3 extends Required<P>["results"] ? T_3 extends (infer V)[] ? V : never : never : never) : T> | MaybeArray<string> | null) => void);
222
222
  }>) => import("vue").VNode & {
223
223
  __ctx?: Awaited<typeof __VLS_setup>;
224
224
  };
@@ -1 +1 @@
1
- {"version":3,"file":"vc-widget-container-desktop.vue.d.ts","sourceRoot":"","sources":["../../../../../../../../ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-desktop.vue"],"names":[],"mappings":"AA2GA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAI7D,UAAU,KAAK;IACb,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;;AAqJD,wBAMG"}
1
+ {"version":3,"file":"vc-widget-container-desktop.vue.d.ts","sourceRoot":"","sources":["../../../../../../../../ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-desktop.vue"],"names":[],"mappings":"AA4GA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAI7D,UAAU,KAAK;IACb,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;;AA6JD,wBAMG"}
@@ -14,7 +14,7 @@ type __VLS_Slots = {
14
14
  closePanel: () => void;
15
15
  }) => VNode;
16
16
  header: (props: {
17
- header: VNode;
17
+ header: () => VNode;
18
18
  }) => VNode;
19
19
  };
20
20
  declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -1 +1 @@
1
- {"version":3,"file":"vc-table-header.vue.d.ts","sourceRoot":"","sources":["../../../../../../../ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue"],"names":[],"mappings":"AAAA,OAiKO,EAAE,KAAK,EAA8E,MAAM,KAAK,CAAC;AAQxG,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAQF,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,KAAK,CAAC;IACtD,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE,KAAK,KAAK,CAAC;CAC7C,CAAC;AA0JF,QAAA,MAAM,eAAe;;;;kFAOnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"vc-table-header.vue.d.ts","sourceRoot":"","sources":["../../../../../../../ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue"],"names":[],"mappings":"AAAA,OAiKO,EAAE,KAAK,EAA8E,MAAM,KAAK,CAAC;AAQxG,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAQF,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,KAAK,CAAC;IACtD,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,KAAK,CAAA;KAAE,KAAK,KAAK,CAAC;CACnD,CAAC;AA0JF,QAAA,MAAM,eAAe;;;;kFAOnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -2,7 +2,7 @@ import type { Ref, VNode } from "vue";
2
2
  import { IActionBuilderResult, ITableColumns } from "../../../../core/types";
3
3
  export interface TableSlots<T> {
4
4
  header: (props: {
5
- header: VNode;
5
+ header: () => VNode;
6
6
  }) => any;
7
7
  filters: (args: {
8
8
  closePanel: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../ui/components/organisms/vc-table/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE7E,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE,KAAK,GAAG,CAAC;IAC1C,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,GAAG,CAAC;IACnD,aAAa,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,KAAK,GAAG,CAAC;IAC1C,CAAC,GAAG,EAAE,UAAU,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAC/C,CAAC,GAAG,EAAE,QAAQ,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,aAAa,GAAG,eAAe,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC;IAC1G,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAC9B,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAC3B,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IACjB,OAAO,CAAC,EAAE,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;CACvC;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,CACnC,aAAa,GAAG;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CACF,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../ui/components/organisms/vc-table/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE7E,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,KAAK,CAAA;KAAE,KAAK,GAAG,CAAC;IAChD,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,GAAG,CAAC;IACnD,aAAa,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,KAAK,GAAG,CAAC;IAC1C,CAAC,GAAG,EAAE,UAAU,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAC/C,CAAC,GAAG,EAAE,QAAQ,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,aAAa,GAAG,eAAe,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC;IAC1G,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAC9B,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAC3B,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IACjB,OAAO,CAAC,EAAE,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;CACvC;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,CACnC,aAAa,GAAG;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CACF,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vc-shell/framework",
3
- "version": "1.1.56",
3
+ "version": "1.1.57",
4
4
  "type": "module",
5
5
  "main": "./dist/framework.js",
6
6
  "types": "./dist/index.d.ts",
@@ -82,9 +82,9 @@
82
82
  "@fullhuman/postcss-purgecss": "^7.0.2",
83
83
  "@laynezh/vite-plugin-lib-assets": "v1.1.0",
84
84
  "@types/dompurify": "^3.0.5",
85
- "@vc-shell/api-client-generator": "^1.1.56",
86
- "@vc-shell/config-generator": "^1.1.56",
87
- "@vc-shell/ts-config": "^1.1.56",
85
+ "@vc-shell/api-client-generator": "^1.1.57",
86
+ "@vc-shell/config-generator": "^1.1.57",
87
+ "@vc-shell/ts-config": "^1.1.57",
88
88
  "@vitejs/plugin-vue": "^5.2.3",
89
89
  "@vue/test-utils": "^2.4.5",
90
90
  "cypress-signalr-mock": "^1.5.0",
@@ -1,5 +1,4 @@
1
1
  export * from "./useMenuExpanded";
2
2
  export * from "./useModificationTracker";
3
3
  export * from "./useTableSort";
4
- export * from "./useBladeMultilanguage";
5
4
  export * from "./useExternalWidgets";
@@ -1,86 +1,50 @@
1
- import { computed, inject, onMounted, watchEffect, Ref, ComputedRef } from "vue";
1
+ import { computed, inject, onMounted, onUnmounted, watch, toValue, Ref, ComputedRef } from "vue";
2
2
  import { WidgetServiceKey, BladeInstance } from "../../injection-keys";
3
- import { IWidget } from "../../core/services/widget-service";
4
-
5
- /**
6
- * Deep comparison function to check if props have changed
7
- */
8
- function isPropsChanged(oldProps: Record<string, unknown>, newProps: Record<string, unknown>): boolean {
9
- const oldKeys = Object.keys(oldProps);
10
- const newKeys = Object.keys(newProps);
11
-
12
- // Quick check for key count difference
13
- if (oldKeys.length !== newKeys.length) {
14
- return true;
15
- }
16
-
17
- // Check each key for changes
18
- return newKeys.some((key) => {
19
- const oldValue = oldProps[key];
20
- const newValue = newProps[key];
21
-
22
- // For objects and arrays, do a shallow comparison
23
- if (typeof oldValue === "object" && typeof newValue === "object") {
24
- if (oldValue === null || newValue === null) {
25
- return oldValue !== newValue;
26
- }
27
- // For now, consider objects as changed if they're different references
28
- // In future, we might want to implement deep comparison
29
- return oldValue !== newValue;
30
- }
31
-
32
- return oldValue !== newValue;
33
- });
34
- }
3
+ import { IWidget } from "../../core/services";
35
4
 
36
5
  export interface UseExternalWidgetsOptions {
37
- bladeId: string;
6
+ bladeId: Ref<string> | string;
38
7
  bladeData: Ref<Record<string, unknown>> | ComputedRef<Record<string, unknown>>;
39
- autoRegister?: boolean; // Automatic registration when mounted
40
- autoUpdateProps?: boolean; // Automatic update of props when data changes
41
8
  }
42
9
 
43
10
  export function useExternalWidgets(options: UseExternalWidgetsOptions) {
44
- const { bladeId, bladeData, autoRegister = true, autoUpdateProps = true } = options;
11
+ const { bladeId, bladeData } = options;
45
12
 
46
13
  const widgetService = inject(WidgetServiceKey);
47
14
  const blade = inject(BladeInstance);
48
15
 
49
16
  // Normalize bladeId to lowercase for consistency
50
- const normalizedBladeId = computed(() => bladeId.toLowerCase());
17
+ const normalizedBladeId = computed(() => blade?.value.id?.toLowerCase() ?? "");
51
18
 
52
19
  const registeredExternalWidgetIds = new Set<string>();
53
20
 
54
21
  const registerExternalWidgets = () => {
55
- if (!widgetService || !normalizedBladeId.value) {
56
- console.warn("Widget service or blade ID not available");
22
+ if (!widgetService || !blade?.value.id) {
23
+ console.warn("useExternalWidgets: Widget service or blade instance not available");
57
24
  return;
58
25
  }
59
26
 
60
- const externalWidgets = widgetService.getExternalWidgetsForBlade(normalizedBladeId.value);
27
+ const allExternalWidgets = widgetService.getAllExternalWidgets();
28
+ const targetBladeId = toValue(bladeId);
61
29
 
62
- externalWidgets.forEach((externalWidget) => {
63
- // Check if the widget is already registered
30
+ const filteredWidgets = allExternalWidgets.filter(
31
+ (widget) => widget.targetBlades?.includes(targetBladeId) ?? false,
32
+ );
33
+
34
+ filteredWidgets.forEach((externalWidget) => {
64
35
  if (registeredExternalWidgetIds.has(externalWidget.id)) {
65
36
  return;
66
37
  }
67
38
 
68
- const widget: IWidget = {
69
- id: externalWidget.id,
70
- component: externalWidget.component,
71
- config: externalWidget.config,
72
- isVisible: externalWidget.isVisible,
73
- title: externalWidget.title,
74
- updateFunctionName: externalWidget.updateFunctionName,
75
- // Initially allow props
76
- props: widgetService.resolveWidgetProps(
77
- { id: externalWidget.id, component: externalWidget.component, config: externalWidget.config },
78
- bladeData.value,
79
- ),
39
+ const widgetClone = widgetService.cloneWidget(externalWidget);
40
+
41
+ const newWidget: IWidget = {
42
+ ...widgetClone,
43
+ props: widgetService.resolveWidgetProps(widgetClone, toValue(bladeData)),
80
44
  };
81
45
 
82
46
  try {
83
- widgetService.registerWidget(widget, normalizedBladeId.value);
47
+ widgetService.registerWidget(newWidget, normalizedBladeId.value);
84
48
  registeredExternalWidgetIds.add(externalWidget.id);
85
49
  } catch (error) {
86
50
  console.error(`Failed to register external widget '${externalWidget.id}':`, error);
@@ -88,28 +52,20 @@ export function useExternalWidgets(options: UseExternalWidgetsOptions) {
88
52
  });
89
53
  };
90
54
 
91
- // Update widget props when blade data changes
92
55
  const updateWidgetProps = () => {
93
56
  if (!widgetService || !blade?.value.id) return;
94
57
 
95
- const widgets = widgetService.getWidgets(blade.value.id);
58
+ registeredExternalWidgetIds.forEach((widgetId) => {
59
+ const widget = widgetService.getWidgets(normalizedBladeId.value).find((w) => w.id === widgetId);
96
60
 
97
- widgets.forEach((widget) => {
98
- if (widget.config && registeredExternalWidgetIds.has(widget.id)) {
61
+ if (widget) {
99
62
  try {
100
- const resolvedProps = widgetService.resolveWidgetProps(widget, bladeData.value);
101
-
102
- // Only update if props have actually changed to avoid unnecessary re-renders
103
- const currentProps = widget.props || {};
104
- const hasChanged = isPropsChanged(currentProps, resolvedProps);
105
-
106
- if (hasChanged) {
107
- widgetService.updateWidget({
108
- id: widget.id,
109
- bladeId: normalizedBladeId.value,
110
- widget: { props: resolvedProps },
111
- });
112
- }
63
+ const resolvedProps = widgetService.resolveWidgetProps(widget, toValue(bladeData));
64
+ widgetService.updateWidget({
65
+ id: widget.id,
66
+ bladeId: blade.value.id,
67
+ widget: { props: resolvedProps },
68
+ });
113
69
  } catch (error) {
114
70
  console.error(`Failed to update props for widget '${widget.id}':`, error);
115
71
  }
@@ -117,7 +73,6 @@ export function useExternalWidgets(options: UseExternalWidgetsOptions) {
117
73
  });
118
74
  };
119
75
 
120
- // Unregister external widgets when unmounted
121
76
  const unregisterExternalWidgets = () => {
122
77
  if (!widgetService || !normalizedBladeId.value) return;
123
78
 
@@ -128,24 +83,21 @@ export function useExternalWidgets(options: UseExternalWidgetsOptions) {
128
83
  console.error(`Failed to unregister external widget '${widgetId}':`, error);
129
84
  }
130
85
  });
131
-
132
86
  registeredExternalWidgetIds.clear();
133
87
  };
134
88
 
135
- // Automatic registration when mounted
136
- if (autoRegister) {
137
- onMounted(registerExternalWidgets);
138
- }
89
+ onMounted(registerExternalWidgets);
90
+ onUnmounted(unregisterExternalWidgets);
139
91
 
140
- // Automatic update of props when blade data changes
141
- if (autoUpdateProps) {
142
- watchEffect(updateWidgetProps);
143
- }
92
+ watch(
93
+ () => toValue(bladeData),
94
+ () => {
95
+ updateWidgetProps();
96
+ },
97
+ { deep: true },
98
+ );
144
99
 
145
100
  return {
146
- registerExternalWidgets,
147
- updateWidgetProps,
148
- unregisterExternalWidgets,
149
101
  registeredExternalWidgetIds: computed(() => Array.from(registeredExternalWidgetIds)),
150
102
  };
151
103
  }
@@ -519,8 +519,8 @@ async function handleImageSelection(event: Event) {
519
519
  --vc-editor-text-primary: var(--neutrals-900);
520
520
  --vc-editor-text-secondary: var(--neutrals-500);
521
521
  --vc-editor-text-muted: var(--neutrals-400);
522
- --vc-editor-text-disabled: var(--neutrals-400);
523
- --vc-editor-background-disabled: var(--neutrals-100);
522
+ --vc-editor-text-disabled: var(--neutrals-500);
523
+ --vc-editor-background-disabled: var(--neutrals-200);
524
524
  --vc-editor-focus-border: var(--primary-500);
525
525
  --vc-editor-focus-shadow: var(--primary-500);
526
526
  --vc-editor-error-border: var(--danger-500);
@@ -572,7 +572,7 @@ const emit = defineEmits<{
572
572
  * Emitted when the component needs to change the model; Is also used by v-model
573
573
  */
574
574
 
575
- "update:modelValue": [inputValue: MaybeArray<string | Option> | null];
575
+ "update:modelValue": [inputValue: MaybeArray<Option> | MaybeArray<string> | null];
576
576
  /**
577
577
  * Emitted when user wants to filter a value
578
578
  */
@@ -37,6 +37,7 @@
37
37
  horizontal
38
38
  :widget-id="item.id"
39
39
  v-on="item.events || {}"
40
+ @click="toggleToolbar"
40
41
  />
41
42
  </template>
42
43
  </GenericDropdown>
@@ -40,7 +40,7 @@ const emit = defineEmits<{
40
40
 
41
41
  defineSlots<{
42
42
  filters: (props: { closePanel: () => void }) => VNode;
43
- header: (props: { header: VNode }) => VNode;
43
+ header: (props: { header: () => VNode }) => VNode;
44
44
  }>();
45
45
 
46
46
  const blade = inject(
@@ -3,7 +3,7 @@ import type { Ref, VNode } from "vue";
3
3
  import { IActionBuilderResult, ITableColumns } from "../../../../core/types";
4
4
 
5
5
  export interface TableSlots<T> {
6
- header: (props: { header: VNode }) => any;
6
+ header: (props: { header: () => VNode }) => any;
7
7
  filters: (args: { closePanel: () => void }) => any;
8
8
  "mobile-item": (args: { item: T }) => any;
9
9
  [key: `header_${string}`]: (props: any) => any;
@@ -1,28 +0,0 @@
1
- import { type Ref } from "vue";
2
- interface LanguageOption {
3
- value: string;
4
- label: string | undefined;
5
- }
6
- interface LanguageOptionWithFlag extends LanguageOption {
7
- flag?: string;
8
- }
9
- interface UseBladeMultilanguageParams {
10
- localesOptions: Ref<LanguageOption[]>;
11
- currentLocale: Ref<string>;
12
- setLocale: (locale: string) => void;
13
- }
14
- interface UseBladeMultilanguageReturn {
15
- languageOptionsWithFlags: Ref<LanguageOptionWithFlag[]>;
16
- currentLanguageOption: Ref<LanguageOptionWithFlag | undefined>;
17
- isLoadingFlags: Ref<boolean>;
18
- setLocale: (locale: string) => void;
19
- isMultilanguage: Ref<boolean>;
20
- }
21
- /**
22
- * Composable for preparing data for the language switcher in blades.
23
- * @param {UseBladeMultilanguageParams} params - Parameters including languages, current locale, and a function to set it.
24
- * @returns {UseBladeMultilanguageReturn} - Reactive data and actions for use in DataContext.
25
- */
26
- export declare function useBladeMultilanguage({ localesOptions, currentLocale, setLocale, }: UseBladeMultilanguageParams): UseBladeMultilanguageReturn;
27
- export {};
28
- //# sourceMappingURL=useBladeMultilanguage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBladeMultilanguage.d.ts","sourceRoot":"","sources":["../../../shared/composables/useBladeMultilanguage.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAG3D,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,UAAU,sBAAuB,SAAQ,cAAc;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,2BAA2B;IACnC,cAAc,EAAE,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;IACtC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,UAAU,2BAA2B;IACnC,wBAAwB,EAAE,GAAG,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACxD,qBAAqB,EAAE,GAAG,CAAC,sBAAsB,GAAG,SAAS,CAAC,CAAC;IAC/D,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,eAAe,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,cAAc,EACd,aAAa,EACb,SAAS,GACV,EAAE,2BAA2B,GAAG,2BAA2B,CAuC3D"}
@@ -1,75 +0,0 @@
1
- import { ref, computed, watchEffect, type Ref } from "vue";
2
- import { useLanguages } from "../../core/composables";
3
-
4
- interface LanguageOption {
5
- value: string;
6
- label: string | undefined;
7
- }
8
-
9
- interface LanguageOptionWithFlag extends LanguageOption {
10
- flag?: string;
11
- }
12
-
13
- interface UseBladeMultilanguageParams {
14
- localesOptions: Ref<LanguageOption[]>;
15
- currentLocale: Ref<string>;
16
- setLocale: (locale: string) => void;
17
- }
18
-
19
- interface UseBladeMultilanguageReturn {
20
- languageOptionsWithFlags: Ref<LanguageOptionWithFlag[]>;
21
- currentLanguageOption: Ref<LanguageOptionWithFlag | undefined>;
22
- isLoadingFlags: Ref<boolean>;
23
- setLocale: (locale: string) => void;
24
- isMultilanguage: Ref<boolean>;
25
- }
26
-
27
- /**
28
- * Composable for preparing data for the language switcher in blades.
29
- * @param {UseBladeMultilanguageParams} params - Parameters including languages, current locale, and a function to set it.
30
- * @returns {UseBladeMultilanguageReturn} - Reactive data and actions for use in DataContext.
31
- */
32
- export function useBladeMultilanguage({
33
- localesOptions,
34
- currentLocale,
35
- setLocale,
36
- }: UseBladeMultilanguageParams): UseBladeMultilanguageReturn {
37
- const { getFlag } = useLanguages();
38
-
39
- const languageOptionsWithFlags = ref<LanguageOptionWithFlag[]>([]);
40
- const isLoadingFlags = ref(false);
41
-
42
- const isMultilanguage = computed(() => localesOptions.value.length > 1);
43
-
44
- watchEffect(async () => {
45
- if (!isMultilanguage.value) {
46
- languageOptionsWithFlags.value = [];
47
- return;
48
- }
49
-
50
- isLoadingFlags.value = true;
51
- const options = await Promise.all(
52
- localesOptions.value.map(async (lang) => ({
53
- ...lang,
54
- flag: await getFlag(lang.value ?? ""),
55
- })),
56
- );
57
-
58
- console.log("options", options);
59
-
60
- languageOptionsWithFlags.value = options;
61
- isLoadingFlags.value = false;
62
- });
63
-
64
- const currentLanguageOption = computed(() => {
65
- return languageOptionsWithFlags.value.find((lang) => lang.value === currentLocale.value);
66
- });
67
-
68
- return {
69
- languageOptionsWithFlags,
70
- currentLanguageOption,
71
- isLoadingFlags,
72
- setLocale,
73
- isMultilanguage,
74
- };
75
- }