Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ngAfterContentInit(): void {
this.horizontal = toBoolean(this.horizontal);
this._keyManager = new FocusKeyManager(this.options)
.withTypeAhead()
.withVerticalOrientation(!this.horizontal)
.withHorizontalOrientation(this.horizontal ? 'ltr' : null);
if (this._tempValues) {
this._setOptionsFromValues(this._tempValues);
this._tempValues = null;
}
// Sync external changes to the model back to the options.
this._modelChanges = this.selectedOptions.onChange!.subscribe((event) => {
for (const item of event.added) {
item.selected = true;
}
set checked(value: boolean) {
const newCheckedState = toBoolean(value);
if (this._checked !== newCheckedState) {
this._checked = newCheckedState;
if (newCheckedState && this.radioGroup && this.radioGroup.value !== this.value) {
this.radioGroup.selected = this;
} else if (!newCheckedState && this.radioGroup && this.radioGroup.value === this.value) {
// When unchecking the selected radio button, update the selected radio
// property on the group.
this.radioGroup.selected = null;
}
if (newCheckedState) {
// Notify all radio buttons with the same name to un-check.
this._radioDispatcher.notify(this.id, this.name);
}
ngAfterContentInit(): void {
this.horizontal = toBoolean(this.horizontal);
this.keyManager = new FocusKeyManager(this.options)
.withTypeAhead()
.withVerticalOrientation(!this.horizontal)
.withHorizontalOrientation(this.horizontal ? 'ltr' : null);
this.keyManager.tabOut
.pipe(takeUntil(this.destroyed))
.subscribe(() => {
this._tabIndex = -1;
setTimeout(() => {
this._tabIndex = 0;
this.changeDetectorRef.markForCheck();
});
});
set inset(value: boolean) {
this._inset = toBoolean(value);
}
set mcCollapsible(value: boolean) {
this.collapsible = toBoolean(value);
}
set required(value: boolean) {
this._required = toBoolean(value);
}
set selected(value: boolean) {
const isSelected = toBoolean(value);
if (isSelected !== this._selected) {
this.setSelected(isSelected);
this.listSelection.reportValueChange();
}
}
set vertical(value: boolean) {
this._vertical = toBoolean(value);
}
constructor(
private _element: ElementRef,
@Attribute('tabindex') tabIndex: string,
@Attribute('auto-select') autoSelect: string,
@Attribute('no-unselect') noUnselect: string,
@Attribute('multiple') multiple: string
) {
super();
this.autoSelect = autoSelect === null ? true : toBoolean(autoSelect);
this.multiple = multiple === null ? true : toBoolean(multiple);
this.noUnselect = noUnselect === null ? true : toBoolean(noUnselect);
this.tabIndex = parseInt(tabIndex) || 0;
this.selectedOptions = new SelectionModel(this.multiple);
}
constructor(
private elementRef: ElementRef,
differs: IterableDiffers,
changeDetectorRef: ChangeDetectorRef,
@Attribute('tabindex') tabIndex: string,
@Attribute('multiple') multiple: string,
@Attribute('auto-select') autoSelect: string,
@Attribute('no-unselect') noUnselect: string
) {
super(differs, changeDetectorRef);
this.tabIndex = parseInt(tabIndex) || 0;
this.multiple = multiple === null ? false : toBoolean(multiple);
this.autoSelect = autoSelect === null ? true : toBoolean(autoSelect);
this.noUnselect = noUnselect === null ? true : toBoolean(noUnselect);
this.selectionModel = new SelectionModel(this.multiple);
}