@tmagic/editor 1.8.0-beta.12 → 1.8.0-beta.13

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.
@@ -1,9 +1,9 @@
1
1
  import { getEditorConfig } from "../utils/config.js";
2
+ import { getCodeBlockFormConfig } from "../utils/code-block.js";
2
3
  import { useServices } from "../hooks/use-services.js";
3
4
  import { useWindowRect } from "../hooks/use-window-rect.js";
4
5
  import { useEditorContentHeight } from "../hooks/use-editor-content-height.js";
5
6
  import { useNextFloatBoxPosition } from "../hooks/use-next-float-box-position.js";
6
- import { getCodeBlockFormConfig } from "../utils/code-block.js";
7
7
  import CodeEditor_default from "../layouts/CodeEditor.js";
8
8
  import FloatingBox_default from "./FloatingBox.js";
9
9
  import { MFormBox } from "@tmagic/form";
@@ -1,7 +1,7 @@
1
- import { getCodeBlockFormConfig } from "../utils/code-block.js";
1
+ import { useCompareForm } from "../hooks/use-compare-form.js";
2
2
  import { MForm } from "@tmagic/form";
3
3
  import { HookType } from "@tmagic/core";
4
- import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, inject, normalizeStyle, openBlock, provide, ref, unref, useTemplateRef, watch, watchEffect } from "vue";
4
+ import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, normalizeStyle, openBlock, unref } from "vue";
5
5
  import { isEqual } from "lodash-es";
6
6
  //#region packages/editor/src/components/CompareForm.vue?vue&type=script&setup=true&lang.ts
7
7
  var CompareForm_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
@@ -9,59 +9,27 @@ var CompareForm_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
9
9
  __name: "CompareForm",
10
10
  props: {
11
11
  value: {},
12
- lastValue: {},
13
12
  type: {},
14
13
  category: { default: "node" },
15
14
  dataSourceType: {},
16
15
  labelWidth: { default: "120px" },
17
16
  height: {},
18
- extendState: {
19
- type: Function,
20
- default: (state) => state
21
- },
17
+ extendState: {},
22
18
  baseFormState: {},
23
- selfDiffFieldTypes: {},
24
19
  size: {},
25
20
  loadConfig: {},
26
- services: {}
21
+ services: {},
22
+ lastValue: {},
23
+ selfDiffFieldTypes: {}
27
24
  },
28
25
  setup(__props, { expose: __expose }) {
29
26
  const props = __props;
30
- provide("services", props.services);
31
- const config = ref([]);
32
- /** vs-code 编辑器的 monaco 配置项,沿用 Editor 顶层 provide('codeOptions', ...) 的注入。 */
33
- const codeOptions = inject("codeOptions", {});
34
- /** 将代码块的 content 字段统一成字符串,便于在表单/对比中展示 */
35
- const normalizeCodeBlockValue = (v) => {
36
- if (!v) return {};
37
- const next = { ...v };
38
- if (next.content && typeof next.content !== "string") try {
39
- next.content = next.content.toString();
40
- } catch {
41
- next.content = "";
42
- }
43
- return next;
44
- };
45
- const currentValues = computed(() => {
46
- if (props.category === "code-block") return normalizeCodeBlockValue(props.value);
47
- return props.value || {};
48
- });
27
+ const { config, currentValues, wrapperStyle, mergedExtendState, loadConfig, formRef, normalizeCodeBlockValue } = useCompareForm(props);
49
28
  const lastValuesProcessed = computed(() => {
50
29
  if (props.category === "code-block") return normalizeCodeBlockValue(props.lastValue);
51
30
  return props.lastValue || {};
52
31
  });
53
32
  /**
54
- * 外层包裹层的样式:当传入 `height` 时启用固定高度 + 内部滚动,
55
- * 这样滚动条会出现在 CompareForm 内部,避免父容器(如 Dialog)自身也产生滚动。
56
- */
57
- const wrapperStyle = computed(() => {
58
- if (!props.height) return void 0;
59
- return {
60
- height: props.height,
61
- overflow: "auto"
62
- };
63
- });
64
- /**
65
33
  * `code-select` 字段在历史数据中存在两种"语义为空"的形态:
66
34
  * - 字符串 `''`(旧数据 / 用户从未配置过钩子);
67
35
  * - `{ hookType: HookType.CODE, hookData: [] }`(CodeSelect.vue 在挂载时
@@ -84,83 +52,6 @@ var CompareForm_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
84
52
  }
85
53
  return !isEqual(curValue, lastValue);
86
54
  };
87
- const removeStyleDisplayConfig = (formConfig) => formConfig.map((item) => {
88
- if (!("type" in item)) return item;
89
- if (item?.type !== "tab" || !Array.isArray(item.items)) return item;
90
- return {
91
- ...item,
92
- items: item.items.map((tabPane) => {
93
- if (tabPane?.title !== "样式" || !Array.isArray(tabPane.items)) return tabPane;
94
- return {
95
- ...tabPane,
96
- display: true
97
- };
98
- })
99
- };
100
- });
101
- const mergedExtendState = (state) => {
102
- return props.extendState(props.baseFormState || state);
103
- };
104
- /**
105
- * 内置的默认 FormConfig 加载逻辑:按 `category` 从对应 service / 工具取配置。
106
- * 作为 ctx.defaultLoadConfig 透传给自定义 `loadConfig`,方便复用与二次加工。
107
- */
108
- const defaultLoadConfig = async () => {
109
- if (!props.services) return [];
110
- switch (props.category) {
111
- case "node":
112
- if (!props.type) return [];
113
- return removeStyleDisplayConfig(await props.services.propsService.getPropsConfig(props.type, { node: props.value }));
114
- case "data-source": return props.services.dataSourceService.getFormConfig(props.type || "base").map((item) => "type" in item && item.type === "tab" ? {
115
- ...item,
116
- active: "fields"
117
- } : item);
118
- case "code-block": return getCodeBlockFormConfig({
119
- paramColConfig: props.services.codeBlockService.getParamsColConfig(),
120
- isDataSource: () => Boolean(props.dataSourceType),
121
- dataSourceType: () => props.dataSourceType,
122
- codeOptions,
123
- editable: false
124
- });
125
- default: return [];
126
- }
127
- };
128
- const loadConfig = async () => {
129
- if (props.loadConfig) {
130
- config.value = await props.loadConfig({
131
- category: props.category,
132
- type: props.type,
133
- dataSourceType: props.dataSourceType,
134
- defaultLoadConfig
135
- });
136
- return;
137
- }
138
- config.value = await defaultLoadConfig();
139
- };
140
- watch([
141
- () => props.category,
142
- () => props.type,
143
- () => props.dataSourceType,
144
- () => props.loadConfig
145
- ], () => {
146
- loadConfig();
147
- }, { immediate: true });
148
- const formRef = useTemplateRef("form");
149
- /**
150
- * 把 services / stage 注入 MForm 的 formState,避免 propsService 注入的表单配置中
151
- * 形如 `display: ({ services }) => services.uiService.get(...)` 的 filterFunction
152
- * 在执行时拿不到 `formState.services` 而报错。
153
- *
154
- * 与 props-panel/FormPanel.vue 中的注入方式保持一致:
155
- * - services:整个 useServices() 返回的服务集合;
156
- * - stage:当前 editorService.get('stage') 的最新值。
157
- */
158
- watchEffect(() => {
159
- if (formRef.value && props.services) {
160
- formRef.value.formState.stage = props.services.editorService.get("stage");
161
- formRef.value.formState.services = props.services;
162
- }
163
- });
164
55
  __expose({
165
56
  form: formRef,
166
57
  config,
@@ -169,18 +60,18 @@ var CompareForm_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
169
60
  return (_ctx, _cache) => {
170
61
  return openBlock(), createElementBlock("div", {
171
62
  class: "m-editor-compare-form-wrapper",
172
- style: normalizeStyle(wrapperStyle.value)
173
- }, [config.value.length ? (openBlock(), createBlock(unref(MForm), {
63
+ style: normalizeStyle(unref(wrapperStyle))
64
+ }, [unref(config).length ? (openBlock(), createBlock(unref(MForm), {
174
65
  key: 0,
175
66
  ref: "form",
176
67
  class: "m-editor-compare-form",
177
- config: config.value,
178
- "init-values": currentValues.value,
68
+ config: unref(config),
69
+ "init-values": unref(currentValues),
179
70
  "last-values": lastValuesProcessed.value,
180
71
  "is-compare": true,
181
72
  disabled: true,
182
73
  "label-width": __props.labelWidth,
183
- "extend-state": mergedExtendState,
74
+ "extend-state": unref(mergedExtendState),
184
75
  "show-diff": showDiff,
185
76
  "self-diff-field-types": __props.selfDiffFieldTypes,
186
77
  size: __props.size
@@ -189,6 +80,7 @@ var CompareForm_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
189
80
  "init-values",
190
81
  "last-values",
191
82
  "label-width",
83
+ "extend-state",
192
84
  "self-diff-field-types",
193
85
  "size"
194
86
  ])) : createCommentVNode("v-if", true)], 4);
@@ -0,0 +1,5 @@
1
+ import ViewForm_vue_vue_type_script_setup_true_lang_default from "./ViewForm.vue_vue_type_script_setup_true_lang.js";
2
+ //#region packages/editor/src/components/ViewForm.vue
3
+ var ViewForm_default = ViewForm_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
5
+ export { ViewForm_default as default };
@@ -0,0 +1,58 @@
1
+ import { useCompareForm } from "../hooks/use-compare-form.js";
2
+ import { MForm } from "@tmagic/form";
3
+ import { createBlock, createCommentVNode, createElementBlock, defineComponent, normalizeStyle, openBlock, unref } from "vue";
4
+ //#region packages/editor/src/components/ViewForm.vue?vue&type=script&setup=true&lang.ts
5
+ var ViewForm_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
6
+ name: "MEditorViewForm",
7
+ __name: "ViewForm",
8
+ props: {
9
+ value: {},
10
+ type: {},
11
+ category: { default: "node" },
12
+ dataSourceType: {},
13
+ labelWidth: { default: "120px" },
14
+ height: {},
15
+ extendState: {},
16
+ baseFormState: {},
17
+ size: {},
18
+ loadConfig: {},
19
+ services: {},
20
+ disabled: {
21
+ type: Boolean,
22
+ default: true
23
+ }
24
+ },
25
+ setup(__props, { expose: __expose }) {
26
+ const { config, currentValues, wrapperStyle, mergedExtendState, loadConfig, formRef } = useCompareForm(__props);
27
+ __expose({
28
+ form: formRef,
29
+ config,
30
+ reload: loadConfig
31
+ });
32
+ return (_ctx, _cache) => {
33
+ return openBlock(), createElementBlock("div", {
34
+ class: "m-editor-view-form-wrapper",
35
+ style: normalizeStyle(unref(wrapperStyle))
36
+ }, [unref(config).length ? (openBlock(), createBlock(unref(MForm), {
37
+ key: 0,
38
+ ref: "form",
39
+ class: "m-editor-view-form",
40
+ config: unref(config),
41
+ "init-values": unref(currentValues),
42
+ disabled: __props.disabled,
43
+ "label-width": __props.labelWidth,
44
+ "extend-state": unref(mergedExtendState),
45
+ size: __props.size
46
+ }, null, 8, [
47
+ "config",
48
+ "init-values",
49
+ "disabled",
50
+ "label-width",
51
+ "extend-state",
52
+ "size"
53
+ ])) : createCommentVNode("v-if", true)], 4);
54
+ };
55
+ }
56
+ });
57
+ //#endregion
58
+ export { ViewForm_vue_vue_type_script_setup_true_lang_default as default };
@@ -0,0 +1,119 @@
1
+ import { getCodeBlockFormConfig } from "../utils/code-block.js";
2
+ import { removeStyleDisplayConfig } from "../utils/props.js";
3
+ import { computed, inject, provide, ref, useTemplateRef, watch, watchEffect } from "vue";
4
+ //#region packages/editor/src/hooks/use-compare-form.ts
5
+ /**
6
+ * CompareForm / ViewForm 共用逻辑:
7
+ * - 按 `category`(node / data-source / code-block) 加载 FormConfig(支持自定义 `loadConfig`);
8
+ * - 代码块 `content` 归一化为字符串;
9
+ * - 外层容器固定高度 + 内部滚动的 `wrapperStyle`;
10
+ * - 将 services / stage 注入 MForm.formState,保证 filterFunction 上下文一致。
11
+ *
12
+ * 两个组件的差异仅在于是否做新旧值对比,这部分逻辑保留在各自组件中。
13
+ */
14
+ var useCompareForm = (props) => {
15
+ provide("services", props.services);
16
+ const config = ref([]);
17
+ /** vs-code 编辑器的 monaco 配置项,沿用 Editor 顶层 provide('codeOptions', ...) 的注入。 */
18
+ const codeOptions = inject("codeOptions", {});
19
+ /** 将代码块的 content 字段统一成字符串,便于在表单 / 对比中展示 */
20
+ const normalizeCodeBlockValue = (v) => {
21
+ if (!v) return {};
22
+ const next = { ...v };
23
+ if (next.content && typeof next.content !== "string") try {
24
+ next.content = next.content.toString();
25
+ } catch {
26
+ next.content = "";
27
+ }
28
+ return next;
29
+ };
30
+ const currentValues = computed(() => {
31
+ if (props.category === "code-block") return normalizeCodeBlockValue(props.value);
32
+ return props.value || {};
33
+ });
34
+ /**
35
+ * 外层包裹层的样式:当传入 `height` 时启用固定高度 + 内部滚动,
36
+ * 这样滚动条会出现在组件内部,避免父容器(如 Dialog)自身也产生滚动。
37
+ */
38
+ const wrapperStyle = computed(() => {
39
+ if (!props.height) return void 0;
40
+ return {
41
+ height: props.height,
42
+ overflow: "auto"
43
+ };
44
+ });
45
+ const mergedExtendState = (state) => {
46
+ return (props.extendState ?? ((s) => s))(props.baseFormState || state);
47
+ };
48
+ /**
49
+ * 内置的默认 FormConfig 加载逻辑:按 `category` 从对应 service / 工具取配置。
50
+ * 作为 ctx.defaultLoadConfig 透传给自定义 `loadConfig`,方便复用与二次加工。
51
+ */
52
+ const defaultLoadConfig = async () => {
53
+ if (!props.services) return [];
54
+ switch (props.category) {
55
+ case "node":
56
+ if (!props.type) return [];
57
+ return removeStyleDisplayConfig(await props.services.propsService.getPropsConfig(props.type, { node: props.value }));
58
+ case "data-source": return props.services.dataSourceService.getFormConfig(props.type || "base").map((item) => "type" in item && item.type === "tab" ? {
59
+ ...item,
60
+ active: "fields"
61
+ } : item);
62
+ case "code-block": return getCodeBlockFormConfig({
63
+ paramColConfig: props.services.codeBlockService.getParamsColConfig(),
64
+ isDataSource: () => Boolean(props.dataSourceType),
65
+ dataSourceType: () => props.dataSourceType,
66
+ codeOptions,
67
+ editable: false
68
+ });
69
+ default: return [];
70
+ }
71
+ };
72
+ const loadConfig = async () => {
73
+ if (props.loadConfig) {
74
+ config.value = await props.loadConfig({
75
+ category: props.category,
76
+ type: props.type,
77
+ dataSourceType: props.dataSourceType,
78
+ defaultLoadConfig
79
+ });
80
+ return;
81
+ }
82
+ config.value = await defaultLoadConfig();
83
+ };
84
+ watch([
85
+ () => props.category,
86
+ () => props.type,
87
+ () => props.dataSourceType,
88
+ () => props.loadConfig
89
+ ], () => {
90
+ loadConfig();
91
+ }, { immediate: true });
92
+ const formRef = useTemplateRef("form");
93
+ /**
94
+ * 把 services / stage 注入 MForm 的 formState,避免 propsService 注入的表单配置中
95
+ * 形如 `display: ({ services }) => services.uiService.get(...)` 的 filterFunction
96
+ * 在执行时拿不到 `formState.services` 而报错。
97
+ *
98
+ * 与 props-panel/FormPanel.vue 中的注入方式保持一致:
99
+ * - services:整个 useServices() 返回的服务集合;
100
+ * - stage:当前 editorService.get('stage') 的最新值。
101
+ */
102
+ watchEffect(() => {
103
+ if (formRef.value && props.services) {
104
+ formRef.value.formState.stage = props.services.editorService.get("stage");
105
+ formRef.value.formState.services = props.services;
106
+ }
107
+ });
108
+ return {
109
+ config,
110
+ currentValues,
111
+ wrapperStyle,
112
+ mergedExtendState,
113
+ loadConfig,
114
+ formRef,
115
+ normalizeCodeBlockValue
116
+ };
117
+ };
118
+ //#endregion
119
+ export { useCompareForm };
package/dist/es/index.js CHANGED
@@ -1,8 +1,10 @@
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, booleanOptions, displayTabConfig, eqOptions, eventTabConfig, fillConfig, getCondOpOptionsByFieldType, numberOptions, styleTabConfig, validatePropsForm } from "./utils/props.js";
4
- import props_default from "./services/props.js";
5
3
  import { getEditorConfig, setEditorConfig } from "./utils/config.js";
4
+ import { getCodeBlockFormConfig } from "./utils/code-block.js";
5
+ import { advancedTabConfig, arrayOptions, booleanOptions, displayTabConfig, eqOptions, eventTabConfig, fillConfig, getCondOpOptionsByFieldType, numberOptions, removeStyleDisplayConfig, styleTabConfig, validatePropsForm } from "./utils/props.js";
6
+ import { useCompareForm } from "./hooks/use-compare-form.js";
7
+ import props_default from "./services/props.js";
6
8
  import { UndoRedo } from "./utils/undo-redo.js";
7
9
  import { createStackStep, describeRevertStep, deserializeStacks, detectStackOpType, detectTargetId, detectTargetName, getLastPushedHistoryIds, getOrCreateStack, markStackSaved, mergeSteps, serializeStacks, undoFloor } from "./utils/history.js";
8
10
  import { idbDelete, idbGet, idbSet, isIndexedDBSupported, openIndexedDB } from "./utils/indexed-db.js";
@@ -23,7 +25,6 @@ import { useFilter } from "./hooks/use-filter.js";
23
25
  import { useGetSo } from "./hooks/use-getso.js";
24
26
  import { useNextFloatBoxPosition } from "./hooks/use-next-float-box-position.js";
25
27
  import { useNodeStatus } from "./hooks/use-node-status.js";
26
- import { getCodeBlockFormConfig } from "./utils/code-block.js";
27
28
  import { debug, error, info, log, warn } from "./utils/logger.js";
28
29
  import { getCascaderOptionsFromFields, getDisplayField, getFieldType, getFormConfig, getFormValue, resolveFieldByPath } from "./utils/data-source/index.js";
29
30
  import { IdleTask } from "./utils/dep/idle-task.js";
@@ -74,6 +75,7 @@ import Index_default from "./fields/DataSourceFieldSelect/Index.js";
74
75
  import EventSelect_default from "./fields/EventSelect.js";
75
76
  import KeyValue_default from "./fields/KeyValue.js";
76
77
  import CompareForm_default from "./components/CompareForm.js";
78
+ import ViewForm_default from "./components/ViewForm.js";
77
79
  import HistoryDiffDialog_default from "./layouts/history-list/HistoryDiffDialog.js";
78
80
  import PageFragmentSelect_default from "./fields/PageFragmentSelect.js";
79
81
  import DisplayConds_default from "./fields/DisplayConds.js";
@@ -90,4 +92,4 @@ export * from "@tmagic/table";
90
92
  export * from "@tmagic/stage";
91
93
  export * from "@tmagic/design";
92
94
  export * from "@tmagic/utils";
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 };
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, isIncludeDataSource, isIndexedDBSupported, keybinding_default as keybindingService, monaco_editor_default as loadMonaco, log, markStackSaved, mergeSteps, moveItemsInContainer, normalizeCompActionValue, numberOptions, openIndexedDB, props_default as propsService, removeStyleDisplayConfig, 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, validatePropsForm, warn };
@@ -1,6 +1,6 @@
1
1
  import { CODE_DRAFT_STORAGE_KEY } from "../type.js";
2
- import BaseService from "./BaseService.js";
3
2
  import { getEditorConfig } from "../utils/config.js";
3
+ import BaseService from "./BaseService.js";
4
4
  import { createStackStep, describeRevertStep, getLastPushedHistoryIds } from "../utils/history.js";
5
5
  import history_default from "./history.js";
6
6
  import storage_default, { Protocol } from "./storage.js";
@@ -1,5 +1,5 @@
1
- import BaseService from "./BaseService.js";
2
1
  import { getEditorConfig } from "../utils/config.js";
2
+ import BaseService from "./BaseService.js";
3
3
  import { UndoRedo } from "../utils/undo-redo.js";
4
4
  import { deserializeStacks, getOrCreateStack, markStackSaved, mergeSteps, serializeStacks, undoFloor } from "../utils/history.js";
5
5
  import { idbGet, idbSet } from "../utils/indexed-db.js";
@@ -1,5 +1,5 @@
1
- import BaseService from "./BaseService.js";
2
1
  import { fillConfig } from "../utils/props.js";
2
+ import BaseService from "./BaseService.js";
3
3
  import editor_default from "./editor.js";
4
4
  import { getNodePath, getValueByKeyPath, guid, setValueByKeyPath, toLine } from "@tmagic/utils";
5
5
  import { Target, Watcher } from "@tmagic/core";
@@ -1,5 +1,5 @@
1
- import BaseService from "./BaseService.js";
2
1
  import { getEditorConfig } from "../utils/config.js";
2
+ import BaseService from "./BaseService.js";
3
3
  import serialize from "serialize-javascript";
4
4
  //#region packages/editor/src/services/storage.ts
5
5
  var Protocol = /* @__PURE__ */ function(Protocol) {
@@ -276,6 +276,31 @@ var fillConfig = (config = [], { labelWidth = "80px", disabledDataSource = false
276
276
  return [tabConfig];
277
277
  };
278
278
  /**
279
+ * 将属性表单配置中「样式」tab-pane 的 `display` 强制置为 `true`。
280
+ *
281
+ * `propsService.getPropsConfig` 返回的样式 tab 默认带有
282
+ * `display: ({ services }) => !(services?.uiService?.get('showStylePanel') ?? true)`,
283
+ * 在对比 / 只读展示场景(CompareForm / ViewForm)下并不需要跟随 uiService 状态隐藏,
284
+ * 这里统一放开,保证样式 tab 始终可见。
285
+ *
286
+ * @param formConfig 组件属性表单配置
287
+ * @returns 处理后的表单配置(不修改入参,返回浅拷贝)
288
+ */
289
+ var removeStyleDisplayConfig = (formConfig) => formConfig.map((item) => {
290
+ if (!("type" in item)) return item;
291
+ if (item?.type !== "tab" || !Array.isArray(item.items)) return item;
292
+ return {
293
+ ...item,
294
+ items: item.items.map((tabPane) => {
295
+ if (tabPane?.title !== "样式" || !Array.isArray(tabPane.items)) return tabPane;
296
+ return {
297
+ ...tabPane,
298
+ display: true
299
+ };
300
+ })
301
+ };
302
+ });
303
+ /**
279
304
  * 对一份「组件属性表单配置 + 值」做一次独立的校验,**不复用也不污染页面上正在展示的表单**。
280
305
  *
281
306
  * 内部基于 `@tmagic/form` 的 `validateForm` 另建一个独立的 MForm 实例完成校验,并统一处理
@@ -319,4 +344,4 @@ var validatePropsForm = ({ config, values, appContext = null, services, stage, e
319
344
  })
320
345
  });
321
346
  //#endregion
322
- export { advancedTabConfig, arrayOptions, booleanOptions, displayTabConfig, eqOptions, eventTabConfig, fillConfig, getCondOpOptionsByFieldType, numberOptions, styleTabConfig, validatePropsForm };
347
+ export { advancedTabConfig, arrayOptions, booleanOptions, displayTabConfig, eqOptions, eventTabConfig, fillConfig, getCondOpOptionsByFieldType, numberOptions, removeStyleDisplayConfig, styleTabConfig, validatePropsForm };