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