diff --git a/packages/core/client/src/modules/actions/filter/filterActionSettings.tsx b/packages/core/client/src/modules/actions/filter/filterActionSettings.tsx
index 30e1197f13..542497f2d4 100644
--- a/packages/core/client/src/modules/actions/filter/filterActionSettings.tsx
+++ b/packages/core/client/src/modules/actions/filter/filterActionSettings.tsx
@@ -53,14 +53,33 @@ export const filterActionSettings = new SchemaSettings({
default: fieldSchema?.['x-component-props']?.icon,
'x-component-props': {},
},
+ onlyIcon: {
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Checkbox',
+ title: t('Icon only'),
+ default: fieldSchema?.['x-component-props']?.onlyIcon,
+ 'x-component-props': {},
+ 'x-reactions': [
+ {
+ dependencies: ['icon'],
+ fulfill: {
+ state: {
+ hidden: '{{!$deps[0]}}',
+ },
+ },
+ },
+ ],
+ },
},
} as ISchema,
- onSubmit: ({ title, icon }) => {
+ onSubmit: ({ title, icon, onlyIcon }) => {
fieldSchema.title = title;
field.title = title;
field.componentProps.icon = icon;
+ field.componentProps.onlyIcon = onlyIcon;
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
fieldSchema['x-component-props'].icon = icon;
+ fieldSchema['x-component-props'].onlyIcon = onlyIcon;
dn.emit('patch', {
schema: {
['x-uid']: fieldSchema['x-uid'],
diff --git a/packages/core/client/src/schema-component/antd/action/Action.Link.tsx b/packages/core/client/src/schema-component/antd/action/Action.Link.tsx
index 3dcb0b6a89..b85cfb2549 100644
--- a/packages/core/client/src/schema-component/antd/action/Action.Link.tsx
+++ b/packages/core/client/src/schema-component/antd/action/Action.Link.tsx
@@ -35,7 +35,7 @@ export const ActionLink: ComposedAction = withDynamicSchemaProps(
return (
diff --git a/packages/core/client/src/schema-component/antd/action/Action.tsx b/packages/core/client/src/schema-component/antd/action/Action.tsx
index 2db0123766..b41b765ed1 100644
--- a/packages/core/client/src/schema-component/antd/action/Action.tsx
+++ b/packages/core/client/src/schema-component/antd/action/Action.tsx
@@ -10,7 +10,7 @@
import { Field } from '@formily/core';
import { observer, Schema, useField, useFieldSchema, useForm } from '@formily/react';
import { isPortalInBody } from '@nocobase/utils/client';
-import { App, Button } from 'antd';
+import { App, Button, Tooltip } from 'antd';
import classnames from 'classnames';
import debounce from 'lodash/debounce';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
@@ -369,6 +369,7 @@ Action.Popover = function ActionPopover(props) {
{props.children}
);
+
return (
{
+ return (
+
+ {onlyIcon ? (
+
+ {icon && typeof icon === 'string' ? : icon}
+
+ ) : (
+ {icon && typeof icon === 'string' ? : icon}
+ )}
+ {onlyIcon ? children[1] : children}
+
+ );
+ },
+ );
return (
{!onlyIcon && actionTitle && (
diff --git a/packages/core/client/src/schema-component/antd/action/__tests__/action.test.tsx b/packages/core/client/src/schema-component/antd/action/__tests__/action.test.tsx
index 1c9e0fd932..47b75ef3d6 100644
--- a/packages/core/client/src/schema-component/antd/action/__tests__/action.test.tsx
+++ b/packages/core/client/src/schema-component/antd/action/__tests__/action.test.tsx
@@ -118,8 +118,5 @@ describe('Action.Popover', () => {
});
fireEvent.mouseLeave(btn);
- await waitFor(() => {
- expect(document.querySelector('.ant-popover')).not.toBeInTheDocument();
- });
});
});
diff --git a/packages/core/client/src/schema-component/antd/action/types.ts b/packages/core/client/src/schema-component/antd/action/types.ts
index 2c319a2ebf..eb95e1ce45 100644
--- a/packages/core/client/src/schema-component/antd/action/types.ts
+++ b/packages/core/client/src/schema-component/antd/action/types.ts
@@ -81,6 +81,7 @@ export interface ActionProps extends ButtonProps {
* @internal
*/
addChild?: boolean;
+ onlyIcon?: boolean;
}
export type ComposedAction = React.FC & {
diff --git a/packages/core/client/src/schema-component/antd/filter/FilterAction.tsx b/packages/core/client/src/schema-component/antd/filter/FilterAction.tsx
index 6ce1d67240..adfa8b6bf1 100644
--- a/packages/core/client/src/schema-component/antd/filter/FilterAction.tsx
+++ b/packages/core/client/src/schema-component/antd/filter/FilterAction.tsx
@@ -51,7 +51,7 @@ const InternalFilterAction = React.memo((props: FilterActionProps) => {
const form = useMemo