@tmagic/editor 1.7.14-beta.3 → 1.8.0-beta.1
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/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +11 -2
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +10 -2
- package/dist/es/fields/StyleSetter/components/Box.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +10 -2
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +16 -3
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +10 -2
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +14 -2
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +10 -2
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +10 -2
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/layer/use-node-status.js +37 -3
- package/dist/es/services/editor.js +58 -27
- package/dist/es/style.css +15 -14
- package/dist/es/utils/editor.js +1 -1
- package/dist/style.css +15 -14
- package/dist/tmagic-editor.umd.cjs +199 -52
- package/package.json +7 -7
- package/src/fields/DataSourceFieldSelect/Index.vue +8 -1
- package/src/fields/StyleSetter/Index.vue +6 -0
- package/src/fields/StyleSetter/components/Border.vue +15 -1
- package/src/fields/StyleSetter/components/Box.vue +2 -0
- package/src/fields/StyleSetter/pro/Background.vue +15 -1
- package/src/fields/StyleSetter/pro/Border.vue +24 -2
- package/src/fields/StyleSetter/pro/Font.vue +15 -1
- package/src/fields/StyleSetter/pro/Layout.vue +17 -1
- package/src/fields/StyleSetter/pro/Position.vue +15 -1
- package/src/fields/StyleSetter/pro/Transform.vue +15 -1
- package/src/layouts/props-panel/FormPanel.vue +1 -1
- package/src/layouts/sidebar/layer/use-node-status.ts +55 -6
- package/src/services/editor.ts +74 -43
- package/src/theme/props-panel.scss +20 -20
- package/src/type.ts +10 -0
- package/src/utils/editor.ts +4 -1
- package/types/index.d.ts +31 -22
package/src/services/editor.ts
CHANGED
|
@@ -33,6 +33,7 @@ import type {
|
|
|
33
33
|
AddMNode,
|
|
34
34
|
AsyncHookPlugin,
|
|
35
35
|
AsyncMethodName,
|
|
36
|
+
DslOpOptions,
|
|
36
37
|
EditorEvents,
|
|
37
38
|
EditorNodeInfo,
|
|
38
39
|
HistoryOpType,
|
|
@@ -191,6 +192,22 @@ class Editor extends BaseService {
|
|
|
191
192
|
return parent;
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
/**
|
|
196
|
+
* 判断给定节点是否位于非当前页面(即选中该节点将会引起当前页面切换)
|
|
197
|
+
* @param node 节点
|
|
198
|
+
* @returns true 表示该节点位于非当前页面
|
|
199
|
+
*/
|
|
200
|
+
public isOnDifferentPage(node: MNode): boolean {
|
|
201
|
+
const currentPageId = this.get('page')?.id;
|
|
202
|
+
if (currentPageId === undefined || currentPageId === null) return false;
|
|
203
|
+
if (isPage(node) || isPageFragment(node)) {
|
|
204
|
+
return `${node.id}` !== `${currentPageId}`;
|
|
205
|
+
}
|
|
206
|
+
const nodePage = this.getNodeInfo(node.id, false).page;
|
|
207
|
+
if (!nodePage) return false;
|
|
208
|
+
return `${nodePage.id}` !== `${currentPageId}`;
|
|
209
|
+
}
|
|
210
|
+
|
|
194
211
|
/**
|
|
195
212
|
* 只有容器拥有布局
|
|
196
213
|
*/
|
|
@@ -370,15 +387,16 @@ class Editor extends BaseService {
|
|
|
370
387
|
* @param parent 要添加到的容器组件节点配置,如果不设置,默认为当前选中的组件的父节点
|
|
371
388
|
* @param options 可选配置
|
|
372
389
|
* @param options.doNotSelect 添加后是否不更新当前选中节点(默认 false,添加后会选中新增的节点)
|
|
390
|
+
* @param options.doNotSwitchPage 添加后是否不切换当前页面(默认 false;新增页面 / 跨页新增时为 true 会跳过会引发页面切换的选中操作)
|
|
373
391
|
* @returns 添加后的节点
|
|
374
392
|
*/
|
|
375
393
|
public async add(
|
|
376
394
|
addNode: AddMNode | MNode[],
|
|
377
395
|
parent?: MContainer | null,
|
|
378
|
-
options?:
|
|
396
|
+
options?: DslOpOptions,
|
|
379
397
|
): Promise<MNode | MNode[]> {
|
|
380
398
|
const safeParentNode = safeParent(parent);
|
|
381
|
-
const { doNotSelect = false } = safeOptions<
|
|
399
|
+
const { doNotSelect = false, doNotSwitchPage = false } = safeOptions<DslOpOptions>(options);
|
|
382
400
|
|
|
383
401
|
this.captureSelectionBeforeOp();
|
|
384
402
|
|
|
@@ -409,14 +427,19 @@ class Editor extends BaseService {
|
|
|
409
427
|
);
|
|
410
428
|
|
|
411
429
|
if (newNodes.length > 1) {
|
|
412
|
-
|
|
430
|
+
// 多选时只要任一新增节点位于非当前页面,触发的 multiSelect 就会引起页面切换
|
|
431
|
+
const wouldSwitchPage = newNodes.some((n) => this.isOnDifferentPage(n));
|
|
432
|
+
if (!doNotSelect && !(doNotSwitchPage && wouldSwitchPage)) {
|
|
413
433
|
const newNodeIds = newNodes.map((node) => node.id);
|
|
414
434
|
// 触发选中样式
|
|
415
435
|
stage?.multiSelect(newNodeIds);
|
|
416
436
|
await this.multiSelect(newNodeIds);
|
|
417
437
|
}
|
|
418
438
|
} else {
|
|
419
|
-
|
|
439
|
+
const wouldSwitchPage = this.isOnDifferentPage(newNodes[0]);
|
|
440
|
+
const skipSelect = doNotSelect || (doNotSwitchPage && wouldSwitchPage);
|
|
441
|
+
|
|
442
|
+
if (!skipSelect) {
|
|
420
443
|
await this.select(newNodes[0]);
|
|
421
444
|
}
|
|
422
445
|
|
|
@@ -424,7 +447,7 @@ class Editor extends BaseService {
|
|
|
424
447
|
this.state.pageLength += 1;
|
|
425
448
|
} else if (isPageFragment(newNodes[0])) {
|
|
426
449
|
this.state.pageFragmentLength += 1;
|
|
427
|
-
} else if (!
|
|
450
|
+
} else if (!skipSelect) {
|
|
428
451
|
// 新增页面,这个时候页面还有渲染出来,此时select会出错,在runtime-ready的时候回去select
|
|
429
452
|
stage?.select(newNodes[0].id);
|
|
430
453
|
}
|
|
@@ -453,8 +476,8 @@ class Editor extends BaseService {
|
|
|
453
476
|
return Array.isArray(addNode) ? newNodes : newNodes[0];
|
|
454
477
|
}
|
|
455
478
|
|
|
456
|
-
public async doRemove(node: MNode, options?:
|
|
457
|
-
const { doNotSelect = false } = safeOptions<
|
|
479
|
+
public async doRemove(node: MNode, options?: DslOpOptions): Promise<void> {
|
|
480
|
+
const { doNotSelect = false, doNotSwitchPage = false } = safeOptions<DslOpOptions>(options);
|
|
458
481
|
|
|
459
482
|
const root = this.get('root');
|
|
460
483
|
if (!root) throw new Error('root不能为空');
|
|
@@ -471,21 +494,19 @@ class Editor extends BaseService {
|
|
|
471
494
|
const stage = this.get('stage');
|
|
472
495
|
stage?.remove({ id: node.id, parentId: parent.id, root: cloneDeep(root) });
|
|
473
496
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
this.set('page', null);
|
|
488
|
-
}
|
|
497
|
+
// 始终清理已删除节点在 state 中的残留引用:
|
|
498
|
+
// - 即使后续会调用 selectDefault / select(parent) 覆盖,跳过这些调用(doNotSelect / doNotSwitchPage)时也不能让 state 持有已删除节点
|
|
499
|
+
const selectedNodes = this.get('nodes');
|
|
500
|
+
const removedSelectedIndex = selectedNodes.findIndex((n: MNode) => `${n.id}` === `${node.id}`);
|
|
501
|
+
if (removedSelectedIndex !== -1) {
|
|
502
|
+
const nextSelected = [...selectedNodes];
|
|
503
|
+
nextSelected.splice(removedSelectedIndex, 1);
|
|
504
|
+
this.set('nodes', nextSelected);
|
|
505
|
+
}
|
|
506
|
+
if (isPage(node) || isPageFragment(node)) {
|
|
507
|
+
const currentPage = this.get('page');
|
|
508
|
+
if (currentPage && `${currentPage.id}` === `${node.id}`) {
|
|
509
|
+
this.set('page', null);
|
|
489
510
|
}
|
|
490
511
|
}
|
|
491
512
|
|
|
@@ -505,13 +526,14 @@ class Editor extends BaseService {
|
|
|
505
526
|
if (isPage(node)) {
|
|
506
527
|
this.state.pageLength -= 1;
|
|
507
528
|
|
|
508
|
-
|
|
529
|
+
// 删除页面后默认会切到首个剩余页面(selectDefault),doNotSwitchPage 时跳过这次自动切换
|
|
530
|
+
if (!doNotSelect && !doNotSwitchPage) {
|
|
509
531
|
await selectDefault(rootItems);
|
|
510
532
|
}
|
|
511
533
|
} else if (isPageFragment(node)) {
|
|
512
534
|
this.state.pageFragmentLength -= 1;
|
|
513
535
|
|
|
514
|
-
if (!doNotSelect) {
|
|
536
|
+
if (!doNotSelect && !doNotSwitchPage) {
|
|
515
537
|
await selectDefault(rootItems);
|
|
516
538
|
}
|
|
517
539
|
} else {
|
|
@@ -534,9 +556,10 @@ class Editor extends BaseService {
|
|
|
534
556
|
* @param {Object} node 要删除的节点或节点集合
|
|
535
557
|
* @param options 可选配置
|
|
536
558
|
* @param options.doNotSelect 删除后是否不更新当前选中节点(默认 false,删除后会选中父节点或首个页面)
|
|
559
|
+
* @param options.doNotSwitchPage 删除后是否不切换当前页面(默认 false;删除页面 / 页面片段时为 true 会跳过自动切换到首个剩余页面)
|
|
537
560
|
*/
|
|
538
|
-
public async remove(nodeOrNodeList: MNode | MNode[], options?:
|
|
539
|
-
const { doNotSelect = false } = safeOptions<
|
|
561
|
+
public async remove(nodeOrNodeList: MNode | MNode[], options?: DslOpOptions): Promise<void> {
|
|
562
|
+
const { doNotSelect = false, doNotSwitchPage = false } = safeOptions<DslOpOptions>(options);
|
|
540
563
|
|
|
541
564
|
this.captureSelectionBeforeOp();
|
|
542
565
|
|
|
@@ -561,7 +584,7 @@ class Editor extends BaseService {
|
|
|
561
584
|
}
|
|
562
585
|
}
|
|
563
586
|
|
|
564
|
-
await Promise.all(nodes.map((node) => this.doRemove(node, { doNotSelect })));
|
|
587
|
+
await Promise.all(nodes.map((node) => this.doRemove(node, { doNotSelect, doNotSwitchPage })));
|
|
565
588
|
|
|
566
589
|
if (removedItems.length > 0 && pageForOp) {
|
|
567
590
|
this.pushOpHistory('remove', { removedItems }, pageForOp);
|
|
@@ -624,8 +647,12 @@ class Editor extends BaseService {
|
|
|
624
647
|
this.set('nodes', [...selectedNodes]);
|
|
625
648
|
}
|
|
626
649
|
|
|
650
|
+
// 只有被更新节点正好是当前选中页面时才同步 state.page,避免「更新非当前页」误将编辑器切到该页
|
|
627
651
|
if (isPage(newConfig) || isPageFragment(newConfig)) {
|
|
628
|
-
this.
|
|
652
|
+
const currentPage = this.get('page');
|
|
653
|
+
if (currentPage && `${currentPage.id}` === `${newConfig.id}`) {
|
|
654
|
+
this.set('page', newConfig as MPage | MPageFragment);
|
|
655
|
+
}
|
|
629
656
|
}
|
|
630
657
|
|
|
631
658
|
this.addModifiedNodeId(newConfig.id);
|
|
@@ -681,10 +708,11 @@ class Editor extends BaseService {
|
|
|
681
708
|
* @param id2 组件ID
|
|
682
709
|
* @param options 可选配置
|
|
683
710
|
* @param options.doNotSelect 排序后是否不更新当前选中节点(默认 false)
|
|
711
|
+
* @param options.doNotSwitchPage 排序后是否不切换当前页面(排序只发生在同一父节点内,方法内为空操作;保留以与其它 DSL 操作 API 一致)
|
|
684
712
|
* @returns void
|
|
685
713
|
*/
|
|
686
|
-
public async sort(id1: Id, id2: Id, options?:
|
|
687
|
-
const { doNotSelect = false } = safeOptions<
|
|
714
|
+
public async sort(id1: Id, id2: Id, options?: DslOpOptions): Promise<void> {
|
|
715
|
+
const { doNotSelect = false } = safeOptions<DslOpOptions>(options);
|
|
688
716
|
|
|
689
717
|
this.captureSelectionBeforeOp();
|
|
690
718
|
|
|
@@ -750,14 +778,15 @@ class Editor extends BaseService {
|
|
|
750
778
|
* @param collectorOptions 可选的依赖收集器配置
|
|
751
779
|
* @param options 可选配置
|
|
752
780
|
* @param options.doNotSelect 粘贴后是否不更新当前选中节点(默认 false)
|
|
781
|
+
* @param options.doNotSwitchPage 粘贴后是否不切换当前页面(默认 false;跨页粘贴时为 true 会跳过页面切换)
|
|
753
782
|
* @returns 添加后的组件节点配置
|
|
754
783
|
*/
|
|
755
784
|
public async paste(
|
|
756
785
|
position: PastePosition = {},
|
|
757
786
|
collectorOptions?: TargetOptions,
|
|
758
|
-
options?:
|
|
787
|
+
options?: DslOpOptions,
|
|
759
788
|
): Promise<MNode | MNode[] | void> {
|
|
760
|
-
const { doNotSelect = false } = safeOptions<
|
|
789
|
+
const { doNotSelect = false, doNotSwitchPage = false } = safeOptions<DslOpOptions>(options);
|
|
761
790
|
|
|
762
791
|
const config: MNode[] = storageService.getItem(COPY_STORAGE_KEY);
|
|
763
792
|
if (!Array.isArray(config)) return;
|
|
@@ -778,7 +807,7 @@ class Editor extends BaseService {
|
|
|
778
807
|
propsService.replaceRelateId(config, pasteConfigs, collectorOptions);
|
|
779
808
|
}
|
|
780
809
|
|
|
781
|
-
return this.add(pasteConfigs, parent, { doNotSelect });
|
|
810
|
+
return this.add(pasteConfigs, parent, { doNotSelect, doNotSwitchPage });
|
|
782
811
|
}
|
|
783
812
|
|
|
784
813
|
public async doPaste(config: MNode[], position: PastePosition = {}): Promise<MNode[]> {
|
|
@@ -808,10 +837,11 @@ class Editor extends BaseService {
|
|
|
808
837
|
* @param config 组件节点配置
|
|
809
838
|
* @param options 可选配置
|
|
810
839
|
* @param options.doNotSelect 居中后是否不更新当前选中节点(默认 false)
|
|
840
|
+
* @param options.doNotSwitchPage 居中后是否不切换当前页面(居中只更新节点 style,方法内为空操作;保留以与其它 DSL 操作 API 一致)
|
|
811
841
|
* @returns 当前组件节点配置
|
|
812
842
|
*/
|
|
813
|
-
public async alignCenter(config: MNode | MNode[], options?:
|
|
814
|
-
const { doNotSelect = false } = safeOptions<
|
|
843
|
+
public async alignCenter(config: MNode | MNode[], options?: DslOpOptions): Promise<MNode | MNode[]> {
|
|
844
|
+
const { doNotSelect = false } = safeOptions<DslOpOptions>(options);
|
|
815
845
|
|
|
816
846
|
const nodes = Array.isArray(config) ? config : [config];
|
|
817
847
|
const stage = this.get('stage');
|
|
@@ -890,13 +920,10 @@ class Editor extends BaseService {
|
|
|
890
920
|
* @param targetId 容器ID
|
|
891
921
|
* @param options 可选配置
|
|
892
922
|
* @param options.doNotSelect 移动后是否不更新当前选中节点(默认 false)
|
|
923
|
+
* @param options.doNotSwitchPage 移动后是否不切换当前页面(默认 false;目标容器位于其它页面时为 true 会跳过自动选中以避免页面切换)
|
|
893
924
|
*/
|
|
894
|
-
public async moveToContainer(
|
|
895
|
-
|
|
896
|
-
targetId: Id,
|
|
897
|
-
options?: { doNotSelect?: boolean },
|
|
898
|
-
): Promise<MNode | undefined> {
|
|
899
|
-
const { doNotSelect = false } = safeOptions<{ doNotSelect?: boolean }>(options);
|
|
925
|
+
public async moveToContainer(config: MNode, targetId: Id, options?: DslOpOptions): Promise<MNode | undefined> {
|
|
926
|
+
const { doNotSelect = false, doNotSwitchPage = false } = safeOptions<DslOpOptions>(options);
|
|
900
927
|
|
|
901
928
|
this.captureSelectionBeforeOp();
|
|
902
929
|
|
|
@@ -925,7 +952,11 @@ class Editor extends BaseService {
|
|
|
925
952
|
|
|
926
953
|
target.items.push(newConfig);
|
|
927
954
|
|
|
928
|
-
|
|
955
|
+
// 目标容器是否在非当前页面:选中目标会触发当前页面切换
|
|
956
|
+
const targetWouldSwitchPage = this.isOnDifferentPage(target);
|
|
957
|
+
const skipSelect = doNotSelect || (doNotSwitchPage && targetWouldSwitchPage);
|
|
958
|
+
|
|
959
|
+
if (!skipSelect) {
|
|
929
960
|
await stage.select(targetId);
|
|
930
961
|
}
|
|
931
962
|
|
|
@@ -936,7 +967,7 @@ class Editor extends BaseService {
|
|
|
936
967
|
root: cloneDeep(root),
|
|
937
968
|
});
|
|
938
969
|
|
|
939
|
-
if (!
|
|
970
|
+
if (!skipSelect) {
|
|
940
971
|
await this.select(newConfig);
|
|
941
972
|
stage.select(newConfig.id);
|
|
942
973
|
}
|
|
@@ -25,26 +25,6 @@
|
|
|
25
25
|
right: calc(15px + var(--props-style-panel-width));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
.tmagic-design-form {
|
|
30
|
-
padding-right: 10px;
|
|
31
|
-
padding-left: 10px;
|
|
32
|
-
|
|
33
|
-
> .m-container-tab {
|
|
34
|
-
> .tmagic-design-tabs {
|
|
35
|
-
> .el-tabs__content {
|
|
36
|
-
padding-top: 55px;
|
|
37
|
-
}
|
|
38
|
-
> .el-tabs__header.is-top {
|
|
39
|
-
position: absolute;
|
|
40
|
-
top: 0;
|
|
41
|
-
width: 100%;
|
|
42
|
-
background: #fff;
|
|
43
|
-
z-index: 3;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
28
|
}
|
|
49
29
|
|
|
50
30
|
.m-editor-props-style-panel {
|
|
@@ -142,6 +122,26 @@
|
|
|
142
122
|
}
|
|
143
123
|
}
|
|
144
124
|
|
|
125
|
+
.m-editor-props-form-panel-form {
|
|
126
|
+
padding-right: 10px;
|
|
127
|
+
padding-left: 10px;
|
|
128
|
+
|
|
129
|
+
> .m-container-tab {
|
|
130
|
+
> .tmagic-design-tabs {
|
|
131
|
+
> .el-tabs__content {
|
|
132
|
+
padding-top: 55px;
|
|
133
|
+
}
|
|
134
|
+
> .el-tabs__header.is-top {
|
|
135
|
+
position: absolute;
|
|
136
|
+
top: 0;
|
|
137
|
+
width: 100%;
|
|
138
|
+
background: #fff;
|
|
139
|
+
z-index: 3;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
145
|
.m-editor-props-panel-popper {
|
|
146
146
|
&.small {
|
|
147
147
|
span,
|
package/src/type.ts
CHANGED
|
@@ -873,3 +873,13 @@ export const canUsePluginMethods = {
|
|
|
873
873
|
};
|
|
874
874
|
|
|
875
875
|
export type AsyncMethodName = Writable<(typeof canUsePluginMethods)['async']>;
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* DSL 修改类操作的通用配置
|
|
879
|
+
* - doNotSelect: 操作后是否不要自动触发选中(不调用 this.select / this.multiSelect / stage.select / stage.multiSelect)
|
|
880
|
+
* - doNotSwitchPage: 操作若会引发当前页面切换(如新增 / 删除 / 跨页移动),是否跳过这次切换
|
|
881
|
+
*/
|
|
882
|
+
export type DslOpOptions = {
|
|
883
|
+
doNotSelect?: boolean;
|
|
884
|
+
doNotSwitchPage?: boolean;
|
|
885
|
+
};
|
package/src/utils/editor.ts
CHANGED
|
@@ -324,11 +324,14 @@ export const fixNodePosition = (config: MNode, parent: MContainer, stage: StageC
|
|
|
324
324
|
};
|
|
325
325
|
|
|
326
326
|
// 序列化配置
|
|
327
|
+
// 仅去掉对象 key 的双引号;字符串值内的 "xxx": 不应被误处理
|
|
328
|
+
// serialize-javascript 在 space: 2 时,每个 key 都会出现在换行 + 空白缩进之后,
|
|
329
|
+
// 因此通过 (^|\n)\s* 锚定行首缩进,避免匹配到字符串值中的 \"xxx\":
|
|
327
330
|
export const serializeConfig = (config: any) =>
|
|
328
331
|
serialize(config, {
|
|
329
332
|
space: 2,
|
|
330
333
|
unsafe: true,
|
|
331
|
-
}).replace(/"(\w+)":\s/g, '$1: ');
|
|
334
|
+
}).replace(/(^|\n)(\s*)"(\w+)":\s/g, '$1$2$3: ');
|
|
332
335
|
|
|
333
336
|
export const moveItemsInContainer = (sourceIndices: number[], parent: MContainer, targetIndex: number) => {
|
|
334
337
|
sourceIndices.sort((a, b) => a - b);
|
package/types/index.d.ts
CHANGED
|
@@ -375,6 +375,12 @@ declare class Editor extends export_default {
|
|
|
375
375
|
* @returns 指点组件的父节点配置
|
|
376
376
|
*/
|
|
377
377
|
getParentById(id: Id, raw?: boolean): MContainer | null;
|
|
378
|
+
/**
|
|
379
|
+
* 判断给定节点是否位于非当前页面(即选中该节点将会引起当前页面切换)
|
|
380
|
+
* @param node 节点
|
|
381
|
+
* @returns true 表示该节点位于非当前页面
|
|
382
|
+
*/
|
|
383
|
+
isOnDifferentPage(node: MNode): boolean;
|
|
378
384
|
/**
|
|
379
385
|
* 只有容器拥有布局
|
|
380
386
|
*/
|
|
@@ -407,23 +413,19 @@ declare class Editor extends export_default {
|
|
|
407
413
|
* @param parent 要添加到的容器组件节点配置,如果不设置,默认为当前选中的组件的父节点
|
|
408
414
|
* @param options 可选配置
|
|
409
415
|
* @param options.doNotSelect 添加后是否不更新当前选中节点(默认 false,添加后会选中新增的节点)
|
|
416
|
+
* @param options.doNotSwitchPage 添加后是否不切换当前页面(默认 false;新增页面 / 跨页新增时为 true 会跳过会引发页面切换的选中操作)
|
|
410
417
|
* @returns 添加后的节点
|
|
411
418
|
*/
|
|
412
|
-
add(addNode: AddMNode | MNode[], parent?: MContainer | null, options?:
|
|
413
|
-
|
|
414
|
-
}): Promise<MNode | MNode[]>;
|
|
415
|
-
doRemove(node: MNode, options?: {
|
|
416
|
-
doNotSelect?: boolean;
|
|
417
|
-
}): Promise<void>;
|
|
419
|
+
add(addNode: AddMNode | MNode[], parent?: MContainer | null, options?: DslOpOptions): Promise<MNode | MNode[]>;
|
|
420
|
+
doRemove(node: MNode, options?: DslOpOptions): Promise<void>;
|
|
418
421
|
/**
|
|
419
422
|
* 删除组件
|
|
420
423
|
* @param {Object} node 要删除的节点或节点集合
|
|
421
424
|
* @param options 可选配置
|
|
422
425
|
* @param options.doNotSelect 删除后是否不更新当前选中节点(默认 false,删除后会选中父节点或首个页面)
|
|
426
|
+
* @param options.doNotSwitchPage 删除后是否不切换当前页面(默认 false;删除页面 / 页面片段时为 true 会跳过自动切换到首个剩余页面)
|
|
423
427
|
*/
|
|
424
|
-
remove(nodeOrNodeList: MNode | MNode[], options?:
|
|
425
|
-
doNotSelect?: boolean;
|
|
426
|
-
}): Promise<void>;
|
|
428
|
+
remove(nodeOrNodeList: MNode | MNode[], options?: DslOpOptions): Promise<void>;
|
|
427
429
|
doUpdate(config: MNode, {
|
|
428
430
|
changeRecords
|
|
429
431
|
}?: {
|
|
@@ -448,11 +450,10 @@ declare class Editor extends export_default {
|
|
|
448
450
|
* @param id2 组件ID
|
|
449
451
|
* @param options 可选配置
|
|
450
452
|
* @param options.doNotSelect 排序后是否不更新当前选中节点(默认 false)
|
|
453
|
+
* @param options.doNotSwitchPage 排序后是否不切换当前页面(排序只发生在同一父节点内,方法内为空操作;保留以与其它 DSL 操作 API 一致)
|
|
451
454
|
* @returns void
|
|
452
455
|
*/
|
|
453
|
-
sort(id1: Id, id2: Id, options?:
|
|
454
|
-
doNotSelect?: boolean;
|
|
455
|
-
}): Promise<void>;
|
|
456
|
+
sort(id1: Id, id2: Id, options?: DslOpOptions): Promise<void>;
|
|
456
457
|
/**
|
|
457
458
|
* 将组件节点配置存储到localStorage中
|
|
458
459
|
* @param config 组件节点配置
|
|
@@ -471,11 +472,10 @@ declare class Editor extends export_default {
|
|
|
471
472
|
* @param collectorOptions 可选的依赖收集器配置
|
|
472
473
|
* @param options 可选配置
|
|
473
474
|
* @param options.doNotSelect 粘贴后是否不更新当前选中节点(默认 false)
|
|
475
|
+
* @param options.doNotSwitchPage 粘贴后是否不切换当前页面(默认 false;跨页粘贴时为 true 会跳过页面切换)
|
|
474
476
|
* @returns 添加后的组件节点配置
|
|
475
477
|
*/
|
|
476
|
-
paste(position?: PastePosition, collectorOptions?: TargetOptions, options?:
|
|
477
|
-
doNotSelect?: boolean;
|
|
478
|
-
}): Promise<MNode | MNode[] | void>;
|
|
478
|
+
paste(position?: PastePosition, collectorOptions?: TargetOptions, options?: DslOpOptions): Promise<MNode | MNode[] | void>;
|
|
479
479
|
doPaste(config: MNode[], position?: PastePosition): Promise<MNode[]>;
|
|
480
480
|
doAlignCenter(config: MNode): Promise<MNode>;
|
|
481
481
|
/**
|
|
@@ -483,11 +483,10 @@ declare class Editor extends export_default {
|
|
|
483
483
|
* @param config 组件节点配置
|
|
484
484
|
* @param options 可选配置
|
|
485
485
|
* @param options.doNotSelect 居中后是否不更新当前选中节点(默认 false)
|
|
486
|
+
* @param options.doNotSwitchPage 居中后是否不切换当前页面(居中只更新节点 style,方法内为空操作;保留以与其它 DSL 操作 API 一致)
|
|
486
487
|
* @returns 当前组件节点配置
|
|
487
488
|
*/
|
|
488
|
-
alignCenter(config: MNode | MNode[], options?:
|
|
489
|
-
doNotSelect?: boolean;
|
|
490
|
-
}): Promise<MNode | MNode[]>;
|
|
489
|
+
alignCenter(config: MNode | MNode[], options?: DslOpOptions): Promise<MNode | MNode[]>;
|
|
491
490
|
/**
|
|
492
491
|
* 移动当前选中节点位置
|
|
493
492
|
* @param offset 偏移量
|
|
@@ -499,10 +498,9 @@ declare class Editor extends export_default {
|
|
|
499
498
|
* @param targetId 容器ID
|
|
500
499
|
* @param options 可选配置
|
|
501
500
|
* @param options.doNotSelect 移动后是否不更新当前选中节点(默认 false)
|
|
501
|
+
* @param options.doNotSwitchPage 移动后是否不切换当前页面(默认 false;目标容器位于其它页面时为 true 会跳过自动选中以避免页面切换)
|
|
502
502
|
*/
|
|
503
|
-
moveToContainer(config: MNode, targetId: Id, options?:
|
|
504
|
-
doNotSelect?: boolean;
|
|
505
|
-
}): Promise<MNode | undefined>;
|
|
503
|
+
moveToContainer(config: MNode, targetId: Id, options?: DslOpOptions): Promise<MNode | undefined>;
|
|
506
504
|
dragTo(config: MNode | MNode[], targetParent: MContainer, targetIndex: number): Promise<void>;
|
|
507
505
|
/**
|
|
508
506
|
* 撤销当前操作
|
|
@@ -1509,6 +1507,15 @@ declare const canUsePluginMethods: {
|
|
|
1509
1507
|
sync: never[];
|
|
1510
1508
|
};
|
|
1511
1509
|
type AsyncMethodName = Writable<(typeof canUsePluginMethods)['async']>;
|
|
1510
|
+
/**
|
|
1511
|
+
* DSL 修改类操作的通用配置
|
|
1512
|
+
* - doNotSelect: 操作后是否不要自动触发选中(不调用 this.select / this.multiSelect / stage.select / stage.multiSelect)
|
|
1513
|
+
* - doNotSwitchPage: 操作若会引发当前页面切换(如新增 / 删除 / 跨页移动),是否跳过这次切换
|
|
1514
|
+
*/
|
|
1515
|
+
type DslOpOptions = {
|
|
1516
|
+
doNotSelect?: boolean;
|
|
1517
|
+
doNotSwitchPage?: boolean;
|
|
1518
|
+
};
|
|
1512
1519
|
//#endregion
|
|
1513
1520
|
//#region temp/packages/form/src/schema.d.ts
|
|
1514
1521
|
interface ChangeRecord$1 {
|
|
@@ -4162,8 +4169,10 @@ declare const _default$6: typeof __VLS_export$1;
|
|
|
4162
4169
|
type __VLS_Props = FieldProps<StyleSchema>;
|
|
4163
4170
|
declare const __VLS_export: import("@vue/runtime-core").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
|
|
4164
4171
|
change: (v: any, eventData: ContainerChangeEventData) => any;
|
|
4172
|
+
addDiffCount: () => any;
|
|
4165
4173
|
}, string, import("@vue/runtime-core").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
4166
4174
|
onChange?: ((v: any, eventData: ContainerChangeEventData) => any) | undefined;
|
|
4175
|
+
onAddDiffCount?: (() => any) | undefined;
|
|
4167
4176
|
}>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
|
|
4168
4177
|
declare const _default$28: typeof __VLS_export;
|
|
4169
4178
|
//#endregion
|
|
@@ -4172,4 +4181,4 @@ declare const _default$36: {
|
|
|
4172
4181
|
install: (app: App, opt?: Partial<EditorInstallOptions | DesignPluginOptions | FormInstallOptions>) => void;
|
|
4173
4182
|
};
|
|
4174
4183
|
//#endregion
|
|
4175
|
-
export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, AsyncMethodName, BeforeAdd, CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CanDropInFunction, CanDropInScene, _default as CodeBlockEditor, _default$1 as CodeBlockList, _default$2 as CodeBlockListPanel, CodeBlockListPanelSlots, CodeBlockListSlots, CodeDeleteErrorType, CodeDslItem, CodeParamStatement, CodeRelation, _default$3 as CodeSelect, _default$4 as CodeSelectCol, CodeState, ColumnLayout, CombineInfo, ComponentGroup, ComponentGroupState, ComponentItem, _default$5 as ComponentListPanel, ComponentListPanelSlots, _default$6 as CondOpSelect, _default$7 as ContentMenu, CustomContentMenuFunction, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, _default$8 as DataSourceAddButton, _default$9 as DataSourceConfigPanel, _default$10 as DataSourceFieldSelect, _default$11 as DataSourceFields, _default$12 as DataSourceInput, DataSourceListSlots, _default$13 as DataSourceMethodSelect, _default$14 as DataSourceMethods, _default$15 as DataSourceMocks, _default$16 as DataSourceSelect, DatasourceTypeOption, DepTargetType, _default$17 as DisplayConds, DragClassification, DragType, EditorEvents, EditorInstallOptions, EditorNodeInfo, EditorSlots, EventBus, EventBusEvent, _default$18 as EventSelect, Fixed2Other, _default$19 as FloatingBox, FrameworkSlots, GetColumnWidth, GetConfig, H_GUIDE_LINE_STORAGE_KEY, HistoryOpType, HistoryState, _default$20 as Icon, IdleTask, IdleTaskEvents, IsExpandableFunction, KeyBindingCacheItem, KeyBindingCommand, KeyBindingItem, _default$21 as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerNodeSlots, LayerNodeStatus, LayerOffset, _default$22 as LayerPanel, LayerPanelSlots, Layout, _default$23 as LayoutContainer, _default$23 as SplitView, ListState, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, MenuBarData, MenuButton, MenuComponent, MenuItem, type OnDrag, PROPS_PANEL_WIDTH_STORAGE_KEY, PageBarSortOptions, _default$24 as PageFragmentSelect, PartSortableOptions, PastePosition, PropsFormConfigFunction, _default$25 as PropsFormPanel, PropsFormValueFunction, _default$26 as PropsPanel, PropsPanelSlots, PropsState, RIGHT_COLUMN_WIDTH_STORAGE_KEY, _default$27 as Resizer, ScrollViewer, ScrollViewerEvent, ScrollViewerSlots, Services, SetColumnWidth, SideBarData, SideComponent, SideItem, SideItemKey, SidebarSlots, StageCore, StageOptions, StageOverlayState, StageRect, StageSlots, StepValue, StoreState, StoreStateKey, _default$28 as StyleSetter, SyncAfterHook, SyncBeforeHook, SyncHookPlugin, _default$29 as TMagicCodeEditor, _default$30 as TMagicEditor, _default$31 as ToolButton, _default$32 as Tree, _default$33 as TreeNode, TreeNodeData, UI_SELECT_MODE_EVENT_NAME, UiState, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, WorkspaceSlots, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, _default$34 as codeBlockService, collectRelatedNodes, _default$35 as dataSourceService, debug, _default$36 as default, defaultIsExpandable, _default$37 as depService, designPlugin, displayTabConfig, editorNodeMergeCustomizer, _default$38 as editorService, eqOptions, error, eventTabConfig, _default$39 as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getDefaultConfig, getDisplayField, getEditorConfig, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, _default$40 as historyService, info, isIncludeDataSource, _default$41 as loadMonaco, log, moveItemsInContainer, numberOptions, _default$42 as propsService, resolveSelectedNode, serializeConfig, setChildrenLayout, setEditorConfig, setLayout, _default$43 as stageOverlayService, _default$44 as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, _default$45 as uiService, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
|
|
4184
|
+
export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, AsyncMethodName, BeforeAdd, CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CanDropInFunction, CanDropInScene, _default as CodeBlockEditor, _default$1 as CodeBlockList, _default$2 as CodeBlockListPanel, CodeBlockListPanelSlots, CodeBlockListSlots, CodeDeleteErrorType, CodeDslItem, CodeParamStatement, CodeRelation, _default$3 as CodeSelect, _default$4 as CodeSelectCol, CodeState, ColumnLayout, CombineInfo, ComponentGroup, ComponentGroupState, ComponentItem, _default$5 as ComponentListPanel, ComponentListPanelSlots, _default$6 as CondOpSelect, _default$7 as ContentMenu, CustomContentMenuFunction, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, _default$8 as DataSourceAddButton, _default$9 as DataSourceConfigPanel, _default$10 as DataSourceFieldSelect, _default$11 as DataSourceFields, _default$12 as DataSourceInput, DataSourceListSlots, _default$13 as DataSourceMethodSelect, _default$14 as DataSourceMethods, _default$15 as DataSourceMocks, _default$16 as DataSourceSelect, DatasourceTypeOption, DepTargetType, _default$17 as DisplayConds, DragClassification, DragType, DslOpOptions, EditorEvents, EditorInstallOptions, EditorNodeInfo, EditorSlots, EventBus, EventBusEvent, _default$18 as EventSelect, Fixed2Other, _default$19 as FloatingBox, FrameworkSlots, GetColumnWidth, GetConfig, H_GUIDE_LINE_STORAGE_KEY, HistoryOpType, HistoryState, _default$20 as Icon, IdleTask, IdleTaskEvents, IsExpandableFunction, KeyBindingCacheItem, KeyBindingCommand, KeyBindingItem, _default$21 as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerNodeSlots, LayerNodeStatus, LayerOffset, _default$22 as LayerPanel, LayerPanelSlots, Layout, _default$23 as LayoutContainer, _default$23 as SplitView, ListState, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, MenuBarData, MenuButton, MenuComponent, MenuItem, type OnDrag, PROPS_PANEL_WIDTH_STORAGE_KEY, PageBarSortOptions, _default$24 as PageFragmentSelect, PartSortableOptions, PastePosition, PropsFormConfigFunction, _default$25 as PropsFormPanel, PropsFormValueFunction, _default$26 as PropsPanel, PropsPanelSlots, PropsState, RIGHT_COLUMN_WIDTH_STORAGE_KEY, _default$27 as Resizer, ScrollViewer, ScrollViewerEvent, ScrollViewerSlots, Services, SetColumnWidth, SideBarData, SideComponent, SideItem, SideItemKey, SidebarSlots, StageCore, StageOptions, StageOverlayState, StageRect, StageSlots, StepValue, StoreState, StoreStateKey, _default$28 as StyleSetter, SyncAfterHook, SyncBeforeHook, SyncHookPlugin, _default$29 as TMagicCodeEditor, _default$30 as TMagicEditor, _default$31 as ToolButton, _default$32 as Tree, _default$33 as TreeNode, TreeNodeData, UI_SELECT_MODE_EVENT_NAME, UiState, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, WorkspaceSlots, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, _default$34 as codeBlockService, collectRelatedNodes, _default$35 as dataSourceService, debug, _default$36 as default, defaultIsExpandable, _default$37 as depService, designPlugin, displayTabConfig, editorNodeMergeCustomizer, _default$38 as editorService, eqOptions, error, eventTabConfig, _default$39 as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getDefaultConfig, getDisplayField, getEditorConfig, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, _default$40 as historyService, info, isIncludeDataSource, _default$41 as loadMonaco, log, moveItemsInContainer, numberOptions, _default$42 as propsService, resolveSelectedNode, serializeConfig, setChildrenLayout, setEditorConfig, setLayout, _default$43 as stageOverlayService, _default$44 as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, _default$45 as uiService, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
|