import BaseOffsetUtils from './BaseOffsetUtils'; import { DSLQuery } from '@lingxiteam/dsl'; import LocalDragUtils from './LocalDragUtils'; import FreeLayoutDragUtils from './FreeLayoutDragUtils'; import { AlignType, Direction } from './type'; import type { CompCreatorType } from '@lingxiteam/editor-types'; import { DSLNode } from '@lingxiteam/dsl/es/core/PropType'; export interface MultiSelectUtilsProps { DSLCore: DSLQuery; pageZoneContainerId: string; localDragInst: LocalDragUtils; freeLayoutInst: FreeLayoutDragUtils; compCreators(): CompCreatorType; } /** * 多选效果 */ export declare const multiSelectEffect: string; /** * 距离标线 */ export declare const distanceLineEffect: string; /** * 参照对象样式 */ export declare const referTargetEffect: string; /** * 多选操作 */ export default class MultiSelectUtils { DSLCore: DSLQuery; compCreators: () => CompCreatorType; private pageZoneContainerId; /** * Map key => nodeId * Map value => source: 画布上控件dom effect: 选中效果dom */ selectTargets: Map; /** * 当前操作的自由布局 */ currentFreeLayoutId?: string; baseOffsetInst: BaseOffsetUtils; localDragInst: LocalDragUtils; freeLayoutInst: FreeLayoutDragUtils; /** * 距离标线集合 */ distanceMap: Map; constructor(props: MultiSelectUtilsProps); get firstTargetId(): string | undefined; /** * 画布容器 */ get pageZoneContainer(): HTMLElement; /** * 多选容器 */ get multiContainer(): HTMLElement; /** * 生成选中效果元素 */ private generateEffectTarget; private generateLineTarget; /** * 根据选中元素添加选中效果 * @param target * @returns */ private addSelectEffect; /** * 重置选中效果 * @param id 控件id */ private resetSelectEffect; /** * * @param target * @param id */ private createSelectEffect; /** * 是否允许选中 * 1、必须是自由布局下的子容器 * 2、跟所选的对象父容器为同一个自由布局 */ allowMultiSelect(id: string, selectFlag?: boolean): boolean; /** * 元素跟踪效果 * @param _target */ trackingNode(_target: HTMLElement): void; /** * 多选选中 */ selectNode(e: any): void; /** * 移除多选 */ removeNode(nodeId: string): void; /** * 清空选中效果 */ cleanMultiEffect(): void; /** * 参照就近对象 */ referAroundTarget(target: HTMLElement): void; /** * 添加距离标线 * @param source 源 * @param target 目标 * @param direction 方向 */ addDistanceLine(source: HTMLElement, target: HTMLElement, direction: Direction, targetIsContainer?: boolean): void; /** * 清空距离标线效果 * @param source */ clearDistanceEffect(id?: string): void; clear(): void; /** * 将当前选中的列表位置信息更新到dsl */ updateToDsl(): void; /** * 对齐多选元素 * @param alignType 对齐方式 */ alignTargets(alignType: AlignType): void; private getMultiSelectTargets; /** * 组合 */ mergeComps(): void; /** * 初始设置分组下节点不可拖拽 * @param nodeList 节点列表 */ initVirtualGroupDrag(nodeList: DSLNode[]): void; /** * 取消分组 * @param id 分组id */ dissolutionGroup(id: string): void; /** * 通过方向键移动元素移动元素 * @param e 键盘事件 */ moveTargets(e: any): void; /** * 指定方向移动元素 * @param nodeId 节点id * @param direction 方向 * @param offset 移动偏移量 默认 1 */ private moveTarget; }