chore: when using association field by picker mode,it's open size can be changed (#1926)
This commit is contained in:
parent
e787890671
commit
948d39bab4
@ -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) => {
|
||||
}}
|
||||
>
|
||||
<Drawer
|
||||
width={openSizeWidthMap.get(openSize)}
|
||||
width={openSizeWidthMap.get(finalOpenSize)}
|
||||
title={field.title}
|
||||
{...others}
|
||||
destroyOnClose
|
||||
|
@ -32,6 +32,7 @@ import { FilterDynamicComponent } from '../table-v2/FilterDynamicComponent';
|
||||
import { isInvariable } from '../variable';
|
||||
import { FilterFormDesigner } from './FormItem.FilterFormDesigner';
|
||||
import { useEnsureOperatorsValid } from './SchemaSettingOptions';
|
||||
import { Select } from 'antd';
|
||||
|
||||
const defaultInputStyle = css`
|
||||
& > .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 (
|
||||
<GeneralSchemaDesigner>
|
||||
<GeneralSchemaItems />
|
||||
@ -559,7 +564,7 @@ FormItem.Designer = function Designer() {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{isAssociationField && fieldModeOptions && !isTableField && (
|
||||
{showFieldMode && (
|
||||
<SchemaSettings.SelectItem
|
||||
key="field-mode"
|
||||
title={t('Field mode')}
|
||||
@ -585,7 +590,37 @@ FormItem.Designer = function Designer() {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showModeSelect && (
|
||||
<SchemaSettings.Item>
|
||||
<div style={{ alignItems: 'center', display: 'flex', justifyContent: 'space-between' }}>
|
||||
{t('Popup size')}
|
||||
<Select
|
||||
bordered={false}
|
||||
options={[
|
||||
{ label: t('Small'), value: 'small' },
|
||||
{ label: t('Middle'), value: 'middle' },
|
||||
{ label: t('Large'), value: 'large' },
|
||||
]}
|
||||
value={
|
||||
fieldSchema?.['x-component-props']?.['openSize'] ??
|
||||
(fieldSchema?.['x-component-props']?.['openMode'] == 'modal' ? 'large' : 'middle')
|
||||
}
|
||||
onChange={(value) => {
|
||||
field.componentProps.openSize = value;
|
||||
fieldSchema['x-component-props'] = field.componentProps;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
'x-component-props': fieldSchema['x-component-props'],
|
||||
},
|
||||
});
|
||||
dn.refresh();
|
||||
}}
|
||||
style={{ textAlign: 'right', minWidth: 100 }}
|
||||
/>
|
||||
</div>
|
||||
</SchemaSettings.Item>
|
||||
)}
|
||||
{!field.readPretty && isAssociationField && ['Select', 'Picker'].includes(fieldMode) && (
|
||||
<SchemaSettings.SwitchItem
|
||||
key="allowAddNew"
|
||||
|
Loading…
Reference in New Issue
Block a user