@pantograph/vue 0.30.1 → 0.30.3
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/dist/Base/BaseInput/BaseInput.d.ts +11 -2
- package/dist/BaseInput.vue_vue_type_style_index_0_lang-DdjridzV.js +1 -0
- package/dist/BaseInput.vue_vue_type_style_index_0_lang-Djl15xzS.js +159 -0
- package/dist/Blanket/Blanket.d.ts +11 -0
- package/dist/Blanket/index.d.ts +1 -1
- package/dist/Blanket/index.js +5 -1
- package/dist/Blanket/index.umd.cjs +1 -1
- package/dist/Blanket.vue_vue_type_style_index_0_lang-Dv68meO4.js +22 -0
- package/dist/Blanket.vue_vue_type_style_index_0_lang-WKNPEuJI.js +1 -0
- package/dist/ColorPicker/index.js +2 -2
- package/dist/ColorPicker/index.umd.cjs +1 -1
- package/dist/{ColorPicker.vue_vue_type_style_index_0_lang-DC7OjAIp.js → ColorPicker.vue_vue_type_style_index_0_lang-BVjzmZnp.js} +1 -1
- package/dist/{ColorPicker.vue_vue_type_style_index_0_lang-BbPbMX-k.js → ColorPicker.vue_vue_type_style_index_0_lang-Did8RS1T.js} +1 -1
- package/dist/ColorSwatchGroup/index.js +1 -1
- package/dist/ColorSwatchGroup/index.umd.cjs +1 -1
- package/dist/{ColorSwatchGroup.vue_vue_type_style_index_0_lang-DroX6p45.js → ColorSwatchGroup.vue_vue_type_style_index_0_lang-CDF1AL9P.js} +1 -1
- package/dist/{ColorSwatchGroup.vue_vue_type_style_index_0_lang-B3fzpT99.js → ColorSwatchGroup.vue_vue_type_style_index_0_lang-C_XuCb0R.js} +1 -1
- package/dist/Combobox/index.js +62 -60
- package/dist/Combobox/index.umd.cjs +1 -1
- package/dist/GOPicker/index.js +2 -2
- package/dist/GOPicker/index.umd.cjs +1 -1
- package/dist/Input/Input.d.ts +174 -1
- package/dist/Input/index.js +1 -1
- package/dist/Input/index.umd.cjs +1 -1
- package/dist/Input.vue_vue_type_script_setup_true_lang-ByHGhDsA.js +126 -0
- package/dist/Input.vue_vue_type_script_setup_true_lang-CTIaAkrW.js +1 -0
- package/dist/InputNumber/InputNumber.d.ts +174 -1
- package/dist/InputNumber/index.js +1 -1
- package/dist/InputNumber/index.umd.cjs +1 -1
- package/dist/{InputNumber.vue_vue_type_script_setup_true_lang-Dx8V2Sz8.js → InputNumber.vue_vue_type_script_setup_true_lang-C4GMpH6O.js} +179 -162
- package/dist/InputNumber.vue_vue_type_script_setup_true_lang-DW-JqPiv.js +1 -0
- package/dist/Pagination/index.js +26 -25
- package/dist/Pagination/index.umd.cjs +1 -1
- package/dist/Steps/Step.d.ts +45 -0
- package/dist/Steps/StepLeading.d.ts +2 -0
- package/dist/Steps/Steps.d.ts +50 -0
- package/dist/Steps/index.d.ts +5 -1
- package/dist/Steps/index.js +247 -1
- package/dist/Steps/index.umd.cjs +1 -1
- package/dist/index.js +375 -360
- package/dist/index.umd.cjs +1 -1
- package/dist/style/index.css +1 -1
- package/dist/use/index.js +400 -359
- package/dist/use/index.umd.cjs +1 -1
- package/package.json +54 -51
- package/dist/BaseInput.vue_vue_type_style_index_0_lang-D3zq7oKh.js +0 -1
- package/dist/BaseInput.vue_vue_type_style_index_0_lang-aX7hcK86.js +0 -136
- package/dist/Input.vue_vue_type_script_setup_true_lang-DW0Xc_1z.js +0 -112
- package/dist/Input.vue_vue_type_script_setup_true_lang-DoaHfVrM.js +0 -1
- package/dist/InputNumber.vue_vue_type_script_setup_true_lang-URIsXuko.js +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (i, e, n) =>
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { getComponentOptions as
|
|
6
|
-
import { i as
|
|
7
|
-
import { useFormInput as
|
|
8
|
-
import { omitBy as
|
|
9
|
-
import { _ as
|
|
10
|
-
function
|
|
1
|
+
var Be = Object.defineProperty;
|
|
2
|
+
var De = (i, e, n) => e in i ? Be(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
|
+
var m = (i, e, n) => De(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { defineComponent as xe, useSlots as _e, useAttrs as Me, ref as re, onMounted as se, shallowRef as ae, computed as N, onBeforeUnmount as Ve, watch as F, createBlock as ze, openBlock as Re, mergeProps as oe, createSlots as Ae, withCtx as M, createElementVNode as V, unref as S, createTextVNode as ke, toDisplayString as Fe, renderList as Ce, renderSlot as Te, normalizeProps as qe, guardReactiveProps as Pe, normalizeClass as C, createVNode as le, nextTick as Ge } from "vue";
|
|
5
|
+
import { getComponentOptions as Le, getBemElement as z, isEmptyLikeLodash as Ue, normCls as We } from "@pantograph/utils";
|
|
6
|
+
import { i as ue, I as Xe, u as Oe, _ as je } from "./BaseInput.vue_vue_type_style_index_0_lang-Djl15xzS.js";
|
|
7
|
+
import { useFormInput as Ke, useInputDataStates as Ze } from "@pantograph/utils-vue";
|
|
8
|
+
import { omitBy as ce, isUndefined as de, omit as He, pick as Je } from "es-toolkit";
|
|
9
|
+
import { _ as me } from "./Icon.vue_vue_type_style_index_0_lang-CD9EvvB5.js";
|
|
10
|
+
function T() {
|
|
11
11
|
return typeof BigInt == "function";
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function B(i) {
|
|
14
14
|
let e = i.trim(), n = e.startsWith("-");
|
|
15
15
|
n && (e = e.slice(1)), e = e.replace(/(?<nonZeroDecimal>\.\d*[^0])0*$/, "$<nonZeroDecimal>").replace(/\.0*$/, "").replace(/^0+/, ""), e.startsWith(".") && (e = `0${e}`);
|
|
16
16
|
const r = e || "0", l = r.split("."), o = l[0] || "0", f = l[1] || "0";
|
|
@@ -25,33 +25,33 @@ function w(i) {
|
|
|
25
25
|
fullStr: `${d}${r}`
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function P(i) {
|
|
29
29
|
if (i == null) return !1;
|
|
30
30
|
const e = String(i);
|
|
31
31
|
return !Number.isNaN(Number(e)) && e.includes("e");
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function D(i) {
|
|
34
34
|
const e = String(i);
|
|
35
|
-
if (
|
|
35
|
+
if (P(i)) {
|
|
36
36
|
let n = Number(e.slice(e.indexOf("e-") + 2));
|
|
37
37
|
const r = e.match(/\.(?<decimals>\d+)/);
|
|
38
38
|
return r != null && r[1] && (n += r[1].length), n;
|
|
39
39
|
}
|
|
40
|
-
return e.includes(".") &&
|
|
40
|
+
return e.includes(".") && L(e) ? e.length - e.indexOf(".") - 1 : 0;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function G(i) {
|
|
43
43
|
if (i == null) return "";
|
|
44
44
|
let e = String(i);
|
|
45
|
-
if (
|
|
45
|
+
if (P(i)) {
|
|
46
46
|
if (i > Number.MAX_SAFE_INTEGER)
|
|
47
|
-
return String(
|
|
47
|
+
return String(T() ? BigInt(i).toString() : Number.MAX_SAFE_INTEGER);
|
|
48
48
|
if (i < Number.MIN_SAFE_INTEGER)
|
|
49
|
-
return String(
|
|
50
|
-
e = i.toFixed(
|
|
49
|
+
return String(T() ? BigInt(i).toString() : Number.MIN_SAFE_INTEGER);
|
|
50
|
+
e = i.toFixed(D(e));
|
|
51
51
|
}
|
|
52
|
-
return
|
|
52
|
+
return B(e).fullStr;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function L(i) {
|
|
55
55
|
return typeof i == "number" ? !Number.isNaN(i) : i ? (
|
|
56
56
|
// Normal type: 11.28
|
|
57
57
|
/^\s*-?\d+(?<decimals>\.\d+)?\s*$/.test(i) || // Pre-number: 1.
|
|
@@ -59,7 +59,7 @@ function G(i) {
|
|
|
59
59
|
/^\s*-?\.\d+\s*$/.test(i)
|
|
60
60
|
) : !1;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function pe(i) {
|
|
63
63
|
return !i && i !== 0 && !Number.isNaN(i) || !String(i).trim();
|
|
64
64
|
}
|
|
65
65
|
class b {
|
|
@@ -67,7 +67,7 @@ class b {
|
|
|
67
67
|
m(this, "origin", "");
|
|
68
68
|
m(this, "number");
|
|
69
69
|
m(this, "empty");
|
|
70
|
-
if (
|
|
70
|
+
if (pe(e)) {
|
|
71
71
|
this.empty = !0;
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
@@ -87,7 +87,7 @@ class b {
|
|
|
87
87
|
return new b(Number.MAX_SAFE_INTEGER);
|
|
88
88
|
if (r < Number.MIN_SAFE_INTEGER)
|
|
89
89
|
return new b(Number.MIN_SAFE_INTEGER);
|
|
90
|
-
const l = Math.max(
|
|
90
|
+
const l = Math.max(D(this.number), D(n));
|
|
91
91
|
return new b(r.toFixed(l));
|
|
92
92
|
}
|
|
93
93
|
isEmpty() {
|
|
@@ -110,10 +110,10 @@ class b {
|
|
|
110
110
|
return this.number;
|
|
111
111
|
}
|
|
112
112
|
toString() {
|
|
113
|
-
return this.isInvalidate() ? "" :
|
|
113
|
+
return this.isInvalidate() ? "" : G(this.number);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
class
|
|
116
|
+
class I {
|
|
117
117
|
constructor(e) {
|
|
118
118
|
m(this, "origin", "");
|
|
119
119
|
m(this, "negative");
|
|
@@ -123,7 +123,7 @@ class y {
|
|
|
123
123
|
m(this, "decimalLen");
|
|
124
124
|
m(this, "empty");
|
|
125
125
|
m(this, "nan");
|
|
126
|
-
if (
|
|
126
|
+
if (pe(e)) {
|
|
127
127
|
this.empty = !0;
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
@@ -132,8 +132,8 @@ class y {
|
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
let n = e;
|
|
135
|
-
if (
|
|
136
|
-
const r =
|
|
135
|
+
if (P(n) && (n = Number(n)), n = typeof n == "string" ? n : G(n), L(n)) {
|
|
136
|
+
const r = B(n);
|
|
137
137
|
this.negative = r.negative;
|
|
138
138
|
const l = r.trimStr.split(".");
|
|
139
139
|
this.integer = BigInt(l[0]);
|
|
@@ -165,18 +165,18 @@ class y {
|
|
|
165
165
|
return BigInt(n);
|
|
166
166
|
}
|
|
167
167
|
negate() {
|
|
168
|
-
const e = new
|
|
168
|
+
const e = new I(this.toString());
|
|
169
169
|
return e.negative = !e.negative, e;
|
|
170
170
|
}
|
|
171
171
|
add(e) {
|
|
172
172
|
if (this.isInvalidate())
|
|
173
|
-
return new
|
|
174
|
-
const n = new
|
|
173
|
+
return new I(e);
|
|
174
|
+
const n = new I(e);
|
|
175
175
|
if (n.isInvalidate())
|
|
176
176
|
return this;
|
|
177
|
-
const r = Math.max(this.getDecimalStr().length, n.getDecimalStr().length), l = this.alignDecimal(r), o = n.alignDecimal(r), f = (l + o).toString(), { negativeStr: d, trimStr: c } =
|
|
178
|
-
return new
|
|
179
|
-
`${
|
|
177
|
+
const r = Math.max(this.getDecimalStr().length, n.getDecimalStr().length), l = this.alignDecimal(r), o = n.alignDecimal(r), f = (l + o).toString(), { negativeStr: d, trimStr: c } = B(f), h = `${d}${c.padStart(r + 1, "0")}`;
|
|
178
|
+
return new I(
|
|
179
|
+
`${h.slice(0, -r)}.${h.slice(-r)}`
|
|
180
180
|
);
|
|
181
181
|
}
|
|
182
182
|
isEmpty() {
|
|
@@ -199,34 +199,34 @@ class y {
|
|
|
199
199
|
return this.isNaN() ? NaN : Number(this.toString());
|
|
200
200
|
}
|
|
201
201
|
toString() {
|
|
202
|
-
return this.isInvalidate() ? "" :
|
|
202
|
+
return this.isInvalidate() ? "" : B(`${this.getMark()}${this.getIntegerStr()}.${this.getDecimalStr()}`).fullStr;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
return
|
|
205
|
+
function v(i) {
|
|
206
|
+
return T() ? new I(i) : new b(i);
|
|
207
207
|
}
|
|
208
|
-
const
|
|
209
|
-
const e =
|
|
208
|
+
const fe = (i) => {
|
|
209
|
+
const e = v(i);
|
|
210
210
|
return e.isInvalidate() ? void 0 : e;
|
|
211
211
|
};
|
|
212
212
|
function q(i, e, n, r = !1) {
|
|
213
213
|
if (i === "")
|
|
214
214
|
return "";
|
|
215
|
-
const { negativeStr: l, integerStr: o, decimalStr: f } =
|
|
215
|
+
const { negativeStr: l, integerStr: o, decimalStr: f } = B(i), d = `${e}${f}`, c = `${l}${o}`;
|
|
216
216
|
if (n && n >= 0) {
|
|
217
|
-
const
|
|
218
|
-
if (
|
|
219
|
-
const
|
|
220
|
-
`${l}0.${"0".repeat(n)}${10 -
|
|
217
|
+
const h = Number(f[n]);
|
|
218
|
+
if (h >= 5 && !r) {
|
|
219
|
+
const x = v(i).add(
|
|
220
|
+
`${l}0.${"0".repeat(n)}${10 - h}`
|
|
221
221
|
);
|
|
222
|
-
return q(
|
|
222
|
+
return q(x.toString(), e, n, r);
|
|
223
223
|
}
|
|
224
224
|
return n === 0 ? c : `${c}${e}${f.padEnd(n, "0").slice(0, n)}`;
|
|
225
225
|
}
|
|
226
226
|
return d === ".0" ? c : `${c}${d}`;
|
|
227
227
|
}
|
|
228
|
-
const
|
|
229
|
-
...
|
|
228
|
+
const Qe = ["aria-valuemin", "aria-valuemax", "value"], Ye = ["data-disabled"], et = ["data-disabled"], lt = /* @__PURE__ */ xe({
|
|
229
|
+
...Le("Input", !1),
|
|
230
230
|
__name: "InputNumber",
|
|
231
231
|
props: {
|
|
232
232
|
id: {},
|
|
@@ -254,139 +254,139 @@ const Ze = ["aria-valuemin", "aria-valuemax", "value"], je = ["data-disabled"],
|
|
|
254
254
|
simple: { type: Boolean },
|
|
255
255
|
size: {},
|
|
256
256
|
status: {},
|
|
257
|
-
steps: { type: Boolean }
|
|
257
|
+
steps: { type: Boolean },
|
|
258
|
+
contentFit: { type: Boolean }
|
|
258
259
|
},
|
|
259
|
-
emits: ["update:modelValue", "change", "input", "keydownEnter", "step", "blur", "focus", "clear"],
|
|
260
|
+
emits: ["update:modelValue", "change", "input", "keydownEnter", "step", "blur", "focus", "clear", "resize"],
|
|
260
261
|
setup(i, { expose: e, emit: n }) {
|
|
261
|
-
const r = i, l =
|
|
262
|
-
getSize: () => r.size &&
|
|
263
|
-
}),
|
|
264
|
-
r.immediateFocus &&
|
|
262
|
+
const r = i, l = _e(), o = n, f = Me(), d = z(ue, "number_steps"), { getDisabled: c, getStatus: h, getSize: x } = Ke({
|
|
263
|
+
getSize: () => r.size && Xe.includes(r.size) ? r.size : "md"
|
|
264
|
+
}), y = re();
|
|
265
|
+
r.immediateFocus && se(() => {
|
|
265
266
|
var t, s;
|
|
266
|
-
return (s = (t =
|
|
267
|
+
return (s = (t = y.value) == null ? void 0 : t.focus) == null ? void 0 : s.call(t);
|
|
267
268
|
});
|
|
268
|
-
const u =
|
|
269
|
-
X(void 0),
|
|
269
|
+
const u = ae(v(r.modelValue)), p = ae(""), $ = N(() => fe(r.max)), w = N(() => fe(r.min)), U = N(() => c.value ? !0 : !w.value || !u.value || u.value.isInvalidate() ? !1 : u.value.lessEquals(w.value)), W = N(() => c.value ? !0 : !$.value || !u.value || u.value.isInvalidate() ? !1 : $.value.lessEquals(u.value)), ge = () => {
|
|
270
|
+
X(void 0), p.value = "", o("clear");
|
|
270
271
|
}, X = (t) => {
|
|
271
|
-
|
|
272
|
-
}, O = (t) => Math.max(
|
|
273
|
-
let s = typeof t == "number" ?
|
|
272
|
+
R = !0, o("update:modelValue", t), o("change", t), Ge(() => R = !1);
|
|
273
|
+
}, O = (t) => Math.max(D(t), D(r.step)), j = (t) => {
|
|
274
|
+
let s = typeof t == "number" ? G(t) : t;
|
|
274
275
|
const a = O(s);
|
|
275
|
-
return
|
|
276
|
+
return L(s) && (!a || a >= 0) && (s = q(s, ".", a)), s;
|
|
276
277
|
}, K = (t) => {
|
|
277
|
-
|
|
278
|
+
p.value = j(
|
|
278
279
|
(t.isInvalidate(), t.toString())
|
|
279
280
|
);
|
|
280
|
-
},
|
|
281
|
+
}, ve = () => {
|
|
281
282
|
const t = r.modelValue;
|
|
282
|
-
return u.value.isInvalidate() && ["string", "number"].includes(typeof t) ? Number.isNaN(t) ? "" : (t == null ? void 0 : t.toString()) ?? "" :
|
|
283
|
+
return u.value.isInvalidate() && ["string", "number"].includes(typeof t) ? Number.isNaN(t) ? "" : (t == null ? void 0 : t.toString()) ?? "" : j(u.value.toString());
|
|
283
284
|
};
|
|
284
|
-
|
|
285
|
+
p.value = ve();
|
|
285
286
|
const Z = (t) => {
|
|
286
|
-
if (
|
|
287
|
-
return I.value;
|
|
288
|
-
if ($.value && !$.value.lessEquals(t))
|
|
287
|
+
if ($.value && !t.lessEquals($.value))
|
|
289
288
|
return $.value;
|
|
290
|
-
|
|
289
|
+
if (w.value && !w.value.lessEquals(t))
|
|
290
|
+
return w.value;
|
|
291
|
+
}, H = (t) => {
|
|
291
292
|
u.value = t, K(t);
|
|
292
|
-
},
|
|
293
|
-
let
|
|
294
|
-
const
|
|
295
|
-
t.equals(u.value) || (
|
|
296
|
-
},
|
|
297
|
-
let s = t, a =
|
|
293
|
+
}, Se = (t) => !Z(t);
|
|
294
|
+
let R = !1;
|
|
295
|
+
const J = (t) => {
|
|
296
|
+
t.equals(u.value) || (H(t), X(t.isEmpty() ? void 0 : t.toNumber()));
|
|
297
|
+
}, A = (t) => {
|
|
298
|
+
let s = t, a = Se(s) || s.isEmpty();
|
|
298
299
|
if (s.isEmpty() || (s = Z(s) || s, a = !0), !r.readonly && !r.disabled && a) {
|
|
299
|
-
const
|
|
300
|
-
return (!E || E >= 0) && (s =
|
|
300
|
+
const g = s.toString(), E = O(g);
|
|
301
|
+
return (!E || E >= 0) && (s = v(q(g, ".", E))), s;
|
|
301
302
|
}
|
|
302
303
|
return u.value;
|
|
303
304
|
};
|
|
304
305
|
let k;
|
|
305
|
-
const
|
|
306
|
+
const _ = () => {
|
|
306
307
|
clearTimeout(k), k = void 0;
|
|
307
|
-
},
|
|
308
|
+
}, Q = (t) => {
|
|
308
309
|
var E;
|
|
309
|
-
if (t &&
|
|
310
|
-
|
|
310
|
+
if (t && W.value || !t && U.value) {
|
|
311
|
+
_();
|
|
311
312
|
return;
|
|
312
313
|
}
|
|
313
|
-
let s =
|
|
314
|
+
let s = v(r.step);
|
|
314
315
|
t || (s = s.negate());
|
|
315
|
-
const a = (u.value ||
|
|
316
|
-
|
|
316
|
+
const a = (u.value || v(0)).add(s.toString()), g = A(a);
|
|
317
|
+
J(g), o("step", {
|
|
317
318
|
offset: r.step ?? 1,
|
|
318
319
|
type: t ? "up" : "down"
|
|
319
|
-
}), (E =
|
|
320
|
-
},
|
|
320
|
+
}), (E = y.value) == null || E.focus();
|
|
321
|
+
}, Y = (t, s) => {
|
|
321
322
|
t.preventDefault();
|
|
322
323
|
function a() {
|
|
323
|
-
k = setTimeout(a, 200),
|
|
324
|
+
k = setTimeout(a, 200), Q(s);
|
|
324
325
|
}
|
|
325
326
|
a();
|
|
326
327
|
};
|
|
327
|
-
|
|
328
|
-
const
|
|
329
|
-
const t =
|
|
328
|
+
Ve(_);
|
|
329
|
+
const ee = (t) => String(t).replace(/[^\w.-]+/g, ""), te = () => {
|
|
330
|
+
const t = v(ee(p.value));
|
|
330
331
|
let s = t;
|
|
331
|
-
t.isNaN() ? s = u.value : (s =
|
|
332
|
-
},
|
|
332
|
+
t.isNaN() ? s = u.value : (s = A(t), J(s)), K(s);
|
|
333
|
+
}, he = (t) => {
|
|
333
334
|
const s = t.target.value;
|
|
334
|
-
|
|
335
|
-
const a =
|
|
336
|
-
|
|
337
|
-
},
|
|
335
|
+
p.value = s;
|
|
336
|
+
const a = ee(s), g = v(a);
|
|
337
|
+
g.isNaN() || A(g), o("input", t);
|
|
338
|
+
}, Ne = (t) => {
|
|
338
339
|
const { key: s } = t;
|
|
339
|
-
s === "Enter" && (
|
|
340
|
+
s === "Enter" && (te(), o("keydownEnter", t)), ["ArrowDown", "ArrowUp"].includes(s) && (Q(s === "ArrowUp"), t.preventDefault());
|
|
340
341
|
};
|
|
341
|
-
|
|
342
|
+
F(
|
|
342
343
|
() => r.modelValue,
|
|
343
344
|
() => {
|
|
344
|
-
if (!
|
|
345
|
-
const t =
|
|
346
|
-
|
|
345
|
+
if (!R) {
|
|
346
|
+
const t = v(r.modelValue);
|
|
347
|
+
H(t);
|
|
347
348
|
}
|
|
348
349
|
}
|
|
349
350
|
);
|
|
350
351
|
const {
|
|
351
|
-
focused:
|
|
352
|
-
rootBindings:
|
|
353
|
-
inputBindings:
|
|
354
|
-
} =
|
|
352
|
+
focused: be,
|
|
353
|
+
rootBindings: ye,
|
|
354
|
+
inputBindings: Ee
|
|
355
|
+
} = Ze({
|
|
355
356
|
getDisabled: () => c.value,
|
|
356
357
|
emit: o,
|
|
357
|
-
blurCallBack:
|
|
358
|
+
blurCallBack: te
|
|
358
359
|
});
|
|
359
|
-
|
|
360
|
+
F(
|
|
360
361
|
() => r.disabled,
|
|
361
362
|
(t) => {
|
|
362
|
-
t && (
|
|
363
|
+
t && (be.value = !1);
|
|
363
364
|
}
|
|
364
365
|
);
|
|
365
|
-
const
|
|
366
|
-
() =>
|
|
366
|
+
const Ie = N(
|
|
367
|
+
() => ce(
|
|
367
368
|
{
|
|
368
|
-
...
|
|
369
|
-
...Ne.value,
|
|
369
|
+
...ye.value,
|
|
370
370
|
...r,
|
|
371
371
|
disabled: c.value,
|
|
372
|
-
status:
|
|
373
|
-
size:
|
|
374
|
-
hasValue: !
|
|
372
|
+
status: h.value,
|
|
373
|
+
size: x.value,
|
|
374
|
+
hasValue: !Ue(p.value)
|
|
375
375
|
},
|
|
376
|
-
|
|
376
|
+
de
|
|
377
377
|
)
|
|
378
|
-
),
|
|
379
|
-
() =>
|
|
378
|
+
), $e = N(
|
|
379
|
+
() => ce(
|
|
380
380
|
{
|
|
381
|
-
...
|
|
381
|
+
...Je(r, ["id", "type", "disabled", "required", "placeholder", "readonly"]),
|
|
382
382
|
disabled: c.value,
|
|
383
|
-
...
|
|
384
|
-
...
|
|
383
|
+
...He(f, ["value"]),
|
|
384
|
+
...Ee.value
|
|
385
385
|
},
|
|
386
|
-
|
|
386
|
+
de
|
|
387
387
|
)
|
|
388
|
-
),
|
|
389
|
-
switch (
|
|
388
|
+
), ne = N(() => {
|
|
389
|
+
switch (x.value) {
|
|
390
390
|
case "sm":
|
|
391
391
|
return 12;
|
|
392
392
|
case "lg":
|
|
@@ -394,64 +394,81 @@ const Ze = ["aria-valuemin", "aria-valuemax", "value"], je = ["data-disabled"],
|
|
|
394
394
|
default:
|
|
395
395
|
return 14;
|
|
396
396
|
}
|
|
397
|
-
})
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
397
|
+
}), ie = re(), we = (t) => {
|
|
398
|
+
y.value && (y.value.style.width = `${t}px`, o("resize", t));
|
|
399
|
+
};
|
|
400
|
+
return se(() => {
|
|
401
|
+
F(
|
|
402
|
+
p,
|
|
403
|
+
() => {
|
|
404
|
+
var t, s;
|
|
405
|
+
(s = (t = ie.value) == null ? void 0 : t.adjustWidth) == null || s.call(t);
|
|
406
|
+
},
|
|
407
|
+
{ immediate: !0, flush: "post" }
|
|
408
|
+
);
|
|
409
|
+
}), e(Oe(y)), (t, s) => (Re(), ze(je, oe(Ie.value, {
|
|
410
|
+
onClear: ge,
|
|
411
|
+
steps: r.controls,
|
|
412
|
+
ref_key: "rootRef",
|
|
413
|
+
ref: ie,
|
|
414
|
+
onResize: we
|
|
415
|
+
}), Ae({
|
|
416
|
+
value: M(() => [
|
|
417
|
+
ke(Fe(p.value || t.placeholder), 1)
|
|
418
|
+
]),
|
|
419
|
+
default: M(() => [
|
|
420
|
+
V("input", oe({
|
|
404
421
|
ref_key: "inputRef",
|
|
405
|
-
ref:
|
|
406
|
-
},
|
|
407
|
-
class:
|
|
422
|
+
ref: y
|
|
423
|
+
}, $e.value, {
|
|
424
|
+
class: S(We)(S(z)(S(ue), "input")),
|
|
408
425
|
autocomplete: "off",
|
|
409
426
|
role: "spinbutton",
|
|
410
427
|
"aria-valuemin": t.min,
|
|
411
428
|
"aria-valuemax": t.max,
|
|
412
|
-
value:
|
|
413
|
-
onInput:
|
|
414
|
-
onKeydown:
|
|
415
|
-
}), null, 16,
|
|
429
|
+
value: p.value,
|
|
430
|
+
onInput: he,
|
|
431
|
+
onKeydown: Ne
|
|
432
|
+
}), null, 16, Qe)
|
|
416
433
|
]),
|
|
417
434
|
_: 2
|
|
418
435
|
}, [
|
|
419
|
-
|
|
436
|
+
Ce(Object.keys(l), (a) => ({
|
|
420
437
|
name: a,
|
|
421
|
-
fn:
|
|
422
|
-
|
|
438
|
+
fn: M((g) => [
|
|
439
|
+
Te(t.$slots, a, qe(Pe(g)))
|
|
423
440
|
])
|
|
424
441
|
})),
|
|
425
442
|
r.controls ? {
|
|
426
443
|
name: "extra",
|
|
427
|
-
fn:
|
|
428
|
-
|
|
429
|
-
class:
|
|
430
|
-
onMouseup:
|
|
431
|
-
onMouseleave:
|
|
444
|
+
fn: M(() => [
|
|
445
|
+
V("div", {
|
|
446
|
+
class: C(S(d)),
|
|
447
|
+
onMouseup: _,
|
|
448
|
+
onMouseleave: _
|
|
432
449
|
}, [
|
|
433
|
-
|
|
450
|
+
V("span", {
|
|
434
451
|
role: "button",
|
|
435
|
-
class:
|
|
436
|
-
"data-disabled":
|
|
437
|
-
onMousedown: s[0] || (s[0] = (a) =>
|
|
452
|
+
class: C(S(z)(S(d), "up")),
|
|
453
|
+
"data-disabled": W.value,
|
|
454
|
+
onMousedown: s[0] || (s[0] = (a) => Y(a, !0))
|
|
438
455
|
}, [
|
|
439
|
-
|
|
456
|
+
le(me, {
|
|
440
457
|
icon: "tabler:chevron-up",
|
|
441
|
-
size:
|
|
458
|
+
size: ne.value
|
|
442
459
|
}, null, 8, ["size"])
|
|
443
|
-
], 42,
|
|
444
|
-
|
|
460
|
+
], 42, Ye),
|
|
461
|
+
V("span", {
|
|
445
462
|
role: "button",
|
|
446
|
-
class:
|
|
447
|
-
"data-disabled":
|
|
448
|
-
onMousedown: s[1] || (s[1] = (a) =>
|
|
463
|
+
class: C(S(z)(S(d), "down")),
|
|
464
|
+
"data-disabled": U.value,
|
|
465
|
+
onMousedown: s[1] || (s[1] = (a) => Y(a, !1))
|
|
449
466
|
}, [
|
|
450
|
-
|
|
467
|
+
le(me, {
|
|
451
468
|
icon: "tabler:chevron-down",
|
|
452
|
-
size:
|
|
469
|
+
size: ne.value
|
|
453
470
|
}, null, 8, ["size"])
|
|
454
|
-
], 42,
|
|
471
|
+
], 42, et)
|
|
455
472
|
], 34)
|
|
456
473
|
]),
|
|
457
474
|
key: "0"
|
|
@@ -460,5 +477,5 @@ const Ze = ["aria-valuemin", "aria-valuemax", "value"], je = ["data-disabled"],
|
|
|
460
477
|
}
|
|
461
478
|
});
|
|
462
479
|
export {
|
|
463
|
-
|
|
480
|
+
lt as _
|
|
464
481
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var ve=Object.defineProperty;var he=(r,e,i)=>e in r?ve(r,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[e]=i;var f=(r,e,i)=>he(r,typeof e!="symbol"?e+"":e,i);const n=require("vue"),N=require("@pantograph/utils"),$=require("./BaseInput.vue_vue_type_style_index_0_lang-DdjridzV.js"),te=require("@pantograph/utils-vue"),I=require("es-toolkit"),ne=require("./Icon.vue_vue_type_style_index_0_lang-DOQsa_aO.js");function C(){return typeof BigInt=="function"}function x(r){let e=r.trim(),i=e.startsWith("-");i&&(e=e.slice(1)),e=e.replace(/(?<nonZeroDecimal>\.\d*[^0])0*$/,"$<nonZeroDecimal>").replace(/\.0*$/,"").replace(/^0+/,""),e.startsWith(".")&&(e=`0${e}`);const s=e||"0",l=s.split("."),u=l[0]||"0",p=l[1]||"0";u==="0"&&p==="0"&&(i=!1);const m=i?"-":"";return{negative:i,negativeStr:m,trimStr:s,integerStr:u,decimalStr:p,fullStr:`${m}${s}`}}function q(r){if(r==null)return!1;const e=String(r);return!Number.isNaN(Number(e))&&e.includes("e")}function D(r){const e=String(r);if(q(r)){let i=Number(e.slice(e.indexOf("e-")+2));const s=e.match(/\.(?<decimals>\d+)/);return s!=null&&s[1]&&(i+=s[1].length),i}return e.includes(".")&&T(e)?e.length-e.indexOf(".")-1:0}function F(r){if(r==null)return"";let e=String(r);if(q(r)){if(r>Number.MAX_SAFE_INTEGER)return String(C()?BigInt(r).toString():Number.MAX_SAFE_INTEGER);if(r<Number.MIN_SAFE_INTEGER)return String(C()?BigInt(r).toString():Number.MIN_SAFE_INTEGER);e=r.toFixed(D(e))}return x(e).fullStr}function T(r){return typeof r=="number"?!Number.isNaN(r):r?/^\s*-?\d+(?<decimals>\.\d+)?\s*$/.test(r)||/^\s*-?\d+\.\s*$/.test(r)||/^\s*-?\.\d+\s*$/.test(r):!1}function re(r){return!r&&r!==0&&!Number.isNaN(r)||!String(r).trim()}class b{constructor(e){f(this,"origin","");f(this,"number");f(this,"empty");if(re(e)){this.empty=!0;return}this.origin=String(e),this.number=Number(e)}negate(){return new b(this.empty?void 0:-this.toNumber())}add(e){if(this.isInvalidate())return new b(e);const i=Number(e);if(Number.isNaN(i))return this;const s=this.number+i;if(s>Number.MAX_SAFE_INTEGER)return new b(Number.MAX_SAFE_INTEGER);if(s<Number.MIN_SAFE_INTEGER)return new b(Number.MIN_SAFE_INTEGER);const l=Math.max(D(this.number),D(i));return new b(s.toFixed(l))}isEmpty(){return!!this.empty}isNaN(){return Number.isNaN(this.number)}isInvalidate(){return this.isEmpty()||this.isNaN()}equals(e){return this.toNumber()===(e==null?void 0:e.toNumber())}lessEquals(e){const i=this.add(e.negate().toString()).toNumber();return i!==void 0&&i<=0}toNumber(){return this.number}toString(){return this.isInvalidate()?"":F(this.number)}}class _{constructor(e){f(this,"origin","");f(this,"negative");f(this,"integer");f(this,"decimal");f(this,"decimalLen");f(this,"empty");f(this,"nan");if(re(e)){this.empty=!0;return}if(this.origin=String(e),e==="-"||Number.isNaN(e)){this.nan=!0;return}let i=e;if(q(i)&&(i=Number(i)),i=typeof i=="string"?i:F(i),T(i)){const s=x(i);this.negative=s.negative;const l=s.trimStr.split(".");this.integer=BigInt(l[0]);const u=l[1]||"0";this.decimal=BigInt(u),this.decimalLen=u.length}else this.nan=!0}getMark(){return this.negative?"-":""}getIntegerStr(){var e;return((e=this.integer)==null?void 0:e.toString())??""}getDecimalStr(){var e;return((e=this.decimal)==null?void 0:e.toString().padStart(this.decimalLen??0,"0"))??""}alignDecimal(e){const i=`${this.getMark()}${this.getIntegerStr()}${this.getDecimalStr().padEnd(e,"0")}`;return BigInt(i)}negate(){const e=new _(this.toString());return e.negative=!e.negative,e}add(e){if(this.isInvalidate())return new _(e);const i=new _(e);if(i.isInvalidate())return this;const s=Math.max(this.getDecimalStr().length,i.getDecimalStr().length),l=this.alignDecimal(s),u=i.alignDecimal(s),p=(l+u).toString(),{negativeStr:m,trimStr:d}=x(p),S=`${m}${d.padStart(s+1,"0")}`;return new _(`${S.slice(0,-s)}.${S.slice(-s)}`)}isEmpty(){return!!this.empty}isNaN(){return!!this.nan}isInvalidate(){return this.isEmpty()||this.isNaN()}equals(e){return this.toString()===(e==null?void 0:e.toString())}lessEquals(e){const i=this.add(e.negate().toString()).toNumber();return i!==void 0&&i<=0}toNumber(){return this.isNaN()?NaN:Number(this.toString())}toString(){return this.isInvalidate()?"":x(`${this.getMark()}${this.getIntegerStr()}.${this.getDecimalStr()}`).fullStr}}function h(r){return C()?new _(r):new b(r)}const ie=r=>{const e=h(r);return e.isInvalidate()?void 0:e};function k(r,e,i,s=!1){if(r==="")return"";const{negativeStr:l,integerStr:u,decimalStr:p}=x(r),m=`${e}${p}`,d=`${l}${u}`;if(i&&i>=0){const S=Number(p[i]);if(S>=5&&!s){const V=h(r).add(`${l}0.${"0".repeat(i)}${10-S}`);return k(V.toString(),e,i,s)}return i===0?d:`${d}${e}${p.padEnd(i,"0").slice(0,i)}`}return m===".0"?d:`${d}${m}`}const Se=["aria-valuemin","aria-valuemax","value"],Ne=["data-disabled"],be=["data-disabled"],ye=n.defineComponent({...N.getComponentOptions("Input",!1),__name:"InputNumber",props:{id:{},type:{},placeholder:{},disabled:{type:Boolean,default:void 0},required:{type:Boolean},modelValue:{},min:{},max:{},step:{default:1},controls:{type:Boolean,default:!0},readonly:{type:Boolean},immediateFocus:{type:Boolean},leading:{},trailing:{},clearIcon:{default:"tabler:circle-x"},trailingCls:{},clearIconCls:{},dividerCls:{},leadingCls:{},class:{},allowClear:{type:Boolean},bordered:{type:Boolean,default:!0},simple:{type:Boolean},size:{},status:{},steps:{type:Boolean},contentFit:{type:Boolean}},emits:["update:modelValue","change","input","keydownEnter","step","blur","focus","clear","resize"],setup(r,{expose:e,emit:i}){const s=r,l=n.useSlots(),u=i,p=n.useAttrs(),m=N.getBemElement($.inputPrefix,"number_steps"),{getDisabled:d,getStatus:S,getSize:V}=te.useFormInput({getSize:()=>s.size&&$.InputSizes.includes(s.size)?s.size:"md"}),y=n.ref();s.immediateFocus&&n.onMounted(()=>{var t,a;return(a=(t=y.value)==null?void 0:t.focus)==null?void 0:a.call(t)});const c=n.shallowRef(h(s.modelValue)),g=n.shallowRef(""),w=n.computed(()=>ie(s.max)),B=n.computed(()=>ie(s.min)),P=n.computed(()=>d.value?!0:!B.value||!c.value||c.value.isInvalidate()?!1:c.value.lessEquals(B.value)),G=n.computed(()=>d.value?!0:!w.value||!c.value||c.value.isInvalidate()?!1:w.value.lessEquals(c.value)),se=()=>{L(void 0),g.value="",u("clear")},L=t=>{M=!0,u("update:modelValue",t),u("change",t),n.nextTick(()=>M=!1)},U=t=>Math.max(D(t),D(s.step)),W=t=>{let a=typeof t=="number"?F(t):t;const o=U(a);return T(a)&&(!o||o>=0)&&(a=k(a,".",o)),a},X=t=>{g.value=W((t.isInvalidate(),t.toString()))},ae=()=>{const t=s.modelValue;return c.value.isInvalidate()&&["string","number"].includes(typeof t)?Number.isNaN(t)?"":(t==null?void 0:t.toString())??"":W(c.value.toString())};g.value=ae();const O=t=>{if(w.value&&!t.lessEquals(w.value))return w.value;if(B.value&&!B.value.lessEquals(t))return B.value},j=t=>{c.value=t,X(t)},oe=t=>!O(t);let M=!1;const K=t=>{t.equals(c.value)||(j(t),L(t.isEmpty()?void 0:t.toNumber()))},R=t=>{let a=t,o=oe(a)||a.isEmpty();if(a.isEmpty()||(a=O(a)||a,o=!0),!s.readonly&&!s.disabled&&o){const v=a.toString(),E=U(v);return(!E||E>=0)&&(a=h(k(v,".",E))),a}return c.value};let A;const z=()=>{clearTimeout(A),A=void 0},Z=t=>{var E;if(t&&G.value||!t&&P.value){z();return}let a=h(s.step);t||(a=a.negate());const o=(c.value||h(0)).add(a.toString()),v=R(o);K(v),u("step",{offset:s.step??1,type:t?"up":"down"}),(E=y.value)==null||E.focus()},H=(t,a)=>{t.preventDefault();function o(){A=setTimeout(o,200),Z(a)}o()};n.onBeforeUnmount(z);const J=t=>String(t).replace(/[^\w.-]+/g,""),Q=()=>{const t=h(J(g.value));let a=t;t.isNaN()?a=c.value:(a=R(t),K(a)),X(a)},ue=t=>{const a=t.target.value;g.value=a;const o=J(a),v=h(o);v.isNaN()||R(v),u("input",t)},le=t=>{const{key:a}=t;a==="Enter"&&(Q(),u("keydownEnter",t)),["ArrowDown","ArrowUp"].includes(a)&&(Z(a==="ArrowUp"),t.preventDefault())};n.watch(()=>s.modelValue,()=>{if(!M){const t=h(s.modelValue);j(t)}});const{focused:ce,rootBindings:de,inputBindings:me}=te.useInputDataStates({getDisabled:()=>d.value,emit:u,blurCallBack:Q});n.watch(()=>s.disabled,t=>{t&&(ce.value=!1)});const fe=n.computed(()=>I.omitBy({...de.value,...s,disabled:d.value,status:S.value,size:V.value,hasValue:!N.isEmptyLikeLodash(g.value)},I.isUndefined)),pe=n.computed(()=>I.omitBy({...I.pick(s,["id","type","disabled","required","placeholder","readonly"]),disabled:d.value,...I.omit(p,["value"]),...me.value},I.isUndefined)),Y=n.computed(()=>{switch(V.value){case"sm":return 12;case"lg":return 16;default:return 14}}),ee=n.ref(),ge=t=>{y.value&&(y.value.style.width=`${t}px`,u("resize",t))};return n.onMounted(()=>{n.watch(g,()=>{var t,a;(a=(t=ee.value)==null?void 0:t.adjustWidth)==null||a.call(t)},{immediate:!0,flush:"post"})}),e($.useInputExposes(y)),(t,a)=>(n.openBlock(),n.createBlock($._sfc_main,n.mergeProps(fe.value,{onClear:se,steps:s.controls,ref_key:"rootRef",ref:ee,onResize:ge}),n.createSlots({value:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(g.value||t.placeholder),1)]),default:n.withCtx(()=>[n.createElementVNode("input",n.mergeProps({ref_key:"inputRef",ref:y},pe.value,{class:n.unref(N.normCls)(n.unref(N.getBemElement)(n.unref($.inputPrefix),"input")),autocomplete:"off",role:"spinbutton","aria-valuemin":t.min,"aria-valuemax":t.max,value:g.value,onInput:ue,onKeydown:le}),null,16,Se)]),_:2},[n.renderList(Object.keys(l),o=>({name:o,fn:n.withCtx(v=>[n.renderSlot(t.$slots,o,n.normalizeProps(n.guardReactiveProps(v)))])})),s.controls?{name:"extra",fn:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(n.unref(m)),onMouseup:z,onMouseleave:z},[n.createElementVNode("span",{role:"button",class:n.normalizeClass(n.unref(N.getBemElement)(n.unref(m),"up")),"data-disabled":G.value,onMousedown:a[0]||(a[0]=o=>H(o,!0))},[n.createVNode(ne._sfc_main,{icon:"tabler:chevron-up",size:Y.value},null,8,["size"])],42,Ne),n.createElementVNode("span",{role:"button",class:n.normalizeClass(n.unref(N.getBemElement)(n.unref(m),"down")),"data-disabled":P.value,onMousedown:a[1]||(a[1]=o=>H(o,!1))},[n.createVNode(ne._sfc_main,{icon:"tabler:chevron-down",size:Y.value},null,8,["size"])],42,be)],34)]),key:"0"}:void 0]),1040,["steps"]))}});exports._sfc_main=ye;
|