@appmax_npm/ds-prime 1.0.0-alpha.176 → 1.0.0-alpha.177

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,4 +1,4 @@
1
- import { defineComponent as R, useAttrs as H, openBlock as g, createElementBlock as F, normalizeClass as V, unref as d, createBlock as L, createCommentVNode as P, withCtx as Y, createTextVNode as te, toDisplayString as ae, mergeModels as j, useModel as oe, ref as h, Fragment as I, createVNode as _, toRefs as le, computed as M, watch as A, nextTick as re, renderList as se } from "vue";
1
+ import { defineComponent as E, useAttrs as H, openBlock as b, createElementBlock as w, normalizeClass as V, unref as d, createBlock as T, createCommentVNode as $, withCtx as I, createTextVNode as te, toDisplayString as ae, mergeModels as j, useModel as le, ref as k, Fragment as Y, createVNode as B, toRefs as oe, computed as S, watch as L, nextTick as re, renderList as se } from "vue";
2
2
  import { _ as ne } from "../AmText.vue_vue_type_script_setup_true_lang-ZUjjXA8M.js";
3
3
  import { _ as ie } from "../AmIcon.vue_vue_type_script_setup_true_lang-DWxib5iw.js";
4
4
  import { cva as G } from "class-variance-authority";
@@ -44,7 +44,7 @@ const me = G(
44
44
  }
45
45
  }
46
46
  }
47
- ), pe = (e, a) => q(me(e), a), ge = (e, a) => q(fe(e), a), be = ["disabled", "data-test"], ve = /* @__PURE__ */ R({
47
+ ), pe = (e, a) => q(me(e), a), be = (e, a) => q(fe(e), a), ve = ["disabled", "data-test"], ge = /* @__PURE__ */ E({
48
48
  inheritAttrs: !1,
49
49
  __name: "AmDateFilterButton",
50
50
  props: {
@@ -59,31 +59,31 @@ const me = G(
59
59
  emits: ["click"],
60
60
  setup(e) {
61
61
  const a = H();
62
- return (t, n) => (g(), F("button", {
62
+ return (t, n) => (b(), w("button", {
63
63
  type: "button",
64
- class: V([d(ge)({ selected: t.selected, disabled: t.disabled, isCustom: t.isCustom }, d(a).class), { "am-date-filter-button--custom": t.isCustom }]),
64
+ class: V([d(be)({ selected: t.selected, disabled: t.disabled, isCustom: t.isCustom }, d(a).class), { "am-date-filter-button--custom": t.isCustom }]),
65
65
  disabled: t.disabled,
66
66
  "data-test": t.dataTest,
67
67
  onClick: n[0] || (n[0] = (u) => t.$emit("click", u))
68
68
  }, [
69
- t.icon ? (g(), L(ie, {
69
+ t.icon ? (b(), T(ie, {
70
70
  key: 0,
71
71
  icon: t.icon,
72
72
  size: "sm"
73
- }, null, 8, ["icon"])) : P("", !0),
74
- t.label ? (g(), L(ne, {
73
+ }, null, 8, ["icon"])) : $("", !0),
74
+ t.label ? (b(), T(ne, {
75
75
  key: 1,
76
76
  as: "span",
77
77
  class: V(t.hideLabel ? "am-date-filter-label--responsive" : "")
78
78
  }, {
79
- default: Y(() => [
79
+ default: I(() => [
80
80
  te(ae(t.label), 1)
81
81
  ]),
82
82
  _: 1
83
- }, 8, ["class"])) : P("", !0)
84
- ], 10, be));
83
+ }, 8, ["class"])) : $("", !0)
84
+ ], 10, ve));
85
85
  }
86
- }), J = /* @__PURE__ */ de(ve, [["__scopeId", "data-v-e2a79444"]]), De = /* @__PURE__ */ R({
86
+ }), J = /* @__PURE__ */ de(ge, [["__scopeId", "data-v-e2a79444"]]), De = /* @__PURE__ */ E({
87
87
  __name: "AmDateFilterPicker",
88
88
  props: /* @__PURE__ */ j({
89
89
  selected: { type: Boolean, default: !1 },
@@ -96,12 +96,12 @@ const me = G(
96
96
  }),
97
97
  emits: /* @__PURE__ */ j(["click"], ["update:date"]),
98
98
  setup(e, { expose: a, emit: t }) {
99
- const n = oe(e, "date"), u = t, c = h(), p = (s) => {
99
+ const n = le(e, "date"), u = t, c = k(), p = (s) => {
100
100
  var i;
101
101
  (i = c.value) == null || i.toggle(s), u("click", s);
102
102
  };
103
- return a({ popover: c }), (s, i) => (g(), F(I, null, [
104
- _(J, {
103
+ return a({ popover: c }), (s, i) => (b(), w(Y, null, [
104
+ B(J, {
105
105
  selected: s.selected,
106
106
  disabled: s.disabled,
107
107
  "is-custom": "",
@@ -111,14 +111,14 @@ const me = G(
111
111
  "hide-label": "",
112
112
  onClick: p
113
113
  }, null, 8, ["selected", "disabled"]),
114
- _(d(ue), {
114
+ B(d(ue), {
115
115
  "data-test": "amdatefilter-popover",
116
116
  ref_key: "popover",
117
117
  ref: c,
118
118
  "pt:content": "!p-0"
119
119
  }, {
120
- default: Y(() => [
121
- _(d(ce), {
120
+ default: I(() => [
121
+ B(d(ce), {
122
122
  "data-test": "amdatefilter-datepicker",
123
123
  modelValue: n.value,
124
124
  "onUpdate:modelValue": i[0] || (i[0] = (m) => n.value = m),
@@ -137,31 +137,28 @@ const me = G(
137
137
  }, 512)
138
138
  ], 64));
139
139
  }
140
- }), E = "America/Sao_Paulo", v = (e = E) => {
140
+ }), v = "America/Sao_Paulo", y = (e = v) => {
141
141
  const a = /* @__PURE__ */ new Date(), t = new Date(a.toLocaleString("en-US", { timeZone: e }));
142
142
  return new Date(t.getFullYear(), t.getMonth(), t.getDate());
143
- }, y = (e, a = E) => {
144
- const t = v(a);
143
+ }, C = (e, a = v) => {
144
+ const t = y(a);
145
145
  return t.setDate(t.getDate() + e), t;
146
- }, T = (e) => {
147
- const a = e.getFullYear(), t = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
148
- return `${a}-${t}-${n}`;
149
- }, S = (e) => {
146
+ }, R = (e, a = v) => e.toLocaleDateString("en-CA", { timeZone: a }), x = (e) => {
150
147
  const a = e.split("T")[0], [t, n, u] = a.split("-").map(Number);
151
148
  return new Date(t, n - 1, u);
152
- }, B = (e, a) => e.getFullYear() === a.getFullYear() && e.getMonth() === a.getMonth() && e.getDate() === a.getDate(), ye = (e) => {
149
+ }, z = (e, a) => e.getFullYear() === a.getFullYear() && e.getMonth() === a.getMonth() && e.getDate() === a.getDate(), ye = (e, a = v) => {
153
150
  if (!Array.isArray(e) || e.length !== 2)
154
151
  throw new Error("Range de datas inválido");
155
- const [a, t] = e;
156
- if (!a || !t)
152
+ const [t, n] = e;
153
+ if (!t || !n)
157
154
  throw new Error("Datas não podem ser nulas");
158
- return [T(a), T(t)];
159
- }, he = (e = E) => ({
160
- Hoje: () => [v(e), v(e)],
161
- Ontem: () => [y(-1, e), y(-1, e)],
162
- "7D": () => [y(-6, e), v(e)],
163
- "14D": () => [y(-13, e), v(e)],
164
- "30D": () => [y(-29, e), v(e)],
155
+ return [R(t, a), R(n, a)];
156
+ }, he = (e = v) => ({
157
+ Hoje: () => [y(e), y(e)],
158
+ Ontem: () => [C(-1, e), C(-1, e)],
159
+ "7D": () => [C(-6, e), y(e)],
160
+ "14D": () => [C(-13, e), y(e)],
161
+ "30D": () => [C(-29, e), y(e)],
165
162
  Customizar: () => null
166
163
  }), Ce = {
167
164
  0: "Hoje",
@@ -169,14 +166,14 @@ const me = G(
169
166
  7: "7D",
170
167
  14: "14D",
171
168
  30: "30D"
172
- }, U = (e) => {
169
+ }, U = (e, a = v) => {
173
170
  if (!(!e || e.length === 0))
174
- return e.map((a) => a instanceof Date ? T(a) : String(a));
171
+ return e.map((t) => t instanceof Date ? R(t, a) : String(t));
175
172
  }, ke = (e, a, t) => {
176
173
  if (!e || e.length !== 2)
177
174
  return "Customizar";
178
175
  try {
179
- const [n, u] = e, c = S(n), p = S(u);
176
+ const [n, u] = e, c = x(n), p = x(u);
180
177
  if (isNaN(c.getTime()) || isNaN(p.getTime()))
181
178
  return "Customizar";
182
179
  for (const s of a) {
@@ -185,15 +182,15 @@ const me = G(
185
182
  if (!i) continue;
186
183
  const m = i();
187
184
  if (!m || !Array.isArray(m) || m.length !== 2) continue;
188
- const [w, x] = m;
189
- if (B(c, w) && B(p, x))
185
+ const [g, A] = m;
186
+ if (z(c, g) && z(p, A))
190
187
  return s;
191
188
  }
192
189
  return "Customizar";
193
190
  } catch {
194
191
  return "Customizar";
195
192
  }
196
- }, k = "Customizar", Ae = /* @__PURE__ */ R({
193
+ }, F = "Customizar", Se = /* @__PURE__ */ E({
197
194
  inheritAttrs: !1,
198
195
  __name: "AmDateFilter",
199
196
  props: {
@@ -204,7 +201,7 @@ const me = G(
204
201
  dateRangeConfigs: { default: () => ({}) },
205
202
  disabled: { type: Boolean },
206
203
  card: { type: Boolean },
207
- timeZone: { default: "America/Sao_Paulo" }
204
+ timeZone: { default: v }
208
205
  },
209
206
  emits: ["update:modelValue"],
210
207
  setup(e, { emit: a }) {
@@ -216,92 +213,92 @@ const me = G(
216
213
  dateRangeConfigs: s,
217
214
  disabled: i,
218
215
  card: m,
219
- timeZone: w
220
- } = le(t), x = a, D = h(k), $ = h(), f = h(null), C = h(!1), K = H(), N = M(() => !s.value || Object.keys(s.value).length === 0 ? ["Hoje", "Ontem", "7D", "14D", "30D"] : Object.keys(s.value)), Q = M(
221
- () => N.value.map((o) => ({
222
- label: o,
223
- value: o,
224
- selected: D.value === o
216
+ timeZone: g
217
+ } = oe(t), A = a, h = k(F), N = k(), f = k(null), _ = k(!1), K = H(), O = S(() => !s.value || Object.keys(s.value).length === 0 ? ["Hoje", "Ontem", "7D", "14D", "30D"] : Object.keys(s.value)), Q = S(
218
+ () => O.value.map((l) => ({
219
+ label: l,
220
+ value: l,
221
+ selected: h.value === l
225
222
  }))
226
- ), O = M(() => ({
227
- ...he(w.value),
223
+ ), P = S(() => ({
224
+ ...he(g.value),
228
225
  ...s.value
229
- })), z = (o) => {
230
- D.value = o;
231
- const r = O.value[o];
226
+ })), M = (l) => {
227
+ h.value = l;
228
+ const r = P.value[l];
232
229
  if (r) {
233
- const l = r();
234
- l && (C.value = !0, f.value = l);
230
+ const o = r();
231
+ o && (_.value = !0, f.value = o);
235
232
  }
236
- }, W = (o) => {
237
- if (C.value) return;
238
- const r = U(o), l = ke(
233
+ }, W = (l) => {
234
+ if (_.value) return;
235
+ const r = U(l, g.value), o = ke(
239
236
  r,
240
- N.value,
241
- O.value
237
+ O.value,
238
+ P.value
242
239
  );
243
- if (D.value !== l && (D.value = l), r && r.length === 2)
240
+ if (h.value !== o && (h.value = o), r && r.length === 2)
244
241
  try {
245
- const b = [
246
- S(r[0]),
247
- S(r[1])
242
+ const D = [
243
+ x(r[0]),
244
+ x(r[1])
248
245
  ];
249
- (!f.value || !B(f.value[0], b[0]) || !B(f.value[1], b[1])) && (f.value = b);
250
- } catch (b) {
251
- console.warn("Erro ao sincronizar datas do modelValue:", b);
246
+ (!f.value || !z(f.value[0], D[0]) || !z(f.value[1], D[1])) && (f.value = D);
247
+ } catch (D) {
248
+ console.warn("Erro ao sincronizar datas do modelValue:", D);
252
249
  }
253
250
  }, X = () => {
254
- z(k);
255
- }, Z = (o) => {
256
- z(o);
257
- }, ee = (o) => {
258
- const r = U(p.value);
251
+ M(F);
252
+ }, Z = (l) => {
253
+ M(l);
254
+ }, ee = (l) => {
255
+ const r = U(p.value, g.value);
259
256
  if (r && r.length === 2) return;
260
- const l = o !== void 0 ? Ce[o] : k;
261
- l && z(l);
257
+ const o = l !== void 0 ? Ce[l] : F;
258
+ o && M(o);
262
259
  };
263
- return A(p, (o) => W(o), {
260
+ return L(p, (l) => W(l), {
264
261
  immediate: !0,
265
262
  deep: !0
266
- }), A(
263
+ }), L(
267
264
  f,
268
- async (o) => {
269
- var r, l;
270
- if ((o == null ? void 0 : o.length) === 2 && o[0] && o[1])
265
+ async (l) => {
266
+ var r, o;
267
+ if ((l == null ? void 0 : l.length) === 2 && l[0] && l[1])
271
268
  try {
272
- (l = (r = $.value) == null ? void 0 : r.popover) == null || l.hide(), x("update:modelValue", ye(o)), await re(), C.value = !1;
269
+ (o = (r = N.value) == null ? void 0 : r.popover) == null || o.hide(), A("update:modelValue", ye(l, g.value)), await re(), _.value = !1;
273
270
  } catch {
274
- C.value = !1;
271
+ _.value = !1;
275
272
  }
276
273
  },
277
274
  { deep: !0 }
278
- ), A(n, (o) => ee(o), { immediate: !0 }), (o, r) => (g(), F("div", {
275
+ ), L(n, (l) => ee(l), { immediate: !0 }), (l, r) => (b(), w("div", {
279
276
  role: "group",
280
277
  "aria-label": "Filtro de período",
281
278
  class: V(d(pe)({ card: d(m), disabled: d(i) }, d(K).class))
282
279
  }, [
283
- _(De, {
280
+ B(De, {
284
281
  ref_key: "pickerRef",
285
- ref: $,
282
+ ref: N,
286
283
  date: f.value,
287
- "onUpdate:date": r[0] || (r[0] = (l) => f.value = l),
288
- selected: D.value === k,
284
+ "onUpdate:date": r[0] || (r[0] = (o) => f.value = o),
285
+ selected: h.value === F,
289
286
  disabled: d(i),
290
287
  "min-date": d(u) || void 0,
291
288
  "max-date": d(c) || void 0,
292
289
  onClick: X
293
290
  }, null, 8, ["date", "selected", "disabled", "min-date", "max-date"]),
294
- (g(!0), F(I, null, se(Q.value, (l) => (g(), L(J, {
295
- key: l.value,
296
- selected: l.selected,
291
+ (b(!0), w(Y, null, se(Q.value, (o) => (b(), T(J, {
292
+ key: o.value,
293
+ selected: o.selected,
297
294
  disabled: d(i),
298
- "data-test": `amdatefilter-toolbar-${l.value.toLowerCase()}`,
299
- label: l.label,
300
- onClick: (b) => Z(l.value)
295
+ "data-test": `amdatefilter-toolbar-${o.value.toLowerCase()}`,
296
+ label: o.label,
297
+ onClick: (D) => Z(o.value)
301
298
  }, null, 8, ["selected", "disabled", "data-test", "label", "onClick"]))), 128))
302
299
  ], 2));
303
300
  }
304
301
  });
305
302
  export {
306
- Ae as default
303
+ Se as default
307
304
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appmax_npm/ds-prime",
3
- "version": "1.0.0-alpha.176",
3
+ "version": "1.0.0-alpha.177",
4
4
  "description": "Design System da Appmax baseado no Primevue",
5
5
  "author": "Appmax",
6
6
  "exports": {