@xto/data 1.0.2 → 1.1.1

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