@vc-shell/framework 1.1.40 → 1.1.42
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 +13 -0
- package/dist/framework.js +1 -1
- package/dist/{index-BVZ7ITWk.js → index-4DWvmoYg.js} +1 -1
- package/dist/{index-B2RWMePi.js → index-52o7mJaX.js} +1 -1
- package/dist/{index-DjvWRavy.js → index-B0KatioT.js} +1 -1
- package/dist/{index-dHHKh9VT.js → index-BP3W8zuk.js} +1 -1
- package/dist/{index-DHtGcfen.js → index-BykT5L1A.js} +14569 -14542
- package/dist/{index-v8WySS31.js → index-CfXo9hsG.js} +1 -1
- package/dist/{index-CNmagx1Y.js → index-Ch37pBUt.js} +1 -1
- package/dist/{index-CgzhIDHU.js → index-D2KGkAYT.js} +1 -1
- package/dist/{index-NypPe4C-.js → index-D83zQom_.js} +1 -1
- package/dist/{index-DEubScbm.js → index-DuQrVLbu.js} +1 -1
- package/dist/{index-DL9X15TB.js → index-_fdMid5h.js} +1 -1
- package/dist/{index-CgwF5LKi.js → index-a1wO-owY.js} +1 -1
- package/dist/{index-nrkGQAk1.js → index-crMpNSFe.js} +1 -1
- package/dist/{index-BAOBYTxv.js → index-dmBRpHHY.js} +1 -1
- package/dist/{index-jjVbrwZ7.js → index-kBdB14Fz.js} +1 -1
- package/dist/{index-C-NGshsT.js → index-uBhy41le.js} +1 -1
- package/dist/{index-D58L3xkh.js → index-zZrijNsr.js} +1 -1
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts +1 -1
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +25 -7
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/package.json +4 -4
- package/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +3 -3
- package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +97 -42
- package/ui/components/molecules/vc-select/vc-select.vue +12 -12
|
@@ -4,11 +4,14 @@ export type MaybeArray<T> = T | T[];
|
|
|
4
4
|
declare const _default: <T, P extends {
|
|
5
5
|
results?: T[];
|
|
6
6
|
totalCount?: number;
|
|
7
|
-
}>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
7
|
+
} | undefined>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
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 | (T & (
|
|
11
|
+
readonly "onUpdate:modelValue"?: ((inputValue: MaybeArray<string | (T & (P extends {
|
|
12
|
+
results?: T[];
|
|
13
|
+
totalCount?: number;
|
|
14
|
+
} ? Required<P>["results"] extends infer T_1 ? T_1 extends Required<P>["results"] ? T_1 extends (infer V)[] ? V : never : never : never : never))> | null) => any) | undefined;
|
|
12
15
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onClose" | "onUpdate:modelValue" | "onSearch"> & {
|
|
13
16
|
/**
|
|
14
17
|
* Name of select
|
|
@@ -75,14 +78,20 @@ declare const _default: <T, P extends {
|
|
|
75
78
|
* @param option The current option being processed
|
|
76
79
|
* @returns Value of the current option
|
|
77
80
|
*/
|
|
78
|
-
optionValue?: OptionProp<T & (
|
|
81
|
+
optionValue?: OptionProp<T & (P extends {
|
|
82
|
+
results?: T[];
|
|
83
|
+
totalCount?: number;
|
|
84
|
+
} ? Required<P>["results"] extends infer T_1 ? T_1 extends Required<P>["results"] ? T_1 extends (infer V)[] ? V : never : never : never : never)>;
|
|
79
85
|
/**
|
|
80
86
|
* Property of option which holds the 'label'
|
|
81
87
|
* @default title
|
|
82
88
|
* @param option The current option being processed
|
|
83
89
|
* @returns Label of the current option
|
|
84
90
|
*/
|
|
85
|
-
optionLabel?: OptionProp<T & (
|
|
91
|
+
optionLabel?: OptionProp<T & (P extends {
|
|
92
|
+
results?: T[];
|
|
93
|
+
totalCount?: number;
|
|
94
|
+
} ? Required<P>["results"] extends infer T_2 ? T_2 extends Required<P>["results"] ? T_2 extends (infer V)[] ? V : never : never : never : never)>;
|
|
86
95
|
/**
|
|
87
96
|
* Update model with the value of the selected option instead of the whole option
|
|
88
97
|
*/
|
|
@@ -165,7 +174,10 @@ declare const _default: <T, P extends {
|
|
|
165
174
|
/**
|
|
166
175
|
* Selected option -- its value is taken from model
|
|
167
176
|
*/
|
|
168
|
-
opt: T & (
|
|
177
|
+
opt: T & (P extends {
|
|
178
|
+
results?: T[];
|
|
179
|
+
totalCount?: number;
|
|
180
|
+
} ? Required<P>["results"] extends infer T_3 ? T_3 extends Required<P>["results"] ? T_3 extends (infer V)[] ? V : never : never : never : never);
|
|
169
181
|
/**
|
|
170
182
|
* Always true -- passed as prop
|
|
171
183
|
*/
|
|
@@ -187,7 +199,10 @@ declare const _default: <T, P extends {
|
|
|
187
199
|
/**
|
|
188
200
|
* Option -- its value is taken from 'options' prop
|
|
189
201
|
*/
|
|
190
|
-
opt: T & (
|
|
202
|
+
opt: T & (P extends {
|
|
203
|
+
results?: T[];
|
|
204
|
+
totalCount?: number;
|
|
205
|
+
} ? Required<P>["results"] extends infer T_3 ? T_3 extends Required<P>["results"] ? T_3 extends (infer V)[] ? V : never : never : never : never);
|
|
191
206
|
/**
|
|
192
207
|
* Is option selected
|
|
193
208
|
*/
|
|
@@ -200,7 +215,10 @@ declare const _default: <T, P extends {
|
|
|
200
215
|
}) => any;
|
|
201
216
|
"no-options": (props: any) => any;
|
|
202
217
|
};
|
|
203
|
-
emit: ((evt: "search", inputValue: string) => void) & ((evt: "close") => void) & ((evt: "update:modelValue", inputValue: MaybeArray<string | (T & (
|
|
218
|
+
emit: ((evt: "search", inputValue: string) => void) & ((evt: "close") => void) & ((evt: "update:modelValue", inputValue: MaybeArray<string | (T & (P extends {
|
|
219
|
+
results?: T[];
|
|
220
|
+
totalCount?: number;
|
|
221
|
+
} ? Required<P>["results"] extends infer T_3 ? T_3 extends Required<P>["results"] ? T_3 extends (infer V)[] ? V : never : never : never : never))> | null) => void);
|
|
204
222
|
}>) => import("vue").VNode & {
|
|
205
223
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
206
224
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vc-select.vue.d.ts","sourceRoot":"","sources":["../../../../../ui/components/molecules/vc-select/vc-select.vue"],"names":[],"mappings":"AA+5CA,OAAO,EAQL,SAAS,EACV,MAAM,kBAAkB,CAAC;AAK1B,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC;AACzE,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;yBACnB,CAAC,EAAE,CAAC,SAAS;IAAE,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"vc-select.vue.d.ts","sourceRoot":"","sources":["../../../../../ui/components/molecules/vc-select/vc-select.vue"],"names":[],"mappings":"AA+5CA,OAAO,EAQL,SAAS,EACV,MAAM,kBAAkB,CAAC;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;YACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;SACxC,KAAK,GAAG;QACT;;WAEG;gBACK,CAAC,KAAK,EAAE;YACd;;eAEG;YACH,KAAK,EAAE,MAAM,CAAC;YACd;;eAEG;YACH,GAAG;0BAtEkC,CAAC,EAAE;6BAAe,MAAM;mHADhB,CAAC,yCAuElC;YACZ;;eAEG;YACH,QAAQ,EAAE,OAAO,CAAC;YAClB;;;eAGG;YACH,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;SAClC,KAAK,GAAG;sBACK,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG;;;kBAjFM,CAAC,EAAE;qBAAe,MAAM;2GADhB,CAAC;EA45C9C,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AA56CzE,wBA46C4E;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.
|
|
3
|
+
"version": "1.1.42",
|
|
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.
|
|
74
|
-
"@vc-shell/config-generator": "^1.1.
|
|
75
|
-
"@vc-shell/ts-config": "^1.1.
|
|
73
|
+
"@vc-shell/api-client-generator": "^1.1.42",
|
|
74
|
+
"@vc-shell/config-generator": "^1.1.42",
|
|
75
|
+
"@vc-shell/ts-config": "^1.1.42",
|
|
76
76
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
77
77
|
"@vue/test-utils": "^2.4.5",
|
|
78
78
|
"cypress-signalr-mock": "^1.5.0",
|
package/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue
CHANGED
|
@@ -121,9 +121,9 @@ const render = () => {
|
|
|
121
121
|
closeBlade(index);
|
|
122
122
|
},
|
|
123
123
|
"onParent:call": async (args: IParentCallArgs) => {
|
|
124
|
-
await nextTick(() => {
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
await nextTick(async () => {
|
|
125
|
+
// Use the centralized onParentCall with the current blade index
|
|
126
|
+
await onParentCall(args, index);
|
|
127
127
|
});
|
|
128
128
|
},
|
|
129
129
|
onVnodeUnmounted: resetInterceptor,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, getCurrentInstance, inject, warn, Component, ComputedRef, Ref, shallowRef } from "vue";
|
|
1
|
+
import { computed, getCurrentInstance, inject, warn, Component, ComputedRef, Ref, shallowRef, unref } from "vue";
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
import { createSharedComposable } from "@vueuse/core";
|
|
4
4
|
import * as _ from "lodash-es";
|
|
@@ -38,7 +38,7 @@ interface IUseBladeNavigation {
|
|
|
38
38
|
) => Promise<void | NavigationFailure>;
|
|
39
39
|
closeBlade: (index: number) => Promise<boolean>;
|
|
40
40
|
goToRoot: () => RouteLocationRaw;
|
|
41
|
-
onParentCall: (
|
|
41
|
+
onParentCall: (args: IParentCallArgs, currentBladeIndex?: number) => void;
|
|
42
42
|
onBeforeClose: (cb: () => Promise<boolean | undefined>) => void;
|
|
43
43
|
resolveBladeByName: (name: string) => BladeInstanceConstructor | undefined;
|
|
44
44
|
routeResolver: (to: RouteLocationNormalized) => Promise<RouteLocationRaw | undefined> | RouteLocationRaw | undefined;
|
|
@@ -125,17 +125,6 @@ const useBladeNavigationSingleton = createSharedComposable(() => {
|
|
|
125
125
|
routeResolver: routeResolverInstance,
|
|
126
126
|
setBladeError: bladeState.setBladeError,
|
|
127
127
|
clearBladeError: bladeState.clearBladeError,
|
|
128
|
-
onParentCall: async (parentExposedMethods: Record<string, any>, args: IParentCallArgs) => {
|
|
129
|
-
if (args.method && parentExposedMethods && typeof parentExposedMethods[args.method] === "function") {
|
|
130
|
-
const method = parentExposedMethods[args.method];
|
|
131
|
-
const result = await method(args.args);
|
|
132
|
-
if (typeof args.callback === "function") args.callback(result);
|
|
133
|
-
} else {
|
|
134
|
-
console.error(
|
|
135
|
-
`No such method: ${args.method}. Please, add method with name ${args.method} and use defineExpose to expose it in parent blade`,
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
128
|
onBeforeClose: (cb: () => Promise<boolean | undefined>) => {
|
|
140
129
|
const targetBlade = bladeState.activeWorkspace.value;
|
|
141
130
|
if (targetBlade && targetBlade.props.navigation) {
|
|
@@ -198,24 +187,43 @@ export function useBladeNavigation(): IUseBladeNavigation {
|
|
|
198
187
|
const singleton = useBladeNavigationSingleton() as typeof useBladeNavigationSingleton extends () => infer R
|
|
199
188
|
? R
|
|
200
189
|
: never;
|
|
201
|
-
console.log("useBladeNavigation singleton", singleton);
|
|
202
190
|
const currentCallingInstance = getCurrentInstance() as BladeComponentInternalInstance | null;
|
|
203
|
-
console.log("useBladeNavigation currentCallingInstance", currentCallingInstance);
|
|
204
191
|
const bladeRegistry = useBladeRegistry();
|
|
205
|
-
console.log("useBladeNavigation bladeRegistry", bladeRegistry);
|
|
206
192
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
193
|
+
// Find the closest parent blade in the component hierarchy
|
|
194
|
+
const findParentBlade = (instance: BladeComponentInternalInstance | null): BladeVNode | undefined => {
|
|
195
|
+
if (!instance) return undefined;
|
|
196
|
+
|
|
197
|
+
// Check if current instance provides navigationViewLocation
|
|
198
|
+
const viewNode = (instance as any).provides[navigationViewLocation as any] as BladeVNode | undefined;
|
|
199
|
+
if (viewNode) {
|
|
200
|
+
return viewNode;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Check if current instance is a blade itself
|
|
210
204
|
if (
|
|
211
|
-
|
|
205
|
+
instance.vnode &&
|
|
212
206
|
singleton.activeWorkspace.value &&
|
|
213
|
-
|
|
214
|
-
_.isEqual(currentCallingInstance.vnode.type, singleton.activeWorkspace.value.type)
|
|
207
|
+
_.isEqual(instance.vnode.type, singleton.activeWorkspace.value.type)
|
|
215
208
|
) {
|
|
216
|
-
return singleton.activeWorkspace.value
|
|
209
|
+
return singleton.activeWorkspace.value;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Check if current instance is in the blades list
|
|
213
|
+
const matchingBlade = singleton.blades.value.find(
|
|
214
|
+
(blade) => blade && instance.vnode && _.isEqual(blade.type, instance.vnode.type),
|
|
215
|
+
);
|
|
216
|
+
if (matchingBlade) {
|
|
217
|
+
return matchingBlade;
|
|
217
218
|
}
|
|
218
|
-
|
|
219
|
+
|
|
220
|
+
// Recursively check parent instance
|
|
221
|
+
return findParentBlade(instance.parent as BladeComponentInternalInstance | null);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const currentBladeNavigationData = computed(() => {
|
|
225
|
+
const parentBlade = findParentBlade(currentCallingInstance);
|
|
226
|
+
return parentBlade?.props?.navigation;
|
|
219
227
|
});
|
|
220
228
|
|
|
221
229
|
const onBeforeClose = (cb: () => Promise<boolean | undefined>) => {
|
|
@@ -223,22 +231,73 @@ export function useBladeNavigation(): IUseBladeNavigation {
|
|
|
223
231
|
warn("onBeforeClose called outside of a component setup context.");
|
|
224
232
|
return;
|
|
225
233
|
}
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
(b && viewNode && _.isEqual(b, viewNode)) ||
|
|
230
|
-
(b &&
|
|
231
|
-
b.props?.navigation?.idx === 0 &&
|
|
232
|
-
currentCallingInstance.vnode &&
|
|
233
|
-
_.isEqual(b.type, currentCallingInstance.vnode.type)),
|
|
234
|
-
);
|
|
235
|
-
if (targetBlade && targetBlade.props.navigation) {
|
|
236
|
-
targetBlade.props.navigation.onBeforeClose = cb;
|
|
234
|
+
const parentBlade = findParentBlade(currentCallingInstance);
|
|
235
|
+
if (parentBlade && parentBlade.props.navigation) {
|
|
236
|
+
parentBlade.props.navigation.onBeforeClose = cb;
|
|
237
237
|
} else {
|
|
238
238
|
warn("Context-specific onBeforeClose: Could not identify the target blade in the global list.");
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
+
const onParentCall = async (args: IParentCallArgs, currentBladeIndex?: number) => {
|
|
243
|
+
let bladeIndex = currentBladeIndex;
|
|
244
|
+
|
|
245
|
+
// If currentBladeIndex is not provided, try to find it from the component hierarchy
|
|
246
|
+
if (bladeIndex === undefined) {
|
|
247
|
+
if (!currentCallingInstance) {
|
|
248
|
+
warn("onParentCall called outside of a component setup context and without currentBladeIndex.");
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Find current blade in the blades list
|
|
253
|
+
const currentBlade = findParentBlade(currentCallingInstance);
|
|
254
|
+
if (!currentBlade) {
|
|
255
|
+
console.error("onParentCall: Could not identify current blade in the global list.");
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
bladeIndex = currentBlade.props.navigation?.idx ?? -1;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (bladeIndex <= 0) {
|
|
263
|
+
console.error("onParentCall: Current blade is workspace (index 0) or invalid, no parent blade available.");
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Find parent blade (blade with index bladeIndex - 1)
|
|
268
|
+
const parentBlade = singleton.blades.value.find((blade) => blade && blade.props.navigation?.idx === bladeIndex - 1);
|
|
269
|
+
|
|
270
|
+
if (!parentBlade) {
|
|
271
|
+
console.error(`onParentCall: Parent blade with index ${bladeIndex - 1} not found.`);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const parentExposedMethods = parentBlade.props.navigation?.instance;
|
|
276
|
+
|
|
277
|
+
if (!parentExposedMethods) {
|
|
278
|
+
console.error("onParentCall: Parent blade has no exposed methods (navigation.instance is undefined).");
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Try to get the method from exposed methods with Vue refs handling
|
|
283
|
+
const targetMethod = parentExposedMethods[args.method];
|
|
284
|
+
|
|
285
|
+
if (args.method && typeof targetMethod === "function") {
|
|
286
|
+
const result = await targetMethod(args.args);
|
|
287
|
+
if (typeof args.callback === "function") args.callback(result);
|
|
288
|
+
} else {
|
|
289
|
+
console.error(
|
|
290
|
+
`onParentCall: Method '${args.method}' is not available or not a function in parent blade '${parentBlade.type?.name}'.`,
|
|
291
|
+
);
|
|
292
|
+
console.error("Available properties:", Object.keys(parentExposedMethods));
|
|
293
|
+
console.error(`Requested method '${args.method}' type:`, typeof targetMethod);
|
|
294
|
+
console.error(`Requested method '${args.method}' value:`, targetMethod);
|
|
295
|
+
console.error(
|
|
296
|
+
`Please ensure that the method '${args.method}' is defined and exposed using defineExpose() in the parent blade component.`,
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
|
|
242
301
|
return {
|
|
243
302
|
blades: singleton.blades,
|
|
244
303
|
activeWorkspace: singleton.activeWorkspace,
|
|
@@ -246,12 +305,8 @@ export function useBladeNavigation(): IUseBladeNavigation {
|
|
|
246
305
|
args: IBladeEvent<Blade>,
|
|
247
306
|
isWorkspace?: boolean,
|
|
248
307
|
): Promise<void | NavigationFailure> => {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
sourceBladeInstanceForOpening = (currentCallingInstance as any).provides[navigationViewLocation as any] as
|
|
252
|
-
| BladeVNode
|
|
253
|
-
| undefined;
|
|
254
|
-
}
|
|
308
|
+
// Find the closest parent blade in the component hierarchy
|
|
309
|
+
let sourceBladeInstanceForOpening: BladeVNode | undefined = findParentBlade(currentCallingInstance);
|
|
255
310
|
|
|
256
311
|
if (!sourceBladeInstanceForOpening) {
|
|
257
312
|
sourceBladeInstanceForOpening = singleton.activeWorkspace.value;
|
|
@@ -266,7 +321,7 @@ export function useBladeNavigation(): IUseBladeNavigation {
|
|
|
266
321
|
},
|
|
267
322
|
closeBlade: singleton.closeBlade,
|
|
268
323
|
goToRoot: singleton.goToRoot,
|
|
269
|
-
onParentCall
|
|
324
|
+
onParentCall,
|
|
270
325
|
resolveBladeByName: (name: string) => bladeRegistry.getBladeComponent(name),
|
|
271
326
|
routeResolver: singleton.routeResolver,
|
|
272
327
|
currentBladeNavigationData,
|
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
</template>
|
|
330
330
|
|
|
331
331
|
<!-- eslint-disable @typescript-eslint/no-explicit-any -->
|
|
332
|
-
<script lang="ts" setup generic="T, P extends { results?: T[]; totalCount?: number }">
|
|
332
|
+
<script lang="ts" setup generic="T, P extends { results?: T[]; totalCount?: number } | undefined">
|
|
333
333
|
import { ref, computed, watch, nextTick, Ref, toRefs, onMounted, onUnmounted } from "vue";
|
|
334
334
|
import { vOnClickOutside } from "@vueuse/components";
|
|
335
335
|
import * as _ from "lodash-es";
|
|
@@ -361,13 +361,13 @@ type FloatingInstanceType = UseFloatingReturn & {
|
|
|
361
361
|
};
|
|
362
362
|
};
|
|
363
363
|
type ArrayElementType<U> = U extends Array<infer V> ? V : never;
|
|
364
|
-
type Option = T & ArrayElementType<Required<P>["results"]
|
|
364
|
+
type Option = T & (P extends { results?: T[]; totalCount?: number } ? ArrayElementType<Required<P>["results"]> : never);
|
|
365
365
|
|
|
366
366
|
defineSlots<{
|
|
367
367
|
/**
|
|
368
368
|
* Custom select control
|
|
369
369
|
*/
|
|
370
|
-
control: (scope: { toggleHandler: () => void
|
|
370
|
+
control: (scope: { toggleHandler: () => void; isOpened: boolean }) => any;
|
|
371
371
|
/**
|
|
372
372
|
* Prepend inner field
|
|
373
373
|
*/
|
|
@@ -832,11 +832,11 @@ async function loadOptionsForOpenDropdown() {
|
|
|
832
832
|
listLoading.value = true;
|
|
833
833
|
const data = await props.options(filterString.value, optionsList.value.length);
|
|
834
834
|
if (filterString.value || optionsList.value.length === 0) {
|
|
835
|
-
optionsList.value = (data
|
|
835
|
+
optionsList.value = (data?.results as Option[]) || [];
|
|
836
836
|
} else {
|
|
837
|
-
optionsList.value = _.unionBy<Option>(optionsList.value, (data
|
|
837
|
+
optionsList.value = _.unionBy<Option>(optionsList.value, (data?.results as Option[]) || [], "id");
|
|
838
838
|
}
|
|
839
|
-
totalItems.value = data
|
|
839
|
+
totalItems.value = data?.totalCount || 0;
|
|
840
840
|
optionsTemp.value = optionsList.value;
|
|
841
841
|
} catch (e) {
|
|
842
842
|
console.error("Error in loadOptionsForOpenDropdown:", e);
|
|
@@ -853,9 +853,9 @@ async function onLoadMore() {
|
|
|
853
853
|
try {
|
|
854
854
|
listLoading.value = true;
|
|
855
855
|
const data = await props.options(filterString.value, optionsList.value.length);
|
|
856
|
-
optionsList.value = _.unionBy<Option>(optionsList.value, data
|
|
856
|
+
optionsList.value = _.unionBy<Option>(optionsList.value, data?.results as Option[], "id");
|
|
857
857
|
|
|
858
|
-
totalItems.value = data
|
|
858
|
+
totalItems.value = data?.totalCount;
|
|
859
859
|
optionsTemp.value = optionsList.value;
|
|
860
860
|
} finally {
|
|
861
861
|
listLoading.value = false;
|
|
@@ -997,8 +997,8 @@ const onDropdownClose = async () => {
|
|
|
997
997
|
try {
|
|
998
998
|
listLoading.value = true;
|
|
999
999
|
const data = await props.options(undefined, 0);
|
|
1000
|
-
optionsList.value = (data
|
|
1001
|
-
totalItems.value = data
|
|
1000
|
+
optionsList.value = (data?.results as Option[]) || [];
|
|
1001
|
+
totalItems.value = data?.totalCount || 0;
|
|
1002
1002
|
} catch (e) {
|
|
1003
1003
|
console.error("Error resetting optionsList on dropdown close:", e);
|
|
1004
1004
|
optionsList.value = [];
|
|
@@ -1130,8 +1130,8 @@ async function onSearch(value: string) {
|
|
|
1130
1130
|
|
|
1131
1131
|
const data = await props.options(filterString.value);
|
|
1132
1132
|
|
|
1133
|
-
optionsList.value = data
|
|
1134
|
-
totalItems.value = data
|
|
1133
|
+
optionsList.value = data?.results as Option[];
|
|
1134
|
+
totalItems.value = data?.totalCount;
|
|
1135
1135
|
} finally {
|
|
1136
1136
|
listLoading.value = false;
|
|
1137
1137
|
}
|