@keyblade/pro-components 1.15.0-alpha.2 → 1.15.0-alpha.3

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.
@@ -2,36 +2,36 @@ var V = Object.defineProperty, X = Object.defineProperties;
2
2
  var Y = Object.getOwnPropertyDescriptors;
3
3
  var x = Object.getOwnPropertySymbols;
4
4
  var Z = Object.prototype.hasOwnProperty, $ = Object.prototype.propertyIsEnumerable;
5
- var J = (c, s, i) => s in c ? V(c, s, { enumerable: !0, configurable: !0, writable: !0, value: i }) : c[s] = i, w = (c, s) => {
6
- for (var i in s || (s = {}))
7
- Z.call(s, i) && J(c, i, s[i]);
5
+ var J = (s, c, i) => c in s ? V(s, c, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[c] = i, w = (s, c) => {
6
+ for (var i in c || (c = {}))
7
+ Z.call(c, i) && J(s, i, c[i]);
8
8
  if (x)
9
- for (var i of x(s))
10
- $.call(s, i) && J(c, i, s[i]);
11
- return c;
12
- }, O = (c, s) => X(c, Y(s));
13
- var L = (c, s, i) => new Promise((K, g) => {
14
- var p = (r) => {
9
+ for (var i of x(c))
10
+ $.call(c, i) && J(s, i, c[i]);
11
+ return s;
12
+ }, O = (s, c) => X(s, Y(c));
13
+ var L = (s, c, i) => new Promise((K, g) => {
14
+ var p = (u) => {
15
15
  try {
16
- u(i.next(r));
16
+ r(i.next(u));
17
17
  } catch (d) {
18
18
  g(d);
19
19
  }
20
- }, M = (r) => {
20
+ }, M = (u) => {
21
21
  try {
22
- u(i.throw(r));
22
+ r(i.throw(u));
23
23
  } catch (d) {
24
24
  g(d);
25
25
  }
26
- }, u = (r) => r.done ? K(r.value) : Promise.resolve(r.value).then(p, M);
27
- u((i = i.apply(c, s)).next());
26
+ }, r = (u) => u.done ? K(u.value) : Promise.resolve(u.value).then(p, M);
27
+ r((i = i.apply(s, c)).next());
28
28
  });
29
29
  import { ref as v, computed as _, watch as A } from "vue";
30
30
  import { useRoute as I, useRouter as m } from "vue-router";
31
31
  import { ProLayoutMode as E, ProLayoutMenuType as R } from "./enum.js";
32
- const te = (c) => {
33
- const s = I(), i = m(), K = v([]), g = v([]), p = v([]), M = v([]), u = v(), r = v([]), d = v({}), k = v([]), f = v([]), P = v([]), T = v([]), y = v([]), b = _(() => {
34
- const e = [...c.menuItems], a = (t) => {
32
+ const te = (s) => {
33
+ const c = I(), i = m(), K = v([]), g = v([]), p = v([]), M = v([]), r = v(), u = v([]), d = v({}), k = v([]), f = v([]), P = v([]), T = v([]), y = v([]), b = _(() => {
34
+ const e = [...s.menuItems], a = (t) => {
35
35
  t.forEach((l) => {
36
36
  if (l != null && l.children && l.children.length > 0) {
37
37
  if ((l == null ? void 0 : l.topChildrenMenu) !== void 0)
@@ -44,7 +44,7 @@ const te = (c) => {
44
44
  }
45
45
  });
46
46
  };
47
- return c.layout === E.mix && a(e), e;
47
+ return s.layout === E.mix && a(e), e;
48
48
  }), W = (e) => {
49
49
  var a;
50
50
  if (K.value = [e.name], !(e != null && e.children) || ((a = e == null ? void 0 : e.children) == null ? void 0 : a.length) === 0)
@@ -53,14 +53,14 @@ const te = (c) => {
53
53
  if (typeof e.redirect == "string")
54
54
  i == null || i.push({ path: e.redirect });
55
55
  else if (typeof e.redirect == "function") {
56
- const t = e.redirect(s);
56
+ const t = e.redirect(c);
57
57
  i == null || i.push(t);
58
58
  } else
59
59
  i == null || i.push(e.redirect);
60
60
  }, B = (e) => {
61
61
  e != null && e.name ? i == null || i.push({ name: e.name }) : i == null || i.push({ path: e.path }), g.value = [e.name];
62
62
  }, D = (e, a) => L(null, null, function* () {
63
- if (a != null && a.path && !(c != null && c.onMenuItemClick && !(yield c.onMenuItemClick(a)))) {
63
+ if (a != null && a.path && !(s != null && s.onMenuItemClick && !(yield s.onMenuItemClick(a)))) {
64
64
  if (a.path.startsWith("http") || a.path.startsWith("https")) {
65
65
  window.open(a.path);
66
66
  return;
@@ -74,63 +74,57 @@ const te = (c) => {
74
74
  var l;
75
75
  for (const n in t) {
76
76
  const o = t[n];
77
- if (o.name === ((l = u == null ? void 0 : u.value) == null ? void 0 : l.name) || o.children && o.children.length > 0 && a(o.children))
77
+ if (o.name === ((l = r == null ? void 0 : r.value) == null ? void 0 : l.name) || o.children && o.children.length > 0 && a(o.children))
78
78
  return e.unshift(o), !0;
79
79
  }
80
80
  return !1;
81
81
  };
82
- a(JSON.parse(JSON.stringify(b.value))), r.value = e;
82
+ a(JSON.parse(JSON.stringify(b.value))), u.value = e;
83
83
  }, q = () => {
84
84
  var a, t, l;
85
- const e = (a = r.value) == null ? void 0 : a.map((n) => ({ path: n == null ? void 0 : n.path, label: n == null ? void 0 : n.title }));
86
- k.value = (t = u.value) != null && t.breadcrumbs ? (l = u.value) == null ? void 0 : l.breadcrumbs : e.length !== 0 ? e : [];
85
+ const e = (a = u.value) == null ? void 0 : a.map((n) => ({ path: n == null ? void 0 : n.path, label: n == null ? void 0 : n.title }));
86
+ k.value = (t = r.value) != null && t.breadcrumbs ? (l = r.value) == null ? void 0 : l.breadcrumbs : e.length !== 0 ? e : [];
87
87
  };
88
88
  function z() {
89
- if (!u.value || u.value.noAffix) {
89
+ if (!r.value || r.value.noAffix) {
90
90
  f.value.forEach((n) => {
91
91
  n.active = !1;
92
92
  });
93
93
  return;
94
94
  }
95
- const { name: e, title: a } = u.value;
96
- let t = -1;
97
- f.value.forEach((n, o) => {
98
- n.active = !1, n.name === e && (t = o);
95
+ const { name: e, title: a } = r.value;
96
+ f.value.forEach((n) => {
97
+ n.active = !1;
99
98
  });
100
- const l = {
99
+ const t = {
101
100
  name: e,
102
- parentNames: r.value.map((n) => n.name),
101
+ parentNames: u.value.map((n) => n.name),
103
102
  title: a != null ? a : e,
104
- fullPath: s.fullPath,
103
+ fullPath: c.fullPath,
105
104
  active: !0
106
- };
107
- if (~t) {
108
- const n = f.value[t];
109
- n.fullPath === s.fullPath ? (n.active = !0, n.fullPath = s.fullPath) : (f.value.splice(t, 1), setTimeout(() => {
110
- f.value.push(l);
111
- }));
112
- } else
113
- f.value.push(l);
105
+ }, l = f.value.findIndex((n) => n.fullPath === c.fullPath);
106
+ ~l ? f.value[l].active = !0 : f.value.push(t);
114
107
  }
115
108
  const F = (e) => {
116
- const a = f.value.findIndex((l) => l.name === e), t = f.value[a];
117
- i.push(t.fullPath);
109
+ const a = f.value.find((t) => t.fullPath === e);
110
+ a && i.push(a.fullPath);
118
111
  }, G = (e) => {
119
112
  let a = -1, t = -1;
120
113
  if (f.value.forEach((n, o) => {
121
- n.name === e && (t = o), n.active && (a = o);
122
- }), a === t) {
114
+ n.fullPath === e && (t = o), n.active && (a = o);
115
+ }), t === -1) return;
116
+ if (a === t) {
123
117
  let n;
124
- t === 0 ? n = f.value[t + 1] : n = f.value[t - 1], n.active = !0, i.push(n.fullPath);
118
+ t === 0 ? n = f.value[t + 1] : n = f.value[t - 1], n && (n.active = !0, i.push(n.fullPath));
125
119
  }
126
120
  const l = f.value.splice(t, 1);
127
121
  U(l[0]);
128
122
  }, Q = () => {
129
123
  var a;
130
- if (c != null && c.disableKeepAlive || (a = s == null ? void 0 : s.meta) != null && a.ignoreCache)
124
+ if (s != null && s.disableKeepAlive || (a = c == null ? void 0 : c.meta) != null && a.ignoreCache)
131
125
  return;
132
126
  const e = new Set(P.value);
133
- r.value.forEach((t) => {
127
+ u.value.forEach((t) => {
134
128
  t.name && e.add(t.name);
135
129
  }), P.value = Array.from(e.values());
136
130
  }, U = (e) => {
@@ -151,27 +145,27 @@ const te = (c) => {
151
145
  });
152
146
  };
153
147
  a(JSON.parse(JSON.stringify(b.value))), d.value = e;
154
- }, { immediate: !0 }), A(() => [c.layout, b.value], () => {
148
+ }, { immediate: !0 }), A(() => [s.layout, b.value], () => {
155
149
  var e, a, t;
156
- if (T.value = [], y.value = [], p.value = [...((e = c.menuProps) == null ? void 0 : e.defaultOpenKeys) || [], ...p.value], M.value = [...((a = c.menuProps) == null ? void 0 : a.defaultOpenKeys) || [], ...M.value], c.layout === E.side)
150
+ if (T.value = [], y.value = [], p.value = [...((e = s.menuProps) == null ? void 0 : e.defaultOpenKeys) || [], ...p.value], M.value = [...((a = s.menuProps) == null ? void 0 : a.defaultOpenKeys) || [], ...M.value], s.layout === E.side)
157
151
  y.value = b.value;
158
- else if (c.layout === E.mix) {
152
+ else if (s.layout === E.mix) {
159
153
  const l = (t = b.value) == null ? void 0 : t.filter((n) => n.topMenu);
160
154
  (l == null ? void 0 : l.length) === 0 ? y.value = b.value : T.value = l;
161
155
  }
162
- }, { immediate: !0 }), A(() => s == null ? void 0 : s.name, () => {
156
+ }, { immediate: !0 }), A(() => c == null ? void 0 : c.name, () => {
163
157
  var t, l, n;
164
- const e = s == null ? void 0 : s.name;
165
- u.value = d.value[e], j();
166
- const a = r.value.filter((o) => o.topMenu);
167
- if (a.length > 0 && T.value.length > 0 && (y.value = ((t = a[a.length - 1]) == null ? void 0 : t.children) || []), K.value = u != null && u.value ? [...a.map((o) => o.name), ...((l = u.value) == null ? void 0 : l.activatedKeys) || []] : [], g.value = u != null && u.value ? [u.value.name, ...((n = u.value) == null ? void 0 : n.activatedKeys) || []] : [], u.value) {
168
- const o = r.value.filter((h, C) => C < r.value.length - 1), S = o.filter((h) => h.topMenu).map((h) => h.name), N = o.filter((h) => !h.topMenu).map((h) => h.name);
169
- u.value.activatedKeys && u.value.activatedKeys.length > 0 && u.value.activatedKeys.forEach((h) => {
158
+ const e = c == null ? void 0 : c.name;
159
+ r.value = d.value[e], j();
160
+ const a = u.value.filter((o) => o.topMenu);
161
+ if (a.length > 0 && T.value.length > 0 && (y.value = ((t = a[a.length - 1]) == null ? void 0 : t.children) || []), K.value = r != null && r.value ? [...a.map((o) => o.name), ...((l = r.value) == null ? void 0 : l.activatedKeys) || []] : [], g.value = r != null && r.value ? [r.value.name, ...((n = r.value) == null ? void 0 : n.activatedKeys) || []] : [], r.value) {
162
+ const o = u.value.filter((h, C) => C < u.value.length - 1), S = o.filter((h) => h.topMenu).map((h) => h.name), N = o.filter((h) => !h.topMenu).map((h) => h.name);
163
+ r.value.activatedKeys && r.value.activatedKeys.length > 0 && r.value.activatedKeys.forEach((h) => {
170
164
  const C = d.value[h];
171
165
  C && (C.topMenu ? S.push(h) : N.push(h));
172
166
  }), p.value = Array.from(/* @__PURE__ */ new Set([...p.value, ...S])), M.value = Array.from(/* @__PURE__ */ new Set([...M.value, ...N]));
173
167
  }
174
- q(), c.hideTabs || z(), Q();
168
+ q(), s.hideTabs || z(), Q();
175
169
  }, { immediate: !0 }), {
176
170
  topMenuItems: T,
177
171
  siderMenuItems: y,
@@ -179,7 +173,7 @@ const te = (c) => {
179
173
  siderMenuSelectedKeys: g,
180
174
  topMenuOpenKeys: p,
181
175
  siderMenuOpenKeys: M,
182
- activeMenuItem: u,
176
+ activeMenuItem: r,
183
177
  menuItemMap: d,
184
178
  breadcrumbItems: k,
185
179
  tabs: f,
@@ -1,6 +1,6 @@
1
- import { defineComponent as m, computed as y, createElementBlock as d, openBlock as n, normalizeClass as f, createVNode as p, unref as l, withCtx as k, Fragment as g, renderList as h, createBlock as v } from "vue";
1
+ import { defineComponent as f, computed as y, createElementBlock as n, openBlock as i, normalizeClass as m, createVNode as p, unref as d, withCtx as k, Fragment as g, renderList as h, createBlock as v } from "vue";
2
2
  import { Tabs as S, TabPane as T } from "@arco-design/web-vue";
3
- const z = "keyblade-pro-reuse-tabs", x = /* @__PURE__ */ m({
3
+ const z = "keyblade-pro-reuse-tabs", q = /* @__PURE__ */ f({
4
4
  __name: "pro-reuse-tabs",
5
5
  props: {
6
6
  tabs: {
@@ -30,31 +30,31 @@ const z = "keyblade-pro-reuse-tabs", x = /* @__PURE__ */ m({
30
30
  "tab-delete": (e) => !0
31
31
  },
32
32
  setup(e, { emit: s }) {
33
- const o = e, i = s, c = y(() => {
33
+ const o = e, l = s, u = y(() => {
34
34
  var t, r;
35
- return (r = (t = o.tabs.find((a) => a.active)) == null ? void 0 : t.name) != null ? r : void 0;
36
- }), u = (t) => {
37
- i("tab-click", String(t));
35
+ return (r = (t = o.tabs.find((a) => a.active)) == null ? void 0 : t.fullPath) != null ? r : void 0;
36
+ }), c = (t) => {
37
+ l("tab-click", String(t));
38
38
  }, b = (t) => {
39
- i("tab-delete", String(t));
39
+ l("tab-delete", String(t));
40
40
  };
41
- return (t, r) => (n(), d("div", {
42
- class: f(z)
41
+ return (t, r) => (i(), n("div", {
42
+ class: m(z)
43
43
  }, [
44
- p(l(S), {
45
- "active-key": c.value,
44
+ p(d(S), {
45
+ "active-key": u.value,
46
46
  size: e.tabsSize,
47
47
  type: e.tabsType,
48
48
  "header-padding": e.tabsHeaderPadding,
49
49
  editable: e.tabs.length > 1,
50
50
  "hide-content": "",
51
51
  "destroy-on-hide": "",
52
- onTabClick: u,
52
+ onTabClick: c,
53
53
  onDelete: b
54
54
  }, {
55
55
  default: k(() => [
56
- (n(!0), d(g, null, h(e.tabs, (a) => (n(), v(l(T), {
57
- key: a.name,
56
+ (i(!0), n(g, null, h(e.tabs, (a) => (i(), v(d(T), {
57
+ key: a.fullPath,
58
58
  title: a.title
59
59
  }, null, 8, ["title"]))), 128))
60
60
  ]),
@@ -64,5 +64,5 @@ const z = "keyblade-pro-reuse-tabs", x = /* @__PURE__ */ m({
64
64
  }
65
65
  });
66
66
  export {
67
- x as default
67
+ q as default
68
68
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@keyblade/pro-components",
3
3
  "description": "KeyBlade Pro Components",
4
4
  "author": "yangshuai <704807396@qq.com>",
5
- "version": "1.15.0-alpha.02",
5
+ "version": "1.15.0-alpha.03",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",