mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 03:56:16 +00:00
fix: limit editing to current collection form block in non-config mode and hide other block (#5499)
This commit is contained in:
parent
f7a368f802
commit
8e6da46691
@ -24,6 +24,8 @@ import { useActionContext } from '../schema-component';
|
|||||||
import { BlockProvider, useBlockRequestContext } from './BlockProvider';
|
import { BlockProvider, useBlockRequestContext } from './BlockProvider';
|
||||||
import { TemplateBlockProvider } from './TemplateBlockProvider';
|
import { TemplateBlockProvider } from './TemplateBlockProvider';
|
||||||
import { FormActiveFieldsProvider } from './hooks/useFormActiveFields';
|
import { FormActiveFieldsProvider } from './hooks/useFormActiveFields';
|
||||||
|
import { useDesignable } from '../schema-component';
|
||||||
|
import { useCollectionRecordData } from '../data-source';
|
||||||
|
|
||||||
export const FormBlockContext = createContext<{
|
export const FormBlockContext = createContext<{
|
||||||
form?: any;
|
form?: any;
|
||||||
@ -123,6 +125,18 @@ export const useIsDetailBlock = () => {
|
|||||||
export const FormBlockProvider = withDynamicSchemaProps((props) => {
|
export const FormBlockProvider = withDynamicSchemaProps((props) => {
|
||||||
const parentRecordData = useCollectionParentRecordData();
|
const parentRecordData = useCollectionParentRecordData();
|
||||||
const { parentRecord } = props;
|
const { parentRecord } = props;
|
||||||
|
const record = useCollectionRecordData();
|
||||||
|
const { association } = props;
|
||||||
|
const cm = useCollectionManager();
|
||||||
|
const { __collection } = record || {};
|
||||||
|
const { designable } = useDesignable();
|
||||||
|
const collection = props.collection || cm.getCollection(association).name;
|
||||||
|
|
||||||
|
if (!designable && __collection) {
|
||||||
|
if (__collection !== collection) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TemplateBlockProvider>
|
<TemplateBlockProvider>
|
||||||
|
Loading…
Reference in New Issue
Block a user