UNPKG

@progress/kendo-angular-dialog

Version:
75 lines (74 loc) 3.62 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Directive, Host, ElementRef, Input, HostBinding, Renderer2 } from '@angular/core'; import { DraggableDirective } from '@progress/kendo-angular-common'; import { DragResizeService } from './drag-resize.service'; import { Subscription, of, merge } from 'rxjs'; import * as i0 from "@angular/core"; import * as i1 from "@progress/kendo-angular-common"; import * as i2 from "./drag-resize.service"; /** * @hidden */ export class ResizeHandleDirective { draggable; el; renderer; service; direction; get hostClass() { return true; } subscriptions = new Subscription(); constructor(draggable, el, renderer, service) { this.draggable = draggable; this.el = el; this.renderer = renderer; this.service = service; } ngOnInit() { this.setDisplay(); this.renderer.addClass(this.el.nativeElement, 'k-resize-' + this.direction); this.subscriptions.add(of(this.draggable).subscribe(handle => { this.service.onResize(handle, this.direction); })); this.subscriptions.add(this.service.resizeStart.subscribe((dir) => { if (dir !== this.direction) { this.setDisplay('none'); } })); this.subscriptions.add(this.service.dragStart.subscribe(() => { this.setDisplay('none'); })); this.subscriptions.add(merge(this.service.resizeEnd, this.service.dragEnd).subscribe(() => { this.setDisplay('block'); })); this.subscriptions.add(this.service.stateChange.subscribe((state) => { this.setDisplay(state === 'default' ? 'block' : 'none'); })); } ngOnDestroy() { this.subscriptions.unsubscribe(); } setDisplay(value = 'block') { this.renderer.setStyle(this.el.nativeElement, 'display', this.service.options.state === 'default' ? value : 'none'); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ResizeHandleDirective, deps: [{ token: i1.DraggableDirective, host: true }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2.DragResizeService }], target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ResizeHandleDirective, isStandalone: true, selector: "[kendoWindowResizeHandle]", inputs: { direction: "direction" }, host: { properties: { "class.k-resize-handle": "this.hostClass" } }, ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ResizeHandleDirective, decorators: [{ type: Directive, args: [{ selector: '[kendoWindowResizeHandle]', standalone: true }] }], ctorParameters: function () { return [{ type: i1.DraggableDirective, decorators: [{ type: Host }] }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i2.DragResizeService }]; }, propDecorators: { direction: [{ type: Input }], hostClass: [{ type: HostBinding, args: ['class.k-resize-handle'] }] } });