Skip to content

Commit 0c129e6

Browse files
authored
Merge branch 'angular:main' into chip-edit
2 parents 514146e + 9288222 commit 0c129e6

File tree

13 files changed

+411
-46
lines changed

13 files changed

+411
-46
lines changed

WORKSPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ esbuild_register_toolchains(
242242

243243
git_repository(
244244
name = "rules_browsers",
245-
commit = "c8246bb6d8bba4e2ae23fc39c7b0cec651953e6d",
245+
commit = "671017c30c0a595d7d639f59c6985255e4b90e0a",
246246
remote = "https://github.com/devversion/rules_browsers.git",
247247
)
248248

docs/src/app/pages/component-sidenav/component-sidenav.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ div.docs-component-viewer-nav-content .mat-nav-list .mat-mdc-list-item .mat-list
117117

118118
@media (max-width: 720px) {
119119
.docs-component-viewer-sidenav-container {
120-
flex: 1 0 auto;
120+
flex: 1 0;
121121
}
122122

123123
.docs-component-sidenav-body-content {

goldens/cdk/dialog/index.api.md

+14-8
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { ViewContainerRef } from '@angular/core';
3838
export type AutoFocusTarget = 'dialog' | 'first-tabbable' | 'first-heading';
3939

4040
// @public
41-
export class CdkDialogContainer<C extends DialogConfig = DialogConfig> extends BasePortalOutlet implements OnDestroy {
41+
export class CdkDialogContainer<C extends DialogConfig = DialogConfig> extends BasePortalOutlet implements DialogContainer, OnDestroy {
4242
constructor(...args: unknown[]);
4343
// (undocumented)
4444
_addAriaLabelledBy(id: string): void;
@@ -62,6 +62,8 @@ export class CdkDialogContainer<C extends DialogConfig = DialogConfig> extends B
6262
// (undocumented)
6363
protected _focusTrapFactory: FocusTrapFactory;
6464
// (undocumented)
65+
_focusTrapped: Observable<void>;
66+
// (undocumented)
6567
ngOnDestroy(): void;
6668
// (undocumented)
6769
protected _ngZone: NgZone;
@@ -111,7 +113,7 @@ export interface DialogCloseOptions {
111113
}
112114

113115
// @public
114-
export class DialogConfig<D = unknown, R = unknown, C extends BasePortalOutlet = BasePortalOutlet> {
116+
export class DialogConfig<D = unknown, R = unknown, C extends DialogContainer = BasePortalOutlet> {
115117
ariaDescribedBy?: string | null;
116118
ariaLabel?: string | null;
117119
ariaLabelledBy?: string | null;
@@ -149,6 +151,13 @@ export class DialogConfig<D = unknown, R = unknown, C extends BasePortalOutlet =
149151
width?: string;
150152
}
151153

154+
// @public
155+
export type DialogContainer = BasePortalOutlet & {
156+
_focusTrapped?: Observable<void>;
157+
_closeInteractionType?: FocusOrigin;
158+
_recaptureFocus?: () => void;
159+
};
160+
152161
// @public (undocumented)
153162
export class DialogModule {
154163
// (undocumented)
@@ -161,19 +170,16 @@ export class DialogModule {
161170

162171
// @public
163172
export class DialogRef<R = unknown, C = unknown> {
164-
constructor(overlayRef: OverlayRef, config: DialogConfig<any, DialogRef<R, C>, BasePortalOutlet>);
173+
constructor(overlayRef: OverlayRef, config: DialogConfig<any, DialogRef<R, C>, DialogContainer>);
165174
addPanelClass(classes: string | string[]): this;
166175
readonly backdropClick: Observable<MouseEvent>;
167176
close(result?: R, options?: DialogCloseOptions): void;
168177
readonly closed: Observable<R | undefined>;
169178
readonly componentInstance: C | null;
170179
readonly componentRef: ComponentRef<C> | null;
171180
// (undocumented)
172-
readonly config: DialogConfig<any, DialogRef<R, C>, BasePortalOutlet>;
173-
readonly containerInstance: BasePortalOutlet & {
174-
_closeInteractionType?: FocusOrigin;
175-
_recaptureFocus?: () => void;
176-
};
181+
readonly config: DialogConfig<any, DialogRef<R, C>, DialogContainer>;
182+
readonly containerInstance: DialogContainer;
177183
disableClose: boolean | undefined;
178184
readonly id: string;
179185
readonly keydownEvents: Observable<KeyboardEvent>;

src/cdk-experimental/tabs/tabs.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
inject,
2121
input,
2222
model,
23-
signal,
23+
linkedSignal,
2424
} from '@angular/core';
2525
import {toSignal} from '@angular/core/rxjs-interop';
2626
import {TabListPattern, TabPanelPattern, TabPattern} from '../ui-patterns';
@@ -97,6 +97,9 @@ export class CdkTabList {
9797
/** The CdkTabs nested inside of the CdkTabList. */
9898
private readonly _cdkTabs = contentChildren(CdkTab);
9999

100+
/** The internal tab selection state. */
101+
private readonly _selection = linkedSignal(() => (this.tab() ? [this.tab()!] : []));
102+
100103
/** A signal wrapper for directionality. */
101104
protected textDirection = toSignal(this._directionality.change, {
102105
initialValue: this._directionality.value,
@@ -126,13 +129,21 @@ export class CdkTabList {
126129
/** The current index that has been navigated to. */
127130
activeIndex = model<number>(0);
128131

132+
// TODO(ok7sai): Provides a default state when there is no pre-select tab.
133+
/** The current selected tab. */
134+
tab = model<string | undefined>();
135+
129136
/** The TabList UIPattern. */
130137
pattern: TabListPattern = new TabListPattern({
131138
...this,
132139
items: this.tabs,
133140
textDirection: this.textDirection,
134-
value: signal<string[]>([]),
141+
value: this._selection,
135142
});
143+
144+
constructor() {
145+
effect(() => this.tab.set(this._selection()[0]));
146+
}
136147
}
137148

138149
/** A selectable tab in a TabList. */

src/cdk-experimental/ui-patterns/tabs/BUILD.bazel

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("//tools:defaults.bzl", "ts_project")
1+
load("//tools:defaults.bzl", "ng_web_test_suite", "ts_project")
22

33
package(default_visibility = ["//visibility:public"])
44

@@ -17,3 +17,22 @@ ts_project(
1717
"//src/cdk-experimental/ui-patterns/behaviors/signal-like",
1818
],
1919
)
20+
21+
ts_project(
22+
name = "unit_test_sources",
23+
testonly = True,
24+
srcs = [
25+
"tabs.spec.ts",
26+
],
27+
deps = [
28+
":tabs",
29+
"//:node_modules/@angular/core",
30+
"//src/cdk/keycodes",
31+
"//src/cdk/testing/private",
32+
],
33+
)
34+
35+
ng_web_test_suite(
36+
name = "unit_tests",
37+
deps = [":unit_test_sources"],
38+
)

0 commit comments

Comments
 (0)