From 13486f5328eaa37221f19de2286fe4f167eb4409 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com>
Date: Tue, 3 Jun 2025 23:19:21 +0800
Subject: [PATCH] feat(mobile-react): SwipeCell add SwipeCellInstanceFunctions
---
db/TDesign.db | Bin 1048576 -> 1048576 bytes
.../src/swipe-cell/swipe-cell.en-US.md | 8 ++++++++
.../src/swipe-cell/swipe-cell.md | 8 ++++++++
.../src/swipe-cell/type.ts | 8 ++++++++
packages/scripts/api.json | 6 ++++--
5 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/db/TDesign.db b/db/TDesign.db
index 0c3040de0ccdf2df940523e285985cf56b123e7e..e5b842b1eda1fac20392683f11954a06b477d531 100644
GIT binary patch
delta 77
zcmZo@aA;_7m>|uVI8nx#HIYHDtfMidHHEP?g{d`#xiy8QHHEb`g{?J(y)}iSHHEV^
gg{w7%yETQUHHCL;3g4Y-Mu~RE8ouq0HT?UV0oZyO(*OVf
delta 77
zcmZo@aA;_7m>|uVFj2;tHGx5|O|vnjHHEP?g{d`#xiy8QHHEb`g{?J(y)}iSHHEV^
gg{w7%yETQUHHCL;3g4Y-MvivJ8ouq0HT?UV0mUL2asU7T
diff --git a/packages/products/tdesign-mobile-react/src/swipe-cell/swipe-cell.en-US.md b/packages/products/tdesign-mobile-react/src/swipe-cell/swipe-cell.en-US.md
index b27422b6b..19e1b6036 100644
--- a/packages/products/tdesign-mobile-react/src/swipe-cell/swipe-cell.en-US.md
+++ b/packages/products/tdesign-mobile-react/src/swipe-cell/swipe-cell.en-US.md
@@ -17,3 +17,11 @@ onChange | Function | | Typescript:`(value: string) => void`
| N
onClick | Function | | Typescript:`(action: SwipeActionItem, source: SwipeSource) => void`
[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swipe-cell/type.ts)。
`type SwipeSource = 'left' \| 'right'`
| N
onDragend | Function | | Typescript:`() => void`
| N
onDragstart | Function | | Typescript:`() => void`
| N
+
+### SwipeCellInstanceFunctions 组件实例方法
+
+name | params | return | description
+-- | -- | -- | --
+className | String | - | className of component | N
+style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
+showSure | `(sure: string \| TNode, onClick?: SwipeActionItem['onClick'])` | `void` | Typescript:`string \| TNode;如果设置了 `onClick`,则点击二次确认内容时,会执行此onClick方法。
[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swipe-cell/type.ts)。
`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)
diff --git a/packages/products/tdesign-mobile-react/src/swipe-cell/swipe-cell.md b/packages/products/tdesign-mobile-react/src/swipe-cell/swipe-cell.md
index 8da2ba1aa..2968deeb5 100644
--- a/packages/products/tdesign-mobile-react/src/swipe-cell/swipe-cell.md
+++ b/packages/products/tdesign-mobile-react/src/swipe-cell/swipe-cell.md
@@ -17,3 +17,11 @@ onChange | Function | | TS 类型:`(value: string) => void`
菜单展开
onClick | Function | | TS 类型:`(action: SwipeActionItem, source: SwipeSource) => void`
操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件)。[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swipe-cell/type.ts)。
`type SwipeSource = 'left' \| 'right'`
| N
onDragend | Function | | TS 类型:`() => void`
滑动结束事件 | N
onDragstart | Function | | TS 类型:`() => void`
滑动开始事件 | N
+
+### SwipeCellInstanceFunctions 组件实例方法
+
+名称 | 参数 | 返回值 | 描述
+-- | -- | -- | --
+className | String | - | 类名 | N
+style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
+showSure | `(sure: string \| TNode, onClick?: SwipeActionItem['onClick'])` | `void` | 显示二次确认内容的函数。
【关于参数】`sure` 表示二次确认的具体内容,同content。TS 类型:`string \| TNode;如果设置了 `onClick`,则点击二次确认内容时,会执行此onClick方法。
[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swipe-cell/type.ts)。
`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)
diff --git a/packages/products/tdesign-mobile-react/src/swipe-cell/type.ts b/packages/products/tdesign-mobile-react/src/swipe-cell/type.ts
index 002ef0d77..d2425e461 100644
--- a/packages/products/tdesign-mobile-react/src/swipe-cell/type.ts
+++ b/packages/products/tdesign-mobile-react/src/swipe-cell/type.ts
@@ -46,6 +46,14 @@ export interface TdSwipeCellProps {
onDragstart?: () => void;
}
+/** 组件实例方法 */
+export interface SwipeCellInstanceFunctions {
+ /**
+ * 显示二次确认内容的函数。
【关于参数】`sure` 表示二次确认的具体内容,同content
+ */
+ showSure?: (sure: string | TNode, onClick?: SwipeActionItem['onClick']) => void;
+}
+
export interface SwipeActionItem {
text: string;
className?: string;
diff --git a/packages/scripts/api.json b/packages/scripts/api.json
index 009854670..547a2124c 100644
--- a/packages/scripts/api.json
+++ b/packages/scripts/api.json
@@ -115077,7 +115077,8 @@
{
"id": 1712719889,
"platform_framework": [
- "8"
+ "8",
+ "16"
],
"component": "SwipeCell",
"field_category": 4,
@@ -115106,7 +115107,8 @@
"support_default_value": 0,
"field_category_text": "Functions",
"platform_framework_text": [
- "Vue(Mobile)"
+ "Vue(Mobile)",
+ "React(Mobile)"
],
"field_type_text": [
"String",