@xto/form 1.1.1 → 1.1.3

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