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