11<div align =" center " >
22 <h1 >@rc-component/trigger</h1 >
3- <p ><sub >Ant Design 生态的一部分。</sub ></p >
4- <img alt =" Ant Design " height =" 32 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " />
3+ <p ><sub ><img alt =" Ant Design " height =" 14 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " style =" vertical-align : -0.125em ;" /> Ant Design 生态的一部分。</sub ></p >
54 <p >🎯 React 弹层触发基础组件,支持定位、对齐、动画和事件触发。</p >
65 <p >
76 <a href="https://www.npmjs.com/package/@rc-component/trigger"><img src="https://img.shields.io/npm/v/@rc-component/trigger.svg?style=flat-square" alt="npm version" /></a>
1817
1918## 特性
2019
21- - Built for React and maintained by the rc-component team.
20+ - 面向 React 构建,并由 rc-component 团队维护。
2221- 被 Ant Design 使用和其他 React 组件库使用。
23- - 提供 TypeScript declarations with both ES module and CommonJS outputs.
24- - 保留 examples, tests, and preview builds aligned with the package source.
22+ - 提供 TypeScript 类型声明,同时输出 ES module 和 CommonJS 产物。
23+ - 示例、测试和预览构建与包源码保持一致。
2524
2625## 安装
2726
@@ -51,7 +50,7 @@ export default () => (
5150
5251## 示例
5352
54- Run the local dumi site to explore the examples:
53+ 运行本地 dumi 站点查看示例:
5554
5655``` bash
5756npm install
@@ -64,44 +63,44 @@ npm start
6463
6564| 属性 | 说明 | 类型 | 默认值 |
6665| -------------------------- | ------------------------------------------------------------------------- | ----------------------------------------- | ------------------ |
67- | action | Actions that control popup visibility. | ` ActionType ` \| ` ActionType[] ` | ` hover ` |
68- | afterOpenChange | Called after popup visibility changes. | ` (visible) => void ` | - |
69- | afterPopupVisibleChange | Deprecated. Use ` afterOpenChange ` instead. | ` (visible) => void ` | - |
70- | alignPoint | Align popup to mouse position for click, hover, and context menu actions. | ` boolean ` | ` false ` |
71- | arrow | Render popup arrow. | ` boolean ` \| ` ArrowType ` | - |
72- | autoDestroy | Destroy popup DOM when it is hidden. | ` boolean ` | ` false ` |
73- | blurDelay | Delay before hiding on blur, in seconds. | ` number ` | - |
74- | builtinPlacements | Named placement presets. | ` BuildInPlacements ` | ` {} ` |
75- | defaultPopupVisible | Initial uncontrolled visibility. | ` boolean ` | ` false ` |
76- | focusDelay | Delay before showing on focus, in seconds. | ` number ` | - |
77- | forceRender | Render popup before it is first shown. | ` boolean ` | ` false ` |
78- | fresh | Keep popup content updated while closed. | ` boolean ` | - |
79- | getPopupClassNameFromAlign | Return a popup class name from the current alignment. | ` (align) => string ` | - |
80- | getPopupContainer | Return the element that should contain the popup. | ` (node) => HTMLElement ` | - |
81- | hideAction | Actions that hide popup visibility. | ` ActionType[] ` | - |
82- | mask | Render a mask behind the popup. | ` boolean ` | ` false ` |
83- | maskClosable | Close when clicking the mask. | ` boolean ` | ` true ` |
84- | maskMotion | Motion config for the mask. | ` CSSMotionProps ` | - |
85- | mouseEnterDelay | Delay before showing on mouse enter, in seconds. | ` number ` | - |
86- | mouseLeaveDelay | Delay before hiding on mouse leave, in seconds. | ` number ` | ` 0.1 ` |
87- | popup | Popup content. | ` ReactNode ` \| ` () => ReactNode ` | - |
88- | popupAlign | Alignment config compatible with dom-align. | ` AlignType ` | - |
89- | popupClassName | Class name added to popup. | ` string ` | - |
90- | popupMotion | Motion config for the popup. | ` CSSMotionProps ` | - |
91- | popupPlacement | Placement key from ` builtinPlacements ` . | ` string ` | - |
92- | popupStyle | Inline popup style. | ` React.CSSProperties ` | - |
93- | popupVisible | Controlled popup visibility. | ` boolean ` | - |
94- | prefixCls | Popup class name prefix. | ` string ` | ` rc-trigger-popup ` |
95- | showAction | Actions that show popup visibility. | ` ActionType[] ` | - |
96- | stretch | Stretch popup width and/or height from target. | ` string ` | - |
97- | unique | Share popup container through ` UniqueProvider ` . | ` boolean ` | - |
98- | uniqueContainerClassName | Class name passed to ` UniqueProvider ` container. | ` string ` | - |
99- | uniqueContainerStyle | Style passed to ` UniqueProvider ` container. | ` React.CSSProperties ` | - |
100- | zIndex | Popup z-index. | ` number ` | - |
101- | onOpenChange | Called when visibility changes. | ` (visible) => void ` | - |
102- | onPopupAlign | Called when the popup is aligned. | ` (element, align) => void ` | - |
103- | onPopupClick | Called when popup is clicked. | ` React.MouseEventHandler<HTMLDivElement> ` | - |
104- | onPopupVisibleChange | Deprecated. Use ` onOpenChange ` instead. | ` (visible) => void ` | - |
66+ | action | 控制弹层显示状态的触发行为。 | ` ActionType ` \| ` ActionType[] ` | ` hover ` |
67+ | afterOpenChange | 弹层窗口可见性更改后调用。 | ` (visible) => void ` | - |
68+ | afterPopupVisibleChange | 已废弃。请使用 ` afterOpenChange ` 。 | ` (visible) => void ` | - |
69+ | alignPoint | 将弹层对齐到 ` click ` 、 ` hover ` 和 ` context menu ` 行为的鼠标位置。 | ` boolean ` | ` false ` |
70+ | arrow | 渲染弹层箭头。 | ` boolean ` \| ` ArrowType ` | - |
71+ | autoDestroy | 弹层隐藏时销毁弹层 DOM。 | ` boolean ` | ` false ` |
72+ | blurDelay | ` blur ` 后隐藏前的延迟,单位为秒。 | ` number ` | - |
73+ | builtinPlacements | 命名位置预设。 | ` BuildInPlacements ` | ` {} ` |
74+ | defaultPopupVisible | 非受控初始显示状态。 | ` boolean ` | ` false ` |
75+ | focusDelay | ` focus ` 后显示前的延迟,单位为秒。 | ` number ` | - |
76+ | forceRender | 首次显示前渲染弹层。 | ` boolean ` | ` false ` |
77+ | fresh | 关闭时仍保持弹层内容更新。 | ` boolean ` | - |
78+ | getPopupClassNameFromAlign | 根据当前对齐信息返回弹层 className。 | ` (align) => string ` | - |
79+ | getPopupContainer | 返回弹层挂载容器元素。 | ` (node) => HTMLElement ` | - |
80+ | hideAction | 隐藏弹层的触发行为。 | ` ActionType[] ` | - |
81+ | mask | 在弹层后渲染遮罩。 | ` boolean ` | ` false ` |
82+ | maskClosable | 点击遮罩时关闭。 | ` boolean ` | ` true ` |
83+ | maskMotion | 遮罩动画配置。 | ` CSSMotionProps ` | - |
84+ | mouseEnterDelay | mouse enter 后显示前的延迟,单位为秒。 | ` number ` | - |
85+ | mouseLeaveDelay | mouse leave 后隐藏前的延迟,单位为秒。 | ` number ` | ` 0.1 ` |
86+ | popup | 弹层内容。 | ` ReactNode ` \| ` () => ReactNode ` | - |
87+ | popupAlign | 与 dom-align 兼容的对齐配置。 | ` AlignType ` | - |
88+ | popupClassName | 添加到弹层的 className。 | ` string ` | - |
89+ | popupMotion | 弹层动画配置。 | ` CSSMotionProps ` | - |
90+ | popupPlacement | 来自 ` builtinPlacements ` 的位置 key。 | ` string ` | - |
91+ | popupStyle | 弹层内联样式。 | ` React.CSSProperties ` | - |
92+ | popupVisible | 受控的弹层窗口可见性。 | ` boolean ` | - |
93+ | prefixCls | 弹层 className 前缀。 | ` string ` | ` rc-trigger-popup ` |
94+ | showAction | 显示弹层的触发行为。 | ` ActionType[] ` | - |
95+ | stretch | 根据目标拉伸弹层宽度和/或高度。 | ` string ` | - |
96+ | unique | 通过 ` UniqueProvider ` 共享弹层容器。 | ` boolean ` | - |
97+ | uniqueContainerClassName | 传给 ` UniqueProvider ` 容器的 className。 | ` string ` | - |
98+ | uniqueContainerStyle | 传给 ` UniqueProvider ` 容器的样式。 | ` React.CSSProperties ` | - |
99+ | zIndex | 弹层 z 索引。 | ` number ` | - |
100+ | onOpenChange | 当可见性发生变化时调用。 | ` (visible) => void ` | - |
101+ | onPopupAlign | 弹层完成对齐时调用。 | ` (element, align) => void ` | - |
102+ | onPopupClick | 点击弹层时调用。 | ` React.MouseEventHandler<HTMLDivElement> ` | - |
103+ | onPopupVisibleChange | 已废弃。请使用 ` onOpenChange ` 。 | ` (visible) => void ` | - |
105104
106105## 本地开发
107106
@@ -118,8 +117,8 @@ npm run build
118117npm run prepublishOnly
119118```
120119
121- The release flow is handled by ` @rc-component/np ` through the ` rc-np ` command after the package build.
120+ 包构建完成后,发布流程由 ` @rc-component/np ` 通过 ` rc-np ` 命令处理。
122121
123122## 许可证
124123
125- @rc-component/trigger is released under the [ MIT] ( ./LICENSE ) license.
124+ @rc-component/trigger 基于 [ MIT] ( ./LICENSE ) 许可证发布。
0 commit comments