@forgeroute/ui 0.5.27 → 0.5.29
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/fesm2022/forgeroute-ui-calendar.mjs +103 -4
- package/fesm2022/forgeroute-ui-calendar.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-card-list-item.mjs +191 -43
- package/fesm2022/forgeroute-ui-card-list-item.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-contact-picker.mjs +2 -2
- package/fesm2022/forgeroute-ui-contact-picker.mjs.map +1 -1
- package/fesm2022/{forgeroute-ui-core-ui-labels.es-Dzvm992V.mjs → forgeroute-ui-core-ui-labels.es-BViJSCO-.mjs} +4 -1
- package/fesm2022/{forgeroute-ui-core-ui-labels.es-Dzvm992V.mjs.map → forgeroute-ui-core-ui-labels.es-BViJSCO-.mjs.map} +1 -1
- package/fesm2022/forgeroute-ui-core.mjs +4 -1
- package/fesm2022/forgeroute-ui-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-data-table-core.mjs +59 -28
- package/fesm2022/forgeroute-ui-data-table-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-kpi-card.mjs +2 -2
- package/fesm2022/forgeroute-ui-kpi-card.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-notes.mjs +20 -22
- package/fesm2022/forgeroute-ui-notes.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-panel-info-list.mjs +26 -4
- package/fesm2022/forgeroute-ui-panel-info-list.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-payments.mjs +2 -1
- package/fesm2022/forgeroute-ui-payments.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-setup.mjs +2 -1
- package/fesm2022/forgeroute-ui-setup.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stripe.mjs +78 -6
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-table-types.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forgeroute-ui-calendar.d.ts +28 -1
- package/types/forgeroute-ui-card-list-item.d.ts +37 -11
- package/types/forgeroute-ui-core.d.ts +3 -0
- package/types/forgeroute-ui-data-table-core.d.ts +10 -1
- package/types/forgeroute-ui-messaging.d.ts +1 -1
- package/types/forgeroute-ui-panel-info-list.d.ts +11 -0
- package/types/forgeroute-ui-quickbooks.d.ts +1 -1
- package/types/forgeroute-ui-square.d.ts +3 -3
- package/types/forgeroute-ui-stripe.d.ts +31 -1
- package/types/forgeroute-ui-table-types.d.ts +5 -0
|
@@ -36,6 +36,54 @@ function isValidDateStr(dateStr) {
|
|
|
36
36
|
const d = fromDateStr(dateStr);
|
|
37
37
|
return !isNaN(d.getTime()) && toDateStr(d) === dateStr;
|
|
38
38
|
}
|
|
39
|
+
function isValidTimeZone(zone) {
|
|
40
|
+
if (typeof zone !== "string" || !zone.trim()) return false;
|
|
41
|
+
try {
|
|
42
|
+
new Intl.DateTimeFormat("en-US", { timeZone: zone.trim() });
|
|
43
|
+
return true;
|
|
44
|
+
} catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function zoneParts(zone, now) {
|
|
49
|
+
if (!isValidTimeZone(zone)) return null;
|
|
50
|
+
try {
|
|
51
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
52
|
+
timeZone: zone.trim(),
|
|
53
|
+
hourCycle: "h23",
|
|
54
|
+
year: "numeric",
|
|
55
|
+
month: "2-digit",
|
|
56
|
+
day: "2-digit",
|
|
57
|
+
hour: "2-digit",
|
|
58
|
+
minute: "2-digit",
|
|
59
|
+
second: "2-digit"
|
|
60
|
+
}).formatToParts(now);
|
|
61
|
+
const get = (type) => Number(parts.find((p) => p.type === type)?.value);
|
|
62
|
+
const out = {
|
|
63
|
+
y: get("year"),
|
|
64
|
+
mo: get("month"),
|
|
65
|
+
d: get("day"),
|
|
66
|
+
h: get("hour") % 24,
|
|
67
|
+
mi: get("minute"),
|
|
68
|
+
s: get("second")
|
|
69
|
+
};
|
|
70
|
+
return Object.values(out).every(Number.isFinite) ? out : null;
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function zoneDateStr(zone, now = /* @__PURE__ */ new Date()) {
|
|
76
|
+
const p = typeof zone === "string" ? zoneParts(zone, now) : null;
|
|
77
|
+
if (!p) return null;
|
|
78
|
+
const ds = `${String(p.y).padStart(4, "0")}-${String(p.mo).padStart(2, "0")}-${String(p.d).padStart(2, "0")}`;
|
|
79
|
+
return isValidDateStr(ds) ? ds : null;
|
|
80
|
+
}
|
|
81
|
+
function msUntilZoneMidnight(zone, now = /* @__PURE__ */ new Date()) {
|
|
82
|
+
const p = typeof zone === "string" ? zoneParts(zone, now) : null;
|
|
83
|
+
if (!p) return null;
|
|
84
|
+
const ms = ((24 - p.h) * 3600 - p.mi * 60 - p.s) * 1e3 + 1e3;
|
|
85
|
+
return Math.max(1e3, Math.min(ms, 36e5));
|
|
86
|
+
}
|
|
39
87
|
function buildMonthCells(anchor, todayStr) {
|
|
40
88
|
const y = anchor.getFullYear();
|
|
41
89
|
const m = anchor.getMonth();
|
|
@@ -246,13 +294,14 @@ var CalendarComponent = class CalendarComponent {
|
|
|
246
294
|
...ngDevMode ? { debugName: "loadingActions" } : /* istanbul ignore next */ {},
|
|
247
295
|
transform: numberAttribute
|
|
248
296
|
});
|
|
297
|
+
this.defaultAnchor = /* @__PURE__ */ new Date();
|
|
249
298
|
this.view = model("month", ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
|
|
250
299
|
this.views = input([
|
|
251
300
|
"week",
|
|
252
301
|
"month",
|
|
253
302
|
"agenda"
|
|
254
303
|
], ...ngDevMode ? [{ debugName: "views" }] : /* istanbul ignore next */ []);
|
|
255
|
-
this.anchorDate = model(
|
|
304
|
+
this.anchorDate = model(this.defaultAnchor, ...ngDevMode ? [{ debugName: "anchorDate" }] : /* istanbul ignore next */ []);
|
|
256
305
|
this.filters = input([], ...ngDevMode ? [{ debugName: "filters" }] : /* istanbul ignore next */ []);
|
|
257
306
|
this.filterLabel = input("", ...ngDevMode ? [{ debugName: "filterLabel" }] : /* istanbul ignore next */ []);
|
|
258
307
|
this.filterMode = input("multi", ...ngDevMode ? [{ debugName: "filterMode" }] : /* istanbul ignore next */ []);
|
|
@@ -261,6 +310,7 @@ var CalendarComponent = class CalendarComponent {
|
|
|
261
310
|
this.canCreate = input(false, ...ngDevMode ? [{ debugName: "canCreate" }] : /* istanbul ignore next */ []);
|
|
262
311
|
this.disablePast = input(false, ...ngDevMode ? [{ debugName: "disablePast" }] : /* istanbul ignore next */ []);
|
|
263
312
|
this.today = input(null, ...ngDevMode ? [{ debugName: "today" }] : /* istanbul ignore next */ []);
|
|
313
|
+
this.timeZone = input("", ...ngDevMode ? [{ debugName: "timeZone" }] : /* istanbul ignore next */ []);
|
|
264
314
|
this.maxVisible = input(3, ...ngDevMode ? [{ debugName: "maxVisible" }] : /* istanbul ignore next */ []);
|
|
265
315
|
this.chipLayout = input("inline", ...ngDevMode ? [{ debugName: "chipLayout" }] : /* istanbul ignore next */ []);
|
|
266
316
|
this.sortByTime = input(true, ...ngDevMode ? [{ debugName: "sortByTime" }] : /* istanbul ignore next */ []);
|
|
@@ -305,9 +355,21 @@ var CalendarComponent = class CalendarComponent {
|
|
|
305
355
|
return Array.from({ length: Number.isFinite(n) ? Math.max(0, Math.min(6, Math.floor(n))) : 0 }, (_, i) => i);
|
|
306
356
|
}, ...ngDevMode ? [{ debugName: "loadingActionSlots" }] : /* istanbul ignore next */ []);
|
|
307
357
|
this.clockToday = signal(toDateStr(/* @__PURE__ */ new Date()), ...ngDevMode ? [{ debugName: "clockToday" }] : /* istanbul ignore next */ []);
|
|
358
|
+
this.clockTick = signal(0, ...ngDevMode ? [{ debugName: "clockTick" }] : /* istanbul ignore next */ []);
|
|
359
|
+
this.effectiveZone = computed(() => {
|
|
360
|
+
const z = this.timeZone();
|
|
361
|
+
return isValidTimeZone(z) ? z.trim() : "";
|
|
362
|
+
}, ...ngDevMode ? [{ debugName: "effectiveZone" }] : /* istanbul ignore next */ []);
|
|
308
363
|
this.todayStr = computed(() => {
|
|
309
364
|
const t = this.today();
|
|
310
|
-
|
|
365
|
+
if (t && isValidDateStr(t)) return t;
|
|
366
|
+
const zone = this.effectiveZone();
|
|
367
|
+
if (zone) {
|
|
368
|
+
this.clockTick();
|
|
369
|
+
const z = zoneDateStr(zone);
|
|
370
|
+
if (z) return z;
|
|
371
|
+
}
|
|
372
|
+
return this.clockToday();
|
|
311
373
|
}, ...ngDevMode ? [{ debugName: "todayStr" }] : /* istanbul ignore next */ []);
|
|
312
374
|
this.focusedDate = signal(null, ...ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []);
|
|
313
375
|
this.lastRangeKey = "";
|
|
@@ -468,6 +530,13 @@ var CalendarComponent = class CalendarComponent {
|
|
|
468
530
|
this.pendingSawLoading = false;
|
|
469
531
|
afterNextRender(() => this.host.nativeElement.querySelector(`.month-cell[data-date="${target}"]`)?.focus(), { injector: this.injector });
|
|
470
532
|
});
|
|
533
|
+
effect(() => {
|
|
534
|
+
if (!this.effectiveZone()) return;
|
|
535
|
+
const t = this.todayStr();
|
|
536
|
+
untracked(() => {
|
|
537
|
+
if (this.anchorDate() === this.defaultAnchor) this.anchorDate.set(fromDateStr(t));
|
|
538
|
+
});
|
|
539
|
+
});
|
|
471
540
|
effect(() => {
|
|
472
541
|
const view = this.view();
|
|
473
542
|
const views = this.views();
|
|
@@ -485,14 +554,18 @@ var CalendarComponent = class CalendarComponent {
|
|
|
485
554
|
const zone = inject(NgZone);
|
|
486
555
|
const doc = inject(DOCUMENT);
|
|
487
556
|
let timer;
|
|
488
|
-
const refreshToday = () => zone.run(() =>
|
|
557
|
+
const refreshToday = () => zone.run(() => {
|
|
558
|
+
this.clockToday.set(toDateStr(/* @__PURE__ */ new Date()));
|
|
559
|
+
this.clockTick.update((n) => n + 1);
|
|
560
|
+
});
|
|
489
561
|
const schedule = () => {
|
|
490
562
|
const now = /* @__PURE__ */ new Date();
|
|
563
|
+
const inZone = msUntilZoneMidnight(this.effectiveZone(), now);
|
|
491
564
|
const next = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 1);
|
|
492
565
|
timer = setTimeout(() => {
|
|
493
566
|
refreshToday();
|
|
494
567
|
schedule();
|
|
495
|
-
}, next.getTime() - now.getTime());
|
|
568
|
+
}, inZone ?? next.getTime() - now.getTime());
|
|
496
569
|
};
|
|
497
570
|
const onVisible = () => {
|
|
498
571
|
if (doc.visibilityState === "visible") refreshToday();
|
|
@@ -506,6 +579,16 @@ var CalendarComponent = class CalendarComponent {
|
|
|
506
579
|
clearTimeout(timer);
|
|
507
580
|
doc.removeEventListener("visibilitychange", onVisible);
|
|
508
581
|
});
|
|
582
|
+
let scheduledZone = "";
|
|
583
|
+
effect(() => {
|
|
584
|
+
const z = this.effectiveZone();
|
|
585
|
+
if (z === scheduledZone) return;
|
|
586
|
+
scheduledZone = z;
|
|
587
|
+
untracked(() => zone.runOutsideAngular(() => {
|
|
588
|
+
clearTimeout(timer);
|
|
589
|
+
schedule();
|
|
590
|
+
}));
|
|
591
|
+
});
|
|
509
592
|
}
|
|
510
593
|
isFilterActive(value) {
|
|
511
594
|
return this.activeFilters().includes(value);
|
|
@@ -531,6 +614,7 @@ var CalendarComponent = class CalendarComponent {
|
|
|
531
614
|
goToday() {
|
|
532
615
|
this.focusedDate.set(null);
|
|
533
616
|
this.clockToday.set(toDateStr(/* @__PURE__ */ new Date()));
|
|
617
|
+
this.clockTick.update((n) => n + 1);
|
|
534
618
|
this.anchorDate.set(fromDateStr(this.todayStr()));
|
|
535
619
|
}
|
|
536
620
|
dowLabel(dateStr) {
|
|
@@ -794,6 +878,13 @@ var CalendarComponent = class CalendarComponent {
|
|
|
794
878
|
isRequired: false,
|
|
795
879
|
transformFunction: null
|
|
796
880
|
},
|
|
881
|
+
timeZone: {
|
|
882
|
+
classPropertyName: "timeZone",
|
|
883
|
+
publicName: "timeZone",
|
|
884
|
+
isSignal: true,
|
|
885
|
+
isRequired: false,
|
|
886
|
+
transformFunction: null
|
|
887
|
+
},
|
|
797
888
|
maxVisible: {
|
|
798
889
|
classPropertyName: "maxVisible",
|
|
799
890
|
publicName: "maxVisible",
|
|
@@ -1895,6 +1986,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1895
1986
|
required: false
|
|
1896
1987
|
}]
|
|
1897
1988
|
}],
|
|
1989
|
+
timeZone: [{
|
|
1990
|
+
type: i0.Input,
|
|
1991
|
+
args: [{
|
|
1992
|
+
isSignal: true,
|
|
1993
|
+
alias: "timeZone",
|
|
1994
|
+
required: false
|
|
1995
|
+
}]
|
|
1996
|
+
}],
|
|
1898
1997
|
maxVisible: [{
|
|
1899
1998
|
type: i0.Input,
|
|
1900
1999
|
args: [{
|