vue3-smart-table 1.0.4 → 1.0.6
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/README.md +1 -1
- package/dist/vue3-smart-table.cjs.js +1 -1
- package/dist/vue3-smart-table.cjs.js.map +1 -1
- package/dist/vue3-smart-table.es.js +430 -418
- package/dist/vue3-smart-table.es.js.map +1 -1
- package/dist/vue3-smart-table.umd.js +2 -2
- package/dist/vue3-smart-table.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SmartTable/hooks/useOperationColumn.ts +5 -1
- package/src/components/SmartTable/index.vue +219 -21
- package/src/components/SmartTable/renderer.ts +3 -2
- package/src/components/SmartTable/renderers/index.ts +6 -2
- package/src/components/SmartTable/renderers/input.vue +1 -0
- package/src/components/SmartTable/renderers/inputNumber.vue +1 -0
- package/src/components/SmartTable/renderers/select.vue +1 -0
- package/src/components/SmartTable/types.ts +11 -1
- package/src/components/SmartTable/column/index.vue +0 -170
|
@@ -1,19 +1,105 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import { ElImage as q, ElTag as
|
|
6
|
-
import { CopyDocument as
|
|
7
|
-
|
|
1
|
+
var ce = Object.defineProperty;
|
|
2
|
+
var de = (t, e, n) => e in t ? ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var W = (t, e, n) => de(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { ref as L, watch as F, computed as S, defineComponent as R, h as m, resolveComponent as O, createBlock as w, openBlock as y, mergeProps as x, withKeys as J, withCtx as V, createElementBlock as A, Fragment as $, renderList as M, resolveDirective as fe, withDirectives as me, createSlots as ye, createTextVNode as X, toDisplayString as P, renderSlot as Z, resolveDynamicComponent as pe, unref as ee, normalizeClass as ge, normalizeStyle as he, normalizeProps as be, guardReactiveProps as ve } from "vue";
|
|
5
|
+
import { ElImage as q, ElTag as Ce, ElMessage as K, ElButton as we } from "element-plus";
|
|
6
|
+
import { CopyDocument as ke, DocumentCopy as _e } from "@element-plus/icons-vue";
|
|
7
|
+
function te(t, e) {
|
|
8
|
+
if (!(e != null && e.length)) return t;
|
|
9
|
+
const n = new Map(
|
|
10
|
+
e.map((l) => [l.key, l])
|
|
11
|
+
);
|
|
12
|
+
return t.map((l) => {
|
|
13
|
+
const i = n.get(l.key);
|
|
14
|
+
return i ? {
|
|
15
|
+
...l,
|
|
16
|
+
visible: typeof i.visible == "boolean" ? i.visible : l.visible
|
|
17
|
+
} : l;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function xe(t, e) {
|
|
21
|
+
const { cacheKey: n, storage: l = localStorage } = e || {}, i = n ? l.getItem(n) : null, r = L(
|
|
22
|
+
te(
|
|
23
|
+
t,
|
|
24
|
+
i ? JSON.parse(i) : []
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
return F(
|
|
28
|
+
r,
|
|
29
|
+
(s) => {
|
|
30
|
+
if (!n) return;
|
|
31
|
+
const d = s.map((f) => ({
|
|
32
|
+
key: f.key,
|
|
33
|
+
visible: f.visible,
|
|
34
|
+
columnOpts: f.columnOpts
|
|
35
|
+
}));
|
|
36
|
+
l.setItem(
|
|
37
|
+
n,
|
|
38
|
+
JSON.stringify(d)
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
{ deep: !0 }
|
|
42
|
+
), {
|
|
43
|
+
/** 当前列配置(响应式) */
|
|
44
|
+
columns: r,
|
|
45
|
+
/**
|
|
46
|
+
* 主动设置列配置
|
|
47
|
+
* 常用于:列设置弹窗 / 拖拽排序完成
|
|
48
|
+
*/
|
|
49
|
+
setColumns(s) {
|
|
50
|
+
r.value = te(
|
|
51
|
+
t,
|
|
52
|
+
s
|
|
53
|
+
), n && l.setItem(
|
|
54
|
+
n,
|
|
55
|
+
JSON.stringify(s)
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* 重置为默认列配置
|
|
60
|
+
*/
|
|
61
|
+
resetColumns() {
|
|
62
|
+
r.value = t, n && l.removeItem(n);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function Be(t, e = 10, n = []) {
|
|
67
|
+
const i = "*:*:*", r = (c) => {
|
|
68
|
+
if (!c) return !0;
|
|
69
|
+
const g = Array.isArray(c) ? c : [c];
|
|
70
|
+
return n.some(
|
|
71
|
+
(b) => b === i || g.includes(b)
|
|
72
|
+
);
|
|
73
|
+
}, s = S(() => t.some((c) => r(c.permission))), d = S(() => t.filter((g) => r(g.permission)).slice(0, e).reduce(
|
|
74
|
+
(g, b) => g + (b.width ?? 55),
|
|
75
|
+
0
|
|
76
|
+
)), f = (c, g) => r(c.permission) && (c.visible ? c.visible(g) : !0), h = (c) => t.filter((b) => f(b, c)).slice(0, e).reduce(
|
|
77
|
+
(b, I) => b + (I.width ?? 55),
|
|
78
|
+
0
|
|
79
|
+
);
|
|
80
|
+
return {
|
|
81
|
+
hasAnyButton: s,
|
|
82
|
+
optWidth: d,
|
|
83
|
+
hasAnyVisibleButton: (c) => c != null && c.length ? c.some(
|
|
84
|
+
(g) => t.some((b) => f(b, g))
|
|
85
|
+
) : !1,
|
|
86
|
+
getMaxOptWidth: (c) => c != null && c.length ? c.reduce(
|
|
87
|
+
(g, b) => Math.max(g, h(b)),
|
|
88
|
+
0
|
|
89
|
+
) : d.value,
|
|
90
|
+
getVisibleButtons: (c) => t.filter((g) => f(g, c)).slice(0, e)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
class Se {
|
|
8
94
|
constructor() {
|
|
9
|
-
|
|
95
|
+
W(this, "renderers", /* @__PURE__ */ new Map());
|
|
10
96
|
}
|
|
11
97
|
register(e, n) {
|
|
12
98
|
this.renderers.has(e) && process.env.NODE_ENV === "development" && console.debug(`[SmartTable] Renderer "${e}" already registered, skipping.`), this.renderers.set(e, n);
|
|
13
99
|
}
|
|
14
100
|
registerMultiple(e) {
|
|
15
|
-
Object.entries(e).forEach(([n,
|
|
16
|
-
this.renderers.has(n) || this.renderers.set(n,
|
|
101
|
+
Object.entries(e).forEach(([n, l]) => {
|
|
102
|
+
this.renderers.has(n) || this.renderers.set(n, l);
|
|
17
103
|
});
|
|
18
104
|
}
|
|
19
105
|
get(e) {
|
|
@@ -32,27 +118,27 @@ class ke {
|
|
|
32
118
|
return Array.from(this.renderers.keys());
|
|
33
119
|
}
|
|
34
120
|
}
|
|
35
|
-
let
|
|
36
|
-
function
|
|
37
|
-
return
|
|
121
|
+
let D = null;
|
|
122
|
+
function H() {
|
|
123
|
+
return D || (D = new Se()), D;
|
|
38
124
|
}
|
|
39
|
-
function
|
|
40
|
-
return
|
|
41
|
-
props: ["row", "col", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
125
|
+
function U(t) {
|
|
126
|
+
return R({
|
|
127
|
+
props: ["row", "col", "index", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
42
128
|
setup(e) {
|
|
43
|
-
return () =>
|
|
129
|
+
return () => m(t, e);
|
|
44
130
|
}
|
|
45
131
|
});
|
|
46
132
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
49
|
-
props: ["row", "col", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
133
|
+
function B(t) {
|
|
134
|
+
return R({
|
|
135
|
+
props: ["row", "col", "index", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
50
136
|
setup(e) {
|
|
51
137
|
return () => t(e);
|
|
52
138
|
}
|
|
53
139
|
});
|
|
54
140
|
}
|
|
55
|
-
function
|
|
141
|
+
function Ge(t, e) {
|
|
56
142
|
if (process.env.NODE_ENV !== "production" && e)
|
|
57
143
|
switch (t) {
|
|
58
144
|
case "dict":
|
|
@@ -88,118 +174,121 @@ function He(t, e) {
|
|
|
88
174
|
}
|
|
89
175
|
function v(t, e) {
|
|
90
176
|
if (!(!t || !e))
|
|
91
|
-
return e.split(".").reduce((n,
|
|
177
|
+
return e.split(".").reduce((n, l) => n == null ? void 0 : n[l], t);
|
|
92
178
|
}
|
|
93
|
-
function
|
|
179
|
+
function Y(t, e, n) {
|
|
94
180
|
if (!t || !e) return;
|
|
95
|
-
const
|
|
96
|
-
|
|
181
|
+
const l = e.split("."), i = l.pop(), r = l.reduce((s, d) => (s[d] || (s[d] = {}), s[d]), t);
|
|
182
|
+
r[i] = n;
|
|
97
183
|
}
|
|
98
|
-
const
|
|
184
|
+
const Ee = /* @__PURE__ */ R({
|
|
99
185
|
__name: "input",
|
|
100
186
|
props: {
|
|
101
187
|
row: {},
|
|
102
188
|
col: {},
|
|
189
|
+
index: {},
|
|
103
190
|
onCellBlur: { type: Function },
|
|
104
191
|
onCellEnter: { type: Function }
|
|
105
192
|
},
|
|
106
193
|
setup(t) {
|
|
107
|
-
const e = t, n =
|
|
108
|
-
|
|
109
|
-
|
|
194
|
+
const e = t, n = L(v(e.row, e.col.key));
|
|
195
|
+
F(n, (r) => {
|
|
196
|
+
Y(e.row, e.col.key, r);
|
|
110
197
|
});
|
|
111
|
-
const
|
|
112
|
-
var
|
|
113
|
-
return (
|
|
114
|
-
},
|
|
115
|
-
var
|
|
116
|
-
return (
|
|
198
|
+
const l = () => {
|
|
199
|
+
var r;
|
|
200
|
+
return (r = e.onCellBlur) == null ? void 0 : r.call(e, e.row, e.col);
|
|
201
|
+
}, i = () => {
|
|
202
|
+
var r;
|
|
203
|
+
return (r = e.onCellEnter) == null ? void 0 : r.call(e, e.row, e.col);
|
|
117
204
|
};
|
|
118
|
-
return (
|
|
119
|
-
const
|
|
120
|
-
return
|
|
205
|
+
return (r, s) => {
|
|
206
|
+
const d = O("el-input");
|
|
207
|
+
return y(), w(d, x({
|
|
121
208
|
modelValue: n.value,
|
|
122
|
-
"onUpdate:modelValue":
|
|
209
|
+
"onUpdate:modelValue": s[0] || (s[0] = (f) => n.value = f)
|
|
123
210
|
}, { placeholder: "", size: "small", clearable: !0, ...t.col.renderProps }, {
|
|
124
|
-
onBlur:
|
|
125
|
-
onKeyup:
|
|
211
|
+
onBlur: l,
|
|
212
|
+
onKeyup: J(i, ["enter"])
|
|
126
213
|
}), null, 16, ["modelValue"]);
|
|
127
214
|
};
|
|
128
215
|
}
|
|
129
|
-
}),
|
|
216
|
+
}), Te = /* @__PURE__ */ R({
|
|
130
217
|
__name: "inputNumber",
|
|
131
218
|
props: {
|
|
132
219
|
row: {},
|
|
133
220
|
col: {},
|
|
221
|
+
index: {},
|
|
134
222
|
onCellChange: { type: Function },
|
|
135
223
|
onCellBlur: { type: Function },
|
|
136
224
|
onCellEnter: { type: Function }
|
|
137
225
|
},
|
|
138
226
|
setup(t) {
|
|
139
|
-
const e = t, n =
|
|
140
|
-
|
|
141
|
-
var
|
|
142
|
-
|
|
227
|
+
const e = t, n = L(v(e.row, e.col.key));
|
|
228
|
+
F(n, (r) => {
|
|
229
|
+
var s;
|
|
230
|
+
Y(e.row, e.col.key, r), (s = e.onCellChange) == null || s.call(e, e.row, e.col);
|
|
143
231
|
});
|
|
144
|
-
const
|
|
145
|
-
var
|
|
146
|
-
return (
|
|
147
|
-
},
|
|
148
|
-
var
|
|
149
|
-
return (
|
|
232
|
+
const l = () => {
|
|
233
|
+
var r;
|
|
234
|
+
return (r = e.onCellBlur) == null ? void 0 : r.call(e, e.row, e.col);
|
|
235
|
+
}, i = () => {
|
|
236
|
+
var r;
|
|
237
|
+
return (r = e.onCellEnter) == null ? void 0 : r.call(e, e.row, e.col);
|
|
150
238
|
};
|
|
151
|
-
return (
|
|
152
|
-
const
|
|
153
|
-
return
|
|
239
|
+
return (r, s) => {
|
|
240
|
+
const d = O("el-input-number");
|
|
241
|
+
return y(), w(d, x({
|
|
154
242
|
modelValue: n.value,
|
|
155
|
-
"onUpdate:modelValue":
|
|
243
|
+
"onUpdate:modelValue": s[0] || (s[0] = (f) => n.value = f)
|
|
156
244
|
}, { min: 0, max: 99999, controls: !1, size: "small", ...t.col.renderProps }, {
|
|
157
|
-
onBlur:
|
|
158
|
-
onKeyup:
|
|
245
|
+
onBlur: l,
|
|
246
|
+
onKeyup: J(i, ["enter"])
|
|
159
247
|
}), null, 16, ["modelValue"]);
|
|
160
248
|
};
|
|
161
249
|
}
|
|
162
|
-
}),
|
|
250
|
+
}), Ve = /* @__PURE__ */ R({
|
|
163
251
|
__name: "select",
|
|
164
252
|
props: {
|
|
165
253
|
row: {},
|
|
166
254
|
col: {},
|
|
255
|
+
index: {},
|
|
167
256
|
onCellChange: { type: Function },
|
|
168
257
|
onCellBlur: { type: Function },
|
|
169
258
|
onCellEnter: { type: Function }
|
|
170
259
|
},
|
|
171
260
|
setup(t) {
|
|
172
|
-
const e = t, n =
|
|
173
|
-
|
|
174
|
-
|
|
261
|
+
const e = t, n = L(v(e.row, e.col.key));
|
|
262
|
+
F(n, (s) => {
|
|
263
|
+
Y(e.row, e.col.key, s);
|
|
175
264
|
});
|
|
176
|
-
const
|
|
177
|
-
var
|
|
178
|
-
return (
|
|
179
|
-
},
|
|
180
|
-
var
|
|
181
|
-
return (
|
|
182
|
-
},
|
|
183
|
-
var
|
|
184
|
-
return (
|
|
265
|
+
const l = () => {
|
|
266
|
+
var s;
|
|
267
|
+
return (s = e.onCellChange) == null ? void 0 : s.call(e, e.row, e.col);
|
|
268
|
+
}, i = () => {
|
|
269
|
+
var s;
|
|
270
|
+
return (s = e.onCellBlur) == null ? void 0 : s.call(e, e.row, e.col);
|
|
271
|
+
}, r = () => {
|
|
272
|
+
var s;
|
|
273
|
+
return (s = e.onCellEnter) == null ? void 0 : s.call(e, e.row, e.col);
|
|
185
274
|
};
|
|
186
|
-
return (
|
|
187
|
-
const
|
|
188
|
-
return
|
|
275
|
+
return (s, d) => {
|
|
276
|
+
const f = O("el-option"), h = O("el-select");
|
|
277
|
+
return y(), w(h, x({
|
|
189
278
|
modelValue: n.value,
|
|
190
|
-
"onUpdate:modelValue":
|
|
279
|
+
"onUpdate:modelValue": d[0] || (d[0] = (k) => n.value = k)
|
|
191
280
|
}, { placeholder: "请选择", size: "small", clearable: !0, ...t.col.renderProps }, {
|
|
192
|
-
onChange:
|
|
193
|
-
onBlur:
|
|
194
|
-
onKeyup:
|
|
281
|
+
onChange: l,
|
|
282
|
+
onBlur: i,
|
|
283
|
+
onKeyup: J(r, ["enter"])
|
|
195
284
|
}), {
|
|
196
|
-
default:
|
|
197
|
-
var
|
|
285
|
+
default: V(() => {
|
|
286
|
+
var k;
|
|
198
287
|
return [
|
|
199
|
-
(
|
|
200
|
-
key:
|
|
201
|
-
label:
|
|
202
|
-
value:
|
|
288
|
+
(y(!0), A($, null, M(((k = t.col.renderProps) == null ? void 0 : k.options) || [], (E) => (y(), w(f, {
|
|
289
|
+
key: E.value,
|
|
290
|
+
label: E.label,
|
|
291
|
+
value: E.value
|
|
203
292
|
}, null, 8, ["label", "value"]))), 128))
|
|
204
293
|
];
|
|
205
294
|
}),
|
|
@@ -207,33 +296,33 @@ const we = /* @__PURE__ */ O({
|
|
|
207
296
|
}, 16, ["modelValue"]);
|
|
208
297
|
};
|
|
209
298
|
}
|
|
210
|
-
}),
|
|
299
|
+
}), Ae = U(Ee), Me = U(Te), Oe = U(Ve), $e = B((t) => {
|
|
211
300
|
const e = t.col.renderProps || {}, n = v(t.row, t.col.key);
|
|
212
|
-
return
|
|
301
|
+
return m(we, {
|
|
213
302
|
type: e.type || "primary",
|
|
214
303
|
...e,
|
|
215
304
|
onClick: () => {
|
|
216
|
-
var
|
|
217
|
-
return (
|
|
305
|
+
var l;
|
|
306
|
+
return (l = t.onClick) == null ? void 0 : l.call(t, t.row, t.col);
|
|
218
307
|
}
|
|
219
308
|
}, () => e.label || n);
|
|
220
|
-
}),
|
|
309
|
+
}), Fe = B((t) => {
|
|
221
310
|
const e = t.col.renderProps || {}, n = v(t.row, t.col.key);
|
|
222
|
-
return
|
|
311
|
+
return m("a", {
|
|
223
312
|
href: e.href || "#",
|
|
224
313
|
target: e.blank ? "_blank" : "_self",
|
|
225
314
|
style: e.style || "color:#409EFF;cursor:pointer;"
|
|
226
315
|
}, e.label || n);
|
|
227
|
-
}),
|
|
316
|
+
}), Re = B((t) => {
|
|
228
317
|
var n;
|
|
229
318
|
const e = v(t.row, t.col.key);
|
|
230
|
-
return
|
|
319
|
+
return m("div", {
|
|
231
320
|
class: "line-clamp-2",
|
|
232
321
|
innerHTML: e ?? "",
|
|
233
322
|
...((n = t.col) == null ? void 0 : n.renderProps) || {}
|
|
234
323
|
});
|
|
235
|
-
}),
|
|
236
|
-
const e = v(t.row, t.col.key) ?? "", n = t.col.renderProps ?? {},
|
|
324
|
+
}), ze = B((t) => {
|
|
325
|
+
const e = v(t.row, t.col.key) ?? "", n = t.col.renderProps ?? {}, l = {
|
|
237
326
|
position: "absolute",
|
|
238
327
|
right: "-5px",
|
|
239
328
|
top: "50%",
|
|
@@ -243,7 +332,7 @@ const we = /* @__PURE__ */ O({
|
|
|
243
332
|
"font-size": "12px",
|
|
244
333
|
color: n.iconColor || "#409EFF",
|
|
245
334
|
"user-select": "none"
|
|
246
|
-
},
|
|
335
|
+
}, i = {
|
|
247
336
|
"padding-right": "10px",
|
|
248
337
|
display: "-webkit-box",
|
|
249
338
|
"-webkit-box-orient": "vertical",
|
|
@@ -251,330 +340,146 @@ const we = /* @__PURE__ */ O({
|
|
|
251
340
|
overflow: "hidden",
|
|
252
341
|
...n.textStyles
|
|
253
342
|
};
|
|
254
|
-
return
|
|
343
|
+
return m(
|
|
255
344
|
"div",
|
|
256
345
|
{
|
|
257
346
|
class: "st_copy_wrapper",
|
|
258
347
|
style: "width: 100%; position: relative; display: inline-block;"
|
|
259
348
|
},
|
|
260
349
|
[
|
|
261
|
-
|
|
350
|
+
m("span", {
|
|
262
351
|
class: `st_copy_text ${n.textClass ?? ""}`,
|
|
263
|
-
style:
|
|
352
|
+
style: i,
|
|
264
353
|
title: e
|
|
265
354
|
}, e),
|
|
266
|
-
e &&
|
|
355
|
+
e && m("span", {
|
|
267
356
|
class: "st_copy_btn",
|
|
268
|
-
style:
|
|
357
|
+
style: l,
|
|
269
358
|
title: n.copyTitle || "复制",
|
|
270
359
|
onClick: () => {
|
|
271
360
|
if (e)
|
|
272
361
|
try {
|
|
273
362
|
if (navigator.clipboard && navigator.clipboard.writeText)
|
|
274
363
|
navigator.clipboard.writeText(e).then(() => {
|
|
275
|
-
|
|
364
|
+
K.success(n.successText ?? "复制成功");
|
|
276
365
|
}).catch(() => {
|
|
277
|
-
|
|
366
|
+
K.error(n.errorText ?? "复制失败");
|
|
278
367
|
});
|
|
279
368
|
else {
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
document.body.removeChild(
|
|
369
|
+
const r = document.createElement("textarea");
|
|
370
|
+
r.value = e, r.style.position = "fixed", r.style.opacity = "0", document.body.appendChild(r), r.select();
|
|
371
|
+
const s = document.execCommand("copy");
|
|
372
|
+
document.body.removeChild(r), s ? K.success(n.successText ?? "复制成功") : K.error(n.errorText ?? "复制失败");
|
|
284
373
|
}
|
|
285
374
|
} catch {
|
|
286
|
-
|
|
375
|
+
K.error(n.errorText ?? "复制失败");
|
|
287
376
|
}
|
|
288
377
|
}
|
|
289
|
-
}, [
|
|
378
|
+
}, [m(_e, {
|
|
290
379
|
style: "width: 1em; height: 1em;"
|
|
291
380
|
})])
|
|
292
381
|
].filter(Boolean)
|
|
293
382
|
);
|
|
294
|
-
}),
|
|
295
|
-
var
|
|
296
|
-
const e = v(t.row, t.col.key) ?? "", n = ((
|
|
297
|
-
if (
|
|
383
|
+
}), Ke = B((t) => {
|
|
384
|
+
var s;
|
|
385
|
+
const e = v(t.row, t.col.key) ?? "", n = ((s = t.col) == null ? void 0 : s.renderProps) || {}, i = e ? Array.isArray(e) ? e.filter((d) => d && typeof d == "string") : [e] : [];
|
|
386
|
+
if (i.length === 0)
|
|
298
387
|
return n.placeholder || "";
|
|
299
|
-
const
|
|
388
|
+
const r = {
|
|
300
389
|
width: n.width || "80px",
|
|
301
390
|
height: n.height || "80px",
|
|
302
|
-
marginRight:
|
|
391
|
+
marginRight: i.length > 1 ? "4px" : "0",
|
|
303
392
|
...n.style || {}
|
|
304
393
|
};
|
|
305
|
-
return
|
|
306
|
-
src:
|
|
307
|
-
previewSrcList: n.previewSrcList ||
|
|
394
|
+
return i.length === 1 ? m(q, {
|
|
395
|
+
src: i[0],
|
|
396
|
+
previewSrcList: n.previewSrcList || i,
|
|
397
|
+
previewTeleported: !0,
|
|
308
398
|
fit: n.fit || "contain",
|
|
309
|
-
style:
|
|
399
|
+
style: r,
|
|
310
400
|
...n
|
|
311
|
-
}) :
|
|
401
|
+
}) : m(
|
|
312
402
|
"div",
|
|
313
403
|
{
|
|
314
404
|
class: "st_img_wrapper",
|
|
315
405
|
style: "display: flex; align-items: center; position: relative"
|
|
316
406
|
},
|
|
317
407
|
[
|
|
318
|
-
|
|
319
|
-
src:
|
|
320
|
-
previewSrcList: n.previewSrcList ||
|
|
408
|
+
m(q, {
|
|
409
|
+
src: i[0],
|
|
410
|
+
previewSrcList: n.previewSrcList || i,
|
|
411
|
+
previewTeleported: !0,
|
|
321
412
|
fit: n.fit || "contain",
|
|
322
|
-
style:
|
|
413
|
+
style: r,
|
|
323
414
|
...n
|
|
324
415
|
}),
|
|
325
|
-
|
|
416
|
+
i.length > 1 && m("span", {
|
|
326
417
|
class: "st_img_total",
|
|
327
418
|
style: "position: absolute; top: 0; right: 0; ",
|
|
328
|
-
title: `${
|
|
329
|
-
}, [
|
|
419
|
+
title: `${i.length}`
|
|
420
|
+
}, [m(ke, { style: "width: 1em; height: 1em; " })])
|
|
330
421
|
]
|
|
331
422
|
);
|
|
332
|
-
}),
|
|
333
|
-
const e = v(t.row, t.col.key) ?? "", n = t.col.renderProps || {},
|
|
423
|
+
}), Le = B((t) => {
|
|
424
|
+
const e = v(t.row, t.col.key) ?? "", n = t.col.renderProps || {}, l = n.options ?? [], i = n.showValue ?? !1;
|
|
334
425
|
if (e == null || e === "") return "";
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
{ key:
|
|
338
|
-
{ default: () =>
|
|
426
|
+
const r = Array.isArray(e) ? e.map(String) : [String(e)], s = l.filter((h) => r.includes(String(h.value))), d = r.filter((h) => !l.some((k) => String(k.value) === h)), f = s.map((h, k) => m(
|
|
427
|
+
Ce,
|
|
428
|
+
{ key: h.value, type: h.listClass, class: h.cssClass, disableTransitions: !0 },
|
|
429
|
+
{ default: () => h.label + " " }
|
|
339
430
|
));
|
|
340
|
-
return
|
|
341
|
-
}),
|
|
342
|
-
var
|
|
343
|
-
const e = v(t.row, t.col.key) ?? "", n = ((
|
|
431
|
+
return i && d.length > 0 && f.push(m("span", {}, d.join(" "))), m("div", {}, f);
|
|
432
|
+
}), Ie = B((t) => {
|
|
433
|
+
var l;
|
|
434
|
+
const e = v(t.row, t.col.key) ?? "", n = ((l = t.col.renderProps) == null ? void 0 : l.options) ?? {};
|
|
344
435
|
return e != null ? n[e] ?? "" : "";
|
|
345
436
|
});
|
|
346
|
-
function
|
|
437
|
+
function Ne(t) {
|
|
347
438
|
return typeof t.formatter == "function";
|
|
348
439
|
}
|
|
349
|
-
const
|
|
350
|
-
var
|
|
351
|
-
const { col: e, row: n } = t,
|
|
352
|
-
return
|
|
353
|
-
}),
|
|
440
|
+
const We = B((t) => {
|
|
441
|
+
var r;
|
|
442
|
+
const { col: e, row: n, index: l } = t, i = v(t.row, t.col.key) ?? "";
|
|
443
|
+
return Ne(e) ? (r = e.formatter) == null ? void 0 : r.call(e, i, n, l) : i ?? "";
|
|
444
|
+
}), Pe = B((t) => {
|
|
354
445
|
const e = v(t.row, t.col.key) ?? "", n = t.col.renderProps || {};
|
|
355
|
-
return e ? /^https?:\/\//.test(e) ?
|
|
446
|
+
return e ? /^https?:\/\//.test(e) ? m(q, {
|
|
356
447
|
src: e,
|
|
357
448
|
previewSrcList: [e],
|
|
449
|
+
previewTeleported: !0,
|
|
358
450
|
fit: "contain",
|
|
359
451
|
style: "width:40px;height:40px",
|
|
360
452
|
...n
|
|
361
|
-
}) : /^\s*<svg[\s\S]*<\/svg>\s*$/.test(e) ?
|
|
453
|
+
}) : /^\s*<svg[\s\S]*<\/svg>\s*$/.test(e) ? m("div", {
|
|
362
454
|
innerHTML: e,
|
|
363
455
|
style: `width:40px;height:40px;display:inline-block;${n.style || ""}`,
|
|
364
456
|
...n
|
|
365
|
-
}) :
|
|
457
|
+
}) : m("i", {
|
|
366
458
|
class: e,
|
|
367
459
|
style: `font-size:20px;${n.style || ""}`,
|
|
368
460
|
...n
|
|
369
461
|
}) : "";
|
|
370
|
-
}),
|
|
371
|
-
input:
|
|
372
|
-
"input-number":
|
|
373
|
-
select:
|
|
374
|
-
button:
|
|
375
|
-
link:
|
|
376
|
-
html:
|
|
377
|
-
copy:
|
|
378
|
-
img:
|
|
379
|
-
dict:
|
|
380
|
-
map:
|
|
381
|
-
formatter:
|
|
382
|
-
icon:
|
|
462
|
+
}), re = {
|
|
463
|
+
input: Ae,
|
|
464
|
+
"input-number": Me,
|
|
465
|
+
select: Oe,
|
|
466
|
+
button: $e,
|
|
467
|
+
link: Fe,
|
|
468
|
+
html: Re,
|
|
469
|
+
copy: ze,
|
|
470
|
+
img: Ke,
|
|
471
|
+
dict: Le,
|
|
472
|
+
map: Ie,
|
|
473
|
+
formatter: We,
|
|
474
|
+
icon: Pe
|
|
383
475
|
};
|
|
384
|
-
function
|
|
385
|
-
t.registerMultiple(
|
|
386
|
-
}
|
|
387
|
-
function Ye() {
|
|
388
|
-
return le;
|
|
389
|
-
}
|
|
390
|
-
function Ne(t, e = 10, n = []) {
|
|
391
|
-
const o = "*:*:*", l = (s) => {
|
|
392
|
-
if (!s) return !0;
|
|
393
|
-
const y = Array.isArray(s) ? s : [s];
|
|
394
|
-
return n.some(
|
|
395
|
-
(p) => p === o || y.includes(p)
|
|
396
|
-
);
|
|
397
|
-
}, i = F(() => t.some((s) => l(s.permission))), c = F(() => t.filter((y) => l(y.permission)).slice(0, e).reduce(
|
|
398
|
-
(y, p) => y + (p.width ?? 60),
|
|
399
|
-
0
|
|
400
|
-
)), d = (s, y) => l(s.permission) && (s.visible ? s.visible(y) : !0), g = (s) => t.filter((p) => d(p, s)).slice(0, e).reduce(
|
|
401
|
-
(p, E) => p + (E.width ?? 60),
|
|
402
|
-
0
|
|
403
|
-
);
|
|
404
|
-
return {
|
|
405
|
-
hasAnyButton: i,
|
|
406
|
-
optWidth: c,
|
|
407
|
-
hasAnyVisibleButton: (s) => s != null && s.length ? s.some(
|
|
408
|
-
(y) => t.some((p) => d(p, y))
|
|
409
|
-
) : !1,
|
|
410
|
-
getMaxOptWidth: (s) => s != null && s.length ? s.reduce(
|
|
411
|
-
(y, p) => Math.max(y, g(p)),
|
|
412
|
-
0
|
|
413
|
-
) : c.value,
|
|
414
|
-
getVisibleButtons: (s) => t.filter((y) => d(y, s)).slice(0, e)
|
|
415
|
-
};
|
|
476
|
+
function De(t) {
|
|
477
|
+
t.registerMultiple(re);
|
|
416
478
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
props: {
|
|
420
|
-
col: { type: Object, required: !0 },
|
|
421
|
-
permissions: { type: Array, default: () => [] },
|
|
422
|
-
pagination: { type: Object, default: () => ({}) }
|
|
423
|
-
},
|
|
424
|
-
emits: ["cellBlur", "cellEnter", "cellChange", "cellClick"],
|
|
425
|
-
setup(t, { emit: e }) {
|
|
426
|
-
const n = t, r = e, o = (u) => {
|
|
427
|
-
var T, w;
|
|
428
|
-
const C = (T = n.pagination) == null ? void 0 : T.page, x = (w = n.pagination) == null ? void 0 : w.size;
|
|
429
|
-
return C && x ? (C - 1) * x + u + 1 : u + 1;
|
|
430
|
-
}, { col: l } = ae(n), i = (u, C) => r("cellChange", u, C), c = (u, C) => r("cellBlur", u, C), d = (u, C) => r("cellEnter", u, C), g = (u, C) => r("cellClick", u, C);
|
|
431
|
-
Le(J());
|
|
432
|
-
const b = F(() => {
|
|
433
|
-
const u = J(), C = {};
|
|
434
|
-
return u.names().forEach((x) => {
|
|
435
|
-
const T = u.get(x);
|
|
436
|
-
T && (C[x] = T);
|
|
437
|
-
}), C;
|
|
438
|
-
}), {
|
|
439
|
-
hasAnyButton: m,
|
|
440
|
-
hasAnyVisibleButton: k,
|
|
441
|
-
optWidth: s,
|
|
442
|
-
getMaxOptWidth: y,
|
|
443
|
-
getVisibleButtons: p
|
|
444
|
-
} = Ne(
|
|
445
|
-
l.value.buttons || [],
|
|
446
|
-
l.value.maxbtn ?? 10,
|
|
447
|
-
n.permissions || []
|
|
448
|
-
), E = F(() => (l.value.buttons || []).length ? (l.value.__rows || []).length ? k(l.value.__rows || []) : m.value : !1), N = F(() => l.value.__rows ? y(l.value.__rows) : s.value);
|
|
449
|
-
function oe(u) {
|
|
450
|
-
return !(u.type === "selection" || u.type === "index" || u.type === "operation" && !E.value || u.visible === !1);
|
|
451
|
-
}
|
|
452
|
-
return (u, C) => {
|
|
453
|
-
const x = M("el-table-column"), T = M("el-button");
|
|
454
|
-
return a(l).type === "selection" ? (h(), _(x, B({
|
|
455
|
-
key: 0,
|
|
456
|
-
type: "selection"
|
|
457
|
-
}, a(l).columnProps), null, 16)) : a(l).type === "index" ? (h(), _(x, B({
|
|
458
|
-
key: 1,
|
|
459
|
-
type: "index",
|
|
460
|
-
label: a(l).label || "#",
|
|
461
|
-
align: "center"
|
|
462
|
-
}, a(l).columnProps), {
|
|
463
|
-
default: A(({ $index: w }) => [
|
|
464
|
-
Z(W(o(w)), 1)
|
|
465
|
-
]),
|
|
466
|
-
_: 1
|
|
467
|
-
}, 16, ["label"])) : a(l).type === "operation" && E.value ? (h(), _(x, B({
|
|
468
|
-
key: 2,
|
|
469
|
-
label: a(l).label || "操作",
|
|
470
|
-
align: "center"
|
|
471
|
-
}, {
|
|
472
|
-
...a(l).columnProps,
|
|
473
|
-
width: N.value
|
|
474
|
-
}), {
|
|
475
|
-
default: A(({ row: w }) => [
|
|
476
|
-
(h(!0), K(H, null, L(a(p)(w), (V) => (h(), _(T, {
|
|
477
|
-
key: V.label,
|
|
478
|
-
type: V.type || "primary",
|
|
479
|
-
link: "",
|
|
480
|
-
onClick: (D) => V.action(w)
|
|
481
|
-
}, {
|
|
482
|
-
default: A(() => [
|
|
483
|
-
Z(W(V.label), 1)
|
|
484
|
-
]),
|
|
485
|
-
_: 2
|
|
486
|
-
}, 1032, ["type", "onClick"]))), 128))
|
|
487
|
-
]),
|
|
488
|
-
_: 1
|
|
489
|
-
}, 16, ["label"])) : oe(a(l)) ? (h(), _(x, B({
|
|
490
|
-
key: 3,
|
|
491
|
-
label: a(l).label,
|
|
492
|
-
align: "center"
|
|
493
|
-
}, a(l).columnProps || {}), {
|
|
494
|
-
default: A((w) => {
|
|
495
|
-
var V, D, Q, X;
|
|
496
|
-
return [
|
|
497
|
-
a(l).render === "slot" && u.$slots[((V = a(l)) == null ? void 0 : V.slot) || a(l).key] ? ne(u.$slots, ((D = a(l)) == null ? void 0 : D.slot) || a(l).key, ue(B({ key: 0 }, w))) : a(l).render && b.value[a(l).render] ? (h(), _(de(b.value[a(l).render]), {
|
|
498
|
-
key: 1,
|
|
499
|
-
row: w.row,
|
|
500
|
-
col: a(l),
|
|
501
|
-
onCellChange: i,
|
|
502
|
-
onCellBlur: c,
|
|
503
|
-
onCellEnter: d,
|
|
504
|
-
onClick: g
|
|
505
|
-
}, null, 40, ["row", "col"])) : (h(), K("span", {
|
|
506
|
-
key: 2,
|
|
507
|
-
style: fe(((Q = a(l).renderProps) == null ? void 0 : Q.style) || ""),
|
|
508
|
-
class: me(((X = a(l).renderProps) == null ? void 0 : X.class) || ""),
|
|
509
|
-
title: a(v)(w.row, a(l).key)
|
|
510
|
-
}, W(a(v)(w.row, a(l).key)), 15, De))
|
|
511
|
-
];
|
|
512
|
-
}),
|
|
513
|
-
_: 3
|
|
514
|
-
}, 16, ["label"])) : ce("", !0);
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
});
|
|
518
|
-
function ee(t, e) {
|
|
519
|
-
if (!(e != null && e.length)) return t;
|
|
520
|
-
const n = new Map(
|
|
521
|
-
e.map((r) => [r.key, r])
|
|
522
|
-
);
|
|
523
|
-
return t.map((r) => {
|
|
524
|
-
const o = n.get(r.key);
|
|
525
|
-
return o ? {
|
|
526
|
-
...r,
|
|
527
|
-
visible: typeof o.visible == "boolean" ? o.visible : r.visible
|
|
528
|
-
} : r;
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
function We(t, e) {
|
|
532
|
-
const { cacheKey: n, storage: r = localStorage } = e || {}, o = n ? r.getItem(n) : null, l = R(
|
|
533
|
-
ee(
|
|
534
|
-
t,
|
|
535
|
-
o ? JSON.parse(o) : []
|
|
536
|
-
)
|
|
537
|
-
);
|
|
538
|
-
return z(
|
|
539
|
-
l,
|
|
540
|
-
(i) => {
|
|
541
|
-
if (!n) return;
|
|
542
|
-
const c = i.map((d) => ({
|
|
543
|
-
key: d.key,
|
|
544
|
-
visible: d.visible,
|
|
545
|
-
columnOpts: d.columnOpts
|
|
546
|
-
}));
|
|
547
|
-
r.setItem(
|
|
548
|
-
n,
|
|
549
|
-
JSON.stringify(c)
|
|
550
|
-
);
|
|
551
|
-
},
|
|
552
|
-
{ deep: !0 }
|
|
553
|
-
), {
|
|
554
|
-
/** 当前列配置(响应式) */
|
|
555
|
-
columns: l,
|
|
556
|
-
/**
|
|
557
|
-
* 主动设置列配置
|
|
558
|
-
* 常用于:列设置弹窗 / 拖拽排序完成
|
|
559
|
-
*/
|
|
560
|
-
setColumns(i) {
|
|
561
|
-
l.value = ee(
|
|
562
|
-
t,
|
|
563
|
-
i
|
|
564
|
-
), n && r.setItem(
|
|
565
|
-
n,
|
|
566
|
-
JSON.stringify(i)
|
|
567
|
-
);
|
|
568
|
-
},
|
|
569
|
-
/**
|
|
570
|
-
* 重置为默认列配置
|
|
571
|
-
*/
|
|
572
|
-
resetColumns() {
|
|
573
|
-
l.value = t, n && r.removeItem(n);
|
|
574
|
-
}
|
|
575
|
-
};
|
|
479
|
+
function Qe() {
|
|
480
|
+
return re;
|
|
576
481
|
}
|
|
577
|
-
const
|
|
482
|
+
const je = ["title"], Xe = /* @__PURE__ */ R({
|
|
578
483
|
__name: "index",
|
|
579
484
|
props: {
|
|
580
485
|
data: { type: Array, default: () => [] },
|
|
@@ -596,59 +501,166 @@ const Ge = /* @__PURE__ */ O({
|
|
|
596
501
|
"cell-click"
|
|
597
502
|
],
|
|
598
503
|
setup(t, { expose: e, emit: n }) {
|
|
599
|
-
const
|
|
600
|
-
cacheKey:
|
|
504
|
+
const l = t, i = n, { columns: r } = xe(l.columns, {
|
|
505
|
+
cacheKey: l.cacheKey ?? ""
|
|
601
506
|
});
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
(
|
|
507
|
+
F(
|
|
508
|
+
r,
|
|
509
|
+
(o) => i("update:columns", o),
|
|
510
|
+
{ deep: !0, immediate: !0 }
|
|
511
|
+
), F(
|
|
512
|
+
() => l.data,
|
|
513
|
+
(o) => {
|
|
514
|
+
o && r.value.forEach((a) => {
|
|
515
|
+
a.type === "operation" && (a.__rows = o);
|
|
516
|
+
});
|
|
517
|
+
},
|
|
605
518
|
{ deep: !0, immediate: !0 }
|
|
606
519
|
);
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
520
|
+
const s = S(
|
|
521
|
+
() => r.value.filter((o) => o.type === "selection")
|
|
522
|
+
), d = S(
|
|
523
|
+
() => r.value.filter((o) => o.type === "index")
|
|
524
|
+
), f = S(
|
|
525
|
+
() => r.value.filter((o) => o.type === "operation")
|
|
526
|
+
), h = S(
|
|
527
|
+
() => r.value.filter((o) => !(o.type === "selection" || o.type === "index" || o.type === "operation" || o.visible === !1))
|
|
528
|
+
), k = (o) => {
|
|
529
|
+
var _, z;
|
|
530
|
+
const a = (_ = l.pagination) == null ? void 0 : _.page, p = (z = l.pagination) == null ? void 0 : z.size;
|
|
531
|
+
return a && p ? (a - 1) * p + o + 1 : o + 1;
|
|
532
|
+
};
|
|
533
|
+
De(H());
|
|
534
|
+
const E = S(() => {
|
|
535
|
+
const o = H(), a = {};
|
|
536
|
+
return o.names().forEach((p) => {
|
|
537
|
+
const _ = o.get(p);
|
|
538
|
+
_ && (a[p] = _);
|
|
539
|
+
}), a;
|
|
540
|
+
}), G = S(() => {
|
|
541
|
+
const o = /* @__PURE__ */ new Map();
|
|
542
|
+
return f.value.forEach((a) => {
|
|
543
|
+
const p = Be(
|
|
544
|
+
a.buttons || [],
|
|
545
|
+
a.maxbtn ?? 10,
|
|
546
|
+
l.permissions || []
|
|
547
|
+
);
|
|
548
|
+
o.set(a.key, p);
|
|
549
|
+
}), o;
|
|
550
|
+
}), c = (o) => G.value.get(o.key), g = (o) => {
|
|
551
|
+
const a = c(o);
|
|
552
|
+
return a ? o.__rows ? a.getMaxOptWidth(o.__rows) : a.optWidth.value : 0;
|
|
553
|
+
}, b = (o, a) => {
|
|
554
|
+
const p = c(o);
|
|
555
|
+
return p ? (o.buttons || []).length ? ((o.__rows || []).length, p.getVisibleButtons(a)) : [] : [];
|
|
556
|
+
}, I = () => f.value.filter((o) => {
|
|
557
|
+
const a = c(o);
|
|
558
|
+
return !a || !(o.buttons || []).length ? !1 : (o.__rows || []).length ? a.hasAnyVisibleButton(o.__rows || []) : a.hasAnyButton.value;
|
|
559
|
+
}), oe = (o, a) => {
|
|
560
|
+
i("cellChange", o, a);
|
|
561
|
+
}, ie = (o, a) => {
|
|
562
|
+
i("cellBlur", o, a);
|
|
563
|
+
}, se = (o, a) => {
|
|
564
|
+
i("cellEnter", o, a);
|
|
565
|
+
}, ae = (o, a) => {
|
|
566
|
+
a && i("cell-click", o, a);
|
|
567
|
+
}, Q = L();
|
|
614
568
|
return e({
|
|
615
|
-
tableRef:
|
|
616
|
-
}), (
|
|
617
|
-
const
|
|
618
|
-
return
|
|
569
|
+
tableRef: Q
|
|
570
|
+
}), (o, a) => {
|
|
571
|
+
const p = O("el-table-column"), _ = O("el-button"), z = O("el-table"), ue = fe("loading");
|
|
572
|
+
return me((y(), w(z, x({
|
|
619
573
|
ref_key: "tableRef",
|
|
620
|
-
ref:
|
|
621
|
-
},
|
|
574
|
+
ref: Q
|
|
575
|
+
}, o.$attrs, {
|
|
622
576
|
data: t.data,
|
|
623
577
|
"row-key": t.rowKey,
|
|
624
578
|
class: "smart_table"
|
|
625
|
-
}), {
|
|
626
|
-
default:
|
|
627
|
-
(
|
|
628
|
-
key:
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
},
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
579
|
+
}), ye({
|
|
580
|
+
default: V(() => [
|
|
581
|
+
(y(!0), A($, null, M(s.value, (u) => (y(), w(p, x({
|
|
582
|
+
key: "selection",
|
|
583
|
+
type: "selection"
|
|
584
|
+
}, { ref_for: !0 }, u.columnProps), null, 16))), 128)),
|
|
585
|
+
(y(!0), A($, null, M(d.value, (u) => (y(), w(p, x({
|
|
586
|
+
key: "index",
|
|
587
|
+
type: "index",
|
|
588
|
+
label: u.label || "#",
|
|
589
|
+
align: "center"
|
|
590
|
+
}, { ref_for: !0 }, u.columnProps), {
|
|
591
|
+
default: V(({ $index: C }) => [
|
|
592
|
+
X(P(k(C)), 1)
|
|
593
|
+
]),
|
|
594
|
+
_: 1
|
|
595
|
+
}, 16, ["label"]))), 128)),
|
|
596
|
+
(y(!0), A($, null, M(I(), (u) => (y(), w(p, x({
|
|
597
|
+
key: u.key,
|
|
598
|
+
label: u.label || "操作",
|
|
599
|
+
align: "center"
|
|
600
|
+
}, { ref_for: !0 }, {
|
|
601
|
+
...u.columnProps,
|
|
602
|
+
width: g(u)
|
|
603
|
+
}), {
|
|
604
|
+
default: V(({ row: C }) => [
|
|
605
|
+
(y(!0), A($, null, M(b(u, C), (T) => (y(), w(_, {
|
|
606
|
+
key: T.label,
|
|
607
|
+
type: T.type || "primary",
|
|
608
|
+
link: "",
|
|
609
|
+
onClick: (N) => T.action(C)
|
|
610
|
+
}, {
|
|
611
|
+
default: V(() => [
|
|
612
|
+
X(P(T.label), 1)
|
|
613
|
+
]),
|
|
614
|
+
_: 2
|
|
615
|
+
}, 1032, ["type", "onClick"]))), 128))
|
|
616
|
+
]),
|
|
617
|
+
_: 2
|
|
618
|
+
}, 1040, ["label"]))), 128)),
|
|
619
|
+
(y(!0), A($, null, M(h.value, (u) => (y(), w(p, x({
|
|
620
|
+
key: u.key,
|
|
621
|
+
label: u.label,
|
|
622
|
+
align: "center"
|
|
623
|
+
}, { ref_for: !0 }, u.columnProps || {}), {
|
|
624
|
+
default: V((C) => {
|
|
625
|
+
var T, N;
|
|
626
|
+
return [
|
|
627
|
+
u.render === "slot" ? Z(o.$slots, (u == null ? void 0 : u.slot) || u.key, x({
|
|
628
|
+
key: 0,
|
|
629
|
+
ref_for: !0
|
|
630
|
+
}, C)) : u.render && E.value[u.render] ? (y(), w(pe(E.value[u.render]), {
|
|
631
|
+
key: 1,
|
|
632
|
+
row: C.row,
|
|
633
|
+
col: u,
|
|
634
|
+
index: C.$index,
|
|
635
|
+
onCellChange: oe,
|
|
636
|
+
onCellBlur: ie,
|
|
637
|
+
onCellEnter: se,
|
|
638
|
+
onClick: ae
|
|
639
|
+
}, null, 40, ["row", "col", "index"])) : (y(), A("span", {
|
|
640
|
+
key: 2,
|
|
641
|
+
style: he(((T = u.renderProps) == null ? void 0 : T.style) || ""),
|
|
642
|
+
class: ge(((N = u.renderProps) == null ? void 0 : N.class) || ""),
|
|
643
|
+
title: ee(v)(C.row, u.key)
|
|
644
|
+
}, P(ee(v)(C.row, u.key)), 15, je))
|
|
645
|
+
];
|
|
646
|
+
}),
|
|
647
|
+
_: 2
|
|
648
|
+
}, 1040, ["label"]))), 128))
|
|
644
649
|
]),
|
|
645
|
-
_:
|
|
646
|
-
},
|
|
647
|
-
|
|
650
|
+
_: 2
|
|
651
|
+
}, [
|
|
652
|
+
M(h.value, (u) => ({
|
|
653
|
+
name: u.key,
|
|
654
|
+
fn: V((C) => [
|
|
655
|
+
Z(o.$slots, u.key, be(ve(C)))
|
|
656
|
+
])
|
|
657
|
+
}))
|
|
658
|
+
]), 1040, ["data", "row-key"])), [
|
|
659
|
+
[ue, t.loading]
|
|
648
660
|
]);
|
|
649
661
|
};
|
|
650
662
|
}
|
|
651
|
-
}),
|
|
663
|
+
}), ne = {
|
|
652
664
|
defaultPagination: {
|
|
653
665
|
page: 1,
|
|
654
666
|
size: 10,
|
|
@@ -657,9 +669,9 @@ const Ge = /* @__PURE__ */ O({
|
|
|
657
669
|
defaultTableProps: {},
|
|
658
670
|
defaultColumnProps: {}
|
|
659
671
|
};
|
|
660
|
-
class
|
|
672
|
+
class qe {
|
|
661
673
|
constructor() {
|
|
662
|
-
|
|
674
|
+
W(this, "config", { ...ne });
|
|
663
675
|
}
|
|
664
676
|
/**
|
|
665
677
|
* 获取所有配置
|
|
@@ -671,7 +683,7 @@ class Pe {
|
|
|
671
683
|
* 设置配置
|
|
672
684
|
*/
|
|
673
685
|
setConfig(e) {
|
|
674
|
-
this.config = this.mergeConfig(this.config, e), e.renderers &&
|
|
686
|
+
this.config = this.mergeConfig(this.config, e), e.renderers && H().registerMultiple(e.renderers);
|
|
675
687
|
}
|
|
676
688
|
/**
|
|
677
689
|
* 获取特定配置项
|
|
@@ -683,46 +695,46 @@ class Pe {
|
|
|
683
695
|
* 重置为默认配置
|
|
684
696
|
*/
|
|
685
697
|
reset() {
|
|
686
|
-
this.config = { ...
|
|
698
|
+
this.config = { ...ne };
|
|
687
699
|
}
|
|
688
700
|
/**
|
|
689
701
|
* 深度合并配置
|
|
690
702
|
*/
|
|
691
703
|
mergeConfig(e, n) {
|
|
692
|
-
const
|
|
693
|
-
for (const
|
|
694
|
-
n[
|
|
695
|
-
return
|
|
704
|
+
const l = { ...e };
|
|
705
|
+
for (const i in n)
|
|
706
|
+
n[i] && typeof n[i] == "object" && !Array.isArray(n[i]) ? l[i] = this.mergeConfig(e[i] || {}, n[i]) : l[i] = n[i];
|
|
707
|
+
return l;
|
|
696
708
|
}
|
|
697
709
|
}
|
|
698
710
|
let j = null;
|
|
699
|
-
function
|
|
700
|
-
return j || (j = new
|
|
711
|
+
function le() {
|
|
712
|
+
return j || (j = new qe()), j;
|
|
701
713
|
}
|
|
702
|
-
function
|
|
703
|
-
|
|
714
|
+
function Ze(t) {
|
|
715
|
+
le().setConfig(t);
|
|
704
716
|
}
|
|
705
|
-
function
|
|
706
|
-
return
|
|
717
|
+
function et() {
|
|
718
|
+
return le().getConfig();
|
|
707
719
|
}
|
|
708
|
-
function
|
|
720
|
+
function tt(t, e) {
|
|
709
721
|
return {
|
|
710
722
|
key: t,
|
|
711
723
|
...e
|
|
712
724
|
};
|
|
713
725
|
}
|
|
714
726
|
export {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
+
Xe as SmartTable,
|
|
728
|
+
re as builtInRenderers,
|
|
729
|
+
B as createFunctionalRenderer,
|
|
730
|
+
Qe as createRenderer,
|
|
731
|
+
Xe as default,
|
|
732
|
+
tt as defineColumn,
|
|
733
|
+
H as getRendererManager,
|
|
734
|
+
et as getSmartTableConfig,
|
|
735
|
+
De as registerBuiltInRenderers,
|
|
736
|
+
Ze as setSmartTableConfig,
|
|
737
|
+
Ge as validateRendererProps,
|
|
738
|
+
U as wrapSFCComponent
|
|
727
739
|
};
|
|
728
740
|
//# sourceMappingURL=vue3-smart-table.es.js.map
|