@tmagic/editor 1.8.0-beta.2 → 1.8.0-beta.21
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 +43 -9
- package/dist/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +8 -4
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +22 -98
- package/dist/es/components/ContentMenu.vue_vue_type_script_setup_true_lang.js +32 -9
- package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +68 -17
- package/dist/es/components/Icon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/Resizer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ScrollBar.js +0 -1
- package/dist/es/components/ScrollBar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ScrollViewer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/SearchInput.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/SplitView.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ToolButton.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/es/components/Tree.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/TreeNode.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ViewForm.js +5 -0
- package/dist/es/components/ViewForm.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/es/editorProps.js +9 -1
- package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +16 -5
- package/dist/es/fields/CodeLink.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +81 -44
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +10 -3
- package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +7 -19
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +13 -6
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +11 -8
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +39 -12
- package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +11 -20
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +11 -6
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +30 -14
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +11 -4
- package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +38 -6
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +156 -155
- package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/PageFragmentSelect.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +8 -10
- package/dist/es/fields/StyleSetter/components/BackgroundPosition.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +28 -6
- package/dist/es/fields/StyleSetter/components/Box.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/Center.js +31 -0
- package/dist/es/fields/StyleSetter/icons/align-items/FlexEnd.js +31 -0
- package/dist/es/fields/StyleSetter/icons/align-items/FlexStart.js +31 -0
- package/dist/es/fields/StyleSetter/icons/align-items/SpaceAround.js +50 -0
- package/dist/es/fields/StyleSetter/icons/align-items/SpaceBetween.js +50 -0
- package/dist/es/fields/StyleSetter/icons/background-repeat/NoRepeat.js +7 -7
- package/dist/es/fields/StyleSetter/icons/background-repeat/Repeat.js +6 -3
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatX.js +29 -6
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatY.js +32 -6
- package/dist/es/fields/StyleSetter/icons/display/Block.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Flex.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Inline.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/InlineBlock.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/None.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/Column.js +11 -3
- package/dist/es/fields/StyleSetter/icons/flex-direction/ColumnReverse.js +11 -3
- package/dist/es/fields/StyleSetter/icons/flex-direction/Row.js +11 -3
- package/dist/es/fields/StyleSetter/icons/flex-direction/RowReverse.js +11 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/Center.js +17 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexEnd.js +19 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexStart.js +19 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceAround.js +37 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceBetween.js +33 -3
- package/dist/es/fields/StyleSetter/icons/text-align/Center.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Left.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Right.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +56 -30
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +7 -4
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +35 -26
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +76 -48
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +29 -23
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +7 -4
- package/dist/es/fields/UISelect.js +0 -1
- package/dist/es/fields/UISelect.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/hooks/use-code-block-edit.js +6 -3
- package/dist/es/hooks/use-compare-form.js +119 -0
- package/dist/es/hooks/use-data-source-edit.js +5 -2
- package/dist/es/hooks/use-stage.js +9 -4
- package/dist/es/icons/CenterIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/icons/CodeIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/icons/DatasourceIcon.js +17 -0
- package/dist/es/icons/FolderMinusIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/index.js +24 -10
- package/dist/es/initService.js +19 -13
- package/dist/es/layouts/AddPageBox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +24 -12
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +25 -18
- package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/es/layouts/NavMenuColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/Bucket.vue_vue_type_script_setup_true_lang.js +25 -38
- package/dist/es/layouts/history-list/BucketTab.js +5 -0
- package/dist/es/layouts/history-list/BucketTab.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/es/layouts/history-list/GroupRow.vue_vue_type_script_setup_true_lang.js +177 -88
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +139 -37
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +164 -107
- package/dist/es/layouts/history-list/InitialRow.vue_vue_type_script_setup_true_lang.js +44 -9
- package/dist/es/layouts/history-list/PageTab.vue_vue_type_script_setup_true_lang.js +49 -53
- package/dist/es/layouts/history-list/composables.js +138 -108
- package/dist/es/layouts/history-list/useHistoryList.js +56 -0
- package/dist/es/layouts/history-list/useHistoryRevert.js +317 -0
- package/dist/es/layouts/page-bar/AddButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageBar.vue_vue_type_script_setup_true_lang.js +5 -3
- package/dist/es/layouts/page-bar/PageBarScrollContainer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/Search.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +50 -7
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +33 -13
- package/dist/es/layouts/props-panel/use-style-panel.js +3 -2
- package/dist/es/layouts/sidebar/ComponentListPanel.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +26 -38
- package/dist/es/layouts/sidebar/code-block/CodeBlockList.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/es/layouts/sidebar/code-block/useContentMenu.js +19 -4
- package/dist/es/layouts/sidebar/data-source/DataSourceAddButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +23 -6
- package/dist/es/layouts/sidebar/data-source/DataSourceList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +27 -5
- package/dist/es/layouts/sidebar/data-source/useContentMenu.js +19 -4
- package/dist/es/layouts/sidebar/layer/LayerMenu.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/es/layouts/sidebar/layer/LayerNodeContent.js +5 -0
- package/dist/es/layouts/sidebar/layer/LayerNodeContent.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/es/layouts/sidebar/layer/LayerNodeTool.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/sidebar/layer/LayerPanel.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/es/layouts/sidebar/layer/use-click.js +3 -3
- package/dist/es/layouts/sidebar/layer/use-node-status.js +2 -2
- package/dist/es/layouts/workspace/Breadcrumb.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/Workspace.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js +9 -3
- package/dist/es/layouts/workspace/viewer/Stage.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/workspace/viewer/StageOverlay.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/ViewerMenu.vue_vue_type_script_setup_true_lang.js +16 -16
- package/dist/es/plugin.js +5 -2
- package/dist/es/services/codeBlock.js +137 -56
- package/dist/es/services/dataSource.js +122 -52
- package/dist/es/services/dep.js +162 -41
- package/dist/es/services/editor.js +613 -179
- package/dist/es/services/events.js +2 -2
- package/dist/es/services/history.js +350 -386
- package/dist/es/services/keybinding.js +6 -6
- package/dist/es/services/props.js +3 -2
- package/dist/es/services/storage.js +2 -2
- package/dist/es/services/ui.js +10 -2
- package/dist/es/style.css +549 -113
- package/dist/es/utils/config.js +4 -1
- package/dist/es/utils/const.js +2 -2
- package/dist/es/utils/content-menu.js +19 -11
- package/dist/es/utils/data-source/index.js +34 -11
- package/dist/es/utils/dep/collect-worker-client.js +114 -0
- package/dist/es/utils/dep/idle-task.js +70 -22
- package/dist/es/utils/dep/worker.js +1 -1
- package/dist/es/utils/editor.js +103 -49
- package/dist/es/utils/event.js +135 -0
- package/dist/es/utils/history.js +220 -0
- package/dist/es/utils/indexed-db.js +86 -0
- package/dist/es/utils/monaco-editor.js +22 -6
- package/dist/es/utils/operator.js +2 -2
- package/dist/es/utils/props.js +114 -33
- package/dist/es/utils/type-match-rules.js +367 -0
- package/dist/es/utils/undo-redo.js +60 -1
- package/dist/style.css +549 -113
- package/dist/themes/magic-admin.css +3028 -0
- package/dist/tmagic-editor.umd.cjs +14403 -10121
- package/package.json +8 -8
- package/src/Editor.vue +43 -2
- package/src/components/CodeBlockEditor.vue +3 -0
- package/src/components/CompareForm.vue +18 -146
- package/src/components/ContentMenu.vue +44 -8
- package/src/components/FloatingBox.vue +84 -9
- package/src/components/ScrollBar.vue +0 -67
- package/src/components/ToolButton.vue +2 -2
- package/src/components/ViewForm.vue +55 -0
- package/src/editorProps.ts +30 -0
- package/src/fields/Code.vue +10 -2
- package/src/fields/CodeLink.vue +2 -5
- package/src/fields/CodeSelect.vue +54 -40
- package/src/fields/CodeSelectCol.vue +8 -1
- package/src/fields/CondOpSelect.vue +2 -24
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +16 -2
- package/src/fields/DataSourceFieldSelect/Index.vue +14 -5
- package/src/fields/DataSourceFields.vue +42 -8
- package/src/fields/DataSourceInput.vue +10 -28
- package/src/fields/DataSourceMethodSelect.vue +9 -4
- package/src/fields/DataSourceMethods.vue +42 -21
- package/src/fields/DataSourceMocks.vue +3 -0
- package/src/fields/DisplayConds.vue +18 -1
- package/src/fields/EventSelect.vue +152 -166
- package/src/fields/StyleSetter/Index.vue +3 -12
- package/src/fields/StyleSetter/components/Border.vue +15 -6
- 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.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 +99 -55
- package/src/fields/StyleSetter/pro/Border.vue +9 -11
- package/src/fields/StyleSetter/pro/Font.vue +66 -64
- package/src/fields/StyleSetter/pro/Layout.vue +211 -139
- package/src/fields/StyleSetter/pro/Position.vue +69 -67
- package/src/fields/StyleSetter/pro/Transform.vue +23 -25
- package/src/fields/UISelect.vue +0 -12
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-code-block-edit.ts +4 -3
- package/src/hooks/use-compare-form.ts +187 -0
- package/src/hooks/use-data-source-edit.ts +2 -2
- package/src/hooks/use-stage.ts +5 -3
- package/src/icons/DatasourceIcon.vue +7 -0
- package/src/index.ts +12 -0
- package/src/initService.ts +26 -16
- package/src/layouts/CodeEditor.vue +34 -11
- package/src/layouts/Framework.vue +15 -8
- package/src/layouts/NavMenu.vue +3 -3
- package/src/layouts/history-list/Bucket.vue +33 -41
- package/src/layouts/history-list/BucketTab.vue +72 -0
- package/src/layouts/history-list/GroupRow.vue +190 -93
- package/src/layouts/history-list/HistoryDiffDialog.vue +169 -90
- package/src/layouts/history-list/HistoryListPanel.vue +191 -95
- package/src/layouts/history-list/InitialRow.vue +38 -8
- package/src/layouts/history-list/PageTab.vue +67 -43
- package/src/layouts/history-list/composables.ts +239 -125
- package/src/layouts/history-list/useHistoryList.ts +60 -0
- package/src/layouts/history-list/useHistoryRevert.ts +425 -0
- package/src/layouts/page-bar/PageBar.vue +4 -2
- package/src/layouts/props-panel/FormPanel.vue +72 -6
- package/src/layouts/props-panel/PropsPanel.vue +62 -18
- package/src/layouts/props-panel/use-style-panel.ts +4 -3
- package/src/layouts/sidebar/ComponentListPanel.vue +10 -6
- package/src/layouts/sidebar/Sidebar.vue +13 -6
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +5 -5
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +5 -2
- package/src/layouts/sidebar/code-block/useContentMenu.ts +14 -2
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +34 -2
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +29 -4
- package/src/layouts/sidebar/data-source/useContentMenu.ts +14 -2
- package/src/layouts/sidebar/layer/LayerMenu.vue +21 -13
- package/src/layouts/sidebar/layer/LayerNodeContent.vue +57 -0
- package/src/layouts/sidebar/layer/LayerNodeTool.vue +7 -4
- package/src/layouts/sidebar/layer/LayerPanel.vue +4 -1
- package/src/layouts/sidebar/layer/use-click.ts +3 -3
- package/src/layouts/sidebar/layer/use-node-status.ts +2 -2
- package/src/layouts/workspace/viewer/NodeListMenu.vue +4 -1
- package/src/layouts/workspace/viewer/Stage.vue +1 -1
- package/src/layouts/workspace/viewer/ViewerMenu.vue +15 -15
- package/src/plugin.ts +6 -3
- package/src/services/codeBlock.ts +152 -47
- package/src/services/dataSource.ts +120 -41
- package/src/services/dep.ts +292 -47
- package/src/services/editor.ts +820 -224
- package/src/services/events.ts +3 -3
- package/src/services/history.ts +449 -412
- package/src/services/keybinding.ts +6 -6
- package/src/services/ui.ts +33 -5
- 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 +70 -1
- package/src/theme/floating-box.scss +9 -1
- package/src/theme/framework.scss +4 -1
- package/src/theme/history-list-panel.scss +157 -23
- package/src/theme/layer-node-content.scss +14 -0
- package/src/theme/nav-menu.scss +5 -1
- package/src/theme/page-bar.scss +0 -4
- package/src/theme/props-panel.scss +5 -4
- package/src/theme/scroll-bar.scss +64 -0
- package/src/theme/style-setter/border.scss +17 -5
- package/src/theme/theme.scss +4 -0
- package/src/theme/themes/magic-admin/index.scss +214 -0
- package/src/theme/ui-select.scss +9 -0
- package/src/type.ts +668 -124
- package/src/utils/config.ts +9 -1
- package/src/utils/const.ts +3 -2
- package/src/utils/content-menu.ts +20 -11
- package/src/utils/data-source/index.ts +32 -12
- package/src/utils/dep/collect-worker-client.ts +149 -0
- package/src/utils/dep/idle-task.ts +104 -35
- package/src/utils/dep/worker.ts +113 -9
- package/src/utils/editor.ts +166 -60
- package/src/utils/event.ts +237 -0
- package/src/utils/history.ts +286 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/indexed-db.ts +122 -0
- package/src/utils/monaco-editor.ts +27 -0
- package/src/utils/operator.ts +2 -2
- package/src/utils/props.ts +114 -11
- package/src/utils/type-match-rules.ts +684 -0
- package/src/utils/undo-redo.ts +88 -0
- package/types/index.d.ts +1990 -517
- package/dist/es/layouts/history-list/CodeBlockTab.js +0 -5
- package/dist/es/layouts/history-list/CodeBlockTab.vue_vue_type_script_setup_true_lang.js +0 -62
- package/dist/es/layouts/history-list/DataSourceTab.js +0 -5
- package/dist/es/layouts/history-list/DataSourceTab.vue_vue_type_script_setup_true_lang.js +0 -62
- package/src/layouts/history-list/CodeBlockTab.vue +0 -61
- package/src/layouts/history-list/DataSourceTab.vue +0 -61
|
@@ -87,70 +87,3 @@ const scrollBy = (delta: number) => {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
</script>
|
|
90
|
-
|
|
91
|
-
<style lang="scss">
|
|
92
|
-
.m-editor-scroll-bar {
|
|
93
|
-
position: absolute;
|
|
94
|
-
background-color: transparent;
|
|
95
|
-
opacity: 0.3;
|
|
96
|
-
transition:
|
|
97
|
-
background-color 0.2s linear,
|
|
98
|
-
opacity 0.2s linear;
|
|
99
|
-
|
|
100
|
-
.m-editor-scroll-bar-thumb {
|
|
101
|
-
background-color: #aaa;
|
|
102
|
-
border-radius: 6px;
|
|
103
|
-
position: absolute;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
&.horizontal {
|
|
107
|
-
width: 100%;
|
|
108
|
-
height: 15px;
|
|
109
|
-
bottom: 0;
|
|
110
|
-
|
|
111
|
-
.m-editor-scroll-bar-thumb {
|
|
112
|
-
height: 6px;
|
|
113
|
-
transition:
|
|
114
|
-
background-color 0.2s linear,
|
|
115
|
-
height 0.2s ease-in-out;
|
|
116
|
-
bottom: 2px;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
&.vertical {
|
|
121
|
-
height: 100%;
|
|
122
|
-
width: 15px;
|
|
123
|
-
right: 5px;
|
|
124
|
-
|
|
125
|
-
.m-editor-scroll-bar-thumb {
|
|
126
|
-
width: 6px;
|
|
127
|
-
transition:
|
|
128
|
-
background-color 0.2s linear,
|
|
129
|
-
width 0.2s ease-in-out;
|
|
130
|
-
right: 2px;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
&:hover,
|
|
135
|
-
&:focus {
|
|
136
|
-
background-color: #eee;
|
|
137
|
-
opacity: 0.9;
|
|
138
|
-
|
|
139
|
-
.m-editor-scroll-bar-thumb {
|
|
140
|
-
background-color: #999;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
&.horizontal {
|
|
144
|
-
.m-editor-scroll-bar-thumb {
|
|
145
|
-
height: 11px;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
&.vertical {
|
|
150
|
-
.m-editor-scroll-bar-thumb {
|
|
151
|
-
width: 11px;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
</style>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
<template v-else-if="data.type === 'button'">
|
|
15
15
|
<TMagicTooltip v-if="data.tooltip" effect="dark" placement="bottom-start" :content="data.tooltip">
|
|
16
|
-
<TMagicButton size="small" link :disabled="disabled">
|
|
16
|
+
<TMagicButton size="small" link :disabled="disabled" v-bind="data.buttonProps || {}">
|
|
17
17
|
<template #icon v-if="data.icon">
|
|
18
18
|
<MIcon :icon="data.icon"></MIcon>
|
|
19
19
|
</template>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</TMagicButton>
|
|
22
22
|
</TMagicTooltip>
|
|
23
23
|
|
|
24
|
-
<TMagicButton v-else size="small" link :disabled="disabled" :title="data.text">
|
|
24
|
+
<TMagicButton v-else size="small" link :disabled="disabled" :title="data.text" v-bind="data.buttonProps || {}">
|
|
25
25
|
<template #icon v-if="data.icon">
|
|
26
26
|
<MIcon :icon="data.icon"></MIcon>
|
|
27
27
|
</template>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="m-editor-view-form-wrapper" :style="wrapperStyle">
|
|
3
|
+
<MForm
|
|
4
|
+
v-if="config.length"
|
|
5
|
+
ref="form"
|
|
6
|
+
class="m-editor-view-form"
|
|
7
|
+
:config="config"
|
|
8
|
+
:init-values="currentValues"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
:label-width="labelWidth"
|
|
11
|
+
:extend-state="mergedExtendState"
|
|
12
|
+
:size="size"
|
|
13
|
+
></MForm>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
import { type Ref, type ShallowRef } from 'vue';
|
|
19
|
+
|
|
20
|
+
import { type FormConfig, MForm } from '@tmagic/form';
|
|
21
|
+
|
|
22
|
+
import { useCompareForm } from '@editor/hooks/use-compare-form';
|
|
23
|
+
import type { CompareFormBaseProps } from '@editor/type';
|
|
24
|
+
|
|
25
|
+
defineOptions({
|
|
26
|
+
name: 'MEditorViewForm',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const props = withDefaults(
|
|
30
|
+
defineProps<
|
|
31
|
+
CompareFormBaseProps & {
|
|
32
|
+
/** 是否禁用表单(默认只读展示)。 */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
>(),
|
|
36
|
+
{
|
|
37
|
+
category: 'node',
|
|
38
|
+
labelWidth: '120px',
|
|
39
|
+
disabled: true,
|
|
40
|
+
// extendState 的默认值由 useCompareForm 内部兜底(props.extendState ?? ...),此处无需重复提供
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const { config, currentValues, wrapperStyle, mergedExtendState, loadConfig, formRef } = useCompareForm(props);
|
|
45
|
+
|
|
46
|
+
defineExpose<{
|
|
47
|
+
form: ShallowRef<InstanceType<typeof MForm> | null>;
|
|
48
|
+
config: Ref<FormConfig>;
|
|
49
|
+
reload: () => Promise<void>;
|
|
50
|
+
}>({
|
|
51
|
+
form: formRef,
|
|
52
|
+
config,
|
|
53
|
+
reload: loadConfig,
|
|
54
|
+
});
|
|
55
|
+
</script>
|
package/src/editorProps.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { InjectionKey } from 'vue';
|
|
2
|
+
|
|
1
3
|
import type { DataSourceSchema, EventOption, Id, MApp, MNode, MPage, MPageFragment } from '@tmagic/core';
|
|
2
4
|
import type { FormConfig, FormState } from '@tmagic/form';
|
|
3
5
|
import StageCore, {
|
|
@@ -15,6 +17,7 @@ import type {
|
|
|
15
17
|
ComponentGroup,
|
|
16
18
|
CustomContentMenuFunction,
|
|
17
19
|
DatasourceTypeOption,
|
|
20
|
+
HistoryListExtraTab,
|
|
18
21
|
IsExpandableFunction,
|
|
19
22
|
MenuBarData,
|
|
20
23
|
MenuButton,
|
|
@@ -25,7 +28,17 @@ import type {
|
|
|
25
28
|
TreeNodeData,
|
|
26
29
|
} from './type';
|
|
27
30
|
|
|
31
|
+
/**
|
|
32
|
+
* 「属性配置表单校验」联动能力的 provide/inject 注入键。
|
|
33
|
+
* 使用 Symbol 避免与其它字符串键冲突,供 PropsPanel / FormPanel 注入判断校验失败时是否仍更新节点并记录错误。
|
|
34
|
+
*/
|
|
35
|
+
export const ENABLE_PROPS_FORM_VALIDATE: InjectionKey<boolean> = Symbol('enablePropsFormValidate');
|
|
36
|
+
|
|
28
37
|
export interface EditorProps {
|
|
38
|
+
/** 是否是大屏模拟器容器,大屏容器时,左侧属性面板会扩展为两列(正常3列),颜色表单不扩展两列等 */
|
|
39
|
+
isLargeStageContainer?: boolean;
|
|
40
|
+
|
|
41
|
+
theme?: string;
|
|
29
42
|
/** 页面初始值 */
|
|
30
43
|
modelValue?: MApp;
|
|
31
44
|
/** 左侧面板中的组件类型列表 */
|
|
@@ -69,6 +82,11 @@ export interface EditorProps {
|
|
|
69
82
|
containerHighlightDuration?: number;
|
|
70
83
|
/** 拖入画布中容器时,识别容器的操作类型 */
|
|
71
84
|
containerHighlightType?: ContainerHighlightType;
|
|
85
|
+
/**
|
|
86
|
+
* 是否仅在新增组件(从组件列表拖入新组件)时才启用识别容器,
|
|
87
|
+
* 开启后在画布中拖动已有组件不会识别容器,默认 false
|
|
88
|
+
*/
|
|
89
|
+
containerHighlightAddOnly?: boolean;
|
|
72
90
|
/** 画布大小 */
|
|
73
91
|
stageRect?: StageRect;
|
|
74
92
|
/** monaco editor 的配置 */
|
|
@@ -86,8 +104,15 @@ export interface EditorProps {
|
|
|
86
104
|
alwaysMultiSelect?: boolean;
|
|
87
105
|
/** 禁用页面片 */
|
|
88
106
|
disabledPageFragment?: boolean;
|
|
107
|
+
/** 禁用「非点击画布选中组件时(如从图层树、面包屑等外部选中),对选中区域做高亮闪烁提示」,默认 false(即默认开启闪烁) */
|
|
108
|
+
disabledFlashTip?: boolean;
|
|
89
109
|
/** 禁用双击在浮层中单独编辑选中组件 */
|
|
90
110
|
disabledStageOverlay?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* 是否启用「属性配置表单校验」联动能力:开启后属性/样式表单校验失败时仍更新节点,
|
|
113
|
+
* 并把错误信息集中记录到 editorService,用于组件树标红提示与保存拦截;默认 false(关闭)。
|
|
114
|
+
*/
|
|
115
|
+
enablePropsFormValidate?: boolean;
|
|
91
116
|
/** 禁用属性配置面板右下角显示源码的按钮 */
|
|
92
117
|
disabledShowSrc?: boolean;
|
|
93
118
|
/** 禁用数据源 */
|
|
@@ -125,6 +150,8 @@ export interface EditorProps {
|
|
|
125
150
|
/** 组件树节点双击前的钩子函数,返回 false 则阻止默认的双击行为 */
|
|
126
151
|
beforeLayerNodeDblclick?: (event: MouseEvent, data: TreeNodeData) => Promise<boolean | void> | boolean | void;
|
|
127
152
|
extendFormState?: (state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
153
|
+
/** 历史记录面板的自定义扩展 tab,追加在内置的页面/数据源/代码块 tab 之后 */
|
|
154
|
+
historyListExtraTabs?: HistoryListExtraTab[];
|
|
128
155
|
/** 页面顺序拖拽配置参数 */
|
|
129
156
|
pageBarSortOptions?: PageBarSortOptions;
|
|
130
157
|
/** 页面搜索函数 */
|
|
@@ -136,15 +163,18 @@ export const defaultEditorProps = {
|
|
|
136
163
|
disabledMultiSelect: false,
|
|
137
164
|
alwaysMultiSelect: false,
|
|
138
165
|
disabledPageFragment: false,
|
|
166
|
+
disabledFlashTip: false,
|
|
139
167
|
disabledStageOverlay: false,
|
|
140
168
|
containerHighlightClassName: CONTAINER_HIGHLIGHT_CLASS_NAME,
|
|
141
169
|
containerHighlightDuration: 800,
|
|
142
170
|
containerHighlightType: ContainerHighlightType.DEFAULT,
|
|
171
|
+
containerHighlightAddOnly: false,
|
|
143
172
|
disabledShowSrc: false,
|
|
144
173
|
disabledDataSource: false,
|
|
145
174
|
disabledCodeBlock: false,
|
|
146
175
|
componentGroupList: () => [],
|
|
147
176
|
datasourceList: () => [],
|
|
177
|
+
historyListExtraTabs: () => [],
|
|
148
178
|
menu: () => ({ left: [], right: [] }),
|
|
149
179
|
layerContentMenu: () => [],
|
|
150
180
|
stageContentMenu: () => [],
|
package/src/fields/Code.vue
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<MagicCodeEditor
|
|
3
|
+
v-if="!silentMode"
|
|
3
4
|
:height="config.height"
|
|
4
5
|
:type="diffMode ? 'diff' : undefined"
|
|
5
6
|
:init-values="diffMode ? (lastValues || {})[name] : model[name]"
|
|
@@ -17,9 +18,9 @@
|
|
|
17
18
|
</template>
|
|
18
19
|
|
|
19
20
|
<script lang="ts" setup>
|
|
20
|
-
import { computed } from 'vue';
|
|
21
|
+
import { computed, inject } from 'vue';
|
|
21
22
|
|
|
22
|
-
import type
|
|
23
|
+
import { type CodeConfig, type FieldProps, FORM_SILENT_MODE_KEY } from '@tmagic/form';
|
|
23
24
|
|
|
24
25
|
import MagicCodeEditor from '@editor/layouts/CodeEditor.vue';
|
|
25
26
|
|
|
@@ -27,6 +28,13 @@ defineOptions({
|
|
|
27
28
|
name: 'MFieldsVsCode',
|
|
28
29
|
});
|
|
29
30
|
|
|
31
|
+
/**
|
|
32
|
+
* 静默模式(submitForm/validateForm 隐藏挂载)下跳过 monaco 渲染:
|
|
33
|
+
* 校验由 FormItem 针对 model 中的值完成,与编辑器实例无关;本组件挂载无值副作用
|
|
34
|
+
* (save 仅由用户操作/编辑器内容变更触发),跳过可省去 monaco worker/model 的无谓实例化。
|
|
35
|
+
*/
|
|
36
|
+
const silentMode = inject(FORM_SILENT_MODE_KEY, false);
|
|
37
|
+
|
|
30
38
|
const emit = defineEmits<{
|
|
31
39
|
change: [value: string | any];
|
|
32
40
|
}>();
|
package/src/fields/CodeLink.vue
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
<script lang="ts" setup>
|
|
6
6
|
import { computed, reactive, watch } from 'vue';
|
|
7
|
-
import serialize from 'serialize-javascript';
|
|
8
7
|
|
|
9
8
|
import type { CodeLinkConfig, FieldProps, MLink } from '@tmagic/form';
|
|
10
9
|
|
|
11
10
|
import { getEditorConfig } from '@editor/utils/config';
|
|
11
|
+
import { serializeConfig } from '@editor/utils/editor';
|
|
12
12
|
|
|
13
13
|
defineOptions({
|
|
14
14
|
name: 'MFieldsCodeLink',
|
|
@@ -47,10 +47,7 @@ watch(
|
|
|
47
47
|
() => props.model[props.name],
|
|
48
48
|
(value) => {
|
|
49
49
|
modelValue.form = {
|
|
50
|
-
[props.name]:
|
|
51
|
-
space: 2,
|
|
52
|
-
unsafe: true,
|
|
53
|
-
}).replace(/"(\w+)":\s/g, '$1: '),
|
|
50
|
+
[props.name]: serializeConfig(value),
|
|
54
51
|
};
|
|
55
52
|
},
|
|
56
53
|
{
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="m-fields-code-select" :class="config.className">
|
|
3
|
-
<TMagicCard>
|
|
3
|
+
<TMagicCard :flat="config.flat">
|
|
4
4
|
<MContainer
|
|
5
5
|
:config="codeConfig"
|
|
6
6
|
:size="size"
|
|
7
|
+
class="code-select-content"
|
|
7
8
|
:prop="prop"
|
|
8
9
|
:disabled="disabled"
|
|
9
10
|
:is-compare="isCompareMode"
|
|
@@ -12,16 +13,20 @@
|
|
|
12
13
|
@change="changeHandler"
|
|
13
14
|
>
|
|
14
15
|
</MContainer>
|
|
16
|
+
<TMagicButton class="create-button fullWidth" :icon="Plus" :size="size" :disabled="disabled" @click="newHandler()"
|
|
17
|
+
>添加{{ config.text }}</TMagicButton
|
|
18
|
+
>
|
|
15
19
|
</TMagicCard>
|
|
16
20
|
</div>
|
|
17
21
|
</template>
|
|
18
22
|
|
|
19
23
|
<script lang="ts" setup>
|
|
20
24
|
import { computed, watch } from 'vue';
|
|
25
|
+
import { Plus } from '@element-plus/icons-vue';
|
|
21
26
|
import { isEmpty } from 'lodash-es';
|
|
22
27
|
|
|
23
28
|
import { HookCodeType, HookType } from '@tmagic/core';
|
|
24
|
-
import { TMagicCard } from '@tmagic/design';
|
|
29
|
+
import { TMagicButton, TMagicCard } from '@tmagic/design';
|
|
25
30
|
import type { CodeSelectConfig, ContainerChangeEventData, FieldProps, GroupListConfig } from '@tmagic/form';
|
|
26
31
|
import { MContainer } from '@tmagic/form';
|
|
27
32
|
|
|
@@ -53,12 +58,23 @@ const props = withDefaults(defineProps<FieldProps<CodeSelectConfig>>(), {});
|
|
|
53
58
|
* 仅当存在历史值时才启用对比,避免 lastValues 缺失时退化为「全部新增」的空对比。
|
|
54
59
|
*/
|
|
55
60
|
const isCompareMode = computed(() => Boolean(props.isCompare && props.lastValues));
|
|
56
|
-
|
|
61
|
+
const newHandler = () => {
|
|
62
|
+
const defaultCode = {
|
|
63
|
+
codeType: HookCodeType.CODE,
|
|
64
|
+
codeId: '',
|
|
65
|
+
};
|
|
66
|
+
const name = props.config.name || '';
|
|
67
|
+
const hookData = props.model[name]?.hookData || [];
|
|
68
|
+
emit('change', defaultCode, {
|
|
69
|
+
modifyKey: `hookData.${hookData.length}`,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
57
72
|
const codeConfig = computed<GroupListConfig>(() => ({
|
|
58
73
|
type: 'group-list',
|
|
59
74
|
name: 'hookData',
|
|
60
75
|
enableToggleMode: false,
|
|
61
76
|
expandAll: true,
|
|
77
|
+
addable: () => false,
|
|
62
78
|
title: (mForm, { model, index }: any) => {
|
|
63
79
|
if (model.codeType === HookCodeType.DATA_SOURCE_METHOD) {
|
|
64
80
|
if (Array.isArray(model.codeId)) {
|
|
@@ -81,46 +97,44 @@ const codeConfig = computed<GroupListConfig>(() => ({
|
|
|
81
97
|
|
|
82
98
|
return model.codeId || index;
|
|
83
99
|
},
|
|
100
|
+
titlePrefix: props.config.name === undefined ? undefined : String(props.config.name),
|
|
84
101
|
items: [
|
|
85
102
|
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
{ value: HookCodeType.DATA_SOURCE_METHOD, text: '数据源方法' },
|
|
95
|
-
],
|
|
96
|
-
defaultValue: 'code',
|
|
97
|
-
onChange: (_mForm, v: HookCodeType, { setModel }) => {
|
|
98
|
-
if (v === HookCodeType.DATA_SOURCE_METHOD) {
|
|
99
|
-
setModel('codeId', []);
|
|
100
|
-
} else {
|
|
101
|
-
setModel('codeId', '');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return v;
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
type: 'code-select-col',
|
|
109
|
-
name: 'codeId',
|
|
110
|
-
span: 18,
|
|
111
|
-
labelWidth: 0,
|
|
112
|
-
display: (_mForm, { model }) => model.codeType !== HookCodeType.DATA_SOURCE_METHOD,
|
|
113
|
-
notEditable: () => !codeBlockService.getEditStatus(),
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
type: 'data-source-method-select',
|
|
117
|
-
name: 'codeId',
|
|
118
|
-
span: 18,
|
|
119
|
-
labelWidth: 0,
|
|
120
|
-
display: (_mForm, { model }) => model.codeType === HookCodeType.DATA_SOURCE_METHOD,
|
|
121
|
-
notEditable: () => !dataSourceService.get('editable'),
|
|
122
|
-
},
|
|
103
|
+
text: '代码类型',
|
|
104
|
+
type: 'select',
|
|
105
|
+
name: 'codeType',
|
|
106
|
+
labelPosition: 'right',
|
|
107
|
+
rules: [{ typeMatch: true, trigger: 'change' }],
|
|
108
|
+
options: [
|
|
109
|
+
{ value: HookCodeType.CODE, text: '代码块' },
|
|
110
|
+
{ value: HookCodeType.DATA_SOURCE_METHOD, text: '数据源方法' },
|
|
123
111
|
],
|
|
112
|
+
defaultValue: HookCodeType.CODE,
|
|
113
|
+
onChange: (_mForm, v: HookCodeType, { setModel }) => {
|
|
114
|
+
if (v === HookCodeType.DATA_SOURCE_METHOD) {
|
|
115
|
+
setModel('codeId', []);
|
|
116
|
+
} else {
|
|
117
|
+
setModel('codeId', '');
|
|
118
|
+
}
|
|
119
|
+
return v;
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
type: 'code-select-col',
|
|
124
|
+
name: 'codeId',
|
|
125
|
+
text: '代码块',
|
|
126
|
+
rules: [{ typeMatch: true, trigger: 'change' }],
|
|
127
|
+
|
|
128
|
+
display: (_mForm, { model }) => model.codeType !== HookCodeType.DATA_SOURCE_METHOD,
|
|
129
|
+
notEditable: () => !codeBlockService.getEditStatus(),
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
type: 'data-source-method-select',
|
|
133
|
+
name: 'codeId',
|
|
134
|
+
text: '数据源字段',
|
|
135
|
+
rules: [{ typeMatch: true, trigger: 'change' }],
|
|
136
|
+
display: (_mForm, { model }) => model.codeType === HookCodeType.DATA_SOURCE_METHOD,
|
|
137
|
+
notEditable: () => !dataSourceService.get('editable'),
|
|
124
138
|
},
|
|
125
139
|
],
|
|
126
140
|
}));
|
|
@@ -107,10 +107,12 @@ const isCompareMode = computed(() => Boolean(props.isCompare && props.lastValues
|
|
|
107
107
|
|
|
108
108
|
const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
|
|
109
109
|
|
|
110
|
-
const
|
|
110
|
+
const codeBlockSidePanel = computed(() =>
|
|
111
111
|
(uiService.get('sideBarItems') || []).find((item) => item.$key === SideItemKey.CODE_BLOCK),
|
|
112
112
|
);
|
|
113
113
|
|
|
114
|
+
const hasCodeBlockSidePanel = computed(() => codeBlockSidePanel.value);
|
|
115
|
+
|
|
114
116
|
/**
|
|
115
117
|
* 根据代码块id获取代码块参数配置
|
|
116
118
|
* @param codeId 代码块ID
|
|
@@ -145,6 +147,7 @@ const selectConfig: SelectConfig = {
|
|
|
145
147
|
type: 'select',
|
|
146
148
|
name: props.name,
|
|
147
149
|
disabled: props.disabled,
|
|
150
|
+
text: props.config.text,
|
|
148
151
|
options: () => {
|
|
149
152
|
if (codeDsl.value) {
|
|
150
153
|
return map(codeDsl.value, (value, key) => ({
|
|
@@ -191,6 +194,10 @@ const onParamsChangeHandler = (value: any, eventData: ContainerChangeEventData)
|
|
|
191
194
|
};
|
|
192
195
|
|
|
193
196
|
const editCode = (id: string) => {
|
|
197
|
+
const sideBarItem = codeBlockSidePanel.value;
|
|
198
|
+
if (sideBarItem) {
|
|
199
|
+
uiService.set('sideBarActiveTabName', sideBarItem.text || sideBarItem.$key || SideItemKey.CODE_BLOCK);
|
|
200
|
+
}
|
|
194
201
|
eventBus?.emit('edit-code', id);
|
|
195
202
|
};
|
|
196
203
|
</script>
|
|
@@ -33,7 +33,7 @@ import { getDesignConfig, TMagicSelect } from '@tmagic/design';
|
|
|
33
33
|
import type { CondOpSelectConfig, FieldProps } from '@tmagic/form';
|
|
34
34
|
|
|
35
35
|
import { useServices } from '@editor/hooks/use-services';
|
|
36
|
-
import {
|
|
36
|
+
import { getCondOpOptionsByFieldType, getFieldType } from '@editor/utils';
|
|
37
37
|
|
|
38
38
|
defineOptions({
|
|
39
39
|
name: 'MFieldsCondOpSelect',
|
|
@@ -51,31 +51,9 @@ const optionComponent = getDesignConfig('components')?.option;
|
|
|
51
51
|
|
|
52
52
|
const options = computed(() => {
|
|
53
53
|
const [id, ...fieldNames] = [...(props.config.parentFields || []), ...props.model.field];
|
|
54
|
-
|
|
55
54
|
const ds = dataSourceService.getDataSourceById(id);
|
|
56
|
-
|
|
57
55
|
const type = getFieldType(ds, fieldNames);
|
|
58
|
-
|
|
59
|
-
if (type === 'array') {
|
|
60
|
-
return arrayOptions;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (type === 'boolean' || type === 'null') {
|
|
64
|
-
return [
|
|
65
|
-
{ text: '是', value: 'is' },
|
|
66
|
-
{ text: '不是', value: 'not' },
|
|
67
|
-
];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (type === 'number') {
|
|
71
|
-
return [...eqOptions, ...numberOptions];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (type === 'string') {
|
|
75
|
-
return [...arrayOptions, ...eqOptions];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return [...arrayOptions, ...eqOptions, ...numberOptions];
|
|
56
|
+
return getCondOpOptionsByFieldType(type);
|
|
79
57
|
});
|
|
80
58
|
|
|
81
59
|
const fieldChangeHandler = (v: string) => {
|
|
@@ -211,11 +211,25 @@ const onChangeHandler = (v: string[] = []) => {
|
|
|
211
211
|
emit('change', v);
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
const
|
|
214
|
+
const dataSourceSidePanel = computed(() =>
|
|
215
215
|
uiService.get('sideBarItems').find((item) => item.$key === SideItemKey.DATA_SOURCE),
|
|
216
216
|
);
|
|
217
217
|
|
|
218
|
+
const hasDataSourceSidePanel = computed(() => dataSourceSidePanel.value);
|
|
219
|
+
|
|
218
220
|
const editHandler = (id: string) => {
|
|
219
|
-
|
|
221
|
+
const sideBarItem = dataSourceSidePanel.value;
|
|
222
|
+
if (sideBarItem) {
|
|
223
|
+
uiService.set('sideBarActiveTabName', sideBarItem.text || sideBarItem.$key || SideItemKey.DATA_SOURCE);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const dataSourceId = removeDataSourceFieldPrefix(id);
|
|
227
|
+
const fieldPath = selectFieldsId.value;
|
|
228
|
+
|
|
229
|
+
if (fieldPath.length) {
|
|
230
|
+
eventBus?.emit('edit-data-source-field', dataSourceId, [...fieldPath]);
|
|
231
|
+
} else {
|
|
232
|
+
eventBus?.emit('edit-data-source', dataSourceId);
|
|
233
|
+
}
|
|
220
234
|
};
|
|
221
235
|
</script>
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="m-fields-data-source-field-select"
|
|
4
|
+
:class="{
|
|
5
|
+
[`data-source-field-${type}`]: !isSelectValid,
|
|
6
|
+
}"
|
|
7
|
+
>
|
|
3
8
|
<FieldSelect
|
|
4
|
-
v-if="
|
|
9
|
+
v-if="isSelectValid"
|
|
5
10
|
:model-value="model[name]"
|
|
6
11
|
:disabled="disabled"
|
|
7
12
|
:size="size"
|
|
@@ -37,15 +42,14 @@
|
|
|
37
42
|
:size="size"
|
|
38
43
|
:disabled="disabled"
|
|
39
44
|
@click="onToggleDataSourceFieldSelectHandler"
|
|
40
|
-
><MIcon :icon="
|
|
41
|
-
|
|
45
|
+
><MIcon :icon="dataSourceIcon"></MIcon>
|
|
46
|
+
</TMagicButton>
|
|
42
47
|
</TMagicTooltip>
|
|
43
48
|
</div>
|
|
44
49
|
</template>
|
|
45
50
|
|
|
46
51
|
<script setup lang="ts">
|
|
47
52
|
import { computed, inject, ref, resolveComponent, watch } from 'vue';
|
|
48
|
-
import { Coin } from '@element-plus/icons-vue';
|
|
49
53
|
|
|
50
54
|
import { DataSchema } from '@tmagic/core';
|
|
51
55
|
import { TMagicButton, tMagicMessage, TMagicTooltip } from '@tmagic/design';
|
|
@@ -61,6 +65,8 @@ import { DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, removeDataSourceFieldPrefix } f
|
|
|
61
65
|
import MIcon from '@editor/components/Icon.vue';
|
|
62
66
|
import { useServices } from '@editor/hooks/use-services';
|
|
63
67
|
|
|
68
|
+
import dataSourceIcon from '../../icons/DatasourceIcon.vue';
|
|
69
|
+
|
|
64
70
|
import FieldSelect from './FieldSelect.vue';
|
|
65
71
|
|
|
66
72
|
defineOptions({
|
|
@@ -75,6 +81,9 @@ const props = withDefaults(defineProps<FieldProps<DataSourceFieldSelectConfig>>(
|
|
|
75
81
|
|
|
76
82
|
const showDataSourceFieldSelect = ref(false);
|
|
77
83
|
|
|
84
|
+
const isSelectValid = computed(
|
|
85
|
+
() => !disabledDataSource.value && (showDataSourceFieldSelect.value || !props.config.fieldConfig),
|
|
86
|
+
);
|
|
78
87
|
watch(
|
|
79
88
|
() => props.model[props.name],
|
|
80
89
|
(value) => {
|
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
10
|
<FloatingBox
|
|
11
|
+
:body-style="{ padding: '0 16px' }"
|
|
11
12
|
v-model:visible="addDialogVisible"
|
|
12
13
|
v-model:width="width"
|
|
13
14
|
v-model:height="editorHeight"
|
|
14
15
|
:title="fieldTitle"
|
|
16
|
+
:framework-width="frameworkWidth"
|
|
15
17
|
:position="boxPosition"
|
|
16
18
|
>
|
|
17
19
|
<template #body>
|
|
@@ -28,10 +30,12 @@
|
|
|
28
30
|
</FloatingBox>
|
|
29
31
|
|
|
30
32
|
<FloatingBox
|
|
33
|
+
:body-style="{ padding: '0 16px' }"
|
|
31
34
|
v-model:visible="addFromJsonDialogVisible"
|
|
32
35
|
v-model:width="width"
|
|
33
36
|
v-model:height="editorHeight"
|
|
34
37
|
title="快速添加数据定义"
|
|
38
|
+
:framework-width="frameworkWidth"
|
|
35
39
|
:position="boxPosition"
|
|
36
40
|
>
|
|
37
41
|
<template #body>
|
|
@@ -47,7 +51,7 @@
|
|
|
47
51
|
</template>
|
|
48
52
|
|
|
49
53
|
<script setup lang="ts">
|
|
50
|
-
import { computed, inject, Ref, ref } from 'vue';
|
|
54
|
+
import { computed, type ComputedRef, inject, onMounted, provide, Ref, ref } from 'vue';
|
|
51
55
|
|
|
52
56
|
import type { DataSchema } from '@tmagic/core';
|
|
53
57
|
import { TMagicButton, tMagicMessage, tMagicMessageBox } from '@tmagic/design';
|
|
@@ -101,6 +105,16 @@ const newHandler = () => {
|
|
|
101
105
|
addDialogVisible.value = true;
|
|
102
106
|
};
|
|
103
107
|
|
|
108
|
+
const editField = (row: Record<string, any>, index: number) => {
|
|
109
|
+
fieldValues.value = {
|
|
110
|
+
...row,
|
|
111
|
+
index,
|
|
112
|
+
};
|
|
113
|
+
fieldTitle.value = `编辑${row.title}`;
|
|
114
|
+
calcBoxPosition();
|
|
115
|
+
addDialogVisible.value = true;
|
|
116
|
+
};
|
|
117
|
+
|
|
104
118
|
const fieldChange = ({ index, ...value }: Record<string, any>, data: ContainerChangeEventData) => {
|
|
105
119
|
addDialogVisible.value = false;
|
|
106
120
|
|
|
@@ -158,13 +172,7 @@ const fieldColumns: ColumnConfig[] = [
|
|
|
158
172
|
{
|
|
159
173
|
text: '编辑',
|
|
160
174
|
handler: (row: Record<string, any>, index: number) => {
|
|
161
|
-
|
|
162
|
-
...row,
|
|
163
|
-
index,
|
|
164
|
-
};
|
|
165
|
-
fieldTitle.value = `编辑${row.title}`;
|
|
166
|
-
calcBoxPosition();
|
|
167
|
-
addDialogVisible.value = true;
|
|
175
|
+
editField(row, index);
|
|
168
176
|
},
|
|
169
177
|
},
|
|
170
178
|
{
|
|
@@ -354,4 +362,30 @@ const { height: editorHeight } = useEditorContentHeight();
|
|
|
354
362
|
|
|
355
363
|
const parentFloating = inject<Ref<HTMLDivElement | null>>('parentFloating', ref(null));
|
|
356
364
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(uiService, parentFloating);
|
|
365
|
+
const frameworkWidth = computed(() => uiService.get('frameworkRect')?.width || 0);
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* 由 DataSourceConfigPanel 注入:打开数据源详情后需要直接打开的字段路径(字段名数组)。
|
|
369
|
+
* 当前层消费 path[0],并把剩余路径下发给嵌套字段,实现逐层打开。
|
|
370
|
+
*/
|
|
371
|
+
const editingFieldPath = inject<ComputedRef<string[]>>(
|
|
372
|
+
'editingDataSourceFieldPath',
|
|
373
|
+
computed(() => []),
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
provide(
|
|
377
|
+
'editingDataSourceFieldPath',
|
|
378
|
+
computed(() => editingFieldPath.value.slice(1)),
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
onMounted(() => {
|
|
382
|
+
const path = editingFieldPath.value;
|
|
383
|
+
if (!path.length) return;
|
|
384
|
+
|
|
385
|
+
const fields: Record<string, any>[] = props.model[props.name] || [];
|
|
386
|
+
const index = fields.findIndex((field) => field.name === path[0]);
|
|
387
|
+
if (index === -1) return;
|
|
388
|
+
|
|
389
|
+
editField(fields[index], index);
|
|
390
|
+
});
|
|
357
391
|
</script>
|