fix: adding inherited blocks in relation fields under edited operate should only display themselves (#1967)

This commit is contained in:
katherinehhh 2023-06-01 16:21:12 +08:00 committed by GitHub
parent a69e1acbf4
commit 1aad355950
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 16 deletions

View File

@ -4,6 +4,7 @@ import { Input } from 'antd';
import React from 'react'; import React from 'react';
import { RemoteSelect, RemoteSelectProps } from '../remote-select'; import { RemoteSelect, RemoteSelectProps } from '../remote-select';
import useServiceOptions from './hooks'; import useServiceOptions from './hooks';
import { RecordProvider } from '../../../';
export type AssociationSelectProps<P = any> = RemoteSelectProps<P> & { export type AssociationSelectProps<P = any> = RemoteSelectProps<P> & {
action?: string; action?: string;
@ -30,6 +31,7 @@ const InternalAssociationSelect = observer((props: AssociationSelectProps) => {
></RemoteSelect> ></RemoteSelect>
{isAllowAddNew && ( {isAllowAddNew && (
<RecordProvider record={null}>
<RecursionField <RecursionField
onlyRenderProperties onlyRenderProperties
basePath={field.address} basePath={field.address}
@ -38,6 +40,7 @@ const InternalAssociationSelect = observer((props: AssociationSelectProps) => {
return s['x-component'] === 'Action'; return s['x-component'] === 'Action';
}} }}
/> />
</RecordProvider>
)} )}
</Input.Group> </Input.Group>
</div> </div>

View File

@ -19,6 +19,7 @@ import { ActionContext } from '../action';
import { useAssociationFieldContext, useFieldNames, useInsertSchema } from './hooks'; import { useAssociationFieldContext, useFieldNames, useInsertSchema } from './hooks';
import schema from './schema'; import schema from './schema';
import { flatData, getLabelFormatValue, useLabelUiSchema } from './util'; import { flatData, getLabelFormatValue, useLabelUiSchema } from './util';
import { RecordProvider } from '../../../';
const useTableSelectorProps = () => { const useTableSelectorProps = () => {
const field: any = useField(); const field: any = useField();
@ -159,6 +160,7 @@ export const InternalPicker = observer((props: any) => {
/> />
</div> </div>
{isAllowAddNew && ( {isAllowAddNew && (
<RecordProvider record={null}>
<RecursionField <RecursionField
onlyRenderProperties onlyRenderProperties
basePath={field.address} basePath={field.address}
@ -167,6 +169,7 @@ export const InternalPicker = observer((props: any) => {
return s['x-component'] === 'Action'; return s['x-component'] === 'Action';
}} }}
/> />
</RecordProvider>
)} )}
</Input.Group> </Input.Group>
<ActionContext.Provider value={{ openMode: 'drawer', visible: visibleSelector, setVisible: setVisibleSelector }}> <ActionContext.Provider value={{ openMode: 'drawer', visible: visibleSelector, setVisible: setVisibleSelector }}>