@vc-shell/framework 1.0.192 → 1.0.194
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 +23 -0
- package/dist/framework.js +13664 -13584
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts +2 -0
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts +1 -0
- package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts +0 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts.map +1 -1
- package/package.json +4 -4
- package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +90 -23
- package/shared/modules/dynamic/factories/base/useDetailsFactory.ts +2 -1
- package/shared/modules/dynamic/factories/types/index.ts +1 -0
- package/shared/modules/dynamic/pages/dynamic-blade-list.vue +7 -4
- package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +20 -6
- package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +0 -2
- package/ui/components/organisms/vc-table/vc-table.vue +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vc-app-menu-link.vue.d.ts","sourceRoot":"","sources":["../../../../../../../../../../ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAIjE,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"vc-app-menu-link.vue.d.ts","sourceRoot":"","sources":["../../../../../../../../../../ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAIjE,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,KAAK;IACpB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC3C;;;;;;;;;;;;AAuOD,wBAOG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vc-app-menu-item.vue.d.ts","sourceRoot":"","sources":["../../../../../../../../../ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,MAAM,WAAW,KAAK;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,KAAK;IACpB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CACzC;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"vc-app-menu-item.vue.d.ts","sourceRoot":"","sources":["../../../../../../../../../ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,MAAM,WAAW,KAAK;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,KAAK;IACpB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CACzC;;;;;;;;;;;;;;;;;AA2HD,wBAOG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,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.0.
|
|
3
|
+
"version": "1.0.194",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/framework.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/dompurify": "^3.0.5",
|
|
61
61
|
"@types/quill": "^2.0.14",
|
|
62
|
-
"@vc-shell/api-client-generator": "^1.0.
|
|
63
|
-
"@vc-shell/config-generator": "^1.0.
|
|
64
|
-
"@vc-shell/ts-config": "^1.0.
|
|
62
|
+
"@vc-shell/api-client-generator": "^1.0.194",
|
|
63
|
+
"@vc-shell/config-generator": "^1.0.194",
|
|
64
|
+
"@vc-shell/ts-config": "^1.0.194",
|
|
65
65
|
"@vitejs/plugin-vue": "^5.0.3",
|
|
66
66
|
"sass": "^1.69.6",
|
|
67
67
|
"shx": "^0.3.4",
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
inject,
|
|
6
6
|
warn,
|
|
7
7
|
Component,
|
|
8
|
-
watch,
|
|
9
8
|
isVNode,
|
|
10
9
|
h,
|
|
11
10
|
shallowRef,
|
|
@@ -13,9 +12,17 @@ import {
|
|
|
13
12
|
mergeProps,
|
|
14
13
|
} from "vue";
|
|
15
14
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
16
|
-
import { createSharedComposable, reactiveComputed,
|
|
15
|
+
import { createSharedComposable, reactiveComputed, watchDebounced } from "@vueuse/core";
|
|
17
16
|
import * as _ from "lodash-es";
|
|
18
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
RouteLocationNormalized,
|
|
19
|
+
useRoute,
|
|
20
|
+
NavigationFailure,
|
|
21
|
+
RouteRecordName,
|
|
22
|
+
RouteParams,
|
|
23
|
+
Router,
|
|
24
|
+
LocationQuery,
|
|
25
|
+
} from "vue-router";
|
|
19
26
|
import { bladeNavigationInstance } from "../../plugin";
|
|
20
27
|
import {
|
|
21
28
|
BladeComponentInternalInstance,
|
|
@@ -55,6 +62,8 @@ interface IUseBladeNavigation {
|
|
|
55
62
|
>
|
|
56
63
|
| undefined;
|
|
57
64
|
getCurrentBlade: () => BladeVNode;
|
|
65
|
+
setNavigationQuery: (query: Record<string, string | number>) => void;
|
|
66
|
+
getNavigationQuery: () => Record<string, string | number>;
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
const activeWorkspace = shallowRef<BladeVNode>();
|
|
@@ -93,16 +102,33 @@ const utils = (router: Router) => {
|
|
|
93
102
|
}
|
|
94
103
|
|
|
95
104
|
function parseWorkspaceUrl(path: string): string {
|
|
96
|
-
|
|
97
|
-
|
|
105
|
+
// Object.values(route.params)[0] will always be base path of the app
|
|
106
|
+
if (!mainRouteBaseParamURL.value) {
|
|
107
|
+
mainRouteBaseParamURL.value = "/" + (Object.values(route.params)?.[0] ?? "");
|
|
108
|
+
}
|
|
109
|
+
const pathWithoutBase = path.startsWith(mainRouteBaseParamURL.value)
|
|
110
|
+
? path.slice(mainRouteBaseParamURL.value.length)
|
|
111
|
+
: path;
|
|
98
112
|
const segments = pathWithoutBase.split("/").filter(Boolean);
|
|
99
113
|
const workspaceUrl = segments.slice(0, 1).join("/");
|
|
100
114
|
return "/" + workspaceUrl;
|
|
101
115
|
}
|
|
102
116
|
|
|
117
|
+
function getURLQuery() {
|
|
118
|
+
if (route.query && Object.keys(route.query).length) {
|
|
119
|
+
return { params: new URLSearchParams(route.query as Record<string, string>).toString(), obj: route.query };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const [, query] = window.location.href.split("#")[1].split("?");
|
|
123
|
+
const params = new URLSearchParams(query).toString();
|
|
124
|
+
|
|
125
|
+
return { params, obj: Object.fromEntries(new URLSearchParams(query)) };
|
|
126
|
+
}
|
|
127
|
+
|
|
103
128
|
return {
|
|
104
129
|
parseUrl,
|
|
105
130
|
parseWorkspaceUrl,
|
|
131
|
+
getURLQuery,
|
|
106
132
|
};
|
|
107
133
|
};
|
|
108
134
|
|
|
@@ -114,7 +140,7 @@ const useBladeNavigationSingleton = createSharedComposable(() => {
|
|
|
114
140
|
(instance !== null && inject<BladeNavigationPlugin>("bladeNavigationPlugin")) || bladeNavigationInstance;
|
|
115
141
|
const router = navigationInstance?.router;
|
|
116
142
|
|
|
117
|
-
const { parseUrl, parseWorkspaceUrl } = utils(router);
|
|
143
|
+
const { parseUrl, parseWorkspaceUrl, getURLQuery } = utils(router);
|
|
118
144
|
|
|
119
145
|
watchDebounced(
|
|
120
146
|
() => route.path,
|
|
@@ -173,8 +199,7 @@ const useBladeNavigationSingleton = createSharedComposable(() => {
|
|
|
173
199
|
if (workspace?.type?.url) {
|
|
174
200
|
const url = constructUrl(workspace, lastBlade);
|
|
175
201
|
if (url) {
|
|
176
|
-
|
|
177
|
-
updateRouterHistory(url, query);
|
|
202
|
+
updateRouterHistory(url);
|
|
178
203
|
}
|
|
179
204
|
}
|
|
180
205
|
},
|
|
@@ -200,11 +225,13 @@ const useBladeNavigationSingleton = createSharedComposable(() => {
|
|
|
200
225
|
}
|
|
201
226
|
}
|
|
202
227
|
|
|
203
|
-
function updateRouterHistory(url: string
|
|
228
|
+
function updateRouterHistory(url: string) {
|
|
229
|
+
const params = getURLQuery().params;
|
|
230
|
+
|
|
204
231
|
router.options.history.replace(
|
|
205
232
|
(mainRouteBaseParamURL.value && !url.startsWith(mainRouteBaseParamURL.value) ? mainRouteBaseParamURL.value : "") +
|
|
206
233
|
url +
|
|
207
|
-
(
|
|
234
|
+
(params ? "?" + params : ""),
|
|
208
235
|
);
|
|
209
236
|
}
|
|
210
237
|
|
|
@@ -259,11 +286,15 @@ export function useBladeNavigation(): IUseBladeNavigation {
|
|
|
259
286
|
const instance: BladeComponentInternalInstance = getCurrentInstance() as BladeComponentInternalInstance;
|
|
260
287
|
|
|
261
288
|
const { router, route, navigationInstance, closeBlade } = useBladeNavigationSingleton();
|
|
262
|
-
const { parseUrl } = utils(router);
|
|
289
|
+
const { parseUrl, getURLQuery } = utils(router);
|
|
263
290
|
const routerRoutes = router.getRoutes();
|
|
264
291
|
const mainRoute = routerRoutes.find((r) => r.meta?.root)!;
|
|
265
292
|
|
|
266
|
-
async function openWorkspace<Blade extends Component>(
|
|
293
|
+
async function openWorkspace<Blade extends Component>(
|
|
294
|
+
{ blade, param, options }: IBladeEvent<Blade>,
|
|
295
|
+
query: LocationQuery | undefined = undefined,
|
|
296
|
+
params: RouteParams = {},
|
|
297
|
+
) {
|
|
267
298
|
const createdComponent = h(blade, {
|
|
268
299
|
param,
|
|
269
300
|
options,
|
|
@@ -284,8 +315,7 @@ export function useBladeNavigation(): IUseBladeNavigation {
|
|
|
284
315
|
if (wsroute && wsroute.components) {
|
|
285
316
|
wsroute.components.default = createdComponent;
|
|
286
317
|
}
|
|
287
|
-
|
|
288
|
-
return await router.replace({ name: wsroute?.name, params: { ...route.params } });
|
|
318
|
+
return await router.replace({ name: wsroute?.name, params: { ...params, ...route.params }, query });
|
|
289
319
|
} else
|
|
290
320
|
notification.error(i18n.global.t("PERMISSION_MESSAGES.ACCESS_RESTRICTED"), {
|
|
291
321
|
timeout: 3000,
|
|
@@ -454,18 +484,15 @@ export function useBladeNavigation(): IUseBladeNavigation {
|
|
|
454
484
|
|
|
455
485
|
// Open the workspace component or workspace route.
|
|
456
486
|
if (registeredRouteComponent?.type.isWorkspace) {
|
|
457
|
-
await
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
},
|
|
461
|
-
true,
|
|
462
|
-
);
|
|
487
|
+
await openWorkspace({
|
|
488
|
+
blade: registeredRouteComponent as unknown as BladeInstanceConstructor,
|
|
489
|
+
});
|
|
463
490
|
return { name: registeredRouteComponent?.type.name, params };
|
|
464
491
|
}
|
|
465
492
|
|
|
466
493
|
// Open the workspace component with param or workspace route.
|
|
467
494
|
if (registeredWorkspaceComponent) {
|
|
468
|
-
await
|
|
495
|
+
await openWorkspace(
|
|
469
496
|
{
|
|
470
497
|
blade: registeredWorkspaceComponent as unknown as BladeInstanceConstructor,
|
|
471
498
|
param:
|
|
@@ -473,7 +500,8 @@ export function useBladeNavigation(): IUseBladeNavigation {
|
|
|
473
500
|
? param
|
|
474
501
|
: undefined,
|
|
475
502
|
},
|
|
476
|
-
|
|
503
|
+
getURLQuery().obj,
|
|
504
|
+
params,
|
|
477
505
|
);
|
|
478
506
|
|
|
479
507
|
// Open the route if it's not from the workspace module.
|
|
@@ -486,7 +514,7 @@ export function useBladeNavigation(): IUseBladeNavigation {
|
|
|
486
514
|
param: param,
|
|
487
515
|
});
|
|
488
516
|
}
|
|
489
|
-
return { name: registeredWorkspaceComponent?.type.name, params };
|
|
517
|
+
return { name: registeredWorkspaceComponent?.type.name, params, query: to.query };
|
|
490
518
|
}
|
|
491
519
|
} else {
|
|
492
520
|
return goToRoot();
|
|
@@ -519,6 +547,43 @@ export function useBladeNavigation(): IUseBladeNavigation {
|
|
|
519
547
|
}
|
|
520
548
|
}
|
|
521
549
|
|
|
550
|
+
function setNavigationQuery(query: Record<string, string | number>) {
|
|
551
|
+
// add blade name to query keys
|
|
552
|
+
const namedQuery = _.mapKeys(
|
|
553
|
+
_.mapValues(query, (value) => value?.toString()),
|
|
554
|
+
(value, key) => instance.vnode.type.name.toLowerCase() + "_" + key,
|
|
555
|
+
);
|
|
556
|
+
const cleanQuery = _.omitBy(namedQuery, _.isNil);
|
|
557
|
+
|
|
558
|
+
router.options.history.replace(
|
|
559
|
+
decodeURIComponent(
|
|
560
|
+
`${window.location.hash.substring(1).split("?")[0]}?${new URLSearchParams(cleanQuery).toString()}`,
|
|
561
|
+
),
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function getNavigationQuery() {
|
|
566
|
+
const queryKeys = Array.from(Object.keys(route.query));
|
|
567
|
+
const bladeQueryKeys = queryKeys.filter((key) => key.startsWith(instance.vnode.type.name.toLowerCase()));
|
|
568
|
+
|
|
569
|
+
const namedQuery = _.mapKeys(_.pick(route.query, bladeQueryKeys), (value, key) =>
|
|
570
|
+
key.replace(instance.vnode.type.name.toLowerCase() + "_", ""),
|
|
571
|
+
) as Record<string, string | number>;
|
|
572
|
+
|
|
573
|
+
const obj: typeof namedQuery = {};
|
|
574
|
+
for (const [key, value] of Object.entries(namedQuery)) {
|
|
575
|
+
const numValue = Number(value);
|
|
576
|
+
|
|
577
|
+
if (!isNaN(numValue)) {
|
|
578
|
+
obj[key] = numValue;
|
|
579
|
+
} else {
|
|
580
|
+
obj[key] = value;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
return obj;
|
|
585
|
+
}
|
|
586
|
+
|
|
522
587
|
return {
|
|
523
588
|
blades: computed(() => navigationInstance.blades.value),
|
|
524
589
|
openBlade,
|
|
@@ -529,5 +594,7 @@ export function useBladeNavigation(): IUseBladeNavigation {
|
|
|
529
594
|
getCurrentBlade,
|
|
530
595
|
currentBladeNavigationData,
|
|
531
596
|
onBeforeClose,
|
|
597
|
+
setNavigationQuery,
|
|
598
|
+
getNavigationQuery,
|
|
532
599
|
};
|
|
533
600
|
}
|
|
@@ -13,7 +13,7 @@ export interface UseDetailsFactoryParams<Item> {
|
|
|
13
13
|
|
|
14
14
|
export const useDetailsFactory = <Item>(factoryParams: UseDetailsFactoryParams<Item>) => {
|
|
15
15
|
return function useDetails(): UseDetails<Item> {
|
|
16
|
-
const { setFieldError, setErrors, validate, setFieldValue, setValues } = useForm({
|
|
16
|
+
const { setFieldError, setErrors, validate, setFieldValue, setValues, errorBag } = useForm({
|
|
17
17
|
validateOnMount: false,
|
|
18
18
|
});
|
|
19
19
|
const item = ref<Item>();
|
|
@@ -57,6 +57,7 @@ export const useDetailsFactory = <Item>(factoryParams: UseDetailsFactoryParams<I
|
|
|
57
57
|
setValues,
|
|
58
58
|
resetModified,
|
|
59
59
|
validate,
|
|
60
|
+
errorBag,
|
|
60
61
|
}),
|
|
61
62
|
);
|
|
62
63
|
|
|
@@ -173,7 +173,7 @@ import { notification, useBladeNavigation, usePopup } from "../../../components"
|
|
|
173
173
|
import { ListBaseBladeScope, ListBladeContext, UseList } from "../factories/types";
|
|
174
174
|
import { IParentCallArgs } from "../../../index";
|
|
175
175
|
import * as _ from "lodash-es";
|
|
176
|
-
import {
|
|
176
|
+
import { toReactive, useMounted } from "@vueuse/core";
|
|
177
177
|
import { safeIn } from "../helpers/safeIn";
|
|
178
178
|
|
|
179
179
|
export interface Props {
|
|
@@ -219,6 +219,7 @@ const itemsProxy = ref<Record<string, any>[]>();
|
|
|
219
219
|
const modified = shallowRef(false);
|
|
220
220
|
|
|
221
221
|
const { moduleNotifications, markAsRead } = useNotifications(settings.value?.pushNotificationType);
|
|
222
|
+
const { setNavigationQuery, getNavigationQuery } = useBladeNavigation();
|
|
222
223
|
|
|
223
224
|
watch(
|
|
224
225
|
moduleNotifications,
|
|
@@ -381,7 +382,7 @@ const toolbarComputed =
|
|
|
381
382
|
[];
|
|
382
383
|
|
|
383
384
|
onBeforeMount(async () => {
|
|
384
|
-
if (props.composables) await load({ sort: sort.value, ...query.value });
|
|
385
|
+
if (props.composables) await load({ sort: sort.value, ...query.value, ...getNavigationQuery() });
|
|
385
386
|
});
|
|
386
387
|
|
|
387
388
|
watch(
|
|
@@ -530,10 +531,12 @@ const onPaginationClick = async (page: number) => {
|
|
|
530
531
|
|
|
531
532
|
return;
|
|
532
533
|
}
|
|
533
|
-
|
|
534
|
+
const queryObj = {
|
|
534
535
|
...query.value,
|
|
535
536
|
skip: (page - 1) * query.value.take,
|
|
536
|
-
}
|
|
537
|
+
};
|
|
538
|
+
setNavigationQuery(queryObj);
|
|
539
|
+
await load(queryObj);
|
|
537
540
|
}
|
|
538
541
|
};
|
|
539
542
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
class="vc-app-menu-item"
|
|
4
4
|
:class="[
|
|
5
5
|
{
|
|
6
|
-
'vc-app-menu-item_active': isActive && !children?.length,
|
|
6
|
+
'vc-app-menu-item_active': isActive(url ?? '') && !children?.length,
|
|
7
7
|
'vc-app-menu-item_no-hover': !children?.length,
|
|
8
8
|
'vc-app-menu-item_child-opened': isOpened,
|
|
9
9
|
},
|
|
@@ -48,16 +48,15 @@
|
|
|
48
48
|
:key="i"
|
|
49
49
|
>
|
|
50
50
|
<router-link
|
|
51
|
-
v-if="$hasAccess(nested.permissions!)"
|
|
52
|
-
|
|
53
|
-
:to="nested.url!"
|
|
51
|
+
v-if="$hasAccess(nested.permissions!) && nested.url"
|
|
52
|
+
:to="nested.url"
|
|
54
53
|
custom
|
|
55
54
|
>
|
|
56
55
|
<div
|
|
57
56
|
:key="i"
|
|
58
57
|
:class="[
|
|
59
58
|
{
|
|
60
|
-
'vc-app-menu-item__child-item_active':
|
|
59
|
+
'vc-app-menu-item__child-item_active': isActive(nested.url ?? ''),
|
|
61
60
|
},
|
|
62
61
|
'vc-app-menu-item__child-item',
|
|
63
62
|
]"
|
|
@@ -81,7 +80,6 @@ export interface Props {
|
|
|
81
80
|
icon: string;
|
|
82
81
|
title?: string;
|
|
83
82
|
url?: string;
|
|
84
|
-
isActive?: boolean;
|
|
85
83
|
}
|
|
86
84
|
|
|
87
85
|
export interface Emits {
|
|
@@ -96,6 +94,7 @@ const emit = defineEmits<Emits>();
|
|
|
96
94
|
|
|
97
95
|
const isOpened = ref(false);
|
|
98
96
|
const route = useRoute();
|
|
97
|
+
const params = Object.fromEntries(Object.entries(route.params).filter(([key]) => key !== "pathMatch"));
|
|
99
98
|
|
|
100
99
|
watch(
|
|
101
100
|
() => route.path,
|
|
@@ -114,6 +113,21 @@ function onMenuItemClick() {
|
|
|
114
113
|
isOpened.value = !isOpened.value;
|
|
115
114
|
}
|
|
116
115
|
}
|
|
116
|
+
|
|
117
|
+
const isActive = (url: string) => {
|
|
118
|
+
let path = route.path;
|
|
119
|
+
if (Object.values(params).length) {
|
|
120
|
+
path = path.replace(Object.values(params)[0] as string, "");
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const active = path.endsWith(url);
|
|
124
|
+
|
|
125
|
+
if (active && props.children?.length) {
|
|
126
|
+
isOpened.value = true;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return active;
|
|
130
|
+
};
|
|
117
131
|
</script>
|
|
118
132
|
|
|
119
133
|
<style lang="scss">
|