mn-angular-lib 2.0.46 → 2.0.48
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.
|
@@ -721,17 +721,35 @@ var UpcomingEventRowComponent = class UpcomingEventRowComponent {
|
|
|
721
721
|
formattedDate = "";
|
|
722
722
|
formatter;
|
|
723
723
|
cdr = inject(ChangeDetectorRef);
|
|
724
|
+
lang = inject(MnLanguageService);
|
|
725
|
+
destroyRef = inject(DestroyRef);
|
|
726
|
+
formatGeneration = 0;
|
|
724
727
|
constructor() {
|
|
725
728
|
const formatter = inject(CALENDAR_DATE_FORMATTER, { optional: true });
|
|
726
729
|
this.formatter = formatter ?? new DefaultCalendarDateFormatter();
|
|
727
730
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
731
|
+
ngOnInit() {
|
|
732
|
+
const sub = this.lang.locale$.pipe(skip(1)).subscribe(() => {
|
|
733
|
+
this.refreshFormattedDate();
|
|
734
|
+
});
|
|
735
|
+
this.destroyRef.onDestroy(() => sub.unsubscribe());
|
|
736
|
+
this.refreshFormattedDate();
|
|
737
|
+
}
|
|
738
|
+
ngOnChanges(changes) {
|
|
739
|
+
if (changes["event"] && !changes["event"].firstChange) this.refreshFormattedDate();
|
|
740
|
+
}
|
|
741
|
+
async refreshFormattedDate() {
|
|
742
|
+
const generation = ++this.formatGeneration;
|
|
743
|
+
if (!this.event) {
|
|
744
|
+
this.formattedDate = "";
|
|
733
745
|
this.cdr.markForCheck();
|
|
746
|
+
return;
|
|
734
747
|
}
|
|
748
|
+
const start = await this.formatter.formatTime(this.event.startTime);
|
|
749
|
+
const end = await this.formatter.formatTime(this.event.endTime);
|
|
750
|
+
if (generation !== this.formatGeneration) return;
|
|
751
|
+
this.formattedDate = `${start} - ${end}`;
|
|
752
|
+
this.cdr.markForCheck();
|
|
735
753
|
}
|
|
736
754
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
737
755
|
minVersion: "12.0.0",
|
|
@@ -749,6 +767,7 @@ var UpcomingEventRowComponent = class UpcomingEventRowComponent {
|
|
|
749
767
|
selector: "mn-upcoming-event-row",
|
|
750
768
|
inputs: { event: "event" },
|
|
751
769
|
outputs: { eventClicked: "eventClicked" },
|
|
770
|
+
usesOnChanges: true,
|
|
752
771
|
ngImport: i0,
|
|
753
772
|
template: "<!-- Sidebar row in the shared chip language: a colored rail from the event's own\n colour, a hover wash, and space-grouped content — no boxed borders. -->\n<div (click)=\"eventClicked.emit(event)\"\n (keyup.enter)=\"eventClicked.emit(event)\"\n class=\"grid grid-cols-[3px_1fr] items-stretch gap-2.5 mb-1.5 cursor-pointer rounded-lg p-2 transition-colors hover:bg-base-200 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary motion-reduce:transition-none\"\n tabindex=\"0\">\n <div class=\"rounded-full\" [style.background-color]=\"event.color.primaryColor\"></div>\n <div class=\"min-w-0\">\n <div class=\"line-clamp-2 break-words text-[13px] font-semibold\">{{ event.title }}</div>\n <div class=\"text-xs tabular-nums opacity-60\">{{ formattedDate }}</div>\n @if (event.description) {\n <div class=\"line-clamp-2 break-words text-xs opacity-50\">{{ event.description }}</div>\n }\n </div>\n</div>\n",
|
|
754
773
|
dependencies: [{
|