@xto/data 1.1.3 → 1.1.4
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/es/index.mjs +1207 -1172
- package/es/style.css +1 -1
- package/lib/index.cjs +1 -1
- package/lib/style.css +1 -1
- package/package.json +6 -6
package/es/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useNamespace as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as G, computed as x, openBlock as c, createElementBlock as h, normalizeStyle as j, normalizeClass as g, renderSlot as B, unref as f, createCommentVNode as S, createTextVNode as J, toDisplayString as A, createElementVNode as y, ref as P, watch as q, Fragment as R, renderList as U, useSlots as ue, withModifiers as de, inject as oe, resolveComponent as ye, withDirectives as ve, createBlock as se, withCtx as he, vShow as me, reactive as fe, provide as le, toRef as ke, nextTick as pe, onMounted as ie, onUnmounted as re, resolveDynamicComponent as ce, createVNode as xe } from "vue";
|
|
2
|
+
import { useNamespace as Y } from "@xto/core";
|
|
3
|
+
const pt = /* @__PURE__ */ G({
|
|
4
4
|
name: "XTag",
|
|
5
5
|
__name: "index",
|
|
6
6
|
props: {
|
|
@@ -12,33 +12,33 @@ const ft = /* @__PURE__ */ O({
|
|
|
12
12
|
color: {}
|
|
13
13
|
},
|
|
14
14
|
emits: ["close"],
|
|
15
|
-
setup(l, { emit:
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
]),
|
|
23
|
-
backgroundColor:
|
|
24
|
-
borderColor:
|
|
25
|
-
color:
|
|
15
|
+
setup(l, { emit: o }) {
|
|
16
|
+
const r = l, t = o, u = Y("tag"), i = x(() => [
|
|
17
|
+
u.b(),
|
|
18
|
+
u.m(r.type || "primary"),
|
|
19
|
+
r.size !== "default" ? u.m(r.size) : "",
|
|
20
|
+
u.m(r.effect),
|
|
21
|
+
u.is("hit", r.hit)
|
|
22
|
+
]), s = x(() => r.color ? {
|
|
23
|
+
backgroundColor: r.effect === "dark" ? r.color : "",
|
|
24
|
+
borderColor: r.color,
|
|
25
|
+
color: r.effect === "dark" ? "#fff" : r.color
|
|
26
26
|
} : {}), k = (b) => {
|
|
27
|
-
|
|
27
|
+
t("close", b);
|
|
28
28
|
};
|
|
29
|
-
return (b,
|
|
30
|
-
class:
|
|
31
|
-
style:
|
|
29
|
+
return (b, M) => (c(), h("span", {
|
|
30
|
+
class: g(i.value),
|
|
31
|
+
style: j(s.value)
|
|
32
32
|
}, [
|
|
33
|
-
|
|
34
|
-
l.closable ? (c(),
|
|
33
|
+
B(b.$slots, "default"),
|
|
34
|
+
l.closable ? (c(), h("i", {
|
|
35
35
|
key: 0,
|
|
36
|
-
class: f(
|
|
36
|
+
class: g(f(u).e("close")),
|
|
37
37
|
onClick: k
|
|
38
|
-
}, "✕", 2)) :
|
|
38
|
+
}, "✕", 2)) : S("", !0)
|
|
39
39
|
], 6));
|
|
40
40
|
}
|
|
41
|
-
}),
|
|
41
|
+
}), gt = /* @__PURE__ */ G({
|
|
42
42
|
name: "XCard",
|
|
43
43
|
__name: "index",
|
|
44
44
|
props: {
|
|
@@ -47,30 +47,30 @@ const ft = /* @__PURE__ */ O({
|
|
|
47
47
|
shadow: { default: "always" }
|
|
48
48
|
},
|
|
49
49
|
setup(l) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const o = l, r = Y("card"), t = x(() => [
|
|
51
|
+
r.b(),
|
|
52
|
+
r.is(`shadow-${o.shadow}`)
|
|
53
53
|
]);
|
|
54
|
-
return (
|
|
55
|
-
class:
|
|
54
|
+
return (u, i) => (c(), h("div", {
|
|
55
|
+
class: g(t.value)
|
|
56
56
|
}, [
|
|
57
|
-
l.header ||
|
|
57
|
+
l.header || u.$slots.header ? (c(), h("div", {
|
|
58
58
|
key: 0,
|
|
59
|
-
class: f(
|
|
59
|
+
class: g(f(r).e("header"))
|
|
60
60
|
}, [
|
|
61
|
-
|
|
61
|
+
B(u.$slots, "header", {}, () => [
|
|
62
62
|
J(A(l.header), 1)
|
|
63
63
|
])
|
|
64
|
-
], 2)) :
|
|
65
|
-
|
|
66
|
-
class: f(
|
|
67
|
-
style:
|
|
64
|
+
], 2)) : S("", !0),
|
|
65
|
+
y("div", {
|
|
66
|
+
class: g(f(r).e("body")),
|
|
67
|
+
style: j(l.bodyStyle)
|
|
68
68
|
}, [
|
|
69
|
-
|
|
69
|
+
B(u.$slots, "default")
|
|
70
70
|
], 6)
|
|
71
71
|
], 2));
|
|
72
72
|
}
|
|
73
|
-
}), be = ["viewBox"],
|
|
73
|
+
}), be = ["viewBox"], Ce = ["cx", "cy", "r", "stroke-width"], we = ["cx", "cy", "r", "stroke-width", "stroke-dasharray", "stroke"], yt = /* @__PURE__ */ G({
|
|
74
74
|
name: "XProgress",
|
|
75
75
|
__name: "index",
|
|
76
76
|
props: {
|
|
@@ -83,74 +83,74 @@ const ft = /* @__PURE__ */ O({
|
|
|
83
83
|
showText: { type: Boolean, default: !0 }
|
|
84
84
|
},
|
|
85
85
|
setup(l) {
|
|
86
|
-
const
|
|
87
|
-
width: `${
|
|
88
|
-
backgroundColor: typeof
|
|
89
|
-
})),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
const o = l, r = Y("progress"), t = x(() => Math.min(100, Math.max(0, o.percentage))), u = x(() => ({
|
|
87
|
+
width: `${t.value}%`,
|
|
88
|
+
backgroundColor: typeof o.color == "function" ? o.color(t.value) : o.color
|
|
89
|
+
})), i = x(() => [
|
|
90
|
+
r.b(),
|
|
91
|
+
r.m(o.type),
|
|
92
|
+
r.is("show-text", o.showText),
|
|
93
|
+
r.is(`status-${o.status || ""}`, o.status)
|
|
94
94
|
]);
|
|
95
|
-
return x(() =>
|
|
96
|
-
class:
|
|
95
|
+
return x(() => o.status === "success" ? "100%" : o.status === "warning" ? "Warning" : o.status === "exception" ? "Exception" : `${t.value}%`), (s, k) => (c(), h("div", {
|
|
96
|
+
class: g(i.value)
|
|
97
97
|
}, [
|
|
98
|
-
l.type === "line" ? (c(),
|
|
98
|
+
l.type === "line" ? (c(), h("div", {
|
|
99
99
|
key: 0,
|
|
100
|
-
class: f(
|
|
100
|
+
class: g(f(r).e("line"))
|
|
101
101
|
}, [
|
|
102
|
-
|
|
103
|
-
class: f(
|
|
102
|
+
y("div", {
|
|
103
|
+
class: g(f(r).e("outer"))
|
|
104
104
|
}, [
|
|
105
|
-
|
|
106
|
-
class: f(
|
|
105
|
+
y("div", {
|
|
106
|
+
class: g(f(r).e("inner"))
|
|
107
107
|
}, [
|
|
108
|
-
|
|
109
|
-
class: f(
|
|
110
|
-
style:
|
|
108
|
+
y("div", {
|
|
109
|
+
class: g(f(r).e("bar")),
|
|
110
|
+
style: j(u.value)
|
|
111
111
|
}, null, 6)
|
|
112
112
|
], 2)
|
|
113
113
|
], 2),
|
|
114
|
-
l.showText ? (c(),
|
|
114
|
+
l.showText ? (c(), h("div", {
|
|
115
115
|
key: 0,
|
|
116
|
-
class: f(
|
|
117
|
-
}, A(
|
|
118
|
-
], 2)) : (c(),
|
|
116
|
+
class: g(f(r).e("text"))
|
|
117
|
+
}, A(t.value) + "% ", 3)) : S("", !0)
|
|
118
|
+
], 2)) : (c(), h("div", {
|
|
119
119
|
key: 1,
|
|
120
|
-
class: f(
|
|
120
|
+
class: g(f(r).e("circle"))
|
|
121
121
|
}, [
|
|
122
|
-
(c(),
|
|
122
|
+
(c(), h("svg", {
|
|
123
123
|
viewBox: `0 0 ${l.width} ${l.width}`,
|
|
124
|
-
style:
|
|
124
|
+
style: j({ width: `${l.width}px`, height: `${l.width}px` })
|
|
125
125
|
}, [
|
|
126
|
-
|
|
126
|
+
y("circle", {
|
|
127
127
|
cx: l.width / 2,
|
|
128
128
|
cy: l.width / 2,
|
|
129
129
|
r: (l.width - l.strokeWidth) / 2,
|
|
130
130
|
fill: "none",
|
|
131
131
|
"stroke-width": l.strokeWidth,
|
|
132
132
|
stroke: "#ebeef5"
|
|
133
|
-
}, null, 8,
|
|
134
|
-
|
|
133
|
+
}, null, 8, Ce),
|
|
134
|
+
y("circle", {
|
|
135
135
|
cx: l.width / 2,
|
|
136
136
|
cy: l.width / 2,
|
|
137
137
|
r: (l.width - l.strokeWidth) / 2,
|
|
138
138
|
fill: "none",
|
|
139
139
|
"stroke-width": l.strokeWidth,
|
|
140
|
-
"stroke-dasharray": `${
|
|
141
|
-
stroke: typeof l.color == "function" ? l.color(
|
|
140
|
+
"stroke-dasharray": `${t.value / 100 * Math.PI * (l.width - l.strokeWidth)} ${Math.PI * (l.width - l.strokeWidth)}`,
|
|
141
|
+
stroke: typeof l.color == "function" ? l.color(t.value) : l.color,
|
|
142
142
|
"stroke-linecap": "round",
|
|
143
143
|
style: { transform: "rotate(-90deg)", "transform-origin": "center" }
|
|
144
|
-
}, null, 8,
|
|
144
|
+
}, null, 8, we)
|
|
145
145
|
], 12, be)),
|
|
146
|
-
l.showText ? (c(),
|
|
146
|
+
l.showText ? (c(), h("div", {
|
|
147
147
|
key: 0,
|
|
148
|
-
class: f(
|
|
149
|
-
}, A(
|
|
148
|
+
class: g(f(r).e("circle-text"))
|
|
149
|
+
}, A(t.value) + "% ", 3)) : S("", !0)
|
|
150
150
|
], 2))
|
|
151
151
|
], 2));
|
|
152
152
|
}
|
|
153
|
-
}),
|
|
153
|
+
}), Ie = ["disabled"], $e = ["onClick"], Me = ["disabled"], Se = ["value"], Ke = ["value"], Ne = /* @__PURE__ */ G({
|
|
154
154
|
name: "XPagination",
|
|
155
155
|
__name: "index",
|
|
156
156
|
props: {
|
|
@@ -161,73 +161,73 @@ const ft = /* @__PURE__ */ O({
|
|
|
161
161
|
layout: { default: "total, sizes, prev, pager, next, jumper" }
|
|
162
162
|
},
|
|
163
163
|
emits: ["update:currentPage", "update:pageSize", "current-change", "size-change"],
|
|
164
|
-
setup(l, { emit:
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}),
|
|
169
|
-
|
|
164
|
+
setup(l, { emit: o }) {
|
|
165
|
+
const r = l, t = o, u = Y("pagination"), i = P(r.currentPage), s = P(r.pageSize);
|
|
166
|
+
q(() => r.currentPage, (w) => {
|
|
167
|
+
i.value = w;
|
|
168
|
+
}), q(() => r.pageSize, (w) => {
|
|
169
|
+
s.value = w;
|
|
170
170
|
});
|
|
171
|
-
const k = x(() =>
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
174
|
-
for (let N = 1; N <=
|
|
171
|
+
const k = x(() => i.value), b = x(() => s.value), M = x(() => Math.max(1, Math.ceil(r.total / b.value))), C = x(() => {
|
|
172
|
+
const w = [], $ = M.value, K = k.value;
|
|
173
|
+
if ($ <= 7)
|
|
174
|
+
for (let N = 1; N <= $; N++) w.push(N);
|
|
175
175
|
else if (K <= 4) {
|
|
176
|
-
for (let N = 1; N <= 5; N++)
|
|
177
|
-
|
|
178
|
-
} else if (K >=
|
|
179
|
-
|
|
180
|
-
for (let N =
|
|
176
|
+
for (let N = 1; N <= 5; N++) w.push(N);
|
|
177
|
+
w.push(-1), w.push($);
|
|
178
|
+
} else if (K >= $ - 3) {
|
|
179
|
+
w.push(1), w.push(-1);
|
|
180
|
+
for (let N = $ - 4; N <= $; N++) w.push(N);
|
|
181
181
|
} else {
|
|
182
|
-
|
|
183
|
-
for (let N = K - 1; N <= K + 1; N++)
|
|
184
|
-
|
|
182
|
+
w.push(1), w.push(-1);
|
|
183
|
+
for (let N = K - 1; N <= K + 1; N++) w.push(N);
|
|
184
|
+
w.push(-1), w.push($);
|
|
185
185
|
}
|
|
186
|
-
return
|
|
187
|
-
}), T = (
|
|
188
|
-
|
|
189
|
-
},
|
|
190
|
-
|
|
186
|
+
return w;
|
|
187
|
+
}), T = (w) => {
|
|
188
|
+
w < 1 || w > M.value || w === k.value || (i.value = w, t("update:currentPage", w), t("current-change", w));
|
|
189
|
+
}, L = (w) => {
|
|
190
|
+
s.value = w, t("update:pageSize", w), t("size-change", w), i.value = 1, t("update:currentPage", 1), t("current-change", 1);
|
|
191
191
|
};
|
|
192
|
-
return (
|
|
193
|
-
class: f(
|
|
192
|
+
return (w, $) => (c(), h("div", {
|
|
193
|
+
class: g(f(u).b())
|
|
194
194
|
}, [
|
|
195
|
-
|
|
196
|
-
class: f(
|
|
195
|
+
y("span", {
|
|
196
|
+
class: g(f(u).e("total"))
|
|
197
197
|
}, "共 " + A(l.total) + " 条", 3),
|
|
198
|
-
|
|
199
|
-
class: f(
|
|
198
|
+
y("button", {
|
|
199
|
+
class: g(f(u).e("btn")),
|
|
200
200
|
disabled: k.value <= 1,
|
|
201
|
-
onClick:
|
|
202
|
-
}, " ‹ ", 10,
|
|
203
|
-
(c(!0),
|
|
204
|
-
K === -1 ? (c(),
|
|
201
|
+
onClick: $[0] || ($[0] = (K) => T(k.value - 1))
|
|
202
|
+
}, " ‹ ", 10, Ie),
|
|
203
|
+
(c(!0), h(R, null, U(C.value, (K) => (c(), h(R, { key: K }, [
|
|
204
|
+
K === -1 ? (c(), h("span", {
|
|
205
205
|
key: 0,
|
|
206
|
-
class: f(
|
|
207
|
-
}, "...", 2)) : (c(),
|
|
206
|
+
class: g(f(u).e("ellipsis"))
|
|
207
|
+
}, "...", 2)) : (c(), h("button", {
|
|
208
208
|
key: 1,
|
|
209
|
-
class:
|
|
209
|
+
class: g([f(u).e("btn"), f(u).is("active", K === k.value)]),
|
|
210
210
|
onClick: (N) => T(K)
|
|
211
|
-
}, A(K), 11,
|
|
211
|
+
}, A(K), 11, $e))
|
|
212
212
|
], 64))), 128)),
|
|
213
|
-
|
|
214
|
-
class: f(
|
|
215
|
-
disabled: k.value >=
|
|
216
|
-
onClick:
|
|
213
|
+
y("button", {
|
|
214
|
+
class: g(f(u).e("btn")),
|
|
215
|
+
disabled: k.value >= M.value,
|
|
216
|
+
onClick: $[1] || ($[1] = (K) => T(k.value + 1))
|
|
217
217
|
}, " › ", 10, Me),
|
|
218
|
-
|
|
219
|
-
class: f(
|
|
218
|
+
y("select", {
|
|
219
|
+
class: g(f(u).e("sizes")),
|
|
220
220
|
value: b.value,
|
|
221
|
-
onChange:
|
|
221
|
+
onChange: $[2] || ($[2] = (K) => L(Number(K.target.value)))
|
|
222
222
|
}, [
|
|
223
|
-
(c(!0),
|
|
223
|
+
(c(!0), h(R, null, U(l.pageSizes, (K) => (c(), h("option", {
|
|
224
224
|
key: K,
|
|
225
225
|
value: K
|
|
226
|
-
}, A(K) + " 条/页", 9,
|
|
227
|
-
], 42,
|
|
226
|
+
}, A(K) + " 条/页", 9, Ke))), 128))
|
|
227
|
+
], 42, Se)
|
|
228
228
|
], 2));
|
|
229
229
|
}
|
|
230
|
-
}),
|
|
230
|
+
}), ze = { key: 0 }, De = ["checked", "indeterminate"], Ae = ["onClick"], Te = ["onClick"], Ee = ["checked", "onChange"], Le = ["onClick"], je = ["onClick"], Be = { key: 1 }, He = ["colspan"], vt = /* @__PURE__ */ G({
|
|
231
231
|
name: "XDynamicTable",
|
|
232
232
|
__name: "index",
|
|
233
233
|
props: {
|
|
@@ -249,336 +249,336 @@ const ft = /* @__PURE__ */ O({
|
|
|
249
249
|
defaultSort: {}
|
|
250
250
|
},
|
|
251
251
|
emits: ["sort-change", "row-click", "row-dblclick", "selection-change", "select-all", "cell-click", "add-row", "delete-row", "update:data"],
|
|
252
|
-
setup(l, { expose:
|
|
253
|
-
var
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
get: () =>
|
|
258
|
-
set: (
|
|
259
|
-
}), k =
|
|
260
|
-
prop: ((
|
|
261
|
-
order: ((
|
|
262
|
-
}), b =
|
|
252
|
+
setup(l, { expose: o, emit: r }) {
|
|
253
|
+
var I, n;
|
|
254
|
+
const t = l, u = r, i = Y("dynamic-table");
|
|
255
|
+
ue();
|
|
256
|
+
const s = x({
|
|
257
|
+
get: () => t.data,
|
|
258
|
+
set: (e) => u("update:data", e)
|
|
259
|
+
}), k = P({
|
|
260
|
+
prop: ((I = t.defaultSort) == null ? void 0 : I.prop) || "",
|
|
261
|
+
order: ((n = t.defaultSort) == null ? void 0 : n.order) || null
|
|
262
|
+
}), b = P([]), M = P(!1), C = P(!1), T = x(() => {
|
|
263
263
|
if (!k.value.prop || !k.value.order)
|
|
264
|
-
return
|
|
265
|
-
const { prop:
|
|
266
|
-
return [...
|
|
267
|
-
const
|
|
268
|
-
if (
|
|
269
|
-
const
|
|
270
|
-
return
|
|
264
|
+
return s.value;
|
|
265
|
+
const { prop: e, order: a } = k.value;
|
|
266
|
+
return [...s.value].sort((d, p) => {
|
|
267
|
+
const m = d[e], D = p[e];
|
|
268
|
+
if (m === D) return 0;
|
|
269
|
+
const H = m > D ? 1 : -1;
|
|
270
|
+
return a === "ascending" ? H : -H;
|
|
271
271
|
});
|
|
272
|
-
}),
|
|
272
|
+
}), L = x(() => {
|
|
273
|
+
const e = {};
|
|
274
|
+
return t.height && (e.height = typeof t.height == "number" ? `${t.height}px` : t.height), t.maxHeight && (e.maxHeight = typeof t.maxHeight == "number" ? `${t.maxHeight}px` : t.maxHeight), e;
|
|
275
|
+
}), w = x(() => {
|
|
276
|
+
const e = typeof t.operationWidth == "number" ? `${t.operationWidth}px` : t.operationWidth;
|
|
277
|
+
return { width: e, minWidth: e };
|
|
278
|
+
}), $ = x(() => [
|
|
279
|
+
i.b(),
|
|
280
|
+
i.is("border", t.border),
|
|
281
|
+
i.is("stripe", t.stripe),
|
|
282
|
+
i.is("loading", t.loading)
|
|
283
|
+
]), K = (e) => {
|
|
284
|
+
e.sortable && (k.value.prop === e.prop ? k.value.order === "ascending" ? k.value.order = "descending" : k.value.order === "descending" && (k.value.order = null, k.value.prop = "") : (k.value.prop = e.prop, k.value.order = "ascending"), u("sort-change", { ...k.value }));
|
|
285
|
+
}, N = (e) => e.sortable ? k.value.prop !== e.prop ? i.is("sortable") : [
|
|
286
|
+
i.is("sortable"),
|
|
287
|
+
i.is(`sort-${k.value.order}`)
|
|
288
|
+
] : "", V = (e, a, d) => {
|
|
289
|
+
const p = e[a.prop];
|
|
290
|
+
return a.formatter ? a.formatter(e, a, p, d) : p ?? "";
|
|
291
|
+
}, X = (e, a, d) => {
|
|
292
|
+
u("row-click", e, a, d);
|
|
293
|
+
}, E = (e, a, d) => {
|
|
294
|
+
const p = d.target;
|
|
295
|
+
u("cell-click", e, a, p, d);
|
|
296
|
+
}, z = () => {
|
|
297
|
+
M.value || C.value ? (b.value = [], M.value = !1, C.value = !1) : (b.value = [...s.value], M.value = !0, C.value = !1), u("select-all", b.value), u("selection-change", b.value);
|
|
298
|
+
}, W = (e) => {
|
|
299
|
+
const a = b.value.findIndex((d) => typeof t.rowKey == "function" ? t.rowKey(d) === t.rowKey(e) : t.rowKey ? d[t.rowKey] === e[t.rowKey] : d === e);
|
|
300
|
+
a > -1 ? b.value.splice(a, 1) : b.value.push(e), M.value = b.value.length === s.value.length, C.value = b.value.length > 0 && b.value.length < s.value.length, u("selection-change", b.value);
|
|
301
|
+
}, Z = (e) => b.value.some((a) => typeof t.rowKey == "function" ? t.rowKey(a) === t.rowKey(e) : t.rowKey ? a[t.rowKey] === e[t.rowKey] : a === e), O = (e) => {
|
|
273
302
|
const a = {};
|
|
274
|
-
return e.
|
|
275
|
-
}
|
|
276
|
-
const a =
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
]), K = (a) => {
|
|
284
|
-
a.sortable && (k.value.prop === a.prop ? k.value.order === "ascending" ? k.value.order = "descending" : k.value.order === "descending" && (k.value.order = null, k.value.prop = "") : (k.value.prop = a.prop, k.value.order = "ascending"), y("sort-change", { ...k.value }));
|
|
285
|
-
}, N = (a) => a.sortable ? k.value.prop !== a.prop ? r.is("sortable") : [
|
|
286
|
-
r.is("sortable"),
|
|
287
|
-
r.is(`sort-${k.value.order}`)
|
|
288
|
-
] : "", Z = (a, o, p) => {
|
|
289
|
-
const v = a[o.prop];
|
|
290
|
-
return o.formatter ? o.formatter(a, o, v, p) : v ?? "";
|
|
291
|
-
}, Y = (a, o, p) => {
|
|
292
|
-
y("row-click", a, o, p);
|
|
293
|
-
}, E = (a, o, p) => {
|
|
294
|
-
const v = p.target;
|
|
295
|
-
y("cell-click", a, o, v, p);
|
|
296
|
-
}, D = () => {
|
|
297
|
-
I.value || w.value ? (b.value = [], I.value = !1, w.value = !1) : (b.value = [...n.value], I.value = !0, w.value = !1), y("select-all", b.value), y("selection-change", b.value);
|
|
298
|
-
}, B = (a) => {
|
|
299
|
-
const o = b.value.findIndex((p) => typeof e.rowKey == "function" ? e.rowKey(p) === e.rowKey(a) : e.rowKey ? p[e.rowKey] === a[e.rowKey] : p === a);
|
|
300
|
-
o > -1 ? b.value.splice(o, 1) : b.value.push(a), I.value = b.value.length === n.value.length, w.value = b.value.length > 0 && b.value.length < n.value.length, y("selection-change", b.value);
|
|
301
|
-
}, X = (a) => b.value.some((o) => typeof e.rowKey == "function" ? e.rowKey(o) === e.rowKey(a) : e.rowKey ? o[e.rowKey] === a[e.rowKey] : o === a), P = (a) => {
|
|
302
|
-
const o = {};
|
|
303
|
-
return a.width && (o.width = typeof a.width == "number" ? `${a.width}px` : a.width), a.minWidth && (o.minWidth = typeof a.minWidth == "number" ? `${a.minWidth}px` : a.minWidth), a.align && (o.textAlign = a.align), o;
|
|
304
|
-
}, Q = (a) => {
|
|
305
|
-
const o = a || {};
|
|
306
|
-
e.columns.forEach((p) => {
|
|
307
|
-
o[p.prop] === void 0 && (o[p.prop] = "");
|
|
308
|
-
}), n.value = [...n.value, o], y("add-row", o);
|
|
309
|
-
}, q = (a) => {
|
|
310
|
-
const o = n.value[a];
|
|
311
|
-
n.value = n.value.filter((p, v) => v !== a), y("delete-row", o, a);
|
|
303
|
+
return e.width && (a.width = typeof e.width == "number" ? `${e.width}px` : e.width), e.minWidth && (a.minWidth = typeof e.minWidth == "number" ? `${e.minWidth}px` : e.minWidth), e.align && (a.textAlign = e.align), a;
|
|
304
|
+
}, Q = (e) => {
|
|
305
|
+
const a = e || {};
|
|
306
|
+
t.columns.forEach((d) => {
|
|
307
|
+
a[d.prop] === void 0 && (a[d.prop] = "");
|
|
308
|
+
}), s.value = [...s.value, a], u("add-row", a);
|
|
309
|
+
}, F = (e) => {
|
|
310
|
+
const a = s.value[e];
|
|
311
|
+
s.value = s.value.filter((d, p) => p !== e), u("delete-row", a, e);
|
|
312
312
|
};
|
|
313
|
-
return
|
|
313
|
+
return o({
|
|
314
314
|
clearSelection: () => {
|
|
315
|
-
b.value = [],
|
|
315
|
+
b.value = [], M.value = !1, C.value = !1;
|
|
316
316
|
},
|
|
317
317
|
getSelection: () => [...b.value],
|
|
318
318
|
sortState: k,
|
|
319
319
|
addRow: Q,
|
|
320
|
-
deleteRow:
|
|
321
|
-
getData: () => [...
|
|
322
|
-
}), (
|
|
323
|
-
class:
|
|
320
|
+
deleteRow: F,
|
|
321
|
+
getData: () => [...s.value]
|
|
322
|
+
}), (e, a) => (c(), h("div", {
|
|
323
|
+
class: g($.value)
|
|
324
324
|
}, [
|
|
325
|
-
l.showAddButton ? (c(),
|
|
325
|
+
l.showAddButton ? (c(), h("div", {
|
|
326
326
|
key: 0,
|
|
327
|
-
class: f(
|
|
327
|
+
class: g(f(i).e("toolbar"))
|
|
328
328
|
}, [
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
class: f(
|
|
332
|
-
onClick:
|
|
333
|
-
}, [...
|
|
334
|
-
|
|
329
|
+
B(e.$slots, "toolbar", {}, () => [
|
|
330
|
+
y("button", {
|
|
331
|
+
class: g(f(i).e("add-btn")),
|
|
332
|
+
onClick: a[0] || (a[0] = (d) => Q())
|
|
333
|
+
}, [...a[2] || (a[2] = [
|
|
334
|
+
y("span", { class: "add-icon" }, "+", -1),
|
|
335
335
|
J(" 新增一行 ", -1)
|
|
336
336
|
])], 2)
|
|
337
337
|
])
|
|
338
|
-
], 2)) :
|
|
339
|
-
l.loading ? (c(),
|
|
338
|
+
], 2)) : S("", !0),
|
|
339
|
+
l.loading ? (c(), h("div", {
|
|
340
340
|
key: 1,
|
|
341
|
-
class: f(
|
|
342
|
-
}, [...
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
])], 2)) :
|
|
346
|
-
|
|
347
|
-
class: f(
|
|
348
|
-
style: L
|
|
341
|
+
class: g(f(i).e("loading"))
|
|
342
|
+
}, [...a[3] || (a[3] = [
|
|
343
|
+
y("span", { class: "loading-spinner" }, null, -1),
|
|
344
|
+
y("span", { class: "loading-text" }, "加载中...", -1)
|
|
345
|
+
])], 2)) : S("", !0),
|
|
346
|
+
y("div", {
|
|
347
|
+
class: g(f(i).e("wrapper")),
|
|
348
|
+
style: j(L.value)
|
|
349
349
|
}, [
|
|
350
|
-
|
|
351
|
-
l.showHeader ? (c(),
|
|
352
|
-
|
|
353
|
-
l.rowKey ? (c(),
|
|
350
|
+
y("table", null, [
|
|
351
|
+
l.showHeader ? (c(), h("thead", ze, [
|
|
352
|
+
y("tr", null, [
|
|
353
|
+
l.rowKey ? (c(), h("th", {
|
|
354
354
|
key: 0,
|
|
355
|
-
class:
|
|
355
|
+
class: g([f(i).e("header-cell"), f(i).e("selection-cell")])
|
|
356
356
|
}, [
|
|
357
|
-
|
|
357
|
+
y("input", {
|
|
358
358
|
type: "checkbox",
|
|
359
|
-
checked:
|
|
360
|
-
indeterminate:
|
|
361
|
-
onChange:
|
|
359
|
+
checked: M.value,
|
|
360
|
+
indeterminate: C.value,
|
|
361
|
+
onChange: z
|
|
362
362
|
}, null, 40, De)
|
|
363
|
-
], 2)) :
|
|
364
|
-
l.showIndex ? (c(),
|
|
363
|
+
], 2)) : S("", !0),
|
|
364
|
+
l.showIndex ? (c(), h("th", {
|
|
365
365
|
key: 1,
|
|
366
|
-
class: f(
|
|
366
|
+
class: g(f(i).e("header-cell")),
|
|
367
367
|
style: { width: "60px" }
|
|
368
|
-
}, " 序号 ", 2)) :
|
|
369
|
-
(c(!0),
|
|
370
|
-
key:
|
|
371
|
-
class:
|
|
372
|
-
style:
|
|
373
|
-
onClick: (
|
|
368
|
+
}, " 序号 ", 2)) : S("", !0),
|
|
369
|
+
(c(!0), h(R, null, U(l.columns, (d) => (c(), h("th", {
|
|
370
|
+
key: d.prop,
|
|
371
|
+
class: g([f(i).e("header-cell"), N(d)]),
|
|
372
|
+
style: j(O(d)),
|
|
373
|
+
onClick: (p) => K(d)
|
|
374
374
|
}, [
|
|
375
|
-
|
|
376
|
-
|
|
375
|
+
y("span", null, A(d.label), 1),
|
|
376
|
+
d.sortable ? (c(), h("span", {
|
|
377
377
|
key: 0,
|
|
378
|
-
class: f(
|
|
379
|
-
}, [...
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
])], 2)) :
|
|
383
|
-
], 14,
|
|
384
|
-
l.showOperation ? (c(),
|
|
378
|
+
class: g(f(i).e("sort-icon"))
|
|
379
|
+
}, [...a[4] || (a[4] = [
|
|
380
|
+
y("span", { class: "sort-arrow up" }, "▲", -1),
|
|
381
|
+
y("span", { class: "sort-arrow down" }, "▼", -1)
|
|
382
|
+
])], 2)) : S("", !0)
|
|
383
|
+
], 14, Ae))), 128)),
|
|
384
|
+
l.showOperation ? (c(), h("th", {
|
|
385
385
|
key: 2,
|
|
386
|
-
class: f(
|
|
387
|
-
style:
|
|
388
|
-
}, A(l.operationLabel), 7)) :
|
|
386
|
+
class: g(f(i).e("header-cell")),
|
|
387
|
+
style: j(w.value)
|
|
388
|
+
}, A(l.operationLabel), 7)) : S("", !0)
|
|
389
389
|
])
|
|
390
|
-
])) :
|
|
391
|
-
|
|
392
|
-
(c(!0),
|
|
393
|
-
key: l.rowKey ? typeof l.rowKey == "function" ? l.rowKey(
|
|
394
|
-
class:
|
|
395
|
-
onClick: (
|
|
390
|
+
])) : S("", !0),
|
|
391
|
+
y("tbody", null, [
|
|
392
|
+
(c(!0), h(R, null, U(T.value, (d, p) => (c(), h("tr", {
|
|
393
|
+
key: l.rowKey ? typeof l.rowKey == "function" ? l.rowKey(d) : d[l.rowKey] : p,
|
|
394
|
+
class: g([f(i).e("row"), f(i).is("selected", Z(d))]),
|
|
395
|
+
onClick: (m) => X(d, l.columns[0], m)
|
|
396
396
|
}, [
|
|
397
|
-
l.rowKey ? (c(),
|
|
397
|
+
l.rowKey ? (c(), h("td", {
|
|
398
398
|
key: 0,
|
|
399
|
-
class: f(
|
|
399
|
+
class: g(f(i).e("cell"))
|
|
400
400
|
}, [
|
|
401
|
-
|
|
401
|
+
y("input", {
|
|
402
402
|
type: "checkbox",
|
|
403
|
-
checked:
|
|
404
|
-
onClick:
|
|
403
|
+
checked: Z(d),
|
|
404
|
+
onClick: a[1] || (a[1] = de(() => {
|
|
405
405
|
}, ["stop"])),
|
|
406
|
-
onChange: (
|
|
407
|
-
}, null, 40,
|
|
408
|
-
], 2)) :
|
|
409
|
-
l.showIndex ? (c(),
|
|
406
|
+
onChange: (m) => W(d)
|
|
407
|
+
}, null, 40, Ee)
|
|
408
|
+
], 2)) : S("", !0),
|
|
409
|
+
l.showIndex ? (c(), h("td", {
|
|
410
410
|
key: 1,
|
|
411
|
-
class: f(
|
|
412
|
-
}, A(
|
|
413
|
-
(c(!0),
|
|
414
|
-
key:
|
|
415
|
-
class: f(
|
|
416
|
-
style:
|
|
417
|
-
onClick: (
|
|
411
|
+
class: g(f(i).e("cell"))
|
|
412
|
+
}, A(p + 1), 3)) : S("", !0),
|
|
413
|
+
(c(!0), h(R, null, U(l.columns, (m) => (c(), h("td", {
|
|
414
|
+
key: m.prop,
|
|
415
|
+
class: g(f(i).e("cell")),
|
|
416
|
+
style: j(O(m)),
|
|
417
|
+
onClick: (D) => E(d, m, D)
|
|
418
418
|
}, [
|
|
419
|
-
|
|
420
|
-
row:
|
|
421
|
-
column:
|
|
422
|
-
$index:
|
|
419
|
+
B(e.$slots, `column-${m.prop}`, {
|
|
420
|
+
row: d,
|
|
421
|
+
column: m,
|
|
422
|
+
$index: p
|
|
423
423
|
}, () => [
|
|
424
|
-
J(A(
|
|
424
|
+
J(A(V(d, m, p)), 1)
|
|
425
425
|
])
|
|
426
|
-
], 14,
|
|
427
|
-
l.showOperation ? (c(),
|
|
426
|
+
], 14, Le))), 128)),
|
|
427
|
+
l.showOperation ? (c(), h("td", {
|
|
428
428
|
key: 2,
|
|
429
|
-
class:
|
|
429
|
+
class: g([f(i).e("cell"), f(i).e("operation-cell")])
|
|
430
430
|
}, [
|
|
431
|
-
|
|
432
|
-
row:
|
|
433
|
-
$index:
|
|
434
|
-
deleteRow: () =>
|
|
431
|
+
B(e.$slots, "operation", {
|
|
432
|
+
row: d,
|
|
433
|
+
$index: p,
|
|
434
|
+
deleteRow: () => F(p)
|
|
435
435
|
}, () => [
|
|
436
|
-
|
|
437
|
-
class: f(
|
|
438
|
-
onClick:
|
|
439
|
-
}, " 删除 ", 10,
|
|
436
|
+
y("button", {
|
|
437
|
+
class: g(f(i).e("operation-btn")),
|
|
438
|
+
onClick: de((m) => F(p), ["stop"])
|
|
439
|
+
}, " 删除 ", 10, je)
|
|
440
440
|
])
|
|
441
|
-
], 2)) :
|
|
442
|
-
], 10,
|
|
441
|
+
], 2)) : S("", !0)
|
|
442
|
+
], 10, Te))), 128))
|
|
443
443
|
]),
|
|
444
|
-
T.value.length === 0 && !l.loading ? (c(),
|
|
445
|
-
|
|
446
|
-
|
|
444
|
+
T.value.length === 0 && !l.loading ? (c(), h("tbody", Be, [
|
|
445
|
+
y("tr", null, [
|
|
446
|
+
y("td", {
|
|
447
447
|
colspan: l.columns.length + (l.rowKey ? 1 : 0) + (l.showIndex ? 1 : 0) + (l.showOperation ? 1 : 0),
|
|
448
|
-
class: f(
|
|
448
|
+
class: g(f(i).e("empty"))
|
|
449
449
|
}, [
|
|
450
|
-
|
|
450
|
+
B(e.$slots, "empty", {}, () => [
|
|
451
451
|
J(A(l.emptyText), 1)
|
|
452
452
|
])
|
|
453
|
-
], 10,
|
|
453
|
+
], 10, He)
|
|
454
454
|
])
|
|
455
|
-
])) :
|
|
455
|
+
])) : S("", !0)
|
|
456
456
|
])
|
|
457
457
|
], 6)
|
|
458
458
|
], 2));
|
|
459
459
|
}
|
|
460
|
-
}),
|
|
460
|
+
}), Pe = ["draggable"], We = {
|
|
461
461
|
key: 0,
|
|
462
462
|
class: "x-tree-node__loading-icon"
|
|
463
|
-
},
|
|
463
|
+
}, Re = {
|
|
464
464
|
key: 0,
|
|
465
465
|
class: "x-tree-node__expand-arrow"
|
|
466
|
-
},
|
|
466
|
+
}, Oe = {
|
|
467
467
|
key: 0,
|
|
468
468
|
class: "x-tree-node__icon"
|
|
469
|
-
},
|
|
469
|
+
}, Ge = { class: "x-tree-node__label" }, Ye = /* @__PURE__ */ G({
|
|
470
470
|
name: "XTreeNode",
|
|
471
471
|
__name: "tree-node",
|
|
472
472
|
props: {
|
|
473
473
|
node: {}
|
|
474
474
|
},
|
|
475
475
|
setup(l) {
|
|
476
|
-
const
|
|
477
|
-
paddingLeft: `${
|
|
478
|
-
})),
|
|
479
|
-
k(
|
|
480
|
-
},
|
|
481
|
-
b(
|
|
482
|
-
},
|
|
483
|
-
|
|
484
|
-
},
|
|
485
|
-
|
|
486
|
-
}, Q = (
|
|
487
|
-
var
|
|
488
|
-
if (!(!
|
|
489
|
-
if (
|
|
490
|
-
|
|
476
|
+
const o = l, r = oe("tree"), { props: t, store: u, toggleExpand: i, toggleCheck: s, handleNodeClick: k, handleNodeContextmenu: b } = r, M = P(), C = P(null), T = x(() => o.node.expanded), L = x(() => o.node.checked), w = x(() => o.node.indeterminate), $ = x(() => o.node.disabled), K = x(() => o.node.loading), N = x(() => o.node.isLeaf), V = x(() => t.showCheckbox || t.checkable), X = x(() => o.node.selected), E = x(() => ({
|
|
477
|
+
paddingLeft: `${o.node.level * (t.indent || 16)}px`
|
|
478
|
+
})), z = (n) => {
|
|
479
|
+
k(o.node, n);
|
|
480
|
+
}, W = (n) => {
|
|
481
|
+
b(o.node, n);
|
|
482
|
+
}, Z = (n) => {
|
|
483
|
+
n.stopPropagation(), $.value || i(o.node);
|
|
484
|
+
}, O = (n) => {
|
|
485
|
+
n.stopPropagation(), $.value || s(o.node);
|
|
486
|
+
}, Q = (n) => {
|
|
487
|
+
var e;
|
|
488
|
+
if (!(!t.draggable || $.value)) {
|
|
489
|
+
if (t.allowDrag && !t.allowDrag(o.node)) {
|
|
490
|
+
n.preventDefault();
|
|
491
491
|
return;
|
|
492
492
|
}
|
|
493
|
-
|
|
493
|
+
n.dataTransfer.effectAllowed = "move", n.dataTransfer.setData("nodeKey", String(o.node.key)), (e = r.emit) == null || e.call(r, "node-drag-start", o.node, n);
|
|
494
494
|
}
|
|
495
|
-
},
|
|
496
|
-
var
|
|
497
|
-
|
|
498
|
-
}, _ = (
|
|
499
|
-
var
|
|
500
|
-
|
|
501
|
-
},
|
|
502
|
-
var
|
|
503
|
-
if (
|
|
504
|
-
const
|
|
505
|
-
if (!
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
},
|
|
509
|
-
var
|
|
510
|
-
if (
|
|
511
|
-
const
|
|
512
|
-
if (
|
|
513
|
-
const
|
|
514
|
-
if (
|
|
515
|
-
if (
|
|
516
|
-
|
|
495
|
+
}, F = (n) => {
|
|
496
|
+
var e;
|
|
497
|
+
n.preventDefault(), t.draggable && (C.value = "inner", (e = r.emit) == null || e.call(r, "node-drag-enter", o.node, n));
|
|
498
|
+
}, _ = (n) => {
|
|
499
|
+
var e;
|
|
500
|
+
C.value = null, (e = r.emit) == null || e.call(r, "node-drag-leave", o.node, n);
|
|
501
|
+
}, ae = (n) => {
|
|
502
|
+
var p, m;
|
|
503
|
+
if (n.preventDefault(), !t.draggable || $.value) return;
|
|
504
|
+
const e = (p = M.value) == null ? void 0 : p.getBoundingClientRect();
|
|
505
|
+
if (!e) return;
|
|
506
|
+
const a = n.clientY - e.top, d = e.height;
|
|
507
|
+
a < d * 0.25 ? C.value = "prev" : a > d * 0.75 ? C.value = "next" : C.value = "inner", (m = r.emit) == null || m.call(r, "node-drag-over", o.node, n);
|
|
508
|
+
}, v = (n) => {
|
|
509
|
+
var a, d;
|
|
510
|
+
if (n.preventDefault(), !t.draggable) return;
|
|
511
|
+
const e = (a = n.dataTransfer) == null ? void 0 : a.getData("nodeKey");
|
|
512
|
+
if (e) {
|
|
513
|
+
const p = u.nodesMap.get(e);
|
|
514
|
+
if (p && C.value) {
|
|
515
|
+
if (t.allowDrop && !t.allowDrop(p, o.node, C.value)) {
|
|
516
|
+
C.value = null;
|
|
517
517
|
return;
|
|
518
518
|
}
|
|
519
|
-
(
|
|
519
|
+
(d = r.emit) == null || d.call(r, "node-drop", p, o.node, C.value, n);
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
|
|
523
|
-
},
|
|
524
|
-
var
|
|
525
|
-
|
|
522
|
+
C.value = null;
|
|
523
|
+
}, I = (n) => {
|
|
524
|
+
var e;
|
|
525
|
+
C.value = null, (e = r.emit) == null || e.call(r, "node-drag-end", o.node, n);
|
|
526
526
|
};
|
|
527
|
-
return (
|
|
528
|
-
var
|
|
529
|
-
const
|
|
530
|
-
return
|
|
527
|
+
return (n, e) => {
|
|
528
|
+
var d;
|
|
529
|
+
const a = ye("TreeNode", !0);
|
|
530
|
+
return ve((c(), h("div", {
|
|
531
531
|
ref_key: "nodeRef",
|
|
532
|
-
ref:
|
|
533
|
-
class:
|
|
532
|
+
ref: M,
|
|
533
|
+
class: g(["x-tree-node", {
|
|
534
534
|
"is-expanded": T.value,
|
|
535
|
-
"is-current":
|
|
536
|
-
"is-selected":
|
|
537
|
-
"is-disabled":
|
|
538
|
-
"is-drop-inner":
|
|
539
|
-
"is-drop-prev":
|
|
540
|
-
"is-drop-next":
|
|
535
|
+
"is-current": n.isCurrent,
|
|
536
|
+
"is-selected": X.value,
|
|
537
|
+
"is-disabled": $.value,
|
|
538
|
+
"is-drop-inner": C.value === "inner",
|
|
539
|
+
"is-drop-prev": C.value === "prev",
|
|
540
|
+
"is-drop-next": C.value === "next"
|
|
541
541
|
}]),
|
|
542
|
-
draggable:
|
|
542
|
+
draggable: f(t).draggable && !$.value,
|
|
543
543
|
onDragstart: Q,
|
|
544
|
-
onDragenter:
|
|
544
|
+
onDragenter: F,
|
|
545
545
|
onDragleave: _,
|
|
546
|
-
onDragover:
|
|
547
|
-
onDrop:
|
|
548
|
-
onDragend:
|
|
546
|
+
onDragover: ae,
|
|
547
|
+
onDrop: v,
|
|
548
|
+
onDragend: I
|
|
549
549
|
}, [
|
|
550
|
-
|
|
550
|
+
y("div", {
|
|
551
551
|
class: "x-tree-node__content",
|
|
552
|
-
style:
|
|
553
|
-
onClick:
|
|
554
|
-
onContextmenu:
|
|
552
|
+
style: j(E.value),
|
|
553
|
+
onClick: z,
|
|
554
|
+
onContextmenu: W
|
|
555
555
|
}, [
|
|
556
|
-
|
|
557
|
-
class:
|
|
556
|
+
y("span", {
|
|
557
|
+
class: g(["x-tree-node__expand-icon", {
|
|
558
558
|
"is-expanded": T.value,
|
|
559
559
|
"is-leaf": N.value,
|
|
560
560
|
"is-loading": K.value
|
|
561
561
|
}]),
|
|
562
|
-
onClick:
|
|
562
|
+
onClick: Z
|
|
563
563
|
}, [
|
|
564
|
-
K.value ? (c(),
|
|
565
|
-
N.value ?
|
|
564
|
+
K.value ? (c(), h("span", We)) : (c(), h(R, { key: 1 }, [
|
|
565
|
+
N.value ? S("", !0) : (c(), h("span", Re))
|
|
566
566
|
], 64))
|
|
567
567
|
], 2),
|
|
568
|
-
l.node.icon ||
|
|
569
|
-
|
|
568
|
+
l.node.icon || f(t).icon ? (c(), h("span", Oe, A(l.node.icon || f(t).icon), 1)) : S("", !0),
|
|
569
|
+
V.value ? (c(), h("span", {
|
|
570
570
|
key: 1,
|
|
571
|
-
class:
|
|
572
|
-
"is-checked":
|
|
573
|
-
"is-indeterminate":
|
|
574
|
-
"is-disabled":
|
|
571
|
+
class: g(["x-tree-node__checkbox", {
|
|
572
|
+
"is-checked": L.value,
|
|
573
|
+
"is-indeterminate": w.value,
|
|
574
|
+
"is-disabled": $.value
|
|
575
575
|
}]),
|
|
576
|
-
onClick:
|
|
577
|
-
}, [...
|
|
578
|
-
|
|
579
|
-
])], 2)) :
|
|
580
|
-
|
|
581
|
-
|
|
576
|
+
onClick: de(O, ["stop"])
|
|
577
|
+
}, [...e[0] || (e[0] = [
|
|
578
|
+
y("span", { class: "x-tree-node__checkbox-inner" }, null, -1)
|
|
579
|
+
])], 2)) : S("", !0),
|
|
580
|
+
y("span", Ge, [
|
|
581
|
+
B(n.$slots, "default", {
|
|
582
582
|
node: l.node,
|
|
583
583
|
data: l.node.data
|
|
584
584
|
}, () => [
|
|
@@ -586,71 +586,71 @@ const ft = /* @__PURE__ */ O({
|
|
|
586
586
|
])
|
|
587
587
|
])
|
|
588
588
|
], 36),
|
|
589
|
-
!N.value && T.value ? (c(),
|
|
589
|
+
!N.value && T.value ? (c(), h("div", {
|
|
590
590
|
key: 0,
|
|
591
|
-
class:
|
|
591
|
+
class: g(["x-tree-node__children", { "x-tree-node__children--show-line": f(t).showLine }])
|
|
592
592
|
}, [
|
|
593
|
-
!
|
|
594
|
-
key:
|
|
595
|
-
node:
|
|
593
|
+
!f(t).renderAfterExpand || T.value ? (c(!0), h(R, { key: 0 }, U(l.node.children, (p) => (c(), se(a, {
|
|
594
|
+
key: p.key,
|
|
595
|
+
node: p
|
|
596
596
|
}, {
|
|
597
|
-
default:
|
|
598
|
-
|
|
599
|
-
node:
|
|
600
|
-
data:
|
|
597
|
+
default: he((m) => [
|
|
598
|
+
B(n.$slots, "default", {
|
|
599
|
+
node: m.node,
|
|
600
|
+
data: m.data
|
|
601
601
|
})
|
|
602
602
|
]),
|
|
603
603
|
_: 3
|
|
604
|
-
}, 8, ["node"]))), 128)) :
|
|
605
|
-
], 2)) :
|
|
606
|
-
], 42,
|
|
607
|
-
[
|
|
604
|
+
}, 8, ["node"]))), 128)) : S("", !0)
|
|
605
|
+
], 2)) : S("", !0)
|
|
606
|
+
], 42, Pe)), [
|
|
607
|
+
[me, l.node.visible && (((d = l.node.parent) == null ? void 0 : d.expanded) ?? !0)]
|
|
608
608
|
]);
|
|
609
609
|
};
|
|
610
610
|
}
|
|
611
611
|
});
|
|
612
612
|
class te {
|
|
613
|
-
constructor(
|
|
614
|
-
this.data =
|
|
615
|
-
const
|
|
616
|
-
this.key = s
|
|
617
|
-
const
|
|
613
|
+
constructor(o, r, t = 0, u = null) {
|
|
614
|
+
this.data = o, this.store = r, this.level = t, this.parent = u, this.children = [], this.expanded = !1, this.selected = !1, this.checked = !1, this.indeterminate = !1, this.loading = !1, this.visible = !0, this.loaded = !1;
|
|
615
|
+
const i = r.props || {}, s = i.value || "value", k = i.label || "label", b = i.disabled || "disabled", M = i.isLeaf || "isLeaf";
|
|
616
|
+
this.key = o[s] ?? o.value ?? o.id ?? Math.random().toString(), this.label = o[k] ?? o.label ?? "", this.disabled = o[b] ?? o.disabled ?? !1, this.isLeaf = o[M] ?? o.isLeaf ?? !1;
|
|
617
|
+
const C = i.children || "children", T = o[C] ?? o.children ?? [];
|
|
618
618
|
T.length > 0 ? this.children = T.map(
|
|
619
|
-
(
|
|
619
|
+
(L) => new te(L, r, t + 1, this)
|
|
620
620
|
) : this.isLeaf = !0;
|
|
621
621
|
}
|
|
622
622
|
/** 设置展开状态 */
|
|
623
|
-
setExpanded(
|
|
624
|
-
this.expanded =
|
|
623
|
+
setExpanded(o, r = !0) {
|
|
624
|
+
this.expanded = o, o ? this.store.expandedKeys.add(this.key) : this.store.expandedKeys.delete(this.key);
|
|
625
625
|
}
|
|
626
626
|
/** 设置选中状态 */
|
|
627
|
-
setSelected(
|
|
628
|
-
this.selected =
|
|
627
|
+
setSelected(o) {
|
|
628
|
+
this.selected = o, o ? this.store.selectedKeys.add(this.key) : this.store.selectedKeys.delete(this.key);
|
|
629
629
|
}
|
|
630
630
|
/** 设置勾选状态 */
|
|
631
|
-
setChecked(
|
|
632
|
-
this.checked =
|
|
631
|
+
setChecked(o, r = !0, t = !0) {
|
|
632
|
+
this.checked = o, this.indeterminate = !1, o ? (this.store.checkedKeys.add(this.key), this.store.indeterminateKeys.delete(this.key)) : (this.store.checkedKeys.delete(this.key), this.store.indeterminateKeys.delete(this.key)), r && (this.updateChildrenChecked(o), this.updateParentChecked());
|
|
633
633
|
}
|
|
634
634
|
/** 更新子节点勾选状态 */
|
|
635
|
-
updateChildrenChecked(
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
|
|
635
|
+
updateChildrenChecked(o) {
|
|
636
|
+
const r = (t) => {
|
|
637
|
+
t.children.forEach((u) => {
|
|
638
|
+
u.disabled || (u.checked = o, u.indeterminate = !1, o ? (this.store.checkedKeys.add(u.key), this.store.indeterminateKeys.delete(u.key)) : (this.store.checkedKeys.delete(u.key), this.store.indeterminateKeys.delete(u.key)), r(u));
|
|
639
639
|
});
|
|
640
640
|
};
|
|
641
|
-
|
|
641
|
+
r(this);
|
|
642
642
|
}
|
|
643
643
|
/** 更新父节点勾选状态 */
|
|
644
644
|
updateParentChecked() {
|
|
645
|
-
let
|
|
646
|
-
for (;
|
|
647
|
-
const
|
|
648
|
-
if (
|
|
649
|
-
|
|
645
|
+
let o = this.parent;
|
|
646
|
+
for (; o; ) {
|
|
647
|
+
const r = o.children.filter((i) => !i.disabled);
|
|
648
|
+
if (r.length === 0) {
|
|
649
|
+
o = o.parent;
|
|
650
650
|
continue;
|
|
651
651
|
}
|
|
652
|
-
const
|
|
653
|
-
|
|
652
|
+
const t = r.every((i) => i.checked), u = r.some((i) => i.checked || i.indeterminate);
|
|
653
|
+
t ? (o.checked = !0, o.indeterminate = !1, this.store.checkedKeys.add(o.key), this.store.indeterminateKeys.delete(o.key)) : u ? (o.checked = !1, o.indeterminate = !0, this.store.checkedKeys.delete(o.key), this.store.indeterminateKeys.add(o.key)) : (o.checked = !1, o.indeterminate = !1, this.store.checkedKeys.delete(o.key), this.store.indeterminateKeys.delete(o.key)), o = o.parent;
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
656
|
/** 展开/收起 */
|
|
@@ -667,23 +667,23 @@ class te {
|
|
|
667
667
|
}
|
|
668
668
|
/** 获取所有父节点的 key */
|
|
669
669
|
getParentKeys() {
|
|
670
|
-
const
|
|
671
|
-
let
|
|
672
|
-
for (;
|
|
673
|
-
|
|
674
|
-
return
|
|
670
|
+
const o = [];
|
|
671
|
+
let r = this.parent;
|
|
672
|
+
for (; r; )
|
|
673
|
+
o.push(r.key), r = r.parent;
|
|
674
|
+
return o;
|
|
675
675
|
}
|
|
676
676
|
/** 获取所有子节点的 key */
|
|
677
677
|
getChildrenKeys() {
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
678
|
+
const o = [], r = (t) => {
|
|
679
|
+
t.forEach((u) => {
|
|
680
|
+
o.push(u.key), u.children.length && r(u.children);
|
|
681
681
|
});
|
|
682
682
|
};
|
|
683
|
-
return
|
|
683
|
+
return r(this.children), o;
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
|
-
const
|
|
686
|
+
const mt = /* @__PURE__ */ G({
|
|
687
687
|
name: "XTree",
|
|
688
688
|
__name: "index",
|
|
689
689
|
props: {
|
|
@@ -724,8 +724,8 @@ const vt = /* @__PURE__ */ O({
|
|
|
724
724
|
checkable: { type: Boolean }
|
|
725
725
|
},
|
|
726
726
|
emits: ["node-click", "node-contextmenu", "check-change", "check", "current-change", "node-expand", "node-collapse", "node-drag-start", "node-drag-enter", "node-drag-leave", "node-drag-over", "node-drag-end", "node-drop"],
|
|
727
|
-
setup(l, { expose:
|
|
728
|
-
const
|
|
727
|
+
setup(l, { expose: o, emit: r }) {
|
|
728
|
+
const t = l, u = r, i = Y("tree"), s = fe({
|
|
729
729
|
nodesMap: /* @__PURE__ */ new Map(),
|
|
730
730
|
rootNodes: [],
|
|
731
731
|
expandedKeys: /* @__PURE__ */ new Set(),
|
|
@@ -734,258 +734,258 @@ const vt = /* @__PURE__ */ O({
|
|
|
734
734
|
indeterminateKeys: /* @__PURE__ */ new Set(),
|
|
735
735
|
currentKey: null,
|
|
736
736
|
filterValue: ""
|
|
737
|
-
}), k =
|
|
738
|
-
value:
|
|
739
|
-
label:
|
|
740
|
-
children:
|
|
741
|
-
disabled:
|
|
742
|
-
isLeaf:
|
|
743
|
-
} :
|
|
744
|
-
|
|
745
|
-
const
|
|
746
|
-
if (
|
|
747
|
-
const
|
|
748
|
-
const
|
|
749
|
-
|
|
750
|
-
const
|
|
751
|
-
return
|
|
752
|
-
(
|
|
753
|
-
),
|
|
737
|
+
}), k = P(""), b = () => t.fieldNames ? {
|
|
738
|
+
value: t.fieldNames.key || "value",
|
|
739
|
+
label: t.fieldNames.title || t.fieldNames.key || "label",
|
|
740
|
+
children: t.fieldNames.children || "children",
|
|
741
|
+
disabled: t.fieldNames.disabled || "disabled",
|
|
742
|
+
isLeaf: t.fieldNames.isLeaf || "isLeaf"
|
|
743
|
+
} : t.props, M = () => t.treeData || t.data || [];
|
|
744
|
+
s.props = b();
|
|
745
|
+
const C = (n) => {
|
|
746
|
+
if (s.nodesMap.clear(), s.rootNodes = [], s.checkedKeys.clear(), s.indeterminateKeys.clear(), !n || !n.length) return;
|
|
747
|
+
const e = b(), a = (d, p, m) => {
|
|
748
|
+
const D = new te(d, s, p, m);
|
|
749
|
+
s.nodesMap.set(D.key, D);
|
|
750
|
+
const H = (e == null ? void 0 : e.children) || "children", ee = d[H] ?? d.children ?? [];
|
|
751
|
+
return ee.length > 0 && (D.children = ee.map(
|
|
752
|
+
(ne) => a(ne, p + 1, D)
|
|
753
|
+
), D.isLeaf = !1), D;
|
|
754
754
|
};
|
|
755
|
-
|
|
755
|
+
s.rootNodes = n.map((d) => a(d, 0, null)), T();
|
|
756
756
|
}, T = () => {
|
|
757
|
-
var
|
|
758
|
-
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
}), (
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
}), (
|
|
765
|
-
const
|
|
766
|
-
|
|
757
|
+
var n, e, a;
|
|
758
|
+
t.defaultExpandAll ? L() : (n = t.defaultExpandedKeys) != null && n.length && t.defaultExpandedKeys.forEach((d) => {
|
|
759
|
+
const p = s.nodesMap.get(d);
|
|
760
|
+
p && (p.expanded = !0, s.expandedKeys.add(d));
|
|
761
|
+
}), (e = t.defaultCheckedKeys) != null && e.length && t.defaultCheckedKeys.forEach((d) => {
|
|
762
|
+
const p = s.nodesMap.get(d);
|
|
763
|
+
p && p.setChecked(!0, !t.checkStrictly);
|
|
764
|
+
}), (a = t.checkedKeys) != null && a.length && t.checkedKeys.forEach((d) => {
|
|
765
|
+
const p = s.nodesMap.get(d);
|
|
766
|
+
p && p.setChecked(!0, !t.checkStrictly);
|
|
767
767
|
});
|
|
768
|
-
},
|
|
769
|
-
|
|
770
|
-
|
|
768
|
+
}, L = () => {
|
|
769
|
+
s.nodesMap.forEach((n) => {
|
|
770
|
+
n.children.length > 0 && (n.expanded = !0, s.expandedKeys.add(n.key));
|
|
771
771
|
});
|
|
772
|
-
},
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}),
|
|
776
|
-
},
|
|
777
|
-
if (
|
|
778
|
-
!
|
|
779
|
-
}, K = (
|
|
780
|
-
if (
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
}),
|
|
787
|
-
checkedNodes:
|
|
788
|
-
checkedKeys:
|
|
789
|
-
halfCheckedNodes:
|
|
790
|
-
halfCheckedKeys:
|
|
772
|
+
}, w = () => {
|
|
773
|
+
s.nodesMap.forEach((n) => {
|
|
774
|
+
n.expanded = !1;
|
|
775
|
+
}), s.expandedKeys.clear();
|
|
776
|
+
}, $ = (n) => {
|
|
777
|
+
if (n.disabled) return;
|
|
778
|
+
!n.expanded ? (n.expanded = !0, s.expandedKeys.add(n.key), u("node-expand", n.data, n, null)) : (n.expanded = !1, s.expandedKeys.delete(n.key), u("node-collapse", n.data, n, null));
|
|
779
|
+
}, K = (n, e) => {
|
|
780
|
+
if (n.disabled) return;
|
|
781
|
+
const a = e ?? !n.checked;
|
|
782
|
+
n.setChecked(a, !t.checkStrictly), u("check-change", n.data, n.checked, n.indeterminate);
|
|
783
|
+
const d = [], p = [], m = [], D = [];
|
|
784
|
+
s.nodesMap.forEach((H) => {
|
|
785
|
+
H.checked && (d.push(H.data), p.push(H.key)), H.indeterminate && (m.push(H.data), D.push(H.key));
|
|
786
|
+
}), u("check", n.data, {
|
|
787
|
+
checkedNodes: d,
|
|
788
|
+
checkedKeys: p,
|
|
789
|
+
halfCheckedNodes: m,
|
|
790
|
+
halfCheckedKeys: D
|
|
791
791
|
});
|
|
792
|
-
}, N = (
|
|
793
|
-
|
|
794
|
-
},
|
|
795
|
-
if (k.value =
|
|
796
|
-
|
|
797
|
-
|
|
792
|
+
}, N = (n, e) => {
|
|
793
|
+
n.disabled || (u("node-click", n.data, n, null), t.expandOnClickNode && n.children.length > 0 && $(n), t.highlightCurrent && (s.currentKey = n.key, u("current-change", n.data, n)));
|
|
794
|
+
}, V = (n) => {
|
|
795
|
+
if (k.value = n, s.filterValue = n, !n) {
|
|
796
|
+
s.nodesMap.forEach((e) => {
|
|
797
|
+
e.visible = !0;
|
|
798
798
|
});
|
|
799
799
|
return;
|
|
800
800
|
}
|
|
801
|
-
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
}),
|
|
805
|
-
if (
|
|
806
|
-
let
|
|
807
|
-
for (;
|
|
808
|
-
|
|
801
|
+
s.nodesMap.forEach((e) => {
|
|
802
|
+
const a = e.label || "";
|
|
803
|
+
e.visible = String(a).toLowerCase().includes(n.toLowerCase());
|
|
804
|
+
}), s.nodesMap.forEach((e) => {
|
|
805
|
+
if (e.visible && e.parent) {
|
|
806
|
+
let a = e.parent;
|
|
807
|
+
for (; a; )
|
|
808
|
+
a.visible = !0, a.expanded = !0, s.expandedKeys.add(a.key), a = a.parent;
|
|
809
809
|
}
|
|
810
810
|
});
|
|
811
|
-
},
|
|
812
|
-
|
|
813
|
-
},
|
|
814
|
-
if (
|
|
815
|
-
return
|
|
816
|
-
},
|
|
817
|
-
const
|
|
818
|
-
return
|
|
819
|
-
|
|
820
|
-
}),
|
|
821
|
-
},
|
|
822
|
-
const
|
|
823
|
-
return
|
|
824
|
-
|
|
825
|
-
}),
|
|
826
|
-
},
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
}),
|
|
830
|
-
const
|
|
831
|
-
|
|
811
|
+
}, X = (n) => s.nodesMap.get(n), E = (n) => {
|
|
812
|
+
s.currentKey = n;
|
|
813
|
+
}, z = () => {
|
|
814
|
+
if (s.currentKey)
|
|
815
|
+
return s.nodesMap.get(s.currentKey);
|
|
816
|
+
}, W = (n = !1) => {
|
|
817
|
+
const e = [];
|
|
818
|
+
return s.nodesMap.forEach((a) => {
|
|
819
|
+
a.checked && (!n || a.isLeaf) && e.push(a.data);
|
|
820
|
+
}), e;
|
|
821
|
+
}, Z = (n = !1) => {
|
|
822
|
+
const e = [];
|
|
823
|
+
return s.nodesMap.forEach((a) => {
|
|
824
|
+
a.checked && (!n || a.isLeaf) && e.push(a.key);
|
|
825
|
+
}), e;
|
|
826
|
+
}, O = (n) => {
|
|
827
|
+
s.nodesMap.forEach((e) => {
|
|
828
|
+
e.checked = !1, e.indeterminate = !1;
|
|
829
|
+
}), s.checkedKeys.clear(), s.indeterminateKeys.clear(), n.forEach((e) => {
|
|
830
|
+
const a = s.nodesMap.get(e);
|
|
831
|
+
a && a.setChecked(!0, !t.checkStrictly);
|
|
832
832
|
});
|
|
833
833
|
}, Q = () => {
|
|
834
|
-
const
|
|
835
|
-
return
|
|
836
|
-
|
|
837
|
-
}),
|
|
838
|
-
},
|
|
839
|
-
const
|
|
840
|
-
return
|
|
841
|
-
|
|
842
|
-
}),
|
|
843
|
-
}, _ = (
|
|
844
|
-
const
|
|
845
|
-
|
|
846
|
-
},
|
|
847
|
-
const
|
|
848
|
-
return
|
|
849
|
-
|
|
850
|
-
}),
|
|
851
|
-
},
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
}),
|
|
855
|
-
const
|
|
856
|
-
|
|
834
|
+
const n = [];
|
|
835
|
+
return s.nodesMap.forEach((e) => {
|
|
836
|
+
e.indeterminate && n.push(e.data);
|
|
837
|
+
}), n;
|
|
838
|
+
}, F = () => {
|
|
839
|
+
const n = [];
|
|
840
|
+
return s.nodesMap.forEach((e) => {
|
|
841
|
+
e.indeterminate && n.push(e.key);
|
|
842
|
+
}), n;
|
|
843
|
+
}, _ = (n, e, a = !0) => {
|
|
844
|
+
const d = s.nodesMap.get(n);
|
|
845
|
+
d && d.setChecked(e, a && !t.checkStrictly);
|
|
846
|
+
}, ae = () => {
|
|
847
|
+
const n = [];
|
|
848
|
+
return s.nodesMap.forEach((e) => {
|
|
849
|
+
e.selected && n.push(e.data);
|
|
850
|
+
}), n;
|
|
851
|
+
}, v = (n) => {
|
|
852
|
+
s.nodesMap.forEach((e) => {
|
|
853
|
+
e.selected = !1;
|
|
854
|
+
}), s.selectedKeys.clear(), n.forEach((e) => {
|
|
855
|
+
const a = s.nodesMap.get(e);
|
|
856
|
+
a && (a.selected = !0, s.selectedKeys.add(e));
|
|
857
857
|
});
|
|
858
|
-
},
|
|
859
|
-
return
|
|
860
|
-
props:
|
|
861
|
-
store:
|
|
862
|
-
emit:
|
|
863
|
-
toggleExpand:
|
|
858
|
+
}, I = x(() => t.showCheckbox || t.checkable);
|
|
859
|
+
return le("tree", {
|
|
860
|
+
props: t,
|
|
861
|
+
store: s,
|
|
862
|
+
emit: u,
|
|
863
|
+
toggleExpand: $,
|
|
864
864
|
toggleCheck: K,
|
|
865
865
|
handleNodeClick: N,
|
|
866
|
-
filterValue:
|
|
867
|
-
showCheckboxComputed:
|
|
868
|
-
}),
|
|
869
|
-
filter:
|
|
870
|
-
getNode:
|
|
866
|
+
filterValue: ke(k),
|
|
867
|
+
showCheckboxComputed: I
|
|
868
|
+
}), o({
|
|
869
|
+
filter: V,
|
|
870
|
+
getNode: X,
|
|
871
871
|
setCurrentKey: E,
|
|
872
|
-
getCurrentKey: () =>
|
|
873
|
-
getCurrentNode:
|
|
874
|
-
getCheckedNodes:
|
|
875
|
-
getCheckedKeys:
|
|
876
|
-
setCheckedKeys:
|
|
872
|
+
getCurrentKey: () => s.currentKey,
|
|
873
|
+
getCurrentNode: z,
|
|
874
|
+
getCheckedNodes: W,
|
|
875
|
+
getCheckedKeys: Z,
|
|
876
|
+
setCheckedKeys: O,
|
|
877
877
|
getHalfCheckedNodes: Q,
|
|
878
|
-
getHalfCheckedKeys:
|
|
878
|
+
getHalfCheckedKeys: F,
|
|
879
879
|
setChecked: _,
|
|
880
|
-
getSelectedNodes:
|
|
881
|
-
setSelectedKeys:
|
|
882
|
-
expandAll:
|
|
883
|
-
collapseAll:
|
|
880
|
+
getSelectedNodes: ae,
|
|
881
|
+
setSelectedKeys: v,
|
|
882
|
+
expandAll: L,
|
|
883
|
+
collapseAll: w,
|
|
884
884
|
// 额外方法
|
|
885
|
-
updateKeyChildren: (
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
}),
|
|
890
|
-
const
|
|
891
|
-
return
|
|
892
|
-
}),
|
|
885
|
+
updateKeyChildren: (n, e) => {
|
|
886
|
+
const a = s.nodesMap.get(n);
|
|
887
|
+
a && (a.children.forEach((d) => {
|
|
888
|
+
s.nodesMap.delete(d.key);
|
|
889
|
+
}), a.children = e.map((d) => {
|
|
890
|
+
const p = new te(d, s, a.level + 1, a);
|
|
891
|
+
return s.nodesMap.set(p.key, p), p;
|
|
892
|
+
}), a.isLeaf = a.children.length === 0);
|
|
893
893
|
},
|
|
894
|
-
remove: (
|
|
895
|
-
const
|
|
896
|
-
if (
|
|
897
|
-
const
|
|
898
|
-
if (
|
|
899
|
-
const
|
|
900
|
-
|
|
894
|
+
remove: (n) => {
|
|
895
|
+
const e = s.nodesMap.get(n);
|
|
896
|
+
if (e) {
|
|
897
|
+
const a = e.parent;
|
|
898
|
+
if (a) {
|
|
899
|
+
const p = a.children.indexOf(e);
|
|
900
|
+
p > -1 && a.children.splice(p, 1), a.children.length === 0 && (a.isLeaf = !0);
|
|
901
901
|
} else {
|
|
902
|
-
const
|
|
903
|
-
|
|
902
|
+
const p = s.rootNodes.indexOf(e);
|
|
903
|
+
p > -1 && s.rootNodes.splice(p, 1);
|
|
904
904
|
}
|
|
905
|
-
const
|
|
906
|
-
|
|
905
|
+
const d = (p) => {
|
|
906
|
+
s.nodesMap.delete(p.key), p.children.forEach(d);
|
|
907
907
|
};
|
|
908
|
-
|
|
908
|
+
d(e);
|
|
909
909
|
}
|
|
910
910
|
},
|
|
911
|
-
append: (
|
|
912
|
-
if (
|
|
913
|
-
const
|
|
914
|
-
if (
|
|
915
|
-
const
|
|
916
|
-
|
|
911
|
+
append: (n, e) => {
|
|
912
|
+
if (e) {
|
|
913
|
+
const a = s.nodesMap.get(e);
|
|
914
|
+
if (a) {
|
|
915
|
+
const d = new te(n, s, a.level + 1, a);
|
|
916
|
+
s.nodesMap.set(d.key, d), a.children.push(d), a.isLeaf = !1;
|
|
917
917
|
}
|
|
918
918
|
} else {
|
|
919
|
-
const
|
|
920
|
-
|
|
919
|
+
const a = new te(n, s, 0, null);
|
|
920
|
+
s.nodesMap.set(a.key, a), s.rootNodes.push(a);
|
|
921
921
|
}
|
|
922
922
|
},
|
|
923
|
-
insertBefore: (
|
|
924
|
-
var
|
|
925
|
-
const
|
|
926
|
-
if (
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
const
|
|
930
|
-
|
|
923
|
+
insertBefore: (n, e) => {
|
|
924
|
+
var d;
|
|
925
|
+
const a = s.nodesMap.get(e);
|
|
926
|
+
if (a) {
|
|
927
|
+
const p = new te(n, s, a.level, a.parent);
|
|
928
|
+
s.nodesMap.set(p.key, p);
|
|
929
|
+
const m = ((d = a.parent) == null ? void 0 : d.children) || s.rootNodes, D = m.indexOf(a);
|
|
930
|
+
m.splice(D, 0, p);
|
|
931
931
|
}
|
|
932
932
|
},
|
|
933
|
-
insertAfter: (
|
|
934
|
-
var
|
|
935
|
-
const
|
|
936
|
-
if (
|
|
937
|
-
const
|
|
938
|
-
|
|
939
|
-
const
|
|
940
|
-
|
|
933
|
+
insertAfter: (n, e) => {
|
|
934
|
+
var d;
|
|
935
|
+
const a = s.nodesMap.get(e);
|
|
936
|
+
if (a) {
|
|
937
|
+
const p = new te(n, s, a.level, a.parent);
|
|
938
|
+
s.nodesMap.set(p.key, p);
|
|
939
|
+
const m = ((d = a.parent) == null ? void 0 : d.children) || s.rootNodes, D = m.indexOf(a);
|
|
940
|
+
m.splice(D + 1, 0, p);
|
|
941
941
|
}
|
|
942
942
|
}
|
|
943
|
-
}),
|
|
944
|
-
() => [
|
|
943
|
+
}), q(
|
|
944
|
+
() => [t.treeData, t.data],
|
|
945
945
|
() => {
|
|
946
|
-
|
|
946
|
+
C(M());
|
|
947
947
|
},
|
|
948
948
|
{ immediate: !0, deep: !0 }
|
|
949
|
-
),
|
|
950
|
-
() =>
|
|
951
|
-
(
|
|
952
|
-
|
|
949
|
+
), q(
|
|
950
|
+
() => t.checkedKeys,
|
|
951
|
+
(n) => {
|
|
952
|
+
n && O(n);
|
|
953
953
|
},
|
|
954
954
|
{ immediate: !0, deep: !0 }
|
|
955
|
-
),
|
|
956
|
-
() =>
|
|
957
|
-
(
|
|
958
|
-
|
|
955
|
+
), q(
|
|
956
|
+
() => t.defaultCheckedKeys,
|
|
957
|
+
(n) => {
|
|
958
|
+
n && n.length > 0 && !t.checkedKeys && O(n);
|
|
959
959
|
},
|
|
960
960
|
{ immediate: !0, deep: !0 }
|
|
961
|
-
), (
|
|
962
|
-
class:
|
|
961
|
+
), (n, e) => (c(), h("div", {
|
|
962
|
+
class: g([f(i).b(), f(i).m(l.size)])
|
|
963
963
|
}, [
|
|
964
|
-
(c(!0),
|
|
965
|
-
key:
|
|
966
|
-
node:
|
|
964
|
+
(c(!0), h(R, null, U(s.rootNodes, (a) => (c(), se(Ye, {
|
|
965
|
+
key: a.key,
|
|
966
|
+
node: a
|
|
967
967
|
}, {
|
|
968
|
-
default:
|
|
969
|
-
|
|
970
|
-
node:
|
|
971
|
-
data:
|
|
968
|
+
default: he((d) => [
|
|
969
|
+
B(n.$slots, "default", {
|
|
970
|
+
node: d.node,
|
|
971
|
+
data: d.data
|
|
972
972
|
}, () => [
|
|
973
|
-
J(A(
|
|
973
|
+
J(A(d.node.label), 1)
|
|
974
974
|
])
|
|
975
975
|
]),
|
|
976
976
|
_: 2
|
|
977
977
|
}, 1032, ["node"]))), 128)),
|
|
978
|
-
|
|
978
|
+
s.rootNodes.length ? S("", !0) : (c(), h("div", {
|
|
979
979
|
key: 0,
|
|
980
|
-
class: f(
|
|
980
|
+
class: g(f(i).e("empty"))
|
|
981
981
|
}, [
|
|
982
|
-
|
|
982
|
+
B(n.$slots, "empty", {}, () => [
|
|
983
983
|
J(A(l.emptyText), 1)
|
|
984
984
|
])
|
|
985
985
|
], 2))
|
|
986
986
|
], 2));
|
|
987
987
|
}
|
|
988
|
-
}),
|
|
988
|
+
}), Xe = ["src"], Qe = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTg0IiBoZWlnaHQ9IjE1MiIgdmlld0JveD0iMCAwIDE4NCAxNTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI0IDMxLjY3KSI+CiAgICAgIDxlbGxpcHNlIGZpbGwtb3BhY2l0eT0iLjgiIGZpbGw9IiNGNUY1RjciIGN4PSI2Ny43OTciIGN5PSIxMDYuODkiIHJ4PSI2Ny43OTciIHJ5PSIxMi42NjgiLz4KICAgICAgPHBhdGggZD0iTTEyMi4wMzQgNjkuNjc0TDk5LjM5NCA0OC4xNjJsMCAyMS41MTYgMjIuNjQgMjIuNjQ0IDAtMjIuNjQ0em0tMjIuNjQgMjIuNjQ0TDc2Ljk5OCA3MC43OThsMCAyMS41MTYgMjIuMzk2IDIyLjM5NiAwLTIyLjM5NnoiIGZpbGw9IiNFRkVGRkYiLz4KICAgICAgPHBhdGggZD0iTTk5LjM5NCA0OC4xNjJsLTIyLjM5NiAyMi42MzYgMjIuMzk2IDIxLjUyIDAtNDQuMTU2eiIgZmlsbD0iI0YyRjZGQyIvPgogICAgICA8cGF0aCBkPSJNMTIxLjk3OCA2OS42NzRMOTkuMzk0IDkyLjI1OGwzLjE2OCAzLjE2OCAyMi41ODQtMjIuNTg0LTMuMTY4LTMuMTY4eiIgZmlsbD0iI0M3Q0NEQyIvPgogICAgICA8cGF0aCBkPSJNOTkuMzk0IDkyLjI1OEw3Ni44MSA2OS42NzRsMy4xNjgtMy4xNjggMjIuNTg0IDIyLjU4NC0zLjE2OCAzLjE2OHoiIGZpbGw9IiNDN0NEREMiLz4KICAgIDwvZz4KICAgIDxwYXRoIGQ9Ik0xNDcuODU3IDMxLjY3bC0zLjI5Mi0zLjI5MmEyLjUgMi41IDAgMCAwLTMuNTM2IDBsLTEzLjQ2IDEzLjQ2YTMuNSAzLjUgMCAwIDAgMCA0Ljk1bDMuMjkzIDMuMjkyYTMuNSAzLjUgMCAwIDAgNC45NSAwbDEzLjQ2LTEzLjQ2YTIuNSAyLjUgMCAwIDAgMC0zLjUzNnoiIGZpbGw9IiNENkRCRUMiLz4KICAgIDxwYXRoIGQ9Ik0zNi4xNDMgMzEuNjdsMy4yOTItMy4yOTJhMi41IDIuNSAwIDAgMSAzLjUzNiAwbDEzLjQ2IDEzLjQ2YTMuNSAzLjUgMCAwIDEgMCA0Ljk1bC0zLjI5MyAzLjI5MmEzLjUgMy41IDAgMCAxLTQuOTUgMEwzNi4xNDMgMzUuMmEyLjUgMi41IDAgMCAxIDAtMy41MzZ6IiBmaWxsPSIjRDZEQkVDIi8+CiAgICA8Y2lyY2xlIGZpbGw9IiNFQUVFRjQiIGN4PSI5MiIgY3k9IjgiIHI9IjgiLz4KICA8L2c+Cjwvc3ZnPg==", kt = /* @__PURE__ */ G({
|
|
989
989
|
name: "XEmpty",
|
|
990
990
|
__name: "index",
|
|
991
991
|
props: {
|
|
@@ -995,69 +995,69 @@ const vt = /* @__PURE__ */ O({
|
|
|
995
995
|
size: { default: "default" }
|
|
996
996
|
},
|
|
997
997
|
setup(l) {
|
|
998
|
-
const
|
|
999
|
-
const
|
|
1000
|
-
return
|
|
1001
|
-
}),
|
|
1002
|
-
return (
|
|
1003
|
-
class:
|
|
998
|
+
const o = l, r = Y("empty"), t = x(() => {
|
|
999
|
+
const i = {};
|
|
1000
|
+
return o.imageSize && (i.height = `${o.imageSize}px`, i.width = `${o.imageSize}px`), i;
|
|
1001
|
+
}), u = x(() => o.description || "暂无数据");
|
|
1002
|
+
return (i, s) => (c(), h("div", {
|
|
1003
|
+
class: g([f(r).b(), f(r).m(l.size)])
|
|
1004
1004
|
}, [
|
|
1005
|
-
|
|
1006
|
-
class: f(
|
|
1007
|
-
style:
|
|
1005
|
+
y("div", {
|
|
1006
|
+
class: g(f(r).e("image")),
|
|
1007
|
+
style: j(t.value)
|
|
1008
1008
|
}, [
|
|
1009
|
-
|
|
1010
|
-
l.image ? (c(),
|
|
1009
|
+
B(i.$slots, "image", {}, () => [
|
|
1010
|
+
l.image ? (c(), h("img", {
|
|
1011
1011
|
key: 0,
|
|
1012
1012
|
src: l.image,
|
|
1013
|
-
style:
|
|
1013
|
+
style: j(t.value),
|
|
1014
1014
|
draggable: "false"
|
|
1015
|
-
}, null, 12,
|
|
1015
|
+
}, null, 12, Xe)) : (c(), h("img", {
|
|
1016
1016
|
key: 1,
|
|
1017
|
-
src:
|
|
1018
|
-
style:
|
|
1017
|
+
src: Qe,
|
|
1018
|
+
style: j(t.value),
|
|
1019
1019
|
draggable: "false"
|
|
1020
1020
|
}, null, 4))
|
|
1021
1021
|
])
|
|
1022
1022
|
], 6),
|
|
1023
|
-
|
|
1024
|
-
class: f(
|
|
1023
|
+
y("div", {
|
|
1024
|
+
class: g(f(r).e("description"))
|
|
1025
1025
|
}, [
|
|
1026
|
-
|
|
1027
|
-
|
|
1026
|
+
B(i.$slots, "description", {}, () => [
|
|
1027
|
+
y("p", null, A(u.value), 1)
|
|
1028
1028
|
])
|
|
1029
1029
|
], 2),
|
|
1030
|
-
|
|
1030
|
+
i.$slots.default ? (c(), h("div", {
|
|
1031
1031
|
key: 0,
|
|
1032
|
-
class: f(
|
|
1032
|
+
class: g(f(r).e("bottom"))
|
|
1033
1033
|
}, [
|
|
1034
|
-
|
|
1035
|
-
], 2)) :
|
|
1034
|
+
B(i.$slots, "default")
|
|
1035
|
+
], 2)) : S("", !0)
|
|
1036
1036
|
], 2));
|
|
1037
1037
|
}
|
|
1038
|
-
}),
|
|
1038
|
+
}), xt = /* @__PURE__ */ G({
|
|
1039
1039
|
name: "XTimeline",
|
|
1040
1040
|
__name: "index",
|
|
1041
1041
|
props: {
|
|
1042
1042
|
direction: { default: "vertical" }
|
|
1043
1043
|
},
|
|
1044
1044
|
setup(l) {
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1047
|
-
props:
|
|
1045
|
+
const o = l, r = Y("timeline");
|
|
1046
|
+
le("timeline", {
|
|
1047
|
+
props: o
|
|
1048
1048
|
});
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1051
|
-
|
|
1049
|
+
const t = x(() => [
|
|
1050
|
+
r.b(),
|
|
1051
|
+
r.m(o.direction)
|
|
1052
1052
|
]);
|
|
1053
|
-
return (
|
|
1054
|
-
class:
|
|
1053
|
+
return (u, i) => (c(), h("ul", {
|
|
1054
|
+
class: g(t.value),
|
|
1055
1055
|
role: "timeline"
|
|
1056
1056
|
}, [
|
|
1057
|
-
|
|
1057
|
+
B(u.$slots, "default")
|
|
1058
1058
|
], 2));
|
|
1059
1059
|
}
|
|
1060
|
-
}), bt = /* @__PURE__ */
|
|
1060
|
+
}), bt = /* @__PURE__ */ G({
|
|
1061
1061
|
name: "XTimelineItem",
|
|
1062
1062
|
__name: "TimelineItem",
|
|
1063
1063
|
props: {
|
|
@@ -1069,51 +1069,51 @@ const vt = /* @__PURE__ */ O({
|
|
|
1069
1069
|
placement: { default: "bottom" }
|
|
1070
1070
|
},
|
|
1071
1071
|
setup(l) {
|
|
1072
|
-
const
|
|
1072
|
+
const o = l, r = Y("timeline-item"), t = {
|
|
1073
1073
|
primary: "#409eff",
|
|
1074
1074
|
success: "#67c23a",
|
|
1075
1075
|
warning: "#e6a23c",
|
|
1076
1076
|
danger: "#f56c6c",
|
|
1077
1077
|
info: "#909399"
|
|
1078
|
-
},
|
|
1079
|
-
const
|
|
1080
|
-
return
|
|
1081
|
-
}),
|
|
1082
|
-
|
|
1083
|
-
|
|
1078
|
+
}, u = x(() => {
|
|
1079
|
+
const s = {};
|
|
1080
|
+
return o.color ? s.backgroundColor = o.color : o.type && t[o.type] && (s.backgroundColor = t[o.type]), s;
|
|
1081
|
+
}), i = x(() => [
|
|
1082
|
+
r.b(),
|
|
1083
|
+
r.m(o.size)
|
|
1084
1084
|
]);
|
|
1085
|
-
return (
|
|
1086
|
-
class:
|
|
1085
|
+
return (s, k) => (c(), h("li", {
|
|
1086
|
+
class: g(i.value)
|
|
1087
1087
|
}, [
|
|
1088
|
-
|
|
1089
|
-
class: f(
|
|
1090
|
-
style:
|
|
1088
|
+
y("div", {
|
|
1089
|
+
class: g(f(r).e("node")),
|
|
1090
|
+
style: j(u.value)
|
|
1091
1091
|
}, [
|
|
1092
|
-
|
|
1092
|
+
B(s.$slots, "dot")
|
|
1093
1093
|
], 6),
|
|
1094
|
-
|
|
1095
|
-
class: f(
|
|
1094
|
+
y("div", {
|
|
1095
|
+
class: g(f(r).e("tail"))
|
|
1096
1096
|
}, null, 2),
|
|
1097
|
-
|
|
1098
|
-
class: f(
|
|
1097
|
+
y("div", {
|
|
1098
|
+
class: g(f(r).e("wrapper"))
|
|
1099
1099
|
}, [
|
|
1100
|
-
!l.hideTimestamp && l.timestamp && l.placement === "top" ? (c(),
|
|
1100
|
+
!l.hideTimestamp && l.timestamp && l.placement === "top" ? (c(), h("div", {
|
|
1101
1101
|
key: 0,
|
|
1102
|
-
class: f(
|
|
1103
|
-
}, A(l.timestamp), 3)) :
|
|
1104
|
-
|
|
1105
|
-
class: f(
|
|
1102
|
+
class: g(f(r).e("timestamp"))
|
|
1103
|
+
}, A(l.timestamp), 3)) : S("", !0),
|
|
1104
|
+
y("div", {
|
|
1105
|
+
class: g(f(r).e("content"))
|
|
1106
1106
|
}, [
|
|
1107
|
-
|
|
1107
|
+
B(s.$slots, "default")
|
|
1108
1108
|
], 2),
|
|
1109
|
-
!l.hideTimestamp && l.timestamp && l.placement === "bottom" ? (c(),
|
|
1109
|
+
!l.hideTimestamp && l.timestamp && l.placement === "bottom" ? (c(), h("div", {
|
|
1110
1110
|
key: 1,
|
|
1111
|
-
class: f(
|
|
1112
|
-
}, A(l.timestamp), 3)) :
|
|
1111
|
+
class: g(f(r).e("timestamp"))
|
|
1112
|
+
}, A(l.timestamp), 3)) : S("", !0)
|
|
1113
1113
|
], 2)
|
|
1114
1114
|
], 2));
|
|
1115
1115
|
}
|
|
1116
|
-
}),
|
|
1116
|
+
}), Ze = ["onMouseenter", "onClick"], Ct = /* @__PURE__ */ G({
|
|
1117
1117
|
name: "XCarousel",
|
|
1118
1118
|
__name: "index",
|
|
1119
1119
|
props: {
|
|
@@ -1127,115 +1127,115 @@ const vt = /* @__PURE__ */ O({
|
|
|
1127
1127
|
height: { default: 300 }
|
|
1128
1128
|
},
|
|
1129
1129
|
emits: ["update:activeIndex", "change"],
|
|
1130
|
-
setup(l, { expose:
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1133
|
-
currentIndex:
|
|
1130
|
+
setup(l, { expose: o, emit: r }) {
|
|
1131
|
+
const t = l, u = r, i = Y("carousel"), s = P(t.activeIndex), k = P(0), b = P(null), M = P(!1);
|
|
1132
|
+
le("carousel", {
|
|
1133
|
+
currentIndex: s,
|
|
1134
1134
|
itemCount: k
|
|
1135
1135
|
});
|
|
1136
|
-
const
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1136
|
+
const C = (W) => {
|
|
1137
|
+
const Z = s.value;
|
|
1138
|
+
t.loop ? s.value = (W + k.value) % k.value : s.value = Math.max(0, Math.min(W, k.value - 1)), u("update:activeIndex", s.value), u("change", s.value, Z);
|
|
1139
1139
|
}, T = () => {
|
|
1140
|
-
|
|
1140
|
+
C(s.value - 1);
|
|
1141
|
+
}, L = () => {
|
|
1142
|
+
C(s.value + 1);
|
|
1143
|
+
}, w = () => {
|
|
1144
|
+
t.autoplay && k.value > 1 && ($(), b.value = setInterval(() => {
|
|
1145
|
+
M.value || L();
|
|
1146
|
+
}, t.interval));
|
|
1141
1147
|
}, $ = () => {
|
|
1142
|
-
w(n.value + 1);
|
|
1143
|
-
}, C = () => {
|
|
1144
|
-
e.autoplay && k.value > 1 && (S(), b.value = setInterval(() => {
|
|
1145
|
-
I.value || $();
|
|
1146
|
-
}, e.interval));
|
|
1147
|
-
}, S = () => {
|
|
1148
1148
|
b.value && (clearInterval(b.value), b.value = null);
|
|
1149
1149
|
}, K = () => {
|
|
1150
|
-
|
|
1150
|
+
M.value = !0, t.arrow;
|
|
1151
1151
|
}, N = () => {
|
|
1152
|
-
|
|
1153
|
-
},
|
|
1154
|
-
|
|
1155
|
-
},
|
|
1156
|
-
|
|
1152
|
+
M.value = !1;
|
|
1153
|
+
}, V = (W) => {
|
|
1154
|
+
t.trigger === "hover" && C(W);
|
|
1155
|
+
}, X = (W) => {
|
|
1156
|
+
t.trigger === "click" && C(W);
|
|
1157
1157
|
}, E = x(() => ({
|
|
1158
|
-
height: typeof
|
|
1159
|
-
})),
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1158
|
+
height: typeof t.height == "number" ? `${t.height}px` : t.height
|
|
1159
|
+
})), z = x(() => [
|
|
1160
|
+
i.b(),
|
|
1161
|
+
i.m(`arrow-${t.arrow}`),
|
|
1162
|
+
i.m(`indicator-${t.indicatorPosition}`)
|
|
1163
1163
|
]);
|
|
1164
|
-
return
|
|
1165
|
-
|
|
1166
|
-
}),
|
|
1167
|
-
|
|
1168
|
-
}),
|
|
1169
|
-
|
|
1170
|
-
|
|
1164
|
+
return q(() => t.activeIndex, (W) => {
|
|
1165
|
+
s.value = W;
|
|
1166
|
+
}), q(() => t.autoplay, () => {
|
|
1167
|
+
w();
|
|
1168
|
+
}), q(k, () => {
|
|
1169
|
+
pe(() => {
|
|
1170
|
+
w();
|
|
1171
1171
|
});
|
|
1172
|
-
}),
|
|
1173
|
-
|
|
1174
|
-
}),
|
|
1175
|
-
|
|
1176
|
-
}),
|
|
1172
|
+
}), ie(() => {
|
|
1173
|
+
w();
|
|
1174
|
+
}), re(() => {
|
|
1175
|
+
$();
|
|
1176
|
+
}), o({
|
|
1177
1177
|
prev: T,
|
|
1178
|
-
next:
|
|
1179
|
-
setActiveItem:
|
|
1180
|
-
}), (
|
|
1181
|
-
class:
|
|
1182
|
-
style:
|
|
1178
|
+
next: L,
|
|
1179
|
+
setActiveItem: C
|
|
1180
|
+
}), (W, Z) => (c(), h("div", {
|
|
1181
|
+
class: g(z.value),
|
|
1182
|
+
style: j(E.value),
|
|
1183
1183
|
onMouseenter: K,
|
|
1184
1184
|
onMouseleave: N
|
|
1185
1185
|
}, [
|
|
1186
|
-
|
|
1187
|
-
class: f(
|
|
1186
|
+
y("div", {
|
|
1187
|
+
class: g(f(i).e("container"))
|
|
1188
1188
|
}, [
|
|
1189
|
-
|
|
1189
|
+
B(W.$slots, "default")
|
|
1190
1190
|
], 2),
|
|
1191
|
-
l.arrow !== "never" ? (c(),
|
|
1191
|
+
l.arrow !== "never" ? (c(), h("button", {
|
|
1192
1192
|
key: 0,
|
|
1193
|
-
class:
|
|
1193
|
+
class: g([f(i).e("arrow"), f(i).e("arrow-left")]),
|
|
1194
1194
|
onClick: T
|
|
1195
|
-
}, " ‹ ", 2)) :
|
|
1196
|
-
l.arrow !== "never" ? (c(),
|
|
1195
|
+
}, " ‹ ", 2)) : S("", !0),
|
|
1196
|
+
l.arrow !== "never" ? (c(), h("button", {
|
|
1197
1197
|
key: 1,
|
|
1198
|
-
class:
|
|
1199
|
-
onClick:
|
|
1200
|
-
}, " › ", 2)) :
|
|
1201
|
-
l.indicatorPosition !== "none" ? (c(),
|
|
1198
|
+
class: g([f(i).e("arrow"), f(i).e("arrow-right")]),
|
|
1199
|
+
onClick: L
|
|
1200
|
+
}, " › ", 2)) : S("", !0),
|
|
1201
|
+
l.indicatorPosition !== "none" ? (c(), h("ul", {
|
|
1202
1202
|
key: 2,
|
|
1203
|
-
class: f(
|
|
1203
|
+
class: g(f(i).e("indicators"))
|
|
1204
1204
|
}, [
|
|
1205
|
-
(c(!0),
|
|
1206
|
-
key:
|
|
1207
|
-
class:
|
|
1208
|
-
onMouseenter: (Q) =>
|
|
1209
|
-
onClick: (Q) =>
|
|
1205
|
+
(c(!0), h(R, null, U(k.value, (O) => (c(), h("li", {
|
|
1206
|
+
key: O,
|
|
1207
|
+
class: g([f(i).e("indicator"), f(i).is("active", O - 1 === s.value)]),
|
|
1208
|
+
onMouseenter: (Q) => V(O - 1),
|
|
1209
|
+
onClick: (Q) => X(O - 1)
|
|
1210
1210
|
}, [
|
|
1211
|
-
|
|
1212
|
-
class: f(
|
|
1211
|
+
y("button", {
|
|
1212
|
+
class: g(f(i).e("indicator-btn"))
|
|
1213
1213
|
}, null, 2)
|
|
1214
|
-
], 42,
|
|
1215
|
-
], 2)) :
|
|
1214
|
+
], 42, Ze))), 128))
|
|
1215
|
+
], 2)) : S("", !0)
|
|
1216
1216
|
], 38));
|
|
1217
1217
|
}
|
|
1218
|
-
}),
|
|
1218
|
+
}), wt = /* @__PURE__ */ G({
|
|
1219
1219
|
name: "XCarouselItem",
|
|
1220
1220
|
__name: "CarouselItem",
|
|
1221
1221
|
setup(l) {
|
|
1222
|
-
const
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
}),
|
|
1226
|
-
|
|
1222
|
+
const o = Y("carousel-item"), r = oe("carousel"), t = P(-1);
|
|
1223
|
+
ie(() => {
|
|
1224
|
+
r && (t.value = r.itemCount.value, r.itemCount.value++);
|
|
1225
|
+
}), re(() => {
|
|
1226
|
+
r && r.itemCount.value--;
|
|
1227
1227
|
});
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1230
|
-
|
|
1228
|
+
const u = x(() => r && t.value === r.currentIndex.value), i = x(() => [
|
|
1229
|
+
o.b(),
|
|
1230
|
+
o.is("active", u.value)
|
|
1231
1231
|
]);
|
|
1232
|
-
return (
|
|
1233
|
-
class:
|
|
1232
|
+
return (s, k) => (c(), h("div", {
|
|
1233
|
+
class: g(i.value)
|
|
1234
1234
|
}, [
|
|
1235
|
-
|
|
1235
|
+
B(s.$slots, "default")
|
|
1236
1236
|
], 2));
|
|
1237
1237
|
}
|
|
1238
|
-
}),
|
|
1238
|
+
}), Ve = { key: 0 }, Ue = ["onClick"], Fe = ["onClick"], Je = ["onClick"], qe = { key: 1 }, _e = ["colspan"], et = { style: { display: "none" } }, It = /* @__PURE__ */ G({
|
|
1239
1239
|
name: "XTable",
|
|
1240
1240
|
__name: "index",
|
|
1241
1241
|
props: {
|
|
@@ -1252,161 +1252,196 @@ const vt = /* @__PURE__ */ O({
|
|
|
1252
1252
|
pagination: {}
|
|
1253
1253
|
},
|
|
1254
1254
|
emits: ["sort-change", "row-click", "row-dblclick", "cell-click", "selection-change", "select-all", "page-change", "size-change"],
|
|
1255
|
-
setup(l, { expose:
|
|
1256
|
-
var
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1261
|
-
registerColumn: (
|
|
1262
|
-
|
|
1255
|
+
setup(l, { expose: o, emit: r }) {
|
|
1256
|
+
var I, n;
|
|
1257
|
+
const t = l, u = r, i = Y("table");
|
|
1258
|
+
ue();
|
|
1259
|
+
const s = fe([]);
|
|
1260
|
+
le("x-table", {
|
|
1261
|
+
registerColumn: (e, a) => {
|
|
1262
|
+
s.findIndex((p) => p.config.prop === e.prop) === -1 && s.push({ config: e, slot: a });
|
|
1263
1263
|
},
|
|
1264
|
-
unregisterColumn: (
|
|
1265
|
-
|
|
1264
|
+
unregisterColumn: (e) => {
|
|
1265
|
+
const a = s.findIndex((d) => d.config.prop === e);
|
|
1266
|
+
a !== -1 && s.splice(a, 1);
|
|
1266
1267
|
},
|
|
1267
|
-
updateColumnSlot: (
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1268
|
+
updateColumnSlot: (e, a) => {
|
|
1269
|
+
const d = s.find((p) => p.config.prop === e);
|
|
1270
|
+
d && (d.slot = a);
|
|
1270
1271
|
},
|
|
1271
|
-
props:
|
|
1272
|
+
props: t
|
|
1272
1273
|
});
|
|
1273
|
-
const
|
|
1274
|
-
const d =
|
|
1275
|
-
return
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1274
|
+
const C = x(() => {
|
|
1275
|
+
const e = s.map((m) => m.config), a = e.filter((m) => m.fixed === "left" || m.fixed === !0), d = e.filter((m) => !m.fixed), p = e.filter((m) => m.fixed === "right");
|
|
1276
|
+
return [...a, ...d, ...p];
|
|
1277
|
+
}), T = x(() => C.value.filter((e) => e.fixed === "left" || e.fixed === !0)), L = x(() => C.value.filter((e) => e.fixed === "right"));
|
|
1278
|
+
x(() => C.value.filter((e) => !e.fixed)), x(() => T.value.reduce((e, a) => {
|
|
1279
|
+
const d = a.width ? typeof a.width == "number" ? a.width : parseInt(a.width) : 100;
|
|
1280
|
+
return e + d;
|
|
1281
|
+
}, 0)), x(() => L.value.reduce((e, a) => {
|
|
1282
|
+
const d = a.width ? typeof a.width == "number" ? a.width : parseInt(a.width) : 100;
|
|
1283
|
+
return e + d;
|
|
1284
|
+
}, 0));
|
|
1285
|
+
const w = x(() => {
|
|
1286
|
+
const e = {};
|
|
1287
|
+
return s.forEach((a) => {
|
|
1288
|
+
a.slot && (e[a.config.prop] = a.slot);
|
|
1289
|
+
}), e;
|
|
1290
|
+
}), $ = P({
|
|
1291
|
+
prop: ((I = t.defaultSort) == null ? void 0 : I.prop) || "",
|
|
1292
|
+
order: ((n = t.defaultSort) == null ? void 0 : n.order) || null
|
|
1293
|
+
}), K = x(() => {
|
|
1282
1294
|
if (!$.value.prop || !$.value.order)
|
|
1283
|
-
return
|
|
1284
|
-
const { prop:
|
|
1285
|
-
return [...
|
|
1286
|
-
const
|
|
1287
|
-
if (
|
|
1288
|
-
const
|
|
1289
|
-
return
|
|
1295
|
+
return t.data;
|
|
1296
|
+
const { prop: e, order: a } = $.value;
|
|
1297
|
+
return [...t.data].sort((d, p) => {
|
|
1298
|
+
const m = d[e], D = p[e];
|
|
1299
|
+
if (m === D) return 0;
|
|
1300
|
+
const H = m > D ? 1 : -1;
|
|
1301
|
+
return a === "ascending" ? H : -H;
|
|
1290
1302
|
});
|
|
1291
|
-
}),
|
|
1292
|
-
const
|
|
1293
|
-
return
|
|
1294
|
-
}),
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1303
|
+
}), N = x(() => {
|
|
1304
|
+
const e = {};
|
|
1305
|
+
return t.height && (e.height = typeof t.height == "number" ? `${t.height}px` : t.height), t.maxHeight && (e.maxHeight = typeof t.maxHeight == "number" ? `${t.maxHeight}px` : t.maxHeight), e;
|
|
1306
|
+
}), V = x(() => [
|
|
1307
|
+
i.b(),
|
|
1308
|
+
i.is("border", t.border),
|
|
1309
|
+
i.is("stripe", t.stripe),
|
|
1310
|
+
i.is("loading", t.loading),
|
|
1311
|
+
i.is("has-fixed", T.value.length > 0 || L.value.length > 0)
|
|
1312
|
+
]), X = (e) => {
|
|
1313
|
+
e.sortable && ($.value.prop === e.prop ? $.value.order === "ascending" ? $.value.order = "descending" : $.value.order === "descending" && ($.value.order = null, $.value.prop = "") : ($.value.prop = e.prop, $.value.order = "ascending"), u("sort-change", { ...$.value }));
|
|
1314
|
+
}, E = (e) => e.sortable ? $.value.prop !== e.prop ? i.is("sortable") : [
|
|
1315
|
+
i.is("sortable"),
|
|
1316
|
+
i.is(`sort-${$.value.order}`)
|
|
1317
|
+
] : "", z = (e, a, d) => {
|
|
1318
|
+
const p = e[a.prop];
|
|
1319
|
+
return a.formatter ? a.formatter(e, a, p, d) : p ?? "";
|
|
1320
|
+
}, W = (e, a) => {
|
|
1321
|
+
u("row-click", e, C.value[0], a);
|
|
1322
|
+
}, Z = (e, a, d) => {
|
|
1323
|
+
const p = d.target;
|
|
1324
|
+
u("cell-click", e, a, p, d);
|
|
1325
|
+
}, O = (e) => {
|
|
1326
|
+
u("page-change", e);
|
|
1327
|
+
}, Q = (e) => {
|
|
1328
|
+
u("size-change", e);
|
|
1329
|
+
}, F = (e, a, d) => {
|
|
1330
|
+
const p = {};
|
|
1331
|
+
if (e.width && (p.width = typeof e.width == "number" ? `${e.width}px` : e.width), e.minWidth && (p.minWidth = typeof e.minWidth == "number" ? `${e.minWidth}px` : e.minWidth), e.align && (p.textAlign = e.align), (e.fixed === "left" || e.fixed === !0) && (p.position = "sticky", p.left = "0px", p.zIndex = "2", a !== void 0 && a > 0)) {
|
|
1332
|
+
let m = 0;
|
|
1333
|
+
for (let D = 0; D < a; D++) {
|
|
1334
|
+
const H = T.value[D], ee = H.width ? typeof H.width == "number" ? H.width : parseInt(H.width) : 100;
|
|
1335
|
+
m += ee;
|
|
1336
|
+
}
|
|
1337
|
+
p.left = `${m}px`;
|
|
1338
|
+
}
|
|
1339
|
+
if (e.fixed === "right" && (p.position = "sticky", p.right = "0px", p.zIndex = "2", a !== void 0)) {
|
|
1340
|
+
const m = L.value, D = m.length - 1 - a;
|
|
1341
|
+
if (D > 0) {
|
|
1342
|
+
let H = 0;
|
|
1343
|
+
for (let ee = 0; ee < D; ee++) {
|
|
1344
|
+
const ne = m[m.length - 1 - ee], ge = ne.width ? typeof ne.width == "number" ? ne.width : parseInt(ne.width) : 100;
|
|
1345
|
+
H += ge;
|
|
1346
|
+
}
|
|
1347
|
+
p.right = `${H}px`;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
return p;
|
|
1351
|
+
}, _ = (e) => {
|
|
1352
|
+
const a = [];
|
|
1353
|
+
return (e.fixed === "left" || e.fixed === !0) && a.push(i.is("fixed-left")), e.fixed === "right" && a.push(i.is("fixed-right")), a;
|
|
1319
1354
|
};
|
|
1320
|
-
return
|
|
1355
|
+
return o({
|
|
1321
1356
|
clearSelection: () => {
|
|
1322
1357
|
},
|
|
1323
1358
|
getSelection: () => [],
|
|
1324
1359
|
sortState: $,
|
|
1325
|
-
columns:
|
|
1326
|
-
}), (
|
|
1327
|
-
class:
|
|
1360
|
+
columns: C
|
|
1361
|
+
}), (e, a) => (c(), h("div", {
|
|
1362
|
+
class: g(V.value)
|
|
1328
1363
|
}, [
|
|
1329
|
-
l.loading ? (c(),
|
|
1364
|
+
l.loading ? (c(), h("div", {
|
|
1330
1365
|
key: 0,
|
|
1331
|
-
class: f(
|
|
1332
|
-
}, [...
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
])], 2)) :
|
|
1336
|
-
|
|
1337
|
-
class: f(
|
|
1338
|
-
style:
|
|
1366
|
+
class: g(f(i).e("loading"))
|
|
1367
|
+
}, [...a[0] || (a[0] = [
|
|
1368
|
+
y("span", { class: "loading-spinner" }, null, -1),
|
|
1369
|
+
y("span", { class: "loading-text" }, "加载中...", -1)
|
|
1370
|
+
])], 2)) : S("", !0),
|
|
1371
|
+
y("div", {
|
|
1372
|
+
class: g(f(i).e("wrapper")),
|
|
1373
|
+
style: j(N.value)
|
|
1339
1374
|
}, [
|
|
1340
|
-
|
|
1341
|
-
l.showHeader ? (c(),
|
|
1342
|
-
|
|
1343
|
-
(c(!0),
|
|
1344
|
-
key:
|
|
1345
|
-
class:
|
|
1346
|
-
style: L(
|
|
1347
|
-
onClick: (
|
|
1375
|
+
y("table", null, [
|
|
1376
|
+
l.showHeader ? (c(), h("thead", Ve, [
|
|
1377
|
+
y("tr", null, [
|
|
1378
|
+
(c(!0), h(R, null, U(C.value, (d, p) => (c(), h("th", {
|
|
1379
|
+
key: d.prop,
|
|
1380
|
+
class: g([f(i).e("header-cell"), E(d), ..._(d)]),
|
|
1381
|
+
style: j(F(d, d.fixed === "right" ? L.value.indexOf(d) : p)),
|
|
1382
|
+
onClick: (m) => X(d)
|
|
1348
1383
|
}, [
|
|
1349
|
-
|
|
1350
|
-
|
|
1384
|
+
y("span", null, A(d.label), 1),
|
|
1385
|
+
d.sortable ? (c(), h("span", {
|
|
1351
1386
|
key: 0,
|
|
1352
|
-
class: f(
|
|
1353
|
-
}, [...
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
])], 2)) :
|
|
1357
|
-
], 14,
|
|
1387
|
+
class: g(f(i).e("sort-icon"))
|
|
1388
|
+
}, [...a[1] || (a[1] = [
|
|
1389
|
+
y("span", { class: "sort-arrow up" }, "▲", -1),
|
|
1390
|
+
y("span", { class: "sort-arrow down" }, "▼", -1)
|
|
1391
|
+
])], 2)) : S("", !0)
|
|
1392
|
+
], 14, Ue))), 128))
|
|
1358
1393
|
])
|
|
1359
|
-
])) :
|
|
1360
|
-
|
|
1361
|
-
(c(!0),
|
|
1362
|
-
key: l.rowKey ? typeof l.rowKey == "function" ? l.rowKey(
|
|
1363
|
-
class:
|
|
1364
|
-
onClick: (
|
|
1394
|
+
])) : S("", !0),
|
|
1395
|
+
y("tbody", null, [
|
|
1396
|
+
(c(!0), h(R, null, U(K.value, (d, p) => (c(), h("tr", {
|
|
1397
|
+
key: l.rowKey ? typeof l.rowKey == "function" ? l.rowKey(d) : d[l.rowKey] : p,
|
|
1398
|
+
class: g([f(i).e("row")]),
|
|
1399
|
+
onClick: (m) => W(d, m)
|
|
1365
1400
|
}, [
|
|
1366
|
-
(c(!0),
|
|
1367
|
-
key:
|
|
1368
|
-
class: f(
|
|
1369
|
-
style: L(
|
|
1370
|
-
onClick: (
|
|
1401
|
+
(c(!0), h(R, null, U(C.value, (m, D) => (c(), h("td", {
|
|
1402
|
+
key: m.prop,
|
|
1403
|
+
class: g([f(i).e("cell"), ..._(m)]),
|
|
1404
|
+
style: j(F(m, m.fixed === "right" ? L.value.indexOf(m) : D)),
|
|
1405
|
+
onClick: (H) => Z(d, m, H)
|
|
1371
1406
|
}, [
|
|
1372
|
-
|
|
1373
|
-
J(A(
|
|
1407
|
+
w.value[m.prop] ? (c(), se(ce(() => w.value[m.prop]({ row: d, column: m, $index: p })), { key: 0 })) : (c(), h(R, { key: 1 }, [
|
|
1408
|
+
J(A(z(d, m, p)), 1)
|
|
1374
1409
|
], 64))
|
|
1375
1410
|
], 14, Je))), 128))
|
|
1376
|
-
], 10,
|
|
1411
|
+
], 10, Fe))), 128))
|
|
1377
1412
|
]),
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
colspan:
|
|
1382
|
-
class: f(
|
|
1413
|
+
K.value.length === 0 && !l.loading ? (c(), h("tbody", qe, [
|
|
1414
|
+
y("tr", null, [
|
|
1415
|
+
y("td", {
|
|
1416
|
+
colspan: C.value.length || 1,
|
|
1417
|
+
class: g(f(i).e("empty"))
|
|
1383
1418
|
}, [
|
|
1384
|
-
|
|
1419
|
+
B(e.$slots, "empty", {}, () => [
|
|
1385
1420
|
J(A(l.emptyText), 1)
|
|
1386
1421
|
])
|
|
1387
|
-
], 10,
|
|
1422
|
+
], 10, _e)
|
|
1388
1423
|
])
|
|
1389
|
-
])) :
|
|
1424
|
+
])) : S("", !0)
|
|
1390
1425
|
])
|
|
1391
1426
|
], 6),
|
|
1392
|
-
l.pagination ? (c(),
|
|
1427
|
+
l.pagination ? (c(), h("div", {
|
|
1393
1428
|
key: 1,
|
|
1394
|
-
class: f(
|
|
1429
|
+
class: g(f(i).e("pagination"))
|
|
1395
1430
|
}, [
|
|
1396
|
-
|
|
1431
|
+
xe(Ne, {
|
|
1397
1432
|
total: l.pagination.total,
|
|
1398
1433
|
"current-page": l.pagination.current,
|
|
1399
1434
|
"page-size": l.pagination.pageSize,
|
|
1400
|
-
onCurrentChange:
|
|
1401
|
-
onSizeChange:
|
|
1435
|
+
onCurrentChange: O,
|
|
1436
|
+
onSizeChange: Q
|
|
1402
1437
|
}, null, 8, ["total", "current-page", "page-size"])
|
|
1403
|
-
], 2)) :
|
|
1404
|
-
|
|
1405
|
-
|
|
1438
|
+
], 2)) : S("", !0),
|
|
1439
|
+
y("div", et, [
|
|
1440
|
+
B(e.$slots, "default")
|
|
1406
1441
|
])
|
|
1407
1442
|
], 2));
|
|
1408
1443
|
}
|
|
1409
|
-
}),
|
|
1444
|
+
}), $t = /* @__PURE__ */ G({
|
|
1410
1445
|
name: "XTableColumn",
|
|
1411
1446
|
__name: "TableColumn",
|
|
1412
1447
|
props: {
|
|
@@ -1420,27 +1455,27 @@ const vt = /* @__PURE__ */ O({
|
|
|
1420
1455
|
formatter: {}
|
|
1421
1456
|
},
|
|
1422
1457
|
setup(l) {
|
|
1423
|
-
const
|
|
1424
|
-
|
|
1425
|
-
const
|
|
1426
|
-
prop:
|
|
1427
|
-
label:
|
|
1428
|
-
width:
|
|
1429
|
-
minWidth:
|
|
1430
|
-
align:
|
|
1431
|
-
sortable:
|
|
1432
|
-
fixed:
|
|
1433
|
-
formatter:
|
|
1458
|
+
const o = l;
|
|
1459
|
+
Y("table-column");
|
|
1460
|
+
const r = ue(), t = P(`column_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`), u = oe("x-table"), i = x(() => ({
|
|
1461
|
+
prop: o.prop || t.value,
|
|
1462
|
+
label: o.label,
|
|
1463
|
+
width: o.width,
|
|
1464
|
+
minWidth: o.minWidth,
|
|
1465
|
+
align: o.align,
|
|
1466
|
+
sortable: o.sortable,
|
|
1467
|
+
fixed: o.fixed,
|
|
1468
|
+
formatter: o.formatter
|
|
1434
1469
|
}));
|
|
1435
|
-
return
|
|
1436
|
-
|
|
1437
|
-
}),
|
|
1438
|
-
|
|
1439
|
-
}, { immediate: !0 }),
|
|
1440
|
-
|
|
1441
|
-
}), (
|
|
1470
|
+
return ie(() => {
|
|
1471
|
+
u != null && u.registerColumn && u.registerColumn(i.value, r.default);
|
|
1472
|
+
}), q(() => r.default, (s) => {
|
|
1473
|
+
u != null && u.updateColumnSlot && s && u.updateColumnSlot(o.prop || t.value, s);
|
|
1474
|
+
}, { immediate: !0 }), re(() => {
|
|
1475
|
+
u != null && u.unregisterColumn && u.unregisterColumn(o.prop || t.value);
|
|
1476
|
+
}), (s, k) => null;
|
|
1442
1477
|
}
|
|
1443
|
-
}),
|
|
1478
|
+
}), tt = { key: 0 }, at = ["onClick"], nt = ["onClick"], st = { key: 0 }, lt = { key: 1 }, ot = { key: 0 }, it = ["colspan"], rt = { style: { display: "none" } }, Mt = /* @__PURE__ */ G({
|
|
1444
1479
|
name: "XTreeTable",
|
|
1445
1480
|
__name: "index",
|
|
1446
1481
|
props: {
|
|
@@ -1459,197 +1494,197 @@ const vt = /* @__PURE__ */ O({
|
|
|
1459
1494
|
collapseIcon: {}
|
|
1460
1495
|
},
|
|
1461
1496
|
emits: ["row-click", "cell-click", "expand-change", "sort-change"],
|
|
1462
|
-
setup(l, { expose:
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
registerColumn: (
|
|
1466
|
-
const
|
|
1467
|
-
|
|
1497
|
+
setup(l, { expose: o, emit: r }) {
|
|
1498
|
+
const t = l, u = r, i = Y("tree-table"), s = P(/* @__PURE__ */ new Set()), k = P([]), b = P({});
|
|
1499
|
+
le("x-tree-table", {
|
|
1500
|
+
registerColumn: (v, I) => {
|
|
1501
|
+
const n = k.value.findIndex((e) => e.prop === v.prop);
|
|
1502
|
+
n === -1 ? k.value.push(v) : k.value[n] = v, I && (b.value[v.prop] = I);
|
|
1468
1503
|
},
|
|
1469
|
-
unregisterColumn: (
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1504
|
+
unregisterColumn: (v) => {
|
|
1505
|
+
const I = k.value.findIndex((n) => n.prop === v);
|
|
1506
|
+
I > -1 && k.value.splice(I, 1), delete b.value[v];
|
|
1472
1507
|
},
|
|
1473
|
-
updateColumnSlot: (
|
|
1474
|
-
b.value[
|
|
1508
|
+
updateColumnSlot: (v, I) => {
|
|
1509
|
+
b.value[v] = I;
|
|
1475
1510
|
},
|
|
1476
|
-
props:
|
|
1511
|
+
props: t
|
|
1477
1512
|
});
|
|
1478
|
-
const
|
|
1479
|
-
var
|
|
1480
|
-
const
|
|
1481
|
-
return
|
|
1482
|
-
},
|
|
1483
|
-
var
|
|
1484
|
-
if (
|
|
1485
|
-
const
|
|
1486
|
-
return
|
|
1487
|
-
}, K = (
|
|
1488
|
-
const
|
|
1489
|
-
return
|
|
1490
|
-
}, N = (
|
|
1491
|
-
const
|
|
1492
|
-
|
|
1493
|
-
},
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1496
|
-
|
|
1513
|
+
const L = (v) => typeof t.rowKey == "function" ? t.rowKey(v) : v[t.rowKey || "id"], w = (v) => {
|
|
1514
|
+
var n;
|
|
1515
|
+
const I = ((n = t.treeProps) == null ? void 0 : n.children) || "children";
|
|
1516
|
+
return v[I] || [];
|
|
1517
|
+
}, $ = (v) => {
|
|
1518
|
+
var e;
|
|
1519
|
+
if (w(v).length > 0) return !0;
|
|
1520
|
+
const n = ((e = t.treeProps) == null ? void 0 : e.hasChildren) || "hasChildren";
|
|
1521
|
+
return v[n] === !0;
|
|
1522
|
+
}, K = (v) => {
|
|
1523
|
+
const I = L(v);
|
|
1524
|
+
return s.value.has(I);
|
|
1525
|
+
}, N = (v) => {
|
|
1526
|
+
const I = L(v), n = !s.value.has(I);
|
|
1527
|
+
n ? s.value.add(I) : s.value.delete(I), u("expand-change", v, n);
|
|
1528
|
+
}, V = () => {
|
|
1529
|
+
const v = (I) => {
|
|
1530
|
+
I.forEach((n) => {
|
|
1531
|
+
$(n) && (s.value.add(L(n)), v(w(n)));
|
|
1497
1532
|
});
|
|
1498
1533
|
};
|
|
1499
|
-
|
|
1500
|
-
},
|
|
1501
|
-
|
|
1534
|
+
v(t.data);
|
|
1535
|
+
}, X = () => {
|
|
1536
|
+
s.value.clear();
|
|
1502
1537
|
}, E = x(() => {
|
|
1503
|
-
const
|
|
1504
|
-
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1507
|
-
const
|
|
1508
|
-
|
|
1538
|
+
const v = [], I = (n, e = 0, a = !0) => {
|
|
1539
|
+
n.forEach((d) => {
|
|
1540
|
+
const p = L(d), m = s.value.has(p), D = a;
|
|
1541
|
+
v.push({ row: d, level: e, visible: D });
|
|
1542
|
+
const H = w(d);
|
|
1543
|
+
H.length > 0 && m && I(H, e + 1, D);
|
|
1509
1544
|
});
|
|
1510
1545
|
};
|
|
1511
|
-
return
|
|
1512
|
-
}),
|
|
1546
|
+
return I(t.data), v;
|
|
1547
|
+
}), z = P({
|
|
1513
1548
|
prop: "",
|
|
1514
1549
|
order: null
|
|
1515
|
-
}),
|
|
1516
|
-
if (!
|
|
1550
|
+
}), W = x(() => {
|
|
1551
|
+
if (!z.value.prop || !z.value.order)
|
|
1517
1552
|
return E.value;
|
|
1518
|
-
const { prop:
|
|
1519
|
-
return [...E.value].sort((
|
|
1520
|
-
const
|
|
1521
|
-
if (
|
|
1522
|
-
const
|
|
1523
|
-
return
|
|
1553
|
+
const { prop: v, order: I } = z.value;
|
|
1554
|
+
return [...E.value].sort((n, e) => {
|
|
1555
|
+
const a = n.row[v], d = e.row[v];
|
|
1556
|
+
if (a === d) return 0;
|
|
1557
|
+
const p = a > d ? 1 : -1;
|
|
1558
|
+
return I === "ascending" ? p : -p;
|
|
1524
1559
|
});
|
|
1525
|
-
}),
|
|
1526
|
-
|
|
1527
|
-
},
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
] : "", Q = (
|
|
1531
|
-
const
|
|
1532
|
-
return
|
|
1533
|
-
},
|
|
1534
|
-
const
|
|
1535
|
-
return
|
|
1560
|
+
}), Z = (v) => {
|
|
1561
|
+
v.sortable && (z.value.prop === v.prop ? z.value.order === "ascending" ? z.value.order = "descending" : z.value.order === "descending" && (z.value.order = null, z.value.prop = "") : (z.value.prop = v.prop, z.value.order = "ascending"), u("sort-change", { ...z.value }));
|
|
1562
|
+
}, O = (v) => v.sortable ? z.value.prop !== v.prop ? i.is("sortable") : [
|
|
1563
|
+
i.is("sortable"),
|
|
1564
|
+
i.is(`sort-${z.value.order}`)
|
|
1565
|
+
] : "", Q = (v, I, n) => {
|
|
1566
|
+
const e = v[I.prop];
|
|
1567
|
+
return I.formatter ? I.formatter(v, I, e, n) : e ?? "";
|
|
1568
|
+
}, F = (v) => {
|
|
1569
|
+
const I = {};
|
|
1570
|
+
return v.width && (I.width = typeof v.width == "number" ? `${v.width}px` : v.width), v.minWidth && (I.minWidth = typeof v.minWidth == "number" ? `${v.minWidth}px` : v.minWidth), v.align && (I.textAlign = v.align), I;
|
|
1536
1571
|
}, _ = x(() => [
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
]),
|
|
1542
|
-
var
|
|
1543
|
-
|
|
1544
|
-
|
|
1572
|
+
i.b(),
|
|
1573
|
+
i.is("border", t.border),
|
|
1574
|
+
i.is("stripe", t.stripe),
|
|
1575
|
+
i.is("loading", t.loading)
|
|
1576
|
+
]), ae = () => {
|
|
1577
|
+
var v;
|
|
1578
|
+
t.defaultExpandAll ? V() : (v = t.defaultExpandedKeys) != null && v.length && t.defaultExpandedKeys.forEach((I) => {
|
|
1579
|
+
s.value.add(I);
|
|
1545
1580
|
});
|
|
1546
1581
|
};
|
|
1547
|
-
return
|
|
1548
|
-
|
|
1549
|
-
}, { immediate: !0 }),
|
|
1550
|
-
|
|
1551
|
-
|
|
1582
|
+
return q(() => t.data, () => {
|
|
1583
|
+
ae();
|
|
1584
|
+
}, { immediate: !0 }), q(() => t.defaultExpandedKeys, (v) => {
|
|
1585
|
+
v != null && v.length && !t.defaultExpandAll && (s.value.clear(), v.forEach((I) => {
|
|
1586
|
+
s.value.add(I);
|
|
1552
1587
|
}));
|
|
1553
|
-
}, { immediate: !0 }),
|
|
1554
|
-
expandAll:
|
|
1555
|
-
collapseAll:
|
|
1588
|
+
}, { immediate: !0 }), o({
|
|
1589
|
+
expandAll: V,
|
|
1590
|
+
collapseAll: X,
|
|
1556
1591
|
toggleExpand: N,
|
|
1557
|
-
expandedKeys:
|
|
1592
|
+
expandedKeys: s,
|
|
1558
1593
|
columns: k
|
|
1559
|
-
}), (
|
|
1560
|
-
class:
|
|
1594
|
+
}), (v, I) => (c(), h("div", {
|
|
1595
|
+
class: g(_.value)
|
|
1561
1596
|
}, [
|
|
1562
|
-
l.loading ? (c(),
|
|
1597
|
+
l.loading ? (c(), h("div", {
|
|
1563
1598
|
key: 0,
|
|
1564
|
-
class: f(
|
|
1565
|
-
}, [...
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
])], 2)) :
|
|
1569
|
-
|
|
1570
|
-
class: f(
|
|
1599
|
+
class: g(f(i).e("loading"))
|
|
1600
|
+
}, [...I[0] || (I[0] = [
|
|
1601
|
+
y("span", { class: "loading-spinner" }, null, -1),
|
|
1602
|
+
y("span", { class: "loading-text" }, "加载中...", -1)
|
|
1603
|
+
])], 2)) : S("", !0),
|
|
1604
|
+
y("div", {
|
|
1605
|
+
class: g(f(i).e("wrapper"))
|
|
1571
1606
|
}, [
|
|
1572
|
-
|
|
1573
|
-
l.showHeader ? (c(),
|
|
1574
|
-
|
|
1575
|
-
(c(!0),
|
|
1576
|
-
key:
|
|
1577
|
-
class:
|
|
1578
|
-
style:
|
|
1579
|
-
onClick: (
|
|
1607
|
+
y("table", null, [
|
|
1608
|
+
l.showHeader ? (c(), h("thead", tt, [
|
|
1609
|
+
y("tr", null, [
|
|
1610
|
+
(c(!0), h(R, null, U(k.value, (n) => (c(), h("th", {
|
|
1611
|
+
key: n.prop,
|
|
1612
|
+
class: g([f(i).e("header-cell"), O(n)]),
|
|
1613
|
+
style: j(F(n)),
|
|
1614
|
+
onClick: (e) => Z(n)
|
|
1580
1615
|
}, [
|
|
1581
|
-
|
|
1582
|
-
|
|
1616
|
+
y("span", null, A(n.label), 1),
|
|
1617
|
+
n.sortable ? (c(), h("span", {
|
|
1583
1618
|
key: 0,
|
|
1584
|
-
class: f(
|
|
1585
|
-
}, [...
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
])], 2)) :
|
|
1589
|
-
], 14,
|
|
1619
|
+
class: g(f(i).e("sort-icon"))
|
|
1620
|
+
}, [...I[1] || (I[1] = [
|
|
1621
|
+
y("span", { class: "sort-arrow up" }, "▲", -1),
|
|
1622
|
+
y("span", { class: "sort-arrow down" }, "▼", -1)
|
|
1623
|
+
])], 2)) : S("", !0)
|
|
1624
|
+
], 14, at))), 128))
|
|
1590
1625
|
])
|
|
1591
|
-
])) :
|
|
1592
|
-
|
|
1593
|
-
(c(!0),
|
|
1594
|
-
key:
|
|
1626
|
+
])) : S("", !0),
|
|
1627
|
+
y("tbody", null, [
|
|
1628
|
+
(c(!0), h(R, null, U(W.value, (n, e) => (c(), h(R, {
|
|
1629
|
+
key: L(n.row)
|
|
1595
1630
|
}, [
|
|
1596
|
-
|
|
1631
|
+
n.visible ? (c(), h("tr", {
|
|
1597
1632
|
key: 0,
|
|
1598
|
-
class:
|
|
1633
|
+
class: g([f(i).e("row"), f(i).is("level-" + n.level)])
|
|
1599
1634
|
}, [
|
|
1600
|
-
(c(!0),
|
|
1601
|
-
key:
|
|
1602
|
-
class: f(
|
|
1603
|
-
style:
|
|
1635
|
+
(c(!0), h(R, null, U(k.value, (a, d) => (c(), h("td", {
|
|
1636
|
+
key: a.prop,
|
|
1637
|
+
class: g(f(i).e("cell")),
|
|
1638
|
+
style: j(F(a))
|
|
1604
1639
|
}, [
|
|
1605
|
-
|
|
1640
|
+
d === 0 ? (c(), h("div", {
|
|
1606
1641
|
key: 0,
|
|
1607
|
-
class: f(
|
|
1642
|
+
class: g(f(i).e("cell-content"))
|
|
1608
1643
|
}, [
|
|
1609
|
-
|
|
1610
|
-
class: f(
|
|
1611
|
-
style:
|
|
1644
|
+
y("span", {
|
|
1645
|
+
class: g(f(i).e("indent")),
|
|
1646
|
+
style: j({ width: `${n.level * l.indent}px` })
|
|
1612
1647
|
}, null, 6),
|
|
1613
|
-
|
|
1648
|
+
$(n.row) ? (c(), h("span", {
|
|
1614
1649
|
key: 0,
|
|
1615
|
-
class:
|
|
1616
|
-
onClick:
|
|
1650
|
+
class: g([f(i).e("expand-icon"), f(i).is("expanded", K(n.row))]),
|
|
1651
|
+
onClick: de((p) => N(n.row), ["stop"])
|
|
1617
1652
|
}, [
|
|
1618
|
-
K(
|
|
1619
|
-
], 10,
|
|
1653
|
+
K(n.row) ? (c(), h("span", st, "▼")) : (c(), h("span", lt, "▶"))
|
|
1654
|
+
], 10, nt)) : (c(), h("span", {
|
|
1620
1655
|
key: 1,
|
|
1621
|
-
class: f(
|
|
1656
|
+
class: g(f(i).e("expand-placeholder"))
|
|
1622
1657
|
}, null, 2)),
|
|
1623
|
-
|
|
1624
|
-
b.value[
|
|
1625
|
-
J(A(Q(
|
|
1658
|
+
y("span", null, [
|
|
1659
|
+
b.value[a.prop] ? (c(), se(ce(() => b.value[a.prop]({ row: n.row, column: a, $index: e })), { key: 0 })) : (c(), h(R, { key: 1 }, [
|
|
1660
|
+
J(A(Q(n.row, a, e)), 1)
|
|
1626
1661
|
], 64))
|
|
1627
1662
|
])
|
|
1628
|
-
], 2)) : b.value[
|
|
1629
|
-
J(A(Q(
|
|
1663
|
+
], 2)) : b.value[a.prop] ? (c(), se(ce(() => b.value[a.prop]({ row: n.row, column: a, $index: e })), { key: 1 })) : (c(), h(R, { key: 2 }, [
|
|
1664
|
+
J(A(Q(n.row, a, e)), 1)
|
|
1630
1665
|
], 64))
|
|
1631
1666
|
], 6))), 128))
|
|
1632
|
-
], 2)) :
|
|
1667
|
+
], 2)) : S("", !0)
|
|
1633
1668
|
], 64))), 128)),
|
|
1634
|
-
|
|
1635
|
-
|
|
1669
|
+
W.value.length === 0 && !l.loading ? (c(), h("tr", ot, [
|
|
1670
|
+
y("td", {
|
|
1636
1671
|
colspan: k.value.length || 1,
|
|
1637
|
-
class: f(
|
|
1672
|
+
class: g(f(i).e("empty"))
|
|
1638
1673
|
}, [
|
|
1639
|
-
|
|
1674
|
+
B(v.$slots, "empty", {}, () => [
|
|
1640
1675
|
J(A(l.emptyText), 1)
|
|
1641
1676
|
])
|
|
1642
|
-
], 10,
|
|
1643
|
-
])) :
|
|
1677
|
+
], 10, it)
|
|
1678
|
+
])) : S("", !0)
|
|
1644
1679
|
])
|
|
1645
1680
|
])
|
|
1646
1681
|
], 2),
|
|
1647
|
-
|
|
1648
|
-
|
|
1682
|
+
y("div", rt, [
|
|
1683
|
+
B(v.$slots, "default")
|
|
1649
1684
|
])
|
|
1650
1685
|
], 2));
|
|
1651
1686
|
}
|
|
1652
|
-
}),
|
|
1687
|
+
}), St = /* @__PURE__ */ G({
|
|
1653
1688
|
name: "XTreeTableColumn",
|
|
1654
1689
|
__name: "TreeTableColumn",
|
|
1655
1690
|
props: {
|
|
@@ -1663,27 +1698,27 @@ const vt = /* @__PURE__ */ O({
|
|
|
1663
1698
|
formatter: {}
|
|
1664
1699
|
},
|
|
1665
1700
|
setup(l) {
|
|
1666
|
-
const
|
|
1667
|
-
|
|
1668
|
-
const
|
|
1669
|
-
prop:
|
|
1670
|
-
label:
|
|
1671
|
-
width:
|
|
1672
|
-
minWidth:
|
|
1673
|
-
align:
|
|
1674
|
-
sortable:
|
|
1675
|
-
fixed:
|
|
1676
|
-
formatter:
|
|
1701
|
+
const o = l;
|
|
1702
|
+
Y("tree-table-column");
|
|
1703
|
+
const r = ue(), t = oe("x-tree-table"), u = x(() => ({
|
|
1704
|
+
prop: o.prop,
|
|
1705
|
+
label: o.label,
|
|
1706
|
+
width: o.width,
|
|
1707
|
+
minWidth: o.minWidth,
|
|
1708
|
+
align: o.align,
|
|
1709
|
+
sortable: o.sortable,
|
|
1710
|
+
fixed: o.fixed,
|
|
1711
|
+
formatter: o.formatter
|
|
1677
1712
|
}));
|
|
1678
|
-
return
|
|
1679
|
-
|
|
1680
|
-
}),
|
|
1681
|
-
|
|
1682
|
-
}, { immediate: !0 }),
|
|
1683
|
-
|
|
1684
|
-
}), (
|
|
1713
|
+
return ie(() => {
|
|
1714
|
+
t != null && t.registerColumn && t.registerColumn(u.value, r.default);
|
|
1715
|
+
}), q(() => r.default, (i) => {
|
|
1716
|
+
t != null && t.updateColumnSlot && i && t.updateColumnSlot(o.prop, i);
|
|
1717
|
+
}, { immediate: !0 }), re(() => {
|
|
1718
|
+
t != null && t.unregisterColumn && t.unregisterColumn(o.prop);
|
|
1719
|
+
}), (i, s) => null;
|
|
1685
1720
|
}
|
|
1686
|
-
}),
|
|
1721
|
+
}), dt = ["src", "alt"], Kt = /* @__PURE__ */ G({
|
|
1687
1722
|
name: "XAvatar",
|
|
1688
1723
|
__name: "index",
|
|
1689
1724
|
props: {
|
|
@@ -1695,39 +1730,39 @@ const vt = /* @__PURE__ */ O({
|
|
|
1695
1730
|
alt: {}
|
|
1696
1731
|
},
|
|
1697
1732
|
emits: ["error"],
|
|
1698
|
-
setup(l, { emit:
|
|
1699
|
-
const
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
typeof
|
|
1703
|
-
]),
|
|
1733
|
+
setup(l, { emit: o }) {
|
|
1734
|
+
const r = l, t = o, u = Y("avatar"), i = x(() => [
|
|
1735
|
+
u.b(),
|
|
1736
|
+
u.m(r.shape),
|
|
1737
|
+
typeof r.size == "string" ? u.m(r.size) : ""
|
|
1738
|
+
]), s = x(() => {
|
|
1704
1739
|
const b = {};
|
|
1705
|
-
return typeof
|
|
1740
|
+
return typeof r.size == "number" && (b.width = `${r.size}px`, b.height = `${r.size}px`, b.lineHeight = `${r.size}px`), b;
|
|
1706
1741
|
}), k = (b) => {
|
|
1707
|
-
|
|
1742
|
+
t("error", b);
|
|
1708
1743
|
};
|
|
1709
|
-
return (b,
|
|
1710
|
-
class:
|
|
1711
|
-
style:
|
|
1744
|
+
return (b, M) => (c(), h("span", {
|
|
1745
|
+
class: g(i.value),
|
|
1746
|
+
style: j(s.value)
|
|
1712
1747
|
}, [
|
|
1713
|
-
l.src ? (c(),
|
|
1748
|
+
l.src ? (c(), h("img", {
|
|
1714
1749
|
key: 0,
|
|
1715
1750
|
src: l.src,
|
|
1716
1751
|
alt: l.alt,
|
|
1717
|
-
style:
|
|
1752
|
+
style: j({ objectFit: l.fit }),
|
|
1718
1753
|
onError: k
|
|
1719
|
-
}, null, 44,
|
|
1754
|
+
}, null, 44, dt)) : l.icon ? (c(), h("span", {
|
|
1720
1755
|
key: 1,
|
|
1721
|
-
class: f(
|
|
1722
|
-
}, A(l.icon), 3)) : (c(),
|
|
1756
|
+
class: g(f(u).e("icon"))
|
|
1757
|
+
}, A(l.icon), 3)) : (c(), h("span", {
|
|
1723
1758
|
key: 2,
|
|
1724
|
-
class: f(
|
|
1759
|
+
class: g(f(u).e("default"))
|
|
1725
1760
|
}, [
|
|
1726
|
-
|
|
1761
|
+
B(b.$slots, "default")
|
|
1727
1762
|
], 2))
|
|
1728
1763
|
], 6));
|
|
1729
1764
|
}
|
|
1730
|
-
}),
|
|
1765
|
+
}), Nt = /* @__PURE__ */ G({
|
|
1731
1766
|
name: "XDescriptions",
|
|
1732
1767
|
__name: "index",
|
|
1733
1768
|
props: {
|
|
@@ -1741,35 +1776,35 @@ const vt = /* @__PURE__ */ O({
|
|
|
1741
1776
|
colon: { type: Boolean, default: !0 }
|
|
1742
1777
|
},
|
|
1743
1778
|
setup(l) {
|
|
1744
|
-
const
|
|
1745
|
-
|
|
1746
|
-
props:
|
|
1747
|
-
column: x(() =>
|
|
1779
|
+
const o = l, r = Y("descriptions");
|
|
1780
|
+
le("x-descriptions", {
|
|
1781
|
+
props: o,
|
|
1782
|
+
column: x(() => o.column)
|
|
1748
1783
|
});
|
|
1749
|
-
const
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1784
|
+
const t = x(() => [
|
|
1785
|
+
r.b(),
|
|
1786
|
+
r.m(o.size),
|
|
1787
|
+
r.is("bordered", o.border)
|
|
1753
1788
|
]);
|
|
1754
|
-
return (
|
|
1755
|
-
class:
|
|
1789
|
+
return (u, i) => (c(), h("div", {
|
|
1790
|
+
class: g(t.value)
|
|
1756
1791
|
}, [
|
|
1757
|
-
l.title ? (c(),
|
|
1792
|
+
l.title ? (c(), h("div", {
|
|
1758
1793
|
key: 0,
|
|
1759
|
-
class: f(
|
|
1760
|
-
}, A(l.title), 3)) :
|
|
1761
|
-
|
|
1762
|
-
class: f(
|
|
1794
|
+
class: g(f(r).e("title"))
|
|
1795
|
+
}, A(l.title), 3)) : S("", !0),
|
|
1796
|
+
y("div", {
|
|
1797
|
+
class: g(f(r).e("body"))
|
|
1763
1798
|
}, [
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1799
|
+
y("table", null, [
|
|
1800
|
+
y("tbody", null, [
|
|
1801
|
+
B(u.$slots, "default")
|
|
1767
1802
|
])
|
|
1768
1803
|
])
|
|
1769
1804
|
], 2)
|
|
1770
1805
|
], 2));
|
|
1771
1806
|
}
|
|
1772
|
-
}),
|
|
1807
|
+
}), ct = ["colspan"], ut = ["colspan"], zt = /* @__PURE__ */ G({
|
|
1773
1808
|
name: "XDescriptionsItem",
|
|
1774
1809
|
__name: "DescriptionsItem",
|
|
1775
1810
|
props: {
|
|
@@ -1779,51 +1814,51 @@ const vt = /* @__PURE__ */ O({
|
|
|
1779
1814
|
contentAlign: {}
|
|
1780
1815
|
},
|
|
1781
1816
|
setup(l) {
|
|
1782
|
-
const
|
|
1817
|
+
const o = l, r = Y("descriptions-item"), t = oe("x-descriptions"), u = x(() => {
|
|
1783
1818
|
var T;
|
|
1784
|
-
const
|
|
1785
|
-
return
|
|
1786
|
-
}),
|
|
1787
|
-
var
|
|
1788
|
-
return
|
|
1789
|
-
}),
|
|
1790
|
-
var
|
|
1791
|
-
return
|
|
1819
|
+
const M = {}, C = (T = t == null ? void 0 : t.props) == null ? void 0 : T.labelWidth;
|
|
1820
|
+
return C && (M.width = typeof C == "number" ? `${C}px` : C), M;
|
|
1821
|
+
}), i = x(() => {
|
|
1822
|
+
var M;
|
|
1823
|
+
return o.labelAlign || ((M = t == null ? void 0 : t.props) == null ? void 0 : M.labelAlign) || "right";
|
|
1824
|
+
}), s = x(() => {
|
|
1825
|
+
var M;
|
|
1826
|
+
return o.contentAlign || ((M = t == null ? void 0 : t.props) == null ? void 0 : M.contentAlign) || "left";
|
|
1792
1827
|
}), k = x(() => {
|
|
1793
|
-
var
|
|
1794
|
-
return ((
|
|
1828
|
+
var M;
|
|
1829
|
+
return ((M = t == null ? void 0 : t.props) == null ? void 0 : M.colon) ?? !0;
|
|
1795
1830
|
}), b = x(() => {
|
|
1796
|
-
var
|
|
1797
|
-
return ((
|
|
1831
|
+
var M;
|
|
1832
|
+
return ((M = t == null ? void 0 : t.props) == null ? void 0 : M.border) ?? !1;
|
|
1798
1833
|
});
|
|
1799
|
-
return (
|
|
1800
|
-
|
|
1801
|
-
class:
|
|
1802
|
-
style:
|
|
1834
|
+
return (M, C) => b.value ? (c(), h(R, { key: 0 }, [
|
|
1835
|
+
y("th", {
|
|
1836
|
+
class: g([f(r).b(), f(r).e("label"), `is-${i.value}`]),
|
|
1837
|
+
style: j(u.value)
|
|
1803
1838
|
}, A(l.label) + A(k.value ? ":" : ""), 7),
|
|
1804
|
-
|
|
1805
|
-
class:
|
|
1839
|
+
y("td", {
|
|
1840
|
+
class: g([f(r).e("content"), `is-${s.value}`]),
|
|
1806
1841
|
colspan: l.span * 2 - 1
|
|
1807
1842
|
}, [
|
|
1808
|
-
|
|
1809
|
-
], 10,
|
|
1810
|
-
], 64)) : (c(),
|
|
1843
|
+
B(M.$slots, "default")
|
|
1844
|
+
], 10, ct)
|
|
1845
|
+
], 64)) : (c(), h("tr", {
|
|
1811
1846
|
key: 1,
|
|
1812
|
-
class: f(
|
|
1847
|
+
class: g(f(r).b())
|
|
1813
1848
|
}, [
|
|
1814
|
-
|
|
1815
|
-
class:
|
|
1816
|
-
style:
|
|
1849
|
+
y("th", {
|
|
1850
|
+
class: g([f(r).e("label"), `is-${i.value}`]),
|
|
1851
|
+
style: j(u.value)
|
|
1817
1852
|
}, A(l.label) + A(k.value ? ":" : ""), 7),
|
|
1818
|
-
|
|
1819
|
-
class:
|
|
1853
|
+
y("td", {
|
|
1854
|
+
class: g([f(r).e("content"), `is-${s.value}`]),
|
|
1820
1855
|
colspan: l.span * 2 - 1
|
|
1821
1856
|
}, [
|
|
1822
|
-
|
|
1823
|
-
], 10,
|
|
1857
|
+
B(M.$slots, "default")
|
|
1858
|
+
], 10, ut)
|
|
1824
1859
|
], 2));
|
|
1825
1860
|
}
|
|
1826
|
-
}), Dt = /* @__PURE__ */
|
|
1861
|
+
}), Dt = /* @__PURE__ */ G({
|
|
1827
1862
|
name: "XScrollbar",
|
|
1828
1863
|
__name: "index",
|
|
1829
1864
|
props: {
|
|
@@ -1840,90 +1875,90 @@ const vt = /* @__PURE__ */ O({
|
|
|
1840
1875
|
minSize: { default: 20 }
|
|
1841
1876
|
},
|
|
1842
1877
|
emits: ["scroll"],
|
|
1843
|
-
setup(l, { expose:
|
|
1844
|
-
const
|
|
1878
|
+
setup(l, { expose: o, emit: r }) {
|
|
1879
|
+
const t = l, u = r, i = Y("scrollbar"), s = P(), k = P(), b = P("0"), M = P("0"), C = P(0), T = P(0), L = x(() => {
|
|
1845
1880
|
const E = {};
|
|
1846
|
-
return
|
|
1847
|
-
}),
|
|
1848
|
-
if (!
|
|
1849
|
-
const E =
|
|
1850
|
-
|
|
1851
|
-
},
|
|
1852
|
-
if (!
|
|
1853
|
-
const
|
|
1854
|
-
T.value =
|
|
1881
|
+
return t.height && (E.height = typeof t.height == "number" ? `${t.height}px` : t.height), t.maxHeight && (E.maxHeight = typeof t.maxHeight == "number" ? `${t.maxHeight}px` : t.maxHeight), E;
|
|
1882
|
+
}), w = () => {
|
|
1883
|
+
if (!s.value) return;
|
|
1884
|
+
const E = s.value.offsetHeight - 4, z = s.value.offsetWidth - 4, W = s.value.scrollHeight, Z = s.value.scrollWidth, O = E / W, Q = z / Z;
|
|
1885
|
+
M.value = O >= 1 ? "0" : `${E * O}px`, b.value = Q >= 1 ? "0" : `${z * Q}px`;
|
|
1886
|
+
}, $ = (E) => {
|
|
1887
|
+
if (!s.value) return;
|
|
1888
|
+
const z = s.value.offsetHeight, W = s.value.offsetWidth;
|
|
1889
|
+
T.value = s.value.scrollTop * 100 / z, C.value = s.value.scrollLeft * 100 / W, u("scroll", E);
|
|
1855
1890
|
}, K = (E) => {
|
|
1856
|
-
var
|
|
1857
|
-
(
|
|
1891
|
+
var z;
|
|
1892
|
+
(z = s.value) == null || z.scrollTo(E);
|
|
1858
1893
|
}, N = (E) => {
|
|
1859
|
-
|
|
1860
|
-
},
|
|
1861
|
-
|
|
1894
|
+
s.value && (s.value.scrollTop = E);
|
|
1895
|
+
}, V = (E) => {
|
|
1896
|
+
s.value && (s.value.scrollLeft = E);
|
|
1862
1897
|
};
|
|
1863
|
-
let
|
|
1864
|
-
return
|
|
1865
|
-
|
|
1866
|
-
}),
|
|
1867
|
-
|
|
1868
|
-
}),
|
|
1898
|
+
let X = null;
|
|
1899
|
+
return ie(() => {
|
|
1900
|
+
t.native || (pe(w), t.noresize || (X = new ResizeObserver(w), k.value && X.observe(k.value), window.addEventListener("resize", w)));
|
|
1901
|
+
}), re(() => {
|
|
1902
|
+
X && X.disconnect(), window.removeEventListener("resize", w);
|
|
1903
|
+
}), o({
|
|
1869
1904
|
scrollTo: K,
|
|
1870
1905
|
setScrollTop: N,
|
|
1871
|
-
setScrollLeft:
|
|
1872
|
-
update:
|
|
1873
|
-
}), (E,
|
|
1874
|
-
class: f(
|
|
1906
|
+
setScrollLeft: V,
|
|
1907
|
+
update: w
|
|
1908
|
+
}), (E, z) => (c(), h("div", {
|
|
1909
|
+
class: g(f(i).b())
|
|
1875
1910
|
}, [
|
|
1876
|
-
|
|
1911
|
+
y("div", {
|
|
1877
1912
|
ref_key: "wrapRef",
|
|
1878
|
-
ref:
|
|
1879
|
-
class:
|
|
1880
|
-
style:
|
|
1881
|
-
onScroll:
|
|
1913
|
+
ref: s,
|
|
1914
|
+
class: g([f(i).e("wrap"), l.wrapClass, { [f(i).em("wrap", "hidden-default")]: !l.native }]),
|
|
1915
|
+
style: j([L.value, { overflow: l.native ? "auto" : "hidden" }]),
|
|
1916
|
+
onScroll: $
|
|
1882
1917
|
}, [
|
|
1883
|
-
(c(),
|
|
1918
|
+
(c(), se(ce(l.tag), {
|
|
1884
1919
|
ref_key: "resizeRef",
|
|
1885
1920
|
ref: k,
|
|
1886
|
-
class:
|
|
1887
|
-
style:
|
|
1921
|
+
class: g([f(i).e("view"), l.viewClass]),
|
|
1922
|
+
style: j(l.viewStyle)
|
|
1888
1923
|
}, {
|
|
1889
|
-
default:
|
|
1890
|
-
|
|
1924
|
+
default: he(() => [
|
|
1925
|
+
B(E.$slots, "default")
|
|
1891
1926
|
]),
|
|
1892
1927
|
_: 3
|
|
1893
1928
|
}, 8, ["class", "style"]))
|
|
1894
1929
|
], 38),
|
|
1895
|
-
!l.native &&
|
|
1930
|
+
!l.native && M.value ? (c(), h("div", {
|
|
1896
1931
|
key: 0,
|
|
1897
|
-
class:
|
|
1898
|
-
style:
|
|
1899
|
-
}, null, 6)) :
|
|
1900
|
-
!l.native && b.value ? (c(),
|
|
1932
|
+
class: g([f(i).e("bar"), f(i).is("vertical")]),
|
|
1933
|
+
style: j({ height: M.value, top: `${T.value}%` })
|
|
1934
|
+
}, null, 6)) : S("", !0),
|
|
1935
|
+
!l.native && b.value ? (c(), h("div", {
|
|
1901
1936
|
key: 1,
|
|
1902
|
-
class:
|
|
1903
|
-
style:
|
|
1904
|
-
}, null, 6)) :
|
|
1937
|
+
class: g([f(i).e("bar"), f(i).is("horizontal")]),
|
|
1938
|
+
style: j({ width: b.value, left: `${C.value}%` })
|
|
1939
|
+
}, null, 6)) : S("", !0)
|
|
1905
1940
|
], 2));
|
|
1906
1941
|
}
|
|
1907
1942
|
});
|
|
1908
1943
|
export {
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1944
|
+
Kt as Avatar,
|
|
1945
|
+
gt as Card,
|
|
1946
|
+
Ct as Carousel,
|
|
1947
|
+
wt as CarouselItem,
|
|
1948
|
+
Nt as Descriptions,
|
|
1949
|
+
zt as DescriptionsItem,
|
|
1950
|
+
vt as DynamicTable,
|
|
1951
|
+
kt as Empty,
|
|
1952
|
+
Ne as Pagination,
|
|
1918
1953
|
yt as Progress,
|
|
1919
1954
|
Dt as Scrollbar,
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1955
|
+
It as Table,
|
|
1956
|
+
$t as TableColumn,
|
|
1957
|
+
pt as Tag,
|
|
1958
|
+
xt as Timeline,
|
|
1924
1959
|
bt as TimelineItem,
|
|
1925
|
-
|
|
1960
|
+
mt as Tree,
|
|
1926
1961
|
te as TreeNode,
|
|
1927
1962
|
Mt as TreeTable,
|
|
1928
|
-
|
|
1963
|
+
St as TreeTableColumn
|
|
1929
1964
|
};
|