@coolon/angular-ui-powerups 16.1.0-alpha.262 → 16.1.0-alpha.263
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/esm2022/lib/components/forms/select-input/select-input.component.mjs +190 -5
- package/esm2022/lib/interaction/components/input-activities/select-input-activity.mjs +1 -1
- package/fesm2022/coolon-angular-ui-powerups.mjs +188 -4
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/components/forms/select-input/select-input.component.d.ts +76 -4
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
|
|
10
10
|
import * as i3$1 from '@angular/material/input';
|
|
11
11
|
import { MatInputModule, MatInput } from '@angular/material/input';
|
|
12
12
|
import * as i4$2 from '@angular/material/select';
|
|
13
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
13
|
+
import { MatSelectModule, MatSelect } from '@angular/material/select';
|
|
14
14
|
import * as i3$2 from '@angular/material/tabs';
|
|
15
15
|
import { MatTabsModule, MAT_TABS_CONFIG } from '@angular/material/tabs';
|
|
16
16
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
@@ -2993,8 +2993,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
2993
2993
|
* <ng-template #selectedOptionTemplate let-option>{{option.thePropertyYouWant}} note, not used for nils (the placeholder is used)</ng-template>
|
|
2994
2994
|
* <ng-template #nilOptionTemplate>Uses the placeholder by default but you can customise it</ng-template>
|
|
2995
2995
|
* </aup-select_input>
|
|
2996
|
+
*
|
|
2997
|
+
* Searching (opt in, off by default so existing usages are unchanged):
|
|
2998
|
+
* <aup-select-input [value$]="myModel" [options]="myOptions" [searchable]="true"
|
|
2999
|
+
* searchPlaceholder="Find a hero…" noResultsText="No heros match"></aup-select-input>
|
|
3000
|
+
* A search box is rendered at the top of the dropdown panel and filters the options client side on
|
|
3001
|
+
* optionLabelFormat. Override {@link filterFactory} for different matching, and bind
|
|
3002
|
+
* {@link searchText$} to observe or pre-seed the text (it is cleared whenever the panel closes).
|
|
3003
|
+
* The nil option is never filtered - it is a clear-the-selection affordance, not a data option.
|
|
2996
3004
|
*/
|
|
2997
3005
|
class SelectInputComponent extends AbstractValueInputComponent {
|
|
3006
|
+
/** Keys the search box hands back to MatSelect's key manager instead of consuming itself. */
|
|
3007
|
+
static NAVIGATION_KEYS = new Set(['ArrowDown', 'ArrowUp', 'Tab', 'PageUp', 'PageDown']);
|
|
2998
3008
|
#options$_accessor_storage = proxify((ListModel));
|
|
2999
3009
|
get options$() { return this.#options$_accessor_storage; }
|
|
3000
3010
|
set options$(value) { this.#options$_accessor_storage = value; }
|
|
@@ -3007,9 +3017,51 @@ class SelectInputComponent extends AbstractValueInputComponent {
|
|
|
3007
3017
|
optionTemplateRef;
|
|
3008
3018
|
nilOptionTemplateRef;
|
|
3009
3019
|
optionLabelFormat = (option) => (option && this.optionLabel) ? option[this.optionLabel] : option;
|
|
3020
|
+
/** Opt-in: renders a search box at the top of the dropdown panel that filters the options. */
|
|
3021
|
+
searchable = false;
|
|
3022
|
+
/** Placeholder for the in-panel search box. {@link FormField} has no slot for this. */
|
|
3023
|
+
searchPlaceholder = 'Search…';
|
|
3024
|
+
/** Shown inside the panel when the search matches nothing. */
|
|
3025
|
+
noResultsText = 'No matches';
|
|
3026
|
+
#searchText$_accessor_storage = proxify((MutableValueModel));
|
|
3027
|
+
/** Bindable so a host can pre-seed or observe the search text. Cleared when the panel closes. */
|
|
3028
|
+
get searchText$() { return this.#searchText$_accessor_storage; }
|
|
3029
|
+
set searchText$(value) { this.#searchText$_accessor_storage = value; }
|
|
3030
|
+
/**
|
|
3031
|
+
* NOTE: deliberately NOT the AutocompleteInputComponent default - there an empty filter matches
|
|
3032
|
+
* nothing, here it must match everything or the panel opens blank. It also guards a nil or
|
|
3033
|
+
* non-string optionLabelFormat result, which the autocomplete version does not.
|
|
3034
|
+
*/
|
|
3035
|
+
filterFactory = (filterText) => {
|
|
3036
|
+
const needle = isString(filterText) ? filterText.trim().toLowerCase() : '';
|
|
3037
|
+
if (isEmpty(needle)) {
|
|
3038
|
+
return () => true;
|
|
3039
|
+
}
|
|
3040
|
+
return (option) => {
|
|
3041
|
+
const label = this.optionLabelFormat(option);
|
|
3042
|
+
return !isNil(label) && String(label).toLowerCase().includes(needle);
|
|
3043
|
+
};
|
|
3044
|
+
};
|
|
3010
3045
|
isNil$;
|
|
3011
3046
|
id$ = new MutableValueModel();
|
|
3012
3047
|
cookedOptions$;
|
|
3048
|
+
/** The options passing the current filter - drives the no-results state. */
|
|
3049
|
+
matchingOptions$;
|
|
3050
|
+
/**
|
|
3051
|
+
* What the panel renders: the matches, plus the selected option even when it does not match.
|
|
3052
|
+
* MatSelect renders `<span class="mat-mdc-select-placeholder">` instead of our <mat-select-trigger>
|
|
3053
|
+
* the moment its _selectionModel empties, so dropping the selected <mat-option> would blank the
|
|
3054
|
+
* field's displayed value while the user types. It is rendered disabled + display:none instead
|
|
3055
|
+
* (disabled is what MatSelect's keyManager skipPredicate reads, so arrow navigation skips it).
|
|
3056
|
+
*/
|
|
3057
|
+
panelOptions$;
|
|
3058
|
+
noMatches$;
|
|
3059
|
+
/** MatSelect._canOpen() refuses to open with zero options, so the filter is inert while closed. */
|
|
3060
|
+
panelOpen$ = new MutableValueModel(false);
|
|
3061
|
+
focusSearchPending = false;
|
|
3062
|
+
filterPredicate$;
|
|
3063
|
+
searchInputRef;
|
|
3064
|
+
matSelect;
|
|
3013
3065
|
delegatedIdentityOf = (item) => this.options$.identityOf(item);
|
|
3014
3066
|
trackByIdentity = (index, item) => this.delegatedIdentityOf(item) ?? index;
|
|
3015
3067
|
constructor() {
|
|
@@ -3022,10 +3074,122 @@ class SelectInputComponent extends AbstractValueInputComponent {
|
|
|
3022
3074
|
dependsOn: this.componentValue$
|
|
3023
3075
|
})
|
|
3024
3076
|
.identifiedWith(this.delegatedIdentityOf);
|
|
3077
|
+
// No debounce: the option list is local and panel sized. If a consumer ever hits lag, chaining
|
|
3078
|
+
// .debounce(250) onto searchText$ here is the escape hatch.
|
|
3079
|
+
this.filterPredicate$ = chain(this.searchText$).mapWithNil(text => this.filterFactory(text));
|
|
3080
|
+
// Filtering is chained AFTER cookedOptions$ so its "empty list -> [componentValue$.value]"
|
|
3081
|
+
// fallback fires on the raw list; a zero match search yields [] rather than a phantom option.
|
|
3082
|
+
this.matchingOptions$ = this.cookedOptions$.select(option => this.matchesSearch(option), {
|
|
3083
|
+
dependsOn: [this.filterPredicate$, this.panelOpen$]
|
|
3084
|
+
});
|
|
3085
|
+
this.panelOptions$ = this.cookedOptions$.select(option => this.matchesSearch(option) || this.isSelectedOption(option), {
|
|
3086
|
+
dependsOn: [this.filterPredicate$, this.panelOpen$, this.componentValue$]
|
|
3087
|
+
});
|
|
3088
|
+
this.noMatches$ = this.matchingOptions$.isEmpty();
|
|
3025
3089
|
}
|
|
3026
3090
|
select(item) {
|
|
3027
3091
|
this.id$.value = this.delegatedIdentityOf(item);
|
|
3028
3092
|
}
|
|
3093
|
+
/**
|
|
3094
|
+
* True when the option is only in {@link panelOptions$} to keep MatSelect's selection model
|
|
3095
|
+
* populated. The template renders it disabled and display:none.
|
|
3096
|
+
*/
|
|
3097
|
+
isHiddenOption(option) {
|
|
3098
|
+
return !this.matchesSearch(option);
|
|
3099
|
+
}
|
|
3100
|
+
/**
|
|
3101
|
+
* MatSelect's (opened)/(closed) outputs are driven by its panel animation: the template holds
|
|
3102
|
+
* [@transformPanel] at a constant 'showing', and ngOnInit pipes (@transformPanel.done) through
|
|
3103
|
+
* distinctUntilChanged(). When the CDK detaches the overlay before the leave animation completes
|
|
3104
|
+
* - which is exactly what its ESCAPE handling does - the 'void' is never emitted, so the next
|
|
3105
|
+
* open's 'showing' is deduped away and BOTH outputs silently stop firing for good. A stale filter
|
|
3106
|
+
* surviving a close would then wedge the select shut (MatSelect._canOpen() needs options.length),
|
|
3107
|
+
* so the panel state is tracked from _panelOpen, which open()/close() set synchronously.
|
|
3108
|
+
*/
|
|
3109
|
+
ngDoCheck() {
|
|
3110
|
+
const open = this.matSelect?.panelOpen ?? false;
|
|
3111
|
+
if (open === this.panelOpen$.value) {
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3114
|
+
this.panelOpen$.value = open;
|
|
3115
|
+
if (open) {
|
|
3116
|
+
this.focusSearchPending = true;
|
|
3117
|
+
}
|
|
3118
|
+
else {
|
|
3119
|
+
this.searchText$.value = undefined;
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
/** The search box only exists in the DOM once the overlay has attached, hence the retry flag. */
|
|
3123
|
+
ngAfterViewChecked() {
|
|
3124
|
+
const searchInput = this.searchInputRef?.nativeElement;
|
|
3125
|
+
if (this.focusSearchPending && searchInput?.isConnected) {
|
|
3126
|
+
this.focusSearchPending = false;
|
|
3127
|
+
searchInput.focus();
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
clearSearch() {
|
|
3131
|
+
this.searchText$.value = '';
|
|
3132
|
+
this.searchInputRef?.nativeElement.focus();
|
|
3133
|
+
}
|
|
3134
|
+
onSearchInput(event) {
|
|
3135
|
+
this.searchText$.value = event.target.value;
|
|
3136
|
+
}
|
|
3137
|
+
/**
|
|
3138
|
+
* MatSelect listens for keydown on the panel div and our search box sits inside it, so every
|
|
3139
|
+
* keystroke bubbles into _handleOpenKeydown. Everything the text box owns is stopped; the
|
|
3140
|
+
* navigation keys are let through to MatSelect's key manager. Because every printable key is
|
|
3141
|
+
* stopped, manager.isTyping() stays false - which is what makes MatSelect treat Enter as
|
|
3142
|
+
* "select the active option" rather than as part of its own typeahead.
|
|
3143
|
+
*/
|
|
3144
|
+
onSearchKeydown(event) {
|
|
3145
|
+
if (event.key === 'Escape') {
|
|
3146
|
+
// Handled here rather than by the CDK overlay's document-level ESCAPE listener, so focus
|
|
3147
|
+
// returns to the trigger instead of <body>, and so the component's existing (keydown.escape)
|
|
3148
|
+
// contract still fires (the panel is outside the mat-select element, so that binding can
|
|
3149
|
+
// never see this event).
|
|
3150
|
+
event.stopPropagation();
|
|
3151
|
+
event.preventDefault();
|
|
3152
|
+
this.notifyEscapeKey();
|
|
3153
|
+
this.matSelect?.close();
|
|
3154
|
+
this.matSelect?.focus();
|
|
3155
|
+
return;
|
|
3156
|
+
}
|
|
3157
|
+
if (event.key === 'Enter') {
|
|
3158
|
+
// Parity with the closed panel path, where (keydown.enter) on <mat-select> fires alongside
|
|
3159
|
+
// MatSelect's own Enter handling. Not stopped - MatSelect must still select the active option.
|
|
3160
|
+
this.notifyEnterKey();
|
|
3161
|
+
return;
|
|
3162
|
+
}
|
|
3163
|
+
if (SelectInputComponent.NAVIGATION_KEYS.has(event.key)) {
|
|
3164
|
+
return;
|
|
3165
|
+
}
|
|
3166
|
+
// Printable characters (MatSelect's letter typeahead), Space (selects the active option) and
|
|
3167
|
+
// Home/End (jump the active option) all belong to the text box.
|
|
3168
|
+
event.stopPropagation();
|
|
3169
|
+
}
|
|
3170
|
+
// Focusing the in-panel search box blurs the trigger. That is an implementation detail of the
|
|
3171
|
+
// dropdown, not the user leaving the field, so the focus/blur commands are suppressed while open.
|
|
3172
|
+
notifyFocusIn() {
|
|
3173
|
+
if (!this.panelOpen$.value) {
|
|
3174
|
+
super.notifyFocusIn();
|
|
3175
|
+
}
|
|
3176
|
+
}
|
|
3177
|
+
notifyFocusOut() {
|
|
3178
|
+
if (!this.panelOpen$.value) {
|
|
3179
|
+
super.notifyFocusOut();
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
matchesSearch(option) {
|
|
3183
|
+
if (!this.searchable || !this.panelOpen$.value) {
|
|
3184
|
+
return true;
|
|
3185
|
+
}
|
|
3186
|
+
const predicate = this.filterPredicate$.value;
|
|
3187
|
+
return !predicate || predicate(option);
|
|
3188
|
+
}
|
|
3189
|
+
isSelectedOption(option) {
|
|
3190
|
+
const selected = this.componentValue$.value;
|
|
3191
|
+
return !isNil(selected) && this.delegatedIdentityOf(option) === this.delegatedIdentityOf(selected);
|
|
3192
|
+
}
|
|
3029
3193
|
ngOnInit() {
|
|
3030
3194
|
super.ngOnInit();
|
|
3031
3195
|
// NOTE: this has to be done after our parameter have been bound or we'll clobber the initial selected values with the writeRight
|
|
@@ -3069,7 +3233,7 @@ class SelectInputComponent extends AbstractValueInputComponent {
|
|
|
3069
3233
|
});
|
|
3070
3234
|
}
|
|
3071
3235
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SelectInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3072
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: SelectInputComponent, selector: "aup-select-input", inputs: { options$: "options$", options: "options", optionLabel: "optionLabel", allowNil: "allowNil", optionLabelFormat: "optionLabelFormat" }, queries: [{ propertyName: "selectedOptionTemplateRef", first: true, predicate: ["selectedOptionTemplate"], descendants: true }, { propertyName: "optionTemplateRef", first: true, predicate: ["optionTemplate"], descendants: true }, { propertyName: "nilOptionTemplateRef", first: true, predicate: ["nilOptionTemplate"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<mat-form-field [floatLabel]=\"floatLabel\" subscriptSizing=\"dynamic\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [ngModel]=\"componentValue$.value\"\n (ngModelChange)=\"select($event)\"\n [disabled]=\"!enabled$.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n\n <!--\n TODO: dave has a scenario where the selected item isn't rendering that I can't reproduce so we explicity render it..\n It typically happens because the ngModel value isn't the one contained in the list - this means our source model\n identifyOf function has changed and our id$/lookup$/componentValue$ are out of sync.\n We get around this for now by explicity rendering the component value.\n Please Note: I haven't been able to reproduce this\n -->\n <mat-select-trigger *ngIf=\"!selectedOptionTemplateRef\">\n {{optionLabelFormat(componentValue$.value)}}\n </mat-select-trigger>\n\n <mat-select-trigger *ngIf=\"selectedOptionTemplateRef\">\n <ng-container [ngTemplateOutlet]=\"selectedOptionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: componentValue$.value}\"></ng-container>\n </mat-select-trigger>\n\n <mat-option *ngIf=\"allowNil\">\n <ng-container *ngIf=\"!nilOptionTemplateRef\">{{placeholder}}</ng-container>\n <ng-container *ngIf=\"nilOptionTemplateRef\" [ngTemplateOutlet]=\"nilOptionTemplateRef\"></ng-container>\n </mat-option>\n <mat-option *ngFor=\"let option of
|
|
3236
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: SelectInputComponent, selector: "aup-select-input", inputs: { options$: "options$", options: "options", optionLabel: "optionLabel", allowNil: "allowNil", optionLabelFormat: "optionLabelFormat", searchable: "searchable", searchPlaceholder: "searchPlaceholder", noResultsText: "noResultsText", searchText$: "searchText$", filterFactory: "filterFactory" }, queries: [{ propertyName: "selectedOptionTemplateRef", first: true, predicate: ["selectedOptionTemplate"], descendants: true }, { propertyName: "optionTemplateRef", first: true, predicate: ["optionTemplate"], descendants: true }, { propertyName: "nilOptionTemplateRef", first: true, predicate: ["nilOptionTemplate"], descendants: true }], viewQueries: [{ propertyName: "searchInputRef", first: true, predicate: ["searchInput"], descendants: true }, { propertyName: "matSelect", first: true, predicate: MatSelect, descendants: true }], usesInheritance: true, ngImport: i0, template: "<mat-form-field [floatLabel]=\"floatLabel\" subscriptSizing=\"dynamic\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [ngModel]=\"componentValue$.value\"\n (ngModelChange)=\"select($event)\"\n [disabled]=\"!enabled$.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n\n <!--\n TODO: dave has a scenario where the selected item isn't rendering that I can't reproduce so we explicity render it..\n It typically happens because the ngModel value isn't the one contained in the list - this means our source model\n identifyOf function has changed and our id$/lookup$/componentValue$ are out of sync.\n We get around this for now by explicity rendering the component value.\n Please Note: I haven't been able to reproduce this\n -->\n <mat-select-trigger *ngIf=\"!selectedOptionTemplateRef\">\n {{optionLabelFormat(componentValue$.value)}}\n </mat-select-trigger>\n\n <mat-select-trigger *ngIf=\"selectedOptionTemplateRef\">\n <ng-container [ngTemplateOutlet]=\"selectedOptionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: componentValue$.value}\"></ng-container>\n </mat-select-trigger>\n\n <div class=\"aup-select-search\" *ngIf=\"searchable\"\n (keydown)=\"onSearchKeydown($event)\"\n (click)=\"$event.stopPropagation()\">\n <aup-icon class=\"aup-select-search__icon\" icon=\"mat:search\"></aup-icon>\n <!--\n Deliberately a bare input: matInput outside a mat-form-field is a MatFormFieldControl with no\n host, and aup-search-input drags in a whole form field (label slot, subscript row,\n .aup-input-component density) that has no business inside a dropdown panel.\n [value]/(input) rather than ngModel avoids a missing-name error inside a host <form>.\n -->\n <input #searchInput type=\"text\" class=\"aup-select-search__input\"\n data-cy=\"select-search\"\n autocomplete=\"off\"\n [placeholder]=\"searchPlaceholder\"\n [attr.aria-label]=\"searchPlaceholder\"\n [value]=\"searchText$.value || ''\"\n (input)=\"onSearchInput($event)\">\n <button type=\"button\" class=\"aup-select-search__clear\" tabindex=\"-1\"\n *ngIf=\"searchText$.value\" data-cy=\"select-search-clear\"\n (click)=\"clearSearch()\">\n <aup-icon icon=\"mat:close\"></aup-icon>\n </button>\n </div>\n\n <!--\n Deliberately outside the filter: the nil option is a clear-the-selection affordance, not one of\n the data options, so it stays available while searching (and keeps MatSelect._canOpen() happy).\n -->\n <mat-option *ngIf=\"allowNil\">\n <ng-container *ngIf=\"!nilOptionTemplateRef\">{{placeholder}}</ng-container>\n <ng-container *ngIf=\"nilOptionTemplateRef\" [ngTemplateOutlet]=\"nilOptionTemplateRef\"></ng-container>\n </mat-option>\n <mat-option *ngFor=\"let option of panelOptions$.value; trackBy: trackByIdentity;let i = index\"\n [value]=\"option\"\n [disabled]=\"isHiddenOption(option)\"\n [class.aup-select-option--filtered]=\"isHiddenOption(option)\">\n <ng-container *ngIf=\"!optionTemplateRef\">{{optionLabelFormat(option)}}</ng-container>\n <ng-container *ngIf=\"optionTemplateRef\"\n [ngTemplateOutlet]=\"optionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: i }\"\n >\n </ng-container>\n </mat-option>\n <!--\n A plain div, NOT a mat-option: a mat-option here would be selectable, and would keep\n MatSelect._canOpen() satisfied with a row that means \"nothing\".\n -->\n <div class=\"aup-select-search__no-results\" data-cy=\"select-no-results\"\n *ngIf=\"searchable && noMatches$.value\">{{noResultsText}}</div>\n <ng-content select=\"[select-option-footer]\"></ng-content>\n </mat-select>\n <mat-hint *ngIf=\"inlineHintText\" [ngClass]=\"inlineHintClass\">{{inlineHintText}}</mat-hint>\n <mat-error *ngIf=\"inlineError\">{{inlineError}}</mat-error>\n <span matSuffix class=\"aup-validation-icon\" *ngIf=\"popupMessage\">\n <aup-icon data-cy=\"validation-icon\"\n [icon]=\"popupIcon\" [ngClass]=\"popupSeverityClass\"\n [aupTooltip]=\"popupMessage\" aupTooltipPosition=\"above\"></aup-icon>\n </span>\n</mat-form-field>\n<div class=\"width-strut\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <div class=\"item\" *ngFor=\"let item of cookedOptions$.value\">\n <ng-container *ngIf=\"!optionTemplateRef\">{{optionLabelFormat(item)}}</ng-container>\n <ng-container *ngIf=\"optionTemplateRef\"\n [ngTemplateOutlet]=\"optionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item, index: 0 }\"\n >\n </ng-container>\n </div>\n</div>\n", styles: [":host{display:inline-block}mat-form-field{width:100%}.width-strut{display:block;height:0;max-height:0;width:auto;visibility:hidden;overflow:hidden;padding-right:35px}.width-strut mat-label{font-size:75%}.width-strut>.item{font-size:16px;padding-left:0}.aup-select-search{position:sticky;top:-8px;z-index:1;display:flex;align-items:center;gap:4px;margin:-8px 0 4px;padding:8px 12px;background:var(--mat-select-panel-background-color, #fff);border-bottom:1px solid rgba(0,0,0,.12)}.aup-select-search .aup-select-search__input{flex:1 1 auto;min-width:0;border:none;outline:none;background:transparent;font:inherit;color:inherit}.aup-select-search .aup-select-search__clear{flex:0 0 auto;display:inline-flex;padding:0;border:none;background:transparent;cursor:pointer;color:inherit}.aup-select-search__no-results{padding:8px 16px;opacity:.6;font-style:italic}mat-option.aup-select-option--filtered{display:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i4$2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "panelWidth", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "directive", type: i4$2.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i5.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: AupTooltipDirective, selector: "[aupTooltip]", inputs: ["aupTooltip", "aupTooltipPosition", "aupTooltipPositionAtOrigin", "aupTooltipDisabled", "aupTooltipShowDelay", "aupTooltipHideDelay", "aupTooltipTouchGestures", "aupTooltipClass"], exportAs: ["aupTooltip"] }, { kind: "directive", type: FocusBindingDirective, selector: "[pectinFocusBinding]", inputs: ["pectinFocusBinding", "focusBindingTarget"] }, { kind: "component", type: IconComponent, selector: "aup-icon", inputs: ["icon"] }] });
|
|
3073
3237
|
}
|
|
3074
3238
|
__decorate([
|
|
3075
3239
|
Proxify(),
|
|
@@ -3079,9 +3243,13 @@ __decorate([
|
|
|
3079
3243
|
StoreInListModel(),
|
|
3080
3244
|
__metadata("design:type", Array)
|
|
3081
3245
|
], SelectInputComponent.prototype, "options", null);
|
|
3246
|
+
__decorate([
|
|
3247
|
+
Proxify(),
|
|
3248
|
+
__metadata("design:type", Object)
|
|
3249
|
+
], SelectInputComponent.prototype, "searchText$", null);
|
|
3082
3250
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SelectInputComponent, decorators: [{
|
|
3083
3251
|
type: Component,
|
|
3084
|
-
args: [{ selector: 'aup-select-input', template: "<mat-form-field [floatLabel]=\"floatLabel\" subscriptSizing=\"dynamic\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [ngModel]=\"componentValue$.value\"\n (ngModelChange)=\"select($event)\"\n [disabled]=\"!enabled$.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n\n <!--\n TODO: dave has a scenario where the selected item isn't rendering that I can't reproduce so we explicity render it..\n It typically happens because the ngModel value isn't the one contained in the list - this means our source model\n identifyOf function has changed and our id$/lookup$/componentValue$ are out of sync.\n We get around this for now by explicity rendering the component value.\n Please Note: I haven't been able to reproduce this\n -->\n <mat-select-trigger *ngIf=\"!selectedOptionTemplateRef\">\n {{optionLabelFormat(componentValue$.value)}}\n </mat-select-trigger>\n\n <mat-select-trigger *ngIf=\"selectedOptionTemplateRef\">\n <ng-container [ngTemplateOutlet]=\"selectedOptionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: componentValue$.value}\"></ng-container>\n </mat-select-trigger>\n\n <mat-option *ngIf=\"allowNil\">\n <ng-container *ngIf=\"!nilOptionTemplateRef\">{{placeholder}}</ng-container>\n <ng-container *ngIf=\"nilOptionTemplateRef\" [ngTemplateOutlet]=\"nilOptionTemplateRef\"></ng-container>\n </mat-option>\n <mat-option *ngFor=\"let option of
|
|
3252
|
+
args: [{ selector: 'aup-select-input', template: "<mat-form-field [floatLabel]=\"floatLabel\" subscriptSizing=\"dynamic\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [ngModel]=\"componentValue$.value\"\n (ngModelChange)=\"select($event)\"\n [disabled]=\"!enabled$.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n\n <!--\n TODO: dave has a scenario where the selected item isn't rendering that I can't reproduce so we explicity render it..\n It typically happens because the ngModel value isn't the one contained in the list - this means our source model\n identifyOf function has changed and our id$/lookup$/componentValue$ are out of sync.\n We get around this for now by explicity rendering the component value.\n Please Note: I haven't been able to reproduce this\n -->\n <mat-select-trigger *ngIf=\"!selectedOptionTemplateRef\">\n {{optionLabelFormat(componentValue$.value)}}\n </mat-select-trigger>\n\n <mat-select-trigger *ngIf=\"selectedOptionTemplateRef\">\n <ng-container [ngTemplateOutlet]=\"selectedOptionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: componentValue$.value}\"></ng-container>\n </mat-select-trigger>\n\n <div class=\"aup-select-search\" *ngIf=\"searchable\"\n (keydown)=\"onSearchKeydown($event)\"\n (click)=\"$event.stopPropagation()\">\n <aup-icon class=\"aup-select-search__icon\" icon=\"mat:search\"></aup-icon>\n <!--\n Deliberately a bare input: matInput outside a mat-form-field is a MatFormFieldControl with no\n host, and aup-search-input drags in a whole form field (label slot, subscript row,\n .aup-input-component density) that has no business inside a dropdown panel.\n [value]/(input) rather than ngModel avoids a missing-name error inside a host <form>.\n -->\n <input #searchInput type=\"text\" class=\"aup-select-search__input\"\n data-cy=\"select-search\"\n autocomplete=\"off\"\n [placeholder]=\"searchPlaceholder\"\n [attr.aria-label]=\"searchPlaceholder\"\n [value]=\"searchText$.value || ''\"\n (input)=\"onSearchInput($event)\">\n <button type=\"button\" class=\"aup-select-search__clear\" tabindex=\"-1\"\n *ngIf=\"searchText$.value\" data-cy=\"select-search-clear\"\n (click)=\"clearSearch()\">\n <aup-icon icon=\"mat:close\"></aup-icon>\n </button>\n </div>\n\n <!--\n Deliberately outside the filter: the nil option is a clear-the-selection affordance, not one of\n the data options, so it stays available while searching (and keeps MatSelect._canOpen() happy).\n -->\n <mat-option *ngIf=\"allowNil\">\n <ng-container *ngIf=\"!nilOptionTemplateRef\">{{placeholder}}</ng-container>\n <ng-container *ngIf=\"nilOptionTemplateRef\" [ngTemplateOutlet]=\"nilOptionTemplateRef\"></ng-container>\n </mat-option>\n <mat-option *ngFor=\"let option of panelOptions$.value; trackBy: trackByIdentity;let i = index\"\n [value]=\"option\"\n [disabled]=\"isHiddenOption(option)\"\n [class.aup-select-option--filtered]=\"isHiddenOption(option)\">\n <ng-container *ngIf=\"!optionTemplateRef\">{{optionLabelFormat(option)}}</ng-container>\n <ng-container *ngIf=\"optionTemplateRef\"\n [ngTemplateOutlet]=\"optionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: i }\"\n >\n </ng-container>\n </mat-option>\n <!--\n A plain div, NOT a mat-option: a mat-option here would be selectable, and would keep\n MatSelect._canOpen() satisfied with a row that means \"nothing\".\n -->\n <div class=\"aup-select-search__no-results\" data-cy=\"select-no-results\"\n *ngIf=\"searchable && noMatches$.value\">{{noResultsText}}</div>\n <ng-content select=\"[select-option-footer]\"></ng-content>\n </mat-select>\n <mat-hint *ngIf=\"inlineHintText\" [ngClass]=\"inlineHintClass\">{{inlineHintText}}</mat-hint>\n <mat-error *ngIf=\"inlineError\">{{inlineError}}</mat-error>\n <span matSuffix class=\"aup-validation-icon\" *ngIf=\"popupMessage\">\n <aup-icon data-cy=\"validation-icon\"\n [icon]=\"popupIcon\" [ngClass]=\"popupSeverityClass\"\n [aupTooltip]=\"popupMessage\" aupTooltipPosition=\"above\"></aup-icon>\n </span>\n</mat-form-field>\n<div class=\"width-strut\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <div class=\"item\" *ngFor=\"let item of cookedOptions$.value\">\n <ng-container *ngIf=\"!optionTemplateRef\">{{optionLabelFormat(item)}}</ng-container>\n <ng-container *ngIf=\"optionTemplateRef\"\n [ngTemplateOutlet]=\"optionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item, index: 0 }\"\n >\n </ng-container>\n </div>\n</div>\n", styles: [":host{display:inline-block}mat-form-field{width:100%}.width-strut{display:block;height:0;max-height:0;width:auto;visibility:hidden;overflow:hidden;padding-right:35px}.width-strut mat-label{font-size:75%}.width-strut>.item{font-size:16px;padding-left:0}.aup-select-search{position:sticky;top:-8px;z-index:1;display:flex;align-items:center;gap:4px;margin:-8px 0 4px;padding:8px 12px;background:var(--mat-select-panel-background-color, #fff);border-bottom:1px solid rgba(0,0,0,.12)}.aup-select-search .aup-select-search__input{flex:1 1 auto;min-width:0;border:none;outline:none;background:transparent;font:inherit;color:inherit}.aup-select-search .aup-select-search__clear{flex:0 0 auto;display:inline-flex;padding:0;border:none;background:transparent;cursor:pointer;color:inherit}.aup-select-search__no-results{padding:8px 16px;opacity:.6;font-style:italic}mat-option.aup-select-option--filtered{display:none}\n"] }]
|
|
3085
3253
|
}], ctorParameters: function () { return []; }, propDecorators: { options$: [{
|
|
3086
3254
|
type: Input
|
|
3087
3255
|
}], options: [{
|
|
@@ -3101,6 +3269,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
3101
3269
|
args: ['nilOptionTemplate']
|
|
3102
3270
|
}], optionLabelFormat: [{
|
|
3103
3271
|
type: Input
|
|
3272
|
+
}], searchable: [{
|
|
3273
|
+
type: Input
|
|
3274
|
+
}], searchPlaceholder: [{
|
|
3275
|
+
type: Input
|
|
3276
|
+
}], noResultsText: [{
|
|
3277
|
+
type: Input
|
|
3278
|
+
}], searchText$: [{
|
|
3279
|
+
type: Input
|
|
3280
|
+
}], filterFactory: [{
|
|
3281
|
+
type: Input
|
|
3282
|
+
}], searchInputRef: [{
|
|
3283
|
+
type: ViewChild,
|
|
3284
|
+
args: ['searchInput']
|
|
3285
|
+
}], matSelect: [{
|
|
3286
|
+
type: ViewChild,
|
|
3287
|
+
args: [MatSelect]
|
|
3104
3288
|
}] } });
|
|
3105
3289
|
|
|
3106
3290
|
class StringInputComponent extends AbstractValueInputComponent {
|
|
@@ -11904,7 +12088,7 @@ class SelectInputActivity extends InputActivity {
|
|
|
11904
12088
|
[confirmFace]="confirmFace"
|
|
11905
12089
|
[cancelFace]="cancelFace"
|
|
11906
12090
|
></aup-activity-actions>
|
|
11907
|
-
`, isInline: true, styles: [":host{--activity-actions-gap: 0}:host .aup-input-component{flex:1}:host[layout=inline]{padding-right:0}:host[layout=block]{padding-bottom:0}\n"], dependencies: [{ kind: "component", type: SelectInputComponent, selector: "aup-select-input", inputs: ["options$", "options", "optionLabel", "allowNil", "optionLabelFormat"] }, { kind: "component", type: ActivityActionsComponent, selector: "aup-activity-actions", inputs: ["confirmCommand", "cancelCommand", "faces", "confirmFace", "cancelFace", "style", "layout", "align", "alignContent"] }] });
|
|
12091
|
+
`, isInline: true, styles: [":host{--activity-actions-gap: 0}:host .aup-input-component{flex:1}:host[layout=inline]{padding-right:0}:host[layout=block]{padding-bottom:0}\n"], dependencies: [{ kind: "component", type: SelectInputComponent, selector: "aup-select-input", inputs: ["options$", "options", "optionLabel", "allowNil", "optionLabelFormat", "searchable", "searchPlaceholder", "noResultsText", "searchText$", "filterFactory"] }, { kind: "component", type: ActivityActionsComponent, selector: "aup-activity-actions", inputs: ["confirmCommand", "cancelCommand", "faces", "confirmFace", "cancelFace", "style", "layout", "align", "alignContent"] }] });
|
|
11908
12092
|
}
|
|
11909
12093
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SelectInputActivity, decorators: [{
|
|
11910
12094
|
type: Component,
|