@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OnInit, TemplateRef, TrackByFunction } from '@angular/core';
|
|
2
|
-
import { BooleanValueModelChain, ListModel, ListModelChain } from '@coolon/pectin';
|
|
1
|
+
import { AfterViewChecked, DoCheck, OnInit, TemplateRef, TrackByFunction } from '@angular/core';
|
|
2
|
+
import { BooleanValueModelChain, ListModel, ListModelChain, MutableValueModel, Predicate } from '@coolon/pectin';
|
|
3
3
|
import { AbstractValueInputComponent } from '../abstract-value-input.component';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
/**
|
|
@@ -9,8 +9,18 @@ import * as i0 from "@angular/core";
|
|
|
9
9
|
* <ng-template #selectedOptionTemplate let-option>{{option.thePropertyYouWant}} note, not used for nils (the placeholder is used)</ng-template>
|
|
10
10
|
* <ng-template #nilOptionTemplate>Uses the placeholder by default but you can customise it</ng-template>
|
|
11
11
|
* </aup-select_input>
|
|
12
|
+
*
|
|
13
|
+
* Searching (opt in, off by default so existing usages are unchanged):
|
|
14
|
+
* <aup-select-input [value$]="myModel" [options]="myOptions" [searchable]="true"
|
|
15
|
+
* searchPlaceholder="Find a hero…" noResultsText="No heros match"></aup-select-input>
|
|
16
|
+
* A search box is rendered at the top of the dropdown panel and filters the options client side on
|
|
17
|
+
* optionLabelFormat. Override {@link filterFactory} for different matching, and bind
|
|
18
|
+
* {@link searchText$} to observe or pre-seed the text (it is cleared whenever the panel closes).
|
|
19
|
+
* The nil option is never filtered - it is a clear-the-selection affordance, not a data option.
|
|
12
20
|
*/
|
|
13
|
-
export declare class SelectInputComponent<T = any> extends AbstractValueInputComponent<T> implements OnInit {
|
|
21
|
+
export declare class SelectInputComponent<T = any> extends AbstractValueInputComponent<T> implements OnInit, DoCheck, AfterViewChecked {
|
|
22
|
+
/** Keys the search box hands back to MatSelect's key manager instead of consuming itself. */
|
|
23
|
+
private static readonly NAVIGATION_KEYS;
|
|
14
24
|
accessor options$: ListModel<T>;
|
|
15
25
|
accessor options: readonly T[];
|
|
16
26
|
optionLabel: keyof T;
|
|
@@ -19,14 +29,76 @@ export declare class SelectInputComponent<T = any> extends AbstractValueInputCom
|
|
|
19
29
|
optionTemplateRef: TemplateRef<any>;
|
|
20
30
|
nilOptionTemplateRef: TemplateRef<any>;
|
|
21
31
|
optionLabelFormat: (option: T) => any;
|
|
32
|
+
/** Opt-in: renders a search box at the top of the dropdown panel that filters the options. */
|
|
33
|
+
searchable: boolean;
|
|
34
|
+
/** Placeholder for the in-panel search box. {@link FormField} has no slot for this. */
|
|
35
|
+
searchPlaceholder: string;
|
|
36
|
+
/** Shown inside the panel when the search matches nothing. */
|
|
37
|
+
noResultsText: string;
|
|
38
|
+
/** Bindable so a host can pre-seed or observe the search text. Cleared when the panel closes. */
|
|
39
|
+
accessor searchText$: MutableValueModel<string>;
|
|
40
|
+
/**
|
|
41
|
+
* NOTE: deliberately NOT the AutocompleteInputComponent default - there an empty filter matches
|
|
42
|
+
* nothing, here it must match everything or the panel opens blank. It also guards a nil or
|
|
43
|
+
* non-string optionLabelFormat result, which the autocomplete version does not.
|
|
44
|
+
*/
|
|
45
|
+
filterFactory: (filterText: string) => Predicate<T>;
|
|
22
46
|
readonly isNil$: BooleanValueModelChain;
|
|
23
47
|
private readonly id$;
|
|
24
48
|
readonly cookedOptions$: ListModelChain<T>;
|
|
49
|
+
/** The options passing the current filter - drives the no-results state. */
|
|
50
|
+
readonly matchingOptions$: ListModelChain<T>;
|
|
51
|
+
/**
|
|
52
|
+
* What the panel renders: the matches, plus the selected option even when it does not match.
|
|
53
|
+
* MatSelect renders `<span class="mat-mdc-select-placeholder">` instead of our <mat-select-trigger>
|
|
54
|
+
* the moment its _selectionModel empties, so dropping the selected <mat-option> would blank the
|
|
55
|
+
* field's displayed value while the user types. It is rendered disabled + display:none instead
|
|
56
|
+
* (disabled is what MatSelect's keyManager skipPredicate reads, so arrow navigation skips it).
|
|
57
|
+
*/
|
|
58
|
+
readonly panelOptions$: ListModelChain<T>;
|
|
59
|
+
readonly noMatches$: BooleanValueModelChain;
|
|
60
|
+
/** MatSelect._canOpen() refuses to open with zero options, so the filter is inert while closed. */
|
|
61
|
+
private readonly panelOpen$;
|
|
62
|
+
private focusSearchPending;
|
|
63
|
+
private readonly filterPredicate$;
|
|
64
|
+
private searchInputRef;
|
|
65
|
+
private matSelect;
|
|
25
66
|
private readonly delegatedIdentityOf;
|
|
26
67
|
readonly trackByIdentity: TrackByFunction<T>;
|
|
27
68
|
constructor();
|
|
28
69
|
select(item: T): void;
|
|
70
|
+
/**
|
|
71
|
+
* True when the option is only in {@link panelOptions$} to keep MatSelect's selection model
|
|
72
|
+
* populated. The template renders it disabled and display:none.
|
|
73
|
+
*/
|
|
74
|
+
isHiddenOption(option: T): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* MatSelect's (opened)/(closed) outputs are driven by its panel animation: the template holds
|
|
77
|
+
* [@transformPanel] at a constant 'showing', and ngOnInit pipes (@transformPanel.done) through
|
|
78
|
+
* distinctUntilChanged(). When the CDK detaches the overlay before the leave animation completes
|
|
79
|
+
* - which is exactly what its ESCAPE handling does - the 'void' is never emitted, so the next
|
|
80
|
+
* open's 'showing' is deduped away and BOTH outputs silently stop firing for good. A stale filter
|
|
81
|
+
* surviving a close would then wedge the select shut (MatSelect._canOpen() needs options.length),
|
|
82
|
+
* so the panel state is tracked from _panelOpen, which open()/close() set synchronously.
|
|
83
|
+
*/
|
|
84
|
+
ngDoCheck(): void;
|
|
85
|
+
/** The search box only exists in the DOM once the overlay has attached, hence the retry flag. */
|
|
86
|
+
ngAfterViewChecked(): void;
|
|
87
|
+
clearSearch(): void;
|
|
88
|
+
onSearchInput(event: Event): void;
|
|
89
|
+
/**
|
|
90
|
+
* MatSelect listens for keydown on the panel div and our search box sits inside it, so every
|
|
91
|
+
* keystroke bubbles into _handleOpenKeydown. Everything the text box owns is stopped; the
|
|
92
|
+
* navigation keys are let through to MatSelect's key manager. Because every printable key is
|
|
93
|
+
* stopped, manager.isTyping() stays false - which is what makes MatSelect treat Enter as
|
|
94
|
+
* "select the active option" rather than as part of its own typeahead.
|
|
95
|
+
*/
|
|
96
|
+
onSearchKeydown(event: KeyboardEvent): void;
|
|
97
|
+
notifyFocusIn(): void;
|
|
98
|
+
notifyFocusOut(): void;
|
|
99
|
+
private matchesSearch;
|
|
100
|
+
private isSelectedOption;
|
|
29
101
|
ngOnInit(): void;
|
|
30
102
|
static ɵfac: i0.ɵɵFactoryDeclaration<SelectInputComponent<any>, never>;
|
|
31
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SelectInputComponent<any>, "aup-select-input", never, { "options$": { "alias": "options$"; "required": false; }; "options": { "alias": "options"; "required": false; }; "optionLabel": { "alias": "optionLabel"; "required": false; }; "allowNil": { "alias": "allowNil"; "required": false; }; "optionLabelFormat": { "alias": "optionLabelFormat"; "required": false; }; }, {}, ["selectedOptionTemplateRef", "optionTemplateRef", "nilOptionTemplateRef"], ["[select-option-footer]"], false, never>;
|
|
103
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SelectInputComponent<any>, "aup-select-input", never, { "options$": { "alias": "options$"; "required": false; }; "options": { "alias": "options"; "required": false; }; "optionLabel": { "alias": "optionLabel"; "required": false; }; "allowNil": { "alias": "allowNil"; "required": false; }; "optionLabelFormat": { "alias": "optionLabelFormat"; "required": false; }; "searchable": { "alias": "searchable"; "required": false; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; }; "noResultsText": { "alias": "noResultsText"; "required": false; }; "searchText$": { "alias": "searchText$"; "required": false; }; "filterFactory": { "alias": "filterFactory"; "required": false; }; }, {}, ["selectedOptionTemplateRef", "optionTemplateRef", "nilOptionTemplateRef"], ["[select-option-footer]"], false, never>;
|
|
32
104
|
}
|
|
@@ -4,7 +4,8 @@ export declare class IconComponent {
|
|
|
4
4
|
_icon: string;
|
|
5
5
|
prefix: string;
|
|
6
6
|
suffix: string;
|
|
7
|
-
|
|
7
|
+
/** Undefined when the icon is fine — see describeProblemWith. */
|
|
8
|
+
errorMessage: string | undefined;
|
|
8
9
|
allowedPrefixes: string[];
|
|
9
10
|
iconPrefix: {
|
|
10
11
|
SVG: "svg";
|
|
@@ -14,6 +15,16 @@ export declare class IconComponent {
|
|
|
14
15
|
set icon(iconName: string);
|
|
15
16
|
get icon(): string;
|
|
16
17
|
get faIcon(): string;
|
|
18
|
+
/**
|
|
19
|
+
* The tooltip on the bug_report fallback, or undefined when the icon is fine.
|
|
20
|
+
*
|
|
21
|
+
* Note this only catches a missing or unrecognised *prefix* — a known prefix with a name that
|
|
22
|
+
* doesn't exist ("mat:no_such_icon") renders down its normal branch and cannot be detected
|
|
23
|
+
* without asking Material's registry. The message this used to build for that case was
|
|
24
|
+
* unreachable: it was assigned and then unconditionally overwritten on the next line, so every
|
|
25
|
+
* icon, valid ones included, ended up carrying the unknown-prefix text.
|
|
26
|
+
*/
|
|
27
|
+
private describeProblemWith;
|
|
17
28
|
static ɵfac: i0.ɵɵFactoryDeclaration<IconComponent, never>;
|
|
18
29
|
static ɵcmp: i0.ɵɵComponentDeclaration<IconComponent, "aup-icon", never, { "icon": { "alias": "icon"; "required": false; }; }, {}, never, never, false, never>;
|
|
19
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coolon/angular-ui-powerups",
|
|
3
|
-
"version": "16.1.0-alpha.
|
|
3
|
+
"version": "16.1.0-alpha.263",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/animations": "^16.2.9",
|
|
6
6
|
"@angular/common": "^16.2.9",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@angular/platform-browser-dynamic": "^16.2.9",
|
|
13
13
|
"@angular/material-moment-adapter": "^16.2.10",
|
|
14
14
|
"@angular/router": "^16.2.9",
|
|
15
|
-
"@coolon/pectin": "^5.0.0-alpha.
|
|
15
|
+
"@coolon/pectin": "^5.0.0-alpha.131",
|
|
16
16
|
"fast-typescript-memoize": "^1.1.1",
|
|
17
17
|
"lodash-es": "^4.17.21",
|
|
18
18
|
"marked": "4.0.10",
|