@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.
Files changed (50) hide show
  1. package/dist/Base/BaseInput/BaseInput.d.ts +11 -2
  2. package/dist/BaseInput.vue_vue_type_style_index_0_lang-DdjridzV.js +1 -0
  3. package/dist/BaseInput.vue_vue_type_style_index_0_lang-Djl15xzS.js +159 -0
  4. package/dist/Blanket/Blanket.d.ts +11 -0
  5. package/dist/Blanket/index.d.ts +1 -1
  6. package/dist/Blanket/index.js +5 -1
  7. package/dist/Blanket/index.umd.cjs +1 -1
  8. package/dist/Blanket.vue_vue_type_style_index_0_lang-Dv68meO4.js +22 -0
  9. package/dist/Blanket.vue_vue_type_style_index_0_lang-WKNPEuJI.js +1 -0
  10. package/dist/ColorPicker/index.js +2 -2
  11. package/dist/ColorPicker/index.umd.cjs +1 -1
  12. package/dist/{ColorPicker.vue_vue_type_style_index_0_lang-DC7OjAIp.js → ColorPicker.vue_vue_type_style_index_0_lang-BVjzmZnp.js} +1 -1
  13. 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
  14. package/dist/ColorSwatchGroup/index.js +1 -1
  15. package/dist/ColorSwatchGroup/index.umd.cjs +1 -1
  16. package/dist/{ColorSwatchGroup.vue_vue_type_style_index_0_lang-DroX6p45.js → ColorSwatchGroup.vue_vue_type_style_index_0_lang-CDF1AL9P.js} +1 -1
  17. 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
  18. package/dist/Combobox/index.js +62 -60
  19. package/dist/Combobox/index.umd.cjs +1 -1
  20. package/dist/GOPicker/index.js +2 -2
  21. package/dist/GOPicker/index.umd.cjs +1 -1
  22. package/dist/Input/Input.d.ts +174 -1
  23. package/dist/Input/index.js +1 -1
  24. package/dist/Input/index.umd.cjs +1 -1
  25. package/dist/Input.vue_vue_type_script_setup_true_lang-ByHGhDsA.js +126 -0
  26. package/dist/Input.vue_vue_type_script_setup_true_lang-CTIaAkrW.js +1 -0
  27. package/dist/InputNumber/InputNumber.d.ts +174 -1
  28. package/dist/InputNumber/index.js +1 -1
  29. package/dist/InputNumber/index.umd.cjs +1 -1
  30. package/dist/{InputNumber.vue_vue_type_script_setup_true_lang-Dx8V2Sz8.js → InputNumber.vue_vue_type_script_setup_true_lang-C4GMpH6O.js} +179 -162
  31. package/dist/InputNumber.vue_vue_type_script_setup_true_lang-DW-JqPiv.js +1 -0
  32. package/dist/Pagination/index.js +26 -25
  33. package/dist/Pagination/index.umd.cjs +1 -1
  34. package/dist/Steps/Step.d.ts +45 -0
  35. package/dist/Steps/StepLeading.d.ts +2 -0
  36. package/dist/Steps/Steps.d.ts +50 -0
  37. package/dist/Steps/index.d.ts +5 -1
  38. package/dist/Steps/index.js +247 -1
  39. package/dist/Steps/index.umd.cjs +1 -1
  40. package/dist/index.js +375 -360
  41. package/dist/index.umd.cjs +1 -1
  42. package/dist/style/index.css +1 -1
  43. package/dist/use/index.js +400 -359
  44. package/dist/use/index.umd.cjs +1 -1
  45. package/package.json +54 -51
  46. package/dist/BaseInput.vue_vue_type_style_index_0_lang-D3zq7oKh.js +0 -1
  47. package/dist/BaseInput.vue_vue_type_style_index_0_lang-aX7hcK86.js +0 -136
  48. package/dist/Input.vue_vue_type_script_setup_true_lang-DW0Xc_1z.js +0 -112
  49. package/dist/Input.vue_vue_type_script_setup_true_lang-DoaHfVrM.js +0 -1
  50. package/dist/InputNumber.vue_vue_type_script_setup_true_lang-URIsXuko.js +0 -1
@@ -1,16 +1,16 @@
1
- var Ie = Object.defineProperty;
2
- var $e = (i, e, n) => e in i ? Ie(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
3
- var m = (i, e, n) => $e(i, typeof e != "symbol" ? e + "" : e, n);
4
- import { defineComponent as we, useSlots as Be, useAttrs as De, ref as _e, onMounted as xe, shallowRef as ne, computed as N, onBeforeUnmount as Me, watch as ie, createBlock as Ve, openBlock as Ae, mergeProps as re, createSlots as Re, withCtx as z, createElementVNode as M, unref as v, renderList as ke, renderSlot as ze, normalizeProps as Fe, guardReactiveProps as Ce, normalizeClass as F, createVNode as se, nextTick as qe } from "vue";
5
- import { getComponentOptions as Te, getBemElement as V, isEmptyLikeLodash as Pe, normCls as Ge } from "@pantograph/utils";
6
- import { i as ae, I as Le, u as Ue, _ as Xe } from "./BaseInput.vue_vue_type_style_index_0_lang-aX7hcK86.js";
7
- import { useFormInput as Oe, useInputDataStates as We } from "@pantograph/utils-vue";
8
- import { omitBy as oe, pick as le, isUndefined as ue, omit as Ke } from "es-toolkit";
9
- import { _ as ce } from "./Icon.vue_vue_type_style_index_0_lang-CD9EvvB5.js";
10
- function C() {
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 w(i) {
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 T(i) {
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 B(i) {
33
+ function D(i) {
34
34
  const e = String(i);
35
- if (T(i)) {
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(".") && G(e) ? e.length - e.indexOf(".") - 1 : 0;
40
+ return e.includes(".") && L(e) ? e.length - e.indexOf(".") - 1 : 0;
41
41
  }
42
- function P(i) {
42
+ function G(i) {
43
43
  if (i == null) return "";
44
44
  let e = String(i);
45
- if (T(i)) {
45
+ if (P(i)) {
46
46
  if (i > Number.MAX_SAFE_INTEGER)
47
- return String(C() ? BigInt(i).toString() : Number.MAX_SAFE_INTEGER);
47
+ return String(T() ? BigInt(i).toString() : Number.MAX_SAFE_INTEGER);
48
48
  if (i < Number.MIN_SAFE_INTEGER)
49
- return String(C() ? BigInt(i).toString() : Number.MIN_SAFE_INTEGER);
50
- e = i.toFixed(B(e));
49
+ return String(T() ? BigInt(i).toString() : Number.MIN_SAFE_INTEGER);
50
+ e = i.toFixed(D(e));
51
51
  }
52
- return w(e).fullStr;
52
+ return B(e).fullStr;
53
53
  }
54
- function G(i) {
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 me(i) {
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 (me(e)) {
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(B(this.number), B(n));
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() ? "" : P(this.number);
113
+ return this.isInvalidate() ? "" : G(this.number);
114
114
  }
115
115
  }
116
- class y {
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 (me(e)) {
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 (T(n) && (n = Number(n)), n = typeof n == "string" ? n : P(n), G(n)) {
136
- const r = w(n);
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 y(this.toString());
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 y(e);
174
- const n = new y(e);
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 } = w(f), S = `${d}${c.padStart(r + 1, "0")}`;
178
- return new y(
179
- `${S.slice(0, -r)}.${S.slice(-r)}`
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() ? "" : w(`${this.getMark()}${this.getIntegerStr()}.${this.getDecimalStr()}`).fullStr;
202
+ return this.isInvalidate() ? "" : B(`${this.getMark()}${this.getIntegerStr()}.${this.getDecimalStr()}`).fullStr;
203
203
  }
204
204
  }
205
- function g(i) {
206
- return C() ? new y(i) : new b(i);
205
+ function v(i) {
206
+ return T() ? new I(i) : new b(i);
207
207
  }
208
- const de = (i) => {
209
- const e = g(i);
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 } = w(i), d = `${e}${f}`, c = `${l}${o}`;
215
+ const { negativeStr: l, integerStr: o, decimalStr: f } = B(i), d = `${e}${f}`, c = `${l}${o}`;
216
216
  if (n && n >= 0) {
217
- const S = Number(f[n]);
218
- if (S >= 5 && !r) {
219
- const D = g(i).add(
220
- `${l}0.${"0".repeat(n)}${10 - S}`
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(D.toString(), e, n, r);
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 Ze = ["aria-valuemin", "aria-valuemax", "value"], je = ["data-disabled"], He = ["data-disabled"], rt = /* @__PURE__ */ we({
229
- ...Te("Input", !1),
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 = Be(), o = n, f = De(), d = V(ae, "number_steps"), { getDisabled: c, getStatus: S, getSize: D } = Oe({
262
- getSize: () => r.size && Le.includes(r.size) ? r.size : "md"
263
- }), _ = _e();
264
- r.immediateFocus && xe(() => {
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 = _.value) == null ? void 0 : t.focus) == null ? void 0 : s.call(t);
267
+ return (s = (t = y.value) == null ? void 0 : t.focus) == null ? void 0 : s.call(t);
267
268
  });
268
- const u = ne(g(r.modelValue)), h = ne(""), I = N(() => de(r.max)), $ = N(() => de(r.min)), L = N(() => c.value ? !0 : !$.value || !u.value || u.value.isInvalidate() ? !1 : u.value.lessEquals($.value)), U = N(() => c.value ? !0 : !I.value || !u.value || u.value.isInvalidate() ? !1 : I.value.lessEquals(u.value)), fe = () => {
269
- X(void 0), h.value = "", o("clear");
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
- A = !0, o("update:modelValue", t), o("change", t), qe(() => A = !1);
272
- }, O = (t) => Math.max(B(t), B(r.step)), W = (t) => {
273
- let s = typeof t == "number" ? P(t) : t;
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 G(s) && (!a || a >= 0) && (s = q(s, ".", a)), s;
276
+ return L(s) && (!a || a >= 0) && (s = q(s, ".", a)), s;
276
277
  }, K = (t) => {
277
- h.value = W(
278
+ p.value = j(
278
279
  (t.isInvalidate(), t.toString())
279
280
  );
280
- }, pe = () => {
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()) ?? "" : W(u.value.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
- h.value = pe();
285
+ p.value = ve();
285
286
  const Z = (t) => {
286
- if (I.value && !t.lessEquals(I.value))
287
- return I.value;
288
- if ($.value && !$.value.lessEquals(t))
287
+ if ($.value && !t.lessEquals($.value))
289
288
  return $.value;
290
- }, j = (t) => {
289
+ if (w.value && !w.value.lessEquals(t))
290
+ return w.value;
291
+ }, H = (t) => {
291
292
  u.value = t, K(t);
292
- }, ge = (t) => !Z(t);
293
- let A = !1;
294
- const H = (t) => {
295
- t.equals(u.value) || (j(t), X(t.isEmpty() ? void 0 : t.toNumber()));
296
- }, R = (t) => {
297
- let s = t, a = ge(s) || s.isEmpty();
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 p = s.toString(), E = O(p);
300
- return (!E || E >= 0) && (s = g(q(p, ".", E))), 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 x = () => {
306
+ const _ = () => {
306
307
  clearTimeout(k), k = void 0;
307
- }, J = (t) => {
308
+ }, Q = (t) => {
308
309
  var E;
309
- if (t && U.value || !t && L.value) {
310
- x();
310
+ if (t && W.value || !t && U.value) {
311
+ _();
311
312
  return;
312
313
  }
313
- let s = g(r.step);
314
+ let s = v(r.step);
314
315
  t || (s = s.negate());
315
- const a = (u.value || g(0)).add(s.toString()), p = R(a);
316
- H(p), o("step", {
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 = _.value) == null || E.focus();
320
- }, Q = (t, s) => {
320
+ }), (E = y.value) == null || E.focus();
321
+ }, Y = (t, s) => {
321
322
  t.preventDefault();
322
323
  function a() {
323
- k = setTimeout(a, 200), J(s);
324
+ k = setTimeout(a, 200), Q(s);
324
325
  }
325
326
  a();
326
327
  };
327
- Me(x);
328
- const Y = (t) => String(t).replace(/[^\w.-]+/g, ""), ee = () => {
329
- const t = g(Y(h.value));
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 = R(t), H(s)), K(s);
332
- }, ve = (t) => {
332
+ t.isNaN() ? s = u.value : (s = A(t), J(s)), K(s);
333
+ }, he = (t) => {
333
334
  const s = t.target.value;
334
- h.value = s;
335
- const a = Y(s), p = g(a);
336
- p.isNaN() || R(p), o("input", t);
337
- }, Se = (t) => {
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" && (ee(), o("keydownEnter", t)), ["ArrowDown", "ArrowUp"].includes(s) && (J(s === "ArrowUp"), t.preventDefault());
340
+ s === "Enter" && (te(), o("keydownEnter", t)), ["ArrowDown", "ArrowUp"].includes(s) && (Q(s === "ArrowUp"), t.preventDefault());
340
341
  };
341
- ie(
342
+ F(
342
343
  () => r.modelValue,
343
344
  () => {
344
- if (!A) {
345
- const t = g(r.modelValue);
346
- j(t);
345
+ if (!R) {
346
+ const t = v(r.modelValue);
347
+ H(t);
347
348
  }
348
349
  }
349
350
  );
350
351
  const {
351
- focused: he,
352
- rootBindings: Ne,
353
- inputBindings: be
354
- } = We({
352
+ focused: be,
353
+ rootBindings: ye,
354
+ inputBindings: Ee
355
+ } = Ze({
355
356
  getDisabled: () => c.value,
356
357
  emit: o,
357
- blurCallBack: ee
358
+ blurCallBack: te
358
359
  });
359
- ie(
360
+ F(
360
361
  () => r.disabled,
361
362
  (t) => {
362
- t && (he.value = !1);
363
+ t && (be.value = !1);
363
364
  }
364
365
  );
365
- const Ee = N(
366
- () => oe(
366
+ const Ie = N(
367
+ () => ce(
367
368
  {
368
- ...le(r, ["id", "type", "disabled", "required", "placeholder", "step"]),
369
- ...Ne.value,
369
+ ...ye.value,
370
370
  ...r,
371
371
  disabled: c.value,
372
- status: S.value,
373
- size: D.value,
374
- hasValue: !Pe(h.value)
372
+ status: h.value,
373
+ size: x.value,
374
+ hasValue: !Ue(p.value)
375
375
  },
376
- ue
376
+ de
377
377
  )
378
- ), ye = N(
379
- () => oe(
378
+ ), $e = N(
379
+ () => ce(
380
380
  {
381
- ...le(r, ["id", "type", "disabled", "required", "placeholder", "readonly"]),
381
+ ...Je(r, ["id", "type", "disabled", "required", "placeholder", "readonly"]),
382
382
  disabled: c.value,
383
- ...Ke(f, ["value"]),
384
- ...be.value
383
+ ...He(f, ["value"]),
384
+ ...Ee.value
385
385
  },
386
- ue
386
+ de
387
387
  )
388
- ), te = N(() => {
389
- switch (D.value) {
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
- return e(Ue(_)), (t, s) => (Ae(), Ve(Xe, re(Ee.value, {
399
- onClear: fe,
400
- steps: r.controls
401
- }), Re({
402
- default: z(() => [
403
- M("input", re({
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
- }, ye.value, {
407
- class: v(Ge)(v(V)(v(ae), "input")),
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: h.value,
413
- onInput: ve,
414
- onKeydown: Se
415
- }), null, 16, Ze)
429
+ value: p.value,
430
+ onInput: he,
431
+ onKeydown: Ne
432
+ }), null, 16, Qe)
416
433
  ]),
417
434
  _: 2
418
435
  }, [
419
- ke(Object.keys(l), (a) => ({
436
+ Ce(Object.keys(l), (a) => ({
420
437
  name: a,
421
- fn: z((p) => [
422
- ze(t.$slots, a, Fe(Ce(p)))
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: z(() => [
428
- M("div", {
429
- class: F(v(d)),
430
- onMouseup: x,
431
- onMouseleave: x
444
+ fn: M(() => [
445
+ V("div", {
446
+ class: C(S(d)),
447
+ onMouseup: _,
448
+ onMouseleave: _
432
449
  }, [
433
- M("span", {
450
+ V("span", {
434
451
  role: "button",
435
- class: F(v(V)(v(d), "up")),
436
- "data-disabled": U.value,
437
- onMousedown: s[0] || (s[0] = (a) => Q(a, !0))
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
- se(ce, {
456
+ le(me, {
440
457
  icon: "tabler:chevron-up",
441
- size: te.value
458
+ size: ne.value
442
459
  }, null, 8, ["size"])
443
- ], 42, je),
444
- M("span", {
460
+ ], 42, Ye),
461
+ V("span", {
445
462
  role: "button",
446
- class: F(v(V)(v(d), "down")),
447
- "data-disabled": L.value,
448
- onMousedown: s[1] || (s[1] = (a) => Q(a, !1))
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
- se(ce, {
467
+ le(me, {
451
468
  icon: "tabler:chevron-down",
452
- size: te.value
469
+ size: ne.value
453
470
  }, null, 8, ["size"])
454
- ], 42, He)
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
- rt as _
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;