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