@progress/kendo-angular-layout
Version:
Kendo UI for Angular Layout Package - a collection of components to create professional application layoyts
62 lines (61 loc) • 3.02 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Directive, ElementRef, Input, Renderer2 } from '@angular/core';
import { RESIZE_HANDLE_DIMENSIONS } from './constants';
import * as i0 from "@angular/core";
/**
* @hidden
*/
export class TileLayoutResizeHandleDirective {
el;
renderer;
resizeDirection;
rtl;
constructor(el, renderer) {
this.el = el;
this.renderer = renderer;
}
ngOnInit() {
this.sizeHandle();
}
setHorizontalPosition(element) {
this.renderer.setStyle(element, this.rtl ? 'left' : 'right', -RESIZE_HANDLE_DIMENSIONS[this.resizeDirection].overlapX + 'px');
}
setBottom(element) {
this.renderer.setStyle(element, 'bottom', -RESIZE_HANDLE_DIMENSIONS[this.resizeDirection].overlapY + 'px');
}
sizeHandle() {
const element = this.el.nativeElement;
const handleWidth = RESIZE_HANDLE_DIMENSIONS[this.resizeDirection].width ?
`${RESIZE_HANDLE_DIMENSIONS[this.resizeDirection].width}px` : '100%';
const handleHeight = RESIZE_HANDLE_DIMENSIONS[this.resizeDirection].height ?
`${RESIZE_HANDLE_DIMENSIONS[this.resizeDirection].height}px` : '100%';
this.renderer.setStyle(element, 'width', handleWidth);
this.renderer.setStyle(element, 'height', handleHeight);
if (this.resizeDirection === 'ew') {
this.setHorizontalPosition(element);
}
else if (this.resizeDirection === 'ns') {
this.setBottom(element);
}
else {
this.setHorizontalPosition(element);
this.setBottom(element);
}
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TileLayoutResizeHandleDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TileLayoutResizeHandleDirective, isStandalone: true, selector: "[kendoTileLayoutResizeHandle]", inputs: { resizeDirection: "resizeDirection", rtl: "rtl" }, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TileLayoutResizeHandleDirective, decorators: [{
type: Directive,
args: [{
selector: '[kendoTileLayoutResizeHandle]',
standalone: true
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { resizeDirection: [{
type: Input
}], rtl: [{
type: Input
}] } });