refactor: the default openSize of dialog should be middle (#3569)

This commit is contained in:
katherinehhh 2024-02-25 17:36:16 +08:00 committed by GitHub
parent 5bf7acdf66
commit e6719763f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 4 deletions

View File

@ -15,7 +15,7 @@ const openSizeWidthMap = new Map<OpenSize, string>([
export const ActionModal: ComposedActionDrawer<ModalProps> = observer(
(props) => {
const { footerNodeName = 'Action.Modal.Footer', width, ...others } = props;
const { visible, setVisible, openSize = 'large', modalProps } = useActionContext();
const { visible, setVisible, openSize = 'middle', modalProps } = useActionContext();
const actualWidth = width ?? openSizeWidthMap.get(openSize);
const schema = useFieldSchema();
const field = useField();

View File

@ -427,9 +427,7 @@ export const formItemSettings = new SchemaSettings({
{ label: t('Middle'), value: 'middle' },
{ label: t('Large'), value: 'large' },
],
value:
fieldSchema?.['x-component-props']?.['openSize'] ??
(fieldSchema?.['x-component-props']?.['openMode'] == 'modal' ? 'large' : 'middle'),
value: fieldSchema?.['x-component-props']?.['openSize'] ?? 'middle',
onChange: (value) => {
field.componentProps.openSize = value;
fieldSchema['x-component-props'] = field.componentProps;