@i-cell/ids-angular 0.2.23 → 0.2.25
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/fesm2022/i-cell-ids-angular-accordion.mjs +32 -32
- package/fesm2022/i-cell-ids-angular-accordion.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-avatar.mjs +18 -18
- package/fesm2022/i-cell-ids-angular-avatar.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-badge.mjs +27 -27
- package/fesm2022/i-cell-ids-angular-badge.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-breadcrumb.mjs +45 -45
- package/fesm2022/i-cell-ids-angular-breadcrumb.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-button.mjs +19 -19
- package/fesm2022/i-cell-ids-angular-button.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-card.mjs +38 -41
- package/fesm2022/i-cell-ids-angular-card.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-checkbox.mjs +45 -45
- package/fesm2022/i-cell-ids-angular-checkbox.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-chip.mjs +28 -28
- package/fesm2022/i-cell-ids-angular-chip.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-core.mjs +18 -20
- package/fesm2022/i-cell-ids-angular-core.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-datepicker.mjs +74 -74
- package/fesm2022/i-cell-ids-angular-datepicker.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-dialog.mjs +23 -23
- package/fesm2022/i-cell-ids-angular-dialog.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-divider.mjs +12 -12
- package/fesm2022/i-cell-ids-angular-divider.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-forms.mjs +1054 -830
- package/fesm2022/i-cell-ids-angular-forms.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-icon-button.mjs +15 -15
- package/fesm2022/i-cell-ids-angular-icon-button.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-icon.mjs +15 -15
- package/fesm2022/i-cell-ids-angular-icon.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-menu.mjs +18 -18
- package/fesm2022/i-cell-ids-angular-menu.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-notification.mjs +26 -26
- package/fesm2022/i-cell-ids-angular-notification.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-overlay-panel.mjs +18 -18
- package/fesm2022/i-cell-ids-angular-overlay-panel.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-paginator.mjs +34 -34
- package/fesm2022/i-cell-ids-angular-paginator.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-radio.mjs +32 -32
- package/fesm2022/i-cell-ids-angular-radio.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-segmented-control-toggle.mjs +34 -34
- package/fesm2022/i-cell-ids-angular-segmented-control-toggle.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-segmented-control.mjs +34 -34
- package/fesm2022/i-cell-ids-angular-segmented-control.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-select.mjs +29 -29
- package/fesm2022/i-cell-ids-angular-select.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-side-nav.mjs +41 -41
- package/fesm2022/i-cell-ids-angular-side-nav.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-side-sheet.mjs +29 -29
- package/fesm2022/i-cell-ids-angular-side-sheet.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-snackbar.mjs +30 -30
- package/fesm2022/i-cell-ids-angular-snackbar.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-spinner.mjs +10 -10
- package/fesm2022/i-cell-ids-angular-spinner.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-switch.mjs +36 -36
- package/fesm2022/i-cell-ids-angular-switch.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-tab.mjs +140 -30
- package/fesm2022/i-cell-ids-angular-tab.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-table.mjs +94 -94
- package/fesm2022/i-cell-ids-angular-table.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-tag.mjs +20 -20
- package/fesm2022/i-cell-ids-angular-tag.mjs.map +1 -1
- package/fesm2022/i-cell-ids-angular-tooltip.mjs +32 -32
- package/fesm2022/i-cell-ids-angular-tooltip.mjs.map +1 -1
- package/package.json +60 -60
- package/{accordion/index.d.ts → types/i-cell-ids-angular-accordion.d.ts} +1 -1
- package/{avatar/index.d.ts → types/i-cell-ids-angular-avatar.d.ts} +1 -1
- package/{button/index.d.ts → types/i-cell-ids-angular-button.d.ts} +1 -1
- package/{card/index.d.ts → types/i-cell-ids-angular-card.d.ts} +2 -2
- package/{chip/index.d.ts → types/i-cell-ids-angular-chip.d.ts} +5 -5
- package/{core/index.d.ts → types/i-cell-ids-angular-core.d.ts} +2 -2
- package/{datepicker/index.d.ts → types/i-cell-ids-angular-datepicker.d.ts} +1 -1
- package/{divider/index.d.ts → types/i-cell-ids-angular-divider.d.ts} +2 -2
- package/{forms/index.d.ts → types/i-cell-ids-angular-forms.d.ts} +116 -96
- package/{icon-button/index.d.ts → types/i-cell-ids-angular-icon-button.d.ts} +2 -2
- package/{icon/index.d.ts → types/i-cell-ids-angular-icon.d.ts} +1 -1
- package/{menu/index.d.ts → types/i-cell-ids-angular-menu.d.ts} +1 -1
- package/{notification/index.d.ts → types/i-cell-ids-angular-notification.d.ts} +1 -1
- package/{paginator/index.d.ts → types/i-cell-ids-angular-paginator.d.ts} +1 -1
- package/{radio/index.d.ts → types/i-cell-ids-angular-radio.d.ts} +1 -1
- package/{segmented-control-toggle/index.d.ts → types/i-cell-ids-angular-segmented-control-toggle.d.ts} +1 -1
- package/{segmented-control/index.d.ts → types/i-cell-ids-angular-segmented-control.d.ts} +1 -1
- package/{snackbar/index.d.ts → types/i-cell-ids-angular-snackbar.d.ts} +3 -3
- package/{tab/index.d.ts → types/i-cell-ids-angular-tab.d.ts} +16 -3
- package/{tag/index.d.ts → types/i-cell-ids-angular-tag.d.ts} +1 -1
- /package/{badge/index.d.ts → types/i-cell-ids-angular-badge.d.ts} +0 -0
- /package/{breadcrumb/index.d.ts → types/i-cell-ids-angular-breadcrumb.d.ts} +0 -0
- /package/{checkbox/index.d.ts → types/i-cell-ids-angular-checkbox.d.ts} +0 -0
- /package/{dialog/index.d.ts → types/i-cell-ids-angular-dialog.d.ts} +0 -0
- /package/{overlay-panel/index.d.ts → types/i-cell-ids-angular-overlay-panel.d.ts} +0 -0
- /package/{select/index.d.ts → types/i-cell-ids-angular-select.d.ts} +0 -0
- /package/{side-nav/index.d.ts → types/i-cell-ids-angular-side-nav.d.ts} +0 -0
- /package/{side-sheet/index.d.ts → types/i-cell-ids-angular-side-sheet.d.ts} +0 -0
- /package/{spinner/index.d.ts → types/i-cell-ids-angular-spinner.d.ts} +0 -0
- /package/{switch/index.d.ts → types/i-cell-ids-angular-switch.d.ts} +0 -0
- /package/{table/index.d.ts → types/i-cell-ids-angular-table.d.ts} +0 -0
- /package/{tooltip/index.d.ts → types/i-cell-ids-angular-tooltip.d.ts} +0 -0
- /package/{index.d.ts → types/i-cell-ids-angular.d.ts} +0 -0
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, InjectionToken, inject,
|
|
3
|
-
import {
|
|
2
|
+
import { Injectable, InjectionToken, inject, Injector, signal, input, effect, booleanAttribute, computed, Directive, Input, contentChildren, ChangeDetectionStrategy, ViewEncapsulation, Component, ElementRef, ChangeDetectorRef, viewChild, contentChild, output, model, untracked, forwardRef, Renderer2, afterNextRender, isDevMode } from '@angular/core';
|
|
3
|
+
import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { NgForm, FormGroupDirective, NgControl, Validators, NG_VALUE_ACCESSOR, StatusChangeEvent } from '@angular/forms';
|
|
5
|
+
import { ComponentBaseWithDefaults, IdsSize, ComponentBase, coerceBooleanAttribute, coerceNumberAttribute } from '@i-cell/ids-angular/core';
|
|
6
|
+
import { Subject, observeOn, asapScheduler, tap, switchMap, startWith, of } from 'rxjs';
|
|
4
7
|
import { IdsIconComponent } from '@i-cell/ids-angular/icon';
|
|
5
8
|
import { hasModifierKey } from '@angular/cdk/keycodes';
|
|
6
|
-
import {
|
|
7
|
-
import * as i1 from '@angular/forms';
|
|
8
|
-
import { NgForm, FormGroupDirective, NgControl, Validators, StatusChangeEvent, ValueChangeEvent, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
|
-
import { Subject, observeOn, asapScheduler, tap, switchMap, of, startWith, filter } from 'rxjs';
|
|
10
|
-
import { LiveAnnouncer, ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
11
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
12
|
-
import { CdkOverlayOrigin } from '@angular/cdk/overlay';
|
|
13
|
-
import { IdsIconButtonComponent } from '@i-cell/ids-angular/icon-button';
|
|
9
|
+
import { IdsIconButtonAppearance, IdsIconButtonComponent } from '@i-cell/ids-angular/icon-button';
|
|
14
10
|
import { IdsOverlayPanelComponent } from '@i-cell/ids-angular/overlay-panel';
|
|
15
|
-
import { IdsSpinnerComponent } from '@i-cell/ids-angular/spinner';
|
|
11
|
+
import { IdsSpinnerVariant, IdsSpinnerComponent } from '@i-cell/ids-angular/spinner';
|
|
16
12
|
import { IdsTooltipDirective } from '@i-cell/ids-angular/tooltip';
|
|
13
|
+
import { LiveAnnouncer, ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
14
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
15
|
+
import { IdsChipAppearance, IdsChipVariant, IdsChipComponent } from '@i-cell/ids-angular/chip';
|
|
17
16
|
|
|
18
17
|
class AbstractErrorStateMatcher {
|
|
19
18
|
}
|
|
@@ -21,10 +20,10 @@ class ErrorStateMatcher extends AbstractErrorStateMatcher {
|
|
|
21
20
|
isErrorState(control, form) {
|
|
22
21
|
return !!(control && control.invalid && (control.touched || (form && form.submitted)));
|
|
23
22
|
}
|
|
24
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
25
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
23
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: ErrorStateMatcher, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
24
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: ErrorStateMatcher, providedIn: 'root' }); }
|
|
26
25
|
}
|
|
27
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: ErrorStateMatcher, decorators: [{
|
|
28
27
|
type: Injectable,
|
|
29
28
|
args: [{ providedIn: 'root' }]
|
|
30
29
|
}] });
|
|
@@ -58,10 +57,10 @@ class SuccessStateMatcher extends AbstractSuccessStateMatcher {
|
|
|
58
57
|
isSuccessState(control, form) {
|
|
59
58
|
return !!(control && control.valid && (control.touched || (form && form.submitted)));
|
|
60
59
|
}
|
|
61
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
62
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
60
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SuccessStateMatcher, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
61
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SuccessStateMatcher, providedIn: 'root' }); }
|
|
63
62
|
}
|
|
64
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SuccessStateMatcher, decorators: [{
|
|
65
64
|
type: Injectable,
|
|
66
65
|
args: [{ providedIn: 'root' }]
|
|
67
66
|
}] });
|
|
@@ -95,223 +94,11 @@ const IDS_AUTOCOMPLETE_DEFAULT_CONFIG = new InjectionToken('IDS_AUTOCOMPLETE_DEF
|
|
|
95
94
|
});
|
|
96
95
|
function IDS_AUTOCOMPLETE_DEFAULT_CONFIG_FACTORY() {
|
|
97
96
|
return {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
hintNoResults: 'No results found',
|
|
101
|
-
hintMinChars: 'Please provide at least 1 characters',
|
|
102
|
-
hintMaxLength: 'Too many results, please refine your search',
|
|
103
|
-
typeaheadDebounceInterval: 300,
|
|
97
|
+
errorStateMatcher: ErrorStateMatcher,
|
|
98
|
+
successStateMatcher: SuccessStateMatcher,
|
|
104
99
|
};
|
|
105
100
|
}
|
|
106
101
|
|
|
107
|
-
const IDS_AUTOCOMPLETE_LOADER = new InjectionToken('IDS_AUTOCOMPLETE_LOADER');
|
|
108
|
-
|
|
109
|
-
const IDS_OPTION_GROUP = new InjectionToken('IdsOptionGroup');
|
|
110
|
-
|
|
111
|
-
const IDS_OPTION_PARENT_COMPONENT = new InjectionToken('IDS_OPTION_PARENT_COMPONENT');
|
|
112
|
-
|
|
113
|
-
class IdsOptionSelectionChange {
|
|
114
|
-
constructor(source, selected, isUserInput = false) {
|
|
115
|
-
this.source = source;
|
|
116
|
-
this.selected = selected;
|
|
117
|
-
this.isUserInput = isUserInput;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const IdsFormFieldVariant = {
|
|
122
|
-
SURFACE: 'surface',
|
|
123
|
-
LIGHT: 'light',
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const IDS_PSEUDO_CHECKBOX_PARENT = new InjectionToken('IDS_PSEUDO_CHECKBOX_PARENT');
|
|
127
|
-
|
|
128
|
-
const IdsPseudoCheckboxState = {
|
|
129
|
-
UNCHECKED: 'unchecked',
|
|
130
|
-
CHECKED: 'checked',
|
|
131
|
-
INDETERMINATE: 'indeterminate',
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
class PseudoCheckboxComponent extends ComponentBase {
|
|
135
|
-
constructor() {
|
|
136
|
-
super(...arguments);
|
|
137
|
-
this._parent = inject(IDS_PSEUDO_CHECKBOX_PARENT, { optional: true });
|
|
138
|
-
this.checkboxState = input(IdsPseudoCheckboxState.UNCHECKED, ...(ngDevMode ? [{ debugName: "checkboxState" }] : []));
|
|
139
|
-
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: coerceBooleanAttribute }] : [{ transform: coerceBooleanAttribute }]));
|
|
140
|
-
this._isChecked = computed(() => this.checkboxState() === IdsPseudoCheckboxState.CHECKED, ...(ngDevMode ? [{ debugName: "_isChecked" }] : []));
|
|
141
|
-
this._isIndeterminate = computed(() => this.checkboxState() === IdsPseudoCheckboxState.INDETERMINATE, ...(ngDevMode ? [{ debugName: "_isIndeterminate" }] : []));
|
|
142
|
-
this._hostClasses = computed(() => this._getHostClasses([
|
|
143
|
-
this._parent?.embeddedPseudoCheckboxSize(),
|
|
144
|
-
this._parent?.embeddedPseudoCheckboxVariant(),
|
|
145
|
-
this.disabled() ? 'disabled' : null,
|
|
146
|
-
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
|
|
147
|
-
}
|
|
148
|
-
get _hostName() {
|
|
149
|
-
return 'pseudo-checkbox';
|
|
150
|
-
}
|
|
151
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: PseudoCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
152
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.7", type: PseudoCheckboxComponent, isStandalone: true, selector: "ids-pseudo-checkbox", inputs: { checkboxState: { classPropertyName: "checkboxState", publicName: "checkboxState", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<div class=\"ids-pseudo-checkbox__input-wrapper\">\n <input\n type=\"checkbox\"\n [disabled]=\"disabled()\"\n [attr.aria-checked]=\"_isIndeterminate() ? 'mixed' : null\"\n [checked]=\"_isChecked()\"\n [indeterminate]=\"_isIndeterminate()\"\n (change)=\"$event.stopPropagation()\"\n />\n <div class=\"ids-pseudo-checkbox__icon\" aria-hidden=\"true\">\n @if (_isIndeterminate()) {\n <ids-icon fontIcon=\"remove\" aria-hidden=\"true\" />\n }\n @if (_isChecked()) {\n <ids-icon fontIcon=\"done\" aria-hidden=\"true\" />\n }\n </div>\n</div>\n", dependencies: [{ kind: "component", type: IdsIconComponent, selector: "ids-icon", inputs: ["size", "sizeCollection", "variant", "fontIcon", "svgIcon", "aria-hidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
153
|
-
}
|
|
154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: PseudoCheckboxComponent, decorators: [{
|
|
155
|
-
type: Component,
|
|
156
|
-
args: [{ selector: 'ids-pseudo-checkbox', imports: [IdsIconComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ids-pseudo-checkbox__input-wrapper\">\n <input\n type=\"checkbox\"\n [disabled]=\"disabled()\"\n [attr.aria-checked]=\"_isIndeterminate() ? 'mixed' : null\"\n [checked]=\"_isChecked()\"\n [indeterminate]=\"_isIndeterminate()\"\n (change)=\"$event.stopPropagation()\"\n />\n <div class=\"ids-pseudo-checkbox__icon\" aria-hidden=\"true\">\n @if (_isIndeterminate()) {\n <ids-icon fontIcon=\"remove\" aria-hidden=\"true\" />\n }\n @if (_isChecked()) {\n <ids-icon fontIcon=\"done\" aria-hidden=\"true\" />\n }\n </div>\n</div>\n" }]
|
|
157
|
-
}] });
|
|
158
|
-
|
|
159
|
-
class IdsOptionComponent extends ComponentBase {
|
|
160
|
-
get _hostName() {
|
|
161
|
-
return 'option';
|
|
162
|
-
}
|
|
163
|
-
constructor() {
|
|
164
|
-
super();
|
|
165
|
-
this._parent = inject(IDS_OPTION_PARENT_COMPONENT);
|
|
166
|
-
this._element = inject(ElementRef);
|
|
167
|
-
this.group = inject(IDS_OPTION_GROUP, { optional: true });
|
|
168
|
-
this._textElement = viewChild.required('text');
|
|
169
|
-
this.selected = signal(false, ...(ngDevMode ? [{ debugName: "selected" }] : []));
|
|
170
|
-
this._active = signal(false, ...(ngDevMode ? [{ debugName: "_active" }] : []));
|
|
171
|
-
this.size = computed(() => this._parent.parentSize(), ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
172
|
-
this.variant = computed(() => this._parent.parentVariant(), ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
173
|
-
this.value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : []));
|
|
174
|
-
this.explicitViewValue = input(null, ...(ngDevMode ? [{ debugName: "explicitViewValue", alias: 'viewValue' }] : [{ alias: 'viewValue' }]));
|
|
175
|
-
this.disabledInput = input(false, ...(ngDevMode ? [{ debugName: "disabledInput", alias: 'disabled', transform: coerceBooleanAttribute }] : [{ alias: 'disabled', transform: coerceBooleanAttribute }]));
|
|
176
|
-
this.disabled = false; // Do not delete this class member, until ListKeyManagerOption requires: `disabled: boolean`
|
|
177
|
-
this._groupOrOptionIsDisabled = computed(() => this.group?.disabled() || this.disabledInput(), ...(ngDevMode ? [{ debugName: "_groupOrOptionIsDisabled" }] : []));
|
|
178
|
-
this._multiSelect = Boolean(this._parent?.multiSelect());
|
|
179
|
-
// eslint-disable-next-line @angular-eslint/no-output-on-prefix
|
|
180
|
-
this.onSelectionChange = output();
|
|
181
|
-
this.viewValue = computed(() => this.explicitViewValue() || this._textElement().nativeElement.textContent || '', ...(ngDevMode ? [{ debugName: "viewValue" }] : []));
|
|
182
|
-
this._hostClasses = computed(() => this._getHostClasses([
|
|
183
|
-
this.selected() ? 'selected' : null,
|
|
184
|
-
this._active() ? 'active' : null,
|
|
185
|
-
this._groupOrOptionIsDisabled() ? 'disabled' : null,
|
|
186
|
-
this._multiSelect ? 'multiselect' : null,
|
|
187
|
-
this.size(),
|
|
188
|
-
this.variant(),
|
|
189
|
-
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
|
|
190
|
-
this._pseudoCheckboxState = computed(() => (this.selected() ? IdsPseudoCheckboxState.CHECKED : IdsPseudoCheckboxState.UNCHECKED), ...(ngDevMode ? [{ debugName: "_pseudoCheckboxState" }] : []));
|
|
191
|
-
this.embeddedPseudoCheckboxSize = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "embeddedPseudoCheckboxSize" }] : []));
|
|
192
|
-
this.embeddedPseudoCheckboxVariant = signal(IdsFormFieldVariant.SURFACE, ...(ngDevMode ? [{ debugName: "embeddedPseudoCheckboxVariant" }] : []));
|
|
193
|
-
effect(() => {
|
|
194
|
-
this.disabled = this.disabledInput();
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
ngOnInit() {
|
|
198
|
-
const parent = this._parent;
|
|
199
|
-
if (parent.isOptionPreSelectedByValue(this.value())) {
|
|
200
|
-
this.selected.set(true);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
_handleKeydown(event) {
|
|
204
|
-
if ((event.key === 'ENTER' || event.key === ' ') && !hasModifierKey(event)) {
|
|
205
|
-
this.selectViaInteraction();
|
|
206
|
-
event.preventDefault();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
selectViaInteraction() {
|
|
210
|
-
if (!this._groupOrOptionIsDisabled()) {
|
|
211
|
-
this._emitSelectionChangeEvent(!this.selected(), true);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
getHostElement() {
|
|
215
|
-
return this._element.nativeElement;
|
|
216
|
-
}
|
|
217
|
-
select(emitEvent = true) {
|
|
218
|
-
if (!this.selected()) {
|
|
219
|
-
if (emitEvent) {
|
|
220
|
-
this._emitSelectionChangeEvent(true);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
deselect(emitEvent = true) {
|
|
225
|
-
if (this.selected()) {
|
|
226
|
-
if (emitEvent) {
|
|
227
|
-
this._emitSelectionChangeEvent(false);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
focus(_origin, options) {
|
|
232
|
-
const element = this._element.nativeElement;
|
|
233
|
-
if (typeof element.focus === 'function') {
|
|
234
|
-
element.focus(options);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
setActiveStyles() {
|
|
238
|
-
if (!this._active()) {
|
|
239
|
-
this._active.set(true);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
setInactiveStyles() {
|
|
243
|
-
if (this._active()) {
|
|
244
|
-
this._active.set(false);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
getLabel() {
|
|
248
|
-
return this.viewValue();
|
|
249
|
-
}
|
|
250
|
-
_emitSelectionChangeEvent(selected, isUserInput = false) {
|
|
251
|
-
if (this._multiSelect || !this.selected()) {
|
|
252
|
-
this.onSelectionChange.emit(new IdsOptionSelectionChange(this, selected, isUserInput));
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: IdsOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
256
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.7", type: IdsOptionComponent, isStandalone: true, selector: "ids-option", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, explicitViewValue: { classPropertyName: "explicitViewValue", publicName: "viewValue", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSelectionChange: "onSelectionChange" }, host: { attributes: { "role": "option" }, listeners: { "click": "selectViaInteraction()", "keydown": "_handleKeydown($event)" }, properties: { "attr.aria-selected": "selected()", "attr.aria-disabled": "disabled.toString()" } }, providers: [
|
|
257
|
-
{
|
|
258
|
-
provide: IDS_PSEUDO_CHECKBOX_PARENT,
|
|
259
|
-
useExisting: IdsOptionComponent,
|
|
260
|
-
},
|
|
261
|
-
], viewQueries: [{ propertyName: "_textElement", first: true, predicate: ["text"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (_multiSelect) {\n <ids-pseudo-checkbox aria-hidden=\"true\" [disabled]=\"_groupOrOptionIsDisabled()\" [checkboxState]=\"_pseudoCheckboxState()\" />\n}\n\n<div #text class=\"ids-option__text\"><ng-content /></div>\n\n@if (!_multiSelect && selected()) {\n <ids-icon fontIcon=\"done\" />\n}\n", dependencies: [{ kind: "component", type: IdsIconComponent, selector: "ids-icon", inputs: ["size", "sizeCollection", "variant", "fontIcon", "svgIcon", "aria-hidden"] }, { kind: "component", type: PseudoCheckboxComponent, selector: "ids-pseudo-checkbox", inputs: ["checkboxState", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
262
|
-
}
|
|
263
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: IdsOptionComponent, decorators: [{
|
|
264
|
-
type: Component,
|
|
265
|
-
args: [{ selector: 'ids-option', imports: [
|
|
266
|
-
IdsIconComponent,
|
|
267
|
-
PseudoCheckboxComponent,
|
|
268
|
-
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
269
|
-
{
|
|
270
|
-
provide: IDS_PSEUDO_CHECKBOX_PARENT,
|
|
271
|
-
useExisting: IdsOptionComponent,
|
|
272
|
-
},
|
|
273
|
-
], host: {
|
|
274
|
-
'role': 'option',
|
|
275
|
-
'[attr.aria-selected]': 'selected()',
|
|
276
|
-
'[attr.aria-disabled]': 'disabled.toString()',
|
|
277
|
-
'(click)': 'selectViaInteraction()',
|
|
278
|
-
'(keydown)': '_handleKeydown($event)',
|
|
279
|
-
}, template: "@if (_multiSelect) {\n <ids-pseudo-checkbox aria-hidden=\"true\" [disabled]=\"_groupOrOptionIsDisabled()\" [checkboxState]=\"_pseudoCheckboxState()\" />\n}\n\n<div #text class=\"ids-option__text\"><ng-content /></div>\n\n@if (!_multiSelect && selected()) {\n <ids-icon fontIcon=\"done\" />\n}\n" }]
|
|
280
|
-
}], ctorParameters: () => [] });
|
|
281
|
-
function _countGroupLabelsBeforeOption(optionIndex, options, optionGroups) {
|
|
282
|
-
if (optionGroups.length) {
|
|
283
|
-
let groupCounter = 0;
|
|
284
|
-
for (let i = 0; i < optionIndex + 1; i++) {
|
|
285
|
-
if (options[i].group && options[i].group === optionGroups[groupCounter]) {
|
|
286
|
-
groupCounter++;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return groupCounter;
|
|
290
|
-
}
|
|
291
|
-
return 0;
|
|
292
|
-
}
|
|
293
|
-
function _getOptionScrollPosition(optionOffset, optionHeight, currentScrollPosition, panelHeight) {
|
|
294
|
-
if (optionOffset < currentScrollPosition) {
|
|
295
|
-
return optionOffset;
|
|
296
|
-
}
|
|
297
|
-
if (optionOffset + optionHeight > currentScrollPosition + panelHeight) {
|
|
298
|
-
return Math.max(0, optionOffset - panelHeight + optionHeight);
|
|
299
|
-
}
|
|
300
|
-
return currentScrollPosition;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
class IdsFormFieldActionDirective {
|
|
304
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: IdsFormFieldActionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
305
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.7", type: IdsFormFieldActionDirective, isStandalone: true, selector: "[idsFormFieldAction]", ngImport: i0 }); }
|
|
306
|
-
}
|
|
307
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: IdsFormFieldActionDirective, decorators: [{
|
|
308
|
-
type: Directive,
|
|
309
|
-
args: [{
|
|
310
|
-
selector: '[idsFormFieldAction]',
|
|
311
|
-
standalone: true,
|
|
312
|
-
}]
|
|
313
|
-
}] });
|
|
314
|
-
|
|
315
102
|
const formFieldControlClass = 'ids-form-field-control';
|
|
316
103
|
class IdsFormFieldControl extends ComponentBaseWithDefaults {
|
|
317
104
|
constructor() {
|
|
@@ -319,22 +106,22 @@ class IdsFormFieldControl extends ComponentBaseWithDefaults {
|
|
|
319
106
|
this._injector = inject(Injector);
|
|
320
107
|
this._parentForm = inject(NgForm, { optional: true });
|
|
321
108
|
this._parentFormGroup = inject(FormGroupDirective, { optional: true });
|
|
322
|
-
this.ngControl = signal(null, ...(ngDevMode ? [{ debugName: "ngControl" }] : []));
|
|
109
|
+
this.ngControl = signal(null, ...(ngDevMode ? [{ debugName: "ngControl" }] : /* istanbul ignore next */ []));
|
|
323
110
|
this.errorStateChanges = new Subject();
|
|
324
111
|
this.successStateChanges = new Subject();
|
|
325
|
-
this.canHandleSuccessState = input(false, ...(ngDevMode ? [{ debugName: "canHandleSuccessState" }] : []));
|
|
326
|
-
this.hasErrorState = signal(false, ...(ngDevMode ? [{ debugName: "hasErrorState" }] : []));
|
|
327
|
-
this.hasSuccessState = signal(false, ...(ngDevMode ? [{ debugName: "hasSuccessState" }] : []));
|
|
112
|
+
this.canHandleSuccessState = input(false, ...(ngDevMode ? [{ debugName: "canHandleSuccessState" }] : /* istanbul ignore next */ []));
|
|
113
|
+
this.hasErrorState = signal(false, ...(ngDevMode ? [{ debugName: "hasErrorState" }] : /* istanbul ignore next */ []));
|
|
114
|
+
this.hasSuccessState = signal(false, ...(ngDevMode ? [{ debugName: "hasSuccessState" }] : /* istanbul ignore next */ []));
|
|
328
115
|
this._canHandleSuccessStateEffect = effect(() => {
|
|
329
116
|
this._setSuccessStateTracker(this.canHandleSuccessState());
|
|
330
|
-
}, ...(ngDevMode ? [{ debugName: "_canHandleSuccessStateEffect" }] : []));
|
|
117
|
+
}, ...(ngDevMode ? [{ debugName: "_canHandleSuccessStateEffect" }] : /* istanbul ignore next */ []));
|
|
331
118
|
/** Handles the `disabled` input binding */
|
|
332
|
-
this.disabledInput = input(false, ...(ngDevMode ?
|
|
119
|
+
this.disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'disabled' });
|
|
333
120
|
/** Stores the `disabled` state internally */
|
|
334
|
-
this._disabled = signal(this.disabledInput(), ...(ngDevMode ? [{ debugName: "_disabled" }] : []));
|
|
121
|
+
this._disabled = signal(this.disabledInput(), ...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
|
|
335
122
|
/** The input's `disabled` state as a read-only signal (to enable/disable the contol programmatically, use the FormControl's related API) */
|
|
336
|
-
this.disabled = computed(() => this._disabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
337
|
-
this.readonly = input(false, ...(ngDevMode ?
|
|
123
|
+
this.disabled = computed(() => this._disabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
124
|
+
this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
338
125
|
/** This effect is triggered if the `disabled` attribute binding changes and delegates the change to the underlying FormControl */
|
|
339
126
|
this._disabledInputEffect = effect(() => {
|
|
340
127
|
const enableOrDisable = this.disabledInput() ? 'disable' : 'enable';
|
|
@@ -343,9 +130,9 @@ class IdsFormFieldControl extends ComponentBaseWithDefaults {
|
|
|
343
130
|
// (the FormControl's enable/disable method call will trigger a StatusChangeEvent and/or the ControlValueAccessor's setDisabledState() callback
|
|
344
131
|
// so that we can update the `disabled` signal)
|
|
345
132
|
queueMicrotask(() => controlDir?.control?.[enableOrDisable]());
|
|
346
|
-
}, ...(ngDevMode ? [{ debugName: "_disabledInputEffect" }] : []));
|
|
347
|
-
this.required = input(false, ...(ngDevMode ?
|
|
348
|
-
this.placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
133
|
+
}, ...(ngDevMode ? [{ debugName: "_disabledInputEffect" }] : /* istanbul ignore next */ []));
|
|
134
|
+
this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
135
|
+
this.placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
349
136
|
// Get the NgControl reference as soon as we can
|
|
350
137
|
queueMicrotask(() => {
|
|
351
138
|
this.ngControl.set(this._injector.get(NgControl, null, { self: true }));
|
|
@@ -377,12 +164,17 @@ class IdsFormFieldControl extends ComponentBaseWithDefaults {
|
|
|
377
164
|
this.hasSuccessState.set(false);
|
|
378
165
|
}
|
|
379
166
|
}
|
|
380
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
381
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
167
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFormFieldControl, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
168
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: IdsFormFieldControl, isStandalone: true, inputs: { canHandleSuccessState: { classPropertyName: "canHandleSuccessState", publicName: "canHandleSuccessState", 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 }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 }); }
|
|
382
169
|
}
|
|
383
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
170
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFormFieldControl, decorators: [{
|
|
384
171
|
type: Directive
|
|
385
|
-
}], ctorParameters: () => [] });
|
|
172
|
+
}], ctorParameters: () => [], propDecorators: { canHandleSuccessState: [{ type: i0.Input, args: [{ isSignal: true, alias: "canHandleSuccessState", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }] } });
|
|
173
|
+
|
|
174
|
+
const IdsFormFieldVariant = {
|
|
175
|
+
SURFACE: 'surface',
|
|
176
|
+
LIGHT: 'light',
|
|
177
|
+
};
|
|
386
178
|
|
|
387
179
|
const IDS_FORM_FIELD_DEFAULT_CONFIG = new InjectionToken('IDS_FORM_FIELD_DEFAULT_CONFIG', {
|
|
388
180
|
providedIn: 'root',
|
|
@@ -397,6 +189,18 @@ function IDS_FORM_FIELD_DEFAULT_CONFIG_FACTORY() {
|
|
|
397
189
|
|
|
398
190
|
const IDS_FORM_FIELD_CONTROL = new InjectionToken('IDS_FORM_FIELD_CONTROL');
|
|
399
191
|
|
|
192
|
+
class IdsFormFieldActionDirective {
|
|
193
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFormFieldActionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
194
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.5", type: IdsFormFieldActionDirective, isStandalone: true, selector: "[idsFormFieldAction]", ngImport: i0 }); }
|
|
195
|
+
}
|
|
196
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFormFieldActionDirective, decorators: [{
|
|
197
|
+
type: Directive,
|
|
198
|
+
args: [{
|
|
199
|
+
selector: '[idsFormFieldAction]',
|
|
200
|
+
standalone: true,
|
|
201
|
+
}]
|
|
202
|
+
}] });
|
|
203
|
+
|
|
400
204
|
class IdsPrefixDirective {
|
|
401
205
|
constructor() {
|
|
402
206
|
this.isLeadingIcon = false;
|
|
@@ -404,10 +208,10 @@ class IdsPrefixDirective {
|
|
|
404
208
|
set idsLeadingIcon(value) {
|
|
405
209
|
this.isLeadingIcon = true;
|
|
406
210
|
}
|
|
407
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
408
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
211
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsPrefixDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
212
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.5", type: IdsPrefixDirective, isStandalone: true, selector: "[idsPrefix], [idsLeadingIcon]", inputs: { idsLeadingIcon: "idsLeadingIcon" }, ngImport: i0 }); }
|
|
409
213
|
}
|
|
410
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
214
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsPrefixDirective, decorators: [{
|
|
411
215
|
type: Directive,
|
|
412
216
|
args: [{
|
|
413
217
|
selector: '[idsPrefix], [idsLeadingIcon]',
|
|
@@ -425,10 +229,10 @@ class IdsSuffixDirective {
|
|
|
425
229
|
set idsTrailingIcon(value) {
|
|
426
230
|
this.isTrailingIcon = true;
|
|
427
231
|
}
|
|
428
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
429
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
232
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsSuffixDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
233
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.5", type: IdsSuffixDirective, isStandalone: true, selector: "[idsSuffix], [idsTrailingIcon]", inputs: { idsTrailingIcon: "idsTrailingIcon" }, ngImport: i0 }); }
|
|
430
234
|
}
|
|
431
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
235
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsSuffixDirective, decorators: [{
|
|
432
236
|
type: Directive,
|
|
433
237
|
args: [{
|
|
434
238
|
selector: '[idsSuffix], [idsTrailingIcon]',
|
|
@@ -475,10 +279,10 @@ function IDS_FIELDSET_DEFAULT_CONFIG_FACTORY() {
|
|
|
475
279
|
}
|
|
476
280
|
|
|
477
281
|
class IdsFieldsetMessageDirective {
|
|
478
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
479
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
282
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFieldsetMessageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
283
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.5", type: IdsFieldsetMessageDirective, isStandalone: true, selector: "[idsFieldsetMessage]", ngImport: i0 }); }
|
|
480
284
|
}
|
|
481
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFieldsetMessageDirective, decorators: [{
|
|
482
286
|
type: Directive,
|
|
483
287
|
args: [{
|
|
484
288
|
selector: '[idsFieldsetMessage]',
|
|
@@ -491,26 +295,26 @@ class IdsFieldsetComponent extends ComponentBaseWithDefaults {
|
|
|
491
295
|
constructor() {
|
|
492
296
|
super(...arguments);
|
|
493
297
|
this._defaultConfig = this._getDefaultConfig(defaultConfig$4, IDS_FIELDSET_DEFAULT_CONFIG);
|
|
494
|
-
this.size = input(this._defaultConfig.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
495
|
-
this.variant = input(this._defaultConfig.variant, ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
496
|
-
this.legend = input('', ...(ngDevMode ? [{ debugName: "legend" }] : []));
|
|
497
|
-
this._fieldsetMessage = contentChildren(IdsFieldsetMessageDirective, ...(ngDevMode ? [{ debugName: "_fieldsetMessage" }] : []));
|
|
498
|
-
this._hasMessage = computed(() => this._fieldsetMessage().length > 0, ...(ngDevMode ? [{ debugName: "_hasMessage" }] : []));
|
|
298
|
+
this.size = input(this._defaultConfig.size, ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
299
|
+
this.variant = input(this._defaultConfig.variant, ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
300
|
+
this.legend = input('', ...(ngDevMode ? [{ debugName: "legend" }] : /* istanbul ignore next */ []));
|
|
301
|
+
this._fieldsetMessage = contentChildren(IdsFieldsetMessageDirective, ...(ngDevMode ? [{ debugName: "_fieldsetMessage" }] : /* istanbul ignore next */ []));
|
|
302
|
+
this._hasMessage = computed(() => this._fieldsetMessage().length > 0, ...(ngDevMode ? [{ debugName: "_hasMessage" }] : /* istanbul ignore next */ []));
|
|
499
303
|
this._hostClasses = computed(() => this._getHostClasses([
|
|
500
304
|
this.size(),
|
|
501
305
|
this.variant(),
|
|
502
|
-
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
|
|
306
|
+
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : /* istanbul ignore next */ []));
|
|
503
307
|
}
|
|
504
308
|
get _hostName() {
|
|
505
309
|
return 'fieldset';
|
|
506
310
|
}
|
|
507
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
508
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
311
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFieldsetComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
312
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: IdsFieldsetComponent, isStandalone: true, selector: "fieldset[idsFieldset]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, legend: { classPropertyName: "legend", publicName: "legend", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "_fieldsetMessage", predicate: IdsFieldsetMessageDirective, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<legend class=\"ids-fieldset-legend\">{{ legend() }}</legend>\n@if (_hasMessage()) {\n <div class=\"ids-fieldset-message\">\n <ng-content select=\"[idsFieldsetMessage]\" />\n </div>\n}\n<ng-content select=\"ids-fieldset-row\" />\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
509
313
|
}
|
|
510
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFieldsetComponent, decorators: [{
|
|
511
315
|
type: Component,
|
|
512
316
|
args: [{ selector: 'fieldset[idsFieldset]', imports: [], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<legend class=\"ids-fieldset-legend\">{{ legend() }}</legend>\n@if (_hasMessage()) {\n <div class=\"ids-fieldset-message\">\n <ng-content select=\"[idsFieldsetMessage]\" />\n </div>\n}\n<ng-content select=\"ids-fieldset-row\" />\n" }]
|
|
513
|
-
}] });
|
|
317
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], legend: [{ type: i0.Input, args: [{ isSignal: true, alias: "legend", required: false }] }], _fieldsetMessage: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsFieldsetMessageDirective), { isSignal: true }] }] } });
|
|
514
318
|
|
|
515
319
|
/**
|
|
516
320
|
* Directive to map an error message to an error code for a form field.
|
|
@@ -546,7 +350,7 @@ class IdsErrorDefinitionDirective {
|
|
|
546
350
|
/**
|
|
547
351
|
* The validation error's identifier code
|
|
548
352
|
*/
|
|
549
|
-
this.code = input.required(...(ngDevMode ? [{ debugName: "code" }] : []));
|
|
353
|
+
this.code = input.required(...(ngDevMode ? [{ debugName: "code" }] : /* istanbul ignore next */ []));
|
|
550
354
|
this._elementRef = inject(ElementRef);
|
|
551
355
|
}
|
|
552
356
|
/**
|
|
@@ -567,21 +371,21 @@ class IdsErrorDefinitionDirective {
|
|
|
567
371
|
message: () => self.errorMessage,
|
|
568
372
|
};
|
|
569
373
|
}
|
|
570
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
571
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
374
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsErrorDefinitionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
375
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: IdsErrorDefinitionDirective, isStandalone: true, selector: "ids-error-def", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
572
376
|
}
|
|
573
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsErrorDefinitionDirective, decorators: [{
|
|
574
378
|
type: Directive,
|
|
575
379
|
args: [{
|
|
576
380
|
selector: 'ids-error-def',
|
|
577
381
|
}]
|
|
578
|
-
}] });
|
|
382
|
+
}], propDecorators: { code: [{ type: i0.Input, args: [{ isSignal: true, alias: "code", required: true }] }] } });
|
|
579
383
|
|
|
580
384
|
class IdsMessageSuffixDirective {
|
|
581
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
582
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
385
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsMessageSuffixDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
386
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.5", type: IdsMessageSuffixDirective, isStandalone: true, selector: "[idsMessageSuffix]", ngImport: i0 }); }
|
|
583
387
|
}
|
|
584
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
388
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsMessageSuffixDirective, decorators: [{
|
|
585
389
|
type: Directive,
|
|
586
390
|
args: [{
|
|
587
391
|
selector: '[idsMessageSuffix]',
|
|
@@ -615,30 +419,30 @@ class IdsMessageDirective extends ComponentBaseWithDefaults {
|
|
|
615
419
|
super(...arguments);
|
|
616
420
|
this._parent = inject(IDS_MESSAGE_PARENT_FORM_FIELD, { skipSelf: true, optional: true });
|
|
617
421
|
this._defaultConfig = this._getDefaultConfig(defaultConfig$3, IDS_MESSAGE_DEFAULT_CONFIG);
|
|
618
|
-
this.size = input(this._defaultConfig.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
619
|
-
this.variant = input(this._defaultConfig.variant, ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
620
|
-
this._parentOrSelfSize = computed(() => this._parent?.size() ?? this.size(), ...(ngDevMode ? [{ debugName: "_parentOrSelfSize" }] : []));
|
|
621
|
-
this._parentOrSelfVariant = computed(() => this._parent?.variant() ?? this.variant(), ...(ngDevMode ? [{ debugName: "_parentOrSelfVariant" }] : []));
|
|
622
|
-
this._parentDisabled = computed(() => this._parent?.disabled(), ...(ngDevMode ? [{ debugName: "_parentDisabled" }] : []));
|
|
422
|
+
this.size = input(this._defaultConfig.size, ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
423
|
+
this.variant = input(this._defaultConfig.variant, ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
424
|
+
this._parentOrSelfSize = computed(() => this._parent?.size() ?? this.size(), ...(ngDevMode ? [{ debugName: "_parentOrSelfSize" }] : /* istanbul ignore next */ []));
|
|
425
|
+
this._parentOrSelfVariant = computed(() => this._parent?.variant() ?? this.variant(), ...(ngDevMode ? [{ debugName: "_parentOrSelfVariant" }] : /* istanbul ignore next */ []));
|
|
426
|
+
this._parentDisabled = computed(() => this._parent?.disabled(), ...(ngDevMode ? [{ debugName: "_parentDisabled" }] : /* istanbul ignore next */ []));
|
|
623
427
|
this._hostClasses = computed(() => this._getHostClasses([
|
|
624
428
|
this._parentOrSelfSize(),
|
|
625
429
|
this._parentOrSelfVariant(),
|
|
626
430
|
this._parentDisabled() ? 'disabled' : null,
|
|
627
|
-
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
|
|
431
|
+
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : /* istanbul ignore next */ []));
|
|
628
432
|
}
|
|
629
433
|
get _hostName() {
|
|
630
434
|
return 'message';
|
|
631
435
|
}
|
|
632
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
633
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
436
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsMessageDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
437
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: IdsMessageDirective, isStandalone: true, selector: "[idsMessage]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 }); }
|
|
634
438
|
}
|
|
635
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
439
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsMessageDirective, decorators: [{
|
|
636
440
|
type: Directive,
|
|
637
441
|
args: [{
|
|
638
442
|
selector: '[idsMessage]',
|
|
639
443
|
standalone: true,
|
|
640
444
|
}]
|
|
641
|
-
}] });
|
|
445
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }] } });
|
|
642
446
|
|
|
643
447
|
class IdsErrorMessageComponent extends ComponentBase {
|
|
644
448
|
get _hostName() {
|
|
@@ -647,12 +451,12 @@ class IdsErrorMessageComponent extends ComponentBase {
|
|
|
647
451
|
constructor() {
|
|
648
452
|
super();
|
|
649
453
|
this._parent = inject(IdsFormFieldComponent, { skipSelf: true });
|
|
650
|
-
this._control = signal(null, ...(ngDevMode ? [{ debugName: "_control" }] : []));
|
|
651
|
-
this._errorDefDirs = contentChildren(IdsErrorDefinitionDirective, ...(ngDevMode ? [{ debugName: "_errorDefDirs" }] : []));
|
|
652
|
-
this._errorDefs = computed(() => this._errorDefDirs().map((errorDefDir) => errorDefDir.toErrorMessageMapping()), ...(ngDevMode ? [{ debugName: "_errorDefs" }] : []));
|
|
653
|
-
this._validationError = signal(null, ...(ngDevMode ? [{ debugName: "_validationError" }] : []));
|
|
654
|
-
this._hostClasses = computed(() => this._getHostClasses([]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
|
|
655
|
-
this.suffixes = contentChildren(IdsMessageSuffixDirective, ...(ngDevMode ? [{ debugName: "suffixes" }] : []));
|
|
454
|
+
this._control = signal(null, ...(ngDevMode ? [{ debugName: "_control" }] : /* istanbul ignore next */ []));
|
|
455
|
+
this._errorDefDirs = contentChildren(IdsErrorDefinitionDirective, ...(ngDevMode ? [{ debugName: "_errorDefDirs" }] : /* istanbul ignore next */ []));
|
|
456
|
+
this._errorDefs = computed(() => this._errorDefDirs().map((errorDefDir) => errorDefDir.toErrorMessageMapping()), ...(ngDevMode ? [{ debugName: "_errorDefs" }] : /* istanbul ignore next */ []));
|
|
457
|
+
this._validationError = signal(null, ...(ngDevMode ? [{ debugName: "_validationError" }] : /* istanbul ignore next */ []));
|
|
458
|
+
this._hostClasses = computed(() => this._getHostClasses([]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : /* istanbul ignore next */ []));
|
|
459
|
+
this.suffixes = contentChildren(IdsMessageSuffixDirective, ...(ngDevMode ? [{ debugName: "suffixes" }] : /* istanbul ignore next */ []));
|
|
656
460
|
toObservable(this._parent.controlDir).pipe(observeOn(asapScheduler), tap((controlDir) => this._control.set(controlDir?.control ?? null)), switchMap(() => this._control()?.statusChanges.pipe(startWith(this._control()?.status)) ?? of(null)), takeUntilDestroyed(this._destroyRef)).subscribe((status) => {
|
|
657
461
|
if (status === 'INVALID') {
|
|
658
462
|
const nextError = this._selectMostImportantValidationError();
|
|
@@ -675,19 +479,19 @@ class IdsErrorMessageComponent extends ComponentBase {
|
|
|
675
479
|
_getValidationErrorMessage(messageOrFn) {
|
|
676
480
|
return messageOrFn instanceof Function ? messageOrFn() : messageOrFn;
|
|
677
481
|
}
|
|
678
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
679
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
482
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsErrorMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
483
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: IdsErrorMessageComponent, isStandalone: true, selector: "ids-error-message", queries: [{ propertyName: "_errorDefDirs", predicate: IdsErrorDefinitionDirective, isSignal: true }, { propertyName: "suffixes", predicate: IdsMessageSuffixDirective, isSignal: true }], usesInheritance: true, hostDirectives: [{ directive: IdsMessageDirective }], ngImport: i0, template: "<div class=\"ids-message__prefix\">\n <ng-content select=\"[idsMessagePrefix]\">\n <ids-icon aria-hidden=\"true\" fontIcon=\"alert-circle-outline\" variant=\"error\" />\n </ng-content>\n</div>\n<div class=\"ids-message__text\">\n @let validationError = _validationError();\n @if (validationError) {\n @let messageString = _getValidationErrorMessage(validationError.message);\n {{ messageString }}\n }\n</div>\n@if (suffixes().length) {\n <div class=\"ids-message__suffix\">\n <ng-content select=\"[idsMessageSuffix]\" />\n </div>\n}\n", dependencies: [{ kind: "component", type: IdsIconComponent, selector: "ids-icon", inputs: ["size", "sizeCollection", "variant", "fontIcon", "svgIcon", "aria-hidden"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
680
484
|
}
|
|
681
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
485
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsErrorMessageComponent, decorators: [{
|
|
682
486
|
type: Component,
|
|
683
487
|
args: [{ selector: 'ids-error-message', imports: [IdsIconComponent], hostDirectives: [IdsMessageDirective], encapsulation: ViewEncapsulation.None, template: "<div class=\"ids-message__prefix\">\n <ng-content select=\"[idsMessagePrefix]\">\n <ids-icon aria-hidden=\"true\" fontIcon=\"alert-circle-outline\" variant=\"error\" />\n </ng-content>\n</div>\n<div class=\"ids-message__text\">\n @let validationError = _validationError();\n @if (validationError) {\n @let messageString = _getValidationErrorMessage(validationError.message);\n {{ messageString }}\n }\n</div>\n@if (suffixes().length) {\n <div class=\"ids-message__suffix\">\n <ng-content select=\"[idsMessageSuffix]\" />\n </div>\n}\n" }]
|
|
684
|
-
}], ctorParameters: () => [] });
|
|
488
|
+
}], ctorParameters: () => [], propDecorators: { _errorDefDirs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsErrorDefinitionDirective), { isSignal: true }] }], suffixes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsMessageSuffixDirective), { isSignal: true }] }] } });
|
|
685
489
|
|
|
686
490
|
class IdsMessagePrefixDirective {
|
|
687
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
688
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
491
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsMessagePrefixDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
492
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.5", type: IdsMessagePrefixDirective, isStandalone: true, selector: "[idsMessagePrefix]", ngImport: i0 }); }
|
|
689
493
|
}
|
|
690
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
494
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsMessagePrefixDirective, decorators: [{
|
|
691
495
|
type: Directive,
|
|
692
496
|
args: [{
|
|
693
497
|
selector: '[idsMessagePrefix]',
|
|
@@ -697,13 +501,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
|
|
|
697
501
|
|
|
698
502
|
class IdsHintMessageComponent {
|
|
699
503
|
constructor() {
|
|
700
|
-
this.prefixes = contentChildren(IdsMessagePrefixDirective, ...(ngDevMode ? [{ debugName: "prefixes" }] : []));
|
|
701
|
-
this.suffixes = contentChildren(IdsMessageSuffixDirective, ...(ngDevMode ? [{ debugName: "suffixes" }] : []));
|
|
504
|
+
this.prefixes = contentChildren(IdsMessagePrefixDirective, ...(ngDevMode ? [{ debugName: "prefixes" }] : /* istanbul ignore next */ []));
|
|
505
|
+
this.suffixes = contentChildren(IdsMessageSuffixDirective, ...(ngDevMode ? [{ debugName: "suffixes" }] : /* istanbul ignore next */ []));
|
|
702
506
|
}
|
|
703
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
704
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
507
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsHintMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
508
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: IdsHintMessageComponent, isStandalone: true, selector: "ids-hint-message", host: { classAttribute: "ids-hint-message" }, queries: [{ propertyName: "prefixes", predicate: IdsMessagePrefixDirective, isSignal: true }, { propertyName: "suffixes", predicate: IdsMessageSuffixDirective, isSignal: true }], hostDirectives: [{ directive: IdsMessageDirective, inputs: ["size", "size", "variant", "variant"] }], ngImport: i0, template: "@if (prefixes().length) {\n <div class=\"ids-message__prefix\">\n <ng-content select=\"[idsMessagePrefix]\" />\n </div>\n}\n<div class=\"ids-message__text\">\n <ng-content />\n</div>\n@if (suffixes().length) {\n <div class=\"ids-message__suffix\">\n <ng-content select=\"[idsMessageSuffix]\" />\n </div>\n}\n", encapsulation: i0.ViewEncapsulation.None }); }
|
|
705
509
|
}
|
|
706
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsHintMessageComponent, decorators: [{
|
|
707
511
|
type: Component,
|
|
708
512
|
args: [{ selector: 'ids-hint-message', imports: [], host: {
|
|
709
513
|
class: 'ids-hint-message',
|
|
@@ -716,26 +520,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
|
|
|
716
520
|
],
|
|
717
521
|
},
|
|
718
522
|
], encapsulation: ViewEncapsulation.None, template: "@if (prefixes().length) {\n <div class=\"ids-message__prefix\">\n <ng-content select=\"[idsMessagePrefix]\" />\n </div>\n}\n<div class=\"ids-message__text\">\n <ng-content />\n</div>\n@if (suffixes().length) {\n <div class=\"ids-message__suffix\">\n <ng-content select=\"[idsMessageSuffix]\" />\n </div>\n}\n" }]
|
|
719
|
-
}] });
|
|
523
|
+
}], propDecorators: { prefixes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsMessagePrefixDirective), { isSignal: true }] }], suffixes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsMessageSuffixDirective), { isSignal: true }] }] } });
|
|
720
524
|
|
|
721
525
|
class IdsSuccessMessageComponent extends ComponentBase {
|
|
722
526
|
constructor() {
|
|
723
527
|
super(...arguments);
|
|
724
528
|
this._parent = inject(IDS_MESSAGE_PARENT_FORM_FIELD, { skipSelf: true, optional: true });
|
|
725
|
-
this._isDisabled = computed(() => this._parent?.disabled() ?? false, ...(ngDevMode ? [{ debugName: "_isDisabled" }] : []));
|
|
726
|
-
this._hostClasses = computed(() => this._getHostClasses([]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
|
|
727
|
-
this.suffixes = contentChildren(IdsMessageSuffixDirective, ...(ngDevMode ? [{ debugName: "suffixes" }] : []));
|
|
529
|
+
this._isDisabled = computed(() => this._parent?.disabled() ?? false, ...(ngDevMode ? [{ debugName: "_isDisabled" }] : /* istanbul ignore next */ []));
|
|
530
|
+
this._hostClasses = computed(() => this._getHostClasses([]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : /* istanbul ignore next */ []));
|
|
531
|
+
this.suffixes = contentChildren(IdsMessageSuffixDirective, ...(ngDevMode ? [{ debugName: "suffixes" }] : /* istanbul ignore next */ []));
|
|
728
532
|
}
|
|
729
533
|
get _hostName() {
|
|
730
534
|
return 'success-message';
|
|
731
535
|
}
|
|
732
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
733
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
536
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsSuccessMessageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
537
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: IdsSuccessMessageComponent, isStandalone: true, selector: "ids-success-message", queries: [{ propertyName: "suffixes", predicate: IdsMessageSuffixDirective, isSignal: true }], usesInheritance: true, hostDirectives: [{ directive: IdsMessageDirective }], ngImport: i0, template: "<div class=\"ids-message__prefix\">\n <ng-content select=\"[idsMessagePrefix]\">\n @if (_isDisabled()) {\n <ids-icon aria-hidden=\"true\" fontIcon=\"done\" />\n } @else {\n <ids-icon aria-hidden=\"true\" fontIcon=\"done\" variant=\"success\" />\n } </ng-content>\n</div>\n<div class=\"ids-message__text\">\n <ng-content />\n</div>\n@if (suffixes().length) {\n <div class=\"ids-message__suffix\">\n <ng-content select=\"[idsMessageSuffix]\" />\n </div>\n}\n", dependencies: [{ kind: "component", type: IdsIconComponent, selector: "ids-icon", inputs: ["size", "sizeCollection", "variant", "fontIcon", "svgIcon", "aria-hidden"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
734
538
|
}
|
|
735
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
539
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsSuccessMessageComponent, decorators: [{
|
|
736
540
|
type: Component,
|
|
737
541
|
args: [{ selector: 'ids-success-message', imports: [IdsIconComponent], hostDirectives: [IdsMessageDirective], encapsulation: ViewEncapsulation.None, template: "<div class=\"ids-message__prefix\">\n <ng-content select=\"[idsMessagePrefix]\">\n @if (_isDisabled()) {\n <ids-icon aria-hidden=\"true\" fontIcon=\"done\" />\n } @else {\n <ids-icon aria-hidden=\"true\" fontIcon=\"done\" variant=\"success\" />\n } </ng-content>\n</div>\n<div class=\"ids-message__text\">\n <ng-content />\n</div>\n@if (suffixes().length) {\n <div class=\"ids-message__suffix\">\n <ng-content select=\"[idsMessageSuffix]\" />\n </div>\n}\n" }]
|
|
738
|
-
}] });
|
|
542
|
+
}], propDecorators: { suffixes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsMessageSuffixDirective), { isSignal: true }] }] } });
|
|
739
543
|
|
|
740
544
|
const defaultConfig$2 = IDS_FORM_FIELD_DEFAULT_CONFIG_FACTORY();
|
|
741
545
|
class IdsFormFieldComponent extends ComponentBaseWithDefaults {
|
|
@@ -746,34 +550,34 @@ class IdsFormFieldComponent extends ComponentBaseWithDefaults {
|
|
|
746
550
|
this._defaultConfig = this._getDefaultConfig(defaultConfig$2, IDS_FORM_FIELD_DEFAULT_CONFIG);
|
|
747
551
|
this._fieldWrapper = viewChild.required('fieldWrapper');
|
|
748
552
|
this._child = contentChild.required(IDS_FORM_FIELD_CONTROL);
|
|
749
|
-
this._hintMessages = contentChildren(IdsHintMessageComponent, ...(ngDevMode ?
|
|
750
|
-
this._successMessages = contentChildren(IdsSuccessMessageComponent, ...(ngDevMode ?
|
|
751
|
-
this._errorMessages = contentChildren(IdsErrorMessageComponent, ...(ngDevMode ?
|
|
752
|
-
this._actions = contentChildren(IdsFormFieldActionDirective, ...(ngDevMode ? [{ debugName: "_actions" }] : []));
|
|
753
|
-
this._prefixes = contentChildren(IdsPrefixDirective, ...(ngDevMode ? [{ debugName: "_prefixes" }] : []));
|
|
754
|
-
this._suffixes = contentChildren(IdsSuffixDirective, ...(ngDevMode ? [{ debugName: "_suffixes" }] : []));
|
|
755
|
-
this._hasActions = computed(() => Boolean(this._actions().length), ...(ngDevMode ? [{ debugName: "_hasActions" }] : []));
|
|
756
|
-
this._hasLeadingIcon = computed(() => Boolean(this._prefixes().filter((prefix) => prefix.isLeadingIcon).length), ...(ngDevMode ? [{ debugName: "_hasLeadingIcon" }] : []));
|
|
757
|
-
this._hasPrefix = computed(() => Boolean(this._prefixes().filter((prefix) => !prefix.isLeadingIcon).length), ...(ngDevMode ? [{ debugName: "_hasPrefix" }] : []));
|
|
758
|
-
this._hasSuffix = computed(() => Boolean(this._suffixes().filter((suffix) => !suffix.isTrailingIcon).length), ...(ngDevMode ? [{ debugName: "_hasSuffix" }] : []));
|
|
759
|
-
this._hasTrailingIcon = computed(() => Boolean(this._suffixes().filter((suffix) => suffix.isTrailingIcon).length), ...(ngDevMode ? [{ debugName: "_hasTrailingIcon" }] : []));
|
|
760
|
-
this._inputId = computed(() => this._child()?.id(), ...(ngDevMode ? [{ debugName: "_inputId" }] : []));
|
|
761
|
-
this.size = input(this._defaultConfig.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
762
|
-
this.variant = input(this._defaultConfig.variant, ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
763
|
-
this.parentOrSelfSize = computed(() => this._parentFieldset?.size() ?? this.size(), ...(ngDevMode ? [{ debugName: "parentOrSelfSize" }] : []));
|
|
764
|
-
this.parentOrSelfVariant = computed(() => this._parentFieldset?.variant() ?? this.variant(), ...(ngDevMode ? [{ debugName: "parentOrSelfVariant" }] : []));
|
|
765
|
-
this.controlDir = computed(() => this._child().ngControl(), ...(ngDevMode ? [{ debugName: "controlDir" }] : []));
|
|
766
|
-
this.disabled = computed(() => Boolean(this._child().disabled()), ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
767
|
-
this.readonly = computed(() => Boolean(this._child().readonly()), ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
768
|
-
this._hasErrorState = computed(() => Boolean(this._child().hasErrorState()), ...(ngDevMode ? [{ debugName: "_hasErrorState" }] : []));
|
|
769
|
-
this._hasSuccessState = computed(() => Boolean(this._child().hasSuccessState()), ...(ngDevMode ? [{ debugName: "_hasSuccessState" }] : []));
|
|
553
|
+
this._hintMessages = contentChildren(IdsHintMessageComponent, { ...(ngDevMode ? { debugName: "_hintMessages" } : /* istanbul ignore next */ {}), descendants: true });
|
|
554
|
+
this._successMessages = contentChildren(IdsSuccessMessageComponent, { ...(ngDevMode ? { debugName: "_successMessages" } : /* istanbul ignore next */ {}), descendants: true });
|
|
555
|
+
this._errorMessages = contentChildren(IdsErrorMessageComponent, { ...(ngDevMode ? { debugName: "_errorMessages" } : /* istanbul ignore next */ {}), descendants: true });
|
|
556
|
+
this._actions = contentChildren(IdsFormFieldActionDirective, ...(ngDevMode ? [{ debugName: "_actions" }] : /* istanbul ignore next */ []));
|
|
557
|
+
this._prefixes = contentChildren(IdsPrefixDirective, ...(ngDevMode ? [{ debugName: "_prefixes" }] : /* istanbul ignore next */ []));
|
|
558
|
+
this._suffixes = contentChildren(IdsSuffixDirective, ...(ngDevMode ? [{ debugName: "_suffixes" }] : /* istanbul ignore next */ []));
|
|
559
|
+
this._hasActions = computed(() => Boolean(this._actions().length), ...(ngDevMode ? [{ debugName: "_hasActions" }] : /* istanbul ignore next */ []));
|
|
560
|
+
this._hasLeadingIcon = computed(() => Boolean(this._prefixes().filter((prefix) => prefix.isLeadingIcon).length), ...(ngDevMode ? [{ debugName: "_hasLeadingIcon" }] : /* istanbul ignore next */ []));
|
|
561
|
+
this._hasPrefix = computed(() => Boolean(this._prefixes().filter((prefix) => !prefix.isLeadingIcon).length), ...(ngDevMode ? [{ debugName: "_hasPrefix" }] : /* istanbul ignore next */ []));
|
|
562
|
+
this._hasSuffix = computed(() => Boolean(this._suffixes().filter((suffix) => !suffix.isTrailingIcon).length), ...(ngDevMode ? [{ debugName: "_hasSuffix" }] : /* istanbul ignore next */ []));
|
|
563
|
+
this._hasTrailingIcon = computed(() => Boolean(this._suffixes().filter((suffix) => suffix.isTrailingIcon).length), ...(ngDevMode ? [{ debugName: "_hasTrailingIcon" }] : /* istanbul ignore next */ []));
|
|
564
|
+
this._inputId = computed(() => this._child()?.id(), ...(ngDevMode ? [{ debugName: "_inputId" }] : /* istanbul ignore next */ []));
|
|
565
|
+
this.size = input(this._defaultConfig.size, ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
566
|
+
this.variant = input(this._defaultConfig.variant, ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
567
|
+
this.parentOrSelfSize = computed(() => this._parentFieldset?.size() ?? this.size(), ...(ngDevMode ? [{ debugName: "parentOrSelfSize" }] : /* istanbul ignore next */ []));
|
|
568
|
+
this.parentOrSelfVariant = computed(() => this._parentFieldset?.variant() ?? this.variant(), ...(ngDevMode ? [{ debugName: "parentOrSelfVariant" }] : /* istanbul ignore next */ []));
|
|
569
|
+
this.controlDir = computed(() => this._child().ngControl(), ...(ngDevMode ? [{ debugName: "controlDir" }] : /* istanbul ignore next */ []));
|
|
570
|
+
this.disabled = computed(() => Boolean(this._child().disabled()), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
571
|
+
this.readonly = computed(() => Boolean(this._child().readonly()), ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
572
|
+
this._hasErrorState = computed(() => Boolean(this._child().hasErrorState()), ...(ngDevMode ? [{ debugName: "_hasErrorState" }] : /* istanbul ignore next */ []));
|
|
573
|
+
this._hasSuccessState = computed(() => Boolean(this._child().hasSuccessState()), ...(ngDevMode ? [{ debugName: "_hasSuccessState" }] : /* istanbul ignore next */ []));
|
|
770
574
|
this._hostClasses = computed(() => this._getHostClasses([
|
|
771
575
|
this.parentOrSelfSize(),
|
|
772
576
|
this.parentOrSelfVariant(),
|
|
773
577
|
this.disabled() ? 'disabled' : null,
|
|
774
578
|
this._hasErrorState() ? 'invalid' : null,
|
|
775
579
|
this._hasSuccessState() ? 'valid' : null,
|
|
776
|
-
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
|
|
580
|
+
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : /* istanbul ignore next */ []));
|
|
777
581
|
this._displayedMessages = computed(() => {
|
|
778
582
|
if (this._errorMessages().length > 0 && this._hasErrorState()) {
|
|
779
583
|
return 'error';
|
|
@@ -785,7 +589,7 @@ class IdsFormFieldComponent extends ComponentBaseWithDefaults {
|
|
|
785
589
|
return 'hint';
|
|
786
590
|
}
|
|
787
591
|
return undefined;
|
|
788
|
-
}, ...(ngDevMode ? [{ debugName: "_displayedMessages" }] : []));
|
|
592
|
+
}, ...(ngDevMode ? [{ debugName: "_displayedMessages" }] : /* istanbul ignore next */ []));
|
|
789
593
|
this.hasRequiredValidator = computed(() => {
|
|
790
594
|
const control = this.controlDir()?.control;
|
|
791
595
|
return this._child().required()
|
|
@@ -794,7 +598,7 @@ class IdsFormFieldComponent extends ComponentBaseWithDefaults {
|
|
|
794
598
|
|| control?.hasValidator(IdsValidators.required)
|
|
795
599
|
|| control?.hasValidator(IdsValidators.requiredTrue)
|
|
796
600
|
|| control?.hasValidator(IdsValidators.requiredFalse);
|
|
797
|
-
}, ...(ngDevMode ? [{ debugName: "hasRequiredValidator" }] : []));
|
|
601
|
+
}, ...(ngDevMode ? [{ debugName: "hasRequiredValidator" }] : /* istanbul ignore next */ []));
|
|
798
602
|
}
|
|
799
603
|
get _hostName() {
|
|
800
604
|
return 'form-field';
|
|
@@ -808,261 +612,273 @@ class IdsFormFieldComponent extends ComponentBaseWithDefaults {
|
|
|
808
612
|
containerClick(event);
|
|
809
613
|
}
|
|
810
614
|
}
|
|
811
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
812
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
615
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFormFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
616
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: IdsFormFieldComponent, isStandalone: true, selector: "ids-form-field", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "_child", first: true, predicate: IDS_FORM_FIELD_CONTROL, descendants: true, isSignal: true }, { propertyName: "_hintMessages", predicate: IdsHintMessageComponent, descendants: true, isSignal: true }, { propertyName: "_successMessages", predicate: IdsSuccessMessageComponent, descendants: true, isSignal: true }, { propertyName: "_errorMessages", predicate: IdsErrorMessageComponent, descendants: true, isSignal: true }, { propertyName: "_actions", predicate: IdsFormFieldActionDirective, isSignal: true }, { propertyName: "_prefixes", predicate: IdsPrefixDirective, isSignal: true }, { propertyName: "_suffixes", predicate: IdsSuffixDirective, isSignal: true }], viewQueries: [{ propertyName: "_fieldWrapper", first: true, predicate: ["fieldWrapper"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<label class=\"ids-form-field__label\" [for]=\"_inputId()\">\n @if (hasRequiredValidator()) {\n <span class=\"ids-form-field__required-marker\"></span>\n }\n <ng-content select=\"ids-label\" />\n</label>\n\n<div #fieldWrapper class=\"ids-form-field__field-wrapper\">\n <div class=\"ids-form-field__field-wrapper__container\" (click)=\"containerClick($event)\">\n @if (_hasLeadingIcon()) {\n <div class=\"ids-form-field__leading-icon\">\n <ng-content select=\"ids-icon[idsLeadingIcon]\" />\n </div>\n }\n @if (_hasPrefix()) {\n <div class=\"ids-form-field__prefix\">\n <ng-content select=\"[idsPrefix]\" />\n </div>\n }\n <div class=\"ids-form-field__infix\">\n <ng-content />\n </div>\n @if (_hasSuffix()) {\n <div class=\"ids-form-field__suffix\">\n <ng-content select=\"[idsSuffix]\" />\n </div>\n }\n @if (_hasTrailingIcon()) {\n <div class=\"ids-form-field__trailing-icon\">\n <ng-content select=\"ids-icon[idsTrailingIcon]\" />\n </div>\n }\n </div>\n @if (_hasActions()) {\n <div class=\"ids-form-field__field-wrapper__action\">\n <ng-content select=\"[idsFormFieldAction]\" />\n </div>\n }\n</div>\n\n<div class=\"ids-form-field__subscript-wrapper\">\n @let messages = _displayedMessages();\n @if (messages) {\n <div class=\"ids-form-field__message-container\">\n @switch (messages) {\n @case (\"error\") {\n <ng-content select=\"ids-error-message\" />\n }\n @case (\"success\") {\n <ng-content select=\"ids-success-message\" />\n }\n @case (\"hint\") {\n <ng-content select=\"ids-hint-message\" />\n }\n }\n </div>\n }\n</div>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
813
617
|
}
|
|
814
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
618
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFormFieldComponent, decorators: [{
|
|
815
619
|
type: Component,
|
|
816
620
|
args: [{ selector: 'ids-form-field', imports: [], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<label class=\"ids-form-field__label\" [for]=\"_inputId()\">\n @if (hasRequiredValidator()) {\n <span class=\"ids-form-field__required-marker\"></span>\n }\n <ng-content select=\"ids-label\" />\n</label>\n\n<div #fieldWrapper class=\"ids-form-field__field-wrapper\">\n <div class=\"ids-form-field__field-wrapper__container\" (click)=\"containerClick($event)\">\n @if (_hasLeadingIcon()) {\n <div class=\"ids-form-field__leading-icon\">\n <ng-content select=\"ids-icon[idsLeadingIcon]\" />\n </div>\n }\n @if (_hasPrefix()) {\n <div class=\"ids-form-field__prefix\">\n <ng-content select=\"[idsPrefix]\" />\n </div>\n }\n <div class=\"ids-form-field__infix\">\n <ng-content />\n </div>\n @if (_hasSuffix()) {\n <div class=\"ids-form-field__suffix\">\n <ng-content select=\"[idsSuffix]\" />\n </div>\n }\n @if (_hasTrailingIcon()) {\n <div class=\"ids-form-field__trailing-icon\">\n <ng-content select=\"ids-icon[idsTrailingIcon]\" />\n </div>\n }\n </div>\n @if (_hasActions()) {\n <div class=\"ids-form-field__field-wrapper__action\">\n <ng-content select=\"[idsFormFieldAction]\" />\n </div>\n }\n</div>\n\n<div class=\"ids-form-field__subscript-wrapper\">\n @let messages = _displayedMessages();\n @if (messages) {\n <div class=\"ids-form-field__message-container\">\n @switch (messages) {\n @case (\"error\") {\n <ng-content select=\"ids-error-message\" />\n }\n @case (\"success\") {\n <ng-content select=\"ids-success-message\" />\n }\n @case (\"hint\") {\n <ng-content select=\"ids-hint-message\" />\n }\n }\n </div>\n }\n</div>\n" }]
|
|
817
|
-
}] });
|
|
621
|
+
}], propDecorators: { _fieldWrapper: [{ type: i0.ViewChild, args: ['fieldWrapper', { isSignal: true }] }], _child: [{ type: i0.ContentChild, args: [i0.forwardRef(() => IDS_FORM_FIELD_CONTROL), { isSignal: true }] }], _hintMessages: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsHintMessageComponent), { ...{ descendants: true }, isSignal: true }] }], _successMessages: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsSuccessMessageComponent), { ...{ descendants: true }, isSignal: true }] }], _errorMessages: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsErrorMessageComponent), { ...{ descendants: true }, isSignal: true }] }], _actions: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsFormFieldActionDirective), { isSignal: true }] }], _prefixes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsPrefixDirective), { isSignal: true }] }], _suffixes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsSuffixDirective), { isSignal: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }] } });
|
|
818
622
|
|
|
819
|
-
const
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
623
|
+
const IDS_OPTION_GROUP = new InjectionToken('IdsOptionGroup');
|
|
624
|
+
|
|
625
|
+
const IDS_OPTION_PARENT_COMPONENT = new InjectionToken('IDS_OPTION_PARENT_COMPONENT');
|
|
626
|
+
|
|
627
|
+
class IdsOptionSelectionChange {
|
|
628
|
+
constructor(source, selected, isUserInput = false) {
|
|
629
|
+
this.source = source;
|
|
630
|
+
this.selected = selected;
|
|
631
|
+
this.isUserInput = isUserInput;
|
|
632
|
+
}
|
|
828
633
|
}
|
|
829
634
|
|
|
830
|
-
const
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
'
|
|
834
|
-
'
|
|
835
|
-
'
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
'reset',
|
|
840
|
-
'submit',
|
|
841
|
-
];
|
|
842
|
-
class IdsInputDirective extends IdsFormFieldControl {
|
|
635
|
+
const IDS_PSEUDO_CHECKBOX_PARENT = new InjectionToken('IDS_PSEUDO_CHECKBOX_PARENT');
|
|
636
|
+
|
|
637
|
+
const IdsPseudoCheckboxState = {
|
|
638
|
+
UNCHECKED: 'unchecked',
|
|
639
|
+
CHECKED: 'checked',
|
|
640
|
+
INDETERMINATE: 'indeterminate',
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
class PseudoCheckboxComponent extends ComponentBase {
|
|
843
644
|
constructor() {
|
|
844
645
|
super(...arguments);
|
|
845
|
-
this.
|
|
846
|
-
this.
|
|
847
|
-
this.
|
|
848
|
-
this.
|
|
849
|
-
this.
|
|
850
|
-
this.
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
}, ...(ngDevMode ? [{ debugName: "_validateTypeEffect" }] : []));
|
|
856
|
-
/**
|
|
857
|
-
* Should be an arrow function in order to handle `this` outside of this class
|
|
858
|
-
*/
|
|
859
|
-
this.onContainerClick = () => {
|
|
860
|
-
if (!this._focused && !this.readonly() && !this.disabled) {
|
|
861
|
-
this.focus();
|
|
862
|
-
}
|
|
863
|
-
};
|
|
646
|
+
this._parent = inject(IDS_PSEUDO_CHECKBOX_PARENT, { optional: true });
|
|
647
|
+
this.checkboxState = input(IdsPseudoCheckboxState.UNCHECKED, ...(ngDevMode ? [{ debugName: "checkboxState" }] : /* istanbul ignore next */ []));
|
|
648
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanAttribute });
|
|
649
|
+
this._isChecked = computed(() => this.checkboxState() === IdsPseudoCheckboxState.CHECKED, ...(ngDevMode ? [{ debugName: "_isChecked" }] : /* istanbul ignore next */ []));
|
|
650
|
+
this._isIndeterminate = computed(() => this.checkboxState() === IdsPseudoCheckboxState.INDETERMINATE, ...(ngDevMode ? [{ debugName: "_isIndeterminate" }] : /* istanbul ignore next */ []));
|
|
651
|
+
this._hostClasses = computed(() => this._getHostClasses([
|
|
652
|
+
this._parent?.embeddedPseudoCheckboxSize(),
|
|
653
|
+
this._parent?.embeddedPseudoCheckboxVariant(),
|
|
654
|
+
this.disabled() ? 'disabled' : null,
|
|
655
|
+
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : /* istanbul ignore next */ []));
|
|
864
656
|
}
|
|
865
657
|
get _hostName() {
|
|
866
|
-
return '
|
|
658
|
+
return 'pseudo-checkbox';
|
|
867
659
|
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
660
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: PseudoCheckboxComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
661
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: PseudoCheckboxComponent, isStandalone: true, selector: "ids-pseudo-checkbox", inputs: { checkboxState: { classPropertyName: "checkboxState", publicName: "checkboxState", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<div class=\"ids-pseudo-checkbox__input-wrapper\">\n <input\n type=\"checkbox\"\n [disabled]=\"disabled()\"\n [attr.aria-checked]=\"_isIndeterminate() ? 'mixed' : null\"\n [checked]=\"_isChecked()\"\n [indeterminate]=\"_isIndeterminate()\"\n (change)=\"$event.stopPropagation()\"\n />\n <div class=\"ids-pseudo-checkbox__icon\" aria-hidden=\"true\">\n @if (_isIndeterminate()) {\n <ids-icon fontIcon=\"remove\" aria-hidden=\"true\" />\n }\n @if (_isChecked()) {\n <ids-icon fontIcon=\"done\" aria-hidden=\"true\" />\n }\n </div>\n</div>\n", dependencies: [{ kind: "component", type: IdsIconComponent, selector: "ids-icon", inputs: ["size", "sizeCollection", "variant", "fontIcon", "svgIcon", "aria-hidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
662
|
+
}
|
|
663
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: PseudoCheckboxComponent, decorators: [{
|
|
664
|
+
type: Component,
|
|
665
|
+
args: [{ selector: 'ids-pseudo-checkbox', imports: [IdsIconComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ids-pseudo-checkbox__input-wrapper\">\n <input\n type=\"checkbox\"\n [disabled]=\"disabled()\"\n [attr.aria-checked]=\"_isIndeterminate() ? 'mixed' : null\"\n [checked]=\"_isChecked()\"\n [indeterminate]=\"_isIndeterminate()\"\n (change)=\"$event.stopPropagation()\"\n />\n <div class=\"ids-pseudo-checkbox__icon\" aria-hidden=\"true\">\n @if (_isIndeterminate()) {\n <ids-icon fontIcon=\"remove\" aria-hidden=\"true\" />\n }\n @if (_isChecked()) {\n <ids-icon fontIcon=\"done\" aria-hidden=\"true\" />\n }\n </div>\n</div>\n" }]
|
|
666
|
+
}], propDecorators: { checkboxState: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkboxState", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
667
|
+
|
|
668
|
+
class IdsOptionComponent extends ComponentBase {
|
|
669
|
+
get _hostName() {
|
|
670
|
+
return 'option';
|
|
671
|
+
}
|
|
672
|
+
constructor() {
|
|
673
|
+
super();
|
|
674
|
+
this._parent = inject(IDS_OPTION_PARENT_COMPONENT);
|
|
675
|
+
this._element = inject(ElementRef);
|
|
676
|
+
this.group = inject(IDS_OPTION_GROUP, { optional: true });
|
|
677
|
+
this._textElement = viewChild.required('text');
|
|
678
|
+
this.selected = signal(false, ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
679
|
+
this._active = signal(false, ...(ngDevMode ? [{ debugName: "_active" }] : /* istanbul ignore next */ []));
|
|
680
|
+
this.size = computed(() => this._parent.parentSize(), ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
681
|
+
this.variant = computed(() => this._parent.parentVariant(), ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
682
|
+
this.value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
683
|
+
this.explicitViewValue = input(null, { ...(ngDevMode ? { debugName: "explicitViewValue" } : /* istanbul ignore next */ {}), alias: 'viewValue' });
|
|
684
|
+
this.disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: coerceBooleanAttribute });
|
|
685
|
+
this.disabled = false; // Do not delete this class member, until ListKeyManagerOption requires: `disabled: boolean`
|
|
686
|
+
this._groupOrOptionIsDisabled = computed(() => this.group?.disabled() || this.disabledInput(), ...(ngDevMode ? [{ debugName: "_groupOrOptionIsDisabled" }] : /* istanbul ignore next */ []));
|
|
687
|
+
this._multiSelect = Boolean(this._parent?.multiSelect());
|
|
688
|
+
// eslint-disable-next-line @angular-eslint/no-output-on-prefix
|
|
689
|
+
this.onSelectionChange = output();
|
|
690
|
+
this.viewValue = computed(() => this.explicitViewValue() || this._textElement().nativeElement.textContent || '', ...(ngDevMode ? [{ debugName: "viewValue" }] : /* istanbul ignore next */ []));
|
|
691
|
+
this._hostClasses = computed(() => this._getHostClasses([
|
|
692
|
+
this.selected() ? 'selected' : null,
|
|
693
|
+
this._active() ? 'active' : null,
|
|
694
|
+
this._groupOrOptionIsDisabled() ? 'disabled' : null,
|
|
695
|
+
this._multiSelect ? 'multiselect' : null,
|
|
696
|
+
this.size(),
|
|
697
|
+
this.variant(),
|
|
698
|
+
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : /* istanbul ignore next */ []));
|
|
699
|
+
this._pseudoCheckboxState = computed(() => (this.selected() ? IdsPseudoCheckboxState.CHECKED : IdsPseudoCheckboxState.UNCHECKED), ...(ngDevMode ? [{ debugName: "_pseudoCheckboxState" }] : /* istanbul ignore next */ []));
|
|
700
|
+
this.embeddedPseudoCheckboxSize = computed(() => this.size(), ...(ngDevMode ? [{ debugName: "embeddedPseudoCheckboxSize" }] : /* istanbul ignore next */ []));
|
|
701
|
+
this.embeddedPseudoCheckboxVariant = signal(IdsFormFieldVariant.SURFACE, ...(ngDevMode ? [{ debugName: "embeddedPseudoCheckboxVariant" }] : /* istanbul ignore next */ []));
|
|
702
|
+
effect(() => {
|
|
703
|
+
this.disabled = this.disabledInput();
|
|
875
704
|
});
|
|
876
705
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
706
|
+
ngOnInit() {
|
|
707
|
+
const parent = this._parent;
|
|
708
|
+
if (parent.isOptionPreSelectedByValue(this.value())) {
|
|
709
|
+
this.selected.set(true);
|
|
880
710
|
}
|
|
881
711
|
}
|
|
882
|
-
|
|
883
|
-
|
|
712
|
+
_handleKeydown(event) {
|
|
713
|
+
if ((event.key === 'ENTER' || event.key === ' ') && !hasModifierKey(event)) {
|
|
714
|
+
this.selectViaInteraction();
|
|
715
|
+
event.preventDefault();
|
|
716
|
+
}
|
|
884
717
|
}
|
|
885
|
-
|
|
886
|
-
if (
|
|
887
|
-
this.
|
|
718
|
+
selectViaInteraction() {
|
|
719
|
+
if (!this._groupOrOptionIsDisabled()) {
|
|
720
|
+
this._emitSelectionChangeEvent(!this.selected(), true);
|
|
888
721
|
}
|
|
889
722
|
}
|
|
890
|
-
|
|
891
|
-
this.
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
723
|
+
getHostElement() {
|
|
724
|
+
return this._element.nativeElement;
|
|
725
|
+
}
|
|
726
|
+
select(emitEvent = true) {
|
|
727
|
+
if (!this.selected()) {
|
|
728
|
+
if (emitEvent) {
|
|
729
|
+
this._emitSelectionChangeEvent(true);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
deselect(emitEvent = true) {
|
|
734
|
+
if (this.selected()) {
|
|
735
|
+
if (emitEvent) {
|
|
736
|
+
this._emitSelectionChangeEvent(false);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
focus(_origin, options) {
|
|
741
|
+
const element = this._element.nativeElement;
|
|
742
|
+
if (typeof element.focus === 'function') {
|
|
743
|
+
element.focus(options);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
setActiveStyles() {
|
|
747
|
+
if (!this._active()) {
|
|
748
|
+
this._active.set(true);
|
|
895
749
|
}
|
|
896
750
|
}
|
|
897
|
-
|
|
898
|
-
|
|
751
|
+
setInactiveStyles() {
|
|
752
|
+
if (this._active()) {
|
|
753
|
+
this._active.set(false);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
getLabel() {
|
|
757
|
+
return this.viewValue();
|
|
758
|
+
}
|
|
759
|
+
_emitSelectionChangeEvent(selected, isUserInput = false) {
|
|
760
|
+
if (this._multiSelect || !this.selected()) {
|
|
761
|
+
this.onSelectionChange.emit(new IdsOptionSelectionChange(this, selected, isUserInput));
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
765
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: IdsOptionComponent, isStandalone: true, selector: "ids-option", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, explicitViewValue: { classPropertyName: "explicitViewValue", publicName: "viewValue", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSelectionChange: "onSelectionChange" }, host: { attributes: { "role": "option" }, listeners: { "click": "selectViaInteraction()", "keydown": "_handleKeydown($event)" }, properties: { "attr.aria-selected": "selected()", "attr.aria-disabled": "disabled.toString()" } }, providers: [
|
|
899
766
|
{
|
|
900
|
-
provide:
|
|
901
|
-
useExisting:
|
|
767
|
+
provide: IDS_PSEUDO_CHECKBOX_PARENT,
|
|
768
|
+
useExisting: IdsOptionComponent,
|
|
902
769
|
},
|
|
903
|
-
],
|
|
770
|
+
], viewQueries: [{ propertyName: "_textElement", first: true, predicate: ["text"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (_multiSelect) {\n <ids-pseudo-checkbox aria-hidden=\"true\" [disabled]=\"_groupOrOptionIsDisabled()\" [checkboxState]=\"_pseudoCheckboxState()\" />\n}\n\n<div #text class=\"ids-option__text\"><ng-content /></div>\n\n@if (!_multiSelect && selected()) {\n <ids-icon fontIcon=\"done\" />\n}\n", dependencies: [{ kind: "component", type: IdsIconComponent, selector: "ids-icon", inputs: ["size", "sizeCollection", "variant", "fontIcon", "svgIcon", "aria-hidden"] }, { kind: "component", type: PseudoCheckboxComponent, selector: "ids-pseudo-checkbox", inputs: ["checkboxState", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
904
771
|
}
|
|
905
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
906
|
-
type:
|
|
907
|
-
args: [{
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
textarea[idsInput][ngModel]:not([formControl]):not([formControlName]),
|
|
912
|
-
textarea[idsInput][formControl]:not([ngModel]):not([formControlName]),
|
|
913
|
-
textarea[idsInput][formControlName]:not([ngModel]):not([formControl])`,
|
|
914
|
-
exportAs: 'idsInput',
|
|
915
|
-
standalone: true,
|
|
916
|
-
providers: [
|
|
772
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsOptionComponent, decorators: [{
|
|
773
|
+
type: Component,
|
|
774
|
+
args: [{ selector: 'ids-option', imports: [
|
|
775
|
+
IdsIconComponent,
|
|
776
|
+
PseudoCheckboxComponent,
|
|
777
|
+
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
917
778
|
{
|
|
918
|
-
provide:
|
|
919
|
-
useExisting:
|
|
779
|
+
provide: IDS_PSEUDO_CHECKBOX_PARENT,
|
|
780
|
+
useExisting: IdsOptionComponent,
|
|
920
781
|
},
|
|
921
|
-
],
|
|
922
|
-
|
|
923
|
-
'[attr.
|
|
924
|
-
'[attr.disabled]': 'disabled()
|
|
925
|
-
'
|
|
926
|
-
'(
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
782
|
+
], host: {
|
|
783
|
+
'role': 'option',
|
|
784
|
+
'[attr.aria-selected]': 'selected()',
|
|
785
|
+
'[attr.aria-disabled]': 'disabled.toString()',
|
|
786
|
+
'(click)': 'selectViaInteraction()',
|
|
787
|
+
'(keydown)': '_handleKeydown($event)',
|
|
788
|
+
}, template: "@if (_multiSelect) {\n <ids-pseudo-checkbox aria-hidden=\"true\" [disabled]=\"_groupOrOptionIsDisabled()\" [checkboxState]=\"_pseudoCheckboxState()\" />\n}\n\n<div #text class=\"ids-option__text\"><ng-content /></div>\n\n@if (!_multiSelect && selected()) {\n <ids-icon fontIcon=\"done\" />\n}\n" }]
|
|
789
|
+
}], ctorParameters: () => [], propDecorators: { _textElement: [{ type: i0.ViewChild, args: ['text', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], explicitViewValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewValue", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], onSelectionChange: [{ type: i0.Output, args: ["onSelectionChange"] }] } });
|
|
790
|
+
function _countGroupLabelsBeforeOption(optionIndex, options, optionGroups) {
|
|
791
|
+
if (optionGroups.length) {
|
|
792
|
+
let groupCounter = 0;
|
|
793
|
+
for (let i = 0; i < optionIndex + 1; i++) {
|
|
794
|
+
if (options[i].group && options[i].group === optionGroups[groupCounter]) {
|
|
795
|
+
groupCounter++;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
return groupCounter;
|
|
799
|
+
}
|
|
800
|
+
return 0;
|
|
801
|
+
}
|
|
802
|
+
function _getOptionScrollPosition(optionOffset, optionHeight, currentScrollPosition, panelHeight) {
|
|
803
|
+
if (optionOffset < currentScrollPosition) {
|
|
804
|
+
return optionOffset;
|
|
805
|
+
}
|
|
806
|
+
if (optionOffset + optionHeight > currentScrollPosition + panelHeight) {
|
|
807
|
+
return Math.max(0, optionOffset - panelHeight + optionHeight);
|
|
808
|
+
}
|
|
809
|
+
return currentScrollPosition;
|
|
810
|
+
}
|
|
931
811
|
|
|
932
|
-
const defaultConfig = IDS_AUTOCOMPLETE_DEFAULT_CONFIG_FACTORY();
|
|
933
|
-
const LIVE_ANNOUNCE_DURATION_MS = 10000;
|
|
812
|
+
const defaultConfig$1 = IDS_AUTOCOMPLETE_DEFAULT_CONFIG_FACTORY();
|
|
934
813
|
class IdsAutocompleteComponent extends IdsFormFieldControl {
|
|
935
814
|
get _hostName() {
|
|
936
815
|
return 'autocomplete';
|
|
937
816
|
}
|
|
938
|
-
get _empty() {
|
|
939
|
-
return Boolean(this._selectionModel?.isEmpty());
|
|
940
|
-
}
|
|
941
|
-
get selected() {
|
|
942
|
-
return this.multiSelect() ? this._selectionModel?.selected : this._selectionModel?.selected?.[0];
|
|
943
|
-
}
|
|
944
|
-
get _triggerValue() {
|
|
945
|
-
if (this._empty) {
|
|
946
|
-
return '';
|
|
947
|
-
}
|
|
948
|
-
if (this.multiSelect()) {
|
|
949
|
-
const selectedOptions = this._selectionModel?.selected;
|
|
950
|
-
return selectedOptions?.join(', ') || '';
|
|
951
|
-
}
|
|
952
|
-
return this._selectionModel?.selected?.[0] || '';
|
|
953
|
-
}
|
|
954
817
|
constructor() {
|
|
955
818
|
super();
|
|
956
|
-
this.
|
|
957
|
-
this.
|
|
958
|
-
this.
|
|
959
|
-
this.
|
|
819
|
+
this.ariaLabel = input('', { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
820
|
+
this.ariaLabelledby = input('', { ...(ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
|
|
821
|
+
this.ariaLabelClear = input('', ...(ngDevMode ? [{ debugName: "ariaLabelClear" }] : /* istanbul ignore next */ []));
|
|
822
|
+
this.ariaLabelLoading = input('', ...(ngDevMode ? [{ debugName: "ariaLabelLoading" }] : /* istanbul ignore next */ []));
|
|
823
|
+
this.multiSelect = input(false, { ...(ngDevMode ? { debugName: "multiSelect" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
824
|
+
this.tabIndex = input(0, { ...(ngDevMode ? { debugName: "tabIndex" } : /* istanbul ignore next */ {}), transform: coerceNumberAttribute });
|
|
825
|
+
this.sortCompareFn = input((a, b) => a.viewValue.localeCompare(b.viewValue), ...(ngDevMode ? [{ debugName: "sortCompareFn" }] : /* istanbul ignore next */ []));
|
|
826
|
+
this.valueCompareFn = input((o1, o2) => JSON.stringify(o1) === JSON.stringify(o2), ...(ngDevMode ? [{ debugName: "valueCompareFn" }] : /* istanbul ignore next */ []));
|
|
827
|
+
this.trigger = input.required(...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
828
|
+
this.panelClasses = input('', ...(ngDevMode ? [{ debugName: "panelClasses" }] : /* istanbul ignore next */ []));
|
|
829
|
+
this.panelOpen = model(false, ...(ngDevMode ? [{ debugName: "panelOpen" }] : /* istanbul ignore next */ []));
|
|
830
|
+
this.options = contentChildren(IdsOptionComponent, { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), descendants: true });
|
|
831
|
+
this.optionGroups = contentChildren(IDS_OPTION_GROUP, { ...(ngDevMode ? { debugName: "optionGroups" } : /* istanbul ignore next */ {}), descendants: true });
|
|
832
|
+
this.overlayPanel = viewChild('overlayPanel', ...(ngDevMode ? [{ debugName: "overlayPanel" }] : /* istanbul ignore next */ []));
|
|
833
|
+
this.panel = viewChild('panel', { ...(ngDevMode ? { debugName: "panel" } : /* istanbul ignore next */ {}), read: (ElementRef) });
|
|
834
|
+
this.appearance = input(IdsIconButtonAppearance.STANDARD, ...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
|
|
835
|
+
this.parentSize = computed(() => this._parentFormField.parentOrSelfSize(), ...(ngDevMode ? [{ debugName: "parentSize" }] : /* istanbul ignore next */ []));
|
|
836
|
+
this.parentVariant = computed(() => this._parentFormField.parentOrSelfVariant(), ...(ngDevMode ? [{ debugName: "parentVariant" }] : /* istanbul ignore next */ []));
|
|
837
|
+
this.spinnerVariant = input(IdsSpinnerVariant.SURFACE, ...(ngDevMode ? [{ debugName: "spinnerVariant" }] : /* istanbul ignore next */ []));
|
|
838
|
+
this.isLoading = input(false, { ...(ngDevMode ? { debugName: "isLoading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
839
|
+
this.onChange = () => { };
|
|
840
|
+
this.onTouched = () => { };
|
|
960
841
|
this._parentFormField = inject(IdsFormFieldComponent);
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
*/
|
|
967
|
-
this.minChars = input(1, ...(ngDevMode ? [{ debugName: "minChars", transform: coerceNumberAttribute }] : [{ transform: coerceNumberAttribute }]));
|
|
968
|
-
/** Max length of options allowed to show. Warning is shown when available options is higher than this number */
|
|
969
|
-
this.maxLength = input(null, ...(ngDevMode ? [{ debugName: "maxLength", transform: coerceNumberAttribute }] : [{ transform: coerceNumberAttribute }]));
|
|
970
|
-
this.multiSelect = input(false, ...(ngDevMode ? [{ debugName: "multiSelect" }] : []));
|
|
971
|
-
this.ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel", alias: 'aria-label' }] : [{ alias: 'aria-label' }]));
|
|
972
|
-
this.ariaLabelledby = input('', ...(ngDevMode ? [{ debugName: "ariaLabelledby", alias: 'aria-labelledby' }] : [{ alias: 'aria-labelledby' }]));
|
|
973
|
-
this.ariaLabelClearButton = input('Clear', ...(ngDevMode ? [{ debugName: "ariaLabelClearButton" }] : []));
|
|
974
|
-
this.ariaLabelToggleButton = input('Toggle', ...(ngDevMode ? [{ debugName: "ariaLabelToggleButton" }] : []));
|
|
975
|
-
this.valueCompareFn = input((o1, o2) => o1 === o2, ...(ngDevMode ? [{ debugName: "valueCompareFn" }] : []));
|
|
976
|
-
this.sortCompareFn = input(...(ngDevMode ? [undefined, { debugName: "sortCompareFn" }] : []));
|
|
977
|
-
this.tabIndex = input(0, ...(ngDevMode ? [{ debugName: "tabIndex", transform: coerceNumberAttribute }] : [{ transform: coerceNumberAttribute }]));
|
|
978
|
-
this.typeaheadDebounceInterval = input(this._defaultConfig.typeaheadDebounceInterval, ...(ngDevMode ? [{ debugName: "typeaheadDebounceInterval", transform: coerceNumberAttribute }] : [{
|
|
979
|
-
transform: coerceNumberAttribute,
|
|
980
|
-
}]));
|
|
981
|
-
this.hintLoading = input(this._defaultConfig.hintLoading, ...(ngDevMode ? [{ debugName: "hintLoading" }] : []));
|
|
982
|
-
this.hintNoResults = input(this._defaultConfig.hintNoResults, ...(ngDevMode ? [{ debugName: "hintNoResults" }] : []));
|
|
983
|
-
this.hintMinChars = input(this._defaultConfig.hintMinChars, ...(ngDevMode ? [{ debugName: "hintMinChars" }] : []));
|
|
984
|
-
this.hintMaxLength = input(this._defaultConfig.hintMaxLength, ...(ngDevMode ? [{ debugName: "hintMaxLength" }] : []));
|
|
985
|
-
this.panelClasses = input('', ...(ngDevMode ? [{ debugName: "panelClasses" }] : []));
|
|
986
|
-
this.parentSize = computed(() => this._parentFormField.parentOrSelfSize(), ...(ngDevMode ? [{ debugName: "parentSize" }] : []));
|
|
987
|
-
this.parentVariant = computed(() => this._parentFormField.parentOrSelfVariant(), ...(ngDevMode ? [{ debugName: "parentVariant" }] : []));
|
|
988
|
-
this.errorStateMatcher = signal(inject(ErrorStateMatcher), ...(ngDevMode ? [{ debugName: "errorStateMatcher" }] : []));
|
|
989
|
-
this.successStateMatcher = signal(inject(SuccessStateMatcher), ...(ngDevMode ? [{ debugName: "successStateMatcher" }] : []));
|
|
990
|
-
this.options = viewChildren(IdsOptionComponent, ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
991
|
-
this.overlayPanel = viewChild.required(IdsOverlayPanelComponent);
|
|
992
|
-
this.onContainerClick = () => { };
|
|
842
|
+
// declarations of IdsFormFieldControl variables
|
|
843
|
+
this._defaultConfig = this._getDefaultConfig(defaultConfig$1, IDS_AUTOCOMPLETE_DEFAULT_CONFIG);
|
|
844
|
+
this.errorStateMatcher = input(inject(this._defaultConfig.errorStateMatcher), ...(ngDevMode ? [{ debugName: "errorStateMatcher" }] : /* istanbul ignore next */ []));
|
|
845
|
+
this.successStateMatcher = input(inject(this._defaultConfig.successStateMatcher), ...(ngDevMode ? [{ debugName: "successStateMatcher" }] : /* istanbul ignore next */ []));
|
|
846
|
+
this._elementRef = inject(ElementRef);
|
|
993
847
|
this._hostClasses = computed(() => this._getHostClasses([
|
|
994
848
|
this.parentSize(),
|
|
995
|
-
this.parentVariant(),
|
|
996
849
|
this.disabled() ? 'disabled' : null,
|
|
997
|
-
|
|
998
|
-
], [formFieldControlClass]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
|
|
850
|
+
], [formFieldControlClass]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : /* istanbul ignore next */ []));
|
|
999
851
|
this._panelClasses = computed(() => [
|
|
1000
|
-
'ids-overlay-
|
|
852
|
+
'ids-autocomplete-overlay-panel',
|
|
1001
853
|
this.panelClasses(),
|
|
1002
|
-
].join(' '), ...(ngDevMode ? [{ debugName: "_panelClasses" }] : []));
|
|
1003
|
-
|
|
1004
|
-
this.
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
this._onChange = () => { };
|
|
1013
|
-
this._onTouched = () => { };
|
|
1014
|
-
this._searchText = model('', ...(ngDevMode ? [{ debugName: "_searchText" }] : []));
|
|
1015
|
-
this._skipPredicate = (option) => {
|
|
1016
|
-
if (this.overlayPanel().open()) {
|
|
1017
|
-
return false;
|
|
854
|
+
].join(' '), ...(ngDevMode ? [{ debugName: "_panelClasses" }] : /* istanbul ignore next */ []));
|
|
855
|
+
// #region IdsFormFieldControl implementation
|
|
856
|
+
this.onContainerClick = (event) => {
|
|
857
|
+
if (!this.readonly() && !this.disabled()) {
|
|
858
|
+
const target = event.target;
|
|
859
|
+
// 'clear' button should not trigger focus on the input
|
|
860
|
+
if (target.parentElement?.tagName === 'BUTTON' || (target.tagName === 'IDS-ICON' && target.parentElement?.tagName === 'BUTTON')) {
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
this.trigger().focus();
|
|
1018
864
|
}
|
|
1019
|
-
return option.disabledInput();
|
|
1020
865
|
};
|
|
1021
866
|
effect(() => {
|
|
1022
|
-
this.
|
|
1023
|
-
});
|
|
1024
|
-
effect(() => {
|
|
1025
|
-
const options = this.options();
|
|
867
|
+
const overlayPanelOpen = this.overlayPanel()?.open() ?? false;
|
|
1026
868
|
untracked(() => {
|
|
1027
|
-
if (
|
|
1028
|
-
this.
|
|
1029
|
-
this.options().forEach((option) => {
|
|
1030
|
-
if (this._selectionModel?.selected.includes(option.viewValue())) {
|
|
1031
|
-
option.selected.set(true);
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
1034
|
-
this._subscribeOptionChanges();
|
|
1035
|
-
}
|
|
1036
|
-
});
|
|
1037
|
-
});
|
|
1038
|
-
effect(() => {
|
|
1039
|
-
const searchText = this._searchText();
|
|
1040
|
-
untracked(() => {
|
|
1041
|
-
const control = this.ngControl()?.control;
|
|
1042
|
-
const controlValue = control?.value;
|
|
1043
|
-
if (controlValue && searchText !== controlValue) {
|
|
1044
|
-
control.setValue(null);
|
|
1045
|
-
this._clearSelection();
|
|
869
|
+
if (!overlayPanelOpen && this.panelOpen()) {
|
|
870
|
+
this.panelOpen.set(false);
|
|
1046
871
|
}
|
|
1047
872
|
});
|
|
1048
873
|
});
|
|
1049
874
|
}
|
|
1050
875
|
ngOnInit() {
|
|
1051
876
|
if (!this._parentFormField) {
|
|
1052
|
-
throw this.
|
|
877
|
+
throw this.createHostError('Select must be in a form field');
|
|
1053
878
|
}
|
|
1054
|
-
this._selectionModel = new SelectionModel(this.multiSelect(), undefined, false, this.valueCompareFn());
|
|
1055
|
-
queueMicrotask(() => {
|
|
1056
|
-
const control = this.ngControl()?.control;
|
|
1057
|
-
if (control) {
|
|
1058
|
-
control.events
|
|
1059
|
-
.pipe(filter((event) => event instanceof ValueChangeEvent), takeUntilDestroyed(this._destroyRef))
|
|
1060
|
-
.subscribe(() => this._changeDetectorRef.markForCheck());
|
|
1061
|
-
}
|
|
1062
|
-
});
|
|
1063
|
-
this._initErrorStateTracker();
|
|
1064
879
|
}
|
|
1065
880
|
ngAfterViewInit() {
|
|
881
|
+
this._initErrorStateTracker();
|
|
1066
882
|
queueMicrotask(() => {
|
|
1067
883
|
const controlDir = this.ngControl();
|
|
1068
884
|
if (controlDir?.control) {
|
|
@@ -1074,26 +890,388 @@ class IdsAutocompleteComponent extends IdsFormFieldControl {
|
|
|
1074
890
|
this._errorStateTracker?.updateErrorState();
|
|
1075
891
|
this._successStateTracker?.updateSuccessState();
|
|
1076
892
|
}
|
|
893
|
+
// #region ControlValueAccessor implementation
|
|
894
|
+
writeValue(value) {
|
|
895
|
+
if (value !== null) {
|
|
896
|
+
this._patchValue(value);
|
|
897
|
+
}
|
|
898
|
+
else {
|
|
899
|
+
this.trigger()?.clear();
|
|
900
|
+
}
|
|
901
|
+
this._value = value;
|
|
902
|
+
}
|
|
903
|
+
registerOnChange(fn) {
|
|
904
|
+
this.onChange = fn;
|
|
905
|
+
}
|
|
906
|
+
registerOnTouched(fn) {
|
|
907
|
+
this.onTouched = fn;
|
|
908
|
+
}
|
|
909
|
+
setDisabledState(isDisabled) {
|
|
910
|
+
this._disabled.set(isDisabled);
|
|
911
|
+
}
|
|
912
|
+
// #endregion
|
|
913
|
+
handleChange(value) {
|
|
914
|
+
this._value = value;
|
|
915
|
+
this.onChange(value);
|
|
916
|
+
}
|
|
917
|
+
// #endregion
|
|
918
|
+
// #region required as `IDS_OPTION_PARENT`, but not used here as it cannot handle option content changes.
|
|
919
|
+
// Selection is handled by `_updateCurrentSelection` method of `AutocompleteTriggerDirective`
|
|
920
|
+
isOptionPreSelectedByValue() {
|
|
921
|
+
return false;
|
|
922
|
+
}
|
|
923
|
+
// #endregion
|
|
924
|
+
setScrollTop(scrollTop) {
|
|
925
|
+
if (this.panel()) {
|
|
926
|
+
this.panel().nativeElement.scrollTop = scrollTop;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
getScrollTop() {
|
|
930
|
+
return this.panel() ? this.panel()?.nativeElement.scrollTop : 0;
|
|
931
|
+
}
|
|
932
|
+
setPanelOpen() {
|
|
933
|
+
this._overlayOrigin = this._parentFormField?.getConnectedOverlayOrigin();
|
|
934
|
+
this.overlayPanel()?.overlayDir()?.overlayRef?.updateSize({ width: this._overlayOrigin.nativeElement.getBoundingClientRect().width });
|
|
935
|
+
this._observeOverlayOrigin();
|
|
936
|
+
this.panelOpen.set(true);
|
|
937
|
+
}
|
|
938
|
+
createHostError(message) {
|
|
939
|
+
throw this._createHostError(message);
|
|
940
|
+
}
|
|
941
|
+
_observeOverlayOrigin() {
|
|
942
|
+
const observer = new ResizeObserver(() => {
|
|
943
|
+
this.overlayPanel()?.overlayDir()?.overlayRef?.updatePosition();
|
|
944
|
+
this.overlayPanel()?.overlayDir()?.overlayRef?.updateSize({ width: this._overlayOrigin.nativeElement.getBoundingClientRect().width });
|
|
945
|
+
});
|
|
946
|
+
observer.observe(this._overlayOrigin.nativeElement);
|
|
947
|
+
}
|
|
948
|
+
// "async" way to patch value to ensure options are loaded before setting selection
|
|
949
|
+
_patchValue(value) {
|
|
950
|
+
const patchEffect = effect(() => {
|
|
951
|
+
const options = this.options();
|
|
952
|
+
untracked(() => {
|
|
953
|
+
if (options.length > 0) {
|
|
954
|
+
this.trigger().setSelectionByValue(value);
|
|
955
|
+
patchEffect.destroy();
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
}, { ...(ngDevMode ? { debugName: "patchEffect" } : /* istanbul ignore next */ {}), injector: this._injector, manualCleanup: true });
|
|
959
|
+
}
|
|
960
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
961
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: IdsAutocompleteComponent, isStandalone: true, selector: "ids-autocomplete", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelClear: { classPropertyName: "ariaLabelClear", publicName: "ariaLabelClear", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelLoading: { classPropertyName: "ariaLabelLoading", publicName: "ariaLabelLoading", isSignal: true, isRequired: false, transformFunction: null }, multiSelect: { classPropertyName: "multiSelect", publicName: "multiSelect", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, sortCompareFn: { classPropertyName: "sortCompareFn", publicName: "sortCompareFn", isSignal: true, isRequired: false, transformFunction: null }, valueCompareFn: { classPropertyName: "valueCompareFn", publicName: "valueCompareFn", isSignal: true, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: true, transformFunction: null }, panelClasses: { classPropertyName: "panelClasses", publicName: "panelClasses", isSignal: true, isRequired: false, transformFunction: null }, panelOpen: { classPropertyName: "panelOpen", publicName: "panelOpen", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, spinnerVariant: { classPropertyName: "spinnerVariant", publicName: "spinnerVariant", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, errorStateMatcher: { classPropertyName: "errorStateMatcher", publicName: "errorStateMatcher", isSignal: true, isRequired: false, transformFunction: null }, successStateMatcher: { classPropertyName: "successStateMatcher", publicName: "successStateMatcher", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { panelOpen: "panelOpenChange" }, providers: [
|
|
962
|
+
{ provide: IDS_FORM_FIELD_CONTROL, useExisting: IdsAutocompleteComponent },
|
|
963
|
+
{ provide: IDS_OPTION_PARENT_COMPONENT, useExisting: IdsAutocompleteComponent },
|
|
964
|
+
{
|
|
965
|
+
provide: NG_VALUE_ACCESSOR,
|
|
966
|
+
useExisting: forwardRef(() => IdsAutocompleteComponent),
|
|
967
|
+
multi: true,
|
|
968
|
+
},
|
|
969
|
+
], queries: [{ propertyName: "options", predicate: IdsOptionComponent, descendants: true, isSignal: true }, { propertyName: "optionGroups", predicate: IDS_OPTION_GROUP, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "overlayPanel", first: true, predicate: ["overlayPanel"], descendants: true, isSignal: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true, read: ElementRef, isSignal: true }], exportAs: ["idsAutocomplete"], usesInheritance: true, ngImport: i0, template: `
|
|
970
|
+
@if (panelOpen()) {
|
|
971
|
+
<ids-overlay-panel
|
|
972
|
+
#overlayPanel
|
|
973
|
+
appearance="elevated"
|
|
974
|
+
[origin]="_overlayOrigin"
|
|
975
|
+
[open]="panelOpen()"
|
|
976
|
+
[size]="parentSize()"
|
|
977
|
+
[panelClasses]="_panelClasses()"
|
|
978
|
+
>
|
|
979
|
+
<div
|
|
980
|
+
#panel
|
|
981
|
+
class="ids-autocomplete-panel"
|
|
982
|
+
role="listbox"
|
|
983
|
+
[id]="id() + '-panel'"
|
|
984
|
+
[attr.aria-multiselectable]="multiSelect()"
|
|
985
|
+
[attr.aria-label]="ariaLabel() || null"
|
|
986
|
+
[attr.aria-labelledby]="ariaLabelledby() || null"
|
|
987
|
+
>
|
|
988
|
+
<ng-content />
|
|
989
|
+
</div>
|
|
990
|
+
</ids-overlay-panel>
|
|
991
|
+
}
|
|
992
|
+
<span class="ids-autocomplete-suffix">
|
|
993
|
+
@if (trigger().selected.length > 0) {
|
|
994
|
+
<button
|
|
995
|
+
type="button"
|
|
996
|
+
idsIconButton
|
|
997
|
+
[appearance]="appearance()"
|
|
998
|
+
[variant]="parentVariant()"
|
|
999
|
+
[size]="parentSize()"
|
|
1000
|
+
[disabled]="disabled()"
|
|
1001
|
+
[ariaLabel]="ariaLabelClear()"
|
|
1002
|
+
[idsTooltip]="ariaLabelClear()"
|
|
1003
|
+
[idsTooltipDisabled]="!ariaLabelClear()"
|
|
1004
|
+
[idsTooltipIgnoreClipped]="true"
|
|
1005
|
+
(click)="trigger().clear()"
|
|
1006
|
+
>
|
|
1007
|
+
<ids-icon alt="" aria-hidden="true" fontIcon="close" />
|
|
1008
|
+
</button>
|
|
1009
|
+
}
|
|
1010
|
+
@if (isLoading()) {
|
|
1011
|
+
<ids-spinner
|
|
1012
|
+
sizeCollection="small"
|
|
1013
|
+
[size]="parentSize()"
|
|
1014
|
+
[variant]="spinnerVariant()"
|
|
1015
|
+
[isTrack]="true"
|
|
1016
|
+
[aria-label]="ariaLabelLoading()"
|
|
1017
|
+
/>
|
|
1018
|
+
} @else {
|
|
1019
|
+
<ids-icon
|
|
1020
|
+
alt=""
|
|
1021
|
+
aria-hidden="true"
|
|
1022
|
+
[size]="parentSize()"
|
|
1023
|
+
[fontIcon]="trigger().autocomplete().panelOpen() ? 'chevron-up' : 'chevron-down'"
|
|
1024
|
+
/>
|
|
1025
|
+
}
|
|
1026
|
+
</span>
|
|
1027
|
+
`, isInline: true, dependencies: [{ kind: "component", type: IdsIconComponent, selector: "ids-icon", inputs: ["size", "sizeCollection", "variant", "fontIcon", "svgIcon", "aria-hidden"] }, { kind: "component", type: IdsIconButtonComponent, selector: "button[idsIconButton], a[idsIconButton]", inputs: ["appearance", "size", "variant", "disabled", "allowCustomContent"] }, { kind: "component", type: IdsOverlayPanelComponent, selector: "ids-overlay-panel", inputs: ["open", "origin", "positions", "appearance", "size", "variant", "panelClasses", "width"], outputs: ["openChange"] }, { kind: "component", type: IdsSpinnerComponent, selector: "ids-spinner", inputs: ["size", "sizeCollection", "variant", "isTrack", "aria-label"] }, { kind: "directive", type: IdsTooltipDirective, selector: "[idsTooltip]", inputs: ["idsTooltip", "idsTooltipPosition", "idsTooltipSize", "idsTooltipVariant", "idsTooltipShowDelay", "idsTooltipHideDelay", "idsTooltipDisabled", "idsTooltipTouchGestures", "idsTooltipTextAlign", "idsTooltipClass", "idsTooltipShowPointer", "idsTooltipIgnoreClipped"] }] }); }
|
|
1028
|
+
}
|
|
1029
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsAutocompleteComponent, decorators: [{
|
|
1030
|
+
type: Component,
|
|
1031
|
+
args: [{
|
|
1032
|
+
selector: 'ids-autocomplete',
|
|
1033
|
+
imports: [
|
|
1034
|
+
IdsIconComponent,
|
|
1035
|
+
IdsIconButtonComponent,
|
|
1036
|
+
IdsOverlayPanelComponent,
|
|
1037
|
+
IdsSpinnerComponent,
|
|
1038
|
+
IdsTooltipDirective,
|
|
1039
|
+
],
|
|
1040
|
+
template: `
|
|
1041
|
+
@if (panelOpen()) {
|
|
1042
|
+
<ids-overlay-panel
|
|
1043
|
+
#overlayPanel
|
|
1044
|
+
appearance="elevated"
|
|
1045
|
+
[origin]="_overlayOrigin"
|
|
1046
|
+
[open]="panelOpen()"
|
|
1047
|
+
[size]="parentSize()"
|
|
1048
|
+
[panelClasses]="_panelClasses()"
|
|
1049
|
+
>
|
|
1050
|
+
<div
|
|
1051
|
+
#panel
|
|
1052
|
+
class="ids-autocomplete-panel"
|
|
1053
|
+
role="listbox"
|
|
1054
|
+
[id]="id() + '-panel'"
|
|
1055
|
+
[attr.aria-multiselectable]="multiSelect()"
|
|
1056
|
+
[attr.aria-label]="ariaLabel() || null"
|
|
1057
|
+
[attr.aria-labelledby]="ariaLabelledby() || null"
|
|
1058
|
+
>
|
|
1059
|
+
<ng-content />
|
|
1060
|
+
</div>
|
|
1061
|
+
</ids-overlay-panel>
|
|
1062
|
+
}
|
|
1063
|
+
<span class="ids-autocomplete-suffix">
|
|
1064
|
+
@if (trigger().selected.length > 0) {
|
|
1065
|
+
<button
|
|
1066
|
+
type="button"
|
|
1067
|
+
idsIconButton
|
|
1068
|
+
[appearance]="appearance()"
|
|
1069
|
+
[variant]="parentVariant()"
|
|
1070
|
+
[size]="parentSize()"
|
|
1071
|
+
[disabled]="disabled()"
|
|
1072
|
+
[ariaLabel]="ariaLabelClear()"
|
|
1073
|
+
[idsTooltip]="ariaLabelClear()"
|
|
1074
|
+
[idsTooltipDisabled]="!ariaLabelClear()"
|
|
1075
|
+
[idsTooltipIgnoreClipped]="true"
|
|
1076
|
+
(click)="trigger().clear()"
|
|
1077
|
+
>
|
|
1078
|
+
<ids-icon alt="" aria-hidden="true" fontIcon="close" />
|
|
1079
|
+
</button>
|
|
1080
|
+
}
|
|
1081
|
+
@if (isLoading()) {
|
|
1082
|
+
<ids-spinner
|
|
1083
|
+
sizeCollection="small"
|
|
1084
|
+
[size]="parentSize()"
|
|
1085
|
+
[variant]="spinnerVariant()"
|
|
1086
|
+
[isTrack]="true"
|
|
1087
|
+
[aria-label]="ariaLabelLoading()"
|
|
1088
|
+
/>
|
|
1089
|
+
} @else {
|
|
1090
|
+
<ids-icon
|
|
1091
|
+
alt=""
|
|
1092
|
+
aria-hidden="true"
|
|
1093
|
+
[size]="parentSize()"
|
|
1094
|
+
[fontIcon]="trigger().autocomplete().panelOpen() ? 'chevron-up' : 'chevron-down'"
|
|
1095
|
+
/>
|
|
1096
|
+
}
|
|
1097
|
+
</span>
|
|
1098
|
+
`,
|
|
1099
|
+
exportAs: 'idsAutocomplete',
|
|
1100
|
+
providers: [
|
|
1101
|
+
{ provide: IDS_FORM_FIELD_CONTROL, useExisting: IdsAutocompleteComponent },
|
|
1102
|
+
{ provide: IDS_OPTION_PARENT_COMPONENT, useExisting: IdsAutocompleteComponent },
|
|
1103
|
+
{
|
|
1104
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1105
|
+
useExisting: forwardRef(() => IdsAutocompleteComponent),
|
|
1106
|
+
multi: true,
|
|
1107
|
+
},
|
|
1108
|
+
],
|
|
1109
|
+
}]
|
|
1110
|
+
}], ctorParameters: () => [], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], ariaLabelClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelClear", required: false }] }], ariaLabelLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelLoading", required: false }] }], multiSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiSelect", required: false }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], sortCompareFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortCompareFn", required: false }] }], valueCompareFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueCompareFn", required: false }] }], trigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "trigger", required: true }] }], panelClasses: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelClasses", required: false }] }], panelOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelOpen", required: false }] }, { type: i0.Output, args: ["panelOpenChange"] }], options: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IdsOptionComponent), { ...{ descendants: true }, isSignal: true }] }], optionGroups: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => IDS_OPTION_GROUP), { ...{ descendants: true }, isSignal: true }] }], overlayPanel: [{ type: i0.ViewChild, args: ['overlayPanel', { isSignal: true }] }], panel: [{ type: i0.ViewChild, args: ['panel', { ...{ read: (ElementRef) }, isSignal: true }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], spinnerVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "spinnerVariant", required: false }] }], isLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLoading", required: false }] }], errorStateMatcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorStateMatcher", required: false }] }], successStateMatcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "successStateMatcher", required: false }] }] } });
|
|
1111
|
+
|
|
1112
|
+
const LIVE_ANNOUNCER_DURATION = 10000;
|
|
1113
|
+
class IdsAutocompleteTriggerDirective {
|
|
1114
|
+
get selected() {
|
|
1115
|
+
return this._selectionModel?.selected ?? [];
|
|
1116
|
+
}
|
|
1117
|
+
get selectedOptions() {
|
|
1118
|
+
const selectedValues = this.selected.map((option) => option.value) ?? [];
|
|
1119
|
+
return this.autocomplete()
|
|
1120
|
+
.options()
|
|
1121
|
+
.filter((option) => selectedValues.includes(option.value()));
|
|
1122
|
+
}
|
|
1123
|
+
constructor() {
|
|
1124
|
+
this.autocomplete = input.required({ ...(ngDevMode ? { debugName: "autocomplete" } : /* istanbul ignore next */ {}), alias: 'idsAutocompleteTriggerFor' });
|
|
1125
|
+
this._disabled = computed(() => this.autocomplete().disabled(), ...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
|
|
1126
|
+
this._readonly = computed(() => this.autocomplete().readonly(), ...(ngDevMode ? [{ debugName: "_readonly" }] : /* istanbul ignore next */ []));
|
|
1127
|
+
this._inputElement = inject((ElementRef));
|
|
1128
|
+
this._liveAnnouncer = inject(LiveAnnouncer);
|
|
1129
|
+
this._renderer = inject(Renderer2);
|
|
1130
|
+
this._injector = inject(Injector);
|
|
1131
|
+
this._skipPredicate = (option) => {
|
|
1132
|
+
if (this.autocomplete().panelOpen()) {
|
|
1133
|
+
return false;
|
|
1134
|
+
}
|
|
1135
|
+
return option.disabledInput();
|
|
1136
|
+
};
|
|
1137
|
+
effect(() => {
|
|
1138
|
+
const options = this.autocomplete().options();
|
|
1139
|
+
untracked(() => {
|
|
1140
|
+
if (options.length > 0) {
|
|
1141
|
+
this._initKeyManager();
|
|
1142
|
+
this._subscribeOptionChanges();
|
|
1143
|
+
this._liveAnnouncer.announce(options.length.toString(), LIVE_ANNOUNCER_DURATION);
|
|
1144
|
+
if (!this._selectionModel.isEmpty()) {
|
|
1145
|
+
this._updateCurrentSelection();
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
});
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
ngOnInit() {
|
|
1152
|
+
this._selectionModel = new SelectionModel(true, undefined, true, this.autocomplete().valueCompareFn());
|
|
1153
|
+
this._selectionModel.changed.subscribe(() => {
|
|
1154
|
+
if (this.autocomplete().multiSelect()) {
|
|
1155
|
+
this._selectionModel?.sort(this.autocomplete().sortCompareFn());
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
this._updateInputValue(this.selected[0]?.viewValue);
|
|
1159
|
+
}
|
|
1160
|
+
this.autocomplete().handleChange(this.autocomplete().multiSelect() ? this.selected.map((option) => option.value) : (this.selected[0]?.value ?? null));
|
|
1161
|
+
this.autocomplete().onTouched();
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1077
1164
|
ngOnDestroy() {
|
|
1078
1165
|
this._keyManager?.destroy();
|
|
1079
1166
|
}
|
|
1167
|
+
toggle() {
|
|
1168
|
+
this.autocomplete().panelOpen() ? this.close() : this.open();
|
|
1169
|
+
}
|
|
1170
|
+
open() {
|
|
1171
|
+
if (!this._canOpen()) {
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
this.autocomplete().setPanelOpen();
|
|
1175
|
+
this._keyManager?.withHorizontalOrientation(null);
|
|
1176
|
+
// wait for opening panel...
|
|
1177
|
+
afterNextRender(() => {
|
|
1178
|
+
this._scrollOptionIntoView(this._keyManager?.activeItemIndex ?? 0);
|
|
1179
|
+
this._highlightCorrectOption();
|
|
1180
|
+
}, { injector: this._injector });
|
|
1181
|
+
}
|
|
1182
|
+
close() {
|
|
1183
|
+
if (this.autocomplete().panelOpen()) {
|
|
1184
|
+
this.autocomplete().panelOpen.set(false);
|
|
1185
|
+
this._keyManager?.withHorizontalOrientation('ltr');
|
|
1186
|
+
this.autocomplete().onTouched();
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
clear() {
|
|
1190
|
+
this._clearSelection();
|
|
1191
|
+
this._updateInputValue('');
|
|
1192
|
+
}
|
|
1193
|
+
removeOption(optionValue) {
|
|
1194
|
+
const option = this.autocomplete()
|
|
1195
|
+
.options()
|
|
1196
|
+
.find((opt) => opt.value() === optionValue.value);
|
|
1197
|
+
if (option) {
|
|
1198
|
+
this._handleOptionChange({
|
|
1199
|
+
source: option,
|
|
1200
|
+
selected: false,
|
|
1201
|
+
isUserInput: true,
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
else {
|
|
1205
|
+
// item to be removed is NOT the current option list, but present in selection model --> deselect directly
|
|
1206
|
+
this._selectionModel?.deselect(optionValue);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
focus(options) {
|
|
1210
|
+
this._inputElement.nativeElement.focus(options);
|
|
1211
|
+
this.open();
|
|
1212
|
+
}
|
|
1213
|
+
setSelectionByValue(value) {
|
|
1214
|
+
if (this.autocomplete().multiSelect() && value !== null) {
|
|
1215
|
+
if (!Array.isArray(value)) {
|
|
1216
|
+
throw this.autocomplete().createHostError('value must be an array in multiple-selection mode');
|
|
1217
|
+
}
|
|
1218
|
+
else {
|
|
1219
|
+
value.forEach((currentValue) => this._selectValue(currentValue));
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
else {
|
|
1223
|
+
const correspondingOption = this._selectValue(value);
|
|
1224
|
+
if (correspondingOption) {
|
|
1225
|
+
this._keyManager?.updateActiveItem(correspondingOption);
|
|
1226
|
+
}
|
|
1227
|
+
else if (!this.autocomplete().panelOpen()) {
|
|
1228
|
+
this._keyManager?.updateActiveItem(-1);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
_handleKeydown(event) {
|
|
1233
|
+
if (!this._disabled() && !this._readonly()) {
|
|
1234
|
+
this.autocomplete().panelOpen() ? this._handleOpenedPanelKeydown(event) : this._handleClosedPanelKeydown(event);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
_onBlur() {
|
|
1238
|
+
if (!this._disabled()) {
|
|
1239
|
+
this.autocomplete().onTouched();
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
_getAriaActiveDescendant() {
|
|
1243
|
+
if (this.autocomplete().panelOpen() && this._keyManager?.activeItem) {
|
|
1244
|
+
return this._keyManager.activeItem.id();
|
|
1245
|
+
}
|
|
1246
|
+
return null;
|
|
1247
|
+
}
|
|
1080
1248
|
_initKeyManager() {
|
|
1081
|
-
this._keyManager = new ActiveDescendantKeyManager(this.options())
|
|
1082
|
-
.withTypeAhead(this.typeaheadDebounceInterval())
|
|
1249
|
+
this._keyManager = new ActiveDescendantKeyManager(this.autocomplete().options())
|
|
1083
1250
|
.withVerticalOrientation()
|
|
1084
1251
|
.withHorizontalOrientation('ltr')
|
|
1085
1252
|
.withHomeAndEnd()
|
|
1086
1253
|
.withPageUpDown()
|
|
1087
1254
|
.withAllowedModifierKeys(['shiftKey'])
|
|
1088
1255
|
.skipPredicate(this._skipPredicate);
|
|
1256
|
+
this._keyManager.tabOut.subscribe(() => {
|
|
1257
|
+
if (this.autocomplete().panelOpen()) {
|
|
1258
|
+
if (!this.autocomplete().multiSelect() && this._keyManager?.activeItem) {
|
|
1259
|
+
this._keyManager.activeItem.selectViaInteraction();
|
|
1260
|
+
}
|
|
1261
|
+
this.focus();
|
|
1262
|
+
this.close();
|
|
1263
|
+
}
|
|
1264
|
+
});
|
|
1089
1265
|
this._keyManager.change.subscribe(() => {
|
|
1090
|
-
if (this.
|
|
1091
|
-
this._scrollOptionIntoView(this._keyManager?.activeItemIndex
|
|
1266
|
+
if (this.autocomplete().panelOpen()) {
|
|
1267
|
+
this._scrollOptionIntoView(this._keyManager?.activeItemIndex ?? 0);
|
|
1092
1268
|
}
|
|
1093
1269
|
});
|
|
1094
1270
|
}
|
|
1095
1271
|
_subscribeOptionChanges() {
|
|
1096
|
-
this.
|
|
1272
|
+
this.autocomplete()
|
|
1273
|
+
.options()
|
|
1274
|
+
.forEach((option) => {
|
|
1097
1275
|
option.onSelectionChange.subscribe((change) => {
|
|
1098
1276
|
this._handleOptionChange(change);
|
|
1099
1277
|
});
|
|
@@ -1101,85 +1279,46 @@ class IdsAutocompleteComponent extends IdsFormFieldControl {
|
|
|
1101
1279
|
}
|
|
1102
1280
|
_handleOptionChange(change) {
|
|
1103
1281
|
const { source, selected, isUserInput } = change;
|
|
1104
|
-
if (!this.multiSelect()) {
|
|
1282
|
+
if (!this.autocomplete().multiSelect()) {
|
|
1105
1283
|
this._clearSelection();
|
|
1106
1284
|
}
|
|
1107
1285
|
source.selected.set(selected);
|
|
1108
1286
|
if (isUserInput) {
|
|
1109
1287
|
this._keyManager?.setActiveItem(source);
|
|
1110
1288
|
}
|
|
1111
|
-
if (isUserInput && !this.multiSelect() && this.
|
|
1289
|
+
if (isUserInput && !this.autocomplete().multiSelect() && this.autocomplete().panelOpen()) {
|
|
1112
1290
|
this.close();
|
|
1113
1291
|
}
|
|
1114
|
-
|
|
1115
|
-
this._sortValues();
|
|
1116
|
-
}
|
|
1292
|
+
const optionValue = this._getAsOptionValue(source);
|
|
1117
1293
|
if (selected) {
|
|
1118
|
-
this._selectionModel?.select(
|
|
1119
|
-
this._searchText.set(source.viewValue());
|
|
1294
|
+
this._selectionModel?.select(optionValue);
|
|
1120
1295
|
}
|
|
1121
1296
|
else {
|
|
1122
|
-
this._selectionModel?.deselect(
|
|
1297
|
+
this._selectionModel?.deselect(optionValue);
|
|
1123
1298
|
}
|
|
1124
|
-
this._handleChange();
|
|
1125
|
-
this._onTouched();
|
|
1126
|
-
this._inputElemment()?.nativeElement.blur();
|
|
1127
|
-
this.overlayPanel().open.set(false);
|
|
1128
1299
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
// announce number of options when a key is pressed
|
|
1133
|
-
this._liveAnnouncer.announce(this.options()
|
|
1134
|
-
.filter((option) => !option.disabled)
|
|
1135
|
-
.length.toString(), LIVE_ANNOUNCE_DURATION_MS);
|
|
1136
|
-
}
|
|
1300
|
+
_clearSelection() {
|
|
1301
|
+
this._selectionModel?.clear();
|
|
1302
|
+
this._clearOptionsSelection();
|
|
1137
1303
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
const manager = this._keyManager;
|
|
1149
|
-
const isArrowKey = key === 'ArrowDown' || key === 'ArrowUp' || key === 'ArrowLeft' || key === 'ArrowRight';
|
|
1150
|
-
const isOpenKey = key === 'Enter' || key === ' ';
|
|
1151
|
-
if ((!manager?.isTyping() && isOpenKey && !hasModifierKey(event)) ||
|
|
1152
|
-
isArrowKey ||
|
|
1153
|
-
this.options().length > 0 ||
|
|
1154
|
-
this._resource.value().length > 0) {
|
|
1155
|
-
if (isArrowKey || isOpenKey) {
|
|
1156
|
-
event.preventDefault();
|
|
1157
|
-
}
|
|
1158
|
-
this.open();
|
|
1159
|
-
}
|
|
1160
|
-
else if (!this.multiSelect()) {
|
|
1161
|
-
const previouslySelectedOption = this.selected;
|
|
1162
|
-
manager?.onKeydown(event);
|
|
1163
|
-
const selectedOption = this.selected;
|
|
1164
|
-
if (selectedOption && previouslySelectedOption !== selectedOption) {
|
|
1165
|
-
this._liveAnnouncer.announce(selectedOption, LIVE_ANNOUNCE_DURATION_MS);
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1304
|
+
_clearOptionsSelection() {
|
|
1305
|
+
this.autocomplete()
|
|
1306
|
+
.options()
|
|
1307
|
+
.forEach((option) => {
|
|
1308
|
+
option.setInactiveStyles();
|
|
1309
|
+
option.selected.set(false);
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
_canOpen() {
|
|
1313
|
+
return !this._readonly() && !this._disabled();
|
|
1168
1314
|
}
|
|
1169
1315
|
_handleOpenedPanelKeydown(event) {
|
|
1170
|
-
const key = event.key;
|
|
1171
|
-
const targetElement = event.target;
|
|
1172
|
-
const isButtonTarget = targetElement.localName === 'button';
|
|
1173
|
-
if (isButtonTarget && (key === 'Enter' || key === ' ')) {
|
|
1174
|
-
event.preventDefault();
|
|
1175
|
-
targetElement.click();
|
|
1176
|
-
targetElement.blur();
|
|
1177
|
-
return;
|
|
1178
|
-
}
|
|
1179
1316
|
const manager = this._keyManager;
|
|
1317
|
+
const key = event.key;
|
|
1180
1318
|
const isArrowKey = key === 'ArrowDown' || key === 'ArrowUp';
|
|
1181
|
-
const isTyping = manager
|
|
1182
|
-
|
|
1319
|
+
const isTyping = manager !== undefined && manager.isTyping();
|
|
1320
|
+
const isEscapeKey = key === 'Escape';
|
|
1321
|
+
if ((isArrowKey && event.altKey) || isEscapeKey) {
|
|
1183
1322
|
event.preventDefault();
|
|
1184
1323
|
this.close();
|
|
1185
1324
|
}
|
|
@@ -1187,10 +1326,14 @@ class IdsAutocompleteComponent extends IdsFormFieldControl {
|
|
|
1187
1326
|
event.preventDefault();
|
|
1188
1327
|
manager.activeItem.selectViaInteraction();
|
|
1189
1328
|
}
|
|
1190
|
-
else if (!isTyping && this.multiSelect() && key === 'a' && event.ctrlKey) {
|
|
1329
|
+
else if (!isTyping && this.autocomplete().multiSelect() && key === 'a' && event.ctrlKey) {
|
|
1191
1330
|
event.preventDefault();
|
|
1192
|
-
const hasDeselectedOptions = this.
|
|
1193
|
-
|
|
1331
|
+
const hasDeselectedOptions = this.autocomplete()
|
|
1332
|
+
.options()
|
|
1333
|
+
.some((opt) => !opt.disabled && !opt.selected());
|
|
1334
|
+
this.autocomplete()
|
|
1335
|
+
.options()
|
|
1336
|
+
.forEach((option) => {
|
|
1194
1337
|
if (!option.disabled) {
|
|
1195
1338
|
hasDeselectedOptions ? option.select() : option.deselect();
|
|
1196
1339
|
}
|
|
@@ -1199,7 +1342,8 @@ class IdsAutocompleteComponent extends IdsFormFieldControl {
|
|
|
1199
1342
|
else {
|
|
1200
1343
|
const previouslyFocusedIndex = manager?.activeItemIndex;
|
|
1201
1344
|
manager?.onKeydown(event);
|
|
1202
|
-
|
|
1345
|
+
this._scrollOptionIntoView(manager?.activeItemIndex ?? 0);
|
|
1346
|
+
if (this.autocomplete().multiSelect() &&
|
|
1203
1347
|
isArrowKey &&
|
|
1204
1348
|
event.shiftKey &&
|
|
1205
1349
|
manager?.activeItem &&
|
|
@@ -1208,102 +1352,65 @@ class IdsAutocompleteComponent extends IdsFormFieldControl {
|
|
|
1208
1352
|
}
|
|
1209
1353
|
}
|
|
1210
1354
|
}
|
|
1211
|
-
|
|
1212
|
-
const
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
panel.scrollTop = _getOptionScrollPosition(element.offsetTop, element.offsetHeight, panel.scrollTop, panel.offsetHeight);
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
_sortValues() {
|
|
1225
|
-
if (this.multiSelect()) {
|
|
1226
|
-
const options = this.options().map((option) => option.viewValue());
|
|
1227
|
-
const sortComparator = this.sortCompareFn();
|
|
1228
|
-
this._selectionModel?.sort((a, b) => (sortComparator ? sortComparator(a, b, options) : options.indexOf(a) - options.indexOf(b)));
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
_getOverlayWidth(preferredOrigin) {
|
|
1232
|
-
const refToMeasure = preferredOrigin instanceof CdkOverlayOrigin ? preferredOrigin.elementRef : preferredOrigin || this._elementRef;
|
|
1233
|
-
return refToMeasure.nativeElement.getBoundingClientRect().width;
|
|
1234
|
-
}
|
|
1235
|
-
toggle() {
|
|
1236
|
-
this.overlayPanel().open() ? this.close() : this.open();
|
|
1237
|
-
}
|
|
1238
|
-
open() {
|
|
1239
|
-
if (!this._canOpen()) {
|
|
1240
|
-
return;
|
|
1241
|
-
}
|
|
1242
|
-
if (this._parentFormField) {
|
|
1243
|
-
this._preferredOverlayOrigin = this._parentFormField?.getConnectedOverlayOrigin();
|
|
1355
|
+
_handleClosedPanelKeydown(event) {
|
|
1356
|
+
const manager = this._keyManager;
|
|
1357
|
+
const key = event.key;
|
|
1358
|
+
const isArrowKey = key === 'ArrowDown' || key === 'ArrowUp' || key === 'ArrowLeft' || key === 'ArrowRight';
|
|
1359
|
+
const isOpenKey = key === 'Enter' || key === ' ';
|
|
1360
|
+
const isEscapeKey = key === 'Escape';
|
|
1361
|
+
if ((manager && !manager.isTyping() && isOpenKey && !hasModifierKey(event)) || isArrowKey) {
|
|
1362
|
+
event.preventDefault();
|
|
1363
|
+
this.open();
|
|
1244
1364
|
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
if (this.overlayPanel().open()) {
|
|
1253
|
-
this.overlayPanel().open.set(false);
|
|
1254
|
-
this._changeDetectorRef.markForCheck();
|
|
1255
|
-
this._onTouched();
|
|
1365
|
+
else if (!this.autocomplete().multiSelect() && !isEscapeKey) {
|
|
1366
|
+
const previouslySelectedOption = this.selectedOptions[0];
|
|
1367
|
+
manager?.onKeydown(event);
|
|
1368
|
+
const selectedOption = this.selectedOptions[0];
|
|
1369
|
+
if (selectedOption?.viewValue() && previouslySelectedOption !== selectedOption) {
|
|
1370
|
+
this._liveAnnouncer.announce(selectedOption.viewValue(), LIVE_ANNOUNCER_DURATION);
|
|
1371
|
+
}
|
|
1256
1372
|
}
|
|
1257
1373
|
}
|
|
1258
|
-
|
|
1259
|
-
this.
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
// #endregion
|
|
1276
|
-
_setSelectionByValue(value) {
|
|
1277
|
-
this.options().forEach((option) => {
|
|
1278
|
-
option.setInactiveStyles();
|
|
1279
|
-
option.selected.set(false);
|
|
1280
|
-
});
|
|
1281
|
-
this._selectionModel?.clear();
|
|
1282
|
-
this._rawValue = value;
|
|
1283
|
-
if (this.options().length === 0) {
|
|
1284
|
-
return;
|
|
1285
|
-
}
|
|
1286
|
-
if (this.multiSelect() && value) {
|
|
1287
|
-
if (!Array.isArray(value)) {
|
|
1288
|
-
throw this._createHostError('value must be an array in multiple-selection mode');
|
|
1374
|
+
_highlightCorrectOption() {
|
|
1375
|
+
if (this._keyManager) {
|
|
1376
|
+
if (this._selectionModel?.isEmpty() ?? true) {
|
|
1377
|
+
let firstEnabledOptionIndex = -1;
|
|
1378
|
+
for (let index = 0; index < this.autocomplete().options().length; index++) {
|
|
1379
|
+
const option = this.autocomplete().options()[index];
|
|
1380
|
+
if (!option.disabled) {
|
|
1381
|
+
firstEnabledOptionIndex = index;
|
|
1382
|
+
break;
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
this._keyManager.setActiveItem(firstEnabledOptionIndex);
|
|
1386
|
+
}
|
|
1387
|
+
else {
|
|
1388
|
+
if (this._selectionModel) {
|
|
1389
|
+
this._keyManager.setActiveItem(this.selectedOptions[0]);
|
|
1390
|
+
}
|
|
1289
1391
|
}
|
|
1290
|
-
value.forEach((currentValue) => this._selectValue(currentValue));
|
|
1291
|
-
this._sortValues();
|
|
1292
1392
|
}
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1393
|
+
}
|
|
1394
|
+
_scrollOptionIntoView(index) {
|
|
1395
|
+
const option = this.autocomplete().options()[index];
|
|
1396
|
+
if (option !== undefined) {
|
|
1397
|
+
const labelCount = _countGroupLabelsBeforeOption(index, this.autocomplete().options(), this.autocomplete().optionGroups());
|
|
1398
|
+
const element = option.getHostElement();
|
|
1399
|
+
if (index === 0 || (index === 0 && labelCount === 1)) {
|
|
1400
|
+
this.autocomplete().setScrollTop(0);
|
|
1297
1401
|
}
|
|
1298
|
-
else
|
|
1299
|
-
this.
|
|
1402
|
+
else {
|
|
1403
|
+
const newScrollPosition = _getOptionScrollPosition(element.offsetTop, element.offsetHeight, this.autocomplete().getScrollTop(), this.autocomplete().panel()?.nativeElement.offsetHeight);
|
|
1404
|
+
this.autocomplete().setScrollTop(newScrollPosition);
|
|
1300
1405
|
}
|
|
1301
1406
|
}
|
|
1302
1407
|
}
|
|
1303
1408
|
_selectValue(value) {
|
|
1304
|
-
const valueCompareFn = this.valueCompareFn();
|
|
1305
|
-
const correspondingOption = this.
|
|
1306
|
-
|
|
1409
|
+
const valueCompareFn = this.autocomplete().valueCompareFn();
|
|
1410
|
+
const correspondingOption = this.autocomplete()
|
|
1411
|
+
.options()
|
|
1412
|
+
.find((option) => {
|
|
1413
|
+
if (this._selectionModel && this._selectionModel.isSelected(this._getAsOptionValue(option))) {
|
|
1307
1414
|
return false;
|
|
1308
1415
|
}
|
|
1309
1416
|
try {
|
|
@@ -1318,155 +1425,272 @@ class IdsAutocompleteComponent extends IdsFormFieldControl {
|
|
|
1318
1425
|
});
|
|
1319
1426
|
if (correspondingOption) {
|
|
1320
1427
|
correspondingOption.selected.set(true);
|
|
1321
|
-
this.
|
|
1428
|
+
const correspondingOptionValue = this._getAsOptionValue(correspondingOption);
|
|
1429
|
+
this._selectionModel?.select(correspondingOptionValue);
|
|
1322
1430
|
}
|
|
1323
1431
|
return correspondingOption;
|
|
1324
1432
|
}
|
|
1325
|
-
|
|
1326
|
-
this.
|
|
1327
|
-
this.
|
|
1328
|
-
option.selected.set(
|
|
1433
|
+
_updateCurrentSelection() {
|
|
1434
|
+
this._clearOptionsSelection();
|
|
1435
|
+
this.selectedOptions.reverse().forEach((option) => {
|
|
1436
|
+
option.selected.set(true);
|
|
1437
|
+
option.setActiveStyles();
|
|
1438
|
+
this._keyManager?.setActiveItem(option);
|
|
1329
1439
|
});
|
|
1330
1440
|
}
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
if (this.multiSelect()) {
|
|
1334
|
-
this._onChange(selectionModelValues);
|
|
1335
|
-
}
|
|
1336
|
-
else {
|
|
1337
|
-
this._onChange(selectionModelValues?.[0]);
|
|
1338
|
-
}
|
|
1339
|
-
this._changeDetectorRef.markForCheck();
|
|
1340
|
-
}
|
|
1341
|
-
_highlightCorrectOption() {
|
|
1342
|
-
if (this._keyManager) {
|
|
1343
|
-
if (this._empty) {
|
|
1344
|
-
let firstEnabledOptionIndex = -1;
|
|
1345
|
-
for (let index = 0; index < this.options().length; index++) {
|
|
1346
|
-
const option = this.options()[index];
|
|
1347
|
-
if (!option.disabled) {
|
|
1348
|
-
firstEnabledOptionIndex = index;
|
|
1349
|
-
break;
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
this._keyManager.setActiveItem(firstEnabledOptionIndex);
|
|
1353
|
-
}
|
|
1354
|
-
else {
|
|
1355
|
-
if (this._selectionModel) {
|
|
1356
|
-
const activeItem = this.options().find((option) => this._selectionModel?.isSelected(option.viewValue()));
|
|
1357
|
-
if (activeItem) {
|
|
1358
|
-
this._keyManager.setActiveItem(activeItem);
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
isOptionPreSelectedByValue(optionValue) {
|
|
1365
|
-
if (this._rawValue === undefined) {
|
|
1366
|
-
return false;
|
|
1367
|
-
}
|
|
1368
|
-
if (this.multiSelect() && Array.isArray(this._rawValue)) {
|
|
1369
|
-
return this._rawValue.some((value) => optionValue != null && value === optionValue);
|
|
1370
|
-
}
|
|
1371
|
-
return optionValue === this._rawValue;
|
|
1372
|
-
}
|
|
1373
|
-
_onFocus() {
|
|
1374
|
-
if (!this.disabled()) {
|
|
1375
|
-
this._focused.set(true);
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
_onBlur() {
|
|
1379
|
-
this._focused.set(false);
|
|
1380
|
-
this._keyManager?.cancelTypeahead();
|
|
1381
|
-
if (!this.disabled() && !this.overlayPanel().open()) {
|
|
1382
|
-
this._onTouched();
|
|
1383
|
-
this._changeDetectorRef.markForCheck();
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
_getAriaActiveDescendant() {
|
|
1387
|
-
if (this.overlayPanel().open() && this._keyManager?.activeItem) {
|
|
1388
|
-
return this._keyManager.activeItem.id();
|
|
1389
|
-
}
|
|
1390
|
-
return null;
|
|
1391
|
-
}
|
|
1392
|
-
focus(options) {
|
|
1393
|
-
this._elementRef.nativeElement.focus(options);
|
|
1441
|
+
_getAsOptionValue(option) {
|
|
1442
|
+
return { value: option.value(), viewValue: option.viewValue() };
|
|
1394
1443
|
}
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
}
|
|
1444
|
+
_updateInputValue(value) {
|
|
1445
|
+
const input = this._inputElement.nativeElement;
|
|
1446
|
+
this._renderer.setProperty(input, 'value', value);
|
|
1447
|
+
input.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1399
1448
|
}
|
|
1400
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1401
|
-
static { this.ɵ
|
|
1402
|
-
{ provide: IDS_FORM_FIELD_CONTROL, useExisting: IdsAutocompleteComponent },
|
|
1403
|
-
{ provide: IDS_OPTION_PARENT_COMPONENT, useExisting: IdsAutocompleteComponent },
|
|
1404
|
-
{
|
|
1405
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1406
|
-
useExisting: forwardRef(() => IdsAutocompleteComponent),
|
|
1407
|
-
multi: true,
|
|
1408
|
-
},
|
|
1409
|
-
], viewQueries: [{ propertyName: "options", predicate: IdsOptionComponent, descendants: true, isSignal: true }, { propertyName: "overlayPanel", first: true, predicate: IdsOverlayPanelComponent, descendants: true, isSignal: true }, { propertyName: "_panel", first: true, predicate: ["overlay"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "_inputElemment", first: true, predicate: ["fallbackOverlayOrigin"], descendants: true, read: ElementRef, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@let isLoading = _resource.isLoading();\n@let optionsLength = _resource.value().length;\n@let maxOptionsLength = maxLength();\n\n<input\n #fallbackOverlayOrigin=\"cdkOverlayOrigin\"\n cdkOverlayOrigin\n idsInput\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [required]=\"false\"\n [(ngModel)]=\"_searchText\"\n (click)=\"_onInputClick()\"\n (blur)=\"_onBlur()\"\n/>\n@if (_searchText().length > 0) {\n <div idsFormFieldAction>\n <button\n type=\"button\"\n idsIconButton\n appearance=\"standard\"\n variant=\"surface\"\n size=\"dense\"\n [attr.aria-label]=\"ariaLabelClearButton()\"\n [idsTooltip]=\"ariaLabelClearButton()\"\n [idsTooltipDisabled]=\"!ariaLabelClearButton() || disabled()\"\n [idsTooltipIgnoreClipped]=\"true\"\n [disabled]=\"disabled()\"\n (click)=\"clear()\"\n >\n <ids-icon alt=\"\" aria-hidden=\"true\" fontIcon=\"close\" />\n </button>\n </div>\n}\n@if (!isLoading && optionsLength > 0) {\n <div idsFormFieldAction>\n <button\n type=\"button\"\n idsIconButton\n appearance=\"standard\"\n variant=\"surface\"\n size=\"dense\"\n [attr.aria-label]=\"ariaLabelToggleButton()\"\n [idsTooltip]=\"ariaLabelToggleButton()\"\n [idsTooltipDisabled]=\"!ariaLabelToggleButton() || disabled()\"\n [idsTooltipIgnoreClipped]=\"true\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n >\n <ids-icon alt=\"\" aria-hidden=\"true\" [fontIcon]=\"overlay.open() ? 'chevron-up' : 'chevron-down'\" />\n </button>\n </div>\n}\n@if (isLoading) {\n <div idsFormFieldAction>\n <ids-spinner sizeCollection=\"small\" size=\"compact\" variant=\"surface\" [isTrack]=\"true\" [aria-label]=\"hintLoading()\" />\n </div>\n}\n<ids-overlay-panel\n #overlay\n variant=\"light\"\n [id]=\"id() + '-panel'\"\n [origin]=\"_preferredOverlayOrigin || fallbackOverlayOrigin\"\n [size]=\"parentSize()\"\n [width]=\"_overlayWidth\"\n [panelClasses]=\"_panelClasses()\"\n>\n @let showHintLoading = isLoading;\n @let showHintMinChars = _searchText().length < minChars();\n @let showHintMaxLength = maxOptionsLength && optionsLength > maxOptionsLength;\n @let showHintNoResults = optionsLength === 0;\n\n @if (showHintLoading || showHintMinChars || showHintMaxLength || showHintNoResults) {\n <div class=\"ids-overlay-panel__autocomplete-message\">\n <ids-option disabled>\n @if (showHintLoading && !showHintMinChars) {\n {{ hintLoading() }}\n } @else if (showHintMinChars) {\n {{ hintMinChars() }}\n } @else if (showHintMaxLength) {\n {{ hintMaxLength() }}\n } @else if (showHintNoResults) {\n {{ hintNoResults() }}\n }\n </ids-option>\n </div>\n } @else {\n @for (option of _resource.value(); track $index) {\n <ids-option [value]=\"option\">{{ option }}</ids-option>\n }\n }\n</ids-overlay-panel>\n", dependencies: [{ kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: IdsFormFieldActionDirective, selector: "[idsFormFieldAction]" }, { kind: "directive", type: IdsInputDirective, selector: "input[idsInput][ngModel]:not([formControl]):not([formControlName]),\n input[idsInput][formControl]:not([ngModel]):not([formControlName]),\n input[idsInput][formControlName]:not([ngModel]):not([formControl]),\n textarea[idsInput][ngModel]:not([formControl]):not([formControlName]),\n textarea[idsInput][formControl]:not([ngModel]):not([formControlName]),\n textarea[idsInput][formControlName]:not([ngModel]):not([formControl])", inputs: ["name", "type", "errorStateMatcher", "successStateMatcher"], exportAs: ["idsInput"] }, { kind: "component", type: IdsIconComponent, selector: "ids-icon", inputs: ["size", "sizeCollection", "variant", "fontIcon", "svgIcon", "aria-hidden"] }, { kind: "component", type: IdsIconButtonComponent, selector: "button[idsIconButton], a[idsIconButton]", inputs: ["appearance", "size", "variant", "disabled", "allowCustomContent"] }, { kind: "component", type: IdsOverlayPanelComponent, selector: "ids-overlay-panel", inputs: ["open", "origin", "positions", "appearance", "size", "variant", "panelClasses", "width"], outputs: ["openChange"] }, { kind: "component", type: IdsOptionComponent, selector: "ids-option", inputs: ["value", "viewValue", "disabled"], outputs: ["onSelectionChange"] }, { kind: "component", type: IdsSpinnerComponent, selector: "ids-spinner", inputs: ["size", "sizeCollection", "variant", "isTrack", "aria-label"] }, { kind: "directive", type: IdsTooltipDirective, selector: "[idsTooltip]", inputs: ["idsTooltip", "idsTooltipPosition", "idsTooltipSize", "idsTooltipVariant", "idsTooltipShowDelay", "idsTooltipHideDelay", "idsTooltipDisabled", "idsTooltipTouchGestures", "idsTooltipTextAlign", "idsTooltipClass", "idsTooltipShowPointer", "idsTooltipIgnoreClipped"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1449
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsAutocompleteTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1450
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: IdsAutocompleteTriggerDirective, isStandalone: true, selector: "input[idsAutocompleteTriggerFor]", inputs: { autocomplete: { classPropertyName: "autocomplete", publicName: "idsAutocompleteTriggerFor", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "keydown": "_handleKeydown($event)", "focus": "focus()", "blur": "_onBlur()" }, properties: { "attr.role": "_disabled() ? null : \"combobox\"", "attr.autocomplete": "\"off\"", "attr.aria-autocomplete": "_disabled() ? null : \"list\"", "attr.aria-activedescendant": "_getAriaActiveDescendant()", "attr.aria-owns": "autocomplete().panelOpen() ? autocomplete().id() + \"-panel\" : null", "attr.aria-expanded": "_disabled() ? null : autocomplete().panelOpen().toString()", "attr.aria-controls": "(_disabled() || !autocomplete().panelOpen()) ? null : autocomplete()?.id()", "attr.aria-haspopup": "_disabled() ? null : \"listbox\"", "attr.tabindex": "_disabled() ? -1 : autocomplete().tabIndex()", "attr.aria-required": "autocomplete().required().toString()", "attr.aria-disabled": "_disabled().toString()", "attr.aria-invalid": "autocomplete().hasErrorState()", "attr.readonly": "_readonly() ? \"true\" : null", "disabled": "_disabled()" }, classAttribute: "ids-form-field-control" }, exportAs: ["idsAutocompleteTrigger"], ngImport: i0 }); }
|
|
1410
1451
|
}
|
|
1411
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1412
|
-
type:
|
|
1413
|
-
args: [{
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
IdsIconComponent,
|
|
1421
|
-
IdsIconButtonComponent,
|
|
1422
|
-
IdsOverlayPanelComponent,
|
|
1423
|
-
IdsOptionComponent,
|
|
1424
|
-
IdsSpinnerComponent,
|
|
1425
|
-
IdsTooltipDirective,
|
|
1426
|
-
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1427
|
-
{ provide: IDS_FORM_FIELD_CONTROL, useExisting: IdsAutocompleteComponent },
|
|
1428
|
-
{ provide: IDS_OPTION_PARENT_COMPONENT, useExisting: IdsAutocompleteComponent },
|
|
1429
|
-
{
|
|
1430
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1431
|
-
useExisting: forwardRef(() => IdsAutocompleteComponent),
|
|
1432
|
-
multi: true,
|
|
1433
|
-
},
|
|
1434
|
-
], host: {
|
|
1435
|
-
role: 'combobox',
|
|
1436
|
-
'aria-autocomplete': 'list',
|
|
1437
|
-
'aria-haspopup': 'listbox',
|
|
1438
|
-
'[attr.tabindex]': 'disabled() ? -1 : tabIndex()',
|
|
1439
|
-
'[attr.aria-controls]': 'overlayPanel().open() ? id() + "-panel" : null',
|
|
1440
|
-
'[attr.aria-owns]': 'overlayPanel().open() ? id() + "-panel" : null',
|
|
1441
|
-
'[attr.aria-expanded]': 'overlayPanel().open()',
|
|
1442
|
-
'[attr.aria-label]': 'ariaLabel() || null',
|
|
1443
|
-
'[attr.aria-labelledby]': 'ariaLabelledby() || null',
|
|
1444
|
-
'[attr.aria-required]': 'required().toString()',
|
|
1445
|
-
'[attr.aria-disabled]': 'disabled().toString()',
|
|
1446
|
-
'[attr.aria-invalid]': 'hasErrorState()',
|
|
1452
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsAutocompleteTriggerDirective, decorators: [{
|
|
1453
|
+
type: Directive,
|
|
1454
|
+
args: [{
|
|
1455
|
+
selector: 'input[idsAutocompleteTriggerFor]',
|
|
1456
|
+
host: {
|
|
1457
|
+
class: 'ids-form-field-control',
|
|
1458
|
+
'[attr.role]': '_disabled() ? null : "combobox"',
|
|
1459
|
+
'[attr.autocomplete]': '"off"',
|
|
1460
|
+
'[attr.aria-autocomplete]': '_disabled() ? null : "list"',
|
|
1447
1461
|
'[attr.aria-activedescendant]': '_getAriaActiveDescendant()',
|
|
1462
|
+
'[attr.aria-owns]': 'autocomplete().panelOpen() ? autocomplete().id() + "-panel" : null',
|
|
1463
|
+
'[attr.aria-expanded]': '_disabled() ? null : autocomplete().panelOpen().toString()',
|
|
1464
|
+
'[attr.aria-controls]': '(_disabled() || !autocomplete().panelOpen()) ? null : autocomplete()?.id()',
|
|
1465
|
+
'[attr.aria-haspopup]': '_disabled() ? null : "listbox"',
|
|
1466
|
+
'[attr.tabindex]': '_disabled() ? -1 : autocomplete().tabIndex()',
|
|
1467
|
+
'[attr.aria-required]': 'autocomplete().required().toString()',
|
|
1468
|
+
'[attr.aria-disabled]': '_disabled().toString()',
|
|
1469
|
+
'[attr.aria-invalid]': 'autocomplete().hasErrorState()',
|
|
1470
|
+
'[attr.readonly]': '_readonly() ? "true" : null',
|
|
1471
|
+
'[disabled]': '_disabled()',
|
|
1448
1472
|
'(keydown)': '_handleKeydown($event)',
|
|
1449
1473
|
'(focus)': 'focus()',
|
|
1450
1474
|
'(blur)': '_onBlur()',
|
|
1451
|
-
},
|
|
1452
|
-
|
|
1475
|
+
},
|
|
1476
|
+
exportAs: 'idsAutocompleteTrigger',
|
|
1477
|
+
}]
|
|
1478
|
+
}], ctorParameters: () => [], propDecorators: { autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "idsAutocompleteTriggerFor", required: true }] }] } });
|
|
1479
|
+
|
|
1480
|
+
class IdsAutocompleteChipListComponent {
|
|
1481
|
+
constructor() {
|
|
1482
|
+
this.autocompleteTrigger = input.required({ ...(ngDevMode ? { debugName: "autocompleteTrigger" } : /* istanbul ignore next */ {}), alias: 'for' });
|
|
1483
|
+
this.options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
1484
|
+
this.appearance = input(IdsChipAppearance.OUTLINED, ...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
|
|
1485
|
+
this.size = input(IdsSize.COMPACT, ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1486
|
+
this.variant = input(IdsChipVariant.SURFACE, ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
1487
|
+
}
|
|
1488
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsAutocompleteChipListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1489
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: IdsAutocompleteChipListComponent, isStandalone: true, selector: "ids-autocomplete-chip-list", inputs: { autocompleteTrigger: { classPropertyName: "autocompleteTrigger", publicName: "for", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ids-autocomplete-chip-list" }, ngImport: i0, template: `
|
|
1490
|
+
@for (option of autocompleteTrigger().selected; track $index) {
|
|
1491
|
+
<button
|
|
1492
|
+
idsChip
|
|
1493
|
+
type="button"
|
|
1494
|
+
[appearance]="appearance()"
|
|
1495
|
+
[size]="size()"
|
|
1496
|
+
[variant]="variant()"
|
|
1497
|
+
[disabled]="autocompleteTrigger().autocomplete().disabled()"
|
|
1498
|
+
[removable]="true"
|
|
1499
|
+
(removed)="autocompleteTrigger().removeOption(option)"
|
|
1500
|
+
>
|
|
1501
|
+
{{ option.viewValue }}
|
|
1502
|
+
</button>
|
|
1503
|
+
}
|
|
1504
|
+
`, isInline: true, dependencies: [{ kind: "component", type: IdsChipComponent, selector: "ids-chip, button[idsChip]", inputs: ["removable", "appearance", "size", "variant", "disabled", "tabIndex"], outputs: ["removed"] }] }); }
|
|
1505
|
+
}
|
|
1506
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsAutocompleteChipListComponent, decorators: [{
|
|
1507
|
+
type: Component,
|
|
1508
|
+
args: [{
|
|
1509
|
+
selector: 'ids-autocomplete-chip-list',
|
|
1510
|
+
host: {
|
|
1511
|
+
class: 'ids-autocomplete-chip-list',
|
|
1512
|
+
},
|
|
1513
|
+
imports: [IdsChipComponent],
|
|
1514
|
+
template: `
|
|
1515
|
+
@for (option of autocompleteTrigger().selected; track $index) {
|
|
1516
|
+
<button
|
|
1517
|
+
idsChip
|
|
1518
|
+
type="button"
|
|
1519
|
+
[appearance]="appearance()"
|
|
1520
|
+
[size]="size()"
|
|
1521
|
+
[variant]="variant()"
|
|
1522
|
+
[disabled]="autocompleteTrigger().autocomplete().disabled()"
|
|
1523
|
+
[removable]="true"
|
|
1524
|
+
(removed)="autocompleteTrigger().removeOption(option)"
|
|
1525
|
+
>
|
|
1526
|
+
{{ option.viewValue }}
|
|
1527
|
+
</button>
|
|
1528
|
+
}
|
|
1529
|
+
`,
|
|
1530
|
+
}]
|
|
1531
|
+
}], propDecorators: { autocompleteTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "for", required: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }] } });
|
|
1532
|
+
|
|
1533
|
+
class IdsAutocompleteHintComponent {
|
|
1534
|
+
constructor() {
|
|
1535
|
+
this.variant = input(IdsMessageVariant.SURFACE, ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
1536
|
+
this.size = input(IdsSize.COMFORTABLE, ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1537
|
+
}
|
|
1538
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsAutocompleteHintComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1539
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.5", type: IdsAutocompleteHintComponent, isStandalone: true, selector: "ids-autocomplete-hint", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ids-autocomplete-hint" }, ngImport: i0, template: `
|
|
1540
|
+
<div class="ids-autocomplete-hint__wrapper">
|
|
1541
|
+
<ids-hint-message [size]="size()" [variant]="variant()">
|
|
1542
|
+
<ng-content />
|
|
1543
|
+
</ids-hint-message>
|
|
1544
|
+
</div>
|
|
1545
|
+
`, isInline: true, dependencies: [{ kind: "component", type: IdsHintMessageComponent, selector: "ids-hint-message" }] }); }
|
|
1546
|
+
}
|
|
1547
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsAutocompleteHintComponent, decorators: [{
|
|
1548
|
+
type: Component,
|
|
1549
|
+
args: [{
|
|
1550
|
+
selector: 'ids-autocomplete-hint',
|
|
1551
|
+
host: {
|
|
1552
|
+
class: 'ids-autocomplete-hint',
|
|
1553
|
+
},
|
|
1554
|
+
imports: [IdsHintMessageComponent],
|
|
1555
|
+
template: `
|
|
1556
|
+
<div class="ids-autocomplete-hint__wrapper">
|
|
1557
|
+
<ids-hint-message [size]="size()" [variant]="variant()">
|
|
1558
|
+
<ng-content />
|
|
1559
|
+
</ids-hint-message>
|
|
1560
|
+
</div>
|
|
1561
|
+
`,
|
|
1562
|
+
}]
|
|
1563
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
1453
1564
|
|
|
1454
1565
|
class IdsFieldsetRowComponent extends ComponentBase {
|
|
1455
1566
|
constructor() {
|
|
1456
1567
|
super(...arguments);
|
|
1457
|
-
this._hostClasses = signal(this._getHostClasses([]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
|
|
1568
|
+
this._hostClasses = signal(this._getHostClasses([]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : /* istanbul ignore next */ []));
|
|
1458
1569
|
}
|
|
1459
1570
|
get _hostName() {
|
|
1460
1571
|
return 'fieldset-row';
|
|
1461
1572
|
}
|
|
1462
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1463
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1573
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFieldsetRowComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1574
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.5", type: IdsFieldsetRowComponent, isStandalone: true, selector: "ids-fieldset-row", usesInheritance: true, ngImport: i0, template: "<ng-content />\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1464
1575
|
}
|
|
1465
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1576
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsFieldsetRowComponent, decorators: [{
|
|
1466
1577
|
type: Component,
|
|
1467
1578
|
args: [{ selector: 'ids-fieldset-row', imports: [], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content />\n" }]
|
|
1468
1579
|
}] });
|
|
1469
1580
|
|
|
1581
|
+
const IDS_INPUT_DEFAULT_CONFIG = new InjectionToken('IDS_INPUT_DEFAULT_CONFIG', {
|
|
1582
|
+
providedIn: 'root',
|
|
1583
|
+
factory: IDS_INPUT_DEFAULT_CONFIG_FACTORY,
|
|
1584
|
+
});
|
|
1585
|
+
function IDS_INPUT_DEFAULT_CONFIG_FACTORY() {
|
|
1586
|
+
return {
|
|
1587
|
+
errorStateMatcher: ErrorStateMatcher,
|
|
1588
|
+
successStateMatcher: SuccessStateMatcher,
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
const defaultConfig = IDS_INPUT_DEFAULT_CONFIG_FACTORY();
|
|
1593
|
+
const IDS_INPUT_INVALID_TYPES = [
|
|
1594
|
+
'button',
|
|
1595
|
+
'checkbox',
|
|
1596
|
+
'file',
|
|
1597
|
+
'hidden',
|
|
1598
|
+
'image',
|
|
1599
|
+
'radio',
|
|
1600
|
+
'range',
|
|
1601
|
+
'reset',
|
|
1602
|
+
'submit',
|
|
1603
|
+
];
|
|
1604
|
+
class IdsInputDirective extends IdsFormFieldControl {
|
|
1605
|
+
constructor() {
|
|
1606
|
+
super(...arguments);
|
|
1607
|
+
this._elementRef = inject(ElementRef);
|
|
1608
|
+
this._defaultConfig = this._getDefaultConfig(defaultConfig, IDS_INPUT_DEFAULT_CONFIG);
|
|
1609
|
+
this._focused = false;
|
|
1610
|
+
this.name = input(...(ngDevMode ? [undefined, { debugName: "name" }] : /* istanbul ignore next */ []));
|
|
1611
|
+
this.type = input('text', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
1612
|
+
this.errorStateMatcher = input(inject(this._defaultConfig.errorStateMatcher), ...(ngDevMode ? [{ debugName: "errorStateMatcher" }] : /* istanbul ignore next */ []));
|
|
1613
|
+
this.successStateMatcher = input(inject(this._defaultConfig.successStateMatcher), ...(ngDevMode ? [{ debugName: "successStateMatcher" }] : /* istanbul ignore next */ []));
|
|
1614
|
+
this._hostClasses = computed(() => this._getHostClasses([], [formFieldControlClass]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : /* istanbul ignore next */ []));
|
|
1615
|
+
this._validateTypeEffect = effect(() => {
|
|
1616
|
+
this._validateType(this.type());
|
|
1617
|
+
}, ...(ngDevMode ? [{ debugName: "_validateTypeEffect" }] : /* istanbul ignore next */ []));
|
|
1618
|
+
/**
|
|
1619
|
+
* Should be an arrow function in order to handle `this` outside of this class
|
|
1620
|
+
*/
|
|
1621
|
+
this.onContainerClick = () => {
|
|
1622
|
+
if (!this._focused && !this.readonly() && !this.disabled()) {
|
|
1623
|
+
this.focus();
|
|
1624
|
+
}
|
|
1625
|
+
};
|
|
1626
|
+
}
|
|
1627
|
+
get _hostName() {
|
|
1628
|
+
return 'input';
|
|
1629
|
+
}
|
|
1630
|
+
ngAfterViewInit() {
|
|
1631
|
+
queueMicrotask(() => {
|
|
1632
|
+
const control = this.ngControl()?.control;
|
|
1633
|
+
if (control) {
|
|
1634
|
+
this._disabled.set(control.status === 'DISABLED');
|
|
1635
|
+
control.events.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((event) => this.updateControlState(event));
|
|
1636
|
+
}
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1639
|
+
_validateType(type) {
|
|
1640
|
+
if (isDevMode() && IDS_INPUT_INVALID_TYPES.indexOf(type) > -1) {
|
|
1641
|
+
throw this._createHostError(`Input type ${type} is not supportedby idsInput`);
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
focus(options) {
|
|
1645
|
+
this._elementRef.nativeElement.focus(options);
|
|
1646
|
+
}
|
|
1647
|
+
_focusChanged(isFocused) {
|
|
1648
|
+
if (isFocused !== this._focused) {
|
|
1649
|
+
this._focused = isFocused;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
updateControlState(event) {
|
|
1653
|
+
this._errorStateTracker?.updateErrorState();
|
|
1654
|
+
this._successStateTracker?.updateSuccessState();
|
|
1655
|
+
if (event instanceof StatusChangeEvent) {
|
|
1656
|
+
this._disabled.set(event.status === 'DISABLED');
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsInputDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1660
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.5", type: IdsInputDirective, isStandalone: true, selector: "input[idsInput][ngModel]:not([formControl]):not([formControlName]),\n input[idsInput][formControl]:not([ngModel]):not([formControlName]),\n input[idsInput][formControlName]:not([ngModel]):not([formControl]),\n textarea[idsInput][ngModel]:not([formControl]):not([formControlName]),\n textarea[idsInput][formControl]:not([ngModel]):not([formControlName]),\n textarea[idsInput][formControlName]:not([ngModel]):not([formControl])", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, errorStateMatcher: { classPropertyName: "errorStateMatcher", publicName: "errorStateMatcher", isSignal: true, isRequired: false, transformFunction: null }, successStateMatcher: { classPropertyName: "successStateMatcher", publicName: "successStateMatcher", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "focus": "_focusChanged(true)", "blur": "_focusChanged(false)" }, properties: { "attr.placeholder": "placeholder()", "attr.disabled": "disabled() ? \"\" : null", "attr.readonly": "readonly() ? \"\" : null" } }, providers: [
|
|
1661
|
+
{
|
|
1662
|
+
provide: IDS_FORM_FIELD_CONTROL,
|
|
1663
|
+
useExisting: IdsInputDirective,
|
|
1664
|
+
},
|
|
1665
|
+
], exportAs: ["idsInput"], usesInheritance: true, ngImport: i0 }); }
|
|
1666
|
+
}
|
|
1667
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsInputDirective, decorators: [{
|
|
1668
|
+
type: Directive,
|
|
1669
|
+
args: [{
|
|
1670
|
+
selector: `input[idsInput][ngModel]:not([formControl]):not([formControlName]),
|
|
1671
|
+
input[idsInput][formControl]:not([ngModel]):not([formControlName]),
|
|
1672
|
+
input[idsInput][formControlName]:not([ngModel]):not([formControl]),
|
|
1673
|
+
textarea[idsInput][ngModel]:not([formControl]):not([formControlName]),
|
|
1674
|
+
textarea[idsInput][formControl]:not([ngModel]):not([formControlName]),
|
|
1675
|
+
textarea[idsInput][formControlName]:not([ngModel]):not([formControl])`,
|
|
1676
|
+
exportAs: 'idsInput',
|
|
1677
|
+
standalone: true,
|
|
1678
|
+
providers: [
|
|
1679
|
+
{
|
|
1680
|
+
provide: IDS_FORM_FIELD_CONTROL,
|
|
1681
|
+
useExisting: IdsInputDirective,
|
|
1682
|
+
},
|
|
1683
|
+
],
|
|
1684
|
+
host: {
|
|
1685
|
+
'[attr.placeholder]': 'placeholder()',
|
|
1686
|
+
'[attr.disabled]': 'disabled() ? "" : null',
|
|
1687
|
+
'[attr.readonly]': 'readonly() ? "" : null',
|
|
1688
|
+
'(focus)': '_focusChanged(true)',
|
|
1689
|
+
'(blur)': '_focusChanged(false)',
|
|
1690
|
+
},
|
|
1691
|
+
}]
|
|
1692
|
+
}], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], errorStateMatcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorStateMatcher", required: false }] }], successStateMatcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "successStateMatcher", required: false }] }] } });
|
|
1693
|
+
|
|
1470
1694
|
const Message = {
|
|
1471
1695
|
HINT: 'hint',
|
|
1472
1696
|
ERROR: 'error',
|
|
@@ -1478,35 +1702,35 @@ class IdsOptionGroupComponent extends ComponentBase {
|
|
|
1478
1702
|
super(...arguments);
|
|
1479
1703
|
this._parent = inject(IDS_OPTION_PARENT_COMPONENT);
|
|
1480
1704
|
this._inert = this._parent?.inertGroups ?? false;
|
|
1481
|
-
this.label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
|
|
1482
|
-
this.disabled = input(false, ...(ngDevMode ?
|
|
1483
|
-
this._labelId = computed(() => `${this.id()}-label`, ...(ngDevMode ? [{ debugName: "_labelId" }] : []));
|
|
1705
|
+
this.label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1706
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanAttribute });
|
|
1707
|
+
this._labelId = computed(() => `${this.id()}-label`, ...(ngDevMode ? [{ debugName: "_labelId" }] : /* istanbul ignore next */ []));
|
|
1484
1708
|
this._hostClasses = computed(() => this._getHostClasses([
|
|
1485
1709
|
this.disabled() ? 'disabled' : null,
|
|
1486
1710
|
this._parent.parentSize(),
|
|
1487
1711
|
this._parent.parentVariant(),
|
|
1488
|
-
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
|
|
1712
|
+
]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : /* istanbul ignore next */ []));
|
|
1489
1713
|
}
|
|
1490
1714
|
get _hostName() {
|
|
1491
1715
|
return 'option-group';
|
|
1492
1716
|
}
|
|
1493
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1494
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
1717
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsOptionGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1718
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.5", type: IdsOptionGroupComponent, isStandalone: true, selector: "ids-option-group", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.role": "_inert ? null : \"group\"", "attr.aria-disabled": "_inert ? null : disabled().toString()", "attr.aria-labelledby": "_inert ? null : _labelId()" } }, providers: [{ provide: IDS_OPTION_GROUP, useExisting: IdsOptionGroupComponent }], usesInheritance: true, ngImport: i0, template: "<div role=\"presentation\" class=\"ids-option-group__label\" [id]=\"_labelId()\">\n <div class=\"ids-option-group__text\">{{ label() }}</div>\n</div>\n<ng-content select=\"ids-option, ng-container\" />\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1495
1719
|
}
|
|
1496
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1720
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsOptionGroupComponent, decorators: [{
|
|
1497
1721
|
type: Component,
|
|
1498
1722
|
args: [{ selector: 'ids-option-group', imports: [], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [{ provide: IDS_OPTION_GROUP, useExisting: IdsOptionGroupComponent }], host: {
|
|
1499
1723
|
'[attr.role]': '_inert ? null : "group"',
|
|
1500
1724
|
'[attr.aria-disabled]': '_inert ? null : disabled().toString()',
|
|
1501
1725
|
'[attr.aria-labelledby]': '_inert ? null : _labelId()',
|
|
1502
1726
|
}, template: "<div role=\"presentation\" class=\"ids-option-group__label\" [id]=\"_labelId()\">\n <div class=\"ids-option-group__text\">{{ label() }}</div>\n</div>\n<ng-content select=\"ids-option, ng-container\" />\n" }]
|
|
1503
|
-
}] });
|
|
1727
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
1504
1728
|
|
|
1505
1729
|
class IdsLabelDirective {
|
|
1506
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1507
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
1730
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1731
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.5", type: IdsLabelDirective, isStandalone: true, selector: "ids-label", ngImport: i0 }); }
|
|
1508
1732
|
}
|
|
1509
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1733
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: IdsLabelDirective, decorators: [{
|
|
1510
1734
|
type: Directive,
|
|
1511
1735
|
args: [{
|
|
1512
1736
|
selector: 'ids-label',
|
|
@@ -1518,5 +1742,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
|
|
|
1518
1742
|
* Generated bundle index. Do not edit.
|
|
1519
1743
|
*/
|
|
1520
1744
|
|
|
1521
|
-
export { AbstractErrorStateMatcher, AbstractSuccessStateMatcher, ErrorStateMatcher, ErrorStateTracker, IDS_AUTOCOMPLETE_DEFAULT_CONFIG, IDS_AUTOCOMPLETE_DEFAULT_CONFIG_FACTORY,
|
|
1745
|
+
export { AbstractErrorStateMatcher, AbstractSuccessStateMatcher, ErrorStateMatcher, ErrorStateTracker, IDS_AUTOCOMPLETE_DEFAULT_CONFIG, IDS_AUTOCOMPLETE_DEFAULT_CONFIG_FACTORY, IDS_FIELDSET_DEFAULT_CONFIG, IDS_FIELDSET_DEFAULT_CONFIG_FACTORY, IDS_FORM_FIELD_CONTROL, IDS_FORM_FIELD_DEFAULT_CONFIG, IDS_FORM_FIELD_DEFAULT_CONFIG_FACTORY, IDS_INPUT_DEFAULT_CONFIG, IDS_INPUT_DEFAULT_CONFIG_FACTORY, IDS_MESSAGE_DEFAULT_CONFIG, IDS_MESSAGE_DEFAULT_CONFIG_FACTORY, IDS_OPTION_GROUP, IDS_OPTION_PARENT_COMPONENT, IDS_PSEUDO_CHECKBOX_PARENT, IdsAutocompleteChipListComponent, IdsAutocompleteComponent, IdsAutocompleteHintComponent, IdsAutocompleteTriggerDirective, IdsErrorDefinitionDirective, IdsErrorMessageComponent, IdsFieldsetComponent, IdsFieldsetMessageDirective, IdsFieldsetRowComponent, IdsFormFieldActionDirective, IdsFormFieldComponent, IdsFormFieldControl, IdsFormFieldVariant, IdsHintMessageComponent, IdsInputDirective, IdsLabelDirective, IdsMessageDirective, IdsMessagePrefixDirective, IdsMessageSuffixDirective, IdsMessageVariant, IdsOptionComponent, IdsOptionGroupComponent, IdsOptionSelectionChange, IdsPrefixDirective, IdsPseudoCheckboxState, IdsSuccessMessageComponent, IdsSuffixDirective, IdsValidators, Message, PseudoCheckboxComponent, SuccessStateMatcher, SuccessStateTracker, _countGroupLabelsBeforeOption, _getOptionScrollPosition, formFieldControlClass, requiredFalseValidator, requiredTrueValidator, requiredValidator };
|
|
1522
1746
|
//# sourceMappingURL=i-cell-ids-angular-forms.mjs.map
|