Skip to content

Commit 3b0c3fc

Browse files
committed
feat(cdk-experiment/selection): Merge to master
1 parent 3967b15 commit 3b0c3fc

File tree

12 files changed

+33
-28
lines changed

12 files changed

+33
-28
lines changed

src/cdk-experimental/selection/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package(default_visibility = ["//visibility:public"])
2-
31
load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite")
42

3+
package(default_visibility = ["//visibility:public"])
4+
55
ng_module(
66
name = "selection",
77
srcs = glob(

src/cdk-experimental/selection/select-all.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class CdkSelectAll<T> implements OnDestroy, OnInit {
6767
private readonly _destroyed = new Subject<void>();
6868

6969
constructor(
70-
@Optional() private readonly _selection: CdkSelection<T>,
70+
@Optional() @Inject(CdkSelection) private readonly _selection: CdkSelection<T>,
7171
@Optional() @Self() @Inject(NG_VALUE_ACCESSOR) private readonly _controlValueAccessor:
7272
ControlValueAccessor[]) {}
7373

src/cdk-experimental/selection/selection-column.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
ViewChild,
1818
ChangeDetectionStrategy,
1919
ViewEncapsulation,
20+
Inject,
2021
} from '@angular/core';
2122

2223
import {CdkSelection} from './selection';
@@ -71,8 +72,8 @@ export class CdkSelectionColumn<T> implements OnInit, OnDestroy {
7172
@ViewChild(CdkHeaderCellDef, {static: true}) private readonly _headerCell: CdkHeaderCellDef;
7273

7374
constructor(
74-
@Optional() private _table: CdkTable<T>,
75-
@Optional() readonly selection: CdkSelection<T>,
75+
@Optional() @Inject(CdkTable) private _table: CdkTable<T>,
76+
@Optional() @Inject(CdkSelection) readonly selection: CdkSelection<T>,
7677
) {}
7778

7879
ngOnInit() {

src/cdk-experimental/selection/selection-set.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import {Subject} from 'rxjs';
1515
*/
1616
interface TrackBySelection<T> {
1717
isSelected(value: SelectableWithIndex<T>): boolean;
18-
select(...values: Array<SelectableWithIndex<T>>): void;
19-
deselect(...values: Array<SelectableWithIndex<T>>): void;
18+
select(...values: SelectableWithIndex<T>[]): void;
19+
deselect(...values: SelectableWithIndex<T>[]): void;
2020
changed: Subject<SelectionChange<T>>;
2121
}
2222

@@ -33,8 +33,8 @@ export interface SelectableWithIndex<T> {
3333
* Represents the change in the selection set.
3434
*/
3535
export interface SelectionChange<T> {
36-
before: Array<SelectableWithIndex<T>>;
37-
after: Array<SelectableWithIndex<T>>;
36+
before: SelectableWithIndex<T>[];
37+
after: SelectableWithIndex<T>[];
3838
}
3939

4040
/**
@@ -54,7 +54,7 @@ export class SelectionSet<T> implements TrackBySelection<T> {
5454
return this._selectionMap.has(this._getTrackedByValue(value));
5555
}
5656

57-
select(...selects: Array<SelectableWithIndex<T>>) {
57+
select(...selects: SelectableWithIndex<T>[]) {
5858
if (!this._multiple && selects.length > 1 && isDevMode()) {
5959
throw Error('SelectionSet: not multiple selection');
6060
}
@@ -65,7 +65,7 @@ export class SelectionSet<T> implements TrackBySelection<T> {
6565
this._selectionMap.clear();
6666
}
6767

68-
const toSelect: Array<SelectableWithIndex<T>> = [];
68+
const toSelect: SelectableWithIndex<T>[] = [];
6969
for (const select of selects) {
7070
if (this.isSelected(select)) {
7171
continue;
@@ -80,13 +80,13 @@ export class SelectionSet<T> implements TrackBySelection<T> {
8080
this.changed.next({before, after});
8181
}
8282

83-
deselect(...selects: Array<SelectableWithIndex<T>>) {
83+
deselect(...selects: SelectableWithIndex<T>[]) {
8484
if (!this._multiple && selects.length > 1 && isDevMode()) {
8585
throw Error('SelectionSet: not multiple selection');
8686
}
8787

8888
const before = this._getCurrentSelection();
89-
const toDeselect: Array<SelectableWithIndex<T>> = [];
89+
const toDeselect: SelectableWithIndex<T>[] = [];
9090

9191
for (const select of selects) {
9292
if (!this.isSelected(select)) {
@@ -121,7 +121,7 @@ export class SelectionSet<T> implements TrackBySelection<T> {
121121
return this._trackByFn(select.index!, select.value);
122122
}
123123

124-
private _getCurrentSelection(): Array<SelectableWithIndex<T>> {
124+
private _getCurrentSelection(): SelectableWithIndex<T>[] {
125125
return Array.from(this._selectionMap.values());
126126
}
127127
}

src/cdk-experimental/selection/selection-toggle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class CdkSelectionToggle<T> implements OnDestroy, OnInit {
6161
private _destroyed = new Subject<void>();
6262

6363
constructor(
64-
@Optional() private _selection: CdkSelection<T>,
64+
@Optional() @Inject(CdkSelection) private _selection: CdkSelection<T>,
6565
@Optional() @Self() @Inject(NG_VALUE_ACCESSOR) private _controlValueAccessors:
6666
ControlValueAccessor[],
6767
) {}

src/cdk-experimental/selection/selection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export class CdkSelection<T> implements OnInit, AfterContentChecked, CollectionV
187187
}
188188

189189
private _selectAll() {
190-
const toSelect: Array<SelectableWithIndex<T>> = [];
190+
const toSelect: SelectableWithIndex<T>[] = [];
191191
this._data.forEach((value, index) => {
192192
toSelect.push({value, index});
193193
});
@@ -196,7 +196,7 @@ export class CdkSelection<T> implements OnInit, AfterContentChecked, CollectionV
196196
}
197197

198198
private _clearAll() {
199-
const toDeselect: Array<SelectableWithIndex<T>> = [];
199+
const toDeselect: SelectableWithIndex<T>[] = [];
200200
this._data.forEach((value, index) => {
201201
toDeselect.push({value, index});
202202
});

src/components-examples/cdk-experimental/selection/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package(default_visibility = ["//visibility:public"])
2-
31
load("//tools:defaults.bzl", "ng_module")
42

3+
package(default_visibility = ["//visibility:public"])
4+
55
ng_module(
66
name = "selection",
77
srcs = glob(["**/*.ts"]),

src/components-examples/material-experimental/selection/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package(default_visibility = ["//visibility:public"])
2-
31
load("//tools:defaults.bzl", "ng_module")
42

3+
package(default_visibility = ["//visibility:public"])
4+
55
ng_module(
66
name = "selection",
77
srcs = glob(["**/*.ts"]),

src/dev-app/example/example-module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
import {CommonModule} from '@angular/common';
10-
import {ExampleModule as DocsExampleModule} from '@angular/components-examples';
1110
import {NgModule} from '@angular/core';
1211
import {MatExpansionModule} from '@angular/material/expansion';
1312

src/dev-app/selection/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package(default_visibility = ["//visibility:public"])
2-
31
load("//tools:defaults.bzl", "ng_module")
42

3+
package(default_visibility = ["//visibility:public"])
4+
55
ng_module(
66
name = "selection",
77
srcs = glob(["**/*.ts"]),

src/material-experimental/selection/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package(default_visibility = ["//visibility:public"])
2-
31
load("//tools:defaults.bzl", "ng_module", "sass_binary", "sass_library")
42

3+
package(default_visibility = ["//visibility:public"])
4+
55
ng_module(
66
name = "selection",
77
srcs = glob(
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
@mixin mat-selection-theme($theme) {}
1+
@import '../../material/core/theming/check-duplicate-styles';
22

3-
@mixin mat-selection-typography($config) {}
3+
@mixin mat-selection-theme($theme-or-color-config) {
4+
$theme: _mat-legacy-get-theme($theme-or-color-config);
5+
@include _mat-check-duplicate-theme-styles($theme, 'mat-selection');
6+
}
7+
8+
@mixin mat-selection-typography($config-or-theme) {}

0 commit comments

Comments
 (0)