@tmagic/editor 1.8.0-beta.10 → 1.8.0-beta.12
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 +7 -4
- package/dist/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +60 -14
- package/dist/es/components/ScrollBar.js +0 -1
- package/dist/es/editorProps.js +6 -1
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +15 -3
- package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +2 -17
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +7 -0
- package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +5 -17
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +29 -3
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +50 -88
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +2 -5
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +48 -23
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +6 -3
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +28 -22
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +28 -22
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +28 -22
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +6 -3
- package/dist/es/fields/UISelect.js +0 -1
- package/dist/es/index.js +9 -6
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +21 -6
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +9 -6
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +14 -4
- package/dist/es/layouts/history-list/composables.js +1 -1
- package/dist/es/layouts/history-list/useHistoryRevert.js +17 -6
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +44 -5
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +15 -8
- package/dist/es/layouts/props-panel/use-style-panel.js +3 -2
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +15 -31
- package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/sidebar/code-block/useContentMenu.js +18 -3
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/sidebar/data-source/useContentMenu.js +18 -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/LayerPanel.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/plugin.js +3 -1
- package/dist/es/services/editor.js +104 -5
- package/dist/es/services/props.js +2 -1
- package/dist/es/services/storage.js +1 -1
- package/dist/es/services/ui.js +3 -0
- package/dist/es/style.css +104 -55
- package/dist/es/utils/data-source/index.js +30 -11
- package/dist/es/utils/event.js +123 -0
- package/dist/es/utils/monaco-editor.js +22 -6
- package/dist/es/utils/props.js +94 -8
- package/dist/es/utils/type-match-rules.js +360 -0
- package/dist/style.css +104 -55
- package/dist/tmagic-editor.umd.cjs +16923 -15771
- package/package.json +8 -8
- package/src/Editor.vue +3 -1
- package/src/components/CodeBlockEditor.vue +3 -0
- package/src/components/CompareForm.vue +7 -0
- package/src/components/FloatingBox.vue +77 -8
- package/src/components/ScrollBar.vue +0 -67
- package/src/editorProps.ts +13 -0
- package/src/fields/CodeSelect.vue +4 -1
- package/src/fields/CondOpSelect.vue +2 -24
- package/src/fields/DataSourceFields.vue +5 -0
- package/src/fields/DataSourceInput.vue +7 -25
- package/src/fields/DataSourceMocks.vue +3 -0
- package/src/fields/DisplayConds.vue +14 -0
- package/src/fields/EventSelect.vue +84 -129
- package/src/fields/StyleSetter/Index.vue +2 -8
- package/src/fields/StyleSetter/pro/Background.vue +94 -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 +140 -138
- 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/index.ts +1 -0
- package/src/layouts/CodeEditor.vue +32 -6
- package/src/layouts/Framework.vue +7 -6
- package/src/layouts/history-list/HistoryDiffDialog.vue +23 -5
- package/src/layouts/history-list/useHistoryRevert.ts +25 -5
- package/src/layouts/props-panel/FormPanel.vue +66 -5
- package/src/layouts/props-panel/PropsPanel.vue +20 -6
- package/src/layouts/props-panel/use-style-panel.ts +4 -3
- package/src/layouts/sidebar/Sidebar.vue +2 -0
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +4 -1
- package/src/layouts/sidebar/code-block/useContentMenu.ts +13 -1
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +3 -0
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +2 -2
- package/src/layouts/sidebar/data-source/useContentMenu.ts +13 -1
- package/src/layouts/sidebar/layer/LayerNodeContent.vue +57 -0
- package/src/layouts/sidebar/layer/LayerPanel.vue +4 -1
- package/src/layouts/workspace/viewer/NodeListMenu.vue +4 -1
- package/src/plugin.ts +3 -1
- package/src/services/editor.ts +168 -3
- package/src/services/ui.ts +6 -0
- package/src/theme/event.scss +8 -0
- package/src/theme/floating-box.scss +9 -1
- package/src/theme/layer-node-content.scss +14 -0
- package/src/theme/scroll-bar.scss +64 -0
- package/src/theme/theme.scss +3 -0
- package/src/theme/ui-select.scss +9 -0
- package/src/type.ts +72 -2
- package/src/utils/data-source/index.ts +30 -12
- package/src/utils/event.ts +224 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/monaco-editor.ts +27 -0
- package/src/utils/props.ts +160 -2
- package/src/utils/type-match-rules.ts +678 -0
- package/types/index.d.ts +391 -85
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CODE_DRAFT_STORAGE_KEY, CodeDeleteErrorType, ColumnLayout, DragType, KeyBindingCommand, Keys, LayerOffset, Layout, SideItemKey, canUsePluginMethods } from "./type.js";
|
|
2
2
|
import { useCodeBlockEdit } from "./hooks/use-code-block-edit.js";
|
|
3
|
-
import { advancedTabConfig, arrayOptions, displayTabConfig, eqOptions, eventTabConfig, fillConfig, numberOptions, styleTabConfig } from "./utils/props.js";
|
|
3
|
+
import { advancedTabConfig, arrayOptions, booleanOptions, displayTabConfig, eqOptions, eventTabConfig, fillConfig, getCondOpOptionsByFieldType, numberOptions, styleTabConfig, validatePropsForm } from "./utils/props.js";
|
|
4
4
|
import props_default from "./services/props.js";
|
|
5
5
|
import { getEditorConfig, setEditorConfig } from "./utils/config.js";
|
|
6
6
|
import { UndoRedo } from "./utils/undo-redo.js";
|
|
@@ -25,9 +25,14 @@ import { useNextFloatBoxPosition } from "./hooks/use-next-float-box-position.js"
|
|
|
25
25
|
import { useNodeStatus } from "./hooks/use-node-status.js";
|
|
26
26
|
import { getCodeBlockFormConfig } from "./utils/code-block.js";
|
|
27
27
|
import { debug, error, info, log, warn } from "./utils/logger.js";
|
|
28
|
-
import { getCascaderOptionsFromFields, getDisplayField, getFieldType, getFormConfig, getFormValue } from "./utils/data-source/index.js";
|
|
28
|
+
import { getCascaderOptionsFromFields, getDisplayField, getFieldType, getFormConfig, getFormValue, resolveFieldByPath } from "./utils/data-source/index.js";
|
|
29
29
|
import { IdleTask } from "./utils/dep/idle-task.js";
|
|
30
30
|
import { ScrollViewer } from "./utils/scroll-viewer.js";
|
|
31
|
+
import codeBlock_default from "./services/codeBlock.js";
|
|
32
|
+
import dataSource_default from "./services/dataSource.js";
|
|
33
|
+
import { ALL_COND_OPS, editorTypeMatchRules } from "./utils/type-match-rules.js";
|
|
34
|
+
import events_default from "./services/events.js";
|
|
35
|
+
import { EVENT_NAME_VALUE_SEPARATOR, collectEventNameOptionValues, getCompActionAllowedValues, getCompActionOptions, getEventNameAllowedValues, getEventNameOptions, isEventNameCheckStrictly, normalizeCompActionValue } from "./utils/event.js";
|
|
31
36
|
import monaco_editor_default from "./utils/monaco-editor.js";
|
|
32
37
|
import Resizer_default from "./components/Resizer.js";
|
|
33
38
|
import SplitView_default from "./components/SplitView.js";
|
|
@@ -49,13 +54,11 @@ import CodeBlockList_default from "./layouts/sidebar/code-block/CodeBlockList.js
|
|
|
49
54
|
import CodeBlockListPanel_default from "./layouts/sidebar/code-block/CodeBlockListPanel.js";
|
|
50
55
|
import DataSourceAddButton_default from "./layouts/sidebar/data-source/DataSourceAddButton.js";
|
|
51
56
|
import DataSourceConfigPanel_default from "./layouts/sidebar/data-source/DataSourceConfigPanel.js";
|
|
57
|
+
import LayerNodeContent_default from "./layouts/sidebar/layer/LayerNodeContent.js";
|
|
52
58
|
import LayerPanel_default from "./layouts/sidebar/layer/LayerPanel.js";
|
|
53
59
|
import ComponentListPanel_default from "./layouts/sidebar/ComponentListPanel.js";
|
|
54
|
-
import codeBlock_default from "./services/codeBlock.js";
|
|
55
60
|
import componentList_default from "./services/componentList.js";
|
|
56
|
-
import dataSource_default from "./services/dataSource.js";
|
|
57
61
|
import dep_default from "./services/dep.js";
|
|
58
|
-
import events_default from "./services/events.js";
|
|
59
62
|
import keybinding_default from "./services/keybinding.js";
|
|
60
63
|
import stageOverlay_default from "./services/stageOverlay.js";
|
|
61
64
|
import Editor_default from "./Editor.js";
|
|
@@ -87,4 +90,4 @@ export * from "@tmagic/table";
|
|
|
87
90
|
export * from "@tmagic/stage";
|
|
88
91
|
export * from "@tmagic/design";
|
|
89
92
|
export * from "@tmagic/utils";
|
|
90
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CodeBlockEditor_default as CodeBlockEditor, CodeBlockList_default as CodeBlockList, CodeBlockListPanel_default as CodeBlockListPanel, CodeDeleteErrorType, CodeSelect_default as CodeSelect, CodeSelectCol_default as CodeSelectCol, ColumnLayout, CompareForm_default as CompareForm, ComponentListPanel_default as ComponentListPanel, CondOpSelect_default as CondOpSelect, ContentMenu_default as ContentMenu, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, DataSourceAddButton_default as DataSourceAddButton, DataSourceConfigPanel_default as DataSourceConfigPanel, Index_default as DataSourceFieldSelect, DataSourceFields_default as DataSourceFields, DataSourceInput_default as DataSourceInput, DataSourceMethodSelect_default as DataSourceMethodSelect, DataSourceMethods_default as DataSourceMethods, DataSourceMocks_default as DataSourceMocks, DataSourceSelect_default as DataSourceSelect, DepTargetType, DisplayConds_default as DisplayConds, DragType, EventSelect_default as EventSelect, Fixed2Other, FloatingBox_default as FloatingBox, H_GUIDE_LINE_STORAGE_KEY, HistoryDiffDialog_default as HistoryDiffDialog, Bucket_default as HistoryListBucket, BucketTab_default as HistoryListBucketTab, Icon_default as Icon, IdleTask, KeyBindingCommand, KeyValue_default as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerOffset, LayerPanel_default as LayerPanel, Layout, SplitView_default as LayoutContainer, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, PROPS_PANEL_WIDTH_STORAGE_KEY, PageFragmentSelect_default as PageFragmentSelect, FormPanel_default as PropsFormPanel, PropsPanel_default as PropsPanel, RIGHT_COLUMN_WIDTH_STORAGE_KEY, Resizer_default as Resizer, ScrollViewer, SideItemKey, SplitView_default as SplitView, StageCore, Index_default$1 as StyleSetter, CodeEditor_default as TMagicCodeEditor, Editor_default as TMagicEditor, ToolButton_default as ToolButton, Tree_default as Tree, TreeNode_default as TreeNode, UI_SELECT_MODE_EVENT_NAME, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, codeBlock_default as codeBlockService, collectRelatedNodes, componentList_default as componentListService, confirmHistoryAction, createStackStep, dataSource_default as dataSourceService, debug, plugin_default as default, defaultIsExpandable, dep_default as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin, detectStackOpType, detectTargetId, detectTargetName, displayTabConfig, editorNodeMergeCustomizer, editor_default as editorService, eqOptions, error, eventTabConfig, events_default as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getCodeBlockFormConfig, getDefaultConfig, getDisplayField, getEditorConfig, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getLastPushedHistoryIds, getNodeIndex, getOrCreateStack, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, history_default as historyService, idbDelete, idbGet, idbSet, info, isIncludeDataSource, isIndexedDBSupported, keybinding_default as keybindingService, monaco_editor_default as loadMonaco, log, markStackSaved, mergeSteps, moveItemsInContainer, numberOptions, openIndexedDB, props_default as propsService, resolveSelectedNode, serializeConfig, serializeStacks, setChildrenLayout, setEditorConfig, setLayout, stageOverlay_default as stageOverlayService, storage_default as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, ui_default as uiService, undoFloor, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useHistoryRevert, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
|
|
93
|
+
export { ALL_COND_OPS, CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CodeBlockEditor_default as CodeBlockEditor, CodeBlockList_default as CodeBlockList, CodeBlockListPanel_default as CodeBlockListPanel, CodeDeleteErrorType, CodeSelect_default as CodeSelect, CodeSelectCol_default as CodeSelectCol, ColumnLayout, CompareForm_default as CompareForm, ComponentListPanel_default as ComponentListPanel, CondOpSelect_default as CondOpSelect, ContentMenu_default as ContentMenu, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, DataSourceAddButton_default as DataSourceAddButton, DataSourceConfigPanel_default as DataSourceConfigPanel, Index_default as DataSourceFieldSelect, DataSourceFields_default as DataSourceFields, DataSourceInput_default as DataSourceInput, DataSourceMethodSelect_default as DataSourceMethodSelect, DataSourceMethods_default as DataSourceMethods, DataSourceMocks_default as DataSourceMocks, DataSourceSelect_default as DataSourceSelect, DepTargetType, DisplayConds_default as DisplayConds, DragType, EVENT_NAME_VALUE_SEPARATOR, EventSelect_default as EventSelect, Fixed2Other, FloatingBox_default as FloatingBox, H_GUIDE_LINE_STORAGE_KEY, HistoryDiffDialog_default as HistoryDiffDialog, Bucket_default as HistoryListBucket, BucketTab_default as HistoryListBucketTab, Icon_default as Icon, IdleTask, KeyBindingCommand, KeyValue_default as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerNodeContent_default as LayerNodeContent, LayerOffset, LayerPanel_default as LayerPanel, Layout, SplitView_default as LayoutContainer, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, PROPS_PANEL_WIDTH_STORAGE_KEY, PageFragmentSelect_default as PageFragmentSelect, FormPanel_default as PropsFormPanel, PropsPanel_default as PropsPanel, RIGHT_COLUMN_WIDTH_STORAGE_KEY, Resizer_default as Resizer, ScrollViewer, SideItemKey, SplitView_default as SplitView, StageCore, Index_default$1 as StyleSetter, CodeEditor_default as TMagicCodeEditor, Editor_default as TMagicEditor, ToolButton_default as ToolButton, Tree_default as Tree, TreeNode_default as TreeNode, UI_SELECT_MODE_EVENT_NAME, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, arrayOptions, beforePaste, booleanOptions, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, codeBlock_default as codeBlockService, collectEventNameOptionValues, collectRelatedNodes, componentList_default as componentListService, confirmHistoryAction, createStackStep, dataSource_default as dataSourceService, debug, plugin_default as default, defaultIsExpandable, dep_default as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin, detectStackOpType, detectTargetId, detectTargetName, displayTabConfig, editorNodeMergeCustomizer, editor_default as editorService, editorTypeMatchRules, eqOptions, error, eventTabConfig, events_default as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getCodeBlockFormConfig, getCompActionAllowedValues, getCompActionOptions, getCondOpOptionsByFieldType, getDefaultConfig, getDisplayField, getEditorConfig, getEventNameAllowedValues, getEventNameOptions, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getLastPushedHistoryIds, getNodeIndex, getOrCreateStack, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, history_default as historyService, idbDelete, idbGet, idbSet, info, isEventNameCheckStrictly, isIncludeDataSource, isIndexedDBSupported, keybinding_default as keybindingService, monaco_editor_default as loadMonaco, log, markStackSaved, mergeSteps, moveItemsInContainer, normalizeCompActionValue, numberOptions, openIndexedDB, props_default as propsService, resolveFieldByPath, resolveSelectedNode, serializeConfig, serializeStacks, setChildrenLayout, setEditorConfig, setLayout, stageOverlay_default as stageOverlayService, storage_default as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, ui_default as uiService, undoFloor, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useHistoryRevert, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, validatePropsForm, warn };
|
|
@@ -110,6 +110,7 @@ var CodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
110
110
|
const values = ref("");
|
|
111
111
|
const loading = ref(false);
|
|
112
112
|
const codeEditorEl = useTemplateRef("codeEditor");
|
|
113
|
+
let destroyed = false;
|
|
113
114
|
const resizeObserver = new globalThis.ResizeObserver(throttle(() => {
|
|
114
115
|
vsEditor?.layout();
|
|
115
116
|
vsDiffEditor?.layout();
|
|
@@ -150,11 +151,17 @@ var CodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
150
151
|
emit("save", props.parse ? parseCode(newValue, props.language) : newValue);
|
|
151
152
|
}
|
|
152
153
|
};
|
|
154
|
+
const isEditorElValid = () => !destroyed && !!codeEditorEl.value && codeEditorEl.value.isConnected;
|
|
153
155
|
const init = async () => {
|
|
154
|
-
if (!
|
|
155
|
-
if (codeEditorEl.value.clientHeight === 0)
|
|
156
|
+
if (!isEditorElValid()) return;
|
|
157
|
+
if (codeEditorEl.value.clientHeight === 0) {
|
|
158
|
+
await nextTick();
|
|
159
|
+
if (!isEditorElValid()) return;
|
|
160
|
+
}
|
|
156
161
|
cachedExtraHeight = null;
|
|
157
162
|
monaco = await monaco_editor_default();
|
|
163
|
+
if (!isEditorElValid()) return;
|
|
164
|
+
const editorEl = codeEditorEl.value;
|
|
158
165
|
const options = {
|
|
159
166
|
value: values.value,
|
|
160
167
|
language: props.language,
|
|
@@ -163,19 +170,26 @@ var CodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
163
170
|
...props.options
|
|
164
171
|
};
|
|
165
172
|
if (props.type === "diff") {
|
|
166
|
-
vsDiffEditor = await getEditorConfig("customCreateMonacoDiffEditor")(monaco,
|
|
173
|
+
vsDiffEditor = await getEditorConfig("customCreateMonacoDiffEditor")(monaco, editorEl, options);
|
|
167
174
|
vsDiffEditor.getModifiedEditor().onDidChangeModelContent(() => {
|
|
168
175
|
if (props.autosize) setAutoHeight(getEditorValue());
|
|
169
176
|
});
|
|
170
177
|
} else {
|
|
171
|
-
vsEditor = await getEditorConfig("customCreateMonacoEditor")(monaco,
|
|
178
|
+
vsEditor = await getEditorConfig("customCreateMonacoEditor")(monaco, editorEl, options);
|
|
172
179
|
vsEditor.onDidChangeModelContent(() => {
|
|
173
180
|
if (props.autosize) setAutoHeight(getEditorValue());
|
|
174
181
|
});
|
|
175
182
|
}
|
|
183
|
+
if (destroyed) {
|
|
184
|
+
vsEditor?.dispose();
|
|
185
|
+
vsDiffEditor?.dispose();
|
|
186
|
+
vsEditor = null;
|
|
187
|
+
vsDiffEditor = null;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
176
190
|
setEditorValue(props.initValues, props.modifiedValues);
|
|
177
191
|
emit("initd", vsEditor);
|
|
178
|
-
|
|
192
|
+
editorEl.addEventListener("keydown", handleKeyDown);
|
|
179
193
|
if (props.type !== "diff" && props.autoSave) vsEditor?.onDidBlurEditorWidget(() => {
|
|
180
194
|
const newValue = getEditorValue();
|
|
181
195
|
if (values.value !== newValue) {
|
|
@@ -183,7 +197,7 @@ var CodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
183
197
|
emit("save", props.parse ? parseCode(newValue, props.language) : newValue);
|
|
184
198
|
}
|
|
185
199
|
});
|
|
186
|
-
resizeObserver.observe(
|
|
200
|
+
resizeObserver.observe(editorEl);
|
|
187
201
|
};
|
|
188
202
|
watch(() => props.initValues, (v, preV) => {
|
|
189
203
|
if (v !== preV) setEditorValue(props.initValues, props.modifiedValues);
|
|
@@ -205,6 +219,7 @@ var CodeEditor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
205
219
|
loading.value = false;
|
|
206
220
|
});
|
|
207
221
|
onBeforeUnmount(() => {
|
|
222
|
+
destroyed = true;
|
|
208
223
|
resizeObserver.disconnect();
|
|
209
224
|
vsEditor?.dispose();
|
|
210
225
|
vsDiffEditor?.dispose();
|
|
@@ -33,6 +33,9 @@ var Framework_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
33
33
|
const pageLength = computed(() => editorService.get("pageLength") || 0);
|
|
34
34
|
const showSrc = computed(() => uiService.get("showSrc"));
|
|
35
35
|
const columnWidth = computed(() => uiService.get("columnWidth"));
|
|
36
|
+
const minLeftColumnWidth = computed(() => uiService.get("minLeftColumnWidth"));
|
|
37
|
+
const minCenterColumnWidth = computed(() => uiService.get("minCenterColumnWidth"));
|
|
38
|
+
const minRightColumnWidth = computed(() => uiService.get("minRightColumnWidth"));
|
|
36
39
|
watch(pageLength, () => {
|
|
37
40
|
splitViewRef.value?.updateWidth();
|
|
38
41
|
});
|
|
@@ -76,13 +79,13 @@ var Framework_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
76
79
|
renderSlot(_ctx.$slots, "header"),
|
|
77
80
|
renderSlot(_ctx.$slots, "nav"),
|
|
78
81
|
renderSlot(_ctx.$slots, "content-before"),
|
|
79
|
-
showSrc.value ? renderSlot(_ctx.$slots, "src-code", {
|
|
82
|
+
showSrc.value ? renderSlot(_ctx.$slots, "src-code", {}, () => [createVNode(CodeEditor_default, {
|
|
80
83
|
class: "m-editor-content",
|
|
81
84
|
"editor-custom-type": "m-editor-content",
|
|
82
85
|
"init-values": root.value,
|
|
83
86
|
options: unref(codeOptions),
|
|
84
87
|
onSave: saveCode
|
|
85
|
-
}, null, 8, ["init-values", "options"])]) : createCommentVNode("v-if", true),
|
|
88
|
+
}, null, 8, ["init-values", "options"])], void 0, 0) : createCommentVNode("v-if", true),
|
|
86
89
|
withDirectives(createVNode(SplitView_default, {
|
|
87
90
|
ref: "splitView",
|
|
88
91
|
class: "m-editor-content",
|
|
@@ -91,13 +94,13 @@ var Framework_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
91
94
|
"right-class": "m-editor-framework-right",
|
|
92
95
|
left: __props.hideSidebar ? void 0 : columnWidth.value.left,
|
|
93
96
|
right: columnWidth.value.right,
|
|
94
|
-
"min-left": __props.hideSidebar ? 0 :
|
|
95
|
-
"min-right":
|
|
96
|
-
"min-center":
|
|
97
|
+
"min-left": __props.hideSidebar ? 0 : minLeftColumnWidth.value,
|
|
98
|
+
"min-right": minRightColumnWidth.value,
|
|
99
|
+
"min-center": minCenterColumnWidth.value,
|
|
97
100
|
width: frameworkRect.value.width,
|
|
98
101
|
onChange: columnWidthChange
|
|
99
102
|
}, createSlots({
|
|
100
|
-
center: withCtx(() => [page.value ? renderSlot(_ctx.$slots, "workspace", {
|
|
103
|
+
center: withCtx(() => [page.value ? renderSlot(_ctx.$slots, "workspace", {}, void 0, void 0, 0) : renderSlot(_ctx.$slots, "empty", {}, () => [createVNode(AddPageBox_default, { "disabled-page-fragment": __props.disabledPageFragment }, null, 8, ["disabled-page-fragment"])], void 0, 1), renderSlot(_ctx.$slots, "page-bar", {}, () => [createVNode(PageBar_default, {
|
|
101
104
|
"disabled-page-fragment": __props.disabledPageFragment,
|
|
102
105
|
"page-bar-sort-options": __props.pageBarSortOptions,
|
|
103
106
|
"filter-function": __props.pageFilterFunction
|
package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -28,6 +28,7 @@ var HistoryDiffDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
28
28
|
extendState: {},
|
|
29
29
|
loadConfig: {},
|
|
30
30
|
width: { default: "900px" },
|
|
31
|
+
size: {},
|
|
31
32
|
isConfirm: { type: Boolean },
|
|
32
33
|
onConfirm: {},
|
|
33
34
|
selfDiffFieldTypes: {},
|
|
@@ -67,11 +68,18 @@ var HistoryDiffDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
67
68
|
const hasCurrent = computed(() => payload.value?.currentValue !== void 0 && payload.value?.currentValue !== null);
|
|
68
69
|
/** 是否存在该步「修改后的值」:不存在(如仅删除)时「与修改前对比」无意义,置灰禁用。 */
|
|
69
70
|
const hasValue = computed(() => payload.value?.value !== void 0 && payload.value?.value !== null);
|
|
71
|
+
/** 指定模式当前是否可用:before 依赖「修改后的值」,current 依赖「当前值」。 */
|
|
72
|
+
const isModeAvailable = (m) => m === "current" ? hasCurrent.value : hasValue.value;
|
|
70
73
|
/**
|
|
71
74
|
* 计算 open 时的初始对比模式:
|
|
72
|
-
*
|
|
75
|
+
* - 调用方通过 payload.mode 指定且该模式可用时,优先使用指定模式;
|
|
76
|
+
* - 否则没有「修改后的值」但有当前值时(「与修改前对比」不可用),默认进入「与当前对比」;
|
|
77
|
+
* - 其余情况默认「与修改前对比」。
|
|
73
78
|
*/
|
|
74
|
-
const resolveInitialMode = () =>
|
|
79
|
+
const resolveInitialMode = (specified) => {
|
|
80
|
+
if (specified && isModeAvailable(specified)) return specified;
|
|
81
|
+
return !hasValue.value && hasCurrent.value ? "current" : "before";
|
|
82
|
+
};
|
|
75
83
|
/** 左侧(旧/参照)值 */
|
|
76
84
|
const leftValue = computed(() => {
|
|
77
85
|
if (!payload.value) return {};
|
|
@@ -114,7 +122,7 @@ var HistoryDiffDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
114
122
|
});
|
|
115
123
|
const open = (p) => {
|
|
116
124
|
payload.value = p;
|
|
117
|
-
mode.value = resolveInitialMode();
|
|
125
|
+
mode.value = resolveInitialMode(p.mode);
|
|
118
126
|
viewMode.value = "form";
|
|
119
127
|
visible.value = true;
|
|
120
128
|
};
|
|
@@ -251,6 +259,7 @@ var HistoryDiffDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
251
259
|
"load-config": __props.loadConfig,
|
|
252
260
|
"self-diff-field-types": __props.selfDiffFieldTypes,
|
|
253
261
|
services: props.services,
|
|
262
|
+
size: props.size,
|
|
254
263
|
height: "70vh"
|
|
255
264
|
}, null, 8, [
|
|
256
265
|
"category",
|
|
@@ -262,7 +271,8 @@ var HistoryDiffDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
262
271
|
"extend-state",
|
|
263
272
|
"load-config",
|
|
264
273
|
"self-diff-field-types",
|
|
265
|
-
"services"
|
|
274
|
+
"services",
|
|
275
|
+
"size"
|
|
266
276
|
])) : (openBlock(), createBlock(CodeEditor_default, {
|
|
267
277
|
key: 2,
|
|
268
278
|
type: "diff",
|
|
@@ -181,4 +181,4 @@ var confirmHistoryAction = async (message) => {
|
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
183
|
//#endregion
|
|
184
|
-
export { confirmHistoryAction, describePageGroup, describePageStep, describeStep, formatHistoryFullTime, formatHistoryTime, isHistoryGroupExpanded, isPageStepRevertable, isSingleDiffStepRevertable, opLabel, sourceLabel, toRowGroup };
|
|
184
|
+
export { confirmHistoryAction, describePageGroup, describePageStep, describeStep, formatHistoryFullTime, formatHistoryTime, groupOperator, groupSource, groupTimestamp, isHistoryGroupExpanded, isPageStepRevertable, isSingleDiffStepRevertable, opLabel, sourceLabel, toRowGroup };
|
|
@@ -47,6 +47,8 @@ var mountHistoryDiffDialog = async (options) => {
|
|
|
47
47
|
loadConfig: options.loadConfig,
|
|
48
48
|
selfDiffFieldTypes: options.selfDiffFieldTypes,
|
|
49
49
|
compareFormState: options.compareFormState,
|
|
50
|
+
width: options.width,
|
|
51
|
+
size: options.size ?? options.services?.uiService?.get("propsPanelSize"),
|
|
50
52
|
onClose: options.onClose
|
|
51
53
|
});
|
|
52
54
|
if (options.appContext) Object.assign(app._context, options.appContext);
|
|
@@ -125,7 +127,7 @@ var viewHistoryDiffDialog = async (payload, options) => {
|
|
|
125
127
|
*/
|
|
126
128
|
var useHistoryRevert = (options = {}, services) => {
|
|
127
129
|
const appContext = options.appContext ?? getCurrentInstance()?.appContext ?? null;
|
|
128
|
-
const { extendState, getPropsPanelFormState } = options;
|
|
130
|
+
const { extendState, getPropsPanelFormState, dialogWidth } = options;
|
|
129
131
|
/** 目标数据已被删除、无法回滚时的统一提示。 */
|
|
130
132
|
const showRevertTargetMissing = () => {
|
|
131
133
|
tMagicMessage.error("回滚失败:该记录对应的数据已被删除");
|
|
@@ -146,7 +148,9 @@ var useHistoryRevert = (options = {}, services) => {
|
|
|
146
148
|
appContext,
|
|
147
149
|
extendState,
|
|
148
150
|
services,
|
|
149
|
-
...extra
|
|
151
|
+
...extra,
|
|
152
|
+
width: extra?.width ?? dialogWidth,
|
|
153
|
+
size: extra?.size
|
|
150
154
|
});
|
|
151
155
|
return confirmRevert();
|
|
152
156
|
};
|
|
@@ -227,6 +231,7 @@ var useHistoryRevert = (options = {}, services) => {
|
|
|
227
231
|
appContext,
|
|
228
232
|
extendState,
|
|
229
233
|
services,
|
|
234
|
+
width: dialogWidth,
|
|
230
235
|
compareFormState: getPropsPanelFormState?.()
|
|
231
236
|
});
|
|
232
237
|
};
|
|
@@ -235,7 +240,8 @@ var useHistoryRevert = (options = {}, services) => {
|
|
|
235
240
|
if (payload) return viewHistoryDiffDialog(payload, {
|
|
236
241
|
appContext,
|
|
237
242
|
extendState,
|
|
238
|
-
services
|
|
243
|
+
services,
|
|
244
|
+
width: dialogWidth
|
|
239
245
|
});
|
|
240
246
|
};
|
|
241
247
|
const onCodeBlockDiff = (id, index) => {
|
|
@@ -243,7 +249,8 @@ var useHistoryRevert = (options = {}, services) => {
|
|
|
243
249
|
if (payload) return viewHistoryDiffDialog(payload, {
|
|
244
250
|
appContext,
|
|
245
251
|
extendState,
|
|
246
|
-
services
|
|
252
|
+
services,
|
|
253
|
+
width: dialogWidth
|
|
247
254
|
});
|
|
248
255
|
};
|
|
249
256
|
/**
|
|
@@ -269,7 +276,9 @@ var useHistoryRevert = (options = {}, services) => {
|
|
|
269
276
|
}
|
|
270
277
|
if (!await runRevert(revertOptions.diffPayload ?? null, {
|
|
271
278
|
loadConfig: revertOptions.loadConfig,
|
|
272
|
-
selfDiffFieldTypes: revertOptions.selfDiffFieldTypes
|
|
279
|
+
selfDiffFieldTypes: revertOptions.selfDiffFieldTypes,
|
|
280
|
+
width: revertOptions.width,
|
|
281
|
+
size: revertOptions.size
|
|
273
282
|
})) return null;
|
|
274
283
|
return await revertOptions.revert();
|
|
275
284
|
};
|
|
@@ -282,7 +291,9 @@ var useHistoryRevert = (options = {}, services) => {
|
|
|
282
291
|
appContext,
|
|
283
292
|
extendState,
|
|
284
293
|
services,
|
|
285
|
-
...extra
|
|
294
|
+
...extra,
|
|
295
|
+
width: extra?.width ?? dialogWidth,
|
|
296
|
+
size: extra?.size
|
|
286
297
|
});
|
|
287
298
|
};
|
|
288
299
|
return {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { validatePropsForm } from "../../utils/props.js";
|
|
1
2
|
import { useServices } from "../../hooks/use-services.js";
|
|
2
3
|
import { useEditorContentHeight } from "../../hooks/use-editor-content-height.js";
|
|
3
4
|
import Icon_default from "../../components/Icon.js";
|
|
4
5
|
import CodeEditor_default from "../CodeEditor.js";
|
|
6
|
+
import { ENABLE_PROPS_FORM_VALIDATE } from "../../editorProps.js";
|
|
5
7
|
import { MForm } from "@tmagic/form";
|
|
6
|
-
import { TMagicButton, TMagicScrollbar } from "@tmagic/design";
|
|
8
|
+
import { TMagicButton, TMagicScrollbar, tMagicMessage } from "@tmagic/design";
|
|
9
|
+
import { filterXSS } from "@tmagic/utils";
|
|
7
10
|
import { computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, getCurrentInstance, inject, normalizeClass, onMounted, onUnmounted, openBlock, ref, renderSlot, unref, useTemplateRef, watchEffect, withCtx } from "vue";
|
|
8
11
|
import { Document } from "@element-plus/icons-vue";
|
|
9
12
|
//#region packages/editor/src/layouts/props-panel/FormPanel.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -30,6 +33,7 @@ var FormPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
30
33
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
31
34
|
const props = __props;
|
|
32
35
|
const emit = __emit;
|
|
36
|
+
const enablePropsFormValidate = inject(ENABLE_PROPS_FORM_VALIDATE, false);
|
|
33
37
|
const services = useServices();
|
|
34
38
|
const { editorService, uiService } = services;
|
|
35
39
|
const codeOptions = inject("codeOptions", {});
|
|
@@ -53,16 +57,50 @@ var FormPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
53
57
|
});
|
|
54
58
|
const submit = async (v, eventData) => {
|
|
55
59
|
try {
|
|
56
|
-
|
|
60
|
+
const values = await configFormRef.value?.submitForm();
|
|
61
|
+
emit("submit", values, eventData);
|
|
57
62
|
} catch (e) {
|
|
58
|
-
emit("submit
|
|
63
|
+
if (enablePropsFormValidate) emit("submit", v, eventData, e);
|
|
64
|
+
else emit("submit-error", e);
|
|
59
65
|
}
|
|
60
66
|
};
|
|
61
67
|
const errorHandler = (e) => {
|
|
62
68
|
emit("form-error", e);
|
|
63
69
|
};
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
/**
|
|
71
|
+
* 将校验错误文案安全地转为用于弹窗展示的 HTML。
|
|
72
|
+
*
|
|
73
|
+
* 文案形如 `字段 -> 主文案\n\n建议`,多条以结构性 `<br>` 拼接。为在保留换行排版的同时
|
|
74
|
+
* 避免 `${value}`/字段名中可能夹带的 HTML 造成 XSS:先按结构性 `<br>` 拆分,对每段做 HTML
|
|
75
|
+
* 转义后再把段内换行 `\n` 替换为 `<br>`,最后用 `<br>` 拼回。
|
|
76
|
+
*/
|
|
77
|
+
const formatValidateErrorHtml = (error) => error.split(/<br\s*\/?>/i).map((segment) => filterXSS(segment).replaceAll("\n", "<br>")).join("<br>");
|
|
78
|
+
const saveCode = async (values) => {
|
|
79
|
+
const newValues = props.codeValueKey ? { [props.codeValueKey]: values } : values;
|
|
80
|
+
if (!enablePropsFormValidate) {
|
|
81
|
+
emit("submit", newValues);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
const error = await validatePropsForm({
|
|
86
|
+
config: props.config,
|
|
87
|
+
values: newValues,
|
|
88
|
+
appContext: internalInstance?.appContext ?? null,
|
|
89
|
+
services,
|
|
90
|
+
stage: stage.value,
|
|
91
|
+
typeMatchValid: true,
|
|
92
|
+
extendState: props.extendState
|
|
93
|
+
});
|
|
94
|
+
if (error) tMagicMessage({
|
|
95
|
+
type: "error",
|
|
96
|
+
message: formatValidateErrorHtml(error),
|
|
97
|
+
dangerouslyUseHTMLString: true
|
|
98
|
+
});
|
|
99
|
+
emit("submit", newValues, void 0, error ? new Error(error) : void 0);
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.log("validateForm error", e);
|
|
102
|
+
emit("submit", newValues);
|
|
103
|
+
}
|
|
66
104
|
};
|
|
67
105
|
__expose({
|
|
68
106
|
configForm: configFormRef,
|
|
@@ -81,6 +119,7 @@ var FormPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
81
119
|
size: propsPanelSize.value,
|
|
82
120
|
"init-values": __props.values,
|
|
83
121
|
config: __props.config,
|
|
122
|
+
"type-match-valid": true,
|
|
84
123
|
"extend-state": __props.extendState,
|
|
85
124
|
onChange: submit,
|
|
86
125
|
onError: errorHandler
|
|
@@ -4,11 +4,12 @@ import { PROPS_PANEL_WIDTH_STORAGE_KEY } from "../../utils/const.js";
|
|
|
4
4
|
import { useServices } from "../../hooks/use-services.js";
|
|
5
5
|
import Resizer_default from "../../components/Resizer.js";
|
|
6
6
|
import Icon_default from "../../components/Icon.js";
|
|
7
|
+
import { ENABLE_PROPS_FORM_VALIDATE } from "../../editorProps.js";
|
|
7
8
|
import FormPanel_default from "./FormPanel.js";
|
|
8
9
|
import { useStylePanel } from "./use-style-panel.js";
|
|
9
10
|
import { TMagicButton } from "@tmagic/design";
|
|
10
11
|
import { setValueByKeyPath } from "@tmagic/utils";
|
|
11
|
-
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, renderSlot, unref, useTemplateRef, vShow, watch, watchEffect, withCtx, withDirectives } from "vue";
|
|
12
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, inject, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, renderSlot, unref, useTemplateRef, vShow, watch, watchEffect, withCtx, withDirectives } from "vue";
|
|
12
13
|
import { Close, Sugar } from "@element-plus/icons-vue";
|
|
13
14
|
//#region packages/editor/src/layouts/props-panel/PropsPanel.vue?vue&type=script&setup=true&lang.ts
|
|
14
15
|
var _hoisted_1 = {
|
|
@@ -32,6 +33,7 @@ var PropsPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
32
33
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
33
34
|
const emit = __emit;
|
|
34
35
|
const { editorService, uiService, propsService, storageService } = useServices();
|
|
36
|
+
const enablePropsFormValidate = inject(ENABLE_PROPS_FORM_VALIDATE, false);
|
|
35
37
|
const values = ref({});
|
|
36
38
|
const curFormConfig = ref([]);
|
|
37
39
|
const node = computed(() => editorService.get("node"));
|
|
@@ -54,7 +56,7 @@ var PropsPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
54
56
|
onBeforeUnmount(() => {
|
|
55
57
|
propsService.off("props-configs-change", init);
|
|
56
58
|
});
|
|
57
|
-
const submit = async (v, eventData) => {
|
|
59
|
+
const submit = async (v, eventData, error, source = "props") => {
|
|
58
60
|
try {
|
|
59
61
|
if (!v.id) v.id = values.value.id;
|
|
60
62
|
const newValue = {
|
|
@@ -72,7 +74,12 @@ var PropsPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
72
74
|
const historySource = eventData ? "props" : "code";
|
|
73
75
|
editorService.update(newValue, {
|
|
74
76
|
changeRecords: eventData?.changeRecords,
|
|
75
|
-
historySource
|
|
77
|
+
historySource,
|
|
78
|
+
...enablePropsFormValidate && error ? { invalidInfo: {
|
|
79
|
+
id: newValue.id,
|
|
80
|
+
source,
|
|
81
|
+
error: error?.message
|
|
82
|
+
} } : {}
|
|
76
83
|
});
|
|
77
84
|
} catch (e) {
|
|
78
85
|
emit("submit-error", e);
|
|
@@ -123,7 +130,7 @@ var PropsPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
123
130
|
values: values.value,
|
|
124
131
|
disabledShowSrc: __props.disabledShowSrc,
|
|
125
132
|
extendState: __props.extendState,
|
|
126
|
-
onSubmit: submit,
|
|
133
|
+
onSubmit: _cache[0] || (_cache[0] = (v, eventData, error) => submit(v, eventData, error, "props")),
|
|
127
134
|
onSubmitError: errorHandler,
|
|
128
135
|
onFormError: errorHandler,
|
|
129
136
|
onMounted: mountedHandler,
|
|
@@ -148,14 +155,14 @@ var PropsPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
148
155
|
values: values.value,
|
|
149
156
|
disabledShowSrc: __props.disabledShowSrc,
|
|
150
157
|
extendState: __props.extendState,
|
|
151
|
-
onSubmit: submit,
|
|
158
|
+
onSubmit: _cache[2] || (_cache[2] = (v, eventData, error) => submit(v, eventData, error, "style")),
|
|
152
159
|
onSubmitError: errorHandler,
|
|
153
160
|
onFormError: errorHandler
|
|
154
161
|
}, {
|
|
155
|
-
"props-form-panel-header": withCtx(() => [createElementVNode("div", _hoisted_2, [_cache[
|
|
162
|
+
"props-form-panel-header": withCtx(() => [createElementVNode("div", _hoisted_2, [_cache[4] || (_cache[4] = createElementVNode("span", null, "样式", -1)), createElementVNode("div", null, [createVNode(unref(TMagicButton), {
|
|
156
163
|
link: "",
|
|
157
164
|
size: "small",
|
|
158
|
-
onClick: _cache[
|
|
165
|
+
onClick: _cache[1] || (_cache[1] = ($event) => unref(toggleStylePanel)(false))
|
|
159
166
|
}, {
|
|
160
167
|
default: withCtx(() => [createVNode(Icon_default, { icon: unref(Close) }, null, 8, ["icon"])]),
|
|
161
168
|
_: 1
|
|
@@ -170,7 +177,7 @@ var PropsPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
170
177
|
key: 2,
|
|
171
178
|
class: "m-editor-props-panel-style-icon",
|
|
172
179
|
circle: "",
|
|
173
|
-
onClick: _cache[
|
|
180
|
+
onClick: _cache[3] || (_cache[3] = ($event) => unref(toggleStylePanel)(true))
|
|
174
181
|
}, {
|
|
175
182
|
default: withCtx(() => [createVNode(Icon_default, { icon: unref(Sugar) }, null, 8, ["icon"])]),
|
|
176
183
|
_: 1
|
|
@@ -23,8 +23,9 @@ var useStylePanel = ({ uiService, storageService }, propsPanelWidth) => {
|
|
|
23
23
|
columnWidth.center += propsPanelWidth.value;
|
|
24
24
|
}
|
|
25
25
|
if (columnWidth.center < 0) {
|
|
26
|
-
|
|
27
|
-
columnWidth.
|
|
26
|
+
const minCenterColumnWidth = uiService.get("minCenterColumnWidth");
|
|
27
|
+
columnWidth.right = columnWidth.right + columnWidth.center - minCenterColumnWidth;
|
|
28
|
+
columnWidth.center = minCenterColumnWidth;
|
|
28
29
|
propsPanelWidth.value = columnWidth.right / 2;
|
|
29
30
|
}
|
|
30
31
|
storageService.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, columnWidth.right, { protocol: Protocol.NUMBER });
|
|
@@ -61,6 +61,7 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
61
61
|
const taskLength = computed(() => depService.get("taskLength"));
|
|
62
62
|
const tipsBarVisible = ref(true);
|
|
63
63
|
const columnLeftWidth = computed(() => uiService.get("columnWidth")[ColumnLayout.LEFT]);
|
|
64
|
+
const frameworkWidth = computed(() => uiService.get("frameworkRect")?.width || 0);
|
|
64
65
|
const { height: editorContentHeight } = useEditorContentHeight();
|
|
65
66
|
const columnLeftHeight = ref(0);
|
|
66
67
|
const unWatchEditorContentHeight = watch(editorContentHeight, (height) => {
|
|
@@ -189,23 +190,17 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
189
190
|
}, config.props || {}, toHandlers(config?.listeners || {})), createSlots({ _: 2 }, [
|
|
190
191
|
config.$key === "component-list" || config.slots?.componentList ? {
|
|
191
192
|
name: "component-list",
|
|
192
|
-
fn: withCtx(({ componentGroupList }) => [config.$key === "component-list" ? renderSlot(_ctx.$slots, "component-list", {
|
|
193
|
-
key: 0,
|
|
194
|
-
componentGroupList
|
|
195
|
-
}) : config.slots?.componentList ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.componentList), { key: 1 })) : createCommentVNode("v-if", true)]),
|
|
193
|
+
fn: withCtx(({ componentGroupList }) => [config.$key === "component-list" ? renderSlot(_ctx.$slots, "component-list", { componentGroupList }, void 0, void 0, 0) : config.slots?.componentList ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.componentList), { key: 1 })) : createCommentVNode("v-if", true)]),
|
|
196
194
|
key: "0"
|
|
197
195
|
} : void 0,
|
|
198
196
|
config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
|
|
199
197
|
name: "component-list-panel-header",
|
|
200
|
-
fn: withCtx(() => [config.$key === "component-list" ? renderSlot(_ctx.$slots, "component-list-panel-header", {
|
|
198
|
+
fn: withCtx(() => [config.$key === "component-list" ? renderSlot(_ctx.$slots, "component-list-panel-header", {}, void 0, void 0, 0) : config.slots?.componentListPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.componentListPanelHeader), { key: 1 })) : createCommentVNode("v-if", true)]),
|
|
201
199
|
key: "1"
|
|
202
200
|
} : void 0,
|
|
203
201
|
config.$key === "component-list" || config.slots?.componentListItem ? {
|
|
204
202
|
name: "component-list-item",
|
|
205
|
-
fn: withCtx(({ component }) => [config.$key === "component-list" ? renderSlot(_ctx.$slots, "component-list-item", {
|
|
206
|
-
key: 0,
|
|
207
|
-
component
|
|
208
|
-
}) : config.slots?.componentListItem ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.componentListItem), {
|
|
203
|
+
fn: withCtx(({ component }) => [config.$key === "component-list" ? renderSlot(_ctx.$slots, "component-list-item", { component }, void 0, void 0, 0) : config.slots?.componentListItem ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.componentListItem), {
|
|
209
204
|
key: 1,
|
|
210
205
|
component
|
|
211
206
|
}, null, 8, ["component"])) : createCommentVNode("v-if", true)]),
|
|
@@ -213,34 +208,30 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
213
208
|
} : void 0,
|
|
214
209
|
config.$key === "layer" || config.slots?.layerPanelHeader ? {
|
|
215
210
|
name: "layer-panel-header",
|
|
216
|
-
fn: withCtx(() => [config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-panel-header", {
|
|
211
|
+
fn: withCtx(() => [config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-panel-header", {}, void 0, void 0, 0) : config.slots?.layerPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerPanelHeader), { key: 1 })) : createCommentVNode("v-if", true)]),
|
|
217
212
|
key: "3"
|
|
218
213
|
} : void 0,
|
|
219
214
|
config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
|
|
220
215
|
name: "code-block-panel-header",
|
|
221
|
-
fn: withCtx(() => [config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-header", {
|
|
216
|
+
fn: withCtx(() => [config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-header", {}, void 0, void 0, 0) : config.slots?.codeBlockPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : createCommentVNode("v-if", true)]),
|
|
222
217
|
key: "4"
|
|
223
218
|
} : void 0,
|
|
224
219
|
config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
|
|
225
220
|
name: "code-block-panel-tool",
|
|
226
221
|
fn: withCtx(({ id, data }) => [config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
227
|
-
key: 0,
|
|
228
222
|
id,
|
|
229
223
|
data
|
|
230
|
-
}) : config.slots?.codeBlockPanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : createCommentVNode("v-if", true)]),
|
|
224
|
+
}, void 0, void 0, 0) : config.slots?.codeBlockPanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : createCommentVNode("v-if", true)]),
|
|
231
225
|
key: "5"
|
|
232
226
|
} : void 0,
|
|
233
227
|
config.$key === "code-block" || config.slots?.codeBlockPanelSearch ? {
|
|
234
228
|
name: "code-block-panel-search",
|
|
235
|
-
fn: withCtx(() => [config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-search", {
|
|
229
|
+
fn: withCtx(() => [config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-search", {}, void 0, void 0, 0) : config.slots?.codeBlockPanelSearch ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelSearch), { key: 1 })) : createCommentVNode("v-if", true)]),
|
|
236
230
|
key: "6"
|
|
237
231
|
} : void 0,
|
|
238
232
|
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
239
233
|
name: "layer-node-content",
|
|
240
|
-
fn: withCtx(({ data: nodeData }) => [config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-content", {
|
|
241
|
-
key: 0,
|
|
242
|
-
data: nodeData
|
|
243
|
-
}) : config.slots?.layerNodeContent ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeContent), {
|
|
234
|
+
fn: withCtx(({ data: nodeData }) => [config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-content", { data: nodeData }, void 0, void 0, 0) : config.slots?.layerNodeContent ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeContent), {
|
|
244
235
|
key: 1,
|
|
245
236
|
data: nodeData
|
|
246
237
|
}, null, 8, ["data"])) : createCommentVNode("v-if", true)]),
|
|
@@ -248,10 +239,7 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
248
239
|
} : void 0,
|
|
249
240
|
config.$key === "layer" || config.slots?.layerNodeLabel ? {
|
|
250
241
|
name: "layer-node-label",
|
|
251
|
-
fn: withCtx(({ data: nodeData }) => [config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-label", {
|
|
252
|
-
key: 0,
|
|
253
|
-
data: nodeData
|
|
254
|
-
}) : config.slots?.layerNodeLabel ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeTool), {
|
|
242
|
+
fn: withCtx(({ data: nodeData }) => [config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-label", { data: nodeData }, void 0, void 0, 0) : config.slots?.layerNodeLabel ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeTool), {
|
|
255
243
|
key: 1,
|
|
256
244
|
data: nodeData
|
|
257
245
|
}, null, 8, ["data"])) : createCommentVNode("v-if", true)]),
|
|
@@ -259,10 +247,7 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
259
247
|
} : void 0,
|
|
260
248
|
config.$key === "layer" || config.slots?.layerNodeTool ? {
|
|
261
249
|
name: "layer-node-tool",
|
|
262
|
-
fn: withCtx(({ data: nodeData }) => [config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-tool", {
|
|
263
|
-
key: 0,
|
|
264
|
-
data: nodeData
|
|
265
|
-
}) : config.slots?.layerNodeTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeTool), {
|
|
250
|
+
fn: withCtx(({ data: nodeData }) => [config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-tool", { data: nodeData }, void 0, void 0, 0) : config.slots?.layerNodeTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeTool), {
|
|
266
251
|
key: 1,
|
|
267
252
|
data: nodeData
|
|
268
253
|
}, null, 8, ["data"])) : createCommentVNode("v-if", true)]),
|
|
@@ -270,15 +255,12 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
270
255
|
} : void 0,
|
|
271
256
|
config.$key === "data-source" || config.slots?.dataSourcePanelTool ? {
|
|
272
257
|
name: "data-source-panel-tool",
|
|
273
|
-
fn: withCtx(({ data }) => [config.$key === "data-source" ? renderSlot(_ctx.$slots, "data-source-panel-tool", {
|
|
274
|
-
key: 0,
|
|
275
|
-
data
|
|
276
|
-
}) : config.slots?.DataSourcePanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : createCommentVNode("v-if", true)]),
|
|
258
|
+
fn: withCtx(({ data }) => [config.$key === "data-source" ? renderSlot(_ctx.$slots, "data-source-panel-tool", { data }, void 0, void 0, 0) : config.slots?.DataSourcePanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : createCommentVNode("v-if", true)]),
|
|
277
259
|
key: "10"
|
|
278
260
|
} : void 0,
|
|
279
261
|
config.$key === "data-source" || config.slots?.dataSourcePanelSearch ? {
|
|
280
262
|
name: "data-source-panel-search",
|
|
281
|
-
fn: withCtx(() => [config.$key === "data-source" ? renderSlot(_ctx.$slots, "data-source-panel-search", {
|
|
263
|
+
fn: withCtx(() => [config.$key === "data-source" ? renderSlot(_ctx.$slots, "data-source-panel-search", {}, void 0, void 0, 0) : config.slots?.dataSourcePanelSearch ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.dataSourcePanelSearch), { key: 1 })) : createCommentVNode("v-if", true)]),
|
|
282
264
|
key: "11"
|
|
283
265
|
} : void 0
|
|
284
266
|
]), 1040)) : createCommentVNode("v-if", true)], 2)), [[vShow, [
|
|
@@ -301,6 +283,7 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
301
283
|
"onUpdate:height": _cache[2] || (_cache[2] = ($event) => columnLeftHeight.value = $event),
|
|
302
284
|
width: columnLeftWidth.value,
|
|
303
285
|
title: config.text,
|
|
286
|
+
"framework-width": frameworkWidth.value,
|
|
304
287
|
position: {
|
|
305
288
|
left: unref(floatBoxStates)[config.$key].left,
|
|
306
289
|
top: unref(floatBoxStates)[config.$key].top
|
|
@@ -317,6 +300,7 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
317
300
|
"height",
|
|
318
301
|
"width",
|
|
319
302
|
"title",
|
|
303
|
+
"framework-width",
|
|
320
304
|
"position"
|
|
321
305
|
])) : createCommentVNode("v-if", true)], 64);
|
|
322
306
|
}), 256))]))], 64);
|