Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 1047ae0

Browse files
authored
feat: Remove packages/common (#1976)
Replaced with `@angular/cdk/*` closes #1974
1 parent 61b247c commit 1047ae0

Some content is hidden

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

52 files changed

+215
-362
lines changed

packages/button/button.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
OnInit,
1010
ViewEncapsulation
1111
} from '@angular/core';
12-
import {toBoolean} from '@angular-mdc/web/common';
12+
import {coerceBooleanProperty} from '@angular/cdk/coercion';
1313
import {MdcRipple} from '@angular-mdc/web/ripple';
1414
import {MdcIcon} from '@angular-mdc/web/icon';
1515

@@ -49,42 +49,42 @@ export class MdcButton implements OnInit, OnDestroy {
4949
@Input()
5050
get raised(): boolean { return this._raised; }
5151
set raised(value: boolean) {
52-
this._raised = toBoolean(value);
52+
this._raised = coerceBooleanProperty(value);
5353
}
5454
private _raised: boolean = false;
5555

5656
@Input()
5757
get primary(): boolean { return this._primary; }
5858
set primary(value: boolean) {
59-
this._primary = toBoolean(value);
59+
this._primary = coerceBooleanProperty(value);
6060
}
6161
private _primary: boolean = false;
6262

6363
@Input()
6464
get dense(): boolean { return this._dense; }
6565
set dense(value: boolean) {
66-
this._dense = toBoolean(value);
66+
this._dense = coerceBooleanProperty(value);
6767
}
6868
private _dense: boolean = false;
6969

7070
@Input()
7171
get secondary(): boolean { return this._secondary; }
7272
set secondary(value: boolean) {
73-
this._secondary = toBoolean(value);
73+
this._secondary = coerceBooleanProperty(value);
7474
}
7575
private _secondary: boolean = false;
7676

7777
@Input()
7878
get unelevated(): boolean { return this._unelevated; }
7979
set unelevated(value: boolean) {
80-
this._unelevated = toBoolean(value);
80+
this._unelevated = coerceBooleanProperty(value);
8181
}
8282
private _unelevated: boolean = false;
8383

8484
@Input()
8585
get outlined(): boolean { return this._outlined; }
8686
set outlined(value: boolean) {
87-
this._outlined = toBoolean(value);
87+
this._outlined = coerceBooleanProperty(value);
8888
}
8989
private _outlined: boolean = false;
9090

@@ -116,7 +116,7 @@ export class MdcButton implements OnInit, OnDestroy {
116116
}
117117

118118
setDisabled(disabled: boolean): void {
119-
this._disabled = toBoolean(disabled);
119+
this._disabled = coerceBooleanProperty(disabled);
120120

121121
if (this._disabled) {
122122
this.getHostElement().setAttribute('disabled', 'true');

packages/card/card.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
OnDestroy,
88
ViewEncapsulation
99
} from '@angular/core';
10-
import {toBoolean} from '@angular-mdc/web/common';
10+
import {coerceBooleanProperty} from '@angular/cdk/coercion';
1111
import {MdcRipple} from '@angular-mdc/web/ripple';
1212

1313
@Directive({
@@ -36,14 +36,14 @@ export class MdcCardMedia {
3636
@Input()
3737
get square(): boolean { return this._square; }
3838
set square(value: boolean) {
39-
this._square = toBoolean(value);
39+
this._square = coerceBooleanProperty(value);
4040
}
4141
private _square: boolean = false;
4242

4343
@Input()
4444
get wide(): boolean { return this._wide; }
4545
set wide(value: boolean) {
46-
this._wide = toBoolean(value);
46+
this._wide = coerceBooleanProperty(value);
4747
}
4848
private _wide: boolean = false;
4949

@@ -89,7 +89,7 @@ export class MdcCardActions {
8989
@Input()
9090
get fullBleed(): boolean { return this._fullBleed; }
9191
set fullBleed(value: boolean) {
92-
this._fullBleed = toBoolean(value);
92+
this._fullBleed = coerceBooleanProperty(value);
9393
}
9494
private _fullBleed: boolean = false;
9595

@@ -158,7 +158,7 @@ export class MdcCard {
158158
@Input()
159159
get outlined(): boolean { return this._outlined; }
160160
set outlined(value: boolean) {
161-
this._outlined = toBoolean(value);
161+
this._outlined = coerceBooleanProperty(value);
162162
}
163163
private _outlined: boolean = false;
164164

packages/checkbox/checkbox.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import {
1515
ViewEncapsulation
1616
} from '@angular/core';
1717
import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';
18+
import {coerceBooleanProperty} from '@angular/cdk/coercion';
1819
import {Platform} from '@angular/cdk/platform';
1920
import {fromEvent, Subject} from 'rxjs';
2021
import {takeUntil, filter} from 'rxjs/operators';
2122

2223
import {MDCComponent} from '@angular-mdc/web/base';
23-
import {toBoolean} from '@angular-mdc/web/common';
2424
import {MdcRipple} from '@angular-mdc/web/ripple';
2525
import {MdcFormField, MdcFormFieldControl} from '@angular-mdc/web/form-field';
2626

@@ -109,7 +109,7 @@ export class MdcCheckbox extends MDCComponent<MDCCheckboxFoundation> implements
109109
get checked(): boolean { return this._checked; }
110110
set checked(value: boolean) {
111111
if (value !== this.checked) {
112-
this._checked = toBoolean(value);
112+
this._checked = coerceBooleanProperty(value);
113113
this._changeDetectorRef.markForCheck();
114114
}
115115
}
@@ -136,7 +136,7 @@ export class MdcCheckbox extends MDCComponent<MDCCheckboxFoundation> implements
136136
set indeterminate(value: boolean) {
137137
if (this.disabled) { return; }
138138

139-
const newValue = toBoolean(value);
139+
const newValue = coerceBooleanProperty(value);
140140
if (newValue !== this._indeterminate) {
141141
this._indeterminate = newValue;
142142
if (newValue) {
@@ -156,7 +156,7 @@ export class MdcCheckbox extends MDCComponent<MDCCheckboxFoundation> implements
156156
@Input()
157157
get indeterminateToChecked(): boolean { return this._indeterminateToChecked; }
158158
set indeterminateToChecked(value: boolean) {
159-
this._indeterminateToChecked = toBoolean(value);
159+
this._indeterminateToChecked = coerceBooleanProperty(value);
160160
this._changeDetectorRef.markForCheck();
161161
}
162162
private _indeterminateToChecked: boolean = true;
@@ -273,7 +273,7 @@ export class MdcCheckbox extends MDCComponent<MDCCheckboxFoundation> implements
273273
}
274274

275275
setDisabledState(disabled: boolean): void {
276-
this._disabled = toBoolean(disabled);
276+
this._disabled = coerceBooleanProperty(disabled);
277277
this._foundation.setDisabled(this._disabled);
278278
this._changeDetectorRef.markForCheck();
279279
}

packages/chips/chip-set.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import {
1414
ViewEncapsulation
1515
} from '@angular/core';
1616
import {ControlValueAccessor, FormGroupDirective, NgControl, NgForm} from '@angular/forms';
17+
import {coerceBooleanProperty} from '@angular/cdk/coercion';
1718
import {merge, Observable, Subject, Subscription} from 'rxjs';
1819
import {startWith, takeUntil} from 'rxjs/operators';
1920

2021
import {MDCComponent} from '@angular-mdc/web/base';
21-
import {toBoolean} from '@angular-mdc/web/common';
2222

2323
import {
2424
MdcChip,
@@ -62,7 +62,7 @@ export class MdcChipSet extends MDCComponent<MDCChipSetFoundation>
6262
@Input()
6363
get choice(): boolean { return this._choice; }
6464
set choice(value: boolean) {
65-
this._choice = toBoolean(value);
65+
this._choice = coerceBooleanProperty(value);
6666
}
6767
private _choice: boolean = false;
6868

@@ -72,7 +72,7 @@ export class MdcChipSet extends MDCComponent<MDCChipSetFoundation>
7272
@Input()
7373
get filter(): boolean { return this._filter; }
7474
set filter(value: boolean) {
75-
this._filter = toBoolean(value);
75+
this._filter = coerceBooleanProperty(value);
7676
}
7777
private _filter: boolean = false;
7878

@@ -82,7 +82,7 @@ export class MdcChipSet extends MDCComponent<MDCChipSetFoundation>
8282
@Input()
8383
get input(): boolean { return this._input; }
8484
set input(value: boolean) {
85-
this._input = toBoolean(value);
85+
this._input = coerceBooleanProperty(value);
8686
}
8787
private _input: boolean = false;
8888

packages/chips/chip.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ import {
2121
QueryList,
2222
ViewEncapsulation
2323
} from '@angular/core';
24+
import {coerceBooleanProperty} from '@angular/cdk/coercion';
2425
import {Platform} from '@angular/cdk/platform';
2526
import {fromEvent, Subject} from 'rxjs';
2627
import {takeUntil} from 'rxjs/operators';
2728

2829
import {MDCComponent} from '@angular-mdc/web/base';
29-
import {toBoolean} from '@angular-mdc/web/common';
3030
import {MdcRipple} from '@angular-mdc/web/ripple';
3131
import {
3232
MdcIcon,
@@ -149,7 +149,7 @@ export class MdcChip extends MDCComponent<MDCChipFoundation> implements AfterVie
149149
@Input()
150150
get selected(): boolean { return this._selected; }
151151
set selected(value: boolean) {
152-
const newValue = toBoolean(value);
152+
const newValue = coerceBooleanProperty(value);
153153
this._selected = newValue;
154154
this._foundation.setSelected(newValue);
155155

@@ -162,7 +162,7 @@ export class MdcChip extends MDCComponent<MDCChipFoundation> implements AfterVie
162162
@Input()
163163
get filter(): boolean { return this._filter; }
164164
set filter(value: boolean) {
165-
const newValue = toBoolean(value);
165+
const newValue = coerceBooleanProperty(value);
166166
if (newValue !== this._filter) {
167167
this._filter = newValue;
168168
}
@@ -172,36 +172,36 @@ export class MdcChip extends MDCComponent<MDCChipFoundation> implements AfterVie
172172
@Input()
173173
get choice(): boolean { return this._choice; }
174174
set choice(value: boolean) {
175-
this._choice = toBoolean(value);
175+
this._choice = coerceBooleanProperty(value);
176176
}
177177
private _choice: boolean = false;
178178

179179
@Input()
180180
get input(): boolean { return this._input; }
181181
set input(value: boolean) {
182-
this._input = toBoolean(value);
182+
this._input = coerceBooleanProperty(value);
183183
}
184184
private _input: boolean = false;
185185

186186
@Input()
187187
get primary(): boolean { return this._primary; }
188188
set primary(value: boolean) {
189-
this._primary = toBoolean(value);
189+
this._primary = coerceBooleanProperty(value);
190190
}
191191
private _primary: boolean = false;
192192

193193
@Input()
194194
get secondary(): boolean { return this._secondary; }
195195
set secondary(value: boolean) {
196-
this._secondary = toBoolean(value);
196+
this._secondary = coerceBooleanProperty(value);
197197
}
198198
private _secondary: boolean = false;
199199

200200
/** Determines whether or not the chip displays the remove styling and emits (removed) events. */
201201
@Input()
202202
get removable(): boolean { return this._removable; }
203203
set removable(value: boolean) {
204-
const newValue = toBoolean(value);
204+
const newValue = coerceBooleanProperty(value);
205205
if (newValue !== this._removable) {
206206
this._removable = value;
207207
this._foundation.setShouldRemoveOnTrailingIconClick(this._removable);
@@ -213,15 +213,15 @@ export class MdcChip extends MDCComponent<MDCChipFoundation> implements AfterVie
213213
@Input()
214214
get disabled(): boolean { return this._disabled; }
215215
set disabled(value: boolean) {
216-
this._disabled = toBoolean(value);
216+
this._disabled = coerceBooleanProperty(value);
217217
}
218218
private _disabled: boolean = false;
219219

220220
/** Whether the chip ripple is disabled. */
221221
@Input()
222222
get disableRipple(): boolean { return this._disableRipple; }
223223
set disableRipple(value: boolean) {
224-
this._disableRipple = toBoolean(value);
224+
this._disableRipple = coerceBooleanProperty(value);
225225
}
226226
private _disableRipple: boolean = false;
227227

@@ -418,14 +418,14 @@ export class MdcChipIcon extends MdcIcon implements AfterContentInit {
418418
@Input()
419419
get leading(): boolean { return this._leading; }
420420
set leading(value: boolean) {
421-
this._leading = toBoolean(value);
421+
this._leading = coerceBooleanProperty(value);
422422
}
423423
private _leading: boolean = false;
424424

425425
@Input()
426426
get trailing(): boolean { return this._trailing; }
427427
set trailing(value: boolean) {
428-
this._trailing = toBoolean(value);
428+
this._trailing = coerceBooleanProperty(value);
429429
}
430430
private _trailing: boolean = false;
431431

packages/common/boolean-property.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/common/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/common/keycodes.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

packages/common/number-property.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

packages/common/public-api.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)