diff --git a/src/popconfirm/Popconfirm.tsx b/src/popconfirm/Popconfirm.tsx index b93da5148d..5be46a8a24 100644 --- a/src/popconfirm/Popconfirm.tsx +++ b/src/popconfirm/Popconfirm.tsx @@ -24,7 +24,6 @@ const Popconfirm = forwardRef((props: PopconfirmProps, ref: React.RefObject setVisible(visible)} overlayClassName={classNames(`${classPrefix}-popconfirm`)} content={ diff --git a/src/popconfirm/__tests__/popconfirm.test.tsx b/src/popconfirm/__tests__/popconfirm.test.tsx index 8bad255845..aacc376c26 100644 --- a/src/popconfirm/__tests__/popconfirm.test.tsx +++ b/src/popconfirm/__tests__/popconfirm.test.tsx @@ -44,6 +44,7 @@ describe('Popconfirm 组件测试', () => { const { getByText, queryByTestId, queryByText } = render( {text}} onCancel={onCancelMock} onConfirm={onConfirmMock} diff --git a/src/popconfirm/_usage/props.json b/src/popconfirm/_usage/props.json index a4d7255687..9a56ad1e67 100644 --- a/src/popconfirm/_usage/props.json +++ b/src/popconfirm/_usage/props.json @@ -60,6 +60,29 @@ } ] }, + { + "name": "trigger", + "type": "enum", + "defaultValue": "hover", + "options": [ + { + "label": "hover", + "value": "hover" + }, + { + "label": "click", + "value": "click" + }, + { + "label": "focus", + "value": "focus" + }, + { + "label": "context-menu", + "value": "context-menu" + } + ] + }, { "name": "showArrow", "type": "Boolean", @@ -91,4 +114,4 @@ "defaultValue": false, "options": [] } -] \ No newline at end of file +] diff --git a/src/popconfirm/popconfirm.en-US.md b/src/popconfirm/popconfirm.en-US.md index 1c616b06cb..a21a0eb7ac 100644 --- a/src/popconfirm/popconfirm.en-US.md +++ b/src/popconfirm/popconfirm.en-US.md @@ -18,6 +18,7 @@ placement | String | top | options:top/left/right/bottom/top-left/top-right/bo popupProps | Object | - | Typescript:`PopupProps`,[Popup API Documents](./popup?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/popconfirm/type.ts) | N showArrow | Boolean | true | \- | N theme | String | default | options:default/warning/danger | N +trigger | String | hover | options:hover/click/focus/mousedown/context-menu | N triggerElement | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N visible | Boolean | - | \- | N defaultVisible | Boolean | - | uncontrolled property | N diff --git a/src/popconfirm/popconfirm.md b/src/popconfirm/popconfirm.md index ea1fb19e08..dcdb3ef3bc 100644 --- a/src/popconfirm/popconfirm.md +++ b/src/popconfirm/popconfirm.md @@ -17,6 +17,7 @@ placement | String | top | 浮层出现位置。可选项:top/left/right/botto popupProps | Object | - | 透传 Popup 组件属性。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/popconfirm/type.ts) | N showArrow | Boolean | true | 是否显示浮层箭头 | N theme | String | default | 文字提示风格。可选项:default/warning/danger | N +trigger | String | hover | 触发浮层出现的方式。可选项:hover/click/focus/mousedown/context-menu | N triggerElement | TNode | - | 触发元素。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N visible | Boolean | - | 是否显示气泡确认框 | N defaultVisible | Boolean | - | 是否显示气泡确认框。非受控属性 | N diff --git a/src/popconfirm/type.ts b/src/popconfirm/type.ts index 61592bc616..44ceb22999 100644 --- a/src/popconfirm/type.ts +++ b/src/popconfirm/type.ts @@ -68,6 +68,11 @@ export interface TdPopconfirmProps { * @default default */ theme?: 'default' | 'warning' | 'danger'; + /** + * 触发浮层出现的方式 + * @default hover + */ + trigger?: 'hover' | 'click' | 'focus' | 'mousedown' | 'context-menu'; /** * 触发元素 */ diff --git a/test/snap/__snapshots__/csr.test.jsx.snap b/test/snap/__snapshots__/csr.test.jsx.snap index 43b57e94ee..582112afda 100644 --- a/test/snap/__snapshots__/csr.test.jsx.snap +++ b/test/snap/__snapshots__/csr.test.jsx.snap @@ -240662,7 +240662,7 @@ exports[`csr snapshot test > csr test src/table/_example/pagination-ajax.jsx 1`] />
csr test src/table/_example/pagination-ajax.jsx 1`] + > + + +
+ Empty Data +
+ + +
csr test src/table/_example/pagination-ajax.jsx 1`]
- Total 0 items + Total 120 items
csr test src/table/_example/pagination-ajax.jsx 1`] > 1 +
  • + 2 +
  • +
  • + 3 +
  • +
  • + 4 +
  • +
  • + 5 +
  • +
  • + + + +
  • +
  • + 24 +
  • csr test src/table/_example/pagination-ajax.jsx 1`] - / 1 + / 24
    @@ -240924,40 +240980,13 @@ exports[`csr snapshot test > csr test src/table/_example/pagination-ajax.jsx 1`] />
    -
    - - -
    - - -
    -
    -
    + /> , "container":
    csr test src/table/_example/pagination-ajax.jsx 1`] + > + + +
    + Empty Data +
    + + +
    csr test src/table/_example/pagination-ajax.jsx 1`]
    - Total 0 items + Total 120 items
    csr test src/table/_example/pagination-ajax.jsx 1`] > 1 +
  • + 2 +
  • +
  • + 3 +
  • +
  • + 4 +
  • +
  • + 5 +
  • +
  • + + + +
  • +
  • + 24 +
  • csr test src/table/_example/pagination-ajax.jsx 1`] - / 1 + / 24
    @@ -241219,34 +241304,7 @@ exports[`csr snapshot test > csr test src/table/_example/pagination-ajax.jsx 1`] />
    -
    - - -
    - - -
    -
    -
    + /> , "debug": [Function],