Skip to content

Commit 1e0bdb6

Browse files
jelbourndevversion
authored andcommitted
ngAcceptType
1 parent 29e2548 commit 1e0bdb6

File tree

56 files changed

+274
-47
lines changed

Some content is hidden

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

56 files changed

+274
-47
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
"@bazel/ibazel": "^0.10.3",
7474
"@bazel/jasmine": "^0.38.3",
7575
"@bazel/karma": "^0.38.3",
76-
"@bazel/typescript": "^0.38.3",
7776
"@bazel/protractor": "^0.38.3",
77+
"@bazel/typescript": "^0.38.3",
7878
"@firebase/app-types": "^0.3.2",
7979
"@octokit/rest": "^16.28.7",
8080
"@schematics/angular": "^9.0.0-next.15",

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,4 +418,7 @@ export class CdkTrapFocus implements OnDestroy, AfterContentInit, DoCheck {
418418
this.focusTrap.attachAnchors();
419419
}
420420
}
421+
422+
static ngAcceptInputType_autoCapture: boolean | string;
423+
static ngAcceptInputType_enabled: boolean | string;
421424
}

src/cdk/accordion/accordion-item.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,7 @@ export class CdkAccordionItem implements OnDestroy {
152152
}
153153
});
154154
}
155+
156+
static ngAcceptInputType_disabled: boolean | string;
157+
static ngAcceptInputType_expanded: boolean | string;
155158
}

src/cdk/accordion/accordion.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,6 @@ export class CdkAccordion implements OnDestroy, OnChanges {
5959
this._openCloseAllActions.next(expanded);
6060
}
6161
}
62+
63+
static ngAcceptInputType_multi: boolean | string;
6264
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class CdkDropList<T = any> implements AfterContentInit, OnDestroy {
113113
* is allowed to be moved into a drop container.
114114
*/
115115
@Input('cdkDropListEnterPredicate')
116-
enterPredicate: (drag: CdkDrag, drop: CdkDropList) => boolean = () => true
116+
enterPredicate: (drag: CdkDrag, drop: CdkDropList) => boolean = () => true;
117117

118118
/** Whether to auto-scroll the view when the user moves their pointer close to the edges. */
119119
@Input('cdkDropListAutoScrollDisabled')
@@ -328,4 +328,7 @@ export class CdkDropList<T = any> implements AfterContentInit, OnDestroy {
328328
});
329329
}
330330

331+
static ngAcceptInputType_autoScrollDisabled: boolean | string;
332+
static ngAcceptInputType_disabled: boolean | string;
333+
static ngAcceptInputType_sortingDisabled: boolean | string;
331334
}

src/cdk/overlay/overlay-directives.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,17 @@ export class CdkConnectedOverlay implements OnDestroy, OnChanges {
383383

384384
this._backdropSubscription.unsubscribe();
385385
}
386+
387+
static ngAcceptInputType_hasBackdrop: boolean | string | undefined;
388+
static ngAcceptInputType_lockPosition: boolean | string | undefined;
389+
static ngAcceptInputType_flexibleDimensions: boolean | string | undefined;
390+
static ngAcceptInputType_growAfterOpen: boolean | string | undefined;
391+
static ngAcceptInputType_push: boolean | string | undefined;
392+
static ngAcceptInputType_width: number | string | undefined;
393+
static ngAcceptInputType_height: number | string | undefined;
394+
static ngAcceptInputType_minWidth: number | string | undefined;
395+
static ngAcceptInputType_minHeight: number | string | undefined;
396+
static ngAcceptInputType_viewportMargin: number | string | undefined;
386397
}
387398

388399

src/cdk/portal/portal-directives.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ export class CdkPortalOutlet extends BasePortalOutlet implements OnInit, OnDestr
170170

171171
return viewRef;
172172
}
173+
174+
static ngAcceptInputType_portal: Portal<any> | null | undefined | '';
173175
}
174176

175177
/**

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,8 @@ export class CdkFixedSizeVirtualScroll implements OnChanges {
203203
ngOnChanges() {
204204
this._scrollStrategy.updateItemAndBufferSize(this.itemSize, this.minBufferPx, this.maxBufferPx);
205205
}
206+
207+
static ngAcceptInputType_itemSize: string | number;
208+
static ngAcceptInputType_minBufferPx: string | number;
209+
static ngAcceptInputType_maxBufferPx: string | number;
206210
}

src/cdk/stepper/stepper.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ export class CdkStep implements OnChanges {
231231
// underlying MatStepHeader, we have to make sure that change detection runs correctly.
232232
this._stepper._stateChanged();
233233
}
234+
235+
static ngAcceptInputType_editable: boolean | string;
236+
static ngAcceptInputType_hasError: boolean | string;
237+
static ngAcceptInputType_optional: boolean | string;
238+
static ngAcceptInputType_completed: boolean | string;
234239
}
235240

236241
@Directive({
@@ -519,6 +524,9 @@ export class CdkStepper implements AfterViewInit, OnDestroy {
519524
const focusedElement = this._document.activeElement;
520525
return stepperElement === focusedElement || stepperElement.contains(focusedElement);
521526
}
527+
528+
static ngAcceptInputType_linear: boolean | string;
529+
static ngAcceptInputType_selectedIndex: number | string;
522530
}
523531

524532

src/cdk/table/cell.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ export class CdkColumnDef extends _CdkColumnDefBase implements CanStick {
107107
* do not match are replaced by the '-' character.
108108
*/
109109
cssClassFriendlyName: string;
110+
111+
static ngAcceptInputType_sticky: boolean | string;
112+
static ngAcceptInputType_stickyEnd: boolean | string;
110113
}
111114

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

src/cdk/table/table.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,8 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes
10771077
this.updateStickyColumnStyles();
10781078
});
10791079
}
1080+
1081+
static ngAcceptInputType_multiTemplateDataRows: boolean | string;
10801082
}
10811083

10821084
/** 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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,4 +272,8 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
272272
textarea.setSelectionRange(selectionStart, selectionEnd);
273273
}
274274
}
275+
276+
static ngAcceptInputType_enabled: boolean | string;
277+
static ngAcceptInputType_minRows: number | string;
278+
static ngAcceptInputType_maxRows: number | string;
275279
}

src/cdk/tree/padding.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,6 @@ export class CdkTreeNodePadding<T> implements OnDestroy {
109109
this._currentPadding = padding;
110110
}
111111
}
112+
113+
static ngAcceptInputType_level: number | string;
112114
}

src/cdk/tree/toggle.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ export class CdkTreeNodeToggle<T> {
3838

3939
event.stopPropagation();
4040
}
41+
42+
static ngAcceptInputType_recursive: boolean | string;
4143
}

src/dev-app/dialog/dialog-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class JazzDialog {
175175
176176
<button
177177
mat-button
178-
color="secondary"
178+
color="accent"
179179
(click)="showInStackedDialog()">
180180
Show in Dialog</button>
181181
</mat-dialog-actions>

src/dev-app/input/input-demo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ <h3>Regular &lt;textarea&gt; with maxRows and minRows</h3>
552552
cdkTextareaAutosize
553553
[cdkAutosizeMinRows]="parseNumber(minRows.value)"
554554
[cdkAutosizeMaxRows]="parseNumber(maxRows.value)"></textarea>
555-
<button type="button" (click)="minRows.value = parseNumber(minRows.value) - 1">Decrement minRows</button>
555+
<button type="button" (click)="minRows.value = (parseNumber(minRows.value) - 1) + ''">Decrement minRows</button>
556556

557557
<h3>&lt;textarea&gt; with mat-form-field</h3>
558558
<div>

src/material-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class CdkDragDropEnterPredicateExample {
1313
all = [1, 2, 3, 4, 5, 6, 7, 8, 9];
1414
even = [10];
1515

16-
drop(event: CdkDragDrop<string[]>) {
16+
drop(event: CdkDragDrop<number[]>) {
1717
if (event.previousContainer === event.container) {
1818
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
1919
} else {

src/material-examples/material/datepicker/datepicker-filter/datepicker-filter-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {Component} from '@angular/core';
77
styleUrls: ['datepicker-filter-example.css'],
88
})
99
export class DatepickerFilterExample {
10-
myFilter = (d: Date): boolean => {
11-
const day = d.getDay();
10+
myFilter = (d: Date | null): boolean => {
11+
const day = (d || new Date()).getDay();
1212
// Prevent Saturday and Sunday from being selected.
1313
return day !== 0 && day !== 6;
1414
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,7 @@ export class MyTelInput implements ControlValueAccessor, MatFormFieldControl<MyT
149149
_handleInput(): void {
150150
this.onChange(this.parts.value);
151151
}
152+
153+
static ngAcceptInputType_disabled: boolean | string;
154+
static ngAcceptInputType_required: boolean | string;
152155
}

src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,7 @@ export class MatTabLink extends _MatTabLinkBase implements MatInkBarItem, OnDest
122122
super.ngOnDestroy();
123123
this._foundation.destroy();
124124
}
125+
126+
static ngAcceptInputType_disabled: boolean | string;
127+
static ngAcceptInputType_disableRipple: boolean | string;
125128
}

src/material/autocomplete/autocomplete.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,5 +221,8 @@ export class MatAutocomplete extends _MatAutocompleteMixinBase implements AfterC
221221
classList['mat-autocomplete-visible'] = this.showPanel;
222222
classList['mat-autocomplete-hidden'] = !this.showPanel;
223223
}
224+
225+
static ngAcceptInputType_autoActiveFirstOption: boolean | string;
226+
static ngAcceptInputType_disableRipple: boolean | string;
224227
}
225228

src/material/badge/badge.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ class MatBadgeBase {}
3434
const _MatBadgeMixinBase:
3535
CanDisableCtor & typeof MatBadgeBase = mixinDisabled(MatBadgeBase);
3636

37-
export type MatBadgePosition = 'above after' | 'above before' | 'below before' | 'below after';
37+
/** Allowed position options for matBadgePosition */
38+
export type MatBadgePosition =
39+
'above after' | 'above before' | 'below before' | 'below after' |
40+
'before' | 'after' | 'above' | 'below';
41+
42+
/** Allowed size options for matBadgeSize */
3843
export type MatBadgeSize = 'small' | 'medium' | 'large';
3944

4045
/** Directive to display a text badge. */
@@ -264,4 +269,8 @@ export class MatBadge extends _MatBadgeMixinBase implements OnDestroy, OnChanges
264269
}
265270
}
266271
}
272+
273+
static ngAcceptInputType_disabled: boolean | string;
274+
static ngAcceptInputType_hidden: boolean | string;
275+
static ngAcceptInputType_overlap: boolean | string;
267276
}

src/material/button-toggle/button-toggle.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ export class MatButtonToggleGroup implements ControlValueAccessor, OnInit, After
368368
// it is used by Angular to sync up the two-way data binding.
369369
this.valueChange.emit(this.value);
370370
}
371+
372+
static ngAcceptInputType_disabled: boolean | string;
373+
static ngAcceptInputType_multiple: boolean | string;
374+
static ngAcceptInputType_vertical: boolean | string;
371375
}
372376

373377
// Boilerplate for applying mixins to the MatButtonToggle class.
@@ -556,4 +560,8 @@ export class MatButtonToggle extends _MatButtonToggleMixinBase implements OnInit
556560
// Use `markForCheck` to explicit update button toggle's status.
557561
this._changeDetectorRef.markForCheck();
558562
}
563+
564+
static ngAcceptInputType_checked: boolean | string;
565+
static ngAcceptInputType_disabled: boolean | string;
566+
static ngAcceptInputType_disableRipple: boolean | string;
559567
}

src/material/button/button.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ export class MatButton extends _MatButtonMixinBase
135135
_hasHostAttributes(...attributes: string[]) {
136136
return attributes.some(attribute => this._getHostElement().hasAttribute(attribute));
137137
}
138+
139+
static ngAcceptInputType_disabled: boolean | string;
140+
static ngAcceptInputType_disableRipple: boolean | string;
138141
}
139142

140143
/**
@@ -179,4 +182,7 @@ export class MatAnchor extends MatButton {
179182
event.stopImmediatePropagation();
180183
}
181184
}
185+
186+
static ngAcceptInputType_disabled: boolean | string;
187+
// static ngAcceptInputType_disableRipple: boolean | string;
182188
}

src/material/checkbox/checkbox.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,4 +470,9 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
470470

471471
return `mat-checkbox-anim-${animSuffix}`;
472472
}
473+
474+
static ngAcceptInputType_checked: boolean | string;
475+
static ngAcceptInputType_disabled: boolean | string;
476+
static ngAcceptInputType_disableRipple: boolean | string;
477+
static ngAcceptInputType_required: boolean | string;
473478
}

src/material/chips/chip.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,12 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
388388
this._changeDetectorRef.markForCheck();
389389
}
390390
}
391+
392+
static ngAcceptInputType_disabled: boolean | string;
393+
static ngAcceptInputType_disableRipple: boolean | string;
394+
static ngAcceptInputType_selectable: boolean | string;
395+
static ngAcceptInputType_selected: boolean | string;
396+
static ngAcceptInputType_removable: boolean | string;
391397
}
392398

393399

src/material/core/option/optgroup.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ export class MatOptgroup extends _MatOptgroupMixinBase implements CanDisable {
4545

4646
/** Unique id for the underlying label. */
4747
_labelId: string = `mat-optgroup-label-${_uniqueOptgroupIdCounter++}`;
48+
49+
static ngAcceptInputType_disabled: boolean | string;
4850
}

src/material/datepicker/calendar-body.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class MatCalendarCell {
3434
public displayValue: string,
3535
public ariaLabel: string,
3636
public enabled: boolean,
37-
public cssClasses?: MatCalendarCellCssClasses) {}
37+
public cssClasses: MatCalendarCellCssClasses = {}) {}
3838
}
3939

4040

src/material/datepicker/calendar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ export class MatCalendar<D> implements AfterContentInit, AfterViewChecked, OnDes
362362
}
363363

364364
/** Handles date selection in the month view. */
365-
_dateSelected(date: D): void {
366-
if (!this._dateAdapter.sameDate(date, this.selected)) {
365+
_dateSelected(date: D | null): void {
366+
if (date && !this._dateAdapter.sameDate(date, this.selected)) {
367367
this.selectedChange.emit(date);
368368
}
369369
}

src/material/datepicker/datepicker-input.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,30 +206,30 @@ export class MatDatepickerInput<D> implements ControlValueAccessor, OnDestroy, V
206206
private _parseValidator: ValidatorFn = (): ValidationErrors | null => {
207207
return this._lastValueValid ?
208208
null : {'matDatepickerParse': {'text': this._elementRef.nativeElement.value}};
209-
}
209+
};
210210

211211
/** The form control validator for the min date. */
212212
private _minValidator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {
213213
const controlValue = this._getValidDateOrNull(this._dateAdapter.deserialize(control.value));
214214
return (!this.min || !controlValue ||
215215
this._dateAdapter.compareDate(this.min, controlValue) <= 0) ?
216216
null : {'matDatepickerMin': {'min': this.min, 'actual': controlValue}};
217-
}
217+
};
218218

219219
/** The form control validator for the max date. */
220220
private _maxValidator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {
221221
const controlValue = this._getValidDateOrNull(this._dateAdapter.deserialize(control.value));
222222
return (!this.max || !controlValue ||
223223
this._dateAdapter.compareDate(this.max, controlValue) >= 0) ?
224224
null : {'matDatepickerMax': {'max': this.max, 'actual': controlValue}};
225-
}
225+
};
226226

227227
/** The form control validator for the date filter. */
228228
private _filterValidator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {
229229
const controlValue = this._getValidDateOrNull(this._dateAdapter.deserialize(control.value));
230230
return !this._dateFilter || !controlValue || this._dateFilter(controlValue) ?
231231
null : {'matDatepickerFilter': true};
232-
}
232+
};
233233

234234
/** The combined form control validator for this input. */
235235
private _validator: ValidatorFn | null =
@@ -366,4 +366,6 @@ export class MatDatepickerInput<D> implements ControlValueAccessor, OnDestroy, V
366366
private _getValidDateOrNull(obj: any): D | null {
367367
return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
368368
}
369+
370+
static ngAcceptInputType_disabled: boolean | string;
369371
}

src/material/datepicker/datepicker-toggle.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,7 @@ export class MatDatepickerToggle<D> implements AfterContentInit, OnChanges, OnDe
132132
datepickerToggled
133133
).subscribe(() => this._changeDetectorRef.markForCheck());
134134
}
135+
136+
static ngAcceptInputType_disabled: boolean | string;
137+
static ngAcceptInputType_disableRipple: boolean | string;
135138
}

src/material/datepicker/datepicker.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,4 +522,8 @@ export class MatDatepicker<D> implements OnDestroy, CanColor {
522522
this._dialogRef.componentInstance.color = color;
523523
}
524524
}
525+
526+
static ngAcceptInputType_disabled: boolean | string;
527+
static ngAcceptInputType_touchUi: boolean | string;
528+
static ngAcceptInputType_opened: boolean | string;
525529
}

src/material/expansion/accordion.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,6 @@ export class MatAccordion extends CdkAccordion implements MatAccordionBase, Afte
8686
_handleHeaderFocus(header: MatExpansionPanelHeader) {
8787
this._keyManager.updateActiveItem(header);
8888
}
89+
90+
static ngAcceptInputType_multi: boolean | string;
8991
}

0 commit comments

Comments
 (0)