z-vue-design 0.0.86 → 0.0.87
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/README.md +182 -15
- package/dist/DownOutlined-DLt_M1C6.mjs +35 -0
- package/dist/SearchOutlined-mgRELgzm.mjs +234 -0
- package/dist/{UtilsEmpty-B_xFeZwK.mjs → UtilsEmpty-BGrmREE4.mjs} +2 -2
- package/dist/{ZDatePicker-_iOnGzI5.mjs → ZDatePicker-BClw7i_W.mjs} +3 -3
- package/dist/ZInput-BAvOFELa.mjs +1151 -0
- package/dist/ZRangeNum-DQb4pYBF.mjs +58 -0
- package/dist/{ZRangePicker-DEc9ZFHk.mjs → ZRangePicker-DRQ7DvKa.mjs} +5 -5
- package/dist/{ZSelect-CqYr-KaO.mjs → ZSelect-BZNWj_EC.mjs} +64 -63
- package/dist/{ZSwitch-QdXAUbbQ.mjs → ZSwitch-CyVE-Fq-.mjs} +4 -4
- package/dist/{ZTimePicker-ChueuS5q.mjs → ZTimePicker-Cb7Evf-v.mjs} +3 -3
- package/dist/{ZTimeRangePicker-D9QmtL5j.mjs → ZTimeRangePicker-CfRaXZC8.mjs} +7 -7
- package/dist/{dayjs-BaYokJbL.mjs → dayjs-CZJNgdie.mjs} +10 -10
- package/dist/{dayjs-D0ij1LGv.mjs → dayjs-phjds8dp.mjs} +2 -2
- package/dist/index-BMe1eySH.mjs +1356 -0
- package/dist/{index-OVDVakdf.mjs → index-C5EmjaZ2.mjs} +7 -7
- package/dist/{index-BqCcUSZ_.mjs → index-NxjGmddr.mjs} +36 -34
- package/dist/{slide-Df0ggJ0k.mjs → slide-D5LZqvuX.mjs} +1 -1
- package/dist/{statusUtils-Dl7LD-4k.mjs → statusUtils-Dk_VID6p.mjs} +1 -1
- package/dist/styles/z-vue-design.css +1 -1
- package/dist/z-vue-design.es.js +1 -1
- package/dist/z-vue-design.umd.js +63 -63
- package/dist/{zh_CN-Ci4SAGB1.mjs → zh_CN-DrSVSNzk.mjs} +245 -245
- package/package.json +1 -1
- package/dist/SearchOutlined-CNVKSbgO.mjs +0 -264
- package/dist/ZInput-DwKbIjYr.mjs +0 -2497
|
@@ -0,0 +1,1151 @@
|
|
|
1
|
+
import { createVNode as b, defineComponent as Pe, ref as ke, onBeforeUnmount as qe, shallowRef as O, computed as j, watch as ee, mergeModels as it, useModel as ot, resolveComponent as Se, createBlock as $e, openBlock as Ne, mergeProps as Te } from "vue";
|
|
2
|
+
import { I as st, f as A, c as W, a as R, w as ut, b as Fe, d as v, e as F, s as Q, g as Ee, K as ie, h as dt, i as ct, r as ze, j as ft, u as pt, F as mt, k as gt, l as vt, m as bt, o as ht, N as je, n as We, p as St, P as ye, _ as $t } from "./index-NxjGmddr.mjs";
|
|
3
|
+
import { a as Nt, I as yt } from "./index-BMe1eySH.mjs";
|
|
4
|
+
import { i as It, D as wt } from "./DownOutlined-DLt_M1C6.mjs";
|
|
5
|
+
import { g as xt, a as Ie } from "./statusUtils-Dk_VID6p.mjs";
|
|
6
|
+
import { i as Et, g as Ke, a as Xe, b as Ct, c as _t, d as Pt, e as Ot, f as Ze } from "./index-C5EmjaZ2.mjs";
|
|
7
|
+
var Mt = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" } }] }, name: "up", theme: "outlined" };
|
|
8
|
+
function He(e) {
|
|
9
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
10
|
+
var n = arguments[t] != null ? Object(arguments[t]) : {}, a = Object.keys(n);
|
|
11
|
+
typeof Object.getOwnPropertySymbols == "function" && (a = a.concat(Object.getOwnPropertySymbols(n).filter(function(l) {
|
|
12
|
+
return Object.getOwnPropertyDescriptor(n, l).enumerable;
|
|
13
|
+
}))), a.forEach(function(l) {
|
|
14
|
+
Dt(e, l, n[l]);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return e;
|
|
18
|
+
}
|
|
19
|
+
function Dt(e, t, n) {
|
|
20
|
+
return t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
|
|
21
|
+
}
|
|
22
|
+
var Oe = function(t, n) {
|
|
23
|
+
var a = He({}, t, n.attrs);
|
|
24
|
+
return b(st, He({}, a, {
|
|
25
|
+
icon: Mt
|
|
26
|
+
}), null);
|
|
27
|
+
};
|
|
28
|
+
Oe.displayName = "UpOutlined";
|
|
29
|
+
Oe.inheritAttrs = !1;
|
|
30
|
+
function Ce() {
|
|
31
|
+
return typeof BigInt == "function";
|
|
32
|
+
}
|
|
33
|
+
function te(e) {
|
|
34
|
+
let t = e.trim(), n = t.startsWith("-");
|
|
35
|
+
n && (t = t.slice(1)), t = t.replace(/(\.\d*[^0])0*$/, "$1").replace(/\.0*$/, "").replace(/^0+/, ""), t.startsWith(".") && (t = `0${t}`);
|
|
36
|
+
const a = t || "0", l = a.split("."), i = l[0] || "0", c = l[1] || "0";
|
|
37
|
+
i === "0" && c === "0" && (n = !1);
|
|
38
|
+
const f = n ? "-" : "";
|
|
39
|
+
return {
|
|
40
|
+
negative: n,
|
|
41
|
+
negativeStr: f,
|
|
42
|
+
trimStr: a,
|
|
43
|
+
integerStr: i,
|
|
44
|
+
decimalStr: c,
|
|
45
|
+
fullStr: `${f}${a}`
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function Me(e) {
|
|
49
|
+
const t = String(e);
|
|
50
|
+
return !Number.isNaN(Number(t)) && t.includes("e");
|
|
51
|
+
}
|
|
52
|
+
function ne(e) {
|
|
53
|
+
const t = String(e);
|
|
54
|
+
if (Me(e)) {
|
|
55
|
+
let n = Number(t.slice(t.indexOf("e-") + 2));
|
|
56
|
+
const a = t.match(/\.(\d+)/);
|
|
57
|
+
return a != null && a[1] && (n += a[1].length), n;
|
|
58
|
+
}
|
|
59
|
+
return t.includes(".") && Ae(t) ? t.length - t.indexOf(".") - 1 : 0;
|
|
60
|
+
}
|
|
61
|
+
function De(e) {
|
|
62
|
+
let t = String(e);
|
|
63
|
+
if (Me(e)) {
|
|
64
|
+
if (e > Number.MAX_SAFE_INTEGER)
|
|
65
|
+
return String(Ce() ? BigInt(e).toString() : Number.MAX_SAFE_INTEGER);
|
|
66
|
+
if (e < Number.MIN_SAFE_INTEGER)
|
|
67
|
+
return String(Ce() ? BigInt(e).toString() : Number.MIN_SAFE_INTEGER);
|
|
68
|
+
t = e.toFixed(ne(t));
|
|
69
|
+
}
|
|
70
|
+
return te(t).fullStr;
|
|
71
|
+
}
|
|
72
|
+
function Ae(e) {
|
|
73
|
+
return typeof e == "number" ? !Number.isNaN(e) : e ? (
|
|
74
|
+
// Normal type: 11.28
|
|
75
|
+
/^\s*-?\d+(\.\d+)?\s*$/.test(e) || // Pre-number: 1.
|
|
76
|
+
/^\s*-?\d+\.\s*$/.test(e) || // Post-number: .1
|
|
77
|
+
/^\s*-?\.\d+\s*$/.test(e)
|
|
78
|
+
) : !1;
|
|
79
|
+
}
|
|
80
|
+
function Ye(e) {
|
|
81
|
+
return !e && e !== 0 && !Number.isNaN(e) || !String(e).trim();
|
|
82
|
+
}
|
|
83
|
+
class z {
|
|
84
|
+
constructor(t) {
|
|
85
|
+
if (this.origin = "", Ye(t)) {
|
|
86
|
+
this.empty = !0;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.origin = String(t), this.number = Number(t);
|
|
90
|
+
}
|
|
91
|
+
negate() {
|
|
92
|
+
return new z(-this.toNumber());
|
|
93
|
+
}
|
|
94
|
+
add(t) {
|
|
95
|
+
if (this.isInvalidate())
|
|
96
|
+
return new z(t);
|
|
97
|
+
const n = Number(t);
|
|
98
|
+
if (Number.isNaN(n))
|
|
99
|
+
return this;
|
|
100
|
+
const a = this.number + n;
|
|
101
|
+
if (a > Number.MAX_SAFE_INTEGER)
|
|
102
|
+
return new z(Number.MAX_SAFE_INTEGER);
|
|
103
|
+
if (a < Number.MIN_SAFE_INTEGER)
|
|
104
|
+
return new z(Number.MIN_SAFE_INTEGER);
|
|
105
|
+
const l = Math.max(ne(this.number), ne(n));
|
|
106
|
+
return new z(a.toFixed(l));
|
|
107
|
+
}
|
|
108
|
+
isEmpty() {
|
|
109
|
+
return this.empty;
|
|
110
|
+
}
|
|
111
|
+
isNaN() {
|
|
112
|
+
return Number.isNaN(this.number);
|
|
113
|
+
}
|
|
114
|
+
isInvalidate() {
|
|
115
|
+
return this.isEmpty() || this.isNaN();
|
|
116
|
+
}
|
|
117
|
+
equals(t) {
|
|
118
|
+
return this.toNumber() === (t == null ? void 0 : t.toNumber());
|
|
119
|
+
}
|
|
120
|
+
lessEquals(t) {
|
|
121
|
+
return this.add(t.negate().toString()).toNumber() <= 0;
|
|
122
|
+
}
|
|
123
|
+
toNumber() {
|
|
124
|
+
return this.number;
|
|
125
|
+
}
|
|
126
|
+
toString() {
|
|
127
|
+
return (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0) ? this.isInvalidate() ? "" : De(this.number) : this.origin;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
class k {
|
|
131
|
+
constructor(t) {
|
|
132
|
+
if (this.origin = "", Ye(t)) {
|
|
133
|
+
this.empty = !0;
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (this.origin = String(t), t === "-" || Number.isNaN(t)) {
|
|
137
|
+
this.nan = !0;
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
let n = t;
|
|
141
|
+
if (Me(n) && (n = Number(n)), n = typeof n == "string" ? n : De(n), Ae(n)) {
|
|
142
|
+
const a = te(n);
|
|
143
|
+
this.negative = a.negative;
|
|
144
|
+
const l = a.trimStr.split(".");
|
|
145
|
+
this.integer = BigInt(l[0]);
|
|
146
|
+
const i = l[1] || "0";
|
|
147
|
+
this.decimal = BigInt(i), this.decimalLen = i.length;
|
|
148
|
+
} else
|
|
149
|
+
this.nan = !0;
|
|
150
|
+
}
|
|
151
|
+
getMark() {
|
|
152
|
+
return this.negative ? "-" : "";
|
|
153
|
+
}
|
|
154
|
+
getIntegerStr() {
|
|
155
|
+
return this.integer.toString();
|
|
156
|
+
}
|
|
157
|
+
getDecimalStr() {
|
|
158
|
+
return this.decimal.toString().padStart(this.decimalLen, "0");
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Align BigIntDecimal with same decimal length. e.g. 12.3 + 5 = 1230000
|
|
162
|
+
* This is used for add function only.
|
|
163
|
+
*/
|
|
164
|
+
alignDecimal(t) {
|
|
165
|
+
const n = `${this.getMark()}${this.getIntegerStr()}${this.getDecimalStr().padEnd(t, "0")}`;
|
|
166
|
+
return BigInt(n);
|
|
167
|
+
}
|
|
168
|
+
negate() {
|
|
169
|
+
const t = new k(this.toString());
|
|
170
|
+
return t.negative = !t.negative, t;
|
|
171
|
+
}
|
|
172
|
+
add(t) {
|
|
173
|
+
if (this.isInvalidate())
|
|
174
|
+
return new k(t);
|
|
175
|
+
const n = new k(t);
|
|
176
|
+
if (n.isInvalidate())
|
|
177
|
+
return this;
|
|
178
|
+
const a = Math.max(this.getDecimalStr().length, n.getDecimalStr().length), l = this.alignDecimal(a), i = n.alignDecimal(a), c = (l + i).toString(), {
|
|
179
|
+
negativeStr: f,
|
|
180
|
+
trimStr: d
|
|
181
|
+
} = te(c), p = `${f}${d.padStart(a + 1, "0")}`;
|
|
182
|
+
return new k(`${p.slice(0, -a)}.${p.slice(-a)}`);
|
|
183
|
+
}
|
|
184
|
+
isEmpty() {
|
|
185
|
+
return this.empty;
|
|
186
|
+
}
|
|
187
|
+
isNaN() {
|
|
188
|
+
return this.nan;
|
|
189
|
+
}
|
|
190
|
+
isInvalidate() {
|
|
191
|
+
return this.isEmpty() || this.isNaN();
|
|
192
|
+
}
|
|
193
|
+
equals(t) {
|
|
194
|
+
return this.toString() === (t == null ? void 0 : t.toString());
|
|
195
|
+
}
|
|
196
|
+
lessEquals(t) {
|
|
197
|
+
return this.add(t.negate().toString()).toNumber() <= 0;
|
|
198
|
+
}
|
|
199
|
+
toNumber() {
|
|
200
|
+
return this.isNaN() ? NaN : Number(this.toString());
|
|
201
|
+
}
|
|
202
|
+
toString() {
|
|
203
|
+
return (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0) ? this.isInvalidate() ? "" : te(`${this.getMark()}${this.getIntegerStr()}.${this.getDecimalStr()}`).fullStr : this.origin;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function P(e) {
|
|
207
|
+
return Ce() ? new k(e) : new z(e);
|
|
208
|
+
}
|
|
209
|
+
function _e(e, t, n) {
|
|
210
|
+
let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
|
|
211
|
+
if (e === "")
|
|
212
|
+
return "";
|
|
213
|
+
const {
|
|
214
|
+
negativeStr: l,
|
|
215
|
+
integerStr: i,
|
|
216
|
+
decimalStr: c
|
|
217
|
+
} = te(e), f = `${t}${c}`, d = `${l}${i}`;
|
|
218
|
+
if (n >= 0) {
|
|
219
|
+
const p = Number(c[n]);
|
|
220
|
+
if (p >= 5 && !a) {
|
|
221
|
+
const s = P(e).add(`${l}0.${"0".repeat(n)}${10 - p}`);
|
|
222
|
+
return _e(s.toString(), t, n, a);
|
|
223
|
+
}
|
|
224
|
+
return n === 0 ? d : `${d}${t}${c.padEnd(n, "0").slice(0, n)}`;
|
|
225
|
+
}
|
|
226
|
+
return f === ".0" ? d : `${d}${f}`;
|
|
227
|
+
}
|
|
228
|
+
const At = 200, Rt = 600, Vt = Pe({
|
|
229
|
+
compatConfig: {
|
|
230
|
+
MODE: 3
|
|
231
|
+
},
|
|
232
|
+
name: "StepHandler",
|
|
233
|
+
inheritAttrs: !1,
|
|
234
|
+
props: {
|
|
235
|
+
prefixCls: String,
|
|
236
|
+
upDisabled: Boolean,
|
|
237
|
+
downDisabled: Boolean,
|
|
238
|
+
onStep: A()
|
|
239
|
+
},
|
|
240
|
+
slots: Object,
|
|
241
|
+
setup(e, t) {
|
|
242
|
+
let {
|
|
243
|
+
slots: n,
|
|
244
|
+
emit: a
|
|
245
|
+
} = t;
|
|
246
|
+
const l = ke(), i = (f, d) => {
|
|
247
|
+
f.preventDefault(), a("step", d);
|
|
248
|
+
function p() {
|
|
249
|
+
a("step", d), l.value = setTimeout(p, At);
|
|
250
|
+
}
|
|
251
|
+
l.value = setTimeout(p, Rt);
|
|
252
|
+
}, c = () => {
|
|
253
|
+
clearTimeout(l.value);
|
|
254
|
+
};
|
|
255
|
+
return qe(() => {
|
|
256
|
+
c();
|
|
257
|
+
}), () => {
|
|
258
|
+
if (It())
|
|
259
|
+
return null;
|
|
260
|
+
const {
|
|
261
|
+
prefixCls: f,
|
|
262
|
+
upDisabled: d,
|
|
263
|
+
downDisabled: p
|
|
264
|
+
} = e, s = `${f}-handler`, I = W(s, `${s}-up`, {
|
|
265
|
+
[`${s}-up-disabled`]: d
|
|
266
|
+
}), S = W(s, `${s}-down`, {
|
|
267
|
+
[`${s}-down-disabled`]: p
|
|
268
|
+
}), x = {
|
|
269
|
+
unselectable: "on",
|
|
270
|
+
role: "button",
|
|
271
|
+
onMouseup: c,
|
|
272
|
+
onMouseleave: c
|
|
273
|
+
}, {
|
|
274
|
+
upNode: $,
|
|
275
|
+
downNode: E
|
|
276
|
+
} = n;
|
|
277
|
+
return b("div", {
|
|
278
|
+
class: `${s}-wrap`
|
|
279
|
+
}, [b("span", R(R({}, x), {}, {
|
|
280
|
+
onMousedown: (M) => {
|
|
281
|
+
i(M, !0);
|
|
282
|
+
},
|
|
283
|
+
"aria-label": "Increase Value",
|
|
284
|
+
"aria-disabled": d,
|
|
285
|
+
class: I
|
|
286
|
+
}), [($ == null ? void 0 : $()) || b("span", {
|
|
287
|
+
unselectable: "on",
|
|
288
|
+
class: `${f}-handler-up-inner`
|
|
289
|
+
}, null)]), b("span", R(R({}, x), {}, {
|
|
290
|
+
onMousedown: (M) => {
|
|
291
|
+
i(M, !1);
|
|
292
|
+
},
|
|
293
|
+
"aria-label": "Decrease Value",
|
|
294
|
+
"aria-disabled": p,
|
|
295
|
+
class: S
|
|
296
|
+
}), [(E == null ? void 0 : E()) || b("span", {
|
|
297
|
+
unselectable: "on",
|
|
298
|
+
class: `${f}-handler-down-inner`
|
|
299
|
+
}, null)])]);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
function Bt(e, t) {
|
|
304
|
+
const n = ke(null);
|
|
305
|
+
function a() {
|
|
306
|
+
try {
|
|
307
|
+
const {
|
|
308
|
+
selectionStart: i,
|
|
309
|
+
selectionEnd: c,
|
|
310
|
+
value: f
|
|
311
|
+
} = e.value, d = f.substring(0, i), p = f.substring(c);
|
|
312
|
+
n.value = {
|
|
313
|
+
start: i,
|
|
314
|
+
end: c,
|
|
315
|
+
value: f,
|
|
316
|
+
beforeTxt: d,
|
|
317
|
+
afterTxt: p
|
|
318
|
+
};
|
|
319
|
+
} catch {
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function l() {
|
|
323
|
+
if (e.value && n.value && t.value)
|
|
324
|
+
try {
|
|
325
|
+
const {
|
|
326
|
+
value: i
|
|
327
|
+
} = e.value, {
|
|
328
|
+
beforeTxt: c,
|
|
329
|
+
afterTxt: f,
|
|
330
|
+
start: d
|
|
331
|
+
} = n.value;
|
|
332
|
+
let p = i.length;
|
|
333
|
+
if (i.endsWith(f))
|
|
334
|
+
p = i.length - n.value.afterTxt.length;
|
|
335
|
+
else if (i.startsWith(c))
|
|
336
|
+
p = c.length;
|
|
337
|
+
else {
|
|
338
|
+
const s = c[d - 1], I = i.indexOf(s, d - 1);
|
|
339
|
+
I !== -1 && (p = I + 1);
|
|
340
|
+
}
|
|
341
|
+
e.value.setSelectionRange(p, p);
|
|
342
|
+
} catch (i) {
|
|
343
|
+
ut(!1, `Something warning of cursor restore. Please fire issue about this: ${i.message}`);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return [a, l];
|
|
347
|
+
}
|
|
348
|
+
const Tt = () => {
|
|
349
|
+
const e = O(0), t = () => {
|
|
350
|
+
Fe.cancel(e.value);
|
|
351
|
+
};
|
|
352
|
+
return qe(() => {
|
|
353
|
+
t();
|
|
354
|
+
}), (n) => {
|
|
355
|
+
t(), e.value = Fe(() => {
|
|
356
|
+
n();
|
|
357
|
+
});
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
var Ft = function(e, t) {
|
|
361
|
+
var n = {};
|
|
362
|
+
for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && t.indexOf(a) < 0 && (n[a] = e[a]);
|
|
363
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, a = Object.getOwnPropertySymbols(e); l < a.length; l++)
|
|
364
|
+
t.indexOf(a[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, a[l]) && (n[a[l]] = e[a[l]]);
|
|
365
|
+
return n;
|
|
366
|
+
};
|
|
367
|
+
const Ue = (e, t) => e || t.isEmpty() ? t.toString() : t.toNumber(), Ge = (e) => {
|
|
368
|
+
const t = P(e);
|
|
369
|
+
return t.isInvalidate() ? null : t;
|
|
370
|
+
}, Je = () => ({
|
|
371
|
+
/** value will show as string */
|
|
372
|
+
stringMode: F(),
|
|
373
|
+
defaultValue: Q([String, Number]),
|
|
374
|
+
value: Q([String, Number]),
|
|
375
|
+
prefixCls: Ee(),
|
|
376
|
+
min: Q([String, Number]),
|
|
377
|
+
max: Q([String, Number]),
|
|
378
|
+
step: Q([String, Number], 1),
|
|
379
|
+
tabindex: Number,
|
|
380
|
+
controls: F(!0),
|
|
381
|
+
readonly: F(),
|
|
382
|
+
disabled: F(),
|
|
383
|
+
autofocus: F(),
|
|
384
|
+
keyboard: F(!0),
|
|
385
|
+
/** Parse display value to validate number */
|
|
386
|
+
parser: A(),
|
|
387
|
+
/** Transform `value` to display value show in input */
|
|
388
|
+
formatter: A(),
|
|
389
|
+
/** Syntactic sugar of `formatter`. Config precision of display. */
|
|
390
|
+
precision: Number,
|
|
391
|
+
/** Syntactic sugar of `formatter`. Config decimal separator of display. */
|
|
392
|
+
decimalSeparator: String,
|
|
393
|
+
onInput: A(),
|
|
394
|
+
onChange: A(),
|
|
395
|
+
onPressEnter: A(),
|
|
396
|
+
onStep: A(),
|
|
397
|
+
onBlur: A(),
|
|
398
|
+
onFocus: A()
|
|
399
|
+
}), zt = Pe({
|
|
400
|
+
compatConfig: {
|
|
401
|
+
MODE: 3
|
|
402
|
+
},
|
|
403
|
+
name: "InnerInputNumber",
|
|
404
|
+
inheritAttrs: !1,
|
|
405
|
+
props: v(v({}, Je()), {
|
|
406
|
+
lazy: Boolean
|
|
407
|
+
}),
|
|
408
|
+
slots: Object,
|
|
409
|
+
setup(e, t) {
|
|
410
|
+
let {
|
|
411
|
+
attrs: n,
|
|
412
|
+
slots: a,
|
|
413
|
+
emit: l,
|
|
414
|
+
expose: i
|
|
415
|
+
} = t;
|
|
416
|
+
const c = O(), f = O(!1), d = O(!1), p = O(!1), s = O(P(e.value));
|
|
417
|
+
function I(r) {
|
|
418
|
+
e.value === void 0 && (s.value = r);
|
|
419
|
+
}
|
|
420
|
+
const S = (r, o) => {
|
|
421
|
+
if (!o)
|
|
422
|
+
return e.precision >= 0 ? e.precision : Math.max(ne(r), ne(e.step));
|
|
423
|
+
}, x = (r) => {
|
|
424
|
+
const o = String(r);
|
|
425
|
+
if (e.parser)
|
|
426
|
+
return e.parser(o);
|
|
427
|
+
let u = o;
|
|
428
|
+
return e.decimalSeparator && (u = u.replace(e.decimalSeparator, ".")), u.replace(/[^\w.-]+/g, "");
|
|
429
|
+
}, $ = O(""), E = (r, o) => {
|
|
430
|
+
if (e.formatter)
|
|
431
|
+
return e.formatter(r, {
|
|
432
|
+
userTyping: o,
|
|
433
|
+
input: String($.value)
|
|
434
|
+
});
|
|
435
|
+
let u = typeof r == "number" ? De(r) : r;
|
|
436
|
+
if (!o) {
|
|
437
|
+
const m = S(u, o);
|
|
438
|
+
if (Ae(u) && (e.decimalSeparator || m >= 0)) {
|
|
439
|
+
const y = e.decimalSeparator || ".";
|
|
440
|
+
u = _e(u, y, m);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return u;
|
|
444
|
+
}, M = (() => {
|
|
445
|
+
const r = e.value;
|
|
446
|
+
return s.value.isInvalidate() && ["string", "number"].includes(typeof r) ? Number.isNaN(r) ? "" : r : E(s.value.toString(), !1);
|
|
447
|
+
})();
|
|
448
|
+
$.value = M;
|
|
449
|
+
function C(r, o) {
|
|
450
|
+
$.value = E(
|
|
451
|
+
// Invalidate number is sometime passed by external control, we should let it go
|
|
452
|
+
// Otherwise is controlled by internal interactive logic which check by userTyping
|
|
453
|
+
// You can ref 'show limited value when input is not focused' test for more info.
|
|
454
|
+
r.isInvalidate() ? r.toString(!1) : r.toString(!o),
|
|
455
|
+
o
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
const _ = j(() => Ge(e.max)), N = j(() => Ge(e.min)), w = j(() => !_.value || !s.value || s.value.isInvalidate() ? !1 : _.value.lessEquals(s.value)), V = j(() => !N.value || !s.value || s.value.isInvalidate() ? !1 : s.value.lessEquals(N.value)), [q, K] = Bt(c, f), X = (r) => _.value && !r.lessEquals(_.value) ? _.value : N.value && !N.value.lessEquals(r) ? N.value : null, oe = (r) => !X(r), Z = (r, o) => {
|
|
459
|
+
var u;
|
|
460
|
+
let m = r, y = oe(m) || m.isEmpty();
|
|
461
|
+
if (!m.isEmpty() && !o && (m = X(m) || m, y = !0), !e.readonly && !e.disabled && y) {
|
|
462
|
+
const D = m.toString(), G = S(D, o);
|
|
463
|
+
return G >= 0 && (m = P(_e(D, ".", G))), m.equals(s.value) || (I(m), (u = e.onChange) === null || u === void 0 || u.call(e, m.isEmpty() ? null : Ue(e.stringMode, m)), e.value === void 0 && C(m, o)), m;
|
|
464
|
+
}
|
|
465
|
+
return s.value;
|
|
466
|
+
}, se = Tt(), Y = (r) => {
|
|
467
|
+
var o;
|
|
468
|
+
if (q(), $.value = r, !p.value) {
|
|
469
|
+
const u = x(r), m = P(u);
|
|
470
|
+
m.isNaN() || Z(m, !0);
|
|
471
|
+
}
|
|
472
|
+
(o = e.onInput) === null || o === void 0 || o.call(e, r), se(() => {
|
|
473
|
+
let u = r;
|
|
474
|
+
e.parser || (u = r.replace(/。/g, ".")), u !== r && Y(u);
|
|
475
|
+
});
|
|
476
|
+
}, h = () => {
|
|
477
|
+
p.value = !0;
|
|
478
|
+
}, J = () => {
|
|
479
|
+
p.value = !1, Y(c.value.value);
|
|
480
|
+
}, H = (r) => {
|
|
481
|
+
Y(r.target.value);
|
|
482
|
+
}, U = (r) => {
|
|
483
|
+
var o, u;
|
|
484
|
+
if (r && w.value || !r && V.value)
|
|
485
|
+
return;
|
|
486
|
+
d.value = !1;
|
|
487
|
+
let m = P(e.step);
|
|
488
|
+
r || (m = m.negate());
|
|
489
|
+
const y = (s.value || P(0)).add(m.toString()), D = Z(y, !1);
|
|
490
|
+
(o = e.onStep) === null || o === void 0 || o.call(e, Ue(e.stringMode, D), {
|
|
491
|
+
offset: e.step,
|
|
492
|
+
type: r ? "up" : "down"
|
|
493
|
+
}), (u = c.value) === null || u === void 0 || u.focus();
|
|
494
|
+
}, B = (r) => {
|
|
495
|
+
const o = P(x($.value));
|
|
496
|
+
let u = o;
|
|
497
|
+
o.isNaN() ? u = s.value : u = Z(o, r), e.value !== void 0 ? C(s.value, !1) : u.isNaN() || C(u, !1);
|
|
498
|
+
}, ue = () => {
|
|
499
|
+
d.value = !0;
|
|
500
|
+
}, de = (r) => {
|
|
501
|
+
var o;
|
|
502
|
+
const {
|
|
503
|
+
which: u
|
|
504
|
+
} = r;
|
|
505
|
+
d.value = !0, u === ie.ENTER && (p.value || (d.value = !1), B(!1), (o = e.onPressEnter) === null || o === void 0 || o.call(e, r)), e.keyboard !== !1 && !p.value && [ie.UP, ie.DOWN].includes(u) && (U(ie.UP === u), r.preventDefault());
|
|
506
|
+
}, ce = () => {
|
|
507
|
+
d.value = !1;
|
|
508
|
+
}, ae = (r) => {
|
|
509
|
+
B(!1), f.value = !1, d.value = !1, l("blur", r);
|
|
510
|
+
};
|
|
511
|
+
return ee(() => e.precision, () => {
|
|
512
|
+
s.value.isInvalidate() || C(s.value, !1);
|
|
513
|
+
}, {
|
|
514
|
+
flush: "post"
|
|
515
|
+
}), ee(() => e.value, () => {
|
|
516
|
+
const r = P(e.value);
|
|
517
|
+
s.value = r;
|
|
518
|
+
const o = P(x($.value));
|
|
519
|
+
(!r.equals(o) || !d.value || e.formatter) && C(r, d.value);
|
|
520
|
+
}, {
|
|
521
|
+
flush: "post"
|
|
522
|
+
}), ee($, () => {
|
|
523
|
+
e.formatter && K();
|
|
524
|
+
}, {
|
|
525
|
+
flush: "post"
|
|
526
|
+
}), ee(() => e.disabled, (r) => {
|
|
527
|
+
r && (f.value = !1);
|
|
528
|
+
}), i({
|
|
529
|
+
focus: () => {
|
|
530
|
+
var r;
|
|
531
|
+
(r = c.value) === null || r === void 0 || r.focus();
|
|
532
|
+
},
|
|
533
|
+
blur: () => {
|
|
534
|
+
var r;
|
|
535
|
+
(r = c.value) === null || r === void 0 || r.blur();
|
|
536
|
+
}
|
|
537
|
+
}), () => {
|
|
538
|
+
const r = v(v({}, n), e), {
|
|
539
|
+
prefixCls: o = "rc-input-number",
|
|
540
|
+
min: u,
|
|
541
|
+
max: m,
|
|
542
|
+
step: y = 1,
|
|
543
|
+
defaultValue: D,
|
|
544
|
+
value: G,
|
|
545
|
+
disabled: re,
|
|
546
|
+
readonly: le,
|
|
547
|
+
keyboard: g,
|
|
548
|
+
controls: fe = !0,
|
|
549
|
+
autofocus: T,
|
|
550
|
+
stringMode: pe,
|
|
551
|
+
parser: me,
|
|
552
|
+
formatter: L,
|
|
553
|
+
precision: ge,
|
|
554
|
+
decimalSeparator: ve,
|
|
555
|
+
onChange: be,
|
|
556
|
+
onInput: Re,
|
|
557
|
+
onPressEnter: Ve,
|
|
558
|
+
onStep: Kt,
|
|
559
|
+
lazy: Qe,
|
|
560
|
+
class: et,
|
|
561
|
+
style: tt
|
|
562
|
+
} = r, nt = Ft(r, ["prefixCls", "min", "max", "step", "defaultValue", "value", "disabled", "readonly", "keyboard", "controls", "autofocus", "stringMode", "parser", "formatter", "precision", "decimalSeparator", "onChange", "onInput", "onPressEnter", "onStep", "lazy", "class", "style"]), {
|
|
563
|
+
upHandler: at,
|
|
564
|
+
downHandler: rt
|
|
565
|
+
} = a, Be = `${o}-input`, he = {};
|
|
566
|
+
return Qe ? he.onChange = H : he.onInput = H, b("div", {
|
|
567
|
+
class: W(o, et, {
|
|
568
|
+
[`${o}-focused`]: f.value,
|
|
569
|
+
[`${o}-disabled`]: re,
|
|
570
|
+
[`${o}-readonly`]: le,
|
|
571
|
+
[`${o}-not-a-number`]: s.value.isNaN(),
|
|
572
|
+
[`${o}-out-of-range`]: !s.value.isInvalidate() && !oe(s.value)
|
|
573
|
+
}),
|
|
574
|
+
style: tt,
|
|
575
|
+
onKeydown: de,
|
|
576
|
+
onKeyup: ce
|
|
577
|
+
}, [fe && b(Vt, {
|
|
578
|
+
prefixCls: o,
|
|
579
|
+
upDisabled: w.value,
|
|
580
|
+
downDisabled: V.value,
|
|
581
|
+
onStep: U
|
|
582
|
+
}, {
|
|
583
|
+
upNode: at,
|
|
584
|
+
downNode: rt
|
|
585
|
+
}), b("div", {
|
|
586
|
+
class: `${Be}-wrap`
|
|
587
|
+
}, [b("input", R(R(R({
|
|
588
|
+
autofocus: T,
|
|
589
|
+
autocomplete: "off",
|
|
590
|
+
role: "spinbutton",
|
|
591
|
+
"aria-valuemin": u,
|
|
592
|
+
"aria-valuemax": m,
|
|
593
|
+
"aria-valuenow": s.value.isInvalidate() ? null : s.value.toString(),
|
|
594
|
+
step: y
|
|
595
|
+
}, nt), {}, {
|
|
596
|
+
ref: c,
|
|
597
|
+
class: Be,
|
|
598
|
+
value: $.value,
|
|
599
|
+
disabled: re,
|
|
600
|
+
readonly: le,
|
|
601
|
+
onFocus: (lt) => {
|
|
602
|
+
f.value = !0, l("focus", lt);
|
|
603
|
+
}
|
|
604
|
+
}, he), {}, {
|
|
605
|
+
onBlur: ae,
|
|
606
|
+
onCompositionstart: h,
|
|
607
|
+
onCompositionend: J,
|
|
608
|
+
onBeforeinput: ue
|
|
609
|
+
}), null)])]);
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
function we(e) {
|
|
614
|
+
return e != null;
|
|
615
|
+
}
|
|
616
|
+
const jt = (e) => {
|
|
617
|
+
const {
|
|
618
|
+
componentCls: t,
|
|
619
|
+
lineWidth: n,
|
|
620
|
+
lineType: a,
|
|
621
|
+
colorBorder: l,
|
|
622
|
+
borderRadius: i,
|
|
623
|
+
fontSizeLG: c,
|
|
624
|
+
controlHeightLG: f,
|
|
625
|
+
controlHeightSM: d,
|
|
626
|
+
colorError: p,
|
|
627
|
+
inputPaddingHorizontalSM: s,
|
|
628
|
+
colorTextDescription: I,
|
|
629
|
+
motionDurationMid: S,
|
|
630
|
+
colorPrimary: x,
|
|
631
|
+
controlHeight: $,
|
|
632
|
+
inputPaddingHorizontal: E,
|
|
633
|
+
colorBgContainer: M,
|
|
634
|
+
colorTextDisabled: C,
|
|
635
|
+
borderRadiusSM: _,
|
|
636
|
+
borderRadiusLG: N,
|
|
637
|
+
controlWidth: w,
|
|
638
|
+
handleVisible: V
|
|
639
|
+
} = e;
|
|
640
|
+
return [
|
|
641
|
+
{
|
|
642
|
+
[t]: v(v(v(v({}, ze(e)), Ke(e)), Xe(e, t)), {
|
|
643
|
+
display: "inline-block",
|
|
644
|
+
width: w,
|
|
645
|
+
margin: 0,
|
|
646
|
+
padding: 0,
|
|
647
|
+
border: `${n}px ${a} ${l}`,
|
|
648
|
+
borderRadius: i,
|
|
649
|
+
"&-rtl": {
|
|
650
|
+
direction: "rtl",
|
|
651
|
+
[`${t}-input`]: {
|
|
652
|
+
direction: "rtl"
|
|
653
|
+
}
|
|
654
|
+
},
|
|
655
|
+
"&-lg": {
|
|
656
|
+
padding: 0,
|
|
657
|
+
fontSize: c,
|
|
658
|
+
borderRadius: N,
|
|
659
|
+
[`input${t}-input`]: {
|
|
660
|
+
height: f - 2 * n
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
"&-sm": {
|
|
664
|
+
padding: 0,
|
|
665
|
+
borderRadius: _,
|
|
666
|
+
[`input${t}-input`]: {
|
|
667
|
+
height: d - 2 * n,
|
|
668
|
+
padding: `0 ${s}px`
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
"&:hover": v({}, Ze(e)),
|
|
672
|
+
"&-focused": v({}, Ot(e)),
|
|
673
|
+
"&-disabled": v(v({}, Pt(e)), {
|
|
674
|
+
[`${t}-input`]: {
|
|
675
|
+
cursor: "not-allowed"
|
|
676
|
+
}
|
|
677
|
+
}),
|
|
678
|
+
// ===================== Out Of Range =====================
|
|
679
|
+
"&-out-of-range": {
|
|
680
|
+
input: {
|
|
681
|
+
color: p
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
// Style for input-group: input with label, with button or dropdown...
|
|
685
|
+
"&-group": v(v(v({}, ze(e)), _t(e)), {
|
|
686
|
+
"&-wrapper": {
|
|
687
|
+
display: "inline-block",
|
|
688
|
+
textAlign: "start",
|
|
689
|
+
verticalAlign: "top",
|
|
690
|
+
[`${t}-affix-wrapper`]: {
|
|
691
|
+
width: "100%"
|
|
692
|
+
},
|
|
693
|
+
// Size
|
|
694
|
+
"&-lg": {
|
|
695
|
+
[`${t}-group-addon`]: {
|
|
696
|
+
borderRadius: N
|
|
697
|
+
}
|
|
698
|
+
},
|
|
699
|
+
"&-sm": {
|
|
700
|
+
[`${t}-group-addon`]: {
|
|
701
|
+
borderRadius: _
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}),
|
|
706
|
+
[t]: {
|
|
707
|
+
"&-input": v(v({
|
|
708
|
+
width: "100%",
|
|
709
|
+
height: $ - 2 * n,
|
|
710
|
+
padding: `0 ${E}px`,
|
|
711
|
+
textAlign: "start",
|
|
712
|
+
backgroundColor: "transparent",
|
|
713
|
+
border: 0,
|
|
714
|
+
borderRadius: i,
|
|
715
|
+
outline: 0,
|
|
716
|
+
transition: `all ${S} linear`,
|
|
717
|
+
appearance: "textfield",
|
|
718
|
+
color: e.colorText,
|
|
719
|
+
fontSize: "inherit",
|
|
720
|
+
verticalAlign: "top"
|
|
721
|
+
}, Ct(e.colorTextPlaceholder)), {
|
|
722
|
+
'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button': {
|
|
723
|
+
margin: 0,
|
|
724
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
725
|
+
webkitAppearance: "none",
|
|
726
|
+
appearance: "none"
|
|
727
|
+
}
|
|
728
|
+
})
|
|
729
|
+
}
|
|
730
|
+
})
|
|
731
|
+
},
|
|
732
|
+
// Handler
|
|
733
|
+
{
|
|
734
|
+
[t]: {
|
|
735
|
+
[`&:hover ${t}-handler-wrap, &-focused ${t}-handler-wrap`]: {
|
|
736
|
+
opacity: 1
|
|
737
|
+
},
|
|
738
|
+
[`${t}-handler-wrap`]: {
|
|
739
|
+
position: "absolute",
|
|
740
|
+
insetBlockStart: 0,
|
|
741
|
+
insetInlineEnd: 0,
|
|
742
|
+
width: e.handleWidth,
|
|
743
|
+
height: "100%",
|
|
744
|
+
background: M,
|
|
745
|
+
borderStartStartRadius: 0,
|
|
746
|
+
borderStartEndRadius: i,
|
|
747
|
+
borderEndEndRadius: i,
|
|
748
|
+
borderEndStartRadius: 0,
|
|
749
|
+
opacity: V === !0 ? 1 : 0,
|
|
750
|
+
display: "flex",
|
|
751
|
+
flexDirection: "column",
|
|
752
|
+
alignItems: "stretch",
|
|
753
|
+
transition: `opacity ${S} linear ${S}`,
|
|
754
|
+
// Fix input number inside Menu makes icon too large
|
|
755
|
+
// We arise the selector priority by nest selector here
|
|
756
|
+
// https://github.com/ant-design/ant-design/issues/14367
|
|
757
|
+
[`${t}-handler`]: {
|
|
758
|
+
display: "flex",
|
|
759
|
+
alignItems: "center",
|
|
760
|
+
justifyContent: "center",
|
|
761
|
+
flex: "auto",
|
|
762
|
+
height: "40%",
|
|
763
|
+
[`
|
|
764
|
+
${t}-handler-up-inner,
|
|
765
|
+
${t}-handler-down-inner
|
|
766
|
+
`]: {
|
|
767
|
+
marginInlineEnd: 0,
|
|
768
|
+
fontSize: e.handleFontSize
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
[`${t}-handler`]: {
|
|
773
|
+
height: "50%",
|
|
774
|
+
overflow: "hidden",
|
|
775
|
+
color: I,
|
|
776
|
+
fontWeight: "bold",
|
|
777
|
+
lineHeight: 0,
|
|
778
|
+
textAlign: "center",
|
|
779
|
+
cursor: "pointer",
|
|
780
|
+
borderInlineStart: `${n}px ${a} ${l}`,
|
|
781
|
+
transition: `all ${S} linear`,
|
|
782
|
+
"&:active": {
|
|
783
|
+
background: e.colorFillAlter
|
|
784
|
+
},
|
|
785
|
+
// Hover
|
|
786
|
+
"&:hover": {
|
|
787
|
+
height: "60%",
|
|
788
|
+
[`
|
|
789
|
+
${t}-handler-up-inner,
|
|
790
|
+
${t}-handler-down-inner
|
|
791
|
+
`]: {
|
|
792
|
+
color: x
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
"&-up-inner, &-down-inner": v(v({}, ft()), {
|
|
796
|
+
color: I,
|
|
797
|
+
transition: `all ${S} linear`,
|
|
798
|
+
userSelect: "none"
|
|
799
|
+
})
|
|
800
|
+
},
|
|
801
|
+
[`${t}-handler-up`]: {
|
|
802
|
+
borderStartEndRadius: i
|
|
803
|
+
},
|
|
804
|
+
[`${t}-handler-down`]: {
|
|
805
|
+
borderBlockStart: `${n}px ${a} ${l}`,
|
|
806
|
+
borderEndEndRadius: i
|
|
807
|
+
},
|
|
808
|
+
// Disabled
|
|
809
|
+
"&-disabled, &-readonly": {
|
|
810
|
+
[`${t}-handler-wrap`]: {
|
|
811
|
+
display: "none"
|
|
812
|
+
},
|
|
813
|
+
[`${t}-input`]: {
|
|
814
|
+
color: "inherit"
|
|
815
|
+
}
|
|
816
|
+
},
|
|
817
|
+
[`
|
|
818
|
+
${t}-handler-up-disabled,
|
|
819
|
+
${t}-handler-down-disabled
|
|
820
|
+
`]: {
|
|
821
|
+
cursor: "not-allowed"
|
|
822
|
+
},
|
|
823
|
+
[`
|
|
824
|
+
${t}-handler-up-disabled:hover &-handler-up-inner,
|
|
825
|
+
${t}-handler-down-disabled:hover &-handler-down-inner
|
|
826
|
+
`]: {
|
|
827
|
+
color: C
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
// Border-less
|
|
832
|
+
{
|
|
833
|
+
[`${t}-borderless`]: {
|
|
834
|
+
borderColor: "transparent",
|
|
835
|
+
boxShadow: "none",
|
|
836
|
+
[`${t}-handler-down`]: {
|
|
837
|
+
borderBlockStartWidth: 0
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
];
|
|
842
|
+
}, Wt = (e) => {
|
|
843
|
+
const {
|
|
844
|
+
componentCls: t,
|
|
845
|
+
inputPaddingHorizontal: n,
|
|
846
|
+
inputAffixPadding: a,
|
|
847
|
+
controlWidth: l,
|
|
848
|
+
borderRadiusLG: i,
|
|
849
|
+
borderRadiusSM: c
|
|
850
|
+
} = e;
|
|
851
|
+
return {
|
|
852
|
+
[`${t}-affix-wrapper`]: v(v(v({}, Ke(e)), Xe(e, `${t}-affix-wrapper`)), {
|
|
853
|
+
// or number handler will cover form status
|
|
854
|
+
position: "relative",
|
|
855
|
+
display: "inline-flex",
|
|
856
|
+
width: l,
|
|
857
|
+
padding: 0,
|
|
858
|
+
paddingInlineStart: n,
|
|
859
|
+
"&-lg": {
|
|
860
|
+
borderRadius: i
|
|
861
|
+
},
|
|
862
|
+
"&-sm": {
|
|
863
|
+
borderRadius: c
|
|
864
|
+
},
|
|
865
|
+
[`&:not(${t}-affix-wrapper-disabled):hover`]: v(v({}, Ze(e)), {
|
|
866
|
+
zIndex: 1
|
|
867
|
+
}),
|
|
868
|
+
"&-focused, &:focus": {
|
|
869
|
+
zIndex: 1
|
|
870
|
+
},
|
|
871
|
+
"&-disabled": {
|
|
872
|
+
[`${t}[disabled]`]: {
|
|
873
|
+
background: "transparent"
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
[`> div${t}`]: {
|
|
877
|
+
width: "100%",
|
|
878
|
+
border: "none",
|
|
879
|
+
outline: "none",
|
|
880
|
+
[`&${t}-focused`]: {
|
|
881
|
+
boxShadow: "none !important"
|
|
882
|
+
}
|
|
883
|
+
},
|
|
884
|
+
[`input${t}-input`]: {
|
|
885
|
+
padding: 0
|
|
886
|
+
},
|
|
887
|
+
"&::before": {
|
|
888
|
+
width: 0,
|
|
889
|
+
visibility: "hidden",
|
|
890
|
+
content: '"\\a0"'
|
|
891
|
+
},
|
|
892
|
+
[`${t}-handler-wrap`]: {
|
|
893
|
+
zIndex: 2
|
|
894
|
+
},
|
|
895
|
+
[t]: {
|
|
896
|
+
"&-prefix, &-suffix": {
|
|
897
|
+
display: "flex",
|
|
898
|
+
flex: "none",
|
|
899
|
+
alignItems: "center",
|
|
900
|
+
pointerEvents: "none"
|
|
901
|
+
},
|
|
902
|
+
"&-prefix": {
|
|
903
|
+
marginInlineEnd: a
|
|
904
|
+
},
|
|
905
|
+
"&-suffix": {
|
|
906
|
+
position: "absolute",
|
|
907
|
+
insetBlockStart: 0,
|
|
908
|
+
insetInlineEnd: 0,
|
|
909
|
+
zIndex: 1,
|
|
910
|
+
height: "100%",
|
|
911
|
+
marginInlineEnd: n,
|
|
912
|
+
marginInlineStart: a
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
})
|
|
916
|
+
};
|
|
917
|
+
}, Ht = dt("InputNumber", (e) => {
|
|
918
|
+
const t = Et(e);
|
|
919
|
+
return [
|
|
920
|
+
jt(t),
|
|
921
|
+
Wt(t),
|
|
922
|
+
// =====================================================
|
|
923
|
+
// == Space Compact ==
|
|
924
|
+
// =====================================================
|
|
925
|
+
ct(t)
|
|
926
|
+
];
|
|
927
|
+
}, (e) => ({
|
|
928
|
+
controlWidth: 90,
|
|
929
|
+
handleWidth: e.controlHeightSM - e.lineWidth * 2,
|
|
930
|
+
handleFontSize: e.fontSize / 2,
|
|
931
|
+
handleVisible: "auto"
|
|
932
|
+
}));
|
|
933
|
+
var Ut = function(e, t) {
|
|
934
|
+
var n = {};
|
|
935
|
+
for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && t.indexOf(a) < 0 && (n[a] = e[a]);
|
|
936
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, a = Object.getOwnPropertySymbols(e); l < a.length; l++)
|
|
937
|
+
t.indexOf(a[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, a[l]) && (n[a[l]] = e[a[l]]);
|
|
938
|
+
return n;
|
|
939
|
+
};
|
|
940
|
+
const Le = Je(), Gt = () => v(v({}, Le), {
|
|
941
|
+
size: Ee(),
|
|
942
|
+
bordered: F(!0),
|
|
943
|
+
placeholder: String,
|
|
944
|
+
name: String,
|
|
945
|
+
id: String,
|
|
946
|
+
type: String,
|
|
947
|
+
addonBefore: ye.any,
|
|
948
|
+
addonAfter: ye.any,
|
|
949
|
+
prefix: ye.any,
|
|
950
|
+
"onUpdate:value": Le.onChange,
|
|
951
|
+
valueModifiers: Object,
|
|
952
|
+
status: Ee()
|
|
953
|
+
}), xe = Pe({
|
|
954
|
+
compatConfig: {
|
|
955
|
+
MODE: 3
|
|
956
|
+
},
|
|
957
|
+
name: "AInputNumber",
|
|
958
|
+
inheritAttrs: !1,
|
|
959
|
+
props: Gt(),
|
|
960
|
+
// emits: ['focus', 'blur', 'change', 'input', 'update:value'],
|
|
961
|
+
slots: Object,
|
|
962
|
+
setup(e, t) {
|
|
963
|
+
let {
|
|
964
|
+
emit: n,
|
|
965
|
+
expose: a,
|
|
966
|
+
attrs: l,
|
|
967
|
+
slots: i
|
|
968
|
+
} = t;
|
|
969
|
+
var c;
|
|
970
|
+
const f = pt(), d = mt.useInject(), p = j(() => xt(d.status, e.status)), {
|
|
971
|
+
prefixCls: s,
|
|
972
|
+
size: I,
|
|
973
|
+
direction: S,
|
|
974
|
+
disabled: x
|
|
975
|
+
} = gt("input-number", e), {
|
|
976
|
+
compactSize: $,
|
|
977
|
+
compactItemClassnames: E
|
|
978
|
+
} = vt(s, S), M = bt(), C = j(() => {
|
|
979
|
+
var h;
|
|
980
|
+
return (h = x.value) !== null && h !== void 0 ? h : M.value;
|
|
981
|
+
}), [_, N] = Ht(s), w = j(() => $.value || I.value), V = O((c = e.value) !== null && c !== void 0 ? c : e.defaultValue), q = O(!1);
|
|
982
|
+
ee(() => e.value, () => {
|
|
983
|
+
V.value = e.value;
|
|
984
|
+
});
|
|
985
|
+
const K = O(null), X = () => {
|
|
986
|
+
var h;
|
|
987
|
+
(h = K.value) === null || h === void 0 || h.focus();
|
|
988
|
+
};
|
|
989
|
+
a({
|
|
990
|
+
focus: X,
|
|
991
|
+
blur: () => {
|
|
992
|
+
var h;
|
|
993
|
+
(h = K.value) === null || h === void 0 || h.blur();
|
|
994
|
+
}
|
|
995
|
+
});
|
|
996
|
+
const Z = (h) => {
|
|
997
|
+
e.value === void 0 && (V.value = h), n("update:value", h), n("change", h), f.onFieldChange();
|
|
998
|
+
}, se = (h) => {
|
|
999
|
+
q.value = !1, n("blur", h), f.onFieldBlur();
|
|
1000
|
+
}, Y = (h) => {
|
|
1001
|
+
q.value = !0, n("focus", h);
|
|
1002
|
+
};
|
|
1003
|
+
return () => {
|
|
1004
|
+
var h, J, H, U;
|
|
1005
|
+
const {
|
|
1006
|
+
hasFeedback: B,
|
|
1007
|
+
isFormItemInput: ue,
|
|
1008
|
+
feedbackIcon: de
|
|
1009
|
+
} = d, ce = (h = e.id) !== null && h !== void 0 ? h : f.id.value, ae = v(v(v({}, l), e), {
|
|
1010
|
+
id: ce,
|
|
1011
|
+
disabled: C.value
|
|
1012
|
+
}), {
|
|
1013
|
+
class: r,
|
|
1014
|
+
bordered: o,
|
|
1015
|
+
readonly: u,
|
|
1016
|
+
style: m,
|
|
1017
|
+
addonBefore: y = (J = i.addonBefore) === null || J === void 0 ? void 0 : J.call(i),
|
|
1018
|
+
addonAfter: D = (H = i.addonAfter) === null || H === void 0 ? void 0 : H.call(i),
|
|
1019
|
+
prefix: G = (U = i.prefix) === null || U === void 0 ? void 0 : U.call(i),
|
|
1020
|
+
valueModifiers: re = {}
|
|
1021
|
+
} = ae, le = Ut(ae, ["class", "bordered", "readonly", "style", "addonBefore", "addonAfter", "prefix", "valueModifiers"]), g = s.value, fe = W({
|
|
1022
|
+
[`${g}-lg`]: w.value === "large",
|
|
1023
|
+
[`${g}-sm`]: w.value === "small",
|
|
1024
|
+
[`${g}-rtl`]: S.value === "rtl",
|
|
1025
|
+
[`${g}-readonly`]: u,
|
|
1026
|
+
[`${g}-borderless`]: !o,
|
|
1027
|
+
[`${g}-in-form-item`]: ue
|
|
1028
|
+
}, Ie(g, p.value), r, E.value, N.value);
|
|
1029
|
+
let T = b(zt, R(R({}, ht(le, ["size", "defaultValue"])), {}, {
|
|
1030
|
+
ref: K,
|
|
1031
|
+
lazy: !!re.lazy,
|
|
1032
|
+
value: V.value,
|
|
1033
|
+
class: fe,
|
|
1034
|
+
prefixCls: g,
|
|
1035
|
+
readonly: u,
|
|
1036
|
+
onChange: Z,
|
|
1037
|
+
onBlur: se,
|
|
1038
|
+
onFocus: Y
|
|
1039
|
+
}), {
|
|
1040
|
+
upHandler: i.upIcon ? () => b("span", {
|
|
1041
|
+
class: `${g}-handler-up-inner`
|
|
1042
|
+
}, [i.upIcon()]) : () => b(Oe, {
|
|
1043
|
+
class: `${g}-handler-up-inner`
|
|
1044
|
+
}, null),
|
|
1045
|
+
downHandler: i.downIcon ? () => b("span", {
|
|
1046
|
+
class: `${g}-handler-down-inner`
|
|
1047
|
+
}, [i.downIcon()]) : () => b(wt, {
|
|
1048
|
+
class: `${g}-handler-down-inner`
|
|
1049
|
+
}, null)
|
|
1050
|
+
});
|
|
1051
|
+
const pe = we(y) || we(D), me = we(G);
|
|
1052
|
+
if (me || B) {
|
|
1053
|
+
const L = W(`${g}-affix-wrapper`, Ie(`${g}-affix-wrapper`, p.value, B), {
|
|
1054
|
+
[`${g}-affix-wrapper-focused`]: q.value,
|
|
1055
|
+
[`${g}-affix-wrapper-disabled`]: C.value,
|
|
1056
|
+
[`${g}-affix-wrapper-sm`]: w.value === "small",
|
|
1057
|
+
[`${g}-affix-wrapper-lg`]: w.value === "large",
|
|
1058
|
+
[`${g}-affix-wrapper-rtl`]: S.value === "rtl",
|
|
1059
|
+
[`${g}-affix-wrapper-readonly`]: u,
|
|
1060
|
+
[`${g}-affix-wrapper-borderless`]: !o,
|
|
1061
|
+
// className will go to addon wrapper
|
|
1062
|
+
[`${r}`]: !pe && r
|
|
1063
|
+
}, N.value);
|
|
1064
|
+
T = b("div", {
|
|
1065
|
+
class: L,
|
|
1066
|
+
style: m,
|
|
1067
|
+
onClick: X
|
|
1068
|
+
}, [me && b("span", {
|
|
1069
|
+
class: `${g}-prefix`
|
|
1070
|
+
}, [G]), T, B && b("span", {
|
|
1071
|
+
class: `${g}-suffix`
|
|
1072
|
+
}, [de])]);
|
|
1073
|
+
}
|
|
1074
|
+
if (pe) {
|
|
1075
|
+
const L = `${g}-group`, ge = `${L}-addon`, ve = y ? b("div", {
|
|
1076
|
+
class: ge
|
|
1077
|
+
}, [y]) : null, be = D ? b("div", {
|
|
1078
|
+
class: ge
|
|
1079
|
+
}, [D]) : null, Re = W(`${g}-wrapper`, L, {
|
|
1080
|
+
[`${L}-rtl`]: S.value === "rtl"
|
|
1081
|
+
}, N.value), Ve = W(`${g}-group-wrapper`, {
|
|
1082
|
+
[`${g}-group-wrapper-sm`]: w.value === "small",
|
|
1083
|
+
[`${g}-group-wrapper-lg`]: w.value === "large",
|
|
1084
|
+
[`${g}-group-wrapper-rtl`]: S.value === "rtl"
|
|
1085
|
+
}, Ie(`${s}-group-wrapper`, p.value, B), r, N.value);
|
|
1086
|
+
T = b("div", {
|
|
1087
|
+
class: Ve,
|
|
1088
|
+
style: m
|
|
1089
|
+
}, [b("div", {
|
|
1090
|
+
class: Re
|
|
1091
|
+
}, [ve && b(je, null, {
|
|
1092
|
+
default: () => [b(We, null, {
|
|
1093
|
+
default: () => [ve]
|
|
1094
|
+
})]
|
|
1095
|
+
}), T, be && b(je, null, {
|
|
1096
|
+
default: () => [b(We, null, {
|
|
1097
|
+
default: () => [be]
|
|
1098
|
+
})]
|
|
1099
|
+
})])]);
|
|
1100
|
+
}
|
|
1101
|
+
return _(St(T, {
|
|
1102
|
+
style: m
|
|
1103
|
+
}));
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
}), Lt = v(xe, {
|
|
1107
|
+
install: (e) => (e.component(xe.name, xe), e)
|
|
1108
|
+
}), kt = {
|
|
1109
|
+
name: "ZInput",
|
|
1110
|
+
components: {
|
|
1111
|
+
AInput: yt,
|
|
1112
|
+
AInputNumber: Lt,
|
|
1113
|
+
AInputPassword: Nt
|
|
1114
|
+
}
|
|
1115
|
+
}, qt = /* @__PURE__ */ Object.assign(kt, {
|
|
1116
|
+
props: /* @__PURE__ */ it({
|
|
1117
|
+
type: {
|
|
1118
|
+
type: String,
|
|
1119
|
+
default: "text"
|
|
1120
|
+
}
|
|
1121
|
+
}, {
|
|
1122
|
+
modelValue: {},
|
|
1123
|
+
modelModifiers: {}
|
|
1124
|
+
}),
|
|
1125
|
+
emits: ["update:modelValue"],
|
|
1126
|
+
setup(e) {
|
|
1127
|
+
const t = ot(e, "modelValue"), n = e;
|
|
1128
|
+
return (a, l) => {
|
|
1129
|
+
const i = Se("a-input-number"), c = Se("a-input-password"), f = Se("a-input");
|
|
1130
|
+
return (n == null ? void 0 : n.type) === "number" ? (Ne(), $e(i, Te({
|
|
1131
|
+
key: 0,
|
|
1132
|
+
class: "z-input",
|
|
1133
|
+
value: t.value,
|
|
1134
|
+
"onUpdate:value": l[0] || (l[0] = (d) => t.value = d)
|
|
1135
|
+
}, a.$attrs), null, 16, ["value"])) : (n == null ? void 0 : n.type) === "password" ? (Ne(), $e(c, {
|
|
1136
|
+
key: 1,
|
|
1137
|
+
value: t.value,
|
|
1138
|
+
"onUpdate:value": l[1] || (l[1] = (d) => t.value = d),
|
|
1139
|
+
placeholder: "input password"
|
|
1140
|
+
}, null, 8, ["value"])) : (Ne(), $e(f, Te({
|
|
1141
|
+
key: 2,
|
|
1142
|
+
class: "z-input",
|
|
1143
|
+
value: t.value,
|
|
1144
|
+
"onUpdate:value": l[2] || (l[2] = (d) => t.value = d)
|
|
1145
|
+
}, a.$attrs), null, 16, ["value"]));
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
}), tn = /* @__PURE__ */ $t(qt, [["__scopeId", "data-v-d68f7888"]]);
|
|
1149
|
+
export {
|
|
1150
|
+
tn as default
|
|
1151
|
+
};
|