zxt-table 0.4.5 → 0.5.0

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