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