@tmagic/editor 1.8.0-beta.8 → 1.8.0-manmanyu.8
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 +13 -3
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +1 -4
- package/dist/es/components/ContentMenu.vue_vue_type_script_setup_true_lang.js +11 -4
- package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +9 -4
- package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/CodeLink.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +68 -43
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +5 -1
- package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +10 -7
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +4 -1
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +101 -64
- package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/PageFragmentSelect.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/es/fields/StyleSetter/components/BackgroundPosition.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/StyleSetter/components/Border.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 +6 -6
- package/dist/es/fields/StyleSetter/icons/background-repeat/Repeat.js +5 -2
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatX.js +28 -5
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatY.js +31 -5
- package/dist/es/fields/StyleSetter/icons/flex-direction/Column.js +10 -2
- package/dist/es/fields/StyleSetter/icons/flex-direction/ColumnReverse.js +10 -2
- package/dist/es/fields/StyleSetter/icons/flex-direction/Row.js +10 -2
- package/dist/es/fields/StyleSetter/icons/flex-direction/RowReverse.js +10 -2
- package/dist/es/fields/StyleSetter/icons/justify-content/Center.js +16 -2
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexEnd.js +18 -2
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexStart.js +18 -2
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceAround.js +36 -2
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceBetween.js +32 -2
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +11 -6
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +6 -3
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +82 -46
- package/dist/es/fields/UISelect.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/icons/DatasourceIcon.js +17 -0
- package/dist/es/index.js +2 -2
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +14 -10
- package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +18 -28
- package/dist/es/layouts/history-list/useHistoryList.js +4 -4
- package/dist/es/layouts/history-list/useHistoryRevert.js +6 -6
- package/dist/es/services/codeBlock.js +28 -32
- package/dist/es/services/dataSource.js +34 -43
- package/dist/es/services/editor.js +26 -31
- package/dist/es/services/history.js +392 -259
- package/dist/es/style.css +294 -37
- package/dist/es/utils/const.js +1 -1
- package/dist/es/utils/history.js +47 -35
- package/dist/es/utils/props.js +137 -31
- package/dist/style.css +294 -37
- package/dist/themes/magic-admin.css +2316 -0
- package/dist/tmagic-editor.umd.cjs +1665 -880
- package/package.json +7 -7
- package/src/Editor.vue +13 -1
- 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/layouts/Framework.vue +7 -1
- 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 +9 -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 +125 -0
- package/src/utils/const.ts +2 -1
- package/src/utils/props.ts +138 -9
- package/types/index.d.ts +310 -315
|
@@ -24,7 +24,10 @@ var UISelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
24
24
|
disabled: { type: Boolean },
|
|
25
25
|
size: {},
|
|
26
26
|
lastValues: {},
|
|
27
|
-
isCompare: { type: Boolean }
|
|
27
|
+
isCompare: { type: Boolean },
|
|
28
|
+
text: {},
|
|
29
|
+
labelWidth: {},
|
|
30
|
+
labelPosition: {}
|
|
28
31
|
},
|
|
29
32
|
emits: ["change"],
|
|
30
33
|
setup(__props, { emit: __emit }) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import _plugin_vue_export_helper_default from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import { createElementBlock, createElementVNode, openBlock } from "vue";
|
|
3
|
+
//#region packages/editor/src/icons/DatasourceIcon.vue
|
|
4
|
+
var _sfc_main = {};
|
|
5
|
+
var _hoisted_1 = {
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
width: "16",
|
|
8
|
+
height: "16",
|
|
9
|
+
viewBox: "0 0 16 16",
|
|
10
|
+
fill: "currentColor"
|
|
11
|
+
};
|
|
12
|
+
function _sfc_render(_ctx, _cache) {
|
|
13
|
+
return openBlock(), createElementBlock("svg", _hoisted_1, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M6.25 9.723C4.392 9.6095 2.804 9.137 1.875 8.4775V9.7495C1.875 10.6165 3.7665 11.3365 6.25 11.4745V12.348C4.392 12.2345 2.804 11.763 1.875 11.102V12.3745H1V4.0625C1 2.371 3.742 1 7.125 1C10.507 1 13.249 2.371 13.249 4.0625V6.8255H12.374V5.6405C11.3025 6.5295 9.352 7.1245 7.1245 7.1245C4.897 7.1245 2.947 6.5295 1.8745 5.6405V7.1245C1.8745 7.9915 3.7665 8.712 6.2495 8.85L6.25 9.723ZM7.125 14.999C3.742 14.999 1 13.8245 1 12.3745H1.875C1.875 13.3415 4.225 14.124 7.125 14.124V14.999ZM7.125 6.2495C10.024 6.2495 12.3745 5.2695 12.3745 4.0625C12.3745 2.855 10.0245 1.875 7.1245 1.875C4.225 1.875 1.8745 2.855 1.8745 4.0625C1.8745 5.2695 4.2255 6.2495 7.125 6.2495ZM14.7385 11.9895L14.1295 11.6345C14.1635 11.4485 14.1855 11.2585 14.1855 11.062C14.1843 10.8697 14.1655 10.6779 14.1295 10.489L14.7385 10.134C14.988 9.987 15.073 9.667 14.929 9.416L14.409 8.507C14.3752 8.44726 14.3299 8.39483 14.2757 8.35275C14.2215 8.31066 14.1595 8.27977 14.0933 8.26186C14.027 8.24395 13.9579 8.23938 13.8898 8.24842C13.8218 8.25745 13.7563 8.27992 13.697 8.3145L13.081 8.6735C12.7931 8.42269 12.4616 8.22694 12.103 8.096V7.6495C12.103 7.36 11.8705 7.1245 11.5825 7.1245H10.5415C10.4728 7.12476 10.4049 7.13855 10.3415 7.16507C10.2782 7.1916 10.2206 7.23034 10.1723 7.2791C10.1239 7.32785 10.0856 7.38565 10.0595 7.4492C10.0335 7.51276 10.0202 7.58082 10.0205 7.6495V8.096C9.66186 8.22694 9.33035 8.42269 9.0425 8.6735L8.4265 8.3145C8.36725 8.27999 8.30174 8.2576 8.23377 8.2486C8.1658 8.23961 8.09672 8.24419 8.03053 8.2621C7.96435 8.28001 7.90238 8.31088 7.84821 8.35292C7.79405 8.39495 7.74877 8.44733 7.715 8.507L7.195 9.417C7.12576 9.53751 7.10688 9.68047 7.14246 9.81482C7.17804 9.94917 7.2652 10.0641 7.385 10.1345L7.9945 10.489C7.9585 10.6775 7.9395 10.8695 7.9385 11.062C7.9385 11.2585 7.96 11.4485 7.9945 11.635L7.3855 11.99C7.1355 12.1365 7.0505 12.4565 7.1945 12.7075L7.715 13.6165C7.74877 13.6762 7.79405 13.7285 7.84821 13.7706C7.90238 13.8126 7.96435 13.8435 8.03053 13.8614C8.09672 13.8793 8.1658 13.8839 8.23377 13.8749C8.30174 13.8659 8.36725 13.8435 8.4265 13.809L9.0425 13.4505C9.33023 13.7015 9.66178 13.8972 10.0205 14.028V14.474C10.0205 14.764 10.2535 14.999 10.5415 14.999H11.5825C11.7211 14.9983 11.8538 14.9427 11.9514 14.8442C12.049 14.7458 12.1035 14.6126 12.103 14.474V14.028C12.4616 13.8971 12.7931 13.7013 13.081 13.4505L13.697 13.809C13.7563 13.8434 13.8218 13.8657 13.8897 13.8746C13.9577 13.8835 14.0267 13.8789 14.0929 13.861C14.159 13.8431 14.221 13.8123 14.2751 13.7703C14.3293 13.7283 14.3746 13.6761 14.4085 13.6165L14.929 12.7065C14.998 12.586 15.0168 12.4431 14.9811 12.3089C14.9454 12.1746 14.8583 12.0599 14.7385 11.9895ZM14.092 12.5065L13.852 12.915C13.8193 12.9693 13.7667 13.0086 13.7054 13.0246C13.6441 13.0406 13.579 13.0319 13.524 13.0005L12.8575 12.623C12.5109 13.0069 12.0497 13.2688 11.5425 13.37V13.889C11.5425 14.0185 11.4345 14.124 11.3015 14.124H10.822C10.7907 14.1243 10.7597 14.1184 10.7308 14.1067C10.7018 14.0949 10.6754 14.0776 10.6531 14.0557C10.6308 14.0338 10.6131 14.0077 10.6009 13.9789C10.5887 13.9502 10.5823 13.9193 10.582 13.888V13.37C10.0746 13.2689 9.61328 13.007 9.2665 12.623L8.6 13C8.54495 13.0316 8.47971 13.0403 8.4183 13.0243C8.35688 13.0083 8.30418 12.9689 8.2715 12.9145L8.0315 12.506C8.01582 12.4792 8.00564 12.4496 8.00158 12.4189C7.99752 12.3881 7.99965 12.3569 8.00785 12.327C8.01605 12.297 8.03016 12.2691 8.04933 12.2447C8.0685 12.2203 8.09236 12.2 8.1195 12.185L8.789 11.805C8.70604 11.5658 8.66313 11.3146 8.662 11.0615C8.662 10.8005 8.709 10.552 8.7895 10.3175L8.1195 9.9375C8.09247 9.92244 8.06872 9.90213 8.04964 9.87777C8.03056 9.85341 8.01654 9.82549 8.00839 9.79564C8.00024 9.76579 7.99813 9.73461 8.00218 9.70394C8.00624 9.67326 8.01637 9.64371 8.032 9.617L8.272 9.208C8.30467 9.15373 8.35729 9.1144 8.41858 9.09843C8.47988 9.08245 8.54499 9.09109 8.6 9.1225L9.2665 9.5005C9.61315 9.11663 10.0743 8.85468 10.5815 8.7535V8.235C10.5815 8.105 10.689 8 10.822 8H11.302C11.4345 8 11.542 8.105 11.542 8.236V8.754C12.0492 8.85518 12.5104 9.11713 12.857 9.501L13.524 9.123C13.579 9.09159 13.6441 9.08295 13.7054 9.09893C13.7667 9.1149 13.8193 9.15423 13.852 9.2085L14.092 9.6175C14.1077 9.64423 14.1179 9.67383 14.122 9.70455C14.1261 9.73528 14.124 9.76652 14.1159 9.79643C14.1077 9.82634 14.0937 9.85431 14.0745 9.87871C14.0554 9.90311 14.0316 9.92344 14.0045 9.9385L13.335 10.3185C13.4135 10.5525 13.462 10.801 13.462 11.062C13.462 11.3225 13.4145 11.571 13.335 11.8055L14.0045 12.1855C14.0316 12.2006 14.0554 12.2209 14.0745 12.2453C14.0937 12.2697 14.1077 12.2977 14.1159 12.3276C14.124 12.3575 14.1261 12.3887 14.122 12.4194C14.1179 12.4502 14.1077 12.4798 14.092 12.5065ZM11.062 9.7495C10.7139 9.7495 10.3801 9.88778 10.1339 10.1339C9.88778 10.3801 9.7495 10.7139 9.7495 11.062C9.7495 11.4101 9.88778 11.7439 10.1339 11.9901C10.3801 12.2362 10.7139 12.3745 11.062 12.3745C11.4101 12.3745 11.7439 12.2362 11.9901 11.9901C12.2362 11.7439 12.3745 11.4101 12.3745 11.062C12.3745 10.7139 12.2362 10.3801 11.9901 10.1339C11.7439 9.88778 11.4101 9.7495 11.062 9.7495ZM11.062 11.4995C10.946 11.4995 10.8347 11.4534 10.7526 11.3714C10.6706 11.2893 10.6245 11.178 10.6245 11.062C10.6245 10.946 10.6706 10.8347 10.7526 10.7526C10.8347 10.6706 10.946 10.6245 11.062 10.6245C11.178 10.6245 11.2893 10.6706 11.3714 10.7526C11.4534 10.8347 11.4995 10.946 11.4995 11.062C11.4995 11.178 11.4534 11.2893 11.3714 11.3714C11.2893 11.4534 11.178 11.4995 11.062 11.4995Z" }, null, -1)])]);
|
|
14
|
+
}
|
|
15
|
+
var DatasourceIcon_default = /* @__PURE__ */ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render]]);
|
|
16
|
+
//#endregion
|
|
17
|
+
export { DatasourceIcon_default as default };
|
package/dist/es/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { advancedTabConfig, arrayOptions, displayTabConfig, eqOptions, eventTabC
|
|
|
4
4
|
import props_default from "./services/props.js";
|
|
5
5
|
import { getEditorConfig, setEditorConfig } from "./utils/config.js";
|
|
6
6
|
import { UndoRedo } from "./utils/undo-redo.js";
|
|
7
|
-
import { createStackStep, describeRevertStep, deserializeStacks,
|
|
7
|
+
import { createStackStep, describeRevertStep, deserializeStacks, detectPageTargetId, detectPageTargetName, detectStackOpType, getLastPushedHistoryIds, getOrCreateStack, markStackSaved, mergePageSteps, mergeStackSteps, serializeStacks, undoFloor } from "./utils/history.js";
|
|
8
8
|
import { idbDelete, idbGet, idbSet, isIndexedDBSupported, openIndexedDB } from "./utils/indexed-db.js";
|
|
9
9
|
import history_default from "./services/history.js";
|
|
10
10
|
import storage_default from "./services/storage.js";
|
|
@@ -85,4 +85,4 @@ export * from "@tmagic/table";
|
|
|
85
85
|
export * from "@tmagic/stage";
|
|
86
86
|
export * from "@tmagic/design";
|
|
87
87
|
export * from "@tmagic/utils";
|
|
88
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CodeBlockEditor_default as CodeBlockEditor, CodeBlockList_default as CodeBlockList, CodeBlockListPanel_default as CodeBlockListPanel, CodeDeleteErrorType, CodeSelect_default as CodeSelect, CodeSelectCol_default as CodeSelectCol, ColumnLayout, CompareForm_default as CompareForm, ComponentListPanel_default as ComponentListPanel, CondOpSelect_default as CondOpSelect, ContentMenu_default as ContentMenu, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, DataSourceAddButton_default as DataSourceAddButton, DataSourceConfigPanel_default as DataSourceConfigPanel, Index_default as DataSourceFieldSelect, DataSourceFields_default as DataSourceFields, DataSourceInput_default as DataSourceInput, DataSourceMethodSelect_default as DataSourceMethodSelect, DataSourceMethods_default as DataSourceMethods, DataSourceMocks_default as DataSourceMocks, DataSourceSelect_default as DataSourceSelect, DepTargetType, DisplayConds_default as DisplayConds, DragType, EventSelect_default as EventSelect, Fixed2Other, FloatingBox_default as FloatingBox, H_GUIDE_LINE_STORAGE_KEY, HistoryDiffDialog_default as HistoryDiffDialog, Bucket_default as HistoryListBucket, BucketTab_default as HistoryListBucketTab, Icon_default as Icon, IdleTask, KeyBindingCommand, KeyValue_default as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerOffset, LayerPanel_default as LayerPanel, Layout, SplitView_default as LayoutContainer, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, PROPS_PANEL_WIDTH_STORAGE_KEY, PageFragmentSelect_default as PageFragmentSelect, FormPanel_default as PropsFormPanel, PropsPanel_default as PropsPanel, RIGHT_COLUMN_WIDTH_STORAGE_KEY, Resizer_default as Resizer, ScrollViewer, SideItemKey, SplitView_default as SplitView, StageCore, Index_default$1 as StyleSetter, CodeEditor_default as TMagicCodeEditor, Editor_default as TMagicEditor, ToolButton_default as ToolButton, Tree_default as Tree, TreeNode_default as TreeNode, UI_SELECT_MODE_EVENT_NAME, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, codeBlock_default as codeBlockService, collectRelatedNodes, confirmHistoryAction, createStackStep, dataSource_default as dataSourceService, debug, plugin_default as default, defaultIsExpandable, dep_default as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin,
|
|
88
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CodeBlockEditor_default as CodeBlockEditor, CodeBlockList_default as CodeBlockList, CodeBlockListPanel_default as CodeBlockListPanel, CodeDeleteErrorType, CodeSelect_default as CodeSelect, CodeSelectCol_default as CodeSelectCol, ColumnLayout, CompareForm_default as CompareForm, ComponentListPanel_default as ComponentListPanel, CondOpSelect_default as CondOpSelect, ContentMenu_default as ContentMenu, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, DataSourceAddButton_default as DataSourceAddButton, DataSourceConfigPanel_default as DataSourceConfigPanel, Index_default as DataSourceFieldSelect, DataSourceFields_default as DataSourceFields, DataSourceInput_default as DataSourceInput, DataSourceMethodSelect_default as DataSourceMethodSelect, DataSourceMethods_default as DataSourceMethods, DataSourceMocks_default as DataSourceMocks, DataSourceSelect_default as DataSourceSelect, DepTargetType, DisplayConds_default as DisplayConds, DragType, EventSelect_default as EventSelect, Fixed2Other, FloatingBox_default as FloatingBox, H_GUIDE_LINE_STORAGE_KEY, HistoryDiffDialog_default as HistoryDiffDialog, Bucket_default as HistoryListBucket, BucketTab_default as HistoryListBucketTab, Icon_default as Icon, IdleTask, KeyBindingCommand, KeyValue_default as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerOffset, LayerPanel_default as LayerPanel, Layout, SplitView_default as LayoutContainer, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, PROPS_PANEL_WIDTH_STORAGE_KEY, PageFragmentSelect_default as PageFragmentSelect, FormPanel_default as PropsFormPanel, PropsPanel_default as PropsPanel, RIGHT_COLUMN_WIDTH_STORAGE_KEY, Resizer_default as Resizer, ScrollViewer, SideItemKey, SplitView_default as SplitView, StageCore, Index_default$1 as StyleSetter, CodeEditor_default as TMagicCodeEditor, Editor_default as TMagicEditor, ToolButton_default as ToolButton, Tree_default as Tree, TreeNode_default as TreeNode, UI_SELECT_MODE_EVENT_NAME, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, codeBlock_default as codeBlockService, collectRelatedNodes, confirmHistoryAction, createStackStep, dataSource_default as dataSourceService, debug, plugin_default as default, defaultIsExpandable, dep_default as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin, detectPageTargetId, detectPageTargetName, detectStackOpType, displayTabConfig, editorNodeMergeCustomizer, editor_default as editorService, eqOptions, error, eventTabConfig, events_default 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, history_default as historyService, idbDelete, idbGet, idbSet, info, isIncludeDataSource, isIndexedDBSupported, monaco_editor_default as loadMonaco, log, markStackSaved, mergePageSteps, mergeStackSteps, moveItemsInContainer, numberOptions, openIndexedDB, props_default as propsService, resolveSelectedNode, serializeConfig, serializeStacks, setChildrenLayout, setEditorConfig, setLayout, stageOverlay_default as stageOverlayService, storage_default as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, ui_default as uiService, undoFloor, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useHistoryRevert, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
|
|
@@ -6,13 +6,8 @@ import SplitView_default from "../components/SplitView.js";
|
|
|
6
6
|
import PageBar_default from "./page-bar/PageBar.js";
|
|
7
7
|
import AddPageBox_default from "./AddPageBox.js";
|
|
8
8
|
import CodeEditor_default from "./CodeEditor.js";
|
|
9
|
-
import { computed, createCommentVNode, createElementBlock, createSlots, createVNode, defineComponent, inject, onBeforeUnmount, onMounted, openBlock, renderSlot, unref, useTemplateRef, vShow, watch, withCtx, withDirectives } from "vue";
|
|
9
|
+
import { computed, createCommentVNode, createElementBlock, createSlots, createVNode, defineComponent, inject, normalizeClass, onBeforeUnmount, onMounted, openBlock, renderSlot, unref, useTemplateRef, vShow, watch, withCtx, withDirectives } from "vue";
|
|
10
10
|
//#region packages/editor/src/layouts/Framework.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
-
var _hoisted_1 = {
|
|
12
|
-
class: "m-editor",
|
|
13
|
-
ref: "content",
|
|
14
|
-
style: { "min-width": "900px" }
|
|
15
|
-
};
|
|
16
11
|
var Framework_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
17
12
|
name: "MEditorFramework",
|
|
18
13
|
__name: "Framework",
|
|
@@ -20,7 +15,8 @@ var Framework_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
20
15
|
disabledPageFragment: { type: Boolean },
|
|
21
16
|
pageBarSortOptions: {},
|
|
22
17
|
pageFilterFunction: { type: Function },
|
|
23
|
-
hideSidebar: { type: Boolean }
|
|
18
|
+
hideSidebar: { type: Boolean },
|
|
19
|
+
theme: {}
|
|
24
20
|
},
|
|
25
21
|
setup(__props) {
|
|
26
22
|
const props = __props;
|
|
@@ -72,7 +68,15 @@ var Framework_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
72
68
|
}
|
|
73
69
|
};
|
|
74
70
|
return (_ctx, _cache) => {
|
|
75
|
-
return openBlock(), createElementBlock("div",
|
|
71
|
+
return openBlock(), createElementBlock("div", {
|
|
72
|
+
ref: "content",
|
|
73
|
+
class: normalizeClass([
|
|
74
|
+
"m-editor",
|
|
75
|
+
__props.theme ? `m-editor--${__props.theme}` : "",
|
|
76
|
+
__props.theme ? `m-theme--${__props.theme}` : ""
|
|
77
|
+
]),
|
|
78
|
+
style: { "min-width": "900px" }
|
|
79
|
+
}, [
|
|
76
80
|
renderSlot(_ctx.$slots, "header"),
|
|
77
81
|
renderSlot(_ctx.$slots, "nav"),
|
|
78
82
|
renderSlot(_ctx.$slots, "content-before"),
|
|
@@ -91,7 +95,7 @@ var Framework_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
91
95
|
"right-class": "m-editor-framework-right",
|
|
92
96
|
left: __props.hideSidebar ? void 0 : columnWidth.value.left,
|
|
93
97
|
right: columnWidth.value.right,
|
|
94
|
-
"min-left": __props.hideSidebar ? 0 : unref(
|
|
98
|
+
"min-left": __props.hideSidebar ? 0 : unref(238),
|
|
95
99
|
"min-right": unref(300),
|
|
96
100
|
"min-center": unref(400),
|
|
97
101
|
width: frameworkRect.value.width,
|
|
@@ -131,7 +135,7 @@ var Framework_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
131
135
|
]), [[vShow, !showSrc.value]]),
|
|
132
136
|
renderSlot(_ctx.$slots, "content-after"),
|
|
133
137
|
renderSlot(_ctx.$slots, "footer")
|
|
134
|
-
],
|
|
138
|
+
], 2);
|
|
135
139
|
};
|
|
136
140
|
}
|
|
137
141
|
});
|
|
@@ -55,7 +55,7 @@ var NavMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
55
55
|
className: "undo",
|
|
56
56
|
icon: markRaw(Back),
|
|
57
57
|
tooltip: `后退(${ctrl}+z)`,
|
|
58
|
-
disabled: () => !historyService.canUndo
|
|
58
|
+
disabled: () => !historyService.state.canUndo,
|
|
59
59
|
handler: () => editorService.undo()
|
|
60
60
|
});
|
|
61
61
|
break;
|
|
@@ -65,7 +65,7 @@ var NavMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
65
65
|
className: "redo",
|
|
66
66
|
icon: markRaw(Right),
|
|
67
67
|
tooltip: `前进(${ctrl}+Shift+z)`,
|
|
68
|
-
disabled: () => !historyService.canRedo
|
|
68
|
+
disabled: () => !historyService.state.canRedo,
|
|
69
69
|
handler: () => editorService.redo()
|
|
70
70
|
});
|
|
71
71
|
break;
|
package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -73,35 +73,27 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
73
73
|
* 当前活动页的「加载/初始」标记记录(设置 root 时生成),透传给 PageTab 的底部初始行展示。
|
|
74
74
|
* 基于 historyService 的 reactive state 派生,活动页切换或标记写入后自动刷新。
|
|
75
75
|
*/
|
|
76
|
-
const pageMarker = computed(() => historyService.
|
|
77
|
-
/**
|
|
78
|
-
* 各历史类型的展示名称(页面 / 数据源 / 代码块),由 historyService.state.stepNames 配置,
|
|
79
|
-
* 业务方可通过 historyService.setStepName / registerStepType 覆盖。基于 reactive state 派生,配置变更后自动刷新。
|
|
80
|
-
*/
|
|
81
|
-
const pageName = computed(() => historyService.getStepName("page"));
|
|
82
|
-
const dataSourceName = computed(() => historyService.getStepName("dataSource"));
|
|
83
|
-
const codeBlockName = computed(() => historyService.getStepName("codeBlock"));
|
|
76
|
+
const pageMarker = computed(() => historyService.getPageMarker());
|
|
84
77
|
/** 代码块 step 仅 update(前后 content 都存在)时可查看差异。 */
|
|
85
78
|
const isStepDiffable = (step) => Boolean(step.diff?.[0]?.oldSchema && step.diff?.[0]?.newSchema);
|
|
86
79
|
/**
|
|
87
80
|
* 数据源 / 代码块两类 bucket 历史的整体渲染配置:把 title / prefix 与各自的描述、
|
|
88
81
|
* 可差异、可回滚判定收敛为单一对象整体注入 BucketTab,组件内部按需读取。
|
|
89
|
-
* title / 描述回退名取自可配置的展示名称,故用 computed 使其随 stepNames 变更刷新。
|
|
90
82
|
*/
|
|
91
|
-
const dataSourceConfig =
|
|
92
|
-
title:
|
|
83
|
+
const dataSourceConfig = {
|
|
84
|
+
title: "数据源",
|
|
93
85
|
prefix: "ds",
|
|
94
|
-
describeStep: (step) => describeStep(step, (schema) => schema?.title,
|
|
86
|
+
describeStep: (step) => describeStep(step, (schema) => schema?.title, "数据源"),
|
|
95
87
|
isStepDiffable,
|
|
96
88
|
isStepRevertable: isSingleDiffStepRevertable
|
|
97
|
-
}
|
|
98
|
-
const codeBlockConfig =
|
|
99
|
-
title:
|
|
89
|
+
};
|
|
90
|
+
const codeBlockConfig = {
|
|
91
|
+
title: "代码块",
|
|
100
92
|
prefix: "cb",
|
|
101
|
-
describeStep: (step) => describeStep(step, (content) => content?.name,
|
|
93
|
+
describeStep: (step) => describeStep(step, (content) => content?.name, "代码块"),
|
|
102
94
|
isStepDiffable,
|
|
103
95
|
isStepRevertable: isSingleDiffStepRevertable
|
|
104
|
-
}
|
|
96
|
+
};
|
|
105
97
|
/** 把"目标 step 索引"翻译成"目标 cursor"(已应用步骤数量)。 */
|
|
106
98
|
const indexToCursor = (index) => index + 1;
|
|
107
99
|
const onPageGoto = (index) => {
|
|
@@ -114,7 +106,7 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
114
106
|
* - 该 step 涉及的节点都已不存在(如删除记录、被撤销的新增)时给出提示,不做选中。
|
|
115
107
|
*/
|
|
116
108
|
const onPageSelect = async (index) => {
|
|
117
|
-
const step = historyService.
|
|
109
|
+
const step = historyService.getPageStepList()[index]?.step;
|
|
118
110
|
if (!step) return;
|
|
119
111
|
const targetId = (step.diff ?? []).map((item) => item.newSchema?.id ?? item.oldSchema?.id).find((id) => id !== void 0 && id !== null && editorService.getNodeById(id, false));
|
|
120
112
|
if (targetId === void 0 || targetId === null) {
|
|
@@ -164,19 +156,19 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
164
156
|
};
|
|
165
157
|
const onPageClear = async () => {
|
|
166
158
|
if (await confirmHistoryAction("确定清空当前页面的历史记录吗?清空后将无法撤销/重做之前的操作,本地保存的记录也会一并删除。")) {
|
|
167
|
-
historyService.
|
|
159
|
+
historyService.clearPage();
|
|
168
160
|
await syncIndexedDB();
|
|
169
161
|
}
|
|
170
162
|
};
|
|
171
163
|
const onDataSourceClear = async () => {
|
|
172
164
|
if (await confirmHistoryAction("确定清空数据源的历史记录吗?清空后将无法撤销/重做之前的操作,本地保存的记录也会一并删除。")) {
|
|
173
|
-
historyService.
|
|
165
|
+
historyService.clearDataSource();
|
|
174
166
|
await syncIndexedDB();
|
|
175
167
|
}
|
|
176
168
|
};
|
|
177
169
|
const onCodeBlockClear = async () => {
|
|
178
170
|
if (await confirmHistoryAction("确定清空代码块的历史记录吗?清空后将无法撤销/重做之前的操作,本地保存的记录也会一并删除。")) {
|
|
179
|
-
historyService.
|
|
171
|
+
historyService.clearCodeBlock();
|
|
180
172
|
await syncIndexedDB();
|
|
181
173
|
}
|
|
182
174
|
};
|
|
@@ -227,7 +219,7 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
227
219
|
default: withCtx(() => [
|
|
228
220
|
(openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), normalizeProps(guardReactiveProps(unref(tabPaneComponent)?.props({
|
|
229
221
|
name: "page",
|
|
230
|
-
label:
|
|
222
|
+
label: `页面 (${unref(pageGroups).length})`
|
|
231
223
|
}) || {})), {
|
|
232
224
|
default: withCtx(() => [createVNode(PageTab_default, {
|
|
233
225
|
list: unref(pageGroupsDisplay),
|
|
@@ -252,10 +244,10 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
252
244
|
}, 16)),
|
|
253
245
|
!disabledDataSource.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), normalizeProps(mergeProps({ key: 0 }, unref(tabPaneComponent)?.props({
|
|
254
246
|
name: "data-source",
|
|
255
|
-
label:
|
|
247
|
+
label: `数据源 (${unref(dataSourceGroups).length})`
|
|
256
248
|
}) || {})), {
|
|
257
249
|
default: withCtx(() => [createVNode(BucketTab_default, {
|
|
258
|
-
config: dataSourceConfig
|
|
250
|
+
config: dataSourceConfig,
|
|
259
251
|
buckets: unref(dataSourceGroupsByTarget),
|
|
260
252
|
expanded: unref(expanded),
|
|
261
253
|
onToggle: unref(toggleGroup),
|
|
@@ -265,7 +257,6 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
265
257
|
onRevertStep: unref(onDataSourceRevert),
|
|
266
258
|
onClear: onDataSourceClear
|
|
267
259
|
}, null, 8, [
|
|
268
|
-
"config",
|
|
269
260
|
"buckets",
|
|
270
261
|
"expanded",
|
|
271
262
|
"onToggle",
|
|
@@ -276,10 +267,10 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
276
267
|
}, 16)) : createCommentVNode("v-if", true),
|
|
277
268
|
!disabledCodeBlock.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), normalizeProps(mergeProps({ key: 1 }, unref(tabPaneComponent)?.props({
|
|
278
269
|
name: "code-block",
|
|
279
|
-
label:
|
|
270
|
+
label: `代码块 (${unref(codeBlockGroups).length})`
|
|
280
271
|
}) || {})), {
|
|
281
272
|
default: withCtx(() => [createVNode(BucketTab_default, {
|
|
282
|
-
config: codeBlockConfig
|
|
273
|
+
config: codeBlockConfig,
|
|
283
274
|
buckets: unref(codeBlockGroupsByTarget),
|
|
284
275
|
expanded: unref(expanded),
|
|
285
276
|
onToggle: unref(toggleGroup),
|
|
@@ -289,7 +280,6 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
289
280
|
onRevertStep: unref(onCodeBlockRevert),
|
|
290
281
|
onClear: onCodeBlockClear
|
|
291
282
|
}, null, 8, [
|
|
292
|
-
"config",
|
|
293
283
|
"buckets",
|
|
294
284
|
"expanded",
|
|
295
285
|
"onToggle",
|
|
@@ -10,7 +10,7 @@ import { computed, reactive } from "vue";
|
|
|
10
10
|
* 所有数据基于 historyService 的 reactive state 派生,自动跟随历史变化刷新。
|
|
11
11
|
*/
|
|
12
12
|
var useHistoryList = () => {
|
|
13
|
-
const {
|
|
13
|
+
const { historyService } = useServices();
|
|
14
14
|
/**
|
|
15
15
|
* 折叠状态:key 形如 `pg-${组内首步 index}` / `ds-${id}-${组内首步 index}` / `cb-${id}-${组内首步 index}`。
|
|
16
16
|
* 用组内首步的稳定 index(而非展示位置)作为 key,确保历史数据更新后已展开的分组状态保持不变。
|
|
@@ -20,9 +20,9 @@ var useHistoryList = () => {
|
|
|
20
20
|
const toggleGroup = (key) => {
|
|
21
21
|
expanded[key] = expanded[key] === false;
|
|
22
22
|
};
|
|
23
|
-
const pageGroups = computed(() => historyService.
|
|
24
|
-
const dataSourceGroups = computed(() => historyService.
|
|
25
|
-
const codeBlockGroups = computed(() => historyService.
|
|
23
|
+
const pageGroups = computed(() => historyService.getPageHistoryGroups());
|
|
24
|
+
const dataSourceGroups = computed(() => historyService.getDataSourceHistoryGroups());
|
|
25
|
+
const codeBlockGroups = computed(() => historyService.getCodeBlockHistoryGroups());
|
|
26
26
|
/** 页面 tab 倒序展示(最新一组在最上面)。 */
|
|
27
27
|
const pageGroupsDisplay = computed(() => pageGroups.value.slice().reverse());
|
|
28
28
|
/**
|
|
@@ -151,21 +151,21 @@ var useHistoryRevert = (services, options = {}) => {
|
|
|
151
151
|
};
|
|
152
152
|
const buildPageDiffPayload = (index) => buildDiffPayload({
|
|
153
153
|
category: "node",
|
|
154
|
-
groups: () => historyService.
|
|
154
|
+
groups: () => historyService.getPageHistoryGroups(),
|
|
155
155
|
getCurrent: (id) => editorService.getNodeById(id),
|
|
156
156
|
resolveType: (n, o) => n.type || o.type || "",
|
|
157
157
|
resolveLabel: (n, o) => n.name || o.name || n.type || o.type || ""
|
|
158
158
|
}, index);
|
|
159
159
|
const buildDataSourceDiffPayload = (id, index) => buildDiffPayload({
|
|
160
160
|
category: "data-source",
|
|
161
|
-
groups: () => historyService.
|
|
161
|
+
groups: () => historyService.getDataSourceHistoryGroups(),
|
|
162
162
|
getCurrent: (id) => dataSourceService.getDataSourceById(`${id}`),
|
|
163
163
|
resolveType: (n, o) => n.type || o.type || "base",
|
|
164
164
|
resolveLabel: (n, o, id) => n.title || o.title || `${id}`
|
|
165
165
|
}, index, id);
|
|
166
166
|
const buildCodeBlockDiffPayload = (id, index) => buildDiffPayload({
|
|
167
167
|
category: "code-block",
|
|
168
|
-
groups: () => historyService.
|
|
168
|
+
groups: () => historyService.getCodeBlockHistoryGroups(),
|
|
169
169
|
getCurrent: (id) => codeBlockService.getCodeContentById(id),
|
|
170
170
|
resolveLabel: (n, o, id) => n.name || o.name || `${id}`
|
|
171
171
|
}, index, id);
|
|
@@ -176,7 +176,7 @@ var useHistoryRevert = (services, options = {}) => {
|
|
|
176
176
|
* add(回滚即删除)即使目标已不在,也已达成「删除」目的,不视为失败。
|
|
177
177
|
*/
|
|
178
178
|
const isPageRevertTargetMissing = (index) => {
|
|
179
|
-
const step = historyService.
|
|
179
|
+
const step = historyService.getPageStepList()[index]?.step;
|
|
180
180
|
if (!step) return false;
|
|
181
181
|
if (step.opType === "update") return (step.diff ?? []).some((item) => {
|
|
182
182
|
const id = item.newSchema?.id ?? item.oldSchema?.id;
|
|
@@ -187,12 +187,12 @@ var useHistoryRevert = (services, options = {}) => {
|
|
|
187
187
|
};
|
|
188
188
|
/** 数据源 update 步骤回滚时,对应数据源必须仍存在(已删除则无处写回旧值)。 */
|
|
189
189
|
const isDataSourceRevertTargetMissing = (id, index) => {
|
|
190
|
-
const step = historyService.
|
|
190
|
+
const step = historyService.getDataSourceStepList(id)[index]?.step;
|
|
191
191
|
return Boolean(step?.opType === "update" && !dataSourceService.getDataSourceById(`${id}`));
|
|
192
192
|
};
|
|
193
193
|
/** 代码块 update 步骤回滚时,对应代码块必须仍存在(已删除则无处写回旧值)。 */
|
|
194
194
|
const isCodeBlockRevertTargetMissing = (id, index) => {
|
|
195
|
-
const step = historyService.
|
|
195
|
+
const step = historyService.getCodeBlockStepList(id)[index]?.step;
|
|
196
196
|
return Boolean(step?.opType === "update" && !codeBlockService.getCodeContentById(id));
|
|
197
197
|
};
|
|
198
198
|
const onPageRevert = (index) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CODE_DRAFT_STORAGE_KEY } from "../type.js";
|
|
2
2
|
import BaseService from "./BaseService.js";
|
|
3
3
|
import { getEditorConfig } from "../utils/config.js";
|
|
4
|
-
import {
|
|
4
|
+
import { 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";
|
|
@@ -121,16 +121,13 @@ var CodeBlock = class extends BaseService {
|
|
|
121
121
|
...codeConfigProcessed
|
|
122
122
|
};
|
|
123
123
|
const newContent = cloneDeep$1(codeDsl[id]);
|
|
124
|
-
if (!doNotPushHistory) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
});
|
|
132
|
-
this.lastPushedHistoryId = (step ? history_default.push("codeBlock", step, id) : null)?.uuid ?? null;
|
|
133
|
-
}
|
|
124
|
+
if (!doNotPushHistory) this.lastPushedHistoryId = history_default.pushCodeBlock(id, {
|
|
125
|
+
oldContent,
|
|
126
|
+
newContent,
|
|
127
|
+
changeRecords,
|
|
128
|
+
historyDescription,
|
|
129
|
+
source: historySource
|
|
130
|
+
})?.uuid ?? null;
|
|
134
131
|
this.emit("addOrUpdate", id, codeDsl[id]);
|
|
135
132
|
}
|
|
136
133
|
/**
|
|
@@ -215,16 +212,15 @@ var CodeBlock = class extends BaseService {
|
|
|
215
212
|
if (!currentDsl) return;
|
|
216
213
|
this.lastDeletedHistoryIds = [];
|
|
217
214
|
codeIds.forEach((id) => {
|
|
218
|
-
const
|
|
215
|
+
const oldContent = currentDsl[id] ? cloneDeep$1(currentDsl[id]) : null;
|
|
219
216
|
delete currentDsl[id];
|
|
220
|
-
if (
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
217
|
+
if (oldContent && !doNotPushHistory) {
|
|
218
|
+
const uuid = history_default.pushCodeBlock(id, {
|
|
219
|
+
oldContent,
|
|
220
|
+
newContent: null,
|
|
224
221
|
historyDescription,
|
|
225
222
|
source: historySource
|
|
226
|
-
});
|
|
227
|
-
const uuid = step ? history_default.push("codeBlock", step, id)?.uuid : void 0;
|
|
223
|
+
})?.uuid;
|
|
228
224
|
if (uuid) this.lastDeletedHistoryIds.push(uuid);
|
|
229
225
|
}
|
|
230
226
|
this.emit("remove", id);
|
|
@@ -285,7 +281,7 @@ var CodeBlock = class extends BaseService {
|
|
|
285
281
|
* @returns 撤销的 step;栈不存在或已无可撤销时返回 null
|
|
286
282
|
*/
|
|
287
283
|
async undo(id) {
|
|
288
|
-
const step = history_default.
|
|
284
|
+
const step = history_default.undoCodeBlock(id);
|
|
289
285
|
if (!step) return null;
|
|
290
286
|
await this.applyHistoryStep(step, true);
|
|
291
287
|
return step;
|
|
@@ -296,18 +292,18 @@ var CodeBlock = class extends BaseService {
|
|
|
296
292
|
* @returns 重做的 step;栈不存在或已无可重做时返回 null
|
|
297
293
|
*/
|
|
298
294
|
async redo(id) {
|
|
299
|
-
const step = history_default.
|
|
295
|
+
const step = history_default.redoCodeBlock(id);
|
|
300
296
|
if (!step) return null;
|
|
301
297
|
await this.applyHistoryStep(step, false);
|
|
302
298
|
return step;
|
|
303
299
|
}
|
|
304
300
|
/** 是否可对指定代码块撤销。 */
|
|
305
301
|
canUndo(id) {
|
|
306
|
-
return history_default.
|
|
302
|
+
return history_default.canUndoCodeBlock(id);
|
|
307
303
|
}
|
|
308
304
|
/** 是否可对指定代码块重做。 */
|
|
309
305
|
canRedo(id) {
|
|
310
|
-
return history_default.
|
|
306
|
+
return history_default.canRedoCodeBlock(id);
|
|
311
307
|
}
|
|
312
308
|
/**
|
|
313
309
|
* 跳转指定代码块的历史栈到目标游标。语义同 editor.gotoPageStep。
|
|
@@ -317,7 +313,7 @@ var CodeBlock = class extends BaseService {
|
|
|
317
313
|
* @returns 实际移动到的最终游标位置
|
|
318
314
|
*/
|
|
319
315
|
async goto(id, targetCursor) {
|
|
320
|
-
let cursor = history_default.
|
|
316
|
+
let cursor = history_default.getCodeBlockCursor(id);
|
|
321
317
|
const target = Math.max(0, targetCursor);
|
|
322
318
|
while (cursor > target) {
|
|
323
319
|
if (!await this.undo(id)) break;
|
|
@@ -340,11 +336,11 @@ var CodeBlock = class extends BaseService {
|
|
|
340
336
|
* @returns 反向后产生的新 step;目标不存在 / 未应用时返回 null
|
|
341
337
|
*/
|
|
342
338
|
async revert(id, index) {
|
|
343
|
-
const entry = history_default.
|
|
339
|
+
const entry = history_default.getCodeBlockStepList(id)[index];
|
|
344
340
|
if (!entry?.applied) return null;
|
|
345
341
|
const { oldSchema, newSchema, changeRecords } = entry.step.diff?.[0] ?? {};
|
|
346
342
|
if (oldSchema && newSchema && !changeRecords?.length) return null;
|
|
347
|
-
const description = `回滚 #${index + 1}: ${describeRevertStep(entry.step.
|
|
343
|
+
const description = `回滚 #${index + 1}: ${describeRevertStep(entry.step.id, entry.step.diff?.[0], (s) => s.name)}`;
|
|
348
344
|
return await this.applyRevertStep(entry.step, description);
|
|
349
345
|
}
|
|
350
346
|
/**
|
|
@@ -357,7 +353,7 @@ var CodeBlock = class extends BaseService {
|
|
|
357
353
|
async revertById(uuids) {
|
|
358
354
|
const results = [];
|
|
359
355
|
for (const uuid of uuids) {
|
|
360
|
-
const location = history_default.
|
|
356
|
+
const location = history_default.findCodeBlockStepLocationByUuid(uuid);
|
|
361
357
|
results.push(location ? await this.revert(location.id, location.index) : null);
|
|
362
358
|
}
|
|
363
359
|
return results;
|
|
@@ -427,21 +423,21 @@ var CodeBlock = class extends BaseService {
|
|
|
427
423
|
* 差异仅在于通过公开的 setCodeDslByIdSync / deleteCodeDslByIds 触发 push。
|
|
428
424
|
*/
|
|
429
425
|
async applyRevertStep(step, historyDescription) {
|
|
430
|
-
const { id } = step
|
|
426
|
+
const { id } = step;
|
|
431
427
|
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
432
428
|
if (!oldSchema && newSchema) {
|
|
433
429
|
await this.deleteCodeDslByIds([id], {
|
|
434
430
|
historyDescription,
|
|
435
431
|
historySource: "rollback"
|
|
436
432
|
});
|
|
437
|
-
return history_default.
|
|
433
|
+
return history_default.getCodeBlockStepList(id).slice(-1)[0]?.step ?? null;
|
|
438
434
|
}
|
|
439
435
|
if (oldSchema && !newSchema) {
|
|
440
436
|
this.setCodeDslByIdSync(id, cloneDeep$1(oldSchema), true, {
|
|
441
437
|
historyDescription,
|
|
442
438
|
historySource: "rollback"
|
|
443
439
|
});
|
|
444
|
-
return history_default.
|
|
440
|
+
return history_default.getCodeBlockStepList(id).slice(-1)[0]?.step ?? null;
|
|
445
441
|
}
|
|
446
442
|
if (!oldSchema || !newSchema) return null;
|
|
447
443
|
if (changeRecords?.length) {
|
|
@@ -462,13 +458,13 @@ var CodeBlock = class extends BaseService {
|
|
|
462
458
|
historyDescription,
|
|
463
459
|
historySource: "rollback"
|
|
464
460
|
});
|
|
465
|
-
return history_default.
|
|
461
|
+
return history_default.getCodeBlockStepList(id).slice(-1)[0]?.step ?? null;
|
|
466
462
|
}
|
|
467
463
|
this.setCodeDslByIdSync(id, cloneDeep$1(oldSchema), true, {
|
|
468
464
|
historyDescription,
|
|
469
465
|
historySource: "rollback"
|
|
470
466
|
});
|
|
471
|
-
return history_default.
|
|
467
|
+
return history_default.getCodeBlockStepList(id).slice(-1)[0]?.step ?? null;
|
|
472
468
|
}
|
|
473
469
|
/**
|
|
474
470
|
* 把一条历史 step 应用到当前代码块服务上。
|
|
@@ -485,7 +481,7 @@ var CodeBlock = class extends BaseService {
|
|
|
485
481
|
* @param reverse true=撤销,false=重做
|
|
486
482
|
*/
|
|
487
483
|
async applyHistoryStep(step, reverse) {
|
|
488
|
-
const { id } = step
|
|
484
|
+
const { id } = step;
|
|
489
485
|
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
490
486
|
if (!oldSchema && newSchema) {
|
|
491
487
|
if (reverse) await this.deleteCodeDslByIds([id], { doNotPushHistory: true });
|