zxt-table 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zxt-table.css +1 -1
- package/dist/zxt-table.es.js +577 -596
- package/dist/zxt-table.umd.js +1 -1
- package/package.json +1 -1
package/dist/zxt-table.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createElementBlock as
|
|
2
|
-
import { ElPagination as
|
|
3
|
-
const
|
|
1
|
+
import { createElementBlock as g, openBlock as s, normalizeClass as ie, renderSlot as Z, defineComponent as y, createVNode as D, ref as k, watch as K, resolveComponent as z, createBlock as $, h as G, inject as Te, computed as C, mergeProps as M, withCtx as b, Fragment as B, renderList as R, createSlots as ne, resolveDynamicComponent as ye, createTextVNode as j, toDisplayString as Q, provide as He, onMounted as Oe, resolveDirective as Ze, normalizeStyle as je, withDirectives as Ie, createCommentVNode as X, createElementVNode as w, reactive as Ee, toHandlers as Ne, useAttrs as Ue, useSlots as qe, normalizeProps as Re, guardReactiveProps as Ae } from "vue";
|
|
2
|
+
import { ElPagination as We, ElLink as Ge, ElCheckbox as Je, ElSelect as Ke, ElOption as Qe, ElInput as Xe, ElTableColumn as Ye, ElTable as et } from "element-plus";
|
|
3
|
+
const q = (e, t) => {
|
|
4
4
|
const a = e.__vccOpts || e;
|
|
5
|
-
for (const [
|
|
6
|
-
a[
|
|
5
|
+
for (const [l, u] of t)
|
|
6
|
+
a[l] = u;
|
|
7
7
|
return a;
|
|
8
|
-
},
|
|
8
|
+
}, tt = {
|
|
9
9
|
name: "MyButton",
|
|
10
10
|
props: {
|
|
11
11
|
type: {
|
|
@@ -21,26 +21,26 @@ const U = (e, t) => {
|
|
|
21
21
|
emits: ["click"],
|
|
22
22
|
setup(e, { emit: t }) {
|
|
23
23
|
return {
|
|
24
|
-
handleClick: (
|
|
25
|
-
t("click",
|
|
24
|
+
handleClick: (l) => {
|
|
25
|
+
t("click", l);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
},
|
|
30
|
-
function
|
|
31
|
-
return s(),
|
|
32
|
-
class:
|
|
29
|
+
}, at = ["disabled"];
|
|
30
|
+
function nt(e, t, a, l, u, c) {
|
|
31
|
+
return s(), g("button", {
|
|
32
|
+
class: ie(["my-button", [`my-button--${a.type}`, { "is-disabled": a.disabled }]]),
|
|
33
33
|
disabled: a.disabled,
|
|
34
|
-
onClick: t[0] || (t[0] = (...
|
|
34
|
+
onClick: t[0] || (t[0] = (...r) => l.handleClick && l.handleClick(...r))
|
|
35
35
|
}, [
|
|
36
|
-
|
|
37
|
-
], 10,
|
|
36
|
+
Z(e.$slots, "default", {}, void 0, !0)
|
|
37
|
+
], 10, at);
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
e.component(
|
|
39
|
+
const ee = /* @__PURE__ */ q(tt, [["render", nt], ["__scopeId", "data-v-4480e77d"]]);
|
|
40
|
+
ee.install = function(e) {
|
|
41
|
+
e.component(ee.name, ee);
|
|
42
42
|
};
|
|
43
|
-
const
|
|
43
|
+
const te = /* @__PURE__ */ y({
|
|
44
44
|
name: "JsxButton",
|
|
45
45
|
props: {
|
|
46
46
|
type: {
|
|
@@ -58,24 +58,24 @@ const ne = /* @__PURE__ */ b({
|
|
|
58
58
|
emit: t,
|
|
59
59
|
slots: a
|
|
60
60
|
}) {
|
|
61
|
-
const
|
|
62
|
-
e.disabled || t("click",
|
|
61
|
+
const l = (u) => {
|
|
62
|
+
e.disabled || t("click", u);
|
|
63
63
|
};
|
|
64
|
-
return () =>
|
|
64
|
+
return () => D("button", {
|
|
65
65
|
class: ["jsx-button", `jsx-button--${e.type}`, {
|
|
66
66
|
"is-disabled": e.disabled
|
|
67
67
|
}],
|
|
68
68
|
disabled: e.disabled,
|
|
69
|
-
onClick:
|
|
69
|
+
onClick: l
|
|
70
70
|
}, [a.default?.()]);
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
|
|
74
|
-
e.component(
|
|
73
|
+
te.install = function(e) {
|
|
74
|
+
e.component(te.name, te);
|
|
75
75
|
};
|
|
76
|
-
const
|
|
76
|
+
const ot = y({
|
|
77
77
|
name: "ZxtPagination",
|
|
78
|
-
components: { ElPagination:
|
|
78
|
+
components: { ElPagination: We },
|
|
79
79
|
props: {
|
|
80
80
|
// 当前页码
|
|
81
81
|
modelValue: { type: Number, default: 1 },
|
|
@@ -93,32 +93,32 @@ const ct = b({
|
|
|
93
93
|
},
|
|
94
94
|
emits: ["update:modelValue", "update:pageSize", "page-change", "size-change"],
|
|
95
95
|
setup(e, { emit: t }) {
|
|
96
|
-
const a = k(e.modelValue),
|
|
97
|
-
return
|
|
96
|
+
const a = k(e.modelValue), l = k(e.pageSize);
|
|
97
|
+
return K(
|
|
98
98
|
() => e.modelValue,
|
|
99
|
-
(
|
|
100
|
-
a.value =
|
|
99
|
+
(r) => {
|
|
100
|
+
a.value = r;
|
|
101
101
|
}
|
|
102
|
-
),
|
|
102
|
+
), K(
|
|
103
103
|
() => e.pageSize,
|
|
104
|
-
(
|
|
105
|
-
|
|
104
|
+
(r) => {
|
|
105
|
+
l.value = r;
|
|
106
106
|
}
|
|
107
107
|
), {
|
|
108
108
|
currentPage: a,
|
|
109
|
-
pageSize:
|
|
110
|
-
handleSizeChange: (
|
|
111
|
-
|
|
109
|
+
pageSize: l,
|
|
110
|
+
handleSizeChange: (r) => {
|
|
111
|
+
l.value = r, a.value = 1, t("update:pageSize", r), t("size-change", { page: a.value, size: r });
|
|
112
112
|
},
|
|
113
|
-
handleCurrentChange: (
|
|
114
|
-
a.value =
|
|
113
|
+
handleCurrentChange: (r) => {
|
|
114
|
+
a.value = r, t("update:modelValue", r), t("page-change", { page: r, size: l.value });
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
|
-
function
|
|
120
|
-
const
|
|
121
|
-
return s(), $(
|
|
119
|
+
function rt(e, t, a, l, u, c) {
|
|
120
|
+
const r = z("el-pagination");
|
|
121
|
+
return s(), $(r, {
|
|
122
122
|
"current-page": e.currentPage,
|
|
123
123
|
"onUpdate:currentPage": t[0] || (t[0] = (p) => e.currentPage = p),
|
|
124
124
|
"page-size": e.pageSize,
|
|
@@ -131,55 +131,55 @@ function pt(e, t, a, r, i, c) {
|
|
|
131
131
|
onCurrentChange: e.handleCurrentChange
|
|
132
132
|
}, null, 8, ["current-page", "page-size", "page-sizes", "total", "layout", "onSizeChange", "onCurrentChange"]);
|
|
133
133
|
}
|
|
134
|
-
const
|
|
134
|
+
const J = /* @__PURE__ */ q(ot, [["render", rt], ["__scopeId", "data-v-497aa44d"]]), ae = {
|
|
135
135
|
default: ({ cellValue: e }) => e ?? "",
|
|
136
|
-
input: ({ cellValue: e, row: t, column: a, updateRow:
|
|
136
|
+
input: ({ cellValue: e, row: t, column: a, updateRow: l }) => G(Xe, {
|
|
137
137
|
modelValue: e,
|
|
138
138
|
size: "small",
|
|
139
|
-
onInput: (
|
|
139
|
+
onInput: (u) => l({ ...t, [a.property]: u })
|
|
140
140
|
}),
|
|
141
|
-
select: ({ cellValue: e, row: t, column: a, updateRow:
|
|
142
|
-
|
|
141
|
+
select: ({ cellValue: e, row: t, column: a, updateRow: l, options: u = [] }) => G(
|
|
142
|
+
Ke,
|
|
143
143
|
{
|
|
144
144
|
modelValue: e,
|
|
145
145
|
size: "small",
|
|
146
|
-
onChange: (c) =>
|
|
146
|
+
onChange: (c) => l({ ...t, [a.property]: c })
|
|
147
147
|
},
|
|
148
|
-
() =>
|
|
149
|
-
(c) =>
|
|
148
|
+
() => u.map(
|
|
149
|
+
(c) => G(Qe, { label: c.label, value: c.value, key: c.value })
|
|
150
150
|
)
|
|
151
151
|
),
|
|
152
|
-
checkbox: ({ cellValue: e, row: t, column: a, updateRow:
|
|
152
|
+
checkbox: ({ cellValue: e, row: t, column: a, updateRow: l }) => G(Je, {
|
|
153
153
|
modelValue: !!e,
|
|
154
|
-
onChange: (
|
|
154
|
+
onChange: (u) => l({ ...t, [a.property]: u })
|
|
155
155
|
}),
|
|
156
|
-
link: ({ cellValue: e, href: t, target: a = "_blank" }) =>
|
|
156
|
+
link: ({ cellValue: e, href: t, target: a = "_blank" }) => G(Ge, { href: t, target: a }, () => e)
|
|
157
157
|
};
|
|
158
|
-
function
|
|
158
|
+
function lt(e, t) {
|
|
159
159
|
if (!e) return null;
|
|
160
160
|
if (typeof e == "string") {
|
|
161
|
-
const a =
|
|
161
|
+
const a = ae[e];
|
|
162
162
|
return a ? a(t) : (console.warn(`[ZxtTable] 未找到内置渲染器: ${e}`), t.cellValue ?? "");
|
|
163
163
|
}
|
|
164
164
|
if (typeof e == "function")
|
|
165
165
|
return e(t);
|
|
166
166
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
167
|
-
const { name: a, props:
|
|
168
|
-
return typeof a == "string" &&
|
|
167
|
+
const { name: a, props: l = {}, attrs: u = {}, events: c = {}, content: r } = e;
|
|
168
|
+
return typeof a == "string" && ae[a] ? ae[a]({
|
|
169
169
|
...t,
|
|
170
|
-
...
|
|
171
|
-
...
|
|
170
|
+
...l,
|
|
171
|
+
...u,
|
|
172
172
|
...c
|
|
173
|
-
}) : typeof a == "object" || typeof a == "function" ?
|
|
173
|
+
}) : typeof a == "object" || typeof a == "function" ? G(a, { ...l, ...u, ...c }, r) : (console.warn("[ZxtTable] cellRender 对象缺少有效的 name 字段"), t.cellValue ?? "");
|
|
174
174
|
}
|
|
175
175
|
return t.cellValue ?? "";
|
|
176
176
|
}
|
|
177
|
-
function
|
|
178
|
-
|
|
177
|
+
function st(e, t) {
|
|
178
|
+
ae[e] && console.warn(`[ZxtTable] 内置渲染器 ${e} 已被覆盖`), ae[e] = t;
|
|
179
179
|
}
|
|
180
|
-
const
|
|
180
|
+
const it = y({
|
|
181
181
|
name: "ZxtTableColumn",
|
|
182
|
-
components: { ElTableColumn:
|
|
182
|
+
components: { ElTableColumn: Ye },
|
|
183
183
|
props: {
|
|
184
184
|
column: {
|
|
185
185
|
type: Object,
|
|
@@ -195,56 +195,56 @@ const mt = b({
|
|
|
195
195
|
}
|
|
196
196
|
},
|
|
197
197
|
setup(e) {
|
|
198
|
-
const t =
|
|
199
|
-
}), a = (
|
|
200
|
-
const { currentPage: p, pageSize:
|
|
201
|
-
return (p - 1) *
|
|
202
|
-
},
|
|
203
|
-
const
|
|
198
|
+
const t = Te("updateRow", () => {
|
|
199
|
+
}), a = (r) => {
|
|
200
|
+
const { currentPage: p, pageSize: m } = e;
|
|
201
|
+
return (p - 1) * m + r + 1;
|
|
202
|
+
}, l = C(() => {
|
|
203
|
+
const r = e.column;
|
|
204
204
|
return {
|
|
205
|
-
...
|
|
206
|
-
prop:
|
|
205
|
+
...r,
|
|
206
|
+
prop: r.prop ?? r.field,
|
|
207
207
|
// 优先使用 prop,兼容 field
|
|
208
|
-
label:
|
|
208
|
+
label: r.label ?? r.title
|
|
209
209
|
// 优先使用 label,兼容 title
|
|
210
210
|
};
|
|
211
|
-
}),
|
|
212
|
-
const { children:
|
|
211
|
+
}), u = C(() => {
|
|
212
|
+
const { children: r, ...p } = l.value;
|
|
213
213
|
return p;
|
|
214
214
|
});
|
|
215
215
|
return {
|
|
216
|
-
normalizedColumn:
|
|
217
|
-
columnProps:
|
|
218
|
-
renderCell: (
|
|
219
|
-
const p =
|
|
220
|
-
return
|
|
221
|
-
row:
|
|
216
|
+
normalizedColumn: l,
|
|
217
|
+
columnProps: u,
|
|
218
|
+
renderCell: (r) => {
|
|
219
|
+
const p = l.value, m = r.row[p.prop], d = m ?? p.defaultValue ?? "";
|
|
220
|
+
return lt(p.cellRender, {
|
|
221
|
+
row: r.row,
|
|
222
222
|
column: p,
|
|
223
|
-
rowIndex:
|
|
223
|
+
rowIndex: r.$index,
|
|
224
224
|
cellValue: d,
|
|
225
|
-
updateRow: (h) => t(h,
|
|
225
|
+
updateRow: (h) => t(h, r.$index)
|
|
226
226
|
});
|
|
227
227
|
},
|
|
228
228
|
defaultIndexMethod: a
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
231
|
});
|
|
232
|
-
function
|
|
233
|
-
const
|
|
232
|
+
function ut(e, t, a, l, u, c) {
|
|
233
|
+
const r = z("ZxtTableColumn", !0), p = z("el-table-column");
|
|
234
234
|
return e.normalizedColumn.children && e.normalizedColumn.children.length ? (s(), $(p, M({ key: 0 }, e.columnProps, {
|
|
235
235
|
key: e.normalizedColumn.prop + "-group"
|
|
236
236
|
}), {
|
|
237
|
-
default:
|
|
238
|
-
(s(!0),
|
|
237
|
+
default: b(() => [
|
|
238
|
+
(s(!0), g(B, null, R(e.normalizedColumn.children, (m, d) => (s(), $(r, {
|
|
239
239
|
key: d,
|
|
240
|
-
column:
|
|
240
|
+
column: m,
|
|
241
241
|
"current-page": e.currentPage,
|
|
242
242
|
"page-size": e.pageSize
|
|
243
|
-
},
|
|
244
|
-
|
|
245
|
-
name:
|
|
246
|
-
fn:
|
|
247
|
-
|
|
243
|
+
}, ne({ _: 2 }, [
|
|
244
|
+
R(e.$slots, (h, i) => ({
|
|
245
|
+
name: i,
|
|
246
|
+
fn: b((_) => [
|
|
247
|
+
Z(e.$slots, i, M({ ref_for: !0 }, _))
|
|
248
248
|
])
|
|
249
249
|
}))
|
|
250
250
|
]), 1032, ["column", "current-page", "page-size"]))), 128))
|
|
@@ -253,34 +253,34 @@ function ht(e, t, a, r, i, c) {
|
|
|
253
253
|
}, 16)) : (s(), $(p, M({ key: 1 }, e.columnProps, {
|
|
254
254
|
key: e.normalizedColumn.prop,
|
|
255
255
|
index: e.normalizedColumn.indexMethod || e.defaultIndexMethod
|
|
256
|
-
}),
|
|
256
|
+
}), ne({ _: 2 }, [
|
|
257
257
|
!["selection", "index"].includes(e.normalizedColumn.type) && (e.normalizedColumn.type !== "expand" || e.normalizedColumn.slot) ? {
|
|
258
258
|
name: "default",
|
|
259
|
-
fn:
|
|
260
|
-
e.normalizedColumn.slot ?
|
|
259
|
+
fn: b((m) => [
|
|
260
|
+
e.normalizedColumn.slot ? Z(e.$slots, e.normalizedColumn.slot, {
|
|
261
261
|
key: 0,
|
|
262
|
-
row:
|
|
263
|
-
index:
|
|
262
|
+
row: m.row,
|
|
263
|
+
index: m.$index,
|
|
264
264
|
column: e.normalizedColumn
|
|
265
|
-
}) : e.normalizedColumn.cellRender ? (s(), $(
|
|
266
|
-
|
|
267
|
-
|
|
265
|
+
}) : e.normalizedColumn.cellRender ? (s(), $(ye(e.renderCell(m)), { key: 1 })) : e.normalizedColumn.formatter ? (s(), g(B, { key: 2 }, [
|
|
266
|
+
j(Q(e.normalizedColumn.formatter(
|
|
267
|
+
m.row,
|
|
268
268
|
e.normalizedColumn,
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
m.row[e.normalizedColumn.prop],
|
|
270
|
+
m.$index
|
|
271
271
|
)), 1)
|
|
272
|
-
], 64)) : (s(),
|
|
273
|
-
|
|
272
|
+
], 64)) : (s(), g(B, { key: 3 }, [
|
|
273
|
+
j(Q(m.row[e.normalizedColumn.prop]), 1)
|
|
274
274
|
], 64))
|
|
275
275
|
]),
|
|
276
276
|
key: "0"
|
|
277
277
|
} : void 0
|
|
278
278
|
]), 1040, ["index"]));
|
|
279
279
|
}
|
|
280
|
-
const
|
|
280
|
+
const dt = /* @__PURE__ */ q(it, [["render", ut]]), ct = y({
|
|
281
281
|
name: "ZxtTable",
|
|
282
282
|
inheritAttrs: !1,
|
|
283
|
-
components: { ZxtPagination:
|
|
283
|
+
components: { ZxtPagination: J, ZxtTableColumn: dt, ElTable: et },
|
|
284
284
|
props: {
|
|
285
285
|
// 表格唯一标识
|
|
286
286
|
id: { type: String, default: "" },
|
|
@@ -309,6 +309,11 @@ const vt = /* @__PURE__ */ U(mt, [["render", ht]]), _t = b({
|
|
|
309
309
|
proxyConfig: {
|
|
310
310
|
type: Object,
|
|
311
311
|
default: null
|
|
312
|
+
},
|
|
313
|
+
// 是否在挂载时自动加载数据(proxy 模式下)
|
|
314
|
+
autoLoad: {
|
|
315
|
+
type: Boolean,
|
|
316
|
+
default: !0
|
|
312
317
|
}
|
|
313
318
|
},
|
|
314
319
|
emits: [
|
|
@@ -321,93 +326,95 @@ const vt = /* @__PURE__ */ U(mt, [["render", ht]]), _t = b({
|
|
|
321
326
|
"update:row"
|
|
322
327
|
],
|
|
323
328
|
setup(e, { emit: t }) {
|
|
324
|
-
const a = k(null),
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}),
|
|
328
|
-
|
|
329
|
+
const a = k(null), l = k(e.pageSize), u = k(e.currentPage), c = k(!1), r = k([]), p = k(0), m = k({ prop: "", order: "" }), d = k({}), h = k({});
|
|
330
|
+
K(() => e.currentPage, (v) => {
|
|
331
|
+
u.value = v;
|
|
332
|
+
}), K(() => e.pageSize, (v) => {
|
|
333
|
+
l.value = v;
|
|
329
334
|
});
|
|
330
|
-
const
|
|
335
|
+
const i = C(() => e.height === "full" ? { height: "100%" } : {}), _ = C(() => {
|
|
331
336
|
if (e.height !== "full")
|
|
332
337
|
return e.height;
|
|
333
|
-
}),
|
|
334
|
-
() =>
|
|
335
|
-
),
|
|
336
|
-
|
|
337
|
-
},
|
|
338
|
-
|
|
339
|
-
},
|
|
340
|
-
|
|
341
|
-
},
|
|
342
|
-
d.value =
|
|
343
|
-
}, T = async (
|
|
344
|
-
if (!
|
|
345
|
-
const
|
|
346
|
-
if (typeof
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
338
|
+
}), o = C(() => !!e.proxyConfig), S = C(() => o.value ? p.value : e.total > 0 ? e.total : e.data.length), L = C(
|
|
339
|
+
() => o.value ? r.value : e.data
|
|
340
|
+
), W = (v) => {
|
|
341
|
+
o.value && (u.value = v.page, l.value = v.size, T()), t("size-change", v);
|
|
342
|
+
}, x = (v) => {
|
|
343
|
+
o.value && (u.value = v.page, l.value = v.size, T()), t("page-change", v);
|
|
344
|
+
}, I = ({ column: v, prop: P, order: H }) => {
|
|
345
|
+
m.value = { prop: P, order: H }, o.value && T(), t("sort-change", { column: v, prop: P, order: H });
|
|
346
|
+
}, ue = (v) => {
|
|
347
|
+
d.value = v || {}, o.value && T(), t("filter-change", d.value);
|
|
348
|
+
}, T = async (v) => {
|
|
349
|
+
if (!o.value) return;
|
|
350
|
+
const P = e.proxyConfig || {}, H = P.ajax?.query;
|
|
351
|
+
if (typeof H != "function") return;
|
|
352
|
+
const E = P.props || {}, fe = E.pageField || "page";
|
|
353
|
+
E.sizeField;
|
|
354
|
+
const ge = E.sortField || "sort", me = E.orderField || "order", he = E.filtersField || "filters";
|
|
355
|
+
v?.formData !== void 0 ? h.value = v.formData : P._formData && (h.value = P._formData);
|
|
356
|
+
const ve = P.params || {}, N = {
|
|
357
|
+
[fe]: {
|
|
358
|
+
currentPage: v?.page ?? u.value,
|
|
359
|
+
pageSize: v?.pageSize ?? l.value
|
|
353
360
|
},
|
|
354
|
-
form:
|
|
355
|
-
...
|
|
361
|
+
form: h.value,
|
|
362
|
+
...ve
|
|
356
363
|
};
|
|
357
|
-
|
|
364
|
+
m.value?.prop && (N[ge] = m.value.prop, N[me] = m.value.order), d.value && Object.keys(d.value).length && (N[he] = d.value), c.value = !0;
|
|
358
365
|
try {
|
|
359
|
-
const
|
|
360
|
-
let
|
|
361
|
-
if (typeof
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
} else
|
|
365
|
-
|
|
366
|
-
data:
|
|
366
|
+
const F = await H(N), Y = P.response || {}, _e = Y.listField || "list", Ce = Y.totalField || "total", re = Y.transform;
|
|
367
|
+
let V = [], n = 0;
|
|
368
|
+
if (typeof re == "function") {
|
|
369
|
+
const f = re(F);
|
|
370
|
+
V = f?.list ?? [], n = f?.total ?? 0;
|
|
371
|
+
} else F && typeof F == "object" && (V = F?.[_e] ?? F?.data ?? [], n = F?.[Ce] ?? F?.total ?? 0);
|
|
372
|
+
r.value = Array.isArray(V) ? V : [], p.value = Number(n) || 0, t("loaded", {
|
|
373
|
+
data: r.value,
|
|
367
374
|
total: p.value,
|
|
368
|
-
payload:
|
|
375
|
+
payload: N
|
|
369
376
|
});
|
|
370
|
-
} catch (
|
|
371
|
-
t("load-error",
|
|
377
|
+
} catch (F) {
|
|
378
|
+
t("load-error", F);
|
|
372
379
|
} finally {
|
|
373
380
|
c.value = !1;
|
|
374
381
|
}
|
|
375
|
-
},
|
|
376
|
-
|
|
382
|
+
}, oe = (v, P) => {
|
|
383
|
+
o.value ? r.value.splice(P, 1, v) : t("update:row", { index: P, row: v });
|
|
377
384
|
};
|
|
378
|
-
|
|
379
|
-
|
|
385
|
+
He("updateRow", oe), Oe(() => {
|
|
386
|
+
o.value && e.autoLoad && T();
|
|
380
387
|
});
|
|
381
|
-
const
|
|
388
|
+
const de = () => a.value, ce = () => a.value?.getSelectionRows?.() || [], pe = (v) => T(v);
|
|
382
389
|
return {
|
|
383
390
|
tableRef: a,
|
|
384
|
-
containerStyle:
|
|
385
|
-
tableHeight:
|
|
386
|
-
getTableRef:
|
|
387
|
-
pageSize:
|
|
388
|
-
currentPage:
|
|
391
|
+
containerStyle: i,
|
|
392
|
+
tableHeight: _,
|
|
393
|
+
getTableRef: de,
|
|
394
|
+
pageSize: l,
|
|
395
|
+
currentPage: u,
|
|
389
396
|
loading: c,
|
|
390
|
-
renderData:
|
|
391
|
-
total:
|
|
397
|
+
renderData: L,
|
|
398
|
+
total: S,
|
|
392
399
|
pageSizes: C(() => e.pageSizes),
|
|
393
400
|
paginationLayout: C(() => e.paginationLayout),
|
|
394
|
-
handleSizeChange:
|
|
395
|
-
handlePageChange:
|
|
396
|
-
handleSortChange:
|
|
397
|
-
handleFilterChange:
|
|
398
|
-
reload:
|
|
399
|
-
getSelectedRows:
|
|
400
|
-
updateRow:
|
|
401
|
+
handleSizeChange: W,
|
|
402
|
+
handlePageChange: x,
|
|
403
|
+
handleSortChange: I,
|
|
404
|
+
handleFilterChange: ue,
|
|
405
|
+
reload: pe,
|
|
406
|
+
getSelectedRows: ce,
|
|
407
|
+
updateRow: oe
|
|
401
408
|
};
|
|
402
409
|
}
|
|
403
410
|
});
|
|
404
|
-
function
|
|
405
|
-
const
|
|
406
|
-
return s(),
|
|
407
|
-
class:
|
|
408
|
-
style:
|
|
411
|
+
function pt(e, t, a, l, u, c) {
|
|
412
|
+
const r = z("ZxtTableColumn"), p = z("el-table"), m = z("ZxtPagination"), d = Ze("loading");
|
|
413
|
+
return s(), g("div", {
|
|
414
|
+
class: ie(["zxt-table-container", { "zxt-table-container--full": e.height === "full" }]),
|
|
415
|
+
style: je(e.containerStyle)
|
|
409
416
|
}, [
|
|
410
|
-
|
|
417
|
+
Ie((s(), $(p, M({
|
|
411
418
|
ref: "tableRef",
|
|
412
419
|
data: e.renderData,
|
|
413
420
|
height: e.tableHeight
|
|
@@ -416,17 +423,17 @@ function Ct(e, t, a, r, i, c) {
|
|
|
416
423
|
onSortChange: e.handleSortChange,
|
|
417
424
|
onFilterChange: e.handleFilterChange
|
|
418
425
|
}), {
|
|
419
|
-
default:
|
|
420
|
-
(s(!0),
|
|
421
|
-
key:
|
|
426
|
+
default: b(() => [
|
|
427
|
+
(s(!0), g(B, null, R(e.columns, (h, i) => (s(), $(r, {
|
|
428
|
+
key: i,
|
|
422
429
|
column: h,
|
|
423
430
|
"current-page": e.currentPage,
|
|
424
431
|
"page-size": e.pageSize
|
|
425
|
-
},
|
|
426
|
-
|
|
427
|
-
name:
|
|
428
|
-
fn:
|
|
429
|
-
|
|
432
|
+
}, ne({ _: 2 }, [
|
|
433
|
+
R(e.$slots, (_, o) => ({
|
|
434
|
+
name: o,
|
|
435
|
+
fn: b((S) => [
|
|
436
|
+
Z(e.$slots, o, M({ ref_for: !0 }, S), void 0, !0)
|
|
430
437
|
])
|
|
431
438
|
}))
|
|
432
439
|
]), 1032, ["column", "current-page", "page-size"]))), 128))
|
|
@@ -435,7 +442,7 @@ function Ct(e, t, a, r, i, c) {
|
|
|
435
442
|
}, 16, ["data", "height", "id", "onSortChange", "onFilterChange"])), [
|
|
436
443
|
[d, e.loading]
|
|
437
444
|
]),
|
|
438
|
-
e.pageable ? (s(), $(
|
|
445
|
+
e.pageable ? (s(), $(m, {
|
|
439
446
|
key: 0,
|
|
440
447
|
"model-value": e.currentPage,
|
|
441
448
|
"page-size": e.pageSize,
|
|
@@ -445,11 +452,11 @@ function Ct(e, t, a, r, i, c) {
|
|
|
445
452
|
layout: e.paginationLayout,
|
|
446
453
|
onPageChange: e.handlePageChange,
|
|
447
454
|
onSizeChange: e.handleSizeChange
|
|
448
|
-
}, null, 8, ["model-value", "page-size", "page-sizes", "total", "layout", "onPageChange", "onSizeChange"])) :
|
|
455
|
+
}, null, 8, ["model-value", "page-size", "page-sizes", "total", "layout", "onPageChange", "onSizeChange"])) : X("", !0)
|
|
449
456
|
], 6);
|
|
450
457
|
}
|
|
451
|
-
const
|
|
452
|
-
class
|
|
458
|
+
const O = /* @__PURE__ */ q(ct, [["render", pt], ["__scopeId", "data-v-ebf6786f"]]), U = /* @__PURE__ */ new Map();
|
|
459
|
+
class ft {
|
|
453
460
|
/**
|
|
454
461
|
* 注册自定义渲染器
|
|
455
462
|
* @param {String} name - 渲染器名称
|
|
@@ -463,7 +470,7 @@ class wt {
|
|
|
463
470
|
* })
|
|
464
471
|
*/
|
|
465
472
|
add(t, a) {
|
|
466
|
-
return !t || typeof t != "string" ? (console.warn("[ZxtTable] 渲染器名称必须是字符串"), this) : !a || typeof a != "object" ? (console.warn("[ZxtTable] 渲染器配置必须是对象"), this) : (
|
|
473
|
+
return !t || typeof t != "string" ? (console.warn("[ZxtTable] 渲染器名称必须是字符串"), this) : !a || typeof a != "object" ? (console.warn("[ZxtTable] 渲染器配置必须是对象"), this) : (U.has(t) && console.warn(`[ZxtTable] 渲染器 "${t}" 已存在,将被覆盖`), U.set(t, a), this);
|
|
467
474
|
}
|
|
468
475
|
/**
|
|
469
476
|
* 获取渲染器
|
|
@@ -471,14 +478,14 @@ class wt {
|
|
|
471
478
|
* @returns {Object|undefined}
|
|
472
479
|
*/
|
|
473
480
|
get(t) {
|
|
474
|
-
return
|
|
481
|
+
return U.get(t);
|
|
475
482
|
}
|
|
476
483
|
/**
|
|
477
484
|
* 删除渲染器
|
|
478
485
|
* @param {String} name - 渲染器名称
|
|
479
486
|
*/
|
|
480
487
|
delete(t) {
|
|
481
|
-
return
|
|
488
|
+
return U.delete(t);
|
|
482
489
|
}
|
|
483
490
|
/**
|
|
484
491
|
* 检查渲染器是否存在
|
|
@@ -486,30 +493,30 @@ class wt {
|
|
|
486
493
|
* @returns {Boolean}
|
|
487
494
|
*/
|
|
488
495
|
has(t) {
|
|
489
|
-
return
|
|
496
|
+
return U.has(t);
|
|
490
497
|
}
|
|
491
498
|
/**
|
|
492
499
|
* 获取所有渲染器名称
|
|
493
500
|
* @returns {Array<String>}
|
|
494
501
|
*/
|
|
495
502
|
getAll() {
|
|
496
|
-
return Array.from(
|
|
503
|
+
return Array.from(U.keys());
|
|
497
504
|
}
|
|
498
505
|
/**
|
|
499
506
|
* 清空所有自定义渲染器
|
|
500
507
|
*/
|
|
501
508
|
clear() {
|
|
502
|
-
|
|
509
|
+
U.clear();
|
|
503
510
|
}
|
|
504
511
|
}
|
|
505
|
-
const
|
|
506
|
-
function
|
|
512
|
+
const be = new ft();
|
|
513
|
+
function gt(e, t, a = {}) {
|
|
507
514
|
if (!e || !e.itemRender)
|
|
508
515
|
return null;
|
|
509
|
-
const { name:
|
|
510
|
-
if (
|
|
511
|
-
const
|
|
512
|
-
if (typeof
|
|
516
|
+
const { name: l } = e.itemRender;
|
|
517
|
+
if (l && be.has(l)) {
|
|
518
|
+
const u = be.get(l);
|
|
519
|
+
if (typeof u.renderItemContent == "function") {
|
|
513
520
|
const c = {
|
|
514
521
|
data: t,
|
|
515
522
|
field: e.field || e.prop,
|
|
@@ -517,25 +524,25 @@ function bt(e, t, a = {}) {
|
|
|
517
524
|
formData: t
|
|
518
525
|
};
|
|
519
526
|
try {
|
|
520
|
-
return
|
|
521
|
-
} catch (
|
|
522
|
-
return console.error(`[ZxtTable] 渲染器 "${
|
|
527
|
+
return u.renderItemContent(a, c);
|
|
528
|
+
} catch (r) {
|
|
529
|
+
return console.error(`[ZxtTable] 渲染器 "${l}" 执行出错:`, r), null;
|
|
523
530
|
}
|
|
524
531
|
}
|
|
525
532
|
}
|
|
526
533
|
return null;
|
|
527
534
|
}
|
|
528
|
-
|
|
529
|
-
e.component(
|
|
535
|
+
O.install = function(e) {
|
|
536
|
+
e.component(O.name, O);
|
|
530
537
|
};
|
|
531
|
-
|
|
532
|
-
|
|
538
|
+
O.registerRenderer = st;
|
|
539
|
+
O.renderer = be;
|
|
533
540
|
/*! Element Plus Icons Vue v2.3.2 */
|
|
534
|
-
var
|
|
541
|
+
var mt = /* @__PURE__ */ y({
|
|
535
542
|
name: "ArrowDown",
|
|
536
543
|
__name: "arrow-down",
|
|
537
544
|
setup(e) {
|
|
538
|
-
return (t, a) => (s(),
|
|
545
|
+
return (t, a) => (s(), g("svg", {
|
|
539
546
|
xmlns: "http://www.w3.org/2000/svg",
|
|
540
547
|
viewBox: "0 0 1024 1024"
|
|
541
548
|
}, [
|
|
@@ -545,11 +552,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
545
552
|
})
|
|
546
553
|
]));
|
|
547
554
|
}
|
|
548
|
-
}),
|
|
555
|
+
}), xe = mt, ht = /* @__PURE__ */ y({
|
|
549
556
|
name: "Check",
|
|
550
557
|
__name: "check",
|
|
551
558
|
setup(e) {
|
|
552
|
-
return (t, a) => (s(),
|
|
559
|
+
return (t, a) => (s(), g("svg", {
|
|
553
560
|
xmlns: "http://www.w3.org/2000/svg",
|
|
554
561
|
viewBox: "0 0 1024 1024"
|
|
555
562
|
}, [
|
|
@@ -559,11 +566,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
559
566
|
})
|
|
560
567
|
]));
|
|
561
568
|
}
|
|
562
|
-
}),
|
|
569
|
+
}), vt = ht, _t = /* @__PURE__ */ y({
|
|
563
570
|
name: "Close",
|
|
564
571
|
__name: "close",
|
|
565
572
|
setup(e) {
|
|
566
|
-
return (t, a) => (s(),
|
|
573
|
+
return (t, a) => (s(), g("svg", {
|
|
567
574
|
xmlns: "http://www.w3.org/2000/svg",
|
|
568
575
|
viewBox: "0 0 1024 1024"
|
|
569
576
|
}, [
|
|
@@ -573,11 +580,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
573
580
|
})
|
|
574
581
|
]));
|
|
575
582
|
}
|
|
576
|
-
}),
|
|
583
|
+
}), Ct = _t, wt = /* @__PURE__ */ y({
|
|
577
584
|
name: "CopyDocument",
|
|
578
585
|
__name: "copy-document",
|
|
579
586
|
setup(e) {
|
|
580
|
-
return (t, a) => (s(),
|
|
587
|
+
return (t, a) => (s(), g("svg", {
|
|
581
588
|
xmlns: "http://www.w3.org/2000/svg",
|
|
582
589
|
viewBox: "0 0 1024 1024"
|
|
583
590
|
}, [
|
|
@@ -591,11 +598,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
591
598
|
})
|
|
592
599
|
]));
|
|
593
600
|
}
|
|
594
|
-
}),
|
|
601
|
+
}), yt = wt, bt = /* @__PURE__ */ y({
|
|
595
602
|
name: "Delete",
|
|
596
603
|
__name: "delete",
|
|
597
604
|
setup(e) {
|
|
598
|
-
return (t, a) => (s(),
|
|
605
|
+
return (t, a) => (s(), g("svg", {
|
|
599
606
|
xmlns: "http://www.w3.org/2000/svg",
|
|
600
607
|
viewBox: "0 0 1024 1024"
|
|
601
608
|
}, [
|
|
@@ -605,11 +612,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
605
612
|
})
|
|
606
613
|
]));
|
|
607
614
|
}
|
|
608
|
-
}),
|
|
615
|
+
}), ze = bt, zt = /* @__PURE__ */ y({
|
|
609
616
|
name: "Document",
|
|
610
617
|
__name: "document",
|
|
611
618
|
setup(e) {
|
|
612
|
-
return (t, a) => (s(),
|
|
619
|
+
return (t, a) => (s(), g("svg", {
|
|
613
620
|
xmlns: "http://www.w3.org/2000/svg",
|
|
614
621
|
viewBox: "0 0 1024 1024"
|
|
615
622
|
}, [
|
|
@@ -619,11 +626,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
619
626
|
})
|
|
620
627
|
]));
|
|
621
628
|
}
|
|
622
|
-
}),
|
|
629
|
+
}), St = zt, kt = /* @__PURE__ */ y({
|
|
623
630
|
name: "Download",
|
|
624
631
|
__name: "download",
|
|
625
632
|
setup(e) {
|
|
626
|
-
return (t, a) => (s(),
|
|
633
|
+
return (t, a) => (s(), g("svg", {
|
|
627
634
|
xmlns: "http://www.w3.org/2000/svg",
|
|
628
635
|
viewBox: "0 0 1024 1024"
|
|
629
636
|
}, [
|
|
@@ -633,11 +640,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
633
640
|
})
|
|
634
641
|
]));
|
|
635
642
|
}
|
|
636
|
-
}),
|
|
643
|
+
}), Se = kt, $t = /* @__PURE__ */ y({
|
|
637
644
|
name: "Edit",
|
|
638
645
|
__name: "edit",
|
|
639
646
|
setup(e) {
|
|
640
|
-
return (t, a) => (s(),
|
|
647
|
+
return (t, a) => (s(), g("svg", {
|
|
641
648
|
xmlns: "http://www.w3.org/2000/svg",
|
|
642
649
|
viewBox: "0 0 1024 1024"
|
|
643
650
|
}, [
|
|
@@ -651,11 +658,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
651
658
|
})
|
|
652
659
|
]));
|
|
653
660
|
}
|
|
654
|
-
}),
|
|
661
|
+
}), ke = $t, Vt = /* @__PURE__ */ y({
|
|
655
662
|
name: "Lock",
|
|
656
663
|
__name: "lock",
|
|
657
664
|
setup(e) {
|
|
658
|
-
return (t, a) => (s(),
|
|
665
|
+
return (t, a) => (s(), g("svg", {
|
|
659
666
|
xmlns: "http://www.w3.org/2000/svg",
|
|
660
667
|
viewBox: "0 0 1024 1024"
|
|
661
668
|
}, [
|
|
@@ -669,11 +676,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
669
676
|
})
|
|
670
677
|
]));
|
|
671
678
|
}
|
|
672
|
-
}),
|
|
679
|
+
}), Pt = Vt, Dt = /* @__PURE__ */ y({
|
|
673
680
|
name: "Plus",
|
|
674
681
|
__name: "plus",
|
|
675
682
|
setup(e) {
|
|
676
|
-
return (t, a) => (s(),
|
|
683
|
+
return (t, a) => (s(), g("svg", {
|
|
677
684
|
xmlns: "http://www.w3.org/2000/svg",
|
|
678
685
|
viewBox: "0 0 1024 1024"
|
|
679
686
|
}, [
|
|
@@ -683,11 +690,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
683
690
|
})
|
|
684
691
|
]));
|
|
685
692
|
}
|
|
686
|
-
}),
|
|
693
|
+
}), $e = Dt, Ft = /* @__PURE__ */ y({
|
|
687
694
|
name: "Refresh",
|
|
688
695
|
__name: "refresh",
|
|
689
696
|
setup(e) {
|
|
690
|
-
return (t, a) => (s(),
|
|
697
|
+
return (t, a) => (s(), g("svg", {
|
|
691
698
|
xmlns: "http://www.w3.org/2000/svg",
|
|
692
699
|
viewBox: "0 0 1024 1024"
|
|
693
700
|
}, [
|
|
@@ -697,11 +704,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
697
704
|
})
|
|
698
705
|
]));
|
|
699
706
|
}
|
|
700
|
-
}),
|
|
707
|
+
}), le = Ft, Rt = /* @__PURE__ */ y({
|
|
701
708
|
name: "Search",
|
|
702
709
|
__name: "search",
|
|
703
710
|
setup(e) {
|
|
704
|
-
return (t, a) => (s(),
|
|
711
|
+
return (t, a) => (s(), g("svg", {
|
|
705
712
|
xmlns: "http://www.w3.org/2000/svg",
|
|
706
713
|
viewBox: "0 0 1024 1024"
|
|
707
714
|
}, [
|
|
@@ -711,11 +718,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
711
718
|
})
|
|
712
719
|
]));
|
|
713
720
|
}
|
|
714
|
-
}),
|
|
721
|
+
}), se = Rt, At = /* @__PURE__ */ y({
|
|
715
722
|
name: "Setting",
|
|
716
723
|
__name: "setting",
|
|
717
724
|
setup(e) {
|
|
718
|
-
return (t, a) => (s(),
|
|
725
|
+
return (t, a) => (s(), g("svg", {
|
|
719
726
|
xmlns: "http://www.w3.org/2000/svg",
|
|
720
727
|
viewBox: "0 0 1024 1024"
|
|
721
728
|
}, [
|
|
@@ -725,11 +732,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
725
732
|
})
|
|
726
733
|
]));
|
|
727
734
|
}
|
|
728
|
-
}),
|
|
735
|
+
}), Ve = At, Ot = /* @__PURE__ */ y({
|
|
729
736
|
name: "Share",
|
|
730
737
|
__name: "share",
|
|
731
738
|
setup(e) {
|
|
732
|
-
return (t, a) => (s(),
|
|
739
|
+
return (t, a) => (s(), g("svg", {
|
|
733
740
|
xmlns: "http://www.w3.org/2000/svg",
|
|
734
741
|
viewBox: "0 0 1024 1024"
|
|
735
742
|
}, [
|
|
@@ -739,11 +746,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
739
746
|
})
|
|
740
747
|
]));
|
|
741
748
|
}
|
|
742
|
-
}),
|
|
749
|
+
}), xt = Ot, Mt = /* @__PURE__ */ y({
|
|
743
750
|
name: "Unlock",
|
|
744
751
|
__name: "unlock",
|
|
745
752
|
setup(e) {
|
|
746
|
-
return (t, a) => (s(),
|
|
753
|
+
return (t, a) => (s(), g("svg", {
|
|
747
754
|
xmlns: "http://www.w3.org/2000/svg",
|
|
748
755
|
viewBox: "0 0 1024 1024"
|
|
749
756
|
}, [
|
|
@@ -757,11 +764,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
757
764
|
})
|
|
758
765
|
]));
|
|
759
766
|
}
|
|
760
|
-
}),
|
|
767
|
+
}), Bt = Mt, Lt = /* @__PURE__ */ y({
|
|
761
768
|
name: "Upload",
|
|
762
769
|
__name: "upload",
|
|
763
770
|
setup(e) {
|
|
764
|
-
return (t, a) => (s(),
|
|
771
|
+
return (t, a) => (s(), g("svg", {
|
|
765
772
|
xmlns: "http://www.w3.org/2000/svg",
|
|
766
773
|
viewBox: "0 0 1024 1024"
|
|
767
774
|
}, [
|
|
@@ -771,11 +778,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
771
778
|
})
|
|
772
779
|
]));
|
|
773
780
|
}
|
|
774
|
-
}),
|
|
781
|
+
}), Pe = Lt, Tt = /* @__PURE__ */ y({
|
|
775
782
|
name: "View",
|
|
776
783
|
__name: "view",
|
|
777
784
|
setup(e) {
|
|
778
|
-
return (t, a) => (s(),
|
|
785
|
+
return (t, a) => (s(), g("svg", {
|
|
779
786
|
xmlns: "http://www.w3.org/2000/svg",
|
|
780
787
|
viewBox: "0 0 1024 1024"
|
|
781
788
|
}, [
|
|
@@ -785,11 +792,11 @@ var yt = /* @__PURE__ */ b({
|
|
|
785
792
|
})
|
|
786
793
|
]));
|
|
787
794
|
}
|
|
788
|
-
}),
|
|
795
|
+
}), De = Tt, Ht = /* @__PURE__ */ y({
|
|
789
796
|
name: "Warning",
|
|
790
797
|
__name: "warning",
|
|
791
798
|
setup(e) {
|
|
792
|
-
return (t, a) => (s(),
|
|
799
|
+
return (t, a) => (s(), g("svg", {
|
|
793
800
|
xmlns: "http://www.w3.org/2000/svg",
|
|
794
801
|
viewBox: "0 0 1024 1024"
|
|
795
802
|
}, [
|
|
@@ -799,8 +806,8 @@ var yt = /* @__PURE__ */ b({
|
|
|
799
806
|
})
|
|
800
807
|
]));
|
|
801
808
|
}
|
|
802
|
-
}),
|
|
803
|
-
const
|
|
809
|
+
}), Zt = Ht;
|
|
810
|
+
const jt = y({
|
|
804
811
|
name: "ZxtForm",
|
|
805
812
|
inheritAttrs: !1,
|
|
806
813
|
props: {
|
|
@@ -811,7 +818,7 @@ const Gt = b({
|
|
|
811
818
|
},
|
|
812
819
|
emits: ["submit", "reset"],
|
|
813
820
|
setup(e, { emit: t, expose: a }) {
|
|
814
|
-
const
|
|
821
|
+
const l = k(null), u = Ee({}), c = {
|
|
815
822
|
input: "el-input",
|
|
816
823
|
select: "el-select",
|
|
817
824
|
date: "el-date-picker",
|
|
@@ -819,17 +826,17 @@ const Gt = b({
|
|
|
819
826
|
datetime: "el-date-picker",
|
|
820
827
|
datetimerange: "el-date-picker",
|
|
821
828
|
cascader: "el-cascader"
|
|
822
|
-
},
|
|
823
|
-
const S =
|
|
829
|
+
}, r = (o) => c[o] || "el-input", p = (o) => {
|
|
830
|
+
const S = o.type || "input", L = [
|
|
824
831
|
"select",
|
|
825
832
|
"date",
|
|
826
833
|
"daterange",
|
|
827
834
|
"datetime",
|
|
828
835
|
"datetimerange",
|
|
829
836
|
"cascader"
|
|
830
|
-
].includes(S),
|
|
831
|
-
placeholder:
|
|
832
|
-
disabled:
|
|
837
|
+
].includes(S), W = {
|
|
838
|
+
placeholder: o.placeholder || `请${L ? "选择" : "输入"}${o.label}`,
|
|
839
|
+
disabled: o.disabled,
|
|
833
840
|
style: "width: 100%",
|
|
834
841
|
"popper-class": "zxt-form-popper"
|
|
835
842
|
};
|
|
@@ -840,52 +847,52 @@ const Gt = b({
|
|
|
840
847
|
case "datetime":
|
|
841
848
|
case "datetimerange":
|
|
842
849
|
x = {
|
|
843
|
-
type:
|
|
844
|
-
startPlaceholder:
|
|
845
|
-
endPlaceholder:
|
|
846
|
-
format:
|
|
847
|
-
valueFormat:
|
|
850
|
+
type: o.dateType || S,
|
|
851
|
+
startPlaceholder: o.startPlaceholder || "开始日期",
|
|
852
|
+
endPlaceholder: o.endPlaceholder || "结束日期",
|
|
853
|
+
format: o.format,
|
|
854
|
+
valueFormat: o.valueFormat
|
|
848
855
|
};
|
|
849
856
|
break;
|
|
850
857
|
case "cascader":
|
|
851
858
|
x = {
|
|
852
|
-
options:
|
|
853
|
-
props:
|
|
854
|
-
clearable:
|
|
859
|
+
options: o.options,
|
|
860
|
+
props: o.cascaderProps,
|
|
861
|
+
clearable: o.clearable !== !1
|
|
855
862
|
};
|
|
856
863
|
break;
|
|
857
864
|
default:
|
|
858
865
|
x = {};
|
|
859
866
|
}
|
|
860
|
-
const
|
|
861
|
-
...
|
|
867
|
+
const I = {
|
|
868
|
+
...W,
|
|
862
869
|
...x
|
|
863
870
|
};
|
|
864
|
-
return "clearable" in
|
|
865
|
-
},
|
|
866
|
-
...
|
|
871
|
+
return "clearable" in o && (I.clearable = o.clearable), o.props && typeof o.props == "object" && Object.assign(I, o.props), I;
|
|
872
|
+
}, m = C(() => e.formColumns.map((o) => ({
|
|
873
|
+
...o,
|
|
867
874
|
colSpan: {
|
|
868
|
-
xs:
|
|
869
|
-
sm:
|
|
870
|
-
md:
|
|
871
|
-
lg:
|
|
872
|
-
xl:
|
|
875
|
+
xs: o.xs ?? o.span ?? 24,
|
|
876
|
+
sm: o.sm ?? o.span ?? 12,
|
|
877
|
+
md: o.md ?? o.span ?? 12,
|
|
878
|
+
lg: o.lg ?? o.span ?? 12,
|
|
879
|
+
xl: o.xl ?? o.span ?? 12
|
|
873
880
|
}
|
|
874
881
|
})));
|
|
875
|
-
|
|
882
|
+
K(
|
|
876
883
|
() => e.initialFormData,
|
|
877
|
-
(
|
|
878
|
-
Object.keys(
|
|
879
|
-
delete
|
|
880
|
-
}), Object.assign(
|
|
884
|
+
(o) => {
|
|
885
|
+
Object.keys(u).forEach((S) => {
|
|
886
|
+
delete u[S];
|
|
887
|
+
}), Object.assign(u, o);
|
|
881
888
|
},
|
|
882
889
|
{ immediate: !0, deep: !0 }
|
|
883
890
|
);
|
|
884
891
|
const d = C(() => {
|
|
885
|
-
const
|
|
886
|
-
return Object.keys(
|
|
892
|
+
const o = { ...e.rules };
|
|
893
|
+
return Object.keys(o).length === 0 && e.formColumns.length > 0 && e.formColumns.forEach((S) => {
|
|
887
894
|
if (S.required) {
|
|
888
|
-
const
|
|
895
|
+
const L = [
|
|
889
896
|
"select",
|
|
890
897
|
"date",
|
|
891
898
|
"daterange",
|
|
@@ -893,85 +900,85 @@ const Gt = b({
|
|
|
893
900
|
"datetimerange",
|
|
894
901
|
"cascader"
|
|
895
902
|
].includes(S.type);
|
|
896
|
-
|
|
903
|
+
o[S.prop] = [
|
|
897
904
|
{
|
|
898
905
|
required: !0,
|
|
899
|
-
message: `请${
|
|
900
|
-
trigger:
|
|
906
|
+
message: `请${L ? "选择" : "输入"}${S.label}`,
|
|
907
|
+
trigger: L ? "change" : "blur"
|
|
901
908
|
}
|
|
902
909
|
];
|
|
903
910
|
}
|
|
904
|
-
}),
|
|
911
|
+
}), o;
|
|
905
912
|
}), h = () => {
|
|
906
|
-
|
|
907
|
-
|
|
913
|
+
l.value && l.value.validate((o) => {
|
|
914
|
+
o && t("submit", { ...u });
|
|
908
915
|
});
|
|
909
|
-
},
|
|
910
|
-
|
|
911
|
-
},
|
|
916
|
+
}, i = () => {
|
|
917
|
+
l.value && l.value.resetFields(), t("reset");
|
|
918
|
+
}, _ = (o) => () => gt(o, u, {}) || null;
|
|
912
919
|
return a({
|
|
913
|
-
validate: () =>
|
|
914
|
-
resetFields: () =>
|
|
915
|
-
getFormData: () => ({ ...
|
|
920
|
+
validate: () => l.value ? l.value.validate() : Promise.resolve(!1),
|
|
921
|
+
resetFields: () => l.value && l.value.resetFields(),
|
|
922
|
+
getFormData: () => ({ ...u }),
|
|
916
923
|
submitForm: h,
|
|
917
|
-
resetForm:
|
|
924
|
+
resetForm: i
|
|
918
925
|
}), {
|
|
919
|
-
formRef:
|
|
920
|
-
formData:
|
|
926
|
+
formRef: l,
|
|
927
|
+
formData: u,
|
|
921
928
|
formRules: d,
|
|
922
929
|
submitForm: h,
|
|
923
|
-
resetForm:
|
|
924
|
-
processedColumns:
|
|
925
|
-
getComponentType:
|
|
930
|
+
resetForm: i,
|
|
931
|
+
processedColumns: m,
|
|
932
|
+
getComponentType: r,
|
|
926
933
|
getComponentProps: p,
|
|
927
|
-
renderCustomItem:
|
|
934
|
+
renderCustomItem: _
|
|
928
935
|
};
|
|
929
936
|
}
|
|
930
|
-
}),
|
|
937
|
+
}), It = { class: "zxt-form-container" }, Et = {
|
|
931
938
|
key: 0,
|
|
932
939
|
class: "form-label"
|
|
933
|
-
},
|
|
934
|
-
function
|
|
935
|
-
const
|
|
936
|
-
return s(),
|
|
937
|
-
|
|
940
|
+
}, Nt = { class: "form-control" };
|
|
941
|
+
function Ut(e, t, a, l, u, c) {
|
|
942
|
+
const r = z("el-option"), p = z("el-form-item"), m = z("el-col"), d = z("el-row"), h = z("el-form");
|
|
943
|
+
return s(), g("div", It, [
|
|
944
|
+
D(h, M({ ref: "formRef" }, e.$attrs, {
|
|
938
945
|
model: e.formData,
|
|
939
946
|
rules: e.formRules,
|
|
940
947
|
"label-width": e.labelWidth,
|
|
941
948
|
class: "zxt-form"
|
|
942
949
|
}), {
|
|
943
|
-
default:
|
|
944
|
-
|
|
945
|
-
default:
|
|
946
|
-
(s(!0),
|
|
947
|
-
default:
|
|
948
|
-
|
|
949
|
-
prop:
|
|
950
|
-
required:
|
|
950
|
+
default: b(() => [
|
|
951
|
+
D(d, { gutter: 20 }, {
|
|
952
|
+
default: b(() => [
|
|
953
|
+
(s(!0), g(B, null, R(e.processedColumns, (i, _) => (s(), $(m, M({ key: _ }, { ref_for: !0 }, i.colSpan), {
|
|
954
|
+
default: b(() => [
|
|
955
|
+
D(p, {
|
|
956
|
+
prop: i.prop,
|
|
957
|
+
required: i.required,
|
|
951
958
|
"label-width": "0",
|
|
952
959
|
class: "custom-form-item"
|
|
953
960
|
}, {
|
|
954
|
-
default:
|
|
961
|
+
default: b(() => [
|
|
955
962
|
w("div", {
|
|
956
|
-
class:
|
|
963
|
+
class: ie(["form-item-wrapper", { "is-action": i.isAction }])
|
|
957
964
|
}, [
|
|
958
|
-
|
|
959
|
-
w("div",
|
|
960
|
-
|
|
965
|
+
i.label ? (s(), g("span", Et, Q(i.label), 1)) : X("", !0),
|
|
966
|
+
w("div", Nt, [
|
|
967
|
+
i.type === "slot" ? Z(e.$slots, i.slotName || i.prop, {
|
|
961
968
|
key: 0,
|
|
962
969
|
formData: e.formData,
|
|
963
|
-
column:
|
|
964
|
-
}, void 0, !0) :
|
|
970
|
+
column: i
|
|
971
|
+
}, void 0, !0) : i.itemRender ? (s(), $(ye(e.renderCustomItem(i)), { key: 1 })) : (s(), $(ye(e.getComponentType(i.type)), M({
|
|
965
972
|
key: 2,
|
|
966
|
-
modelValue: e.formData[
|
|
967
|
-
"onUpdate:modelValue": (
|
|
968
|
-
}, { ref_for: !0 }, e.getComponentProps(
|
|
969
|
-
default:
|
|
970
|
-
|
|
973
|
+
modelValue: e.formData[i.prop],
|
|
974
|
+
"onUpdate:modelValue": (o) => e.formData[i.prop] = o
|
|
975
|
+
}, { ref_for: !0 }, e.getComponentProps(i), Ne(i.events || {})), {
|
|
976
|
+
default: b(() => [
|
|
977
|
+
i.type === "select" ? (s(!0), g(B, { key: 0 }, R(i.options, (o, S) => (s(), $(r, {
|
|
971
978
|
key: S,
|
|
972
|
-
label:
|
|
973
|
-
value:
|
|
974
|
-
}, null, 8, ["label", "value"]))), 128)) :
|
|
979
|
+
label: o.label,
|
|
980
|
+
value: o.value
|
|
981
|
+
}, null, 8, ["label", "value"]))), 128)) : X("", !0)
|
|
975
982
|
]),
|
|
976
983
|
_: 2
|
|
977
984
|
}, 1040, ["modelValue", "onUpdate:modelValue"]))
|
|
@@ -991,28 +998,28 @@ function Xt(e, t, a, r, i, c) {
|
|
|
991
998
|
}, 16, ["model", "rules", "label-width"])
|
|
992
999
|
]);
|
|
993
1000
|
}
|
|
994
|
-
const
|
|
995
|
-
Plus:
|
|
996
|
-
Delete:
|
|
997
|
-
Refresh:
|
|
998
|
-
Download:
|
|
999
|
-
Search:
|
|
1000
|
-
Edit:
|
|
1001
|
-
View:
|
|
1002
|
-
Upload:
|
|
1003
|
-
Setting:
|
|
1004
|
-
Warning:
|
|
1005
|
-
Check:
|
|
1006
|
-
Close:
|
|
1007
|
-
Document:
|
|
1008
|
-
CopyDocument:
|
|
1009
|
-
Share:
|
|
1010
|
-
Lock:
|
|
1011
|
-
Unlock:
|
|
1012
|
-
ArrowDown:
|
|
1013
|
-
},
|
|
1001
|
+
const Fe = /* @__PURE__ */ q(jt, [["render", Ut], ["__scopeId", "data-v-6b22a57b"]]), qt = {
|
|
1002
|
+
Plus: $e,
|
|
1003
|
+
Delete: ze,
|
|
1004
|
+
Refresh: le,
|
|
1005
|
+
Download: Se,
|
|
1006
|
+
Search: se,
|
|
1007
|
+
Edit: ke,
|
|
1008
|
+
View: De,
|
|
1009
|
+
Upload: Pe,
|
|
1010
|
+
Setting: Ve,
|
|
1011
|
+
Warning: Zt,
|
|
1012
|
+
Check: vt,
|
|
1013
|
+
Close: Ct,
|
|
1014
|
+
Document: St,
|
|
1015
|
+
CopyDocument: yt,
|
|
1016
|
+
Share: xt,
|
|
1017
|
+
Lock: Pt,
|
|
1018
|
+
Unlock: Bt,
|
|
1019
|
+
ArrowDown: xe
|
|
1020
|
+
}, Wt = y({
|
|
1014
1021
|
name: "ActionColumn",
|
|
1015
|
-
components: { ArrowDown:
|
|
1022
|
+
components: { ArrowDown: xe },
|
|
1016
1023
|
props: {
|
|
1017
1024
|
buttons: {
|
|
1018
1025
|
type: Array,
|
|
@@ -1029,19 +1036,19 @@ const xe = /* @__PURE__ */ U(Gt, [["render", Xt], ["__scopeId", "data-v-6b22a57b
|
|
|
1029
1036
|
},
|
|
1030
1037
|
emits: ["action-click"],
|
|
1031
1038
|
setup(e, { emit: t }) {
|
|
1032
|
-
const a = C(() => e.buttons.filter((d) => typeof d.visible == "function" ? d.visible(e.row) : typeof d.visible == "boolean" ? d.visible : !0)),
|
|
1039
|
+
const a = C(() => e.buttons.filter((d) => typeof d.visible == "function" ? d.visible(e.row) : typeof d.visible == "boolean" ? d.visible : !0)), l = C(
|
|
1033
1040
|
() => a.value.length > e.maxVisible
|
|
1034
|
-
),
|
|
1035
|
-
() =>
|
|
1041
|
+
), u = C(
|
|
1042
|
+
() => l.value ? a.value.slice(0, e.maxVisible) : a.value
|
|
1036
1043
|
), c = C(
|
|
1037
|
-
() =>
|
|
1044
|
+
() => l.value ? a.value.slice(e.maxVisible) : []
|
|
1038
1045
|
);
|
|
1039
1046
|
return {
|
|
1040
|
-
visibleButtons:
|
|
1047
|
+
visibleButtons: u,
|
|
1041
1048
|
overflowButtons: c,
|
|
1042
1049
|
getIconComponent: (d) => {
|
|
1043
1050
|
if (d)
|
|
1044
|
-
return typeof d == "object" || typeof d == "function" ? d :
|
|
1051
|
+
return typeof d == "object" || typeof d == "function" ? d : qt[d];
|
|
1045
1052
|
},
|
|
1046
1053
|
handleClick: (d) => {
|
|
1047
1054
|
t("action-click", { code: d.code, button: d, row: e.row });
|
|
@@ -1051,38 +1058,38 @@ const xe = /* @__PURE__ */ U(Gt, [["render", Xt], ["__scopeId", "data-v-6b22a57b
|
|
|
1051
1058
|
}
|
|
1052
1059
|
};
|
|
1053
1060
|
}
|
|
1054
|
-
}),
|
|
1055
|
-
function
|
|
1056
|
-
const
|
|
1057
|
-
return s(),
|
|
1058
|
-
(s(!0),
|
|
1059
|
-
key:
|
|
1060
|
-
type:
|
|
1061
|
-
icon: e.getIconComponent(
|
|
1061
|
+
}), Gt = { class: "action-column" };
|
|
1062
|
+
function Jt(e, t, a, l, u, c) {
|
|
1063
|
+
const r = z("el-button"), p = z("ArrowDown"), m = z("el-icon"), d = z("el-dropdown-item"), h = z("el-dropdown-menu"), i = z("el-dropdown");
|
|
1064
|
+
return s(), g("div", Gt, [
|
|
1065
|
+
(s(!0), g(B, null, R(e.visibleButtons, (_) => (s(), $(r, {
|
|
1066
|
+
key: _.code,
|
|
1067
|
+
type: _.type || "",
|
|
1068
|
+
icon: e.getIconComponent(_.icon),
|
|
1062
1069
|
size: "small",
|
|
1063
1070
|
link: "",
|
|
1064
|
-
onClick: (
|
|
1071
|
+
onClick: (o) => e.handleClick(_)
|
|
1065
1072
|
}, {
|
|
1066
|
-
default:
|
|
1067
|
-
|
|
1073
|
+
default: b(() => [
|
|
1074
|
+
j(Q(_.label), 1)
|
|
1068
1075
|
]),
|
|
1069
1076
|
_: 2
|
|
1070
1077
|
}, 1032, ["type", "icon", "onClick"]))), 128)),
|
|
1071
|
-
e.overflowButtons.length ? (s(), $(
|
|
1078
|
+
e.overflowButtons.length ? (s(), $(i, {
|
|
1072
1079
|
key: 0,
|
|
1073
1080
|
trigger: "hover",
|
|
1074
1081
|
onCommand: e.handleCommand
|
|
1075
1082
|
}, {
|
|
1076
|
-
dropdown:
|
|
1077
|
-
|
|
1078
|
-
default:
|
|
1079
|
-
(s(!0),
|
|
1080
|
-
key:
|
|
1081
|
-
command:
|
|
1082
|
-
icon: e.getIconComponent(
|
|
1083
|
+
dropdown: b(() => [
|
|
1084
|
+
D(h, null, {
|
|
1085
|
+
default: b(() => [
|
|
1086
|
+
(s(!0), g(B, null, R(e.overflowButtons, (_) => (s(), $(d, {
|
|
1087
|
+
key: _.code,
|
|
1088
|
+
command: _,
|
|
1089
|
+
icon: e.getIconComponent(_.icon)
|
|
1083
1090
|
}, {
|
|
1084
|
-
default:
|
|
1085
|
-
|
|
1091
|
+
default: b(() => [
|
|
1092
|
+
j(Q(_.label), 1)
|
|
1086
1093
|
]),
|
|
1087
1094
|
_: 2
|
|
1088
1095
|
}, 1032, ["command", "icon"]))), 128))
|
|
@@ -1090,17 +1097,17 @@ function aa(e, t, a, r, i, c) {
|
|
|
1090
1097
|
_: 1
|
|
1091
1098
|
})
|
|
1092
1099
|
]),
|
|
1093
|
-
default:
|
|
1094
|
-
|
|
1100
|
+
default: b(() => [
|
|
1101
|
+
D(r, {
|
|
1095
1102
|
type: "",
|
|
1096
1103
|
size: "small",
|
|
1097
1104
|
link: ""
|
|
1098
1105
|
}, {
|
|
1099
|
-
default:
|
|
1100
|
-
t[0] || (t[0] =
|
|
1101
|
-
|
|
1102
|
-
default:
|
|
1103
|
-
|
|
1106
|
+
default: b(() => [
|
|
1107
|
+
t[0] || (t[0] = j(" 更多 ", -1)),
|
|
1108
|
+
D(m, { class: "el-icon--right" }, {
|
|
1109
|
+
default: b(() => [
|
|
1110
|
+
D(p)
|
|
1104
1111
|
]),
|
|
1105
1112
|
_: 1
|
|
1106
1113
|
})
|
|
@@ -1109,25 +1116,25 @@ function aa(e, t, a, r, i, c) {
|
|
|
1109
1116
|
})
|
|
1110
1117
|
]),
|
|
1111
1118
|
_: 1
|
|
1112
|
-
}, 8, ["onCommand"])) :
|
|
1119
|
+
}, 8, ["onCommand"])) : X("", !0)
|
|
1113
1120
|
]);
|
|
1114
1121
|
}
|
|
1115
|
-
const
|
|
1122
|
+
const Kt = /* @__PURE__ */ q(Wt, [["render", Jt], ["__scopeId", "data-v-6d75a891"]]), Qt = y({
|
|
1116
1123
|
name: "ZxtGrid",
|
|
1117
1124
|
inheritAttrs: !1,
|
|
1118
1125
|
components: {
|
|
1119
|
-
ZxtTable:
|
|
1120
|
-
ZxtForm:
|
|
1121
|
-
ActionColumn:
|
|
1122
|
-
Plus:
|
|
1123
|
-
Delete:
|
|
1124
|
-
Refresh:
|
|
1125
|
-
Download:
|
|
1126
|
-
Search:
|
|
1127
|
-
Edit:
|
|
1128
|
-
View:
|
|
1129
|
-
Upload:
|
|
1130
|
-
Setting:
|
|
1126
|
+
ZxtTable: O,
|
|
1127
|
+
ZxtForm: Fe,
|
|
1128
|
+
ActionColumn: Kt,
|
|
1129
|
+
Plus: $e,
|
|
1130
|
+
Delete: ze,
|
|
1131
|
+
Refresh: le,
|
|
1132
|
+
Download: Se,
|
|
1133
|
+
Search: se,
|
|
1134
|
+
Edit: ke,
|
|
1135
|
+
View: De,
|
|
1136
|
+
Upload: Pe,
|
|
1137
|
+
Setting: Ve
|
|
1131
1138
|
},
|
|
1132
1139
|
props: {
|
|
1133
1140
|
// 网格配置选项
|
|
@@ -1155,236 +1162,209 @@ const na = /* @__PURE__ */ U(ea, [["render", aa], ["__scopeId", "data-v-6d75a891
|
|
|
1155
1162
|
},
|
|
1156
1163
|
emits: ["toolbar-click", "action-click", "submit", "reset", "page-change", "size-change"],
|
|
1157
1164
|
setup(e, { emit: t, expose: a }) {
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1165
|
+
const l = Ue(), u = qe(), c = k(null), r = k(null), p = k(1), m = k(10), d = k(null), h = k(e.gridOptions.formMode !== !1), i = k({
|
|
1166
|
+
...e.gridOptions.formConfig?.data || {}
|
|
1167
|
+
}), _ = {
|
|
1168
|
+
Plus: $e,
|
|
1169
|
+
Delete: ze,
|
|
1170
|
+
Refresh: le,
|
|
1171
|
+
Download: Se,
|
|
1172
|
+
Search: se,
|
|
1173
|
+
Edit: ke,
|
|
1174
|
+
View: De,
|
|
1175
|
+
Upload: Pe,
|
|
1176
|
+
Setting: Ve
|
|
1177
|
+
}, o = C(() => {
|
|
1178
|
+
const f = (e.gridOptions.columns || []).find((A) => A.actionColumn);
|
|
1179
|
+
return f ? f.actionColumn : null;
|
|
1180
|
+
}), S = C(() => (e.gridOptions.columns || []).map((f) => f.actionColumn ? {
|
|
1181
|
+
...f,
|
|
1173
1182
|
slot: "__action__",
|
|
1174
1183
|
actionColumn: void 0
|
|
1175
|
-
} :
|
|
1184
|
+
} : f)), L = (n) => {
|
|
1176
1185
|
t("action-click", n);
|
|
1177
|
-
},
|
|
1186
|
+
}, W = C(() => {
|
|
1178
1187
|
const n = e.gridOptions.formConfig;
|
|
1179
1188
|
if (!n || !n.items) return [];
|
|
1180
|
-
const
|
|
1181
|
-
return
|
|
1182
|
-
(
|
|
1183
|
-
) ||
|
|
1189
|
+
const f = [...n.items];
|
|
1190
|
+
return f.some(
|
|
1191
|
+
(we) => we.type === "slot" && we.slotName === "search-actions"
|
|
1192
|
+
) || f.push({
|
|
1184
1193
|
type: "slot",
|
|
1185
1194
|
slotName: "search-actions",
|
|
1186
1195
|
span: 6,
|
|
1187
1196
|
labelWidth: "0px",
|
|
1188
1197
|
isAction: !0,
|
|
1189
1198
|
...n.actionConfig
|
|
1190
|
-
}),
|
|
1199
|
+
}), f;
|
|
1191
1200
|
}), x = C(() => {
|
|
1192
1201
|
const n = /* @__PURE__ */ new Set(["search-actions"]);
|
|
1193
|
-
return (
|
|
1194
|
-
|
|
1202
|
+
return (W.value || []).forEach((f) => {
|
|
1203
|
+
f.type === "slot" && n.add(f.slotName || f.prop);
|
|
1195
1204
|
}), n;
|
|
1196
|
-
}),
|
|
1205
|
+
}), I = C(() => {
|
|
1197
1206
|
const n = {};
|
|
1198
|
-
for (const
|
|
1199
|
-
|
|
1207
|
+
for (const f in u)
|
|
1208
|
+
f === "search-actions" || f === "toolbar" || (x.value.has(f) || f.startsWith("form-")) && (n[f] = u[f]);
|
|
1200
1209
|
return n;
|
|
1201
|
-
}),
|
|
1210
|
+
}), ue = C(() => {
|
|
1202
1211
|
const n = {};
|
|
1203
|
-
for (const
|
|
1204
|
-
|
|
1212
|
+
for (const f in u)
|
|
1213
|
+
f !== "toolbar" && !x.value.has(f) && !f.startsWith("form-") && (n[f] = u[f]);
|
|
1205
1214
|
return n;
|
|
1206
|
-
}),
|
|
1207
|
-
|
|
1208
|
-
},
|
|
1209
|
-
t("submit", n), e.gridOptions.proxyConfig && (
|
|
1210
|
-
},
|
|
1211
|
-
|
|
1212
|
-
},
|
|
1213
|
-
t("reset"), e.gridOptions.proxyConfig && (
|
|
1214
|
-
},
|
|
1215
|
+
}), T = () => {
|
|
1216
|
+
r.value?.submitForm();
|
|
1217
|
+
}, oe = (n) => {
|
|
1218
|
+
t("submit", n), e.gridOptions.proxyConfig && (i.value = { ...n }, p.value = 1, c.value?.reload?.({ formData: i.value, page: 1 }));
|
|
1219
|
+
}, de = () => {
|
|
1220
|
+
r.value?.resetForm();
|
|
1221
|
+
}, ce = () => {
|
|
1222
|
+
t("reset"), e.gridOptions.proxyConfig && (i.value = {}, p.value = 1, c.value?.reload?.({ formData: {}, page: 1 }));
|
|
1223
|
+
}, pe = (n) => {
|
|
1215
1224
|
if (n)
|
|
1216
|
-
return typeof n == "object" || typeof n == "function" ? n :
|
|
1217
|
-
},
|
|
1225
|
+
return typeof n == "object" || typeof n == "function" ? n : _[n];
|
|
1226
|
+
}, v = C(() => {
|
|
1218
1227
|
const n = e.gridOptions.proxyConfig;
|
|
1219
1228
|
return n ? {
|
|
1220
1229
|
...n,
|
|
1221
|
-
_formData:
|
|
1230
|
+
_formData: i.value
|
|
1222
1231
|
} : null;
|
|
1223
|
-
}),
|
|
1232
|
+
}), P = C(() => {
|
|
1224
1233
|
const {
|
|
1225
1234
|
formConfig: n,
|
|
1226
|
-
toolbar:
|
|
1227
|
-
formMode:
|
|
1228
|
-
formColumns:
|
|
1229
|
-
rules:
|
|
1230
|
-
data:
|
|
1231
|
-
proxyConfig:
|
|
1232
|
-
...
|
|
1235
|
+
toolbar: f,
|
|
1236
|
+
formMode: A,
|
|
1237
|
+
formColumns: we,
|
|
1238
|
+
rules: ra,
|
|
1239
|
+
data: la,
|
|
1240
|
+
proxyConfig: Be,
|
|
1241
|
+
...Le
|
|
1233
1242
|
} = e.gridOptions;
|
|
1234
1243
|
return {
|
|
1235
|
-
...
|
|
1236
|
-
proxyConfig:
|
|
1244
|
+
...Le,
|
|
1245
|
+
proxyConfig: v.value || Be || null
|
|
1237
1246
|
};
|
|
1238
|
-
}),
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
Ce();
|
|
1242
|
-
break;
|
|
1243
|
-
case "delete":
|
|
1244
|
-
we();
|
|
1245
|
-
break;
|
|
1246
|
-
case "refresh":
|
|
1247
|
-
I();
|
|
1248
|
-
break;
|
|
1249
|
-
case "export":
|
|
1250
|
-
R();
|
|
1251
|
-
break;
|
|
1252
|
-
}
|
|
1253
|
-
}, Ce = () => {
|
|
1254
|
-
h.value = !0;
|
|
1255
|
-
}, we = () => {
|
|
1256
|
-
const n = c.value?.getTableRef()?.getSelectionRows?.() || [];
|
|
1257
|
-
if (n.length === 0) {
|
|
1258
|
-
ue.warning("请先选择要删除的数据");
|
|
1259
|
-
return;
|
|
1260
|
-
}
|
|
1261
|
-
ue.success(`删除 ${n.length} 条数据`);
|
|
1262
|
-
}, I = () => {
|
|
1263
|
-
ue.success("刷新数据"), c.value?.reload?.();
|
|
1264
|
-
}, R = () => {
|
|
1265
|
-
ue.success("导出数据");
|
|
1266
|
-
}, ee = (n) => {
|
|
1267
|
-
t("submit", n);
|
|
1268
|
-
}, be = () => {
|
|
1269
|
-
t("reset");
|
|
1270
|
-
}, ye = () => {
|
|
1271
|
-
h.value = !1;
|
|
1272
|
-
}, se = (n) => {
|
|
1247
|
+
}), H = C(() => d.value !== null ? d.value : e.externalData.length > 0 ? e.externalData : e.gridOptions.data || []), E = C(() => !!e.gridOptions.proxyConfig), fe = C(() => E.value ? 0 : H.value.length), ge = (n, f) => {
|
|
1248
|
+
t("toolbar-click", { code: n, button: f, grid: c.value });
|
|
1249
|
+
}, me = (n) => {
|
|
1273
1250
|
p.value = n.page, t("page-change", n);
|
|
1274
|
-
},
|
|
1275
|
-
|
|
1276
|
-
},
|
|
1251
|
+
}, he = (n) => {
|
|
1252
|
+
m.value = n.size, t("size-change", n);
|
|
1253
|
+
}, ve = () => c.value, N = () => r.value, F = () => c.value?.getTableRef()?.getSelectionRows?.() || [], Y = (n) => {
|
|
1277
1254
|
d.value = n ?? null;
|
|
1278
|
-
},
|
|
1255
|
+
}, _e = (n) => {
|
|
1279
1256
|
h.value = n;
|
|
1280
|
-
},
|
|
1281
|
-
const
|
|
1257
|
+
}, Ce = (n, f = !0) => {
|
|
1258
|
+
const A = e.gridOptions.formConfig;
|
|
1259
|
+
A?.data && Object.assign(A.data, n), i.value = { ...A?.data || {}, ...n }, f && e.gridOptions.proxyConfig && (p.value = 1, c.value?.reload?.({ formData: i.value, page: 1 }));
|
|
1260
|
+
}, re = (n, ...f) => {
|
|
1261
|
+
const A = i.value;
|
|
1282
1262
|
switch (n) {
|
|
1283
1263
|
case "query":
|
|
1284
|
-
p.value = 1, c.value?.reload?.({ formData:
|
|
1264
|
+
p.value = 1, c.value?.reload?.({ formData: A, page: 1 });
|
|
1285
1265
|
break;
|
|
1286
1266
|
case "reload":
|
|
1287
|
-
c.value?.reload?.({ formData:
|
|
1267
|
+
c.value?.reload?.({ formData: A });
|
|
1288
1268
|
break;
|
|
1289
1269
|
default:
|
|
1290
1270
|
console.warn(`[ZxtGrid] commitProxy: unknown type "${n}"`);
|
|
1291
1271
|
}
|
|
1292
1272
|
};
|
|
1293
|
-
|
|
1273
|
+
K(
|
|
1294
1274
|
() => e.gridOptions.formMode,
|
|
1295
1275
|
(n) => {
|
|
1296
1276
|
n !== void 0 && (h.value = n);
|
|
1297
1277
|
}
|
|
1298
|
-
)
|
|
1299
|
-
|
|
1278
|
+
), Oe(() => {
|
|
1279
|
+
e.gridOptions.proxyConfig && e.gridOptions.autoLoad !== !1 && c.value?.reload?.({ formData: i.value, page: 1 });
|
|
1280
|
+
});
|
|
1281
|
+
const V = () => c.value?.getTableRef?.();
|
|
1300
1282
|
return a({
|
|
1301
|
-
getGridRef:
|
|
1302
|
-
getFormRef:
|
|
1303
|
-
getElTableRef:
|
|
1304
|
-
getSelectedRows:
|
|
1305
|
-
reloadData:
|
|
1306
|
-
setFormVisible:
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1283
|
+
getGridRef: ve,
|
|
1284
|
+
getFormRef: N,
|
|
1285
|
+
getElTableRef: V,
|
|
1286
|
+
getSelectedRows: F,
|
|
1287
|
+
reloadData: Y,
|
|
1288
|
+
setFormVisible: _e,
|
|
1289
|
+
setFormData: Ce,
|
|
1290
|
+
commitProxy: re,
|
|
1291
|
+
clearSelection: () => V()?.clearSelection(),
|
|
1292
|
+
toggleRowSelection: (...n) => V()?.toggleRowSelection(...n),
|
|
1293
|
+
toggleAllSelection: () => V()?.toggleAllSelection(),
|
|
1294
|
+
toggleRowExpansion: (...n) => V()?.toggleRowExpansion(...n),
|
|
1295
|
+
setCurrentRow: (...n) => V()?.setCurrentRow(...n),
|
|
1296
|
+
clearSort: () => V()?.clearSort(),
|
|
1297
|
+
clearFilter: (...n) => V()?.clearFilter(...n),
|
|
1298
|
+
doLayout: () => V()?.doLayout(),
|
|
1299
|
+
sort: (...n) => V()?.sort(...n)
|
|
1317
1300
|
}), {
|
|
1318
|
-
attrs:
|
|
1301
|
+
attrs: l,
|
|
1319
1302
|
gridRef: c,
|
|
1320
|
-
searchFormRef:
|
|
1303
|
+
searchFormRef: r,
|
|
1321
1304
|
currentPage: p,
|
|
1322
|
-
pageSize:
|
|
1323
|
-
tableData:
|
|
1324
|
-
tableProps:
|
|
1305
|
+
pageSize: m,
|
|
1306
|
+
tableData: H,
|
|
1307
|
+
tableProps: P,
|
|
1325
1308
|
mergedColumns: S,
|
|
1326
|
-
actionColumnConfig:
|
|
1327
|
-
total:
|
|
1309
|
+
actionColumnConfig: o,
|
|
1310
|
+
total: fe,
|
|
1328
1311
|
isFormVisible: h,
|
|
1329
|
-
searchFormColumns:
|
|
1330
|
-
formFilteredSlots:
|
|
1331
|
-
tableFilteredSlots:
|
|
1332
|
-
getIconComponent:
|
|
1333
|
-
handleToolbarClick:
|
|
1334
|
-
handleActionClick:
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
handleSearchReset: me,
|
|
1344
|
-
Search: ce,
|
|
1345
|
-
Refresh: de
|
|
1312
|
+
searchFormColumns: W,
|
|
1313
|
+
formFilteredSlots: I,
|
|
1314
|
+
tableFilteredSlots: ue,
|
|
1315
|
+
getIconComponent: pe,
|
|
1316
|
+
handleToolbarClick: ge,
|
|
1317
|
+
handleActionClick: L,
|
|
1318
|
+
handlePageChange: me,
|
|
1319
|
+
handleSizeChange: he,
|
|
1320
|
+
handleSearch: T,
|
|
1321
|
+
handleSearchSubmit: oe,
|
|
1322
|
+
handleReset: de,
|
|
1323
|
+
handleSearchReset: ce,
|
|
1324
|
+
Search: se,
|
|
1325
|
+
Refresh: le
|
|
1346
1326
|
};
|
|
1347
1327
|
}
|
|
1348
|
-
}),
|
|
1328
|
+
}), Xt = {
|
|
1349
1329
|
key: 0,
|
|
1350
1330
|
class: "grid-search-form"
|
|
1351
|
-
},
|
|
1331
|
+
}, Yt = { class: "search-btn-group" }, ea = { class: "grid-table-wrapper" }, ta = {
|
|
1352
1332
|
key: 0,
|
|
1353
1333
|
class: "grid-toolbar"
|
|
1354
1334
|
};
|
|
1355
|
-
function
|
|
1356
|
-
const
|
|
1357
|
-
return s(),
|
|
1358
|
-
class:
|
|
1335
|
+
function aa(e, t, a, l, u, c) {
|
|
1336
|
+
const r = z("el-button"), p = z("ZxtForm"), m = z("ActionColumn"), d = z("ZxtTable");
|
|
1337
|
+
return s(), g("div", {
|
|
1338
|
+
class: ie(["zxt-grid-container", { "zxt-grid-container--full": e.gridOptions.height === "full" }])
|
|
1359
1339
|
}, [
|
|
1360
|
-
e.gridOptions.formConfig && e.isFormVisible ? (s(),
|
|
1361
|
-
|
|
1340
|
+
e.gridOptions.formConfig && e.isFormVisible ? (s(), g("div", Xt, [
|
|
1341
|
+
D(p, {
|
|
1362
1342
|
ref: "searchFormRef",
|
|
1363
1343
|
"form-columns": e.searchFormColumns,
|
|
1364
1344
|
"initial-form-data": e.gridOptions.formConfig.data,
|
|
1365
1345
|
rules: e.gridOptions.formConfig.rules,
|
|
1366
1346
|
onSubmit: e.handleSearchSubmit,
|
|
1367
1347
|
onReset: e.handleSearchReset
|
|
1368
|
-
},
|
|
1369
|
-
"search-actions":
|
|
1370
|
-
w("div",
|
|
1371
|
-
|
|
1348
|
+
}, ne({
|
|
1349
|
+
"search-actions": b(() => [
|
|
1350
|
+
w("div", Yt, [
|
|
1351
|
+
D(r, {
|
|
1372
1352
|
class: "btn-search",
|
|
1373
1353
|
icon: e.Search,
|
|
1374
1354
|
onClick: e.handleSearch
|
|
1375
1355
|
}, {
|
|
1376
|
-
default:
|
|
1377
|
-
|
|
1356
|
+
default: b(() => [...t[0] || (t[0] = [
|
|
1357
|
+
j(" 查询 ", -1)
|
|
1378
1358
|
])]),
|
|
1379
1359
|
_: 1
|
|
1380
1360
|
}, 8, ["icon", "onClick"]),
|
|
1381
|
-
|
|
1361
|
+
D(r, {
|
|
1382
1362
|
class: "btn-reset",
|
|
1383
1363
|
icon: e.Refresh,
|
|
1384
1364
|
onClick: e.handleReset
|
|
1385
1365
|
}, {
|
|
1386
|
-
default:
|
|
1387
|
-
|
|
1366
|
+
default: b(() => [...t[1] || (t[1] = [
|
|
1367
|
+
j(" 重置 ", -1)
|
|
1388
1368
|
])]),
|
|
1389
1369
|
_: 1
|
|
1390
1370
|
}, 8, ["icon", "onClick"])
|
|
@@ -1392,38 +1372,39 @@ function ua(e, t, a, r, i, c) {
|
|
|
1392
1372
|
]),
|
|
1393
1373
|
_: 2
|
|
1394
1374
|
}, [
|
|
1395
|
-
|
|
1396
|
-
name:
|
|
1397
|
-
fn:
|
|
1398
|
-
|
|
1375
|
+
R(e.formFilteredSlots, (h, i) => ({
|
|
1376
|
+
name: i,
|
|
1377
|
+
fn: b((_) => [
|
|
1378
|
+
Z(e.$slots, i, Re(Ae(_)), void 0, !0)
|
|
1399
1379
|
])
|
|
1400
1380
|
}))
|
|
1401
1381
|
]), 1032, ["form-columns", "initial-form-data", "rules", "onSubmit", "onReset"])
|
|
1402
|
-
])) :
|
|
1403
|
-
w("div",
|
|
1404
|
-
e.gridOptions.toolbar ? (s(),
|
|
1405
|
-
(s(!0),
|
|
1406
|
-
key:
|
|
1382
|
+
])) : X("", !0),
|
|
1383
|
+
w("div", ea, [
|
|
1384
|
+
e.gridOptions.toolbar ? (s(), g("div", ta, [
|
|
1385
|
+
(s(!0), g(B, null, R(e.gridOptions.toolbar.buttons, (h, i) => (s(), $(r, {
|
|
1386
|
+
key: i,
|
|
1407
1387
|
type: h.type || "default",
|
|
1408
1388
|
size: h.size || "small",
|
|
1409
1389
|
icon: e.getIconComponent(h.icon),
|
|
1410
1390
|
disabled: h.disabled,
|
|
1411
|
-
onClick: (
|
|
1391
|
+
onClick: (_) => e.handleToolbarClick(h.code, h)
|
|
1412
1392
|
}, {
|
|
1413
|
-
default:
|
|
1414
|
-
|
|
1393
|
+
default: b(() => [
|
|
1394
|
+
j(Q(h.name), 1)
|
|
1415
1395
|
]),
|
|
1416
1396
|
_: 2
|
|
1417
1397
|
}, 1032, ["type", "size", "icon", "disabled", "onClick"]))), 128)),
|
|
1418
|
-
|
|
1398
|
+
Z(e.$slots, "toolbar", {
|
|
1419
1399
|
grid: e.$refs.gridRef
|
|
1420
1400
|
}, void 0, !0)
|
|
1421
|
-
])) :
|
|
1422
|
-
|
|
1401
|
+
])) : X("", !0),
|
|
1402
|
+
D(d, M({ ref: "gridRef" }, { ...e.tableProps, ...e.attrs }, {
|
|
1423
1403
|
id: e.gridOptions.id,
|
|
1424
1404
|
columns: e.mergedColumns,
|
|
1425
1405
|
data: e.tableData,
|
|
1426
1406
|
height: e.gridOptions.height,
|
|
1407
|
+
"auto-load": !1,
|
|
1427
1408
|
pageable: e.gridOptions.pageable !== !1,
|
|
1428
1409
|
"current-page": e.currentPage,
|
|
1429
1410
|
"page-size": e.pageSize,
|
|
@@ -1432,11 +1413,11 @@ function ua(e, t, a, r, i, c) {
|
|
|
1432
1413
|
"pagination-layout": e.gridOptions.paginationLayout,
|
|
1433
1414
|
onPageChange: e.handlePageChange,
|
|
1434
1415
|
onSizeChange: e.handleSizeChange
|
|
1435
|
-
}),
|
|
1416
|
+
}), ne({ _: 2 }, [
|
|
1436
1417
|
e.actionColumnConfig ? {
|
|
1437
1418
|
name: "__action__",
|
|
1438
|
-
fn:
|
|
1439
|
-
|
|
1419
|
+
fn: b(({ row: h }) => [
|
|
1420
|
+
D(m, {
|
|
1440
1421
|
buttons: e.actionColumnConfig.buttons,
|
|
1441
1422
|
row: h,
|
|
1442
1423
|
"max-visible": e.actionColumnConfig.maxVisible || 2,
|
|
@@ -1445,49 +1426,49 @@ function ua(e, t, a, r, i, c) {
|
|
|
1445
1426
|
]),
|
|
1446
1427
|
key: "0"
|
|
1447
1428
|
} : void 0,
|
|
1448
|
-
|
|
1449
|
-
name:
|
|
1450
|
-
fn:
|
|
1451
|
-
|
|
1429
|
+
R(e.tableFilteredSlots, (h, i) => ({
|
|
1430
|
+
name: i,
|
|
1431
|
+
fn: b((_) => [
|
|
1432
|
+
Z(e.$slots, i, Re(Ae(_)), void 0, !0)
|
|
1452
1433
|
])
|
|
1453
1434
|
}))
|
|
1454
1435
|
]), 1040, ["id", "columns", "data", "height", "pageable", "current-page", "page-size", "page-sizes", "total", "pagination-layout", "onPageChange", "onSizeChange"])
|
|
1455
1436
|
])
|
|
1456
1437
|
], 2);
|
|
1457
1438
|
}
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1460
|
-
e.component(
|
|
1439
|
+
const Me = /* @__PURE__ */ q(Qt, [["render", aa], ["__scopeId", "data-v-f8b2d913"]]);
|
|
1440
|
+
J.install = function(e) {
|
|
1441
|
+
e.component(J.name, J);
|
|
1461
1442
|
};
|
|
1462
|
-
const
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
],
|
|
1470
|
-
|
|
1443
|
+
const na = [
|
|
1444
|
+
ee,
|
|
1445
|
+
te,
|
|
1446
|
+
O,
|
|
1447
|
+
Me,
|
|
1448
|
+
Fe,
|
|
1449
|
+
J
|
|
1450
|
+
], oa = (e) => {
|
|
1451
|
+
na.forEach((t) => {
|
|
1471
1452
|
e.component(t.name, t);
|
|
1472
1453
|
});
|
|
1473
|
-
},
|
|
1474
|
-
install:
|
|
1475
|
-
MyButton:
|
|
1476
|
-
JsxButton:
|
|
1477
|
-
ZxtTable:
|
|
1478
|
-
ZxtGrid:
|
|
1479
|
-
ZxtForm:
|
|
1480
|
-
ZxtPagination:
|
|
1454
|
+
}, ua = {
|
|
1455
|
+
install: oa,
|
|
1456
|
+
MyButton: ee,
|
|
1457
|
+
JsxButton: te,
|
|
1458
|
+
ZxtTable: O,
|
|
1459
|
+
ZxtGrid: Me,
|
|
1460
|
+
ZxtForm: Fe,
|
|
1461
|
+
ZxtPagination: J,
|
|
1481
1462
|
// 暴露渲染器 API
|
|
1482
|
-
renderer:
|
|
1483
|
-
registerRenderer:
|
|
1463
|
+
renderer: O.renderer,
|
|
1464
|
+
registerRenderer: O.registerRenderer
|
|
1484
1465
|
};
|
|
1485
1466
|
export {
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1467
|
+
te as JsxButton,
|
|
1468
|
+
ee as MyButton,
|
|
1469
|
+
Fe as ZxtForm,
|
|
1470
|
+
Me as ZxtGrid,
|
|
1471
|
+
J as ZxtPagination,
|
|
1472
|
+
O as ZxtTable,
|
|
1473
|
+
ua as default
|
|
1493
1474
|
};
|