@amaoaaaaa/search-table 0.2.3 → 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 Ve = Object.defineProperty;
2
- var Be = (l, t, f) => t in l ? Ve(l, t, { enumerable: !0, configurable: !0, writable: !0, value: f }) : l[t] = f;
3
- var re = (l, t, f) => Be(l, typeof t != "symbol" ? t + "" : t, f);
4
- import { defineComponent as pe, computed as I, isVNode as ze, openBlock as s, createBlock as _, resolveDynamicComponent as Pe, createElementBlock as x, markRaw as q, createElementVNode as $, useModel as He, useTemplateRef as Se, ref as B, withDirectives as ee, createVNode as C, unref as a, withCtx as b, createCommentVNode as H, createTextVNode as R, toDisplayString as O, Fragment as U, renderList as te, mergeProps as fe, createSlots as Fe, isRef as _e, normalizeClass as De, toValue as ge, withModifiers as oe, withKeys as ve, normalizeStyle as be, mergeModels as xe, reactive as me, nextTick as le, toRef as Me, watch as Ce, onMounted as Ke, 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 D, ElInput as Ee, 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 he, merge as et, isEqual as tt, sortBy as lt, uniq as at, pickBy as nt, countBy as it } from "lodash-es";
7
- import { vTextEllipsis as ce } from "@amaoaaaaa/v-text-ellipsis";
8
- import { isCancel as Te } from "axios";
9
- const st = ["innerHTML"], rt = /* @__PURE__ */ pe({
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__ */ pe({
14
14
  column: {},
15
15
  index: {}
16
16
  },
17
- setup(l) {
18
- const t = l, f = I(() => {
19
- var r, h;
20
- const o = t.col.prop ? t.row[t.col.prop] : void 0;
21
- return (h = (r = t.col).formatter) == null ? void 0 : h.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) => ze(f.value) ? (s(), _(Pe(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
- $("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
- $("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 }), ht = { "element-loading-text": "加载中..." }, pt = { class: "flex justify-center" }, mt = { 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__ */ pe({
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 }), ht = { "element-loadi
75
75
  loading: { type: Boolean, default: !1 }
76
76
  }, {
77
77
  filterData: {
78
- default: () => me({})
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, h = He(l, "filterData"), k = f, V = Se("elTableRef"), g = B({}), w = B({});
85
- function ae(n) {
86
- g.value[n] = Q(h.value[n]);
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 ne(n) {
89
- g.value[n] = Q(h.value[n]);
88
+ function ie(a) {
89
+ x.value[a] = J(p.value[a]);
90
90
  }
91
- function J(n, v, e) {
92
- g.value[n] = void 0, h.value[n] = void 0, N(n, 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(n, v, e) {
95
- h.value[n] = g.value[n], w.value[n] = !1, k("applyFilter", {
96
- col: e,
97
- prop: n,
98
- type: v,
99
- value: h.value[n],
100
- filterData: h.value
94
+ function I(a, h, t) {
95
+ p.value[a] = x.value[a], H.value[a] = !1, T("applyFilter", {
96
+ col: t,
97
+ prop: a,
98
+ type: h,
99
+ value: p.value[a],
100
+ filterData: p.value
101
101
  });
102
102
  }
103
- function j(n, v) {
104
- const e = A(n.actions) ? n.actions(v) : n.actions;
105
- return e == null ? void 0 : e.map((c) => {
106
- const m = A(c.visibility) ? c.visibility(v) : c.visibility ?? !0;
107
- return { ...c, visibility: m };
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(n) {
111
- return n.filterFieldName ?? n.prop;
110
+ function b(a) {
111
+ return a.filterFieldName ?? a.prop;
112
112
  }
113
- function M(n, v) {
113
+ function Q(a, h) {
114
114
  return {
115
- color: n.text.includes("删除") ? "var(--el-color-danger)" : "",
116
- visibility: ke(v) ? void 0 : v
115
+ color: a.text.includes("删除") ? "var(--el-color-danger)" : "",
116
+ visibility: Se(h) ? void 0 : h
117
117
  };
118
118
  }
119
- const E = B([]);
120
- function W() {
121
- E.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(n, v) {
131
- return A(n.editable) ? n.editable(v) : n.editable ?? !1;
130
+ function N(a, h) {
131
+ return A(a.editable) ? a.editable(h) : a.editable ?? !1;
132
132
  }
133
- function z(n, v, e) {
134
- const c = E.value[n][v];
135
- c && (c.value = e, c.editing = !0, le(() => {
136
- var m;
137
- (m = c.inputRef) == null || m.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 P(n) {
141
- const v = E.value[n.rowIndex][n.colIndex];
142
- if (!v) return;
143
- v.editing = !1;
144
- const e = n.newValue, c = n.row[n.prop];
145
- e !== c && (n.row[n.prop] = e, k("cell-edit", n));
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 K(n, v) {
148
- const e = E.value[n][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: V,
153
- resetCells: W
154
- }), (n, v) => ee((s(), x("section", ht, [
155
- C(a(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(), _(a(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: a(A)(l.selectable) ? l.selectable : void 0
170
- }, null, 8, ["selectable"])) : H("", !0),
171
- l.showIndex ? (s(), _(a(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
- R(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"])) : H("", !0),
183
- (s(!0), x(U, null, te(l.columns, (e, c) => (s(), _(a(de), fe({ key: c }, { ref_for: !0 }, e, {
184
- align: e.align ?? "center",
185
- fixed: e.label === "操作" ? "right" : !1
186
- }), Fe({ _: 2 }, [
187
- e.filterable ?? (e.filterType || e.filterOptions || _e(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: m }) => [
190
- $("span", {
191
- class: De(["inline-flex items-center", {
192
- "text-[--el-color-primary]": S(e) && h.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(), _(a(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) => ae(S(e)),
206
- onHide: (u) => ne(S(e))
205
+ onShow: (c) => V(b(t)),
206
+ onHide: (c) => ie(b(t))
207
207
  }, {
208
- reference: b(() => [
209
- $("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
- R(O(m.label) + " ", 1),
215
- h.value[S(e)] !== void 0 ? (s(), _(a(vt), { key: 0 })) : (s(), _(a(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(), _(a(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
- C(a(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(), _(a(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 }), ht = { "element-loadi
238
238
  }, 1032, ["modelValue", "onUpdate:modelValue"])
239
239
  ]),
240
240
  _: 2
241
- }, 1024)) : e.filterType === "checkbox" ? (s(), _(a(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
- C(a(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(), _(a(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,46 +260,46 @@ const vt = q({ name: "tabler-filter-check", render: ft }), ht = { "element-loadi
260
260
  }, 1032, ["modelValue", "onUpdate:modelValue"])
261
261
  ]),
262
262
  _: 2
263
- }, 1024)) : e.filterType === "datetimerange" ? (s(), _(a(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"])) : H("", !0),
274
- v[4] || (v[4] = $("div", { class: "-mx-3 my-3 border-t" }, null, -1)),
275
- $("div", pt, [
276
- $("div", mt, [
277
- C(a(D), {
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] = [
287
+ default: y(() => [...h[2] || (h[2] = [
288
288
  R("重置", -1)
289
289
  ])]),
290
290
  _: 1
291
291
  }, 8, ["onClick"]),
292
- C(a(D), {
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] = [
302
+ default: y(() => [...h[3] || (h[3] = [
303
303
  R("确定", -1)
304
304
  ])]),
305
305
  _: 1
@@ -308,112 +308,112 @@ const vt = q({ name: "tabler-filter-check", render: ft }), ht = { "element-loadi
308
308
  ])
309
309
  ]),
310
310
  _: 2
311
- }, 1032, ["visible", "onUpdate:visible", "width", "onShow", "onHide"])) : H("", !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: m, column: u, $index: F }) => [
319
- ee((s(), x("div", null, [
320
- C(rt, {
321
- col: e,
322
- row: m,
323
- column: u,
324
- index: F
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
325
325
  }, null, 8, ["col", "row", "column", "index"])
326
326
  ])), [
327
- [a(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: m, $index: u }) => {
334
- var F, 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, m) ? (s(), x(U, { key: 0 }, [
338
- (Y = (F = E.value[u]) == null ? void 0 : F[c]) != null && Y.editing ? (s(), _(a(Ee), {
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) => E.value[u][c].inputRef = d,
342
- modelValue: E.value[u][c].value,
343
- "onUpdate:modelValue": (d) => E.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) => P({
349
- rowIndex: u,
350
- colIndex: c,
351
- row: m,
352
- prop: e.prop,
353
- oldValue: m[e.prop],
354
- newValue: E.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) => P({
358
- rowIndex: u,
359
- colIndex: c,
360
- row: m,
361
- prop: e.prop,
362
- oldValue: m[e.prop],
363
- newValue: E.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) => K(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) => z(u, c, m[e.prop])
370
+ onDblclick: (u) => oe(c, m, f[t.prop])
371
371
  }, [
372
- R(O(m[e.prop]), 1)
373
- ], 40, gt)), [
374
- [a(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
- R(O(m[e.prop]), 1)
376
+ ], 64)) : te((s(), w("div", _t, [
377
+ R(O(f[t.prop]), 1)
378
378
  ])), [
379
- [a(ce), e.truncate ?? !0]
379
+ [n(he), t.truncate ?? !0]
380
380
  ])
381
- ])) : H("", !0),
382
- (s(!0), x(U, null, te(j(e, m), (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(), _(a(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: a(ke)(d.confirmText) ? `是否确认${d.text}?` : a(A)(d.confirmText) ? d.confirmText(m) : d.confirmText ?? `是否确认${d.text}?`,
391
- onConfirm: (se) => d.visibility === "hidden" ? void 0 : d.handler(m)
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
- C(a(D), {
393
+ reference: y(() => [
394
+ S(n(M), {
395
395
  link: "",
396
- type: d.type ?? "primary",
397
- style: be(M(d, d.visibility)),
398
- disabled: a(A)(d.disabled) ? d.disabled(m) : 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
- R(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(), _(a(D), {
407
+ }, 1032, ["title", "onConfirm"])) : (s(), k(n(M), {
408
408
  key: 1,
409
409
  link: "",
410
- type: d.type ?? "primary",
411
- style: be(M(d, d.visibility)),
412
- disabled: a(A)(d.disabled) ? d.disabled(m) : d.disabled,
413
- onClick: (se) => d.visibility === "hidden" ? void 0 : d.handler(m)
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
- R(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 }), ht = { "element-loadi
427
427
  _: 1
428
428
  }, 8, ["data", "row-key"])
429
429
  ])), [
430
- [a(o), l.loading]
430
+ [n(r), e.loading]
431
431
  ]);
432
432
  }
433
- }), $e = (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__ */ $e(xt, [["__scopeId", "data-v-476baef5"]]);
439
- function kt(l) {
440
- var t, f, o, r, h, k, V;
441
- if (Ze(l))
442
- return l.includes("database") || l.includes("java.sql.") ? "接口异常" : l;
443
- if (Te(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 = he(l)) == null ? void 0 : f[0]]) == null ? void 0 : o[0]) != null && r.message) ? (V = (k = l[(h = he(l)) == null ? void 0 : h[0]]) == null ? void 0 : k[0]) == null ? void 0 : V.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 _t(l, t, f) {
543
- let o, r;
544
- _e(l) ? (o = l, r = t) : (o = Me(l, t), r = 300);
545
- const h = B(o.value);
546
- let k = null;
547
- const V = () => {
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
- return Ce(
551
- o,
552
- (g) => {
553
- g ? (V(), k = setTimeout(() => {
554
- h.value = !0;
555
- }, r)) : (V(), h.value = !1);
550
+ return Ee(
551
+ r,
552
+ (x) => {
553
+ x ? (E(), T = setTimeout(() => {
554
+ p.value = !0;
555
+ }, o)) : (E(), p.value = !1);
556
556
  },
557
557
  { immediate: !1 }
558
- ), h;
558
+ ), p;
559
559
  }
560
- function Ct({ 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 = me(Q(o));
568
- let h = Q(r);
569
- function k({
570
- prop: V,
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 = V || "", r.order = g === "ascending" ? "asc" : "desc", t()) : (r.sort = o.sort, r.order = o.order, tt(r, h) && (r.order = r.order === "asc" ? "desc" : "asc"), f ? f() : t()), h = 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
+ };
579
+ }
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
+ )
578
598
  };
579
599
  }
580
- const Et = {
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 Tt(l, t) {
586
- return s(), x("svg", Et, [...t[0] || (t[0] = [
587
- $("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 $t = q({ name: "ri-search-line", render: Tt }), Rt = {
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 Vt(l, t) {
599
- return s(), x("svg", Rt, [...t[0] || (t[0] = [
600
- $("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 Bt = q({ name: "ri-add-line", render: Vt }), zt = {
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 Pt(l, t) {
612
- return s(), x("svg", zt, [...t[0] || (t[0] = [
613
- $("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 Ht = q({ name: "ri-delete-bin-line", render: Pt }), Ft = {
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 Dt(l, t) {
625
- return s(), x("svg", Ft, [...t[0] || (t[0] = [
626
- $("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 Mt = q({ name: "ri-delete-back2-line", render: Dt }), Kt = { class: "search-table 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
654
  class: "search-table__toolbar mb-6 flex flex-shrink-0 items-center justify-between"
635
- }, At = { class: "search-table__search flex items-center gap-x-3" }, Ot = { class: "search-table__actions" }, Ut = { class: "search-table__footer mt-5 flex flex-shrink-0 items-center justify-between" }, Nt = { class: "search-table__selection flex w-[164px] items-center" }, jt = /* @__PURE__ */ pe({
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,243 +674,254 @@ const Mt = q({ name: "ri-delete-back2-line", render: Dt }), Kt = { class: "searc
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, h = Se("proTableRef"), { sortState: k, onSortChange: V } = Ct({
659
- defaultSort: o.defaultSort,
660
- fetchFn: P,
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, T;
663
- const p = k.sort, i = k.order === "asc" ? "ascending" : "descending";
664
- o.columns.some((G) => G.prop === p) ? (T = (y = h.value) == null ? void 0 : y.tableInstance) == null || T.sort(p, i) : P();
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 = B(o.pageSize ?? 0), w = B({
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
- }), ae = I(() => lt(at([g.value, 10, 20, 30, 40, 50, 100]))), ne = I(() => (w.value.currPage - 1) * w.value.pageSize), J = B(0), N = I(() => o.searchField ?? "search"), j = B({
671
- [N.value]: ""
672
- }), S = I({
673
- get: () => j.value[N.value] ?? "",
674
- set: (p) => {
675
- j.value[N.value] = p;
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
- }), M = me({}), E = B([]), W = B(!1), ie = _t(W, 100);
678
- let z = null;
679
- async function P() {
680
- z == null || z.abort(), z = new AbortController(), W.value = !0;
681
- const p = ne.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
- ...M,
686
- ...k,
687
- limit: w.value.pageSize,
688
- offset: p
689
- }, y = o.searchParamsHandler ? o.searchParamsHandler(i) : i, { data: T = [], totalCount: G = 0 } = await o.fetchFn(y, {
690
- signal: z.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
- E.value = T, J.value = p, w.value.total = G, await le(() => {
693
- var L, X, Z;
694
- (X = (L = h.value) == null ? void 0 : L.tableInstance) == null || X.setScrollTop(0), (Z = h.value) == null || Z.resetCells();
695
- }), o.selectable && Re(T);
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 (Te(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 K() {
703
- w.value.currPage = 1, P();
722
+ function a() {
723
+ V.value.currPage = 1, F();
704
724
  }
705
- function n({ type: p, value: i, prop: y, col: T }) {
706
- if (p === "datetimerange") {
707
- const [G = `${y}Start`, L = `${y}End`] = T.datetimerangeFilterFieldNames || [], [X, Z] = i || [];
708
- M[G] = X, M[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
- M[y] = i;
711
- K();
730
+ $[g] = i;
731
+ a();
712
732
  }
713
- const v = async () => {
714
- W.value || (ye(), await P());
733
+ const t = async () => {
734
+ N.value || (ye(), await F());
715
735
  };
716
- function e() {
736
+ function m() {
717
737
  var L;
718
- const T = ((L = h.value) == null ? void 0 : L.$el).offsetHeight - 40;
719
- return Math.floor(T / 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 = B([]), m = I(() => c.value), u = new St(o.rowKey);
722
- let F = !1;
723
- const Y = (p) => {
724
- F || (u.syncPage(E.value, p), c.value = u.values);
725
- }, d = () => c.value, se = (p) => {
726
- Y(p);
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 p, i;
729
- (i = (p = h.value) == null ? void 0 : p.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 && Ce(E, async () => {
732
- F = !0, await le(), u.restorePageSelection(E.value, (p, i) => {
733
- var y, T;
734
- (T = (y = h.value) == null ? void 0 : y.tableInstance) == null || T.toggleRowSelection(p, i);
735
- }), await le(), F = !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 Re(p) {
738
- const i = p.map((T) => T[o.rowKey]), y = he(nt(it(i), (T) => T > 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 Ke(() => {
745
- if (!w.value.pageSize) {
746
- const p = e();
747
- g.value = p, w.value.pageSize = p;
764
+ return Ne(() => {
765
+ if (!V.value.pageSize) {
766
+ const v = m();
767
+ H.value = v, V.value.pageSize = v;
748
768
  }
749
- P();
750
- }), Le(() => {
751
- z == null || z.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: m,
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
- }), (p, i) => (s(), x("div", Kt, [
770
- l.showSearch ? (s(), x("section", Lt, [
771
- $("div", At, [
772
- C(a(Ee), {
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
796
  class: "search-table__search-input !w-[260px] flex-shrink-0",
777
- placeholder: l.searchInputPlaceholder,
797
+ placeholder: e.searchInputPlaceholder,
778
798
  clearable: "",
779
- onKeyup: ve(K, ["enter"]),
780
- onClear: K
799
+ onKeyup: pe(a, ["enter"]),
800
+ onClear: a
781
801
  }, null, 8, ["modelValue", "placeholder"]),
782
- ue(p.$slots, "search-form", {
783
- query: j.value,
784
- search: K
802
+ ne(v.$slots, "search-form", {
803
+ query: b.value,
804
+ search: a
785
805
  }, void 0, !0),
786
- C(a(D), {
806
+ S(n(M), {
787
807
  class: "search-table__search-button",
788
808
  type: "primary",
789
- onClick: K
809
+ onClick: a
790
810
  }, {
791
- default: b(() => [
792
- C(a($t)),
811
+ default: y(() => [
812
+ S(n(Ft)),
793
813
  i[6] || (i[6] = R(" 搜索 ", -1))
794
814
  ]),
795
815
  _: 1
796
816
  })
797
817
  ]),
798
- ue(p.$slots, "top-center", {}, void 0, !0),
799
- $("div", Ot, [
800
- l.showAddButton ? (s(), _(a(D), {
818
+ ne(v.$slots, "top-center", {}, void 0, !0),
819
+ _("div", It, [
820
+ e.showAddButton ? (s(), k(n(M), {
801
821
  key: 0,
802
822
  class: "search-table__add-button",
803
823
  type: "primary",
804
- onClick: i[1] || (i[1] = (y) => r("add"))
824
+ onClick: i[1] || (i[1] = (g) => o("add"))
805
825
  }, {
806
- default: b(() => [
807
- C(a(Bt)),
826
+ default: y(() => [
827
+ S(n(Kt)),
808
828
  i[7] || (i[7] = R("新增 ", -1))
809
829
  ]),
810
830
  _: 1
811
- })) : H("", !0),
812
- l.showBatchDeleteButton ? (s(), _(a(D), {
831
+ })) : z("", !0),
832
+ e.showBatchDeleteButton ? (s(), k(n(M), {
813
833
  key: 1,
814
834
  class: "search-table__batch-delete-button",
815
- disabled: !c.value.length,
835
+ disabled: !f.value.length,
816
836
  type: "danger",
817
- onClick: i[2] || (i[2] = (y) => r("batch-delete", c.value))
837
+ onClick: i[2] || (i[2] = (g) => o("batch-delete", f.value))
818
838
  }, {
819
- default: b(() => [
820
- C(a(Ht)),
839
+ default: y(() => [
840
+ S(n(Ot)),
821
841
  i[8] || (i[8] = R("批量删除 ", -1))
822
842
  ]),
823
843
  _: 1
824
- }, 8, ["disabled"])) : H("", !0),
825
- ue(p.$slots, "btns", {}, void 0, !0)
844
+ }, 8, ["disabled"])) : z("", !0),
845
+ ne(v.$slots, "btns", {}, void 0, !0)
826
846
  ])
827
- ])) : H("", !0),
828
- C(wt, fe({ ref: "proTableRef" }, o, {
847
+ ])) : z("", !0),
848
+ S(Et, ve({ ref: "proTableRef" }, r, {
829
849
  class: "search-table__body flex-1 overflow-hidden",
830
- "index-offset": J.value,
831
- data: E.value,
832
- loading: a(ie),
850
+ "index-offset": I.value,
851
+ data: K.value,
852
+ loading: n(oe),
833
853
  "default-sort": {
834
- prop: a(k).sort,
835
- order: a(k).order === "asc" ? "ascending" : "descending"
854
+ prop: n(E).sort,
855
+ order: n(E).order === "asc" ? "ascending" : "descending"
836
856
  },
837
- onApplyFilter: n,
838
- onSelectionChange: Y,
839
- onCellEdit: i[3] || (i[3] = (...y) => r("cell-edit", ...y)),
840
- onSortChange: a(V)
857
+ onApplyFilter: h,
858
+ onSelectionChange: u,
859
+ onCellEdit: i[3] || (i[3] = (...g) => o("cell-edit", ...g)),
860
+ onSortChange: n(x)
841
861
  }), null, 16, ["index-offset", "data", "loading", "default-sort", "onSortChange"]),
842
- $("section", Ut, [
843
- $("div", Nt, [
844
- l.selectable ? (s(), x(U, { key: 0 }, [
845
- C(a(Ye), { type: "info" }, {
846
- default: b(() => [
847
- R("已选 " + 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)
848
868
  ]),
849
869
  _: 1
850
870
  }),
851
- c.value.length ? (s(), _(a(Qe), {
871
+ f.value.length ? (s(), k(n(lt), {
852
872
  key: 0,
853
873
  content: "清空勾选",
854
874
  placement: "top",
855
875
  effect: "dark",
856
876
  "hide-after": 0
857
877
  }, {
858
- default: b(() => [
859
- C(a(D), {
878
+ default: y(() => [
879
+ S(n(M), {
860
880
  type: "danger",
861
881
  text: "",
862
882
  class: "search-table__clear-selection-button ml-1 !px-2",
863
883
  onClick: ye
864
884
  }, {
865
- default: b(() => [
866
- C(a(Mt))
885
+ default: y(() => [
886
+ S(n(jt))
867
887
  ]),
868
888
  _: 1
869
889
  })
870
890
  ]),
871
891
  _: 1
872
- })) : H("", !0)
873
- ], 64)) : H("", !0)
892
+ })) : z("", !0)
893
+ ], 64)) : z("", !0)
874
894
  ]),
875
- C(a(Je), fe(l.elPaginationProps, {
876
- "page-size": w.value.pageSize,
877
- "onUpdate:pageSize": i[4] || (i[4] = (y) => w.value.pageSize = y),
878
- "current-page": w.value.currPage,
879
- "onUpdate:currentPage": i[5] || (i[5] = (y) => w.value.currPage = y),
880
- 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,
881
901
  background: "",
882
- "page-sizes": ae.value,
902
+ "page-sizes": ie.value,
883
903
  layout: "total, sizes, prev, pager, next, jumper",
884
904
  class: "search-table__pagination flex-shrink-0",
885
- onSizeChange: P,
886
- onCurrentChange: P
905
+ onSizeChange: F,
906
+ onCurrentChange: F
887
907
  }), null, 16, ["page-size", "current-page", "total", "page-sizes"]),
888
- i[9] || (i[9] = $("div", { class: "search-table__footer-spacer w-[164px]" }, null, -1))
908
+ i[9] || (i[9] = _("div", { class: "search-table__footer-spacer w-[164px]" }, null, -1))
889
909
  ])
890
910
  ]));
891
911
  }
892
- }), Jt = /* @__PURE__ */ $e(jt, [["__scopeId", "data-v-4e564d86"]]);
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
+ });
893
923
  export {
894
- wt as ProTable,
895
- Jt as SearchTable
924
+ Et as ProTable,
925
+ nl as SearchTable,
926
+ rl as SearchTableConfigProvider
896
927
  };