@coolon/angular-ui-powerups 16.1.0-alpha.260 → 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/components/icon/icon.component.mjs +27 -8
- package/esm2022/lib/interaction/components/input-activities/select-input-activity.mjs +1 -1
- package/fesm2022/coolon-angular-ui-powerups.mjs +214 -11
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/components/forms/select-input/select-input.component.d.ts +76 -4
- package/lib/components/icon/icon.component.d.ts +12 -1
- package/package.json +2 -2
|
@@ -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';
|
|
@@ -1032,25 +1032,26 @@ class IconComponent {
|
|
|
1032
1032
|
_icon;
|
|
1033
1033
|
prefix;
|
|
1034
1034
|
suffix;
|
|
1035
|
+
/** Undefined when the icon is fine — see describeProblemWith. */
|
|
1035
1036
|
errorMessage;
|
|
1036
1037
|
allowedPrefixes = Enum.values(IconComponent.IconPrefix).map(p => `${p}:`);
|
|
1037
1038
|
iconPrefix = IconComponent.IconPrefix;
|
|
1038
1039
|
set icon(iconName) {
|
|
1039
1040
|
this._icon = iconName;
|
|
1041
|
+
// Cleared up front: a name with no colon used to leave the previous prefix and suffix in
|
|
1042
|
+
// place, so the component carried on rendering the icon it was showing before.
|
|
1043
|
+
this.prefix = undefined;
|
|
1044
|
+
this.suffix = undefined;
|
|
1040
1045
|
if (!iconName) {
|
|
1041
1046
|
this.errorMessage = 'icon is nil';
|
|
1042
|
-
this.prefix = undefined;
|
|
1043
1047
|
return;
|
|
1044
1048
|
}
|
|
1045
1049
|
const colonIndex = iconName.indexOf(':');
|
|
1046
1050
|
if (colonIndex > 0) {
|
|
1047
|
-
this.prefix =
|
|
1048
|
-
this.suffix =
|
|
1051
|
+
this.prefix = iconName.slice(0, colonIndex);
|
|
1052
|
+
this.suffix = iconName.slice(colonIndex + 1);
|
|
1049
1053
|
}
|
|
1050
|
-
|
|
1051
|
-
this.errorMessage = `Unknown icon "${iconName}"`;
|
|
1052
|
-
}
|
|
1053
|
-
this.errorMessage = `Unknown icon prefix, expected one of [${this.allowedPrefixes.join(',')}] got "${this.prefix}:"`;
|
|
1054
|
+
this.errorMessage = this.describeProblemWith(iconName);
|
|
1054
1055
|
}
|
|
1055
1056
|
get icon() {
|
|
1056
1057
|
return this._icon;
|
|
@@ -1058,6 +1059,24 @@ class IconComponent {
|
|
|
1058
1059
|
get faIcon() {
|
|
1059
1060
|
return `fa-${this.suffix}`;
|
|
1060
1061
|
}
|
|
1062
|
+
/**
|
|
1063
|
+
* The tooltip on the bug_report fallback, or undefined when the icon is fine.
|
|
1064
|
+
*
|
|
1065
|
+
* Note this only catches a missing or unrecognised *prefix* — a known prefix with a name that
|
|
1066
|
+
* doesn't exist ("mat:no_such_icon") renders down its normal branch and cannot be detected
|
|
1067
|
+
* without asking Material's registry. The message this used to build for that case was
|
|
1068
|
+
* unreachable: it was assigned and then unconditionally overwritten on the next line, so every
|
|
1069
|
+
* icon, valid ones included, ended up carrying the unknown-prefix text.
|
|
1070
|
+
*/
|
|
1071
|
+
describeProblemWith(iconName) {
|
|
1072
|
+
const expected = `expected one of [${this.allowedPrefixes.join(',')}]`;
|
|
1073
|
+
if (!this.prefix) {
|
|
1074
|
+
return `Icon "${iconName}" has no prefix, ${expected}`;
|
|
1075
|
+
}
|
|
1076
|
+
return this.allowedPrefixes.includes(`${this.prefix}:`)
|
|
1077
|
+
? undefined
|
|
1078
|
+
: `Unknown icon prefix "${this.prefix}:", ${expected}`;
|
|
1079
|
+
}
|
|
1061
1080
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1062
1081
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: IconComponent, selector: "aup-icon", inputs: { icon: "icon" }, host: { properties: { "attr.icon": "this.icon" }, classAttribute: "mat-icon" }, ngImport: i0, template: "<ng-container [ngSwitch]=\"prefix\">\n\n <mat-icon *ngSwitchCase=\"iconPrefix.SVG\"\n [svgIcon]=\"suffix\"\n class=\"svgIcon\">\n </mat-icon>\n\n <mat-icon *ngSwitchCase=\"iconPrefix.MATERIAL\">\n {{suffix}}\n </mat-icon>\n\n <div *ngSwitchCase=\"iconPrefix.FONT_AWESOME\" class=\"faIconWrapper\">\n <i class=\"fa-solid\" [class]=\"faIcon\"></i>\n </div>\n\n <mat-icon *ngSwitchDefault\n [matTooltip]=\"errorMessage\">\n bug_report\n </mat-icon>\n\n</ng-container>\n\n", styles: [":host{display:inline-flex;--resolved-size: var(--aup-icon-size, 24px);width:var(--resolved-size)!important;min-width:var(--resolved-size)!important;height:var(--resolved-size)!important;min-height:var(--resolved-size)!important}:host fa-icon{vertical-align:middle}:host .faIconWrapper{display:flex;flex-direction:row;align-items:center;justify-content:center;width:var(--resolved-size)!important;height:var(--resolved-size)!important}:host .svgIcon{width:var(--resolved-size)!important;height:var(--resolved-size)!important}:host :host(.mat-chip-remove){--aup-icon-size: 18px}:host mat-icon{font-size:var(--resolved-size)!important;width:var(--resolved-size)!important;height:var(--resolved-size)!important;margin-right:0!important}\n"], dependencies: [{ kind: "directive", type: i1$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i2$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1063
1082
|
}
|
|
@@ -2974,8 +2993,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
2974
2993
|
* <ng-template #selectedOptionTemplate let-option>{{option.thePropertyYouWant}} note, not used for nils (the placeholder is used)</ng-template>
|
|
2975
2994
|
* <ng-template #nilOptionTemplate>Uses the placeholder by default but you can customise it</ng-template>
|
|
2976
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.
|
|
2977
3004
|
*/
|
|
2978
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']);
|
|
2979
3008
|
#options$_accessor_storage = proxify((ListModel));
|
|
2980
3009
|
get options$() { return this.#options$_accessor_storage; }
|
|
2981
3010
|
set options$(value) { this.#options$_accessor_storage = value; }
|
|
@@ -2988,9 +3017,51 @@ class SelectInputComponent extends AbstractValueInputComponent {
|
|
|
2988
3017
|
optionTemplateRef;
|
|
2989
3018
|
nilOptionTemplateRef;
|
|
2990
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
|
+
};
|
|
2991
3045
|
isNil$;
|
|
2992
3046
|
id$ = new MutableValueModel();
|
|
2993
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;
|
|
2994
3065
|
delegatedIdentityOf = (item) => this.options$.identityOf(item);
|
|
2995
3066
|
trackByIdentity = (index, item) => this.delegatedIdentityOf(item) ?? index;
|
|
2996
3067
|
constructor() {
|
|
@@ -3003,10 +3074,122 @@ class SelectInputComponent extends AbstractValueInputComponent {
|
|
|
3003
3074
|
dependsOn: this.componentValue$
|
|
3004
3075
|
})
|
|
3005
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();
|
|
3006
3089
|
}
|
|
3007
3090
|
select(item) {
|
|
3008
3091
|
this.id$.value = this.delegatedIdentityOf(item);
|
|
3009
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
|
+
}
|
|
3010
3193
|
ngOnInit() {
|
|
3011
3194
|
super.ngOnInit();
|
|
3012
3195
|
// NOTE: this has to be done after our parameter have been bound or we'll clobber the initial selected values with the writeRight
|
|
@@ -3050,7 +3233,7 @@ class SelectInputComponent extends AbstractValueInputComponent {
|
|
|
3050
3233
|
});
|
|
3051
3234
|
}
|
|
3052
3235
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SelectInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3053
|
-
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"] }] });
|
|
3054
3237
|
}
|
|
3055
3238
|
__decorate([
|
|
3056
3239
|
Proxify(),
|
|
@@ -3060,9 +3243,13 @@ __decorate([
|
|
|
3060
3243
|
StoreInListModel(),
|
|
3061
3244
|
__metadata("design:type", Array)
|
|
3062
3245
|
], SelectInputComponent.prototype, "options", null);
|
|
3246
|
+
__decorate([
|
|
3247
|
+
Proxify(),
|
|
3248
|
+
__metadata("design:type", Object)
|
|
3249
|
+
], SelectInputComponent.prototype, "searchText$", null);
|
|
3063
3250
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SelectInputComponent, decorators: [{
|
|
3064
3251
|
type: Component,
|
|
3065
|
-
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"] }]
|
|
3066
3253
|
}], ctorParameters: function () { return []; }, propDecorators: { options$: [{
|
|
3067
3254
|
type: Input
|
|
3068
3255
|
}], options: [{
|
|
@@ -3082,6 +3269,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
3082
3269
|
args: ['nilOptionTemplate']
|
|
3083
3270
|
}], optionLabelFormat: [{
|
|
3084
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]
|
|
3085
3288
|
}] } });
|
|
3086
3289
|
|
|
3087
3290
|
class StringInputComponent extends AbstractValueInputComponent {
|
|
@@ -11885,7 +12088,7 @@ class SelectInputActivity extends InputActivity {
|
|
|
11885
12088
|
[confirmFace]="confirmFace"
|
|
11886
12089
|
[cancelFace]="cancelFace"
|
|
11887
12090
|
></aup-activity-actions>
|
|
11888
|
-
`, 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"] }] });
|
|
11889
12092
|
}
|
|
11890
12093
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SelectInputActivity, decorators: [{
|
|
11891
12094
|
type: Component,
|