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