@guodun/antdv 1.2.0 → 1.2.2
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/dist/es/components/index.mjs +3 -0
- package/dist/es/components/pro-menu-tree/index.mjs +8 -0
- package/dist/es/components/pro-menu-tree/src/hooks.mjs +183 -0
- package/dist/es/components/pro-menu-tree/src/pro-menu-tree.mjs +223 -0
- package/dist/es/components/pro-menu-tree/src/style/index.mjs +2 -0
- package/dist/es/components/pro-menu-tree/src/types.mjs +78 -0
- package/dist/es/components/pro-modal/index.mjs +1 -0
- package/dist/es/components/pro-modal/src/ProModal.vue.mjs +25 -25
- package/dist/es/components/pro-modal/src/types.mjs +5 -1
- package/dist/es/components/role-selector/src/role.mjs +99 -95
- package/dist/es/index.mjs +52 -49
- package/dist/lib/components/index.cjs +1 -1
- package/dist/lib/components/pro-menu-tree/index.cjs +1 -0
- package/dist/lib/components/pro-menu-tree/src/hooks.cjs +1 -0
- package/dist/lib/components/pro-menu-tree/src/pro-menu-tree.cjs +1 -0
- package/dist/lib/components/pro-menu-tree/src/style/index.cjs +1 -0
- package/dist/lib/components/pro-menu-tree/src/types.cjs +1 -0
- package/dist/lib/components/pro-modal/index.cjs +1 -1
- package/dist/lib/components/pro-modal/src/ProModal.vue.cjs +1 -1
- package/dist/lib/components/pro-modal/src/types.cjs +1 -1
- package/dist/lib/components/role-selector/src/role.cjs +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/theme/icon.css +1 -1
- package/dist/theme/index.css +1 -1
- package/dist/theme/pro-menu-tree.css +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/pro-menu-tree/index.d.ts +168 -0
- package/dist/types/components/pro-menu-tree/src/hooks.d.ts +6699 -0
- package/dist/types/components/pro-menu-tree/src/pro-menu-tree.d.ts +168 -0
- package/dist/types/components/pro-menu-tree/src/types.d.ts +171 -0
- package/dist/types/components/pro-modal/index.d.ts +13 -11
- package/dist/types/components/pro-modal/src/Modal.d.ts +2 -2
- package/dist/types/components/pro-modal/src/ProModal.vue.d.ts +4 -4
- package/dist/types/components/pro-modal/src/types.d.ts +5 -0
- package/global.d.ts +1 -0
- package/package.json +25 -21
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./collapse-transtion/src/types.mjs";
|
|
2
2
|
import "./collapse-transtion/index.mjs";
|
|
3
|
+
import "./pro-modal/src/types.mjs";
|
|
3
4
|
import "./pro-modal/hooks/useProModal.mjs";
|
|
4
5
|
import "./pro-modal/index.mjs";
|
|
5
6
|
import "./icon/index.mjs";
|
|
@@ -37,6 +38,8 @@ import "./role-selector/src/types.mjs";
|
|
|
37
38
|
import "./role-selector/index.mjs";
|
|
38
39
|
import "./dept-selector/src/types.mjs";
|
|
39
40
|
import "./dept-selector/index.mjs";
|
|
41
|
+
import "./pro-menu-tree/src/types.mjs";
|
|
42
|
+
import "./pro-menu-tree/index.mjs";
|
|
40
43
|
import "./pro-tag-group/src/types.mjs";
|
|
41
44
|
import "./pro-tag-group/index.mjs";
|
|
42
45
|
import "./pro-form-render/src/types.mjs";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { withInstall as e } from "../utils/install.mjs";
|
|
2
|
+
import "./src/types.mjs";
|
|
3
|
+
import t from "./src/pro-menu-tree.mjs";
|
|
4
|
+
import "./src/style/index.mjs";
|
|
5
|
+
//#region src/components/pro-menu-tree/index.ts
|
|
6
|
+
var n = e(t);
|
|
7
|
+
//#endregion
|
|
8
|
+
export { n as default };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { computed as e, ref as t } from "vue";
|
|
2
|
+
//#region src/components/pro-menu-tree/src/hooks.ts
|
|
3
|
+
function n(e) {
|
|
4
|
+
return { ...e };
|
|
5
|
+
}
|
|
6
|
+
function r(r) {
|
|
7
|
+
let i = t([]), a = t(/* @__PURE__ */ new Map()), o = t([]), s = t([]), c = e(() => new Set(s.value)), l = (e) => String(e[r().fieldNames.key] ?? ""), u = (e) => String(e[r().fieldNames.title] ?? ""), d = (e) => !!e && e[r().nodeTypeField] === r().buttonType, f = (e) => e?.[r().fieldNames.children] ?? [];
|
|
8
|
+
function p(e = []) {
|
|
9
|
+
let t = m(e);
|
|
10
|
+
return i.value = t.nodes, o.value = t.expandableKeys, s.value = t.checkableKeys, a.value = t.nodeMap, t.nodes;
|
|
11
|
+
}
|
|
12
|
+
function m(e) {
|
|
13
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = [];
|
|
14
|
+
return {
|
|
15
|
+
nodes: h(e, void 0, 0, t, n, r),
|
|
16
|
+
expandableKeys: n,
|
|
17
|
+
checkableKeys: r,
|
|
18
|
+
nodeMap: t
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function h(e, t, i, a, o, s) {
|
|
22
|
+
return e.map((e, c) => {
|
|
23
|
+
let u = n(e), p = l(u), m = d(u), g = f(e), _ = g.length > 0 ? h(g, p, i + 1, a, o, s) : [];
|
|
24
|
+
_.length > 0 && (u[r().fieldNames.children] = _, o.push(p)), m && (u.class = `pro-menu-tree-button pro-menu-tree-button-${c + 1}`, u.style = {
|
|
25
|
+
display: "flex",
|
|
26
|
+
flexDirection: "row",
|
|
27
|
+
alignItems: "center"
|
|
28
|
+
}, u.isLeaf = !0, u.checkable = !0), m || s.push(p);
|
|
29
|
+
let v = _.map((e) => l(e)).filter(Boolean), y = _.flatMap((e) => {
|
|
30
|
+
let t = l(e), n = a.get(t);
|
|
31
|
+
return n ? [t, ...n.descendantIds] : [t];
|
|
32
|
+
}), b = y.filter((e) => !a.get(e)?.isButton), x = v.filter((e) => !a.get(e)?.isButton);
|
|
33
|
+
return a.set(p, {
|
|
34
|
+
id: p,
|
|
35
|
+
parentId: t,
|
|
36
|
+
node: u,
|
|
37
|
+
childrenIds: v,
|
|
38
|
+
directCheckableChildIds: x,
|
|
39
|
+
descendantIds: y,
|
|
40
|
+
checkableDescendantIds: b,
|
|
41
|
+
isButton: m,
|
|
42
|
+
level: i
|
|
43
|
+
}), u;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function g(e) {
|
|
47
|
+
let t = [], n = a.value.get(e);
|
|
48
|
+
for (; n?.parentId;) t.push(n.parentId), n = a.value.get(n.parentId);
|
|
49
|
+
return t;
|
|
50
|
+
}
|
|
51
|
+
function _(e) {
|
|
52
|
+
return a.value.get(e)?.node;
|
|
53
|
+
}
|
|
54
|
+
function v(e, t = {}) {
|
|
55
|
+
let n = a.value.get(e);
|
|
56
|
+
return n ? t.checkableOnly ? n.checkableDescendantIds : n.descendantIds : [];
|
|
57
|
+
}
|
|
58
|
+
function y() {
|
|
59
|
+
return s.value;
|
|
60
|
+
}
|
|
61
|
+
function b() {
|
|
62
|
+
return o.value;
|
|
63
|
+
}
|
|
64
|
+
function x(e) {
|
|
65
|
+
return e ? b() : [];
|
|
66
|
+
}
|
|
67
|
+
function S(e) {
|
|
68
|
+
let t = (e ?? "").trim();
|
|
69
|
+
if (!t) return {
|
|
70
|
+
keyword: "",
|
|
71
|
+
expandedKeys: [],
|
|
72
|
+
matchedKeys: []
|
|
73
|
+
};
|
|
74
|
+
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
75
|
+
return a.value.forEach((e, i) => {
|
|
76
|
+
u(e.node).includes(t) && (r.add(i), n.add(i), g(i).forEach((e) => n.add(e)));
|
|
77
|
+
}), {
|
|
78
|
+
keyword: t,
|
|
79
|
+
expandedKeys: Array.from(n),
|
|
80
|
+
matchedKeys: Array.from(r)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function C(e) {
|
|
84
|
+
let t = (e ?? "").trim();
|
|
85
|
+
return t ? w(i.value, t) : i.value;
|
|
86
|
+
}
|
|
87
|
+
function w(e, t) {
|
|
88
|
+
let { children: i } = r().fieldNames;
|
|
89
|
+
return e.flatMap((e) => {
|
|
90
|
+
let r = f(e), a = u(e).includes(t), o = a ? r : w(r, t);
|
|
91
|
+
if (!a && o.length === 0) return [];
|
|
92
|
+
let s = n(e);
|
|
93
|
+
return s[i] = a ? r : o, [s];
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function T(e) {
|
|
97
|
+
let t = new Set(e.checked), n = new Set(e.halfChecked);
|
|
98
|
+
return t.forEach((e) => n.delete(e)), {
|
|
99
|
+
checked: Array.from(t),
|
|
100
|
+
halfChecked: Array.from(n)
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function E(e) {
|
|
104
|
+
let t = new Set(e.filter((e) => a.value.has(e))), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
105
|
+
return Array.from(a.value.values()).sort((e, t) => t.level - e.level).forEach((e) => {
|
|
106
|
+
if (e.isButton) {
|
|
107
|
+
t.has(e.id) && n.add(e.id);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
let i = O(e, n, r, t);
|
|
111
|
+
if (t.has(e.id) && i !== "partial") {
|
|
112
|
+
n.add(e.id), r.delete(e.id);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (i === "all") {
|
|
116
|
+
n.add(e.id), r.delete(e.id);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
i === "partial" && (n.delete(e.id), r.add(e.id));
|
|
120
|
+
}), T({
|
|
121
|
+
checked: Array.from(n),
|
|
122
|
+
halfChecked: Array.from(r)
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function D(e, t, n) {
|
|
126
|
+
if (!a.value.has(t)) return e;
|
|
127
|
+
let r = new Set(e.checked), i = new Set(e.halfChecked), o = a.value.get(t);
|
|
128
|
+
return (o?.isButton ? [t] : [t, ...v(t, { checkableOnly: !0 })]).forEach((e) => {
|
|
129
|
+
n ? (r.add(e), i.delete(e)) : (r.delete(e), i.delete(e));
|
|
130
|
+
}), A([t, ...o?.checkableDescendantIds ?? []], r, i), j(t, r, i), T({
|
|
131
|
+
checked: Array.from(r),
|
|
132
|
+
halfChecked: Array.from(i)
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function O(e, t, n, r) {
|
|
136
|
+
let i = e.directCheckableChildIds, o = e.childrenIds.filter((e) => a.value.get(e)?.isButton).filter((e) => t.has(e) || r.has(e)), s = i.some((e) => n.has(e)), c = i.filter((e) => t.has(e) || r.has(e)).length;
|
|
137
|
+
return i.length === 0 ? o.length > 0 ? "partial" : "none" : c === i.length && !s ? o.length > 0 ? "partial" : "all" : c > 0 || s || o.length > 0 ? "partial" : "none";
|
|
138
|
+
}
|
|
139
|
+
function k(e, t, n) {
|
|
140
|
+
let r = a.value.get(e);
|
|
141
|
+
if (!r || r.isButton || r.childrenIds.length === 0) return;
|
|
142
|
+
let i = t.has(e) && r.directCheckableChildIds.length === 0;
|
|
143
|
+
t.delete(e), n.delete(e);
|
|
144
|
+
let o = O(r, t, n, t);
|
|
145
|
+
o === "all" || o === "none" && i ? t.add(e) : o === "partial" && n.add(e);
|
|
146
|
+
}
|
|
147
|
+
function A(e, t, n) {
|
|
148
|
+
Array.from(new Set(e)).sort((e, t) => (a.value.get(t)?.level ?? 0) - (a.value.get(e)?.level ?? 0)).forEach((e) => k(e, t, n));
|
|
149
|
+
}
|
|
150
|
+
function j(e, t, n) {
|
|
151
|
+
g(e).forEach((e) => {
|
|
152
|
+
let r = a.value.get(e);
|
|
153
|
+
if (!r || r.isButton) return;
|
|
154
|
+
t.delete(e), n.delete(e);
|
|
155
|
+
let i = O(r, t, n, t);
|
|
156
|
+
i === "all" ? t.add(e) : i === "partial" && n.add(e);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function M(e) {
|
|
160
|
+
return c.value.has(e);
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
treeData: i,
|
|
164
|
+
nodeMap: a,
|
|
165
|
+
expandableKeys: o,
|
|
166
|
+
checkableKeys: s,
|
|
167
|
+
normalizeTree: p,
|
|
168
|
+
getAllParentIds: g,
|
|
169
|
+
findNodeById: _,
|
|
170
|
+
getAllChildrenIds: v,
|
|
171
|
+
getAllCheckableNodeIds: y,
|
|
172
|
+
getAllExpandableKeys: b,
|
|
173
|
+
getDefaultExpandedKeys: x,
|
|
174
|
+
searchTree: S,
|
|
175
|
+
getFilteredTree: C,
|
|
176
|
+
buildCheckedStateFromIds: E,
|
|
177
|
+
buildCheckedStateAfterToggle: D,
|
|
178
|
+
isButton: d,
|
|
179
|
+
isCheckableNode: M
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
//#endregion
|
|
183
|
+
export { r as useProMenuTree };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { useNamespace as e } from "../../../hooks/use-namespace/index.mjs";
|
|
2
|
+
import { useProMenuTree as t } from "./hooks.mjs";
|
|
3
|
+
import { MENU_TREE_URL as n, proMenuTreeEmits as r, proMenuTreeProps as i } from "./types.mjs";
|
|
4
|
+
import { Fragment as a, computed as o, createTextVNode as s, createVNode as c, defineComponent as l, onMounted as u, reactive as d, ref as f, watch as p } from "vue";
|
|
5
|
+
import { Button as m, Empty as h, InputSearch as g, Spin as ee, Tree as te, message as _ } from "ant-design-vue";
|
|
6
|
+
//#region src/components/pro-menu-tree/src/pro-menu-tree.tsx
|
|
7
|
+
var v = /* @__PURE__ */ l({
|
|
8
|
+
name: "KProMenuTree",
|
|
9
|
+
props: i,
|
|
10
|
+
emits: r,
|
|
11
|
+
setup(r, { emit: i, slots: l, expose: v }) {
|
|
12
|
+
let y = e("pro-menu-tree"), { treeData: ne, nodeMap: b, normalizeTree: re, getAllCheckableNodeIds: x, getAllExpandableKeys: ie, getDefaultExpandedKeys: S, searchTree: ae, getFilteredTree: C, buildCheckedStateFromIds: w, buildCheckedStateAfterToggle: T, isButton: E } = t(() => ({
|
|
13
|
+
fieldNames: r.fieldNames,
|
|
14
|
+
nodeTypeField: r.nodeTypeField,
|
|
15
|
+
buttonType: r.buttonType
|
|
16
|
+
})), D = f(!1), O = f(""), k = f([]), A = f(!0), j = d({
|
|
17
|
+
checked: [],
|
|
18
|
+
halfChecked: []
|
|
19
|
+
}), M = !1, oe = o(() => r.fieldNames.key), se = o(() => r.fieldNames.title), N = o(() => r.showExpandActions ?? r.showToolbar), P = o(() => r.showClearAction ?? r.showToolbar), F = o(() => r.isBuiltInRequest && r.showRefreshAction), I = o(() => r.disabled), L = o(() => r.searchable || r.showToolbar || r.showStats || N.value || P.value || F.value), R = o(() => ({
|
|
20
|
+
checked: j.checked.length,
|
|
21
|
+
halfChecked: j.halfChecked.length
|
|
22
|
+
})), z = o(() => C(O.value));
|
|
23
|
+
function B() {
|
|
24
|
+
return [...j.checked, ...j.halfChecked].map((e) => ({
|
|
25
|
+
id: e,
|
|
26
|
+
selected: !0
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
function V(e) {
|
|
30
|
+
j.checked = e.checked, j.halfChecked = e.halfChecked;
|
|
31
|
+
}
|
|
32
|
+
function H() {
|
|
33
|
+
I.value || (V({
|
|
34
|
+
checked: x(),
|
|
35
|
+
halfChecked: []
|
|
36
|
+
}), J());
|
|
37
|
+
}
|
|
38
|
+
function U() {
|
|
39
|
+
if (I.value) return;
|
|
40
|
+
let e = new Set([...j.checked, ...j.halfChecked]);
|
|
41
|
+
q(x().filter((t) => !e.has(t))), J();
|
|
42
|
+
}
|
|
43
|
+
function W() {
|
|
44
|
+
I.value || (V({
|
|
45
|
+
checked: [],
|
|
46
|
+
halfChecked: []
|
|
47
|
+
}), J());
|
|
48
|
+
}
|
|
49
|
+
function G() {
|
|
50
|
+
I.value || (k.value = ie(), A.value = !0);
|
|
51
|
+
}
|
|
52
|
+
function K() {
|
|
53
|
+
I.value || (k.value = [], A.value = !1);
|
|
54
|
+
}
|
|
55
|
+
function q(e) {
|
|
56
|
+
V(w(e ?? []));
|
|
57
|
+
}
|
|
58
|
+
function ce(e, t) {
|
|
59
|
+
r.disabled || (V(T(j, String(t.node[oe.value] ?? t.node.key ?? t.node.eventKey ?? ""), t.checked)), J());
|
|
60
|
+
}
|
|
61
|
+
function J() {
|
|
62
|
+
M = !0, i("update:modelValue", [...j.checked, ...j.halfChecked]), i("change", B());
|
|
63
|
+
}
|
|
64
|
+
function le() {
|
|
65
|
+
b.value.size !== 0 && q(r.modelValue ?? []);
|
|
66
|
+
}
|
|
67
|
+
function Y(e) {
|
|
68
|
+
re(e), k.value = S(r.defaultExpandAll), O.value = "", A.value = !0, q(r.modelValue ?? []);
|
|
69
|
+
}
|
|
70
|
+
async function X() {
|
|
71
|
+
I.value || !r.isBuiltInRequest || await Z();
|
|
72
|
+
}
|
|
73
|
+
async function Z() {
|
|
74
|
+
if (!r.http?.get) {
|
|
75
|
+
_.error("请传入 http 实例");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
D.value = !0;
|
|
79
|
+
try {
|
|
80
|
+
let e = await r.http.get(`${r.prefix ?? ""}${n}`);
|
|
81
|
+
e.status === 0 ? (Y(Array.isArray(e.data) ? e.data : []), i("ready")) : _.error(e.message ?? e.msg ?? "获取菜单树失败");
|
|
82
|
+
} catch (e) {
|
|
83
|
+
_.error(e instanceof Error ? e.message : "获取菜单树失败");
|
|
84
|
+
} finally {
|
|
85
|
+
D.value = !1;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
u(() => {
|
|
89
|
+
r.isBuiltInRequest ? Z() : (Y(r.treeData ?? []), i("ready"));
|
|
90
|
+
}), p(() => r.treeData, (e) => {
|
|
91
|
+
r.isBuiltInRequest || Y(e ?? []);
|
|
92
|
+
}), p(() => r.modelValue, () => {
|
|
93
|
+
if (M) {
|
|
94
|
+
M = !1;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
le();
|
|
98
|
+
}, { deep: !0 });
|
|
99
|
+
function Q(e) {
|
|
100
|
+
if (I.value) return;
|
|
101
|
+
let t = ae(e);
|
|
102
|
+
O.value = t.keyword, A.value = !0, k.value = t.keyword ? t.expandedKeys : S(r.defaultExpandAll);
|
|
103
|
+
}
|
|
104
|
+
function $(e) {
|
|
105
|
+
k.value = e, A.value = !1;
|
|
106
|
+
}
|
|
107
|
+
v({
|
|
108
|
+
getSelectedStatusArray: B,
|
|
109
|
+
setCheckedKeysFromIds: q,
|
|
110
|
+
selectAll: H,
|
|
111
|
+
selectInverse: U,
|
|
112
|
+
clearChecked: W,
|
|
113
|
+
expandAll: G,
|
|
114
|
+
collapseAll: K,
|
|
115
|
+
reload: X
|
|
116
|
+
});
|
|
117
|
+
let ue = (e) => {
|
|
118
|
+
if (!O.value) return c("span", { class: y.e("title") }, [e], 2);
|
|
119
|
+
let t = e.indexOf(O.value);
|
|
120
|
+
return t === -1 ? c("span", { class: y.e("title") }, [e], 2) : c("span", { class: y.e("title") }, [
|
|
121
|
+
e.substring(0, t),
|
|
122
|
+
c("span", { class: y.e("keyword") }, [e.substring(t, t + O.value.length)], 2),
|
|
123
|
+
e.substring(t + O.value.length)
|
|
124
|
+
], 2);
|
|
125
|
+
}, de = (e) => {
|
|
126
|
+
let t = E(e), n = String(e[se.value] ?? ""), i = e[r.iconField];
|
|
127
|
+
return c("div", { class: [y.e("node"), t ? "pro-menu-tree-button" : ""] }, [c("div", { class: y.e("node-inner") }, [!t && l.icon ? l.icon({
|
|
128
|
+
node: e,
|
|
129
|
+
icon: i
|
|
130
|
+
}) : null, ue(n)], 2)], 2);
|
|
131
|
+
}, fe = () => c(te, {
|
|
132
|
+
treeData: z.value,
|
|
133
|
+
fieldNames: r.fieldNames,
|
|
134
|
+
checkedKeys: {
|
|
135
|
+
checked: j.checked,
|
|
136
|
+
halfChecked: j.halfChecked
|
|
137
|
+
},
|
|
138
|
+
expandedKeys: k.value,
|
|
139
|
+
autoExpandParent: A.value,
|
|
140
|
+
checkable: !0,
|
|
141
|
+
checkStrictly: !0,
|
|
142
|
+
disabled: r.disabled,
|
|
143
|
+
selectable: !1,
|
|
144
|
+
onCheck: ce,
|
|
145
|
+
onExpand: $
|
|
146
|
+
}, {
|
|
147
|
+
title: (e) => de(e),
|
|
148
|
+
_: 1
|
|
149
|
+
}, 8, [
|
|
150
|
+
"treeData",
|
|
151
|
+
"fieldNames",
|
|
152
|
+
"checkedKeys",
|
|
153
|
+
"expandedKeys",
|
|
154
|
+
"autoExpandParent",
|
|
155
|
+
"checkable",
|
|
156
|
+
"checkStrictly",
|
|
157
|
+
"disabled",
|
|
158
|
+
"onCheck",
|
|
159
|
+
"onExpand"
|
|
160
|
+
]), pe = () => r.showToolbar || P.value || N.value || F.value ? c("div", { class: y.e("actions") }, [
|
|
161
|
+
r.showToolbar && c(a, null, [c(m, {
|
|
162
|
+
size: "small",
|
|
163
|
+
disabled: r.disabled,
|
|
164
|
+
onClick: H
|
|
165
|
+
}, { default: () => [s("全选")] }, 8, ["disabled", "onClick"]), c(m, {
|
|
166
|
+
size: "small",
|
|
167
|
+
disabled: r.disabled,
|
|
168
|
+
onClick: U
|
|
169
|
+
}, { default: () => [s("反选")] }, 8, ["disabled", "onClick"])]),
|
|
170
|
+
P.value && c(m, {
|
|
171
|
+
size: "small",
|
|
172
|
+
disabled: r.disabled,
|
|
173
|
+
onClick: W
|
|
174
|
+
}, { default: () => [s("清空")] }, 8, ["disabled", "onClick"]),
|
|
175
|
+
N.value && c(a, null, [c(m, {
|
|
176
|
+
size: "small",
|
|
177
|
+
disabled: I.value,
|
|
178
|
+
onClick: G
|
|
179
|
+
}, { default: () => [s("展开全部")] }, 8, ["disabled", "onClick"]), c(m, {
|
|
180
|
+
size: "small",
|
|
181
|
+
disabled: I.value,
|
|
182
|
+
onClick: K
|
|
183
|
+
}, { default: () => [s("收起全部")] }, 8, ["disabled", "onClick"])]),
|
|
184
|
+
F.value && c(m, {
|
|
185
|
+
size: "small",
|
|
186
|
+
disabled: I.value,
|
|
187
|
+
loading: D.value,
|
|
188
|
+
onClick: X
|
|
189
|
+
}, { default: () => [s("刷新")] }, 8, [
|
|
190
|
+
"disabled",
|
|
191
|
+
"loading",
|
|
192
|
+
"onClick"
|
|
193
|
+
])
|
|
194
|
+
], 2) : null;
|
|
195
|
+
return () => c("div", { class: y.b() }, [L.value && c("div", { class: y.e("toolbar") }, [c("div", { class: y.e("tools") }, [r.searchable && c(g, {
|
|
196
|
+
class: y.e("search"),
|
|
197
|
+
value: O.value,
|
|
198
|
+
placeholder: "请输入菜单名称",
|
|
199
|
+
allowClear: !0,
|
|
200
|
+
disabled: I.value,
|
|
201
|
+
onSearch: Q,
|
|
202
|
+
onChange: (e) => Q(e.target?.value ?? "")
|
|
203
|
+
}, null, 8, [
|
|
204
|
+
"class",
|
|
205
|
+
"value",
|
|
206
|
+
"allowClear",
|
|
207
|
+
"disabled",
|
|
208
|
+
"onSearch",
|
|
209
|
+
"onChange"
|
|
210
|
+
]), r.showStats && c("span", { class: y.e("stats") }, [
|
|
211
|
+
s("已选 "),
|
|
212
|
+
R.value.checked,
|
|
213
|
+
s(" 项 / 半选 "),
|
|
214
|
+
R.value.halfChecked,
|
|
215
|
+
s(" 项")
|
|
216
|
+
], 2)], 2), pe()], 2), c(ee, { spinning: D.value }, { default: () => [c("div", { class: y.e("body") }, [z.value.length > 0 ? fe() : c(h, {
|
|
217
|
+
image: h.PRESENTED_IMAGE_SIMPLE,
|
|
218
|
+
description: "暂无数据"
|
|
219
|
+
}, null, 8, ["image"])], 2)] }, 8, ["spinning"])], 2);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
//#endregion
|
|
223
|
+
export { v as default };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region src/components/pro-menu-tree/src/types.ts
|
|
2
|
+
var e = {
|
|
3
|
+
modelValue: {
|
|
4
|
+
type: Array,
|
|
5
|
+
default: () => []
|
|
6
|
+
},
|
|
7
|
+
treeData: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: () => []
|
|
10
|
+
},
|
|
11
|
+
fieldNames: {
|
|
12
|
+
type: Object,
|
|
13
|
+
default: () => ({
|
|
14
|
+
title: "menuTitle",
|
|
15
|
+
key: "id",
|
|
16
|
+
children: "children"
|
|
17
|
+
})
|
|
18
|
+
},
|
|
19
|
+
nodeTypeField: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "menuType"
|
|
22
|
+
},
|
|
23
|
+
buttonType: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "button"
|
|
26
|
+
},
|
|
27
|
+
iconField: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "menuIcon"
|
|
30
|
+
},
|
|
31
|
+
isBuiltInRequest: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: !1
|
|
34
|
+
},
|
|
35
|
+
http: {
|
|
36
|
+
type: [Object, Function],
|
|
37
|
+
default: () => {}
|
|
38
|
+
},
|
|
39
|
+
prefix: String,
|
|
40
|
+
defaultExpandAll: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: !0
|
|
43
|
+
},
|
|
44
|
+
searchable: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: !1
|
|
47
|
+
},
|
|
48
|
+
showToolbar: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !1
|
|
51
|
+
},
|
|
52
|
+
showStats: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: !1
|
|
55
|
+
},
|
|
56
|
+
showExpandActions: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: void 0
|
|
59
|
+
},
|
|
60
|
+
showClearAction: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: void 0
|
|
63
|
+
},
|
|
64
|
+
showRefreshAction: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: !0
|
|
67
|
+
},
|
|
68
|
+
disabled: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: !1
|
|
71
|
+
}
|
|
72
|
+
}, t = "/qy/menu/whole/tree", n = {
|
|
73
|
+
"update:modelValue": (e) => !0,
|
|
74
|
+
ready: () => !0,
|
|
75
|
+
change: (e) => !0
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
export { t as MENU_TREE_URL, n as proMenuTreeEmits, e as proMenuTreeProps };
|
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
import { useNamespace as e } from "../../../hooks/use-namespace/index.mjs";
|
|
2
|
-
import { ProModalProps as t } from "./types.mjs";
|
|
3
|
-
import { computed as
|
|
4
|
-
import { Modal as
|
|
5
|
-
import { useDraggable as
|
|
2
|
+
import { ProModalProps as t, proModalEmits as n } from "./types.mjs";
|
|
3
|
+
import { computed as r, createBlock as i, createElementVNode as a, createSlots as o, defineComponent as s, mergeModels as c, mergeProps as l, normalizeStyle as u, openBlock as d, ref as f, renderSlot as p, resolveDynamicComponent as m, toDisplayString as h, unref as g, useModel as _, watch as v, watchEffect as y, withCtx as b } from "vue";
|
|
4
|
+
import { Modal as x } from "ant-design-vue";
|
|
5
|
+
import { useDraggable as S } from "@vueuse/core";
|
|
6
6
|
//#region src/components/pro-modal/src/ProModal.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
-
var
|
|
7
|
+
var C = /* @__PURE__ */ s({
|
|
8
8
|
name: "ProModal",
|
|
9
9
|
__name: "ProModal",
|
|
10
|
-
props: /* @__PURE__ */
|
|
10
|
+
props: /* @__PURE__ */ c(t, {
|
|
11
11
|
modelValue: {
|
|
12
12
|
required: !0,
|
|
13
13
|
type: Boolean
|
|
14
14
|
},
|
|
15
15
|
modelModifiers: {}
|
|
16
16
|
}),
|
|
17
|
-
emits: /* @__PURE__ */
|
|
18
|
-
setup(t, { emit:
|
|
19
|
-
let s =
|
|
17
|
+
emits: /* @__PURE__ */ c(n, ["update:modelValue"]),
|
|
18
|
+
setup(t, { emit: n }) {
|
|
19
|
+
let s = n, c = f(null), C = _(t, "modelValue"), { b: w } = e("pro-modal"), T = r(() => w());
|
|
20
20
|
function E() {
|
|
21
21
|
s("onConfirm");
|
|
22
22
|
}
|
|
23
23
|
function D() {
|
|
24
24
|
s("onCancel");
|
|
25
25
|
}
|
|
26
|
-
let { x: O, y: k, isDragging: A } =
|
|
26
|
+
let { x: O, y: k, isDragging: A } = S(c), j = f(0), M = f(0), N = f(!1), P = f(0), F = f(0), I = f(0), L = f(0), R = f({
|
|
27
27
|
left: 0,
|
|
28
28
|
right: 0,
|
|
29
29
|
top: 0,
|
|
30
30
|
bottom: 0
|
|
31
31
|
});
|
|
32
|
-
|
|
33
|
-
if (!N.value &&
|
|
32
|
+
v([O, k], () => {
|
|
33
|
+
if (!N.value && c.value) {
|
|
34
34
|
j.value = O.value, M.value = k.value;
|
|
35
|
-
let e = document.body.getBoundingClientRect(), t =
|
|
35
|
+
let e = document.body.getBoundingClientRect(), t = c.value.getBoundingClientRect();
|
|
36
36
|
R.value.right = e.width - t.width, R.value.bottom = e.height - t.height, I.value = P.value, L.value = F.value;
|
|
37
37
|
}
|
|
38
38
|
N.value = !0;
|
|
39
|
-
}),
|
|
39
|
+
}), v(A, () => {
|
|
40
40
|
A || (N.value = !1);
|
|
41
|
-
}),
|
|
41
|
+
}), y(() => {
|
|
42
42
|
N.value && (P.value = I.value + Math.min(Math.max(R.value.left, O.value), R.value.right) - j.value, F.value = L.value + Math.min(Math.max(R.value.top, k.value), R.value.bottom) - M.value);
|
|
43
43
|
});
|
|
44
|
-
let z =
|
|
45
|
-
return (e, t) => (
|
|
44
|
+
let z = r(() => ({ transform: `translate(${P.value}px, ${F.value}px)` }));
|
|
45
|
+
return (e, t) => (d(), i(g(x), l({
|
|
46
46
|
open: C.value,
|
|
47
47
|
"onUpdate:open": t[0] ||= (e) => C.value = e
|
|
48
48
|
}, e.modalProps, {
|
|
49
49
|
"wrap-class-name": T.value,
|
|
50
50
|
onOk: E,
|
|
51
51
|
onCancel: D
|
|
52
|
-
}),
|
|
53
|
-
title:
|
|
52
|
+
}), o({
|
|
53
|
+
title: b(() => [a("div", {
|
|
54
54
|
ref_key: "modalTitleRef",
|
|
55
|
-
ref:
|
|
55
|
+
ref: c,
|
|
56
56
|
class: "pro-modal-title"
|
|
57
|
-
},
|
|
58
|
-
modalRender:
|
|
59
|
-
default:
|
|
57
|
+
}, h(e.title), 513)]),
|
|
58
|
+
modalRender: b(({ originVNode: e }) => [a("div", { style: u(z.value) }, [(d(), i(m(e)))], 4)]),
|
|
59
|
+
default: b(() => [p(e.$slots, "default")]),
|
|
60
60
|
_: 2
|
|
61
61
|
}, [e.$slots.footer ? {
|
|
62
62
|
name: "footer",
|
|
63
|
-
fn:
|
|
63
|
+
fn: b(() => [p(e.$slots, "footer")]),
|
|
64
64
|
key: "0"
|
|
65
65
|
} : void 0]), 1040, ["open", "wrap-class-name"]));
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
//#endregion
|
|
69
|
-
export {
|
|
69
|
+
export { C as default };
|