@vc-shell/framework 1.1.7 → 1.1.9

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 (61) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/core/services/widget-service.ts +4 -3
  3. package/core/types/index.ts +6 -1
  4. package/dist/core/services/widget-service.d.ts +4 -3
  5. package/dist/core/services/widget-service.d.ts.map +1 -1
  6. package/dist/core/types/index.d.ts +2 -1
  7. package/dist/core/types/index.d.ts.map +1 -1
  8. package/dist/framework.js +1 -1
  9. package/dist/{index-L61Jab0v.js → index-83AS8awQ.js} +1616 -1611
  10. package/dist/{index-B-mWhdLd.js → index-BRzLUR4F.js} +1 -1
  11. package/dist/{index-CupHW_BC.js → index-BSMDwAsD.js} +1 -1
  12. package/dist/{index-CiGiEqGG.js → index-BcE8cPQ1.js} +1 -1
  13. package/dist/{index-CDBWP4up.js → index-BdXB4Rc2.js} +1 -1
  14. package/dist/{index-DqYA_pFb.js → index-BeE65IDG.js} +1 -1
  15. package/dist/{index-C5CvjxDz.js → index-BjulAuhE.js} +1 -1
  16. package/dist/{index-EX-KKv5q.js → index-C1julODM.js} +1 -1
  17. package/dist/{index-CyoDOgBt.js → index-CCh6DcPw.js} +1 -1
  18. package/dist/{index-hQL5vI4T.js → index-CM-cQwyJ.js} +1 -1
  19. package/dist/{index-BkhpB2QG.js → index-CcUXsEpB.js} +1 -1
  20. package/dist/{index-Dfqkcdc_.js → index-D77dHT9M.js} +1 -1
  21. package/dist/{index-B8b4HKad.js → index-DjGE0Oe5.js} +1 -1
  22. package/dist/{index-C1SZpIDW.js → index-DkbufypA.js} +1 -1
  23. package/dist/{index-BgxGeHeF.js → index-VBkCq_SK.js} +1 -1
  24. package/dist/{index-F1Iiqswe.js → index-cAxs8v2c.js} +1 -1
  25. package/dist/{index-C70yQsjv.js → index-nY-vksAs.js} +1 -1
  26. package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts +15 -37
  27. package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts.map +1 -1
  28. package/dist/shared/components/blade-navigation/types/index.d.ts +3 -0
  29. package/dist/shared/components/blade-navigation/types/index.d.ts.map +1 -1
  30. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts +1 -1
  31. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts.map +1 -1
  32. package/dist/shared/modules/dynamic/factories/types/index.d.ts +0 -1
  33. package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
  34. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +2 -2
  35. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
  36. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +2 -2
  37. package/dist/shared/modules/dynamic/types/index.d.ts +6 -1
  38. package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/dist/ui/components/organisms/vc-app/vc-app.backupsb.d.ts +50 -0
  41. package/dist/ui/components/organisms/vc-app/vc-app.backupsb.d.ts.map +1 -0
  42. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue.d.ts.map +1 -1
  43. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-mobile.vue.d.ts +1 -0
  44. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-mobile.vue.d.ts.map +1 -1
  45. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/vc-widget-container.vue.d.ts.map +1 -1
  46. package/dist/ui/components/organisms/vc-blade/vc-blade.backupsb.d.ts +89 -0
  47. package/dist/ui/components/organisms/vc-blade/vc-blade.backupsb.d.ts.map +1 -0
  48. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
  49. package/package.json +5 -5
  50. package/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.ts +119 -56
  51. package/shared/components/blade-navigation/types/index.ts +3 -0
  52. package/shared/modules/dynamic/factories/types/index.ts +228 -229
  53. package/shared/modules/dynamic/types/index.ts +4 -1
  54. package/ui/components/atoms/vc-badge/vc-badge.stories.ts +2 -2
  55. package/ui/components/atoms/vc-badge/vc-badge.vue +1 -1
  56. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +3 -1
  57. package/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-mobile.vue +15 -2
  58. package/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/vc-widget-container.vue +5 -2
  59. package/ui/components/organisms/vc-blade/vc-blade.vue +5 -1
  60. /package/ui/components/organisms/vc-app/{vc-app.stories.ts → vc-app.backupsb.ts} +0 -0
  61. /package/ui/components/organisms/vc-blade/{vc-blade.stories.ts → vc-blade.backupsb.ts} +0 -0
@@ -1,229 +1,228 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { ComputedRef, MaybeRef, Ref, UnwrapNestedRefs } from "vue";
3
- import { AsyncAction } from "../../../../../core/composables";
4
- import { SettingsDetails, SettingsGrid, SettingsSchema } from "../../types";
5
- import {
6
- AssetsHandler,
7
- IActionBuilderResult,
8
- IBladeToolbar,
9
- ICommonAsset,
10
- ITableColumns,
11
- } from "../../../../../core/types";
12
- import { useBladeNavigation } from "../../../../components";
13
- import { FormContext } from "vee-validate";
14
- import { Breadcrumbs } from "../../../../../ui/types";
15
- import { DynamicBladeForm, DynamicBladeList } from "../../pages";
16
-
17
- export type ItemId = { id: string };
18
-
19
- export interface IPagination {
20
- currentPage: number;
21
- totalCount: number;
22
- pageSize: number;
23
- pages: number;
24
- }
25
-
26
- export interface IValidationState<Item> {
27
- valid: boolean;
28
- /**
29
- * @deprecated `dirty` - use `modified` instead
30
- */
31
- dirty: boolean;
32
- disabled: boolean;
33
- modified: boolean;
34
- validated: boolean;
35
- cachedValue: Item | undefined;
36
- setFieldError: FormContext["setFieldError"];
37
- setFieldValue: FormContext["setFieldValue"];
38
- setValues: FormContext["setValues"];
39
- setErrors: FormContext["setErrors"];
40
- resetModified: (
41
- data: MaybeRef<Item | undefined> | ComputedRef<Item | undefined>,
42
- updateInitial?: MaybeRef<boolean>,
43
- ) => void;
44
- resetValidationState: () => void;
45
- validate: FormContext["validate"];
46
- errorBag: Partial<Record<string, string[]>>;
47
- setModifiedState: (value: boolean) => void;
48
- }
49
-
50
- export type CustomQuery = { ids: string[] | null; allSelected?: boolean };
51
-
52
- export interface UseDetails<Item, Scope extends DetailsBaseBladeScope = DetailsBaseBladeScope> {
53
- load: AsyncAction<ItemId>;
54
- saveChanges: AsyncAction<Item, Item | void>;
55
- remove?: AsyncAction<ItemId | Item>;
56
- loading: ComputedRef<boolean>;
57
- item: Ref<Item | undefined>;
58
- validationState: ComputedRef<IValidationState<Item>>;
59
- scope?: Scope;
60
- bladeTitle?: ComputedRef<string>;
61
- }
62
-
63
- export interface UseList<
64
- Items extends Record<string, any>[],
65
- Query,
66
- Scope extends ListBaseBladeScope<Items[number]> = ListBaseBladeScope<Items[number]>,
67
- > {
68
- items: ComputedRef<Items>;
69
- query: Ref<Query>;
70
- loading: ComputedRef<boolean>;
71
- pagination: ComputedRef<{
72
- currentPage: number;
73
- totalCount: number;
74
- pageSize: number;
75
- pages: number;
76
- }>;
77
- load: AsyncAction<Query>;
78
- remove?: AsyncAction<CustomQuery>;
79
- scope?: Scope;
80
- }
81
-
82
- export interface ITableConfig {
83
- loading?: boolean;
84
- columns?: ITableColumns[];
85
- stateKey?: string;
86
- items?: Record<string, any>[];
87
- multiselect?: boolean;
88
- header?: boolean;
89
- itemActionBuilder?: (item: Record<string, any>) => IActionBuilderResult[] | undefined;
90
- editing?: boolean;
91
- enableItemActions?: boolean;
92
- footer?: boolean;
93
- sort?: string;
94
- pages?: number;
95
- currentPage?: number;
96
- searchValue?: string;
97
- selectedItemId?: string | undefined;
98
- totalCount?: number;
99
- reorderableRows?: boolean;
100
- pullToReload?: boolean;
101
- selectAll?: boolean;
102
- paginationVariant?: "default" | "minimal" | undefined;
103
- selectionItems?: Record<string, any>[];
104
- onItemClick?: (item: Record<string, any>) => void;
105
- onPaginationClick?: (page: number) => void;
106
- onSelectionChanged?: (items: Record<string, any>[]) => void;
107
- onHeaderClick?: (item: ITableColumns) => void;
108
- "onScroll:ptr"?: () => void;
109
- "onSearch:change"?: (keyword: string | undefined) => void;
110
- "onRow:reorder"?: (event: { dragIndex: number; dropIndex: number; value: any[] }) => void;
111
- "onSelect:all"?: (all: boolean) => void;
112
- onEditComplete?: (data: { event: { field: string; value: any }; index: number }) => void;
113
- onCellBlur?: (data: { row: number | undefined; field: string }) => void;
114
- disableItemCheckbox?: (item: Record<string, any> | undefined) => boolean;
115
- columnSelector?: "auto" | "defined" | MaybeRef<ITableColumns[]> | (() => ITableColumns[]);
116
- }
117
-
118
- export interface BaseBladeScope {
119
- [x: string]: any;
120
- toolbarOverrides?:
121
- | MaybeRef<{ [x: string]: IBladeToolbar | IBladeToolbar[] | MaybeRef<IBladeToolbar> | MaybeRef<IBladeToolbar[]> }>
122
- | ((...args: any[]) => any)
123
- | MaybeRef<IBladeToolbar[]>;
124
- }
125
-
126
- export interface ListBaseBladeScope<Item = Record<string, any>, Query = Record<string, any>> extends BaseBladeScope {
127
- openDetailsBlade?: (
128
- args?: Omit<Parameters<ReturnType<typeof useBladeNavigation>["openBlade"]>["0"], "blade">,
129
- ) => Promise<void> | void;
130
- onListItemClick?: (
131
- args: { item?: Item } & Omit<
132
- Parameters<ReturnType<typeof useBladeNavigation>["openBlade"]>["0"],
133
- "blade" | "param" | "options"
134
- >,
135
- ) => void;
136
- onPaginationClick?: (query: Query) => void;
137
- breadcrumbs?: ComputedRef<Breadcrumbs[]>;
138
- modified?: ComputedRef<boolean> | Ref<boolean> | boolean;
139
- tableConfig?: (initialTableConfig: ITableConfig) => ITableConfig;
140
- }
141
-
142
- export type TOpenBladeArgs = Omit<Parameters<ReturnType<typeof useBladeNavigation>["openBlade"]>["0"], "blade">;
143
- export type TListItemClickArgs<Item extends Record<string, any> = Record<string, any>> = Omit<
144
- Parameters<ReturnType<typeof useBladeNavigation>["openBlade"]>["0"],
145
- "blade" | "param" | "options"
146
- > & { item?: Item | undefined };
147
-
148
- export interface DetailsBaseBladeScope<Item = Record<string, any>> extends BaseBladeScope {
149
- disabled?: ComputedRef<boolean | undefined> | Ref<boolean | undefined> | boolean;
150
- multilanguage?: {
151
- loading: ComputedRef<boolean>;
152
- currentLocale: Ref<string>;
153
- languages: Ref<string[]>;
154
- setLocale: (locale: string) => void;
155
- localesOptions: Ref<{ label: string | undefined; value: string }[]>;
156
- getLanguages: AsyncAction<void, void>;
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
- };
174
- assetsHandler?: {
175
- assets?: AssetsHandler<ICommonAsset>;
176
- images?: AssetsHandler<ICommonAsset>;
177
- };
178
- selection?: Item[];
179
- }
180
-
181
- export interface DetailsBladeContext<
182
- Item extends Record<string, any> = Record<string, any>,
183
- Scope extends DetailsBaseBladeScope = DetailsBaseBladeScope,
184
- > extends UseDetails<Item, Scope> {
185
- settings: ComputedRef<SettingsSchema>;
186
- }
187
-
188
- export interface ListBladeContext<
189
- Items extends Record<string, any>[] = Record<string, any>[],
190
- Query = Record<string, any>,
191
- Scope extends ListBaseBladeScope = ListBaseBladeScope,
192
- > extends UseList<Items, Query, Scope> {
193
- settings: ComputedRef<SettingsSchema>;
194
- selectedIds: ComputedRef<string[]>;
195
- }
196
-
197
- export interface BaseBladeExposed {
198
- updateActiveWidgetCount: () => void;
199
- readonly title: MaybeRef<string>;
200
- }
201
-
202
- export type ListBladeExposed<Scope extends ListBaseBladeScope> = BaseBladeExposed & {
203
- readonly selectedIds: string[];
204
- reload: () => void;
205
- readonly settings: SettingsGrid;
206
- } & UnwrapNestedRefs<Scope>;
207
-
208
- export type DetailsBladeExposed<Scope extends DetailsBaseBladeScope> = BaseBladeExposed & {
209
- readonly settings: SettingsDetails;
210
- readonly item: Record<string, any>;
211
- readonly validationState: IValidationState<Record<string, any>>;
212
- } & UnwrapNestedRefs<Scope>;
213
-
214
- export type DetailsComposableArgs<
215
- Props extends Omit<InstanceType<typeof DynamicBladeForm>["$props"], "composables"> = Record<string, any>,
216
- > = {
217
- props: InstanceType<typeof DynamicBladeForm>["$props"] & Props;
218
- emit: InstanceType<typeof DynamicBladeForm>["$emit"];
219
- mounted: Ref<boolean>;
220
- };
221
-
222
- export type ListComposableArgs<
223
- Props extends Omit<InstanceType<typeof DynamicBladeList>["$props"], "composables"> = Record<string, any>,
224
- > = {
225
- readonly props: InstanceType<typeof DynamicBladeList>["$props"] & Props;
226
- readonly emit: InstanceType<typeof DynamicBladeList>["$emit"];
227
- readonly mounted: Ref<boolean>;
228
- readonly isWidgetView: boolean;
229
- };
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { ComputedRef, MaybeRef, Ref, UnwrapNestedRefs } from "vue";
3
+ import { AsyncAction } from "../../../../../core/composables";
4
+ import { SettingsDetails, SettingsGrid, SettingsSchema } from "../../types";
5
+ import {
6
+ AssetsHandler,
7
+ IActionBuilderResult,
8
+ IBladeToolbar,
9
+ ICommonAsset,
10
+ ITableColumns,
11
+ } from "../../../../../core/types";
12
+ import { useBladeNavigation } from "../../../../components";
13
+ import { FormContext } from "vee-validate";
14
+ import { Breadcrumbs } from "../../../../../ui/types";
15
+ import { DynamicBladeForm, DynamicBladeList } from "../../pages";
16
+
17
+ export type ItemId = { id: string };
18
+
19
+ export interface IPagination {
20
+ currentPage: number;
21
+ totalCount: number;
22
+ pageSize: number;
23
+ pages: number;
24
+ }
25
+
26
+ export interface IValidationState<Item> {
27
+ valid: boolean;
28
+ /**
29
+ * @deprecated `dirty` - use `modified` instead
30
+ */
31
+ dirty: boolean;
32
+ disabled: boolean;
33
+ modified: boolean;
34
+ validated: boolean;
35
+ cachedValue: Item | undefined;
36
+ setFieldError: FormContext["setFieldError"];
37
+ setFieldValue: FormContext["setFieldValue"];
38
+ setValues: FormContext["setValues"];
39
+ setErrors: FormContext["setErrors"];
40
+ resetModified: (
41
+ data: MaybeRef<Item | undefined> | ComputedRef<Item | undefined>,
42
+ updateInitial?: MaybeRef<boolean>,
43
+ ) => void;
44
+ resetValidationState: () => void;
45
+ validate: FormContext["validate"];
46
+ errorBag: Partial<Record<string, string[]>>;
47
+ setModifiedState: (value: boolean) => void;
48
+ }
49
+
50
+ export type CustomQuery = { ids: string[] | null; allSelected?: boolean };
51
+
52
+ export interface UseDetails<Item, Scope extends DetailsBaseBladeScope = DetailsBaseBladeScope> {
53
+ load: AsyncAction<ItemId>;
54
+ saveChanges: AsyncAction<Item, Item | void>;
55
+ remove?: AsyncAction<ItemId | Item>;
56
+ loading: ComputedRef<boolean>;
57
+ item: Ref<Item | undefined>;
58
+ validationState: ComputedRef<IValidationState<Item>>;
59
+ scope?: Scope;
60
+ bladeTitle?: ComputedRef<string>;
61
+ }
62
+
63
+ export interface UseList<
64
+ Items extends Record<string, any>[],
65
+ Query,
66
+ Scope extends ListBaseBladeScope<Items[number]> = ListBaseBladeScope<Items[number]>,
67
+ > {
68
+ items: ComputedRef<Items>;
69
+ query: Ref<Query>;
70
+ loading: ComputedRef<boolean>;
71
+ pagination: ComputedRef<{
72
+ currentPage: number;
73
+ totalCount: number;
74
+ pageSize: number;
75
+ pages: number;
76
+ }>;
77
+ load: AsyncAction<Query>;
78
+ remove?: AsyncAction<CustomQuery>;
79
+ scope?: Scope;
80
+ }
81
+
82
+ export interface ITableConfig {
83
+ loading?: boolean;
84
+ columns?: ITableColumns[];
85
+ stateKey?: string;
86
+ items?: Record<string, any>[];
87
+ multiselect?: boolean;
88
+ header?: boolean;
89
+ itemActionBuilder?: (item: Record<string, any>) => IActionBuilderResult[] | undefined;
90
+ editing?: boolean;
91
+ enableItemActions?: boolean;
92
+ footer?: boolean;
93
+ sort?: string;
94
+ pages?: number;
95
+ currentPage?: number;
96
+ searchValue?: string;
97
+ selectedItemId?: string | undefined;
98
+ totalCount?: number;
99
+ reorderableRows?: boolean;
100
+ pullToReload?: boolean;
101
+ selectAll?: boolean;
102
+ paginationVariant?: "default" | "minimal" | undefined;
103
+ selectionItems?: Record<string, any>[];
104
+ onItemClick?: (item: Record<string, any>) => void;
105
+ onPaginationClick?: (page: number) => void;
106
+ onSelectionChanged?: (items: Record<string, any>[]) => void;
107
+ onHeaderClick?: (item: ITableColumns) => void;
108
+ "onScroll:ptr"?: () => void;
109
+ "onSearch:change"?: (keyword: string | undefined) => void;
110
+ "onRow:reorder"?: (event: { dragIndex: number; dropIndex: number; value: any[] }) => void;
111
+ "onSelect:all"?: (all: boolean) => void;
112
+ onEditComplete?: (data: { event: { field: string; value: any }; index: number }) => void;
113
+ onCellBlur?: (data: { row: number | undefined; field: string }) => void;
114
+ disableItemCheckbox?: (item: Record<string, any> | undefined) => boolean;
115
+ columnSelector?: "auto" | "defined" | MaybeRef<ITableColumns[]> | (() => ITableColumns[]);
116
+ }
117
+
118
+ export interface BaseBladeScope {
119
+ [x: string]: any;
120
+ toolbarOverrides?:
121
+ | MaybeRef<{ [x: string]: IBladeToolbar | IBladeToolbar[] | MaybeRef<IBladeToolbar> | MaybeRef<IBladeToolbar[]> }>
122
+ | ((...args: any[]) => any)
123
+ | MaybeRef<IBladeToolbar[]>;
124
+ }
125
+
126
+ export interface ListBaseBladeScope<Item = Record<string, any>, Query = Record<string, any>> extends BaseBladeScope {
127
+ openDetailsBlade?: (
128
+ args?: Omit<Parameters<ReturnType<typeof useBladeNavigation>["openBlade"]>["0"], "blade">,
129
+ ) => Promise<void> | void;
130
+ onListItemClick?: (
131
+ args: { item?: Item } & Omit<
132
+ Parameters<ReturnType<typeof useBladeNavigation>["openBlade"]>["0"],
133
+ "blade" | "param" | "options"
134
+ >,
135
+ ) => void;
136
+ onPaginationClick?: (query: Query) => void;
137
+ breadcrumbs?: ComputedRef<Breadcrumbs[]>;
138
+ modified?: ComputedRef<boolean> | Ref<boolean> | boolean;
139
+ tableConfig?: (initialTableConfig: ITableConfig) => ITableConfig;
140
+ }
141
+
142
+ export type TOpenBladeArgs = Omit<Parameters<ReturnType<typeof useBladeNavigation>["openBlade"]>["0"], "blade">;
143
+ export type TListItemClickArgs<Item extends Record<string, any> = Record<string, any>> = Omit<
144
+ Parameters<ReturnType<typeof useBladeNavigation>["openBlade"]>["0"],
145
+ "blade" | "param" | "options"
146
+ > & { item?: Item | undefined };
147
+
148
+ export interface DetailsBaseBladeScope<Item = Record<string, any>> extends BaseBladeScope {
149
+ disabled?: ComputedRef<boolean | undefined> | Ref<boolean | undefined> | boolean;
150
+ multilanguage?: {
151
+ loading: ComputedRef<boolean>;
152
+ currentLocale: Ref<string>;
153
+ languages: Ref<string[]>;
154
+ setLocale: (locale: string) => void;
155
+ localesOptions: Ref<{ label: string | undefined; value: string }[]>;
156
+ getLanguages: AsyncAction<void, void>;
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
+ };
174
+ assetsHandler?: {
175
+ assets?: AssetsHandler<ICommonAsset>;
176
+ images?: AssetsHandler<ICommonAsset>;
177
+ };
178
+ selection?: Item[];
179
+ }
180
+
181
+ export interface DetailsBladeContext<
182
+ Item extends Record<string, any> = Record<string, any>,
183
+ Scope extends DetailsBaseBladeScope = DetailsBaseBladeScope,
184
+ > extends UseDetails<Item, Scope> {
185
+ settings: ComputedRef<SettingsSchema>;
186
+ }
187
+
188
+ export interface ListBladeContext<
189
+ Items extends Record<string, any>[] = Record<string, any>[],
190
+ Query = Record<string, any>,
191
+ Scope extends ListBaseBladeScope = ListBaseBladeScope,
192
+ > extends UseList<Items, Query, Scope> {
193
+ settings: ComputedRef<SettingsSchema>;
194
+ selectedIds: ComputedRef<string[]>;
195
+ }
196
+
197
+ export interface BaseBladeExposed {
198
+ updateActiveWidgetCount: () => void;
199
+ readonly title: MaybeRef<string>;
200
+ }
201
+
202
+ export type ListBladeExposed<Scope extends ListBaseBladeScope> = BaseBladeExposed & {
203
+ readonly selectedIds: string[];
204
+ reload: () => void;
205
+ readonly settings: SettingsGrid;
206
+ } & UnwrapNestedRefs<Scope>;
207
+
208
+ export type DetailsBladeExposed<Scope extends DetailsBaseBladeScope> = BaseBladeExposed & {
209
+ readonly settings: SettingsDetails;
210
+ readonly item: Record<string, any>;
211
+ readonly validationState: IValidationState<Record<string, any>>;
212
+ } & UnwrapNestedRefs<Scope>;
213
+
214
+ export type DetailsComposableArgs<
215
+ Props extends Omit<InstanceType<typeof DynamicBladeForm>["$props"], "composables"> = Record<string, any>,
216
+ > = {
217
+ props: InstanceType<typeof DynamicBladeForm>["$props"] & Props;
218
+ emit: InstanceType<typeof DynamicBladeForm>["$emit"];
219
+ mounted: Ref<boolean>;
220
+ };
221
+
222
+ export type ListComposableArgs<
223
+ Props extends Omit<InstanceType<typeof DynamicBladeList>["$props"], "composables"> = Record<string, any>,
224
+ > = {
225
+ readonly props: InstanceType<typeof DynamicBladeList>["$props"] & Props;
226
+ readonly emit: InstanceType<typeof DynamicBladeList>["$emit"];
227
+ readonly mounted: Ref<boolean>;
228
+ };
@@ -843,7 +843,10 @@ export interface CardSchema
843
843
 
844
844
  export interface WidgetsSchema extends Pick<SchemaBase, "id" | "horizontalSeparator" | "permissions"> {
845
845
  component: "vc-widgets";
846
- children: string[] | { id: string; visibility?: { method: string } }[];
846
+ children:
847
+ | string[]
848
+ | { id: string; visibility?: { method: string } }[]
849
+ | (string | { id: string; visibility?: { method: string } })[];
847
850
  }
848
851
 
849
852
  export interface CheckboxSchema extends Omit<SchemaBase, "multilanguage" | "placeholder" | "onBlur"> {
@@ -249,7 +249,7 @@ export const DotIndicator: Story = {
249
249
  <div class="tw-flex tw-gap-4">
250
250
  <div v-for="variant in variants" :key="variant" class="tw-flex tw-flex-col tw-items-center tw-gap-2">
251
251
  <VcBadge :isDot="true" :variant="variant">
252
- <div class="tw-w-10 tw-h-10 tw-bg-gray-200 tw-rounded tw-flex tw-items-center tw-justify-center">
252
+ <div class="tw-w-5 tw-h-5 tw-bg-gray-200 tw-rounded tw-flex tw-items-center tw-justify-center">
253
253
  <svg xmlns="http://www.w3.org/2000/svg" class="tw-h-5 tw-w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
254
254
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z" />
255
255
  </svg>
@@ -463,7 +463,7 @@ export const UseCases: Story = {
463
463
  :variant="example.variant"
464
464
  :isDot="example.isDot"
465
465
  >
466
- <div class="tw-w-12 tw-h-12 tw-bg-gray-200 tw-rounded tw-flex tw-items-center tw-justify-center">
466
+ <div class="tw-w-8 tw-h-8 tw-bg-gray-200 tw-rounded tw-flex tw-items-center tw-justify-center">
467
467
  <svg xmlns="http://www.w3.org/2000/svg" class="tw-h-6 tw-w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
468
468
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" :d="example.icon" />
469
469
  </svg>
@@ -11,7 +11,7 @@
11
11
  <slot name="default"></slot>
12
12
 
13
13
  <div
14
- v-if="typeof content !== 'undefined'"
14
+ v-if="typeof content !== 'undefined' || isDot"
15
15
  ref="badge"
16
16
  class="vc-badge__badge"
17
17
  :class="[
@@ -130,7 +130,9 @@ const visibleItems = computed(() => {
130
130
  .filter(
131
131
  (item) =>
132
132
  hasAccess(item.permissions) &&
133
- (item.isVisible === undefined || item.isVisible) &&
133
+ (typeof item.isVisible === "function"
134
+ ? item.isVisible(blade.value)
135
+ : item.isVisible === undefined || item.isVisible) &&
134
136
  (isMobile.value ? !item.disabled : true),
135
137
  )
136
138
  .sort((a, b) => {
@@ -51,22 +51,35 @@
51
51
  </template>
52
52
 
53
53
  <script setup lang="ts">
54
- import { ref, computed } from "vue";
54
+ import { ref, computed, inject } from "vue";
55
55
  import { useAdaptiveItems } from "../../../../../../composables/useAdaptiveItems";
56
56
 
57
57
  import { GenericDropdown } from "../../../../../../../shared/components/generic-dropdown";
58
58
  import { VcIcon, ChevronUpIcon } from "../../../../..";
59
59
  import { IWidget } from "../../../../../../../core/services";
60
+ import { BladeInstance } from "../../../../../../../injection-keys";
61
+ import { IBladeInstance } from "../../../../../../../shared/components/blade-navigation/types";
60
62
 
61
63
  interface Props {
62
64
  widgets: IWidget[];
65
+ bladeId: string;
63
66
  }
64
67
 
65
68
  const props = defineProps<Props>();
66
69
  const containerRef = ref<HTMLElement | null>(null);
67
70
  const showToolbar = ref(false);
71
+ const bladeInstance = inject<IBladeInstance>(BladeInstance);
68
72
 
69
- const isAnyVisible = computed(() => props.widgets.some((widget) => widget.isVisible));
73
+ const isAnyVisible = computed(() =>
74
+ props.widgets.some((widget) => {
75
+ if (typeof widget.isVisible === "function") {
76
+ return widget.isVisible(bladeInstance);
77
+ } else if (typeof widget.isVisible === "boolean") {
78
+ return widget.isVisible;
79
+ }
80
+ return widget.isVisible;
81
+ }),
82
+ );
70
83
 
71
84
  const { visibleItems, showMoreButton, recalculate, hiddenItems, updateObserver } = useAdaptiveItems<IWidget>({
72
85
  containerRef,
@@ -14,9 +14,11 @@
14
14
  </template>
15
15
 
16
16
  <script setup lang="ts">
17
- import { computed, toValue } from "vue";
17
+ import { computed, toValue, inject } from "vue";
18
18
  import { useWidgets } from "../../../../../../core/composables/useWidgets";
19
19
  import { WidgetContainerDesktop, WidgetContainerMobile } from "./_internal";
20
+ import { BladeInstance } from "../../../../../../injection-keys";
21
+ import { IBladeInstance } from "../../../../../../shared/components/blade-navigation/types";
20
22
 
21
23
  interface Props {
22
24
  bladeId: string;
@@ -25,11 +27,12 @@ interface Props {
25
27
  const props = defineProps<Props>();
26
28
  const widgetService = useWidgets();
27
29
  const widgets = computed(() => widgetService.getWidgets(props.bladeId));
30
+ const bladeInstance = inject<IBladeInstance>(BladeInstance);
28
31
 
29
32
  const visibleWidgets = computed(() =>
30
33
  widgets.value.filter((widget) => {
31
34
  if (typeof widget.isVisible === "function") {
32
- return widget.isVisible();
35
+ return widget.isVisible(bladeInstance);
33
36
  } else if (typeof widget.isVisible === "boolean") {
34
37
  return widget.isVisible;
35
38
  }
@@ -125,7 +125,7 @@
125
125
  </template>
126
126
  <!-- eslint-disable @typescript-eslint/no-explicit-any -->
127
127
  <script lang="ts" setup>
128
- import { computed, ref, toValue, inject, useSlots, defineComponent, h } from "vue";
128
+ import { computed, ref, toValue, inject, useSlots, defineComponent, h, getCurrentInstance } from "vue";
129
129
  import { IBladeToolbar } from "../../../../core/types";
130
130
  import { usePopup, useBladeNavigation } from "../../../../shared";
131
131
  import { useI18n } from "vue-i18n";
@@ -212,6 +212,8 @@ const blade = inject(
212
212
  maximized: false,
213
213
  navigation: undefined,
214
214
  breadcrumbs: undefined,
215
+ param: undefined,
216
+ options: undefined,
215
217
  })),
216
218
  );
217
219
 
@@ -241,6 +243,8 @@ const { open } = usePopup({
241
243
  }),
242
244
  },
243
245
  });
246
+
247
+ console.log(getCurrentInstance());
244
248
  </script>
245
249
 
246
250
  <style lang="scss">