@appmax_npm/ds-prime 1.0.0-alpha.114 → 1.0.0-alpha.116

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.
@@ -0,0 +1,21 @@
1
+ import { InputTextEmits, InputTextProps, InputTextSlots } from 'primevue';
2
+ import { DefineComponent } from 'vue';
3
+
4
+ export interface AmInputCurrencyProps extends /* @vue-ignore */ InputTextProps {
5
+ currency?: string;
6
+ locale?: string;
7
+ inCents?: boolean;
8
+ modelValue?: number;
9
+ }
10
+
11
+ export interface AmInputCurrencySlots extends InputTextSlots {
12
+
13
+ }
14
+
15
+ export interface AmInputCurrencyEmits extends InputTextEmits {
16
+ 'update:modelValue': (value: number) => void;
17
+ }
18
+
19
+ declare const AmInputCurrency: DefineComponent<AmInputCurrencyProps, AmInputCurrencySlots, AmInputCurrencyEmits>;
20
+
21
+ export default AmInputCurrency;
@@ -0,0 +1,86 @@
1
+ import { defineComponent as C, mergeModels as R, createPropsRestProxy as N, useModel as V, ref as D, watch as I, 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) => {
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 = {
13
+ AUD: "en-AU",
14
+ BGN: "bg-BG",
15
+ BRL: "pt-BR",
16
+ CAD: "en-CA",
17
+ CHF: ["de-CH", "fr-CH", "it-CH"],
18
+ // multiple locales array
19
+ CNY: "zh-CN",
20
+ CZK: "cs-CZ",
21
+ DKK: "da-DK",
22
+ EUR: ["de-DE", "fr-FR", "es-ES", "it-IT"],
23
+ // multiple locales array
24
+ GBP: "en-GB",
25
+ HKD: "zh-HK",
26
+ HUF: "hu-HU",
27
+ IDR: "id-ID",
28
+ ILS: "he-IL",
29
+ INR: "en-IN",
30
+ ISK: "is-IS",
31
+ JPY: "ja-JP",
32
+ KRW: "ko-KR",
33
+ MXN: "es-MX",
34
+ MYR: "ms-MY",
35
+ NOK: "no-NO",
36
+ NZD: "en-NZ",
37
+ PHP: "en-PH",
38
+ PLN: "pl-PL",
39
+ RON: "ro-RO",
40
+ SEK: "sv-SE",
41
+ SGD: "en-SG",
42
+ THB: "th-TH",
43
+ TRY: "tr-TR",
44
+ USD: "en-US",
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;
50
+ } else
51
+ return K;
52
+ }, s = (e, t = m, n) => {
53
+ const o = n || P(t);
54
+ return new Intl.NumberFormat(o, {
55
+ style: "currency",
56
+ currency: t
57
+ }).format(c(e));
58
+ }, S = { name: "AmInputCurrency" }, E = /* @__PURE__ */ C({
59
+ ...S,
60
+ props: /* @__PURE__ */ R({
61
+ currency: {},
62
+ locale: {},
63
+ inCents: { type: Boolean },
64
+ modelValue: {}
65
+ }, {
66
+ modelValue: { default: 0 },
67
+ modelModifiers: {}
68
+ }),
69
+ emits: ["update:modelValue"],
70
+ setup(e) {
71
+ const t = N(e, ["currency", "locale", "inCents", "modelValue"]), n = V(e, "modelValue"), o = D(""), d = (r) => {
72
+ const a = c(r), l = e.inCents ? a / 100 : a;
73
+ o.value = s(l, e.currency, e.locale);
74
+ }, i = (r) => {
75
+ const a = r.target, l = L(a.value), f = e.inCents ? l * 100 : l;
76
+ n.value = f, a.value = s(l, e.currency, e.locale);
77
+ };
78
+ return I(() => n.value, d, { immediate: !0 }), (r, a) => (p(), y(A(H), B(t, {
79
+ value: o.value,
80
+ onInput: i
81
+ }), null, 16, ["value"]));
82
+ }
83
+ });
84
+ export {
85
+ E as default
86
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appmax_npm/ds-prime",
3
- "version": "1.0.0-alpha.114",
3
+ "version": "1.0.0-alpha.116",
4
4
  "description": "Design System da Appmax baseado no Primevue",
5
5
  "author": "Appmax",
6
6
  "exports": {