@tmagic/editor 1.8.0-beta.7 → 1.8.0-manmanyu.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 +15 -5
- package/dist/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +11 -7
- package/dist/es/components/ContentMenu.vue_vue_type_script_setup_true_lang.js +12 -5
- package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +11 -6
- package/dist/es/components/Icon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/Resizer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ScrollBar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ScrollViewer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/SearchInput.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/SplitView.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ToolButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/Tree.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/TreeNode.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/CodeLink.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +69 -44
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +6 -2
- package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +11 -8
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +7 -4
- package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +5 -2
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +7 -4
- package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +9 -3
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +102 -65
- package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/PageFragmentSelect.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/es/fields/StyleSetter/components/BackgroundPosition.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/fields/StyleSetter/components/Box.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/Center.js +31 -0
- package/dist/es/fields/StyleSetter/icons/align-items/FlexEnd.js +31 -0
- package/dist/es/fields/StyleSetter/icons/align-items/FlexStart.js +31 -0
- package/dist/es/fields/StyleSetter/icons/align-items/SpaceAround.js +50 -0
- package/dist/es/fields/StyleSetter/icons/align-items/SpaceBetween.js +50 -0
- package/dist/es/fields/StyleSetter/icons/background-repeat/NoRepeat.js +7 -7
- package/dist/es/fields/StyleSetter/icons/background-repeat/Repeat.js +6 -3
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatX.js +29 -6
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatY.js +32 -6
- package/dist/es/fields/StyleSetter/icons/display/Block.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Flex.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Inline.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/InlineBlock.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/None.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/Column.js +11 -3
- package/dist/es/fields/StyleSetter/icons/flex-direction/ColumnReverse.js +11 -3
- package/dist/es/fields/StyleSetter/icons/flex-direction/Row.js +11 -3
- package/dist/es/fields/StyleSetter/icons/flex-direction/RowReverse.js +11 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/Center.js +17 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexEnd.js +19 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexStart.js +19 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceAround.js +37 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceBetween.js +33 -3
- package/dist/es/fields/StyleSetter/icons/text-align/Center.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Left.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Right.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +12 -7
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +7 -4
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +83 -47
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/UISelect.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/icons/CenterIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/icons/CodeIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/icons/DatasourceIcon.js +17 -0
- package/dist/es/icons/FolderMinusIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/index.js +6 -4
- package/dist/es/layouts/AddPageBox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +15 -11
- package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/layouts/NavMenuColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/Bucket.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/BucketTab.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/GroupRow.vue_vue_type_script_setup_true_lang.js +39 -27
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +6 -2
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +159 -302
- package/dist/es/layouts/history-list/InitialRow.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/PageTab.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/composables.js +23 -55
- package/dist/es/layouts/history-list/useHistoryList.js +56 -0
- package/dist/es/layouts/history-list/useHistoryRevert.js +304 -0
- package/dist/es/layouts/page-bar/AddButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageBar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageBarScrollContainer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/Search.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +11 -2
- package/dist/es/layouts/sidebar/ComponentListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/code-block/CodeBlockList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceAddButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/layouts/sidebar/data-source/DataSourceList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/layer/LayerMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/layer/LayerNodeTool.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/layer/LayerPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/Breadcrumb.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/Workspace.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/Stage.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/StageOverlay.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/ViewerMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/services/codeBlock.js +32 -28
- package/dist/es/services/dataSource.js +43 -34
- package/dist/es/services/editor.js +31 -26
- package/dist/es/services/history.js +268 -384
- package/dist/es/style.css +306 -37
- package/dist/es/utils/const.js +1 -1
- package/dist/es/utils/dep/worker.js +1 -1
- package/dist/es/utils/history.js +35 -47
- package/dist/es/utils/props.js +48 -29
- package/dist/style.css +306 -37
- package/dist/themes/magic-admin.css +2805 -0
- package/dist/tmagic-editor.umd.cjs +6855 -5579
- package/package.json +8 -8
- package/src/Editor.vue +13 -1
- package/src/components/CompareForm.vue +14 -6
- package/src/components/ContentMenu.vue +10 -2
- package/src/components/FloatingBox.vue +13 -2
- package/src/editorProps.ts +9 -0
- package/src/fields/CodeSelect.vue +51 -40
- package/src/fields/CodeSelectCol.vue +1 -0
- package/src/fields/DataSourceFieldSelect/Index.vue +14 -5
- package/src/fields/DisplayConds.vue +4 -1
- package/src/fields/EventSelect.vue +58 -32
- package/src/fields/StyleSetter/Index.vue +1 -4
- package/src/fields/StyleSetter/components/Border.vue +1 -1
- package/src/fields/StyleSetter/icons/align-items/Center.vue +19 -0
- package/src/fields/StyleSetter/icons/align-items/FlexEnd.vue +19 -0
- package/src/fields/StyleSetter/icons/align-items/FlexStart.vue +19 -0
- package/src/fields/StyleSetter/icons/align-items/SpaceAround.vue +34 -0
- package/src/fields/StyleSetter/icons/align-items/SpaceBetween.vue +34 -0
- package/src/fields/StyleSetter/icons/align-items/index copy.ts +5 -0
- package/src/fields/StyleSetter/icons/align-items/index.ts +5 -0
- package/src/fields/StyleSetter/icons/background-repeat/NoRepeat.vue +20 -4
- package/src/fields/StyleSetter/icons/background-repeat/Repeat.vue +10 -28
- package/src/fields/StyleSetter/icons/background-repeat/RepeatX.vue +4 -5
- package/src/fields/StyleSetter/icons/background-repeat/RepeatY.vue +4 -5
- package/src/fields/StyleSetter/icons/flex-direction/Column.vue +4 -3
- package/src/fields/StyleSetter/icons/flex-direction/ColumnReverse.vue +4 -3
- package/src/fields/StyleSetter/icons/flex-direction/Row.vue +4 -3
- package/src/fields/StyleSetter/icons/flex-direction/RowReverse.vue +4 -3
- package/src/fields/StyleSetter/icons/justify-content/Center.vue +5 -2
- package/src/fields/StyleSetter/icons/justify-content/FlexEnd.vue +15 -2
- package/src/fields/StyleSetter/icons/justify-content/FlexStart.vue +15 -2
- package/src/fields/StyleSetter/icons/justify-content/SpaceAround.vue +28 -3
- package/src/fields/StyleSetter/icons/justify-content/SpaceBetween.vue +28 -2
- package/src/fields/StyleSetter/pro/Background.vue +11 -5
- package/src/fields/StyleSetter/pro/Font.vue +3 -3
- package/src/fields/StyleSetter/pro/Layout.vue +105 -28
- package/src/fields/UISelect.vue +1 -1
- package/src/icons/DatasourceIcon.vue +7 -0
- package/src/index.ts +2 -0
- package/src/layouts/Framework.vue +7 -1
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/history-list/GroupRow.vue +10 -0
- package/src/layouts/history-list/HistoryDiffDialog.vue +6 -1
- package/src/layouts/history-list/HistoryListPanel.vue +53 -250
- package/src/layouts/history-list/PageTab.vue +4 -4
- package/src/layouts/history-list/composables.ts +52 -90
- package/src/layouts/history-list/useHistoryList.ts +60 -0
- package/src/layouts/history-list/useHistoryRevert.ts +400 -0
- package/src/layouts/props-panel/PropsPanel.vue +19 -1
- package/src/services/codeBlock.ts +30 -29
- package/src/services/dataSource.ts +37 -37
- package/src/services/editor.ts +32 -29
- package/src/services/history.ts +340 -430
- package/src/theme/code-block.scss +37 -0
- package/src/theme/common/var.scss +1 -1
- package/src/theme/component-list-panel.scss +2 -2
- package/src/theme/data-source-field.scss +4 -0
- package/src/theme/display-conds.scss +11 -0
- package/src/theme/event.scss +55 -1
- package/src/theme/history-list-panel.scss +23 -9
- package/src/theme/props-panel.scss +2 -1
- package/src/theme/style-setter/border.scss +14 -5
- package/src/theme/theme.scss +1 -0
- package/src/theme/themes/magic-admin/index.scss +124 -0
- package/src/type.ts +174 -92
- package/src/utils/const.ts +2 -1
- package/src/utils/history.ts +52 -67
- package/src/utils/props.ts +30 -9
- package/types/index.d.ts +471 -287
package/types/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import StageCore, { CanDropIn, ContainerHighlightType, CustomizeMoveableOptions,
|
|
|
4
4
|
import designPlugin, { ButtonProps, DesignPluginOptions } from "@tmagic/design";
|
|
5
5
|
import Gesto, { OnDrag, OnDrag as OnDrag$1 } from "gesto";
|
|
6
6
|
import { CodeBlockContent, CodeBlockDSL, DataSchema, DataSourceFieldType, DataSourceSchema, DepData, DepExtendedData, DepTargetType, DepTargetType as DepTargetType$1, DisplayCond, EventOption, Id, MApp, MContainer, MNode, MPage, MPageFragment, NodeType, Target, TargetOptions } from "@tmagic/core";
|
|
7
|
-
import { App, Component, ComputedRef, Ref, ShallowRef } from "vue";
|
|
8
|
-
import EventEmitter, { EventEmitter
|
|
7
|
+
import { App, AppContext, Component, ComputedRef, Ref, ShallowRef } from "vue";
|
|
8
|
+
import EventEmitter$1, { EventEmitter } from "events";
|
|
9
9
|
import * as Monaco from "monaco-editor";
|
|
10
10
|
import Sortable, { Options, SortableEvent } from "sortablejs";
|
|
11
11
|
import { PascalCasedProperties, Writable } from "type-fest";
|
|
@@ -47,7 +47,7 @@ export * from "@tmagic/utils";
|
|
|
47
47
|
* 调用时的参数会透传到before方法的参数中, 然后before的return 会作为原方法的参数和after的参数,after第一个参数则是原方法的return值;
|
|
48
48
|
* 如需终止后续方法调用可以return new Error();
|
|
49
49
|
*/
|
|
50
|
-
declare class BaseService extends EventEmitter
|
|
50
|
+
declare class BaseService extends EventEmitter {
|
|
51
51
|
private pluginOptionsList;
|
|
52
52
|
private taskList;
|
|
53
53
|
private doingTask;
|
|
@@ -62,11 +62,11 @@ declare class BaseService extends EventEmitter$1 {
|
|
|
62
62
|
}
|
|
63
63
|
//#endregion
|
|
64
64
|
//#region temp/packages/editor/src/services/codeBlock.d.ts
|
|
65
|
-
declare const canUsePluginMethods$
|
|
65
|
+
declare const canUsePluginMethods$8: {
|
|
66
66
|
async: readonly ["setCodeDslById", "setEditStatus", "setCombineIds", "setUndeleteableList", "deleteCodeDslByIds"];
|
|
67
67
|
sync: string[];
|
|
68
68
|
};
|
|
69
|
-
type AsyncMethodName$4 = Writable<(typeof canUsePluginMethods$
|
|
69
|
+
type AsyncMethodName$4 = Writable<(typeof canUsePluginMethods$8)['async']>;
|
|
70
70
|
declare class CodeBlock extends BaseService {
|
|
71
71
|
private state;
|
|
72
72
|
/**
|
|
@@ -329,11 +329,11 @@ interface State$2 {
|
|
|
329
329
|
methods: Record<string, EventOption[]>;
|
|
330
330
|
}
|
|
331
331
|
type StateKey$1 = keyof State$2;
|
|
332
|
-
declare const canUsePluginMethods$
|
|
332
|
+
declare const canUsePluginMethods$7: {
|
|
333
333
|
async: never[];
|
|
334
334
|
sync: readonly ["getFormConfig", "setFormConfig", "getFormValue", "setFormValue", "getFormEvent", "setFormEvent", "getFormMethod", "setFormMethod", "add", "update", "remove", "createId"];
|
|
335
335
|
};
|
|
336
|
-
type SyncMethodName$
|
|
336
|
+
type SyncMethodName$5 = Writable<(typeof canUsePluginMethods$7)['sync']>;
|
|
337
337
|
declare class DataSource extends BaseService {
|
|
338
338
|
private state;
|
|
339
339
|
/**
|
|
@@ -466,7 +466,7 @@ declare class DataSource extends BaseService {
|
|
|
466
466
|
getDataSourceById(id: string): DataSourceSchema | undefined;
|
|
467
467
|
resetState(): void;
|
|
468
468
|
destroy(): void;
|
|
469
|
-
usePlugin(options: SyncHookPlugin<SyncMethodName$
|
|
469
|
+
usePlugin(options: SyncHookPlugin<SyncMethodName$5, DataSource>): void;
|
|
470
470
|
/**
|
|
471
471
|
* 复制时会带上组件关联的数据源
|
|
472
472
|
* @param config 组件节点配置
|
|
@@ -919,12 +919,12 @@ type EditorService = Editor;
|
|
|
919
919
|
declare const _default$42: Editor;
|
|
920
920
|
//#endregion
|
|
921
921
|
//#region temp/packages/editor/src/services/events.d.ts
|
|
922
|
-
declare const canUsePluginMethods$
|
|
922
|
+
declare const canUsePluginMethods$6: {
|
|
923
923
|
async: readonly [];
|
|
924
924
|
sync: readonly ["setEvent", "getEvent", "setMethod", "getMethod"];
|
|
925
925
|
};
|
|
926
|
-
type AsyncMethodName$3 = Writable<(typeof canUsePluginMethods$
|
|
927
|
-
type SyncMethodName$
|
|
926
|
+
type AsyncMethodName$3 = Writable<(typeof canUsePluginMethods$6)['async']>;
|
|
927
|
+
type SyncMethodName$4 = Writable<(typeof canUsePluginMethods$6)['sync']>;
|
|
928
928
|
declare class Events extends BaseService {
|
|
929
929
|
constructor();
|
|
930
930
|
setEvents(events: Record<string, EventOption[]>): void;
|
|
@@ -935,7 +935,7 @@ declare class Events extends BaseService {
|
|
|
935
935
|
getMethod(type: string, _targetId: Id): EventOption[];
|
|
936
936
|
resetState(): void;
|
|
937
937
|
destroy(): void;
|
|
938
|
-
usePlugin(options: AsyncHookPlugin<AsyncMethodName$3, Events> & SyncHookPlugin<SyncMethodName$
|
|
938
|
+
usePlugin(options: AsyncHookPlugin<AsyncMethodName$3, Events> & SyncHookPlugin<SyncMethodName$4, Events>): void;
|
|
939
939
|
}
|
|
940
940
|
type EventsService = Events;
|
|
941
941
|
declare const _default$43: Events;
|
|
@@ -1010,133 +1010,153 @@ declare class UndoRedo<T = any> {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
//#endregion
|
|
1012
1012
|
//#region temp/packages/editor/src/services/history.d.ts
|
|
1013
|
+
declare const canUsePluginMethods$5: {
|
|
1014
|
+
sync: readonly ["push", "undo", "redo"];
|
|
1015
|
+
};
|
|
1016
|
+
type SyncMethodName$3 = Writable<(typeof canUsePluginMethods$5)['sync']>;
|
|
1013
1017
|
declare class History extends BaseService {
|
|
1014
1018
|
state: {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1019
|
+
steps: {
|
|
1020
|
+
[x: string]: Record<Id, UndoRedo<any>>;
|
|
1021
|
+
page: Record<Id, UndoRedo<StepValue>>;
|
|
1022
|
+
codeBlock: Record<Id, UndoRedo<CodeBlockStepValue>>;
|
|
1023
|
+
dataSource: Record<Id, UndoRedo<DataSourceStepValue>>;
|
|
1024
|
+
};
|
|
1025
|
+
stepNames: Record<string, string>;
|
|
1021
1026
|
};
|
|
1022
1027
|
constructor();
|
|
1028
|
+
/**
|
|
1029
|
+
* 注册一个扩展历史类型,使其可与内置 `page` / `codeBlock` / `dataSource` 一样走统一的
|
|
1030
|
+
* {@link push} / {@link undo} / {@link redo}(按 id 分栈、独立 undo/redo)。
|
|
1031
|
+
*
|
|
1032
|
+
* @param stepType 自定义历史类型标识(勿与内置类型重名)
|
|
1033
|
+
* @param options.event push/undo/redo 后派发的事件名,缺省为 `${stepType}-history-change`
|
|
1034
|
+
* @param options.name 历史面板中的展示名称(tab / 分组标题等),缺省回退到 stepType 本身
|
|
1035
|
+
*/
|
|
1036
|
+
registerStepType(stepType: string, options?: {
|
|
1037
|
+
event?: string;
|
|
1038
|
+
name?: string;
|
|
1039
|
+
}): void;
|
|
1040
|
+
/**
|
|
1041
|
+
* 读取指定历史类型的展示名称(用于历史面板 tab / 分组标题等)。
|
|
1042
|
+
* 未登记名称时回退到 stepType 本身。
|
|
1043
|
+
*/
|
|
1044
|
+
getStepName(stepType: HistoryStepType): string;
|
|
1045
|
+
/**
|
|
1046
|
+
* 设置指定历史类型的展示名称(用于历史面板 tab / 分组标题等)。
|
|
1047
|
+
* 内置 `page` / `codeBlock` / `dataSource` 也可在此覆盖默认中文名。
|
|
1048
|
+
*/
|
|
1049
|
+
setStepName(stepType: HistoryStepType, name: string): void;
|
|
1023
1050
|
reset(): void;
|
|
1024
|
-
resetPage(): void;
|
|
1025
|
-
changePage(page: MPage | MPageFragment): void;
|
|
1026
1051
|
resetState(): void;
|
|
1027
1052
|
/**
|
|
1028
|
-
*
|
|
1053
|
+
* 为指定历史栈(默认 `page`,也适用于 codeBlock / dataSource / 扩展类型)种入一条「初始基线」记录。
|
|
1029
1054
|
*
|
|
1030
|
-
* 该记录是一条 `opType: 'initial'` 的
|
|
1055
|
+
* 该记录是一条 `opType: 'initial'` 的 step,作为对应栈 **index 0 的固定底线**:
|
|
1031
1056
|
* - 它是一条真实入栈的 step(随栈一起持久化),但被钉为撤销/回滚的下限——cursor 永不低于它,
|
|
1032
|
-
* 因此不会被 undo / goto / revert 触达(详见 {@link undo} / {@link
|
|
1033
|
-
* - 历史面板把它过滤出分组列表(见 {@link
|
|
1057
|
+
* 因此不会被 undo / goto / revert 触达(详见 {@link undo} / {@link undoFloor});
|
|
1058
|
+
* - 历史面板把它过滤出分组列表(见 {@link getHistoryGroups}),改由底部「初始」行展示。
|
|
1034
1059
|
*
|
|
1035
|
-
*
|
|
1036
|
-
*
|
|
1060
|
+
* 仅当目标栈为空时种入(保证 initial 一定位于 index 0);已存在 initial 底线时不重复种入。
|
|
1061
|
+
*
|
|
1062
|
+
* @param stepType 历史类型
|
|
1063
|
+
* @param id 目标栈 id(page 为 pageId,其余类型为对应资源 id)
|
|
1064
|
+
* @param options 基线展示信息(名称 / 描述 / 来源)
|
|
1037
1065
|
*/
|
|
1038
|
-
|
|
1066
|
+
setMarker(stepType: HistoryStepType, id: Id, options?: {
|
|
1039
1067
|
name?: string;
|
|
1040
1068
|
description?: string;
|
|
1041
1069
|
source?: HistoryOpSource;
|
|
1070
|
+
extra?: Record<string, any>;
|
|
1042
1071
|
}): StepValue | null;
|
|
1043
1072
|
/**
|
|
1044
|
-
*
|
|
1045
|
-
*
|
|
1073
|
+
* 读取指定历史栈的初始基线 step(栈 index 0 且 `opType: 'initial'`);
|
|
1074
|
+
* 不存在或 id 缺省时返回 undefined。
|
|
1046
1075
|
*/
|
|
1047
|
-
|
|
1076
|
+
getMarker(stepType: HistoryStepType, id?: Id): StepValue | undefined;
|
|
1048
1077
|
/**
|
|
1049
|
-
*
|
|
1078
|
+
* 把一条步骤推入指定历史栈。统一入口,所有类型(page / codeBlock / dataSource / 扩展)行为完全一致:
|
|
1079
|
+
* 按 `stepType` 选择目标栈类型,按 `id`(必填)选择具体栈,按需建栈后入栈,并派发对应的历史变更事件
|
|
1080
|
+
* (`page` 为 `change`,其余见 {@link registerStepType}),回调签名统一为 `(id, step)`。
|
|
1050
1081
|
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1082
|
+
* 跨页 / 跨资源操作(如 `moveToContainer` 把节点搬到其它页)必须显式传入目标 id,
|
|
1083
|
+
* 否则无法落到正确的栈。step 可由 `createStackStep` 等构造后传入。
|
|
1084
|
+
*
|
|
1085
|
+
* @param stepType 历史类型
|
|
1086
|
+
* @param step 已构造好的历史记录(缺省自动补全 uuid / timestamp)
|
|
1087
|
+
* @param id 目标栈 id(page 为 pageId,其余类型为对应资源 id),必填
|
|
1088
|
+
*/
|
|
1089
|
+
push(stepType: 'page', step: StepValue, id: Id): StepValue | null;
|
|
1090
|
+
push(stepType: 'codeBlock', step: CodeBlockStepValue, id: Id): CodeBlockStepValue | null;
|
|
1091
|
+
push(stepType: 'dataSource', step: DataSourceStepValue, id: Id): DataSourceStepValue | null;
|
|
1092
|
+
push<T extends BaseStepValue>(stepType: string, step: T, id: Id): T | null;
|
|
1093
|
+
/**
|
|
1094
|
+
* 撤销指定历史栈的最近一次变更。统一入口,所有类型行为一致:
|
|
1095
|
+
* 按 `id`(必填)+ `stepType` 定位栈,不会越过 index 0 的 initial 基线(所有类型同等适用),
|
|
1096
|
+
* 仅在确有可撤销 step 时派发对应的历史变更事件(`page` 为 `change`,回调签名 `(id, step)`)。
|
|
1097
|
+
*
|
|
1098
|
+
* @param stepType 历史类型
|
|
1099
|
+
* @param id 目标栈 id(page 为 pageId,其余类型为对应资源 id),必填
|
|
1060
1100
|
*/
|
|
1061
|
-
|
|
1101
|
+
undo(stepType: 'page', id: Id): StepValue | null;
|
|
1102
|
+
undo(stepType: 'codeBlock', id: Id): CodeBlockStepValue | null;
|
|
1103
|
+
undo(stepType: 'dataSource', id: Id): DataSourceStepValue | null;
|
|
1104
|
+
undo<T extends BaseStepValue>(stepType: string, id: Id): T | null;
|
|
1062
1105
|
/**
|
|
1063
|
-
*
|
|
1106
|
+
* 重做指定历史栈的下一次变更。语义与 {@link undo} 对称,详见其说明。
|
|
1064
1107
|
*
|
|
1065
|
-
*
|
|
1066
|
-
*
|
|
1067
|
-
* - 删除:newContent = null,oldContent = 删除前内容
|
|
1068
|
-
* - `changeRecords` 来自 form 端,撤销/重做时若有则按 propPath 局部覆盖;缺省才退化为整内容替换。
|
|
1069
|
-
* - 不直接驱动 codeBlockService,调用方负责实际写回。
|
|
1070
|
-
*/
|
|
1071
|
-
pushCodeBlock(codeBlockId: Id, payload: {
|
|
1072
|
-
oldContent: CodeBlockContent | null;
|
|
1073
|
-
newContent: CodeBlockContent | null;
|
|
1074
|
-
changeRecords?: ChangeRecord[]; /** 可选的人类可读描述(如「修改按钮颜色」),仅用于历史面板展示。 */
|
|
1075
|
-
historyDescription?: string; /** 可选的操作途径(配置面板 / 菜单 / 接口等),仅用于历史面板展示与埋点。 */
|
|
1076
|
-
source?: HistoryOpSource;
|
|
1077
|
-
}): CodeBlockStepValue | null;
|
|
1078
|
-
/**
|
|
1079
|
-
* 推入一条数据源变更记录(与页面/节点完全无关),按 `dataSourceId` 维度独立一份 UndoRedo 栈。
|
|
1080
|
-
* 行为同 pushCodeBlock(新增 oldSchema=null;删除 newSchema=null)。
|
|
1108
|
+
* @param stepType 历史类型
|
|
1109
|
+
* @param id 目标栈 id(page 为 pageId,其余类型为对应资源 id),必填
|
|
1081
1110
|
*/
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
historyDescription?: string; /** 可选的操作途径(配置面板 / 菜单 / 接口等),仅用于历史面板展示与埋点。 */
|
|
1087
|
-
source?: HistoryOpSource;
|
|
1088
|
-
}): DataSourceStepValue | null;
|
|
1089
|
-
/** 撤销指定代码块的最近一次变更。 */
|
|
1090
|
-
undoCodeBlock(codeBlockId: Id): CodeBlockStepValue | null;
|
|
1091
|
-
/** 重做指定代码块的下一次变更。 */
|
|
1092
|
-
redoCodeBlock(codeBlockId: Id): CodeBlockStepValue | null;
|
|
1093
|
-
/** 是否可对指定代码块撤销。 */
|
|
1094
|
-
canUndoCodeBlock(codeBlockId: Id): boolean;
|
|
1095
|
-
/** 是否可对指定代码块重做。 */
|
|
1096
|
-
canRedoCodeBlock(codeBlockId: Id): boolean;
|
|
1097
|
-
/** 撤销指定数据源的最近一次变更。 */
|
|
1098
|
-
undoDataSource(dataSourceId: Id): DataSourceStepValue | null;
|
|
1099
|
-
/** 重做指定数据源的下一次变更。 */
|
|
1100
|
-
redoDataSource(dataSourceId: Id): DataSourceStepValue | null;
|
|
1101
|
-
/** 是否可对指定数据源撤销。 */
|
|
1102
|
-
canUndoDataSource(dataSourceId: Id): boolean;
|
|
1103
|
-
/** 是否可对指定数据源重做。 */
|
|
1104
|
-
canRedoDataSource(dataSourceId: Id): boolean;
|
|
1105
|
-
undo(): StepValue | null;
|
|
1106
|
-
redo(): StepValue | null;
|
|
1107
|
-
destroy(): void;
|
|
1111
|
+
redo(stepType: 'page', id: Id): StepValue | null;
|
|
1112
|
+
redo(stepType: 'codeBlock', id: Id): CodeBlockStepValue | null;
|
|
1113
|
+
redo(stepType: 'dataSource', id: Id): DataSourceStepValue | null;
|
|
1114
|
+
redo<T extends BaseStepValue>(stepType: string, id: Id): T | null;
|
|
1108
1115
|
/**
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1116
|
+
* 是否可对指定历史栈撤销(cursor 高于 initial 基线底线)。
|
|
1117
|
+
* @param stepType 历史类型
|
|
1118
|
+
* @param id 目标栈 id;缺省 / 无效时返回 false
|
|
1111
1119
|
*/
|
|
1112
|
-
|
|
1120
|
+
canUndo(stepType: HistoryStepType, id?: Id): boolean;
|
|
1113
1121
|
/**
|
|
1114
|
-
*
|
|
1115
|
-
*
|
|
1122
|
+
* 是否可对指定历史栈重做。
|
|
1123
|
+
* @param stepType 历史类型
|
|
1124
|
+
* @param id 目标栈 id;缺省 / 无效时返回 false
|
|
1116
1125
|
*/
|
|
1117
|
-
|
|
1126
|
+
canRedo(stepType: HistoryStepType, id?: Id): boolean;
|
|
1127
|
+
/** 读取指定页面历史栈当前游标所在的 step(cursor - 1);无则返回 null。 */
|
|
1128
|
+
getCurrentPageStep(pageId: Id): StepValue | null;
|
|
1118
1129
|
/**
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1130
|
+
* 用 `state` 替换指定页面栈当前游标所在的 step(并丢弃其后的重做尾部),游标不变。
|
|
1131
|
+
* 用于「连续 set root 记录合并」等就地替换最新一条的场景;替换成功后派发 `change`。
|
|
1121
1132
|
*/
|
|
1122
|
-
|
|
1133
|
+
replaceCurrentStep(stepType: HistoryStepType, state: StepValue, id: Id): StepValue | null;
|
|
1134
|
+
destroy(): void;
|
|
1123
1135
|
/**
|
|
1124
|
-
*
|
|
1125
|
-
*
|
|
1126
|
-
*
|
|
1136
|
+
* 清空历史记录栈。统一入口,所有类型(page / codeBlock / dataSource / 扩展)行为一致:
|
|
1137
|
+
* - 传入 `id`:仅清空 `stepType` 下该 id 对应的栈;
|
|
1138
|
+
* - 缺省 `id`:清空 `stepType` 下的全部栈。
|
|
1139
|
+
*
|
|
1140
|
+
* 仅删除撤销/重做记录,不会改动 DSL / 代码块 / 数据源本身。清空时会**保留各栈原有的
|
|
1141
|
+
* initial 基线**(文案 / 来源),无基线时清空成空栈。清空后派发 `clear`(签名 `(id, stepType)`)。
|
|
1142
|
+
*
|
|
1143
|
+
* @param stepType 历史类型
|
|
1144
|
+
* @param id 目标栈 id;缺省表示清空该类型下全部栈
|
|
1127
1145
|
*/
|
|
1128
|
-
|
|
1146
|
+
clear(stepType: HistoryStepType, id?: Id): void;
|
|
1129
1147
|
/**
|
|
1130
|
-
*
|
|
1131
|
-
*
|
|
1148
|
+
* 标记历史记录为「已保存」(把对应栈当前游标所在的记录标为 `saved`)。统一入口:
|
|
1149
|
+
* - 缺省 `id`:标记**全部类型、全部栈**(整份 DSL 落库场景),派发 `mark-saved` 且 `kind: 'all'`;
|
|
1150
|
+
* - 传入 `id`:仅标记 `stepType` 下该 id 对应的栈,派发 `mark-saved` 且 `kind` 为 `stepType`。
|
|
1151
|
+
*
|
|
1152
|
+
* 同一栈内任意时刻最多只有一条记录为 `saved`;从 IndexedDB 恢复时游标会被定位到最近一条已保存记录之后。
|
|
1153
|
+
*
|
|
1154
|
+
* @param stepType 历史类型
|
|
1155
|
+
* @param id 目标栈 id;缺省表示标记全部类型 / 全部栈
|
|
1132
1156
|
*/
|
|
1133
|
-
|
|
1134
|
-
/** 标记指定代码块的历史栈当前记录为已保存,仅影响该代码块自己的栈。 */
|
|
1135
|
-
markCodeBlockSaved(codeBlockId: Id): void;
|
|
1136
|
-
/** 标记指定数据源的历史栈当前记录为已保存,仅影响该数据源自己的栈。 */
|
|
1137
|
-
markDataSourceSaved(dataSourceId: Id): void;
|
|
1157
|
+
markSaved(stepType: HistoryStepType, id?: Id): void;
|
|
1138
1158
|
/**
|
|
1139
|
-
* 把当前内存中的全部历史栈(页面 / 代码块 /
|
|
1159
|
+
* 把当前内存中的全部历史栈(页面 / 代码块 / 数据源 / 扩展类型)序列化后写入本地 IndexedDB。
|
|
1140
1160
|
*
|
|
1141
1161
|
* - 每个 UndoRedo 栈连同其游标、容量一并保存,恢复后可继续 undo/redo;
|
|
1142
1162
|
* - `key` 用于区分不同活动页 / 项目(同一 store 下可保存多份快照),缺省为 `default`;
|
|
@@ -1148,92 +1168,90 @@ declare class History extends BaseService {
|
|
|
1148
1168
|
* 从本地 IndexedDB 读取此前保存的历史快照并重建全部撤销/重做栈。
|
|
1149
1169
|
*
|
|
1150
1170
|
* - 读取到的每个栈都会经 {@link UndoRedo.fromSerialized} 还原(含游标),随后可直接 undo/redo;
|
|
1151
|
-
* -
|
|
1171
|
+
* - 会整体覆盖当前内存中的历史状态(活动页由 editorService 维护,不在此恢复);
|
|
1152
1172
|
* - 找不到对应记录时返回 null,且不改动当前状态;
|
|
1153
1173
|
* - 不支持 IndexedDB 的环境(如 SSR)会 reject。
|
|
1154
1174
|
*/
|
|
1155
1175
|
restoreFromIndexedDB(options?: HistoryPersistOptions): Promise<PersistedHistoryState | null>;
|
|
1156
1176
|
/**
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
1159
|
-
*
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
*
|
|
1164
|
-
*
|
|
1165
|
-
*
|
|
1166
|
-
* 用于历史面板的"页面"tab 展示。
|
|
1167
|
-
*/
|
|
1168
|
-
getPageHistoryGroups(pageId?: Id): PageHistoryGroup[];
|
|
1169
|
-
/**
|
|
1170
|
-
* 取出全部代码块的历史栈,按 codeBlockId 分桶展示。
|
|
1171
|
-
* 同一栈内每条操作记录独立成组,不做相邻 update 合并。
|
|
1172
|
-
*/
|
|
1173
|
-
getCodeBlockHistoryGroups(): StackHistoryGroup<CodeBlockStepValue, 'code-block'>[];
|
|
1174
|
-
/**
|
|
1175
|
-
* 读取指定页面历史栈的当前游标(已应用步骤数量)。不传则取当前活动页。
|
|
1176
|
-
* 没有对应栈时返回 0。
|
|
1177
|
+
* 取出指定历史类型(页面 / 代码块 / 数据源 / 扩展类型)某个栈的平铺步骤列表(含 applied 标记)。
|
|
1178
|
+
* 统一入口,替代旧的 `getPageStepList` / `getCodeBlockStepList` / `getDataSourceStepList`。
|
|
1179
|
+
*
|
|
1180
|
+
* 列表按时间正序,最早一步在最前面;`applied` 表示该步骤处于栈游标之前(已应用)。
|
|
1181
|
+
* 供 revert / goto 等按 index 索引步骤的场景使用。通常 UI 应使用
|
|
1182
|
+
* {@link getHistoryGroups} 取已合并分组的版本;本方法仅为兼容/调试保留。
|
|
1183
|
+
*
|
|
1184
|
+
* @param stepType 历史类型
|
|
1185
|
+
* @param id 目标栈 id(page 为 pageId,其余类型为对应资源 id);缺省 / 无效时返回空数组
|
|
1177
1186
|
*/
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
getDataSourceCursor(dataSourceId: Id): number;
|
|
1187
|
+
getStepList(stepType: 'page', id?: Id): HistoryStepEntry<StepValue>[];
|
|
1188
|
+
getStepList(stepType: 'codeBlock', id: Id): HistoryStepEntry<CodeBlockStepValue>[];
|
|
1189
|
+
getStepList(stepType: 'dataSource', id: Id): HistoryStepEntry<DataSourceStepValue>[];
|
|
1190
|
+
getStepList<T extends BaseStepValue>(stepType: HistoryStepType, id?: Id): HistoryStepEntry<T>[];
|
|
1183
1191
|
/**
|
|
1184
|
-
*
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
*
|
|
1192
|
+
* 取出指定历史类型的历史分组(页面 / 代码块 / 数据源 / 扩展类型统一入口)。
|
|
1193
|
+
*
|
|
1194
|
+
* 把目标栈的步骤列表按"目标"做相邻合并(连续修改同一目标的 update 合并为一组,组内可展开查看每步;
|
|
1195
|
+
* add / remove / 多实体 update 始终独立成组),并过滤掉 index 0 的 initial 基线(底部「初始」行由
|
|
1196
|
+
* {@link getMarker} 驱动)。各类型行为完全一致,仅 `kind` 与 step 快照类型不同。
|
|
1197
|
+
*
|
|
1198
|
+
* 作用域:
|
|
1199
|
+
* - 传入 `id`:仅取该 id 对应的单个栈(页面历史按活动页查看,传入 pageId);
|
|
1200
|
+
* - 缺省 `id`:遍历该类型下全部栈并汇总(代码块 / 数据源按全部资源分桶展示)。
|
|
1201
|
+
*
|
|
1202
|
+
* @param stepType 历史类型,缺省 `page`
|
|
1203
|
+
* @param id 目标栈 id;缺省表示遍历该类型下全部栈
|
|
1193
1204
|
*/
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
}[];
|
|
1205
|
+
getHistoryGroups(stepType: 'page', id?: Id): HistoryGroup<StepValue>[];
|
|
1206
|
+
getHistoryGroups(stepType: 'codeBlock', id?: Id): HistoryGroup<CodeBlockStepValue>[];
|
|
1207
|
+
getHistoryGroups(stepType: 'dataSource', id?: Id): HistoryGroup<DataSourceStepValue>[];
|
|
1208
|
+
getHistoryGroups<T extends BaseStepValue>(stepType: HistoryStepType, id?: Id): HistoryGroup<T>[];
|
|
1199
1209
|
/**
|
|
1200
|
-
*
|
|
1201
|
-
*
|
|
1210
|
+
* 读取指定历史栈的当前游标(已应用步骤数量)。统一入口,替代旧的
|
|
1211
|
+
* `getPageCursor` / `getCodeBlockCursor` / `getDataSourceCursor`。
|
|
1212
|
+
* - `id` 缺省或非法、或对应栈不存在时返回 0;
|
|
1213
|
+
* - `stepType` 支持 `page` / `codeBlock` / `dataSource` / 扩展类型。
|
|
1202
1214
|
*/
|
|
1203
|
-
|
|
1215
|
+
getCursor(stepType: HistoryStepType, id?: Id): number;
|
|
1204
1216
|
/**
|
|
1205
|
-
* 按历史记录 uuid
|
|
1206
|
-
*
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
*
|
|
1214
|
-
*
|
|
1217
|
+
* 按历史记录 uuid 在指定历史类型的栈中查找其所属 id 与索引,统一入口,替代旧的
|
|
1218
|
+
* `getPageStepIndexByUuid` / `findCodeBlockStepLocationByUuid` / `findDataSourceStepLocationByUuid`。
|
|
1219
|
+
*
|
|
1220
|
+
* - 传入 `id`:仅在该 id 对应的单个栈中查找(如页面历史按活动页查看,传入 pageId);
|
|
1221
|
+
* - 缺省 `id`:遍历该类型下全部栈查找(代码块 / 数据源等按全部资源分桶的场景)。
|
|
1222
|
+
*
|
|
1223
|
+
* 找不到时返回 null。供「按 uuid 回滚」等需要把 uuid 映射回 (id, index) 的场景使用。
|
|
1224
|
+
*
|
|
1225
|
+
* @param stepType 历史类型
|
|
1226
|
+
* @param uuid 目标历史记录的 uuid
|
|
1227
|
+
* @param id 目标栈 id;缺省表示遍历该类型下全部栈
|
|
1215
1228
|
*/
|
|
1216
|
-
|
|
1229
|
+
findStepLocationByUuid(stepType: HistoryStepType, uuid: string, id?: Id): {
|
|
1217
1230
|
id: Id;
|
|
1218
1231
|
index: number;
|
|
1219
1232
|
} | null;
|
|
1233
|
+
usePlugin(options: SyncHookPlugin<SyncMethodName$3, History>): void;
|
|
1234
|
+
emit<Name extends keyof HistoryEvents, Param extends HistoryEvents[Name]>(eventName: Name, ...args: Param): boolean;
|
|
1220
1235
|
/**
|
|
1221
|
-
*
|
|
1236
|
+
* 取出指定历史类型的栈桶(`Record<id, UndoRedo>`);不存在时按需创建空桶,
|
|
1237
|
+
* 从而支持通过 {@link registerStepType} 或首次 push 动态扩展历史类型。
|
|
1222
1238
|
*/
|
|
1223
|
-
|
|
1239
|
+
private getStepBucket;
|
|
1224
1240
|
/**
|
|
1225
|
-
*
|
|
1226
|
-
*
|
|
1227
|
-
* 跨页 push 时如果目标页的栈尚不存在(用户从未进入过该页),会按需创建一条空栈,
|
|
1228
|
-
* 这样切到目标页时 Ctrl+Z 也能撤回该步骤。
|
|
1241
|
+
* 清空单个历史栈并按需重建其 initial 基线(保留原基线的文案 / 来源)。
|
|
1229
1242
|
*/
|
|
1230
|
-
private
|
|
1243
|
+
private clearStack;
|
|
1244
|
+
/** 入栈前补全 step 的 uuid / timestamp(调用方未指定时)。 */
|
|
1245
|
+
private fillStepMeta;
|
|
1246
|
+
/** 校验「按 id 分栈」类型(codeBlock / dataSource / 扩展)的 id 是否有效。 */
|
|
1247
|
+
private isValidStackId;
|
|
1248
|
+
/** 清空全部历史栈内容(保留已注册的类型键,使扩展类型在 reset 后仍可用)。 */
|
|
1249
|
+
private clearAllSteps;
|
|
1231
1250
|
/**
|
|
1232
1251
|
* 把基础 dbName 与当前 DSL(root app)的 id 拼成最终库名,实现不同应用历史隔离。
|
|
1233
1252
|
* 取不到 app id(如尚未加载 DSL)时退回基础 dbName。
|
|
1234
1253
|
*/
|
|
1235
1254
|
private resolveDbName;
|
|
1236
|
-
private setCanUndoRedo;
|
|
1237
1255
|
}
|
|
1238
1256
|
type HistoryService = History;
|
|
1239
1257
|
declare const _default$44: History;
|
|
@@ -2080,13 +2098,21 @@ interface StepDiffItem<T = unknown> {
|
|
|
2080
2098
|
*
|
|
2081
2099
|
* 泛型 `T` 为 `diff` 中变化内容的快照类型(页面节点 `MNode` / 代码块 `CodeBlockContent` / 数据源 `DataSourceSchema`)。
|
|
2082
2100
|
*/
|
|
2083
|
-
interface BaseStepValue<T = unknown> {
|
|
2101
|
+
interface BaseStepValue<T = unknown, U extends Record<string, any> = {}> {
|
|
2084
2102
|
/**
|
|
2085
2103
|
* 历史记录唯一标识(uuid)。入栈时自动写入(若调用方未指定),
|
|
2086
2104
|
* 用于精确定位 / 引用某一条历史记录(如 revert、埋点、跨端同步等)。
|
|
2087
|
-
*
|
|
2105
|
+
* 注意与 `data.id`(关联的页面 / 代码块 / 数据源 id)区分。
|
|
2088
2106
|
*/
|
|
2089
2107
|
uuid: string;
|
|
2108
|
+
/**
|
|
2109
|
+
* 关联目标信息:`id` 为关联的页面 / 代码块 / 数据源等资源 id(也是历史栈的分组 key),
|
|
2110
|
+
* `name` 为展示名。所有历史类型统一携带。
|
|
2111
|
+
*/
|
|
2112
|
+
data: {
|
|
2113
|
+
name: string;
|
|
2114
|
+
id: Id;
|
|
2115
|
+
};
|
|
2090
2116
|
/** 操作类型:新增 / 删除 / 更新(三类历史记录统一携带)。 */
|
|
2091
2117
|
opType: HistoryOpType;
|
|
2092
2118
|
/**
|
|
@@ -2120,56 +2146,78 @@ interface BaseStepValue<T = unknown> {
|
|
|
2120
2146
|
* 避免源码反复保存 / 外部重设 DSL 时堆积多条 root 记录。
|
|
2121
2147
|
*/
|
|
2122
2148
|
rootStep?: boolean;
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
/**
|
|
2126
|
-
|
|
2127
|
-
name: string;
|
|
2128
|
-
id: Id;
|
|
2129
|
-
};
|
|
2130
|
-
/** 操作前选中的节点 ID,用于撤销后恢复选择状态 */
|
|
2131
|
-
selectedBefore: Id[];
|
|
2132
|
-
/** 操作后选中的节点 ID,用于重做后恢复选择状态 */
|
|
2133
|
-
selectedAfter: Id[];
|
|
2134
|
-
modifiedNodeIds: Map<Id, Id>;
|
|
2149
|
+
/** 操作人 */
|
|
2150
|
+
operator?: string;
|
|
2151
|
+
/** 扩展信息 */
|
|
2152
|
+
extra?: U;
|
|
2135
2153
|
}
|
|
2136
2154
|
/**
|
|
2137
|
-
*
|
|
2138
|
-
*
|
|
2139
|
-
* - 新增(opType 'add'):仅 `newSchema`(新内容);
|
|
2140
|
-
* - 更新(opType 'update'):`oldSchema` + `newSchema`,并可带 `changeRecords` 做局部更新;
|
|
2141
|
-
* - 删除(opType 'remove'):仅 `oldSchema`(删除前内容)。
|
|
2155
|
+
* 历史记录的扩展上下文({@link BaseStepValue.extra})。
|
|
2156
|
+
* 内置字段供 `page` 类型在撤销 / 重做时恢复选区与受影响节点;扩展类型可自由附加其它键。
|
|
2142
2157
|
*/
|
|
2143
|
-
interface
|
|
2144
|
-
/**
|
|
2145
|
-
|
|
2158
|
+
interface StepExtra {
|
|
2159
|
+
/** 操作前选中的节点 ID,用于撤销后恢复选择状态(page 类型) */
|
|
2160
|
+
selectedBefore?: Id[];
|
|
2161
|
+
/** 操作后选中的节点 ID,用于重做后恢复选择状态(page 类型) */
|
|
2162
|
+
selectedAfter?: Id[];
|
|
2163
|
+
/** 本次操作涉及的节点 id 集合(page 类型) */
|
|
2164
|
+
modifiedNodeIds?: Map<Id, Id>;
|
|
2165
|
+
[key: string]: any;
|
|
2146
2166
|
}
|
|
2147
2167
|
/**
|
|
2148
|
-
*
|
|
2149
|
-
*
|
|
2150
|
-
* - 新增(opType 'add'):仅 `newSchema`(新 schema);
|
|
2151
|
-
* - 更新(opType 'update'):`oldSchema` + `newSchema`,并可带 `changeRecords` 做局部更新;
|
|
2152
|
-
* - 删除(opType 'remove'):仅 `oldSchema`(删除前 schema)。
|
|
2168
|
+
* 页面节点历史记录条目(`diff` 内容为 {@link MNode})。结构已与代码块 / 数据源统一收敛到
|
|
2169
|
+
* {@link BaseStepValue}:关联 id 见 `data.id`,选区等上下文见 `extra`。
|
|
2153
2170
|
*/
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2171
|
+
type StepValue = BaseStepValue<MNode, StepExtra>;
|
|
2172
|
+
/**
|
|
2173
|
+
* 代码块历史记录条目(`diff` 内容为 {@link CodeBlockContent}),按 `data.id`(codeBlock.id)
|
|
2174
|
+
* 分组保存到 historyState.steps.codeBlock。结构与 {@link StepValue} / {@link DataSourceStepValue}
|
|
2175
|
+
* 一致,仅 `diff` 快照类型不同。
|
|
2176
|
+
*/
|
|
2177
|
+
type CodeBlockStepValue = BaseStepValue<CodeBlockContent>;
|
|
2178
|
+
/**
|
|
2179
|
+
* 数据源历史记录条目(`diff` 内容为 {@link DataSourceSchema}),按 `data.id`(dataSource.id)
|
|
2180
|
+
* 分组保存到 historyState.steps.dataSource。结构与 {@link StepValue} / {@link CodeBlockStepValue}
|
|
2181
|
+
* 一致,仅 `diff` 快照类型不同。
|
|
2182
|
+
*/
|
|
2183
|
+
type DataSourceStepValue = BaseStepValue<DataSourceSchema>;
|
|
2184
|
+
/**
|
|
2185
|
+
* 历史记录类型标识:内置 `page` / `codeBlock` / `dataSource`,并允许业务扩展自定义类型。
|
|
2186
|
+
* `(string & {})` 保留对内置字面量的智能提示,同时不限制扩展取值。
|
|
2187
|
+
*/
|
|
2188
|
+
type HistoryStepType = 'page' | 'codeBlock' | 'dataSource' | (string & {});
|
|
2189
|
+
/**
|
|
2190
|
+
* 全部历史栈的统一容器,按「类型 -> id -> UndoRedo 栈」两级分组。
|
|
2191
|
+
*
|
|
2192
|
+
* - `page`:页面历史栈,按 page.id 分组(每页一份 UndoRedo);
|
|
2193
|
+
* - `codeBlock`:代码块历史栈,按 codeBlock.id 分组;
|
|
2194
|
+
* - `dataSource`:数据源历史栈,按 dataSource.id 分组;
|
|
2195
|
+
* - 其余键:业务通过 {@link HistoryService.registerStepType} 注册的自定义历史类型。
|
|
2196
|
+
*
|
|
2197
|
+
* 所有类型(含扩展类型)一视同仁:均按 id 独立分栈、独立 undo/redo,且都可通过
|
|
2198
|
+
* {@link HistoryService.setMarker} 在 index 0 种入 `initial` 基线(撤销 / 回滚不会越过该基线)。
|
|
2199
|
+
*/
|
|
2200
|
+
interface HistorySteps {
|
|
2201
|
+
page: Record<Id, UndoRedo<StepValue>>;
|
|
2202
|
+
codeBlock: Record<Id, UndoRedo<CodeBlockStepValue>>;
|
|
2203
|
+
dataSource: Record<Id, UndoRedo<DataSourceStepValue>>;
|
|
2204
|
+
/** 扩展历史类型:按 id 分组的 UndoRedo 栈。 */
|
|
2205
|
+
[stepType: string]: Record<Id, UndoRedo<any>>;
|
|
2157
2206
|
}
|
|
2158
2207
|
interface HistoryState {
|
|
2159
|
-
pageId?: Id;
|
|
2160
|
-
pageSteps: Record<Id, UndoRedo<StepValue>>;
|
|
2161
|
-
canRedo: boolean;
|
|
2162
|
-
canUndo: boolean;
|
|
2163
2208
|
/**
|
|
2164
|
-
*
|
|
2165
|
-
*
|
|
2209
|
+
* 全部历史栈的统一容器(页面 / 代码块 / 数据源 / 扩展类型),见 {@link HistorySteps}。
|
|
2210
|
+
* 各类型互不影响,支持按 id 独立 undo/redo;是否可撤销 / 重做改用 {@link HistoryService.canUndo} /
|
|
2211
|
+
* {@link HistoryService.canRedo}(按 stepType + id 查询)替代旧的全局 canUndo / canRedo 字段。
|
|
2166
2212
|
*/
|
|
2167
|
-
|
|
2213
|
+
steps: HistorySteps;
|
|
2168
2214
|
/**
|
|
2169
|
-
*
|
|
2170
|
-
*
|
|
2215
|
+
* 各历史类型的展示名称,用于历史面板({@link HistorySteps} 的 tab / 分组标题等)。
|
|
2216
|
+
* 内置 `page` / `codeBlock` / `dataSource` 有默认中文名(页面 / 代码块 / 数据源),
|
|
2217
|
+
* 扩展类型可通过 {@link HistoryService.registerStepType} 的 `name` 选项或
|
|
2218
|
+
* {@link HistoryService.setStepName} 登记;读取请用 {@link HistoryService.getStepName}。
|
|
2171
2219
|
*/
|
|
2172
|
-
|
|
2220
|
+
stepNames: Record<string, string>;
|
|
2173
2221
|
}
|
|
2174
2222
|
/**
|
|
2175
2223
|
* 历史记录的可持久化快照。由 historyService.saveToIndexedDB 写入 IndexedDB,
|
|
@@ -2178,14 +2226,16 @@ interface HistoryState {
|
|
|
2178
2226
|
interface PersistedHistoryState {
|
|
2179
2227
|
/** 快照结构版本号,便于后续兼容升级。 */
|
|
2180
2228
|
version: number;
|
|
2181
|
-
/**
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2229
|
+
/**
|
|
2230
|
+
* 全部历史栈的序列化快照,按「类型 -> id」两级分组,与 {@link HistorySteps} 对应。
|
|
2231
|
+
* 内置 `page` / `codeBlock` / `dataSource`,并包含业务注册的扩展类型。
|
|
2232
|
+
*/
|
|
2233
|
+
steps: {
|
|
2234
|
+
page: Record<Id, SerializedUndoRedo<StepValue>>;
|
|
2235
|
+
codeBlock: Record<Id, SerializedUndoRedo<CodeBlockStepValue>>;
|
|
2236
|
+
dataSource: Record<Id, SerializedUndoRedo<DataSourceStepValue>>;
|
|
2237
|
+
[stepType: string]: Record<Id, SerializedUndoRedo<any>>;
|
|
2238
|
+
};
|
|
2189
2239
|
/** 保存时间戳(毫秒)。 */
|
|
2190
2240
|
savedAt: number;
|
|
2191
2241
|
}
|
|
@@ -2207,9 +2257,9 @@ interface HistoryPersistOptions {
|
|
|
2207
2257
|
/**
|
|
2208
2258
|
* 历史面板用:当前页面的一条历史步骤(包含位置和是否已应用)。
|
|
2209
2259
|
*/
|
|
2210
|
-
interface
|
|
2260
|
+
interface HistoryStepEntry<T> {
|
|
2211
2261
|
/** 步骤内容 */
|
|
2212
|
-
step:
|
|
2262
|
+
step: T;
|
|
2213
2263
|
/** 在所属栈中的索引(0 为最早) */
|
|
2214
2264
|
index: number;
|
|
2215
2265
|
/** 是否处于"已应用"段(即位于栈游标之前)。撤销后变为 false。 */
|
|
@@ -2218,56 +2268,42 @@ interface PageHistoryStepEntry {
|
|
|
2218
2268
|
isCurrent?: boolean;
|
|
2219
2269
|
}
|
|
2220
2270
|
/**
|
|
2221
|
-
*
|
|
2222
|
-
*
|
|
2223
|
-
*
|
|
2224
|
-
* - targetId
|
|
2271
|
+
* 历史面板分组(页面 / 数据源 / 代码块 / 扩展类型统一结构)。
|
|
2272
|
+
*
|
|
2273
|
+
* 把指定历史栈的步骤列表按"目标"做相邻合并:
|
|
2274
|
+
* - 连续修改同一目标(单实体 update,targetId 一致)的多步合并成一组,组内可展开查看每步;
|
|
2275
|
+
* - add / remove / 多实体 update 始终独立成组(无法明确归属单一目标);
|
|
2276
|
+
* - targetId 为 undefined 表示"无明确目标",不参与合并。
|
|
2277
|
+
*
|
|
2278
|
+
* 各类型仅 `kind` 与 step 快照类型不同,统一由泛型描述:
|
|
2279
|
+
* - 页面:`HistoryGroup<StepValue>`,`kind: 'page'`,`id` 为 pageId,`targetId` 为被改节点 id;
|
|
2280
|
+
* - 数据源:`HistoryGroup<DataSourceStepValue>`,`kind: 'data-source'`,`id` 为 dataSource.id;
|
|
2281
|
+
* - 代码块:`HistoryGroup<CodeBlockStepValue>`,`kind: 'code-block'`,`id` 为 codeBlock.id。
|
|
2225
2282
|
*/
|
|
2226
|
-
interface
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
pageId
|
|
2230
|
-
|
|
2283
|
+
interface HistoryGroup<T extends BaseStepValue = BaseStepValue> {
|
|
2284
|
+
/** 历史类型标识:page / code-block / data-source(扩展类型同理)。 */
|
|
2285
|
+
kind: string;
|
|
2286
|
+
/** 所属栈 id(page 为 pageId,代码块 / 数据源为对应资源 id)。 */
|
|
2287
|
+
id: Id;
|
|
2288
|
+
/** 该分组的操作类型。 */
|
|
2231
2289
|
opType: HistoryOpType;
|
|
2232
2290
|
/**
|
|
2233
|
-
*
|
|
2234
|
-
* undefined 表示该分组不可被合并(add / remove /
|
|
2291
|
+
* 合并的目标 id:仅"单实体 update"有值,并按此与相邻同 id 的 update 合并。
|
|
2292
|
+
* undefined 表示该分组不可被合并(add / remove / 多实体 update)。
|
|
2235
2293
|
*/
|
|
2236
2294
|
targetId?: Id;
|
|
2237
|
-
/**
|
|
2295
|
+
/** 目标可读名(取最后一步快照的 name/type/id)。 */
|
|
2238
2296
|
targetName?: string;
|
|
2239
|
-
/**
|
|
2240
|
-
steps: PageHistoryStepEntry[];
|
|
2241
|
-
/** 组内最后一步是否已应用 */
|
|
2242
|
-
applied: boolean;
|
|
2243
|
-
/** 是否为当前所在的分组(包含栈中最近一次已应用步骤的那一组)。 */
|
|
2244
|
-
isCurrent?: boolean;
|
|
2245
|
-
}
|
|
2246
|
-
/**
|
|
2247
|
-
* 数据源 / 代码块历史面板分组(按 id 分栈展示)。
|
|
2248
|
-
* 二者结构完全一致,仅 `kind` 与 step 类型不同,统一由该泛型描述:
|
|
2249
|
-
* - 数据源:`StackHistoryGroup<DataSourceStepValue, 'data-source'>`;
|
|
2250
|
-
* - 代码块:`StackHistoryGroup<CodeBlockStepValue, 'code-block'>`。
|
|
2251
|
-
*
|
|
2252
|
-
* 每条操作记录独立成组,不做相邻合并(与页面历史 {@link PageHistoryGroup} 不同),故 `steps` 恒为单元素。
|
|
2253
|
-
*/
|
|
2254
|
-
interface StackHistoryGroup<T extends BaseStepValue = BaseStepValue, K extends 'code-block' | 'data-source' = 'code-block' | 'data-source'> {
|
|
2255
|
-
/** 区分代码块 / 数据源。 */
|
|
2256
|
-
kind: K;
|
|
2257
|
-
/** 关联的代码块 / 数据源 id。 */
|
|
2258
|
-
id: Id;
|
|
2259
|
-
/** 该分组的操作类型。 */
|
|
2260
|
-
opType: HistoryOpType;
|
|
2261
|
-
/** 组内所有步骤,按时间正序(不做相邻合并,恒为单元素)。 */
|
|
2297
|
+
/** 组内所有步骤,按时间正序。 */
|
|
2262
2298
|
steps: {
|
|
2263
2299
|
step: T;
|
|
2264
2300
|
index: number;
|
|
2265
2301
|
applied: boolean;
|
|
2266
2302
|
isCurrent?: boolean;
|
|
2267
2303
|
}[];
|
|
2268
|
-
/**
|
|
2304
|
+
/** 组内最后一步是否已应用。 */
|
|
2269
2305
|
applied: boolean;
|
|
2270
|
-
/**
|
|
2306
|
+
/** 是否为当前所在的分组(包含栈中最近一次已应用步骤的那一组)。 */
|
|
2271
2307
|
isCurrent?: boolean;
|
|
2272
2308
|
}
|
|
2273
2309
|
declare enum KeyBindingCommand {
|
|
@@ -2389,7 +2425,7 @@ interface EventBusEvent {
|
|
|
2389
2425
|
'remove-data-source': [id: string];
|
|
2390
2426
|
'edit-code': [id: string];
|
|
2391
2427
|
}
|
|
2392
|
-
interface EventBus extends EventEmitter {
|
|
2428
|
+
interface EventBus extends EventEmitter$1 {
|
|
2393
2429
|
on<Name extends keyof EventBusEvent, Param extends EventBusEvent[Name]>(eventName: Name, listener: (...args: Param) => void): this;
|
|
2394
2430
|
emit<Name extends keyof EventBusEvent, Param extends EventBusEvent[Name]>(eventName: Name, ...args: Param): boolean;
|
|
2395
2431
|
}
|
|
@@ -2427,6 +2463,26 @@ interface EditorEvents {
|
|
|
2427
2463
|
}];
|
|
2428
2464
|
'history-change': [data: MPage | MPageFragment];
|
|
2429
2465
|
}
|
|
2466
|
+
interface HistoryEvents {
|
|
2467
|
+
change: [state: BaseStepValue | StepValue | CodeBlockStepValue | DataSourceStepValue, stepType: HistoryStepType, id: Id];
|
|
2468
|
+
'code-block-history-change': [id: Id, state: CodeBlockStepValue];
|
|
2469
|
+
'data-source-history-change': [id: Id, state: DataSourceStepValue];
|
|
2470
|
+
'restore-from-indexed-db': [snapshot: PersistedHistoryState | null];
|
|
2471
|
+
'save-to-indexed-db': [snapshot: PersistedHistoryState];
|
|
2472
|
+
'mark-saved': [{
|
|
2473
|
+
kind: HistoryStepType;
|
|
2474
|
+
id?: Id;
|
|
2475
|
+
}];
|
|
2476
|
+
clear: [{
|
|
2477
|
+
id: Id;
|
|
2478
|
+
stepType: HistoryStepType;
|
|
2479
|
+
}];
|
|
2480
|
+
'marker-change': [{
|
|
2481
|
+
id: Id;
|
|
2482
|
+
marker: StepValue;
|
|
2483
|
+
stepType: HistoryStepType;
|
|
2484
|
+
}];
|
|
2485
|
+
}
|
|
2430
2486
|
declare const canUsePluginMethods: {
|
|
2431
2487
|
async: readonly ["getLayout", "highlight", "select", "multiSelect", "doAdd", "add", "doRemove", "remove", "doUpdate", "update", "sort", "copy", "paste", "doPaste", "doAlignCenter", "alignCenter", "moveLayer", "moveToContainer", "dragTo", "undo", "redo", "move"];
|
|
2432
2488
|
sync: never[];
|
|
@@ -2510,6 +2566,49 @@ interface HistoryBucketConfig<T extends BaseStepValue = BaseStepValue> extends H
|
|
|
2510
2566
|
/** 是否支持「跳转到该记录」(goto),默认 true。 */
|
|
2511
2567
|
gotoEnabled?: boolean;
|
|
2512
2568
|
}
|
|
2569
|
+
interface UseHistoryRevertOptions {
|
|
2570
|
+
/**
|
|
2571
|
+
* 父级应用上下文,用于让动态挂载的「差异确认弹窗」继承全局组件 / 指令 / provide / 插件
|
|
2572
|
+
* (Element Plus、@tmagic/form 字段组件等)。未显式传入时,会自动取调用方所在组件的 appContext
|
|
2573
|
+
* (`getCurrentInstance()?.appContext`)。业务方若在组件 setup 之外调用,需手动传入(如 `editorApp._context`)。
|
|
2574
|
+
*/
|
|
2575
|
+
appContext?: AppContext | null;
|
|
2576
|
+
/**
|
|
2577
|
+
* 透传给差异确认弹窗的 `extendState`(即 Editor 的 `extendFormState`),
|
|
2578
|
+
* 使对比表单中依赖业务上下文的 `display` / `disabled` 等 filterFunction 正常工作。
|
|
2579
|
+
*/
|
|
2580
|
+
extendState?: (_state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
2581
|
+
}
|
|
2582
|
+
/**
|
|
2583
|
+
* 业务自有历史(如管理台「模块」)做差异对比时所需的额外渲染入参。
|
|
2584
|
+
* 内置的页面 / 数据源 / 代码块按 `category` 自动取表单配置,无需传这些;
|
|
2585
|
+
* 业务自有类别可通过 `loadConfig` 注入自定义表单配置加载逻辑。
|
|
2586
|
+
*/
|
|
2587
|
+
interface CustomDiffFormOptions {
|
|
2588
|
+
/**
|
|
2589
|
+
* 自定义差异表单配置加载逻辑(如「模块」按 c_type 重建表单配置),
|
|
2590
|
+
* 透传给弹窗内部的 CompareForm;缺省时按 `category` 走内置加载。
|
|
2591
|
+
*/
|
|
2592
|
+
loadConfig?: CompareFormLoadConfig;
|
|
2593
|
+
/** 需要走 self diff 的字段类型(如模块的 mod-cond)。 */
|
|
2594
|
+
selfDiffFieldTypes?: string[];
|
|
2595
|
+
}
|
|
2596
|
+
/**
|
|
2597
|
+
* 业务自有历史复用「单步回滚」交互({@link useHistoryRevert} 的 `confirmAndRevert`)的入参。
|
|
2598
|
+
* 与内置页面 / 数据源 / 代码块回滚共用「目标校验 → 差异/二次确认弹窗 → 反向回滚」流程,
|
|
2599
|
+
* 业务方只需提供:差异弹窗入参(可选)、表单配置加载(可选)、实际回滚执行函数。
|
|
2600
|
+
*/
|
|
2601
|
+
interface ConfirmAndRevertOptions<T = unknown> extends CustomDiffFormOptions {
|
|
2602
|
+
/**
|
|
2603
|
+
* 差异确认弹窗入参;可对比的步骤(单实体 update)传入后弹差异确认弹窗,
|
|
2604
|
+
* 传 null / 省略则退化为普通二次确认框(add / remove / 不可对比)。
|
|
2605
|
+
*/
|
|
2606
|
+
diffPayload?: DiffDialogPayload | null;
|
|
2607
|
+
/** 回滚前置校验:返回 true 表示目标数据已删除等不可回滚,给出统一提示并中止。 */
|
|
2608
|
+
isTargetMissing?: () => boolean;
|
|
2609
|
+
/** 用户确认后执行的实际回滚逻辑。 */
|
|
2610
|
+
revert: () => T | Promise<T>;
|
|
2611
|
+
}
|
|
2513
2612
|
//#endregion
|
|
2514
2613
|
//#region temp/packages/editor/src/hooks/use-code-block-edit.d.ts
|
|
2515
2614
|
declare const useCodeBlockEdit: (codeBlockService: Services["codeBlockService"]) => {
|
|
@@ -2916,7 +3015,7 @@ interface IdleTaskEvents {
|
|
|
2916
3015
|
hightLevelLength: number;
|
|
2917
3016
|
}];
|
|
2918
3017
|
}
|
|
2919
|
-
declare class IdleTask<T = any> extends EventEmitter
|
|
3018
|
+
declare class IdleTask<T = any> extends EventEmitter {
|
|
2920
3019
|
private taskList;
|
|
2921
3020
|
private hightLevelTaskList;
|
|
2922
3021
|
private taskHandle;
|
|
@@ -2939,7 +3038,7 @@ interface ScrollViewerOptions {
|
|
|
2939
3038
|
height: number;
|
|
2940
3039
|
};
|
|
2941
3040
|
}
|
|
2942
|
-
declare class ScrollViewer extends EventEmitter
|
|
3041
|
+
declare class ScrollViewer extends EventEmitter {
|
|
2943
3042
|
private container;
|
|
2944
3043
|
private target;
|
|
2945
3044
|
private zoom;
|
|
@@ -3019,43 +3118,36 @@ declare const detectStackOpType: (oldVal: unknown, newVal: unknown) => "add" | "
|
|
|
3019
3118
|
*
|
|
3020
3119
|
* - `add`:oldValue = null;`remove`:newValue = null;`update`:两者都有,可带 changeRecords 做局部更新。
|
|
3021
3120
|
* - 内容会做 cloneDeep 防止后续被外部引用篡改;opType 依据 old/new 是否为 null 推断。
|
|
3022
|
-
* - 仅负责构造 step 并返回,入栈与事件 emit
|
|
3121
|
+
* - 仅负责构造 step 并返回,入栈与事件 emit 由统一的 history.push(stepType, step, id) 处理。
|
|
3023
3122
|
* - 不直接驱动业务 service,调用方负责实际写回。
|
|
3024
3123
|
*/
|
|
3025
|
-
declare const createStackStep: <T, S extends BaseStepValue<T> & {
|
|
3026
|
-
id: Id;
|
|
3027
|
-
}>(id: Id, payload: {
|
|
3124
|
+
declare const createStackStep: <T, S extends BaseStepValue<T>>(id: Id, payload: Omit<BaseStepValue<T>, "uuid" | "data" | "opType" | "diff" | "timestamp" | "saved"> & {
|
|
3028
3125
|
oldValue: T | null;
|
|
3029
3126
|
newValue: T | null;
|
|
3030
|
-
changeRecords?: ChangeRecord[];
|
|
3031
|
-
|
|
3032
|
-
source?: HistoryOpSource;
|
|
3127
|
+
changeRecords?: ChangeRecord[]; /** 展示名(缺省时从快照 name / title 推断)。 */
|
|
3128
|
+
name?: string;
|
|
3033
3129
|
}) => S | null;
|
|
3034
3130
|
declare const markStackSaved: <S extends {
|
|
3035
3131
|
saved?: boolean;
|
|
3036
3132
|
}>(undoRedo?: UndoRedo<S>) => void;
|
|
3037
3133
|
/**
|
|
3038
|
-
*
|
|
3039
|
-
*
|
|
3134
|
+
* 把单个历史栈(页面 / 代码块 / 数据源 / 扩展类型)的步骤列表按"目标"做相邻合并:
|
|
3135
|
+
* - 单实体的 'update' 按 targetId 与相邻同 targetId 的 update 合并到一个 group,组内可展开查看每步;
|
|
3136
|
+
* - 'add' / 'remove' 始终独立成组(语义上是结构变更,不应被收纳进单实体修改组);
|
|
3137
|
+
* - 多实体 'update'(如页面批量改属性)也独立成组(无明确单一目标,避免误合并)。
|
|
3040
3138
|
*
|
|
3041
|
-
*
|
|
3139
|
+
* 各类型行为完全一致,仅 `kind` 与 step 快照类型不同,统一由本方法处理。
|
|
3042
3140
|
*/
|
|
3043
|
-
declare const
|
|
3141
|
+
declare const mergeSteps: <T extends BaseStepValue>(kind: string, id: Id, list: T[], cursor: number) => HistoryGroup<T>[];
|
|
3044
3142
|
/**
|
|
3045
|
-
*
|
|
3046
|
-
* -
|
|
3047
|
-
*
|
|
3048
|
-
* -
|
|
3143
|
+
* 解析 step 中的"目标 id"用于合并:
|
|
3144
|
+
* - 单实体 update:取唯一一项 diff 的快照 id;快照无 id 时(如 CodeBlockContent)回退到 `step.data.id`
|
|
3145
|
+
* (即资源 id),使代码块 / 数据源同样能按资源合并相邻 update;
|
|
3146
|
+
* - 其它情形(多实体 update / add / remove):返回 undefined,表示不参与合并。
|
|
3049
3147
|
*/
|
|
3050
|
-
declare const
|
|
3051
|
-
/**
|
|
3052
|
-
|
|
3053
|
-
* - 单节点 update:取唯一一项 updatedItems 的节点 id;
|
|
3054
|
-
* - 其它情形(多节点 update / add / remove):返回 undefined,表示不参与合并。
|
|
3055
|
-
*/
|
|
3056
|
-
declare const detectPageTargetId: (step: StepValue) => Id | undefined;
|
|
3057
|
-
/** 解析 StepValue 中的目标节点可读名(用于 UI 展示)。 */
|
|
3058
|
-
declare const detectPageTargetName: (step: StepValue) => string | undefined;
|
|
3148
|
+
declare const detectTargetId: (step: BaseStepValue) => Id | undefined;
|
|
3149
|
+
/** 解析 step 中的目标可读名(用于 UI 展示)。 */
|
|
3150
|
+
declare const detectTargetName: (step: BaseStepValue) => string | undefined;
|
|
3059
3151
|
/**
|
|
3060
3152
|
* 把 `Record<Id, UndoRedo>` 整体序列化为 `Record<Id, SerializedUndoRedo>`。
|
|
3061
3153
|
*
|
|
@@ -3082,10 +3174,11 @@ declare const deserializeStacks: <T extends {
|
|
|
3082
3174
|
*/
|
|
3083
3175
|
declare const getOrCreateStack: <T>(stacks: Record<Id, UndoRedo<T>>, id: Id) => UndoRedo<T>;
|
|
3084
3176
|
/**
|
|
3085
|
-
*
|
|
3086
|
-
*
|
|
3177
|
+
* 撤销下限:当栈 index 0 是 `opType: 'initial'` 的基线 step 时为 1(基线不可被撤销),否则为 0。
|
|
3178
|
+
* 适用于所有历史类型(page / codeBlock / dataSource / 扩展),把 cursor 钉在基线之上,
|
|
3179
|
+
* 保证 undo / canUndo / goto 都不会越过初始基线。
|
|
3087
3180
|
*/
|
|
3088
|
-
declare const undoFloor: (undoRedo: UndoRedo<
|
|
3181
|
+
declare const undoFloor: (undoRedo: UndoRedo<any>) => number;
|
|
3089
3182
|
/** 将单次 push 产生的 history uuid(或 null)转为 *AndGetHistoryId 返回用的 uuid 列表。 */
|
|
3090
3183
|
declare const getLastPushedHistoryIds: (historyId: string | null) => string[];
|
|
3091
3184
|
//#endregion
|
|
@@ -3097,7 +3190,7 @@ declare const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData
|
|
|
3097
3190
|
declare const PROPS_PANEL_WIDTH_STORAGE_KEY = "$MagicEditorPropsPanelWidthData";
|
|
3098
3191
|
declare const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
3099
3192
|
declare const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
3100
|
-
declare const MIN_LEFT_COLUMN_WIDTH =
|
|
3193
|
+
declare const MIN_LEFT_COLUMN_WIDTH = 238;
|
|
3101
3194
|
declare const MIN_CENTER_COLUMN_WIDTH = 400;
|
|
3102
3195
|
declare const MIN_RIGHT_COLUMN_WIDTH = 300;
|
|
3103
3196
|
declare const H_GUIDE_LINE_STORAGE_KEY = "$MagicStageHorizontalGuidelinesData";
|
|
@@ -3135,6 +3228,15 @@ interface FormSlots {
|
|
|
3135
3228
|
//#endregion
|
|
3136
3229
|
//#region temp/packages/editor/src/editorProps.d.ts
|
|
3137
3230
|
interface EditorProps {
|
|
3231
|
+
/**
|
|
3232
|
+
* 主题名称:对应 `packages/editor/src/theme/themes/<theme>/index.scss` 的目录名。
|
|
3233
|
+
*
|
|
3234
|
+
* 设置后会在编辑器根元素上追加 `m-editor--<theme>` 修饰类,配合按需引入
|
|
3235
|
+
* `@tmagic/editor/dist/themes/<theme>.css` 即可启用主题样式。
|
|
3236
|
+
*
|
|
3237
|
+
* 例如:`<MEditor theme="magic-admin" />` + `import '@tmagic/editor/dist/themes/magic-admin.css'`。
|
|
3238
|
+
*/
|
|
3239
|
+
theme?: string;
|
|
3138
3240
|
/** 页面初始值 */
|
|
3139
3241
|
modelValue?: MApp;
|
|
3140
3242
|
/** 左侧面板中的组件类型列表 */
|
|
@@ -3327,6 +3429,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
3327
3429
|
config: any;
|
|
3328
3430
|
}) => boolean) | undefined;
|
|
3329
3431
|
readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
|
|
3432
|
+
readonly theme?: string | undefined;
|
|
3330
3433
|
readonly onError?: ((...args: any[]) => any) | undefined;
|
|
3331
3434
|
readonly onChange?: ((...args: any[]) => any) | undefined;
|
|
3332
3435
|
readonly "onField-input"?: ((...args: any[]) => any) | undefined;
|
|
@@ -3368,6 +3471,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
3368
3471
|
config: any;
|
|
3369
3472
|
}) => boolean;
|
|
3370
3473
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
3474
|
+
theme?: string;
|
|
3371
3475
|
}> & Readonly<{
|
|
3372
3476
|
onError?: ((...args: any[]) => any) | undefined;
|
|
3373
3477
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -3459,6 +3563,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
3459
3563
|
config: any;
|
|
3460
3564
|
}) => boolean;
|
|
3461
3565
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
3566
|
+
theme?: string;
|
|
3462
3567
|
}> & Readonly<{
|
|
3463
3568
|
onError?: ((...args: any[]) => any) | undefined;
|
|
3464
3569
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -3546,6 +3651,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
3546
3651
|
config: any;
|
|
3547
3652
|
}) => boolean) | undefined;
|
|
3548
3653
|
readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
|
|
3654
|
+
readonly theme?: string | undefined;
|
|
3549
3655
|
readonly onError?: ((...args: any[]) => any) | undefined;
|
|
3550
3656
|
readonly onChange?: ((...args: any[]) => any) | undefined;
|
|
3551
3657
|
readonly "onField-input"?: ((...args: any[]) => any) | undefined;
|
|
@@ -3587,6 +3693,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
3587
3693
|
config: any;
|
|
3588
3694
|
}) => boolean;
|
|
3589
3695
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
3696
|
+
theme?: string;
|
|
3590
3697
|
}> & Readonly<{
|
|
3591
3698
|
onError?: ((...args: any[]) => any) | undefined;
|
|
3592
3699
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -3678,6 +3785,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
3678
3785
|
config: any;
|
|
3679
3786
|
}) => boolean;
|
|
3680
3787
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
3788
|
+
theme?: string;
|
|
3681
3789
|
}> & Readonly<{
|
|
3682
3790
|
onError?: ((...args: any[]) => any) | undefined;
|
|
3683
3791
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -3779,6 +3887,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
3779
3887
|
config: any;
|
|
3780
3888
|
}) => boolean) | undefined;
|
|
3781
3889
|
readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
|
|
3890
|
+
readonly theme?: string | undefined;
|
|
3782
3891
|
readonly onError?: ((...args: any[]) => any) | undefined;
|
|
3783
3892
|
readonly onChange?: ((...args: any[]) => any) | undefined;
|
|
3784
3893
|
readonly "onField-input"?: ((...args: any[]) => any) | undefined;
|
|
@@ -3820,6 +3929,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
3820
3929
|
config: any;
|
|
3821
3930
|
}) => boolean;
|
|
3822
3931
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
3932
|
+
theme?: string;
|
|
3823
3933
|
}> & Readonly<{
|
|
3824
3934
|
onError?: ((...args: any[]) => any) | undefined;
|
|
3825
3935
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -3911,6 +4021,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
3911
4021
|
config: any;
|
|
3912
4022
|
}) => boolean;
|
|
3913
4023
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
4024
|
+
theme?: string;
|
|
3914
4025
|
}> & Readonly<{
|
|
3915
4026
|
onError?: ((...args: any[]) => any) | undefined;
|
|
3916
4027
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -3998,6 +4109,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
3998
4109
|
config: any;
|
|
3999
4110
|
}) => boolean) | undefined;
|
|
4000
4111
|
readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
|
|
4112
|
+
readonly theme?: string | undefined;
|
|
4001
4113
|
readonly onError?: ((...args: any[]) => any) | undefined;
|
|
4002
4114
|
readonly onChange?: ((...args: any[]) => any) | undefined;
|
|
4003
4115
|
readonly "onField-input"?: ((...args: any[]) => any) | undefined;
|
|
@@ -4039,6 +4151,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
4039
4151
|
config: any;
|
|
4040
4152
|
}) => boolean;
|
|
4041
4153
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
4154
|
+
theme?: string;
|
|
4042
4155
|
}> & Readonly<{
|
|
4043
4156
|
onError?: ((...args: any[]) => any) | undefined;
|
|
4044
4157
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -4130,6 +4243,7 @@ declare const __VLS_base$12: import("@vue/runtime-core").DefineComponent<EditorP
|
|
|
4130
4243
|
config: any;
|
|
4131
4244
|
}) => boolean;
|
|
4132
4245
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
4246
|
+
theme?: string;
|
|
4133
4247
|
}> & Readonly<{
|
|
4134
4248
|
onError?: ((...args: any[]) => any) | undefined;
|
|
4135
4249
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -4604,6 +4718,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
4604
4718
|
config: any;
|
|
4605
4719
|
}) => boolean) | undefined;
|
|
4606
4720
|
readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
|
|
4721
|
+
readonly theme?: string | undefined;
|
|
4607
4722
|
readonly onError?: ((...args: any[]) => any) | undefined;
|
|
4608
4723
|
readonly onChange?: ((...args: any[]) => any) | undefined;
|
|
4609
4724
|
readonly "onField-input"?: ((...args: any[]) => any) | undefined;
|
|
@@ -4645,6 +4760,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
4645
4760
|
config: any;
|
|
4646
4761
|
}) => boolean;
|
|
4647
4762
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
4763
|
+
theme?: string;
|
|
4648
4764
|
}> & Readonly<{
|
|
4649
4765
|
onError?: ((...args: any[]) => any) | undefined;
|
|
4650
4766
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -4736,6 +4852,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
4736
4852
|
config: any;
|
|
4737
4853
|
}) => boolean;
|
|
4738
4854
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
4855
|
+
theme?: string;
|
|
4739
4856
|
}> & Readonly<{
|
|
4740
4857
|
onError?: ((...args: any[]) => any) | undefined;
|
|
4741
4858
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -4823,6 +4940,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
4823
4940
|
config: any;
|
|
4824
4941
|
}) => boolean) | undefined;
|
|
4825
4942
|
readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
|
|
4943
|
+
readonly theme?: string | undefined;
|
|
4826
4944
|
readonly onError?: ((...args: any[]) => any) | undefined;
|
|
4827
4945
|
readonly onChange?: ((...args: any[]) => any) | undefined;
|
|
4828
4946
|
readonly "onField-input"?: ((...args: any[]) => any) | undefined;
|
|
@@ -4864,6 +4982,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
4864
4982
|
config: any;
|
|
4865
4983
|
}) => boolean;
|
|
4866
4984
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
4985
|
+
theme?: string;
|
|
4867
4986
|
}> & Readonly<{
|
|
4868
4987
|
onError?: ((...args: any[]) => any) | undefined;
|
|
4869
4988
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -4955,6 +5074,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
4955
5074
|
config: any;
|
|
4956
5075
|
}) => boolean;
|
|
4957
5076
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
5077
|
+
theme?: string;
|
|
4958
5078
|
}> & Readonly<{
|
|
4959
5079
|
onError?: ((...args: any[]) => any) | undefined;
|
|
4960
5080
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -5054,6 +5174,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
5054
5174
|
config: any;
|
|
5055
5175
|
}) => boolean) | undefined;
|
|
5056
5176
|
readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
|
|
5177
|
+
readonly theme?: string | undefined;
|
|
5057
5178
|
readonly onError?: ((...args: any[]) => any) | undefined;
|
|
5058
5179
|
readonly onChange?: ((...args: any[]) => any) | undefined;
|
|
5059
5180
|
readonly "onField-input"?: ((...args: any[]) => any) | undefined;
|
|
@@ -5095,6 +5216,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
5095
5216
|
config: any;
|
|
5096
5217
|
}) => boolean;
|
|
5097
5218
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
5219
|
+
theme?: string;
|
|
5098
5220
|
}> & Readonly<{
|
|
5099
5221
|
onError?: ((...args: any[]) => any) | undefined;
|
|
5100
5222
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -5186,6 +5308,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
5186
5308
|
config: any;
|
|
5187
5309
|
}) => boolean;
|
|
5188
5310
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
5311
|
+
theme?: string;
|
|
5189
5312
|
}> & Readonly<{
|
|
5190
5313
|
onError?: ((...args: any[]) => any) | undefined;
|
|
5191
5314
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -5273,6 +5396,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
5273
5396
|
config: any;
|
|
5274
5397
|
}) => boolean) | undefined;
|
|
5275
5398
|
readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
|
|
5399
|
+
readonly theme?: string | undefined;
|
|
5276
5400
|
readonly onError?: ((...args: any[]) => any) | undefined;
|
|
5277
5401
|
readonly onChange?: ((...args: any[]) => any) | undefined;
|
|
5278
5402
|
readonly "onField-input"?: ((...args: any[]) => any) | undefined;
|
|
@@ -5314,6 +5438,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
5314
5438
|
config: any;
|
|
5315
5439
|
}) => boolean;
|
|
5316
5440
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
5441
|
+
theme?: string;
|
|
5317
5442
|
}> & Readonly<{
|
|
5318
5443
|
onError?: ((...args: any[]) => any) | undefined;
|
|
5319
5444
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -5405,6 +5530,7 @@ declare const __VLS_base$7: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
5405
5530
|
config: any;
|
|
5406
5531
|
}) => boolean;
|
|
5407
5532
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
5533
|
+
theme?: string;
|
|
5408
5534
|
}> & Readonly<{
|
|
5409
5535
|
onError?: ((...args: any[]) => any) | undefined;
|
|
5410
5536
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -5482,6 +5608,7 @@ declare const __VLS_base$6: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
5482
5608
|
config: any;
|
|
5483
5609
|
}) => boolean) | undefined;
|
|
5484
5610
|
readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
|
|
5611
|
+
readonly theme?: string | undefined;
|
|
5485
5612
|
readonly onError?: ((...args: any[]) => any) | undefined;
|
|
5486
5613
|
readonly onChange?: ((...args: any[]) => any) | undefined;
|
|
5487
5614
|
readonly "onField-input"?: ((...args: any[]) => any) | undefined;
|
|
@@ -5523,6 +5650,7 @@ declare const __VLS_base$6: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
5523
5650
|
config: any;
|
|
5524
5651
|
}) => boolean;
|
|
5525
5652
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
5653
|
+
theme?: string;
|
|
5526
5654
|
}> & Readonly<{
|
|
5527
5655
|
onError?: ((...args: any[]) => any) | undefined;
|
|
5528
5656
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -5614,6 +5742,7 @@ declare const __VLS_base$6: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
5614
5742
|
config: any;
|
|
5615
5743
|
}) => boolean;
|
|
5616
5744
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
5745
|
+
theme?: string;
|
|
5617
5746
|
}> & Readonly<{
|
|
5618
5747
|
onError?: ((...args: any[]) => any) | undefined;
|
|
5619
5748
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
@@ -5853,7 +5982,8 @@ type __VLS_Props$8 = {
|
|
|
5853
5982
|
* 取配置逻辑,调用方可根据业务自行返回(或异步返回)表单配置。可通过
|
|
5854
5983
|
* `ctx.defaultLoadConfig()` 复用默认结果再做二次加工。返回的 config 直接用于对比展示。
|
|
5855
5984
|
*/
|
|
5856
|
-
loadConfig?: CompareFormLoadConfig;
|
|
5985
|
+
loadConfig?: CompareFormLoadConfig; /** 编辑器服务集合,由调用方传入(不再通过 inject('services') 获取)。 */
|
|
5986
|
+
services: Services;
|
|
5857
5987
|
};
|
|
5858
5988
|
declare const __VLS_export$10: import("@vue/runtime-core").DefineComponent<__VLS_Props$8, {
|
|
5859
5989
|
form: ShallowRef<InstanceType<typeof MForm> | null>;
|
|
@@ -5861,6 +5991,7 @@ declare const __VLS_export$10: import("@vue/runtime-core").DefineComponent<__VLS
|
|
|
5861
5991
|
reload: () => Promise<void>;
|
|
5862
5992
|
}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<__VLS_Props$8> & Readonly<{}>, {
|
|
5863
5993
|
labelWidth: string;
|
|
5994
|
+
services: Services;
|
|
5864
5995
|
category: CompareCategory;
|
|
5865
5996
|
}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
|
|
5866
5997
|
declare const _default$5: typeof __VLS_export$10;
|
|
@@ -5885,6 +6016,11 @@ interface HistoryBucketGroup<T extends BaseStepValue = BaseStepValue> {
|
|
|
5885
6016
|
step: T;
|
|
5886
6017
|
}[];
|
|
5887
6018
|
}
|
|
6019
|
+
/**
|
|
6020
|
+
* 通用二次确认弹窗:清空历史 / 无法差异对比的回滚等会改变状态的操作,先弹出确认框,
|
|
6021
|
+
* 用户点击「确定」返回 true,取消(confirm reject)时返回 false 并静默忽略。
|
|
6022
|
+
*/
|
|
6023
|
+
declare const confirmHistoryAction: (message: string) => Promise<boolean>;
|
|
5888
6024
|
//#endregion
|
|
5889
6025
|
//#region temp/packages/editor/src/layouts/history-list/Bucket.vue.d.ts
|
|
5890
6026
|
declare const __VLS_export$9: <T extends BaseStepValue = BaseStepValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal$1<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
@@ -5973,6 +6109,7 @@ type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K i
|
|
|
5973
6109
|
//#endregion
|
|
5974
6110
|
//#region temp/packages/editor/src/layouts/history-list/HistoryDiffDialog.vue.d.ts
|
|
5975
6111
|
type __VLS_Props$7 = {
|
|
6112
|
+
/** 编辑器服务集合,由调用方传入(不再通过 inject('services') 获取)。 */services: Services;
|
|
5976
6113
|
/**
|
|
5977
6114
|
* 来自 Editor 顶层的 `extendFormState`,用于扩展 MForm.formState。
|
|
5978
6115
|
* 透传给 CompareForm,从而让差异对比时表单 item 中依赖业务上下文的
|
|
@@ -5999,9 +6136,56 @@ declare const __VLS_export$7: import("@vue/runtime-core").DefineComponent<__VLS_
|
|
|
5999
6136
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
6000
6137
|
}>, {
|
|
6001
6138
|
width: string;
|
|
6139
|
+
services: Services;
|
|
6002
6140
|
}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
|
|
6003
6141
|
declare const _default$21: typeof __VLS_export$7;
|
|
6004
6142
|
//#endregion
|
|
6143
|
+
//#region temp/packages/editor/src/layouts/history-list/useHistoryRevert.d.ts
|
|
6144
|
+
/**
|
|
6145
|
+
* 历史记录「单步回滚」与「查看差异」的完整交互流程,供历史面板与业务方共用。
|
|
6146
|
+
*
|
|
6147
|
+
* 单步回滚(类 git revert):
|
|
6148
|
+
* 1. 前置校验:目标数据已被删除(update 写回目标 / 页面 remove 的原父容器缺失)时给出「回滚失败」提示并中止;
|
|
6149
|
+
* 2. 二次确认:可差异对比的步骤(单实体 update)弹出差异确认弹窗,其余步骤弹普通二次确认框;
|
|
6150
|
+
* 3. 用户确认后执行对应 service 的 revert(页面 / 数据源 / 代码块)。
|
|
6151
|
+
*
|
|
6152
|
+
* 查看差异:可差异对比的步骤动态挂载只读 HistoryDiffDialog 展示前后值差异。
|
|
6153
|
+
*
|
|
6154
|
+
* 上述弹窗均按需动态挂载 HistoryDiffDialog 实现,业务方无需自行挂载任何弹窗。
|
|
6155
|
+
*
|
|
6156
|
+
* 返回的能力分三组:
|
|
6157
|
+
* - 内置三类(页面 / 数据源 / 代码块):`onPageRevert` / `onDataSourceRevert` / `onCodeBlockRevert` 单步回滚,
|
|
6158
|
+
* `onPageDiff` / `onDataSourceDiff` / `onCodeBlockDiff` 查看差异,及配套的 `buildXxxDiffPayload` / `isXxxRevertTargetMissing`;
|
|
6159
|
+
* - 业务自有历史(如管理台「模块」):`confirmAndRevert` / `viewDiff` 复用同一套交互流程,由业务方自行构造差异入参;
|
|
6160
|
+
* 即上述内置三类本质上是它们各自预置好 payload 构造与 service.revert 的特例。
|
|
6161
|
+
*
|
|
6162
|
+
* 业务方可在拿到 Editor 实例暴露的 `services` 后直接 import 调用:
|
|
6163
|
+
*
|
|
6164
|
+
* ```ts
|
|
6165
|
+
* import { useHistoryRevert } from '@tmagic/editor';
|
|
6166
|
+
*
|
|
6167
|
+
* const { onPageRevert, onPageDiff } = useHistoryRevert(editorRef.value); // editorRef.value 即 Editor 暴露的 services
|
|
6168
|
+
* await onPageRevert(index); // 弹出差异 / 二次确认弹窗后回滚
|
|
6169
|
+
* onPageDiff(index); // 弹出只读差异弹窗查看前后值差异
|
|
6170
|
+
* ```
|
|
6171
|
+
*/
|
|
6172
|
+
declare const useHistoryRevert: (services: Pick<Services, "editorService" | "dataSourceService" | "codeBlockService" | "historyService">, options?: UseHistoryRevertOptions) => {
|
|
6173
|
+
onPageRevert: (index: number) => Promise<StepValue | null>;
|
|
6174
|
+
onDataSourceRevert: (id: string | number, index: number) => Promise<DataSourceStepValue | null>;
|
|
6175
|
+
onCodeBlockRevert: (id: string | number, index: number) => Promise<CodeBlockStepValue | null>;
|
|
6176
|
+
onPageDiff: (index: number) => Promise<void> | void;
|
|
6177
|
+
onDataSourceDiff: (id: string | number, index: number) => Promise<void> | void;
|
|
6178
|
+
onCodeBlockDiff: (id: string | number, index: number) => Promise<void> | void;
|
|
6179
|
+
buildPageDiffPayload: (index: number) => DiffDialogPayload | null;
|
|
6180
|
+
buildDataSourceDiffPayload: (id: string | number, index: number) => DiffDialogPayload | null;
|
|
6181
|
+
buildCodeBlockDiffPayload: (id: string | number, index: number) => DiffDialogPayload | null;
|
|
6182
|
+
isPageRevertTargetMissing: (index: number) => boolean;
|
|
6183
|
+
isDataSourceRevertTargetMissing: (id: string | number, index: number) => boolean;
|
|
6184
|
+
isCodeBlockRevertTargetMissing: (id: string | number, index: number) => boolean;
|
|
6185
|
+
confirmAndRevert: <T = unknown>(revertOptions: ConfirmAndRevertOptions<T>) => Promise<T | null>;
|
|
6186
|
+
viewDiff: (payload: DiffDialogPayload | null, extra?: CustomDiffFormOptions) => Promise<void> | void;
|
|
6187
|
+
};
|
|
6188
|
+
//#endregion
|
|
6005
6189
|
//#region temp/packages/editor/src/components/FloatingBox.vue.d.ts
|
|
6006
6190
|
interface Position {
|
|
6007
6191
|
left: number;
|
|
@@ -6196,4 +6380,4 @@ declare const _default$40: {
|
|
|
6196
6380
|
install: (app: App, opt?: Partial<EditorInstallOptions | DesignPluginOptions | FormInstallOptions>) => void;
|
|
6197
6381
|
};
|
|
6198
6382
|
//#endregion
|
|
6199
|
-
export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, AsyncMethodName, BaseStepValue, 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, CodeBlockStepValue, CodeDeleteErrorType, CodeDslItem, CodeParamStatement, CodeRelation, _default$3 as CodeSelect, _default$4 as CodeSelectCol, CodeState, ColumnLayout, CombineInfo, CompareCategory, _default$5 as CompareForm, CompareFormLoadConfig, CompareFormLoadConfigContext, ComponentGroup, ComponentGroupState, ComponentItem, _default$6 as ComponentListPanel, ComponentListPanelSlots, _default$7 as CondOpSelect, _default$8 as ContentMenu, CustomContentMenuFunction, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, _default$9 as DataSourceAddButton, _default$10 as DataSourceConfigPanel, _default$11 as DataSourceFieldSelect, _default$12 as DataSourceFields, _default$13 as DataSourceInput, DataSourceListSlots, _default$14 as DataSourceMethodSelect, _default$15 as DataSourceMethods, _default$16 as DataSourceMocks, _default$17 as DataSourceSelect, DataSourceStepValue, DatasourceTypeOption, DepTargetType, DiffDialogPayload, _default$18 as DisplayConds, DragClassification, DragType, DslOpOptions, DslOpWithHistoryIdsResult, EditorEvents, EditorInstallOptions, EditorNodeInfo, EditorSlots, EventBus, EventBusEvent, _default$19 as EventSelect, Fixed2Other, _default$20 as FloatingBox, FrameworkSlots, GetCodeBlockFormConfigOptions, GetColumnWidth, GetConfig, H_GUIDE_LINE_STORAGE_KEY, HistoryBucketConfig, _default$21 as HistoryDiffDialog, _default$22 as HistoryListBucket, _default$23 as HistoryListBucketTab, HistoryListExtraTab, HistoryOpOptions, HistoryOpOptionsWithChangeRecords, HistoryOpSource, HistoryOpType, HistoryPersistOptions, HistoryRowDescriptor, HistoryState, _default$24 as Icon, IdleTask, IdleTaskEvents, IsExpandableFunction, KeyBindingCacheItem, KeyBindingCommand, KeyBindingItem, _default$25 as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerNodeSlots, LayerNodeStatus, LayerOffset, _default$26 as LayerPanel, LayerPanelSlots, Layout, _default$27 as LayoutContainer, _default$27 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$28 as PageFragmentSelect,
|
|
6383
|
+
export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, AsyncMethodName, BaseStepValue, 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, CodeBlockStepValue, CodeDeleteErrorType, CodeDslItem, CodeParamStatement, CodeRelation, _default$3 as CodeSelect, _default$4 as CodeSelectCol, CodeState, ColumnLayout, CombineInfo, CompareCategory, _default$5 as CompareForm, CompareFormLoadConfig, CompareFormLoadConfigContext, ComponentGroup, ComponentGroupState, ComponentItem, _default$6 as ComponentListPanel, ComponentListPanelSlots, _default$7 as CondOpSelect, ConfirmAndRevertOptions, _default$8 as ContentMenu, CustomContentMenuFunction, CustomDiffFormOptions, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, _default$9 as DataSourceAddButton, _default$10 as DataSourceConfigPanel, _default$11 as DataSourceFieldSelect, _default$12 as DataSourceFields, _default$13 as DataSourceInput, DataSourceListSlots, _default$14 as DataSourceMethodSelect, _default$15 as DataSourceMethods, _default$16 as DataSourceMocks, _default$17 as DataSourceSelect, DataSourceStepValue, DatasourceTypeOption, DepTargetType, DiffDialogPayload, _default$18 as DisplayConds, DragClassification, DragType, DslOpOptions, DslOpWithHistoryIdsResult, EditorEvents, EditorInstallOptions, EditorNodeInfo, EditorSlots, EventBus, EventBusEvent, _default$19 as EventSelect, Fixed2Other, _default$20 as FloatingBox, FrameworkSlots, GetCodeBlockFormConfigOptions, GetColumnWidth, GetConfig, H_GUIDE_LINE_STORAGE_KEY, HistoryBucketConfig, _default$21 as HistoryDiffDialog, HistoryEvents, HistoryGroup, _default$22 as HistoryListBucket, _default$23 as HistoryListBucketTab, HistoryListExtraTab, HistoryOpOptions, HistoryOpOptionsWithChangeRecords, HistoryOpSource, HistoryOpType, HistoryPersistOptions, HistoryRowDescriptor, HistoryState, HistoryStepEntry, HistoryStepType, HistorySteps, _default$24 as Icon, IdleTask, IdleTaskEvents, IsExpandableFunction, KeyBindingCacheItem, KeyBindingCommand, KeyBindingItem, _default$25 as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerNodeSlots, LayerNodeStatus, LayerOffset, _default$26 as LayerPanel, LayerPanelSlots, Layout, _default$27 as LayoutContainer, _default$27 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$28 as PageFragmentSelect, PartSortableOptions, PastePosition, PersistedHistoryState, PropsFormConfigFunction, _default$29 as PropsFormPanel, PropsFormValueFunction, _default$30 as PropsPanel, PropsPanelSlots, PropsState, RIGHT_COLUMN_WIDTH_STORAGE_KEY, _default$31 as Resizer, ScrollViewer, ScrollViewerEvent, ScrollViewerSlots, SerializedUndoRedo, Services, SetColumnWidth, SideBarData, SideComponent, SideItem, SideItemKey, SidebarSlots, StageCore, StageOptions, StageOverlayState, StageRect, StageSlots, StepDiffItem, StepExtra, StepValue, StoreState, StoreStateKey, _default$32 as StyleSetter, SyncAfterHook, SyncBeforeHook, SyncHookPlugin, _default$33 as TMagicCodeEditor, _default$34 as TMagicEditor, _default$35 as ToolButton, _default$36 as Tree, _default$37 as TreeNode, TreeNodeData, UI_SELECT_MODE_EVENT_NAME, UiState, UndoRedo, UseHistoryRevertOptions, V_GUIDE_LINE_STORAGE_KEY, WorkspaceSlots, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, _default$38 as codeBlockService, collectRelatedNodes, confirmHistoryAction, createStackStep, _default$39 as dataSourceService, debug, _default$40 as default, defaultIsExpandable, _default$41 as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin, detectStackOpType, detectTargetId, detectTargetName, displayTabConfig, editorNodeMergeCustomizer, _default$42 as editorService, eqOptions, error, eventTabConfig, _default$43 as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getCodeBlockFormConfig, getDefaultConfig, getDisplayField, getEditorConfig, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getLastPushedHistoryIds, getNodeIndex, getOrCreateStack, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, _default$44 as historyService, idbDelete, idbGet, idbSet, info, isIncludeDataSource, isIndexedDBSupported, _default$45 as loadMonaco, log, markStackSaved, mergeSteps, moveItemsInContainer, numberOptions, openIndexedDB, _default$46 as propsService, resolveSelectedNode, serializeConfig, serializeStacks, setChildrenLayout, setEditorConfig, setLayout, _default$47 as stageOverlayService, _default$48 as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, _default$49 as uiService, undoFloor, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useHistoryRevert, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
|