Skip to content

Commit a190456

Browse files
committed
refactor(radio-group): deprecate disabled and labelPosition
1 parent c9971b9 commit a190456

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

projects/igniteui-angular/src/lib/directives/radio/radio-group.directive.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { IgxRippleModule } from '../ripple/ripple.directive';
1616
import { takeUntil } from 'rxjs/operators';
1717
import { noop, Subject } from 'rxjs';
1818
import { mkenum } from '../../core/utils';
19+
import { DeprecateProperty } from '../../core/deprecateDecorators';
1920

2021
/**
2122
* Determines the Radio Group alignment
@@ -24,7 +25,7 @@ export const RadioGroupAlignment = mkenum({
2425
horizontal: 'horizontal',
2526
vertical: 'vertical'
2627
});
27-
export type RadioGroupAlignment = (typeof RadioGroupAlignment)[keyof typeof RadioGroupAlignment];
28+
export type RadioGroupAlignment = typeof RadioGroupAlignment[keyof typeof RadioGroupAlignment];
2829

2930
let nextId = 0;
3031

@@ -123,30 +124,35 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
123124
return this._required;
124125
}
125126
public set required(value: boolean) {
126-
this._required = (value as any === '') || value;
127+
this._required = (value as any) === '' || value;
127128
this._setRadioButtonsRequired();
128129
}
129130

130131
/**
131132
* An @Input property that allows you to disable the radio group. By default it's false.
132133
*
134+
* @deprecated in version 12.2.0
135+
*
133136
* @example
134137
* ```html
135-
* <igx-radio-group [disabled]="true"></igx-radio-group>
138+
* <igx-radio-group disabled></igx-radio-group>
136139
* ```
137140
*/
141+
@DeprecateProperty('`disabled` is deprecated.')
138142
@Input()
139143
public get disabled(): boolean {
140144
return this._disabled;
141145
}
142146
public set disabled(value: boolean) {
143-
this._disabled = (value as any === '') || value;
147+
this._disabled = (value as any) === '' || value;
144148
this.setDisabledState(value);
145149
}
146150

147151
/**
148152
* Sets/gets the position of the `label` in the child radio buttons.
149153
*
154+
* @deprecated in version 12.2.0
155+
*
150156
* @remarks
151157
* If not set, `labelPosition` will have value `"after"`.
152158
*
@@ -155,6 +161,7 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
155161
* <igx-radio-group labelPosition = "before"></igx-radio-group>
156162
* ```
157163
*/
164+
@DeprecateProperty('`labelPosition` is deprecated.')
158165
@Input()
159166
public get labelPosition(): RadioLabelPosition | string {
160167
return this._labelPosition;
@@ -340,10 +347,10 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
340347
* @hidden
341348
* @internal
342349
*/
343-
public setDisabledState(isDisabled: boolean) {
350+
public setDisabledState(isDisabled: boolean) {
344351
if (this.radioButtons) {
345352
this.radioButtons.forEach((button) => {
346-
button.disabled = isDisabled;
353+
button.setDisabledState(isDisabled);
347354
});
348355
}
349356
}
@@ -396,7 +403,7 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
396403
* @internal
397404
*/
398405
private _selectedRadioButtonChanged(args: IChangeRadioEventArgs) {
399-
this.radioButtons.forEach(button => {
406+
this.radioButtons.forEach((button) => {
400407
button.checked = button.id === args.radio.id;
401408
});
402409

@@ -487,4 +494,4 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
487494
exports: [IgxRadioGroupDirective, IgxRadioComponent],
488495
imports: [IgxRippleModule]
489496
})
490-
export class IgxRadioModule { }
497+
export class IgxRadioModule {}

0 commit comments

Comments
 (0)