zxt-table 0.5.3 → 0.5.6
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.es.js +210 -204
- package/dist/zxt-table.umd.js +1 -1
- package/package.json +1 -1
package/dist/zxt-table.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElementBlock as g, openBlock as s, normalizeClass as ie, renderSlot as
|
|
1
|
+
import { createElementBlock as g, openBlock as s, normalizeClass as ie, renderSlot as B, defineComponent as b, createVNode as D, ref as k, watch as K, resolveComponent as z, createBlock as $, h as G, inject as Te, computed as _, mergeProps as O, withCtx as y, Fragment as L, 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
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
3
|
const q = (e, t) => {
|
|
4
4
|
const a = e.__vccOpts || e;
|
|
@@ -33,14 +33,14 @@ function nt(e, t, a, l, u, c) {
|
|
|
33
33
|
disabled: a.disabled,
|
|
34
34
|
onClick: t[0] || (t[0] = (...r) => l.handleClick && l.handleClick(...r))
|
|
35
35
|
}, [
|
|
36
|
-
|
|
36
|
+
B(e.$slots, "default", {}, void 0, !0)
|
|
37
37
|
], 10, at);
|
|
38
38
|
}
|
|
39
39
|
const ee = /* @__PURE__ */ q(tt, [["render", nt], ["__scopeId", "data-v-4480e77d"]]);
|
|
40
40
|
ee.install = function(e) {
|
|
41
41
|
e.component(ee.name, ee);
|
|
42
42
|
};
|
|
43
|
-
const te = /* @__PURE__ */
|
|
43
|
+
const te = /* @__PURE__ */ b({
|
|
44
44
|
name: "JsxButton",
|
|
45
45
|
props: {
|
|
46
46
|
type: {
|
|
@@ -73,7 +73,7 @@ const te = /* @__PURE__ */ y({
|
|
|
73
73
|
te.install = function(e) {
|
|
74
74
|
e.component(te.name, te);
|
|
75
75
|
};
|
|
76
|
-
const ot =
|
|
76
|
+
const ot = b({
|
|
77
77
|
name: "ZxtPagination",
|
|
78
78
|
components: { ElPagination: We },
|
|
79
79
|
props: {
|
|
@@ -177,7 +177,7 @@ function lt(e, t) {
|
|
|
177
177
|
function st(e, t) {
|
|
178
178
|
ae[e] && console.warn(`[ZxtTable] 内置渲染器 ${e} 已被覆盖`), ae[e] = t;
|
|
179
179
|
}
|
|
180
|
-
const it =
|
|
180
|
+
const it = b({
|
|
181
181
|
name: "ZxtTableColumn",
|
|
182
182
|
components: { ElTableColumn: Ye },
|
|
183
183
|
props: {
|
|
@@ -197,9 +197,9 @@ const it = y({
|
|
|
197
197
|
setup(e) {
|
|
198
198
|
const t = Te("updateRow", () => {
|
|
199
199
|
}), a = (r) => {
|
|
200
|
-
const { currentPage: p, pageSize:
|
|
201
|
-
return (p - 1) *
|
|
202
|
-
}, l =
|
|
200
|
+
const { currentPage: p, pageSize: f } = e;
|
|
201
|
+
return (p - 1) * f + r + 1;
|
|
202
|
+
}, l = _(() => {
|
|
203
203
|
const r = e.column;
|
|
204
204
|
return {
|
|
205
205
|
...r,
|
|
@@ -208,7 +208,7 @@ const it = y({
|
|
|
208
208
|
label: r.label ?? r.title
|
|
209
209
|
// 优先使用 label,兼容 title
|
|
210
210
|
};
|
|
211
|
-
}), u =
|
|
211
|
+
}), u = _(() => {
|
|
212
212
|
const { children: r, ...p } = l.value;
|
|
213
213
|
return p;
|
|
214
214
|
});
|
|
@@ -216,7 +216,7 @@ const it = y({
|
|
|
216
216
|
normalizedColumn: l,
|
|
217
217
|
columnProps: u,
|
|
218
218
|
renderCell: (r) => {
|
|
219
|
-
const p = l.value,
|
|
219
|
+
const p = l.value, f = r.row[p.prop], d = f ?? p.defaultValue ?? "";
|
|
220
220
|
return lt(p.cellRender, {
|
|
221
221
|
row: r.row,
|
|
222
222
|
column: p,
|
|
@@ -231,53 +231,60 @@ const it = y({
|
|
|
231
231
|
});
|
|
232
232
|
function ut(e, t, a, l, u, c) {
|
|
233
233
|
const r = z("ZxtTableColumn", !0), p = z("el-table-column");
|
|
234
|
-
return e.normalizedColumn.children && e.normalizedColumn.children.length ? (s(), $(p,
|
|
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), g(
|
|
237
|
+
default: y(() => [
|
|
238
|
+
(s(!0), g(L, null, R(e.normalizedColumn.children, (f, d) => (s(), $(r, {
|
|
239
239
|
key: d,
|
|
240
|
-
column:
|
|
240
|
+
column: f,
|
|
241
241
|
"current-page": e.currentPage,
|
|
242
242
|
"page-size": e.pageSize
|
|
243
243
|
}, ne({ _: 2 }, [
|
|
244
244
|
R(e.$slots, (h, i) => ({
|
|
245
245
|
name: i,
|
|
246
|
-
fn:
|
|
247
|
-
|
|
246
|
+
fn: y((C) => [
|
|
247
|
+
B(e.$slots, i, O({ ref_for: !0 }, C))
|
|
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
|
+
e.normalizedColumn.headerSlot ? {
|
|
258
|
+
name: "header",
|
|
259
|
+
fn: y((f) => [
|
|
260
|
+
B(e.$slots, e.normalizedColumn.headerSlot, O({ column: e.normalizedColumn }, f))
|
|
261
|
+
]),
|
|
262
|
+
key: "0"
|
|
263
|
+
} : void 0,
|
|
257
264
|
!["selection", "index"].includes(e.normalizedColumn.type) && (e.normalizedColumn.type !== "expand" || e.normalizedColumn.slot) ? {
|
|
258
265
|
name: "default",
|
|
259
|
-
fn:
|
|
260
|
-
e.normalizedColumn.slot ?
|
|
266
|
+
fn: y((f) => [
|
|
267
|
+
e.normalizedColumn.slot ? B(e.$slots, e.normalizedColumn.slot, {
|
|
261
268
|
key: 0,
|
|
262
|
-
row:
|
|
263
|
-
index:
|
|
269
|
+
row: f.row,
|
|
270
|
+
index: f.$index,
|
|
264
271
|
column: e.normalizedColumn
|
|
265
|
-
}) : e.normalizedColumn.cellRender ? (s(), $(ye(e.renderCell(
|
|
272
|
+
}) : e.normalizedColumn.cellRender ? (s(), $(ye(e.renderCell(f)), { key: 1 })) : e.normalizedColumn.formatter ? (s(), g(L, { key: 2 }, [
|
|
266
273
|
j(Q(e.normalizedColumn.formatter(
|
|
267
|
-
|
|
274
|
+
f.row,
|
|
268
275
|
e.normalizedColumn,
|
|
269
|
-
|
|
270
|
-
|
|
276
|
+
f.row[e.normalizedColumn.prop],
|
|
277
|
+
f.$index
|
|
271
278
|
)), 1)
|
|
272
|
-
], 64)) : (s(), g(
|
|
273
|
-
j(Q(
|
|
279
|
+
], 64)) : (s(), g(L, { key: 3 }, [
|
|
280
|
+
j(Q(f.row[e.normalizedColumn.prop]), 1)
|
|
274
281
|
], 64))
|
|
275
282
|
]),
|
|
276
|
-
key: "
|
|
283
|
+
key: "1"
|
|
277
284
|
} : void 0
|
|
278
285
|
]), 1040, ["index"]));
|
|
279
286
|
}
|
|
280
|
-
const dt = /* @__PURE__ */ q(it, [["render", ut]]), ct =
|
|
287
|
+
const dt = /* @__PURE__ */ q(it, [["render", ut]]), ct = b({
|
|
281
288
|
name: "ZxtTable",
|
|
282
289
|
inheritAttrs: !1,
|
|
283
290
|
components: { ZxtPagination: J, ZxtTableColumn: dt, ElTable: et },
|
|
@@ -326,32 +333,32 @@ const dt = /* @__PURE__ */ q(it, [["render", ut]]), ct = y({
|
|
|
326
333
|
"update:row"
|
|
327
334
|
],
|
|
328
335
|
setup(e, { emit: t }) {
|
|
329
|
-
const a = k(null), l = k(e.pageSize), u = k(e.currentPage), c = k(!1), r = k([]), p = k(0),
|
|
336
|
+
const a = k(null), l = k(e.pageSize), u = k(e.currentPage), c = k(!1), r = k([]), p = k(0), f = k({ prop: "", order: "" }), d = k({}), h = k({});
|
|
330
337
|
K(() => e.currentPage, (v) => {
|
|
331
338
|
u.value = v;
|
|
332
339
|
}), K(() => e.pageSize, (v) => {
|
|
333
340
|
l.value = v;
|
|
334
341
|
});
|
|
335
|
-
const i =
|
|
342
|
+
const i = _(() => e.height === "full" ? { height: "100%" } : {}), C = _(() => {
|
|
336
343
|
if (e.height !== "full")
|
|
337
344
|
return e.height;
|
|
338
|
-
}), o =
|
|
345
|
+
}), o = _(() => !!e.proxyConfig), S = _(() => o.value ? p.value : e.total > 0 ? e.total : e.data.length), T = _(
|
|
339
346
|
() => o.value ? r.value : e.data
|
|
340
347
|
), W = (v) => {
|
|
341
|
-
o.value && (u.value = v.page, l.value = v.size,
|
|
348
|
+
o.value && (u.value = v.page, l.value = v.size, H()), t("size-change", v);
|
|
342
349
|
}, x = (v) => {
|
|
343
|
-
o.value && (u.value = v.page, l.value = v.size,
|
|
344
|
-
}, I = ({ column: v, prop: P, order:
|
|
345
|
-
|
|
350
|
+
o.value && (u.value = v.page, l.value = v.size, H()), t("page-change", v);
|
|
351
|
+
}, I = ({ column: v, prop: P, order: Z }) => {
|
|
352
|
+
f.value = { prop: P, order: Z }, o.value && H(), t("sort-change", { column: v, prop: P, order: Z });
|
|
346
353
|
}, ue = (v) => {
|
|
347
|
-
d.value = v || {}, o.value &&
|
|
348
|
-
},
|
|
354
|
+
d.value = v || {}, o.value && H(), t("filter-change", d.value);
|
|
355
|
+
}, H = async (v) => {
|
|
349
356
|
if (!o.value) return;
|
|
350
|
-
const P = e.proxyConfig || {},
|
|
351
|
-
if (typeof
|
|
357
|
+
const P = e.proxyConfig || {}, Z = P.ajax?.query;
|
|
358
|
+
if (typeof Z != "function") return;
|
|
352
359
|
const E = P.props || {}, fe = E.pageField || "page";
|
|
353
360
|
E.sizeField;
|
|
354
|
-
const
|
|
361
|
+
const me = E.sortField || "sort", ge = E.orderField || "order", he = E.filtersField || "filters";
|
|
355
362
|
v?.formData !== void 0 ? h.value = v.formData : P._formData && (h.value = P._formData);
|
|
356
363
|
const ve = P.params || {}, N = {
|
|
357
364
|
[fe]: {
|
|
@@ -361,14 +368,14 @@ const dt = /* @__PURE__ */ q(it, [["render", ut]]), ct = y({
|
|
|
361
368
|
form: h.value,
|
|
362
369
|
...ve
|
|
363
370
|
};
|
|
364
|
-
|
|
371
|
+
f.value?.prop && (N[me] = f.value.prop, N[ge] = f.value.order), d.value && Object.keys(d.value).length && (N[he] = d.value), c.value = !0;
|
|
365
372
|
try {
|
|
366
|
-
const F = await
|
|
373
|
+
const F = await Z(N), Y = P.response || {}, Ce = Y.listField || "list", _e = Y.totalField || "total", re = Y.transform;
|
|
367
374
|
let V = [], n = 0;
|
|
368
375
|
if (typeof re == "function") {
|
|
369
|
-
const
|
|
370
|
-
V =
|
|
371
|
-
} else F && typeof F == "object" && (V = F?.[
|
|
376
|
+
const m = re(F);
|
|
377
|
+
V = m?.list ?? [], n = m?.total ?? 0;
|
|
378
|
+
} else F && typeof F == "object" && (V = F?.[Ce] ?? F?.data ?? [], n = F?.[_e] ?? F?.total ?? 0);
|
|
372
379
|
r.value = Array.isArray(V) ? V : [], p.value = Number(n) || 0, t("loaded", {
|
|
373
380
|
data: r.value,
|
|
374
381
|
total: p.value,
|
|
@@ -383,21 +390,21 @@ const dt = /* @__PURE__ */ q(it, [["render", ut]]), ct = y({
|
|
|
383
390
|
o.value ? r.value.splice(P, 1, v) : t("update:row", { index: P, row: v });
|
|
384
391
|
};
|
|
385
392
|
He("updateRow", oe), Oe(() => {
|
|
386
|
-
o.value && e.autoLoad &&
|
|
393
|
+
o.value && e.autoLoad && H();
|
|
387
394
|
});
|
|
388
|
-
const de = () => a.value, ce = () => a.value?.getSelectionRows?.() || [], pe = (v) =>
|
|
395
|
+
const de = () => a.value, ce = () => a.value?.getSelectionRows?.() || [], pe = (v) => H(v);
|
|
389
396
|
return {
|
|
390
397
|
tableRef: a,
|
|
391
398
|
containerStyle: i,
|
|
392
|
-
tableHeight:
|
|
399
|
+
tableHeight: C,
|
|
393
400
|
getTableRef: de,
|
|
394
401
|
pageSize: l,
|
|
395
402
|
currentPage: u,
|
|
396
403
|
loading: c,
|
|
397
|
-
renderData:
|
|
404
|
+
renderData: T,
|
|
398
405
|
total: S,
|
|
399
|
-
pageSizes:
|
|
400
|
-
paginationLayout:
|
|
406
|
+
pageSizes: _(() => e.pageSizes),
|
|
407
|
+
paginationLayout: _(() => e.paginationLayout),
|
|
401
408
|
handleSizeChange: W,
|
|
402
409
|
handlePageChange: x,
|
|
403
410
|
handleSortChange: I,
|
|
@@ -409,12 +416,12 @@ const dt = /* @__PURE__ */ q(it, [["render", ut]]), ct = y({
|
|
|
409
416
|
}
|
|
410
417
|
});
|
|
411
418
|
function pt(e, t, a, l, u, c) {
|
|
412
|
-
const r = z("ZxtTableColumn"), p = z("el-table"),
|
|
419
|
+
const r = z("ZxtTableColumn"), p = z("el-table"), f = z("ZxtPagination"), d = Ze("loading");
|
|
413
420
|
return s(), g("div", {
|
|
414
421
|
class: ie(["zxt-table-container", { "zxt-table-container--full": e.height === "full" }]),
|
|
415
422
|
style: je(e.containerStyle)
|
|
416
423
|
}, [
|
|
417
|
-
Ie((s(), $(p,
|
|
424
|
+
Ie((s(), $(p, O({
|
|
418
425
|
ref: "tableRef",
|
|
419
426
|
data: e.renderData,
|
|
420
427
|
height: e.tableHeight
|
|
@@ -423,17 +430,17 @@ function pt(e, t, a, l, u, c) {
|
|
|
423
430
|
onSortChange: e.handleSortChange,
|
|
424
431
|
onFilterChange: e.handleFilterChange
|
|
425
432
|
}), {
|
|
426
|
-
default:
|
|
427
|
-
(s(!0), g(
|
|
433
|
+
default: y(() => [
|
|
434
|
+
(s(!0), g(L, null, R(e.columns, (h, i) => (s(), $(r, {
|
|
428
435
|
key: i,
|
|
429
436
|
column: h,
|
|
430
437
|
"current-page": e.currentPage,
|
|
431
438
|
"page-size": e.pageSize
|
|
432
439
|
}, ne({ _: 2 }, [
|
|
433
|
-
R(e.$slots, (
|
|
440
|
+
R(e.$slots, (C, o) => ({
|
|
434
441
|
name: o,
|
|
435
|
-
fn:
|
|
436
|
-
|
|
442
|
+
fn: y((S) => [
|
|
443
|
+
B(e.$slots, o, O({ ref_for: !0 }, S), void 0, !0)
|
|
437
444
|
])
|
|
438
445
|
}))
|
|
439
446
|
]), 1032, ["column", "current-page", "page-size"]))), 128))
|
|
@@ -442,7 +449,7 @@ function pt(e, t, a, l, u, c) {
|
|
|
442
449
|
}, 16, ["data", "height", "id", "onSortChange", "onFilterChange"])), [
|
|
443
450
|
[d, e.loading]
|
|
444
451
|
]),
|
|
445
|
-
e.pageable ? (s(), $(
|
|
452
|
+
e.pageable ? (s(), $(f, {
|
|
446
453
|
key: 0,
|
|
447
454
|
"model-value": e.currentPage,
|
|
448
455
|
"page-size": e.pageSize,
|
|
@@ -455,7 +462,7 @@ function pt(e, t, a, l, u, c) {
|
|
|
455
462
|
}, null, 8, ["model-value", "page-size", "page-sizes", "total", "layout", "onPageChange", "onSizeChange"])) : X("", !0)
|
|
456
463
|
], 6);
|
|
457
464
|
}
|
|
458
|
-
const
|
|
465
|
+
const M = /* @__PURE__ */ q(ct, [["render", pt], ["__scopeId", "data-v-ebf6786f"]]), U = /* @__PURE__ */ new Map();
|
|
459
466
|
class ft {
|
|
460
467
|
/**
|
|
461
468
|
* 注册自定义渲染器
|
|
@@ -510,7 +517,7 @@ class ft {
|
|
|
510
517
|
}
|
|
511
518
|
}
|
|
512
519
|
const be = new ft();
|
|
513
|
-
function
|
|
520
|
+
function mt(e, t, a = {}) {
|
|
514
521
|
if (!e || !e.itemRender)
|
|
515
522
|
return null;
|
|
516
523
|
const { name: l } = e.itemRender;
|
|
@@ -532,13 +539,12 @@ function gt(e, t, a = {}) {
|
|
|
532
539
|
}
|
|
533
540
|
return null;
|
|
534
541
|
}
|
|
535
|
-
|
|
536
|
-
e.component(
|
|
542
|
+
M.install = function(e) {
|
|
543
|
+
e.component(M.name, M);
|
|
537
544
|
};
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
var mt = /* @__PURE__ */ y({
|
|
545
|
+
M.registerRenderer = st;
|
|
546
|
+
M.renderer = be;
|
|
547
|
+
var gt = /* @__PURE__ */ b({
|
|
542
548
|
name: "ArrowDown",
|
|
543
549
|
__name: "arrow-down",
|
|
544
550
|
setup(e) {
|
|
@@ -552,7 +558,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
552
558
|
})
|
|
553
559
|
]));
|
|
554
560
|
}
|
|
555
|
-
}),
|
|
561
|
+
}), Me = gt, ht = /* @__PURE__ */ b({
|
|
556
562
|
name: "Check",
|
|
557
563
|
__name: "check",
|
|
558
564
|
setup(e) {
|
|
@@ -566,7 +572,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
566
572
|
})
|
|
567
573
|
]));
|
|
568
574
|
}
|
|
569
|
-
}), vt = ht,
|
|
575
|
+
}), vt = ht, Ct = /* @__PURE__ */ b({
|
|
570
576
|
name: "Close",
|
|
571
577
|
__name: "close",
|
|
572
578
|
setup(e) {
|
|
@@ -580,7 +586,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
580
586
|
})
|
|
581
587
|
]));
|
|
582
588
|
}
|
|
583
|
-
}),
|
|
589
|
+
}), _t = Ct, wt = /* @__PURE__ */ b({
|
|
584
590
|
name: "CopyDocument",
|
|
585
591
|
__name: "copy-document",
|
|
586
592
|
setup(e) {
|
|
@@ -598,7 +604,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
598
604
|
})
|
|
599
605
|
]));
|
|
600
606
|
}
|
|
601
|
-
}), yt = wt, bt = /* @__PURE__ */
|
|
607
|
+
}), yt = wt, bt = /* @__PURE__ */ b({
|
|
602
608
|
name: "Delete",
|
|
603
609
|
__name: "delete",
|
|
604
610
|
setup(e) {
|
|
@@ -612,7 +618,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
612
618
|
})
|
|
613
619
|
]));
|
|
614
620
|
}
|
|
615
|
-
}), ze = bt, zt = /* @__PURE__ */
|
|
621
|
+
}), ze = bt, zt = /* @__PURE__ */ b({
|
|
616
622
|
name: "Document",
|
|
617
623
|
__name: "document",
|
|
618
624
|
setup(e) {
|
|
@@ -626,7 +632,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
626
632
|
})
|
|
627
633
|
]));
|
|
628
634
|
}
|
|
629
|
-
}), St = zt, kt = /* @__PURE__ */
|
|
635
|
+
}), St = zt, kt = /* @__PURE__ */ b({
|
|
630
636
|
name: "Download",
|
|
631
637
|
__name: "download",
|
|
632
638
|
setup(e) {
|
|
@@ -640,7 +646,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
640
646
|
})
|
|
641
647
|
]));
|
|
642
648
|
}
|
|
643
|
-
}), Se = kt, $t = /* @__PURE__ */
|
|
649
|
+
}), Se = kt, $t = /* @__PURE__ */ b({
|
|
644
650
|
name: "Edit",
|
|
645
651
|
__name: "edit",
|
|
646
652
|
setup(e) {
|
|
@@ -658,7 +664,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
658
664
|
})
|
|
659
665
|
]));
|
|
660
666
|
}
|
|
661
|
-
}), ke = $t, Vt = /* @__PURE__ */
|
|
667
|
+
}), ke = $t, Vt = /* @__PURE__ */ b({
|
|
662
668
|
name: "Lock",
|
|
663
669
|
__name: "lock",
|
|
664
670
|
setup(e) {
|
|
@@ -676,7 +682,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
676
682
|
})
|
|
677
683
|
]));
|
|
678
684
|
}
|
|
679
|
-
}), Pt = Vt, Dt = /* @__PURE__ */
|
|
685
|
+
}), Pt = Vt, Dt = /* @__PURE__ */ b({
|
|
680
686
|
name: "Plus",
|
|
681
687
|
__name: "plus",
|
|
682
688
|
setup(e) {
|
|
@@ -690,7 +696,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
690
696
|
})
|
|
691
697
|
]));
|
|
692
698
|
}
|
|
693
|
-
}), $e = Dt, Ft = /* @__PURE__ */
|
|
699
|
+
}), $e = Dt, Ft = /* @__PURE__ */ b({
|
|
694
700
|
name: "Refresh",
|
|
695
701
|
__name: "refresh",
|
|
696
702
|
setup(e) {
|
|
@@ -704,7 +710,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
704
710
|
})
|
|
705
711
|
]));
|
|
706
712
|
}
|
|
707
|
-
}), le = Ft, Rt = /* @__PURE__ */
|
|
713
|
+
}), le = Ft, Rt = /* @__PURE__ */ b({
|
|
708
714
|
name: "Search",
|
|
709
715
|
__name: "search",
|
|
710
716
|
setup(e) {
|
|
@@ -718,7 +724,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
718
724
|
})
|
|
719
725
|
]));
|
|
720
726
|
}
|
|
721
|
-
}), se = Rt, At = /* @__PURE__ */
|
|
727
|
+
}), se = Rt, At = /* @__PURE__ */ b({
|
|
722
728
|
name: "Setting",
|
|
723
729
|
__name: "setting",
|
|
724
730
|
setup(e) {
|
|
@@ -732,7 +738,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
732
738
|
})
|
|
733
739
|
]));
|
|
734
740
|
}
|
|
735
|
-
}), Ve = At, Ot = /* @__PURE__ */
|
|
741
|
+
}), Ve = At, Ot = /* @__PURE__ */ b({
|
|
736
742
|
name: "Share",
|
|
737
743
|
__name: "share",
|
|
738
744
|
setup(e) {
|
|
@@ -746,7 +752,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
746
752
|
})
|
|
747
753
|
]));
|
|
748
754
|
}
|
|
749
|
-
}),
|
|
755
|
+
}), Mt = Ot, xt = /* @__PURE__ */ b({
|
|
750
756
|
name: "Unlock",
|
|
751
757
|
__name: "unlock",
|
|
752
758
|
setup(e) {
|
|
@@ -764,7 +770,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
764
770
|
})
|
|
765
771
|
]));
|
|
766
772
|
}
|
|
767
|
-
}), Bt =
|
|
773
|
+
}), Bt = xt, Lt = /* @__PURE__ */ b({
|
|
768
774
|
name: "Upload",
|
|
769
775
|
__name: "upload",
|
|
770
776
|
setup(e) {
|
|
@@ -778,7 +784,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
778
784
|
})
|
|
779
785
|
]));
|
|
780
786
|
}
|
|
781
|
-
}), Pe = Lt, Tt = /* @__PURE__ */
|
|
787
|
+
}), Pe = Lt, Tt = /* @__PURE__ */ b({
|
|
782
788
|
name: "View",
|
|
783
789
|
__name: "view",
|
|
784
790
|
setup(e) {
|
|
@@ -792,7 +798,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
792
798
|
})
|
|
793
799
|
]));
|
|
794
800
|
}
|
|
795
|
-
}), De = Tt, Ht = /* @__PURE__ */
|
|
801
|
+
}), De = Tt, Ht = /* @__PURE__ */ b({
|
|
796
802
|
name: "Warning",
|
|
797
803
|
__name: "warning",
|
|
798
804
|
setup(e) {
|
|
@@ -807,7 +813,7 @@ var mt = /* @__PURE__ */ y({
|
|
|
807
813
|
]));
|
|
808
814
|
}
|
|
809
815
|
}), Zt = Ht;
|
|
810
|
-
const jt =
|
|
816
|
+
const jt = b({
|
|
811
817
|
name: "ZxtForm",
|
|
812
818
|
inheritAttrs: !1,
|
|
813
819
|
props: {
|
|
@@ -827,7 +833,7 @@ const jt = y({
|
|
|
827
833
|
datetimerange: "el-date-picker",
|
|
828
834
|
cascader: "el-cascader"
|
|
829
835
|
}, r = (o) => c[o] || "el-input", p = (o) => {
|
|
830
|
-
const S = o.type || "input",
|
|
836
|
+
const S = o.type || "input", T = [
|
|
831
837
|
"select",
|
|
832
838
|
"date",
|
|
833
839
|
"daterange",
|
|
@@ -835,7 +841,7 @@ const jt = y({
|
|
|
835
841
|
"datetimerange",
|
|
836
842
|
"cascader"
|
|
837
843
|
].includes(S), W = {
|
|
838
|
-
placeholder: o.placeholder || `请${
|
|
844
|
+
placeholder: o.placeholder || `请${T ? "选择" : "输入"}${o.label}`,
|
|
839
845
|
disabled: o.disabled,
|
|
840
846
|
style: "width: 100%",
|
|
841
847
|
"popper-class": "zxt-form-popper"
|
|
@@ -869,7 +875,7 @@ const jt = y({
|
|
|
869
875
|
...x
|
|
870
876
|
};
|
|
871
877
|
return "clearable" in o && (I.clearable = o.clearable), o.props && typeof o.props == "object" && Object.assign(I, o.props), I;
|
|
872
|
-
},
|
|
878
|
+
}, f = _(() => e.formColumns.map((o) => ({
|
|
873
879
|
...o,
|
|
874
880
|
colSpan: {
|
|
875
881
|
xs: o.xs ?? o.span ?? 24,
|
|
@@ -888,11 +894,11 @@ const jt = y({
|
|
|
888
894
|
},
|
|
889
895
|
{ immediate: !0, deep: !0 }
|
|
890
896
|
);
|
|
891
|
-
const d =
|
|
897
|
+
const d = _(() => {
|
|
892
898
|
const o = { ...e.rules };
|
|
893
899
|
return Object.keys(o).length === 0 && e.formColumns.length > 0 && e.formColumns.forEach((S) => {
|
|
894
900
|
if (S.required) {
|
|
895
|
-
const
|
|
901
|
+
const T = [
|
|
896
902
|
"select",
|
|
897
903
|
"date",
|
|
898
904
|
"daterange",
|
|
@@ -903,8 +909,8 @@ const jt = y({
|
|
|
903
909
|
o[S.prop] = [
|
|
904
910
|
{
|
|
905
911
|
required: !0,
|
|
906
|
-
message: `请${
|
|
907
|
-
trigger:
|
|
912
|
+
message: `请${T ? "选择" : "输入"}${S.label}`,
|
|
913
|
+
trigger: T ? "change" : "blur"
|
|
908
914
|
}
|
|
909
915
|
];
|
|
910
916
|
}
|
|
@@ -915,7 +921,7 @@ const jt = y({
|
|
|
915
921
|
});
|
|
916
922
|
}, i = () => {
|
|
917
923
|
l.value && l.value.resetFields(), t("reset");
|
|
918
|
-
},
|
|
924
|
+
}, C = (o) => () => mt(o, u, {}) || null;
|
|
919
925
|
return a({
|
|
920
926
|
validate: () => l.value ? l.value.validate() : Promise.resolve(!1),
|
|
921
927
|
resetFields: () => l.value && l.value.resetFields(),
|
|
@@ -928,10 +934,10 @@ const jt = y({
|
|
|
928
934
|
formRules: d,
|
|
929
935
|
submitForm: h,
|
|
930
936
|
resetForm: i,
|
|
931
|
-
processedColumns:
|
|
937
|
+
processedColumns: f,
|
|
932
938
|
getComponentType: r,
|
|
933
939
|
getComponentProps: p,
|
|
934
|
-
renderCustomItem:
|
|
940
|
+
renderCustomItem: C
|
|
935
941
|
};
|
|
936
942
|
}
|
|
937
943
|
}), It = { class: "zxt-form-container" }, Et = {
|
|
@@ -939,42 +945,42 @@ const jt = y({
|
|
|
939
945
|
class: "form-label"
|
|
940
946
|
}, Nt = { class: "form-control" };
|
|
941
947
|
function Ut(e, t, a, l, u, c) {
|
|
942
|
-
const r = z("el-option"), p = z("el-form-item"),
|
|
948
|
+
const r = z("el-option"), p = z("el-form-item"), f = z("el-col"), d = z("el-row"), h = z("el-form");
|
|
943
949
|
return s(), g("div", It, [
|
|
944
|
-
D(h,
|
|
950
|
+
D(h, O({ ref: "formRef" }, e.$attrs, {
|
|
945
951
|
model: e.formData,
|
|
946
952
|
rules: e.formRules,
|
|
947
953
|
"label-width": e.labelWidth,
|
|
948
954
|
class: "zxt-form"
|
|
949
955
|
}), {
|
|
950
|
-
default:
|
|
956
|
+
default: y(() => [
|
|
951
957
|
D(d, { gutter: 20 }, {
|
|
952
|
-
default:
|
|
953
|
-
(s(!0), g(
|
|
954
|
-
default:
|
|
958
|
+
default: y(() => [
|
|
959
|
+
(s(!0), g(L, null, R(e.processedColumns, (i, C) => (s(), $(f, O({ key: C }, { ref_for: !0 }, i.colSpan), {
|
|
960
|
+
default: y(() => [
|
|
955
961
|
D(p, {
|
|
956
962
|
prop: i.prop,
|
|
957
963
|
required: i.required,
|
|
958
964
|
"label-width": "0",
|
|
959
965
|
class: "custom-form-item"
|
|
960
966
|
}, {
|
|
961
|
-
default:
|
|
967
|
+
default: y(() => [
|
|
962
968
|
w("div", {
|
|
963
969
|
class: ie(["form-item-wrapper", { "is-action": i.isAction }])
|
|
964
970
|
}, [
|
|
965
971
|
i.label ? (s(), g("span", Et, Q(i.label), 1)) : X("", !0),
|
|
966
972
|
w("div", Nt, [
|
|
967
|
-
i.type === "slot" ?
|
|
973
|
+
i.type === "slot" ? B(e.$slots, i.slotName || i.prop, {
|
|
968
974
|
key: 0,
|
|
969
975
|
formData: e.formData,
|
|
970
976
|
column: i
|
|
971
|
-
}, void 0, !0) : i.itemRender ? (s(), $(ye(e.renderCustomItem(i)), { key: 1 })) : (s(), $(ye(e.getComponentType(i.type)),
|
|
977
|
+
}, void 0, !0) : i.itemRender ? (s(), $(ye(e.renderCustomItem(i)), { key: 1 })) : (s(), $(ye(e.getComponentType(i.type)), O({
|
|
972
978
|
key: 2,
|
|
973
979
|
modelValue: e.formData[i.prop],
|
|
974
980
|
"onUpdate:modelValue": (o) => e.formData[i.prop] = o
|
|
975
981
|
}, { ref_for: !0 }, e.getComponentProps(i), Ne(i.events || {})), {
|
|
976
|
-
default:
|
|
977
|
-
i.type === "select" ? (s(!0), g(
|
|
982
|
+
default: y(() => [
|
|
983
|
+
i.type === "select" ? (s(!0), g(L, { key: 0 }, R(i.options, (o, S) => (s(), $(r, {
|
|
978
984
|
key: S,
|
|
979
985
|
label: o.label,
|
|
980
986
|
value: o.value
|
|
@@ -1010,16 +1016,16 @@ const Fe = /* @__PURE__ */ q(jt, [["render", Ut], ["__scopeId", "data-v-6b22a57b
|
|
|
1010
1016
|
Setting: Ve,
|
|
1011
1017
|
Warning: Zt,
|
|
1012
1018
|
Check: vt,
|
|
1013
|
-
Close:
|
|
1019
|
+
Close: _t,
|
|
1014
1020
|
Document: St,
|
|
1015
1021
|
CopyDocument: yt,
|
|
1016
|
-
Share:
|
|
1022
|
+
Share: Mt,
|
|
1017
1023
|
Lock: Pt,
|
|
1018
1024
|
Unlock: Bt,
|
|
1019
|
-
ArrowDown:
|
|
1020
|
-
}, Wt =
|
|
1025
|
+
ArrowDown: Me
|
|
1026
|
+
}, Wt = b({
|
|
1021
1027
|
name: "ActionColumn",
|
|
1022
|
-
components: { ArrowDown:
|
|
1028
|
+
components: { ArrowDown: Me },
|
|
1023
1029
|
props: {
|
|
1024
1030
|
buttons: {
|
|
1025
1031
|
type: Array,
|
|
@@ -1036,11 +1042,11 @@ const Fe = /* @__PURE__ */ q(jt, [["render", Ut], ["__scopeId", "data-v-6b22a57b
|
|
|
1036
1042
|
},
|
|
1037
1043
|
emits: ["action-click"],
|
|
1038
1044
|
setup(e, { emit: t }) {
|
|
1039
|
-
const a =
|
|
1045
|
+
const a = _(() => e.buttons.filter((d) => typeof d.visible == "function" ? d.visible(e.row) : typeof d.visible == "boolean" ? d.visible : !0)), l = _(
|
|
1040
1046
|
() => a.value.length > e.maxVisible
|
|
1041
|
-
), u =
|
|
1047
|
+
), u = _(
|
|
1042
1048
|
() => l.value ? a.value.slice(0, e.maxVisible) : a.value
|
|
1043
|
-
), c =
|
|
1049
|
+
), c = _(
|
|
1044
1050
|
() => l.value ? a.value.slice(e.maxVisible) : []
|
|
1045
1051
|
);
|
|
1046
1052
|
return {
|
|
@@ -1060,18 +1066,18 @@ const Fe = /* @__PURE__ */ q(jt, [["render", Ut], ["__scopeId", "data-v-6b22a57b
|
|
|
1060
1066
|
}
|
|
1061
1067
|
}), Gt = { class: "action-column" };
|
|
1062
1068
|
function Jt(e, t, a, l, u, c) {
|
|
1063
|
-
const r = z("el-button"), p = z("ArrowDown"),
|
|
1069
|
+
const r = z("el-button"), p = z("ArrowDown"), f = z("el-icon"), d = z("el-dropdown-item"), h = z("el-dropdown-menu"), i = z("el-dropdown");
|
|
1064
1070
|
return s(), g("div", Gt, [
|
|
1065
|
-
(s(!0), g(
|
|
1066
|
-
key:
|
|
1067
|
-
type:
|
|
1068
|
-
icon: e.getIconComponent(
|
|
1071
|
+
(s(!0), g(L, null, R(e.visibleButtons, (C) => (s(), $(r, {
|
|
1072
|
+
key: C.code,
|
|
1073
|
+
type: C.type || "",
|
|
1074
|
+
icon: e.getIconComponent(C.icon),
|
|
1069
1075
|
size: "small",
|
|
1070
1076
|
link: "",
|
|
1071
|
-
onClick: (o) => e.handleClick(
|
|
1077
|
+
onClick: (o) => e.handleClick(C)
|
|
1072
1078
|
}, {
|
|
1073
|
-
default:
|
|
1074
|
-
j(Q(
|
|
1079
|
+
default: y(() => [
|
|
1080
|
+
j(Q(C.label), 1)
|
|
1075
1081
|
]),
|
|
1076
1082
|
_: 2
|
|
1077
1083
|
}, 1032, ["type", "icon", "onClick"]))), 128)),
|
|
@@ -1080,16 +1086,16 @@ function Jt(e, t, a, l, u, c) {
|
|
|
1080
1086
|
trigger: "hover",
|
|
1081
1087
|
onCommand: e.handleCommand
|
|
1082
1088
|
}, {
|
|
1083
|
-
dropdown:
|
|
1089
|
+
dropdown: y(() => [
|
|
1084
1090
|
D(h, null, {
|
|
1085
|
-
default:
|
|
1086
|
-
(s(!0), g(
|
|
1087
|
-
key:
|
|
1088
|
-
command:
|
|
1089
|
-
icon: e.getIconComponent(
|
|
1091
|
+
default: y(() => [
|
|
1092
|
+
(s(!0), g(L, null, R(e.overflowButtons, (C) => (s(), $(d, {
|
|
1093
|
+
key: C.code,
|
|
1094
|
+
command: C,
|
|
1095
|
+
icon: e.getIconComponent(C.icon)
|
|
1090
1096
|
}, {
|
|
1091
|
-
default:
|
|
1092
|
-
j(Q(
|
|
1097
|
+
default: y(() => [
|
|
1098
|
+
j(Q(C.label), 1)
|
|
1093
1099
|
]),
|
|
1094
1100
|
_: 2
|
|
1095
1101
|
}, 1032, ["command", "icon"]))), 128))
|
|
@@ -1097,16 +1103,16 @@ function Jt(e, t, a, l, u, c) {
|
|
|
1097
1103
|
_: 1
|
|
1098
1104
|
})
|
|
1099
1105
|
]),
|
|
1100
|
-
default:
|
|
1106
|
+
default: y(() => [
|
|
1101
1107
|
D(r, {
|
|
1102
1108
|
type: "",
|
|
1103
1109
|
size: "small",
|
|
1104
1110
|
link: ""
|
|
1105
1111
|
}, {
|
|
1106
|
-
default:
|
|
1112
|
+
default: y(() => [
|
|
1107
1113
|
t[0] || (t[0] = j(" 更多 ", -1)),
|
|
1108
|
-
D(
|
|
1109
|
-
default:
|
|
1114
|
+
D(f, { class: "el-icon--right" }, {
|
|
1115
|
+
default: y(() => [
|
|
1110
1116
|
D(p)
|
|
1111
1117
|
]),
|
|
1112
1118
|
_: 1
|
|
@@ -1119,11 +1125,11 @@ function Jt(e, t, a, l, u, c) {
|
|
|
1119
1125
|
}, 8, ["onCommand"])) : X("", !0)
|
|
1120
1126
|
]);
|
|
1121
1127
|
}
|
|
1122
|
-
const Kt = /* @__PURE__ */ q(Wt, [["render", Jt], ["__scopeId", "data-v-6d75a891"]]), Qt =
|
|
1128
|
+
const Kt = /* @__PURE__ */ q(Wt, [["render", Jt], ["__scopeId", "data-v-6d75a891"]]), Qt = b({
|
|
1123
1129
|
name: "ZxtGrid",
|
|
1124
1130
|
inheritAttrs: !1,
|
|
1125
1131
|
components: {
|
|
1126
|
-
ZxtTable:
|
|
1132
|
+
ZxtTable: M,
|
|
1127
1133
|
ZxtForm: Fe,
|
|
1128
1134
|
ActionColumn: Kt,
|
|
1129
1135
|
Plus: $e,
|
|
@@ -1162,9 +1168,9 @@ const Kt = /* @__PURE__ */ q(Wt, [["render", Jt], ["__scopeId", "data-v-6d75a891
|
|
|
1162
1168
|
},
|
|
1163
1169
|
emits: ["toolbar-click", "action-click", "submit", "reset", "page-change", "size-change"],
|
|
1164
1170
|
setup(e, { emit: t, expose: a }) {
|
|
1165
|
-
const l = Ue(), u = qe(), c = k(null), r = k(null), p = k(1),
|
|
1171
|
+
const l = Ue(), u = qe(), c = k(null), r = k(null), p = k(1), f = k(10), d = k(null), h = k(e.gridOptions.formMode !== !1), i = k({
|
|
1166
1172
|
...e.gridOptions.formConfig?.data || {}
|
|
1167
|
-
}),
|
|
1173
|
+
}), C = {
|
|
1168
1174
|
Plus: $e,
|
|
1169
1175
|
Delete: ze,
|
|
1170
1176
|
Refresh: le,
|
|
@@ -1174,45 +1180,45 @@ const Kt = /* @__PURE__ */ q(Wt, [["render", Jt], ["__scopeId", "data-v-6d75a891
|
|
|
1174
1180
|
View: De,
|
|
1175
1181
|
Upload: Pe,
|
|
1176
1182
|
Setting: Ve
|
|
1177
|
-
}, o =
|
|
1178
|
-
const
|
|
1179
|
-
return
|
|
1180
|
-
}), S =
|
|
1181
|
-
...
|
|
1183
|
+
}, o = _(() => {
|
|
1184
|
+
const m = (e.gridOptions.columns || []).find((A) => A.actionColumn);
|
|
1185
|
+
return m ? m.actionColumn : null;
|
|
1186
|
+
}), S = _(() => (e.gridOptions.columns || []).map((m) => m.actionColumn ? {
|
|
1187
|
+
...m,
|
|
1182
1188
|
slot: "__action__",
|
|
1183
1189
|
actionColumn: void 0
|
|
1184
|
-
} :
|
|
1190
|
+
} : m)), T = (n) => {
|
|
1185
1191
|
t("action-click", n);
|
|
1186
|
-
}, W =
|
|
1192
|
+
}, W = _(() => {
|
|
1187
1193
|
const n = e.gridOptions.formConfig;
|
|
1188
1194
|
if (!n || !n.items) return [];
|
|
1189
|
-
const
|
|
1190
|
-
return
|
|
1195
|
+
const m = [...n.items];
|
|
1196
|
+
return m.some(
|
|
1191
1197
|
(we) => we.type === "slot" && we.slotName === "search-actions"
|
|
1192
|
-
) ||
|
|
1198
|
+
) || m.push({
|
|
1193
1199
|
type: "slot",
|
|
1194
1200
|
slotName: "search-actions",
|
|
1195
1201
|
span: 6,
|
|
1196
1202
|
labelWidth: "0px",
|
|
1197
1203
|
isAction: !0,
|
|
1198
1204
|
...n.actionConfig
|
|
1199
|
-
}),
|
|
1200
|
-
}), x =
|
|
1205
|
+
}), m;
|
|
1206
|
+
}), x = _(() => {
|
|
1201
1207
|
const n = /* @__PURE__ */ new Set(["search-actions"]);
|
|
1202
|
-
return (W.value || []).forEach((
|
|
1203
|
-
|
|
1208
|
+
return (W.value || []).forEach((m) => {
|
|
1209
|
+
m.type === "slot" && n.add(m.slotName || m.prop);
|
|
1204
1210
|
}), n;
|
|
1205
|
-
}), I =
|
|
1211
|
+
}), I = _(() => {
|
|
1206
1212
|
const n = {};
|
|
1207
|
-
for (const
|
|
1208
|
-
|
|
1213
|
+
for (const m in u)
|
|
1214
|
+
m === "search-actions" || m === "toolbar" || (x.value.has(m) || m.startsWith("form-")) && (n[m] = u[m]);
|
|
1209
1215
|
return n;
|
|
1210
|
-
}), ue =
|
|
1216
|
+
}), ue = _(() => {
|
|
1211
1217
|
const n = {};
|
|
1212
|
-
for (const
|
|
1213
|
-
|
|
1218
|
+
for (const m in u)
|
|
1219
|
+
m !== "toolbar" && !x.value.has(m) && !m.startsWith("form-") && (n[m] = u[m]);
|
|
1214
1220
|
return n;
|
|
1215
|
-
}),
|
|
1221
|
+
}), H = () => {
|
|
1216
1222
|
r.value?.submitForm();
|
|
1217
1223
|
}, oe = (n) => {
|
|
1218
1224
|
t("submit", n), e.gridOptions.proxyConfig && (i.value = { ...n }, p.value = 1, c.value?.reload?.({ formData: i.value, page: 1 }));
|
|
@@ -1222,17 +1228,17 @@ const Kt = /* @__PURE__ */ q(Wt, [["render", Jt], ["__scopeId", "data-v-6d75a891
|
|
|
1222
1228
|
t("reset"), e.gridOptions.proxyConfig && (i.value = {}, p.value = 1, c.value?.reload?.({ formData: {}, page: 1 }));
|
|
1223
1229
|
}, pe = (n) => {
|
|
1224
1230
|
if (n)
|
|
1225
|
-
return typeof n == "object" || typeof n == "function" ? n :
|
|
1226
|
-
}, v =
|
|
1231
|
+
return typeof n == "object" || typeof n == "function" ? n : C[n];
|
|
1232
|
+
}, v = _(() => {
|
|
1227
1233
|
const n = e.gridOptions.proxyConfig;
|
|
1228
1234
|
return n ? {
|
|
1229
1235
|
...n,
|
|
1230
1236
|
_formData: i.value
|
|
1231
1237
|
} : null;
|
|
1232
|
-
}), P =
|
|
1238
|
+
}), P = _(() => {
|
|
1233
1239
|
const {
|
|
1234
1240
|
formConfig: n,
|
|
1235
|
-
toolbar:
|
|
1241
|
+
toolbar: m,
|
|
1236
1242
|
formMode: A,
|
|
1237
1243
|
formColumns: we,
|
|
1238
1244
|
rules: ra,
|
|
@@ -1244,20 +1250,20 @@ const Kt = /* @__PURE__ */ q(Wt, [["render", Jt], ["__scopeId", "data-v-6d75a891
|
|
|
1244
1250
|
...Le,
|
|
1245
1251
|
proxyConfig: v.value || Be || null
|
|
1246
1252
|
};
|
|
1247
|
-
}),
|
|
1248
|
-
t("toolbar-click", { code: n, button:
|
|
1249
|
-
},
|
|
1253
|
+
}), Z = _(() => d.value !== null ? d.value : e.externalData.length > 0 ? e.externalData : e.gridOptions.data || []), E = _(() => !!e.gridOptions.proxyConfig), fe = _(() => E.value ? 0 : Z.value.length), me = (n, m) => {
|
|
1254
|
+
t("toolbar-click", { code: n, button: m, grid: c.value });
|
|
1255
|
+
}, ge = (n) => {
|
|
1250
1256
|
p.value = n.page, t("page-change", n);
|
|
1251
1257
|
}, he = (n) => {
|
|
1252
|
-
|
|
1258
|
+
f.value = n.size, t("size-change", n);
|
|
1253
1259
|
}, ve = () => c.value, N = () => r.value, F = () => c.value?.getTableRef()?.getSelectionRows?.() || [], Y = (n) => {
|
|
1254
1260
|
d.value = n ?? null;
|
|
1255
|
-
},
|
|
1261
|
+
}, Ce = (n) => {
|
|
1256
1262
|
h.value = n;
|
|
1257
|
-
},
|
|
1263
|
+
}, _e = (n, m = !0) => {
|
|
1258
1264
|
const A = e.gridOptions.formConfig;
|
|
1259
|
-
A?.data && Object.assign(A.data, n), i.value = { ...A?.data || {}, ...n },
|
|
1260
|
-
}, re = (n, ...
|
|
1265
|
+
A?.data && Object.assign(A.data, n), i.value = { ...A?.data || {}, ...n }, m && e.gridOptions.proxyConfig && (p.value = 1, c.value?.reload?.({ formData: i.value, page: 1 }));
|
|
1266
|
+
}, re = (n, ...m) => {
|
|
1261
1267
|
const A = i.value;
|
|
1262
1268
|
switch (n) {
|
|
1263
1269
|
case "query":
|
|
@@ -1285,8 +1291,8 @@ const Kt = /* @__PURE__ */ q(Wt, [["render", Jt], ["__scopeId", "data-v-6d75a891
|
|
|
1285
1291
|
getElTableRef: V,
|
|
1286
1292
|
getSelectedRows: F,
|
|
1287
1293
|
reloadData: Y,
|
|
1288
|
-
setFormVisible:
|
|
1289
|
-
setFormData:
|
|
1294
|
+
setFormVisible: Ce,
|
|
1295
|
+
setFormData: _e,
|
|
1290
1296
|
commitProxy: re,
|
|
1291
1297
|
clearSelection: () => V()?.clearSelection(),
|
|
1292
1298
|
toggleRowSelection: (...n) => V()?.toggleRowSelection(...n),
|
|
@@ -1302,8 +1308,8 @@ const Kt = /* @__PURE__ */ q(Wt, [["render", Jt], ["__scopeId", "data-v-6d75a891
|
|
|
1302
1308
|
gridRef: c,
|
|
1303
1309
|
searchFormRef: r,
|
|
1304
1310
|
currentPage: p,
|
|
1305
|
-
pageSize:
|
|
1306
|
-
tableData:
|
|
1311
|
+
pageSize: f,
|
|
1312
|
+
tableData: Z,
|
|
1307
1313
|
tableProps: P,
|
|
1308
1314
|
mergedColumns: S,
|
|
1309
1315
|
actionColumnConfig: o,
|
|
@@ -1313,11 +1319,11 @@ const Kt = /* @__PURE__ */ q(Wt, [["render", Jt], ["__scopeId", "data-v-6d75a891
|
|
|
1313
1319
|
formFilteredSlots: I,
|
|
1314
1320
|
tableFilteredSlots: ue,
|
|
1315
1321
|
getIconComponent: pe,
|
|
1316
|
-
handleToolbarClick:
|
|
1317
|
-
handleActionClick:
|
|
1318
|
-
handlePageChange:
|
|
1322
|
+
handleToolbarClick: me,
|
|
1323
|
+
handleActionClick: T,
|
|
1324
|
+
handlePageChange: ge,
|
|
1319
1325
|
handleSizeChange: he,
|
|
1320
|
-
handleSearch:
|
|
1326
|
+
handleSearch: H,
|
|
1321
1327
|
handleSearchSubmit: oe,
|
|
1322
1328
|
handleReset: de,
|
|
1323
1329
|
handleSearchReset: ce,
|
|
@@ -1333,7 +1339,7 @@ const Kt = /* @__PURE__ */ q(Wt, [["render", Jt], ["__scopeId", "data-v-6d75a891
|
|
|
1333
1339
|
class: "grid-toolbar"
|
|
1334
1340
|
};
|
|
1335
1341
|
function aa(e, t, a, l, u, c) {
|
|
1336
|
-
const r = z("el-button"), p = z("ZxtForm"),
|
|
1342
|
+
const r = z("el-button"), p = z("ZxtForm"), f = z("ActionColumn"), d = z("ZxtTable");
|
|
1337
1343
|
return s(), g("div", {
|
|
1338
1344
|
class: ie(["zxt-grid-container", { "zxt-grid-container--full": e.gridOptions.height === "full" }])
|
|
1339
1345
|
}, [
|
|
@@ -1346,14 +1352,14 @@ function aa(e, t, a, l, u, c) {
|
|
|
1346
1352
|
onSubmit: e.handleSearchSubmit,
|
|
1347
1353
|
onReset: e.handleSearchReset
|
|
1348
1354
|
}, ne({
|
|
1349
|
-
"search-actions":
|
|
1355
|
+
"search-actions": y(() => [
|
|
1350
1356
|
w("div", Yt, [
|
|
1351
1357
|
D(r, {
|
|
1352
1358
|
class: "btn-search",
|
|
1353
1359
|
icon: e.Search,
|
|
1354
1360
|
onClick: e.handleSearch
|
|
1355
1361
|
}, {
|
|
1356
|
-
default:
|
|
1362
|
+
default: y(() => [...t[0] || (t[0] = [
|
|
1357
1363
|
j(" 查询 ", -1)
|
|
1358
1364
|
])]),
|
|
1359
1365
|
_: 1
|
|
@@ -1363,7 +1369,7 @@ function aa(e, t, a, l, u, c) {
|
|
|
1363
1369
|
icon: e.Refresh,
|
|
1364
1370
|
onClick: e.handleReset
|
|
1365
1371
|
}, {
|
|
1366
|
-
default:
|
|
1372
|
+
default: y(() => [...t[1] || (t[1] = [
|
|
1367
1373
|
j(" 重置 ", -1)
|
|
1368
1374
|
])]),
|
|
1369
1375
|
_: 1
|
|
@@ -1374,32 +1380,32 @@ function aa(e, t, a, l, u, c) {
|
|
|
1374
1380
|
}, [
|
|
1375
1381
|
R(e.formFilteredSlots, (h, i) => ({
|
|
1376
1382
|
name: i,
|
|
1377
|
-
fn:
|
|
1378
|
-
|
|
1383
|
+
fn: y((C) => [
|
|
1384
|
+
B(e.$slots, i, Re(Ae(C)), void 0, !0)
|
|
1379
1385
|
])
|
|
1380
1386
|
}))
|
|
1381
1387
|
]), 1032, ["form-columns", "initial-form-data", "rules", "onSubmit", "onReset"])
|
|
1382
1388
|
])) : X("", !0),
|
|
1383
1389
|
w("div", ea, [
|
|
1384
1390
|
e.gridOptions.toolbar ? (s(), g("div", ta, [
|
|
1385
|
-
(s(!0), g(
|
|
1391
|
+
(s(!0), g(L, null, R(e.gridOptions.toolbar.buttons, (h, i) => (s(), $(r, {
|
|
1386
1392
|
key: i,
|
|
1387
1393
|
type: h.type || "default",
|
|
1388
1394
|
size: h.size || "small",
|
|
1389
1395
|
icon: e.getIconComponent(h.icon),
|
|
1390
1396
|
disabled: h.disabled,
|
|
1391
|
-
onClick: (
|
|
1397
|
+
onClick: (C) => e.handleToolbarClick(h.code, h)
|
|
1392
1398
|
}, {
|
|
1393
|
-
default:
|
|
1399
|
+
default: y(() => [
|
|
1394
1400
|
j(Q(h.name), 1)
|
|
1395
1401
|
]),
|
|
1396
1402
|
_: 2
|
|
1397
1403
|
}, 1032, ["type", "size", "icon", "disabled", "onClick"]))), 128)),
|
|
1398
|
-
|
|
1404
|
+
B(e.$slots, "toolbar", {
|
|
1399
1405
|
grid: e.$refs.gridRef
|
|
1400
1406
|
}, void 0, !0)
|
|
1401
1407
|
])) : X("", !0),
|
|
1402
|
-
D(d,
|
|
1408
|
+
D(d, O({ ref: "gridRef" }, { ...e.tableProps, ...e.attrs }, {
|
|
1403
1409
|
id: e.gridOptions.id,
|
|
1404
1410
|
columns: e.mergedColumns,
|
|
1405
1411
|
data: e.tableData,
|
|
@@ -1416,8 +1422,8 @@ function aa(e, t, a, l, u, c) {
|
|
|
1416
1422
|
}), ne({ _: 2 }, [
|
|
1417
1423
|
e.actionColumnConfig ? {
|
|
1418
1424
|
name: "__action__",
|
|
1419
|
-
fn:
|
|
1420
|
-
D(
|
|
1425
|
+
fn: y(({ row: h }) => [
|
|
1426
|
+
D(f, {
|
|
1421
1427
|
buttons: e.actionColumnConfig.buttons,
|
|
1422
1428
|
row: h,
|
|
1423
1429
|
"max-visible": e.actionColumnConfig.maxVisible || 2,
|
|
@@ -1428,23 +1434,23 @@ function aa(e, t, a, l, u, c) {
|
|
|
1428
1434
|
} : void 0,
|
|
1429
1435
|
R(e.tableFilteredSlots, (h, i) => ({
|
|
1430
1436
|
name: i,
|
|
1431
|
-
fn:
|
|
1432
|
-
|
|
1437
|
+
fn: y((C) => [
|
|
1438
|
+
B(e.$slots, i, Re(Ae(C)), void 0, !0)
|
|
1433
1439
|
])
|
|
1434
1440
|
}))
|
|
1435
1441
|
]), 1040, ["id", "columns", "data", "height", "pageable", "current-page", "page-size", "page-sizes", "total", "pagination-layout", "onPageChange", "onSizeChange"])
|
|
1436
1442
|
])
|
|
1437
1443
|
], 2);
|
|
1438
1444
|
}
|
|
1439
|
-
const
|
|
1445
|
+
const xe = /* @__PURE__ */ q(Qt, [["render", aa], ["__scopeId", "data-v-f8b2d913"]]);
|
|
1440
1446
|
J.install = function(e) {
|
|
1441
1447
|
e.component(J.name, J);
|
|
1442
1448
|
};
|
|
1443
1449
|
const na = [
|
|
1444
1450
|
ee,
|
|
1445
1451
|
te,
|
|
1446
|
-
|
|
1447
|
-
|
|
1452
|
+
M,
|
|
1453
|
+
xe,
|
|
1448
1454
|
Fe,
|
|
1449
1455
|
J
|
|
1450
1456
|
], oa = (e) => {
|
|
@@ -1455,20 +1461,20 @@ const na = [
|
|
|
1455
1461
|
install: oa,
|
|
1456
1462
|
MyButton: ee,
|
|
1457
1463
|
JsxButton: te,
|
|
1458
|
-
ZxtTable:
|
|
1459
|
-
ZxtGrid:
|
|
1464
|
+
ZxtTable: M,
|
|
1465
|
+
ZxtGrid: xe,
|
|
1460
1466
|
ZxtForm: Fe,
|
|
1461
1467
|
ZxtPagination: J,
|
|
1462
1468
|
// 暴露渲染器 API
|
|
1463
|
-
renderer:
|
|
1464
|
-
registerRenderer:
|
|
1469
|
+
renderer: M.renderer,
|
|
1470
|
+
registerRenderer: M.registerRenderer
|
|
1465
1471
|
};
|
|
1466
1472
|
export {
|
|
1467
1473
|
te as JsxButton,
|
|
1468
1474
|
ee as MyButton,
|
|
1469
1475
|
Fe as ZxtForm,
|
|
1470
|
-
|
|
1476
|
+
xe as ZxtGrid,
|
|
1471
1477
|
J as ZxtPagination,
|
|
1472
|
-
|
|
1478
|
+
M as ZxtTable,
|
|
1473
1479
|
ua as default
|
|
1474
1480
|
};
|
package/dist/zxt-table.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(k,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(k=typeof globalThis<"u"?globalThis:k||self,e(k.ZxtTable={},k.Vue,k.ElementPlus))})(this,(function(k,e,V){"use strict";const P=(t,o)=>{const n=t.__vccOpts||t;for(const[s,c]of o)n[s]=c;return n},ge={name:"MyButton",props:{type:{type:String,default:"default",validator:t=>["default","primary","success","warning","danger"].includes(t)},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:o}){return{handleClick:s=>{o("click",s)}}}},ue=["disabled"];function he(t,o,n,s,c,p){return e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["my-button",[`my-button--${n.type}`,{"is-disabled":n.disabled}]]),disabled:n.disabled,onClick:o[0]||(o[0]=(...l)=>s.handleClick&&s.handleClick(...l))},[e.renderSlot(t.$slots,"default",{},void 0,!0)],10,ue)}const A=P(ge,[["render",he],["__scopeId","data-v-4480e77d"]]);A.install=function(t){t.component(A.name,A)};const L=e.defineComponent({name:"JsxButton",props:{type:{type:String,default:"default",validator:t=>["default","primary","success","warning","danger"].includes(t)},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:o,slots:n}){const s=c=>{t.disabled||o("click",c)};return()=>e.createVNode("button",{class:["jsx-button",`jsx-button--${t.type}`,{"is-disabled":t.disabled}],disabled:t.disabled,onClick:s},[n.default?.()])}});L.install=function(t){t.component(L.name,L)};const Ce=e.defineComponent({name:"ZxtPagination",components:{ElPagination:V.ElPagination},props:{modelValue:{type:Number,default:1},pageSize:{type:Number,default:10},pageSizes:{type:Array,default:()=>[10,20,50,100]},total:{type:Number,default:0},layout:{type:String,default:"total, sizes, prev, pager, next, jumper"}},emits:["update:modelValue","update:pageSize","page-change","size-change"],setup(t,{emit:o}){const n=e.ref(t.modelValue),s=e.ref(t.pageSize);return e.watch(()=>t.modelValue,l=>{n.value=l}),e.watch(()=>t.pageSize,l=>{s.value=l}),{currentPage:n,pageSize:s,handleSizeChange:l=>{s.value=l,n.value=1,o("update:pageSize",l),o("size-change",{page:n.value,size:l})},handleCurrentChange:l=>{n.value=l,o("update:modelValue",l),o("page-change",{page:l,size:s.value})}}}});function we(t,o,n,s,c,p){const l=e.resolveComponent("el-pagination");return e.openBlock(),e.createBlock(l,{"current-page":t.currentPage,"onUpdate:currentPage":o[0]||(o[0]=m=>t.currentPage=m),"page-size":t.pageSize,"onUpdate:pageSize":o[1]||(o[1]=m=>t.pageSize=m),"page-sizes":t.pageSizes,total:t.total,layout:t.layout,class:"zxt-pagination",onSizeChange:t.handleSizeChange,onCurrentChange:t.handleCurrentChange},null,8,["current-page","page-size","page-sizes","total","layout","onSizeChange","onCurrentChange"])}const F=P(Ce,[["render",we],["__scopeId","data-v-497aa44d"]]),O={default:({cellValue:t})=>t??"",input:({cellValue:t,row:o,column:n,updateRow:s})=>e.h(V.ElInput,{modelValue:t,size:"small",onInput:c=>s({...o,[n.property]:c})}),select:({cellValue:t,row:o,column:n,updateRow:s,options:c=[]})=>e.h(V.ElSelect,{modelValue:t,size:"small",onChange:p=>s({...o,[n.property]:p})},()=>c.map(p=>e.h(V.ElOption,{label:p.label,value:p.value,key:p.value}))),checkbox:({cellValue:t,row:o,column:n,updateRow:s})=>e.h(V.ElCheckbox,{modelValue:!!t,onChange:c=>s({...o,[n.property]:c})}),link:({cellValue:t,href:o,target:n="_blank"})=>e.h(V.ElLink,{href:o,target:n},()=>t)};function _e(t,o){if(!t)return null;if(typeof t=="string"){const n=O[t];return n?n(o):(console.warn(`[ZxtTable] 未找到内置渲染器: ${t}`),o.cellValue??"")}if(typeof t=="function")return t(o);if(typeof t=="object"&&!Array.isArray(t)){const{name:n,props:s={},attrs:c={},events:p={},content:l}=t;return typeof n=="string"&&O[n]?O[n]({...o,...s,...c,...p}):typeof n=="object"||typeof n=="function"?e.h(n,{...s,...c,...p},l):(console.warn("[ZxtTable] cellRender 对象缺少有效的 name 字段"),o.cellValue??"")}return o.cellValue??""}function ke(t,o){O[t]&&console.warn(`[ZxtTable] 内置渲染器 ${t} 已被覆盖`),O[t]=o}const ye=e.defineComponent({name:"ZxtTableColumn",components:{ElTableColumn:V.ElTableColumn},props:{column:{type:Object,required:!0},currentPage:{type:Number,default:1},pageSize:{type:Number,default:10}},setup(t){const o=e.inject("updateRow",()=>{}),n=l=>{const{currentPage:m,pageSize:g}=t;return(m-1)*g+l+1},s=e.computed(()=>{const l=t.column;return{...l,prop:l.prop??l.field,label:l.label??l.title}}),c=e.computed(()=>{const{children:l,...m}=s.value;return m});return{normalizedColumn:s,columnProps:c,renderCell:l=>{const m=s.value,g=l.row[m.prop],d=g??m.defaultValue??"";return _e(m.cellRender,{row:l.row,column:m,rowIndex:l.$index,cellValue:d,updateRow:u=>o(u,l.$index)})},defaultIndexMethod:n}}});function be(t,o,n,s,c,p){const l=e.resolveComponent("ZxtTableColumn",!0),m=e.resolveComponent("el-table-column");return t.normalizedColumn.children&&t.normalizedColumn.children.length?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0},t.columnProps,{key:t.normalizedColumn.prop+"-group"}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.normalizedColumn.children,(g,d)=>(e.openBlock(),e.createBlock(l,{key:d,column:g,"current-page":t.currentPage,"page-size":t.pageSize},e.createSlots({_:2},[e.renderList(t.$slots,(u,i)=>({name:i,fn:e.withCtx(C=>[e.renderSlot(t.$slots,i,e.mergeProps({ref_for:!0},C))])}))]),1032,["column","current-page","page-size"]))),128))]),_:3},16)):(e.openBlock(),e.createBlock(m,e.mergeProps({key:1},t.columnProps,{key:t.normalizedColumn.prop,index:t.normalizedColumn.indexMethod||t.defaultIndexMethod}),e.createSlots({_:2},[!["selection","index"].includes(t.normalizedColumn.type)&&(t.normalizedColumn.type!=="expand"||t.normalizedColumn.slot)?{name:"default",fn:e.withCtx(g=>[t.normalizedColumn.slot?e.renderSlot(t.$slots,t.normalizedColumn.slot,{key:0,row:g.row,index:g.$index,column:t.normalizedColumn}):t.normalizedColumn.cellRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.renderCell(g)),{key:1})):t.normalizedColumn.formatter?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(t.normalizedColumn.formatter(g.row,t.normalizedColumn,g.row[t.normalizedColumn.prop],g.$index)),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(g.row[t.normalizedColumn.prop]),1)],64))]),key:"0"}:void 0]),1040,["index"]))}const ze=P(ye,[["render",be]]),Be=e.defineComponent({name:"ZxtTable",inheritAttrs:!1,components:{ZxtPagination:F,ZxtTableColumn:ze,ElTable:V.ElTable},props:{id:{type:String,default:""},columns:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},height:{type:[String,Number],default:""},pageable:{type:Boolean,default:!0},currentPage:{type:Number,default:1},pageSize:{type:Number,default:10},pageSizes:{type:Array,default:()=>[10,20,50,100]},total:{type:Number,default:0},paginationLayout:{type:String,default:"total, sizes, prev, pager, next, jumper"},proxyConfig:{type:Object,default:null},autoLoad:{type:Boolean,default:!0}},emits:["page-change","size-change","sort-change","filter-change","loaded","load-error","update:row"],setup(t,{emit:o}){const n=e.ref(null),s=e.ref(t.pageSize),c=e.ref(t.currentPage),p=e.ref(!1),l=e.ref([]),m=e.ref(0),g=e.ref({prop:"",order:""}),d=e.ref({}),u=e.ref({});e.watch(()=>t.currentPage,h=>{c.value=h}),e.watch(()=>t.pageSize,h=>{s.value=h});const i=e.computed(()=>t.height==="full"?{height:"100%"}:{}),C=e.computed(()=>{if(t.height!=="full")return t.height}),r=e.computed(()=>!!t.proxyConfig),w=e.computed(()=>r.value?m.value:t.total>0?t.total:t.data.length),E=e.computed(()=>r.value?l.value:t.data),M=h=>{r.value&&(c.value=h.page,s.value=h.size,x()),o("size-change",h)},S=h=>{r.value&&(c.value=h.page,s.value=h.size,x()),o("page-change",h)},D=({column:h,prop:y,order:$})=>{g.value={prop:y,order:$},r.value&&x(),o("sort-change",{column:h,prop:y,order:$})},te=h=>{d.value=h||{},r.value&&x(),o("filter-change",d.value)},x=async h=>{if(!r.value)return;const y=t.proxyConfig||{},$=y.ajax?.query;if(typeof $!="function")return;const R=y.props||{},re=R.pageField||"page";R.sizeField;const le=R.sortField||"sort",se=R.orderField||"order",ie=R.filtersField||"filters";h?.formData!==void 0?u.value=h.formData:y._formData&&(u.value=y._formData);const ce=y.params||{},T={[re]:{currentPage:h?.page??c.value,pageSize:h?.pageSize??s.value},form:u.value,...ce};g.value?.prop&&(T[le]=g.value.prop,T[se]=g.value.order),d.value&&Object.keys(d.value).length&&(T[ie]=d.value),p.value=!0;try{const z=await $(T),Z=y.response||{},de=Z.listField||"list",pe=Z.totalField||"total",U=Z.transform;let _=[],a=0;if(typeof U=="function"){const f=U(z);_=f?.list??[],a=f?.total??0}else z&&typeof z=="object"&&(_=z?.[de]??z?.data??[],a=z?.[pe]??z?.total??0);l.value=Array.isArray(_)?_:[],m.value=Number(a)||0,o("loaded",{data:l.value,total:m.value,payload:T})}catch(z){o("load-error",z)}finally{p.value=!1}},q=(h,y)=>{r.value?l.value.splice(y,1,h):o("update:row",{index:y,row:h})};e.provide("updateRow",q),e.onMounted(()=>{r.value&&t.autoLoad&&x()});const oe=()=>n.value,ne=()=>n.value?.getSelectionRows?.()||[],ae=h=>x(h);return{tableRef:n,containerStyle:i,tableHeight:C,getTableRef:oe,pageSize:s,currentPage:c,loading:p,renderData:E,total:w,pageSizes:e.computed(()=>t.pageSizes),paginationLayout:e.computed(()=>t.paginationLayout),handleSizeChange:M,handlePageChange:S,handleSortChange:D,handleFilterChange:te,reload:ae,getSelectedRows:ne,updateRow:q}}});function Se(t,o,n,s,c,p){const l=e.resolveComponent("ZxtTableColumn"),m=e.resolveComponent("el-table"),g=e.resolveComponent("ZxtPagination"),d=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["zxt-table-container",{"zxt-table-container--full":t.height==="full"}]),style:e.normalizeStyle(t.containerStyle)},[e.withDirectives((e.openBlock(),e.createBlock(m,e.mergeProps({ref:"tableRef",data:t.renderData,height:t.tableHeight},t.$attrs,{id:t.id,onSortChange:t.handleSortChange,onFilterChange:t.handleFilterChange}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,(u,i)=>(e.openBlock(),e.createBlock(l,{key:i,column:u,"current-page":t.currentPage,"page-size":t.pageSize},e.createSlots({_:2},[e.renderList(t.$slots,(C,r)=>({name:r,fn:e.withCtx(w=>[e.renderSlot(t.$slots,r,e.mergeProps({ref_for:!0},w),void 0,!0)])}))]),1032,["column","current-page","page-size"]))),128))]),_:3},16,["data","height","id","onSortChange","onFilterChange"])),[[d,t.loading]]),t.pageable?(e.openBlock(),e.createBlock(g,{key:0,"model-value":t.currentPage,"page-size":t.pageSize,"onUpdate:pageSize":o[0]||(o[0]=u=>t.pageSize=u),"page-sizes":t.pageSizes,total:t.total,layout:t.paginationLayout,onPageChange:t.handlePageChange,onSizeChange:t.handleSizeChange},null,8,["model-value","page-size","page-sizes","total","layout","onPageChange","onSizeChange"])):e.createCommentVNode("",!0)],6)}const b=P(Be,[["render",Se],["__scopeId","data-v-ebf6786f"]]),N=new Map;class Ve{add(o,n){return!o||typeof o!="string"?(console.warn("[ZxtTable] 渲染器名称必须是字符串"),this):!n||typeof n!="object"?(console.warn("[ZxtTable] 渲染器配置必须是对象"),this):(N.has(o)&&console.warn(`[ZxtTable] 渲染器 "${o}" 已存在,将被覆盖`),N.set(o,n),this)}get(o){return N.get(o)}delete(o){return N.delete(o)}has(o){return N.has(o)}getAll(){return Array.from(N.keys())}clear(){N.clear()}}const W=new Ve;function Ee(t,o,n={}){if(!t||!t.itemRender)return null;const{name:s}=t.itemRender;if(s&&W.has(s)){const c=W.get(s);if(typeof c.renderItemContent=="function"){const p={data:o,field:t.field||t.prop,item:t,formData:o};try{return c.renderItemContent(n,p)}catch(l){return console.error(`[ZxtTable] 渲染器 "${s}" 执行出错:`,l),null}}}return null}b.install=function(t){t.component(b.name,b)},b.registerRenderer=ke,b.renderer=W;/*! Element Plus Icons Vue v2.3.2 */var xe=e.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"})]))}}),fe=xe,$e=e.defineComponent({name:"Check",__name:"check",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"})]))}}),Pe=$e,Fe=e.defineComponent({name:"Close",__name:"close",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),Ne=Fe,De=e.defineComponent({name:"CopyDocument",__name:"copy-document",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M768 832a128 128 0 0 1-128 128H192A128 128 0 0 1 64 832V384a128 128 0 0 1 128-128v64a64 64 0 0 0-64 64v448a64 64 0 0 0 64 64h448a64 64 0 0 0 64-64z"}),e.createElementVNode("path",{fill:"currentColor",d:"M384 128a64 64 0 0 0-64 64v448a64 64 0 0 0 64 64h448a64 64 0 0 0 64-64V192a64 64 0 0 0-64-64zm0-64h448a128 128 0 0 1 128 128v448a128 128 0 0 1-128 128H384a128 128 0 0 1-128-128V192A128 128 0 0 1 384 64"})]))}}),Re=De,Te=e.defineComponent({name:"Delete",__name:"delete",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),G=Te,Ae=e.defineComponent({name:"Document",__name:"document",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"})]))}}),Le=Ae,Me=e.defineComponent({name:"Download",__name:"download",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"})]))}}),J=Me,Oe=e.defineComponent({name:"Edit",__name:"edit",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"}),e.createElementVNode("path",{fill:"currentColor",d:"m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"})]))}}),K=Oe,Ze=e.defineComponent({name:"Lock",__name:"lock",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M224 448a32 32 0 0 0-32 32v384a32 32 0 0 0 32 32h576a32 32 0 0 0 32-32V480a32 32 0 0 0-32-32zm0-64h576a96 96 0 0 1 96 96v384a96 96 0 0 1-96 96H224a96 96 0 0 1-96-96V480a96 96 0 0 1 96-96"}),e.createElementVNode("path",{fill:"currentColor",d:"M512 544a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V576a32 32 0 0 1 32-32m192-160v-64a192 192 0 1 0-384 0v64zM512 64a256 256 0 0 1 256 256v128H256V320A256 256 0 0 1 512 64"})]))}}),He=Ze,je=e.defineComponent({name:"Plus",__name:"plus",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),Q=je,Ie=e.defineComponent({name:"Refresh",__name:"refresh",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"})]))}}),H=Ie,qe=e.defineComponent({name:"Search",__name:"search",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"})]))}}),j=qe,Ue=e.defineComponent({name:"Setting",__name:"setting",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357 357 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a352 352 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357 357 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294 294 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293 293 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294 294 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288 288 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293 293 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a288 288 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384m0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256"})]))}}),X=Ue,We=e.defineComponent({name:"Share",__name:"share",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m679.872 348.8-301.76 188.608a127.8 127.8 0 0 1 5.12 52.16l279.936 104.96a128 128 0 1 1-22.464 59.904l-279.872-104.96a128 128 0 1 1-16.64-166.272l301.696-188.608a128 128 0 1 1 33.92 54.272z"})]))}}),Ge=We,Je=e.defineComponent({name:"Unlock",__name:"unlock",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M224 448a32 32 0 0 0-32 32v384a32 32 0 0 0 32 32h576a32 32 0 0 0 32-32V480a32 32 0 0 0-32-32zm0-64h576a96 96 0 0 1 96 96v384a96 96 0 0 1-96 96H224a96 96 0 0 1-96-96V480a96 96 0 0 1 96-96"}),e.createElementVNode("path",{fill:"currentColor",d:"M512 544a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V576a32 32 0 0 1 32-32m178.304-295.296A192.064 192.064 0 0 0 320 320v64h352l96 38.4V448H256V320a256 256 0 0 1 493.76-95.104z"})]))}}),Ke=Je,Qe=e.defineComponent({name:"Upload",__name:"upload",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248z"})]))}}),Y=Qe,Xe=e.defineComponent({name:"View",__name:"view",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"})]))}}),v=Xe,Ye=e.defineComponent({name:"Warning",__name:"warning",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768m48-176a48 48 0 1 1-96 0 48 48 0 0 1 96 0m-48-464a32 32 0 0 1 32 32v288a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"})]))}}),ve=Ye;const et=e.defineComponent({name:"ZxtForm",inheritAttrs:!1,props:{formColumns:{type:Array,default:()=>[]},initialFormData:{type:Object,default:()=>({})},rules:{type:Object,default:()=>({})},labelWidth:{type:String,default:"100px"}},emits:["submit","reset"],setup(t,{emit:o,expose:n}){const s=e.ref(null),c=e.reactive({}),p={input:"el-input",select:"el-select",date:"el-date-picker",daterange:"el-date-picker",datetime:"el-date-picker",datetimerange:"el-date-picker",cascader:"el-cascader"},l=r=>p[r]||"el-input",m=r=>{const w=r.type||"input",E=["select","date","daterange","datetime","datetimerange","cascader"].includes(w),M={placeholder:r.placeholder||`请${E?"选择":"输入"}${r.label}`,disabled:r.disabled,style:"width: 100%","popper-class":"zxt-form-popper"};let S={};switch(w){case"date":case"daterange":case"datetime":case"datetimerange":S={type:r.dateType||w,startPlaceholder:r.startPlaceholder||"开始日期",endPlaceholder:r.endPlaceholder||"结束日期",format:r.format,valueFormat:r.valueFormat};break;case"cascader":S={options:r.options,props:r.cascaderProps,clearable:r.clearable!==!1};break;default:S={}}const D={...M,...S};return"clearable"in r&&(D.clearable=r.clearable),r.props&&typeof r.props=="object"&&Object.assign(D,r.props),D},g=e.computed(()=>t.formColumns.map(r=>({...r,colSpan:{xs:r.xs??r.span??24,sm:r.sm??r.span??12,md:r.md??r.span??12,lg:r.lg??r.span??12,xl:r.xl??r.span??12}})));e.watch(()=>t.initialFormData,r=>{Object.keys(c).forEach(w=>{delete c[w]}),Object.assign(c,r)},{immediate:!0,deep:!0});const d=e.computed(()=>{const r={...t.rules};return Object.keys(r).length===0&&t.formColumns.length>0&&t.formColumns.forEach(w=>{if(w.required){const E=["select","date","daterange","datetime","datetimerange","cascader"].includes(w.type);r[w.prop]=[{required:!0,message:`请${E?"选择":"输入"}${w.label}`,trigger:E?"change":"blur"}]}}),r}),u=()=>{s.value&&s.value.validate(r=>{r&&o("submit",{...c})})},i=()=>{s.value&&s.value.resetFields(),o("reset")},C=r=>()=>Ee(r,c,{})||null;return n({validate:()=>s.value?s.value.validate():Promise.resolve(!1),resetFields:()=>s.value&&s.value.resetFields(),getFormData:()=>({...c}),submitForm:u,resetForm:i}),{formRef:s,formData:c,formRules:d,submitForm:u,resetForm:i,processedColumns:g,getComponentType:l,getComponentProps:m,renderCustomItem:C}}}),tt={class:"zxt-form-container"},ot={key:0,class:"form-label"},nt={class:"form-control"};function at(t,o,n,s,c,p){const l=e.resolveComponent("el-option"),m=e.resolveComponent("el-form-item"),g=e.resolveComponent("el-col"),d=e.resolveComponent("el-row"),u=e.resolveComponent("el-form");return e.openBlock(),e.createElementBlock("div",tt,[e.createVNode(u,e.mergeProps({ref:"formRef"},t.$attrs,{model:t.formData,rules:t.formRules,"label-width":t.labelWidth,class:"zxt-form"}),{default:e.withCtx(()=>[e.createVNode(d,{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.processedColumns,(i,C)=>(e.openBlock(),e.createBlock(g,e.mergeProps({key:C},{ref_for:!0},i.colSpan),{default:e.withCtx(()=>[e.createVNode(m,{prop:i.prop,required:i.required,"label-width":"0",class:"custom-form-item"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["form-item-wrapper",{"is-action":i.isAction}])},[i.label?(e.openBlock(),e.createElementBlock("span",ot,e.toDisplayString(i.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",nt,[i.type==="slot"?e.renderSlot(t.$slots,i.slotName||i.prop,{key:0,formData:t.formData,column:i},void 0,!0):i.itemRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.renderCustomItem(i)),{key:1})):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.getComponentType(i.type)),e.mergeProps({key:2,modelValue:t.formData[i.prop],"onUpdate:modelValue":r=>t.formData[i.prop]=r},{ref_for:!0},t.getComponentProps(i),e.toHandlers(i.events||{})),{default:e.withCtx(()=>[i.type==="select"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(i.options,(r,w)=>(e.openBlock(),e.createBlock(l,{key:w,label:r.label,value:r.value},null,8,["label","value"]))),128)):e.createCommentVNode("",!0)]),_:2},1040,["modelValue","onUpdate:modelValue"]))])],2)]),_:2},1032,["prop","required"])]),_:2},1040))),128))]),_:3})]),_:3},16,["model","rules","label-width"])])}const I=P(et,[["render",at],["__scopeId","data-v-6b22a57b"]]),rt={Plus:Q,Delete:G,Refresh:H,Download:J,Search:j,Edit:K,View:v,Upload:Y,Setting:X,Warning:ve,Check:Pe,Close:Ne,Document:Le,CopyDocument:Re,Share:Ge,Lock:He,Unlock:Ke,ArrowDown:fe},lt=e.defineComponent({name:"ActionColumn",components:{ArrowDown:fe},props:{buttons:{type:Array,default:()=>[]},row:{type:Object,default:()=>({})},maxVisible:{type:Number,default:2}},emits:["action-click"],setup(t,{emit:o}){const n=e.computed(()=>t.buttons.filter(d=>typeof d.visible=="function"?d.visible(t.row):typeof d.visible=="boolean"?d.visible:!0)),s=e.computed(()=>n.value.length>t.maxVisible),c=e.computed(()=>s.value?n.value.slice(0,t.maxVisible):n.value),p=e.computed(()=>s.value?n.value.slice(t.maxVisible):[]);return{visibleButtons:c,overflowButtons:p,getIconComponent:d=>{if(d)return typeof d=="object"||typeof d=="function"?d:rt[d]},handleClick:d=>{o("action-click",{code:d.code,button:d,row:t.row})},handleCommand:d=>{o("action-click",{code:d.code,button:d,row:t.row})}}}}),st={class:"action-column"};function it(t,o,n,s,c,p){const l=e.resolveComponent("el-button"),m=e.resolveComponent("ArrowDown"),g=e.resolveComponent("el-icon"),d=e.resolveComponent("el-dropdown-item"),u=e.resolveComponent("el-dropdown-menu"),i=e.resolveComponent("el-dropdown");return e.openBlock(),e.createElementBlock("div",st,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.visibleButtons,C=>(e.openBlock(),e.createBlock(l,{key:C.code,type:C.type||"",icon:t.getIconComponent(C.icon),size:"small",link:"",onClick:r=>t.handleClick(C)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C.label),1)]),_:2},1032,["type","icon","onClick"]))),128)),t.overflowButtons.length?(e.openBlock(),e.createBlock(i,{key:0,trigger:"hover",onCommand:t.handleCommand},{dropdown:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.overflowButtons,C=>(e.openBlock(),e.createBlock(d,{key:C.code,command:C,icon:t.getIconComponent(C.icon)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C.label),1)]),_:2},1032,["command","icon"]))),128))]),_:1})]),default:e.withCtx(()=>[e.createVNode(l,{type:"",size:"small",link:""},{default:e.withCtx(()=>[o[0]||(o[0]=e.createTextVNode(" 更多 ",-1)),e.createVNode(g,{class:"el-icon--right"},{default:e.withCtx(()=>[e.createVNode(m)]),_:1})]),_:1})]),_:1},8,["onCommand"])):e.createCommentVNode("",!0)])}const ct=P(lt,[["render",it],["__scopeId","data-v-6d75a891"]]),dt=e.defineComponent({name:"ZxtGrid",inheritAttrs:!1,components:{ZxtTable:b,ZxtForm:I,ActionColumn:ct,Plus:Q,Delete:G,Refresh:H,Download:J,Search:j,Edit:K,View:v,Upload:Y,Setting:X},props:{gridOptions:{type:Object,default:()=>({id:"grid",columns:[],data:[],height:400,pageable:!0,pageSizes:[10,20,50,100],paginationLayout:"total, sizes, prev, pager, next, jumper",toolbar:null,formMode:!1,formColumns:[],rules:{}})},externalData:{type:Array,default:()=>[]}},emits:["toolbar-click","action-click","submit","reset","page-change","size-change"],setup(t,{emit:o,expose:n}){const s=e.useAttrs(),c=e.useSlots(),p=e.ref(null),l=e.ref(null),m=e.ref(1),g=e.ref(10),d=e.ref(null),u=e.ref(t.gridOptions.formMode!==!1),i=e.ref({...t.gridOptions.formConfig?.data||{}}),C={Plus:Q,Delete:G,Refresh:H,Download:J,Search:j,Edit:K,View:v,Upload:Y,Setting:X},r=e.computed(()=>{const f=(t.gridOptions.columns||[]).find(B=>B.actionColumn);return f?f.actionColumn:null}),w=e.computed(()=>(t.gridOptions.columns||[]).map(f=>f.actionColumn?{...f,slot:"__action__",actionColumn:void 0}:f)),E=a=>{o("action-click",a)},M=e.computed(()=>{const a=t.gridOptions.formConfig;if(!a||!a.items)return[];const f=[...a.items];return f.some(me=>me.type==="slot"&&me.slotName==="search-actions")||f.push({type:"slot",slotName:"search-actions",span:6,labelWidth:"0px",isAction:!0,...a.actionConfig}),f}),S=e.computed(()=>{const a=new Set(["search-actions"]);return(M.value||[]).forEach(f=>{f.type==="slot"&&a.add(f.slotName||f.prop)}),a}),D=e.computed(()=>{const a={};for(const f in c)f==="search-actions"||f==="toolbar"||(S.value.has(f)||f.startsWith("form-"))&&(a[f]=c[f]);return a}),te=e.computed(()=>{const a={};for(const f in c)f!=="toolbar"&&!S.value.has(f)&&!f.startsWith("form-")&&(a[f]=c[f]);return a}),x=()=>{l.value?.submitForm()},q=a=>{o("submit",a),t.gridOptions.proxyConfig&&(i.value={...a},m.value=1,p.value?.reload?.({formData:i.value,page:1}))},oe=()=>{l.value?.resetForm()},ne=()=>{o("reset"),t.gridOptions.proxyConfig&&(i.value={},m.value=1,p.value?.reload?.({formData:{},page:1}))},ae=a=>{if(a)return typeof a=="object"||typeof a=="function"?a:C[a]},h=e.computed(()=>{const a=t.gridOptions.proxyConfig;return a?{...a,_formData:i.value}:null}),y=e.computed(()=>{const{formConfig:a,toolbar:f,formMode:B,formColumns:me,rules:yt,data:bt,proxyConfig:wt,..._t}=t.gridOptions;return{..._t,proxyConfig:h.value||wt||null}}),$=e.computed(()=>d.value!==null?d.value:t.externalData.length>0?t.externalData:t.gridOptions.data||[]),R=e.computed(()=>!!t.gridOptions.proxyConfig),re=e.computed(()=>R.value?0:$.value.length),le=(a,f)=>{o("toolbar-click",{code:a,button:f,grid:p.value})},se=a=>{m.value=a.page,o("page-change",a)},ie=a=>{g.value=a.size,o("size-change",a)},ce=()=>p.value,T=()=>l.value,z=()=>p.value?.getTableRef()?.getSelectionRows?.()||[],Z=a=>{d.value=a??null},de=a=>{u.value=a},pe=(a,f=!0)=>{const B=t.gridOptions.formConfig;B?.data&&Object.assign(B.data,a),i.value={...B?.data||{},...a},f&&t.gridOptions.proxyConfig&&(m.value=1,p.value?.reload?.({formData:i.value,page:1}))},U=(a,...f)=>{const B=i.value;switch(a){case"query":m.value=1,p.value?.reload?.({formData:B,page:1});break;case"reload":p.value?.reload?.({formData:B});break;default:console.warn(`[ZxtGrid] commitProxy: unknown type "${a}"`)}};e.watch(()=>t.gridOptions.formMode,a=>{a!==void 0&&(u.value=a)}),e.onMounted(()=>{t.gridOptions.proxyConfig&&t.gridOptions.autoLoad!==!1&&p.value?.reload?.({formData:i.value,page:1})});const _=()=>p.value?.getTableRef?.();return n({getGridRef:ce,getFormRef:T,getElTableRef:_,getSelectedRows:z,reloadData:Z,setFormVisible:de,setFormData:pe,commitProxy:U,clearSelection:()=>_()?.clearSelection(),toggleRowSelection:(...a)=>_()?.toggleRowSelection(...a),toggleAllSelection:()=>_()?.toggleAllSelection(),toggleRowExpansion:(...a)=>_()?.toggleRowExpansion(...a),setCurrentRow:(...a)=>_()?.setCurrentRow(...a),clearSort:()=>_()?.clearSort(),clearFilter:(...a)=>_()?.clearFilter(...a),doLayout:()=>_()?.doLayout(),sort:(...a)=>_()?.sort(...a)}),{attrs:s,gridRef:p,searchFormRef:l,currentPage:m,pageSize:g,tableData:$,tableProps:y,mergedColumns:w,actionColumnConfig:r,total:re,isFormVisible:u,searchFormColumns:M,formFilteredSlots:D,tableFilteredSlots:te,getIconComponent:ae,handleToolbarClick:le,handleActionClick:E,handlePageChange:se,handleSizeChange:ie,handleSearch:x,handleSearchSubmit:q,handleReset:oe,handleSearchReset:ne,Search:j,Refresh:H}}}),pt={key:0,class:"grid-search-form"},mt={class:"search-btn-group"},ft={class:"grid-table-wrapper"},gt={key:0,class:"grid-toolbar"};function ut(t,o,n,s,c,p){const l=e.resolveComponent("el-button"),m=e.resolveComponent("ZxtForm"),g=e.resolveComponent("ActionColumn"),d=e.resolveComponent("ZxtTable");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["zxt-grid-container",{"zxt-grid-container--full":t.gridOptions.height==="full"}])},[t.gridOptions.formConfig&&t.isFormVisible?(e.openBlock(),e.createElementBlock("div",pt,[e.createVNode(m,{ref:"searchFormRef","form-columns":t.searchFormColumns,"initial-form-data":t.gridOptions.formConfig.data,rules:t.gridOptions.formConfig.rules,onSubmit:t.handleSearchSubmit,onReset:t.handleSearchReset},e.createSlots({"search-actions":e.withCtx(()=>[e.createElementVNode("div",mt,[e.createVNode(l,{class:"btn-search",icon:t.Search,onClick:t.handleSearch},{default:e.withCtx(()=>[...o[0]||(o[0]=[e.createTextVNode(" 查询 ",-1)])]),_:1},8,["icon","onClick"]),e.createVNode(l,{class:"btn-reset",icon:t.Refresh,onClick:t.handleReset},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode(" 重置 ",-1)])]),_:1},8,["icon","onClick"])])]),_:2},[e.renderList(t.formFilteredSlots,(u,i)=>({name:i,fn:e.withCtx(C=>[e.renderSlot(t.$slots,i,e.normalizeProps(e.guardReactiveProps(C)),void 0,!0)])}))]),1032,["form-columns","initial-form-data","rules","onSubmit","onReset"])])):e.createCommentVNode("",!0),e.createElementVNode("div",ft,[t.gridOptions.toolbar?(e.openBlock(),e.createElementBlock("div",gt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.gridOptions.toolbar.buttons,(u,i)=>(e.openBlock(),e.createBlock(l,{key:i,type:u.type||"default",size:u.size||"small",icon:t.getIconComponent(u.icon),disabled:u.disabled,onClick:C=>t.handleToolbarClick(u.code,u)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.name),1)]),_:2},1032,["type","size","icon","disabled","onClick"]))),128)),e.renderSlot(t.$slots,"toolbar",{grid:t.$refs.gridRef},void 0,!0)])):e.createCommentVNode("",!0),e.createVNode(d,e.mergeProps({ref:"gridRef"},{...t.tableProps,...t.attrs},{id:t.gridOptions.id,columns:t.mergedColumns,data:t.tableData,height:t.gridOptions.height,"auto-load":!1,pageable:t.gridOptions.pageable!==!1,"current-page":t.currentPage,"page-size":t.pageSize,"page-sizes":t.gridOptions.pageSizes,total:t.total,"pagination-layout":t.gridOptions.paginationLayout,onPageChange:t.handlePageChange,onSizeChange:t.handleSizeChange}),e.createSlots({_:2},[t.actionColumnConfig?{name:"__action__",fn:e.withCtx(({row:u})=>[e.createVNode(g,{buttons:t.actionColumnConfig.buttons,row:u,"max-visible":t.actionColumnConfig.maxVisible||2,onActionClick:t.handleActionClick},null,8,["buttons","row","max-visible","onActionClick"])]),key:"0"}:void 0,e.renderList(t.tableFilteredSlots,(u,i)=>({name:i,fn:e.withCtx(C=>[e.renderSlot(t.$slots,i,e.normalizeProps(e.guardReactiveProps(C)),void 0,!0)])}))]),1040,["id","columns","data","height","pageable","current-page","page-size","page-sizes","total","pagination-layout","onPageChange","onSizeChange"])])],2)}const ee=P(dt,[["render",ut],["__scopeId","data-v-f8b2d913"]]);F.install=function(t){t.component(F.name,F)};const ht=[A,L,b,ee,I,F],Ct={install:t=>{ht.forEach(o=>{t.component(o.name,o)})},MyButton:A,JsxButton:L,ZxtTable:b,ZxtGrid:ee,ZxtForm:I,ZxtPagination:F,renderer:b.renderer,registerRenderer:b.registerRenderer};k.JsxButton=L,k.MyButton=A,k.ZxtForm=I,k.ZxtGrid=ee,k.ZxtPagination=F,k.ZxtTable=b,k.default=Ct,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(k,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(k=typeof globalThis<"u"?globalThis:k||self,e(k.ZxtTable={},k.Vue,k.ElementPlus))})(this,(function(k,e,V){"use strict";const P=(t,o)=>{const n=t.__vccOpts||t;for(const[i,c]of o)n[i]=c;return n},ge={name:"MyButton",props:{type:{type:String,default:"default",validator:t=>["default","primary","success","warning","danger"].includes(t)},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:o}){return{handleClick:i=>{o("click",i)}}}},ue=["disabled"];function he(t,o,n,i,c,p){return e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["my-button",[`my-button--${n.type}`,{"is-disabled":n.disabled}]]),disabled:n.disabled,onClick:o[0]||(o[0]=(...l)=>i.handleClick&&i.handleClick(...l))},[e.renderSlot(t.$slots,"default",{},void 0,!0)],10,ue)}const A=P(ge,[["render",he],["__scopeId","data-v-4480e77d"]]);A.install=function(t){t.component(A.name,A)};const L=e.defineComponent({name:"JsxButton",props:{type:{type:String,default:"default",validator:t=>["default","primary","success","warning","danger"].includes(t)},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:o,slots:n}){const i=c=>{t.disabled||o("click",c)};return()=>e.createVNode("button",{class:["jsx-button",`jsx-button--${t.type}`,{"is-disabled":t.disabled}],disabled:t.disabled,onClick:i},[n.default?.()])}});L.install=function(t){t.component(L.name,L)};const Ce=e.defineComponent({name:"ZxtPagination",components:{ElPagination:V.ElPagination},props:{modelValue:{type:Number,default:1},pageSize:{type:Number,default:10},pageSizes:{type:Array,default:()=>[10,20,50,100]},total:{type:Number,default:0},layout:{type:String,default:"total, sizes, prev, pager, next, jumper"}},emits:["update:modelValue","update:pageSize","page-change","size-change"],setup(t,{emit:o}){const n=e.ref(t.modelValue),i=e.ref(t.pageSize);return e.watch(()=>t.modelValue,l=>{n.value=l}),e.watch(()=>t.pageSize,l=>{i.value=l}),{currentPage:n,pageSize:i,handleSizeChange:l=>{i.value=l,n.value=1,o("update:pageSize",l),o("size-change",{page:n.value,size:l})},handleCurrentChange:l=>{n.value=l,o("update:modelValue",l),o("page-change",{page:l,size:i.value})}}}});function we(t,o,n,i,c,p){const l=e.resolveComponent("el-pagination");return e.openBlock(),e.createBlock(l,{"current-page":t.currentPage,"onUpdate:currentPage":o[0]||(o[0]=m=>t.currentPage=m),"page-size":t.pageSize,"onUpdate:pageSize":o[1]||(o[1]=m=>t.pageSize=m),"page-sizes":t.pageSizes,total:t.total,layout:t.layout,class:"zxt-pagination",onSizeChange:t.handleSizeChange,onCurrentChange:t.handleCurrentChange},null,8,["current-page","page-size","page-sizes","total","layout","onSizeChange","onCurrentChange"])}const F=P(Ce,[["render",we],["__scopeId","data-v-497aa44d"]]),O={default:({cellValue:t})=>t??"",input:({cellValue:t,row:o,column:n,updateRow:i})=>e.h(V.ElInput,{modelValue:t,size:"small",onInput:c=>i({...o,[n.property]:c})}),select:({cellValue:t,row:o,column:n,updateRow:i,options:c=[]})=>e.h(V.ElSelect,{modelValue:t,size:"small",onChange:p=>i({...o,[n.property]:p})},()=>c.map(p=>e.h(V.ElOption,{label:p.label,value:p.value,key:p.value}))),checkbox:({cellValue:t,row:o,column:n,updateRow:i})=>e.h(V.ElCheckbox,{modelValue:!!t,onChange:c=>i({...o,[n.property]:c})}),link:({cellValue:t,href:o,target:n="_blank"})=>e.h(V.ElLink,{href:o,target:n},()=>t)};function _e(t,o){if(!t)return null;if(typeof t=="string"){const n=O[t];return n?n(o):(console.warn(`[ZxtTable] 未找到内置渲染器: ${t}`),o.cellValue??"")}if(typeof t=="function")return t(o);if(typeof t=="object"&&!Array.isArray(t)){const{name:n,props:i={},attrs:c={},events:p={},content:l}=t;return typeof n=="string"&&O[n]?O[n]({...o,...i,...c,...p}):typeof n=="object"||typeof n=="function"?e.h(n,{...i,...c,...p},l):(console.warn("[ZxtTable] cellRender 对象缺少有效的 name 字段"),o.cellValue??"")}return o.cellValue??""}function ke(t,o){O[t]&&console.warn(`[ZxtTable] 内置渲染器 ${t} 已被覆盖`),O[t]=o}const ye=e.defineComponent({name:"ZxtTableColumn",components:{ElTableColumn:V.ElTableColumn},props:{column:{type:Object,required:!0},currentPage:{type:Number,default:1},pageSize:{type:Number,default:10}},setup(t){const o=e.inject("updateRow",()=>{}),n=l=>{const{currentPage:m,pageSize:f}=t;return(m-1)*f+l+1},i=e.computed(()=>{const l=t.column;return{...l,prop:l.prop??l.field,label:l.label??l.title}}),c=e.computed(()=>{const{children:l,...m}=i.value;return m});return{normalizedColumn:i,columnProps:c,renderCell:l=>{const m=i.value,f=l.row[m.prop],d=f??m.defaultValue??"";return _e(m.cellRender,{row:l.row,column:m,rowIndex:l.$index,cellValue:d,updateRow:u=>o(u,l.$index)})},defaultIndexMethod:n}}});function be(t,o,n,i,c,p){const l=e.resolveComponent("ZxtTableColumn",!0),m=e.resolveComponent("el-table-column");return t.normalizedColumn.children&&t.normalizedColumn.children.length?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0},t.columnProps,{key:t.normalizedColumn.prop+"-group"}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.normalizedColumn.children,(f,d)=>(e.openBlock(),e.createBlock(l,{key:d,column:f,"current-page":t.currentPage,"page-size":t.pageSize},e.createSlots({_:2},[e.renderList(t.$slots,(u,s)=>({name:s,fn:e.withCtx(C=>[e.renderSlot(t.$slots,s,e.mergeProps({ref_for:!0},C))])}))]),1032,["column","current-page","page-size"]))),128))]),_:3},16)):(e.openBlock(),e.createBlock(m,e.mergeProps({key:1},t.columnProps,{key:t.normalizedColumn.prop,index:t.normalizedColumn.indexMethod||t.defaultIndexMethod}),e.createSlots({_:2},[t.normalizedColumn.headerSlot?{name:"header",fn:e.withCtx(f=>[e.renderSlot(t.$slots,t.normalizedColumn.headerSlot,e.mergeProps({column:t.normalizedColumn},f))]),key:"0"}:void 0,!["selection","index"].includes(t.normalizedColumn.type)&&(t.normalizedColumn.type!=="expand"||t.normalizedColumn.slot)?{name:"default",fn:e.withCtx(f=>[t.normalizedColumn.slot?e.renderSlot(t.$slots,t.normalizedColumn.slot,{key:0,row:f.row,index:f.$index,column:t.normalizedColumn}):t.normalizedColumn.cellRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.renderCell(f)),{key:1})):t.normalizedColumn.formatter?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(t.normalizedColumn.formatter(f.row,t.normalizedColumn,f.row[t.normalizedColumn.prop],f.$index)),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createTextVNode(e.toDisplayString(f.row[t.normalizedColumn.prop]),1)],64))]),key:"1"}:void 0]),1040,["index"]))}const ze=P(ye,[["render",be]]),Be=e.defineComponent({name:"ZxtTable",inheritAttrs:!1,components:{ZxtPagination:F,ZxtTableColumn:ze,ElTable:V.ElTable},props:{id:{type:String,default:""},columns:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},height:{type:[String,Number],default:""},pageable:{type:Boolean,default:!0},currentPage:{type:Number,default:1},pageSize:{type:Number,default:10},pageSizes:{type:Array,default:()=>[10,20,50,100]},total:{type:Number,default:0},paginationLayout:{type:String,default:"total, sizes, prev, pager, next, jumper"},proxyConfig:{type:Object,default:null},autoLoad:{type:Boolean,default:!0}},emits:["page-change","size-change","sort-change","filter-change","loaded","load-error","update:row"],setup(t,{emit:o}){const n=e.ref(null),i=e.ref(t.pageSize),c=e.ref(t.currentPage),p=e.ref(!1),l=e.ref([]),m=e.ref(0),f=e.ref({prop:"",order:""}),d=e.ref({}),u=e.ref({});e.watch(()=>t.currentPage,h=>{c.value=h}),e.watch(()=>t.pageSize,h=>{i.value=h});const s=e.computed(()=>t.height==="full"?{height:"100%"}:{}),C=e.computed(()=>{if(t.height!=="full")return t.height}),r=e.computed(()=>!!t.proxyConfig),w=e.computed(()=>r.value?m.value:t.total>0?t.total:t.data.length),E=e.computed(()=>r.value?l.value:t.data),M=h=>{r.value&&(c.value=h.page,i.value=h.size,$()),o("size-change",h)},S=h=>{r.value&&(c.value=h.page,i.value=h.size,$()),o("page-change",h)},D=({column:h,prop:y,order:x})=>{f.value={prop:y,order:x},r.value&&$(),o("sort-change",{column:h,prop:y,order:x})},te=h=>{d.value=h||{},r.value&&$(),o("filter-change",d.value)},$=async h=>{if(!r.value)return;const y=t.proxyConfig||{},x=y.ajax?.query;if(typeof x!="function")return;const R=y.props||{},re=R.pageField||"page";R.sizeField;const le=R.sortField||"sort",ie=R.orderField||"order",se=R.filtersField||"filters";h?.formData!==void 0?u.value=h.formData:y._formData&&(u.value=y._formData);const ce=y.params||{},T={[re]:{currentPage:h?.page??c.value,pageSize:h?.pageSize??i.value},form:u.value,...ce};f.value?.prop&&(T[le]=f.value.prop,T[ie]=f.value.order),d.value&&Object.keys(d.value).length&&(T[se]=d.value),p.value=!0;try{const z=await x(T),Z=y.response||{},de=Z.listField||"list",pe=Z.totalField||"total",U=Z.transform;let _=[],a=0;if(typeof U=="function"){const g=U(z);_=g?.list??[],a=g?.total??0}else z&&typeof z=="object"&&(_=z?.[de]??z?.data??[],a=z?.[pe]??z?.total??0);l.value=Array.isArray(_)?_:[],m.value=Number(a)||0,o("loaded",{data:l.value,total:m.value,payload:T})}catch(z){o("load-error",z)}finally{p.value=!1}},q=(h,y)=>{r.value?l.value.splice(y,1,h):o("update:row",{index:y,row:h})};e.provide("updateRow",q),e.onMounted(()=>{r.value&&t.autoLoad&&$()});const oe=()=>n.value,ne=()=>n.value?.getSelectionRows?.()||[],ae=h=>$(h);return{tableRef:n,containerStyle:s,tableHeight:C,getTableRef:oe,pageSize:i,currentPage:c,loading:p,renderData:E,total:w,pageSizes:e.computed(()=>t.pageSizes),paginationLayout:e.computed(()=>t.paginationLayout),handleSizeChange:M,handlePageChange:S,handleSortChange:D,handleFilterChange:te,reload:ae,getSelectedRows:ne,updateRow:q}}});function Se(t,o,n,i,c,p){const l=e.resolveComponent("ZxtTableColumn"),m=e.resolveComponent("el-table"),f=e.resolveComponent("ZxtPagination"),d=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["zxt-table-container",{"zxt-table-container--full":t.height==="full"}]),style:e.normalizeStyle(t.containerStyle)},[e.withDirectives((e.openBlock(),e.createBlock(m,e.mergeProps({ref:"tableRef",data:t.renderData,height:t.tableHeight},t.$attrs,{id:t.id,onSortChange:t.handleSortChange,onFilterChange:t.handleFilterChange}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,(u,s)=>(e.openBlock(),e.createBlock(l,{key:s,column:u,"current-page":t.currentPage,"page-size":t.pageSize},e.createSlots({_:2},[e.renderList(t.$slots,(C,r)=>({name:r,fn:e.withCtx(w=>[e.renderSlot(t.$slots,r,e.mergeProps({ref_for:!0},w),void 0,!0)])}))]),1032,["column","current-page","page-size"]))),128))]),_:3},16,["data","height","id","onSortChange","onFilterChange"])),[[d,t.loading]]),t.pageable?(e.openBlock(),e.createBlock(f,{key:0,"model-value":t.currentPage,"page-size":t.pageSize,"onUpdate:pageSize":o[0]||(o[0]=u=>t.pageSize=u),"page-sizes":t.pageSizes,total:t.total,layout:t.paginationLayout,onPageChange:t.handlePageChange,onSizeChange:t.handleSizeChange},null,8,["model-value","page-size","page-sizes","total","layout","onPageChange","onSizeChange"])):e.createCommentVNode("",!0)],6)}const b=P(Be,[["render",Se],["__scopeId","data-v-ebf6786f"]]),N=new Map;class Ve{add(o,n){return!o||typeof o!="string"?(console.warn("[ZxtTable] 渲染器名称必须是字符串"),this):!n||typeof n!="object"?(console.warn("[ZxtTable] 渲染器配置必须是对象"),this):(N.has(o)&&console.warn(`[ZxtTable] 渲染器 "${o}" 已存在,将被覆盖`),N.set(o,n),this)}get(o){return N.get(o)}delete(o){return N.delete(o)}has(o){return N.has(o)}getAll(){return Array.from(N.keys())}clear(){N.clear()}}const W=new Ve;function Ee(t,o,n={}){if(!t||!t.itemRender)return null;const{name:i}=t.itemRender;if(i&&W.has(i)){const c=W.get(i);if(typeof c.renderItemContent=="function"){const p={data:o,field:t.field||t.prop,item:t,formData:o};try{return c.renderItemContent(n,p)}catch(l){return console.error(`[ZxtTable] 渲染器 "${i}" 执行出错:`,l),null}}}return null}b.install=function(t){t.component(b.name,b)},b.registerRenderer=ke,b.renderer=W;var $e=e.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"})]))}}),fe=$e,xe=e.defineComponent({name:"Check",__name:"check",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"})]))}}),Pe=xe,Fe=e.defineComponent({name:"Close",__name:"close",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),Ne=Fe,De=e.defineComponent({name:"CopyDocument",__name:"copy-document",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M768 832a128 128 0 0 1-128 128H192A128 128 0 0 1 64 832V384a128 128 0 0 1 128-128v64a64 64 0 0 0-64 64v448a64 64 0 0 0 64 64h448a64 64 0 0 0 64-64z"}),e.createElementVNode("path",{fill:"currentColor",d:"M384 128a64 64 0 0 0-64 64v448a64 64 0 0 0 64 64h448a64 64 0 0 0 64-64V192a64 64 0 0 0-64-64zm0-64h448a128 128 0 0 1 128 128v448a128 128 0 0 1-128 128H384a128 128 0 0 1-128-128V192A128 128 0 0 1 384 64"})]))}}),Re=De,Te=e.defineComponent({name:"Delete",__name:"delete",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),G=Te,Ae=e.defineComponent({name:"Document",__name:"document",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"})]))}}),Le=Ae,Me=e.defineComponent({name:"Download",__name:"download",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"})]))}}),J=Me,Oe=e.defineComponent({name:"Edit",__name:"edit",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"}),e.createElementVNode("path",{fill:"currentColor",d:"m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"})]))}}),K=Oe,Ze=e.defineComponent({name:"Lock",__name:"lock",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M224 448a32 32 0 0 0-32 32v384a32 32 0 0 0 32 32h576a32 32 0 0 0 32-32V480a32 32 0 0 0-32-32zm0-64h576a96 96 0 0 1 96 96v384a96 96 0 0 1-96 96H224a96 96 0 0 1-96-96V480a96 96 0 0 1 96-96"}),e.createElementVNode("path",{fill:"currentColor",d:"M512 544a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V576a32 32 0 0 1 32-32m192-160v-64a192 192 0 1 0-384 0v64zM512 64a256 256 0 0 1 256 256v128H256V320A256 256 0 0 1 512 64"})]))}}),He=Ze,je=e.defineComponent({name:"Plus",__name:"plus",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),Q=je,Ie=e.defineComponent({name:"Refresh",__name:"refresh",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"})]))}}),H=Ie,qe=e.defineComponent({name:"Search",__name:"search",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"})]))}}),j=qe,Ue=e.defineComponent({name:"Setting",__name:"setting",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357 357 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a352 352 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357 357 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294 294 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293 293 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294 294 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288 288 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293 293 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a288 288 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384m0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256"})]))}}),X=Ue,We=e.defineComponent({name:"Share",__name:"share",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m679.872 348.8-301.76 188.608a127.8 127.8 0 0 1 5.12 52.16l279.936 104.96a128 128 0 1 1-22.464 59.904l-279.872-104.96a128 128 0 1 1-16.64-166.272l301.696-188.608a128 128 0 1 1 33.92 54.272z"})]))}}),Ge=We,Je=e.defineComponent({name:"Unlock",__name:"unlock",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M224 448a32 32 0 0 0-32 32v384a32 32 0 0 0 32 32h576a32 32 0 0 0 32-32V480a32 32 0 0 0-32-32zm0-64h576a96 96 0 0 1 96 96v384a96 96 0 0 1-96 96H224a96 96 0 0 1-96-96V480a96 96 0 0 1 96-96"}),e.createElementVNode("path",{fill:"currentColor",d:"M512 544a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V576a32 32 0 0 1 32-32m178.304-295.296A192.064 192.064 0 0 0 320 320v64h352l96 38.4V448H256V320a256 256 0 0 1 493.76-95.104z"})]))}}),Ke=Je,Qe=e.defineComponent({name:"Upload",__name:"upload",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248z"})]))}}),Y=Qe,Xe=e.defineComponent({name:"View",__name:"view",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"})]))}}),v=Xe,Ye=e.defineComponent({name:"Warning",__name:"warning",setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768m48-176a48 48 0 1 1-96 0 48 48 0 0 1 96 0m-48-464a32 32 0 0 1 32 32v288a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"})]))}}),ve=Ye;const et=e.defineComponent({name:"ZxtForm",inheritAttrs:!1,props:{formColumns:{type:Array,default:()=>[]},initialFormData:{type:Object,default:()=>({})},rules:{type:Object,default:()=>({})},labelWidth:{type:String,default:"100px"}},emits:["submit","reset"],setup(t,{emit:o,expose:n}){const i=e.ref(null),c=e.reactive({}),p={input:"el-input",select:"el-select",date:"el-date-picker",daterange:"el-date-picker",datetime:"el-date-picker",datetimerange:"el-date-picker",cascader:"el-cascader"},l=r=>p[r]||"el-input",m=r=>{const w=r.type||"input",E=["select","date","daterange","datetime","datetimerange","cascader"].includes(w),M={placeholder:r.placeholder||`请${E?"选择":"输入"}${r.label}`,disabled:r.disabled,style:"width: 100%","popper-class":"zxt-form-popper"};let S={};switch(w){case"date":case"daterange":case"datetime":case"datetimerange":S={type:r.dateType||w,startPlaceholder:r.startPlaceholder||"开始日期",endPlaceholder:r.endPlaceholder||"结束日期",format:r.format,valueFormat:r.valueFormat};break;case"cascader":S={options:r.options,props:r.cascaderProps,clearable:r.clearable!==!1};break;default:S={}}const D={...M,...S};return"clearable"in r&&(D.clearable=r.clearable),r.props&&typeof r.props=="object"&&Object.assign(D,r.props),D},f=e.computed(()=>t.formColumns.map(r=>({...r,colSpan:{xs:r.xs??r.span??24,sm:r.sm??r.span??12,md:r.md??r.span??12,lg:r.lg??r.span??12,xl:r.xl??r.span??12}})));e.watch(()=>t.initialFormData,r=>{Object.keys(c).forEach(w=>{delete c[w]}),Object.assign(c,r)},{immediate:!0,deep:!0});const d=e.computed(()=>{const r={...t.rules};return Object.keys(r).length===0&&t.formColumns.length>0&&t.formColumns.forEach(w=>{if(w.required){const E=["select","date","daterange","datetime","datetimerange","cascader"].includes(w.type);r[w.prop]=[{required:!0,message:`请${E?"选择":"输入"}${w.label}`,trigger:E?"change":"blur"}]}}),r}),u=()=>{i.value&&i.value.validate(r=>{r&&o("submit",{...c})})},s=()=>{i.value&&i.value.resetFields(),o("reset")},C=r=>()=>Ee(r,c,{})||null;return n({validate:()=>i.value?i.value.validate():Promise.resolve(!1),resetFields:()=>i.value&&i.value.resetFields(),getFormData:()=>({...c}),submitForm:u,resetForm:s}),{formRef:i,formData:c,formRules:d,submitForm:u,resetForm:s,processedColumns:f,getComponentType:l,getComponentProps:m,renderCustomItem:C}}}),tt={class:"zxt-form-container"},ot={key:0,class:"form-label"},nt={class:"form-control"};function at(t,o,n,i,c,p){const l=e.resolveComponent("el-option"),m=e.resolveComponent("el-form-item"),f=e.resolveComponent("el-col"),d=e.resolveComponent("el-row"),u=e.resolveComponent("el-form");return e.openBlock(),e.createElementBlock("div",tt,[e.createVNode(u,e.mergeProps({ref:"formRef"},t.$attrs,{model:t.formData,rules:t.formRules,"label-width":t.labelWidth,class:"zxt-form"}),{default:e.withCtx(()=>[e.createVNode(d,{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.processedColumns,(s,C)=>(e.openBlock(),e.createBlock(f,e.mergeProps({key:C},{ref_for:!0},s.colSpan),{default:e.withCtx(()=>[e.createVNode(m,{prop:s.prop,required:s.required,"label-width":"0",class:"custom-form-item"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["form-item-wrapper",{"is-action":s.isAction}])},[s.label?(e.openBlock(),e.createElementBlock("span",ot,e.toDisplayString(s.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",nt,[s.type==="slot"?e.renderSlot(t.$slots,s.slotName||s.prop,{key:0,formData:t.formData,column:s},void 0,!0):s.itemRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.renderCustomItem(s)),{key:1})):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.getComponentType(s.type)),e.mergeProps({key:2,modelValue:t.formData[s.prop],"onUpdate:modelValue":r=>t.formData[s.prop]=r},{ref_for:!0},t.getComponentProps(s),e.toHandlers(s.events||{})),{default:e.withCtx(()=>[s.type==="select"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(s.options,(r,w)=>(e.openBlock(),e.createBlock(l,{key:w,label:r.label,value:r.value},null,8,["label","value"]))),128)):e.createCommentVNode("",!0)]),_:2},1040,["modelValue","onUpdate:modelValue"]))])],2)]),_:2},1032,["prop","required"])]),_:2},1040))),128))]),_:3})]),_:3},16,["model","rules","label-width"])])}const I=P(et,[["render",at],["__scopeId","data-v-6b22a57b"]]),rt={Plus:Q,Delete:G,Refresh:H,Download:J,Search:j,Edit:K,View:v,Upload:Y,Setting:X,Warning:ve,Check:Pe,Close:Ne,Document:Le,CopyDocument:Re,Share:Ge,Lock:He,Unlock:Ke,ArrowDown:fe},lt=e.defineComponent({name:"ActionColumn",components:{ArrowDown:fe},props:{buttons:{type:Array,default:()=>[]},row:{type:Object,default:()=>({})},maxVisible:{type:Number,default:2}},emits:["action-click"],setup(t,{emit:o}){const n=e.computed(()=>t.buttons.filter(d=>typeof d.visible=="function"?d.visible(t.row):typeof d.visible=="boolean"?d.visible:!0)),i=e.computed(()=>n.value.length>t.maxVisible),c=e.computed(()=>i.value?n.value.slice(0,t.maxVisible):n.value),p=e.computed(()=>i.value?n.value.slice(t.maxVisible):[]);return{visibleButtons:c,overflowButtons:p,getIconComponent:d=>{if(d)return typeof d=="object"||typeof d=="function"?d:rt[d]},handleClick:d=>{o("action-click",{code:d.code,button:d,row:t.row})},handleCommand:d=>{o("action-click",{code:d.code,button:d,row:t.row})}}}}),it={class:"action-column"};function st(t,o,n,i,c,p){const l=e.resolveComponent("el-button"),m=e.resolveComponent("ArrowDown"),f=e.resolveComponent("el-icon"),d=e.resolveComponent("el-dropdown-item"),u=e.resolveComponent("el-dropdown-menu"),s=e.resolveComponent("el-dropdown");return e.openBlock(),e.createElementBlock("div",it,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.visibleButtons,C=>(e.openBlock(),e.createBlock(l,{key:C.code,type:C.type||"",icon:t.getIconComponent(C.icon),size:"small",link:"",onClick:r=>t.handleClick(C)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C.label),1)]),_:2},1032,["type","icon","onClick"]))),128)),t.overflowButtons.length?(e.openBlock(),e.createBlock(s,{key:0,trigger:"hover",onCommand:t.handleCommand},{dropdown:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.overflowButtons,C=>(e.openBlock(),e.createBlock(d,{key:C.code,command:C,icon:t.getIconComponent(C.icon)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C.label),1)]),_:2},1032,["command","icon"]))),128))]),_:1})]),default:e.withCtx(()=>[e.createVNode(l,{type:"",size:"small",link:""},{default:e.withCtx(()=>[o[0]||(o[0]=e.createTextVNode(" 更多 ",-1)),e.createVNode(f,{class:"el-icon--right"},{default:e.withCtx(()=>[e.createVNode(m)]),_:1})]),_:1})]),_:1},8,["onCommand"])):e.createCommentVNode("",!0)])}const ct=P(lt,[["render",st],["__scopeId","data-v-6d75a891"]]),dt=e.defineComponent({name:"ZxtGrid",inheritAttrs:!1,components:{ZxtTable:b,ZxtForm:I,ActionColumn:ct,Plus:Q,Delete:G,Refresh:H,Download:J,Search:j,Edit:K,View:v,Upload:Y,Setting:X},props:{gridOptions:{type:Object,default:()=>({id:"grid",columns:[],data:[],height:400,pageable:!0,pageSizes:[10,20,50,100],paginationLayout:"total, sizes, prev, pager, next, jumper",toolbar:null,formMode:!1,formColumns:[],rules:{}})},externalData:{type:Array,default:()=>[]}},emits:["toolbar-click","action-click","submit","reset","page-change","size-change"],setup(t,{emit:o,expose:n}){const i=e.useAttrs(),c=e.useSlots(),p=e.ref(null),l=e.ref(null),m=e.ref(1),f=e.ref(10),d=e.ref(null),u=e.ref(t.gridOptions.formMode!==!1),s=e.ref({...t.gridOptions.formConfig?.data||{}}),C={Plus:Q,Delete:G,Refresh:H,Download:J,Search:j,Edit:K,View:v,Upload:Y,Setting:X},r=e.computed(()=>{const g=(t.gridOptions.columns||[]).find(B=>B.actionColumn);return g?g.actionColumn:null}),w=e.computed(()=>(t.gridOptions.columns||[]).map(g=>g.actionColumn?{...g,slot:"__action__",actionColumn:void 0}:g)),E=a=>{o("action-click",a)},M=e.computed(()=>{const a=t.gridOptions.formConfig;if(!a||!a.items)return[];const g=[...a.items];return g.some(me=>me.type==="slot"&&me.slotName==="search-actions")||g.push({type:"slot",slotName:"search-actions",span:6,labelWidth:"0px",isAction:!0,...a.actionConfig}),g}),S=e.computed(()=>{const a=new Set(["search-actions"]);return(M.value||[]).forEach(g=>{g.type==="slot"&&a.add(g.slotName||g.prop)}),a}),D=e.computed(()=>{const a={};for(const g in c)g==="search-actions"||g==="toolbar"||(S.value.has(g)||g.startsWith("form-"))&&(a[g]=c[g]);return a}),te=e.computed(()=>{const a={};for(const g in c)g!=="toolbar"&&!S.value.has(g)&&!g.startsWith("form-")&&(a[g]=c[g]);return a}),$=()=>{l.value?.submitForm()},q=a=>{o("submit",a),t.gridOptions.proxyConfig&&(s.value={...a},m.value=1,p.value?.reload?.({formData:s.value,page:1}))},oe=()=>{l.value?.resetForm()},ne=()=>{o("reset"),t.gridOptions.proxyConfig&&(s.value={},m.value=1,p.value?.reload?.({formData:{},page:1}))},ae=a=>{if(a)return typeof a=="object"||typeof a=="function"?a:C[a]},h=e.computed(()=>{const a=t.gridOptions.proxyConfig;return a?{...a,_formData:s.value}:null}),y=e.computed(()=>{const{formConfig:a,toolbar:g,formMode:B,formColumns:me,rules:yt,data:bt,proxyConfig:wt,..._t}=t.gridOptions;return{..._t,proxyConfig:h.value||wt||null}}),x=e.computed(()=>d.value!==null?d.value:t.externalData.length>0?t.externalData:t.gridOptions.data||[]),R=e.computed(()=>!!t.gridOptions.proxyConfig),re=e.computed(()=>R.value?0:x.value.length),le=(a,g)=>{o("toolbar-click",{code:a,button:g,grid:p.value})},ie=a=>{m.value=a.page,o("page-change",a)},se=a=>{f.value=a.size,o("size-change",a)},ce=()=>p.value,T=()=>l.value,z=()=>p.value?.getTableRef()?.getSelectionRows?.()||[],Z=a=>{d.value=a??null},de=a=>{u.value=a},pe=(a,g=!0)=>{const B=t.gridOptions.formConfig;B?.data&&Object.assign(B.data,a),s.value={...B?.data||{},...a},g&&t.gridOptions.proxyConfig&&(m.value=1,p.value?.reload?.({formData:s.value,page:1}))},U=(a,...g)=>{const B=s.value;switch(a){case"query":m.value=1,p.value?.reload?.({formData:B,page:1});break;case"reload":p.value?.reload?.({formData:B});break;default:console.warn(`[ZxtGrid] commitProxy: unknown type "${a}"`)}};e.watch(()=>t.gridOptions.formMode,a=>{a!==void 0&&(u.value=a)}),e.onMounted(()=>{t.gridOptions.proxyConfig&&t.gridOptions.autoLoad!==!1&&p.value?.reload?.({formData:s.value,page:1})});const _=()=>p.value?.getTableRef?.();return n({getGridRef:ce,getFormRef:T,getElTableRef:_,getSelectedRows:z,reloadData:Z,setFormVisible:de,setFormData:pe,commitProxy:U,clearSelection:()=>_()?.clearSelection(),toggleRowSelection:(...a)=>_()?.toggleRowSelection(...a),toggleAllSelection:()=>_()?.toggleAllSelection(),toggleRowExpansion:(...a)=>_()?.toggleRowExpansion(...a),setCurrentRow:(...a)=>_()?.setCurrentRow(...a),clearSort:()=>_()?.clearSort(),clearFilter:(...a)=>_()?.clearFilter(...a),doLayout:()=>_()?.doLayout(),sort:(...a)=>_()?.sort(...a)}),{attrs:i,gridRef:p,searchFormRef:l,currentPage:m,pageSize:f,tableData:x,tableProps:y,mergedColumns:w,actionColumnConfig:r,total:re,isFormVisible:u,searchFormColumns:M,formFilteredSlots:D,tableFilteredSlots:te,getIconComponent:ae,handleToolbarClick:le,handleActionClick:E,handlePageChange:ie,handleSizeChange:se,handleSearch:$,handleSearchSubmit:q,handleReset:oe,handleSearchReset:ne,Search:j,Refresh:H}}}),pt={key:0,class:"grid-search-form"},mt={class:"search-btn-group"},ft={class:"grid-table-wrapper"},gt={key:0,class:"grid-toolbar"};function ut(t,o,n,i,c,p){const l=e.resolveComponent("el-button"),m=e.resolveComponent("ZxtForm"),f=e.resolveComponent("ActionColumn"),d=e.resolveComponent("ZxtTable");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["zxt-grid-container",{"zxt-grid-container--full":t.gridOptions.height==="full"}])},[t.gridOptions.formConfig&&t.isFormVisible?(e.openBlock(),e.createElementBlock("div",pt,[e.createVNode(m,{ref:"searchFormRef","form-columns":t.searchFormColumns,"initial-form-data":t.gridOptions.formConfig.data,rules:t.gridOptions.formConfig.rules,onSubmit:t.handleSearchSubmit,onReset:t.handleSearchReset},e.createSlots({"search-actions":e.withCtx(()=>[e.createElementVNode("div",mt,[e.createVNode(l,{class:"btn-search",icon:t.Search,onClick:t.handleSearch},{default:e.withCtx(()=>[...o[0]||(o[0]=[e.createTextVNode(" 查询 ",-1)])]),_:1},8,["icon","onClick"]),e.createVNode(l,{class:"btn-reset",icon:t.Refresh,onClick:t.handleReset},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode(" 重置 ",-1)])]),_:1},8,["icon","onClick"])])]),_:2},[e.renderList(t.formFilteredSlots,(u,s)=>({name:s,fn:e.withCtx(C=>[e.renderSlot(t.$slots,s,e.normalizeProps(e.guardReactiveProps(C)),void 0,!0)])}))]),1032,["form-columns","initial-form-data","rules","onSubmit","onReset"])])):e.createCommentVNode("",!0),e.createElementVNode("div",ft,[t.gridOptions.toolbar?(e.openBlock(),e.createElementBlock("div",gt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.gridOptions.toolbar.buttons,(u,s)=>(e.openBlock(),e.createBlock(l,{key:s,type:u.type||"default",size:u.size||"small",icon:t.getIconComponent(u.icon),disabled:u.disabled,onClick:C=>t.handleToolbarClick(u.code,u)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.name),1)]),_:2},1032,["type","size","icon","disabled","onClick"]))),128)),e.renderSlot(t.$slots,"toolbar",{grid:t.$refs.gridRef},void 0,!0)])):e.createCommentVNode("",!0),e.createVNode(d,e.mergeProps({ref:"gridRef"},{...t.tableProps,...t.attrs},{id:t.gridOptions.id,columns:t.mergedColumns,data:t.tableData,height:t.gridOptions.height,"auto-load":!1,pageable:t.gridOptions.pageable!==!1,"current-page":t.currentPage,"page-size":t.pageSize,"page-sizes":t.gridOptions.pageSizes,total:t.total,"pagination-layout":t.gridOptions.paginationLayout,onPageChange:t.handlePageChange,onSizeChange:t.handleSizeChange}),e.createSlots({_:2},[t.actionColumnConfig?{name:"__action__",fn:e.withCtx(({row:u})=>[e.createVNode(f,{buttons:t.actionColumnConfig.buttons,row:u,"max-visible":t.actionColumnConfig.maxVisible||2,onActionClick:t.handleActionClick},null,8,["buttons","row","max-visible","onActionClick"])]),key:"0"}:void 0,e.renderList(t.tableFilteredSlots,(u,s)=>({name:s,fn:e.withCtx(C=>[e.renderSlot(t.$slots,s,e.normalizeProps(e.guardReactiveProps(C)),void 0,!0)])}))]),1040,["id","columns","data","height","pageable","current-page","page-size","page-sizes","total","pagination-layout","onPageChange","onSizeChange"])])],2)}const ee=P(dt,[["render",ut],["__scopeId","data-v-f8b2d913"]]);F.install=function(t){t.component(F.name,F)};const ht=[A,L,b,ee,I,F],Ct={install:t=>{ht.forEach(o=>{t.component(o.name,o)})},MyButton:A,JsxButton:L,ZxtTable:b,ZxtGrid:ee,ZxtForm:I,ZxtPagination:F,renderer:b.renderer,registerRenderer:b.registerRenderer};k.JsxButton=L,k.MyButton=A,k.ZxtForm=I,k.ZxtGrid=ee,k.ZxtPagination=F,k.ZxtTable=b,k.default=Ct,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|