@xto/form 1.1.7 → 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 +547 -546
- 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
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);
|
|
@@ -44,10 +44,10 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
44
44
|
p.value = !1, a("blur", k);
|
|
45
45
|
}, M = () => {
|
|
46
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
|
-
},
|
|
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();
|
|
@@ -58,7 +58,7 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
58
58
|
},
|
|
59
59
|
inputRef: m
|
|
60
60
|
}), (k, W) => (r(), d("div", {
|
|
61
|
-
class: u(
|
|
61
|
+
class: u(P.value)
|
|
62
62
|
}, [
|
|
63
63
|
k.$slots.prefix || n.prefixIcon ? (r(), d("span", {
|
|
64
64
|
key: 0,
|
|
@@ -87,7 +87,7 @@ 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
|
}, [
|
|
@@ -97,10 +97,10 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
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:
|
|
103
|
+
onClick: A
|
|
104
104
|
}, z(C.value ? "🙈" : "👁️"), 3)) : O("", !0),
|
|
105
105
|
n.showWordLimit && n.maxlength ? (r(), d("span", {
|
|
106
106
|
key: 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,25 +149,25 @@ 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
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 {
|
|
@@ -178,7 +178,7 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
178
178
|
} else
|
|
179
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,23 +220,23 @@ 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) : (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,
|
|
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
241
|
}), (o, c) => (r(), d("div", {
|
|
242
242
|
class: u(M.value)
|
|
@@ -271,7 +271,7 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
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
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,25 +330,25 @@ 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
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]
|
|
@@ -356,14 +356,15 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
356
356
|
n.showWordLimit && n.maxlength ? (r(), d("span", {
|
|
357
357
|
key: 0,
|
|
358
358
|
class: u(s(l).e("count"))
|
|
359
|
-
}, z(
|
|
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,15 +414,15 @@ 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
|
}, [
|
|
@@ -430,17 +431,17 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
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
|
+
ae(P.$slots, "default", {}, () => [
|
|
444
445
|
me(z(n.label), 1)
|
|
445
446
|
])
|
|
446
447
|
], 2)) : O("", !0)
|
|
@@ -456,12 +457,12 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
456
457
|
name: {}
|
|
457
458
|
},
|
|
458
459
|
emits: ["update:modelValue", "update:value", "change"],
|
|
459
|
-
setup(n, { emit:
|
|
460
|
-
const t = n, e =
|
|
460
|
+
setup(n, { emit: y }) {
|
|
461
|
+
const t = n, e = y, a = _("radio-group"), l = (m) => {
|
|
461
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);
|
|
462
463
|
};
|
|
463
464
|
return $e("radioGroup", {
|
|
464
|
-
modelValue:
|
|
465
|
+
modelValue: b(() => t.modelValue ?? t.value),
|
|
465
466
|
name: t.name || `radio-group-${Date.now()}`,
|
|
466
467
|
disabled: t.disabled,
|
|
467
468
|
changeValue: l
|
|
@@ -482,22 +483,22 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
482
483
|
name: {}
|
|
483
484
|
},
|
|
484
485
|
emits: ["update:modelValue", "change"],
|
|
485
|
-
setup(n, { emit:
|
|
486
|
-
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(() => [
|
|
487
488
|
e.b(),
|
|
488
489
|
e.is("active", C.value),
|
|
489
|
-
e.is("disabled",
|
|
490
|
+
e.is("disabled", w.value)
|
|
490
491
|
]), S = () => {
|
|
491
|
-
|
|
492
|
+
w.value || l.value && a.changeValue(p.value);
|
|
492
493
|
};
|
|
493
494
|
return (V, $) => (r(), d("label", {
|
|
494
|
-
class: u(
|
|
495
|
+
class: u(F.value),
|
|
495
496
|
onClick: oe(S, ["prevent"])
|
|
496
497
|
}, [
|
|
497
498
|
i("input", {
|
|
498
499
|
type: "radio",
|
|
499
500
|
checked: C.value,
|
|
500
|
-
disabled:
|
|
501
|
+
disabled: w.value,
|
|
501
502
|
value: p.value,
|
|
502
503
|
class: u(s(e).e("input"))
|
|
503
504
|
}, null, 10, Ze),
|
|
@@ -522,21 +523,21 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
522
523
|
indeterminate: { type: Boolean }
|
|
523
524
|
},
|
|
524
525
|
emits: ["update:modelValue", "change"],
|
|
525
|
-
setup(n, { emit:
|
|
526
|
-
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(() => {
|
|
527
528
|
if (t.disabled) return !0;
|
|
528
529
|
if (m.value) {
|
|
529
|
-
const V = l.disabled, $ = l.min > 0 && l.modelValue.value.length <= l.min,
|
|
530
|
-
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;
|
|
531
532
|
}
|
|
532
533
|
return !1;
|
|
533
|
-
}),
|
|
534
|
+
}), F = b(() => [
|
|
534
535
|
a.b(),
|
|
535
536
|
a.is("checked", C.value),
|
|
536
|
-
a.is("disabled",
|
|
537
|
+
a.is("disabled", w.value),
|
|
537
538
|
a.is("indeterminate", t.indeterminate && !C.value)
|
|
538
539
|
]), S = () => {
|
|
539
|
-
if (!
|
|
540
|
+
if (!w.value)
|
|
540
541
|
if (m.value)
|
|
541
542
|
l.changeValue(p.value);
|
|
542
543
|
else {
|
|
@@ -550,7 +551,7 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
550
551
|
}
|
|
551
552
|
};
|
|
552
553
|
return (V, $) => (r(), d("label", {
|
|
553
|
-
class: u(
|
|
554
|
+
class: u(F.value),
|
|
554
555
|
onClick: oe(S, ["prevent"])
|
|
555
556
|
}, [
|
|
556
557
|
i("span", {
|
|
@@ -559,7 +560,7 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
559
560
|
i("input", {
|
|
560
561
|
type: "checkbox",
|
|
561
562
|
checked: C.value,
|
|
562
|
-
disabled:
|
|
563
|
+
disabled: w.value,
|
|
563
564
|
name: n.name,
|
|
564
565
|
value: p.value
|
|
565
566
|
}, null, 8, Qe)
|
|
@@ -584,13 +585,13 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
584
585
|
max: { default: 0 }
|
|
585
586
|
},
|
|
586
587
|
emits: ["update:modelValue", "change"],
|
|
587
|
-
setup(n, { emit:
|
|
588
|
-
const t = n, e =
|
|
588
|
+
setup(n, { emit: y }) {
|
|
589
|
+
const t = n, e = y, a = _("checkbox-group"), l = (m) => {
|
|
589
590
|
const p = [...t.modelValue], C = p.indexOf(m);
|
|
590
591
|
C > -1 ? p.splice(C, 1) : p.push(m), e("update:modelValue", p), e("change", p);
|
|
591
592
|
};
|
|
592
593
|
return $e("checkboxGroup", {
|
|
593
|
-
modelValue:
|
|
594
|
+
modelValue: b(() => t.modelValue),
|
|
594
595
|
disabled: t.disabled,
|
|
595
596
|
min: t.min,
|
|
596
597
|
max: t.max,
|
|
@@ -616,13 +617,13 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
616
617
|
size: { default: "default" }
|
|
617
618
|
},
|
|
618
619
|
emits: ["validate", "submit", "reset"],
|
|
619
|
-
setup(n, { expose:
|
|
620
|
-
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(() => [
|
|
621
622
|
l.b(),
|
|
622
623
|
l.m(`label-${C.value ? "top" : e.labelPosition}`),
|
|
623
624
|
l.is("inline", p.value),
|
|
624
625
|
l.is("vertical", C.value)
|
|
625
|
-
]),
|
|
626
|
+
]), F = b(() => ({ width: typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth })), S = (h) => {
|
|
626
627
|
m.value.push(h);
|
|
627
628
|
}, V = (h) => {
|
|
628
629
|
const f = m.value.indexOf(h);
|
|
@@ -632,7 +633,7 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
632
633
|
for (const f of m.value)
|
|
633
634
|
await f.validate() || (h = !1);
|
|
634
635
|
return h;
|
|
635
|
-
},
|
|
636
|
+
}, P = async (h) => {
|
|
636
637
|
const f = Array.isArray(h) ? h : [h];
|
|
637
638
|
let k = !0;
|
|
638
639
|
for (const W of m.value)
|
|
@@ -656,25 +657,25 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
656
657
|
console.log("[XForm] handleSubmit triggered", h), h.preventDefault(), a("submit");
|
|
657
658
|
}, M = (h) => {
|
|
658
659
|
console.log("[XForm] handleReset triggered", h), h.preventDefault(), v(), a("reset");
|
|
659
|
-
},
|
|
660
|
+
}, A = Ue(e, "model");
|
|
660
661
|
return $e("form", {
|
|
661
|
-
model:
|
|
662
|
+
model: A,
|
|
662
663
|
rules: e.rules,
|
|
663
664
|
labelWidth: e.labelWidth,
|
|
664
665
|
labelPosition: C.value ? "top" : e.labelPosition,
|
|
665
666
|
disabled: e.disabled,
|
|
666
667
|
size: e.size,
|
|
667
|
-
labelStyle:
|
|
668
|
+
labelStyle: F,
|
|
668
669
|
addField: S,
|
|
669
670
|
removeField: V,
|
|
670
671
|
emit: a
|
|
671
|
-
}),
|
|
672
|
+
}), y({
|
|
672
673
|
validate: $,
|
|
673
|
-
validateField:
|
|
674
|
+
validateField: P,
|
|
674
675
|
resetFields: v,
|
|
675
676
|
clearValidate: D
|
|
676
677
|
}), (h, f) => (r(), d("form", {
|
|
677
|
-
class: u(
|
|
678
|
+
class: u(w.value),
|
|
678
679
|
onSubmit: R,
|
|
679
680
|
onReset: M
|
|
680
681
|
}, [
|
|
@@ -692,41 +693,41 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
692
693
|
rules: {},
|
|
693
694
|
showMessage: { type: Boolean }
|
|
694
695
|
},
|
|
695
|
-
setup(n, { expose:
|
|
696
|
-
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 = () => {
|
|
697
698
|
const D = [];
|
|
698
699
|
return t.rules && D.push(...t.rules), a && t.prop && a.rules[t.prop] && D.push(...a.rules[t.prop]), D;
|
|
699
|
-
},
|
|
700
|
+
}, w = () => {
|
|
700
701
|
var D;
|
|
701
702
|
if (!(!a || !t.prop))
|
|
702
703
|
return (D = a.model.value) == null ? void 0 : D[t.prop];
|
|
703
|
-
},
|
|
704
|
+
}, F = (D) => {
|
|
704
705
|
!a || !t.prop || a.model.value && (a.model.value[t.prop] = D);
|
|
705
706
|
}, S = async (D) => {
|
|
706
707
|
const R = C();
|
|
707
708
|
if (R.length === 0)
|
|
708
709
|
return l.value = "valid", !0;
|
|
709
|
-
const M =
|
|
710
|
-
let
|
|
710
|
+
const M = w();
|
|
711
|
+
let A = !0, h = "";
|
|
711
712
|
for (const f of R)
|
|
712
713
|
if (!(D && f.trigger && f.trigger !== D)) {
|
|
713
714
|
if (f.required && (M == null || M === "" || Array.isArray(M) && M.length === 0)) {
|
|
714
|
-
|
|
715
|
+
A = !1, h = f.message || "该字段为必填项";
|
|
715
716
|
break;
|
|
716
717
|
}
|
|
717
718
|
if (f.min !== void 0 || f.max !== void 0) {
|
|
718
719
|
const k = typeof M == "string" ? M.length : 0;
|
|
719
720
|
if (f.min !== void 0 && k < f.min) {
|
|
720
|
-
|
|
721
|
+
A = !1, h = f.message || `长度不能小于 ${f.min} 个字符`;
|
|
721
722
|
break;
|
|
722
723
|
}
|
|
723
724
|
if (f.max !== void 0 && k > f.max) {
|
|
724
|
-
|
|
725
|
+
A = !1, h = f.message || `长度不能大于 ${f.max} 个字符`;
|
|
725
726
|
break;
|
|
726
727
|
}
|
|
727
728
|
}
|
|
728
729
|
if (f.pattern && M && !f.pattern.test(M)) {
|
|
729
|
-
|
|
730
|
+
A = !1, h = f.message || "格式不正确";
|
|
730
731
|
break;
|
|
731
732
|
}
|
|
732
733
|
if (f.validator)
|
|
@@ -737,25 +738,25 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
737
738
|
});
|
|
738
739
|
});
|
|
739
740
|
} catch (k) {
|
|
740
|
-
|
|
741
|
+
A = !1, h = k.message || f.message || "验证失败";
|
|
741
742
|
break;
|
|
742
743
|
}
|
|
743
744
|
}
|
|
744
|
-
return l.value =
|
|
745
|
+
return l.value = A ? "valid" : "invalid", m.value = h, a && t.prop && a.emit("validate", t.prop, A, h), A;
|
|
745
746
|
}, V = () => {
|
|
746
|
-
|
|
747
|
+
F(void 0), $();
|
|
747
748
|
}, $ = () => {
|
|
748
749
|
l.value = "", m.value = "";
|
|
749
|
-
},
|
|
750
|
+
}, P = b(() => [
|
|
750
751
|
e.b(),
|
|
751
752
|
e.is("required", p.value),
|
|
752
753
|
e.is("error", l.value === "invalid"),
|
|
753
754
|
e.is("success", l.value === "valid")
|
|
754
|
-
]), v =
|
|
755
|
+
]), v = b(() => {
|
|
755
756
|
const D = t.labelWidth ?? (a == null ? void 0 : a.labelWidth) ?? "100px";
|
|
756
757
|
return { width: typeof D == "number" ? `${D}px` : D };
|
|
757
758
|
});
|
|
758
|
-
return ce(() =>
|
|
759
|
+
return ce(() => w(), () => {
|
|
759
760
|
l.value === "invalid" && S("change");
|
|
760
761
|
}), xe(() => {
|
|
761
762
|
a && t.prop && a.addField({
|
|
@@ -771,12 +772,12 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
771
772
|
resetField: V,
|
|
772
773
|
clearValidate: $
|
|
773
774
|
});
|
|
774
|
-
}),
|
|
775
|
+
}), y({
|
|
775
776
|
validate: S,
|
|
776
777
|
resetField: V,
|
|
777
778
|
clearValidate: $
|
|
778
779
|
}), (D, R) => (r(), d("div", {
|
|
779
|
-
class: u(
|
|
780
|
+
class: u(P.value)
|
|
780
781
|
}, [
|
|
781
782
|
n.label ? (r(), d("label", {
|
|
782
783
|
key: 0,
|
|
@@ -795,37 +796,37 @@ const Xe = ["type", "placeholder", "disabled", "readonly", "maxlength", "minleng
|
|
|
795
796
|
], 2));
|
|
796
797
|
}
|
|
797
798
|
});
|
|
798
|
-
function Je(n,
|
|
799
|
-
return new Date(n,
|
|
799
|
+
function Je(n, y) {
|
|
800
|
+
return new Date(n, y + 1, 0).getDate();
|
|
800
801
|
}
|
|
801
|
-
function _e(n,
|
|
802
|
-
return new Date(n,
|
|
802
|
+
function _e(n, y) {
|
|
803
|
+
return new Date(n, y, 1).getDay();
|
|
803
804
|
}
|
|
804
|
-
function fe(n,
|
|
805
|
-
return !n || !
|
|
805
|
+
function fe(n, y) {
|
|
806
|
+
return !n || !y ? !1 : n.getFullYear() === y.getFullYear() && n.getMonth() === y.getMonth() && n.getDate() === y.getDate();
|
|
806
807
|
}
|
|
807
|
-
function et(n,
|
|
808
|
-
return !n || !
|
|
808
|
+
function et(n, y) {
|
|
809
|
+
return !n || !y ? !1 : n.getFullYear() === y.getFullYear() && n.getMonth() === y.getMonth();
|
|
809
810
|
}
|
|
810
|
-
function Ee(n,
|
|
811
|
-
if (!
|
|
811
|
+
function Ee(n, y, t) {
|
|
812
|
+
if (!y || !t) return !1;
|
|
812
813
|
const e = n.getTime();
|
|
813
|
-
return e >=
|
|
814
|
+
return e >= y.getTime() && e <= t.getTime();
|
|
814
815
|
}
|
|
815
|
-
function tt(n,
|
|
816
|
-
const e = [], a = Je(n,
|
|
817
|
-
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);
|
|
818
819
|
const p = (l - t + 7) % 7;
|
|
819
820
|
m.setDate(1 - p);
|
|
820
|
-
let C = [],
|
|
821
|
-
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))); )
|
|
822
823
|
;
|
|
823
824
|
return C.length > 0 && e.push(C), e;
|
|
824
825
|
}
|
|
825
|
-
function re(n,
|
|
826
|
+
function re(n, y = "YYYY-MM-DD") {
|
|
826
827
|
if (!n) return "";
|
|
827
828
|
const t = n.getFullYear(), e = n.getMonth() + 1, a = n.getDate(), l = n.getHours(), m = n.getMinutes(), p = n.getSeconds();
|
|
828
|
-
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));
|
|
829
830
|
}
|
|
830
831
|
function de(n) {
|
|
831
832
|
if (!n || Array.isArray(n)) return null;
|
|
@@ -834,39 +835,39 @@ function de(n) {
|
|
|
834
835
|
if (typeof n == "number")
|
|
835
836
|
return new Date(n);
|
|
836
837
|
if (typeof n != "string") return null;
|
|
837
|
-
const
|
|
838
|
-
if (isNaN(
|
|
838
|
+
const y = new Date(n);
|
|
839
|
+
if (isNaN(y.getTime())) {
|
|
839
840
|
const t = n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);
|
|
840
841
|
return t ? new Date(parseInt(t[1]), parseInt(t[2]) - 1, parseInt(t[3])) : null;
|
|
841
842
|
}
|
|
842
|
-
return
|
|
843
|
+
return y;
|
|
843
844
|
}
|
|
844
845
|
function lt(n) {
|
|
845
|
-
const
|
|
846
|
-
return
|
|
846
|
+
const y = new Date(n);
|
|
847
|
+
return y.setMonth(y.getMonth() - 1), y;
|
|
847
848
|
}
|
|
848
849
|
function at(n) {
|
|
849
|
-
const
|
|
850
|
-
return
|
|
850
|
+
const y = new Date(n);
|
|
851
|
+
return y.setMonth(y.getMonth() + 1), y;
|
|
851
852
|
}
|
|
852
853
|
function nt(n) {
|
|
853
|
-
const
|
|
854
|
-
return
|
|
854
|
+
const y = new Date(n);
|
|
855
|
+
return y.setFullYear(y.getFullYear() - 1), y;
|
|
855
856
|
}
|
|
856
857
|
function st(n) {
|
|
857
|
-
const
|
|
858
|
-
return
|
|
858
|
+
const y = new Date(n);
|
|
859
|
+
return y.setFullYear(y.getFullYear() + 1), y;
|
|
859
860
|
}
|
|
860
861
|
function ze(n) {
|
|
861
|
-
const
|
|
862
|
-
return [
|
|
862
|
+
const y = Math.floor(n / 10) * 10;
|
|
863
|
+
return [y, y + 9];
|
|
863
864
|
}
|
|
864
865
|
function Re(n) {
|
|
865
|
-
const
|
|
866
|
-
return
|
|
866
|
+
const y = new Date(n);
|
|
867
|
+
return y.setHours(0, 0, 0, 0), y;
|
|
867
868
|
}
|
|
868
|
-
function ut(n,
|
|
869
|
-
if (
|
|
869
|
+
function ut(n, y, t, e) {
|
|
870
|
+
if (y && y(n))
|
|
870
871
|
return !0;
|
|
871
872
|
const a = Re(n).getTime();
|
|
872
873
|
return !!(t && a < Re(t).getTime() || e && a > Re(e).getTime());
|
|
@@ -901,8 +902,8 @@ const ot = [
|
|
|
901
902
|
selectionMode: { default: "single" }
|
|
902
903
|
},
|
|
903
904
|
emits: ["pick", "range-select", "range-move", "update:viewedMonth"],
|
|
904
|
-
setup(n, { emit:
|
|
905
|
-
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) => {
|
|
906
907
|
if (t.selectionMode !== "range") return !1;
|
|
907
908
|
const { startDate: f, endDate: k, selecting: W } = t.rangeState || {};
|
|
908
909
|
if (W && f) {
|
|
@@ -918,7 +919,7 @@ const ot = [
|
|
|
918
919
|
if (t.selectionMode !== "range") return !1;
|
|
919
920
|
const { startDate: f, selecting: k } = t.rangeState || {};
|
|
920
921
|
return k && f && l.value ? fe(h, f < l.value ? f : l.value) : f ? fe(h, f) : !1;
|
|
921
|
-
},
|
|
922
|
+
}, P = (h) => {
|
|
922
923
|
if (t.selectionMode !== "range") return !1;
|
|
923
924
|
const { endDate: f, selecting: k } = t.rangeState || {};
|
|
924
925
|
if (k && l.value) {
|
|
@@ -928,19 +929,19 @@ const ot = [
|
|
|
928
929
|
return f ? fe(h, f) : !1;
|
|
929
930
|
}, v = (h) => ut(h, t.disabledDate, t.minDate, t.maxDate), D = (h) => [
|
|
930
931
|
a.e("cell"),
|
|
931
|
-
a.is("selected",
|
|
932
|
-
a.is("today",
|
|
932
|
+
a.is("selected", w(h)),
|
|
933
|
+
a.is("today", F(h)),
|
|
933
934
|
a.is("disabled", v(h)),
|
|
934
935
|
a.is("in-range", V(h)),
|
|
935
936
|
a.is("range-start", $(h)),
|
|
936
|
-
a.is("range-end",
|
|
937
|
+
a.is("range-end", P(h)),
|
|
937
938
|
a.is("prev-month", !S(h) && h.getMonth() < p.value),
|
|
938
939
|
a.is("next-month", !S(h) && h.getMonth() > p.value)
|
|
939
940
|
], R = (h) => {
|
|
940
941
|
v(h) || (t.selectionMode === "range" ? e("range-select", h) : e("pick", h));
|
|
941
942
|
}, M = (h) => {
|
|
942
943
|
l.value = h;
|
|
943
|
-
},
|
|
944
|
+
}, A = () => {
|
|
944
945
|
l.value = null;
|
|
945
946
|
};
|
|
946
947
|
return (h, f) => (r(), d("table", {
|
|
@@ -963,7 +964,7 @@ const ot = [
|
|
|
963
964
|
class: u(D(X)),
|
|
964
965
|
onClick: (ee) => R(X),
|
|
965
966
|
onMouseenter: (ee) => M(X),
|
|
966
|
-
onMouseleave:
|
|
967
|
+
onMouseleave: A
|
|
967
968
|
}, [
|
|
968
969
|
i("span", {
|
|
969
970
|
class: u(s(a).e("cell-text"))
|
|
@@ -982,9 +983,9 @@ const ot = [
|
|
|
982
983
|
disabledDate: {}
|
|
983
984
|
},
|
|
984
985
|
emits: ["pick"],
|
|
985
|
-
setup(n, { emit:
|
|
986
|
-
const t = n, e =
|
|
987
|
-
|
|
986
|
+
setup(n, { emit: y }) {
|
|
987
|
+
const t = n, e = y, a = _("month-table");
|
|
988
|
+
b(() => t.modelValue ? t.modelValue.getMonth() : -1);
|
|
988
989
|
const l = (S) => t.modelValue ? t.modelValue.getFullYear() === t.viewedYear && t.modelValue.getMonth() === S : !1, m = (S) => {
|
|
989
990
|
const V = /* @__PURE__ */ new Date();
|
|
990
991
|
return V.getFullYear() === t.viewedYear && V.getMonth() === S;
|
|
@@ -997,9 +998,9 @@ const ot = [
|
|
|
997
998
|
a.is("selected", l(S)),
|
|
998
999
|
a.is("current", m(S)),
|
|
999
1000
|
a.is("disabled", p(S))
|
|
1000
|
-
],
|
|
1001
|
+
], w = (S) => {
|
|
1001
1002
|
p(S) || e("pick", S);
|
|
1002
|
-
},
|
|
1003
|
+
}, F = b(() => {
|
|
1003
1004
|
const S = [];
|
|
1004
1005
|
for (let V = 0; V < 12; V += 3)
|
|
1005
1006
|
S.push([V, V + 1, V + 2]);
|
|
@@ -1011,11 +1012,11 @@ const ot = [
|
|
|
1011
1012
|
cellpadding: "0"
|
|
1012
1013
|
}, [
|
|
1013
1014
|
i("tbody", null, [
|
|
1014
|
-
(r(!0), d(G, null, Q(
|
|
1015
|
+
(r(!0), d(G, null, Q(F.value, ($, P) => (r(), d("tr", { key: P }, [
|
|
1015
1016
|
(r(!0), d(G, null, Q($, (v) => (r(), d("td", {
|
|
1016
1017
|
key: v,
|
|
1017
1018
|
class: u(C(v)),
|
|
1018
|
-
onClick: (D) =>
|
|
1019
|
+
onClick: (D) => w(v)
|
|
1019
1020
|
}, [
|
|
1020
1021
|
i("span", {
|
|
1021
1022
|
class: u(s(a).e("cell-text"))
|
|
@@ -1034,19 +1035,19 @@ const ot = [
|
|
|
1034
1035
|
disabledDate: {}
|
|
1035
1036
|
},
|
|
1036
1037
|
emits: ["pick"],
|
|
1037
|
-
setup(n, { emit:
|
|
1038
|
-
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(() => {
|
|
1039
1040
|
const [v] = m.value, D = [];
|
|
1040
1041
|
D.push(v - 1);
|
|
1041
1042
|
for (let R = 0; R < 10; R++)
|
|
1042
1043
|
D.push(v + R);
|
|
1043
1044
|
return D.push(v + 10), D;
|
|
1044
|
-
}), C =
|
|
1045
|
+
}), C = b(() => {
|
|
1045
1046
|
const v = [];
|
|
1046
1047
|
for (let D = 0; D < p.value.length; D += 3)
|
|
1047
1048
|
v.push(p.value.slice(D, D + 3));
|
|
1048
1049
|
return v;
|
|
1049
|
-
}),
|
|
1050
|
+
}), w = (v) => t.modelValue ? t.modelValue.getFullYear() === v : !1, F = (v) => v === l.value, S = (v) => {
|
|
1050
1051
|
const [D, R] = m.value;
|
|
1051
1052
|
return v >= D && v <= R;
|
|
1052
1053
|
}, V = (v) => {
|
|
@@ -1055,11 +1056,11 @@ const ot = [
|
|
|
1055
1056
|
return t.disabledDate(D) && t.disabledDate(R);
|
|
1056
1057
|
}, $ = (v) => [
|
|
1057
1058
|
a.e("cell"),
|
|
1058
|
-
a.is("selected",
|
|
1059
|
-
a.is("current",
|
|
1059
|
+
a.is("selected", w(v)),
|
|
1060
|
+
a.is("current", F(v)),
|
|
1060
1061
|
a.is("disabled", V(v)),
|
|
1061
1062
|
a.is("in-decade", S(v))
|
|
1062
|
-
],
|
|
1063
|
+
], P = (v) => {
|
|
1063
1064
|
V(v) || e("pick", v);
|
|
1064
1065
|
};
|
|
1065
1066
|
return (v, D) => (r(), d("table", {
|
|
@@ -1069,14 +1070,14 @@ const ot = [
|
|
|
1069
1070
|
}, [
|
|
1070
1071
|
i("tbody", null, [
|
|
1071
1072
|
(r(!0), d(G, null, Q(C.value, (R, M) => (r(), d("tr", { key: M }, [
|
|
1072
|
-
(r(!0), d(G, null, Q(R, (
|
|
1073
|
-
key:
|
|
1074
|
-
class: u($(
|
|
1075
|
-
onClick: (h) =>
|
|
1073
|
+
(r(!0), d(G, null, Q(R, (A) => (r(), d("td", {
|
|
1074
|
+
key: A,
|
|
1075
|
+
class: u($(A)),
|
|
1076
|
+
onClick: (h) => P(A)
|
|
1076
1077
|
}, [
|
|
1077
1078
|
i("span", {
|
|
1078
1079
|
class: u(s(a).e("cell-text"))
|
|
1079
|
-
}, z(
|
|
1080
|
+
}, z(A), 3)
|
|
1080
1081
|
], 10, ft))), 128))
|
|
1081
1082
|
]))), 128))
|
|
1082
1083
|
])
|
|
@@ -1104,13 +1105,13 @@ const ot = [
|
|
|
1104
1105
|
showTime: { type: Boolean, default: !1 }
|
|
1105
1106
|
},
|
|
1106
1107
|
emits: ["update:modelValue", "update:value", "change", "focus", "blur", "clear"],
|
|
1107
|
-
setup(n, { expose:
|
|
1108
|
-
const e = n, a = t, l = _("date-picker"), m = E(!1), p = E(2e3), C = E(),
|
|
1109
|
-
e.modelValue !== void 0 && 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);
|
|
1110
1111
|
}, S = E(), V = E(), $ = E({
|
|
1111
1112
|
top: "0px",
|
|
1112
1113
|
left: "0px"
|
|
1113
|
-
}),
|
|
1114
|
+
}), P = () => Ye().next(), v = E("date"), D = E(/* @__PURE__ */ new Date()), R = E({
|
|
1114
1115
|
hours: (/* @__PURE__ */ new Date()).getHours(),
|
|
1115
1116
|
minutes: (/* @__PURE__ */ new Date()).getMinutes(),
|
|
1116
1117
|
seconds: (/* @__PURE__ */ new Date()).getSeconds()
|
|
@@ -1118,60 +1119,60 @@ const ot = [
|
|
|
1118
1119
|
selecting: !1,
|
|
1119
1120
|
startDate: null,
|
|
1120
1121
|
endDate: null
|
|
1121
|
-
}),
|
|
1122
|
-
const
|
|
1123
|
-
if (!
|
|
1122
|
+
}), A = b(() => {
|
|
1123
|
+
const I = w();
|
|
1124
|
+
if (!I) return null;
|
|
1124
1125
|
if (e.type === "daterange") {
|
|
1125
|
-
if (!Array.isArray(
|
|
1126
|
-
const [
|
|
1126
|
+
if (!Array.isArray(I)) return null;
|
|
1127
|
+
const [L, U] = I;
|
|
1127
1128
|
return [
|
|
1128
|
-
|
|
1129
|
+
L instanceof Date ? L : de(L),
|
|
1129
1130
|
U instanceof Date ? U : de(U)
|
|
1130
1131
|
];
|
|
1131
1132
|
}
|
|
1132
|
-
return
|
|
1133
|
-
}), h =
|
|
1133
|
+
return I instanceof Date ? I : de(I);
|
|
1134
|
+
}), h = b(() => {
|
|
1134
1135
|
if (e.type === "daterange") return "";
|
|
1135
|
-
const
|
|
1136
|
-
if (!F) return "";
|
|
1137
|
-
const I = F instanceof Date ? F : de(F);
|
|
1136
|
+
const I = w();
|
|
1138
1137
|
if (!I) return "";
|
|
1138
|
+
const L = I instanceof Date ? I : de(I);
|
|
1139
|
+
if (!L) return "";
|
|
1139
1140
|
const U = e.showTime ? "YYYY-MM-DD HH:mm:ss" : e.format;
|
|
1140
|
-
return re(
|
|
1141
|
-
}), f =
|
|
1142
|
-
const
|
|
1143
|
-
if (!
|
|
1144
|
-
const [
|
|
1145
|
-
if (!
|
|
1146
|
-
const U =
|
|
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);
|
|
1147
1148
|
return U ? re(U, e.format) : "";
|
|
1148
|
-
}), k =
|
|
1149
|
-
const
|
|
1150
|
-
if (!
|
|
1151
|
-
const [,
|
|
1152
|
-
if (!
|
|
1153
|
-
const U =
|
|
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);
|
|
1154
1155
|
return U ? re(U, e.format) : "";
|
|
1155
|
-
}), W =
|
|
1156
|
-
const
|
|
1157
|
-
return !
|
|
1158
|
-
}), X =
|
|
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(() => [
|
|
1159
1160
|
l.b(),
|
|
1160
1161
|
l.m(e.size),
|
|
1161
1162
|
l.is("disabled", e.disabled),
|
|
1162
1163
|
l.is("range", e.type === "daterange")
|
|
1163
|
-
]),
|
|
1164
|
+
]), x = b(() => [
|
|
1164
1165
|
l.e("input"),
|
|
1165
1166
|
l.is("focus", m.value),
|
|
1166
1167
|
l.is("has-value", !!h.value || !!(f.value || k.value))
|
|
1167
1168
|
]), o = () => {
|
|
1168
1169
|
e.disabled || e.readonly || (m.value ? g() : c());
|
|
1169
1170
|
}, c = () => {
|
|
1170
|
-
m.value = !0, p.value =
|
|
1171
|
+
m.value = !0, p.value = P(), Se(() => {
|
|
1171
1172
|
if (C.value && S.value) {
|
|
1172
|
-
const
|
|
1173
|
-
let U =
|
|
1174
|
-
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 = {
|
|
1175
1176
|
top: `${U}px`,
|
|
1176
1177
|
left: `${Te}px`
|
|
1177
1178
|
};
|
|
@@ -1179,53 +1180,53 @@ const ot = [
|
|
|
1179
1180
|
}), a("focus", {});
|
|
1180
1181
|
}, g = () => {
|
|
1181
1182
|
m.value = !1, v.value = "date", a("blur", {});
|
|
1182
|
-
}, K = (
|
|
1183
|
+
}, K = (I) => {
|
|
1183
1184
|
if (e.type === "date") {
|
|
1184
|
-
e.showTime && (
|
|
1185
|
-
const
|
|
1186
|
-
|
|
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();
|
|
1187
1188
|
}
|
|
1188
1189
|
}, le = () => {
|
|
1189
|
-
const
|
|
1190
|
-
if (
|
|
1191
|
-
const
|
|
1192
|
-
if (
|
|
1193
|
-
|
|
1194
|
-
const U = e.valueFormat ? re(
|
|
1195
|
-
|
|
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);
|
|
1196
1197
|
}
|
|
1197
1198
|
} else {
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1200
|
-
const U = e.valueFormat ? re(
|
|
1201
|
-
|
|
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);
|
|
1202
1203
|
}
|
|
1203
1204
|
g();
|
|
1204
|
-
}, H = (
|
|
1205
|
+
}, H = (I) => {
|
|
1205
1206
|
if (!M.value.selecting)
|
|
1206
|
-
M.value.selecting = !0, M.value.startDate =
|
|
1207
|
+
M.value.selecting = !0, M.value.startDate = I, M.value.endDate = null;
|
|
1207
1208
|
else {
|
|
1208
|
-
M.value.selecting = !1, M.value.startDate &&
|
|
1209
|
-
const
|
|
1210
|
-
|
|
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();
|
|
1211
1212
|
}
|
|
1212
|
-
}, te = (
|
|
1213
|
-
if (D.value = new Date(X.value,
|
|
1214
|
-
const
|
|
1215
|
-
|
|
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();
|
|
1216
1217
|
} else
|
|
1217
1218
|
v.value = "date";
|
|
1218
|
-
}, N = (
|
|
1219
|
-
if (D.value = new Date(
|
|
1220
|
-
const
|
|
1221
|
-
|
|
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();
|
|
1222
1223
|
} else
|
|
1223
1224
|
v.value = "month";
|
|
1224
1225
|
}, ve = () => {
|
|
1225
1226
|
D.value = lt(D.value);
|
|
1226
1227
|
}, ye = () => {
|
|
1227
1228
|
D.value = at(D.value);
|
|
1228
|
-
},
|
|
1229
|
+
}, Y = () => {
|
|
1229
1230
|
v.value === "year" ? D.value = new Date(X.value - 10, Z.value, 1) : D.value = nt(D.value);
|
|
1230
1231
|
}, q = () => {
|
|
1231
1232
|
v.value === "year" ? D.value = new Date(X.value + 10, Z.value, 1) : D.value = st(D.value);
|
|
@@ -1234,57 +1235,57 @@ const ot = [
|
|
|
1234
1235
|
}, se = () => {
|
|
1235
1236
|
v.value = "year";
|
|
1236
1237
|
}, ie = () => {
|
|
1237
|
-
|
|
1238
|
+
F(null), a("clear"), M.value = {
|
|
1238
1239
|
selecting: !1,
|
|
1239
1240
|
startDate: null,
|
|
1240
1241
|
endDate: null
|
|
1241
1242
|
};
|
|
1242
|
-
}, Ve = (
|
|
1243
|
+
}, Ve = (I) => {
|
|
1243
1244
|
if (!C.value) return;
|
|
1244
|
-
const
|
|
1245
|
-
C.value.contains(
|
|
1245
|
+
const L = I.target;
|
|
1246
|
+
C.value.contains(L) || S.value && S.value.contains(L) || g();
|
|
1246
1247
|
};
|
|
1247
1248
|
ce(
|
|
1248
|
-
|
|
1249
|
-
(
|
|
1250
|
-
if (
|
|
1251
|
-
if (Array.isArray(
|
|
1252
|
-
const [
|
|
1253
|
-
|
|
1254
|
-
} 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));
|
|
1255
1256
|
},
|
|
1256
1257
|
{ immediate: !0 }
|
|
1257
|
-
), ce(m, (
|
|
1258
|
-
|
|
1258
|
+
), ce(m, (I) => {
|
|
1259
|
+
I && (v.value = "date", e.type === "daterange" && (M.value = {
|
|
1259
1260
|
selecting: !1,
|
|
1260
|
-
startDate: Array.isArray(
|
|
1261
|
-
endDate: Array.isArray(
|
|
1261
|
+
startDate: Array.isArray(A.value) ? A.value[0] : null,
|
|
1262
|
+
endDate: Array.isArray(A.value) ? A.value[1] : null
|
|
1262
1263
|
}));
|
|
1263
1264
|
});
|
|
1264
|
-
const Me = (
|
|
1265
|
-
|
|
1265
|
+
const Me = (I) => {
|
|
1266
|
+
I.key === "Escape" && g();
|
|
1266
1267
|
};
|
|
1267
1268
|
return xe(() => {
|
|
1268
1269
|
document.addEventListener("click", Ve), document.addEventListener("keydown", Me);
|
|
1269
1270
|
}), we(() => {
|
|
1270
1271
|
document.removeEventListener("click", Ve), document.removeEventListener("keydown", Me);
|
|
1271
|
-
}),
|
|
1272
|
+
}), y({
|
|
1272
1273
|
focus: () => {
|
|
1273
|
-
var
|
|
1274
|
-
return (
|
|
1274
|
+
var I;
|
|
1275
|
+
return (I = V.value) == null ? void 0 : I.focus();
|
|
1275
1276
|
},
|
|
1276
1277
|
blur: () => {
|
|
1277
|
-
var
|
|
1278
|
-
return (
|
|
1278
|
+
var I;
|
|
1279
|
+
return (I = V.value) == null ? void 0 : I.blur();
|
|
1279
1280
|
}
|
|
1280
|
-
}), (
|
|
1281
|
+
}), (I, L) => (r(), d("div", {
|
|
1281
1282
|
ref_key: "pickerRef",
|
|
1282
1283
|
ref: C,
|
|
1283
1284
|
class: u(B.value)
|
|
1284
1285
|
}, [
|
|
1285
1286
|
n.type !== "daterange" ? (r(), d("div", {
|
|
1286
1287
|
key: 0,
|
|
1287
|
-
class: u(
|
|
1288
|
+
class: u(x.value),
|
|
1288
1289
|
onClick: o
|
|
1289
1290
|
}, [
|
|
1290
1291
|
i("input", {
|
|
@@ -1311,7 +1312,7 @@ const ot = [
|
|
|
1311
1312
|
], 2)
|
|
1312
1313
|
], 2)) : (r(), d("div", {
|
|
1313
1314
|
key: 1,
|
|
1314
|
-
class: u(
|
|
1315
|
+
class: u(x.value),
|
|
1315
1316
|
onClick: o
|
|
1316
1317
|
}, [
|
|
1317
1318
|
i("input", {
|
|
@@ -1361,14 +1362,14 @@ const ot = [
|
|
|
1361
1362
|
i("button", {
|
|
1362
1363
|
type: "button",
|
|
1363
1364
|
class: u(s(l).e("prev-btn")),
|
|
1364
|
-
onClick:
|
|
1365
|
+
onClick: L[0] || (L[0] = (U) => v.value === "date" ? ve() : Y())
|
|
1365
1366
|
}, " ‹ ", 2),
|
|
1366
1367
|
i("div", {
|
|
1367
1368
|
class: u(s(l).e("header-title"))
|
|
1368
1369
|
}, [
|
|
1369
1370
|
v.value === "year" ? (r(), d("span", {
|
|
1370
1371
|
key: 0,
|
|
1371
|
-
onClick:
|
|
1372
|
+
onClick: L[1] || (L[1] = (U) => v.value = "month")
|
|
1372
1373
|
}, z(T.value), 1)) : (r(), d(G, { key: 1 }, [
|
|
1373
1374
|
i("span", { onClick: se }, z(X.value) + " 年", 1),
|
|
1374
1375
|
v.value === "date" ? (r(), d("span", {
|
|
@@ -1380,7 +1381,7 @@ const ot = [
|
|
|
1380
1381
|
i("button", {
|
|
1381
1382
|
type: "button",
|
|
1382
1383
|
class: u(s(l).e("next-btn")),
|
|
1383
|
-
onClick:
|
|
1384
|
+
onClick: L[2] || (L[2] = (U) => v.value === "date" ? ye() : q())
|
|
1384
1385
|
}, " › ", 2)
|
|
1385
1386
|
], 2),
|
|
1386
1387
|
i("div", {
|
|
@@ -1419,7 +1420,7 @@ const ot = [
|
|
|
1419
1420
|
class: u(s(l).e("time-item"))
|
|
1420
1421
|
}, [
|
|
1421
1422
|
ue(i("select", {
|
|
1422
|
-
"onUpdate:modelValue":
|
|
1423
|
+
"onUpdate:modelValue": L[3] || (L[3] = (U) => R.value.hours = U),
|
|
1423
1424
|
class: u(s(l).e("time-select"))
|
|
1424
1425
|
}, [
|
|
1425
1426
|
(r(), d(G, null, Q(24, (U) => i("option", {
|
|
@@ -1434,13 +1435,13 @@ const ot = [
|
|
|
1434
1435
|
{ number: !0 }
|
|
1435
1436
|
]
|
|
1436
1437
|
]),
|
|
1437
|
-
|
|
1438
|
+
L[6] || (L[6] = i("span", null, "时", -1))
|
|
1438
1439
|
], 2),
|
|
1439
1440
|
i("div", {
|
|
1440
1441
|
class: u(s(l).e("time-item"))
|
|
1441
1442
|
}, [
|
|
1442
1443
|
ue(i("select", {
|
|
1443
|
-
"onUpdate:modelValue":
|
|
1444
|
+
"onUpdate:modelValue": L[4] || (L[4] = (U) => R.value.minutes = U),
|
|
1444
1445
|
class: u(s(l).e("time-select"))
|
|
1445
1446
|
}, [
|
|
1446
1447
|
(r(), d(G, null, Q(60, (U) => i("option", {
|
|
@@ -1455,13 +1456,13 @@ const ot = [
|
|
|
1455
1456
|
{ number: !0 }
|
|
1456
1457
|
]
|
|
1457
1458
|
]),
|
|
1458
|
-
|
|
1459
|
+
L[7] || (L[7] = i("span", null, "分", -1))
|
|
1459
1460
|
], 2),
|
|
1460
1461
|
i("div", {
|
|
1461
1462
|
class: u(s(l).e("time-item"))
|
|
1462
1463
|
}, [
|
|
1463
1464
|
ue(i("select", {
|
|
1464
|
-
"onUpdate:modelValue":
|
|
1465
|
+
"onUpdate:modelValue": L[5] || (L[5] = (U) => R.value.seconds = U),
|
|
1465
1466
|
class: u(s(l).e("time-select"))
|
|
1466
1467
|
}, [
|
|
1467
1468
|
(r(), d(G, null, Q(60, (U) => i("option", {
|
|
@@ -1476,7 +1477,7 @@ const ot = [
|
|
|
1476
1477
|
{ number: !0 }
|
|
1477
1478
|
]
|
|
1478
1479
|
]),
|
|
1479
|
-
|
|
1480
|
+
L[8] || (L[8] = i("span", null, "秒", -1))
|
|
1480
1481
|
], 2)
|
|
1481
1482
|
], 2)) : O("", !0),
|
|
1482
1483
|
n.showTime && n.type !== "daterange" ? (r(), d("div", {
|
|
@@ -1499,10 +1500,10 @@ const ot = [
|
|
|
1499
1500
|
], 2));
|
|
1500
1501
|
}
|
|
1501
1502
|
});
|
|
1502
|
-
function pe(n,
|
|
1503
|
+
function pe(n, y = "HH:mm:ss") {
|
|
1503
1504
|
if (!n) return "";
|
|
1504
1505
|
const t = n.getHours(), e = n.getMinutes(), a = n.getSeconds();
|
|
1505
|
-
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));
|
|
1506
1507
|
}
|
|
1507
1508
|
function Be(n) {
|
|
1508
1509
|
if (!n) return null;
|
|
@@ -1512,10 +1513,10 @@ function Be(n) {
|
|
|
1512
1513
|
const e = /* @__PURE__ */ new Date();
|
|
1513
1514
|
return e.setTime(n), e;
|
|
1514
1515
|
}
|
|
1515
|
-
const
|
|
1516
|
-
if (
|
|
1516
|
+
const y = n.match(/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?/);
|
|
1517
|
+
if (y) {
|
|
1517
1518
|
const e = /* @__PURE__ */ new Date();
|
|
1518
|
-
return e.setHours(parseInt(
|
|
1519
|
+
return e.setHours(parseInt(y[1]), parseInt(y[2]), y[3] ? parseInt(y[3]) : 0, 0), e;
|
|
1519
1520
|
}
|
|
1520
1521
|
const t = new Date(n);
|
|
1521
1522
|
return isNaN(t.getTime()) ? null : t;
|
|
@@ -1537,43 +1538,43 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1537
1538
|
secondStep: { default: 1 }
|
|
1538
1539
|
},
|
|
1539
1540
|
emits: ["confirm", "cancel"],
|
|
1540
|
-
setup(n, { emit:
|
|
1541
|
-
const t = n, e =
|
|
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(() => {
|
|
1542
1543
|
const H = [], te = Math.max(1, t.hourStep);
|
|
1543
1544
|
for (let N = 0; N < 24; N += te)
|
|
1544
1545
|
H.push(N);
|
|
1545
1546
|
return H;
|
|
1546
|
-
}), $ =
|
|
1547
|
+
}), $ = b(() => {
|
|
1547
1548
|
const H = [], te = Math.max(1, t.minuteStep);
|
|
1548
1549
|
for (let N = 0; N < 60; N += te)
|
|
1549
1550
|
H.push(N);
|
|
1550
1551
|
return H;
|
|
1551
|
-
}),
|
|
1552
|
+
}), P = b(() => {
|
|
1552
1553
|
const H = [], te = Math.max(1, t.secondStep);
|
|
1553
1554
|
for (let N = 0; N < 60; N += te)
|
|
1554
1555
|
H.push(N);
|
|
1555
1556
|
return H;
|
|
1556
|
-
}), v =
|
|
1557
|
-
|
|
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)));
|
|
1558
1559
|
}, W = (H) => {
|
|
1559
|
-
h(H) || (m.value = H, B(
|
|
1560
|
+
h(H) || (m.value = H, B(w.value, ee(H)));
|
|
1560
1561
|
}, X = (H) => {
|
|
1561
|
-
f(H) || (p.value = H, B(
|
|
1562
|
-
}, Z = (H) => V.value.indexOf(H), ee = (H) => $.value.indexOf(H), T = (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) => {
|
|
1563
1564
|
if (!H) return;
|
|
1564
1565
|
const N = 32, ye = te * N + 84 - 200 / 2 + N / 2;
|
|
1565
1566
|
H.scrollTop = Math.max(0, ye);
|
|
1566
|
-
},
|
|
1567
|
+
}, x = () => {
|
|
1567
1568
|
if (!C.value) return;
|
|
1568
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))];
|
|
1569
|
-
N !== void 0 && !
|
|
1570
|
+
N !== void 0 && !A(N) && (l.value = N);
|
|
1570
1571
|
}, o = () => {
|
|
1571
|
-
if (!
|
|
1572
|
-
const H =
|
|
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))];
|
|
1573
1574
|
N !== void 0 && !h(N) && (m.value = N);
|
|
1574
1575
|
}, c = () => {
|
|
1575
|
-
if (!
|
|
1576
|
-
const H =
|
|
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))];
|
|
1577
1578
|
N !== void 0 && !f(N) && (p.value = N);
|
|
1578
1579
|
}, g = () => {
|
|
1579
1580
|
const H = t.modelValue ? new Date(t.modelValue) : /* @__PURE__ */ new Date();
|
|
@@ -1588,7 +1589,7 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1588
1589
|
l.value = H.getHours(), m.value = H.getMinutes(), p.value = H.getSeconds();
|
|
1589
1590
|
}
|
|
1590
1591
|
Se(() => {
|
|
1591
|
-
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));
|
|
1592
1593
|
});
|
|
1593
1594
|
};
|
|
1594
1595
|
return ce(
|
|
@@ -1612,14 +1613,14 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1612
1613
|
ref_key: "hourListRef",
|
|
1613
1614
|
ref: C,
|
|
1614
1615
|
class: u(s(a).e("list")),
|
|
1615
|
-
onScroll:
|
|
1616
|
+
onScroll: x
|
|
1616
1617
|
}, [
|
|
1617
1618
|
i("div", {
|
|
1618
1619
|
class: u(s(a).e("padding"))
|
|
1619
1620
|
}, null, 2),
|
|
1620
1621
|
(r(!0), d(G, null, Q(V.value, (N) => (r(), d("div", {
|
|
1621
1622
|
key: N,
|
|
1622
|
-
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))]),
|
|
1623
1624
|
onClick: (ve) => k(N)
|
|
1624
1625
|
}, z(s(he)(N)), 11, xt))), 128)),
|
|
1625
1626
|
i("div", {
|
|
@@ -1628,7 +1629,7 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1628
1629
|
], 34),
|
|
1629
1630
|
i("div", {
|
|
1630
1631
|
ref_key: "minuteListRef",
|
|
1631
|
-
ref:
|
|
1632
|
+
ref: w,
|
|
1632
1633
|
class: u(s(a).e("list")),
|
|
1633
1634
|
onScroll: o
|
|
1634
1635
|
}, [
|
|
@@ -1647,14 +1648,14 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1647
1648
|
S.value ? (r(), d("div", {
|
|
1648
1649
|
key: 0,
|
|
1649
1650
|
ref_key: "secondListRef",
|
|
1650
|
-
ref:
|
|
1651
|
+
ref: F,
|
|
1651
1652
|
class: u(s(a).e("list")),
|
|
1652
1653
|
onScroll: c
|
|
1653
1654
|
}, [
|
|
1654
1655
|
i("div", {
|
|
1655
1656
|
class: u(s(a).e("padding"))
|
|
1656
1657
|
}, null, 2),
|
|
1657
|
-
(r(!0), d(G, null, Q(
|
|
1658
|
+
(r(!0), d(G, null, Q(P.value, (N) => (r(), d("div", {
|
|
1658
1659
|
key: N,
|
|
1659
1660
|
class: u([s(a).e("item"), s(a).is("selected", p.value === N), s(a).is("disabled", f(N))]),
|
|
1660
1661
|
onClick: (ve) => X(N)
|
|
@@ -1708,44 +1709,44 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1708
1709
|
secondStep: { default: 1 }
|
|
1709
1710
|
},
|
|
1710
1711
|
emits: ["update:modelValue", "change", "focus", "blur", "clear"],
|
|
1711
|
-
setup(n, { expose:
|
|
1712
|
-
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({
|
|
1713
1714
|
top: "0px",
|
|
1714
1715
|
left: "0px"
|
|
1715
1716
|
}), $ = E({
|
|
1716
1717
|
startTime: null,
|
|
1717
1718
|
endTime: null
|
|
1718
|
-
}),
|
|
1719
|
+
}), P = E("start"), v = b(() => {
|
|
1719
1720
|
if (!e.modelValue) return null;
|
|
1720
1721
|
if (e.type === "timerange") {
|
|
1721
1722
|
const [c, g] = e.modelValue;
|
|
1722
1723
|
return [Be(c), Be(g)];
|
|
1723
1724
|
}
|
|
1724
1725
|
return Be(e.modelValue);
|
|
1725
|
-
}), D =
|
|
1726
|
+
}), D = b(() => !v.value || Array.isArray(v.value) ? "" : pe(v.value, e.format)), R = b(() => {
|
|
1726
1727
|
if (!Array.isArray(v.value)) return "";
|
|
1727
1728
|
const [c] = v.value;
|
|
1728
1729
|
return c ? pe(c, e.format) : "";
|
|
1729
|
-
}), M =
|
|
1730
|
+
}), M = b(() => {
|
|
1730
1731
|
if (!Array.isArray(v.value)) return "";
|
|
1731
1732
|
const [, c] = v.value;
|
|
1732
1733
|
return c ? pe(c, e.format) : "";
|
|
1733
|
-
}),
|
|
1734
|
+
}), A = b(() => e.type === "timerange" ? P.value === "start" ? $.value.startTime : $.value.endTime || $.value.startTime : v.value), h = b(() => [
|
|
1734
1735
|
l.b(),
|
|
1735
1736
|
l.m(e.size),
|
|
1736
1737
|
l.is("disabled", e.disabled),
|
|
1737
1738
|
l.is("range", e.type === "timerange")
|
|
1738
|
-
]), f =
|
|
1739
|
+
]), f = b(() => [
|
|
1739
1740
|
l.e("input"),
|
|
1740
1741
|
l.is("focus", p.value)
|
|
1741
1742
|
]), k = () => {
|
|
1742
1743
|
e.disabled || e.readonly || (p.value ? Z() : X());
|
|
1743
1744
|
}, W = (c) => {
|
|
1744
|
-
e.disabled || e.readonly || (
|
|
1745
|
+
e.disabled || e.readonly || (P.value = c, p.value || X());
|
|
1745
1746
|
}, X = () => {
|
|
1746
1747
|
p.value = !0, C.value = m(), Se(() => {
|
|
1747
|
-
if (
|
|
1748
|
-
const c =
|
|
1748
|
+
if (w.value && F.value) {
|
|
1749
|
+
const c = w.value.getBoundingClientRect(), g = F.value.getBoundingClientRect();
|
|
1749
1750
|
let K = c.bottom + 8, le = c.left;
|
|
1750
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 = {
|
|
1751
1752
|
top: `${K}px`,
|
|
@@ -1757,8 +1758,8 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1757
1758
|
p.value = !1, a("blur", {});
|
|
1758
1759
|
}, ee = (c) => {
|
|
1759
1760
|
if (e.type === "timerange")
|
|
1760
|
-
if (
|
|
1761
|
-
$.value.startTime = c,
|
|
1761
|
+
if (P.value === "start")
|
|
1762
|
+
$.value.startTime = c, P.value = "end", $.value.endTime && $.value.endTime < c && ($.value.endTime = null);
|
|
1762
1763
|
else {
|
|
1763
1764
|
$.value.startTime && c < $.value.startTime ? ($.value.endTime = $.value.startTime, $.value.startTime = c) : $.value.endTime = c;
|
|
1764
1765
|
const g = e.valueFormat ? pe($.value.startTime, e.valueFormat) : $.value.startTime, K = e.valueFormat ? pe($.value.endTime, e.valueFormat) : $.value.endTime;
|
|
@@ -1775,10 +1776,10 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1775
1776
|
startTime: null,
|
|
1776
1777
|
endTime: null
|
|
1777
1778
|
};
|
|
1778
|
-
},
|
|
1779
|
-
if (!
|
|
1779
|
+
}, x = (c) => {
|
|
1780
|
+
if (!w.value) return;
|
|
1780
1781
|
const g = c.target;
|
|
1781
|
-
|
|
1782
|
+
w.value.contains(g) || F.value && F.value.contains(g) || Z();
|
|
1782
1783
|
};
|
|
1783
1784
|
ce(
|
|
1784
1785
|
() => e.modelValue,
|
|
@@ -1796,16 +1797,16 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1796
1797
|
c && e.type === "timerange" && ($.value = {
|
|
1797
1798
|
startTime: Array.isArray(v.value) ? v.value[0] : null,
|
|
1798
1799
|
endTime: Array.isArray(v.value) ? v.value[1] : null
|
|
1799
|
-
},
|
|
1800
|
+
}, P.value = "start");
|
|
1800
1801
|
});
|
|
1801
1802
|
const o = (c) => {
|
|
1802
1803
|
c.key === "Escape" && Z();
|
|
1803
1804
|
};
|
|
1804
1805
|
return xe(() => {
|
|
1805
|
-
document.addEventListener("click",
|
|
1806
|
+
document.addEventListener("click", x), document.addEventListener("keydown", o);
|
|
1806
1807
|
}), we(() => {
|
|
1807
|
-
document.removeEventListener("click",
|
|
1808
|
-
}),
|
|
1808
|
+
document.removeEventListener("click", x), document.removeEventListener("keydown", o);
|
|
1809
|
+
}), y({
|
|
1809
1810
|
focus: () => {
|
|
1810
1811
|
var c;
|
|
1811
1812
|
return (c = S.value) == null ? void 0 : c.focus();
|
|
@@ -1816,7 +1817,7 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1816
1817
|
}
|
|
1817
1818
|
}), (c, g) => (r(), d("div", {
|
|
1818
1819
|
ref_key: "pickerRef",
|
|
1819
|
-
ref:
|
|
1820
|
+
ref: w,
|
|
1820
1821
|
class: u(h.value)
|
|
1821
1822
|
}, [
|
|
1822
1823
|
n.type !== "timerange" ? (r(), d("div", {
|
|
@@ -1857,7 +1858,7 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1857
1858
|
disabled: n.disabled,
|
|
1858
1859
|
readonly: !0,
|
|
1859
1860
|
value: R.value,
|
|
1860
|
-
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")]),
|
|
1861
1862
|
onClick: g[0] || (g[0] = oe((K) => W("start"), ["stop"]))
|
|
1862
1863
|
}, null, 10, $t),
|
|
1863
1864
|
i("span", {
|
|
@@ -1869,7 +1870,7 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1869
1870
|
disabled: n.disabled,
|
|
1870
1871
|
readonly: !0,
|
|
1871
1872
|
value: M.value,
|
|
1872
|
-
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")]),
|
|
1873
1874
|
onClick: g[1] || (g[1] = oe((K) => W("end"), ["stop"]))
|
|
1874
1875
|
}, null, 10, St),
|
|
1875
1876
|
i("span", {
|
|
@@ -1890,16 +1891,16 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1890
1891
|
default: Pe(() => [
|
|
1891
1892
|
ue(i("div", {
|
|
1892
1893
|
ref_key: "popperRef",
|
|
1893
|
-
ref:
|
|
1894
|
+
ref: F,
|
|
1894
1895
|
class: u(s(l).e("popper")),
|
|
1895
1896
|
style: ne({ zIndex: C.value, ...V.value })
|
|
1896
1897
|
}, [
|
|
1897
1898
|
n.type === "timerange" ? (r(), d("div", {
|
|
1898
1899
|
key: 0,
|
|
1899
1900
|
class: u(s(l).e("popper-header"))
|
|
1900
|
-
}, z(
|
|
1901
|
+
}, z(P.value === "start" ? "请选择开始时间" : "请选择结束时间"), 3)) : O("", !0),
|
|
1901
1902
|
Ce(Ct, {
|
|
1902
|
-
"model-value":
|
|
1903
|
+
"model-value": A.value,
|
|
1903
1904
|
format: n.format,
|
|
1904
1905
|
"disabled-hours": n.disabledHours,
|
|
1905
1906
|
"disabled-minutes": n.disabledMinutes,
|
|
@@ -1920,25 +1921,25 @@ const xt = ["onClick"], wt = ["onClick"], Vt = ["onClick"], Ct = /* @__PURE__ */
|
|
|
1920
1921
|
], 2));
|
|
1921
1922
|
}
|
|
1922
1923
|
});
|
|
1923
|
-
function Mt(n,
|
|
1924
|
-
return t ? t(
|
|
1924
|
+
function Mt(n, y, t) {
|
|
1925
|
+
return t ? t(y, n) : n.toLowerCase().includes(y.toLowerCase());
|
|
1925
1926
|
}
|
|
1926
|
-
function Oe(n,
|
|
1927
|
+
function Oe(n, y, t = "value", e = "children") {
|
|
1927
1928
|
for (const a of n) {
|
|
1928
|
-
if (a[t] ===
|
|
1929
|
+
if (a[t] === y)
|
|
1929
1930
|
return a;
|
|
1930
1931
|
if (a[e] && a[e].length > 0) {
|
|
1931
|
-
const l = Oe(a[e],
|
|
1932
|
+
const l = Oe(a[e], y, t, e);
|
|
1932
1933
|
if (l) return l;
|
|
1933
1934
|
}
|
|
1934
1935
|
}
|
|
1935
1936
|
return null;
|
|
1936
1937
|
}
|
|
1937
|
-
function Fe(n,
|
|
1938
|
+
function Fe(n, y, t = "value", e = "children") {
|
|
1938
1939
|
const a = [];
|
|
1939
1940
|
function l(m) {
|
|
1940
1941
|
for (const p of m) {
|
|
1941
|
-
if (p[t] ===
|
|
1942
|
+
if (p[t] === y)
|
|
1942
1943
|
return a.push(p), !0;
|
|
1943
1944
|
if (p[e] && p[e].length > 0) {
|
|
1944
1945
|
if (a.push(p), l(p[e]))
|
|
@@ -1950,11 +1951,11 @@ function Fe(n, b, t = "value", e = "children") {
|
|
|
1950
1951
|
}
|
|
1951
1952
|
return l(n), a;
|
|
1952
1953
|
}
|
|
1953
|
-
function Tt(n,
|
|
1954
|
+
function Tt(n, y = "children") {
|
|
1954
1955
|
const t = [];
|
|
1955
1956
|
function e(a, l = 0, m = null) {
|
|
1956
1957
|
for (const p of a)
|
|
1957
|
-
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);
|
|
1958
1959
|
}
|
|
1959
1960
|
return e(n), t;
|
|
1960
1961
|
}
|
|
@@ -1983,55 +1984,55 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
1983
1984
|
noMatchText: { default: "无匹配数据" }
|
|
1984
1985
|
},
|
|
1985
1986
|
emits: ["update:modelValue", "update:value", "change", "clear", "focus", "blur", "visible-change", "remove-tag"],
|
|
1986
|
-
setup(n, { emit:
|
|
1987
|
-
const t = n, e =
|
|
1988
|
-
t.modelValue !== void 0 && e("update:modelValue",
|
|
1989
|
-
},
|
|
1990
|
-
const
|
|
1991
|
-
return
|
|
1992
|
-
}), h =
|
|
1993
|
-
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] || "";
|
|
1994
1995
|
return Mt(q, S.value, t.filterMethod);
|
|
1995
|
-
})), k =
|
|
1996
|
-
const
|
|
1997
|
-
for (const q of
|
|
1996
|
+
})), k = b(() => {
|
|
1997
|
+
const Y = [];
|
|
1998
|
+
for (const q of A.value) {
|
|
1998
1999
|
const j = Oe(t.options, q, t.valueKey, t.childrenKey);
|
|
1999
|
-
j &&
|
|
2000
|
+
j && Y.push(j);
|
|
2000
2001
|
}
|
|
2001
|
-
return
|
|
2002
|
-
}), W =
|
|
2003
|
-
if (
|
|
2002
|
+
return Y;
|
|
2003
|
+
}), W = b(() => {
|
|
2004
|
+
if (P.value)
|
|
2004
2005
|
return "";
|
|
2005
2006
|
if (v.value)
|
|
2006
|
-
return Fe(t.options,
|
|
2007
|
-
const
|
|
2008
|
-
return
|
|
2009
|
-
}), 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(() => [
|
|
2010
2011
|
a.b(),
|
|
2011
2012
|
a.m(t.size),
|
|
2012
2013
|
a.is("disabled", t.disabled),
|
|
2013
|
-
a.is("multiple",
|
|
2014
|
+
a.is("multiple", P.value),
|
|
2014
2015
|
a.is("cascader", v.value),
|
|
2015
2016
|
a.is("filterable", t.filterable),
|
|
2016
|
-
a.is("focus",
|
|
2017
|
+
a.is("focus", w.value)
|
|
2017
2018
|
]), B = () => {
|
|
2018
|
-
if (!m.value || !C.value || !
|
|
2019
|
-
const
|
|
2020
|
-
let j =
|
|
2021
|
-
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 = {
|
|
2022
2023
|
top: `${j}px`,
|
|
2023
2024
|
left: `${se}px`
|
|
2024
2025
|
};
|
|
2025
|
-
},
|
|
2026
|
-
t.disabled || (
|
|
2026
|
+
}, x = () => {
|
|
2027
|
+
t.disabled || (w.value = !0, F.value = l(), S.value = "", Se(() => {
|
|
2027
2028
|
B();
|
|
2028
2029
|
}), e("visible-change", !0), e("focus", {}));
|
|
2029
2030
|
}, o = () => {
|
|
2030
|
-
|
|
2031
|
-
}, c = (
|
|
2032
|
-
if (!
|
|
2033
|
-
if (
|
|
2034
|
-
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);
|
|
2035
2036
|
if (se > -1)
|
|
2036
2037
|
q.splice(se, 1), e("remove-tag", j);
|
|
2037
2038
|
else {
|
|
@@ -2041,67 +2042,67 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2041
2042
|
}
|
|
2042
2043
|
M(q);
|
|
2043
2044
|
} else if (v.value)
|
|
2044
|
-
if (
|
|
2045
|
-
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);
|
|
2046
2047
|
D.value = q;
|
|
2047
2048
|
} else {
|
|
2048
|
-
const j = Fe(t.options,
|
|
2049
|
+
const j = Fe(t.options, Y[t.valueKey], t.valueKey, t.childrenKey).map((se) => se[t.valueKey]);
|
|
2049
2050
|
M(j), o();
|
|
2050
2051
|
}
|
|
2051
2052
|
else
|
|
2052
|
-
M(
|
|
2053
|
-
}, g = (
|
|
2054
|
-
const q =
|
|
2055
|
-
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]);
|
|
2056
2057
|
}, K = () => {
|
|
2057
|
-
const
|
|
2058
|
-
M(
|
|
2059
|
-
}, le = (
|
|
2060
|
-
S.value =
|
|
2061
|
-
}, H = (
|
|
2058
|
+
const Y = P.value ? [] : "";
|
|
2059
|
+
M(Y), e("clear");
|
|
2060
|
+
}, le = (Y) => {
|
|
2061
|
+
S.value = Y.target.value;
|
|
2062
|
+
}, H = (Y) => {
|
|
2062
2063
|
if (!m.value) return;
|
|
2063
|
-
const q =
|
|
2064
|
+
const q = Y.target;
|
|
2064
2065
|
m.value.contains(q) || C.value && C.value.contains(q) || o();
|
|
2065
|
-
}, te = (
|
|
2066
|
-
if (
|
|
2066
|
+
}, te = (Y) => {
|
|
2067
|
+
if (Y.key === "Escape")
|
|
2067
2068
|
o();
|
|
2068
|
-
else if (
|
|
2069
|
+
else if (Y.key === "Enter" && w.value) {
|
|
2069
2070
|
const q = f.value[V.value];
|
|
2070
2071
|
q && c(q);
|
|
2071
|
-
} else
|
|
2072
|
-
}, 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) => [
|
|
2073
2074
|
a.e("option"),
|
|
2074
|
-
a.is("selected", N(
|
|
2075
|
-
a.is("disabled",
|
|
2075
|
+
a.is("selected", N(Y)),
|
|
2076
|
+
a.is("disabled", Y.disabled === !0),
|
|
2076
2077
|
a.is("hover", V.value === q),
|
|
2077
|
-
a.is("group", !!(
|
|
2078
|
-
], ye =
|
|
2078
|
+
a.is("group", !!(Y.children && Y.children.length > 0))
|
|
2079
|
+
], ye = b(() => {
|
|
2079
2080
|
if (!v.value) return [];
|
|
2080
|
-
const
|
|
2081
|
+
const Y = [t.options];
|
|
2081
2082
|
for (const q of D.value)
|
|
2082
|
-
q.children && q.children.length > 0 &&
|
|
2083
|
-
return
|
|
2083
|
+
q.children && q.children.length > 0 && Y.push(q.children);
|
|
2084
|
+
return Y;
|
|
2084
2085
|
});
|
|
2085
2086
|
return xe(() => {
|
|
2086
2087
|
document.addEventListener("click", H), document.addEventListener("keydown", te);
|
|
2087
2088
|
}), we(() => {
|
|
2088
2089
|
document.removeEventListener("click", H), document.removeEventListener("keydown", te), document.removeEventListener("scroll", B, !0);
|
|
2089
|
-
}), ce(
|
|
2090
|
-
|
|
2090
|
+
}), ce(w, (Y) => {
|
|
2091
|
+
Y ? document.addEventListener("scroll", B, !0) : document.removeEventListener("scroll", B, !0);
|
|
2091
2092
|
}), $e("select", {
|
|
2092
|
-
selectedValues:
|
|
2093
|
+
selectedValues: A,
|
|
2093
2094
|
handleSelect: c,
|
|
2094
2095
|
isSelected: N
|
|
2095
|
-
}), (
|
|
2096
|
+
}), (Y, q) => (r(), d("div", {
|
|
2096
2097
|
ref_key: "selectRef",
|
|
2097
2098
|
ref: m,
|
|
2098
2099
|
class: u(T.value)
|
|
2099
2100
|
}, [
|
|
2100
2101
|
i("div", {
|
|
2101
2102
|
class: u(s(a).e("wrapper")),
|
|
2102
|
-
onClick: q[0] || (q[0] = (j) =>
|
|
2103
|
+
onClick: q[0] || (q[0] = (j) => w.value ? o() : x())
|
|
2103
2104
|
}, [
|
|
2104
|
-
|
|
2105
|
+
P.value && X.value.length > 0 ? (r(), d("div", {
|
|
2105
2106
|
key: 0,
|
|
2106
2107
|
class: u(s(a).e("tags"))
|
|
2107
2108
|
}, [
|
|
@@ -2126,22 +2127,22 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2126
2127
|
ref_key: "inputRef",
|
|
2127
2128
|
ref: p,
|
|
2128
2129
|
class: u(s(a).e("input")),
|
|
2129
|
-
placeholder:
|
|
2130
|
+
placeholder: P.value && X.value.length > 0 ? "" : n.placeholder,
|
|
2130
2131
|
disabled: n.disabled,
|
|
2131
|
-
readonly: !n.filterable || !
|
|
2132
|
-
value: n.filterable &&
|
|
2132
|
+
readonly: !n.filterable || !w.value,
|
|
2133
|
+
value: n.filterable && w.value ? S.value : W.value,
|
|
2133
2134
|
onInput: le
|
|
2134
2135
|
}, null, 42, Bt),
|
|
2135
2136
|
i("span", {
|
|
2136
2137
|
class: u(s(a).e("suffix"))
|
|
2137
2138
|
}, [
|
|
2138
|
-
n.clearable &&
|
|
2139
|
+
n.clearable && A.value.length > 0 && !n.disabled ? (r(), d("span", {
|
|
2139
2140
|
key: 0,
|
|
2140
2141
|
class: u(s(a).e("clear")),
|
|
2141
2142
|
onClick: oe(K, ["stop"])
|
|
2142
2143
|
}, "×", 2)) : (r(), d("span", {
|
|
2143
2144
|
key: 1,
|
|
2144
|
-
class: u([s(a).e("arrow"), s(a).is("reverse",
|
|
2145
|
+
class: u([s(a).e("arrow"), s(a).is("reverse", w.value)])
|
|
2145
2146
|
}, "▼", 2))
|
|
2146
2147
|
], 2)
|
|
2147
2148
|
], 2),
|
|
@@ -2152,7 +2153,7 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2152
2153
|
ref_key: "popperRef",
|
|
2153
2154
|
ref: C,
|
|
2154
2155
|
class: u([s(a).e("popper"), s(a).is("cascader", v.value)]),
|
|
2155
|
-
style: ne({ zIndex:
|
|
2156
|
+
style: ne({ zIndex: F.value, ...$.value })
|
|
2156
2157
|
}, [
|
|
2157
2158
|
v.value ? (r(), d("div", {
|
|
2158
2159
|
key: 0,
|
|
@@ -2200,7 +2201,7 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2200
2201
|
], 2))
|
|
2201
2202
|
], 64))
|
|
2202
2203
|
], 6), [
|
|
2203
|
-
[Ae,
|
|
2204
|
+
[Ae, w.value]
|
|
2204
2205
|
])
|
|
2205
2206
|
]),
|
|
2206
2207
|
_: 1
|
|
@@ -2225,27 +2226,27 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2225
2226
|
rightDefaultChecked: { default: () => [] }
|
|
2226
2227
|
},
|
|
2227
2228
|
emits: ["update:modelValue", "change", "left-check-change", "right-check-change"],
|
|
2228
|
-
setup(n, { expose:
|
|
2229
|
-
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(() => {
|
|
2230
2231
|
var o;
|
|
2231
2232
|
return ((o = e.props) == null ? void 0 : o.key) || "key";
|
|
2232
|
-
}), p =
|
|
2233
|
+
}), p = b(() => {
|
|
2233
2234
|
var o;
|
|
2234
2235
|
return ((o = e.props) == null ? void 0 : o.label) || "label";
|
|
2235
|
-
}), C =
|
|
2236
|
+
}), C = b(() => {
|
|
2236
2237
|
var o;
|
|
2237
2238
|
return ((o = e.props) == null ? void 0 : o.disabled) || "disabled";
|
|
2238
|
-
}),
|
|
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) => {
|
|
2239
2240
|
const c = $(o);
|
|
2240
|
-
return e.modelValue.includes(c) ? !1 : e.filterable &&
|
|
2241
|
-
})), 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(() => {
|
|
2242
2243
|
const o = e.modelValue;
|
|
2243
2244
|
let c = e.data.filter((g) => {
|
|
2244
2245
|
const K = $(g);
|
|
2245
2246
|
return o.includes(K);
|
|
2246
2247
|
});
|
|
2247
|
-
return e.filterable &&
|
|
2248
|
-
}), 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 = () => {
|
|
2249
2250
|
const o = S.value.filter((g) => {
|
|
2250
2251
|
const K = e.data.find((le) => $(le) === g);
|
|
2251
2252
|
return K && !v(K);
|
|
@@ -2269,12 +2270,12 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2269
2270
|
}, T = () => {
|
|
2270
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]);
|
|
2271
2272
|
}, B = (o) => {
|
|
2272
|
-
o === "left" ?
|
|
2273
|
-
},
|
|
2274
|
-
return
|
|
2273
|
+
o === "left" ? w.value = "" : F.value = "";
|
|
2274
|
+
}, x = b(() => [l.b()]);
|
|
2275
|
+
return y({
|
|
2275
2276
|
clearQuery: B
|
|
2276
2277
|
}), (o, c) => (r(), d("div", {
|
|
2277
|
-
class: u(
|
|
2278
|
+
class: u(x.value)
|
|
2278
2279
|
}, [
|
|
2279
2280
|
i("div", {
|
|
2280
2281
|
class: u(s(l).e("panel"))
|
|
@@ -2302,13 +2303,13 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2302
2303
|
class: u(s(l).e("filter"))
|
|
2303
2304
|
}, [
|
|
2304
2305
|
ue(i("input", {
|
|
2305
|
-
"onUpdate:modelValue": c[0] || (c[0] = (g) =>
|
|
2306
|
+
"onUpdate:modelValue": c[0] || (c[0] = (g) => w.value = g),
|
|
2306
2307
|
placeholder: n.filterPlaceholder,
|
|
2307
2308
|
class: u(s(l).e("filter-input"))
|
|
2308
2309
|
}, null, 10, Pt), [
|
|
2309
|
-
[be,
|
|
2310
|
+
[be, w.value]
|
|
2310
2311
|
]),
|
|
2311
|
-
|
|
2312
|
+
w.value ? (r(), d("span", {
|
|
2312
2313
|
key: 0,
|
|
2313
2314
|
class: u(s(l).e("filter-clear")),
|
|
2314
2315
|
onClick: c[1] || (c[1] = (g) => B("left"))
|
|
@@ -2337,7 +2338,7 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2337
2338
|
}, ["stop"])),
|
|
2338
2339
|
onChange: (K) => X($(g))
|
|
2339
2340
|
}, null, 40, Yt),
|
|
2340
|
-
i("span", null, z(
|
|
2341
|
+
i("span", null, z(P(g)), 1)
|
|
2341
2342
|
], 2)
|
|
2342
2343
|
], 10, At))), 128)),
|
|
2343
2344
|
D.value.length === 0 ? (r(), d("div", {
|
|
@@ -2390,13 +2391,13 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2390
2391
|
class: u(s(l).e("filter"))
|
|
2391
2392
|
}, [
|
|
2392
2393
|
ue(i("input", {
|
|
2393
|
-
"onUpdate:modelValue": c[3] || (c[3] = (g) =>
|
|
2394
|
+
"onUpdate:modelValue": c[3] || (c[3] = (g) => F.value = g),
|
|
2394
2395
|
placeholder: n.filterPlaceholder,
|
|
2395
2396
|
class: u(s(l).e("filter-input"))
|
|
2396
2397
|
}, null, 10, Ot), [
|
|
2397
|
-
[be,
|
|
2398
|
+
[be, F.value]
|
|
2398
2399
|
]),
|
|
2399
|
-
|
|
2400
|
+
F.value ? (r(), d("span", {
|
|
2400
2401
|
key: 0,
|
|
2401
2402
|
class: u(s(l).e("filter-clear")),
|
|
2402
2403
|
onClick: c[4] || (c[4] = (g) => B("right"))
|
|
@@ -2425,7 +2426,7 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2425
2426
|
}, ["stop"])),
|
|
2426
2427
|
onChange: (K) => Z($(g))
|
|
2427
2428
|
}, null, 40, Ut),
|
|
2428
|
-
i("span", null, z(
|
|
2429
|
+
i("span", null, z(P(g)), 1)
|
|
2429
2430
|
], 2)
|
|
2430
2431
|
], 10, Nt))), 128)),
|
|
2431
2432
|
R.value.length === 0 ? (r(), d("div", {
|
|
@@ -2457,52 +2458,52 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2457
2458
|
marks: {}
|
|
2458
2459
|
},
|
|
2459
2460
|
emits: ["update:modelValue", "change", "input"],
|
|
2460
|
-
setup(n, { emit:
|
|
2461
|
-
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(() => {
|
|
2462
2463
|
const B = t.max - t.min;
|
|
2463
2464
|
return (t.modelValue - t.min) / B * 100;
|
|
2464
|
-
}),
|
|
2465
|
+
}), F = b(() => t.formatTooltip ? t.formatTooltip(t.modelValue) : t.modelValue), S = b(() => {
|
|
2465
2466
|
if (!t.showStops || t.min >= t.max) return [];
|
|
2466
|
-
const B = [],
|
|
2467
|
-
for (let o = 0; o <=
|
|
2467
|
+
const B = [], x = (t.max - t.min) / t.step;
|
|
2468
|
+
for (let o = 0; o <= x; o++) {
|
|
2468
2469
|
const c = t.min + o * t.step;
|
|
2469
2470
|
c > t.min && c < t.max && B.push((c - t.min) / (t.max - t.min) * 100);
|
|
2470
2471
|
}
|
|
2471
2472
|
return B;
|
|
2472
|
-
}), V =
|
|
2473
|
-
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;
|
|
2474
2475
|
let g, K = {};
|
|
2475
|
-
return typeof o == "string" ? g = o : (g = o.label || String(
|
|
2476
|
-
}) : []), $ = () => 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) => {
|
|
2477
2478
|
if (!l.value) return t.modelValue;
|
|
2478
2479
|
const o = l.value.getBoundingClientRect(), c = $();
|
|
2479
2480
|
let g;
|
|
2480
|
-
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));
|
|
2481
2482
|
const K = t.min + g / 100 * (t.max - t.min), le = Math.round(K / t.step) * t.step;
|
|
2482
2483
|
return Math.max(t.min, Math.min(t.max, le));
|
|
2483
2484
|
}, v = (B) => {
|
|
2484
2485
|
if (t.disabled) return;
|
|
2485
|
-
const
|
|
2486
|
-
|
|
2486
|
+
const x = Math.max(t.min, Math.min(t.max, B));
|
|
2487
|
+
x !== t.modelValue && (e("update:modelValue", x), e("input", x));
|
|
2487
2488
|
}, D = (B) => {
|
|
2488
2489
|
if (t.disabled) return;
|
|
2489
2490
|
B.preventDefault(), C.value = !0, p.value = !0;
|
|
2490
|
-
const
|
|
2491
|
-
v(
|
|
2491
|
+
const x = P(B.clientX, B.clientY);
|
|
2492
|
+
v(x), document.addEventListener("mousemove", R), document.addEventListener("mouseup", M);
|
|
2492
2493
|
}, R = (B) => {
|
|
2493
2494
|
if (!C.value) return;
|
|
2494
|
-
const
|
|
2495
|
-
v(
|
|
2495
|
+
const x = P(B.clientX, B.clientY);
|
|
2496
|
+
v(x);
|
|
2496
2497
|
}, M = () => {
|
|
2497
2498
|
C.value = !1, e("change", t.modelValue), document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", M);
|
|
2498
|
-
},
|
|
2499
|
+
}, A = (B) => {
|
|
2499
2500
|
if (t.disabled) return;
|
|
2500
2501
|
B.preventDefault(), C.value = !0, p.value = !0;
|
|
2501
|
-
const
|
|
2502
|
+
const x = B.touches[0], o = P(x.clientX, x.clientY);
|
|
2502
2503
|
v(o);
|
|
2503
2504
|
}, h = (B) => {
|
|
2504
2505
|
if (!C.value) return;
|
|
2505
|
-
const
|
|
2506
|
+
const x = B.touches[0], o = P(x.clientX, x.clientY);
|
|
2506
2507
|
v(o);
|
|
2507
2508
|
}, f = () => {
|
|
2508
2509
|
C.value = !1, e("change", t.modelValue);
|
|
@@ -2514,12 +2515,12 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2514
2515
|
we(() => {
|
|
2515
2516
|
document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", M);
|
|
2516
2517
|
});
|
|
2517
|
-
const X =
|
|
2518
|
+
const X = b(() => [
|
|
2518
2519
|
a.b(),
|
|
2519
2520
|
a.is("disabled", t.disabled),
|
|
2520
2521
|
a.is("vertical", t.vertical)
|
|
2521
|
-
]), Z =
|
|
2522
|
-
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", {
|
|
2523
2524
|
class: u(X.value),
|
|
2524
2525
|
style: ne(Z.value)
|
|
2525
2526
|
}, [
|
|
@@ -2528,7 +2529,7 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2528
2529
|
ref: l,
|
|
2529
2530
|
class: u(s(a).e("runway")),
|
|
2530
2531
|
onMousedown: D,
|
|
2531
|
-
onTouchstart:
|
|
2532
|
+
onTouchstart: A
|
|
2532
2533
|
}, [
|
|
2533
2534
|
i("div", {
|
|
2534
2535
|
class: u(s(a).e("bar")),
|
|
@@ -2565,7 +2566,7 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2565
2566
|
n.showTooltip && p.value ? (r(), d("div", {
|
|
2566
2567
|
key: 0,
|
|
2567
2568
|
class: u(s(a).e("tooltip"))
|
|
2568
|
-
}, z(
|
|
2569
|
+
}, z(F.value), 3)) : O("", !0),
|
|
2569
2570
|
i("div", {
|
|
2570
2571
|
class: u(s(a).e("button"))
|
|
2571
2572
|
}, null, 2)
|
|
@@ -2617,14 +2618,14 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2617
2618
|
onExceed: {}
|
|
2618
2619
|
},
|
|
2619
2620
|
emits: ["update:fileList", "success", "error", "progress", "change", "remove", "exceed"],
|
|
2620
|
-
setup(n, { expose:
|
|
2621
|
+
setup(n, { expose: y, emit: t }) {
|
|
2621
2622
|
const e = n, a = t, l = _("upload");
|
|
2622
2623
|
He();
|
|
2623
2624
|
const m = E(), p = E([...e.fileList]), C = E(!1);
|
|
2624
|
-
let
|
|
2625
|
-
const
|
|
2625
|
+
let w = 1;
|
|
2626
|
+
const F = () => Date.now() + w++, S = (T) => {
|
|
2626
2627
|
var o;
|
|
2627
|
-
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 = {
|
|
2628
2629
|
pdf: "📄",
|
|
2629
2630
|
doc: "📝",
|
|
2630
2631
|
docx: "📝",
|
|
@@ -2638,17 +2639,17 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2638
2639
|
mp4: "🎬",
|
|
2639
2640
|
default: "📁"
|
|
2640
2641
|
};
|
|
2641
|
-
return
|
|
2642
|
-
}, V =
|
|
2642
|
+
return x[B || ""] || x.default;
|
|
2643
|
+
}, V = b(() => e.limit ? p.value.length < e.limit : !0), $ = b(() => [
|
|
2643
2644
|
l.b(),
|
|
2644
2645
|
l.is("disabled", e.disabled),
|
|
2645
2646
|
l.is("drag", e.drag),
|
|
2646
2647
|
l.m(e.listType)
|
|
2647
|
-
]),
|
|
2648
|
+
]), P = (T) => {
|
|
2648
2649
|
const B = T.target.files;
|
|
2649
2650
|
!B || B.length === 0 || (v(Array.from(B)), m.value && (m.value.value = ""));
|
|
2650
2651
|
}, v = async (T) => {
|
|
2651
|
-
var B,
|
|
2652
|
+
var B, x;
|
|
2652
2653
|
if (e.limit && p.value.length + T.length > e.limit) {
|
|
2653
2654
|
a("exceed", T, p.value), (B = e.onExceed) == null || B.call(e, T, p.value);
|
|
2654
2655
|
return;
|
|
@@ -2661,17 +2662,17 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2661
2662
|
size: o.size,
|
|
2662
2663
|
status: "ready",
|
|
2663
2664
|
percentage: 0,
|
|
2664
|
-
uid:
|
|
2665
|
+
uid: F(),
|
|
2665
2666
|
raw: o
|
|
2666
2667
|
};
|
|
2667
|
-
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);
|
|
2668
2669
|
}
|
|
2669
2670
|
}, D = (T) => new Promise((B) => {
|
|
2670
|
-
const
|
|
2671
|
-
|
|
2671
|
+
const x = new FileReader();
|
|
2672
|
+
x.onload = (o) => {
|
|
2672
2673
|
var c;
|
|
2673
2674
|
B((c = o.target) == null ? void 0 : c.result);
|
|
2674
|
-
},
|
|
2675
|
+
}, x.readAsDataURL(T);
|
|
2675
2676
|
}), R = (T) => {
|
|
2676
2677
|
if (!T.raw) return;
|
|
2677
2678
|
T.status = "uploading", (e.httpRequest || M)({
|
|
@@ -2681,26 +2682,26 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2681
2682
|
file: T.raw,
|
|
2682
2683
|
name: e.name,
|
|
2683
2684
|
withCredentials: e.withCredentials,
|
|
2684
|
-
onProgress: (
|
|
2685
|
+
onProgress: (x) => {
|
|
2685
2686
|
var o;
|
|
2686
|
-
T.percentage =
|
|
2687
|
+
T.percentage = x.percent, a("progress", x, T, p.value), (o = e.onProgress) == null || o.call(e, x, T, p.value);
|
|
2687
2688
|
},
|
|
2688
|
-
onSuccess: (
|
|
2689
|
+
onSuccess: (x) => {
|
|
2689
2690
|
var o;
|
|
2690
|
-
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);
|
|
2691
2692
|
},
|
|
2692
|
-
onError: (
|
|
2693
|
+
onError: (x) => {
|
|
2693
2694
|
var o;
|
|
2694
|
-
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);
|
|
2695
2696
|
}
|
|
2696
2697
|
});
|
|
2697
|
-
}, M = (T) => new Promise((B,
|
|
2698
|
+
}, M = (T) => new Promise((B, x) => {
|
|
2698
2699
|
const o = new XMLHttpRequest();
|
|
2699
2700
|
o.upload.addEventListener("progress", (g) => {
|
|
2700
2701
|
g.lengthComputable && T.onProgress({ percent: g.loaded / g.total * 100 });
|
|
2701
2702
|
}), o.addEventListener("load", () => {
|
|
2702
2703
|
if (o.status < 200 || o.status >= 300) {
|
|
2703
|
-
T.onError(new Error("Upload failed")),
|
|
2704
|
+
T.onError(new Error("Upload failed")), x(new Error("Upload failed"));
|
|
2704
2705
|
return;
|
|
2705
2706
|
}
|
|
2706
2707
|
try {
|
|
@@ -2710,7 +2711,7 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2710
2711
|
T.onSuccess(o.responseText), B(o.responseText);
|
|
2711
2712
|
}
|
|
2712
2713
|
}), o.addEventListener("error", () => {
|
|
2713
|
-
T.onError(new Error("Upload error")),
|
|
2714
|
+
T.onError(new Error("Upload error")), x(new Error("Upload error"));
|
|
2714
2715
|
});
|
|
2715
2716
|
const c = new FormData();
|
|
2716
2717
|
c.append(T.name, T.file), T.data && Object.keys(T.data).forEach((g) => {
|
|
@@ -2718,12 +2719,12 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2718
2719
|
}), o.open("POST", T.action, !0), T.withCredentials && (o.withCredentials = !0), T.headers && Object.keys(T.headers).forEach((g) => {
|
|
2719
2720
|
o.setRequestHeader(g, T.headers[g]);
|
|
2720
2721
|
}), o.send(c);
|
|
2721
|
-
}),
|
|
2722
|
-
var
|
|
2722
|
+
}), A = async (T) => {
|
|
2723
|
+
var x;
|
|
2723
2724
|
if (e.beforeRemove && await e.beforeRemove(T, p.value) === !1)
|
|
2724
2725
|
return;
|
|
2725
2726
|
const B = p.value.findIndex((o) => o.uid === T.uid);
|
|
2726
|
-
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));
|
|
2727
2728
|
}, h = () => {
|
|
2728
2729
|
p.value.filter((T) => T.status === "ready" && T.raw).forEach((T) => R(T));
|
|
2729
2730
|
}, f = () => {
|
|
@@ -2736,19 +2737,19 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2736
2737
|
}, X = () => {
|
|
2737
2738
|
C.value = !1;
|
|
2738
2739
|
}, Z = (T) => {
|
|
2739
|
-
var
|
|
2740
|
+
var x;
|
|
2740
2741
|
if (T.preventDefault(), C.value = !1, e.disabled) return;
|
|
2741
|
-
const B = (
|
|
2742
|
+
const B = (x = T.dataTransfer) == null ? void 0 : x.files;
|
|
2742
2743
|
B && B.length > 0 && v(Array.from(B));
|
|
2743
2744
|
}, ee = (T) => {
|
|
2744
2745
|
if (!T) return "0 B";
|
|
2745
2746
|
const B = ["B", "KB", "MB", "GB"];
|
|
2746
|
-
let
|
|
2747
|
-
for (; o >= 1024 &&
|
|
2748
|
-
o /= 1024,
|
|
2749
|
-
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]}`;
|
|
2750
2751
|
};
|
|
2751
|
-
return
|
|
2752
|
+
return y({
|
|
2752
2753
|
submit: h,
|
|
2753
2754
|
clearFiles: f,
|
|
2754
2755
|
uploadFiles: p
|
|
@@ -2778,31 +2779,31 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2778
2779
|
key: 1,
|
|
2779
2780
|
class: u([s(l).e("files"), s(l).e("upload-list")])
|
|
2780
2781
|
}, [
|
|
2781
|
-
(r(!0), d(G, null, Q(p.value, (
|
|
2782
|
-
key:
|
|
2783
|
-
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}`)])
|
|
2784
2785
|
}, [
|
|
2785
|
-
|
|
2786
|
+
x.thumbUrl && x.status !== "uploading" ? (r(), d("img", {
|
|
2786
2787
|
key: 0,
|
|
2787
|
-
src:
|
|
2788
|
+
src: x.thumbUrl,
|
|
2788
2789
|
class: u(s(l).e("file-image"))
|
|
2789
2790
|
}, null, 10, Wt)) : (r(), d("div", {
|
|
2790
2791
|
key: 1,
|
|
2791
2792
|
class: u(s(l).e("file-status"))
|
|
2792
2793
|
}, [
|
|
2793
|
-
|
|
2794
|
+
x.status === "uploading" ? (r(), d("span", qt, [
|
|
2794
2795
|
i("span", Gt, [
|
|
2795
|
-
i("span", jt, z(Math.round(
|
|
2796
|
+
i("span", jt, z(Math.round(x.percentage || 0)) + "%", 1)
|
|
2796
2797
|
])
|
|
2797
|
-
])) :
|
|
2798
|
+
])) : x.status === "error" ? (r(), d("span", Zt, "✕")) : x.status === "success" ? (r(), d("span", Qt, "✓")) : O("", !0)
|
|
2798
2799
|
], 2)),
|
|
2799
2800
|
i("span", {
|
|
2800
2801
|
class: u(s(l).e("file-actions"))
|
|
2801
2802
|
}, [
|
|
2802
|
-
|
|
2803
|
+
x.url ? (r(), d("span", Jt, "👁️")) : O("", !0),
|
|
2803
2804
|
i("span", {
|
|
2804
2805
|
class: "action-remove",
|
|
2805
|
-
onClick: (o) =>
|
|
2806
|
+
onClick: (o) => A(x)
|
|
2806
2807
|
}, "🗑️", 8, _t)
|
|
2807
2808
|
], 2)
|
|
2808
2809
|
], 2))), 128)),
|
|
@@ -2837,35 +2838,35 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2837
2838
|
key: 0,
|
|
2838
2839
|
class: u(s(l).e("files"))
|
|
2839
2840
|
}, [
|
|
2840
|
-
(r(!0), d(G, null, Q(p.value, (
|
|
2841
|
-
key:
|
|
2842
|
-
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}`)])
|
|
2843
2844
|
}, [
|
|
2844
2845
|
n.listType === "text" ? (r(), d(G, { key: 0 }, [
|
|
2845
2846
|
i("span", {
|
|
2846
2847
|
class: u(s(l).e("file-icon"))
|
|
2847
|
-
}, z(S(
|
|
2848
|
+
}, z(S(x)), 3),
|
|
2848
2849
|
i("span", {
|
|
2849
2850
|
class: u(s(l).e("file-name"))
|
|
2850
|
-
}, z(
|
|
2851
|
+
}, z(x.name), 3),
|
|
2851
2852
|
i("span", {
|
|
2852
2853
|
class: u(s(l).e("file-size"))
|
|
2853
|
-
}, z(ee(
|
|
2854
|
-
|
|
2854
|
+
}, z(ee(x.size)), 3),
|
|
2855
|
+
x.status === "uploading" ? (r(), d("span", {
|
|
2855
2856
|
key: 0,
|
|
2856
2857
|
class: u(s(l).e("file-progress"))
|
|
2857
2858
|
}, [
|
|
2858
2859
|
i("span", {
|
|
2859
2860
|
class: "progress-bar",
|
|
2860
|
-
style: ne({ width:
|
|
2861
|
+
style: ne({ width: x.percentage + "%" })
|
|
2861
2862
|
}, null, 4),
|
|
2862
|
-
i("span", tl, z(Math.round(
|
|
2863
|
+
i("span", tl, z(Math.round(x.percentage || 0)) + "%", 1)
|
|
2863
2864
|
], 2)) : O("", !0),
|
|
2864
|
-
|
|
2865
|
+
x.status === "success" ? (r(), d("span", {
|
|
2865
2866
|
key: 1,
|
|
2866
2867
|
class: u(s(l).e("file-success"))
|
|
2867
2868
|
}, "✓", 2)) : O("", !0),
|
|
2868
|
-
|
|
2869
|
+
x.status === "error" ? (r(), d("span", {
|
|
2869
2870
|
key: 2,
|
|
2870
2871
|
class: u(s(l).e("file-error"))
|
|
2871
2872
|
}, "✕", 2)) : O("", !0),
|
|
@@ -2874,41 +2875,41 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2874
2875
|
}, [
|
|
2875
2876
|
i("span", {
|
|
2876
2877
|
class: "action-remove",
|
|
2877
|
-
onClick: (o) =>
|
|
2878
|
+
onClick: (o) => A(x)
|
|
2878
2879
|
}, "✕", 8, ll)
|
|
2879
2880
|
], 2)
|
|
2880
2881
|
], 64)) : n.listType === "picture" ? (r(), d(G, { key: 1 }, [
|
|
2881
|
-
|
|
2882
|
+
x.thumbUrl ? (r(), d("img", {
|
|
2882
2883
|
key: 0,
|
|
2883
|
-
src:
|
|
2884
|
+
src: x.thumbUrl,
|
|
2884
2885
|
class: u(s(l).e("file-thumb"))
|
|
2885
2886
|
}, null, 10, al)) : (r(), d("span", {
|
|
2886
2887
|
key: 1,
|
|
2887
2888
|
class: u(s(l).e("file-icon"))
|
|
2888
|
-
}, z(S(
|
|
2889
|
+
}, z(S(x)), 3)),
|
|
2889
2890
|
i("div", {
|
|
2890
2891
|
class: u(s(l).e("file-info"))
|
|
2891
2892
|
}, [
|
|
2892
2893
|
i("span", {
|
|
2893
2894
|
class: u(s(l).e("file-name"))
|
|
2894
|
-
}, z(
|
|
2895
|
-
|
|
2895
|
+
}, z(x.name), 3),
|
|
2896
|
+
x.status === "uploading" ? (r(), d("span", {
|
|
2896
2897
|
key: 0,
|
|
2897
2898
|
class: u(s(l).e("file-progress"))
|
|
2898
2899
|
}, [
|
|
2899
2900
|
i("span", {
|
|
2900
2901
|
class: "progress-bar",
|
|
2901
|
-
style: ne({ width:
|
|
2902
|
+
style: ne({ width: x.percentage + "%" })
|
|
2902
2903
|
}, null, 4)
|
|
2903
2904
|
], 2)) : O("", !0)
|
|
2904
2905
|
], 2),
|
|
2905
2906
|
i("span", {
|
|
2906
2907
|
class: u(s(l).e("file-actions"))
|
|
2907
2908
|
}, [
|
|
2908
|
-
|
|
2909
|
+
x.status === "success" ? (r(), d("span", nl, "✓")) : O("", !0),
|
|
2909
2910
|
i("span", {
|
|
2910
2911
|
class: "action-remove",
|
|
2911
|
-
onClick: (o) =>
|
|
2912
|
+
onClick: (o) => A(x)
|
|
2912
2913
|
}, "✕", 8, sl)
|
|
2913
2914
|
], 2)
|
|
2914
2915
|
], 64)) : O("", !0)
|
|
@@ -2923,7 +2924,7 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2923
2924
|
multiple: n.multiple,
|
|
2924
2925
|
accept: n.accept,
|
|
2925
2926
|
disabled: n.disabled,
|
|
2926
|
-
onChange:
|
|
2927
|
+
onChange: P
|
|
2927
2928
|
}, null, 42, ul),
|
|
2928
2929
|
T.$slots.tip ? (r(), d("div", {
|
|
2929
2930
|
key: 3,
|
|
@@ -2958,16 +2959,16 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2958
2959
|
size: { default: "default" }
|
|
2959
2960
|
},
|
|
2960
2961
|
emits: ["update:modelValue", "change"],
|
|
2961
|
-
setup(n, { emit:
|
|
2962
|
-
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(() => [
|
|
2963
2964
|
a.b(),
|
|
2964
2965
|
a.m(t.size),
|
|
2965
2966
|
a.is("disabled", t.disabled),
|
|
2966
2967
|
a.is("readonly", t.readonly)
|
|
2967
|
-
]), 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) => {
|
|
2968
2969
|
const D = m.value;
|
|
2969
2970
|
return D >= v ? 100 : t.allowHalf && D >= v - 0.5 ? 50 : 0;
|
|
2970
|
-
},
|
|
2971
|
+
}, F = (v) => w(v) > 0 ? C(m.value) : t.disabled ? t.disabledVoidColor : t.voidColor, S = b(() => {
|
|
2971
2972
|
if (t.showScore)
|
|
2972
2973
|
return t.scoreTemplate.replace("{value}", String(t.modelValue));
|
|
2973
2974
|
if (t.showText) {
|
|
@@ -2978,18 +2979,18 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
2978
2979
|
}), V = (v, D) => {
|
|
2979
2980
|
if (!(t.disabled || t.readonly))
|
|
2980
2981
|
if (t.allowHalf) {
|
|
2981
|
-
const M = D.currentTarget.getBoundingClientRect(),
|
|
2982
|
-
l.value =
|
|
2982
|
+
const M = D.currentTarget.getBoundingClientRect(), A = D.clientX - M.left < M.width / 2;
|
|
2983
|
+
l.value = A ? v - 0.5 : v;
|
|
2983
2984
|
} else
|
|
2984
2985
|
l.value = v;
|
|
2985
2986
|
}, $ = () => {
|
|
2986
2987
|
t.disabled || t.readonly || (l.value = -1);
|
|
2987
|
-
},
|
|
2988
|
+
}, P = (v, D) => {
|
|
2988
2989
|
if (t.disabled || t.readonly) return;
|
|
2989
2990
|
let R;
|
|
2990
2991
|
if (t.allowHalf) {
|
|
2991
|
-
const
|
|
2992
|
-
R = D.clientX -
|
|
2992
|
+
const A = D.currentTarget.getBoundingClientRect();
|
|
2993
|
+
R = D.clientX - A.left < A.width / 2 ? v - 0.5 : v;
|
|
2993
2994
|
} else
|
|
2994
2995
|
R = v;
|
|
2995
2996
|
e("update:modelValue", R), e("change", R);
|
|
@@ -3005,17 +3006,17 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
3005
3006
|
key: R,
|
|
3006
3007
|
class: u(s(a).e("item")),
|
|
3007
3008
|
onMousemove: (M) => V(R, M),
|
|
3008
|
-
onClick: (M) =>
|
|
3009
|
+
onClick: (M) => P(R, M)
|
|
3009
3010
|
}, [
|
|
3010
3011
|
i("span", {
|
|
3011
3012
|
class: u(s(a).e("void")),
|
|
3012
3013
|
style: ne({ color: n.disabled ? n.disabledVoidColor : n.voidColor })
|
|
3013
3014
|
}, z(n.disabled ? n.disabledVoidIcon : n.voidIcon), 7),
|
|
3014
3015
|
i("span", {
|
|
3015
|
-
class: u([s(a).e("fill"),
|
|
3016
|
+
class: u([s(a).e("fill"), w(R) > 0 ? "is-active" : ""]),
|
|
3016
3017
|
style: ne({
|
|
3017
|
-
color:
|
|
3018
|
-
clipPath: `inset(0 ${100 -
|
|
3018
|
+
color: F(R),
|
|
3019
|
+
clipPath: `inset(0 ${100 - w(R)}% 0 0)`
|
|
3019
3020
|
})
|
|
3020
3021
|
}, z(n.icon), 7)
|
|
3021
3022
|
], 42, ol))), 128))
|
|
@@ -3049,18 +3050,18 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
3049
3050
|
] }
|
|
3050
3051
|
},
|
|
3051
3052
|
emits: ["update:fields", "add", "remove", "sort", "update"],
|
|
3052
|
-
setup(n, { emit:
|
|
3053
|
-
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(() => [
|
|
3054
3055
|
a.b(),
|
|
3055
3056
|
a.is("editable", t.editable)
|
|
3056
|
-
]),
|
|
3057
|
+
]), w = b(() => l.value.length < t.maxFields);
|
|
3057
3058
|
ce(() => t.fields, (h) => {
|
|
3058
3059
|
l.value = [...h].sort((f, k) => (f.order || 0) - (k.order || 0));
|
|
3059
3060
|
}, { immediate: !0, deep: !0 });
|
|
3060
|
-
const
|
|
3061
|
-
if (!
|
|
3061
|
+
const F = () => `field_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`, S = () => {
|
|
3062
|
+
if (!w.value) return;
|
|
3062
3063
|
const h = {
|
|
3063
|
-
id:
|
|
3064
|
+
id: F(),
|
|
3064
3065
|
name: `field_${l.value.length + 1}`,
|
|
3065
3066
|
label: "新字段",
|
|
3066
3067
|
type: p.value,
|
|
@@ -3077,7 +3078,7 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
3077
3078
|
const k = l.value[f];
|
|
3078
3079
|
l.value[f] = l.value[f - 1], l.value[f - 1] = k, v(), e("sort", l.value), e("update:fields", l.value);
|
|
3079
3080
|
}
|
|
3080
|
-
},
|
|
3081
|
+
}, P = (h) => {
|
|
3081
3082
|
const f = l.value.findIndex((k) => k.id === h);
|
|
3082
3083
|
if (f < l.value.length - 1) {
|
|
3083
3084
|
const k = l.value[f];
|
|
@@ -3096,14 +3097,14 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
3096
3097
|
}
|
|
3097
3098
|
}, M = () => {
|
|
3098
3099
|
m.value = null;
|
|
3099
|
-
},
|
|
3100
|
+
}, A = (h) => {
|
|
3100
3101
|
const f = t.availableTypes.find((k) => k.value === h);
|
|
3101
3102
|
return (f == null ? void 0 : f.label) || h;
|
|
3102
3103
|
};
|
|
3103
3104
|
return (h, f) => (r(), d("div", {
|
|
3104
3105
|
class: u(C.value)
|
|
3105
3106
|
}, [
|
|
3106
|
-
n.editable &&
|
|
3107
|
+
n.editable && w.value ? (r(), d("div", {
|
|
3107
3108
|
key: 0,
|
|
3108
3109
|
class: u(s(a).e("add"))
|
|
3109
3110
|
}, [
|
|
@@ -3133,7 +3134,7 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
3133
3134
|
i("div", {
|
|
3134
3135
|
class: u(s(a).e("info"))
|
|
3135
3136
|
}, [
|
|
3136
|
-
i("span", rl, z(
|
|
3137
|
+
i("span", rl, z(A(k.type)), 1),
|
|
3137
3138
|
i("span", dl, z(k.name), 1),
|
|
3138
3139
|
i("span", cl, z(k.label), 1),
|
|
3139
3140
|
k.required ? (r(), d("span", vl, "必填")) : O("", !0)
|
|
@@ -3152,7 +3153,7 @@ const Rt = ["onClick"], Bt = ["placeholder", "disabled", "readonly", "value"], F
|
|
|
3152
3153
|
key: 1,
|
|
3153
3154
|
class: "action-btn",
|
|
3154
3155
|
title: "下移",
|
|
3155
|
-
onClick: (W) =>
|
|
3156
|
+
onClick: (W) => P(k.id)
|
|
3156
3157
|
}, " ↓ ", 8, ml)) : O("", !0),
|
|
3157
3158
|
i("button", {
|
|
3158
3159
|
class: "action-btn",
|