UNPKG

@progress/kendo-angular-treeview

Version:
78 lines (77 loc) 3.44 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { DropPosition, DropAction, ScrollDirection } from './models'; import { TreeItemLookup, ItemLookup } from '../treeitem-lookup.interface'; import { TreeViewComponent } from '../treeview.component'; /** * @hidden * * Gets the offset of the parent element if the latter has the `transform` CSS prop applied. * Transformed parents create new stacking context and the `fixed` children must be position based on the transformed parent. * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context * * If no parent container is `transform`-ed the function will return `{ left: 0, top: 0 }`; */ export declare const getContainerOffset: (element: HTMLElement) => { top: number; left: number; }; /** * @hidden */ export declare const getDropAction: (dropPosition: DropPosition, dropTarget: HTMLElement) => DropAction; /** * @hidden */ export declare const getDropPosition: (draggedItem: HTMLElement, target: HTMLElement, clientY: number, targetTreeView: any, containerOffset: { top: number; left: number; }) => DropPosition; /** * @hidden */ export declare const treeItemFromEventTarget: (treeView: TreeViewComponent, dropTarget: Element) => TreeItemLookup; /** * @hidden * * Emits `collapse` on the specified TreeView node if the latter is left empty after its last child node was dragged out. */ export declare const collapseEmptyParent: (parent: ItemLookup, parentNodes: any[], treeview: TreeViewComponent) => void; /** * @hidden * * Expands the node if it's dropped into and it's not yet expanded. */ export declare const expandDropTarget: (dropTarget: TreeItemLookup, treeView: TreeViewComponent) => void; /** * @hidden * * Extracts the event target from the viewport coords. Required for touch devices * where the `event.target` of a `pointermove` event is always the initially dragged item. */ export declare const getDropTarget: (event: PointerEvent) => HTMLElement; /** * @hidden * * Checks if the original index is before the new one and corrects the new one by decrementing the index for the level, where the original item stood. */ export declare const updateMovedItemIndex: (newIndex: string, originalIndex: string) => string; /** * @hidden * * Retrives the first scrollable element starting the search from the provided one, traversing to the top of the DOM tree. */ export declare const getScrollableContainer: (node: any) => HTMLElement; /** * @hidden * * Scrolls the element in the given direction by the provided step. * * If the targeted scroll incrementation doesn't yield any result due to device pixel ratio issues (https://github.com/dimitar-pechev/RenderingIndependentScrollOffsets#readme), * increments the step with 1px and again attempts to change the scrollTop of the element, until the content is actually scrolled. * * Cuts the operation short after 20 unsuccessful attempts to prevent infinite loops in possible corner-case scenarios. */ export declare const scrollElementBy: (element: Element, step: number, direction: ScrollDirection) => void;