@spartan-ng/brain 0.0.1-alpha.489 → 0.0.1-alpha.491
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/avatar/lib/brn-avatar.component.d.ts +2 -2
- package/calendar/lib/brn-calendar-cell-button.directive.d.ts +2 -2
- package/calendar/lib/brn-calendar-grid.directive.d.ts +1 -1
- package/calendar/lib/brn-calendar-next-button.directive.d.ts +1 -1
- package/calendar/lib/brn-calendar-previous-button.directive.d.ts +1 -1
- package/calendar/lib/brn-calendar-week.directive.d.ts +1 -1
- package/calendar/lib/brn-calendar-weekday.directive.d.ts +1 -1
- package/calendar/lib/brn-calendar.directive.d.ts +3 -3
- package/calendar/lib/mode/brn-calendar-multiple.directive.d.ts +3 -3
- package/checkbox/lib/brn-checkbox.component.d.ts +3 -3
- package/collapsible/lib/brn-collapsible-content.component.d.ts +3 -3
- package/collapsible/lib/brn-collapsible-trigger.directive.d.ts +1 -1
- package/command/lib/brn-command-group.directive.d.ts +1 -1
- package/command/lib/brn-command-item.directive.d.ts +1 -1
- package/dialog/lib/brn-dialog-description.directive.d.ts +1 -1
- package/dialog/lib/brn-dialog-title.directive.d.ts +1 -1
- package/dialog/lib/brn-dialog.component.d.ts +1 -1
- package/fesm2022/spartan-ng-brain-avatar.mjs +4 -4
- package/fesm2022/spartan-ng-brain-avatar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-calendar.mjs +80 -80
- package/fesm2022/spartan-ng-brain-calendar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-checkbox.mjs +30 -30
- package/fesm2022/spartan-ng-brain-checkbox.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-collapsible.mjs +22 -22
- package/fesm2022/spartan-ng-brain-collapsible.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-command.mjs +10 -9
- package/fesm2022/spartan-ng-brain-command.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-hover-card.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-input-otp.mjs +18 -18
- package/fesm2022/spartan-ng-brain-input-otp.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-menu.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-progress.mjs +8 -8
- package/fesm2022/spartan-ng-brain-progress.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-radio-group.mjs +33 -33
- package/fesm2022/spartan-ng-brain-radio-group.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-select.mjs +44 -43
- package/fesm2022/spartan-ng-brain-select.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-separator.mjs +5 -5
- package/fesm2022/spartan-ng-brain-separator.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-sheet.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-slider.mjs +34 -35
- package/fesm2022/spartan-ng-brain-slider.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-switch.mjs +28 -28
- package/fesm2022/spartan-ng-brain-switch.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-tabs.mjs +51 -50
- package/fesm2022/spartan-ng-brain-tabs.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle-group.mjs +13 -13
- package/fesm2022/spartan-ng-brain-toggle-group.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle.mjs +4 -4
- package/fesm2022/spartan-ng-brain-toggle.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-tooltip.mjs +31 -31
- package/fesm2022/spartan-ng-brain-tooltip.mjs.map +1 -1
- package/hover-card/lib/brn-hover-card-content.service.d.ts +5 -5
- package/input-otp/lib/brn-input-otp-slot.component.d.ts +2 -2
- package/input-otp/lib/brn-input-otp.component.d.ts +2 -2
- package/menu/lib/brn-context-menu-trigger.directive.d.ts +2 -2
- package/package.json +1 -1
- package/progress/lib/brn-progress-indicator.component.d.ts +1 -1
- package/progress/lib/brn-progress.component.d.ts +2 -2
- package/radio-group/lib/brn-radio-group.directive.d.ts +1 -1
- package/radio-group/lib/brn-radio.component.d.ts +6 -6
- package/select/lib/brn-select-content.component.d.ts +6 -6
- package/select/lib/brn-select-value.component.d.ts +4 -4
- package/select/lib/brn-select.component.d.ts +4 -4
- package/separator/lib/brn-separator.component.d.ts +2 -2
- package/sheet/lib/brn-sheet-trigger.directive.d.ts +1 -1
- package/slider/lib/brn-slider-range.directive.d.ts +1 -1
- package/slider/lib/brn-slider-thumb.directive.d.ts +2 -2
- package/slider/lib/brn-slider-track.directive.d.ts +1 -1
- package/slider/lib/brn-slider.directive.d.ts +3 -3
- package/switch/lib/brn-switch.component.d.ts +6 -5
- package/tabs/lib/brn-tabs-content.directive.d.ts +2 -2
- package/tabs/lib/brn-tabs-paginated-list.directive.d.ts +12 -12
- package/tabs/lib/brn-tabs-trigger.directive.d.ts +2 -2
- package/tabs/lib/brn-tabs.directive.d.ts +2 -2
- package/toggle/lib/brn-toggle.directive.d.ts +1 -1
- package/toggle-group/lib/brn-toggle-item.directive.d.ts +2 -2
- package/tooltip/lib/brn-tooltip-content.component.d.ts +5 -5
- package/tooltip/lib/brn-tooltip-trigger.directive.d.ts +5 -5
|
@@ -15,25 +15,25 @@ function injectBrnCalendar() {
|
|
|
15
15
|
|
|
16
16
|
class BrnCalendarCellButtonDirective {
|
|
17
17
|
/** Access the date adapter */
|
|
18
|
-
|
|
18
|
+
_dateAdapter = injectDateAdapter();
|
|
19
19
|
/** Access the calendar component */
|
|
20
|
-
|
|
20
|
+
_calendar = injectBrnCalendar();
|
|
21
21
|
/** Access the element ref */
|
|
22
22
|
_elementRef = inject(ElementRef);
|
|
23
23
|
/** The date this cell represents */
|
|
24
24
|
date = input.required();
|
|
25
25
|
/** Whether this date is currently selected */
|
|
26
|
-
selected = computed(() => this.
|
|
26
|
+
selected = computed(() => this._calendar.isSelected(this.date()));
|
|
27
27
|
/** Whether this date is focusable */
|
|
28
|
-
focusable = computed(() => this.
|
|
28
|
+
focusable = computed(() => this._dateAdapter.isSameDay(this._calendar.focusedDate(), this.date()));
|
|
29
29
|
outside = computed(() => {
|
|
30
|
-
const focusedDate = this.
|
|
31
|
-
return !this.
|
|
30
|
+
const focusedDate = this._calendar.focusedDate();
|
|
31
|
+
return !this._dateAdapter.isSameMonth(this.date(), focusedDate);
|
|
32
32
|
});
|
|
33
33
|
/** Whether this date is today */
|
|
34
|
-
today = computed(() => this.
|
|
34
|
+
today = computed(() => this._dateAdapter.isSameDay(this.date(), this._dateAdapter.now()));
|
|
35
35
|
/** Whether this date is disabled */
|
|
36
|
-
disabled = computed(() => this.
|
|
36
|
+
disabled = computed(() => this._calendar.isDateDisabled(this.date()) || this._calendar.disabled());
|
|
37
37
|
/**
|
|
38
38
|
* Focus the previous cell.
|
|
39
39
|
*/
|
|
@@ -41,10 +41,10 @@ class BrnCalendarCellButtonDirective {
|
|
|
41
41
|
event.preventDefault();
|
|
42
42
|
event.stopPropagation();
|
|
43
43
|
// in rtl, the arrow keys are reversed.
|
|
44
|
-
const targetDate = this.
|
|
44
|
+
const targetDate = this._dateAdapter.add(this._calendar.focusedDate(), {
|
|
45
45
|
days: this.getDirection() === 'rtl' ? 1 : -1,
|
|
46
46
|
});
|
|
47
|
-
this.
|
|
47
|
+
this._calendar.setFocusedDate(targetDate);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Focus the next cell.
|
|
@@ -52,10 +52,10 @@ class BrnCalendarCellButtonDirective {
|
|
|
52
52
|
focusNext(event) {
|
|
53
53
|
event.preventDefault();
|
|
54
54
|
event.stopPropagation();
|
|
55
|
-
const targetDate = this.
|
|
55
|
+
const targetDate = this._dateAdapter.add(this._calendar.focusedDate(), {
|
|
56
56
|
days: this.getDirection() === 'rtl' ? -1 : 1,
|
|
57
57
|
});
|
|
58
|
-
this.
|
|
58
|
+
this._calendar.setFocusedDate(targetDate);
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Focus the above cell.
|
|
@@ -63,7 +63,7 @@ class BrnCalendarCellButtonDirective {
|
|
|
63
63
|
focusAbove(event) {
|
|
64
64
|
event.preventDefault();
|
|
65
65
|
event.stopPropagation();
|
|
66
|
-
this.
|
|
66
|
+
this._calendar.setFocusedDate(this._dateAdapter.subtract(this._calendar.focusedDate(), { days: 7 }));
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Focus the below cell.
|
|
@@ -71,7 +71,7 @@ class BrnCalendarCellButtonDirective {
|
|
|
71
71
|
focusBelow(event) {
|
|
72
72
|
event.preventDefault();
|
|
73
73
|
event.stopPropagation();
|
|
74
|
-
this.
|
|
74
|
+
this._calendar.setFocusedDate(this._dateAdapter.add(this._calendar.focusedDate(), { days: 7 }));
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Focus the first date of the month.
|
|
@@ -79,7 +79,7 @@ class BrnCalendarCellButtonDirective {
|
|
|
79
79
|
focusFirst(event) {
|
|
80
80
|
event.preventDefault();
|
|
81
81
|
event.stopPropagation();
|
|
82
|
-
this.
|
|
82
|
+
this._calendar.setFocusedDate(this._dateAdapter.startOfMonth(this._calendar.focusedDate()));
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
* Focus the last date of the month.
|
|
@@ -87,7 +87,7 @@ class BrnCalendarCellButtonDirective {
|
|
|
87
87
|
focusLast(event) {
|
|
88
88
|
event.preventDefault();
|
|
89
89
|
event.stopPropagation();
|
|
90
|
-
this.
|
|
90
|
+
this._calendar.setFocusedDate(this._dateAdapter.endOfMonth(this._calendar.focusedDate()));
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* Focus the same date in the previous month.
|
|
@@ -95,16 +95,16 @@ class BrnCalendarCellButtonDirective {
|
|
|
95
95
|
focusPreviousMonth(event) {
|
|
96
96
|
event.preventDefault();
|
|
97
97
|
event.stopPropagation();
|
|
98
|
-
const date = this.
|
|
99
|
-
let previousMonthTarget = this.
|
|
100
|
-
previousMonthTarget = this.
|
|
101
|
-
const lastDay = this.
|
|
98
|
+
const date = this._dateAdapter.getDate(this._calendar.focusedDate());
|
|
99
|
+
let previousMonthTarget = this._dateAdapter.startOfMonth(this._calendar.focusedDate());
|
|
100
|
+
previousMonthTarget = this._dateAdapter.subtract(previousMonthTarget, { months: 1 });
|
|
101
|
+
const lastDay = this._dateAdapter.endOfMonth(previousMonthTarget);
|
|
102
102
|
// if we are on a date that does not exist in the previous month, we should focus the last day of the month.
|
|
103
|
-
if (date > this.
|
|
104
|
-
this.
|
|
103
|
+
if (date > this._dateAdapter.getDate(lastDay)) {
|
|
104
|
+
this._calendar.setFocusedDate(lastDay);
|
|
105
105
|
}
|
|
106
106
|
else {
|
|
107
|
-
this.
|
|
107
|
+
this._calendar.setFocusedDate(this._dateAdapter.set(previousMonthTarget, { day: date }));
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
@@ -113,16 +113,16 @@ class BrnCalendarCellButtonDirective {
|
|
|
113
113
|
focusNextMonth(event) {
|
|
114
114
|
event.preventDefault();
|
|
115
115
|
event.stopPropagation();
|
|
116
|
-
const date = this.
|
|
117
|
-
let nextMonthTarget = this.
|
|
118
|
-
nextMonthTarget = this.
|
|
119
|
-
const lastDay = this.
|
|
116
|
+
const date = this._dateAdapter.getDate(this._calendar.focusedDate());
|
|
117
|
+
let nextMonthTarget = this._dateAdapter.startOfMonth(this._calendar.focusedDate());
|
|
118
|
+
nextMonthTarget = this._dateAdapter.add(nextMonthTarget, { months: 1 });
|
|
119
|
+
const lastDay = this._dateAdapter.endOfMonth(nextMonthTarget);
|
|
120
120
|
// if we are on a date that does not exist in the next month, we should focus the last day of the month.
|
|
121
|
-
if (date > this.
|
|
122
|
-
this.
|
|
121
|
+
if (date > this._dateAdapter.getDate(lastDay)) {
|
|
122
|
+
this._calendar.setFocusedDate(lastDay);
|
|
123
123
|
}
|
|
124
124
|
else {
|
|
125
|
-
this.
|
|
125
|
+
this._calendar.setFocusedDate(this._dateAdapter.set(nextMonthTarget, { day: date }));
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
@@ -135,7 +135,7 @@ class BrnCalendarCellButtonDirective {
|
|
|
135
135
|
this._elementRef.nativeElement.focus();
|
|
136
136
|
}
|
|
137
137
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarCellButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
138
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCalendarCellButtonDirective, isStandalone: true, selector: "button[brnCalendarCellButton]", inputs: { date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "gridcell", "type": "button" }, listeners: { "click": "
|
|
138
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCalendarCellButtonDirective, isStandalone: true, selector: "button[brnCalendarCellButton]", inputs: { date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "gridcell", "type": "button" }, listeners: { "click": "_calendar.selectDate(date())", "keydown.arrowLeft": "focusPrevious($event)", "keydown.arrowRight": "focusNext($event)", "keydown.arrowUp": "focusAbove($event)", "keydown.arrowDown": "focusBelow($event)", "keydown.home": "focusFirst($event)", "keydown.end": "focusLast($event)", "keydown.pageUp": "focusPreviousMonth($event)", "keydown.pageDown": "focusNextMonth($event)" }, properties: { "tabindex": "focusable() ? 0 : -1", "attr.data-outside": "outside() ? '' : null", "attr.data-today": "today() && !selected() ? '' : null", "attr.data-selected": "selected() ? '' : null", "attr.data-disabled": "disabled() ? '' : null", "attr.aria-selected": "selected() ? 'true' : null", "attr.aria-disabled": "disabled() ? 'true' : null", "disabled": "disabled()" } }, ngImport: i0 });
|
|
139
139
|
}
|
|
140
140
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarCellButtonDirective, decorators: [{
|
|
141
141
|
type: Directive,
|
|
@@ -152,7 +152,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
152
152
|
'[attr.aria-selected]': "selected() ? 'true' : null",
|
|
153
153
|
'[attr.aria-disabled]': "disabled() ? 'true' : null",
|
|
154
154
|
'[disabled]': 'disabled()',
|
|
155
|
-
'(click)': '
|
|
155
|
+
'(click)': '_calendar.selectDate(date())',
|
|
156
156
|
'(keydown.arrowLeft)': 'focusPrevious($event)',
|
|
157
157
|
'(keydown.arrowRight)': 'focusNext($event)',
|
|
158
158
|
'(keydown.arrowUp)': 'focusAbove($event)',
|
|
@@ -181,9 +181,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
181
181
|
|
|
182
182
|
class BrnCalendarGridDirective {
|
|
183
183
|
/** Access the calendar component */
|
|
184
|
-
|
|
184
|
+
_calendar = injectBrnCalendar();
|
|
185
185
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarGridDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
186
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarGridDirective, isStandalone: true, selector: "[brnCalendarGrid]", host: { attributes: { "role": "grid" }, properties: { "attr.aria-labelledby": "
|
|
186
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarGridDirective, isStandalone: true, selector: "[brnCalendarGrid]", host: { attributes: { "role": "grid" }, properties: { "attr.aria-labelledby": "_calendar.header()?.id()" } }, ngImport: i0 });
|
|
187
187
|
}
|
|
188
188
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarGridDirective, decorators: [{
|
|
189
189
|
type: Directive,
|
|
@@ -191,7 +191,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
191
191
|
selector: '[brnCalendarGrid]',
|
|
192
192
|
host: {
|
|
193
193
|
role: 'grid',
|
|
194
|
-
'[attr.aria-labelledby]': '
|
|
194
|
+
'[attr.aria-labelledby]': '_calendar.header()?.id()',
|
|
195
195
|
},
|
|
196
196
|
}]
|
|
197
197
|
}] });
|
|
@@ -253,7 +253,7 @@ class BrnCalendarNextButtonDirective {
|
|
|
253
253
|
/** Access the date adapter */
|
|
254
254
|
_dateAdapter = injectDateAdapter();
|
|
255
255
|
/** Access the calendar i18n */
|
|
256
|
-
|
|
256
|
+
_i18n = injectBrnCalendarI18n();
|
|
257
257
|
/** Focus the previous month */
|
|
258
258
|
focusPreviousMonth() {
|
|
259
259
|
const targetDate = this._dateAdapter.add(this._calendar.state().focusedDate(), { months: 1 });
|
|
@@ -267,7 +267,7 @@ class BrnCalendarNextButtonDirective {
|
|
|
267
267
|
this._calendar.state().focusedDate.set(targetDate);
|
|
268
268
|
}
|
|
269
269
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarNextButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
270
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarNextButtonDirective, isStandalone: true, selector: "[brnCalendarNextButton]", host: { attributes: { "type": "button" }, listeners: { "click": "focusPreviousMonth()" }, properties: { "attr.aria-label": "
|
|
270
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarNextButtonDirective, isStandalone: true, selector: "[brnCalendarNextButton]", host: { attributes: { "type": "button" }, listeners: { "click": "focusPreviousMonth()" }, properties: { "attr.aria-label": "_i18n.labelNext()" } }, ngImport: i0 });
|
|
271
271
|
}
|
|
272
272
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarNextButtonDirective, decorators: [{
|
|
273
273
|
type: Directive,
|
|
@@ -275,7 +275,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
275
275
|
selector: '[brnCalendarNextButton]',
|
|
276
276
|
host: {
|
|
277
277
|
type: 'button',
|
|
278
|
-
'[attr.aria-label]': '
|
|
278
|
+
'[attr.aria-label]': '_i18n.labelNext()',
|
|
279
279
|
},
|
|
280
280
|
}]
|
|
281
281
|
}], propDecorators: { focusPreviousMonth: [{
|
|
@@ -289,7 +289,7 @@ class BrnCalendarPreviousButtonDirective {
|
|
|
289
289
|
/** Access the date adapter */
|
|
290
290
|
_dateAdapter = injectDateAdapter();
|
|
291
291
|
/** Access the calendar i18n */
|
|
292
|
-
|
|
292
|
+
_i18n = injectBrnCalendarI18n();
|
|
293
293
|
/** Focus the previous month */
|
|
294
294
|
focusPreviousMonth() {
|
|
295
295
|
const targetDate = this._dateAdapter.subtract(this._calendar.state().focusedDate(), { months: 1 });
|
|
@@ -303,7 +303,7 @@ class BrnCalendarPreviousButtonDirective {
|
|
|
303
303
|
this._calendar.state().focusedDate.set(targetDate);
|
|
304
304
|
}
|
|
305
305
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarPreviousButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
306
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarPreviousButtonDirective, isStandalone: true, selector: "[brnCalendarPreviousButton]", host: { attributes: { "type": "button" }, listeners: { "click": "focusPreviousMonth()" }, properties: { "attr.aria-label": "
|
|
306
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarPreviousButtonDirective, isStandalone: true, selector: "[brnCalendarPreviousButton]", host: { attributes: { "type": "button" }, listeners: { "click": "focusPreviousMonth()" }, properties: { "attr.aria-label": "_i18n.labelPrevious()" } }, ngImport: i0 });
|
|
307
307
|
}
|
|
308
308
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarPreviousButtonDirective, decorators: [{
|
|
309
309
|
type: Directive,
|
|
@@ -311,7 +311,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
311
311
|
selector: '[brnCalendarPreviousButton]',
|
|
312
312
|
host: {
|
|
313
313
|
type: 'button',
|
|
314
|
-
'[attr.aria-label]': '
|
|
314
|
+
'[attr.aria-label]': '_i18n.labelPrevious()',
|
|
315
315
|
},
|
|
316
316
|
}]
|
|
317
317
|
}], propDecorators: { focusPreviousMonth: [{
|
|
@@ -329,7 +329,7 @@ class BrnCalendarWeekDirective {
|
|
|
329
329
|
/** Access the template ref */
|
|
330
330
|
_templateRef = inject(TemplateRef);
|
|
331
331
|
// get the weeks to display.
|
|
332
|
-
|
|
332
|
+
_weeks = computed(() => {
|
|
333
333
|
const days = this._calendar.days();
|
|
334
334
|
const weeks = [];
|
|
335
335
|
for (let i = 0; i < days.length; i += 7) {
|
|
@@ -347,7 +347,7 @@ class BrnCalendarWeekDirective {
|
|
|
347
347
|
constructor() {
|
|
348
348
|
// this should use `afterRenderEffect` but it's not available in the current version
|
|
349
349
|
effect(() => {
|
|
350
|
-
const weeks = this.
|
|
350
|
+
const weeks = this._weeks();
|
|
351
351
|
untracked(() => this._renderWeeks(weeks));
|
|
352
352
|
});
|
|
353
353
|
}
|
|
@@ -394,7 +394,7 @@ class BrnCalendarWeekdayDirective {
|
|
|
394
394
|
/** Access the template ref */
|
|
395
395
|
_templateRef = inject(TemplateRef);
|
|
396
396
|
/** Get the days of the week to display in the header. */
|
|
397
|
-
|
|
397
|
+
_weekdays = computed(() => this._calendar.days().slice(0, 7));
|
|
398
398
|
/** Store the view refs */
|
|
399
399
|
_viewRefs = [];
|
|
400
400
|
// Make sure the template checker knows the type of the context with which the
|
|
@@ -406,7 +406,7 @@ class BrnCalendarWeekdayDirective {
|
|
|
406
406
|
// Create a new view for each day
|
|
407
407
|
effect(() => {
|
|
408
408
|
// Get the weekdays to display
|
|
409
|
-
const weekdays = this.
|
|
409
|
+
const weekdays = this._weekdays();
|
|
410
410
|
// Render the weekdays
|
|
411
411
|
untracked(() => this._renderWeekdays(weekdays));
|
|
412
412
|
});
|
|
@@ -444,7 +444,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
444
444
|
|
|
445
445
|
class BrnCalendarDirective {
|
|
446
446
|
/** Access the date adapter */
|
|
447
|
-
|
|
447
|
+
_dateAdapter = injectDateAdapter();
|
|
448
448
|
/** Access the change detector */
|
|
449
449
|
_changeDetector = inject(ChangeDetectorRef);
|
|
450
450
|
/** Access the injector */
|
|
@@ -470,7 +470,7 @@ class BrnCalendarDirective {
|
|
|
470
470
|
/** @internal Access the header */
|
|
471
471
|
header = contentChild(BrnCalendarHeaderDirective);
|
|
472
472
|
/** Store the cells */
|
|
473
|
-
|
|
473
|
+
_cells = contentChildren(BrnCalendarCellButtonDirective, {
|
|
474
474
|
descendants: true,
|
|
475
475
|
});
|
|
476
476
|
/**
|
|
@@ -478,7 +478,7 @@ class BrnCalendarDirective {
|
|
|
478
478
|
* The internal state of the component.
|
|
479
479
|
*/
|
|
480
480
|
state = computed(() => ({
|
|
481
|
-
focusedDate: signal(this.constrainDate(this.defaultFocusedDate() ?? this.date() ?? this.
|
|
481
|
+
focusedDate: signal(this.constrainDate(this.defaultFocusedDate() ?? this.date() ?? this._dateAdapter.now())),
|
|
482
482
|
}));
|
|
483
483
|
/**
|
|
484
484
|
* The focused date.
|
|
@@ -493,21 +493,21 @@ class BrnCalendarDirective {
|
|
|
493
493
|
const month = this.state().focusedDate();
|
|
494
494
|
const days = [];
|
|
495
495
|
// Get the first and last day of the month.
|
|
496
|
-
let firstDay = this.
|
|
497
|
-
let lastDay = this.
|
|
496
|
+
let firstDay = this._dateAdapter.startOfMonth(month);
|
|
497
|
+
let lastDay = this._dateAdapter.endOfMonth(month);
|
|
498
498
|
// we need to subtract until we get the to starting day before or on the start of the month.
|
|
499
|
-
while (this.
|
|
500
|
-
firstDay = this.
|
|
499
|
+
while (this._dateAdapter.getDay(firstDay) !== weekStartsOn) {
|
|
500
|
+
firstDay = this._dateAdapter.subtract(firstDay, { days: 1 });
|
|
501
501
|
}
|
|
502
502
|
const weekEndsOn = (weekStartsOn + 6) % 7;
|
|
503
503
|
// we need to add until we get to the ending day after or on the end of the month.
|
|
504
|
-
while (this.
|
|
505
|
-
lastDay = this.
|
|
504
|
+
while (this._dateAdapter.getDay(lastDay) !== weekEndsOn) {
|
|
505
|
+
lastDay = this._dateAdapter.add(lastDay, { days: 1 });
|
|
506
506
|
}
|
|
507
507
|
// collect all the days to display.
|
|
508
508
|
while (firstDay <= lastDay) {
|
|
509
509
|
days.push(firstDay);
|
|
510
|
-
firstDay = this.
|
|
510
|
+
firstDay = this._dateAdapter.add(firstDay, { days: 1 });
|
|
511
511
|
}
|
|
512
512
|
return days;
|
|
513
513
|
});
|
|
@@ -520,11 +520,11 @@ class BrnCalendarDirective {
|
|
|
520
520
|
return date;
|
|
521
521
|
}
|
|
522
522
|
// If there is a min and the date is before the min, return the min.
|
|
523
|
-
if (min && this.
|
|
523
|
+
if (min && this._dateAdapter.isBefore(date, this._dateAdapter.startOfDay(min))) {
|
|
524
524
|
return min;
|
|
525
525
|
}
|
|
526
526
|
// If there is a max and the date is after the max, return the max.
|
|
527
|
-
if (max && this.
|
|
527
|
+
if (max && this._dateAdapter.isAfter(date, this._dateAdapter.endOfDay(max))) {
|
|
528
528
|
return max;
|
|
529
529
|
}
|
|
530
530
|
// Return the date.
|
|
@@ -539,10 +539,10 @@ class BrnCalendarDirective {
|
|
|
539
539
|
// if the date is outside the min and max range
|
|
540
540
|
const min = this.min();
|
|
541
541
|
const max = this.max();
|
|
542
|
-
if (min && this.
|
|
542
|
+
if (min && this._dateAdapter.isBefore(date, this._dateAdapter.startOfDay(min))) {
|
|
543
543
|
return true;
|
|
544
544
|
}
|
|
545
|
-
if (max && this.
|
|
545
|
+
if (max && this._dateAdapter.isAfter(date, this._dateAdapter.endOfDay(max))) {
|
|
546
546
|
return true;
|
|
547
547
|
}
|
|
548
548
|
// if this specific date is disabled
|
|
@@ -554,7 +554,7 @@ class BrnCalendarDirective {
|
|
|
554
554
|
}
|
|
555
555
|
isSelected(date) {
|
|
556
556
|
const selected = this.date();
|
|
557
|
-
return selected !== undefined && this.
|
|
557
|
+
return selected !== undefined && this._dateAdapter.isSameDay(date, selected);
|
|
558
558
|
}
|
|
559
559
|
selectDate(date) {
|
|
560
560
|
if (this.isSelected(date)) {
|
|
@@ -576,7 +576,7 @@ class BrnCalendarDirective {
|
|
|
576
576
|
afterNextRender({
|
|
577
577
|
write: () => {
|
|
578
578
|
// focus the cell with the target date.
|
|
579
|
-
const cell = this.
|
|
579
|
+
const cell = this._cells().find((c) => this._dateAdapter.isSameDay(c.date(), date));
|
|
580
580
|
if (cell) {
|
|
581
581
|
cell.focus();
|
|
582
582
|
}
|
|
@@ -588,7 +588,7 @@ class BrnCalendarDirective {
|
|
|
588
588
|
this._changeDetector.detectChanges();
|
|
589
589
|
}
|
|
590
590
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
591
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnCalendarDirective, isStandalone: true, selector: "[brnCalendar]", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "dateDisabled", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { date: "dateChange" }, providers: [provideBrnCalendar(BrnCalendarDirective)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeaderDirective, descendants: true, isSignal: true }, { propertyName: "
|
|
591
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnCalendarDirective, isStandalone: true, selector: "[brnCalendar]", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "dateDisabled", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { date: "dateChange" }, providers: [provideBrnCalendar(BrnCalendarDirective)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeaderDirective, descendants: true, isSignal: true }, { propertyName: "_cells", predicate: BrnCalendarCellButtonDirective, descendants: true, isSignal: true }], ngImport: i0 });
|
|
592
592
|
}
|
|
593
593
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarDirective, decorators: [{
|
|
594
594
|
type: Directive,
|
|
@@ -600,7 +600,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
600
600
|
|
|
601
601
|
class BrnCalendarMultiDirective {
|
|
602
602
|
// /** Access the date adapter */
|
|
603
|
-
|
|
603
|
+
_dateAdapter = injectDateAdapter();
|
|
604
604
|
/** Access the change detector */
|
|
605
605
|
_changeDetector = inject(ChangeDetectorRef);
|
|
606
606
|
/** Access the injector */
|
|
@@ -634,7 +634,7 @@ class BrnCalendarMultiDirective {
|
|
|
634
634
|
/** @internal Access the header */
|
|
635
635
|
header = contentChild(BrnCalendarHeaderDirective);
|
|
636
636
|
/** Store the cells */
|
|
637
|
-
|
|
637
|
+
_cells = contentChildren(BrnCalendarCellButtonDirective, {
|
|
638
638
|
descendants: true,
|
|
639
639
|
});
|
|
640
640
|
/**
|
|
@@ -642,7 +642,7 @@ class BrnCalendarMultiDirective {
|
|
|
642
642
|
* The internal state of the component.
|
|
643
643
|
*/
|
|
644
644
|
state = computed(() => ({
|
|
645
|
-
focusedDate: signal(this.constrainDate(this.defaultFocusedDate() ?? this.
|
|
645
|
+
focusedDate: signal(this.constrainDate(this.defaultFocusedDate() ?? this._dateAdapter.now())),
|
|
646
646
|
}));
|
|
647
647
|
/**
|
|
648
648
|
* The focused date.
|
|
@@ -657,26 +657,26 @@ class BrnCalendarMultiDirective {
|
|
|
657
657
|
const month = this.state().focusedDate();
|
|
658
658
|
const days = [];
|
|
659
659
|
// Get the first and last day of the month.
|
|
660
|
-
let firstDay = this.
|
|
661
|
-
let lastDay = this.
|
|
660
|
+
let firstDay = this._dateAdapter.startOfMonth(month);
|
|
661
|
+
let lastDay = this._dateAdapter.endOfMonth(month);
|
|
662
662
|
// we need to subtract until we get the to starting day before or on the start of the month.
|
|
663
|
-
while (this.
|
|
664
|
-
firstDay = this.
|
|
663
|
+
while (this._dateAdapter.getDay(firstDay) !== weekStartsOn) {
|
|
664
|
+
firstDay = this._dateAdapter.subtract(firstDay, { days: 1 });
|
|
665
665
|
}
|
|
666
666
|
const weekEndsOn = (weekStartsOn + 6) % 7;
|
|
667
667
|
// we need to add until we get to the ending day after or on the end of the month.
|
|
668
|
-
while (this.
|
|
669
|
-
lastDay = this.
|
|
668
|
+
while (this._dateAdapter.getDay(lastDay) !== weekEndsOn) {
|
|
669
|
+
lastDay = this._dateAdapter.add(lastDay, { days: 1 });
|
|
670
670
|
}
|
|
671
671
|
// collect all the days to display.
|
|
672
672
|
while (firstDay <= lastDay) {
|
|
673
673
|
days.push(firstDay);
|
|
674
|
-
firstDay = this.
|
|
674
|
+
firstDay = this._dateAdapter.add(firstDay, { days: 1 });
|
|
675
675
|
}
|
|
676
676
|
return days;
|
|
677
677
|
});
|
|
678
678
|
isSelected(date) {
|
|
679
|
-
return this.date()?.some((d) => this.
|
|
679
|
+
return this.date()?.some((d) => this._dateAdapter.isSameDay(d, date)) ?? false;
|
|
680
680
|
}
|
|
681
681
|
selectDate(date) {
|
|
682
682
|
const selected = this.date();
|
|
@@ -686,7 +686,7 @@ class BrnCalendarMultiDirective {
|
|
|
686
686
|
// min selection reached, do not allow to deselect
|
|
687
687
|
return;
|
|
688
688
|
}
|
|
689
|
-
this.date.set(selected?.filter((d) => !this.
|
|
689
|
+
this.date.set(selected?.filter((d) => !this._dateAdapter.isSameDay(d, date)));
|
|
690
690
|
}
|
|
691
691
|
else {
|
|
692
692
|
const maxSelection = this.maxSelection();
|
|
@@ -710,11 +710,11 @@ class BrnCalendarMultiDirective {
|
|
|
710
710
|
return date;
|
|
711
711
|
}
|
|
712
712
|
// If there is a min and the date is before the min, return the min.
|
|
713
|
-
if (min && this.
|
|
713
|
+
if (min && this._dateAdapter.isBefore(date, this._dateAdapter.startOfDay(min))) {
|
|
714
714
|
return min;
|
|
715
715
|
}
|
|
716
716
|
// If there is a max and the date is after the max, return the max.
|
|
717
|
-
if (max && this.
|
|
717
|
+
if (max && this._dateAdapter.isAfter(date, this._dateAdapter.endOfDay(max))) {
|
|
718
718
|
return max;
|
|
719
719
|
}
|
|
720
720
|
// Return the date.
|
|
@@ -729,10 +729,10 @@ class BrnCalendarMultiDirective {
|
|
|
729
729
|
// if the date is outside the min and max range
|
|
730
730
|
const min = this.min();
|
|
731
731
|
const max = this.max();
|
|
732
|
-
if (min && this.
|
|
732
|
+
if (min && this._dateAdapter.isBefore(date, this._dateAdapter.startOfDay(min))) {
|
|
733
733
|
return true;
|
|
734
734
|
}
|
|
735
|
-
if (max && this.
|
|
735
|
+
if (max && this._dateAdapter.isAfter(date, this._dateAdapter.endOfDay(max))) {
|
|
736
736
|
return true;
|
|
737
737
|
}
|
|
738
738
|
// if this specific date is disabled
|
|
@@ -753,7 +753,7 @@ class BrnCalendarMultiDirective {
|
|
|
753
753
|
afterNextRender({
|
|
754
754
|
write: () => {
|
|
755
755
|
// focus the cell with the target date.
|
|
756
|
-
const cell = this.
|
|
756
|
+
const cell = this._cells().find((c) => this._dateAdapter.isSameDay(c.date(), date));
|
|
757
757
|
if (cell) {
|
|
758
758
|
cell.focus();
|
|
759
759
|
}
|
|
@@ -765,7 +765,7 @@ class BrnCalendarMultiDirective {
|
|
|
765
765
|
this._changeDetector.detectChanges();
|
|
766
766
|
}
|
|
767
767
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarMultiDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
768
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnCalendarMultiDirective, isStandalone: true, selector: "[brnCalendarMulti]", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, minSelection: { classPropertyName: "minSelection", publicName: "minSelection", isSignal: true, isRequired: false, transformFunction: null }, maxSelection: { classPropertyName: "maxSelection", publicName: "maxSelection", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "dateDisabled", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { date: "dateChange" }, providers: [provideBrnCalendar(BrnCalendarMultiDirective)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeaderDirective, descendants: true, isSignal: true }, { propertyName: "
|
|
768
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnCalendarMultiDirective, isStandalone: true, selector: "[brnCalendarMulti]", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, minSelection: { classPropertyName: "minSelection", publicName: "minSelection", isSignal: true, isRequired: false, transformFunction: null }, maxSelection: { classPropertyName: "maxSelection", publicName: "maxSelection", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "dateDisabled", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { date: "dateChange" }, providers: [provideBrnCalendar(BrnCalendarMultiDirective)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeaderDirective, descendants: true, isSignal: true }, { propertyName: "_cells", predicate: BrnCalendarCellButtonDirective, descendants: true, isSignal: true }], ngImport: i0 });
|
|
769
769
|
}
|
|
770
770
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarMultiDirective, decorators: [{
|
|
771
771
|
type: Directive,
|