UNPKG

@anglr/grid

Version:
64 lines 2.98 kB
import { Component, ChangeDetectionStrategy, forwardRef, ContentChildren, signal } from '@angular/core'; import { TableGridColumnComponent } from '../tableGridColumn/tableGridColumn.component'; import { METADATA_GATHERER } from '../../misc/tokens'; import * as i0 from "@angular/core"; /** * Component that is used for gathering metadata for table */ export class TableGridMetadataGathererComponent { constructor() { //######################### protected fields ######################### /** * Signal for metadata value */ this.metadataValue = signal({ columns: [], }); } //######################### public properties - implementation of MetadataGatherer<TableGridMetadata> ######################### /** * @inheritdoc */ get metadata() { return this.metadataValue.asReadonly(); } //######################### public methods - implementation of AfterContentInit ######################### /** * Called when content was initialized */ ngAfterContentInit() { this.columns?.changes.subscribe(() => { this.metadataValue.set({ columns: this.columns?.toArray() ?? [], }); }); this.metadataValue.set({ columns: this.columns?.toArray() ?? [], }); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: TableGridMetadataGathererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: TableGridMetadataGathererComponent, isStandalone: true, selector: "basic-table-metadata, table-metadata", providers: [ { provide: METADATA_GATHERER, useExisting: forwardRef(() => TableGridMetadataGathererComponent) }, ], queries: [{ propertyName: "columns", predicate: TableGridColumnComponent }], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: TableGridMetadataGathererComponent, decorators: [{ type: Component, args: [{ selector: 'basic-table-metadata, table-metadata', template: '', changeDetection: ChangeDetectionStrategy.OnPush, providers: [ { provide: METADATA_GATHERER, useExisting: forwardRef(() => TableGridMetadataGathererComponent) }, ], }] }], propDecorators: { columns: [{ type: ContentChildren, args: [TableGridColumnComponent] }] } }); //# sourceMappingURL=tableGridMetadataGatherer.component.js.map