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