fix: fix loss of data scope field in permission configuration

This commit is contained in:
Zeke Zhang 2024-05-27 18:24:54 +08:00
parent 0adf5fb6b7
commit a1909d9ce4

View File

@ -8,7 +8,14 @@
*/
import { ISchema } from '@formily/react';
import { Filter, FlagProvider, VariableInput, useFilterFieldOptions, useFormBlockContext } from '@nocobase/client';
import {
Filter,
FlagProvider,
VariableInput,
useFilterFieldOptions,
useFormBlockContext,
withDynamicSchemaProps,
} from '@nocobase/client';
import React, { useContext, useEffect } from 'react';
import { RoleResourceCollectionContext } from '../RolesResourcesActions';
@ -146,13 +153,13 @@ export const getScopesSchema = (dataSourceKey) => {
title: '{{t("Data scope")}}',
name: 'filter',
'x-decorator': 'FormItem',
'x-component': (props) => {
'x-component': withDynamicSchemaProps((props) => {
return (
<FlagProvider isVariableParsedInOtherContext={true}>
<Filter {...props} />
</FlagProvider>
);
},
}),
'x-use-component-props': () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const ctx = useContext(RoleResourceCollectionContext);
@ -280,13 +287,13 @@ export const getScopesSchema = (dataSourceKey) => {
title: '{{t("Data scope")}}',
name: 'filter',
'x-decorator': 'FormItem',
'x-component': (props) => {
'x-component': withDynamicSchemaProps((props) => {
return (
<FlagProvider isVariableParsedInOtherContext={true}>
<Filter {...props} />
</FlagProvider>
);
},
}),
'x-use-component-props': () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const ctx = useContext(RoleResourceCollectionContext);