Skip to content

Commit 6970266

Browse files
committed
refactor(material-experimental/selection): switch to standalone
Reworks `material-experimental/selection` to support standalone.
1 parent 30fc1b8 commit 6970266

File tree

6 files changed

+33
-4
lines changed

6 files changed

+33
-4
lines changed

src/material-experimental/selection/row-selection.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {Input, Directive} from '@angular/core';
2424
},
2525
providers: [{provide: CdkRowSelection, useExisting: MatRowSelection}],
2626
inputs: ['index: matRowSelectionIndex'],
27+
standalone: true,
2728
})
2829
export class MatRowSelection<T> extends CdkRowSelection<T> {
2930
/** The value that is associated with the row */

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ import {Directive} from '@angular/core';
2323
selector: '[matSelectAll]',
2424
exportAs: 'matSelectAll',
2525
providers: [{provide: CdkSelectAll, useExisting: MatSelectAll}],
26+
standalone: true,
2627
})
2728
export class MatSelectAll<T> extends CdkSelectAll<T> {}

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {MatCellDef, MatColumnDef, MatHeaderCellDef, MatTable} from '@angular/material/table';
9+
import {
10+
MatCell,
11+
MatCellDef,
12+
MatColumnDef,
13+
MatHeaderCell,
14+
MatHeaderCellDef,
15+
MatTable,
16+
} from '@angular/material/table';
1017
import {
1118
Component,
1219
Input,
@@ -18,8 +25,12 @@ import {
1825
ViewEncapsulation,
1926
Inject,
2027
} from '@angular/core';
28+
import {AsyncPipe} from '@angular/common';
2129

2230
import {MatSelection} from './selection';
31+
import {MatCheckbox} from '@angular/material/checkbox';
32+
import {MatSelectionToggle} from './selection-toggle';
33+
import {MatSelectAll} from './select-all';
2334

2435
/**
2536
* Column that adds row selecting checkboxes and a select-all checkbox if `matSelectionMultiple` is
@@ -50,6 +61,18 @@ import {MatSelection} from './selection';
5061
changeDetection: ChangeDetectionStrategy.OnPush,
5162
styleUrls: ['selection-column.css'],
5263
encapsulation: ViewEncapsulation.None,
64+
standalone: true,
65+
imports: [
66+
MatColumnDef,
67+
MatHeaderCellDef,
68+
MatHeaderCell,
69+
MatCheckbox,
70+
MatSelectAll,
71+
MatCellDef,
72+
MatCell,
73+
MatSelectionToggle,
74+
AsyncPipe,
75+
],
5376
})
5477
export class MatSelectionColumn<T> implements OnInit, OnDestroy {
5578
/** Column name that should be used to reference this column. */

src/material-experimental/selection/selection-module.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ import {MatSelectionColumn} from './selection-column';
1919
import {MatRowSelection} from './row-selection';
2020

2121
@NgModule({
22-
imports: [CommonModule, MatTableModule, MatCheckboxModule],
23-
exports: [MatSelectAll, MatSelection, MatSelectionToggle, MatSelectionColumn, MatRowSelection],
24-
declarations: [
22+
imports: [
23+
CommonModule,
24+
MatTableModule,
25+
MatCheckboxModule,
2526
MatSelectAll,
2627
MatSelection,
2728
MatSelectionToggle,
2829
MatSelectionColumn,
2930
MatRowSelection,
3031
],
32+
exports: [MatSelectAll, MatSelection, MatSelectionToggle, MatSelectionColumn, MatRowSelection],
3133
})
3234
export class MatSelectionModule {}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {Directive, Input} from '@angular/core';
2424
exportAs: 'matSelectionToggle',
2525
inputs: ['index: matSelectionToggleIndex'],
2626
providers: [{provide: CdkSelectionToggle, useExisting: MatSelectionToggle}],
27+
standalone: true,
2728
})
2829
export class MatSelectionToggle<T> extends CdkSelectionToggle<T> {
2930
/** The value that is associated with the toggle */

src/material-experimental/selection/selection.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {Directive, Input, Output, EventEmitter} from '@angular/core';
2020
selector: '[matSelection]',
2121
exportAs: 'matSelection',
2222
providers: [{provide: CdkSelection, useExisting: MatSelection}],
23+
standalone: true,
2324
})
2425
// tslint:disable-next-line: coercion-types
2526
export class MatSelection<T> extends CdkSelection<T> {

0 commit comments

Comments
 (0)