@fe6/water-pro
Version:
An enterprise-class UI design language and Vue-based implementation
46 lines (45 loc) • 2.17 kB
TypeScript
/** @format */
export interface ViewportOffsetResult {
left: number;
top: number;
right: number;
bottom: number;
rightIncludeBody: number;
bottomIncludeBody: number;
}
export declare function getBoundingClientRect(element: Element): DOMRect | number;
export declare function hasClass(el: Element, cls: string): boolean;
export declare function addClass(el: Element, cls: string): void;
export declare function removeClass(el: Element, cls: string): void;
/**
* Get the left and top offset of the current element
* left: the distance between the leftmost element and the left side of the document
* top: the distance from the top of the element to the top of the document
* right: the distance from the far right of the element to the right of the document
* bottom: the distance from the bottom of the element to the bottom of the document
* rightIncludeBody: the distance between the leftmost element and the right side of the document
* bottomIncludeBody: the distance from the bottom of the element to the bottom of the document
*
* @description:
*/
export declare function getViewportOffset(element: Element): ViewportOffsetResult;
export declare function hackCss(attr: string, value: string): any;
export declare function on(element: Element | HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject): void;
export declare function off(element: Element | HTMLElement | Document | Window, event: string, handler: Fn): void;
export declare function once(el: HTMLElement, event: string, fn: EventListener): void;
/**
* triggter window.resize
*/
export declare function triggerWindowResize(): void;
/**
* @description: Set ui mount node
*/
export declare function getPopupContainer(node?: HTMLElement): HTMLElement;
export declare const isServer: boolean;
export declare function addResizeListener(element: any, fn: () => any): void;
export declare function removeResizeListener(element: any, fn: () => any): void;
export declare const getCursortPositionFormTextArea: (ctrl: any) => {
start: number;
end: number;
};
export declare function setCaretPosition(ctrl: any, pos: number): void;