@appmax_npm/ds-prime 1.0.0-alpha.118 → 1.0.0-alpha.119

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.
@@ -1,15 +1,21 @@
1
- import { defineComponent as U, mergeModels as y, useModel as L, ref as S, watch as h, openBlock as B, createBlock as E, unref as H, mergeProps as M } from "vue";
2
- import { InputText as v } from "primevue";
3
- const d = (e, t = !1) => {
4
- const o = Number(e) || 0;
5
- return t ? -o : o;
6
- }, P = (e) => {
1
+ import { defineComponent as v, mergeModels as S, useModel as B, ref as E, computed as H, watch as M, openBlock as T, createBlock as h, unref as b, mergeProps as P } from "vue";
2
+ import { InputText as _ } from "primevue";
3
+ const i = (e, t = !1) => {
4
+ const n = Number(e) || 0;
5
+ return t ? -n : n;
6
+ }, w = (e) => {
7
7
  if (!e) return 0;
8
- const t = e.startsWith("-"), o = e.replace(/[^\d]/g, "");
9
- if (!o) return 0;
10
- const l = o.padStart(3, "0").replace(/(\d{2})$/, ".$1");
11
- return d(l, t);
12
- }, T = (e, t) => Math.round((e + t) * 100) / 100, f = {
8
+ const t = e.startsWith("-"), n = e.replace(/[^\d]/g, "");
9
+ if (!n) return 0;
10
+ const a = n.padStart(3, "0").replace(/(\d{2})$/, ".$1");
11
+ return i(a, t);
12
+ }, N = (e, t = !1) => {
13
+ const n = i(e);
14
+ return t ? n / 100 : n;
15
+ }, Y = (e, t = !1) => {
16
+ const n = i(e);
17
+ return t ? Math.round(n * 100) : n;
18
+ }, g = (e, t) => Math.round((e + t) * 100) / 100, D = {
13
19
  AUD: "en-AU",
14
20
  BGN: "bg-BG",
15
21
  BRL: "pt-BR",
@@ -43,21 +49,21 @@ const d = (e, t = !1) => {
43
49
  TRY: "tr-TR",
44
50
  USD: "en-US",
45
51
  ZAR: "en-ZA"
46
- }, g = "pt-BR", R = "BRL", _ = (e = R) => {
47
- if (e in f) {
48
- const t = f[e];
52
+ }, F = "pt-BR", C = "BRL", x = (e = C) => {
53
+ if (e in D) {
54
+ const t = D[e];
49
55
  return Array.isArray(t) ? t[0] : t;
50
56
  } else
51
- return g;
52
- }, N = (e, t = R, o) => {
53
- const l = o || _(t);
54
- return new Intl.NumberFormat(l, {
57
+ return F;
58
+ }, R = (e, t = C, n) => {
59
+ const a = n || x(t);
60
+ return new Intl.NumberFormat(a, {
55
61
  style: "currency",
56
62
  currency: t
57
- }).format(d(e));
58
- }, w = { name: "AmInputCurrency" }, x = /* @__PURE__ */ U({
59
- ...w,
60
- props: /* @__PURE__ */ y({
63
+ }).format(i(e));
64
+ }, G = { name: "AmInputCurrency" }, z = /* @__PURE__ */ v({
65
+ ...G,
66
+ props: /* @__PURE__ */ S({
61
67
  currency: {},
62
68
  locale: {},
63
69
  inCents: { type: Boolean },
@@ -69,28 +75,33 @@ const d = (e, t = !1) => {
69
75
  }),
70
76
  emits: ["update:modelValue"],
71
77
  setup(e) {
72
- const t = e, { currency: o, locale: l, inCents: c, max: m, modelValue: Y, ...C } = t, s = (n) => m && n > m ? m : Math.max(0, n), u = L(e, "modelValue", { set: s, get: s }), p = S(""), D = (n) => {
73
- const r = d(n), a = c ? r / 100 : r;
74
- p.value = N(a, o, l);
75
- }, V = (n) => {
76
- const r = n.target, a = P(r.value), i = c ? a * 100 : a;
77
- r.value = N(a, o, l), u.value = s(i);
78
- }, A = (n) => {
79
- if (!["ArrowUp", "ArrowDown"].includes(n.key)) return;
80
- n.preventDefault(), n.stopPropagation();
81
- const a = n.key === "ArrowUp" ? 1 : -1, i = c ? 100 : 1, I = T(u.value, i * a);
82
- u.value = s(I);
78
+ const t = e, { currency: n, locale: a, inCents: s, max: V, modelValue: O, ...y } = t, u = B(e, "modelValue"), f = E(""), l = H(() => V), m = (r) => r < 0 ? 0 : typeof l.value != "number" ? r : l.value <= 0 ? 0 : l.value < r ? l.value : r, A = (r) => {
79
+ const o = N(r, s);
80
+ f.value = R(o, n, a);
81
+ }, K = (r) => {
82
+ const o = r.target, d = w(o.value), p = Y(d, s), c = m(p);
83
+ u.value = c;
84
+ const U = N(c, s);
85
+ o.value = R(U, n, a);
86
+ }, I = (r) => {
87
+ if (!["ArrowUp", "ArrowDown"].includes(r.key)) return;
88
+ r.preventDefault();
89
+ const d = s ? 100 : 1, p = r.key === "ArrowUp" ? 1 : -1, c = g(u.value, d * p);
90
+ u.value = m(c);
83
91
  };
84
- h(() => u.value, D, { immediate: !0 });
85
- const K = "numberic";
86
- return (n, r) => (B(), E(H(v), M(C, {
87
- inputmode: K,
88
- value: p.value,
89
- onInput: V,
90
- onKeydown: A
92
+ M(u, (r) => {
93
+ const o = m(r);
94
+ r !== o && (u.value = o), A(o);
95
+ }, { immediate: !0 });
96
+ const L = "numberic";
97
+ return (r, o) => (T(), h(b(_), P(y, {
98
+ inputmode: L,
99
+ value: f.value,
100
+ onInput: K,
101
+ onKeydown: I
91
102
  }), null, 16, ["value"]));
92
103
  }
93
104
  });
94
105
  export {
95
- x as default
106
+ z as default
96
107
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appmax_npm/ds-prime",
3
- "version": "1.0.0-alpha.118",
3
+ "version": "1.0.0-alpha.119",
4
4
  "description": "Design System da Appmax baseado no Primevue",
5
5
  "author": "Appmax",
6
6
  "exports": {