@tmagic/editor 1.8.0-beta.25 → 1.8.0-beta.26
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 +10 -16
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +5 -8
- package/dist/es/components/ViewForm.vue_vue_type_script_setup_true_lang.js +3 -5
- package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +3 -11
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +29 -124
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +5 -6
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +4 -5
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +6 -10
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +5 -7
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +1 -4
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +4 -6
- package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +9 -142
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +51 -326
- package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +2 -4
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +3 -34
- package/dist/es/fields/StyleSetter/configs.js +663 -0
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +5 -108
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +3 -9
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +5 -102
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +5 -265
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +5 -85
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +3 -22
- 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 +20 -0
- package/dist/es/fields/headless-validation.js +139 -0
- package/dist/es/headless.js +2 -0
- package/dist/es/hooks/use-compare-form.js +6 -23
- package/dist/es/hooks/use-form-context.js +19 -0
- package/dist/es/index.js +2 -1
- package/dist/es/initService.js +17 -1
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +1 -7
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +1 -11
- package/dist/es/layouts/history-list/useHistoryRevert.js +3 -11
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +10 -23
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +3 -13
- package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/code-block/useContentMenu.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/useContentMenu.js +1 -1
- package/dist/es/plugin.js +33 -32
- package/dist/es/style.css +116 -60
- package/dist/es/utils/data-source/index.js +2 -1
- package/dist/es/utils/props.js +1 -4
- package/dist/es/utils/type-match-rules.js +2 -2
- package/dist/style.css +116 -60
- package/dist/themes/magic-admin.css +128 -67
- package/dist/tmagic-editor-headless.umd.cjs +10867 -0
- package/dist/tmagic-editor.umd.cjs +2123 -2015
- package/package.json +12 -7
- package/src/Editor.vue +12 -16
- package/src/components/CodeParams.vue +10 -4
- package/src/components/CompareForm.vue +4 -5
- package/src/components/ViewForm.vue +2 -3
- package/src/editorProps.ts +1 -2
- package/src/fields/Code.vue +2 -10
- package/src/fields/CodeSelect.vue +20 -116
- package/src/fields/CodeSelectCol.vue +3 -5
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +1 -1
- package/src/fields/DataSourceFieldSelect/Index.vue +3 -5
- package/src/fields/DataSourceFields.vue +0 -7
- package/src/fields/DataSourceMethodSelect.vue +2 -5
- package/src/fields/DataSourceMethods.vue +1 -6
- package/src/fields/DataSourceMocks.vue +1 -10
- package/src/fields/DataSourceSelect.vue +1 -1
- package/src/fields/DisplayConds.vue +17 -157
- package/src/fields/EventSelect.vue +28 -375
- package/src/fields/KeyValue.vue +3 -4
- package/src/fields/StyleSetter/components/Border.vue +4 -38
- package/src/fields/StyleSetter/configs.ts +690 -0
- package/src/fields/StyleSetter/pro/Background.vue +4 -104
- package/src/fields/StyleSetter/pro/Border.vue +3 -12
- package/src/fields/StyleSetter/pro/Font.vue +4 -123
- package/src/fields/StyleSetter/pro/Layout.vue +4 -219
- package/src/fields/StyleSetter/pro/Position.vue +6 -110
- package/src/fields/StyleSetter/pro/Transform.vue +4 -30
- 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 +31 -0
- package/src/fields/headless-validation.ts +177 -0
- package/src/headless.ts +33 -0
- package/src/hooks/use-compare-form.ts +7 -25
- package/src/hooks/use-form-context.ts +40 -0
- package/src/index.ts +2 -0
- package/src/initService.ts +23 -1
- package/src/layouts/history-list/HistoryDiffDialog.vue +0 -10
- package/src/layouts/history-list/HistoryListPanel.vue +1 -13
- package/src/layouts/history-list/useHistoryRevert.ts +7 -13
- package/src/layouts/props-panel/FormPanel.vue +17 -28
- package/src/layouts/props-panel/PropsPanel.vue +1 -4
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +1 -1
- package/src/layouts/sidebar/code-block/useContentMenu.ts +1 -1
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +1 -1
- package/src/layouts/sidebar/data-source/useContentMenu.ts +1 -1
- package/src/plugin.ts +32 -33
- package/src/theme/code-block.scss +0 -37
- package/src/theme/display-conds.scss +4 -0
- package/src/theme/event.scss +22 -45
- package/src/theme/props-panel.scss +17 -3
- package/src/theme/themes/magic-admin/index.scss +12 -1
- package/src/type.ts +10 -29
- package/src/utils/data-source/index.ts +1 -0
- package/src/utils/props.ts +1 -4
- package/src/utils/type-match-rules.ts +8 -3
- package/types/headless.d.ts +18 -0
- package/types/index.d.ts +154 -179
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { useEditorFormContext } from "./use-form-context.js";
|
|
1
2
|
import { getCodeBlockFormConfig } from "../utils/code-block.js";
|
|
2
|
-
import { computed, inject, provide, ref, useTemplateRef, watch
|
|
3
|
+
import { computed, inject, provide, ref, useTemplateRef, watch } from "vue";
|
|
3
4
|
//#region packages/editor/src/hooks/use-compare-form.ts
|
|
4
5
|
/**
|
|
5
6
|
* CompareForm / ViewForm 共用逻辑:
|
|
6
7
|
* - 按 `category`(node / data-source / code-block) 加载 FormConfig(支持自定义 `loadConfig`);
|
|
7
8
|
* - 代码块 `content` 归一化为字符串;
|
|
8
9
|
* - 外层容器固定高度 + 内部滚动的 `wrapperStyle`;
|
|
9
|
-
* - 将 services / stage
|
|
10
|
+
* - 将 services / stage 作为 form context 传给 MForm,保证 filterFunction 上下文一致。
|
|
10
11
|
*
|
|
11
12
|
* 两个组件的差异仅在于是否做新旧值对比,这部分逻辑保留在各自组件中。
|
|
12
13
|
*/
|
|
@@ -41,9 +42,7 @@ var useCompareForm = (props) => {
|
|
|
41
42
|
overflow: "auto"
|
|
42
43
|
};
|
|
43
44
|
});
|
|
44
|
-
const
|
|
45
|
-
return (props.extendState ?? ((s) => s))(props.baseFormState || state);
|
|
46
|
-
};
|
|
45
|
+
const formContext = useEditorFormContext(() => props.services);
|
|
47
46
|
/**
|
|
48
47
|
* 内置的默认 FormConfig 加载逻辑:按 `category` 从对应 service / 工具取配置。
|
|
49
48
|
* 作为 ctx.defaultLoadConfig 透传给自定义 `loadConfig`,方便复用与二次加工。
|
|
@@ -88,29 +87,13 @@ var useCompareForm = (props) => {
|
|
|
88
87
|
], () => {
|
|
89
88
|
loadConfig();
|
|
90
89
|
}, { immediate: true });
|
|
91
|
-
const formRef = useTemplateRef("form");
|
|
92
|
-
/**
|
|
93
|
-
* 把 services / stage 注入 MForm 的 formState,避免 propsService 注入的表单配置中
|
|
94
|
-
* 形如 `display: ({ services }) => services.uiService.get(...)` 的 filterFunction
|
|
95
|
-
* 在执行时拿不到 `formState.services` 而报错。
|
|
96
|
-
*
|
|
97
|
-
* 与 props-panel/FormPanel.vue 中的注入方式保持一致:
|
|
98
|
-
* - services:整个 useServices() 返回的服务集合;
|
|
99
|
-
* - stage:当前 editorService.get('stage') 的最新值。
|
|
100
|
-
*/
|
|
101
|
-
watchEffect(() => {
|
|
102
|
-
if (formRef.value && props.services) {
|
|
103
|
-
formRef.value.formState.stage = props.services.editorService.get("stage");
|
|
104
|
-
formRef.value.formState.services = props.services;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
90
|
return {
|
|
108
91
|
config,
|
|
109
92
|
currentValues,
|
|
110
93
|
wrapperStyle,
|
|
111
|
-
|
|
94
|
+
formContext,
|
|
112
95
|
loadConfig,
|
|
113
|
-
formRef,
|
|
96
|
+
formRef: useTemplateRef("form"),
|
|
114
97
|
normalizeCodeBlockValue
|
|
115
98
|
};
|
|
116
99
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
//#region packages/editor/src/hooks/use-form-context.ts
|
|
3
|
+
/**
|
|
4
|
+
* 编辑器注入给表单的业务上下文:`services` 与当前画布 `stage`。
|
|
5
|
+
*
|
|
6
|
+
* 由 `Editor.vue`(provide `FORM_CONTEXT_KEY`)、`FormPanel.vue` 与 `useCompareForm`
|
|
7
|
+
* 共用。`stage` 走 computed 而非快照,保证切换画布后配置回调读到的是最新实例。
|
|
8
|
+
*
|
|
9
|
+
* 字段类型见 `@editor/type` 里对 `@tmagic/form-schema` 的 `FormContext` 模块增强。
|
|
10
|
+
*/
|
|
11
|
+
var useEditorFormContext = (getServices) => computed(() => {
|
|
12
|
+
const services = getServices();
|
|
13
|
+
return {
|
|
14
|
+
services,
|
|
15
|
+
stage: services?.editorService.get("stage")
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { useEditorFormContext };
|
package/dist/es/index.js
CHANGED
|
@@ -81,6 +81,7 @@ import PageFragmentSelect_default from "./fields/PageFragmentSelect.js";
|
|
|
81
81
|
import DisplayConds_default from "./fields/DisplayConds.js";
|
|
82
82
|
import CondOpSelect_default from "./fields/CondOpSelect.js";
|
|
83
83
|
import Index_default$1 from "./fields/StyleSetter/Index.js";
|
|
84
|
+
import { editorFields } from "./fields/headless-validation.js";
|
|
84
85
|
import plugin_default from "./plugin.js";
|
|
85
86
|
import formPlugin from "@tmagic/form";
|
|
86
87
|
import tablePlugin from "@tmagic/table";
|
|
@@ -92,4 +93,4 @@ export * from "@tmagic/table";
|
|
|
92
93
|
export * from "@tmagic/stage";
|
|
93
94
|
export * from "@tmagic/design";
|
|
94
95
|
export * from "@tmagic/utils";
|
|
95
|
-
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, ViewForm_default as ViewForm, 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, isGlobalFlat, 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, useCompareForm, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useHistoryRevert, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, validateDataSourceFieldSelect, warn };
|
|
96
|
+
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, ViewForm_default as ViewForm, 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, editorFields, 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, isGlobalFlat, 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, useCompareForm, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useHistoryRevert, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, validateDataSourceFieldSelect, warn };
|
package/dist/es/initService.js
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { isIncludeDataSource } from "./utils/editor.js";
|
|
2
|
+
import { error } from "./utils/logger.js";
|
|
2
3
|
import { getDepNodeIds, getNodes, isPage, isValueIncludeDataSource } from "@tmagic/utils";
|
|
3
4
|
import { DepTargetType, NODE_CONDS_KEY, NodeType, createCodeBlockTarget, createDataSourceCondTarget, createDataSourceMethodTarget, createDataSourceTarget, updateNode } from "@tmagic/core";
|
|
4
5
|
import { nextTick, onBeforeUnmount, reactive, toRaw, watch } from "vue";
|
|
5
6
|
import { cloneDeep as cloneDeep$1 } from "lodash-es";
|
|
6
7
|
//#region packages/editor/src/initService.ts
|
|
8
|
+
/**
|
|
9
|
+
* select 为异步串行执行,节点不可选中(如已从 DSL 中移除)时会抛错。
|
|
10
|
+
* 在 watch 回调中调用不能把拒绝抛回调用方,否则会变成 Vue 的「Unhandled error during execution of watcher callback」,
|
|
11
|
+
* 这里统一兜底成日志。
|
|
12
|
+
*/
|
|
13
|
+
var selectNode = async (editorService, id) => {
|
|
14
|
+
try {
|
|
15
|
+
await editorService.select(id);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
error(e);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
7
20
|
var initServiceState = (props, { editorService, historyService, componentListService, propsService, eventsService, uiService, codeBlockService, keybindingService, dataSourceService, depService }) => {
|
|
8
21
|
watch(() => props.modelValue, (modelValue) => {
|
|
9
22
|
editorService.set("root", modelValue || null, { historySource: "initial" });
|
|
@@ -46,7 +59,10 @@ var initServiceState = (props, { editorService, historyService, componentListSer
|
|
|
46
59
|
for (const [key, value] of Object.entries(eventsList)) dataSourceService.setFormEvent(key, value);
|
|
47
60
|
for (const [key, value] of Object.entries(methodsList)) dataSourceService.setFormMethod(key, value);
|
|
48
61
|
}, { immediate: true });
|
|
49
|
-
watch(() => props.defaultSelected, (defaultSelected) =>
|
|
62
|
+
watch(() => props.defaultSelected, (defaultSelected) => {
|
|
63
|
+
if (!defaultSelected || !editorService.getNodeById(defaultSelected)) return;
|
|
64
|
+
selectNode(editorService, defaultSelected);
|
|
65
|
+
}, { immediate: true });
|
|
50
66
|
watch(() => props.stageRect, (stageRect) => stageRect && uiService.set("stageRect", stageRect), { immediate: true });
|
|
51
67
|
watch(() => props.disabledCodeBlock, (disabledCodeBlock) => propsService.setDisabledCodeBlock(disabledCodeBlock ?? false), { immediate: true });
|
|
52
68
|
watch(() => props.disabledDataSource, (disabledDataSource) => propsService.setDisabledDataSource(disabledDataSource ?? false), { immediate: true });
|
package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -25,14 +25,12 @@ var HistoryDiffDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
25
25
|
__name: "HistoryDiffDialog",
|
|
26
26
|
props: {
|
|
27
27
|
services: {},
|
|
28
|
-
extendState: {},
|
|
29
28
|
loadConfig: {},
|
|
30
29
|
width: { default: "900px" },
|
|
31
30
|
size: {},
|
|
32
31
|
isConfirm: { type: Boolean },
|
|
33
32
|
onConfirm: {},
|
|
34
|
-
selfDiffFieldTypes: {}
|
|
35
|
-
compareFormState: {}
|
|
33
|
+
selfDiffFieldTypes: {}
|
|
36
34
|
},
|
|
37
35
|
emits: ["close"],
|
|
38
36
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -254,8 +252,6 @@ var HistoryDiffDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
254
252
|
"data-source-type": payload.value.dataSourceType,
|
|
255
253
|
value: rightValue.value,
|
|
256
254
|
"last-value": leftValue.value,
|
|
257
|
-
"base-form-state": __props.compareFormState,
|
|
258
|
-
"extend-state": __props.extendState,
|
|
259
255
|
"load-config": __props.loadConfig,
|
|
260
256
|
"self-diff-field-types": __props.selfDiffFieldTypes,
|
|
261
257
|
services: props.services,
|
|
@@ -267,8 +263,6 @@ var HistoryDiffDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
267
263
|
"data-source-type",
|
|
268
264
|
"value",
|
|
269
265
|
"last-value",
|
|
270
|
-
"base-form-state",
|
|
271
|
-
"extend-state",
|
|
272
266
|
"load-config",
|
|
273
267
|
"self-diff-field-types",
|
|
274
268
|
"services",
|
package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -62,13 +62,6 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
62
62
|
watch([disabledDataSource, disabledCodeBlock], ([dsDisabled, cbDisabled]) => {
|
|
63
63
|
if (activeTab.value === "data-source" && dsDisabled || activeTab.value === "code-block" && cbDisabled) activeTab.value = "page";
|
|
64
64
|
});
|
|
65
|
-
/**
|
|
66
|
-
* 通过 inject 拿到 Editor 顶层注入的 `extendFormState`,转交给 HistoryDiffDialog
|
|
67
|
-
* 内部的 CompareForm,使差异对比表单的 filterFunction 能拿到完整的业务上下文。
|
|
68
|
-
* 未提供时为 undefined,CompareForm/MForm 会跳过 extendState 处理。
|
|
69
|
-
*/
|
|
70
|
-
const extendFormState = inject("extendFormState", void 0);
|
|
71
|
-
const getPropsPanelFormState = inject("getPropsPanelFormState", void 0);
|
|
72
65
|
const { expanded, toggleGroup, pageGroups, dataSourceGroups, codeBlockGroups, pageGroupsDisplay, dataSourceGroupsByTarget, codeBlockGroupsByTarget } = useHistoryList();
|
|
73
66
|
/**
|
|
74
67
|
* 当前活动页的「加载/初始」标记记录(设置 root 时生成),透传给 PageTab 的底部初始行展示。
|
|
@@ -152,10 +145,7 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
152
145
|
* 二者均由 useHistoryRevert 内部按需动态挂载 HistoryDiffDialog,
|
|
153
146
|
* 业务方亦可直接 import useHistoryRevert(options, services) 调用,无需自行挂载任何弹窗。
|
|
154
147
|
*/
|
|
155
|
-
const { onPageRevert, onDataSourceRevert, onCodeBlockRevert, onPageDiff, onDataSourceDiff, onCodeBlockDiff } = useHistoryRevert({
|
|
156
|
-
extendState: extendFormState,
|
|
157
|
-
getPropsPanelFormState
|
|
158
|
-
}, services);
|
|
148
|
+
const { onPageRevert, onDataSourceRevert, onCodeBlockRevert, onPageDiff, onDataSourceDiff, onCodeBlockDiff } = useHistoryRevert({}, services);
|
|
159
149
|
/**
|
|
160
150
|
* 把内存中(已清空对应类别后的)历史状态重新写回 IndexedDB,
|
|
161
151
|
* 使本地持久化的那份与内存保持一致——即「连同本地保存的一并删除」。
|
|
@@ -43,10 +43,8 @@ var mountHistoryDiffDialog = async (options) => {
|
|
|
43
43
|
const app = createApp(historyDiffDialog, {
|
|
44
44
|
services: options.services,
|
|
45
45
|
isConfirm: options.isConfirm,
|
|
46
|
-
extendState: options.extendState,
|
|
47
46
|
loadConfig: options.loadConfig,
|
|
48
47
|
selfDiffFieldTypes: options.selfDiffFieldTypes,
|
|
49
|
-
compareFormState: options.compareFormState,
|
|
50
48
|
width: options.width,
|
|
51
49
|
size: options.size ?? options.services?.uiService?.get("propsPanelSize"),
|
|
52
50
|
onClose: options.onClose
|
|
@@ -127,7 +125,7 @@ var viewHistoryDiffDialog = async (payload, options) => {
|
|
|
127
125
|
*/
|
|
128
126
|
var useHistoryRevert = (options = {}, services) => {
|
|
129
127
|
const appContext = options.appContext ?? getCurrentInstance()?.appContext ?? null;
|
|
130
|
-
const {
|
|
128
|
+
const { dialogWidth } = options;
|
|
131
129
|
/** 目标数据已被删除、无法回滚时的统一提示。 */
|
|
132
130
|
const showRevertTargetMissing = () => {
|
|
133
131
|
tMagicMessage.error("回滚失败:该记录对应的数据已被删除");
|
|
@@ -146,7 +144,6 @@ var useHistoryRevert = (options = {}, services) => {
|
|
|
146
144
|
const runRevert = (payload, extra) => {
|
|
147
145
|
if (payload) return confirmRevertWithDiffDialog(payload, {
|
|
148
146
|
appContext,
|
|
149
|
-
extendState,
|
|
150
147
|
services,
|
|
151
148
|
...extra,
|
|
152
149
|
width: extra?.width ?? dialogWidth,
|
|
@@ -205,7 +202,7 @@ var useHistoryRevert = (options = {}, services) => {
|
|
|
205
202
|
showRevertTargetMissing();
|
|
206
203
|
return Promise.resolve(null);
|
|
207
204
|
}
|
|
208
|
-
return runRevert(buildPageDiffPayload(index), {
|
|
205
|
+
return runRevert(buildPageDiffPayload(index), {}).then((result) => result ? services?.editorService.revertPageStep(index) : null);
|
|
209
206
|
};
|
|
210
207
|
const onDataSourceRevert = (id, index) => {
|
|
211
208
|
if (isDataSourceRevertTargetMissing(id, index)) {
|
|
@@ -229,17 +226,14 @@ var useHistoryRevert = (options = {}, services) => {
|
|
|
229
226
|
const payload = buildPageDiffPayload(index);
|
|
230
227
|
if (payload) return viewHistoryDiffDialog(payload, {
|
|
231
228
|
appContext,
|
|
232
|
-
extendState,
|
|
233
229
|
services,
|
|
234
|
-
width: dialogWidth
|
|
235
|
-
compareFormState: getPropsPanelFormState?.()
|
|
230
|
+
width: dialogWidth
|
|
236
231
|
});
|
|
237
232
|
};
|
|
238
233
|
const onDataSourceDiff = (id, index) => {
|
|
239
234
|
const payload = buildDataSourceDiffPayload(id, index);
|
|
240
235
|
if (payload) return viewHistoryDiffDialog(payload, {
|
|
241
236
|
appContext,
|
|
242
|
-
extendState,
|
|
243
237
|
services,
|
|
244
238
|
width: dialogWidth
|
|
245
239
|
});
|
|
@@ -248,7 +242,6 @@ var useHistoryRevert = (options = {}, services) => {
|
|
|
248
242
|
const payload = buildCodeBlockDiffPayload(id, index);
|
|
249
243
|
if (payload) return viewHistoryDiffDialog(payload, {
|
|
250
244
|
appContext,
|
|
251
|
-
extendState,
|
|
252
245
|
services,
|
|
253
246
|
width: dialogWidth
|
|
254
247
|
});
|
|
@@ -289,7 +282,6 @@ var useHistoryRevert = (options = {}, services) => {
|
|
|
289
282
|
const viewDiff = (payload, extra) => {
|
|
290
283
|
if (payload) return viewHistoryDiffDialog(payload, {
|
|
291
284
|
appContext,
|
|
292
|
-
extendState,
|
|
293
285
|
services,
|
|
294
286
|
...extra,
|
|
295
287
|
width: extra?.width ?? dialogWidth,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useEditorFormContext } from "../../hooks/use-form-context.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";
|
|
@@ -6,7 +7,7 @@ import { ENABLE_PROPS_FORM_VALIDATE } from "../../editorProps.js";
|
|
|
6
7
|
import { MForm, validateForm } from "@tmagic/form";
|
|
7
8
|
import { TMagicButton, TMagicScrollbar, tMagicMessage } from "@tmagic/design";
|
|
8
9
|
import { filterXSS } from "@tmagic/utils";
|
|
9
|
-
import { computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, getCurrentInstance, inject, normalizeClass, onMounted, onUnmounted, openBlock, ref, renderSlot, unref, useTemplateRef,
|
|
10
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, getCurrentInstance, inject, normalizeClass, onMounted, onUnmounted, openBlock, ref, renderSlot, unref, useTemplateRef, withCtx } from "vue";
|
|
10
11
|
import { Document } from "@element-plus/icons-vue";
|
|
11
12
|
//#region packages/editor/src/layouts/props-panel/FormPanel.vue?vue&type=script&setup=true&lang.ts
|
|
12
13
|
var _hoisted_1 = { class: "m-editor-props-form-panel" };
|
|
@@ -19,8 +20,7 @@ var FormPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
19
20
|
disabledShowSrc: { type: Boolean },
|
|
20
21
|
labelWidth: {},
|
|
21
22
|
codeValueKey: {},
|
|
22
|
-
labelPosition: {}
|
|
23
|
-
extendState: { type: Function }
|
|
23
|
+
labelPosition: {}
|
|
24
24
|
},
|
|
25
25
|
emits: [
|
|
26
26
|
"submit",
|
|
@@ -34,19 +34,13 @@ var FormPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
34
34
|
const emit = __emit;
|
|
35
35
|
const enablePropsFormValidate = inject(ENABLE_PROPS_FORM_VALIDATE, false);
|
|
36
36
|
const services = useServices();
|
|
37
|
-
const {
|
|
37
|
+
const { uiService } = services;
|
|
38
38
|
const codeOptions = inject("codeOptions", {});
|
|
39
39
|
const showSrc = ref(false);
|
|
40
40
|
const propsPanelSize = computed(() => uiService.get("propsPanelSize") || "small");
|
|
41
41
|
const { height: editorContentHeight } = useEditorContentHeight();
|
|
42
|
-
const
|
|
42
|
+
const formContext = useEditorFormContext(() => services);
|
|
43
43
|
const configFormRef = useTemplateRef("configForm");
|
|
44
|
-
watchEffect(() => {
|
|
45
|
-
if (configFormRef.value) {
|
|
46
|
-
configFormRef.value.formState.stage = stage.value;
|
|
47
|
-
configFormRef.value.formState.services = services;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
44
|
const internalInstance = getCurrentInstance();
|
|
51
45
|
onMounted(() => {
|
|
52
46
|
emit("mounted", internalInstance?.proxy);
|
|
@@ -85,14 +79,7 @@ var FormPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
85
79
|
config: props.config,
|
|
86
80
|
typeMatchValid: true,
|
|
87
81
|
initValues: newValues,
|
|
88
|
-
|
|
89
|
-
...internalInstance?.appContext,
|
|
90
|
-
provides: { services }
|
|
91
|
-
} : null,
|
|
92
|
-
extendState: (state) => {
|
|
93
|
-
if (configFormRef.value?.formState) return { ...configFormRef.value?.formState || {} };
|
|
94
|
-
return props.extendState?.(state) || {};
|
|
95
|
-
}
|
|
82
|
+
context: formContext.value
|
|
96
83
|
});
|
|
97
84
|
if (error) tMagicMessage({
|
|
98
85
|
type: "error",
|
|
@@ -101,8 +88,8 @@ var FormPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
101
88
|
});
|
|
102
89
|
emit("submit", newValues, void 0, error ? new Error(error) : void 0);
|
|
103
90
|
} catch (e) {
|
|
104
|
-
console.
|
|
105
|
-
emit("submit", newValues);
|
|
91
|
+
console.error("validateForm error", e);
|
|
92
|
+
emit("submit", newValues, void 0, e instanceof Error ? e : new Error(String(e)));
|
|
106
93
|
}
|
|
107
94
|
};
|
|
108
95
|
__expose({
|
|
@@ -123,7 +110,7 @@ var FormPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
123
110
|
"init-values": __props.values,
|
|
124
111
|
config: __props.config,
|
|
125
112
|
"type-match-valid": true,
|
|
126
|
-
|
|
113
|
+
context: unref(formContext),
|
|
127
114
|
"validate-on-init": true,
|
|
128
115
|
onChange: submit,
|
|
129
116
|
onError: errorHandler
|
|
@@ -135,7 +122,7 @@ var FormPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
135
122
|
"size",
|
|
136
123
|
"init-values",
|
|
137
124
|
"config",
|
|
138
|
-
"
|
|
125
|
+
"context"
|
|
139
126
|
])]),
|
|
140
127
|
_: 1
|
|
141
128
|
}),
|
|
@@ -20,10 +20,7 @@ var _hoisted_2 = { class: "m-editor-props-style-panel-title" };
|
|
|
20
20
|
var PropsPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
21
21
|
name: "MEditorPropsPanel",
|
|
22
22
|
__name: "PropsPanel",
|
|
23
|
-
props: {
|
|
24
|
-
disabledShowSrc: { type: Boolean },
|
|
25
|
-
extendState: { type: Function }
|
|
26
|
-
},
|
|
23
|
+
props: { disabledShowSrc: { type: Boolean } },
|
|
27
24
|
emits: [
|
|
28
25
|
"submit-error",
|
|
29
26
|
"form-error",
|
|
@@ -149,7 +146,6 @@ var PropsPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
149
146
|
config: curFormConfig.value,
|
|
150
147
|
values: values.value,
|
|
151
148
|
disabledShowSrc: __props.disabledShowSrc,
|
|
152
|
-
extendState: __props.extendState,
|
|
153
149
|
onSubmit: _cache[0] || (_cache[0] = (v, eventData, error) => submit(v, eventData, error, "props")),
|
|
154
150
|
onSubmitError: errorHandler,
|
|
155
151
|
onFormError: errorHandler,
|
|
@@ -159,8 +155,7 @@ var PropsPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
159
155
|
"class",
|
|
160
156
|
"config",
|
|
161
157
|
"values",
|
|
162
|
-
"disabledShowSrc"
|
|
163
|
-
"extendState"
|
|
158
|
+
"disabledShowSrc"
|
|
164
159
|
]),
|
|
165
160
|
unref(showStylePanel) ? (openBlock(), createBlock(Resizer_default, {
|
|
166
161
|
key: 0,
|
|
@@ -174,7 +169,6 @@ var PropsPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
174
169
|
config: styleFormConfig,
|
|
175
170
|
values: values.value,
|
|
176
171
|
disabledShowSrc: __props.disabledShowSrc,
|
|
177
|
-
extendState: __props.extendState,
|
|
178
172
|
onSubmit: _cache[2] || (_cache[2] = (v, eventData, error) => submit(v, eventData, error, "style")),
|
|
179
173
|
onSubmitError: errorHandler,
|
|
180
174
|
onFormError: errorHandler
|
|
@@ -188,11 +182,7 @@ var PropsPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
188
182
|
_: 1
|
|
189
183
|
})])])]),
|
|
190
184
|
_: 1
|
|
191
|
-
}, 8, [
|
|
192
|
-
"values",
|
|
193
|
-
"disabledShowSrc",
|
|
194
|
-
"extendState"
|
|
195
|
-
])) : createCommentVNode("v-if", true),
|
|
185
|
+
}, 8, ["values", "disabledShowSrc"])) : createCommentVNode("v-if", true),
|
|
196
186
|
unref(showStylePanelToggleButton) && !unref(showStylePanel) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
197
187
|
key: 2,
|
|
198
188
|
class: "m-editor-props-panel-style-icon",
|
package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -20,7 +20,7 @@ var CodeBlockListPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
|
|
|
20
20
|
},
|
|
21
21
|
setup(__props) {
|
|
22
22
|
const props = __props;
|
|
23
|
-
const eventBus = inject("eventBus");
|
|
23
|
+
const eventBus = inject("eventBus", null);
|
|
24
24
|
const { codeBlockService } = useServices();
|
|
25
25
|
const editable = computed(() => codeBlockService.getEditStatus());
|
|
26
26
|
const { codeId, codeBlockEditor, codeConfig, editCode, deleteCode, createCodeBlock, submitCodeBlockHandler } = useCodeBlockEdit(codeBlockService);
|
|
@@ -3,7 +3,7 @@ import { cloneDeep } from "lodash-es";
|
|
|
3
3
|
import { CopyDocument, Delete, Edit } from "@element-plus/icons-vue";
|
|
4
4
|
//#region packages/editor/src/layouts/sidebar/code-block/useContentMenu.ts
|
|
5
5
|
var useContentMenu = (deleteCode) => {
|
|
6
|
-
const eventBus = inject("eventBus");
|
|
6
|
+
const eventBus = inject("eventBus", null);
|
|
7
7
|
const menuRef = useTemplateRef("menu");
|
|
8
8
|
let selectId = "";
|
|
9
9
|
let selectData = null;
|
|
@@ -21,7 +21,7 @@ var DataSourceListPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
|
|
|
21
21
|
},
|
|
22
22
|
setup(__props) {
|
|
23
23
|
const props = __props;
|
|
24
|
-
const eventBus = inject("eventBus");
|
|
24
|
+
const eventBus = inject("eventBus", null);
|
|
25
25
|
const { dataSourceService } = useServices();
|
|
26
26
|
const { editDialog, dataSourceValues, dialogTitle, editable, editHandler, submitDataSourceHandler } = useDataSourceEdit(dataSourceService);
|
|
27
27
|
/** 打开数据源详情时需要直接定位并打开的方法名,为空则正常展示「数据定义」tab */
|
|
@@ -3,7 +3,7 @@ import { cloneDeep } from "lodash-es";
|
|
|
3
3
|
import { CopyDocument, Delete, Edit } from "@element-plus/icons-vue";
|
|
4
4
|
//#region packages/editor/src/layouts/sidebar/data-source/useContentMenu.ts
|
|
5
5
|
var useContentMenu = () => {
|
|
6
|
-
const eventBus = inject("eventBus");
|
|
6
|
+
const eventBus = inject("eventBus", null);
|
|
7
7
|
const menuRef = useTemplateRef("menu");
|
|
8
8
|
let selectId = "";
|
|
9
9
|
let selectData = null;
|
package/dist/es/plugin.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { setEditorConfig } from "./utils/config.js";
|
|
2
|
-
import { editorTypeMatchRules } from "./utils/type-match-rules.js";
|
|
3
2
|
import CodeEditor_default from "./layouts/CodeEditor.js";
|
|
4
3
|
import Editor_default from "./Editor.js";
|
|
5
4
|
import CodeSelect_default from "./fields/CodeSelect.js";
|
|
@@ -17,11 +16,12 @@ import PageFragmentSelect_default from "./fields/PageFragmentSelect.js";
|
|
|
17
16
|
import DisplayConds_default from "./fields/DisplayConds.js";
|
|
18
17
|
import CondOpSelect_default from "./fields/CondOpSelect.js";
|
|
19
18
|
import Index_default$1 from "./fields/StyleSetter/Index.js";
|
|
19
|
+
import { editorFields } from "./fields/headless-validation.js";
|
|
20
20
|
import Code_default from "./fields/Code.js";
|
|
21
21
|
import CodeLink_default from "./fields/CodeLink.js";
|
|
22
22
|
import UISelect_default from "./fields/UISelect.js";
|
|
23
23
|
/* empty css */
|
|
24
|
-
import formPlugin, {
|
|
24
|
+
import formPlugin, { mergeFieldOptions } from "@tmagic/form";
|
|
25
25
|
import tablePlugin from "@tmagic/table";
|
|
26
26
|
import designPlugin from "@tmagic/design";
|
|
27
27
|
//#region packages/editor/src/plugin.ts
|
|
@@ -31,42 +31,43 @@ var defaultInstallOpt = {
|
|
|
31
31
|
customCreateMonacoDiffEditor: (monaco, codeEditorEl, options) => monaco.editor.createDiffEditor(codeEditorEl, options),
|
|
32
32
|
flat: false
|
|
33
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 }
|
|
53
|
+
};
|
|
34
54
|
var plugin_default = { install: (app, opt) => {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
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
|
+
});
|
|
38
66
|
app.use(tablePlugin);
|
|
39
|
-
registerTypeMatchRules(editorTypeMatchRules);
|
|
40
|
-
registerSilentLeafFieldTypes([
|
|
41
|
-
"vs-code",
|
|
42
|
-
"ui-select",
|
|
43
|
-
"cond-op-select",
|
|
44
|
-
"page-fragment-select",
|
|
45
|
-
"data-source-select",
|
|
46
|
-
"data-source-input"
|
|
47
|
-
]);
|
|
48
67
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
49
68
|
setEditorConfig(option);
|
|
50
69
|
app.component(`${Editor_default.name || "MEditor"}`, Editor_default);
|
|
51
70
|
app.component("magic-code-editor", CodeEditor_default);
|
|
52
|
-
app.component("m-fields-ui-select", UISelect_default);
|
|
53
|
-
app.component("m-fields-code-link", CodeLink_default);
|
|
54
|
-
app.component("m-fields-vs-code", Code_default);
|
|
55
|
-
app.component("m-fields-code-select", CodeSelect_default);
|
|
56
|
-
app.component("m-fields-code-select-col", CodeSelectCol_default);
|
|
57
|
-
app.component("m-fields-event-select", EventSelect_default);
|
|
58
|
-
app.component("m-fields-data-source-fields", DataSourceFields_default);
|
|
59
|
-
app.component("m-fields-data-source-mocks", DataSourceMocks_default);
|
|
60
|
-
app.component("m-fields-key-value", KeyValue_default);
|
|
61
|
-
app.component("m-fields-data-source-input", DataSourceInput_default);
|
|
62
|
-
app.component("m-fields-data-source-select", DataSourceSelect_default);
|
|
63
|
-
app.component("m-fields-data-source-methods", DataSourceMethods_default);
|
|
64
|
-
app.component("m-fields-data-source-method-select", DataSourceMethodSelect_default);
|
|
65
|
-
app.component("m-fields-data-source-field-select", Index_default);
|
|
66
|
-
app.component("m-fields-page-fragment-select", PageFragmentSelect_default);
|
|
67
|
-
app.component("m-fields-display-conds", DisplayConds_default);
|
|
68
|
-
app.component("m-fields-cond-op-select", CondOpSelect_default);
|
|
69
|
-
app.component("m-form-style-setter", Index_default$1);
|
|
70
71
|
} };
|
|
71
72
|
//#endregion
|
|
72
73
|
export { plugin_default as default };
|