@tmagic/editor 1.8.0-manmanyu.8 → 1.8.0
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 +22 -13
- package/dist/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +10 -5
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +7 -6
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +21 -119
- package/dist/es/components/ContentMenu.vue_vue_type_script_setup_true_lang.js +21 -5
- package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +62 -16
- 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 +3 -2
- package/dist/es/components/ScrollBar.js +0 -1
- package/dist/es/components/ScrollBar.vue_vue_type_script_setup_true_lang.js +5 -4
- 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/components/ViewForm.js +5 -0
- package/dist/es/components/ViewForm.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/es/editorProps.js +7 -1
- package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/CodeLink.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +30 -113
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +7 -19
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +7 -6
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +12 -4
- package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +9 -20
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +2 -2
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +5 -3
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +9 -4
- package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +10 -110
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +52 -363
- package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/PageFragmentSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +3 -6
- package/dist/es/fields/StyleSetter/components/BackgroundPosition.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +4 -35
- package/dist/es/fields/StyleSetter/components/Box.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/fields/StyleSetter/configs.js +663 -0
- package/dist/es/fields/StyleSetter/icons/align-items/Center.js +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/FlexEnd.js +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/FlexStart.js +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/SpaceAround.js +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/SpaceBetween.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/NoRepeat.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/Repeat.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatX.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatY.js +1 -1
- 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 +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/ColumnReverse.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/Row.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/RowReverse.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/Center.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexEnd.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexStart.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceAround.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceBetween.js +1 -1
- 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 +29 -106
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +8 -11
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +30 -89
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +29 -297
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +29 -82
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +8 -24
- package/dist/es/fields/UISelect.js +0 -1
- package/dist/es/fields/UISelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/configs/codeSelect.js +98 -0
- package/dist/es/fields/configs/displayConds.js +158 -0
- package/dist/es/fields/configs/eventSelect.js +225 -0
- package/dist/es/fields/configs/stickyAddButton.js +21 -0
- package/dist/es/fields/headless-validation.js +139 -0
- package/dist/es/headless.js +2 -0
- package/dist/es/hooks/use-code-block-edit.js +4 -2
- package/dist/es/hooks/use-compare-form.js +101 -0
- package/dist/es/hooks/use-form-context.js +29 -0
- package/dist/es/hooks/use-stage.js +1 -0
- 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 +1 -1
- package/dist/es/icons/FolderMinusIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/index.js +17 -9
- package/dist/es/initService.js +52 -16
- 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 +26 -10
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +11 -8
- 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 +8 -5
- package/dist/es/layouts/history-list/GroupRow.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +26 -10
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +36 -28
- 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 +1 -1
- package/dist/es/layouts/history-list/useHistoryList.js +4 -4
- package/dist/es/layouts/history-list/useHistoryRevert.js +38 -33
- 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 +50 -20
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +53 -35
- package/dist/es/layouts/props-panel/use-style-panel.js +3 -2
- package/dist/es/layouts/sidebar/ComponentListPanel.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +21 -36
- 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 +4 -4
- package/dist/es/layouts/sidebar/code-block/useContentMenu.js +19 -4
- 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 +9 -4
- 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 +4 -4
- package/dist/es/layouts/sidebar/data-source/useContentMenu.js +19 -4
- package/dist/es/layouts/sidebar/layer/LayerMenu.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/layouts/sidebar/layer/LayerNodeContent.js +5 -0
- package/dist/es/layouts/sidebar/layer/LayerNodeContent.vue_vue_type_script_setup_true_lang.js +46 -0
- 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 +6 -4
- package/dist/es/layouts/sidebar/layer/use-click.js +3 -3
- package/dist/es/layouts/sidebar/layer/use-drag.js +11 -10
- package/dist/es/layouts/sidebar/layer/use-node-status.js +2 -2
- 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 +9 -3
- package/dist/es/layouts/workspace/viewer/Stage.vue_vue_type_script_setup_true_lang.js +55 -9
- 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 +8 -8
- package/dist/es/plugin.js +35 -23
- package/dist/es/services/codeBlock.js +40 -31
- package/dist/es/services/dataSource.js +46 -34
- package/dist/es/services/dep.js +162 -41
- package/dist/es/services/editor.js +373 -137
- package/dist/es/services/events.js +4 -4
- package/dist/es/services/history.js +275 -392
- package/dist/es/services/keybinding.js +3 -3
- package/dist/es/services/props.js +2 -1
- package/dist/es/services/storage.js +2 -2
- package/dist/es/services/ui.js +7 -2
- package/dist/es/style.css +277 -114
- package/dist/es/utils/code-block.js +14 -7
- package/dist/es/utils/config.js +4 -1
- package/dist/es/utils/const.js +2 -2
- package/dist/es/utils/content-menu.js +2 -2
- package/dist/es/utils/data-source/index.js +34 -12
- package/dist/es/utils/dep/collect-worker-client.js +154 -0
- package/dist/es/utils/dep/idle-task.js +70 -22
- package/dist/es/utils/dep/worker.js +1 -1
- package/dist/es/utils/editor.js +4 -2
- package/dist/es/utils/event.js +135 -0
- package/dist/es/utils/history.js +35 -47
- package/dist/es/utils/monaco-editor.js +22 -6
- package/dist/es/utils/operator.js +2 -2
- package/dist/es/utils/props.js +50 -106
- package/dist/es/utils/type-match-rules.js +356 -0
- package/dist/style.css +277 -114
- package/dist/themes/magic-admin.css +978 -175
- package/dist/tmagic-editor-headless.umd.cjs +10880 -0
- package/dist/tmagic-editor.umd.cjs +13047 -11363
- package/package.json +18 -13
- package/src/Editor.vue +23 -6
- package/src/components/CodeBlockEditor.vue +3 -0
- package/src/components/CodeParams.vue +10 -4
- package/src/components/CompareForm.vue +20 -190
- package/src/components/ContentMenu.vue +34 -6
- package/src/components/FloatingBox.vue +71 -7
- package/src/components/ScrollBar.vue +0 -67
- package/src/components/ViewForm.vue +54 -0
- package/src/editorProps.ts +23 -10
- package/src/fields/Code.vue +1 -1
- package/src/fields/CodeSelect.vue +20 -113
- package/src/fields/CodeSelectCol.vue +1 -1
- package/src/fields/CondOpSelect.vue +5 -26
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +2 -2
- package/src/fields/DataSourceFieldSelect/Index.vue +4 -1
- package/src/fields/DataSourceFields.vue +5 -1
- package/src/fields/DataSourceInput.vue +10 -28
- package/src/fields/DataSourceMethodSelect.vue +1 -1
- package/src/fields/DataSourceMethods.vue +6 -2
- package/src/fields/DataSourceMocks.vue +3 -0
- package/src/fields/DataSourceSelect.vue +1 -1
- package/src/fields/DisplayConds.vue +17 -139
- package/src/fields/EventSelect.vue +29 -416
- package/src/fields/KeyValue.vue +1 -1
- package/src/fields/StyleSetter/Index.vue +2 -8
- package/src/fields/StyleSetter/components/Border.vue +4 -38
- package/src/fields/StyleSetter/components/Box.vue +1 -1
- package/src/fields/StyleSetter/components/Position.vue +1 -1
- package/src/fields/StyleSetter/configs.ts +690 -0
- package/src/fields/StyleSetter/pro/Background.vue +9 -64
- package/src/fields/StyleSetter/pro/Border.vue +5 -16
- package/src/fields/StyleSetter/pro/Font.vue +11 -71
- package/src/fields/StyleSetter/pro/Layout.vue +10 -230
- package/src/fields/StyleSetter/pro/Position.vue +11 -82
- package/src/fields/StyleSetter/pro/Transform.vue +6 -34
- package/src/fields/UISelect.vue +0 -12
- package/src/fields/configs/codeSelect.ts +127 -0
- package/src/fields/configs/displayConds.ts +184 -0
- package/src/fields/configs/eventSelect.ts +309 -0
- package/src/fields/configs/stickyAddButton.ts +32 -0
- package/src/fields/headless-validation.ts +177 -0
- package/src/headless.ts +33 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-compare-form.ts +166 -0
- package/src/hooks/use-form-context.ts +56 -0
- package/src/hooks/use-stage.ts +1 -0
- package/src/index.ts +9 -0
- package/src/initService.ts +73 -18
- package/src/layouts/CodeEditor.vue +32 -6
- package/src/layouts/Framework.vue +7 -6
- package/src/layouts/history-list/BucketTab.vue +2 -2
- package/src/layouts/history-list/HistoryDiffDialog.vue +33 -15
- package/src/layouts/history-list/HistoryListPanel.vue +16 -18
- package/src/layouts/history-list/useHistoryRevert.ts +57 -41
- package/src/layouts/props-panel/FormPanel.vue +75 -20
- package/src/layouts/props-panel/PropsPanel.vue +81 -30
- package/src/layouts/props-panel/use-style-panel.ts +4 -3
- package/src/layouts/sidebar/ComponentListPanel.vue +6 -2
- package/src/layouts/sidebar/Sidebar.vue +5 -3
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +5 -2
- package/src/layouts/sidebar/code-block/useContentMenu.ts +14 -2
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +3 -0
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +3 -3
- package/src/layouts/sidebar/data-source/useContentMenu.ts +14 -2
- package/src/layouts/sidebar/layer/LayerMenu.vue +2 -2
- package/src/layouts/sidebar/layer/LayerNodeContent.vue +57 -0
- package/src/layouts/sidebar/layer/LayerPanel.vue +5 -2
- package/src/layouts/sidebar/layer/use-click.ts +3 -3
- package/src/layouts/sidebar/layer/use-node-status.ts +2 -2
- package/src/layouts/workspace/viewer/NodeListMenu.vue +4 -1
- package/src/layouts/workspace/viewer/Stage.vue +80 -10
- package/src/layouts/workspace/viewer/ViewerMenu.vue +7 -7
- package/src/plugin.ts +35 -25
- package/src/services/codeBlock.ts +4 -0
- package/src/services/dataSource.ts +3 -0
- package/src/services/dep.ts +292 -47
- package/src/services/editor.ts +383 -120
- package/src/services/events.ts +8 -7
- package/src/services/history.ts +22 -1
- package/src/services/keybinding.ts +3 -3
- package/src/services/ui.ts +26 -5
- package/src/theme/code-block.scss +0 -37
- package/src/theme/display-conds.scss +4 -0
- package/src/theme/event.scss +25 -33
- package/src/theme/floating-box.scss +9 -1
- package/src/theme/framework.scss +4 -1
- package/src/theme/layer-node-content.scss +14 -0
- package/src/theme/nav-menu.scss +5 -1
- package/src/theme/props-panel.scss +17 -3
- package/src/theme/scroll-bar.scss +64 -0
- package/src/theme/theme.scss +3 -0
- package/src/theme/themes/magic-admin/index.scss +109 -9
- package/src/theme/ui-select.scss +9 -0
- package/src/type.ts +216 -6
- package/src/utils/code-block.ts +1 -0
- package/src/utils/config.ts +9 -1
- package/src/utils/const.ts +3 -3
- package/src/utils/content-menu.ts +2 -2
- package/src/utils/data-source/index.ts +31 -12
- package/src/utils/dep/collect-worker-client.ts +215 -0
- package/src/utils/dep/idle-task.ts +104 -35
- package/src/utils/dep/worker.ts +113 -9
- package/src/utils/event.ts +237 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/monaco-editor.ts +27 -0
- package/src/utils/operator.ts +2 -2
- package/src/utils/props.ts +61 -122
- package/src/utils/type-match-rules.ts +697 -0
- package/types/headless.d.ts +17 -0
- package/types/index.d.ts +1494 -978
- package/src/fields/StyleSetter/icons/align-items/index copy.ts +0 -5
package/dist/es/plugin.js
CHANGED
|
@@ -16,46 +16,58 @@ import PageFragmentSelect_default from "./fields/PageFragmentSelect.js";
|
|
|
16
16
|
import DisplayConds_default from "./fields/DisplayConds.js";
|
|
17
17
|
import CondOpSelect_default from "./fields/CondOpSelect.js";
|
|
18
18
|
import Index_default$1 from "./fields/StyleSetter/Index.js";
|
|
19
|
+
import { editorFields } from "./fields/headless-validation.js";
|
|
19
20
|
import Code_default from "./fields/Code.js";
|
|
20
21
|
import CodeLink_default from "./fields/CodeLink.js";
|
|
21
22
|
import UISelect_default from "./fields/UISelect.js";
|
|
22
23
|
/* empty css */
|
|
23
|
-
import formPlugin from "@tmagic/form";
|
|
24
|
+
import formPlugin, { mergeFieldOptions } from "@tmagic/form";
|
|
24
25
|
import tablePlugin from "@tmagic/table";
|
|
25
26
|
import designPlugin from "@tmagic/design";
|
|
26
27
|
//#region packages/editor/src/plugin.ts
|
|
27
28
|
var defaultInstallOpt = {
|
|
28
29
|
parseDSL: (dsl) => eval(dsl),
|
|
29
30
|
customCreateMonacoEditor: (monaco, codeEditorEl, options) => monaco.editor.create(codeEditorEl, options),
|
|
30
|
-
customCreateMonacoDiffEditor: (monaco, codeEditorEl, options) => monaco.editor.createDiffEditor(codeEditorEl, options)
|
|
31
|
+
customCreateMonacoDiffEditor: (monaco, codeEditorEl, options) => monaco.editor.createDiffEditor(codeEditorEl, options),
|
|
32
|
+
flat: false
|
|
33
|
+
};
|
|
34
|
+
var editorFieldVue = {
|
|
35
|
+
"vs-code": { component: Code_default },
|
|
36
|
+
"ui-select": { component: UISelect_default },
|
|
37
|
+
"cond-op-select": { component: CondOpSelect_default },
|
|
38
|
+
"page-fragment-select": { component: PageFragmentSelect_default },
|
|
39
|
+
"data-source-select": { component: DataSourceSelect_default },
|
|
40
|
+
"data-source-input": { component: DataSourceInput_default },
|
|
41
|
+
"code-link": { component: CodeLink_default },
|
|
42
|
+
"key-value": { component: KeyValue_default },
|
|
43
|
+
"code-select-col": { component: CodeSelectCol_default },
|
|
44
|
+
"data-source-fields": { component: DataSourceFields_default },
|
|
45
|
+
"data-source-mocks": { component: DataSourceMocks_default },
|
|
46
|
+
"data-source-methods": { component: DataSourceMethods_default },
|
|
47
|
+
"data-source-method-select": { component: DataSourceMethodSelect_default },
|
|
48
|
+
"data-source-field-select": { component: Index_default },
|
|
49
|
+
"code-select": { component: CodeSelect_default },
|
|
50
|
+
"display-conds": { component: DisplayConds_default },
|
|
51
|
+
"event-select": { component: EventSelect_default },
|
|
52
|
+
"style-setter": { container: Index_default$1 }
|
|
31
53
|
};
|
|
32
54
|
var plugin_default = { install: (app, opt) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
55
|
+
const incoming = opt || {};
|
|
56
|
+
const option = {
|
|
57
|
+
...defaultInstallOpt,
|
|
58
|
+
...incoming
|
|
59
|
+
};
|
|
60
|
+
const formOpt = incoming;
|
|
61
|
+
app.use(designPlugin, incoming);
|
|
62
|
+
app.use(formPlugin, {
|
|
63
|
+
...formOpt,
|
|
64
|
+
fields: mergeFieldOptions(editorFields, editorFieldVue, formOpt.fields)
|
|
65
|
+
});
|
|
36
66
|
app.use(tablePlugin);
|
|
37
67
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
38
68
|
setEditorConfig(option);
|
|
39
69
|
app.component(`${Editor_default.name || "MEditor"}`, Editor_default);
|
|
40
70
|
app.component("magic-code-editor", CodeEditor_default);
|
|
41
|
-
app.component("m-fields-ui-select", UISelect_default);
|
|
42
|
-
app.component("m-fields-code-link", CodeLink_default);
|
|
43
|
-
app.component("m-fields-vs-code", Code_default);
|
|
44
|
-
app.component("m-fields-code-select", CodeSelect_default);
|
|
45
|
-
app.component("m-fields-code-select-col", CodeSelectCol_default);
|
|
46
|
-
app.component("m-fields-event-select", EventSelect_default);
|
|
47
|
-
app.component("m-fields-data-source-fields", DataSourceFields_default);
|
|
48
|
-
app.component("m-fields-data-source-mocks", DataSourceMocks_default);
|
|
49
|
-
app.component("m-fields-key-value", KeyValue_default);
|
|
50
|
-
app.component("m-fields-data-source-input", DataSourceInput_default);
|
|
51
|
-
app.component("m-fields-data-source-select", DataSourceSelect_default);
|
|
52
|
-
app.component("m-fields-data-source-methods", DataSourceMethods_default);
|
|
53
|
-
app.component("m-fields-data-source-method-select", DataSourceMethodSelect_default);
|
|
54
|
-
app.component("m-fields-data-source-field-select", Index_default);
|
|
55
|
-
app.component("m-fields-page-fragment-select", PageFragmentSelect_default);
|
|
56
|
-
app.component("m-fields-display-conds", DisplayConds_default);
|
|
57
|
-
app.component("m-fields-cond-op-select", CondOpSelect_default);
|
|
58
|
-
app.component("m-form-style-setter", Index_default$1);
|
|
59
71
|
} };
|
|
60
72
|
//#endregion
|
|
61
73
|
export { plugin_default as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CODE_DRAFT_STORAGE_KEY } from "../type.js";
|
|
2
|
-
import BaseService from "./BaseService.js";
|
|
3
2
|
import { getEditorConfig } from "../utils/config.js";
|
|
4
|
-
import
|
|
3
|
+
import BaseService from "./BaseService.js";
|
|
4
|
+
import { createStackStep, describeRevertStep, getLastPushedHistoryIds } from "../utils/history.js";
|
|
5
5
|
import history_default from "./history.js";
|
|
6
6
|
import storage_default, { Protocol } from "./storage.js";
|
|
7
7
|
import { COPY_CODE_STORAGE_KEY } from "../utils/editor.js";
|
|
@@ -56,6 +56,7 @@ var CodeBlock = class extends BaseService {
|
|
|
56
56
|
async setCodeDsl(codeDsl) {
|
|
57
57
|
this.state.codeDsl = codeDsl;
|
|
58
58
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
59
|
+
this.emit("change", this.state.codeDsl);
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
61
62
|
* 获取活动的代码块dsl数据源(默认从dsl中的codeBlocks字段读取)
|
|
@@ -121,14 +122,18 @@ var CodeBlock = class extends BaseService {
|
|
|
121
122
|
...codeConfigProcessed
|
|
122
123
|
};
|
|
123
124
|
const newContent = cloneDeep$1(codeDsl[id]);
|
|
124
|
-
if (!doNotPushHistory)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
if (!doNotPushHistory) {
|
|
126
|
+
const step = createStackStep(id, {
|
|
127
|
+
oldValue: oldContent,
|
|
128
|
+
newValue: newContent,
|
|
129
|
+
changeRecords,
|
|
130
|
+
historyDescription,
|
|
131
|
+
source: historySource
|
|
132
|
+
});
|
|
133
|
+
this.lastPushedHistoryId = (step ? history_default.push("codeBlock", step, id) : null)?.uuid ?? null;
|
|
134
|
+
}
|
|
131
135
|
this.emit("addOrUpdate", id, codeDsl[id]);
|
|
136
|
+
this.emit("change", this.getCodeDsl());
|
|
132
137
|
}
|
|
133
138
|
/**
|
|
134
139
|
* 根据代码块id数组获取代码dsl
|
|
@@ -136,7 +141,8 @@ var CodeBlock = class extends BaseService {
|
|
|
136
141
|
* @returns {CodeBlockDSL}
|
|
137
142
|
*/
|
|
138
143
|
getCodeDslByIds(ids) {
|
|
139
|
-
|
|
144
|
+
const codeDsl = this.getCodeDsl();
|
|
145
|
+
return pick(codeDsl, ids);
|
|
140
146
|
}
|
|
141
147
|
/**
|
|
142
148
|
* 获取编辑状态
|
|
@@ -212,19 +218,21 @@ var CodeBlock = class extends BaseService {
|
|
|
212
218
|
if (!currentDsl) return;
|
|
213
219
|
this.lastDeletedHistoryIds = [];
|
|
214
220
|
codeIds.forEach((id) => {
|
|
215
|
-
const
|
|
221
|
+
const oldValue = currentDsl[id] ? cloneDeep$1(currentDsl[id]) : null;
|
|
216
222
|
delete currentDsl[id];
|
|
217
|
-
if (
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
223
|
+
if (oldValue && !doNotPushHistory) {
|
|
224
|
+
const step = createStackStep(id, {
|
|
225
|
+
oldValue,
|
|
226
|
+
newValue: null,
|
|
221
227
|
historyDescription,
|
|
222
228
|
source: historySource
|
|
223
|
-
})
|
|
229
|
+
});
|
|
230
|
+
const uuid = step ? history_default.push("codeBlock", step, id)?.uuid : void 0;
|
|
224
231
|
if (uuid) this.lastDeletedHistoryIds.push(uuid);
|
|
225
232
|
}
|
|
226
233
|
this.emit("remove", id);
|
|
227
234
|
});
|
|
235
|
+
this.emit("change", this.getCodeDsl());
|
|
228
236
|
}
|
|
229
237
|
/**
|
|
230
238
|
* 下列 *AndGetHistoryId 方法与对应的写入方法行为完全一致,
|
|
@@ -281,7 +289,7 @@ var CodeBlock = class extends BaseService {
|
|
|
281
289
|
* @returns 撤销的 step;栈不存在或已无可撤销时返回 null
|
|
282
290
|
*/
|
|
283
291
|
async undo(id) {
|
|
284
|
-
const step = history_default.
|
|
292
|
+
const step = history_default.undo("codeBlock", id);
|
|
285
293
|
if (!step) return null;
|
|
286
294
|
await this.applyHistoryStep(step, true);
|
|
287
295
|
return step;
|
|
@@ -292,18 +300,18 @@ var CodeBlock = class extends BaseService {
|
|
|
292
300
|
* @returns 重做的 step;栈不存在或已无可重做时返回 null
|
|
293
301
|
*/
|
|
294
302
|
async redo(id) {
|
|
295
|
-
const step = history_default.
|
|
303
|
+
const step = history_default.redo("codeBlock", id);
|
|
296
304
|
if (!step) return null;
|
|
297
305
|
await this.applyHistoryStep(step, false);
|
|
298
306
|
return step;
|
|
299
307
|
}
|
|
300
308
|
/** 是否可对指定代码块撤销。 */
|
|
301
309
|
canUndo(id) {
|
|
302
|
-
return history_default.
|
|
310
|
+
return history_default.canUndo("codeBlock", id);
|
|
303
311
|
}
|
|
304
312
|
/** 是否可对指定代码块重做。 */
|
|
305
313
|
canRedo(id) {
|
|
306
|
-
return history_default.
|
|
314
|
+
return history_default.canRedo("codeBlock", id);
|
|
307
315
|
}
|
|
308
316
|
/**
|
|
309
317
|
* 跳转指定代码块的历史栈到目标游标。语义同 editor.gotoPageStep。
|
|
@@ -313,7 +321,7 @@ var CodeBlock = class extends BaseService {
|
|
|
313
321
|
* @returns 实际移动到的最终游标位置
|
|
314
322
|
*/
|
|
315
323
|
async goto(id, targetCursor) {
|
|
316
|
-
let cursor = history_default.
|
|
324
|
+
let cursor = history_default.getCursor("codeBlock", id);
|
|
317
325
|
const target = Math.max(0, targetCursor);
|
|
318
326
|
while (cursor > target) {
|
|
319
327
|
if (!await this.undo(id)) break;
|
|
@@ -336,11 +344,11 @@ var CodeBlock = class extends BaseService {
|
|
|
336
344
|
* @returns 反向后产生的新 step;目标不存在 / 未应用时返回 null
|
|
337
345
|
*/
|
|
338
346
|
async revert(id, index) {
|
|
339
|
-
const entry = history_default.
|
|
347
|
+
const entry = history_default.getStepList("codeBlock", id)[index];
|
|
340
348
|
if (!entry?.applied) return null;
|
|
341
349
|
const { oldSchema, newSchema, changeRecords } = entry.step.diff?.[0] ?? {};
|
|
342
350
|
if (oldSchema && newSchema && !changeRecords?.length) return null;
|
|
343
|
-
const description = `回滚 #${index + 1}: ${describeRevertStep(entry.step.id, entry.step.diff?.[0], (s) => s.name)}`;
|
|
351
|
+
const description = `回滚 #${index + 1}: ${describeRevertStep(entry.step.data.id, entry.step.diff?.[0], (s) => s.name)}`;
|
|
344
352
|
return await this.applyRevertStep(entry.step, description);
|
|
345
353
|
}
|
|
346
354
|
/**
|
|
@@ -353,7 +361,7 @@ var CodeBlock = class extends BaseService {
|
|
|
353
361
|
async revertById(uuids) {
|
|
354
362
|
const results = [];
|
|
355
363
|
for (const uuid of uuids) {
|
|
356
|
-
const location = history_default.
|
|
364
|
+
const location = history_default.findStepLocationByUuid("codeBlock", uuid);
|
|
357
365
|
results.push(location ? await this.revert(location.id, location.index) : null);
|
|
358
366
|
}
|
|
359
367
|
return results;
|
|
@@ -364,7 +372,8 @@ var CodeBlock = class extends BaseService {
|
|
|
364
372
|
*/
|
|
365
373
|
async getUniqueId() {
|
|
366
374
|
const newId = `code_${Math.random().toString(10).substring(2).substring(0, 4)}`;
|
|
367
|
-
|
|
375
|
+
const dsl = await this.getCodeDsl();
|
|
376
|
+
if (!keys(dsl).includes(newId)) return newId;
|
|
368
377
|
return await this.getUniqueId();
|
|
369
378
|
}
|
|
370
379
|
/**
|
|
@@ -423,21 +432,21 @@ var CodeBlock = class extends BaseService {
|
|
|
423
432
|
* 差异仅在于通过公开的 setCodeDslByIdSync / deleteCodeDslByIds 触发 push。
|
|
424
433
|
*/
|
|
425
434
|
async applyRevertStep(step, historyDescription) {
|
|
426
|
-
const { id } = step;
|
|
435
|
+
const { id } = step.data;
|
|
427
436
|
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
428
437
|
if (!oldSchema && newSchema) {
|
|
429
438
|
await this.deleteCodeDslByIds([id], {
|
|
430
439
|
historyDescription,
|
|
431
440
|
historySource: "rollback"
|
|
432
441
|
});
|
|
433
|
-
return history_default.
|
|
442
|
+
return history_default.getStepList("codeBlock", id).slice(-1)[0]?.step ?? null;
|
|
434
443
|
}
|
|
435
444
|
if (oldSchema && !newSchema) {
|
|
436
445
|
this.setCodeDslByIdSync(id, cloneDeep$1(oldSchema), true, {
|
|
437
446
|
historyDescription,
|
|
438
447
|
historySource: "rollback"
|
|
439
448
|
});
|
|
440
|
-
return history_default.
|
|
449
|
+
return history_default.getStepList("codeBlock", id).slice(-1)[0]?.step ?? null;
|
|
441
450
|
}
|
|
442
451
|
if (!oldSchema || !newSchema) return null;
|
|
443
452
|
if (changeRecords?.length) {
|
|
@@ -458,13 +467,13 @@ var CodeBlock = class extends BaseService {
|
|
|
458
467
|
historyDescription,
|
|
459
468
|
historySource: "rollback"
|
|
460
469
|
});
|
|
461
|
-
return history_default.
|
|
470
|
+
return history_default.getStepList("codeBlock", id).slice(-1)[0]?.step ?? null;
|
|
462
471
|
}
|
|
463
472
|
this.setCodeDslByIdSync(id, cloneDeep$1(oldSchema), true, {
|
|
464
473
|
historyDescription,
|
|
465
474
|
historySource: "rollback"
|
|
466
475
|
});
|
|
467
|
-
return history_default.
|
|
476
|
+
return history_default.getStepList("codeBlock", id).slice(-1)[0]?.step ?? null;
|
|
468
477
|
}
|
|
469
478
|
/**
|
|
470
479
|
* 把一条历史 step 应用到当前代码块服务上。
|
|
@@ -481,7 +490,7 @@ var CodeBlock = class extends BaseService {
|
|
|
481
490
|
* @param reverse true=撤销,false=重做
|
|
482
491
|
*/
|
|
483
492
|
async applyHistoryStep(step, reverse) {
|
|
484
|
-
const { id } = step;
|
|
493
|
+
const { id } = step.data;
|
|
485
494
|
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
486
495
|
if (!oldSchema && newSchema) {
|
|
487
496
|
if (reverse) await this.deleteCodeDslByIds([id], { doNotPushHistory: true });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseService from "./BaseService.js";
|
|
2
|
-
import { describeRevertStep, getLastPushedHistoryIds } from "../utils/history.js";
|
|
2
|
+
import { createStackStep, describeRevertStep, getLastPushedHistoryIds } from "../utils/history.js";
|
|
3
3
|
import history_default from "./history.js";
|
|
4
4
|
import storage_default, { Protocol } from "./storage.js";
|
|
5
5
|
import { COPY_DS_STORAGE_KEY } from "../utils/editor.js";
|
|
@@ -92,13 +92,17 @@ var DataSource = class extends BaseService {
|
|
|
92
92
|
id: config.id && !this.getDataSourceById(config.id) ? config.id : this.createId()
|
|
93
93
|
};
|
|
94
94
|
this.get("dataSources").push(newConfig);
|
|
95
|
-
if (!doNotPushHistory)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
if (!doNotPushHistory) {
|
|
96
|
+
const step = createStackStep(newConfig.id, {
|
|
97
|
+
oldValue: null,
|
|
98
|
+
newValue: newConfig,
|
|
99
|
+
historyDescription,
|
|
100
|
+
source: historySource
|
|
101
|
+
});
|
|
102
|
+
this.lastPushedHistoryId = (step ? history_default.push("dataSource", step, newConfig.id) : null)?.uuid ?? null;
|
|
103
|
+
}
|
|
101
104
|
this.emit("add", newConfig);
|
|
105
|
+
this.emit("change", this.get("dataSources"));
|
|
102
106
|
return newConfig;
|
|
103
107
|
}
|
|
104
108
|
/**
|
|
@@ -115,17 +119,21 @@ var DataSource = class extends BaseService {
|
|
|
115
119
|
const oldConfig = dataSources[index];
|
|
116
120
|
const newConfig = cloneDeep$1(config);
|
|
117
121
|
dataSources[index] = newConfig;
|
|
118
|
-
if (!doNotPushHistory)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
if (!doNotPushHistory) {
|
|
123
|
+
const step = createStackStep(newConfig.id, {
|
|
124
|
+
oldValue: oldConfig ? cloneDeep$1(oldConfig) : null,
|
|
125
|
+
newValue: newConfig,
|
|
126
|
+
changeRecords,
|
|
127
|
+
historyDescription,
|
|
128
|
+
source: historySource
|
|
129
|
+
});
|
|
130
|
+
this.lastPushedHistoryId = (step ? history_default.push("dataSource", step, newConfig.id) : null)?.uuid ?? null;
|
|
131
|
+
}
|
|
125
132
|
this.emit("update", newConfig, {
|
|
126
133
|
oldConfig,
|
|
127
134
|
changeRecords
|
|
128
135
|
});
|
|
136
|
+
this.emit("change", this.get("dataSources"));
|
|
129
137
|
return newConfig;
|
|
130
138
|
}
|
|
131
139
|
/**
|
|
@@ -140,13 +148,17 @@ var DataSource = class extends BaseService {
|
|
|
140
148
|
const index = dataSources.findIndex((ds) => ds.id === id);
|
|
141
149
|
const oldConfig = index !== -1 ? dataSources[index] : null;
|
|
142
150
|
dataSources.splice(index, 1);
|
|
143
|
-
if (oldConfig && !doNotPushHistory)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
if (oldConfig && !doNotPushHistory) {
|
|
152
|
+
const step = createStackStep(id, {
|
|
153
|
+
oldValue: cloneDeep$1(oldConfig),
|
|
154
|
+
newValue: null,
|
|
155
|
+
historyDescription,
|
|
156
|
+
source: historySource
|
|
157
|
+
});
|
|
158
|
+
this.lastPushedHistoryId = (step ? history_default.push("dataSource", step, id) : null)?.uuid ?? null;
|
|
159
|
+
}
|
|
149
160
|
this.emit("remove", id);
|
|
161
|
+
this.emit("change", this.get("dataSources"));
|
|
150
162
|
}
|
|
151
163
|
/**
|
|
152
164
|
* 下列 *AndGetHistoryId 方法与对应的 add / update / remove 行为完全一致,
|
|
@@ -191,7 +203,7 @@ var DataSource = class extends BaseService {
|
|
|
191
203
|
* @returns 撤销的 step;栈不存在或已无可撤销时返回 null
|
|
192
204
|
*/
|
|
193
205
|
undo(id) {
|
|
194
|
-
const step = history_default.
|
|
206
|
+
const step = history_default.undo("dataSource", id);
|
|
195
207
|
if (!step) return null;
|
|
196
208
|
this.applyHistoryStep(step, true);
|
|
197
209
|
return step;
|
|
@@ -202,18 +214,18 @@ var DataSource = class extends BaseService {
|
|
|
202
214
|
* @returns 重做的 step;栈不存在或已无可重做时返回 null
|
|
203
215
|
*/
|
|
204
216
|
redo(id) {
|
|
205
|
-
const step = history_default.
|
|
217
|
+
const step = history_default.redo("dataSource", id);
|
|
206
218
|
if (!step) return null;
|
|
207
219
|
this.applyHistoryStep(step, false);
|
|
208
220
|
return step;
|
|
209
221
|
}
|
|
210
222
|
/** 是否可对指定数据源撤销。 */
|
|
211
223
|
canUndo(id) {
|
|
212
|
-
return history_default.
|
|
224
|
+
return history_default.canUndo("dataSource", id);
|
|
213
225
|
}
|
|
214
226
|
/** 是否可对指定数据源重做。 */
|
|
215
227
|
canRedo(id) {
|
|
216
|
-
return history_default.
|
|
228
|
+
return history_default.canRedo("dataSource", id);
|
|
217
229
|
}
|
|
218
230
|
/**
|
|
219
231
|
* 跳转指定数据源的历史栈到目标游标。语义同 editor.gotoPageStep。
|
|
@@ -223,7 +235,7 @@ var DataSource = class extends BaseService {
|
|
|
223
235
|
* @returns 实际移动到的最终游标位置
|
|
224
236
|
*/
|
|
225
237
|
goto(id, targetCursor) {
|
|
226
|
-
let cursor = history_default.
|
|
238
|
+
let cursor = history_default.getCursor("dataSource", id);
|
|
227
239
|
const target = Math.max(0, targetCursor);
|
|
228
240
|
while (cursor > target) {
|
|
229
241
|
if (!this.undo(id)) break;
|
|
@@ -246,11 +258,11 @@ var DataSource = class extends BaseService {
|
|
|
246
258
|
* @returns 反向后产生的新 step;目标不存在 / 未应用时返回 null
|
|
247
259
|
*/
|
|
248
260
|
revert(id, index) {
|
|
249
|
-
const entry = history_default.
|
|
261
|
+
const entry = history_default.getStepList("dataSource", id)[index];
|
|
250
262
|
if (!entry?.applied) return null;
|
|
251
263
|
const { oldSchema, newSchema, changeRecords } = entry.step.diff?.[0] ?? {};
|
|
252
264
|
if (oldSchema && newSchema && !changeRecords?.length) return null;
|
|
253
|
-
const description = `回滚 #${index + 1}: ${describeRevertStep(entry.step.id, entry.step.diff?.[0], (s) => s.title)}`;
|
|
265
|
+
const description = `回滚 #${index + 1}: ${describeRevertStep(entry.step.data.id, entry.step.diff?.[0], (s) => s.title)}`;
|
|
254
266
|
return this.applyRevertStep(entry.step, description);
|
|
255
267
|
}
|
|
256
268
|
/**
|
|
@@ -262,7 +274,7 @@ var DataSource = class extends BaseService {
|
|
|
262
274
|
*/
|
|
263
275
|
revertById(uuids) {
|
|
264
276
|
return uuids.map((uuid) => {
|
|
265
|
-
const location = history_default.
|
|
277
|
+
const location = history_default.findStepLocationByUuid("dataSource", uuid);
|
|
266
278
|
if (!location) return null;
|
|
267
279
|
return this.revert(location.id, location.index);
|
|
268
280
|
});
|
|
@@ -325,21 +337,21 @@ var DataSource = class extends BaseService {
|
|
|
325
337
|
* 同构,差异仅在于走对应的公共 add / update / remove 而不是带 doNotPushHistory 的版本。
|
|
326
338
|
*/
|
|
327
339
|
applyRevertStep(step, historyDescription) {
|
|
328
|
-
const { id } = step;
|
|
340
|
+
const { id } = step.data;
|
|
329
341
|
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
330
342
|
if (!oldSchema && newSchema) {
|
|
331
343
|
this.remove(`${id}`, {
|
|
332
344
|
historyDescription,
|
|
333
345
|
historySource: "rollback"
|
|
334
346
|
});
|
|
335
|
-
return history_default.
|
|
347
|
+
return history_default.getStepList("dataSource", id).slice(-1)[0]?.step ?? null;
|
|
336
348
|
}
|
|
337
349
|
if (oldSchema && !newSchema) {
|
|
338
350
|
this.add(cloneDeep$1(oldSchema), {
|
|
339
351
|
historyDescription,
|
|
340
352
|
historySource: "rollback"
|
|
341
353
|
});
|
|
342
|
-
return history_default.
|
|
354
|
+
return history_default.getStepList("dataSource", id).slice(-1)[0]?.step ?? null;
|
|
343
355
|
}
|
|
344
356
|
if (!oldSchema || !newSchema) return null;
|
|
345
357
|
if (changeRecords?.length) {
|
|
@@ -360,13 +372,13 @@ var DataSource = class extends BaseService {
|
|
|
360
372
|
historyDescription,
|
|
361
373
|
historySource: "rollback"
|
|
362
374
|
});
|
|
363
|
-
return history_default.
|
|
375
|
+
return history_default.getStepList("dataSource", id).slice(-1)[0]?.step ?? null;
|
|
364
376
|
}
|
|
365
377
|
this.update(cloneDeep$1(oldSchema), {
|
|
366
378
|
historyDescription,
|
|
367
379
|
historySource: "rollback"
|
|
368
380
|
});
|
|
369
|
-
return history_default.
|
|
381
|
+
return history_default.getStepList("dataSource", id).slice(-1)[0]?.step ?? null;
|
|
370
382
|
}
|
|
371
383
|
/**
|
|
372
384
|
* 把一条历史 step 应用到当前数据源服务上。
|
|
@@ -383,7 +395,7 @@ var DataSource = class extends BaseService {
|
|
|
383
395
|
* @param reverse true=撤销,false=重做
|
|
384
396
|
*/
|
|
385
397
|
applyHistoryStep(step, reverse) {
|
|
386
|
-
const { id } = step;
|
|
398
|
+
const { id } = step.data;
|
|
387
399
|
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
388
400
|
if (!oldSchema && newSchema) {
|
|
389
401
|
if (reverse) this.remove(`${id}`, { doNotPushHistory: true });
|