element-plus-suite 0.0.5 → 0.0.7
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/README.md +86 -213
- package/dist/button-pro/index.d.ts +2 -0
- package/dist/button-pro/index.vue.d.ts +119 -0
- package/dist/button-pro/types.d.ts +28 -0
- package/dist/button-pro/utils.d.ts +6 -0
- package/dist/form-pro/index.vue.d.ts +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +594 -498
- package/package.json +1 -1
- package/dist/shared/utils.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,83 +1,178 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ElMention as
|
|
3
|
-
function
|
|
4
|
-
|
|
1
|
+
import { defineComponent as te, shallowRef as _, computed as g, h as b, mergeProps as ze, reactive as ee, watch as O, onBeforeUnmount as he, isVNode as Te, nextTick as Be, useSlots as Ie, onMounted as Le, withDirectives as De } from "vue";
|
|
2
|
+
import { buttonProps as Ue, ElButton as W, ElMention as We, ElTransfer as $e, ElTreeSelect as Ge, ElSwitch as Ne, ElSlider as Ke, ElRate as Qe, ElInputTag as Ye, ElCascader as He, ElAutocomplete as Je, ElTimeSelect as Xe, ElTimePicker as Ze, ElDatePicker as et, ElSelectV2 as tt, ElInputNumber as nt, ElInput as ne, ElUpload as lt, ElCheckbox as at, ElCheckboxGroup as rt, ElRadio as ot, ElRadioGroup as ut, ElOption as st, ElSelect as it, ElForm as ct, ElRow as dt, ElCol as ce, ElFormItem as X, ElTableColumn as de, ElTable as ft, vLoading as vt, ElPagination as gt } from "element-plus";
|
|
3
|
+
function fe(e) {
|
|
4
|
+
if (typeof e == "string")
|
|
5
|
+
return e.trim();
|
|
6
|
+
const { from: n, to: r, angle: o = 135 } = e;
|
|
7
|
+
return `linear-gradient(${o}deg, ${n}, ${r})`;
|
|
5
8
|
}
|
|
6
|
-
function
|
|
7
|
-
return (
|
|
9
|
+
function pt(e) {
|
|
10
|
+
return new Proxy({}, {
|
|
11
|
+
get(n, r) {
|
|
12
|
+
return e()?.[r];
|
|
13
|
+
},
|
|
14
|
+
has(n, r) {
|
|
15
|
+
const o = e();
|
|
16
|
+
return !!(o && r in o);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const bt = /* @__PURE__ */ te({
|
|
21
|
+
name: "ElButtonPro",
|
|
22
|
+
inheritAttrs: !1,
|
|
23
|
+
props: {
|
|
24
|
+
...Ue,
|
|
25
|
+
block: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: !1
|
|
28
|
+
},
|
|
29
|
+
iconPlacement: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "start"
|
|
32
|
+
},
|
|
33
|
+
gradient: {
|
|
34
|
+
type: [String, Object],
|
|
35
|
+
default: void 0
|
|
36
|
+
},
|
|
37
|
+
hoverGradient: {
|
|
38
|
+
type: [String, Object],
|
|
39
|
+
default: void 0
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
setup(e, {
|
|
43
|
+
attrs: n,
|
|
44
|
+
expose: r,
|
|
45
|
+
slots: o
|
|
46
|
+
}) {
|
|
47
|
+
const d = _(), c = _(!1), u = g(() => {
|
|
48
|
+
const {
|
|
49
|
+
onClick: k,
|
|
50
|
+
...S
|
|
51
|
+
} = n;
|
|
52
|
+
return S;
|
|
53
|
+
}), a = g(() => !e.plain && !e.dashed && !e.text && !e.link && e.type !== "text"), i = g(() => e.gradient && a.value ? fe(e.gradient) : ""), v = g(() => i.value && e.hoverGradient ? fe(e.hoverGradient) : ""), h = g(() => {
|
|
54
|
+
if (i.value)
|
|
55
|
+
return {
|
|
56
|
+
"--el-button-pro-gradient": i.value,
|
|
57
|
+
...v.value && {
|
|
58
|
+
"--el-button-pro-hover-gradient": v.value
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}), s = g(() => {
|
|
62
|
+
const {
|
|
63
|
+
block: k,
|
|
64
|
+
iconPlacement: S,
|
|
65
|
+
gradient: m,
|
|
66
|
+
hoverGradient: M,
|
|
67
|
+
...A
|
|
68
|
+
} = e;
|
|
69
|
+
return A;
|
|
70
|
+
});
|
|
71
|
+
async function w(k) {
|
|
72
|
+
const S = n.onClick;
|
|
73
|
+
if (typeof S != "function") return;
|
|
74
|
+
const m = S(k);
|
|
75
|
+
if (!(!m || typeof m.then != "function")) {
|
|
76
|
+
c.value = !0;
|
|
77
|
+
try {
|
|
78
|
+
await m;
|
|
79
|
+
} finally {
|
|
80
|
+
c.value = !1;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return r(pt(() => d.value)), () => b(W, ze(s.value, u.value, {
|
|
85
|
+
ref: d,
|
|
86
|
+
loading: e.loading || c.value,
|
|
87
|
+
class: ["el-button-pro", {
|
|
88
|
+
"is-block": e.block,
|
|
89
|
+
"is-gradient": !!i.value,
|
|
90
|
+
"has-icon-end": e.iconPlacement === "end",
|
|
91
|
+
"has-hover-gradient": !!v.value
|
|
92
|
+
}],
|
|
93
|
+
style: h.value,
|
|
94
|
+
onClick: w
|
|
95
|
+
}), o);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
function ht(e) {
|
|
99
|
+
return typeof e == "function" ? e() : e ?? [];
|
|
100
|
+
}
|
|
101
|
+
function Z(e, n) {
|
|
102
|
+
return (r, { slots: o = {} }) => {
|
|
8
103
|
const {
|
|
9
104
|
options: d,
|
|
10
|
-
props:
|
|
11
|
-
slots:
|
|
12
|
-
...
|
|
13
|
-
} =
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
105
|
+
props: c = {},
|
|
106
|
+
slots: u = {},
|
|
107
|
+
...a
|
|
108
|
+
} = r, i = c.label ?? "label", v = c.value ?? "value", h = c.disabled ?? "disabled";
|
|
109
|
+
return b(
|
|
110
|
+
e,
|
|
111
|
+
a,
|
|
17
112
|
{
|
|
18
113
|
// 保留 ElSelect / ElRadioGroup / ElCheckboxGroup 自身的具名插槽。
|
|
19
114
|
...o,
|
|
20
115
|
// 自动生成选项;显式传入 default 插槽时交由调用方接管。
|
|
21
|
-
default: o.default ?? (() =>
|
|
22
|
-
(
|
|
116
|
+
default: o.default ?? (() => ht(d).map(
|
|
117
|
+
(s) => b(
|
|
23
118
|
n,
|
|
24
119
|
{
|
|
25
|
-
label:
|
|
26
|
-
value:
|
|
27
|
-
disabled:
|
|
120
|
+
label: s[i],
|
|
121
|
+
value: s[v],
|
|
122
|
+
disabled: s[h]
|
|
28
123
|
},
|
|
29
|
-
typeof
|
|
124
|
+
typeof s.slots == "function" ? s.slots : u[s.slots]
|
|
30
125
|
)
|
|
31
126
|
))
|
|
32
127
|
}
|
|
33
128
|
);
|
|
34
129
|
};
|
|
35
130
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
131
|
+
function yt(e, { slots: n }) {
|
|
132
|
+
return b(ne, { ...e, type: "password" }, n);
|
|
38
133
|
}
|
|
39
|
-
function
|
|
40
|
-
const { modelValue:
|
|
41
|
-
return
|
|
42
|
-
|
|
134
|
+
function mt(e, { slots: n }) {
|
|
135
|
+
const { modelValue: r, "onUpdate:modelValue": o, ...d } = e;
|
|
136
|
+
return b(
|
|
137
|
+
lt,
|
|
43
138
|
{
|
|
44
139
|
...d,
|
|
45
|
-
fileList:
|
|
140
|
+
fileList: r,
|
|
46
141
|
"onUpdate:fileList": o
|
|
47
142
|
},
|
|
48
143
|
{
|
|
49
144
|
...n,
|
|
50
145
|
// ElUpload 不会自动生成触发按钮,未自定义内容时提供默认按钮。
|
|
51
|
-
default: n.default ?? (() =>
|
|
146
|
+
default: n.default ?? (() => b(W, { type: "primary", plain: !0 }, () => "选择文件"))
|
|
52
147
|
}
|
|
53
148
|
);
|
|
54
149
|
}
|
|
55
|
-
const
|
|
56
|
-
input:
|
|
57
|
-
password:
|
|
58
|
-
number:
|
|
59
|
-
select:
|
|
60
|
-
selectV2:
|
|
61
|
-
radio:
|
|
62
|
-
checkbox:
|
|
63
|
-
date:
|
|
64
|
-
time:
|
|
65
|
-
timeSelect:
|
|
66
|
-
autocomplete:
|
|
67
|
-
cascader:
|
|
68
|
-
inputTag:
|
|
69
|
-
rate:
|
|
70
|
-
slider:
|
|
71
|
-
switch:
|
|
72
|
-
tree:
|
|
73
|
-
transfer:
|
|
74
|
-
upload:
|
|
75
|
-
mention:
|
|
150
|
+
const Pt = {
|
|
151
|
+
input: ne,
|
|
152
|
+
password: yt,
|
|
153
|
+
number: nt,
|
|
154
|
+
select: Z(it, st),
|
|
155
|
+
selectV2: tt,
|
|
156
|
+
radio: Z(ut, ot),
|
|
157
|
+
checkbox: Z(rt, at),
|
|
158
|
+
date: et,
|
|
159
|
+
time: Ze,
|
|
160
|
+
timeSelect: Xe,
|
|
161
|
+
autocomplete: Je,
|
|
162
|
+
cascader: He,
|
|
163
|
+
inputTag: Ye,
|
|
164
|
+
rate: Qe,
|
|
165
|
+
slider: Ke,
|
|
166
|
+
switch: Ne,
|
|
167
|
+
tree: Ge,
|
|
168
|
+
transfer: $e,
|
|
169
|
+
upload: mt,
|
|
170
|
+
mention: We
|
|
76
171
|
};
|
|
77
|
-
function
|
|
78
|
-
return
|
|
172
|
+
function wt(e) {
|
|
173
|
+
return e.type && typeof e.type != "string" ? e.type : Pt[e.type || "input"] ?? ne;
|
|
79
174
|
}
|
|
80
|
-
const
|
|
175
|
+
const kt = [
|
|
81
176
|
"key",
|
|
82
177
|
"label",
|
|
83
178
|
"type",
|
|
@@ -93,55 +188,55 @@ const ht = [
|
|
|
93
188
|
"children",
|
|
94
189
|
"separator"
|
|
95
190
|
];
|
|
96
|
-
function
|
|
191
|
+
function St(e) {
|
|
97
192
|
["select", "selectV2", "cascader", "autocomplete", "tree"].includes(
|
|
98
|
-
|
|
193
|
+
e.type
|
|
99
194
|
);
|
|
100
|
-
const n = new Set(
|
|
195
|
+
const n = new Set(kt);
|
|
101
196
|
return {
|
|
102
197
|
clearable: !0,
|
|
103
198
|
...Object.fromEntries(
|
|
104
|
-
Object.entries(
|
|
199
|
+
Object.entries(e).filter(([o]) => !n.has(o))
|
|
105
200
|
),
|
|
106
|
-
...
|
|
201
|
+
...e.fieldProps ?? {}
|
|
107
202
|
};
|
|
108
203
|
}
|
|
109
|
-
function
|
|
110
|
-
return typeof
|
|
204
|
+
function $(e) {
|
|
205
|
+
return typeof e == "number" ? { span: e } : e ?? {};
|
|
111
206
|
}
|
|
112
|
-
function
|
|
207
|
+
function ve(e, n) {
|
|
113
208
|
return {
|
|
114
209
|
span: 24,
|
|
115
|
-
|
|
116
|
-
|
|
210
|
+
...$(n.col),
|
|
211
|
+
...$(e.col)
|
|
117
212
|
};
|
|
118
213
|
}
|
|
119
|
-
function I(
|
|
120
|
-
const n =
|
|
121
|
-
const o =
|
|
214
|
+
function I(e) {
|
|
215
|
+
const n = e.flatMap((r) => {
|
|
216
|
+
const o = r.key && !r.children?.length ? [[r.key, r.defaultValue]] : [], d = I(r.children ?? []);
|
|
122
217
|
return [...o, ...Object.entries(d)];
|
|
123
218
|
});
|
|
124
219
|
return Object.fromEntries(n);
|
|
125
220
|
}
|
|
126
|
-
function
|
|
127
|
-
return
|
|
221
|
+
function Ct(e) {
|
|
222
|
+
return e != null && typeof e == "object";
|
|
128
223
|
}
|
|
129
|
-
const
|
|
224
|
+
const ge = {
|
|
130
225
|
form: {
|
|
131
226
|
submitText: "提交"
|
|
132
227
|
},
|
|
133
228
|
search: {
|
|
134
229
|
submitText: "查询"
|
|
135
230
|
}
|
|
136
|
-
},
|
|
231
|
+
}, Et = {
|
|
137
232
|
submit: !0,
|
|
138
233
|
reset: !0,
|
|
139
234
|
cancel: !1
|
|
140
235
|
};
|
|
141
|
-
function
|
|
142
|
-
return Object.fromEntries(Object.entries(
|
|
236
|
+
function pe(e, n) {
|
|
237
|
+
return Object.fromEntries(Object.entries(e).filter(([r]) => !n.includes(r)));
|
|
143
238
|
}
|
|
144
|
-
const
|
|
239
|
+
const ye = /* @__PURE__ */ te({
|
|
145
240
|
name: "ElFormPro",
|
|
146
241
|
props: {
|
|
147
242
|
schema: {
|
|
@@ -168,47 +263,47 @@ const he = /* @__PURE__ */ ge({
|
|
|
168
263
|
}
|
|
169
264
|
},
|
|
170
265
|
emits: {
|
|
171
|
-
"update:modelValue": (
|
|
172
|
-
submit: (
|
|
173
|
-
reset: (
|
|
266
|
+
"update:modelValue": (e) => !0,
|
|
267
|
+
submit: (e) => !0,
|
|
268
|
+
reset: (e) => !0,
|
|
174
269
|
cancel: () => !0,
|
|
175
|
-
change: (
|
|
270
|
+
change: (e) => !0
|
|
176
271
|
},
|
|
177
|
-
setup(
|
|
272
|
+
setup(e, {
|
|
178
273
|
emit: n,
|
|
179
|
-
expose:
|
|
274
|
+
expose: r,
|
|
180
275
|
slots: o
|
|
181
276
|
}) {
|
|
182
|
-
const d =
|
|
183
|
-
...
|
|
277
|
+
const d = _(), c = _(typeof window > "u" ? 0 : window.innerWidth), u = _(e.collapsible && !(e.formConfig?.collapsed ?? !0)), a = ee({
|
|
278
|
+
...e.formConfig
|
|
184
279
|
});
|
|
185
|
-
O(() =>
|
|
186
|
-
Object.assign(
|
|
280
|
+
O(() => e.formConfig, (t) => {
|
|
281
|
+
Object.assign(a, t);
|
|
187
282
|
}, {
|
|
188
283
|
deep: !0
|
|
189
|
-
}), O(() =>
|
|
190
|
-
|
|
284
|
+
}), O(() => e.formConfig?.collapsed, (t) => {
|
|
285
|
+
e.collapsible && (u.value = !(t ?? !0));
|
|
191
286
|
});
|
|
192
|
-
const
|
|
193
|
-
get: () =>
|
|
194
|
-
set: (
|
|
195
|
-
if (
|
|
196
|
-
n("update:modelValue",
|
|
287
|
+
const i = ee(I(e.schema)), v = g(() => Ct(e.modelValue)), h = g({
|
|
288
|
+
get: () => v.value ? e.modelValue : i,
|
|
289
|
+
set: (t) => {
|
|
290
|
+
if (v.value) {
|
|
291
|
+
n("update:modelValue", t);
|
|
197
292
|
return;
|
|
198
293
|
}
|
|
199
|
-
for (const l of Object.keys(
|
|
200
|
-
Object.assign(
|
|
294
|
+
for (const l of Object.keys(i)) delete i[l];
|
|
295
|
+
Object.assign(i, t), n("update:modelValue", t);
|
|
201
296
|
}
|
|
202
297
|
});
|
|
203
|
-
O(() =>
|
|
204
|
-
if (!
|
|
205
|
-
for (const l of Object.keys(
|
|
206
|
-
Object.assign(
|
|
298
|
+
O(() => e.schema, (t) => {
|
|
299
|
+
if (!v.value) {
|
|
300
|
+
for (const l of Object.keys(i)) delete i[l];
|
|
301
|
+
Object.assign(i, I(t));
|
|
207
302
|
}
|
|
208
303
|
}, {
|
|
209
304
|
deep: !0
|
|
210
305
|
});
|
|
211
|
-
const
|
|
306
|
+
const s = g(() => e.schema.filter((t) => !t.hidden)), w = [{
|
|
212
307
|
key: "sm",
|
|
213
308
|
min: 768
|
|
214
309
|
}, {
|
|
@@ -220,67 +315,67 @@ const he = /* @__PURE__ */ ge({
|
|
|
220
315
|
}, {
|
|
221
316
|
key: "xl",
|
|
222
317
|
min: 1920
|
|
223
|
-
}],
|
|
224
|
-
let
|
|
225
|
-
if (l < 768) return
|
|
318
|
+
}], k = (t, l) => {
|
|
319
|
+
let p = t.base || t.xs || "top";
|
|
320
|
+
if (l < 768) return t.xs || p;
|
|
226
321
|
for (const y of w) {
|
|
227
322
|
if (l < y.min) break;
|
|
228
|
-
|
|
323
|
+
p = t[y.key] || p;
|
|
229
324
|
}
|
|
230
|
-
return
|
|
231
|
-
},
|
|
232
|
-
const
|
|
233
|
-
return typeof
|
|
325
|
+
return p;
|
|
326
|
+
}, S = g(() => {
|
|
327
|
+
const t = a.labelPosition;
|
|
328
|
+
return typeof t == "string" ? t : k(t || {
|
|
234
329
|
base: "top",
|
|
235
330
|
md: "right"
|
|
236
|
-
},
|
|
237
|
-
}),
|
|
238
|
-
let
|
|
331
|
+
}, c.value);
|
|
332
|
+
}), m = (t) => typeof t == "number" ? t : t?.span, M = (t, l) => {
|
|
333
|
+
let p = m(t.span) ?? 24;
|
|
239
334
|
for (const y of w) {
|
|
240
335
|
if (l < y.min) break;
|
|
241
|
-
const
|
|
242
|
-
|
|
336
|
+
const E = m(t[y.key]);
|
|
337
|
+
E !== void 0 && (p = E);
|
|
243
338
|
}
|
|
244
|
-
return Math.min(24,
|
|
245
|
-
},
|
|
246
|
-
const
|
|
247
|
-
return
|
|
248
|
-
}, L =
|
|
249
|
-
if (
|
|
250
|
-
return
|
|
251
|
-
const l =
|
|
339
|
+
return Math.min(24, p);
|
|
340
|
+
}, A = (t) => M(ve(t, a), c.value), z = (t, l) => {
|
|
341
|
+
const p = t % 24;
|
|
342
|
+
return p && 24 - p < l && (t += 24 - p), t + l;
|
|
343
|
+
}, L = g(() => !!o.buttons || a.buttons?.submit !== !1 || a.buttons?.reset !== !1 || a.buttons?.cancel !== void 0 && a.buttons.cancel !== !1), D = (t) => {
|
|
344
|
+
if (a.actionCol !== void 0)
|
|
345
|
+
return M($(a.actionCol), c.value);
|
|
346
|
+
const l = t ? 24 - t : 0;
|
|
252
347
|
return l >= 4 ? l : 24;
|
|
253
|
-
},
|
|
254
|
-
const l =
|
|
255
|
-
let
|
|
256
|
-
for (const
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
259
|
-
const V = L.value ? z(
|
|
348
|
+
}, G = (t) => {
|
|
349
|
+
const l = t * 24;
|
|
350
|
+
let p = 0, y = 0;
|
|
351
|
+
for (const E of s.value) {
|
|
352
|
+
const x = z(p, A(E));
|
|
353
|
+
if (x > l) break;
|
|
354
|
+
const V = L.value ? z(x, D(x)) : x;
|
|
260
355
|
if (y > 0 && V > l) break;
|
|
261
|
-
|
|
356
|
+
p = x, y += 1;
|
|
262
357
|
}
|
|
263
358
|
return Math.max(1, y);
|
|
264
|
-
},
|
|
265
|
-
let
|
|
266
|
-
for (const l of
|
|
267
|
-
|
|
268
|
-
return
|
|
269
|
-
}),
|
|
270
|
-
if (
|
|
359
|
+
}, R = g(() => !e.collapsible || !a.showCollapseButton ? s.value.length : a.collapseCount !== void 0 ? a.collapseCount : G(a.collapseRows ?? 1)), T = g(() => u.value ? s.value : s.value.slice(0, R.value)), j = g(() => {
|
|
360
|
+
let t = 0;
|
|
361
|
+
for (const l of T.value)
|
|
362
|
+
t = z(t, A(l));
|
|
363
|
+
return t % 24;
|
|
364
|
+
}), N = g(() => D(j.value)), K = g(() => j.value > 0 && j.value + N.value <= 24), f = g(() => S.value === "top" && K.value), P = g(() => {
|
|
365
|
+
if (a.actionCol !== void 0)
|
|
271
366
|
return {
|
|
272
367
|
span: 24,
|
|
273
|
-
|
|
368
|
+
...$(a.actionCol)
|
|
274
369
|
};
|
|
275
|
-
const
|
|
370
|
+
const t = j.value, l = t ? 24 - t : 0;
|
|
276
371
|
return {
|
|
277
372
|
span: l >= 4 ? l : 24
|
|
278
373
|
};
|
|
279
|
-
}),
|
|
280
|
-
const
|
|
374
|
+
}), C = g(() => {
|
|
375
|
+
const t = {
|
|
281
376
|
submit: {
|
|
282
377
|
type: "primary",
|
|
283
|
-
text:
|
|
378
|
+
text: e.searchMode ? ge.search.submitText : ge.form.submitText,
|
|
284
379
|
disabled: !1,
|
|
285
380
|
loading: !1
|
|
286
381
|
},
|
|
@@ -294,10 +389,10 @@ const he = /* @__PURE__ */ ge({
|
|
|
294
389
|
text: "取消",
|
|
295
390
|
disabled: !1
|
|
296
391
|
}
|
|
297
|
-
}, l = (
|
|
298
|
-
const y =
|
|
299
|
-
return y === !1 || y === void 0 && !
|
|
300
|
-
...
|
|
392
|
+
}, l = (p) => {
|
|
393
|
+
const y = a.buttons?.[p];
|
|
394
|
+
return y === !1 || y === void 0 && !Et[p] ? null : {
|
|
395
|
+
...t[p],
|
|
301
396
|
...y ?? {}
|
|
302
397
|
};
|
|
303
398
|
};
|
|
@@ -306,109 +401,109 @@ const he = /* @__PURE__ */ ge({
|
|
|
306
401
|
reset: l("reset"),
|
|
307
402
|
cancel: l("cancel")
|
|
308
403
|
};
|
|
309
|
-
}),
|
|
310
|
-
const
|
|
311
|
-
return
|
|
312
|
-
}),
|
|
313
|
-
const
|
|
404
|
+
}), q = g(() => Object.values(C.value).some(Boolean)), we = g(() => {
|
|
405
|
+
const t = a.buttonAlign ?? "right";
|
|
406
|
+
return t === "start" ? "is-start" : t === "center" ? "is-center" : "is-end";
|
|
407
|
+
}), ke = (t) => ve(t, a), Se = (t, l) => {
|
|
408
|
+
const p = {
|
|
314
409
|
...h.value,
|
|
315
|
-
[
|
|
410
|
+
[t]: l
|
|
316
411
|
};
|
|
317
|
-
h.value =
|
|
318
|
-
},
|
|
319
|
-
const l = [],
|
|
320
|
-
for (const
|
|
321
|
-
|
|
412
|
+
h.value = p, n("change", p);
|
|
413
|
+
}, Ce = (t) => Array.isArray(t) ? t : t ? [t] : [], Ee = (t) => {
|
|
414
|
+
const l = [], p = (y) => {
|
|
415
|
+
for (const E of y)
|
|
416
|
+
E.hidden || (E.children?.length ? p(E.children) : l.push(E));
|
|
322
417
|
};
|
|
323
|
-
return
|
|
324
|
-
},
|
|
325
|
-
...
|
|
418
|
+
return p(t.children ?? []), l;
|
|
419
|
+
}, _e = (t) => Ce(t).some((l) => l?.required), Oe = (t) => Ee(t).some((l) => _e(l.rules)), Q = (t, l) => t ? b(W, {
|
|
420
|
+
...pe(t, ["text"]),
|
|
326
421
|
onClick: l
|
|
327
|
-
}, () =>
|
|
328
|
-
const l = o[
|
|
422
|
+
}, () => t.text) : null, Y = (t) => {
|
|
423
|
+
const l = o[t.slot ?? t.key ?? ""];
|
|
329
424
|
if (l) return l({
|
|
330
|
-
item:
|
|
425
|
+
item: t,
|
|
331
426
|
model: h.value
|
|
332
427
|
});
|
|
333
|
-
const
|
|
334
|
-
if (
|
|
428
|
+
const p = wt(t);
|
|
429
|
+
if (Te(p)) return p;
|
|
335
430
|
const {
|
|
336
431
|
slots: y,
|
|
337
|
-
...
|
|
338
|
-
} =
|
|
339
|
-
const
|
|
340
|
-
return
|
|
432
|
+
...E
|
|
433
|
+
} = St(t), x = Object.fromEntries(Object.entries(y ?? {}).flatMap(([V, B]) => {
|
|
434
|
+
const F = typeof B == "function" ? B : o[String(B)];
|
|
435
|
+
return F ? [[V, (U = {}) => F({
|
|
341
436
|
...U,
|
|
342
|
-
item:
|
|
437
|
+
item: t,
|
|
343
438
|
model: h.value
|
|
344
439
|
})]] : [];
|
|
345
440
|
}));
|
|
346
|
-
return
|
|
347
|
-
...
|
|
348
|
-
modelValue:
|
|
441
|
+
return b(p, {
|
|
442
|
+
...E,
|
|
443
|
+
modelValue: t.key == null ? void 0 : h.value[t.key],
|
|
349
444
|
"onUpdate:modelValue": (V) => {
|
|
350
|
-
|
|
445
|
+
t.key != null && Se(t.key, V);
|
|
351
446
|
}
|
|
352
|
-
},
|
|
353
|
-
},
|
|
354
|
-
const l =
|
|
355
|
-
return
|
|
447
|
+
}, x);
|
|
448
|
+
}, le = (t) => typeof t.label == "function" ? t.label() : t.label, xe = (t) => {
|
|
449
|
+
const l = S.value;
|
|
450
|
+
return b("div", {
|
|
356
451
|
class: ["el-form-item", `el-form-item--label-${l}`, "el-form-pro__group", {
|
|
357
|
-
"is-required":
|
|
358
|
-
"is-no-asterisk":
|
|
359
|
-
"asterisk-right":
|
|
360
|
-
"asterisk-left":
|
|
452
|
+
"is-required": t.formItemProps?.required ?? Oe(t),
|
|
453
|
+
"is-no-asterisk": a.hideRequiredAsterisk,
|
|
454
|
+
"asterisk-right": a.requireAsteriskPosition === "right",
|
|
455
|
+
"asterisk-left": a.requireAsteriskPosition !== "right"
|
|
361
456
|
}],
|
|
362
|
-
style:
|
|
363
|
-
}, [
|
|
457
|
+
style: t.style
|
|
458
|
+
}, [t.label ? b("div", {
|
|
364
459
|
class: "el-form-item__label",
|
|
365
460
|
style: l === "top" ? void 0 : {
|
|
366
|
-
width:
|
|
461
|
+
width: t.labelWidth ?? a.labelWidth
|
|
367
462
|
}
|
|
368
|
-
}, [
|
|
463
|
+
}, [le(t)]) : null, b("div", {
|
|
369
464
|
class: "el-form-item__content"
|
|
370
|
-
}, [
|
|
371
|
-
},
|
|
372
|
-
...
|
|
373
|
-
prop:
|
|
374
|
-
rules:
|
|
375
|
-
labelWidth:
|
|
376
|
-
class: [
|
|
377
|
-
style:
|
|
465
|
+
}, [ae(t)])]);
|
|
466
|
+
}, Fe = (t) => t.children?.length ? ae(t) : b(X, {
|
|
467
|
+
...t.formItemProps ?? {},
|
|
468
|
+
prop: t.key,
|
|
469
|
+
rules: t.rules,
|
|
470
|
+
labelWidth: t.labelWidth ?? a.labelWidth,
|
|
471
|
+
class: [t.formItemProps?.class, "el-form-pro__child"],
|
|
472
|
+
style: t.style
|
|
378
473
|
}, {
|
|
379
|
-
default: () =>
|
|
380
|
-
}),
|
|
474
|
+
default: () => Y(t)
|
|
475
|
+
}), ae = (t) => t.children?.length ? b("div", {
|
|
381
476
|
class: "el-form-pro__children"
|
|
382
|
-
},
|
|
383
|
-
const y =
|
|
477
|
+
}, t.children.filter((l) => !l.hidden).flatMap((l, p) => {
|
|
478
|
+
const y = b("div", {
|
|
384
479
|
class: "el-form-pro__child-wrapper",
|
|
385
480
|
key: l.key
|
|
386
|
-
}, [
|
|
387
|
-
return
|
|
481
|
+
}, [Fe(l)]);
|
|
482
|
+
return p === 0 ? [y] : [b("span", {
|
|
388
483
|
class: "el-form-pro__separator"
|
|
389
|
-
},
|
|
390
|
-
})) :
|
|
391
|
-
|
|
484
|
+
}, t.separator ?? ""), y];
|
|
485
|
+
})) : Y(t), re = async () => {
|
|
486
|
+
e.collapsible && (u.value = !0), await Be(), d.value?.$el?.querySelector(".is-error")?.scrollIntoView({
|
|
392
487
|
behavior: "smooth",
|
|
393
488
|
block: "center"
|
|
394
489
|
});
|
|
395
|
-
},
|
|
490
|
+
}, oe = (...t) => d.value?.validate(...t), Me = (...t) => d.value?.validateField(...t), ue = async () => {
|
|
396
491
|
try {
|
|
397
|
-
await
|
|
492
|
+
await oe(), n("submit", h.value);
|
|
398
493
|
} catch {
|
|
399
494
|
re();
|
|
400
495
|
}
|
|
401
|
-
}, Re = (
|
|
402
|
-
const l = I(
|
|
403
|
-
for (const
|
|
404
|
-
const U = V ||
|
|
405
|
-
|
|
496
|
+
}, Re = (t) => {
|
|
497
|
+
const l = I(e.schema), p = t == null ? null : new Set(Array.isArray(t) ? t : [t]), y = {}, E = (x, V = !1, B = !1) => {
|
|
498
|
+
for (const F of x) {
|
|
499
|
+
const U = V || p === null || p.has(F.key);
|
|
500
|
+
F.children?.length ? E(F.children, U, !0) : B && U && F.key != null && (y[F.key] = l[F.key]);
|
|
406
501
|
}
|
|
407
502
|
};
|
|
408
|
-
return
|
|
409
|
-
}, se = (...
|
|
410
|
-
d.value?.resetFields(...
|
|
411
|
-
const l = Re(
|
|
503
|
+
return E(e.schema), y;
|
|
504
|
+
}, se = (...t) => {
|
|
505
|
+
d.value?.resetFields(...t);
|
|
506
|
+
const l = Re(t[0]);
|
|
412
507
|
return Object.keys(l).length && (h.value = {
|
|
413
508
|
...h.value,
|
|
414
509
|
...l
|
|
@@ -416,90 +511,90 @@ const he = /* @__PURE__ */ ge({
|
|
|
416
511
|
...h.value,
|
|
417
512
|
...l
|
|
418
513
|
};
|
|
419
|
-
},
|
|
420
|
-
const
|
|
421
|
-
n("reset",
|
|
422
|
-
},
|
|
423
|
-
Object.assign(
|
|
424
|
-
},
|
|
425
|
-
d.value?.$el, typeof window < "u" && (
|
|
426
|
-
},
|
|
427
|
-
O(() => d.value?.$el, (
|
|
428
|
-
|
|
514
|
+
}, je = () => {
|
|
515
|
+
const t = se();
|
|
516
|
+
n("reset", t);
|
|
517
|
+
}, qe = () => n("cancel"), Ve = (t) => {
|
|
518
|
+
Object.assign(a, t);
|
|
519
|
+
}, Ae = () => h.value, H = () => {
|
|
520
|
+
d.value?.$el, typeof window < "u" && (c.value = window.innerWidth);
|
|
521
|
+
}, J = typeof ResizeObserver > "u" ? null : new ResizeObserver(H);
|
|
522
|
+
O(() => d.value?.$el, (t) => {
|
|
523
|
+
J?.disconnect(), t && J?.observe(t), H();
|
|
429
524
|
}, {
|
|
430
525
|
flush: "post"
|
|
431
526
|
});
|
|
432
|
-
const
|
|
433
|
-
typeof window < "u" && (
|
|
527
|
+
const ie = () => {
|
|
528
|
+
typeof window < "u" && (c.value = window.innerWidth), H();
|
|
434
529
|
};
|
|
435
|
-
return typeof window < "u" && window.addEventListener("resize",
|
|
436
|
-
|
|
437
|
-
}),
|
|
438
|
-
validate: (...
|
|
439
|
-
validateField: (...
|
|
440
|
-
resetFields: (...
|
|
441
|
-
se(...
|
|
530
|
+
return typeof window < "u" && window.addEventListener("resize", ie), he(() => {
|
|
531
|
+
J?.disconnect(), typeof window < "u" && window.removeEventListener("resize", ie);
|
|
532
|
+
}), r({
|
|
533
|
+
validate: (...t) => oe(...t),
|
|
534
|
+
validateField: (...t) => Me(...t),
|
|
535
|
+
resetFields: (...t) => {
|
|
536
|
+
se(...t);
|
|
442
537
|
},
|
|
443
|
-
clearValidate: (...
|
|
444
|
-
d.value?.clearValidate(...
|
|
538
|
+
clearValidate: (...t) => {
|
|
539
|
+
d.value?.clearValidate(...t);
|
|
445
540
|
},
|
|
446
541
|
scrollToError: re,
|
|
447
|
-
setState:
|
|
448
|
-
getValues:
|
|
542
|
+
setState: Ve,
|
|
543
|
+
getValues: Ae
|
|
449
544
|
}), () => {
|
|
450
|
-
const
|
|
451
|
-
...
|
|
545
|
+
const t = {
|
|
546
|
+
...pe(a, ["buttonAlign", "buttons", "row", "col", "showCollapseButton", "collapseRows", "collapseCount", "collapsed", "actionCol"])
|
|
452
547
|
};
|
|
453
|
-
return
|
|
454
|
-
...
|
|
455
|
-
class: ["el-form-pro",
|
|
456
|
-
labelPosition:
|
|
548
|
+
return b(ct, {
|
|
549
|
+
...t,
|
|
550
|
+
class: ["el-form-pro", t.class].filter(Boolean),
|
|
551
|
+
labelPosition: S.value,
|
|
457
552
|
ref: d,
|
|
458
553
|
model: h.value,
|
|
459
554
|
onSubmit: (l) => {
|
|
460
|
-
l.preventDefault(),
|
|
555
|
+
l.preventDefault(), ue();
|
|
461
556
|
}
|
|
462
557
|
}, {
|
|
463
|
-
default: () => [
|
|
558
|
+
default: () => [b(dt, {
|
|
464
559
|
gutter: 18,
|
|
465
|
-
...
|
|
560
|
+
...a.row ?? {}
|
|
466
561
|
}, {
|
|
467
|
-
default: () => [...
|
|
468
|
-
...
|
|
562
|
+
default: () => [...T.value.map((l) => b(ce, {
|
|
563
|
+
...ke(l),
|
|
469
564
|
key: l.key ?? l.children?.[0]?.key
|
|
470
565
|
}, {
|
|
471
|
-
default: () => l.children?.length ?
|
|
566
|
+
default: () => l.children?.length ? xe(l) : b(X, {
|
|
472
567
|
...l.formItemProps ?? {},
|
|
473
568
|
label: typeof l.label == "function" ? void 0 : l.label,
|
|
474
|
-
labelWidth: l.labelWidth ??
|
|
569
|
+
labelWidth: l.labelWidth ?? a.labelWidth,
|
|
475
570
|
prop: l.key,
|
|
476
571
|
rules: l.rules,
|
|
477
572
|
class: l.formItemProps?.class,
|
|
478
573
|
style: l.style
|
|
479
574
|
}, {
|
|
480
575
|
...typeof l.label == "function" ? {
|
|
481
|
-
label: () =>
|
|
576
|
+
label: () => le(l)
|
|
482
577
|
} : {},
|
|
483
|
-
default: () =>
|
|
578
|
+
default: () => Y(l)
|
|
484
579
|
})
|
|
485
|
-
})),
|
|
486
|
-
default: () =>
|
|
487
|
-
...
|
|
488
|
-
label: () =>
|
|
580
|
+
})), q.value && s.value.length ? b(ce, P.value, {
|
|
581
|
+
default: () => b(X, null, {
|
|
582
|
+
...f.value ? {
|
|
583
|
+
label: () => b("label", {
|
|
489
584
|
class: "el-form-pro__actions-label"
|
|
490
585
|
})
|
|
491
586
|
} : {},
|
|
492
|
-
default: () =>
|
|
587
|
+
default: () => b("div", {
|
|
493
588
|
class: ["el-form-pro__actions", we.value]
|
|
494
|
-
}, [o.buttons ? o.buttons() : [
|
|
495
|
-
|
|
496
|
-
}),
|
|
589
|
+
}, [o.buttons ? o.buttons() : [Q(C.value.submit, () => {
|
|
590
|
+
ue();
|
|
591
|
+
}), Q(C.value.reset, je), Q(C.value.cancel, qe)], e.collapsible && a.showCollapseButton && s.value.length > R.value ? b(W, {
|
|
497
592
|
type: "primary",
|
|
498
593
|
link: !0,
|
|
499
594
|
onClick: () => {
|
|
500
|
-
|
|
595
|
+
u.value = !u.value;
|
|
501
596
|
}
|
|
502
|
-
}, () =>
|
|
597
|
+
}, () => u.value ? "收起" : "展开") : null])
|
|
503
598
|
})
|
|
504
599
|
}) : null]
|
|
505
600
|
})]
|
|
@@ -507,131 +602,131 @@ const he = /* @__PURE__ */ ge({
|
|
|
507
602
|
};
|
|
508
603
|
}
|
|
509
604
|
});
|
|
510
|
-
function
|
|
511
|
-
return
|
|
512
|
-
if (
|
|
605
|
+
function me(e, n) {
|
|
606
|
+
return e.flatMap((r) => {
|
|
607
|
+
if (r.visible === !1) return [];
|
|
513
608
|
const {
|
|
514
609
|
visible: o,
|
|
515
610
|
slot: d,
|
|
516
|
-
headerSlot:
|
|
517
|
-
render:
|
|
518
|
-
headerRender:
|
|
519
|
-
autoMerge:
|
|
520
|
-
children:
|
|
611
|
+
headerSlot: c,
|
|
612
|
+
render: u,
|
|
613
|
+
headerRender: a,
|
|
614
|
+
autoMerge: i,
|
|
615
|
+
children: v,
|
|
521
616
|
...h
|
|
522
|
-
} =
|
|
523
|
-
if (
|
|
524
|
-
row:
|
|
525
|
-
column:
|
|
526
|
-
$index:
|
|
527
|
-
})),
|
|
528
|
-
column:
|
|
529
|
-
$index:
|
|
530
|
-
store:
|
|
531
|
-
_self:
|
|
532
|
-
})),
|
|
533
|
-
const
|
|
534
|
-
default: () =>
|
|
617
|
+
} = r, s = { ...h }, w = {}, k = d ? n[d] : void 0, S = c ? n[c] : void 0;
|
|
618
|
+
if (k ? w.default = k : u && (w.default = (m) => u({
|
|
619
|
+
row: m.row,
|
|
620
|
+
column: m.column,
|
|
621
|
+
$index: m.$index
|
|
622
|
+
})), S ? w.header = S : a && (w.header = (m) => a({
|
|
623
|
+
column: m.column,
|
|
624
|
+
$index: m.$index,
|
|
625
|
+
store: m.store,
|
|
626
|
+
_self: m._self
|
|
627
|
+
})), v?.length) {
|
|
628
|
+
const m = {
|
|
629
|
+
default: () => me(v, n)
|
|
535
630
|
};
|
|
536
|
-
return w.header && (
|
|
631
|
+
return w.header && (m.header = w.header), [b(de, s, m)];
|
|
537
632
|
}
|
|
538
633
|
return [
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
634
|
+
b(
|
|
635
|
+
de,
|
|
636
|
+
s,
|
|
542
637
|
Object.keys(w).length ? w : void 0
|
|
543
638
|
)
|
|
544
639
|
];
|
|
545
640
|
});
|
|
546
641
|
}
|
|
547
|
-
function
|
|
548
|
-
return
|
|
642
|
+
function be(e) {
|
|
643
|
+
return e.prop ?? e.property;
|
|
549
644
|
}
|
|
550
|
-
function
|
|
551
|
-
if (
|
|
552
|
-
const
|
|
553
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
554
|
-
return
|
|
645
|
+
function _t(e, n) {
|
|
646
|
+
if (e === null || typeof e != "object") return;
|
|
647
|
+
const r = e;
|
|
648
|
+
if (Object.prototype.hasOwnProperty.call(r, n))
|
|
649
|
+
return r[n];
|
|
555
650
|
if (!n.includes(".")) return;
|
|
556
|
-
let o =
|
|
651
|
+
let o = r;
|
|
557
652
|
for (const d of n.split(".")) {
|
|
558
653
|
if (o === null || typeof o != "object") return;
|
|
559
654
|
o = o[d];
|
|
560
655
|
}
|
|
561
656
|
return o;
|
|
562
657
|
}
|
|
563
|
-
function
|
|
564
|
-
return
|
|
658
|
+
function Pe(e) {
|
|
659
|
+
return e.flatMap((n) => n.visible === !1 ? [] : n.children?.length ? Pe(n.children) : [n]);
|
|
565
660
|
}
|
|
566
|
-
function
|
|
567
|
-
const
|
|
568
|
-
for (const
|
|
569
|
-
const
|
|
570
|
-
|
|
661
|
+
function Ot(e, n = []) {
|
|
662
|
+
const r = Pe(e), o = /* @__PURE__ */ new Map();
|
|
663
|
+
for (const a of r) {
|
|
664
|
+
const i = be(a);
|
|
665
|
+
i && !o.has(i) && o.set(i, a);
|
|
571
666
|
}
|
|
572
|
-
const d = /* @__PURE__ */ new Set(),
|
|
573
|
-
!
|
|
574
|
-
key:
|
|
575
|
-
getValue: (
|
|
667
|
+
const d = /* @__PURE__ */ new Set(), c = [], u = (a) => {
|
|
668
|
+
!a || d.has(a) || !o.has(a) || (d.add(a), c.push({
|
|
669
|
+
key: a,
|
|
670
|
+
getValue: (i) => _t(i, a)
|
|
576
671
|
}));
|
|
577
672
|
};
|
|
578
|
-
return n.forEach(
|
|
579
|
-
|
|
580
|
-
}),
|
|
673
|
+
return n.forEach(u), r.forEach((a) => {
|
|
674
|
+
a.autoMerge && u(be(a));
|
|
675
|
+
}), c;
|
|
581
676
|
}
|
|
582
|
-
function
|
|
583
|
-
const
|
|
584
|
-
n.map((
|
|
677
|
+
function xt(e, n) {
|
|
678
|
+
const r = e.length, o = new Map(
|
|
679
|
+
n.map((u) => [u.key, Array.from({ length: r }, () => 1)])
|
|
585
680
|
);
|
|
586
|
-
if (!
|
|
587
|
-
const d =
|
|
588
|
-
for (let
|
|
589
|
-
let
|
|
590
|
-
for (let
|
|
591
|
-
const
|
|
592
|
-
if (!
|
|
593
|
-
const h = o.get(n[
|
|
594
|
-
h[
|
|
595
|
-
for (let
|
|
596
|
-
h[
|
|
597
|
-
|
|
681
|
+
if (!r || !n.length) return o;
|
|
682
|
+
const d = e.map((u) => n.map((a) => a.getValue(u))), c = n.map(() => 0);
|
|
683
|
+
for (let u = 1; u <= r; u += 1) {
|
|
684
|
+
let a = !0;
|
|
685
|
+
for (let i = 0; i < n.length; i += 1) {
|
|
686
|
+
const v = u < r && a && d[u][i] === d[u - 1][i];
|
|
687
|
+
if (!v) {
|
|
688
|
+
const h = o.get(n[i].key), s = c[i], w = u - s;
|
|
689
|
+
h[s] = w;
|
|
690
|
+
for (let k = s + 1; k < u; k += 1)
|
|
691
|
+
h[k] = 0;
|
|
692
|
+
c[i] = u;
|
|
598
693
|
}
|
|
599
|
-
|
|
694
|
+
a = v;
|
|
600
695
|
}
|
|
601
696
|
}
|
|
602
697
|
return o;
|
|
603
698
|
}
|
|
604
|
-
function
|
|
605
|
-
return
|
|
606
|
-
if (
|
|
607
|
-
const o =
|
|
699
|
+
function Ft(e, n = "children") {
|
|
700
|
+
return e.some((r) => {
|
|
701
|
+
if (r === null || typeof r != "object") return !1;
|
|
702
|
+
const o = r[n];
|
|
608
703
|
return Array.isArray(o) && o.length > 0;
|
|
609
704
|
});
|
|
610
705
|
}
|
|
611
|
-
function
|
|
612
|
-
const n =
|
|
613
|
-
() =>
|
|
614
|
-
),
|
|
615
|
-
if (!n.value.length ||
|
|
706
|
+
function Mt(e) {
|
|
707
|
+
const n = g(
|
|
708
|
+
() => Ot(e.columns(), e.mergeFields())
|
|
709
|
+
), r = g(() => n.value.length ? e.tableRef.value?.store?.states?.data?.value ?? e.data.value : e.data.value), o = g(() => {
|
|
710
|
+
if (!n.value.length || e.lazy())
|
|
616
711
|
return /* @__PURE__ */ new Map();
|
|
617
|
-
const
|
|
618
|
-
return
|
|
712
|
+
const c = e.treeProps()?.children ?? "children", u = r.value;
|
|
713
|
+
return Ft(u, c) ? /* @__PURE__ */ new Map() : xt(u, n.value);
|
|
619
714
|
});
|
|
620
715
|
return {
|
|
621
|
-
spanMethod:
|
|
622
|
-
const
|
|
623
|
-
return n.value.length ? (
|
|
624
|
-
const
|
|
625
|
-
if (
|
|
626
|
-
const
|
|
627
|
-
if (!(
|
|
628
|
-
return { rowspan:
|
|
629
|
-
} :
|
|
716
|
+
spanMethod: g(() => {
|
|
717
|
+
const c = e.userSpanMethod();
|
|
718
|
+
return n.value.length ? (u) => {
|
|
719
|
+
const a = c?.(u);
|
|
720
|
+
if (a !== void 0) return a;
|
|
721
|
+
const i = u.column.property, v = i ? o.value.get(i)?.[u.rowIndex] : void 0;
|
|
722
|
+
if (!(v === void 0 || v === 1))
|
|
723
|
+
return { rowspan: v, colspan: 1 };
|
|
724
|
+
} : c;
|
|
630
725
|
}),
|
|
631
726
|
spanMap: o
|
|
632
727
|
};
|
|
633
728
|
}
|
|
634
|
-
const
|
|
729
|
+
const Rt = {
|
|
635
730
|
page: 1,
|
|
636
731
|
pageSize: 20,
|
|
637
732
|
pageSizes: [10, 20, 50, 100],
|
|
@@ -639,77 +734,77 @@ const Ot = {
|
|
|
639
734
|
layout: "total, sizes, prev, pager, next, jumper",
|
|
640
735
|
background: !0
|
|
641
736
|
};
|
|
642
|
-
function
|
|
643
|
-
return
|
|
644
|
-
...
|
|
645
|
-
...
|
|
737
|
+
function jt(e) {
|
|
738
|
+
return e === !1 ? null : {
|
|
739
|
+
...Rt,
|
|
740
|
+
...e === !0 ? {} : e ?? {}
|
|
646
741
|
};
|
|
647
742
|
}
|
|
648
|
-
function
|
|
649
|
-
const n =
|
|
743
|
+
function qt(e) {
|
|
744
|
+
const n = g(() => jt(e())), r = _(n.value?.page ?? 1), o = _(n.value?.pageSize ?? 20);
|
|
650
745
|
O(
|
|
651
746
|
() => n.value?.page,
|
|
652
|
-
(
|
|
653
|
-
|
|
747
|
+
(a) => {
|
|
748
|
+
a !== void 0 && (r.value = a);
|
|
654
749
|
}
|
|
655
750
|
), O(
|
|
656
751
|
() => n.value?.pageSize,
|
|
657
|
-
(
|
|
658
|
-
|
|
752
|
+
(a) => {
|
|
753
|
+
a !== void 0 && (o.value = a);
|
|
659
754
|
}
|
|
660
755
|
);
|
|
661
|
-
const d =
|
|
662
|
-
() => n.value ?
|
|
663
|
-
),
|
|
756
|
+
const d = g(
|
|
757
|
+
() => n.value ? r.value : null
|
|
758
|
+
), c = g(
|
|
664
759
|
() => n.value ? o.value : null
|
|
665
760
|
);
|
|
666
|
-
function
|
|
667
|
-
o.value =
|
|
761
|
+
function u(a) {
|
|
762
|
+
o.value = a, r.value = 1;
|
|
668
763
|
}
|
|
669
764
|
return {
|
|
670
765
|
// 模板直接依赖这个布尔值,避免访问可能为 null 的配置。
|
|
671
|
-
enabled:
|
|
766
|
+
enabled: g(() => n.value != null),
|
|
672
767
|
config: n,
|
|
673
|
-
currentPage:
|
|
768
|
+
currentPage: r,
|
|
674
769
|
pageSize: o,
|
|
675
770
|
requestPage: d,
|
|
676
|
-
requestPageSize:
|
|
677
|
-
setPageSize:
|
|
771
|
+
requestPageSize: c,
|
|
772
|
+
setPageSize: u
|
|
678
773
|
};
|
|
679
774
|
}
|
|
680
|
-
function
|
|
681
|
-
const n =
|
|
682
|
-
let
|
|
775
|
+
function Vt(e) {
|
|
776
|
+
const n = _(!1);
|
|
777
|
+
let r = null, o = 0;
|
|
683
778
|
async function d() {
|
|
684
|
-
const
|
|
685
|
-
if (!
|
|
686
|
-
|
|
687
|
-
const
|
|
779
|
+
const u = e.request();
|
|
780
|
+
if (!u) return;
|
|
781
|
+
r?.abort(), r = new AbortController();
|
|
782
|
+
const a = ++o, i = r;
|
|
688
783
|
n.value = !0;
|
|
689
784
|
try {
|
|
690
|
-
const
|
|
691
|
-
page:
|
|
692
|
-
pageSize:
|
|
693
|
-
query:
|
|
694
|
-
signal:
|
|
785
|
+
const v = await u({
|
|
786
|
+
page: e.page(),
|
|
787
|
+
pageSize: e.pageSize(),
|
|
788
|
+
query: e.query(),
|
|
789
|
+
signal: i.signal
|
|
695
790
|
});
|
|
696
|
-
if (
|
|
791
|
+
if (i.signal.aborted || a !== o)
|
|
697
792
|
return;
|
|
698
|
-
|
|
699
|
-
} catch (
|
|
700
|
-
if (
|
|
793
|
+
e.onData?.(v), e.onLoaded?.(v);
|
|
794
|
+
} catch (v) {
|
|
795
|
+
if (i.signal.aborted || a !== o)
|
|
701
796
|
return;
|
|
702
|
-
|
|
797
|
+
e.onError?.(v);
|
|
703
798
|
} finally {
|
|
704
|
-
|
|
799
|
+
a === o && (n.value = !1);
|
|
705
800
|
}
|
|
706
801
|
}
|
|
707
|
-
function
|
|
708
|
-
|
|
802
|
+
function c() {
|
|
803
|
+
r?.abort(), o += 1, n.value = !1;
|
|
709
804
|
}
|
|
710
|
-
return
|
|
805
|
+
return he(c), { loading: n, load: d, cancel: c };
|
|
711
806
|
}
|
|
712
|
-
const
|
|
807
|
+
const At = /* @__PURE__ */ te({
|
|
713
808
|
name: "ElTablePro",
|
|
714
809
|
inheritAttrs: !1,
|
|
715
810
|
props: {
|
|
@@ -747,187 +842,188 @@ const Rt = /* @__PURE__ */ ge({
|
|
|
747
842
|
}
|
|
748
843
|
},
|
|
749
844
|
emits: {
|
|
750
|
-
loaded: (
|
|
751
|
-
error: (
|
|
845
|
+
loaded: (e) => !0,
|
|
846
|
+
error: (e) => !0
|
|
752
847
|
},
|
|
753
|
-
setup(
|
|
848
|
+
setup(e, {
|
|
754
849
|
attrs: n,
|
|
755
|
-
emit:
|
|
850
|
+
emit: r,
|
|
756
851
|
expose: o
|
|
757
852
|
}) {
|
|
758
|
-
const d =
|
|
759
|
-
...I(
|
|
760
|
-
...
|
|
761
|
-
...
|
|
762
|
-
})),
|
|
763
|
-
...
|
|
764
|
-
}), h =
|
|
765
|
-
...
|
|
766
|
-
...
|
|
853
|
+
const d = Ie(), c = _(null), u = _([]), a = _(0), i = g(() => ({
|
|
854
|
+
...I(e.filter?.schema ?? []),
|
|
855
|
+
...e.filter?.defaultValue ?? {},
|
|
856
|
+
...e.filter?.model ?? {}
|
|
857
|
+
})), v = ee({
|
|
858
|
+
...i.value
|
|
859
|
+
}), h = _({
|
|
860
|
+
...i.value,
|
|
861
|
+
...e.query ?? {}
|
|
767
862
|
});
|
|
768
|
-
O(() =>
|
|
863
|
+
O(() => e.query, (f) => {
|
|
769
864
|
h.value = {
|
|
770
|
-
...
|
|
771
|
-
...
|
|
772
|
-
},
|
|
865
|
+
...i.value,
|
|
866
|
+
...f ?? {}
|
|
867
|
+
}, e.request && M();
|
|
773
868
|
}, {
|
|
774
869
|
deep: !0
|
|
775
|
-
}), O(() =>
|
|
776
|
-
for (const
|
|
777
|
-
Object.assign(
|
|
870
|
+
}), O(() => e.filter?.model, (f) => {
|
|
871
|
+
for (const P of Object.keys(v)) delete v[P];
|
|
872
|
+
Object.assign(v, i.value, f ?? {});
|
|
778
873
|
}, {
|
|
779
874
|
deep: !0
|
|
780
875
|
});
|
|
781
|
-
const
|
|
876
|
+
const s = qt(() => e.pagination);
|
|
782
877
|
let w = !1;
|
|
783
|
-
function
|
|
784
|
-
|
|
878
|
+
function k(f) {
|
|
879
|
+
f !== s.currentPage.value && (s.enabled.value && (w = !0), s.currentPage.value = f);
|
|
785
880
|
}
|
|
786
|
-
const
|
|
787
|
-
const
|
|
788
|
-
return typeof
|
|
881
|
+
const S = g(() => {
|
|
882
|
+
const f = e.rowKey;
|
|
883
|
+
return typeof f == "function" ? (P) => String(f(P)) : f;
|
|
789
884
|
}), {
|
|
790
|
-
loading:
|
|
791
|
-
load:
|
|
792
|
-
cancel:
|
|
793
|
-
} =
|
|
794
|
-
request: () =>
|
|
795
|
-
page: () =>
|
|
796
|
-
pageSize: () =>
|
|
885
|
+
loading: m,
|
|
886
|
+
load: M,
|
|
887
|
+
cancel: A
|
|
888
|
+
} = Vt({
|
|
889
|
+
request: () => e.request,
|
|
890
|
+
page: () => s.requestPage.value,
|
|
891
|
+
pageSize: () => s.requestPageSize.value,
|
|
797
892
|
query: () => h.value,
|
|
798
|
-
onData: (
|
|
799
|
-
|
|
893
|
+
onData: (f) => {
|
|
894
|
+
u.value = f.data, a.value = f.total;
|
|
800
895
|
},
|
|
801
|
-
onLoaded: (
|
|
802
|
-
onError: (
|
|
803
|
-
}), z =
|
|
804
|
-
if (
|
|
805
|
-
if (!
|
|
806
|
-
if (!
|
|
807
|
-
const
|
|
808
|
-
return
|
|
809
|
-
}), D =
|
|
810
|
-
spanMethod:
|
|
811
|
-
} =
|
|
812
|
-
tableRef:
|
|
813
|
-
columns: () =>
|
|
896
|
+
onLoaded: (f) => r("loaded", f),
|
|
897
|
+
onError: (f) => r("error", f)
|
|
898
|
+
}), z = g(() => m.value), L = g(() => {
|
|
899
|
+
if (e.request) return u.value;
|
|
900
|
+
if (!e.data) return [];
|
|
901
|
+
if (!s.config.value) return e.data;
|
|
902
|
+
const f = (s.currentPage.value - 1) * s.pageSize.value;
|
|
903
|
+
return e.data.slice(f, f + s.pageSize.value);
|
|
904
|
+
}), D = g(() => e.request ? a.value : e.data?.length ?? 0), {
|
|
905
|
+
spanMethod: G
|
|
906
|
+
} = Mt({
|
|
907
|
+
tableRef: c,
|
|
908
|
+
columns: () => e.columns,
|
|
814
909
|
data: L,
|
|
815
|
-
mergeFields: () =>
|
|
910
|
+
mergeFields: () => e.mergeFields,
|
|
816
911
|
userSpanMethod: () => n.spanMethod,
|
|
817
912
|
treeProps: () => n.treeProps,
|
|
818
913
|
lazy: () => !!n.lazy
|
|
819
914
|
});
|
|
820
|
-
async function
|
|
821
|
-
|
|
915
|
+
async function R(f) {
|
|
916
|
+
f?.page !== void 0 && k(f.page), await M();
|
|
822
917
|
}
|
|
823
|
-
async function
|
|
918
|
+
async function T() {
|
|
824
919
|
h.value = {
|
|
825
|
-
...
|
|
826
|
-
},
|
|
920
|
+
...v
|
|
921
|
+
}, k(1), await M();
|
|
827
922
|
}
|
|
828
923
|
async function j() {
|
|
829
|
-
const
|
|
830
|
-
...
|
|
924
|
+
const f = {
|
|
925
|
+
...i.value
|
|
831
926
|
};
|
|
832
|
-
for (const
|
|
833
|
-
delete
|
|
834
|
-
Object.assign(
|
|
835
|
-
...
|
|
836
|
-
},
|
|
927
|
+
for (const P of Object.keys(v))
|
|
928
|
+
delete v[P];
|
|
929
|
+
Object.assign(v, f), h.value = {
|
|
930
|
+
...f
|
|
931
|
+
}, k(1), await M();
|
|
837
932
|
}
|
|
838
|
-
O(() =>
|
|
839
|
-
|
|
840
|
-
}), O(() => [
|
|
933
|
+
O(() => e.request, (f) => {
|
|
934
|
+
u.value = [], a.value = 0, f ? R() : A();
|
|
935
|
+
}), O(() => [s.requestPage.value, s.requestPageSize.value], () => {
|
|
841
936
|
if (w) {
|
|
842
937
|
w = !1;
|
|
843
938
|
return;
|
|
844
939
|
}
|
|
845
|
-
|
|
940
|
+
e.request && R();
|
|
846
941
|
});
|
|
847
|
-
const
|
|
848
|
-
get(
|
|
849
|
-
if (
|
|
850
|
-
if (
|
|
851
|
-
if (
|
|
852
|
-
const
|
|
853
|
-
if (!
|
|
854
|
-
const
|
|
855
|
-
return typeof
|
|
942
|
+
const N = new Proxy({}, {
|
|
943
|
+
get(f, P) {
|
|
944
|
+
if (P === "reload") return R;
|
|
945
|
+
if (P === "search") return T;
|
|
946
|
+
if (P === "resetFilter") return j;
|
|
947
|
+
const C = c.value;
|
|
948
|
+
if (!C) return;
|
|
949
|
+
const q = C[P];
|
|
950
|
+
return typeof q == "function" ? q.bind(C) : q;
|
|
856
951
|
},
|
|
857
|
-
has(
|
|
858
|
-
return
|
|
952
|
+
has(f, P) {
|
|
953
|
+
return P === "reload" || P === "search" || P === "resetFilter" ? !0 : c.value != null && P in c.value;
|
|
859
954
|
}
|
|
860
955
|
});
|
|
861
|
-
o(
|
|
862
|
-
|
|
956
|
+
o(N), Le(() => {
|
|
957
|
+
e.request && R();
|
|
863
958
|
});
|
|
864
|
-
const
|
|
959
|
+
const K = () => Object.fromEntries(Object.entries(d).filter(([f]) => f.startsWith("filter-")).map(([f, P]) => [f.slice(7), P]));
|
|
865
960
|
return () => {
|
|
866
|
-
const
|
|
867
|
-
schema:
|
|
868
|
-
modelValue:
|
|
961
|
+
const f = e.filter ? b(ye, {
|
|
962
|
+
schema: e.filter.schema,
|
|
963
|
+
modelValue: v,
|
|
869
964
|
collapsible: !0,
|
|
870
965
|
searchMode: !0,
|
|
871
966
|
formConfig: {
|
|
872
967
|
// 筛选表单开启折叠按钮时,默认按一行折叠。
|
|
873
|
-
...
|
|
968
|
+
...e.filter.formConfig?.showCollapseButton ? {
|
|
874
969
|
collapseRows: 1
|
|
875
970
|
} : {},
|
|
876
|
-
...
|
|
971
|
+
...e.filter.formConfig ?? {}
|
|
877
972
|
},
|
|
878
|
-
"onUpdate:modelValue": (
|
|
879
|
-
for (const
|
|
880
|
-
Object.assign(
|
|
973
|
+
"onUpdate:modelValue": (C) => {
|
|
974
|
+
for (const q of Object.keys(v)) delete v[q];
|
|
975
|
+
Object.assign(v, C);
|
|
881
976
|
},
|
|
882
977
|
onSubmit: () => {
|
|
883
|
-
|
|
978
|
+
T();
|
|
884
979
|
},
|
|
885
980
|
onReset: () => {
|
|
886
981
|
j();
|
|
887
982
|
}
|
|
888
|
-
},
|
|
983
|
+
}, K()) : null, P = b(ft, {
|
|
889
984
|
...n,
|
|
890
|
-
ref:
|
|
985
|
+
ref: c,
|
|
891
986
|
data: L.value,
|
|
892
|
-
rowKey:
|
|
893
|
-
spanMethod:
|
|
987
|
+
rowKey: S.value,
|
|
988
|
+
spanMethod: G.value
|
|
894
989
|
}, {
|
|
895
|
-
default: () =>
|
|
990
|
+
default: () => me(e.columns, d),
|
|
896
991
|
empty: d.empty,
|
|
897
992
|
append: d.append
|
|
898
993
|
});
|
|
899
|
-
return
|
|
994
|
+
return b("div", {
|
|
900
995
|
class: "el-table-pro"
|
|
901
|
-
}, [
|
|
902
|
-
currentPage:
|
|
903
|
-
pageSize:
|
|
996
|
+
}, [f, De(P, [[vt, z.value]]), s.enabled.value ? b(gt, {
|
|
997
|
+
currentPage: s.currentPage.value,
|
|
998
|
+
pageSize: s.pageSize.value,
|
|
904
999
|
total: D.value,
|
|
905
|
-
pageSizes: [...
|
|
906
|
-
pagerCount:
|
|
907
|
-
layout:
|
|
908
|
-
background:
|
|
909
|
-
"onUpdate:currentPage": (
|
|
910
|
-
|
|
1000
|
+
pageSizes: [...s.config.value?.pageSizes ?? []],
|
|
1001
|
+
pagerCount: s.config.value?.pagerCount,
|
|
1002
|
+
layout: s.config.value?.layout,
|
|
1003
|
+
background: s.config.value?.background,
|
|
1004
|
+
"onUpdate:currentPage": (C) => {
|
|
1005
|
+
s.currentPage.value = C;
|
|
911
1006
|
},
|
|
912
|
-
"onUpdate:pageSize": (
|
|
913
|
-
|
|
1007
|
+
"onUpdate:pageSize": (C) => {
|
|
1008
|
+
s.setPageSize(C);
|
|
914
1009
|
}
|
|
915
1010
|
}) : null]);
|
|
916
1011
|
};
|
|
917
1012
|
}
|
|
918
|
-
}),
|
|
919
|
-
function
|
|
920
|
-
|
|
921
|
-
const
|
|
922
|
-
|
|
1013
|
+
}), zt = [bt, ye, At];
|
|
1014
|
+
function Tt(e) {
|
|
1015
|
+
zt.forEach((n) => {
|
|
1016
|
+
const r = n.name;
|
|
1017
|
+
r && e.component(r, n);
|
|
923
1018
|
});
|
|
924
1019
|
}
|
|
925
|
-
const
|
|
1020
|
+
const Dt = { install: Tt };
|
|
926
1021
|
export {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1022
|
+
bt as ElButtonPro,
|
|
1023
|
+
ye as ElFormPro,
|
|
1024
|
+
At as ElTablePro,
|
|
1025
|
+
Rt as TABLE_PRO_DEFAULT_PAGINATION,
|
|
1026
|
+
Dt as default,
|
|
1027
|
+
Tt as install,
|
|
1028
|
+
jt as normalizePagination
|
|
933
1029
|
};
|