UNPKG

@anglr/grid

Version:
42 lines 2.19 kB
import { Component, ChangeDetectionStrategy } from '@angular/core'; import { extend } from '@jscrpt/common/extend'; import { BasicRowSelectorComponent } from '../basic/basicRowSelector.component'; import * as i0 from "@angular/core"; /** * Component used for handling row selection with limit of selected rows */ export class LimitedRowSelectorComponent extends BasicRowSelectorComponent { //######################### public properties - overrides ######################### /** * @inheritdoc */ get options() { return this.ɵoptions; } set options(options) { this.ɵoptions = extend(true, this.ɵoptions, options); } //######################### public methods - overrides ######################### /** * Adds item to selection (or remove it from selection if deselect is true) * @param item - Item that is going to be selected * @param select - Indication whether select specified item, defaults to true */ selectItem(item, select = true) { if (!isNaN(this.options.limit) && !isNaN(this.selectedIds.length) && this.selectedIds.length >= this.options.limit && select) { return; } return super.selectItem(item, select); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: LimitedRowSelectorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: LimitedRowSelectorComponent, isStandalone: true, selector: "ng-limited-row-selector", usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: LimitedRowSelectorComponent, decorators: [{ type: Component, args: [{ selector: 'ng-limited-row-selector', template: '', changeDetection: ChangeDetectionStrategy.OnPush }] }] }); //# sourceMappingURL=limitedRowSelector.component.js.map