@anglr/grid
Version:
Angular module displaying grid
68 lines • 6.1 kB
JavaScript
import { Component, ChangeDetectionStrategy, ChangeDetectorRef, Optional, Inject, HostBinding, ElementRef } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MergeCssClassesPipe } from '@anglr/common';
import { BodyContentRendererAbstractComponent } from '../../bodyContentRendererAbstract.component';
import { BODY_CONTENT_RENDERER_OPTIONS, GRID_PLUGIN_INSTANCES } from '../../../../../misc/tokens';
import { DataCellContextPipe, ReadValuePipe } from '../../../../../pipes';
import { provideDataCellContextFactoryFn } from '../../../../../misc/providers';
import { dataCellContextFactory } from '../../../../../misc/utils';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
/**
* Default options for 'CssDivsBodyContentRendererComponent'
*/
const defaultOptions = {
rowClick: null,
rowCssClass: null,
cssClasses: {
bodyDiv: 'body-div-contents',
rowDiv: 'body-row-contents',
cellDiv: 'body-cell'
}
};
/**
* Component used for rendering body for 'CssDivsContentRenderer'
* @deprecated use new MatrixGrid with MatrixContentRenderer instead
*/
export class CssDivsBodyContentRendererComponent extends BodyContentRendererAbstractComponent {
//######################### public properties - host bindings #########################
/**
* Css class applied to grid itself
*/
get cssClass() {
return this.ɵoptions.cssClasses.bodyDiv;
}
//######################### constructor #########################
constructor(pluginElement, changeDetector, gridPlugins, options) {
super(pluginElement, changeDetector, gridPlugins, defaultOptions, options);
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: CssDivsBodyContentRendererComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: GRID_PLUGIN_INSTANCES, optional: true }, { token: BODY_CONTENT_RENDERER_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.0", type: CssDivsBodyContentRendererComponent, isStandalone: true, selector: "div.content-renderer-body", host: { properties: { "class": "this.cssClass" } }, providers: [
provideDataCellContextFactoryFn(dataCellContextFactory),
], usesInheritance: true, ngImport: i0, template: "@for(datum of data; track datum; let index=$index)\r\n{\r\n <div [ngClass]=\"options.cssClasses.rowDiv | mergeCssClasses: [options.rowCssClass?.(datum)]\" (click)=\"options.rowClick?.(datum, index)\">\r\n @for(meta of metadata?.columns; track meta)\r\n {\r\n <div [ngClass]=\"options.cssClasses.cellDiv | mergeCssClasses: [meta.cellClass]\"\r\n [attr.data-header-title]=\"meta?.title\"\r\n [style.width]=\"meta?.width\">\r\n @if (meta?.bodyTemplate) \r\n {\r\n <ng-container *ngTemplateOutlet=\"meta?.bodyTemplate ?? null; context: datum | dataCellContext: index : meta\"/>\r\n }\r\n @else \r\n {\r\n {{datum | readValue: meta?.name}}\r\n }\r\n </div>\r\n }\r\n </div>\r\n}\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: ReadValuePipe, name: "readValue" }, { kind: "pipe", type: DataCellContextPipe, name: "dataCellContext" }, { kind: "pipe", type: MergeCssClassesPipe, name: "mergeCssClasses" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: CssDivsBodyContentRendererComponent, decorators: [{
type: Component,
args: [{ selector: 'div.content-renderer-body', imports: [
CommonModule,
ReadValuePipe,
DataCellContextPipe,
MergeCssClassesPipe,
], providers: [
provideDataCellContextFactoryFn(dataCellContextFactory),
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@for(datum of data; track datum; let index=$index)\r\n{\r\n <div [ngClass]=\"options.cssClasses.rowDiv | mergeCssClasses: [options.rowCssClass?.(datum)]\" (click)=\"options.rowClick?.(datum, index)\">\r\n @for(meta of metadata?.columns; track meta)\r\n {\r\n <div [ngClass]=\"options.cssClasses.cellDiv | mergeCssClasses: [meta.cellClass]\"\r\n [attr.data-header-title]=\"meta?.title\"\r\n [style.width]=\"meta?.width\">\r\n @if (meta?.bodyTemplate) \r\n {\r\n <ng-container *ngTemplateOutlet=\"meta?.bodyTemplate ?? null; context: datum | dataCellContext: index : meta\"/>\r\n }\r\n @else \r\n {\r\n {{datum | readValue: meta?.name}}\r\n }\r\n </div>\r\n }\r\n </div>\r\n}\r\n" }]
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
type: Inject,
args: [GRID_PLUGIN_INSTANCES]
}, {
type: Optional
}] }, { type: undefined, decorators: [{
type: Inject,
args: [BODY_CONTENT_RENDERER_OPTIONS]
}, {
type: Optional
}] }], propDecorators: { cssClass: [{
type: HostBinding,
args: ['class']
}] } });
//# sourceMappingURL=cssDivsBodyContentRenderer.component.js.map