mn-angular-lib 1.0.180 → 2.0.1
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/mn-angular-lib-alert.mjs +11 -10
- package/fesm2022/mn-angular-lib-alert.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs +15 -14
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-button.mjs +9 -9
- package/fesm2022/mn-angular-lib-button.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar-core.mjs +6 -6
- package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar.mjs +118 -81
- package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-collection.mjs +36 -28
- package/fesm2022/mn-angular-lib-collection.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-core.mjs +17 -16
- package/fesm2022/mn-angular-lib-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-display.mjs +45 -37
- package/fesm2022/mn-angular-lib-display.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-forms.mjs +243 -99
- package/fesm2022/mn-angular-lib-forms.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-keyboard.mjs +3 -3
- package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-ui.mjs +158 -100
- package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal.mjs +3 -3
- package/fesm2022/mn-angular-lib-modal.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs +21 -12
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-segmented.mjs +3 -3
- package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-tab.mjs +14 -6
- package/fesm2022/mn-angular-lib-tab.mjs.map +1 -1
- package/package.json +4 -4
- package/types/mn-angular-lib-alert.d.ts +2 -2
- package/types/mn-angular-lib-calendar-core.d.ts +2 -2
- package/types/mn-angular-lib-calendar.d.ts +2 -0
- package/types/mn-angular-lib-core.d.ts +2 -2
- package/types/mn-angular-lib-display.d.ts +5 -0
- package/types/mn-angular-lib-forms.d.ts +10 -0
- package/types/mn-angular-lib-modal.d.ts +1 -1
- package/types/mn-angular-lib-tab.d.ts +7 -0
|
@@ -52,7 +52,9 @@ class CalendarMonthComponent {
|
|
|
52
52
|
this.weekdayLabels = DEFAULT_CALENDAR_CONFIG.shortDayNames;
|
|
53
53
|
}
|
|
54
54
|
ngOnInit() {
|
|
55
|
-
const resolved = this.config
|
|
55
|
+
const resolved = this.config
|
|
56
|
+
? resolveCalendarConfig(this.config)
|
|
57
|
+
: { ...DEFAULT_CALENDAR_CONFIG };
|
|
56
58
|
this.weekdayLabels = resolved.shortDayNames;
|
|
57
59
|
this.moreEventsLabel = resolved.moreEventsLabel;
|
|
58
60
|
this.buildMonth();
|
|
@@ -61,14 +63,14 @@ class CalendarMonthComponent {
|
|
|
61
63
|
// whose events arrive from a stream — a fetch, a parent seeding its list — stays blank until
|
|
62
64
|
// some unrelated interaction happens to trigger change detection.
|
|
63
65
|
if (this.eventsChanged) {
|
|
64
|
-
this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe(events => {
|
|
66
|
+
this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe((events) => {
|
|
65
67
|
this.events = events;
|
|
66
68
|
this.buildMonth();
|
|
67
69
|
this.cdr.markForCheck();
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
72
|
if (this.focusDayChanged) {
|
|
71
|
-
this.focusDayChanged.pipe(takeUntil(this.destroy$)).subscribe(date => {
|
|
73
|
+
this.focusDayChanged.pipe(takeUntil(this.destroy$)).subscribe((date) => {
|
|
72
74
|
this.focusDay = date;
|
|
73
75
|
this.buildMonth();
|
|
74
76
|
this.cdr.markForCheck();
|
|
@@ -124,7 +126,7 @@ class CalendarMonthComponent {
|
|
|
124
126
|
}
|
|
125
127
|
createMonthItem(date, isCurrentMonth, today) {
|
|
126
128
|
const isToday = this.formatter.isSameDay(date, today);
|
|
127
|
-
const dayEvents = this.events.filter(e => this.formatter.isSameDay(e.startTime, date) ||
|
|
129
|
+
const dayEvents = this.events.filter((e) => this.formatter.isSameDay(e.startTime, date) ||
|
|
128
130
|
this.formatter.isSameDay(e.endTime, date) ||
|
|
129
131
|
(e.startTime < date && e.endTime > date));
|
|
130
132
|
return {
|
|
@@ -132,13 +134,13 @@ class CalendarMonthComponent {
|
|
|
132
134
|
dayNumber: date.getDate(),
|
|
133
135
|
isCurrentMonth,
|
|
134
136
|
isToday,
|
|
135
|
-
events: dayEvents
|
|
137
|
+
events: dayEvents,
|
|
136
138
|
};
|
|
137
139
|
}
|
|
138
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
139
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
140
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarMonthComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
141
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: CalendarMonthComponent, isStandalone: true, selector: "mn-calendar-month", inputs: { focusDay: "focusDay", eventsChanged: "eventsChanged", focusDayChanged: "focusDayChanged", config: "config" }, outputs: { dayClicked: "dayClicked" }, ngImport: i0, template: "<!-- Month grid. Cells are grouped by space rather than boxed by borders, in\n keeping with the date-selector-bar: no rules, soft rounded cells, a hover\n wash, and today marked by a tinted number alone (no circle). -->\n<!-- Rows are a compact fixed height rather than stretched to fill the container:\n a month with few events shouldn't leave each cell mostly empty. The panel\n scrolls if the grid is taller than the space it's given. -->\n<div [attr.aria-label]=\"monthViewLabel\" class=\"w-full flex flex-col\" role=\"grid\">\n <div class=\"grid grid-cols-7 pb-2\">\n @for (day of weekdayLabels; track day) {\n <div class=\"pl-2 text-left text-[11px] font-semibold uppercase tracking-wide opacity-45\" role=\"columnheader\">{{ day }}</div>\n }\n </div>\n <div class=\"grid grid-cols-7 gap-1 auto-rows-[minmax(92px,auto)]\">\n @for (item of monthItems; track item.date.getTime()) {\n <div\n class=\"flex flex-col gap-1 min-h-0 overflow-hidden rounded-xl p-1.5 cursor-pointer transition-colors hover:bg-base-200 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary motion-reduce:transition-none\"\n [class.opacity-40]=\"!item.isCurrentMonth\"\n (keyup.enter)=\"onDayClick(item.date)\"\n (click)=\"onDayClick(item.date)\"\n tabindex=\"0\"\n role=\"gridcell\"\n [attr.aria-label]=\"item.date.toDateString()\">\n <span class=\"text-[13px] font-bold leading-none tabular-nums\" [class.text-primary]=\"item.isToday\">{{ item.dayNumber }}</span>\n <div class=\"flex flex-col gap-0.5 min-h-0\">\n @for (event of item.events.slice(0, 3); track $index) {\n <div\n class=\"flex items-center overflow-hidden rounded-md border-l-[3px] px-1.5 py-0.5 text-[11px] leading-tight\"\n [style.background-color]=\"event.color.secondaryColor\"\n [style.border-left-color]=\"event.color.primaryColor\"\n [style.color]=\"event.color.primaryColor\"\n [title]=\"event.title\">\n <span class=\"truncate font-semibold\">{{ event.title }}</span>\n </div>\n }\n <!-- Overflow indicator. Styled as a pill that lights up on hover so it\n reads as actionable; the whole cell already navigates to the Day\n view for this date on click / Enter, where every event is listed. -->\n @if (item.events.length > 3) {\n <span class=\"mt-0.5 inline-flex w-fit items-center rounded-md px-1.5 py-0.5 text-[10.5px] font-semibold opacity-60 transition-colors hover:bg-base-300 hover:opacity-100 motion-reduce:transition-none\">\n +{{ item.events.length - 3 }} {{ moreEventsLabel }}\n </span>\n }\n </div>\n </div>\n }\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
140
142
|
}
|
|
141
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarMonthComponent, decorators: [{
|
|
142
144
|
type: Component,
|
|
143
145
|
args: [{ selector: 'mn-calendar-month', standalone: true, imports: [CommonModule], template: "<!-- Month grid. Cells are grouped by space rather than boxed by borders, in\n keeping with the date-selector-bar: no rules, soft rounded cells, a hover\n wash, and today marked by a tinted number alone (no circle). -->\n<!-- Rows are a compact fixed height rather than stretched to fill the container:\n a month with few events shouldn't leave each cell mostly empty. The panel\n scrolls if the grid is taller than the space it's given. -->\n<div [attr.aria-label]=\"monthViewLabel\" class=\"w-full flex flex-col\" role=\"grid\">\n <div class=\"grid grid-cols-7 pb-2\">\n @for (day of weekdayLabels; track day) {\n <div class=\"pl-2 text-left text-[11px] font-semibold uppercase tracking-wide opacity-45\" role=\"columnheader\">{{ day }}</div>\n }\n </div>\n <div class=\"grid grid-cols-7 gap-1 auto-rows-[minmax(92px,auto)]\">\n @for (item of monthItems; track item.date.getTime()) {\n <div\n class=\"flex flex-col gap-1 min-h-0 overflow-hidden rounded-xl p-1.5 cursor-pointer transition-colors hover:bg-base-200 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary motion-reduce:transition-none\"\n [class.opacity-40]=\"!item.isCurrentMonth\"\n (keyup.enter)=\"onDayClick(item.date)\"\n (click)=\"onDayClick(item.date)\"\n tabindex=\"0\"\n role=\"gridcell\"\n [attr.aria-label]=\"item.date.toDateString()\">\n <span class=\"text-[13px] font-bold leading-none tabular-nums\" [class.text-primary]=\"item.isToday\">{{ item.dayNumber }}</span>\n <div class=\"flex flex-col gap-0.5 min-h-0\">\n @for (event of item.events.slice(0, 3); track $index) {\n <div\n class=\"flex items-center overflow-hidden rounded-md border-l-[3px] px-1.5 py-0.5 text-[11px] leading-tight\"\n [style.background-color]=\"event.color.secondaryColor\"\n [style.border-left-color]=\"event.color.primaryColor\"\n [style.color]=\"event.color.primaryColor\"\n [title]=\"event.title\">\n <span class=\"truncate font-semibold\">{{ event.title }}</span>\n </div>\n }\n <!-- Overflow indicator. Styled as a pill that lights up on hover so it\n reads as actionable; the whole cell already navigates to the Day\n view for this date on click / Enter, where every event is listed. -->\n @if (item.events.length > 3) {\n <span class=\"mt-0.5 inline-flex w-fit items-center rounded-md px-1.5 py-0.5 text-[10.5px] font-semibold opacity-60 transition-colors hover:bg-base-300 hover:opacity-100 motion-reduce:transition-none\">\n +{{ item.events.length - 3 }} {{ moreEventsLabel }}\n </span>\n }\n </div>\n </div>\n }\n </div>\n</div>\n" }]
|
|
144
146
|
}], ctorParameters: () => [], propDecorators: { focusDay: [{
|
|
@@ -166,7 +168,9 @@ class CalendarEventDefaultComponent {
|
|
|
166
168
|
formattedTime = '';
|
|
167
169
|
formatter;
|
|
168
170
|
constructor() {
|
|
169
|
-
const formatter = inject(CALENDAR_DATE_FORMATTER, {
|
|
171
|
+
const formatter = inject(CALENDAR_DATE_FORMATTER, {
|
|
172
|
+
optional: true,
|
|
173
|
+
});
|
|
170
174
|
this.formatter = formatter ?? new DefaultCalendarDateFormatter();
|
|
171
175
|
}
|
|
172
176
|
async ngOnInit() {
|
|
@@ -177,10 +181,10 @@ class CalendarEventDefaultComponent {
|
|
|
177
181
|
this.cdr.markForCheck();
|
|
178
182
|
}
|
|
179
183
|
}
|
|
180
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
181
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
184
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarEventDefaultComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
185
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: CalendarEventDefaultComponent, isStandalone: true, selector: "mn-calendar-event-default", ngImport: i0, template: "<!-- The shared event chip: a colored spine and a tinted fill from the event's own\n colours, so it reads the same in week, day and month. Text inherits the\n event's primary colour, keeping it legible on either theme. -->\n<div class=\"h-full overflow-hidden cursor-pointer rounded-lg border-l-[3px] px-2 py-1 text-xs\"\n [style.background-color]=\"event.color.secondaryColor\"\n [style.border-left-color]=\"event.color.primaryColor\"\n [style.color]=\"event.color.primaryColor\">\n <div class=\"truncate font-semibold\">{{ event.title }}</div>\n <div class=\"truncate text-[11px] opacity-85\">{{ formattedTime }}</div>\n @if (event.description) {\n <div class=\"truncate text-[11px] opacity-75\">{{ event.description }}</div>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
182
186
|
}
|
|
183
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
187
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarEventDefaultComponent, decorators: [{
|
|
184
188
|
type: Component,
|
|
185
189
|
args: [{ selector: 'mn-calendar-event-default', standalone: true, imports: [CommonModule], template: "<!-- The shared event chip: a colored spine and a tinted fill from the event's own\n colours, so it reads the same in week, day and month. Text inherits the\n event's primary colour, keeping it legible on either theme. -->\n<div class=\"h-full overflow-hidden cursor-pointer rounded-lg border-l-[3px] px-2 py-1 text-xs\"\n [style.background-color]=\"event.color.secondaryColor\"\n [style.border-left-color]=\"event.color.primaryColor\"\n [style.color]=\"event.color.primaryColor\">\n <div class=\"truncate font-semibold\">{{ event.title }}</div>\n <div class=\"truncate text-[11px] opacity-85\">{{ formattedTime }}</div>\n @if (event.description) {\n <div class=\"truncate text-[11px] opacity-75\">{{ event.description }}</div>\n }\n</div>\n" }]
|
|
186
190
|
}], ctorParameters: () => [] });
|
|
@@ -226,10 +230,10 @@ class CalendarEventComponent {
|
|
|
226
230
|
ref.changeDetectorRef.detectChanges();
|
|
227
231
|
this.rendered = true;
|
|
228
232
|
}
|
|
229
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
230
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
233
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarEventComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
234
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: CalendarEventComponent, isStandalone: true, selector: "mn-calendar-event", inputs: { event: "event", customComponent: "customComponent" }, outputs: { eventClicked: "eventClicked" }, viewQueries: [{ propertyName: "eventContainer", first: true, predicate: ["eventContainer"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<!-- Host for the dynamically-rendered event component. Click/keyboard handling and\n the focus ring live on the week/day event wrapper, so this stays presentational\n to avoid a second, redundant tab stop per event. -->\n<div class=\"h-full w-full\">\n <ng-template #eventContainer></ng-template>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
231
235
|
}
|
|
232
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarEventComponent, decorators: [{
|
|
233
237
|
type: Component,
|
|
234
238
|
args: [{ selector: 'mn-calendar-event', standalone: true, imports: [CommonModule], template: "<!-- Host for the dynamically-rendered event component. Click/keyboard handling and\n the focus ring live on the week/day event wrapper, so this stays presentational\n to avoid a second, redundant tab stop per event. -->\n<div class=\"h-full w-full\">\n <ng-template #eventContainer></ng-template>\n</div>\n" }]
|
|
235
239
|
}], propDecorators: { event: [{
|
|
@@ -292,19 +296,21 @@ class CalendarWeekComponent {
|
|
|
292
296
|
this.formatter = new DefaultCalendarDateFormatter();
|
|
293
297
|
}
|
|
294
298
|
ngOnInit() {
|
|
295
|
-
this.resolvedConfig = this.config
|
|
299
|
+
this.resolvedConfig = this.config
|
|
300
|
+
? resolveCalendarConfig(this.config)
|
|
301
|
+
: { ...DEFAULT_CALENDAR_CONFIG };
|
|
296
302
|
this.buildColumns();
|
|
297
303
|
this.updateCurrentTime();
|
|
298
304
|
this.currentTimeInterval = setInterval(() => this.updateCurrentTime(), 60000);
|
|
299
305
|
if (this.eventsChanged) {
|
|
300
|
-
this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe(events => {
|
|
306
|
+
this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe((events) => {
|
|
301
307
|
this.events = events;
|
|
302
308
|
this.refreshEvents();
|
|
303
309
|
this.cdr.markForCheck();
|
|
304
310
|
});
|
|
305
311
|
}
|
|
306
312
|
if (this.focusDayChanged) {
|
|
307
|
-
this.focusDayChanged.pipe(takeUntil(this.destroy$)).subscribe(date => {
|
|
313
|
+
this.focusDayChanged.pipe(takeUntil(this.destroy$)).subscribe((date) => {
|
|
308
314
|
this.focusDay = date;
|
|
309
315
|
this.buildColumns();
|
|
310
316
|
this.refreshEvents();
|
|
@@ -336,7 +342,7 @@ class CalendarWeekComponent {
|
|
|
336
342
|
}
|
|
337
343
|
/** Returns the CSS `grid-column` value for an event within its day's sub-columns. */
|
|
338
344
|
getEventColumn(event) {
|
|
339
|
-
const dayIdx = this.columns.findIndex(c => this.formatter.isSameDay(c.date, event.startTime));
|
|
345
|
+
const dayIdx = this.columns.findIndex((c) => this.formatter.isSameDay(c.date, event.startTime));
|
|
340
346
|
if (dayIdx < 0)
|
|
341
347
|
return '1 / span 1';
|
|
342
348
|
const dayInfo = this.dayColumnMap[dayIdx];
|
|
@@ -371,7 +377,7 @@ class CalendarWeekComponent {
|
|
|
371
377
|
hour,
|
|
372
378
|
topRow: i * 2 + 1,
|
|
373
379
|
bottomRow: i * 2 + 3,
|
|
374
|
-
hourLabel: label
|
|
380
|
+
hourLabel: label,
|
|
375
381
|
});
|
|
376
382
|
}
|
|
377
383
|
this.hourRows = rows;
|
|
@@ -394,7 +400,7 @@ class CalendarWeekComponent {
|
|
|
394
400
|
date,
|
|
395
401
|
dayName: shortNames[i],
|
|
396
402
|
dayNumber: date.getDate(),
|
|
397
|
-
isToday: this.formatter.isSameDay(date, today)
|
|
403
|
+
isToday: this.formatter.isSameDay(date, today),
|
|
398
404
|
});
|
|
399
405
|
}
|
|
400
406
|
}
|
|
@@ -405,7 +411,7 @@ class CalendarWeekComponent {
|
|
|
405
411
|
const rangeStart = this.columns[0].date;
|
|
406
412
|
const rangeEnd = new Date(this.columns[6].date);
|
|
407
413
|
rangeEnd.setHours(23, 59, 59, 999);
|
|
408
|
-
const filtered = this.events.filter(e => this.layoutService.eventsOverlap(e.startTime, e.endTime, rangeStart, rangeEnd));
|
|
414
|
+
const filtered = this.events.filter((e) => this.layoutService.eventsOverlap(e.startTime, e.endTime, rangeStart, rangeEnd));
|
|
409
415
|
this.displayEvents = this.layoutService.calculateMultiDayEvents(filtered, this.resolvedConfig.startHour, this.resolvedConfig.endHour, rangeStart, rangeEnd);
|
|
410
416
|
// Assign columns per day so overlapping events within a day get sub-columns
|
|
411
417
|
for (let i = 0; i < 7; i++) {
|
|
@@ -413,7 +419,7 @@ class CalendarWeekComponent {
|
|
|
413
419
|
dayStart.setHours(0, 0, 0, 0);
|
|
414
420
|
const dayEnd = new Date(this.columns[i].date);
|
|
415
421
|
dayEnd.setHours(23, 59, 59, 999);
|
|
416
|
-
const dayEvents = this.displayEvents.filter(e => this.formatter.isSameDay(e.startTime, this.columns[i].date));
|
|
422
|
+
const dayEvents = this.displayEvents.filter((e) => this.formatter.isSameDay(e.startTime, this.columns[i].date));
|
|
417
423
|
this.layoutService.assignColumnsToEvents(dayEvents);
|
|
418
424
|
this.layoutService.assignWidthsToEvents(dayEvents, dayStart, dayEnd);
|
|
419
425
|
}
|
|
@@ -425,7 +431,7 @@ class CalendarWeekComponent {
|
|
|
425
431
|
this.dayColumnMap = [];
|
|
426
432
|
let currentCol = 1;
|
|
427
433
|
for (let i = 0; i < 7; i++) {
|
|
428
|
-
const dayEvents = this.displayEvents.filter(e => this.formatter.isSameDay(e.startTime, this.columns[i].date));
|
|
434
|
+
const dayEvents = this.displayEvents.filter((e) => this.formatter.isSameDay(e.startTime, this.columns[i].date));
|
|
429
435
|
let maxSubCols = 1;
|
|
430
436
|
for (const e of dayEvents) {
|
|
431
437
|
maxSubCols = Math.max(maxSubCols, (e.column ?? 0) + (e.width ?? 1));
|
|
@@ -444,13 +450,13 @@ class CalendarWeekComponent {
|
|
|
444
450
|
/** Updates the current-time red line position. */
|
|
445
451
|
updateCurrentTime() {
|
|
446
452
|
const now = new Date();
|
|
447
|
-
const dayIdx = this.columns.findIndex(c => this.formatter.isSameDay(c.date, now));
|
|
453
|
+
const dayIdx = this.columns.findIndex((c) => this.formatter.isSameDay(c.date, now));
|
|
448
454
|
if (dayIdx >= 0 && this.dayColumnMap.length > 0) {
|
|
449
455
|
const dayInfo = this.dayColumnMap[dayIdx];
|
|
450
456
|
this.currentTimeCol = `${dayInfo.startCol} / span ${dayInfo.subColumns}`;
|
|
451
457
|
this.currentTimeRow = CalendarUtility.getCorrectRow(now.getHours(), now.getMinutes(), this.resolvedConfig.startHour);
|
|
452
458
|
// formatTime is async; refresh the label and re-render when it resolves.
|
|
453
|
-
this.formatter.formatTime(now).then(label => {
|
|
459
|
+
this.formatter.formatTime(now).then((label) => {
|
|
454
460
|
this.currentTimeLabel = label;
|
|
455
461
|
this.cdr.markForCheck();
|
|
456
462
|
});
|
|
@@ -460,11 +466,13 @@ class CalendarWeekComponent {
|
|
|
460
466
|
this.currentTimeRow = 0;
|
|
461
467
|
this.currentTimeLabel = '';
|
|
462
468
|
}
|
|
469
|
+
// See calendar-day: the setInterval tick marks nothing by itself.
|
|
470
|
+
this.cdr.markForCheck();
|
|
463
471
|
}
|
|
464
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
465
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
472
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarWeekComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
473
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: CalendarWeekComponent, isStandalone: true, selector: "mn-calendar-week", inputs: { focusDay: "focusDay", eventsChanged: "eventsChanged", focusDayChanged: "focusDayChanged", config: "config", calendarEventComponent: "calendarEventComponent" }, outputs: { eventClicked: "eventClicked" }, providers: [CalendarEventLayoutService], ngImport: i0, template: "<!-- Week grid. Hour rules are quiet hairlines; today's column header is a tinted\n number (no fill); the current time is a line carrying a small time bubble.\n Dynamic row/column placement stays inline \u2014 the layout maths lives in TS. -->\n<div [attr.aria-label]=\"weekViewLabel\" class=\"w-full h-full flex flex-col overflow-hidden\" role=\"grid\">\n <div class=\"grid\" [style.grid-template-columns]=\"'60px ' + gridTemplateColumns\">\n <div></div>\n @for (col of columns; track col.dayName; let i = $index) {\n <div class=\"py-2 px-1 text-center\"\n [style.grid-column]=\"getHeaderColumn(i)\"\n role=\"columnheader\">\n <span class=\"block text-[11px] font-semibold uppercase tracking-wide opacity-50\">{{ col.dayName }}</span>\n <span class=\"text-lg font-bold tabular-nums\" [class.text-primary]=\"col.isToday\">{{ col.dayNumber }}</span>\n </div>\n }\n </div>\n <div class=\"grid grid-cols-[60px_1fr] flex-1 min-h-0 overflow-hidden items-stretch\">\n <div class=\"grid h-full min-h-0\" [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"flex items-start justify-end min-h-0 overflow-hidden pr-2 text-[11px] tabular-nums opacity-50\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\">\n {{ row.hourLabel }}\n </div>\n }\n </div>\n <div class=\"grid relative auto-rows-fr h-full min-h-0\"\n [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\"\n [style.grid-template-columns]=\"gridTemplateColumns\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"border-t border-base-200 pointer-events-none min-h-0\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\"\n [style.grid-column]=\"'1 / -1'\">\n </div>\n }\n @if (currentTimeRow > 0 && currentTimeCol) {\n <div class=\"relative z-[2] pointer-events-none\"\n [style.grid-row]=\"currentTimeRow\"\n [style.grid-column]=\"currentTimeCol\">\n <div class=\"absolute -left-1 -top-1 h-2 w-2 rounded-full bg-error\"></div>\n <div class=\"h-0.5 w-full bg-error\"></div>\n <div class=\"absolute left-0 top-0 -translate-x-2 -translate-y-1/2 rounded-full bg-error px-1.5 py-0.5 text-[10px] font-bold tabular-nums text-error-content shadow\">{{ currentTimeLabel }}</div>\n </div>\n }\n @for (event of displayEvents; track $index) {\n <div class=\"z-[1] min-h-0 overflow-hidden rounded-lg p-0.5 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary\"\n [style.grid-row]=\"getEventRow(event)\"\n [style.grid-column]=\"getEventColumn(event)\"\n (click)=\"onEventClick(event)\"\n (keyup.enter)=\"onEventClick(event)\"\n tabindex=\"0\">\n <mn-calendar-event [customComponent]=\"calendarEventComponent\" [event]=\"event\"></mn-calendar-event>\n </div>\n }\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: CalendarEventComponent, selector: "mn-calendar-event", inputs: ["event", "customComponent"], outputs: ["eventClicked"] }] });
|
|
466
474
|
}
|
|
467
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
475
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarWeekComponent, decorators: [{
|
|
468
476
|
type: Component,
|
|
469
477
|
args: [{ selector: 'mn-calendar-week', standalone: true, imports: [CommonModule, CalendarEventComponent], providers: [CalendarEventLayoutService], template: "<!-- Week grid. Hour rules are quiet hairlines; today's column header is a tinted\n number (no fill); the current time is a line carrying a small time bubble.\n Dynamic row/column placement stays inline \u2014 the layout maths lives in TS. -->\n<div [attr.aria-label]=\"weekViewLabel\" class=\"w-full h-full flex flex-col overflow-hidden\" role=\"grid\">\n <div class=\"grid\" [style.grid-template-columns]=\"'60px ' + gridTemplateColumns\">\n <div></div>\n @for (col of columns; track col.dayName; let i = $index) {\n <div class=\"py-2 px-1 text-center\"\n [style.grid-column]=\"getHeaderColumn(i)\"\n role=\"columnheader\">\n <span class=\"block text-[11px] font-semibold uppercase tracking-wide opacity-50\">{{ col.dayName }}</span>\n <span class=\"text-lg font-bold tabular-nums\" [class.text-primary]=\"col.isToday\">{{ col.dayNumber }}</span>\n </div>\n }\n </div>\n <div class=\"grid grid-cols-[60px_1fr] flex-1 min-h-0 overflow-hidden items-stretch\">\n <div class=\"grid h-full min-h-0\" [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"flex items-start justify-end min-h-0 overflow-hidden pr-2 text-[11px] tabular-nums opacity-50\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\">\n {{ row.hourLabel }}\n </div>\n }\n </div>\n <div class=\"grid relative auto-rows-fr h-full min-h-0\"\n [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\"\n [style.grid-template-columns]=\"gridTemplateColumns\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"border-t border-base-200 pointer-events-none min-h-0\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\"\n [style.grid-column]=\"'1 / -1'\">\n </div>\n }\n @if (currentTimeRow > 0 && currentTimeCol) {\n <div class=\"relative z-[2] pointer-events-none\"\n [style.grid-row]=\"currentTimeRow\"\n [style.grid-column]=\"currentTimeCol\">\n <div class=\"absolute -left-1 -top-1 h-2 w-2 rounded-full bg-error\"></div>\n <div class=\"h-0.5 w-full bg-error\"></div>\n <div class=\"absolute left-0 top-0 -translate-x-2 -translate-y-1/2 rounded-full bg-error px-1.5 py-0.5 text-[10px] font-bold tabular-nums text-error-content shadow\">{{ currentTimeLabel }}</div>\n </div>\n }\n @for (event of displayEvents; track $index) {\n <div class=\"z-[1] min-h-0 overflow-hidden rounded-lg p-0.5 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary\"\n [style.grid-row]=\"getEventRow(event)\"\n [style.grid-column]=\"getEventColumn(event)\"\n (click)=\"onEventClick(event)\"\n (keyup.enter)=\"onEventClick(event)\"\n tabindex=\"0\">\n <mn-calendar-event [customComponent]=\"calendarEventComponent\" [event]=\"event\"></mn-calendar-event>\n </div>\n }\n </div>\n </div>\n</div>\n" }]
|
|
470
478
|
}], ctorParameters: () => [], propDecorators: { focusDay: [{
|
|
@@ -529,19 +537,21 @@ class CalendarDayComponent {
|
|
|
529
537
|
this.formatter = new DefaultCalendarDateFormatter();
|
|
530
538
|
}
|
|
531
539
|
ngOnInit() {
|
|
532
|
-
this.resolvedConfig = this.config
|
|
540
|
+
this.resolvedConfig = this.config
|
|
541
|
+
? resolveCalendarConfig(this.config)
|
|
542
|
+
: { ...DEFAULT_CALENDAR_CONFIG };
|
|
533
543
|
this.updateDayInfo();
|
|
534
544
|
this.updateCurrentTime();
|
|
535
545
|
this.currentTimeInterval = setInterval(() => this.updateCurrentTime(), 60000);
|
|
536
546
|
if (this.eventsChanged) {
|
|
537
|
-
this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe(events => {
|
|
547
|
+
this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe((events) => {
|
|
538
548
|
this.events = events;
|
|
539
549
|
this.refreshEvents();
|
|
540
550
|
this.cdr.markForCheck();
|
|
541
551
|
});
|
|
542
552
|
}
|
|
543
553
|
if (this.focusDayChanged) {
|
|
544
|
-
this.focusDayChanged.pipe(takeUntil(this.destroy$)).subscribe(date => {
|
|
554
|
+
this.focusDayChanged.pipe(takeUntil(this.destroy$)).subscribe((date) => {
|
|
545
555
|
this.focusDay = date;
|
|
546
556
|
this.updateDayInfo();
|
|
547
557
|
this.refreshEvents();
|
|
@@ -593,7 +603,7 @@ class CalendarDayComponent {
|
|
|
593
603
|
hour,
|
|
594
604
|
topRow: i * 2 + 1,
|
|
595
605
|
bottomRow: i * 2 + 3,
|
|
596
|
-
hourLabel: label
|
|
606
|
+
hourLabel: label,
|
|
597
607
|
});
|
|
598
608
|
}
|
|
599
609
|
this.hourRows = rows;
|
|
@@ -617,7 +627,7 @@ class CalendarDayComponent {
|
|
|
617
627
|
rangeStart.setHours(0, 0, 0, 0);
|
|
618
628
|
const rangeEnd = new Date(this.focusDay);
|
|
619
629
|
rangeEnd.setHours(23, 59, 59, 999);
|
|
620
|
-
const filtered = this.events.filter(e => this.layoutService.eventsOverlap(e.startTime, e.endTime, rangeStart, rangeEnd));
|
|
630
|
+
const filtered = this.events.filter((e) => this.layoutService.eventsOverlap(e.startTime, e.endTime, rangeStart, rangeEnd));
|
|
621
631
|
this.displayEvents = this.layoutService.calculateMultiDayEvents(filtered, this.resolvedConfig.startHour, this.resolvedConfig.endHour, rangeStart, rangeEnd);
|
|
622
632
|
this.layoutService.assignColumnsToEvents(this.displayEvents);
|
|
623
633
|
this.layoutService.assignWidthsToEvents(this.displayEvents, rangeStart, rangeEnd);
|
|
@@ -630,7 +640,7 @@ class CalendarDayComponent {
|
|
|
630
640
|
this.currentTimeRow = CalendarUtility.getCorrectRow(now.getHours(), now.getMinutes(), this.resolvedConfig.startHour);
|
|
631
641
|
this.isToday = true;
|
|
632
642
|
// formatTime is async; refresh the label and re-render when it resolves.
|
|
633
|
-
this.formatter.formatTime(now).then(label => {
|
|
643
|
+
this.formatter.formatTime(now).then((label) => {
|
|
634
644
|
this.currentTimeLabel = label;
|
|
635
645
|
this.cdr.markForCheck();
|
|
636
646
|
});
|
|
@@ -640,11 +650,15 @@ class CalendarDayComponent {
|
|
|
640
650
|
this.isToday = false;
|
|
641
651
|
this.currentTimeLabel = '';
|
|
642
652
|
}
|
|
653
|
+
// The minute tick is a bare setInterval, so neither branch is reached through anything
|
|
654
|
+
// Angular wraps. Only the `then` above marked anything, which left a view opened on a
|
|
655
|
+
// day that stops being today painting its "now" line forever.
|
|
656
|
+
this.cdr.markForCheck();
|
|
643
657
|
}
|
|
644
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
645
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
658
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarDayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
659
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: CalendarDayComponent, isStandalone: true, selector: "mn-calendar-day", inputs: { focusDay: "focusDay", eventsChanged: "eventsChanged", focusDayChanged: "focusDayChanged", config: "config", calendarEventComponent: "calendarEventComponent" }, outputs: { eventClicked: "eventClicked" }, providers: [CalendarEventLayoutService], ngImport: i0, template: "<!-- Day grid. One column, its header centered over that column (the toolbar\n already names the date). Today's number is tinted, not filled; the now-line\n carries a time bubble that overhangs into the gutter. -->\n<div [attr.aria-label]=\"dayViewLabel\" class=\"w-full h-full flex flex-col overflow-hidden\" role=\"grid\">\n <div class=\"grid grid-cols-[60px_1fr]\">\n <div></div>\n <div class=\"flex items-center justify-center gap-2 py-2 px-1\" role=\"columnheader\">\n <span class=\"text-[11px] font-semibold uppercase tracking-wide opacity-50\">{{ dayName }}</span>\n <span class=\"text-base font-bold tabular-nums\" [class.text-primary]=\"isToday\">{{ focusDay.getDate() }}</span>\n </div>\n </div>\n <div class=\"grid grid-cols-[60px_1fr] flex-1 min-h-0 overflow-hidden items-stretch\">\n <div class=\"grid h-full min-h-0\" [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"flex items-start justify-end min-h-0 overflow-hidden pr-2 text-[11px] tabular-nums opacity-50\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\">\n {{ row.hourLabel }}\n </div>\n }\n </div>\n <div class=\"grid relative auto-rows-fr h-full min-h-0\"\n [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\"\n [style.grid-template-columns]=\"'repeat(' + totalColumns + ', 1fr)'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"border-t border-base-200 pointer-events-none min-h-0\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\"\n [style.grid-column]=\"'1 / -1'\">\n </div>\n }\n @if (currentTimeRow > 0 && isToday) {\n <div class=\"relative z-[2] pointer-events-none\"\n [style.grid-row]=\"currentTimeRow\"\n [style.grid-column]=\"'1 / -1'\">\n <div class=\"absolute -left-1 -top-1 h-2 w-2 rounded-full bg-error\"></div>\n <div class=\"h-0.5 w-full bg-error\"></div>\n <div class=\"absolute left-0 top-0 -translate-x-2 -translate-y-1/2 rounded-full bg-error px-1.5 py-0.5 text-[10px] font-bold tabular-nums text-error-content shadow\">{{ currentTimeLabel }}</div>\n </div>\n }\n @for (event of displayEvents; track $index) {\n <div class=\"z-[1] min-h-0 overflow-hidden rounded-lg p-0.5 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary\"\n [style.grid-row]=\"getEventRow(event)\"\n [style.grid-column]=\"getEventColumn(event)\"\n (click)=\"onEventClick(event)\"\n (keyup.enter)=\"onEventClick(event)\"\n tabindex=\"0\">\n <mn-calendar-event [customComponent]=\"calendarEventComponent\" [event]=\"event\"></mn-calendar-event>\n </div>\n }\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: CalendarEventComponent, selector: "mn-calendar-event", inputs: ["event", "customComponent"], outputs: ["eventClicked"] }] });
|
|
646
660
|
}
|
|
647
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
661
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarDayComponent, decorators: [{
|
|
648
662
|
type: Component,
|
|
649
663
|
args: [{ selector: 'mn-calendar-day', standalone: true, imports: [CommonModule, CalendarEventComponent], providers: [CalendarEventLayoutService], template: "<!-- Day grid. One column, its header centered over that column (the toolbar\n already names the date). Today's number is tinted, not filled; the now-line\n carries a time bubble that overhangs into the gutter. -->\n<div [attr.aria-label]=\"dayViewLabel\" class=\"w-full h-full flex flex-col overflow-hidden\" role=\"grid\">\n <div class=\"grid grid-cols-[60px_1fr]\">\n <div></div>\n <div class=\"flex items-center justify-center gap-2 py-2 px-1\" role=\"columnheader\">\n <span class=\"text-[11px] font-semibold uppercase tracking-wide opacity-50\">{{ dayName }}</span>\n <span class=\"text-base font-bold tabular-nums\" [class.text-primary]=\"isToday\">{{ focusDay.getDate() }}</span>\n </div>\n </div>\n <div class=\"grid grid-cols-[60px_1fr] flex-1 min-h-0 overflow-hidden items-stretch\">\n <div class=\"grid h-full min-h-0\" [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"flex items-start justify-end min-h-0 overflow-hidden pr-2 text-[11px] tabular-nums opacity-50\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\">\n {{ row.hourLabel }}\n </div>\n }\n </div>\n <div class=\"grid relative auto-rows-fr h-full min-h-0\"\n [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\"\n [style.grid-template-columns]=\"'repeat(' + totalColumns + ', 1fr)'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"border-t border-base-200 pointer-events-none min-h-0\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\"\n [style.grid-column]=\"'1 / -1'\">\n </div>\n }\n @if (currentTimeRow > 0 && isToday) {\n <div class=\"relative z-[2] pointer-events-none\"\n [style.grid-row]=\"currentTimeRow\"\n [style.grid-column]=\"'1 / -1'\">\n <div class=\"absolute -left-1 -top-1 h-2 w-2 rounded-full bg-error\"></div>\n <div class=\"h-0.5 w-full bg-error\"></div>\n <div class=\"absolute left-0 top-0 -translate-x-2 -translate-y-1/2 rounded-full bg-error px-1.5 py-0.5 text-[10px] font-bold tabular-nums text-error-content shadow\">{{ currentTimeLabel }}</div>\n </div>\n }\n @for (event of displayEvents; track $index) {\n <div class=\"z-[1] min-h-0 overflow-hidden rounded-lg p-0.5 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary\"\n [style.grid-row]=\"getEventRow(event)\"\n [style.grid-column]=\"getEventColumn(event)\"\n (click)=\"onEventClick(event)\"\n (keyup.enter)=\"onEventClick(event)\"\n tabindex=\"0\">\n <mn-calendar-event [customComponent]=\"calendarEventComponent\" [event]=\"event\"></mn-calendar-event>\n </div>\n }\n </div>\n </div>\n</div>\n" }]
|
|
650
664
|
}], ctorParameters: () => [], propDecorators: { focusDay: [{
|
|
@@ -672,8 +686,12 @@ class UpcomingEventRowComponent {
|
|
|
672
686
|
eventClicked = new EventEmitter();
|
|
673
687
|
formattedDate = '';
|
|
674
688
|
formatter;
|
|
689
|
+
/** Marks the view when the awaited time string lands (see {@link ngOnInit}). */
|
|
690
|
+
cdr = inject(ChangeDetectorRef);
|
|
675
691
|
constructor() {
|
|
676
|
-
const formatter = inject(CALENDAR_DATE_FORMATTER, {
|
|
692
|
+
const formatter = inject(CALENDAR_DATE_FORMATTER, {
|
|
693
|
+
optional: true,
|
|
694
|
+
});
|
|
677
695
|
this.formatter = formatter ?? new DefaultCalendarDateFormatter();
|
|
678
696
|
}
|
|
679
697
|
async ngOnInit() {
|
|
@@ -681,12 +699,15 @@ class UpcomingEventRowComponent {
|
|
|
681
699
|
const start = await this.formatter.formatTime(this.event.startTime);
|
|
682
700
|
const end = await this.formatter.formatTime(this.event.endTime);
|
|
683
701
|
this.formattedDate = `${start} - ${end}`;
|
|
702
|
+
// The first render already happened with the empty string; nothing schedules a second
|
|
703
|
+
// one for a value written after an await. Same fix as calendar-event-default.
|
|
704
|
+
this.cdr.markForCheck();
|
|
684
705
|
}
|
|
685
706
|
}
|
|
686
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
687
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
707
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UpcomingEventRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
708
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UpcomingEventRowComponent, isStandalone: true, selector: "mn-upcoming-event-row", inputs: { event: "event" }, outputs: { eventClicked: "eventClicked" }, ngImport: i0, 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 \u2014 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=\"truncate 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=\"truncate text-xs opacity-50\">{{ event.description }}</div>\n }\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
688
709
|
}
|
|
689
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
710
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UpcomingEventRowComponent, decorators: [{
|
|
690
711
|
type: Component,
|
|
691
712
|
args: [{ selector: 'mn-upcoming-event-row', standalone: true, imports: [CommonModule], 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 \u2014 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=\"truncate 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=\"truncate text-xs opacity-50\">{{ event.description }}</div>\n }\n </div>\n</div>\n" }]
|
|
692
713
|
}], ctorParameters: () => [], propDecorators: { event: [{
|
|
@@ -733,17 +754,19 @@ class UpcomingEventsComponent {
|
|
|
733
754
|
}
|
|
734
755
|
}
|
|
735
756
|
ngOnInit() {
|
|
736
|
-
const resolved = this.config
|
|
757
|
+
const resolved = this.config
|
|
758
|
+
? resolveCalendarConfig(this.config)
|
|
759
|
+
: { ...DEFAULT_CALENDAR_CONFIG };
|
|
737
760
|
this.title = resolved.upcomingEventsTitle;
|
|
738
761
|
this.noEventsMessage = resolved.noUpcomingEvents;
|
|
739
762
|
// Marked because the list is a plain field: in a zoneless app a stream emission is not by
|
|
740
763
|
// itself a reason for Angular to re-render, so the sidebar would keep showing the events it
|
|
741
764
|
// was first given.
|
|
742
765
|
if (this.eventsChanged) {
|
|
743
|
-
this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe(events => {
|
|
766
|
+
this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe((events) => {
|
|
744
767
|
const now = new Date();
|
|
745
768
|
this.upcomingEvents = events
|
|
746
|
-
.filter(e => e.endTime > now)
|
|
769
|
+
.filter((e) => e.endTime > now)
|
|
747
770
|
.sort((a, b) => a.startTime.getTime() - b.startTime.getTime())
|
|
748
771
|
.slice(0, 10);
|
|
749
772
|
this.cdr.markForCheck();
|
|
@@ -758,10 +781,10 @@ class UpcomingEventsComponent {
|
|
|
758
781
|
trackByEvent(_index, event) {
|
|
759
782
|
return event.id;
|
|
760
783
|
}
|
|
761
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
762
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
784
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UpcomingEventsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
785
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UpcomingEventsComponent, isStandalone: true, selector: "mn-upcoming-events", inputs: { eventsChanged: "eventsChanged", config: "config" }, outputs: { eventClicked: "eventClicked" }, usesOnChanges: true, ngImport: i0, template: "<div [attr.aria-label]=\"upcomingEventsLabel\" class=\"p-4\" role=\"complementary\">\n <div class=\"mb-3 flex items-center gap-2\">\n <h3 class=\"text-sm font-bold tracking-wide\">{{ title }}</h3>\n @if (upcomingEvents.length) {\n <span class=\"text-xs font-semibold tabular-nums opacity-45\">{{ upcomingEvents.length }}</span>\n }\n </div>\n @for (event of upcomingEvents; track $index) {\n <mn-upcoming-event-row\n [event]=\"event\"\n (eventClicked)=\"eventClicked.emit($event)\">\n </mn-upcoming-event-row>\n }\n @if (upcomingEvents.length === 0) {\n <div class=\"text-sm opacity-50\">{{ noEventsMessage }}</div>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: UpcomingEventRowComponent, selector: "mn-upcoming-event-row", inputs: ["event"], outputs: ["eventClicked"] }] });
|
|
763
786
|
}
|
|
764
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
787
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UpcomingEventsComponent, decorators: [{
|
|
765
788
|
type: Component,
|
|
766
789
|
args: [{ selector: 'mn-upcoming-events', standalone: true, imports: [CommonModule, UpcomingEventRowComponent], template: "<div [attr.aria-label]=\"upcomingEventsLabel\" class=\"p-4\" role=\"complementary\">\n <div class=\"mb-3 flex items-center gap-2\">\n <h3 class=\"text-sm font-bold tracking-wide\">{{ title }}</h3>\n @if (upcomingEvents.length) {\n <span class=\"text-xs font-semibold tabular-nums opacity-45\">{{ upcomingEvents.length }}</span>\n }\n </div>\n @for (event of upcomingEvents; track $index) {\n <mn-upcoming-event-row\n [event]=\"event\"\n (eventClicked)=\"eventClicked.emit($event)\">\n </mn-upcoming-event-row>\n }\n @if (upcomingEvents.length === 0) {\n <div class=\"text-sm opacity-50\">{{ noEventsMessage }}</div>\n }\n</div>\n" }]
|
|
767
790
|
}], ctorParameters: () => [], propDecorators: { eventsChanged: [{
|
|
@@ -870,7 +893,7 @@ class CalendarViewComponent {
|
|
|
870
893
|
this.checkMobileView();
|
|
871
894
|
this.RequestNewCalendarItemsEvent.emit(this.focusDay);
|
|
872
895
|
if (this.NewCalendarItemsEvent) {
|
|
873
|
-
this.NewCalendarItemsEvent.pipe(takeUntil(this.destroy$)).subscribe(events => {
|
|
896
|
+
this.NewCalendarItemsEvent.pipe(takeUntil(this.destroy$)).subscribe((events) => {
|
|
874
897
|
this.internalEventsChanged.next(events);
|
|
875
898
|
});
|
|
876
899
|
}
|
|
@@ -983,7 +1006,7 @@ class CalendarViewComponent {
|
|
|
983
1006
|
this.viewOptions = [
|
|
984
1007
|
{ value: CalendarView.MONTH, label: this.config.viewLabels['MONTH'] ?? 'Month' },
|
|
985
1008
|
{ value: CalendarView.WEEK, label: this.config.viewLabels['WEEK'] ?? 'Week' },
|
|
986
|
-
{ value: CalendarView.DAY, label: this.config.viewLabels['DAY'] ?? 'Day' }
|
|
1009
|
+
{ value: CalendarView.DAY, label: this.config.viewLabels['DAY'] ?? 'Day' },
|
|
987
1010
|
];
|
|
988
1011
|
}
|
|
989
1012
|
checkMobileView() {
|
|
@@ -1023,12 +1046,10 @@ class CalendarViewComponent {
|
|
|
1023
1046
|
this.internalFocusDayChanged.next(date);
|
|
1024
1047
|
this.RequestNewCalendarItemsEvent.emit(date);
|
|
1025
1048
|
}
|
|
1026
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1027
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1028
|
-
provideMnCalendarConfig(DEFAULT_CALENDAR_CONFIG),
|
|
1029
|
-
], ngImport: i0, template: "<div class=\"w-full h-full flex flex-col\" role=\"application\" aria-label=\"Calendar\">\n\n <!-- Toolbar has one layout below the desktop (`lg`) width and one at it. Below\n `lg`: a controls row (Today anchored left, the right-hand cluster anchored\n right) with the \u2039 date \u203A nav centred on its own row beneath \u2014 the same\n shape from phone through tablet, so nothing wraps into a lopsided diagonal.\n At `lg`, where the upcoming-events sidebar also appears, the nav folds up\n inline after Today and the whole toolbar becomes a single row. The one JS\n breakpoint (`mobileBreakpoint`) governs the phone controls \u2014 icon-only\n picker, hidden view-switcher, forced day view \u2014 not the toolbar's shape. -->\n <div class=\"flex flex-wrap items-center gap-x-3 gap-y-2 py-3\">\n\n <button (click)=\"goToToday()\"\n [data]=\"{ variant: 'outline', size: 'md', color: 'primary' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n {{ config.todayLabel }}\n </button>\n\n <!-- Stepping through time. The arrows sit either side of the date they move,\n so the control and the thing it controls read as one unit. Below `lg` it\n sits centred on its own row (basis-full, ordered last) \u2014 a period header\n above the grid, tight rather than flinging the arrows to the row's edges.\n At `lg` it folds inline right after Today, taking a stable min-width so\n the arrows don't jitter as the label's length changes. -->\n <div class=\"flex basis-full order-last justify-center items-center gap-1\n lg:basis-auto lg:order-none lg:justify-start\">\n <button (click)=\"navigate(-1)\"\n [attr.aria-label]=\"config.previousLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n </button>\n\n <h2 aria-live=\"polite\"\n class=\"text-center text-base font-semibold whitespace-nowrap px-1 lg:min-w-56\">\n {{ periodLabel }}\n </h2>\n\n <button (click)=\"navigate(1)\"\n [attr.aria-label]=\"config.nextLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronRight\"></svg>\n </button>\n </div>\n\n <!-- Right-hand controls travel together as one cluster with `ml-auto`, so they\n hold to the right of the row on every width \u2014 and when space runs short the\n whole group wraps to a new line as a unit rather than stranding a lone\n button. On desktop the cluster lands above the upcoming-events sidebar,\n using that otherwise-empty space. -->\n <div class=\"ml-auto flex items-center gap-2\">\n <!-- On mobile the picker collapses to its icon-only variant. -->\n <mn-lib-datetime (ngModelChange)=\"onPickDate($event)\"\n [ngModel]=\"focusDayString\"\n [props]=\"{ id: panelId + '-date', mode: 'date', placeholder: config.pickDateLabel, size: 'md', borderRadius: 'lg', hover: true, iconOnly: isMobileView }\"\n class=\"block\"></mn-lib-datetime>\n\n <!-- View switcher (month / week / day) \u2014 hidden on mobile, which is forced to day view. -->\n @if (!isMobileView) {\n <div [attr.aria-label]=\"calendarViewLabel\" class=\"flex border border-base-300 rounded-md overflow-hidden\"\n role=\"tablist\">\n @for (view of viewOptions; track view.value) {\n <button\n (click)=\"switchView(view.value)\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"currentView === view.value\"\n [data]=\"{ size: 'md', variant: currentView === view.value ? 'fill' : 'text', color: 'primary' }\"\n mnButton\n role=\"tab\"\n type=\"button\">\n {{ view.label }}\n </button>\n }\n </div>\n }\n\n <!-- Action buttons (custom buttons + optional showButton CTA). -->\n @if (buttons.length || showButton) {\n @for (btn of buttons; track btn.label) {\n <button (click)=\"btn.onClick()\" [data]=\"btn.buttonData || {}\" mnButton type=\"button\">\n {{ btn.label }}\n </button>\n }\n @if (showButton) {\n <button (click)=\"ButtonClickedEvent.emit()\" [data]=\"{}\" mnButton type=\"button\">\n {{ buttonTitle }}\n </button>\n }\n }\n </div>\n\n </div>\n\n <div class=\"grid grid-cols-1 lg:grid-cols-[1fr_220px] gap-3 flex-1 min-h-0\">\n <div [id]=\"panelId\" class=\"min-w-0 min-h-0 overflow-hidden overflow-y-auto\" role=\"tabpanel\">\n @if (currentView === CalendarView.MONTH) {\n <mn-calendar-month\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n (dayClicked)=\"onMonthDayClick($event)\">\n </mn-calendar-month>\n }\n @if (currentView === CalendarView.WEEK) {\n <mn-calendar-week\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-week>\n }\n @if (currentView === CalendarView.DAY) {\n <mn-calendar-day\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-day>\n }\n </div>\n <div class=\"hidden lg:block border-l border-base-300 overflow-auto\">\n <mn-upcoming-events\n [eventsChanged]=\"internalEventsChanged\"\n [config]=\"config\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-upcoming-events>\n </div>\n </div>\n\n</div>\n", styles: [":host{display:flex;flex-direction:column;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CalendarMonthComponent, selector: "mn-calendar-month", inputs: ["focusDay", "eventsChanged", "focusDayChanged", "config"], outputs: ["dayClicked"] }, { kind: "component", type: CalendarWeekComponent, selector: "mn-calendar-week", inputs: ["focusDay", "eventsChanged", "focusDayChanged", "config", "calendarEventComponent"], outputs: ["eventClicked"] }, { kind: "component", type: CalendarDayComponent, selector: "mn-calendar-day", inputs: ["focusDay", "eventsChanged", "focusDayChanged", "config", "calendarEventComponent"], outputs: ["eventClicked"] }, { kind: "component", type: UpcomingEventsComponent, selector: "mn-upcoming-events", inputs: ["eventsChanged", "config"], outputs: ["eventClicked"] }, { kind: "component", type: MnButton, selector: "button[mnButton], a[mnButton]", inputs: ["data"] }, { kind: "component", type: MnDatetime, selector: "mn-lib-datetime", inputs: ["props"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }] });
|
|
1049
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1050
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: CalendarViewComponent, isStandalone: true, selector: "mn-calendar-view", inputs: { showButton: "showButton", buttonTitle: "buttonTitle", buttons: "buttons", CalendarEventComponent: "CalendarEventComponent", NewCalendarItemsEvent: "NewCalendarItemsEvent" }, outputs: { RequestNewCalendarItemsEvent: "RequestNewCalendarItemsEvent", CalendarItemClickedEvent: "CalendarItemClickedEvent", ButtonClickedEvent: "ButtonClickedEvent" }, host: { listeners: { "window:resize": "onResize()" } }, providers: [provideMnCalendarConfig(DEFAULT_CALENDAR_CONFIG)], ngImport: i0, template: "<div class=\"w-full h-full flex flex-col\" role=\"application\" aria-label=\"Calendar\">\n\n <!-- Toolbar has one layout below the desktop (`lg`) width and one at it. Below\n `lg`: a controls row (Today anchored left, the right-hand cluster anchored\n right) with the \u2039 date \u203A nav centred on its own row beneath \u2014 the same\n shape from phone through tablet, so nothing wraps into a lopsided diagonal.\n At `lg`, where the upcoming-events sidebar also appears, the nav folds up\n inline after Today and the whole toolbar becomes a single row. The one JS\n breakpoint (`mobileBreakpoint`) governs the phone controls \u2014 icon-only\n picker, hidden view-switcher, forced day view \u2014 not the toolbar's shape. -->\n <div class=\"flex flex-wrap items-center gap-x-3 gap-y-2 py-3\">\n\n <button (click)=\"goToToday()\"\n [data]=\"{ variant: 'outline', size: 'md', color: 'primary' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n {{ config.todayLabel }}\n </button>\n\n <!-- Stepping through time. The arrows sit either side of the date they move,\n so the control and the thing it controls read as one unit. Below `lg` it\n sits centred on its own row (basis-full, ordered last) \u2014 a period header\n above the grid, tight rather than flinging the arrows to the row's edges.\n At `lg` it folds inline right after Today, taking a stable min-width so\n the arrows don't jitter as the label's length changes. -->\n <div class=\"flex basis-full order-last justify-center items-center gap-1\n lg:basis-auto lg:order-none lg:justify-start\">\n <button (click)=\"navigate(-1)\"\n [attr.aria-label]=\"config.previousLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n </button>\n\n <h2 aria-live=\"polite\"\n class=\"text-center text-base font-semibold whitespace-nowrap px-1 lg:min-w-56\">\n {{ periodLabel }}\n </h2>\n\n <button (click)=\"navigate(1)\"\n [attr.aria-label]=\"config.nextLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronRight\"></svg>\n </button>\n </div>\n\n <!-- Right-hand controls travel together as one cluster with `ml-auto`, so they\n hold to the right of the row on every width \u2014 and when space runs short the\n whole group wraps to a new line as a unit rather than stranding a lone\n button. On desktop the cluster lands above the upcoming-events sidebar,\n using that otherwise-empty space. -->\n <div class=\"ml-auto flex items-center gap-2\">\n <!-- On mobile the picker collapses to its icon-only variant. -->\n <mn-lib-datetime (ngModelChange)=\"onPickDate($event)\"\n [ngModel]=\"focusDayString\"\n [props]=\"{ id: panelId + '-date', mode: 'date', placeholder: config.pickDateLabel, size: 'md', borderRadius: 'lg', hover: true, iconOnly: isMobileView }\"\n class=\"block\"></mn-lib-datetime>\n\n <!-- View switcher (month / week / day) \u2014 hidden on mobile, which is forced to day view. -->\n @if (!isMobileView) {\n <div [attr.aria-label]=\"calendarViewLabel\" class=\"flex border border-base-300 rounded-md overflow-hidden\"\n role=\"tablist\">\n @for (view of viewOptions; track view.value) {\n <button\n (click)=\"switchView(view.value)\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"currentView === view.value\"\n [data]=\"{ size: 'md', variant: currentView === view.value ? 'fill' : 'text', color: 'primary' }\"\n mnButton\n role=\"tab\"\n type=\"button\">\n {{ view.label }}\n </button>\n }\n </div>\n }\n\n <!-- Action buttons (custom buttons + optional showButton CTA). -->\n @if (buttons.length || showButton) {\n @for (btn of buttons; track btn.label) {\n <button (click)=\"btn.onClick()\" [data]=\"btn.buttonData || {}\" mnButton type=\"button\">\n {{ btn.label }}\n </button>\n }\n @if (showButton) {\n <button (click)=\"ButtonClickedEvent.emit()\" [data]=\"{}\" mnButton type=\"button\">\n {{ buttonTitle }}\n </button>\n }\n }\n </div>\n\n </div>\n\n <div class=\"grid grid-cols-1 lg:grid-cols-[1fr_220px] gap-3 flex-1 min-h-0\">\n <div [id]=\"panelId\" class=\"min-w-0 min-h-0 overflow-hidden overflow-y-auto\" role=\"tabpanel\">\n @if (currentView === CalendarView.MONTH) {\n <mn-calendar-month\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n (dayClicked)=\"onMonthDayClick($event)\">\n </mn-calendar-month>\n }\n @if (currentView === CalendarView.WEEK) {\n <mn-calendar-week\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-week>\n }\n @if (currentView === CalendarView.DAY) {\n <mn-calendar-day\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-day>\n }\n </div>\n <div class=\"hidden lg:block border-l border-base-300 overflow-auto\">\n <mn-upcoming-events\n [eventsChanged]=\"internalEventsChanged\"\n [config]=\"config\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-upcoming-events>\n </div>\n </div>\n\n</div>\n", styles: [":host{display:flex;flex-direction:column;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CalendarMonthComponent, selector: "mn-calendar-month", inputs: ["focusDay", "eventsChanged", "focusDayChanged", "config"], outputs: ["dayClicked"] }, { kind: "component", type: CalendarWeekComponent, selector: "mn-calendar-week", inputs: ["focusDay", "eventsChanged", "focusDayChanged", "config", "calendarEventComponent"], outputs: ["eventClicked"] }, { kind: "component", type: CalendarDayComponent, selector: "mn-calendar-day", inputs: ["focusDay", "eventsChanged", "focusDayChanged", "config", "calendarEventComponent"], outputs: ["eventClicked"] }, { kind: "component", type: UpcomingEventsComponent, selector: "mn-upcoming-events", inputs: ["eventsChanged", "config"], outputs: ["eventClicked"] }, { kind: "component", type: MnButton, selector: "button[mnButton], a[mnButton]", inputs: ["data"] }, { kind: "component", type: MnDatetime, selector: "mn-lib-datetime", inputs: ["props"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }] });
|
|
1030
1051
|
}
|
|
1031
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1052
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: CalendarViewComponent, decorators: [{
|
|
1032
1053
|
type: Component,
|
|
1033
1054
|
args: [{ selector: 'mn-calendar-view', standalone: true, imports: [
|
|
1034
1055
|
CommonModule,
|
|
@@ -1040,9 +1061,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
1040
1061
|
MnButton,
|
|
1041
1062
|
MnDatetime,
|
|
1042
1063
|
LucideDynamicIcon,
|
|
1043
|
-
], providers: [
|
|
1044
|
-
provideMnCalendarConfig(DEFAULT_CALENDAR_CONFIG),
|
|
1045
|
-
], template: "<div class=\"w-full h-full flex flex-col\" role=\"application\" aria-label=\"Calendar\">\n\n <!-- Toolbar has one layout below the desktop (`lg`) width and one at it. Below\n `lg`: a controls row (Today anchored left, the right-hand cluster anchored\n right) with the \u2039 date \u203A nav centred on its own row beneath \u2014 the same\n shape from phone through tablet, so nothing wraps into a lopsided diagonal.\n At `lg`, where the upcoming-events sidebar also appears, the nav folds up\n inline after Today and the whole toolbar becomes a single row. The one JS\n breakpoint (`mobileBreakpoint`) governs the phone controls \u2014 icon-only\n picker, hidden view-switcher, forced day view \u2014 not the toolbar's shape. -->\n <div class=\"flex flex-wrap items-center gap-x-3 gap-y-2 py-3\">\n\n <button (click)=\"goToToday()\"\n [data]=\"{ variant: 'outline', size: 'md', color: 'primary' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n {{ config.todayLabel }}\n </button>\n\n <!-- Stepping through time. The arrows sit either side of the date they move,\n so the control and the thing it controls read as one unit. Below `lg` it\n sits centred on its own row (basis-full, ordered last) \u2014 a period header\n above the grid, tight rather than flinging the arrows to the row's edges.\n At `lg` it folds inline right after Today, taking a stable min-width so\n the arrows don't jitter as the label's length changes. -->\n <div class=\"flex basis-full order-last justify-center items-center gap-1\n lg:basis-auto lg:order-none lg:justify-start\">\n <button (click)=\"navigate(-1)\"\n [attr.aria-label]=\"config.previousLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n </button>\n\n <h2 aria-live=\"polite\"\n class=\"text-center text-base font-semibold whitespace-nowrap px-1 lg:min-w-56\">\n {{ periodLabel }}\n </h2>\n\n <button (click)=\"navigate(1)\"\n [attr.aria-label]=\"config.nextLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronRight\"></svg>\n </button>\n </div>\n\n <!-- Right-hand controls travel together as one cluster with `ml-auto`, so they\n hold to the right of the row on every width \u2014 and when space runs short the\n whole group wraps to a new line as a unit rather than stranding a lone\n button. On desktop the cluster lands above the upcoming-events sidebar,\n using that otherwise-empty space. -->\n <div class=\"ml-auto flex items-center gap-2\">\n <!-- On mobile the picker collapses to its icon-only variant. -->\n <mn-lib-datetime (ngModelChange)=\"onPickDate($event)\"\n [ngModel]=\"focusDayString\"\n [props]=\"{ id: panelId + '-date', mode: 'date', placeholder: config.pickDateLabel, size: 'md', borderRadius: 'lg', hover: true, iconOnly: isMobileView }\"\n class=\"block\"></mn-lib-datetime>\n\n <!-- View switcher (month / week / day) \u2014 hidden on mobile, which is forced to day view. -->\n @if (!isMobileView) {\n <div [attr.aria-label]=\"calendarViewLabel\" class=\"flex border border-base-300 rounded-md overflow-hidden\"\n role=\"tablist\">\n @for (view of viewOptions; track view.value) {\n <button\n (click)=\"switchView(view.value)\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"currentView === view.value\"\n [data]=\"{ size: 'md', variant: currentView === view.value ? 'fill' : 'text', color: 'primary' }\"\n mnButton\n role=\"tab\"\n type=\"button\">\n {{ view.label }}\n </button>\n }\n </div>\n }\n\n <!-- Action buttons (custom buttons + optional showButton CTA). -->\n @if (buttons.length || showButton) {\n @for (btn of buttons; track btn.label) {\n <button (click)=\"btn.onClick()\" [data]=\"btn.buttonData || {}\" mnButton type=\"button\">\n {{ btn.label }}\n </button>\n }\n @if (showButton) {\n <button (click)=\"ButtonClickedEvent.emit()\" [data]=\"{}\" mnButton type=\"button\">\n {{ buttonTitle }}\n </button>\n }\n }\n </div>\n\n </div>\n\n <div class=\"grid grid-cols-1 lg:grid-cols-[1fr_220px] gap-3 flex-1 min-h-0\">\n <div [id]=\"panelId\" class=\"min-w-0 min-h-0 overflow-hidden overflow-y-auto\" role=\"tabpanel\">\n @if (currentView === CalendarView.MONTH) {\n <mn-calendar-month\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n (dayClicked)=\"onMonthDayClick($event)\">\n </mn-calendar-month>\n }\n @if (currentView === CalendarView.WEEK) {\n <mn-calendar-week\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-week>\n }\n @if (currentView === CalendarView.DAY) {\n <mn-calendar-day\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-day>\n }\n </div>\n <div class=\"hidden lg:block border-l border-base-300 overflow-auto\">\n <mn-upcoming-events\n [eventsChanged]=\"internalEventsChanged\"\n [config]=\"config\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-upcoming-events>\n </div>\n </div>\n\n</div>\n", styles: [":host{display:flex;flex-direction:column;width:100%;height:100%}\n"] }]
|
|
1064
|
+
], providers: [provideMnCalendarConfig(DEFAULT_CALENDAR_CONFIG)], template: "<div class=\"w-full h-full flex flex-col\" role=\"application\" aria-label=\"Calendar\">\n\n <!-- Toolbar has one layout below the desktop (`lg`) width and one at it. Below\n `lg`: a controls row (Today anchored left, the right-hand cluster anchored\n right) with the \u2039 date \u203A nav centred on its own row beneath \u2014 the same\n shape from phone through tablet, so nothing wraps into a lopsided diagonal.\n At `lg`, where the upcoming-events sidebar also appears, the nav folds up\n inline after Today and the whole toolbar becomes a single row. The one JS\n breakpoint (`mobileBreakpoint`) governs the phone controls \u2014 icon-only\n picker, hidden view-switcher, forced day view \u2014 not the toolbar's shape. -->\n <div class=\"flex flex-wrap items-center gap-x-3 gap-y-2 py-3\">\n\n <button (click)=\"goToToday()\"\n [data]=\"{ variant: 'outline', size: 'md', color: 'primary' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n {{ config.todayLabel }}\n </button>\n\n <!-- Stepping through time. The arrows sit either side of the date they move,\n so the control and the thing it controls read as one unit. Below `lg` it\n sits centred on its own row (basis-full, ordered last) \u2014 a period header\n above the grid, tight rather than flinging the arrows to the row's edges.\n At `lg` it folds inline right after Today, taking a stable min-width so\n the arrows don't jitter as the label's length changes. -->\n <div class=\"flex basis-full order-last justify-center items-center gap-1\n lg:basis-auto lg:order-none lg:justify-start\">\n <button (click)=\"navigate(-1)\"\n [attr.aria-label]=\"config.previousLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n </button>\n\n <h2 aria-live=\"polite\"\n class=\"text-center text-base font-semibold whitespace-nowrap px-1 lg:min-w-56\">\n {{ periodLabel }}\n </h2>\n\n <button (click)=\"navigate(1)\"\n [attr.aria-label]=\"config.nextLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronRight\"></svg>\n </button>\n </div>\n\n <!-- Right-hand controls travel together as one cluster with `ml-auto`, so they\n hold to the right of the row on every width \u2014 and when space runs short the\n whole group wraps to a new line as a unit rather than stranding a lone\n button. On desktop the cluster lands above the upcoming-events sidebar,\n using that otherwise-empty space. -->\n <div class=\"ml-auto flex items-center gap-2\">\n <!-- On mobile the picker collapses to its icon-only variant. -->\n <mn-lib-datetime (ngModelChange)=\"onPickDate($event)\"\n [ngModel]=\"focusDayString\"\n [props]=\"{ id: panelId + '-date', mode: 'date', placeholder: config.pickDateLabel, size: 'md', borderRadius: 'lg', hover: true, iconOnly: isMobileView }\"\n class=\"block\"></mn-lib-datetime>\n\n <!-- View switcher (month / week / day) \u2014 hidden on mobile, which is forced to day view. -->\n @if (!isMobileView) {\n <div [attr.aria-label]=\"calendarViewLabel\" class=\"flex border border-base-300 rounded-md overflow-hidden\"\n role=\"tablist\">\n @for (view of viewOptions; track view.value) {\n <button\n (click)=\"switchView(view.value)\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"currentView === view.value\"\n [data]=\"{ size: 'md', variant: currentView === view.value ? 'fill' : 'text', color: 'primary' }\"\n mnButton\n role=\"tab\"\n type=\"button\">\n {{ view.label }}\n </button>\n }\n </div>\n }\n\n <!-- Action buttons (custom buttons + optional showButton CTA). -->\n @if (buttons.length || showButton) {\n @for (btn of buttons; track btn.label) {\n <button (click)=\"btn.onClick()\" [data]=\"btn.buttonData || {}\" mnButton type=\"button\">\n {{ btn.label }}\n </button>\n }\n @if (showButton) {\n <button (click)=\"ButtonClickedEvent.emit()\" [data]=\"{}\" mnButton type=\"button\">\n {{ buttonTitle }}\n </button>\n }\n }\n </div>\n\n </div>\n\n <div class=\"grid grid-cols-1 lg:grid-cols-[1fr_220px] gap-3 flex-1 min-h-0\">\n <div [id]=\"panelId\" class=\"min-w-0 min-h-0 overflow-hidden overflow-y-auto\" role=\"tabpanel\">\n @if (currentView === CalendarView.MONTH) {\n <mn-calendar-month\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n (dayClicked)=\"onMonthDayClick($event)\">\n </mn-calendar-month>\n }\n @if (currentView === CalendarView.WEEK) {\n <mn-calendar-week\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-week>\n }\n @if (currentView === CalendarView.DAY) {\n <mn-calendar-day\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-day>\n }\n </div>\n <div class=\"hidden lg:block border-l border-base-300 overflow-auto\">\n <mn-upcoming-events\n [eventsChanged]=\"internalEventsChanged\"\n [config]=\"config\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-upcoming-events>\n </div>\n </div>\n\n</div>\n", styles: [":host{display:flex;flex-direction:column;width:100%;height:100%}\n"] }]
|
|
1046
1065
|
}], ctorParameters: () => [], propDecorators: { showButton: [{
|
|
1047
1066
|
type: Input
|
|
1048
1067
|
}], buttonTitle: [{
|
|
@@ -1135,22 +1154,29 @@ class MnDateSelectorBar {
|
|
|
1135
1154
|
/** Lucide icons the template renders. */
|
|
1136
1155
|
icons = ICONS;
|
|
1137
1156
|
/** The currently selected date, provided by the parent. */
|
|
1138
|
-
selectedDate = input(this.getToday(),
|
|
1157
|
+
selectedDate = input(this.getToday(), /* @ts-ignore */
|
|
1158
|
+
...(ngDevMode ? [{ debugName: "selectedDate" }] : /* istanbul ignore next */ []));
|
|
1139
1159
|
/** Label for the "Today" button. */
|
|
1140
|
-
todayLabel = input('Today',
|
|
1160
|
+
todayLabel = input('Today', /* @ts-ignore */
|
|
1161
|
+
...(ngDevMode ? [{ debugName: "todayLabel" }] : /* istanbul ignore next */ []));
|
|
1141
1162
|
/** Placeholder for the date picker shown in place of a too-cramped week strip. */
|
|
1142
|
-
pickDateLabel = input('Pick a date',
|
|
1163
|
+
pickDateLabel = input('Pick a date', /* @ts-ignore */
|
|
1164
|
+
...(ngDevMode ? [{ debugName: "pickDateLabel" }] : /* istanbul ignore next */ []));
|
|
1143
1165
|
/** Accessible name for the previous-week arrow. */
|
|
1144
|
-
previousLabel = input('Show the previous week',
|
|
1166
|
+
previousLabel = input('Show the previous week', /* @ts-ignore */
|
|
1167
|
+
...(ngDevMode ? [{ debugName: "previousLabel" }] : /* istanbul ignore next */ []));
|
|
1145
1168
|
/** Accessible name for the next-week arrow. */
|
|
1146
|
-
nextLabel = input('Show the next week',
|
|
1169
|
+
nextLabel = input('Show the next week', /* @ts-ignore */
|
|
1170
|
+
...(ngDevMode ? [{ debugName: "nextLabel" }] : /* istanbul ignore next */ []));
|
|
1147
1171
|
/** Accessible name for the day strip as a whole. */
|
|
1148
|
-
dayStripLabel = input('Select a day',
|
|
1172
|
+
dayStripLabel = input('Select a day', /* @ts-ignore */
|
|
1173
|
+
...(ngDevMode ? [{ debugName: "dayStripLabel" }] : /* istanbul ignore next */ []));
|
|
1149
1174
|
/**
|
|
1150
1175
|
* BCP 47 locale used to format day/month names. When empty, the active
|
|
1151
1176
|
* {@link MnLanguageService} locale is used.
|
|
1152
1177
|
*/
|
|
1153
|
-
locale = input('',
|
|
1178
|
+
locale = input('', /* @ts-ignore */
|
|
1179
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
1154
1180
|
/** Emits when the user selects a new date. */
|
|
1155
1181
|
dateSelected = output();
|
|
1156
1182
|
/** Unique id for this instance's date picker, so several bars can coexist. */
|
|
@@ -1159,15 +1185,20 @@ class MnDateSelectorBar {
|
|
|
1159
1185
|
injector = inject(Injector);
|
|
1160
1186
|
host = inject((ElementRef));
|
|
1161
1187
|
lang = inject(MnLanguageService);
|
|
1162
|
-
tileButtons = viewChildren('tileButton',
|
|
1188
|
+
tileButtons = viewChildren('tileButton', /* @ts-ignore */
|
|
1189
|
+
...(ngDevMode ? [{ debugName: "tileButtons" }] : /* istanbul ignore next */ []));
|
|
1163
1190
|
/** The bar's own width in px, tracked so the layout follows its container. */
|
|
1164
|
-
containerWidth = signal(0,
|
|
1191
|
+
containerWidth = signal(0, /* @ts-ignore */
|
|
1192
|
+
...(ngDevMode ? [{ debugName: "containerWidth" }] : /* istanbul ignore next */ []));
|
|
1165
1193
|
/** Bumped whenever the active language changes so name formatting re-runs. */
|
|
1166
|
-
localeTick = signal(0,
|
|
1194
|
+
localeTick = signal(0, /* @ts-ignore */
|
|
1195
|
+
...(ngDevMode ? [{ debugName: "localeTick" }] : /* istanbul ignore next */ []));
|
|
1167
1196
|
/** How the bar is arranged at the current width. */
|
|
1168
|
-
layout = computed(() => (this.containerWidth() || UNMEASURED_WIDTH) >= COMPACT_MAX_WIDTH ? 'inline' : 'compact',
|
|
1197
|
+
layout = computed(() => (this.containerWidth() || UNMEASURED_WIDTH) >= COMPACT_MAX_WIDTH ? 'inline' : 'compact', /* @ts-ignore */
|
|
1198
|
+
...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
|
|
1169
1199
|
/** Whether the day strip is shown, or the picker has taken its place. */
|
|
1170
|
-
showDayStrip = computed(() => this.layout() === 'inline',
|
|
1200
|
+
showDayStrip = computed(() => this.layout() === 'inline', /* @ts-ignore */
|
|
1201
|
+
...(ngDevMode ? [{ debugName: "showDayStrip" }] : /* istanbul ignore next */ []));
|
|
1171
1202
|
/**
|
|
1172
1203
|
* Days in the visible strip: a full week where there's room, fewer as the bar
|
|
1173
1204
|
* narrows. The bar drops days rather than adding a second row, so it stays one
|
|
@@ -1179,12 +1210,14 @@ class MnDateSelectorBar {
|
|
|
1179
1210
|
const width = this.containerWidth() || UNMEASURED_WIDTH;
|
|
1180
1211
|
const fits = Math.floor((width - RESERVED_WIDTH) / TILE_SLOT_WIDTH);
|
|
1181
1212
|
return Math.min(DAYS_IN_WEEK, Math.max(MIN_TILE_COUNT, fits));
|
|
1182
|
-
},
|
|
1213
|
+
}, /* @ts-ignore */
|
|
1214
|
+
...(ngDevMode ? [{ debugName: "tileCount" }] : /* istanbul ignore next */ []));
|
|
1183
1215
|
/** Effective locale: explicit input, else the active app locale. */
|
|
1184
1216
|
effectiveLocale = computed(() => {
|
|
1185
1217
|
this.localeTick();
|
|
1186
1218
|
return this.locale() || this.lang.locale;
|
|
1187
|
-
},
|
|
1219
|
+
}, /* @ts-ignore */
|
|
1220
|
+
...(ngDevMode ? [{ debugName: "effectiveLocale" }] : /* istanbul ignore next */ []));
|
|
1188
1221
|
/**
|
|
1189
1222
|
* First day of the visible strip — the week's Monday when a whole week is on
|
|
1190
1223
|
* show, otherwise whatever start keeps the selection in view.
|
|
@@ -1193,7 +1226,7 @@ class MnDateSelectorBar {
|
|
|
1193
1226
|
* outside it moves to where that day is. The arrows write here directly to page
|
|
1194
1227
|
* away from the selection.
|
|
1195
1228
|
*/
|
|
1196
|
-
windowStart = linkedSignal({ ...(ngDevMode ? { debugName: "windowStart" } : {}), source: () => ({ selected: this.selectedDate().getTime(), count: this.tileCount() }),
|
|
1229
|
+
windowStart = linkedSignal({ ...(ngDevMode ? { debugName: "windowStart" } : /* istanbul ignore next */ {}), source: () => ({ selected: this.selectedDate().getTime(), count: this.tileCount() }),
|
|
1197
1230
|
computation: (source, previous) => {
|
|
1198
1231
|
const selected = new Date(source.selected);
|
|
1199
1232
|
const { count } = source;
|
|
@@ -1217,7 +1250,7 @@ class MnDateSelectorBar {
|
|
|
1217
1250
|
* Tracks the selection so Tab lands on the selected day, falling back to Monday
|
|
1218
1251
|
* when the selection has been paged out of sight.
|
|
1219
1252
|
*/
|
|
1220
|
-
focusedIndex = linkedSignal({ ...(ngDevMode ? { debugName: "focusedIndex" } : {}), source: () => this.selectedDate().getTime(),
|
|
1253
|
+
focusedIndex = linkedSignal({ ...(ngDevMode ? { debugName: "focusedIndex" } : /* istanbul ignore next */ {}), source: () => this.selectedDate().getTime(),
|
|
1221
1254
|
computation: () => Math.max(0, this.indexOfSelected()) });
|
|
1222
1255
|
/** The visible days, derived from the window start and the current selection. */
|
|
1223
1256
|
dayTiles = computed(() => {
|
|
@@ -1256,7 +1289,8 @@ class MnDateSelectorBar {
|
|
|
1256
1289
|
previousYear = year;
|
|
1257
1290
|
}
|
|
1258
1291
|
return tiles;
|
|
1259
|
-
},
|
|
1292
|
+
}, /* @ts-ignore */
|
|
1293
|
+
...(ngDevMode ? [{ debugName: "dayTiles" }] : /* istanbul ignore next */ []));
|
|
1260
1294
|
/**
|
|
1261
1295
|
* The month the strip is currently in, spelled out for the header that titles
|
|
1262
1296
|
* the bar — so the days below are never just loose numbers. Reads as a range
|
|
@@ -1284,13 +1318,15 @@ class MnDateSelectorBar {
|
|
|
1284
1318
|
return `${from} – ${to}`;
|
|
1285
1319
|
}
|
|
1286
1320
|
return first.toLocaleDateString(locale, { month: 'long', year: 'numeric' });
|
|
1287
|
-
},
|
|
1321
|
+
}, /* @ts-ignore */
|
|
1322
|
+
...(ngDevMode ? [{ debugName: "monthCaption" }] : /* istanbul ignore next */ []));
|
|
1288
1323
|
/** The selected date formatted as YYYY-MM-DD for the date-picker input. */
|
|
1289
1324
|
selectedDateString = computed(() => {
|
|
1290
1325
|
const d = this.selectedDate();
|
|
1291
1326
|
const pad = (n) => n.toString().padStart(2, '0');
|
|
1292
1327
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
1293
|
-
},
|
|
1328
|
+
}, /* @ts-ignore */
|
|
1329
|
+
...(ngDevMode ? [{ debugName: "selectedDateString" }] : /* istanbul ignore next */ []));
|
|
1294
1330
|
/**
|
|
1295
1331
|
* Props for the compact-layout date picker. Sized to match the Today button it
|
|
1296
1332
|
* sits beside, and filling the rest of the row so it stays an easy tap target.
|
|
@@ -1303,7 +1339,8 @@ class MnDateSelectorBar {
|
|
|
1303
1339
|
borderRadius: 'lg',
|
|
1304
1340
|
hover: true,
|
|
1305
1341
|
fullWidth: true,
|
|
1306
|
-
}),
|
|
1342
|
+
}), /* @ts-ignore */
|
|
1343
|
+
...(ngDevMode ? [{ debugName: "pickerProps" }] : /* istanbul ignore next */ []));
|
|
1307
1344
|
ngOnInit() {
|
|
1308
1345
|
// Re-format names when the active language changes.
|
|
1309
1346
|
this.lang.locale$
|
|
@@ -1483,10 +1520,10 @@ class MnDateSelectorBar {
|
|
|
1483
1520
|
a.getMonth() === b.getMonth() &&
|
|
1484
1521
|
a.getDate() === b.getDate());
|
|
1485
1522
|
}
|
|
1486
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1487
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1523
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnDateSelectorBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1524
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnDateSelectorBar, isStandalone: true, selector: "mn-date-selector-bar", inputs: { selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: false, transformFunction: null }, todayLabel: { classPropertyName: "todayLabel", publicName: "todayLabel", isSignal: true, isRequired: false, transformFunction: null }, pickDateLabel: { classPropertyName: "pickDateLabel", publicName: "pickDateLabel", isSignal: true, isRequired: false, transformFunction: null }, previousLabel: { classPropertyName: "previousLabel", publicName: "previousLabel", isSignal: true, isRequired: false, transformFunction: null }, nextLabel: { classPropertyName: "nextLabel", publicName: "nextLabel", isSignal: true, isRequired: false, transformFunction: null }, dayStripLabel: { classPropertyName: "dayStripLabel", publicName: "dayStripLabel", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateSelected: "dateSelected" }, host: { classAttribute: "block" }, viewQueries: [{ propertyName: "tileButtons", predicate: ["tileButton"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- Date selector bar. Layout is driven by the bar's own measured width, so it\n rearranges for the space the bar was given, not for the viewport. The strip\n never stacks: as room runs out it shows fewer days, then hands over to the\n picker. Nothing here is boxed \u2014 spacing does the grouping, not borders. -->\n<div class=\"flex flex-col gap-2 px-4 py-3\">\n\n <!-- Month header. Titles the whole bar so the day numbers below are never loose:\n it names the month the strip is in (or, when compact, the month the\n selection sits in), reading as a range where the strip crosses a boundary.\n On its own line it has room to be spelled out, and no longer steals width\n from the days the way the old inline caption did. -->\n <div aria-hidden=\"true\"\n class=\"text-center text-sm font-semibold tracking-wide whitespace-nowrap opacity-80\">\n {{ monthCaption() }}\n </div>\n\n <!-- Controls row. Today and the strip travel together as one centred cluster, so\n Today sits right beside the days instead of stranded against the far edge;\n the gap between them matches the strip's own spacing. When the strip gives\n way to the picker, the picker fills the row and Today anchors its left. -->\n <div class=\"flex items-center justify-center gap-3\">\n\n <!-- Today: returns the strip and the selection to the current day. Outlined\n rather than filled, so the one filled-primary element on the bar is the\n selected day \u2014 Today shares the primary accent without competing with it. -->\n <button (click)=\"goToToday()\"\n [data]=\"{ variant: 'outline', color: 'primary', size: 'md' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n {{ todayLabel() }}\n </button>\n\n <!-- Too narrow for a usable strip, so the picker takes its place beside Today.\n Every date stays reachable on a phone, in one tap rather than by paging;\n the month header above keeps the compact bar labelled like the wide one. -->\n @if (!showDayStrip()) {\n <mn-lib-datetime (ngModelChange)=\"onDateModelChanged($event)\"\n [ngModel]=\"selectedDateString()\"\n [props]=\"pickerProps()\"\n class=\"block min-w-0 flex-1\"></mn-lib-datetime>\n }\n\n <!-- Arrows and days, sized to their own content so the row can centre them\n together with Today as a single cluster \u2014 rather than the days drifting to\n the middle of the leftover space, away from the button. -->\n @if (showDayStrip()) {\n <div [attr.aria-label]=\"dayStripLabel()\"\n class=\"flex min-w-0 items-center gap-3\"\n role=\"group\">\n <button (click)=\"navigatePrevious()\"\n [attr.aria-label]=\"previousLabel()\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n </button>\n\n <!-- Days read on one line so each sits at the same height as the buttons\n either side of it. Roving tabindex: one day is in the tab order, the\n arrow keys move between the rest and page the strip at either end. -->\n <div class=\"flex min-w-0 gap-1\">\n @for (tile of dayTiles(); track tile.date.getTime(); let i = $index) {\n <!-- Selected is the filled pill; today is called out by its number\n alone, tinted primary \u2014 no box, in keeping with a bar that groups\n by spacing rather than borders. When today is also the selected\n day the fill takes over, since there is nothing left to tell apart.\n A month break is marked by extra breathing room rather than a rule,\n so the run of days stays unbroken; the header names both months. -->\n <button #tileButton\n (click)=\"selectDate(tile.date)\"\n (focus)=\"onTileFocus(i)\"\n (keydown)=\"onTileKeydown($event, i)\"\n [attr.aria-current]=\"tile.isToday ? 'date' : null\"\n [attr.aria-label]=\"tile.accessibleLabel\"\n [attr.aria-pressed]=\"tile.isSelected\"\n [attr.tabindex]=\"isTabbable(i) ? 0 : -1\"\n [class.bg-primary]=\"tile.isSelected\"\n [class.hover:bg-base-200]=\"!tile.isSelected\"\n [class.ml-3]=\"tile.startsNewMonth\"\n [class.text-primary-content]=\"tile.isSelected\"\n class=\"flex min-w-16 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none\"\n type=\"button\">\n <span [class.opacity-60]=\"!tile.isSelected\"\n [class.opacity-90]=\"tile.isSelected\"\n aria-hidden=\"true\"\n class=\"text-xs font-medium uppercase\">\n {{ tile.dayName }}\n </span>\n <!-- Today's number carries the primary tint, unless the tile is\n filled \u2014 then it wears the fill's own text colour instead. -->\n <span [class.text-primary]=\"tile.isToday && !tile.isSelected\"\n aria-hidden=\"true\"\n class=\"font-bold tabular-nums\">{{ tile.dayNumber }}</span>\n </button>\n }\n </div>\n\n <button (click)=\"navigateNext()\"\n [attr.aria-label]=\"nextLabel()\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronRight\"></svg>\n </button>\n </div>\n }\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: MnButton, selector: "button[mnButton], a[mnButton]", inputs: ["data"] }, { kind: "component", type: MnDatetime, selector: "mn-lib-datetime", inputs: ["props"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1488
1525
|
}
|
|
1489
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1526
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnDateSelectorBar, decorators: [{
|
|
1490
1527
|
type: Component,
|
|
1491
1528
|
args: [{ selector: 'mn-date-selector-bar', standalone: true, imports: [
|
|
1492
1529
|
CommonModule,
|