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