How to use the @ptsecurity/mosaic/core.getMcSelectNonArrayValueError 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 / select / select.component.ts View on Github external
private setSelectionByValue(value: any | any[]): void {
        if (this.multiple && value) {
            if (!Array.isArray(value)) {
                throw getMcSelectNonArrayValueError();
            }

            this.selectionModel.clear();
            value.forEach((currentValue: any) => this.selectValue(currentValue));
            this.sortValues();
        } else {
            this.selectionModel.clear();
            const correspondingOption = this.selectValue(value);

            // Shift focus to the active item. Note that we shouldn't do this in multiple
            // mode, because we don't know what option the user interacted with last.
            if (correspondingOption) {
                this.keyManager.setActiveItem(correspondingOption);
            }
        }
github positive-js / mosaic / packages / mosaic / select / select.component.ts View on Github external
private setSelectionByValue(value: any | any[]): void {
        this.previousSelectionModelSelected = this.selectionModel.selected;

        if (this.multiple && value) {
            if (!Array.isArray(value)) {
                throw getMcSelectNonArrayValueError();
            }

            this.selectionModel.clear();
            value.forEach((currentValue: any) => this.selectValue(currentValue));
            this.sortValues();
        } else {
            this.selectionModel.clear();
            const correspondingOption = this.selectValue(value);

            // Shift focus to the active item. Note that we shouldn't do this in multiple
            // mode, because we don't know what option the user interacted with last.
            if (correspondingOption) {
                this.keyManager.setActiveItem(correspondingOption);
            }
        }
github positive-js / mosaic / src / lib / tree-select / tree-select.component.ts View on Github external
private setSelectionByValue(value: any | any[]) {
        if (this.multiple && value) {
            if (!Array.isArray(value)) { throw getMcSelectNonArrayValueError(); }

            this.selectionModel.clear();
            value.forEach((currentValue: any) => this.selectValue(currentValue));
            this.sortValues();
        } else {
            this.selectionModel.clear();
            const correspondingOption = this.selectValue(value);

            // Shift focus to the active item. Note that we shouldn't do this in multiple
            // mode, because we don't know what option the user interacted with last.
            if (correspondingOption) {
                this.tree.keyManager.setActiveItem(correspondingOption);
            }
        }

        this.changeDetectorRef.markForCheck();
github positive-js / mosaic / packages / mosaic / tree-select / tree-select.component.ts View on Github external
private setSelectionByValue(value: any | any[]) {
        if (this.multiple && value) {
            if (!Array.isArray(value)) { throw getMcSelectNonArrayValueError(); }

            this.tree.setOptionsFromValues(value);

            this.sortValues();
        } else {
            this.tree.setOptionsFromValues([value]);
        }

        this.changeDetectorRef.detectChanges();
    }
github positive-js / mosaic / packages / mosaic / tree / tree-selection.component.ts View on Github external
writeValue(value: any): void {
        if (this.multiple && value && !Array.isArray(value)) {
            throw getMcSelectNonArrayValueError();
        }

        if (this.renderedOptions) {
            this.setOptionsFromValues(this.multiple ? value : [value]);
        }
    }