diff --git a/package.json b/package.json index 1a126662..15cf9026 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ }, "dependencies": { "@ant-design/icons": "^5", + "@ant-design/pro-editor": "latest", "@babel/runtime": "^7", "ahooks": "^3", "chroma-js": "^2", @@ -86,7 +87,6 @@ "zustand-utils": "^1.3.1" }, "devDependencies": { - "@ant-design/pro-editor": "latest", "@commitlint/cli": "^17", "@lobehub/ui": "^1", "@testing-library/react": "^14", diff --git a/src/ActionIcon/index.tsx b/src/ActionIcon/index.tsx index 109e56e1..d4aa8160 100644 --- a/src/ActionIcon/index.tsx +++ b/src/ActionIcon/index.tsx @@ -4,10 +4,12 @@ import { forwardRef, useMemo } from 'react'; import Icon, { type IconProps } from '@/Icon'; import Spotlight from '@/components/Spotlight'; import { DivProps } from '@/types'; -import { Tooltip, type TooltipProps } from 'antd'; +import { type TooltipProps } from 'antd'; import { useStyles } from './style'; +import { ActionIcon as ProEditorActionIcon } from '@ant-design/pro-editor'; + export type ActionIconSize = | 'large' | 'normal' @@ -125,14 +127,10 @@ const ActionIcon = forwardRef( size = 'normal', style, glass, - title, - placement, - arrow = false, spotlight, onClick, children, loading, - tooltipDelay = 0.5, ...props }, ref, @@ -173,19 +171,7 @@ const ActionIcon = forwardRef( ); - if (!title) return actionIconBlock; - - return ( - - {actionIconBlock} - - ); + return ; }, ); diff --git a/src/ActionIconGroup/index.tsx b/src/ActionIconGroup/index.tsx index c8ae7949..02e93e52 100644 --- a/src/ActionIconGroup/index.tsx +++ b/src/ActionIconGroup/index.tsx @@ -1,15 +1,14 @@ import ActionIcon, { ActionIconProps } from '@/ActionIcon'; import Icon from '@/Icon'; import Spotlight from '@/components/Spotlight'; +import { ActionGroup as ProEditorActionGroup } from '@ant-design/pro-editor'; -import { Dropdown } from 'antd'; -import { MoreHorizontal, type LucideIcon } from 'lucide-react'; +import { DropdownProps } from 'antd'; +import { type LucideIcon } from 'lucide-react'; import { memo } from 'react'; import { DivProps } from '@/types'; -import { useStyles } from './style'; - export interface ActionIconGroupItems { icon: LucideIcon; key: string; @@ -64,60 +63,59 @@ const ActionIconGroup = memo( direction = 'row', dropdownMenu = [], onActionClick, - ...props + className, + style, }) => { - const { styles } = useStyles({ direction, type }); - const tooltipsPlacement = placement || (direction === 'column' ? 'right' : 'top'); + const mergeDropDownList = dropdownMenu?.map((item: any) => { + return { + ...item, + icon: , + onClick: onActionClick + ? (info: ActionEvent) => + onActionClick({ + item, + key: info.key, + keyPath: info.keyPath, + }) + : undefined, + }; + }); + return ( -
- {spotlight && } - {items?.length > 0 && - items.map((item) => ( - onActionClick?.({ item, key: item.key, keyPath: [item.key] }) - : undefined - } - placement={tooltipsPlacement} - size="small" - title={item.label} - /> - ))} - {dropdownMenu?.length > 0 && ( - { - if (item.type) return item; - return { - ...item, - icon: , - onClick: onActionClick - ? (info: ActionEvent) => - onActionClick({ - item, - key: info.key, - keyPath: info.keyPath, - }) - : undefined, - }; - }), - }} - trigger={['click']} - > - - - )} -
+ { + return ( + <> + {spotlight && } + {items?.length > 0 && + items.map((item) => ( + onActionClick?.({ item, key: item.key, keyPath: [item.key] }) + : undefined + } + placement={tooltipsPlacement} + size="small" + title={item.label} + /> + ))} + + ); + }} + /> ); }, ); diff --git a/src/ActionIconGroup/style.ts b/src/ActionIconGroup/style.ts deleted file mode 100644 index d5ae6ac1..00000000 --- a/src/ActionIconGroup/style.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { createStyles } from 'antd-style'; - -export const useStyles = createStyles( - ( - { css, token, stylish, cx }, - { direction, type }: { direction: 'row' | 'column'; type: 'ghost' | 'block' | 'pure' }, - ) => { - const typeStylish = css` - background-color: ${type === 'block' ? token.colorFillTertiary : token.colorFillQuaternary}; - border: 1px solid ${type === 'block' ? 'transparent' : token.colorBorder}; - `; - - return { - container: cx( - type !== 'pure' && typeStylish, - stylish.blur, - css` - position: relative; - - display: flex; - flex-direction: ${direction}; - - padding: 2px; - - border-radius: ${token.borderRadius}px; - `, - ), - }; - }, -);