@tmagic/editor 1.7.8 → 1.7.10
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/Editor.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +17 -7
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +38 -9
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +38 -5
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +5 -0
- package/dist/es/fields/StyleSetter/pro/Transform.js +5 -0
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/es/hooks/use-code-block-edit.js +3 -2
- package/dist/es/index.js +3 -3
- package/dist/es/initService.js +4 -4
- package/dist/es/layouts/workspace/viewer/Stage.vue_vue_type_script_setup_true_lang.js +64 -1
- package/dist/es/layouts/workspace/viewer/StageOverlay.vue_vue_type_script_setup_true_lang.js +1 -5
- package/dist/es/services/editor.js +191 -174
- package/dist/es/services/history.js +1 -9
- package/dist/es/type.js +28 -1
- package/dist/es/utils/dep/worker.js +1 -1
- package/dist/es/utils/editor-history.js +100 -0
- package/dist/es/utils/editor.js +178 -4
- package/dist/es/utils/props.js +4 -1
- package/dist/es/utils/undo-redo.js +7 -4
- package/dist/tmagic-editor.umd.cjs +744 -234
- package/package.json +8 -8
- package/src/Editor.vue +1 -0
- package/src/components/CodeBlockEditor.vue +1 -1
- package/src/components/CodeParams.vue +23 -7
- package/src/editorProps.ts +2 -0
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +39 -6
- package/src/fields/DataSourceFieldSelect/Index.vue +1 -0
- package/src/fields/DataSourceMethodSelect.vue +54 -13
- package/src/fields/DataSourceMethods.vue +9 -5
- package/src/fields/StyleSetter/Index.vue +5 -1
- package/src/fields/StyleSetter/pro/Transform.vue +54 -0
- package/src/fields/StyleSetter/pro/index.ts +1 -0
- package/src/hooks/use-code-block-edit.ts +8 -4
- package/src/initService.ts +6 -6
- package/src/layouts/workspace/viewer/Stage.vue +89 -1
- package/src/layouts/workspace/viewer/StageOverlay.vue +1 -6
- package/src/services/editor.ts +231 -270
- package/src/services/history.ts +1 -9
- package/src/type.ts +65 -5
- package/src/utils/editor-history.ts +138 -0
- package/src/utils/editor.ts +249 -4
- package/src/utils/props.ts +4 -0
- package/src/utils/undo-redo.ts +7 -6
- package/types/index.d.ts +179 -53
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import formPlugin, { CascaderOption, ChangeRecord, CodeSelectColConfig, CodeSelectConfig, CondOpSelectConfig, ContainerChangeEventData, DataSourceFieldSelectConfig, DataSourceFieldsConfig, DataSourceInputConfig, DataSourceMethodSelectConfig, DataSourceMethodsConfig, DataSourceMocksConfig, DataSourceSelect, DisplayCondsConfig, EventSelectConfig, FieldProps, FormConfig, FormInstallOptions, FormState, FormValue, KeyValueConfig, PageFragmentSelectConfig, TabPaneConfig, TableColumnConfig } from "@tmagic/form";
|
|
1
|
+
import formPlugin, { CascaderOption, ChangeRecord, CodeSelectColConfig, CodeSelectConfig, CondOpSelectConfig, ContainerChangeEventData, DataSourceFieldSelectConfig, DataSourceFieldsConfig, DataSourceInputConfig, DataSourceMethodSelectConfig, DataSourceMethodsConfig, DataSourceMocksConfig, DataSourceSelect, DisplayCondsConfig, EventSelectConfig, FieldProps, FormConfig, FormInstallOptions, FormState, FormValue, KeyValueConfig, PageFragmentSelectConfig, TabPaneConfig, TableColumnConfig, TypeFunction } from "@tmagic/form";
|
|
2
2
|
import tablePlugin from "@tmagic/table";
|
|
3
3
|
import * as _tmagic_stage0 from "@tmagic/stage";
|
|
4
4
|
import StageCore, { ContainerHighlightType, CustomizeMoveableOptions, GuidesOptions, RenderType, UpdateDragEl, default as StageCore$1 } from "@tmagic/stage";
|
|
@@ -344,32 +344,10 @@ type DepService = Dep;
|
|
|
344
344
|
declare const _default$37: Dep;
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region temp/packages/editor/src/services/editor.d.ts
|
|
347
|
-
interface EditorEvents {
|
|
348
|
-
'root-change': [value: StoreState['root'], preValue?: StoreState['root']];
|
|
349
|
-
select: [node: MNode | null];
|
|
350
|
-
add: [nodes: MNode[]];
|
|
351
|
-
remove: [nodes: MNode[]];
|
|
352
|
-
update: [nodes: {
|
|
353
|
-
newNode: MNode;
|
|
354
|
-
oldNode: MNode;
|
|
355
|
-
changeRecords?: ChangeRecord[];
|
|
356
|
-
}[]];
|
|
357
|
-
'move-layer': [offset: number | LayerOffset];
|
|
358
|
-
'drag-to': [data: {
|
|
359
|
-
targetIndex: number;
|
|
360
|
-
configs: MNode | MNode[];
|
|
361
|
-
targetParent: MContainer;
|
|
362
|
-
}];
|
|
363
|
-
'history-change': [data: MPage | MPageFragment];
|
|
364
|
-
}
|
|
365
|
-
declare const canUsePluginMethods$5: {
|
|
366
|
-
async: readonly ["getLayout", "highlight", "select", "multiSelect", "doAdd", "add", "doRemove", "remove", "doUpdate", "update", "sort", "copy", "paste", "doPaste", "doAlignCenter", "alignCenter", "moveLayer", "moveToContainer", "dragTo", "undo", "redo", "move"];
|
|
367
|
-
sync: never[];
|
|
368
|
-
};
|
|
369
|
-
type AsyncMethodName$3 = Writable<(typeof canUsePluginMethods$5)['async']>;
|
|
370
347
|
declare class Editor extends export_default {
|
|
371
348
|
state: StoreState;
|
|
372
349
|
private isHistoryStateChange;
|
|
350
|
+
private selectionBeforeOp;
|
|
373
351
|
constructor();
|
|
374
352
|
/**
|
|
375
353
|
* 设置当前指点节点配置
|
|
@@ -508,38 +486,43 @@ declare class Editor extends export_default {
|
|
|
508
486
|
dragTo(config: MNode | MNode[], targetParent: MContainer, targetIndex: number): Promise<void>;
|
|
509
487
|
/**
|
|
510
488
|
* 撤销当前操作
|
|
511
|
-
* @returns
|
|
489
|
+
* @returns 被撤销的操作
|
|
512
490
|
*/
|
|
513
491
|
undo(): Promise<StepValue | null>;
|
|
514
492
|
/**
|
|
515
493
|
* 恢复到下一步
|
|
516
|
-
* @returns
|
|
494
|
+
* @returns 被恢复的操作
|
|
517
495
|
*/
|
|
518
496
|
redo(): Promise<StepValue | null>;
|
|
519
497
|
move(left: number, top: number): Promise<void>;
|
|
520
498
|
resetState(): void;
|
|
521
499
|
destroy(): void;
|
|
522
500
|
resetModifiedNodeId(): void;
|
|
523
|
-
usePlugin(options: AsyncHookPlugin<AsyncMethodName
|
|
501
|
+
usePlugin(options: AsyncHookPlugin<AsyncMethodName, Editor>): void;
|
|
524
502
|
on<Name extends keyof EditorEvents, Param extends EditorEvents[Name]>(eventName: Name, listener: (...args: Param) => void | Promise<void>): this;
|
|
525
503
|
once<Name extends keyof EditorEvents, Param extends EditorEvents[Name]>(eventName: Name, listener: (...args: Param) => void | Promise<void>): this;
|
|
526
504
|
emit<Name extends keyof EditorEvents, Param extends EditorEvents[Name]>(eventName: Name, ...args: Param): boolean;
|
|
527
505
|
private addModifiedNodeId;
|
|
528
|
-
private
|
|
529
|
-
private
|
|
530
|
-
|
|
506
|
+
private captureSelectionBeforeOp;
|
|
507
|
+
private pushOpHistory;
|
|
508
|
+
/**
|
|
509
|
+
* 应用历史操作(撤销 / 重做)
|
|
510
|
+
* @param step 操作记录
|
|
511
|
+
* @param reverse true = 撤销,false = 重做
|
|
512
|
+
*/
|
|
513
|
+
private applyHistoryOp;
|
|
531
514
|
private selectedConfigExceptionHandler;
|
|
532
515
|
}
|
|
533
516
|
type EditorService = Editor;
|
|
534
517
|
declare const _default$38: Editor;
|
|
535
518
|
//#endregion
|
|
536
519
|
//#region temp/packages/editor/src/services/events.d.ts
|
|
537
|
-
declare const canUsePluginMethods$
|
|
520
|
+
declare const canUsePluginMethods$5: {
|
|
538
521
|
async: readonly [];
|
|
539
522
|
sync: readonly ["setEvent", "getEvent", "setMethod", "getMethod"];
|
|
540
523
|
};
|
|
541
|
-
type AsyncMethodName$
|
|
542
|
-
type SyncMethodName$3 = Writable<(typeof canUsePluginMethods$
|
|
524
|
+
type AsyncMethodName$3 = Writable<(typeof canUsePluginMethods$5)['async']>;
|
|
525
|
+
type SyncMethodName$3 = Writable<(typeof canUsePluginMethods$5)['sync']>;
|
|
543
526
|
declare class Events extends export_default {
|
|
544
527
|
constructor();
|
|
545
528
|
setEvents(events: Record<string, EventOption[]>): void;
|
|
@@ -550,7 +533,7 @@ declare class Events extends export_default {
|
|
|
550
533
|
getMethod(type: string, _targetId: Id): EventOption[];
|
|
551
534
|
resetState(): void;
|
|
552
535
|
destroy(): void;
|
|
553
|
-
usePlugin(options: AsyncHookPlugin<AsyncMethodName$
|
|
536
|
+
usePlugin(options: AsyncHookPlugin<AsyncMethodName$3, Events> & SyncHookPlugin<SyncMethodName$3, Events>): void;
|
|
554
537
|
}
|
|
555
538
|
type EventsService = Events;
|
|
556
539
|
declare const _default$39: Events;
|
|
@@ -563,8 +546,10 @@ declare class UndoRedo<T = any> {
|
|
|
563
546
|
constructor(listMaxSize?: number);
|
|
564
547
|
pushElement(element: T): void;
|
|
565
548
|
canUndo(): boolean;
|
|
549
|
+
/** 返回被撤销的操作 */
|
|
566
550
|
undo(): T | null;
|
|
567
551
|
canRedo(): boolean;
|
|
552
|
+
/** 返回被重做的操作 */
|
|
568
553
|
redo(): T | null;
|
|
569
554
|
getCurrentElement(): T | null;
|
|
570
555
|
}
|
|
@@ -631,12 +616,12 @@ declare class Keybinding extends export_default {
|
|
|
631
616
|
type KeybindingService = Keybinding;
|
|
632
617
|
//#endregion
|
|
633
618
|
//#region temp/packages/editor/src/services/props.d.ts
|
|
634
|
-
declare const canUsePluginMethods$
|
|
619
|
+
declare const canUsePluginMethods$4: {
|
|
635
620
|
async: readonly ["setPropsConfig", "getPropsConfig", "setPropsValue", "getPropsValue", "fillConfig", "getDefaultPropsValue"];
|
|
636
621
|
sync: readonly ["createId", "setNewItemId"];
|
|
637
622
|
};
|
|
638
|
-
type AsyncMethodName$
|
|
639
|
-
type SyncMethodName$2 = Writable<(typeof canUsePluginMethods$
|
|
623
|
+
type AsyncMethodName$2 = Writable<(typeof canUsePluginMethods$4)['async']>;
|
|
624
|
+
type SyncMethodName$2 = Writable<(typeof canUsePluginMethods$4)['sync']>;
|
|
640
625
|
declare class Props extends export_default {
|
|
641
626
|
private state;
|
|
642
627
|
constructor();
|
|
@@ -707,7 +692,7 @@ declare class Props extends export_default {
|
|
|
707
692
|
*/
|
|
708
693
|
clearRelateId(): void;
|
|
709
694
|
destroy(): void;
|
|
710
|
-
usePlugin(options: AsyncHookPlugin<AsyncMethodName$
|
|
695
|
+
usePlugin(options: AsyncHookPlugin<AsyncMethodName$2, Props> & SyncHookPlugin<SyncMethodName$2, Props>): void;
|
|
711
696
|
/**
|
|
712
697
|
* 获取setNewItemId前后映射关系
|
|
713
698
|
* @param oldId 原组件ID
|
|
@@ -725,11 +710,11 @@ type PropsService = Props;
|
|
|
725
710
|
declare const _default$42: Props;
|
|
726
711
|
//#endregion
|
|
727
712
|
//#region temp/packages/editor/src/services/stageOverlay.d.ts
|
|
728
|
-
declare const canUsePluginMethods$
|
|
713
|
+
declare const canUsePluginMethods$3: {
|
|
729
714
|
async: never[];
|
|
730
715
|
sync: readonly ["openOverlay", "closeOverlay", "updateOverlay", "createStage"];
|
|
731
716
|
};
|
|
732
|
-
type SyncMethodName$1 = Writable<(typeof canUsePluginMethods$
|
|
717
|
+
type SyncMethodName$1 = Writable<(typeof canUsePluginMethods$3)['sync']>;
|
|
733
718
|
declare class StageOverlay extends export_default {
|
|
734
719
|
private state;
|
|
735
720
|
constructor();
|
|
@@ -763,11 +748,11 @@ declare enum Protocol {
|
|
|
763
748
|
NUMBER = "number",
|
|
764
749
|
BOOLEAN = "boolean"
|
|
765
750
|
}
|
|
766
|
-
declare const canUsePluginMethods$
|
|
751
|
+
declare const canUsePluginMethods$2: {
|
|
767
752
|
async: never[];
|
|
768
753
|
sync: readonly ["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"];
|
|
769
754
|
};
|
|
770
|
-
type SyncMethodName = Writable<(typeof canUsePluginMethods$
|
|
755
|
+
type SyncMethodName = Writable<(typeof canUsePluginMethods$2)['sync']>;
|
|
771
756
|
/**
|
|
772
757
|
* 数据存储服务
|
|
773
758
|
*/
|
|
@@ -815,11 +800,11 @@ type StorageService = WebStorage;
|
|
|
815
800
|
declare const _default$44: WebStorage;
|
|
816
801
|
//#endregion
|
|
817
802
|
//#region temp/packages/editor/src/services/ui.d.ts
|
|
818
|
-
declare const canUsePluginMethods: {
|
|
803
|
+
declare const canUsePluginMethods$1: {
|
|
819
804
|
async: readonly ["zoom", "calcZoom"];
|
|
820
805
|
sync: readonly [];
|
|
821
806
|
};
|
|
822
|
-
type AsyncMethodName = Writable<(typeof canUsePluginMethods)['async']>;
|
|
807
|
+
type AsyncMethodName$1 = Writable<(typeof canUsePluginMethods$1)['async']>;
|
|
823
808
|
declare class Ui extends export_default {
|
|
824
809
|
constructor();
|
|
825
810
|
set<K extends keyof UiState, T extends UiState[K]>(name: K, value: T): void;
|
|
@@ -828,7 +813,7 @@ declare class Ui extends export_default {
|
|
|
828
813
|
calcZoom(): Promise<number>;
|
|
829
814
|
resetState(): void;
|
|
830
815
|
destroy(): void;
|
|
831
|
-
usePlugin(options: AsyncHookPlugin<AsyncMethodName, Ui>): void;
|
|
816
|
+
usePlugin(options: AsyncHookPlugin<AsyncMethodName$1, Ui>): void;
|
|
832
817
|
private setStageRect;
|
|
833
818
|
}
|
|
834
819
|
type UiService = Ui;
|
|
@@ -956,6 +941,8 @@ interface StageOptions {
|
|
|
956
941
|
disabledMultiSelect?: boolean;
|
|
957
942
|
disabledRule?: boolean;
|
|
958
943
|
zoom?: number;
|
|
944
|
+
/** 画布双击前的钩子函数,返回 false 则阻止默认的双击行为 */
|
|
945
|
+
beforeDblclick?: (event: MouseEvent) => Promise<boolean | void> | boolean | void;
|
|
959
946
|
}
|
|
960
947
|
interface StoreState {
|
|
961
948
|
root: MApp | null;
|
|
@@ -1273,13 +1260,39 @@ interface CodeParamStatement {
|
|
|
1273
1260
|
/** 参数名称 */
|
|
1274
1261
|
name: string;
|
|
1275
1262
|
/** 参数类型 */
|
|
1276
|
-
type?: string
|
|
1263
|
+
type?: string | TypeFunction<string>;
|
|
1277
1264
|
[key: string]: any;
|
|
1278
1265
|
}
|
|
1266
|
+
type HistoryOpType = 'add' | 'remove' | 'update';
|
|
1279
1267
|
interface StepValue {
|
|
1280
|
-
|
|
1268
|
+
/** 页面信息 */
|
|
1269
|
+
data: {
|
|
1270
|
+
name: string;
|
|
1271
|
+
id: Id;
|
|
1272
|
+
};
|
|
1273
|
+
opType: HistoryOpType;
|
|
1274
|
+
/** 操作前选中的节点 ID,用于撤销后恢复选择状态 */
|
|
1275
|
+
selectedBefore: Id[];
|
|
1276
|
+
/** 操作后选中的节点 ID,用于重做后恢复选择状态 */
|
|
1277
|
+
selectedAfter: Id[];
|
|
1281
1278
|
modifiedNodeIds: Map<Id, Id>;
|
|
1282
|
-
|
|
1279
|
+
/** opType 'add': 新增的节点 */
|
|
1280
|
+
nodes?: MNode[];
|
|
1281
|
+
/** opType 'add': 父节点 ID */
|
|
1282
|
+
parentId?: Id;
|
|
1283
|
+
/** opType 'add': 每个新增节点在父节点 items 中的索引 */
|
|
1284
|
+
indexMap?: Record<string, number>;
|
|
1285
|
+
/** opType 'remove': 被删除的节点及其位置信息 */
|
|
1286
|
+
removedItems?: {
|
|
1287
|
+
node: MNode;
|
|
1288
|
+
parentId: Id;
|
|
1289
|
+
index: number;
|
|
1290
|
+
}[];
|
|
1291
|
+
/** opType 'update': 变更前后的节点快照 */
|
|
1292
|
+
updatedItems?: {
|
|
1293
|
+
oldNode: MNode;
|
|
1294
|
+
newNode: MNode;
|
|
1295
|
+
}[];
|
|
1283
1296
|
}
|
|
1284
1297
|
interface HistoryState {
|
|
1285
1298
|
pageId?: Id;
|
|
@@ -1400,6 +1413,29 @@ interface PageBarSortOptions extends PartSortableOptions {
|
|
|
1400
1413
|
beforeStart?: (event: SortableEvent, sortable: Sortable) => void | Promise<void>;
|
|
1401
1414
|
}
|
|
1402
1415
|
type CustomContentMenuFunction = (menus: (MenuButton | MenuComponent)[], type: 'layer' | 'data-source' | 'viewer' | 'code-block') => (MenuButton | MenuComponent)[];
|
|
1416
|
+
interface EditorEvents {
|
|
1417
|
+
'root-change': [value: StoreState['root'], preValue?: StoreState['root']];
|
|
1418
|
+
select: [node: MNode | null];
|
|
1419
|
+
add: [nodes: MNode[]];
|
|
1420
|
+
remove: [nodes: MNode[]];
|
|
1421
|
+
update: [nodes: {
|
|
1422
|
+
newNode: MNode;
|
|
1423
|
+
oldNode: MNode;
|
|
1424
|
+
changeRecords?: ChangeRecord[];
|
|
1425
|
+
}[]];
|
|
1426
|
+
'move-layer': [offset: number | LayerOffset];
|
|
1427
|
+
'drag-to': [data: {
|
|
1428
|
+
targetIndex: number;
|
|
1429
|
+
configs: MNode | MNode[];
|
|
1430
|
+
targetParent: MContainer;
|
|
1431
|
+
}];
|
|
1432
|
+
'history-change': [data: MPage | MPageFragment];
|
|
1433
|
+
}
|
|
1434
|
+
declare const canUsePluginMethods: {
|
|
1435
|
+
async: readonly ["getLayout", "highlight", "select", "multiSelect", "doAdd", "add", "doRemove", "remove", "doUpdate", "update", "sort", "copy", "paste", "doPaste", "doAlignCenter", "alignCenter", "moveLayer", "moveToContainer", "dragTo", "undo", "redo", "move"];
|
|
1436
|
+
sync: never[];
|
|
1437
|
+
};
|
|
1438
|
+
type AsyncMethodName = Writable<(typeof canUsePluginMethods)['async']>;
|
|
1403
1439
|
//#endregion
|
|
1404
1440
|
//#region temp/packages/form/src/schema.d.ts
|
|
1405
1441
|
interface ChangeRecord$1 {
|
|
@@ -1414,9 +1450,15 @@ interface ContainerChangeEventData$1 {
|
|
|
1414
1450
|
//#region temp/packages/editor/src/hooks/use-code-block-edit.d.ts
|
|
1415
1451
|
declare const useCodeBlockEdit: (codeBlockService: Services["codeBlockService"]) => {
|
|
1416
1452
|
codeId: _vue_reactivity0.Ref<string | undefined, string | undefined>;
|
|
1417
|
-
codeConfig: _vue_reactivity0.Ref<CodeBlockContent
|
|
1453
|
+
codeConfig: _vue_reactivity0.Ref<(Omit<CodeBlockContent, "content"> & {
|
|
1454
|
+
content: string;
|
|
1455
|
+
}) | undefined, (Omit<CodeBlockContent, "content"> & {
|
|
1456
|
+
content: string;
|
|
1457
|
+
}) | undefined>;
|
|
1418
1458
|
codeBlockEditor: Readonly<_vue_reactivity0.ShallowRef<_vue_runtime_core0.CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
1419
|
-
content: CodeBlockContent
|
|
1459
|
+
content: Omit<CodeBlockContent, "content"> & {
|
|
1460
|
+
content: string;
|
|
1461
|
+
};
|
|
1420
1462
|
disabled?: boolean;
|
|
1421
1463
|
isDataSource?: boolean;
|
|
1422
1464
|
dataSourceType?: string;
|
|
@@ -1446,7 +1488,9 @@ declare const useCodeBlockEdit: (codeBlockService: Services["codeBlockService"])
|
|
|
1446
1488
|
M: {};
|
|
1447
1489
|
Defaults: {};
|
|
1448
1490
|
}, Readonly<{
|
|
1449
|
-
content: CodeBlockContent
|
|
1491
|
+
content: Omit<CodeBlockContent, "content"> & {
|
|
1492
|
+
content: string;
|
|
1493
|
+
};
|
|
1450
1494
|
disabled?: boolean;
|
|
1451
1495
|
isDataSource?: boolean;
|
|
1452
1496
|
dataSourceType?: string;
|
|
@@ -1637,6 +1681,84 @@ declare const buildChangeRecords: (value: any, basePath: string) => {
|
|
|
1637
1681
|
propPath: string;
|
|
1638
1682
|
value: any;
|
|
1639
1683
|
}[];
|
|
1684
|
+
/**
|
|
1685
|
+
* 根据节点配置或ID解析出选中节点信息,并进行合法性校验
|
|
1686
|
+
* @param config 节点配置或节点ID
|
|
1687
|
+
* @param getNodeInfoFn 获取节点信息的回调函数
|
|
1688
|
+
* @param rootId 根节点ID,用于排除根节点被选中
|
|
1689
|
+
* @returns 选中节点的完整信息(node、parent、page)
|
|
1690
|
+
*/
|
|
1691
|
+
declare const resolveSelectedNode: (config: MNode | Id, getNodeInfoFn: (id: Id) => EditorNodeInfo, rootId?: Id) => EditorNodeInfo;
|
|
1692
|
+
/**
|
|
1693
|
+
* 处理节点在 fixed 定位与其他定位之间的切换
|
|
1694
|
+
* 当节点从非 fixed 变为 fixed 时,根据节点路径累加偏移量;反之则还原偏移量
|
|
1695
|
+
* @param dist 更新后的节点配置(目标状态)
|
|
1696
|
+
* @param src 更新前的节点配置(原始状态)
|
|
1697
|
+
* @param root 根节点配置,用于计算节点路径上的偏移量
|
|
1698
|
+
* @param getLayoutFn 获取父节点布局方式的回调函数
|
|
1699
|
+
* @returns 处理后的节点配置(深拷贝)
|
|
1700
|
+
*/
|
|
1701
|
+
declare const toggleFixedPosition: (dist: MNode, src: MNode, root: MApp, getLayoutFn: (parent: MNode, node?: MNode | null) => Promise<Layout>) => Promise<MNode>;
|
|
1702
|
+
/**
|
|
1703
|
+
* 根据键盘移动的偏移量计算节点的新样式
|
|
1704
|
+
* 仅对 absolute 或 fixed 定位的节点生效;优先修改 top/left,若未设置则修改 bottom/right
|
|
1705
|
+
* @param style 节点当前样式
|
|
1706
|
+
* @param left 水平方向偏移量(正值向右,负值向左)
|
|
1707
|
+
* @param top 垂直方向偏移量(正值向下,负值向上)
|
|
1708
|
+
* @returns 计算后的新样式对象,若节点不支持移动则返回 null
|
|
1709
|
+
*/
|
|
1710
|
+
declare const calcMoveStyle: (style: Record<string, any>, left: number, top: number) => Record<string, any> | null;
|
|
1711
|
+
/**
|
|
1712
|
+
* 计算节点水平居中对齐后的样式
|
|
1713
|
+
* 流式布局(relative)下不做处理;优先通过 DOM 元素实际宽度计算,回退到配置中的 width 值
|
|
1714
|
+
* @param node 需要居中的节点配置
|
|
1715
|
+
* @param parent 父容器节点配置
|
|
1716
|
+
* @param layout 当前布局方式
|
|
1717
|
+
* @param doc 画布 document 对象,用于获取 DOM 元素实际宽度
|
|
1718
|
+
* @returns 计算后的新样式对象,若不支持居中则返回 null
|
|
1719
|
+
*/
|
|
1720
|
+
declare const calcAlignCenterStyle: (node: MNode, parent: MContainer, layout: Layout, doc?: Document) => Record<string, any> | null;
|
|
1721
|
+
/**
|
|
1722
|
+
* 计算图层移动后的目标索引
|
|
1723
|
+
* 流式布局与绝对定位布局的移动方向相反:流式布局中"上移"对应索引减小,绝对定位中"上移"对应索引增大
|
|
1724
|
+
* @param currentIndex 节点当前在兄弟列表中的索引
|
|
1725
|
+
* @param offset 移动偏移量,支持数值或 LayerOffset.TOP / LayerOffset.BOTTOM
|
|
1726
|
+
* @param brothersLength 兄弟节点总数
|
|
1727
|
+
* @param isRelative 是否为流式布局
|
|
1728
|
+
* @returns 目标索引位置
|
|
1729
|
+
*/
|
|
1730
|
+
declare const calcLayerTargetIndex: (currentIndex: number, offset: number | LayerOffset, brothersLength: number, isRelative: boolean) => number;
|
|
1731
|
+
/**
|
|
1732
|
+
* 节点配置合并策略:用于 mergeWith 的自定义回调
|
|
1733
|
+
* - undefined 且 source 拥有该 key 时返回空字符串
|
|
1734
|
+
* - 原来是数组而新值是对象时,使用新值
|
|
1735
|
+
* - 新值是数组时,直接替换而非逐元素合并
|
|
1736
|
+
*/
|
|
1737
|
+
declare const editorNodeMergeCustomizer: (objValue: any, srcValue: any, key: string, _object: any, source: any) => object | "" | undefined;
|
|
1738
|
+
/**
|
|
1739
|
+
* 收集复制节点关联的依赖节点,将关联节点追加到 copyNodes 数组中
|
|
1740
|
+
* @param copyNodes 待复制的节点列表(会被就地修改)
|
|
1741
|
+
* @param collectorOptions 依赖收集器配置
|
|
1742
|
+
* @param getNodeById 根据 ID 获取节点的回调函数
|
|
1743
|
+
*/
|
|
1744
|
+
declare const collectRelatedNodes: (copyNodes: MNode[], collectorOptions: TargetOptions, getNodeById: (id: Id) => MNode | null) => void;
|
|
1745
|
+
interface DragClassification {
|
|
1746
|
+
sameParentIndices: number[];
|
|
1747
|
+
crossParentConfigs: {
|
|
1748
|
+
config: MNode;
|
|
1749
|
+
parent: MContainer;
|
|
1750
|
+
}[];
|
|
1751
|
+
/** 当同父容器节点索引异常时置为 true,调用方应中止拖拽操作 */
|
|
1752
|
+
aborted: boolean;
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* 对拖拽的节点进行分类:同父容器内移动 vs 跨容器移动
|
|
1756
|
+
* @param configs 被拖拽的节点列表
|
|
1757
|
+
* @param targetParent 目标父容器
|
|
1758
|
+
* @param getNodeInfo 获取节点信息的回调
|
|
1759
|
+
* @returns 分类结果,包含同容器索引列表和跨容器节点列表
|
|
1760
|
+
*/
|
|
1761
|
+
declare const classifyDragSources: (configs: MNode[], targetParent: MContainer, getNodeInfo: (id: Id, raw?: boolean) => EditorNodeInfo) => DragClassification;
|
|
1640
1762
|
//#endregion
|
|
1641
1763
|
//#region temp/packages/editor/src/utils/operator.d.ts
|
|
1642
1764
|
/**
|
|
@@ -1836,6 +1958,8 @@ interface EditorProps {
|
|
|
1836
1958
|
isContainer?: (el: HTMLElement) => boolean | Promise<boolean>;
|
|
1837
1959
|
/** 用于自定义组件树与画布的右键菜单 */
|
|
1838
1960
|
customContentMenu?: CustomContentMenuFunction;
|
|
1961
|
+
/** 画布双击前的钩子函数,返回 false 则阻止默认的双击行为 */
|
|
1962
|
+
beforeDblclick?: (event: MouseEvent) => Promise<boolean | void> | boolean | void;
|
|
1839
1963
|
extendFormState?: (state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
1840
1964
|
/** 页面顺序拖拽配置参数 */
|
|
1841
1965
|
pageBarSortOptions?: PageBarSortOptions;
|
|
@@ -3728,7 +3852,9 @@ type __VLS_WithSlots$3<T, S> = T & {
|
|
|
3728
3852
|
//#endregion
|
|
3729
3853
|
//#region temp/packages/editor/src/components/CodeBlockEditor.vue.d.ts
|
|
3730
3854
|
type __VLS_Props$7 = {
|
|
3731
|
-
content: CodeBlockContent
|
|
3855
|
+
content: Omit<CodeBlockContent, 'content'> & {
|
|
3856
|
+
content: string;
|
|
3857
|
+
};
|
|
3732
3858
|
disabled?: boolean;
|
|
3733
3859
|
isDataSource?: boolean;
|
|
3734
3860
|
dataSourceType?: string;
|
|
@@ -3941,4 +4067,4 @@ declare const _default$36: {
|
|
|
3941
4067
|
install: (app: App, opt?: Partial<EditorInstallOptions | DesignPluginOptions | FormInstallOptions>) => void;
|
|
3942
4068
|
};
|
|
3943
4069
|
//#endregion
|
|
3944
|
-
export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, BeforeAdd, CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, _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, DragType, EditorInstallOptions, EditorNodeInfo, EditorSlots, EventBus, EventBusEvent, _default$18 as EventSelect, Fixed2Other, _default$19 as FloatingBox, FrameworkSlots, GetColumnWidth, GetConfig, H_GUIDE_LINE_STORAGE_KEY, HistoryState, _default$20 as Icon, IdleTask, IdleTaskEvents, 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, Services, SetColumnWidth, SideBarData, SideComponent, SideItem, SideItemKey, SidebarSlots, StageCore, StageOptions, StageOverlayState, StageRect, 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, change2Fixed, _default$34 as codeBlockService, _default$35 as dataSourceService, debug, _default$36 as default, _default$37 as depService, designPlugin, displayTabConfig, _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, serializeConfig, setChildrenLayout, setEditorConfig, setLayout, _default$43 as stageOverlayService, _default$44 as storageService, styleTabConfig, tablePlugin, _default$45 as uiService, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
|
|
4070
|
+
export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, AsyncMethodName, BeforeAdd, CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, _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, 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, Services, SetColumnWidth, SideBarData, SideComponent, SideItem, SideItemKey, SidebarSlots, StageCore, StageOptions, StageOverlayState, StageRect, 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, _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 };
|