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