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