mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +08:00
fix: association select support add mode (#4108)
This commit is contained in:
parent
c8454ab006
commit
31c5ff6624
@ -52,7 +52,6 @@ const InternalAssociationSelect = observer(
|
||||
// 因为通过 Schema 的形式书写的组件,在值变更的时候 `value` 的值没有改变,所以需要维护一个 `innerValue` 来变更值
|
||||
const [innerValue, setInnerValue] = useState(value);
|
||||
const addMode = fieldSchema['x-component-props']?.addMode;
|
||||
const isAllowAddNew = fieldSchema['x-add-new'];
|
||||
const { t } = useTranslation();
|
||||
const { multiple } = props;
|
||||
const form = useForm();
|
||||
@ -133,7 +132,7 @@ const InternalAssociationSelect = observer(
|
||||
CustomDropdownRender={addMode === 'quickAdd' && QuickAddContent}
|
||||
></RemoteSelect>
|
||||
|
||||
{(addMode === 'modalAdd' || isAllowAddNew) && (
|
||||
{addMode === 'modalAdd' && (
|
||||
<RecordProvider isNew={true} record={null} parent={recordData}>
|
||||
{/* 快捷添加按钮添加的添加的是一个普通的 form 区块(非关系区块),不应该与任何字段有关联,所以在这里把字段相关的上下文给清除掉 */}
|
||||
<ClearCollectionFieldContext>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { observer, RecursionField, useField, useFieldSchema } from '@formily/react';
|
||||
import { Input, Select } from 'antd';
|
||||
import { Input, Select, Space } from 'antd';
|
||||
import { differenceBy, unionBy } from 'lodash';
|
||||
import React, { useContext, useMemo, useState } from 'react';
|
||||
import {
|
||||
@ -139,7 +139,7 @@ export const InternalPicker = observer(
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<Input.Group compact style={{ display: 'flex', lineHeight: '32px' }}>
|
||||
<Space.Compact style={{ display: 'flex', lineHeight: '32px' }}>
|
||||
<div style={{ width: '100%' }}>
|
||||
<Select
|
||||
role="button"
|
||||
@ -190,7 +190,7 @@ export const InternalPicker = observer(
|
||||
</ClearCollectionFieldContext>
|
||||
</RecordProvider>
|
||||
)}
|
||||
</Input.Group>
|
||||
</Space.Compact>
|
||||
<ActionContextProvider
|
||||
value={{
|
||||
openSize: fieldSchema['x-component-props']?.['openSize'] || openSize,
|
||||
|
Loading…
x
Reference in New Issue
Block a user