@appmax_npm/ds-prime 1.0.0-alpha.131 → 1.0.0-alpha.133
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/amdatefilter/index.js +43 -39
- package/css/index.css +1 -1
- package/package.json +1 -1
package/amdatefilter/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { _ as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as V, toRefs as B, ref as p, computed as v, watch as g, nextTick as R, openBlock as U, createElementBlock as Y, createVNode as y, unref as u, withCtx as q } from "vue";
|
|
2
|
+
import G from "primevue/menu";
|
|
3
|
+
import J from "primevue/popover";
|
|
4
|
+
import K from "primevue/datepicker";
|
|
5
|
+
import { _ as Q } from "../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
|
+
const W = /* @__PURE__ */ V({
|
|
7
7
|
__name: "AmDateFilter",
|
|
8
8
|
props: {
|
|
9
9
|
defaultSelected: {},
|
|
@@ -14,8 +14,8 @@ const Q = /* @__PURE__ */ B({
|
|
|
14
14
|
style: {}
|
|
15
15
|
},
|
|
16
16
|
emits: ["update:modelValue"],
|
|
17
|
-
setup(b, { emit:
|
|
18
|
-
const
|
|
17
|
+
setup(b, { emit: x }) {
|
|
18
|
+
const z = b, { defaultSelected: w, minDate: E, maxDate: _, modelValue: F } = B(z), O = x, d = p("Customizar"), D = p(), n = p(null), f = p(!1), S = v(() => ({
|
|
19
19
|
root: {
|
|
20
20
|
class: "!min-w-0 am-date-filter"
|
|
21
21
|
},
|
|
@@ -37,18 +37,22 @@ const Q = /* @__PURE__ */ B({
|
|
|
37
37
|
}, r = (e) => {
|
|
38
38
|
const t = s(), a = new Date(t);
|
|
39
39
|
return a.setDate(t.getDate() + e), a;
|
|
40
|
-
},
|
|
40
|
+
}, h = (e) => {
|
|
41
|
+
const t = new Date(e);
|
|
42
|
+
return t.setHours(0, 0, 0, 0), t;
|
|
43
|
+
}, o = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), H = (e) => {
|
|
41
44
|
if (!e || e.length !== 2)
|
|
42
45
|
return "Customizar";
|
|
43
46
|
try {
|
|
44
|
-
const [t, a] = e,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const [t, a] = e, i = h(new Date(t)), c = h(new Date(a));
|
|
48
|
+
if (isNaN(i.getTime()) || isNaN(c.getTime()))
|
|
49
|
+
return "Customizar";
|
|
50
|
+
const m = s(), C = r(-1), N = r(-6), P = r(-13), T = r(-29);
|
|
51
|
+
return o(i, m) && o(c, m) ? "Hoje" : o(i, C) && o(c, C) ? "Ontem" : o(i, N) && o(c, m) ? "7D" : o(i, P) && o(c, m) ? "14D" : o(i, T) && o(c, m) ? "30D" : "Customizar";
|
|
52
|
+
} catch {
|
|
53
|
+
return "Customizar";
|
|
50
54
|
}
|
|
51
|
-
},
|
|
55
|
+
}, k = v(() => ({
|
|
52
56
|
Hoje: () => [s(), s()],
|
|
53
57
|
Ontem: () => [r(-1), r(-1)],
|
|
54
58
|
"7D": () => [r(-6), s()],
|
|
@@ -57,15 +61,15 @@ const Q = /* @__PURE__ */ B({
|
|
|
57
61
|
Customizar: () => null
|
|
58
62
|
})), l = (e) => {
|
|
59
63
|
d.value = e;
|
|
60
|
-
const t =
|
|
64
|
+
const t = k.value[e];
|
|
61
65
|
if (t) {
|
|
62
66
|
const a = t();
|
|
63
67
|
a && (f.value = !0, n.value = a);
|
|
64
68
|
}
|
|
65
|
-
},
|
|
69
|
+
}, j = (e) => {
|
|
66
70
|
if (f.value)
|
|
67
71
|
return;
|
|
68
|
-
const t =
|
|
72
|
+
const t = H(e);
|
|
69
73
|
if (d.value !== t && (d.value = t), e && e.length === 2)
|
|
70
74
|
try {
|
|
71
75
|
const a = [
|
|
@@ -76,16 +80,16 @@ const Q = /* @__PURE__ */ B({
|
|
|
76
80
|
} catch (a) {
|
|
77
81
|
console.warn("Erro ao sincronizar datas do modelValue:", a);
|
|
78
82
|
}
|
|
79
|
-
},
|
|
83
|
+
}, A = (e) => {
|
|
80
84
|
var t;
|
|
81
85
|
(t = D.value) == null || t.toggle(e), l("Customizar");
|
|
82
|
-
},
|
|
86
|
+
}, I = v(() => {
|
|
83
87
|
const e = d.value, t = (a) => e === a ? "bg-[#EBE1FE]" : "";
|
|
84
88
|
return [
|
|
85
89
|
{
|
|
86
90
|
label: "Customizar",
|
|
87
91
|
icon: "pi pi-calendar",
|
|
88
|
-
command: (a) =>
|
|
92
|
+
command: (a) => A(a.originalEvent),
|
|
89
93
|
class: [
|
|
90
94
|
"am-v3-date-filter-selector-item-customize",
|
|
91
95
|
"custom",
|
|
@@ -118,7 +122,7 @@ const Q = /* @__PURE__ */ B({
|
|
|
118
122
|
class: ["am-v3-date-filter-selector-item-30d", t("30D")]
|
|
119
123
|
}
|
|
120
124
|
];
|
|
121
|
-
}),
|
|
125
|
+
}), L = (e) => {
|
|
122
126
|
const a = e !== void 0 ? {
|
|
123
127
|
0: "Hoje",
|
|
124
128
|
1: "Ontem",
|
|
@@ -127,7 +131,7 @@ const Q = /* @__PURE__ */ B({
|
|
|
127
131
|
30: "30D"
|
|
128
132
|
}[e] : "Customizar";
|
|
129
133
|
a && l(a);
|
|
130
|
-
},
|
|
134
|
+
}, M = (e) => {
|
|
131
135
|
if (!Array.isArray(e) || e.length !== 2)
|
|
132
136
|
throw new Error("Range de datas inválido");
|
|
133
137
|
const [t, a] = e;
|
|
@@ -136,9 +140,9 @@ const Q = /* @__PURE__ */ B({
|
|
|
136
140
|
return [t.toISOString(), a.toISOString()];
|
|
137
141
|
};
|
|
138
142
|
return g(
|
|
139
|
-
|
|
143
|
+
F,
|
|
140
144
|
(e) => {
|
|
141
|
-
|
|
145
|
+
j(e);
|
|
142
146
|
},
|
|
143
147
|
{ immediate: !0, deep: !0 }
|
|
144
148
|
), g(
|
|
@@ -148,35 +152,35 @@ const Q = /* @__PURE__ */ B({
|
|
|
148
152
|
if ((e == null ? void 0 : e.length) === 2 && e[0] && e[1])
|
|
149
153
|
try {
|
|
150
154
|
(t = D.value) == null || t.hide();
|
|
151
|
-
const a =
|
|
152
|
-
|
|
155
|
+
const a = M(e);
|
|
156
|
+
O("update:modelValue", a), await R(), f.value = !1;
|
|
153
157
|
} catch {
|
|
154
158
|
f.value = !1;
|
|
155
159
|
}
|
|
156
160
|
},
|
|
157
161
|
{ deep: !0 }
|
|
158
|
-
), g(
|
|
159
|
-
y(u(
|
|
162
|
+
), g(w, (e) => L(e), { immediate: !0 }), (e, t) => (U(), Y("div", null, [
|
|
163
|
+
y(u(G), {
|
|
160
164
|
"data-test": "amdatefilter-toolbar",
|
|
161
|
-
model:
|
|
162
|
-
pt:
|
|
165
|
+
model: I.value,
|
|
166
|
+
pt: S.value
|
|
163
167
|
}, null, 8, ["model", "pt"]),
|
|
164
|
-
y(u(
|
|
168
|
+
y(u(J), {
|
|
165
169
|
"data-test": "amdatefilter-popover",
|
|
166
170
|
ref_key: "popover",
|
|
167
171
|
ref: D,
|
|
168
172
|
"pt:content": "!p-0"
|
|
169
173
|
}, {
|
|
170
|
-
default:
|
|
171
|
-
y(u(
|
|
174
|
+
default: q(() => [
|
|
175
|
+
y(u(K), {
|
|
172
176
|
"data-test": "amdatefilter-datepicker",
|
|
173
177
|
modelValue: n.value,
|
|
174
178
|
"onUpdate:modelValue": t[0] || (t[0] = (a) => n.value = a),
|
|
175
179
|
selectionMode: "range",
|
|
176
180
|
inline: "",
|
|
177
181
|
dateFormat: "yyyy-mm-dd",
|
|
178
|
-
minDate: u(
|
|
179
|
-
maxDate: u(
|
|
182
|
+
minDate: u(E),
|
|
183
|
+
maxDate: u(_),
|
|
180
184
|
"pt:dayCell": "!p-0",
|
|
181
185
|
"pt:tableHeaderCell": "!p-0",
|
|
182
186
|
"pt:panel": "!p-0 !border-none",
|
|
@@ -187,7 +191,7 @@ const Q = /* @__PURE__ */ B({
|
|
|
187
191
|
}, 512)
|
|
188
192
|
]));
|
|
189
193
|
}
|
|
190
|
-
}),
|
|
194
|
+
}), ae = /* @__PURE__ */ Q(W, [["__scopeId", "data-v-5f5e9eaf"]]);
|
|
191
195
|
export {
|
|
192
|
-
|
|
196
|
+
ae as default
|
|
193
197
|
};
|