@spartan-ng/brain 0.0.1-alpha.373 → 0.0.1-alpha.379
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/README.md +3 -0
- package/accordion/index.d.ts +13 -0
- package/accordion/lib/brn-accordion-content.component.d.ts +15 -0
- package/accordion/lib/brn-accordion.directive.d.ts +47 -0
- package/alert-dialog/README.md +3 -0
- package/alert-dialog/index.d.ts +25 -0
- package/alert-dialog/lib/brn-alert-dialog-content.directive.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-description.directive.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-overlay.component.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-title.directive.d.ts +6 -0
- package/alert-dialog/lib/brn-alert-dialog-trigger.directive.d.ts +8 -0
- package/alert-dialog/lib/brn-alert-dialog.component.d.ts +7 -0
- package/avatar/README.md +3 -0
- package/avatar/index.d.ts +17 -0
- package/avatar/lib/brn-avatar.component.d.ts +7 -0
- package/avatar/lib/fallback/brn-avatar-fallback.directive.d.ts +11 -0
- package/avatar/lib/fallback/index.d.ts +1 -0
- package/avatar/lib/image/brn-avatar-image.directive.d.ts +9 -0
- package/avatar/lib/image/index.d.ts +1 -0
- package/avatar/lib/util/hex-color-for.d.ts +1 -0
- package/avatar/lib/util/index.d.ts +3 -0
- package/avatar/lib/util/initials.pipe.d.ts +7 -0
- package/avatar/lib/util/is-bright.d.ts +1 -0
- package/calendar/README.md +3 -0
- package/calendar/index.d.ts +36 -0
- package/calendar/lib/brn-calendar-cell-button.directive.d.ts +59 -0
- package/calendar/lib/brn-calendar-cell.directive.d.ts +5 -0
- package/calendar/lib/brn-calendar-grid.directive.d.ts +7 -0
- package/calendar/lib/brn-calendar-header.directive.d.ts +7 -0
- package/calendar/lib/brn-calendar-next-button.directive.d.ts +13 -0
- package/calendar/lib/brn-calendar-previous-button.directive.d.ts +13 -0
- package/calendar/lib/brn-calendar-week.directive.d.ts +25 -0
- package/calendar/lib/brn-calendar-weekday.directive.d.ts +25 -0
- package/calendar/lib/brn-calendar.directive.d.ts +55 -0
- package/calendar/lib/brn-calendar.token.d.ts +8 -0
- package/calendar/lib/i18n/calendar-i18n.d.ts +17 -0
- package/checkbox/lib/brn-checkbox.component.d.ts +1 -1
- package/collapsible/README.md +3 -0
- package/collapsible/index.d.ts +16 -0
- package/collapsible/lib/brn-collapsible-content.component.d.ts +19 -0
- package/collapsible/lib/brn-collapsible-trigger.directive.d.ts +12 -0
- package/collapsible/lib/brn-collapsible.component.d.ts +11 -0
- package/command/README.md +3 -0
- package/command/index.d.ts +33 -0
- package/command/lib/brn-command-empty.directive.d.ts +6 -0
- package/command/lib/brn-command-group.component.d.ts +6 -0
- package/command/lib/brn-command-input.directive.d.ts +6 -0
- package/command/lib/brn-command-item.directive.d.ts +6 -0
- package/command/lib/brn-command-list.component.d.ts +6 -0
- package/command/lib/brn-command-loader.directive.d.ts +6 -0
- package/command/lib/brn-command-separator.component.d.ts +6 -0
- package/command/lib/brn-command.component.d.ts +6 -0
- package/date-time/README.md +3 -0
- package/date-time/index.d.ts +2 -0
- package/date-time/lib/date-adapter.d.ts +176 -0
- package/date-time/lib/native-date-adapter.d.ts +103 -0
- package/date-time-luxon/README.md +3 -0
- package/date-time-luxon/index.d.ts +1 -0
- package/date-time-luxon/lib/date-adapter.d.ts +29 -0
- package/dialog/README.md +3 -0
- package/dialog/index.d.ts +33 -0
- package/dialog/lib/brn-dialog-close.directive.d.ts +10 -0
- package/dialog/lib/brn-dialog-content.directive.d.ts +12 -0
- package/dialog/lib/brn-dialog-description.directive.d.ts +8 -0
- package/dialog/lib/brn-dialog-options.d.ts +26 -0
- package/dialog/lib/brn-dialog-overlay.component.d.ts +8 -0
- package/dialog/lib/brn-dialog-ref.d.ts +24 -0
- package/dialog/lib/brn-dialog-state.d.ts +1 -0
- package/dialog/lib/brn-dialog-title.directive.d.ts +8 -0
- package/dialog/lib/brn-dialog-trigger.directive.d.ts +16 -0
- package/dialog/lib/brn-dialog-utils.d.ts +1 -0
- package/dialog/lib/brn-dialog.component.d.ts +56 -0
- package/dialog/lib/brn-dialog.service.d.ts +22 -0
- package/esm2022/accordion/index.mjs +31 -0
- package/esm2022/accordion/lib/brn-accordion-content.component.mjs +50 -0
- package/esm2022/accordion/lib/brn-accordion.directive.mjs +180 -0
- package/esm2022/accordion/spartan-ng-brain-accordion.mjs +5 -0
- package/esm2022/alert-dialog/index.mjs +45 -0
- package/esm2022/alert-dialog/lib/brn-alert-dialog-content.directive.mjs +17 -0
- package/esm2022/alert-dialog/lib/brn-alert-dialog-description.directive.mjs +18 -0
- package/esm2022/alert-dialog/lib/brn-alert-dialog-overlay.component.mjs +20 -0
- package/esm2022/alert-dialog/lib/brn-alert-dialog-title.directive.mjs +18 -0
- package/esm2022/alert-dialog/lib/brn-alert-dialog-trigger.directive.mjs +27 -0
- package/esm2022/alert-dialog/lib/brn-alert-dialog.component.mjs +40 -0
- package/esm2022/alert-dialog/spartan-ng-brain-alert-dialog.mjs +5 -0
- package/esm2022/avatar/index.mjs +23 -0
- package/esm2022/avatar/lib/brn-avatar.component.mjs +31 -0
- package/esm2022/avatar/lib/fallback/brn-avatar-fallback.directive.mjs +21 -0
- package/esm2022/avatar/lib/fallback/index.mjs +2 -0
- package/esm2022/avatar/lib/image/brn-avatar-image.directive.mjs +29 -0
- package/esm2022/avatar/lib/image/index.mjs +2 -0
- package/esm2022/avatar/lib/util/hex-color-for.mjs +22 -0
- package/esm2022/avatar/lib/util/index.mjs +4 -0
- package/esm2022/avatar/lib/util/initials.pipe.mjs +27 -0
- package/esm2022/avatar/lib/util/is-bright.mjs +12 -0
- package/esm2022/avatar/spartan-ng-brain-avatar.mjs +5 -0
- package/esm2022/calendar/index.mjs +62 -0
- package/esm2022/calendar/lib/brn-calendar-cell-button.directive.mjs +160 -0
- package/esm2022/calendar/lib/brn-calendar-cell.directive.mjs +17 -0
- package/esm2022/calendar/lib/brn-calendar-grid.directive.mjs +21 -0
- package/esm2022/calendar/lib/brn-calendar-header.directive.mjs +22 -0
- package/esm2022/calendar/lib/brn-calendar-next-button.directive.mjs +42 -0
- package/esm2022/calendar/lib/brn-calendar-previous-button.directive.mjs +42 -0
- package/esm2022/calendar/lib/brn-calendar-week.directive.mjs +64 -0
- package/esm2022/calendar/lib/brn-calendar-weekday.directive.mjs +48 -0
- package/esm2022/calendar/lib/brn-calendar.directive.mjs +154 -0
- package/esm2022/calendar/lib/brn-calendar.token.mjs +12 -0
- package/esm2022/calendar/lib/i18n/calendar-i18n.mjs +33 -0
- package/esm2022/calendar/spartan-ng-brain-calendar.mjs +5 -0
- package/esm2022/checkbox/lib/brn-checkbox.component.mjs +1 -1
- package/esm2022/collapsible/index.mjs +30 -0
- package/esm2022/collapsible/lib/brn-collapsible-content.component.mjs +61 -0
- package/esm2022/collapsible/lib/brn-collapsible-trigger.directive.mjs +35 -0
- package/esm2022/collapsible/lib/brn-collapsible.component.mjs +33 -0
- package/esm2022/collapsible/spartan-ng-brain-collapsible.mjs +5 -0
- package/esm2022/command/index.mjs +64 -0
- package/esm2022/command/lib/brn-command-empty.directive.mjs +29 -0
- package/esm2022/command/lib/brn-command-group.component.mjs +45 -0
- package/esm2022/command/lib/brn-command-input.directive.mjs +29 -0
- package/esm2022/command/lib/brn-command-item.directive.mjs +36 -0
- package/esm2022/command/lib/brn-command-list.component.mjs +35 -0
- package/esm2022/command/lib/brn-command-loader.directive.mjs +29 -0
- package/esm2022/command/lib/brn-command-separator.component.mjs +30 -0
- package/esm2022/command/lib/brn-command.component.mjs +21 -0
- package/esm2022/command/spartan-ng-brain-command.mjs +5 -0
- package/esm2022/date-time/index.mjs +3 -0
- package/esm2022/date-time/lib/date-adapter.mjs +16 -0
- package/esm2022/date-time/lib/native-date-adapter.mjs +155 -0
- package/esm2022/date-time/spartan-ng-brain-date-time.mjs +5 -0
- package/esm2022/date-time-luxon/index.mjs +2 -0
- package/esm2022/date-time-luxon/lib/date-adapter.mjs +85 -0
- package/esm2022/date-time-luxon/spartan-ng-brain-date-time-luxon.mjs +5 -0
- package/esm2022/dialog/index.mjs +55 -0
- package/esm2022/dialog/lib/brn-dialog-close.directive.mjs +29 -0
- package/esm2022/dialog/lib/brn-dialog-content.directive.mjs +41 -0
- package/esm2022/dialog/lib/brn-dialog-description.directive.mjs +25 -0
- package/esm2022/dialog/lib/brn-dialog-options.mjs +19 -0
- package/esm2022/dialog/lib/brn-dialog-overlay.component.mjs +29 -0
- package/esm2022/dialog/lib/brn-dialog-ref.mjs +53 -0
- package/esm2022/dialog/lib/brn-dialog-state.mjs +2 -0
- package/esm2022/dialog/lib/brn-dialog-title.directive.mjs +25 -0
- package/esm2022/dialog/lib/brn-dialog-trigger.directive.mjs +39 -0
- package/esm2022/dialog/lib/brn-dialog-utils.mjs +12 -0
- package/esm2022/dialog/lib/brn-dialog.component.mjs +208 -0
- package/esm2022/dialog/lib/brn-dialog.service.mjs +127 -0
- package/esm2022/dialog/spartan-ng-brain-dialog.mjs +5 -0
- package/esm2022/form-field/index.mjs +2 -0
- package/esm2022/form-field/lib/brn-form-field-control.mjs +14 -0
- package/esm2022/form-field/spartan-ng-brain-form-field.mjs +5 -0
- package/esm2022/forms/index.mjs +4 -0
- package/esm2022/forms/lib/control-value-accessor.mjs +2 -0
- package/esm2022/forms/lib/error-options.mjs +26 -0
- package/esm2022/forms/lib/error-state-tracker.mjs +29 -0
- package/esm2022/forms/spartan-ng-brain-forms.mjs +5 -0
- package/esm2022/hover-card/index.mjs +29 -0
- package/esm2022/hover-card/lib/brn-hover-card-content.service.mjs +205 -0
- package/esm2022/hover-card/lib/brn-hover-card.component.mjs +34 -0
- package/esm2022/hover-card/lib/createHoverObservable.mjs +19 -0
- package/esm2022/hover-card/spartan-ng-brain-hover-card.mjs +5 -0
- package/esm2022/label/index.mjs +17 -0
- package/esm2022/label/lib/brn-label.directive.mjs +49 -0
- package/esm2022/label/spartan-ng-brain-label.mjs +5 -0
- package/esm2022/menu/index.mjs +100 -0
- package/esm2022/menu/lib/brn-context-menu-trigger.directive.mjs +40 -0
- package/esm2022/menu/lib/brn-menu-align.mjs +15 -0
- package/esm2022/menu/lib/brn-menu-bar.directive.mjs +17 -0
- package/esm2022/menu/lib/brn-menu-group.directive.mjs +17 -0
- package/esm2022/menu/lib/brn-menu-item-checkbox.directive.mjs +30 -0
- package/esm2022/menu/lib/brn-menu-item-radio.directive.mjs +30 -0
- package/esm2022/menu/lib/brn-menu-item.directive.mjs +27 -0
- package/esm2022/menu/lib/brn-menu-trigger.directive.mjs +36 -0
- package/esm2022/menu/lib/brn-menu.directive.mjs +50 -0
- package/esm2022/menu/spartan-ng-brain-menu.mjs +5 -0
- package/esm2022/popover/index.mjs +35 -0
- package/esm2022/popover/lib/brn-popover-close.directive.mjs +15 -0
- package/esm2022/popover/lib/brn-popover-content.directive.mjs +17 -0
- package/esm2022/popover/lib/brn-popover-trigger.directive.mjs +37 -0
- package/esm2022/popover/lib/brn-popover.component.mjs +81 -0
- package/esm2022/popover/spartan-ng-brain-popover.mjs +5 -0
- package/esm2022/progress/index.mjs +21 -0
- package/esm2022/progress/lib/brn-progress-indicator.component.mjs +22 -0
- package/esm2022/progress/lib/brn-progress.component.mjs +61 -0
- package/esm2022/progress/lib/brn-progress.token.mjs +9 -0
- package/esm2022/progress/spartan-ng-brain-progress.mjs +5 -0
- package/esm2022/radio-group/index.mjs +20 -0
- package/esm2022/radio-group/lib/brn-radio-group.component.mjs +90 -0
- package/esm2022/radio-group/lib/brn-radio-group.token.mjs +9 -0
- package/esm2022/radio-group/lib/brn-radio.component.mjs +185 -0
- package/esm2022/radio-group/spartan-ng-brain-radio-group.mjs +5 -0
- package/esm2022/select/index.mjs +56 -0
- package/esm2022/select/lib/brn-select-content.component.mjs +204 -0
- package/esm2022/select/lib/brn-select-group.directive.mjs +19 -0
- package/esm2022/select/lib/brn-select-label.directive.mjs +23 -0
- package/esm2022/select/lib/brn-select-option.directive.mjs +65 -0
- package/esm2022/select/lib/brn-select-value.component.mjs +46 -0
- package/esm2022/select/lib/brn-select.component.mjs +358 -0
- package/esm2022/select/lib/brn-select.service.mjs +197 -0
- package/esm2022/select/spartan-ng-brain-select.mjs +5 -0
- package/esm2022/separator/index.mjs +17 -0
- package/esm2022/separator/lib/brn-separator.component.mjs +24 -0
- package/esm2022/separator/spartan-ng-brain-separator.mjs +5 -0
- package/esm2022/sheet/index.mjs +50 -0
- package/esm2022/sheet/lib/brn-sheet-close.directive.mjs +15 -0
- package/esm2022/sheet/lib/brn-sheet-content.directive.mjs +25 -0
- package/esm2022/sheet/lib/brn-sheet-description.directive.mjs +18 -0
- package/esm2022/sheet/lib/brn-sheet-overlay.component.mjs +20 -0
- package/esm2022/sheet/lib/brn-sheet-title.directive.mjs +18 -0
- package/esm2022/sheet/lib/brn-sheet-trigger.directive.mjs +26 -0
- package/esm2022/sheet/lib/brn-sheet.component.mjs +55 -0
- package/esm2022/sheet/spartan-ng-brain-sheet.mjs +5 -0
- package/esm2022/slider/index.mjs +13 -0
- package/esm2022/slider/lib/brn-slider-thumb.directive.mjs +41 -0
- package/esm2022/slider/lib/brn-slider-tick-mark.directive.mjs +37 -0
- package/esm2022/slider/lib/brn-slider-track-active-fill.directive.mjs +29 -0
- package/esm2022/slider/lib/brn-slider-track.directive.mjs +290 -0
- package/esm2022/slider/spartan-ng-brain-slider.mjs +5 -0
- package/esm2022/switch/index.mjs +20 -0
- package/esm2022/switch/lib/brn-switch-thumb.component.mjs +16 -0
- package/esm2022/switch/lib/brn-switch.component.mjs +236 -0
- package/esm2022/switch/spartan-ng-brain-switch.mjs +5 -0
- package/esm2022/table/index.mjs +47 -0
- package/esm2022/table/lib/brn-cell-def.directive.mjs +22 -0
- package/esm2022/table/lib/brn-column-def.component.mjs +82 -0
- package/esm2022/table/lib/brn-column-manager.mjs +61 -0
- package/esm2022/table/lib/brn-footer-def.directive.mjs +22 -0
- package/esm2022/table/lib/brn-header-def.directive.mjs +22 -0
- package/esm2022/table/lib/brn-paginator.directive.mjs +109 -0
- package/esm2022/table/lib/brn-table.component.mjs +169 -0
- package/esm2022/table/spartan-ng-brain-table.mjs +5 -0
- package/esm2022/tabs/index.mjs +32 -0
- package/esm2022/tabs/lib/brn-tabs-list.directive.mjs +65 -0
- package/esm2022/tabs/lib/brn-tabs-paginated-list.directive.mjs +525 -0
- package/esm2022/tabs/lib/brn-tabs-trigger.directive.mjs +134 -0
- package/esm2022/tabs/spartan-ng-brain-tabs.mjs +5 -0
- package/esm2022/toggle/index.mjs +31 -0
- package/esm2022/toggle/lib/brn-toggle-group.component.mjs +159 -0
- package/esm2022/toggle/lib/brn-toggle-group.token.mjs +9 -0
- package/esm2022/toggle/lib/brn-toggle.directive.mjs +65 -0
- package/esm2022/toggle/spartan-ng-brain-toggle.mjs +5 -0
- package/esm2022/tooltip/index.mjs +35 -0
- package/esm2022/tooltip/lib/brn-tooltip-content.component.mjs +228 -0
- package/esm2022/tooltip/lib/brn-tooltip-content.directive.mjs +22 -0
- package/esm2022/tooltip/lib/brn-tooltip-trigger.directive.mjs +689 -0
- package/esm2022/tooltip/lib/brn-tooltip.directive.mjs +15 -0
- package/esm2022/tooltip/spartan-ng-brain-tooltip.mjs +5 -0
- package/fesm2022/spartan-ng-brain-accordion.mjs +259 -0
- package/fesm2022/spartan-ng-brain-accordion.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs +162 -0
- package/fesm2022/spartan-ng-brain-alert-dialog.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-avatar.mjs +156 -0
- package/fesm2022/spartan-ng-brain-avatar.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-calendar.mjs +629 -0
- package/fesm2022/spartan-ng-brain-calendar.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-checkbox.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-collapsible.mjs +152 -0
- package/fesm2022/spartan-ng-brain-collapsible.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-command.mjs +284 -0
- package/fesm2022/spartan-ng-brain-command.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-date-time-luxon.mjs +92 -0
- package/fesm2022/spartan-ng-brain-date-time-luxon.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-date-time.mjs +177 -0
- package/fesm2022/spartan-ng-brain-date-time.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-dialog.mjs +617 -0
- package/fesm2022/spartan-ng-brain-dialog.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-form-field.mjs +21 -0
- package/fesm2022/spartan-ng-brain-form-field.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-forms.mjs +61 -0
- package/fesm2022/spartan-ng-brain-forms.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-hover-card.mjs +274 -0
- package/fesm2022/spartan-ng-brain-hover-card.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-label.mjs +69 -0
- package/fesm2022/spartan-ng-brain-label.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-menu.mjs +316 -0
- package/fesm2022/spartan-ng-brain-menu.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-popover.mjs +173 -0
- package/fesm2022/spartan-ng-brain-popover.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-progress.mjs +108 -0
- package/fesm2022/spartan-ng-brain-progress.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-radio-group.mjs +299 -0
- package/fesm2022/spartan-ng-brain-radio-group.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-select.mjs +928 -0
- package/fesm2022/spartan-ng-brain-select.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-separator.mjs +44 -0
- package/fesm2022/spartan-ng-brain-separator.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-sheet.mjs +197 -0
- package/fesm2022/spartan-ng-brain-sheet.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-slider.mjs +399 -0
- package/fesm2022/spartan-ng-brain-slider.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-switch.mjs +271 -0
- package/fesm2022/spartan-ng-brain-switch.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-table.mjs +506 -0
- package/fesm2022/spartan-ng-brain-table.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-tabs.mjs +748 -0
- package/fesm2022/spartan-ng-brain-tabs.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-toggle.mjs +260 -0
- package/fesm2022/spartan-ng-brain-toggle.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-tooltip.mjs +975 -0
- package/fesm2022/spartan-ng-brain-tooltip.mjs.map +1 -0
- package/form-field/README.md +3 -0
- package/form-field/index.d.ts +1 -0
- package/form-field/lib/brn-form-field-control.d.ts +11 -0
- package/forms/README.md +3 -0
- package/forms/index.d.ts +3 -0
- package/forms/lib/control-value-accessor.d.ts +2 -0
- package/forms/lib/error-options.d.ts +14 -0
- package/forms/lib/error-state-tracker.d.ts +15 -0
- package/hover-card/README.md +3 -0
- package/hover-card/index.d.ts +14 -0
- package/hover-card/lib/brn-hover-card-content.service.d.ts +65 -0
- package/hover-card/lib/brn-hover-card.component.d.ts +9 -0
- package/hover-card/lib/createHoverObservable.d.ts +4 -0
- package/label/README.md +3 -0
- package/label/index.d.ts +8 -0
- package/label/lib/brn-label.directive.d.ts +15 -0
- package/menu/README.md +3 -0
- package/menu/index.d.ts +49 -0
- package/menu/lib/brn-context-menu-trigger.directive.d.ts +13 -0
- package/menu/lib/brn-menu-align.d.ts +3 -0
- package/menu/lib/brn-menu-bar.directive.d.ts +6 -0
- package/menu/lib/brn-menu-group.directive.d.ts +6 -0
- package/menu/lib/brn-menu-item-checkbox.directive.d.ts +11 -0
- package/menu/lib/brn-menu-item-radio.directive.d.ts +11 -0
- package/menu/lib/brn-menu-item.directive.d.ts +10 -0
- package/menu/lib/brn-menu-trigger.directive.d.ts +10 -0
- package/menu/lib/brn-menu.directive.d.ts +11 -0
- package/package.json +182 -9
- package/popover/README.md +3 -0
- package/popover/index.d.ts +19 -0
- package/popover/lib/brn-popover-close.directive.d.ts +6 -0
- package/popover/lib/brn-popover-content.directive.d.ts +6 -0
- package/popover/lib/brn-popover-trigger.directive.d.ts +10 -0
- package/popover/lib/brn-popover.component.d.ts +14 -0
- package/progress/README.md +3 -0
- package/progress/index.d.ts +14 -0
- package/progress/lib/brn-progress-indicator.component.d.ts +6 -0
- package/progress/lib/brn-progress.component.d.ts +15 -0
- package/progress/lib/brn-progress.token.d.ts +4 -0
- package/radio-group/README.md +3 -0
- package/radio-group/index.d.ts +13 -0
- package/radio-group/lib/brn-radio-group.component.d.ts +57 -0
- package/radio-group/lib/brn-radio-group.token.d.ts +4 -0
- package/radio-group/lib/brn-radio.component.d.ts +58 -0
- package/select/README.md +3 -0
- package/select/index.d.ts +28 -0
- package/select/lib/brn-select-content.component.d.ts +50 -0
- package/select/lib/brn-select-group.directive.d.ts +6 -0
- package/select/lib/brn-select-label.directive.d.ts +9 -0
- package/select/lib/brn-select-option.directive.d.ts +25 -0
- package/select/lib/brn-select-value.component.d.ts +11 -0
- package/select/lib/brn-select.component.d.ts +82 -0
- package/select/lib/brn-select.service.d.ts +67 -0
- package/separator/README.md +3 -0
- package/separator/index.d.ts +8 -0
- package/separator/lib/brn-separator.component.d.ts +11 -0
- package/sheet/README.md +3 -0
- package/sheet/index.d.ts +28 -0
- package/sheet/lib/brn-sheet-close.directive.d.ts +6 -0
- package/sheet/lib/brn-sheet-content.directive.d.ts +8 -0
- package/sheet/lib/brn-sheet-description.directive.d.ts +6 -0
- package/sheet/lib/brn-sheet-overlay.component.d.ts +6 -0
- package/sheet/lib/brn-sheet-title.directive.d.ts +6 -0
- package/sheet/lib/brn-sheet-trigger.directive.d.ts +9 -0
- package/sheet/lib/brn-sheet.component.d.ts +9 -0
- package/slider/README.md +3 -0
- package/slider/index.d.ts +7 -0
- package/slider/lib/brn-slider-thumb.directive.d.ts +17 -0
- package/slider/lib/brn-slider-tick-mark.directive.d.ts +15 -0
- package/slider/lib/brn-slider-track-active-fill.directive.d.ts +10 -0
- package/slider/lib/brn-slider-track.directive.d.ts +139 -0
- package/switch/README.md +3 -0
- package/switch/index.d.ts +13 -0
- package/switch/lib/brn-switch-thumb.component.d.ts +5 -0
- package/switch/lib/brn-switch.component.d.ts +58 -0
- package/table/README.md +3 -0
- package/table/index.d.ts +26 -0
- package/table/lib/brn-cell-def.directive.d.ts +9 -0
- package/table/lib/brn-column-def.component.d.ts +18 -0
- package/table/lib/brn-column-manager.d.ts +26 -0
- package/table/lib/brn-footer-def.directive.d.ts +9 -0
- package/table/lib/brn-header-def.directive.d.ts +9 -0
- package/table/lib/brn-paginator.directive.d.ts +41 -0
- package/table/lib/brn-table.component.d.ts +37 -0
- package/tabs/README.md +3 -0
- package/tabs/index.d.ts +14 -0
- package/tabs/lib/brn-tabs-list.directive.d.ts +17 -0
- package/tabs/lib/brn-tabs-paginated-list.directive.d.ts +196 -0
- package/tabs/lib/brn-tabs-trigger.directive.d.ts +61 -0
- package/toggle/README.md +3 -0
- package/toggle/index.d.ts +15 -0
- package/toggle/lib/brn-toggle-group.component.d.ts +68 -0
- package/toggle/lib/brn-toggle-group.token.d.ts +4 -0
- package/toggle/lib/brn-toggle.directive.d.ts +25 -0
- package/tooltip/README.md +3 -0
- package/tooltip/index.d.ts +19 -0
- package/tooltip/lib/brn-tooltip-content.component.d.ts +73 -0
- package/tooltip/lib/brn-tooltip-content.directive.d.ts +8 -0
- package/tooltip/lib/brn-tooltip-trigger.directive.d.ts +177 -0
- package/tooltip/lib/brn-tooltip.directive.d.ts +7 -0
|
@@ -0,0 +1,928 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, PLATFORM_ID, computed, Directive, signal, Injectable, effect, input, booleanAttribute, DestroyRef, viewChild, contentChild, contentChildren, Component, ChangeDetectionStrategy, ChangeDetectorRef, output, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/cdk/listbox';
|
|
4
|
+
import { CdkOption, CdkListbox, CdkListboxModule } from '@angular/cdk/listbox';
|
|
5
|
+
import { isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
|
|
6
|
+
import { toObservable, takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
7
|
+
import { NgControl, NgForm, FormGroupDirective } from '@angular/forms';
|
|
8
|
+
import { Subject, skip, fromEvent, interval, takeUntil, map, switchMap, of, delay, combineLatest } from 'rxjs';
|
|
9
|
+
import * as i1$1 from '@spartan-ng/brain/label';
|
|
10
|
+
import { BrnLabelDirective } from '@spartan-ng/brain/label';
|
|
11
|
+
import * as i1$2 from '@angular/cdk/overlay';
|
|
12
|
+
import { CdkConnectedOverlay, OverlayModule } from '@angular/cdk/overlay';
|
|
13
|
+
import { BrnFormFieldControl } from '@spartan-ng/brain/form-field';
|
|
14
|
+
import { ErrorStateMatcher, ErrorStateTracker } from '@spartan-ng/brain/forms';
|
|
15
|
+
import { provideExposedSideProviderExisting, provideExposesStateProviderExisting } from '@spartan-ng/ui-core';
|
|
16
|
+
|
|
17
|
+
class BrnSelectTriggerDirective {
|
|
18
|
+
_el = inject(ElementRef);
|
|
19
|
+
_selectService = inject(BrnSelectService);
|
|
20
|
+
_ngControl = inject(NgControl, { optional: true });
|
|
21
|
+
_platform = inject(PLATFORM_ID);
|
|
22
|
+
isExpanded = this._selectService.isExpanded;
|
|
23
|
+
selectTriggerId = computed(() => `${this._selectService.id()}--trigger`);
|
|
24
|
+
selectContentId = computed(() => `${this._selectService.id()}--content`);
|
|
25
|
+
selectDisable = computed(() => this._selectService.disabled());
|
|
26
|
+
selectTriggerLabelledBy = computed(() => {
|
|
27
|
+
if (this._selectService.value() && this._selectService.value().length > 0) {
|
|
28
|
+
return `${this._selectService.labelId()} ${this._selectService.id()}--value`;
|
|
29
|
+
}
|
|
30
|
+
return this._selectService.labelId();
|
|
31
|
+
});
|
|
32
|
+
_resizeObserver;
|
|
33
|
+
constructor() {
|
|
34
|
+
if (!this._selectService)
|
|
35
|
+
return;
|
|
36
|
+
this._selectService._setSelectTrigger(this);
|
|
37
|
+
}
|
|
38
|
+
ngAfterViewInit() {
|
|
39
|
+
this._selectService.setTriggerWidth(this._el.nativeElement.offsetWidth);
|
|
40
|
+
// if we are on the client, listen for element resize events
|
|
41
|
+
if (isPlatformBrowser(this._platform)) {
|
|
42
|
+
this._resizeObserver = new ResizeObserver(() => this._selectService.setTriggerWidth(this._el.nativeElement.offsetWidth));
|
|
43
|
+
this._resizeObserver.observe(this._el.nativeElement);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
ngOnDestroy() {
|
|
47
|
+
this._resizeObserver?.disconnect();
|
|
48
|
+
}
|
|
49
|
+
focus() {
|
|
50
|
+
this._el.nativeElement.focus();
|
|
51
|
+
}
|
|
52
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
53
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.5", type: BrnSelectTriggerDirective, isStandalone: true, selector: "[brnSelectTrigger]", host: { attributes: { "role": "combobox", "aria-autocomplete": "none", "type": "button" }, properties: { "attr.id": "selectTriggerId()", "disabled": "selectDisable()", "attr.aria-expanded": "isExpanded()", "attr.aria-controls": "selectContentId() + ''", "attr.aria-labelledBy": "selectTriggerLabelledBy()", "attr.dir": "_selectService.dir()", "class.ng-invalid": "this._ngControl?.invalid || null", "class.ng-dirty": "this._ngControl?.dirty || null", "class.ng-valid": "this._ngControl?.valid || null", "class.ng-touched": "this._ngControl?.touched || null", "class.ng-untouched": "this._ngControl?.untouched || null", "class.ng-pristine": "this._ngControl?.pristine || null" } }, ngImport: i0 });
|
|
54
|
+
}
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectTriggerDirective, decorators: [{
|
|
56
|
+
type: Directive,
|
|
57
|
+
args: [{
|
|
58
|
+
selector: '[brnSelectTrigger]',
|
|
59
|
+
standalone: true,
|
|
60
|
+
host: {
|
|
61
|
+
role: 'combobox',
|
|
62
|
+
'[attr.id]': 'selectTriggerId()',
|
|
63
|
+
'[disabled]': 'selectDisable()',
|
|
64
|
+
'[attr.aria-expanded]': 'isExpanded()',
|
|
65
|
+
'[attr.aria-controls]': "selectContentId() + ''",
|
|
66
|
+
'[attr.aria-labelledBy]': 'selectTriggerLabelledBy()',
|
|
67
|
+
'aria-autocomplete': 'none',
|
|
68
|
+
'[attr.dir]': '_selectService.dir()',
|
|
69
|
+
'[class.ng-invalid]': 'this._ngControl?.invalid || null',
|
|
70
|
+
'[class.ng-dirty]': 'this._ngControl?.dirty || null',
|
|
71
|
+
'[class.ng-valid]': 'this._ngControl?.valid || null',
|
|
72
|
+
'[class.ng-touched]': 'this._ngControl?.touched || null',
|
|
73
|
+
'[class.ng-untouched]': 'this._ngControl?.untouched || null',
|
|
74
|
+
'[class.ng-pristine]': 'this._ngControl?.pristine || null',
|
|
75
|
+
type: 'button',
|
|
76
|
+
},
|
|
77
|
+
}]
|
|
78
|
+
}], ctorParameters: () => [] });
|
|
79
|
+
class BrnSelectService {
|
|
80
|
+
state = signal({
|
|
81
|
+
id: '',
|
|
82
|
+
labelId: '',
|
|
83
|
+
panelId: '',
|
|
84
|
+
isExpanded: false,
|
|
85
|
+
placeholder: signal(''),
|
|
86
|
+
multiple: signal(false),
|
|
87
|
+
disabled: signal(false),
|
|
88
|
+
disabledBySetDisabled: signal(false),
|
|
89
|
+
dir: signal('ltr'),
|
|
90
|
+
selectedOptions: [],
|
|
91
|
+
possibleOptions: [],
|
|
92
|
+
value: '',
|
|
93
|
+
triggerWidth: 0,
|
|
94
|
+
});
|
|
95
|
+
id = computed(() => this.state().id);
|
|
96
|
+
labelId = computed(() => this.state().labelId);
|
|
97
|
+
panelId = computed(() => this.state().panelId);
|
|
98
|
+
placeholder = computed(() => this.state().placeholder());
|
|
99
|
+
disabled = computed(() => this.state().disabled() || this.state().disabledBySetDisabled());
|
|
100
|
+
isExpanded = computed(() => this.state().isExpanded);
|
|
101
|
+
multiple = computed(() => this.state().multiple());
|
|
102
|
+
dir = computed(() => this.state().dir());
|
|
103
|
+
selectedOptions = computed(() => this.state().selectedOptions);
|
|
104
|
+
value = computed(() => this.state().value);
|
|
105
|
+
triggerWidth = computed(() => this.state().triggerWidth);
|
|
106
|
+
possibleOptions = computed(() => this.state().possibleOptions);
|
|
107
|
+
_multiple$ = toObservable(this.multiple);
|
|
108
|
+
listBoxValueChangeEvent$ = new Subject();
|
|
109
|
+
_selectTrigger;
|
|
110
|
+
get selectTrigger() {
|
|
111
|
+
return this._selectTrigger;
|
|
112
|
+
}
|
|
113
|
+
constructor() {
|
|
114
|
+
this.listBoxValueChangeEvent$.pipe(takeUntilDestroyed()).subscribe((listBoxChange) => {
|
|
115
|
+
const updatedSelections = this.multiple() ? this.getUpdatedOptions(listBoxChange) : [listBoxChange.option];
|
|
116
|
+
const value = this.multiple() ? listBoxChange.value : listBoxChange.value[0];
|
|
117
|
+
this.state.update((state) => ({
|
|
118
|
+
...state,
|
|
119
|
+
selectedOptions: [...updatedSelections],
|
|
120
|
+
value: value,
|
|
121
|
+
}));
|
|
122
|
+
});
|
|
123
|
+
// We need to skip the first value because we don't want to deselect all options when the component is initialized with a preselected value e.g. by the form control
|
|
124
|
+
this._multiple$.pipe(skip(1), takeUntilDestroyed()).subscribe((multiple) => {
|
|
125
|
+
if (!multiple && this.value().length > 1) {
|
|
126
|
+
this.deselectAllOptions();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
setTriggerWidth(triggerWidth) {
|
|
131
|
+
this.state.update((s) => ({ ...s, triggerWidth }));
|
|
132
|
+
}
|
|
133
|
+
getUpdatedOptions(latestListboxChange) {
|
|
134
|
+
const isNewSelection = latestListboxChange.value.findIndex((value) => value === latestListboxChange.option?.value);
|
|
135
|
+
if (isNewSelection === -1) {
|
|
136
|
+
const removedOptionIndex = this.selectedOptions().findIndex((option) => latestListboxChange.option === option);
|
|
137
|
+
const options = this.selectedOptions();
|
|
138
|
+
options.splice(removedOptionIndex, 1);
|
|
139
|
+
return options;
|
|
140
|
+
}
|
|
141
|
+
return [...this.selectedOptions(), latestListboxChange.option];
|
|
142
|
+
}
|
|
143
|
+
deselectAllOptions() {
|
|
144
|
+
this.state.update((state) => ({
|
|
145
|
+
...state,
|
|
146
|
+
selectedOptions: [],
|
|
147
|
+
value: [],
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
// Needed due to https://github.com/angular/angular/issues/20810
|
|
151
|
+
_setSelectTrigger(trigger) {
|
|
152
|
+
this._selectTrigger = trigger;
|
|
153
|
+
}
|
|
154
|
+
setInitialSelectedOptions(value) {
|
|
155
|
+
this.selectOptionByValue(value);
|
|
156
|
+
this.state.update((state) => ({
|
|
157
|
+
...state,
|
|
158
|
+
value: value,
|
|
159
|
+
initialSelectedOptions: this.selectedOptions(),
|
|
160
|
+
selectedOptions: this.selectedOptions(),
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
selectOptionByValue(value) {
|
|
164
|
+
const options = this.possibleOptions();
|
|
165
|
+
if (value === null || value === undefined) {
|
|
166
|
+
const nullOrUndefinedOption = options.find((o) => o && o.value === value);
|
|
167
|
+
if (!nullOrUndefinedOption) {
|
|
168
|
+
this.state.update((state) => ({
|
|
169
|
+
...state,
|
|
170
|
+
selectedOptions: [],
|
|
171
|
+
value: this.multiple() ? [] : '',
|
|
172
|
+
}));
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (this.multiple()) {
|
|
177
|
+
const selectedOptions = options.filter((option) => {
|
|
178
|
+
if (Array.isArray(value)) {
|
|
179
|
+
return value.includes(option?.value);
|
|
180
|
+
}
|
|
181
|
+
return value === option?.value;
|
|
182
|
+
});
|
|
183
|
+
this.state.update((state) => ({
|
|
184
|
+
...state,
|
|
185
|
+
selectedOptions,
|
|
186
|
+
value: value,
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
const selectedOption = options.find((option) => option?.value === value);
|
|
191
|
+
if (!selectedOption) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
this.state.update((state) => ({
|
|
195
|
+
...state,
|
|
196
|
+
selectedOptions: [selectedOption],
|
|
197
|
+
value: selectedOption.value,
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
202
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectService });
|
|
203
|
+
}
|
|
204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectService, decorators: [{
|
|
205
|
+
type: Injectable
|
|
206
|
+
}], ctorParameters: () => [] });
|
|
207
|
+
|
|
208
|
+
class BrnSelectOptionDirective {
|
|
209
|
+
_cdkSelectOption = inject(CdkOption, { host: true });
|
|
210
|
+
_selectService = inject(BrnSelectService);
|
|
211
|
+
_focused = signal(false);
|
|
212
|
+
elementRef = inject(ElementRef);
|
|
213
|
+
selected = computed(() => {
|
|
214
|
+
if (Array.isArray(this._selectService.value())) {
|
|
215
|
+
const itemFound = this._selectService.value().find((val) => val === this._cdkSelectOption.value);
|
|
216
|
+
return !!itemFound;
|
|
217
|
+
}
|
|
218
|
+
return this._cdkSelectOption.value === this._selectService.value();
|
|
219
|
+
});
|
|
220
|
+
focused = computed(() => this._focused());
|
|
221
|
+
checkedState = computed(() => (this.selected() ? 'checked' : 'unchecked'));
|
|
222
|
+
dir = computed(() => this._selectService.dir());
|
|
223
|
+
constructor() {
|
|
224
|
+
effect(() => {
|
|
225
|
+
this._cdkSelectOption.value = this.value();
|
|
226
|
+
});
|
|
227
|
+
effect(() => {
|
|
228
|
+
this._cdkSelectOption.disabled = this.disabledSignal();
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
ngAfterContentChecked() {
|
|
232
|
+
this._cdkSelectOption.value = this.value();
|
|
233
|
+
}
|
|
234
|
+
value = input(null);
|
|
235
|
+
// we use "disabledSignal" here because disabled is already defined in the FocusableOption interface
|
|
236
|
+
disabledSignal = input(false, {
|
|
237
|
+
alias: 'disabled',
|
|
238
|
+
transform: booleanAttribute,
|
|
239
|
+
});
|
|
240
|
+
hover() {
|
|
241
|
+
this.focus();
|
|
242
|
+
}
|
|
243
|
+
focus() {
|
|
244
|
+
this._cdkSelectOption.focus();
|
|
245
|
+
this._focused.set(true);
|
|
246
|
+
}
|
|
247
|
+
blur() {
|
|
248
|
+
this._focused.set(false);
|
|
249
|
+
}
|
|
250
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectOptionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
251
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.5", type: BrnSelectOptionDirective, isStandalone: true, selector: "[brnOption]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabledSignal: { classPropertyName: "disabledSignal", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "hover()", "blur": "blur()" }, properties: { "attr.dir": "_selectService.dir()", "attr.data-disabled": "disabledSignal() ? '' : undefined" } }, hostDirectives: [{ directive: i1.CdkOption }], ngImport: i0 });
|
|
252
|
+
}
|
|
253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectOptionDirective, decorators: [{
|
|
254
|
+
type: Directive,
|
|
255
|
+
args: [{
|
|
256
|
+
selector: '[brnOption]',
|
|
257
|
+
standalone: true,
|
|
258
|
+
hostDirectives: [CdkOption],
|
|
259
|
+
host: {
|
|
260
|
+
'(mouseenter)': 'hover()',
|
|
261
|
+
'(blur)': 'blur()',
|
|
262
|
+
'[attr.dir]': '_selectService.dir()',
|
|
263
|
+
'[attr.data-disabled]': "disabledSignal() ? '' : undefined",
|
|
264
|
+
},
|
|
265
|
+
}]
|
|
266
|
+
}], ctorParameters: () => [] });
|
|
267
|
+
|
|
268
|
+
const SCROLLBY_PIXELS = 100;
|
|
269
|
+
class BrnSelectScrollUpDirective {
|
|
270
|
+
_el = inject(ElementRef);
|
|
271
|
+
_selectContent = inject(BrnSelectContentComponent);
|
|
272
|
+
_endReached = new Subject();
|
|
273
|
+
_destroyRef = inject(DestroyRef);
|
|
274
|
+
startEmittingEvents() {
|
|
275
|
+
const mouseLeave$ = fromEvent(this._el.nativeElement, 'mouseleave');
|
|
276
|
+
interval(100)
|
|
277
|
+
.pipe(takeUntil(mouseLeave$), takeUntil(this._endReached), takeUntilDestroyed(this._destroyRef))
|
|
278
|
+
.subscribe(() => this._selectContent.moveFocusUp());
|
|
279
|
+
}
|
|
280
|
+
stopEmittingEvents() {
|
|
281
|
+
this._endReached.next(true);
|
|
282
|
+
}
|
|
283
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectScrollUpDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
284
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.5", type: BrnSelectScrollUpDirective, isStandalone: true, selector: "[brnSelectScrollUp], brn-select-scroll-up, hlm-select-scroll-up:not(noHlm)", host: { attributes: { "aria-hidden": "true" }, listeners: { "mouseenter": "startEmittingEvents()" } }, ngImport: i0 });
|
|
285
|
+
}
|
|
286
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectScrollUpDirective, decorators: [{
|
|
287
|
+
type: Directive,
|
|
288
|
+
args: [{
|
|
289
|
+
selector: '[brnSelectScrollUp], brn-select-scroll-up, hlm-select-scroll-up:not(noHlm)',
|
|
290
|
+
standalone: true,
|
|
291
|
+
host: {
|
|
292
|
+
'aria-hidden': 'true',
|
|
293
|
+
'(mouseenter)': 'startEmittingEvents()',
|
|
294
|
+
},
|
|
295
|
+
}]
|
|
296
|
+
}] });
|
|
297
|
+
class BrnSelectScrollDownDirective {
|
|
298
|
+
_el = inject(ElementRef);
|
|
299
|
+
_selectContent = inject(BrnSelectContentComponent);
|
|
300
|
+
_endReached = new Subject();
|
|
301
|
+
_destroyRef = inject(DestroyRef);
|
|
302
|
+
startEmittingEvents() {
|
|
303
|
+
const mouseLeave$ = fromEvent(this._el.nativeElement, 'mouseleave');
|
|
304
|
+
interval(100)
|
|
305
|
+
.pipe(takeUntil(mouseLeave$), takeUntil(this._endReached), takeUntilDestroyed(this._destroyRef))
|
|
306
|
+
.subscribe(() => this._selectContent.moveFocusDown());
|
|
307
|
+
}
|
|
308
|
+
stopEmittingEvents() {
|
|
309
|
+
this._endReached.next(true);
|
|
310
|
+
}
|
|
311
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectScrollDownDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
312
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.5", type: BrnSelectScrollDownDirective, isStandalone: true, selector: "[brnSelectScrollDown], brn-select-scroll-down, hlm-select-scroll-down:not(noHlm)", host: { attributes: { "aria-hidden": "true" }, listeners: { "mouseenter": "startEmittingEvents()" } }, ngImport: i0 });
|
|
313
|
+
}
|
|
314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectScrollDownDirective, decorators: [{
|
|
315
|
+
type: Directive,
|
|
316
|
+
args: [{
|
|
317
|
+
selector: '[brnSelectScrollDown], brn-select-scroll-down, hlm-select-scroll-down:not(noHlm)',
|
|
318
|
+
standalone: true,
|
|
319
|
+
host: {
|
|
320
|
+
'aria-hidden': 'true',
|
|
321
|
+
'(mouseenter)': 'startEmittingEvents()',
|
|
322
|
+
},
|
|
323
|
+
}]
|
|
324
|
+
}] });
|
|
325
|
+
class BrnSelectContentComponent {
|
|
326
|
+
_el = inject(ElementRef);
|
|
327
|
+
_cdkListbox = inject(CdkListbox, { host: true });
|
|
328
|
+
_destroyRef = inject(DestroyRef);
|
|
329
|
+
_selectService = inject(BrnSelectService);
|
|
330
|
+
labelledBy = this._selectService.labelId;
|
|
331
|
+
id = this._selectService.id;
|
|
332
|
+
canScrollUp = signal(false);
|
|
333
|
+
canScrollDown = signal(false);
|
|
334
|
+
initialSelectedOptions$ = toObservable(this._selectService.selectedOptions);
|
|
335
|
+
viewport = viewChild.required('viewport');
|
|
336
|
+
scrollUpBtn = contentChild.required(BrnSelectScrollUpDirective);
|
|
337
|
+
scrollDownBtn = contentChild.required(BrnSelectScrollDownDirective);
|
|
338
|
+
_options = contentChildren(BrnSelectOptionDirective, { descendants: true });
|
|
339
|
+
constructor() {
|
|
340
|
+
this._cdkListbox.valueChange
|
|
341
|
+
.asObservable()
|
|
342
|
+
.pipe(takeUntilDestroyed())
|
|
343
|
+
.subscribe((val) => this._selectService.listBoxValueChangeEvent$.next(val));
|
|
344
|
+
effect(() => {
|
|
345
|
+
this._cdkListbox.multiple = this._selectService.multiple();
|
|
346
|
+
this._selectService.isExpanded() && setTimeout(() => this.updateArrowDisplay());
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
ngAfterViewInit() {
|
|
350
|
+
this.setInitiallySelectedOptions();
|
|
351
|
+
}
|
|
352
|
+
setInitiallySelectedOptions() {
|
|
353
|
+
this.initialSelectedOptions$.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((selectedOptions) => {
|
|
354
|
+
// Reapplying cdkLibstbox multiple because seems this is running before effect that
|
|
355
|
+
// updates cdklistbox, reapplying multiple true so we can set the multiple initial options
|
|
356
|
+
if (this._selectService.multiple()) {
|
|
357
|
+
this._cdkListbox.multiple = true;
|
|
358
|
+
}
|
|
359
|
+
for (const cdkOption of this._selectService.possibleOptions()) {
|
|
360
|
+
if (selectedOptions.includes(cdkOption)) {
|
|
361
|
+
cdkOption?.select();
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
cdkOption?.deselect();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
for (const cdkOption of selectedOptions) {
|
|
368
|
+
cdkOption?.select();
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
updateArrowDisplay() {
|
|
373
|
+
const { scrollTop, scrollHeight, clientHeight } = this.viewport().nativeElement;
|
|
374
|
+
this.canScrollUp.set(scrollTop > 0);
|
|
375
|
+
const maxScroll = scrollHeight - clientHeight;
|
|
376
|
+
this.canScrollDown.set(Math.ceil(scrollTop) < maxScroll);
|
|
377
|
+
}
|
|
378
|
+
handleScroll() {
|
|
379
|
+
this.updateArrowDisplay();
|
|
380
|
+
}
|
|
381
|
+
focusList() {
|
|
382
|
+
this._cdkListbox.focus();
|
|
383
|
+
}
|
|
384
|
+
moveFocusUp() {
|
|
385
|
+
this.viewport().nativeElement.scrollBy({ top: -SCROLLBY_PIXELS, behavior: 'smooth' });
|
|
386
|
+
if (this.viewport().nativeElement.scrollTop === 0) {
|
|
387
|
+
this.scrollUpBtn().stopEmittingEvents();
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
moveFocusDown() {
|
|
391
|
+
this.viewport().nativeElement.scrollBy({ top: SCROLLBY_PIXELS, behavior: 'smooth' });
|
|
392
|
+
const viewportSize = this._el.nativeElement.scrollHeight;
|
|
393
|
+
const viewportScrollPosition = this.viewport().nativeElement.scrollTop;
|
|
394
|
+
if (viewportSize + viewportScrollPosition + SCROLLBY_PIXELS >
|
|
395
|
+
this.viewport().nativeElement.scrollHeight + SCROLLBY_PIXELS / 2) {
|
|
396
|
+
this.scrollDownBtn().stopEmittingEvents();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
400
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.5", type: BrnSelectContentComponent, isStandalone: true, selector: "brn-select-content, hlm-select-content:not(noHlm)", host: { properties: { "attr.aria-labelledBy": "labelledBy()", "attr.aria-controlledBy": "id() +'--trigger'", "id": "id() + '--content'", "attr.dir": "_selectService.dir()" } }, queries: [{ propertyName: "scrollUpBtn", first: true, predicate: BrnSelectScrollUpDirective, descendants: true, isSignal: true }, { propertyName: "scrollDownBtn", first: true, predicate: BrnSelectScrollDownDirective, descendants: true, isSignal: true }, { propertyName: "_options", predicate: BrnSelectOptionDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "viewport", first: true, predicate: ["viewport"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.CdkListbox }], ngImport: i0, template: `
|
|
401
|
+
<ng-template #scrollUp>
|
|
402
|
+
<ng-content select="hlm-select-scroll-up" />
|
|
403
|
+
<ng-content select="brnSelectScrollUp" />
|
|
404
|
+
</ng-template>
|
|
405
|
+
<ng-container *ngTemplateOutlet="canScrollUp() && scrollUpBtn() ? scrollUp : null" />
|
|
406
|
+
<div
|
|
407
|
+
data-brn-select-viewport
|
|
408
|
+
#viewport
|
|
409
|
+
(scroll)="handleScroll()"
|
|
410
|
+
style="flex: 1 1 0%;
|
|
411
|
+
position: relative;
|
|
412
|
+
width:100%;
|
|
413
|
+
overflow:auto;
|
|
414
|
+
min-height: 36px;
|
|
415
|
+
padding-bottom: 2px;
|
|
416
|
+
margin-bottom: -2px;"
|
|
417
|
+
>
|
|
418
|
+
<ng-content />
|
|
419
|
+
</div>
|
|
420
|
+
<ng-template #scrollDown>
|
|
421
|
+
<ng-content select="brnSelectScrollDown" />
|
|
422
|
+
<ng-content select="hlm-select-scroll-down" />
|
|
423
|
+
</ng-template>
|
|
424
|
+
<ng-container *ngTemplateOutlet="canScrollDown() && scrollDownBtn() ? scrollDown : null" />
|
|
425
|
+
`, isInline: true, styles: [":host{display:flex;box-sizing:border-box;flex-direction:column;outline:none;pointer-events:auto}[data-brn-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch}[data-brn-select-viewport]::-webkit-scrollbar{display:none}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
426
|
+
}
|
|
427
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectContentComponent, decorators: [{
|
|
428
|
+
type: Component,
|
|
429
|
+
args: [{ selector: 'brn-select-content, hlm-select-content:not(noHlm)', standalone: true, imports: [BrnSelectScrollUpDirective, BrnSelectScrollDownDirective, NgTemplateOutlet], hostDirectives: [CdkListbox], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
430
|
+
'[attr.aria-labelledBy]': 'labelledBy()',
|
|
431
|
+
'[attr.aria-controlledBy]': "id() +'--trigger'",
|
|
432
|
+
'[id]': "id() + '--content'",
|
|
433
|
+
'[attr.dir]': '_selectService.dir()',
|
|
434
|
+
}, template: `
|
|
435
|
+
<ng-template #scrollUp>
|
|
436
|
+
<ng-content select="hlm-select-scroll-up" />
|
|
437
|
+
<ng-content select="brnSelectScrollUp" />
|
|
438
|
+
</ng-template>
|
|
439
|
+
<ng-container *ngTemplateOutlet="canScrollUp() && scrollUpBtn() ? scrollUp : null" />
|
|
440
|
+
<div
|
|
441
|
+
data-brn-select-viewport
|
|
442
|
+
#viewport
|
|
443
|
+
(scroll)="handleScroll()"
|
|
444
|
+
style="flex: 1 1 0%;
|
|
445
|
+
position: relative;
|
|
446
|
+
width:100%;
|
|
447
|
+
overflow:auto;
|
|
448
|
+
min-height: 36px;
|
|
449
|
+
padding-bottom: 2px;
|
|
450
|
+
margin-bottom: -2px;"
|
|
451
|
+
>
|
|
452
|
+
<ng-content />
|
|
453
|
+
</div>
|
|
454
|
+
<ng-template #scrollDown>
|
|
455
|
+
<ng-content select="brnSelectScrollDown" />
|
|
456
|
+
<ng-content select="hlm-select-scroll-down" />
|
|
457
|
+
</ng-template>
|
|
458
|
+
<ng-container *ngTemplateOutlet="canScrollDown() && scrollDownBtn() ? scrollDown : null" />
|
|
459
|
+
`, styles: [":host{display:flex;box-sizing:border-box;flex-direction:column;outline:none;pointer-events:auto}[data-brn-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch}[data-brn-select-viewport]::-webkit-scrollbar{display:none}\n"] }]
|
|
460
|
+
}], ctorParameters: () => [] });
|
|
461
|
+
|
|
462
|
+
class BrnSelectGroupDirective {
|
|
463
|
+
labelledBy = signal('');
|
|
464
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
465
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.5", type: BrnSelectGroupDirective, isStandalone: true, selector: "[brnSelectGroup]", host: { attributes: { "role": "group" }, properties: { "attr.aria-labelledby": "labelledBy()" } }, ngImport: i0 });
|
|
466
|
+
}
|
|
467
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectGroupDirective, decorators: [{
|
|
468
|
+
type: Directive,
|
|
469
|
+
args: [{
|
|
470
|
+
selector: '[brnSelectGroup]',
|
|
471
|
+
standalone: true,
|
|
472
|
+
host: {
|
|
473
|
+
role: 'group',
|
|
474
|
+
'[attr.aria-labelledby]': 'labelledBy()',
|
|
475
|
+
},
|
|
476
|
+
}]
|
|
477
|
+
}] });
|
|
478
|
+
|
|
479
|
+
class BrnSelectLabelDirective {
|
|
480
|
+
_group = inject(BrnSelectGroupDirective, { optional: true });
|
|
481
|
+
_label = inject(BrnLabelDirective, { host: true });
|
|
482
|
+
constructor() {
|
|
483
|
+
this._group?.labelledBy.set(this._label.id());
|
|
484
|
+
}
|
|
485
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
486
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.5", type: BrnSelectLabelDirective, isStandalone: true, selector: "[brnSelectLabel]", hostDirectives: [{ directive: i1$1.BrnLabelDirective }], ngImport: i0 });
|
|
487
|
+
}
|
|
488
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectLabelDirective, decorators: [{
|
|
489
|
+
type: Directive,
|
|
490
|
+
args: [{
|
|
491
|
+
selector: '[brnSelectLabel]',
|
|
492
|
+
hostDirectives: [BrnLabelDirective],
|
|
493
|
+
standalone: true,
|
|
494
|
+
}]
|
|
495
|
+
}], ctorParameters: () => [] });
|
|
496
|
+
|
|
497
|
+
class BrnSelectValueComponent {
|
|
498
|
+
_selectService = inject(BrnSelectService);
|
|
499
|
+
id = computed(() => `${this._selectService.id()}--value`);
|
|
500
|
+
placeholder = computed(() => this._selectService.placeholder());
|
|
501
|
+
value = null;
|
|
502
|
+
transformFn = input((values) => (values ?? []).join(', '));
|
|
503
|
+
constructor() {
|
|
504
|
+
const cdr = inject(ChangeDetectorRef);
|
|
505
|
+
// In certain cases (when using a computed signal for value) where the value of the select and the options are
|
|
506
|
+
// changed dynamically, the template does not update until the next frame. To work around this we can use a simple
|
|
507
|
+
// string variable in the template and manually trigger change detection when we update it.
|
|
508
|
+
toObservable(this._selectService.selectedOptions)
|
|
509
|
+
.pipe(takeUntilDestroyed())
|
|
510
|
+
.subscribe((value) => {
|
|
511
|
+
if (value.length === 0) {
|
|
512
|
+
this.value = null;
|
|
513
|
+
cdr.detectChanges();
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
const selectedLabels = value.map((selectedOption) => selectedOption?.getLabel());
|
|
517
|
+
if (this._selectService.dir() === 'rtl') {
|
|
518
|
+
selectedLabels.reverse();
|
|
519
|
+
}
|
|
520
|
+
const result = this.transformFn()(selectedLabels);
|
|
521
|
+
this.value = result;
|
|
522
|
+
cdr.detectChanges();
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
526
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.5", type: BrnSelectValueComponent, isStandalone: true, selector: "brn-select-value, hlm-select-value", inputs: { transformFn: { classPropertyName: "transformFn", publicName: "transformFn", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()" } }, ngImport: i0, template: `
|
|
527
|
+
{{ value || placeholder() }}
|
|
528
|
+
`, isInline: true, styles: [":host{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;white-space:nowrap;pointer-events:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
529
|
+
}
|
|
530
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectValueComponent, decorators: [{
|
|
531
|
+
type: Component,
|
|
532
|
+
args: [{ selector: 'brn-select-value, hlm-select-value', template: `
|
|
533
|
+
{{ value || placeholder() }}
|
|
534
|
+
`, host: {
|
|
535
|
+
'[id]': 'id()',
|
|
536
|
+
}, standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;white-space:nowrap;pointer-events:none}\n"] }]
|
|
537
|
+
}], ctorParameters: () => [] });
|
|
538
|
+
|
|
539
|
+
let nextId = 0;
|
|
540
|
+
class BrnSelectComponent {
|
|
541
|
+
_selectService = inject(BrnSelectService);
|
|
542
|
+
triggerWidth = this._selectService.triggerWidth;
|
|
543
|
+
multiple = input(false);
|
|
544
|
+
placeholder = input('');
|
|
545
|
+
disabled = input(false);
|
|
546
|
+
dir = input('ltr');
|
|
547
|
+
_disabledFromSetDisabledState = signal(false);
|
|
548
|
+
selectLabel = contentChild(BrnLabelDirective, { descendants: false });
|
|
549
|
+
/** Overlay pane containing the options. */
|
|
550
|
+
selectContent = contentChild.required(BrnSelectContentComponent);
|
|
551
|
+
options = contentChildren(CdkOption, { descendants: true });
|
|
552
|
+
options$ = toObservable(this.options);
|
|
553
|
+
optionsAndIndex$ = this.options$.pipe(map((options, index) => [options, index]));
|
|
554
|
+
/** Overlay pane containing the options. */
|
|
555
|
+
_overlayDir = viewChild(CdkConnectedOverlay);
|
|
556
|
+
openedChange = output();
|
|
557
|
+
closeDelay = input(100);
|
|
558
|
+
isExpanded = this._selectService.isExpanded;
|
|
559
|
+
_delayedExpanded = toSignal(toObservable(this.isExpanded).pipe(switchMap((expanded) => (!expanded ? of(expanded).pipe(delay(this.closeDelay())) : of(expanded))), takeUntilDestroyed()), { initialValue: false });
|
|
560
|
+
state = computed(() => (this.isExpanded() ? 'open' : 'closed'));
|
|
561
|
+
_positionChanges$ = new Subject();
|
|
562
|
+
side = toSignal(this._positionChanges$.pipe(map((change) =>
|
|
563
|
+
// todo: better translation or adjusting hlm to take that into account
|
|
564
|
+
change.connectionPair.originY === 'center'
|
|
565
|
+
? change.connectionPair.originX === 'start'
|
|
566
|
+
? 'left'
|
|
567
|
+
: 'right'
|
|
568
|
+
: change.connectionPair.originY)), { initialValue: 'bottom' });
|
|
569
|
+
backupLabelId = computed(() => this._selectService.labelId());
|
|
570
|
+
labelProvided = signal(false);
|
|
571
|
+
ngControl = inject(NgControl, { optional: true, self: true });
|
|
572
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
573
|
+
_onChange = () => { };
|
|
574
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
575
|
+
_onTouched = () => { };
|
|
576
|
+
_shouldEmitValueChange = signal(false);
|
|
577
|
+
/*
|
|
578
|
+
* This position config ensures that the top "start" corner of the overlay
|
|
579
|
+
* is aligned with with the top "start" of the origin by default (overlapping
|
|
580
|
+
* the trigger completely). If the panel cannot fit below the trigger, it
|
|
581
|
+
* will fall back to a position above the trigger.
|
|
582
|
+
*/
|
|
583
|
+
_positions = [
|
|
584
|
+
{
|
|
585
|
+
originX: 'start',
|
|
586
|
+
originY: 'bottom',
|
|
587
|
+
overlayX: 'start',
|
|
588
|
+
overlayY: 'top',
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
originX: 'end',
|
|
592
|
+
originY: 'bottom',
|
|
593
|
+
overlayX: 'end',
|
|
594
|
+
overlayY: 'top',
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
originX: 'start',
|
|
598
|
+
originY: 'top',
|
|
599
|
+
overlayX: 'start',
|
|
600
|
+
overlayY: 'bottom',
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
originX: 'end',
|
|
604
|
+
originY: 'top',
|
|
605
|
+
overlayX: 'end',
|
|
606
|
+
overlayY: 'bottom',
|
|
607
|
+
},
|
|
608
|
+
];
|
|
609
|
+
errorStateTracker;
|
|
610
|
+
_defaultErrorStateMatcher = inject(ErrorStateMatcher);
|
|
611
|
+
_parentForm = inject(NgForm, { optional: true });
|
|
612
|
+
_parentFormGroup = inject(FormGroupDirective, { optional: true });
|
|
613
|
+
errorState = computed(() => this.errorStateTracker.errorState());
|
|
614
|
+
writeValue$ = new Subject();
|
|
615
|
+
constructor() {
|
|
616
|
+
this._selectService.state.update((state) => ({
|
|
617
|
+
...state,
|
|
618
|
+
multiple: this.multiple,
|
|
619
|
+
placeholder: this.placeholder,
|
|
620
|
+
disabled: this.disabled,
|
|
621
|
+
disabledBySetDisabled: this._disabledFromSetDisabledState,
|
|
622
|
+
dir: this.dir,
|
|
623
|
+
}));
|
|
624
|
+
this.handleOptionChanges();
|
|
625
|
+
this.handleInitialOptionSelect();
|
|
626
|
+
this._selectService.state.update((state) => ({
|
|
627
|
+
...state,
|
|
628
|
+
id: `brn-select-${nextId++}`,
|
|
629
|
+
}));
|
|
630
|
+
if (this.ngControl !== null) {
|
|
631
|
+
this.ngControl.valueAccessor = this;
|
|
632
|
+
}
|
|
633
|
+
// Watch for Listbox Selection Changes to trigger Collapse and Value Change
|
|
634
|
+
this._selectService.listBoxValueChangeEvent$.pipe(takeUntilDestroyed()).subscribe(() => {
|
|
635
|
+
if (!this.multiple()) {
|
|
636
|
+
this.close();
|
|
637
|
+
}
|
|
638
|
+
// we set shouldEmitValueChange to true because we want to propagate the value change
|
|
639
|
+
// as a result of user interaction
|
|
640
|
+
this._shouldEmitValueChange.set(true);
|
|
641
|
+
});
|
|
642
|
+
/**
|
|
643
|
+
* Listening to value changes in order to trigger forms api on change
|
|
644
|
+
* ShouldEmitValueChange simply ensures we only propagate value change when a user makes a selection
|
|
645
|
+
* we don't propagate changes made from outside the component (ex. patch value or initial value from form control)
|
|
646
|
+
*/
|
|
647
|
+
toObservable(this._selectService.value).subscribe((value) => {
|
|
648
|
+
if (this._shouldEmitValueChange()) {
|
|
649
|
+
this._onChange((value ?? null));
|
|
650
|
+
}
|
|
651
|
+
this._shouldEmitValueChange.set(true);
|
|
652
|
+
});
|
|
653
|
+
this.errorStateTracker = new ErrorStateTracker(this._defaultErrorStateMatcher, this.ngControl, this._parentFormGroup, this._parentForm);
|
|
654
|
+
}
|
|
655
|
+
ngAfterContentInit() {
|
|
656
|
+
// Check if Label Directive Provided and pass to service
|
|
657
|
+
const label = this.selectLabel();
|
|
658
|
+
if (label) {
|
|
659
|
+
this.labelProvided.set(true);
|
|
660
|
+
this._selectService.state.update((state) => ({
|
|
661
|
+
...state,
|
|
662
|
+
labelId: label.id(),
|
|
663
|
+
}));
|
|
664
|
+
}
|
|
665
|
+
else if (this.placeholder()) {
|
|
666
|
+
this._selectService.state.update((state) => ({
|
|
667
|
+
...state,
|
|
668
|
+
labelId: `${state.id}--label`,
|
|
669
|
+
}));
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
ngDoCheck() {
|
|
673
|
+
this.errorStateTracker.updateErrorState();
|
|
674
|
+
}
|
|
675
|
+
toggle() {
|
|
676
|
+
if (this.isExpanded()) {
|
|
677
|
+
this.close();
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
this.open();
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
open() {
|
|
684
|
+
if (!this._canOpen())
|
|
685
|
+
return;
|
|
686
|
+
this._selectService.state.update((state) => ({
|
|
687
|
+
...state,
|
|
688
|
+
isExpanded: true,
|
|
689
|
+
}));
|
|
690
|
+
this.openedChange.emit(true);
|
|
691
|
+
this._moveFocusToCDKList();
|
|
692
|
+
}
|
|
693
|
+
close() {
|
|
694
|
+
if (!this.isExpanded())
|
|
695
|
+
return;
|
|
696
|
+
if (this._selectService.selectTrigger) {
|
|
697
|
+
this._selectService.selectTrigger.focus();
|
|
698
|
+
}
|
|
699
|
+
this.openedChange.emit(false);
|
|
700
|
+
this._selectService.state.update((state) => ({
|
|
701
|
+
...state,
|
|
702
|
+
isExpanded: false,
|
|
703
|
+
}));
|
|
704
|
+
this._onTouched();
|
|
705
|
+
}
|
|
706
|
+
_canOpen() {
|
|
707
|
+
return !this.isExpanded() && !this.disabled() && this.options()?.length > 0;
|
|
708
|
+
}
|
|
709
|
+
_moveFocusToCDKList() {
|
|
710
|
+
setTimeout(() => {
|
|
711
|
+
this.selectContent()?.focusList();
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
writeValue(value) {
|
|
715
|
+
this.writeValue$.next(value);
|
|
716
|
+
}
|
|
717
|
+
registerOnChange(fn) {
|
|
718
|
+
this._onChange = fn;
|
|
719
|
+
}
|
|
720
|
+
registerOnTouched(fn) {
|
|
721
|
+
this._onTouched = fn;
|
|
722
|
+
}
|
|
723
|
+
setDisabledState(isDisabled) {
|
|
724
|
+
this._disabledFromSetDisabledState.set(isDisabled);
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Once writeValue is called and options are available we can handle setting the initial options
|
|
728
|
+
* @private
|
|
729
|
+
*/
|
|
730
|
+
handleInitialOptionSelect() {
|
|
731
|
+
// Write value cannot be handled until options are available, so we wait until both are available with a combineLatest
|
|
732
|
+
combineLatest([this.writeValue$, this.options$])
|
|
733
|
+
.pipe(map((values, index) => [...values, index]), takeUntilDestroyed())
|
|
734
|
+
.subscribe(([value, _, index]) => {
|
|
735
|
+
this._shouldEmitValueChange.set(false);
|
|
736
|
+
this._selectService.setInitialSelectedOptions(value);
|
|
737
|
+
// the first time this observable emits a value we are simply setting the initial state
|
|
738
|
+
// this change should not count as changing the state of the select, so we need to mark as pristine
|
|
739
|
+
if (index === 0) {
|
|
740
|
+
this.ngControl?.control?.markAsPristine();
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* When options change, our current selected options may become invalid
|
|
746
|
+
* Here we will automatically update our current selected options so that they are always inline with the possibleOptions
|
|
747
|
+
* @private
|
|
748
|
+
*/
|
|
749
|
+
handleOptionChanges() {
|
|
750
|
+
this.optionsAndIndex$.pipe(takeUntilDestroyed()).subscribe(([options, index]) => {
|
|
751
|
+
if (index > 0) {
|
|
752
|
+
this.handleInvalidOptions(options);
|
|
753
|
+
}
|
|
754
|
+
this.updatePossibleOptions(options);
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Check that our "selectedOptions" are still valid when "possibleOptions" is about to be updated
|
|
759
|
+
*/
|
|
760
|
+
handleInvalidOptions(options) {
|
|
761
|
+
const selectedOptions = this._selectService.selectedOptions();
|
|
762
|
+
const availableOptionSet = new Set(options);
|
|
763
|
+
if (this._selectService.multiple()) {
|
|
764
|
+
const filteredOptions = selectedOptions.filter((o) => availableOptionSet.has(o));
|
|
765
|
+
// only update if there was an actual change
|
|
766
|
+
if (selectedOptions.length !== filteredOptions.length) {
|
|
767
|
+
// update should result in a value change since we are deselecting a value
|
|
768
|
+
this._shouldEmitValueChange.set(true);
|
|
769
|
+
const value = filteredOptions.map((o) => o?.value ?? '');
|
|
770
|
+
this._selectService.state.update((state) => ({
|
|
771
|
+
...state,
|
|
772
|
+
selectedOptions: filteredOptions,
|
|
773
|
+
value: value,
|
|
774
|
+
}));
|
|
775
|
+
this._onChange((value ?? null));
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
else {
|
|
779
|
+
const selectedOption = selectedOptions[0] ?? null;
|
|
780
|
+
if (selectedOption !== null && !availableOptionSet.has(selectedOption)) {
|
|
781
|
+
this._shouldEmitValueChange.set(true);
|
|
782
|
+
this._selectService.state.update((state) => ({
|
|
783
|
+
...state,
|
|
784
|
+
selectedOptions: [],
|
|
785
|
+
value: '',
|
|
786
|
+
}));
|
|
787
|
+
this._onChange('');
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Sync the updated options with "possibleOptions" in the select service
|
|
793
|
+
*/
|
|
794
|
+
updatePossibleOptions(options) {
|
|
795
|
+
this._selectService.state.update((state) => ({
|
|
796
|
+
...state,
|
|
797
|
+
possibleOptions: options,
|
|
798
|
+
}));
|
|
799
|
+
}
|
|
800
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
801
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.5", type: BrnSelectComponent, isStandalone: true, selector: "brn-select, hlm-select", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, dir: { classPropertyName: "dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, closeDelay: { classPropertyName: "closeDelay", publicName: "closeDelay", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { openedChange: "openedChange" }, providers: [
|
|
802
|
+
BrnSelectService,
|
|
803
|
+
CdkListbox,
|
|
804
|
+
provideExposedSideProviderExisting((() => BrnSelectComponent)),
|
|
805
|
+
provideExposesStateProviderExisting((() => BrnSelectComponent)),
|
|
806
|
+
{
|
|
807
|
+
provide: BrnFormFieldControl,
|
|
808
|
+
useExisting: BrnSelectComponent,
|
|
809
|
+
},
|
|
810
|
+
], queries: [{ propertyName: "selectLabel", first: true, predicate: BrnLabelDirective, isSignal: true }, { propertyName: "selectContent", first: true, predicate: BrnSelectContentComponent, descendants: true, isSignal: true }, { propertyName: "options", predicate: CdkOption, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_overlayDir", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
811
|
+
@if (!labelProvided() && placeholder()) {
|
|
812
|
+
<label class="hidden" [attr.id]="backupLabelId()">{{ placeholder() }}</label>
|
|
813
|
+
} @else {
|
|
814
|
+
<ng-content select="label[hlmLabel],label[brnLabel]" />
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
<div cdk-overlay-origin (click)="toggle()" #trigger="cdkOverlayOrigin">
|
|
818
|
+
<ng-content select="hlm-select-trigger,[brnSelectTrigger]" />
|
|
819
|
+
</div>
|
|
820
|
+
<ng-template
|
|
821
|
+
cdk-connected-overlay
|
|
822
|
+
cdkConnectedOverlayLockPosition
|
|
823
|
+
cdkConnectedOverlayHasBackdrop
|
|
824
|
+
cdkConnectedOverlayBackdropClass="cdk-overlay-transparent-backdrop"
|
|
825
|
+
[cdkConnectedOverlayOrigin]="trigger"
|
|
826
|
+
[cdkConnectedOverlayOpen]="_delayedExpanded()"
|
|
827
|
+
[cdkConnectedOverlayPositions]="_positions"
|
|
828
|
+
[cdkConnectedOverlayWidth]="triggerWidth() > 0 ? triggerWidth() : 'auto'"
|
|
829
|
+
(backdropClick)="close()"
|
|
830
|
+
(detach)="close()"
|
|
831
|
+
(positionChange)="_positionChanges$.next($event)"
|
|
832
|
+
>
|
|
833
|
+
<ng-content />
|
|
834
|
+
</ng-template>
|
|
835
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1$2.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1$2.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "ngmodule", type: CdkListboxModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
836
|
+
}
|
|
837
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectComponent, decorators: [{
|
|
838
|
+
type: Component,
|
|
839
|
+
args: [{
|
|
840
|
+
selector: 'brn-select, hlm-select',
|
|
841
|
+
standalone: true,
|
|
842
|
+
imports: [OverlayModule, CdkListboxModule],
|
|
843
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
844
|
+
providers: [
|
|
845
|
+
BrnSelectService,
|
|
846
|
+
CdkListbox,
|
|
847
|
+
provideExposedSideProviderExisting((() => BrnSelectComponent)),
|
|
848
|
+
provideExposesStateProviderExisting((() => BrnSelectComponent)),
|
|
849
|
+
{
|
|
850
|
+
provide: BrnFormFieldControl,
|
|
851
|
+
useExisting: BrnSelectComponent,
|
|
852
|
+
},
|
|
853
|
+
],
|
|
854
|
+
template: `
|
|
855
|
+
@if (!labelProvided() && placeholder()) {
|
|
856
|
+
<label class="hidden" [attr.id]="backupLabelId()">{{ placeholder() }}</label>
|
|
857
|
+
} @else {
|
|
858
|
+
<ng-content select="label[hlmLabel],label[brnLabel]" />
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
<div cdk-overlay-origin (click)="toggle()" #trigger="cdkOverlayOrigin">
|
|
862
|
+
<ng-content select="hlm-select-trigger,[brnSelectTrigger]" />
|
|
863
|
+
</div>
|
|
864
|
+
<ng-template
|
|
865
|
+
cdk-connected-overlay
|
|
866
|
+
cdkConnectedOverlayLockPosition
|
|
867
|
+
cdkConnectedOverlayHasBackdrop
|
|
868
|
+
cdkConnectedOverlayBackdropClass="cdk-overlay-transparent-backdrop"
|
|
869
|
+
[cdkConnectedOverlayOrigin]="trigger"
|
|
870
|
+
[cdkConnectedOverlayOpen]="_delayedExpanded()"
|
|
871
|
+
[cdkConnectedOverlayPositions]="_positions"
|
|
872
|
+
[cdkConnectedOverlayWidth]="triggerWidth() > 0 ? triggerWidth() : 'auto'"
|
|
873
|
+
(backdropClick)="close()"
|
|
874
|
+
(detach)="close()"
|
|
875
|
+
(positionChange)="_positionChanges$.next($event)"
|
|
876
|
+
>
|
|
877
|
+
<ng-content />
|
|
878
|
+
</ng-template>
|
|
879
|
+
`,
|
|
880
|
+
}]
|
|
881
|
+
}], ctorParameters: () => [] });
|
|
882
|
+
|
|
883
|
+
const BrnSelectImports = [
|
|
884
|
+
BrnSelectComponent,
|
|
885
|
+
BrnSelectContentComponent,
|
|
886
|
+
BrnSelectTriggerDirective,
|
|
887
|
+
BrnSelectOptionDirective,
|
|
888
|
+
BrnSelectValueComponent,
|
|
889
|
+
BrnSelectScrollDownDirective,
|
|
890
|
+
BrnSelectScrollUpDirective,
|
|
891
|
+
BrnSelectGroupDirective,
|
|
892
|
+
BrnSelectLabelDirective,
|
|
893
|
+
];
|
|
894
|
+
class BrnSelectModule {
|
|
895
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
896
|
+
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectModule, imports: [BrnSelectComponent,
|
|
897
|
+
BrnSelectContentComponent,
|
|
898
|
+
BrnSelectTriggerDirective,
|
|
899
|
+
BrnSelectOptionDirective,
|
|
900
|
+
BrnSelectValueComponent,
|
|
901
|
+
BrnSelectScrollDownDirective,
|
|
902
|
+
BrnSelectScrollUpDirective,
|
|
903
|
+
BrnSelectGroupDirective,
|
|
904
|
+
BrnSelectLabelDirective], exports: [BrnSelectComponent,
|
|
905
|
+
BrnSelectContentComponent,
|
|
906
|
+
BrnSelectTriggerDirective,
|
|
907
|
+
BrnSelectOptionDirective,
|
|
908
|
+
BrnSelectValueComponent,
|
|
909
|
+
BrnSelectScrollDownDirective,
|
|
910
|
+
BrnSelectScrollUpDirective,
|
|
911
|
+
BrnSelectGroupDirective,
|
|
912
|
+
BrnSelectLabelDirective] });
|
|
913
|
+
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectModule, imports: [BrnSelectComponent] });
|
|
914
|
+
}
|
|
915
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.5", ngImport: i0, type: BrnSelectModule, decorators: [{
|
|
916
|
+
type: NgModule,
|
|
917
|
+
args: [{
|
|
918
|
+
imports: [...BrnSelectImports],
|
|
919
|
+
exports: [...BrnSelectImports],
|
|
920
|
+
}]
|
|
921
|
+
}] });
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Generated bundle index. Do not edit.
|
|
925
|
+
*/
|
|
926
|
+
|
|
927
|
+
export { BrnSelectComponent, BrnSelectContentComponent, BrnSelectGroupDirective, BrnSelectImports, BrnSelectLabelDirective, BrnSelectModule, BrnSelectOptionDirective, BrnSelectScrollDownDirective, BrnSelectScrollUpDirective, BrnSelectService, BrnSelectTriggerDirective, BrnSelectValueComponent };
|
|
928
|
+
//# sourceMappingURL=spartan-ng-brain-select.mjs.map
|