Skip to content

Commit b56bcad

Browse files
devversionmmalerba
authored andcommitted
refactor: allow coercion inputs to work with async pipe (#17640)
We need to accept `null` and `undefined` for coercion members to make them work with the `async` pipe. The overall problem remains for other non-coercion inputs, but since the majority of inputs are coerced, we only make the change to these. The overall problem applies to _all_ inputs, but it's not clear yet how this issue can be solved for all inputs. This involves discussion with the framework team. More information: https://hackmd.io/@devversion/rkKOD8ZjB
1 parent a5cad10 commit b56bcad

File tree

136 files changed

+553
-502
lines changed

Some content is hidden

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

136 files changed

+553
-502
lines changed

src/cdk-experimental/scrolling/auto-size-virtual-scroll.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,6 @@ export class CdkAutoSizeVirtualScroll implements OnChanges {
464464
this._scrollStrategy.updateBufferSize(this.minBufferPx, this.maxBufferPx);
465465
}
466466

467-
static ngAcceptInputType_minBufferPx: number | string;
468-
static ngAcceptInputType_maxBufferPx: number | string;
467+
static ngAcceptInputType_minBufferPx: number | string | null | undefined;
468+
static ngAcceptInputType_maxBufferPx: number | string | null | undefined;
469469
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,6 @@ export class CdkTrapFocus implements OnDestroy, AfterContentInit, DoCheck {
419419
}
420420
}
421421

422-
static ngAcceptInputType_enabled: boolean | string;
423-
static ngAcceptInputType_autoCapture: boolean | string;
422+
static ngAcceptInputType_enabled: boolean | string | null | undefined;
423+
static ngAcceptInputType_autoCapture: boolean | string | null | undefined;
424424
}

src/cdk/accordion/accordion-item.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,6 @@ export class CdkAccordionItem implements OnDestroy {
153153
});
154154
}
155155

156-
static ngAcceptInputType_expanded: boolean | string;
157-
static ngAcceptInputType_disabled: boolean | string;
156+
static ngAcceptInputType_expanded: boolean | string | null | undefined;
157+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
158158
}

src/cdk/accordion/accordion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ export class CdkAccordion implements OnDestroy, OnChanges {
6060
}
6161
}
6262

63-
static ngAcceptInputType_multi: boolean | string;
63+
static ngAcceptInputType_multi: boolean | string | null | undefined;
6464
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ export class CdkDragHandle implements OnDestroy {
4747
this._stateChanges.complete();
4848
}
4949

50-
static ngAcceptInputType_disabled: boolean | string;
50+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
5151
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ export class CdkDrag<T = any> implements AfterViewInit, OnChanges, OnDestroy {
409409
});
410410
}
411411

412-
static ngAcceptInputType_disabled: boolean | string;
412+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
413413
}
414414

415415
/** Gets the closest ancestor of an element that matches a selector. */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ export class CdkDropListGroup<T> implements OnDestroy {
3535
this._items.clear();
3636
}
3737

38-
static ngAcceptInputType_disabled: boolean | string;
38+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
3939
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ export class CdkDropList<T = any> implements AfterContentInit, OnDestroy {
328328
});
329329
}
330330

331-
static ngAcceptInputType_disabled: boolean | string;
332-
static ngAcceptInputType_sortingDisabled: boolean | string;
333-
static ngAcceptInputType_autoScrollDisabled: boolean | string;
331+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
332+
static ngAcceptInputType_sortingDisabled: boolean | string | null | undefined;
333+
static ngAcceptInputType_autoScrollDisabled: boolean | string | null | undefined;
334334
}

src/cdk/observers/observe-content.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ export class CdkObserveContent implements AfterContentInit, OnDestroy {
194194
}
195195
}
196196

197-
static ngAcceptInputType_disabled: boolean | string;
198-
static ngAcceptInputType_debounce: boolean | string;
197+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
198+
static ngAcceptInputType_debounce: boolean | string | null | undefined;
199199
}
200200

201201

src/cdk/overlay/overlay-directives.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,11 @@ export class CdkConnectedOverlay implements OnDestroy, OnChanges {
384384
this._backdropSubscription.unsubscribe();
385385
}
386386

387-
static ngAcceptInputType_hasBackdrop: boolean | string;
388-
static ngAcceptInputType_lockPosition: boolean | string;
389-
static ngAcceptInputType_flexibleDimensions: boolean | string;
390-
static ngAcceptInputType_growAfterOpen: boolean | string;
391-
static ngAcceptInputType_push: boolean | string;
387+
static ngAcceptInputType_hasBackdrop: boolean | string | null | undefined;
388+
static ngAcceptInputType_lockPosition: boolean | string | null | undefined;
389+
static ngAcceptInputType_flexibleDimensions: boolean | string | null | undefined;
390+
static ngAcceptInputType_growAfterOpen: boolean | string | null | undefined;
391+
static ngAcceptInputType_push: boolean | string | null | undefined;
392392
}
393393

394394

src/cdk/scrolling/fixed-size-virtual-scroll.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export class CdkFixedSizeVirtualScroll implements OnChanges {
204204
this._scrollStrategy.updateItemAndBufferSize(this.itemSize, this.minBufferPx, this.maxBufferPx);
205205
}
206206

207-
static ngAcceptInputType_itemSize: string | number;
208-
static ngAcceptInputType_minBufferPx: string | number;
209-
static ngAcceptInputType_maxBufferPx: string | number;
207+
static ngAcceptInputType_itemSize: string | number | null | undefined;
208+
static ngAcceptInputType_minBufferPx: string | number | null | undefined;
209+
static ngAcceptInputType_maxBufferPx: string | number | null | undefined;
210210
}

src/cdk/stepper/stepper.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ export class CdkStep implements OnChanges {
231231
this._stepper._stateChanged();
232232
}
233233

234-
static ngAcceptInputType_editable: boolean | string;
235-
static ngAcceptInputType_hasError: boolean | string;
236-
static ngAcceptInputType_optional: boolean | string;
237-
static ngAcceptInputType_completed: boolean | string;
234+
static ngAcceptInputType_editable: boolean | string | null | undefined;
235+
static ngAcceptInputType_hasError: boolean | string | null | undefined;
236+
static ngAcceptInputType_optional: boolean | string | null | undefined;
237+
static ngAcceptInputType_completed: boolean | string | null | undefined;
238238
}
239239

240240
@Directive({
@@ -524,12 +524,12 @@ export class CdkStepper implements AfterViewInit, OnDestroy {
524524
return stepperElement === focusedElement || stepperElement.contains(focusedElement);
525525
}
526526

527-
static ngAcceptInputType_editable: boolean | string;
528-
static ngAcceptInputType_optional: boolean | string;
529-
static ngAcceptInputType_completed: boolean | string;
530-
static ngAcceptInputType_hasError: boolean | string;
531-
static ngAcceptInputType_linear: boolean | string;
532-
static ngAcceptInputType_selectedIndex: number | string;
527+
static ngAcceptInputType_editable: boolean | string | null | undefined;
528+
static ngAcceptInputType_optional: boolean | string | null | undefined;
529+
static ngAcceptInputType_completed: boolean | string | null | undefined;
530+
static ngAcceptInputType_hasError: boolean | string | null | undefined;
531+
static ngAcceptInputType_linear: boolean | string | null | undefined;
532+
static ngAcceptInputType_selectedIndex: number | string | null | undefined;
533533
}
534534

535535

src/cdk/table/cell.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ export class CdkColumnDef extends _CdkColumnDefBase implements CanStick {
108108
*/
109109
cssClassFriendlyName: string;
110110

111-
static ngAcceptInputType_sticky: boolean | string;
112-
static ngAcceptInputType_stickyEnd: boolean | string;
111+
static ngAcceptInputType_sticky: boolean | string | null | undefined;
112+
static ngAcceptInputType_stickyEnd: boolean | string | null | undefined;
113113
}
114114

115115
/** Base class for the cells. Adds a CSS classname that identifies the column it renders in. */

src/cdk/table/row.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export class CdkHeaderRowDef extends _CdkHeaderRowDefBase implements CanStick, O
100100
super.ngOnChanges(changes);
101101
}
102102

103-
static ngAcceptInputType_sticky: boolean | string;
103+
static ngAcceptInputType_sticky: boolean | string | null | undefined;
104104
}
105105

106106
// Boilerplate for applying mixins to CdkFooterRowDef.
@@ -128,7 +128,7 @@ export class CdkFooterRowDef extends _CdkFooterRowDefBase implements CanStick, O
128128
super.ngOnChanges(changes);
129129
}
130130

131-
static ngAcceptInputType_sticky: boolean | string;
131+
static ngAcceptInputType_sticky: boolean | string | null | undefined;
132132
}
133133

134134
/**

src/cdk/table/table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
10771077
});
10781078
}
10791079

1080-
static ngAcceptInputType_multiTemplateDataRows: boolean | string;
1080+
static ngAcceptInputType_multiTemplateDataRows: boolean | string | null | undefined;
10811081
}
10821082

10831083
/** Utility function that gets a merged list of the entries in a QueryList and values of a Set. */

src/cdk/text-field/autosize.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
273273
}
274274
}
275275

276-
static ngAcceptInputType_minRows: number | string;
277-
static ngAcceptInputType_maxRows: number | string;
278-
static ngAcceptInputType_enabled: boolean | string;
276+
static ngAcceptInputType_minRows: number | string | null | undefined;
277+
static ngAcceptInputType_maxRows: number | string | null | undefined;
278+
static ngAcceptInputType_enabled: boolean | string | null | undefined;
279279
}

src/cdk/tree/padding.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,5 @@ export class CdkTreeNodePadding<T> implements OnDestroy {
110110
}
111111
}
112112

113-
static ngAcceptInputType_level: number | string;
113+
static ngAcceptInputType_level: number | string | null | undefined;
114114
}

src/cdk/tree/toggle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ export class CdkTreeNodeToggle<T> {
3939
event.stopPropagation();
4040
}
4141

42-
static ngAcceptInputType_recursive: boolean | string;
42+
static ngAcceptInputType_recursive: boolean | string | null | undefined;
4343
}

src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/cdk-custom-stepper-without-form-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ export class CustomStepper extends CdkStepper {
2424
// These properties are required so that the Ivy template type checker in strict mode knows
2525
// what kind of values are accepted by the `linear` and `selectedIndex` inputs which
2626
// are inherited from `CdkStepper`.
27-
static ngAcceptInputType_linear: boolean | string;
28-
static ngAcceptInputType_selectedIndex: number | string;
27+
static ngAcceptInputType_linear: boolean | string | null | undefined;
28+
static ngAcceptInputType_selectedIndex: number | string | null | undefined;
2929
}

src/components-examples/material/form-field/form-field-custom-control/form-field-custom-control-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,6 @@ export class MyTelInput implements ControlValueAccessor, MatFormFieldControl<MyT
150150
this.onChange(this.parts.value);
151151
}
152152

153-
static ngAcceptInputType_disabled: boolean | string;
154-
static ngAcceptInputType_required: boolean | string;
153+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
154+
static ngAcceptInputType_required: boolean | string | null | undefined;
155155
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ export class ExampleList {
6666

6767
exampleComponents = EXAMPLE_COMPONENTS;
6868

69-
static ngAcceptInputType_expandAll: boolean | string;
69+
static ngAcceptInputType_expandAll: boolean | string | null | undefined;
7070
}

src/dev-app/example/example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ export class Example implements OnInit {
7272
this.title = EXAMPLE_COMPONENTS[this.id] ? EXAMPLE_COMPONENTS[this.id].title : '';
7373
}
7474

75-
static ngAcceptInputType_showLabel: boolean | string;
75+
static ngAcceptInputType_showLabel: boolean | string | null | undefined;
7676
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ export class MatButton extends MatButtonBase {
5656
super(elementRef, platform, ngZone, animationMode);
5757
}
5858

59-
static ngAcceptInputType_disabled: boolean | string;
60-
static ngAcceptInputType_disableRipple: boolean | string;
59+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
60+
static ngAcceptInputType_disableRipple: boolean | string | null | undefined;
6161
}
6262

6363
/**
@@ -87,6 +87,6 @@ export class MatAnchor extends MatAnchorBase {
8787
super(elementRef, platform, ngZone, animationMode);
8888
}
8989

90-
static ngAcceptInputType_disabled: boolean | string;
91-
static ngAcceptInputType_disableRipple: boolean | string;
90+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
91+
static ngAcceptInputType_disableRipple: boolean | string | null | undefined;
9292
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ export class MatFabButton extends MatButtonBase {
5555
super(elementRef, platform, ngZone, animationMode);
5656
}
5757

58-
static ngAcceptInputType_disabled: boolean | string;
59-
static ngAcceptInputType_disableRipple: boolean | string;
58+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
59+
static ngAcceptInputType_disableRipple: boolean | string | null | undefined;
6060
}
6161

6262

@@ -87,6 +87,6 @@ export class MatFabAnchor extends MatAnchor {
8787
super(elementRef, platform, ngZone, animationMode);
8888
}
8989

90-
static ngAcceptInputType_disabled: boolean | string;
91-
static ngAcceptInputType_disableRipple: boolean | string;
90+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
91+
static ngAcceptInputType_disableRipple: boolean | string | null | undefined;
9292
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export class MatIconButton extends MatButtonBase {
5252
super(elementRef, platform, ngZone, animationMode);
5353
}
5454

55-
static ngAcceptInputType_disabled: boolean | string;
56-
static ngAcceptInputType_disableRipple: boolean | string;
55+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
56+
static ngAcceptInputType_disableRipple: boolean | string | null | undefined;
5757
}
5858

5959
/**
@@ -81,6 +81,6 @@ export class MatIconAnchor extends MatAnchorBase {
8181
super(elementRef, platform, ngZone, animationMode);
8282
}
8383

84-
static ngAcceptInputType_disabled: boolean | string;
85-
static ngAcceptInputType_disableRipple: boolean | string;
84+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
85+
static ngAcceptInputType_disableRipple: boolean | string | null | undefined;
8686
}

src/material-experimental/mdc-checkbox/checkbox.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,9 @@ export class MatCheckbox implements AfterViewInit, OnDestroy, ControlValueAccess
370370
this._changeDetectorRef.markForCheck();
371371
}
372372

373-
static ngAcceptInputType_checked: boolean | string;
374-
static ngAcceptInputType_indeterminate: boolean | string;
375-
static ngAcceptInputType_disabled: boolean | string;
376-
static ngAcceptInputType_required: boolean | string;
377-
static ngAcceptInputType_disableRipple: boolean | string;
373+
static ngAcceptInputType_checked: boolean | string | null | undefined;
374+
static ngAcceptInputType_indeterminate: boolean | string | null | undefined;
375+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
376+
static ngAcceptInputType_required: boolean | string | null | undefined;
377+
static ngAcceptInputType_disableRipple: boolean | string | null | undefined;
378378
}

src/material-experimental/mdc-chips/chip-grid.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,6 @@ export class MatChipGrid extends _MatChipGridMixinBase implements AfterContentIn
520520
return false;
521521
}
522522

523-
static ngAcceptInputType_disabled: boolean | string;
524-
static ngAcceptInputType_required: boolean | string;
523+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
524+
static ngAcceptInputType_required: boolean | string | null | undefined;
525525
}

src/material-experimental/mdc-chips/chip-icons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,5 @@ export class MatChipRemove extends _MatChipRemoveMixinBase implements CanDisable
121121
super(_elementRef);
122122
}
123123

124-
static ngAcceptInputType_disabled: boolean | string;
124+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
125125
}

src/material-experimental/mdc-chips/chip-input.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,6 @@ export class MatChipInput implements MatChipTextControl, OnChanges {
171171
return Array.isArray(separators) ? separators.indexOf(keyCode) > -1 : separators.has(keyCode);
172172
}
173173

174-
static ngAcceptInputType_addOnBlur: boolean | string;
175-
static ngAcceptInputType_disabled: boolean | string;
174+
static ngAcceptInputType_addOnBlur: boolean | string | null | undefined;
175+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
176176
}

src/material-experimental/mdc-chips/chip-listbox.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,9 @@ export class MatChipListbox extends MatChipSet implements AfterContentInit, Cont
554554
this._lastDestroyedChipIndex = null;
555555
}
556556

557-
static ngAcceptInputType_multiple: boolean | string;
558-
static ngAcceptInputType_selectable: boolean | string;
559-
static ngAcceptInputType_required: boolean | string;
560-
static ngAcceptInputType_disabled: boolean | string;
557+
static ngAcceptInputType_multiple: boolean | string | null | undefined;
558+
static ngAcceptInputType_selectable: boolean | string | null | undefined;
559+
static ngAcceptInputType_required: boolean | string | null | undefined;
560+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
561561
}
562562

src/material-experimental/mdc-chips/chip-option.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ export class MatChipOption extends MatChip {
226226
}
227227
}
228228

229-
static ngAcceptInputType_selectable: boolean | string;
230-
static ngAcceptInputType_selected: boolean | string;
231-
static ngAcceptInputType_disabled: boolean | string;
232-
static ngAcceptInputType_removable: boolean | string;
233-
static ngAcceptInputType_highlighted: boolean | string;
234-
static ngAcceptInputType_disableRipple: boolean | string;
229+
static ngAcceptInputType_selectable: boolean | string | null | undefined;
230+
static ngAcceptInputType_selected: boolean | string | null | undefined;
231+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
232+
static ngAcceptInputType_removable: boolean | string | null | undefined;
233+
static ngAcceptInputType_highlighted: boolean | string | null | undefined;
234+
static ngAcceptInputType_disableRipple: boolean | string | null | undefined;
235235
}

src/material-experimental/mdc-chips/chip-row.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ export class MatChipRow extends MatChip implements AfterContentInit, AfterViewIn
150150
}
151151
}
152152

153-
static ngAcceptInputType_disabled: boolean | string;
154-
static ngAcceptInputType_removable: boolean | string;
155-
static ngAcceptInputType_highlighted: boolean | string;
156-
static ngAcceptInputType_disableRipple: boolean | string;
153+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
154+
static ngAcceptInputType_removable: boolean | string | null | undefined;
155+
static ngAcceptInputType_highlighted: boolean | string | null | undefined;
156+
static ngAcceptInputType_disableRipple: boolean | string | null | undefined;
157157
}

src/material-experimental/mdc-chips/chip-set.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,6 @@ export class MatChipSet extends _MatChipSetMixinBase implements AfterContentInit
304304
return false;
305305
}
306306

307-
static ngAcceptInputType_disabled: boolean | string;
307+
static ngAcceptInputType_disabled: boolean | string | null | undefined;
308308
}
309309

0 commit comments

Comments
 (0)