refactor(): remove checked property in favor of parent value (#19449)

BREAKING CHANGE:


The following components have been updated to remove the checked or selected properties:

- Radio
- Segment Button
- Select

Developers should set the value property on the respective parent components in order to managed checked/selected status.

Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
This commit is contained in:
Manu MA
2020-01-17 23:22:26 +01:00
committed by Liam DeBeasi
parent 9232f16eea
commit a5229d90ca
52 changed files with 879 additions and 939 deletions

View File

@ -26,7 +26,7 @@ export class SelectPopover implements ComponentInterface {
/** Array of options for the popover */
@Prop() options: SelectPopoverOption[] = [];
@Listen('ionSelect')
@Listen('ionChange')
onSelect(ev: any) {
const option = this.options.find(o => o.value === ev.target.value);
if (option) {
@ -35,6 +35,8 @@ export class SelectPopover implements ComponentInterface {
}
render() {
const checkedOption = this.options.find(o => o.checked);
const checkedValue = checkedOption ? checkedOption.value : undefined;
return (
<Host class={getIonMode(this)}>
<ion-list>
@ -47,14 +49,13 @@ export class SelectPopover implements ComponentInterface {
</ion-label>
</ion-item>
}
<ion-radio-group>
<ion-radio-group value={checkedValue}>
{this.options.map(option =>
<ion-item>
<ion-label>
{option.text}
</ion-label>
<ion-radio
checked={option.checked}
value={option.value}
disabled={option.disabled}
>