@vc-shell/framework 1.0.191 → 1.0.192

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 +14 -0
  2. package/core/plugins/modularity/index.ts +9 -2
  3. package/dist/core/plugins/modularity/index.d.ts.map +1 -1
  4. package/dist/framework.js +11901 -11824
  5. package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts +5 -2
  6. package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
  7. package/dist/shared/components/blade-navigation/types/index.d.ts +0 -1
  8. package/dist/shared/components/blade-navigation/types/index.d.ts.map +1 -1
  9. package/dist/shared/modules/dynamic/index.d.ts.map +1 -1
  10. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +8 -9
  11. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
  12. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts +1 -0
  15. 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
  16. 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
  17. package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
  18. package/package.json +4 -4
  19. package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +235 -191
  20. package/shared/components/blade-navigation/plugin.ts +1 -1
  21. package/shared/components/blade-navigation/types/index.ts +0 -1
  22. package/shared/modules/dynamic/index.ts +5 -0
  23. package/shared/modules/dynamic/pages/dynamic-blade-form.vue +4 -1
  24. package/shared/modules/dynamic/pages/dynamic-blade-list.vue +5 -1
  25. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +4 -15
  26. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +2 -0
  27. package/ui/components/organisms/vc-app/vc-app.vue +8 -1
  28. package/ui/components/organisms/vc-table/vc-table.vue +2 -2
@@ -44,6 +44,7 @@ const register = (
44
44
  composables: { [key: string]: (...args: any[]) => any };
45
45
  json: DynamicSchema;
46
46
  options?: { router: any };
47
+ moduleUid: string;
47
48
  },
48
49
  appModuleContent:
49
50
  | {
@@ -73,7 +74,9 @@ const register = (
73
74
  name: bladeName,
74
75
  isWorkspace: "isWorkspace" in json.settings && json.settings.isWorkspace,
75
76
  menuItem: ("menuItem" in json.settings && json.settings.menuItem) ?? undefined,
77
+ moduleUid: args.moduleUid,
76
78
  routable: json.settings.routable ?? true,
79
+ composables: args.composables,
77
80
  setup: (props: ComponentProps<typeof bladeComponent>, ctx) =>
78
81
  (bladeComponent?.setup &&
79
82
  bladeComponent.setup(
@@ -146,6 +149,7 @@ export const createDynamicAppModule = (args: {
146
149
  notificationTemplates: args?.notificationTemplates,
147
150
  moduleComponents: args?.moduleComponents,
148
151
  };
152
+ const moduleUid = _.uniqueId("module_");
149
153
  Object.entries(schemaCopy).forEach(([, JsonSchema], index) => {
150
154
  const blade = register(
151
155
  {
@@ -154,6 +158,7 @@ export const createDynamicAppModule = (args: {
154
158
  composables: { ...args.composables },
155
159
  json: JsonSchema,
156
160
  options,
161
+ moduleUid,
157
162
  },
158
163
  index === 0 ? appModuleContent : undefined,
159
164
  );
@@ -97,7 +97,6 @@ import { VcSelect } from "../../../../ui/components";
97
97
  import { useToolbarReducer } from "../composables/useToolbarReducer";
98
98
  import { useBeforeUnload } from "../../../../core/composables/useBeforeUnload";
99
99
  import * as _ from "lodash-es";
100
- import { IBladeToolbar } from "../../../../core/types";
101
100
  import { useNotifications } from "../../../../core/composables";
102
101
  import { notification } from "../../../components";
103
102
 
@@ -132,6 +131,9 @@ const { showConfirmation } = usePopup();
132
131
 
133
132
  const widgetsRefs = useTemplateRefsList<{ el: HTMLDivElement; component: ConcreteComponent }>();
134
133
 
134
+ if (typeof props.composables?.[props.model?.settings?.composable ?? ""] === "undefined") {
135
+ throw new Error(`Composable ( ${props.model?.settings?.composable} ) is not defined`);
136
+ }
135
137
  const { loading, item, validationState, scope, load, remove, saveChanges, bladeTitle } = props.composables
136
138
  ? (props.composables?.[props.model?.settings?.composable ?? ""]({ emit, props, mounted: useMounted() }) as UseDetails<
137
139
  Record<string, any>,
@@ -147,6 +149,7 @@ const { loading, item, validationState, scope, load, remove, saveChanges, bladeT
147
149
  saveChanges: undefined,
148
150
  bladeTitle: undefined,
149
151
  } as unknown as UseDetails<Record<string, any>, DetailsBaseBladeScope>);
152
+
150
153
  const { onBeforeClose } = useBladeNavigation();
151
154
  const title = ref();
152
155
  const isReady = ref(false);
@@ -169,7 +169,7 @@ import { useFilterBuilder, useTableTemplates } from "../composables";
169
169
  import { useFunctions, useNotifications } from "../../../../core/composables";
170
170
  import { IActionBuilderResult, ITableColumns } from "../../../../core/types";
171
171
  import { useToolbarReducer } from "../composables/useToolbarReducer";
172
- import { notification, usePopup } from "../../../components";
172
+ 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";
@@ -252,6 +252,10 @@ const stateKey =
252
252
  throw new Error('Table id is not defined. Please provide "id" property in table schema');
253
253
  });
254
254
 
255
+ if (typeof props.composables?.[props.model?.settings?.composable ?? ""] === "undefined") {
256
+ throw new Error(`Composable ( ${props.model?.settings?.composable} ) is not defined`);
257
+ }
258
+
255
259
  const { load, remove, items, loading, pagination, query, scope } = props.composables
256
260
  ? (props.composables?.[props.model?.settings?.composable ?? ""]({
257
261
  emit,
@@ -3,7 +3,7 @@
3
3
  class="vc-app-menu-item"
4
4
  :class="[
5
5
  {
6
- 'vc-app-menu-item_active': isActive(url ?? '') && !children?.length,
6
+ 'vc-app-menu-item_active': isActive && !children?.length,
7
7
  'vc-app-menu-item_no-hover': !children?.length,
8
8
  'vc-app-menu-item_child-opened': isOpened,
9
9
  },
@@ -49,6 +49,7 @@
49
49
  >
50
50
  <router-link
51
51
  v-if="$hasAccess(nested.permissions!)"
52
+ v-slot="{ isExactActive }"
52
53
  :to="nested.url!"
53
54
  custom
54
55
  >
@@ -56,7 +57,7 @@
56
57
  :key="i"
57
58
  :class="[
58
59
  {
59
- 'vc-app-menu-item__child-item_active': isActive(nested.url!),
60
+ 'vc-app-menu-item__child-item_active': isExactActive,
60
61
  },
61
62
  'vc-app-menu-item__child-item',
62
63
  ]"
@@ -80,6 +81,7 @@ export interface Props {
80
81
  icon: string;
81
82
  title?: string;
82
83
  url?: string;
84
+ isActive?: boolean;
83
85
  }
84
86
 
85
87
  export interface Emits {
@@ -112,19 +114,6 @@ function onMenuItemClick() {
112
114
  isOpened.value = !isOpened.value;
113
115
  }
114
116
  }
115
-
116
- const isActive = (url: string) => {
117
- if (url) {
118
- const splitted = url.split("/").filter((part) => part !== "");
119
- const active = route.path.split("/").filter((part) => part !== "")[0] === splitted[0];
120
-
121
- if (active && props.children?.length) {
122
- isOpened.value = true;
123
- }
124
-
125
- return active;
126
- } else return false;
127
- };
128
117
  </script>
129
118
 
130
119
  <style lang="scss">
@@ -2,11 +2,13 @@
2
2
  <div>
3
3
  <template v-if="url">
4
4
  <router-link
5
+ v-slot="{ isExactActive }"
5
6
  :to="url"
6
7
  custom
7
8
  >
8
9
  <vc-app-menu-link
9
10
  v-if="isVisible"
11
+ :is-active="isExactActive"
10
12
  :sticky="sticky"
11
13
  :icon="icon ?? ''"
12
14
  :title="title ?? ''"
@@ -167,7 +167,14 @@ const onMenuItemClick = function (item: MenuItem) {
167
167
  true,
168
168
  );
169
169
  } else if (!item.routeId && item.url) {
170
- router.push(item.url);
170
+ const menuRoute = router.getRoutes().find((r) => {
171
+ return "/" + r.path.split("/").filter((part) => part !== "")[1] === item.url || r.path === item.url;
172
+ });
173
+ if (typeof menuRoute === "undefined") {
174
+ openRoot();
175
+ } else {
176
+ router.replace({ name: menuRoute?.name, params: route.params });
177
+ }
171
178
  }
172
179
  };
173
180
 
@@ -382,7 +382,7 @@
382
382
  </div>
383
383
  <VcButton
384
384
  v-if="notfound?.action"
385
- @click="notfound.clickHandler"
385
+ @click="notfound?.clickHandler"
386
386
  >
387
387
  {{ notfound.action }}
388
388
  </VcButton>
@@ -402,7 +402,7 @@
402
402
  </div>
403
403
  <VcButton
404
404
  v-if="empty?.action"
405
- @click="empty.clickHandler"
405
+ @click="empty?.clickHandler"
406
406
  >
407
407
  {{ empty.action }}
408
408
  </VcButton>