import * as i0 from '@angular/core'; import { OnInit, OnDestroy, EventEmitter, AfterViewInit, ElementRef } from '@angular/core'; interface Boundary { top: number; left: number; bottom: number; right: number; } /** * The directive is used to work with boundary area for HTML element * * @author Dmytro Parfenov * * @internal * * @dynamic * @see https://angular.io/guide/angular-compiler-options#strictmetadataemit */ declare class BoundaryDirective { private readonly windowObject; private readonly documentObject; /** * CSS selector or HTML element */ protected boundary: string | HTMLElement | Window | null; /** * Get boundary position based on {@link boundary} */ protected getBoundary(): Boundary | null; /** * Resolves HTML element based on {@link boundary} */ protected resolveBoundaryElement(): Element | Window | null; /** * Returns positional value based on boundary position */ protected basedOnBoundary(value: number, position: 'left' | 'top'): number; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } type PositionStrategy = 'relative' | 'free'; type Axis = 'x' | 'y' | null; interface NgxDrag extends Boundary { nativeEvent?: Event; } /** * The directive that allows to drag HTML element on page * * @author Dmytro Parfenov * * @dynamic * @see https://angular.io/guide/angular-compiler-options#strictmetadataemit */ declare class NgxDragDirective extends BoundaryDirective implements OnInit, OnDestroy { private readonly elementRef; private readonly renderer; private readonly dragService; private readonly window; private readonly platformId; /** * Initial size and position of host element */ private hostElementRectInitial; /** * Emits when directive was destroyed */ private destroy$; /** * Emits when observable target was changed */ private observableTargetChange$; /** * Define positioning strategy. * * 'free' - position will change by 'transform: translate3d()' style * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/translate3d * * 'relative' - position will change by 'top' and 'left' style * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position * * Default is 'free'. */ ngxDragPositionStrategy: PositionStrategy; /** * Locks axis for the dragging */ ngxDragLockAxis: Axis; /** * Disable any drag events */ ngxDragDisabled: boolean; /** * Constrain for the dragging element. * Can be as a HTMLElement or CSS selector. * You can put 'window' string to define window object as a constraint. */ set ngxDragBoundary(boundary: string | HTMLElement); /** * Emits changes when element was dragged */ ngxDragged: EventEmitter; /** * @inheritDoc */ ngOnInit(): void; /** * @inheritDoc */ ngOnDestroy(): void; /** * Observe the element dragging which will be as handle for dragging */ observe(target?: HTMLElement): void; /** * Update size and position of host element */ private updateInitialRect; /** * Starts the calculation of drag event and changes host position */ private onDrag; /** * Updates the host style */ private updateHostStyle; /** * Emits drag event to the {@link ngxDragged} */ private emitDrag; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * The directive that allows to mark HTML element as handle of dragging element for {@link NgxDragDirective} * * @author Dmytro Parfenov * * @dynamic * @see https://angular.io/guide/angular-compiler-options#strictmetadataemit */ declare class NgxDragHandleDirective implements AfterViewInit, OnDestroy { private readonly elementRef; private readonly dragDirective; private readonly platformId; /** * @inheritDoc */ ngAfterViewInit(): void; /** * @inheritDoc */ ngOnDestroy(): void; /** * Sets host element as observable point for {@link NgxDragDirective} */ private observe; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } type PositionType = 'fixed' | 'absolute'; interface NgxResize extends Boundary { nativeEvent?: Event; } /** * The directive that allows to resize HTML element on page * * @author Dmytro Parfenov * * @dynamic * @see https://angular.io/guide/angular-compiler-options#strictmetadataemit */ declare class NgxResizeDirective extends BoundaryDirective implements AfterViewInit, OnDestroy { readonly elementRef: ElementRef; private readonly renderer; private readonly dragService; private readonly window; private readonly platformId; /** * Emits when directive was destroyed */ private destroy$; /** * Emits next every time when behavior for wheel event was changed */ private wheelBehaviourChange$; /** * Emits next every time when behavior for touches event was changed */ private touchBehaviourChange$; /** * An array of observers for the resizable element */ private observers; /** * A regular expression for keyboard code */ private wheelInitiatorRegExp; /** * Make a resize unavailable by wheel */ private isWheelDisabled; /** * Make a resize unavailable by touches */ private isTouchesDisabled; /** * Minimal width in px */ ngxResizeMinWidth: number; /** * Minimal height in px */ ngxResizeMinHeight: number; /** * Aspect ratio the element will use during resize * * @example * 16/9 - 9/16 * 100 = 56.25 * 1/1 - 1/1 * 100 = 100 */ ngxResizeAspectRatio: number; /** * Disables any resize events */ ngxResizeDisabled: boolean; /** * Locks axis for the resize */ ngxResizeLockAxis: Axis; /** * Constrain of the resizing area. * Can be as a HTMLElement or CSS selector. * You can put 'window' string to define window object as a constraint. */ set ngxResizeBoundary(boundary: string | HTMLElement); /** * A regular expression that matches with keyboard key code. * When value is provided the element can be scaled by 'Key + wheel'. * If value not provided the element can be scaled just by 'wheel'. * * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code */ set ngxResizeWheelInitiatorRegExp(pattern: RegExp | string); /** * Disables resize by wheel. * By default, is 'false'. */ set ngxResizeWheelDisabled(disabled: boolean); /** * Enables inversion for wheel event */ ngxResizeWheelInverse: boolean; /** * Disables resize by touches. * By default, is 'false'. * Resizing works by using two fingers. */ set ngxResizeTouchesDisabled(disabled: boolean); /** * Position CSS style. Allows 'absolute' and 'fixed'. Default is 'absolute'. * Will be applied to host element. * * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position */ ngxResizePosition: PositionType; /** * Emits changes when element was resized */ ngxResized: EventEmitter; /** * @inheritDoc */ ngAfterViewInit(): void; /** * @inheritDoc */ ngOnDestroy(): void; /** * Unsubscribe from the element dragging and remove it from an array of observable objects */ unsubscribe(target: HTMLElement): void; /** * Observe the element dragging which will be as handle for resize */ observe(target: HTMLElement): void; /** * Starts the subscription for touch events */ private subscribeForTouchEvents; /** * Returns distance between two touches */ private touchesDistance; /** * Make a subscription for wheel events */ private subscribeForWheelEvent; /** * Runs initial resize for the host element */ private initialResize; /** * Starts the calculation of scale event and changes host size */ private onScale; /** * Check whether is resize is available for current initiator type */ private canResize; /** * Starts the calculation of resize event and changes host size */ private onResize; private topLeftMovement; private topRightMovement; private bottomRightMovement; private bottomLeftMovement; private topMovement; private rightMovement; private bottomMovement; private leftMovement; /** * Get position and size of width */ private getWidthProportions; /** * Get position and size of height */ private getHeightProportions; /** * Get width based on {@link ngxResizeAspectRatio} from height */ private fromHeightProportion; /** * Get height based on {@link ngxResizeAspectRatio} from width */ private fromWidthProportion; /** * Updates host element style */ private updateHostStyle; /** * Resolves the type of handle HTML element */ private resolveInitiatorType; /** * Emits resize event to the {@link ngxResized} */ private emitResize; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare enum NgxResizeHandleType { TopLeft = "top-left", Top = "top", TopRight = "top-right", Right = "right", BottomRight = "bottom-right", Bottom = "bottom", BottomLeft = "bottom-left", Left = "left" } /** * The directive that allows to mark HTML element as one of handle of resizing element for {@link NgxResizeDirective} * * @author Dmytro Parfenov * * @dynamic * @see https://angular.io/guide/angular-compiler-options#strictmetadataemit */ declare class NgxResizeHandleDirective implements AfterViewInit, OnDestroy { private readonly elementRef; private readonly platformId; private readonly resizeDirective; /** * Sets the attribute which define the side the HTML element will affect during drag */ type: NgxResizeHandleType | null; /** * @inheritDoc */ ngAfterViewInit(): void; /** * @inheritDoc */ ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } export { NgxDragDirective, NgxDragHandleDirective, NgxResizeDirective, NgxResizeHandleDirective, NgxResizeHandleType }; export type { NgxDrag, NgxResize };