@syncfusion/react-base
Version:
A common package of core React base, methods and class definitions
95 lines (94 loc) • 3.33 kB
TypeScript
import { IPosition } from './draggable';
/**
* Position coordinates
*/
export interface PositionCoordinates {
left?: number;
top?: number;
bottom?: number;
right?: number;
}
/**
* Coordinates for element position
*
* @private
*/
export interface Coordinates {
/**
* Defines the x Coordinate of page.
*/
pageX?: number;
/**
* Defines the y Coordinate of page.
*/
pageY?: number;
/**
* Defines the x Coordinate of client.
*/
clientX?: number;
/**
* Defines the y Coordinate of client.
*/
clientY?: number;
}
/**
* Sets the permitted drag area boundaries based on the defined dragArea.
*
* @private
* @param {HTMLElement | string} dragArea - The element or selector string defining the drag area
* @param {Element} helperElement - The helper element used in dragging
* @param {PositionCoordinates} borderWidth - The border width of the drag area
* @param {PositionCoordinates} padding - The padding of the drag area
* @param {PositionCoordinates} dragLimit - The object to store the calculated drag limits
* @returns {void}
*/
export declare function setDragArea(dragArea: HTMLElement | string, helperElement: Element, borderWidth: PositionCoordinates, padding: PositionCoordinates, dragLimit: PositionCoordinates): void;
/**
* Retrieves the document's full height or width, considering the scroll and offset values.
*
* @private
* @param {string} str - The dimension type ('Height' or 'Width') to calculate.
* @returns {number} - The maximum value across scroll, offset, and client dimensions.
*/
export declare function getDocumentWidthHeight(str: 'Height' | 'Width'): number;
/**
* Determines if a given element is within the bounds of the viewport.
*
* @private
* @param {HTMLElement} el - The element to check.
* @returns {boolean} - True if the element is in the viewport, false otherwise.
*/
export declare function elementInViewport(el: HTMLElement): boolean;
/**
* Gets the coordinates of a mouse or touch event.
*
* @private
* @param {MouseEvent | TouchEvent} evt - The event object.
* @returns {Coordinates} - The x and y coordinates of the page and client.
*/
export declare function getCoordinates(evt: MouseEvent & TouchEvent): Coordinates;
/**
* Calculates the parent position of the element relative to the document.
*
* @private
* @param {Element} ele - The element for which the parent position is calculated.
* @returns {IPosition} - The calculated left and top position.
*/
export declare function calculateParentPosition(ele: Element): IPosition;
/**
* Retrieves all elements from a point defined by event coordinates.
*
* @private
* @param {MouseEvent | TouchEvent} evt - The event object containing coordinates.
* @returns {Element[]} - An array of elements located at the event's point.
*/
export declare function getPathElements(evt: MouseEvent & TouchEvent): Element[];
/**
* Identifies the scrollable parent of the current node element.
*
* @private
* @param {Element[]} nodes - The path of elements to check.
* @param {boolean} reverse - Whether to reverse the array to check from bottom to top.
* @returns {Element | null} - The first scrollable parent element or null.
*/
export declare function getScrollParent(nodes: Element[], reverse: boolean): Element | null;