@king-one/antdv 1.2.23 → 1.2.25
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/CHANGELOG.md +12 -0
- package/dist/es/components/dept-selector/src/dept.mjs +40 -40
- package/dist/es/components/dept-selector/src/types.mjs +8 -1
- package/dist/es/components/pro-selector/src/pro-user.mjs +33 -33
- package/dist/es/components/pro-selector/src/types.mjs +10 -3
- package/dist/es/components/pro-table/src/pro-table.vue2.mjs +52 -47
- package/dist/es/components/role-selector/src/role.mjs +44 -44
- package/dist/es/components/role-selector/src/types.mjs +8 -1
- package/dist/lib/components/dept-selector/src/dept.js +1 -1
- package/dist/lib/components/dept-selector/src/types.js +1 -1
- package/dist/lib/components/pro-selector/src/pro-user.js +1 -1
- package/dist/lib/components/pro-selector/src/types.js +1 -1
- package/dist/lib/components/pro-table/src/pro-table.vue2.js +1 -1
- package/dist/lib/components/role-selector/src/role.js +1 -1
- package/dist/lib/components/role-selector/src/types.js +1 -1
- package/dist/theme-chalk/icon.css +1 -1
- package/dist/theme-chalk/index.css +1 -1
- package/dist/types/components/dept-selector/index.d.ts +9 -0
- package/dist/types/components/dept-selector/src/dept.d.ts +9 -0
- package/dist/types/components/dept-selector/src/types.d.ts +7 -0
- package/dist/types/components/pro-selector/index.d.ts +9 -0
- package/dist/types/components/pro-selector/src/pro-user.d.ts +9 -0
- package/dist/types/components/pro-selector/src/types.d.ts +7 -0
- package/dist/types/components/pro-table/src/types.d.ts +2 -0
- package/dist/types/components/role-selector/index.d.ts +18 -0
- package/dist/types/components/role-selector/src/role.d.ts +9 -0
- package/dist/types/components/role-selector/src/types.d.ts +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as H, ref as s, watch as
|
|
1
|
+
import { defineComponent as H, ref as s, watch as p, createVNode as n, Fragment as J } from "vue";
|
|
2
2
|
import { useNamespace as Q } from "../../../hooks/use-namespace/index.mjs";
|
|
3
3
|
import "../../index.mjs";
|
|
4
4
|
import { message as W, FormItemRest as X, InputSearch as Y, Tree as Z, Empty as C, Input as ee } from "ant-design-vue";
|
|
@@ -14,11 +14,11 @@ const f = Q("dept-selector"), ve = /* @__PURE__ */ H({
|
|
|
14
14
|
attrs: V,
|
|
15
15
|
slots: g
|
|
16
16
|
}) {
|
|
17
|
-
const x = s(!0), w = s(!0), y = s([]), m = s([]),
|
|
17
|
+
const x = s(!0), w = s(!0), y = s([]), m = s([]), d = s([]), A = s(!1), u = s(t.isBuiltInRequest ? {
|
|
18
18
|
children: "children",
|
|
19
19
|
title: "deptName",
|
|
20
20
|
key: "id"
|
|
21
|
-
} : t.fieldNames),
|
|
21
|
+
} : t.fieldNames), S = s(""), r = s([]), v = s(t.treeData), E = s(!1), k = s("");
|
|
22
22
|
if (t.isBuiltInRequest) {
|
|
23
23
|
if (!t.http)
|
|
24
24
|
throw new Error("请传入http实例");
|
|
@@ -30,10 +30,10 @@ const f = Q("dept-selector"), ve = /* @__PURE__ */ H({
|
|
|
30
30
|
if (t.type === "checkbox") {
|
|
31
31
|
if (!Array.isArray(t.modelValue)) return;
|
|
32
32
|
const e = t.modelValue.map((l) => l[u.value.key]);
|
|
33
|
-
x.value ?
|
|
33
|
+
x.value ? d.value = {
|
|
34
34
|
checked: e,
|
|
35
35
|
halfChecked: []
|
|
36
|
-
} :
|
|
36
|
+
} : d.value = e, y.value = e;
|
|
37
37
|
} else {
|
|
38
38
|
if (Array.isArray(t.modelValue)) return;
|
|
39
39
|
const e = t.modelValue[u.value.key];
|
|
@@ -42,18 +42,18 @@ const f = Q("dept-selector"), ve = /* @__PURE__ */ H({
|
|
|
42
42
|
}, I = (e) => {
|
|
43
43
|
if (E.value)
|
|
44
44
|
return E.value = !1;
|
|
45
|
-
t.type === "radio" ?
|
|
45
|
+
t.type === "radio" ? r.value.length > 0 && (S.value = r.value[0][u.value.title] || "") : S.value = r.value.map((l) => l[u.value.title]).join(",");
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
p(() => t.visible, () => {
|
|
48
48
|
t.visible && N();
|
|
49
49
|
}, {
|
|
50
50
|
immediate: !0
|
|
51
|
-
}),
|
|
51
|
+
}), p(() => t.modelValue, () => {
|
|
52
52
|
v.value.length > 0 && N();
|
|
53
53
|
}, {
|
|
54
54
|
immediate: !0,
|
|
55
55
|
deep: !0
|
|
56
|
-
}),
|
|
56
|
+
}), p(v, () => {
|
|
57
57
|
v.value.length > 0 && N();
|
|
58
58
|
}, {
|
|
59
59
|
immediate: !0,
|
|
@@ -76,17 +76,17 @@ const f = Q("dept-selector"), ve = /* @__PURE__ */ H({
|
|
|
76
76
|
function D(e) {
|
|
77
77
|
return e ? e.map((l) => R(l)).filter(Boolean) : [];
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
t.type === "checkbox" && (x.value ?
|
|
79
|
+
p(d, () => {
|
|
80
|
+
t.type === "checkbox" && (x.value ? r.value = D(d.value.checked) : r.value = D(d.value), I("watch checkedKeys..."));
|
|
81
81
|
}, {
|
|
82
82
|
immediate: !0,
|
|
83
83
|
deep: !0
|
|
84
|
-
}),
|
|
85
|
-
t.type === "radio" && (
|
|
84
|
+
}), p(m, () => {
|
|
85
|
+
t.type === "radio" && (r.value = D(m.value), I("watch selectedKeys..."));
|
|
86
86
|
}, {
|
|
87
87
|
immediate: !0,
|
|
88
88
|
deep: !0
|
|
89
|
-
}),
|
|
89
|
+
}), p(() => t.treeData, () => {
|
|
90
90
|
t.isBuiltInRequest || (v.value = t.treeData);
|
|
91
91
|
});
|
|
92
92
|
const _ = () => {
|
|
@@ -96,27 +96,27 @@ const f = Q("dept-selector"), ve = /* @__PURE__ */ H({
|
|
|
96
96
|
}, O = () => {
|
|
97
97
|
h("update:visible", !1), h("cancel");
|
|
98
98
|
}, F = () => {
|
|
99
|
-
if (!
|
|
99
|
+
if (!r.value.length) {
|
|
100
100
|
W.warn("请选择部门");
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
t.type === "radio" ? h("update:modelValue", {
|
|
104
104
|
[u.value.key]: m.value[0],
|
|
105
|
-
[u.value.title]:
|
|
106
|
-
}) : h("update:modelValue",
|
|
105
|
+
[u.value.title]: r.value[0][u.value.title]
|
|
106
|
+
}) : h("update:modelValue", r.value.map((e) => ({
|
|
107
107
|
[u.value.key]: e[u.value.key],
|
|
108
108
|
[u.value.title]: e[u.value.title]
|
|
109
|
-
}))), h("update:visible", !1), h("confirm",
|
|
109
|
+
}))), h("update:visible", !1), h("confirm", r.value), I("handleConfirm ...");
|
|
110
110
|
}, M = (e) => {
|
|
111
111
|
if (E.value = !0, t.type === "radio")
|
|
112
|
-
return
|
|
112
|
+
return r.value = [], m.value = [], !1;
|
|
113
113
|
if (x.value)
|
|
114
|
-
|
|
114
|
+
d.value.checked = d.value.checked.filter((l) => l !== e[u.value.key]);
|
|
115
115
|
else {
|
|
116
|
-
const l = e.parentId, i =
|
|
117
|
-
i !== -1 &&
|
|
118
|
-
const c =
|
|
119
|
-
c !== -1 &&
|
|
116
|
+
const l = e.parentId, i = d.value.indexOf(l);
|
|
117
|
+
i !== -1 && d.value.splice(i, 1), d.value = d.value.filter((a) => a !== e[u.value.key]), L(e.children).forEach((a) => {
|
|
118
|
+
const c = d.value.indexOf(a);
|
|
119
|
+
c !== -1 && d.value.splice(c, 1);
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
}, L = (e) => {
|
|
@@ -140,7 +140,7 @@ const f = Q("dept-selector"), ve = /* @__PURE__ */ H({
|
|
|
140
140
|
default: () => [n("div", {
|
|
141
141
|
class: f.e("modal-content")
|
|
142
142
|
}, [$(), j()], 2)]
|
|
143
|
-
}, 8, ["modelValue", "modalProps", "onOnCancel", "onOnConfirm"])]),
|
|
143
|
+
}, 8, ["modelValue", "modalProps", "onOnCancel", "onOnConfirm"])]), b = (e, l) => {
|
|
144
144
|
let i;
|
|
145
145
|
for (let o = 0; o < l.length; o++) {
|
|
146
146
|
const a = l[o];
|
|
@@ -148,35 +148,35 @@ const f = Q("dept-selector"), ve = /* @__PURE__ */ H({
|
|
|
148
148
|
if (a.children.some((c) => c[u.value.key] === e)) {
|
|
149
149
|
i = a[u.value.key];
|
|
150
150
|
break;
|
|
151
|
-
} else
|
|
151
|
+
} else b(e, a.children) && (i = b(e, a.children));
|
|
152
152
|
}
|
|
153
153
|
return i;
|
|
154
154
|
}, z = (e) => {
|
|
155
155
|
if (!e.trim()) {
|
|
156
|
-
y.value = [],
|
|
156
|
+
y.value = [], k.value = "", w.value = !0;
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
159
|
const l = /* @__PURE__ */ new Set(), i = (o, a) => {
|
|
160
160
|
o.forEach((c) => {
|
|
161
161
|
var U;
|
|
162
162
|
if ((U = c[u.value.title]) != null && U.includes(a)) {
|
|
163
|
-
let
|
|
164
|
-
for (;
|
|
165
|
-
l.add(
|
|
163
|
+
let K = b(c[u.value.key], v.value);
|
|
164
|
+
for (; K; )
|
|
165
|
+
l.add(K), K = b(K, v.value);
|
|
166
166
|
l.add(c[u.value.key]);
|
|
167
167
|
}
|
|
168
168
|
c.children && c.children.length > 0 && i(c.children, a);
|
|
169
169
|
});
|
|
170
170
|
};
|
|
171
|
-
i(v.value, e), y.value = Array.from(l),
|
|
171
|
+
i(v.value, e), y.value = Array.from(l), k.value = e, w.value = !0;
|
|
172
172
|
}, G = (e) => {
|
|
173
173
|
const l = e[u.value.title] || "";
|
|
174
|
-
if (!
|
|
174
|
+
if (!k.value)
|
|
175
175
|
return n("span", null, [l]);
|
|
176
|
-
const i = l.indexOf(
|
|
176
|
+
const i = l.indexOf(k.value);
|
|
177
177
|
if (i === -1)
|
|
178
178
|
return n("span", null, [l]);
|
|
179
|
-
const o = l.substring(0, i), a = l.substring(i, i +
|
|
179
|
+
const o = l.substring(0, i), a = l.substring(i, i + k.value.length), c = l.substring(i + k.value.length);
|
|
180
180
|
return n("span", null, [o, n("span", {
|
|
181
181
|
style: "color: #f50; font-weight: bold"
|
|
182
182
|
}, [a]), c]);
|
|
@@ -196,8 +196,8 @@ const f = Q("dept-selector"), ve = /* @__PURE__ */ H({
|
|
|
196
196
|
"onUpdate:expandedKeys": (e) => y.value = e,
|
|
197
197
|
selectedKeys: m.value,
|
|
198
198
|
"onUpdate:selectedKeys": (e) => m.value = e,
|
|
199
|
-
checkedKeys:
|
|
200
|
-
"onUpdate:checkedKeys": (e) =>
|
|
199
|
+
checkedKeys: d.value,
|
|
200
|
+
"onUpdate:checkedKeys": (e) => d.value = e,
|
|
201
201
|
checkable: t.type === "checkbox",
|
|
202
202
|
checkStrictly: x.value,
|
|
203
203
|
"show-icon": !0,
|
|
@@ -222,7 +222,7 @@ const f = Q("dept-selector"), ve = /* @__PURE__ */ H({
|
|
|
222
222
|
size: 16
|
|
223
223
|
}, null, 8, ["name"]), j = () => n("div", {
|
|
224
224
|
class: f.e("modal-content-right")
|
|
225
|
-
}, [
|
|
225
|
+
}, [r.value.length > 0 ? r.value.map((e) => n("div", {
|
|
226
226
|
class: f.e("modal-content-right-item")
|
|
227
227
|
}, [n("div", {
|
|
228
228
|
class: f.e("modal-content-right-item-label")
|
|
@@ -240,11 +240,11 @@ const f = Q("dept-selector"), ve = /* @__PURE__ */ H({
|
|
|
240
240
|
var e;
|
|
241
241
|
return n("div", {
|
|
242
242
|
class: f.b()
|
|
243
|
-
}, [(e = g.default) != null && e.call(g) ? g.default() : n("div", null, [n(ee, {
|
|
243
|
+
}, [t.hideSlot ? null : (e = g.default) != null && e.call(g) ? g.default() : n("div", null, [n(ee, {
|
|
244
244
|
style: "width: 100%;",
|
|
245
245
|
readonly: !0,
|
|
246
|
-
value:
|
|
247
|
-
"onUpdate:value": (l) =>
|
|
246
|
+
value: S.value,
|
|
247
|
+
"onUpdate:value": (l) => S.value = l,
|
|
248
248
|
onClick: () => h("update:visible", !0),
|
|
249
249
|
placeholder: "请选择部门"
|
|
250
250
|
}, {
|
|
@@ -39,7 +39,14 @@ const t = {
|
|
|
39
39
|
/**
|
|
40
40
|
* 请求前缀,如 qy-user-service
|
|
41
41
|
*/
|
|
42
|
-
prefix: String
|
|
42
|
+
prefix: String,
|
|
43
|
+
/**
|
|
44
|
+
* 是否隐藏插槽,只使用 modal
|
|
45
|
+
*/
|
|
46
|
+
hideSlot: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !1
|
|
49
|
+
}
|
|
43
50
|
}, l = "/security/dept/company/tree", a = {
|
|
44
51
|
"update:visible": (e) => !0,
|
|
45
52
|
"update:modelValue": (e) => !0,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as L, ref as
|
|
1
|
+
import { defineComponent as L, ref as s, provide as O, reactive as T, watch as U, nextTick as g, createVNode as l, createTextVNode as v } from "vue";
|
|
2
2
|
import "../../index.mjs";
|
|
3
3
|
import { useNamespace as D } from "../../../hooks/use-namespace/index.mjs";
|
|
4
4
|
import { message as w, Input as R, Empty as x, FormItemRest as B } from "ant-design-vue";
|
|
@@ -14,30 +14,30 @@ const {
|
|
|
14
14
|
name: "ProUserSelector",
|
|
15
15
|
props: A,
|
|
16
16
|
emits: z,
|
|
17
|
-
setup(
|
|
18
|
-
emit:
|
|
17
|
+
setup(a, {
|
|
18
|
+
emit: n,
|
|
19
19
|
slots: p,
|
|
20
20
|
expose: E,
|
|
21
21
|
attrs: V
|
|
22
22
|
}) {
|
|
23
|
-
const d =
|
|
23
|
+
const d = s(""), r = s([]), o = s(), c = s(null);
|
|
24
24
|
O(M, T({
|
|
25
|
-
maxCount:
|
|
26
|
-
http:
|
|
27
|
-
isBuiltInRequest:
|
|
28
|
-
prefix:
|
|
29
|
-
initData:
|
|
25
|
+
maxCount: a.maxCount,
|
|
26
|
+
http: a.http,
|
|
27
|
+
isBuiltInRequest: a.isBuiltInRequest,
|
|
28
|
+
prefix: a.prefix,
|
|
29
|
+
initData: a.initData
|
|
30
30
|
}));
|
|
31
|
-
const h =
|
|
32
|
-
U(() =>
|
|
31
|
+
const h = s(a.modelValue || []), m = s(!1);
|
|
32
|
+
U(() => a.modelValue, (e) => {
|
|
33
33
|
m.value ? m.value = !1 : (h.value = JSON.parse(JSON.stringify(e)), g(() => {
|
|
34
34
|
k(h.value);
|
|
35
35
|
}));
|
|
36
36
|
}, {
|
|
37
37
|
deep: !0,
|
|
38
38
|
immediate: !0
|
|
39
|
-
}), U(r, (e,
|
|
40
|
-
e.length >
|
|
39
|
+
}), U(r, (e, t) => {
|
|
40
|
+
e.length > t.length && g(() => {
|
|
41
41
|
c.value && (c.value.scrollTop = c.value.scrollHeight);
|
|
42
42
|
});
|
|
43
43
|
}, {
|
|
@@ -45,34 +45,34 @@ const {
|
|
|
45
45
|
});
|
|
46
46
|
async function k(e) {
|
|
47
47
|
if (o.value) {
|
|
48
|
-
const
|
|
49
|
-
o.value.getInitData(e,
|
|
48
|
+
const t = await o.value.dataLoadPromise;
|
|
49
|
+
o.value.getInitData(e, t);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
const I = (e) => {
|
|
53
|
-
var
|
|
54
|
-
r.value = r.value.filter((y) => y.id !== e), (
|
|
53
|
+
var t;
|
|
54
|
+
r.value = r.value.filter((y) => y.id !== e), (t = o.value) == null || t.deleteDeptUser(e);
|
|
55
55
|
}, b = () => {
|
|
56
|
-
|
|
56
|
+
n("update:visible", !1), n("cancel");
|
|
57
57
|
}, C = (e) => {
|
|
58
|
-
|
|
58
|
+
n("update:modelValue", a.modelValue.filter((t) => t.id !== e));
|
|
59
59
|
}, N = () => {
|
|
60
60
|
if (r.value.length === 0) {
|
|
61
61
|
w.warn("请选择用户");
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
const e = r.value.map((
|
|
65
|
-
id:
|
|
66
|
-
realName:
|
|
67
|
-
avatar:
|
|
64
|
+
const e = r.value.map((t) => ({
|
|
65
|
+
id: t.id,
|
|
66
|
+
realName: t.realName || "",
|
|
67
|
+
avatar: t.avatar
|
|
68
68
|
}));
|
|
69
|
-
|
|
69
|
+
n("update:visible", !1), m.value = !0, n("update:modelValue", e), n("confirm", e);
|
|
70
70
|
};
|
|
71
71
|
E({
|
|
72
72
|
deleteCheckedUser: C
|
|
73
73
|
});
|
|
74
|
-
const
|
|
75
|
-
modelValue:
|
|
74
|
+
const S = () => l(_, {
|
|
75
|
+
modelValue: a.visible,
|
|
76
76
|
title: "选择联系人",
|
|
77
77
|
modalProps: {
|
|
78
78
|
cancelText: "取消",
|
|
@@ -108,7 +108,7 @@ const {
|
|
|
108
108
|
class: u("content-right")
|
|
109
109
|
}, [l("div", {
|
|
110
110
|
class: u("content-right-title")
|
|
111
|
-
}, [v("已选:"), r.value.length, v("/"),
|
|
111
|
+
}, [v("已选:"), r.value.length, v("/"), a.maxCount, v("人")], 2), l("div", {
|
|
112
112
|
class: "select-user-list",
|
|
113
113
|
ref: c
|
|
114
114
|
}, [l("div", {
|
|
@@ -123,19 +123,19 @@ const {
|
|
|
123
123
|
image: x.PRESENTED_IMAGE_SIMPLE,
|
|
124
124
|
description: "暂无数据"
|
|
125
125
|
}, null, 8, ["image"])], 2)], 512)], 2)], 2)]
|
|
126
|
-
}, 8, ["modelValue", "modalProps", "onOnCancel", "onOnConfirm"]),
|
|
126
|
+
}, 8, ["modelValue", "modalProps", "onOnCancel", "onOnConfirm"]), P = () => l(B, null, {
|
|
127
127
|
default: () => [l("div", {
|
|
128
128
|
class: i.b()
|
|
129
|
-
}, [p.default ? p.default() : l("div", {
|
|
129
|
+
}, [a.hideSlot ? null : p.default ? p.default() : l("div", {
|
|
130
130
|
class: i.b("list")
|
|
131
131
|
}, [l("div", {
|
|
132
132
|
class: i.b("icon"),
|
|
133
|
-
onClick: () =>
|
|
133
|
+
onClick: () => n("update:visible", !0)
|
|
134
134
|
}, [l(f, {
|
|
135
135
|
name: "plus",
|
|
136
136
|
size: 20,
|
|
137
137
|
color: "#409eff"
|
|
138
|
-
}, null)], 10, ["onClick"]),
|
|
138
|
+
}, null)], 10, ["onClick"]), a.modelValue.map((e) => l("div", {
|
|
139
139
|
class: i.b("item")
|
|
140
140
|
}, [l(q, {
|
|
141
141
|
name: e.realName,
|
|
@@ -149,9 +149,9 @@ const {
|
|
|
149
149
|
name: "shanchu",
|
|
150
150
|
size: 18,
|
|
151
151
|
color: "#646a73"
|
|
152
|
-
}, null)], 8, ["onClick"])], 2))], 2),
|
|
152
|
+
}, null)], 8, ["onClick"])], 2))], 2), S()], 2)]
|
|
153
153
|
});
|
|
154
|
-
return () =>
|
|
154
|
+
return () => P();
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
export {
|
|
@@ -33,8 +33,15 @@ const t = Symbol("selectUserContextKey"), l = {
|
|
|
33
33
|
type: Boolean,
|
|
34
34
|
default: !1
|
|
35
35
|
},
|
|
36
|
-
prefix: String
|
|
37
|
-
|
|
36
|
+
prefix: String,
|
|
37
|
+
/**
|
|
38
|
+
* 是否隐藏插槽,只使用 modal
|
|
39
|
+
*/
|
|
40
|
+
hideSlot: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: !1
|
|
43
|
+
}
|
|
44
|
+
}, u = "/security/dept/user/tree", o = {
|
|
38
45
|
"update:visible": (e) => !0,
|
|
39
46
|
"update:modelValue": (e) => !0,
|
|
40
47
|
"delete-user": (e) => !0,
|
|
@@ -45,5 +52,5 @@ export {
|
|
|
45
52
|
u as GTE_ORGTREE_URL,
|
|
46
53
|
l as UserSelectorProps,
|
|
47
54
|
t as selectUserContextKey,
|
|
48
|
-
|
|
55
|
+
o as userSelectorEmits
|
|
49
56
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as $, useSlots as x, ref as c, reactive as C, watch as
|
|
2
|
-
import { Card as _, Table as
|
|
3
|
-
import { spitRender as
|
|
1
|
+
import { defineComponent as $, useSlots as x, ref as c, reactive as C, watch as L, toRefs as O, provide as q, createElementBlock as s, openBlock as l, Fragment as T, createCommentVNode as r, createElementVNode as A, createBlock as g, createVNode as u, unref as t, withCtx as i, mergeProps as b, createSlots as j, renderSlot as y, normalizeProps as k, createTextVNode as I, toDisplayString as U } from "vue";
|
|
2
|
+
import { Card as _, Table as K, Pagination as M } from "ant-design-vue";
|
|
3
|
+
import { spitRender as X } from "../utils.mjs";
|
|
4
4
|
import "./form-render.vue.mjs";
|
|
5
|
-
import { TABLE_CONTEXT_PROVIDE_KEY as
|
|
6
|
-
import { useForm as
|
|
7
|
-
import { useTable as
|
|
8
|
-
import
|
|
9
|
-
const
|
|
5
|
+
import { TABLE_CONTEXT_PROVIDE_KEY as Y, ANTD_SLOT_NAMES as G } from "./constants.mjs";
|
|
6
|
+
import { useForm as H } from "./hooks/use-form.mjs";
|
|
7
|
+
import { useTable as J } from "./hooks/use-table.mjs";
|
|
8
|
+
import Q from "./form-render.vue2.mjs";
|
|
9
|
+
const W = { class: "pro-table" }, Z = {
|
|
10
10
|
key: 0,
|
|
11
11
|
style: { width: "100%" }
|
|
12
|
-
},
|
|
12
|
+
}, ee = {
|
|
13
13
|
key: 0,
|
|
14
14
|
class: "toolbar-slot"
|
|
15
|
-
},
|
|
15
|
+
}, oe = { key: 0 }, me = /* @__PURE__ */ $({
|
|
16
16
|
__name: "pro-table",
|
|
17
17
|
props: {
|
|
18
18
|
antdTableProps: {},
|
|
@@ -30,23 +30,23 @@ const Q = { class: "pro-table" }, W = {
|
|
|
30
30
|
buttonCol: {}
|
|
31
31
|
},
|
|
32
32
|
setup(w, { expose: z }) {
|
|
33
|
-
const
|
|
34
|
-
pageSize:
|
|
33
|
+
const n = w, d = x(), { columns: B } = n, h = c(), p = c(!1), a = C({
|
|
34
|
+
pageSize: n.pageSize,
|
|
35
35
|
pageNum: 1,
|
|
36
36
|
total: 0
|
|
37
|
-
}), v = c([]), { formState: S, genFormState: N } =
|
|
37
|
+
}), v = c([]), { formState: S, genFormState: N } = H(n), {
|
|
38
38
|
filteredColumns: P,
|
|
39
39
|
handleRequest: f,
|
|
40
40
|
getLabelByValue: E,
|
|
41
41
|
hasCurrentColBodySlot: F,
|
|
42
42
|
bodyCellProps: R
|
|
43
|
-
} =
|
|
43
|
+
} = J(n, d, {
|
|
44
44
|
loading: p,
|
|
45
45
|
pageData: a,
|
|
46
46
|
formState: S,
|
|
47
47
|
dataSource: v
|
|
48
48
|
});
|
|
49
|
-
|
|
49
|
+
L(
|
|
50
50
|
() => B,
|
|
51
51
|
() => {
|
|
52
52
|
N();
|
|
@@ -57,36 +57,41 @@ const Q = { class: "pro-table" }, W = {
|
|
|
57
57
|
}
|
|
58
58
|
);
|
|
59
59
|
const V = C({
|
|
60
|
-
...
|
|
60
|
+
...O(n),
|
|
61
61
|
tableSlots: d,
|
|
62
62
|
formState: S,
|
|
63
63
|
loading: p,
|
|
64
64
|
pageData: a,
|
|
65
65
|
handleRequest: f
|
|
66
66
|
});
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
q(
|
|
68
|
+
Y,
|
|
69
69
|
V
|
|
70
|
-
)
|
|
70
|
+
);
|
|
71
|
+
function D(o) {
|
|
72
|
+
Object.assign(a, o);
|
|
73
|
+
}
|
|
74
|
+
return z({
|
|
71
75
|
onRefresh: f,
|
|
72
76
|
formRef: () => {
|
|
73
|
-
var
|
|
74
|
-
return (
|
|
77
|
+
var o;
|
|
78
|
+
return (o = h.value) == null ? void 0 : o.formRef;
|
|
75
79
|
},
|
|
76
|
-
pageData: a
|
|
77
|
-
|
|
80
|
+
pageData: a,
|
|
81
|
+
setPageData: D
|
|
82
|
+
}), (o, m) => (l(), s(
|
|
78
83
|
T,
|
|
79
84
|
null,
|
|
80
85
|
[
|
|
81
|
-
|
|
82
|
-
A("div",
|
|
83
|
-
|
|
86
|
+
r(" eslint-disable vue/component-name-in-template-casing vue/no-use-v-if-with-v-for "),
|
|
87
|
+
A("div", W, [
|
|
88
|
+
o.hideForm ? r("v-if", !0) : (l(), g(t(_), {
|
|
84
89
|
key: 0,
|
|
85
90
|
class: "pro-table-form"
|
|
86
91
|
}, {
|
|
87
92
|
default: i(() => [
|
|
88
93
|
u(
|
|
89
|
-
|
|
94
|
+
Q,
|
|
90
95
|
{
|
|
91
96
|
ref_key: "formRenderRef",
|
|
92
97
|
ref: h
|
|
@@ -99,9 +104,9 @@ const Q = { class: "pro-table" }, W = {
|
|
|
99
104
|
_: 1
|
|
100
105
|
/* STABLE */
|
|
101
106
|
})),
|
|
102
|
-
u(
|
|
107
|
+
u(t(_), {
|
|
103
108
|
class: "pro-table-table",
|
|
104
|
-
title:
|
|
109
|
+
title: o.headerTitle,
|
|
105
110
|
"head-style": {
|
|
106
111
|
borderBottom: "none",
|
|
107
112
|
paddingLeft: "16px",
|
|
@@ -112,37 +117,37 @@ const Q = { class: "pro-table" }, W = {
|
|
|
112
117
|
shadow: "none!"
|
|
113
118
|
}, {
|
|
114
119
|
extra: i(() => [
|
|
115
|
-
d.toolbar ||
|
|
116
|
-
d.toolbar ? (l(), s("div",
|
|
117
|
-
|
|
118
|
-
])) : (l(), g(
|
|
119
|
-
])) :
|
|
120
|
+
d.toolbar || n.toolbarRender ? (l(), s("div", Z, [
|
|
121
|
+
d.toolbar ? (l(), s("div", ee, [
|
|
122
|
+
y(o.$slots, "toolbar")
|
|
123
|
+
])) : (l(), g(n.toolbarRender, { key: 1 }))
|
|
124
|
+
])) : r("v-if", !0)
|
|
120
125
|
]),
|
|
121
126
|
default: i(() => [
|
|
122
|
-
u(
|
|
127
|
+
u(t(K), b(o.antdTableProps, {
|
|
123
128
|
"data-source": v.value,
|
|
124
|
-
columns:
|
|
129
|
+
columns: t(P),
|
|
125
130
|
pagination: !1,
|
|
126
131
|
loading: p.value
|
|
127
|
-
}),
|
|
132
|
+
}), j({
|
|
128
133
|
bodyCell: i((e) => [
|
|
129
|
-
|
|
134
|
+
t(F)(e) ? y(o.$slots, "bodyCell", k(b({ key: 0 }, t(R)(e)))) : e.column.customRender ? (l(), g(t(X), {
|
|
130
135
|
key: 1,
|
|
131
136
|
fn: e.column.customRender,
|
|
132
|
-
scope:
|
|
137
|
+
scope: t(R)(e)
|
|
133
138
|
}, null, 8, ["fn", "scope"])) : e.column.valueType === "select" || e.column.valueEnum ? (l(), s(
|
|
134
139
|
T,
|
|
135
140
|
{ key: 2 },
|
|
136
141
|
[
|
|
137
142
|
I(
|
|
138
|
-
U(
|
|
143
|
+
U(t(E)(e.text, e.column)),
|
|
139
144
|
1
|
|
140
145
|
/* TEXT */
|
|
141
146
|
)
|
|
142
147
|
],
|
|
143
148
|
64
|
|
144
149
|
/* STABLE_FRAGMENT */
|
|
145
|
-
)) :
|
|
150
|
+
)) : r("v-if", !0)
|
|
146
151
|
]),
|
|
147
152
|
_: 2
|
|
148
153
|
/* DYNAMIC */
|
|
@@ -150,13 +155,13 @@ const Q = { class: "pro-table" }, W = {
|
|
|
150
155
|
String(name) !== "bodyCell" ? {
|
|
151
156
|
name,
|
|
152
157
|
fn: i((e) => [
|
|
153
|
-
|
|
158
|
+
t(G).includes(name) ? y(o.$slots, name, k(b({ key: 0 }, e))) : r("v-if", !0)
|
|
154
159
|
]),
|
|
155
160
|
key: "0"
|
|
156
161
|
} : void 0
|
|
157
162
|
]), 1040, ["data-source", "columns", "loading"]),
|
|
158
|
-
|
|
159
|
-
u(
|
|
163
|
+
o.hidePage ? r("v-if", !0) : (l(), s("div", oe, [
|
|
164
|
+
u(t(M), {
|
|
160
165
|
current: a.pageNum,
|
|
161
166
|
"onUpdate:current": m[0] || (m[0] = (e) => a.pageNum = e),
|
|
162
167
|
"page-size": a.pageSize,
|
|
@@ -170,8 +175,8 @@ const Q = { class: "pro-table" }, W = {
|
|
|
170
175
|
"show-less-items": "",
|
|
171
176
|
"show-size-changer": "",
|
|
172
177
|
"page-size-options": ["5", "10", "20", "50", "100"],
|
|
173
|
-
"show-total":
|
|
174
|
-
onChange:
|
|
178
|
+
"show-total": o.pageShowTotal ? (e) => `共 ${e} 条` : void 0,
|
|
179
|
+
onChange: t(f)
|
|
175
180
|
}, null, 8, ["current", "page-size", "total", "show-total", "onChange"])
|
|
176
181
|
]))
|
|
177
182
|
]),
|
|
@@ -186,5 +191,5 @@ const Q = { class: "pro-table" }, W = {
|
|
|
186
191
|
}
|
|
187
192
|
});
|
|
188
193
|
export {
|
|
189
|
-
|
|
194
|
+
me as default
|
|
190
195
|
};
|