fix: component CustomRequestAction support x-use-component-props (#5379)
Some checks are pending
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (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:
Jiannx 2024-10-10 11:22:03 +08:00 committed by GitHub
parent d63d5567e0
commit 61d9bdf0e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,7 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { Action, useAPIClient, useRequest } from '@nocobase/client';
import { Action, useAPIClient, useRequest, withDynamicSchemaProps } from '@nocobase/client';
import React from 'react';
import { useFieldSchema } from '@formily/react';
import { listByCurrentRoleUrl } from '../constants';
@ -39,12 +39,14 @@ const components = {
'customize:table:request': Action.Link,
};
export const CustomRequestAction = (props) => {
export const CustomRequestAction: React.FC<any> & {
[key: string]: any;
} = withDynamicSchemaProps((props) => {
const fieldSchema = useFieldSchema();
const xAction = fieldSchema['x-action'];
const Component = components[xAction] || Action;
return <Component {...props} useProps={useCustomizeRequestActionProps}></Component>;
};
});
CustomRequestAction.Designer = CustomRequestActionDesigner;
CustomRequestAction.Decorator = CustomRequestActionACLDecorator;