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