@amaoaaaaa/search-table 0.4.0 → 0.5.1

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,12 +1,12 @@
1
- var Ke = Object.defineProperty;
2
- var Oe = (e, t, c) => t in e ? Ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: c }) : e[t] = c;
3
- var de = (e, t, c) => Oe(e, typeof t != "symbol" ? t + "" : t, c);
4
- import { defineComponent as se, computed as F, isVNode as Ue, openBlock as o, createBlock as k, resolveDynamicComponent as Ne, createElementBlock as b, markRaw as I, createElementVNode as C, useModel as je, useTemplateRef as Ce, ref as H, withDirectives as le, createVNode as _, unref as n, withCtx as y, createCommentVNode as z, createTextVNode as V, toDisplayString as D, Fragment as N, renderList as ae, mergeProps as pe, createSlots as We, isRef as Pe, normalizeClass as qe, toValue as xe, withModifiers as ce, withKeys as ve, normalizeStyle as we, mergeModels as ke, reactive as ge, nextTick as ne, toRef as Ie, watch as Ee, inject as Ge, onMounted as Ye, onUnmounted as Qe, renderSlot as re, provide as Je } from "vue";
5
- import { ElLoading as Xe, ElTable as Ze, ElTableColumn as fe, ElPopover as et, ElScrollbar as Se, ElRadioGroup as tt, ElRadio as lt, ElCheckboxGroup as at, ElCheckbox as nt, ElDatePicker as rt, ElButton as L, ElInput as $e, ElPopconfirm as st, ElText as it, ElTooltip as ot, ElPagination as ut, ElMessage as dt } from "element-plus";
6
- import { isFunction as U, isBoolean as _e, cloneDeep as Q, isString as ct, keys as me, merge as ft, isEqual as ht, pickBy as Re, sortBy as pt, uniq as vt, countBy as mt } from "lodash-es";
7
- import { vTextEllipsis as he } from "@amaoaaaaa/v-text-ellipsis";
8
- import { isCancel as Ve } from "axios";
9
- const gt = ["innerHTML"], yt = /* @__PURE__ */ se({
1
+ var je = Object.defineProperty;
2
+ var Ie = (e, l, d) => l in e ? je(e, l, { enumerable: !0, configurable: !0, writable: !0, value: d }) : e[l] = d;
3
+ var he = (e, l, d) => Ie(e, typeof l != "symbol" ? l + "" : l, d);
4
+ import { defineComponent as de, computed as z, isVNode as qe, openBlock as s, createBlock as k, resolveDynamicComponent as Ge, createElementBlock as x, markRaw as Q, createElementVNode as _, useModel as We, useTemplateRef as $e, ref as V, withDirectives as ie, createVNode as C, unref as n, withCtx as y, createCommentVNode as F, createTextVNode as R, toDisplayString as L, Fragment as q, renderList as oe, mergeProps as ge, createSlots as Ye, isRef as Re, normalizeClass as Qe, toValue as Se, withModifiers as pe, withKeys as ye, normalizeStyle as ke, mergeModels as Ce, reactive as xe, nextTick as ue, toRef as Ze, watch as Ve, useSlots as Je, inject as Xe, onMounted as et, onUnmounted as tt, renderSlot as J, provide as lt } from "vue";
5
+ import { ElLoading as at, ElTable as nt, ElTableColumn as ve, ElPopover as rt, ElScrollbar as Te, ElRadioGroup as st, ElRadio as it, ElCheckboxGroup as ot, ElCheckbox as ut, ElDatePicker as dt, ElButton as M, ElInput as Be, ElPopconfirm as ct, ElText as ft, ElTooltip as ht, ElPagination as pt, ElMessage as vt } from "element-plus";
6
+ import { isFunction as I, isBoolean as _e, cloneDeep as Y, isString as mt, keys as be, isEqual as gt, pickBy as Fe, sortBy as yt, uniq as bt, countBy as xt } from "lodash-es";
7
+ import { vTextEllipsis as me } from "@amaoaaaaa/v-text-ellipsis";
8
+ import { isCancel as He } from "axios";
9
+ const wt = ["innerHTML"], St = /* @__PURE__ */ de({
10
10
  __name: "RenderFormatterResult",
11
11
  props: {
12
12
  col: {},
@@ -15,24 +15,24 @@ const gt = ["innerHTML"], yt = /* @__PURE__ */ se({
15
15
  index: {}
16
16
  },
17
17
  setup(e) {
18
- const t = e, c = F(() => {
19
- var u, p;
20
- const r = t.col.prop ? t.row[t.col.prop] : void 0;
21
- return (p = (u = t.col).formatter) == null ? void 0 : p.call(u, t.row, t.column, r, t.index);
18
+ const l = e, d = z(() => {
19
+ var i, g;
20
+ const r = l.col.prop ? l.row[l.col.prop] : void 0;
21
+ return (g = (i = l.col).formatter) == null ? void 0 : g.call(i, l.row, l.column, r, l.index);
22
22
  });
23
- return (r, u) => Ue(c.value) ? (o(), k(Ne(c.value), { key: 0 })) : (o(), b("span", {
23
+ return (r, i) => qe(d.value) ? (s(), k(Ge(d.value), { key: 0 })) : (s(), x("span", {
24
24
  key: 1,
25
- innerHTML: c.value
26
- }, null, 8, gt));
25
+ innerHTML: d.value
26
+ }, null, 8, wt));
27
27
  }
28
- }), bt = {
28
+ }), kt = {
29
29
  viewBox: "0 0 24 24",
30
30
  width: "1.2em",
31
31
  height: "1.2em"
32
32
  };
33
- function xt(e, t) {
34
- return o(), b("svg", bt, [...t[0] || (t[0] = [
35
- C("path", {
33
+ function Ct(e, l) {
34
+ return s(), x("svg", kt, [...l[0] || (l[0] = [
35
+ _("path", {
36
36
  fill: "none",
37
37
  stroke: "currentColor",
38
38
  "stroke-linecap": "round",
@@ -42,14 +42,14 @@ function xt(e, t) {
42
42
  }, null, -1)
43
43
  ])]);
44
44
  }
45
- const wt = I({ name: "tabler-filter", render: xt }), kt = {
45
+ const Tt = Q({ name: "tabler-filter", render: Ct }), _t = {
46
46
  viewBox: "0 0 24 24",
47
47
  width: "1.2em",
48
48
  height: "1.2em"
49
49
  };
50
- function St(e, t) {
51
- return o(), b("svg", kt, [...t[0] || (t[0] = [
52
- C("path", {
50
+ function Pt(e, l) {
51
+ return s(), x("svg", _t, [...l[0] || (l[0] = [
52
+ _("path", {
53
53
  fill: "none",
54
54
  stroke: "currentColor",
55
55
  "stroke-linecap": "round",
@@ -59,14 +59,15 @@ function St(e, t) {
59
59
  }, null, -1)
60
60
  ])]);
61
61
  }
62
- const _t = I({ name: "tabler-filter-check", render: St }), Tt = { "element-loading-text": "加载中..." }, Ct = { class: "flex justify-center" }, Pt = { class: "-mx-3 flex w-[150px] items-center justify-evenly" }, Et = {
62
+ const Et = Q({ name: "tabler-filter-check", render: Pt }), $t = { "element-loading-text": "加载中..." }, Rt = { class: "flex justify-center" }, Vt = { class: "-mx-3 flex w-[150px] items-center justify-evenly" }, Bt = {
63
63
  key: 0,
64
64
  class: "h-[23px]"
65
- }, $t = ["onDblclick"], Rt = { key: 1 }, Vt = /* @__PURE__ */ se({
65
+ }, Ft = ["onDblclick"], Ht = { key: 1 }, zt = /* @__PURE__ */ de({
66
66
  __name: "index",
67
- props: /* @__PURE__ */ ke({
67
+ props: /* @__PURE__ */ Ce({
68
68
  data: {},
69
69
  columns: {},
70
+ defaultSort: {},
70
71
  rowKey: { default: "id" },
71
72
  selectable: { type: [Boolean, Function] },
72
73
  showIndex: { type: Boolean, default: !0 },
@@ -75,162 +76,164 @@ const _t = I({ name: "tabler-filter-check", render: St }), Tt = { "element-loadi
75
76
  loading: { type: Boolean, default: !1 }
76
77
  }, {
77
78
  filterData: {
78
- default: () => ge({})
79
+ default: () => xe({})
79
80
  },
80
81
  filterDataModifiers: {}
81
82
  }),
82
- emits: /* @__PURE__ */ ke(["applyFilter", "selectionChange", "cell-edit"], ["update:filterData"]),
83
- setup(e, { expose: t, emit: c }) {
84
- const r = Xe.directive, u = e, p = je(e, "filterData"), S = c, B = Ce("elTableRef"), x = H({}), $ = H({});
85
- function ie(a) {
86
- x.value[a] = Q(p.value[a]);
83
+ emits: /* @__PURE__ */ Ce(["applyFilter", "selectionChange", "cell-edit", "sortChange"], ["update:filterData"]),
84
+ setup(e, { expose: l, emit: d }) {
85
+ const r = at.directive, i = e, g = We(e, "filterData"), b = d, $ = $e("elTableRef"), w = V({}), H = V({});
86
+ function O(a) {
87
+ w.value[a] = Y(g.value[a]);
87
88
  }
88
- function G(a) {
89
- x.value[a] = Q(p.value[a]);
89
+ function X(a) {
90
+ w.value[a] = Y(g.value[a]);
90
91
  }
91
- function E(a, d, l) {
92
- x.value[a] = void 0, p.value[a] = void 0, J(a, d, l);
92
+ function ee(a, f, t) {
93
+ w.value[a] = void 0, g.value[a] = void 0, D(a, f, t);
93
94
  }
94
- function J(a, d, l) {
95
- p.value[a] = x.value[a], $.value[a] = !1, S("applyFilter", {
96
- col: l,
95
+ function D(a, f, t) {
96
+ g.value[a] = w.value[a], H.value[a] = !1, b("applyFilter", {
97
+ col: t,
97
98
  prop: a,
98
- type: d,
99
- value: p.value[a],
100
- filterData: p.value
99
+ type: f,
100
+ value: g.value[a],
101
+ filterData: g.value
101
102
  });
102
103
  }
103
- function oe(a, d) {
104
- const l = U(a.actions) ? a.actions(d) : a.actions;
105
- return l == null ? void 0 : l.map((v) => {
106
- const m = U(v.visibility) ? v.visibility(d) : v.visibility ?? !0;
107
- return { ...v, visibility: m };
108
- }).filter((v) => v.visibility !== !1);
104
+ function P(a, f) {
105
+ const t = I(a.actions) ? a.actions(f) : a.actions;
106
+ return t == null ? void 0 : t.map((h) => {
107
+ const v = I(h.visibility) ? h.visibility(f) : h.visibility ?? !0;
108
+ return { ...h, visibility: v };
109
+ }).filter((h) => h.visibility !== !1);
109
110
  }
110
- function w(a) {
111
+ function S(a) {
111
112
  return a.filterFieldName ?? a.prop;
112
113
  }
113
- function j(a, d) {
114
+ function te(a, f) {
114
115
  return {
115
116
  color: a.text.includes("删除") ? "var(--el-color-danger)" : "",
116
- visibility: _e(d) ? void 0 : d
117
+ visibility: _e(f) ? void 0 : f
117
118
  };
118
119
  }
119
- const P = H([]);
120
- function X() {
121
- P.value = Array.from(
122
- { length: u.data.length },
123
- () => Array.from({ length: u.columns.length }, () => ({
120
+ const E = V([]);
121
+ function Z() {
122
+ E.value = Array.from(
123
+ { length: i.data.length },
124
+ () => Array.from({ length: i.columns.length }, () => ({
124
125
  editing: !1,
125
126
  inputRef: void 0,
126
127
  value: void 0
127
128
  }))
128
129
  );
129
130
  }
130
- function W(a, d) {
131
- return U(a.editable) ? a.editable(d) : a.editable ?? !1;
131
+ function G(a, f) {
132
+ return I(a.editable) ? a.editable(f) : a.editable ?? !1;
132
133
  }
133
- function A(a, d, l) {
134
- const v = P.value[a][d];
135
- v && (v.value = l, v.editing = !0, ne(() => {
136
- var m;
137
- (m = v.inputRef) == null || m.focus();
134
+ function le(a, f, t) {
135
+ const h = E.value[a][f];
136
+ h && (h.value = t, h.editing = !0, ue(() => {
137
+ var v;
138
+ (v = h.inputRef) == null || v.focus();
138
139
  }));
139
140
  }
140
- function K(a) {
141
- const d = P.value[a.rowIndex][a.colIndex];
142
- if (!d) return;
143
- d.editing = !1;
144
- const l = a.newValue, v = a.row[a.prop];
145
- l !== v && (a.row[a.prop] = l, S("cell-edit", a));
141
+ function U(a) {
142
+ const f = E.value[a.rowIndex][a.colIndex];
143
+ if (!f) return;
144
+ f.editing = !1;
145
+ const t = a.newValue, h = a.row[a.prop];
146
+ t !== h && (a.row[a.prop] = t, b("cell-edit", a));
146
147
  }
147
- function ue(a, d) {
148
- const l = P.value[a][d];
149
- l && (l.editing = !1);
148
+ function A(a, f) {
149
+ const t = E.value[a][f];
150
+ t && (t.editing = !1);
150
151
  }
151
- return t({
152
- tableInstance: B,
153
- resetCells: X
154
- }), (a, d) => le((o(), b("section", Tt, [
155
- _(n(Ze), {
152
+ return l({
153
+ tableInstance: $,
154
+ resetCells: Z
155
+ }), (a, f) => ie((s(), x("section", $t, [
156
+ C(n(nt), {
156
157
  ref: "elTableRef",
157
158
  data: e.data,
159
+ "default-sort": e.defaultSort,
158
160
  border: "",
159
161
  class: "pro-table",
160
162
  height: "100%",
161
163
  "row-key": e.rowKey,
162
- onSelectionChange: d[1] || (d[1] = (l) => S("selectionChange", l))
164
+ onSelectionChange: f[1] || (f[1] = (t) => b("selectionChange", t)),
165
+ onSortChange: f[2] || (f[2] = (t) => b("sortChange", { prop: t.prop ?? "", order: t.order }))
163
166
  }, {
164
167
  default: y(() => [
165
- e.selectable ? (o(), k(n(fe), {
168
+ e.selectable ? (s(), k(n(ve), {
166
169
  key: 0,
167
170
  type: "selection",
168
171
  width: "55",
169
- selectable: n(U)(e.selectable) ? e.selectable : void 0
170
- }, null, 8, ["selectable"])) : z("", !0),
171
- e.showIndex ? (o(), k(n(fe), {
172
+ selectable: n(I)(e.selectable) ? e.selectable : void 0
173
+ }, null, 8, ["selectable"])) : F("", !0),
174
+ e.showIndex ? (s(), k(n(ve), {
172
175
  key: 1,
173
176
  class: "index-cell",
174
177
  align: "center",
175
178
  width: e.indexWidth,
176
179
  label: "序号"
177
180
  }, {
178
- default: y(({ $index: l }) => [
179
- V(D(l + 1 + (e.indexOffset || 0)), 1)
181
+ default: y(({ $index: t }) => [
182
+ R(L(t + 1 + (e.indexOffset || 0)), 1)
180
183
  ]),
181
184
  _: 1
182
- }, 8, ["width"])) : z("", !0),
183
- (o(!0), b(N, null, ae(e.columns, (l, v) => (o(), k(n(fe), pe({ key: v }, { ref_for: !0 }, l, {
184
- align: l.align ?? "center",
185
- fixed: l.label === "操作" ? "right" : !1
186
- }), We({ _: 2 }, [
187
- l.filterable ?? (l.filterType || l.filterOptions || Pe(l.filterOptions)) ? {
185
+ }, 8, ["width"])) : F("", !0),
186
+ (s(!0), x(q, null, oe(e.columns, (t, h) => (s(), k(n(ve), ge({ key: h }, { ref_for: !0 }, t, {
187
+ align: t.align ?? "center",
188
+ fixed: t.label === "操作" ? "right" : !1
189
+ }), Ye({ _: 2 }, [
190
+ t.filterable ?? (t.filterType || t.filterOptions || Re(t.filterOptions)) ? {
188
191
  name: "header",
189
- fn: y(({ column: m }) => [
190
- C("span", {
191
- class: qe(["inline-flex items-center", {
192
- "text-[--el-color-primary]": w(l) && p.value[w(l)] !== void 0
192
+ fn: y(({ column: v }) => [
193
+ _("span", {
194
+ class: Qe(["inline-flex items-center", {
195
+ "text-[--el-color-primary]": S(t) && g.value[S(t)] !== void 0
193
196
  }])
194
197
  }, [
195
- w(l) ? (o(), k(n(et), {
198
+ S(t) ? (s(), k(n(rt), {
196
199
  key: 0,
197
- visible: $.value[w(l)],
198
- "onUpdate:visible": (f) => $.value[w(l)] = f,
200
+ visible: H.value[S(t)],
201
+ "onUpdate:visible": (c) => H.value[S(t)] = c,
199
202
  placement: "bottom",
200
203
  trigger: "click",
201
204
  "hide-after": 0,
202
205
  "show-after": 0,
203
- width: l.filterPopoverWidth ?? (l.filterType === "datetimerange" ? 424 : void 0),
206
+ width: t.filterPopoverWidth ?? (t.filterType === "datetimerange" ? 424 : void 0),
204
207
  "popper-class": "reset",
205
- onShow: (f) => ie(w(l)),
206
- onHide: (f) => G(w(l))
208
+ onShow: (c) => O(S(t)),
209
+ onHide: (c) => X(S(t))
207
210
  }, {
208
211
  reference: y(() => [
209
- C("div", {
212
+ _("div", {
210
213
  class: "inline-flex cursor-pointer items-center gap-x-0.5 duration-100 hover:text-[--el-color-primary]",
211
- onClick: d[0] || (d[0] = ce(() => {
214
+ onClick: f[0] || (f[0] = pe(() => {
212
215
  }, ["stop"]))
213
216
  }, [
214
- V(D(m.label) + " ", 1),
215
- p.value[w(l)] !== void 0 ? (o(), k(n(_t), { key: 0 })) : (o(), k(n(wt), { key: 1 }))
217
+ R(L(v.label) + " ", 1),
218
+ g.value[S(t)] !== void 0 ? (s(), k(n(Et), { key: 0 })) : (s(), k(n(Tt), { key: 1 }))
216
219
  ])
217
220
  ]),
218
221
  default: y(() => [
219
- !l.filterType || l.filterType === "radio" ? (o(), k(n(Se), {
222
+ !t.filterType || t.filterType === "radio" ? (s(), k(n(Te), {
220
223
  key: 0,
221
224
  always: "",
222
225
  "max-height": "34vh"
223
226
  }, {
224
227
  default: y(() => [
225
- _(n(tt), {
226
- modelValue: x.value[w(l)],
227
- "onUpdate:modelValue": (f) => x.value[w(l)] = f
228
+ C(n(st), {
229
+ modelValue: w.value[S(t)],
230
+ "onUpdate:modelValue": (c) => w.value[S(t)] = c
228
231
  }, {
229
232
  default: y(() => [
230
- (o(!0), b(N, null, ae(xe(l.filterOptions), (f) => (o(), k(n(lt), {
231
- key: f.value.toString(),
232
- value: f.value,
233
- label: f.label,
233
+ (s(!0), x(q, null, oe(Se(t.filterOptions), (c) => (s(), k(n(it), {
234
+ key: c.value.toString(),
235
+ value: c.value,
236
+ label: c.label,
234
237
  class: "!m-0 w-full"
235
238
  }, null, 8, ["value", "label"]))), 128))
236
239
  ]),
@@ -238,21 +241,21 @@ const _t = I({ name: "tabler-filter-check", render: St }), Tt = { "element-loadi
238
241
  }, 1032, ["modelValue", "onUpdate:modelValue"])
239
242
  ]),
240
243
  _: 2
241
- }, 1024)) : l.filterType === "checkbox" ? (o(), k(n(Se), {
244
+ }, 1024)) : t.filterType === "checkbox" ? (s(), k(n(Te), {
242
245
  key: 1,
243
246
  always: "",
244
247
  "max-height": "34vh"
245
248
  }, {
246
249
  default: y(() => [
247
- _(n(at), {
248
- modelValue: x.value[w(l)],
249
- "onUpdate:modelValue": (f) => x.value[w(l)] = f
250
+ C(n(ot), {
251
+ modelValue: w.value[S(t)],
252
+ "onUpdate:modelValue": (c) => w.value[S(t)] = c
250
253
  }, {
251
254
  default: y(() => [
252
- (o(!0), b(N, null, ae(xe(l.filterOptions), (f) => (o(), k(n(nt), {
253
- key: f.value.toString(),
254
- value: f.value,
255
- label: f.label,
255
+ (s(!0), x(q, null, oe(Se(t.filterOptions), (c) => (s(), k(n(ut), {
256
+ key: c.value.toString(),
257
+ value: c.value,
258
+ label: c.label,
256
259
  class: "!m-0 w-full"
257
260
  }, null, 8, ["value", "label"]))), 128))
258
261
  ]),
@@ -260,47 +263,47 @@ const _t = I({ name: "tabler-filter-check", render: St }), Tt = { "element-loadi
260
263
  }, 1032, ["modelValue", "onUpdate:modelValue"])
261
264
  ]),
262
265
  _: 2
263
- }, 1024)) : l.filterType === "datetimerange" ? (o(), k(n(rt), {
266
+ }, 1024)) : t.filterType === "datetimerange" ? (s(), k(n(dt), {
264
267
  key: 2,
265
- modelValue: x.value[w(l)],
266
- "onUpdate:modelValue": (f) => x.value[w(l)] = f,
268
+ modelValue: w.value[S(t)],
269
+ "onUpdate:modelValue": (c) => w.value[S(t)] = c,
267
270
  type: "datetimerange",
268
271
  "start-placeholder": "开始时间",
269
272
  "end-placeholder": "结束时间",
270
273
  "range-separator": "至",
271
274
  "value-format": "YYYY-MM-DD HH:mm:ss",
272
275
  teleported: !1
273
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : z("", !0),
274
- d[4] || (d[4] = C("div", { class: "-mx-3 my-3 border-t" }, null, -1)),
275
- C("div", Ct, [
276
- C("div", Pt, [
277
- _(n(L), {
276
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])) : F("", !0),
277
+ f[5] || (f[5] = _("div", { class: "-mx-3 my-3 border-t" }, null, -1)),
278
+ _("div", Rt, [
279
+ _("div", Vt, [
280
+ C(n(M), {
278
281
  type: "primary",
279
282
  plain: "",
280
283
  size: "small",
281
- onClick: (f) => E(
282
- w(l),
283
- l.filterType || "radio",
284
- l
284
+ onClick: (c) => ee(
285
+ S(t),
286
+ t.filterType || "radio",
287
+ t
285
288
  )
286
289
  }, {
287
- default: y(() => [...d[2] || (d[2] = [
288
- V("重置", -1)
290
+ default: y(() => [...f[3] || (f[3] = [
291
+ R("重置", -1)
289
292
  ])]),
290
293
  _: 1
291
294
  }, 8, ["onClick"]),
292
- _(n(L), {
295
+ C(n(M), {
293
296
  type: "primary",
294
297
  size: "small",
295
298
  class: "!m-0",
296
- onClick: (f) => J(
297
- w(l),
298
- l.filterType || "radio",
299
- l
299
+ onClick: (c) => D(
300
+ S(t),
301
+ t.filterType || "radio",
302
+ t
300
303
  )
301
304
  }, {
302
- default: y(() => [...d[3] || (d[3] = [
303
- V("确定", -1)
305
+ default: y(() => [...f[4] || (f[4] = [
306
+ R("确定", -1)
304
307
  ])]),
305
308
  _: 1
306
309
  }, 8, ["onClick"])
@@ -308,112 +311,112 @@ const _t = I({ name: "tabler-filter-check", render: St }), Tt = { "element-loadi
308
311
  ])
309
312
  ]),
310
313
  _: 2
311
- }, 1032, ["visible", "onUpdate:visible", "width", "onShow", "onHide"])) : z("", !0)
314
+ }, 1032, ["visible", "onUpdate:visible", "width", "onShow", "onHide"])) : F("", !0)
312
315
  ], 2)
313
316
  ]),
314
317
  key: "0"
315
318
  } : void 0,
316
- l.formatter ? {
319
+ t.formatter ? {
317
320
  name: "default",
318
- fn: y(({ row: m, column: f, $index: R }) => [
319
- le((o(), b("div", null, [
320
- _(yt, {
321
- col: l,
322
- row: m,
323
- column: f,
324
- index: R
321
+ fn: y(({ row: v, column: c, $index: N }) => [
322
+ ie((s(), x("div", null, [
323
+ C(St, {
324
+ col: t,
325
+ row: v,
326
+ column: c,
327
+ index: N
325
328
  }, null, 8, ["col", "row", "column", "index"])
326
329
  ])), [
327
- [n(he), l.truncate ?? !0]
330
+ [n(me), t.truncate ?? !0]
328
331
  ])
329
332
  ]),
330
333
  key: "1"
331
334
  } : {
332
335
  name: "default",
333
- fn: y(({ row: m, $index: f }) => {
334
- var R, Z;
336
+ fn: y(({ row: v, $index: c }) => {
337
+ var N, ae;
335
338
  return [
336
- l.prop ? (o(), b("div", Et, [
337
- W(l, m) ? (o(), b(N, { key: 0 }, [
338
- (Z = (R = P.value[f]) == null ? void 0 : R[v]) != null && Z.editing ? (o(), k(n($e), {
339
+ t.prop ? (s(), x("div", Bt, [
340
+ G(t, v) ? (s(), x(q, { key: 0 }, [
341
+ (ae = (N = E.value[c]) == null ? void 0 : N[h]) != null && ae.editing ? (s(), k(n(Be), {
339
342
  key: 0,
340
343
  ref_for: !0,
341
- ref: (s) => P.value[f][v].inputRef = s,
342
- modelValue: P.value[f][v].value,
343
- "onUpdate:modelValue": (s) => P.value[f][v].value = s,
344
+ ref: (o) => E.value[c][h].inputRef = o,
345
+ modelValue: E.value[c][h].value,
346
+ "onUpdate:modelValue": (o) => E.value[c][h].value = o,
344
347
  style: { "--el-input-height": "23px" },
345
348
  clearable: "",
346
349
  size: "small",
347
350
  "input-style": "--el-input-inner-height: 20px",
348
- onBlur: (s) => K({
349
- rowIndex: f,
350
- colIndex: v,
351
- row: m,
352
- prop: l.prop,
353
- oldValue: m[l.prop],
354
- newValue: P.value[f][v].value
351
+ onBlur: (o) => U({
352
+ rowIndex: c,
353
+ colIndex: h,
354
+ row: v,
355
+ prop: t.prop,
356
+ oldValue: v[t.prop],
357
+ newValue: E.value[c][h].value
355
358
  }),
356
359
  onKeydown: [
357
- ve(ce((s) => K({
358
- rowIndex: f,
359
- colIndex: v,
360
- row: m,
361
- prop: l.prop,
362
- oldValue: m[l.prop],
363
- newValue: P.value[f][v].value
360
+ ye(pe((o) => U({
361
+ rowIndex: c,
362
+ colIndex: h,
363
+ row: v,
364
+ prop: t.prop,
365
+ oldValue: v[t.prop],
366
+ newValue: E.value[c][h].value
364
367
  }), ["stop", "prevent"]), ["enter"]),
365
- ve(ce((s) => ue(f, v), ["stop", "prevent"]), ["esc"])
368
+ ye(pe((o) => A(c, h), ["stop", "prevent"]), ["esc"])
366
369
  ]
367
- }, null, 8, ["modelValue", "onUpdate:modelValue", "onBlur", "onKeydown"])) : le((o(), b("div", {
370
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "onBlur", "onKeydown"])) : ie((s(), x("div", {
368
371
  key: 1,
369
372
  class: "h-[23px] cursor-pointer",
370
- onDblclick: (s) => A(f, v, m[l.prop])
373
+ onDblclick: (o) => le(c, h, v[t.prop])
371
374
  }, [
372
- V(D(m[l.prop]), 1)
373
- ], 40, $t)), [
374
- [n(he), l.truncate ?? !0]
375
+ R(L(v[t.prop]), 1)
376
+ ], 40, Ft)), [
377
+ [n(me), t.truncate ?? !0]
375
378
  ])
376
- ], 64)) : le((o(), b("div", Rt, [
377
- V(D(m[l.prop]), 1)
379
+ ], 64)) : ie((s(), x("div", Ht, [
380
+ R(L(v[t.prop]), 1)
378
381
  ])), [
379
- [n(he), l.truncate ?? !0]
382
+ [n(me), t.truncate ?? !0]
380
383
  ])
381
- ])) : z("", !0),
382
- (o(!0), b(N, null, ae(oe(l, m), (s) => (o(), b(N, {
383
- key: s.text
384
+ ])) : F("", !0),
385
+ (s(!0), x(q, null, oe(P(t, v), (o) => (s(), x(q, {
386
+ key: o.text
384
387
  }, [
385
- s.text === "删除" || s.confirmText ? (o(), k(n(st), {
388
+ o.text === "删除" || o.confirmText ? (s(), k(n(ct), {
386
389
  key: 0,
387
390
  placement: "top",
388
391
  "hide-after": 0,
389
392
  "popper-style": "width: unset; min-width: 150px;",
390
- title: n(_e)(s.confirmText) ? `是否确认${s.text}?` : n(U)(s.confirmText) ? s.confirmText(m) : s.confirmText ?? `是否确认${s.text}?`,
391
- onConfirm: (Y) => s.visibility === "hidden" ? void 0 : s.handler(m)
393
+ title: n(_e)(o.confirmText) ? `是否确认${o.text}?` : n(I)(o.confirmText) ? o.confirmText(v) : o.confirmText ?? `是否确认${o.text}?`,
394
+ onConfirm: (B) => o.visibility === "hidden" ? void 0 : o.handler(v)
392
395
  }, {
393
396
  reference: y(() => [
394
- _(n(L), {
397
+ C(n(M), {
395
398
  link: "",
396
- type: s.type ?? "primary",
397
- style: we(j(s, s.visibility)),
398
- disabled: n(U)(s.disabled) ? s.disabled(m) : s.disabled
399
+ type: o.type ?? "primary",
400
+ style: ke(te(o, o.visibility)),
401
+ disabled: n(I)(o.disabled) ? o.disabled(v) : o.disabled
399
402
  }, {
400
403
  default: y(() => [
401
- V(D(s.text), 1)
404
+ R(L(o.text), 1)
402
405
  ]),
403
406
  _: 2
404
407
  }, 1032, ["type", "style", "disabled"])
405
408
  ]),
406
409
  _: 2
407
- }, 1032, ["title", "onConfirm"])) : (o(), k(n(L), {
410
+ }, 1032, ["title", "onConfirm"])) : (s(), k(n(M), {
408
411
  key: 1,
409
412
  link: "",
410
- type: s.type ?? "primary",
411
- style: we(j(s, s.visibility)),
412
- disabled: n(U)(s.disabled) ? s.disabled(m) : s.disabled,
413
- onClick: (Y) => s.visibility === "hidden" ? void 0 : s.handler(m)
413
+ type: o.type ?? "primary",
414
+ style: ke(te(o, o.visibility)),
415
+ disabled: n(I)(o.disabled) ? o.disabled(v) : o.disabled,
416
+ onClick: (B) => o.visibility === "hidden" ? void 0 : o.handler(v)
414
417
  }, {
415
418
  default: y(() => [
416
- V(D(s.text), 1)
419
+ R(L(o.text), 1)
417
420
  ]),
418
421
  _: 2
419
422
  }, 1032, ["type", "style", "disabled", "onClick"]))
@@ -425,30 +428,30 @@ const _t = I({ name: "tabler-filter-check", render: St }), Tt = { "element-loadi
425
428
  ]), 1040, ["align", "fixed"]))), 128))
426
429
  ]),
427
430
  _: 1
428
- }, 8, ["data", "row-key"])
431
+ }, 8, ["data", "default-sort", "row-key"])
429
432
  ])), [
430
433
  [n(r), e.loading]
431
434
  ]);
432
435
  }
433
- }), Be = (e, t) => {
434
- const c = e.__vccOpts || e;
435
- for (const [r, u] of t)
436
- c[r] = u;
437
- return c;
438
- }, Bt = /* @__PURE__ */ Be(Vt, [["__scopeId", "data-v-476baef5"]]);
439
- function Ht(e) {
440
- var t, c, r, u, p, S, B;
441
- if (ct(e))
436
+ }), ze = (e, l) => {
437
+ const d = e.__vccOpts || e;
438
+ for (const [r, i] of l)
439
+ d[r] = i;
440
+ return d;
441
+ }, Dt = /* @__PURE__ */ ze(zt, [["__scopeId", "data-v-455222f2"]]);
442
+ function At(e) {
443
+ var l, d, r, i, g, b, $;
444
+ if (mt(e))
442
445
  return e.includes("database") || e.includes("java.sql.") ? "接口异常" : e;
443
- if (Ve(e)) return "请求已取消";
444
- if (e.code === "ECONNABORTED" || (t = e.message) != null && t.includes("timeout"))
446
+ if (He(e)) return "请求已取消";
447
+ if (e.code === "ECONNABORTED" || (l = e.message) != null && l.includes("timeout"))
445
448
  return "请求超时,请稍后重试";
446
449
  if (!window.navigator.onLine || e.message === "Network Error")
447
450
  return "网络连接断开,请检查网络设置";
448
451
  if (e.response) {
449
- const x = e.response.status, $ = e.response.data;
450
- if ($ && $.message) return $.message;
451
- switch (x) {
452
+ const w = e.response.status, H = e.response.data;
453
+ if (H && H.message) return H.message;
454
+ switch (w) {
452
455
  case 400:
453
456
  return "请求参数错误 (400)";
454
457
  case 401:
@@ -464,23 +467,23 @@ function Ht(e) {
464
467
  case 503:
465
468
  return "服务不可用 (503)";
466
469
  default:
467
- return `网络异常 (${x})`;
470
+ return `网络异常 (${w})`;
468
471
  }
469
472
  }
470
- return e instanceof SyntaxError ? "数据解析异常" : e instanceof TypeError ? "程序运行异常" : e instanceof Object && ((u = (r = e[(c = me(e)) == null ? void 0 : c[0]]) == null ? void 0 : r[0]) != null && u.message) ? (B = (S = e[(p = me(e)) == null ? void 0 : p[0]]) == null ? void 0 : S[0]) == null ? void 0 : B.message : e.message || "未知错误";
473
+ return e instanceof SyntaxError ? "数据解析异常" : e instanceof TypeError ? "程序运行异常" : e instanceof Object && ((i = (r = e[(d = be(e)) == null ? void 0 : d[0]]) == null ? void 0 : r[0]) != null && i.message) ? ($ = (b = e[(g = be(e)) == null ? void 0 : g[0]]) == null ? void 0 : b[0]) == null ? void 0 : $.message : e.message || "未知错误";
471
474
  }
472
- class zt {
475
+ class Lt {
473
476
  /**
474
477
  * 实例化 SelectionStore
475
478
  *
476
479
  * @param rowKey 作为 id 的字段名,默认为 `'id'`
477
480
  */
478
- constructor(t = "id") {
481
+ constructor(l = "id") {
479
482
  /** 存储选中的行 */
480
- de(this, "map", /* @__PURE__ */ new Map());
483
+ he(this, "map", /* @__PURE__ */ new Map());
481
484
  /** 行数据的 Key */
482
- de(this, "rowKey");
483
- this.rowKey = t;
485
+ he(this, "rowKey");
486
+ this.rowKey = l;
484
487
  }
485
488
  /** 获取所有选中行 */
486
489
  get values() {
@@ -491,24 +494,24 @@ class zt {
491
494
  return [...this.map.keys()];
492
495
  }
493
496
  /** 是否选中 */
494
- has(t) {
495
- return this.map.has(t);
497
+ has(l) {
498
+ return this.map.has(l);
496
499
  }
497
500
  /** 选中一行 */
498
- select(t) {
499
- this.map.set(t[this.rowKey], t);
501
+ select(l) {
502
+ this.map.set(l[this.rowKey], l);
500
503
  }
501
504
  /** 取消选中 */
502
- unselect(t) {
503
- this.map.delete(t);
505
+ unselect(l) {
506
+ this.map.delete(l);
504
507
  }
505
508
  /** 批量选中 */
506
- selectMany(t) {
507
- t.forEach((c) => this.select(c));
509
+ selectMany(l) {
510
+ l.forEach((d) => this.select(d));
508
511
  }
509
512
  /** 批量取消 */
510
- unselectMany(t) {
511
- t.forEach((c) => this.unselect(c));
513
+ unselectMany(l) {
514
+ l.forEach((d) => this.unselect(d));
512
515
  }
513
516
  /** 清空 */
514
517
  clear() {
@@ -519,167 +522,168 @@ class zt {
519
522
  * @param pageRows 当前页数据
520
523
  * @param selected 当前页勾选行
521
524
  */
522
- syncPage(t, c) {
523
- const r = new Set(c.map((u) => u[this.rowKey]));
524
- t.forEach((u) => {
525
- r.has(u[this.rowKey]) || this.map.delete(u[this.rowKey]);
526
- }), c.forEach((u) => this.map.set(u[this.rowKey], u));
525
+ syncPage(l, d) {
526
+ const r = new Set(d.map((i) => i[this.rowKey]));
527
+ l.forEach((i) => {
528
+ r.has(i[this.rowKey]) || this.map.delete(i[this.rowKey]);
529
+ }), d.forEach((i) => this.map.set(i[this.rowKey], i));
527
530
  }
528
531
  /**
529
532
  * 同步表格 UI 勾选状态
530
533
  * @param pageRows 当前页数据
531
534
  * @param toggleFn el-table toggleRowSelection
532
535
  */
533
- restorePageSelection(t, c) {
534
- t.forEach((r) => {
536
+ restorePageSelection(l, d) {
537
+ l.forEach((r) => {
535
538
  Object.hasOwn(r, this.rowKey) || console.error(
536
539
  "[SelectionStore]",
537
540
  `表格数据缺少配置的 rowKey 属性:'${this.rowKey}'`
538
- ), this.map.has(r[this.rowKey]) && c(r, !0);
541
+ ), this.map.has(r[this.rowKey]) && d(r, !0);
539
542
  });
540
543
  }
541
544
  }
542
- function Ft(e, t, c) {
543
- let r, u;
544
- Pe(e) ? (r = e, u = t) : (r = Ie(e, t), u = 300);
545
- const p = H(r.value);
546
- let S = null;
547
- const B = () => {
548
- S !== null && (clearTimeout(S), S = null);
545
+ function Mt(e, l, d) {
546
+ let r, i;
547
+ Re(e) ? (r = e, i = l) : (r = Ze(e, l), i = 300);
548
+ const g = V(r.value);
549
+ let b = null;
550
+ const $ = () => {
551
+ b !== null && (clearTimeout(b), b = null);
549
552
  };
550
- return Ee(
553
+ return Ve(
551
554
  r,
552
- (x) => {
553
- x ? (B(), S = setTimeout(() => {
554
- p.value = !0;
555
- }, u)) : (B(), p.value = !1);
555
+ (w) => {
556
+ w ? ($(), b = setTimeout(() => {
557
+ g.value = !0;
558
+ }, i)) : ($(), g.value = !1);
556
559
  },
557
560
  { immediate: !1 }
558
- ), p;
561
+ ), g;
559
562
  }
560
- function Dt({ defaultSort: e, fetchFn: t, onReset: c }) {
561
- const r = ft(
562
- {
563
- order: "",
564
- sort: ""
565
- },
566
- e
567
- ), u = ge(Q(r));
568
- let p = Q(u);
569
- function S({
570
- prop: B,
571
- order: x
563
+ function Kt({
564
+ defaultSort: e,
565
+ fetchFn: l,
566
+ onReset: d
567
+ }) {
568
+ const r = e ? Y(e) : {
569
+ order: "",
570
+ sort: ""
571
+ }, i = xe(Y(r));
572
+ let g = Y(i);
573
+ function b({
574
+ prop: $,
575
+ order: w
572
576
  }) {
573
- x ? (u.sort = B || "", u.order = x === "ascending" ? "asc" : "desc", t()) : (u.sort = r.sort, u.order = r.order, ht(u, p) && (u.order = u.order === "asc" ? "desc" : "asc"), c ? c() : t()), p = Q(u);
577
+ w ? (i.sort = $ || "", i.order = w === "ascending" ? "asc" : "desc", l()) : (i.sort = r.sort, i.order = r.order, gt(i, g) && (i.order = i.order === "asc" ? "desc" : "asc"), d ? d() : l()), g = Y(i);
574
578
  }
575
579
  return {
576
- sortState: u,
577
- onSortChange: S
580
+ sortState: i,
581
+ onSortChange: b
578
582
  };
579
583
  }
580
- const He = {
584
+ const De = {
581
585
  background: !0,
582
586
  layout: "total, sizes, prev, pager, next, jumper"
583
- }, ze = {
587
+ }, Ae = {
584
588
  buttonText: "搜索"
585
- }, M = {
589
+ }, K = {
586
590
  rowHeight: 40,
587
591
  headerHeight: 40,
588
- paginationProps: He,
589
- searchProps: ze
592
+ paginationProps: De,
593
+ searchProps: Ae
590
594
  };
591
- function Te(e, t) {
592
- if (e == null) return t;
593
- const c = typeof e == "number" ? e : Number.parseFloat(e);
594
- if (!Number.isFinite(c)) return t;
595
- const r = Math.round(c);
596
- return r > 0 ? r : t;
595
+ function Pe(e, l) {
596
+ if (e == null) return l;
597
+ const d = typeof e == "number" ? e : Number.parseFloat(e);
598
+ if (!Number.isFinite(d)) return l;
599
+ const r = Math.round(d);
600
+ return r > 0 ? r : l;
597
601
  }
598
- function Lt(e, t) {
599
- return typeof e == "string" && e.trim() ? e : t;
602
+ function Ot(e, l) {
603
+ return typeof e == "string" && e.trim() ? e : l;
600
604
  }
601
- function Fe(...e) {
602
- return Re(Object.assign({}, ...e), (t) => t !== void 0);
605
+ function Le(...e) {
606
+ return Fe(Object.assign({}, ...e), (l) => l !== void 0);
603
607
  }
604
- function Mt(e) {
608
+ function Ut(e) {
605
609
  return {
606
- buttonText: (e == null ? void 0 : e.buttonText) ?? ze.buttonText
610
+ buttonText: (e == null ? void 0 : e.buttonText) ?? Ae.buttonText
607
611
  };
608
612
  }
609
- function At(e) {
610
- const t = Fe(
611
- M.paginationProps,
613
+ function Nt(e) {
614
+ const l = Le(
615
+ K.paginationProps,
612
616
  e == null ? void 0 : e.paginationProps
613
617
  );
614
618
  return {
615
- rowHeight: Te(e == null ? void 0 : e.rowHeight, M.rowHeight),
616
- headerHeight: Te(e == null ? void 0 : e.headerHeight, M.headerHeight),
619
+ rowHeight: Pe(e == null ? void 0 : e.rowHeight, K.rowHeight),
620
+ headerHeight: Pe(e == null ? void 0 : e.headerHeight, K.headerHeight),
617
621
  paginationProps: {
618
- ...t,
619
- layout: Lt(
620
- t.layout,
621
- He.layout
622
+ ...l,
623
+ layout: Ot(
624
+ l.layout,
625
+ De.layout
622
626
  )
623
627
  },
624
- searchProps: Mt(e == null ? void 0 : e.searchProps)
628
+ searchProps: Ut(e == null ? void 0 : e.searchProps)
625
629
  };
626
630
  }
627
- const De = Symbol("searchTableConfig"), Kt = {
631
+ const Me = Symbol("searchTableConfig"), jt = {
628
632
  viewBox: "0 0 24 24",
629
633
  width: "1.2em",
630
634
  height: "1.2em"
631
635
  };
632
- function Ot(e, t) {
633
- return o(), b("svg", Kt, [...t[0] || (t[0] = [
634
- C("path", {
636
+ function It(e, l) {
637
+ return s(), x("svg", jt, [...l[0] || (l[0] = [
638
+ _("path", {
635
639
  fill: "currentColor",
636
640
  d: "m18.031 16.617l4.283 4.282l-1.415 1.415l-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9s9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617m-2.006-.742A6.98 6.98 0 0 0 18 11c0-3.867-3.133-7-7-7s-7 3.133-7 7s3.133 7 7 7a6.98 6.98 0 0 0 4.875-1.975z"
637
641
  }, null, -1)
638
642
  ])]);
639
643
  }
640
- const Ut = I({ name: "ri-search-line", render: Ot }), Nt = {
644
+ const qt = Q({ name: "ri-search-line", render: It }), Gt = {
641
645
  viewBox: "0 0 24 24",
642
646
  width: "1.2em",
643
647
  height: "1.2em"
644
648
  };
645
- function jt(e, t) {
646
- return o(), b("svg", Nt, [...t[0] || (t[0] = [
647
- C("path", {
649
+ function Wt(e, l) {
650
+ return s(), x("svg", Gt, [...l[0] || (l[0] = [
651
+ _("path", {
648
652
  fill: "currentColor",
649
653
  d: "M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"
650
654
  }, null, -1)
651
655
  ])]);
652
656
  }
653
- const Wt = I({ name: "ri-add-line", render: jt }), qt = {
657
+ const Yt = Q({ name: "ri-add-line", render: Wt }), Qt = {
654
658
  viewBox: "0 0 24 24",
655
659
  width: "1.2em",
656
660
  height: "1.2em"
657
661
  };
658
- function It(e, t) {
659
- return o(), b("svg", qt, [...t[0] || (t[0] = [
660
- C("path", {
662
+ function Zt(e, l) {
663
+ return s(), x("svg", Qt, [...l[0] || (l[0] = [
664
+ _("path", {
661
665
  fill: "currentColor",
662
666
  d: "M17 6h5v2h-2v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V8H2V6h5V3a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1zm1 2H6v12h12zm-9 3h2v6H9zm4 0h2v6h-2zM9 4v2h6V4z"
663
667
  }, null, -1)
664
668
  ])]);
665
669
  }
666
- const Gt = I({ name: "ri-delete-bin-line", render: It }), Yt = {
670
+ const Jt = Q({ name: "ri-delete-bin-line", render: Zt }), Xt = {
667
671
  viewBox: "0 0 24 24",
668
672
  width: "1.2em",
669
673
  height: "1.2em"
670
674
  };
671
- function Qt(e, t) {
672
- return o(), b("svg", Yt, [...t[0] || (t[0] = [
673
- C("path", {
675
+ function el(e, l) {
676
+ return s(), x("svg", Xt, [...l[0] || (l[0] = [
677
+ _("path", {
674
678
  fill: "currentColor",
675
679
  d: "M6.535 3h14.464a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H6.535a1 1 0 0 1-.833-.445l-5.333-8a1 1 0 0 1 0-1.11l5.333-8A1 1 0 0 1 6.535 3m.535 2l-4.667 7l4.667 7H20V5zM13 10.586l2.828-2.829l1.414 1.415L14.414 12l2.828 2.828l-1.414 1.415l-2.829-2.829l-2.828 2.829l-1.414-1.415L11.585 12L8.757 9.172l1.414-1.415z"
676
680
  }, null, -1)
677
681
  ])]);
678
682
  }
679
- const Jt = I({ name: "ri-delete-back2-line", render: Qt }), Xt = { class: "search-table flex h-full flex-col" }, Zt = {
683
+ const tl = Q({ name: "ri-delete-back2-line", render: el }), ll = { class: "search-table flex h-full flex-col" }, al = {
680
684
  key: 0,
681
685
  class: "search-table__toolbar mb-6 flex flex-shrink-0 items-center justify-between"
682
- }, el = { class: "search-table__search flex items-center gap-x-3" }, tl = { class: "search-table__actions" }, ll = { class: "search-table__footer mt-5 flex flex-shrink-0 items-center justify-between" }, al = { class: "search-table__selection flex w-[164px] items-center" }, nl = /* @__PURE__ */ se({
686
+ }, nl = { class: "search-table__search flex items-center gap-x-3" }, rl = { class: "search-table__actions" }, sl = { class: "search-table__footer mt-5 flex flex-shrink-0 items-center justify-between" }, il = { class: "search-table__selection flex w-[164px] items-center" }, Ee = 10, ol = /* @__PURE__ */ de({
683
687
  __name: "index",
684
688
  props: {
685
689
  columns: {},
@@ -702,205 +706,223 @@ const Jt = I({ name: "ri-delete-back2-line", render: Qt }), Xt = { class: "searc
702
706
  searchParamsHandler: {}
703
707
  },
704
708
  emits: ["add", "batch-delete", "cell-edit"],
705
- setup(e, { expose: t, emit: c }) {
706
- const r = e, u = c, p = Ce("proTableRef"), S = Ge(De, M), B = F(
707
- () => Fe(S.paginationProps, r.elPaginationProps)
708
- ), x = F(
709
- () => r.searchButtonText ?? S.searchProps.buttonText
710
- ), { sortState: $, onSortChange: ie } = Dt({
709
+ setup(e, { expose: l, emit: d }) {
710
+ const r = e, i = d, g = Je(), b = $e("proTableRef"), $ = Xe(Me, K), w = z(
711
+ () => Le($.paginationProps, r.elPaginationProps)
712
+ ), H = z(
713
+ () => r.searchButtonText ?? $.searchProps.buttonText
714
+ ), { sortState: O, onSortChange: X } = Kt({
711
715
  defaultSort: r.defaultSort,
712
- fetchFn: d,
716
+ fetchFn: h,
713
717
  onReset() {
714
- var g, T;
715
- const h = $.sort, i = $.order === "asc" ? "ascending" : "descending";
716
- r.columns.some((q) => q.prop === h) ? (T = (g = p.value) == null ? void 0 : g.tableInstance) == null || T.sort(h, i) : d();
718
+ var m, T;
719
+ const p = O.sort, u = O.order === "asc" ? "ascending" : "descending";
720
+ r.columns.some((W) => W.prop === p) ? (T = (m = b.value) == null ? void 0 : m.tableInstance) == null || T.sort(p, u) : h();
717
721
  }
718
- }), G = H(r.pageSize ?? 0), E = H({
719
- pageSize: G.value,
722
+ }), ee = z(() => {
723
+ const p = O.order === "asc" ? "ascending" : "descending";
724
+ return {
725
+ prop: O.sort,
726
+ order: p
727
+ };
728
+ }), D = V(r.pageSize ?? 0), P = V({
729
+ pageSize: D.value,
720
730
  currPage: 1,
721
731
  total: 0
722
- }), J = F(() => pt(vt([G.value, 10, 20, 30, 40, 50, 100]))), oe = F(() => (E.value.currPage - 1) * E.value.pageSize), w = H(0), j = F(() => r.searchField ?? "search"), P = H({
723
- [j.value]: ""
724
- }), X = F({
725
- get: () => P.value[j.value] ?? "",
726
- set: (h) => {
727
- P.value[j.value] = h;
732
+ }), S = z(() => yt(bt([D.value, 10, 20, 30, 40, 50, 100]))), te = z(() => (P.value.currPage - 1) * P.value.pageSize), E = V(0), Z = z(() => r.searchField ?? "search"), G = V({
733
+ [Z.value]: ""
734
+ }), le = z({
735
+ get: () => G.value[Z.value] ?? "",
736
+ set: (p) => {
737
+ G.value[Z.value] = p;
728
738
  }
729
- }), W = ge({}), A = H([]), K = H(!1), ue = Ft(K, 100);
730
- let a = null;
731
- async function d() {
732
- a == null || a.abort(), a = new AbortController(), K.value = !0;
733
- const h = oe.value;
739
+ }), U = xe({}), A = V([]), a = V(!1), f = Mt(a, 100);
740
+ let t = null;
741
+ async function h() {
742
+ t == null || t.abort(), t = new AbortController(), a.value = !0;
743
+ const p = te.value;
734
744
  try {
735
- const i = {
736
- ...P.value,
737
- ...W,
738
- ...$,
739
- limit: E.value.pageSize,
740
- offset: h
741
- }, g = r.searchParamsHandler ? r.searchParamsHandler(i) : i, { data: T = [], totalCount: q = 0 } = await r.fetchFn(g, {
742
- signal: a.signal
745
+ const u = {
746
+ ...G.value,
747
+ ...U,
748
+ ...O,
749
+ limit: P.value.pageSize,
750
+ offset: p
751
+ }, m = r.searchParamsHandler ? r.searchParamsHandler(u) : u, { data: T = [], totalCount: W = 0 } = await r.fetchFn(m, {
752
+ signal: t.signal
743
753
  });
744
- A.value = T, w.value = h, E.value.total = q, await ne(() => {
745
- var O, ee, te;
746
- (ee = (O = p.value) == null ? void 0 : O.tableInstance) == null || ee.setScrollTop(0), (te = p.value) == null || te.resetCells();
747
- }), r.selectable && Ae(T);
748
- } catch (i) {
749
- if (Ve(i)) return;
750
- console.error("[SearchTable] 获取数据失败", i), dt.error("表格数据加载失败:" + Ht(i));
754
+ A.value = T, E.value = p, P.value.total = W, await ue(() => {
755
+ var j, re, se;
756
+ (re = (j = b.value) == null ? void 0 : j.tableInstance) == null || re.setScrollTop(0), (se = b.value) == null || se.resetCells();
757
+ }), r.selectable && Ne(T);
758
+ } catch (u) {
759
+ if (He(u)) return;
760
+ console.error("[SearchTable] 获取数据失败", u), vt.error("表格数据加载失败:" + At(u));
751
761
  }
752
- K.value = !1;
762
+ a.value = !1;
753
763
  }
754
- function l() {
755
- E.value.currPage = 1, d();
764
+ function v() {
765
+ P.value.currPage = 1, h();
756
766
  }
757
- function v({ type: h, value: i, prop: g, col: T }) {
758
- if (h === "datetimerange") {
759
- const [q = `${g}Start`, O = `${g}End`] = T.datetimerangeFilterFieldNames || [], [ee, te] = i || [];
760
- W[q] = ee, W[O] = te;
767
+ function c({ type: p, value: u, prop: m, col: T }) {
768
+ if (p === "datetimerange") {
769
+ const [W = `${m}Start`, j = `${m}End`] = T.datetimerangeFilterFieldNames || [], [re, se] = u || [];
770
+ U[W] = re, U[j] = se;
761
771
  } else
762
- W[g] = i;
763
- l();
772
+ U[m] = u;
773
+ v();
764
774
  }
765
- const m = async () => {
766
- K.value || (be(), await d());
775
+ function N(p) {
776
+ i("cell-edit", p);
777
+ }
778
+ const ae = async () => {
779
+ a.value || (we(), await h());
767
780
  };
768
- function f() {
769
- var O;
770
- const { rowHeight: h, headerHeight: i } = S, T = ((O = p.value) == null ? void 0 : O.$el).offsetHeight - i;
771
- return Math.floor(T / h);
781
+ function o() {
782
+ var j;
783
+ const { rowHeight: p, headerHeight: u } = $, m = (j = b.value) == null ? void 0 : j.$el;
784
+ if (!m) return 0;
785
+ const T = m.offsetHeight - u;
786
+ return Math.floor(T / p);
772
787
  }
773
- const R = H([]), Z = F(() => R.value), s = new zt(r.rowKey);
774
- let Y = !1;
775
- const ye = (h) => {
776
- Y || (s.syncPage(A.value, h), R.value = s.values);
777
- }, Le = () => R.value, Me = (h) => {
778
- ye(h);
779
- }, be = () => {
780
- var h, i;
781
- (i = (h = p.value) == null ? void 0 : h.tableInstance) == null || i.clearSelection(), R.value = [], s.clear();
788
+ const B = V([]), Ke = z(() => B.value), ne = new Lt(r.rowKey);
789
+ let ce = !1;
790
+ const fe = (p) => {
791
+ ce || (ne.syncPage(A.value, p), B.value = ne.values);
792
+ }, Oe = () => B.value, Ue = (p) => {
793
+ fe(p);
794
+ }, we = () => {
795
+ var p, u;
796
+ (u = (p = b.value) == null ? void 0 : p.tableInstance) == null || u.clearSelection(), B.value = [], ne.clear();
782
797
  };
783
- r.selectable && Ee(A, async () => {
784
- Y = !0, await ne(), s.restorePageSelection(A.value, (h, i) => {
785
- var g, T;
786
- (T = (g = p.value) == null ? void 0 : g.tableInstance) == null || T.toggleRowSelection(h, i);
787
- }), await ne(), Y = !1;
798
+ r.selectable && Ve(A, async () => {
799
+ ce = !0, await ue(), ne.restorePageSelection(A.value, (p, u) => {
800
+ var m, T;
801
+ (T = (m = b.value) == null ? void 0 : m.tableInstance) == null || T.toggleRowSelection(p, u);
802
+ }), await ue(), ce = !1;
788
803
  });
789
- function Ae(h) {
790
- const i = h.map((T) => T[r.rowKey]), g = me(Re(mt(i), (T) => T > 1));
791
- g.length && console.error(
804
+ function Ne(p) {
805
+ const u = p.map((T) => T[r.rowKey]), m = be(Fe(xt(u), (T) => T > 1));
806
+ m.length && console.error(
792
807
  "[SearchTable] 表格数据存在重复的 rowKey,将会导致勾选功能异常!",
793
- g
808
+ m
794
809
  );
795
810
  }
796
- return Ye(() => {
797
- if (!E.value.pageSize) {
798
- const h = f();
799
- G.value = h, E.value.pageSize = h;
800
- }
801
- d();
802
- }), Qe(() => {
803
- a == null || a.abort();
804
- }), t({
811
+ return et(() => {
812
+ P.value.pageSize || (g.table ? (console.warn(
813
+ `[SearchTable] 使用 table 插槽替换表格时无法自动计算每页条数,将使用默认值 ${Ee},可通过 pageSize 指定`
814
+ ), D.value = Ee) : D.value = o(), P.value.pageSize = D.value), h();
815
+ }), tt(() => {
816
+ t == null || t.abort();
817
+ }), l({
805
818
  /**
806
819
  * 刷新当前页
807
820
  */
808
- refresh: m,
821
+ refresh: ae,
809
822
  /**
810
823
  * 已勾选的行
811
824
  */
812
- selectedRows: Z,
825
+ selectedRows: Ke,
813
826
  /**
814
827
  * 获取已勾选的行
815
828
  */
816
- getSelectionRows: Le,
829
+ getSelectionRows: Oe,
817
830
  /**
818
831
  * 勾选指定行
819
832
  */
820
- selectRows: Me
821
- }), (h, i) => (o(), b("div", Xt, [
822
- e.showSearch ? (o(), b("section", Zt, [
823
- C("div", el, [
824
- _(n($e), {
825
- modelValue: X.value,
826
- "onUpdate:modelValue": i[0] || (i[0] = (g) => X.value = g),
833
+ selectRows: Ue
834
+ }), (p, u) => (s(), x("div", ll, [
835
+ e.showSearch ? (s(), x("section", al, [
836
+ _("div", nl, [
837
+ C(n(Be), {
838
+ modelValue: le.value,
839
+ "onUpdate:modelValue": u[0] || (u[0] = (m) => le.value = m),
827
840
  modelModifiers: { trim: !0 },
828
841
  class: "search-table__search-input !w-[260px] flex-shrink-0",
829
842
  placeholder: e.searchInputPlaceholder,
830
843
  clearable: "",
831
- onKeyup: ve(l, ["enter"]),
832
- onClear: l
844
+ onKeyup: ye(v, ["enter"]),
845
+ onClear: v
833
846
  }, null, 8, ["modelValue", "placeholder"]),
834
- re(h.$slots, "search-form", {
835
- query: P.value,
836
- search: l
847
+ J(p.$slots, "search-form", {
848
+ query: G.value,
849
+ search: v
837
850
  }, void 0, !0),
838
- _(n(L), {
851
+ C(n(M), {
839
852
  class: "search-table__search-button",
840
853
  type: "primary",
841
- onClick: l
854
+ onClick: v
842
855
  }, {
843
856
  default: y(() => [
844
- _(n(Ut)),
845
- V(" " + D(x.value), 1)
857
+ C(n(qt)),
858
+ R(" " + L(H.value), 1)
846
859
  ]),
847
860
  _: 1
848
861
  })
849
862
  ]),
850
- re(h.$slots, "top-center", {}, void 0, !0),
851
- C("div", tl, [
852
- e.showAddButton ? (o(), k(n(L), {
863
+ J(p.$slots, "top-center", {}, void 0, !0),
864
+ _("div", rl, [
865
+ e.showAddButton ? (s(), k(n(M), {
853
866
  key: 0,
854
867
  class: "search-table__add-button",
855
868
  type: "primary",
856
- onClick: i[1] || (i[1] = (g) => u("add"))
869
+ onClick: u[1] || (u[1] = (m) => i("add"))
857
870
  }, {
858
871
  default: y(() => [
859
- _(n(Wt)),
860
- i[6] || (i[6] = V("新增 ", -1))
872
+ C(n(Yt)),
873
+ u[5] || (u[5] = R("新增 ", -1))
861
874
  ]),
862
875
  _: 1
863
- })) : z("", !0),
864
- e.showBatchDeleteButton ? (o(), k(n(L), {
876
+ })) : F("", !0),
877
+ e.showBatchDeleteButton ? (s(), k(n(M), {
865
878
  key: 1,
866
879
  class: "search-table__batch-delete-button",
867
- disabled: !R.value.length,
880
+ disabled: !B.value.length,
868
881
  type: "danger",
869
- onClick: i[2] || (i[2] = (g) => u("batch-delete", R.value))
882
+ onClick: u[2] || (u[2] = (m) => i("batch-delete", B.value))
870
883
  }, {
871
884
  default: y(() => [
872
- _(n(Gt)),
873
- i[7] || (i[7] = V("批量删除 ", -1))
885
+ C(n(Jt)),
886
+ u[6] || (u[6] = R("批量删除 ", -1))
874
887
  ]),
875
888
  _: 1
876
- }, 8, ["disabled"])) : z("", !0),
877
- re(h.$slots, "btns", {}, void 0, !0)
889
+ }, 8, ["disabled"])) : F("", !0),
890
+ J(p.$slots, "btns", {}, void 0, !0)
878
891
  ])
879
- ])) : z("", !0),
880
- _(Bt, pe({ ref: "proTableRef" }, r, {
881
- class: "search-table__body flex-1 overflow-hidden",
882
- "index-offset": w.value,
892
+ ])) : F("", !0),
893
+ J(p.$slots, "table", {
883
894
  data: A.value,
884
- loading: n(ue),
885
- "default-sort": {
886
- prop: n($).sort,
887
- order: n($).order === "asc" ? "ascending" : "descending"
888
- },
889
- onApplyFilter: v,
890
- onSelectionChange: ye,
891
- onCellEdit: i[3] || (i[3] = (...g) => u("cell-edit", ...g)),
892
- onSortChange: n(ie)
893
- }), null, 16, ["index-offset", "data", "loading", "default-sort", "onSortChange"]),
894
- C("section", ll, [
895
- C("div", al, [
896
- e.selectable ? (o(), b(N, { key: 0 }, [
897
- _(n(it), { type: "info" }, {
895
+ loading: n(f),
896
+ columns: r.columns,
897
+ indexOffset: E.value,
898
+ defaultSort: ee.value,
899
+ applyFilter: c,
900
+ selectionChange: fe,
901
+ cellEdit: N,
902
+ sortChange: n(X)
903
+ }, () => [
904
+ C(Dt, ge({ ref: "proTableRef" }, r, {
905
+ class: "search-table__body flex-1 overflow-hidden",
906
+ "index-offset": E.value,
907
+ data: A.value,
908
+ loading: n(f),
909
+ "default-sort": ee.value,
910
+ onApplyFilter: c,
911
+ onSelectionChange: fe,
912
+ onCellEdit: N,
913
+ onSortChange: n(X)
914
+ }), null, 16, ["index-offset", "data", "loading", "default-sort", "onSortChange"])
915
+ ], !0),
916
+ _("section", sl, [
917
+ _("div", il, [
918
+ e.selectable ? (s(), x(q, { key: 0 }, [
919
+ C(n(ft), { type: "info" }, {
898
920
  default: y(() => [
899
- V("已选 " + D(R.value.length) + " 条", 1)
921
+ R("已选 " + L(B.value.length) + " 条", 1)
900
922
  ]),
901
923
  _: 1
902
924
  }),
903
- R.value.length ? (o(), k(n(ot), {
925
+ B.value.length ? (s(), k(n(ht), {
904
926
  key: 0,
905
927
  content: "清空勾选",
906
928
  placement: "top",
@@ -908,52 +930,52 @@ const Jt = I({ name: "ri-delete-back2-line", render: Qt }), Xt = { class: "searc
908
930
  "hide-after": 0
909
931
  }, {
910
932
  default: y(() => [
911
- _(n(L), {
933
+ C(n(M), {
912
934
  type: "danger",
913
935
  text: "",
914
936
  class: "search-table__clear-selection-button ml-1 !px-2",
915
- onClick: be
937
+ onClick: we
916
938
  }, {
917
939
  default: y(() => [
918
- _(n(Jt))
940
+ C(n(tl))
919
941
  ]),
920
942
  _: 1
921
943
  })
922
944
  ]),
923
945
  _: 1
924
- })) : z("", !0)
925
- ], 64)) : z("", !0)
946
+ })) : F("", !0)
947
+ ], 64)) : F("", !0)
926
948
  ]),
927
- _(n(ut), pe(B.value, {
928
- "page-size": E.value.pageSize,
929
- "onUpdate:pageSize": i[4] || (i[4] = (g) => E.value.pageSize = g),
930
- "current-page": E.value.currPage,
931
- "onUpdate:currentPage": i[5] || (i[5] = (g) => E.value.currPage = g),
932
- total: E.value.total,
933
- "page-sizes": J.value,
949
+ C(n(pt), ge(w.value, {
950
+ "page-size": P.value.pageSize,
951
+ "onUpdate:pageSize": u[3] || (u[3] = (m) => P.value.pageSize = m),
952
+ "current-page": P.value.currPage,
953
+ "onUpdate:currentPage": u[4] || (u[4] = (m) => P.value.currPage = m),
954
+ total: P.value.total,
955
+ "page-sizes": S.value,
934
956
  class: "search-table__pagination flex-shrink-0",
935
- onSizeChange: d,
936
- onCurrentChange: d
957
+ onSizeChange: h,
958
+ onCurrentChange: h
937
959
  }), null, 16, ["page-size", "current-page", "total", "page-sizes"]),
938
- i[8] || (i[8] = C("div", { class: "search-table__footer-spacer w-[164px]" }, null, -1))
960
+ u[7] || (u[7] = _("div", { class: "search-table__footer-spacer w-[164px]" }, null, -1))
939
961
  ])
940
962
  ]));
941
963
  }
942
- }), cl = /* @__PURE__ */ Be(nl, [["__scopeId", "data-v-2cc7f503"]]), fl = /* @__PURE__ */ se({
964
+ }), vl = /* @__PURE__ */ ze(ol, [["__scopeId", "data-v-56484700"]]), ml = /* @__PURE__ */ de({
943
965
  name: "SearchTableConfigProvider",
944
966
  __name: "ConfigProvider",
945
967
  props: {
946
- rowHeight: { default: M.rowHeight },
947
- headerHeight: { default: M.headerHeight },
948
- paginationProps: { default: () => M.paginationProps },
949
- searchProps: { default: () => M.searchProps }
968
+ rowHeight: { default: K.rowHeight },
969
+ headerHeight: { default: K.headerHeight },
970
+ paginationProps: { default: () => K.paginationProps },
971
+ searchProps: { default: () => K.searchProps }
950
972
  },
951
973
  setup(e) {
952
- return Je(De, At(e)), (c, r) => re(c.$slots, "default");
974
+ return lt(Me, Nt(e)), (d, r) => J(d.$slots, "default");
953
975
  }
954
976
  });
955
977
  export {
956
- Bt as ProTable,
957
- cl as SearchTable,
958
- fl as SearchTableConfigProvider
978
+ Dt as ProTable,
979
+ vl as SearchTable,
980
+ ml as SearchTableConfigProvider
959
981
  };