@appmax_npm/ds-prime 1.0.0-alpha.161 → 1.0.0-alpha.163

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/amfield/index.js CHANGED
@@ -16,12 +16,12 @@ const v = { name: "AmField" }, B = /* @__PURE__ */ m({
16
16
  disabled: { type: Boolean }
17
17
  },
18
18
  setup(d) {
19
- const a = p(d, ["as", "help", "label", "labelHint", "hint", "dataTestPrefix"]);
19
+ const r = p(d, ["as", "help", "label", "labelHint", "hint", "dataTestPrefix"]);
20
20
  return (e, T) => (o(), n(u(_), {
21
- name: a.name
21
+ name: r.name
22
22
  }, {
23
- default: s((l) => {
24
- var r;
23
+ default: s((a) => {
24
+ var l;
25
25
  return [
26
26
  b(P, {
27
27
  dataTestPrefix: e.dataTestPrefix,
@@ -29,20 +29,20 @@ const v = { name: "AmField" }, B = /* @__PURE__ */ m({
29
29
  label: e.label,
30
30
  labelHint: e.labelHint,
31
31
  hint: e.hint,
32
- error: l.touched ? a.error || ((r = l.error) == null ? void 0 : r.message) : "",
33
- disabled: a.disabled
32
+ error: a.touched || a.error ? r.error || ((l = a.error) == null ? void 0 : l.message) : "",
33
+ disabled: r.disabled
34
34
  }, {
35
35
  default: s(() => {
36
36
  var t;
37
37
  return [
38
38
  (o(), n(f(e.as), h({
39
- modelValue: l.value,
40
- "onUpdate:modelValue": (i) => l.value = i,
39
+ modelValue: a.value,
40
+ "onUpdate:modelValue": (i) => a.value = i,
41
41
  class: "overflow-hidden"
42
- }, { ...e.$attrs, ...a }, {
42
+ }, { ...e.$attrs, ...r }, {
43
43
  "data-test": `${e.dataTestPrefix}-field`,
44
- invalid: l.touched && !!(a.error || (t = l.error) != null && t.message),
45
- disabled: a.disabled
44
+ invalid: (a.touched || !!a.error) && !!(r.error || (t = a.error) != null && t.message),
45
+ disabled: r.disabled
46
46
  }), null, 16, ["modelValue", "onUpdate:modelValue", "data-test", "invalid", "disabled"]))
47
47
  ];
48
48
  }),
@@ -1,21 +1,21 @@
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) => {
1
+ import { defineComponent as L, ref as U, computed as f, watch as S, openBlock as B, createBlock as E, unref as H, mergeProps as T } from "vue";
2
+ import { InputText as h } from "primevue";
3
+ const m = (t, n = !1) => {
4
+ const e = Number(t) || 0;
5
+ return n ? -e : e;
6
+ }, P = (t) => {
7
+ if (!t) return 0;
8
+ const n = t.startsWith("-"), e = t.replace(/[^\d]/g, "");
7
9
  if (!e) return 0;
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 = {
10
+ const u = e.padStart(3, "0").replace(/(\d{2})$/, ".$1");
11
+ return m(u, n);
12
+ }, C = (t, n = !1) => {
13
+ const e = m(t);
14
+ return n ? e / 100 : e;
15
+ }, v = (t, n = !1) => {
16
+ const e = m(t);
17
+ return n ? Math.round(e * 100) : e;
18
+ }, _ = (t, n) => Math.round((t + n) * 100) / 100, V = {
19
19
  AUD: "en-AU",
20
20
  BGN: "bg-BG",
21
21
  BRL: "pt-BR",
@@ -49,59 +49,59 @@ const i = (e, t = !1) => {
49
49
  TRY: "tr-TR",
50
50
  USD: "en-US",
51
51
  ZAR: "en-ZA"
52
- }, F = "pt-BR", C = "BRL", x = (e = C) => {
53
- if (e in D) {
54
- const t = D[e];
55
- return Array.isArray(t) ? t[0] : t;
52
+ }, b = "pt-BR", D = "BRL", w = (t = D) => {
53
+ if (t in V) {
54
+ const n = V[t];
55
+ return Array.isArray(n) ? n[0] : n;
56
56
  } else
57
- return F;
58
- }, R = (e, t = C, n) => {
59
- const a = n || x(t);
60
- return new Intl.NumberFormat(a, {
57
+ return b;
58
+ }, N = (t, n = D, e) => {
59
+ const u = e || w(n);
60
+ return new Intl.NumberFormat(u, {
61
61
  style: "currency",
62
- currency: t
63
- }).format(i(e));
64
- }, G = { name: "AmInputCurrency" }, z = /* @__PURE__ */ v({
65
- ...G,
66
- props: /* @__PURE__ */ S({
62
+ currency: n
63
+ }).format(m(t));
64
+ }, M = { name: "AmInputCurrency" }, F = /* @__PURE__ */ L({
65
+ ...M,
66
+ props: {
67
67
  currency: {},
68
68
  locale: {},
69
69
  inCents: { type: Boolean },
70
70
  modelValue: {},
71
71
  max: {}
72
- }, {
73
- modelValue: { default: 0 },
74
- modelModifiers: {}
75
- }),
72
+ },
76
73
  emits: ["update:modelValue"],
77
- setup(e) {
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);
74
+ setup(t, { emit: n }) {
75
+ const e = t, u = n, p = U(""), l = f(() => e.max), R = f(() => {
76
+ const { currency: r, locale: o, inCents: a, max: i, modelValue: s, ...c } = e;
77
+ return c;
78
+ }), d = (r) => r < 0 ? 0 : typeof l.value != "number" ? r : l.value <= 0 ? 0 : l.value < r ? l.value : r, y = (r) => {
79
+ const o = C(r, e.inCents);
80
+ p.value = N(o, e.currency, e.locale);
81
+ }, A = (r) => {
82
+ const o = r.target, a = P(o.value), i = v(a, e.inCents), s = d(i);
83
+ u("update:modelValue", s);
84
+ const c = C(s, e.inCents);
85
+ o.value = N(c, e.currency, e.locale);
81
86
  }, 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
87
  if (!["ArrowUp", "ArrowDown"].includes(r.key)) return;
88
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);
89
+ const a = e.inCents ? 100 : 1, i = r.key === "ArrowUp" ? 1 : -1, s = e.modelValue ?? 0, c = _(s, a * i);
90
+ u("update:modelValue", d(c));
91
91
  };
92
- M(u, (r) => {
93
- const o = m(r);
94
- r !== o && (u.value = o), A(o);
92
+ S(() => e.modelValue, (r) => {
93
+ const o = r ?? 0, a = d(o);
94
+ o !== a && u("update:modelValue", a), y(a);
95
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
96
+ const I = "numeric";
97
+ return (r, o) => (B(), E(H(h), T(R.value, {
98
+ inputmode: I,
99
+ value: p.value,
100
+ onInput: A,
101
+ onKeydown: K
102
102
  }), null, 16, ["value"]));
103
103
  }
104
104
  });
105
105
  export {
106
- z as default
106
+ F as default
107
107
  };
@@ -1,2 +1 @@
1
- import Lara from '@primevue/themes/lara';
2
- export declare const AppmaxPreset: typeof Lara;
1
+ export declare const AppmaxPreset: import("@primeuix/themes/types").Preset;
@@ -1,6 +1,6 @@
1
- import { definePreset } from '@primevue/themes';
2
- import Lara from '@primevue/themes/lara';
3
- import Aura from '@primevue/themes/aura';
1
+ import { definePreset } from '@primeuix/themes';
2
+ import Lara from '@primeuix/themes/lara';
3
+ import Aura from '@primeuix/themes/aura';
4
4
  import { AmColors } from '../colors';
5
5
  export const AppmaxPreset = definePreset(Lara, {
6
6
  primitive: {
@@ -1,2 +1 @@
1
- import Lara from '@primevue/themes/lara';
2
- export declare const MaxPreset: typeof Lara;
1
+ export declare const MaxPreset: import("@primeuix/themes/types").Preset;
@@ -1,6 +1,6 @@
1
- import { definePreset } from '@primevue/themes';
2
- import Lara from '@primevue/themes/lara';
3
- import Aura from '@primevue/themes/aura';
1
+ import { definePreset } from '@primeuix/themes';
2
+ import Lara from '@primeuix/themes/lara';
3
+ import Aura from '@primeuix/themes/aura';
4
4
  import { AmColors } from '../colors';
5
5
  export const MaxPreset = definePreset(Lara, {
6
6
  primitive: {