@mintplayer/ng-bootstrap 22.24.0 → 22.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/mintplayer-ng-bootstrap-a11y.mjs +27 -48
- package/fesm2022/mintplayer-ng-bootstrap-a11y.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-badge.mjs +11 -1
- package/fesm2022/mintplayer-ng-bootstrap-badge.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs +0 -1
- package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs +7 -19
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs +6 -160
- package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-machine.mjs +102 -0
- package/fesm2022/mintplayer-ng-bootstrap-machine.mjs.map +1 -0
- package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs +250 -103
- package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs.map +1 -1
- package/machine/package.json +4 -0
- package/package.json +7 -2
- package/types/mintplayer-ng-bootstrap-a11y.d.ts +23 -34
- package/types/mintplayer-ng-bootstrap-code-snippet.d.ts +0 -1
- package/types/mintplayer-ng-bootstrap-datatable.d.ts +7 -0
- package/types/mintplayer-ng-bootstrap-dropdown-menu.d.ts +6 -18
- package/types/mintplayer-ng-bootstrap-dropdown.d.ts +2 -48
- package/types/mintplayer-ng-bootstrap-machine.d.ts +54 -0
- package/types/mintplayer-ng-bootstrap-typeahead.d.ts +141 -32
|
@@ -1,40 +1,149 @@
|
|
|
1
|
+
import * as _mintplayer_ui_core_typeahead from '@mintplayer/ui-core/typeahead';
|
|
2
|
+
import { TypeaheadRequest, TypeaheadMachine } from '@mintplayer/ui-core/typeahead';
|
|
3
|
+
export { TypeaheadLabels, TypeaheadProvider, TypeaheadRequest, inMemoryTypeaheadProvider } from '@mintplayer/ui-core/typeahead';
|
|
1
4
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
5
|
+
import { TemplateRef } from '@angular/core';
|
|
6
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
7
|
+
import { Observable } from 'rxjs';
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
/** The context of a `*bsTypeaheadItem` template: the item and the current term (for highlighting). */
|
|
10
|
+
interface BsTypeaheadItemContext<T = unknown> {
|
|
11
|
+
$implicit: T;
|
|
12
|
+
term: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Renders one suggestion row. Declared inside `<bs-typeahead>`; absent, the
|
|
16
|
+
* row shows the item's text (`itemText`).
|
|
17
|
+
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <bs-typeahead [provider]="streets">
|
|
20
|
+
* <ng-container *bsTypeaheadItem="let street; let term = term; of: streetList">
|
|
21
|
+
* {{ street.name }} <small>{{ street.municipality }}</small>
|
|
22
|
+
* </ng-container>
|
|
23
|
+
* </bs-typeahead>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* `of:` is optional and only carries the item type into the template (like
|
|
27
|
+
* `ngFor`'s `of`); pass any value of the item type or an array of it.
|
|
28
|
+
*/
|
|
29
|
+
declare class BsTypeaheadItemDirective<T = unknown> {
|
|
30
|
+
readonly templateRef: TemplateRef<BsTypeaheadItemContext<T>>;
|
|
31
|
+
/** Type carrier only; never read at runtime. */
|
|
32
|
+
readonly bsTypeaheadItemOf: _angular_core.InputSignal<T | readonly T[] | null | undefined>;
|
|
33
|
+
static ngTemplateContextGuard<T>(_dir: BsTypeaheadItemDirective<T>, ctx: unknown): ctx is BsTypeaheadItemContext<T>;
|
|
34
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BsTypeaheadItemDirective<any>, never>;
|
|
35
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BsTypeaheadItemDirective<any>, "[bsTypeaheadItem]", never, { "bsTypeaheadItemOf": { "alias": "bsTypeaheadItemOf"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An Angular provider may answer with a Promise or an Observable. An
|
|
40
|
+
* Observable is unsubscribed when `request.signal` aborts, which cancels an
|
|
41
|
+
* `HttpClient` request in flight.
|
|
42
|
+
*/
|
|
43
|
+
type BsTypeaheadProvider<T> = (term: string, request: TypeaheadRequest) => Promise<readonly T[]> | Observable<readonly T[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Typeahead: a text input with asynchronous suggestions and free text.
|
|
46
|
+
*
|
|
47
|
+
* The first component built on the headless-core architecture (#436): all
|
|
48
|
+
* behaviour lives in `TypeaheadMachine` (`@mintplayer/ui-core/typeahead`); this
|
|
49
|
+
* component renders its own Angular template from the machine's snapshot and
|
|
50
|
+
* applies the core's ARIA bags with `[mpProps]`. Because it is an Angular
|
|
51
|
+
* template, Angular SSR emits a real, named `<input>` that submits free text
|
|
52
|
+
* with JavaScript disabled, and hydration attaches to that same node.
|
|
53
|
+
*
|
|
54
|
+
* Value = the term (string). `selectedItem()` holds the last picked item until
|
|
55
|
+
* the text changes. Usable with `[(value)]`, `[(ngModel)]`, `formControlName`.
|
|
56
|
+
*/
|
|
57
|
+
declare class BsTypeaheadComponent<T = unknown> implements ControlValueAccessor {
|
|
58
|
+
/** Supplies suggestions for a settled term; a newer term aborts the previous request. */
|
|
59
|
+
readonly provider: _angular_core.InputSignal<BsTypeaheadProvider<T> | null>;
|
|
60
|
+
/** Quiet time after the last keystroke, ms. 0 requests synchronously. */
|
|
61
|
+
readonly debounceMs: _angular_core.InputSignal<number>;
|
|
62
|
+
/** A trimmed term shorter than this closes the list without querying. */
|
|
63
|
+
readonly minLength: _angular_core.InputSignal<number>;
|
|
64
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
65
|
+
/** The text a pick writes into the input. Default: `item.text`, else `String(item)`. */
|
|
66
|
+
readonly itemText: _angular_core.InputSignal<((item: T) => string) | undefined>;
|
|
67
|
+
/** Row identity for keyed rendering. Default: `itemText`. */
|
|
68
|
+
readonly itemKey: _angular_core.InputSignal<((item: T) => unknown) | undefined>;
|
|
69
|
+
/** Submitted with a native `<form>` under this name (also with JavaScript disabled). */
|
|
70
|
+
readonly name: _angular_core.InputSignal<string | null>;
|
|
71
|
+
/** Accessible name of the input. A host `aria-label` or `aria-labelledby` wins. */
|
|
72
|
+
readonly inputLabel: _angular_core.InputSignal<string | null>;
|
|
73
|
+
readonly loadingLabel: _angular_core.InputSignal<string | undefined>;
|
|
74
|
+
readonly noResultsLabel: _angular_core.InputSignal<string | undefined>;
|
|
75
|
+
/** Spoken once per settled request, e.g. `n => n + ' resultaten'`. */
|
|
76
|
+
readonly resultsLabel: _angular_core.InputSignal<((count: number) => string) | undefined>;
|
|
77
|
+
/** A persistent validation message, wired to the input with aria-errormessage. */
|
|
78
|
+
readonly errorText: _angular_core.InputSignal<string | null>;
|
|
79
|
+
/** The term. Two-way; also the ControlValueAccessor value. */
|
|
80
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
81
|
+
readonly select: _angular_core.OutputEmitterRef<T>;
|
|
82
|
+
readonly submitted: _angular_core.OutputEmitterRef<string>;
|
|
83
|
+
readonly opened: _angular_core.OutputEmitterRef<void>;
|
|
84
|
+
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
85
|
+
readonly loadError: _angular_core.OutputEmitterRef<unknown>;
|
|
86
|
+
readonly itemTemplate: _angular_core.Signal<BsTypeaheadItemDirective<T> | undefined>;
|
|
87
|
+
private readonly inputRef;
|
|
88
|
+
readonly id: string;
|
|
8
89
|
/**
|
|
9
|
-
*
|
|
10
|
-
* typeahead
|
|
11
|
-
*
|
|
90
|
+
* Host transparency: a consumer's `aria-*`, `id` and `tabindex` on
|
|
91
|
+
* `<bs-typeahead>` land on the role-bearing input (`id` and `tabindex` are
|
|
92
|
+
* moved, so no duplicate id and no dead tab stop on the host). A consumer
|
|
93
|
+
* `role` is NOT forwarded: the input's role is `combobox` by contract. Read
|
|
94
|
+
* once, in the constructor, so the server render carries them too.
|
|
12
95
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
96
|
+
private readonly hostAria;
|
|
97
|
+
readonly machine: TypeaheadMachine<T>;
|
|
98
|
+
readonly state: _angular_core.Signal<_mintplayer_ui_core_typeahead.TypeaheadState<T>>;
|
|
99
|
+
readonly api: _angular_core.Signal<{
|
|
100
|
+
input: {
|
|
101
|
+
[x: string]: string | boolean | null;
|
|
102
|
+
};
|
|
103
|
+
root: _mintplayer_ui_core_typeahead.AttrBag;
|
|
104
|
+
listbox: _mintplayer_ui_core_typeahead.AttrBag;
|
|
105
|
+
status: {
|
|
106
|
+
attrs: _mintplayer_ui_core_typeahead.AttrBag;
|
|
107
|
+
text: string;
|
|
108
|
+
} | null;
|
|
109
|
+
option(index: number): _mintplayer_ui_core_typeahead.AttrBag;
|
|
110
|
+
live: {
|
|
111
|
+
attrs: _mintplayer_ui_core_typeahead.AttrBag;
|
|
112
|
+
text: string;
|
|
113
|
+
};
|
|
114
|
+
error: {
|
|
115
|
+
attrs: _mintplayer_ui_core_typeahead.AttrBag;
|
|
116
|
+
text: string;
|
|
117
|
+
} | null;
|
|
118
|
+
}>;
|
|
119
|
+
/** The last picked item, `null` once the text changes after the pick. */
|
|
120
|
+
readonly selectedItem: _angular_core.Signal<T | null>;
|
|
121
|
+
private readonly disabledByCva;
|
|
122
|
+
private onChange;
|
|
123
|
+
private onTouched;
|
|
28
124
|
constructor();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Text typed or pasted into the server-rendered input before hydration lives
|
|
127
|
+
* only in the DOM. Hydration's [value] binding would overwrite it with the
|
|
128
|
+
* empty term, and the replayed input event then reads the empty field, so it
|
|
129
|
+
* is lost. Read it here, while the host still holds the server DOM, and keep
|
|
130
|
+
* it as the term; once effects have configured the provider, re-enter it as a
|
|
131
|
+
* typed term so it notifies the model and queries.
|
|
132
|
+
*/
|
|
133
|
+
private adoptPreHydrationText;
|
|
134
|
+
protected onInput(event: Event): void;
|
|
135
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
136
|
+
protected onBlur(): void;
|
|
137
|
+
protected trackItem: (index: number, item: T) => unknown;
|
|
138
|
+
/** Focus the input. */
|
|
35
139
|
focus(): void;
|
|
36
|
-
|
|
37
|
-
|
|
140
|
+
writeValue(value: string | null): void;
|
|
141
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
142
|
+
registerOnTouched(fn: () => void): void;
|
|
143
|
+
setDisabledState(isDisabled: boolean): void;
|
|
144
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BsTypeaheadComponent<any>, never>;
|
|
145
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<BsTypeaheadComponent<any>, "bs-typeahead", never, { "provider": { "alias": "provider"; "required": false; "isSignal": true; }; "debounceMs": { "alias": "debounceMs"; "required": false; "isSignal": true; }; "minLength": { "alias": "minLength"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "itemText": { "alias": "itemText"; "required": false; "isSignal": true; }; "itemKey": { "alias": "itemKey"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "inputLabel": { "alias": "inputLabel"; "required": false; "isSignal": true; }; "loadingLabel": { "alias": "loadingLabel"; "required": false; "isSignal": true; }; "noResultsLabel": { "alias": "noResultsLabel"; "required": false; "isSignal": true; }; "resultsLabel": { "alias": "resultsLabel"; "required": false; "isSignal": true; }; "errorText": { "alias": "errorText"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "select": "select"; "submitted": "submitted"; "opened": "opened"; "closed": "closed"; "loadError": "loadError"; }, ["itemTemplate"], never, true, never>;
|
|
38
146
|
}
|
|
39
147
|
|
|
40
|
-
export { BsTypeaheadComponent };
|
|
148
|
+
export { BsTypeaheadComponent, BsTypeaheadItemDirective };
|
|
149
|
+
export type { BsTypeaheadItemContext, BsTypeaheadProvider };
|