diff --git a/packages/editor/src/components/CompareForm.vue b/packages/editor/src/components/CompareForm.vue index 56569926..d825c014 100644 --- a/packages/editor/src/components/CompareForm.vue +++ b/packages/editor/src/components/CompareForm.vue @@ -13,6 +13,7 @@ :extend-state="mergedExtendState" :show-diff="showDiff" :self-diff-field-types="selfDiffFieldTypes" + :size="size" > @@ -22,6 +23,7 @@ import { computed, inject, provide, type Ref, ref, type ShallowRef, useTemplateR import { isEqual } from 'lodash-es'; import { type CodeBlockContent, type DataSourceSchema, HookType, type MNode } from '@tmagic/core'; +import { type FieldSize } from '@tmagic/design'; import { type FormConfig, type FormState, type FormValue, MForm } from '@tmagic/form'; import type { CompareCategory, CompareFormLoadConfig, Services } from '@editor/type'; @@ -68,6 +70,11 @@ const props = withDefaults( baseFormState?: FormState; /** 需要走 self diff 的字段类型(例如 mod-cond)。 */ selfDiffFieldTypes?: string[]; + /** + * 表单内组件的尺寸(透传给 MForm 的 `size`),可选 'large' | 'default' | 'small'。 + * 缺省时使用 MForm 内置默认尺寸。 + */ + size?: FieldSize; /** * 自定义 FormConfig 加载逻辑。传入后将接管内置的按 `category`(node/data-source/code-block) * 取配置逻辑,调用方可根据业务自行返回(或异步返回)表单配置。可通过 diff --git a/packages/editor/src/layouts/history-list/HistoryDiffDialog.vue b/packages/editor/src/layouts/history-list/HistoryDiffDialog.vue index c2b38fbf..8d89ae45 100644 --- a/packages/editor/src/layouts/history-list/HistoryDiffDialog.vue +++ b/packages/editor/src/layouts/history-list/HistoryDiffDialog.vue @@ -48,6 +48,7 @@ :load-config="loadConfig" :self-diff-field-types="selfDiffFieldTypes" :services="props.services" + :size="props.size" height="70vh" /> @@ -77,7 +78,14 @@ import { computed, ref, watch } from 'vue'; import { isEqual } from 'lodash-es'; -import { TMagicButton, TMagicDialog, TMagicRadioButton, TMagicRadioGroup, TMagicTag } from '@tmagic/design'; +import { + type FieldSize, + TMagicButton, + TMagicDialog, + TMagicRadioButton, + TMagicRadioGroup, + TMagicTag, +} from '@tmagic/design'; import type { FormState } from '@tmagic/form'; import CompareForm from '@editor/components/CompareForm.vue'; @@ -104,6 +112,8 @@ const props = withDefaults( */ loadConfig?: CompareFormLoadConfig; width?: string; + /** 差异对比表单内组件的尺寸(透传给 CompareForm 的 `size`),可选 'large' | 'default' | 'small'。 */ + size?: FieldSize; isConfirm?: boolean; onConfirm?: () => void; selfDiffFieldTypes?: string[]; diff --git a/packages/editor/src/layouts/history-list/useHistoryRevert.ts b/packages/editor/src/layouts/history-list/useHistoryRevert.ts index 6c241298..fffbb13e 100644 --- a/packages/editor/src/layouts/history-list/useHistoryRevert.ts +++ b/packages/editor/src/layouts/history-list/useHistoryRevert.ts @@ -95,6 +95,7 @@ const mountHistoryDiffDialog = async ( selfDiffFieldTypes: options.selfDiffFieldTypes, compareFormState: options.compareFormState, width: options.width, + size: options.size ?? options.services?.uiService?.get('propsPanelSize'), onClose: options.onClose, }); if (options.appContext) { @@ -223,6 +224,7 @@ export const useHistoryRevert = (options: UseHistoryRevertOptions = {}, services services, ...extra, width: extra?.width ?? dialogWidth, + size: extra?.size, }); } return confirmRevert(); @@ -382,6 +384,7 @@ export const useHistoryRevert = (options: UseHistoryRevertOptions = {}, services loadConfig: revertOptions.loadConfig, selfDiffFieldTypes: revertOptions.selfDiffFieldTypes, width: revertOptions.width, + size: revertOptions.size, }); if (!confirmed) return null; return await revertOptions.revert(); @@ -399,6 +402,7 @@ export const useHistoryRevert = (options: UseHistoryRevertOptions = {}, services services, ...extra, width: extra?.width ?? dialogWidth, + size: extra?.size, }); }; diff --git a/packages/editor/src/type.ts b/packages/editor/src/type.ts index 38e7263d..0d302bd7 100644 --- a/packages/editor/src/type.ts +++ b/packages/editor/src/type.ts @@ -33,6 +33,7 @@ import type { MPage, MPageFragment, } from '@tmagic/core'; +import type { FieldSize } from '@tmagic/design'; import type { ChangeRecord, FormConfig, FormState, TableColumnConfig, TypeFunction } from '@tmagic/form'; import type StageCore from '@tmagic/stage'; import type { @@ -1453,6 +1454,11 @@ export interface CustomDiffFormOptions { * 如 `'1200px'` / `'80%'`。缺省时使用弹窗内置默认宽度(900px)。 */ width?: string; + /** + * 差异 / 确认回滚弹窗内 form 表单的尺寸(透传给 CompareForm 的 `size`), + * 可选 `'large' | 'default' | 'small'`,缺省时使用表单内置默认尺寸。 + */ + size?: FieldSize; } /**