@tmagic/editor 1.8.0-manmanyu.9 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/Editor.vue_vue_type_script_setup_true_lang.js +22 -13
- package/dist/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +10 -5
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +7 -6
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +21 -122
- package/dist/es/components/ContentMenu.vue_vue_type_script_setup_true_lang.js +21 -5
- package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +62 -16
- package/dist/es/components/Icon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/Resizer.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/es/components/ScrollBar.js +0 -1
- package/dist/es/components/ScrollBar.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/es/components/ScrollViewer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/SearchInput.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/SplitView.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ToolButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/Tree.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/TreeNode.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ViewForm.js +5 -0
- package/dist/es/components/ViewForm.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/es/editorProps.js +7 -1
- package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/CodeLink.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +30 -113
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +7 -19
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +7 -6
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +12 -4
- package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +9 -20
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +2 -2
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +5 -3
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +9 -4
- package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +10 -110
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +52 -363
- package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/PageFragmentSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +3 -6
- package/dist/es/fields/StyleSetter/components/BackgroundPosition.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +4 -35
- package/dist/es/fields/StyleSetter/components/Box.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/fields/StyleSetter/configs.js +663 -0
- package/dist/es/fields/StyleSetter/icons/align-items/Center.js +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/FlexEnd.js +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/FlexStart.js +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/SpaceAround.js +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/SpaceBetween.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/NoRepeat.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/Repeat.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatX.js +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatY.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Block.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Flex.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Inline.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/InlineBlock.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/None.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/Column.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/ColumnReverse.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/Row.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/RowReverse.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/Center.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexEnd.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexStart.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceAround.js +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceBetween.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Center.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Left.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Right.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +29 -106
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +8 -11
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +30 -89
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +29 -297
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +29 -82
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +8 -24
- package/dist/es/fields/UISelect.js +0 -1
- package/dist/es/fields/UISelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/configs/codeSelect.js +98 -0
- package/dist/es/fields/configs/displayConds.js +158 -0
- package/dist/es/fields/configs/eventSelect.js +225 -0
- package/dist/es/fields/configs/stickyAddButton.js +21 -0
- package/dist/es/fields/headless-validation.js +139 -0
- package/dist/es/headless.js +2 -0
- package/dist/es/hooks/use-code-block-edit.js +4 -2
- package/dist/es/hooks/use-compare-form.js +101 -0
- package/dist/es/hooks/use-form-context.js +29 -0
- package/dist/es/hooks/use-stage.js +1 -0
- package/dist/es/icons/CenterIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/icons/CodeIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/icons/DatasourceIcon.js +1 -1
- package/dist/es/icons/FolderMinusIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/index.js +16 -8
- package/dist/es/initService.js +52 -16
- package/dist/es/layouts/AddPageBox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +26 -10
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +11 -8
- package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/NavMenuColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/Bucket.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/BucketTab.vue_vue_type_script_setup_true_lang.js +8 -5
- package/dist/es/layouts/history-list/GroupRow.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +26 -10
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +11 -13
- package/dist/es/layouts/history-list/InitialRow.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/PageTab.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/composables.js +1 -1
- package/dist/es/layouts/history-list/useHistoryRevert.js +38 -33
- package/dist/es/layouts/page-bar/AddButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageBar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageBarScrollContainer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/Search.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +50 -20
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +53 -35
- package/dist/es/layouts/props-panel/use-style-panel.js +3 -2
- package/dist/es/layouts/sidebar/ComponentListPanel.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +21 -36
- package/dist/es/layouts/sidebar/code-block/CodeBlockList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/es/layouts/sidebar/code-block/useContentMenu.js +19 -4
- package/dist/es/layouts/sidebar/data-source/DataSourceAddButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +9 -4
- package/dist/es/layouts/sidebar/data-source/DataSourceList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/es/layouts/sidebar/data-source/useContentMenu.js +19 -4
- package/dist/es/layouts/sidebar/layer/LayerMenu.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/layouts/sidebar/layer/LayerNodeContent.js +5 -0
- package/dist/es/layouts/sidebar/layer/LayerNodeContent.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/es/layouts/sidebar/layer/LayerNodeTool.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/layer/LayerPanel.vue_vue_type_script_setup_true_lang.js +6 -4
- package/dist/es/layouts/sidebar/layer/use-click.js +3 -3
- package/dist/es/layouts/sidebar/layer/use-drag.js +11 -10
- package/dist/es/layouts/sidebar/layer/use-node-status.js +2 -2
- package/dist/es/layouts/workspace/Breadcrumb.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/Workspace.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js +9 -3
- package/dist/es/layouts/workspace/viewer/Stage.vue_vue_type_script_setup_true_lang.js +55 -9
- package/dist/es/layouts/workspace/viewer/StageOverlay.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/ViewerMenu.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/es/plugin.js +35 -23
- package/dist/es/services/codeBlock.js +8 -3
- package/dist/es/services/dataSource.js +3 -0
- package/dist/es/services/dep.js +162 -41
- package/dist/es/services/editor.js +344 -113
- package/dist/es/services/events.js +4 -4
- package/dist/es/services/history.js +17 -1
- package/dist/es/services/keybinding.js +3 -3
- package/dist/es/services/props.js +2 -1
- package/dist/es/services/storage.js +2 -2
- package/dist/es/services/ui.js +7 -2
- package/dist/es/style.css +277 -114
- package/dist/es/utils/code-block.js +14 -7
- package/dist/es/utils/config.js +4 -1
- package/dist/es/utils/const.js +2 -2
- package/dist/es/utils/content-menu.js +2 -2
- package/dist/es/utils/data-source/index.js +34 -12
- package/dist/es/utils/dep/collect-worker-client.js +154 -0
- package/dist/es/utils/dep/idle-task.js +70 -22
- package/dist/es/utils/dep/worker.js +1 -1
- package/dist/es/utils/editor.js +4 -2
- package/dist/es/utils/event.js +135 -0
- package/dist/es/utils/monaco-editor.js +22 -6
- package/dist/es/utils/operator.js +2 -2
- package/dist/es/utils/props.js +50 -106
- package/dist/es/utils/type-match-rules.js +356 -0
- package/dist/style.css +277 -114
- package/dist/themes/magic-admin.css +978 -175
- package/dist/tmagic-editor-headless.umd.cjs +10880 -0
- package/dist/tmagic-editor.umd.cjs +12695 -10896
- package/package.json +18 -13
- package/src/Editor.vue +23 -6
- package/src/components/CodeBlockEditor.vue +3 -0
- package/src/components/CodeParams.vue +10 -4
- package/src/components/CompareForm.vue +20 -190
- package/src/components/ContentMenu.vue +34 -6
- package/src/components/FloatingBox.vue +71 -7
- package/src/components/ScrollBar.vue +0 -67
- package/src/components/ViewForm.vue +54 -0
- package/src/editorProps.ts +23 -10
- package/src/fields/Code.vue +1 -1
- package/src/fields/CodeSelect.vue +20 -113
- package/src/fields/CodeSelectCol.vue +1 -1
- package/src/fields/CondOpSelect.vue +5 -26
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +2 -2
- package/src/fields/DataSourceFieldSelect/Index.vue +4 -1
- package/src/fields/DataSourceFields.vue +5 -1
- package/src/fields/DataSourceInput.vue +10 -28
- package/src/fields/DataSourceMethodSelect.vue +1 -1
- package/src/fields/DataSourceMethods.vue +6 -2
- package/src/fields/DataSourceMocks.vue +3 -0
- package/src/fields/DataSourceSelect.vue +1 -1
- package/src/fields/DisplayConds.vue +17 -139
- package/src/fields/EventSelect.vue +29 -416
- package/src/fields/KeyValue.vue +1 -1
- package/src/fields/StyleSetter/Index.vue +2 -8
- package/src/fields/StyleSetter/components/Border.vue +4 -38
- package/src/fields/StyleSetter/components/Box.vue +1 -1
- package/src/fields/StyleSetter/components/Position.vue +1 -1
- package/src/fields/StyleSetter/configs.ts +690 -0
- package/src/fields/StyleSetter/pro/Background.vue +9 -64
- package/src/fields/StyleSetter/pro/Border.vue +5 -16
- package/src/fields/StyleSetter/pro/Font.vue +11 -71
- package/src/fields/StyleSetter/pro/Layout.vue +10 -230
- package/src/fields/StyleSetter/pro/Position.vue +11 -82
- package/src/fields/StyleSetter/pro/Transform.vue +6 -34
- package/src/fields/UISelect.vue +0 -12
- package/src/fields/configs/codeSelect.ts +127 -0
- package/src/fields/configs/displayConds.ts +184 -0
- package/src/fields/configs/eventSelect.ts +309 -0
- package/src/fields/configs/stickyAddButton.ts +32 -0
- package/src/fields/headless-validation.ts +177 -0
- package/src/headless.ts +33 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-compare-form.ts +166 -0
- package/src/hooks/use-form-context.ts +56 -0
- package/src/hooks/use-stage.ts +1 -0
- package/src/index.ts +9 -0
- package/src/initService.ts +73 -18
- package/src/layouts/CodeEditor.vue +32 -6
- package/src/layouts/Framework.vue +7 -6
- package/src/layouts/history-list/BucketTab.vue +2 -2
- package/src/layouts/history-list/HistoryDiffDialog.vue +33 -15
- package/src/layouts/history-list/HistoryListPanel.vue +16 -18
- package/src/layouts/history-list/useHistoryRevert.ts +57 -41
- package/src/layouts/props-panel/FormPanel.vue +75 -20
- package/src/layouts/props-panel/PropsPanel.vue +81 -30
- package/src/layouts/props-panel/use-style-panel.ts +4 -3
- package/src/layouts/sidebar/ComponentListPanel.vue +6 -2
- package/src/layouts/sidebar/Sidebar.vue +5 -3
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +5 -2
- package/src/layouts/sidebar/code-block/useContentMenu.ts +14 -2
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +3 -0
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +3 -3
- package/src/layouts/sidebar/data-source/useContentMenu.ts +14 -2
- package/src/layouts/sidebar/layer/LayerMenu.vue +2 -2
- package/src/layouts/sidebar/layer/LayerNodeContent.vue +57 -0
- package/src/layouts/sidebar/layer/LayerPanel.vue +5 -2
- package/src/layouts/sidebar/layer/use-click.ts +3 -3
- package/src/layouts/sidebar/layer/use-node-status.ts +2 -2
- package/src/layouts/workspace/viewer/NodeListMenu.vue +4 -1
- package/src/layouts/workspace/viewer/Stage.vue +80 -10
- package/src/layouts/workspace/viewer/ViewerMenu.vue +7 -7
- package/src/plugin.ts +35 -25
- package/src/services/codeBlock.ts +4 -0
- package/src/services/dataSource.ts +3 -0
- package/src/services/dep.ts +292 -47
- package/src/services/editor.ts +383 -120
- package/src/services/events.ts +8 -7
- package/src/services/history.ts +22 -1
- package/src/services/keybinding.ts +3 -3
- package/src/services/ui.ts +26 -5
- package/src/theme/code-block.scss +0 -37
- package/src/theme/display-conds.scss +4 -0
- package/src/theme/event.scss +25 -33
- package/src/theme/floating-box.scss +9 -1
- package/src/theme/framework.scss +4 -1
- package/src/theme/layer-node-content.scss +14 -0
- package/src/theme/nav-menu.scss +5 -1
- package/src/theme/props-panel.scss +17 -3
- package/src/theme/scroll-bar.scss +64 -0
- package/src/theme/theme.scss +3 -0
- package/src/theme/themes/magic-admin/index.scss +109 -9
- package/src/theme/ui-select.scss +9 -0
- package/src/type.ts +216 -6
- package/src/utils/code-block.ts +1 -0
- package/src/utils/config.ts +9 -1
- package/src/utils/const.ts +3 -3
- package/src/utils/content-menu.ts +2 -2
- package/src/utils/data-source/index.ts +31 -12
- package/src/utils/dep/collect-worker-client.ts +215 -0
- package/src/utils/dep/idle-task.ts +104 -35
- package/src/utils/dep/worker.ts +113 -9
- package/src/utils/event.ts +237 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/monaco-editor.ts +27 -0
- package/src/utils/operator.ts +2 -2
- package/src/utils/props.ts +61 -122
- package/src/utils/type-match-rules.ts +697 -0
- package/types/headless.d.ts +17 -0
- package/types/index.d.ts +1199 -724
- package/src/fields/StyleSetter/icons/align-items/index copy.ts +0 -5
|
@@ -2,11 +2,11 @@ import { useServices } from "../../../hooks/use-services.js";
|
|
|
2
2
|
import ContentMenu_default from "../../../components/ContentMenu.js";
|
|
3
3
|
import FolderMinusIcon_default from "../../../icons/FolderMinusIcon.js";
|
|
4
4
|
import { useCopyMenu, useDeleteMenu, useMoveToMenu, usePasteMenu } from "../../../utils/content-menu.js";
|
|
5
|
-
import {
|
|
5
|
+
import { isPageOrFragment } from "@tmagic/utils";
|
|
6
6
|
import { computed, createBlock, defineComponent, markRaw, openBlock, useTemplateRef } from "vue";
|
|
7
7
|
import { Files, Plus } from "@element-plus/icons-vue";
|
|
8
8
|
//#region packages/editor/src/layouts/sidebar/layer/LayerMenu.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var LayerMenu_vue_vue_type_script_setup_true_lang_default =
|
|
9
|
+
var LayerMenu_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
10
10
|
name: "MEditorLayerMenu",
|
|
11
11
|
__name: "LayerMenu",
|
|
12
12
|
props: {
|
|
@@ -55,7 +55,7 @@ var LayerMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
55
55
|
type: "button",
|
|
56
56
|
text: "全部折叠",
|
|
57
57
|
icon: FolderMinusIcon_default,
|
|
58
|
-
display: () =>
|
|
58
|
+
display: () => isPageOrFragment(node.value),
|
|
59
59
|
handler: () => {
|
|
60
60
|
emit("collapse-all");
|
|
61
61
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import LayerNodeContent_vue_vue_type_script_setup_true_lang_default from "./LayerNodeContent.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
//#region packages/editor/src/layouts/sidebar/layer/LayerNodeContent.vue
|
|
3
|
+
var LayerNodeContent_default = LayerNodeContent_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { LayerNodeContent_default as default };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useServices } from "../../../hooks/use-services.js";
|
|
2
|
+
import Icon_default from "../../../components/Icon.js";
|
|
3
|
+
import { TMagicTooltip, stripValidateSuggestion } from "@tmagic/design";
|
|
4
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref, withCtx } from "vue";
|
|
5
|
+
import { WarningFilled } from "@element-plus/icons-vue";
|
|
6
|
+
//#region packages/editor/src/layouts/sidebar/layer/LayerNodeContent.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var _hoisted_1 = { class: "m-editor-layer-node-label" };
|
|
8
|
+
var _hoisted_2 = ["innerHTML"];
|
|
9
|
+
var LayerNodeContent_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
10
|
+
name: "MEditorLayerNodeContent",
|
|
11
|
+
__name: "LayerNodeContent",
|
|
12
|
+
props: { data: {} },
|
|
13
|
+
setup(__props) {
|
|
14
|
+
const props = __props;
|
|
15
|
+
const { editorService } = useServices();
|
|
16
|
+
const label = computed(() => `${props.data.name} (${props.data.id})`);
|
|
17
|
+
/** 读取集中存储的校验错误状态,建立响应式依赖 */
|
|
18
|
+
const invalidInfo = computed(() => editorService.get("invalidNodeIds").get(props.data.id));
|
|
19
|
+
const hasError = computed(() => Boolean(invalidInfo.value?.props || invalidInfo.value?.style));
|
|
20
|
+
/**
|
|
21
|
+
* 去掉单条校验文案中的「修改建议」部分。
|
|
22
|
+
*
|
|
23
|
+
* 错误文案可能是多条错误以 `<br>` 拼接的 HTML,每条本身形如 `主文案\n\n建议`。
|
|
24
|
+
* 组件树 tooltip 仅展示错误描述,不展示修改建议(建议仅在错误汇总面板展示),
|
|
25
|
+
* 故先按 `<br>` 拆分,每段用 `stripValidateSuggestion` 截断建议后再拼回。
|
|
26
|
+
*/
|
|
27
|
+
const stripSuggestion = (text) => String(text ?? "").split(/<br\s*\/?>/i).map((segment) => stripValidateSuggestion(segment)).join("<br>");
|
|
28
|
+
/** 合并属性表单与样式表单的错误文案(去掉建议,本身可能仍是含 <br> 的 HTML) */
|
|
29
|
+
const errorMessage = computed(() => [stripSuggestion(invalidInfo.value?.props), stripSuggestion(invalidInfo.value?.style)].filter(Boolean).join("<br>"));
|
|
30
|
+
return (_ctx, _cache) => {
|
|
31
|
+
return openBlock(), createElementBlock("span", { class: normalizeClass(["m-editor-layer-node-content", { "is-invalid": hasError.value }]) }, [createElementVNode("span", _hoisted_1, toDisplayString(label.value), 1), hasError.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
32
|
+
key: 0,
|
|
33
|
+
placement: "top"
|
|
34
|
+
}, {
|
|
35
|
+
content: withCtx(() => [createElementVNode("span", { innerHTML: errorMessage.value }, null, 8, _hoisted_2)]),
|
|
36
|
+
default: withCtx(() => [createVNode(Icon_default, {
|
|
37
|
+
class: "m-editor-layer-node-error-icon",
|
|
38
|
+
icon: unref(WarningFilled)
|
|
39
|
+
}, null, 8, ["icon"])]),
|
|
40
|
+
_: 1
|
|
41
|
+
})) : createCommentVNode("v-if", true)], 2);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
//#endregion
|
|
46
|
+
export { LayerNodeContent_vue_vue_type_script_setup_true_lang_default as default };
|
|
@@ -3,7 +3,7 @@ import { TMagicButton } from "@tmagic/design";
|
|
|
3
3
|
import { createBlock, createCommentVNode, defineComponent, openBlock, unref, withModifiers } from "vue";
|
|
4
4
|
import { Hide, View } from "@element-plus/icons-vue";
|
|
5
5
|
//#region packages/editor/src/layouts/sidebar/layer/LayerNodeTool.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var LayerNodeTool_vue_vue_type_script_setup_true_lang_default =
|
|
6
|
+
var LayerNodeTool_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
7
7
|
__name: "LayerNodeTool",
|
|
8
8
|
props: { data: {} },
|
|
9
9
|
setup(__props) {
|
|
@@ -3,6 +3,7 @@ import { useFilter } from "../../../hooks/use-filter.js";
|
|
|
3
3
|
import SearchInput_default from "../../../components/SearchInput.js";
|
|
4
4
|
import Tree_default from "../../../components/Tree.js";
|
|
5
5
|
import LayerMenu_default from "./LayerMenu.js";
|
|
6
|
+
import LayerNodeContent_default from "./LayerNodeContent.js";
|
|
6
7
|
import LayerNodeTool_default from "./LayerNodeTool.js";
|
|
7
8
|
import { useClick } from "./use-click.js";
|
|
8
9
|
import { useDrag } from "./use-drag.js";
|
|
@@ -11,7 +12,7 @@ import { useNodeStatus } from "./use-node-status.js";
|
|
|
11
12
|
import { TMagicScrollbar } from "@tmagic/design";
|
|
12
13
|
import { Teleport, computed, createBlock, createCommentVNode, createVNode, defineComponent, openBlock, renderSlot, unref, useTemplateRef, withCtx } from "vue";
|
|
13
14
|
//#region packages/editor/src/layouts/sidebar/layer/LayerPanel.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
-
var LayerPanel_vue_vue_type_script_setup_true_lang_default =
|
|
15
|
+
var LayerPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
15
16
|
name: "MEditorLayerPanel",
|
|
16
17
|
__name: "LayerPanel",
|
|
17
18
|
props: {
|
|
@@ -38,7 +39,7 @@ var LayerPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
38
39
|
let name = "";
|
|
39
40
|
if (data.name) name = data.name;
|
|
40
41
|
else if (data.items) name = "container";
|
|
41
|
-
return `${data.id}${name}${data.type}`.includes(v);
|
|
42
|
+
return `${data.id}${name}${data.type || ""}`.toLocaleLowerCase().includes(v.toLocaleLowerCase());
|
|
42
43
|
};
|
|
43
44
|
const { filterTextChangeHandler } = useFilter(nodeData, nodeStatusMap, filterNodeMethod);
|
|
44
45
|
const collapseAllHandler = () => {
|
|
@@ -50,7 +51,8 @@ var LayerPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
const { handleDragStart, handleDragEnd, handleDragLeave, handleDragOver } = useDrag(services, { canDropIn: (sourceIds, targetId) => props.canDropIn?.(sourceIds, targetId, "layer") });
|
|
53
|
-
const
|
|
54
|
+
const menuRef = useTemplateRef("menu");
|
|
55
|
+
const { nodeClickHandler, nodeDblclickHandler, nodeContentMenuHandler, highlightHandler: mouseenterHandler } = useClick(services, isCtrlKeyDown, nodeStatusMap, menuRef);
|
|
54
56
|
const dblclickHandler = async (event, data) => {
|
|
55
57
|
if (props.beforeNodeDblclick) {
|
|
56
58
|
if (await props.beforeNodeDblclick(event, data) === false) return;
|
|
@@ -83,7 +85,7 @@ var LayerPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
83
85
|
}, {
|
|
84
86
|
"tree-node-content": withCtx(({ data: nodeData }) => [renderSlot(_ctx.$slots, "layer-node-content", { data: nodeData })]),
|
|
85
87
|
"tree-node-tool": withCtx(({ data: nodeData }) => [renderSlot(_ctx.$slots, "layer-node-tool", { data: nodeData }, () => [createVNode(LayerNodeTool_default, { data: nodeData }, null, 8, ["data"])])]),
|
|
86
|
-
"tree-node-label": withCtx(({ data: nodeData }) => [renderSlot(_ctx.$slots, "layer-node-label", { data: nodeData })]),
|
|
88
|
+
"tree-node-label": withCtx(({ data: nodeData }) => [renderSlot(_ctx.$slots, "layer-node-label", { data: nodeData }, () => [createVNode(LayerNodeContent_default, { data: nodeData }, null, 8, ["data"])])]),
|
|
87
89
|
_: 3
|
|
88
90
|
}, 8, [
|
|
89
91
|
"data",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UI_SELECT_MODE_EVENT_NAME } from "../../../utils/const.js";
|
|
2
2
|
import { updateStatus } from "../../../utils/tree.js";
|
|
3
|
-
import { getElById,
|
|
3
|
+
import { getElById, isPageOrFragment } from "@tmagic/utils";
|
|
4
4
|
import { computed, nextTick } from "vue";
|
|
5
5
|
import { throttle } from "lodash-es";
|
|
6
6
|
//#region packages/editor/src/layouts/sidebar/layer/use-click.ts
|
|
@@ -16,7 +16,7 @@ var useClick = ({ editorService, stageOverlayService, uiService }, isCtrlKeyDown
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
const multiSelect = async (data) => {
|
|
19
|
-
if (
|
|
19
|
+
if (isPageOrFragment(data)) return;
|
|
20
20
|
const nodes = editorService.get("nodes") || [];
|
|
21
21
|
const newNodes = [];
|
|
22
22
|
let isCancel = false;
|
|
@@ -25,7 +25,7 @@ var useClick = ({ editorService, stageOverlayService, uiService }, isCtrlKeyDown
|
|
|
25
25
|
isCancel = true;
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
if (
|
|
28
|
+
if (isPageOrFragment(node)) return;
|
|
29
29
|
newNodes.push(node.id);
|
|
30
30
|
});
|
|
31
31
|
if (!isCancel || newNodes.length === 0) newNodes.push(data.id);
|
|
@@ -109,16 +109,17 @@ var useDrag = ({ editorService }, options = {}) => {
|
|
|
109
109
|
let targetParent = targetInfo.parent;
|
|
110
110
|
if (!targetParent || !targetNode) return;
|
|
111
111
|
let targetIndex = -1;
|
|
112
|
-
if (Array.isArray(targetNode.items) && dragState.dropType === "inner")
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
if (Array.isArray(targetNode.items) && dragState.dropType === "inner") {
|
|
113
|
+
if (dragState.redirectedTargetId !== void 0) {
|
|
114
|
+
const redirectedNode = editorService.getNodeInfo(dragState.redirectedTargetId, false).node;
|
|
115
|
+
if (!redirectedNode || !Array.isArray(redirectedNode.items)) return;
|
|
116
|
+
targetParent = redirectedNode;
|
|
117
|
+
targetIndex = redirectedNode.items.length;
|
|
118
|
+
} else {
|
|
119
|
+
targetIndex = targetNode.items.length;
|
|
120
|
+
targetParent = targetNode;
|
|
121
|
+
}
|
|
122
|
+
} else targetIndex = getNodeIndex(dragState.dragOverNodeId, targetParent);
|
|
122
123
|
if (dragState.dropType === "after") targetIndex += 1;
|
|
123
124
|
const selectedNodes = editorService.get("nodes");
|
|
124
125
|
if (selectedNodes.find((n) => `${n.id}` === `${node.id}`)) editorService.dragTo(selectedNodes, targetParent, targetIndex);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { updateStatus } from "../../../utils/tree.js";
|
|
2
|
-
import { getNodePath,
|
|
2
|
+
import { getNodePath, isPageOrFragment, traverseNode } from "@tmagic/utils";
|
|
3
3
|
import { computed, onBeforeUnmount, ref, watch } from "vue";
|
|
4
4
|
//#region packages/editor/src/layouts/sidebar/layer/use-node-status.ts
|
|
5
5
|
var createPageNodeStatus = (page, initialLayerNodeStatus) => {
|
|
@@ -75,7 +75,7 @@ var useNodeStatus = ({ editorService }) => {
|
|
|
75
75
|
}, { immediate: true });
|
|
76
76
|
const addHandler = (newNodes) => {
|
|
77
77
|
newNodes.forEach((node) => {
|
|
78
|
-
if (
|
|
78
|
+
if (isPageOrFragment(node)) return;
|
|
79
79
|
traverseNode(node, (node) => {
|
|
80
80
|
nodeStatusMap.value?.set(node.id, {
|
|
81
81
|
visible: true,
|
|
@@ -12,7 +12,7 @@ var _hoisted_2 = {
|
|
|
12
12
|
class: "m-editor-breadcrumb-separator"
|
|
13
13
|
};
|
|
14
14
|
var COLLAPSE_RATIO = .8;
|
|
15
|
-
var Breadcrumb_vue_vue_type_script_setup_true_lang_default =
|
|
15
|
+
var Breadcrumb_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
16
16
|
name: "MEditorBreadcrumb",
|
|
17
17
|
__name: "Breadcrumb",
|
|
18
18
|
setup(__props) {
|
|
@@ -4,7 +4,7 @@ import Breadcrumb_default from "./Breadcrumb.js";
|
|
|
4
4
|
import { computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, inject, openBlock, renderSlot, unref, withCtx } from "vue";
|
|
5
5
|
//#region packages/editor/src/layouts/workspace/Workspace.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
var _hoisted_1 = { class: "m-editor-workspace" };
|
|
7
|
-
var Workspace_vue_vue_type_script_setup_true_lang_default =
|
|
7
|
+
var Workspace_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
8
8
|
name: "MEditorWorkspace",
|
|
9
9
|
__name: "Workspace",
|
|
10
10
|
props: {
|
package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -7,11 +7,12 @@ import { TMagicTooltip } from "@tmagic/design";
|
|
|
7
7
|
import { getIdFromEl } from "@tmagic/utils";
|
|
8
8
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, nextTick, openBlock, ref, unref, useTemplateRef, watch, withCtx } from "vue";
|
|
9
9
|
//#region packages/editor/src/layouts/workspace/viewer/NodeListMenu.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var NodeListMenu_vue_vue_type_script_setup_true_lang_default =
|
|
10
|
+
var NodeListMenu_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
11
11
|
__name: "NodeListMenu",
|
|
12
12
|
setup(__props) {
|
|
13
13
|
const services = useServices();
|
|
14
|
-
const { editorService } = services;
|
|
14
|
+
const { editorService, uiService } = services;
|
|
15
|
+
const frameworkWidth = computed(() => uiService.get("frameworkRect")?.width || 0);
|
|
15
16
|
const visible = ref(false);
|
|
16
17
|
const buttonVisible = ref(false);
|
|
17
18
|
const buttonEl = useTemplateRef("button");
|
|
@@ -71,6 +72,7 @@ var NodeListMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
71
72
|
visible: visible.value,
|
|
72
73
|
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => visible.value = $event),
|
|
73
74
|
title: "当前位置下的组件",
|
|
75
|
+
"framework-width": frameworkWidth.value,
|
|
74
76
|
position: menuPosition.value
|
|
75
77
|
}, {
|
|
76
78
|
body: withCtx(() => [createVNode(Tree_default, {
|
|
@@ -80,7 +82,11 @@ var NodeListMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
80
82
|
onNodeClick: clickHandler
|
|
81
83
|
}, null, 8, ["data", "node-status-map"])]),
|
|
82
84
|
_: 1
|
|
83
|
-
}, 8, [
|
|
85
|
+
}, 8, [
|
|
86
|
+
"visible",
|
|
87
|
+
"framework-width",
|
|
88
|
+
"position"
|
|
89
|
+
])) : createCommentVNode("v-if", true)], 64);
|
|
84
90
|
};
|
|
85
91
|
}
|
|
86
92
|
});
|
|
@@ -11,7 +11,7 @@ import { getOffset } from "@tmagic/stage";
|
|
|
11
11
|
import { calcValueByFontsize, getIdFromEl } from "@tmagic/utils";
|
|
12
12
|
import { Teleport, computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, markRaw, nextTick, normalizeStyle, onBeforeUnmount, onMounted, openBlock, renderSlot, resolveDirective, useTemplateRef, watch, watchEffect, withCtx, withDirectives } from "vue";
|
|
13
13
|
//#region packages/editor/src/layouts/workspace/viewer/Stage.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
-
var Stage_vue_vue_type_script_setup_true_lang_default =
|
|
14
|
+
var Stage_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
15
15
|
name: "MEditorStage",
|
|
16
16
|
__name: "Stage",
|
|
17
17
|
props: {
|
|
@@ -151,11 +151,44 @@ var Stage_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
151
151
|
height: contentRect.height
|
|
152
152
|
});
|
|
153
153
|
});
|
|
154
|
+
const parseDSL = getEditorConfig("parseDSL");
|
|
155
|
+
/**
|
|
156
|
+
* 本次拖拽是否由编辑器文档内部发起
|
|
157
|
+
*
|
|
158
|
+
* drop 的 text/json 里可能带函数(组件配置的事件、钩子等),还原只能交给 parseDSL,
|
|
159
|
+
* 而 parseDSL 的默认实现是 eval;HTML 拖放又允许其他源的页面在 DataTransfer 中投递
|
|
160
|
+
* 自定义 MIME 数据,跨源页面只要诱导用户拖拽一次,就能让 eval 执行任意脚本。
|
|
161
|
+
*
|
|
162
|
+
* 跨源页面既不会在本文档触发 dragstart,也无法往本文档创建的 DataTransfer 中写数据,
|
|
163
|
+
* 因此只有起源于本文档的拖拽才交给 parseDSL 还原。
|
|
164
|
+
* 同源拖拽源写入的 text/json 由业务保证可信。
|
|
165
|
+
*/
|
|
166
|
+
let isInternalDrag = false;
|
|
167
|
+
let internalDragSession = 0;
|
|
168
|
+
let clearInternalDragTimer;
|
|
169
|
+
const documentDragStartHandler = () => {
|
|
170
|
+
internalDragSession += 1;
|
|
171
|
+
isInternalDrag = true;
|
|
172
|
+
if (clearInternalDragTimer !== void 0) {
|
|
173
|
+
globalThis.clearTimeout(clearInternalDragTimer);
|
|
174
|
+
clearInternalDragTimer = void 0;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const documentDragEndHandler = () => {
|
|
178
|
+
const session = internalDragSession;
|
|
179
|
+
if (clearInternalDragTimer !== void 0) globalThis.clearTimeout(clearInternalDragTimer);
|
|
180
|
+
clearInternalDragTimer = globalThis.setTimeout(() => {
|
|
181
|
+
clearInternalDragTimer = void 0;
|
|
182
|
+
if (session === internalDragSession) isInternalDrag = false;
|
|
183
|
+
}, 0);
|
|
184
|
+
};
|
|
154
185
|
onMounted(() => {
|
|
155
186
|
if (stageWrapRef.value?.container) {
|
|
156
187
|
resizeObserver.observe(stageWrapRef.value.container);
|
|
157
188
|
keybindingService.registerEl(KeyBindingContainerKey.STAGE, stageWrapRef.value.container);
|
|
158
189
|
}
|
|
190
|
+
globalThis.document.addEventListener("dragstart", documentDragStartHandler, true);
|
|
191
|
+
globalThis.document.addEventListener("dragend", documentDragEndHandler, true);
|
|
159
192
|
});
|
|
160
193
|
onBeforeUnmount(() => {
|
|
161
194
|
stage?.destroy();
|
|
@@ -163,8 +196,13 @@ var Stage_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
163
196
|
resizeObserver.disconnect();
|
|
164
197
|
editorService.set("stage", null);
|
|
165
198
|
keybindingService.unregisterEl("stage");
|
|
199
|
+
if (clearInternalDragTimer !== void 0) {
|
|
200
|
+
globalThis.clearTimeout(clearInternalDragTimer);
|
|
201
|
+
clearInternalDragTimer = void 0;
|
|
202
|
+
}
|
|
203
|
+
globalThis.document.removeEventListener("dragstart", documentDragStartHandler, true);
|
|
204
|
+
globalThis.document.removeEventListener("dragend", documentDragEndHandler, true);
|
|
166
205
|
});
|
|
167
|
-
const parseDSL = getEditorConfig("parseDSL");
|
|
168
206
|
const contextmenuHandler = (e) => {
|
|
169
207
|
e.preventDefault();
|
|
170
208
|
menuRef.value?.show(e);
|
|
@@ -175,11 +213,19 @@ var Stage_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
175
213
|
e.dataTransfer.dropEffect = "move";
|
|
176
214
|
};
|
|
177
215
|
const dropHandler = async (e) => {
|
|
216
|
+
const allowed = isInternalDrag;
|
|
217
|
+
isInternalDrag = false;
|
|
178
218
|
if (!e.dataTransfer) return;
|
|
179
219
|
const data = e.dataTransfer.getData("text/json");
|
|
180
|
-
if (!data) return;
|
|
181
|
-
|
|
182
|
-
|
|
220
|
+
if (!data || !allowed) return;
|
|
221
|
+
let config;
|
|
222
|
+
try {
|
|
223
|
+
config = parseDSL(`(${data})`);
|
|
224
|
+
} catch {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (!config || config.dragType !== DragType.COMPONENT_LIST || !config.data) return;
|
|
228
|
+
const dragData = config.data;
|
|
183
229
|
e.preventDefault();
|
|
184
230
|
const doc = stage?.renderer?.contentWindow?.document;
|
|
185
231
|
const parentEl = doc?.querySelector(`.${props.stageOptions?.containerHighlightClassName}`);
|
|
@@ -201,7 +247,7 @@ var Stage_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
201
247
|
const layout = await editorService.getLayout(parent);
|
|
202
248
|
const containerRect = stageContainerEl.value.getBoundingClientRect();
|
|
203
249
|
const { scrollTop, scrollLeft } = stage.mask;
|
|
204
|
-
const { style = {} } =
|
|
250
|
+
const { style = {} } = dragData;
|
|
205
251
|
let top = 0;
|
|
206
252
|
let left = 0;
|
|
207
253
|
let position = "relative";
|
|
@@ -219,14 +265,14 @@ var Stage_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
219
265
|
top = top - parentTop * zoom.value;
|
|
220
266
|
}
|
|
221
267
|
}
|
|
222
|
-
|
|
268
|
+
dragData.style = {
|
|
223
269
|
...style,
|
|
224
270
|
position,
|
|
225
271
|
top: calcValueByFontsize(doc, top / zoom.value),
|
|
226
272
|
left: calcValueByFontsize(doc, left / zoom.value)
|
|
227
273
|
};
|
|
228
|
-
|
|
229
|
-
editorService.add(
|
|
274
|
+
dragData.inputEvent = e;
|
|
275
|
+
editorService.add(dragData, parent, { historySource: "component-panel" });
|
|
230
276
|
}
|
|
231
277
|
};
|
|
232
278
|
return (_ctx, _cache) => {
|
package/dist/es/layouts/workspace/viewer/StageOverlay.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -8,7 +8,7 @@ var _hoisted_1 = {
|
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "m-editor-stage-overlay"
|
|
10
10
|
};
|
|
11
|
-
var StageOverlay_vue_vue_type_script_setup_true_lang_default =
|
|
11
|
+
var StageOverlay_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
12
12
|
__name: "StageOverlay",
|
|
13
13
|
setup(__props) {
|
|
14
14
|
const { stageOverlayService, editorService, uiService } = useServices();
|
|
@@ -3,12 +3,12 @@ import { useServices } from "../../../hooks/use-services.js";
|
|
|
3
3
|
import ContentMenu_default from "../../../components/ContentMenu.js";
|
|
4
4
|
import { useCopyMenu, useDeleteMenu, useMoveToMenu, usePasteMenu } from "../../../utils/content-menu.js";
|
|
5
5
|
import CenterIcon_default from "../../../icons/CenterIcon.js";
|
|
6
|
-
import {
|
|
6
|
+
import { isPageOrFragment } from "@tmagic/utils";
|
|
7
7
|
import { NodeType } from "@tmagic/core";
|
|
8
8
|
import { computed, createBlock, defineComponent, markRaw, openBlock, ref, useTemplateRef, watch } from "vue";
|
|
9
9
|
import { Bottom, Top } from "@element-plus/icons-vue";
|
|
10
10
|
//#region packages/editor/src/layouts/workspace/viewer/ViewerMenu.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
-
var ViewerMenu_vue_vue_type_script_setup_true_lang_default =
|
|
11
|
+
var ViewerMenu_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
12
12
|
name: "MEditorViewerMenu",
|
|
13
13
|
__name: "ViewerMenu",
|
|
14
14
|
props: {
|
|
@@ -46,14 +46,14 @@ var ViewerMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
46
46
|
direction: "horizontal",
|
|
47
47
|
display: () => {
|
|
48
48
|
if (!node.value) return false;
|
|
49
|
-
return !
|
|
49
|
+
return !isPageOrFragment(node.value);
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
type: "button",
|
|
54
54
|
text: "上移一层",
|
|
55
55
|
icon: markRaw(Top),
|
|
56
|
-
display: () => !
|
|
56
|
+
display: () => !isPageOrFragment(node.value) && !props.isMultiSelect,
|
|
57
57
|
handler: () => {
|
|
58
58
|
editorService.moveLayer(1, { historySource: "stage-contextmenu" });
|
|
59
59
|
}
|
|
@@ -62,7 +62,7 @@ var ViewerMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
62
62
|
type: "button",
|
|
63
63
|
text: "下移一层",
|
|
64
64
|
icon: markRaw(Bottom),
|
|
65
|
-
display: () => !
|
|
65
|
+
display: () => !isPageOrFragment(node.value) && !props.isMultiSelect,
|
|
66
66
|
handler: () => {
|
|
67
67
|
editorService.moveLayer(-1, { historySource: "stage-contextmenu" });
|
|
68
68
|
}
|
|
@@ -71,7 +71,7 @@ var ViewerMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
71
71
|
type: "button",
|
|
72
72
|
text: "置顶",
|
|
73
73
|
icon: markRaw(Top),
|
|
74
|
-
display: () => !
|
|
74
|
+
display: () => !isPageOrFragment(node.value) && !props.isMultiSelect,
|
|
75
75
|
handler: () => {
|
|
76
76
|
editorService.moveLayer(LayerOffset.TOP, { historySource: "stage-contextmenu" });
|
|
77
77
|
}
|
|
@@ -80,7 +80,7 @@ var ViewerMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
80
80
|
type: "button",
|
|
81
81
|
text: "置底",
|
|
82
82
|
icon: markRaw(Bottom),
|
|
83
|
-
display: () => !
|
|
83
|
+
display: () => !isPageOrFragment(node.value) && !props.isMultiSelect,
|
|
84
84
|
handler: () => {
|
|
85
85
|
editorService.moveLayer(LayerOffset.BOTTOM, { historySource: "stage-contextmenu" });
|
|
86
86
|
}
|
|
@@ -89,7 +89,7 @@ var ViewerMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
89
89
|
{
|
|
90
90
|
type: "divider",
|
|
91
91
|
direction: "horizontal",
|
|
92
|
-
display: () => !
|
|
92
|
+
display: () => !isPageOrFragment(node.value) && !props.isMultiSelect
|
|
93
93
|
},
|
|
94
94
|
useDeleteMenu("stage-contextmenu"),
|
|
95
95
|
{
|
package/dist/es/plugin.js
CHANGED
|
@@ -16,46 +16,58 @@ import PageFragmentSelect_default from "./fields/PageFragmentSelect.js";
|
|
|
16
16
|
import DisplayConds_default from "./fields/DisplayConds.js";
|
|
17
17
|
import CondOpSelect_default from "./fields/CondOpSelect.js";
|
|
18
18
|
import Index_default$1 from "./fields/StyleSetter/Index.js";
|
|
19
|
+
import { editorFields } from "./fields/headless-validation.js";
|
|
19
20
|
import Code_default from "./fields/Code.js";
|
|
20
21
|
import CodeLink_default from "./fields/CodeLink.js";
|
|
21
22
|
import UISelect_default from "./fields/UISelect.js";
|
|
22
23
|
/* empty css */
|
|
23
|
-
import formPlugin from "@tmagic/form";
|
|
24
|
+
import formPlugin, { mergeFieldOptions } from "@tmagic/form";
|
|
24
25
|
import tablePlugin from "@tmagic/table";
|
|
25
26
|
import designPlugin from "@tmagic/design";
|
|
26
27
|
//#region packages/editor/src/plugin.ts
|
|
27
28
|
var defaultInstallOpt = {
|
|
28
29
|
parseDSL: (dsl) => eval(dsl),
|
|
29
30
|
customCreateMonacoEditor: (monaco, codeEditorEl, options) => monaco.editor.create(codeEditorEl, options),
|
|
30
|
-
customCreateMonacoDiffEditor: (monaco, codeEditorEl, options) => monaco.editor.createDiffEditor(codeEditorEl, options)
|
|
31
|
+
customCreateMonacoDiffEditor: (monaco, codeEditorEl, options) => monaco.editor.createDiffEditor(codeEditorEl, options),
|
|
32
|
+
flat: false
|
|
33
|
+
};
|
|
34
|
+
var editorFieldVue = {
|
|
35
|
+
"vs-code": { component: Code_default },
|
|
36
|
+
"ui-select": { component: UISelect_default },
|
|
37
|
+
"cond-op-select": { component: CondOpSelect_default },
|
|
38
|
+
"page-fragment-select": { component: PageFragmentSelect_default },
|
|
39
|
+
"data-source-select": { component: DataSourceSelect_default },
|
|
40
|
+
"data-source-input": { component: DataSourceInput_default },
|
|
41
|
+
"code-link": { component: CodeLink_default },
|
|
42
|
+
"key-value": { component: KeyValue_default },
|
|
43
|
+
"code-select-col": { component: CodeSelectCol_default },
|
|
44
|
+
"data-source-fields": { component: DataSourceFields_default },
|
|
45
|
+
"data-source-mocks": { component: DataSourceMocks_default },
|
|
46
|
+
"data-source-methods": { component: DataSourceMethods_default },
|
|
47
|
+
"data-source-method-select": { component: DataSourceMethodSelect_default },
|
|
48
|
+
"data-source-field-select": { component: Index_default },
|
|
49
|
+
"code-select": { component: CodeSelect_default },
|
|
50
|
+
"display-conds": { component: DisplayConds_default },
|
|
51
|
+
"event-select": { component: EventSelect_default },
|
|
52
|
+
"style-setter": { container: Index_default$1 }
|
|
31
53
|
};
|
|
32
54
|
var plugin_default = { install: (app, opt) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
55
|
+
const incoming = opt || {};
|
|
56
|
+
const option = {
|
|
57
|
+
...defaultInstallOpt,
|
|
58
|
+
...incoming
|
|
59
|
+
};
|
|
60
|
+
const formOpt = incoming;
|
|
61
|
+
app.use(designPlugin, incoming);
|
|
62
|
+
app.use(formPlugin, {
|
|
63
|
+
...formOpt,
|
|
64
|
+
fields: mergeFieldOptions(editorFields, editorFieldVue, formOpt.fields)
|
|
65
|
+
});
|
|
36
66
|
app.use(tablePlugin);
|
|
37
67
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
38
68
|
setEditorConfig(option);
|
|
39
69
|
app.component(`${Editor_default.name || "MEditor"}`, Editor_default);
|
|
40
70
|
app.component("magic-code-editor", CodeEditor_default);
|
|
41
|
-
app.component("m-fields-ui-select", UISelect_default);
|
|
42
|
-
app.component("m-fields-code-link", CodeLink_default);
|
|
43
|
-
app.component("m-fields-vs-code", Code_default);
|
|
44
|
-
app.component("m-fields-code-select", CodeSelect_default);
|
|
45
|
-
app.component("m-fields-code-select-col", CodeSelectCol_default);
|
|
46
|
-
app.component("m-fields-event-select", EventSelect_default);
|
|
47
|
-
app.component("m-fields-data-source-fields", DataSourceFields_default);
|
|
48
|
-
app.component("m-fields-data-source-mocks", DataSourceMocks_default);
|
|
49
|
-
app.component("m-fields-key-value", KeyValue_default);
|
|
50
|
-
app.component("m-fields-data-source-input", DataSourceInput_default);
|
|
51
|
-
app.component("m-fields-data-source-select", DataSourceSelect_default);
|
|
52
|
-
app.component("m-fields-data-source-methods", DataSourceMethods_default);
|
|
53
|
-
app.component("m-fields-data-source-method-select", DataSourceMethodSelect_default);
|
|
54
|
-
app.component("m-fields-data-source-field-select", Index_default);
|
|
55
|
-
app.component("m-fields-page-fragment-select", PageFragmentSelect_default);
|
|
56
|
-
app.component("m-fields-display-conds", DisplayConds_default);
|
|
57
|
-
app.component("m-fields-cond-op-select", CondOpSelect_default);
|
|
58
|
-
app.component("m-form-style-setter", Index_default$1);
|
|
59
71
|
} };
|
|
60
72
|
//#endregion
|
|
61
73
|
export { plugin_default as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CODE_DRAFT_STORAGE_KEY } from "../type.js";
|
|
2
|
-
import BaseService from "./BaseService.js";
|
|
3
2
|
import { getEditorConfig } from "../utils/config.js";
|
|
3
|
+
import BaseService from "./BaseService.js";
|
|
4
4
|
import { createStackStep, describeRevertStep, getLastPushedHistoryIds } from "../utils/history.js";
|
|
5
5
|
import history_default from "./history.js";
|
|
6
6
|
import storage_default, { Protocol } from "./storage.js";
|
|
@@ -56,6 +56,7 @@ var CodeBlock = class extends BaseService {
|
|
|
56
56
|
async setCodeDsl(codeDsl) {
|
|
57
57
|
this.state.codeDsl = codeDsl;
|
|
58
58
|
this.emit("code-dsl-change", this.state.codeDsl);
|
|
59
|
+
this.emit("change", this.state.codeDsl);
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
61
62
|
* 获取活动的代码块dsl数据源(默认从dsl中的codeBlocks字段读取)
|
|
@@ -132,6 +133,7 @@ var CodeBlock = class extends BaseService {
|
|
|
132
133
|
this.lastPushedHistoryId = (step ? history_default.push("codeBlock", step, id) : null)?.uuid ?? null;
|
|
133
134
|
}
|
|
134
135
|
this.emit("addOrUpdate", id, codeDsl[id]);
|
|
136
|
+
this.emit("change", this.getCodeDsl());
|
|
135
137
|
}
|
|
136
138
|
/**
|
|
137
139
|
* 根据代码块id数组获取代码dsl
|
|
@@ -139,7 +141,8 @@ var CodeBlock = class extends BaseService {
|
|
|
139
141
|
* @returns {CodeBlockDSL}
|
|
140
142
|
*/
|
|
141
143
|
getCodeDslByIds(ids) {
|
|
142
|
-
|
|
144
|
+
const codeDsl = this.getCodeDsl();
|
|
145
|
+
return pick(codeDsl, ids);
|
|
143
146
|
}
|
|
144
147
|
/**
|
|
145
148
|
* 获取编辑状态
|
|
@@ -229,6 +232,7 @@ var CodeBlock = class extends BaseService {
|
|
|
229
232
|
}
|
|
230
233
|
this.emit("remove", id);
|
|
231
234
|
});
|
|
235
|
+
this.emit("change", this.getCodeDsl());
|
|
232
236
|
}
|
|
233
237
|
/**
|
|
234
238
|
* 下列 *AndGetHistoryId 方法与对应的写入方法行为完全一致,
|
|
@@ -368,7 +372,8 @@ var CodeBlock = class extends BaseService {
|
|
|
368
372
|
*/
|
|
369
373
|
async getUniqueId() {
|
|
370
374
|
const newId = `code_${Math.random().toString(10).substring(2).substring(0, 4)}`;
|
|
371
|
-
|
|
375
|
+
const dsl = await this.getCodeDsl();
|
|
376
|
+
if (!keys(dsl).includes(newId)) return newId;
|
|
372
377
|
return await this.getUniqueId();
|
|
373
378
|
}
|
|
374
379
|
/**
|
|
@@ -102,6 +102,7 @@ var DataSource = class extends BaseService {
|
|
|
102
102
|
this.lastPushedHistoryId = (step ? history_default.push("dataSource", step, newConfig.id) : null)?.uuid ?? null;
|
|
103
103
|
}
|
|
104
104
|
this.emit("add", newConfig);
|
|
105
|
+
this.emit("change", this.get("dataSources"));
|
|
105
106
|
return newConfig;
|
|
106
107
|
}
|
|
107
108
|
/**
|
|
@@ -132,6 +133,7 @@ var DataSource = class extends BaseService {
|
|
|
132
133
|
oldConfig,
|
|
133
134
|
changeRecords
|
|
134
135
|
});
|
|
136
|
+
this.emit("change", this.get("dataSources"));
|
|
135
137
|
return newConfig;
|
|
136
138
|
}
|
|
137
139
|
/**
|
|
@@ -156,6 +158,7 @@ var DataSource = class extends BaseService {
|
|
|
156
158
|
this.lastPushedHistoryId = (step ? history_default.push("dataSource", step, id) : null)?.uuid ?? null;
|
|
157
159
|
}
|
|
158
160
|
this.emit("remove", id);
|
|
161
|
+
this.emit("change", this.get("dataSources"));
|
|
159
162
|
}
|
|
160
163
|
/**
|
|
161
164
|
* 下列 *AndGetHistoryId 方法与对应的 add / update / remove 行为完全一致,
|