@angular/cdk-experimental 20.0.0-next.6 → 20.0.0-next.8
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/column-resize/index.d.ts +1 -1
- package/combobox/index.d.ts +2 -1
- package/deferred-content/index.d.ts +37 -0
- package/fesm2022/cdk-experimental.mjs +1 -1
- package/fesm2022/cdk-experimental.mjs.map +1 -1
- package/fesm2022/column-resize.mjs +2 -3
- package/fesm2022/column-resize.mjs.map +1 -1
- package/fesm2022/combobox.mjs +4 -4
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/deferred-content.mjs +60 -0
- package/fesm2022/deferred-content.mjs.map +1 -0
- package/fesm2022/list-focus-CSTLIgwc.mjs +382 -0
- package/fesm2022/list-focus-CSTLIgwc.mjs.map +1 -0
- package/fesm2022/listbox.mjs +3 -2
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/option-D1-Zcobx.mjs +338 -0
- package/fesm2022/option-D1-Zcobx.mjs.map +1 -0
- package/fesm2022/{polyfill-e71d02cf.mjs → polyfill-DRXnWbMt.mjs} +2 -2
- package/fesm2022/polyfill-DRXnWbMt.mjs.map +1 -0
- package/fesm2022/popover-edit.mjs +3 -5
- package/fesm2022/popover-edit.mjs.map +1 -1
- package/fesm2022/scrolling.mjs +1 -1
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/selection.mjs +2 -2
- package/fesm2022/selection.mjs.map +1 -1
- package/fesm2022/table-scroll-container.mjs +1 -2
- package/fesm2022/table-scroll-container.mjs.map +1 -1
- package/fesm2022/tabs-C0pLghH2.mjs +185 -0
- package/fesm2022/tabs-C0pLghH2.mjs.map +1 -0
- package/fesm2022/tabs.mjs +224 -0
- package/fesm2022/tabs.mjs.map +1 -0
- package/fesm2022/ui-patterns.mjs +3 -1
- package/fesm2022/ui-patterns.mjs.map +1 -1
- package/list-navigation.d-cy63EByU.d.ts +247 -0
- package/listbox/index.d.ts +2 -1
- package/listbox.d-DJqDR_H3.d.ts +180 -0
- package/package.json +10 -2
- package/tabs/index.d.ts +128 -0
- package/tabs.d-CWu2orP4.d.ts +107 -0
- package/ui-patterns/index.d.ts +3 -1
- package/fesm2022/option-7fdc6400.mjs +0 -628
- package/fesm2022/option-7fdc6400.mjs.map +0 -1
- package/fesm2022/polyfill-e71d02cf.mjs.map +0 -1
- package/listbox.d-7a7652e3.d.ts +0 -384
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import * as i1 from '@angular/cdk-experimental/deferred-content';
|
|
2
|
+
import { DeferredContentAware, DeferredContent } from '@angular/cdk-experimental/deferred-content';
|
|
3
|
+
import { _IdGenerator } from '@angular/cdk/a11y';
|
|
4
|
+
import { Directionality } from '@angular/cdk/bidi';
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
import { contentChild, contentChildren, computed, inject, input, booleanAttribute, model, signal, ElementRef, effect, Directive } from '@angular/core';
|
|
7
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
8
|
+
import { TabListPattern, TabPattern, TabPanelPattern } from './tabs-C0pLghH2.mjs';
|
|
9
|
+
import './list-focus-CSTLIgwc.mjs';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A Tabs container.
|
|
13
|
+
*
|
|
14
|
+
* Represents a set of layered sections of content. The CdkTabs is a container meant to be used with
|
|
15
|
+
* CdkTabList, CdkTab, and CdkTabPanel as follows:
|
|
16
|
+
*
|
|
17
|
+
* ```html
|
|
18
|
+
* <div cdkTabs>
|
|
19
|
+
* <ul cdkTabList>
|
|
20
|
+
* <li cdkTab>Tab 1</li>
|
|
21
|
+
* <li cdkTab>Tab 2</li>
|
|
22
|
+
* <li cdkTab>Tab 3</li>
|
|
23
|
+
* </ul>
|
|
24
|
+
*
|
|
25
|
+
* <div cdkTabPanel>Tab content 1</div>
|
|
26
|
+
* <div cdkTabPanel>Tab content 2</div>
|
|
27
|
+
* <div cdkTabPanel>Tab content 3</div>
|
|
28
|
+
* </div>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
class CdkTabs {
|
|
32
|
+
/** The CdkTabList nested inside of the container. */
|
|
33
|
+
_cdkTabList = contentChild(CdkTabList);
|
|
34
|
+
/** The CdkTabPanels nested inside of the container. */
|
|
35
|
+
_cdkTabPanels = contentChildren(CdkTabPanel);
|
|
36
|
+
/** The Tab UIPattern of the child Tabs. */
|
|
37
|
+
tabs = computed(() => this._cdkTabList()?.tabs());
|
|
38
|
+
/** The TabPanel UIPattern of the child TabPanels. */
|
|
39
|
+
tabpanels = computed(() => this._cdkTabPanels().map(tabpanel => tabpanel.pattern));
|
|
40
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: CdkTabs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
41
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.0.0-next.5", type: CdkTabs, isStandalone: true, selector: "[cdkTabs]", host: { classAttribute: "cdk-tabs" }, queries: [{ propertyName: "_cdkTabList", first: true, predicate: CdkTabList, descendants: true, isSignal: true }, { propertyName: "_cdkTabPanels", predicate: CdkTabPanel, isSignal: true }], exportAs: ["cdkTabs"], ngImport: i0 });
|
|
42
|
+
}
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: CdkTabs, decorators: [{
|
|
44
|
+
type: Directive,
|
|
45
|
+
args: [{
|
|
46
|
+
selector: '[cdkTabs]',
|
|
47
|
+
exportAs: 'cdkTabs',
|
|
48
|
+
host: {
|
|
49
|
+
'class': 'cdk-tabs',
|
|
50
|
+
},
|
|
51
|
+
}]
|
|
52
|
+
}] });
|
|
53
|
+
/**
|
|
54
|
+
* A TabList container.
|
|
55
|
+
*
|
|
56
|
+
* Controls a list of CdkTab(s).
|
|
57
|
+
*/
|
|
58
|
+
class CdkTabList {
|
|
59
|
+
/** The directionality (LTR / RTL) context for the application (or a subtree of it). */
|
|
60
|
+
_directionality = inject(Directionality);
|
|
61
|
+
/** The CdkTabs nested inside of the CdkTabList. */
|
|
62
|
+
_cdkTabs = contentChildren(CdkTab);
|
|
63
|
+
/** A signal wrapper for directionality. */
|
|
64
|
+
textDirection = toSignal(this._directionality.change, {
|
|
65
|
+
initialValue: this._directionality.value,
|
|
66
|
+
});
|
|
67
|
+
/** The Tab UIPatterns of the child Tabs. */
|
|
68
|
+
tabs = computed(() => this._cdkTabs().map(tab => tab.pattern));
|
|
69
|
+
/** Whether the tablist is vertically or horizontally oriented. */
|
|
70
|
+
orientation = input('horizontal');
|
|
71
|
+
/** Whether focus should wrap when navigating. */
|
|
72
|
+
wrap = input(true, { transform: booleanAttribute });
|
|
73
|
+
/** Whether disabled items in the list should be skipped when navigating. */
|
|
74
|
+
skipDisabled = input(true, { transform: booleanAttribute });
|
|
75
|
+
/** The focus strategy used by the tablist. */
|
|
76
|
+
focusMode = input('roving');
|
|
77
|
+
/** The selection strategy used by the tablist. */
|
|
78
|
+
selectionMode = input('follow');
|
|
79
|
+
/** Whether the tablist is disabled. */
|
|
80
|
+
disabled = input(false, { transform: booleanAttribute });
|
|
81
|
+
/** The current index that has been navigated to. */
|
|
82
|
+
activeIndex = model(0);
|
|
83
|
+
/** The TabList UIPattern. */
|
|
84
|
+
pattern = new TabListPattern({
|
|
85
|
+
...this,
|
|
86
|
+
items: this.tabs,
|
|
87
|
+
textDirection: this.textDirection,
|
|
88
|
+
value: signal([]),
|
|
89
|
+
});
|
|
90
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: CdkTabList, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
91
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.0.0-next.5", type: CdkTabList, isStandalone: true, selector: "[cdkTabList]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null }, skipDisabled: { classPropertyName: "skipDisabled", publicName: "skipDisabled", isSignal: true, isRequired: false, transformFunction: null }, focusMode: { classPropertyName: "focusMode", publicName: "focusMode", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, activeIndex: { classPropertyName: "activeIndex", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeIndex: "activeIndexChange" }, host: { attributes: { "role": "tablist" }, listeners: { "keydown": "pattern.onKeydown($event)", "pointerdown": "pattern.onPointerdown($event)" }, properties: { "attr.tabindex": "pattern.tabindex()", "attr.aria-disabled": "pattern.disabled()", "attr.aria-orientation": "pattern.orientation()", "attr.aria-activedescendant": "pattern.activedescendant()" }, classAttribute: "cdk-tablist" }, queries: [{ propertyName: "_cdkTabs", predicate: CdkTab, isSignal: true }], exportAs: ["cdkTabList"], ngImport: i0 });
|
|
92
|
+
}
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: CdkTabList, decorators: [{
|
|
94
|
+
type: Directive,
|
|
95
|
+
args: [{
|
|
96
|
+
selector: '[cdkTabList]',
|
|
97
|
+
exportAs: 'cdkTabList',
|
|
98
|
+
host: {
|
|
99
|
+
'role': 'tablist',
|
|
100
|
+
'class': 'cdk-tablist',
|
|
101
|
+
'[attr.tabindex]': 'pattern.tabindex()',
|
|
102
|
+
'[attr.aria-disabled]': 'pattern.disabled()',
|
|
103
|
+
'[attr.aria-orientation]': 'pattern.orientation()',
|
|
104
|
+
'[attr.aria-activedescendant]': 'pattern.activedescendant()',
|
|
105
|
+
'(keydown)': 'pattern.onKeydown($event)',
|
|
106
|
+
'(pointerdown)': 'pattern.onPointerdown($event)',
|
|
107
|
+
},
|
|
108
|
+
}]
|
|
109
|
+
}] });
|
|
110
|
+
/** A selectable tab in a TabList. */
|
|
111
|
+
class CdkTab {
|
|
112
|
+
/** A reference to the tab element. */
|
|
113
|
+
_elementRef = inject(ElementRef);
|
|
114
|
+
/** The parent CdkTabs. */
|
|
115
|
+
_cdkTabs = inject(CdkTabs);
|
|
116
|
+
/** The parent CdkTabList. */
|
|
117
|
+
_cdkTabList = inject(CdkTabList);
|
|
118
|
+
/** A global unique identifier for the tab. */
|
|
119
|
+
_id = inject(_IdGenerator).getId('cdk-tab-');
|
|
120
|
+
/** The parent TabList UIPattern. */
|
|
121
|
+
tablist = computed(() => this._cdkTabList.pattern);
|
|
122
|
+
/** The TabPanel UIPattern associated with the tab */
|
|
123
|
+
tabpanel = computed(() => this._cdkTabs.tabpanels().find(tabpanel => tabpanel.value() === this.value()));
|
|
124
|
+
/** Whether a tab is disabled. */
|
|
125
|
+
disabled = input(false, { transform: booleanAttribute });
|
|
126
|
+
/** A local unique identifier for the tab. */
|
|
127
|
+
value = input.required();
|
|
128
|
+
/** The Tab UIPattern. */
|
|
129
|
+
pattern = new TabPattern({
|
|
130
|
+
...this,
|
|
131
|
+
id: () => this._id,
|
|
132
|
+
element: () => this._elementRef.nativeElement,
|
|
133
|
+
tablist: this.tablist,
|
|
134
|
+
tabpanel: this.tabpanel,
|
|
135
|
+
value: this.value,
|
|
136
|
+
});
|
|
137
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: CdkTab, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
138
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.0-next.5", type: CdkTab, isStandalone: true, selector: "[cdkTab]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "tab" }, properties: { "attr.id": "pattern.id()", "attr.tabindex": "pattern.tabindex()", "attr.aria-selected": "pattern.selected()", "attr.aria-disabled": "pattern.disabled()", "attr.aria-controls": "pattern.controls()" }, classAttribute: "cdk-tab" }, exportAs: ["cdkTab"], ngImport: i0 });
|
|
139
|
+
}
|
|
140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: CdkTab, decorators: [{
|
|
141
|
+
type: Directive,
|
|
142
|
+
args: [{
|
|
143
|
+
selector: '[cdkTab]',
|
|
144
|
+
exportAs: 'cdkTab',
|
|
145
|
+
host: {
|
|
146
|
+
'role': 'tab',
|
|
147
|
+
'class': 'cdk-tab',
|
|
148
|
+
'[attr.id]': 'pattern.id()',
|
|
149
|
+
'[attr.tabindex]': 'pattern.tabindex()',
|
|
150
|
+
'[attr.aria-selected]': 'pattern.selected()',
|
|
151
|
+
'[attr.aria-disabled]': 'pattern.disabled()',
|
|
152
|
+
'[attr.aria-controls]': 'pattern.controls()',
|
|
153
|
+
},
|
|
154
|
+
}]
|
|
155
|
+
}] });
|
|
156
|
+
/**
|
|
157
|
+
* A TabPanel container for the resources of layered content associated with a tab.
|
|
158
|
+
*
|
|
159
|
+
* If a tabpanel is hidden due to its corresponding tab is not activated, the `inert` attribute
|
|
160
|
+
* will be applied to the tabpanel element to remove it from the accessibility tree and stop
|
|
161
|
+
* all the keyboard and pointer interactions. Note that this does not visually hide the tabpenl
|
|
162
|
+
* and a proper styling is required.
|
|
163
|
+
*/
|
|
164
|
+
class CdkTabPanel {
|
|
165
|
+
/** The DeferredContentAware host directive. */
|
|
166
|
+
_deferredContentAware = inject(DeferredContentAware);
|
|
167
|
+
/** The parent CdkTabs. */
|
|
168
|
+
_cdkTabs = inject(CdkTabs);
|
|
169
|
+
/** A global unique identifier for the tab. */
|
|
170
|
+
_id = inject(_IdGenerator).getId('cdk-tabpanel-');
|
|
171
|
+
/** The Tab UIPattern associated with the tabpanel */
|
|
172
|
+
tab = computed(() => this._cdkTabs.tabs()?.find(tab => tab.value() === this.value()));
|
|
173
|
+
/** A local unique identifier for the tabpanel. */
|
|
174
|
+
value = input.required();
|
|
175
|
+
/** The TabPanel UIPattern. */
|
|
176
|
+
pattern = new TabPanelPattern({
|
|
177
|
+
...this,
|
|
178
|
+
id: () => this._id,
|
|
179
|
+
tab: this.tab,
|
|
180
|
+
});
|
|
181
|
+
constructor() {
|
|
182
|
+
effect(() => this._deferredContentAware.contentVisible.set(!this.pattern.hidden()));
|
|
183
|
+
}
|
|
184
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: CdkTabPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
185
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.0-next.5", type: CdkTabPanel, isStandalone: true, selector: "[cdkTabPanel]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "tabpanel", "tabindex": "0" }, properties: { "attr.id": "pattern.id()", "attr.inert": "pattern.hidden() ? true : null" }, classAttribute: "cdk-tabpanel" }, exportAs: ["cdkTabPanel"], hostDirectives: [{ directive: i1.DeferredContentAware, inputs: ["preserveContent", "preserveContent"] }], ngImport: i0 });
|
|
186
|
+
}
|
|
187
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: CdkTabPanel, decorators: [{
|
|
188
|
+
type: Directive,
|
|
189
|
+
args: [{
|
|
190
|
+
selector: '[cdkTabPanel]',
|
|
191
|
+
exportAs: 'cdkTabPanel',
|
|
192
|
+
host: {
|
|
193
|
+
'role': 'tabpanel',
|
|
194
|
+
'tabindex': '0',
|
|
195
|
+
'class': 'cdk-tabpanel',
|
|
196
|
+
'[attr.id]': 'pattern.id()',
|
|
197
|
+
'[attr.inert]': 'pattern.hidden() ? true : null',
|
|
198
|
+
},
|
|
199
|
+
hostDirectives: [
|
|
200
|
+
{
|
|
201
|
+
directive: DeferredContentAware,
|
|
202
|
+
inputs: ['preserveContent'],
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
}]
|
|
206
|
+
}], ctorParameters: () => [] });
|
|
207
|
+
/**
|
|
208
|
+
* A TabContent container for the lazy-loaded content.
|
|
209
|
+
*/
|
|
210
|
+
class CdkTabContent {
|
|
211
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: CdkTabContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
212
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.0-next.5", type: CdkTabContent, isStandalone: true, selector: "ng-template[cdkTabContent]", exportAs: ["cdTabContent"], hostDirectives: [{ directive: i1.DeferredContent }], ngImport: i0 });
|
|
213
|
+
}
|
|
214
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: CdkTabContent, decorators: [{
|
|
215
|
+
type: Directive,
|
|
216
|
+
args: [{
|
|
217
|
+
selector: 'ng-template[cdkTabContent]',
|
|
218
|
+
exportAs: 'cdTabContent',
|
|
219
|
+
hostDirectives: [DeferredContent],
|
|
220
|
+
}]
|
|
221
|
+
}] });
|
|
222
|
+
|
|
223
|
+
export { CdkTab, CdkTabContent, CdkTabList, CdkTabPanel, CdkTabs };
|
|
224
|
+
//# sourceMappingURL=tabs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/tabs/tabs.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {DeferredContent, DeferredContentAware} from '@angular/cdk-experimental/deferred-content';\nimport {_IdGenerator} from '@angular/cdk/a11y';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {\n booleanAttribute,\n computed,\n contentChild,\n contentChildren,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n model,\n signal,\n} from '@angular/core';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {TabListPattern, TabPanelPattern, TabPattern} from '../ui-patterns';\n\n/**\n * A Tabs container.\n *\n * Represents a set of layered sections of content. The CdkTabs is a container meant to be used with\n * CdkTabList, CdkTab, and CdkTabPanel as follows:\n *\n * ```html\n * <div cdkTabs>\n * <ul cdkTabList>\n * <li cdkTab>Tab 1</li>\n * <li cdkTab>Tab 2</li>\n * <li cdkTab>Tab 3</li>\n * </ul>\n *\n * <div cdkTabPanel>Tab content 1</div>\n * <div cdkTabPanel>Tab content 2</div>\n * <div cdkTabPanel>Tab content 3</div>\n * </div>\n * ```\n */\n@Directive({\n selector: '[cdkTabs]',\n exportAs: 'cdkTabs',\n host: {\n 'class': 'cdk-tabs',\n },\n})\nexport class CdkTabs {\n /** The CdkTabList nested inside of the container. */\n private readonly _cdkTabList = contentChild(CdkTabList);\n\n /** The CdkTabPanels nested inside of the container. */\n private readonly _cdkTabPanels = contentChildren(CdkTabPanel);\n\n /** The Tab UIPattern of the child Tabs. */\n tabs = computed(() => this._cdkTabList()?.tabs());\n\n /** The TabPanel UIPattern of the child TabPanels. */\n tabpanels = computed(() => this._cdkTabPanels().map(tabpanel => tabpanel.pattern));\n}\n\n/**\n * A TabList container.\n *\n * Controls a list of CdkTab(s).\n */\n@Directive({\n selector: '[cdkTabList]',\n exportAs: 'cdkTabList',\n host: {\n 'role': 'tablist',\n 'class': 'cdk-tablist',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-orientation]': 'pattern.orientation()',\n '[attr.aria-activedescendant]': 'pattern.activedescendant()',\n '(keydown)': 'pattern.onKeydown($event)',\n '(pointerdown)': 'pattern.onPointerdown($event)',\n },\n})\nexport class CdkTabList {\n /** The directionality (LTR / RTL) context for the application (or a subtree of it). */\n private readonly _directionality = inject(Directionality);\n\n /** The CdkTabs nested inside of the CdkTabList. */\n private readonly _cdkTabs = contentChildren(CdkTab);\n\n /** A signal wrapper for directionality. */\n protected textDirection = toSignal(this._directionality.change, {\n initialValue: this._directionality.value,\n });\n\n /** The Tab UIPatterns of the child Tabs. */\n tabs = computed(() => this._cdkTabs().map(tab => tab.pattern));\n\n /** Whether the tablist is vertically or horizontally oriented. */\n orientation = input<'vertical' | 'horizontal'>('horizontal');\n\n /** Whether focus should wrap when navigating. */\n wrap = input(true, {transform: booleanAttribute});\n\n /** Whether disabled items in the list should be skipped when navigating. */\n skipDisabled = input(true, {transform: booleanAttribute});\n\n /** The focus strategy used by the tablist. */\n focusMode = input<'roving' | 'activedescendant'>('roving');\n\n /** The selection strategy used by the tablist. */\n selectionMode = input<'follow' | 'explicit'>('follow');\n\n /** Whether the tablist is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** The current index that has been navigated to. */\n activeIndex = model<number>(0);\n\n /** The TabList UIPattern. */\n pattern: TabListPattern = new TabListPattern({\n ...this,\n items: this.tabs,\n textDirection: this.textDirection,\n value: signal<string[]>([]),\n });\n}\n\n/** A selectable tab in a TabList. */\n@Directive({\n selector: '[cdkTab]',\n exportAs: 'cdkTab',\n host: {\n 'role': 'tab',\n 'class': 'cdk-tab',\n '[attr.id]': 'pattern.id()',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-selected]': 'pattern.selected()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-controls]': 'pattern.controls()',\n },\n})\nexport class CdkTab {\n /** A reference to the tab element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The parent CdkTabs. */\n private readonly _cdkTabs = inject(CdkTabs);\n\n /** The parent CdkTabList. */\n private readonly _cdkTabList = inject(CdkTabList);\n\n /** A global unique identifier for the tab. */\n private readonly _id = inject(_IdGenerator).getId('cdk-tab-');\n\n /** The parent TabList UIPattern. */\n protected tablist = computed(() => this._cdkTabList.pattern);\n\n /** The TabPanel UIPattern associated with the tab */\n protected tabpanel = computed(() =>\n this._cdkTabs.tabpanels().find(tabpanel => tabpanel.value() === this.value()),\n );\n\n /** Whether a tab is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** A local unique identifier for the tab. */\n value = input.required<string>();\n\n /** The Tab UIPattern. */\n pattern: TabPattern = new TabPattern({\n ...this,\n id: () => this._id,\n element: () => this._elementRef.nativeElement,\n tablist: this.tablist,\n tabpanel: this.tabpanel,\n value: this.value,\n });\n}\n\n/**\n * A TabPanel container for the resources of layered content associated with a tab.\n *\n * If a tabpanel is hidden due to its corresponding tab is not activated, the `inert` attribute\n * will be applied to the tabpanel element to remove it from the accessibility tree and stop\n * all the keyboard and pointer interactions. Note that this does not visually hide the tabpenl\n * and a proper styling is required.\n */\n@Directive({\n selector: '[cdkTabPanel]',\n exportAs: 'cdkTabPanel',\n host: {\n 'role': 'tabpanel',\n 'tabindex': '0',\n 'class': 'cdk-tabpanel',\n '[attr.id]': 'pattern.id()',\n '[attr.inert]': 'pattern.hidden() ? true : null',\n },\n hostDirectives: [\n {\n directive: DeferredContentAware,\n inputs: ['preserveContent'],\n },\n ],\n})\nexport class CdkTabPanel {\n /** The DeferredContentAware host directive. */\n private readonly _deferredContentAware = inject(DeferredContentAware);\n\n /** The parent CdkTabs. */\n private readonly _cdkTabs = inject(CdkTabs);\n\n /** A global unique identifier for the tab. */\n private readonly _id = inject(_IdGenerator).getId('cdk-tabpanel-');\n\n /** The Tab UIPattern associated with the tabpanel */\n protected tab = computed(() => this._cdkTabs.tabs()?.find(tab => tab.value() === this.value()));\n\n /** A local unique identifier for the tabpanel. */\n value = input.required<string>();\n\n /** The TabPanel UIPattern. */\n pattern: TabPanelPattern = new TabPanelPattern({\n ...this,\n id: () => this._id,\n tab: this.tab,\n });\n\n constructor() {\n effect(() => this._deferredContentAware.contentVisible.set(!this.pattern.hidden()));\n }\n}\n\n/**\n * A TabContent container for the lazy-loaded content.\n */\n@Directive({\n selector: 'ng-template[cdkTabContent]',\n exportAs: 'cdTabContent',\n hostDirectives: [DeferredContent],\n})\nexport class CdkTabContent {}\n"],"names":[],"mappings":";;;;;;;;;;AA2BA;;;;;;;;;;;;;;;;;;;AAmBG;MAQU,OAAO,CAAA;;AAED,IAAA,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC;;AAGtC,IAAA,aAAa,GAAG,eAAe,CAAC,WAAW,CAAC;;AAG7D,IAAA,IAAI,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC;;IAGjD,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;8GAXvE,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;kGAAP,OAAO,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,UAAA,EAAA,EAAA,OAAA,EAAA,CAAA,EAAA,YAAA,EAAA,aAAA,EAAA,KAAA,EAAA,IAAA,EAAA,SAAA,EAE0B,UAAU,EAAA,WAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,EAAA,EAAA,YAAA,EAAA,eAAA,EAAA,SAAA,EAGL,WAAW,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;kGALjD,OAAO,EAAA,UAAA,EAAA,CAAA;kBAPnB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAA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A;;AA6BD;;AAEG;MAMU,aAAa,CAAA;8GAAb,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;kGAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,4BAAA,EAAA,QAAA,EAAA,CAAA,cAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,eAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;kGAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBALzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,4BAA4B;AACtC,oBAAA,QAAQ,EAAE,cAAc;oBACxB,cAAc,EAAE,CAAC,eAAe,CAAC;AAClC,iBAAA;;;;;"}
|
package/fesm2022/ui-patterns.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ListboxPattern, OptionPattern } from './option-D1-Zcobx.mjs';
|
|
2
|
+
export { TabListPattern, TabPanelPattern, TabPattern } from './tabs-C0pLghH2.mjs';
|
|
3
|
+
import './list-focus-CSTLIgwc.mjs';
|
|
2
4
|
import '@angular/core';
|
|
3
5
|
|
|
4
6
|
/** Converts a getter setter style signal to a WritableSignalLike. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-patterns.mjs","sources":["../../../../../
|
|
1
|
+
{"version":3,"file":"ui-patterns.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/signal-like/signal-like.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nexport type SignalLike<T> = () => T;\n\nexport interface WritableSignalLike<T> extends SignalLike<T> {\n set(value: T): void;\n update(updateFn: (value: T) => T): void;\n}\n\n/** Converts a getter setter style signal to a WritableSignalLike. */\nexport function convertGetterSetterToWritableSignalLike<T>(\n getter: () => T,\n setter: (v: T) => void,\n): WritableSignalLike<T> {\n // tslint:disable-next-line:ban Have to use `Object.assign` to preserve the getter function.\n return Object.assign(getter, {\n set: setter,\n update: (updateCallback: (v: T) => T) => setter(updateCallback(getter())),\n });\n}\n"],"names":[],"mappings":";;;;;AAeA;AACgB,SAAA,uCAAuC,CACrD,MAAe,EACf,MAAsB,EAAA;;AAGtB,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;AAC3B,QAAA,GAAG,EAAE,MAAM;AACX,QAAA,MAAM,EAAE,CAAC,cAA2B,KAAK,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1E,KAAA,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
|
|
3
|
+
type SignalLike<T> = () => T;
|
|
4
|
+
interface WritableSignalLike<T> extends SignalLike<T> {
|
|
5
|
+
set(value: T): void;
|
|
6
|
+
update(updateFn: (value: T) => T): void;
|
|
7
|
+
}
|
|
8
|
+
/** Converts a getter setter style signal to a WritableSignalLike. */
|
|
9
|
+
declare function convertGetterSetterToWritableSignalLike<T>(getter: () => T, setter: (v: T) => void): WritableSignalLike<T>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Options that are applicable to all event handlers.
|
|
13
|
+
*
|
|
14
|
+
* This library has not yet had a need for stopPropagationImmediate.
|
|
15
|
+
*/
|
|
16
|
+
interface EventHandlerOptions {
|
|
17
|
+
stopPropagation: boolean;
|
|
18
|
+
preventDefault: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** A basic event handler. */
|
|
21
|
+
type EventHandler<T extends Event> = (event: T) => void;
|
|
22
|
+
/** A function that determines whether an event is to be handled. */
|
|
23
|
+
type EventMatcher<T extends Event> = (event: T) => boolean;
|
|
24
|
+
/** A config that specifies how to handle a particular event. */
|
|
25
|
+
interface EventHandlerConfig<T extends Event> extends EventHandlerOptions {
|
|
26
|
+
matcher: EventMatcher<T>;
|
|
27
|
+
handler: EventHandler<T>;
|
|
28
|
+
}
|
|
29
|
+
/** Bit flag representation of the possible modifier keys that can be present on an event. */
|
|
30
|
+
declare enum ModifierKey {
|
|
31
|
+
None = 0,
|
|
32
|
+
Ctrl = 1,
|
|
33
|
+
Shift = 2,
|
|
34
|
+
Alt = 4,
|
|
35
|
+
Meta = 8,
|
|
36
|
+
Any = "Any"
|
|
37
|
+
}
|
|
38
|
+
type ModifierInputs = ModifierKey | ModifierKey[];
|
|
39
|
+
/**
|
|
40
|
+
* Abstract base class for all event managers.
|
|
41
|
+
*
|
|
42
|
+
* Event managers are designed to normalize how event handlers are authored and create a safety net
|
|
43
|
+
* for common event handling gotchas like remembering to call preventDefault or stopPropagation.
|
|
44
|
+
*/
|
|
45
|
+
declare abstract class EventManager<T extends Event> {
|
|
46
|
+
protected configs: EventHandlerConfig<T>[];
|
|
47
|
+
abstract options: EventHandlerOptions;
|
|
48
|
+
/** Runs the handlers that match with the given event. */
|
|
49
|
+
handle(event: T): void;
|
|
50
|
+
/** Configures the event manager to handle specific events. (See subclasses for more). */
|
|
51
|
+
abstract on(...args: [...unknown[]]): this;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Used to represent a keycode.
|
|
56
|
+
*
|
|
57
|
+
* This is used to match whether an events keycode should be handled. The ability to match using a
|
|
58
|
+
* string, SignalLike, or Regexp gives us more flexibility when authoring event handlers.
|
|
59
|
+
*/
|
|
60
|
+
type KeyCode = string | SignalLike<string> | RegExp;
|
|
61
|
+
/**
|
|
62
|
+
* An event manager that is specialized for handling keyboard events. By default this manager stops
|
|
63
|
+
* propagation and prevents default on all events it handles.
|
|
64
|
+
*/
|
|
65
|
+
declare class KeyboardEventManager<T extends KeyboardEvent> extends EventManager<T> {
|
|
66
|
+
options: EventHandlerOptions;
|
|
67
|
+
/** Configures this event manager to handle events with a specific key and no modifiers. */
|
|
68
|
+
on(key: KeyCode, handler: EventHandler<T>): this;
|
|
69
|
+
/** Configures this event manager to handle events with a specific modifer and key combination. */
|
|
70
|
+
on(modifiers: ModifierInputs, key: KeyCode, handler: EventHandler<T>): this;
|
|
71
|
+
private _normalizeInputs;
|
|
72
|
+
private _isMatch;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The different mouse buttons that may appear on a pointer event.
|
|
77
|
+
*/
|
|
78
|
+
declare enum MouseButton {
|
|
79
|
+
Main = 0,
|
|
80
|
+
Auxiliary = 1,
|
|
81
|
+
Secondary = 2
|
|
82
|
+
}
|
|
83
|
+
/** An event manager that is specialized for handling pointer events. */
|
|
84
|
+
declare class PointerEventManager<T extends PointerEvent> extends EventManager<T> {
|
|
85
|
+
options: EventHandlerOptions;
|
|
86
|
+
/**
|
|
87
|
+
* Configures this event manager to handle events with a specific modifer and mouse button
|
|
88
|
+
* combination.
|
|
89
|
+
*/
|
|
90
|
+
on(button: MouseButton, modifiers: ModifierInputs, handler: EventHandler<T>): this;
|
|
91
|
+
/**
|
|
92
|
+
* Configures this event manager to handle events with a specific mouse button and no modifiers.
|
|
93
|
+
*/
|
|
94
|
+
on(modifiers: ModifierInputs, handler: EventHandler<T>): this;
|
|
95
|
+
/**
|
|
96
|
+
* Configures this event manager to handle events with the main mouse button and no modifiers.
|
|
97
|
+
*
|
|
98
|
+
* @param handler The handler function
|
|
99
|
+
* @param options Options for whether to stop propagation or prevent default.
|
|
100
|
+
*/
|
|
101
|
+
on(handler: EventHandler<T>): this;
|
|
102
|
+
private _normalizeInputs;
|
|
103
|
+
_isMatch(event: PointerEvent, button: MouseButton, modifiers: ModifierInputs): boolean;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Represents an item in a collection, such as a listbox option, than may receive focus. */
|
|
107
|
+
interface ListFocusItem {
|
|
108
|
+
/** A unique identifier for the item. */
|
|
109
|
+
id: SignalLike<string>;
|
|
110
|
+
/** The html element that should receive focus. */
|
|
111
|
+
element: SignalLike<HTMLElement>;
|
|
112
|
+
/** Whether an item is disabled. */
|
|
113
|
+
disabled: SignalLike<boolean>;
|
|
114
|
+
}
|
|
115
|
+
/** Represents the required inputs for a collection that contains focusable items. */
|
|
116
|
+
interface ListFocusInputs<T extends ListFocusItem> {
|
|
117
|
+
/** The focus strategy used by the list. */
|
|
118
|
+
focusMode: SignalLike<'roving' | 'activedescendant'>;
|
|
119
|
+
/** Whether the list is disabled. */
|
|
120
|
+
disabled: SignalLike<boolean>;
|
|
121
|
+
/** The items in the list. */
|
|
122
|
+
items: SignalLike<T[]>;
|
|
123
|
+
/** The index of the current active item. */
|
|
124
|
+
activeIndex: WritableSignalLike<number>;
|
|
125
|
+
/** Whether disabled items in the list should be skipped when navigating. */
|
|
126
|
+
skipDisabled: SignalLike<boolean>;
|
|
127
|
+
}
|
|
128
|
+
/** Controls focus for a list of items. */
|
|
129
|
+
declare class ListFocus<T extends ListFocusItem> {
|
|
130
|
+
readonly inputs: ListFocusInputs<T>;
|
|
131
|
+
/** The last index that was active. */
|
|
132
|
+
prevActiveIndex: i0.WritableSignal<number>;
|
|
133
|
+
/** The current active item. */
|
|
134
|
+
activeItem: i0.Signal<T>;
|
|
135
|
+
constructor(inputs: ListFocusInputs<T>);
|
|
136
|
+
/** Whether the list is in a disabled state. */
|
|
137
|
+
isListDisabled(): boolean;
|
|
138
|
+
/** The id of the current active item. */
|
|
139
|
+
getActiveDescendant(): string | undefined;
|
|
140
|
+
/** The tabindex for the list. */
|
|
141
|
+
getListTabindex(): -1 | 0;
|
|
142
|
+
/** Returns the tabindex for the given item. */
|
|
143
|
+
getItemTabindex(item: T): -1 | 0;
|
|
144
|
+
/** Moves focus to the given item if it is focusable. */
|
|
145
|
+
focus(item: T): boolean;
|
|
146
|
+
/** Returns true if the given item can be navigated to. */
|
|
147
|
+
isFocusable(item: T): boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Represents an item in a collection, such as a listbox option, than can be selected. */
|
|
151
|
+
interface ListSelectionItem<V> extends ListFocusItem {
|
|
152
|
+
/** The value of the item. */
|
|
153
|
+
value: SignalLike<V>;
|
|
154
|
+
}
|
|
155
|
+
/** Represents the required inputs for a collection that contains selectable items. */
|
|
156
|
+
interface ListSelectionInputs<T extends ListSelectionItem<V>, V> extends ListFocusInputs<T> {
|
|
157
|
+
/** Whether multiple items in the list can be selected at once. */
|
|
158
|
+
multi: SignalLike<boolean>;
|
|
159
|
+
/** The current value of the list selection. */
|
|
160
|
+
value: WritableSignalLike<V[]>;
|
|
161
|
+
/** The selection strategy used by the list. */
|
|
162
|
+
selectionMode: SignalLike<'follow' | 'explicit'>;
|
|
163
|
+
}
|
|
164
|
+
/** Controls selection for a list of items. */
|
|
165
|
+
declare class ListSelection<T extends ListSelectionItem<V>, V> {
|
|
166
|
+
readonly inputs: ListSelectionInputs<T, V> & {
|
|
167
|
+
focusManager: ListFocus<T>;
|
|
168
|
+
};
|
|
169
|
+
/** The start index to use for range selection. */
|
|
170
|
+
rangeStartIndex: i0.WritableSignal<number>;
|
|
171
|
+
/** The end index to use for range selection. */
|
|
172
|
+
rangeEndIndex: i0.WritableSignal<number>;
|
|
173
|
+
constructor(inputs: ListSelectionInputs<T, V> & {
|
|
174
|
+
focusManager: ListFocus<T>;
|
|
175
|
+
});
|
|
176
|
+
/** Selects the item at the current active index. */
|
|
177
|
+
select(item?: ListSelectionItem<V>, opts?: {
|
|
178
|
+
anchor: boolean;
|
|
179
|
+
}): void;
|
|
180
|
+
/** Deselects the item at the current active index. */
|
|
181
|
+
deselect(item?: T): void;
|
|
182
|
+
/** Toggles the item at the current active index. */
|
|
183
|
+
toggle(): void;
|
|
184
|
+
/** Toggles only the item at the current active index. */
|
|
185
|
+
toggleOne(): void;
|
|
186
|
+
/** Selects all items in the list. */
|
|
187
|
+
selectAll(): void;
|
|
188
|
+
/** Deselects all items in the list. */
|
|
189
|
+
deselectAll(): void;
|
|
190
|
+
/**
|
|
191
|
+
* Selects all items in the list or deselects all
|
|
192
|
+
* items in the list if all items are already selected.
|
|
193
|
+
*/
|
|
194
|
+
toggleAll(): void;
|
|
195
|
+
/** Sets the selection to only the current active item. */
|
|
196
|
+
selectOne(): void;
|
|
197
|
+
/**
|
|
198
|
+
* Selects all items in the list up to the anchor item.
|
|
199
|
+
*
|
|
200
|
+
* Deselects all items that were previously within the
|
|
201
|
+
* selected range that are now outside of the selected range
|
|
202
|
+
*/
|
|
203
|
+
selectRange(opts?: {
|
|
204
|
+
anchor: boolean;
|
|
205
|
+
}): void;
|
|
206
|
+
/** Marks the given index as the start of a range selection. */
|
|
207
|
+
beginRangeSelection(index?: number): void;
|
|
208
|
+
/** Returns the items in the list starting from the given index. */
|
|
209
|
+
private _getItemsFromIndex;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Represents an item in a collection, such as a listbox option, than can be navigated to. */
|
|
213
|
+
interface ListNavigationItem extends ListFocusItem {
|
|
214
|
+
}
|
|
215
|
+
/** Represents the required inputs for a collection that has navigable items. */
|
|
216
|
+
interface ListNavigationInputs<T extends ListNavigationItem> extends ListFocusInputs<T> {
|
|
217
|
+
/** Whether focus should wrap when navigating. */
|
|
218
|
+
wrap: SignalLike<boolean>;
|
|
219
|
+
/** Whether the list is vertically or horizontally oriented. */
|
|
220
|
+
orientation: SignalLike<'vertical' | 'horizontal'>;
|
|
221
|
+
/** The direction that text is read based on the users locale. */
|
|
222
|
+
textDirection: SignalLike<'rtl' | 'ltr'>;
|
|
223
|
+
}
|
|
224
|
+
/** Controls navigation for a list of items. */
|
|
225
|
+
declare class ListNavigation<T extends ListNavigationItem> {
|
|
226
|
+
readonly inputs: ListNavigationInputs<T> & {
|
|
227
|
+
focusManager: ListFocus<T>;
|
|
228
|
+
};
|
|
229
|
+
constructor(inputs: ListNavigationInputs<T> & {
|
|
230
|
+
focusManager: ListFocus<T>;
|
|
231
|
+
});
|
|
232
|
+
/** Navigates to the given item. */
|
|
233
|
+
goto(item?: T): boolean;
|
|
234
|
+
/** Navigates to the next item in the list. */
|
|
235
|
+
next(): boolean;
|
|
236
|
+
/** Navigates to the previous item in the list. */
|
|
237
|
+
prev(): boolean;
|
|
238
|
+
/** Navigates to the first item in the list. */
|
|
239
|
+
first(): boolean;
|
|
240
|
+
/** Navigates to the last item in the list. */
|
|
241
|
+
last(): boolean;
|
|
242
|
+
/** Advances to the next or previous focusable item in the list based on the given delta. */
|
|
243
|
+
private _advance;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export { KeyboardEventManager, ListFocus, ListNavigation, ListSelection, PointerEventManager, convertGetterSetterToWritableSignalLike };
|
|
247
|
+
export type { ListFocusInputs, ListFocusItem, ListNavigationInputs, ListNavigationItem, ListSelectionInputs, ListSelectionItem, SignalLike, WritableSignalLike };
|
package/listbox/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import * as _angular_cdk_bidi from '@angular/cdk/bidi';
|
|
3
|
-
import {
|
|
3
|
+
import { OptionPattern, ListboxPattern } from '../listbox.d-DJqDR_H3.js';
|
|
4
|
+
import '../list-navigation.d-cy63EByU.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* A listbox container.
|