@xto/form 1.1.1 → 1.1.2

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 Z, ref as E, useSlots as Ae, computed as h, openBlock as i, createElementBlock as c, normalizeClass as u, unref as s, renderSlot as le, createElementVNode as f, toDisplayString as z, createCommentVNode as N, withDirectives as ve, vModelDynamic as ze, watch as ce, normalizeStyle as ae, vModelText as Te, inject as we, withModifiers as ue, createTextVNode as fe, provide as Ve, toRef as He, onMounted as ye, onUnmounted as ke, Fragment as j, renderList as _, createBlock as he, Teleport as Re, createVNode as xe, Transition as Be, withCtx as Fe, vShow as Ie, nextTick as Ce } from "vue";
2
- import { useNamespace as Q, useZIndex as Le } from "@xto/core";
3
- const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minlength"], nl = /* @__PURE__ */ Z({
1
+ import { defineComponent as Q, ref as A, useSlots as Ee, computed as b, openBlock as r, createElementBlock as c, normalizeClass as u, unref as s, renderSlot as le, createElementVNode as d, toDisplayString as Y, createCommentVNode as H, withDirectives as oe, vModelDynamic as He, watch as ie, normalizeStyle as ae, vModelText as ge, inject as Ve, withModifiers as ue, createTextVNode as fe, provide as Ce, toRef as Oe, onMounted as ke, onUnmounted as xe, Fragment as G, renderList as Z, createBlock as he, Teleport as Re, createVNode as we, Transition as Be, withCtx as Fe, vShow as Ie, nextTick as De, vModelSelect as Pe } from "vue";
2
+ import { useNamespace as J, useZIndex as Le } from "@xto/core";
3
+ const Ne = ["type", "placeholder", "disabled", "readonly", "maxlength", "minlength"], wl = /* @__PURE__ */ Q({
4
4
  name: "XInput",
5
5
  __name: "index",
6
6
  props: {
@@ -20,97 +20,97 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
20
20
  suffixIcon: {}
21
21
  },
22
22
  emits: ["update:modelValue", "update:value", "input", "change", "focus", "blur", "clear"],
23
- setup(n, { expose: p, emit: e }) {
24
- const t = n, l = e, a = Q("input"), g = E(), v = E(!1), w = E(!1), k = Ae(), L = h(
25
- () => t.type === "password" && t.showPassword && !t.disabled
26
- ), D = h(() => L.value ? w.value ? "text" : "password" : t.type), x = h({
27
- get: () => t.modelValue !== void 0 ? t.modelValue : t.value !== void 0 ? t.value : "",
28
- set: (B) => {
29
- l("update:modelValue", B), l("update:value", B), l("input", B);
23
+ setup(n, { expose: g, emit: t }) {
24
+ const e = n, a = t, l = J("input"), m = A(), p = A(!1), C = A(!1), w = Ee(), L = b(
25
+ () => e.type === "password" && e.showPassword && !e.disabled
26
+ ), S = b(() => L.value ? C.value ? "text" : "password" : e.type), V = b({
27
+ get: () => e.modelValue !== void 0 ? e.modelValue : e.value !== void 0 ? e.value : "",
28
+ set: (k) => {
29
+ a("update:modelValue", k), a("update:value", k), a("input", k);
30
30
  }
31
- }), C = h(() => String(x.value).length), I = h(() => [
32
- a.b(),
33
- t.size !== "default" ? a.m(t.size) : "",
34
- a.is("disabled", t.disabled),
35
- a.is("focus", v.value),
36
- a.is("has-prefix", t.prefixIcon || k.prefix),
37
- a.is("has-suffix", t.suffixIcon || k.suffix || t.clearable || L.value || t.showWordLimit)
38
- ]), d = (B) => {
39
- const K = B.target.value;
40
- l("change", K);
41
- }, V = (B) => {
42
- v.value = !0, l("focus", B);
43
- }, M = (B) => {
44
- v.value = !1, l("blur", B);
45
- }, S = () => {
46
- l("update:modelValue", ""), l("update:value", ""), l("clear");
31
+ }), $ = b(() => String(V.value).length), F = b(() => [
32
+ l.b(),
33
+ e.size !== "default" ? l.m(e.size) : "",
34
+ l.is("disabled", e.disabled),
35
+ l.is("focus", p.value),
36
+ l.is("has-prefix", e.prefixIcon || w.prefix),
37
+ l.is("has-suffix", e.suffixIcon || w.suffix || e.clearable || L.value || e.showWordLimit)
38
+ ]), v = (k) => {
39
+ const N = k.target.value;
40
+ a("change", N);
41
+ }, D = (k) => {
42
+ p.value = !0, a("focus", k);
43
+ }, T = (k) => {
44
+ p.value = !1, a("blur", k);
45
+ }, M = () => {
46
+ a("update:modelValue", ""), a("update:value", ""), a("clear");
47
47
  }, P = () => {
48
- w.value = !w.value;
48
+ C.value = !C.value;
49
49
  };
50
- return p({
50
+ return g({
51
51
  focus: () => {
52
- var B;
53
- (B = g.value) == null || B.focus();
52
+ var k;
53
+ (k = m.value) == null || k.focus();
54
54
  },
55
55
  blur: () => {
56
- var B;
57
- (B = g.value) == null || B.blur();
56
+ var k;
57
+ (k = m.value) == null || k.blur();
58
58
  },
59
- inputRef: g
60
- }), (B, K) => (i(), c("div", {
61
- class: u(I.value)
59
+ inputRef: m
60
+ }), (k, N) => (r(), c("div", {
61
+ class: u(F.value)
62
62
  }, [
63
- B.$slots.prefix || n.prefixIcon ? (i(), c("span", {
63
+ k.$slots.prefix || n.prefixIcon ? (r(), c("span", {
64
64
  key: 0,
65
- class: u(s(a).e("prefix"))
65
+ class: u(s(l).e("prefix"))
66
66
  }, [
67
- le(B.$slots, "prefix", {}, () => [
68
- f("span", {
69
- class: u(s(a).e("icon"))
70
- }, z(n.prefixIcon), 3)
67
+ le(k.$slots, "prefix", {}, () => [
68
+ d("span", {
69
+ class: u(s(l).e("icon"))
70
+ }, Y(n.prefixIcon), 3)
71
71
  ])
72
- ], 2)) : N("", !0),
73
- ve(f("input", {
72
+ ], 2)) : H("", !0),
73
+ oe(d("input", {
74
74
  ref_key: "inputRef",
75
- ref: g,
76
- "onUpdate:modelValue": K[0] || (K[0] = (X) => x.value = X),
77
- type: D.value,
75
+ ref: m,
76
+ "onUpdate:modelValue": N[0] || (N[0] = (X) => V.value = X),
77
+ type: S.value,
78
78
  placeholder: n.placeholder,
79
79
  disabled: n.disabled,
80
80
  readonly: n.readonly,
81
81
  maxlength: n.maxlength,
82
82
  minlength: n.minlength,
83
- class: u(s(a).e("inner")),
84
- onChange: d,
85
- onFocus: V,
86
- onBlur: M
87
- }, null, 42, Oe), [
88
- [ze, x.value]
83
+ class: u(s(l).e("inner")),
84
+ onChange: v,
85
+ onFocus: D,
86
+ onBlur: T
87
+ }, null, 42, Ne), [
88
+ [He, V.value]
89
89
  ]),
90
- B.$slots.suffix || n.suffixIcon || n.clearable || L.value || n.showWordLimit ? (i(), c("span", {
90
+ k.$slots.suffix || n.suffixIcon || n.clearable || L.value || n.showWordLimit ? (r(), c("span", {
91
91
  key: 1,
92
- class: u(s(a).e("suffix"))
92
+ class: u(s(l).e("suffix"))
93
93
  }, [
94
- le(B.$slots, "suffix", {}, () => [
95
- n.clearable && x.value && !n.disabled ? (i(), c("span", {
94
+ le(k.$slots, "suffix", {}, () => [
95
+ n.clearable && V.value && !n.disabled ? (r(), c("span", {
96
96
  key: 0,
97
- class: u([s(a).e("icon"), s(a).e("clear")]),
98
- onClick: S
99
- }, " ✕ ", 2)) : N("", !0),
100
- L.value ? (i(), c("span", {
97
+ class: u([s(l).e("icon"), s(l).e("clear")]),
98
+ onClick: M
99
+ }, " ✕ ", 2)) : H("", !0),
100
+ L.value ? (r(), c("span", {
101
101
  key: 1,
102
- class: u([s(a).e("icon"), s(a).e("password")]),
102
+ class: u([s(l).e("icon"), s(l).e("password")]),
103
103
  onClick: P
104
- }, z(w.value ? "🙈" : "👁️"), 3)) : N("", !0),
105
- n.showWordLimit && n.maxlength ? (i(), c("span", {
104
+ }, Y(C.value ? "🙈" : "👁️"), 3)) : H("", !0),
105
+ n.showWordLimit && n.maxlength ? (r(), c("span", {
106
106
  key: 2,
107
- class: u(s(a).e("count"))
108
- }, z(C.value) + "/" + z(n.maxlength), 3)) : N("", !0)
107
+ class: u(s(l).e("count"))
108
+ }, Y($.value) + "/" + Y(n.maxlength), 3)) : H("", !0)
109
109
  ])
110
- ], 2)) : N("", !0)
110
+ ], 2)) : H("", !0)
111
111
  ], 2));
112
112
  }
113
- }), Ne = ["disabled"], Ke = ["value", "placeholder", "disabled"], Xe = ["disabled"], sl = /* @__PURE__ */ Z({
113
+ }), Ue = ["disabled"], Xe = ["value", "placeholder", "disabled"], Ke = ["disabled"], Vl = /* @__PURE__ */ Q({
114
114
  name: "XInputNumber",
115
115
  __name: "index",
116
116
  props: {
@@ -128,152 +128,152 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
128
128
  valueOnClear: { default: null }
129
129
  },
130
130
  emits: ["update:modelValue", "change", "focus", "blur"],
131
- setup(n, { expose: p, emit: e }) {
132
- const t = n, l = e, a = Q("input-number"), g = E(), v = E(!1), w = E(null), k = E(t.modelValue), L = h(() => {
133
- if (t.precision !== void 0)
134
- return t.precision;
135
- const o = D(t.step), r = t.modelValue !== void 0 ? D(t.modelValue) : 0;
136
- return Math.max(o, r);
131
+ setup(n, { expose: g, emit: t }) {
132
+ const e = n, a = t, l = J("input-number"), m = A(), p = A(!1), C = A(null), w = A(e.modelValue), L = b(() => {
133
+ if (e.precision !== void 0)
134
+ return e.precision;
135
+ const o = S(e.step), i = e.modelValue !== void 0 ? S(e.modelValue) : 0;
136
+ return Math.max(o, i);
137
137
  });
138
- function D(o) {
139
- const r = o.toString(), m = r.indexOf(".");
140
- return m === -1 ? 0 : r.length - m - 1;
138
+ function S(o) {
139
+ const i = o.toString(), y = i.indexOf(".");
140
+ return y === -1 ? 0 : i.length - y - 1;
141
141
  }
142
- function x(o, r = L.value) {
143
- if (r === 0) return Math.round(o);
144
- let m = o.toFixed(r);
145
- return Number(m);
142
+ function V(o, i = L.value) {
143
+ if (i === 0) return Math.round(o);
144
+ let y = o.toFixed(i);
145
+ return Number(y);
146
146
  }
147
- function C(o) {
148
- return o > t.max ? t.max : o < t.min ? t.min : o;
147
+ function $(o) {
148
+ return o > e.max ? e.max : o < e.min ? e.min : o;
149
149
  }
150
- const I = h(() => t.modelValue), d = h(() => w.value !== null ? w.value : I.value === void 0 ? "" : x(I.value)), V = h(() => t.disabled ? !0 : I.value === void 0 ? t.min !== -1 / 0 : I.value <= t.min), M = h(() => t.disabled ? !0 : I.value === void 0 ? t.max !== 1 / 0 : I.value >= t.max), S = h(() => [
151
- a.b(),
152
- t.size !== "default" ? a.m(t.size) : "",
153
- a.is("disabled", t.disabled),
154
- a.is("focus", v.value),
155
- t.controlsPosition ? a.m(t.controlsPosition) : ""
150
+ const F = b(() => e.modelValue), v = b(() => C.value !== null ? C.value : F.value === void 0 ? "" : V(F.value)), D = b(() => e.disabled ? !0 : F.value === void 0 ? e.min !== -1 / 0 : F.value <= e.min), T = b(() => e.disabled ? !0 : F.value === void 0 ? e.max !== 1 / 0 : F.value >= e.max), M = b(() => [
151
+ l.b(),
152
+ e.size !== "default" ? l.m(e.size) : "",
153
+ l.is("disabled", e.disabled),
154
+ l.is("focus", p.value),
155
+ e.controlsPosition ? l.m(e.controlsPosition) : ""
156
156
  ]);
157
157
  function P() {
158
- if (t.disabled || M.value) return;
159
- const o = I.value ?? (t.min === -1 / 0 ? 0 : t.min), r = x(o + t.step), m = C(r);
160
- T(m);
158
+ if (e.disabled || T.value) return;
159
+ const o = F.value ?? (e.min === -1 / 0 ? 0 : e.min), i = V(o + e.step), y = $(i);
160
+ f(y);
161
161
  }
162
- function b() {
163
- if (t.disabled || V.value) return;
164
- const o = I.value ?? (t.min === -1 / 0 ? 0 : t.min), r = x(o - t.step), m = C(r);
165
- T(m);
162
+ function h() {
163
+ if (e.disabled || D.value) return;
164
+ const o = F.value ?? (e.min === -1 / 0 ? 0 : e.min), i = V(o - e.step), y = $(i);
165
+ f(y);
166
166
  }
167
- function T(o) {
168
- const r = k.value;
167
+ function f(o) {
168
+ const i = w.value;
169
169
  if (o === void 0)
170
- l("update:modelValue", void 0), l("change", void 0, r);
170
+ a("update:modelValue", void 0), a("change", void 0, i);
171
171
  else {
172
- const m = x(o), O = C(m);
173
- if (t.stepStrictly) {
174
- const te = Math.round((O - t.min) / t.step), A = x(t.min + te * t.step);
175
- l("update:modelValue", A), l("change", A, r);
172
+ const y = V(o), U = $(y);
173
+ if (e.stepStrictly) {
174
+ const te = Math.round((U - e.min) / e.step), E = V(e.min + te * e.step);
175
+ a("update:modelValue", E), a("change", E, i);
176
176
  } else
177
- l("update:modelValue", O), l("change", O, r);
177
+ a("update:modelValue", U), a("change", U, i);
178
178
  }
179
- k.value = t.modelValue, w.value = null;
179
+ w.value = e.modelValue, C.value = null;
180
180
  }
181
- function B(o) {
181
+ function k(o) {
182
182
  if (o === "" || o === "-")
183
183
  return;
184
- let r = o.replace(/[^\d.-]/g, "");
185
- const m = r.split(".");
186
- m.length > 2 && (r = m[0] + "." + m.slice(1).join("")), r.indexOf("-") > 0 && (r = r.replace(/-/g, "")), r.lastIndexOf("-") > 0 && (r = "-" + r.replace(/-/g, ""));
187
- const O = Number(r);
188
- if (!isNaN(O))
189
- return O;
184
+ let i = o.replace(/[^\d.-]/g, "");
185
+ const y = i.split(".");
186
+ y.length > 2 && (i = y[0] + "." + y.slice(1).join("")), i.indexOf("-") > 0 && (i = i.replace(/-/g, "")), i.lastIndexOf("-") > 0 && (i = "-" + i.replace(/-/g, ""));
187
+ const U = Number(i);
188
+ if (!isNaN(U))
189
+ return U;
190
190
  }
191
- function K(o) {
192
- const r = o.target.value;
193
- w.value = r;
191
+ function N(o) {
192
+ const i = o.target.value;
193
+ C.value = i;
194
194
  }
195
195
  function X(o) {
196
- if (v.value = !1, w.value !== null) {
197
- const r = B(w.value);
198
- r === void 0 ? t.valueOnClear !== null ? T(t.valueOnClear) : w.value = null : T(r);
196
+ if (p.value = !1, C.value !== null) {
197
+ const i = k(C.value);
198
+ i === void 0 ? e.valueOnClear !== null ? f(e.valueOnClear) : C.value = null : f(i);
199
199
  }
200
- l("blur", o);
200
+ a("blur", o);
201
201
  }
202
- function q(o) {
203
- v.value = !0, k.value = t.modelValue, l("focus", o);
202
+ function j(o) {
203
+ p.value = !0, w.value = e.modelValue, a("focus", o);
204
204
  }
205
- function J(o) {
206
- var r;
207
- if (!t.disabled)
205
+ function _(o) {
206
+ var i;
207
+ if (!e.disabled)
208
208
  switch (o.key) {
209
209
  case "ArrowUp":
210
210
  o.preventDefault(), P();
211
211
  break;
212
212
  case "ArrowDown":
213
- o.preventDefault(), b();
213
+ o.preventDefault(), h();
214
214
  break;
215
215
  case "Enter":
216
- (r = g.value) == null || r.blur();
216
+ (i = m.value) == null || i.blur();
217
217
  break;
218
218
  }
219
219
  }
220
- function $() {
221
- w.value = null, t.valueOnClear !== null && t.valueOnClear !== void 0 ? T(t.valueOnClear) : (l("update:modelValue", void 0), l("change", void 0, k.value), k.value = void 0);
222
- }
223
220
  function R() {
221
+ C.value = null, e.valueOnClear !== null && e.valueOnClear !== void 0 ? f(e.valueOnClear) : (a("update:modelValue", void 0), a("change", void 0, w.value), w.value = void 0);
222
+ }
223
+ function B() {
224
224
  var o;
225
- (o = g.value) == null || o.focus();
225
+ (o = m.value) == null || o.focus();
226
226
  }
227
- function y() {
227
+ function x() {
228
228
  var o;
229
- (o = g.value) == null || o.blur();
229
+ (o = m.value) == null || o.blur();
230
230
  }
231
- return ce(() => t.modelValue, (o) => {
232
- k.value = o, w.value = null;
233
- }, { immediate: !0 }), p({
234
- focus: R,
235
- blur: y,
236
- clear: $,
231
+ return ie(() => e.modelValue, (o) => {
232
+ w.value = o, C.value = null;
233
+ }, { immediate: !0 }), g({
234
+ focus: B,
235
+ blur: x,
236
+ clear: R,
237
237
  increase: P,
238
- decrease: b
239
- }), (o, r) => (i(), c("div", {
240
- class: u(S.value)
238
+ decrease: h
239
+ }), (o, i) => (r(), c("div", {
240
+ class: u(M.value)
241
241
  }, [
242
- n.controls ? (i(), c("button", {
242
+ n.controls ? (r(), c("button", {
243
243
  key: 0,
244
244
  type: "button",
245
- class: u([s(a).e("decrease"), s(a).is("disabled", V.value)]),
246
- disabled: V.value,
247
- onClick: b
248
- }, " − ", 10, Ne)) : N("", !0),
249
- f("div", {
250
- class: u(s(a).e("wrapper"))
245
+ class: u([s(l).e("decrease"), s(l).is("disabled", D.value)]),
246
+ disabled: D.value,
247
+ onClick: h
248
+ }, " − ", 10, Ue)) : H("", !0),
249
+ d("div", {
250
+ class: u(s(l).e("wrapper"))
251
251
  }, [
252
- f("input", {
252
+ d("input", {
253
253
  ref_key: "inputRef",
254
- ref: g,
255
- value: d.value,
254
+ ref: m,
255
+ value: v.value,
256
256
  placeholder: n.placeholder,
257
257
  disabled: n.disabled,
258
- class: u(s(a).e("inner")),
258
+ class: u(s(l).e("inner")),
259
259
  type: "text",
260
260
  autocomplete: "off",
261
- onInput: K,
262
- onFocus: q,
261
+ onInput: N,
262
+ onFocus: j,
263
263
  onBlur: X,
264
- onKeydown: J
265
- }, null, 42, Ke)
264
+ onKeydown: _
265
+ }, null, 42, Xe)
266
266
  ], 2),
267
- n.controls ? (i(), c("button", {
267
+ n.controls ? (r(), c("button", {
268
268
  key: 1,
269
269
  type: "button",
270
- class: u([s(a).e("increase"), s(a).is("disabled", M.value)]),
271
- disabled: M.value,
270
+ class: u([s(l).e("increase"), s(l).is("disabled", T.value)]),
271
+ disabled: T.value,
272
272
  onClick: P
273
- }, " + ", 10, Xe)) : N("", !0)
273
+ }, " + ", 10, Ke)) : H("", !0)
274
274
  ], 2));
275
275
  }
276
- }), Ue = ["placeholder", "disabled", "readonly", "maxlength", "minlength", "rows"], ul = /* @__PURE__ */ Z({
276
+ }), We = ["placeholder", "disabled", "readonly", "maxlength", "minlength", "rows"], Cl = /* @__PURE__ */ Q({
277
277
  name: "XTextarea",
278
278
  __name: "index",
279
279
  props: {
@@ -290,52 +290,52 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
290
290
  resize: { default: "vertical" }
291
291
  },
292
292
  emits: ["update:modelValue", "update:value", "input", "change", "focus", "blur"],
293
- setup(n, { expose: p, emit: e }) {
294
- const t = n, l = e, a = Q("textarea"), g = E(), v = E(!1), w = h({
295
- get: () => t.modelValue !== void 0 ? t.modelValue : t.value !== void 0 ? t.value : "",
296
- set: (S) => {
297
- l("update:modelValue", S), l("update:value", S), l("input", S);
293
+ setup(n, { expose: g, emit: t }) {
294
+ const e = n, a = t, l = J("textarea"), m = A(), p = A(!1), C = b({
295
+ get: () => e.modelValue !== void 0 ? e.modelValue : e.value !== void 0 ? e.value : "",
296
+ set: (M) => {
297
+ a("update:modelValue", M), a("update:value", M), a("input", M);
298
298
  }
299
- }), k = h(() => String(w.value).length), L = h(() => {
300
- const S = {};
301
- if (t.resize && (S.resize = t.resize), t.autosize && (S.minHeight = "auto", typeof t.autosize == "object")) {
302
- const P = t.autosize.minRows || 1, b = t.autosize.maxRows;
303
- S.minHeight = `${P * 22 + 12}px`, b && (S.maxHeight = `${b * 22 + 12}px`);
299
+ }), w = b(() => String(C.value).length), L = b(() => {
300
+ const M = {};
301
+ if (e.resize && (M.resize = e.resize), e.autosize && (M.minHeight = "auto", typeof e.autosize == "object")) {
302
+ const P = e.autosize.minRows || 1, h = e.autosize.maxRows;
303
+ M.minHeight = `${P * 22 + 12}px`, h && (M.maxHeight = `${h * 22 + 12}px`);
304
304
  }
305
- return S;
306
- }), D = h(() => [
307
- a.b(),
308
- a.is("disabled", t.disabled),
309
- a.is("focus", v.value),
310
- a.is("exceed", t.maxlength && k.value > t.maxlength)
311
- ]), x = () => {
312
- t.autosize && g.value && (g.value.style.height = "auto", g.value.style.height = `${g.value.scrollHeight}px`);
313
- }, C = (S) => {
314
- const P = S.target.value;
315
- l("change", P);
316
- }, I = (S) => {
317
- v.value = !0, l("focus", S);
318
- }, d = (S) => {
319
- v.value = !1, l("blur", S);
305
+ return M;
306
+ }), S = b(() => [
307
+ l.b(),
308
+ l.is("disabled", e.disabled),
309
+ l.is("focus", p.value),
310
+ l.is("exceed", e.maxlength && w.value > e.maxlength)
311
+ ]), V = () => {
312
+ e.autosize && m.value && (m.value.style.height = "auto", m.value.style.height = `${m.value.scrollHeight}px`);
313
+ }, $ = (M) => {
314
+ const P = M.target.value;
315
+ a("change", P);
316
+ }, F = (M) => {
317
+ p.value = !0, a("focus", M);
318
+ }, v = (M) => {
319
+ p.value = !1, a("blur", M);
320
320
  };
321
- return p({
321
+ return g({
322
322
  focus: () => {
323
- var S;
324
- (S = g.value) == null || S.focus();
323
+ var M;
324
+ (M = m.value) == null || M.focus();
325
325
  },
326
326
  blur: () => {
327
- var S;
328
- (S = g.value) == null || S.blur();
327
+ var M;
328
+ (M = m.value) == null || M.blur();
329
329
  },
330
- textareaRef: g
331
- }), (S, P) => (i(), c("div", {
332
- class: u(D.value),
330
+ textareaRef: m
331
+ }), (M, P) => (r(), c("div", {
332
+ class: u(S.value),
333
333
  style: ae(n.disabled ? void 0 : { cursor: "text" })
334
334
  }, [
335
- ve(f("textarea", {
335
+ oe(d("textarea", {
336
336
  ref_key: "textareaRef",
337
- ref: g,
338
- "onUpdate:modelValue": P[0] || (P[0] = (b) => w.value = b),
337
+ ref: m,
338
+ "onUpdate:modelValue": P[0] || (P[0] = (h) => C.value = h),
339
339
  placeholder: n.placeholder,
340
340
  disabled: n.disabled,
341
341
  readonly: n.readonly,
@@ -343,21 +343,21 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
343
343
  minlength: n.minlength,
344
344
  rows: n.rows,
345
345
  style: ae(L.value),
346
- class: u(s(a).e("inner")),
347
- onInput: x,
348
- onChange: C,
349
- onFocus: I,
350
- onBlur: d
351
- }, null, 46, Ue), [
352
- [Te, w.value]
346
+ class: u(s(l).e("inner")),
347
+ onInput: V,
348
+ onChange: $,
349
+ onFocus: F,
350
+ onBlur: v
351
+ }, null, 46, We), [
352
+ [ge, C.value]
353
353
  ]),
354
- n.showWordLimit && n.maxlength ? (i(), c("span", {
354
+ n.showWordLimit && n.maxlength ? (r(), c("span", {
355
355
  key: 0,
356
- class: u(s(a).e("count"))
357
- }, z(k.value) + "/" + z(n.maxlength), 3)) : N("", !0)
356
+ class: u(s(l).e("count"))
357
+ }, Y(w.value) + "/" + Y(n.maxlength), 3)) : H("", !0)
358
358
  ], 6));
359
359
  }
360
- }), ol = /* @__PURE__ */ Z({
360
+ }), Dl = /* @__PURE__ */ Q({
361
361
  name: "XSwitch",
362
362
  __name: "index",
363
363
  props: {
@@ -370,37 +370,37 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
370
370
  inactiveValue: { type: [Boolean, Number, String], default: !1 }
371
371
  },
372
372
  emits: ["update:modelValue", "change"],
373
- setup(n, { emit: p }) {
374
- const e = n, t = p, l = Q("switch"), a = h(() => e.modelValue === e.activeValue), g = h(() => [
375
- l.b(),
376
- l.is("disabled", e.disabled),
377
- l.is("checked", a.value)
378
- ]), v = h(() => ({
379
- width: typeof e.width == "number" ? `${e.width}px` : e.width,
373
+ setup(n, { emit: g }) {
374
+ const t = n, e = g, a = J("switch"), l = b(() => t.modelValue === t.activeValue), m = b(() => [
375
+ a.b(),
376
+ a.is("disabled", t.disabled),
377
+ a.is("checked", l.value)
378
+ ]), p = b(() => ({
379
+ width: typeof t.width == "number" ? `${t.width}px` : t.width,
380
380
  height: "20px",
381
- backgroundColor: a.value ? e.activeColor : e.inactiveColor
382
- })), w = () => {
383
- if (e.disabled) return;
384
- const k = a.value ? e.inactiveValue : e.activeValue;
385
- t("update:modelValue", k), t("change", k);
381
+ backgroundColor: l.value ? t.activeColor : t.inactiveColor
382
+ })), C = () => {
383
+ if (t.disabled) return;
384
+ const w = l.value ? t.inactiveValue : t.activeValue;
385
+ e("update:modelValue", w), e("change", w);
386
386
  };
387
- return (k, L) => (i(), c("span", {
388
- class: u(g.value),
389
- onClick: w
387
+ return (w, L) => (r(), c("span", {
388
+ class: u(m.value),
389
+ onClick: C
390
390
  }, [
391
- f("span", {
392
- class: u(s(l).e("core")),
393
- style: ae(v.value)
391
+ d("span", {
392
+ class: u(s(a).e("core")),
393
+ style: ae(p.value)
394
394
  }, null, 6),
395
- k.$slots.default ? (i(), c("span", {
395
+ w.$slots.default ? (r(), c("span", {
396
396
  key: 0,
397
- class: u(s(l).e("text"))
397
+ class: u(s(a).e("text"))
398
398
  }, [
399
- le(k.$slots, "default")
400
- ], 2)) : N("", !0)
399
+ le(w.$slots, "default")
400
+ ], 2)) : H("", !0)
401
401
  ], 2));
402
402
  }
403
- }), We = ["checked", "disabled", "name", "value"], rl = /* @__PURE__ */ Z({
403
+ }), qe = ["checked", "disabled", "name", "value"], $l = /* @__PURE__ */ Q({
404
404
  name: "XRadio",
405
405
  __name: "index",
406
406
  props: {
@@ -411,40 +411,40 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
411
411
  name: {}
412
412
  },
413
413
  emits: ["update:modelValue", "change"],
414
- setup(n, { emit: p }) {
415
- const e = n, t = p, l = Q("radio"), a = we("radioGroup", null), g = h(() => !!a), v = h(() => g.value ? a.modelValue.value : e.modelValue), w = h(() => e.value ?? e.label), k = h(() => v.value === w.value), L = h(() => e.disabled || g.value && a.disabled), D = h(() => e.name || (g.value ? a.name : void 0)), x = h(() => [
416
- l.b(),
417
- l.is("checked", k.value),
418
- l.is("disabled", L.value)
419
- ]), C = () => {
420
- L.value || (g.value ? a.changeValue(w.value) : (t("update:modelValue", w.value), t("change", w.value)));
414
+ setup(n, { emit: g }) {
415
+ const t = n, e = g, a = J("radio"), l = Ve("radioGroup", null), m = b(() => !!l), p = b(() => m.value ? l.modelValue.value : t.modelValue), C = b(() => t.value ?? t.label), w = b(() => p.value === C.value), L = b(() => t.disabled || m.value && l.disabled), S = b(() => t.name || (m.value ? l.name : void 0)), V = b(() => [
416
+ a.b(),
417
+ a.is("checked", w.value),
418
+ a.is("disabled", L.value)
419
+ ]), $ = () => {
420
+ L.value || (m.value ? l.changeValue(C.value) : (e("update:modelValue", C.value), e("change", C.value)));
421
421
  };
422
- return (I, d) => (i(), c("label", {
423
- class: u(x.value),
424
- onClick: ue(C, ["prevent"])
422
+ return (F, v) => (r(), c("label", {
423
+ class: u(V.value),
424
+ onClick: ue($, ["prevent"])
425
425
  }, [
426
- f("span", {
427
- class: u(s(l).e("input"))
426
+ d("span", {
427
+ class: u(s(a).e("input"))
428
428
  }, [
429
- f("input", {
429
+ d("input", {
430
430
  type: "radio",
431
- checked: k.value,
431
+ checked: w.value,
432
432
  disabled: L.value,
433
- name: D.value,
434
- value: w.value
435
- }, null, 8, We)
433
+ name: S.value,
434
+ value: C.value
435
+ }, null, 8, qe)
436
436
  ], 2),
437
- I.$slots.default || n.label ? (i(), c("span", {
437
+ F.$slots.default || n.label ? (r(), c("span", {
438
438
  key: 0,
439
- class: u(s(l).e("label"))
439
+ class: u(s(a).e("label"))
440
440
  }, [
441
- le(I.$slots, "default", {}, () => [
442
- fe(z(n.label), 1)
441
+ le(F.$slots, "default", {}, () => [
442
+ fe(Y(n.label), 1)
443
443
  ])
444
- ], 2)) : N("", !0)
444
+ ], 2)) : H("", !0)
445
445
  ], 2));
446
446
  }
447
- }), il = /* @__PURE__ */ Z({
447
+ }), Sl = /* @__PURE__ */ Q({
448
448
  name: "XRadioGroup",
449
449
  __name: "group",
450
450
  props: {
@@ -453,23 +453,23 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
453
453
  name: {}
454
454
  },
455
455
  emits: ["update:modelValue", "change"],
456
- setup(n, { emit: p }) {
457
- const e = n, t = p, l = Q("radio-group"), a = (g) => {
458
- t("update:modelValue", g), t("change", g);
456
+ setup(n, { emit: g }) {
457
+ const t = n, e = g, a = J("radio-group"), l = (m) => {
458
+ e("update:modelValue", m), e("change", m);
459
459
  };
460
- return Ve("radioGroup", {
461
- modelValue: h(() => e.modelValue),
462
- name: e.name || `radio-group-${Date.now()}`,
463
- disabled: e.disabled,
464
- changeValue: a
465
- }), (g, v) => (i(), c("div", {
466
- class: u(s(l).b()),
460
+ return Ce("radioGroup", {
461
+ modelValue: b(() => t.modelValue),
462
+ name: t.name || `radio-group-${Date.now()}`,
463
+ disabled: t.disabled,
464
+ changeValue: l
465
+ }), (m, p) => (r(), c("div", {
466
+ class: u(s(a).b()),
467
467
  role: "radiogroup"
468
468
  }, [
469
- le(g.$slots, "default")
469
+ le(m.$slots, "default")
470
470
  ], 2));
471
471
  }
472
- }), Ge = ["checked", "disabled", "value"], cl = /* @__PURE__ */ Z({
472
+ }), Ge = ["checked", "disabled", "value"], Ml = /* @__PURE__ */ Q({
473
473
  name: "XRadioButton",
474
474
  __name: "button",
475
475
  props: {
@@ -479,35 +479,35 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
479
479
  name: {}
480
480
  },
481
481
  emits: ["update:modelValue", "change"],
482
- setup(n, { emit: p }) {
483
- const e = n, t = Q("radio-button"), l = we("radioGroup", null), a = h(() => !!l), g = h(() => a.value ? l.modelValue.value : null), v = h(() => e.value ?? e.label), w = h(() => g.value === v.value), k = h(() => e.disabled || a.value && l.disabled), L = h(() => [
484
- t.b(),
485
- t.is("active", w.value),
486
- t.is("disabled", k.value)
487
- ]), D = () => {
488
- k.value || a.value && l.changeValue(v.value);
482
+ setup(n, { emit: g }) {
483
+ const t = n, e = J("radio-button"), a = Ve("radioGroup", null), l = b(() => !!a), m = b(() => l.value ? a.modelValue.value : null), p = b(() => t.value ?? t.label), C = b(() => m.value === p.value), w = b(() => t.disabled || l.value && a.disabled), L = b(() => [
484
+ e.b(),
485
+ e.is("active", C.value),
486
+ e.is("disabled", w.value)
487
+ ]), S = () => {
488
+ w.value || l.value && a.changeValue(p.value);
489
489
  };
490
- return (x, C) => (i(), c("label", {
490
+ return (V, $) => (r(), c("label", {
491
491
  class: u(L.value),
492
- onClick: ue(D, ["prevent"])
492
+ onClick: ue(S, ["prevent"])
493
493
  }, [
494
- f("input", {
494
+ d("input", {
495
495
  type: "radio",
496
- checked: w.value,
497
- disabled: k.value,
498
- value: v.value,
499
- class: u(s(t).e("input"))
496
+ checked: C.value,
497
+ disabled: w.value,
498
+ value: p.value,
499
+ class: u(s(e).e("input"))
500
500
  }, null, 10, Ge),
501
- f("span", {
502
- class: u(s(t).e("inner"))
501
+ d("span", {
502
+ class: u(s(e).e("inner"))
503
503
  }, [
504
- le(x.$slots, "default", {}, () => [
505
- fe(z(n.label), 1)
504
+ le(V.$slots, "default", {}, () => [
505
+ fe(Y(n.label), 1)
506
506
  ])
507
507
  ], 2)
508
508
  ], 2));
509
509
  }
510
- }), qe = ["checked", "disabled", "name", "value"], dl = /* @__PURE__ */ Z({
510
+ }), je = ["checked", "disabled", "name", "value"], Tl = /* @__PURE__ */ Q({
511
511
  name: "XCheckbox",
512
512
  __name: "index",
513
513
  props: {
@@ -519,59 +519,59 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
519
519
  indeterminate: { type: Boolean }
520
520
  },
521
521
  emits: ["update:modelValue", "change"],
522
- setup(n, { emit: p }) {
523
- const e = n, t = p, l = Q("checkbox"), a = we("checkboxGroup", null), g = h(() => !!a), v = h(() => e.value ?? e.label), w = h(() => g.value ? a.modelValue.value.includes(v.value) : Array.isArray(e.modelValue) ? e.modelValue.includes(v.value) : !!e.modelValue), k = h(() => {
524
- if (e.disabled) return !0;
525
- if (g.value) {
526
- const x = a.disabled, C = a.min > 0 && a.modelValue.value.length <= a.min, I = a.max > 0 && a.modelValue.value.length >= a.max;
527
- return w.value && C || !w.value && I ? !0 : x;
522
+ setup(n, { emit: g }) {
523
+ const t = n, e = g, a = J("checkbox"), l = Ve("checkboxGroup", null), m = b(() => !!l), p = b(() => t.value ?? t.label), C = b(() => m.value ? l.modelValue.value.includes(p.value) : Array.isArray(t.modelValue) ? t.modelValue.includes(p.value) : !!t.modelValue), w = b(() => {
524
+ if (t.disabled) return !0;
525
+ if (m.value) {
526
+ const V = l.disabled, $ = l.min > 0 && l.modelValue.value.length <= l.min, F = l.max > 0 && l.modelValue.value.length >= l.max;
527
+ return C.value && $ || !C.value && F ? !0 : V;
528
528
  }
529
529
  return !1;
530
- }), L = h(() => [
531
- l.b(),
532
- l.is("checked", w.value),
533
- l.is("disabled", k.value),
534
- l.is("indeterminate", e.indeterminate && !w.value)
535
- ]), D = () => {
536
- if (!k.value)
537
- if (g.value)
538
- a.changeValue(v.value);
530
+ }), L = b(() => [
531
+ a.b(),
532
+ a.is("checked", C.value),
533
+ a.is("disabled", w.value),
534
+ a.is("indeterminate", t.indeterminate && !C.value)
535
+ ]), S = () => {
536
+ if (!w.value)
537
+ if (m.value)
538
+ l.changeValue(p.value);
539
539
  else {
540
- let x;
541
- if (Array.isArray(e.modelValue)) {
542
- const C = e.modelValue.indexOf(v.value);
543
- C > -1 ? x = [...e.modelValue.slice(0, C), ...e.modelValue.slice(C + 1)] : x = [...e.modelValue, v.value];
540
+ let V;
541
+ if (Array.isArray(t.modelValue)) {
542
+ const $ = t.modelValue.indexOf(p.value);
543
+ $ > -1 ? V = [...t.modelValue.slice(0, $), ...t.modelValue.slice($ + 1)] : V = [...t.modelValue, p.value];
544
544
  } else
545
- x = !e.modelValue;
546
- t("update:modelValue", x), t("change", x);
545
+ V = !t.modelValue;
546
+ e("update:modelValue", V), e("change", V);
547
547
  }
548
548
  };
549
- return (x, C) => (i(), c("label", {
549
+ return (V, $) => (r(), c("label", {
550
550
  class: u(L.value),
551
- onClick: ue(D, ["prevent"])
551
+ onClick: ue(S, ["prevent"])
552
552
  }, [
553
- f("span", {
554
- class: u(s(l).e("input"))
553
+ d("span", {
554
+ class: u(s(a).e("input"))
555
555
  }, [
556
- f("input", {
556
+ d("input", {
557
557
  type: "checkbox",
558
- checked: w.value,
559
- disabled: k.value,
558
+ checked: C.value,
559
+ disabled: w.value,
560
560
  name: n.name,
561
- value: v.value
562
- }, null, 8, qe)
561
+ value: p.value
562
+ }, null, 8, je)
563
563
  ], 2),
564
- x.$slots.default || n.label !== void 0 ? (i(), c("span", {
564
+ V.$slots.default || n.label !== void 0 ? (r(), c("span", {
565
565
  key: 0,
566
- class: u(s(l).e("label"))
566
+ class: u(s(a).e("label"))
567
567
  }, [
568
- le(x.$slots, "default", {}, () => [
569
- fe(z(n.label), 1)
568
+ le(V.$slots, "default", {}, () => [
569
+ fe(Y(n.label), 1)
570
570
  ])
571
- ], 2)) : N("", !0)
571
+ ], 2)) : H("", !0)
572
572
  ], 2));
573
573
  }
574
- }), vl = /* @__PURE__ */ Z({
574
+ }), Rl = /* @__PURE__ */ Q({
575
575
  name: "XCheckboxGroup",
576
576
  __name: "group",
577
577
  props: {
@@ -581,25 +581,25 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
581
581
  max: { default: 0 }
582
582
  },
583
583
  emits: ["update:modelValue", "change"],
584
- setup(n, { emit: p }) {
585
- const e = n, t = p, l = Q("checkbox-group"), a = (g) => {
586
- const v = [...e.modelValue], w = v.indexOf(g);
587
- w > -1 ? v.splice(w, 1) : v.push(g), t("update:modelValue", v), t("change", v);
584
+ setup(n, { emit: g }) {
585
+ const t = n, e = g, a = J("checkbox-group"), l = (m) => {
586
+ const p = [...t.modelValue], C = p.indexOf(m);
587
+ C > -1 ? p.splice(C, 1) : p.push(m), e("update:modelValue", p), e("change", p);
588
588
  };
589
- return Ve("checkboxGroup", {
590
- modelValue: h(() => e.modelValue),
591
- disabled: e.disabled,
592
- min: e.min,
593
- max: e.max,
594
- changeValue: a
595
- }), (g, v) => (i(), c("div", {
596
- class: u(s(l).b()),
589
+ return Ce("checkboxGroup", {
590
+ modelValue: b(() => t.modelValue),
591
+ disabled: t.disabled,
592
+ min: t.min,
593
+ max: t.max,
594
+ changeValue: l
595
+ }), (m, p) => (r(), c("div", {
596
+ class: u(s(a).b()),
597
597
  role: "group"
598
598
  }, [
599
- le(g.$slots, "default")
599
+ le(m.$slots, "default")
600
600
  ], 2));
601
601
  }
602
- }), fl = /* @__PURE__ */ Z({
602
+ }), Bl = /* @__PURE__ */ Q({
603
603
  name: "XForm",
604
604
  __name: "index",
605
605
  props: {
@@ -613,72 +613,72 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
613
613
  size: { default: "default" }
614
614
  },
615
615
  emits: ["validate", "submit", "reset"],
616
- setup(n, { expose: p, emit: e }) {
617
- const t = n, l = e, a = Q("form"), g = E([]), v = h(() => t.layout === "inline" || t.inline), w = h(() => t.layout === "vertical" || t.labelPosition === "top"), k = h(() => [
618
- a.b(),
619
- a.m(`label-${w.value ? "top" : t.labelPosition}`),
620
- a.is("inline", v.value),
621
- a.is("vertical", w.value)
622
- ]), L = h(() => ({ width: typeof t.labelWidth == "number" ? `${t.labelWidth}px` : t.labelWidth })), D = (b) => {
623
- g.value.push(b);
624
- }, x = (b) => {
625
- const T = g.value.indexOf(b);
626
- T > -1 && g.value.splice(T, 1);
627
- }, C = async () => {
628
- let b = !0;
629
- for (const T of g.value)
630
- await T.validate() || (b = !1);
631
- return b;
632
- }, I = async (b) => {
633
- const T = Array.isArray(b) ? b : [b];
634
- let B = !0;
635
- for (const K of g.value)
636
- T.includes(K.prop) && (await K.validate() || (B = !1));
637
- return B;
638
- }, d = () => {
639
- g.value.forEach((b) => {
640
- b.resetField();
616
+ setup(n, { expose: g, emit: t }) {
617
+ const e = n, a = t, l = J("form"), m = A([]), p = b(() => e.layout === "inline" || e.inline), C = b(() => e.layout === "vertical" || e.labelPosition === "top"), w = b(() => [
618
+ l.b(),
619
+ l.m(`label-${C.value ? "top" : e.labelPosition}`),
620
+ l.is("inline", p.value),
621
+ l.is("vertical", C.value)
622
+ ]), L = b(() => ({ width: typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth })), S = (h) => {
623
+ m.value.push(h);
624
+ }, V = (h) => {
625
+ const f = m.value.indexOf(h);
626
+ f > -1 && m.value.splice(f, 1);
627
+ }, $ = async () => {
628
+ let h = !0;
629
+ for (const f of m.value)
630
+ await f.validate() || (h = !1);
631
+ return h;
632
+ }, F = async (h) => {
633
+ const f = Array.isArray(h) ? h : [h];
634
+ let k = !0;
635
+ for (const N of m.value)
636
+ f.includes(N.prop) && (await N.validate() || (k = !1));
637
+ return k;
638
+ }, v = () => {
639
+ m.value.forEach((h) => {
640
+ h.resetField();
641
641
  });
642
- }, V = (b) => {
643
- if (b) {
644
- const T = Array.isArray(b) ? b : [b];
645
- g.value.forEach((B) => {
646
- T.includes(B.prop) && B.clearValidate();
642
+ }, D = (h) => {
643
+ if (h) {
644
+ const f = Array.isArray(h) ? h : [h];
645
+ m.value.forEach((k) => {
646
+ f.includes(k.prop) && k.clearValidate();
647
647
  });
648
648
  } else
649
- g.value.forEach((T) => {
650
- T.clearValidate();
649
+ m.value.forEach((f) => {
650
+ f.clearValidate();
651
651
  });
652
- }, M = (b) => {
653
- console.log("[XForm] handleSubmit triggered", b), b.preventDefault(), l("submit");
654
- }, S = (b) => {
655
- console.log("[XForm] handleReset triggered", b), b.preventDefault(), d(), l("reset");
656
- }, P = He(t, "model");
657
- return Ve("form", {
652
+ }, T = (h) => {
653
+ console.log("[XForm] handleSubmit triggered", h), h.preventDefault(), a("submit");
654
+ }, M = (h) => {
655
+ console.log("[XForm] handleReset triggered", h), h.preventDefault(), v(), a("reset");
656
+ }, P = Oe(e, "model");
657
+ return Ce("form", {
658
658
  model: P,
659
- rules: t.rules,
660
- labelWidth: t.labelWidth,
661
- labelPosition: w.value ? "top" : t.labelPosition,
662
- disabled: t.disabled,
663
- size: t.size,
659
+ rules: e.rules,
660
+ labelWidth: e.labelWidth,
661
+ labelPosition: C.value ? "top" : e.labelPosition,
662
+ disabled: e.disabled,
663
+ size: e.size,
664
664
  labelStyle: L,
665
- addField: D,
666
- removeField: x,
667
- emit: l
668
- }), p({
669
- validate: C,
670
- validateField: I,
671
- resetFields: d,
672
- clearValidate: V
673
- }), (b, T) => (i(), c("form", {
674
- class: u(k.value),
675
- onSubmit: M,
676
- onReset: S
665
+ addField: S,
666
+ removeField: V,
667
+ emit: a
668
+ }), g({
669
+ validate: $,
670
+ validateField: F,
671
+ resetFields: v,
672
+ clearValidate: D
673
+ }), (h, f) => (r(), c("form", {
674
+ class: u(w.value),
675
+ onSubmit: T,
676
+ onReset: M
677
677
  }, [
678
- le(b.$slots, "default")
678
+ le(h.$slots, "default")
679
679
  ], 34));
680
680
  }
681
- }), ml = /* @__PURE__ */ Z({
681
+ }), Fl = /* @__PURE__ */ Q({
682
682
  name: "XFormItem",
683
683
  __name: "item",
684
684
  props: {
@@ -689,185 +689,185 @@ const Oe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
689
689
  rules: {},
690
690
  showMessage: { type: Boolean }
691
691
  },
692
- setup(n, { expose: p }) {
693
- const e = n, t = Q("form-item"), l = we("form", null), a = E(""), g = E(""), v = h(() => e.required ? !0 : w().some((M) => M.required)), w = () => {
694
- const V = [];
695
- return e.rules && V.push(...e.rules), l && e.prop && l.rules[e.prop] && V.push(...l.rules[e.prop]), V;
696
- }, k = () => {
697
- var V;
698
- if (!(!l || !e.prop))
699
- return (V = l.model.value) == null ? void 0 : V[e.prop];
700
- }, L = (V) => {
701
- !l || !e.prop || l.model.value && (l.model.value[e.prop] = V);
702
- }, D = async (V) => {
692
+ setup(n, { expose: g }) {
693
+ const t = n, e = J("form-item"), a = Ve("form", null), l = A(""), m = A(""), p = b(() => t.required ? !0 : C().some((T) => T.required)), C = () => {
694
+ const D = [];
695
+ return t.rules && D.push(...t.rules), a && t.prop && a.rules[t.prop] && D.push(...a.rules[t.prop]), D;
696
+ }, w = () => {
697
+ var D;
698
+ if (!(!a || !t.prop))
699
+ return (D = a.model.value) == null ? void 0 : D[t.prop];
700
+ }, L = (D) => {
701
+ !a || !t.prop || a.model.value && (a.model.value[t.prop] = D);
702
+ }, S = async (D) => {
703
+ const T = C();
704
+ if (T.length === 0)
705
+ return l.value = "valid", !0;
703
706
  const M = w();
704
- if (M.length === 0)
705
- return a.value = "valid", !0;
706
- const S = k();
707
- let P = !0, b = "";
708
- for (const T of M)
709
- if (!(V && T.trigger && T.trigger !== V)) {
710
- if (T.required && (S == null || S === "" || Array.isArray(S) && S.length === 0)) {
711
- P = !1, b = T.message || "该字段为必填项";
707
+ let P = !0, h = "";
708
+ for (const f of T)
709
+ if (!(D && f.trigger && f.trigger !== D)) {
710
+ if (f.required && (M == null || M === "" || Array.isArray(M) && M.length === 0)) {
711
+ P = !1, h = f.message || "该字段为必填项";
712
712
  break;
713
713
  }
714
- if (T.min !== void 0 || T.max !== void 0) {
715
- const B = typeof S == "string" ? S.length : 0;
716
- if (T.min !== void 0 && B < T.min) {
717
- P = !1, b = T.message || `长度不能小于 ${T.min} 个字符`;
714
+ if (f.min !== void 0 || f.max !== void 0) {
715
+ const k = typeof M == "string" ? M.length : 0;
716
+ if (f.min !== void 0 && k < f.min) {
717
+ P = !1, h = f.message || `长度不能小于 ${f.min} 个字符`;
718
718
  break;
719
719
  }
720
- if (T.max !== void 0 && B > T.max) {
721
- P = !1, b = T.message || `长度不能大于 ${T.max} 个字符`;
720
+ if (f.max !== void 0 && k > f.max) {
721
+ P = !1, h = f.message || `长度不能大于 ${f.max} 个字符`;
722
722
  break;
723
723
  }
724
724
  }
725
- if (T.pattern && S && !T.pattern.test(S)) {
726
- P = !1, b = T.message || "格式不正确";
725
+ if (f.pattern && M && !f.pattern.test(M)) {
726
+ P = !1, h = f.message || "格式不正确";
727
727
  break;
728
728
  }
729
- if (T.validator)
729
+ if (f.validator)
730
730
  try {
731
- await new Promise((B, K) => {
732
- T.validator(T, S, (X) => {
733
- X ? K(X) : B();
731
+ await new Promise((k, N) => {
732
+ f.validator(f, M, (X) => {
733
+ X ? N(X) : k();
734
734
  });
735
735
  });
736
- } catch (B) {
737
- P = !1, b = B.message || T.message || "验证失败";
736
+ } catch (k) {
737
+ P = !1, h = k.message || f.message || "验证失败";
738
738
  break;
739
739
  }
740
740
  }
741
- return a.value = P ? "valid" : "invalid", g.value = b, l && e.prop && l.emit("validate", e.prop, P, b), P;
742
- }, x = () => {
743
- L(void 0), C();
744
- }, C = () => {
745
- a.value = "", g.value = "";
746
- }, I = h(() => [
747
- t.b(),
748
- t.is("required", v.value),
749
- t.is("error", a.value === "invalid"),
750
- t.is("success", a.value === "valid")
751
- ]), d = h(() => {
752
- const V = e.labelWidth ?? (l == null ? void 0 : l.labelWidth) ?? "100px";
753
- return { width: typeof V == "number" ? `${V}px` : V };
741
+ return l.value = P ? "valid" : "invalid", m.value = h, a && t.prop && a.emit("validate", t.prop, P, h), P;
742
+ }, V = () => {
743
+ L(void 0), $();
744
+ }, $ = () => {
745
+ l.value = "", m.value = "";
746
+ }, F = b(() => [
747
+ e.b(),
748
+ e.is("required", p.value),
749
+ e.is("error", l.value === "invalid"),
750
+ e.is("success", l.value === "valid")
751
+ ]), v = b(() => {
752
+ const D = t.labelWidth ?? (a == null ? void 0 : a.labelWidth) ?? "100px";
753
+ return { width: typeof D == "number" ? `${D}px` : D };
754
754
  });
755
- return ce(() => k(), () => {
756
- a.value === "invalid" && D("change");
757
- }), ye(() => {
758
- l && e.prop && l.addField({
759
- prop: e.prop,
760
- validate: D,
761
- resetField: x,
762
- clearValidate: C
763
- });
755
+ return ie(() => w(), () => {
756
+ l.value === "invalid" && S("change");
764
757
  }), ke(() => {
765
- l && e.prop && l.removeField({
766
- prop: e.prop,
767
- validate: D,
768
- resetField: x,
769
- clearValidate: C
758
+ a && t.prop && a.addField({
759
+ prop: t.prop,
760
+ validate: S,
761
+ resetField: V,
762
+ clearValidate: $
770
763
  });
771
- }), p({
772
- validate: D,
773
- resetField: x,
774
- clearValidate: C
775
- }), (V, M) => (i(), c("div", {
776
- class: u(I.value)
764
+ }), xe(() => {
765
+ a && t.prop && a.removeField({
766
+ prop: t.prop,
767
+ validate: S,
768
+ resetField: V,
769
+ clearValidate: $
770
+ });
771
+ }), g({
772
+ validate: S,
773
+ resetField: V,
774
+ clearValidate: $
775
+ }), (D, T) => (r(), c("div", {
776
+ class: u(F.value)
777
777
  }, [
778
- n.label ? (i(), c("label", {
778
+ n.label ? (r(), c("label", {
779
779
  key: 0,
780
- class: u(s(t).e("label")),
781
- style: ae(d.value)
782
- }, z(n.label), 7)) : N("", !0),
783
- f("div", {
784
- class: u(s(t).e("content"))
780
+ class: u(s(e).e("label")),
781
+ style: ae(v.value)
782
+ }, Y(n.label), 7)) : H("", !0),
783
+ d("div", {
784
+ class: u(s(e).e("content"))
785
785
  }, [
786
- le(V.$slots, "default"),
787
- n.showMessage !== !1 && a.value === "invalid" ? (i(), c("div", {
786
+ le(D.$slots, "default"),
787
+ n.showMessage !== !1 && l.value === "invalid" ? (r(), c("div", {
788
788
  key: 0,
789
- class: u(s(t).e("error"))
790
- }, z(g.value), 3)) : N("", !0)
789
+ class: u(s(e).e("error"))
790
+ }, Y(m.value), 3)) : H("", !0)
791
791
  ], 2)
792
792
  ], 2));
793
793
  }
794
794
  });
795
- function je(n, p) {
796
- return new Date(n, p + 1, 0).getDate();
795
+ function Ze(n, g) {
796
+ return new Date(n, g + 1, 0).getDate();
797
797
  }
798
- function Ze(n, p) {
799
- return new Date(n, p, 1).getDay();
798
+ function Qe(n, g) {
799
+ return new Date(n, g, 1).getDay();
800
800
  }
801
- function de(n, p) {
802
- return !n || !p ? !1 : n.getFullYear() === p.getFullYear() && n.getMonth() === p.getMonth() && n.getDate() === p.getDate();
801
+ function ve(n, g) {
802
+ return !n || !g ? !1 : n.getFullYear() === g.getFullYear() && n.getMonth() === g.getMonth() && n.getDate() === g.getDate();
803
803
  }
804
- function Qe(n, p) {
805
- return !n || !p ? !1 : n.getFullYear() === p.getFullYear() && n.getMonth() === p.getMonth();
804
+ function Je(n, g) {
805
+ return !n || !g ? !1 : n.getFullYear() === g.getFullYear() && n.getMonth() === g.getMonth();
806
806
  }
807
- function Pe(n, p, e) {
808
- if (!p || !e) return !1;
809
- const t = n.getTime();
810
- return t >= p.getTime() && t <= e.getTime();
807
+ function Ae(n, g, t) {
808
+ if (!g || !t) return !1;
809
+ const e = n.getTime();
810
+ return e >= g.getTime() && e <= t.getTime();
811
811
  }
812
- function Je(n, p, e = 0) {
813
- const t = [], l = je(n, p), a = Ze(n, p);
814
- let g = new Date(n, p, 1);
815
- const v = (a - e + 7) % 7;
816
- g.setDate(1 - v);
817
- let w = [], k = new Date(g);
818
- for (; (k.getMonth() <= p || k.getMonth() === p && k.getDate() <= l) && (w.push(new Date(k)), !(w.length === 7 && (t.push(w), w = [], k.getMonth() > p) || (k.setDate(k.getDate() + 1), t.length > 7))); )
812
+ function _e(n, g, t = 0) {
813
+ const e = [], a = Ze(n, g), l = Qe(n, g);
814
+ let m = new Date(n, g, 1);
815
+ const p = (l - t + 7) % 7;
816
+ m.setDate(1 - p);
817
+ let C = [], w = new Date(m);
818
+ for (; (w.getMonth() <= g || w.getMonth() === g && w.getDate() <= a) && (C.push(new Date(w)), !(C.length === 7 && (e.push(C), C = [], w.getMonth() > g) || (w.setDate(w.getDate() + 1), e.length > 7))); )
819
819
  ;
820
- return w.length > 0 && t.push(w), t;
820
+ return C.length > 0 && e.push(C), e;
821
821
  }
822
- function ie(n, p = "YYYY-MM-DD") {
822
+ function ce(n, g = "YYYY-MM-DD") {
823
823
  if (!n) return "";
824
- const e = n.getFullYear(), t = n.getMonth() + 1, l = n.getDate(), a = n.getHours(), g = n.getMinutes(), v = n.getSeconds();
825
- return p.replace(/YYYY/g, String(e)).replace(/YY/g, String(e).slice(-2)).replace(/MM/g, String(t).padStart(2, "0")).replace(/M/g, String(t)).replace(/DD/g, String(l).padStart(2, "0")).replace(/D/g, String(l)).replace(/HH/g, String(a).padStart(2, "0")).replace(/H/g, String(a)).replace(/mm/g, String(g).padStart(2, "0")).replace(/m/g, String(g)).replace(/ss/g, String(v).padStart(2, "0")).replace(/s/g, String(v));
824
+ const t = n.getFullYear(), e = n.getMonth() + 1, a = n.getDate(), l = n.getHours(), m = n.getMinutes(), p = n.getSeconds();
825
+ return g.replace(/YYYY/g, String(t)).replace(/YY/g, String(t).slice(-2)).replace(/MM/g, String(e).padStart(2, "0")).replace(/M/g, String(e)).replace(/DD/g, String(a).padStart(2, "0")).replace(/D/g, String(a)).replace(/HH/g, String(l).padStart(2, "0")).replace(/H/g, String(l)).replace(/mm/g, String(m).padStart(2, "0")).replace(/m/g, String(m)).replace(/ss/g, String(p).padStart(2, "0")).replace(/s/g, String(p));
826
826
  }
827
- function be(n) {
827
+ function ye(n) {
828
828
  if (!n) return null;
829
829
  if (n instanceof Date)
830
830
  return isNaN(n.getTime()) ? null : n;
831
831
  if (typeof n == "number")
832
832
  return new Date(n);
833
- const p = new Date(n);
834
- if (isNaN(p.getTime())) {
835
- const e = n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);
836
- return e ? new Date(parseInt(e[1]), parseInt(e[2]) - 1, parseInt(e[3])) : null;
833
+ const g = new Date(n);
834
+ if (isNaN(g.getTime())) {
835
+ const t = n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);
836
+ return t ? new Date(parseInt(t[1]), parseInt(t[2]) - 1, parseInt(t[3])) : null;
837
837
  }
838
- return p;
839
- }
840
- function _e(n) {
841
- const p = new Date(n);
842
- return p.setMonth(p.getMonth() - 1), p;
838
+ return g;
843
839
  }
844
840
  function et(n) {
845
- const p = new Date(n);
846
- return p.setMonth(p.getMonth() + 1), p;
841
+ const g = new Date(n);
842
+ return g.setMonth(g.getMonth() - 1), g;
847
843
  }
848
844
  function tt(n) {
849
- const p = new Date(n);
850
- return p.setFullYear(p.getFullYear() - 1), p;
845
+ const g = new Date(n);
846
+ return g.setMonth(g.getMonth() + 1), g;
851
847
  }
852
848
  function lt(n) {
853
- const p = new Date(n);
854
- return p.setFullYear(p.getFullYear() + 1), p;
849
+ const g = new Date(n);
850
+ return g.setFullYear(g.getFullYear() - 1), g;
855
851
  }
856
- function Ee(n) {
857
- const p = Math.floor(n / 10) * 10;
858
- return [p, p + 9];
852
+ function at(n) {
853
+ const g = new Date(n);
854
+ return g.setFullYear(g.getFullYear() + 1), g;
855
+ }
856
+ function Ye(n) {
857
+ const g = Math.floor(n / 10) * 10;
858
+ return [g, g + 9];
859
859
  }
860
860
  function Se(n) {
861
- const p = new Date(n);
862
- return p.setHours(0, 0, 0, 0), p;
861
+ const g = new Date(n);
862
+ return g.setHours(0, 0, 0, 0), g;
863
863
  }
864
- function at(n, p, e, t) {
865
- if (p && p(n))
864
+ function nt(n, g, t, e) {
865
+ if (g && g(n))
866
866
  return !0;
867
- const l = Se(n).getTime();
868
- return !!(e && l < Se(e).getTime() || t && l > Se(t).getTime());
867
+ const a = Se(n).getTime();
868
+ return !!(t && a < Se(t).getTime() || e && a > Se(e).getTime());
869
869
  }
870
- const nt = [
870
+ const st = [
871
871
  "一月",
872
872
  "二月",
873
873
  "三月",
@@ -880,7 +880,7 @@ const nt = [
880
880
  "十月",
881
881
  "十一月",
882
882
  "十二月"
883
- ], st = ["日", "一", "二", "三", "四", "五", "六"], ut = ["onClick", "onMouseenter"], ot = /* @__PURE__ */ Z({
883
+ ], ut = ["日", "一", "二", "三", "四", "五", "六"], ot = ["onClick", "onMouseenter"], rt = /* @__PURE__ */ Q({
884
884
  name: "XDateTable",
885
885
  __name: "DateTable",
886
886
  props: {
@@ -897,79 +897,79 @@ const nt = [
897
897
  selectionMode: { default: "single" }
898
898
  },
899
899
  emits: ["pick", "range-select", "range-move", "update:viewedMonth"],
900
- setup(n, { emit: p }) {
901
- const e = n, t = p, l = Q("date-table"), a = E(null), g = h(() => e.viewedMonth.getFullYear()), v = h(() => e.viewedMonth.getMonth()), w = h(() => Je(g.value, v.value, 0)), k = (b) => e.modelValue ? de(b, e.modelValue) : !1, L = (b) => de(b, /* @__PURE__ */ new Date()), D = (b) => Qe(b, e.viewedMonth), x = (b) => {
902
- if (e.selectionMode !== "range") return !1;
903
- const { startDate: T, endDate: B, selecting: K } = e.rangeState || {};
904
- if (K && T) {
905
- const X = a.value;
900
+ setup(n, { emit: g }) {
901
+ const t = n, e = g, a = J("date-table"), l = A(null), m = b(() => t.viewedMonth.getFullYear()), p = b(() => t.viewedMonth.getMonth()), C = b(() => _e(m.value, p.value, 0)), w = (h) => t.modelValue ? ve(h, t.modelValue) : !1, L = (h) => ve(h, /* @__PURE__ */ new Date()), S = (h) => Je(h, t.viewedMonth), V = (h) => {
902
+ if (t.selectionMode !== "range") return !1;
903
+ const { startDate: f, endDate: k, selecting: N } = t.rangeState || {};
904
+ if (N && f) {
905
+ const X = l.value;
906
906
  if (X) {
907
- const q = T < X ? T : X, J = T < X ? X : T;
908
- return Pe(b, q, J);
907
+ const j = f < X ? f : X, _ = f < X ? X : f;
908
+ return Ae(h, j, _);
909
909
  }
910
- return de(b, T);
910
+ return ve(h, f);
911
911
  }
912
- return T && B ? Pe(b, T, B) : !1;
913
- }, C = (b) => {
914
- if (e.selectionMode !== "range") return !1;
915
- const { startDate: T, selecting: B } = e.rangeState || {};
916
- return B && T && a.value ? de(b, T < a.value ? T : a.value) : T ? de(b, T) : !1;
917
- }, I = (b) => {
918
- if (e.selectionMode !== "range") return !1;
919
- const { endDate: T, selecting: B } = e.rangeState || {};
920
- if (B && a.value) {
921
- const { startDate: K } = e.rangeState || {};
922
- return de(b, K < a.value ? a.value : K);
912
+ return f && k ? Ae(h, f, k) : !1;
913
+ }, $ = (h) => {
914
+ if (t.selectionMode !== "range") return !1;
915
+ const { startDate: f, selecting: k } = t.rangeState || {};
916
+ return k && f && l.value ? ve(h, f < l.value ? f : l.value) : f ? ve(h, f) : !1;
917
+ }, F = (h) => {
918
+ if (t.selectionMode !== "range") return !1;
919
+ const { endDate: f, selecting: k } = t.rangeState || {};
920
+ if (k && l.value) {
921
+ const { startDate: N } = t.rangeState || {};
922
+ return ve(h, N < l.value ? l.value : N);
923
923
  }
924
- return T ? de(b, T) : !1;
925
- }, d = (b) => at(b, e.disabledDate, e.minDate, e.maxDate), V = (b) => [
926
- l.e("cell"),
927
- l.is("selected", k(b)),
928
- l.is("today", L(b)),
929
- l.is("disabled", d(b)),
930
- l.is("in-range", x(b)),
931
- l.is("range-start", C(b)),
932
- l.is("range-end", I(b)),
933
- l.is("prev-month", !D(b) && b.getMonth() < v.value),
934
- l.is("next-month", !D(b) && b.getMonth() > v.value)
935
- ], M = (b) => {
936
- d(b) || (e.selectionMode === "range" ? t("range-select", b) : t("pick", b));
937
- }, S = (b) => {
938
- a.value = b;
924
+ return f ? ve(h, f) : !1;
925
+ }, v = (h) => nt(h, t.disabledDate, t.minDate, t.maxDate), D = (h) => [
926
+ a.e("cell"),
927
+ a.is("selected", w(h)),
928
+ a.is("today", L(h)),
929
+ a.is("disabled", v(h)),
930
+ a.is("in-range", V(h)),
931
+ a.is("range-start", $(h)),
932
+ a.is("range-end", F(h)),
933
+ a.is("prev-month", !S(h) && h.getMonth() < p.value),
934
+ a.is("next-month", !S(h) && h.getMonth() > p.value)
935
+ ], T = (h) => {
936
+ v(h) || (t.selectionMode === "range" ? e("range-select", h) : e("pick", h));
937
+ }, M = (h) => {
938
+ l.value = h;
939
939
  }, P = () => {
940
- a.value = null;
940
+ l.value = null;
941
941
  };
942
- return (b, T) => (i(), c("table", {
943
- class: u(s(l).b()),
942
+ return (h, f) => (r(), c("table", {
943
+ class: u(s(a).b()),
944
944
  cellspacing: "0",
945
945
  cellpadding: "0"
946
946
  }, [
947
- f("thead", null, [
948
- f("tr", null, [
949
- (i(!0), c(j, null, _(s(st), (B) => (i(), c("th", {
950
- key: B,
951
- class: u(s(l).e("header-cell"))
952
- }, z(B), 3))), 128))
947
+ d("thead", null, [
948
+ d("tr", null, [
949
+ (r(!0), c(G, null, Z(s(ut), (k) => (r(), c("th", {
950
+ key: k,
951
+ class: u(s(a).e("header-cell"))
952
+ }, Y(k), 3))), 128))
953
953
  ])
954
954
  ]),
955
- f("tbody", null, [
956
- (i(!0), c(j, null, _(w.value, (B, K) => (i(), c("tr", { key: K }, [
957
- (i(!0), c(j, null, _(B, (X, q) => (i(), c("td", {
958
- key: q,
959
- class: u(V(X)),
960
- onClick: (J) => M(X),
961
- onMouseenter: (J) => S(X),
955
+ d("tbody", null, [
956
+ (r(!0), c(G, null, Z(C.value, (k, N) => (r(), c("tr", { key: N }, [
957
+ (r(!0), c(G, null, Z(k, (X, j) => (r(), c("td", {
958
+ key: j,
959
+ class: u(D(X)),
960
+ onClick: (_) => T(X),
961
+ onMouseenter: (_) => M(X),
962
962
  onMouseleave: P
963
963
  }, [
964
- f("span", {
965
- class: u(s(l).e("cell-text"))
966
- }, z(X.getDate()), 3)
967
- ], 42, ut))), 128))
964
+ d("span", {
965
+ class: u(s(a).e("cell-text"))
966
+ }, Y(X.getDate()), 3)
967
+ ], 42, ot))), 128))
968
968
  ]))), 128))
969
969
  ])
970
970
  ], 2));
971
971
  }
972
- }), rt = ["onClick"], it = /* @__PURE__ */ Z({
972
+ }), it = ["onClick"], dt = /* @__PURE__ */ Q({
973
973
  name: "XMonthTable",
974
974
  __name: "MonthTable",
975
975
  props: {
@@ -978,50 +978,50 @@ const nt = [
978
978
  disabledDate: {}
979
979
  },
980
980
  emits: ["pick"],
981
- setup(n, { emit: p }) {
982
- const e = n, t = p, l = Q("month-table");
983
- h(() => e.modelValue ? e.modelValue.getMonth() : -1);
984
- const a = (D) => e.modelValue ? e.modelValue.getFullYear() === e.viewedYear && e.modelValue.getMonth() === D : !1, g = (D) => {
985
- const x = /* @__PURE__ */ new Date();
986
- return x.getFullYear() === e.viewedYear && x.getMonth() === D;
987
- }, v = (D) => {
988
- if (!e.disabledDate) return !1;
989
- const x = new Date(e.viewedYear, D, 1), C = new Date(e.viewedYear, D + 1, 0);
990
- return e.disabledDate(x) && e.disabledDate(C);
991
- }, w = (D) => [
992
- l.e("cell"),
993
- l.is("selected", a(D)),
994
- l.is("current", g(D)),
995
- l.is("disabled", v(D))
996
- ], k = (D) => {
997
- v(D) || t("pick", D);
998
- }, L = h(() => {
999
- const D = [];
1000
- for (let x = 0; x < 12; x += 3)
1001
- D.push([x, x + 1, x + 2]);
1002
- return D;
981
+ setup(n, { emit: g }) {
982
+ const t = n, e = g, a = J("month-table");
983
+ b(() => t.modelValue ? t.modelValue.getMonth() : -1);
984
+ const l = (S) => t.modelValue ? t.modelValue.getFullYear() === t.viewedYear && t.modelValue.getMonth() === S : !1, m = (S) => {
985
+ const V = /* @__PURE__ */ new Date();
986
+ return V.getFullYear() === t.viewedYear && V.getMonth() === S;
987
+ }, p = (S) => {
988
+ if (!t.disabledDate) return !1;
989
+ const V = new Date(t.viewedYear, S, 1), $ = new Date(t.viewedYear, S + 1, 0);
990
+ return t.disabledDate(V) && t.disabledDate($);
991
+ }, C = (S) => [
992
+ a.e("cell"),
993
+ a.is("selected", l(S)),
994
+ a.is("current", m(S)),
995
+ a.is("disabled", p(S))
996
+ ], w = (S) => {
997
+ p(S) || e("pick", S);
998
+ }, L = b(() => {
999
+ const S = [];
1000
+ for (let V = 0; V < 12; V += 3)
1001
+ S.push([V, V + 1, V + 2]);
1002
+ return S;
1003
1003
  });
1004
- return (D, x) => (i(), c("table", {
1005
- class: u(s(l).b()),
1004
+ return (S, V) => (r(), c("table", {
1005
+ class: u(s(a).b()),
1006
1006
  cellspacing: "0",
1007
1007
  cellpadding: "0"
1008
1008
  }, [
1009
- f("tbody", null, [
1010
- (i(!0), c(j, null, _(L.value, (C, I) => (i(), c("tr", { key: I }, [
1011
- (i(!0), c(j, null, _(C, (d) => (i(), c("td", {
1012
- key: d,
1013
- class: u(w(d)),
1014
- onClick: (V) => k(d)
1009
+ d("tbody", null, [
1010
+ (r(!0), c(G, null, Z(L.value, ($, F) => (r(), c("tr", { key: F }, [
1011
+ (r(!0), c(G, null, Z($, (v) => (r(), c("td", {
1012
+ key: v,
1013
+ class: u(C(v)),
1014
+ onClick: (D) => w(v)
1015
1015
  }, [
1016
- f("span", {
1017
- class: u(s(l).e("cell-text"))
1018
- }, z(s(nt)[d]), 3)
1019
- ], 10, rt))), 128))
1016
+ d("span", {
1017
+ class: u(s(a).e("cell-text"))
1018
+ }, Y(s(st)[v]), 3)
1019
+ ], 10, it))), 128))
1020
1020
  ]))), 128))
1021
1021
  ])
1022
1022
  ], 2));
1023
1023
  }
1024
- }), ct = ["onClick"], dt = /* @__PURE__ */ Z({
1024
+ }), ct = ["onClick"], vt = /* @__PURE__ */ Q({
1025
1025
  name: "XYearTable",
1026
1026
  __name: "YearTable",
1027
1027
  props: {
@@ -1030,55 +1030,55 @@ const nt = [
1030
1030
  disabledDate: {}
1031
1031
  },
1032
1032
  emits: ["pick"],
1033
- setup(n, { emit: p }) {
1034
- const e = n, t = p, l = Q("year-table"), a = h(() => (/* @__PURE__ */ new Date()).getFullYear()), g = h(() => Ee(e.viewedYear)), v = h(() => {
1035
- const [d] = g.value, V = [];
1036
- V.push(d - 1);
1037
- for (let M = 0; M < 10; M++)
1038
- V.push(d + M);
1039
- return V.push(d + 10), V;
1040
- }), w = h(() => {
1041
- const d = [];
1042
- for (let V = 0; V < v.value.length; V += 3)
1043
- d.push(v.value.slice(V, V + 3));
1044
- return d;
1045
- }), k = (d) => e.modelValue ? e.modelValue.getFullYear() === d : !1, L = (d) => d === a.value, D = (d) => {
1046
- const [V, M] = g.value;
1047
- return d >= V && d <= M;
1048
- }, x = (d) => {
1049
- if (!e.disabledDate) return !1;
1050
- const V = new Date(d, 0, 1), M = new Date(d, 11, 31);
1051
- return e.disabledDate(V) && e.disabledDate(M);
1052
- }, C = (d) => [
1053
- l.e("cell"),
1054
- l.is("selected", k(d)),
1055
- l.is("current", L(d)),
1056
- l.is("disabled", x(d)),
1057
- l.is("in-decade", D(d))
1058
- ], I = (d) => {
1059
- x(d) || t("pick", d);
1033
+ setup(n, { emit: g }) {
1034
+ const t = n, e = g, a = J("year-table"), l = b(() => (/* @__PURE__ */ new Date()).getFullYear()), m = b(() => Ye(t.viewedYear)), p = b(() => {
1035
+ const [v] = m.value, D = [];
1036
+ D.push(v - 1);
1037
+ for (let T = 0; T < 10; T++)
1038
+ D.push(v + T);
1039
+ return D.push(v + 10), D;
1040
+ }), C = b(() => {
1041
+ const v = [];
1042
+ for (let D = 0; D < p.value.length; D += 3)
1043
+ v.push(p.value.slice(D, D + 3));
1044
+ return v;
1045
+ }), w = (v) => t.modelValue ? t.modelValue.getFullYear() === v : !1, L = (v) => v === l.value, S = (v) => {
1046
+ const [D, T] = m.value;
1047
+ return v >= D && v <= T;
1048
+ }, V = (v) => {
1049
+ if (!t.disabledDate) return !1;
1050
+ const D = new Date(v, 0, 1), T = new Date(v, 11, 31);
1051
+ return t.disabledDate(D) && t.disabledDate(T);
1052
+ }, $ = (v) => [
1053
+ a.e("cell"),
1054
+ a.is("selected", w(v)),
1055
+ a.is("current", L(v)),
1056
+ a.is("disabled", V(v)),
1057
+ a.is("in-decade", S(v))
1058
+ ], F = (v) => {
1059
+ V(v) || e("pick", v);
1060
1060
  };
1061
- return (d, V) => (i(), c("table", {
1062
- class: u(s(l).b()),
1061
+ return (v, D) => (r(), c("table", {
1062
+ class: u(s(a).b()),
1063
1063
  cellspacing: "0",
1064
1064
  cellpadding: "0"
1065
1065
  }, [
1066
- f("tbody", null, [
1067
- (i(!0), c(j, null, _(w.value, (M, S) => (i(), c("tr", { key: S }, [
1068
- (i(!0), c(j, null, _(M, (P) => (i(), c("td", {
1066
+ d("tbody", null, [
1067
+ (r(!0), c(G, null, Z(C.value, (T, M) => (r(), c("tr", { key: M }, [
1068
+ (r(!0), c(G, null, Z(T, (P) => (r(), c("td", {
1069
1069
  key: P,
1070
- class: u(C(P)),
1071
- onClick: (b) => I(P)
1070
+ class: u($(P)),
1071
+ onClick: (h) => F(P)
1072
1072
  }, [
1073
- f("span", {
1074
- class: u(s(l).e("cell-text"))
1075
- }, z(P), 3)
1073
+ d("span", {
1074
+ class: u(s(a).e("cell-text"))
1075
+ }, Y(P), 3)
1076
1076
  ], 10, ct))), 128))
1077
1077
  ]))), 128))
1078
1078
  ])
1079
1079
  ], 2));
1080
1080
  }
1081
- }), vt = ["placeholder", "disabled", "value"], ft = ["placeholder", "disabled", "value"], mt = ["placeholder", "disabled", "value"], pl = /* @__PURE__ */ Z({
1081
+ }), ft = ["placeholder", "disabled", "value"], mt = ["placeholder", "disabled", "value"], pt = ["placeholder", "disabled", "value"], Il = /* @__PURE__ */ Q({
1082
1082
  name: "XDatePicker",
1083
1083
  __name: "index",
1084
1084
  props: {
@@ -1099,273 +1099,273 @@ const nt = [
1099
1099
  maxDate: {}
1100
1100
  },
1101
1101
  emits: ["update:modelValue", "update:value", "change", "focus", "blur", "clear"],
1102
- setup(n, { expose: p, emit: e }) {
1103
- const t = n, l = e, a = Q("date-picker"), g = E(!1), v = E(2e3), w = E(), k = () => t.modelValue !== void 0 ? t.modelValue : t.value !== void 0 ? t.value : null, L = (H) => {
1104
- l("update:modelValue", H), l("update:value", H), l("change", H);
1105
- }, D = E(), x = E(), C = E({
1102
+ setup(n, { expose: g, emit: t }) {
1103
+ const e = n, a = t, l = J("date-picker"), m = A(!1), p = A(2e3), C = A(), w = () => e.modelValue !== void 0 ? e.modelValue : e.value !== void 0 ? e.value : null, L = (O) => {
1104
+ a("update:modelValue", O), a("update:value", O), a("change", O);
1105
+ }, S = A(), V = A(), $ = A({
1106
1106
  top: "0px",
1107
1107
  left: "0px"
1108
- }), I = () => Le().next(), d = E("date"), V = E(/* @__PURE__ */ new Date()), M = E({
1108
+ }), F = () => Le().next(), v = A("date"), D = A(/* @__PURE__ */ new Date()), T = A({
1109
1109
  selecting: !1,
1110
1110
  startDate: null,
1111
1111
  endDate: null
1112
- }), S = h(() => {
1113
- const H = k();
1114
- if (!H) return null;
1115
- if (t.type === "daterange") {
1116
- const [G, se] = H;
1117
- return [be(G), be(se)];
1112
+ }), M = b(() => {
1113
+ const O = w();
1114
+ if (!O) return null;
1115
+ if (e.type === "daterange") {
1116
+ const [q, se] = O;
1117
+ return [ye(q), ye(se)];
1118
1118
  }
1119
- return be(H);
1120
- }), P = h(() => !S.value || Array.isArray(S.value) ? "" : ie(S.value, t.format)), b = h(() => {
1121
- if (!Array.isArray(S.value)) return "";
1122
- const [H] = S.value;
1123
- return H ? ie(H, t.format) : "";
1124
- }), T = h(() => {
1125
- if (!Array.isArray(S.value)) return "";
1126
- const [, H] = S.value;
1127
- return H ? ie(H, t.format) : "";
1128
- }), B = h(() => Array.isArray(S.value) ? null : S.value), K = h(() => V.value.getFullYear()), X = h(() => V.value.getMonth()), q = h(() => Ee(K.value)), J = h(() => d.value === "year" ? `${q.value[0]} 年 - ${q.value[1]} 年` : d.value === "month" ? `${K.value} 年` : `${K.value} 年 ${X.value + 1} 月`), $ = h(() => [
1129
- a.b(),
1130
- a.m(t.size),
1131
- a.is("disabled", t.disabled),
1132
- a.is("range", t.type === "daterange")
1133
- ]), R = h(() => [
1134
- a.e("input"),
1135
- a.is("focus", g.value),
1136
- a.is("has-value", !!P.value || !!(b.value || T.value))
1137
- ]), y = () => {
1138
- t.disabled || t.readonly || (g.value ? r() : o());
1119
+ return ye(O);
1120
+ }), P = b(() => !M.value || Array.isArray(M.value) ? "" : ce(M.value, e.format)), h = b(() => {
1121
+ if (!Array.isArray(M.value)) return "";
1122
+ const [O] = M.value;
1123
+ return O ? ce(O, e.format) : "";
1124
+ }), f = b(() => {
1125
+ if (!Array.isArray(M.value)) return "";
1126
+ const [, O] = M.value;
1127
+ return O ? ce(O, e.format) : "";
1128
+ }), k = b(() => Array.isArray(M.value) ? null : M.value), N = b(() => D.value.getFullYear()), X = b(() => D.value.getMonth()), j = b(() => Ye(N.value)), _ = b(() => v.value === "year" ? `${j.value[0]} 年 - ${j.value[1]} 年` : v.value === "month" ? `${N.value} 年` : `${N.value} 年 ${X.value + 1} 月`), R = b(() => [
1129
+ l.b(),
1130
+ l.m(e.size),
1131
+ l.is("disabled", e.disabled),
1132
+ l.is("range", e.type === "daterange")
1133
+ ]), B = b(() => [
1134
+ l.e("input"),
1135
+ l.is("focus", m.value),
1136
+ l.is("has-value", !!P.value || !!(h.value || f.value))
1137
+ ]), x = () => {
1138
+ e.disabled || e.readonly || (m.value ? i() : o());
1139
1139
  }, o = () => {
1140
- g.value = !0, v.value = I(), Ce(() => {
1141
- if (w.value && D.value) {
1142
- const H = w.value.getBoundingClientRect(), G = D.value.getBoundingClientRect();
1143
- let se = H.bottom + 8, De = H.left;
1144
- De + G.width > window.innerWidth && (De = window.innerWidth - G.width - 8), se + G.height > window.innerHeight && (se = H.top - G.height - 8), C.value = {
1140
+ m.value = !0, p.value = F(), De(() => {
1141
+ if (C.value && S.value) {
1142
+ const O = C.value.getBoundingClientRect(), q = S.value.getBoundingClientRect();
1143
+ let se = O.bottom + 8, $e = O.left;
1144
+ $e + q.width > window.innerWidth && ($e = window.innerWidth - q.width - 8), se + q.height > window.innerHeight && (se = O.top - q.height - 8), $.value = {
1145
1145
  top: `${se}px`,
1146
- left: `${De}px`
1146
+ left: `${$e}px`
1147
1147
  };
1148
1148
  }
1149
- }), l("focus", {});
1150
- }, r = () => {
1151
- g.value = !1, d.value = "date", l("blur", {});
1152
- }, m = (H) => {
1153
- if (t.type === "date") {
1154
- const G = t.valueFormat ? ie(H, t.valueFormat) : H;
1155
- L(G), r();
1149
+ }), a("focus", {});
1150
+ }, i = () => {
1151
+ m.value = !1, v.value = "date", a("blur", {});
1152
+ }, y = (O) => {
1153
+ if (e.type === "date") {
1154
+ const q = e.valueFormat ? ce(O, e.valueFormat) : O;
1155
+ L(q), i();
1156
1156
  }
1157
- }, O = (H) => {
1158
- if (!M.value.selecting)
1159
- M.value.selecting = !0, M.value.startDate = H, M.value.endDate = null;
1157
+ }, U = (O) => {
1158
+ if (!T.value.selecting)
1159
+ T.value.selecting = !0, T.value.startDate = O, T.value.endDate = null;
1160
1160
  else {
1161
- M.value.selecting = !1, M.value.startDate && H < M.value.startDate ? [M.value.startDate, M.value.endDate] = [H, M.value.startDate] : M.value.endDate = H;
1162
- const G = t.valueFormat ? ie(M.value.startDate, t.valueFormat) : M.value.startDate, se = t.valueFormat ? ie(M.value.endDate, t.valueFormat) : M.value.endDate;
1163
- L([G, se]), r();
1161
+ T.value.selecting = !1, T.value.startDate && O < T.value.startDate ? [T.value.startDate, T.value.endDate] = [O, T.value.startDate] : T.value.endDate = O;
1162
+ const q = e.valueFormat ? ce(T.value.startDate, e.valueFormat) : T.value.startDate, se = e.valueFormat ? ce(T.value.endDate, e.valueFormat) : T.value.endDate;
1163
+ L([q, se]), i();
1164
1164
  }
1165
- }, te = (H) => {
1166
- if (V.value = new Date(K.value, H, 1), t.type === "month") {
1167
- const G = new Date(K.value, H, 1), se = t.valueFormat ? ie(G, t.valueFormat) : G;
1168
- L(se), r();
1165
+ }, te = (O) => {
1166
+ if (D.value = new Date(N.value, O, 1), e.type === "month") {
1167
+ const q = new Date(N.value, O, 1), se = e.valueFormat ? ce(q, e.valueFormat) : q;
1168
+ L(se), i();
1169
1169
  } else
1170
- d.value = "date";
1171
- }, A = (H) => {
1172
- if (V.value = new Date(H, X.value, 1), t.type === "year") {
1173
- const G = new Date(H, 0, 1), se = t.valueFormat ? ie(G, t.valueFormat) : G;
1174
- L(se), r();
1170
+ v.value = "date";
1171
+ }, E = (O) => {
1172
+ if (D.value = new Date(O, X.value, 1), e.type === "year") {
1173
+ const q = new Date(O, 0, 1), se = e.valueFormat ? ce(q, e.valueFormat) : q;
1174
+ L(se), i();
1175
1175
  } else
1176
- d.value = "month";
1176
+ v.value = "month";
1177
1177
  }, ee = () => {
1178
- V.value = _e(V.value);
1179
- }, Y = () => {
1180
- V.value = et(V.value);
1181
- }, re = () => {
1182
- d.value === "year" ? V.value = new Date(K.value - 10, X.value, 1) : V.value = tt(V.value);
1183
- }, ge = () => {
1184
- d.value === "year" ? V.value = new Date(K.value + 10, X.value, 1) : V.value = lt(V.value);
1185
- }, F = () => {
1186
- d.value = "month";
1187
- }, U = () => {
1188
- d.value = "year";
1178
+ D.value = et(D.value);
1179
+ }, z = () => {
1180
+ D.value = tt(D.value);
1181
+ }, de = () => {
1182
+ v.value === "year" ? D.value = new Date(N.value - 10, X.value, 1) : D.value = lt(D.value);
1183
+ }, be = () => {
1184
+ v.value === "year" ? D.value = new Date(N.value + 10, X.value, 1) : D.value = at(D.value);
1185
+ }, I = () => {
1186
+ v.value = "month";
1187
+ }, K = () => {
1188
+ v.value = "year";
1189
1189
  }, W = () => {
1190
- L(null), l("clear"), M.value = {
1190
+ L(null), a("clear"), T.value = {
1191
1191
  selecting: !1,
1192
1192
  startDate: null,
1193
1193
  endDate: null
1194
1194
  };
1195
- }, ne = (H) => {
1196
- if (!w.value) return;
1197
- const G = H.target;
1198
- w.value.contains(G) || D.value && D.value.contains(G) || r();
1195
+ }, ne = (O) => {
1196
+ if (!C.value) return;
1197
+ const q = O.target;
1198
+ C.value.contains(q) || S.value && S.value.contains(q) || i();
1199
1199
  };
1200
- ce(
1201
- k,
1202
- (H) => {
1203
- if (H)
1204
- if (Array.isArray(S.value)) {
1205
- const [G] = S.value;
1206
- G && (V.value = new Date(G));
1207
- } else S.value && (V.value = new Date(S.value));
1200
+ ie(
1201
+ w,
1202
+ (O) => {
1203
+ if (O)
1204
+ if (Array.isArray(M.value)) {
1205
+ const [q] = M.value;
1206
+ q && (D.value = new Date(q));
1207
+ } else M.value && (D.value = new Date(M.value));
1208
1208
  },
1209
1209
  { immediate: !0 }
1210
- ), ce(g, (H) => {
1211
- H && (d.value = "date", t.type === "daterange" && (M.value = {
1210
+ ), ie(m, (O) => {
1211
+ O && (v.value = "date", e.type === "daterange" && (T.value = {
1212
1212
  selecting: !1,
1213
- startDate: Array.isArray(S.value) ? S.value[0] : null,
1214
- endDate: Array.isArray(S.value) ? S.value[1] : null
1213
+ startDate: Array.isArray(M.value) ? M.value[0] : null,
1214
+ endDate: Array.isArray(M.value) ? M.value[1] : null
1215
1215
  }));
1216
1216
  });
1217
- const oe = (H) => {
1218
- H.key === "Escape" && r();
1217
+ const re = (O) => {
1218
+ O.key === "Escape" && i();
1219
1219
  };
1220
- return ye(() => {
1221
- document.addEventListener("click", ne), document.addEventListener("keydown", oe);
1222
- }), ke(() => {
1223
- document.removeEventListener("click", ne), document.removeEventListener("keydown", oe);
1224
- }), p({
1220
+ return ke(() => {
1221
+ document.addEventListener("click", ne), document.addEventListener("keydown", re);
1222
+ }), xe(() => {
1223
+ document.removeEventListener("click", ne), document.removeEventListener("keydown", re);
1224
+ }), g({
1225
1225
  focus: () => {
1226
- var H;
1227
- return (H = x.value) == null ? void 0 : H.focus();
1226
+ var O;
1227
+ return (O = V.value) == null ? void 0 : O.focus();
1228
1228
  },
1229
1229
  blur: () => {
1230
- var H;
1231
- return (H = x.value) == null ? void 0 : H.blur();
1230
+ var O;
1231
+ return (O = V.value) == null ? void 0 : O.blur();
1232
1232
  }
1233
- }), (H, G) => (i(), c("div", {
1233
+ }), (O, q) => (r(), c("div", {
1234
1234
  ref_key: "pickerRef",
1235
- ref: w,
1236
- class: u($.value)
1235
+ ref: C,
1236
+ class: u(R.value)
1237
1237
  }, [
1238
- n.type !== "daterange" ? (i(), c("div", {
1238
+ n.type !== "daterange" ? (r(), c("div", {
1239
1239
  key: 0,
1240
- class: u(R.value),
1241
- onClick: y
1240
+ class: u(B.value),
1241
+ onClick: x
1242
1242
  }, [
1243
- f("input", {
1243
+ d("input", {
1244
1244
  ref_key: "inputRef",
1245
- ref: x,
1245
+ ref: V,
1246
1246
  type: "text",
1247
1247
  placeholder: n.placeholder,
1248
1248
  disabled: n.disabled,
1249
1249
  readonly: !0,
1250
1250
  value: P.value,
1251
- class: u(s(a).e("input-inner"))
1252
- }, null, 10, vt),
1253
- f("span", {
1254
- class: u(s(a).e("suffix"))
1251
+ class: u(s(l).e("input-inner"))
1252
+ }, null, 10, ft),
1253
+ d("span", {
1254
+ class: u(s(l).e("suffix"))
1255
1255
  }, [
1256
- n.clearable && P.value && !n.disabled ? (i(), c("span", {
1256
+ n.clearable && P.value && !n.disabled ? (r(), c("span", {
1257
1257
  key: 0,
1258
- class: u(s(a).e("clear")),
1258
+ class: u(s(l).e("clear")),
1259
1259
  onClick: ue(W, ["stop"])
1260
- }, " ✕ ", 2)) : (i(), c("span", {
1260
+ }, " ✕ ", 2)) : (r(), c("span", {
1261
1261
  key: 1,
1262
- class: u(s(a).e("icon"))
1262
+ class: u(s(l).e("icon"))
1263
1263
  }, "📅", 2))
1264
1264
  ], 2)
1265
- ], 2)) : (i(), c("div", {
1265
+ ], 2)) : (r(), c("div", {
1266
1266
  key: 1,
1267
- class: u(R.value),
1268
- onClick: y
1267
+ class: u(B.value),
1268
+ onClick: x
1269
1269
  }, [
1270
- f("input", {
1270
+ d("input", {
1271
1271
  type: "text",
1272
1272
  placeholder: n.startPlaceholder,
1273
1273
  disabled: n.disabled,
1274
1274
  readonly: !0,
1275
- value: b.value,
1276
- class: u(s(a).e("input-inner"))
1277
- }, null, 10, ft),
1278
- f("span", {
1279
- class: u(s(a).e("separator"))
1275
+ value: h.value,
1276
+ class: u(s(l).e("input-inner"))
1277
+ }, null, 10, mt),
1278
+ d("span", {
1279
+ class: u(s(l).e("separator"))
1280
1280
  }, "至", 2),
1281
- f("input", {
1281
+ d("input", {
1282
1282
  type: "text",
1283
1283
  placeholder: n.endPlaceholder,
1284
1284
  disabled: n.disabled,
1285
1285
  readonly: !0,
1286
- value: T.value,
1287
- class: u(s(a).e("input-inner"))
1288
- }, null, 10, mt),
1289
- f("span", {
1290
- class: u(s(a).e("suffix"))
1286
+ value: f.value,
1287
+ class: u(s(l).e("input-inner"))
1288
+ }, null, 10, pt),
1289
+ d("span", {
1290
+ class: u(s(l).e("suffix"))
1291
1291
  }, [
1292
- n.clearable && (b.value || T.value) && !n.disabled ? (i(), c("span", {
1292
+ n.clearable && (h.value || f.value) && !n.disabled ? (r(), c("span", {
1293
1293
  key: 0,
1294
- class: u(s(a).e("clear")),
1294
+ class: u(s(l).e("clear")),
1295
1295
  onClick: ue(W, ["stop"])
1296
- }, " ✕ ", 2)) : (i(), c("span", {
1296
+ }, " ✕ ", 2)) : (r(), c("span", {
1297
1297
  key: 1,
1298
- class: u(s(a).e("icon"))
1298
+ class: u(s(l).e("icon"))
1299
1299
  }, "📅", 2))
1300
1300
  ], 2)
1301
1301
  ], 2)),
1302
- (i(), he(Re, { to: "body" }, [
1303
- xe(Be, { name: "fade" }, {
1302
+ (r(), he(Re, { to: "body" }, [
1303
+ we(Be, { name: "fade" }, {
1304
1304
  default: Fe(() => [
1305
- ve(f("div", {
1305
+ oe(d("div", {
1306
1306
  ref_key: "popperRef",
1307
- ref: D,
1308
- class: u(s(a).e("popper")),
1309
- style: ae({ zIndex: v.value, ...C.value })
1307
+ ref: S,
1308
+ class: u(s(l).e("popper")),
1309
+ style: ae({ zIndex: p.value, ...$.value })
1310
1310
  }, [
1311
- f("div", {
1312
- class: u(s(a).e("header"))
1311
+ d("div", {
1312
+ class: u(s(l).e("header"))
1313
1313
  }, [
1314
- f("button", {
1314
+ d("button", {
1315
1315
  type: "button",
1316
- class: u(s(a).e("prev-btn")),
1317
- onClick: G[0] || (G[0] = (se) => d.value === "date" ? ee() : re())
1316
+ class: u(s(l).e("prev-btn")),
1317
+ onClick: q[0] || (q[0] = (se) => v.value === "date" ? ee() : de())
1318
1318
  }, " ‹ ", 2),
1319
- f("div", {
1320
- class: u(s(a).e("header-title"))
1319
+ d("div", {
1320
+ class: u(s(l).e("header-title"))
1321
1321
  }, [
1322
- d.value === "year" ? (i(), c("span", {
1322
+ v.value === "year" ? (r(), c("span", {
1323
1323
  key: 0,
1324
- onClick: G[1] || (G[1] = (se) => d.value = "month")
1325
- }, z(J.value), 1)) : (i(), c(j, { key: 1 }, [
1326
- f("span", { onClick: U }, z(K.value) + " 年", 1),
1327
- d.value === "date" ? (i(), c("span", {
1324
+ onClick: q[1] || (q[1] = (se) => v.value = "month")
1325
+ }, Y(_.value), 1)) : (r(), c(G, { key: 1 }, [
1326
+ d("span", { onClick: K }, Y(N.value) + " 年", 1),
1327
+ v.value === "date" ? (r(), c("span", {
1328
1328
  key: 0,
1329
- onClick: F
1330
- }, z(X.value + 1) + " 月", 1)) : N("", !0)
1329
+ onClick: I
1330
+ }, Y(X.value + 1) + " 月", 1)) : H("", !0)
1331
1331
  ], 64))
1332
1332
  ], 2),
1333
- f("button", {
1333
+ d("button", {
1334
1334
  type: "button",
1335
- class: u(s(a).e("next-btn")),
1336
- onClick: G[2] || (G[2] = (se) => d.value === "date" ? Y() : ge())
1335
+ class: u(s(l).e("next-btn")),
1336
+ onClick: q[2] || (q[2] = (se) => v.value === "date" ? z() : be())
1337
1337
  }, " › ", 2)
1338
1338
  ], 2),
1339
- f("div", {
1340
- class: u(s(a).e("content"))
1339
+ d("div", {
1340
+ class: u(s(l).e("content"))
1341
1341
  }, [
1342
- d.value === "date" ? (i(), he(ot, {
1342
+ v.value === "date" ? (r(), he(rt, {
1343
1343
  key: 0,
1344
- "model-value": B.value,
1345
- "viewed-month": V.value,
1344
+ "model-value": k.value,
1345
+ "viewed-month": D.value,
1346
1346
  "disabled-date": n.disabledDate,
1347
- "min-date": n.minDate ? s(be)(n.minDate) : null,
1348
- "max-date": n.maxDate ? s(be)(n.maxDate) : null,
1347
+ "min-date": n.minDate ? s(ye)(n.minDate) : null,
1348
+ "max-date": n.maxDate ? s(ye)(n.maxDate) : null,
1349
1349
  "selection-mode": n.type === "daterange" ? "range" : "single",
1350
- "range-state": M.value,
1351
- onPick: m,
1352
- onRangeSelect: O
1353
- }, null, 8, ["model-value", "viewed-month", "disabled-date", "min-date", "max-date", "selection-mode", "range-state"])) : d.value === "month" ? (i(), he(it, {
1350
+ "range-state": T.value,
1351
+ onPick: y,
1352
+ onRangeSelect: U
1353
+ }, null, 8, ["model-value", "viewed-month", "disabled-date", "min-date", "max-date", "selection-mode", "range-state"])) : v.value === "month" ? (r(), he(dt, {
1354
1354
  key: 1,
1355
- "model-value": B.value,
1356
- "viewed-year": K.value,
1355
+ "model-value": k.value,
1356
+ "viewed-year": N.value,
1357
1357
  "disabled-date": n.disabledDate,
1358
1358
  onPick: te
1359
- }, null, 8, ["model-value", "viewed-year", "disabled-date"])) : d.value === "year" ? (i(), he(dt, {
1359
+ }, null, 8, ["model-value", "viewed-year", "disabled-date"])) : v.value === "year" ? (r(), he(vt, {
1360
1360
  key: 2,
1361
- "model-value": B.value,
1362
- "viewed-year": K.value,
1361
+ "model-value": k.value,
1362
+ "viewed-year": N.value,
1363
1363
  "disabled-date": n.disabledDate,
1364
- onPick: A
1365
- }, null, 8, ["model-value", "viewed-year", "disabled-date"])) : N("", !0)
1364
+ onPick: E
1365
+ }, null, 8, ["model-value", "viewed-year", "disabled-date"])) : H("", !0)
1366
1366
  ], 2)
1367
1367
  ], 6), [
1368
- [Ie, g.value]
1368
+ [Ie, m.value]
1369
1369
  ])
1370
1370
  ]),
1371
1371
  _: 1
@@ -1374,31 +1374,31 @@ const nt = [
1374
1374
  ], 2));
1375
1375
  }
1376
1376
  });
1377
- function me(n, p = "HH:mm:ss") {
1377
+ function me(n, g = "HH:mm:ss") {
1378
1378
  if (!n) return "";
1379
- const e = n.getHours(), t = n.getMinutes(), l = n.getSeconds();
1380
- return p.replace(/HH/g, String(e).padStart(2, "0")).replace(/H/g, String(e)).replace(/mm/g, String(t).padStart(2, "0")).replace(/m/g, String(t)).replace(/ss/g, String(l).padStart(2, "0")).replace(/s/g, String(l));
1379
+ const t = n.getHours(), e = n.getMinutes(), a = n.getSeconds();
1380
+ return g.replace(/HH/g, String(t).padStart(2, "0")).replace(/H/g, String(t)).replace(/mm/g, String(e).padStart(2, "0")).replace(/m/g, String(e)).replace(/ss/g, String(a).padStart(2, "0")).replace(/s/g, String(a));
1381
1381
  }
1382
- function $e(n) {
1382
+ function Me(n) {
1383
1383
  if (!n) return null;
1384
1384
  if (n instanceof Date)
1385
1385
  return isNaN(n.getTime()) ? null : n;
1386
1386
  if (typeof n == "number") {
1387
- const t = /* @__PURE__ */ new Date();
1388
- return t.setTime(n), t;
1387
+ const e = /* @__PURE__ */ new Date();
1388
+ return e.setTime(n), e;
1389
1389
  }
1390
- const p = n.match(/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?/);
1391
- if (p) {
1392
- const t = /* @__PURE__ */ new Date();
1393
- return t.setHours(parseInt(p[1]), parseInt(p[2]), p[3] ? parseInt(p[3]) : 0, 0), t;
1390
+ const g = n.match(/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?/);
1391
+ if (g) {
1392
+ const e = /* @__PURE__ */ new Date();
1393
+ return e.setHours(parseInt(g[1]), parseInt(g[2]), g[3] ? parseInt(g[3]) : 0, 0), e;
1394
1394
  }
1395
- const e = new Date(n);
1396
- return isNaN(e.getTime()) ? null : e;
1395
+ const t = new Date(n);
1396
+ return isNaN(t.getTime()) ? null : t;
1397
1397
  }
1398
1398
  function pe(n) {
1399
1399
  return String(n).padStart(2, "0");
1400
1400
  }
1401
- const pt = ["onClick"], ht = ["onClick"], gt = ["onClick"], bt = /* @__PURE__ */ Z({
1401
+ const ht = ["onClick"], gt = ["onClick"], bt = ["onClick"], yt = /* @__PURE__ */ Q({
1402
1402
  name: "XTimePanel",
1403
1403
  __name: "TimePanel",
1404
1404
  props: {
@@ -1412,155 +1412,155 @@ const pt = ["onClick"], ht = ["onClick"], gt = ["onClick"], bt = /* @__PURE__ */
1412
1412
  secondStep: { default: 1 }
1413
1413
  },
1414
1414
  emits: ["confirm", "cancel"],
1415
- setup(n, { emit: p }) {
1416
- const e = n, t = p, l = Q("time-panel"), a = E(0), g = E(0), v = E(0), w = E(), k = E(), L = E(), D = h(() => e.format.includes("ss") || e.format.includes("s")), x = h(() => {
1417
- const A = [], ee = Math.max(1, e.hourStep);
1418
- for (let Y = 0; Y < 24; Y += ee)
1419
- A.push(Y);
1420
- return A;
1421
- }), C = h(() => {
1422
- const A = [], ee = Math.max(1, e.minuteStep);
1423
- for (let Y = 0; Y < 60; Y += ee)
1424
- A.push(Y);
1425
- return A;
1426
- }), I = h(() => {
1427
- const A = [], ee = Math.max(1, e.secondStep);
1428
- for (let Y = 0; Y < 60; Y += ee)
1429
- A.push(Y);
1430
- return A;
1431
- }), d = h(() => e.disabledHours ? new Set(e.disabledHours()) : /* @__PURE__ */ new Set()), V = h(() => e.disabledMinutes ? new Set(e.disabledMinutes(a.value)) : /* @__PURE__ */ new Set()), M = h(() => e.disabledSeconds ? new Set(e.disabledSeconds(a.value, g.value)) : /* @__PURE__ */ new Set()), S = h(() => `${pe(a.value)}:${pe(g.value)}${D.value ? ":" + pe(v.value) : ""}`), P = (A) => d.value.has(A), b = (A) => V.value.has(A), T = (A) => M.value.has(A), B = (A) => {
1432
- P(A) || (a.value = A, R(w.value, q(A)));
1433
- }, K = (A) => {
1434
- b(A) || (g.value = A, R(k.value, J(A)));
1435
- }, X = (A) => {
1436
- T(A) || (v.value = A, R(L.value, $(A)));
1437
- }, q = (A) => x.value.indexOf(A), J = (A) => C.value.indexOf(A), $ = (A) => I.value.indexOf(A), R = (A, ee) => {
1438
- if (!A) return;
1439
- const Y = 32, ge = ee * Y + 84 - 200 / 2 + Y / 2;
1440
- A.scrollTop = Math.max(0, ge);
1441
- }, y = () => {
1442
- if (!w.value) return;
1443
- const A = w.value.scrollTop, ee = Math.round((A - 84 + 100) / 32), Y = x.value[Math.max(0, Math.min(ee, x.value.length - 1))];
1444
- Y !== void 0 && !P(Y) && (a.value = Y);
1415
+ setup(n, { emit: g }) {
1416
+ const t = n, e = g, a = J("time-panel"), l = A(0), m = A(0), p = A(0), C = A(), w = A(), L = A(), S = b(() => t.format.includes("ss") || t.format.includes("s")), V = b(() => {
1417
+ const E = [], ee = Math.max(1, t.hourStep);
1418
+ for (let z = 0; z < 24; z += ee)
1419
+ E.push(z);
1420
+ return E;
1421
+ }), $ = b(() => {
1422
+ const E = [], ee = Math.max(1, t.minuteStep);
1423
+ for (let z = 0; z < 60; z += ee)
1424
+ E.push(z);
1425
+ return E;
1426
+ }), F = b(() => {
1427
+ const E = [], ee = Math.max(1, t.secondStep);
1428
+ for (let z = 0; z < 60; z += ee)
1429
+ E.push(z);
1430
+ return E;
1431
+ }), v = b(() => t.disabledHours ? new Set(t.disabledHours()) : /* @__PURE__ */ new Set()), D = b(() => t.disabledMinutes ? new Set(t.disabledMinutes(l.value)) : /* @__PURE__ */ new Set()), T = b(() => t.disabledSeconds ? new Set(t.disabledSeconds(l.value, m.value)) : /* @__PURE__ */ new Set()), M = b(() => `${pe(l.value)}:${pe(m.value)}${S.value ? ":" + pe(p.value) : ""}`), P = (E) => v.value.has(E), h = (E) => D.value.has(E), f = (E) => T.value.has(E), k = (E) => {
1432
+ P(E) || (l.value = E, B(C.value, j(E)));
1433
+ }, N = (E) => {
1434
+ h(E) || (m.value = E, B(w.value, _(E)));
1435
+ }, X = (E) => {
1436
+ f(E) || (p.value = E, B(L.value, R(E)));
1437
+ }, j = (E) => V.value.indexOf(E), _ = (E) => $.value.indexOf(E), R = (E) => F.value.indexOf(E), B = (E, ee) => {
1438
+ if (!E) return;
1439
+ const z = 32, be = ee * z + 84 - 200 / 2 + z / 2;
1440
+ E.scrollTop = Math.max(0, be);
1441
+ }, x = () => {
1442
+ if (!C.value) return;
1443
+ const E = C.value.scrollTop, ee = Math.round((E - 84 + 100) / 32), z = V.value[Math.max(0, Math.min(ee, V.value.length - 1))];
1444
+ z !== void 0 && !P(z) && (l.value = z);
1445
1445
  }, o = () => {
1446
- if (!k.value) return;
1447
- const A = k.value.scrollTop, ee = Math.round((A - 84 + 100) / 32), Y = C.value[Math.max(0, Math.min(ee, C.value.length - 1))];
1448
- Y !== void 0 && !b(Y) && (g.value = Y);
1449
- }, r = () => {
1446
+ if (!w.value) return;
1447
+ const E = w.value.scrollTop, ee = Math.round((E - 84 + 100) / 32), z = $.value[Math.max(0, Math.min(ee, $.value.length - 1))];
1448
+ z !== void 0 && !h(z) && (m.value = z);
1449
+ }, i = () => {
1450
1450
  if (!L.value) return;
1451
- const A = L.value.scrollTop, ee = Math.round((A - 84 + 100) / 32), Y = I.value[Math.max(0, Math.min(ee, I.value.length - 1))];
1452
- Y !== void 0 && !T(Y) && (v.value = Y);
1453
- }, m = () => {
1454
- const A = e.modelValue ? new Date(e.modelValue) : /* @__PURE__ */ new Date();
1455
- A.setHours(a.value, g.value, v.value, 0), t("confirm", A);
1456
- }, O = () => {
1457
- t("cancel");
1451
+ const E = L.value.scrollTop, ee = Math.round((E - 84 + 100) / 32), z = F.value[Math.max(0, Math.min(ee, F.value.length - 1))];
1452
+ z !== void 0 && !f(z) && (p.value = z);
1453
+ }, y = () => {
1454
+ const E = t.modelValue ? new Date(t.modelValue) : /* @__PURE__ */ new Date();
1455
+ E.setHours(l.value, m.value, p.value, 0), e("confirm", E);
1456
+ }, U = () => {
1457
+ e("cancel");
1458
1458
  }, te = () => {
1459
- if (e.modelValue)
1460
- a.value = e.modelValue.getHours(), g.value = e.modelValue.getMinutes(), v.value = e.modelValue.getSeconds();
1459
+ if (t.modelValue)
1460
+ l.value = t.modelValue.getHours(), m.value = t.modelValue.getMinutes(), p.value = t.modelValue.getSeconds();
1461
1461
  else {
1462
- const A = /* @__PURE__ */ new Date();
1463
- a.value = A.getHours(), g.value = A.getMinutes(), v.value = A.getSeconds();
1462
+ const E = /* @__PURE__ */ new Date();
1463
+ l.value = E.getHours(), m.value = E.getMinutes(), p.value = E.getSeconds();
1464
1464
  }
1465
- Ce(() => {
1466
- R(w.value, q(a.value)), R(k.value, J(g.value)), D.value && R(L.value, $(v.value));
1465
+ De(() => {
1466
+ B(C.value, j(l.value)), B(w.value, _(m.value)), S.value && B(L.value, R(p.value));
1467
1467
  });
1468
1468
  };
1469
- return ce(
1470
- () => e.modelValue,
1469
+ return ie(
1470
+ () => t.modelValue,
1471
1471
  () => {
1472
1472
  te();
1473
1473
  },
1474
1474
  { immediate: !0 }
1475
- ), ye(() => {
1475
+ ), ke(() => {
1476
1476
  te();
1477
- }), (A, ee) => (i(), c("div", {
1478
- class: u(s(l).b())
1477
+ }), (E, ee) => (r(), c("div", {
1478
+ class: u(s(a).b())
1479
1479
  }, [
1480
- f("div", {
1481
- class: u(s(l).e("content"))
1480
+ d("div", {
1481
+ class: u(s(a).e("content"))
1482
1482
  }, [
1483
- f("div", {
1484
- class: u(s(l).e("indicator"))
1483
+ d("div", {
1484
+ class: u(s(a).e("indicator"))
1485
1485
  }, null, 2),
1486
- f("div", {
1486
+ d("div", {
1487
1487
  ref_key: "hourListRef",
1488
- ref: w,
1489
- class: u(s(l).e("list")),
1490
- onScroll: y
1488
+ ref: C,
1489
+ class: u(s(a).e("list")),
1490
+ onScroll: x
1491
1491
  }, [
1492
- f("div", {
1493
- class: u(s(l).e("padding"))
1492
+ d("div", {
1493
+ class: u(s(a).e("padding"))
1494
1494
  }, null, 2),
1495
- (i(!0), c(j, null, _(x.value, (Y) => (i(), c("div", {
1496
- key: Y,
1497
- class: u([s(l).e("item"), s(l).is("selected", a.value === Y), s(l).is("disabled", P(Y))]),
1498
- onClick: (re) => B(Y)
1499
- }, z(s(pe)(Y)), 11, pt))), 128)),
1500
- f("div", {
1501
- class: u(s(l).e("padding"))
1495
+ (r(!0), c(G, null, Z(V.value, (z) => (r(), c("div", {
1496
+ key: z,
1497
+ class: u([s(a).e("item"), s(a).is("selected", l.value === z), s(a).is("disabled", P(z))]),
1498
+ onClick: (de) => k(z)
1499
+ }, Y(s(pe)(z)), 11, ht))), 128)),
1500
+ d("div", {
1501
+ class: u(s(a).e("padding"))
1502
1502
  }, null, 2)
1503
1503
  ], 34),
1504
- f("div", {
1504
+ d("div", {
1505
1505
  ref_key: "minuteListRef",
1506
- ref: k,
1507
- class: u(s(l).e("list")),
1506
+ ref: w,
1507
+ class: u(s(a).e("list")),
1508
1508
  onScroll: o
1509
1509
  }, [
1510
- f("div", {
1511
- class: u(s(l).e("padding"))
1510
+ d("div", {
1511
+ class: u(s(a).e("padding"))
1512
1512
  }, null, 2),
1513
- (i(!0), c(j, null, _(C.value, (Y) => (i(), c("div", {
1514
- key: Y,
1515
- class: u([s(l).e("item"), s(l).is("selected", g.value === Y), s(l).is("disabled", b(Y))]),
1516
- onClick: (re) => K(Y)
1517
- }, z(s(pe)(Y)), 11, ht))), 128)),
1518
- f("div", {
1519
- class: u(s(l).e("padding"))
1513
+ (r(!0), c(G, null, Z($.value, (z) => (r(), c("div", {
1514
+ key: z,
1515
+ class: u([s(a).e("item"), s(a).is("selected", m.value === z), s(a).is("disabled", h(z))]),
1516
+ onClick: (de) => N(z)
1517
+ }, Y(s(pe)(z)), 11, gt))), 128)),
1518
+ d("div", {
1519
+ class: u(s(a).e("padding"))
1520
1520
  }, null, 2)
1521
1521
  ], 34),
1522
- D.value ? (i(), c("div", {
1522
+ S.value ? (r(), c("div", {
1523
1523
  key: 0,
1524
1524
  ref_key: "secondListRef",
1525
1525
  ref: L,
1526
- class: u(s(l).e("list")),
1527
- onScroll: r
1526
+ class: u(s(a).e("list")),
1527
+ onScroll: i
1528
1528
  }, [
1529
- f("div", {
1530
- class: u(s(l).e("padding"))
1529
+ d("div", {
1530
+ class: u(s(a).e("padding"))
1531
1531
  }, null, 2),
1532
- (i(!0), c(j, null, _(I.value, (Y) => (i(), c("div", {
1533
- key: Y,
1534
- class: u([s(l).e("item"), s(l).is("selected", v.value === Y), s(l).is("disabled", T(Y))]),
1535
- onClick: (re) => X(Y)
1536
- }, z(s(pe)(Y)), 11, gt))), 128)),
1537
- f("div", {
1538
- class: u(s(l).e("padding"))
1532
+ (r(!0), c(G, null, Z(F.value, (z) => (r(), c("div", {
1533
+ key: z,
1534
+ class: u([s(a).e("item"), s(a).is("selected", p.value === z), s(a).is("disabled", f(z))]),
1535
+ onClick: (de) => X(z)
1536
+ }, Y(s(pe)(z)), 11, bt))), 128)),
1537
+ d("div", {
1538
+ class: u(s(a).e("padding"))
1539
1539
  }, null, 2)
1540
- ], 34)) : N("", !0)
1540
+ ], 34)) : H("", !0)
1541
1541
  ], 2),
1542
- f("div", {
1543
- class: u(s(l).e("footer"))
1542
+ d("div", {
1543
+ class: u(s(a).e("footer"))
1544
1544
  }, [
1545
- f("span", {
1546
- class: u(s(l).e("current-time"))
1547
- }, z(S.value), 3),
1548
- f("div", {
1549
- class: u(s(l).e("actions"))
1545
+ d("span", {
1546
+ class: u(s(a).e("current-time"))
1547
+ }, Y(M.value), 3),
1548
+ d("div", {
1549
+ class: u(s(a).e("actions"))
1550
1550
  }, [
1551
- f("button", {
1552
- class: u(s(l).e("btn-cancel")),
1553
- onClick: O
1551
+ d("button", {
1552
+ class: u(s(a).e("btn-cancel")),
1553
+ onClick: U
1554
1554
  }, "取消", 2),
1555
- f("button", {
1556
- class: u(s(l).e("btn-confirm")),
1557
- onClick: m
1555
+ d("button", {
1556
+ class: u(s(a).e("btn-confirm")),
1557
+ onClick: y
1558
1558
  }, "确定", 2)
1559
1559
  ], 2)
1560
1560
  ], 2)
1561
1561
  ], 2));
1562
1562
  }
1563
- }), yt = ["placeholder", "disabled", "value"], kt = ["placeholder", "disabled", "value"], xt = ["placeholder", "disabled", "value"], hl = /* @__PURE__ */ Z({
1563
+ }), kt = ["placeholder", "disabled", "value"], xt = ["placeholder", "disabled", "value"], wt = ["placeholder", "disabled", "value"], Ll = /* @__PURE__ */ Q({
1564
1564
  name: "XTimePicker",
1565
1565
  __name: "index",
1566
1566
  props: {
@@ -1583,197 +1583,197 @@ const pt = ["onClick"], ht = ["onClick"], gt = ["onClick"], bt = /* @__PURE__ */
1583
1583
  secondStep: { default: 1 }
1584
1584
  },
1585
1585
  emits: ["update:modelValue", "change", "focus", "blur", "clear"],
1586
- setup(n, { expose: p, emit: e }) {
1587
- const t = n, l = e, a = Q("time-picker"), g = () => Le().next(), v = E(!1), w = E(2e3), k = E(), L = E(), D = E(), x = E({
1586
+ setup(n, { expose: g, emit: t }) {
1587
+ const e = n, a = t, l = J("time-picker"), m = () => Le().next(), p = A(!1), C = A(2e3), w = A(), L = A(), S = A(), V = A({
1588
1588
  top: "0px",
1589
1589
  left: "0px"
1590
- }), C = E({
1590
+ }), $ = A({
1591
1591
  startTime: null,
1592
1592
  endTime: null
1593
- }), I = E("start"), d = h(() => {
1594
- if (!t.modelValue) return null;
1595
- if (t.type === "timerange") {
1596
- const [r, m] = t.modelValue;
1597
- return [$e(r), $e(m)];
1593
+ }), F = A("start"), v = b(() => {
1594
+ if (!e.modelValue) return null;
1595
+ if (e.type === "timerange") {
1596
+ const [i, y] = e.modelValue;
1597
+ return [Me(i), Me(y)];
1598
1598
  }
1599
- return $e(t.modelValue);
1600
- }), V = h(() => !d.value || Array.isArray(d.value) ? "" : me(d.value, t.format)), M = h(() => {
1601
- if (!Array.isArray(d.value)) return "";
1602
- const [r] = d.value;
1603
- return r ? me(r, t.format) : "";
1604
- }), S = h(() => {
1605
- if (!Array.isArray(d.value)) return "";
1606
- const [, r] = d.value;
1607
- return r ? me(r, t.format) : "";
1608
- }), P = h(() => t.type === "timerange" ? I.value === "start" ? C.value.startTime : C.value.endTime || C.value.startTime : d.value), b = h(() => [
1609
- a.b(),
1610
- a.m(t.size),
1611
- a.is("disabled", t.disabled),
1612
- a.is("range", t.type === "timerange")
1613
- ]), T = h(() => [
1614
- a.e("input"),
1615
- a.is("focus", v.value)
1616
- ]), B = () => {
1617
- t.disabled || t.readonly || (v.value ? q() : X());
1618
- }, K = (r) => {
1619
- t.disabled || t.readonly || (I.value = r, v.value || X());
1599
+ return Me(e.modelValue);
1600
+ }), D = b(() => !v.value || Array.isArray(v.value) ? "" : me(v.value, e.format)), T = b(() => {
1601
+ if (!Array.isArray(v.value)) return "";
1602
+ const [i] = v.value;
1603
+ return i ? me(i, e.format) : "";
1604
+ }), M = b(() => {
1605
+ if (!Array.isArray(v.value)) return "";
1606
+ const [, i] = v.value;
1607
+ return i ? me(i, e.format) : "";
1608
+ }), P = b(() => e.type === "timerange" ? F.value === "start" ? $.value.startTime : $.value.endTime || $.value.startTime : v.value), h = b(() => [
1609
+ l.b(),
1610
+ l.m(e.size),
1611
+ l.is("disabled", e.disabled),
1612
+ l.is("range", e.type === "timerange")
1613
+ ]), f = b(() => [
1614
+ l.e("input"),
1615
+ l.is("focus", p.value)
1616
+ ]), k = () => {
1617
+ e.disabled || e.readonly || (p.value ? j() : X());
1618
+ }, N = (i) => {
1619
+ e.disabled || e.readonly || (F.value = i, p.value || X());
1620
1620
  }, X = () => {
1621
- v.value = !0, w.value = g(), Ce(() => {
1622
- if (k.value && L.value) {
1623
- const r = k.value.getBoundingClientRect(), m = L.value.getBoundingClientRect();
1624
- let O = r.bottom + 8, te = r.left;
1625
- te + m.width > window.innerWidth && (te = window.innerWidth - m.width - 8), O + m.height > window.innerHeight && (O = r.top - m.height - 8), x.value = {
1626
- top: `${O}px`,
1621
+ p.value = !0, C.value = m(), De(() => {
1622
+ if (w.value && L.value) {
1623
+ const i = w.value.getBoundingClientRect(), y = L.value.getBoundingClientRect();
1624
+ let U = i.bottom + 8, te = i.left;
1625
+ te + y.width > window.innerWidth && (te = window.innerWidth - y.width - 8), U + y.height > window.innerHeight && (U = i.top - y.height - 8), V.value = {
1626
+ top: `${U}px`,
1627
1627
  left: `${te}px`
1628
1628
  };
1629
1629
  }
1630
- }), l("focus", {});
1631
- }, q = () => {
1632
- v.value = !1, l("blur", {});
1633
- }, J = (r) => {
1634
- if (t.type === "timerange")
1635
- if (I.value === "start")
1636
- C.value.startTime = r, I.value = "end", C.value.endTime && C.value.endTime < r && (C.value.endTime = null);
1630
+ }), a("focus", {});
1631
+ }, j = () => {
1632
+ p.value = !1, a("blur", {});
1633
+ }, _ = (i) => {
1634
+ if (e.type === "timerange")
1635
+ if (F.value === "start")
1636
+ $.value.startTime = i, F.value = "end", $.value.endTime && $.value.endTime < i && ($.value.endTime = null);
1637
1637
  else {
1638
- C.value.startTime && r < C.value.startTime ? (C.value.endTime = C.value.startTime, C.value.startTime = r) : C.value.endTime = r;
1639
- const m = t.valueFormat ? me(C.value.startTime, t.valueFormat) : C.value.startTime, O = t.valueFormat ? me(C.value.endTime, t.valueFormat) : C.value.endTime;
1640
- l("update:modelValue", [m, O]), l("change", [m, O]), q();
1638
+ $.value.startTime && i < $.value.startTime ? ($.value.endTime = $.value.startTime, $.value.startTime = i) : $.value.endTime = i;
1639
+ const y = e.valueFormat ? me($.value.startTime, e.valueFormat) : $.value.startTime, U = e.valueFormat ? me($.value.endTime, e.valueFormat) : $.value.endTime;
1640
+ a("update:modelValue", [y, U]), a("change", [y, U]), j();
1641
1641
  }
1642
1642
  else {
1643
- const m = t.valueFormat ? me(r, t.valueFormat) : r;
1644
- l("update:modelValue", m), l("change", m), q();
1643
+ const y = e.valueFormat ? me(i, e.valueFormat) : i;
1644
+ a("update:modelValue", y), a("change", y), j();
1645
1645
  }
1646
- }, $ = () => {
1647
- q();
1648
1646
  }, R = () => {
1649
- l("update:modelValue", null), l("change", null), l("clear"), C.value = {
1647
+ j();
1648
+ }, B = () => {
1649
+ a("update:modelValue", null), a("change", null), a("clear"), $.value = {
1650
1650
  startTime: null,
1651
1651
  endTime: null
1652
1652
  };
1653
- }, y = (r) => {
1654
- if (!k.value) return;
1655
- const m = r.target;
1656
- k.value.contains(m) || L.value && L.value.contains(m) || q();
1653
+ }, x = (i) => {
1654
+ if (!w.value) return;
1655
+ const y = i.target;
1656
+ w.value.contains(y) || L.value && L.value.contains(y) || j();
1657
1657
  };
1658
- ce(
1659
- () => t.modelValue,
1660
- (r) => {
1661
- if (r && t.type === "timerange") {
1662
- const [m, O] = d.value;
1663
- C.value = {
1664
- startTime: m,
1665
- endTime: O
1658
+ ie(
1659
+ () => e.modelValue,
1660
+ (i) => {
1661
+ if (i && e.type === "timerange") {
1662
+ const [y, U] = v.value;
1663
+ $.value = {
1664
+ startTime: y,
1665
+ endTime: U
1666
1666
  };
1667
1667
  }
1668
1668
  },
1669
1669
  { immediate: !0 }
1670
- ), ce(v, (r) => {
1671
- r && t.type === "timerange" && (C.value = {
1672
- startTime: Array.isArray(d.value) ? d.value[0] : null,
1673
- endTime: Array.isArray(d.value) ? d.value[1] : null
1674
- }, I.value = "start");
1670
+ ), ie(p, (i) => {
1671
+ i && e.type === "timerange" && ($.value = {
1672
+ startTime: Array.isArray(v.value) ? v.value[0] : null,
1673
+ endTime: Array.isArray(v.value) ? v.value[1] : null
1674
+ }, F.value = "start");
1675
1675
  });
1676
- const o = (r) => {
1677
- r.key === "Escape" && q();
1676
+ const o = (i) => {
1677
+ i.key === "Escape" && j();
1678
1678
  };
1679
- return ye(() => {
1680
- document.addEventListener("click", y), document.addEventListener("keydown", o);
1681
- }), ke(() => {
1682
- document.removeEventListener("click", y), document.removeEventListener("keydown", o);
1683
- }), p({
1679
+ return ke(() => {
1680
+ document.addEventListener("click", x), document.addEventListener("keydown", o);
1681
+ }), xe(() => {
1682
+ document.removeEventListener("click", x), document.removeEventListener("keydown", o);
1683
+ }), g({
1684
1684
  focus: () => {
1685
- var r;
1686
- return (r = D.value) == null ? void 0 : r.focus();
1685
+ var i;
1686
+ return (i = S.value) == null ? void 0 : i.focus();
1687
1687
  },
1688
1688
  blur: () => {
1689
- var r;
1690
- return (r = D.value) == null ? void 0 : r.blur();
1689
+ var i;
1690
+ return (i = S.value) == null ? void 0 : i.blur();
1691
1691
  }
1692
- }), (r, m) => (i(), c("div", {
1692
+ }), (i, y) => (r(), c("div", {
1693
1693
  ref_key: "pickerRef",
1694
- ref: k,
1695
- class: u(b.value)
1694
+ ref: w,
1695
+ class: u(h.value)
1696
1696
  }, [
1697
- n.type !== "timerange" ? (i(), c("div", {
1697
+ n.type !== "timerange" ? (r(), c("div", {
1698
1698
  key: 0,
1699
- class: u(T.value),
1700
- onClick: B
1699
+ class: u(f.value),
1700
+ onClick: k
1701
1701
  }, [
1702
- f("input", {
1702
+ d("input", {
1703
1703
  ref_key: "inputRef",
1704
- ref: D,
1704
+ ref: S,
1705
1705
  type: "text",
1706
1706
  placeholder: n.placeholder,
1707
1707
  disabled: n.disabled,
1708
1708
  readonly: !0,
1709
- value: V.value,
1710
- class: u(s(a).e("input-inner"))
1711
- }, null, 10, yt),
1712
- f("span", {
1713
- class: u(s(a).e("suffix"))
1709
+ value: D.value,
1710
+ class: u(s(l).e("input-inner"))
1711
+ }, null, 10, kt),
1712
+ d("span", {
1713
+ class: u(s(l).e("suffix"))
1714
1714
  }, [
1715
- n.clearable && V.value && !n.disabled ? (i(), c("span", {
1715
+ n.clearable && D.value && !n.disabled ? (r(), c("span", {
1716
1716
  key: 0,
1717
- class: u(s(a).e("clear")),
1718
- onClick: ue(R, ["stop"])
1719
- }, " ✕ ", 2)) : (i(), c("span", {
1717
+ class: u(s(l).e("clear")),
1718
+ onClick: ue(B, ["stop"])
1719
+ }, " ✕ ", 2)) : (r(), c("span", {
1720
1720
  key: 1,
1721
- class: u(s(a).e("icon"))
1721
+ class: u(s(l).e("icon"))
1722
1722
  }, "🕐", 2))
1723
1723
  ], 2)
1724
- ], 2)) : (i(), c("div", {
1724
+ ], 2)) : (r(), c("div", {
1725
1725
  key: 1,
1726
- class: u(T.value),
1727
- onClick: B
1726
+ class: u(f.value),
1727
+ onClick: k
1728
1728
  }, [
1729
- f("input", {
1729
+ d("input", {
1730
1730
  type: "text",
1731
1731
  placeholder: n.startPlaceholder,
1732
1732
  disabled: n.disabled,
1733
1733
  readonly: !0,
1734
- value: M.value,
1735
- class: u([s(a).e("input-inner"), s(a).is("active", I.value === "start")]),
1736
- onClick: m[0] || (m[0] = ue((O) => K("start"), ["stop"]))
1737
- }, null, 10, kt),
1738
- f("span", {
1739
- class: u(s(a).e("separator"))
1734
+ value: T.value,
1735
+ class: u([s(l).e("input-inner"), s(l).is("active", F.value === "start")]),
1736
+ onClick: y[0] || (y[0] = ue((U) => N("start"), ["stop"]))
1737
+ }, null, 10, xt),
1738
+ d("span", {
1739
+ class: u(s(l).e("separator"))
1740
1740
  }, "至", 2),
1741
- f("input", {
1741
+ d("input", {
1742
1742
  type: "text",
1743
1743
  placeholder: n.endPlaceholder,
1744
1744
  disabled: n.disabled,
1745
1745
  readonly: !0,
1746
- value: S.value,
1747
- class: u([s(a).e("input-inner"), s(a).is("active", I.value === "end")]),
1748
- onClick: m[1] || (m[1] = ue((O) => K("end"), ["stop"]))
1749
- }, null, 10, xt),
1750
- f("span", {
1751
- class: u(s(a).e("suffix"))
1746
+ value: M.value,
1747
+ class: u([s(l).e("input-inner"), s(l).is("active", F.value === "end")]),
1748
+ onClick: y[1] || (y[1] = ue((U) => N("end"), ["stop"]))
1749
+ }, null, 10, wt),
1750
+ d("span", {
1751
+ class: u(s(l).e("suffix"))
1752
1752
  }, [
1753
- n.clearable && (M.value || S.value) && !n.disabled ? (i(), c("span", {
1753
+ n.clearable && (T.value || M.value) && !n.disabled ? (r(), c("span", {
1754
1754
  key: 0,
1755
- class: u(s(a).e("clear")),
1756
- onClick: ue(R, ["stop"])
1757
- }, " ✕ ", 2)) : (i(), c("span", {
1755
+ class: u(s(l).e("clear")),
1756
+ onClick: ue(B, ["stop"])
1757
+ }, " ✕ ", 2)) : (r(), c("span", {
1758
1758
  key: 1,
1759
- class: u(s(a).e("icon"))
1759
+ class: u(s(l).e("icon"))
1760
1760
  }, "🕐", 2))
1761
1761
  ], 2)
1762
1762
  ], 2)),
1763
- (i(), he(Re, { to: "body" }, [
1764
- xe(Be, { name: "fade" }, {
1763
+ (r(), he(Re, { to: "body" }, [
1764
+ we(Be, { name: "fade" }, {
1765
1765
  default: Fe(() => [
1766
- ve(f("div", {
1766
+ oe(d("div", {
1767
1767
  ref_key: "popperRef",
1768
1768
  ref: L,
1769
- class: u(s(a).e("popper")),
1770
- style: ae({ zIndex: w.value, ...x.value })
1769
+ class: u(s(l).e("popper")),
1770
+ style: ae({ zIndex: C.value, ...V.value })
1771
1771
  }, [
1772
- n.type === "timerange" ? (i(), c("div", {
1772
+ n.type === "timerange" ? (r(), c("div", {
1773
1773
  key: 0,
1774
- class: u(s(a).e("popper-header"))
1775
- }, z(I.value === "start" ? "请选择开始时间" : "请选择结束时间"), 3)) : N("", !0),
1776
- xe(bt, {
1774
+ class: u(s(l).e("popper-header"))
1775
+ }, Y(F.value === "start" ? "请选择开始时间" : "请选择结束时间"), 3)) : H("", !0),
1776
+ we(yt, {
1777
1777
  "model-value": P.value,
1778
1778
  format: n.format,
1779
1779
  "disabled-hours": n.disabledHours,
@@ -1782,11 +1782,11 @@ const pt = ["onClick"], ht = ["onClick"], gt = ["onClick"], bt = /* @__PURE__ */
1782
1782
  "hour-step": n.hourStep,
1783
1783
  "minute-step": n.minuteStep,
1784
1784
  "second-step": n.secondStep,
1785
- onConfirm: J,
1786
- onCancel: $
1785
+ onConfirm: _,
1786
+ onCancel: R
1787
1787
  }, null, 8, ["model-value", "format", "disabled-hours", "disabled-minutes", "disabled-seconds", "hour-step", "minute-step", "second-step"])
1788
1788
  ], 6), [
1789
- [Ie, v.value]
1789
+ [Ie, p.value]
1790
1790
  ])
1791
1791
  ]),
1792
1792
  _: 1
@@ -1795,45 +1795,45 @@ const pt = ["onClick"], ht = ["onClick"], gt = ["onClick"], bt = /* @__PURE__ */
1795
1795
  ], 2));
1796
1796
  }
1797
1797
  });
1798
- function wt(n, p, e) {
1799
- return e ? e(p, n) : n.toLowerCase().includes(p.toLowerCase());
1798
+ function Vt(n, g, t) {
1799
+ return t ? t(g, n) : n.toLowerCase().includes(g.toLowerCase());
1800
1800
  }
1801
- function Ye(n, p, e = "value", t = "children") {
1802
- for (const l of n) {
1803
- if (l[e] === p)
1804
- return l;
1805
- if (l[t] && l[t].length > 0) {
1806
- const a = Ye(l[t], p, e, t);
1807
- if (a) return a;
1801
+ function ze(n, g, t = "value", e = "children") {
1802
+ for (const a of n) {
1803
+ if (a[t] === g)
1804
+ return a;
1805
+ if (a[e] && a[e].length > 0) {
1806
+ const l = ze(a[e], g, t, e);
1807
+ if (l) return l;
1808
1808
  }
1809
1809
  }
1810
1810
  return null;
1811
1811
  }
1812
- function Me(n, p, e = "value", t = "children") {
1813
- const l = [];
1814
- function a(g) {
1815
- for (const v of g) {
1816
- if (v[e] === p)
1817
- return l.push(v), !0;
1818
- if (v[t] && v[t].length > 0) {
1819
- if (l.push(v), a(v[t]))
1812
+ function Te(n, g, t = "value", e = "children") {
1813
+ const a = [];
1814
+ function l(m) {
1815
+ for (const p of m) {
1816
+ if (p[t] === g)
1817
+ return a.push(p), !0;
1818
+ if (p[e] && p[e].length > 0) {
1819
+ if (a.push(p), l(p[e]))
1820
1820
  return !0;
1821
- l.pop();
1821
+ a.pop();
1822
1822
  }
1823
1823
  }
1824
1824
  return !1;
1825
1825
  }
1826
- return a(n), l;
1826
+ return l(n), a;
1827
1827
  }
1828
- function Vt(n, p = "children") {
1829
- const e = [];
1830
- function t(l, a = 0, g = null) {
1831
- for (const v of l)
1832
- e.push({ ...v, level: a, parent: g }), v[p] && v[p].length > 0 && t(v[p], a + 1, v);
1828
+ function Ct(n, g = "children") {
1829
+ const t = [];
1830
+ function e(a, l = 0, m = null) {
1831
+ for (const p of a)
1832
+ t.push({ ...p, level: l, parent: m }), p[g] && p[g].length > 0 && e(p[g], l + 1, p);
1833
1833
  }
1834
- return t(n), e;
1834
+ return e(n), t;
1835
1835
  }
1836
- const Ct = ["onClick"], Dt = ["placeholder", "disabled", "readonly", "value"], St = ["onClick"], $t = ["onClick"], gl = /* @__PURE__ */ Z({
1836
+ const Dt = ["onClick"], $t = ["placeholder", "disabled", "readonly", "value"], St = ["onClick"], Mt = ["onClick"], Pl = /* @__PURE__ */ Q({
1837
1837
  name: "XSelect",
1838
1838
  __name: "index",
1839
1839
  props: {
@@ -1858,224 +1858,224 @@ const Ct = ["onClick"], Dt = ["placeholder", "disabled", "readonly", "value"], S
1858
1858
  noMatchText: { default: "无匹配数据" }
1859
1859
  },
1860
1860
  emits: ["update:modelValue", "update:value", "change", "clear", "focus", "blur", "visible-change", "remove-tag"],
1861
- setup(n, { emit: p }) {
1862
- const e = n, t = p, l = Q("select"), a = () => Le().next(), g = E(), v = E(), w = E(), k = E(!1), L = E(2e3), D = E(""), x = E(-1), C = E({ top: "0px", left: "0px" }), I = h(() => e.type === "multiple"), d = h(() => e.type === "cascader"), V = E([]), M = () => e.modelValue !== void 0 ? e.modelValue : e.value !== void 0 ? e.value : "", S = (F) => {
1863
- t("update:modelValue", F), t("update:value", F), t("change", F);
1864
- }, P = h(() => {
1865
- const F = M();
1866
- return I.value ? Array.isArray(F) ? F : [] : d.value ? Array.isArray(F) ? F : F ? [F] : [] : F !== "" && F !== null && F !== void 0 ? [F] : [];
1867
- }), b = h(() => d.value ? Vt(e.options, e.childrenKey) : e.options.map((F) => ({ ...F, level: 0 }))), T = h(() => !e.filterable || !D.value ? b.value : b.value.filter((F) => {
1868
- const U = F[e.labelKey] || "";
1869
- return wt(U, D.value, e.filterMethod);
1870
- })), B = h(() => {
1871
- const F = [];
1872
- for (const U of P.value) {
1873
- const W = Ye(e.options, U, e.valueKey, e.childrenKey);
1874
- W && F.push(W);
1861
+ setup(n, { emit: g }) {
1862
+ const t = n, e = g, a = J("select"), l = () => Le().next(), m = A(), p = A(), C = A(), w = A(!1), L = A(2e3), S = A(""), V = A(-1), $ = A({ top: "0px", left: "0px" }), F = b(() => t.type === "multiple"), v = b(() => t.type === "cascader"), D = A([]), T = () => t.modelValue !== void 0 ? t.modelValue : t.value !== void 0 ? t.value : "", M = (I) => {
1863
+ e("update:modelValue", I), e("update:value", I), e("change", I);
1864
+ }, P = b(() => {
1865
+ const I = T();
1866
+ return F.value ? Array.isArray(I) ? I : [] : v.value ? Array.isArray(I) ? I : I ? [I] : [] : I !== "" && I !== null && I !== void 0 ? [I] : [];
1867
+ }), h = b(() => v.value ? Ct(t.options, t.childrenKey) : t.options.map((I) => ({ ...I, level: 0 }))), f = b(() => !t.filterable || !S.value ? h.value : h.value.filter((I) => {
1868
+ const K = I[t.labelKey] || "";
1869
+ return Vt(K, S.value, t.filterMethod);
1870
+ })), k = b(() => {
1871
+ const I = [];
1872
+ for (const K of P.value) {
1873
+ const W = ze(t.options, K, t.valueKey, t.childrenKey);
1874
+ W && I.push(W);
1875
1875
  }
1876
- return F;
1877
- }), K = h(() => {
1878
- if (I.value)
1876
+ return I;
1877
+ }), N = b(() => {
1878
+ if (F.value)
1879
1879
  return "";
1880
- if (d.value)
1881
- return Me(e.options, P.value[P.value.length - 1], e.valueKey, e.childrenKey).map((W) => W[e.labelKey]).join(e.separator);
1882
- const F = B.value[0];
1883
- return F ? F[e.labelKey] : "";
1884
- }), X = h(() => I.value ? B.value : []), q = h(() => e.collapseTags ? X.value.slice(0, e.maxCollapseTags) : X.value), J = h(() => e.collapseTags ? Math.max(0, X.value.length - e.maxCollapseTags) : 0), $ = h(() => [
1885
- l.b(),
1886
- l.m(e.size),
1887
- l.is("disabled", e.disabled),
1888
- l.is("multiple", I.value),
1889
- l.is("cascader", d.value),
1890
- l.is("filterable", e.filterable),
1891
- l.is("focus", k.value)
1892
- ]), R = () => {
1893
- if (!g.value || !w.value || !k.value) return;
1894
- const F = g.value.getBoundingClientRect(), U = w.value.getBoundingClientRect();
1895
- let W = F.bottom + 4, ne = F.left;
1896
- ne + U.width > window.innerWidth && (ne = window.innerWidth - U.width - 8), W + U.height > window.innerHeight && (W = F.top - U.height - 4), C.value = {
1880
+ if (v.value)
1881
+ return Te(t.options, P.value[P.value.length - 1], t.valueKey, t.childrenKey).map((W) => W[t.labelKey]).join(t.separator);
1882
+ const I = k.value[0];
1883
+ return I ? I[t.labelKey] : "";
1884
+ }), X = b(() => F.value ? k.value : []), j = b(() => t.collapseTags ? X.value.slice(0, t.maxCollapseTags) : X.value), _ = b(() => t.collapseTags ? Math.max(0, X.value.length - t.maxCollapseTags) : 0), R = b(() => [
1885
+ a.b(),
1886
+ a.m(t.size),
1887
+ a.is("disabled", t.disabled),
1888
+ a.is("multiple", F.value),
1889
+ a.is("cascader", v.value),
1890
+ a.is("filterable", t.filterable),
1891
+ a.is("focus", w.value)
1892
+ ]), B = () => {
1893
+ if (!m.value || !C.value || !w.value) return;
1894
+ const I = m.value.getBoundingClientRect(), K = C.value.getBoundingClientRect();
1895
+ let W = I.bottom + 4, ne = I.left;
1896
+ ne + K.width > window.innerWidth && (ne = window.innerWidth - K.width - 8), W + K.height > window.innerHeight && (W = I.top - K.height - 4), $.value = {
1897
1897
  top: `${W}px`,
1898
1898
  left: `${ne}px`
1899
1899
  };
1900
- }, y = () => {
1901
- e.disabled || (k.value = !0, L.value = a(), D.value = "", Ce(() => {
1902
- R();
1903
- }), t("visible-change", !0), t("focus", {}));
1900
+ }, x = () => {
1901
+ t.disabled || (w.value = !0, L.value = l(), S.value = "", De(() => {
1902
+ B();
1903
+ }), e("visible-change", !0), e("focus", {}));
1904
1904
  }, o = () => {
1905
- k.value = !1, D.value = "", V.value = [], t("visible-change", !1), t("blur", {});
1906
- }, r = (F) => {
1907
- if (!F.disabled)
1908
- if (I.value) {
1909
- const U = [...P.value], W = F[e.valueKey], ne = U.indexOf(W);
1905
+ w.value = !1, S.value = "", D.value = [], e("visible-change", !1), e("blur", {});
1906
+ }, i = (I) => {
1907
+ if (!I.disabled)
1908
+ if (F.value) {
1909
+ const K = [...P.value], W = I[t.valueKey], ne = K.indexOf(W);
1910
1910
  if (ne > -1)
1911
- U.splice(ne, 1), t("remove-tag", W);
1911
+ K.splice(ne, 1), e("remove-tag", W);
1912
1912
  else {
1913
- if (e.multipleLimit > 0 && U.length >= e.multipleLimit)
1913
+ if (t.multipleLimit > 0 && K.length >= t.multipleLimit)
1914
1914
  return;
1915
- U.push(W);
1915
+ K.push(W);
1916
1916
  }
1917
- S(U);
1918
- } else if (d.value)
1919
- if (F.children && F.children.length > 0) {
1920
- const U = Me(e.options, F[e.valueKey], e.valueKey, e.childrenKey);
1921
- V.value = U;
1917
+ M(K);
1918
+ } else if (v.value)
1919
+ if (I.children && I.children.length > 0) {
1920
+ const K = Te(t.options, I[t.valueKey], t.valueKey, t.childrenKey);
1921
+ D.value = K;
1922
1922
  } else {
1923
- const W = Me(e.options, F[e.valueKey], e.valueKey, e.childrenKey).map((ne) => ne[e.valueKey]);
1924
- S(W), o();
1923
+ const W = Te(t.options, I[t.valueKey], t.valueKey, t.childrenKey).map((ne) => ne[t.valueKey]);
1924
+ M(W), o();
1925
1925
  }
1926
1926
  else
1927
- S(F[e.valueKey]), o();
1928
- }, m = (F) => {
1929
- const U = P.value.filter((W) => W !== F[e.valueKey]);
1930
- S(U), t("remove-tag", F[e.valueKey]);
1931
- }, O = () => {
1932
- const F = I.value ? [] : "";
1933
- S(F), t("clear");
1934
- }, te = (F) => {
1935
- D.value = F.target.value;
1936
- }, A = (F) => {
1937
- if (!g.value) return;
1938
- const U = F.target;
1939
- g.value.contains(U) || w.value && w.value.contains(U) || o();
1940
- }, ee = (F) => {
1941
- if (F.key === "Escape")
1927
+ M(I[t.valueKey]), o();
1928
+ }, y = (I) => {
1929
+ const K = P.value.filter((W) => W !== I[t.valueKey]);
1930
+ M(K), e("remove-tag", I[t.valueKey]);
1931
+ }, U = () => {
1932
+ const I = F.value ? [] : "";
1933
+ M(I), e("clear");
1934
+ }, te = (I) => {
1935
+ S.value = I.target.value;
1936
+ }, E = (I) => {
1937
+ if (!m.value) return;
1938
+ const K = I.target;
1939
+ m.value.contains(K) || C.value && C.value.contains(K) || o();
1940
+ }, ee = (I) => {
1941
+ if (I.key === "Escape")
1942
1942
  o();
1943
- else if (F.key === "Enter" && k.value) {
1944
- const U = T.value[x.value];
1945
- U && r(U);
1946
- } else F.key === "ArrowDown" && k.value ? (F.preventDefault(), x.value = Math.min(x.value + 1, T.value.length - 1)) : F.key === "ArrowUp" && k.value && (F.preventDefault(), x.value = Math.max(x.value - 1, 0));
1947
- }, Y = (F) => P.value.includes(F[e.valueKey]), re = (F, U) => [
1948
- l.e("option"),
1949
- l.is("selected", Y(F)),
1950
- l.is("disabled", F.disabled === !0),
1951
- l.is("hover", x.value === U),
1952
- l.is("group", !!(F.children && F.children.length > 0))
1953
- ], ge = h(() => {
1954
- if (!d.value) return [];
1955
- const F = [e.options];
1956
- for (const U of V.value)
1957
- U.children && U.children.length > 0 && F.push(U.children);
1958
- return F;
1943
+ else if (I.key === "Enter" && w.value) {
1944
+ const K = f.value[V.value];
1945
+ K && i(K);
1946
+ } else I.key === "ArrowDown" && w.value ? (I.preventDefault(), V.value = Math.min(V.value + 1, f.value.length - 1)) : I.key === "ArrowUp" && w.value && (I.preventDefault(), V.value = Math.max(V.value - 1, 0));
1947
+ }, z = (I) => P.value.includes(I[t.valueKey]), de = (I, K) => [
1948
+ a.e("option"),
1949
+ a.is("selected", z(I)),
1950
+ a.is("disabled", I.disabled === !0),
1951
+ a.is("hover", V.value === K),
1952
+ a.is("group", !!(I.children && I.children.length > 0))
1953
+ ], be = b(() => {
1954
+ if (!v.value) return [];
1955
+ const I = [t.options];
1956
+ for (const K of D.value)
1957
+ K.children && K.children.length > 0 && I.push(K.children);
1958
+ return I;
1959
1959
  });
1960
- return ye(() => {
1961
- document.addEventListener("click", A), document.addEventListener("keydown", ee);
1962
- }), ke(() => {
1963
- document.removeEventListener("click", A), document.removeEventListener("keydown", ee), document.removeEventListener("scroll", R, !0);
1964
- }), ce(k, (F) => {
1965
- F ? document.addEventListener("scroll", R, !0) : document.removeEventListener("scroll", R, !0);
1966
- }), Ve("select", {
1960
+ return ke(() => {
1961
+ document.addEventListener("click", E), document.addEventListener("keydown", ee);
1962
+ }), xe(() => {
1963
+ document.removeEventListener("click", E), document.removeEventListener("keydown", ee), document.removeEventListener("scroll", B, !0);
1964
+ }), ie(w, (I) => {
1965
+ I ? document.addEventListener("scroll", B, !0) : document.removeEventListener("scroll", B, !0);
1966
+ }), Ce("select", {
1967
1967
  selectedValues: P,
1968
- handleSelect: r,
1969
- isSelected: Y
1970
- }), (F, U) => (i(), c("div", {
1968
+ handleSelect: i,
1969
+ isSelected: z
1970
+ }), (I, K) => (r(), c("div", {
1971
1971
  ref_key: "selectRef",
1972
- ref: g,
1973
- class: u($.value)
1972
+ ref: m,
1973
+ class: u(R.value)
1974
1974
  }, [
1975
- f("div", {
1976
- class: u(s(l).e("wrapper")),
1977
- onClick: U[0] || (U[0] = (W) => k.value ? o() : y())
1975
+ d("div", {
1976
+ class: u(s(a).e("wrapper")),
1977
+ onClick: K[0] || (K[0] = (W) => w.value ? o() : x())
1978
1978
  }, [
1979
- I.value && X.value.length > 0 ? (i(), c("div", {
1979
+ F.value && X.value.length > 0 ? (r(), c("div", {
1980
1980
  key: 0,
1981
- class: u(s(l).e("tags"))
1981
+ class: u(s(a).e("tags"))
1982
1982
  }, [
1983
- (i(!0), c(j, null, _(q.value, (W) => (i(), c("span", {
1983
+ (r(!0), c(G, null, Z(j.value, (W) => (r(), c("span", {
1984
1984
  key: W[n.valueKey],
1985
- class: u(s(l).e("tag"))
1985
+ class: u(s(a).e("tag"))
1986
1986
  }, [
1987
- f("span", {
1988
- class: u(s(l).e("tag-text"))
1989
- }, z(W[n.labelKey]), 3),
1990
- f("span", {
1991
- class: u(s(l).e("tag-close")),
1992
- onClick: ue((ne) => m(W), ["stop"])
1993
- }, "×", 10, Ct)
1987
+ d("span", {
1988
+ class: u(s(a).e("tag-text"))
1989
+ }, Y(W[n.labelKey]), 3),
1990
+ d("span", {
1991
+ class: u(s(a).e("tag-close")),
1992
+ onClick: ue((ne) => y(W), ["stop"])
1993
+ }, "×", 10, Dt)
1994
1994
  ], 2))), 128)),
1995
- J.value > 0 ? (i(), c("span", {
1995
+ _.value > 0 ? (r(), c("span", {
1996
1996
  key: 0,
1997
- class: u(s(l).e("tag-count"))
1998
- }, " +" + z(J.value), 3)) : N("", !0)
1999
- ], 2)) : N("", !0),
2000
- f("input", {
1997
+ class: u(s(a).e("tag-count"))
1998
+ }, " +" + Y(_.value), 3)) : H("", !0)
1999
+ ], 2)) : H("", !0),
2000
+ d("input", {
2001
2001
  ref_key: "inputRef",
2002
- ref: v,
2003
- class: u(s(l).e("input")),
2004
- placeholder: I.value && X.value.length > 0 ? "" : n.placeholder,
2002
+ ref: p,
2003
+ class: u(s(a).e("input")),
2004
+ placeholder: F.value && X.value.length > 0 ? "" : n.placeholder,
2005
2005
  disabled: n.disabled,
2006
- readonly: !n.filterable || !k.value,
2007
- value: n.filterable && k.value ? D.value : K.value,
2006
+ readonly: !n.filterable || !w.value,
2007
+ value: n.filterable && w.value ? S.value : N.value,
2008
2008
  onInput: te
2009
- }, null, 42, Dt),
2010
- f("span", {
2011
- class: u(s(l).e("suffix"))
2009
+ }, null, 42, $t),
2010
+ d("span", {
2011
+ class: u(s(a).e("suffix"))
2012
2012
  }, [
2013
- n.clearable && P.value.length > 0 && !n.disabled ? (i(), c("span", {
2013
+ n.clearable && P.value.length > 0 && !n.disabled ? (r(), c("span", {
2014
2014
  key: 0,
2015
- class: u(s(l).e("clear")),
2016
- onClick: ue(O, ["stop"])
2017
- }, "×", 2)) : (i(), c("span", {
2015
+ class: u(s(a).e("clear")),
2016
+ onClick: ue(U, ["stop"])
2017
+ }, "×", 2)) : (r(), c("span", {
2018
2018
  key: 1,
2019
- class: u([s(l).e("arrow"), s(l).is("reverse", k.value)])
2019
+ class: u([s(a).e("arrow"), s(a).is("reverse", w.value)])
2020
2020
  }, "▼", 2))
2021
2021
  ], 2)
2022
2022
  ], 2),
2023
- (i(), he(Re, { to: "body" }, [
2024
- xe(Be, { name: "fade" }, {
2023
+ (r(), he(Re, { to: "body" }, [
2024
+ we(Be, { name: "fade" }, {
2025
2025
  default: Fe(() => [
2026
- ve(f("div", {
2026
+ oe(d("div", {
2027
2027
  ref_key: "popperRef",
2028
- ref: w,
2029
- class: u([s(l).e("popper"), s(l).is("cascader", d.value)]),
2030
- style: ae({ zIndex: L.value, ...C.value })
2028
+ ref: C,
2029
+ class: u([s(a).e("popper"), s(a).is("cascader", v.value)]),
2030
+ style: ae({ zIndex: L.value, ...$.value })
2031
2031
  }, [
2032
- d.value ? (i(), c("div", {
2032
+ v.value ? (r(), c("div", {
2033
2033
  key: 0,
2034
- class: u(s(l).e("cascader-panels"))
2034
+ class: u(s(a).e("cascader-panels"))
2035
2035
  }, [
2036
- (i(!0), c(j, null, _(ge.value, (W, ne) => (i(), c("div", {
2036
+ (r(!0), c(G, null, Z(be.value, (W, ne) => (r(), c("div", {
2037
2037
  key: ne,
2038
- class: u(s(l).e("cascader-panel"))
2038
+ class: u(s(a).e("cascader-panel"))
2039
2039
  }, [
2040
- (i(!0), c(j, null, _(W, (oe, H) => (i(), c("div", {
2041
- key: oe[n.valueKey],
2042
- class: u(re(oe, H)),
2043
- onClick: (G) => r(oe)
2040
+ (r(!0), c(G, null, Z(W, (re, O) => (r(), c("div", {
2041
+ key: re[n.valueKey],
2042
+ class: u(de(re, O)),
2043
+ onClick: (q) => i(re)
2044
2044
  }, [
2045
- f("span", {
2046
- class: u(s(l).e("option-label"))
2047
- }, z(oe[n.labelKey]), 3),
2048
- oe.children && oe.children.length > 0 ? (i(), c("span", {
2045
+ d("span", {
2046
+ class: u(s(a).e("option-label"))
2047
+ }, Y(re[n.labelKey]), 3),
2048
+ re.children && re.children.length > 0 ? (r(), c("span", {
2049
2049
  key: 0,
2050
- class: u(s(l).e("option-arrow"))
2051
- }, "›", 2)) : N("", !0)
2050
+ class: u(s(a).e("option-arrow"))
2051
+ }, "›", 2)) : H("", !0)
2052
2052
  ], 10, St))), 128))
2053
2053
  ], 2))), 128))
2054
- ], 2)) : (i(), c(j, { key: 1 }, [
2055
- T.value.length === 0 ? (i(), c("div", {
2054
+ ], 2)) : (r(), c(G, { key: 1 }, [
2055
+ f.value.length === 0 ? (r(), c("div", {
2056
2056
  key: 0,
2057
- class: u(s(l).e("empty"))
2058
- }, z(D.value ? n.noMatchText : n.noDataText), 3)) : (i(), c("div", {
2057
+ class: u(s(a).e("empty"))
2058
+ }, Y(S.value ? n.noMatchText : n.noDataText), 3)) : (r(), c("div", {
2059
2059
  key: 1,
2060
- class: u(s(l).e("options"))
2060
+ class: u(s(a).e("options"))
2061
2061
  }, [
2062
- (i(!0), c(j, null, _(T.value, (W, ne) => (i(), c("div", {
2062
+ (r(!0), c(G, null, Z(f.value, (W, ne) => (r(), c("div", {
2063
2063
  key: W[n.valueKey],
2064
- class: u(re(W, ne)),
2065
- onClick: (oe) => r(W)
2064
+ class: u(de(W, ne)),
2065
+ onClick: (re) => i(W)
2066
2066
  }, [
2067
- f("span", {
2068
- class: u(s(l).e("option-label"))
2069
- }, z(W[n.labelKey]), 3),
2070
- Y(W) ? (i(), c("span", {
2067
+ d("span", {
2068
+ class: u(s(a).e("option-label"))
2069
+ }, Y(W[n.labelKey]), 3),
2070
+ z(W) ? (r(), c("span", {
2071
2071
  key: 0,
2072
- class: u(s(l).e("option-check"))
2073
- }, "✓", 2)) : N("", !0)
2074
- ], 10, $t))), 128))
2072
+ class: u(s(a).e("option-check"))
2073
+ }, "✓", 2)) : H("", !0)
2074
+ ], 10, Mt))), 128))
2075
2075
  ], 2))
2076
2076
  ], 64))
2077
2077
  ], 6), [
2078
- [Ie, k.value]
2078
+ [Ie, w.value]
2079
2079
  ])
2080
2080
  ]),
2081
2081
  _: 1
@@ -2083,7 +2083,7 @@ const Ct = ["onClick"], Dt = ["placeholder", "disabled", "readonly", "value"], S
2083
2083
  ]))
2084
2084
  ], 2));
2085
2085
  }
2086
- }), Mt = ["checked", "indeterminate"], Tt = ["placeholder"], Rt = ["onClick"], Bt = ["checked", "disabled", "onChange"], Ft = ["disabled"], It = ["disabled"], Lt = ["checked", "indeterminate"], Pt = ["placeholder"], At = ["onClick"], Et = ["checked", "disabled", "onChange"], bl = /* @__PURE__ */ Z({
2086
+ }), Tt = ["checked", "indeterminate"], Rt = ["placeholder"], Bt = ["onClick"], Ft = ["checked", "disabled", "onChange"], It = ["disabled"], Lt = ["disabled"], Pt = ["checked", "indeterminate"], At = ["placeholder"], Et = ["onClick"], Yt = ["checked", "disabled", "onChange"], Al = /* @__PURE__ */ Q({
2087
2087
  name: "XTransfer",
2088
2088
  __name: "index",
2089
2089
  props: {
@@ -2100,222 +2100,222 @@ const Ct = ["onClick"], Dt = ["placeholder", "disabled", "readonly", "value"], S
2100
2100
  rightDefaultChecked: { default: () => [] }
2101
2101
  },
2102
2102
  emits: ["update:modelValue", "change", "left-check-change", "right-check-change"],
2103
- setup(n, { expose: p, emit: e }) {
2104
- const t = n, l = e, a = Q("transfer"), g = h(() => {
2103
+ setup(n, { expose: g, emit: t }) {
2104
+ const e = n, a = t, l = J("transfer"), m = b(() => {
2105
2105
  var o;
2106
- return ((o = t.props) == null ? void 0 : o.key) || "key";
2107
- }), v = h(() => {
2106
+ return ((o = e.props) == null ? void 0 : o.key) || "key";
2107
+ }), p = b(() => {
2108
2108
  var o;
2109
- return ((o = t.props) == null ? void 0 : o.label) || "label";
2110
- }), w = h(() => {
2109
+ return ((o = e.props) == null ? void 0 : o.label) || "label";
2110
+ }), C = b(() => {
2111
2111
  var o;
2112
- return ((o = t.props) == null ? void 0 : o.disabled) || "disabled";
2113
- }), k = E(""), L = E(""), D = E([]), x = E([]), C = (o) => o[g.value], I = (o) => o[v.value], d = (o) => o[w.value] || !1, V = h(() => t.data.filter((o) => {
2114
- const r = C(o);
2115
- return t.modelValue.includes(r) ? !1 : t.filterable && k.value ? t.filterMethod ? t.filterMethod(k.value, o) : I(o).toLowerCase().includes(k.value.toLowerCase()) : !0;
2116
- })), M = h(() => {
2117
- const o = t.modelValue;
2118
- let r = t.data.filter((m) => {
2119
- const O = C(m);
2120
- return o.includes(O);
2112
+ return ((o = e.props) == null ? void 0 : o.disabled) || "disabled";
2113
+ }), w = A(""), L = A(""), S = A([]), V = A([]), $ = (o) => o[m.value], F = (o) => o[p.value], v = (o) => o[C.value] || !1, D = b(() => e.data.filter((o) => {
2114
+ const i = $(o);
2115
+ return e.modelValue.includes(i) ? !1 : e.filterable && w.value ? e.filterMethod ? e.filterMethod(w.value, o) : F(o).toLowerCase().includes(w.value.toLowerCase()) : !0;
2116
+ })), T = b(() => {
2117
+ const o = e.modelValue;
2118
+ let i = e.data.filter((y) => {
2119
+ const U = $(y);
2120
+ return o.includes(U);
2121
2121
  });
2122
- return t.filterable && L.value && (r = r.filter((m) => t.filterMethod ? t.filterMethod(L.value, m) : I(m).toLowerCase().includes(L.value.toLowerCase()))), t.targetOrder === "push" ? r.sort((m, O) => o.indexOf(C(m)) - o.indexOf(C(O))) : t.targetOrder === "unshift" ? r.sort((m, O) => o.indexOf(C(O)) - o.indexOf(C(m))) : r;
2123
- }), S = h(() => V.value.filter((o) => D.value.includes(C(o))).every((o) => d(o))), P = h(() => M.value.filter((o) => x.value.includes(C(o))).every((o) => d(o))), b = h(() => D.value.length === 0 || S.value), T = h(() => x.value.length === 0 || P.value), B = () => {
2124
- const o = D.value.filter((m) => {
2125
- const O = t.data.find((te) => C(te) === m);
2126
- return O && !d(O);
2122
+ return e.filterable && L.value && (i = i.filter((y) => e.filterMethod ? e.filterMethod(L.value, y) : F(y).toLowerCase().includes(L.value.toLowerCase()))), e.targetOrder === "push" ? i.sort((y, U) => o.indexOf($(y)) - o.indexOf($(U))) : e.targetOrder === "unshift" ? i.sort((y, U) => o.indexOf($(U)) - o.indexOf($(y))) : i;
2123
+ }), M = b(() => D.value.filter((o) => S.value.includes($(o))).every((o) => v(o))), P = b(() => T.value.filter((o) => V.value.includes($(o))).every((o) => v(o))), h = b(() => S.value.length === 0 || M.value), f = b(() => V.value.length === 0 || P.value), k = () => {
2124
+ const o = S.value.filter((y) => {
2125
+ const U = e.data.find((te) => $(te) === y);
2126
+ return U && !v(U);
2127
2127
  });
2128
- let r;
2129
- t.targetOrder === "unshift" ? r = [...o, ...t.modelValue] : r = [...t.modelValue, ...o], l("update:modelValue", r), l("change", r, "right", o), D.value = [];
2130
- }, K = () => {
2131
- const o = x.value.filter((m) => {
2132
- const O = t.data.find((te) => C(te) === m);
2133
- return O && !d(O);
2134
- }), r = t.modelValue.filter((m) => !o.includes(m));
2135
- l("update:modelValue", r), l("change", r, "left", o), x.value = [];
2128
+ let i;
2129
+ e.targetOrder === "unshift" ? i = [...o, ...e.modelValue] : i = [...e.modelValue, ...o], a("update:modelValue", i), a("change", i, "right", o), S.value = [];
2130
+ }, N = () => {
2131
+ const o = V.value.filter((y) => {
2132
+ const U = e.data.find((te) => $(te) === y);
2133
+ return U && !v(U);
2134
+ }), i = e.modelValue.filter((y) => !o.includes(y));
2135
+ a("update:modelValue", i), a("change", i, "left", o), V.value = [];
2136
2136
  }, X = (o) => {
2137
- const r = D.value.indexOf(o);
2138
- r > -1 ? D.value.splice(r, 1) : D.value.push(o), l("left-check-change", [...D.value]);
2139
- }, q = (o) => {
2140
- const r = x.value.indexOf(o);
2141
- r > -1 ? x.value.splice(r, 1) : x.value.push(o), l("right-check-change", [...x.value]);
2142
- }, J = () => {
2143
- D.value.length === V.value.filter((o) => !d(o)).length ? D.value = [] : D.value = V.value.filter((o) => !d(o)).map((o) => C(o)), l("left-check-change", [...D.value]);
2144
- }, $ = () => {
2145
- x.value.length === M.value.filter((o) => !d(o)).length ? x.value = [] : x.value = M.value.filter((o) => !d(o)).map((o) => C(o)), l("right-check-change", [...x.value]);
2146
- }, R = (o) => {
2147
- o === "left" ? k.value = "" : L.value = "";
2148
- }, y = h(() => [a.b()]);
2149
- return p({
2150
- clearQuery: R
2151
- }), (o, r) => (i(), c("div", {
2152
- class: u(y.value)
2137
+ const i = S.value.indexOf(o);
2138
+ i > -1 ? S.value.splice(i, 1) : S.value.push(o), a("left-check-change", [...S.value]);
2139
+ }, j = (o) => {
2140
+ const i = V.value.indexOf(o);
2141
+ i > -1 ? V.value.splice(i, 1) : V.value.push(o), a("right-check-change", [...V.value]);
2142
+ }, _ = () => {
2143
+ S.value.length === D.value.filter((o) => !v(o)).length ? S.value = [] : S.value = D.value.filter((o) => !v(o)).map((o) => $(o)), a("left-check-change", [...S.value]);
2144
+ }, R = () => {
2145
+ V.value.length === T.value.filter((o) => !v(o)).length ? V.value = [] : V.value = T.value.filter((o) => !v(o)).map((o) => $(o)), a("right-check-change", [...V.value]);
2146
+ }, B = (o) => {
2147
+ o === "left" ? w.value = "" : L.value = "";
2148
+ }, x = b(() => [l.b()]);
2149
+ return g({
2150
+ clearQuery: B
2151
+ }), (o, i) => (r(), c("div", {
2152
+ class: u(x.value)
2153
2153
  }, [
2154
- f("div", {
2155
- class: u(s(a).e("panel"))
2154
+ d("div", {
2155
+ class: u(s(l).e("panel"))
2156
2156
  }, [
2157
- f("div", {
2158
- class: u(s(a).e("header"))
2157
+ d("div", {
2158
+ class: u(s(l).e("header"))
2159
2159
  }, [
2160
- f("label", {
2161
- class: u(s(a).e("checkbox"))
2160
+ d("label", {
2161
+ class: u(s(l).e("checkbox"))
2162
2162
  }, [
2163
- f("input", {
2163
+ d("input", {
2164
2164
  type: "checkbox",
2165
- checked: D.value.length > 0 && D.value.length === V.value.filter((m) => !d(m)).length,
2166
- indeterminate: D.value.length > 0 && D.value.length < V.value.filter((m) => !d(m)).length,
2167
- onChange: J
2168
- }, null, 40, Mt),
2169
- f("span", null, z(n.titles[0]), 1)
2165
+ checked: S.value.length > 0 && S.value.length === D.value.filter((y) => !v(y)).length,
2166
+ indeterminate: S.value.length > 0 && S.value.length < D.value.filter((y) => !v(y)).length,
2167
+ onChange: _
2168
+ }, null, 40, Tt),
2169
+ d("span", null, Y(n.titles[0]), 1)
2170
2170
  ], 2),
2171
- f("span", {
2172
- class: u(s(a).e("count"))
2173
- }, z(D.value.length) + " / " + z(V.value.length), 3)
2171
+ d("span", {
2172
+ class: u(s(l).e("count"))
2173
+ }, Y(S.value.length) + " / " + Y(D.value.length), 3)
2174
2174
  ], 2),
2175
- n.filterable ? (i(), c("div", {
2175
+ n.filterable ? (r(), c("div", {
2176
2176
  key: 0,
2177
- class: u(s(a).e("filter"))
2177
+ class: u(s(l).e("filter"))
2178
2178
  }, [
2179
- ve(f("input", {
2180
- "onUpdate:modelValue": r[0] || (r[0] = (m) => k.value = m),
2179
+ oe(d("input", {
2180
+ "onUpdate:modelValue": i[0] || (i[0] = (y) => w.value = y),
2181
2181
  placeholder: n.filterPlaceholder,
2182
- class: u(s(a).e("filter-input"))
2183
- }, null, 10, Tt), [
2184
- [Te, k.value]
2182
+ class: u(s(l).e("filter-input"))
2183
+ }, null, 10, Rt), [
2184
+ [ge, w.value]
2185
2185
  ]),
2186
- k.value ? (i(), c("span", {
2186
+ w.value ? (r(), c("span", {
2187
2187
  key: 0,
2188
- class: u(s(a).e("filter-clear")),
2189
- onClick: r[1] || (r[1] = (m) => R("left"))
2190
- }, "×", 2)) : N("", !0)
2191
- ], 2)) : N("", !0),
2192
- f("div", {
2193
- class: u(s(a).e("body"))
2188
+ class: u(s(l).e("filter-clear")),
2189
+ onClick: i[1] || (i[1] = (y) => B("left"))
2190
+ }, "×", 2)) : H("", !0)
2191
+ ], 2)) : H("", !0),
2192
+ d("div", {
2193
+ class: u(s(l).e("body"))
2194
2194
  }, [
2195
- (i(!0), c(j, null, _(V.value, (m) => (i(), c("div", {
2196
- key: C(m),
2195
+ (r(!0), c(G, null, Z(D.value, (y) => (r(), c("div", {
2196
+ key: $(y),
2197
2197
  class: u([
2198
- s(a).e("item"),
2199
- s(a).is("disabled", d(m)),
2200
- s(a).is("checked", D.value.includes(C(m)))
2198
+ s(l).e("item"),
2199
+ s(l).is("disabled", v(y)),
2200
+ s(l).is("checked", S.value.includes($(y)))
2201
2201
  ]),
2202
- onClick: (O) => !d(m) && X(C(m))
2202
+ onClick: (U) => !v(y) && X($(y))
2203
2203
  }, [
2204
- f("label", {
2205
- class: u(s(a).e("checkbox"))
2204
+ d("label", {
2205
+ class: u(s(l).e("checkbox"))
2206
2206
  }, [
2207
- f("input", {
2207
+ d("input", {
2208
2208
  type: "checkbox",
2209
- checked: D.value.includes(C(m)),
2210
- disabled: d(m),
2211
- onClick: r[2] || (r[2] = ue(() => {
2209
+ checked: S.value.includes($(y)),
2210
+ disabled: v(y),
2211
+ onClick: i[2] || (i[2] = ue(() => {
2212
2212
  }, ["stop"])),
2213
- onChange: (O) => X(C(m))
2214
- }, null, 40, Bt),
2215
- f("span", null, z(I(m)), 1)
2213
+ onChange: (U) => X($(y))
2214
+ }, null, 40, Ft),
2215
+ d("span", null, Y(F(y)), 1)
2216
2216
  ], 2)
2217
- ], 10, Rt))), 128)),
2218
- V.value.length === 0 ? (i(), c("div", {
2217
+ ], 10, Bt))), 128)),
2218
+ D.value.length === 0 ? (r(), c("div", {
2219
2219
  key: 0,
2220
- class: u(s(a).e("empty"))
2220
+ class: u(s(l).e("empty"))
2221
2221
  }, [
2222
2222
  le(o.$slots, "left-empty", {}, () => [
2223
- r[6] || (r[6] = fe("暂无数据", -1))
2223
+ i[6] || (i[6] = fe("暂无数据", -1))
2224
2224
  ])
2225
- ], 2)) : N("", !0)
2225
+ ], 2)) : H("", !0)
2226
2226
  ], 2)
2227
2227
  ], 2),
2228
- f("div", {
2229
- class: u(s(a).e("buttons"))
2228
+ d("div", {
2229
+ class: u(s(l).e("buttons"))
2230
2230
  }, [
2231
- f("button", {
2232
- class: u([s(a).e("button"), s(a).is("disabled", b.value)]),
2233
- disabled: b.value,
2234
- onClick: B
2235
- }, z(n.buttonTexts[0] || ">"), 11, Ft),
2236
- f("button", {
2237
- class: u([s(a).e("button"), s(a).is("disabled", T.value)]),
2238
- disabled: T.value,
2239
- onClick: K
2240
- }, z(n.buttonTexts[1] || "<"), 11, It)
2231
+ d("button", {
2232
+ class: u([s(l).e("button"), s(l).is("disabled", h.value)]),
2233
+ disabled: h.value,
2234
+ onClick: k
2235
+ }, Y(n.buttonTexts[0] || ">"), 11, It),
2236
+ d("button", {
2237
+ class: u([s(l).e("button"), s(l).is("disabled", f.value)]),
2238
+ disabled: f.value,
2239
+ onClick: N
2240
+ }, Y(n.buttonTexts[1] || "<"), 11, Lt)
2241
2241
  ], 2),
2242
- f("div", {
2243
- class: u(s(a).e("panel"))
2242
+ d("div", {
2243
+ class: u(s(l).e("panel"))
2244
2244
  }, [
2245
- f("div", {
2246
- class: u(s(a).e("header"))
2245
+ d("div", {
2246
+ class: u(s(l).e("header"))
2247
2247
  }, [
2248
- f("label", {
2249
- class: u(s(a).e("checkbox"))
2248
+ d("label", {
2249
+ class: u(s(l).e("checkbox"))
2250
2250
  }, [
2251
- f("input", {
2251
+ d("input", {
2252
2252
  type: "checkbox",
2253
- checked: x.value.length > 0 && x.value.length === M.value.filter((m) => !d(m)).length,
2254
- indeterminate: x.value.length > 0 && x.value.length < M.value.filter((m) => !d(m)).length,
2255
- onChange: $
2256
- }, null, 40, Lt),
2257
- f("span", null, z(n.titles[1]), 1)
2253
+ checked: V.value.length > 0 && V.value.length === T.value.filter((y) => !v(y)).length,
2254
+ indeterminate: V.value.length > 0 && V.value.length < T.value.filter((y) => !v(y)).length,
2255
+ onChange: R
2256
+ }, null, 40, Pt),
2257
+ d("span", null, Y(n.titles[1]), 1)
2258
2258
  ], 2),
2259
- f("span", {
2260
- class: u(s(a).e("count"))
2261
- }, z(x.value.length) + " / " + z(M.value.length), 3)
2259
+ d("span", {
2260
+ class: u(s(l).e("count"))
2261
+ }, Y(V.value.length) + " / " + Y(T.value.length), 3)
2262
2262
  ], 2),
2263
- n.filterable ? (i(), c("div", {
2263
+ n.filterable ? (r(), c("div", {
2264
2264
  key: 0,
2265
- class: u(s(a).e("filter"))
2265
+ class: u(s(l).e("filter"))
2266
2266
  }, [
2267
- ve(f("input", {
2268
- "onUpdate:modelValue": r[3] || (r[3] = (m) => L.value = m),
2267
+ oe(d("input", {
2268
+ "onUpdate:modelValue": i[3] || (i[3] = (y) => L.value = y),
2269
2269
  placeholder: n.filterPlaceholder,
2270
- class: u(s(a).e("filter-input"))
2271
- }, null, 10, Pt), [
2272
- [Te, L.value]
2270
+ class: u(s(l).e("filter-input"))
2271
+ }, null, 10, At), [
2272
+ [ge, L.value]
2273
2273
  ]),
2274
- L.value ? (i(), c("span", {
2274
+ L.value ? (r(), c("span", {
2275
2275
  key: 0,
2276
- class: u(s(a).e("filter-clear")),
2277
- onClick: r[4] || (r[4] = (m) => R("right"))
2278
- }, "×", 2)) : N("", !0)
2279
- ], 2)) : N("", !0),
2280
- f("div", {
2281
- class: u(s(a).e("body"))
2276
+ class: u(s(l).e("filter-clear")),
2277
+ onClick: i[4] || (i[4] = (y) => B("right"))
2278
+ }, "×", 2)) : H("", !0)
2279
+ ], 2)) : H("", !0),
2280
+ d("div", {
2281
+ class: u(s(l).e("body"))
2282
2282
  }, [
2283
- (i(!0), c(j, null, _(M.value, (m) => (i(), c("div", {
2284
- key: C(m),
2283
+ (r(!0), c(G, null, Z(T.value, (y) => (r(), c("div", {
2284
+ key: $(y),
2285
2285
  class: u([
2286
- s(a).e("item"),
2287
- s(a).is("disabled", d(m)),
2288
- s(a).is("checked", x.value.includes(C(m)))
2286
+ s(l).e("item"),
2287
+ s(l).is("disabled", v(y)),
2288
+ s(l).is("checked", V.value.includes($(y)))
2289
2289
  ]),
2290
- onClick: (O) => !d(m) && q(C(m))
2290
+ onClick: (U) => !v(y) && j($(y))
2291
2291
  }, [
2292
- f("label", {
2293
- class: u(s(a).e("checkbox"))
2292
+ d("label", {
2293
+ class: u(s(l).e("checkbox"))
2294
2294
  }, [
2295
- f("input", {
2295
+ d("input", {
2296
2296
  type: "checkbox",
2297
- checked: x.value.includes(C(m)),
2298
- disabled: d(m),
2299
- onClick: r[5] || (r[5] = ue(() => {
2297
+ checked: V.value.includes($(y)),
2298
+ disabled: v(y),
2299
+ onClick: i[5] || (i[5] = ue(() => {
2300
2300
  }, ["stop"])),
2301
- onChange: (O) => q(C(m))
2302
- }, null, 40, Et),
2303
- f("span", null, z(I(m)), 1)
2301
+ onChange: (U) => j($(y))
2302
+ }, null, 40, Yt),
2303
+ d("span", null, Y(F(y)), 1)
2304
2304
  ], 2)
2305
- ], 10, At))), 128)),
2306
- M.value.length === 0 ? (i(), c("div", {
2305
+ ], 10, Et))), 128)),
2306
+ T.value.length === 0 ? (r(), c("div", {
2307
2307
  key: 0,
2308
- class: u(s(a).e("empty"))
2308
+ class: u(s(l).e("empty"))
2309
2309
  }, [
2310
2310
  le(o.$slots, "right-empty", {}, () => [
2311
- r[7] || (r[7] = fe("暂无数据", -1))
2311
+ i[7] || (i[7] = fe("暂无数据", -1))
2312
2312
  ])
2313
- ], 2)) : N("", !0)
2313
+ ], 2)) : H("", !0)
2314
2314
  ], 2)
2315
2315
  ], 2)
2316
2316
  ], 2));
2317
2317
  }
2318
- }), Yt = { key: 0 }, zt = { key: 1 }, yl = /* @__PURE__ */ Z({
2318
+ }), zt = { key: 0 }, Ht = { key: 1 }, El = /* @__PURE__ */ Q({
2319
2319
  name: "XSlider",
2320
2320
  __name: "index",
2321
2321
  props: {
@@ -2332,138 +2332,138 @@ const Ct = ["onClick"], Dt = ["placeholder", "disabled", "readonly", "value"], S
2332
2332
  marks: {}
2333
2333
  },
2334
2334
  emits: ["update:modelValue", "change", "input"],
2335
- setup(n, { emit: p }) {
2336
- const e = n, t = p, l = Q("slider"), a = E(), g = E(), v = E(!1), w = E(!1), k = h(() => {
2337
- const R = e.max - e.min;
2338
- return (e.modelValue - e.min) / R * 100;
2339
- }), L = h(() => e.formatTooltip ? e.formatTooltip(e.modelValue) : e.modelValue), D = h(() => {
2340
- if (!e.showStops || e.min >= e.max) return [];
2341
- const R = [], y = (e.max - e.min) / e.step;
2342
- for (let o = 0; o <= y; o++) {
2343
- const r = e.min + o * e.step;
2344
- r > e.min && r < e.max && R.push((r - e.min) / (e.max - e.min) * 100);
2335
+ setup(n, { emit: g }) {
2336
+ const t = n, e = g, a = J("slider"), l = A(), m = A(), p = A(!1), C = A(!1), w = b(() => {
2337
+ const B = t.max - t.min;
2338
+ return (t.modelValue - t.min) / B * 100;
2339
+ }), L = b(() => t.formatTooltip ? t.formatTooltip(t.modelValue) : t.modelValue), S = b(() => {
2340
+ if (!t.showStops || t.min >= t.max) return [];
2341
+ const B = [], x = (t.max - t.min) / t.step;
2342
+ for (let o = 0; o <= x; o++) {
2343
+ const i = t.min + o * t.step;
2344
+ i > t.min && i < t.max && B.push((i - t.min) / (t.max - t.min) * 100);
2345
2345
  }
2346
- return R;
2347
- }), x = h(() => e.marks ? Object.keys(e.marks).map((R) => {
2348
- const y = Number(R), o = e.marks[y], r = (y - e.min) / (e.max - e.min) * 100;
2349
- let m, O = {};
2350
- return typeof o == "string" ? m = o : (m = o.label || String(y), O = o.style || {}), { value: y, pos: r, label: m, style: O };
2351
- }) : []), C = () => a.value ? e.vertical ? a.value.offsetHeight : a.value.offsetWidth : 0, I = (R, y) => {
2352
- if (!a.value) return e.modelValue;
2353
- const o = a.value.getBoundingClientRect(), r = C();
2354
- let m;
2355
- e.vertical ? m = (o.bottom - y) / r * 100 : m = (R - o.left) / r * 100, m = Math.max(0, Math.min(100, m));
2356
- const O = e.min + m / 100 * (e.max - e.min), te = Math.round(O / e.step) * e.step;
2357
- return Math.max(e.min, Math.min(e.max, te));
2358
- }, d = (R) => {
2359
- if (e.disabled) return;
2360
- const y = Math.max(e.min, Math.min(e.max, R));
2361
- y !== e.modelValue && (t("update:modelValue", y), t("input", y));
2362
- }, V = (R) => {
2363
- if (e.disabled) return;
2364
- R.preventDefault(), w.value = !0, v.value = !0;
2365
- const y = I(R.clientX, R.clientY);
2366
- d(y), document.addEventListener("mousemove", M), document.addEventListener("mouseup", S);
2367
- }, M = (R) => {
2368
- if (!w.value) return;
2369
- const y = I(R.clientX, R.clientY);
2370
- d(y);
2371
- }, S = () => {
2372
- w.value = !1, t("change", e.modelValue), document.removeEventListener("mousemove", M), document.removeEventListener("mouseup", S);
2373
- }, P = (R) => {
2374
- if (e.disabled) return;
2375
- R.preventDefault(), w.value = !0, v.value = !0;
2376
- const y = R.touches[0], o = I(y.clientX, y.clientY);
2377
- d(o);
2378
- }, b = (R) => {
2379
- if (!w.value) return;
2380
- const y = R.touches[0], o = I(y.clientX, y.clientY);
2381
- d(o);
2382
- }, T = () => {
2383
- w.value = !1, t("change", e.modelValue);
2384
- }, B = () => {
2385
- e.showTooltip && (v.value = !0);
2386
- }, K = () => {
2387
- w.value || (v.value = !1);
2346
+ return B;
2347
+ }), V = b(() => t.marks ? Object.keys(t.marks).map((B) => {
2348
+ const x = Number(B), o = t.marks[x], i = (x - t.min) / (t.max - t.min) * 100;
2349
+ let y, U = {};
2350
+ return typeof o == "string" ? y = o : (y = o.label || String(x), U = o.style || {}), { value: x, pos: i, label: y, style: U };
2351
+ }) : []), $ = () => l.value ? t.vertical ? l.value.offsetHeight : l.value.offsetWidth : 0, F = (B, x) => {
2352
+ if (!l.value) return t.modelValue;
2353
+ const o = l.value.getBoundingClientRect(), i = $();
2354
+ let y;
2355
+ t.vertical ? y = (o.bottom - x) / i * 100 : y = (B - o.left) / i * 100, y = Math.max(0, Math.min(100, y));
2356
+ const U = t.min + y / 100 * (t.max - t.min), te = Math.round(U / t.step) * t.step;
2357
+ return Math.max(t.min, Math.min(t.max, te));
2358
+ }, v = (B) => {
2359
+ if (t.disabled) return;
2360
+ const x = Math.max(t.min, Math.min(t.max, B));
2361
+ x !== t.modelValue && (e("update:modelValue", x), e("input", x));
2362
+ }, D = (B) => {
2363
+ if (t.disabled) return;
2364
+ B.preventDefault(), C.value = !0, p.value = !0;
2365
+ const x = F(B.clientX, B.clientY);
2366
+ v(x), document.addEventListener("mousemove", T), document.addEventListener("mouseup", M);
2367
+ }, T = (B) => {
2368
+ if (!C.value) return;
2369
+ const x = F(B.clientX, B.clientY);
2370
+ v(x);
2371
+ }, M = () => {
2372
+ C.value = !1, e("change", t.modelValue), document.removeEventListener("mousemove", T), document.removeEventListener("mouseup", M);
2373
+ }, P = (B) => {
2374
+ if (t.disabled) return;
2375
+ B.preventDefault(), C.value = !0, p.value = !0;
2376
+ const x = B.touches[0], o = F(x.clientX, x.clientY);
2377
+ v(o);
2378
+ }, h = (B) => {
2379
+ if (!C.value) return;
2380
+ const x = B.touches[0], o = F(x.clientX, x.clientY);
2381
+ v(o);
2382
+ }, f = () => {
2383
+ C.value = !1, e("change", t.modelValue);
2384
+ }, k = () => {
2385
+ t.showTooltip && (p.value = !0);
2386
+ }, N = () => {
2387
+ C.value || (p.value = !1);
2388
2388
  };
2389
- ke(() => {
2390
- document.removeEventListener("mousemove", M), document.removeEventListener("mouseup", S);
2389
+ xe(() => {
2390
+ document.removeEventListener("mousemove", T), document.removeEventListener("mouseup", M);
2391
2391
  });
2392
- const X = h(() => [
2393
- l.b(),
2394
- l.is("disabled", e.disabled),
2395
- l.is("vertical", e.vertical)
2396
- ]), q = h(() => e.vertical && e.height ? { height: typeof e.height == "number" ? `${e.height}px` : e.height } : {}), J = h(() => e.vertical ? { height: `${k.value}%` } : { width: `${k.value}%` }), $ = h(() => e.vertical ? { bottom: `${k.value}%` } : { left: `${k.value}%` });
2397
- return (R, y) => (i(), c("div", {
2392
+ const X = b(() => [
2393
+ a.b(),
2394
+ a.is("disabled", t.disabled),
2395
+ a.is("vertical", t.vertical)
2396
+ ]), j = b(() => t.vertical && t.height ? { height: typeof t.height == "number" ? `${t.height}px` : t.height } : {}), _ = b(() => t.vertical ? { height: `${w.value}%` } : { width: `${w.value}%` }), R = b(() => t.vertical ? { bottom: `${w.value}%` } : { left: `${w.value}%` });
2397
+ return (B, x) => (r(), c("div", {
2398
2398
  class: u(X.value),
2399
- style: ae(q.value)
2399
+ style: ae(j.value)
2400
2400
  }, [
2401
- f("div", {
2401
+ d("div", {
2402
2402
  ref_key: "sliderRef",
2403
- ref: a,
2404
- class: u(s(l).e("runway")),
2405
- onMousedown: V,
2403
+ ref: l,
2404
+ class: u(s(a).e("runway")),
2405
+ onMousedown: D,
2406
2406
  onTouchstart: P
2407
2407
  }, [
2408
- f("div", {
2409
- class: u(s(l).e("bar")),
2410
- style: ae(J.value)
2408
+ d("div", {
2409
+ class: u(s(a).e("bar")),
2410
+ style: ae(_.value)
2411
2411
  }, null, 6),
2412
- n.showStops ? (i(), c("div", Yt, [
2413
- (i(!0), c(j, null, _(D.value, (o, r) => (i(), c("div", {
2414
- key: r,
2415
- class: u(s(l).e("stop")),
2412
+ n.showStops ? (r(), c("div", zt, [
2413
+ (r(!0), c(G, null, Z(S.value, (o, i) => (r(), c("div", {
2414
+ key: i,
2415
+ class: u(s(a).e("stop")),
2416
2416
  style: ae(n.vertical ? { bottom: `${o}%` } : { left: `${o}%` })
2417
2417
  }, null, 6))), 128))
2418
- ])) : N("", !0),
2419
- x.value.length > 0 ? (i(), c("div", zt, [
2420
- (i(!0), c(j, null, _(x.value, (o) => (i(), c("div", {
2418
+ ])) : H("", !0),
2419
+ V.value.length > 0 ? (r(), c("div", Ht, [
2420
+ (r(!0), c(G, null, Z(V.value, (o) => (r(), c("div", {
2421
2421
  key: o.value,
2422
- class: u(s(l).e("mark")),
2422
+ class: u(s(a).e("mark")),
2423
2423
  style: ae(n.vertical ? { bottom: `${o.pos}%` } : { left: `${o.pos}%`, ...o.style })
2424
2424
  }, [
2425
- f("span", {
2426
- class: u(s(l).e("mark-text"))
2427
- }, z(o.label), 3)
2425
+ d("span", {
2426
+ class: u(s(a).e("mark-text"))
2427
+ }, Y(o.label), 3)
2428
2428
  ], 6))), 128))
2429
- ])) : N("", !0),
2430
- f("div", {
2429
+ ])) : H("", !0),
2430
+ d("div", {
2431
2431
  ref_key: "buttonRef",
2432
- ref: g,
2433
- class: u(s(l).e("button-wrapper")),
2434
- style: ae($.value),
2435
- onMouseenter: B,
2436
- onMouseleave: K,
2437
- onTouchmove: b,
2438
- onTouchend: T
2432
+ ref: m,
2433
+ class: u(s(a).e("button-wrapper")),
2434
+ style: ae(R.value),
2435
+ onMouseenter: k,
2436
+ onMouseleave: N,
2437
+ onTouchmove: h,
2438
+ onTouchend: f
2439
2439
  }, [
2440
- n.showTooltip && v.value ? (i(), c("div", {
2440
+ n.showTooltip && p.value ? (r(), c("div", {
2441
2441
  key: 0,
2442
- class: u(s(l).e("tooltip"))
2443
- }, z(L.value), 3)) : N("", !0),
2444
- f("div", {
2445
- class: u(s(l).e("button"))
2442
+ class: u(s(a).e("tooltip"))
2443
+ }, Y(L.value), 3)) : H("", !0),
2444
+ d("div", {
2445
+ class: u(s(a).e("button"))
2446
2446
  }, null, 2)
2447
2447
  ], 38)
2448
2448
  ], 34)
2449
2449
  ], 6));
2450
2450
  }
2451
- }), Ht = ["src"], Ot = {
2451
+ }), Ot = ["src"], Nt = {
2452
2452
  key: 0,
2453
2453
  class: "status-uploading"
2454
- }, Nt = { class: "progress-circle" }, Kt = { class: "progress-text" }, Xt = {
2454
+ }, Ut = { class: "progress-circle" }, Xt = { class: "progress-text" }, Kt = {
2455
2455
  key: 1,
2456
2456
  class: "status-error"
2457
- }, Ut = {
2457
+ }, Wt = {
2458
2458
  key: 2,
2459
2459
  class: "status-success"
2460
- }, Wt = {
2460
+ }, qt = {
2461
2461
  key: 0,
2462
2462
  class: "action-preview"
2463
- }, Gt = ["onClick"], qt = ["disabled"], jt = { class: "progress-text" }, Zt = ["onClick"], Qt = ["src"], Jt = {
2463
+ }, Gt = ["onClick"], jt = ["disabled"], Zt = { class: "progress-text" }, Qt = ["onClick"], Jt = ["src"], _t = {
2464
2464
  key: 0,
2465
2465
  class: "action-success"
2466
- }, _t = ["onClick"], el = ["multiple", "accept", "disabled"], kl = /* @__PURE__ */ Z({
2466
+ }, el = ["onClick"], tl = ["multiple", "accept", "disabled"], Yl = /* @__PURE__ */ Q({
2467
2467
  name: "XUpload",
2468
2468
  __name: "index",
2469
2469
  props: {
@@ -2492,14 +2492,14 @@ const Ct = ["onClick"], Dt = ["placeholder", "disabled", "readonly", "value"], S
2492
2492
  onExceed: {}
2493
2493
  },
2494
2494
  emits: ["update:fileList", "success", "error", "progress", "change", "remove", "exceed"],
2495
- setup(n, { expose: p, emit: e }) {
2496
- const t = n, l = e, a = Q("upload");
2497
- Ae();
2498
- const g = E(), v = E([...t.fileList]), w = E(!1);
2499
- let k = 1;
2500
- const L = () => Date.now() + k++, D = ($) => {
2495
+ setup(n, { expose: g, emit: t }) {
2496
+ const e = n, a = t, l = J("upload");
2497
+ Ee();
2498
+ const m = A(), p = A([...e.fileList]), C = A(!1);
2499
+ let w = 1;
2500
+ const L = () => Date.now() + w++, S = (R) => {
2501
2501
  var o;
2502
- const R = (o = $.name.split(".").pop()) == null ? void 0 : o.toLowerCase(), y = {
2502
+ const B = (o = R.name.split(".").pop()) == null ? void 0 : o.toLowerCase(), x = {
2503
2503
  pdf: "📄",
2504
2504
  doc: "📝",
2505
2505
  docx: "📝",
@@ -2513,25 +2513,25 @@ const Ct = ["onClick"], Dt = ["placeholder", "disabled", "readonly", "value"], S
2513
2513
  mp4: "🎬",
2514
2514
  default: "📁"
2515
2515
  };
2516
- return y[R || ""] || y.default;
2517
- }, x = h(() => t.limit ? v.value.length < t.limit : !0), C = h(() => [
2518
- a.b(),
2519
- a.is("disabled", t.disabled),
2520
- a.is("drag", t.drag),
2521
- a.m(t.listType)
2522
- ]), I = ($) => {
2523
- const R = $.target.files;
2524
- !R || R.length === 0 || (d(Array.from(R)), g.value && (g.value.value = ""));
2525
- }, d = async ($) => {
2526
- var R, y;
2527
- if (t.limit && v.value.length + $.length > t.limit) {
2528
- l("exceed", $, v.value), (R = t.onExceed) == null || R.call(t, $, v.value);
2516
+ return x[B || ""] || x.default;
2517
+ }, V = b(() => e.limit ? p.value.length < e.limit : !0), $ = b(() => [
2518
+ l.b(),
2519
+ l.is("disabled", e.disabled),
2520
+ l.is("drag", e.drag),
2521
+ l.m(e.listType)
2522
+ ]), F = (R) => {
2523
+ const B = R.target.files;
2524
+ !B || B.length === 0 || (v(Array.from(B)), m.value && (m.value.value = ""));
2525
+ }, v = async (R) => {
2526
+ var B, x;
2527
+ if (e.limit && p.value.length + R.length > e.limit) {
2528
+ a("exceed", R, p.value), (B = e.onExceed) == null || B.call(e, R, p.value);
2529
2529
  return;
2530
2530
  }
2531
- for (const o of $) {
2532
- if (t.beforeUpload && await t.beforeUpload(o, $) === !1)
2531
+ for (const o of R) {
2532
+ if (e.beforeUpload && await e.beforeUpload(o, R) === !1)
2533
2533
  continue;
2534
- const r = {
2534
+ const i = {
2535
2535
  name: o.name,
2536
2536
  size: o.size,
2537
2537
  status: "ready",
@@ -2539,276 +2539,276 @@ const Ct = ["onClick"], Dt = ["placeholder", "disabled", "readonly", "value"], S
2539
2539
  uid: L(),
2540
2540
  raw: o
2541
2541
  };
2542
- o.type.startsWith("image/") && (r.thumbUrl = await V(o), r.url = r.thumbUrl), v.value.push(r), l("update:fileList", v.value), l("change", r, v.value), (y = t.onChange) == null || y.call(t, r, v.value), t.autoUpload && M(r);
2542
+ o.type.startsWith("image/") && (i.thumbUrl = await D(o), i.url = i.thumbUrl), p.value.push(i), a("update:fileList", p.value), a("change", i, p.value), (x = e.onChange) == null || x.call(e, i, p.value), e.autoUpload && T(i);
2543
2543
  }
2544
- }, V = ($) => new Promise((R) => {
2545
- const y = new FileReader();
2546
- y.onload = (o) => {
2547
- var r;
2548
- R((r = o.target) == null ? void 0 : r.result);
2549
- }, y.readAsDataURL($);
2550
- }), M = ($) => {
2551
- if (!$.raw) return;
2552
- $.status = "uploading", (t.httpRequest || S)({
2553
- action: t.action,
2554
- headers: t.headers,
2555
- data: t.data,
2556
- file: $.raw,
2557
- name: t.name,
2558
- withCredentials: t.withCredentials,
2559
- onProgress: (y) => {
2544
+ }, D = (R) => new Promise((B) => {
2545
+ const x = new FileReader();
2546
+ x.onload = (o) => {
2547
+ var i;
2548
+ B((i = o.target) == null ? void 0 : i.result);
2549
+ }, x.readAsDataURL(R);
2550
+ }), T = (R) => {
2551
+ if (!R.raw) return;
2552
+ R.status = "uploading", (e.httpRequest || M)({
2553
+ action: e.action,
2554
+ headers: e.headers,
2555
+ data: e.data,
2556
+ file: R.raw,
2557
+ name: e.name,
2558
+ withCredentials: e.withCredentials,
2559
+ onProgress: (x) => {
2560
2560
  var o;
2561
- $.percentage = y.percent, l("progress", y, $, v.value), (o = t.onProgress) == null || o.call(t, y, $, v.value);
2561
+ R.percentage = x.percent, a("progress", x, R, p.value), (o = e.onProgress) == null || o.call(e, x, R, p.value);
2562
2562
  },
2563
- onSuccess: (y) => {
2563
+ onSuccess: (x) => {
2564
2564
  var o;
2565
- $.status = "success", $.response = y, l("success", y, $, v.value), (o = t.onSuccess) == null || o.call(t, y, $, v.value);
2565
+ R.status = "success", R.response = x, a("success", x, R, p.value), (o = e.onSuccess) == null || o.call(e, x, R, p.value);
2566
2566
  },
2567
- onError: (y) => {
2567
+ onError: (x) => {
2568
2568
  var o;
2569
- $.status = "error", l("error", y, $, v.value), (o = t.onError) == null || o.call(t, y, $, v.value);
2569
+ R.status = "error", a("error", x, R, p.value), (o = e.onError) == null || o.call(e, x, R, p.value);
2570
2570
  }
2571
2571
  });
2572
- }, S = ($) => new Promise((R, y) => {
2572
+ }, M = (R) => new Promise((B, x) => {
2573
2573
  const o = new XMLHttpRequest();
2574
- o.upload.addEventListener("progress", (m) => {
2575
- m.lengthComputable && $.onProgress({ percent: m.loaded / m.total * 100 });
2574
+ o.upload.addEventListener("progress", (y) => {
2575
+ y.lengthComputable && R.onProgress({ percent: y.loaded / y.total * 100 });
2576
2576
  }), o.addEventListener("load", () => {
2577
2577
  if (o.status < 200 || o.status >= 300) {
2578
- $.onError(new Error("Upload failed")), y(new Error("Upload failed"));
2578
+ R.onError(new Error("Upload failed")), x(new Error("Upload failed"));
2579
2579
  return;
2580
2580
  }
2581
2581
  try {
2582
- const m = JSON.parse(o.responseText);
2583
- $.onSuccess(m), R(m);
2582
+ const y = JSON.parse(o.responseText);
2583
+ R.onSuccess(y), B(y);
2584
2584
  } catch {
2585
- $.onSuccess(o.responseText), R(o.responseText);
2585
+ R.onSuccess(o.responseText), B(o.responseText);
2586
2586
  }
2587
2587
  }), o.addEventListener("error", () => {
2588
- $.onError(new Error("Upload error")), y(new Error("Upload error"));
2588
+ R.onError(new Error("Upload error")), x(new Error("Upload error"));
2589
2589
  });
2590
- const r = new FormData();
2591
- r.append($.name, $.file), $.data && Object.keys($.data).forEach((m) => {
2592
- r.append(m, $.data[m]);
2593
- }), o.open("POST", $.action, !0), $.withCredentials && (o.withCredentials = !0), $.headers && Object.keys($.headers).forEach((m) => {
2594
- o.setRequestHeader(m, $.headers[m]);
2595
- }), o.send(r);
2596
- }), P = async ($) => {
2597
- var y;
2598
- if (t.beforeRemove && await t.beforeRemove($, v.value) === !1)
2590
+ const i = new FormData();
2591
+ i.append(R.name, R.file), R.data && Object.keys(R.data).forEach((y) => {
2592
+ i.append(y, R.data[y]);
2593
+ }), o.open("POST", R.action, !0), R.withCredentials && (o.withCredentials = !0), R.headers && Object.keys(R.headers).forEach((y) => {
2594
+ o.setRequestHeader(y, R.headers[y]);
2595
+ }), o.send(i);
2596
+ }), P = async (R) => {
2597
+ var x;
2598
+ if (e.beforeRemove && await e.beforeRemove(R, p.value) === !1)
2599
2599
  return;
2600
- const R = v.value.findIndex((o) => o.uid === $.uid);
2601
- R > -1 && (v.value.splice(R, 1), l("update:fileList", v.value), l("remove", $, v.value), (y = t.onRemove) == null || y.call(t, $, v.value));
2602
- }, b = () => {
2603
- v.value.filter(($) => $.status === "ready" && $.raw).forEach(($) => M($));
2604
- }, T = () => {
2605
- v.value = [], l("update:fileList", v.value);
2606
- }, B = () => {
2607
- var $;
2608
- t.disabled || ($ = g.value) == null || $.click();
2609
- }, K = ($) => {
2610
- $.preventDefault(), !t.disabled && t.drag && (w.value = !0);
2600
+ const B = p.value.findIndex((o) => o.uid === R.uid);
2601
+ B > -1 && (p.value.splice(B, 1), a("update:fileList", p.value), a("remove", R, p.value), (x = e.onRemove) == null || x.call(e, R, p.value));
2602
+ }, h = () => {
2603
+ p.value.filter((R) => R.status === "ready" && R.raw).forEach((R) => T(R));
2604
+ }, f = () => {
2605
+ p.value = [], a("update:fileList", p.value);
2606
+ }, k = () => {
2607
+ var R;
2608
+ e.disabled || (R = m.value) == null || R.click();
2609
+ }, N = (R) => {
2610
+ R.preventDefault(), !e.disabled && e.drag && (C.value = !0);
2611
2611
  }, X = () => {
2612
- w.value = !1;
2613
- }, q = ($) => {
2614
- var y;
2615
- if ($.preventDefault(), w.value = !1, t.disabled) return;
2616
- const R = (y = $.dataTransfer) == null ? void 0 : y.files;
2617
- R && R.length > 0 && d(Array.from(R));
2618
- }, J = ($) => {
2619
- if (!$) return "0 B";
2620
- const R = ["B", "KB", "MB", "GB"];
2621
- let y = 0, o = $;
2622
- for (; o >= 1024 && y < R.length - 1; )
2623
- o /= 1024, y++;
2624
- return `${o.toFixed(2)} ${R[y]}`;
2612
+ C.value = !1;
2613
+ }, j = (R) => {
2614
+ var x;
2615
+ if (R.preventDefault(), C.value = !1, e.disabled) return;
2616
+ const B = (x = R.dataTransfer) == null ? void 0 : x.files;
2617
+ B && B.length > 0 && v(Array.from(B));
2618
+ }, _ = (R) => {
2619
+ if (!R) return "0 B";
2620
+ const B = ["B", "KB", "MB", "GB"];
2621
+ let x = 0, o = R;
2622
+ for (; o >= 1024 && x < B.length - 1; )
2623
+ o /= 1024, x++;
2624
+ return `${o.toFixed(2)} ${B[x]}`;
2625
2625
  };
2626
- return p({
2627
- submit: b,
2628
- clearFiles: T,
2629
- uploadFiles: v
2630
- }), ($, R) => (i(), c("div", {
2631
- class: u(C.value)
2626
+ return g({
2627
+ submit: h,
2628
+ clearFiles: f,
2629
+ uploadFiles: p
2630
+ }), (R, B) => (r(), c("div", {
2631
+ class: u($.value)
2632
2632
  }, [
2633
- n.drag ? (i(), c("div", {
2633
+ n.drag ? (r(), c("div", {
2634
2634
  key: 0,
2635
- class: u([s(a).e("drag"), s(a).is("dragover", w.value)]),
2636
- onClick: B,
2637
- onDragover: K,
2635
+ class: u([s(l).e("drag"), s(l).is("dragover", C.value)]),
2636
+ onClick: k,
2637
+ onDragover: N,
2638
2638
  onDragleave: X,
2639
- onDrop: q
2639
+ onDrop: j
2640
2640
  }, [
2641
- le($.$slots, "drag", {}, () => [
2642
- f("span", {
2643
- class: u(s(a).e("drag-icon"))
2641
+ le(R.$slots, "drag", {}, () => [
2642
+ d("span", {
2643
+ class: u(s(l).e("drag-icon"))
2644
2644
  }, "📁", 2),
2645
- f("div", {
2646
- class: u(s(a).e("drag-text"))
2647
- }, [...R[0] || (R[0] = [
2645
+ d("div", {
2646
+ class: u(s(l).e("drag-text"))
2647
+ }, [...B[0] || (B[0] = [
2648
2648
  fe(" 将文件拖到此处,或", -1),
2649
- f("em", null, "点击上传", -1)
2649
+ d("em", null, "点击上传", -1)
2650
2650
  ])], 2)
2651
2651
  ])
2652
- ], 34)) : n.listType === "picture-card" ? (i(), c("ul", {
2652
+ ], 34)) : n.listType === "picture-card" ? (r(), c("ul", {
2653
2653
  key: 1,
2654
- class: u([s(a).e("files"), s(a).e("upload-list")])
2654
+ class: u([s(l).e("files"), s(l).e("upload-list")])
2655
2655
  }, [
2656
- (i(!0), c(j, null, _(v.value, (y) => (i(), c("li", {
2657
- key: y.uid,
2658
- class: u([s(a).e("file"), s(a).is(`status-${y.status}`)])
2656
+ (r(!0), c(G, null, Z(p.value, (x) => (r(), c("li", {
2657
+ key: x.uid,
2658
+ class: u([s(l).e("file"), s(l).is(`status-${x.status}`)])
2659
2659
  }, [
2660
- y.thumbUrl && y.status !== "uploading" ? (i(), c("img", {
2660
+ x.thumbUrl && x.status !== "uploading" ? (r(), c("img", {
2661
2661
  key: 0,
2662
- src: y.thumbUrl,
2663
- class: u(s(a).e("file-image"))
2664
- }, null, 10, Ht)) : (i(), c("div", {
2662
+ src: x.thumbUrl,
2663
+ class: u(s(l).e("file-image"))
2664
+ }, null, 10, Ot)) : (r(), c("div", {
2665
2665
  key: 1,
2666
- class: u(s(a).e("file-status"))
2666
+ class: u(s(l).e("file-status"))
2667
2667
  }, [
2668
- y.status === "uploading" ? (i(), c("span", Ot, [
2669
- f("span", Nt, [
2670
- f("span", Kt, z(Math.round(y.percentage || 0)) + "%", 1)
2668
+ x.status === "uploading" ? (r(), c("span", Nt, [
2669
+ d("span", Ut, [
2670
+ d("span", Xt, Y(Math.round(x.percentage || 0)) + "%", 1)
2671
2671
  ])
2672
- ])) : y.status === "error" ? (i(), c("span", Xt, "✕")) : y.status === "success" ? (i(), c("span", Ut, "✓")) : N("", !0)
2672
+ ])) : x.status === "error" ? (r(), c("span", Kt, "✕")) : x.status === "success" ? (r(), c("span", Wt, "✓")) : H("", !0)
2673
2673
  ], 2)),
2674
- f("span", {
2675
- class: u(s(a).e("file-actions"))
2674
+ d("span", {
2675
+ class: u(s(l).e("file-actions"))
2676
2676
  }, [
2677
- y.url ? (i(), c("span", Wt, "👁️")) : N("", !0),
2678
- f("span", {
2677
+ x.url ? (r(), c("span", qt, "👁️")) : H("", !0),
2678
+ d("span", {
2679
2679
  class: "action-remove",
2680
- onClick: (o) => P(y)
2680
+ onClick: (o) => P(x)
2681
2681
  }, "🗑️", 8, Gt)
2682
2682
  ], 2)
2683
2683
  ], 2))), 128)),
2684
- x.value ? (i(), c("li", {
2684
+ V.value ? (r(), c("li", {
2685
2685
  key: 0,
2686
- class: u(s(a).e("upload-card")),
2687
- onClick: B
2686
+ class: u(s(l).e("upload-card")),
2687
+ onClick: k
2688
2688
  }, [
2689
- le($.$slots, "trigger", {}, () => [
2690
- R[1] || (R[1] = f("span", { class: "upload-icon" }, "+", -1))
2689
+ le(R.$slots, "trigger", {}, () => [
2690
+ B[1] || (B[1] = d("span", { class: "upload-icon" }, "+", -1))
2691
2691
  ])
2692
- ], 2)) : N("", !0)
2693
- ], 2)) : (i(), c(j, { key: 2 }, [
2694
- f("div", {
2695
- class: u(s(a).e("trigger-wrapper")),
2696
- onClick: B
2692
+ ], 2)) : H("", !0)
2693
+ ], 2)) : (r(), c(G, { key: 2 }, [
2694
+ d("div", {
2695
+ class: u(s(l).e("trigger-wrapper")),
2696
+ onClick: k
2697
2697
  }, [
2698
- le($.$slots, "trigger", {}, () => [
2699
- x.value ? (i(), c("button", {
2698
+ le(R.$slots, "trigger", {}, () => [
2699
+ V.value ? (r(), c("button", {
2700
2700
  key: 0,
2701
2701
  type: "button",
2702
- class: u(s(a).e("trigger")),
2702
+ class: u(s(l).e("trigger")),
2703
2703
  disabled: n.disabled
2704
2704
  }, [
2705
- le($.$slots, "default", {}, () => [
2706
- R[2] || (R[2] = fe("点击上传", -1))
2705
+ le(R.$slots, "default", {}, () => [
2706
+ B[2] || (B[2] = fe("点击上传", -1))
2707
2707
  ])
2708
- ], 10, qt)) : N("", !0)
2708
+ ], 10, jt)) : H("", !0)
2709
2709
  ])
2710
2710
  ], 2),
2711
- n.showFileList && v.value.length > 0 ? (i(), c("ul", {
2711
+ n.showFileList && p.value.length > 0 ? (r(), c("ul", {
2712
2712
  key: 0,
2713
- class: u(s(a).e("files"))
2713
+ class: u(s(l).e("files"))
2714
2714
  }, [
2715
- (i(!0), c(j, null, _(v.value, (y) => (i(), c("li", {
2716
- key: y.uid,
2717
- class: u([s(a).e("file"), s(a).is(`status-${y.status}`)])
2715
+ (r(!0), c(G, null, Z(p.value, (x) => (r(), c("li", {
2716
+ key: x.uid,
2717
+ class: u([s(l).e("file"), s(l).is(`status-${x.status}`)])
2718
2718
  }, [
2719
- n.listType === "text" ? (i(), c(j, { key: 0 }, [
2720
- f("span", {
2721
- class: u(s(a).e("file-icon"))
2722
- }, z(D(y)), 3),
2723
- f("span", {
2724
- class: u(s(a).e("file-name"))
2725
- }, z(y.name), 3),
2726
- f("span", {
2727
- class: u(s(a).e("file-size"))
2728
- }, z(J(y.size)), 3),
2729
- y.status === "uploading" ? (i(), c("span", {
2719
+ n.listType === "text" ? (r(), c(G, { key: 0 }, [
2720
+ d("span", {
2721
+ class: u(s(l).e("file-icon"))
2722
+ }, Y(S(x)), 3),
2723
+ d("span", {
2724
+ class: u(s(l).e("file-name"))
2725
+ }, Y(x.name), 3),
2726
+ d("span", {
2727
+ class: u(s(l).e("file-size"))
2728
+ }, Y(_(x.size)), 3),
2729
+ x.status === "uploading" ? (r(), c("span", {
2730
2730
  key: 0,
2731
- class: u(s(a).e("file-progress"))
2731
+ class: u(s(l).e("file-progress"))
2732
2732
  }, [
2733
- f("span", {
2733
+ d("span", {
2734
2734
  class: "progress-bar",
2735
- style: ae({ width: y.percentage + "%" })
2735
+ style: ae({ width: x.percentage + "%" })
2736
2736
  }, null, 4),
2737
- f("span", jt, z(Math.round(y.percentage || 0)) + "%", 1)
2738
- ], 2)) : N("", !0),
2739
- y.status === "success" ? (i(), c("span", {
2737
+ d("span", Zt, Y(Math.round(x.percentage || 0)) + "%", 1)
2738
+ ], 2)) : H("", !0),
2739
+ x.status === "success" ? (r(), c("span", {
2740
2740
  key: 1,
2741
- class: u(s(a).e("file-success"))
2742
- }, "✓", 2)) : N("", !0),
2743
- y.status === "error" ? (i(), c("span", {
2741
+ class: u(s(l).e("file-success"))
2742
+ }, "✓", 2)) : H("", !0),
2743
+ x.status === "error" ? (r(), c("span", {
2744
2744
  key: 2,
2745
- class: u(s(a).e("file-error"))
2746
- }, "✕", 2)) : N("", !0),
2747
- f("span", {
2748
- class: u(s(a).e("file-actions"))
2745
+ class: u(s(l).e("file-error"))
2746
+ }, "✕", 2)) : H("", !0),
2747
+ d("span", {
2748
+ class: u(s(l).e("file-actions"))
2749
2749
  }, [
2750
- f("span", {
2750
+ d("span", {
2751
2751
  class: "action-remove",
2752
- onClick: (o) => P(y)
2753
- }, "✕", 8, Zt)
2752
+ onClick: (o) => P(x)
2753
+ }, "✕", 8, Qt)
2754
2754
  ], 2)
2755
- ], 64)) : n.listType === "picture" ? (i(), c(j, { key: 1 }, [
2756
- y.thumbUrl ? (i(), c("img", {
2755
+ ], 64)) : n.listType === "picture" ? (r(), c(G, { key: 1 }, [
2756
+ x.thumbUrl ? (r(), c("img", {
2757
2757
  key: 0,
2758
- src: y.thumbUrl,
2759
- class: u(s(a).e("file-thumb"))
2760
- }, null, 10, Qt)) : (i(), c("span", {
2758
+ src: x.thumbUrl,
2759
+ class: u(s(l).e("file-thumb"))
2760
+ }, null, 10, Jt)) : (r(), c("span", {
2761
2761
  key: 1,
2762
- class: u(s(a).e("file-icon"))
2763
- }, z(D(y)), 3)),
2764
- f("div", {
2765
- class: u(s(a).e("file-info"))
2762
+ class: u(s(l).e("file-icon"))
2763
+ }, Y(S(x)), 3)),
2764
+ d("div", {
2765
+ class: u(s(l).e("file-info"))
2766
2766
  }, [
2767
- f("span", {
2768
- class: u(s(a).e("file-name"))
2769
- }, z(y.name), 3),
2770
- y.status === "uploading" ? (i(), c("span", {
2767
+ d("span", {
2768
+ class: u(s(l).e("file-name"))
2769
+ }, Y(x.name), 3),
2770
+ x.status === "uploading" ? (r(), c("span", {
2771
2771
  key: 0,
2772
- class: u(s(a).e("file-progress"))
2772
+ class: u(s(l).e("file-progress"))
2773
2773
  }, [
2774
- f("span", {
2774
+ d("span", {
2775
2775
  class: "progress-bar",
2776
- style: ae({ width: y.percentage + "%" })
2776
+ style: ae({ width: x.percentage + "%" })
2777
2777
  }, null, 4)
2778
- ], 2)) : N("", !0)
2778
+ ], 2)) : H("", !0)
2779
2779
  ], 2),
2780
- f("span", {
2781
- class: u(s(a).e("file-actions"))
2780
+ d("span", {
2781
+ class: u(s(l).e("file-actions"))
2782
2782
  }, [
2783
- y.status === "success" ? (i(), c("span", Jt, "✓")) : N("", !0),
2784
- f("span", {
2783
+ x.status === "success" ? (r(), c("span", _t, "✓")) : H("", !0),
2784
+ d("span", {
2785
2785
  class: "action-remove",
2786
- onClick: (o) => P(y)
2787
- }, "✕", 8, _t)
2786
+ onClick: (o) => P(x)
2787
+ }, "✕", 8, el)
2788
2788
  ], 2)
2789
- ], 64)) : N("", !0)
2789
+ ], 64)) : H("", !0)
2790
2790
  ], 2))), 128))
2791
- ], 2)) : N("", !0)
2791
+ ], 2)) : H("", !0)
2792
2792
  ], 64)),
2793
- f("input", {
2793
+ d("input", {
2794
2794
  ref_key: "inputRef",
2795
- ref: g,
2795
+ ref: m,
2796
2796
  type: "file",
2797
- class: u(s(a).e("input")),
2797
+ class: u(s(l).e("input")),
2798
2798
  multiple: n.multiple,
2799
2799
  accept: n.accept,
2800
2800
  disabled: n.disabled,
2801
- onChange: I
2802
- }, null, 42, el),
2803
- $.$slots.tip ? (i(), c("div", {
2801
+ onChange: F
2802
+ }, null, 42, tl),
2803
+ R.$slots.tip ? (r(), c("div", {
2804
2804
  key: 3,
2805
- class: u(s(a).e("tip"))
2805
+ class: u(s(l).e("tip"))
2806
2806
  }, [
2807
- le($.$slots, "tip")
2808
- ], 2)) : N("", !0)
2807
+ le(R.$slots, "tip")
2808
+ ], 2)) : H("", !0)
2809
2809
  ], 2));
2810
2810
  }
2811
- }), tl = ["onMousemove", "onClick"], xl = /* @__PURE__ */ Z({
2811
+ }), ll = ["onMousemove", "onClick"], zl = /* @__PURE__ */ Q({
2812
2812
  name: "XRate",
2813
2813
  __name: "index",
2814
2814
  props: {
@@ -2833,93 +2833,318 @@ const Ct = ["onClick"], Dt = ["placeholder", "disabled", "readonly", "value"], S
2833
2833
  size: { default: "default" }
2834
2834
  },
2835
2835
  emits: ["update:modelValue", "change"],
2836
- setup(n, { emit: p }) {
2837
- const e = n, t = p, l = Q("rate"), a = E(-1), g = h(() => a.value > -1 ? a.value : e.modelValue), v = h(() => [
2838
- l.b(),
2839
- l.m(e.size),
2840
- l.is("disabled", e.disabled),
2841
- l.is("readonly", e.readonly)
2842
- ]), w = (d) => e.disabled ? e.disabledVoidColor : d <= e.lowThreshold ? e.colors[0] : d <= e.highThreshold ? e.colors[1] || e.colors[0] : e.colors[2] || e.colors[1] || e.colors[0], k = (d) => {
2843
- const V = g.value;
2844
- return V >= d ? 100 : e.allowHalf && V >= d - 0.5 ? 50 : 0;
2845
- }, L = (d) => k(d) > 0 ? w(g.value) : e.disabled ? e.disabledVoidColor : e.voidColor, D = h(() => {
2846
- if (e.showScore)
2847
- return e.scoreTemplate.replace("{value}", String(e.modelValue));
2848
- if (e.showText) {
2849
- const d = Math.min(Math.ceil(e.modelValue || 0), e.max) - 1;
2850
- return e.texts[Math.max(0, d)] || "";
2836
+ setup(n, { emit: g }) {
2837
+ const t = n, e = g, a = J("rate"), l = A(-1), m = b(() => l.value > -1 ? l.value : t.modelValue), p = b(() => [
2838
+ a.b(),
2839
+ a.m(t.size),
2840
+ a.is("disabled", t.disabled),
2841
+ a.is("readonly", t.readonly)
2842
+ ]), C = (v) => t.disabled ? t.disabledVoidColor : v <= t.lowThreshold ? t.colors[0] : v <= t.highThreshold ? t.colors[1] || t.colors[0] : t.colors[2] || t.colors[1] || t.colors[0], w = (v) => {
2843
+ const D = m.value;
2844
+ return D >= v ? 100 : t.allowHalf && D >= v - 0.5 ? 50 : 0;
2845
+ }, L = (v) => w(v) > 0 ? C(m.value) : t.disabled ? t.disabledVoidColor : t.voidColor, S = b(() => {
2846
+ if (t.showScore)
2847
+ return t.scoreTemplate.replace("{value}", String(t.modelValue));
2848
+ if (t.showText) {
2849
+ const v = Math.min(Math.ceil(t.modelValue || 0), t.max) - 1;
2850
+ return t.texts[Math.max(0, v)] || "";
2851
2851
  }
2852
2852
  return "";
2853
- }), x = (d, V) => {
2854
- if (!(e.disabled || e.readonly))
2855
- if (e.allowHalf) {
2856
- const S = V.currentTarget.getBoundingClientRect(), P = V.clientX - S.left < S.width / 2;
2857
- a.value = P ? d - 0.5 : d;
2853
+ }), V = (v, D) => {
2854
+ if (!(t.disabled || t.readonly))
2855
+ if (t.allowHalf) {
2856
+ const M = D.currentTarget.getBoundingClientRect(), P = D.clientX - M.left < M.width / 2;
2857
+ l.value = P ? v - 0.5 : v;
2858
2858
  } else
2859
- a.value = d;
2860
- }, C = () => {
2861
- e.disabled || e.readonly || (a.value = -1);
2862
- }, I = (d, V) => {
2863
- if (e.disabled || e.readonly) return;
2864
- let M;
2865
- if (e.allowHalf) {
2866
- const P = V.currentTarget.getBoundingClientRect();
2867
- M = V.clientX - P.left < P.width / 2 ? d - 0.5 : d;
2859
+ l.value = v;
2860
+ }, $ = () => {
2861
+ t.disabled || t.readonly || (l.value = -1);
2862
+ }, F = (v, D) => {
2863
+ if (t.disabled || t.readonly) return;
2864
+ let T;
2865
+ if (t.allowHalf) {
2866
+ const P = D.currentTarget.getBoundingClientRect();
2867
+ T = D.clientX - P.left < P.width / 2 ? v - 0.5 : v;
2868
2868
  } else
2869
- M = d;
2870
- t("update:modelValue", M), t("change", M);
2869
+ T = v;
2870
+ e("update:modelValue", T), e("change", T);
2871
2871
  };
2872
- return (d, V) => (i(), c("div", {
2873
- class: u(v.value),
2874
- onMouseleave: C
2872
+ return (v, D) => (r(), c("div", {
2873
+ class: u(p.value),
2874
+ onMouseleave: $
2875
2875
  }, [
2876
- f("div", {
2877
- class: u(s(l).e("items"))
2876
+ d("div", {
2877
+ class: u(s(a).e("items"))
2878
2878
  }, [
2879
- (i(!0), c(j, null, _(n.max, (M) => (i(), c("span", {
2880
- key: M,
2881
- class: u(s(l).e("item")),
2882
- onMousemove: (S) => x(M, S),
2883
- onClick: (S) => I(M, S)
2879
+ (r(!0), c(G, null, Z(n.max, (T) => (r(), c("span", {
2880
+ key: T,
2881
+ class: u(s(a).e("item")),
2882
+ onMousemove: (M) => V(T, M),
2883
+ onClick: (M) => F(T, M)
2884
2884
  }, [
2885
- f("span", {
2886
- class: u(s(l).e("void")),
2885
+ d("span", {
2886
+ class: u(s(a).e("void")),
2887
2887
  style: ae({ color: n.disabled ? n.disabledVoidColor : n.voidColor })
2888
- }, z(n.disabled ? n.disabledVoidIcon : n.voidIcon), 7),
2889
- f("span", {
2890
- class: u([s(l).e("fill"), k(M) > 0 ? "is-active" : ""]),
2888
+ }, Y(n.disabled ? n.disabledVoidIcon : n.voidIcon), 7),
2889
+ d("span", {
2890
+ class: u([s(a).e("fill"), w(T) > 0 ? "is-active" : ""]),
2891
2891
  style: ae({
2892
- color: L(M),
2893
- clipPath: `inset(0 ${100 - k(M)}% 0 0)`
2892
+ color: L(T),
2893
+ clipPath: `inset(0 ${100 - w(T)}% 0 0)`
2894
2894
  })
2895
- }, z(n.icon), 7)
2896
- ], 42, tl))), 128))
2895
+ }, Y(n.icon), 7)
2896
+ ], 42, ll))), 128))
2897
2897
  ], 2),
2898
- n.showText || n.showScore ? (i(), c("div", {
2898
+ n.showText || n.showScore ? (r(), c("div", {
2899
2899
  key: 0,
2900
- class: u(s(l).e("text")),
2900
+ class: u(s(a).e("text")),
2901
2901
  style: ae({ color: n.textColor })
2902
- }, z(D.value), 7)) : N("", !0)
2902
+ }, Y(S.value), 7)) : H("", !0)
2903
2903
  ], 34));
2904
2904
  }
2905
+ }), al = ["value"], nl = { class: "field-type" }, sl = { class: "field-name" }, ul = { class: "field-label" }, ol = {
2906
+ key: 0,
2907
+ class: "field-required"
2908
+ }, rl = ["onClick"], il = ["onClick"], dl = ["onClick"], cl = ["onClick"], vl = { class: "modal-content" }, fl = { class: "modal-body" }, ml = { class: "edit-field" }, pl = { class: "edit-field" }, hl = { class: "edit-field" }, gl = ["value"], bl = { class: "edit-field" }, yl = { class: "edit-field" }, Hl = /* @__PURE__ */ Q({
2909
+ name: "XDynamicFields",
2910
+ __name: "index",
2911
+ props: {
2912
+ fields: { default: () => [] },
2913
+ editable: { type: Boolean, default: !0 },
2914
+ showSort: { type: Boolean, default: !0 },
2915
+ maxFields: { default: 20 },
2916
+ availableTypes: { default: () => [
2917
+ { label: "单行文本", value: "input" },
2918
+ { label: "文本域", value: "textarea" },
2919
+ { label: "数字", value: "number" },
2920
+ { label: "下拉选择", value: "select" },
2921
+ { label: "开关", value: "switch" },
2922
+ { label: "日期", value: "date" },
2923
+ { label: "文件", value: "file" }
2924
+ ] }
2925
+ },
2926
+ emits: ["update:fields", "add", "remove", "sort", "update"],
2927
+ setup(n, { emit: g }) {
2928
+ const t = n, e = g, a = J("dynamic-fields"), l = A([]), m = A(null), p = A("input"), C = b(() => [
2929
+ a.b(),
2930
+ a.is("editable", t.editable)
2931
+ ]), w = b(() => l.value.length < t.maxFields);
2932
+ ie(() => t.fields, (h) => {
2933
+ l.value = [...h].sort((f, k) => (f.order || 0) - (k.order || 0));
2934
+ }, { immediate: !0, deep: !0 });
2935
+ const L = () => `field_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`, S = () => {
2936
+ if (!w.value) return;
2937
+ const h = {
2938
+ id: L(),
2939
+ name: `field_${l.value.length + 1}`,
2940
+ label: "新字段",
2941
+ type: p.value,
2942
+ required: !1,
2943
+ order: l.value.length
2944
+ };
2945
+ l.value.push(h), e("add", h), e("update:fields", l.value);
2946
+ }, V = (h) => {
2947
+ const f = l.value.findIndex((k) => k.id === h);
2948
+ f !== -1 && (l.value[f], l.value.splice(f, 1), e("remove", h), e("update:fields", l.value));
2949
+ }, $ = (h) => {
2950
+ const f = l.value.findIndex((k) => k.id === h);
2951
+ if (f > 0) {
2952
+ const k = l.value[f];
2953
+ l.value[f] = l.value[f - 1], l.value[f - 1] = k, v(), e("sort", l.value), e("update:fields", l.value);
2954
+ }
2955
+ }, F = (h) => {
2956
+ const f = l.value.findIndex((k) => k.id === h);
2957
+ if (f < l.value.length - 1) {
2958
+ const k = l.value[f];
2959
+ l.value[f] = l.value[f + 1], l.value[f + 1] = k, v(), e("sort", l.value), e("update:fields", l.value);
2960
+ }
2961
+ }, v = () => {
2962
+ l.value.forEach((h, f) => {
2963
+ h.order = f;
2964
+ });
2965
+ }, D = (h) => {
2966
+ m.value = { ...h };
2967
+ }, T = () => {
2968
+ if (m.value) {
2969
+ const h = l.value.findIndex((f) => f.id === m.value.id);
2970
+ h !== -1 && (l.value[h] = m.value, e("update", m.value.id, m.value), e("update:fields", l.value)), m.value = null;
2971
+ }
2972
+ }, M = () => {
2973
+ m.value = null;
2974
+ }, P = (h) => {
2975
+ const f = t.availableTypes.find((k) => k.value === h);
2976
+ return (f == null ? void 0 : f.label) || h;
2977
+ };
2978
+ return (h, f) => (r(), c("div", {
2979
+ class: u(C.value)
2980
+ }, [
2981
+ n.editable && w.value ? (r(), c("div", {
2982
+ key: 0,
2983
+ class: u(s(a).e("add"))
2984
+ }, [
2985
+ oe(d("select", {
2986
+ "onUpdate:modelValue": f[0] || (f[0] = (k) => p.value = k),
2987
+ class: u(s(a).e("type-select"))
2988
+ }, [
2989
+ (r(!0), c(G, null, Z(n.availableTypes, (k) => (r(), c("option", {
2990
+ key: k.value,
2991
+ value: k.value
2992
+ }, Y(k.label), 9, al))), 128))
2993
+ ], 2), [
2994
+ [Pe, p.value]
2995
+ ]),
2996
+ d("button", {
2997
+ class: u(s(a).e("add-btn")),
2998
+ onClick: S
2999
+ }, " + 添加字段 ", 2)
3000
+ ], 2)) : H("", !0),
3001
+ d("div", {
3002
+ class: u(s(a).e("list"))
3003
+ }, [
3004
+ (r(!0), c(G, null, Z(l.value, (k) => (r(), c("div", {
3005
+ key: k.id,
3006
+ class: u(s(a).e("item"))
3007
+ }, [
3008
+ d("div", {
3009
+ class: u(s(a).e("info"))
3010
+ }, [
3011
+ d("span", nl, Y(P(k.type)), 1),
3012
+ d("span", sl, Y(k.name), 1),
3013
+ d("span", ul, Y(k.label), 1),
3014
+ k.required ? (r(), c("span", ol, "必填")) : H("", !0)
3015
+ ], 2),
3016
+ n.editable ? (r(), c("div", {
3017
+ key: 0,
3018
+ class: u(s(a).e("actions"))
3019
+ }, [
3020
+ n.showSort ? (r(), c("button", {
3021
+ key: 0,
3022
+ class: "action-btn",
3023
+ title: "上移",
3024
+ onClick: (N) => $(k.id)
3025
+ }, " ↑ ", 8, rl)) : H("", !0),
3026
+ n.showSort ? (r(), c("button", {
3027
+ key: 1,
3028
+ class: "action-btn",
3029
+ title: "下移",
3030
+ onClick: (N) => F(k.id)
3031
+ }, " ↓ ", 8, il)) : H("", !0),
3032
+ d("button", {
3033
+ class: "action-btn",
3034
+ title: "编辑",
3035
+ onClick: (N) => D(k)
3036
+ }, " ✏️ ", 8, dl),
3037
+ d("button", {
3038
+ class: "action-btn action-btn--danger",
3039
+ title: "删除",
3040
+ onClick: (N) => V(k.id)
3041
+ }, " ✕ ", 8, cl)
3042
+ ], 2)) : H("", !0)
3043
+ ], 2))), 128))
3044
+ ], 2),
3045
+ l.value.length === 0 ? (r(), c("div", {
3046
+ key: 1,
3047
+ class: u(s(a).e("empty"))
3048
+ }, [...f[6] || (f[6] = [
3049
+ d("span", null, "暂无字段配置", -1)
3050
+ ])], 2)) : H("", !0),
3051
+ m.value ? (r(), c("div", {
3052
+ key: 2,
3053
+ class: u(s(a).e("edit-modal"))
3054
+ }, [
3055
+ d("div", vl, [
3056
+ d("div", { class: "modal-header" }, [
3057
+ f[7] || (f[7] = d("span", null, "编辑字段", -1)),
3058
+ d("button", {
3059
+ class: "close-btn",
3060
+ onClick: M
3061
+ }, "✕")
3062
+ ]),
3063
+ d("div", fl, [
3064
+ d("div", ml, [
3065
+ f[8] || (f[8] = d("label", null, "字段名称", -1)),
3066
+ oe(d("input", {
3067
+ "onUpdate:modelValue": f[1] || (f[1] = (k) => m.value.name = k),
3068
+ type: "text",
3069
+ placeholder: "变量名称"
3070
+ }, null, 512), [
3071
+ [ge, m.value.name]
3072
+ ])
3073
+ ]),
3074
+ d("div", pl, [
3075
+ f[9] || (f[9] = d("label", null, "字段标签", -1)),
3076
+ oe(d("input", {
3077
+ "onUpdate:modelValue": f[2] || (f[2] = (k) => m.value.label = k),
3078
+ type: "text",
3079
+ placeholder: "显示标签"
3080
+ }, null, 512), [
3081
+ [ge, m.value.label]
3082
+ ])
3083
+ ]),
3084
+ d("div", hl, [
3085
+ f[10] || (f[10] = d("label", null, "字段类型", -1)),
3086
+ oe(d("select", {
3087
+ "onUpdate:modelValue": f[3] || (f[3] = (k) => m.value.type = k)
3088
+ }, [
3089
+ (r(!0), c(G, null, Z(n.availableTypes, (k) => (r(), c("option", {
3090
+ key: k.value,
3091
+ value: k.value
3092
+ }, Y(k.label), 9, gl))), 128))
3093
+ ], 512), [
3094
+ [Pe, m.value.type]
3095
+ ])
3096
+ ]),
3097
+ d("div", bl, [
3098
+ f[11] || (f[11] = d("label", null, "是否必填", -1)),
3099
+ d("button", {
3100
+ class: u(["switch-btn", { "is-on": m.value.required }]),
3101
+ onClick: f[4] || (f[4] = (k) => m.value.required = !m.value.required)
3102
+ }, Y(m.value.required ? "必填" : "可选"), 3)
3103
+ ]),
3104
+ d("div", yl, [
3105
+ f[12] || (f[12] = d("label", null, "占位文本", -1)),
3106
+ oe(d("input", {
3107
+ "onUpdate:modelValue": f[5] || (f[5] = (k) => m.value.placeholder = k),
3108
+ type: "text",
3109
+ placeholder: "输入提示"
3110
+ }, null, 512), [
3111
+ [ge, m.value.placeholder]
3112
+ ])
3113
+ ])
3114
+ ]),
3115
+ d("div", { class: "modal-footer" }, [
3116
+ d("button", {
3117
+ class: "cancel-btn",
3118
+ onClick: M
3119
+ }, "取消"),
3120
+ d("button", {
3121
+ class: "save-btn",
3122
+ onClick: T
3123
+ }, "保存")
3124
+ ])
3125
+ ])
3126
+ ], 2)) : H("", !0)
3127
+ ], 2));
3128
+ }
2905
3129
  });
2906
3130
  export {
2907
- dl as Checkbox,
2908
- vl as CheckboxGroup,
2909
- pl as DatePicker,
2910
- fl as Form,
2911
- ml as FormItem,
2912
- nl as Input,
2913
- sl as InputNumber,
2914
- rl as Radio,
2915
- cl as RadioButton,
2916
- il as RadioGroup,
2917
- xl as Rate,
2918
- gl as Select,
2919
- yl as Slider,
2920
- ol as Switch,
2921
- ul as Textarea,
2922
- hl as TimePicker,
2923
- bl as Transfer,
2924
- kl as Upload
3131
+ Tl as Checkbox,
3132
+ Rl as CheckboxGroup,
3133
+ Il as DatePicker,
3134
+ Hl as DynamicFields,
3135
+ Bl as Form,
3136
+ Fl as FormItem,
3137
+ wl as Input,
3138
+ Vl as InputNumber,
3139
+ $l as Radio,
3140
+ Ml as RadioButton,
3141
+ Sl as RadioGroup,
3142
+ zl as Rate,
3143
+ Pl as Select,
3144
+ El as Slider,
3145
+ Dl as Switch,
3146
+ Cl as Textarea,
3147
+ Ll as TimePicker,
3148
+ Al as Transfer,
3149
+ Yl as Upload
2925
3150
  };