How to use the @ptsecurity/mosaic/core.toBoolean function in @ptsecurity/mosaic

To help you get started, we’ve selected a few @ptsecurity/mosaic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github positive-js / mosaic / src / lib / list / list-selection.component.ts View on Github external
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;
            }
github positive-js / mosaic / src / lib / radio / radio.component.ts View on Github external
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);
            }
github positive-js / mosaic / packages / mosaic / list / list-selection.component.ts View on Github external
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();
                });
            });
github positive-js / mosaic / src / lib / divider / divider.component.ts View on Github external
set inset(value: boolean) {
        this._inset = toBoolean(value);
    }
github positive-js / mosaic / src / lib / layout / sidebar.component.ts View on Github external
set mcCollapsible(value: boolean) {
        this.collapsible = toBoolean(value);
    }
github positive-js / mosaic / packages / mosaic / radio / radio.component.ts View on Github external
set required(value: boolean) {
        this._required = toBoolean(value);
    }
github positive-js / mosaic / packages / mosaic / list / list-selection.component.ts View on Github external
set selected(value: boolean) {
        const isSelected = toBoolean(value);

        if (isSelected !== this._selected) {
            this.setSelected(isSelected);

            this.listSelection.reportValueChange();
        }
    }
github positive-js / mosaic / src / lib / divider / divider.component.ts View on Github external
set vertical(value: boolean) {
        this._vertical = toBoolean(value);
    }
github positive-js / mosaic / src / lib / list / list-selection.component.ts View on Github external
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);
    }
github positive-js / mosaic / src / lib / tree / tree-selection.ts View on Github external
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);
    }