mirror of
https://github.com/nocobase/nocobase
synced 2024-11-14 22:05:38 +00:00
fix(plugin-workflow): fix field crash in block (#5366)
Some checks are pending
auto-merge / push-commit (push) Waiting to run
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
deploy client docs / Build (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
Some checks are pending
auto-merge / push-commit (push) Waiting to run
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
deploy client docs / Build (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
This commit is contained in:
parent
69302e1ddf
commit
f074029624
@ -122,7 +122,7 @@ export const DataBlockContext = createContext<DataBlockContextValue<any>>({} as
|
|||||||
DataBlockContext.displayName = 'DataBlockContext';
|
DataBlockContext.displayName = 'DataBlockContext';
|
||||||
|
|
||||||
const DataBlockResourceContext = createContext<{ rerenderDataBlock: () => void }>(null);
|
const DataBlockResourceContext = createContext<{ rerenderDataBlock: () => void }>(null);
|
||||||
const RerenderDataBlockProvider: FC = ({ children }) => {
|
export const RerenderDataBlockProvider: FC = ({ children }) => {
|
||||||
const [hidden, setHidden] = React.useState(false);
|
const [hidden, setHidden] = React.useState(false);
|
||||||
const value = useMemo(() => {
|
const value = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
|
@ -18,6 +18,7 @@ import {
|
|||||||
FormBlockContext,
|
FormBlockContext,
|
||||||
FormV2,
|
FormV2,
|
||||||
RecordProvider,
|
RecordProvider,
|
||||||
|
RerenderDataBlockProvider,
|
||||||
useAPIClient,
|
useAPIClient,
|
||||||
useAssociationNames,
|
useAssociationNames,
|
||||||
useBlockRequestContext,
|
useBlockRequestContext,
|
||||||
@ -82,16 +83,18 @@ export function FormBlockProvider(props) {
|
|||||||
<CollectionManagerProvider dataSource={dataSource}>
|
<CollectionManagerProvider dataSource={dataSource}>
|
||||||
<CollectionProvider_deprecated collection={props.collection}>
|
<CollectionProvider_deprecated collection={props.collection}>
|
||||||
<RecordProvider record={values} parent={null}>
|
<RecordProvider record={values} parent={null}>
|
||||||
<FormActiveFieldsProvider name="form">
|
<RerenderDataBlockProvider>
|
||||||
<BlockRequestContext_deprecated.Provider
|
<FormActiveFieldsProvider name="form">
|
||||||
value={{ block: 'form', props, field, service, resource, __parent }}
|
<BlockRequestContext_deprecated.Provider
|
||||||
>
|
value={{ block: 'form', props, field, service, resource, __parent }}
|
||||||
<FormBlockContext.Provider value={formBlockValue}>
|
>
|
||||||
<FormV2.Templates style={{ marginBottom: token.margin }} form={form} />
|
<FormBlockContext.Provider value={formBlockValue}>
|
||||||
<div ref={formBlockRef}>{props.children}</div>
|
<FormV2.Templates style={{ marginBottom: token.margin }} form={form} />
|
||||||
</FormBlockContext.Provider>
|
<div ref={formBlockRef}>{props.children}</div>
|
||||||
</BlockRequestContext_deprecated.Provider>
|
</FormBlockContext.Provider>
|
||||||
</FormActiveFieldsProvider>
|
</BlockRequestContext_deprecated.Provider>
|
||||||
|
</FormActiveFieldsProvider>
|
||||||
|
</RerenderDataBlockProvider>
|
||||||
</RecordProvider>
|
</RecordProvider>
|
||||||
</CollectionProvider_deprecated>
|
</CollectionProvider_deprecated>
|
||||||
</CollectionManagerProvider>
|
</CollectionManagerProvider>
|
||||||
|
@ -19,6 +19,7 @@ import {
|
|||||||
CollectionManagerProvider,
|
CollectionManagerProvider,
|
||||||
CollectionProvider,
|
CollectionProvider,
|
||||||
FormProvider,
|
FormProvider,
|
||||||
|
RerenderDataBlockProvider,
|
||||||
SchemaComponent,
|
SchemaComponent,
|
||||||
SchemaComponentOptions,
|
SchemaComponentOptions,
|
||||||
SchemaComponentProvider,
|
SchemaComponentProvider,
|
||||||
@ -57,8 +58,7 @@ export function AssignedFieldsFormSchemaConfig(props) {
|
|||||||
const { setFormValueChanged } = useActionContext();
|
const { setFormValueChanged } = useActionContext();
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
const scope = useWorkflowVariableOptions();
|
const scope = useWorkflowVariableOptions();
|
||||||
const nodeForm = useForm();
|
const { values, setValuesIn, disabled } = useForm();
|
||||||
const { values, setValuesIn } = nodeForm;
|
|
||||||
const params = toJS(values.params);
|
const params = toJS(values.params);
|
||||||
const [dataSourceName, collectionName] = parseCollectionName(values.collection);
|
const [dataSourceName, collectionName] = parseCollectionName(values.collection);
|
||||||
|
|
||||||
@ -121,17 +121,19 @@ export function AssignedFieldsFormSchemaConfig(props) {
|
|||||||
<Card>
|
<Card>
|
||||||
<CollectionManagerProvider dataSource={dataSourceName}>
|
<CollectionManagerProvider dataSource={dataSourceName}>
|
||||||
<CollectionProvider name={collectionName}>
|
<CollectionProvider name={collectionName}>
|
||||||
<FormProvider form={form}>
|
<RerenderDataBlockProvider>
|
||||||
<FormLayout layout={'vertical'}>
|
<FormProvider form={form}>
|
||||||
<VariableScopeProvider scope={scope}>
|
<FormLayout layout={'vertical'}>
|
||||||
<SchemaComponentProvider form={form} designable={!nodeForm.disabled}>
|
<VariableScopeProvider scope={scope}>
|
||||||
<SchemaComponentOptions {...schemaOptions}>
|
<SchemaComponentProvider form={form} designable={!disabled}>
|
||||||
<SchemaComponent schema={schema} onChange={onChange} />
|
<SchemaComponentOptions {...schemaOptions}>
|
||||||
</SchemaComponentOptions>
|
<SchemaComponent schema={schema} onChange={onChange} />
|
||||||
</SchemaComponentProvider>
|
</SchemaComponentOptions>
|
||||||
</VariableScopeProvider>
|
</SchemaComponentProvider>
|
||||||
</FormLayout>
|
</VariableScopeProvider>
|
||||||
</FormProvider>
|
</FormLayout>
|
||||||
|
</FormProvider>
|
||||||
|
</RerenderDataBlockProvider>
|
||||||
</CollectionProvider>
|
</CollectionProvider>
|
||||||
</CollectionManagerProvider>
|
</CollectionManagerProvider>
|
||||||
</Card>
|
</Card>
|
||||||
|
Loading…
Reference in New Issue
Block a user