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