@coolon/angular-ui-powerups 16.1.0-alpha.278 → 16.1.0-alpha.280
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/abstract-input.component.mjs +15 -3
- package/esm2022/lib/components/forms/checkbox-input/checkbox-input.component.mjs +3 -3
- package/esm2022/lib/components/forms/select-input/select-input.component.mjs +71 -15
- package/esm2022/lib/interaction/components/input-activities/select-input-activity.mjs +1 -1
- package/fesm2022/coolon-angular-ui-powerups.mjs +85 -17
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/components/forms/abstract-input.component.d.ts +8 -1
- package/lib/components/forms/select-input/select-input.component.d.ts +42 -9
- package/package.json +1 -1
|
@@ -38,6 +38,13 @@ export declare class AbstractInputComponent<T> extends DisposableComponent {
|
|
|
38
38
|
private readonly _enabled$;
|
|
39
39
|
set enabled$(condition$: ValueModel<boolean>);
|
|
40
40
|
get enabled$(): ValueModel<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* The inverse of {@link enabled$}, for a caller whose model already reads as a reason to disable -
|
|
43
|
+
* "no groups to choose from", say. Hand-inverting such a model at the call site reads correctly
|
|
44
|
+
* and behaves backwards, and nothing in the template says which way it runs; bind it as it is.
|
|
45
|
+
* A nil model restores the default (the form value's own enabled state).
|
|
46
|
+
*/
|
|
47
|
+
set disable$(condition$: ValueModel<boolean> | null | undefined);
|
|
41
48
|
focusCommand: Command<any>;
|
|
42
49
|
blurCommand: Command<any>;
|
|
43
50
|
enterCommand: Command<any>;
|
|
@@ -112,7 +119,7 @@ export declare class AbstractInputComponent<T> extends DisposableComponent {
|
|
|
112
119
|
onValueEdited(callback: (is: T, was: T) => void): Disposable;
|
|
113
120
|
protected hackyGetI18n(key: keyof FormField): string;
|
|
114
121
|
static ɵfac: i0.ɵɵFactoryDeclaration<AbstractInputComponent<any>, never>;
|
|
115
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AbstractInputComponent<any>, "ng-component", never, { "i18n$": { "alias": "i18n$"; "required": false; }; "i18n": { "alias": "i18n"; "required": false; }; "_label": { "alias": "label"; "required": false; }; "userFloatLabel": { "alias": "floatLabel"; "required": false; }; "_hint": { "alias": "hint"; "required": false; }; "_placeholder": { "alias": "placeholder"; "required": false; }; "dense": { "alias": "dense"; "required": false; }; "enabled$": { "alias": "enabled$"; "required": false; }; "focusCommand": { "alias": "command.focus"; "required": false; }; "blurCommand": { "alias": "command.blur"; "required": false; }; "enterCommand": { "alias": "command.enter"; "required": false; }; "escapeCommand": { "alias": "command.escape"; "required": false; }; "clickCommand": { "alias": "command.click"; "required": false; }; }, { "focus": "focus"; "blur": "blur"; "enterKey": "enterKey"; "escapeKey": "escapeKey"; }, never, never, false, never>;
|
|
122
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AbstractInputComponent<any>, "ng-component", never, { "i18n$": { "alias": "i18n$"; "required": false; }; "i18n": { "alias": "i18n"; "required": false; }; "_label": { "alias": "label"; "required": false; }; "userFloatLabel": { "alias": "floatLabel"; "required": false; }; "_hint": { "alias": "hint"; "required": false; }; "_placeholder": { "alias": "placeholder"; "required": false; }; "dense": { "alias": "dense"; "required": false; }; "enabled$": { "alias": "enabled$"; "required": false; }; "disable$": { "alias": "disable$"; "required": false; }; "focusCommand": { "alias": "command.focus"; "required": false; }; "blurCommand": { "alias": "command.blur"; "required": false; }; "enterCommand": { "alias": "command.enter"; "required": false; }; "escapeCommand": { "alias": "command.escape"; "required": false; }; "clickCommand": { "alias": "command.click"; "required": false; }; }, { "focus": "focus"; "blur": "blur"; "enterKey": "enterKey"; "escapeKey": "escapeKey"; }, never, never, false, never>;
|
|
116
123
|
}
|
|
117
124
|
export declare namespace AbstractInputComponent {
|
|
118
125
|
/** 'hint' is the plain, non-validation hint — it has no severity of its own. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AfterViewChecked, DoCheck, OnInit, TemplateRef, TrackByFunction } from '@angular/core';
|
|
2
|
-
import { BooleanValueModelChain, ListModel, ListModelChain, MutableValueModel, Predicate } from '@coolon/pectin';
|
|
1
|
+
import { AfterContentInit, AfterViewChecked, DoCheck, OnInit, TemplateRef, TrackByFunction } from '@angular/core';
|
|
2
|
+
import { BooleanValueModelChain, ListModel, ListModelChain, MutableValueModel, Predicate, ValueModel } from '@coolon/pectin';
|
|
3
3
|
import { AbstractValueInputComponent } from '../abstract-value-input.component';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
/**
|
|
@@ -14,17 +14,29 @@ import * as i0 from "@angular/core";
|
|
|
14
14
|
* <aup-select-input [value$]="myModel" [options]="myOptions" [searchable]="true"
|
|
15
15
|
* searchPlaceholder="Find a hero…" noResultsText="No heros match"></aup-select-input>
|
|
16
16
|
* A search box is rendered at the top of the dropdown panel and filters the options client side on
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* the rows {@link optionSearchText} returns - by default the single row optionLabelFormat produces.
|
|
18
|
+
* An option that renders more than optionLabelFormat through #optionTemplate must return every row
|
|
19
|
+
* it shows, or the user can read text the search cannot find:
|
|
20
|
+
*
|
|
21
|
+
* <aup-select-input ... [searchable]="true" [optionSearchText]="hero => [hero.name, hero.alias]">
|
|
22
|
+
* <ng-template #optionTemplate let-hero>{{hero.name}}<br>{{hero.alias}}</ng-template>
|
|
23
|
+
* </aup-select-input>
|
|
24
|
+
*
|
|
25
|
+
* Rows are matched one at a time, so a term cannot straddle two of them. In development mode a
|
|
26
|
+
* searchable select with an #optionTemplate and neither optionSearchText nor filterFactory warns.
|
|
27
|
+
* Override {@link filterFactory} only for matching that is genuinely different - fuzzy, tokenised,
|
|
28
|
+
* remote. Bind {@link searchText$} to observe or pre-seed the text (it is cleared whenever the panel
|
|
29
|
+
* closes). The nil option is never filtered - it is a clear-the-selection affordance, not a data
|
|
30
|
+
* option.
|
|
20
31
|
*/
|
|
21
|
-
export declare class SelectInputComponent<T = any> extends AbstractValueInputComponent<T> implements OnInit, DoCheck, AfterViewChecked {
|
|
32
|
+
export declare class SelectInputComponent<T = any> extends AbstractValueInputComponent<T> implements OnInit, AfterContentInit, DoCheck, AfterViewChecked {
|
|
22
33
|
/** Keys the search box hands back to MatSelect's key manager instead of consuming itself. */
|
|
23
34
|
private static readonly NAVIGATION_KEYS;
|
|
24
35
|
accessor options$: ListModel<T>;
|
|
25
36
|
accessor options: readonly T[];
|
|
26
37
|
optionLabel: keyof T;
|
|
27
|
-
allowNil
|
|
38
|
+
accessor allowNil$: ValueModel<boolean>;
|
|
39
|
+
accessor allowNil: boolean;
|
|
28
40
|
selectedOptionTemplateRef: TemplateRef<any>;
|
|
29
41
|
optionTemplateRef: TemplateRef<any>;
|
|
30
42
|
nilOptionTemplateRef: TemplateRef<any>;
|
|
@@ -37,11 +49,21 @@ export declare class SelectInputComponent<T = any> extends AbstractValueInputCom
|
|
|
37
49
|
noResultsText: string;
|
|
38
50
|
/** Bindable so a host can pre-seed or observe the search text. Cleared when the panel closes. */
|
|
39
51
|
accessor searchText$: MutableValueModel<string>;
|
|
52
|
+
private readonly defaultOptionSearchText;
|
|
53
|
+
/**
|
|
54
|
+
* The text the default filter searches, one entry per row the option renders. Defaults to the
|
|
55
|
+
* single row optionLabelFormat produces. Return every row an #optionTemplate shows - a second line
|
|
56
|
+
* the search cannot see is the bug this input exists to prevent. Nil entries are skipped and
|
|
57
|
+
* non-strings are matched by their text.
|
|
58
|
+
*/
|
|
59
|
+
optionSearchText: (option: T) => SelectInputComponent.SearchText | readonly SelectInputComponent.SearchText[];
|
|
40
60
|
/**
|
|
41
61
|
* NOTE: deliberately NOT the AutocompleteInputComponent default - there an empty filter matches
|
|
42
62
|
* nothing, here it must match everything or the panel opens blank. It also guards a nil or
|
|
43
|
-
* non-string
|
|
63
|
+
* non-string row, which the autocomplete version does not.
|
|
44
64
|
*/
|
|
65
|
+
private readonly defaultFilterFactory;
|
|
66
|
+
/** Escape hatch for matching that is genuinely different; the default consults {@link optionSearchText}. */
|
|
45
67
|
filterFactory: (filterText: string) => Predicate<T>;
|
|
46
68
|
readonly isNil$: BooleanValueModelChain;
|
|
47
69
|
private readonly id$;
|
|
@@ -67,6 +89,13 @@ export declare class SelectInputComponent<T = any> extends AbstractValueInputCom
|
|
|
67
89
|
readonly trackByIdentity: TrackByFunction<T>;
|
|
68
90
|
constructor();
|
|
69
91
|
select(item: T): void;
|
|
92
|
+
/** Lower-cased, nil-free rows for one option. Matched row by row so a term cannot straddle two. */
|
|
93
|
+
private searchRows;
|
|
94
|
+
/**
|
|
95
|
+
* The trap this guards is silent in production: the option renders text the search box cannot
|
|
96
|
+
* reach, and the user's search for what they can plainly see finds nothing.
|
|
97
|
+
*/
|
|
98
|
+
ngAfterContentInit(): void;
|
|
70
99
|
/**
|
|
71
100
|
* True when the option is only in {@link panelOptions$} to keep MatSelect's selection model
|
|
72
101
|
* populated. The template renders it disabled and display:none.
|
|
@@ -100,5 +129,9 @@ export declare class SelectInputComponent<T = any> extends AbstractValueInputCom
|
|
|
100
129
|
private isSelectedOption;
|
|
101
130
|
ngOnInit(): void;
|
|
102
131
|
static ɵfac: i0.ɵɵFactoryDeclaration<SelectInputComponent<any>, 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>;
|
|
132
|
+
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; }; "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; }; "optionSearchText": { "alias": "optionSearchText"; "required": false; }; "filterFactory": { "alias": "filterFactory"; "required": false; }; }, {}, ["selectedOptionTemplateRef", "optionTemplateRef", "nilOptionTemplateRef"], ["[select-option-footer]"], false, never>;
|
|
133
|
+
}
|
|
134
|
+
export declare namespace SelectInputComponent {
|
|
135
|
+
/** One row of an option's searchable text. Nil rows are skipped; numbers are matched by their text. */
|
|
136
|
+
type SearchText = string | number | null | undefined;
|
|
104
137
|
}
|