-
-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add overflow trigger props #706
Changes from 3 commits
b1665cf
725236d
cc18fce
ee2f480
21d2092
5c64a52
e5284fe
25c8541
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ import Menu, { MenuItem } from 'rc-menu'; | |||||
import KeyCode from 'rc-util/lib/KeyCode'; | ||||||
import * as React from 'react'; | ||||||
import { useEffect, useState } from 'react'; | ||||||
import type { EditableConfig, Tab, TabsLocale } from '../interface'; | ||||||
import type { EditableConfig, Tab, TabsLocale, MoreProps } from '../interface'; | ||||||
import { getRemovable } from '../util'; | ||||||
import AddButton from './AddButton'; | ||||||
|
||||||
|
@@ -18,7 +18,7 @@ export interface OperationNodeProps { | |||||
tabBarGutter?: number; | ||||||
activeKey: string; | ||||||
mobile: boolean; | ||||||
moreIcon?: React.ReactNode; | ||||||
more?: MoreProps | ||||||
moreTransitionName?: string; | ||||||
editable?: EditableConfig; | ||||||
locale?: TabsLocale; | ||||||
|
@@ -36,7 +36,7 @@ const OperationNode = React.forwardRef<HTMLDivElement, OperationNodeProps>((prop | |||||
tabs, | ||||||
locale, | ||||||
mobile, | ||||||
moreIcon = 'More', | ||||||
more: moreProp = {}, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
moreTransitionName, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will Check it out later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moreTransitionName 也可以干掉,改用 more={{ transitionName }} 支持。 |
||||||
style, | ||||||
className, | ||||||
|
@@ -52,6 +52,8 @@ const OperationNode = React.forwardRef<HTMLDivElement, OperationNodeProps>((prop | |||||
const [open, setOpen] = useState(false); | ||||||
const [selectedKey, setSelectedKey] = useState<string>(null); | ||||||
|
||||||
const { icon: moreIcon = 'More', trigger = 'hover' } = moreProp; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 把 moreProps 放到 Dropdown 的属性最下面去,这个可以支持 DropdownProps 所有能力。
|
||||||
|
||||||
const popupId = `${id}-more-popup`; | ||||||
const dropdownPrefix = `${prefixCls}-dropdown`; | ||||||
const selectedItemId = selectedKey !== null ? `${popupId}-${selectedKey}` : null; | ||||||
|
@@ -190,7 +192,7 @@ const OperationNode = React.forwardRef<HTMLDivElement, OperationNodeProps>((prop | |||||
<Dropdown | ||||||
prefixCls={dropdownPrefix} | ||||||
overlay={menu} | ||||||
trigger={['hover']} | ||||||
trigger={[`${trigger}`]} | ||||||
visible={tabs.length ? open : false} | ||||||
transitionName={moreTransitionName} | ||||||
onVisibleChange={setOpen} | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,6 +3,14 @@ import type React from 'react'; | |||||
import type { TabNavListProps } from './TabNavList'; | ||||||
import type { TabPaneProps } from './TabPanelList/TabPane'; | ||||||
|
||||||
export type TriggerProps = { | ||||||
trigger?: 'hover' | 'click'; | ||||||
} | ||||||
export type moreIcon = React.ReactNode; | ||||||
export type MoreProps = { | ||||||
icon?: moreIcon, | ||||||
} & TriggerProps ; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 别忘了从 rc-dropdown 里 import 出来。 |
||||||
|
||||||
export type SizeInfo = [width: number, height: number]; | ||||||
|
||||||
export type TabSizeMap = Map< | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.