import { DSLNode } from '@lingxiteam/dsl/es/core/PropType'; import { Direction, VirtualBox, AlignType } from './type'; export default class BaseOffsetUtils { /** * 更新customStyle * @param style 更新customStyle * @param node */ static updateCustomStyle(style: any, node: DSLNode): void; getBoundingClientRect(target: HTMLElement): DOMRect; getInnerOffset(outerTarget: HTMLElement, innerTarget: HTMLElement | VirtualBox): VirtualBox; resizeInnerOffset(outerTarget: HTMLElement, innerTarget: HTMLElement): void; copyTargetSize(source: HTMLElement, target: HTMLElement): void; /** * 重置尺寸 */ resetSize(target: HTMLElement, size?: { width: number; height: number; }): this; /** * 重置位置 */ resetPosition(target: HTMLElement, offset?: { left?: number; top: number; right?: number; }): this; /** * 清空样式 */ clearStyle(target: HTMLElement): this; /** * 获取横、纵两轴重叠元素 * @param source 源对象 * @param otherList 比对列表 * @returns */ private collectDirectionTargets; /** * 根据方向定位到最近的元素 * @param direction 方向 * @param targets 查找对象集 * @returns */ private findDirectionTarget; /** * 查找就近方位的元素 * @param source * @param otherList * @returns */ findAroundTargets(source: HTMLElement, otherList: HTMLElement[], containerTarget: HTMLElement): { top?: HTMLElement; left?: HTMLElement; right?: HTMLElement; bottom?: HTMLElement; }; private getCenterPoint; /** * 获取虚拟容器,描述两个容器之间重叠部分 * @param source 源目标 * @param target 距离目标 * @param direction 方向 */ getVirtualBox(source: HTMLElement, target: HTMLElement, direction: Direction): VirtualBox; private getSpace; arrangeTargets(type: 'horizontal' | 'vertical', targets: HTMLElement[], containerTarget: HTMLElement): void; /** * 根据对齐方式重新排列对齐元素 * @param alignType 对齐方式 * @param baseTarget 基准元素 * @param otherTargets 对齐元素 */ alignTargetsByType(alignType: AlignType, baseTarget: HTMLElement, otherTargets: HTMLElement[], containerTarget: HTMLElement): void; /** * 根据多个控件获取包裹控件坐标 * @param targets 子控件 */ getGroupContainer(targets: HTMLElement[], containerTarget?: HTMLElement): { left: number; top: number; width: number; height: number; }; getPixelPosition(target: HTMLElement): { left?: number; top: number; right?: number; }; /** * 矫正元素位置 * @param target 设置位置的元素 * @param hoverTarget 参照元素 */ resizePosition(target: HTMLElement, hoverTarget: HTMLElement, node?: DSLNode): void; }