Skip to content

Commit 7fde1c2

Browse files
committed
refactor(multiple): remove standalone flag from CDK
Removes all of the `standalone` flag from all components in the CDK.
1 parent 0649e2f commit 7fde1c2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+103
-91
lines changed

src/cdk/a11y/focus-monitor/focus-monitor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,6 @@ export class FocusMonitor implements OnDestroy {
617617
@Directive({
618618
selector: '[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]',
619619
exportAs: 'cdkMonitorFocus',
620-
standalone: true,
621620
})
622621
export class CdkMonitorFocus implements AfterViewInit, OnDestroy {
623622
private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);

src/cdk/a11y/focus-trap/focus-trap.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ export class FocusTrapFactory {
403403
@Directive({
404404
selector: '[cdkTrapFocus]',
405405
exportAs: 'cdkTrapFocus',
406-
standalone: true,
407406
})
408407
export class CdkTrapFocus implements OnDestroy, AfterContentInit, OnChanges, DoCheck {
409408
private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);

src/cdk/a11y/live-announcer/live-announcer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ export class LiveAnnouncer implements OnDestroy {
210210
@Directive({
211211
selector: '[cdkAriaLive]',
212212
exportAs: 'cdkAriaLive',
213-
standalone: true,
214213
})
215214
export class CdkAriaLive implements OnDestroy {
216215
private _elementRef = inject(ElementRef);

src/cdk/accordion/accordion-item.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ let nextId = 0;
3636
// registering to the same accordion.
3737
{provide: CDK_ACCORDION, useValue: undefined},
3838
],
39-
standalone: true,
4039
})
4140
export class CdkAccordionItem implements OnInit, OnDestroy {
4241
accordion = inject<CdkAccordion>(CDK_ACCORDION, {optional: true, skipSelf: true})!;

src/cdk/accordion/accordion.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export const CDK_ACCORDION = new InjectionToken<CdkAccordion>('CdkAccordion');
3434
selector: 'cdk-accordion, [cdkAccordion]',
3535
exportAs: 'cdkAccordion',
3636
providers: [{provide: CDK_ACCORDION, useExisting: CdkAccordion}],
37-
standalone: true,
3837
})
3938
export class CdkAccordion implements OnDestroy, OnChanges {
4039
/** Emits when the state of the accordion changes */

src/cdk/bidi/dir.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {Direction, Directionality, _resolveDirectionality} from './directionalit
2121
providers: [{provide: Directionality, useExisting: Dir}],
2222
host: {'[attr.dir]': '_rawDir'},
2323
exportAs: 'dir',
24-
standalone: true,
2524
})
2625
export class Dir implements Directionality, AfterContentInit, OnDestroy {
2726
/** Normalized direction that accounts for invalid/unsupported values. */

src/cdk/clipboard/copy-to-clipboard.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export const CDK_COPY_TO_CLIPBOARD_CONFIG = new InjectionToken<CdkCopyToClipboar
3939
host: {
4040
'(click)': 'copy()',
4141
},
42-
standalone: true,
4342
})
4443
export class CdkCopyToClipboard implements OnDestroy {
4544
private _clipboard = inject(Clipboard);

src/cdk/dialog/dialog-container.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ export function throwDialogContentAlreadyAttachedError() {
5656
// Using OnPush for dialogs caused some G3 sync issues. Disabled until we can track them down.
5757
// tslint:disable-next-line:validate-decorators
5858
changeDetection: ChangeDetectionStrategy.Default,
59-
standalone: true,
6059
imports: [CdkPortalOutlet],
6160
host: {
6261
'class': 'cdk-dialog-container',

src/cdk/dialog/dialog.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,7 @@ class DirectiveWithViewContainer {
12141214
@Component({
12151215
changeDetection: ChangeDetectionStrategy.OnPush,
12161216
template: 'hello',
1217+
standalone: false,
12171218
})
12181219
class ComponentWithOnPushViewContainer {
12191220
viewContainerRef = inject(ViewContainerRef);
@@ -1305,6 +1306,7 @@ class DialogWithoutFocusableElements {}
13051306
@Component({
13061307
template: `<button>I'm a button</button>`,
13071308
encapsulation: ViewEncapsulation.ShadowDom,
1309+
standalone: false,
13081310
})
13091311
class ShadowDomComponent {}
13101312

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export const CDK_DRAG_HANDLE = new InjectionToken<CdkDragHandle>('CdkDragHandle'
3030
/** Handle that can be used to drag a CdkDrag instance. */
3131
@Directive({
3232
selector: '[cdkDragHandle]',
33-
standalone: true,
3433
host: {
3534
'class': 'cdk-drag-handle',
3635
},

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export const CDK_DRAG_PLACEHOLDER = new InjectionToken<CdkDragPlaceholder>('CdkD
2222
*/
2323
@Directive({
2424
selector: 'ng-template[cdkDragPlaceholder]',
25-
standalone: true,
2625
providers: [{provide: CDK_DRAG_PLACEHOLDER, useExisting: CdkDragPlaceholder}],
2726
})
2827
export class CdkDragPlaceholder<T = any> implements OnDestroy {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export const CDK_DRAG_PREVIEW = new InjectionToken<CdkDragPreview>('CdkDragPrevi
3030
*/
3131
@Directive({
3232
selector: 'ng-template[cdkDragPreview]',
33-
standalone: true,
3433
providers: [{provide: CDK_DRAG_PREVIEW, useExisting: CdkDragPreview}],
3534
})
3635
export class CdkDragPreview<T = any> implements OnDestroy {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export const CDK_DROP_LIST = new InjectionToken<CdkDropList>('CdkDropList');
6262
@Directive({
6363
selector: '[cdkDrag]',
6464
exportAs: 'cdkDrag',
65-
standalone: true,
6665
host: {
6766
'class': DRAG_HOST_CLASS,
6867
'[class.cdk-drag-disabled]': 'disabled',

src/cdk/drag-drop/directives/drop-list-group.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export const CDK_DROP_LIST_GROUP = new InjectionToken<CdkDropListGroup<unknown>>
2626
@Directive({
2727
selector: '[cdkDropListGroup]',
2828
exportAs: 'cdkDropListGroup',
29-
standalone: true,
3029
providers: [{provide: CDK_DROP_LIST_GROUP, useExisting: CdkDropListGroup}],
3130
})
3231
export class CdkDropListGroup<T> implements OnDestroy {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ let _uniqueIdCounter = 0;
3838
@Directive({
3939
selector: '[cdkDropList], cdk-drop-list',
4040
exportAs: 'cdkDropList',
41-
standalone: true,
4241
providers: [
4342
// Prevent child drop lists from picking up the same group as their parent.
4443
{provide: CDK_DROP_LIST_GROUP, useValue: undefined},

src/cdk/drag-drop/drag-drop-registry.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const activeCapturingEventOptions = normalizePassiveListenerOptions({
3535
* @docs-private
3636
*/
3737
@Component({
38-
standalone: true,
3938
styleUrl: 'resets.css',
4039
encapsulation: ViewEncapsulation.None,
4140
template: '',

src/cdk/listbox/listbox.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,7 @@ describe('CdkOption and CdkListbox', () => {
10121012
<div cdkOption="peach">Peach</div>
10131013
</div>
10141014
`,
1015+
standalone: false,
10151016
})
10161017
class ListboxWithOptions {
10171018
changedOption: CdkOption | null;
@@ -1037,6 +1038,7 @@ class ListboxWithOptions {
10371038

10381039
@Component({
10391040
template: `<div cdkListbox></div>`,
1041+
standalone: false,
10401042
})
10411043
class ListboxWithNoOptions {}
10421044

@@ -1052,6 +1054,7 @@ class ListboxWithNoOptions {}
10521054
<div cdkOption="peach">Peach</div>
10531055
</div>
10541056
`,
1057+
standalone: false,
10551058
})
10561059
class ListboxWithFormControl {
10571060
formControl = new FormControl();
@@ -1067,6 +1070,7 @@ class ListboxWithFormControl {
10671070
}
10681071
</div>
10691072
`,
1073+
standalone: false,
10701074
})
10711075
class ListboxWithPreselectedFormControl {
10721076
options = ['a', 'b', 'c'];
@@ -1081,6 +1085,7 @@ class ListboxWithPreselectedFormControl {
10811085
}
10821086
</div>
10831087
`,
1088+
standalone: false,
10841089
})
10851090
class ListboxWithInvalidPreselectedFormControl {
10861091
options = ['a', 'b', 'c'];
@@ -1096,6 +1101,7 @@ class ListboxWithInvalidPreselectedFormControl {
10961101
<li cdkOption="peach" cdkOptionTypeaheadLabel="peach">🍑</li>
10971102
</ul>
10981103
`,
1104+
standalone: false,
10991105
})
11001106
class ListboxWithCustomTypeahead {}
11011107

@@ -1109,6 +1115,7 @@ class ListboxWithCustomTypeahead {}
11091115
<div cdkOption="peach">Peach</div>
11101116
</div>
11111117
`,
1118+
standalone: false,
11121119
})
11131120
class ListboxWithBoundValue {
11141121
value = ['banana'];
@@ -1125,6 +1132,7 @@ class ListboxWithBoundValue {
11251132
<div cdkOption="peach">Peach</div>
11261133
</div>
11271134
`,
1135+
standalone: false,
11281136
})
11291137
class ListboxWithMultipleBoundValues {
11301138
value = ['apple', 'banana'];
@@ -1138,6 +1146,7 @@ class ListboxWithMultipleBoundValues {
11381146
}
11391147
</div>
11401148
`,
1149+
standalone: false,
11411150
})
11421151
class ListboxWithObjectValues {
11431152
fruits = [{name: 'Apple'}, {name: 'Orange'}, {name: 'Banana'}, {name: 'Peach'}];

src/cdk/listbox/listbox.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ class ListboxSelectionModel<T> extends SelectionModel<T> {
8181
/** A selectable option in a listbox. */
8282
@Directive({
8383
selector: '[cdkOption]',
84-
standalone: true,
8584
exportAs: 'cdkOption',
8685
host: {
8786
'role': 'option',
@@ -230,7 +229,6 @@ export class CdkOption<T = unknown> implements ListKeyManagerOption, Highlightab
230229

231230
@Directive({
232231
selector: '[cdkListbox]',
233-
standalone: true,
234232
exportAs: 'cdkListbox',
235233
host: {
236234
'role': 'listbox',

src/cdk/menu/context-menu-trigger.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ describe('CdkContextMenuTrigger', () => {
451451
</div>
452452
</ng-template>
453453
`,
454+
standalone: false,
454455
})
455456
class SimpleContextMenu {
456457
@ViewChild(CdkContextMenuTrigger) trigger: CdkContextMenuTrigger;
@@ -479,6 +480,7 @@ class SimpleContextMenu {
479480
<div #copy_menu cdkMenu></div>
480481
</ng-template>
481482
`,
483+
standalone: false,
482484
})
483485
class NestedContextMenu {
484486
@ViewChild('cut_trigger', {read: ElementRef}) cutContext: ElementRef<HTMLElement>;
@@ -504,6 +506,7 @@ class NestedContextMenu {
504506
<div #copy_menu cdkMenu></div>
505507
</ng-template>
506508
`,
509+
standalone: false,
507510
})
508511
class ContextMenuWithSubmenu {
509512
@ViewChild(CdkContextMenuTrigger, {read: ElementRef}) context: ElementRef<HTMLElement>;
@@ -534,6 +537,7 @@ class ContextMenuWithSubmenu {
534537
<button #inline_menu_button cdkMenuItem></button>
535538
</div>
536539
`,
540+
standalone: false,
537541
})
538542
class ContextMenuWithMenuBarAndInlineMenu {
539543
@ViewChild(CdkMenuBar, {read: ElementRef}) nativeMenuBar: ElementRef;
@@ -562,6 +566,7 @@ class ContextMenuWithMenuBarAndInlineMenu {
562566
</div>
563567
</ng-template>
564568
`,
569+
standalone: false,
565570
})
566571
class MenuBarAndContextTriggerShareMenu {
567572
@ViewChild(CdkMenuTrigger) menuBarTrigger: CdkMenuTrigger;
@@ -577,6 +582,7 @@ class MenuBarAndContextTriggerShareMenu {
577582
<div cdkMenu class="test-menu">{{message}}</div>
578583
</ng-template>
579584
`,
585+
standalone: false,
580586
})
581587
class ContextTriggerWithData {
582588
@ViewChild(CdkContextMenuTrigger, {read: ElementRef}) triggerElement: ElementRef<HTMLElement>;

src/cdk/menu/context-menu-trigger.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export type ContextMenuCoordinates = {x: number; y: number};
6565
@Directive({
6666
selector: '[cdkContextMenuTriggerFor]',
6767
exportAs: 'cdkContextMenuTriggerFor',
68-
standalone: true,
6968
host: {
7069
'[attr.data-cdk-menu-stack-id]': 'null',
7170
'(contextmenu)': '_openOnContextMenu($event)',

src/cdk/menu/menu-aim.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ export class TargetMenuAim implements MenuAim, OnDestroy {
254254
@Directive({
255255
selector: '[cdkTargetMenuAim]',
256256
exportAs: 'cdkTargetMenuAim',
257-
standalone: true,
258257
providers: [{provide: MENU_AIM, useClass: TargetMenuAim}],
259258
})
260259
export class CdkTargetMenuAim {}

src/cdk/menu/menu-bar.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {CdkMenuBase} from './menu-base';
3131
@Directive({
3232
selector: '[cdkMenuBar]',
3333
exportAs: 'cdkMenuBar',
34-
standalone: true,
3534
host: {
3635
'role': 'menubar',
3736
'class': 'cdk-menu-bar',

src/cdk/menu/menu-base.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ let nextId = 0;
4949
'(focusin)': 'menuStack.setHasFocus(true)',
5050
'(focusout)': 'menuStack.setHasFocus(false)',
5151
},
52-
standalone: true,
5352
})
5453
export abstract class CdkMenuBase
5554
extends CdkMenuGroup

src/cdk/menu/menu-group.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {UniqueSelectionDispatcher} from '@angular/cdk/collections';
1515
@Directive({
1616
selector: '[cdkMenuGroup]',
1717
exportAs: 'cdkMenuGroup',
18-
standalone: true,
1918
host: {
2019
'role': 'group',
2120
'class': 'cdk-menu-group',

src/cdk/menu/menu-item-checkbox.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {CdkMenuItem} from './menu-item';
1717
@Directive({
1818
selector: '[cdkMenuItemCheckbox]',
1919
exportAs: 'cdkMenuItemCheckbox',
20-
standalone: true,
2120
host: {
2221
'role': 'menuitemcheckbox',
2322
'[class.cdk-menu-item-checkbox]': 'true',

src/cdk/menu/menu-item-radio.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ let nextId = 0;
2222
@Directive({
2323
selector: '[cdkMenuItemRadio]',
2424
exportAs: 'cdkMenuItemRadio',
25-
standalone: true,
2625
host: {
2726
'role': 'menuitemradio',
2827
'[class.cdk-menu-item-radio]': 'true',

src/cdk/menu/menu-item-selectable.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {CdkMenuItem} from './menu-item';
1515
'[attr.aria-checked]': '!!checked',
1616
'[attr.aria-disabled]': 'disabled || null',
1717
},
18-
standalone: true,
1918
})
2019
export abstract class CdkMenuItemSelectable extends CdkMenuItem {
2120
/** Whether the element is checked */

src/cdk/menu/menu-item.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ describe('MenuItem', () => {
148148

149149
@Component({
150150
template: `<button cdkMenuItem>Click me!</button>`,
151+
standalone: false,
151152
})
152153
class SingleMenuItem {}
153154

@@ -158,6 +159,7 @@ class SingleMenuItem {}
158159
Click me!
159160
</button>
160161
`,
162+
standalone: false,
161163
})
162164
class MenuItemWithIcon {
163165
typeahead: string;
@@ -170,13 +172,15 @@ class MenuItemWithIcon {
170172
Click me!
171173
</button>
172174
`,
175+
standalone: false,
173176
})
174177
class MenuItemWithIconClass {
175178
typeahead: string;
176179
}
177180

178181
@Component({
179182
template: ` <button cdkMenuItem><strong>Click</strong> me!</button> `,
183+
standalone: false,
180184
})
181185
class MenuItemWithBoldElement {}
182186

@@ -193,6 +197,7 @@ class MenuItemWithBoldElement {}
193197
</div>
194198
</button>
195199
`,
200+
standalone: false,
196201
})
197202
class MenuItemWithMultipleNestings {
198203
typeahead: string;

src/cdk/menu/menu-item.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import {eventDispatchesNativeClick} from './event-detection';
3737
@Directive({
3838
selector: '[cdkMenuItem]',
3939
exportAs: 'cdkMenuItem',
40-
standalone: true,
4140
host: {
4241
'role': 'menuitem',
4342
'class': 'cdk-menu-item',

src/cdk/menu/menu-trigger-base.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export const MENU_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>(
4646
'[attr.aria-controls]': 'childMenu?.id',
4747
'[attr.data-cdk-menu-stack-id]': 'menuStack.id',
4848
},
49-
standalone: true,
5049
})
5150
export abstract class CdkMenuTriggerBase implements OnDestroy {
5251
/** The DI injector for this component. */

0 commit comments

Comments
 (0)