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