@arco-design/mobile-react 2.20.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/avatar/index.d.ts +1 -1
  5. package/cjs/avatar/index.js +1 -1
  6. package/cjs/badge/index.d.ts +1 -1
  7. package/cjs/badge/index.js +1 -1
  8. package/cjs/carousel/index.d.ts +1 -1
  9. package/cjs/carousel/index.js +1 -1
  10. package/cjs/cell/index.d.ts +1 -1
  11. package/cjs/cell/index.js +1 -1
  12. package/cjs/checkbox/index.d.ts +1 -1
  13. package/cjs/checkbox/index.js +1 -1
  14. package/cjs/collapse/index.d.ts +1 -1
  15. package/cjs/collapse/index.js +1 -1
  16. package/cjs/count-down/index.d.ts +1 -1
  17. package/cjs/count-down/index.js +1 -1
  18. package/cjs/date-picker/index.d.ts +1 -1
  19. package/cjs/date-picker/index.js +1 -1
  20. package/cjs/dropdown/dropdown.js +36 -20
  21. package/cjs/dropdown/style/css/index.css +3 -0
  22. package/cjs/dropdown/style/index.less +2 -0
  23. package/cjs/ellipsis/index.d.ts +1 -1
  24. package/cjs/ellipsis/index.js +1 -1
  25. package/cjs/image/index.d.ts +1 -1
  26. package/cjs/image/index.js +1 -1
  27. package/cjs/image-picker/index.d.ts +4 -175
  28. package/cjs/image-picker/index.js +41 -18
  29. package/cjs/image-picker/type.d.ts +174 -0
  30. package/cjs/image-picker/type.js +3 -0
  31. package/cjs/image-preview/index.d.ts +1 -1
  32. package/cjs/image-preview/index.js +1 -1
  33. package/cjs/index.d.ts +2 -0
  34. package/cjs/index.js +9 -1
  35. package/cjs/input/hooks.js +49 -8
  36. package/cjs/input/index.d.ts +1 -1
  37. package/cjs/input/index.js +1 -1
  38. package/cjs/input/props.d.ts +8 -2
  39. package/cjs/notice-bar/index.d.ts +1 -1
  40. package/cjs/notice-bar/index.js +1 -1
  41. package/cjs/picker/index.d.ts +1 -1
  42. package/cjs/picker/index.js +1 -1
  43. package/cjs/picker-view/index.d.ts +1 -1
  44. package/cjs/picker-view/index.js +1 -1
  45. package/cjs/popover/index.d.ts +1 -1
  46. package/cjs/popover/index.js +1 -1
  47. package/cjs/popup-swiper/index.js +3 -2
  48. package/cjs/radio/index.d.ts +1 -1
  49. package/cjs/radio/index.js +1 -1
  50. package/cjs/rate/index.d.ts +1 -1
  51. package/cjs/rate/index.js +1 -1
  52. package/cjs/search-bar/association.d.ts +3 -0
  53. package/cjs/search-bar/association.js +92 -0
  54. package/cjs/search-bar/cancel-button.d.ts +10 -0
  55. package/cjs/search-bar/cancel-button.js +41 -0
  56. package/cjs/search-bar/demo/style/css/mobile.css +5 -0
  57. package/cjs/search-bar/demo/style/mobile.less +9 -0
  58. package/cjs/search-bar/highlight.d.ts +12 -0
  59. package/cjs/search-bar/highlight.js +77 -0
  60. package/cjs/search-bar/index.d.ts +13 -0
  61. package/cjs/search-bar/index.js +239 -0
  62. package/cjs/search-bar/style/css/index.css +148 -0
  63. package/cjs/search-bar/style/css/index.d.ts +2 -0
  64. package/cjs/search-bar/style/css/index.js +5 -0
  65. package/cjs/search-bar/style/index.d.ts +2 -0
  66. package/cjs/search-bar/style/index.js +5 -0
  67. package/cjs/search-bar/style/index.less +111 -0
  68. package/cjs/search-bar/type.d.ts +163 -0
  69. package/cjs/search-bar/type.js +3 -0
  70. package/cjs/slider/index.d.ts +1 -1
  71. package/cjs/slider/index.js +1 -1
  72. package/cjs/steps/index.d.ts +1 -1
  73. package/cjs/steps/index.js +1 -1
  74. package/cjs/sticky/index.d.ts +1 -1
  75. package/cjs/style.d.ts +2 -0
  76. package/cjs/style.js +4 -0
  77. package/cjs/swipe-action/demo/style/css/mobile.css +5 -0
  78. package/cjs/swipe-action/demo/style/mobile.less +9 -0
  79. package/cjs/swipe-action/index.d.ts +12 -0
  80. package/cjs/swipe-action/index.js +339 -0
  81. package/cjs/swipe-action/item.d.ts +11 -0
  82. package/cjs/swipe-action/item.js +52 -0
  83. package/cjs/swipe-action/style/css/index.css +88 -0
  84. package/cjs/swipe-action/style/css/index.d.ts +2 -0
  85. package/cjs/swipe-action/style/css/index.js +5 -0
  86. package/cjs/swipe-action/style/index.d.ts +2 -0
  87. package/cjs/swipe-action/style/index.js +5 -0
  88. package/cjs/swipe-action/style/index.less +89 -0
  89. package/cjs/swipe-action/type.d.ts +123 -0
  90. package/cjs/swipe-action/type.js +3 -0
  91. package/cjs/switch/index.d.ts +1 -1
  92. package/cjs/switch/index.js +1 -1
  93. package/cjs/tabs/tab-pane.js +5 -1
  94. package/cjs/tag/index.d.ts +1 -1
  95. package/cjs/tag/index.js +1 -1
  96. package/cjs/textarea/index.d.ts +1 -1
  97. package/cjs/textarea/index.js +1 -1
  98. package/dist/index.js +7450 -6611
  99. package/dist/index.min.js +6 -6
  100. package/dist/style.css +203 -0
  101. package/dist/style.min.css +1 -1
  102. package/esm/avatar/index.d.ts +1 -1
  103. package/esm/avatar/index.js +1 -1
  104. package/esm/badge/index.d.ts +1 -1
  105. package/esm/badge/index.js +1 -1
  106. package/esm/carousel/index.d.ts +1 -1
  107. package/esm/carousel/index.js +1 -1
  108. package/esm/cell/index.d.ts +1 -1
  109. package/esm/cell/index.js +1 -1
  110. package/esm/checkbox/index.d.ts +1 -1
  111. package/esm/checkbox/index.js +1 -1
  112. package/esm/collapse/index.d.ts +1 -1
  113. package/esm/collapse/index.js +1 -1
  114. package/esm/count-down/index.d.ts +1 -1
  115. package/esm/count-down/index.js +1 -1
  116. package/esm/date-picker/index.d.ts +1 -1
  117. package/esm/date-picker/index.js +1 -1
  118. package/esm/dropdown/dropdown.js +36 -20
  119. package/esm/dropdown/style/css/index.css +3 -0
  120. package/esm/dropdown/style/index.less +2 -0
  121. package/esm/ellipsis/index.d.ts +1 -1
  122. package/esm/ellipsis/index.js +1 -1
  123. package/esm/image/index.d.ts +1 -1
  124. package/esm/image/index.js +1 -1
  125. package/esm/image-picker/index.d.ts +4 -175
  126. package/esm/image-picker/index.js +30 -17
  127. package/esm/image-picker/type.d.ts +174 -0
  128. package/esm/image-picker/type.js +1 -0
  129. package/esm/image-preview/index.d.ts +1 -1
  130. package/esm/image-preview/index.js +1 -1
  131. package/esm/index.d.ts +2 -0
  132. package/esm/index.js +2 -0
  133. package/esm/input/hooks.js +49 -8
  134. package/esm/input/index.d.ts +1 -1
  135. package/esm/input/index.js +1 -1
  136. package/esm/input/props.d.ts +8 -2
  137. package/esm/notice-bar/index.d.ts +1 -1
  138. package/esm/notice-bar/index.js +1 -1
  139. package/esm/picker/index.d.ts +1 -1
  140. package/esm/picker/index.js +1 -1
  141. package/esm/picker-view/index.d.ts +1 -1
  142. package/esm/picker-view/index.js +1 -1
  143. package/esm/popover/index.d.ts +1 -1
  144. package/esm/popover/index.js +1 -1
  145. package/esm/popup-swiper/index.js +3 -2
  146. package/esm/radio/index.d.ts +1 -1
  147. package/esm/radio/index.js +1 -1
  148. package/esm/rate/index.d.ts +1 -1
  149. package/esm/rate/index.js +1 -1
  150. package/esm/search-bar/association.d.ts +3 -0
  151. package/esm/search-bar/association.js +82 -0
  152. package/esm/search-bar/cancel-button.d.ts +10 -0
  153. package/esm/search-bar/cancel-button.js +30 -0
  154. package/esm/search-bar/demo/style/css/mobile.css +5 -0
  155. package/esm/search-bar/demo/style/mobile.less +9 -0
  156. package/esm/search-bar/highlight.d.ts +12 -0
  157. package/esm/search-bar/highlight.js +66 -0
  158. package/esm/search-bar/index.d.ts +13 -0
  159. package/esm/search-bar/index.js +213 -0
  160. package/esm/search-bar/style/css/index.css +148 -0
  161. package/esm/search-bar/style/css/index.d.ts +2 -0
  162. package/esm/search-bar/style/css/index.js +2 -0
  163. package/esm/search-bar/style/index.d.ts +2 -0
  164. package/esm/search-bar/style/index.js +2 -0
  165. package/esm/search-bar/style/index.less +111 -0
  166. package/esm/search-bar/type.d.ts +163 -0
  167. package/esm/search-bar/type.js +1 -0
  168. package/esm/slider/index.d.ts +1 -1
  169. package/esm/slider/index.js +1 -1
  170. package/esm/steps/index.d.ts +1 -1
  171. package/esm/steps/index.js +1 -1
  172. package/esm/sticky/index.d.ts +1 -1
  173. package/esm/style.d.ts +2 -0
  174. package/esm/style.js +2 -0
  175. package/esm/swipe-action/demo/style/css/mobile.css +5 -0
  176. package/esm/swipe-action/demo/style/mobile.less +9 -0
  177. package/esm/swipe-action/index.d.ts +12 -0
  178. package/esm/swipe-action/index.js +321 -0
  179. package/esm/swipe-action/item.d.ts +11 -0
  180. package/esm/swipe-action/item.js +42 -0
  181. package/esm/swipe-action/style/css/index.css +88 -0
  182. package/esm/swipe-action/style/css/index.d.ts +2 -0
  183. package/esm/swipe-action/style/css/index.js +2 -0
  184. package/esm/swipe-action/style/index.d.ts +2 -0
  185. package/esm/swipe-action/style/index.js +2 -0
  186. package/esm/swipe-action/style/index.less +89 -0
  187. package/esm/swipe-action/type.d.ts +123 -0
  188. package/esm/swipe-action/type.js +1 -0
  189. package/esm/switch/index.d.ts +1 -1
  190. package/esm/switch/index.js +1 -1
  191. package/esm/tabs/tab-pane.js +5 -1
  192. package/esm/tag/index.d.ts +1 -1
  193. package/esm/tag/index.js +1 -1
  194. package/esm/textarea/index.d.ts +1 -1
  195. package/esm/textarea/index.js +1 -1
  196. package/package.json +3 -3
  197. package/tokens/app/arcodesign/default/css-variables.less +34 -0
  198. package/tokens/app/arcodesign/default/index.d.ts +34 -0
  199. package/tokens/app/arcodesign/default/index.js +34 -0
  200. package/tokens/app/arcodesign/default/index.json +398 -0
  201. package/tokens/app/arcodesign/default/index.less +34 -0
  202. package/umd/avatar/index.d.ts +1 -1
  203. package/umd/avatar/index.js +1 -1
  204. package/umd/badge/index.d.ts +1 -1
  205. package/umd/badge/index.js +1 -1
  206. package/umd/carousel/index.d.ts +1 -1
  207. package/umd/carousel/index.js +1 -1
  208. package/umd/cell/index.d.ts +1 -1
  209. package/umd/cell/index.js +1 -1
  210. package/umd/checkbox/index.d.ts +1 -1
  211. package/umd/checkbox/index.js +1 -1
  212. package/umd/collapse/index.d.ts +1 -1
  213. package/umd/collapse/index.js +1 -1
  214. package/umd/count-down/index.d.ts +1 -1
  215. package/umd/count-down/index.js +1 -1
  216. package/umd/date-picker/index.d.ts +1 -1
  217. package/umd/date-picker/index.js +1 -1
  218. package/umd/dropdown/dropdown.js +36 -20
  219. package/umd/dropdown/style/css/index.css +3 -0
  220. package/umd/dropdown/style/index.less +2 -0
  221. package/umd/ellipsis/index.d.ts +1 -1
  222. package/umd/ellipsis/index.js +1 -1
  223. package/umd/image/index.d.ts +1 -1
  224. package/umd/image/index.js +1 -1
  225. package/umd/image-picker/index.d.ts +4 -175
  226. package/umd/image-picker/index.js +40 -22
  227. package/umd/image-picker/type.d.ts +174 -0
  228. package/umd/image-picker/type.js +17 -0
  229. package/umd/image-preview/index.d.ts +1 -1
  230. package/umd/image-preview/index.js +1 -1
  231. package/umd/index.d.ts +2 -0
  232. package/umd/index.js +9 -5
  233. package/umd/input/hooks.js +48 -7
  234. package/umd/input/index.d.ts +1 -1
  235. package/umd/input/index.js +1 -1
  236. package/umd/input/props.d.ts +8 -2
  237. package/umd/notice-bar/index.d.ts +1 -1
  238. package/umd/notice-bar/index.js +1 -1
  239. package/umd/picker/index.d.ts +1 -1
  240. package/umd/picker/index.js +1 -1
  241. package/umd/picker-view/index.d.ts +1 -1
  242. package/umd/picker-view/index.js +1 -1
  243. package/umd/popover/index.d.ts +1 -1
  244. package/umd/popover/index.js +1 -1
  245. package/umd/popup-swiper/index.js +3 -2
  246. package/umd/radio/index.d.ts +1 -1
  247. package/umd/radio/index.js +1 -1
  248. package/umd/rate/index.d.ts +1 -1
  249. package/umd/rate/index.js +1 -1
  250. package/umd/search-bar/association.d.ts +3 -0
  251. package/umd/search-bar/association.js +101 -0
  252. package/umd/search-bar/cancel-button.d.ts +10 -0
  253. package/umd/search-bar/cancel-button.js +52 -0
  254. package/umd/search-bar/demo/style/css/mobile.css +5 -0
  255. package/umd/search-bar/demo/style/mobile.less +9 -0
  256. package/umd/search-bar/highlight.d.ts +12 -0
  257. package/umd/search-bar/highlight.js +87 -0
  258. package/umd/search-bar/index.d.ts +13 -0
  259. package/umd/search-bar/index.js +235 -0
  260. package/umd/search-bar/style/css/index.css +148 -0
  261. package/umd/search-bar/style/css/index.d.ts +2 -0
  262. package/umd/search-bar/style/css/index.js +15 -0
  263. package/umd/search-bar/style/index.d.ts +2 -0
  264. package/umd/search-bar/style/index.js +15 -0
  265. package/umd/search-bar/style/index.less +111 -0
  266. package/umd/search-bar/type.d.ts +163 -0
  267. package/umd/search-bar/type.js +17 -0
  268. package/umd/slider/index.d.ts +1 -1
  269. package/umd/slider/index.js +1 -1
  270. package/umd/steps/index.d.ts +1 -1
  271. package/umd/steps/index.js +1 -1
  272. package/umd/sticky/index.d.ts +1 -1
  273. package/umd/style.d.ts +2 -0
  274. package/umd/style.js +4 -4
  275. package/umd/swipe-action/demo/style/css/mobile.css +5 -0
  276. package/umd/swipe-action/demo/style/mobile.less +9 -0
  277. package/umd/swipe-action/index.d.ts +12 -0
  278. package/umd/swipe-action/index.js +342 -0
  279. package/umd/swipe-action/item.d.ts +11 -0
  280. package/umd/swipe-action/item.js +62 -0
  281. package/umd/swipe-action/style/css/index.css +88 -0
  282. package/umd/swipe-action/style/css/index.d.ts +2 -0
  283. package/umd/swipe-action/style/css/index.js +15 -0
  284. package/umd/swipe-action/style/index.d.ts +2 -0
  285. package/umd/swipe-action/style/index.js +15 -0
  286. package/umd/swipe-action/style/index.less +89 -0
  287. package/umd/swipe-action/type.d.ts +123 -0
  288. package/umd/swipe-action/type.js +17 -0
  289. package/umd/switch/index.d.ts +1 -1
  290. package/umd/switch/index.js +1 -1
  291. package/umd/tabs/tab-pane.js +5 -1
  292. package/umd/tag/index.d.ts +1 -1
  293. package/umd/tag/index.js +1 -1
  294. package/umd/textarea/index.d.ts +1 -1
  295. package/umd/textarea/index.js +1 -1
@@ -0,0 +1,163 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ import { InputProps } from '../input/index';
3
+ export declare type SearchBarShape = 'square' | 'round';
4
+ export declare type SearchAssociationShowType = 'focus' | 'value' | 'default' | 'always';
5
+ export declare type SearchAssociationHighlightMode = 'prefix' | 'contain' | 'none' | ((content: string, keyword: string, defaultHighlightClassName: string) => ReactNode);
6
+ export interface SearchAssociationBaseItem {
7
+ /**
8
+ * 基础内容
9
+ * @en basic content
10
+ */
11
+ content: string;
12
+ }
13
+ export declare type SearchAssociationItem<ExtraData = Record<string, any>> = SearchAssociationBaseItem & ExtraData;
14
+ export interface SearchBarAssociationProps<Data = Record<string, any>> {
15
+ /**
16
+ * 前缀class名
17
+ * @en prefix class
18
+ */
19
+ prefixCls: string;
20
+ /**
21
+ * 搜索关键字
22
+ * @en search value
23
+ */
24
+ keyword: string;
25
+ /**
26
+ * 是否显示搜索联想框
27
+ * @en Whether to show the search prediction box
28
+ */
29
+ visible: boolean;
30
+ /**
31
+ * 每一项搜索内容
32
+ * @en every search
33
+ */
34
+ associationItems?: SearchAssociationItem<Data>[];
35
+ /**
36
+ * 搜索结果高亮模式,可以是内置的两种模式,或者一个自定义的高亮函数(接受选项内容content、搜索关键字keyword、默认的高亮class,返回一个ReactNode) - prefix 高亮最长前缀匹配字符串 - contain 高亮所有搜索关键字 - none 关闭高亮
37
+ * @en Search result highlighting mode, which can be two built-in modes, or a custom highlighting function(Accept option content content, search keyword keyword, default highlight class, return a ReactNode) - "prefix" to highlight the longest prefix matching string - "contain" to highlight all search keywords - "none" to turn off highlighting
38
+ * @default "none"
39
+ */
40
+ highlightMode?: SearchAssociationHighlightMode;
41
+ /**
42
+ * 要为高亮结果添加的样式,仅非自定高亮模式下生效
43
+ * @en The style to be added to the highlighted result, only available in non-custom highlight mode
44
+ */
45
+ highlightStyle?: CSSProperties;
46
+ /**
47
+ * 要为高亮结果添加的class,仅非自定义高亮模式下生效
48
+ * @en The class to be added to the highlighting result, only valid in non-custom highlighting mode
49
+ */
50
+ highlightClassName?: string;
51
+ /**
52
+ * 右侧取消按钮的点击回调
53
+ * @en Right cancel button click callback
54
+ */
55
+ onCancel?: () => void;
56
+ /**
57
+ * 每行搜索结果的点击回调
58
+ * @en Click callback for each row of search results
59
+ */
60
+ onAssociationItemClick?: (item: SearchAssociationItem<Data>, index: number) => void;
61
+ /**
62
+ * 搜索联想框整体被点击的回调
63
+ * @en The callback for the overall click of the search association box
64
+ */
65
+ onAssociationClick?: React.MouseEventHandler<HTMLDivElement>;
66
+ /**
67
+ * 自定义渲染每行搜索结果
68
+ * @en Custom rendering of each row of search results
69
+ */
70
+ renderAssociationItem?: (item: SearchAssociationItem<Data>, index: number, node: ReactNode) => ReactNode;
71
+ /**
72
+ * 自定义渲染搜索联想框整体内容
73
+ * @en Customize the rendering of the overall content of the search association box
74
+ */
75
+ renderAssociation?: (Content: ReactNode) => ReactNode;
76
+ }
77
+ export interface SearchBarProps<Data = Record<string, any>> extends Omit<SearchBarAssociationProps<Data>, 'keyword' | 'visible' | 'prefixCls'>, Omit<InputProps, 'label' | 'border' | 'required'> {
78
+ /**
79
+ * 输入框形状
80
+ * @en input box shape
81
+ * @default "square"
82
+ */
83
+ shape?: SearchBarShape;
84
+ /**
85
+ * 搜索栏内容位置
86
+ * @en Search bar content location
87
+ * @default "left"
88
+ */
89
+ textAlign?: 'left' | 'center' | 'right';
90
+ /**
91
+ * 搜索栏头部插入的内容
92
+ * @en Content inserted in the header of the search box
93
+ */
94
+ prepend?: ReactNode | ((focusing: boolean, value: string) => ReactNode);
95
+ /**
96
+ * 搜索栏尾部要插入的内容, 默认在搜索栏激活态时会插入一个按钮
97
+ * @en The content to be inserted at the end of the search box, a button will be inserted by default when the search box is activated
98
+ * @default (focusing) => focusing ? (<span>取消</span>) : null
99
+ */
100
+ append?: ReactNode | ((focusing: boolean, value: string) => ReactNode);
101
+ /**
102
+ * 搜索栏最右侧要插入的按钮,默认情况下插入一个取消按钮
103
+ * @en The button to insert on the far right side of the search box, a cancel button is inserted by default
104
+ * @default <CancelButton />
105
+ */
106
+ actionButton?: ReactNode;
107
+ /**
108
+ * 是否开启搜索联想框功能
109
+ * @en Whether to enable the search association box function
110
+ * @default false
111
+ */
112
+ enableAssociation?: boolean;
113
+ /**
114
+ * (受控模式)搜索联想框的可见态
115
+ * @en (Controlled mode) Visible state of search association box
116
+ */
117
+ associationVisible?: boolean;
118
+ /**
119
+ * 非受控模式下,搜索联想框的展示时机 - focus 仅聚焦时 - value 搜索词不为空 - default 搜索栏被聚焦或者搜索词不为空 - always 一直展示
120
+ * @en In uncontrolled mode, the display timing of the search association box - "focus" only when focused - "value" search term is not empty - "default" search bar is focused or search term is not empty - "always" always displayed
121
+ * @default "default"
122
+ */
123
+ associationShowType?: SearchAssociationShowType;
124
+ }
125
+ export interface SearchBarRef {
126
+ /**
127
+ * 最外层元素 DOM
128
+ * @en The outermost element DOM
129
+ */
130
+ dom: HTMLDivElement | null;
131
+ /**
132
+ * 原生输入框 DOM
133
+ * @en Native input box DOM
134
+ */
135
+ input: HTMLInputElement | null;
136
+ /**
137
+ * 仅非受控模式下生效,手动控制搜索联想框的显隐,如果没有传入值则默认将显隐状态反转
138
+ * @en It only takes effect in uncontrolled mode. Manually control the display and hide of the search association box. If there is no incoming value, the display and hidden state will be reversed by default.
139
+ */
140
+ toggleAssociation: (newVisible?: boolean) => void;
141
+ }
142
+ export interface SearchBarAssociationHighlightConfig {
143
+ /**
144
+ * 要为高亮结果添加的样式,仅非自定高亮模式下生效
145
+ * @en The style to be added to the highlighted result, only available in non-custom highlight mode
146
+ */
147
+ highlightStyle?: CSSProperties;
148
+ /**
149
+ * 要为高亮结果添加的class,仅非自定义高亮模式下生效
150
+ * @en The class to be added to the highlighting result, only valid in non-custom highlighting mode
151
+ */
152
+ highlightClassName?: string;
153
+ /**
154
+ * 搜索关键字
155
+ * @en search for the keyword
156
+ */
157
+ keyword: string;
158
+ /**
159
+ * 搜索候选项的内容
160
+ * @en Contents of search candidates
161
+ */
162
+ content: string;
163
+ }
@@ -0,0 +1,17 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports);
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports);
11
+ global.type = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
14
+ "use strict";
15
+
16
+ _exports.__esModule = true;
17
+ });
@@ -143,7 +143,7 @@ export interface SliderRef {
143
143
  * @en Slide input component, displays the current value and optional range.
144
144
  * @name 滑动输入条
145
145
  * @name_en Slider
146
- * @type 数据输入
146
+ * @type 数据录入
147
147
  * @type_en Data Entry
148
148
  */
149
149
  declare const SliderWrapper: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<SliderRef>>;
@@ -176,7 +176,7 @@
176
176
  * @en Slide input component, displays the current value and optional range.
177
177
  * @name 滑动输入条
178
178
  * @name_en Slider
179
- * @type 数据输入
179
+ * @type 数据录入
180
180
  * @type_en Data Entry
181
181
  */
182
182
 
@@ -13,7 +13,7 @@ declare const _default: React.ForwardRefExoticComponent<StepsProps & React.RefAt
13
13
  * @en Display the progress of a task, or guide users to complete a complex task.
14
14
  * @name 步骤条
15
15
  * @name_en Steps
16
- * @type 数据展示
16
+ * @type 信息展示
17
17
  * @type_en Data Display
18
18
  */
19
19
  export default _default;
@@ -115,7 +115,7 @@
115
115
  * @en Display the progress of a task, or guide users to complete a complex task.
116
116
  * @name 步骤条
117
117
  * @name_en Steps
118
- * @type 数据展示
118
+ * @type 信息展示
119
119
  * @type_en Data Display
120
120
  */
121
121
 
@@ -118,7 +118,7 @@ export interface StickyProps {
118
118
  */
119
119
  getContainer?: () => HTMLElement | string;
120
120
  /**
121
- * 指定滚动容器,如果指定该值则relative属性始终认定为false;如果返回string则使用querySelector选取容器
121
+ * 指定滚动容器;如果返回string则使用querySelector选取容器
122
122
  * @en Specifies the scrolling container. If this value is specified, the relative property is always regarded as false; if a string is input, use querySelector to select the container
123
123
  * @default () => window
124
124
  */
package/umd/style.d.ts CHANGED
@@ -42,8 +42,10 @@ import './pull-refresh/style';
42
42
  import './radio/style';
43
43
  import './rate/style';
44
44
  import './slider/style';
45
+ import './search-bar/style';
45
46
  import './steps/style';
46
47
  import './sticky/style';
48
+ import './swipe-action/style';
47
49
  import './swipe-load/style';
48
50
  import './tab-bar/style';
49
51
  import './tag/style';
package/umd/style.js CHANGED
@@ -1,15 +1,15 @@
1
1
  (function (global, factory) {
2
2
  if (typeof define === "function" && define.amd) {
3
- define(["../style/public.less", "./action-sheet/style", "./cell/style", "./loading/style", "./badge/style", "./avatar/style", "./button/style", "./carousel/style", "./toast/style", "./switch/style", "./checkbox/style", "./circle-progress/style", "./collapse/style", "./tabs/style", "./context-provider/style", "./dialog/style", "./count-down/style", "./date-picker/style", "./dropdown/style", "./dropdown-menu/style", "./ellipsis/style", "./grid/style", "./image/style", "./show-monitor/style", "./image-picker/style", "./image-preview/style", "./input/style", "./load-more/style", "./masking/style", "./nav-bar/style", "./notice-bar/style", "./notify/style", "./pagination/style", "./picker/style", "./picker-view/style", "./popover/style", "./popup/style", "./popup-swiper/style", "./portal/style", "./progress/style", "./pull-refresh/style", "./radio/style", "./rate/style", "./slider/style", "./steps/style", "./sticky/style", "./swipe-load/style", "./tab-bar/style", "./tag/style", "./textarea/style", "./transition/style"], factory);
3
+ define(["../style/public.less", "./action-sheet/style", "./cell/style", "./loading/style", "./badge/style", "./avatar/style", "./button/style", "./carousel/style", "./toast/style", "./switch/style", "./checkbox/style", "./circle-progress/style", "./collapse/style", "./tabs/style", "./context-provider/style", "./dialog/style", "./count-down/style", "./date-picker/style", "./dropdown/style", "./dropdown-menu/style", "./ellipsis/style", "./grid/style", "./image/style", "./show-monitor/style", "./image-picker/style", "./image-preview/style", "./input/style", "./load-more/style", "./masking/style", "./nav-bar/style", "./notice-bar/style", "./notify/style", "./pagination/style", "./picker/style", "./picker-view/style", "./popover/style", "./popup/style", "./popup-swiper/style", "./portal/style", "./progress/style", "./pull-refresh/style", "./radio/style", "./rate/style", "./slider/style", "./search-bar/style", "./steps/style", "./sticky/style", "./swipe-action/style", "./swipe-load/style", "./tab-bar/style", "./tag/style", "./textarea/style", "./transition/style"], factory);
4
4
  } else if (typeof exports !== "undefined") {
5
- factory(require("../style/public.less"), require("./action-sheet/style"), require("./cell/style"), require("./loading/style"), require("./badge/style"), require("./avatar/style"), require("./button/style"), require("./carousel/style"), require("./toast/style"), require("./switch/style"), require("./checkbox/style"), require("./circle-progress/style"), require("./collapse/style"), require("./tabs/style"), require("./context-provider/style"), require("./dialog/style"), require("./count-down/style"), require("./date-picker/style"), require("./dropdown/style"), require("./dropdown-menu/style"), require("./ellipsis/style"), require("./grid/style"), require("./image/style"), require("./show-monitor/style"), require("./image-picker/style"), require("./image-preview/style"), require("./input/style"), require("./load-more/style"), require("./masking/style"), require("./nav-bar/style"), require("./notice-bar/style"), require("./notify/style"), require("./pagination/style"), require("./picker/style"), require("./picker-view/style"), require("./popover/style"), require("./popup/style"), require("./popup-swiper/style"), require("./portal/style"), require("./progress/style"), require("./pull-refresh/style"), require("./radio/style"), require("./rate/style"), require("./slider/style"), require("./steps/style"), require("./sticky/style"), require("./swipe-load/style"), require("./tab-bar/style"), require("./tag/style"), require("./textarea/style"), require("./transition/style"));
5
+ factory(require("../style/public.less"), require("./action-sheet/style"), require("./cell/style"), require("./loading/style"), require("./badge/style"), require("./avatar/style"), require("./button/style"), require("./carousel/style"), require("./toast/style"), require("./switch/style"), require("./checkbox/style"), require("./circle-progress/style"), require("./collapse/style"), require("./tabs/style"), require("./context-provider/style"), require("./dialog/style"), require("./count-down/style"), require("./date-picker/style"), require("./dropdown/style"), require("./dropdown-menu/style"), require("./ellipsis/style"), require("./grid/style"), require("./image/style"), require("./show-monitor/style"), require("./image-picker/style"), require("./image-preview/style"), require("./input/style"), require("./load-more/style"), require("./masking/style"), require("./nav-bar/style"), require("./notice-bar/style"), require("./notify/style"), require("./pagination/style"), require("./picker/style"), require("./picker-view/style"), require("./popover/style"), require("./popup/style"), require("./popup-swiper/style"), require("./portal/style"), require("./progress/style"), require("./pull-refresh/style"), require("./radio/style"), require("./rate/style"), require("./slider/style"), require("./search-bar/style"), require("./steps/style"), require("./sticky/style"), require("./swipe-action/style"), require("./swipe-load/style"), require("./tab-bar/style"), require("./tag/style"), require("./textarea/style"), require("./transition/style"));
6
6
  } else {
7
7
  var mod = {
8
8
  exports: {}
9
9
  };
10
- factory(global._public, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style);
10
+ factory(global._public, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style, global.style);
11
11
  global.style = mod.exports;
12
12
  }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_public, _style, _style2, _style3, _style4, _style5, _style6, _style7, _style8, _style9, _style10, _style11, _style12, _style13, _style14, _style15, _style16, _style17, _style18, _style19, _style20, _style21, _style22, _style23, _style24, _style25, _style26, _style27, _style28, _style29, _style30, _style31, _style32, _style33, _style34, _style35, _style36, _style37, _style38, _style39, _style40, _style41, _style42, _style43, _style44, _style45, _style46, _style47, _style48, _style49, _style50) {
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_public, _style, _style2, _style3, _style4, _style5, _style6, _style7, _style8, _style9, _style10, _style11, _style12, _style13, _style14, _style15, _style16, _style17, _style18, _style19, _style20, _style21, _style22, _style23, _style24, _style25, _style26, _style27, _style28, _style29, _style30, _style31, _style32, _style33, _style34, _style35, _style36, _style37, _style38, _style39, _style40, _style41, _style42, _style43, _style44, _style45, _style46, _style47, _style48, _style49, _style50, _style51, _style52) {
14
14
  "use strict";
15
15
  });
@@ -0,0 +1,5 @@
1
+ #demo-swipe-action .arcodesign-mobile-demo-content {
2
+ padding: 0;
3
+ background: transparent;
4
+ overflow: hidden;
5
+ }
@@ -0,0 +1,9 @@
1
+ @import '../../../../style/mixin.less';
2
+
3
+ #demo-swipe-action {
4
+ .arcodesign-mobile-demo-content {
5
+ padding: 0;
6
+ background: transparent;
7
+ overflow: hidden;
8
+ }
9
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { SwipeActionProps, SwipeActionRef } from './type';
3
+ /**
4
+ * 滑动操作组件,左右滑动拉出菜单栏
5
+ * @en SwipeAction component, slide left and right to pull out the menu bar
6
+ * @type 反馈
7
+ * @type_en FeedBack
8
+ * @name 滑动操作
9
+ * @name_en SwipeAction
10
+ */
11
+ declare const SwipeAction: React.ForwardRefExoticComponent<SwipeActionProps & React.RefAttributes<SwipeActionRef>>;
12
+ export default SwipeAction;
@@ -0,0 +1,342 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils/utils", "@arco-design/mobile-utils", "../context-provider", "./item", "../_helpers"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils/utils"), require("@arco-design/mobile-utils"), require("../context-provider"), require("./item"), require("../_helpers"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global._extends, global.react, global.utils, global.mobileUtils, global.contextProvider, global.item, global._helpers);
11
+ global.index = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _utils, _mobileUtils, _contextProvider, _item, _helpers) {
14
+ "use strict";
15
+
16
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
17
+
18
+ _exports.__esModule = true;
19
+ _exports.default = void 0;
20
+ _extends2 = _interopRequireDefault(_extends2);
21
+ _react = _interopRequireWildcard(_react);
22
+ _item = _interopRequireDefault(_item);
23
+
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+
26
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
+
28
+ /**
29
+ * 滑动操作组件,左右滑动拉出菜单栏
30
+ * @en SwipeAction component, slide left and right to pull out the menu bar
31
+ * @type 反馈
32
+ * @type_en FeedBack
33
+ * @name 滑动操作
34
+ * @name_en SwipeAction
35
+ */
36
+ var SwipeAction = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
37
+ var _props$className = props.className,
38
+ className = _props$className === void 0 ? '' : _props$className,
39
+ style = props.style,
40
+ children = props.children,
41
+ leftActions = props.leftActions,
42
+ rightActions = props.rightActions,
43
+ _props$disabled = props.disabled,
44
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
45
+ _props$threshold = props.threshold,
46
+ threshold = _props$threshold === void 0 ? 0.15 : _props$threshold,
47
+ closeOnTouchOutside = props.closeOnTouchOutside,
48
+ _props$transitionDura = props.transitionDuration,
49
+ transitionDuration = _props$transitionDura === void 0 ? 300 : _props$transitionDura,
50
+ _props$dampRate = props.dampRate,
51
+ dampRate = _props$dampRate === void 0 ? 15 : _props$dampRate,
52
+ _props$openStyleType = props.openStyleType,
53
+ openStyleType = _props$openStyleType === void 0 ? 'layer' : _props$openStyleType,
54
+ onClose = props.onClose,
55
+ onOpen = props.onOpen;
56
+ var domRef = (0, _react.useRef)(null);
57
+ var leftRef = (0, _react.useRef)(null);
58
+ var rightRef = (0, _react.useRef)(null);
59
+ var isOpen = (0, _react.useRef)(false);
60
+ var leftMenuWidthRef = (0, _react.useRef)(0);
61
+
62
+ var _useState = (0, _react.useState)([]),
63
+ leftMenuWidthArr = _useState[0],
64
+ setLeftMenuWidthArr = _useState[1];
65
+
66
+ var rightMenuWidthRef = (0, _react.useRef)(0);
67
+
68
+ var _useState2 = (0, _react.useState)([]),
69
+ rightMenuWidthArr = _useState2[0],
70
+ setRightMenuWidthArr = _useState2[1];
71
+
72
+ var dampRateRef = (0, _helpers.useLatestRef)(dampRate);
73
+ var forbidClick = (0, _react.useRef)(false);
74
+
75
+ var _useRefState = (0, _helpers.useRefState)(false),
76
+ moving = _useRefState[0],
77
+ movingRef = _useRefState[1],
78
+ setMoving = _useRefState[2];
79
+
80
+ var _useRefState2 = (0, _helpers.useRefState)(0),
81
+ offset = _useRefState2[0],
82
+ offsetRef = _useRefState2[1],
83
+ setOffset = _useRefState2[2];
84
+
85
+ var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
86
+ prefixCls = _useContext.prefixCls;
87
+
88
+ var startRef = (0, _react.useRef)(0);
89
+ var startX = (0, _react.useRef)(0);
90
+ var slideX = (0, _react.useRef)(0);
91
+ var isLayer = openStyleType === 'layer';
92
+ var transitionStyle = (0, _react.useMemo)(function () {
93
+ return (0, _helpers.getStyleWithVendor)({
94
+ transitionDuration: moving ? '0ms' : transitionDuration + "ms"
95
+ });
96
+ }, [moving, transitionDuration]);
97
+
98
+ function resetMoveData() {
99
+ startX.current = 0;
100
+ slideX.current = 0;
101
+ }
102
+
103
+ function getMenuCurrentWidth(a, min, max) {
104
+ var buffer = Math.abs(a) / dampRateRef.current;
105
+ return Math.min(Math.max(a, min - buffer), max + buffer);
106
+ }
107
+
108
+ function touchstart(e) {
109
+ startRef.current = offsetRef.current;
110
+ resetMoveData();
111
+ startX.current = e.touches[0].pageX;
112
+ }
113
+
114
+ function touchmove(e) {
115
+ e.preventDefault();
116
+ slideX.current = e.touches[0].pageX - startX.current;
117
+ forbidClick.current = true;
118
+ setMoving(true);
119
+ setOffset(getMenuCurrentWidth(slideX.current + startRef.current, -rightMenuWidthRef.current, leftMenuWidthRef.current));
120
+ }
121
+
122
+ function touchend() {
123
+ if (movingRef.current) {
124
+ var currentMenu = offsetRef.current > 0 ? 'left' : 'right';
125
+ changeMenu(currentMenu);
126
+ setMoving(false);
127
+ (0, _utils.nextTick)(function () {
128
+ forbidClick.current = false;
129
+ });
130
+ }
131
+ }
132
+
133
+ function changeMenu(dir) {
134
+ var cookedThreshold = isOpen.current ? 1 - threshold : threshold;
135
+ var width = dir === 'left' ? leftMenuWidthRef.current : rightMenuWidthRef.current;
136
+
137
+ if (width && Math.abs(offsetRef.current) > width * cookedThreshold) {
138
+ open(dir);
139
+ } else {
140
+ close(dir);
141
+ }
142
+ }
143
+
144
+ function getWidthByRef(widthRef) {
145
+ if (!widthRef.current) {
146
+ return {
147
+ totalWidth: 0,
148
+ widthArr: []
149
+ };
150
+ }
151
+
152
+ var totalWidth = 0;
153
+ var widthArr = [];
154
+ var allEle = widthRef.current.getElementsByClassName(prefixCls + "-swipe-action-menu-action-info-container");
155
+ Array.prototype.forEach.call(allEle, function (ele) {
156
+ var _ele$getBoundingClien;
157
+
158
+ var w = (_ele$getBoundingClien = ele.getBoundingClientRect().width) != null ? _ele$getBoundingClien : 0;
159
+ totalWidth += w;
160
+ widthArr.push(w);
161
+ });
162
+ return {
163
+ totalWidth: totalWidth,
164
+ widthArr: widthArr
165
+ };
166
+ }
167
+
168
+ (0, _react.useEffect)(function () {
169
+ var container = domRef.current;
170
+
171
+ if (!disabled && container) {
172
+ container.addEventListener('touchstart', touchstart);
173
+ container.addEventListener('touchmove', touchmove);
174
+ container.addEventListener('touchend', touchend);
175
+ }
176
+
177
+ return function () {
178
+ if (!disabled && container) {
179
+ container.removeEventListener('touchstart', touchstart);
180
+ container.removeEventListener('touchmove', touchmove);
181
+ container.removeEventListener('touchend', touchend);
182
+ }
183
+ };
184
+ }, [disabled]); // 获取左右菜单的宽度
185
+ // @en Get the width of the left and right menu
186
+
187
+ (0, _react.useEffect)(function () {
188
+ var _getWidthByRef = getWidthByRef(leftRef),
189
+ leftTotalWidth = _getWidthByRef.totalWidth,
190
+ leftWidthArr = _getWidthByRef.widthArr;
191
+
192
+ leftMenuWidthRef.current = leftTotalWidth;
193
+ setLeftMenuWidthArr(leftWidthArr);
194
+
195
+ var _getWidthByRef2 = getWidthByRef(rightRef),
196
+ rightTotalWidth = _getWidthByRef2.totalWidth,
197
+ rightWidthArr = _getWidthByRef2.widthArr;
198
+
199
+ rightMenuWidthRef.current = rightTotalWidth;
200
+ setRightMenuWidthArr(rightWidthArr);
201
+ }, [leftActions, rightActions]); // 点击外部区域事件
202
+ // @en Event when clicking outside of the element
203
+
204
+ (0, _react.useEffect)(function () {
205
+ var handle = function handle(e) {
206
+ var _domRef$current;
207
+
208
+ if (!((_domRef$current = domRef.current) != null && _domRef$current.contains(e.target)) && isOpen.current) {
209
+ close();
210
+ }
211
+ };
212
+
213
+ closeOnTouchOutside && document.addEventListener('touchstart', handle);
214
+ return function () {
215
+ closeOnTouchOutside && document.removeEventListener('touchstart', handle);
216
+ };
217
+ }, [closeOnTouchOutside]);
218
+ (0, _react.useImperativeHandle)(ref, function () {
219
+ return {
220
+ dom: domRef.current,
221
+ close: close,
222
+ open: open
223
+ };
224
+ });
225
+
226
+ function close(dir) {
227
+ setOffset(0);
228
+
229
+ if (isOpen.current) {
230
+ isOpen.current = false;
231
+
232
+ if (!dir && offsetRef.current !== 0) {
233
+ var noDir = offsetRef.current > 0 ? 'left' : 'right';
234
+ handleClose(noDir);
235
+ return;
236
+ }
237
+
238
+ handleClose(dir);
239
+ }
240
+ }
241
+
242
+ function open(dir) {
243
+ if (dir === void 0) {
244
+ dir = 'right';
245
+ }
246
+
247
+ if (!isOpen.current) {
248
+ isOpen.current = true;
249
+ handleOpen(dir);
250
+ }
251
+
252
+ setOffset(dir === 'left' ? leftMenuWidthRef.current : -rightMenuWidthRef.current);
253
+ }
254
+
255
+ function handleOpen(dir) {
256
+ setTimeout(function () {
257
+ onOpen == null ? void 0 : onOpen(dir);
258
+ }, transitionDuration);
259
+ }
260
+
261
+ function handleClose(dir) {
262
+ setTimeout(function () {
263
+ onClose == null ? void 0 : onClose(dir);
264
+ }, transitionDuration);
265
+ }
266
+
267
+ function actionClick(e) {
268
+ var _leftRef$current, _rightRef$current;
269
+
270
+ if (isOpen.current && !forbidClick.current && !((_leftRef$current = leftRef.current) != null && _leftRef$current.contains(e.target)) && !((_rightRef$current = rightRef.current) != null && _rightRef$current.contains(e.target))) {
271
+ close();
272
+ }
273
+ }
274
+
275
+ function getActionRightByIndex(index) {
276
+ var preWidth = leftMenuWidthArr.slice(index + 1).reduce(function (acc, cur) {
277
+ return acc + cur;
278
+ }, 0);
279
+ return (preWidth / leftMenuWidthRef.current || 0) * 100 + "%";
280
+ }
281
+
282
+ function getActionLeftByIndex(index) {
283
+ var preWidth = rightMenuWidthArr.slice(0, index).reduce(function (acc, cur) {
284
+ return acc + cur;
285
+ }, 0);
286
+ return (preWidth / rightMenuWidthRef.current || 0) * 100 + "%";
287
+ }
288
+
289
+ return /*#__PURE__*/_react.default.createElement("div", {
290
+ className: (0, _mobileUtils.cls)(prefixCls + "-swipe-action", className, offset === 0 ? 'action-close' : 'action-open'),
291
+ style: (0, _helpers.getStyleWithVendor)((0, _extends2.default)({}, style || {}, transitionStyle, {
292
+ transform: "translateX(" + offset + "px)"
293
+ })),
294
+ ref: domRef,
295
+ onClick: actionClick
296
+ }, /*#__PURE__*/_react.default.createElement("div", {
297
+ className: (0, _mobileUtils.cls)(prefixCls + "-swipe-action-menu-left", prefixCls + "-swipe-action-menu", offset > 0 ? 'action-open' : 'action-close'),
298
+ ref: leftRef,
299
+ style: isLayer && offset >= 0 ? (0, _extends2.default)({
300
+ width: offset
301
+ }, transitionStyle) : {}
302
+ }, leftActions == null ? void 0 : leftActions.map(function (action, index) {
303
+ return /*#__PURE__*/_react.default.createElement(_item.default, {
304
+ action: (0, _extends2.default)({}, action || {}, {
305
+ style: (0, _extends2.default)({}, isLayer ? {
306
+ right: getActionRightByIndex(index)
307
+ } : {}, action.style || {}),
308
+ className: (0, _mobileUtils.cls)(action.className, "open-style-" + openStyleType)
309
+ }),
310
+ prefixCls: prefixCls + "-swipe-action-menu-action",
311
+ index: leftActions.length - index,
312
+ type: "left",
313
+ close: close,
314
+ key: index
315
+ });
316
+ })), /*#__PURE__*/_react.default.createElement("div", {
317
+ className: prefixCls + "-swipe-action-content"
318
+ }, children), /*#__PURE__*/_react.default.createElement("div", {
319
+ className: (0, _mobileUtils.cls)(prefixCls + "-swipe-action-menu-right", prefixCls + "-swipe-action-menu", offset < 0 ? 'action-open' : 'action-close'),
320
+ ref: rightRef,
321
+ style: isLayer && offset <= 0 ? (0, _extends2.default)({
322
+ width: -1 * offset
323
+ }, transitionStyle) : {}
324
+ }, rightActions == null ? void 0 : rightActions.map(function (action, index) {
325
+ return /*#__PURE__*/_react.default.createElement(_item.default, {
326
+ action: (0, _extends2.default)({}, action || {}, {
327
+ style: (0, _extends2.default)({}, isLayer ? {
328
+ left: getActionLeftByIndex(index)
329
+ } : {}, action.style || {}),
330
+ className: (0, _mobileUtils.cls)(action.className, "open-style-" + openStyleType)
331
+ }),
332
+ prefixCls: prefixCls + "-swipe-action-menu-action",
333
+ index: index + 1,
334
+ type: "right",
335
+ close: close,
336
+ key: index
337
+ });
338
+ })));
339
+ });
340
+ var _default = SwipeAction;
341
+ _exports.default = _default;
342
+ });
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { Action } from './type';
3
+ interface IProps {
4
+ action: Action;
5
+ prefixCls: string;
6
+ index: number;
7
+ type: 'left' | 'right';
8
+ close: () => void;
9
+ }
10
+ export default function renderAction({ action, prefixCls, index, type, close }: IProps): JSX.Element;
11
+ export {};