@spartan-ng/brain 0.0.1-alpha.493 → 0.0.1-alpha.495
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/accordion/index.d.ts +8 -8
- package/accordion/lib/{brn-accordion-content.component.d.ts → brn-accordion-content.d.ts} +3 -3
- package/accordion/lib/{brn-accordion.directive.d.ts → brn-accordion.d.ts} +11 -11
- package/alert-dialog/index.d.ts +20 -20
- package/alert-dialog/lib/brn-alert-dialog-content.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-description.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-overlay.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-title.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-trigger.d.ts +9 -0
- package/alert-dialog/lib/brn-alert-dialog.d.ts +7 -0
- package/avatar/index.d.ts +9 -9
- package/avatar/lib/brn-avatar.d.ts +7 -0
- package/avatar/lib/fallback/brn-avatar-fallback.d.ts +9 -0
- package/avatar/lib/fallback/index.d.ts +1 -1
- package/avatar/lib/image/brn-avatar-image.d.ts +9 -0
- package/avatar/lib/image/index.d.ts +1 -1
- package/calendar/index.d.ts +32 -32
- package/calendar/lib/{brn-calendar-cell-button.directive.d.ts → brn-calendar-cell-button.d.ts} +4 -4
- package/calendar/lib/brn-calendar-cell.d.ts +5 -0
- package/calendar/lib/brn-calendar-grid.d.ts +7 -0
- package/calendar/lib/brn-calendar-header.d.ts +7 -0
- package/calendar/lib/{brn-calendar-next-button.directive.d.ts → brn-calendar-next-button.d.ts} +3 -3
- package/calendar/lib/{brn-calendar-previous-button.directive.d.ts → brn-calendar-previous-button.d.ts} +3 -3
- package/calendar/lib/{brn-calendar-week.directive.d.ts → brn-calendar-week.d.ts} +4 -4
- package/calendar/lib/{brn-calendar-weekday.directive.d.ts → brn-calendar-weekday.d.ts} +4 -4
- package/calendar/lib/{brn-calendar.directive.d.ts → brn-calendar.d.ts} +8 -8
- package/calendar/lib/brn-calendar.token.d.ts +6 -6
- package/calendar/lib/mode/{brn-calendar-multiple.directive.d.ts → brn-calendar-multiple.d.ts} +9 -9
- package/checkbox/index.d.ts +5 -5
- package/checkbox/lib/{brn-checkbox.component.d.ts → brn-checkbox.d.ts} +3 -3
- package/collapsible/index.d.ts +11 -11
- package/collapsible/lib/{brn-collapsible-content.component.d.ts → brn-collapsible-content.d.ts} +5 -5
- package/collapsible/lib/brn-collapsible-trigger.d.ts +9 -0
- package/collapsible/lib/{brn-collapsible.component.d.ts → brn-collapsible.d.ts} +3 -3
- package/command/index.d.ts +20 -20
- package/command/lib/brn-command-empty.d.ts +11 -0
- package/command/lib/{brn-command-group.directive.d.ts → brn-command-group.d.ts} +3 -3
- package/command/lib/{brn-command-item.directive.d.ts → brn-command-item.d.ts} +3 -3
- package/command/lib/brn-command-item.token.d.ts +3 -3
- package/command/lib/brn-command-list.d.ts +8 -0
- package/command/lib/{brn-command-search-input.directive.d.ts → brn-command-search-input.d.ts} +3 -3
- package/command/lib/brn-command-search-input.token.d.ts +3 -3
- package/command/lib/{brn-command.directive.d.ts → brn-command.d.ts} +5 -5
- package/command/lib/brn-command.token.d.ts +4 -4
- package/dialog/index.d.ts +23 -23
- package/dialog/lib/brn-dialog-close.d.ts +8 -0
- package/dialog/lib/brn-dialog-content.d.ts +12 -0
- package/dialog/lib/{brn-dialog-description.directive.d.ts → brn-dialog-description.d.ts} +3 -3
- package/dialog/lib/brn-dialog-overlay.d.ts +9 -0
- package/dialog/lib/brn-dialog-title.d.ts +8 -0
- package/dialog/lib/brn-dialog-trigger.d.ts +18 -0
- package/dialog/lib/{brn-dialog.component.d.ts → brn-dialog.d.ts} +3 -3
- package/fesm2022/spartan-ng-brain-accordion.mjs +25 -36
- package/fesm2022/spartan-ng-brain-accordion.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs +79 -79
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-avatar.mjs +16 -16
- package/fesm2022/spartan-ng-brain-avatar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-calendar.mjs +239 -239
- package/fesm2022/spartan-ng-brain-calendar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-checkbox.mjs +8 -8
- package/fesm2022/spartan-ng-brain-checkbox.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-collapsible.mjs +17 -25
- package/fesm2022/spartan-ng-brain-collapsible.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-command.mjs +195 -195
- package/fesm2022/spartan-ng-brain-command.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-dialog.mjs +98 -98
- package/fesm2022/spartan-ng-brain-dialog.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-form-field.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-forms.mjs +3 -2
- package/fesm2022/spartan-ng-brain-forms.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-hover-card.mjs +21 -29
- package/fesm2022/spartan-ng-brain-hover-card.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-input-otp.mjs +44 -44
- package/fesm2022/spartan-ng-brain-input-otp.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-label.mjs +8 -8
- package/fesm2022/spartan-ng-brain-label.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-menu.mjs +102 -131
- package/fesm2022/spartan-ng-brain-menu.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-popover.mjs +75 -86
- package/fesm2022/spartan-ng-brain-popover.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-progress.mjs +28 -28
- package/fesm2022/spartan-ng-brain-progress.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-radio-group.mjs +17 -17
- package/fesm2022/spartan-ng-brain-radio-group.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-select.mjs +277 -277
- package/fesm2022/spartan-ng-brain-select.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-separator.mjs +8 -8
- package/fesm2022/spartan-ng-brain-separator.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-sheet.mjs +69 -69
- package/fesm2022/spartan-ng-brain-sheet.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-slider.mjs +136 -142
- package/fesm2022/spartan-ng-brain-slider.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-switch.mjs +26 -26
- package/fesm2022/spartan-ng-brain-switch.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-tabs.mjs +28 -39
- package/fesm2022/spartan-ng-brain-tabs.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle-group.mjs +18 -18
- package/fesm2022/spartan-ng-brain-toggle-group.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle.mjs +9 -9
- package/fesm2022/spartan-ng-brain-toggle.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-tooltip.mjs +31 -42
- package/fesm2022/spartan-ng-brain-tooltip.mjs.map +1 -1
- package/form-field/lib/brn-form-field-control.d.ts +2 -2
- package/forms/lib/error-options.d.ts +1 -1
- package/hover-card/index.d.ts +6 -6
- package/hover-card/lib/brn-hover-card-content.service.d.ts +9 -9
- package/hover-card/lib/brn-hover-card.d.ts +9 -0
- package/input-otp/index.d.ts +8 -8
- package/input-otp/lib/{brn-input-otp-slot.component.d.ts → brn-input-otp-slot.d.ts} +4 -4
- package/input-otp/lib/{brn-input-otp.component.d.ts → brn-input-otp.d.ts} +3 -3
- package/input-otp/lib/brn-input-otp.token.d.ts +4 -4
- package/label/index.d.ts +3 -3
- package/label/lib/{brn-label.directive.d.ts → brn-label.d.ts} +3 -3
- package/menu/index.d.ts +32 -32
- package/menu/lib/{brn-context-menu-trigger.directive.d.ts → brn-context-menu-trigger.d.ts} +3 -3
- package/menu/lib/brn-menu-bar.d.ts +6 -0
- package/menu/lib/brn-menu-group.d.ts +6 -0
- package/menu/lib/brn-menu-item-checkbox.d.ts +11 -0
- package/menu/lib/brn-menu-item-radio.d.ts +11 -0
- package/menu/lib/brn-menu-item.d.ts +10 -0
- package/menu/lib/brn-menu-trigger.d.ts +10 -0
- package/menu/lib/{brn-menu.directive.d.ts → brn-menu.d.ts} +3 -3
- package/package.json +1 -1
- package/popover/index.d.ts +14 -14
- package/popover/lib/brn-popover-close.d.ts +6 -0
- package/popover/lib/brn-popover-content.d.ts +6 -0
- package/popover/lib/brn-popover-trigger.d.ts +10 -0
- package/popover/lib/brn-popover.d.ts +12 -0
- package/progress/index.d.ts +8 -8
- package/progress/lib/{brn-progress-indicator.component.d.ts → brn-progress-indicator.d.ts} +4 -4
- package/progress/lib/{brn-progress.component.d.ts → brn-progress.d.ts} +3 -3
- package/progress/lib/brn-progress.token.d.ts +3 -3
- package/radio-group/index.d.ts +8 -8
- package/radio-group/lib/{brn-radio-group.directive.d.ts → brn-radio-group.d.ts} +6 -6
- package/radio-group/lib/brn-radio-group.token.d.ts +3 -3
- package/radio-group/lib/{brn-radio.component.d.ts → brn-radio.d.ts} +6 -6
- package/select/index.d.ts +29 -29
- package/select/lib/{brn-select-content.component.d.ts → brn-select-content.d.ts} +15 -15
- package/select/lib/brn-select-content.token.d.ts +3 -3
- package/select/lib/brn-select-group.d.ts +6 -0
- package/select/lib/brn-select-label.d.ts +9 -0
- package/select/lib/{brn-select-option.directive.d.ts → brn-select-option.d.ts} +5 -5
- package/select/lib/{brn-select-placeholder.directive.d.ts → brn-select-placeholder.d.ts} +3 -3
- package/select/lib/{brn-select-trigger.directive.d.ts → brn-select-trigger.d.ts} +4 -4
- package/select/lib/brn-select-value-template.d.ts +11 -0
- package/select/lib/{brn-select-value.component.d.ts → brn-select-value.d.ts} +8 -8
- package/select/lib/{brn-select.component.d.ts → brn-select.d.ts} +12 -12
- package/select/lib/brn-select.token.d.ts +3 -3
- package/separator/index.d.ts +3 -3
- package/separator/lib/{brn-separator.component.d.ts → brn-separator.d.ts} +3 -3
- package/sheet/index.d.ts +23 -23
- package/sheet/lib/brn-sheet-close.d.ts +6 -0
- package/sheet/lib/brn-sheet-content.d.ts +8 -0
- package/sheet/lib/brn-sheet-description.d.ts +6 -0
- package/sheet/lib/brn-sheet-overlay.d.ts +6 -0
- package/sheet/lib/brn-sheet-title.d.ts +6 -0
- package/sheet/lib/brn-sheet-trigger.d.ts +9 -0
- package/sheet/lib/brn-sheet.d.ts +10 -0
- package/slider/index.d.ts +11 -11
- package/slider/lib/brn-slider-range.d.ts +7 -0
- package/slider/lib/{brn-slider-thumb.directive.d.ts → brn-slider-thumb.d.ts} +4 -4
- package/slider/lib/brn-slider-tick.d.ts +12 -0
- package/slider/lib/{brn-slider-track.directive.d.ts → brn-slider-track.d.ts} +4 -4
- package/slider/lib/brn-slider-track.token.d.ts +4 -4
- package/slider/lib/{brn-slider.directive.d.ts → brn-slider.d.ts} +5 -5
- package/slider/lib/brn-slider.token.d.ts +3 -3
- package/switch/index.d.ts +8 -8
- package/switch/lib/brn-switch-thumb.d.ts +5 -0
- package/switch/lib/{brn-switch.component.d.ts → brn-switch.d.ts} +3 -3
- package/tabs/index.d.ts +15 -15
- package/tabs/lib/{brn-tabs-content.directive.d.ts → brn-tabs-content.d.ts} +3 -3
- package/tabs/lib/{brn-tabs-list.directive.d.ts → brn-tabs-list.d.ts} +6 -6
- package/tabs/lib/{brn-tabs-paginated-list.directive.d.ts → brn-tabs-paginated-list.d.ts} +3 -3
- package/tabs/lib/{brn-tabs-trigger.directive.d.ts → brn-tabs-trigger.d.ts} +4 -4
- package/tabs/lib/{brn-tabs.directive.d.ts → brn-tabs.d.ts} +9 -9
- package/toggle/index.d.ts +3 -3
- package/toggle/lib/{brn-toggle.directive.d.ts → brn-toggle.d.ts} +3 -3
- package/toggle-group/index.d.ts +6 -6
- package/toggle-group/lib/{brn-toggle-group.component.d.ts → brn-toggle-group.d.ts} +8 -8
- package/toggle-group/lib/brn-toggle-group.token.d.ts +3 -3
- package/toggle-group/lib/{brn-toggle-item.directive.d.ts → brn-toggle-item.d.ts} +4 -4
- package/tooltip/index.d.ts +14 -14
- package/tooltip/lib/brn-tooltip-content-template.d.ts +8 -0
- package/tooltip/lib/{brn-tooltip-content.component.d.ts → brn-tooltip-content.d.ts} +3 -3
- package/tooltip/lib/{brn-tooltip-trigger.directive.d.ts → brn-tooltip-trigger.d.ts} +3 -3
- package/tooltip/lib/brn-tooltip.d.ts +7 -0
- package/tooltip/lib/brn-tooltip.token.d.ts +1 -1
- package/alert-dialog/lib/brn-alert-dialog-content.directive.d.ts +0 -6
- package/alert-dialog/lib/brn-alert-dialog-description.directive.d.ts +0 -6
- package/alert-dialog/lib/brn-alert-dialog-overlay.component.d.ts +0 -6
- package/alert-dialog/lib/brn-alert-dialog-title.directive.d.ts +0 -6
- package/alert-dialog/lib/brn-alert-dialog-trigger.directive.d.ts +0 -9
- package/alert-dialog/lib/brn-alert-dialog.component.d.ts +0 -7
- package/avatar/lib/brn-avatar.component.d.ts +0 -7
- package/avatar/lib/fallback/brn-avatar-fallback.directive.d.ts +0 -9
- package/avatar/lib/image/brn-avatar-image.directive.d.ts +0 -9
- package/calendar/lib/brn-calendar-cell.directive.d.ts +0 -5
- package/calendar/lib/brn-calendar-grid.directive.d.ts +0 -7
- package/calendar/lib/brn-calendar-header.directive.d.ts +0 -7
- package/collapsible/lib/brn-collapsible-trigger.directive.d.ts +0 -9
- package/command/lib/brn-command-empty.directive.d.ts +0 -11
- package/command/lib/brn-command-list.directive.d.ts +0 -8
- package/dialog/lib/brn-dialog-close.directive.d.ts +0 -8
- package/dialog/lib/brn-dialog-content.directive.d.ts +0 -12
- package/dialog/lib/brn-dialog-overlay.component.d.ts +0 -9
- package/dialog/lib/brn-dialog-title.directive.d.ts +0 -8
- package/dialog/lib/brn-dialog-trigger.directive.d.ts +0 -18
- package/hover-card/lib/brn-hover-card.component.d.ts +0 -9
- package/menu/lib/brn-menu-bar.directive.d.ts +0 -6
- package/menu/lib/brn-menu-group.directive.d.ts +0 -6
- package/menu/lib/brn-menu-item-checkbox.directive.d.ts +0 -11
- package/menu/lib/brn-menu-item-radio.directive.d.ts +0 -11
- package/menu/lib/brn-menu-item.directive.d.ts +0 -10
- package/menu/lib/brn-menu-trigger.directive.d.ts +0 -10
- package/popover/lib/brn-popover-close.directive.d.ts +0 -6
- package/popover/lib/brn-popover-content.directive.d.ts +0 -6
- package/popover/lib/brn-popover-trigger.directive.d.ts +0 -10
- package/popover/lib/brn-popover.component.d.ts +0 -12
- package/select/lib/brn-select-group.directive.d.ts +0 -6
- package/select/lib/brn-select-label.directive.d.ts +0 -9
- package/select/lib/brn-select-value.directive.d.ts +0 -11
- package/sheet/lib/brn-sheet-close.directive.d.ts +0 -6
- package/sheet/lib/brn-sheet-content.directive.d.ts +0 -8
- package/sheet/lib/brn-sheet-description.directive.d.ts +0 -6
- package/sheet/lib/brn-sheet-overlay.component.d.ts +0 -6
- package/sheet/lib/brn-sheet-title.directive.d.ts +0 -6
- package/sheet/lib/brn-sheet-trigger.directive.d.ts +0 -9
- package/sheet/lib/brn-sheet.component.d.ts +0 -10
- package/slider/lib/brn-slider-range.directive.d.ts +0 -7
- package/slider/lib/brn-slider-tick.directive.d.ts +0 -12
- package/switch/lib/brn-switch-thumb.component.d.ts +0 -5
- package/tooltip/lib/brn-tooltip-content.directive.d.ts +0 -8
- package/tooltip/lib/brn-tooltip.directive.d.ts +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, ElementRef, input, computed, Directive,
|
|
2
|
+
import { InjectionToken, inject, ElementRef, input, computed, Directive, ChangeDetectorRef, Injector, booleanAttribute, model, numberAttribute, contentChild, contentChildren, signal, afterNextRender, HostListener, ViewContainerRef, TemplateRef, effect, untracked, NgModule } from '@angular/core';
|
|
3
3
|
import { injectDateAdapter } from '@spartan-ng/brain/date-time';
|
|
4
4
|
|
|
5
5
|
const BrnCalendarToken = new InjectionToken('BrnCalendarToken');
|
|
@@ -13,7 +13,7 @@ function injectBrnCalendar() {
|
|
|
13
13
|
return inject(BrnCalendarToken);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
class
|
|
16
|
+
class BrnCalendarCellButton {
|
|
17
17
|
/** Access the date adapter */
|
|
18
18
|
_dateAdapter = injectDateAdapter();
|
|
19
19
|
/** Access the calendar component */
|
|
@@ -134,10 +134,10 @@ class BrnCalendarCellButtonDirective {
|
|
|
134
134
|
focus() {
|
|
135
135
|
this._elementRef.nativeElement.focus();
|
|
136
136
|
}
|
|
137
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
138
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type:
|
|
137
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarCellButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
138
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCalendarCellButton, 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
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarCellButton, decorators: [{
|
|
141
141
|
type: Directive,
|
|
142
142
|
args: [{
|
|
143
143
|
selector: 'button[brnCalendarCellButton]',
|
|
@@ -165,52 +165,208 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
165
165
|
}]
|
|
166
166
|
}] });
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
/**
|
|
168
|
+
let uniqueId = 0;
|
|
169
|
+
class BrnCalendarHeader {
|
|
170
|
+
/** The unique id for the header */
|
|
171
|
+
id = input(`brn-calendar-header-${uniqueId++}`);
|
|
172
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
173
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCalendarHeader, isStandalone: true, selector: "[brnCalendarHeader]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-live": "polite", "role": "presentation" }, properties: { "id": "id()" } }, ngImport: i0 });
|
|
171
174
|
}
|
|
172
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
175
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarHeader, decorators: [{
|
|
173
176
|
type: Directive,
|
|
174
177
|
args: [{
|
|
175
|
-
selector: '[
|
|
178
|
+
selector: '[brnCalendarHeader]',
|
|
176
179
|
host: {
|
|
180
|
+
'[id]': 'id()',
|
|
181
|
+
'aria-live': 'polite',
|
|
177
182
|
role: 'presentation',
|
|
178
183
|
},
|
|
179
184
|
}]
|
|
180
185
|
}] });
|
|
181
186
|
|
|
182
|
-
class
|
|
183
|
-
/** Access the
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
|
|
187
|
+
class BrnCalendar {
|
|
188
|
+
/** Access the date adapter */
|
|
189
|
+
_dateAdapter = injectDateAdapter();
|
|
190
|
+
/** Access the change detector */
|
|
191
|
+
_changeDetector = inject(ChangeDetectorRef);
|
|
192
|
+
/** Access the injector */
|
|
193
|
+
_injector = inject(Injector);
|
|
194
|
+
/** The minimum date that can be selected.*/
|
|
195
|
+
min = input();
|
|
196
|
+
/** The maximum date that can be selected. */
|
|
197
|
+
max = input();
|
|
198
|
+
/** Determine if the date picker is disabled. */
|
|
199
|
+
disabled = input(false, {
|
|
200
|
+
transform: booleanAttribute,
|
|
201
|
+
});
|
|
202
|
+
/** The selected value. */
|
|
203
|
+
date = model();
|
|
204
|
+
/** Whether a specific date is disabled. */
|
|
205
|
+
dateDisabled = input(() => false);
|
|
206
|
+
/** The day the week starts on */
|
|
207
|
+
weekStartsOn = input(0, {
|
|
208
|
+
transform: (v) => numberAttribute(v),
|
|
209
|
+
});
|
|
210
|
+
/** The default focused date. */
|
|
211
|
+
defaultFocusedDate = input();
|
|
212
|
+
/** @internal Access the header */
|
|
213
|
+
header = contentChild(BrnCalendarHeader);
|
|
214
|
+
/** Store the cells */
|
|
215
|
+
_cells = contentChildren(BrnCalendarCellButton, {
|
|
216
|
+
descendants: true,
|
|
217
|
+
});
|
|
218
|
+
/**
|
|
219
|
+
* @internal
|
|
220
|
+
* The internal state of the component.
|
|
221
|
+
*/
|
|
222
|
+
state = computed(() => ({
|
|
223
|
+
focusedDate: signal(this.constrainDate(this.defaultFocusedDate() ?? this.date() ?? this._dateAdapter.now())),
|
|
224
|
+
}));
|
|
225
|
+
/**
|
|
226
|
+
* The focused date.
|
|
227
|
+
*/
|
|
228
|
+
focusedDate = computed(() => this.state().focusedDate());
|
|
229
|
+
/**
|
|
230
|
+
* Get all the days to display, this is the days of the current month
|
|
231
|
+
* and the days of the previous and next month to fill the grid.
|
|
232
|
+
*/
|
|
233
|
+
days = computed(() => {
|
|
234
|
+
const weekStartsOn = this.weekStartsOn();
|
|
235
|
+
const month = this.state().focusedDate();
|
|
236
|
+
const days = [];
|
|
237
|
+
// Get the first and last day of the month.
|
|
238
|
+
let firstDay = this._dateAdapter.startOfMonth(month);
|
|
239
|
+
let lastDay = this._dateAdapter.endOfMonth(month);
|
|
240
|
+
// we need to subtract until we get the to starting day before or on the start of the month.
|
|
241
|
+
while (this._dateAdapter.getDay(firstDay) !== weekStartsOn) {
|
|
242
|
+
firstDay = this._dateAdapter.subtract(firstDay, { days: 1 });
|
|
243
|
+
}
|
|
244
|
+
const weekEndsOn = (weekStartsOn + 6) % 7;
|
|
245
|
+
// we need to add until we get to the ending day after or on the end of the month.
|
|
246
|
+
while (this._dateAdapter.getDay(lastDay) !== weekEndsOn) {
|
|
247
|
+
lastDay = this._dateAdapter.add(lastDay, { days: 1 });
|
|
248
|
+
}
|
|
249
|
+
// collect all the days to display.
|
|
250
|
+
while (firstDay <= lastDay) {
|
|
251
|
+
days.push(firstDay);
|
|
252
|
+
firstDay = this._dateAdapter.add(firstDay, { days: 1 });
|
|
253
|
+
}
|
|
254
|
+
return days;
|
|
255
|
+
});
|
|
256
|
+
/** @internal Constrain a date to the min and max boundaries */
|
|
257
|
+
constrainDate(date) {
|
|
258
|
+
const min = this.min();
|
|
259
|
+
const max = this.max();
|
|
260
|
+
// If there is no min or max, return the date.
|
|
261
|
+
if (!min && !max) {
|
|
262
|
+
return date;
|
|
263
|
+
}
|
|
264
|
+
// If there is a min and the date is before the min, return the min.
|
|
265
|
+
if (min && this._dateAdapter.isBefore(date, this._dateAdapter.startOfDay(min))) {
|
|
266
|
+
return min;
|
|
267
|
+
}
|
|
268
|
+
// If there is a max and the date is after the max, return the max.
|
|
269
|
+
if (max && this._dateAdapter.isAfter(date, this._dateAdapter.endOfDay(max))) {
|
|
270
|
+
return max;
|
|
271
|
+
}
|
|
272
|
+
// Return the date.
|
|
273
|
+
return date;
|
|
274
|
+
}
|
|
275
|
+
/** @internal Determine if a date is disabled */
|
|
276
|
+
isDateDisabled(date) {
|
|
277
|
+
// if the calendar is disabled we can't select this date
|
|
278
|
+
if (this.disabled()) {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
// if the date is outside the min and max range
|
|
282
|
+
const min = this.min();
|
|
283
|
+
const max = this.max();
|
|
284
|
+
if (min && this._dateAdapter.isBefore(date, this._dateAdapter.startOfDay(min))) {
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
if (max && this._dateAdapter.isAfter(date, this._dateAdapter.endOfDay(max))) {
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
// if this specific date is disabled
|
|
291
|
+
const disabledFn = this.dateDisabled();
|
|
292
|
+
if (disabledFn(date)) {
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
isSelected(date) {
|
|
298
|
+
const selected = this.date();
|
|
299
|
+
return selected !== undefined && this._dateAdapter.isSameDay(date, selected);
|
|
300
|
+
}
|
|
301
|
+
selectDate(date) {
|
|
302
|
+
if (this.isSelected(date)) {
|
|
303
|
+
this.date.set(undefined);
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
this.date.set(date);
|
|
307
|
+
}
|
|
308
|
+
this.state().focusedDate.set(date);
|
|
309
|
+
}
|
|
310
|
+
/** @internal Set the focused date */
|
|
311
|
+
setFocusedDate(date) {
|
|
312
|
+
// check if the date is disabled.
|
|
313
|
+
if (this.isDateDisabled(date)) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
this.state().focusedDate.set(date);
|
|
317
|
+
// wait until the cells have all updated
|
|
318
|
+
afterNextRender({
|
|
319
|
+
write: () => {
|
|
320
|
+
// focus the cell with the target date.
|
|
321
|
+
const cell = this._cells().find((c) => this._dateAdapter.isSameDay(c.date(), date));
|
|
322
|
+
if (cell) {
|
|
323
|
+
cell.focus();
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
}, {
|
|
327
|
+
injector: this._injector,
|
|
328
|
+
});
|
|
329
|
+
// we must update the view to ensure the focused cell is visible.
|
|
330
|
+
this._changeDetector.detectChanges();
|
|
331
|
+
}
|
|
332
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendar, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
333
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnCalendar, 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(BrnCalendar)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeader, descendants: true, isSignal: true }, { propertyName: "_cells", predicate: BrnCalendarCellButton, descendants: true, isSignal: true }], ngImport: i0 });
|
|
187
334
|
}
|
|
188
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
335
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendar, decorators: [{
|
|
189
336
|
type: Directive,
|
|
190
337
|
args: [{
|
|
191
|
-
selector: '[
|
|
338
|
+
selector: '[brnCalendar]',
|
|
339
|
+
providers: [provideBrnCalendar(BrnCalendar)],
|
|
340
|
+
}]
|
|
341
|
+
}] });
|
|
342
|
+
|
|
343
|
+
class BrnCalendarCell {
|
|
344
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarCell, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
345
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarCell, isStandalone: true, selector: "[brnCalendarCell]", host: { attributes: { "role": "presentation" } }, ngImport: i0 });
|
|
346
|
+
}
|
|
347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarCell, decorators: [{
|
|
348
|
+
type: Directive,
|
|
349
|
+
args: [{
|
|
350
|
+
selector: '[brnCalendarCell]',
|
|
192
351
|
host: {
|
|
193
|
-
role: '
|
|
194
|
-
'[attr.aria-labelledby]': '_calendar.header()?.id()',
|
|
352
|
+
role: 'presentation',
|
|
195
353
|
},
|
|
196
354
|
}]
|
|
197
355
|
}] });
|
|
198
356
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
/** @nocollapse */ static
|
|
204
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnCalendarHeaderDirective, isStandalone: true, selector: "[brnCalendarHeader]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-live": "polite", "role": "presentation" }, properties: { "id": "id()" } }, ngImport: i0 });
|
|
357
|
+
class BrnCalendarGrid {
|
|
358
|
+
/** Access the calendar component */
|
|
359
|
+
_calendar = injectBrnCalendar();
|
|
360
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarGrid, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
361
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarGrid, isStandalone: true, selector: "[brnCalendarGrid]", host: { attributes: { "role": "grid" }, properties: { "attr.aria-labelledby": "_calendar.header()?.id()" } }, ngImport: i0 });
|
|
205
362
|
}
|
|
206
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
363
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarGrid, decorators: [{
|
|
207
364
|
type: Directive,
|
|
208
365
|
args: [{
|
|
209
|
-
selector: '[
|
|
366
|
+
selector: '[brnCalendarGrid]',
|
|
210
367
|
host: {
|
|
211
|
-
|
|
212
|
-
'aria-
|
|
213
|
-
role: 'presentation',
|
|
368
|
+
role: 'grid',
|
|
369
|
+
'[attr.aria-labelledby]': '_calendar.header()?.id()',
|
|
214
370
|
},
|
|
215
371
|
}]
|
|
216
372
|
}] });
|
|
@@ -247,7 +403,7 @@ function injectBrnCalendarI18n() {
|
|
|
247
403
|
return inject(BrnCalendarI18nToken, { optional: true }) ?? defaultCalendarI18n;
|
|
248
404
|
}
|
|
249
405
|
|
|
250
|
-
class
|
|
406
|
+
class BrnCalendarNextButton {
|
|
251
407
|
/** Access the calendar */
|
|
252
408
|
_calendar = injectBrnCalendar();
|
|
253
409
|
/** Access the date adapter */
|
|
@@ -266,10 +422,10 @@ class BrnCalendarNextButtonDirective {
|
|
|
266
422
|
}
|
|
267
423
|
this._calendar.state().focusedDate.set(targetDate);
|
|
268
424
|
}
|
|
269
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
270
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type:
|
|
425
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarNextButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
426
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarNextButton, isStandalone: true, selector: "[brnCalendarNextButton]", host: { attributes: { "type": "button" }, listeners: { "click": "focusPreviousMonth()" }, properties: { "attr.aria-label": "_i18n.labelNext()" } }, ngImport: i0 });
|
|
271
427
|
}
|
|
272
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
428
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarNextButton, decorators: [{
|
|
273
429
|
type: Directive,
|
|
274
430
|
args: [{
|
|
275
431
|
selector: '[brnCalendarNextButton]',
|
|
@@ -283,7 +439,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
283
439
|
args: ['click']
|
|
284
440
|
}] } });
|
|
285
441
|
|
|
286
|
-
class
|
|
442
|
+
class BrnCalendarPreviousButton {
|
|
287
443
|
/** Access the calendar */
|
|
288
444
|
_calendar = injectBrnCalendar();
|
|
289
445
|
/** Access the date adapter */
|
|
@@ -302,10 +458,10 @@ class BrnCalendarPreviousButtonDirective {
|
|
|
302
458
|
}
|
|
303
459
|
this._calendar.state().focusedDate.set(targetDate);
|
|
304
460
|
}
|
|
305
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
306
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type:
|
|
461
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarPreviousButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
462
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarPreviousButton, isStandalone: true, selector: "[brnCalendarPreviousButton]", host: { attributes: { "type": "button" }, listeners: { "click": "focusPreviousMonth()" }, properties: { "attr.aria-label": "_i18n.labelPrevious()" } }, ngImport: i0 });
|
|
307
463
|
}
|
|
308
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
464
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarPreviousButton, decorators: [{
|
|
309
465
|
type: Directive,
|
|
310
466
|
args: [{
|
|
311
467
|
selector: '[brnCalendarPreviousButton]',
|
|
@@ -319,7 +475,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
319
475
|
args: ['click']
|
|
320
476
|
}] } });
|
|
321
477
|
|
|
322
|
-
class
|
|
478
|
+
class BrnCalendarWeek {
|
|
323
479
|
/** Access the calendar */
|
|
324
480
|
_calendar = injectBrnCalendar();
|
|
325
481
|
/** Access the view container ref */
|
|
@@ -372,17 +528,17 @@ class BrnCalendarWeekDirective {
|
|
|
372
528
|
viewRef.destroy();
|
|
373
529
|
}
|
|
374
530
|
}
|
|
375
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
376
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type:
|
|
531
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarWeek, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
532
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarWeek, isStandalone: true, selector: "[brnCalendarWeek]", ngImport: i0 });
|
|
377
533
|
}
|
|
378
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarWeek, decorators: [{
|
|
379
535
|
type: Directive,
|
|
380
536
|
args: [{
|
|
381
537
|
selector: '[brnCalendarWeek]',
|
|
382
538
|
}]
|
|
383
539
|
}], ctorParameters: () => [] });
|
|
384
540
|
|
|
385
|
-
class
|
|
541
|
+
class BrnCalendarWeekday {
|
|
386
542
|
/** Access the calendar */
|
|
387
543
|
_calendar = injectBrnCalendar();
|
|
388
544
|
/** Access the date time adapter */
|
|
@@ -432,173 +588,17 @@ class BrnCalendarWeekdayDirective {
|
|
|
432
588
|
viewRef.destroy();
|
|
433
589
|
}
|
|
434
590
|
}
|
|
435
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
436
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type:
|
|
591
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarWeekday, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
592
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarWeekday, isStandalone: true, selector: "[brnCalendarWeekday]", ngImport: i0 });
|
|
437
593
|
}
|
|
438
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
594
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarWeekday, decorators: [{
|
|
439
595
|
type: Directive,
|
|
440
596
|
args: [{
|
|
441
597
|
selector: '[brnCalendarWeekday]',
|
|
442
598
|
}]
|
|
443
599
|
}], ctorParameters: () => [] });
|
|
444
600
|
|
|
445
|
-
class
|
|
446
|
-
/** Access the date adapter */
|
|
447
|
-
_dateAdapter = injectDateAdapter();
|
|
448
|
-
/** Access the change detector */
|
|
449
|
-
_changeDetector = inject(ChangeDetectorRef);
|
|
450
|
-
/** Access the injector */
|
|
451
|
-
_injector = inject(Injector);
|
|
452
|
-
/** The minimum date that can be selected.*/
|
|
453
|
-
min = input();
|
|
454
|
-
/** The maximum date that can be selected. */
|
|
455
|
-
max = input();
|
|
456
|
-
/** Determine if the date picker is disabled. */
|
|
457
|
-
disabled = input(false, {
|
|
458
|
-
transform: booleanAttribute,
|
|
459
|
-
});
|
|
460
|
-
/** The selected value. */
|
|
461
|
-
date = model();
|
|
462
|
-
/** Whether a specific date is disabled. */
|
|
463
|
-
dateDisabled = input(() => false);
|
|
464
|
-
/** The day the week starts on */
|
|
465
|
-
weekStartsOn = input(0, {
|
|
466
|
-
transform: (v) => numberAttribute(v),
|
|
467
|
-
});
|
|
468
|
-
/** The default focused date. */
|
|
469
|
-
defaultFocusedDate = input();
|
|
470
|
-
/** @internal Access the header */
|
|
471
|
-
header = contentChild(BrnCalendarHeaderDirective);
|
|
472
|
-
/** Store the cells */
|
|
473
|
-
_cells = contentChildren(BrnCalendarCellButtonDirective, {
|
|
474
|
-
descendants: true,
|
|
475
|
-
});
|
|
476
|
-
/**
|
|
477
|
-
* @internal
|
|
478
|
-
* The internal state of the component.
|
|
479
|
-
*/
|
|
480
|
-
state = computed(() => ({
|
|
481
|
-
focusedDate: signal(this.constrainDate(this.defaultFocusedDate() ?? this.date() ?? this._dateAdapter.now())),
|
|
482
|
-
}));
|
|
483
|
-
/**
|
|
484
|
-
* The focused date.
|
|
485
|
-
*/
|
|
486
|
-
focusedDate = computed(() => this.state().focusedDate());
|
|
487
|
-
/**
|
|
488
|
-
* Get all the days to display, this is the days of the current month
|
|
489
|
-
* and the days of the previous and next month to fill the grid.
|
|
490
|
-
*/
|
|
491
|
-
days = computed(() => {
|
|
492
|
-
const weekStartsOn = this.weekStartsOn();
|
|
493
|
-
const month = this.state().focusedDate();
|
|
494
|
-
const days = [];
|
|
495
|
-
// Get the first and last day of the month.
|
|
496
|
-
let firstDay = this._dateAdapter.startOfMonth(month);
|
|
497
|
-
let lastDay = this._dateAdapter.endOfMonth(month);
|
|
498
|
-
// we need to subtract until we get the to starting day before or on the start of the month.
|
|
499
|
-
while (this._dateAdapter.getDay(firstDay) !== weekStartsOn) {
|
|
500
|
-
firstDay = this._dateAdapter.subtract(firstDay, { days: 1 });
|
|
501
|
-
}
|
|
502
|
-
const weekEndsOn = (weekStartsOn + 6) % 7;
|
|
503
|
-
// we need to add until we get to the ending day after or on the end of the month.
|
|
504
|
-
while (this._dateAdapter.getDay(lastDay) !== weekEndsOn) {
|
|
505
|
-
lastDay = this._dateAdapter.add(lastDay, { days: 1 });
|
|
506
|
-
}
|
|
507
|
-
// collect all the days to display.
|
|
508
|
-
while (firstDay <= lastDay) {
|
|
509
|
-
days.push(firstDay);
|
|
510
|
-
firstDay = this._dateAdapter.add(firstDay, { days: 1 });
|
|
511
|
-
}
|
|
512
|
-
return days;
|
|
513
|
-
});
|
|
514
|
-
/** @internal Constrain a date to the min and max boundaries */
|
|
515
|
-
constrainDate(date) {
|
|
516
|
-
const min = this.min();
|
|
517
|
-
const max = this.max();
|
|
518
|
-
// If there is no min or max, return the date.
|
|
519
|
-
if (!min && !max) {
|
|
520
|
-
return date;
|
|
521
|
-
}
|
|
522
|
-
// If there is a min and the date is before the min, return the min.
|
|
523
|
-
if (min && this._dateAdapter.isBefore(date, this._dateAdapter.startOfDay(min))) {
|
|
524
|
-
return min;
|
|
525
|
-
}
|
|
526
|
-
// If there is a max and the date is after the max, return the max.
|
|
527
|
-
if (max && this._dateAdapter.isAfter(date, this._dateAdapter.endOfDay(max))) {
|
|
528
|
-
return max;
|
|
529
|
-
}
|
|
530
|
-
// Return the date.
|
|
531
|
-
return date;
|
|
532
|
-
}
|
|
533
|
-
/** @internal Determine if a date is disabled */
|
|
534
|
-
isDateDisabled(date) {
|
|
535
|
-
// if the calendar is disabled we can't select this date
|
|
536
|
-
if (this.disabled()) {
|
|
537
|
-
return true;
|
|
538
|
-
}
|
|
539
|
-
// if the date is outside the min and max range
|
|
540
|
-
const min = this.min();
|
|
541
|
-
const max = this.max();
|
|
542
|
-
if (min && this._dateAdapter.isBefore(date, this._dateAdapter.startOfDay(min))) {
|
|
543
|
-
return true;
|
|
544
|
-
}
|
|
545
|
-
if (max && this._dateAdapter.isAfter(date, this._dateAdapter.endOfDay(max))) {
|
|
546
|
-
return true;
|
|
547
|
-
}
|
|
548
|
-
// if this specific date is disabled
|
|
549
|
-
const disabledFn = this.dateDisabled();
|
|
550
|
-
if (disabledFn(date)) {
|
|
551
|
-
return true;
|
|
552
|
-
}
|
|
553
|
-
return false;
|
|
554
|
-
}
|
|
555
|
-
isSelected(date) {
|
|
556
|
-
const selected = this.date();
|
|
557
|
-
return selected !== undefined && this._dateAdapter.isSameDay(date, selected);
|
|
558
|
-
}
|
|
559
|
-
selectDate(date) {
|
|
560
|
-
if (this.isSelected(date)) {
|
|
561
|
-
this.date.set(undefined);
|
|
562
|
-
}
|
|
563
|
-
else {
|
|
564
|
-
this.date.set(date);
|
|
565
|
-
}
|
|
566
|
-
this.state().focusedDate.set(date);
|
|
567
|
-
}
|
|
568
|
-
/** @internal Set the focused date */
|
|
569
|
-
setFocusedDate(date) {
|
|
570
|
-
// check if the date is disabled.
|
|
571
|
-
if (this.isDateDisabled(date)) {
|
|
572
|
-
return;
|
|
573
|
-
}
|
|
574
|
-
this.state().focusedDate.set(date);
|
|
575
|
-
// wait until the cells have all updated
|
|
576
|
-
afterNextRender({
|
|
577
|
-
write: () => {
|
|
578
|
-
// focus the cell with the target date.
|
|
579
|
-
const cell = this._cells().find((c) => this._dateAdapter.isSameDay(c.date(), date));
|
|
580
|
-
if (cell) {
|
|
581
|
-
cell.focus();
|
|
582
|
-
}
|
|
583
|
-
},
|
|
584
|
-
}, {
|
|
585
|
-
injector: this._injector,
|
|
586
|
-
});
|
|
587
|
-
// we must update the view to ensure the focused cell is visible.
|
|
588
|
-
this._changeDetector.detectChanges();
|
|
589
|
-
}
|
|
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: "_cells", predicate: BrnCalendarCellButtonDirective, descendants: true, isSignal: true }], ngImport: i0 });
|
|
592
|
-
}
|
|
593
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarDirective, decorators: [{
|
|
594
|
-
type: Directive,
|
|
595
|
-
args: [{
|
|
596
|
-
selector: '[brnCalendar]',
|
|
597
|
-
providers: [provideBrnCalendar(BrnCalendarDirective)],
|
|
598
|
-
}]
|
|
599
|
-
}] });
|
|
600
|
-
|
|
601
|
-
class BrnCalendarMultiDirective {
|
|
601
|
+
class BrnCalendarMulti {
|
|
602
602
|
// /** Access the date adapter */
|
|
603
603
|
_dateAdapter = injectDateAdapter();
|
|
604
604
|
/** Access the change detector */
|
|
@@ -632,9 +632,9 @@ class BrnCalendarMultiDirective {
|
|
|
632
632
|
/** The default focused date. */
|
|
633
633
|
defaultFocusedDate = input();
|
|
634
634
|
/** @internal Access the header */
|
|
635
|
-
header = contentChild(
|
|
635
|
+
header = contentChild(BrnCalendarHeader);
|
|
636
636
|
/** Store the cells */
|
|
637
|
-
_cells = contentChildren(
|
|
637
|
+
_cells = contentChildren(BrnCalendarCellButton, {
|
|
638
638
|
descendants: true,
|
|
639
639
|
});
|
|
640
640
|
/**
|
|
@@ -764,50 +764,50 @@ class BrnCalendarMultiDirective {
|
|
|
764
764
|
// we must update the view to ensure the focused cell is visible.
|
|
765
765
|
this._changeDetector.detectChanges();
|
|
766
766
|
}
|
|
767
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
768
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type:
|
|
767
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarMulti, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
768
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnCalendarMulti, 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(BrnCalendarMulti)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeader, descendants: true, isSignal: true }, { propertyName: "_cells", predicate: BrnCalendarCellButton, descendants: true, isSignal: true }], ngImport: i0 });
|
|
769
769
|
}
|
|
770
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type:
|
|
770
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarMulti, decorators: [{
|
|
771
771
|
type: Directive,
|
|
772
772
|
args: [{
|
|
773
773
|
selector: '[brnCalendarMulti]',
|
|
774
|
-
providers: [provideBrnCalendar(
|
|
774
|
+
providers: [provideBrnCalendar(BrnCalendarMulti)],
|
|
775
775
|
}]
|
|
776
776
|
}] });
|
|
777
777
|
|
|
778
778
|
const BrnCalendarImports = [
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
779
|
+
BrnCalendarCellButton,
|
|
780
|
+
BrnCalendarGrid,
|
|
781
|
+
BrnCalendarHeader,
|
|
782
|
+
BrnCalendarNextButton,
|
|
783
|
+
BrnCalendarPreviousButton,
|
|
784
|
+
BrnCalendarWeek,
|
|
785
|
+
BrnCalendarWeekday,
|
|
786
|
+
BrnCalendar,
|
|
787
|
+
BrnCalendarCell,
|
|
788
|
+
BrnCalendarMulti,
|
|
789
789
|
];
|
|
790
790
|
class BrnCalendarModule {
|
|
791
791
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
792
|
-
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarModule, imports: [
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
792
|
+
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarModule, imports: [BrnCalendarCellButton,
|
|
793
|
+
BrnCalendarGrid,
|
|
794
|
+
BrnCalendarHeader,
|
|
795
|
+
BrnCalendarNextButton,
|
|
796
|
+
BrnCalendarPreviousButton,
|
|
797
|
+
BrnCalendarWeek,
|
|
798
|
+
BrnCalendarWeekday,
|
|
799
|
+
BrnCalendar,
|
|
800
|
+
BrnCalendarCell,
|
|
801
|
+
BrnCalendarMulti], exports: [BrnCalendarCellButton,
|
|
802
|
+
BrnCalendarGrid,
|
|
803
|
+
BrnCalendarHeader,
|
|
804
|
+
BrnCalendarNextButton,
|
|
805
|
+
BrnCalendarPreviousButton,
|
|
806
|
+
BrnCalendarWeek,
|
|
807
|
+
BrnCalendarWeekday,
|
|
808
|
+
BrnCalendar,
|
|
809
|
+
BrnCalendarCell,
|
|
810
|
+
BrnCalendarMulti] });
|
|
811
811
|
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarModule });
|
|
812
812
|
}
|
|
813
813
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarModule, decorators: [{
|
|
@@ -822,5 +822,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
822
822
|
* Generated bundle index. Do not edit.
|
|
823
823
|
*/
|
|
824
824
|
|
|
825
|
-
export {
|
|
825
|
+
export { BrnCalendar, BrnCalendarCell, BrnCalendarCellButton, BrnCalendarGrid, BrnCalendarHeader, BrnCalendarI18nToken, BrnCalendarImports, BrnCalendarModule, BrnCalendarMulti, BrnCalendarNextButton, BrnCalendarPreviousButton, BrnCalendarToken, BrnCalendarWeek, BrnCalendarWeekday, injectBrnCalendar, injectBrnCalendarI18n, provideBrnCalendar, provideBrnCalendarI18n };
|
|
826
826
|
//# sourceMappingURL=spartan-ng-brain-calendar.mjs.map
|