vue3-smart-table 2.1.1 → 2.1.3
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/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 +146 -145
- 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/index.vue +1 -0
- package/src/components/SmartTable/renderers/index.ts +21 -16
- package/src/components/SmartTable/renderers/input.vue +73 -73
- package/src/components/SmartTable/renderers/inputNumber.vue +64 -64
- package/src/components/SmartTable/renderers/select.vue +87 -87
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var j = (t, e, r) =>
|
|
4
|
-
import { ref as O, watch as N, computed as E, defineComponent as
|
|
5
|
-
import { ElImage as U, ElTag as
|
|
6
|
-
import { CopyDocument as
|
|
7
|
-
function
|
|
1
|
+
var fe = Object.defineProperty;
|
|
2
|
+
var de = (t, e, r) => e in t ? fe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var j = (t, e, r) => de(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { ref as O, watch as N, computed as E, defineComponent as R, h as b, resolveComponent as T, createBlock as B, openBlock as w, mergeProps as S, withKeys as G, withCtx as $, createElementBlock as A, Fragment as I, renderList as J, resolveDirective as me, withDirectives as ye, createTextVNode as ne, toDisplayString as P, renderSlot as ge, createCommentVNode as he, resolveDynamicComponent as Ce, unref as oe, normalizeClass as be, normalizeStyle as ve } from "vue";
|
|
5
|
+
import { ElImage as U, ElTag as we, ElMessage as z, ElButton as ke } from "element-plus";
|
|
6
|
+
import { CopyDocument as _e, DocumentCopy as xe } from "@element-plus/icons-vue";
|
|
7
|
+
function ie(t) {
|
|
8
8
|
return t === "selection" || t === "index" || t === "operation";
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return t ? !
|
|
10
|
+
function Ze(t) {
|
|
11
|
+
return t ? !ie(t) : !1;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function Be(t) {
|
|
14
14
|
return t.type === "operation";
|
|
15
15
|
}
|
|
16
16
|
function re(t, e) {
|
|
@@ -26,7 +26,7 @@ function re(t, e) {
|
|
|
26
26
|
} : l;
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Ee(t, e) {
|
|
30
30
|
const { cacheKey: r, storage: l = localStorage } = e || {}, a = r ? l.getItem(r) : null, p = O(
|
|
31
31
|
re(
|
|
32
32
|
t,
|
|
@@ -37,14 +37,14 @@ function Be(t, e) {
|
|
|
37
37
|
p,
|
|
38
38
|
(u) => {
|
|
39
39
|
if (!r) return;
|
|
40
|
-
const
|
|
40
|
+
const g = u.map((d) => ({
|
|
41
41
|
key: d.key,
|
|
42
42
|
visible: d.visible,
|
|
43
43
|
columnOpts: d.columnOpts
|
|
44
44
|
}));
|
|
45
45
|
l.setItem(
|
|
46
46
|
r,
|
|
47
|
-
JSON.stringify(
|
|
47
|
+
JSON.stringify(g)
|
|
48
48
|
);
|
|
49
49
|
},
|
|
50
50
|
{ deep: !0 }
|
|
@@ -72,34 +72,34 @@ function Be(t, e) {
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function Se(t, e = 10, r = []) {
|
|
76
76
|
const a = "*:*:*", p = (o) => {
|
|
77
77
|
if (!o) return !0;
|
|
78
78
|
const f = Array.isArray(o) ? o : [o];
|
|
79
79
|
return r.some(
|
|
80
80
|
(h) => h === a || f.includes(h)
|
|
81
81
|
);
|
|
82
|
-
}, u = E(() => t.some((o) => p(o.permission))),
|
|
82
|
+
}, u = E(() => t.some((o) => p(o.permission))), g = E(() => t.filter((f) => p(f.permission)).slice(0, e).reduce(
|
|
83
83
|
(f, h) => f + (h.width ?? 55),
|
|
84
84
|
0
|
|
85
|
-
)), d = (o, f) => p(o.permission) && (o.visible ? o.visible(f) : !0),
|
|
85
|
+
)), d = (o, f) => p(o.permission) && (o.visible ? o.visible(f) : !0), y = (o) => t.filter((h) => d(h, o)).slice(0, e).reduce(
|
|
86
86
|
(h, M) => h + (M.width ?? 55),
|
|
87
87
|
0
|
|
88
88
|
);
|
|
89
89
|
return {
|
|
90
90
|
hasAnyButton: u,
|
|
91
|
-
optWidth:
|
|
91
|
+
optWidth: g,
|
|
92
92
|
hasAnyVisibleButton: (o) => o != null && o.length ? o.some(
|
|
93
93
|
(f) => t.some((h) => d(h, f))
|
|
94
94
|
) : !1,
|
|
95
95
|
getMaxOptWidth: (o) => o != null && o.length ? o.reduce(
|
|
96
|
-
(f, h) => Math.max(f,
|
|
96
|
+
(f, h) => Math.max(f, y(h)),
|
|
97
97
|
0
|
|
98
|
-
) :
|
|
98
|
+
) : g.value,
|
|
99
99
|
getVisibleButtons: (o) => t.filter((f) => d(f, o)).slice(0, e)
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
class
|
|
102
|
+
class Ve {
|
|
103
103
|
constructor() {
|
|
104
104
|
j(this, "renderers", /* @__PURE__ */ new Map());
|
|
105
105
|
}
|
|
@@ -129,10 +129,10 @@ class Se {
|
|
|
129
129
|
}
|
|
130
130
|
let q = null;
|
|
131
131
|
function Y() {
|
|
132
|
-
return q || (q = new
|
|
132
|
+
return q || (q = new Ve()), q;
|
|
133
133
|
}
|
|
134
134
|
function Q(t) {
|
|
135
|
-
return
|
|
135
|
+
return R({
|
|
136
136
|
props: ["row", "col", "index", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
137
137
|
setup(e) {
|
|
138
138
|
return () => b(t, e);
|
|
@@ -140,14 +140,14 @@ function Q(t) {
|
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
function V(t) {
|
|
143
|
-
return
|
|
143
|
+
return R({
|
|
144
144
|
props: ["row", "col", "index", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
|
|
145
145
|
setup(e) {
|
|
146
146
|
return () => t(e);
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function et(t, e) {
|
|
151
151
|
if (process.env.NODE_ENV !== "production" && e)
|
|
152
152
|
switch (t) {
|
|
153
153
|
case "dict":
|
|
@@ -187,10 +187,10 @@ function k(t, e) {
|
|
|
187
187
|
}
|
|
188
188
|
function X(t, e, r) {
|
|
189
189
|
if (!t || !e) return;
|
|
190
|
-
const l = e.split("."), a = l.pop(), p = l.reduce((u,
|
|
190
|
+
const l = e.split("."), a = l.pop(), p = l.reduce((u, g) => (u[g] || (u[g] = {}), u[g]), t);
|
|
191
191
|
p[a] = r;
|
|
192
192
|
}
|
|
193
|
-
const
|
|
193
|
+
const Fe = /* @__PURE__ */ R({
|
|
194
194
|
__name: "input",
|
|
195
195
|
props: {
|
|
196
196
|
row: {},
|
|
@@ -222,13 +222,13 @@ const Ve = /* @__PURE__ */ z({
|
|
|
222
222
|
}, u = (i) => {
|
|
223
223
|
var n, s;
|
|
224
224
|
(s = (n = e.col.props) == null ? void 0 : n.onFocus) == null || s.call(n, i, e.row, e.col);
|
|
225
|
-
},
|
|
225
|
+
}, g = (i) => {
|
|
226
226
|
var n, s;
|
|
227
227
|
(s = (n = e.col.props) == null ? void 0 : n.onInput) == null || s.call(n, i, e.row, e.col);
|
|
228
228
|
}, d = (i) => {
|
|
229
229
|
var n, s, o;
|
|
230
230
|
(n = e.onCellEnter) == null || n.call(e, e.row, e.col), (o = (s = e.col.props) == null ? void 0 : s.onEnter) == null || o.call(s, i, e.row, e.col);
|
|
231
|
-
},
|
|
231
|
+
}, y = () => {
|
|
232
232
|
var i, n;
|
|
233
233
|
(n = (i = e.col.props) == null ? void 0 : i.onClear) == null || n.call(i, e.row, e.col);
|
|
234
234
|
};
|
|
@@ -241,13 +241,13 @@ const Ve = /* @__PURE__ */ z({
|
|
|
241
241
|
onBlur: p,
|
|
242
242
|
onFocus: u,
|
|
243
243
|
onChange: a,
|
|
244
|
-
onInput:
|
|
244
|
+
onInput: g,
|
|
245
245
|
onKeyup: G(d, ["enter"]),
|
|
246
|
-
onClear:
|
|
246
|
+
onClear: y
|
|
247
247
|
}), null, 16, ["modelValue"]);
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
|
-
}),
|
|
250
|
+
}), Te = /* @__PURE__ */ R({
|
|
251
251
|
__name: "inputNumber",
|
|
252
252
|
props: {
|
|
253
253
|
row: {},
|
|
@@ -259,7 +259,7 @@ const Ve = /* @__PURE__ */ z({
|
|
|
259
259
|
},
|
|
260
260
|
setup(t) {
|
|
261
261
|
const e = t, r = O(k(e.row, e.col.key)), l = E(() => {
|
|
262
|
-
const d = e.col.props || {}, { onBlur:
|
|
262
|
+
const d = e.col.props || {}, { onBlur: y, onFocus: i, onChange: n, onEnter: s, ...o } = d;
|
|
263
263
|
return {
|
|
264
264
|
min: 0,
|
|
265
265
|
max: 99999,
|
|
@@ -271,33 +271,33 @@ const Ve = /* @__PURE__ */ z({
|
|
|
271
271
|
N(r, (d) => {
|
|
272
272
|
X(e.row, e.col.key, d);
|
|
273
273
|
});
|
|
274
|
-
const a = (d,
|
|
274
|
+
const a = (d, y) => {
|
|
275
275
|
var i, n, s;
|
|
276
|
-
(i = e.onCellChange) == null || i.call(e, e.row, e.col), (s = (n = e.col.props) == null ? void 0 : n.onChange) == null || s.call(n, d,
|
|
276
|
+
(i = e.onCellChange) == null || i.call(e, e.row, e.col), (s = (n = e.col.props) == null ? void 0 : n.onChange) == null || s.call(n, d, y, e.row, e.col);
|
|
277
277
|
}, p = (d) => {
|
|
278
|
-
var
|
|
279
|
-
(
|
|
278
|
+
var y, i, n;
|
|
279
|
+
(y = e.onCellBlur) == null || y.call(e, e.row, e.col), (n = (i = e.col.props) == null ? void 0 : i.onBlur) == null || n.call(i, d, e.row, e.col);
|
|
280
280
|
}, u = (d) => {
|
|
281
|
-
var
|
|
282
|
-
(i = (
|
|
283
|
-
},
|
|
284
|
-
var
|
|
285
|
-
(
|
|
281
|
+
var y, i;
|
|
282
|
+
(i = (y = e.col.props) == null ? void 0 : y.onFocus) == null || i.call(y, d, e.row, e.col);
|
|
283
|
+
}, g = (d) => {
|
|
284
|
+
var y, i, n;
|
|
285
|
+
(y = e.onCellEnter) == null || y.call(e, e.row, e.col), (n = (i = e.col.props) == null ? void 0 : i.onEnter) == null || n.call(i, d, e.row, e.col);
|
|
286
286
|
};
|
|
287
|
-
return (d,
|
|
287
|
+
return (d, y) => {
|
|
288
288
|
const i = T("el-input-number");
|
|
289
289
|
return w(), B(i, S({
|
|
290
290
|
modelValue: r.value,
|
|
291
|
-
"onUpdate:modelValue":
|
|
291
|
+
"onUpdate:modelValue": y[0] || (y[0] = (n) => r.value = n)
|
|
292
292
|
}, l.value, {
|
|
293
293
|
onBlur: p,
|
|
294
294
|
onFocus: u,
|
|
295
295
|
onChange: a,
|
|
296
|
-
onKeyup: G(
|
|
296
|
+
onKeyup: G(g, ["enter"])
|
|
297
297
|
}), null, 16, ["modelValue"]);
|
|
298
298
|
};
|
|
299
299
|
}
|
|
300
|
-
}),
|
|
300
|
+
}), Me = /* @__PURE__ */ R({
|
|
301
301
|
__name: "select",
|
|
302
302
|
props: {
|
|
303
303
|
row: {},
|
|
@@ -326,13 +326,13 @@ const Ve = /* @__PURE__ */ z({
|
|
|
326
326
|
}, u = (n) => {
|
|
327
327
|
var s, o, f;
|
|
328
328
|
(s = e.onCellBlur) == null || s.call(e, e.row, e.col), (f = (o = e.col.props) == null ? void 0 : o.onBlur) == null || f.call(o, n, e.row, e.col);
|
|
329
|
-
},
|
|
329
|
+
}, g = (n) => {
|
|
330
330
|
var s, o;
|
|
331
331
|
(o = (s = e.col.props) == null ? void 0 : s.onFocus) == null || o.call(s, n, e.row, e.col);
|
|
332
332
|
}, d = (n) => {
|
|
333
333
|
var s, o;
|
|
334
334
|
(o = (s = e.col.props) == null ? void 0 : s.onVisibleChange) == null || o.call(s, n, e.row, e.col);
|
|
335
|
-
},
|
|
335
|
+
}, y = () => {
|
|
336
336
|
var n, s;
|
|
337
337
|
(s = (n = e.col.props) == null ? void 0 : n.onClear) == null || s.call(n, e.row, e.col);
|
|
338
338
|
}, i = (n) => {
|
|
@@ -347,9 +347,9 @@ const Ve = /* @__PURE__ */ z({
|
|
|
347
347
|
}, l.value, {
|
|
348
348
|
onChange: p,
|
|
349
349
|
onBlur: u,
|
|
350
|
-
onFocus:
|
|
350
|
+
onFocus: g,
|
|
351
351
|
onVisibleChange: d,
|
|
352
|
-
onClear:
|
|
352
|
+
onClear: y,
|
|
353
353
|
onKeyup: G(i, ["enter"])
|
|
354
354
|
}), {
|
|
355
355
|
default: $(() => [
|
|
@@ -364,23 +364,23 @@ const Ve = /* @__PURE__ */ z({
|
|
|
364
364
|
}, 16, ["modelValue"]);
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
|
-
}),
|
|
367
|
+
}), $e = Q(Fe), Ae = Q(Te), Oe = Q(Me), le = (t, e) => t == null || t === "" ? e : typeof t == "number" ? t + "px" : t, Re = (t) => {
|
|
368
368
|
const e = {}, r = {};
|
|
369
369
|
return Object.keys(t).forEach((l) => {
|
|
370
370
|
l.startsWith("on") && typeof t[l] == "function" ? e[l] = t[l] : r[l] = t[l];
|
|
371
371
|
}), { events: e, props: r };
|
|
372
372
|
}, ze = V((t) => {
|
|
373
|
-
const e = t.col.props || {}, r = k(t.row, t.col.key), { events: l, props: a } =
|
|
374
|
-
return b(
|
|
373
|
+
const e = t.col.props || {}, r = k(t.row, t.col.key), { events: l, props: a } = Re(e);
|
|
374
|
+
return b(ke, {
|
|
375
375
|
type: "primary",
|
|
376
376
|
...a,
|
|
377
377
|
...l,
|
|
378
378
|
onClick: (p) => {
|
|
379
|
-
var u,
|
|
380
|
-
(u = t.onClick) == null || u.call(t, t.row, t.col), (
|
|
379
|
+
var u, g;
|
|
380
|
+
(u = t.onClick) == null || u.call(t, t.row, t.col), (g = e.onClick) == null || g.call(e, p, t.row, t.col);
|
|
381
381
|
}
|
|
382
382
|
}, () => e.label || r);
|
|
383
|
-
}),
|
|
383
|
+
}), Ie = V((t) => {
|
|
384
384
|
const e = t.col.props || {}, r = k(t.row, t.col.key), { href: l, blank: a, label: p, ...u } = e;
|
|
385
385
|
return b("a", {
|
|
386
386
|
href: l || r || "#",
|
|
@@ -389,7 +389,7 @@ const Ve = /* @__PURE__ */ z({
|
|
|
389
389
|
style: "color:#409EFF;cursor:pointer;text-decoration:none;",
|
|
390
390
|
...u
|
|
391
391
|
}, p || r);
|
|
392
|
-
}),
|
|
392
|
+
}), Ne = V((t) => {
|
|
393
393
|
var u;
|
|
394
394
|
const e = k(t.row, t.col.key), r = ((u = t.col) == null ? void 0 : u.props) || {}, { style: l, class: a, ...p } = r;
|
|
395
395
|
return b("div", {
|
|
@@ -398,8 +398,8 @@ const Ve = /* @__PURE__ */ z({
|
|
|
398
398
|
innerHTML: e ?? "",
|
|
399
399
|
...p
|
|
400
400
|
});
|
|
401
|
-
}),
|
|
402
|
-
const e = k(t.row, t.col.key) ?? "", r = t.col.props ?? {}, { iconColor: l, copyTitle: a, successText: p, errorText: u, lineClamp:
|
|
401
|
+
}), Ke = V((t) => {
|
|
402
|
+
const e = k(t.row, t.col.key) ?? "", r = t.col.props ?? {}, { iconColor: l, copyTitle: a, successText: p, errorText: u, lineClamp: g, textStyles: d, textClass: y, ...i } = r, n = {
|
|
403
403
|
position: "absolute",
|
|
404
404
|
right: "-5px",
|
|
405
405
|
top: "50%",
|
|
@@ -413,7 +413,7 @@ const Ve = /* @__PURE__ */ z({
|
|
|
413
413
|
"padding-right": "10px",
|
|
414
414
|
display: "-webkit-box",
|
|
415
415
|
"-webkit-box-orient": "vertical",
|
|
416
|
-
"-webkit-line-clamp":
|
|
416
|
+
"-webkit-line-clamp": g ?? 2,
|
|
417
417
|
overflow: "hidden",
|
|
418
418
|
...d
|
|
419
419
|
};
|
|
@@ -426,7 +426,7 @@ const Ve = /* @__PURE__ */ z({
|
|
|
426
426
|
},
|
|
427
427
|
[
|
|
428
428
|
b("span", {
|
|
429
|
-
class: `st_copy_text ${
|
|
429
|
+
class: `st_copy_text ${y ?? ""}`,
|
|
430
430
|
style: s,
|
|
431
431
|
title: e
|
|
432
432
|
}, e),
|
|
@@ -439,33 +439,33 @@ const Ve = /* @__PURE__ */ z({
|
|
|
439
439
|
try {
|
|
440
440
|
if (navigator.clipboard && navigator.clipboard.writeText)
|
|
441
441
|
navigator.clipboard.writeText(e).then(() => {
|
|
442
|
-
|
|
442
|
+
z.success(p ?? "复制成功");
|
|
443
443
|
}).catch(() => {
|
|
444
|
-
|
|
444
|
+
z.error(u ?? "复制失败");
|
|
445
445
|
});
|
|
446
446
|
else {
|
|
447
447
|
const o = document.createElement("textarea");
|
|
448
448
|
o.value = e, o.style.position = "fixed", o.style.opacity = "0", document.body.appendChild(o), o.select();
|
|
449
449
|
const f = document.execCommand("copy");
|
|
450
|
-
document.body.removeChild(o), f ?
|
|
450
|
+
document.body.removeChild(o), f ? z.success(p ?? "复制成功") : z.error(u ?? "复制失败");
|
|
451
451
|
}
|
|
452
452
|
} catch {
|
|
453
|
-
|
|
453
|
+
z.error(u ?? "复制失败");
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
-
}, [b(
|
|
456
|
+
}, [b(xe, {
|
|
457
457
|
style: "width: 1em; height: 1em;"
|
|
458
458
|
})])
|
|
459
459
|
].filter(Boolean)
|
|
460
460
|
);
|
|
461
|
-
}),
|
|
461
|
+
}), We = V((t) => {
|
|
462
462
|
var f;
|
|
463
|
-
const e = k(t.row, t.col.key) ?? "", r = ((f = t.col) == null ? void 0 : f.props) || {}, { width: l, height: a, fit: p, previewSrcList: u, placeholder:
|
|
463
|
+
const e = k(t.row, t.col.key) ?? "", r = ((f = t.col) == null ? void 0 : f.props) || {}, { width: l, height: a, fit: p, previewSrcList: u, placeholder: g, style: d, ...y } = r, n = e ? Array.isArray(e) ? e.filter((h) => h && typeof h == "string") : [e] : [];
|
|
464
464
|
if (n.length === 0)
|
|
465
|
-
return
|
|
465
|
+
return g || "";
|
|
466
466
|
const s = {
|
|
467
|
-
width: l
|
|
468
|
-
height: a
|
|
467
|
+
width: le(l, "80px"),
|
|
468
|
+
height: le(a, "80px"),
|
|
469
469
|
marginRight: n.length > 1 ? "4px" : "0",
|
|
470
470
|
...typeof d == "object" ? d : {}
|
|
471
471
|
}, o = {
|
|
@@ -473,7 +473,7 @@ const Ve = /* @__PURE__ */ z({
|
|
|
473
473
|
previewTeleported: !0,
|
|
474
474
|
fit: p || "contain",
|
|
475
475
|
style: s,
|
|
476
|
-
...
|
|
476
|
+
...y
|
|
477
477
|
};
|
|
478
478
|
return n.length === 1 ? b(U, {
|
|
479
479
|
src: n[0],
|
|
@@ -493,16 +493,16 @@ const Ve = /* @__PURE__ */ z({
|
|
|
493
493
|
class: "st_img_total",
|
|
494
494
|
style: "position: absolute; top: 0; right: 0; ",
|
|
495
495
|
title: `${n.length}`
|
|
496
|
-
}, [b(
|
|
496
|
+
}, [b(_e, { style: "width: 1em; height: 1em; " })])
|
|
497
497
|
]
|
|
498
498
|
);
|
|
499
|
-
}),
|
|
499
|
+
}), je = V((t) => {
|
|
500
500
|
const e = k(t.row, t.col.key) ?? "", r = t.col.props || {}, { options: l = [], showValue: a = !1, ...p } = r;
|
|
501
501
|
if (e == null || e === "") return "";
|
|
502
|
-
const u = Array.isArray(e) ? e.map(String) : [String(e)],
|
|
502
|
+
const u = Array.isArray(e) ? e.map(String) : [String(e)], g = l.filter((i) => u.includes(String(i.value))), d = u.filter((i) => !l.some((n) => String(n.value) === i)), y = g.map((i) => {
|
|
503
503
|
const { listClass: n, cssClass: s, tagProps: o, ...f } = i;
|
|
504
504
|
return b(
|
|
505
|
-
|
|
505
|
+
we,
|
|
506
506
|
{
|
|
507
507
|
key: i.value,
|
|
508
508
|
type: n,
|
|
@@ -514,23 +514,23 @@ const Ve = /* @__PURE__ */ z({
|
|
|
514
514
|
{ default: () => i.label + " " }
|
|
515
515
|
);
|
|
516
516
|
});
|
|
517
|
-
return a && d.length > 0 &&
|
|
518
|
-
}),
|
|
517
|
+
return a && d.length > 0 && y.push(b("span", {}, d.join(" "))), b("div", { style: "display: inline-flex; gap: 4px; flex-wrap: wrap;" }, y);
|
|
518
|
+
}), De = V((t) => {
|
|
519
519
|
const e = k(t.row, t.col.key) ?? "", r = t.col.props || {}, { options: l = {}, ...a } = r, p = e != null ? l[e] ?? "" : "";
|
|
520
520
|
return b("span", { ...a }, p);
|
|
521
521
|
});
|
|
522
|
-
function
|
|
522
|
+
function Le(t) {
|
|
523
523
|
return typeof t.formatter == "function";
|
|
524
524
|
}
|
|
525
|
-
const
|
|
526
|
-
var
|
|
525
|
+
const Pe = V((t) => {
|
|
526
|
+
var g;
|
|
527
527
|
const { col: e, row: r, index: l } = t, a = k(t.row, t.col.key) ?? "", p = t.col.props || {};
|
|
528
528
|
let u = a;
|
|
529
|
-
return
|
|
530
|
-
}),
|
|
529
|
+
return Le(e) && (u = ((g = e.formatter) == null ? void 0 : g.call(e, a, r, l)) ?? a), b("span", { ...p }, u);
|
|
530
|
+
}), qe = V((t) => {
|
|
531
531
|
const e = k(t.row, t.col.key) ?? "", r = t.col.props || {}, { style: l, size: a, class: p, ...u } = r;
|
|
532
532
|
if (!e) return "";
|
|
533
|
-
const
|
|
533
|
+
const g = a ? `${a}px` : "20px";
|
|
534
534
|
return /^https?:\/\//.test(e) ? b(U, {
|
|
535
535
|
src: e,
|
|
536
536
|
previewSrcList: [e],
|
|
@@ -551,32 +551,32 @@ const Le = V((t) => {
|
|
|
551
551
|
}) : b("i", {
|
|
552
552
|
class: [e, p].filter(Boolean).join(" "),
|
|
553
553
|
style: {
|
|
554
|
-
fontSize:
|
|
554
|
+
fontSize: g,
|
|
555
555
|
...typeof l == "object" ? l : {}
|
|
556
556
|
},
|
|
557
557
|
...u
|
|
558
558
|
});
|
|
559
|
-
}),
|
|
560
|
-
input:
|
|
561
|
-
"input-number":
|
|
562
|
-
select:
|
|
559
|
+
}), ae = {
|
|
560
|
+
input: $e,
|
|
561
|
+
"input-number": Ae,
|
|
562
|
+
select: Oe,
|
|
563
563
|
button: ze,
|
|
564
|
-
link:
|
|
565
|
-
html:
|
|
566
|
-
copy:
|
|
567
|
-
img:
|
|
568
|
-
dict:
|
|
569
|
-
map:
|
|
570
|
-
formatter:
|
|
571
|
-
icon:
|
|
564
|
+
link: Ie,
|
|
565
|
+
html: Ne,
|
|
566
|
+
copy: Ke,
|
|
567
|
+
img: We,
|
|
568
|
+
dict: je,
|
|
569
|
+
map: De,
|
|
570
|
+
formatter: Pe,
|
|
571
|
+
icon: qe
|
|
572
572
|
};
|
|
573
|
-
function
|
|
574
|
-
t.registerMultiple(
|
|
573
|
+
function He(t) {
|
|
574
|
+
t.registerMultiple(ae);
|
|
575
575
|
}
|
|
576
|
-
function
|
|
577
|
-
return
|
|
576
|
+
function tt() {
|
|
577
|
+
return ae;
|
|
578
578
|
}
|
|
579
|
-
const
|
|
579
|
+
const se = {
|
|
580
580
|
defaultPagination: {
|
|
581
581
|
page: 1,
|
|
582
582
|
size: 10,
|
|
@@ -585,9 +585,9 @@ const le = {
|
|
|
585
585
|
defaultTableProps: {},
|
|
586
586
|
defaultColumnProps: {}
|
|
587
587
|
};
|
|
588
|
-
class
|
|
588
|
+
class Je {
|
|
589
589
|
constructor() {
|
|
590
|
-
j(this, "config", { ...
|
|
590
|
+
j(this, "config", { ...se });
|
|
591
591
|
j(this, "_initialized", !1);
|
|
592
592
|
}
|
|
593
593
|
/**
|
|
@@ -600,7 +600,7 @@ class He {
|
|
|
600
600
|
* 初始化(注册内置渲染器)
|
|
601
601
|
*/
|
|
602
602
|
init() {
|
|
603
|
-
this._initialized || (
|
|
603
|
+
this._initialized || (He(Y()), this._initialized = !0);
|
|
604
604
|
}
|
|
605
605
|
/**
|
|
606
606
|
* 获取所有配置
|
|
@@ -624,7 +624,7 @@ class He {
|
|
|
624
624
|
* 重置为默认配置
|
|
625
625
|
*/
|
|
626
626
|
reset() {
|
|
627
|
-
this.config = { ...
|
|
627
|
+
this.config = { ...se };
|
|
628
628
|
}
|
|
629
629
|
/**
|
|
630
630
|
* 深度合并配置
|
|
@@ -638,15 +638,15 @@ class He {
|
|
|
638
638
|
}
|
|
639
639
|
let H = null;
|
|
640
640
|
function Z() {
|
|
641
|
-
return H || (H = new
|
|
641
|
+
return H || (H = new Je()), H;
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function nt(t) {
|
|
644
644
|
Z().setConfig(t);
|
|
645
645
|
}
|
|
646
|
-
function
|
|
646
|
+
function ot() {
|
|
647
647
|
return Z().getConfig();
|
|
648
648
|
}
|
|
649
|
-
const
|
|
649
|
+
const Ue = ["title"], rt = /* @__PURE__ */ R({
|
|
650
650
|
__name: "index",
|
|
651
651
|
props: {
|
|
652
652
|
data: { default: () => [] },
|
|
@@ -661,7 +661,7 @@ const Je = ["title"], ot = /* @__PURE__ */ z({
|
|
|
661
661
|
setup(t, { expose: e, emit: r }) {
|
|
662
662
|
const l = t, a = r;
|
|
663
663
|
Z().init();
|
|
664
|
-
const { columns: p } =
|
|
664
|
+
const { columns: p } = Ee(l.columns, {
|
|
665
665
|
cacheKey: l.cacheKey ?? ""
|
|
666
666
|
}), u = O(!1);
|
|
667
667
|
N(
|
|
@@ -671,32 +671,32 @@ const Je = ["title"], ot = /* @__PURE__ */ z({
|
|
|
671
671
|
},
|
|
672
672
|
{ deep: !0, immediate: !0 }
|
|
673
673
|
);
|
|
674
|
-
const
|
|
674
|
+
const g = E(
|
|
675
675
|
() => p.value.filter((c) => c.type === "operation")
|
|
676
676
|
), d = E(() => {
|
|
677
677
|
const c = /* @__PURE__ */ new Map();
|
|
678
|
-
return
|
|
679
|
-
const v =
|
|
678
|
+
return g.value.forEach((m) => {
|
|
679
|
+
const v = Se(
|
|
680
680
|
m.buttons || [],
|
|
681
681
|
m.maxbtn ?? 10,
|
|
682
682
|
l.permissions || []
|
|
683
683
|
);
|
|
684
684
|
c.set(m.key, v);
|
|
685
685
|
}), c;
|
|
686
|
-
}),
|
|
686
|
+
}), y = (c) => d.value.get(c.key), i = (c) => {
|
|
687
687
|
var _;
|
|
688
|
-
if (!
|
|
689
|
-
const m =
|
|
688
|
+
if (!Be(c)) return !1;
|
|
689
|
+
const m = y(c);
|
|
690
690
|
return !m || !(c.buttons || []).length ? !1 : (_ = l.data) != null && _.length ? m.hasAnyVisibleButton(l.data) : m.hasAnyButton.value;
|
|
691
691
|
}, n = (c) => {
|
|
692
692
|
var v;
|
|
693
|
-
const m =
|
|
693
|
+
const m = y(c);
|
|
694
694
|
return m ? (v = l.data) != null && v.length ? m.getMaxOptWidth(l.data) : m.optWidth.value : 0;
|
|
695
695
|
}, s = (c, m) => {
|
|
696
|
-
const v =
|
|
696
|
+
const v = y(c);
|
|
697
697
|
return v ? (c.buttons || []).length ? v.getVisibleButtons(m) : [] : [];
|
|
698
698
|
}, o = E(
|
|
699
|
-
() => p.value.filter((c) => c.type === "operation" ? i(c) :
|
|
699
|
+
() => p.value.filter((c) => c.type === "operation" ? i(c) : ie(c.type) ? !0 : c.visible !== !1)
|
|
700
700
|
), f = (c, m) => c.type === "selection" ? `selection-${m}` : c.type === "index" ? `index-${m}` : c.type === "operation" ? `operation-${c.key}-${m}` : `${c.key}-${m}`, h = (c) => {
|
|
701
701
|
var _, W;
|
|
702
702
|
const m = (_ = l.pagination) == null ? void 0 : _.page, v = (W = l.pagination) == null ? void 0 : W.size;
|
|
@@ -713,14 +713,14 @@ const Je = ["title"], ot = /* @__PURE__ */ z({
|
|
|
713
713
|
a("cellBlur", c, m);
|
|
714
714
|
}, D = (c, m) => {
|
|
715
715
|
a("cellEnter", c, m);
|
|
716
|
-
},
|
|
716
|
+
}, ce = (c, m) => {
|
|
717
717
|
m && a("cellClick", c, m);
|
|
718
718
|
}, te = O();
|
|
719
719
|
return e({
|
|
720
720
|
tableRef: te
|
|
721
721
|
}), (c, m) => {
|
|
722
|
-
const v = T("el-table-column"), _ = T("el-button"), W = T("el-table"),
|
|
723
|
-
return
|
|
722
|
+
const v = T("el-table-column"), _ = T("el-button"), W = T("el-table"), ue = me("loading");
|
|
723
|
+
return ye((w(), B(W, S({
|
|
724
724
|
ref_key: "tableRef",
|
|
725
725
|
ref: te
|
|
726
726
|
}, c.$attrs, {
|
|
@@ -729,8 +729,8 @@ const Je = ["title"], ot = /* @__PURE__ */ z({
|
|
|
729
729
|
class: "smart_table"
|
|
730
730
|
}), {
|
|
731
731
|
default: $(() => [
|
|
732
|
-
(w(!0), A(I, null, J(o.value, (C,
|
|
733
|
-
key: f(C,
|
|
732
|
+
(w(!0), A(I, null, J(o.value, (C, pe) => (w(), A(I, {
|
|
733
|
+
key: f(C, pe)
|
|
734
734
|
}, [
|
|
735
735
|
C.type === "selection" ? (w(), B(v, S({
|
|
736
736
|
key: 0,
|
|
@@ -769,6 +769,7 @@ const Je = ["title"], ot = /* @__PURE__ */ z({
|
|
|
769
769
|
_: 2
|
|
770
770
|
}, 1040, ["label"])) : (w(), B(v, S({
|
|
771
771
|
key: 3,
|
|
772
|
+
prop: C.key,
|
|
772
773
|
label: C.label,
|
|
773
774
|
align: "center"
|
|
774
775
|
}, { ref_for: !0 }, C.columnProps || {}), {
|
|
@@ -779,8 +780,8 @@ const Je = ["title"], ot = /* @__PURE__ */ z({
|
|
|
779
780
|
x.$index >= 0 ? ge(c.$slots, C.slot || C.key, S({
|
|
780
781
|
key: 0,
|
|
781
782
|
ref_for: !0
|
|
782
|
-
}, x)) :
|
|
783
|
-
], 64)) : C.type && M.value[C.type] ? (w(), B(
|
|
783
|
+
}, x)) : he("", !0)
|
|
784
|
+
], 64)) : C.type && M.value[C.type] ? (w(), B(Ce(M.value[C.type]), {
|
|
784
785
|
key: 1,
|
|
785
786
|
row: x.row,
|
|
786
787
|
col: C,
|
|
@@ -788,47 +789,47 @@ const Je = ["title"], ot = /* @__PURE__ */ z({
|
|
|
788
789
|
onCellChange: K,
|
|
789
790
|
onCellBlur: ee,
|
|
790
791
|
onCellEnter: D,
|
|
791
|
-
onClick:
|
|
792
|
+
onClick: ce
|
|
792
793
|
}, null, 40, ["row", "col", "index"])) : (w(), A("span", {
|
|
793
794
|
key: 2,
|
|
794
|
-
style:
|
|
795
|
-
class:
|
|
795
|
+
style: ve(((F = C.props) == null ? void 0 : F.style) || ""),
|
|
796
|
+
class: be(((L = C.props) == null ? void 0 : L.class) || ""),
|
|
796
797
|
title: oe(k)(x.row, C.key)
|
|
797
|
-
}, P(oe(k)(x.row, C.key)), 15,
|
|
798
|
+
}, P(oe(k)(x.row, C.key)), 15, Ue))
|
|
798
799
|
];
|
|
799
800
|
}),
|
|
800
801
|
_: 2
|
|
801
|
-
}, 1040, ["label"]))
|
|
802
|
+
}, 1040, ["prop", "label"]))
|
|
802
803
|
], 64))), 128))
|
|
803
804
|
]),
|
|
804
805
|
_: 3
|
|
805
806
|
}, 16, ["data", "row-key"])), [
|
|
806
|
-
[
|
|
807
|
+
[ue, t.loading]
|
|
807
808
|
]);
|
|
808
809
|
};
|
|
809
810
|
}
|
|
810
811
|
});
|
|
811
|
-
function
|
|
812
|
+
function lt(t, e) {
|
|
812
813
|
return {
|
|
813
814
|
key: t,
|
|
814
815
|
...e
|
|
815
816
|
};
|
|
816
817
|
}
|
|
817
818
|
export {
|
|
818
|
-
|
|
819
|
-
|
|
819
|
+
rt as SmartTable,
|
|
820
|
+
ae as builtInRenderers,
|
|
820
821
|
V as createFunctionalRenderer,
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
822
|
+
tt as createRenderer,
|
|
823
|
+
rt as default,
|
|
824
|
+
lt as defineColumn,
|
|
824
825
|
Y as getRendererManager,
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
826
|
+
ot as getSmartTableConfig,
|
|
827
|
+
Be as isOperationColumn,
|
|
828
|
+
Ze as isRendererType,
|
|
829
|
+
ie as isSpecialColumn,
|
|
830
|
+
He as registerBuiltInRenderers,
|
|
831
|
+
nt as setSmartTableConfig,
|
|
832
|
+
et as validateRendererProps,
|
|
832
833
|
Q as wrapSFCComponent
|
|
833
834
|
};
|
|
834
835
|
//# sourceMappingURL=vue3-smart-table.es.js.map
|