@siemens/element-ng 47.1.0 → 47.3.0
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/README.md +18 -6
- package/accordion/index.d.ts +9 -0
- package/accordion/package.json +3 -0
- package/accordion/si-accordion-hcollapse.service.d.ts +17 -0
- package/accordion/si-accordion.component.d.ts +37 -0
- package/accordion/si-accordion.module.d.ts +8 -0
- package/accordion/si-accordion.service.d.ts +17 -0
- package/accordion/si-collapsible-panel.component.d.ts +89 -0
- package/action-modal/index.d.ts +6 -0
- package/action-modal/package.json +3 -0
- package/action-modal/si-action-dialog.service.d.ts +49 -0
- package/action-modal/si-action-dialog.types.d.ts +92 -0
- package/action-modal/si-alert-dialog/si-alert-dialog.component.d.ts +32 -0
- package/action-modal/si-confirmation-dialog/si-confirmation-dialog.component.d.ts +40 -0
- package/action-modal/si-delete-confirmation-dialog/si-delete-confirmation-dialog.component.d.ts +45 -0
- package/action-modal/si-edit-discard-dialog/si-edit-discard-dialog.component.d.ts +68 -0
- package/auto-collapsable-list/index.d.ts +10 -0
- package/auto-collapsable-list/package.json +3 -0
- package/auto-collapsable-list/si-auto-collapsable-list-additional-content.directive.d.ts +6 -0
- package/auto-collapsable-list/si-auto-collapsable-list-item.directive.d.ts +29 -0
- package/auto-collapsable-list/si-auto-collapsable-list-measurable.class.d.ts +16 -0
- package/auto-collapsable-list/si-auto-collapsable-list-overflow-item.directive.d.ts +12 -0
- package/auto-collapsable-list/si-auto-collapsable-list.directive.d.ts +47 -0
- package/auto-collapsable-list/si-auto-collapsable-list.module.d.ts +10 -0
- package/autocomplete/index.d.ts +8 -0
- package/autocomplete/package.json +3 -0
- package/autocomplete/si-autocomplete-listbox.directive.d.ts +31 -0
- package/autocomplete/si-autocomplete-option.directive.d.ts +31 -0
- package/autocomplete/si-autocomplete.directive.d.ts +14 -0
- package/autocomplete/si-autocomplete.model.d.ts +7 -0
- package/autocomplete/si-autocomplete.module.d.ts +9 -0
- package/badge/index.d.ts +5 -0
- package/badge/package.json +3 -0
- package/badge/si-badge.component.d.ts +17 -0
- package/color-picker/index.d.ts +5 -0
- package/color-picker/package.json +3 -0
- package/color-picker/si-color-picker.component.d.ts +61 -0
- package/common/models/menu.model.d.ts +2 -2
- package/connection-strength/index.d.ts +6 -0
- package/connection-strength/package.json +3 -0
- package/connection-strength/si-connection-strength.component.d.ts +19 -0
- package/connection-strength/si-connection-strength.module.d.ts +7 -0
- package/content-action-bar/index.d.ts +7 -0
- package/content-action-bar/package.json +3 -0
- package/content-action-bar/si-content-action-bar-toggle.component.d.ts +6 -0
- package/content-action-bar/si-content-action-bar.component.d.ts +72 -0
- package/content-action-bar/si-content-action-bar.model.d.ts +9 -0
- package/content-action-bar/si-content-action-bar.module.d.ts +7 -0
- package/copyright-notice/index.d.ts +7 -0
- package/copyright-notice/package.json +3 -0
- package/copyright-notice/si-copyright-notice.component.d.ts +18 -0
- package/copyright-notice/si-copyright-notice.d.ts +23 -0
- package/copyright-notice/si-copyright-notice.module.d.ts +7 -0
- package/empty-state/index.d.ts +6 -0
- package/empty-state/package.json +3 -0
- package/empty-state/si-empty-state.component.d.ts +18 -0
- package/empty-state/si-empty-state.module.d.ts +7 -0
- package/fesm2022/siemens-element-ng-accordion.mjs +314 -0
- package/fesm2022/siemens-element-ng-accordion.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-action-modal.mjs +363 -0
- package/fesm2022/siemens-element-ng-action-modal.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-application-header.mjs +2 -2
- package/fesm2022/siemens-element-ng-application-header.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-auto-collapsable-list.mjs +312 -0
- package/fesm2022/siemens-element-ng-auto-collapsable-list.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-autocomplete.mjs +235 -0
- package/fesm2022/siemens-element-ng-autocomplete.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-badge.mjs +59 -0
- package/fesm2022/siemens-element-ng-badge.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-color-picker.mjs +176 -0
- package/fesm2022/siemens-element-ng-color-picker.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-common.mjs +1 -1
- package/fesm2022/siemens-element-ng-common.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-connection-strength.mjs +58 -0
- package/fesm2022/siemens-element-ng-connection-strength.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-content-action-bar.mjs +200 -0
- package/fesm2022/siemens-element-ng-content-action-bar.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-copyright-notice.mjs +71 -0
- package/fesm2022/siemens-element-ng-copyright-notice.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-empty-state.mjs +59 -0
- package/fesm2022/siemens-element-ng-empty-state.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-footer.mjs +55 -0
- package/fesm2022/siemens-element-ng-footer.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-form.mjs +827 -0
- package/fesm2022/siemens-element-ng-form.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-icon-status.mjs +65 -0
- package/fesm2022/siemens-element-ng-icon-status.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-icon.mjs +19 -2
- package/fesm2022/siemens-element-ng-icon.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-inline-notification.mjs +82 -0
- package/fesm2022/siemens-element-ng-inline-notification.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-language-switcher.mjs +90 -0
- package/fesm2022/siemens-element-ng-language-switcher.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-loading-spinner.mjs +248 -0
- package/fesm2022/siemens-element-ng-loading-spinner.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-menu.mjs +350 -0
- package/fesm2022/siemens-element-ng-menu.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-modal.mjs +345 -0
- package/fesm2022/siemens-element-ng-modal.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-number-input.mjs +267 -0
- package/fesm2022/siemens-element-ng-number-input.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-pagination.mjs +145 -0
- package/fesm2022/siemens-element-ng-pagination.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-password-strength.mjs +177 -0
- package/fesm2022/siemens-element-ng-password-strength.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-password-toggle.mjs +88 -0
- package/fesm2022/siemens-element-ng-password-toggle.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-pills-input.mjs +397 -0
- package/fesm2022/siemens-element-ng-pills-input.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-popover-next.mjs +259 -0
- package/fesm2022/siemens-element-ng-popover-next.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-popover.mjs +256 -0
- package/fesm2022/siemens-element-ng-popover.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-progressbar.mjs +83 -0
- package/fesm2022/siemens-element-ng-progressbar.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-select.mjs +1166 -0
- package/fesm2022/siemens-element-ng-select.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-skip-links.mjs +117 -0
- package/fesm2022/siemens-element-ng-skip-links.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-summary-chip.mjs +77 -0
- package/fesm2022/siemens-element-ng-summary-chip.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-summary-widget.mjs +77 -0
- package/fesm2022/siemens-element-ng-summary-widget.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-toast-notification.mjs +227 -0
- package/fesm2022/siemens-element-ng-toast-notification.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-tooltip.mjs +233 -0
- package/fesm2022/siemens-element-ng-tooltip.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-translate.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-typeahead.mjs +746 -0
- package/fesm2022/siemens-element-ng-typeahead.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-wizard.mjs +465 -0
- package/fesm2022/siemens-element-ng-wizard.mjs.map +1 -0
- package/footer/index.d.ts +6 -0
- package/footer/package.json +3 -0
- package/footer/si-footer.component.d.ts +14 -0
- package/footer/si-footer.module.d.ts +7 -0
- package/form/form-fieldset/si-form-fieldset.component.d.ts +40 -0
- package/form/index.d.ts +14 -0
- package/form/package.json +3 -0
- package/form/si-form-container/si-form-container.component.d.ts +155 -0
- package/form/si-form-item/si-form-field-native.control.d.ts +22 -0
- package/form/si-form-item/si-form-item.component.d.ts +90 -0
- package/form/si-form-item-control-input.directive.d.ts +18 -0
- package/form/si-form-item.control.d.ts +35 -0
- package/form/si-form-validation-error.model.d.ts +55 -0
- package/form/si-form-validation-error.provider.d.ts +11 -0
- package/form/si-form-validation-error.service.d.ts +42 -0
- package/form/si-form-validation-tooltip/si-form-validation-tooltip.component.d.ts +13 -0
- package/form/si-form-validation-tooltip/si-form-validation-tooltip.directive.d.ts +42 -0
- package/form/si-form.module.d.ts +25 -0
- package/icon/element-icons.d.ts +17 -0
- package/icon-status/index.d.ts +6 -0
- package/icon-status/package.json +3 -0
- package/icon-status/si-icon-status.component.d.ts +24 -0
- package/icon-status/si-icon-status.module.d.ts +7 -0
- package/inline-notification/index.d.ts +6 -0
- package/inline-notification/package.json +3 -0
- package/inline-notification/si-inline-notification.component.d.ts +42 -0
- package/inline-notification/si-inline-notification.module.d.ts +7 -0
- package/language-switcher/index.d.ts +7 -0
- package/language-switcher/iso-language-value.d.ts +14 -0
- package/language-switcher/package.json +3 -0
- package/language-switcher/si-language-switcher.component.d.ts +32 -0
- package/language-switcher/si-language-switcher.module.d.ts +7 -0
- package/loading-spinner/index.d.ts +9 -0
- package/loading-spinner/package.json +3 -0
- package/loading-spinner/si-loading-button.component.d.ts +31 -0
- package/loading-spinner/si-loading-spinner.component.d.ts +32 -0
- package/loading-spinner/si-loading-spinner.directive.d.ts +36 -0
- package/loading-spinner/si-loading-spinner.module.d.ts +8 -0
- package/loading-spinner/si-loading-spinner.service.d.ts +18 -0
- package/menu/index.d.ts +15 -0
- package/menu/package.json +3 -0
- package/menu/si-menu-action.service.d.ts +13 -0
- package/menu/si-menu-bar.directive.d.ts +12 -0
- package/menu/si-menu-divider.directive.d.ts +5 -0
- package/menu/si-menu-factory-item-guard.directive.d.ts +11 -0
- package/menu/si-menu-factory.component.d.ts +15 -0
- package/menu/si-menu-header.directive.d.ts +5 -0
- package/menu/si-menu-item-base.directive.d.ts +16 -0
- package/menu/si-menu-item-checkbox.component.d.ts +10 -0
- package/menu/si-menu-item-radio.component.d.ts +10 -0
- package/menu/si-menu-item.component.d.ts +10 -0
- package/menu/si-menu-model.d.ts +91 -0
- package/menu/si-menu.directive.d.ts +6 -0
- package/menu/si-menu.module.d.ts +14 -0
- package/modal/index.d.ts +7 -0
- package/modal/modal.helpers.d.ts +8 -0
- package/modal/modalref.d.ts +64 -0
- package/modal/package.json +3 -0
- package/modal/si-modal.component.d.ts +32 -0
- package/modal/si-modal.service.d.ts +57 -0
- package/number-input/index.d.ts +6 -0
- package/number-input/package.json +3 -0
- package/number-input/si-number-input.component.d.ts +106 -0
- package/number-input/si-number-input.module.d.ts +7 -0
- package/package.json +139 -3
- package/pagination/index.d.ts +6 -0
- package/pagination/package.json +3 -0
- package/pagination/si-pagination.component.d.ts +65 -0
- package/pagination/si-pagination.module.d.ts +7 -0
- package/password-strength/index.d.ts +7 -0
- package/password-strength/package.json +3 -0
- package/password-strength/si-password-strength.component.d.ts +25 -0
- package/password-strength/si-password-strength.directive.d.ts +54 -0
- package/password-strength/si-password-strength.module.d.ts +8 -0
- package/password-toggle/index.d.ts +6 -0
- package/password-toggle/package.json +3 -0
- package/password-toggle/si-password-toggle.component.d.ts +39 -0
- package/password-toggle/si-password-toggle.module.d.ts +7 -0
- package/pills-input/index.d.ts +9 -0
- package/pills-input/package.json +3 -0
- package/pills-input/si-input-pill.component.d.ts +9 -0
- package/pills-input/si-pills-input-csv.directive.d.ts +8 -0
- package/pills-input/si-pills-input-email.directive.d.ts +10 -0
- package/pills-input/si-pills-input-pattern-base.d.ts +19 -0
- package/pills-input/si-pills-input-value-handler.d.ts +12 -0
- package/pills-input/si-pills-input.component.d.ts +87 -0
- package/pills-input/si-pills-input.module.d.ts +9 -0
- package/popover/index.d.ts +6 -0
- package/popover/package.json +3 -0
- package/popover/si-popover.component.d.ts +26 -0
- package/popover/si-popover.directive.d.ts +89 -0
- package/popover/si-popover.module.d.ts +7 -0
- package/popover-next/index.d.ts +7 -0
- package/popover-next/package.json +3 -0
- package/popover-next/si-popover-description.directive.d.ts +7 -0
- package/popover-next/si-popover-next.directive.d.ts +61 -0
- package/popover-next/si-popover-title.directive.d.ts +7 -0
- package/popover-next/si-popover.component.d.ts +27 -0
- package/progressbar/index.d.ts +6 -0
- package/progressbar/package.json +3 -0
- package/progressbar/si-progressbar.component.d.ts +43 -0
- package/progressbar/si-progressbar.module.d.ts +7 -0
- package/select/index.d.ts +18 -0
- package/select/options/si-select-complex-options.directive.d.ts +69 -0
- package/select/options/si-select-lazy-options.directive.d.ts +38 -0
- package/select/options/si-select-option.source.d.ts +49 -0
- package/select/options/si-select-options-strategy.base.d.ts +35 -0
- package/select/options/si-select-options-strategy.d.ts +37 -0
- package/select/options/si-select-simple-options.directive.d.ts +34 -0
- package/select/package.json +3 -0
- package/select/select-input/si-select-input.component.d.ts +43 -0
- package/select/select-list/si-select-list-has-filter.component.d.ts +20 -0
- package/select/select-list/si-select-list.base.d.ts +37 -0
- package/select/select-list/si-select-list.component.d.ts +15 -0
- package/select/select-option/si-select-option-row.component.d.ts +16 -0
- package/select/select-option/si-select-option.component.d.ts +9 -0
- package/select/selection/si-select-multi-value.directive.d.ts +26 -0
- package/select/selection/si-select-selection-strategy.d.ts +58 -0
- package/select/selection/si-select-single-value.directive.d.ts +26 -0
- package/select/si-select-action.directive.d.ts +12 -0
- package/select/si-select-actions.directive.d.ts +5 -0
- package/select/si-select-group-template.directive.d.ts +20 -0
- package/select/si-select-option-row-template.directive.d.ts +9 -0
- package/select/si-select-option-template.directive.d.ts +21 -0
- package/select/si-select.component.d.ts +96 -0
- package/select/si-select.module.d.ts +15 -0
- package/select/si-select.types.d.ts +65 -0
- package/skip-links/index.d.ts +5 -0
- package/skip-links/package.json +3 -0
- package/skip-links/si-skip-link-target.directive.d.ts +27 -0
- package/skip-links/si-skip-links.component.d.ts +9 -0
- package/skip-links/skip-link.service.d.ts +14 -0
- package/summary-chip/index.d.ts +5 -0
- package/summary-chip/package.json +3 -0
- package/summary-chip/si-summary-chip.component.d.ts +44 -0
- package/summary-widget/index.d.ts +5 -0
- package/summary-widget/package.json +3 -0
- package/summary-widget/si-summary-widget.component.d.ts +44 -0
- package/template-i18n.json +47 -1
- package/toast-notification/index.d.ts +6 -0
- package/toast-notification/package.json +3 -0
- package/toast-notification/si-toast-notification/si-toast-notification.component.d.ts +17 -0
- package/toast-notification/si-toast-notification-drawer/si-toast-notification-drawer.component.d.ts +9 -0
- package/toast-notification/si-toast-notification.service.d.ts +41 -0
- package/toast-notification/si-toast.model.d.ts +25 -0
- package/tooltip/index.d.ts +7 -0
- package/tooltip/package.json +3 -0
- package/tooltip/si-tooltip.component.d.ts +25 -0
- package/tooltip/si-tooltip.directive.d.ts +45 -0
- package/tooltip/si-tooltip.module.d.ts +7 -0
- package/tooltip/si-tooltip.service.d.ts +44 -0
- package/translate/si-translatable-keys.interface.d.ts +46 -0
- package/typeahead/index.d.ts +8 -0
- package/typeahead/package.json +3 -0
- package/typeahead/si-typeahead-item-template.directive.d.ts +7 -0
- package/typeahead/si-typeahead.component.d.ts +22 -0
- package/typeahead/si-typeahead.directive.d.ts +196 -0
- package/typeahead/si-typeahead.model.d.ts +60 -0
- package/typeahead/si-typeahead.module.d.ts +8 -0
- package/typeahead/si-typeahead.sorting.d.ts +10 -0
- package/wizard/index.d.ts +7 -0
- package/wizard/package.json +3 -0
- package/wizard/si-wizard-step.component.d.ts +21 -0
- package/wizard/si-wizard.component.d.ts +196 -0
- package/wizard/si-wizard.module.d.ts +8 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, Directive, input, booleanAttribute, signal, computed, contentChild, ChangeDetectorRef, ContentChildren, NgModule } from '@angular/core';
|
|
3
|
+
import { ResizeObserverService } from '@siemens/element-ng/resize-observer';
|
|
4
|
+
import { map, distinctUntilChanged, shareReplay, switchMap, startWith, auditTime } from 'rxjs/operators';
|
|
5
|
+
import { BehaviorSubject, of, combineLatest } from 'rxjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Copyright Siemens 2016 - 2025.
|
|
9
|
+
* SPDX-License-Identifier: MIT
|
|
10
|
+
*/
|
|
11
|
+
class SiAutoCollapsableListMeasurable {
|
|
12
|
+
/** Emits on element width changes. */
|
|
13
|
+
size$;
|
|
14
|
+
elementRef = inject((ElementRef));
|
|
15
|
+
resizeObserverService = inject(ResizeObserverService);
|
|
16
|
+
ngAfterViewInit() {
|
|
17
|
+
this.size$ = this.resizeObserverService
|
|
18
|
+
.observe(this.elementRef.nativeElement, 0, true, true)
|
|
19
|
+
.pipe(map(size => size.width), distinctUntilChanged(), shareReplay(1));
|
|
20
|
+
}
|
|
21
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListMeasurable, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
22
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: SiAutoCollapsableListMeasurable, isStandalone: true, ngImport: i0 });
|
|
23
|
+
}
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListMeasurable, decorators: [{
|
|
25
|
+
type: Directive
|
|
26
|
+
}] });
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Copyright Siemens 2016 - 2025.
|
|
30
|
+
* SPDX-License-Identifier: MIT
|
|
31
|
+
*/
|
|
32
|
+
class SiAutoCollapsableListItemDirective extends SiAutoCollapsableListMeasurable {
|
|
33
|
+
/**
|
|
34
|
+
* Hide this item even if enough space is available.
|
|
35
|
+
* When calculating the overall available size, this item is still considered when forceHide=true
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue false
|
|
38
|
+
*/
|
|
39
|
+
forceHide = input(false, { transform: booleanAttribute });
|
|
40
|
+
/**
|
|
41
|
+
* True if enough space is available for this item.
|
|
42
|
+
*
|
|
43
|
+
* @defaultValue false
|
|
44
|
+
*/
|
|
45
|
+
canBeVisible = signal(false);
|
|
46
|
+
/**
|
|
47
|
+
* True if this item is actually visible to the user
|
|
48
|
+
*/
|
|
49
|
+
isVisible = computed(() => this.canBeVisible() && !this.forceHide());
|
|
50
|
+
ngAfterViewInit() {
|
|
51
|
+
if (getComputedStyle(this.elementRef.nativeElement).display === 'inline') {
|
|
52
|
+
console.error('siAutoCollapsibleListItem does not work on items with display="inline"');
|
|
53
|
+
}
|
|
54
|
+
super.ngAfterViewInit();
|
|
55
|
+
}
|
|
56
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListItemDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
57
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.6", type: SiAutoCollapsableListItemDirective, isStandalone: true, selector: "[siAutoCollapsableListItem]", inputs: { forceHide: { classPropertyName: "forceHide", publicName: "forceHide", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.visibility": "isVisible() ? \"visible\" : \"hidden\"", "style.position": "isVisible() ? \"\" : \"absolute\"", "style.z-index": "isVisible() ? \"\" : \"-1\"" } }, exportAs: ["siAutoCollapsableListItem"], usesInheritance: true, ngImport: i0 });
|
|
58
|
+
}
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListItemDirective, decorators: [{
|
|
60
|
+
type: Directive,
|
|
61
|
+
args: [{
|
|
62
|
+
selector: '[siAutoCollapsableListItem]',
|
|
63
|
+
exportAs: 'siAutoCollapsableListItem',
|
|
64
|
+
host: {
|
|
65
|
+
'[style.visibility]': 'isVisible() ? "visible" : "hidden"',
|
|
66
|
+
'[style.position]': 'isVisible() ? "" : "absolute"',
|
|
67
|
+
// Ensure hidden items are behind the visible ones. Otherwise, the visible ones are not clickable
|
|
68
|
+
'[style.z-index]': 'isVisible() ? "" : "-1"'
|
|
69
|
+
}
|
|
70
|
+
}]
|
|
71
|
+
}] });
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Copyright Siemens 2016 - 2025.
|
|
75
|
+
* SPDX-License-Identifier: MIT
|
|
76
|
+
*/
|
|
77
|
+
class SiAutoCollapsableListAdditionalContentDirective extends SiAutoCollapsableListMeasurable {
|
|
78
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListAdditionalContentDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
79
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: SiAutoCollapsableListAdditionalContentDirective, isStandalone: true, selector: "[siAutoCollapsableListAdditionalContent]", usesInheritance: true, ngImport: i0 });
|
|
80
|
+
}
|
|
81
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListAdditionalContentDirective, decorators: [{
|
|
82
|
+
type: Directive,
|
|
83
|
+
args: [{
|
|
84
|
+
selector: '[siAutoCollapsableListAdditionalContent]'
|
|
85
|
+
}]
|
|
86
|
+
}] });
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Copyright Siemens 2016 - 2025.
|
|
90
|
+
* SPDX-License-Identifier: MIT
|
|
91
|
+
*/
|
|
92
|
+
class SiAutoCollapsableListOverflowItemDirective extends SiAutoCollapsableListItemDirective {
|
|
93
|
+
/**
|
|
94
|
+
* Number of hidden items.
|
|
95
|
+
*
|
|
96
|
+
* @defaultValue 0
|
|
97
|
+
*/
|
|
98
|
+
hiddenItemCount = 0;
|
|
99
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListOverflowItemDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
100
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: SiAutoCollapsableListOverflowItemDirective, isStandalone: true, selector: "[siAutoCollapsableListOverflowItem]", exportAs: ["siAutoCollapsableListOverflowItem"], usesInheritance: true, ngImport: i0 });
|
|
101
|
+
}
|
|
102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListOverflowItemDirective, decorators: [{
|
|
103
|
+
type: Directive,
|
|
104
|
+
args: [{
|
|
105
|
+
selector: '[siAutoCollapsableListOverflowItem]',
|
|
106
|
+
exportAs: 'siAutoCollapsableListOverflowItem'
|
|
107
|
+
}]
|
|
108
|
+
}] });
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Copyright Siemens 2016 - 2025.
|
|
112
|
+
* SPDX-License-Identifier: MIT
|
|
113
|
+
*/
|
|
114
|
+
class SiAutoCollapsableListDirective {
|
|
115
|
+
/**
|
|
116
|
+
* The items which are displayed in the siAutoCollapsableList.
|
|
117
|
+
*/
|
|
118
|
+
items;
|
|
119
|
+
overflowItem = contentChild(SiAutoCollapsableListOverflowItemDirective);
|
|
120
|
+
additionalContent;
|
|
121
|
+
/** @defaultValue true */
|
|
122
|
+
siAutoCollapsableList = input(true, { transform: booleanAttribute });
|
|
123
|
+
/**
|
|
124
|
+
* The (flex) gap in pixels, will automatically be set if a pixel value is used in CSS.
|
|
125
|
+
*/
|
|
126
|
+
gap = input();
|
|
127
|
+
/**
|
|
128
|
+
* The element which size is available for the content of the siAutoCollapsableList.
|
|
129
|
+
*
|
|
130
|
+
* @defaultValue undefined
|
|
131
|
+
*/
|
|
132
|
+
containerElement = input(undefined, {
|
|
133
|
+
alias: 'siAutoCollapsableListContainerElement'
|
|
134
|
+
});
|
|
135
|
+
resizeSubscription;
|
|
136
|
+
disableInitSubscription;
|
|
137
|
+
elementRef = inject(ElementRef);
|
|
138
|
+
resizeObserverService = inject(ResizeObserverService);
|
|
139
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
140
|
+
containerElementSubject = new BehaviorSubject(this.elementRef.nativeElement);
|
|
141
|
+
/**
|
|
142
|
+
* The same as {@link gap}, but automatically read from the computed styles.
|
|
143
|
+
* Used if not set by user.
|
|
144
|
+
*/
|
|
145
|
+
computedGap = 0;
|
|
146
|
+
ngAfterViewInit() {
|
|
147
|
+
if (this.siAutoCollapsableList()) {
|
|
148
|
+
this.readGapSize();
|
|
149
|
+
this.setupResizeListener();
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this.reset();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
ngOnChanges(changes) {
|
|
156
|
+
if (changes.siAutoCollapsableList) {
|
|
157
|
+
const siAutoCollapsableList = this.siAutoCollapsableList();
|
|
158
|
+
if (!siAutoCollapsableList && this.resizeSubscription) {
|
|
159
|
+
this.reset();
|
|
160
|
+
}
|
|
161
|
+
else if (siAutoCollapsableList && !this.resizeSubscription && this.items) {
|
|
162
|
+
this.setupResizeListener();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (changes.containerElement) {
|
|
166
|
+
this.containerElementSubject.next(this.containerElement() ?? this.elementRef.nativeElement);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
ngOnDestroy() {
|
|
170
|
+
this.resizeSubscription?.unsubscribe();
|
|
171
|
+
this.disableInitSubscription?.unsubscribe();
|
|
172
|
+
this.containerElementSubject.complete();
|
|
173
|
+
}
|
|
174
|
+
setupResizeListener() {
|
|
175
|
+
this.disableInitSubscription?.unsubscribe();
|
|
176
|
+
const containerSize$ = this.containerElementSubject.pipe(switchMap(element => this.resizeObserverService.observe(element, 0, true, true)), map(size => size.width), distinctUntilChanged(), map(size => {
|
|
177
|
+
const { paddingInlineStart, paddingInlineEnd } = getComputedStyle(this.containerElement() ?? this.elementRef.nativeElement);
|
|
178
|
+
return size - parseFloat(paddingInlineStart) - parseFloat(paddingInlineEnd);
|
|
179
|
+
}));
|
|
180
|
+
const itemSizes$ = this.items.changes.pipe(startWith(this.items), switchMap((items) => !items.length
|
|
181
|
+
? of([])
|
|
182
|
+
: combineLatest(items.map(item => item.size$.pipe(map(size => ({
|
|
183
|
+
size,
|
|
184
|
+
directive: item
|
|
185
|
+
})))))));
|
|
186
|
+
const additionalContentSizes$ = this.additionalContent.changes.pipe(startWith(this.additionalContent), switchMap((additionalContent) => combineLatest(additionalContent.map(item => item.size$))), startWith([]));
|
|
187
|
+
this.resizeSubscription = combineLatest([
|
|
188
|
+
containerSize$,
|
|
189
|
+
this.overflowItem()?.size$ ?? of(0),
|
|
190
|
+
itemSizes$,
|
|
191
|
+
additionalContentSizes$
|
|
192
|
+
])
|
|
193
|
+
.pipe(auditTime(0))
|
|
194
|
+
.subscribe(([containerSize, overflowItemSize, items, additionalContentSizes]) => this.updateItemVisibility(containerSize, overflowItemSize, items, additionalContentSizes));
|
|
195
|
+
}
|
|
196
|
+
updateItemVisibility(containerSize, overflowItemSize, items, additionalContent) {
|
|
197
|
+
let remainingSpace = containerSize - additionalContent.reduce((a, b) => a + b, 0);
|
|
198
|
+
const itemsRemaining = items.slice();
|
|
199
|
+
const gap = this.gap() ?? this.computedGap;
|
|
200
|
+
while (remainingSpace > 0 && itemsRemaining.length) {
|
|
201
|
+
const item = itemsRemaining.shift();
|
|
202
|
+
if (remainingSpace - item.size - gap - overflowItemSize >= 0) {
|
|
203
|
+
// There is space for the item and an overflow item.
|
|
204
|
+
item.directive.canBeVisible.set(true);
|
|
205
|
+
remainingSpace -= item.size + gap;
|
|
206
|
+
}
|
|
207
|
+
else if (!itemsRemaining.length &&
|
|
208
|
+
(remainingSpace - item.size >= 0 || overflowItemSize >= item.size)) {
|
|
209
|
+
// There are no other items remaining and there is enough space or the overflow item is biggger than the current one.
|
|
210
|
+
item.directive.canBeVisible.set(true);
|
|
211
|
+
remainingSpace = 0;
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
// There is no space for the item.
|
|
215
|
+
remainingSpace = 0;
|
|
216
|
+
item.directive.canBeVisible.set(false);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
itemsRemaining.forEach(item => item.directive.canBeVisible.set(false));
|
|
220
|
+
const overflowItem = this.overflowItem();
|
|
221
|
+
if (overflowItem) {
|
|
222
|
+
overflowItem.hiddenItemCount = this.items.filter(item => !item.canBeVisible()).length;
|
|
223
|
+
overflowItem.canBeVisible.set(overflowItem.hiddenItemCount !== 0);
|
|
224
|
+
}
|
|
225
|
+
this.changeDetectorRef.markForCheck();
|
|
226
|
+
}
|
|
227
|
+
reset() {
|
|
228
|
+
this.resizeSubscription?.unsubscribe();
|
|
229
|
+
this.resizeSubscription = undefined;
|
|
230
|
+
this.disableInitSubscription = this.items.changes.subscribe((items) => queueMicrotask(() => {
|
|
231
|
+
items.forEach(item => item.canBeVisible.set(true));
|
|
232
|
+
}));
|
|
233
|
+
this.items.notifyOnChanges();
|
|
234
|
+
const overflowItem = this.overflowItem();
|
|
235
|
+
if (overflowItem) {
|
|
236
|
+
queueMicrotask(() => {
|
|
237
|
+
overflowItem.canBeVisible.set(false);
|
|
238
|
+
overflowItem.hiddenItemCount = 0;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
readGapSize() {
|
|
243
|
+
const { gap } = getComputedStyle(this.containerElement() ?? this.elementRef.nativeElement);
|
|
244
|
+
if (gap.endsWith('px') || gap === '0') {
|
|
245
|
+
this.computedGap = parseFloat(gap);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
249
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.6", type: SiAutoCollapsableListDirective, isStandalone: true, selector: "[siAutoCollapsableList]", inputs: { siAutoCollapsableList: { classPropertyName: "siAutoCollapsableList", publicName: "siAutoCollapsableList", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, containerElement: { classPropertyName: "containerElement", publicName: "siAutoCollapsableListContainerElement", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.overflow": "siAutoCollapsableList() ? \"hidden\" : \"\"" }, styleAttribute: "position: relative" }, queries: [{ propertyName: "overflowItem", first: true, predicate: SiAutoCollapsableListOverflowItemDirective, descendants: true, isSignal: true }, { propertyName: "items", predicate: SiAutoCollapsableListItemDirective }, { propertyName: "additionalContent", predicate: SiAutoCollapsableListAdditionalContentDirective }], exportAs: ["siAutoCollapsableList"], usesOnChanges: true, ngImport: i0 });
|
|
250
|
+
}
|
|
251
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListDirective, decorators: [{
|
|
252
|
+
type: Directive,
|
|
253
|
+
args: [{
|
|
254
|
+
selector: '[siAutoCollapsableList]',
|
|
255
|
+
exportAs: 'siAutoCollapsableList',
|
|
256
|
+
host: {
|
|
257
|
+
style: 'position: relative',
|
|
258
|
+
'[style.overflow]': 'siAutoCollapsableList() ? "hidden" : ""'
|
|
259
|
+
}
|
|
260
|
+
}]
|
|
261
|
+
}], propDecorators: { items: [{
|
|
262
|
+
type: ContentChildren,
|
|
263
|
+
args: [SiAutoCollapsableListItemDirective]
|
|
264
|
+
}], additionalContent: [{
|
|
265
|
+
type: ContentChildren,
|
|
266
|
+
args: [SiAutoCollapsableListAdditionalContentDirective]
|
|
267
|
+
}] } });
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Copyright Siemens 2016 - 2025.
|
|
271
|
+
* SPDX-License-Identifier: MIT
|
|
272
|
+
*/
|
|
273
|
+
class SiAutoCollapsableListModule {
|
|
274
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
275
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListModule, imports: [SiAutoCollapsableListAdditionalContentDirective,
|
|
276
|
+
SiAutoCollapsableListDirective,
|
|
277
|
+
SiAutoCollapsableListItemDirective,
|
|
278
|
+
SiAutoCollapsableListOverflowItemDirective], exports: [SiAutoCollapsableListAdditionalContentDirective,
|
|
279
|
+
SiAutoCollapsableListDirective,
|
|
280
|
+
SiAutoCollapsableListItemDirective,
|
|
281
|
+
SiAutoCollapsableListOverflowItemDirective] });
|
|
282
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListModule });
|
|
283
|
+
}
|
|
284
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutoCollapsableListModule, decorators: [{
|
|
285
|
+
type: NgModule,
|
|
286
|
+
args: [{
|
|
287
|
+
imports: [
|
|
288
|
+
SiAutoCollapsableListAdditionalContentDirective,
|
|
289
|
+
SiAutoCollapsableListDirective,
|
|
290
|
+
SiAutoCollapsableListItemDirective,
|
|
291
|
+
SiAutoCollapsableListOverflowItemDirective
|
|
292
|
+
],
|
|
293
|
+
exports: [
|
|
294
|
+
SiAutoCollapsableListAdditionalContentDirective,
|
|
295
|
+
SiAutoCollapsableListDirective,
|
|
296
|
+
SiAutoCollapsableListItemDirective,
|
|
297
|
+
SiAutoCollapsableListOverflowItemDirective
|
|
298
|
+
]
|
|
299
|
+
}]
|
|
300
|
+
}] });
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Copyright Siemens 2016 - 2025.
|
|
304
|
+
* SPDX-License-Identifier: MIT
|
|
305
|
+
*/
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Generated bundle index. Do not edit.
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
export { SiAutoCollapsableListAdditionalContentDirective, SiAutoCollapsableListDirective, SiAutoCollapsableListItemDirective, SiAutoCollapsableListMeasurable, SiAutoCollapsableListModule, SiAutoCollapsableListOverflowItemDirective };
|
|
312
|
+
//# sourceMappingURL=siemens-element-ng-auto-collapsable-list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"siemens-element-ng-auto-collapsable-list.mjs","sources":["../../../../projects/element-ng/auto-collapsable-list/si-auto-collapsable-list-measurable.class.ts","../../../../projects/element-ng/auto-collapsable-list/si-auto-collapsable-list-item.directive.ts","../../../../projects/element-ng/auto-collapsable-list/si-auto-collapsable-list-additional-content.directive.ts","../../../../projects/element-ng/auto-collapsable-list/si-auto-collapsable-list-overflow-item.directive.ts","../../../../projects/element-ng/auto-collapsable-list/si-auto-collapsable-list.directive.ts","../../../../projects/element-ng/auto-collapsable-list/si-auto-collapsable-list.module.ts","../../../../projects/element-ng/auto-collapsable-list/index.ts","../../../../projects/element-ng/auto-collapsable-list/siemens-element-ng-auto-collapsable-list.ts"],"sourcesContent":["/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport { AfterViewInit, Directive, ElementRef, inject } from '@angular/core';\nimport { ResizeObserverService } from '@siemens/element-ng/resize-observer';\nimport { Observable } from 'rxjs';\nimport { distinctUntilChanged, map, shareReplay } from 'rxjs/operators';\n\n@Directive()\nexport class SiAutoCollapsableListMeasurable implements AfterViewInit {\n /** Emits on element width changes. */\n size$!: Observable<number>;\n\n protected readonly elementRef = inject(ElementRef<HTMLElement>);\n private readonly resizeObserverService = inject(ResizeObserverService);\n\n ngAfterViewInit(): void {\n this.size$ = this.resizeObserverService\n .observe(this.elementRef.nativeElement, 0, true, true)\n .pipe(\n map(size => size.width),\n distinctUntilChanged(),\n shareReplay(1)\n );\n }\n}\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport { AfterViewInit, booleanAttribute, computed, Directive, input, signal } from '@angular/core';\n\nimport { SiAutoCollapsableListMeasurable } from './si-auto-collapsable-list-measurable.class';\n\n@Directive({\n selector: '[siAutoCollapsableListItem]',\n exportAs: 'siAutoCollapsableListItem',\n host: {\n '[style.visibility]': 'isVisible() ? \"visible\" : \"hidden\"',\n '[style.position]': 'isVisible() ? \"\" : \"absolute\"',\n // Ensure hidden items are behind the visible ones. Otherwise, the visible ones are not clickable\n '[style.z-index]': 'isVisible() ? \"\" : \"-1\"'\n }\n})\nexport class SiAutoCollapsableListItemDirective\n extends SiAutoCollapsableListMeasurable\n implements AfterViewInit\n{\n /**\n * Hide this item even if enough space is available.\n * When calculating the overall available size, this item is still considered when forceHide=true\n *\n * @defaultValue false\n */\n readonly forceHide = input(false, { transform: booleanAttribute });\n\n /**\n * True if enough space is available for this item.\n *\n * @defaultValue false\n */\n readonly canBeVisible = signal<boolean>(false);\n\n /**\n * True if this item is actually visible to the user\n */\n readonly isVisible = computed(() => this.canBeVisible() && !this.forceHide());\n\n override ngAfterViewInit(): void {\n if (getComputedStyle(this.elementRef.nativeElement).display === 'inline') {\n console.error('siAutoCollapsibleListItem does not work on items with display=\"inline\"');\n }\n super.ngAfterViewInit();\n }\n}\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport { Directive } from '@angular/core';\n\nimport { SiAutoCollapsableListMeasurable } from './si-auto-collapsable-list-measurable.class';\n\n@Directive({\n selector: '[siAutoCollapsableListAdditionalContent]'\n})\nexport class SiAutoCollapsableListAdditionalContentDirective extends SiAutoCollapsableListMeasurable {}\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport { Directive } from '@angular/core';\n\nimport { SiAutoCollapsableListItemDirective } from './si-auto-collapsable-list-item.directive';\n\n@Directive({\n selector: '[siAutoCollapsableListOverflowItem]',\n exportAs: 'siAutoCollapsableListOverflowItem'\n})\nexport class SiAutoCollapsableListOverflowItemDirective extends SiAutoCollapsableListItemDirective {\n /**\n * Number of hidden items.\n *\n * @defaultValue 0\n */\n hiddenItemCount = 0;\n}\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport {\n AfterViewInit,\n booleanAttribute,\n ChangeDetectorRef,\n contentChild,\n ContentChildren,\n Directive,\n ElementRef,\n inject,\n input,\n OnChanges,\n OnDestroy,\n QueryList,\n SimpleChanges\n} from '@angular/core';\nimport { ResizeObserverService } from '@siemens/element-ng/resize-observer';\nimport { BehaviorSubject, combineLatest, of, Subscription } from 'rxjs';\nimport { auditTime, distinctUntilChanged, map, startWith, switchMap } from 'rxjs/operators';\n\nimport { SiAutoCollapsableListAdditionalContentDirective } from './si-auto-collapsable-list-additional-content.directive';\nimport { SiAutoCollapsableListItemDirective } from './si-auto-collapsable-list-item.directive';\nimport { SiAutoCollapsableListOverflowItemDirective } from './si-auto-collapsable-list-overflow-item.directive';\n\n@Directive({\n selector: '[siAutoCollapsableList]',\n exportAs: 'siAutoCollapsableList',\n host: {\n style: 'position: relative',\n '[style.overflow]': 'siAutoCollapsableList() ? \"hidden\" : \"\"'\n }\n})\nexport class SiAutoCollapsableListDirective implements AfterViewInit, OnChanges, OnDestroy {\n /**\n * The items which are displayed in the siAutoCollapsableList.\n */\n @ContentChildren(SiAutoCollapsableListItemDirective)\n items!: QueryList<SiAutoCollapsableListItemDirective>;\n\n private readonly overflowItem = contentChild(SiAutoCollapsableListOverflowItemDirective);\n\n @ContentChildren(SiAutoCollapsableListAdditionalContentDirective)\n private additionalContent!: QueryList<SiAutoCollapsableListAdditionalContentDirective>;\n\n /** @defaultValue true */\n readonly siAutoCollapsableList = input(true, { transform: booleanAttribute });\n\n /**\n * The (flex) gap in pixels, will automatically be set if a pixel value is used in CSS.\n */\n readonly gap = input<number>();\n\n /**\n * The element which size is available for the content of the siAutoCollapsableList.\n *\n * @defaultValue undefined\n */\n readonly containerElement = input<HTMLElement | undefined | null>(undefined, {\n alias: 'siAutoCollapsableListContainerElement'\n });\n\n private resizeSubscription?: Subscription;\n private disableInitSubscription?: Subscription;\n private readonly elementRef = inject(ElementRef);\n private readonly resizeObserverService = inject(ResizeObserverService);\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n private readonly containerElementSubject = new BehaviorSubject<HTMLElement | null>(\n this.elementRef.nativeElement\n );\n\n /**\n * The same as {@link gap}, but automatically read from the computed styles.\n * Used if not set by user.\n */\n private computedGap = 0;\n\n ngAfterViewInit(): void {\n if (this.siAutoCollapsableList()) {\n this.readGapSize();\n this.setupResizeListener();\n } else {\n this.reset();\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.siAutoCollapsableList) {\n const siAutoCollapsableList = this.siAutoCollapsableList();\n if (!siAutoCollapsableList && this.resizeSubscription) {\n this.reset();\n } else if (siAutoCollapsableList && !this.resizeSubscription && this.items) {\n this.setupResizeListener();\n }\n }\n\n if (changes.containerElement) {\n this.containerElementSubject.next(this.containerElement() ?? this.elementRef.nativeElement);\n }\n }\n\n ngOnDestroy(): void {\n this.resizeSubscription?.unsubscribe();\n this.disableInitSubscription?.unsubscribe();\n this.containerElementSubject.complete();\n }\n\n private setupResizeListener(): void {\n this.disableInitSubscription?.unsubscribe();\n const containerSize$ = this.containerElementSubject.pipe(\n switchMap(element => this.resizeObserverService.observe(element!, 0, true, true)),\n map(size => size.width),\n distinctUntilChanged(),\n map(size => {\n const { paddingInlineStart, paddingInlineEnd } = getComputedStyle(\n this.containerElement() ?? this.elementRef.nativeElement\n );\n return size - parseFloat(paddingInlineStart) - parseFloat(paddingInlineEnd);\n })\n );\n\n const itemSizes$ = this.items.changes.pipe(\n startWith(this.items),\n switchMap((items: QueryList<SiAutoCollapsableListItemDirective>) =>\n !items.length\n ? of([])\n : combineLatest(\n items.map(item =>\n item.size$.pipe(\n map(size => ({\n size,\n directive: item\n }))\n )\n )\n )\n )\n );\n const additionalContentSizes$ = this.additionalContent.changes.pipe(\n startWith(this.additionalContent),\n switchMap((additionalContent: QueryList<SiAutoCollapsableListAdditionalContentDirective>) =>\n combineLatest(additionalContent.map(item => item.size$))\n ),\n startWith([])\n );\n\n this.resizeSubscription = combineLatest([\n containerSize$,\n this.overflowItem()?.size$ ?? of(0),\n itemSizes$,\n additionalContentSizes$\n ])\n .pipe(auditTime(0))\n .subscribe(([containerSize, overflowItemSize, items, additionalContentSizes]) =>\n this.updateItemVisibility(containerSize, overflowItemSize, items, additionalContentSizes)\n );\n }\n\n private updateItemVisibility(\n containerSize: number,\n overflowItemSize: number,\n items: { size: number; directive: SiAutoCollapsableListItemDirective }[],\n additionalContent: number[]\n ): void {\n let remainingSpace = containerSize - additionalContent.reduce((a, b) => a + b, 0);\n\n const itemsRemaining = items.slice();\n\n const gap = this.gap() ?? this.computedGap;\n\n while (remainingSpace > 0 && itemsRemaining.length) {\n const item = itemsRemaining.shift()!;\n if (remainingSpace - item.size - gap - overflowItemSize >= 0) {\n // There is space for the item and an overflow item.\n item.directive.canBeVisible.set(true);\n remainingSpace -= item.size + gap;\n } else if (\n !itemsRemaining.length &&\n (remainingSpace - item.size >= 0 || overflowItemSize >= item.size)\n ) {\n // There are no other items remaining and there is enough space or the overflow item is biggger than the current one.\n item.directive.canBeVisible.set(true);\n remainingSpace = 0;\n } else {\n // There is no space for the item.\n remainingSpace = 0;\n item.directive.canBeVisible.set(false);\n }\n }\n itemsRemaining.forEach(item => item.directive.canBeVisible.set(false));\n\n const overflowItem = this.overflowItem();\n if (overflowItem) {\n overflowItem.hiddenItemCount = this.items.filter(item => !item.canBeVisible()).length;\n overflowItem.canBeVisible.set(overflowItem.hiddenItemCount !== 0);\n }\n this.changeDetectorRef.markForCheck();\n }\n\n private reset(): void {\n this.resizeSubscription?.unsubscribe();\n this.resizeSubscription = undefined;\n this.disableInitSubscription = this.items.changes.subscribe(\n (items: QueryList<SiAutoCollapsableListItemDirective>) =>\n queueMicrotask(() => {\n items.forEach(item => item.canBeVisible.set(true));\n })\n );\n this.items.notifyOnChanges();\n\n const overflowItem = this.overflowItem();\n if (overflowItem) {\n queueMicrotask(() => {\n overflowItem!.canBeVisible.set(false);\n overflowItem!.hiddenItemCount = 0;\n });\n }\n }\n\n private readGapSize(): void {\n const { gap } = getComputedStyle(this.containerElement() ?? this.elementRef.nativeElement);\n if (gap.endsWith('px') || gap === '0') {\n this.computedGap = parseFloat(gap);\n }\n }\n}\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport { NgModule } from '@angular/core';\n\nimport { SiAutoCollapsableListAdditionalContentDirective } from './si-auto-collapsable-list-additional-content.directive';\nimport { SiAutoCollapsableListItemDirective } from './si-auto-collapsable-list-item.directive';\nimport { SiAutoCollapsableListOverflowItemDirective } from './si-auto-collapsable-list-overflow-item.directive';\nimport { SiAutoCollapsableListDirective } from './si-auto-collapsable-list.directive';\n\n@NgModule({\n imports: [\n SiAutoCollapsableListAdditionalContentDirective,\n SiAutoCollapsableListDirective,\n SiAutoCollapsableListItemDirective,\n SiAutoCollapsableListOverflowItemDirective\n ],\n exports: [\n SiAutoCollapsableListAdditionalContentDirective,\n SiAutoCollapsableListDirective,\n SiAutoCollapsableListItemDirective,\n SiAutoCollapsableListOverflowItemDirective\n ]\n})\nexport class SiAutoCollapsableListModule {}\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-auto-collapsable-list-item.directive';\nexport * from './si-auto-collapsable-list.directive';\nexport * from './si-auto-collapsable-list-overflow-item.directive';\nexport * from './si-auto-collapsable-list-measurable.class';\nexport * from './si-auto-collapsable-list-additional-content.directive';\nexport * from './si-auto-collapsable-list.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;AAGG;MAOU,+BAA+B,CAAA;;AAE1C,IAAA,KAAK;AAEc,IAAA,UAAU,GAAG,MAAM,EAAC,UAAuB,EAAC;AAC9C,IAAA,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC;IAEtE,eAAe,GAAA;AACb,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AACf,aAAA,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI;aACpD,IAAI,CACH,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,EACvB,oBAAoB,EAAE,EACtB,WAAW,CAAC,CAAC,CAAC,CACf;;uGAdM,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAA/B,+BAA+B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAA/B,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAD3C;;;ACTD;;;AAGG;AAeG,MAAO,kCACX,SAAQ,+BAA+B,CAAA;AAGvC;;;;;AAKG;IACM,SAAS,GAAG,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAElE;;;;AAIG;AACM,IAAA,YAAY,GAAG,MAAM,CAAU,KAAK,CAAC;AAE9C;;AAEG;AACM,IAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IAEpE,eAAe,GAAA;AACtB,QAAA,IAAI,gBAAgB,CAAC,IAAI,CAAC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;;ACHH;;AAEG;;;;"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { InjectionToken, inject, ElementRef, input, booleanAttribute, HostListener, HostBinding, Directive, output, ChangeDetectorRef, DestroyRef, ContentChildren, NgModule } from '@angular/core';
|
|
4
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Copyright Siemens 2016 - 2025.
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
*/
|
|
10
|
+
const AUTOCOMPLETE_LISTBOX = new InjectionToken('si-autocomplete-listbox');
|
|
11
|
+
|
|
12
|
+
class SiAutocompleteOptionDirective {
|
|
13
|
+
static idCounter = 0;
|
|
14
|
+
element = inject(ElementRef);
|
|
15
|
+
parent = inject(AUTOCOMPLETE_LISTBOX);
|
|
16
|
+
/**
|
|
17
|
+
* @defaultValue
|
|
18
|
+
* ```
|
|
19
|
+
* `__si-autocomplete-option-${SiAutocompleteOptionDirective.idCounter++}`
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
id = input(`__si-autocomplete-option-${SiAutocompleteOptionDirective.idCounter++}`);
|
|
23
|
+
/** @defaultValue false */
|
|
24
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
25
|
+
disabledInput = input(false, { alias: 'disabled', transform: booleanAttribute });
|
|
26
|
+
get disabled() {
|
|
27
|
+
return this.disabledInput();
|
|
28
|
+
}
|
|
29
|
+
/** @defaultValue undefined */
|
|
30
|
+
value = input(undefined, { alias: 'siAutocompleteOption' });
|
|
31
|
+
active;
|
|
32
|
+
click() {
|
|
33
|
+
this.parent.siAutocompleteOptionSubmitted.emit(this.value());
|
|
34
|
+
}
|
|
35
|
+
/** @internal */
|
|
36
|
+
setActiveStyles() {
|
|
37
|
+
this.active = true;
|
|
38
|
+
this.element.nativeElement.scrollIntoView({ block: 'nearest' });
|
|
39
|
+
}
|
|
40
|
+
/** @internal */
|
|
41
|
+
setInactiveStyles() {
|
|
42
|
+
this.active = false;
|
|
43
|
+
}
|
|
44
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutocompleteOptionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
45
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.6", type: SiAutocompleteOptionDirective, isStandalone: true, selector: "[siAutocompleteOption]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "siAutocompleteOption", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "option" }, listeners: { "click": "click()" }, properties: { "id": "id()", "attr.aria-disabled": "disabledInput()", "class.active": "this.active" } }, exportAs: ["siAutocompleteOption"], ngImport: i0 });
|
|
46
|
+
}
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutocompleteOptionDirective, decorators: [{
|
|
48
|
+
type: Directive,
|
|
49
|
+
args: [{
|
|
50
|
+
selector: '[siAutocompleteOption]',
|
|
51
|
+
exportAs: 'siAutocompleteOption',
|
|
52
|
+
host: {
|
|
53
|
+
role: 'option',
|
|
54
|
+
'[id]': 'id()',
|
|
55
|
+
'[attr.aria-disabled]': 'disabledInput()'
|
|
56
|
+
}
|
|
57
|
+
}]
|
|
58
|
+
}], propDecorators: { active: [{
|
|
59
|
+
type: HostBinding,
|
|
60
|
+
args: ['class.active']
|
|
61
|
+
}], click: [{
|
|
62
|
+
type: HostListener,
|
|
63
|
+
args: ['click']
|
|
64
|
+
}] } });
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Copyright Siemens 2016 - 2025.
|
|
68
|
+
* SPDX-License-Identifier: MIT
|
|
69
|
+
*/
|
|
70
|
+
class SiAutocompleteListboxDirective {
|
|
71
|
+
static idCounter = 0;
|
|
72
|
+
options;
|
|
73
|
+
/**
|
|
74
|
+
* @defaultValue
|
|
75
|
+
* ```
|
|
76
|
+
* `__si-autocomplete-listbox-${SiAutocompleteListboxDirective.idCounter++}`
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
id = input(`__si-autocomplete-listbox-${SiAutocompleteListboxDirective.idCounter++}`);
|
|
80
|
+
autocomplete = input.required({
|
|
81
|
+
alias: 'siAutocompleteListboxFor'
|
|
82
|
+
});
|
|
83
|
+
/** @defaultValue 0 */
|
|
84
|
+
siAutocompleteDefaultIndex = input(0);
|
|
85
|
+
siAutocompleteOptionSubmitted = output();
|
|
86
|
+
keyManager;
|
|
87
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
88
|
+
destroyRef = inject(DestroyRef);
|
|
89
|
+
ngOnChanges(changes) {
|
|
90
|
+
if (changes.siAutocompleteDefaultIndex) {
|
|
91
|
+
if (!this.keyManager?.activeItem) {
|
|
92
|
+
this.setActiveItem();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
ngOnInit() {
|
|
97
|
+
// For some reason, this is needed sometimes. Otherwise, one may get ExpressionChangedAfterItHasBeenCheckedError.
|
|
98
|
+
queueMicrotask(() => {
|
|
99
|
+
this.changeDetectorRef.markForCheck();
|
|
100
|
+
this.autocomplete().listbox = this;
|
|
101
|
+
});
|
|
102
|
+
this.destroyRef.onDestroy(() => {
|
|
103
|
+
this.autocomplete().listbox = undefined;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
ngAfterContentInit() {
|
|
107
|
+
this.keyManager = new ActiveDescendantKeyManager(this.options)
|
|
108
|
+
.withWrap(true)
|
|
109
|
+
.withVerticalOrientation(true);
|
|
110
|
+
this.options.changes
|
|
111
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
112
|
+
.subscribe(() => this.setActiveItem());
|
|
113
|
+
this.setActiveItem();
|
|
114
|
+
}
|
|
115
|
+
setActiveItem() {
|
|
116
|
+
queueMicrotask(() => {
|
|
117
|
+
this.keyManager.setActiveItem(this.siAutocompleteDefaultIndex());
|
|
118
|
+
this.changeDetectorRef.markForCheck();
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/** @internal */
|
|
122
|
+
onKeydown(event) {
|
|
123
|
+
if (event.ctrlKey && event.key === 'Enter') {
|
|
124
|
+
// [ctrl + enter] should submit and not select an option.
|
|
125
|
+
// Mainly needed for filtered-search.
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.keyManager.onKeydown(event);
|
|
129
|
+
if (event.key === 'Enter' && this.keyManager.activeItem) {
|
|
130
|
+
this.siAutocompleteOptionSubmitted.emit(this.keyManager.activeItem.value());
|
|
131
|
+
// Something was selected. This should prevent everything else from happening, especially submitting the form.
|
|
132
|
+
event.stopImmediatePropagation();
|
|
133
|
+
}
|
|
134
|
+
this.changeDetectorRef.markForCheck();
|
|
135
|
+
}
|
|
136
|
+
get active() {
|
|
137
|
+
return this.keyManager?.activeItem ?? null;
|
|
138
|
+
}
|
|
139
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutocompleteListboxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
140
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.6", type: SiAutocompleteListboxDirective, isStandalone: true, selector: "[siAutocompleteListboxFor]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "siAutocompleteListboxFor", isSignal: true, isRequired: true, transformFunction: null }, siAutocompleteDefaultIndex: { classPropertyName: "siAutocompleteDefaultIndex", publicName: "siAutocompleteDefaultIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { siAutocompleteOptionSubmitted: "siAutocompleteOptionSubmitted" }, host: { attributes: { "role": "listbox" }, properties: { "id": "id()" } }, providers: [{ provide: AUTOCOMPLETE_LISTBOX, useExisting: SiAutocompleteListboxDirective }], queries: [{ propertyName: "options", predicate: SiAutocompleteOptionDirective, descendants: true }], exportAs: ["siAutocompleteListbox"], usesOnChanges: true, ngImport: i0 });
|
|
141
|
+
}
|
|
142
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutocompleteListboxDirective, decorators: [{
|
|
143
|
+
type: Directive,
|
|
144
|
+
args: [{
|
|
145
|
+
selector: '[siAutocompleteListboxFor]',
|
|
146
|
+
exportAs: 'siAutocompleteListbox',
|
|
147
|
+
providers: [{ provide: AUTOCOMPLETE_LISTBOX, useExisting: SiAutocompleteListboxDirective }],
|
|
148
|
+
host: {
|
|
149
|
+
role: 'listbox',
|
|
150
|
+
'[id]': 'id()'
|
|
151
|
+
}
|
|
152
|
+
}]
|
|
153
|
+
}], propDecorators: { options: [{
|
|
154
|
+
type: ContentChildren,
|
|
155
|
+
args: [SiAutocompleteOptionDirective, { descendants: true }]
|
|
156
|
+
}] } });
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Copyright Siemens 2016 - 2025.
|
|
160
|
+
* SPDX-License-Identifier: MIT
|
|
161
|
+
*/
|
|
162
|
+
class SiAutocompleteDirective {
|
|
163
|
+
/** @internal */
|
|
164
|
+
listbox;
|
|
165
|
+
get activeDescendant() {
|
|
166
|
+
return this.listbox?.active?.id() ?? '';
|
|
167
|
+
}
|
|
168
|
+
get ariaControls() {
|
|
169
|
+
return this.listbox?.id();
|
|
170
|
+
}
|
|
171
|
+
get expanded() {
|
|
172
|
+
return !!this.listbox;
|
|
173
|
+
}
|
|
174
|
+
keydown(event) {
|
|
175
|
+
this.listbox?.onKeydown(event);
|
|
176
|
+
}
|
|
177
|
+
get active() {
|
|
178
|
+
return this.listbox?.active;
|
|
179
|
+
}
|
|
180
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutocompleteDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
181
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: SiAutocompleteDirective, isStandalone: true, selector: "input[siAutocomplete]", host: { attributes: { "role": "combobox", "aria-autocomplete": "list" }, listeners: { "keydown": "keydown($event)" }, properties: { "attr.aria-activedescendant": "this.activeDescendant", "attr.aria-controls": "this.ariaControls", "attr.aria-expanded": "this.expanded" } }, exportAs: ["siAutocomplete"], ngImport: i0 });
|
|
182
|
+
}
|
|
183
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutocompleteDirective, decorators: [{
|
|
184
|
+
type: Directive,
|
|
185
|
+
args: [{
|
|
186
|
+
selector: 'input[siAutocomplete]',
|
|
187
|
+
exportAs: 'siAutocomplete',
|
|
188
|
+
host: {
|
|
189
|
+
role: 'combobox',
|
|
190
|
+
'aria-autocomplete': 'list'
|
|
191
|
+
}
|
|
192
|
+
}]
|
|
193
|
+
}], propDecorators: { activeDescendant: [{
|
|
194
|
+
type: HostBinding,
|
|
195
|
+
args: ['attr.aria-activedescendant']
|
|
196
|
+
}], ariaControls: [{
|
|
197
|
+
type: HostBinding,
|
|
198
|
+
args: ['attr.aria-controls']
|
|
199
|
+
}], expanded: [{
|
|
200
|
+
type: HostBinding,
|
|
201
|
+
args: ['attr.aria-expanded']
|
|
202
|
+
}], keydown: [{
|
|
203
|
+
type: HostListener,
|
|
204
|
+
args: ['keydown', ['$event']]
|
|
205
|
+
}] } });
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Copyright Siemens 2016 - 2025.
|
|
209
|
+
* SPDX-License-Identifier: MIT
|
|
210
|
+
*/
|
|
211
|
+
class SiAutocompleteModule {
|
|
212
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
213
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: SiAutocompleteModule, imports: [SiAutocompleteDirective, SiAutocompleteListboxDirective, SiAutocompleteOptionDirective], exports: [SiAutocompleteDirective, SiAutocompleteListboxDirective, SiAutocompleteOptionDirective] });
|
|
214
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutocompleteModule });
|
|
215
|
+
}
|
|
216
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiAutocompleteModule, decorators: [{
|
|
217
|
+
type: NgModule,
|
|
218
|
+
args: [{
|
|
219
|
+
declarations: [],
|
|
220
|
+
imports: [SiAutocompleteDirective, SiAutocompleteListboxDirective, SiAutocompleteOptionDirective],
|
|
221
|
+
exports: [SiAutocompleteDirective, SiAutocompleteListboxDirective, SiAutocompleteOptionDirective]
|
|
222
|
+
}]
|
|
223
|
+
}] });
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Copyright Siemens 2016 - 2025.
|
|
227
|
+
* SPDX-License-Identifier: MIT
|
|
228
|
+
*/
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Generated bundle index. Do not edit.
|
|
232
|
+
*/
|
|
233
|
+
|
|
234
|
+
export { SiAutocompleteDirective, SiAutocompleteListboxDirective, SiAutocompleteModule, SiAutocompleteOptionDirective };
|
|
235
|
+
//# sourceMappingURL=siemens-element-ng-autocomplete.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"siemens-element-ng-autocomplete.mjs","sources":["../../../../projects/element-ng/autocomplete/si-autocomplete.model.ts","../../../../projects/element-ng/autocomplete/si-autocomplete-option.directive.ts","../../../../projects/element-ng/autocomplete/si-autocomplete-listbox.directive.ts","../../../../projects/element-ng/autocomplete/si-autocomplete.directive.ts","../../../../projects/element-ng/autocomplete/si-autocomplete.module.ts","../../../../projects/element-ng/autocomplete/index.ts","../../../../projects/element-ng/autocomplete/siemens-element-ng-autocomplete.ts"],"sourcesContent":["/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport { InjectionToken } from '@angular/core';\n\nimport { SiAutocompleteListboxDirective } from './si-autocomplete-listbox.directive';\n\nexport const AUTOCOMPLETE_LISTBOX = new InjectionToken<SiAutocompleteListboxDirective<unknown>>(\n 'si-autocomplete-listbox'\n);\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport { Highlightable } from '@angular/cdk/a11y';\nimport {\n booleanAttribute,\n Directive,\n ElementRef,\n HostBinding,\n HostListener,\n inject,\n input\n} from '@angular/core';\n\nimport { AUTOCOMPLETE_LISTBOX } from './si-autocomplete.model';\n\n@Directive({\n selector: '[siAutocompleteOption]',\n exportAs: 'siAutocompleteOption',\n host: {\n role: 'option',\n '[id]': 'id()',\n '[attr.aria-disabled]': 'disabledInput()'\n }\n})\nexport class SiAutocompleteOptionDirective<T = unknown> implements Highlightable {\n private static idCounter = 0;\n private element = inject<ElementRef<HTMLElement>>(ElementRef);\n private parent = inject(AUTOCOMPLETE_LISTBOX);\n\n /**\n * @defaultValue\n * ```\n * `__si-autocomplete-option-${SiAutocompleteOptionDirective.idCounter++}`\n * ```\n */\n readonly id = input(`__si-autocomplete-option-${SiAutocompleteOptionDirective.idCounter++}`);\n\n /** @defaultValue false */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n readonly disabledInput = input(false, { alias: 'disabled', transform: booleanAttribute });\n\n get disabled(): boolean {\n return this.disabledInput();\n }\n /** @defaultValue undefined */\n readonly value = input<T>(undefined, { alias: 'siAutocompleteOption' });\n\n @HostBinding('class.active') protected active?: boolean;\n\n @HostListener('click')\n protected click(): void {\n this.parent.siAutocompleteOptionSubmitted.emit(this.value());\n }\n\n /** @internal */\n setActiveStyles(): void {\n this.active = true;\n this.element.nativeElement.scrollIntoView({ block: 'nearest' });\n }\n\n /** @internal */\n setInactiveStyles(): void {\n this.active = false;\n }\n}\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport { ActiveDescendantKeyManager } from '@angular/cdk/a11y';\nimport {\n AfterContentInit,\n ChangeDetectorRef,\n ContentChildren,\n DestroyRef,\n Directive,\n inject,\n input,\n OnChanges,\n OnInit,\n output,\n QueryList,\n SimpleChanges\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { SiAutocompleteOptionDirective } from './si-autocomplete-option.directive';\nimport { SiAutocompleteDirective } from './si-autocomplete.directive';\nimport { AUTOCOMPLETE_LISTBOX } from './si-autocomplete.model';\n\n@Directive({\n selector: '[siAutocompleteListboxFor]',\n exportAs: 'siAutocompleteListbox',\n providers: [{ provide: AUTOCOMPLETE_LISTBOX, useExisting: SiAutocompleteListboxDirective }],\n host: {\n role: 'listbox',\n '[id]': 'id()'\n }\n})\nexport class SiAutocompleteListboxDirective<T> implements OnInit, OnChanges, AfterContentInit {\n private static idCounter = 0;\n\n @ContentChildren(SiAutocompleteOptionDirective, { descendants: true })\n private options!: QueryList<SiAutocompleteOptionDirective<T>>;\n\n /**\n * @defaultValue\n * ```\n * `__si-autocomplete-listbox-${SiAutocompleteListboxDirective.idCounter++}`\n * ```\n */\n readonly id = input(`__si-autocomplete-listbox-${SiAutocompleteListboxDirective.idCounter++}`);\n\n readonly autocomplete = input.required<SiAutocompleteDirective<T>>({\n alias: 'siAutocompleteListboxFor'\n });\n\n /** @defaultValue 0 */\n readonly siAutocompleteDefaultIndex = input(0);\n\n readonly siAutocompleteOptionSubmitted = output<T | undefined>();\n\n private keyManager?: ActiveDescendantKeyManager<SiAutocompleteOptionDirective<T>>;\n\n private changeDetectorRef = inject(ChangeDetectorRef);\n private destroyRef = inject(DestroyRef);\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.siAutocompleteDefaultIndex) {\n if (!this.keyManager?.activeItem) {\n this.setActiveItem();\n }\n }\n }\n\n ngOnInit(): void {\n // For some reason, this is needed sometimes. Otherwise, one may get ExpressionChangedAfterItHasBeenCheckedError.\n queueMicrotask(() => {\n this.changeDetectorRef.markForCheck();\n this.autocomplete().listbox = this;\n });\n this.destroyRef.onDestroy(() => {\n this.autocomplete().listbox = undefined;\n });\n }\n\n ngAfterContentInit(): void {\n this.keyManager = new ActiveDescendantKeyManager(this.options)\n .withWrap(true)\n .withVerticalOrientation(true);\n\n this.options.changes\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.setActiveItem());\n\n this.setActiveItem();\n }\n\n private setActiveItem(): void {\n queueMicrotask(() => {\n this.keyManager!.setActiveItem(this.siAutocompleteDefaultIndex());\n this.changeDetectorRef.markForCheck();\n });\n }\n\n /** @internal */\n onKeydown(event: KeyboardEvent): void {\n if (event.ctrlKey && event.key === 'Enter') {\n // [ctrl + enter] should submit and not select an option.\n // Mainly needed for filtered-search.\n return;\n }\n this.keyManager!.onKeydown(event);\n if (event.key === 'Enter' && this.keyManager!.activeItem) {\n this.siAutocompleteOptionSubmitted.emit(this.keyManager!.activeItem.value());\n // Something was selected. This should prevent everything else from happening, especially submitting the form.\n event.stopImmediatePropagation();\n }\n this.changeDetectorRef.markForCheck();\n }\n\n get active(): SiAutocompleteOptionDirective<T> | null {\n return this.keyManager?.activeItem ?? null;\n }\n}\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport { Directive, HostBinding, HostListener } from '@angular/core';\n\nimport { SiAutocompleteListboxDirective } from './si-autocomplete-listbox.directive';\nimport { SiAutocompleteOptionDirective } from './si-autocomplete-option.directive';\n\n@Directive({\n selector: 'input[siAutocomplete]',\n exportAs: 'siAutocomplete',\n host: {\n role: 'combobox',\n 'aria-autocomplete': 'list'\n }\n})\nexport class SiAutocompleteDirective<T> {\n /** @internal */\n listbox?: SiAutocompleteListboxDirective<T>;\n\n @HostBinding('attr.aria-activedescendant')\n protected get activeDescendant(): string {\n return this.listbox?.active?.id() ?? '';\n }\n\n @HostBinding('attr.aria-controls')\n protected get ariaControls(): string | undefined {\n return this.listbox?.id();\n }\n\n @HostBinding('attr.aria-expanded')\n protected get expanded(): boolean {\n return !!this.listbox;\n }\n\n @HostListener('keydown', ['$event'])\n protected keydown(event: KeyboardEvent): void {\n this.listbox?.onKeydown(event);\n }\n\n get active(): SiAutocompleteOptionDirective<T> | undefined | null {\n return this.listbox?.active;\n }\n}\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport { NgModule } from '@angular/core';\n\nimport { SiAutocompleteListboxDirective } from './si-autocomplete-listbox.directive';\nimport { SiAutocompleteOptionDirective } from './si-autocomplete-option.directive';\nimport { SiAutocompleteDirective } from './si-autocomplete.directive';\n\n@NgModule({\n declarations: [],\n imports: [SiAutocompleteDirective, SiAutocompleteListboxDirective, SiAutocompleteOptionDirective],\n exports: [SiAutocompleteDirective, SiAutocompleteListboxDirective, SiAutocompleteOptionDirective]\n})\nexport class SiAutocompleteModule {}\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-autocomplete-listbox.directive';\nexport * from './si-autocomplete-option.directive';\nexport * from './si-autocomplete.directive';\nexport * from './si-autocomplete.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;AAGG;AAKI,MAAM,oBAAoB,GAAG,IAAI,cAAc,CACpD,yBAAyB,CAC1B;;MCgBY,6BAA6B,CAAA;AAChC,IAAA,OAAO,SAAS,GAAG,CAAC;AACpB,IAAA,OAAO,GAAG,MAAM,CAA0B,UAAU,CAAC;AACrD,IAAA,MAAM,GAAG,MAAM,CAAC,oBAAo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