Skip to content

Commit e92a99f

Browse files
committed
fix: remove not needed coercion
1 parent 8bc7b01 commit e92a99f

File tree

3 files changed

+20
-122
lines changed

3 files changed

+20
-122
lines changed

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

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,7 @@ export class CdkDropList<T = any> implements OnDestroy {
125125

126126
/** Whether sorting within this drop list is disabled. */
127127
@Input('cdkDropListSortingDisabled')
128-
get sortingDisabled(): boolean {
129-
return this._sortingDisabled;
130-
}
131-
set sortingDisabled(value: boolean) {
132-
this._sortingDisabled = coerceBooleanProperty(value);
133-
}
134-
private _sortingDisabled: boolean;
128+
sortingDisabled: boolean;
135129

136130
/**
137131
* Function that is used to determine whether an item
@@ -146,23 +140,11 @@ export class CdkDropList<T = any> implements OnDestroy {
146140

147141
/** Whether to auto-scroll the view when the user moves their pointer close to the edges. */
148142
@Input('cdkDropListAutoScrollDisabled')
149-
get autoScrollDisabled(): boolean {
150-
return this._autoScrollDisabled;
151-
}
152-
set autoScrollDisabled(value: boolean) {
153-
this._autoScrollDisabled = coerceBooleanProperty(value);
154-
}
155-
private _autoScrollDisabled: boolean;
143+
autoScrollDisabled: boolean;
156144

157145
/** Number of pixels to scroll for each frame when auto-scrolling an element. */
158146
@Input('cdkDropListAutoScrollStep')
159-
get autoScrollStep(): number {
160-
return this._autoScrollStep;
161-
}
162-
set autoScrollStep(value: number) {
163-
this._autoScrollStep = coerceNumberProperty(value);
164-
}
165-
private _autoScrollStep: number;
147+
autoScrollStep: number;
166148

167149
/** Emits when the user drops an item inside the container. */
168150
@Output('cdkDropListDropped')

src/material/datepicker/calendar-body.ts

Lines changed: 12 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ import {
1919
SimpleChanges,
2020
OnDestroy,
2121
} from '@angular/core';
22-
import {
23-
BooleanInput,
24-
NumberInput,
25-
coerceBooleanProperty,
26-
coerceNumberProperty,
27-
} from '@angular/cdk/coercion';
2822
import {take} from 'rxjs/operators';
2923

3024
/** Extra CSS classes that can be associated with a calendar cell. */
@@ -83,81 +77,43 @@ export class MatCalendarBody implements OnChanges, OnDestroy {
8377
@Input() rows: MatCalendarCell[][];
8478

8579
/** The value in the table that corresponds to today. */
86-
@Input()
87-
get todayValue(): number { return this._todayValue; }
88-
set todayValue(value: number) { this._todayValue = coerceNumberProperty(value); }
89-
private _todayValue: number;
80+
@Input() todayValue: number;
9081

9182
/** Start value of the selected date range. */
92-
@Input()
93-
get startValue(): number { return this._startValue; }
94-
set startValue(value: number) { this._startValue = coerceNumberProperty(value); }
95-
private _startValue: number;
83+
@Input() startValue: number;
9684

9785
/** End value of the selected date range. */
98-
@Input()
99-
get endValue(): number { return this._endValue; }
100-
set endValue(value: number) { this._endValue = coerceNumberProperty(value); }
101-
private _endValue: number;
86+
@Input() endValue: number;
10287

10388
/** The minimum number of free cells needed to fit the label in the first row. */
104-
@Input()
105-
get labelMinRequiredCells(): number { return this._labelMinRequiredCells; }
106-
set labelMinRequiredCells(value: number) {
107-
this._labelMinRequiredCells = coerceNumberProperty(value);
108-
}
109-
private _labelMinRequiredCells: number;
89+
@Input() labelMinRequiredCells: number;
11090

11191
/** The number of columns in the table. */
112-
@Input()
113-
get numCols(): number { return this._numCols; }
114-
set numCols(value: number) { this._numCols = coerceNumberProperty(value); }
115-
private _numCols = 7;
92+
@Input() numCols: number = 7;
11693

11794
/** The cell number of the active cell in the table. */
118-
@Input()
119-
get activeCell(): number { return this._activeCell; }
120-
set activeCell(value: number) { this._activeCell = coerceNumberProperty(value); }
121-
private _activeCell = 0;
95+
@Input() activeCell: number = 0;
12296

12397
/** Whether a range is being selected. */
124-
@Input()
125-
get isRange(): boolean { return this._isRange; }
126-
set isRange(value: boolean) { this._isRange = coerceBooleanProperty(value); }
127-
private _isRange = false;
98+
@Input() isRange: boolean = false;
12899

129100
/**
130101
* The aspect ratio (width / height) to use for the cells in the table. This aspect ratio will be
131102
* maintained even as the table resizes.
132103
*/
133-
@Input()
134-
get cellAspectRatio(): number { return this._cellAspectRatio; }
135-
set cellAspectRatio(value: number) { this._cellAspectRatio = coerceNumberProperty(value); }
136-
private _cellAspectRatio = 1;
104+
@Input() cellAspectRatio: number = 1;
137105

138106
/** Start of the comparison range. */
139-
@Input()
140-
get comparisonStart(): number | null { return this._comparisonStart; }
141-
set comparisonStart(value: number | null) { this._comparisonStart = coerceNumberProperty(value); }
142-
private _comparisonStart: number | null;
107+
@Input() comparisonStart: number | null;
143108

144109
/** End of the comparison range. */
145-
@Input()
146-
get comparisonEnd(): number | null { return this._comparisonEnd; }
147-
set comparisonEnd(value: number | null) { this._comparisonEnd = coerceNumberProperty(value); }
148-
private _comparisonEnd: number | null;
110+
@Input() comparisonEnd: number | null;
149111

150112
/** Start of the preview range. */
151-
@Input()
152-
get previewStart(): number | null { return this._previewStart; }
153-
set previewStart(value: number | null) { this._previewStart = coerceNumberProperty(value); }
154-
private _previewStart: number | null = null;
113+
@Input() previewStart: number | null = null;
155114

156115
/** End of the preview range. */
157-
@Input()
158-
get previewEnd(): number | null { return this._previewEnd; }
159-
set previewEnd(value: number | null) { this._previewEnd = coerceNumberProperty(value); }
160-
private _previewEnd: number | null = null;
116+
@Input() previewEnd: number | null = null;
161117

162118
/** Emits when a new value is selected. */
163119
@Output() readonly selectedValueChange = new EventEmitter<MatCalendarUserEvent<number>>();
@@ -402,19 +358,6 @@ export class MatCalendarBody implements OnChanges, OnDestroy {
402358

403359
return null;
404360
}
405-
406-
static ngAcceptInputType_todayValue: NumberInput;
407-
static ngAcceptInputType_startValue: NumberInput;
408-
static ngAcceptInputType_endValue: NumberInput;
409-
static ngAcceptInputType_labelMinRequiredCells: NumberInput;
410-
static ngAcceptInputType_numCols: NumberInput;
411-
static ngAcceptInputType_activeCell: NumberInput;
412-
static ngAcceptInputType_isRange: BooleanInput;
413-
static ngAcceptInputType_cellAspectRatio: NumberInput;
414-
static ngAcceptInputType_comparisonStart: NumberInput;
415-
static ngAcceptInputType_comparisonEnd: NumberInput;
416-
static ngAcceptInputType_previewStart: NumberInput;
417-
static ngAcceptInputType_previewEnd: NumberInput;
418361
}
419362

420363
/** Checks whether a node is a table cell element. */

src/material/stepper/step-header.ts

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
*/
88

99
import {FocusMonitor, FocusOrigin} from '@angular/cdk/a11y';
10-
import {
11-
BooleanInput,
12-
NumberInput,
13-
coerceBooleanProperty,
14-
coerceNumberProperty,
15-
} from '@angular/cdk/coercion';
1610
import {
1711
ChangeDetectionStrategy,
1812
ChangeDetectorRef,
@@ -69,34 +63,19 @@ export class MatStepHeader extends _MatStepHeaderBase implements AfterViewInit,
6963
@Input() iconOverrides: {[key: string]: TemplateRef<MatStepperIconContext>};
7064

7165
/** Index of the given step. */
72-
@Input()
73-
get index(): number { return this._index; }
74-
set index(value: number) { this._index = coerceNumberProperty(value); }
75-
private _index: number;
66+
@Input() index: number;
7667

7768
/** Whether the given step is selected. */
78-
@Input()
79-
get selected(): boolean { return this._selected; }
80-
set selected(value: boolean) { this._selected = coerceBooleanProperty(value); }
81-
private _selected: boolean;
69+
@Input() selected: boolean;
8270

8371
/** Whether the given step label is active. */
84-
@Input()
85-
get active(): boolean { return this._active; }
86-
set active(value: boolean) { this._active = coerceBooleanProperty(value); }
87-
private _active: boolean;
72+
@Input() active: boolean;
8873

8974
/** Whether the given step is optional. */
90-
@Input()
91-
get optional(): boolean { return this._optional; }
92-
set optional(value: boolean) { this._optional = coerceBooleanProperty(value); }
93-
private _optional: boolean;
75+
@Input() optional: boolean;
9476

9577
/** Whether the ripple should be disabled. */
96-
@Input()
97-
get disableRipple(): boolean { return this._disableRipple; }
98-
set disableRipple(value: boolean) { this._disableRipple = coerceBooleanProperty(value); }
99-
private _disableRipple: boolean;
78+
@Input() disableRipple: boolean;
10079

10180
constructor(
10281
public _intl: MatStepperIntl,
@@ -161,10 +140,4 @@ export class MatStepHeader extends _MatStepHeaderBase implements AfterViewInit,
161140
}
162141
return state;
163142
}
164-
165-
static ngAcceptInputType_index: NumberInput;
166-
static ngAcceptInputType_selected: BooleanInput;
167-
static ngAcceptInputType_active: BooleanInput;
168-
static ngAcceptInputType_optional: BooleanInput;
169-
static ngAcceptInputType_disableRipple: BooleanInput;
170143
}

0 commit comments

Comments
 (0)