@siemens/element-ng 51.6.0 → 51.7.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 +3 -4
- package/element-ng.scss +3 -1
- package/fesm2022/siemens-element-ng-accordion.mjs +2 -2
- package/fesm2022/siemens-element-ng-accordion.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-ag-grid.mjs +9 -9
- package/fesm2022/siemens-element-ng-ag-grid.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-application-header.mjs +10 -7
- package/fesm2022/siemens-element-ng-application-header.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-avatar.mjs +3 -3
- package/fesm2022/siemens-element-ng-avatar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-card.mjs +6 -5
- package/fesm2022/siemens-element-ng-card.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-carousel.mjs +6 -4
- package/fesm2022/siemens-element-ng-carousel.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-chat-messages.mjs +605 -32
- package/fesm2022/siemens-element-ng-chat-messages.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-color-picker.mjs +55 -39
- package/fesm2022/siemens-element-ng-color-picker.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-content-action-bar.mjs +2 -2
- package/fesm2022/siemens-element-ng-content-action-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-dashboard.mjs +13 -15
- package/fesm2022/siemens-element-ng-dashboard.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-date-range-filter.mjs +3 -3
- package/fesm2022/siemens-element-ng-date-range-filter.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-datepicker.mjs +5 -4
- package/fesm2022/siemens-element-ng-datepicker.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-empty-state.mjs +13 -6
- package/fesm2022/siemens-element-ng-empty-state.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-file-uploader.mjs +2 -2
- package/fesm2022/siemens-element-ng-file-uploader.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-filter-bar.mjs +4 -4
- package/fesm2022/siemens-element-ng-filter-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-footer.mjs +2 -2
- package/fesm2022/siemens-element-ng-form.mjs +4 -4
- package/fesm2022/siemens-element-ng-formly.mjs +1 -1
- package/fesm2022/siemens-element-ng-formly.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-icon.mjs +2 -1
- package/fesm2022/siemens-element-ng-icon.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-info-page.mjs +20 -7
- package/fesm2022/siemens-element-ng-info-page.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-inline-notification.mjs +2 -2
- package/fesm2022/siemens-element-ng-inline-notification.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-landing-page.mjs +2 -2
- package/fesm2022/siemens-element-ng-landing-page.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-list-details.mjs +2 -2
- package/fesm2022/siemens-element-ng-list-details.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-loading-spinner.mjs +2 -2
- package/fesm2022/siemens-element-ng-loading-spinner.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-maplibre.mjs +133 -10
- package/fesm2022/siemens-element-ng-maplibre.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-menu.mjs +6 -6
- package/fesm2022/siemens-element-ng-menu.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-modal.mjs +71 -84
- package/fesm2022/siemens-element-ng-modal.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar-vertical-next.mjs +64 -14
- package/fesm2022/siemens-element-ng-navbar-vertical-next.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar-vertical.mjs +4 -4
- package/fesm2022/siemens-element-ng-navbar-vertical.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar.mjs +7 -2
- package/fesm2022/siemens-element-ng-navbar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-notification-item.mjs +2 -2
- package/fesm2022/siemens-element-ng-notification-item.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-number-input.mjs +2 -2
- package/fesm2022/siemens-element-ng-number-input.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-password-strength.mjs +2 -2
- package/fesm2022/siemens-element-ng-password-strength.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-phone-number.mjs +32 -23
- package/fesm2022/siemens-element-ng-phone-number.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-photo-upload.mjs +7 -2
- package/fesm2022/siemens-element-ng-photo-upload.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-pills-input.mjs +2 -2
- package/fesm2022/siemens-element-ng-pills-input.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-result-details-list.mjs +11 -6
- package/fesm2022/siemens-element-ng-result-details-list.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-search-bar.mjs +188 -15
- package/fesm2022/siemens-element-ng-search-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-select.mjs +631 -764
- package/fesm2022/siemens-element-ng-select.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-side-panel.mjs +19 -10
- package/fesm2022/siemens-element-ng-side-panel.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-slider.mjs +2 -2
- package/fesm2022/siemens-element-ng-slider.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-source-chip.mjs +2 -2
- package/fesm2022/siemens-element-ng-source-chip.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-split.mjs +2 -2
- package/fesm2022/siemens-element-ng-split.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-status-bar.mjs +12 -12
- package/fesm2022/siemens-element-ng-status-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-status-counter.mjs +2 -2
- package/fesm2022/siemens-element-ng-status-counter.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-status-toggle.mjs +2 -2
- package/fesm2022/siemens-element-ng-status-toggle.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-summary-chip.mjs +2 -2
- package/fesm2022/siemens-element-ng-summary-chip.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-summary-widget.mjs +2 -2
- package/fesm2022/siemens-element-ng-summary-widget.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tabs-legacy.mjs +2 -1
- package/fesm2022/siemens-element-ng-tabs-legacy.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tabs.mjs +3 -6
- package/fesm2022/siemens-element-ng-tabs.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-theme.mjs +9 -5
- package/fesm2022/siemens-element-ng-theme.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-threshold.mjs +2 -2
- package/fesm2022/siemens-element-ng-threshold.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-toast-notification.mjs +2 -2
- package/fesm2022/siemens-element-ng-toast-notification.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tour.mjs +2 -2
- package/fesm2022/siemens-element-ng-tour.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-translate.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tree-view.mjs +8 -25
- package/fesm2022/siemens-element-ng-tree-view.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-typeahead.mjs +42 -30
- package/fesm2022/siemens-element-ng-typeahead.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-wizard.mjs +2 -2
- package/fesm2022/siemens-element-ng-wizard.mjs.map +1 -1
- package/maplibre/styles/maplibre-gl.scss +2 -2
- package/package.json +8 -8
- package/schematics/collection.json +5 -0
- package/schematics/migrate-search-bar/index.js +5 -0
- package/schematics/migrate-search-bar/migrate-search-bar-rule.js +733 -0
- package/schematics/migrate-search-bar/schema.json +14 -0
- package/schematics/migrate-search-bar/search-bar-template.js +742 -0
- package/schematics/migrate-search-bar/text-edits.js +23 -0
- package/schematics/migrations/data/css-custom-properties.js +11 -11
- package/schematics/utils/project-utils.js +2 -1
- package/template-i18n.json +8 -0
- package/types/siemens-element-ng-application-header.d.ts +1 -0
- package/types/siemens-element-ng-avatar.d.ts +1 -1
- package/types/siemens-element-ng-card.d.ts +2 -2
- package/types/siemens-element-ng-chat-messages.d.ts +517 -124
- package/types/siemens-element-ng-color-picker.d.ts +18 -9
- package/types/siemens-element-ng-dashboard.d.ts +2 -1
- package/types/siemens-element-ng-empty-state.d.ts +9 -2
- package/types/siemens-element-ng-info-page.d.ts +17 -5
- package/types/siemens-element-ng-maplibre.d.ts +39 -2
- package/types/siemens-element-ng-modal.d.ts +6 -4
- package/types/siemens-element-ng-navbar-vertical-next.d.ts +31 -2
- package/types/siemens-element-ng-navbar.d.ts +1 -0
- package/types/siemens-element-ng-phone-number.d.ts +5 -6
- package/types/siemens-element-ng-photo-upload.d.ts +1 -0
- package/types/siemens-element-ng-result-details-list.d.ts +7 -2
- package/types/siemens-element-ng-search-bar.d.ts +110 -5
- package/types/siemens-element-ng-select.d.ts +257 -286
- package/types/siemens-element-ng-side-panel.d.ts +5 -1
- package/types/siemens-element-ng-status-bar.d.ts +2 -2
- package/types/siemens-element-ng-tabs-legacy.d.ts +2 -1
- package/types/siemens-element-ng-theme.d.ts +1 -0
- package/types/siemens-element-ng-tour.d.ts +11 -0
- package/types/siemens-element-ng-translate.d.ts +8 -0
- package/types/siemens-element-ng-tree-view.d.ts +0 -8
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import * as i1$3 from '@angular/cdk/overlay';
|
|
2
|
-
import { CdkOverlayOrigin, OverlayModule, Overlay } from '@angular/cdk/overlay';
|
|
3
1
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken, Directive, input, Component, booleanAttribute, output,
|
|
5
|
-
import { defaultConnectedOverlayScrollStrategy } from '@siemens/element-ng/common';
|
|
2
|
+
import { InjectionToken, Directive, input, Component, booleanAttribute, output, model, signal, computed, inject, ElementRef, ViewContainerRef, DestroyRef, PLATFORM_ID, Input, viewChild, TemplateRef, contentChild, NgModule } from '@angular/core';
|
|
6
3
|
import { SI_FORM_ITEM_CONTROL } from '@siemens/element-ng/form';
|
|
7
4
|
import { SiTranslatePipe, t } from '@siemens/element-translate-ng/translate';
|
|
8
5
|
import { elementDown2, elementOk, elementSearch } from '@siemens/element-icons';
|
|
@@ -10,17 +7,19 @@ import * as i1 from '@siemens/element-ng/auto-collapsable-list';
|
|
|
10
7
|
import { SiAutoCollapsableListModule } from '@siemens/element-ng/auto-collapsable-list';
|
|
11
8
|
import { SiIconComponent, addIcons } from '@siemens/element-ng/icon';
|
|
12
9
|
import * as i1$2 from '@angular/common';
|
|
13
|
-
import { NgTemplateOutlet,
|
|
10
|
+
import { NgTemplateOutlet, isPlatformBrowser, CommonModule } from '@angular/common';
|
|
11
|
+
import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
|
12
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
13
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
14
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
15
|
+
import { defaultConnectedOverlayScrollStrategy } from '@siemens/element-ng/common';
|
|
14
16
|
import * as i1$1 from '@siemens/element-ng/autocomplete';
|
|
15
17
|
import { SiAutocompleteDirective, SiAutocompleteModule } from '@siemens/element-ng/autocomplete';
|
|
16
18
|
import { SiLoadingSpinnerComponent } from '@siemens/element-ng/loading-spinner';
|
|
17
|
-
import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
|
18
19
|
import { CdkListbox, CdkOption } from '@angular/cdk/listbox';
|
|
19
|
-
import {
|
|
20
|
-
import { debounceTime, takeUntil } from 'rxjs/operators';
|
|
21
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
22
|
-
import { TemplatePortal } from '@angular/cdk/portal';
|
|
20
|
+
import { filter, tap, map, merge, Subject, switchMap, of } from 'rxjs';
|
|
23
21
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
22
|
+
import { debounceTime, takeUntil } from 'rxjs/operators';
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -89,9 +88,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
89
88
|
* SPDX-License-Identifier: MIT
|
|
90
89
|
*/
|
|
91
90
|
/**
|
|
92
|
-
*
|
|
91
|
+
* Host directive for building custom selects.
|
|
92
|
+
*
|
|
93
|
+
* Add this as a `hostDirective` on your component and expose the inputs/outputs you need.
|
|
94
|
+
* The directive handles:
|
|
95
|
+
* - {@link ControlValueAccessor} integration (`formControl`, `ngModel`, `[(value)]`)
|
|
96
|
+
* - Disabled / readonly state management
|
|
97
|
+
* - Overlay lifecycle for the dropdown (open/close)
|
|
98
|
+
* - Focus management and focus trapping in the dropdown
|
|
99
|
+
* - Opening the dropdown on click, Enter, Space, ArrowDown, ArrowUp
|
|
100
|
+
* - {@link SiFormItemControl} integration
|
|
101
|
+
*
|
|
102
|
+
* Use {@link SiSelectDropdownDirective} to mark the dropdown template in your component,
|
|
103
|
+
* and call {@link open}, {@link close}, {@link updateValue} from your component logic.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* @Component({
|
|
108
|
+
* selector: 'app-my-select',
|
|
109
|
+
* hostDirectives: [{
|
|
110
|
+
* directive: SiCustomSelectDirective,
|
|
111
|
+
* inputs: ['disabled', 'readonly', 'value'],
|
|
112
|
+
* outputs: ['valueChange']
|
|
113
|
+
* }],
|
|
114
|
+
* template: `
|
|
115
|
+
* <si-select-combobox>
|
|
116
|
+
* {{ select.value() }}
|
|
117
|
+
* </si-select-combobox>
|
|
118
|
+
* <ng-template si-select-dropdown contentType="listbox">
|
|
119
|
+
* <button (click)="select.updateValue('new'); select.close()">Pick</button>
|
|
120
|
+
* </ng-template>
|
|
121
|
+
* `
|
|
122
|
+
* })
|
|
123
|
+
* export class MySelectComponent {
|
|
124
|
+
* readonly select = inject(SiCustomSelectDirective);
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @experimental
|
|
93
129
|
*/
|
|
94
|
-
class
|
|
130
|
+
class SiCustomSelectDirective {
|
|
131
|
+
static idCounter = 0;
|
|
132
|
+
/**
|
|
133
|
+
* Unique identifier.
|
|
134
|
+
*
|
|
135
|
+
* @defaultValue
|
|
136
|
+
* ```
|
|
137
|
+
* `__si-select-${SiCustomSelectDirective.idCounter++}`
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
id = input(`__si-select-${SiCustomSelectDirective.idCounter++}`, /* @ts-ignore */
|
|
141
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
95
142
|
/**
|
|
96
143
|
* Whether the select input is disabled.
|
|
97
144
|
*
|
|
@@ -100,205 +147,382 @@ class SiSelectSelectionStrategy {
|
|
|
100
147
|
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
101
148
|
disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
|
|
102
149
|
/**
|
|
103
|
-
*
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
this.updateFromInput(this.toArrayValue(value));
|
|
107
|
-
}
|
|
108
|
-
/** Emitted when the selection is changed */
|
|
109
|
-
valueChange = output();
|
|
110
|
-
/**
|
|
111
|
-
* Provides the internal value always as an array
|
|
112
|
-
* @internal
|
|
113
|
-
*/
|
|
114
|
-
arrayValue = computed(() => this.selectOptions.selectedRows().map(option => option.value), /* @ts-ignore */
|
|
115
|
-
...(ngDevMode ? [{ debugName: "arrayValue" }] : /* istanbul ignore next */ []));
|
|
116
|
-
/**
|
|
117
|
-
* Registered form callback which shall be called on blur.
|
|
118
|
-
* @internal
|
|
119
|
-
*/
|
|
120
|
-
onTouched = () => { };
|
|
121
|
-
/** @internal */
|
|
122
|
-
disabled = computed(() => this.disabledInput() || this.disabledNgControl(), /* @ts-ignore */
|
|
123
|
-
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
124
|
-
onChange = () => { };
|
|
125
|
-
disabledNgControl = signal(false, /* @ts-ignore */
|
|
126
|
-
...(ngDevMode ? [{ debugName: "disabledNgControl" }] : /* istanbul ignore next */ []));
|
|
127
|
-
selectOptions = inject(SI_SELECT_OPTIONS_STRATEGY);
|
|
128
|
-
registerOnTouched(fn) {
|
|
129
|
-
this.onTouched = fn;
|
|
130
|
-
}
|
|
131
|
-
registerOnChange(fn) {
|
|
132
|
-
this.onChange = fn;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* CDK Listbox value changed handler.
|
|
136
|
-
* @internal
|
|
137
|
-
*/
|
|
138
|
-
updateFromUser(values) {
|
|
139
|
-
const parsedValue = this.fromArrayValue(values);
|
|
140
|
-
this.onChange(parsedValue);
|
|
141
|
-
this.valueChange.emit(parsedValue);
|
|
142
|
-
this.selectOptions.onValueChange(values);
|
|
143
|
-
}
|
|
144
|
-
setDisabledState(isDisabled) {
|
|
145
|
-
this.disabledNgControl.set(isDisabled);
|
|
146
|
-
}
|
|
147
|
-
writeValue(obj) {
|
|
148
|
-
this.updateFromInput(this.toArrayValue(obj));
|
|
149
|
-
}
|
|
150
|
-
updateFromInput(values) {
|
|
151
|
-
this.selectOptions.onValueChange(values);
|
|
152
|
-
}
|
|
153
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectSelectionStrategy, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
154
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: SiSelectSelectionStrategy, isStandalone: true, inputs: { disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.disabled": "disabled()" } }, ngImport: i0 });
|
|
155
|
-
}
|
|
156
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectSelectionStrategy, decorators: [{
|
|
157
|
-
type: Directive,
|
|
158
|
-
args: [{
|
|
159
|
-
host: {
|
|
160
|
-
'[class.disabled]': 'disabled()'
|
|
161
|
-
}
|
|
162
|
-
}]
|
|
163
|
-
}], propDecorators: { disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], value: [{
|
|
164
|
-
type: Input
|
|
165
|
-
}], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Copyright (c) Siemens 2016 - 2026
|
|
169
|
-
* SPDX-License-Identifier: MIT
|
|
170
|
-
*/
|
|
171
|
-
class SiSelectInputComponent {
|
|
172
|
-
/**
|
|
173
|
-
* Base ID used to associate the input with its label.
|
|
150
|
+
* Readonly state. Similar to disabled but with higher contrast.
|
|
151
|
+
*
|
|
152
|
+
* @defaultValue false
|
|
174
153
|
*/
|
|
175
|
-
|
|
176
|
-
...(ngDevMode ? [{ debugName: "baseId" }] : /* istanbul ignore next */ []));
|
|
154
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
177
155
|
/**
|
|
178
156
|
* Aria labelledby of the select.
|
|
179
157
|
*
|
|
180
|
-
* @defaultValue
|
|
158
|
+
* @defaultValue undefined
|
|
181
159
|
*/
|
|
182
|
-
|
|
183
|
-
...(ngDevMode ?
|
|
160
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
161
|
+
labelledbyInput = input(undefined, { ...(ngDevMode ? { debugName: "labelledbyInput" } : /* istanbul ignore next */ {}), alias: 'labelledby' });
|
|
184
162
|
/**
|
|
185
|
-
*
|
|
163
|
+
* Optional CDK scroll strategy used for the custom select overlay.
|
|
186
164
|
*
|
|
187
|
-
* @defaultValue
|
|
165
|
+
* @defaultValue defaultConnectedOverlayScrollStrategy()
|
|
188
166
|
*/
|
|
189
|
-
|
|
190
|
-
|
|
167
|
+
scrollStrategy = input(defaultConnectedOverlayScrollStrategy(), { ...(ngDevMode ? { debugName: "scrollStrategy" } : /* istanbul ignore next */ {}), alias: 'siCustomSelectScrollStrategy' });
|
|
168
|
+
/** Emits when the dropdown open state changes. */
|
|
169
|
+
openChange = output();
|
|
191
170
|
/**
|
|
192
|
-
*
|
|
171
|
+
* The current value, supports two-way binding via `[(value)]`.
|
|
193
172
|
*
|
|
194
|
-
* @defaultValue
|
|
195
|
-
*/
|
|
196
|
-
open = input(false, { ...(ngDevMode ? { debugName: "open" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
197
|
-
/**
|
|
198
|
-
* Text shown when no option is selected.
|
|
173
|
+
* @defaultValue undefined
|
|
199
174
|
*/
|
|
200
|
-
|
|
201
|
-
...(ngDevMode ? [
|
|
175
|
+
value = model(undefined, /* @ts-ignore */
|
|
176
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
202
177
|
/**
|
|
203
|
-
*
|
|
178
|
+
* Whether the dropdown is currently open.
|
|
179
|
+
*
|
|
180
|
+
* @defaultValue false
|
|
204
181
|
*/
|
|
205
|
-
|
|
206
|
-
...(ngDevMode ? [{ debugName: "
|
|
182
|
+
isOpen = signal(false, /* @ts-ignore */
|
|
183
|
+
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
184
|
+
/** @internal */
|
|
185
|
+
labelledby = computed(() => this.labelledbyInput() ?? `${this.id()}-label`, /* @ts-ignore */
|
|
186
|
+
...(ngDevMode ? [{ debugName: "labelledby" }] : /* istanbul ignore next */ []));
|
|
187
|
+
hostLabelledby = computed(() => `${this.labelledby()} ${this.comboboxLabelId()}`, /* @ts-ignore */
|
|
188
|
+
...(ngDevMode ? [{ debugName: "hostLabelledby" }] : /* istanbul ignore next */ []));
|
|
189
|
+
/** @internal */
|
|
190
|
+
comboboxLabelId = computed(() => `${this.id()}-combobox`, /* @ts-ignore */
|
|
191
|
+
...(ngDevMode ? [{ debugName: "comboboxLabelId" }] : /* istanbul ignore next */ []));
|
|
192
|
+
/** @internal */
|
|
193
|
+
dropdownId = computed(() => this.id() + '-dropdown', /* @ts-ignore */
|
|
194
|
+
...(ngDevMode ? [{ debugName: "dropdownId" }] : /* istanbul ignore next */ []));
|
|
207
195
|
/**
|
|
208
|
-
*
|
|
196
|
+
* Value forwarded to the `aria-haspopup` attribute. Reflects the
|
|
197
|
+
* `contentType` input of the registered {@link SiSelectDropdownDirective},
|
|
198
|
+
* defaulting to `'listbox'` until a dropdown template is registered.
|
|
199
|
+
* @internal
|
|
209
200
|
*/
|
|
210
|
-
|
|
211
|
-
...(ngDevMode ? [
|
|
201
|
+
haspopup = computed(() => this.dropdownDirective()?.contentType() ?? 'listbox', /* @ts-ignore */
|
|
202
|
+
...(ngDevMode ? [{ debugName: "haspopup" }] : /* istanbul ignore next */ []));
|
|
212
203
|
/**
|
|
213
|
-
*
|
|
204
|
+
* This ID will be bound to the `aria-describedby` attribute of the select.
|
|
214
205
|
*
|
|
215
|
-
* @defaultValue
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
* Emits when the user requests to open the listbox.
|
|
206
|
+
* @defaultValue
|
|
207
|
+
* ```
|
|
208
|
+
* `${this.id()}-errormessage`
|
|
209
|
+
* ```
|
|
220
210
|
*/
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
211
|
+
errormessageId = input(`${this.id()}-errormessage`, /* @ts-ignore */
|
|
212
|
+
...(ngDevMode ? [{ debugName: "errormessageId" }] : /* istanbul ignore next */ []));
|
|
213
|
+
/** Combined disabled state from input and form control. */
|
|
214
|
+
disabled = computed(() => this.disabledInput() || this.disabledByForm(), /* @ts-ignore */
|
|
215
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
216
|
+
onTouched = () => { };
|
|
217
|
+
onChange = () => { };
|
|
218
|
+
onValueWrite;
|
|
219
|
+
disabledByForm = signal(false, /* @ts-ignore */
|
|
220
|
+
...(ngDevMode ? [{ debugName: "disabledByForm" }] : /* istanbul ignore next */ []));
|
|
221
|
+
overlay = inject(Overlay);
|
|
222
|
+
focusTrapFactory = inject(ConfigurableFocusTrapFactory);
|
|
223
|
+
elementRef = inject(ElementRef);
|
|
224
|
+
viewContainerRef = inject(ViewContainerRef);
|
|
225
|
+
destroyRef = inject(DestroyRef);
|
|
226
|
+
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
227
|
+
overlayRef;
|
|
228
|
+
focusTrap;
|
|
229
|
+
dropdownDirective = signal(undefined, /* @ts-ignore */
|
|
230
|
+
...(ngDevMode ? [{ debugName: "dropdownDirective" }] : /* istanbul ignore next */ []));
|
|
231
|
+
constructor() {
|
|
232
|
+
this.destroyRef.onDestroy(() => {
|
|
233
|
+
this.isOpen.set(false);
|
|
234
|
+
this.disposeOverlay();
|
|
235
|
+
});
|
|
236
236
|
}
|
|
237
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
238
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiSelectInputComponent, isStandalone: true, selector: "si-select-input", inputs: { baseId: { classPropertyName: "baseId", publicName: "baseId", isSignal: true, isRequired: true, transformFunction: null }, labelledby: { classPropertyName: "labelledby", publicName: "labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, controls: { classPropertyName: "controls", publicName: "controls", isSignal: true, isRequired: true, transformFunction: null }, optionTemplate: { classPropertyName: "optionTemplate", publicName: "optionTemplate", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { openListbox: "openListbox" }, host: { attributes: { "aria-autocomplete": "none" }, listeners: { "blur": "blur()", "click": "click($event)", "keydown.arrowDown": "click($event)", "keydown.alt.arrowDown": "click($event)", "keydown.arrowUp": "click($event)", "keydown.enter": "click($event)", "keydown.space": "click($event)" }, properties: { "attr.role": "readonly() ? \"textbox\": \"combobox\"", "attr.aria-haspopup": "readonly() ? undefined : \"listbox\"", "attr.aria-expanded": "readonly() ? undefined : open()", "attr.aria-controls": "readonly() ? undefined : controls()", "attr.aria-readonly": "readonly()", "attr.aria-labelledby": "labeledBy()", "attr.aria-disabled": "selectionStrategy.disabled()", "attr.tabindex": "selectionStrategy.disabled() ? \"-1\" : \"0\"", "class.disabled": "selectionStrategy.disabled()", "class.active": "open()" }, classAttribute: "select focus-none dropdown-toggle d-flex align-items-center ps-4" }, ngImport: i0, template: "@if (ariaLabel()) {\n <span class=\"visually-hidden\" [id]=\"baseId() + '-aria-label'\">{{ ariaLabel() }}</span>\n}\n<div\n class=\"d-flex align-items-center flex-fill overflow-hidden h-100\"\n [id]=\"baseId() + '-content'\"\n [siAutoCollapsableList]=\"selectionStrategy.allowMultiple && selectedRows().length > 1\"\n>\n @for (activeOption of selectedRows(); track activeOption) {\n @if (activeOption) {\n <si-select-option\n class=\"h-100\"\n siAutoCollapsableListItem\n [option]=\"activeOption\"\n [optionTemplate]=\"optionTemplate()\"\n [class.overflow-hidden]=\"!selectionStrategy.allowMultiple || $count === 1\"\n />\n }\n } @empty {\n <div class=\"text-secondary\">{{ placeholder() | translate }}</div>\n }\n @if (selectionStrategy.allowMultiple) {\n <div #overflowItem=\"siAutoCollapsableListOverflowItem\" siAutoCollapsableListOverflowItem>\n <div class=\"pill py-0 ms-2\"> {{ overflowItem.hiddenItemCount }}+</div>\n </div>\n }\n</div>\n<div class=\"form-control-actions\">\n <si-icon\n class=\"dropdown-caret icon flip-rtl ps-0 m-0\"\n [class.text-disabled]=\"readonly()\"\n [icon]=\"icons.elementDown2\"\n />\n</div>\n", styles: ["@charset \"UTF-8\";:host{cursor:pointer;min-inline-size:72px;block-size:100%;color:var(--si-sys-color-text-primary);padding-inline-end:calc(var(--si-sys-sizing-spacing-y-20) - 1px + var(--si-feedback-icon-size, 0px))}:host.disabled{color:var(--si-sys-color-text-disabled)}:host-context(.form-control) :host{padding-block:calc(var(--si-sys-sizing-spacing-y-20) - 1px);padding-inline-end:var(--si-input-padding-inline-end)}si-select-option+si-select-option:before{content:\",\\a0\"}\n"], dependencies: [{ kind: "ngmodule", type: SiAutoCollapsableListModule }, { kind: "directive", type: i1.SiAutoCollapsableListDirective, selector: "[siAutoCollapsableList]", inputs: ["siAutoCollapsableList", "gap", "siAutoCollapsableListContainerElement"], exportAs: ["siAutoCollapsableList"] }, { kind: "directive", type: i1.SiAutoCollapsableListItemDirective, selector: "[siAutoCollapsableListItem]", inputs: ["forceHide"], exportAs: ["siAutoCollapsableListItem"] }, { kind: "directive", type: i1.SiAutoCollapsableListOverflowItemDirective, selector: "[siAutoCollapsableListOverflowItem]", exportAs: ["siAutoCollapsableListOverflowItem"] }, { kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiSelectOptionComponent, selector: "si-select-option", inputs: ["option", "optionTemplate"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
239
|
-
}
|
|
240
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectInputComponent, decorators: [{
|
|
241
|
-
type: Component,
|
|
242
|
-
args: [{ selector: 'si-select-input', imports: [SiAutoCollapsableListModule, SiIconComponent, SiSelectOptionComponent, SiTranslatePipe], host: {
|
|
243
|
-
// In readonly mode, the select needs to be announced as a textbox.
|
|
244
|
-
// Otherwise, screen-reader won't announce the readonly state.
|
|
245
|
-
class: 'select focus-none dropdown-toggle d-flex align-items-center ps-4',
|
|
246
|
-
'aria-autocomplete': 'none',
|
|
247
|
-
'[attr.role]': 'readonly() ? "textbox": "combobox"',
|
|
248
|
-
'[attr.aria-haspopup]': 'readonly() ? undefined : "listbox"',
|
|
249
|
-
'[attr.aria-expanded]': 'readonly() ? undefined : open()',
|
|
250
|
-
'[attr.aria-controls]': 'readonly() ? undefined : controls()',
|
|
251
|
-
'[attr.aria-readonly]': 'readonly()',
|
|
252
|
-
'[attr.aria-labelledby]': 'labeledBy()',
|
|
253
|
-
'[attr.aria-disabled]': 'selectionStrategy.disabled()',
|
|
254
|
-
'[attr.tabindex]': 'selectionStrategy.disabled() ? "-1" : "0"',
|
|
255
|
-
'[class.disabled]': 'selectionStrategy.disabled()',
|
|
256
|
-
'[class.active]': 'open()',
|
|
257
|
-
'(blur)': 'blur()',
|
|
258
|
-
'(click)': 'click($event)',
|
|
259
|
-
'(keydown.arrowDown)': 'click($event)',
|
|
260
|
-
'(keydown.alt.arrowDown)': 'click($event)',
|
|
261
|
-
'(keydown.arrowUp)': 'click($event)',
|
|
262
|
-
'(keydown.enter)': 'click($event)',
|
|
263
|
-
'(keydown.space)': 'click($event)'
|
|
264
|
-
}, template: "@if (ariaLabel()) {\n <span class=\"visually-hidden\" [id]=\"baseId() + '-aria-label'\">{{ ariaLabel() }}</span>\n}\n<div\n class=\"d-flex align-items-center flex-fill overflow-hidden h-100\"\n [id]=\"baseId() + '-content'\"\n [siAutoCollapsableList]=\"selectionStrategy.allowMultiple && selectedRows().length > 1\"\n>\n @for (activeOption of selectedRows(); track activeOption) {\n @if (activeOption) {\n <si-select-option\n class=\"h-100\"\n siAutoCollapsableListItem\n [option]=\"activeOption\"\n [optionTemplate]=\"optionTemplate()\"\n [class.overflow-hidden]=\"!selectionStrategy.allowMultiple || $count === 1\"\n />\n }\n } @empty {\n <div class=\"text-secondary\">{{ placeholder() | translate }}</div>\n }\n @if (selectionStrategy.allowMultiple) {\n <div #overflowItem=\"siAutoCollapsableListOverflowItem\" siAutoCollapsableListOverflowItem>\n <div class=\"pill py-0 ms-2\"> {{ overflowItem.hiddenItemCount }}+</div>\n </div>\n }\n</div>\n<div class=\"form-control-actions\">\n <si-icon\n class=\"dropdown-caret icon flip-rtl ps-0 m-0\"\n [class.text-disabled]=\"readonly()\"\n [icon]=\"icons.elementDown2\"\n />\n</div>\n", styles: ["@charset \"UTF-8\";:host{cursor:pointer;min-inline-size:72px;block-size:100%;color:var(--si-sys-color-text-primary);padding-inline-end:calc(var(--si-sys-sizing-spacing-y-20) - 1px + var(--si-feedback-icon-size, 0px))}:host.disabled{color:var(--si-sys-color-text-disabled)}:host-context(.form-control) :host{padding-block:calc(var(--si-sys-sizing-spacing-y-20) - 1px);padding-inline-end:var(--si-input-padding-inline-end)}si-select-option+si-select-option:before{content:\",\\a0\"}\n"] }]
|
|
265
|
-
}], propDecorators: { baseId: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseId", required: true }] }], labelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelledby", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], controls: [{ type: i0.Input, args: [{ isSignal: true, alias: "controls", required: true }] }], optionTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionTemplate", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], openListbox: [{ type: i0.Output, args: ["openListbox"] }] } });
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Copyright (c) Siemens 2016 - 2026
|
|
269
|
-
* SPDX-License-Identifier: MIT
|
|
270
|
-
*/
|
|
271
|
-
class SiSelectOptionRowComponent {
|
|
272
237
|
/**
|
|
273
|
-
*
|
|
238
|
+
* Registers the dropdown directive. Called by
|
|
239
|
+
* {@link SiSelectDropdownDirective} when it is initialized.
|
|
240
|
+
* @internal
|
|
274
241
|
*/
|
|
275
|
-
|
|
276
|
-
|
|
242
|
+
registerDropdown(directive) {
|
|
243
|
+
this.dropdownDirective.set(directive);
|
|
244
|
+
}
|
|
277
245
|
/**
|
|
278
|
-
*
|
|
246
|
+
* Registers a callback invoked synchronously on every value write, including same-reference writes.
|
|
247
|
+
* @internal
|
|
279
248
|
*/
|
|
280
|
-
|
|
281
|
-
|
|
249
|
+
registerOnValueWrite(fn) {
|
|
250
|
+
this.onValueWrite = fn;
|
|
251
|
+
}
|
|
282
252
|
/**
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
* @defaultValue false
|
|
253
|
+
* Updates the value programmatically.
|
|
254
|
+
* Call this from your dropdown template to set the new value.
|
|
286
255
|
*/
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
256
|
+
updateValue(value) {
|
|
257
|
+
this.value.set(value);
|
|
258
|
+
this.onValueWrite?.(value);
|
|
259
|
+
this.onChange(value);
|
|
260
|
+
}
|
|
261
|
+
/** Opens the dropdown overlay. */
|
|
262
|
+
open(event) {
|
|
263
|
+
if (this.disabled() || this.readonly() || this.isOpen() || !this.isBrowser) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (!this.dropdownDirective()) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
// Prevent default scrolling behavior for Space / ArrowUp / ArrowDown.
|
|
270
|
+
event?.preventDefault();
|
|
271
|
+
const width = this.elementRef.nativeElement.getBoundingClientRect().width;
|
|
272
|
+
this.overlayRef = this.overlay.create({
|
|
273
|
+
positionStrategy: this.overlay
|
|
274
|
+
.position()
|
|
275
|
+
.flexibleConnectedTo(this.elementRef)
|
|
276
|
+
.withPositions([
|
|
277
|
+
// Preferred: below, aligned to the start edge of the trigger.
|
|
278
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },
|
|
279
|
+
// Below, aligned to the end edge (trigger near the end of the viewport).
|
|
280
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },
|
|
281
|
+
// Above, aligned to the start edge (no space below).
|
|
282
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },
|
|
283
|
+
// Above, aligned to the end edge (no space below, trigger near the end).
|
|
284
|
+
{ originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom' },
|
|
285
|
+
// Below, centered (small screens, trigger in the middle).
|
|
286
|
+
{ originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },
|
|
287
|
+
// Above, centered.
|
|
288
|
+
{ originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' }
|
|
289
|
+
])
|
|
290
|
+
.withFlexibleDimensions(true)
|
|
291
|
+
.withPush(true),
|
|
292
|
+
hasBackdrop: true,
|
|
293
|
+
scrollStrategy: this.scrollStrategy(),
|
|
294
|
+
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
295
|
+
panelClass: ['dropdown-menu', 'show'],
|
|
296
|
+
minWidth: width + 2
|
|
297
|
+
});
|
|
298
|
+
const portal = new TemplatePortal(this.dropdownDirective().templateRef, this.viewContainerRef);
|
|
299
|
+
this.overlayRef.attach(portal);
|
|
300
|
+
this.overlayRef.overlayElement.id = this.dropdownId();
|
|
301
|
+
this.dropdownDirective()
|
|
302
|
+
.overlayCloseEvents(this.overlayRef)
|
|
303
|
+
.subscribe(restoreFocus => this.closeOverlay(restoreFocus));
|
|
304
|
+
this.focusTrap = this.focusTrapFactory.create(this.overlayRef.overlayElement);
|
|
305
|
+
this.focusTrap.focusFirstTabbableElementWhenReady();
|
|
306
|
+
this.isOpen.set(true);
|
|
307
|
+
this.openChange.emit(true);
|
|
308
|
+
}
|
|
309
|
+
/** Closes the dropdown overlay and restores focus. */
|
|
310
|
+
close() {
|
|
311
|
+
this.closeOverlay(true);
|
|
312
|
+
}
|
|
313
|
+
blur() {
|
|
314
|
+
if (!this.isOpen()) {
|
|
315
|
+
this.onTouched();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/** @internal */
|
|
319
|
+
writeValue(obj) {
|
|
320
|
+
this.value.set(obj);
|
|
321
|
+
this.onValueWrite?.(obj);
|
|
322
|
+
}
|
|
323
|
+
/** @internal */
|
|
324
|
+
registerOnChange(fn) {
|
|
325
|
+
this.onChange = fn;
|
|
326
|
+
}
|
|
327
|
+
/** @internal */
|
|
328
|
+
registerOnTouched(fn) {
|
|
329
|
+
this.onTouched = fn;
|
|
330
|
+
}
|
|
331
|
+
/** @internal */
|
|
332
|
+
setDisabledState(isDisabled) {
|
|
333
|
+
this.disabledByForm.set(isDisabled);
|
|
334
|
+
}
|
|
335
|
+
closeOverlay(restoreFocus) {
|
|
336
|
+
// Also guards re-entry from the detachment emitted synchronously by dispose().
|
|
337
|
+
if (!this.isOpen()) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
this.isOpen.set(false);
|
|
341
|
+
this.disposeOverlay();
|
|
342
|
+
this.openChange.emit(false);
|
|
343
|
+
// Focus restoration lets the browser continue Tab navigation from the trigger.
|
|
344
|
+
if (restoreFocus) {
|
|
345
|
+
this.elementRef.nativeElement.focus();
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
this.onTouched();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
disposeOverlay() {
|
|
352
|
+
this.focusTrap?.destroy();
|
|
353
|
+
this.overlayRef?.dispose();
|
|
354
|
+
this.focusTrap = undefined;
|
|
355
|
+
this.overlayRef = undefined;
|
|
356
|
+
}
|
|
357
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiCustomSelectDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
358
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: SiCustomSelectDirective, isStandalone: true, selector: "[siCustomSelect]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, labelledbyInput: { classPropertyName: "labelledbyInput", publicName: "labelledby", isSignal: true, isRequired: false, transformFunction: null }, scrollStrategy: { classPropertyName: "scrollStrategy", publicName: "siCustomSelectScrollStrategy", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, errormessageId: { classPropertyName: "errormessageId", publicName: "errormessageId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { openChange: "openChange", value: "valueChange" }, host: { attributes: { "role": "combobox", "aria-autocomplete": "none" }, listeners: { "click": "open()", "keydown.enter": "open()", "keydown.space": "open($event)", "keydown.arrowDown": "open($event)", "keydown.arrowUp": "open($event)", "keydown.alt.arrowDown": "open($event)", "blur": "blur()" }, properties: { "style.--si-action-icon-offset.rem": "1.5", "attr.aria-haspopup": "haspopup()", "attr.aria-labelledby": "hostLabelledby()", "attr.aria-describedby": "errormessageId()", "attr.aria-controls": "isOpen() ? dropdownId() : null", "attr.aria-expanded": "isOpen()", "attr.aria-disabled": "disabled() || readonly()", "attr.id": "id()", "attr.tabindex": "disabled() ? \"-1\" : \"0\"", "class.disabled": "disabled()", "class.pe-none": "disabled()", "class.readonly": "readonly()", "class.open": "isOpen()", "class.show": "isOpen()" }, classAttribute: "dropdown" }, providers: [
|
|
359
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: SiCustomSelectDirective, multi: true },
|
|
360
|
+
{ provide: SI_FORM_ITEM_CONTROL, useExisting: SiCustomSelectDirective }
|
|
361
|
+
], ngImport: i0 });
|
|
362
|
+
}
|
|
363
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiCustomSelectDirective, decorators: [{
|
|
364
|
+
type: Directive,
|
|
365
|
+
args: [{
|
|
366
|
+
selector: '[siCustomSelect]',
|
|
367
|
+
providers: [
|
|
368
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: SiCustomSelectDirective, multi: true },
|
|
369
|
+
{ provide: SI_FORM_ITEM_CONTROL, useExisting: SiCustomSelectDirective }
|
|
370
|
+
],
|
|
371
|
+
host: {
|
|
372
|
+
class: 'dropdown',
|
|
373
|
+
'[style.--si-action-icon-offset.rem]': '1.5',
|
|
374
|
+
role: 'combobox',
|
|
375
|
+
'aria-autocomplete': 'none',
|
|
376
|
+
'[attr.aria-haspopup]': 'haspopup()',
|
|
377
|
+
'[attr.aria-labelledby]': 'hostLabelledby()',
|
|
378
|
+
'[attr.aria-describedby]': 'errormessageId()',
|
|
379
|
+
'[attr.aria-controls]': 'isOpen() ? dropdownId() : null',
|
|
380
|
+
'[attr.aria-expanded]': 'isOpen()',
|
|
381
|
+
// Use aria-disabled as a workaround because screen readers currently do not announce
|
|
382
|
+
// aria-readonly on comboboxes. Readonly selects remain focusable.
|
|
383
|
+
'[attr.aria-disabled]': 'disabled() || readonly()',
|
|
384
|
+
'[attr.id]': 'id()',
|
|
385
|
+
'[attr.tabindex]': 'disabled() ? "-1" : "0"',
|
|
386
|
+
'[class.disabled]': 'disabled()',
|
|
387
|
+
'[class.pe-none]': 'disabled()',
|
|
388
|
+
'[class.readonly]': 'readonly()',
|
|
389
|
+
'[class.open]': 'isOpen()',
|
|
390
|
+
'[class.show]': 'isOpen()',
|
|
391
|
+
'(click)': 'open()',
|
|
392
|
+
'(keydown.enter)': 'open()',
|
|
393
|
+
'(keydown.space)': 'open($event)',
|
|
394
|
+
'(keydown.arrowDown)': 'open($event)',
|
|
395
|
+
'(keydown.arrowUp)': 'open($event)',
|
|
396
|
+
'(keydown.alt.arrowDown)': 'open($event)',
|
|
397
|
+
'(blur)': 'blur()'
|
|
398
|
+
}
|
|
399
|
+
}]
|
|
400
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], labelledbyInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelledby", required: false }] }], scrollStrategy: [{ type: i0.Input, args: [{ isSignal: true, alias: "siCustomSelectScrollStrategy", required: false }] }], openChange: [{ type: i0.Output, args: ["openChange"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], errormessageId: [{ type: i0.Input, args: [{ isSignal: true, alias: "errormessageId", required: false }] }] } });
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
404
|
+
* SPDX-License-Identifier: MIT
|
|
405
|
+
*/
|
|
406
|
+
/**
|
|
407
|
+
* Selection strategy base class.
|
|
408
|
+
*/
|
|
409
|
+
class SiSelectSelectionStrategy {
|
|
410
|
+
/**
|
|
411
|
+
* The selected value(s).
|
|
412
|
+
*/
|
|
413
|
+
set value(value) {
|
|
414
|
+
this.select.writeValue(value);
|
|
415
|
+
}
|
|
416
|
+
/** Emitted when the selection is changed */
|
|
417
|
+
valueChange = output();
|
|
418
|
+
/**
|
|
419
|
+
* Provides the internal value always as an array
|
|
420
|
+
* @internal
|
|
421
|
+
*/
|
|
422
|
+
arrayValue = computed(() => this.selectOptions.selectedRows().map(option => option.value), /* @ts-ignore */
|
|
423
|
+
...(ngDevMode ? [{ debugName: "arrayValue" }] : /* istanbul ignore next */ []));
|
|
424
|
+
selectOptions = inject(SI_SELECT_OPTIONS_STRATEGY);
|
|
425
|
+
select = inject(SiCustomSelectDirective, {
|
|
426
|
+
self: true
|
|
427
|
+
});
|
|
428
|
+
constructor() {
|
|
429
|
+
this.select.registerOnValueWrite(value => this.syncSelection(value));
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* CDK Listbox value changed handler.
|
|
433
|
+
* @internal
|
|
434
|
+
*/
|
|
435
|
+
updateFromUser(values) {
|
|
436
|
+
const parsedValue = this.fromArrayValue(values);
|
|
437
|
+
this.select.updateValue(parsedValue);
|
|
438
|
+
this.valueChange.emit(parsedValue);
|
|
439
|
+
}
|
|
440
|
+
syncSelection(value) {
|
|
441
|
+
this.selectOptions.onValueChange([...this.toArrayValue(value)]);
|
|
442
|
+
}
|
|
443
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectSelectionStrategy, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
444
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: SiSelectSelectionStrategy, isStandalone: true, inputs: { value: "value" }, outputs: { valueChange: "valueChange" }, ngImport: i0 });
|
|
445
|
+
}
|
|
446
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectSelectionStrategy, decorators: [{
|
|
447
|
+
type: Directive
|
|
448
|
+
}], ctorParameters: () => [], propDecorators: { value: [{
|
|
449
|
+
type: Input
|
|
450
|
+
}], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
454
|
+
* SPDX-License-Identifier: MIT
|
|
455
|
+
*/
|
|
456
|
+
class SiSelectInputComponent {
|
|
457
|
+
/**
|
|
458
|
+
* Aria label of the select.
|
|
459
|
+
*
|
|
460
|
+
* @defaultValue null
|
|
461
|
+
*/
|
|
462
|
+
ariaLabel = input(null, /* @ts-ignore */
|
|
463
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
464
|
+
/**
|
|
465
|
+
* Text shown when no option is selected.
|
|
466
|
+
*/
|
|
467
|
+
placeholder = input(/* @ts-ignore */
|
|
468
|
+
...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
469
|
+
/**
|
|
470
|
+
* Custom template for rendering selected options.
|
|
471
|
+
*/
|
|
472
|
+
optionTemplate = input(/* @ts-ignore */
|
|
473
|
+
...(ngDevMode ? [undefined, { debugName: "optionTemplate" }] : /* istanbul ignore next */ []));
|
|
474
|
+
select = inject(SiCustomSelectDirective);
|
|
475
|
+
selectionStrategy = inject((SiSelectSelectionStrategy));
|
|
476
|
+
selectOptions = inject(SI_SELECT_OPTIONS_STRATEGY);
|
|
477
|
+
selectedRows = this.selectOptions.selectedRows;
|
|
478
|
+
icons = addIcons({ elementDown2 });
|
|
479
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
480
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiSelectInputComponent, isStandalone: true, selector: "si-select-input", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, optionTemplate: { classPropertyName: "optionTemplate", publicName: "optionTemplate", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.disabled": "select.disabled()", "class.active": "select.isOpen()" }, classAttribute: "select focus-none dropdown-toggle d-flex align-items-center ps-4" }, ngImport: i0, template: "<span class=\"visually-hidden\" [id]=\"select.comboboxLabelId()\">\n @if (ariaLabel()) {\n <span [id]=\"select.id() + '-aria-label'\">{{ ariaLabel() }}</span>\n }\n</span>\n<div\n class=\"d-flex align-items-center flex-fill overflow-hidden h-100\"\n [id]=\"select.id() + '-content'\"\n [siAutoCollapsableList]=\"selectionStrategy.allowMultiple && selectedRows().length > 1\"\n>\n @for (activeOption of selectedRows(); track activeOption) {\n @if (activeOption) {\n <si-select-option\n class=\"h-100\"\n siAutoCollapsableListItem\n [option]=\"activeOption\"\n [optionTemplate]=\"optionTemplate()\"\n [class.overflow-hidden]=\"!selectionStrategy.allowMultiple || $count === 1\"\n />\n }\n } @empty {\n <div class=\"text-secondary\">{{ placeholder() | translate }}</div>\n }\n @if (selectionStrategy.allowMultiple) {\n <div #overflowItem=\"siAutoCollapsableListOverflowItem\" siAutoCollapsableListOverflowItem>\n <div class=\"pill py-0 ms-2\"> {{ overflowItem.hiddenItemCount }}+</div>\n </div>\n }\n</div>\n<div class=\"form-control-actions\">\n <si-icon\n class=\"dropdown-caret icon flip-rtl ps-0 m-0\"\n [class.text-disabled]=\"select.readonly()\"\n [icon]=\"icons.elementDown2\"\n />\n</div>\n", styles: ["@charset \"UTF-8\";:host{cursor:pointer;min-inline-size:72px;block-size:100%;color:var(--si-sys-color-text-primary);padding-inline-end:calc(var(--si-sys-sizing-spacing-y-20) - 1px + var(--si-feedback-icon-size, 0px))}:host.disabled{color:var(--si-sys-color-text-disabled)}:host-context(.form-control) :host{padding-block:calc(var(--si-sys-sizing-spacing-y-20) - 1px);padding-inline-end:var(--si-input-padding-inline-end)}si-select-option+si-select-option:before{content:\",\\a0\"}\n"], dependencies: [{ kind: "ngmodule", type: SiAutoCollapsableListModule }, { kind: "directive", type: i1.SiAutoCollapsableListDirective, selector: "[siAutoCollapsableList]", inputs: ["siAutoCollapsableList", "gap", "siAutoCollapsableListContainerElement"], exportAs: ["siAutoCollapsableList"] }, { kind: "directive", type: i1.SiAutoCollapsableListItemDirective, selector: "[siAutoCollapsableListItem]", inputs: ["forceHide"], exportAs: ["siAutoCollapsableListItem"] }, { kind: "directive", type: i1.SiAutoCollapsableListOverflowItemDirective, selector: "[siAutoCollapsableListOverflowItem]", exportAs: ["siAutoCollapsableListOverflowItem"] }, { kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiSelectOptionComponent, selector: "si-select-option", inputs: ["option", "optionTemplate"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
481
|
+
}
|
|
482
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectInputComponent, decorators: [{
|
|
483
|
+
type: Component,
|
|
484
|
+
args: [{ selector: 'si-select-input', imports: [SiAutoCollapsableListModule, SiIconComponent, SiSelectOptionComponent, SiTranslatePipe], host: {
|
|
485
|
+
class: 'select focus-none dropdown-toggle d-flex align-items-center ps-4',
|
|
486
|
+
'[class.disabled]': 'select.disabled()',
|
|
487
|
+
'[class.active]': 'select.isOpen()'
|
|
488
|
+
}, template: "<span class=\"visually-hidden\" [id]=\"select.comboboxLabelId()\">\n @if (ariaLabel()) {\n <span [id]=\"select.id() + '-aria-label'\">{{ ariaLabel() }}</span>\n }\n</span>\n<div\n class=\"d-flex align-items-center flex-fill overflow-hidden h-100\"\n [id]=\"select.id() + '-content'\"\n [siAutoCollapsableList]=\"selectionStrategy.allowMultiple && selectedRows().length > 1\"\n>\n @for (activeOption of selectedRows(); track activeOption) {\n @if (activeOption) {\n <si-select-option\n class=\"h-100\"\n siAutoCollapsableListItem\n [option]=\"activeOption\"\n [optionTemplate]=\"optionTemplate()\"\n [class.overflow-hidden]=\"!selectionStrategy.allowMultiple || $count === 1\"\n />\n }\n } @empty {\n <div class=\"text-secondary\">{{ placeholder() | translate }}</div>\n }\n @if (selectionStrategy.allowMultiple) {\n <div #overflowItem=\"siAutoCollapsableListOverflowItem\" siAutoCollapsableListOverflowItem>\n <div class=\"pill py-0 ms-2\"> {{ overflowItem.hiddenItemCount }}+</div>\n </div>\n }\n</div>\n<div class=\"form-control-actions\">\n <si-icon\n class=\"dropdown-caret icon flip-rtl ps-0 m-0\"\n [class.text-disabled]=\"select.readonly()\"\n [icon]=\"icons.elementDown2\"\n />\n</div>\n", styles: ["@charset \"UTF-8\";:host{cursor:pointer;min-inline-size:72px;block-size:100%;color:var(--si-sys-color-text-primary);padding-inline-end:calc(var(--si-sys-sizing-spacing-y-20) - 1px + var(--si-feedback-icon-size, 0px))}:host.disabled{color:var(--si-sys-color-text-disabled)}:host-context(.form-control) :host{padding-block:calc(var(--si-sys-sizing-spacing-y-20) - 1px);padding-inline-end:var(--si-input-padding-inline-end)}si-select-option+si-select-option:before{content:\",\\a0\"}\n"] }]
|
|
489
|
+
}], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], optionTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionTemplate", required: false }] }] } });
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
493
|
+
* SPDX-License-Identifier: MIT
|
|
494
|
+
*/
|
|
495
|
+
class SiSelectOptionRowComponent {
|
|
496
|
+
/**
|
|
497
|
+
* Option displayed by the row.
|
|
498
|
+
*/
|
|
499
|
+
option = input.required(/* @ts-ignore */
|
|
500
|
+
...(ngDevMode ? [{ debugName: "option" }] : /* istanbul ignore next */ []));
|
|
501
|
+
/**
|
|
502
|
+
* Custom template for rendering the option.
|
|
503
|
+
*/
|
|
504
|
+
optionTemplate = input(/* @ts-ignore */
|
|
505
|
+
...(ngDevMode ? [undefined, { debugName: "optionTemplate" }] : /* istanbul ignore next */ []));
|
|
506
|
+
/**
|
|
507
|
+
* Whether the option is selected.
|
|
508
|
+
*
|
|
509
|
+
* @defaultValue false
|
|
510
|
+
*/
|
|
511
|
+
selected = input(false, { ...(ngDevMode ? { debugName: "selected" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
512
|
+
icons = addIcons({ elementOk });
|
|
513
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectOptionRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
514
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiSelectOptionRowComponent, isStandalone: true, selector: "si-select-option-row", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: true, transformFunction: null }, optionTemplate: { classPropertyName: "optionTemplate", publicName: "optionTemplate", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.disabled": "!!this.option().disabled", "attr.aria-selected": "selected()", "attr.data-id": "this.option().value" }, classAttribute: "dropdown-item focus-none pe-4 gap-4" }, ngImport: i0, template: "<span\n class=\"form-check-input si-form-checkbox\"\n [class.checked]=\"selected()\"\n [class.disabled]=\"option().disabled\"\n></span>\n<si-select-option [option]=\"option()\" [optionTemplate]=\"optionTemplate()\" />\n@if (selected()) {\n <span class=\"ms-auto selected-marker\" aria-hidden=\"true\">\n <si-icon class=\"d-block icon\" [icon]=\"icons.elementOk\" />\n </span>\n}\n", styles: [".selected-marker>span{font-size:1.5rem;margin-inline-end:0}.form-check-input{display:none}:host-context(.si-multi-select) .selected-marker{display:none}:host-context(.si-multi-select) .form-check-input{display:block}\n"], dependencies: [{ kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "component", type: SiSelectOptionComponent, selector: "si-select-option", inputs: ["option", "optionTemplate"] }] });
|
|
515
|
+
}
|
|
516
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectOptionRowComponent, decorators: [{
|
|
517
|
+
type: Component,
|
|
518
|
+
args: [{ selector: 'si-select-option-row', imports: [SiIconComponent, SiSelectOptionComponent], host: {
|
|
519
|
+
class: 'dropdown-item focus-none pe-4 gap-4',
|
|
520
|
+
'[class.disabled]': '!!this.option().disabled',
|
|
521
|
+
'[attr.aria-selected]': 'selected()',
|
|
522
|
+
'[attr.data-id]': 'this.option().value'
|
|
523
|
+
}, template: "<span\n class=\"form-check-input si-form-checkbox\"\n [class.checked]=\"selected()\"\n [class.disabled]=\"option().disabled\"\n></span>\n<si-select-option [option]=\"option()\" [optionTemplate]=\"optionTemplate()\" />\n@if (selected()) {\n <span class=\"ms-auto selected-marker\" aria-hidden=\"true\">\n <si-icon class=\"d-block icon\" [icon]=\"icons.elementOk\" />\n </span>\n}\n", styles: [".selected-marker>span{font-size:1.5rem;margin-inline-end:0}.form-check-input{display:none}:host-context(.si-multi-select) .selected-marker{display:none}:host-context(.si-multi-select) .form-check-input{display:block}\n"] }]
|
|
524
|
+
}], propDecorators: { option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: true }] }], optionTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionTemplate", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }] } });
|
|
525
|
+
|
|
302
526
|
/**
|
|
303
527
|
* Copyright (c) Siemens 2016 - 2026
|
|
304
528
|
* SPDX-License-Identifier: MIT
|
|
@@ -388,17 +612,8 @@ class SiSelectListBase {
|
|
|
388
612
|
closeOverlay = output();
|
|
389
613
|
selectionStrategy = inject(SiSelectSelectionStrategy);
|
|
390
614
|
selectOptions = inject(SI_SELECT_OPTIONS_STRATEGY);
|
|
391
|
-
focusTrapFactory = inject(ConfigurableFocusTrapFactory);
|
|
392
|
-
elementRef = inject(ElementRef);
|
|
393
615
|
rows = this.selectOptions.rows;
|
|
394
|
-
focusTrap;
|
|
395
616
|
multiSelect = this.selectionStrategy.allowMultiple;
|
|
396
|
-
ngOnInit() {
|
|
397
|
-
this.focusTrap = this.focusTrapFactory.create(this.elementRef.nativeElement);
|
|
398
|
-
}
|
|
399
|
-
ngOnDestroy() {
|
|
400
|
-
this.focusTrap.destroy();
|
|
401
|
-
}
|
|
402
617
|
keydownTab() {
|
|
403
618
|
// Ignore tab key if actions are displayed.
|
|
404
619
|
if (!this.actionsTemplate()) {
|
|
@@ -414,13 +629,13 @@ class SiSelectListBase {
|
|
|
414
629
|
}
|
|
415
630
|
}
|
|
416
631
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectListBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
417
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: SiSelectListBase, isStandalone: true, inputs: { baseId: { classPropertyName: "baseId", publicName: "baseId", isSignal: true, isRequired: true, transformFunction: null }, optionTemplate: { classPropertyName: "optionTemplate", publicName: "optionTemplate", isSignal: true, isRequired: false, transformFunction: null }, groupTemplate: { classPropertyName: "groupTemplate", publicName: "groupTemplate", isSignal: true, isRequired: false, transformFunction: null }, labelledby: { classPropertyName: "labelledby", publicName: "labelledby", isSignal: true, isRequired: false, transformFunction: null }, actionsTemplate: { classPropertyName: "actionsTemplate", publicName: "actionsTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeOverlay: "closeOverlay" }, host: { listeners: { "keydown.tab": "keydownTab()" }, properties: { "class.si-multi-select": "multiSelect" }, classAttribute: "
|
|
632
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: SiSelectListBase, isStandalone: true, inputs: { baseId: { classPropertyName: "baseId", publicName: "baseId", isSignal: true, isRequired: true, transformFunction: null }, optionTemplate: { classPropertyName: "optionTemplate", publicName: "optionTemplate", isSignal: true, isRequired: false, transformFunction: null }, groupTemplate: { classPropertyName: "groupTemplate", publicName: "groupTemplate", isSignal: true, isRequired: false, transformFunction: null }, labelledby: { classPropertyName: "labelledby", publicName: "labelledby", isSignal: true, isRequired: false, transformFunction: null }, actionsTemplate: { classPropertyName: "actionsTemplate", publicName: "actionsTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeOverlay: "closeOverlay" }, host: { listeners: { "keydown.tab": "keydownTab()" }, properties: { "class.si-multi-select": "multiSelect" }, classAttribute: "position-static w-100 d-flex flex-column" }, ngImport: i0 });
|
|
418
633
|
}
|
|
419
634
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectListBase, decorators: [{
|
|
420
635
|
type: Directive,
|
|
421
636
|
args: [{
|
|
422
637
|
host: {
|
|
423
|
-
class: '
|
|
638
|
+
class: 'position-static w-100 d-flex flex-column',
|
|
424
639
|
'[class.si-multi-select]': 'multiSelect',
|
|
425
640
|
'(keydown.tab)': 'keydownTab()'
|
|
426
641
|
}
|
|
@@ -460,7 +675,6 @@ class SiSelectListHasFilterComponent extends SiSelectListBase {
|
|
|
460
675
|
}
|
|
461
676
|
}
|
|
462
677
|
ngOnInit() {
|
|
463
|
-
super.ngOnInit();
|
|
464
678
|
this.selectOptions.onFilter();
|
|
465
679
|
setTimeout(() => this.filterInput().nativeElement.focus());
|
|
466
680
|
}
|
|
@@ -482,7 +696,7 @@ class SiSelectListHasFilterComponent extends SiSelectListBase {
|
|
|
482
696
|
this.closeOverlayIfSingle();
|
|
483
697
|
}
|
|
484
698
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectListHasFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
485
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiSelectListHasFilterComponent, isStandalone: true, selector: "si-select-list-has-filter", inputs: { filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: true, transformFunction: null }, noResultsFoundLabel: { classPropertyName: "noResultsFoundLabel", publicName: "noResultsFoundLabel", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.id": "id()" }, classAttribute: "
|
|
699
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiSelectListHasFilterComponent, isStandalone: true, selector: "si-select-list-has-filter", inputs: { filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: true, transformFunction: null }, noResultsFoundLabel: { classPropertyName: "noResultsFoundLabel", publicName: "noResultsFoundLabel", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.id": "id()" }, classAttribute: "mt-n4" }, viewQueries: [{ propertyName: "filterInput", first: true, predicate: ["filter"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"pt-5 pb-5 px-5 top-0\">\n <div class=\"search-bar variant-background-0\">\n <input\n #filter\n #siAutocomplete=\"siAutocomplete\"\n siAutocomplete\n class=\"search-bar-input form-control\"\n [placeholder]=\"filterPlaceholder() | translate\"\n [id]=\"baseId() + 'filter-input'\"\n [attr.aria-labelledby]=\"baseId() + '-aria-label' + ' ' + labelledby()\"\n (input)=\"input()\"\n />\n <si-icon class=\"search-bar-icon\" [icon]=\"icons.elementSearch\" />\n @if (selectOptions.loading?.()) {\n <si-loading-spinner class=\"position-absolute end-0 bottom-0 d-flex align-items-center p-2\" />\n }\n </div>\n</div>\n<div\n class=\"si-select-filtered-items\"\n tabindex=\"-1\"\n [siAutocompleteListboxFor]=\"siAutocomplete\"\n [siAutocompleteDefaultIndex]=\"initIndex()\"\n [attr.aria-labelledby]=\"baseId() + '-aria-label' + ' ' + labelledby()\"\n (siAutocompleteOptionSubmitted)=\"select($event)\"\n>\n @for (item of rows(); track item; let index = $index) {\n @if (item.type === 'group') {\n <div\n role=\"group\"\n class=\"ps-0\"\n aria-disabled=\"false\"\n [attr.aria-labelledby]=\"baseId() + '-' + index + '-group-header'\"\n >\n <div class=\"dropdown-header\" [id]=\"baseId() + '-' + index + '-group-header'\">\n <ng-container\n [ngTemplateOutlet]=\"groupTemplate() ?? defaultGroupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n </div>\n @for (optionRow of item.options; track optionRow) {\n <ng-container\n [ngTemplateOutlet]=\"optionRowTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: optionRow }\"\n />\n }\n </div>\n }\n @if (item.type === 'option') {\n <ng-container\n [ngTemplateOutlet]=\"optionRowTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n }\n } @empty {\n <div\n role=\"option\"\n aria-disabled=\"true\"\n aria-selected=\"false\"\n class=\"dropdown-item disabled text-secondary justify-content-center mb-2\"\n >\n <span>{{ noResultsFoundLabel() | translate }}</span>\n </div>\n }\n\n <ng-template #optionRowTemplate let-option siSelectOptionRowTemplate>\n <si-select-option-row\n [option]=\"option\"\n [optionTemplate]=\"optionTemplate()\"\n [siAutocompleteOption]=\"option.value\"\n [disabled]=\"option.disabled\"\n [selected]=\"selectionStrategy.arrayValue().includes(option.value)\"\n />\n </ng-template>\n</div>\n@if (actionsTemplate()) {\n <div class=\"dropdown-divider\"></div>\n <div class=\"d-flex flex-column align-items-start\">\n <ng-container\n [ngTemplateOutlet]=\"actionsTemplate()!\"\n [ngTemplateOutletContext]=\"{\n searchText: filter.value,\n visibleOptionsCount: rows().length\n }\"\n />\n </div>\n}\n\n<ng-template #defaultGroupTemplate let-group siSelectGroupTemplate>\n {{ group.label | translate }}\n</ng-template>\n", styles: [".si-select-filtered-items{max-block-size:min(100vb - 56px,266px);overflow-y:auto}si-loading-spinner{--loading-spinner-size: var(--si-sys-sizing-icon-md)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: SiAutocompleteDirective, selector: "input[siAutocomplete]", exportAs: ["siAutocomplete"] }, { kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "directive", type: SiSelectGroupTemplateDirective, selector: "[siSelectGroupTemplate]" }, { kind: "component", type: SiSelectOptionRowComponent, selector: "si-select-option-row", inputs: ["option", "optionTemplate", "selected"] }, { kind: "directive", type: SiSelectOptionRowTemplateDirective, selector: "[siSelectOptionRowTemplate]" }, { kind: "ngmodule", type: SiAutocompleteModule }, { kind: "directive", type: i1$1.SiAutocompleteListboxDirective, selector: "[siAutocompleteListboxFor]", inputs: ["id", "siAutocompleteListboxFor", "siAutocompleteDefaultIndex"], outputs: ["siAutocompleteOptionSubmitted"], exportAs: ["siAutocompleteListbox"] }, { kind: "directive", type: i1$1.SiAutocompleteOptionDirective, selector: "[siAutocompleteOption]", inputs: ["id", "disabled", "siAutocompleteOption"], exportAs: ["siAutocompleteOption"] }, { kind: "component", type: SiLoadingSpinnerComponent, selector: "si-loading-spinner", inputs: ["isBlockingSpinner", "isSpinnerOverlay", "ariaLabel", "loadingText"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
486
700
|
}
|
|
487
701
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectListHasFilterComponent, decorators: [{
|
|
488
702
|
type: Component,
|
|
@@ -497,7 +711,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
497
711
|
SiAutocompleteModule,
|
|
498
712
|
SiLoadingSpinnerComponent
|
|
499
713
|
], host: {
|
|
500
|
-
class: '
|
|
714
|
+
class: 'mt-n4',
|
|
501
715
|
'[attr.id]': 'id()'
|
|
502
716
|
}, template: "<div class=\"pt-5 pb-5 px-5 top-0\">\n <div class=\"search-bar variant-background-0\">\n <input\n #filter\n #siAutocomplete=\"siAutocomplete\"\n siAutocomplete\n class=\"search-bar-input form-control\"\n [placeholder]=\"filterPlaceholder() | translate\"\n [id]=\"baseId() + 'filter-input'\"\n [attr.aria-labelledby]=\"baseId() + '-aria-label' + ' ' + labelledby()\"\n (input)=\"input()\"\n />\n <si-icon class=\"search-bar-icon\" [icon]=\"icons.elementSearch\" />\n @if (selectOptions.loading?.()) {\n <si-loading-spinner class=\"position-absolute end-0 bottom-0 d-flex align-items-center p-2\" />\n }\n </div>\n</div>\n<div\n class=\"si-select-filtered-items\"\n tabindex=\"-1\"\n [siAutocompleteListboxFor]=\"siAutocomplete\"\n [siAutocompleteDefaultIndex]=\"initIndex()\"\n [attr.aria-labelledby]=\"baseId() + '-aria-label' + ' ' + labelledby()\"\n (siAutocompleteOptionSubmitted)=\"select($event)\"\n>\n @for (item of rows(); track item; let index = $index) {\n @if (item.type === 'group') {\n <div\n role=\"group\"\n class=\"ps-0\"\n aria-disabled=\"false\"\n [attr.aria-labelledby]=\"baseId() + '-' + index + '-group-header'\"\n >\n <div class=\"dropdown-header\" [id]=\"baseId() + '-' + index + '-group-header'\">\n <ng-container\n [ngTemplateOutlet]=\"groupTemplate() ?? defaultGroupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n </div>\n @for (optionRow of item.options; track optionRow) {\n <ng-container\n [ngTemplateOutlet]=\"optionRowTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: optionRow }\"\n />\n }\n </div>\n }\n @if (item.type === 'option') {\n <ng-container\n [ngTemplateOutlet]=\"optionRowTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n }\n } @empty {\n <div\n role=\"option\"\n aria-disabled=\"true\"\n aria-selected=\"false\"\n class=\"dropdown-item disabled text-secondary justify-content-center mb-2\"\n >\n <span>{{ noResultsFoundLabel() | translate }}</span>\n </div>\n }\n\n <ng-template #optionRowTemplate let-option siSelectOptionRowTemplate>\n <si-select-option-row\n [option]=\"option\"\n [optionTemplate]=\"optionTemplate()\"\n [siAutocompleteOption]=\"option.value\"\n [disabled]=\"option.disabled\"\n [selected]=\"selectionStrategy.arrayValue().includes(option.value)\"\n />\n </ng-template>\n</div>\n@if (actionsTemplate()) {\n <div class=\"dropdown-divider\"></div>\n <div class=\"d-flex flex-column align-items-start\">\n <ng-container\n [ngTemplateOutlet]=\"actionsTemplate()!\"\n [ngTemplateOutletContext]=\"{\n searchText: filter.value,\n visibleOptionsCount: rows().length\n }\"\n />\n </div>\n}\n\n<ng-template #defaultGroupTemplate let-group siSelectGroupTemplate>\n {{ group.label | translate }}\n</ng-template>\n", styles: [".si-select-filtered-items{max-block-size:min(100vb - 56px,266px);overflow-y:auto}si-loading-spinner{--loading-spinner-size: var(--si-sys-sizing-icon-md)}\n"] }]
|
|
503
717
|
}], ctorParameters: () => [], propDecorators: { filterPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPlaceholder", required: true }] }], noResultsFoundLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "noResultsFoundLabel", required: true }] }], filterInput: [{ type: i0.ViewChild, args: ['filter', { isSignal: true }] }] } });
|
|
@@ -509,7 +723,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
509
723
|
class SiSelectListComponent extends SiSelectListBase {
|
|
510
724
|
listbox = viewChild.required(CdkListbox, { ...(ngDevMode ? { debugName: "listbox" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
511
725
|
ngOnInit() {
|
|
512
|
-
super.ngOnInit();
|
|
513
726
|
setTimeout(() => this.listbox().nativeElement.focus());
|
|
514
727
|
}
|
|
515
728
|
listBoxValueChange(changeEvent) {
|
|
@@ -554,23 +767,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
554
767
|
}] });
|
|
555
768
|
|
|
556
769
|
/**
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
*
|
|
562
|
-
* This requires using the {@link SiSelectSimpleOptionsDirective} to specify options as input.
|
|
770
|
+
* Structural directive marking the dropdown template for custom selects
|
|
771
|
+
* built with {@link SiCustomSelectDirective}.
|
|
772
|
+
*
|
|
773
|
+
* When placed on an `<ng-template>`, it automatically registers the template
|
|
774
|
+
* with the parent {@link SiCustomSelectDirective}.
|
|
563
775
|
*
|
|
564
776
|
* @example
|
|
565
777
|
* ```html
|
|
566
|
-
* <si-select
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
* ]">
|
|
570
|
-
* <ng-template siSelectValueTemplate let-option>{{ option.label }}</ng-template>
|
|
571
|
-
* </si-select>
|
|
778
|
+
* <ng-template si-select-dropdown contentType="listbox">
|
|
779
|
+
* <!-- custom dropdown content -->
|
|
780
|
+
* </ng-template>
|
|
572
781
|
* ```
|
|
573
|
-
|
|
782
|
+
*
|
|
783
|
+
* @experimental
|
|
784
|
+
*/
|
|
785
|
+
class SiSelectDropdownDirective {
|
|
786
|
+
/**
|
|
787
|
+
* Describes the kind of content rendered by the dropdown. The value is
|
|
788
|
+
* forwarded to the `aria-haspopup` attribute of the combobox host of
|
|
789
|
+
* the parent {@link SiCustomSelectDirective}.
|
|
790
|
+
*/
|
|
791
|
+
contentType = input.required(/* @ts-ignore */
|
|
792
|
+
...(ngDevMode ? [{ debugName: "contentType" }] : /* istanbul ignore next */ []));
|
|
793
|
+
/**
|
|
794
|
+
* Whether pressing Tab closes the dropdown.
|
|
795
|
+
*
|
|
796
|
+
* Keep this disabled when the dropdown contains controls that users must reach with Tab.
|
|
797
|
+
*
|
|
798
|
+
* @defaultValue false
|
|
799
|
+
*/
|
|
800
|
+
closeOnTab = input(false, { ...(ngDevMode ? { debugName: "closeOnTab" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
801
|
+
/** @internal */
|
|
802
|
+
templateRef = inject(TemplateRef);
|
|
803
|
+
constructor() {
|
|
804
|
+
inject(SiCustomSelectDirective).registerDropdown(this);
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Emits when the overlay should close; the value indicates whether focus should be restored.
|
|
808
|
+
* Completes when the overlay is disposed.
|
|
809
|
+
* @internal
|
|
810
|
+
*/
|
|
811
|
+
overlayCloseEvents(overlayRef) {
|
|
812
|
+
const escape$ = overlayRef.keydownEvents().pipe(filter(event => event.key === 'Escape'), tap(event => event.stopPropagation()), map(() => true));
|
|
813
|
+
const tab$ = overlayRef.keydownEvents().pipe(filter(event => event.key === 'Tab' && this.closeOnTab()), map(() => true));
|
|
814
|
+
const backdrop$ = overlayRef.backdropClick().pipe(map(() => false));
|
|
815
|
+
// E.g. closed by the scroll strategy; the detachment from our own dispose() is ignored by the caller.
|
|
816
|
+
const detach$ = overlayRef.detachments().pipe(map(() => true));
|
|
817
|
+
return merge(escape$, tab$, backdrop$, detach$);
|
|
818
|
+
}
|
|
819
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectDropdownDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
820
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: SiSelectDropdownDirective, isStandalone: true, selector: "[si-select-dropdown]", inputs: { contentType: { classPropertyName: "contentType", publicName: "contentType", isSignal: true, isRequired: true, transformFunction: null }, closeOnTab: { classPropertyName: "closeOnTab", publicName: "closeOnTab", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
821
|
+
}
|
|
822
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectDropdownDirective, decorators: [{
|
|
823
|
+
type: Directive,
|
|
824
|
+
args: [{
|
|
825
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
826
|
+
selector: '[si-select-dropdown]'
|
|
827
|
+
}]
|
|
828
|
+
}], ctorParameters: () => [], propDecorators: { contentType: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentType", required: true }] }], closeOnTab: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnTab", required: false }] }] } });
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
832
|
+
* SPDX-License-Identifier: MIT
|
|
833
|
+
*/
|
|
834
|
+
/**
|
|
835
|
+
* The directive allows to template/customize the selected value rendering in the select input.
|
|
836
|
+
* This requires using the {@link SiSelectSimpleOptionsDirective} to specify options as input.
|
|
837
|
+
*
|
|
838
|
+
* @example
|
|
839
|
+
* ```html
|
|
840
|
+
* <si-select [options]="[
|
|
841
|
+
* { type: 'option', value: 'good', label: 'Good' },
|
|
842
|
+
* { type: 'option', value: 'fair', label: 'Fair' }
|
|
843
|
+
* ]">
|
|
844
|
+
* <ng-template siSelectValueTemplate let-option>{{ option.label }}</ng-template>
|
|
845
|
+
* </si-select>
|
|
846
|
+
* ```
|
|
847
|
+
*/
|
|
574
848
|
class SiSelectValueTemplateDirective {
|
|
575
849
|
/** @internal */
|
|
576
850
|
static ngTemplateContextGuard(directive, context) {
|
|
@@ -591,17 +865,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
591
865
|
* SPDX-License-Identifier: MIT
|
|
592
866
|
*/
|
|
593
867
|
class SiSelectComponent {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
868
|
+
select = inject(SiCustomSelectDirective);
|
|
869
|
+
// Re-exposed from SiCustomSelectDirective to keep the public API stable.
|
|
870
|
+
/** Unique identifier. */
|
|
871
|
+
id = this.select.id;
|
|
872
|
+
/** ID bound to the select's `aria-describedby` attribute. */
|
|
873
|
+
errormessageId = this.select.errormessageId;
|
|
874
|
+
/** Readonly state. */
|
|
875
|
+
readonly = this.select.readonly;
|
|
876
|
+
/** Scroll strategy used for the select overlay. */
|
|
877
|
+
scrollStrategy = this.select.scrollStrategy;
|
|
878
|
+
/** Emits when the dropdown open state changes. */
|
|
879
|
+
openChange = this.select.openChange;
|
|
605
880
|
/**
|
|
606
881
|
* Aria label of the select.
|
|
607
882
|
*
|
|
@@ -609,12 +884,8 @@ class SiSelectComponent {
|
|
|
609
884
|
*/
|
|
610
885
|
ariaLabel = input(null, /* @ts-ignore */
|
|
611
886
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
612
|
-
/**
|
|
613
|
-
|
|
614
|
-
* @defaultValue undefined
|
|
615
|
-
*/
|
|
616
|
-
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
617
|
-
labelledbyInput = input(undefined, { ...(ngDevMode ? { debugName: "labelledbyInput" } : /* istanbul ignore next */ {}), alias: 'labelledby' });
|
|
887
|
+
/** Aria labelledby of the select. */
|
|
888
|
+
labelledbyInput = this.select.labelledbyInput;
|
|
618
889
|
/**
|
|
619
890
|
* Placeholder for search input field.
|
|
620
891
|
*
|
|
@@ -638,97 +909,52 @@ class SiSelectComponent {
|
|
|
638
909
|
/** Placeholder text to display when no options are selected. */
|
|
639
910
|
placeholder = input(/* @ts-ignore */
|
|
640
911
|
...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
641
|
-
/**
|
|
642
|
-
* Readonly state. Similar to disabled but with higher contrast *
|
|
643
|
-
*
|
|
644
|
-
* @defaultValue false
|
|
645
|
-
*/
|
|
646
|
-
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
647
|
-
/**
|
|
648
|
-
* Optional CDK scroll strategy used for the select overlay.
|
|
649
|
-
*
|
|
650
|
-
* @defaultValue defaultConnectedOverlayScrollStrategy()
|
|
651
|
-
*/
|
|
652
|
-
scrollStrategy = input(defaultConnectedOverlayScrollStrategy(), /* @ts-ignore */
|
|
653
|
-
...(ngDevMode ? [{ debugName: "scrollStrategy" }] : /* istanbul ignore next */ []));
|
|
654
|
-
/** Emits when the dropdown open state changes. */
|
|
655
|
-
openChange = output();
|
|
656
|
-
isOpen = signal(false, /* @ts-ignore */
|
|
657
|
-
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
658
912
|
optionTemplate = contentChild(SiSelectOptionTemplateDirective, { ...(ngDevMode ? { debugName: "optionTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
659
913
|
selectedValueTemplate = contentChild(SiSelectValueTemplateDirective, { ...(ngDevMode ? { debugName: "selectedValueTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
660
914
|
groupTemplate = contentChild(SiSelectGroupTemplateDirective, { ...(ngDevMode ? { debugName: "groupTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
661
915
|
actionsTemplate = contentChild(SiSelectActionsDirective, { ...(ngDevMode ? { debugName: "actionsTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
662
|
-
trigger = viewChild.required(CdkOverlayOrigin, { ...(ngDevMode ? { debugName: "trigger" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
663
916
|
/** @internal */
|
|
664
|
-
labelledby =
|
|
665
|
-
...(ngDevMode ? [{ debugName: "labelledby" }] : /* istanbul ignore next */ []));
|
|
666
|
-
/**
|
|
667
|
-
* This ID will be bound to the `aria-describedby` attribute of the select.
|
|
668
|
-
* Use this to reference the element containing the error message(s) for the select.
|
|
669
|
-
* It will be picked by the {@link SiFormItemComponent} if the select is used inside a form item.
|
|
670
|
-
*
|
|
671
|
-
* @defaultValue
|
|
672
|
-
* ```
|
|
673
|
-
* `${this.id()}-errormessage`
|
|
674
|
-
* ```
|
|
675
|
-
*/
|
|
676
|
-
errormessageId = input(`${this.id()}-errormessage`, /* @ts-ignore */
|
|
677
|
-
...(ngDevMode ? [{ debugName: "errormessageId" }] : /* istanbul ignore next */ []));
|
|
678
|
-
rows = [];
|
|
679
|
-
overlayWidth = 0;
|
|
680
|
-
selectionStrategy = inject((SiSelectSelectionStrategy));
|
|
681
|
-
backdropClicked = false;
|
|
917
|
+
labelledby = this.select.labelledby;
|
|
682
918
|
/**
|
|
683
919
|
* Enables the filter input
|
|
684
920
|
* @defaultValue false
|
|
685
|
-
* @defaultref {@link SiSelectComponent#_hasFilter}
|
|
686
921
|
*/
|
|
687
922
|
hasFilter = input(false, { ...(ngDevMode ? { debugName: "hasFilter" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
688
923
|
/** Opens the `si-select`. */
|
|
689
924
|
open() {
|
|
690
|
-
|
|
691
|
-
return;
|
|
692
|
-
}
|
|
693
|
-
this.overlayWidth = this.trigger().nativeElement.getBoundingClientRect().width + 2; // 2px border
|
|
694
|
-
this.isOpen.set(true);
|
|
695
|
-
this.openChange.emit(true);
|
|
925
|
+
this.select.open();
|
|
696
926
|
}
|
|
697
927
|
/** Closes the `si-select`. */
|
|
698
928
|
close() {
|
|
699
|
-
this.
|
|
700
|
-
if (!this.backdropClicked) {
|
|
701
|
-
this.trigger().nativeElement.focus();
|
|
702
|
-
}
|
|
703
|
-
else {
|
|
704
|
-
this.backdropClicked = false;
|
|
705
|
-
this.selectionStrategy.onTouched();
|
|
706
|
-
}
|
|
707
|
-
this.openChange.emit(false);
|
|
708
|
-
}
|
|
709
|
-
backdropClick() {
|
|
710
|
-
this.backdropClicked = true;
|
|
711
|
-
this.isOpen.set(false);
|
|
929
|
+
this.select.close();
|
|
712
930
|
}
|
|
713
931
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
714
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiSelectComponent, isStandalone: true, selector: "si-select", inputs: {
|
|
932
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: SiSelectComponent, isStandalone: true, selector: "si-select", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, noResultsFoundLabel: { classPropertyName: "noResultsFoundLabel", publicName: "noResultsFoundLabel", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, hasFilter: { classPropertyName: "hasFilter", publicName: "hasFilter", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.si-select-has-filter": "hasFilter()" } }, providers: [{ provide: SI_FORM_ITEM_CONTROL, useExisting: SiSelectComponent }], queries: [{ propertyName: "optionTemplate", first: true, predicate: SiSelectOptionTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "selectedValueTemplate", first: true, predicate: SiSelectValueTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupTemplate", first: true, predicate: SiSelectGroupTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "actionsTemplate", first: true, predicate: SiSelectActionsDirective, descendants: true, read: TemplateRef, isSignal: true }], hostDirectives: [{ directive: SiCustomSelectDirective, inputs: ["id", "id", "disabled", "disabled", "readonly", "readonly", "labelledby", "labelledby", "siCustomSelectScrollStrategy", "scrollStrategy", "errormessageId", "errormessageId"], outputs: ["openChange", "openChange"] }], ngImport: i0, template: "<si-select-input\n [optionTemplate]=\"selectedValueTemplate() ?? optionTemplate()\"\n [ariaLabel]=\"ariaLabel()\"\n [placeholder]=\"placeholder()\"\n/>\n\n<ng-template si-select-dropdown contentType=\"listbox\">\n @if (!hasFilter()) {\n <si-select-list\n [baseId]=\"id()\"\n [optionTemplate]=\"optionTemplate()\"\n [groupTemplate]=\"groupTemplate()\"\n [labelledby]=\"labelledby()\"\n [actionsTemplate]=\"actionsTemplate()\"\n (closeOverlay)=\"close()\"\n />\n } @else {\n <si-select-list-has-filter\n [baseId]=\"id()\"\n [filterPlaceholder]=\"filterPlaceholder()\"\n [noResultsFoundLabel]=\"noResultsFoundLabel()\"\n [optionTemplate]=\"optionTemplate()\"\n [groupTemplate]=\"groupTemplate()\"\n [labelledby]=\"labelledby()\"\n [actionsTemplate]=\"actionsTemplate()\"\n (closeOverlay)=\"close()\"\n />\n }\n</ng-template>\n", styles: [":host{display:inline-block;padding:0;block-size:2rem}:host:focus-within,:host.open:not(.si-select-has-filter){outline:var(--si-sys-sizing-focus-ring-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--si-sys-sizing-focus-ring-offset)}:host.readonly{pointer-events:none}\n"], dependencies: [{ kind: "component", type: SiSelectInputComponent, selector: "si-select-input", inputs: ["ariaLabel", "placeholder", "optionTemplate"] }, { kind: "component", type: SiSelectListComponent, selector: "si-select-list" }, { kind: "component", type: SiSelectListHasFilterComponent, selector: "si-select-list-has-filter", inputs: ["filterPlaceholder", "noResultsFoundLabel"] }, { kind: "directive", type: SiSelectDropdownDirective, selector: "[si-select-dropdown]", inputs: ["contentType", "closeOnTab"] }] });
|
|
715
933
|
}
|
|
716
934
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectComponent, decorators: [{
|
|
717
935
|
type: Component,
|
|
718
936
|
args: [{ selector: 'si-select', imports: [
|
|
719
|
-
OverlayModule,
|
|
720
937
|
SiSelectInputComponent,
|
|
721
938
|
SiSelectListComponent,
|
|
722
|
-
SiSelectListHasFilterComponent
|
|
939
|
+
SiSelectListHasFilterComponent,
|
|
940
|
+
SiSelectDropdownDirective
|
|
723
941
|
], providers: [{ provide: SI_FORM_ITEM_CONTROL, useExisting: SiSelectComponent }], host: {
|
|
724
|
-
class: 'dropdown',
|
|
725
|
-
'[class.readonly]': 'readonly()',
|
|
726
|
-
'[class.open]': 'isOpen()',
|
|
727
942
|
'[class.si-select-has-filter]': 'hasFilter()'
|
|
728
|
-
},
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
943
|
+
}, hostDirectives: [
|
|
944
|
+
{
|
|
945
|
+
directive: SiCustomSelectDirective,
|
|
946
|
+
inputs: [
|
|
947
|
+
'id',
|
|
948
|
+
'disabled',
|
|
949
|
+
'readonly',
|
|
950
|
+
'labelledby',
|
|
951
|
+
'siCustomSelectScrollStrategy:scrollStrategy',
|
|
952
|
+
'errormessageId'
|
|
953
|
+
],
|
|
954
|
+
outputs: ['openChange']
|
|
955
|
+
}
|
|
956
|
+
], template: "<si-select-input\n [optionTemplate]=\"selectedValueTemplate() ?? optionTemplate()\"\n [ariaLabel]=\"ariaLabel()\"\n [placeholder]=\"placeholder()\"\n/>\n\n<ng-template si-select-dropdown contentType=\"listbox\">\n @if (!hasFilter()) {\n <si-select-list\n [baseId]=\"id()\"\n [optionTemplate]=\"optionTemplate()\"\n [groupTemplate]=\"groupTemplate()\"\n [labelledby]=\"labelledby()\"\n [actionsTemplate]=\"actionsTemplate()\"\n (closeOverlay)=\"close()\"\n />\n } @else {\n <si-select-list-has-filter\n [baseId]=\"id()\"\n [filterPlaceholder]=\"filterPlaceholder()\"\n [noResultsFoundLabel]=\"noResultsFoundLabel()\"\n [optionTemplate]=\"optionTemplate()\"\n [groupTemplate]=\"groupTemplate()\"\n [labelledby]=\"labelledby()\"\n [actionsTemplate]=\"actionsTemplate()\"\n (closeOverlay)=\"close()\"\n />\n }\n</ng-template>\n", styles: [":host{display:inline-block;padding:0;block-size:2rem}:host:focus-within,:host.open:not(.si-select-has-filter){outline:var(--si-sys-sizing-focus-ring-width) solid var(--si-sys-color-effects-focus);outline-offset:var(--si-sys-sizing-focus-ring-offset)}:host.readonly{pointer-events:none}\n"] }]
|
|
957
|
+
}], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], filterPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPlaceholder", required: false }] }], noResultsFoundLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "noResultsFoundLabel", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], optionTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SiSelectOptionTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], selectedValueTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SiSelectValueTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SiSelectGroupTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], actionsTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SiSelectActionsDirective), { ...{ read: TemplateRef }, isSignal: true }] }], hasFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasFilter", required: false }] }] } });
|
|
732
958
|
|
|
733
959
|
/**
|
|
734
960
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -776,7 +1002,7 @@ class SiSelectLazyOptionsDirective {
|
|
|
776
1002
|
return of(this.selectedRows());
|
|
777
1003
|
}
|
|
778
1004
|
}
|
|
779
|
-
}))
|
|
1005
|
+
}), takeUntilDestroyed())
|
|
780
1006
|
.subscribe(rows => {
|
|
781
1007
|
this.loading.set(false);
|
|
782
1008
|
this.rows.set(rows);
|
|
@@ -979,28 +1205,14 @@ class SiSelectSingleValueDirective extends SiSelectSelectionStrategy {
|
|
|
979
1205
|
return value;
|
|
980
1206
|
}
|
|
981
1207
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectSingleValueDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
982
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: SiSelectSingleValueDirective, isStandalone: true, selector: "si-select:not([multi])", providers: [
|
|
983
|
-
{ provide: SiSelectSelectionStrategy, useExisting: SiSelectSingleValueDirective },
|
|
984
|
-
{
|
|
985
|
-
provide: NG_VALUE_ACCESSOR,
|
|
986
|
-
useExisting: SiSelectSingleValueDirective,
|
|
987
|
-
multi: true
|
|
988
|
-
}
|
|
989
|
-
], usesInheritance: true, ngImport: i0 });
|
|
1208
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: SiSelectSingleValueDirective, isStandalone: true, selector: "si-select:not([multi])", providers: [{ provide: SiSelectSelectionStrategy, useExisting: SiSelectSingleValueDirective }], usesInheritance: true, ngImport: i0 });
|
|
990
1209
|
}
|
|
991
1210
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectSingleValueDirective, decorators: [{
|
|
992
1211
|
type: Directive,
|
|
993
1212
|
args: [{
|
|
994
1213
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
995
1214
|
selector: 'si-select:not([multi])',
|
|
996
|
-
providers: [
|
|
997
|
-
{ provide: SiSelectSelectionStrategy, useExisting: SiSelectSingleValueDirective },
|
|
998
|
-
{
|
|
999
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1000
|
-
useExisting: SiSelectSingleValueDirective,
|
|
1001
|
-
multi: true
|
|
1002
|
-
}
|
|
1003
|
-
]
|
|
1215
|
+
providers: [{ provide: SiSelectSelectionStrategy, useExisting: SiSelectSingleValueDirective }]
|
|
1004
1216
|
}]
|
|
1005
1217
|
}] });
|
|
1006
1218
|
|
|
@@ -1010,424 +1222,124 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
1010
1222
|
*/
|
|
1011
1223
|
/**
|
|
1012
1224
|
* The directive enables the multi-select behavior.
|
|
1013
|
-
* Otherwise, use the {@link SiSelectSingleValueDirective} directive.
|
|
1014
|
-
*
|
|
1015
|
-
* @example
|
|
1016
|
-
* ```html
|
|
1017
|
-
* <si-select multi [(value)]="multiValue" [options]="[
|
|
1018
|
-
* { id: 'good', title: 'Good' },
|
|
1019
|
-
* { id: 'average', title: 'Average' },
|
|
1020
|
-
* { id: 'poor', title: 'Poor' }
|
|
1021
|
-
* ]"></si-select>
|
|
1022
|
-
* ```
|
|
1023
|
-
*/
|
|
1024
|
-
class SiSelectMultiValueDirective extends SiSelectSelectionStrategy {
|
|
1025
|
-
/**
|
|
1026
|
-
* {@inheritDoc SiSelectSelectionStrategy#allowMultiple}
|
|
1027
|
-
* @defaultValue true
|
|
1028
|
-
*/
|
|
1029
|
-
allowMultiple = true;
|
|
1030
|
-
fromArrayValue(value) {
|
|
1031
|
-
return value;
|
|
1032
|
-
}
|
|
1033
|
-
toArrayValue(value) {
|
|
1034
|
-
return value ?? [];
|
|
1035
|
-
}
|
|
1036
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectMultiValueDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1037
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: SiSelectMultiValueDirective, isStandalone: true, selector: "si-select[multi]", providers: [
|
|
1038
|
-
{ provide: SiSelectSelectionStrategy, useExisting: SiSelectMultiValueDirective },
|
|
1039
|
-
{
|
|
1040
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1041
|
-
useExisting: SiSelectMultiValueDirective,
|
|
1042
|
-
multi: true
|
|
1043
|
-
}
|
|
1044
|
-
], usesInheritance: true, ngImport: i0 });
|
|
1045
|
-
}
|
|
1046
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectMultiValueDirective, decorators: [{
|
|
1047
|
-
type: Directive,
|
|
1048
|
-
args: [{
|
|
1049
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1050
|
-
selector: 'si-select[multi]',
|
|
1051
|
-
providers: [
|
|
1052
|
-
{ provide: SiSelectSelectionStrategy, useExisting: SiSelectMultiValueDirective },
|
|
1053
|
-
{
|
|
1054
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1055
|
-
useExisting: SiSelectMultiValueDirective,
|
|
1056
|
-
multi: true
|
|
1057
|
-
}
|
|
1058
|
-
]
|
|
1059
|
-
}]
|
|
1060
|
-
}] });
|
|
1061
|
-
|
|
1062
|
-
/**
|
|
1063
|
-
* Copyright (c) Siemens 2016 - 2026
|
|
1064
|
-
* SPDX-License-Identifier: MIT
|
|
1065
|
-
*/
|
|
1066
|
-
class SiSelectActionDirective {
|
|
1067
|
-
select = inject(SiSelectComponent);
|
|
1068
|
-
/**
|
|
1069
|
-
* Close the select drop down on click.
|
|
1070
|
-
* @defaultValue false
|
|
1071
|
-
*/
|
|
1072
|
-
selectActionAutoClose = input(false, { ...(ngDevMode ? { debugName: "selectActionAutoClose" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1073
|
-
close() {
|
|
1074
|
-
if (this.selectActionAutoClose()) {
|
|
1075
|
-
this.select.close();
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectActionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1079
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: SiSelectActionDirective, isStandalone: true, selector: "[siSelectAction]", inputs: { selectActionAutoClose: { classPropertyName: "selectActionAutoClose", publicName: "selectActionAutoClose", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "close()" }, classAttribute: "mx-5 my-4" }, exportAs: ["si-select-action"], ngImport: i0 });
|
|
1080
|
-
}
|
|
1081
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectActionDirective, decorators: [{
|
|
1082
|
-
type: Directive,
|
|
1083
|
-
args: [{
|
|
1084
|
-
selector: '[siSelectAction]',
|
|
1085
|
-
host: {
|
|
1086
|
-
class: 'mx-5 my-4',
|
|
1087
|
-
'(click)': 'close()'
|
|
1088
|
-
},
|
|
1089
|
-
exportAs: 'si-select-action'
|
|
1090
|
-
}]
|
|
1091
|
-
}], propDecorators: { selectActionAutoClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectActionAutoClose", required: false }] }] } });
|
|
1092
|
-
|
|
1093
|
-
/**
|
|
1094
|
-
* Copyright (c) Siemens 2016 - 2026
|
|
1095
|
-
* SPDX-License-Identifier: MIT
|
|
1096
|
-
*/
|
|
1097
|
-
class SiSelectModule {
|
|
1098
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1099
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: SiSelectModule, imports: [SiSelectActionDirective,
|
|
1100
|
-
SiSelectActionsDirective,
|
|
1101
|
-
SiSelectComponent,
|
|
1102
|
-
SiSelectGroupTemplateDirective,
|
|
1103
|
-
SiSelectMultiValueDirective,
|
|
1104
|
-
SiSelectOptionTemplateDirective,
|
|
1105
|
-
SiSelectValueTemplateDirective,
|
|
1106
|
-
SiSelectSimpleOptionsDirective,
|
|
1107
|
-
SiSelectSingleValueDirective], exports: [SiSelectActionDirective,
|
|
1108
|
-
SiSelectActionsDirective,
|
|
1109
|
-
SiSelectComponent,
|
|
1110
|
-
SiSelectGroupTemplateDirective,
|
|
1111
|
-
SiSelectMultiValueDirective,
|
|
1112
|
-
SiSelectOptionTemplateDirective,
|
|
1113
|
-
SiSelectValueTemplateDirective,
|
|
1114
|
-
SiSelectSimpleOptionsDirective,
|
|
1115
|
-
SiSelectSingleValueDirective] });
|
|
1116
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectModule, imports: [SiSelectComponent] });
|
|
1117
|
-
}
|
|
1118
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectModule, decorators: [{
|
|
1119
|
-
type: NgModule,
|
|
1120
|
-
args: [{
|
|
1121
|
-
imports: [
|
|
1122
|
-
SiSelectActionDirective,
|
|
1123
|
-
SiSelectActionsDirective,
|
|
1124
|
-
SiSelectComponent,
|
|
1125
|
-
SiSelectGroupTemplateDirective,
|
|
1126
|
-
SiSelectMultiValueDirective,
|
|
1127
|
-
SiSelectOptionTemplateDirective,
|
|
1128
|
-
SiSelectValueTemplateDirective,
|
|
1129
|
-
SiSelectSimpleOptionsDirective,
|
|
1130
|
-
SiSelectSingleValueDirective
|
|
1131
|
-
],
|
|
1132
|
-
exports: [
|
|
1133
|
-
SiSelectActionDirective,
|
|
1134
|
-
SiSelectActionsDirective,
|
|
1135
|
-
SiSelectComponent,
|
|
1136
|
-
SiSelectGroupTemplateDirective,
|
|
1137
|
-
SiSelectMultiValueDirective,
|
|
1138
|
-
SiSelectOptionTemplateDirective,
|
|
1139
|
-
SiSelectValueTemplateDirective,
|
|
1140
|
-
SiSelectSimpleOptionsDirective,
|
|
1141
|
-
SiSelectSingleValueDirective
|
|
1142
|
-
]
|
|
1143
|
-
}]
|
|
1144
|
-
}] });
|
|
1145
|
-
|
|
1146
|
-
/**
|
|
1147
|
-
* Copyright (c) Siemens 2016 - 2026
|
|
1148
|
-
* SPDX-License-Identifier: MIT
|
|
1149
|
-
*/
|
|
1150
|
-
/**
|
|
1151
|
-
* Host directive for building custom selects.
|
|
1152
|
-
*
|
|
1153
|
-
* Add this as a `hostDirective` on your component and expose the inputs/outputs you need.
|
|
1154
|
-
* The directive handles:
|
|
1155
|
-
* - {@link ControlValueAccessor} integration (`formControl`, `ngModel`, `[(value)]`)
|
|
1156
|
-
* - Disabled / readonly state management
|
|
1157
|
-
* - Overlay lifecycle for the dropdown (open/close)
|
|
1158
|
-
* - Focus management and focus trapping in the dropdown
|
|
1159
|
-
* - Opening the dropdown on click, Enter, Space, ArrowDown, ArrowUp
|
|
1160
|
-
* - {@link SiFormItemControl} integration
|
|
1161
|
-
*
|
|
1162
|
-
* Use {@link SiSelectDropdownDirective} to mark the dropdown template in your component,
|
|
1163
|
-
* and call {@link open}, {@link close}, {@link updateValue} from your component logic.
|
|
1164
|
-
*
|
|
1165
|
-
* @example
|
|
1166
|
-
* ```ts
|
|
1167
|
-
* @Component({
|
|
1168
|
-
* selector: 'app-my-select',
|
|
1169
|
-
* hostDirectives: [{
|
|
1170
|
-
* directive: SiCustomSelectDirective,
|
|
1171
|
-
* inputs: ['disabled', 'readonly', 'value'],
|
|
1172
|
-
* outputs: ['valueChange']
|
|
1173
|
-
* }],
|
|
1174
|
-
* template: `
|
|
1175
|
-
* <si-select-combobox>
|
|
1176
|
-
* {{ select.value() }}
|
|
1177
|
-
* </si-select-combobox>
|
|
1178
|
-
* <ng-template si-select-dropdown contentType="listbox">
|
|
1179
|
-
* <button (click)="select.updateValue('new'); select.close()">Pick</button>
|
|
1180
|
-
* </ng-template>
|
|
1181
|
-
* `
|
|
1182
|
-
* })
|
|
1183
|
-
* export class MySelectComponent {
|
|
1184
|
-
* readonly select = inject(SiCustomSelectDirective);
|
|
1185
|
-
* }
|
|
1186
|
-
* ```
|
|
1187
|
-
*
|
|
1188
|
-
* @experimental
|
|
1189
|
-
*/
|
|
1190
|
-
class SiCustomSelectDirective {
|
|
1191
|
-
static idCounter = 0;
|
|
1192
|
-
/**
|
|
1193
|
-
* Unique identifier.
|
|
1194
|
-
*
|
|
1195
|
-
* @defaultValue
|
|
1196
|
-
* ```
|
|
1197
|
-
* `__si-custom-select-${SiCustomSelectDirective.idCounter++}`
|
|
1198
|
-
* ```
|
|
1199
|
-
*/
|
|
1200
|
-
id = input(`__si-custom-select-${SiCustomSelectDirective.idCounter++}`, /* @ts-ignore */
|
|
1201
|
-
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1202
|
-
/**
|
|
1203
|
-
* Whether the select input is disabled.
|
|
1204
|
-
*
|
|
1205
|
-
* @defaultValue false
|
|
1206
|
-
*/
|
|
1207
|
-
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
1208
|
-
disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
|
|
1209
|
-
/**
|
|
1210
|
-
* Readonly state. Similar to disabled but with higher contrast.
|
|
1211
|
-
*
|
|
1212
|
-
* @defaultValue false
|
|
1213
|
-
*/
|
|
1214
|
-
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1215
|
-
/**
|
|
1216
|
-
* Optional CDK scroll strategy used for the custom select overlay.
|
|
1217
|
-
*
|
|
1218
|
-
* @defaultValue defaultConnectedOverlayScrollStrategy()
|
|
1219
|
-
*/
|
|
1220
|
-
scrollStrategy = input(defaultConnectedOverlayScrollStrategy(), { ...(ngDevMode ? { debugName: "scrollStrategy" } : /* istanbul ignore next */ {}), alias: 'siCustomSelectScrollStrategy' });
|
|
1221
|
-
/** Emits when the dropdown open state changes. */
|
|
1222
|
-
openChange = output();
|
|
1223
|
-
/**
|
|
1224
|
-
* The current value, supports two-way binding via `[(value)]`.
|
|
1225
|
-
*
|
|
1226
|
-
* @defaultValue undefined
|
|
1227
|
-
*/
|
|
1228
|
-
value = model(undefined, /* @ts-ignore */
|
|
1229
|
-
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1230
|
-
/**
|
|
1231
|
-
* Whether the dropdown is currently open.
|
|
1232
|
-
*
|
|
1233
|
-
* @defaultValue false
|
|
1234
|
-
*/
|
|
1235
|
-
isOpen = signal(false, /* @ts-ignore */
|
|
1236
|
-
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
1237
|
-
/** @internal */
|
|
1238
|
-
labelledby = computed(() => `${this.id()}-label ${this.id()}-combobox`, /* @ts-ignore */
|
|
1239
|
-
...(ngDevMode ? [{ debugName: "labelledby" }] : /* istanbul ignore next */ []));
|
|
1240
|
-
/** @internal */
|
|
1241
|
-
comboboxLabelId = computed(() => `${this.id()}-combobox`, /* @ts-ignore */
|
|
1242
|
-
...(ngDevMode ? [{ debugName: "comboboxLabelId" }] : /* istanbul ignore next */ []));
|
|
1243
|
-
/** @internal */
|
|
1244
|
-
dropdownId = computed(() => this.id() + '-dropdown', /* @ts-ignore */
|
|
1245
|
-
...(ngDevMode ? [{ debugName: "dropdownId" }] : /* istanbul ignore next */ []));
|
|
1246
|
-
/**
|
|
1247
|
-
* Value forwarded to the `aria-haspopup` attribute. Reflects the
|
|
1248
|
-
* `contentType` input of the registered {@link SiSelectDropdownDirective},
|
|
1249
|
-
* defaulting to `'listbox'` until a dropdown template is registered.
|
|
1250
|
-
* @internal
|
|
1251
|
-
*/
|
|
1252
|
-
haspopup = computed(() => this.dropdownDirective()?.contentType() ?? 'listbox', /* @ts-ignore */
|
|
1253
|
-
...(ngDevMode ? [{ debugName: "haspopup" }] : /* istanbul ignore next */ []));
|
|
1254
|
-
/**
|
|
1255
|
-
* This ID will be bound to the `aria-describedby` attribute of the select.
|
|
1256
|
-
*
|
|
1257
|
-
* @defaultValue
|
|
1258
|
-
* ```
|
|
1259
|
-
* `${this.id()}-errormessage`
|
|
1260
|
-
* ```
|
|
1261
|
-
*/
|
|
1262
|
-
errormessageId = input(`${this.id()}-errormessage`, /* @ts-ignore */
|
|
1263
|
-
...(ngDevMode ? [{ debugName: "errormessageId" }] : /* istanbul ignore next */ []));
|
|
1264
|
-
/** Combined disabled state from input and form control. */
|
|
1265
|
-
disabled = computed(() => this.disabledInput() || this.disabledByForm(), /* @ts-ignore */
|
|
1266
|
-
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1267
|
-
onTouched = () => { };
|
|
1268
|
-
onChange = () => { };
|
|
1269
|
-
disabledByForm = signal(false, /* @ts-ignore */
|
|
1270
|
-
...(ngDevMode ? [{ debugName: "disabledByForm" }] : /* istanbul ignore next */ []));
|
|
1271
|
-
overlay = inject(Overlay);
|
|
1272
|
-
focusTrapFactory = inject(ConfigurableFocusTrapFactory);
|
|
1273
|
-
elementRef = inject(ElementRef);
|
|
1274
|
-
viewContainerRef = inject(ViewContainerRef);
|
|
1275
|
-
destroyRef = inject(DestroyRef);
|
|
1276
|
-
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
1277
|
-
overlayRef;
|
|
1278
|
-
focusTrap;
|
|
1279
|
-
closeOverlay$ = new Subject();
|
|
1280
|
-
dropdownDirective = signal(undefined, /* @ts-ignore */
|
|
1281
|
-
...(ngDevMode ? [{ debugName: "dropdownDirective" }] : /* istanbul ignore next */ []));
|
|
1282
|
-
constructor() {
|
|
1283
|
-
this.destroyRef.onDestroy(() => {
|
|
1284
|
-
this.disposeOverlay();
|
|
1285
|
-
this.closeOverlay$.complete();
|
|
1286
|
-
});
|
|
1287
|
-
}
|
|
1225
|
+
* Otherwise, use the {@link SiSelectSingleValueDirective} directive.
|
|
1226
|
+
*
|
|
1227
|
+
* @example
|
|
1228
|
+
* ```html
|
|
1229
|
+
* <si-select multi [(value)]="multiValue" [options]="[
|
|
1230
|
+
* { id: 'good', title: 'Good' },
|
|
1231
|
+
* { id: 'average', title: 'Average' },
|
|
1232
|
+
* { id: 'poor', title: 'Poor' }
|
|
1233
|
+
* ]"></si-select>
|
|
1234
|
+
* ```
|
|
1235
|
+
*/
|
|
1236
|
+
class SiSelectMultiValueDirective extends SiSelectSelectionStrategy {
|
|
1288
1237
|
/**
|
|
1289
|
-
*
|
|
1290
|
-
*
|
|
1291
|
-
* @internal
|
|
1238
|
+
* {@inheritDoc SiSelectSelectionStrategy#allowMultiple}
|
|
1239
|
+
* @defaultValue true
|
|
1292
1240
|
*/
|
|
1293
|
-
|
|
1294
|
-
|
|
1241
|
+
allowMultiple = true;
|
|
1242
|
+
fromArrayValue(value) {
|
|
1243
|
+
return value;
|
|
1244
|
+
}
|
|
1245
|
+
toArrayValue(value) {
|
|
1246
|
+
return value ?? [];
|
|
1295
1247
|
}
|
|
1248
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectMultiValueDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1249
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: SiSelectMultiValueDirective, isStandalone: true, selector: "si-select[multi]", providers: [{ provide: SiSelectSelectionStrategy, useExisting: SiSelectMultiValueDirective }], usesInheritance: true, ngImport: i0 });
|
|
1250
|
+
}
|
|
1251
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectMultiValueDirective, decorators: [{
|
|
1252
|
+
type: Directive,
|
|
1253
|
+
args: [{
|
|
1254
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1255
|
+
selector: 'si-select[multi]',
|
|
1256
|
+
providers: [{ provide: SiSelectSelectionStrategy, useExisting: SiSelectMultiValueDirective }]
|
|
1257
|
+
}]
|
|
1258
|
+
}] });
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
1262
|
+
* SPDX-License-Identifier: MIT
|
|
1263
|
+
*/
|
|
1264
|
+
class SiSelectActionDirective {
|
|
1265
|
+
select = inject(SiSelectComponent);
|
|
1296
1266
|
/**
|
|
1297
|
-
*
|
|
1298
|
-
*
|
|
1267
|
+
* Close the select drop down on click.
|
|
1268
|
+
* @defaultValue false
|
|
1299
1269
|
*/
|
|
1300
|
-
|
|
1301
|
-
this.value.set(value);
|
|
1302
|
-
this.onChange(value);
|
|
1303
|
-
}
|
|
1304
|
-
/** Opens the dropdown overlay. */
|
|
1305
|
-
open(event) {
|
|
1306
|
-
if (this.disabled() || this.readonly() || this.isOpen() || !this.isBrowser) {
|
|
1307
|
-
return;
|
|
1308
|
-
}
|
|
1309
|
-
if (!this.dropdownDirective()) {
|
|
1310
|
-
return;
|
|
1311
|
-
}
|
|
1312
|
-
// Prevent default scrolling behavior for Space / ArrowUp / ArrowDown.
|
|
1313
|
-
event?.preventDefault();
|
|
1314
|
-
const width = this.elementRef.nativeElement.getBoundingClientRect().width;
|
|
1315
|
-
this.overlayRef = this.overlay.create({
|
|
1316
|
-
positionStrategy: this.overlay
|
|
1317
|
-
.position()
|
|
1318
|
-
.flexibleConnectedTo(this.elementRef)
|
|
1319
|
-
.withPositions([
|
|
1320
|
-
// Preferred: below, aligned to the start edge of the trigger.
|
|
1321
|
-
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },
|
|
1322
|
-
// Below, aligned to the end edge (trigger near the end of the viewport).
|
|
1323
|
-
{ originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },
|
|
1324
|
-
// Above, aligned to the start edge (no space below).
|
|
1325
|
-
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },
|
|
1326
|
-
// Above, aligned to the end edge (no space below, trigger near the end).
|
|
1327
|
-
{ originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom' },
|
|
1328
|
-
// Below, centered (small screens, trigger in the middle).
|
|
1329
|
-
{ originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },
|
|
1330
|
-
// Above, centered.
|
|
1331
|
-
{ originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' }
|
|
1332
|
-
])
|
|
1333
|
-
.withFlexibleDimensions(true)
|
|
1334
|
-
.withPush(true),
|
|
1335
|
-
hasBackdrop: true,
|
|
1336
|
-
scrollStrategy: this.scrollStrategy(),
|
|
1337
|
-
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
1338
|
-
panelClass: ['dropdown-menu', 'show'],
|
|
1339
|
-
minWidth: width + 2
|
|
1340
|
-
});
|
|
1341
|
-
const portal = new TemplatePortal(this.dropdownDirective().templateRef, this.viewContainerRef);
|
|
1342
|
-
this.overlayRef.attach(portal);
|
|
1343
|
-
this.overlayRef.overlayElement.id = this.dropdownId();
|
|
1344
|
-
this.focusTrap = this.focusTrapFactory.create(this.overlayRef.overlayElement);
|
|
1345
|
-
this.focusTrap.focusFirstTabbableElementWhenReady();
|
|
1346
|
-
this.isOpen.set(true);
|
|
1347
|
-
this.openChange.emit(true);
|
|
1348
|
-
merge(this.overlayRef.backdropClick(), this.overlayRef.keydownEvents().pipe(filter(e => e.key === 'Escape')))
|
|
1349
|
-
.pipe(takeUntil$1(this.closeOverlay$), takeUntilDestroyed(this.destroyRef))
|
|
1350
|
-
.subscribe(() => this.close());
|
|
1351
|
-
}
|
|
1352
|
-
/** Closes the dropdown overlay and restores focus. */
|
|
1270
|
+
selectActionAutoClose = input(false, { ...(ngDevMode ? { debugName: "selectActionAutoClose" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1353
1271
|
close() {
|
|
1354
|
-
if (
|
|
1355
|
-
|
|
1356
|
-
}
|
|
1357
|
-
this.isOpen.set(false);
|
|
1358
|
-
this.disposeOverlay();
|
|
1359
|
-
this.openChange.emit(false);
|
|
1360
|
-
this.onTouched();
|
|
1361
|
-
if (this.isBrowser) {
|
|
1362
|
-
this.elementRef.nativeElement.focus();
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
/** @internal */
|
|
1366
|
-
writeValue(obj) {
|
|
1367
|
-
this.value.set(obj ?? undefined);
|
|
1368
|
-
}
|
|
1369
|
-
/** @internal */
|
|
1370
|
-
registerOnChange(fn) {
|
|
1371
|
-
this.onChange = fn;
|
|
1372
|
-
}
|
|
1373
|
-
/** @internal */
|
|
1374
|
-
registerOnTouched(fn) {
|
|
1375
|
-
this.onTouched = fn;
|
|
1376
|
-
}
|
|
1377
|
-
/** @internal */
|
|
1378
|
-
setDisabledState(isDisabled) {
|
|
1379
|
-
this.disabledByForm.set(isDisabled);
|
|
1380
|
-
}
|
|
1381
|
-
disposeOverlay() {
|
|
1382
|
-
if (this.overlayRef) {
|
|
1383
|
-
this.closeOverlay$.next();
|
|
1384
|
-
this.focusTrap?.destroy();
|
|
1385
|
-
this.focusTrap = undefined;
|
|
1386
|
-
this.overlayRef.detach();
|
|
1387
|
-
this.overlayRef.dispose();
|
|
1388
|
-
this.overlayRef = undefined;
|
|
1272
|
+
if (this.selectActionAutoClose()) {
|
|
1273
|
+
this.select.close();
|
|
1389
1274
|
}
|
|
1390
1275
|
}
|
|
1391
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type:
|
|
1392
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type:
|
|
1393
|
-
{ provide: NG_VALUE_ACCESSOR, useExisting: SiCustomSelectDirective, multi: true },
|
|
1394
|
-
{ provide: SI_FORM_ITEM_CONTROL, useExisting: SiCustomSelectDirective }
|
|
1395
|
-
], ngImport: i0 });
|
|
1276
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectActionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1277
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: SiSelectActionDirective, isStandalone: true, selector: "[siSelectAction]", inputs: { selectActionAutoClose: { classPropertyName: "selectActionAutoClose", publicName: "selectActionAutoClose", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "close()" }, classAttribute: "mx-5 my-4" }, exportAs: ["si-select-action"], ngImport: i0 });
|
|
1396
1278
|
}
|
|
1397
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type:
|
|
1279
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectActionDirective, decorators: [{
|
|
1398
1280
|
type: Directive,
|
|
1399
1281
|
args: [{
|
|
1400
|
-
selector: '[
|
|
1401
|
-
providers: [
|
|
1402
|
-
{ provide: NG_VALUE_ACCESSOR, useExisting: SiCustomSelectDirective, multi: true },
|
|
1403
|
-
{ provide: SI_FORM_ITEM_CONTROL, useExisting: SiCustomSelectDirective }
|
|
1404
|
-
],
|
|
1282
|
+
selector: '[siSelectAction]',
|
|
1405
1283
|
host: {
|
|
1406
|
-
class: '
|
|
1407
|
-
'
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1284
|
+
class: 'mx-5 my-4',
|
|
1285
|
+
'(click)': 'close()'
|
|
1286
|
+
},
|
|
1287
|
+
exportAs: 'si-select-action'
|
|
1288
|
+
}]
|
|
1289
|
+
}], propDecorators: { selectActionAutoClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectActionAutoClose", required: false }] }] } });
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
1293
|
+
* SPDX-License-Identifier: MIT
|
|
1294
|
+
*/
|
|
1295
|
+
class SiSelectModule {
|
|
1296
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1297
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: SiSelectModule, imports: [SiSelectActionDirective,
|
|
1298
|
+
SiSelectActionsDirective,
|
|
1299
|
+
SiSelectComponent,
|
|
1300
|
+
SiSelectGroupTemplateDirective,
|
|
1301
|
+
SiSelectMultiValueDirective,
|
|
1302
|
+
SiSelectOptionTemplateDirective,
|
|
1303
|
+
SiSelectValueTemplateDirective,
|
|
1304
|
+
SiSelectSimpleOptionsDirective,
|
|
1305
|
+
SiSelectSingleValueDirective], exports: [SiSelectActionDirective,
|
|
1306
|
+
SiSelectActionsDirective,
|
|
1307
|
+
SiSelectComponent,
|
|
1308
|
+
SiSelectGroupTemplateDirective,
|
|
1309
|
+
SiSelectMultiValueDirective,
|
|
1310
|
+
SiSelectOptionTemplateDirective,
|
|
1311
|
+
SiSelectValueTemplateDirective,
|
|
1312
|
+
SiSelectSimpleOptionsDirective,
|
|
1313
|
+
SiSelectSingleValueDirective] });
|
|
1314
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectModule, imports: [SiSelectComponent] });
|
|
1315
|
+
}
|
|
1316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectModule, decorators: [{
|
|
1317
|
+
type: NgModule,
|
|
1318
|
+
args: [{
|
|
1319
|
+
imports: [
|
|
1320
|
+
SiSelectActionDirective,
|
|
1321
|
+
SiSelectActionsDirective,
|
|
1322
|
+
SiSelectComponent,
|
|
1323
|
+
SiSelectGroupTemplateDirective,
|
|
1324
|
+
SiSelectMultiValueDirective,
|
|
1325
|
+
SiSelectOptionTemplateDirective,
|
|
1326
|
+
SiSelectValueTemplateDirective,
|
|
1327
|
+
SiSelectSimpleOptionsDirective,
|
|
1328
|
+
SiSelectSingleValueDirective
|
|
1329
|
+
],
|
|
1330
|
+
exports: [
|
|
1331
|
+
SiSelectActionDirective,
|
|
1332
|
+
SiSelectActionsDirective,
|
|
1333
|
+
SiSelectComponent,
|
|
1334
|
+
SiSelectGroupTemplateDirective,
|
|
1335
|
+
SiSelectMultiValueDirective,
|
|
1336
|
+
SiSelectOptionTemplateDirective,
|
|
1337
|
+
SiSelectValueTemplateDirective,
|
|
1338
|
+
SiSelectSimpleOptionsDirective,
|
|
1339
|
+
SiSelectSingleValueDirective
|
|
1340
|
+
]
|
|
1429
1341
|
}]
|
|
1430
|
-
}]
|
|
1342
|
+
}] });
|
|
1431
1343
|
|
|
1432
1344
|
/**
|
|
1433
1345
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -1546,51 +1458,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
1546
1458
|
}, styles: ["@charset \"UTF-8\";:host{display:inline-block;max-inline-size:100%}:host(.comma-separated:not(:first-of-type)):before{content:\",\\a0\"}\n"] }]
|
|
1547
1459
|
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], iconColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconColor", required: false }] }], stackedIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "stackedIcon", required: false }] }], stackedIconColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "stackedIconColor", required: false }] }] } });
|
|
1548
1460
|
|
|
1549
|
-
/**
|
|
1550
|
-
* Copyright (c) Siemens 2016 - 2026
|
|
1551
|
-
* SPDX-License-Identifier: MIT
|
|
1552
|
-
*/
|
|
1553
|
-
/**
|
|
1554
|
-
* Structural directive marking the dropdown template for custom selects
|
|
1555
|
-
* built with {@link SiCustomSelectDirective}.
|
|
1556
|
-
*
|
|
1557
|
-
* When placed on an `<ng-template>`, it automatically registers the template
|
|
1558
|
-
* with the parent {@link SiCustomSelectDirective}.
|
|
1559
|
-
*
|
|
1560
|
-
* @example
|
|
1561
|
-
* ```html
|
|
1562
|
-
* <ng-template si-select-dropdown contentType="listbox">
|
|
1563
|
-
* <!-- custom dropdown content -->
|
|
1564
|
-
* </ng-template>
|
|
1565
|
-
* ```
|
|
1566
|
-
*
|
|
1567
|
-
* @experimental
|
|
1568
|
-
*/
|
|
1569
|
-
class SiSelectDropdownDirective {
|
|
1570
|
-
/**
|
|
1571
|
-
* Describes the kind of content rendered by the dropdown. The value is
|
|
1572
|
-
* forwarded to the `aria-haspopup` attribute of the combobox host of
|
|
1573
|
-
* the parent {@link SiCustomSelectDirective}.
|
|
1574
|
-
*/
|
|
1575
|
-
contentType = input.required(/* @ts-ignore */
|
|
1576
|
-
...(ngDevMode ? [{ debugName: "contentType" }] : /* istanbul ignore next */ []));
|
|
1577
|
-
/** @internal */
|
|
1578
|
-
templateRef = inject(TemplateRef);
|
|
1579
|
-
constructor() {
|
|
1580
|
-
const customSelect = inject(SiCustomSelectDirective, { optional: true });
|
|
1581
|
-
customSelect?.registerDropdown(this);
|
|
1582
|
-
}
|
|
1583
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectDropdownDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1584
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: SiSelectDropdownDirective, isStandalone: true, selector: "[si-select-dropdown]", inputs: { contentType: { classPropertyName: "contentType", publicName: "contentType", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
1585
|
-
}
|
|
1586
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SiSelectDropdownDirective, decorators: [{
|
|
1587
|
-
type: Directive,
|
|
1588
|
-
args: [{
|
|
1589
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1590
|
-
selector: '[si-select-dropdown]'
|
|
1591
|
-
}]
|
|
1592
|
-
}], ctorParameters: () => [], propDecorators: { contentType: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentType", required: true }] }] } });
|
|
1593
|
-
|
|
1594
1461
|
/**
|
|
1595
1462
|
* Copyright (c) Siemens 2016 - 2026
|
|
1596
1463
|
* SPDX-License-Identifier: MIT
|