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