diff --git a/packages/smarthr-ui/src/components/Dialog/RemoteDialogTrigger.tsx b/packages/smarthr-ui/src/components/Dialog/RemoteDialogTrigger.tsx index 3444909a65..6856391bcd 100644 --- a/packages/smarthr-ui/src/components/Dialog/RemoteDialogTrigger.tsx +++ b/packages/smarthr-ui/src/components/Dialog/RemoteDialogTrigger.tsx @@ -18,7 +18,7 @@ export const RemoteDialogTrigger: React.FC< onClick?: (open: () => void) => void children: Omit } -> = ({ targetId, children, onClick, variant }) => { +> = ({ targetId, children, onClick, variant, ...rest }) => { const actualOnClick = useCallback( (e: React.MouseEvent) => { if (onClick) { @@ -38,8 +38,9 @@ export const RemoteDialogTrigger: React.FC< 'aria-haspopup': 'true', 'aria-controls': targetId, variant, + ...rest, }), - [children, variant, targetId, actualOnClick], + [children, actualOnClick, targetId, variant, rest], ) return actualTrigger diff --git a/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/DropdownMenuButton.tsx b/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/DropdownMenuButton.tsx index 540a497789..ef2adc8b93 100644 --- a/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/DropdownMenuButton.tsx +++ b/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/DropdownMenuButton.tsx @@ -119,7 +119,9 @@ export const renderButtonList = (children: Actions) => return renderButtonList(item.props.children) } - if (!(item.type === Button || item.type === AnchorButton)) { + if ( + !(item.type === Button || item.type === AnchorButton || item.type === RemoteDialogTrigger) + ) { return item } diff --git a/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/stories/DropdownMenuButton.stories.tsx b/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/stories/DropdownMenuButton.stories.tsx index 37076cf0ea..226d8a987b 100644 --- a/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/stories/DropdownMenuButton.stories.tsx +++ b/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/stories/DropdownMenuButton.stories.tsx @@ -1,6 +1,8 @@ +import { action } from '@storybook/addon-actions' import React from 'react' -import { Button } from '../../../Button' +import { AnchorButton, Button } from '../../../Button' +import { RemoteDialogTrigger } from '../../../Dialog' import { FaGearIcon } from '../../../Icon' import { DropdownMenuButton } from '../DropdownMenuButton' import { DropdownMenuGroup } from '../DropdownMenuGroup' @@ -19,8 +21,10 @@ export default { render: (args) => ( - - + 操作2 + + + ), argTypes: { diff --git a/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/stories/VRTDropdownMenuButton.stories.tsx b/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/stories/VRTDropdownMenuButton.stories.tsx index 87e3032c27..f48015104b 100644 --- a/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/stories/VRTDropdownMenuButton.stories.tsx +++ b/packages/smarthr-ui/src/components/Dropdown/DropdownMenuButton/stories/VRTDropdownMenuButton.stories.tsx @@ -2,6 +2,7 @@ import { userEvent, within } from '@storybook/test' import React, { ComponentProps } from 'react' import { AnchorButton, Button } from '../../../Button' +import { RemoteDialogTrigger } from '../../../Dialog' import { FaGearIcon } from '../../../Icon' import { Cluster } from '../../../Layout' import { DropdownMenuButton } from '../DropdownMenuButton' @@ -43,7 +44,9 @@ export default { 操作2 - + + + 操作4 操作5