public select()

in src/app/common/selectable.ts [18:44]


    public select(target: any, multi: boolean = false, cascade: boolean) {
        if (!multi && !cascade) {
            this.clearSelection();
        }

        if (cascade) {
            let start = this._selectable.findIndex(f => f === (this._selected.length > 0 ? this._selected[0] : null));

            this.clearSelection();
            this._selected.push(this._selectable[start]);

            if (start != -1) {
                let currentIndex = this._selectable.findIndex(t => t === target);

                let min = Math.min(start, currentIndex);
                let max = Math.max(start, currentIndex);

                for (let i = min; i <= max && i < this._selectable.length; i++) {
                    this.select(this._selectable[i], true, false);
                }
            }
        }

        if (!this._selected.find(f => f === target)) {
            this._selected.push(target);
        }
    }