@tmagic/editor 1.8.5 → 1.8.7
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 → Editor.vue.js} +9 -9
- package/dist/es/{Editor.js → Editor2.vue.js} +1 -1
- package/dist/es/components/{CodeBlockEditor.vue_vue_type_script_setup_true_lang.js → CodeBlockEditor.vue.js} +5 -5
- package/dist/es/components/{CodeBlockEditor.js → CodeBlockEditor2.vue.js} +1 -1
- package/dist/es/components/{CodeParams.js → CodeParams2.vue.js} +1 -1
- package/dist/es/components/{CompareForm.js → CompareForm2.vue.js} +1 -1
- package/dist/es/components/{ContentMenu.vue_vue_type_script_setup_true_lang.js → ContentMenu.vue.js} +2 -2
- package/dist/es/components/{ContentMenu.js → ContentMenu2.vue.js} +1 -1
- package/dist/es/components/{FloatingBox.vue_vue_type_script_setup_true_lang.js → FloatingBox.vue.js} +2 -2
- package/dist/es/components/{FloatingBox.js → FloatingBox2.vue.js} +1 -1
- package/dist/es/components/{Icon.js → Icon2.vue.js} +1 -1
- package/dist/es/components/{Resizer.js → Resizer2.vue.js} +1 -1
- package/dist/es/components/{ScrollBar.js → ScrollBar2.vue.js} +1 -1
- package/dist/es/components/{ScrollViewer.vue_vue_type_script_setup_true_lang.js → ScrollViewer.vue.js} +3 -3
- package/dist/es/components/{ScrollViewer.js → ScrollViewer2.vue.js} +1 -1
- package/dist/es/components/{SearchInput.js → SearchInput2.vue.js} +1 -1
- package/dist/es/components/{SplitView.vue_vue_type_script_setup_true_lang.js → SplitView.vue.js} +1 -1
- package/dist/es/components/{SplitView.js → SplitView2.vue.js} +1 -1
- package/dist/es/components/{ToolButton.vue_vue_type_script_setup_true_lang.js → ToolButton.vue.js} +3 -3
- package/dist/es/components/{ToolButton.js → ToolButton2.vue.js} +1 -1
- package/dist/es/components/{Tree.vue_vue_type_script_setup_true_lang.js → Tree.vue.js} +1 -1
- package/dist/es/components/{Tree.js → Tree2.vue.js} +1 -1
- package/dist/es/components/{TreeNode.vue_vue_type_script_setup_true_lang.js → TreeNode.vue.js} +2 -2
- package/dist/es/components/{TreeNode.js → TreeNode2.vue.js} +1 -1
- package/dist/es/components/{ViewForm.js → ViewForm2.vue.js} +1 -1
- package/dist/es/fields/{Code.vue_vue_type_script_setup_true_lang.js → Code.vue.js} +1 -1
- package/dist/es/fields/{Code.js → Code2.vue.js} +1 -1
- package/dist/es/fields/{CodeLink.js → CodeLink2.vue.js} +1 -1
- package/dist/es/fields/{CodeSelect.js → CodeSelect2.vue.js} +1 -1
- package/dist/es/fields/{CodeSelectCol.vue_vue_type_script_setup_true_lang.js → CodeSelectCol.vue.js} +7 -7
- package/dist/es/fields/{CodeSelectCol.js → CodeSelectCol2.vue.js} +1 -1
- package/dist/es/fields/{CondOpSelect.js → CondOpSelect2.vue.js} +1 -1
- package/dist/es/fields/DataSourceFieldSelect/{FieldSelect.vue_vue_type_script_setup_true_lang.js → FieldSelect.vue.js} +55 -14
- package/dist/es/fields/DataSourceFieldSelect/{FieldSelect.js → FieldSelect2.vue.js} +1 -1
- package/dist/es/fields/DataSourceFieldSelect/{Index.vue_vue_type_script_setup_true_lang.js → Index.vue.js} +7 -7
- package/dist/es/fields/DataSourceFieldSelect/{Index.js → Index2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceFields.vue_vue_type_script_setup_true_lang.js → DataSourceFields.vue.js} +50 -17
- package/dist/es/fields/{DataSourceFields.js → DataSourceFields2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceInput.vue_vue_type_script_setup_true_lang.js → DataSourceInput.vue.js} +5 -5
- package/dist/es/fields/{DataSourceInput.js → DataSourceInput2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js → DataSourceMethodSelect.vue.js} +7 -7
- package/dist/es/fields/{DataSourceMethodSelect.js → DataSourceMethodSelect2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceMethods.vue_vue_type_script_setup_true_lang.js → DataSourceMethods.vue.js} +3 -3
- package/dist/es/fields/{DataSourceMethods.js → DataSourceMethods2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceMocks.vue_vue_type_script_setup_true_lang.js → DataSourceMocks.vue.js} +8 -8
- package/dist/es/fields/{DataSourceMocks.js → DataSourceMocks2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceSelect.vue_vue_type_script_setup_true_lang.js → DataSourceSelect.vue.js} +5 -5
- package/dist/es/fields/{DataSourceSelect.js → DataSourceSelect2.vue.js} +1 -1
- package/dist/es/fields/{DisplayConds.js → DisplayConds2.vue.js} +1 -1
- package/dist/es/fields/{EventSelect.js → EventSelect2.vue.js} +1 -1
- package/dist/es/fields/{KeyValue.vue_vue_type_script_setup_true_lang.js → KeyValue.vue.js} +3 -3
- package/dist/es/fields/{KeyValue.js → KeyValue2.vue.js} +1 -1
- package/dist/es/fields/{PageFragmentSelect.vue_vue_type_script_setup_true_lang.js → PageFragmentSelect.vue.js} +4 -4
- package/dist/es/fields/{PageFragmentSelect.js → PageFragmentSelect2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/{Index.vue_vue_type_script_setup_true_lang.js → Index.vue.js} +7 -7
- package/dist/es/fields/StyleSetter/{Index.js → Index2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{BackgroundPosition.js → BackgroundPosition2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{Border.js → Border2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{Box.js → Box2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/configs.js +43 -43
- package/dist/es/fields/StyleSetter/pro/{Background.js → Background2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Border.vue_vue_type_script_setup_true_lang.js → Border.vue.js} +3 -3
- package/dist/es/fields/StyleSetter/pro/{Border.js → Border2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Font.js → Font2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Layout.vue_vue_type_script_setup_true_lang.js → Layout.vue.js} +4 -4
- package/dist/es/fields/StyleSetter/pro/{Layout.js → Layout2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Position.js → Position2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Transform.js → Transform2.vue.js} +1 -1
- package/dist/es/fields/{UISelect.js → UISelect2.vue.js} +1 -1
- package/dist/es/fields/configs/codeSelect.js +2 -2
- package/dist/es/fields/configs/displayConds.js +1 -1
- package/dist/es/fields/configs/eventSelect.js +3 -3
- package/dist/es/fields/headless-validation.js +1 -1
- package/dist/es/hooks/use-code-block-edit.js +1 -1
- package/dist/es/hooks/use-compare-form.js +1 -1
- package/dist/es/hooks/use-editor-content-height.js +1 -1
- package/dist/es/hooks/use-filter.js +2 -2
- package/dist/es/hooks/use-float-box.js +1 -1
- package/dist/es/hooks/use-form-context.js +1 -1
- package/dist/es/hooks/use-node-status.js +1 -1
- package/dist/es/hooks/use-stage.js +28 -3
- package/dist/es/icons/{CenterIcon.js → CenterIcon2.vue.js} +1 -1
- package/dist/es/icons/{CodeIcon.js → CodeIcon2.vue.js} +1 -1
- package/dist/es/icons/{FolderMinusIcon.js → FolderMinusIcon2.vue.js} +1 -1
- package/dist/es/index.js +47 -47
- package/dist/es/initService.js +9 -9
- package/dist/es/layouts/{AddPageBox.vue_vue_type_script_setup_true_lang.js → AddPageBox.vue.js} +4 -4
- package/dist/es/layouts/{AddPageBox.js → AddPageBox2.vue.js} +1 -1
- package/dist/es/layouts/{CodeEditor.vue_vue_type_script_setup_true_lang.js → CodeEditor.vue.js} +5 -5
- package/dist/es/layouts/{CodeEditor.js → CodeEditor2.vue.js} +1 -1
- package/dist/es/layouts/{Framework.vue_vue_type_script_setup_true_lang.js → Framework.vue.js} +5 -5
- package/dist/es/layouts/{Framework.js → Framework2.vue.js} +1 -1
- package/dist/es/layouts/{NavMenu.vue_vue_type_script_setup_true_lang.js → NavMenu.vue.js} +5 -5
- package/dist/es/layouts/{NavMenu.js → NavMenu2.vue.js} +1 -1
- package/dist/es/layouts/{NavMenuColumn.vue_vue_type_script_setup_true_lang.js → NavMenuColumn.vue.js} +14 -6
- package/dist/es/layouts/{NavMenuColumn.js → NavMenuColumn2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{Bucket.vue_vue_type_script_setup_true_lang.js → Bucket.vue.js} +23 -7
- package/dist/es/layouts/history-list/{Bucket.js → Bucket2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{BucketTab.vue_vue_type_script_setup_true_lang.js → BucketTab.vue.js} +9 -4
- package/dist/es/layouts/history-list/{BucketTab.js → BucketTab2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{GroupRow.js → GroupRow2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js → HistoryDiffDialog.vue.js} +3 -3
- package/dist/es/layouts/history-list/{HistoryDiffDialog.js → HistoryDiffDialog2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{HistoryListPanel.vue_vue_type_script_setup_true_lang.js → HistoryListPanel.vue.js} +24 -6
- package/dist/es/layouts/history-list/{HistoryListPanel.js → HistoryListPanel2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{InitialRow.vue_vue_type_script_setup_true_lang.js → InitialRow.vue.js} +16 -5
- package/dist/es/layouts/history-list/{InitialRow.js → InitialRow2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{PageTab.vue_vue_type_script_setup_true_lang.js → PageTab.vue.js} +20 -8
- package/dist/es/layouts/history-list/{PageTab.js → PageTab2.vue.js} +1 -1
- package/dist/es/layouts/history-list/composables.js +1 -1
- package/dist/es/layouts/history-list/useHistoryList.js +1 -1
- package/dist/es/layouts/history-list/useHistoryRevert.js +3 -3
- package/dist/es/layouts/page-bar/{AddButton.vue_vue_type_script_setup_true_lang.js → AddButton.vue.js} +6 -6
- package/dist/es/layouts/page-bar/{AddButton.js → AddButton2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{PageBar.vue_vue_type_script_setup_true_lang.js → PageBar.vue.js} +8 -8
- package/dist/es/layouts/page-bar/{PageBar.js → PageBar2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{PageBarScrollContainer.vue_vue_type_script_setup_true_lang.js → PageBarScrollContainer.vue.js} +2 -2
- package/dist/es/layouts/page-bar/{PageBarScrollContainer.js → PageBarScrollContainer2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{PageList.vue_vue_type_script_setup_true_lang.js → PageList.vue.js} +3 -3
- package/dist/es/layouts/page-bar/{PageList.js → PageList2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{Search.vue_vue_type_script_setup_true_lang.js → Search.vue.js} +3 -3
- package/dist/es/layouts/page-bar/{Search.js → Search2.vue.js} +1 -1
- package/dist/es/layouts/props-panel/{FormPanel.vue_vue_type_script_setup_true_lang.js → FormPanel.vue.js} +7 -7
- package/dist/es/layouts/props-panel/{FormPanel.js → FormPanel2.vue.js} +1 -1
- package/dist/es/layouts/props-panel/{PropsPanel.vue_vue_type_script_setup_true_lang.js → PropsPanel.vue.js} +7 -7
- package/dist/es/layouts/props-panel/{PropsPanel.js → PropsPanel2.vue.js} +1 -1
- package/dist/es/layouts/props-panel/use-style-panel.js +1 -1
- package/dist/es/layouts/sidebar/{ComponentListPanel.vue_vue_type_script_setup_true_lang.js → ComponentListPanel.vue.js} +7 -7
- package/dist/es/layouts/sidebar/{ComponentListPanel.js → ComponentListPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/{Sidebar.vue_vue_type_script_setup_true_lang.js → Sidebar.vue.js} +8 -8
- package/dist/es/layouts/sidebar/{Sidebar.js → Sidebar2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/code-block/{CodeBlockList.vue_vue_type_script_setup_true_lang.js → CodeBlockList.vue.js} +5 -5
- package/dist/es/layouts/sidebar/code-block/{CodeBlockList.js → CodeBlockList2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/code-block/{CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js → CodeBlockListPanel.vue.js} +6 -6
- package/dist/es/layouts/sidebar/code-block/{CodeBlockListPanel.js → CodeBlockListPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/code-block/useContentMenu.js +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceAddButton.vue_vue_type_script_setup_true_lang.js → DataSourceAddButton.vue.js} +2 -2
- package/dist/es/layouts/sidebar/data-source/{DataSourceAddButton.js → DataSourceAddButton2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js → DataSourceConfigPanel.vue.js} +4 -4
- package/dist/es/layouts/sidebar/data-source/{DataSourceConfigPanel.js → DataSourceConfigPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceList.vue_vue_type_script_setup_true_lang.js → DataSourceList.vue.js} +5 -5
- package/dist/es/layouts/sidebar/data-source/{DataSourceList.js → DataSourceList2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceListPanel.vue_vue_type_script_setup_true_lang.js → DataSourceListPanel.vue.js} +8 -8
- package/dist/es/layouts/sidebar/data-source/{DataSourceListPanel.js → DataSourceListPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/useContentMenu.js +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerMenu.vue_vue_type_script_setup_true_lang.js → LayerMenu.vue.js} +5 -5
- package/dist/es/layouts/sidebar/layer/{LayerMenu.js → LayerMenu2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerNodeContent.vue_vue_type_script_setup_true_lang.js → LayerNodeContent.vue.js} +3 -3
- package/dist/es/layouts/sidebar/layer/{LayerNodeContent.js → LayerNodeContent2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerNodeTool.js → LayerNodeTool2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerPanel.vue_vue_type_script_setup_true_lang.js → LayerPanel.vue.js} +7 -7
- package/dist/es/layouts/sidebar/layer/{LayerPanel.js → LayerPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/use-click.js +3 -3
- package/dist/es/layouts/sidebar/layer/use-drag.js +1 -1
- package/dist/es/layouts/sidebar/layer/use-keybinding.js +1 -1
- package/dist/es/layouts/sidebar/layer/use-node-status.js +2 -2
- package/dist/es/layouts/workspace/{Breadcrumb.js → Breadcrumb2.vue.js} +1 -1
- package/dist/es/layouts/workspace/{Workspace.vue_vue_type_script_setup_true_lang.js → Workspace.vue.js} +3 -3
- package/dist/es/layouts/workspace/{Workspace.js → Workspace2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{NodeListMenu.vue_vue_type_script_setup_true_lang.js → NodeListMenu.vue.js} +5 -5
- package/dist/es/layouts/workspace/viewer/{NodeListMenu.js → NodeListMenu2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{Stage.vue_vue_type_script_setup_true_lang.js → Stage.vue.js} +70 -55
- package/dist/es/layouts/workspace/viewer/{Stage.js → Stage2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{StageOverlay.vue_vue_type_script_setup_true_lang.js → StageOverlay.vue.js} +3 -3
- package/dist/es/layouts/workspace/viewer/{StageOverlay.js → StageOverlay2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{ViewerMenu.vue_vue_type_script_setup_true_lang.js → ViewerMenu.vue.js} +6 -6
- package/dist/es/layouts/workspace/viewer/{ViewerMenu.js → ViewerMenu2.vue.js} +1 -1
- package/dist/es/plugin.js +24 -24
- package/dist/es/sdk/index.js +2 -2
- package/dist/es/sdk/services/CodeBlock.js +18 -18
- package/dist/es/sdk/services/DataSource.js +17 -17
- package/dist/es/sdk/services/Dep.js +3 -3
- package/dist/es/sdk/services/Editor.js +116 -81
- package/dist/es/sdk/services/Events.js +2 -2
- package/dist/es/sdk/services/History.js +45 -7
- package/dist/es/sdk/services/Props.js +6 -6
- package/dist/es/sdk/services/WebStorage.js +1 -1
- package/dist/es/sdk/utils/dep.js +2 -2
- package/dist/es/sdk/utils/operator.js +3 -3
- package/dist/es/sdk/validate/index.js +4 -4
- package/dist/es/sdk/wiring.js +2 -2
- package/dist/es/services/keybinding.js +2 -2
- package/dist/es/services/stageOverlay.js +2 -2
- package/dist/es/services/ui.js +2 -2
- package/dist/es/utils/code-block.js +2 -2
- package/dist/es/utils/content-menu.js +3 -3
- package/dist/es/utils/data-source/index.js +88 -5
- package/dist/es/utils/dep/collect-worker-client.js +1 -1
- package/dist/es/utils/dep/idle-task.js +1 -1
- package/dist/es/utils/editor.js +7 -6
- package/dist/es/utils/event.js +1 -1
- package/dist/es/utils/history.js +29 -10
- package/dist/es/utils/operator.js +1 -1
- package/dist/es/utils/page.js +21 -0
- package/dist/es/utils/props.js +1 -1
- package/dist/es/utils/type-match-rules.js +4 -4
- package/dist/es/utils/undo-redo.js +57 -9
- package/dist/tmagic-editor-headless.umd.cjs +257 -87
- package/dist/tmagic-editor-sdk.umd.cjs +225 -84
- package/dist/tmagic-editor.umd.cjs +814 -241
- package/package.json +8 -8
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +68 -9
- package/src/fields/DataSourceFields.vue +53 -10
- package/src/fields/DataSourceMocks.vue +2 -2
- package/src/hooks/use-stage.ts +26 -1
- package/src/layouts/NavMenuColumn.vue +8 -1
- package/src/layouts/history-list/Bucket.vue +30 -16
- package/src/layouts/history-list/BucketTab.vue +8 -1
- package/src/layouts/history-list/HistoryListPanel.vue +27 -0
- package/src/layouts/history-list/InitialRow.vue +17 -5
- package/src/layouts/history-list/PageTab.vue +32 -18
- package/src/layouts/workspace/viewer/Stage.vue +77 -57
- package/src/sdk/services/Editor.ts +56 -26
- package/src/sdk/services/History.ts +58 -11
- package/src/type.ts +19 -3
- package/src/utils/data-source/index.ts +151 -6
- package/src/utils/editor.ts +4 -0
- package/src/utils/history.ts +35 -10
- package/src/utils/page.ts +32 -0
- package/src/utils/undo-redo.ts +76 -12
- package/types/headless.d.ts +14 -3
- package/types/index.d.ts +234 -314
- package/types/sdk.d.ts +79 -59
- package/dist/es/components/{CodeParams.vue_vue_type_script_setup_true_lang.js → CodeParams.vue.js} +2 -2
- package/dist/es/components/{CompareForm.vue_vue_type_script_setup_true_lang.js → CompareForm.vue.js} +3 -3
- package/dist/es/components/{Icon.vue_vue_type_script_setup_true_lang.js → Icon.vue.js} +1 -1
- package/dist/es/components/{Resizer.vue_vue_type_script_setup_true_lang.js → Resizer.vue.js} +1 -1
- package/dist/es/components/{ScrollBar.vue_vue_type_script_setup_true_lang.js → ScrollBar.vue.js} +0 -0
- package/dist/es/components/{SearchInput.vue_vue_type_script_setup_true_lang.js → SearchInput.vue.js} +1 -1
- package/dist/es/components/{ViewForm.vue_vue_type_script_setup_true_lang.js → ViewForm.vue.js} +2 -2
- package/dist/es/fields/{CodeLink.vue_vue_type_script_setup_true_lang.js → CodeLink.vue.js} +1 -1
- package/dist/es/fields/{CodeSelect.vue_vue_type_script_setup_true_lang.js → CodeSelect.vue.js} +2 -2
- package/dist/es/fields/{CondOpSelect.vue_vue_type_script_setup_true_lang.js → CondOpSelect.vue.js} +3 -3
- package/dist/es/fields/{DisplayConds.vue_vue_type_script_setup_true_lang.js → DisplayConds.vue.js} +2 -2
- package/dist/es/fields/{EventSelect.vue_vue_type_script_setup_true_lang.js → EventSelect.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/components/{BackgroundPosition.vue_vue_type_script_setup_true_lang.js → BackgroundPosition.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{Border.vue_vue_type_script_setup_true_lang.js → Border.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/components/{Box.vue_vue_type_script_setup_true_lang.js → Box.vue.js} +0 -0
- package/dist/es/fields/StyleSetter/icons/align-items/{Baseline.js → Baseline.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Center.js → Center.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{End.js → End.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{FlexEnd.js → FlexEnd.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{FlexStart.js → FlexStart.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Normal.js → Normal.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{SpaceAround.js → SpaceAround.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{SpaceBetween.js → SpaceBetween.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Start.js → Start.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Stretch.js → Stretch.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{NoRepeat.js → NoRepeat.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{Repeat.js → Repeat.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{RepeatX.js → RepeatX.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{RepeatY.js → RepeatY.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{Round.js → Round.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{Space.js → Space.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Block.js → Block.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Flex.js → Flex.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Grid.js → Grid.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Inline.js → Inline.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{InlineBlock.js → InlineBlock.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{InlineFlex.js → InlineFlex.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{InlineGrid.js → InlineGrid.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{None.js → None.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{Column.js → Column.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{ColumnReverse.js → ColumnReverse.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{Row.js → Row.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{RowReverse.js → RowReverse.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{Center.js → Center.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{FlexEnd.js → FlexEnd.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{FlexStart.js → FlexStart.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{SpaceAround.js → SpaceAround.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{SpaceBetween.js → SpaceBetween.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{SpaceEvenly.js → SpaceEvenly.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Center.js → Center.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{End.js → End.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Justify.js → Justify.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Left.js → Left.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{MatchParent.js → MatchParent.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Right.js → Right.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Start.js → Start.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Background.vue_vue_type_script_setup_true_lang.js → Background.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/pro/{Font.vue_vue_type_script_setup_true_lang.js → Font.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/pro/{Position.vue_vue_type_script_setup_true_lang.js → Position.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/pro/{Transform.vue_vue_type_script_setup_true_lang.js → Transform.vue.js} +2 -2
- package/dist/es/fields/{UISelect.vue_vue_type_script_setup_true_lang.js → UISelect.vue.js} +5 -5
- package/dist/es/icons/{CenterIcon.vue_vue_type_script_setup_true_lang.js → CenterIcon.vue.js} +0 -0
- package/dist/es/icons/{CodeIcon.vue_vue_type_script_setup_true_lang.js → CodeIcon.vue.js} +0 -0
- package/dist/es/icons/{DatasourceIcon.js → DatasourceIcon.vue.js} +1 -1
- package/dist/es/icons/{FolderMinusIcon.vue_vue_type_script_setup_true_lang.js → FolderMinusIcon.vue.js} +0 -0
- package/dist/es/layouts/history-list/{GroupRow.vue_vue_type_script_setup_true_lang.js → GroupRow.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerNodeTool.vue_vue_type_script_setup_true_lang.js → LayerNodeTool.vue.js} +2 -2
- package/dist/es/layouts/workspace/{Breadcrumb.vue_vue_type_script_setup_true_lang.js → Breadcrumb.vue.js} +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { guid } from "@tmagic/utils";
|
|
1
2
|
import { deserializeStacks, getOrCreateStack, markStackSaved, mergeSteps, serializeStacks, undoFloor } from "../../utils/history.js";
|
|
2
3
|
import { UndoRedo } from "../../utils/undo-redo.js";
|
|
3
4
|
import BaseService from "./BaseService.js";
|
|
4
|
-
import { guid } from "@tmagic/utils";
|
|
5
5
|
// packages/editor/src/sdk/services/History.ts
|
|
6
6
|
var canUsePluginMethods = { sync: [
|
|
7
7
|
"push",
|
|
@@ -82,8 +82,9 @@ var History = class extends BaseService {
|
|
|
82
82
|
* 注册一个扩展历史类型,使其可与内置 `page` / `codeBlock` / `dataSource` 一样走统一的
|
|
83
83
|
* {@link push} / {@link undo} / {@link redo}(按 id 分栈、独立 undo/redo)。
|
|
84
84
|
*
|
|
85
|
+
* 扩展类型与内置类型一样统一派发 `change` 事件,无需(也不支持)单独指定事件名。
|
|
86
|
+
*
|
|
85
87
|
* @param stepType 自定义历史类型标识(勿与内置类型重名)
|
|
86
|
-
* @param options.event push/undo/redo 后派发的事件名,缺省为 `${stepType}-history-change`
|
|
87
88
|
* @param options.name 历史面板中的展示名称(tab / 分组标题等),缺省回退到 stepType 本身
|
|
88
89
|
*/
|
|
89
90
|
registerStepType(stepType, options = {}) {
|
|
@@ -167,11 +168,20 @@ var History = class extends BaseService {
|
|
|
167
168
|
const first = this.state.steps[stepType]?.[id]?.getElementList()[0];
|
|
168
169
|
return first?.opType === "initial" ? first : void 0;
|
|
169
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* 目标栈「回到初始」是否可达:容量裁剪删掉已应用的真实步骤后撤销链断开,返回 false。
|
|
173
|
+
* 与是否存在 {@link getMarker} 基线无关——没有基线的栈同样可能因裁剪回不到加载时的 DSL,
|
|
174
|
+
* 历史面板的各 tab 统一用它判断初始行是否可高亮 / 可点击。
|
|
175
|
+
*/
|
|
176
|
+
isInitialReachable(stepType, id) {
|
|
177
|
+
if (!this.isValidStackId(id)) return true;
|
|
178
|
+
return this.state.steps[stepType]?.[id]?.isInitialReachable() ?? true;
|
|
179
|
+
}
|
|
170
180
|
push(stepType, step, id) {
|
|
171
181
|
if (!this.isValidStackId(id)) return null;
|
|
172
182
|
this.fillStepMeta(step);
|
|
173
183
|
getOrCreateStack(this.getStepBucket(stepType), id).pushElement(step);
|
|
174
|
-
this.
|
|
184
|
+
this.emitStepChange(step, stepType, id);
|
|
175
185
|
return step;
|
|
176
186
|
}
|
|
177
187
|
undo(stepType, id) {
|
|
@@ -180,7 +190,7 @@ var History = class extends BaseService {
|
|
|
180
190
|
if (!undoRedo) return null;
|
|
181
191
|
if (undoRedo.getCursor() <= undoFloor(undoRedo)) return null;
|
|
182
192
|
const step = undoRedo.undo();
|
|
183
|
-
if (step) this.
|
|
193
|
+
if (step) this.emitStepChange(step, stepType, id, true);
|
|
184
194
|
return step;
|
|
185
195
|
}
|
|
186
196
|
redo(stepType, id) {
|
|
@@ -188,7 +198,7 @@ var History = class extends BaseService {
|
|
|
188
198
|
const undoRedo = this.state.steps[stepType]?.[id];
|
|
189
199
|
if (!undoRedo) return null;
|
|
190
200
|
const step = undoRedo.redo();
|
|
191
|
-
if (step) this.
|
|
201
|
+
if (step) this.emitStepChange(step, stepType, id, true);
|
|
192
202
|
return step;
|
|
193
203
|
}
|
|
194
204
|
/**
|
|
@@ -224,7 +234,7 @@ var History = class extends BaseService {
|
|
|
224
234
|
const undoRedo = getOrCreateStack(this.getStepBucket(stepType), id);
|
|
225
235
|
this.fillStepMeta(state);
|
|
226
236
|
if (!undoRedo.replaceCurrentElement(state)) return null;
|
|
227
|
-
this.
|
|
237
|
+
this.emitStepChange(state, stepType, id);
|
|
228
238
|
return state;
|
|
229
239
|
}
|
|
230
240
|
destroy() {
|
|
@@ -261,6 +271,9 @@ var History = class extends BaseService {
|
|
|
261
271
|
*
|
|
262
272
|
* 同一栈内任意时刻最多只有一条记录为 `saved`;从 IndexedDB 恢复时游标会被定位到最近一条已保存记录之后。
|
|
263
273
|
*
|
|
274
|
+
* 标记后把对应栈裁剪到容量上限({@link markStackSaved} → {@link UndoRedo.trim}):入栈与还原都不裁剪,
|
|
275
|
+
* 只有保存后才收敛,避免用户在落库前丢掉可撤销的历史;initial 基线与 set root 产生的记录不会被裁掉。
|
|
276
|
+
*
|
|
264
277
|
* @param stepType 历史类型
|
|
265
278
|
* @param id 目标栈 id;缺省表示标记全部类型 / 全部栈
|
|
266
279
|
*/
|
|
@@ -331,6 +344,10 @@ var History = class extends BaseService {
|
|
|
331
344
|
}
|
|
332
345
|
/**
|
|
333
346
|
* 用 {@link serialize} 导出的快照重建全部撤销/重做栈,会整体覆盖当前内存中的历史状态。
|
|
347
|
+
*
|
|
348
|
+
* 单个栈 / 单个类型的快照损坏只丢弃该部分,其余照常还原;
|
|
349
|
+
* 快照里的栈全部还原失败时抛出首个错误,此时内存中的历史状态保持不变
|
|
350
|
+
* (不会把「什么都没恢复」当成一次成功的还原)。
|
|
334
351
|
*/
|
|
335
352
|
restore(snapshot) {
|
|
336
353
|
const steps = {
|
|
@@ -338,9 +355,20 @@ var History = class extends BaseService {
|
|
|
338
355
|
codeBlock: {},
|
|
339
356
|
dataSource: {}
|
|
340
357
|
};
|
|
358
|
+
let firstError;
|
|
359
|
+
let stackCount = 0;
|
|
360
|
+
let restoredStackCount = 0;
|
|
341
361
|
Object.entries(snapshot.steps).forEach(([stepType, bucket]) => {
|
|
342
|
-
|
|
362
|
+
try {
|
|
363
|
+
const restored = deserializeStacks(convertExtraMaps(bucket, true), this.ctx.parseDSL);
|
|
364
|
+
steps[stepType] = restored;
|
|
365
|
+
restoredStackCount += Object.keys(restored).length;
|
|
366
|
+
} catch (error) {
|
|
367
|
+
firstError ??= error;
|
|
368
|
+
}
|
|
369
|
+
stackCount += Object.keys(bucket ?? {}).length;
|
|
343
370
|
});
|
|
371
|
+
if (firstError && stackCount > 0 && restoredStackCount === 0) throw firstError;
|
|
344
372
|
this.state.steps = steps;
|
|
345
373
|
return snapshot;
|
|
346
374
|
}
|
|
@@ -436,6 +464,16 @@ var History = class extends BaseService {
|
|
|
436
464
|
return super.emit(eventName, ...args);
|
|
437
465
|
}
|
|
438
466
|
/**
|
|
467
|
+
* 所有历史类型统一派发 `change`(签名 `(step, stepType, id, isHistoryOp)`);
|
|
468
|
+
* 代码块 / 数据源额外派发文档约定的同构事件(签名 `(id, step, isHistoryOp)`)。
|
|
469
|
+
* `isHistoryOp` 仅在 `undo` / `redo` 时为 true,供业务侧跳过历史回放触发的副作用。
|
|
470
|
+
*/
|
|
471
|
+
emitStepChange(step, stepType, id, isHistoryOp = false) {
|
|
472
|
+
this.emit("change", step, stepType, id, isHistoryOp);
|
|
473
|
+
if (stepType === "codeBlock") this.emit("code-block-history-change", id, step, isHistoryOp);
|
|
474
|
+
else if (stepType === "dataSource") this.emit("data-source-history-change", id, step, isHistoryOp);
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
439
477
|
* 取出指定历史类型的栈桶(`Record<id, UndoRedo>`);不存在时按需创建空桶,
|
|
440
478
|
* 从而支持通过 {@link registerStepType} 或首次 push 动态扩展历史类型。
|
|
441
479
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { cloneDeep, mergeWith } from "lodash-es";
|
|
2
|
+
import { Target, Watcher } from "@tmagic/core";
|
|
3
|
+
import { getNodePath, getValueByKeyPath, guid, setValueByKeyPath, toLine } from "@tmagic/utils";
|
|
1
4
|
import { fillConfig } from "../utils/props.js";
|
|
2
5
|
import BaseService from "./BaseService.js";
|
|
3
|
-
import { getNodePath, getValueByKeyPath, guid, setValueByKeyPath, toLine } from "@tmagic/utils";
|
|
4
|
-
import { Target, Watcher } from "@tmagic/core";
|
|
5
|
-
import { cloneDeep as cloneDeep$1, mergeWith } from "lodash-es";
|
|
6
6
|
// packages/editor/src/sdk/services/Props.ts
|
|
7
7
|
var canUsePluginMethods = {
|
|
8
8
|
async: [
|
|
@@ -79,7 +79,7 @@ var Props = class extends BaseService {
|
|
|
79
79
|
*/
|
|
80
80
|
async getPropsConfig(type, data) {
|
|
81
81
|
if (type === "area") return await this.getPropsConfig("button", data);
|
|
82
|
-
return cloneDeep
|
|
82
|
+
return cloneDeep(this.state.propsConfigMap[toLine(type)] || await this.fillConfig([]));
|
|
83
83
|
}
|
|
84
84
|
hasPropsConfig(type) {
|
|
85
85
|
return !!this.state.propsConfigMap[toLine(type)];
|
|
@@ -116,14 +116,14 @@ var Props = class extends BaseService {
|
|
|
116
116
|
}
|
|
117
117
|
const id = this.createId(type);
|
|
118
118
|
const defaultPropsValue = this.getDefaultPropsValue(type);
|
|
119
|
-
const data = this.setNewItemId(cloneDeep
|
|
119
|
+
const data = this.setNewItemId(cloneDeep({
|
|
120
120
|
type,
|
|
121
121
|
...defaultValue
|
|
122
122
|
}));
|
|
123
123
|
return {
|
|
124
124
|
id,
|
|
125
125
|
...defaultPropsValue,
|
|
126
|
-
...mergeWith({}, cloneDeep
|
|
126
|
+
...mergeWith({}, cloneDeep(this.state.propsValueMap[type] || {}), data)
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
hasPropsValue(type) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import BaseService from "./BaseService.js";
|
|
2
1
|
import serialize from "serialize-javascript";
|
|
2
|
+
import BaseService from "./BaseService.js";
|
|
3
3
|
// packages/editor/src/sdk/services/WebStorage.ts
|
|
4
4
|
var Protocol = /* @__PURE__ */ function(Protocol) {
|
|
5
5
|
Protocol["OBJECT"] = "object";
|
package/dist/es/sdk/utils/dep.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isIncludeDataSource } from "../../utils/editor.js";
|
|
2
|
-
import { isValueIncludeDataSource } from "@tmagic/utils";
|
|
3
1
|
import { DepTargetType, NODE_CONDS_KEY, NodeType, createCodeBlockTarget, createDataSourceCondTarget, createDataSourceMethodTarget, createDataSourceTarget } from "@tmagic/core";
|
|
2
|
+
import { isValueIncludeDataSource } from "@tmagic/utils";
|
|
3
|
+
import { isIncludeDataSource } from "../../utils/editor.js";
|
|
4
4
|
// packages/editor/src/sdk/utils/dep.ts
|
|
5
5
|
/** 数据源依赖类型 -> 写回 root 的字段 */
|
|
6
6
|
var DEPS_KEY = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { generatePageNameByApp, getInitPositionStyle } from "../../utils/editor.js";
|
|
2
|
-
import { calcValueByFontsize, getElById, isPage, isPageOrFragment } from "@tmagic/utils";
|
|
3
|
-
import { NodeType } from "@tmagic/core";
|
|
4
1
|
import { isEmpty } from "lodash-es";
|
|
2
|
+
import { NodeType } from "@tmagic/core";
|
|
3
|
+
import { calcValueByFontsize, getElById, isPage, isPageOrFragment } from "@tmagic/utils";
|
|
4
|
+
import { generatePageNameByApp, getInitPositionStyle } from "../../utils/editor.js";
|
|
5
5
|
// packages/editor/src/sdk/utils/operator.ts
|
|
6
6
|
/**
|
|
7
7
|
* 粘贴前置操作:返回分配了新id以及校准了坐标的配置
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isPage, isPageFragment, isPageOrFragment, toLine, traverseNode } from "@tmagic/utils";
|
|
1
|
+
import { cloneDeep, mergeWith } from "lodash-es";
|
|
3
2
|
import { NodeType } from "@tmagic/core";
|
|
4
|
-
import { cloneDeep as cloneDeep$1, mergeWith } from "lodash-es";
|
|
5
3
|
import { builtInFields, registerBuiltInFields, validateForm } from "@tmagic/form/headless";
|
|
4
|
+
import { isPage, isPageFragment, isPageOrFragment, toLine, traverseNode } from "@tmagic/utils";
|
|
5
|
+
import { editorNodeMergeCustomizer } from "../../utils/editor.js";
|
|
6
6
|
// packages/editor/src/sdk/validate/index.ts
|
|
7
7
|
/**
|
|
8
8
|
* @fileoverview DSL 校验:
|
|
@@ -228,7 +228,7 @@ var createValidator = (ctx) => {
|
|
|
228
228
|
if (old.type === NodeType.ROOT) return { issues: [] };
|
|
229
229
|
const issues = [];
|
|
230
230
|
if (node.type && node.type !== old.type) issues.push(nodeIssue(node.id, `不允许修改节点类型(${old.type} -> ${node.type})`, { path: "type" }));
|
|
231
|
-
const merged = replace ? cloneDeep
|
|
231
|
+
const merged = replace ? cloneDeep(node) : mergeWith(cloneDeep(ctx.reactivity.toRaw(old)), cloneDeep(node), editorNodeMergeCustomizer);
|
|
232
232
|
issues.push(...checkExistingNodeStructure(merged), ...await checkNodeProps(merged));
|
|
233
233
|
return {
|
|
234
234
|
id: node.id,
|
package/dist/es/sdk/wiring.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { addDataSourceTargets, classifyUpdatedNodes, getDataSourceRecollectTypes, removeDataSourceTargets, removeTargetDeps, resetDepTargets, writeTargetDeps } from "./utils/dep.js";
|
|
2
|
-
import { getNodes, isPage } from "@tmagic/utils";
|
|
3
1
|
import { DepTargetType, NodeType, createCodeBlockTarget } from "@tmagic/core";
|
|
2
|
+
import { getNodes, isPage } from "@tmagic/utils";
|
|
3
|
+
import { addDataSourceTargets, classifyUpdatedNodes, getDataSourceRecollectTypes, removeDataSourceTargets, removeTargetDeps, resetDepTargets, writeTargetDeps } from "./utils/dep.js";
|
|
4
4
|
// packages/editor/src/sdk/wiring.ts
|
|
5
5
|
var pendingSelects = /* @__PURE__ */ new WeakMap();
|
|
6
6
|
/** root 变化后自动选中节点是异步的,需要时可以等它完成 */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import KeyController from "keycon";
|
|
2
|
+
import { isPageOrFragment } from "@tmagic/utils";
|
|
1
3
|
import BaseService from "../sdk/services/BaseService.js";
|
|
2
4
|
import { KeyBindingCommand } from "../type.js";
|
|
3
5
|
import { editorService } from "./sdk-instance.js";
|
|
4
6
|
import ui_default from "./ui.js";
|
|
5
|
-
import { isPageOrFragment } from "@tmagic/utils";
|
|
6
|
-
import KeyController from "keycon";
|
|
7
7
|
// packages/editor/src/services/keybinding.ts
|
|
8
8
|
var Keybinding = class extends BaseService {
|
|
9
9
|
ctrlKey = /mac os x/.test(navigator.userAgent.toLowerCase()) ? "meta" : "ctrl";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { shallowReactive } from "vue";
|
|
2
|
+
import { getIdFromEl } from "@tmagic/utils";
|
|
1
3
|
import { useStage } from "../hooks/use-stage.js";
|
|
2
4
|
import BaseService from "../sdk/services/BaseService.js";
|
|
3
5
|
import { editorService } from "./sdk-instance.js";
|
|
4
|
-
import { getIdFromEl } from "@tmagic/utils";
|
|
5
|
-
import { shallowReactive } from "vue";
|
|
6
6
|
// packages/editor/src/services/stageOverlay.ts
|
|
7
7
|
var canUsePluginMethods = {
|
|
8
8
|
async: [],
|
package/dist/es/services/ui.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { shallowReactive } from "vue";
|
|
2
|
+
import { convertToNumber } from "@tmagic/utils";
|
|
1
3
|
import BaseService from "../sdk/services/BaseService.js";
|
|
2
4
|
import { Protocol } from "../sdk/services/WebStorage.js";
|
|
3
5
|
import { editorService, storageService } from "./sdk-instance.js";
|
|
4
6
|
import "../utils/const.js";
|
|
5
|
-
import { convertToNumber } from "@tmagic/utils";
|
|
6
|
-
import { shallowReactive } from "vue";
|
|
7
7
|
// packages/editor/src/services/ui.ts
|
|
8
8
|
var state = shallowReactive({
|
|
9
9
|
uiSelectMode: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getEditorConfig } from "./config.js";
|
|
2
|
-
import { defineFormConfig, defineFormItem } from "@tmagic/form";
|
|
3
1
|
import { tMagicMessage } from "@tmagic/design";
|
|
2
|
+
import { defineFormConfig, defineFormItem } from "@tmagic/form";
|
|
3
|
+
import { getEditorConfig } from "./config.js";
|
|
4
4
|
// packages/editor/src/utils/code-block.ts
|
|
5
5
|
/** 默认的"参数类型"列配置:数字 / 字符串 / 组件 三选一。 */
|
|
6
6
|
var defaultParamColConfig = () => defineFormItem({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { COPY_STORAGE_KEY } from "./editor.js";
|
|
2
|
-
import { calcValueByFontsize, isPage, isPageOrFragment } from "@tmagic/utils";
|
|
3
|
-
import { NodeType, cloneDeep } from "@tmagic/core";
|
|
4
1
|
import { computed, markRaw } from "vue";
|
|
5
2
|
import { CopyDocument, Delete, DocumentCopy } from "@element-plus/icons-vue";
|
|
3
|
+
import { NodeType, cloneDeep } from "@tmagic/core";
|
|
4
|
+
import { calcValueByFontsize, isPage, isPageOrFragment } from "@tmagic/utils";
|
|
5
|
+
import { COPY_STORAGE_KEY } from "./editor.js";
|
|
6
6
|
// packages/editor/src/utils/content-menu.ts
|
|
7
7
|
/**
|
|
8
8
|
* 共享的右键菜单项构造器(画布 ViewerMenu 与图层树 LayerMenu 共用)。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { dataSourceTemplateRegExp, getDefaultValueFromFields, getKeysArray, isArrayIndex, isNumber, isObject } from "@tmagic/utils";
|
|
1
2
|
import base_default from "./formConfigs/base.js";
|
|
2
3
|
import http_default from "./formConfigs/http.js";
|
|
3
|
-
import { dataSourceTemplateRegExp, getKeysArray, isArrayIndex, isNumber } from "@tmagic/utils";
|
|
4
4
|
// packages/editor/src/utils/data-source/index.ts
|
|
5
5
|
var dataSourceFormConfig = {
|
|
6
6
|
type: "tab",
|
|
@@ -173,18 +173,101 @@ var getDisplayField = (dataSources, key) => {
|
|
|
173
173
|
});
|
|
174
174
|
return displayState;
|
|
175
175
|
};
|
|
176
|
-
|
|
176
|
+
/** 编辑器里这份数据源当前用于展示的数据:优先 useInEditor 的 mock,否则用字段默认值 */
|
|
177
|
+
var getDataSourceEditorData = (ds) => {
|
|
178
|
+
const mock = ds.mocks?.find((item) => item.useInEditor)?.data;
|
|
179
|
+
if (mock && isObject(mock)) return mock;
|
|
180
|
+
return getDefaultValueFromFields(ds.fields || []);
|
|
181
|
+
};
|
|
182
|
+
var cloneSchemaOptions = (nodes) => nodes.filter((node) => !node.arrayIndex).map((node) => ({
|
|
183
|
+
label: node.label,
|
|
184
|
+
value: node.value,
|
|
185
|
+
fieldType: node.fieldType,
|
|
186
|
+
...node.children?.length ? { children: cloneSchemaOptions(node.children) } : {}
|
|
187
|
+
}));
|
|
188
|
+
var cloneOptions = (nodes) => nodes.map((node) => ({
|
|
189
|
+
label: node.label,
|
|
190
|
+
value: node.value,
|
|
191
|
+
fieldType: node.fieldType,
|
|
192
|
+
...node.arrayIndex ? { arrayIndex: true } : {},
|
|
193
|
+
...node.children?.length ? { children: cloneOptions(node.children) } : {}
|
|
194
|
+
}));
|
|
195
|
+
/**
|
|
196
|
+
* 已选路径对不上选项时补节点,否则级联框输入框是空的。
|
|
197
|
+
* 数组字段后面缺的下标会补上;只展示下标时,已保存的元素字段路径(`array.xxx`)也会补回。
|
|
198
|
+
* 对象上的数字字段名仍然按字段处理。
|
|
199
|
+
*/
|
|
200
|
+
var ensureSelectedArrayIndices = (options, fieldPath) => {
|
|
201
|
+
let level = options;
|
|
202
|
+
let parent;
|
|
203
|
+
for (let i = 0; i < fieldPath.length; i++) {
|
|
204
|
+
const segment = `${fieldPath[i]}`;
|
|
205
|
+
let node = level.find((opt) => `${opt.value}` === segment);
|
|
206
|
+
if (!node && parent?.fieldType === "array") {
|
|
207
|
+
if (isArrayIndex(segment)) {
|
|
208
|
+
const fromSchema = cloneSchemaOptions(level);
|
|
209
|
+
const fromIndex = cloneSchemaOptions(level.find((item) => item.arrayIndex)?.children || []);
|
|
210
|
+
const children = fromSchema.length ? fromSchema : fromIndex;
|
|
211
|
+
node = {
|
|
212
|
+
label: `[${segment}]`,
|
|
213
|
+
value: Number(segment),
|
|
214
|
+
arrayIndex: true,
|
|
215
|
+
...children.length ? { children } : {}
|
|
216
|
+
};
|
|
217
|
+
level.push(node);
|
|
218
|
+
} else {
|
|
219
|
+
node = cloneOptions(level.find((item) => item.arrayIndex)?.children || []).find((item) => !item.arrayIndex && `${item.value}` === segment);
|
|
220
|
+
if (node) level.push(node);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (!node) return;
|
|
224
|
+
parent = node;
|
|
225
|
+
if (i === fieldPath.length - 1) return;
|
|
226
|
+
if (!node.children) node.children = [];
|
|
227
|
+
level = node.children;
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
/** 数组下标固定提供 0–19,不随 mock 或默认值的长度变化 */
|
|
231
|
+
var ARRAY_INDEX_COUNT = 20;
|
|
232
|
+
var appendArrayIndexOptions = (field, dataSourceFieldType, typeSet, includesAny, context) => {
|
|
233
|
+
const elementFields = field.fields;
|
|
234
|
+
const taken = new Set((elementFields || []).map((item) => item.name));
|
|
235
|
+
const elementType = elementFields?.length ? "object" : "any";
|
|
236
|
+
if (!elementFields?.length && !includesAny) return [];
|
|
237
|
+
const children = getCascaderOptionsFromFields(elementFields, dataSourceFieldType, {}, context);
|
|
238
|
+
if (!(includesAny || typeSet.has(elementType)) && !children.length) return [];
|
|
239
|
+
const indexNodes = [];
|
|
240
|
+
for (let index = 0; index < ARRAY_INDEX_COUNT; index++) {
|
|
241
|
+
const name = `${index}`;
|
|
242
|
+
if (taken.has(name)) continue;
|
|
243
|
+
indexNodes.push({
|
|
244
|
+
label: `[${index}]`,
|
|
245
|
+
value: index,
|
|
246
|
+
arrayIndex: true,
|
|
247
|
+
...children.length ? { children } : {}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
return indexNodes;
|
|
251
|
+
};
|
|
252
|
+
var getCascaderOptionsFromFields = (fields = [], dataSourceFieldType = ["any"], data, context = {}) => {
|
|
177
253
|
const typeSet = new Set(dataSourceFieldType.length ? dataSourceFieldType : ["any"]);
|
|
178
254
|
const includesAny = typeSet.has("any");
|
|
179
255
|
const result = [];
|
|
180
256
|
for (const field of fields) {
|
|
181
257
|
const fieldType = field.type || "any";
|
|
182
258
|
const isContainerType = fieldType === "any" || fieldType === "array" || fieldType === "object";
|
|
183
|
-
const
|
|
259
|
+
const showElementFields = fieldType !== "array" || context.directArrayElements !== false;
|
|
260
|
+
const nestedData = data ? {} : void 0;
|
|
261
|
+
let children = isContainerType && showElementFields ? getCascaderOptionsFromFields(field.fields, dataSourceFieldType, nestedData, context) : [];
|
|
262
|
+
if (fieldType === "array" && data) {
|
|
263
|
+
const indexNodes = appendArrayIndexOptions(field, dataSourceFieldType, typeSet, includesAny, context);
|
|
264
|
+
children = [...children, ...indexNodes];
|
|
265
|
+
}
|
|
184
266
|
if (includesAny || typeSet.has(fieldType) || isContainerType && children.length) result.push({
|
|
185
267
|
label: `${field.title || field.name}(${field.type})`,
|
|
186
268
|
value: field.name,
|
|
187
|
-
children
|
|
269
|
+
children,
|
|
270
|
+
fieldType
|
|
188
271
|
});
|
|
189
272
|
}
|
|
190
273
|
return result;
|
|
@@ -256,4 +339,4 @@ var getFieldType = (ds, fieldNames) => {
|
|
|
256
339
|
if (!ok || untypedArrayElement) return "";
|
|
257
340
|
return field?.type || "";
|
|
258
341
|
};
|
|
259
|
-
export { getCascaderOptionsFromFields, getDisplayField, getFieldType, getFormConfig, getFormValue, resolveFieldByPath };
|
|
342
|
+
export { ensureSelectedArrayIndices, getCascaderOptionsFromFields, getDataSourceEditorData, getDisplayField, getFieldType, getFormConfig, getFormValue, resolveFieldByPath };
|
package/dist/es/utils/editor.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { LayerOffset, Layout } from "../type.js";
|
|
2
|
-
import { isFixed } from "../sdk/utils/position.js";
|
|
3
|
-
import { calcValueByFontsize, getElById, getNodePath, isNumber, isPage, isPageFragment, isPop, isValueIncludeDataSource } from "@tmagic/utils";
|
|
4
|
-
import { NODE_CONDS_KEY, Target, Watcher } from "@tmagic/core";
|
|
5
|
-
import { cloneDeep as cloneDeep$1, get, isObject } from "lodash-es";
|
|
6
1
|
import { detailedDiff } from "deep-object-diff";
|
|
2
|
+
import { cloneDeep, get, isObject } from "lodash-es";
|
|
7
3
|
import serialize from "serialize-javascript";
|
|
4
|
+
import { NODE_CONDS_KEY, Target, Watcher } from "@tmagic/core";
|
|
5
|
+
import { calcValueByFontsize, getElById, getNodePath, isNumber, isPage, isPageFragment, isPop, isValueIncludeDataSource } from "@tmagic/utils";
|
|
6
|
+
import { LayerOffset, Layout } from "../type.js";
|
|
7
|
+
import { isFixed } from "../sdk/utils/position.js";
|
|
8
8
|
// packages/editor/src/utils/editor.ts
|
|
9
9
|
var COPY_STORAGE_KEY = "$MagicEditorCopyData";
|
|
10
10
|
var COPY_CODE_STORAGE_KEY = "$MagicEditorCopyCode";
|
|
@@ -202,6 +202,7 @@ var fixNodeLeft = (config, parent, doc) => {
|
|
|
202
202
|
if (el && parentEl) {
|
|
203
203
|
const calcParentOffsetWidth = calcValueByFontsize(doc, parentEl.offsetWidth);
|
|
204
204
|
const calcElOffsetWidth = calcValueByFontsize(doc, el.offsetWidth);
|
|
205
|
+
if (calcElOffsetWidth > calcParentOffsetWidth) return config.style.left;
|
|
205
206
|
if (calcElOffsetWidth + left > calcParentOffsetWidth) return calcParentOffsetWidth - calcElOffsetWidth;
|
|
206
207
|
}
|
|
207
208
|
return config.style.left;
|
|
@@ -309,7 +310,7 @@ var resolveSelectedNode = (config, getNodeInfoFn, rootId) => {
|
|
|
309
310
|
* @returns 处理后的节点配置(深拷贝)
|
|
310
311
|
*/
|
|
311
312
|
var toggleFixedPosition = async (dist, src, path, getLayoutFn) => {
|
|
312
|
-
const newConfig = cloneDeep
|
|
313
|
+
const newConfig = cloneDeep(dist);
|
|
313
314
|
if (!isPop(src) && newConfig.style?.position) {
|
|
314
315
|
if (isFixed(newConfig.style) && !isFixed(src.style || {})) newConfig.style = change2Fixed(newConfig, path);
|
|
315
316
|
else if (!isFixed(newConfig.style) && isFixed(src.style || {})) newConfig.style = await Fixed2Other(newConfig, path, getLayoutFn);
|
package/dist/es/utils/event.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, traverseNode } from "@tmagic/utils";
|
|
1
2
|
import { dataSourceService, editorService, eventsService } from "../services/sdk-instance.js";
|
|
2
3
|
import { getCascaderOptionsFromFields } from "./data-source/index.js";
|
|
3
|
-
import { DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, traverseNode } from "@tmagic/utils";
|
|
4
4
|
// packages/editor/src/utils/event.ts
|
|
5
5
|
/** 未显式传入 services 时使用浏览器端默认实例 */
|
|
6
6
|
var getDefaultServices = () => ({
|
package/dist/es/utils/history.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UndoRedo } from "./undo-redo.js";
|
|
2
|
-
import { guid } from "@tmagic/utils";
|
|
3
1
|
import { cloneDeep } from "lodash-es";
|
|
4
2
|
import serialize from "serialize-javascript";
|
|
3
|
+
import { guid } from "@tmagic/utils";
|
|
4
|
+
import { UndoRedo } from "./undo-redo.js";
|
|
5
5
|
// packages/editor/src/utils/history.ts
|
|
6
6
|
/**
|
|
7
7
|
* 「回滚」生成的新 step 简短描述。代码块 / 数据源共用。
|
|
@@ -64,6 +64,11 @@ var createStackStep = (id, payload) => {
|
|
|
64
64
|
extra: payload.extra
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* 把栈当前游标所在的记录标记为「已保存」,随后把栈裁剪到容量上限(见 {@link UndoRedo.trim})。
|
|
69
|
+
* 入栈与还原都不裁剪,只有保存后才收敛,避免用户在落库前丢掉可撤销的历史;
|
|
70
|
+
* initial 基线与「整体设置 root」产生的记录(`rootStep`)不会被裁掉。
|
|
71
|
+
*/
|
|
67
72
|
var markStackSaved = (undoRedo) => {
|
|
68
73
|
if (!undoRedo) return;
|
|
69
74
|
undoRedo.updateElements((element) => {
|
|
@@ -72,6 +77,7 @@ var markStackSaved = (undoRedo) => {
|
|
|
72
77
|
undoRedo.updateCurrentElement((element) => {
|
|
73
78
|
element.saved = true;
|
|
74
79
|
});
|
|
80
|
+
undoRedo.trim();
|
|
75
81
|
};
|
|
76
82
|
/**
|
|
77
83
|
* 把单个历史栈(页面 / 代码块 / 数据源 / 扩展类型)的步骤列表按"目标"做相邻合并:
|
|
@@ -183,20 +189,33 @@ var serializeStacks = (stacks) => {
|
|
|
183
189
|
*
|
|
184
190
|
* 与 {@link serializeStacks} 相反:当传入 `parse`(parseDSL)时,把每条 step 中以字符串形式存储的 `diff`
|
|
185
191
|
* 解析回真实对象(含函数);不含 `diff` 的元素(如通用栈)原样透传。
|
|
192
|
+
*
|
|
193
|
+
* 单个栈解析失败只丢弃该栈,其余栈照常还原:一条损坏的快照不应该让整份本地历史都不可用。
|
|
194
|
+
* 结构性损坏(`elementList` 不是数组)同样按空栈处理,交给 {@link UndoRedo.fromSerialized} 兜底。
|
|
195
|
+
* 全部栈都失败时抛出首个错误,避免调用方把「什么都没恢复」当成一次成功的还原。
|
|
186
196
|
*/
|
|
187
197
|
var deserializeStacks = (stacks = {}, parse) => {
|
|
188
198
|
const result = {};
|
|
199
|
+
let firstError;
|
|
200
|
+
let failedCount = 0;
|
|
189
201
|
Object.entries(stacks).forEach(([id, serialized]) => {
|
|
190
202
|
if (!serialized) return;
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
203
|
+
const source = Array.isArray(serialized.elementList) ? serialized.elementList : [];
|
|
204
|
+
try {
|
|
205
|
+
const elementList = parse ? source.map((step) => {
|
|
206
|
+
const { diff } = step;
|
|
207
|
+
return typeof diff === "string" ? Object.assign({}, step, { diff: parse(`(${diff})`) }) : step;
|
|
208
|
+
}) : source;
|
|
209
|
+
result[id] = UndoRedo.fromSerialized({
|
|
210
|
+
...serialized,
|
|
211
|
+
elementList
|
|
212
|
+
}, { isSavedStep: (element) => element.saved === true });
|
|
213
|
+
} catch (error) {
|
|
214
|
+
failedCount += 1;
|
|
215
|
+
firstError ??= error;
|
|
216
|
+
}
|
|
199
217
|
});
|
|
218
|
+
if (failedCount > 0 && Object.keys(result).length === 0) throw firstError;
|
|
200
219
|
return result;
|
|
201
220
|
};
|
|
202
221
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { toRaw } from "vue";
|
|
1
2
|
import { editorService, propsService } from "../services/sdk-instance.js";
|
|
2
3
|
import { beforePaste as beforePaste$1, getAddParent as getAddParent$1, getDefaultConfig as getDefaultConfig$1, getPositionInContainer as getPositionInContainer$1 } from "../sdk/utils/operator.js";
|
|
3
|
-
import { toRaw } from "vue";
|
|
4
4
|
// packages/editor/src/utils/operator.ts
|
|
5
5
|
var getContext = () => ({
|
|
6
6
|
editor: editorService,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isEqual, omit } from "lodash-es";
|
|
2
|
+
// packages/editor/src/utils/page.ts
|
|
3
|
+
/**
|
|
4
|
+
* 页面 id 和页面自身配置都没变,只是 items 换了顺序。
|
|
5
|
+
* 这种更新来自子节点排序,不是切页,也不是改页面配置。
|
|
6
|
+
*/
|
|
7
|
+
var isSamePageItemsReorder = (prev, next) => {
|
|
8
|
+
if (!prev || !next || `${prev.id}` !== `${next.id}`) return false;
|
|
9
|
+
if (!isEqual(omit(prev, "items"), omit(next, "items"))) return false;
|
|
10
|
+
const prevItems = prev.items ?? [];
|
|
11
|
+
const nextItems = next.items ?? [];
|
|
12
|
+
if (!prevItems.length || prevItems.length !== nextItems.length) return false;
|
|
13
|
+
const used = /* @__PURE__ */ new Set();
|
|
14
|
+
return nextItems.every((item) => {
|
|
15
|
+
const index = prevItems.findIndex((prevItem, itemIndex) => !used.has(itemIndex) && isEqual(prevItem, item));
|
|
16
|
+
if (index < 0) return false;
|
|
17
|
+
used.add(index);
|
|
18
|
+
return true;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export { isSamePageItemsReorder };
|
package/dist/es/utils/props.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { advancedTabConfig, arrayOptions, booleanOptions, displayTabConfig, eqOptions, eventTabConfig, fillConfig as fillConfig$1, getCondOpOptionsByFieldType, numberOptions, styleTabConfig } from "../sdk/utils/props.js";
|
|
2
1
|
import { tMagicMessage } from "@tmagic/design";
|
|
2
|
+
import { advancedTabConfig, arrayOptions, booleanOptions, displayTabConfig, eqOptions, eventTabConfig, fillConfig as fillConfig$1, getCondOpOptionsByFieldType, numberOptions, styleTabConfig } from "../sdk/utils/props.js";
|
|
3
3
|
// packages/editor/src/utils/props.ts
|
|
4
4
|
/** 浏览器端默认用 `navigator.clipboard` 复制,并用 `tMagicMessage` 提示 */
|
|
5
5
|
var copyTextToClipboard = (text) => navigator.clipboard.writeText(text);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { NodeType } from "@tmagic/core";
|
|
2
|
+
import { appendValidateSuggestion } from "@tmagic/design/headless";
|
|
3
|
+
import { MAX_SUGGESTION_OPTIONS, optionSuggestion, stringifyExampleValue, validateTypeMatch } from "@tmagic/form/headless";
|
|
4
|
+
import { DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, DATA_SOURCE_SET_DATA_METHOD_NAME, dataSourceTemplateRegExp, getKeysArray, isArrayIndex, removeDataSourceFieldPrefix } from "@tmagic/utils";
|
|
1
5
|
import { codeBlockService, dataSourceService, editorService } from "../services/sdk-instance.js";
|
|
2
6
|
import { getFieldType, resolveFieldByPath } from "./data-source/index.js";
|
|
3
7
|
import { arrayOptions, booleanOptions, eqOptions, getCondOpOptionsByFieldType, numberOptions } from "../sdk/utils/props.js";
|
|
4
|
-
import { DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, DATA_SOURCE_SET_DATA_METHOD_NAME, dataSourceTemplateRegExp, getKeysArray, isArrayIndex, removeDataSourceFieldPrefix } from "@tmagic/utils";
|
|
5
|
-
import { NodeType } from "@tmagic/core";
|
|
6
|
-
import { MAX_SUGGESTION_OPTIONS, optionSuggestion, stringifyExampleValue, validateTypeMatch } from "@tmagic/form/headless";
|
|
7
|
-
import { appendValidateSuggestion } from "@tmagic/design/headless";
|
|
8
8
|
// packages/editor/src/utils/type-match-rules.ts
|
|
9
9
|
/** 复用 form 的可选项建议文案;额外过滤 null / 空串,避免业务侧无效枚举污染提示。 */
|
|
10
10
|
var listSuggestion = (values) => optionSuggestion(values.filter((item) => item !== null && item !== ""));
|