@mhmo91/schmancy 0.4.42 → 0.4.43
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/dist/{avatar-CTMslQhQ.js → avatar-B_cWIpIJ.js} +2 -2
- package/dist/{avatar-CTMslQhQ.js.map → avatar-B_cWIpIJ.js.map} +1 -1
- package/dist/{avatar-mtNrDY7i.cjs → avatar-DMqFLv9E.cjs} +2 -2
- package/dist/{avatar-mtNrDY7i.cjs.map → avatar-DMqFLv9E.cjs.map} +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/{date-range-DG2gpDMM.js → date-range-B7VG8UXD.js} +117 -107
- package/dist/date-range-B7VG8UXD.js.map +1 -0
- package/dist/{date-range-0L9-_r4A.cjs → date-range-CREpHqxO.cjs} +12 -12
- package/dist/date-range-CREpHqxO.cjs.map +1 -0
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +1 -1
- package/types/src/date-range/date-range.d.ts +8 -0
- package/dist/date-range-0L9-_r4A.cjs.map +0 -1
- package/dist/date-range-DG2gpDMM.js.map +0 -1
|
@@ -3,25 +3,25 @@ import "lit/directives/class-map.js";
|
|
|
3
3
|
import "lit/directives/style-map.js";
|
|
4
4
|
import { $ as ue } from "./litElement.mixin-BH9PTyUD.js";
|
|
5
5
|
import "./tailwind.mixin-CaIkmP6j.js";
|
|
6
|
-
import { property as T, customElement as ce, state as
|
|
6
|
+
import { property as T, customElement as ce, state as j } from "lit/decorators.js";
|
|
7
7
|
import { g as he } from "./_commonjsHelpers-Dw9sPFZy.js";
|
|
8
|
-
import { html as
|
|
8
|
+
import { html as W } from "lit";
|
|
9
9
|
import { $ as J } from "./dialog-service-DFMlRcXf.js";
|
|
10
|
-
import { ifDefined as
|
|
10
|
+
import { ifDefined as z } from "lit/directives/if-defined.js";
|
|
11
11
|
var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
|
|
12
12
|
var t = 1e3, a = 6e4, e = 36e5, n = "millisecond", l = "second", r = "minute", c = "hour", f = "day", v = "week", $ = "month", Y = "quarter", O = "year", L = "date", ee = "Invalid Date", le = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, me = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, pe = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(h) {
|
|
13
13
|
var o = ["th", "st", "nd", "rd"], s = h % 100;
|
|
14
14
|
return "[" + h + (o[(s - 20) % 10] || o[s] || o[0]) + "]";
|
|
15
15
|
} }, K = function(h, o, s) {
|
|
16
|
-
var
|
|
17
|
-
return !
|
|
16
|
+
var u = String(h);
|
|
17
|
+
return !u || u.length >= o ? h : "" + Array(o + 1 - u.length).join(s) + h;
|
|
18
18
|
}, fe = { s: K, z: function(h) {
|
|
19
|
-
var o = -h.utcOffset(), s = Math.abs(o),
|
|
20
|
-
return (o <= 0 ? "+" : "-") + K(
|
|
19
|
+
var o = -h.utcOffset(), s = Math.abs(o), u = Math.floor(s / 60), i = s % 60;
|
|
20
|
+
return (o <= 0 ? "+" : "-") + K(u, 2, "0") + ":" + K(i, 2, "0");
|
|
21
21
|
}, m: function h(o, s) {
|
|
22
22
|
if (o.date() < s.date()) return -h(s, o);
|
|
23
|
-
var
|
|
24
|
-
return +(-(
|
|
23
|
+
var u = 12 * (s.year() - o.year()) + (s.month() - o.month()), i = o.clone().add(u, $), m = s - i < 0, p = o.clone().add(u + (m ? -1 : 1), $);
|
|
24
|
+
return +(-(u + (s - i) / (m ? i - p : p - i)) || 0);
|
|
25
25
|
}, a: function(h) {
|
|
26
26
|
return h < 0 ? Math.ceil(h) || 0 : Math.floor(h);
|
|
27
27
|
}, p: function(h) {
|
|
@@ -32,7 +32,7 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
|
|
|
32
32
|
A[E] = pe;
|
|
33
33
|
var te = "$isDayjsObject", Z = function(h) {
|
|
34
34
|
return h instanceof U || !(!h || !h[te]);
|
|
35
|
-
}, I = function h(o, s,
|
|
35
|
+
}, I = function h(o, s, u) {
|
|
36
36
|
var i;
|
|
37
37
|
if (!o) return E;
|
|
38
38
|
if (typeof o == "string") {
|
|
@@ -44,7 +44,7 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
|
|
|
44
44
|
var g = o.name;
|
|
45
45
|
A[g] = o, i = g;
|
|
46
46
|
}
|
|
47
|
-
return !
|
|
47
|
+
return !u && i && (E = i), i || !u && E;
|
|
48
48
|
}, w = function(h, o) {
|
|
49
49
|
if (Z(h)) return h.clone();
|
|
50
50
|
var s = typeof o == "object" ? o : {};
|
|
@@ -59,8 +59,8 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
|
|
|
59
59
|
}
|
|
60
60
|
var o = h.prototype;
|
|
61
61
|
return o.parse = function(s) {
|
|
62
|
-
this.$d = function(
|
|
63
|
-
var i =
|
|
62
|
+
this.$d = function(u) {
|
|
63
|
+
var i = u.date, m = u.utc;
|
|
64
64
|
if (i === null) return /* @__PURE__ */ new Date(NaN);
|
|
65
65
|
if (y.u(i)) return /* @__PURE__ */ new Date();
|
|
66
66
|
if (i instanceof Date) return new Date(i);
|
|
@@ -80,34 +80,34 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
|
|
|
80
80
|
return y;
|
|
81
81
|
}, o.isValid = function() {
|
|
82
82
|
return this.$d.toString() !== ee;
|
|
83
|
-
}, o.isSame = function(s,
|
|
83
|
+
}, o.isSame = function(s, u) {
|
|
84
84
|
var i = w(s);
|
|
85
|
-
return this.startOf(
|
|
86
|
-
}, o.isAfter = function(s,
|
|
87
|
-
return w(s) < this.startOf(
|
|
88
|
-
}, o.isBefore = function(s,
|
|
89
|
-
return this.endOf(
|
|
90
|
-
}, o.$g = function(s,
|
|
91
|
-
return y.u(s) ? this[
|
|
85
|
+
return this.startOf(u) <= i && i <= this.endOf(u);
|
|
86
|
+
}, o.isAfter = function(s, u) {
|
|
87
|
+
return w(s) < this.startOf(u);
|
|
88
|
+
}, o.isBefore = function(s, u) {
|
|
89
|
+
return this.endOf(u) < w(s);
|
|
90
|
+
}, o.$g = function(s, u, i) {
|
|
91
|
+
return y.u(s) ? this[u] : this.set(i, s);
|
|
92
92
|
}, o.unix = function() {
|
|
93
93
|
return Math.floor(this.valueOf() / 1e3);
|
|
94
94
|
}, o.valueOf = function() {
|
|
95
95
|
return this.$d.getTime();
|
|
96
|
-
}, o.startOf = function(s,
|
|
97
|
-
var i = this, m = !!y.u(
|
|
98
|
-
var C = y.w(i.$u ? Date.UTC(i.$y,
|
|
96
|
+
}, o.startOf = function(s, u) {
|
|
97
|
+
var i = this, m = !!y.u(u) || u, p = y.p(s), g = function(H, S) {
|
|
98
|
+
var C = y.w(i.$u ? Date.UTC(i.$y, S, H) : new Date(i.$y, S, H), i);
|
|
99
99
|
return m ? C : C.endOf(f);
|
|
100
|
-
}, b = function(H,
|
|
101
|
-
return y.w(i.toDate()[H].apply(i.toDate("s"), (m ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(
|
|
102
|
-
}, F = this.$W,
|
|
100
|
+
}, b = function(H, S) {
|
|
101
|
+
return y.w(i.toDate()[H].apply(i.toDate("s"), (m ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(S)), i);
|
|
102
|
+
}, F = this.$W, k = this.$M, x = this.$D, q = "set" + (this.$u ? "UTC" : "");
|
|
103
103
|
switch (p) {
|
|
104
104
|
case O:
|
|
105
105
|
return m ? g(1, 0) : g(31, 11);
|
|
106
106
|
case $:
|
|
107
|
-
return m ? g(1,
|
|
107
|
+
return m ? g(1, k) : g(0, k + 1);
|
|
108
108
|
case v:
|
|
109
|
-
var _ = this.$locale().weekStart || 0,
|
|
110
|
-
return g(m ? x -
|
|
109
|
+
var _ = this.$locale().weekStart || 0, N = (F < _ ? F + 7 : F) - _;
|
|
110
|
+
return g(m ? x - N : x + (6 - N), k);
|
|
111
111
|
case f:
|
|
112
112
|
case L:
|
|
113
113
|
return b(q + "Hours", 0);
|
|
@@ -122,23 +122,23 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
|
|
|
122
122
|
}
|
|
123
123
|
}, o.endOf = function(s) {
|
|
124
124
|
return this.startOf(s, !1);
|
|
125
|
-
}, o.$set = function(s,
|
|
126
|
-
var i, m = y.p(s), p = "set" + (this.$u ? "UTC" : ""), g = (i = {}, i[f] = p + "Date", i[L] = p + "Date", i[$] = p + "Month", i[O] = p + "FullYear", i[c] = p + "Hours", i[r] = p + "Minutes", i[l] = p + "Seconds", i[n] = p + "Milliseconds", i)[m], b = m === f ? this.$D + (
|
|
125
|
+
}, o.$set = function(s, u) {
|
|
126
|
+
var i, m = y.p(s), p = "set" + (this.$u ? "UTC" : ""), g = (i = {}, i[f] = p + "Date", i[L] = p + "Date", i[$] = p + "Month", i[O] = p + "FullYear", i[c] = p + "Hours", i[r] = p + "Minutes", i[l] = p + "Seconds", i[n] = p + "Milliseconds", i)[m], b = m === f ? this.$D + (u - this.$W) : u;
|
|
127
127
|
if (m === $ || m === O) {
|
|
128
128
|
var F = this.clone().set(L, 1);
|
|
129
129
|
F.$d[g](b), F.init(), this.$d = F.set(L, Math.min(this.$D, F.daysInMonth())).$d;
|
|
130
130
|
} else g && this.$d[g](b);
|
|
131
131
|
return this.init(), this;
|
|
132
|
-
}, o.set = function(s,
|
|
133
|
-
return this.clone().$set(s,
|
|
132
|
+
}, o.set = function(s, u) {
|
|
133
|
+
return this.clone().$set(s, u);
|
|
134
134
|
}, o.get = function(s) {
|
|
135
135
|
return this[y.p(s)]();
|
|
136
|
-
}, o.add = function(s,
|
|
136
|
+
}, o.add = function(s, u) {
|
|
137
137
|
var i, m = this;
|
|
138
138
|
s = Number(s);
|
|
139
|
-
var p = y.p(
|
|
139
|
+
var p = y.p(u), g = function(k) {
|
|
140
140
|
var x = w(m);
|
|
141
|
-
return y.w(x.date(x.date() + Math.round(
|
|
141
|
+
return y.w(x.date(x.date() + Math.round(k * s)), m);
|
|
142
142
|
};
|
|
143
143
|
if (p === $) return this.set($, this.$M + s);
|
|
144
144
|
if (p === O) return this.set(O, this.$y + s);
|
|
@@ -146,26 +146,26 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
|
|
|
146
146
|
if (p === v) return g(7);
|
|
147
147
|
var b = (i = {}, i[r] = a, i[c] = e, i[l] = t, i)[p] || 1, F = this.$d.getTime() + s * b;
|
|
148
148
|
return y.w(F, this);
|
|
149
|
-
}, o.subtract = function(s,
|
|
150
|
-
return this.add(-1 * s,
|
|
149
|
+
}, o.subtract = function(s, u) {
|
|
150
|
+
return this.add(-1 * s, u);
|
|
151
151
|
}, o.format = function(s) {
|
|
152
|
-
var
|
|
152
|
+
var u = this, i = this.$locale();
|
|
153
153
|
if (!this.isValid()) return i.invalidDate || ee;
|
|
154
|
-
var m = s || "YYYY-MM-DDTHH:mm:ssZ", p = y.z(this), g = this.$H, b = this.$m, F = this.$M,
|
|
155
|
-
return
|
|
156
|
-
},
|
|
157
|
-
return y.s(g % 12 || 12,
|
|
158
|
-
}, H = q || function(
|
|
159
|
-
var
|
|
160
|
-
return
|
|
154
|
+
var m = s || "YYYY-MM-DDTHH:mm:ssZ", p = y.z(this), g = this.$H, b = this.$m, F = this.$M, k = i.weekdays, x = i.months, q = i.meridiem, _ = function(S, C, V, B) {
|
|
155
|
+
return S && (S[C] || S(u, m)) || V[C].slice(0, B);
|
|
156
|
+
}, N = function(S) {
|
|
157
|
+
return y.s(g % 12 || 12, S, "0");
|
|
158
|
+
}, H = q || function(S, C, V) {
|
|
159
|
+
var B = S < 12 ? "AM" : "PM";
|
|
160
|
+
return V ? B.toLowerCase() : B;
|
|
161
161
|
};
|
|
162
|
-
return m.replace(me, function(
|
|
163
|
-
return C || function(
|
|
164
|
-
switch (
|
|
162
|
+
return m.replace(me, function(S, C) {
|
|
163
|
+
return C || function(V) {
|
|
164
|
+
switch (V) {
|
|
165
165
|
case "YY":
|
|
166
|
-
return String(
|
|
166
|
+
return String(u.$y).slice(-2);
|
|
167
167
|
case "YYYY":
|
|
168
|
-
return y.s(
|
|
168
|
+
return y.s(u.$y, 4, "0");
|
|
169
169
|
case "M":
|
|
170
170
|
return F + 1;
|
|
171
171
|
case "MM":
|
|
@@ -175,25 +175,25 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
|
|
|
175
175
|
case "MMMM":
|
|
176
176
|
return _(x, F);
|
|
177
177
|
case "D":
|
|
178
|
-
return
|
|
178
|
+
return u.$D;
|
|
179
179
|
case "DD":
|
|
180
|
-
return y.s(
|
|
180
|
+
return y.s(u.$D, 2, "0");
|
|
181
181
|
case "d":
|
|
182
|
-
return String(
|
|
182
|
+
return String(u.$W);
|
|
183
183
|
case "dd":
|
|
184
|
-
return _(i.weekdaysMin,
|
|
184
|
+
return _(i.weekdaysMin, u.$W, k, 2);
|
|
185
185
|
case "ddd":
|
|
186
|
-
return _(i.weekdaysShort,
|
|
186
|
+
return _(i.weekdaysShort, u.$W, k, 3);
|
|
187
187
|
case "dddd":
|
|
188
|
-
return
|
|
188
|
+
return k[u.$W];
|
|
189
189
|
case "H":
|
|
190
190
|
return String(g);
|
|
191
191
|
case "HH":
|
|
192
192
|
return y.s(g, 2, "0");
|
|
193
193
|
case "h":
|
|
194
|
-
return
|
|
194
|
+
return N(1);
|
|
195
195
|
case "hh":
|
|
196
|
-
return
|
|
196
|
+
return N(2);
|
|
197
197
|
case "a":
|
|
198
198
|
return H(g, b, !0);
|
|
199
199
|
case "A":
|
|
@@ -203,21 +203,21 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
|
|
|
203
203
|
case "mm":
|
|
204
204
|
return y.s(b, 2, "0");
|
|
205
205
|
case "s":
|
|
206
|
-
return String(
|
|
206
|
+
return String(u.$s);
|
|
207
207
|
case "ss":
|
|
208
|
-
return y.s(
|
|
208
|
+
return y.s(u.$s, 2, "0");
|
|
209
209
|
case "SSS":
|
|
210
|
-
return y.s(
|
|
210
|
+
return y.s(u.$ms, 3, "0");
|
|
211
211
|
case "Z":
|
|
212
212
|
return p;
|
|
213
213
|
}
|
|
214
214
|
return null;
|
|
215
|
-
}(
|
|
215
|
+
}(S) || p.replace(":", "");
|
|
216
216
|
});
|
|
217
217
|
}, o.utcOffset = function() {
|
|
218
218
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
219
|
-
}, o.diff = function(s,
|
|
220
|
-
var m, p = this, g = y.p(
|
|
219
|
+
}, o.diff = function(s, u, i) {
|
|
220
|
+
var m, p = this, g = y.p(u), b = w(s), F = (b.utcOffset() - this.utcOffset()) * a, k = this - b, x = function() {
|
|
221
221
|
return y.m(p, b);
|
|
222
222
|
};
|
|
223
223
|
switch (g) {
|
|
@@ -231,31 +231,31 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
|
|
|
231
231
|
m = x() / 3;
|
|
232
232
|
break;
|
|
233
233
|
case v:
|
|
234
|
-
m = (
|
|
234
|
+
m = (k - F) / 6048e5;
|
|
235
235
|
break;
|
|
236
236
|
case f:
|
|
237
|
-
m = (
|
|
237
|
+
m = (k - F) / 864e5;
|
|
238
238
|
break;
|
|
239
239
|
case c:
|
|
240
|
-
m =
|
|
240
|
+
m = k / e;
|
|
241
241
|
break;
|
|
242
242
|
case r:
|
|
243
|
-
m =
|
|
243
|
+
m = k / a;
|
|
244
244
|
break;
|
|
245
245
|
case l:
|
|
246
|
-
m =
|
|
246
|
+
m = k / t;
|
|
247
247
|
break;
|
|
248
248
|
default:
|
|
249
|
-
m =
|
|
249
|
+
m = k;
|
|
250
250
|
}
|
|
251
251
|
return i ? m : y.a(m);
|
|
252
252
|
}, o.daysInMonth = function() {
|
|
253
253
|
return this.endOf($).$D;
|
|
254
254
|
}, o.$locale = function() {
|
|
255
255
|
return A[this.$L];
|
|
256
|
-
}, o.locale = function(s,
|
|
256
|
+
}, o.locale = function(s, u) {
|
|
257
257
|
if (!s) return this.$L;
|
|
258
|
-
var i = this.clone(), m = I(s,
|
|
258
|
+
var i = this.clone(), m = I(s, u, !0);
|
|
259
259
|
return m && (i.$L = m), i;
|
|
260
260
|
}, o.clone = function() {
|
|
261
261
|
return y.w(this.$d, this);
|
|
@@ -279,7 +279,7 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
|
|
|
279
279
|
return w(1e3 * h);
|
|
280
280
|
}, w.en = A[E], w.Ls = A, w.p = {}, w;
|
|
281
281
|
}()), ie.exports);
|
|
282
|
-
const
|
|
282
|
+
const d = he(ve);
|
|
283
283
|
var ne, Q, X, oe = { exports: {} };
|
|
284
284
|
const be = he(ne ? oe.exports : (ne = 1, oe.exports = (Q = "month", X = "quarter", function(t, a) {
|
|
285
285
|
var e = a.prototype;
|
|
@@ -301,20 +301,20 @@ const be = he(ne ? oe.exports : (ne = 1, oe.exports = (Q = "month", X = "quarter
|
|
|
301
301
|
};
|
|
302
302
|
})));
|
|
303
303
|
function $e(t, a) {
|
|
304
|
-
return t.map((e) => ({ label: `Last ${e} Days`, range: { dateFrom:
|
|
304
|
+
return t.map((e) => ({ label: `Last ${e} Days`, range: { dateFrom: d().subtract(e - 1, "days").startOf("day").format(a), dateTo: d().endOf("day").format(a) }, step: "day" }));
|
|
305
305
|
}
|
|
306
306
|
function De(t, a) {
|
|
307
|
-
return t.map((e) => ({ label: `Last ${e} Weeks`, range: { dateFrom:
|
|
307
|
+
return t.map((e) => ({ label: `Last ${e} Weeks`, range: { dateFrom: d().subtract(e, "weeks").startOf("week").format(a), dateTo: d().endOf("day").format(a) }, step: "week" }));
|
|
308
308
|
}
|
|
309
309
|
function Te(t, a) {
|
|
310
|
-
return t.map((e) => ({ label: `Last ${e} Months`, range: { dateFrom:
|
|
310
|
+
return t.map((e) => ({ label: `Last ${e} Months`, range: { dateFrom: d().subtract(e, "months").startOf("month").format(a), dateTo: d().endOf("day").format(a) }, step: "month" }));
|
|
311
311
|
}
|
|
312
312
|
function we(t, a) {
|
|
313
|
-
return t.map((e) => ({ label: `Last ${e} Quarters`, range: { dateFrom:
|
|
313
|
+
return t.map((e) => ({ label: `Last ${e} Quarters`, range: { dateFrom: d().subtract(e, "quarters").startOf("quarter").format(a), dateTo: d().endOf("day").format(a) }, step: "quarter" }));
|
|
314
314
|
}
|
|
315
315
|
function de(t, a) {
|
|
316
316
|
if (!t) return null;
|
|
317
|
-
const e =
|
|
317
|
+
const e = d(t);
|
|
318
318
|
return e.isValid() ? e.format(a) : null;
|
|
319
319
|
}
|
|
320
320
|
function Fe(t, a, e) {
|
|
@@ -331,7 +331,7 @@ let P = class extends ue() {
|
|
|
331
331
|
}
|
|
332
332
|
handleFromDateChange(t) {
|
|
333
333
|
const a = t.target;
|
|
334
|
-
this.dateFrom = { ...this.dateFrom, value: a.value }, this.dateTo.value &&
|
|
334
|
+
this.dateFrom = { ...this.dateFrom, value: a.value }, this.dateTo.value && d(this.dateFrom.value).isAfter(d(this.dateTo.value)) && (this.dateTo = { ...this.dateTo, value: this.dateFrom.value }), this.dispatchEvent(new CustomEvent("date-change", { detail: { dateFrom: this.dateFrom.value, dateTo: this.dateTo.value }, bubbles: !0, composed: !0 }));
|
|
335
335
|
}
|
|
336
336
|
handleToDateChange(t) {
|
|
337
337
|
const a = t.target;
|
|
@@ -342,11 +342,11 @@ let P = class extends ue() {
|
|
|
342
342
|
}
|
|
343
343
|
applyManualDateSelection(t) {
|
|
344
344
|
t.stopPropagation();
|
|
345
|
-
const a =
|
|
345
|
+
const a = d(this.dateFrom.value), e = d(this.dateTo.value);
|
|
346
346
|
a.isValid() && e.isValid() ? (this.dispatchEvent(new CustomEvent("apply-dates", { detail: { dateFrom: this.dateFrom.value, dateTo: this.dateTo.value, swapIfNeeded: a.isAfter(e) }, bubbles: !0, composed: !0 })), J.dismiss()) : this.dispatchEvent(new CustomEvent("announce", { detail: { message: "Invalid date format. Please check your input." }, bubbles: !0, composed: !0 }));
|
|
347
347
|
}
|
|
348
348
|
render() {
|
|
349
|
-
return
|
|
349
|
+
return W`
|
|
350
350
|
<div class="w-full min-h-[400px] max-h-[80vh] flex flex-col p-4">
|
|
351
351
|
<!-- Custom Range Section with Inline Calendars -->
|
|
352
352
|
<schmancy-surface type="container" class="rounded-xl p-4 mb-6">
|
|
@@ -360,8 +360,8 @@ let P = class extends ue() {
|
|
|
360
360
|
<schmancy-input
|
|
361
361
|
type="${this.type}"
|
|
362
362
|
.value="${this.dateFrom.value}"
|
|
363
|
-
min="${
|
|
364
|
-
max="${
|
|
363
|
+
min="${z(this.minDate)}"
|
|
364
|
+
max="${z(this.maxDate)}"
|
|
365
365
|
@change="${this.handleFromDateChange}"
|
|
366
366
|
></schmancy-input>
|
|
367
367
|
</div>
|
|
@@ -374,8 +374,8 @@ let P = class extends ue() {
|
|
|
374
374
|
<schmancy-input
|
|
375
375
|
type="${this.type}"
|
|
376
376
|
.value="${this.dateTo.value}"
|
|
377
|
-
min="${
|
|
378
|
-
max="${
|
|
377
|
+
min="${z(this.dateFrom.value)}"
|
|
378
|
+
max="${z(this.maxDate)}"
|
|
379
379
|
@change="${this.handleToDateChange}"
|
|
380
380
|
></schmancy-input>
|
|
381
381
|
</div>
|
|
@@ -397,13 +397,13 @@ let P = class extends ue() {
|
|
|
397
397
|
<!-- Presets Section -->
|
|
398
398
|
<div class="flex-1 overflow-y-auto overflow-x-hidden min-h-0">
|
|
399
399
|
<div class="grid grid-cols-2 md:grid-cols-5 gap-6">
|
|
400
|
-
${this.presetCategories.map((t) =>
|
|
400
|
+
${this.presetCategories.map((t) => W`
|
|
401
401
|
<div class="space-y-3">
|
|
402
402
|
<schmancy-typography type="title" token="md" class="text-surface-onVariant font-medium">
|
|
403
403
|
${t.name}
|
|
404
404
|
</schmancy-typography>
|
|
405
405
|
<div class="space-y-1">
|
|
406
|
-
${t.presets.map((a) =>
|
|
406
|
+
${t.presets.map((a) => W`
|
|
407
407
|
<schmancy-button
|
|
408
408
|
variant="${this.activePreset === a.label ? "filled" : "text"}"
|
|
409
409
|
class="w-full justify-start text-left"
|
|
@@ -425,11 +425,11 @@ let P = class extends ue() {
|
|
|
425
425
|
}
|
|
426
426
|
};
|
|
427
427
|
R([T({ type: String })], P.prototype, "type", 2), R([T({ type: Object })], P.prototype, "dateFrom", 2), R([T({ type: Object })], P.prototype, "dateTo", 2), R([T({ type: String })], P.prototype, "minDate", 2), R([T({ type: String })], P.prototype, "maxDate", 2), R([T({ type: String })], P.prototype, "activePreset", 2), R([T({ type: Array })], P.prototype, "presetCategories", 2), P = R([ce("schmancy-date-range-dialog")], P);
|
|
428
|
-
var
|
|
429
|
-
for (var l, r = n > 1 ? void 0 : n ?
|
|
430
|
-
return n && r &&
|
|
428
|
+
var ke = Object.defineProperty, Se = Object.getOwnPropertyDescriptor, M = (t, a, e, n) => {
|
|
429
|
+
for (var l, r = n > 1 ? void 0 : n ? Se(a, e) : a, c = t.length - 1; c >= 0; c--) (l = t[c]) && (r = (n ? l(a, e, r) : l(r)) || r);
|
|
430
|
+
return n && r && ke(a, e, r), r;
|
|
431
431
|
};
|
|
432
|
-
|
|
432
|
+
d.extend(be);
|
|
433
433
|
let D = class extends ue() {
|
|
434
434
|
constructor() {
|
|
435
435
|
super(...arguments), this.type = "date", this.dateFrom = { label: "From", value: "" }, this.dateTo = { label: "To", value: "" }, this.customPresets = [], this.disabled = !1, this.required = !1, this.placeholder = "Select date range", this.clearable = !0, this.isOpen = !1, this.selectedDateRange = "", this.activePreset = null, this.announceMessage = "", this.isMobile = !1, this.presetRanges = [], this.presetCategories = [], this.memoizedPresets = /* @__PURE__ */ new Map();
|
|
@@ -439,7 +439,7 @@ let D = class extends ue() {
|
|
|
439
439
|
const t = this.getDateFormat(), a = Fe(this.dateFrom.value, this.dateTo.value, t);
|
|
440
440
|
if (a.isValid) this.dateFrom.value = a.dateFrom, this.dateTo.value = a.dateTo, this.updateSelectedDateRange();
|
|
441
441
|
else {
|
|
442
|
-
const e =
|
|
442
|
+
const e = d().format(t);
|
|
443
443
|
this.dateFrom.value = e, this.dateTo.value = e, this.updateSelectedDateRange();
|
|
444
444
|
}
|
|
445
445
|
this.setupEventHandlers();
|
|
@@ -467,7 +467,7 @@ let D = class extends ue() {
|
|
|
467
467
|
}
|
|
468
468
|
if (this.presetCategories = function(e, n = !1) {
|
|
469
469
|
const l = [];
|
|
470
|
-
return n && l.push({ name: "Hours", presets: [{ label: "Last 24 Hours", range: { dateFrom:
|
|
470
|
+
return n && l.push({ name: "Hours", presets: [{ label: "Last 24 Hours", range: { dateFrom: d().subtract(24, "hours").format(e), dateTo: d().format(e) }, step: "hour" }, { label: "Last 12 Hours", range: { dateFrom: d().subtract(12, "hours").format(e), dateTo: d().format(e) }, step: "hour" }] }), l.push({ name: "Days", presets: [{ label: "Today", range: { dateFrom: d().startOf("day").format(e), dateTo: d().endOf("day").format(e) }, step: "day" }, { label: "Yesterday", range: { dateFrom: d().subtract(1, "days").startOf("day").format(e), dateTo: d().subtract(1, "days").endOf("day").format(e) }, step: "day" }, ...$e([7, 14, 30, 60, 90], e)] }), l.push({ name: "Weeks", presets: [{ label: "This Week", range: { dateFrom: d().startOf("week").format(e), dateTo: d().endOf("week").format(e) }, step: "week" }, { label: "Last Week", range: { dateFrom: d().subtract(1, "weeks").startOf("week").format(e), dateTo: d().subtract(1, "weeks").endOf("week").format(e) }, step: "week" }, ...De([2, 4], e)] }), l.push({ name: "Months", presets: [{ label: "This Month", range: { dateFrom: d().startOf("month").format(e), dateTo: d().endOf("month").format(e) }, step: "month" }, { label: "Last Month", range: { dateFrom: d().subtract(1, "month").startOf("month").format(e), dateTo: d().subtract(1, "month").endOf("month").format(e) }, step: "month" }, ...Te([3, 6], e)] }), l.push({ name: "Quarters", presets: [{ label: "This Quarter", range: { dateFrom: d().startOf("quarter").format(e), dateTo: d().endOf("quarter").format(e) }, step: "quarter" }, { label: "Last Quarter", range: { dateFrom: d().subtract(1, "quarter").startOf("quarter").format(e), dateTo: d().subtract(1, "quarter").endOf("quarter").format(e) }, step: "quarter" }, ...we([2, 4], e)] }), l.push({ name: "Years", presets: [{ label: "This Year", range: { dateFrom: d().startOf("year").format(e), dateTo: d().endOf("year").format(e) }, step: "year" }, { label: "Last Year", range: { dateFrom: d().subtract(1, "year").startOf("year").format(e), dateTo: d().subtract(1, "year").endOf("year").format(e) }, step: "year" }, { label: "Year to Date", range: { dateFrom: d().startOf("year").format(e), dateTo: d().endOf("day").format(e) }, step: "day" }] }), l;
|
|
471
471
|
}(t, this.type === "datetime-local"), this.presetRanges = [], this.presetCategories.forEach((e) => {
|
|
472
472
|
this.presetRanges.push(...e.presets);
|
|
473
473
|
}), this.customPresets && this.customPresets.length > 0) {
|
|
@@ -484,7 +484,7 @@ let D = class extends ue() {
|
|
|
484
484
|
if (t) return this.selectedDateRange = t.label, void (this.activePreset = t.label);
|
|
485
485
|
this.checkAndUpdateActivePreset(this.dateFrom.value, this.dateTo.value), this.activePreset = null, this.selectedDateRange = function(a, e, n, l) {
|
|
486
486
|
if (!a || !e) return l;
|
|
487
|
-
const r =
|
|
487
|
+
const r = d(a), c = d(e);
|
|
488
488
|
if (!r.isValid() || !c.isValid()) return l;
|
|
489
489
|
const f = n === "datetime-local" ? r.format(" h:mm A") : "", v = n === "datetime-local" ? c.format(" h:mm A") : "";
|
|
490
490
|
return r.isSame(c, "day") ? `${r.format("MMM D, YYYY")}${f}` : r.isSame(c, "month") && r.isSame(c, "year") ? `${r.format("MMM D")}-${c.format("D, YYYY")}${v}` : r.isSame(c, "year") ? `${r.format("MMM D")} - ${c.format("MMM D, YYYY")}${v}` : `${r.format("MMM D, YYYY")}${f} - ${c.format("MMM D, YYYY")}${v}`;
|
|
@@ -499,7 +499,7 @@ let D = class extends ue() {
|
|
|
499
499
|
openDropdown() {
|
|
500
500
|
if (this.disabled || this.step !== void 0) return;
|
|
501
501
|
this.isOpen = !0;
|
|
502
|
-
const t =
|
|
502
|
+
const t = W`
|
|
503
503
|
<schmancy-date-range-dialog
|
|
504
504
|
.type="${this.type}"
|
|
505
505
|
.dateFrom="${this.dateFrom}"
|
|
@@ -528,7 +528,7 @@ let D = class extends ue() {
|
|
|
528
528
|
}
|
|
529
529
|
shiftDateRange(t, a) {
|
|
530
530
|
if (a.stopPropagation(), !this.dateFrom.value || !this.dateTo.value) return;
|
|
531
|
-
const e =
|
|
531
|
+
const e = d(this.dateFrom.value), n = d(this.dateTo.value);
|
|
532
532
|
if (!e.isValid() || !n.isValid()) return;
|
|
533
533
|
const l = this.getDateFormat(), r = t > 0 ? 1 : -1;
|
|
534
534
|
let c, f;
|
|
@@ -555,11 +555,11 @@ let D = class extends ue() {
|
|
|
555
555
|
v.isFullYear ? (c = r > 0 ? e.add(1, "year") : e.subtract(1, "year"), f = r > 0 ? n.add(1, "year") : n.subtract(1, "year")) : v.isFullMonth ? (c = r > 0 ? e.add(1, "month") : e.subtract(1, "month"), f = r > 0 ? n.add(1, "month") : n.subtract(1, "month")) : v.isFullWeek ? (c = r > 0 ? e.add(1, "week") : e.subtract(1, "week"), f = r > 0 ? n.add(1, "week") : n.subtract(1, "week")) : $ === 1 ? (c = r > 0 ? e.add(1, "day") : e.subtract(1, "day"), f = r > 0 ? n.add(1, "day") : n.subtract(1, "day")) : (c = r > 0 ? e.add($, "day") : e.subtract($, "day"), f = r > 0 ? n.add($, "day") : n.subtract($, "day"));
|
|
556
556
|
}
|
|
557
557
|
if (this.minDate) {
|
|
558
|
-
const v =
|
|
558
|
+
const v = d(this.minDate);
|
|
559
559
|
if (c.isBefore(v)) return;
|
|
560
560
|
}
|
|
561
561
|
if (this.maxDate) {
|
|
562
|
-
const v =
|
|
562
|
+
const v = d(this.maxDate);
|
|
563
563
|
if (f.isAfter(v)) return;
|
|
564
564
|
}
|
|
565
565
|
this.setDateRange(c.format(l), f.format(l)), this.checkAndUpdateActivePreset(c.format(l), f.format(l));
|
|
@@ -575,13 +575,13 @@ let D = class extends ue() {
|
|
|
575
575
|
break;
|
|
576
576
|
case "Home":
|
|
577
577
|
if (t.ctrlKey && (t.target === this || this.contains(t.target))) {
|
|
578
|
-
const e =
|
|
578
|
+
const e = d(this.dateFrom.value), n = d(this.dateTo.value), l = e.startOf("month"), r = n.diff(e, "day");
|
|
579
579
|
this.setDateRange(l.format(this.getDateFormat()), l.add(r, "day").format(this.getDateFormat())), t.preventDefault();
|
|
580
580
|
}
|
|
581
581
|
break;
|
|
582
582
|
case "End":
|
|
583
583
|
if (t.ctrlKey && (t.target === this || this.contains(t.target))) {
|
|
584
|
-
const e =
|
|
584
|
+
const e = d(this.dateFrom.value), n = d(this.dateTo.value), l = n.diff(e, "day"), r = n.endOf("month");
|
|
585
585
|
this.setDateRange(r.subtract(l, "day").format(this.getDateFormat()), r.format(this.getDateFormat())), t.preventDefault();
|
|
586
586
|
}
|
|
587
587
|
}
|
|
@@ -593,13 +593,23 @@ let D = class extends ue() {
|
|
|
593
593
|
checkMobileView() {
|
|
594
594
|
this.isMobile = window.innerWidth < 768;
|
|
595
595
|
}
|
|
596
|
+
canNavigateBackward() {
|
|
597
|
+
if (!this.dateFrom.value || !this.minDate) return !0;
|
|
598
|
+
const t = d(this.dateFrom.value), a = d(this.minDate);
|
|
599
|
+
return t.isAfter(a);
|
|
600
|
+
}
|
|
601
|
+
canNavigateForward() {
|
|
602
|
+
if (!this.dateTo.value || !this.maxDate) return !0;
|
|
603
|
+
const t = d(this.dateTo.value), a = d(this.maxDate);
|
|
604
|
+
return t.isBefore(a);
|
|
605
|
+
}
|
|
596
606
|
announceToScreenReader(t) {
|
|
597
607
|
this.announceMessage = t, ge(100).pipe(G(this.disconnecting)).subscribe(() => {
|
|
598
608
|
this.announceMessage = "";
|
|
599
609
|
});
|
|
600
610
|
}
|
|
601
611
|
render() {
|
|
602
|
-
return
|
|
612
|
+
return W`
|
|
603
613
|
<div class="relative ${this.disabled ? "opacity-60 pointer-events-none" : ""}">
|
|
604
614
|
<!-- Screen reader announcements -->
|
|
605
615
|
<div class="sr-only" role="status" aria-live="polite" aria-atomic="true">
|
|
@@ -612,7 +622,7 @@ let D = class extends ue() {
|
|
|
612
622
|
type="button"
|
|
613
623
|
aria-label="Previous ${this.activePreset ? this.activePreset.toLowerCase() : "date range"}"
|
|
614
624
|
@click=${(t) => this.shiftDateRange(-1, t)}
|
|
615
|
-
?disabled=${this.disabled || !this.dateFrom.value || !this.dateTo.value}
|
|
625
|
+
?disabled=${this.disabled || !this.dateFrom.value || !this.dateTo.value || !this.canNavigateBackward()}
|
|
616
626
|
>
|
|
617
627
|
arrow_left
|
|
618
628
|
</schmancy-icon-button>
|
|
@@ -636,7 +646,7 @@ let D = class extends ue() {
|
|
|
636
646
|
type="button"
|
|
637
647
|
aria-label="Next ${this.activePreset ? this.activePreset.toLowerCase() : "date range"}"
|
|
638
648
|
@click=${(t) => this.shiftDateRange(1, t)}
|
|
639
|
-
?disabled=${this.disabled || !this.dateFrom.value || !this.dateTo.value}
|
|
649
|
+
?disabled=${this.disabled || !this.dateFrom.value || !this.dateTo.value || !this.canNavigateForward()}
|
|
640
650
|
>
|
|
641
651
|
arrow_right
|
|
642
652
|
</schmancy-icon-button>
|
|
@@ -645,9 +655,9 @@ let D = class extends ue() {
|
|
|
645
655
|
`;
|
|
646
656
|
}
|
|
647
657
|
};
|
|
648
|
-
M([T({ type: String })], D.prototype, "type", 2), M([T({ type: Object })], D.prototype, "dateFrom", 2), M([T({ type: Object })], D.prototype, "dateTo", 2), M([T({ type: String })], D.prototype, "minDate", 2), M([T({ type: String })], D.prototype, "maxDate", 2), M([T({ type: Array })], D.prototype, "customPresets", 2), M([T({ type: String })], D.prototype, "format", 2), M([T({ type: Boolean })], D.prototype, "disabled", 2), M([T({ type: Boolean })], D.prototype, "required", 2), M([T({ type: String })], D.prototype, "placeholder", 2), M([T({ type: Boolean })], D.prototype, "clearable", 2), M([T()], D.prototype, "step", 2), M([
|
|
658
|
+
M([T({ type: String })], D.prototype, "type", 2), M([T({ type: Object })], D.prototype, "dateFrom", 2), M([T({ type: Object })], D.prototype, "dateTo", 2), M([T({ type: String })], D.prototype, "minDate", 2), M([T({ type: String })], D.prototype, "maxDate", 2), M([T({ type: Array })], D.prototype, "customPresets", 2), M([T({ type: String })], D.prototype, "format", 2), M([T({ type: Boolean })], D.prototype, "disabled", 2), M([T({ type: Boolean })], D.prototype, "required", 2), M([T({ type: String })], D.prototype, "placeholder", 2), M([T({ type: Boolean })], D.prototype, "clearable", 2), M([T()], D.prototype, "step", 2), M([j()], D.prototype, "isOpen", 2), M([j()], D.prototype, "selectedDateRange", 2), M([j()], D.prototype, "activePreset", 2), M([j()], D.prototype, "announceMessage", 2), M([j()], D.prototype, "isMobile", 2), D = M([ce("schmancy-date-range")], D);
|
|
649
659
|
export {
|
|
650
660
|
D as S,
|
|
651
661
|
Fe as v
|
|
652
662
|
};
|
|
653
|
-
//# sourceMappingURL=date-range-
|
|
663
|
+
//# sourceMappingURL=date-range-B7VG8UXD.js.map
|