Skip to content

Commit

Permalink
refactor(checkbox): remove 6.0.0 deletion targets (#10342)
Browse files Browse the repository at this point in the history
Removes the 6.0.0 deletion targets from the `material/checkbox` entry point.

BREAKING CHANGES:
* `align` which was deprecated in 5.0.0 has been removed. Use `labelPosition` instead. Note that the values are different.
  • Loading branch information
crisbeto authored and mmalerba committed Mar 12, 2018
1 parent aa2356d commit 9f8eec1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 35 deletions.
28 changes: 14 additions & 14 deletions src/demo-app/checkbox/checkbox-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h1>mat-checkbox: Basic Example</h1>
(change)="isIndeterminate = false"
[indeterminate]="isIndeterminate"
[disabled]="isDisabled"
[align]="alignment">
[labelPosition]="labelPosition">
Do you want to <em>foobar</em> the <em>bazquux</em>?

</mat-checkbox> - <strong>{{printResult()}}</strong>
Expand All @@ -24,23 +24,23 @@ <h1>mat-checkbox: Basic Example</h1>
<label for="color-toggle">Toggle Color</label>
</div>
<div>
<p>Alignment:</p>
<p>Label position:</p>
<div>
<input #start type="radio"
value="start"
id="align-start"
name="alignment"
(click)="alignment = start.value"
<input #after type="radio"
value="after"
id="align-after"
name="labelPosition"
(click)="labelPosition = after.value"
checked>
<label for="align-start">Start</label>
<label for="align-after">After</label>
</div>
<div>
<input #end type="radio"
value="end"
id="align-end"
name="alignment"
(click)="alignment = end.value">
<label for="align-end">End</label>
<input #before type="radio"
value="before"
id="align-before"
name="labelPosition"
(click)="labelPosition = before.value">
<label for="align-before">Before</label>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/checkbox/checkbox-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class CheckboxDemo {
isIndeterminate: boolean = false;
isChecked: boolean = false;
isDisabled: boolean = false;
alignment: string = 'start';
labelPosition: string = 'after';
useAlternativeColor: boolean = false;

printResult() {
Expand Down
15 changes: 0 additions & 15 deletions src/lib/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,6 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
set required(value: boolean) { this._required = coerceBooleanProperty(value); }
private _required: boolean;

/**
* Whether or not the checkbox should appear before or after the label.
* @deprecated
* @deletion-target 6.0.0
*/
@Input()
get align(): 'start' | 'end' {
// align refers to the checkbox relative to the label, while labelPosition refers to the
// label relative to the checkbox. As such, they are inverted.
return this.labelPosition == 'after' ? 'start' : 'end';
}
set align(value: 'start' | 'end') {
this.labelPosition = (value == 'start') ? 'after' : 'before';
}

/** Whether the label should appear after or before the checkbox. Defaults to 'after' */
@Input() labelPosition: 'before' | 'after' = 'after';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ <h2 class="example-h2">Checkbox configuration</h2>

<section class="example-section">
<label class="example-margin">Align:</label>
<mat-radio-group [(ngModel)]="align">
<mat-radio-button class="example-margin" value="start">Start</mat-radio-button>
<mat-radio-button class="example-margin" value="end">End</mat-radio-button>
<mat-radio-group [(ngModel)]="labelPosition">
<mat-radio-button class="example-margin" value="after">After</mat-radio-button>
<mat-radio-button class="example-margin" value="before">Before</mat-radio-button>
</mat-radio-group>
</section>

Expand All @@ -30,7 +30,7 @@ <h2 class="example-h2">Result</h2>
class="example-margin"
[(ngModel)]="checked"
[(indeterminate)]="indeterminate"
[align]="align"
[labelPosition]="labelPosition"
[disabled]="disabled">
I'm a checkbox
</mat-checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import {Component} from '@angular/core';
export class CheckboxConfigurableExample {
checked = false;
indeterminate = false;
align = 'start';
labelPosition = 'after';
disabled = false;
}

0 comments on commit 9f8eec1

Please sign in to comment.