UNPKG

@anglr/grid

Version:
108 lines 3.4 kB
import { Component, ChangeDetectionStrategy, ElementRef, Inject, Optional, signal, inject } from '@angular/core'; import { extend } from '@jscrpt/common/extend'; import { GRID_PLUGIN_INSTANCES, ROW_SELECTOR_OPTIONS } from '../../../misc/tokens'; import * as i0 from "@angular/core"; /** * Default options for row selector */ const defaultOptions = { getRowId: null, autoResetOnDataChange: false, multiSelection: true, getRowData: data => data }; /** * Component used for handling no row selection */ export class NoRowSelectorComponent { /** * @inheritdoc */ get options() { return this.ɵoptions; } set options(options) { this.ɵoptions = extend(true, this.ɵoptions, options); } /** * @inheritdoc */ get selectedIds() { return this.ɵselectedIds.asReadonly(); } /** * @inheritdoc */ get selectedData() { return this.ɵselectedData.asReadonly(); } //######################### constructor ######################### constructor(options) { /** * Array of currently selected row ids */ this.ɵselectedIds = signal([]); /** * Array of currently selected row data */ this.ɵselectedData = signal([]); //######################### public properties - implementation of RowSelector ######################### /** * @inheritdoc */ this.pluginElement = inject((ElementRef)); /** * @inheritdoc */ this.gridPlugins = inject(GRID_PLUGIN_INSTANCES, { optional: true }); this.ɵoptions = extend(true, {}, defaultOptions, options); } //######################### public methods - implementation of RowSelector ######################### /** * @inheritdoc */ resetSelection() { } /** * @inheritdoc */ selectItem(_item, _select = true) { } /** * @inheritdoc */ isSelected(_item) { return false; } /** * @inheritdoc */ initialize(_force) { } /** * @inheritdoc */ initOptions() { } /** * @inheritdoc */ invalidateVisuals() { } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: NoRowSelectorComponent, deps: [{ token: ROW_SELECTOR_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: NoRowSelectorComponent, isStandalone: true, selector: "ng-no-row-selector", ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: NoRowSelectorComponent, decorators: [{ type: Component, args: [{ selector: 'ng-no-row-selector', template: '', changeDetection: ChangeDetectionStrategy.OnPush }] }], ctorParameters: () => [{ type: undefined, decorators: [{ type: Inject, args: [ROW_SELECTOR_OPTIONS] }, { type: Optional }] }] }); //# sourceMappingURL=noRowSelector.component.js.map