@appmax_npm/ds-prime 1.0.0-alpha.115 → 1.0.0-alpha.117

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