@tmagic/stage 1.7.7 → 1.7.8-beta.2
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/LICENSE +235 -164
- package/dist/es/ActionManager.js +470 -0
- package/dist/es/DragResizeHelper.js +280 -0
- package/dist/es/MoveableActionsAble.js +64 -0
- package/dist/es/MoveableOptionsManager.js +204 -0
- package/dist/es/Rule.js +139 -0
- package/dist/es/StageCore.js +307 -0
- package/dist/es/StageDragResize.js +233 -0
- package/dist/es/StageHighlight.js +62 -0
- package/dist/es/StageMask.js +256 -0
- package/dist/es/StageMultiDragResize.js +153 -0
- package/dist/es/StageRender.js +186 -0
- package/dist/es/TargetShadow.js +68 -0
- package/dist/es/const.js +91 -0
- package/dist/es/index.js +12 -0
- package/dist/es/moveable-able.js +4 -0
- package/dist/es/style.js +4 -0
- package/dist/es/util.js +192 -0
- package/dist/tmagic-stage.umd.cjs +4811 -5308
- package/package.json +5 -4
- package/types/index.d.ts +857 -841
- package/dist/tmagic-stage.js +0 -2833
package/types/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import EventEmitter, { EventEmitter
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
export
|
|
8
|
-
import MoveableHelper from 'moveable-helper';
|
|
1
|
+
import * as _tmagic_editor0 from "@tmagic/editor";
|
|
2
|
+
import EventEmitter$1, { EventEmitter } from "events";
|
|
3
|
+
import { MoveableManagerInterface, MoveableOptions, OnDrag, OnDragGroup, OnDragGroupStart, OnDragStart, OnResize, OnResizeGroup, OnResizeGroupStart, OnResizeStart, OnRotate, OnRotateStart, OnScale, OnScaleStart, Renderer } from "moveable";
|
|
4
|
+
import Core, { Id, MApp, MContainer, MNode } from "@tmagic/core";
|
|
5
|
+
import Guides, { GuidesOptions, GuidesOptions as GuidesOptions$1 } from "@scena/guides";
|
|
6
|
+
import MoveableHelper from "moveable-helper";
|
|
7
|
+
export * from "moveable";
|
|
9
8
|
|
|
9
|
+
//#region temp/packages/stage/src/const.d.ts
|
|
10
10
|
/** 流式布局下拖动时需要clone一个镜像节点,镜像节点的id前缀 */
|
|
11
11
|
declare const GHOST_EL_ID_PREFIX = "ghost_el_";
|
|
12
12
|
/** 拖动的时候需要在蒙层中创建一个占位节点,该节点的id前缀 */
|
|
@@ -19,141 +19,143 @@ declare const PAGE_CLASS = "magic-ui-page";
|
|
|
19
19
|
declare const DEFAULT_ZOOM = 1;
|
|
20
20
|
/** 参考线类型 */
|
|
21
21
|
declare enum GuidesType {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
/** 水平 */
|
|
23
|
+
HORIZONTAL = "horizontal",
|
|
24
|
+
/** 垂直 */
|
|
25
|
+
VERTICAL = "vertical"
|
|
26
26
|
}
|
|
27
27
|
/** css z-index */
|
|
28
28
|
declare enum ZIndex {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
/** 蒙层,用于监听用户操作,需要置于顶层 */
|
|
30
|
+
MASK = "99999",
|
|
31
|
+
/** 选中的节点 */
|
|
32
|
+
SELECTED_EL = "666",
|
|
33
|
+
GHOST_EL = "700",
|
|
34
|
+
DRAG_EL = "9",
|
|
35
|
+
HIGHLIGHT_EL = "8"
|
|
36
36
|
}
|
|
37
37
|
/** 鼠标按键 */
|
|
38
38
|
declare enum MouseButton {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
/** 左键 */
|
|
40
|
+
LEFT = 0,
|
|
41
|
+
/** z中健 */
|
|
42
|
+
MIDDLE = 1,
|
|
43
|
+
/** 右键 */
|
|
44
|
+
RIGHT = 2
|
|
45
45
|
}
|
|
46
46
|
/** 布局方式 */
|
|
47
47
|
declare enum Mode {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
/** 绝对定位布局 */
|
|
49
|
+
ABSOLUTE = "absolute",
|
|
50
|
+
/** 固定定位布局 */
|
|
51
|
+
FIXED = "fixed",
|
|
52
|
+
/** 流式布局 */
|
|
53
|
+
SORTABLE = "sortable"
|
|
54
54
|
}
|
|
55
55
|
/** 选中节点的class name */
|
|
56
56
|
declare const SELECTED_CLASS = "tmagic-stage-selected-area";
|
|
57
57
|
declare enum AbleActionEventType {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
SELECT_PARENT = "select-parent",
|
|
59
|
+
REMOVE = "remove",
|
|
60
|
+
RERENDER = "rerender"
|
|
61
61
|
}
|
|
62
62
|
/** 将组件添加到容器的方式 */
|
|
63
63
|
declare enum ContainerHighlightType {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
/** 默认方式:组件在容器上方悬停一段时间后加入 */
|
|
65
|
+
DEFAULT = "default",
|
|
66
|
+
/** 按住alt键,并在容器上方悬停一段时间后加入 */
|
|
67
|
+
ALT = "alt"
|
|
68
68
|
}
|
|
69
69
|
declare enum RenderType {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
IFRAME = "iframe",
|
|
71
|
+
NATIVE = "native"
|
|
72
72
|
}
|
|
73
73
|
/** 选择状态 */
|
|
74
74
|
declare enum SelectStatus {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
/** 单选 */
|
|
76
|
+
SELECT = "select",
|
|
77
|
+
/** 多选 */
|
|
78
|
+
MULTI_SELECT = "multiSelect"
|
|
79
79
|
}
|
|
80
80
|
/** 拖动状态 */
|
|
81
81
|
declare enum StageDragStatus {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
/** 开始拖动 */
|
|
83
|
+
START = "start",
|
|
84
|
+
/** 拖动中 */
|
|
85
|
+
ING = "ing",
|
|
86
|
+
/** 拖动结束 */
|
|
87
|
+
END = "end"
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region temp/packages/stage/src/DragResizeHelper.d.ts
|
|
90
91
|
/**
|
|
91
92
|
* 拖拽/改变大小等操作发生时,moveable会抛出各种状态事件,DragResizeHelper负责响应这些事件,对目标节点target和拖拽节点targetShadow进行修改;
|
|
92
93
|
* 其中目标节点是DragResizeHelper直接改的,targetShadow作为直接被操作的拖拽框,是调用moveableHelper改的;
|
|
93
94
|
* 有个特殊情况是流式布局下,moveableHelper不支持,targetShadow也是DragResizeHelper直接改的
|
|
94
95
|
*/
|
|
95
96
|
declare class DragResizeHelper {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
97
|
+
/** 目标节点在蒙层上的占位节点,用于跟鼠标交互,避免鼠标事件直接作用到目标节点 */
|
|
98
|
+
private targetShadow;
|
|
99
|
+
/** 要操作的原始目标节点 */
|
|
100
|
+
private target;
|
|
101
|
+
/** 多选:目标节点组 */
|
|
102
|
+
private targetList;
|
|
103
|
+
/** 响应拖拽的状态事件,修改绝对定位布局下targetShadow的dom。
|
|
104
|
+
* MoveableHelper里面的方法是成员属性,如果DragResizeHelper用继承的方式将无法通过super去调这些方法 */
|
|
105
|
+
private moveableHelper;
|
|
106
|
+
/** 流式布局下,目标节点的镜像节点 */
|
|
107
|
+
private ghostEl;
|
|
108
|
+
/** 用于记录节点被改变前的位置 */
|
|
109
|
+
private frameSnapShot;
|
|
110
|
+
/** 多选模式下的多个节点 */
|
|
111
|
+
private framesSnapShot;
|
|
112
|
+
/** 布局方式:流式布局、绝对定位、固定定位 */
|
|
113
|
+
private mode;
|
|
114
|
+
constructor(config: DragResizeHelperConfig);
|
|
115
|
+
destroy(): void;
|
|
116
|
+
destroyShadowEl(): void;
|
|
117
|
+
getShadowEl(): TargetElement | undefined;
|
|
118
|
+
updateShadowEl(el: HTMLElement): void;
|
|
119
|
+
setMode(mode: Mode): void;
|
|
120
|
+
/**
|
|
121
|
+
* 改变大小事件开始
|
|
122
|
+
* @param e 包含了拖拽节点的dom,moveableHelper会直接修改拖拽节点
|
|
123
|
+
*/
|
|
124
|
+
onResizeStart(e: OnResizeStart): void;
|
|
125
|
+
onResize(e: OnResize): void;
|
|
126
|
+
onDragStart(e: OnDragStart): void;
|
|
127
|
+
onDrag(e: OnDrag): void;
|
|
128
|
+
onRotateStart(e: OnRotateStart): void;
|
|
129
|
+
onRotate(e: OnRotate): void;
|
|
130
|
+
onScaleStart(e: OnScaleStart): void;
|
|
131
|
+
onScale(e: OnScale): void;
|
|
132
|
+
getGhostEl(): HTMLElement | undefined;
|
|
133
|
+
destroyGhostEl(): void;
|
|
134
|
+
clear(): void;
|
|
135
|
+
getFrame(el: HTMLElement | SVGElement): ReturnType<MoveableHelper['getFrame']>;
|
|
136
|
+
getShadowEls(): TargetElement[];
|
|
137
|
+
updateGroup(els: HTMLElement[]): void;
|
|
138
|
+
setTargetList(targetList: HTMLElement[]): void;
|
|
139
|
+
clearMultiSelectStatus(): void;
|
|
140
|
+
onResizeGroupStart(e: OnResizeGroupStart): void;
|
|
141
|
+
/**
|
|
142
|
+
* 多选状态下通过拖拽边框改变大小,所有选中组件会一起改变大小
|
|
143
|
+
*/
|
|
144
|
+
onResizeGroup(e: OnResizeGroup): void;
|
|
145
|
+
onDragGroupStart(e: OnDragGroupStart): void;
|
|
146
|
+
onDragGroup(e: OnDragGroup): void;
|
|
147
|
+
getUpdatedElRect(el: HTMLElement, parentEl: HTMLElement | null, doc: Document): Rect;
|
|
148
|
+
/**
|
|
149
|
+
* 多选状态设置多个节点的快照
|
|
150
|
+
*/
|
|
151
|
+
private setFramesSnapShot;
|
|
152
|
+
/**
|
|
153
|
+
* 流式布局把目标节点复制一份进行拖拽,在拖拽结束前不影响页面原布局样式
|
|
154
|
+
*/
|
|
155
|
+
private generateGhostEl;
|
|
155
156
|
}
|
|
156
|
-
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region temp/packages/stage/src/types.d.ts
|
|
157
159
|
type TargetElement = HTMLElement | SVGElement;
|
|
158
160
|
type CanSelect = (el: HTMLElement, event: MouseEvent, stop: () => boolean) => boolean | Promise<boolean>;
|
|
159
161
|
type IsContainer = (el: HTMLElement) => boolean | Promise<boolean>;
|
|
@@ -171,812 +173,826 @@ type MarkContainerEnd = () => HTMLElement | null;
|
|
|
171
173
|
type GetRootContainer = () => HTMLDivElement | undefined;
|
|
172
174
|
type UpdateDragEl = (el: TargetElement, target: TargetElement, container: HTMLElement) => void;
|
|
173
175
|
interface StageCoreConfig {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
176
|
+
/** 需要对齐的dom节点的CSS选择器字符串 */
|
|
177
|
+
snapElementQuerySelector?: string;
|
|
178
|
+
/** 放大倍数,默认1倍 */
|
|
179
|
+
zoom?: number;
|
|
180
|
+
canSelect?: CanSelect;
|
|
181
|
+
isContainer?: IsContainer;
|
|
182
|
+
containerHighlightClassName?: string;
|
|
183
|
+
containerHighlightDuration?: number;
|
|
184
|
+
containerHighlightType?: ContainerHighlightType;
|
|
185
|
+
moveableOptions?: CustomizeMoveableOptions;
|
|
186
|
+
/** runtime 的HTML地址,可以是一个HTTP地址,如果和编辑器不同域,需要设置跨域,也可以是一个相对或绝对路径 */
|
|
187
|
+
runtimeUrl?: string;
|
|
188
|
+
render?: CustomizeRender;
|
|
189
|
+
autoScrollIntoView?: boolean;
|
|
190
|
+
updateDragEl?: UpdateDragEl;
|
|
191
|
+
disabledDragStart?: boolean;
|
|
192
|
+
renderType?: RenderType;
|
|
193
|
+
guidesOptions?: Partial<GuidesOptions$1>;
|
|
194
|
+
disabledMultiSelect?: boolean;
|
|
195
|
+
disabledRule?: boolean;
|
|
194
196
|
}
|
|
195
197
|
interface ActionManagerConfig {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
198
|
+
container: HTMLElement;
|
|
199
|
+
containerHighlightClassName?: string;
|
|
200
|
+
containerHighlightDuration?: number;
|
|
201
|
+
containerHighlightType?: ContainerHighlightType;
|
|
202
|
+
moveableOptions?: CustomizeMoveableOptions;
|
|
203
|
+
disabledDragStart?: boolean;
|
|
204
|
+
disabledMultiSelect?: boolean;
|
|
205
|
+
canSelect?: CanSelect;
|
|
206
|
+
isContainer?: IsContainer;
|
|
207
|
+
getRootContainer: GetRootContainer;
|
|
208
|
+
getRenderDocument: GetRenderDocument;
|
|
209
|
+
updateDragEl?: UpdateDragEl;
|
|
210
|
+
getTargetElement: GetTargetElement;
|
|
211
|
+
getElementsFromPoint: GetElementsFromPoint;
|
|
210
212
|
}
|
|
211
213
|
interface MoveableOptionsManagerConfig {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
container: HTMLElement;
|
|
215
|
+
moveableOptions?: MoveableOptions | (() => MoveableOptions);
|
|
216
|
+
getRootContainer: GetRootContainer;
|
|
215
217
|
}
|
|
216
218
|
interface CustomizeMoveableOptionsCallbackConfig {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
targetEl: HTMLElement | null;
|
|
220
|
+
targetElId?: string;
|
|
221
|
+
targetEls?: HTMLElement[];
|
|
222
|
+
targetElIds?: string[];
|
|
223
|
+
isMulti: boolean;
|
|
224
|
+
document?: Document;
|
|
223
225
|
}
|
|
224
226
|
interface StageRenderConfig {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
runtimeUrl?: string;
|
|
228
|
+
zoom: number | undefined;
|
|
229
|
+
renderType?: RenderType;
|
|
230
|
+
customizedRender?: () => Promise<HTMLElement | null | void>;
|
|
229
231
|
}
|
|
230
232
|
interface StageMaskConfig {
|
|
231
|
-
|
|
233
|
+
core: StageCore;
|
|
232
234
|
}
|
|
233
235
|
interface StageDragResizeConfig extends MoveableOptionsManagerConfig {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
dragResizeHelper: DragResizeHelper;
|
|
237
|
+
disabledDragStart?: boolean;
|
|
238
|
+
getRenderDocument: GetRenderDocument;
|
|
239
|
+
markContainerEnd: MarkContainerEnd;
|
|
240
|
+
delayedMarkContainer: DelayedMarkContainer;
|
|
239
241
|
}
|
|
240
242
|
interface StageMultiDragResizeConfig extends MoveableOptionsManagerConfig {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
dragResizeHelper: DragResizeHelper;
|
|
244
|
+
getRenderDocument: GetRenderDocument;
|
|
245
|
+
markContainerEnd: MarkContainerEnd;
|
|
246
|
+
delayedMarkContainer: DelayedMarkContainer;
|
|
245
247
|
}
|
|
246
248
|
interface DragResizeHelperConfig {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
+
container: HTMLElement;
|
|
250
|
+
updateDragEl?: UpdateDragEl;
|
|
249
251
|
}
|
|
250
252
|
type Rect = {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
+
width: number;
|
|
254
|
+
height: number;
|
|
253
255
|
} & Offset;
|
|
254
256
|
interface Offset {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
left: number;
|
|
258
|
+
top: number;
|
|
257
259
|
}
|
|
258
260
|
interface Point {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
+
clientX: number;
|
|
262
|
+
clientY: number;
|
|
261
263
|
}
|
|
262
264
|
interface GuidesEventData {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
+
type: GuidesType;
|
|
266
|
+
guides: number[];
|
|
265
267
|
}
|
|
266
268
|
interface UpdateEventData {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
269
|
+
data: {
|
|
270
|
+
el: HTMLElement;
|
|
271
|
+
style: {
|
|
272
|
+
width?: number;
|
|
273
|
+
height?: number;
|
|
274
|
+
left?: number;
|
|
275
|
+
top?: number;
|
|
276
|
+
transform?: {
|
|
277
|
+
rotate?: string;
|
|
278
|
+
scale?: string;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
ghostEl?: HTMLElement;
|
|
282
|
+
}[];
|
|
283
|
+
parentEl: HTMLElement | null;
|
|
282
284
|
}
|
|
283
285
|
interface RemoveEventData {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
286
|
+
data: {
|
|
287
|
+
el: HTMLElement;
|
|
288
|
+
}[];
|
|
287
289
|
}
|
|
288
290
|
interface SortEventData {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
291
|
+
src: Id;
|
|
292
|
+
dist: Id;
|
|
293
|
+
root?: MApp;
|
|
292
294
|
}
|
|
293
295
|
interface UpdateData {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
config: MNode;
|
|
297
|
+
parent?: MContainer;
|
|
298
|
+
parentId?: Id;
|
|
299
|
+
root: MApp;
|
|
298
300
|
}
|
|
299
301
|
interface RemoveData {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
302
|
+
id: Id;
|
|
303
|
+
parentId: Id;
|
|
304
|
+
root: MApp;
|
|
303
305
|
}
|
|
304
306
|
interface Runtime {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
307
|
+
getApp?: () => Core | undefined;
|
|
308
|
+
updateRootConfig?: (config: MApp) => void;
|
|
309
|
+
updatePageId?: (id: Id) => void;
|
|
310
|
+
select?: (id: Id) => Promise<HTMLElement> | HTMLElement;
|
|
311
|
+
add?: (data: UpdateData) => void;
|
|
312
|
+
update?: (data: UpdateData) => void;
|
|
313
|
+
sortNode?: (data: SortEventData) => void;
|
|
314
|
+
remove?: (data: RemoveData) => void;
|
|
315
|
+
[key: string]: any;
|
|
314
316
|
}
|
|
315
317
|
interface Magic {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
318
|
+
id: string;
|
|
319
|
+
/** 当前页面的根节点变化时调用该方法,编辑器会同步该el和stage的大小,该方法由stage注入到iframe.contentWindow中 */
|
|
320
|
+
onPageElUpdate: (el: HTMLElement) => void;
|
|
321
|
+
onRuntimeReady: (runtime: Runtime) => void;
|
|
320
322
|
}
|
|
321
323
|
interface RuntimeWindow extends Window {
|
|
322
|
-
|
|
324
|
+
magic: Magic;
|
|
323
325
|
}
|
|
324
326
|
interface StageHighlightConfig {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
327
|
+
container: HTMLElement;
|
|
328
|
+
updateDragEl?: UpdateDragEl;
|
|
329
|
+
getRootContainer: GetRootContainer;
|
|
328
330
|
}
|
|
329
331
|
interface TargetShadowConfig {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
container: HTMLElement;
|
|
333
|
+
zIndex?: ZIndex;
|
|
334
|
+
updateDragEl?: UpdateDragEl;
|
|
335
|
+
idPrefix?: string;
|
|
334
336
|
}
|
|
335
337
|
interface RuleOptions {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
+
guidesOptions?: Partial<GuidesOptions$1>;
|
|
339
|
+
disabledRule?: boolean;
|
|
338
340
|
}
|
|
339
341
|
interface CoreEvents {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
342
|
+
mounted: [];
|
|
343
|
+
'runtime-ready': [runtime: Runtime];
|
|
344
|
+
'page-el-update': [el: HTMLElement];
|
|
345
|
+
'change-guides': [data: GuidesEventData];
|
|
346
|
+
select: [selectedEl: HTMLElement, event: MouseEvent];
|
|
347
|
+
'multi-select': [selectedElList: HTMLElement[], event: MouseEvent];
|
|
348
|
+
dblclick: [event: MouseEvent];
|
|
349
|
+
update: [data: UpdateEventData];
|
|
350
|
+
sort: [data: SortEventData];
|
|
351
|
+
'select-parent': [];
|
|
352
|
+
rerender: [];
|
|
353
|
+
remove: [data: RemoveEventData];
|
|
354
|
+
highlight: [highlightEl: HTMLElement];
|
|
355
|
+
mousemove: [event: MouseEvent];
|
|
356
|
+
mouseleave: [event: MouseEvent];
|
|
357
|
+
'drag-start': [event: OnDragStart];
|
|
356
358
|
}
|
|
357
359
|
interface RenderEvents {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
360
|
+
onload: [];
|
|
361
|
+
'page-el-update': [el: HTMLElement];
|
|
362
|
+
'runtime-ready': [runtime: Runtime];
|
|
361
363
|
}
|
|
362
364
|
interface MaskEvents {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}
|
|
369
|
-
];
|
|
365
|
+
scroll: [event: WheelEvent];
|
|
366
|
+
'change-guides': [data: {
|
|
367
|
+
type: GuidesType.HORIZONTAL;
|
|
368
|
+
guides: number[];
|
|
369
|
+
}];
|
|
370
370
|
}
|
|
371
371
|
interface ActionManagerEvents {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
372
|
+
dblclick: [event: MouseEvent];
|
|
373
|
+
mousemove: [event: MouseEvent];
|
|
374
|
+
mouseleave: [event: MouseEvent];
|
|
375
|
+
highlight: [el: HTMLElement];
|
|
376
|
+
update: [data: UpdateEventData];
|
|
377
|
+
sort: [data: SortEventData];
|
|
378
|
+
remove: [data: RemoveEventData];
|
|
379
|
+
select: [selectedEl: HTMLElement | null, event: MouseEvent];
|
|
380
|
+
rerender: [];
|
|
381
|
+
'select-parent': [];
|
|
382
|
+
'drag-start': [event: OnDragStart];
|
|
383
|
+
'multi-update': [data: UpdateEventData];
|
|
384
|
+
'change-to-select': [id: Id, event: MouseEvent];
|
|
385
|
+
'before-multi-select': [selectedElList: HTMLElement[]];
|
|
386
|
+
'before-select': [el: HTMLElement, event: MouseEvent];
|
|
387
|
+
'multi-select': [selectedElList: HTMLElement[], event: MouseEvent];
|
|
388
|
+
'get-elements-from-point': [els: HTMLElement[]];
|
|
389
389
|
}
|
|
390
390
|
interface DrEvents {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
391
|
+
'update-moveable': [];
|
|
392
|
+
[AbleActionEventType.REMOVE]: [];
|
|
393
|
+
[AbleActionEventType.SELECT_PARENT]: [];
|
|
394
|
+
[AbleActionEventType.RERENDER]: [];
|
|
395
|
+
'drag-start': [event: OnDragStart];
|
|
396
|
+
update: [data: UpdateEventData];
|
|
397
|
+
sort: [data: SortEventData];
|
|
398
398
|
}
|
|
399
399
|
interface MultiDrEvents {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
400
|
+
'update-moveable': [];
|
|
401
|
+
'change-to-select': [id: Id, event: MouseEvent];
|
|
402
|
+
update: [data: UpdateEventData];
|
|
403
403
|
}
|
|
404
|
-
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region temp/packages/stage/src/ActionManager.d.ts
|
|
405
406
|
/**
|
|
406
407
|
* 管理蒙层mask之上的操作:1、监听键盘鼠标事件,判断形成单选、多选、高亮操作;2、管理单选、多选、高亮三个类协同工作。
|
|
407
408
|
* @extends EventEmitter
|
|
408
409
|
*/
|
|
409
|
-
declare class ActionManager extends EventEmitter {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
410
|
+
declare class ActionManager extends EventEmitter$1 {
|
|
411
|
+
private dr;
|
|
412
|
+
private multiDr;
|
|
413
|
+
private highlightLayer;
|
|
414
|
+
/** 单选、多选、高亮的容器(蒙层的content) */
|
|
415
|
+
private container;
|
|
416
|
+
/** 当前选中的节点 */
|
|
417
|
+
private selectedEl;
|
|
418
|
+
/** 多选选中的节点组 */
|
|
419
|
+
private selectedElList;
|
|
420
|
+
/** 当前高亮的节点 */
|
|
421
|
+
private highlightedEl;
|
|
422
|
+
/** 当前是否处于多选状态 */
|
|
423
|
+
private isMultiSelectStatus;
|
|
424
|
+
/** 当拖拽组件到容器上方进入可加入容器状态时,给容器添加的一个class名称 */
|
|
425
|
+
private containerHighlightClassName;
|
|
426
|
+
/** 当拖拽组件到容器上方时,需要悬停多久才能将组件加入容器 */
|
|
427
|
+
private containerHighlightDuration;
|
|
428
|
+
/** 将组件加入容器的操作方式 */
|
|
429
|
+
private containerHighlightType?;
|
|
430
|
+
private isAltKeydown;
|
|
431
|
+
private getTargetElement;
|
|
432
|
+
private getElementsFromPoint;
|
|
433
|
+
private canSelect;
|
|
434
|
+
private isContainer?;
|
|
435
|
+
private getRenderDocument;
|
|
436
|
+
private disabledMultiSelect;
|
|
437
|
+
private config;
|
|
438
|
+
private mouseMoveHandler;
|
|
439
|
+
constructor(config: ActionManagerConfig);
|
|
440
|
+
disableMultiSelect(): void;
|
|
441
|
+
enableMultiSelect(): void;
|
|
442
|
+
/**
|
|
443
|
+
* 设置水平/垂直参考线
|
|
444
|
+
* @param type 参考线类型
|
|
445
|
+
* @param guidelines 参考线坐标数组
|
|
446
|
+
*/
|
|
447
|
+
setGuidelines(type: GuidesType, guidelines: number[]): void;
|
|
448
|
+
/**
|
|
449
|
+
* 清空所有参考线
|
|
450
|
+
*/
|
|
451
|
+
clearGuides(): void;
|
|
452
|
+
/**
|
|
453
|
+
* 更新moveable,外部主要调用场景是元素配置变更、页面大小变更
|
|
454
|
+
* @param el 变更的元素
|
|
455
|
+
*/
|
|
456
|
+
updateMoveable(el?: HTMLElement): void;
|
|
457
|
+
/**
|
|
458
|
+
* 判断是否单选选中的元素
|
|
459
|
+
*/
|
|
460
|
+
isSelectedEl(el: HTMLElement): boolean;
|
|
461
|
+
setSelectedEl(el: HTMLElement | null): void;
|
|
462
|
+
getSelectedEl(): HTMLElement | null;
|
|
463
|
+
getSelectedElList(): HTMLElement[];
|
|
464
|
+
getMoveableOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K] | undefined;
|
|
465
|
+
/**
|
|
466
|
+
* 获取鼠标下方第一个可选中元素,如果元素层叠,返回到是最上层元素
|
|
467
|
+
* @param event 鼠标事件
|
|
468
|
+
* @returns 鼠标下方第一个可选中元素
|
|
469
|
+
*/
|
|
470
|
+
getElementFromPoint(event: MouseEvent): Promise<HTMLElement | null>;
|
|
471
|
+
/**
|
|
472
|
+
* 判断一个元素能否在当前场景被选中
|
|
473
|
+
* @param el 被判断的元素
|
|
474
|
+
* @param event 鼠标事件
|
|
475
|
+
* @param stop 通过该元素如果得知剩下的元素都不可被选中,通知调用方终止对剩下元素的判断
|
|
476
|
+
* @returns 能否选中
|
|
477
|
+
*/
|
|
478
|
+
isElCanSelect(el: HTMLElement, event: MouseEvent, stop: () => boolean): Promise<boolean>;
|
|
479
|
+
/**
|
|
480
|
+
* 判断一个元素是否可以被多选,如果当前元素是page,则调stop函数告诉调用方不必继续判断其它元素了
|
|
481
|
+
*/
|
|
482
|
+
canMultiSelect(el: HTMLElement, stop: () => boolean): boolean;
|
|
483
|
+
select(el: HTMLElement | null, event?: MouseEvent): void;
|
|
484
|
+
multiSelect(ids: Id[]): void;
|
|
485
|
+
getHighlightEl(): HTMLElement | undefined;
|
|
486
|
+
setHighlightEl(el: HTMLElement | undefined): void;
|
|
487
|
+
highlight(id: Id): void;
|
|
488
|
+
clearHighlight(): void;
|
|
489
|
+
/**
|
|
490
|
+
* 用于在切换选择模式时清除上一次的状态
|
|
491
|
+
* @param selectType 需要清理的选择模式
|
|
492
|
+
*/
|
|
493
|
+
clearSelectStatus(selectType: SelectStatus): void;
|
|
494
|
+
/**
|
|
495
|
+
* 找到鼠标下方的容器,通过添加className对容器进行标记
|
|
496
|
+
* @param event 鼠标事件
|
|
497
|
+
* @param excludeElList 计算鼠标点所在容器时要排除的元素列表
|
|
498
|
+
*/
|
|
499
|
+
addContainerHighlightClassName(event: MouseEvent, excludeElList: Element[]): Promise<void>;
|
|
500
|
+
/**
|
|
501
|
+
* 鼠标拖拽着元素,在容器上方悬停,延迟一段时间后,对容器进行标记,如果悬停时间够长将标记成功,悬停时间短,调用方通过返回的timeoutId取消标记
|
|
502
|
+
* 标记的作用:1、高亮容器,给用户一个加入容器的交互感知;2、释放鼠标后,通过标记的标志找到要加入的容器
|
|
503
|
+
* @param event 鼠标事件
|
|
504
|
+
* @param excludeElList 计算鼠标所在容器时要排除的元素列表
|
|
505
|
+
* @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
|
|
506
|
+
*/
|
|
507
|
+
delayedMarkContainer(event: MouseEvent, excludeElList?: Element[]): NodeJS.Timeout | undefined;
|
|
508
|
+
getDragStatus(): StageDragStatus | undefined;
|
|
509
|
+
updateMoveableOptions(): void;
|
|
510
|
+
destroy(): void;
|
|
511
|
+
on<Name extends keyof ActionManagerEvents, Param extends ActionManagerEvents[Name]>(eventName: Name, listener: (...args: Param) => void): this;
|
|
512
|
+
emit<Name extends keyof ActionManagerEvents, Param extends ActionManagerEvents[Name]>(eventName: Name, ...args: Param): boolean;
|
|
513
|
+
private createDr;
|
|
514
|
+
private createMultiDr;
|
|
515
|
+
private changeCallback;
|
|
516
|
+
/**
|
|
517
|
+
* 在执行多选逻辑前,先准备好多选选中元素
|
|
518
|
+
* @param el 新选中的元素
|
|
519
|
+
* @returns 多选选中的元素列表
|
|
520
|
+
*/
|
|
521
|
+
private beforeMultiSelect;
|
|
522
|
+
/**
|
|
523
|
+
* 当前状态下能否将组件加入容器,默认是鼠标悬停一段时间加入,alt模式则是按住alt+鼠标悬停一段时间加入
|
|
524
|
+
*/
|
|
525
|
+
private canAddToContainer;
|
|
526
|
+
/**
|
|
527
|
+
* 结束对container的标记状态
|
|
528
|
+
* @returns 标记的容器元素,没有标记的容器时返回null
|
|
529
|
+
*/
|
|
530
|
+
private markContainerEnd;
|
|
531
|
+
private initMouseEvent;
|
|
532
|
+
/**
|
|
533
|
+
* 初始化键盘事件监听
|
|
534
|
+
*/
|
|
535
|
+
private initKeyEvent;
|
|
536
|
+
/**
|
|
537
|
+
* 在down事件中集中cpu处理画布中选中操作渲染,在up事件中再通知外面的编辑器更新
|
|
538
|
+
*/
|
|
539
|
+
private mouseDownHandler;
|
|
540
|
+
private isStopTriggerSelect;
|
|
541
|
+
/**
|
|
542
|
+
* 在up事件中负责对外通知选中事件,通知画布之外的编辑器更新
|
|
543
|
+
*/
|
|
544
|
+
private mouseUpHandler;
|
|
545
|
+
private mouseLeaveHandler;
|
|
546
|
+
private mouseWheelHandler;
|
|
547
|
+
private dblclickHandler;
|
|
547
548
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region temp/packages/stage/src/Rule.d.ts
|
|
551
|
+
declare class Rule extends EventEmitter$1 {
|
|
552
|
+
hGuides?: Guides;
|
|
553
|
+
vGuides?: Guides;
|
|
554
|
+
horizontalGuidelines: number[];
|
|
555
|
+
verticalGuidelines: number[];
|
|
556
|
+
private container?;
|
|
557
|
+
private containerResizeObserver?;
|
|
558
|
+
private isShowGuides;
|
|
559
|
+
private guidesOptions?;
|
|
560
|
+
constructor(container: HTMLDivElement, options?: RuleOptions);
|
|
561
|
+
/**
|
|
562
|
+
* 是否显示辅助线
|
|
563
|
+
* @param isShowGuides 是否显示
|
|
564
|
+
*/
|
|
565
|
+
showGuides(isShowGuides?: boolean): void;
|
|
566
|
+
setGuides([hLines, vLines]: [number[], number[]]): void;
|
|
567
|
+
/**
|
|
568
|
+
* 清空所有参考线
|
|
569
|
+
*/
|
|
570
|
+
clearGuides(): void;
|
|
571
|
+
/**
|
|
572
|
+
* 是否显示标尺
|
|
573
|
+
* @param show 是否显示
|
|
574
|
+
*/
|
|
575
|
+
showRule(show?: boolean): void;
|
|
576
|
+
scrollRule(scrollTop: number): void;
|
|
577
|
+
destroy(): void;
|
|
578
|
+
destroyGuides(): void;
|
|
579
|
+
private getGuidesStyle;
|
|
580
|
+
private createGuides;
|
|
581
|
+
private hGuidesChangeGuidesHandler;
|
|
582
|
+
private vGuidesChangeGuidesHandler;
|
|
581
583
|
}
|
|
582
|
-
|
|
584
|
+
//#endregion
|
|
585
|
+
//#region temp/packages/stage/src/StageMask.d.ts
|
|
583
586
|
/**
|
|
584
587
|
* 蒙层
|
|
585
588
|
* @description 用于拦截页面的点击动作,避免点击时触发组件自身动作;在编辑器中点击组件应当是选中组件;
|
|
586
589
|
*/
|
|
587
590
|
declare class StageMask extends Rule {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
591
|
+
content: HTMLDivElement;
|
|
592
|
+
wrapper: HTMLDivElement;
|
|
593
|
+
page: HTMLElement | null;
|
|
594
|
+
scrollTop: number;
|
|
595
|
+
scrollLeft: number;
|
|
596
|
+
width: number;
|
|
597
|
+
height: number;
|
|
598
|
+
wrapperHeight: number;
|
|
599
|
+
wrapperWidth: number;
|
|
600
|
+
maxScrollTop: number;
|
|
601
|
+
maxScrollLeft: number;
|
|
602
|
+
private mode;
|
|
603
|
+
private pageScrollParent;
|
|
604
|
+
private intersectionObserver;
|
|
605
|
+
private wrapperResizeObserver;
|
|
606
|
+
constructor(options?: RuleOptions);
|
|
607
|
+
setMode(mode: Mode): void;
|
|
608
|
+
/**
|
|
609
|
+
* 初始化视窗和蒙层监听,监听元素是否在视窗区域、监听mask蒙层所在的wrapper大小变化
|
|
610
|
+
* @description 初始化视窗和蒙层监听
|
|
611
|
+
* @param page 页面Dom节点
|
|
612
|
+
*/
|
|
613
|
+
observe(page: HTMLElement): void;
|
|
614
|
+
/**
|
|
615
|
+
* 处理页面大小变更,同步页面和mask大小
|
|
616
|
+
* @param entries ResizeObserverEntry,获取页面最新大小
|
|
617
|
+
*/
|
|
618
|
+
pageResize(entries: ResizeObserverEntry[]): void;
|
|
619
|
+
/**
|
|
620
|
+
* 监听一个组件是否在画布可视区域内
|
|
621
|
+
* @param el 被选中的组件,可能是左侧目录树中选中的
|
|
622
|
+
*/
|
|
623
|
+
observerIntersection(el: HTMLElement): void;
|
|
624
|
+
/**
|
|
625
|
+
* 挂载Dom节点
|
|
626
|
+
* @param el 将蒙层挂载到该Dom节点上
|
|
627
|
+
*/
|
|
628
|
+
mount(el: HTMLDivElement): void;
|
|
629
|
+
setLayout(el: HTMLElement): void;
|
|
630
|
+
scrollIntoView(el: Element): void;
|
|
631
|
+
/**
|
|
632
|
+
* 销毁实例
|
|
633
|
+
*/
|
|
634
|
+
destroy(): void;
|
|
635
|
+
on<Name extends keyof MaskEvents, Param extends MaskEvents[Name]>(eventName: Name, listener: (...args: Param) => void | Promise<void>): this;
|
|
636
|
+
emit<Name extends keyof MaskEvents, Param extends MaskEvents[Name]>(eventName: Name, ...args: Param): boolean;
|
|
637
|
+
/**
|
|
638
|
+
* 监听选中元素是否在画布可视区域内,如果目标元素不在可视区域内,通过滚动使该元素出现在可视区域
|
|
639
|
+
*/
|
|
640
|
+
private initObserverIntersection;
|
|
641
|
+
/**
|
|
642
|
+
* 监听mask的容器大小变化
|
|
643
|
+
*/
|
|
644
|
+
private initObserverWrapper;
|
|
645
|
+
private scroll;
|
|
646
|
+
private scrollTo;
|
|
647
|
+
/**
|
|
648
|
+
* 设置蒙层高度
|
|
649
|
+
* @param height 高度
|
|
650
|
+
*/
|
|
651
|
+
private setHeight;
|
|
652
|
+
/**
|
|
653
|
+
* 设置蒙层宽度
|
|
654
|
+
* @param width 宽度
|
|
655
|
+
*/
|
|
656
|
+
private setWidth;
|
|
657
|
+
/**
|
|
658
|
+
* 计算并设置最大滚动宽度
|
|
659
|
+
*/
|
|
660
|
+
private setMaxScrollLeft;
|
|
661
|
+
/**
|
|
662
|
+
* 计算并设置最大滚动高度
|
|
663
|
+
*/
|
|
664
|
+
private setMaxScrollTop;
|
|
665
|
+
/**
|
|
666
|
+
* 修复滚动距离
|
|
667
|
+
* 由于滚动容器变化等因素,会导致当前滚动的距离不正确
|
|
668
|
+
*/
|
|
669
|
+
private fixScrollValue;
|
|
670
|
+
private mouseWheelHandler;
|
|
668
671
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
672
|
+
//#endregion
|
|
673
|
+
//#region temp/packages/stage/src/StageRender.d.ts
|
|
674
|
+
declare class StageRender extends EventEmitter {
|
|
675
|
+
/** 组件的js、css执行的环境,直接渲染为当前window,iframe渲染则为iframe.contentWindow */
|
|
676
|
+
contentWindow: RuntimeWindow | null;
|
|
677
|
+
runtime: Runtime | null;
|
|
678
|
+
iframe?: HTMLIFrameElement;
|
|
679
|
+
nativeContainer?: HTMLDivElement;
|
|
680
|
+
private runtimeUrl?;
|
|
681
|
+
private zoom;
|
|
682
|
+
private renderType;
|
|
683
|
+
private customizedRender?;
|
|
684
|
+
constructor({
|
|
685
|
+
runtimeUrl,
|
|
686
|
+
zoom,
|
|
687
|
+
customizedRender,
|
|
688
|
+
renderType
|
|
689
|
+
}: StageRenderConfig);
|
|
690
|
+
getMagicApi: () => {
|
|
691
|
+
id: string;
|
|
692
|
+
onPageElUpdate: (el: HTMLElement) => void;
|
|
693
|
+
onRuntimeReady: (runtime: Runtime) => void;
|
|
694
|
+
};
|
|
695
|
+
add(data: UpdateData): Promise<void>;
|
|
696
|
+
remove(data: RemoveData): Promise<void>;
|
|
697
|
+
update(data: UpdateData): Promise<void>;
|
|
698
|
+
select(ids: Id[]): Promise<void>;
|
|
699
|
+
setZoom(zoom?: number): void;
|
|
700
|
+
/**
|
|
701
|
+
* 挂载Dom节点
|
|
702
|
+
* @param el 将页面挂载到该Dom节点上
|
|
703
|
+
*/
|
|
704
|
+
mount(el: HTMLDivElement): Promise<void>;
|
|
705
|
+
getRuntime: () => Promise<Runtime>;
|
|
706
|
+
getDocument(): Document | undefined;
|
|
707
|
+
/**
|
|
708
|
+
* 通过坐标获得坐标下所有HTML元素数组
|
|
709
|
+
* @param point 坐标
|
|
710
|
+
* @returns 坐标下方所有HTML元素数组,会包含父元素直至html,元素层叠时返回顺序是从上到下
|
|
711
|
+
*/
|
|
712
|
+
getElementsFromPoint(point: Point): HTMLElement[];
|
|
713
|
+
getTargetElement(id: Id): HTMLElement | null;
|
|
714
|
+
postTmagicRuntimeReady(): void;
|
|
715
|
+
reloadIframe(url: string): void;
|
|
716
|
+
destroyIframe(): void;
|
|
717
|
+
/**
|
|
718
|
+
* 销毁实例
|
|
719
|
+
*/
|
|
720
|
+
destroy(): void;
|
|
721
|
+
on<Name extends keyof RenderEvents, Param extends RenderEvents[Name]>(eventName: Name, listener: (...args: Param) => void | Promise<void>): this;
|
|
722
|
+
emit<Name extends keyof RenderEvents, Param extends RenderEvents[Name]>(eventName: Name, ...args: Param): boolean;
|
|
723
|
+
private createIframe;
|
|
724
|
+
private createNativeContainer;
|
|
725
|
+
/**
|
|
726
|
+
* 在runtime中对被选中的元素进行标记,部分组件有对选中态进行特殊显示的需求
|
|
727
|
+
* @param el 被选中的元素
|
|
728
|
+
*/
|
|
729
|
+
private flagSelectedEl;
|
|
730
|
+
private iframeLoadHandler;
|
|
722
731
|
}
|
|
723
|
-
|
|
732
|
+
//#endregion
|
|
733
|
+
//#region temp/packages/stage/src/StageCore.d.ts
|
|
724
734
|
/**
|
|
725
735
|
* 负责管理画布,管理renderer、mask、actionManager三个核心类,并负责统一对外通信,包括提供接口和抛事件
|
|
726
736
|
*/
|
|
727
|
-
declare class StageCore extends EventEmitter
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
737
|
+
declare class StageCore extends EventEmitter {
|
|
738
|
+
container?: HTMLDivElement;
|
|
739
|
+
renderer: StageRender | null;
|
|
740
|
+
mask: StageMask | null;
|
|
741
|
+
actionManager: ActionManager | null;
|
|
742
|
+
private pageResizeObserver;
|
|
743
|
+
private autoScrollIntoView;
|
|
744
|
+
private customizedRender?;
|
|
745
|
+
constructor(config: StageCoreConfig);
|
|
746
|
+
/**
|
|
747
|
+
* 单选选中元素
|
|
748
|
+
* @param id 选中的id
|
|
749
|
+
*/
|
|
750
|
+
select(id: Id, event?: MouseEvent): Promise<void>;
|
|
751
|
+
/**
|
|
752
|
+
* 多选选中多个元素
|
|
753
|
+
* @param ids 选中元素的id列表
|
|
754
|
+
*/
|
|
755
|
+
multiSelect(ids: Id[]): Promise<void>;
|
|
756
|
+
/**
|
|
757
|
+
* 高亮选中元素
|
|
758
|
+
* @param el 要高亮的元素
|
|
759
|
+
*/
|
|
760
|
+
highlight(id: Id): void;
|
|
761
|
+
clearHighlight(): void;
|
|
762
|
+
/**
|
|
763
|
+
* 更新组件
|
|
764
|
+
* @param data 更新组件的数据
|
|
765
|
+
*/
|
|
766
|
+
update(data: UpdateData): Promise<void>;
|
|
767
|
+
/**
|
|
768
|
+
* 往画布增加一个组件
|
|
769
|
+
* @param data 组件信息数据
|
|
770
|
+
*/
|
|
771
|
+
add(data: UpdateData): Promise<void>;
|
|
772
|
+
/**
|
|
773
|
+
* 从画布删除一个组件
|
|
774
|
+
* @param data 组件信息数据
|
|
775
|
+
*/
|
|
776
|
+
remove(data: RemoveData): Promise<void>;
|
|
777
|
+
setZoom(zoom?: number): void;
|
|
778
|
+
/**
|
|
779
|
+
* 挂载Dom节点
|
|
780
|
+
* @param el 将stage挂载到该Dom节点上
|
|
781
|
+
*/
|
|
782
|
+
mount(el: HTMLDivElement): Promise<void>;
|
|
783
|
+
/**
|
|
784
|
+
* 清空所有参考线
|
|
785
|
+
*/
|
|
786
|
+
clearGuides(): void;
|
|
787
|
+
/**
|
|
788
|
+
* @deprecated 废弃接口,建议用delayedMarkContainer代替
|
|
789
|
+
*/
|
|
790
|
+
getAddContainerHighlightClassNameTimeout(event: MouseEvent, excludeElList?: Element[]): NodeJS.Timeout | undefined;
|
|
791
|
+
/**
|
|
792
|
+
* 鼠标拖拽着元素,在容器上方悬停,延迟一段时间后,对容器进行标记,如果悬停时间够长将标记成功,悬停时间短,调用方通过返回的timeoutId取消标记
|
|
793
|
+
* 标记的作用:1、高亮容器,给用户一个加入容器的交互感知;2、释放鼠标后,通过标记的标志找到要加入的容器
|
|
794
|
+
* @param event 鼠标事件
|
|
795
|
+
* @param excludeElList 计算鼠标所在容器时要排除的元素列表
|
|
796
|
+
* @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
|
|
797
|
+
*/
|
|
798
|
+
delayedMarkContainer(event: MouseEvent, excludeElList?: Element[]): NodeJS.Timeout | undefined;
|
|
799
|
+
getMoveableOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K] | undefined;
|
|
800
|
+
getDragStatus(): _tmagic_editor0.StageDragStatus | undefined;
|
|
801
|
+
disableMultiSelect(): void;
|
|
802
|
+
enableMultiSelect(): void;
|
|
803
|
+
reloadIframe(url: string): void;
|
|
804
|
+
/**
|
|
805
|
+
* 销毁实例
|
|
806
|
+
*/
|
|
807
|
+
destroy(): void;
|
|
808
|
+
on<Name extends keyof CoreEvents, Param extends CoreEvents[Name]>(eventName: Name, listener: (...args: Param) => void | Promise<void>): this;
|
|
809
|
+
emit<Name extends keyof CoreEvents, Param extends CoreEvents[Name]>(eventName: Name, ...args: Param): boolean;
|
|
810
|
+
/**
|
|
811
|
+
* 监听页面大小变化
|
|
812
|
+
*/
|
|
813
|
+
private observePageResize;
|
|
814
|
+
private getActionManagerConfig;
|
|
815
|
+
private initRenderEvent;
|
|
816
|
+
private initMaskEvent;
|
|
817
|
+
/**
|
|
818
|
+
* 初始化操作相关事件监听
|
|
819
|
+
*/
|
|
820
|
+
private initActionEvent;
|
|
821
|
+
/**
|
|
822
|
+
* 初始化ActionManager类本身抛出来的事件监听
|
|
823
|
+
*/
|
|
824
|
+
private initActionManagerEvent;
|
|
825
|
+
/**
|
|
826
|
+
* 初始化DragResize类通过ActionManager抛出来的事件监听
|
|
827
|
+
*/
|
|
828
|
+
private initDrEvent;
|
|
829
|
+
/**
|
|
830
|
+
* 初始化MultiDragResize类通过ActionManager抛出来的事件监听
|
|
831
|
+
*/
|
|
832
|
+
private initMulDrEvent;
|
|
833
|
+
/**
|
|
834
|
+
* 初始化Highlight类通过ActionManager抛出来的事件监听
|
|
835
|
+
*/
|
|
836
|
+
private initHighlightEvent;
|
|
837
|
+
/**
|
|
838
|
+
* 初始化Highlight类通过ActionManager抛出来的事件监听
|
|
839
|
+
*/
|
|
840
|
+
private initMouseEvent;
|
|
831
841
|
}
|
|
832
|
-
|
|
842
|
+
//#endregion
|
|
843
|
+
//#region temp/packages/stage/src/MoveableOptionsManager.d.ts
|
|
833
844
|
/**
|
|
834
845
|
* 单选和多选的父类,用于管理moveableOptions
|
|
835
846
|
* @extends EventEmitter
|
|
836
847
|
*/
|
|
837
|
-
declare class MoveableOptionsManager extends EventEmitter {
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
848
|
+
declare class MoveableOptionsManager extends EventEmitter$1 {
|
|
849
|
+
/** 布局方式:流式布局、绝对定位、固定定位 */
|
|
850
|
+
mode: Mode;
|
|
851
|
+
/** 画布容器 */
|
|
852
|
+
protected container: HTMLElement;
|
|
853
|
+
protected options: MoveableOptions;
|
|
854
|
+
/** 水平参考线 */
|
|
855
|
+
private horizontalGuidelines;
|
|
856
|
+
/** 垂直参考线 */
|
|
857
|
+
private verticalGuidelines;
|
|
858
|
+
/** 对齐元素集合 */
|
|
859
|
+
private elementGuidelines;
|
|
860
|
+
/** 由外部调用方(编辑器)传入进来的moveable默认参数,可以为空,也可以是一个回调函数 */
|
|
861
|
+
private customizedOptions?;
|
|
862
|
+
/** 获取整个画布的根元素(在StageCore的mount函数中挂载的container) */
|
|
863
|
+
private getRootContainer;
|
|
864
|
+
constructor(config: MoveableOptionsManagerConfig);
|
|
865
|
+
getOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K];
|
|
866
|
+
/**
|
|
867
|
+
* 设置水平/垂直参考线
|
|
868
|
+
* @param type 参考线类型
|
|
869
|
+
* @param guidelines 参考线坐标数组
|
|
870
|
+
*/
|
|
871
|
+
setGuidelines(type: GuidesType, guidelines: number[]): void;
|
|
872
|
+
/**
|
|
873
|
+
* 清除横向和纵向的参考线
|
|
874
|
+
*/
|
|
875
|
+
clearGuides(): void;
|
|
876
|
+
/**
|
|
877
|
+
* 设置有哪些元素要辅助对齐
|
|
878
|
+
* @param selectedElList 选中的元素列表,需要排除在对齐元素之外
|
|
879
|
+
*/
|
|
880
|
+
protected setElementGuidelines(selectedElList: HTMLElement[]): void;
|
|
881
|
+
/**
|
|
882
|
+
* 获取moveable参数
|
|
883
|
+
* @param isMultiSelect 是否多选模式
|
|
884
|
+
* @param runtimeOptions 调用时实时传进来的的moveable参数
|
|
885
|
+
* @returns moveable所需参数
|
|
886
|
+
*/
|
|
887
|
+
protected getOptions(isMultiSelect: boolean, runtimeOptions?: MoveableOptions): MoveableOptions;
|
|
888
|
+
/**
|
|
889
|
+
* 获取单选和多选的moveable公共参数
|
|
890
|
+
* @returns moveable公共参数
|
|
891
|
+
*/
|
|
892
|
+
private getDefaultOptions;
|
|
893
|
+
/**
|
|
894
|
+
* 获取单选下的差异化参数
|
|
895
|
+
* @returns {MoveableOptions} moveable options参数
|
|
896
|
+
*/
|
|
897
|
+
private getSingleOptions;
|
|
898
|
+
/**
|
|
899
|
+
* 获取多选下的差异化参数
|
|
900
|
+
* @returns {MoveableOptions} moveable options参数
|
|
901
|
+
*/
|
|
902
|
+
private getMultiOptions;
|
|
903
|
+
/**
|
|
904
|
+
* 获取业务方自定义的moveable参数
|
|
905
|
+
*/
|
|
906
|
+
private getCustomizeOptions;
|
|
907
|
+
/**
|
|
908
|
+
* 这是给selectParentAbles的回调函数,用于触发选中父元素事件
|
|
909
|
+
*/
|
|
910
|
+
private actionHandler;
|
|
911
|
+
/**
|
|
912
|
+
* 为需要辅助对齐的元素创建div
|
|
913
|
+
* @param selectedElList 选中的元素列表,需要排除在对齐元素之外
|
|
914
|
+
* @param allElList 全部元素列表
|
|
915
|
+
* @returns frame 辅助对齐元素集合的页面片
|
|
916
|
+
*/
|
|
917
|
+
private createGuidelineElements;
|
|
918
|
+
/**
|
|
919
|
+
* 判断一个元素是否在元素列表里面
|
|
920
|
+
* @param ele 元素
|
|
921
|
+
* @param eleList 元素列表
|
|
922
|
+
* @returns 是否在元素列表里面
|
|
923
|
+
*/
|
|
924
|
+
private isInElementList;
|
|
914
925
|
}
|
|
915
|
-
|
|
926
|
+
//#endregion
|
|
927
|
+
//#region temp/packages/stage/src/StageDragResize.d.ts
|
|
916
928
|
/**
|
|
917
929
|
* 管理单选操作,响应选中操作,初始化moveableOption参数并初始化moveable,处理moveable回调事件对组件进行更新
|
|
918
930
|
* @extends MoveableOptionsManager
|
|
919
931
|
*/
|
|
920
932
|
declare class StageDragResize extends MoveableOptionsManager {
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
933
|
+
/** 目标节点 */
|
|
934
|
+
private target;
|
|
935
|
+
/** Moveable拖拽类实例 */
|
|
936
|
+
private moveable?;
|
|
937
|
+
/** 拖动状态 */
|
|
938
|
+
private dragStatus;
|
|
939
|
+
private dragResizeHelper;
|
|
940
|
+
private disabledDragStart?;
|
|
941
|
+
private getRenderDocument;
|
|
942
|
+
private markContainerEnd;
|
|
943
|
+
private delayedMarkContainer;
|
|
944
|
+
constructor(config: StageDragResizeConfig);
|
|
945
|
+
getTarget(): HTMLElement | null;
|
|
946
|
+
/**
|
|
947
|
+
* 将选中框渲染并覆盖到选中的组件Dom节点上方
|
|
948
|
+
* 当选中的节点不是absolute时,会创建一个新的节点出来作为拖拽目标
|
|
949
|
+
* @param el 选中组件的Dom节点元素
|
|
950
|
+
* @param event 鼠标事件
|
|
951
|
+
*/
|
|
952
|
+
select(el: HTMLElement | null, event?: MouseEvent): void;
|
|
953
|
+
/**
|
|
954
|
+
* 初始化选中框并渲染出来
|
|
955
|
+
*/
|
|
956
|
+
updateMoveable(el?: HTMLElement | null): void;
|
|
957
|
+
clearSelectStatus(): void;
|
|
958
|
+
getDragStatus(): StageDragStatus;
|
|
959
|
+
/**
|
|
960
|
+
* 销毁实例
|
|
961
|
+
*/
|
|
962
|
+
destroy(): void;
|
|
963
|
+
on<Name extends keyof DrEvents, Param extends DrEvents[Name]>(eventName: Name, listener: (...args: Param) => void | Promise<void>): this;
|
|
964
|
+
emit<Name extends keyof DrEvents, Param extends DrEvents[Name]>(eventName: Name, ...args: Param): boolean;
|
|
965
|
+
private init;
|
|
966
|
+
private initMoveable;
|
|
967
|
+
private bindResizeEvent;
|
|
968
|
+
private bindDragEvent;
|
|
969
|
+
private bindRotateEvent;
|
|
970
|
+
private bindScaleEvent;
|
|
971
|
+
private sort;
|
|
972
|
+
private update;
|
|
961
973
|
}
|
|
962
|
-
|
|
974
|
+
//#endregion
|
|
975
|
+
//#region temp/packages/stage/src/util.d.ts
|
|
963
976
|
declare const getOffset: (el: Element) => Offset;
|
|
964
977
|
declare const getTargetElStyle: (el: TargetElement, zIndex?: ZIndex) => string;
|
|
965
|
-
declare const getAbsolutePosition: (el: HTMLElement, {
|
|
966
|
-
|
|
967
|
-
|
|
978
|
+
declare const getAbsolutePosition: (el: HTMLElement, {
|
|
979
|
+
top,
|
|
980
|
+
left
|
|
981
|
+
}: Offset) => {
|
|
982
|
+
left: number;
|
|
983
|
+
top: number;
|
|
968
984
|
};
|
|
969
985
|
declare const isAbsolute: (style: {
|
|
970
|
-
|
|
986
|
+
position?: string;
|
|
971
987
|
}) => boolean;
|
|
972
988
|
declare const isRelative: (style: {
|
|
973
|
-
|
|
989
|
+
position?: string;
|
|
974
990
|
}) => boolean;
|
|
975
991
|
declare const isStatic: (style: {
|
|
976
|
-
|
|
992
|
+
position?: string;
|
|
977
993
|
}) => boolean;
|
|
978
994
|
declare const isFixed: (style: {
|
|
979
|
-
|
|
995
|
+
position?: string;
|
|
980
996
|
}) => boolean;
|
|
981
997
|
declare const isFixedParent: (el: Element) => boolean;
|
|
982
998
|
declare const getMode: (el: Element) => Mode;
|
|
@@ -999,31 +1015,31 @@ declare const down: (deltaTop: number, target: TargetElement) => SortEventData;
|
|
|
999
1015
|
declare const up: (deltaTop: number, target: TargetElement) => SortEventData;
|
|
1000
1016
|
declare const isMoveableButton: (target: Element) => boolean | undefined;
|
|
1001
1017
|
declare const getMarginValue: (el: Element) => {
|
|
1002
|
-
|
|
1003
|
-
|
|
1018
|
+
marginLeft: number;
|
|
1019
|
+
marginTop: number;
|
|
1004
1020
|
};
|
|
1005
1021
|
declare const getBorderWidth: (el: Element) => {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1022
|
+
borderLeftWidth: number;
|
|
1023
|
+
borderRightWidth: number;
|
|
1024
|
+
borderTopWidth: number;
|
|
1025
|
+
borderBottomWidth: number;
|
|
1010
1026
|
};
|
|
1011
|
-
|
|
1027
|
+
//#endregion
|
|
1028
|
+
//#region temp/packages/stage/src/MoveableActionsAble.d.ts
|
|
1012
1029
|
interface AbleCustomizedButton {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1030
|
+
props: {
|
|
1031
|
+
className?: string;
|
|
1032
|
+
onClick?(e: MouseEvent): void;
|
|
1033
|
+
[key: string]: any;
|
|
1034
|
+
};
|
|
1035
|
+
children: ReturnType<Renderer['createElement']>[];
|
|
1019
1036
|
}
|
|
1020
1037
|
declare const _default: (handler: (type: AbleActionEventType) => void, customizedButton?: ((react: Renderer) => AbleCustomizedButton)[]) => {
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1038
|
+
name: string;
|
|
1039
|
+
props: never[];
|
|
1040
|
+
always: boolean;
|
|
1041
|
+
events: never[];
|
|
1042
|
+
render(moveable: MoveableManagerInterface<any, any>, React: Renderer): any;
|
|
1026
1043
|
};
|
|
1027
|
-
|
|
1028
|
-
export { AbleActionEventType, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType, DEFAULT_ZOOM, DRAG_EL_ID_PREFIX, GHOST_EL_ID_PREFIX, GuidesType, HIGHLIGHT_EL_ID_PREFIX, Mode, MouseButton, _default as MoveableActionsAble, PAGE_CLASS, RenderType, SELECTED_CLASS, SelectStatus, StageDragResize, StageDragStatus, StageMask, StageRender, ZIndex, addSelectedClassName, StageCore as default, down, getAbsolutePosition, getBorderWidth, getMarginValue, getMode, getOffset, getScrollParent, getTargetElStyle, isAbsolute, isFixed, isFixedParent, isMoveableButton, isRelative, isStatic, removeSelectedClassName, up };
|
|
1029
|
-
export type { AbleCustomizedButton, ActionManagerConfig, ActionManagerEvents, CanSelect, CoreEvents, CustomizeMoveableOptions, CustomizeMoveableOptionsCallbackConfig, CustomizeMoveableOptionsFunction, CustomizeRender, DelayedMarkContainer, DrEvents, DragResizeHelperConfig, GetElementsFromPoint, GetRenderDocument, GetRootContainer, GetTargetElement, GuidesEventData, IsContainer, Magic, MarkContainerEnd, MaskEvents, MoveableOptionsManagerConfig, MultiDrEvents, Offset, Point, Rect, RemoveData, RemoveEventData, RenderEvents, RuleOptions, Runtime, RuntimeWindow, SortEventData, StageCoreConfig, StageDragResizeConfig, StageHighlightConfig, StageMaskConfig, StageMultiDragResizeConfig, StageRenderConfig, TargetElement, TargetShadowConfig, UpdateData, UpdateDragEl, UpdateEventData };
|
|
1044
|
+
//#endregion
|
|
1045
|
+
export { AbleActionEventType, AbleCustomizedButton, ActionManagerConfig, ActionManagerEvents, CONTAINER_HIGHLIGHT_CLASS_NAME, CanSelect, ContainerHighlightType, CoreEvents, CustomizeMoveableOptions, CustomizeMoveableOptionsCallbackConfig, CustomizeMoveableOptionsFunction, CustomizeRender, DEFAULT_ZOOM, DRAG_EL_ID_PREFIX, DelayedMarkContainer, DrEvents, DragResizeHelperConfig, GHOST_EL_ID_PREFIX, GetElementsFromPoint, GetRenderDocument, GetRootContainer, GetTargetElement, GuidesEventData, type GuidesOptions, GuidesType, HIGHLIGHT_EL_ID_PREFIX, IsContainer, Magic, MarkContainerEnd, MaskEvents, Mode, MouseButton, _default as MoveableActionsAble, MoveableOptionsManagerConfig, MultiDrEvents, Offset, PAGE_CLASS, Point, Rect, RemoveData, RemoveEventData, RenderEvents, RenderType, RuleOptions, Runtime, RuntimeWindow, SELECTED_CLASS, SelectStatus, SortEventData, StageCoreConfig, StageDragResize, StageDragResizeConfig, StageDragStatus, StageHighlightConfig, StageMask, StageMaskConfig, StageMultiDragResizeConfig, StageRender, StageRenderConfig, TargetElement, TargetShadowConfig, UpdateData, UpdateDragEl, UpdateEventData, ZIndex, addSelectedClassName, StageCore as default, down, getAbsolutePosition, getBorderWidth, getMarginValue, getMode, getOffset, getScrollParent, getTargetElStyle, isAbsolute, isFixed, isFixedParent, isMoveableButton, isRelative, isStatic, removeSelectedClassName, up };
|