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,14 +31,16 @@ const InternalAssociationSelect = observer((props: AssociationSelectProps) => {
></RemoteSelect> ></RemoteSelect>
{isAllowAddNew && ( {isAllowAddNew && (
<RecursionField <RecordProvider record={null}>
onlyRenderProperties <RecursionField
basePath={field.address} onlyRenderProperties
schema={fieldSchema} basePath={field.address}
filterProperties={(s) => { schema={fieldSchema}
return s['x-component'] === 'Action'; filterProperties={(s) => {
}} 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,14 +160,16 @@ export const InternalPicker = observer((props: any) => {
/> />
</div> </div>
{isAllowAddNew && ( {isAllowAddNew && (
<RecursionField <RecordProvider record={null}>
onlyRenderProperties <RecursionField
basePath={field.address} onlyRenderProperties
schema={fieldSchema} basePath={field.address}
filterProperties={(s) => { schema={fieldSchema}
return s['x-component'] === 'Action'; filterProperties={(s) => {
}} 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 }}>