@vc-shell/framework 1.0.64 → 1.0.65

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.
@@ -47891,8 +47891,8 @@ const Gj = To(zj), qj = /* @__PURE__ */ Ne({
47891
47891
  maximized: d(w.idx),
47892
47892
  options: w.bladeOptions,
47893
47893
  "onOpen:blade": (_) => c(_, w.idx),
47894
- "onClose:blade": (_) => a(w.idx),
47895
- "onClose:children": (_) => m.$emit("onClose", w.idx + 1),
47894
+ "onClose:blade": (_) => a(x),
47895
+ "onClose:children": (_) => m.$emit("onClose", x + 1),
47896
47896
  "onParent:call": (_) => m.$emit("onParentCall", { id: x, args: _ }),
47897
47897
  "onExpand:blade": (_) => u(w.idx, !0),
47898
47898
  "onCollapse:blade": (_) => u(w.idx, !1),
@@ -47921,7 +47921,7 @@ function WU() {
47921
47921
  async function i({ parentBlade: l, component: o, param: a, bladeOptions: c, onOpen: p, onClose: m }, v, y) {
47922
47922
  console.debug("openBlade called.");
47923
47923
  const w = H(l), x = H(o), _ = d(x);
47924
- if (w && w.url && (await s(1), !r.value))
47924
+ if (w && w.url && (await s(0), !r.value))
47925
47925
  if (Ip.value = H(c), Np.value = H(a), y && typeof y == "function")
47926
47926
  try {
47927
47927
  await y();
@@ -47932,23 +47932,22 @@ function WU() {
47932
47932
  }
47933
47933
  else
47934
47934
  y || await t.push(w.url);
47935
- x && (_ === void 0 ? x.idx = v + 1 : _ && (await s(hr.value.find((b) => b.idx === _.idx).idx), x.idx = _.idx), await f(x, a, c, p, m, v));
47935
+ x && (_ === void 0 ? x.idx = v + 1 : _ && (await s(hr.value.findIndex((b) => b.idx === _.idx)), x.idx = _.idx), await f(x, a, c, p, m, v));
47936
47936
  }
47937
47937
  async function s(l) {
47938
- if (l < ea.value.length) {
47939
- const o = ea.value.slice(l).reverse();
47938
+ const o = l + 1;
47939
+ if (o < ea.value.length) {
47940
+ const a = ea.value.slice(o).reverse();
47940
47941
  r.value = !1;
47941
- for (let a = 0; a < o.length; a++)
47942
- if (o[a]?.exposed.onBeforeClose && typeof o[a].exposed.onBeforeClose == "function" && await o[a].exposed.onBeforeClose() === !1) {
47942
+ for (let c = 0; c < a.length; c++)
47943
+ if (a[c]?.exposed.onBeforeClose && typeof a[c].exposed.onBeforeClose == "function" && await a[c].exposed.onBeforeClose() === !1) {
47943
47944
  r.value = !0;
47944
47945
  break;
47945
47946
  }
47946
- if (r.value)
47947
+ if (!r.value)
47948
+ typeof hr.value[l]?.onClose == "function" && hr.value[l]?.onClose?.(), hr.value.splice(l);
47949
+ else
47947
47950
  throw "Closing prevented";
47948
- {
47949
- const a = hr.value.find((c) => c.idx === l);
47950
- a && typeof a.onClose == "function" && a.onClose?.(), hr.value.splice(hr.value.indexOf(a));
47951
- }
47952
47951
  }
47953
47952
  }
47954
47953
  async function f(l, o, a, c, p, m) {
@@ -6,8 +6,8 @@ interface IUseBladeNavigation {
6
6
  readonly parentBladeOptions: Ref<Record<string, unknown>>;
7
7
  readonly parentBladeParam: Ref<string>;
8
8
  bladesRefs: Ref<IBladeRef[]>;
9
- openBlade: ({ parentBlade, component, param, bladeOptions, onOpen, onClose }: IBladeEvent, idx?: number, navigationCb?: () => Promise<void | NavigationFailure>) => void;
10
- closeBlade: (idx: number) => void;
9
+ openBlade: ({ parentBlade, component, param, bladeOptions, onOpen, onClose }: IBladeEvent, index?: number, navigationCb?: () => Promise<void | NavigationFailure>) => void;
10
+ closeBlade: (index: number) => void;
11
11
  onParentCall: (index: number, args: IParentCallArgs) => void;
12
12
  }
13
13
  export declare function useBladeNavigation(): IUseBladeNavigation;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../shared/components/blade-navigation/composables/useBladeNavigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,GAAG,EAAc,MAAM,KAAK,CAAC;AAEnE,OAAO,EAAuB,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAqB,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1G,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC;IACxC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1D,QAAQ,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvC,UAAU,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;IAC7B,SAAS,EAAE,CACT,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,WAAW,EAC7E,GAAG,CAAC,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,GAAG,iBAAiB,CAAC,KACnD,IAAI,CAAC;IACV,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;CAC9D;AAOD,wBAAgB,kBAAkB,IAAI,mBAAmB,CAkKxD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../shared/components/blade-navigation/composables/useBladeNavigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,GAAG,EAAc,MAAM,KAAK,CAAC;AAEnE,OAAO,EAAuB,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAqB,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1G,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC;IACxC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1D,QAAQ,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvC,UAAU,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;IAC7B,SAAS,EAAE,CACT,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,WAAW,EAC7E,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,GAAG,iBAAiB,CAAC,KACnD,IAAI,CAAC;IACV,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;CAC9D;AAOD,wBAAgB,kBAAkB,IAAI,mBAAmB,CAkKxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vc-shell/framework",
3
- "version": "1.0.64",
3
+ "version": "1.0.65",
4
4
  "main": "./dist/framework.mjs",
5
5
  "module": "./dist/framework.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -54,8 +54,8 @@
54
54
  "vue3-touch-events": "^4.1.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@vc-shell/api-client-generator": "^1.0.64",
58
- "@vc-shell/config-generator": "^1.0.64",
57
+ "@vc-shell/api-client-generator": "^1.0.65",
58
+ "@vc-shell/config-generator": "^1.0.65",
59
59
  "sass": "^1.49.0",
60
60
  "typescript": "^4.9.5",
61
61
  "url-pattern": "^1.0.3"
@@ -64,5 +64,5 @@
64
64
  "access": "public",
65
65
  "registry": "https://registry.npmjs.org/"
66
66
  },
67
- "gitHead": "2b19eaf7e0642927756da9b562b5b1265133f701"
67
+ "gitHead": "da9dd24de0a4bcbc2ed3a68409771e5b40eda1ce"
68
68
  }
@@ -28,8 +28,8 @@
28
28
  :maximized="findStateById(blade.idx)"
29
29
  :options="blade.bladeOptions"
30
30
  @open:blade="onBladeOpen($event, blade.idx)"
31
- @close:blade="onBladeClose(blade.idx)"
32
- @close:children="$emit('onClose', blade.idx + 1)"
31
+ @close:blade="onBladeClose(i)"
32
+ @close:children="$emit('onClose', i + 1)"
33
33
  @parent:call="$emit('onParentCall', { id: i, args: $event })"
34
34
  @expand:blade="handleMaximizeBlade(blade.idx, true)"
35
35
  @collapse:blade="handleMaximizeBlade(blade.idx, false)"
@@ -105,8 +105,8 @@ function setBladesRef(el: IBladeElement, blade: IBladeContainer) {
105
105
  }
106
106
  }
107
107
 
108
- function onBladeClose(idx: number) {
109
- emit("onClose", idx);
108
+ function onBladeClose(index: number) {
109
+ emit("onClose", index);
110
110
  }
111
111
 
112
112
  function onBladeOpen(event: IBladeEvent, idx: number) {
@@ -11,10 +11,10 @@ interface IUseBladeNavigation {
11
11
  bladesRefs: Ref<IBladeRef[]>;
12
12
  openBlade: (
13
13
  { parentBlade, component, param, bladeOptions, onOpen, onClose }: IBladeEvent,
14
- idx?: number,
14
+ index?: number,
15
15
  navigationCb?: () => Promise<void | NavigationFailure>
16
16
  ) => void;
17
- closeBlade: (idx: number) => void;
17
+ closeBlade: (index: number) => void;
18
18
  onParentCall: (index: number, args: IParentCallArgs) => void;
19
19
  }
20
20
 
@@ -49,7 +49,7 @@ export function useBladeNavigation(): IUseBladeNavigation {
49
49
 
50
50
  async function openBlade(
51
51
  { parentBlade, component: blade, param, bladeOptions, onOpen, onClose }: IBladeEvent,
52
- idx?: number,
52
+ index?: number,
53
53
  navigationCb?: () => Promise<void | NavigationFailure>
54
54
  ) {
55
55
  console.debug(`openBlade called.`);
@@ -59,7 +59,7 @@ export function useBladeNavigation(): IUseBladeNavigation {
59
59
  const existingChild = findBlade(child);
60
60
 
61
61
  if (parent && parent.url) {
62
- await closeBlade(1);
62
+ await closeBlade(0);
63
63
 
64
64
  if (!isPrevented.value) {
65
65
  parentBladeOptions.value = unref(bladeOptions);
@@ -80,19 +80,20 @@ export function useBladeNavigation(): IUseBladeNavigation {
80
80
 
81
81
  if (child) {
82
82
  if (existingChild === undefined) {
83
- child.idx = idx + 1;
83
+ child.idx = index + 1;
84
84
  } else if (existingChild) {
85
- await closeBlade(blades.value.find((x) => x.idx === existingChild.idx).idx);
85
+ await closeBlade(blades.value.findIndex((x) => x.idx === existingChild.idx));
86
86
  child.idx = existingChild.idx;
87
87
  }
88
88
 
89
- await addBlade(child, param, bladeOptions, onOpen, onClose, idx);
89
+ await addBlade(child, param, bladeOptions, onOpen, onClose, index);
90
90
  }
91
91
  }
92
92
 
93
- async function closeBlade(idx: number) {
94
- if (idx < bladesRefs.value.length) {
95
- const children = bladesRefs.value.slice(idx).reverse();
93
+ async function closeBlade(index: number) {
94
+ const refsIndex = index + 1;
95
+ if (refsIndex < bladesRefs.value.length) {
96
+ const children = bladesRefs.value.slice(refsIndex).reverse();
96
97
 
97
98
  isPrevented.value = false;
98
99
  for (let i = 0; i < children.length; i++) {
@@ -105,11 +106,10 @@ export function useBladeNavigation(): IUseBladeNavigation {
105
106
  }
106
107
  }
107
108
  if (!isPrevented.value) {
108
- const blade = blades.value.find((x) => x.idx === idx);
109
- if (blade && typeof blade.onClose === "function") {
110
- blade.onClose?.();
109
+ if (typeof blades.value[index]?.onClose === "function") {
110
+ blades.value[index]?.onClose?.();
111
111
  }
112
- blades.value.splice(blades.value.indexOf(blade));
112
+ blades.value.splice(index);
113
113
  } else {
114
114
  throw "Closing prevented";
115
115
  }