mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 15:39:24 +08:00
fix: associationSelect
This commit is contained in:
parent
9864292029
commit
dba550803a
@ -14,7 +14,7 @@ import {
|
|||||||
TableSelectorParamsProvider,
|
TableSelectorParamsProvider,
|
||||||
useTableSelectorProps as useTsp,
|
useTableSelectorProps as useTsp,
|
||||||
} from '../../../block-provider/TableSelectorProvider';
|
} from '../../../block-provider/TableSelectorProvider';
|
||||||
import { CollectionProvider, useCollection } from '../../../collection-manager';
|
import { CollectionProvider, useCollection, useCollectionManager } from '../../../collection-manager';
|
||||||
import { useCompile } from '../../hooks';
|
import { useCompile } from '../../hooks';
|
||||||
import { ActionContext } from '../action';
|
import { ActionContext } from '../action';
|
||||||
import { useFieldNames, useInsertSchema } from './hooks';
|
import { useFieldNames, useInsertSchema } from './hooks';
|
||||||
@ -71,7 +71,8 @@ export const InternalPicker = observer((props: any) => {
|
|||||||
const insertSelector = useInsertSchema('Selector');
|
const insertSelector = useInsertSchema('Selector');
|
||||||
const { getField } = useCollection();
|
const { getField } = useCollection();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const collectionField = getField(field.props.name);
|
const { getCollectionJoinField } = useCollectionManager();
|
||||||
|
const collectionField = getField(field.props.name) || getCollectionJoinField(fieldSchema?.['x-collection-field']);
|
||||||
const addbuttonClick = () => {
|
const addbuttonClick = () => {
|
||||||
insertAddNewer(schema.AddNewer);
|
insertAddNewer(schema.AddNewer);
|
||||||
setVisibleAddNewer(true);
|
setVisibleAddNewer(true);
|
||||||
|
@ -37,8 +37,8 @@ export default function useServiceOptions(props) {
|
|||||||
const { action = 'list', service, fieldNames } = props;
|
const { action = 'list', service, fieldNames } = props;
|
||||||
const params = service?.params || {};
|
const params = service?.params || {};
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
const { getField, fields } = useCollection();
|
const { getField } = useCollection();
|
||||||
const { getCollectionFields } = useCollectionManager();
|
const { getCollectionFields, getCollectionJoinField } = useCollectionManager();
|
||||||
const record = useRecord();
|
const record = useRecord();
|
||||||
|
|
||||||
const normalizeValues = useCallback(
|
const normalizeValues = useCallback(
|
||||||
@ -63,8 +63,9 @@ export default function useServiceOptions(props) {
|
|||||||
}, [props.value, normalizeValues]);
|
}, [props.value, normalizeValues]);
|
||||||
|
|
||||||
const collectionField = useMemo(() => {
|
const collectionField = useMemo(() => {
|
||||||
return getField(fieldSchema.name);
|
return getField(fieldSchema.name) || getCollectionJoinField(fieldSchema?.['x-collection-field']);
|
||||||
}, [fieldSchema.name]);
|
}, [fieldSchema.name]);
|
||||||
|
|
||||||
const sourceValue = record?.[collectionField?.sourceKey];
|
const sourceValue = record?.[collectionField?.sourceKey];
|
||||||
const filter = useMemo(() => {
|
const filter = useMemo(() => {
|
||||||
const isOToAny = ['oho', 'o2m'].includes(collectionField?.interface);
|
const isOToAny = ['oho', 'o2m'].includes(collectionField?.interface);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user