@tmagic/stage 1.8.0-beta.16 → 1.8.0-beta.18
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/es/ActionManager.js +14 -6
- package/dist/es/StageCore.js +4 -2
- package/dist/tmagic-stage.umd.cjs +18 -8
- package/package.json +2 -2
- package/src/ActionManager.ts +20 -8
- package/src/StageCore.ts +8 -2
- package/src/types.ts +12 -1
- package/types/index.d.ts +17 -4
package/dist/es/ActionManager.js
CHANGED
|
@@ -35,6 +35,8 @@ var ActionManager = class extends EventEmitter$1 {
|
|
|
35
35
|
containerHighlightDuration;
|
|
36
36
|
/** 将组件加入容器的操作方式 */
|
|
37
37
|
containerHighlightType;
|
|
38
|
+
/** 是否仅在新增组件时才启用将组件加入容器 */
|
|
39
|
+
containerHighlightAddOnly = false;
|
|
38
40
|
isAltKeydown = false;
|
|
39
41
|
getTargetElement;
|
|
40
42
|
getElementsFromPoint;
|
|
@@ -68,6 +70,7 @@ var ActionManager = class extends EventEmitter$1 {
|
|
|
68
70
|
this.containerHighlightClassName = config.containerHighlightClassName || "tmagic-stage-container-highlight";
|
|
69
71
|
this.containerHighlightDuration = config.containerHighlightDuration || defaultContainerHighlightDuration;
|
|
70
72
|
this.containerHighlightType = config.containerHighlightType;
|
|
73
|
+
this.containerHighlightAddOnly = config.containerHighlightAddOnly ?? false;
|
|
71
74
|
this.disabledMultiSelect = config.disabledMultiSelect ?? false;
|
|
72
75
|
this.alwaysMultiSelect = config.alwaysMultiSelect ?? false;
|
|
73
76
|
this.getTargetElement = config.getTargetElement;
|
|
@@ -299,10 +302,11 @@ var ActionManager = class extends EventEmitter$1 {
|
|
|
299
302
|
* 标记的作用:1、高亮容器,给用户一个加入容器的交互感知;2、释放鼠标后,通过标记的标志找到要加入的容器
|
|
300
303
|
* @param event 鼠标事件
|
|
301
304
|
* @param excludeElList 计算鼠标所在容器时要排除的元素列表
|
|
305
|
+
* @param isAdd 当前操作是否为新增组件(从组件列表拖入),开启 containerHighlightAddOnly 时只有新增才会标记
|
|
302
306
|
* @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
|
|
303
307
|
*/
|
|
304
|
-
delayedMarkContainer(event, excludeElList = []) {
|
|
305
|
-
if (this.canAddToContainer()) return globalThis.setTimeout(() => {
|
|
308
|
+
delayedMarkContainer(event, excludeElList = [], isAdd = false) {
|
|
309
|
+
if (this.canAddToContainer(isAdd)) return globalThis.setTimeout(() => {
|
|
306
310
|
this.addContainerHighlightClassName(event, excludeElList);
|
|
307
311
|
}, this.containerHighlightDuration);
|
|
308
312
|
}
|
|
@@ -421,9 +425,12 @@ var ActionManager = class extends EventEmitter$1 {
|
|
|
421
425
|
} else this.selectedElList.push(el);
|
|
422
426
|
}
|
|
423
427
|
/**
|
|
424
|
-
* 当前状态下能否将组件加入容器,默认是鼠标悬停一段时间加入,alt模式则是按住alt
|
|
428
|
+
* 当前状态下能否将组件加入容器,默认是鼠标悬停一段时间加入,alt模式则是按住alt+鼠标悬停一段时间加入;
|
|
429
|
+
* 开启containerHighlightAddOnly时,画布中拖动已有组件不能加入容器
|
|
430
|
+
* @param isAdd 当前操作是否为新增组件
|
|
425
431
|
*/
|
|
426
|
-
canAddToContainer() {
|
|
432
|
+
canAddToContainer(isAdd = false) {
|
|
433
|
+
if (this.containerHighlightAddOnly && !isAdd) return false;
|
|
427
434
|
return this.containerHighlightType === ContainerHighlightType.DEFAULT || this.containerHighlightType === ContainerHighlightType.ALT && this.isAltKeydown;
|
|
428
435
|
}
|
|
429
436
|
/**
|
|
@@ -432,8 +439,9 @@ var ActionManager = class extends EventEmitter$1 {
|
|
|
432
439
|
*/
|
|
433
440
|
markContainerEnd() {
|
|
434
441
|
const doc = this.getRenderDocument();
|
|
435
|
-
if (doc
|
|
436
|
-
|
|
442
|
+
if (!doc) return null;
|
|
443
|
+
const markedContainer = removeClassNameByClassName(doc, this.containerHighlightClassName);
|
|
444
|
+
return this.canAddToContainer() ? markedContainer : null;
|
|
437
445
|
}
|
|
438
446
|
initMouseEvent() {
|
|
439
447
|
this.container.addEventListener("mousedown", this.mouseDownHandler);
|
package/dist/es/StageCore.js
CHANGED
|
@@ -171,10 +171,11 @@ var StageCore = class extends EventEmitter {
|
|
|
171
171
|
* 标记的作用:1、高亮容器,给用户一个加入容器的交互感知;2、释放鼠标后,通过标记的标志找到要加入的容器
|
|
172
172
|
* @param event 鼠标事件
|
|
173
173
|
* @param excludeElList 计算鼠标所在容器时要排除的元素列表
|
|
174
|
+
* @param isAdd 当前操作是否为新增组件(从组件列表拖入),开启 containerHighlightAddOnly 时只有新增才会标记
|
|
174
175
|
* @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
|
|
175
176
|
*/
|
|
176
|
-
delayedMarkContainer(event, excludeElList = []) {
|
|
177
|
-
return this.actionManager?.delayedMarkContainer(event, excludeElList);
|
|
177
|
+
delayedMarkContainer(event, excludeElList = [], isAdd = false) {
|
|
178
|
+
return this.actionManager?.delayedMarkContainer(event, excludeElList, isAdd);
|
|
178
179
|
}
|
|
179
180
|
getMoveableOption(key) {
|
|
180
181
|
return this.actionManager?.getMoveableOption(key);
|
|
@@ -247,6 +248,7 @@ var StageCore = class extends EventEmitter {
|
|
|
247
248
|
containerHighlightClassName: config.containerHighlightClassName,
|
|
248
249
|
containerHighlightDuration: config.containerHighlightDuration,
|
|
249
250
|
containerHighlightType: config.containerHighlightType,
|
|
251
|
+
containerHighlightAddOnly: config.containerHighlightAddOnly,
|
|
250
252
|
moveableOptions: config.moveableOptions,
|
|
251
253
|
container: this.mask.content,
|
|
252
254
|
disabledDragStart: config.disabledDragStart,
|
|
@@ -3567,6 +3567,8 @@
|
|
|
3567
3567
|
containerHighlightDuration;
|
|
3568
3568
|
/** 将组件加入容器的操作方式 */
|
|
3569
3569
|
containerHighlightType;
|
|
3570
|
+
/** 是否仅在新增组件时才启用将组件加入容器 */
|
|
3571
|
+
containerHighlightAddOnly = false;
|
|
3570
3572
|
isAltKeydown = false;
|
|
3571
3573
|
getTargetElement;
|
|
3572
3574
|
getElementsFromPoint;
|
|
@@ -3600,6 +3602,7 @@
|
|
|
3600
3602
|
this.containerHighlightClassName = config.containerHighlightClassName || "tmagic-stage-container-highlight";
|
|
3601
3603
|
this.containerHighlightDuration = config.containerHighlightDuration || defaultContainerHighlightDuration;
|
|
3602
3604
|
this.containerHighlightType = config.containerHighlightType;
|
|
3605
|
+
this.containerHighlightAddOnly = config.containerHighlightAddOnly ?? false;
|
|
3603
3606
|
this.disabledMultiSelect = config.disabledMultiSelect ?? false;
|
|
3604
3607
|
this.alwaysMultiSelect = config.alwaysMultiSelect ?? false;
|
|
3605
3608
|
this.getTargetElement = config.getTargetElement;
|
|
@@ -3831,10 +3834,11 @@
|
|
|
3831
3834
|
* 标记的作用:1、高亮容器,给用户一个加入容器的交互感知;2、释放鼠标后,通过标记的标志找到要加入的容器
|
|
3832
3835
|
* @param event 鼠标事件
|
|
3833
3836
|
* @param excludeElList 计算鼠标所在容器时要排除的元素列表
|
|
3837
|
+
* @param isAdd 当前操作是否为新增组件(从组件列表拖入),开启 containerHighlightAddOnly 时只有新增才会标记
|
|
3834
3838
|
* @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
|
|
3835
3839
|
*/
|
|
3836
|
-
delayedMarkContainer(event, excludeElList = []) {
|
|
3837
|
-
if (this.canAddToContainer()) return globalThis.setTimeout(() => {
|
|
3840
|
+
delayedMarkContainer(event, excludeElList = [], isAdd = false) {
|
|
3841
|
+
if (this.canAddToContainer(isAdd)) return globalThis.setTimeout(() => {
|
|
3838
3842
|
this.addContainerHighlightClassName(event, excludeElList);
|
|
3839
3843
|
}, this.containerHighlightDuration);
|
|
3840
3844
|
}
|
|
@@ -3953,9 +3957,12 @@
|
|
|
3953
3957
|
} else this.selectedElList.push(el);
|
|
3954
3958
|
}
|
|
3955
3959
|
/**
|
|
3956
|
-
* 当前状态下能否将组件加入容器,默认是鼠标悬停一段时间加入,alt模式则是按住alt
|
|
3960
|
+
* 当前状态下能否将组件加入容器,默认是鼠标悬停一段时间加入,alt模式则是按住alt+鼠标悬停一段时间加入;
|
|
3961
|
+
* 开启containerHighlightAddOnly时,画布中拖动已有组件不能加入容器
|
|
3962
|
+
* @param isAdd 当前操作是否为新增组件
|
|
3957
3963
|
*/
|
|
3958
|
-
canAddToContainer() {
|
|
3964
|
+
canAddToContainer(isAdd = false) {
|
|
3965
|
+
if (this.containerHighlightAddOnly && !isAdd) return false;
|
|
3959
3966
|
return this.containerHighlightType === ContainerHighlightType.DEFAULT || this.containerHighlightType === ContainerHighlightType.ALT && this.isAltKeydown;
|
|
3960
3967
|
}
|
|
3961
3968
|
/**
|
|
@@ -3964,8 +3971,9 @@
|
|
|
3964
3971
|
*/
|
|
3965
3972
|
markContainerEnd() {
|
|
3966
3973
|
const doc = this.getRenderDocument();
|
|
3967
|
-
if (doc
|
|
3968
|
-
|
|
3974
|
+
if (!doc) return null;
|
|
3975
|
+
const markedContainer = (0, _tmagic_core.removeClassNameByClassName)(doc, this.containerHighlightClassName);
|
|
3976
|
+
return this.canAddToContainer() ? markedContainer : null;
|
|
3969
3977
|
}
|
|
3970
3978
|
initMouseEvent() {
|
|
3971
3979
|
this.container.addEventListener("mousedown", this.mouseDownHandler);
|
|
@@ -4901,10 +4909,11 @@
|
|
|
4901
4909
|
* 标记的作用:1、高亮容器,给用户一个加入容器的交互感知;2、释放鼠标后,通过标记的标志找到要加入的容器
|
|
4902
4910
|
* @param event 鼠标事件
|
|
4903
4911
|
* @param excludeElList 计算鼠标所在容器时要排除的元素列表
|
|
4912
|
+
* @param isAdd 当前操作是否为新增组件(从组件列表拖入),开启 containerHighlightAddOnly 时只有新增才会标记
|
|
4904
4913
|
* @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
|
|
4905
4914
|
*/
|
|
4906
|
-
delayedMarkContainer(event, excludeElList = []) {
|
|
4907
|
-
return this.actionManager?.delayedMarkContainer(event, excludeElList);
|
|
4915
|
+
delayedMarkContainer(event, excludeElList = [], isAdd = false) {
|
|
4916
|
+
return this.actionManager?.delayedMarkContainer(event, excludeElList, isAdd);
|
|
4908
4917
|
}
|
|
4909
4918
|
getMoveableOption(key) {
|
|
4910
4919
|
return this.actionManager?.getMoveableOption(key);
|
|
@@ -4977,6 +4986,7 @@
|
|
|
4977
4986
|
containerHighlightClassName: config.containerHighlightClassName,
|
|
4978
4987
|
containerHighlightDuration: config.containerHighlightDuration,
|
|
4979
4988
|
containerHighlightType: config.containerHighlightType,
|
|
4989
|
+
containerHighlightAddOnly: config.containerHighlightAddOnly,
|
|
4980
4990
|
moveableOptions: config.moveableOptions,
|
|
4981
4991
|
container: this.mask.content,
|
|
4982
4992
|
disabledDragStart: config.disabledDragStart,
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.8.0-beta.
|
|
2
|
+
"version": "1.8.0-beta.18",
|
|
3
3
|
"name": "@tmagic/stage",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
|
-
"@tmagic/core": "1.8.0-beta.
|
|
47
|
+
"@tmagic/core": "1.8.0-beta.18"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"typescript": {
|
package/src/ActionManager.ts
CHANGED
|
@@ -84,6 +84,8 @@ export default class ActionManager extends EventEmitter {
|
|
|
84
84
|
private containerHighlightDuration: number;
|
|
85
85
|
/** 将组件加入容器的操作方式 */
|
|
86
86
|
private containerHighlightType?: ContainerHighlightType;
|
|
87
|
+
/** 是否仅在新增组件时才启用将组件加入容器 */
|
|
88
|
+
private containerHighlightAddOnly = false;
|
|
87
89
|
private isAltKeydown = false;
|
|
88
90
|
private getTargetElement: GetTargetElement;
|
|
89
91
|
private getElementsFromPoint: GetElementsFromPoint;
|
|
@@ -124,6 +126,7 @@ export default class ActionManager extends EventEmitter {
|
|
|
124
126
|
this.containerHighlightClassName = config.containerHighlightClassName || CONTAINER_HIGHLIGHT_CLASS_NAME;
|
|
125
127
|
this.containerHighlightDuration = config.containerHighlightDuration || defaultContainerHighlightDuration;
|
|
126
128
|
this.containerHighlightType = config.containerHighlightType;
|
|
129
|
+
this.containerHighlightAddOnly = config.containerHighlightAddOnly ?? false;
|
|
127
130
|
this.disabledMultiSelect = config.disabledMultiSelect ?? false;
|
|
128
131
|
this.alwaysMultiSelect = config.alwaysMultiSelect ?? false;
|
|
129
132
|
this.getTargetElement = config.getTargetElement;
|
|
@@ -428,10 +431,15 @@ export default class ActionManager extends EventEmitter {
|
|
|
428
431
|
* 标记的作用:1、高亮容器,给用户一个加入容器的交互感知;2、释放鼠标后,通过标记的标志找到要加入的容器
|
|
429
432
|
* @param event 鼠标事件
|
|
430
433
|
* @param excludeElList 计算鼠标所在容器时要排除的元素列表
|
|
434
|
+
* @param isAdd 当前操作是否为新增组件(从组件列表拖入),开启 containerHighlightAddOnly 时只有新增才会标记
|
|
431
435
|
* @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
|
|
432
436
|
*/
|
|
433
|
-
public delayedMarkContainer(
|
|
434
|
-
|
|
437
|
+
public delayedMarkContainer(
|
|
438
|
+
event: MouseEvent,
|
|
439
|
+
excludeElList: Element[] = [],
|
|
440
|
+
isAdd = false,
|
|
441
|
+
): NodeJS.Timeout | undefined {
|
|
442
|
+
if (this.canAddToContainer(isAdd)) {
|
|
435
443
|
return globalThis.setTimeout(() => {
|
|
436
444
|
this.addContainerHighlightClassName(event, excludeElList);
|
|
437
445
|
}, this.containerHighlightDuration);
|
|
@@ -609,9 +617,13 @@ export default class ActionManager extends EventEmitter {
|
|
|
609
617
|
}
|
|
610
618
|
|
|
611
619
|
/**
|
|
612
|
-
* 当前状态下能否将组件加入容器,默认是鼠标悬停一段时间加入,alt模式则是按住alt
|
|
620
|
+
* 当前状态下能否将组件加入容器,默认是鼠标悬停一段时间加入,alt模式则是按住alt+鼠标悬停一段时间加入;
|
|
621
|
+
* 开启containerHighlightAddOnly时,画布中拖动已有组件不能加入容器
|
|
622
|
+
* @param isAdd 当前操作是否为新增组件
|
|
613
623
|
*/
|
|
614
|
-
private canAddToContainer(): boolean {
|
|
624
|
+
private canAddToContainer(isAdd = false): boolean {
|
|
625
|
+
if (this.containerHighlightAddOnly && !isAdd) return false;
|
|
626
|
+
|
|
615
627
|
return (
|
|
616
628
|
this.containerHighlightType === ContainerHighlightType.DEFAULT ||
|
|
617
629
|
(this.containerHighlightType === ContainerHighlightType.ALT && this.isAltKeydown)
|
|
@@ -624,10 +636,10 @@ export default class ActionManager extends EventEmitter {
|
|
|
624
636
|
*/
|
|
625
637
|
private markContainerEnd(): HTMLElement | null {
|
|
626
638
|
const doc = this.getRenderDocument();
|
|
627
|
-
if (doc
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
return null;
|
|
639
|
+
if (!doc) return null;
|
|
640
|
+
|
|
641
|
+
const markedContainer = removeClassNameByClassName(doc, this.containerHighlightClassName);
|
|
642
|
+
return this.canAddToContainer() ? markedContainer : null;
|
|
631
643
|
}
|
|
632
644
|
|
|
633
645
|
private initMouseEvent(): void {
|
package/src/StageCore.ts
CHANGED
|
@@ -263,10 +263,15 @@ export default class StageCore extends EventEmitter {
|
|
|
263
263
|
* 标记的作用:1、高亮容器,给用户一个加入容器的交互感知;2、释放鼠标后,通过标记的标志找到要加入的容器
|
|
264
264
|
* @param event 鼠标事件
|
|
265
265
|
* @param excludeElList 计算鼠标所在容器时要排除的元素列表
|
|
266
|
+
* @param isAdd 当前操作是否为新增组件(从组件列表拖入),开启 containerHighlightAddOnly 时只有新增才会标记
|
|
266
267
|
* @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
|
|
267
268
|
*/
|
|
268
|
-
public delayedMarkContainer(
|
|
269
|
-
|
|
269
|
+
public delayedMarkContainer(
|
|
270
|
+
event: MouseEvent,
|
|
271
|
+
excludeElList: Element[] = [],
|
|
272
|
+
isAdd = false,
|
|
273
|
+
): NodeJS.Timeout | undefined {
|
|
274
|
+
return this.actionManager?.delayedMarkContainer(event, excludeElList, isAdd);
|
|
270
275
|
}
|
|
271
276
|
|
|
272
277
|
public getMoveableOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K] | undefined {
|
|
@@ -368,6 +373,7 @@ export default class StageCore extends EventEmitter {
|
|
|
368
373
|
containerHighlightClassName: config.containerHighlightClassName,
|
|
369
374
|
containerHighlightDuration: config.containerHighlightDuration,
|
|
370
375
|
containerHighlightType: config.containerHighlightType,
|
|
376
|
+
containerHighlightAddOnly: config.containerHighlightAddOnly,
|
|
371
377
|
moveableOptions: config.moveableOptions,
|
|
372
378
|
container: this.mask!.content,
|
|
373
379
|
disabledDragStart: config.disabledDragStart,
|
package/src/types.ts
CHANGED
|
@@ -53,7 +53,11 @@ export type GetTargetElement = (id: Id) => HTMLElement | null;
|
|
|
53
53
|
/** render提供的接口,通过坐标获得坐标下所有HTML元素数组 */
|
|
54
54
|
export type GetElementsFromPoint = (point: Point) => HTMLElement[];
|
|
55
55
|
export type GetRenderDocument = () => Document | undefined;
|
|
56
|
-
export type DelayedMarkContainer = (
|
|
56
|
+
export type DelayedMarkContainer = (
|
|
57
|
+
event: MouseEvent,
|
|
58
|
+
exclude?: Element[],
|
|
59
|
+
isAdd?: boolean,
|
|
60
|
+
) => NodeJS.Timeout | undefined;
|
|
57
61
|
export type MarkContainerEnd = () => HTMLElement | null;
|
|
58
62
|
export type GetRootContainer = () => HTMLDivElement | undefined;
|
|
59
63
|
|
|
@@ -74,6 +78,11 @@ export interface StageCoreConfig {
|
|
|
74
78
|
containerHighlightClassName?: string;
|
|
75
79
|
containerHighlightDuration?: number;
|
|
76
80
|
containerHighlightType?: ContainerHighlightType;
|
|
81
|
+
/**
|
|
82
|
+
* 是否仅在新增组件(从组件列表拖入新组件)时才启用将组件拖入容器,
|
|
83
|
+
* 开启后在画布中拖动已有组件不会识别容器,默认 false
|
|
84
|
+
*/
|
|
85
|
+
containerHighlightAddOnly?: boolean;
|
|
77
86
|
moveableOptions?: CustomizeMoveableOptions;
|
|
78
87
|
/** runtime 的HTML地址,可以是一个HTTP地址,如果和编辑器不同域,需要设置跨域,也可以是一个相对或绝对路径 */
|
|
79
88
|
runtimeUrl?: string;
|
|
@@ -102,6 +111,8 @@ export interface ActionManagerConfig {
|
|
|
102
111
|
containerHighlightClassName?: string;
|
|
103
112
|
containerHighlightDuration?: number;
|
|
104
113
|
containerHighlightType?: ContainerHighlightType;
|
|
114
|
+
/** 见 StageCoreConfig.containerHighlightAddOnly */
|
|
115
|
+
containerHighlightAddOnly?: boolean;
|
|
105
116
|
moveableOptions?: CustomizeMoveableOptions;
|
|
106
117
|
disabledDragStart?: boolean;
|
|
107
118
|
disabledMultiSelect?: boolean;
|
package/types/index.d.ts
CHANGED
|
@@ -182,7 +182,7 @@ type GetTargetElement = (id: Id) => HTMLElement | null;
|
|
|
182
182
|
/** render提供的接口,通过坐标获得坐标下所有HTML元素数组 */
|
|
183
183
|
type GetElementsFromPoint = (point: Point) => HTMLElement[];
|
|
184
184
|
type GetRenderDocument = () => Document | undefined;
|
|
185
|
-
type DelayedMarkContainer = (event: MouseEvent, exclude
|
|
185
|
+
type DelayedMarkContainer = (event: MouseEvent, exclude?: Element[], isAdd?: boolean) => NodeJS.Timeout | undefined;
|
|
186
186
|
type MarkContainerEnd = () => HTMLElement | null;
|
|
187
187
|
type GetRootContainer = () => HTMLDivElement | undefined;
|
|
188
188
|
type UpdateDragEl = (el: TargetElement, target: TargetElement, container: HTMLElement) => void;
|
|
@@ -201,6 +201,11 @@ interface StageCoreConfig {
|
|
|
201
201
|
containerHighlightClassName?: string;
|
|
202
202
|
containerHighlightDuration?: number;
|
|
203
203
|
containerHighlightType?: ContainerHighlightType;
|
|
204
|
+
/**
|
|
205
|
+
* 是否仅在新增组件(从组件列表拖入新组件)时才启用将组件拖入容器,
|
|
206
|
+
* 开启后在画布中拖动已有组件不会识别容器,默认 false
|
|
207
|
+
*/
|
|
208
|
+
containerHighlightAddOnly?: boolean;
|
|
204
209
|
moveableOptions?: CustomizeMoveableOptions;
|
|
205
210
|
/** runtime 的HTML地址,可以是一个HTTP地址,如果和编辑器不同域,需要设置跨域,也可以是一个相对或绝对路径 */
|
|
206
211
|
runtimeUrl?: string;
|
|
@@ -228,6 +233,8 @@ interface ActionManagerConfig {
|
|
|
228
233
|
containerHighlightClassName?: string;
|
|
229
234
|
containerHighlightDuration?: number;
|
|
230
235
|
containerHighlightType?: ContainerHighlightType;
|
|
236
|
+
/** 见 StageCoreConfig.containerHighlightAddOnly */
|
|
237
|
+
containerHighlightAddOnly?: boolean;
|
|
231
238
|
moveableOptions?: CustomizeMoveableOptions;
|
|
232
239
|
disabledDragStart?: boolean;
|
|
233
240
|
disabledMultiSelect?: boolean;
|
|
@@ -467,6 +474,8 @@ declare class ActionManager extends EventEmitter$1 {
|
|
|
467
474
|
private containerHighlightDuration;
|
|
468
475
|
/** 将组件加入容器的操作方式 */
|
|
469
476
|
private containerHighlightType?;
|
|
477
|
+
/** 是否仅在新增组件时才启用将组件加入容器 */
|
|
478
|
+
private containerHighlightAddOnly;
|
|
470
479
|
private isAltKeydown;
|
|
471
480
|
private getTargetElement;
|
|
472
481
|
private getElementsFromPoint;
|
|
@@ -557,9 +566,10 @@ declare class ActionManager extends EventEmitter$1 {
|
|
|
557
566
|
* 标记的作用:1、高亮容器,给用户一个加入容器的交互感知;2、释放鼠标后,通过标记的标志找到要加入的容器
|
|
558
567
|
* @param event 鼠标事件
|
|
559
568
|
* @param excludeElList 计算鼠标所在容器时要排除的元素列表
|
|
569
|
+
* @param isAdd 当前操作是否为新增组件(从组件列表拖入),开启 containerHighlightAddOnly 时只有新增才会标记
|
|
560
570
|
* @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
|
|
561
571
|
*/
|
|
562
|
-
delayedMarkContainer(event: MouseEvent, excludeElList?: Element[]): NodeJS.Timeout | undefined;
|
|
572
|
+
delayedMarkContainer(event: MouseEvent, excludeElList?: Element[], isAdd?: boolean): NodeJS.Timeout | undefined;
|
|
563
573
|
getDragStatus(): StageDragStatus | undefined;
|
|
564
574
|
updateMoveableOptions(): void;
|
|
565
575
|
destroy(): void;
|
|
@@ -575,7 +585,9 @@ declare class ActionManager extends EventEmitter$1 {
|
|
|
575
585
|
*/
|
|
576
586
|
private beforeMultiSelect;
|
|
577
587
|
/**
|
|
578
|
-
* 当前状态下能否将组件加入容器,默认是鼠标悬停一段时间加入,alt模式则是按住alt
|
|
588
|
+
* 当前状态下能否将组件加入容器,默认是鼠标悬停一段时间加入,alt模式则是按住alt+鼠标悬停一段时间加入;
|
|
589
|
+
* 开启containerHighlightAddOnly时,画布中拖动已有组件不能加入容器
|
|
590
|
+
* @param isAdd 当前操作是否为新增组件
|
|
579
591
|
*/
|
|
580
592
|
private canAddToContainer;
|
|
581
593
|
/**
|
|
@@ -891,9 +903,10 @@ declare class StageCore extends EventEmitter {
|
|
|
891
903
|
* 标记的作用:1、高亮容器,给用户一个加入容器的交互感知;2、释放鼠标后,通过标记的标志找到要加入的容器
|
|
892
904
|
* @param event 鼠标事件
|
|
893
905
|
* @param excludeElList 计算鼠标所在容器时要排除的元素列表
|
|
906
|
+
* @param isAdd 当前操作是否为新增组件(从组件列表拖入),开启 containerHighlightAddOnly 时只有新增才会标记
|
|
894
907
|
* @returns timeoutId,调用方在鼠标移走时要取消该timeout,阻止标记
|
|
895
908
|
*/
|
|
896
|
-
delayedMarkContainer(event: MouseEvent, excludeElList?: Element[]): NodeJS.Timeout | undefined;
|
|
909
|
+
delayedMarkContainer(event: MouseEvent, excludeElList?: Element[], isAdd?: boolean): NodeJS.Timeout | undefined;
|
|
897
910
|
getMoveableOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K] | undefined;
|
|
898
911
|
getDragStatus(): import("@tmagic/editor").StageDragStatus | undefined;
|
|
899
912
|
disableMultiSelect(): void;
|