UNPKG

@progress/kendo-angular-layout

Version:

Kendo UI for Angular Layout Package - a collection of components to create professional application layoyts

71 lines (70 loc) 3.14 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Component, Input, Renderer2, ElementRef } from '@angular/core'; import * as i0 from "@angular/core"; export class GridLayoutItemComponent { renderer; element; /** * Sets the row of the item in the GridLayout * ([see example]({% slug items_gridlayout %}#toc-size-and-position)). */ row; /** * Sets the column of the item in the GridLayout * ([see example]({% slug items_gridlayout %}#toc-size-and-position)). */ col; /** * Determines how many rows will the item span. The default size is one row * ([see example]({% slug items_gridlayout %}#toc-size-and-position)). */ rowSpan; /** * Determines how many columns will the item span. The default size is one column * ([see example]({% slug items_gridlayout %}#toc-size-and-position)). */ colSpan; constructor(renderer, element) { this.renderer = renderer; this.element = element; } ngOnInit() { this.setItemStyle(); } ngOnChanges() { this.setItemStyle(); } setItemStyle() { const row = this.row || 'auto'; const col = this.col || 'auto'; const rowSpan = this.rowSpan ? `span ${this.rowSpan}` : 'auto'; const colSpan = this.colSpan ? `span ${this.colSpan}` : 'auto'; const gridAreaStyle = `${row} / ${col} / ${rowSpan} / ${colSpan}`; this.renderer.setStyle(this.element.nativeElement, 'grid-area', gridAreaStyle); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GridLayoutItemComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: GridLayoutItemComponent, isStandalone: true, selector: "kendo-gridlayout-item", inputs: { row: "row", col: "col", rowSpan: "rowSpan", colSpan: "colSpan" }, usesOnChanges: true, ngImport: i0, template: ` <ng-content></ng-content> `, isInline: true }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GridLayoutItemComponent, decorators: [{ type: Component, args: [{ selector: 'kendo-gridlayout-item', template: ` <ng-content></ng-content> `, standalone: true }] }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { row: [{ type: Input }], col: [{ type: Input }], rowSpan: [{ type: Input }], colSpan: [{ type: Input }] } });