@done-coding/admin-core 0.3.1-alpha.0 → 0.4.0

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 (79) hide show
  1. package/es/bridge/index.mjs +83 -27
  2. package/es/components/app-layout/AppBody.vue.mjs +7 -0
  3. package/es/components/app-layout/AppBody.vue2.mjs +89 -0
  4. package/es/components/app-layout/AppBreadcrumb.vue.mjs +7 -0
  5. package/es/components/app-layout/AppBreadcrumb.vue2.mjs +58 -0
  6. package/es/components/app-layout/AppFooter.vue.mjs +7 -0
  7. package/es/components/app-layout/AppFooter.vue2.mjs +17 -0
  8. package/es/components/app-layout/AppHeader.vue.mjs +7 -0
  9. package/es/components/app-layout/AppHeader.vue2.mjs +99 -0
  10. package/es/components/app-layout/AppLayout.vue.mjs +7 -0
  11. package/es/components/app-layout/AppLayout.vue2.mjs +130 -0
  12. package/es/components/app-layout/AppPage.vue.mjs +7 -0
  13. package/es/components/app-layout/AppPage.vue2.mjs +39 -0
  14. package/es/components/app-layout/AppSidebar.vue.mjs +7 -0
  15. package/es/components/app-layout/AppSidebar.vue2.mjs +97 -0
  16. package/es/components/app-layout/index.mjs +32 -0
  17. package/es/components/display/ActionBtnGroup.vue.mjs +61 -0
  18. package/es/components/display/ActionBtnGroup.vue2.mjs +4 -0
  19. package/es/components/display/index.mjs +13 -11
  20. package/es/components/misc/ActionBtn.vue.mjs +84 -65
  21. package/es/components/misc/ActionConfirm.vue.mjs +1 -1
  22. package/es/components/misc/ActionConfirm.vue2.mjs +77 -71
  23. package/es/components/misc/SelectModule.vue.mjs +55 -0
  24. package/es/components/misc/SelectModule.vue2.mjs +4 -0
  25. package/es/components/modal/ConfirmModal.vue.mjs +1 -1
  26. package/es/components/modal/ConfirmModal.vue2.mjs +13 -12
  27. package/es/components/modal/modal-shelf-hierarchy.mjs +4 -6
  28. package/es/components/table/ToolbarButtons.vue.mjs +10 -40
  29. package/es/index.mjs +165 -132
  30. package/es/inject/key.mjs +15 -6
  31. package/es/router/guard/index.mjs +31 -0
  32. package/es/router/guard/login.mjs +4 -0
  33. package/es/router/guard/permission.mjs +4 -0
  34. package/es/store/app.mjs +103 -0
  35. package/es/store/router-permission.mjs +65 -0
  36. package/es/store/user.mjs +52 -52
  37. package/es/style.css +1 -1
  38. package/package.json +2 -2
  39. package/types/bridge/index.d.ts +180 -76
  40. package/types/components/app-layout/AppBody.vue.d.ts +45 -0
  41. package/types/components/app-layout/AppBreadcrumb.vue.d.ts +25 -0
  42. package/types/components/app-layout/AppFooter.vue.d.ts +2 -0
  43. package/types/components/app-layout/AppHeader.vue.d.ts +55 -0
  44. package/types/components/app-layout/AppLayout.vue.d.ts +76 -0
  45. package/types/components/app-layout/AppPage.vue.d.ts +54 -0
  46. package/types/components/app-layout/AppSidebar.vue.d.ts +51 -0
  47. package/types/components/app-layout/index.d.ts +27 -0
  48. package/types/components/app-layout/types.d.ts +43 -0
  49. package/types/components/display/ActionBtnGroup.vue.d.ts +16 -0
  50. package/types/components/display/TabsHeader.vue.d.ts +8 -8
  51. package/types/components/display/index.d.ts +10 -1
  52. package/types/components/display/types.d.ts +42 -1
  53. package/types/components/misc/ActionBtn.vue.d.ts +17 -23
  54. package/types/components/misc/ActionConfirm.vue.d.ts +56 -27
  55. package/types/components/misc/SelectModule.vue.d.ts +2 -0
  56. package/types/components/misc/index.d.ts +2 -1
  57. package/types/components/misc/types.d.ts +35 -26
  58. package/types/components/modal/ConfirmModal.vue.d.ts +19 -2
  59. package/types/components/modal/modal-shelf-hierarchy.d.ts +1 -1
  60. package/types/components/table/TableToolbar.vue.d.ts +8 -8
  61. package/types/components/table/types.d.ts +10 -12
  62. package/types/helpers/index.d.ts +10 -3
  63. package/types/index.d.ts +4 -1
  64. package/types/inject/key.d.ts +25 -0
  65. package/types/router/guard/index.d.ts +21 -0
  66. package/types/router/guard/login.d.ts +5 -0
  67. package/types/router/guard/permission.d.ts +5 -0
  68. package/types/router/guard/types.d.ts +15 -0
  69. package/types/router/index.d.ts +1 -0
  70. package/types/store/app.d.ts +149 -0
  71. package/types/store/index.d.ts +2 -0
  72. package/types/store/router-permission.d.ts +80 -0
  73. package/types/store/user.d.ts +11 -9
  74. /package/es/{helpers → bridge}/route.mjs +0 -0
  75. /package/es/{helpers → bridge}/state.mjs +0 -0
  76. /package/es/{helpers → bridge}/storage.mjs +0 -0
  77. /package/types/{helpers → bridge}/route.d.ts +0 -0
  78. /package/types/{helpers → bridge}/state.d.ts +0 -0
  79. /package/types/{helpers → bridge}/storage.d.ts +0 -0
@@ -0,0 +1,97 @@
1
+ import { ElTooltip as T, ElIcon as H } from "element-plus/es";
2
+ import "element-plus/es/components/base/style/css";
3
+ import "element-plus/es/components/tooltip/style/css";
4
+ import "element-plus/es/components/icon/style/css";
5
+ import { defineComponent as P, useCssVars as w, unref as o, inject as A, computed as e, ref as b, toRefs as F, openBlock as f, createElementBlock as I, normalizeStyle as g, createVNode as a, withCtx as p, renderSlot as v, createElementVNode as h, createBlock as L, createCommentVNode as V } from "vue";
6
+ import N from "../menu/MenuTree.vue.mjs";
7
+ import y from "../display/WatchSize.vue.mjs";
8
+ import { ArrowRightBold as R } from "@element-plus/icons-vue";
9
+ import { APP_LAYOUT_APP_STORE_KEY as M } from "../../inject/key.mjs";
10
+ const O = { class: "app-sidebar-shim" }, J = /* @__PURE__ */ P({
11
+ __name: "AppSidebar",
12
+ props: {
13
+ show: { type: Boolean },
14
+ aboveHeader: { type: Boolean, default: !1 },
15
+ menus: {},
16
+ menuFlatList: {}
17
+ },
18
+ setup(s) {
19
+ w((c) => ({
20
+ ce9ef212: o(E),
21
+ v309db2c2: o(x),
22
+ v2189b8a1: o(_),
23
+ v65908f82: o(l).bodyColor,
24
+ v42a24063: o(l).primaryColor
25
+ }));
26
+ const C = s, r = A(M), m = e(() => r.sidebarStyle), d = b(0), u = b(0), S = e(() => parseFloat(m.value.paddingTop) || 0), x = e(
27
+ () => `${Math.max(S.value, d.value)}px`
28
+ ), _ = e(() => `${u.value}px`), E = e(() => C.aboveHeader ? 2 : 0), n = e(() => r.sidebarIsCollapse), $ = e(() => ({
29
+ transform: `rotate(${n.value ? 0 : 180}deg)`
30
+ })), { theme: l } = F(r);
31
+ return (c, t) => {
32
+ const k = H, B = T;
33
+ return f(), I("div", {
34
+ class: "app-sidebar",
35
+ style: g(o(m))
36
+ }, [
37
+ a(o(y), {
38
+ class: "app-sidebar-top",
39
+ onHeightChange: t[0] || (t[0] = (i) => d.value = i)
40
+ }, {
41
+ default: p(() => [
42
+ v(c.$slots, "top", {}, void 0, !0)
43
+ ]),
44
+ _: 3
45
+ }),
46
+ h("div", O, [
47
+ a(o(N), {
48
+ collapse: o(n),
49
+ menus: s.menus,
50
+ style: { height: "100%" },
51
+ "background-color": o(l).bodyColor,
52
+ "text-color": o(l).baseColor,
53
+ "active-text-color": o(l).primaryColor,
54
+ menuFlatList: s.menuFlatList,
55
+ routerMode: ""
56
+ }, null, 8, ["collapse", "menus", "background-color", "text-color", "active-text-color", "menuFlatList"])
57
+ ]),
58
+ a(o(y), {
59
+ class: "app-sidebar-bottom",
60
+ onHeightChange: t[1] || (t[1] = (i) => u.value = i)
61
+ }, {
62
+ default: p(() => [
63
+ v(c.$slots, "bottom", {}, void 0, !0)
64
+ ]),
65
+ _: 3
66
+ }),
67
+ s.show ? (f(), L(B, {
68
+ key: 0,
69
+ content: o(n) ? "展开" : "收起",
70
+ placement: "right",
71
+ "show-after": 200
72
+ }, {
73
+ default: p(() => [
74
+ h("div", {
75
+ class: "app-sidebar-toggle",
76
+ onClick: t[2] || (t[2] = (i) => o(r).changeSidebarCollapseStatus(!o(n)))
77
+ }, [
78
+ a(k, null, {
79
+ default: p(() => [
80
+ a(o(R), {
81
+ class: "app-sidebar-toggle-icon",
82
+ style: g(o($))
83
+ }, null, 8, ["style"])
84
+ ]),
85
+ _: 1
86
+ })
87
+ ])
88
+ ]),
89
+ _: 1
90
+ }, 8, ["content"])) : V("", !0)
91
+ ], 4);
92
+ };
93
+ }
94
+ });
95
+ export {
96
+ J as default
97
+ };
@@ -0,0 +1,32 @@
1
+ import t from "./AppLayout.vue.mjs";
2
+ import m from "./AppHeader.vue.mjs";
3
+ import e from "./AppSidebar.vue.mjs";
4
+ import a from "./AppBody.vue.mjs";
5
+ import i from "./AppBreadcrumb.vue.mjs";
6
+ import n from "./AppFooter.vue.mjs";
7
+ import f from "./AppPage.vue.mjs";
8
+ const c = {
9
+ AppLayout: t,
10
+ AppHeader: m,
11
+ AppSidebar: e,
12
+ AppBody: a,
13
+ AppBreadcrumb: i,
14
+ AppFooter: n,
15
+ AppPage: f
16
+ }, B = {
17
+ install(o) {
18
+ Object.entries(c).forEach(([p, r]) => {
19
+ o.component(p, r);
20
+ });
21
+ }
22
+ };
23
+ export {
24
+ a as AppBody,
25
+ i as AppBreadcrumb,
26
+ n as AppFooter,
27
+ m as AppHeader,
28
+ t as AppLayout,
29
+ f as AppPage,
30
+ e as AppSidebar,
31
+ B as appLayoutInstall
32
+ };
@@ -0,0 +1,61 @@
1
+ import { defineComponent as z, toRefs as C, computed as S, openBlock as r, createElementBlock as c, Fragment as s, renderList as h, createBlock as a, resolveDynamicComponent as i, unref as n, mergeProps as m, withCtx as d, createTextVNode as _, toDisplayString as k } from "vue";
2
+ import { ElButton as A } from "element-plus";
3
+ import P from "../misc/ActionBtn.vue.mjs";
4
+ const F = /* @__PURE__ */ z({
5
+ __name: "ActionBtnGroup",
6
+ props: {
7
+ configs: {},
8
+ ctx: {},
9
+ defaultSize: {}
10
+ },
11
+ setup(y) {
12
+ const x = y, { configs: v, ctx: l, defaultSize: u } = C(x), B = P, g = S(
13
+ () => (v.value ?? []).filter(
14
+ (o) => {
15
+ var t;
16
+ return ((t = o.show) == null ? void 0 : t.call(o, l.value)) ?? !0;
17
+ }
18
+ )
19
+ ), f = (o) => {
20
+ const t = o ?? {};
21
+ return u.value === void 0 ? t : { size: u.value, ...t };
22
+ };
23
+ return (o, t) => (r(!0), c(s, null, h(g.value, (e) => {
24
+ var p;
25
+ return r(), c(s, {
26
+ key: e.key
27
+ }, [
28
+ e.actionBtnProps ? (r(), a(i(n(B)), m({
29
+ key: 0,
30
+ ref_for: !0
31
+ }, f(e.actionBtnProps(n(l)))), {
32
+ default: d(() => [
33
+ e.render ? (r(), a(i(e.render), {
34
+ key: 0,
35
+ ctx: n(l)
36
+ }, null, 8, ["ctx"])) : (r(), c(s, { key: 1 }, [
37
+ _(k(e.label), 1)
38
+ ], 64))
39
+ ]),
40
+ _: 2
41
+ }, 1040)) : (r(), a(n(A), m({
42
+ key: 1,
43
+ ref_for: !0
44
+ }, f((p = e.props) == null ? void 0 : p.call(e, n(l)))), {
45
+ default: d(() => [
46
+ e.render ? (r(), a(i(e.render), {
47
+ key: 0,
48
+ ctx: n(l)
49
+ }, null, 8, ["ctx"])) : (r(), c(s, { key: 1 }, [
50
+ _(k(e.label), 1)
51
+ ], 64))
52
+ ]),
53
+ _: 2
54
+ }, 1040))
55
+ ], 64);
56
+ }), 128));
57
+ }
58
+ });
59
+ export {
60
+ F as default
61
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ActionBtnGroup.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -1,16 +1,18 @@
1
- import t from "./WatchSize.vue.mjs";
2
- import s from "./TabsMain.vue.mjs";
3
- import n from "./HeightProvider.vue.mjs";
4
- const r = { WatchSize: t, TabsMain: s, HeightProvider: n }, f = {
5
- install(i) {
6
- Object.entries(r).forEach(([a, o]) => {
7
- i.component(a, o);
1
+ import n from "./WatchSize.vue.mjs";
2
+ import a from "./TabsMain.vue.mjs";
3
+ import r from "./HeightProvider.vue.mjs";
4
+ import s from "./ActionBtnGroup.vue.mjs";
5
+ const c = { WatchSize: n, TabsMain: a, HeightProvider: r, ActionBtnGroup: s }, _ = {
6
+ install(o) {
7
+ Object.entries(c).forEach(([i, t]) => {
8
+ o.component(i, t);
8
9
  });
9
10
  }
10
11
  };
11
12
  export {
12
- n as HeightProvider,
13
- s as TabsMain,
14
- t as WatchSize,
15
- f as displayInstall
13
+ s as ActionBtnGroup,
14
+ r as HeightProvider,
15
+ a as TabsMain,
16
+ n as WatchSize,
17
+ _ as displayInstall
16
18
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as A, getCurrentInstance as b, ref as s, computed as P, openBlock as g, createBlock as v, withCtx as f, createVNode as T, unref as k, mergeProps as B, renderSlot as C } from "vue";
2
- import { ElButton as h } from "element-plus";
3
- import w from "./ActionConfirm.vue.mjs";
4
- const E = /* @__PURE__ */ A({
1
+ import { defineComponent as z, toRefs as E, getCurrentInstance as M, ref as p, computed as C, watch as R, openBlock as b, createBlock as x, unref as u, withCtx as d, createVNode as V, mergeProps as w, renderSlot as A } from "vue";
2
+ import { ElButton as I } from "element-plus";
3
+ import $ from "./ActionConfirm.vue.mjs";
4
+ const q = /* @__PURE__ */ z({
5
5
  inheritAttrs: !1,
6
6
  __name: "ActionBtn",
7
7
  props: {
@@ -24,14 +24,17 @@ const E = /* @__PURE__ */ A({
24
24
  autoInsertSpace: { type: Boolean },
25
25
  tag: {},
26
26
  confirmMode: {},
27
- confirmConfig: {}
27
+ confirmConfig: { type: [Object, Function] },
28
+ beforeOpen: { type: Function }
28
29
  },
29
30
  emits: ["click"],
30
- setup(x) {
31
- const t = x, n = b(), u = s(), r = s(!1), a = s(!1);
32
- let p;
33
- const m = P(() => {
34
- const e = t, o = {}, l = [
31
+ setup(_) {
32
+ const v = _, { confirmConfig: s, confirmMode: T, beforeOpen: f } = E(v), r = M(), o = p(!1), c = p(!1), l = p();
33
+ let m;
34
+ const F = C(
35
+ () => !!s.value || !!f.value
36
+ ), y = C(() => {
37
+ const e = v, t = {}, a = [
35
38
  "type",
36
39
  "size",
37
40
  "plain",
@@ -50,68 +53,84 @@ const E = /* @__PURE__ */ A({
50
53
  "icon",
51
54
  "loadingIcon"
52
55
  ];
53
- for (const i of l) e[i] !== void 0 && (o[i] = e[i]);
54
- return { ...n == null ? void 0 : n.attrs, ...o };
55
- }), _ = (e) => !!e && typeof e.then == "function", I = () => {
56
- var o;
57
- const e = (o = n == null ? void 0 : n.vnode.props) == null ? void 0 : o.onClick;
56
+ for (const n of a) e[n] !== void 0 && (t[n] = e[n]);
57
+ return { ...r == null ? void 0 : r.attrs, ...t };
58
+ }), L = (e) => !!e && typeof e.then == "function", O = () => {
59
+ var t;
60
+ const e = (t = r == null ? void 0 : r.vnode.props) == null ? void 0 : t.onClick;
58
61
  return e ? Array.isArray(e) ? e : [e] : [];
59
- }, d = () => {
60
- const e = I();
62
+ }, g = () => {
63
+ const e = O();
61
64
  if (!e.length) return;
62
- const o = p;
63
- let l;
65
+ const t = m;
66
+ let a;
64
67
  try {
65
- l = e.map((c) => c(o));
66
- } catch (c) {
67
- throw r.value = !1, c;
68
+ a = e.map((i) => i(t));
69
+ } catch (i) {
70
+ throw o.value = !1, i;
68
71
  }
69
- const i = l.filter(_);
70
- if (i.length)
71
- return r.value = !0, Promise.all(i).finally(() => {
72
- r.value = !1;
72
+ const n = a.filter(L);
73
+ if (n.length)
74
+ return o.value = !0, Promise.all(n).finally(() => {
75
+ o.value = !1;
73
76
  });
74
- }, y = (e) => {
75
- var o;
76
- r.value || a.value || (p = e, t.confirmConfig ? (a.value = !0, Promise.resolve((o = u.value) == null ? void 0 : o.run()).finally(() => {
77
- a.value = !1;
78
- })) : d());
77
+ }, P = g, k = async (e) => {
78
+ if (o.value || c.value) return;
79
+ m = e;
80
+ let t;
81
+ if (f.value) {
82
+ o.value = !0;
83
+ try {
84
+ t = await f.value();
85
+ } catch {
86
+ o.value = !1;
87
+ return;
88
+ }
89
+ o.value = !1;
90
+ } else
91
+ t = void 0;
92
+ s.value ? (l.value = typeof s.value == "function" ? s.value(t) : s.value, c.value = !0) : g();
93
+ };
94
+ return R(c, (e) => {
95
+ e || (l.value = void 0);
96
+ }), (e, t) => {
97
+ var a, n, i, B, h;
98
+ return F.value ? (b(), x($, {
99
+ key: 0,
100
+ show: c.value,
101
+ "onUpdate:show": t[0] || (t[0] = (S) => c.value = S),
102
+ mode: u(T) || "popconfirm",
103
+ title: (a = l.value) == null ? void 0 : a.title,
104
+ content: (n = l.value) == null ? void 0 : n.content,
105
+ "confirm-text": (i = l.value) == null ? void 0 : i.confirmText,
106
+ "cancel-text": (B = l.value) == null ? void 0 : B.cancelText,
107
+ type: (h = l.value) == null ? void 0 : h.type,
108
+ "submit-fn": u(P)
109
+ }, {
110
+ default: d(() => [
111
+ V(u(I), w(y.value, {
112
+ loading: o.value,
113
+ onClick: k
114
+ }), {
115
+ default: d(() => [
116
+ A(e.$slots, "default")
117
+ ]),
118
+ _: 3
119
+ }, 16, ["loading"])
120
+ ]),
121
+ _: 3
122
+ }, 8, ["show", "mode", "title", "content", "confirm-text", "cancel-text", "type", "submit-fn"])) : (b(), x(u(I), w({ key: 1 }, y.value, {
123
+ loading: o.value,
124
+ onClick: k
125
+ }), {
126
+ default: d(() => [
127
+ A(e.$slots, "default")
128
+ ]),
129
+ _: 3
130
+ }, 16, ["loading"]));
79
131
  };
80
- return (e, o) => t.confirmConfig ? (g(), v(w, {
81
- key: 0,
82
- ref_key: "confirmRef",
83
- ref: u,
84
- mode: t.confirmMode || "popconfirm",
85
- title: t.confirmConfig.title,
86
- content: t.confirmConfig.content,
87
- "confirm-text": t.confirmConfig.confirmText,
88
- "cancel-text": t.confirmConfig.cancelText,
89
- type: t.confirmConfig.type,
90
- action: d
91
- }, {
92
- default: f(() => [
93
- T(k(h), B(m.value, {
94
- loading: r.value,
95
- onClick: y
96
- }), {
97
- default: f(() => [
98
- C(e.$slots, "default")
99
- ]),
100
- _: 3
101
- }, 16, ["loading"])
102
- ]),
103
- _: 3
104
- }, 8, ["mode", "title", "content", "confirm-text", "cancel-text", "type"])) : (g(), v(k(h), B({ key: 1 }, m.value, {
105
- loading: r.value,
106
- onClick: y
107
- }), {
108
- default: f(() => [
109
- C(e.$slots, "default")
110
- ]),
111
- _: 3
112
- }, 16, ["loading"]));
113
132
  }
114
133
  });
115
134
  export {
116
- E as default
135
+ q as default
117
136
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./ActionConfirm.vue2.mjs";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-1003e4cb"]]);
4
+ const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5bb407c9"]]);
5
5
  export {
6
6
  f as default
7
7
  };
@@ -1,103 +1,95 @@
1
- import { defineComponent as S, ref as _, computed as x, openBlock as i, createBlock as u, unref as f, withCtx as s, createElementVNode as g, createElementBlock as C, resolveDynamicComponent as w, createCommentVNode as T, createVNode as h, createTextVNode as k, toDisplayString as B, renderSlot as N, h as b } from "vue";
2
- import { ElPopover as $, ElButton as E, ElMessageBox as j } from "element-plus";
3
- const q = { class: "action-confirm" }, F = {
1
+ import { defineComponent as _, useModel as P, ref as $, computed as s, h as r, openBlock as o, createBlock as u, unref as d, withCtx as c, createElementVNode as C, createElementBlock as f, resolveDynamicComponent as x, createCommentVNode as k, createVNode as m, createTextVNode as T, toDisplayString as b, renderSlot as v, Fragment as z, mergeModels as D } from "vue";
2
+ import { ElPopover as S, ElButton as N } from "element-plus";
3
+ import A from "../modal/ConfirmModal.vue.mjs";
4
+ const U = { class: "action-confirm" }, j = {
4
5
  key: 0,
5
6
  class: "action-confirm__title"
6
- }, G = {
7
+ }, q = {
7
8
  key: 1,
8
9
  class: "action-confirm__content"
9
- }, H = { class: "action-confirm__actions" }, O = /* @__PURE__ */ S({
10
+ }, G = { class: "action-confirm__actions" }, K = /* @__PURE__ */ _({
10
11
  __name: "ActionConfirm",
11
- props: {
12
+ props: /* @__PURE__ */ D({
12
13
  mode: {},
13
14
  title: {},
14
15
  content: {},
15
16
  confirmText: { default: "确定" },
16
17
  cancelText: { default: "取消" },
17
18
  type: {},
18
- action: {}
19
- },
20
- setup(a, { expose: P }) {
21
- const e = a, c = _(!1), l = _(!1);
22
- let n = null;
23
- const r = (t) => {
24
- if (t != null)
25
- return typeof t == "function" ? t() : t;
26
- }, m = (t) => {
27
- if (!(t == null || t === ""))
28
- return typeof t == "string" ? () => b("span", t) : () => t;
29
- }, d = x(() => m(r(e.title))), y = x(() => m(r(e.content))), V = async () => {
30
- l.value = !0;
19
+ submitFn: {}
20
+ }, {
21
+ show: { type: Boolean, default: !1 },
22
+ showModifiers: {}
23
+ }),
24
+ emits: ["update:show"],
25
+ setup(t) {
26
+ const n = t, i = P(t, "show"), a = $(!1), l = (e) => {
27
+ if (e != null)
28
+ return typeof e == "function" ? e() : e;
29
+ }, y = (e) => {
30
+ if (!(e == null || e === ""))
31
+ return typeof e == "string" ? () => r("span", e) : () => e;
32
+ }, p = s(() => y(l(n.title))), h = s(() => y(l(n.content))), B = async () => {
33
+ a.value = !0;
31
34
  try {
32
- await Promise.resolve(e.action());
35
+ await Promise.resolve(n.submitFn()), i.value = !1;
36
+ } catch {
33
37
  } finally {
34
- l.value = !1;
38
+ a.value = !1;
35
39
  }
36
- }, z = async () => {
37
- await V(), c.value = !1, n == null || n(!0), n = null;
38
- }, A = () => {
39
- c.value = !1, n == null || n(!1), n = null;
40
- }, D = async () => {
41
- const t = r(e.title), o = r(e.content), L = typeof o == "string" ? o : o ? b("div", o) : "";
40
+ }, g = () => {
41
+ i.value = !1;
42
+ }, M = s(() => {
43
+ const e = l(n.title);
44
+ if (!(e === void 0 || e === ""))
45
+ return typeof e == "string" ? e : () => r("span", e);
46
+ }), E = s(() => {
47
+ const e = l(n.content);
48
+ if (!(e === void 0 || e === ""))
49
+ return typeof e == "string" ? e : () => r("div", e);
50
+ }), F = async () => {
42
51
  try {
43
- return await j.confirm(L, {
44
- title: typeof t == "string" ? t : void 0,
45
- confirmButtonText: e.confirmText,
46
- cancelButtonText: e.cancelText,
47
- type: e.type === "danger" ? "warning" : void 0,
48
- beforeClose: async (M, v, p) => {
49
- if (M !== "confirm") return p();
50
- v.confirmButtonLoading = !0;
51
- try {
52
- await Promise.resolve(e.action());
53
- } finally {
54
- v.confirmButtonLoading = !1;
55
- }
56
- p();
57
- }
58
- }), !0;
52
+ await Promise.resolve(n.submitFn());
59
53
  } catch {
60
54
  return !1;
61
55
  }
62
56
  };
63
- return P({ run: () => e.mode === "messageConfirm" ? D() : (c.value = !0, new Promise((t) => {
64
- n = t;
65
- })) }), (t, o) => e.mode === "popconfirm" ? (i(), u(f($), {
57
+ return (e, w) => n.mode === "popconfirm" ? (o(), u(d(S), {
66
58
  key: 0,
67
- visible: c.value,
59
+ visible: i.value,
68
60
  width: 240,
69
61
  persistent: !1
70
62
  }, {
71
- reference: s(() => [
72
- N(t.$slots, "default", {}, void 0, !0)
63
+ reference: c(() => [
64
+ v(e.$slots, "default", {}, void 0, !0)
73
65
  ]),
74
- default: s(() => [
75
- g("div", q, [
76
- d.value ? (i(), C("div", F, [
77
- (i(), u(w(d.value)))
78
- ])) : T("", !0),
79
- y.value ? (i(), C("div", G, [
80
- (i(), u(w(y.value)))
81
- ])) : T("", !0),
82
- g("div", H, [
83
- h(f(E), {
66
+ default: c(() => [
67
+ C("div", U, [
68
+ p.value ? (o(), f("div", j, [
69
+ (o(), u(x(p.value)))
70
+ ])) : k("", !0),
71
+ h.value ? (o(), f("div", q, [
72
+ (o(), u(x(h.value)))
73
+ ])) : k("", !0),
74
+ C("div", G, [
75
+ m(d(N), {
84
76
  size: "small",
85
- disabled: l.value,
86
- onClick: A
77
+ disabled: a.value,
78
+ onClick: g
87
79
  }, {
88
- default: s(() => [
89
- k(B(a.cancelText), 1)
80
+ default: c(() => [
81
+ T(b(t.cancelText), 1)
90
82
  ]),
91
83
  _: 1
92
84
  }, 8, ["disabled"]),
93
- h(f(E), {
85
+ m(d(N), {
94
86
  size: "small",
95
- type: a.type,
96
- loading: l.value,
97
- onClick: z
87
+ type: t.type,
88
+ loading: a.value,
89
+ onClick: B
98
90
  }, {
99
- default: s(() => [
100
- k(B(a.confirmText), 1)
91
+ default: c(() => [
92
+ T(b(t.confirmText), 1)
101
93
  ]),
102
94
  _: 1
103
95
  }, 8, ["type", "loading"])
@@ -105,9 +97,23 @@ const q = { class: "action-confirm" }, F = {
105
97
  ])
106
98
  ]),
107
99
  _: 3
108
- }, 8, ["visible"])) : N(t.$slots, "default", { key: 1 }, void 0, !0);
100
+ }, 8, ["visible"])) : n.mode === "messageConfirm" ? (o(), f(z, { key: 1 }, [
101
+ v(e.$slots, "default", {}, void 0, !0),
102
+ m(A, {
103
+ show: i.value,
104
+ "onUpdate:show": w[0] || (w[0] = (V) => i.value = V),
105
+ title: M.value,
106
+ content: E.value,
107
+ "confirm-text": t.confirmText,
108
+ "cancel-text": t.cancelText,
109
+ type: t.type,
110
+ "on-confirm": F,
111
+ "on-cancel": g,
112
+ "use-loading": ""
113
+ }, null, 8, ["show", "title", "content", "confirm-text", "cancel-text", "type"])
114
+ ], 64)) : v(e.$slots, "default", { key: 2 }, void 0, !0);
109
115
  }
110
116
  });
111
117
  export {
112
- O as default
118
+ K as default
113
119
  };
@@ -0,0 +1,55 @@
1
+ import { defineComponent as s, inject as E, computed as d, openBlock as e, createBlock as n, unref as l, withCtx as i, createVNode as h, createElementBlock as a, Fragment as p, renderList as m } from "vue";
2
+ import { ElSelect as b, ElOption as _, ElOptionGroup as A } from "element-plus";
3
+ import { APP_LAYOUT_BRIDGE_KEY as L } from "../../inject/key.mjs";
4
+ import { FORM_CONFIG_SELECT_ALL_VALUE as S } from "../../helpers/form.mjs";
5
+ const w = /* @__PURE__ */ s({
6
+ name: "SelectModule",
7
+ inheritAttrs: !0,
8
+ __name: "SelectModule",
9
+ setup(k) {
10
+ const o = E(L);
11
+ if (!o)
12
+ throw new Error(
13
+ "[SelectModule] 必须在 AppLayout 内使用(缺 APP_LAYOUT_BRIDGE_KEY)"
14
+ );
15
+ const f = d(
16
+ () => o.generateRouteMetaRawTree(o.getRoutes(), {
17
+ filterFn: (r) => r.menuShow,
18
+ sortFn: (r, c) => r.menuSort - c.menuSort
19
+ })
20
+ );
21
+ return (r, c) => (e(), n(l(b), null, {
22
+ default: i(() => [
23
+ h(l(_), {
24
+ value: l(S),
25
+ label: "全部"
26
+ }, null, 8, ["value"]),
27
+ (e(!0), a(p, null, m(f.value, (t) => (e(), a(p, {
28
+ key: t.path
29
+ }, [
30
+ t.children.length ? (e(), n(l(A), {
31
+ key: 0,
32
+ label: t.title
33
+ }, {
34
+ default: i(() => [
35
+ (e(!0), a(p, null, m(t.children, (u) => (e(), n(l(_), {
36
+ key: u.path,
37
+ label: u.title,
38
+ value: u.path
39
+ }, null, 8, ["label", "value"]))), 128))
40
+ ]),
41
+ _: 2
42
+ }, 1032, ["label"])) : (e(), n(l(_), {
43
+ key: 1,
44
+ label: t.title,
45
+ value: t.path
46
+ }, null, 8, ["label", "value"]))
47
+ ], 64))), 128))
48
+ ]),
49
+ _: 1
50
+ }));
51
+ }
52
+ });
53
+ export {
54
+ w as default
55
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./SelectModule.vue.mjs";
2
+ export {
3
+ f as default
4
+ };