From 948d39bab490da140bafb02eab0a86665000127e Mon Sep 17 00:00:00 2001 From: black Date: Thu, 25 May 2023 13:05:00 +0800 Subject: [PATCH] chore: when using association field by picker mode,it's open size can be changed (#1926) --- .../antd/action/Action.Drawer.tsx | 4 +- .../antd/form-item/FormItem.tsx | 39 ++++++++++++++++++- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/action/Action.Drawer.tsx b/packages/core/client/src/schema-component/antd/action/Action.Drawer.tsx index e0550fc43..74994bda5 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.Drawer.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.Drawer.tsx @@ -20,6 +20,8 @@ export const ActionDrawer: ComposedActionDrawer = observer((props) => { const { visible, setVisible, openSize = 'middle' } = useActionContext(); const schema = useFieldSchema(); const field = useField(); + const openSizeFromParent = schema.parent?.['x-component-props']?.['openSize']; + const finalOpenSize = openSizeFromParent || openSize; const footerSchema = schema.reduceProperties((buf, s) => { if (s['x-component'] === footerNodeName) { return s; @@ -35,7 +37,7 @@ export const ActionDrawer: ComposedActionDrawer = observer((props) => { }} > .nb-form-item { @@ -174,6 +175,10 @@ FormItem.Designer = function Designer() { const fieldSchemaWithoutRequired = _.omit(fieldSchema, 'required'); + const isPickerMode = fieldSchema['x-component-props'].mode === 'Picker'; + const showFieldMode = isAssociationField && fieldModeOptions && !isTableField; + const showModeSelect = showFieldMode && isPickerMode; + return ( @@ -559,7 +564,7 @@ FormItem.Designer = function Designer() { }} /> )} - {isAssociationField && fieldModeOptions && !isTableField && ( + {showFieldMode && ( )} - + {showModeSelect && ( + +
+ {t('Popup size')} +