Skip to content

Commit 4be9a6e

Browse files
authored
refactor(multiple): clean up more ViewEngine-specific code (#23960)
Cleans up a bunch of workarounds and docs that were specific to ViewEngine. There are still more places to clean up, but I'm trying to make it easier to track down any potential failures.
1 parent 6f1a1b7 commit 4be9a6e

File tree

24 files changed

+15
-229
lines changed

24 files changed

+15
-229
lines changed

src/cdk-experimental/dialog/dialog-module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,5 @@ import {
3737
{provide: DIALOG_CONTAINER, useValue: CdkDialogContainer},
3838
{provide: DIALOG_CONFIG, useValue: DialogConfig},
3939
],
40-
entryComponents: [CdkDialogContainer],
4140
})
4241
export class DialogModule {}

src/cdk/drag-drop/directives/drag.spec.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4698,17 +4698,6 @@ describe('CdkDrag', () => {
46984698
}));
46994699

47004700
it('should be able to start dragging again if the dragged item is destroyed', fakeAsync(() => {
4701-
// We have some behavior where we move the dragged element out to the bottom of the `body`,
4702-
// in order to work around a browser issue. We restore the element when dragging stops, but
4703-
// the problem is that if it's destroyed before we've had a chance to return it, ViewEngine
4704-
// will throw an error since the element isn't in its original parent. Skip this test if the
4705-
// component hasn't been compiled with Ivy since the assertions depend on the element being
4706-
// removed while dragging.
4707-
// TODO(crisbeto): remove this check once ViewEngine has been dropped.
4708-
if (!DraggableInDropZone.hasOwnProperty('ɵcmp')) {
4709-
return;
4710-
}
4711-
47124701
const fixture = createComponent(DraggableInDropZone);
47134702
fixture.detectChanges();
47144703

src/cdk/portal/portal.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ A component can use `@ViewChild` or `@ViewChildren` to get a reference to a
5050
`CdkPortal`.
5151

5252
##### `ComponentPortal`
53-
Used to create a portal from a component type. When a component is dynamically created using
54-
portals, it must be included in the `entryComponents` of its `NgModule`if your project uses ViewEngine. Projects
55-
using Angular Ivy don't need `entryComponents`.
53+
Used to create a portal from a component type.
5654

5755
Usage:
5856
```ts

src/dev-app/main-module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ import {ANIMATIONS_STORAGE_KEY} from './dev-app/dev-app-layout';
2424
@NgModule({
2525
imports: [
2626
BrowserAnimationsModule.withConfig({
27-
// Note that this doesn't seem to work on ViewEngine, but it's
28-
// not a compilation error either so we can live with it.
2927
disableAnimations: localStorage.getItem(ANIMATIONS_STORAGE_KEY) === 'true',
3028
}),
3129
BrowserModule,

src/material-experimental/column-resize/column-resize-module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const ENTRY_COMMON_COMPONENTS = [MatColumnResizeOverlayHandle];
2323
@NgModule({
2424
declarations: ENTRY_COMMON_COMPONENTS,
2525
exports: ENTRY_COMMON_COMPONENTS,
26-
entryComponents: ENTRY_COMMON_COMPONENTS,
2726
})
2827
export class MatColumnResizeCommonModule {}
2928

src/material-experimental/mdc-button/fab.ts

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,11 @@ const defaults = MAT_FAB_DEFAULT_OPTIONS_FACTORY();
6666
selector: `button[mat-fab]`,
6767
templateUrl: 'button.html',
6868
styleUrls: ['fab.css'],
69-
// TODO: change to MAT_BUTTON_INPUTS/MAT_BUTTON_HOST with spread after ViewEngine is deprecated
70-
inputs: ['disabled', 'disableRipple', 'color', 'extended'],
69+
inputs: [...MAT_BUTTON_INPUTS, 'extended'],
7170
host: {
71+
...MAT_BUTTON_HOST,
7272
'[class.mdc-fab--extended]': 'extended',
7373
'[class.mat-mdc-extended-fab]': 'extended',
74-
'[attr.disabled]': 'disabled || null',
75-
'[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
76-
// MDC automatically applies the primary theme color to the button, but we want to support
77-
// an unthemed version. If color is undefined, apply a CSS class that makes it easy to
78-
// select and style this "theme".
79-
'[class.mat-unthemed]': '!color',
80-
// Add a class that applies to all buttons. This makes it easier to target if somebody
81-
// wants to target all Material buttons.
82-
'[class.mat-mdc-button-base]': 'true',
8374
},
8475
exportAs: 'matButton',
8576
encapsulation: ViewEncapsulation.None,
@@ -153,26 +144,11 @@ export class MatMiniFabButton extends MatButtonBase {
153144
selector: `a[mat-fab]`,
154145
templateUrl: 'button.html',
155146
styleUrls: ['fab.css'],
156-
// TODO: change to MAT_ANCHOR_INPUTS/MAT_ANCHOR_HOST with spread after ViewEngine is deprecated
157-
inputs: ['disabled', 'disableRipple', 'color', 'tabIndex', 'extended'],
147+
inputs: [...MAT_BUTTON_INPUTS, 'extended'],
158148
host: {
149+
...MAT_ANCHOR_HOST,
159150
'[class.mdc-fab--extended]': 'extended',
160151
'[class.mat-mdc-extended-fab]': 'extended',
161-
'[attr.disabled]': 'disabled || null',
162-
'[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
163-
164-
// Note that we ignore the user-specified tabindex when it's disabled for
165-
// consistency with the `mat-button` applied on native buttons where even
166-
// though they have an index, they're not tabbable.
167-
'[attr.tabindex]': 'disabled ? -1 : (tabIndex || 0)',
168-
'[attr.aria-disabled]': 'disabled.toString()',
169-
// MDC automatically applies the primary theme color to the button, but we want to support
170-
// an unthemed version. If color is undefined, apply a CSS class that makes it easy to
171-
// select and style this "theme".
172-
'[class.mat-unthemed]': '!color',
173-
// Add a class that applies to all buttons. This makes it easier to target if somebody
174-
// wants to target all Material buttons.
175-
'[class.mat-mdc-button-base]': 'true',
176152
},
177153
exportAs: 'matButton, matAnchor',
178154
encapsulation: ViewEncapsulation.None,

src/material-experimental/mdc-dialog/module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,5 @@ import {
3737
MatDialogContent,
3838
],
3939
providers: [MatDialog, MAT_DIALOG_SCROLL_STRATEGY_PROVIDER],
40-
entryComponents: [MatDialogContainer],
4140
})
4241
export class MatDialogModule {}

src/material-experimental/mdc-snack-bar/module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,5 @@ import {MatSnackBarAction, MatSnackBarActions, MatSnackBarLabel} from './snack-b
3333
MatSnackBarActions,
3434
MatSnackBarAction,
3535
],
36-
entryComponents: [MatSimpleSnackBar, MatSnackBarContainer],
3736
})
3837
export class MatSnackBarModule {}

src/material-experimental/mdc-tooltip/module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {MatTooltip, TooltipComponent} from './tooltip';
1919
imports: [A11yModule, CommonModule, OverlayModule, MatCommonModule],
2020
exports: [MatTooltip, TooltipComponent, MatCommonModule, CdkScrollableModule],
2121
declarations: [MatTooltip, TooltipComponent],
22-
entryComponents: [TooltipComponent],
2322
providers: [MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER],
2423
})
2524
export class MatTooltipModule {}

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

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

9-
import {coerceNumberProperty} from '@angular/cdk/coercion';
109
import {CdkRowSelection} from '@angular/cdk-experimental/selection';
1110
import {Input, Directive} from '@angular/core';
1211

@@ -24,20 +23,9 @@ import {Input, Directive} from '@angular/core';
2423
'[attr.aria-selected]': '_selection.isSelected(this.value, this.index)',
2524
},
2625
providers: [{provide: CdkRowSelection, useExisting: MatRowSelection}],
26+
inputs: ['index: matRowSelectionIndex'],
2727
})
28-
// tslint:disable-next-line: coercion-types
2928
export class MatRowSelection<T> extends CdkRowSelection<T> {
3029
/** The value that is associated with the row */
3130
@Input('matRowSelectionValue') override value: T;
32-
33-
/** The index of the value in the list. Required when used with `trackBy` */
34-
@Input('matRowSelectionIndex')
35-
override get index(): number | undefined {
36-
return this._index;
37-
}
38-
override set index(index: number | undefined) {
39-
// TODO: when we remove support for ViewEngine, change this setter to an input
40-
// alias in the decorator metadata.
41-
this._index = coerceNumberProperty(index);
42-
}
4331
}

0 commit comments

Comments
 (0)