@tmagic/stage 1.4.16 → 1.5.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tmagic-stage.js +40 -32
- package/dist/tmagic-stage.umd.cjs +43 -35
- package/package.json +7 -9
- package/src/ActionManager.ts +15 -10
- package/src/DragResizeHelper.ts +28 -17
- package/src/StageCore.ts +4 -2
- package/src/StageDragResize.ts +8 -4
- package/src/StageMultiDragResize.ts +4 -1
- package/src/StageRender.ts +2 -2
- package/src/TargetShadow.ts +3 -3
- package/types/index.d.ts +997 -10
- package/types/ActionManager.d.ts +0 -147
- package/types/DragResizeHelper.d.ts +0 -71
- package/types/MoveableActionsAble.d.ts +0 -9
- package/types/MoveableOptionsManager.d.ts +0 -86
- package/types/Rule.d.ts +0 -36
- package/types/StageCore.d.ts +0 -114
- package/types/StageDragResize.d.ts +0 -49
- package/types/StageHighlight.d.ts +0 -25
- package/types/StageMask.d.ts +0 -89
- package/types/StageMultiDragResize.d.ts +0 -40
- package/types/StageRender.d.ts +0 -53
- package/types/TargetShadow.d.ts +0 -22
- package/types/const.d.ts +0 -78
- package/types/logger.d.ts +0 -5
- package/types/types.d.ts +0 -252
- package/types/util.d.ts +0 -42
package/types/StageRender.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { Id } from '@tmagic/schema';
|
|
3
|
-
import type { Point, RemoveData, RenderEvents, Runtime, RuntimeWindow, StageRenderConfig, UpdateData } from './types';
|
|
4
|
-
export default class StageRender extends EventEmitter {
|
|
5
|
-
/** 组件的js、css执行的环境,直接渲染为当前window,iframe渲染则为iframe.contentWindow */
|
|
6
|
-
contentWindow: RuntimeWindow | null;
|
|
7
|
-
runtime: Runtime | null;
|
|
8
|
-
iframe?: HTMLIFrameElement;
|
|
9
|
-
nativeContainer?: HTMLDivElement;
|
|
10
|
-
private runtimeUrl?;
|
|
11
|
-
private zoom;
|
|
12
|
-
private renderType;
|
|
13
|
-
private customizedRender?;
|
|
14
|
-
constructor({ runtimeUrl, zoom, customizedRender, renderType }: StageRenderConfig);
|
|
15
|
-
getMagicApi: () => {
|
|
16
|
-
onPageElUpdate: (el: HTMLElement) => boolean;
|
|
17
|
-
onRuntimeReady: (runtime: Runtime) => void;
|
|
18
|
-
};
|
|
19
|
-
add(data: UpdateData): Promise<void>;
|
|
20
|
-
remove(data: RemoveData): Promise<void>;
|
|
21
|
-
update(data: UpdateData): Promise<void>;
|
|
22
|
-
select(ids: Id[]): Promise<void>;
|
|
23
|
-
setZoom(zoom?: number): void;
|
|
24
|
-
/**
|
|
25
|
-
* 挂载Dom节点
|
|
26
|
-
* @param el 将页面挂载到该Dom节点上
|
|
27
|
-
*/
|
|
28
|
-
mount(el: HTMLDivElement): Promise<void>;
|
|
29
|
-
getRuntime: () => Promise<Runtime>;
|
|
30
|
-
getDocument(): Document | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* 通过坐标获得坐标下所有HTML元素数组
|
|
33
|
-
* @param point 坐标
|
|
34
|
-
* @returns 坐标下方所有HTML元素数组,会包含父元素直至html,元素层叠时返回顺序是从上到下
|
|
35
|
-
*/
|
|
36
|
-
getElementsFromPoint(point: Point): HTMLElement[];
|
|
37
|
-
getTargetElement(id: Id): HTMLElement | null;
|
|
38
|
-
/**
|
|
39
|
-
* 销毁实例
|
|
40
|
-
*/
|
|
41
|
-
destroy(): void;
|
|
42
|
-
on<Name extends keyof RenderEvents, Param extends RenderEvents[Name]>(eventName: Name, listener: (...args: Param) => void | Promise<void>): this;
|
|
43
|
-
emit<Name extends keyof RenderEvents, Param extends RenderEvents[Name]>(eventName: Name, ...args: Param): boolean;
|
|
44
|
-
private createIframe;
|
|
45
|
-
private createNativeContainer;
|
|
46
|
-
/**
|
|
47
|
-
* 在runtime中对被选中的元素进行标记,部分组件有对选中态进行特殊显示的需求
|
|
48
|
-
* @param el 被选中的元素
|
|
49
|
-
*/
|
|
50
|
-
private flagSelectedEl;
|
|
51
|
-
private iframeLoadHandler;
|
|
52
|
-
private postTmagicRuntimeReady;
|
|
53
|
-
}
|
package/types/TargetShadow.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { TargetElement as ShadowElement, TargetShadowConfig } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* 将选中的节点修正定位后,添加一个操作节点到蒙层上
|
|
4
|
-
*/
|
|
5
|
-
export default class TargetShadow {
|
|
6
|
-
el?: ShadowElement;
|
|
7
|
-
els: ShadowElement[];
|
|
8
|
-
private idPrefix;
|
|
9
|
-
private container;
|
|
10
|
-
private scrollLeft;
|
|
11
|
-
private scrollTop;
|
|
12
|
-
private zIndex?;
|
|
13
|
-
private updateDragEl?;
|
|
14
|
-
constructor(config: TargetShadowConfig);
|
|
15
|
-
update(target: ShadowElement): ShadowElement;
|
|
16
|
-
updateGroup(targetGroup: ShadowElement[]): ShadowElement[];
|
|
17
|
-
destroyEl(): void;
|
|
18
|
-
destroyEls(): void;
|
|
19
|
-
destroy(): void;
|
|
20
|
-
private updateEl;
|
|
21
|
-
private scrollHandler;
|
|
22
|
-
}
|
package/types/const.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/** 流式布局下拖动时需要clone一个镜像节点,镜像节点的id前缀 */
|
|
2
|
-
export declare const GHOST_EL_ID_PREFIX = "ghost_el_";
|
|
3
|
-
/** 拖动的时候需要在蒙层中创建一个占位节点,该节点的id前缀 */
|
|
4
|
-
export declare const DRAG_EL_ID_PREFIX = "drag_el_";
|
|
5
|
-
/** 高亮时需要在蒙层中创建一个占位节点,该节点的id前缀 */
|
|
6
|
-
export declare const HIGHLIGHT_EL_ID_PREFIX = "highlight_el_";
|
|
7
|
-
export declare const CONTAINER_HIGHLIGHT_CLASS_NAME = "tmagic-stage-container-highlight";
|
|
8
|
-
export declare const PAGE_CLASS = "magic-ui-page";
|
|
9
|
-
/** 默认放到缩小倍数 */
|
|
10
|
-
export declare const DEFAULT_ZOOM = 1;
|
|
11
|
-
/** 参考线类型 */
|
|
12
|
-
export declare enum GuidesType {
|
|
13
|
-
/** 水平 */
|
|
14
|
-
HORIZONTAL = "horizontal",
|
|
15
|
-
/** 垂直 */
|
|
16
|
-
VERTICAL = "vertical"
|
|
17
|
-
}
|
|
18
|
-
/** css z-index */
|
|
19
|
-
export declare enum ZIndex {
|
|
20
|
-
/** 蒙层,用于监听用户操作,需要置于顶层 */
|
|
21
|
-
MASK = "99999",
|
|
22
|
-
/** 选中的节点 */
|
|
23
|
-
SELECTED_EL = "666",
|
|
24
|
-
GHOST_EL = "700",
|
|
25
|
-
DRAG_EL = "9",
|
|
26
|
-
HIGHLIGHT_EL = "8"
|
|
27
|
-
}
|
|
28
|
-
/** 鼠标按键 */
|
|
29
|
-
export declare enum MouseButton {
|
|
30
|
-
/** 左键 */
|
|
31
|
-
LEFT = 0,
|
|
32
|
-
/** z中健 */
|
|
33
|
-
MIDDLE = 1,
|
|
34
|
-
/** 右键 */
|
|
35
|
-
RIGHT = 2
|
|
36
|
-
}
|
|
37
|
-
/** 布局方式 */
|
|
38
|
-
export declare enum Mode {
|
|
39
|
-
/** 绝对定位布局 */
|
|
40
|
-
ABSOLUTE = "absolute",
|
|
41
|
-
/** 固定定位布局 */
|
|
42
|
-
FIXED = "fixed",
|
|
43
|
-
/** 流式布局 */
|
|
44
|
-
SORTABLE = "sortable"
|
|
45
|
-
}
|
|
46
|
-
/** 选中节点的class name */
|
|
47
|
-
export declare const SELECTED_CLASS = "tmagic-stage-selected-area";
|
|
48
|
-
export declare enum AbleActionEventType {
|
|
49
|
-
SELECT_PARENT = "select-parent",
|
|
50
|
-
REMOVE = "remove"
|
|
51
|
-
}
|
|
52
|
-
/** 将组件添加到容器的方式 */
|
|
53
|
-
export declare enum ContainerHighlightType {
|
|
54
|
-
/** 默认方式:组件在容器上方悬停一段时间后加入 */
|
|
55
|
-
DEFAULT = "default",
|
|
56
|
-
/** 按住alt键,并在容器上方悬停一段时间后加入 */
|
|
57
|
-
ALT = "alt"
|
|
58
|
-
}
|
|
59
|
-
export declare enum RenderType {
|
|
60
|
-
IFRAME = "iframe",
|
|
61
|
-
NATIVE = "native"
|
|
62
|
-
}
|
|
63
|
-
/** 选择状态 */
|
|
64
|
-
export declare enum SelectStatus {
|
|
65
|
-
/** 单选 */
|
|
66
|
-
SELECT = "select",
|
|
67
|
-
/** 多选 */
|
|
68
|
-
MULTI_SELECT = "multiSelect"
|
|
69
|
-
}
|
|
70
|
-
/** 拖动状态 */
|
|
71
|
-
export declare enum StageDragStatus {
|
|
72
|
-
/** 开始拖动 */
|
|
73
|
-
START = "start",
|
|
74
|
-
/** 拖动中 */
|
|
75
|
-
ING = "ing",
|
|
76
|
-
/** 拖动结束 */
|
|
77
|
-
END = "end"
|
|
78
|
-
}
|
package/types/logger.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const log: (...args: any[]) => void;
|
|
2
|
-
export declare const info: (...args: any[]) => void;
|
|
3
|
-
export declare const warn: (...args: any[]) => void;
|
|
4
|
-
export declare const debug: (...args: any[]) => void;
|
|
5
|
-
export declare const error: (...args: any[]) => void;
|
package/types/types.d.ts
DELETED
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import type { GuidesOptions } from '@scena/guides';
|
|
2
|
-
import type { MoveableOptions, OnDragStart } from 'moveable';
|
|
3
|
-
import Core from '@tmagic/core';
|
|
4
|
-
import type { Id, MApp, MContainer, MNode } from '@tmagic/schema';
|
|
5
|
-
import { AbleActionEventType, ContainerHighlightType, GuidesType, RenderType, ZIndex } from './const';
|
|
6
|
-
import DragResizeHelper from './DragResizeHelper';
|
|
7
|
-
import StageCore from './StageCore';
|
|
8
|
-
export type TargetElement = HTMLElement | SVGElement;
|
|
9
|
-
export type CanSelect = (el: HTMLElement, event: MouseEvent, stop: () => boolean) => boolean | Promise<boolean>;
|
|
10
|
-
export type IsContainer = (el: HTMLElement) => boolean | Promise<boolean>;
|
|
11
|
-
export type CustomizeRender = (renderer: StageCore) => Promise<HTMLElement> | HTMLElement;
|
|
12
|
-
/** 业务方自定义的moveableOptions,可以是配置,也可以是回调函数 */
|
|
13
|
-
export type CustomizeMoveableOptions = ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions) | MoveableOptions | undefined;
|
|
14
|
-
/** render提供给的接口,id转成el */
|
|
15
|
-
export type GetTargetElement = (id: Id) => HTMLElement | null;
|
|
16
|
-
/** render提供的接口,通过坐标获得坐标下所有HTML元素数组 */
|
|
17
|
-
export type GetElementsFromPoint = (point: Point) => HTMLElement[];
|
|
18
|
-
export type GetRenderDocument = () => Document | undefined;
|
|
19
|
-
export type DelayedMarkContainer = (event: MouseEvent, exclude: Element[]) => NodeJS.Timeout | undefined;
|
|
20
|
-
export type MarkContainerEnd = () => HTMLElement | null;
|
|
21
|
-
export type GetRootContainer = () => HTMLDivElement | undefined;
|
|
22
|
-
export type UpdateDragEl = (el: TargetElement, target: TargetElement, container: HTMLElement) => void;
|
|
23
|
-
export interface StageCoreConfig {
|
|
24
|
-
/** 需要对齐的dom节点的CSS选择器字符串 */
|
|
25
|
-
snapElementQuerySelector?: string;
|
|
26
|
-
/** 放大倍数,默认1倍 */
|
|
27
|
-
zoom?: number;
|
|
28
|
-
canSelect?: CanSelect;
|
|
29
|
-
isContainer?: IsContainer;
|
|
30
|
-
containerHighlightClassName?: string;
|
|
31
|
-
containerHighlightDuration?: number;
|
|
32
|
-
containerHighlightType?: ContainerHighlightType;
|
|
33
|
-
moveableOptions?: CustomizeMoveableOptions;
|
|
34
|
-
/** runtime 的HTML地址,可以是一个HTTP地址,如果和编辑器不同域,需要设置跨域,也可以是一个相对或绝对路径 */
|
|
35
|
-
runtimeUrl?: string;
|
|
36
|
-
render?: (renderer: StageCore) => Promise<HTMLElement> | HTMLElement;
|
|
37
|
-
autoScrollIntoView?: boolean;
|
|
38
|
-
updateDragEl?: UpdateDragEl;
|
|
39
|
-
disabledDragStart?: boolean;
|
|
40
|
-
renderType?: RenderType;
|
|
41
|
-
guidesOptions?: Partial<GuidesOptions>;
|
|
42
|
-
disabledMultiSelect?: boolean;
|
|
43
|
-
}
|
|
44
|
-
export interface ActionManagerConfig {
|
|
45
|
-
container: HTMLElement;
|
|
46
|
-
containerHighlightClassName?: string;
|
|
47
|
-
containerHighlightDuration?: number;
|
|
48
|
-
containerHighlightType?: ContainerHighlightType;
|
|
49
|
-
moveableOptions?: CustomizeMoveableOptions;
|
|
50
|
-
disabledDragStart?: boolean;
|
|
51
|
-
disabledMultiSelect?: boolean;
|
|
52
|
-
canSelect?: CanSelect;
|
|
53
|
-
isContainer?: IsContainer;
|
|
54
|
-
getRootContainer: GetRootContainer;
|
|
55
|
-
getRenderDocument: GetRenderDocument;
|
|
56
|
-
updateDragEl?: UpdateDragEl;
|
|
57
|
-
getTargetElement: GetTargetElement;
|
|
58
|
-
getElementsFromPoint: GetElementsFromPoint;
|
|
59
|
-
}
|
|
60
|
-
export interface MoveableOptionsManagerConfig {
|
|
61
|
-
container: HTMLElement;
|
|
62
|
-
moveableOptions?: CustomizeMoveableOptions;
|
|
63
|
-
getRootContainer: GetRootContainer;
|
|
64
|
-
}
|
|
65
|
-
export interface CustomizeMoveableOptionsCallbackConfig {
|
|
66
|
-
targetEl: HTMLElement | null;
|
|
67
|
-
targetElId?: string;
|
|
68
|
-
targetEls?: HTMLElement[];
|
|
69
|
-
targetElIds?: string[];
|
|
70
|
-
isMulti: boolean;
|
|
71
|
-
document?: Document;
|
|
72
|
-
}
|
|
73
|
-
export interface StageRenderConfig {
|
|
74
|
-
runtimeUrl?: string;
|
|
75
|
-
zoom: number | undefined;
|
|
76
|
-
renderType?: RenderType;
|
|
77
|
-
customizedRender?: () => Promise<HTMLElement | null>;
|
|
78
|
-
}
|
|
79
|
-
export interface StageMaskConfig {
|
|
80
|
-
core: StageCore;
|
|
81
|
-
}
|
|
82
|
-
export interface StageDragResizeConfig {
|
|
83
|
-
container: HTMLElement;
|
|
84
|
-
dragResizeHelper: DragResizeHelper;
|
|
85
|
-
moveableOptions?: CustomizeMoveableOptions;
|
|
86
|
-
disabledDragStart?: boolean;
|
|
87
|
-
getRootContainer: GetRootContainer;
|
|
88
|
-
getRenderDocument: GetRenderDocument;
|
|
89
|
-
markContainerEnd: MarkContainerEnd;
|
|
90
|
-
delayedMarkContainer: DelayedMarkContainer;
|
|
91
|
-
}
|
|
92
|
-
export interface StageMultiDragResizeConfig {
|
|
93
|
-
container: HTMLElement;
|
|
94
|
-
dragResizeHelper: DragResizeHelper;
|
|
95
|
-
moveableOptions?: CustomizeMoveableOptions;
|
|
96
|
-
getRootContainer: GetRootContainer;
|
|
97
|
-
getRenderDocument: GetRenderDocument;
|
|
98
|
-
markContainerEnd: MarkContainerEnd;
|
|
99
|
-
delayedMarkContainer: DelayedMarkContainer;
|
|
100
|
-
}
|
|
101
|
-
export interface DragResizeHelperConfig {
|
|
102
|
-
container: HTMLElement;
|
|
103
|
-
updateDragEl?: UpdateDragEl;
|
|
104
|
-
}
|
|
105
|
-
export type Rect = {
|
|
106
|
-
width: number;
|
|
107
|
-
height: number;
|
|
108
|
-
} & Offset;
|
|
109
|
-
export interface Offset {
|
|
110
|
-
left: number;
|
|
111
|
-
top: number;
|
|
112
|
-
}
|
|
113
|
-
export interface Point {
|
|
114
|
-
clientX: number;
|
|
115
|
-
clientY: number;
|
|
116
|
-
}
|
|
117
|
-
export interface GuidesEventData {
|
|
118
|
-
type: GuidesType;
|
|
119
|
-
guides: number[];
|
|
120
|
-
}
|
|
121
|
-
export interface UpdateEventData {
|
|
122
|
-
data: {
|
|
123
|
-
el: HTMLElement;
|
|
124
|
-
style: {
|
|
125
|
-
width?: number;
|
|
126
|
-
height?: number;
|
|
127
|
-
left?: number;
|
|
128
|
-
top?: number;
|
|
129
|
-
transform?: {
|
|
130
|
-
rotate?: string;
|
|
131
|
-
scale?: string;
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
ghostEl?: HTMLElement;
|
|
135
|
-
}[];
|
|
136
|
-
parentEl: HTMLElement | null;
|
|
137
|
-
}
|
|
138
|
-
export interface RemoveEventData {
|
|
139
|
-
data: {
|
|
140
|
-
el: HTMLElement;
|
|
141
|
-
}[];
|
|
142
|
-
}
|
|
143
|
-
export interface SortEventData {
|
|
144
|
-
src: Id;
|
|
145
|
-
dist: Id;
|
|
146
|
-
root?: MApp;
|
|
147
|
-
}
|
|
148
|
-
export interface UpdateData {
|
|
149
|
-
config: MNode;
|
|
150
|
-
parent?: MContainer;
|
|
151
|
-
parentId?: Id;
|
|
152
|
-
root: MApp;
|
|
153
|
-
}
|
|
154
|
-
export interface RemoveData {
|
|
155
|
-
id: Id;
|
|
156
|
-
parentId: Id;
|
|
157
|
-
root: MApp;
|
|
158
|
-
}
|
|
159
|
-
export interface Runtime {
|
|
160
|
-
getApp?: () => Core | undefined;
|
|
161
|
-
updateRootConfig?: (config: MApp) => void;
|
|
162
|
-
updatePageId?: (id: Id) => void;
|
|
163
|
-
select?: (id: Id) => Promise<HTMLElement> | HTMLElement;
|
|
164
|
-
add?: (data: UpdateData) => void;
|
|
165
|
-
update?: (data: UpdateData) => void;
|
|
166
|
-
sortNode?: (data: SortEventData) => void;
|
|
167
|
-
remove?: (data: RemoveData) => void;
|
|
168
|
-
}
|
|
169
|
-
export interface Magic {
|
|
170
|
-
/** 当前页面的根节点变化时调用该方法,编辑器会同步该el和stage的大小,该方法由stage注入到iframe.contentWindow中 */
|
|
171
|
-
onPageElUpdate: (el: HTMLElement) => void;
|
|
172
|
-
onRuntimeReady: (runtime: Runtime) => void;
|
|
173
|
-
}
|
|
174
|
-
export interface RuntimeWindow extends Window {
|
|
175
|
-
magic: Magic;
|
|
176
|
-
}
|
|
177
|
-
export interface StageHighlightConfig {
|
|
178
|
-
container: HTMLElement;
|
|
179
|
-
updateDragEl?: UpdateDragEl;
|
|
180
|
-
getRootContainer: GetRootContainer;
|
|
181
|
-
}
|
|
182
|
-
export interface TargetShadowConfig {
|
|
183
|
-
container: HTMLElement;
|
|
184
|
-
zIndex?: ZIndex;
|
|
185
|
-
updateDragEl?: UpdateDragEl;
|
|
186
|
-
idPrefix?: string;
|
|
187
|
-
}
|
|
188
|
-
export interface RuleOptions {
|
|
189
|
-
guidesOptions?: Partial<GuidesOptions>;
|
|
190
|
-
}
|
|
191
|
-
export interface CoreEvents {
|
|
192
|
-
mounted: [];
|
|
193
|
-
'runtime-ready': [runtime: Runtime];
|
|
194
|
-
'page-el-update': [el: HTMLElement];
|
|
195
|
-
'change-guides': [data: GuidesEventData];
|
|
196
|
-
select: [selectedEl: HTMLElement, event: MouseEvent];
|
|
197
|
-
'multi-select': [selectedElList: HTMLElement[], event: MouseEvent];
|
|
198
|
-
dblclick: [event: MouseEvent];
|
|
199
|
-
update: [data: UpdateEventData];
|
|
200
|
-
sort: [data: SortEventData];
|
|
201
|
-
'select-parent': [];
|
|
202
|
-
remove: [data: RemoveEventData];
|
|
203
|
-
highlight: [highlightEl: HTMLElement];
|
|
204
|
-
mousemove: [event: MouseEvent];
|
|
205
|
-
mouseleave: [event: MouseEvent];
|
|
206
|
-
'drag-start': [event: OnDragStart];
|
|
207
|
-
}
|
|
208
|
-
export interface RenderEvents {
|
|
209
|
-
onload: [];
|
|
210
|
-
'page-el-update': [el: HTMLElement];
|
|
211
|
-
'runtime-ready': [runtime: Runtime];
|
|
212
|
-
}
|
|
213
|
-
export interface MaskEvents {
|
|
214
|
-
scroll: [event: WheelEvent];
|
|
215
|
-
'change-guides': [
|
|
216
|
-
data: {
|
|
217
|
-
type: GuidesType.HORIZONTAL;
|
|
218
|
-
guides: number[];
|
|
219
|
-
}
|
|
220
|
-
];
|
|
221
|
-
}
|
|
222
|
-
export interface ActionManagerEvents {
|
|
223
|
-
dblclick: [event: MouseEvent];
|
|
224
|
-
mousemove: [event: MouseEvent];
|
|
225
|
-
mouseleave: [event: MouseEvent];
|
|
226
|
-
highlight: [el: HTMLElement];
|
|
227
|
-
update: [data: UpdateEventData];
|
|
228
|
-
sort: [data: SortEventData];
|
|
229
|
-
remove: [data: RemoveEventData];
|
|
230
|
-
select: [selectedEl: HTMLElement | null, event: MouseEvent];
|
|
231
|
-
'select-parent': [];
|
|
232
|
-
'drag-start': [event: OnDragStart];
|
|
233
|
-
'multi-update': [data: UpdateEventData];
|
|
234
|
-
'change-to-select': [id: Id, event: MouseEvent];
|
|
235
|
-
'before-multi-select': [selectedElList: HTMLElement[]];
|
|
236
|
-
'before-select': [el: HTMLElement, event: MouseEvent];
|
|
237
|
-
'multi-select': [selectedElList: HTMLElement[], event: MouseEvent];
|
|
238
|
-
'get-elements-from-point': [els: HTMLElement[]];
|
|
239
|
-
}
|
|
240
|
-
export interface DrEvents {
|
|
241
|
-
'update-moveable': [];
|
|
242
|
-
[AbleActionEventType.REMOVE]: [];
|
|
243
|
-
[AbleActionEventType.SELECT_PARENT]: [];
|
|
244
|
-
'drag-start': [event: OnDragStart];
|
|
245
|
-
update: [data: UpdateEventData];
|
|
246
|
-
sort: [data: SortEventData];
|
|
247
|
-
}
|
|
248
|
-
export interface MultiDrEvents {
|
|
249
|
-
'update-moveable': [];
|
|
250
|
-
'change-to-select': [id: Id, event: MouseEvent];
|
|
251
|
-
update: [data: UpdateEventData];
|
|
252
|
-
}
|
package/types/util.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Mode, ZIndex } from './const';
|
|
2
|
-
import type { Offset, SortEventData, TargetElement } from './types';
|
|
3
|
-
export declare const getOffset: (el: Element) => Offset;
|
|
4
|
-
export declare const getTargetElStyle: (el: TargetElement, zIndex?: ZIndex) => string;
|
|
5
|
-
export declare const getAbsolutePosition: (el: HTMLElement, { top, left }: Offset) => {
|
|
6
|
-
left: number;
|
|
7
|
-
top: number;
|
|
8
|
-
};
|
|
9
|
-
export declare const isAbsolute: (style: CSSStyleDeclaration) => boolean;
|
|
10
|
-
export declare const isRelative: (style: CSSStyleDeclaration) => boolean;
|
|
11
|
-
export declare const isStatic: (style: CSSStyleDeclaration) => boolean;
|
|
12
|
-
export declare const isFixed: (style: CSSStyleDeclaration) => boolean;
|
|
13
|
-
export declare const isFixedParent: (el: Element) => boolean;
|
|
14
|
-
export declare const getMode: (el: Element) => Mode;
|
|
15
|
-
export declare const getScrollParent: (element: HTMLElement, includeHidden?: boolean) => HTMLElement | null;
|
|
16
|
-
export declare const removeSelectedClassName: (doc: Document) => void;
|
|
17
|
-
export declare const addSelectedClassName: (el: Element, doc: Document) => void;
|
|
18
|
-
/**
|
|
19
|
-
* 下移组件位置
|
|
20
|
-
* @param {number} deltaTop 偏移量
|
|
21
|
-
* @param {Object} detail 当前选中的组件配置
|
|
22
|
-
*/
|
|
23
|
-
export declare const down: (deltaTop: number, target: TargetElement) => SortEventData;
|
|
24
|
-
/**
|
|
25
|
-
* 上移组件位置
|
|
26
|
-
* @param {Array} brothers 处于同一容器下的所有子组件配置
|
|
27
|
-
* @param {number} index 当前组件所处的位置
|
|
28
|
-
* @param {number} deltaTop 偏移量
|
|
29
|
-
* @param {Object} detail 当前选中的组件配置
|
|
30
|
-
*/
|
|
31
|
-
export declare const up: (deltaTop: number, target: TargetElement) => SortEventData;
|
|
32
|
-
export declare const isMoveableButton: (target: Element) => boolean | undefined;
|
|
33
|
-
export declare const getMarginValue: (el: Element) => {
|
|
34
|
-
marginLeft: number;
|
|
35
|
-
marginTop: number;
|
|
36
|
-
};
|
|
37
|
-
export declare const getBorderWidth: (el: Element) => {
|
|
38
|
-
borderLeftWidth: number;
|
|
39
|
-
borderRightWidth: number;
|
|
40
|
-
borderTopWidth: number;
|
|
41
|
-
borderBottomWidth: number;
|
|
42
|
-
};
|