@arco-design/mobile-react 2.29.5 → 2.30.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 (736) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/_helpers/hooks.d.ts +242 -2
  5. package/cjs/_helpers/hooks.js +267 -10
  6. package/cjs/_helpers/index.d.ts +78 -1
  7. package/cjs/_helpers/index.js +87 -8
  8. package/cjs/action-sheet/demo/style/css/mobile.css +514 -1
  9. package/cjs/action-sheet/demo/style/mobile.less +32 -0
  10. package/cjs/action-sheet/style/css/index.css +597 -2
  11. package/cjs/action-sheet/style/index.less +62 -0
  12. package/cjs/avatar/demo/style/css/mobile.css +518 -1
  13. package/cjs/avatar/demo/style/mobile.less +41 -1
  14. package/cjs/avatar/style/css/index.css +529 -3
  15. package/cjs/avatar/style/index.less +54 -1
  16. package/cjs/badge/demo/style/css/mobile.css +520 -1
  17. package/cjs/badge/demo/style/mobile.less +40 -0
  18. package/cjs/badge/style/css/index.css +518 -1
  19. package/cjs/badge/style/index.less +36 -0
  20. package/cjs/button/demo/style/css/mobile.css +510 -0
  21. package/cjs/button/demo/style/mobile.less +25 -0
  22. package/cjs/button/style/css/index.css +616 -39
  23. package/cjs/button/style/index.less +135 -25
  24. package/cjs/carousel/demo/style/css/mobile.css +514 -0
  25. package/cjs/carousel/demo/style/mobile.less +33 -0
  26. package/cjs/carousel/style/css/index.css +525 -3
  27. package/cjs/carousel/style/index.less +55 -0
  28. package/cjs/cell/demo/style/css/mobile.css +521 -0
  29. package/cjs/cell/demo/style/mobile.less +46 -0
  30. package/cjs/cell/style/css/index.css +707 -2
  31. package/cjs/cell/style/index.less +96 -0
  32. package/cjs/checkbox/demo/style/css/mobile.css +510 -0
  33. package/cjs/checkbox/demo/style/mobile.less +25 -0
  34. package/cjs/checkbox/style/css/index.css +535 -4
  35. package/cjs/checkbox/style/index.less +61 -0
  36. package/cjs/circle-progress/demo/style/css/mobile.css +510 -0
  37. package/cjs/circle-progress/demo/style/mobile.less +25 -0
  38. package/cjs/circle-progress/style/css/index.css +527 -3
  39. package/cjs/circle-progress/style/index.less +49 -0
  40. package/cjs/collapse/demo/style/css/mobile.css +510 -0
  41. package/cjs/collapse/demo/style/mobile.less +25 -0
  42. package/cjs/collapse/style/css/index.css +557 -1
  43. package/cjs/collapse/style/index.less +53 -0
  44. package/cjs/context-provider/demo/style/css/mobile.css +510 -0
  45. package/cjs/context-provider/demo/style/mobile.less +25 -0
  46. package/cjs/context-provider/index.d.ts +10 -3
  47. package/cjs/context-provider/index.js +40 -7
  48. package/cjs/count-down/demo/style/css/mobile.css +518 -2
  49. package/cjs/count-down/demo/style/mobile.less +39 -0
  50. package/cjs/count-down/style/css/index.css +513 -0
  51. package/cjs/count-down/style/index.less +30 -0
  52. package/cjs/date-picker/demo/style/css/mobile.css +510 -0
  53. package/cjs/date-picker/demo/style/mobile.less +25 -0
  54. package/cjs/date-picker/style/css/index.css +510 -0
  55. package/cjs/date-picker/style/index.less +25 -0
  56. package/cjs/dialog/demo/style/css/mobile.css +520 -1
  57. package/cjs/dialog/demo/style/mobile.less +44 -0
  58. package/cjs/dialog/style/css/index.css +645 -4
  59. package/cjs/dialog/style/index.less +102 -0
  60. package/cjs/divider/demo/style/css/mobile.css +510 -1
  61. package/cjs/divider/demo/style/mobile.less +26 -2
  62. package/cjs/divider/style/css/index.css +516 -0
  63. package/cjs/divider/style/index.less +44 -9
  64. package/cjs/dropdown/demo/style/css/mobile.css +510 -0
  65. package/cjs/dropdown/demo/style/mobile.less +25 -0
  66. package/cjs/dropdown/style/css/index.css +542 -6
  67. package/cjs/dropdown/style/index.less +69 -0
  68. package/cjs/dropdown-menu/demo/style/css/mobile.css +510 -0
  69. package/cjs/dropdown-menu/demo/style/mobile.less +25 -0
  70. package/cjs/dropdown-menu/style/css/index.css +566 -3
  71. package/cjs/dropdown-menu/style/index.less +62 -0
  72. package/cjs/ellipsis/demo/style/css/mobile.css +519 -1
  73. package/cjs/ellipsis/demo/style/mobile.less +39 -0
  74. package/cjs/ellipsis/style/css/index.css +514 -0
  75. package/cjs/ellipsis/style/index.less +32 -0
  76. package/cjs/form/style/css/index.css +538 -5
  77. package/cjs/form/style/index.less +66 -3
  78. package/cjs/grid/demo/style/css/mobile.css +525 -3
  79. package/cjs/grid/demo/style/mobile.less +47 -0
  80. package/cjs/grid/style/css/index.css +519 -0
  81. package/cjs/grid/style/index.less +48 -0
  82. package/cjs/image/demo/style/css/mobile.css +510 -0
  83. package/cjs/image/demo/style/mobile.less +25 -0
  84. package/cjs/image/index.d.ts +7 -7
  85. package/cjs/image/index.js +81 -61
  86. package/cjs/image/style/css/index.css +551 -7
  87. package/cjs/image/style/index.less +54 -0
  88. package/cjs/image-picker/demo/style/css/mobile.css +510 -0
  89. package/cjs/image-picker/demo/style/mobile.less +25 -0
  90. package/cjs/image-picker/style/css/index.css +529 -4
  91. package/cjs/image-picker/style/index.less +54 -0
  92. package/cjs/image-preview/demo/style/css/mobile.css +510 -0
  93. package/cjs/image-preview/demo/style/mobile.less +25 -0
  94. package/cjs/image-preview/index.js +6 -2
  95. package/cjs/image-preview/methods.d.ts +1 -0
  96. package/cjs/image-preview/methods.js +7 -2
  97. package/cjs/image-preview/style/css/index.css +530 -5
  98. package/cjs/image-preview/style/index.less +37 -0
  99. package/cjs/index-bar/demo/style/css/mobile.css +510 -0
  100. package/cjs/index-bar/demo/style/mobile.less +25 -0
  101. package/cjs/index-bar/style/css/index.css +572 -8
  102. package/cjs/index-bar/style/index.less +67 -0
  103. package/cjs/input/demo/style/css/mobile.css +514 -1
  104. package/cjs/input/demo/style/mobile.less +32 -0
  105. package/cjs/input/style/css/index.css +589 -2
  106. package/cjs/input/style/index.less +87 -0
  107. package/cjs/keyboard/demo/style/css/mobile.css +516 -0
  108. package/cjs/keyboard/demo/style/mobile.less +35 -1
  109. package/cjs/keyboard/style/css/index.css +526 -2
  110. package/cjs/keyboard/style/index.less +51 -0
  111. package/cjs/load-more/demo/style/css/mobile.css +513 -0
  112. package/cjs/load-more/demo/style/mobile.less +30 -0
  113. package/cjs/load-more/style/css/index.css +513 -0
  114. package/cjs/load-more/style/index.less +30 -0
  115. package/cjs/loading/demo/style/css/mobile.css +510 -0
  116. package/cjs/loading/demo/style/mobile.less +25 -0
  117. package/cjs/loading/style/css/index.css +534 -5
  118. package/cjs/loading/style/index.less +45 -0
  119. package/cjs/masking/demo/style/css/mobile.css +514 -1
  120. package/cjs/masking/demo/style/mobile.less +30 -0
  121. package/cjs/masking/methods.js +7 -2
  122. package/cjs/masking/style/css/index.css +510 -0
  123. package/cjs/masking/style/index.less +25 -0
  124. package/cjs/nav-bar/demo/style/css/mobile.css +514 -1
  125. package/cjs/nav-bar/demo/style/mobile.less +33 -1
  126. package/cjs/nav-bar/style/css/index.css +550 -1
  127. package/cjs/nav-bar/style/index.less +38 -0
  128. package/cjs/notice-bar/style/css/index.css +520 -2
  129. package/cjs/notice-bar/style/index.less +36 -0
  130. package/cjs/notify/demo/style/css/mobile.css +510 -0
  131. package/cjs/notify/demo/style/mobile.less +25 -0
  132. package/cjs/notify/style/css/index.css +529 -4
  133. package/cjs/notify/style/index.less +50 -0
  134. package/cjs/pagination/demo/style/css/index.css +510 -0
  135. package/cjs/pagination/demo/style/index.less +25 -0
  136. package/cjs/pagination/style/css/index.css +543 -4
  137. package/cjs/pagination/style/index.less +72 -0
  138. package/cjs/picker/demo/style/css/mobile.css +510 -0
  139. package/cjs/picker/demo/style/mobile.less +25 -0
  140. package/cjs/picker/style/css/index.css +525 -3
  141. package/cjs/picker/style/index.less +49 -0
  142. package/cjs/picker-view/demo/style/css/mobile.css +510 -0
  143. package/cjs/picker-view/demo/style/mobile.less +25 -0
  144. package/cjs/picker-view/style/css/index.css +587 -0
  145. package/cjs/picker-view/style/index.less +50 -0
  146. package/cjs/popover/demo/style/css/mobile.css +510 -0
  147. package/cjs/popover/demo/style/mobile.less +25 -0
  148. package/cjs/popover/style/css/index.css +614 -4
  149. package/cjs/popover/style/css/menu.css +539 -1
  150. package/cjs/popover/style/index.less +126 -9
  151. package/cjs/popover/style/menu.less +69 -0
  152. package/cjs/popup/demo/style/css/mobile.css +517 -0
  153. package/cjs/popup/demo/style/mobile.less +38 -0
  154. package/cjs/popup/style/css/index.css +514 -1
  155. package/cjs/popup/style/index.less +32 -0
  156. package/cjs/popup-swiper/demo/style/css/mobile.css +517 -0
  157. package/cjs/popup-swiper/demo/style/mobile.less +38 -0
  158. package/cjs/popup-swiper/index.d.ts +2 -8
  159. package/cjs/popup-swiper/style/css/index.css +510 -0
  160. package/cjs/popup-swiper/style/index.less +25 -0
  161. package/cjs/portal/demo/style/css/mobile.css +515 -1
  162. package/cjs/portal/demo/style/mobile.less +31 -0
  163. package/cjs/progress/demo/style/css/mobile.css +510 -0
  164. package/cjs/progress/demo/style/mobile.less +25 -0
  165. package/cjs/progress/style/css/index.css +556 -8
  166. package/cjs/progress/style/index.less +91 -0
  167. package/cjs/pull-refresh/demo/style/css/mobile.css +514 -2
  168. package/cjs/pull-refresh/demo/style/mobile.less +35 -2
  169. package/cjs/pull-refresh/style/css/index.css +536 -3
  170. package/cjs/pull-refresh/style/index.less +45 -0
  171. package/cjs/radio/demo/style/css/mobile.css +513 -0
  172. package/cjs/radio/demo/style/mobile.less +32 -0
  173. package/cjs/radio/style/css/index.css +535 -4
  174. package/cjs/radio/style/index.less +61 -0
  175. package/cjs/rate/demo/style/css/mobile.css +510 -0
  176. package/cjs/rate/demo/style/mobile.less +25 -0
  177. package/cjs/rate/style/css/index.css +522 -2
  178. package/cjs/rate/style/index.less +43 -0
  179. package/cjs/search-bar/demo/style/css/mobile.css +516 -1
  180. package/cjs/search-bar/demo/style/mobile.less +39 -5
  181. package/cjs/search-bar/style/css/index.css +586 -6
  182. package/cjs/search-bar/style/index.less +84 -0
  183. package/cjs/show-monitor/demo/style/css/mobile.css +521 -2
  184. package/cjs/show-monitor/demo/style/mobile.less +43 -1
  185. package/cjs/skeleton/demo/style/css/mobile.css +510 -0
  186. package/cjs/skeleton/demo/style/mobile.less +25 -0
  187. package/cjs/skeleton/style/css/index.css +517 -1
  188. package/cjs/skeleton/style/index.less +35 -0
  189. package/cjs/slider/demo/style/css/mobile.css +514 -1
  190. package/cjs/slider/demo/style/mobile.less +34 -0
  191. package/cjs/slider/style/css/index.css +542 -5
  192. package/cjs/slider/style/index.less +74 -0
  193. package/cjs/stepper/demo/style/css/mobile.css +510 -0
  194. package/cjs/stepper/demo/style/mobile.less +25 -1
  195. package/cjs/stepper/style/css/index.css +551 -7
  196. package/cjs/stepper/style/index.less +84 -3
  197. package/cjs/steps/demo/style/css/mobile.css +544 -4
  198. package/cjs/steps/demo/style/mobile.less +41 -3
  199. package/cjs/steps/style/css/index.css +580 -9
  200. package/cjs/steps/style/index.less +138 -0
  201. package/cjs/steps/type.d.ts +1 -1
  202. package/cjs/sticky/demo/style/css/mobile.css +515 -2
  203. package/cjs/sticky/demo/style/mobile.less +34 -2
  204. package/cjs/sticky/style/css/index.css +510 -0
  205. package/cjs/sticky/style/index.less +25 -0
  206. package/cjs/swipe-action/demo/style/css/mobile.css +510 -0
  207. package/cjs/swipe-action/demo/style/mobile.less +25 -0
  208. package/cjs/swipe-action/style/css/index.css +518 -2
  209. package/cjs/swipe-action/style/index.less +43 -0
  210. package/cjs/swipe-load/demo/style/css/mobile.css +539 -5
  211. package/cjs/swipe-load/demo/style/mobile.less +64 -0
  212. package/cjs/swipe-load/style/css/index.css +517 -1
  213. package/cjs/swipe-load/style/index.less +37 -0
  214. package/cjs/switch/demo/style/css/mobile.css +515 -1
  215. package/cjs/switch/demo/style/mobile.less +35 -0
  216. package/cjs/switch/style/css/index.css +532 -4
  217. package/cjs/switch/style/index.less +59 -0
  218. package/cjs/tab-bar/demo/style/css/mobile.css +510 -0
  219. package/cjs/tab-bar/demo/style/mobile.less +25 -0
  220. package/cjs/tab-bar/style/css/index.css +517 -1
  221. package/cjs/tab-bar/style/index.less +37 -0
  222. package/cjs/tabs/demo/style/css/mobile.css +542 -5
  223. package/cjs/tabs/demo/style/mobile.less +75 -0
  224. package/cjs/tabs/index.js +4 -1
  225. package/cjs/tabs/style/css/index.css +618 -13
  226. package/cjs/tabs/style/index.less +123 -0
  227. package/cjs/tabs/tab-cell.js +1 -1
  228. package/cjs/tag/demo/style/css/mobile.css +510 -0
  229. package/cjs/tag/demo/style/mobile.less +25 -0
  230. package/cjs/tag/style/css/index.css +538 -10
  231. package/cjs/tag/style/index.less +55 -0
  232. package/cjs/textarea/demo/style/css/mobile.css +514 -1
  233. package/cjs/textarea/demo/style/mobile.less +32 -1
  234. package/cjs/textarea/style/css/index.css +527 -2
  235. package/cjs/textarea/style/index.less +47 -0
  236. package/cjs/toast/demo/style/css/mobile.css +510 -0
  237. package/cjs/toast/demo/style/mobile.less +25 -0
  238. package/cjs/toast/style/css/index.css +530 -5
  239. package/cjs/toast/style/index.less +37 -0
  240. package/cjs/transition/demo/style/css/mobile.css +510 -0
  241. package/cjs/transition/demo/style/mobile.less +25 -0
  242. package/cjs/transition/style/css/index.css +510 -0
  243. package/cjs/transition/style/index.less +25 -0
  244. package/dist/index.js +1196 -117
  245. package/dist/index.min.js +4 -4
  246. package/dist/style.css +28002 -211
  247. package/dist/style.min.css +1 -1
  248. package/esm/_helpers/hooks.d.ts +242 -2
  249. package/esm/_helpers/hooks.js +269 -10
  250. package/esm/_helpers/index.d.ts +78 -1
  251. package/esm/_helpers/index.js +80 -1
  252. package/esm/action-sheet/demo/style/css/mobile.css +514 -1
  253. package/esm/action-sheet/demo/style/mobile.less +32 -0
  254. package/esm/action-sheet/style/css/index.css +597 -2
  255. package/esm/action-sheet/style/index.less +62 -0
  256. package/esm/avatar/demo/style/css/mobile.css +518 -1
  257. package/esm/avatar/demo/style/mobile.less +41 -1
  258. package/esm/avatar/style/css/index.css +529 -3
  259. package/esm/avatar/style/index.less +54 -1
  260. package/esm/badge/demo/style/css/mobile.css +520 -1
  261. package/esm/badge/demo/style/mobile.less +40 -0
  262. package/esm/badge/style/css/index.css +518 -1
  263. package/esm/badge/style/index.less +36 -0
  264. package/esm/button/demo/style/css/mobile.css +510 -0
  265. package/esm/button/demo/style/mobile.less +25 -0
  266. package/esm/button/style/css/index.css +616 -39
  267. package/esm/button/style/index.less +135 -25
  268. package/esm/carousel/demo/style/css/mobile.css +514 -0
  269. package/esm/carousel/demo/style/mobile.less +33 -0
  270. package/esm/carousel/style/css/index.css +525 -3
  271. package/esm/carousel/style/index.less +55 -0
  272. package/esm/cell/demo/style/css/mobile.css +521 -0
  273. package/esm/cell/demo/style/mobile.less +46 -0
  274. package/esm/cell/style/css/index.css +707 -2
  275. package/esm/cell/style/index.less +96 -0
  276. package/esm/checkbox/demo/style/css/mobile.css +510 -0
  277. package/esm/checkbox/demo/style/mobile.less +25 -0
  278. package/esm/checkbox/style/css/index.css +535 -4
  279. package/esm/checkbox/style/index.less +61 -0
  280. package/esm/circle-progress/demo/style/css/mobile.css +510 -0
  281. package/esm/circle-progress/demo/style/mobile.less +25 -0
  282. package/esm/circle-progress/style/css/index.css +527 -3
  283. package/esm/circle-progress/style/index.less +49 -0
  284. package/esm/collapse/demo/style/css/mobile.css +510 -0
  285. package/esm/collapse/demo/style/mobile.less +25 -0
  286. package/esm/collapse/style/css/index.css +557 -1
  287. package/esm/collapse/style/index.less +53 -0
  288. package/esm/context-provider/demo/style/css/mobile.css +510 -0
  289. package/esm/context-provider/demo/style/mobile.less +25 -0
  290. package/esm/context-provider/index.d.ts +10 -3
  291. package/esm/context-provider/index.js +41 -8
  292. package/esm/count-down/demo/style/css/mobile.css +518 -2
  293. package/esm/count-down/demo/style/mobile.less +39 -0
  294. package/esm/count-down/style/css/index.css +513 -0
  295. package/esm/count-down/style/index.less +30 -0
  296. package/esm/date-picker/demo/style/css/mobile.css +510 -0
  297. package/esm/date-picker/demo/style/mobile.less +25 -0
  298. package/esm/date-picker/style/css/index.css +510 -0
  299. package/esm/date-picker/style/index.less +25 -0
  300. package/esm/dialog/demo/style/css/mobile.css +520 -1
  301. package/esm/dialog/demo/style/mobile.less +44 -0
  302. package/esm/dialog/style/css/index.css +645 -4
  303. package/esm/dialog/style/index.less +102 -0
  304. package/esm/divider/demo/style/css/mobile.css +510 -1
  305. package/esm/divider/demo/style/mobile.less +26 -2
  306. package/esm/divider/style/css/index.css +516 -0
  307. package/esm/divider/style/index.less +44 -9
  308. package/esm/dropdown/demo/style/css/mobile.css +510 -0
  309. package/esm/dropdown/demo/style/mobile.less +25 -0
  310. package/esm/dropdown/style/css/index.css +542 -6
  311. package/esm/dropdown/style/index.less +69 -0
  312. package/esm/dropdown-menu/demo/style/css/mobile.css +510 -0
  313. package/esm/dropdown-menu/demo/style/mobile.less +25 -0
  314. package/esm/dropdown-menu/style/css/index.css +566 -3
  315. package/esm/dropdown-menu/style/index.less +62 -0
  316. package/esm/ellipsis/demo/style/css/mobile.css +519 -1
  317. package/esm/ellipsis/demo/style/mobile.less +39 -0
  318. package/esm/ellipsis/style/css/index.css +514 -0
  319. package/esm/ellipsis/style/index.less +32 -0
  320. package/esm/form/style/css/index.css +538 -5
  321. package/esm/form/style/index.less +66 -3
  322. package/esm/grid/demo/style/css/mobile.css +525 -3
  323. package/esm/grid/demo/style/mobile.less +47 -0
  324. package/esm/grid/style/css/index.css +519 -0
  325. package/esm/grid/style/index.less +48 -0
  326. package/esm/image/demo/style/css/mobile.css +510 -0
  327. package/esm/image/demo/style/mobile.less +25 -0
  328. package/esm/image/index.d.ts +7 -7
  329. package/esm/image/index.js +81 -61
  330. package/esm/image/style/css/index.css +551 -7
  331. package/esm/image/style/index.less +54 -0
  332. package/esm/image-picker/demo/style/css/mobile.css +510 -0
  333. package/esm/image-picker/demo/style/mobile.less +25 -0
  334. package/esm/image-picker/style/css/index.css +529 -4
  335. package/esm/image-picker/style/index.less +54 -0
  336. package/esm/image-preview/demo/style/css/mobile.css +510 -0
  337. package/esm/image-preview/demo/style/mobile.less +25 -0
  338. package/esm/image-preview/index.js +6 -2
  339. package/esm/image-preview/methods.d.ts +1 -0
  340. package/esm/image-preview/methods.js +7 -3
  341. package/esm/image-preview/style/css/index.css +530 -5
  342. package/esm/image-preview/style/index.less +37 -0
  343. package/esm/index-bar/demo/style/css/mobile.css +510 -0
  344. package/esm/index-bar/demo/style/mobile.less +25 -0
  345. package/esm/index-bar/style/css/index.css +572 -8
  346. package/esm/index-bar/style/index.less +67 -0
  347. package/esm/input/demo/style/css/mobile.css +514 -1
  348. package/esm/input/demo/style/mobile.less +32 -0
  349. package/esm/input/style/css/index.css +589 -2
  350. package/esm/input/style/index.less +87 -0
  351. package/esm/keyboard/demo/style/css/mobile.css +516 -0
  352. package/esm/keyboard/demo/style/mobile.less +35 -1
  353. package/esm/keyboard/style/css/index.css +526 -2
  354. package/esm/keyboard/style/index.less +51 -0
  355. package/esm/load-more/demo/style/css/mobile.css +513 -0
  356. package/esm/load-more/demo/style/mobile.less +30 -0
  357. package/esm/load-more/style/css/index.css +513 -0
  358. package/esm/load-more/style/index.less +30 -0
  359. package/esm/loading/demo/style/css/mobile.css +510 -0
  360. package/esm/loading/demo/style/mobile.less +25 -0
  361. package/esm/loading/style/css/index.css +534 -5
  362. package/esm/loading/style/index.less +45 -0
  363. package/esm/masking/demo/style/css/mobile.css +514 -1
  364. package/esm/masking/demo/style/mobile.less +30 -0
  365. package/esm/masking/methods.js +7 -3
  366. package/esm/masking/style/css/index.css +510 -0
  367. package/esm/masking/style/index.less +25 -0
  368. package/esm/nav-bar/demo/style/css/mobile.css +514 -1
  369. package/esm/nav-bar/demo/style/mobile.less +33 -1
  370. package/esm/nav-bar/style/css/index.css +550 -1
  371. package/esm/nav-bar/style/index.less +38 -0
  372. package/esm/notice-bar/style/css/index.css +520 -2
  373. package/esm/notice-bar/style/index.less +36 -0
  374. package/esm/notify/demo/style/css/mobile.css +510 -0
  375. package/esm/notify/demo/style/mobile.less +25 -0
  376. package/esm/notify/style/css/index.css +529 -4
  377. package/esm/notify/style/index.less +50 -0
  378. package/esm/pagination/demo/style/css/index.css +510 -0
  379. package/esm/pagination/demo/style/index.less +25 -0
  380. package/esm/pagination/style/css/index.css +543 -4
  381. package/esm/pagination/style/index.less +72 -0
  382. package/esm/picker/demo/style/css/mobile.css +510 -0
  383. package/esm/picker/demo/style/mobile.less +25 -0
  384. package/esm/picker/style/css/index.css +525 -3
  385. package/esm/picker/style/index.less +49 -0
  386. package/esm/picker-view/demo/style/css/mobile.css +510 -0
  387. package/esm/picker-view/demo/style/mobile.less +25 -0
  388. package/esm/picker-view/style/css/index.css +587 -0
  389. package/esm/picker-view/style/index.less +50 -0
  390. package/esm/popover/demo/style/css/mobile.css +510 -0
  391. package/esm/popover/demo/style/mobile.less +25 -0
  392. package/esm/popover/style/css/index.css +614 -4
  393. package/esm/popover/style/css/menu.css +539 -1
  394. package/esm/popover/style/index.less +126 -9
  395. package/esm/popover/style/menu.less +69 -0
  396. package/esm/popup/demo/style/css/mobile.css +517 -0
  397. package/esm/popup/demo/style/mobile.less +38 -0
  398. package/esm/popup/style/css/index.css +514 -1
  399. package/esm/popup/style/index.less +32 -0
  400. package/esm/popup-swiper/demo/style/css/mobile.css +517 -0
  401. package/esm/popup-swiper/demo/style/mobile.less +38 -0
  402. package/esm/popup-swiper/index.d.ts +2 -8
  403. package/esm/popup-swiper/style/css/index.css +510 -0
  404. package/esm/popup-swiper/style/index.less +25 -0
  405. package/esm/portal/demo/style/css/mobile.css +515 -1
  406. package/esm/portal/demo/style/mobile.less +31 -0
  407. package/esm/progress/demo/style/css/mobile.css +510 -0
  408. package/esm/progress/demo/style/mobile.less +25 -0
  409. package/esm/progress/style/css/index.css +556 -8
  410. package/esm/progress/style/index.less +91 -0
  411. package/esm/pull-refresh/demo/style/css/mobile.css +514 -2
  412. package/esm/pull-refresh/demo/style/mobile.less +35 -2
  413. package/esm/pull-refresh/style/css/index.css +536 -3
  414. package/esm/pull-refresh/style/index.less +45 -0
  415. package/esm/radio/demo/style/css/mobile.css +513 -0
  416. package/esm/radio/demo/style/mobile.less +32 -0
  417. package/esm/radio/style/css/index.css +535 -4
  418. package/esm/radio/style/index.less +61 -0
  419. package/esm/rate/demo/style/css/mobile.css +510 -0
  420. package/esm/rate/demo/style/mobile.less +25 -0
  421. package/esm/rate/style/css/index.css +522 -2
  422. package/esm/rate/style/index.less +43 -0
  423. package/esm/search-bar/demo/style/css/mobile.css +516 -1
  424. package/esm/search-bar/demo/style/mobile.less +39 -5
  425. package/esm/search-bar/style/css/index.css +586 -6
  426. package/esm/search-bar/style/index.less +84 -0
  427. package/esm/show-monitor/demo/style/css/mobile.css +521 -2
  428. package/esm/show-monitor/demo/style/mobile.less +43 -1
  429. package/esm/skeleton/demo/style/css/mobile.css +510 -0
  430. package/esm/skeleton/demo/style/mobile.less +25 -0
  431. package/esm/skeleton/style/css/index.css +517 -1
  432. package/esm/skeleton/style/index.less +35 -0
  433. package/esm/slider/demo/style/css/mobile.css +514 -1
  434. package/esm/slider/demo/style/mobile.less +34 -0
  435. package/esm/slider/style/css/index.css +542 -5
  436. package/esm/slider/style/index.less +74 -0
  437. package/esm/stepper/demo/style/css/mobile.css +510 -0
  438. package/esm/stepper/demo/style/mobile.less +25 -1
  439. package/esm/stepper/style/css/index.css +551 -7
  440. package/esm/stepper/style/index.less +84 -3
  441. package/esm/steps/demo/style/css/mobile.css +544 -4
  442. package/esm/steps/demo/style/mobile.less +41 -3
  443. package/esm/steps/style/css/index.css +580 -9
  444. package/esm/steps/style/index.less +138 -0
  445. package/esm/steps/type.d.ts +1 -1
  446. package/esm/sticky/demo/style/css/mobile.css +515 -2
  447. package/esm/sticky/demo/style/mobile.less +34 -2
  448. package/esm/sticky/style/css/index.css +510 -0
  449. package/esm/sticky/style/index.less +25 -0
  450. package/esm/swipe-action/demo/style/css/mobile.css +510 -0
  451. package/esm/swipe-action/demo/style/mobile.less +25 -0
  452. package/esm/swipe-action/style/css/index.css +518 -2
  453. package/esm/swipe-action/style/index.less +43 -0
  454. package/esm/swipe-load/demo/style/css/mobile.css +539 -5
  455. package/esm/swipe-load/demo/style/mobile.less +64 -0
  456. package/esm/swipe-load/style/css/index.css +517 -1
  457. package/esm/swipe-load/style/index.less +37 -0
  458. package/esm/switch/demo/style/css/mobile.css +515 -1
  459. package/esm/switch/demo/style/mobile.less +35 -0
  460. package/esm/switch/style/css/index.css +532 -4
  461. package/esm/switch/style/index.less +59 -0
  462. package/esm/tab-bar/demo/style/css/mobile.css +510 -0
  463. package/esm/tab-bar/demo/style/mobile.less +25 -0
  464. package/esm/tab-bar/style/css/index.css +517 -1
  465. package/esm/tab-bar/style/index.less +37 -0
  466. package/esm/tabs/demo/style/css/mobile.css +542 -5
  467. package/esm/tabs/demo/style/mobile.less +75 -0
  468. package/esm/tabs/index.js +4 -1
  469. package/esm/tabs/style/css/index.css +618 -13
  470. package/esm/tabs/style/index.less +123 -0
  471. package/esm/tabs/tab-cell.js +1 -1
  472. package/esm/tag/demo/style/css/mobile.css +510 -0
  473. package/esm/tag/demo/style/mobile.less +25 -0
  474. package/esm/tag/style/css/index.css +538 -10
  475. package/esm/tag/style/index.less +55 -0
  476. package/esm/textarea/demo/style/css/mobile.css +514 -1
  477. package/esm/textarea/demo/style/mobile.less +32 -1
  478. package/esm/textarea/style/css/index.css +527 -2
  479. package/esm/textarea/style/index.less +47 -0
  480. package/esm/toast/demo/style/css/mobile.css +510 -0
  481. package/esm/toast/demo/style/mobile.less +25 -0
  482. package/esm/toast/style/css/index.css +530 -5
  483. package/esm/toast/style/index.less +37 -0
  484. package/esm/transition/demo/style/css/mobile.css +510 -0
  485. package/esm/transition/demo/style/mobile.less +25 -0
  486. package/esm/transition/style/css/index.css +510 -0
  487. package/esm/transition/style/index.less +25 -0
  488. package/less-loader.config.js +6 -0
  489. package/package.json +3 -3
  490. package/style/css/public.css +510 -0
  491. package/tokens/app/arcodesign/default/css-variables.less +357 -103
  492. package/tokens/app/arcodesign/default/index.d.ts +257 -3
  493. package/tokens/app/arcodesign/default/index.js +357 -103
  494. package/tokens/app/arcodesign/default/index.json +2574 -526
  495. package/tokens/app/arcodesign/default/index.less +357 -103
  496. package/tokens/mixin/index.less +255 -1
  497. package/umd/_helpers/hooks.d.ts +242 -2
  498. package/umd/_helpers/hooks.js +267 -10
  499. package/umd/_helpers/index.d.ts +78 -1
  500. package/umd/_helpers/index.js +89 -10
  501. package/umd/action-sheet/demo/style/css/mobile.css +514 -1
  502. package/umd/action-sheet/demo/style/mobile.less +32 -0
  503. package/umd/action-sheet/style/css/index.css +597 -2
  504. package/umd/action-sheet/style/index.less +62 -0
  505. package/umd/avatar/demo/style/css/mobile.css +518 -1
  506. package/umd/avatar/demo/style/mobile.less +41 -1
  507. package/umd/avatar/style/css/index.css +529 -3
  508. package/umd/avatar/style/index.less +54 -1
  509. package/umd/badge/demo/style/css/mobile.css +520 -1
  510. package/umd/badge/demo/style/mobile.less +40 -0
  511. package/umd/badge/style/css/index.css +518 -1
  512. package/umd/badge/style/index.less +36 -0
  513. package/umd/button/demo/style/css/mobile.css +510 -0
  514. package/umd/button/demo/style/mobile.less +25 -0
  515. package/umd/button/style/css/index.css +616 -39
  516. package/umd/button/style/index.less +135 -25
  517. package/umd/carousel/demo/style/css/mobile.css +514 -0
  518. package/umd/carousel/demo/style/mobile.less +33 -0
  519. package/umd/carousel/style/css/index.css +525 -3
  520. package/umd/carousel/style/index.less +55 -0
  521. package/umd/cell/demo/style/css/mobile.css +521 -0
  522. package/umd/cell/demo/style/mobile.less +46 -0
  523. package/umd/cell/style/css/index.css +707 -2
  524. package/umd/cell/style/index.less +96 -0
  525. package/umd/checkbox/demo/style/css/mobile.css +510 -0
  526. package/umd/checkbox/demo/style/mobile.less +25 -0
  527. package/umd/checkbox/style/css/index.css +535 -4
  528. package/umd/checkbox/style/index.less +61 -0
  529. package/umd/circle-progress/demo/style/css/mobile.css +510 -0
  530. package/umd/circle-progress/demo/style/mobile.less +25 -0
  531. package/umd/circle-progress/style/css/index.css +527 -3
  532. package/umd/circle-progress/style/index.less +49 -0
  533. package/umd/collapse/demo/style/css/mobile.css +510 -0
  534. package/umd/collapse/demo/style/mobile.less +25 -0
  535. package/umd/collapse/style/css/index.css +557 -1
  536. package/umd/collapse/style/index.less +53 -0
  537. package/umd/context-provider/demo/style/css/mobile.css +510 -0
  538. package/umd/context-provider/demo/style/mobile.less +25 -0
  539. package/umd/context-provider/index.d.ts +10 -3
  540. package/umd/context-provider/index.js +40 -7
  541. package/umd/count-down/demo/style/css/mobile.css +518 -2
  542. package/umd/count-down/demo/style/mobile.less +39 -0
  543. package/umd/count-down/style/css/index.css +513 -0
  544. package/umd/count-down/style/index.less +30 -0
  545. package/umd/date-picker/demo/style/css/mobile.css +510 -0
  546. package/umd/date-picker/demo/style/mobile.less +25 -0
  547. package/umd/date-picker/style/css/index.css +510 -0
  548. package/umd/date-picker/style/index.less +25 -0
  549. package/umd/dialog/demo/style/css/mobile.css +520 -1
  550. package/umd/dialog/demo/style/mobile.less +44 -0
  551. package/umd/dialog/style/css/index.css +645 -4
  552. package/umd/dialog/style/index.less +102 -0
  553. package/umd/divider/demo/style/css/mobile.css +510 -1
  554. package/umd/divider/demo/style/mobile.less +26 -2
  555. package/umd/divider/style/css/index.css +516 -0
  556. package/umd/divider/style/index.less +44 -9
  557. package/umd/dropdown/demo/style/css/mobile.css +510 -0
  558. package/umd/dropdown/demo/style/mobile.less +25 -0
  559. package/umd/dropdown/style/css/index.css +542 -6
  560. package/umd/dropdown/style/index.less +69 -0
  561. package/umd/dropdown-menu/demo/style/css/mobile.css +510 -0
  562. package/umd/dropdown-menu/demo/style/mobile.less +25 -0
  563. package/umd/dropdown-menu/style/css/index.css +566 -3
  564. package/umd/dropdown-menu/style/index.less +62 -0
  565. package/umd/ellipsis/demo/style/css/mobile.css +519 -1
  566. package/umd/ellipsis/demo/style/mobile.less +39 -0
  567. package/umd/ellipsis/style/css/index.css +514 -0
  568. package/umd/ellipsis/style/index.less +32 -0
  569. package/umd/form/style/css/index.css +538 -5
  570. package/umd/form/style/index.less +66 -3
  571. package/umd/grid/demo/style/css/mobile.css +525 -3
  572. package/umd/grid/demo/style/mobile.less +47 -0
  573. package/umd/grid/style/css/index.css +519 -0
  574. package/umd/grid/style/index.less +48 -0
  575. package/umd/image/demo/style/css/mobile.css +510 -0
  576. package/umd/image/demo/style/mobile.less +25 -0
  577. package/umd/image/index.d.ts +7 -7
  578. package/umd/image/index.js +81 -61
  579. package/umd/image/style/css/index.css +551 -7
  580. package/umd/image/style/index.less +54 -0
  581. package/umd/image-picker/demo/style/css/mobile.css +510 -0
  582. package/umd/image-picker/demo/style/mobile.less +25 -0
  583. package/umd/image-picker/style/css/index.css +529 -4
  584. package/umd/image-picker/style/index.less +54 -0
  585. package/umd/image-preview/demo/style/css/mobile.css +510 -0
  586. package/umd/image-preview/demo/style/mobile.less +25 -0
  587. package/umd/image-preview/index.js +6 -2
  588. package/umd/image-preview/methods.d.ts +1 -0
  589. package/umd/image-preview/methods.js +7 -2
  590. package/umd/image-preview/style/css/index.css +530 -5
  591. package/umd/image-preview/style/index.less +37 -0
  592. package/umd/index-bar/demo/style/css/mobile.css +510 -0
  593. package/umd/index-bar/demo/style/mobile.less +25 -0
  594. package/umd/index-bar/style/css/index.css +572 -8
  595. package/umd/index-bar/style/index.less +67 -0
  596. package/umd/input/demo/style/css/mobile.css +514 -1
  597. package/umd/input/demo/style/mobile.less +32 -0
  598. package/umd/input/style/css/index.css +589 -2
  599. package/umd/input/style/index.less +87 -0
  600. package/umd/keyboard/demo/style/css/mobile.css +516 -0
  601. package/umd/keyboard/demo/style/mobile.less +35 -1
  602. package/umd/keyboard/style/css/index.css +526 -2
  603. package/umd/keyboard/style/index.less +51 -0
  604. package/umd/load-more/demo/style/css/mobile.css +513 -0
  605. package/umd/load-more/demo/style/mobile.less +30 -0
  606. package/umd/load-more/style/css/index.css +513 -0
  607. package/umd/load-more/style/index.less +30 -0
  608. package/umd/loading/demo/style/css/mobile.css +510 -0
  609. package/umd/loading/demo/style/mobile.less +25 -0
  610. package/umd/loading/style/css/index.css +534 -5
  611. package/umd/loading/style/index.less +45 -0
  612. package/umd/masking/demo/style/css/mobile.css +514 -1
  613. package/umd/masking/demo/style/mobile.less +30 -0
  614. package/umd/masking/methods.js +7 -2
  615. package/umd/masking/style/css/index.css +510 -0
  616. package/umd/masking/style/index.less +25 -0
  617. package/umd/nav-bar/demo/style/css/mobile.css +514 -1
  618. package/umd/nav-bar/demo/style/mobile.less +33 -1
  619. package/umd/nav-bar/style/css/index.css +550 -1
  620. package/umd/nav-bar/style/index.less +38 -0
  621. package/umd/notice-bar/style/css/index.css +520 -2
  622. package/umd/notice-bar/style/index.less +36 -0
  623. package/umd/notify/demo/style/css/mobile.css +510 -0
  624. package/umd/notify/demo/style/mobile.less +25 -0
  625. package/umd/notify/style/css/index.css +529 -4
  626. package/umd/notify/style/index.less +50 -0
  627. package/umd/pagination/demo/style/css/index.css +510 -0
  628. package/umd/pagination/demo/style/index.less +25 -0
  629. package/umd/pagination/style/css/index.css +543 -4
  630. package/umd/pagination/style/index.less +72 -0
  631. package/umd/picker/demo/style/css/mobile.css +510 -0
  632. package/umd/picker/demo/style/mobile.less +25 -0
  633. package/umd/picker/style/css/index.css +525 -3
  634. package/umd/picker/style/index.less +49 -0
  635. package/umd/picker-view/demo/style/css/mobile.css +510 -0
  636. package/umd/picker-view/demo/style/mobile.less +25 -0
  637. package/umd/picker-view/style/css/index.css +587 -0
  638. package/umd/picker-view/style/index.less +50 -0
  639. package/umd/popover/demo/style/css/mobile.css +510 -0
  640. package/umd/popover/demo/style/mobile.less +25 -0
  641. package/umd/popover/style/css/index.css +614 -4
  642. package/umd/popover/style/css/menu.css +539 -1
  643. package/umd/popover/style/index.less +126 -9
  644. package/umd/popover/style/menu.less +69 -0
  645. package/umd/popup/demo/style/css/mobile.css +517 -0
  646. package/umd/popup/demo/style/mobile.less +38 -0
  647. package/umd/popup/style/css/index.css +514 -1
  648. package/umd/popup/style/index.less +32 -0
  649. package/umd/popup-swiper/demo/style/css/mobile.css +517 -0
  650. package/umd/popup-swiper/demo/style/mobile.less +38 -0
  651. package/umd/popup-swiper/index.d.ts +2 -8
  652. package/umd/popup-swiper/style/css/index.css +510 -0
  653. package/umd/popup-swiper/style/index.less +25 -0
  654. package/umd/portal/demo/style/css/mobile.css +515 -1
  655. package/umd/portal/demo/style/mobile.less +31 -0
  656. package/umd/progress/demo/style/css/mobile.css +510 -0
  657. package/umd/progress/demo/style/mobile.less +25 -0
  658. package/umd/progress/style/css/index.css +556 -8
  659. package/umd/progress/style/index.less +91 -0
  660. package/umd/pull-refresh/demo/style/css/mobile.css +514 -2
  661. package/umd/pull-refresh/demo/style/mobile.less +35 -2
  662. package/umd/pull-refresh/style/css/index.css +536 -3
  663. package/umd/pull-refresh/style/index.less +45 -0
  664. package/umd/radio/demo/style/css/mobile.css +513 -0
  665. package/umd/radio/demo/style/mobile.less +32 -0
  666. package/umd/radio/style/css/index.css +535 -4
  667. package/umd/radio/style/index.less +61 -0
  668. package/umd/rate/demo/style/css/mobile.css +510 -0
  669. package/umd/rate/demo/style/mobile.less +25 -0
  670. package/umd/rate/style/css/index.css +522 -2
  671. package/umd/rate/style/index.less +43 -0
  672. package/umd/search-bar/demo/style/css/mobile.css +516 -1
  673. package/umd/search-bar/demo/style/mobile.less +39 -5
  674. package/umd/search-bar/style/css/index.css +586 -6
  675. package/umd/search-bar/style/index.less +84 -0
  676. package/umd/show-monitor/demo/style/css/mobile.css +521 -2
  677. package/umd/show-monitor/demo/style/mobile.less +43 -1
  678. package/umd/skeleton/demo/style/css/mobile.css +510 -0
  679. package/umd/skeleton/demo/style/mobile.less +25 -0
  680. package/umd/skeleton/style/css/index.css +517 -1
  681. package/umd/skeleton/style/index.less +35 -0
  682. package/umd/slider/demo/style/css/mobile.css +514 -1
  683. package/umd/slider/demo/style/mobile.less +34 -0
  684. package/umd/slider/style/css/index.css +542 -5
  685. package/umd/slider/style/index.less +74 -0
  686. package/umd/stepper/demo/style/css/mobile.css +510 -0
  687. package/umd/stepper/demo/style/mobile.less +25 -1
  688. package/umd/stepper/style/css/index.css +551 -7
  689. package/umd/stepper/style/index.less +84 -3
  690. package/umd/steps/demo/style/css/mobile.css +544 -4
  691. package/umd/steps/demo/style/mobile.less +41 -3
  692. package/umd/steps/style/css/index.css +580 -9
  693. package/umd/steps/style/index.less +138 -0
  694. package/umd/steps/type.d.ts +1 -1
  695. package/umd/sticky/demo/style/css/mobile.css +515 -2
  696. package/umd/sticky/demo/style/mobile.less +34 -2
  697. package/umd/sticky/style/css/index.css +510 -0
  698. package/umd/sticky/style/index.less +25 -0
  699. package/umd/swipe-action/demo/style/css/mobile.css +510 -0
  700. package/umd/swipe-action/demo/style/mobile.less +25 -0
  701. package/umd/swipe-action/style/css/index.css +518 -2
  702. package/umd/swipe-action/style/index.less +43 -0
  703. package/umd/swipe-load/demo/style/css/mobile.css +539 -5
  704. package/umd/swipe-load/demo/style/mobile.less +64 -0
  705. package/umd/swipe-load/style/css/index.css +517 -1
  706. package/umd/swipe-load/style/index.less +37 -0
  707. package/umd/switch/demo/style/css/mobile.css +515 -1
  708. package/umd/switch/demo/style/mobile.less +35 -0
  709. package/umd/switch/style/css/index.css +532 -4
  710. package/umd/switch/style/index.less +59 -0
  711. package/umd/tab-bar/demo/style/css/mobile.css +510 -0
  712. package/umd/tab-bar/demo/style/mobile.less +25 -0
  713. package/umd/tab-bar/style/css/index.css +517 -1
  714. package/umd/tab-bar/style/index.less +37 -0
  715. package/umd/tabs/demo/style/css/mobile.css +542 -5
  716. package/umd/tabs/demo/style/mobile.less +75 -0
  717. package/umd/tabs/index.js +4 -1
  718. package/umd/tabs/style/css/index.css +618 -13
  719. package/umd/tabs/style/index.less +123 -0
  720. package/umd/tabs/tab-cell.js +1 -1
  721. package/umd/tag/demo/style/css/mobile.css +510 -0
  722. package/umd/tag/demo/style/mobile.less +25 -0
  723. package/umd/tag/style/css/index.css +538 -10
  724. package/umd/tag/style/index.less +55 -0
  725. package/umd/textarea/demo/style/css/mobile.css +514 -1
  726. package/umd/textarea/demo/style/mobile.less +32 -1
  727. package/umd/textarea/style/css/index.css +527 -2
  728. package/umd/textarea/style/index.less +47 -0
  729. package/umd/toast/demo/style/css/mobile.css +510 -0
  730. package/umd/toast/demo/style/mobile.less +25 -0
  731. package/umd/toast/style/css/index.css +530 -5
  732. package/umd/toast/style/index.less +37 -0
  733. package/umd/transition/demo/style/css/mobile.css +510 -0
  734. package/umd/transition/demo/style/mobile.less +25 -0
  735. package/umd/transition/style/css/index.css +510 -0
  736. package/umd/transition/style/index.less +25 -0
package/dist/index.js CHANGED
@@ -111,27 +111,151 @@
111
111
  }
112
112
 
113
113
  var opt = Object.prototype.toString;
114
+ /**
115
+ * 判断一个对象是否为数组类型
116
+ * @desc {en} Whether it is an array
117
+ * @param {any} obj 入参
118
+ * @param {any} obj {en} Entering
119
+ * @returns {boolean} 返回是否为数组类型
120
+ * @returns {boolean} {en} Returns whether it is an array type
121
+ * @example
122
+ * ```
123
+ * import { isArray } from '@arco-design/mobile-utils';
124
+ *
125
+ * const test = isArray([]);
126
+ * ```
127
+ */
128
+
114
129
  function isArray(obj) {
115
130
  return opt.call(obj) === '[object Array]';
116
131
  }
132
+ /**
133
+ * 判断一个对象是否为对象类型
134
+ * @desc {en} Whether it is an object
135
+ * @param {any} obj 入参
136
+ * @param {any} obj {en} Entering
137
+ * @returns {boolean} 返回是否为对象类型
138
+ * @returns {boolean} {en} Returns whether it is an object type
139
+ * @example
140
+ * ```
141
+ * import { isObject } from '@arco-design/mobile-utils';
142
+ *
143
+ * const test = isObject({});
144
+ * ```
145
+ */
146
+
117
147
  function isObject$2(obj) {
118
148
  return opt.call(obj) === '[object Object]';
119
149
  }
150
+ /**
151
+ * 判断一个对象是否为字符串类型
152
+ * @desc {en} Whether it is an string
153
+ * @param {any} obj 入参
154
+ * @param {any} obj {en} Entering
155
+ * @returns {boolean} 返回是否为字符串类型
156
+ * @returns {boolean} {en} Returns whether it is an string type
157
+ * @example
158
+ * ```
159
+ * import { isString } from '@arco-design/mobile-utils';
160
+ *
161
+ * const test = isString('');
162
+ * ```
163
+ */
164
+
120
165
  function isString(obj) {
121
166
  return opt.call(obj) === '[object String]';
122
167
  }
168
+ /**
169
+ * 检查一个值是否在给定的有效值列表中
170
+ * @desc {en} Checks whether a value is in the given list of valid values
171
+ * @param {T} value 检查的值
172
+ * @param {T} value {en} value to check
173
+ * @param {T[]} validList 有效值列表
174
+ * @param {T[]} validList {en} List of valid values
175
+ * @returns {boolean} 返回要检查的值是否在有效值列表中
176
+ * @returns {boolean} {en} Returns whether the value to be checked is in the list of valid values
177
+ * @example
178
+ * ```
179
+ * import { isOneOf } from '@arco-design/mobile-utils';
180
+ *
181
+ * const test = isOneOf(1, [1, 2, 3]);
182
+ * ```
183
+ */
184
+
123
185
  function isOneOf(value, validList) {
124
186
  return validList.indexOf(value) !== -1;
125
187
  }
188
+ /**
189
+ * 检查一个值是否为空值
190
+ * @desc {en} Check if a value is null
191
+ * @param {any} obj 入参
192
+ * @param {any} obj {en} Entering
193
+ * @returns {boolean} 返回该值是否为空值
194
+ * @returns {boolean} {en} Returns whether the value is null
195
+ * @example
196
+ * ```
197
+ * import { isEmptyValue } from '@arco-design/mobile-utils';
198
+ *
199
+ * const test = isEmptyValue(null);
200
+ * ```
201
+ */
202
+
126
203
  function isEmptyValue(obj) {
127
204
  return obj === undefined || obj === null || obj === '';
128
205
  }
206
+ /**
207
+ * 检查一个值是否为函数类型
208
+ * @desc {en} Check if a value is function
209
+ * @param {unknown} obj 入参
210
+ * @param {unknown} obj {en} Entering
211
+ * @returns {boolean} 返回该值是否为函数
212
+ * @returns {boolean} {en} Returns whether the value is function
213
+ * @example
214
+ * ```
215
+ * import { isFunction } from '@arco-design/mobile-utils';
216
+ *
217
+ * const test = isFunction(() => {});
218
+ * ```
219
+ */
220
+
129
221
  function isFunction(obj) {
130
222
  return Object.prototype.toString.call(obj).toLowerCase() === '[object function]';
131
223
  }
224
+ /**
225
+ * 检查一个值是否为空数组
226
+ * @desc {en} Check if a value is an empty array
227
+ * @param {Array<unknown>} obj 入参
228
+ * @param {Array<unknown>} obj {en} Entering
229
+ * @returns {boolean} 返回该值是否为空数组
230
+ * @returns {boolean} {en} Returns whether the value is an empty array
231
+ * @example
232
+ * ```
233
+ * import { isEmptyArray } from '@arco-design/mobile-utils';
234
+ *
235
+ * const test = isEmptyArray([]);
236
+ * ```
237
+ */
238
+
132
239
  function isEmptyArray(obj) {
133
240
  return isArray(obj) && !(obj === null || obj === void 0 ? void 0 : obj.length);
134
241
  }
242
+ /**
243
+ * 深比较两个对象是否相等
244
+ * @desc {en} Check if a value is an empty array
245
+ * @param {any} obj 要比较的第一个对象
246
+ * @param {any} obj {en} the first object to compare
247
+ * @param {any} obj 要比较的第二个对象
248
+ * @param {any} obj {en} the second object to be compared
249
+ * @returns {boolean} 返回两个对象是否相等
250
+ * @returns {boolean} {en} Returns whether two objects are equal
251
+ * @example
252
+ * ```
253
+ * import { isDeepEqual } from '@arco-design/mobile-utils';
254
+ *
255
+ * const test = isDeepEqual({a: 1}, {a: 1});
256
+ * ```
257
+ */
258
+
135
259
  function isDeepEqual(obj, sub) {
136
260
  if (typeof obj !== 'object' || typeof sub !== 'object' || obj === null || sub === null) {
137
261
  return obj === sub;
@@ -152,6 +276,23 @@
152
276
  return true;
153
277
  }
154
278
 
279
+ /**
280
+ * @type utils
281
+ * @name classnames
282
+ */
283
+ /**
284
+ * 将传入的值转为class字符串
285
+ * @param args 字符串,字符串数组,对象,undefined,null,boolean
286
+ * @param args {en} string, string[], object, undefined, null, boolean
287
+ * @returns class字符串
288
+ * @returns {en} class string
289
+ * @example
290
+ * import { cls } from '@arco-design/mobile-utils';
291
+ *
292
+ * <div className={cls('a', 'b', { ok: true })} />
293
+ * // result: <div class="a b ok"></div>
294
+ */
295
+
155
296
  function cls () {
156
297
  var args = [];
157
298
 
@@ -263,6 +404,33 @@
263
404
  function LinearEasing(x) {
264
405
  return x;
265
406
  }
407
+ /**
408
+ * 获取一个用于计算贝塞尔曲线的函数
409
+ * @desc {en} Gets a function used to calculate Bezier curves
410
+ * @param mX1 第一个点的x坐标
411
+ * @param mX1 {en} The X coordinate of first point
412
+ * @param mY1 第一个点的y坐标
413
+ * @param mY1 {en} The Y coordinate of first point
414
+ * @param mX2 第二个点的x坐标
415
+ * @param mX2 {en} The X coordinate of second point
416
+ * @param mY2 第二个点的y坐标
417
+ * @param mY2 {en} The Y coordinate of second point
418
+ * @returns 计算贝塞尔曲线的函数
419
+ * @returns {function} {en} The function of calculating bezier curve
420
+ * @example
421
+ * ```
422
+ * import { bezierEasing } from '@arco-design/mobile-utils';
423
+ *
424
+ * const p = (Date.now() - start) / duration;
425
+ * if (p > 1) {
426
+ * scrollTo(targetTop);
427
+ * } else {
428
+ * const newTop = initTop + (targetTop - initTop) * bezierEasing(0.34, 0.69, 0.1, 1)(p);
429
+ * scrollTo(newTop);
430
+ * }
431
+ * ```
432
+ */
433
+
266
434
 
267
435
  function bezier(mX1, mY1, mX2, mY2) {
268
436
  if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
@@ -316,9 +484,63 @@
316
484
  };
317
485
  }
318
486
 
487
+ /**
488
+ * 阻止 TouchEvent 事件的默认行为
489
+ * @desc {en} Stops the default behavior of a TouchEvent
490
+ * @param {TouchEvent} e 要阻止的 TouchEvent 事件
491
+ * @param {TouchEvent} e {en} The TouchEvent to stop
492
+ * @returns {void}
493
+ * @example
494
+ * ```
495
+ * import { stopTouch } from '@arco-design/mobile-utils';
496
+ *
497
+ * // Before calling stopTouch
498
+ * const touchEvent = new TouchEvent("touchstart", { cancelable: true });
499
+ * console.log(touchEvent.defaultPrevented); // false
500
+ *
501
+ * // Call stopTouch to prevent the default behavior
502
+ * stopTouch(touchEvent);
503
+ *
504
+ * // After calling stopTouch
505
+ * console.log(touchEvent.defaultPrevented); // true
506
+ * ```
507
+ */
508
+
319
509
  function stopTouch(e) {
510
+ // If the TouchEvent is cancelable, prevent it's default behavior using preventDefault
320
511
  e.cancelable && e.preventDefault();
321
512
  }
513
+ /**
514
+ * 阻止元素滚动
515
+ * @desc {en} Prevents an element from scrolling
516
+ * @param scrollContainer 滚动容器的函数,默认为 document.body
517
+ * @param scrollContainer {en} A function that returns the scroll container, defaults to document.body
518
+ * @param preventWindow 是否阻止窗口滚动
519
+ * @param preventWindow {en} Whether to prevent window scrolling
520
+ * @param customStopTouch 自定义停止触摸事件的函数
521
+ * @param customStopTouch {en} A custom function to stop touch events
522
+ * @example
523
+ * ```
524
+ * import { preventEleScroll } from '@arco-design/mobile-utils';
525
+ *
526
+ * // Example 1: Prevent scrolling in the entire document body
527
+ * preventEleScroll();
528
+ *
529
+ * // Example 2: Prevent scrolling in a specific element
530
+ * preventEleScroll(() => document.getElementById('myScrollableElement'));
531
+ *
532
+ * // Example 3: Prevent scrolling in a specific element with custom touch event handling
533
+ * preventEleScroll(
534
+ * () => document.getElementById('myScrollableElement'),
535
+ * false,
536
+ * (e) => {
537
+ * // Custom touch event handling logic here
538
+ * e.preventDefault();
539
+ * }
540
+ * );
541
+ * ```
542
+ */
543
+
322
544
  function preventEleScroll(scrollContainer, preventWindow, customStopTouch) {
323
545
  if (scrollContainer === void 0) {
324
546
  scrollContainer = function scrollContainer() {
@@ -340,6 +562,37 @@
340
562
  capture: true
341
563
  });
342
564
  }
565
+ /**
566
+ * 允许元素滚动
567
+ * @desc {en} Allows an element to scroll
568
+ * @param scrollContainer 滚动容器的函数,默认为 document.body
569
+ * @param scrollContainer {en} A function that returns the scroll container, defaults to document.body
570
+ * @param preventWindow 是否阻止窗口滚动
571
+ * @param preventWindow {en} Whether to prevent window scrolling
572
+ * @param customStopTouch 自定义停止触摸事件的函数
573
+ * @param customStopTouch {en} A custom function to stop touch events
574
+ * @example
575
+ * ```
576
+ * import { freeEleScroll } from '@arco-design/mobile-utils';
577
+ *
578
+ * // Example 1: Allow scrolling in the entire document body
579
+ * freeEleScroll();
580
+ *
581
+ * // Example 2: Allow scrolling in a specific element
582
+ * freeEleScroll(() => document.getElementById('myScrollableElement'));
583
+ *
584
+ * // Example 3: Allow scrolling in a specific element with custom touch event handling
585
+ * freeEleScroll(
586
+ * () => document.getElementById('myScrollableElement'),
587
+ * false,
588
+ * (e) => {
589
+ * // Custom touch event handling logic here
590
+ * // You can choose to call e.preventDefault() or not based on your needs
591
+ * }
592
+ * );
593
+ * ```
594
+ */
595
+
343
596
  function freeEleScroll(scrollContainer, preventWindow, customStopTouch) {
344
597
  if (scrollContainer === void 0) {
345
598
  scrollContainer = function scrollContainer() {
@@ -362,9 +615,38 @@
362
615
  }
363
616
  /**
364
617
  * 判断父节点是否包含子节点
365
- * @desc {en} comfirm parentNode contains children nodes
366
- * @param parentEl 父节点
367
- * @param childrenEl 子节点
618
+ * @desc {en} confirm parentNode contains children nodes
619
+ * @param {HTMLElement | null} parentEl 父节点
620
+ * @param {HTMLElement | null} parentEl {en} The parent element
621
+ * @param {HTMLElement | null} childrenEl 子节点
622
+ * @param {HTMLElement | null} childrenEl {en} The child element
623
+ * @returns {boolean} 是否包含子节点
624
+ * @returns {boolean} {en} Whether the parent contains the child
625
+ * @example
626
+ * ```
627
+ * import { isContains } from '@arco-design/mobile-utils';
628
+ *
629
+ * // Example 1: When the parent contains the direct child
630
+ * const parentElement = document.getElementById('parent');
631
+ * const childElement = document.getElementById('directChild');
632
+ * const result1 = isContains(parentElement, childElement);
633
+ * console.log(result1); // Output: true
634
+ * // Explanation: In this example, the parent element (#parent) contains a direct child element (#directChild).
635
+ *
636
+ * // Example 2: When the parent contains an indirect child
637
+ * const grandparentElement = document.getElementById('grandparent');
638
+ * const indirectChildElement = document.getElementById('indirectChild');
639
+ * const result2 = isContains(grandparentElement, indirectChildElement);
640
+ * console.log(result2); // Output: true
641
+ * // Explanation: Here, the grandparent element (#grandparent) contains an indirect child element (#indirectChild) nested within other elements.
642
+ *
643
+ * // Example 3: When the parent does not contain the child
644
+ * const unrelatedParent = document.getElementById('unrelatedParent');
645
+ * const unrelatedChild = document.getElementById('unrelatedChild');
646
+ * const result3 = isContains(unrelatedParent, unrelatedChild);
647
+ * console.log(result3); // Output: false
648
+ * // Explanation: In this case, the unrelated parent element (#unrelatedParent) and unrelated child element (#unrelatedChild) are not related in the DOM structure.
649
+ * ```
368
650
  */
369
651
 
370
652
  function isContains(parentEl, childrenEl) {
@@ -386,13 +668,79 @@
386
668
 
387
669
  return false;
388
670
  }
671
+ /**
672
+ * 使用 requestAnimationFrame 执行函数,如果不支持则使用 setTimeout 作为兜底
673
+ * @desc {en} Executes a function using requestAnimationFrame, if not supported, falls back to setTimeout
674
+ * @param {Function} fn 需要执行的函数
675
+ * @param {Function} fn {en} the function to be executed
676
+ * @returns {number} 返回 requestAnimationFrame 或 setTimeout 的 ID
677
+ * @returns {number} {en} returns the ID of requestAnimationFrame or setTimeout
678
+ * @example
679
+ * ```
680
+ * import { execRAF } from '@arco-design/mobile-utils';
681
+ *
682
+ * // Example 1: Using requestAnimationFrame
683
+ * const rafId = execRAF(() => {
684
+ * console.log("Using requestAnimationFrame");
685
+ * });
686
+ * console.log(rafId); // Output: A numerical ID representing the requestAnimationFrame callback
687
+ * // Explanation:
688
+ * // This example demonstrates using `execRAF` with `requestAnimationFrame` to execute a function.
689
+ * // `requestAnimationFrame` is typically used for animations and smooth updates.
690
+ * // The ID returned by `requestAnimationFrame` is logged, which can be useful for canceling the animation frame if needed.
691
+ *
692
+ * // Example 2: Using setTimeout as a fallback
693
+ * const setTimeoutId = execRAF(() => {
694
+ * console.log("Using setTimeout as a fallback");
695
+ * });
696
+ * console.log(setTimeoutId); // Output: A numerical ID representing the setTimeout callback
697
+ * // Explanation:
698
+ * // In situations where the browser does not support `requestAnimationFrame`,
699
+ * // `execRAF` falls back to using `setTimeout` with a delay of approximately 17 milliseconds (equivalent to a frame rate of 60 frames per second).
700
+ * // The ID returned by `setTimeout` is logged, allowing you to manage the execution of the function, even in browsers without `requestAnimationFrame` support.
701
+ * ```
702
+ */
703
+
389
704
  function execRAF(fn) {
390
705
  try {
391
706
  return requestAnimationFrame(fn);
392
707
  } catch (e) {
708
+ // Note that the delay time for setTimeout is 17 milliseconds, which is approximately equivalent to a frame rate of 60 frames per second.
709
+ // This is a good fallback option because requestAnimationFrame also typically runs at a rate of about 60 frames per second.
393
710
  return setTimeout(fn, 17);
394
711
  }
395
712
  }
713
+ /**
714
+ * 使用动画滚动页面
715
+ * @desc {en} Scroll the page with animation
716
+ * @param {number} initTop 初始滚动位置(像素)
717
+ * @param {number} initTop {en} Initial scroll position (in pixels)
718
+ * @param {number} target 目标滚动位置(像素)
719
+ * @param {number} target {en} Target scroll position (in pixels)
720
+ * @param {function} scrollTo 滚动函数
721
+ * @param {function} scrollTo {en} Scroll function
722
+ * @param {number} duration 动画持续时间(毫秒)
723
+ * @param {number} duration {en} Animation duration (in milliseconds)
724
+ * @param {Array<number>} bezier 贝塞尔曲线参数
725
+ * @param {Array<number>} bezier {en} Bezier curve parameters
726
+ * @param {'by'|'to'} type 滚动类型:'by'表示相对滚动,'to'表示绝对滚动
727
+ * @param {'by'|'to'} type {en} Scroll type: 'by' for relative scrolling, 'to' for absolute scrolling
728
+ * @example
729
+ * ```
730
+ * import { scrollWithAnimation } from '@arco-design/mobile-utils';
731
+ *
732
+ * // Scroll to 500px from the current position over 1 second
733
+ * scrollWithAnimation(
734
+ * window.pageYOffset,
735
+ * 500,
736
+ * (top) => window.scrollTo({ top }),
737
+ * 1000,
738
+ * [0.34, 0.69, 0.1, 1],
739
+ * 'to'
740
+ * );
741
+ * ```
742
+ */
743
+
396
744
  function scrollWithAnimation(initTop, target, scrollTo, duration, bezier$1, type) {
397
745
  if (duration === void 0) {
398
746
  duration = 300;
@@ -428,6 +776,26 @@
428
776
  * @desc {en} Returns the node's document properties
429
777
  * @param {HTMLElement} node dom 节点
430
778
  * @param {HTMLElement} node {en} dom Node
779
+ * @returns {HTMLElement | Document | null} 返回节点的最近可滚动父节点或 document 对象
780
+ * @returns {HTMLElement | Document | null} {en} Returns the nearest scrollable parent node of the node or the document object
781
+ * @example
782
+ * ```
783
+ * import { scrollParent } from '@arco-design/mobile-utils';
784
+ *
785
+ * // Example 1: Finding the scroll parent of a DOM node
786
+ * const targetNode = document.getElementById('targetElement');
787
+ * const scrollParentNode = scrollParent(targetNode);
788
+ * console.log(scrollParentNode); // Output: The nearest scrollable parent element or the document
789
+ * // Explanation:
790
+ * // This example demonstrates how to use the `scrollParent` function to find the nearest scrollable parent element of a given DOM node.
791
+ * // It returns the nearest scrollable parent element, or if none is found, it returns the document.
792
+ *
793
+ * // Example 2: Finding the scroll parent of the document body
794
+ * const bodyNode = document.body;
795
+ * const scrollParentBody = scrollParent(bodyNode);
796
+ * console.log(scrollParentBody); // Output: The document's HTML element (document.documentElement)
797
+ * // Explanation: In this scenario, we use the `scrollParent` function to find the scrollable parent of the document body.
798
+ * ```
431
799
  */
432
800
 
433
801
  function scrollParent(node) {
@@ -464,6 +832,17 @@
464
832
  * @desc {en} Get element offset
465
833
  * @param {HTMLElement} node dom 节点
466
834
  * @param {HTMLElement} node {en} Dom node
835
+ * @example
836
+ * ```
837
+ * import { getOffset } from '@arco-design/mobile-utils';
838
+ *
839
+ * const element = document.getElementById('exampleElement');
840
+ * const offset = getOffset(element);
841
+ * console.log('Element Width:', offset.width);
842
+ * console.log('Element Height:', offset.height);
843
+ * console.log('Element Top Offset:', offset.top);
844
+ * console.log('Element Left Offset:', offset.left);
845
+ * ```
467
846
  */
468
847
 
469
848
  function getOffset(node) {
@@ -492,6 +871,22 @@
492
871
  left: left
493
872
  };
494
873
  }
874
+ /**
875
+ * 格式化偏移量
876
+ * Format the offset
877
+ * @param {Array|number} offset 输入的偏移量,可以是一个数字或者一个长度为2或4的数组
878
+ * @param {Array|number} offset {en} The input offset, which can be a number or an array of length 2 or 4
879
+ * @returns {Array} 返回一个长度为4的数组,表示上、右、下、左四个方向的偏移量
880
+ * @returns {Array} {en} Returns an array of length 4, representing the offsets in the top, right, bottom, and left directions
881
+ * @example
882
+ * ```
883
+ * import { formatOffset } from '@arco-design/mobile-utils';
884
+ *
885
+ * console.log(formatOffset(10)) // output: [10, 10, 10, 10]
886
+ * console.log(formatOffset([10, 20])) // output: [10, 0, 20, 0]
887
+ * console.log(formatOffset([10, 20, 30, 40])) // output: [10, 20, 30, 40]
888
+ * ```
889
+ */
495
890
 
496
891
  function formatOffset(offset) {
497
892
  var offsets;
@@ -515,6 +910,18 @@
515
910
  * @param component {en} Current element node
516
911
  * @param parent 当前元素所在容器 dom 节点
517
912
  * @param parent {en} The dom node of the container where the current element is located
913
+ * @example
914
+ * ```
915
+ * import { checkOverflowVisible } from '@arco-design/mobile-utils';
916
+ *
917
+ * const component = {
918
+ * node: document.getElementById('myComponent'),
919
+ * offset: 20, // Set the offset value
920
+ * threshold: 0.5, // Set the threshold value
921
+ * }
922
+ * const myParent = document.getElementById('myParent');
923
+ * const isVisible = checkOverflowVisible(component, myParent);
924
+ * ```
518
925
  */
519
926
 
520
927
 
@@ -552,8 +959,30 @@
552
959
  /**
553
960
  * 检查非局部滚动容器元素是否在视口区域内
554
961
  * @desc {en} Check if a non-local scroll container element is inside the viewport area
555
- * @param component 当前元素节节点
962
+ * @param component 当前元素节点
556
963
  * @param component {en} Current element node
964
+ * @returns {boolean} 如果元素可见,则返回 true,否则返回 false。
965
+ * @returns {boolean} {en} Returns true if the element is visible, otherwise returns false.
966
+ * @example
967
+ * ```
968
+ * import { checkNormalVisible } from '@arco-design/mobile-utils';
969
+ *
970
+ * // Example usage:
971
+ * const element = document.getElementById('myElement');
972
+ *
973
+ * // Make sure to set the offset and threshold values to actual values that suit your use case.
974
+ * const isVisible = checkNormalVisible({
975
+ * node: element,
976
+ * offset: 20, // Set the offset value
977
+ * threshold: 0.5, // Set the threshold value
978
+ * });
979
+ *
980
+ * if (isVisible) {
981
+ * console.log('The element is in the viewport area');
982
+ * } else {
983
+ * console.log('The element is not in the viewport area');
984
+ * }
985
+ * ```
557
986
  */
558
987
 
559
988
  function checkNormalVisible(component) {
@@ -589,6 +1018,17 @@
589
1018
  * @param id {en} added dom id
590
1019
  * @param getContainer 被添加元素的父级
591
1020
  * @param getContainer {en} The parent of the added element
1021
+ * @example
1022
+ * ```
1023
+ * import { appendElementById } from '@arco-design/mobile-utils';
1024
+ *
1025
+ * // Example 1: Add a div element with the id "myDiv" to the body.
1026
+ * const { child, container } = appendElementById("myDiv");
1027
+ *
1028
+ * // Example 2: Add a div element with the id "customDiv" to a specific container.
1029
+ * const customContainer = document.getElementById("customContainer");
1030
+ * const { child, container } = appendElementById("customDiv", () => customContainer);
1031
+ * ```
592
1032
  */
593
1033
 
594
1034
  function appendElementById(id, getContainer) {
@@ -602,10 +1042,19 @@
602
1042
  };
603
1043
  }
604
1044
  /**
605
- * 从父级节点移除元素
1045
+ * 从父级节点移除该元素
606
1046
  * @desc {en} Remove element from parent node
607
1047
  * @param ele 待移除元素
608
1048
  * @param ele {en} Element to be removed
1049
+ * @example
1050
+ * ```
1051
+ * import { removeElement } from '@arco-design/mobile-utils';
1052
+ *
1053
+ * // HTML: <div id="myElement">This is a div</div>
1054
+ * const elementToRemove = document.getElementById('myElement');
1055
+ * // The element with ID 'myElement' will be removed from the DOM
1056
+ * removeElement(elementToRemove);
1057
+ * ```
609
1058
  */
610
1059
 
611
1060
  function removeElement(ele) {
@@ -613,10 +1062,37 @@
613
1062
  ele.parentNode.removeChild(ele);
614
1063
  }
615
1064
  }
1065
+ /**
1066
+ * 获取滚动容器,如果传入 string 则使用 querySelector 选取容器
1067
+ * @desc {en} Get the scrolling container. If a string is passed in, use querySelector to select the container
1068
+ * @param getContainer 指定滚动容器
1069
+ * @param getContainer {en} Specifies the scrolling container.
1070
+ * @example
1071
+ * ```
1072
+ * import { getActualContainer } from '@arco-design/mobile-utils';
1073
+ *
1074
+ * const customContainer = document.getElementById("customContainer");
1075
+ * const actualContainer = getActualContainer(() => customContainer);
1076
+ * ```
1077
+ */
1078
+
616
1079
  function getActualContainer(getContainer) {
617
1080
  var container = getContainer ? getContainer() : void 0;
618
1081
  return typeof container === 'string' ? document.querySelector(container) : container;
619
1082
  }
1083
+ /**
1084
+ * 获取有效滚动监听容器,默认情况或者监听 body 的滚动时均指定为 window
1085
+ * @desc {en} Get the effective scrolling container, which is specified as window by default or for listening to the scrolling of the body
1086
+ * @param getContainer 指定滚动容器
1087
+ * @param getContainer {en} Specifies the scrolling container.
1088
+ * @example
1089
+ * ```
1090
+ * import { getValidScrollContainer } from '@arco-design/mobile-utils';
1091
+ *
1092
+ * const customContainer = document.getElementById("customContainer");
1093
+ * const validScrollContainer = getValidScrollContainer(() => customContainer);
1094
+ */
1095
+
620
1096
  function getValidScrollContainer(getContainer) {
621
1097
  // 默认为window
622
1098
  // @en Default is window
@@ -625,6 +1101,22 @@
625
1101
 
626
1102
  return originContainer === document.body ? window : originContainer;
627
1103
  }
1104
+ /**
1105
+ * 获取滚动容器的属性。针对 window 和 document 额外进行一些属性兼容处理。
1106
+ * @desc {en} Get properties of the scrolling container. Perform additional attribute compatibility processing for window and document.
1107
+ * @param property 所需属性
1108
+ * @param property {en} Required attributes
1109
+ * @param getContainer 待计算滚动容器
1110
+ * @param getContainer {en} Scrolling container to be calculated.
1111
+ * @example
1112
+ * ```
1113
+ * import { getScrollContainerAttribute } from '@arco-design/mobile-utils';
1114
+ *
1115
+ * const contentRef = useRef<HTMLDivElement>(null);
1116
+ * const scrollTop = getScrollContainerAttribute('scrollTop', () => contentRef.current);
1117
+ * ```
1118
+ */
1119
+
628
1120
  function getScrollContainerAttribute(property, getContainer) {
629
1121
  var container = getContainer ? getContainer() : window;
630
1122
  if (!container) return 0;
@@ -652,6 +1144,20 @@
652
1144
 
653
1145
  return container[property];
654
1146
  }
1147
+ /**
1148
+ * 提供了元素的大小及其相对于视口的位置。
1149
+ * @desc {en} Provide information about the size of an element and its position relative to the viewport.
1150
+ * @param container 滚动容器
1151
+ * @param container {en} Scroll Container
1152
+ * @example
1153
+ * ```
1154
+ * import { getScrollContainerAttribute } from '@arco-design/mobile-utils';
1155
+ *
1156
+ * const contentRef = useRef<HTMLDivElement>(null);
1157
+ * const scrollTop = getScrollContainerAttribute('scrollTop', () => contentRef.current);
1158
+ * ```
1159
+ */
1160
+
655
1161
  function getScrollContainerRect(container) {
656
1162
  var containerRect = {
657
1163
  top: 0,
@@ -689,6 +1195,19 @@
689
1195
  };
690
1196
  }
691
1197
  var styleDoms = {};
1198
+ /**
1199
+ * 删除自定义 style 标签,配合 addCssStyleDom 函数一起使用
1200
+ * @desc {en} Remove custom style tags and use it in conjunction with the addCssStyleDom function
1201
+ * @param key 标签对应的key
1202
+ * @param key {en} Key corresponding to the tag
1203
+ * @example
1204
+ * ```
1205
+ * import { removeCssStyleDom } from '@arco-design/mobile-utils';
1206
+ *
1207
+ * removeCssStyleDom('arcoTheme');
1208
+ * ```
1209
+ */
1210
+
692
1211
  function removeCssStyleDom(key) {
693
1212
  var styleDom = styleDoms[key];
694
1213
 
@@ -697,6 +1216,21 @@
697
1216
  delete styleDoms[key];
698
1217
  }
699
1218
  }
1219
+ /**
1220
+ * 添加自定义 style 标签,addCssKeyframes 和 addCssRules 的底层方法
1221
+ * @desc {en} Add custom style tags, underlying methods for addCssKeyframes and addCssRules
1222
+ * @param key 标签对应的key
1223
+ * @param key {en} Key corresponding to the tag
1224
+ * @param html 样式内容
1225
+ * @param html {en} style information (CSS)
1226
+ * @example
1227
+ * ```
1228
+ * import { addCssStyleDom } from '@arco-design/mobile-utils';
1229
+ *
1230
+ * addCssStyleDom('arcoTheme', ':root {--base-font-size: 50;}');
1231
+ * ```
1232
+ */
1233
+
700
1234
  function addCssStyleDom(key, html) {
701
1235
  removeCssStyleDom(key);
702
1236
  var style = document.createElement('style');
@@ -704,9 +1238,53 @@
704
1238
  document.documentElement.appendChild(style);
705
1239
  styleDoms[key] = style;
706
1240
  }
1241
+ /**
1242
+ * 增加自定义关键帧动画变量,实现动画函数复用。
1243
+ * @desc {en} Add custom keyframe animation variables to achieve reuse of animation functions
1244
+ * @param key 规则名称
1245
+ * @param key {en} Rule Name
1246
+ * @param rules 动画关键帧
1247
+ * @param rules {en} Animation keyframes
1248
+ * @example
1249
+ * ```
1250
+ * import { addCssKeyframes } from '@arco-design/mobile-utils';
1251
+ *
1252
+ * const maxScaleWithDefault = 2;
1253
+ addCssKeyframes(
1254
+ 'animationKey',
1255
+ `{
1256
+ 0% {
1257
+ width: 100%;
1258
+ }
1259
+ 50% {
1260
+ width: ${100 * maxScaleWithDefault}%;
1261
+ }
1262
+ 100% {
1263
+ width: 100%;
1264
+ }
1265
+ }`,
1266
+ );
1267
+ * ```
1268
+ */
1269
+
707
1270
  function addCssKeyframes(key, rules) {
708
1271
  addCssStyleDom(key, "@keyframes " + key + " " + rules + "\n@-webkit-keyframes " + key + " " + rules);
709
1272
  }
1273
+ /**
1274
+ * 增加自定义 CSS 变量规则,使用后将在线替换css变量。需设置less变量 @use-css-vars: 1
1275
+ * @desc {en} Add custom CSS variable rules, which will replace CSS variables online after use.The less variable needs to be set @use-css-vars: 1.
1276
+ * @param key 规则名称
1277
+ * @param key {en} Rule Name
1278
+ * @param rules 规则对象
1279
+ * @param rules {en} Rule Object
1280
+ * @example
1281
+ * ```
1282
+ * import { addCssRules } from '@arco-design/mobile-utils';
1283
+ *
1284
+ * addCssRules('arcoTheme', { 'base-font-size': '50' });
1285
+ * ```
1286
+ */
1287
+
710
1288
  function addCssRules(key, rules) {
711
1289
  if (!rules || !Object.keys(rules).length) {
712
1290
  return;
@@ -716,6 +1294,22 @@
716
1294
  return "--" + rule + ": " + rules[rule] + ";";
717
1295
  }).join('\n') + "}");
718
1296
  }
1297
+ /**
1298
+ * 获取元素的时间属性值,结果统一成毫秒级别
1299
+ * @desc {en} Get the time attribute value of the element, and the results are unified into milliseconds
1300
+ * @param ele 要获取样式的元素
1301
+ * @param ele {en} Element to get the computed style
1302
+ * @param property 与时间相关属性
1303
+ * @param property {en} Property related to time
1304
+ * @example
1305
+ * ```
1306
+ * import { convertCssDuration } from '@arco-design/mobile-utils';
1307
+ *
1308
+ * const contentRef = useRef<HTMLDivElement>(null);
1309
+ * const transTimeout = convertCssDuration(contentRef.current, 'transitionDuration');
1310
+ * ```
1311
+ */
1312
+
719
1313
  function convertCssDuration(ele, property) {
720
1314
  var timeout = window.getComputedStyle(ele)[property];
721
1315
 
@@ -729,6 +1323,20 @@
729
1323
 
730
1324
  return 0;
731
1325
  }
1326
+ /**
1327
+ * 获取指定元素的 CSS 样式,当抛出异常时返回空对象
1328
+ * @desc {en} Get the CSS style of the specified element and return an empty object when an exception is thrown
1329
+ * @param element 要获取样式的元素
1330
+ * @param element {en} Element to get the computed style
1331
+ * @example
1332
+ * ```
1333
+ * import { safeGetComputedStyle } from '@arco-design/mobile-utils';
1334
+ *
1335
+ * const element = document.querySelector("p");
1336
+ * const compStyle =safeGetComputedStyle(element);
1337
+ * ```
1338
+ */
1339
+
732
1340
  function safeGetComputedStyle(element) {
733
1341
  try {
734
1342
  return window.getComputedStyle(element);
@@ -760,6 +1368,10 @@
760
1368
  return Comp;
761
1369
  }
762
1370
 
1371
+ /**
1372
+ * @type utils
1373
+ * @name color
1374
+ */
763
1375
  var w3cx11 = {
764
1376
  aliceblue: '#f0f8ff',
765
1377
  antiquewhite: '#faebd7',
@@ -917,6 +1529,21 @@
917
1529
  yellow: '#ffff00',
918
1530
  yellowgreen: '#9acd32'
919
1531
  };
1532
+ /**
1533
+ * 获取任意颜色的透明色
1534
+ * @desc {en} Get any transparent color
1535
+ * @param color 颜色
1536
+ * @param color {en} color
1537
+ * @returns transparent color
1538
+ * @example
1539
+ * ```
1540
+ * import { fadeColor } from '@arco-design/mobile-utils';
1541
+ *
1542
+ * const transparentColor = fadeColor('#ffffff');
1543
+ * // transparentColor is '#ffffff00'
1544
+ * ```
1545
+ */
1546
+
920
1547
  function fadeColor(color) {
921
1548
  if (!color) {
922
1549
  return '';
@@ -937,6 +1564,27 @@
937
1564
  return '';
938
1565
  }
939
1566
 
1567
+ /**
1568
+ * 获取当前设备的操作系统
1569
+ * @desc {en} Get the operating system of the current device
1570
+ * @returns {string} 返回当前设备的操作系统,可能的值包括 'android'、'ios' 或 'pc',如果无法获取,则返回空字符串
1571
+ * @returns {string} {en} Returns the operating system of the current device, possible values are 'android', 'ios', or 'pc'. Returns an empty string if it cannot be obtained
1572
+ * @example
1573
+ * ```
1574
+ * import { getSystem } from '@arco-design/mobile-utils';
1575
+ *
1576
+ * const systemInfo = getSystem();
1577
+ * if (systemInfo === 'android') {
1578
+ * console.log('You are using the Android operating system');
1579
+ * } else if (systemInfo === 'ios') {
1580
+ * console.log('You are using the iOS operating system');
1581
+ * } else if (systemInfo === 'pc') {
1582
+ * console.log('You are using a desktop PC operating system');
1583
+ * } else {
1584
+ * console.log('Unable to detect your operating system');
1585
+ * }
1586
+ * ```
1587
+ */
940
1588
  function getSystem() {
941
1589
  try {
942
1590
  var u = navigator.userAgent;
@@ -949,6 +1597,21 @@
949
1597
  return '';
950
1598
  }
951
1599
  }
1600
+ /**
1601
+ * 检查是否在 SSR 环境
1602
+ * @desc {en} Check if in ssr environment
1603
+ * @example
1604
+ * ```
1605
+ * import { isSSR } from '@arco-design/mobile-utils';
1606
+ *
1607
+ * if (isSSR()) {
1608
+ * console.log("It is currently in the ssr stage");
1609
+ * } else {
1610
+ * console.log("It is currently in the csr stage");
1611
+ * }
1612
+ * ```
1613
+ */
1614
+
952
1615
  function isSSR() {
953
1616
  return typeof window === 'undefined';
954
1617
  }
@@ -2974,6 +3637,25 @@
2974
3637
  * @type utils
2975
3638
  * @name utils
2976
3639
  */
3640
+ /**
3641
+ * 基于给定的过滤函数返回一个过滤后的数组
3642
+ * @desc {en} Returns a filtered array based on the given filter function
3643
+ * @param {T[]} data 数据数组
3644
+ * @param {T[]} data {en} data array
3645
+ * @param {Function} filterFn 过滤函数
3646
+ * @param {Function} filterFn {en} filter function
3647
+ * @param {Object} options 可选对象
3648
+ * @param {Object} options {en} Optional object
3649
+ * @return {string} 过滤后的数组
3650
+ * @return {string} filtered array
3651
+ * @example
3652
+ * ```
3653
+ * import { arrayTreeFilter } from '@arco-design/mobile-utils';
3654
+ *
3655
+ * const test = arrayTreeFilter(data, (item: any, level: number) => level <= index && item.value === value[level]);
3656
+ * ```
3657
+ */
3658
+
2977
3659
  function arrayTreeFilter(data, filterFn, options) {
2978
3660
  options = options || {};
2979
3661
  options.childrenKeyName = options.childrenKeyName || 'children';
@@ -3002,8 +3684,16 @@
3002
3684
  return result;
3003
3685
  }
3004
3686
  /**
3005
- * 历史逻辑问题,轻喷 _(:з」∠)_
3006
- * @desc {en} Please ignore this weird function _(:з」∠)_
3687
+ * 在下一个事件循环周期执行给定的函数
3688
+ * @desc {en} Execute the given function on the next event loop cycle
3689
+ * @param {Function} func 执行的函数
3690
+ * @param {Function} func {en} function executed
3691
+ * @example
3692
+ * ```
3693
+ * import { nextTick } from '@arco-design/mobile-utils';
3694
+ *
3695
+ * nextTick(() => { updateLayoutData(); });
3696
+ * ```
3007
3697
  */
3008
3698
 
3009
3699
  function nextTick(func) {
@@ -3014,6 +3704,18 @@
3014
3704
  * @desc {en} To simulate the sliding damping effect, use the function x = X/(aX+b), where x is the element displacement, X is the sliding distance, and a and b are custom parameters obtained by setting the corresponding relationship between the two targets
3015
3705
  * 例如目标X=500时x=100, X=200时x=60,可得a,b
3016
3706
  * @desc {en} For example, when the target X=500, x=100, when X=200, x=60, you can get a,b
3707
+ * @param {number} x 元素位移
3708
+ * @param {number} x {en} element displacement
3709
+ * @param {[number, number] | number} damping 阻尼参数
3710
+ * @param {[number, number] | number} damping {en} Damping parameters
3711
+ * @return {number} 返回需要滑动的距离
3712
+ * @return {number} {en} Return the distance required to slide
3713
+ * @example
3714
+ * ```
3715
+ * import { fingerDisToLabelDis } from '@arco-design/mobile-utils';
3716
+ *
3717
+ * const test = fingerDisToLabelDis(1000, 0.01);
3718
+ * ```
3017
3719
  */
3018
3720
 
3019
3721
  function fingerDisToLabelDis(x, damping) {
@@ -3028,11 +3730,12 @@
3028
3730
  return x / (a * x + b);
3029
3731
  }
3030
3732
 
3733
+ var DEFAULT_DARK_MODE_SELECTOR = 'arco-theme-dark';
3031
3734
  var defaultContext = {
3032
3735
  prefixCls: 'arco',
3033
3736
  system: '',
3034
3737
  useDarkMode: false,
3035
- isDarkMode: false,
3738
+ darkModeSelector: DEFAULT_DARK_MODE_SELECTOR,
3036
3739
  locale: defaultLocale,
3037
3740
  useRtl: false
3038
3741
  };
@@ -3049,25 +3752,57 @@
3049
3752
  function ContextProvider(props) {
3050
3753
  var children = props.children,
3051
3754
  useDarkMode = props.useDarkMode,
3052
- isDarkMode = props.isDarkMode,
3755
+ userSetIsDarkMode = props.isDarkMode,
3756
+ _a = props.darkModeSelector,
3757
+ darkModeSelector = _a === void 0 ? DEFAULT_DARK_MODE_SELECTOR : _a,
3053
3758
  theme = props.theme,
3054
- _a = props.locale,
3055
- locale = _a === void 0 ? defaultLocale : _a,
3056
- restProps = __rest$1(props, ["children", "useDarkMode", "isDarkMode", "theme", "locale"]);
3759
+ _b = props.locale,
3760
+ locale = _b === void 0 ? defaultLocale : _b,
3761
+ onDarkModeChange = props.onDarkModeChange,
3762
+ restProps = __rest$1(props, ["children", "useDarkMode", "isDarkMode", "darkModeSelector", "theme", "locale", "onDarkModeChange"]);
3057
3763
 
3058
- var _b = React.useState(),
3059
- isDarkModeState = _b[0],
3060
- setIsDarkModeState = _b[1];
3764
+ var _c = React.useState(function () {
3765
+ if (typeof window !== 'undefined' && useDarkMode) {
3766
+ return window.matchMedia('(prefers-color-scheme: dark)').matches;
3767
+ }
3061
3768
 
3769
+ return false;
3770
+ }),
3771
+ isDarkModeState = _c[0],
3772
+ setIsDarkModeState = _c[1];
3773
+
3774
+ var setDarkModeState = function setDarkModeState(isDark) {
3775
+ setIsDarkModeState(isDark);
3776
+ onDarkModeChange && onDarkModeChange(isDark);
3777
+ };
3778
+
3779
+ var isDarkMode = React.useMemo(function () {
3780
+ // 如果未开启暗黑模式则不对body做操作
3781
+ // @en If dark mode is not turned on, no operation will be performed on the body
3782
+ if (userSetIsDarkMode === void 0 && !useDarkMode) {
3783
+ return false;
3784
+ }
3785
+
3786
+ var value = Boolean(userSetIsDarkMode !== void 0 ? userSetIsDarkMode : isDarkModeState);
3787
+ var needUpdateBody = darkModeSelector && typeof document !== 'undefined';
3788
+
3789
+ if (value) {
3790
+ needUpdateBody && document.body.classList.add(darkModeSelector);
3791
+ } else {
3792
+ needUpdateBody && document.body.classList.remove(darkModeSelector);
3793
+ }
3794
+
3795
+ return value;
3796
+ }, [userSetIsDarkMode, isDarkModeState, darkModeSelector, useDarkMode]);
3062
3797
  var changeDarkMode = React.useCallback(function (res) {
3063
- return setIsDarkModeState(res.matches);
3798
+ return setDarkModeState(res.matches);
3064
3799
  }, []);
3065
3800
  React.useEffect(function () {
3066
3801
  var matchMedia = window.matchMedia('(prefers-color-scheme: dark)');
3067
3802
 
3068
3803
  if (useDarkMode) {
3069
3804
  var dark = matchMedia.matches;
3070
- setIsDarkModeState(dark);
3805
+ setDarkModeState(dark);
3071
3806
 
3072
3807
  if (typeof matchMedia.addEventListener === 'function') {
3073
3808
  matchMedia.addEventListener('change', changeDarkMode);
@@ -3098,7 +3833,7 @@
3098
3833
  }, [theme]);
3099
3834
  return /*#__PURE__*/React__default["default"].createElement(GlobalContext.Provider, {
3100
3835
  value: __assign$2(__assign$2(__assign$2({}, defaultContext), restProps), {
3101
- isDarkMode: isDarkMode === void 0 ? isDarkModeState : isDarkMode,
3836
+ isDarkMode: isDarkMode,
3102
3837
  useDarkMode: useDarkMode,
3103
3838
  locale: locale || defaultLocale
3104
3839
  })
@@ -3116,6 +3851,23 @@
3116
3851
  };
3117
3852
  }
3118
3853
 
3854
+ /**
3855
+ * 监听页面resize事件的统一封装
3856
+ * @desc {en} Unified encapsulation for monitoring page resize events
3857
+ * @param resizeHandler resize事件回调
3858
+ * @param resizeHandler {en} Resize event callback
3859
+ * @param deps 触发事件绑定更新的依赖
3860
+ * @param deps {en} Dependencies that trigger event binding updates
3861
+ * @param needListen 是否开启事件监听,默认开启
3862
+ * @param needListen {en} Whether to enable event monitoring
3863
+ * @example
3864
+ * ```
3865
+ * import { useListenResize } from '@arco-design/mobile-react/esm/_helpers/hooks';
3866
+ *
3867
+ * useListenResize(setSize, [], listenResize);
3868
+ * ```
3869
+ */
3870
+
3119
3871
  function useListenResize(resizeHandler, deps, needListen) {
3120
3872
  if (deps === void 0) {
3121
3873
  deps = [];
@@ -3126,15 +3878,16 @@
3126
3878
  }
3127
3879
 
3128
3880
  React.useEffect(function () {
3129
- if (!needListen) {
3130
- return function () {};
3881
+ if (needListen) {
3882
+ window.addEventListener('resize', resizeHandler);
3883
+ window.addEventListener('orientationchange', resizeHandler);
3131
3884
  }
3132
3885
 
3133
- window.addEventListener('resize', resizeHandler);
3134
- window.addEventListener('orientationchange', resizeHandler);
3135
3886
  return function () {
3136
- window.removeEventListener('resize', resizeHandler);
3137
- window.removeEventListener('orientationchange', resizeHandler);
3887
+ if (needListen) {
3888
+ window.removeEventListener('resize', resizeHandler);
3889
+ window.removeEventListener('orientationchange', resizeHandler);
3890
+ }
3138
3891
  };
3139
3892
  }, __spreadArrays$1(deps, [needListen]));
3140
3893
  }
@@ -3145,6 +3898,7 @@
3145
3898
  * @desc {en} Tips: Use in scenarios where asynchronous processing is not completed after unmount. It is not recommended to replace useState without brains
3146
3899
  * @param initialState 初始状态
3147
3900
  * @param initialState {en} Initial State
3901
+ * @returns [state, setState],同useState返回值
3148
3902
  * @example
3149
3903
  * ```
3150
3904
  * import { useMountedState } from '@arco-design/mobile-react/esm/_helpers/hooks';
@@ -3174,6 +3928,20 @@
3174
3928
  var result = [state, setValidState];
3175
3929
  return result;
3176
3930
  }
3931
+ /**
3932
+ * 用useState管理状态,且在状态更新之前同步至ref,并返回ref
3933
+ * @desc {en} Use useState to manage the state, and synchronize to ref before the state is updated, and return ref
3934
+ * @param initialValue 初始状态
3935
+ * @param initialValue {en} Initial State
3936
+ * @returns [state, stateRef, setState]
3937
+ * @example
3938
+ * ```
3939
+ * import { useSameRefState } from '@arco-design/mobile-react/esm/_helpers/hooks';
3940
+ *
3941
+ * const [opened, openedRef, setOpened] = useSameRefState(false);
3942
+ * ```
3943
+ */
3944
+
3177
3945
  function useSameRefState(initialValue) {
3178
3946
  var _a = React.useState(initialValue),
3179
3947
  state = _a[0],
@@ -3188,6 +3956,20 @@
3188
3956
 
3189
3957
  return [state, stateRef, setStateProxy];
3190
3958
  }
3959
+ /**
3960
+ * 用useState管理状态,且在状态更新后同步至ref,并返回ref
3961
+ * @desc {en} Use useState to manage the state, and synchronize to ref after the state is updated, and return ref
3962
+ * @param initialValue 初始状态
3963
+ * @param initialValue {en} Initial State
3964
+ * @returns [state, stateRef, setState]
3965
+ * @example
3966
+ * ```
3967
+ * import { useRefState } from '@arco-design/mobile-react/esm/_helpers/hooks';
3968
+ *
3969
+ * const [index, indexRef, setIndex] = useRefState(currentIndex);
3970
+ * ```
3971
+ */
3972
+
3191
3973
  function useRefState(initialValue) {
3192
3974
  var _a = React.useState(initialValue),
3193
3975
  state = _a[0],
@@ -3199,6 +3981,23 @@
3199
3981
  }, [state]);
3200
3982
  return [state, stateRef, setState];
3201
3983
  }
3984
+ /**
3985
+ * useEffect特殊封装,仅在非首次依赖更新时触发回调
3986
+ * @desc {en} Special encapsulation of useEffect, which only triggers the callback when the dependency is not updated for the first time
3987
+ * @param effect useEffect回调
3988
+ * @param effect {en} useEffect callback
3989
+ * @param dependencies useEffect依赖
3990
+ * @param dependencies {en} useEffect dependencies
3991
+ * @example
3992
+ * ```
3993
+ * import { useUpdateEffect } from '@arco-design/mobile-react/esm/_helpers/hooks';
3994
+ *
3995
+ * useUpdateEffect(() => {
3996
+ * handleIndexChange(index);
3997
+ * }, [index]);
3998
+ * ```
3999
+ */
4000
+
3202
4001
  function useUpdateEffect(effect, dependencies) {
3203
4002
  if (dependencies === void 0) {
3204
4003
  dependencies = [];
@@ -3213,6 +4012,21 @@
3213
4012
  }
3214
4013
  }, dependencies);
3215
4014
  }
4015
+ /**
4016
+ * 获取任意变量的最新ref值(用于监听属性、方法等非state变量)
4017
+ * @desc {en} Get the latest ref value of any variable (used to monitor non-state variables such as properties and methods)
4018
+ * @param variable 待获取最新值的变量
4019
+ * @param variable {en} Variable to get latest value
4020
+ * @returns variableRef,变量的最新ref值
4021
+ * @example
4022
+ * ```
4023
+ * import { useLatestRef } from '@arco-design/mobile-react/esm/_helpers/hooks';
4024
+ *
4025
+ * const { wrapSize } = props;
4026
+ * const wrapSizeRef = useLatestRef(wrapSize);
4027
+ * ```
4028
+ */
4029
+
3216
4030
  function useLatestRef(variable) {
3217
4031
  var variableRef = React.useRef(variable);
3218
4032
  React.useEffect(function () {
@@ -3220,6 +4034,18 @@
3220
4034
  }, [variable]);
3221
4035
  return variableRef;
3222
4036
  }
4037
+ /**
4038
+ * 从navigator.userAgent中获取当前操作系统,如果无法获取ua,则从ContextProvider传入的system中获取值
4039
+ * @desc {en} Get the current operating system from navigator.userAgent, if ua cannot be obtained, get the value from the system passed in by ContextProvider
4040
+ * @returns system 操作系统,"" | "pc" | "android" | "ios"
4041
+ * @example
4042
+ * ```
4043
+ * import { useSystem } from '@arco-design/mobile-react/esm/_helpers/hooks';
4044
+ *
4045
+ * const system = useSystem();
4046
+ * ```
4047
+ */
4048
+
3223
4049
  function useSystem() {
3224
4050
  var currentSystem = React.useContext(GlobalContext).system;
3225
4051
 
@@ -3234,12 +4060,26 @@
3234
4060
  }, [currentSystem]);
3235
4061
  return system;
3236
4062
  }
4063
+ /**
4064
+ * 获取页面视口宽高大小,并在页面有resize时更新大小
4065
+ * @desc {en} Get the width and height of the page viewport, and update the size when the page is resized
4066
+ * @param needListen 是否开启resize事件监听
4067
+ * @param needListen {en} Whether to enable resize event monitoring
4068
+ * @returns 页面宽高,{ windowWidth, windowHeight }
4069
+ * @example
4070
+ * ```
4071
+ * import { useWindowSize } from '@arco-design/mobile-react/esm/_helpers/hooks';
4072
+ *
4073
+ * const { windowHeight, windowWidth } = useWindowSize();
4074
+ * ```
4075
+ */
4076
+
3237
4077
  function useWindowSize(listenResize) {
3238
- var _a = React.useState(0),
4078
+ var _a = React.useState(typeof window !== 'undefined' ? window.innerWidth : 0),
3239
4079
  windowWidth = _a[0],
3240
4080
  setWindowWidth = _a[1];
3241
4081
 
3242
- var _b = React.useState(0),
4082
+ var _b = React.useState(typeof window !== 'undefined' ? window.innerHeight : 0),
3243
4083
  windowHeight = _b[0],
3244
4084
  setWindowHeight = _b[1];
3245
4085
 
@@ -3257,7 +4097,30 @@
3257
4097
  windowHeight: windowHeight
3258
4098
  };
3259
4099
  }
3260
- /* eslint-disable max-lines-per-function */
4100
+ /**
4101
+ * 弹窗中滚动统一处理,防止滚动穿透
4102
+ * @desc {en} Unified processing of scrolling in pop-up windows to prevent scrolling penetration
4103
+ * @param visible 弹窗是否被打开
4104
+ * @param visible {en} Whether the popup is opened
4105
+ * @param popupDom 弹窗的dom元素
4106
+ * @param popupDom {en} DOM element of the popup
4107
+ * @param getScrollContainer 弹窗中的滚动容器,可传入多个
4108
+ * @param getScrollContainer {en} The scrolling container in the popup, which can pass in multiple
4109
+ * @param orientationDirection 弹窗内容朝向,默认为top(从上到下),用于实现模拟横屏
4110
+ * @param orientationDirection {en} The content orientation of the popup, the default is top (from top to bottom), which is used to simulate a horizontal screen
4111
+ * @param preventCallback 在滚动穿透被阻止(preventDefault被触发)时的回调
4112
+ * @param preventCallback {en} Callback when scrolling is blocked (preventDefault is triggered)
4113
+ * @param onTouchMove touchmove 自定义事件
4114
+ * @param onTouchMove {en} Touchmove custom event
4115
+ * @param gestureOutOfControl 是否禁用滚动穿透处理
4116
+ * @param gestureOutOfControl {en} Whether to disable scroll through processing
4117
+ * @example
4118
+ * ```
4119
+ * import { usePopupScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
4120
+ *
4121
+ * usePopupScroll(visible, domRef.current, getScrollContainer, orientationDirection, onPreventTouchMove, onTouchMove, gestureOutOfControl);
4122
+ * ```
4123
+ */
3261
4124
 
3262
4125
  function usePopupScroll(visible, popupDom, getScrollContainer, orientationDirection, preventCallback, onTouchMove, gestureOutOfControl) {
3263
4126
  if (orientationDirection === void 0) {
@@ -3442,6 +4305,19 @@
3442
4305
  };
3443
4306
  }, [visible, popupDom, handleTouchStart, handleTouchMove]);
3444
4307
  }
4308
+ /**
4309
+ * 在滑动类组件中,如果有内部可滚动区域,则在内部滚动区域滚动时禁用滑动事件
4310
+ * @desc {en} In the sliding class component, if there is an inner scrollable area, the sliding event is disabled when the inner scrolling area is scrolled
4311
+ * @param getInnerScrollContainer 内部可滚动区域,可传入多个
4312
+ * @param getInnerScrollContainer {en} Inner scrollable area, can pass in multiple
4313
+ * @example
4314
+ * ```
4315
+ * import { useSwiperInnerScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
4316
+ *
4317
+ * useSwiperInnerScroll(getInnerScrollContainer);
4318
+ * ```
4319
+ */
4320
+
3445
4321
  function useSwiperInnerScroll(getInnerScrollContainer) {
3446
4322
  var stopFunc = React.useCallback(function (e) {
3447
4323
  return e.stopPropagation();
@@ -3469,6 +4345,26 @@
3469
4345
  };
3470
4346
  }, [getInnerScrollContainer]);
3471
4347
  }
4348
+ /**
4349
+ * 事件绑定统一封装
4350
+ * @desc {en} Unified encapsulation of event binding
4351
+ * @param dom 待绑定事件的dom元素
4352
+ * @param dom {en} The dom element to be bound to the event
4353
+ * @param event 待绑定事件名称
4354
+ * @param event {en} The name of the event to be bound
4355
+ * @param handler 待绑定事件回调
4356
+ * @param handler {en} The callback of the event to be bound
4357
+ * @param options 待绑定事件配置,默认为 { capture: true }
4358
+ * @param options {en} Event configuration to be bound, the default is { capture: true }
4359
+ * @example
4360
+ * ```
4361
+ * import { useAddListener } from '@arco-design/mobile-react/esm/_helpers/hooks';
4362
+ *
4363
+ * useAddListener(domRef.current, 'touchstart', onTouchStart);
4364
+ * useAddListener(domRef.current, 'touchend', onTouchEnd);
4365
+ * ```
4366
+ */
4367
+
3472
4368
  function useAddListener(dom, event, handler, options) {
3473
4369
  if (options === void 0) {
3474
4370
  options = {
@@ -3497,9 +4393,30 @@
3497
4393
 
3498
4394
  var arcoFullScreenCount = 0;
3499
4395
  var arcoFullScreenOriginOverflow = '';
4396
+ /**
4397
+ * 在全屏组件出现时,将body的overflow设置为hidden,防止滚动穿透
4398
+ * @desc {en} When the full screen component appears, set the overflow of the body to hidden to prevent scrolling penetration
4399
+ * @param visible 全屏组件是否被打开
4400
+ * @param visible {en} Whether the full screen component is opened
4401
+ * @param preventBodyScroll 是否启用防滚动穿透,默认启用
4402
+ * @param preventBodyScroll {en} Whether to enable anti-scroll penetration, enabled by default
4403
+ * @param initialBodyOverflow body在初始状态下的overflow值,在全屏组件全部关闭后会还原
4404
+ * @param initialBodyOverflow {en} The overflow value of the body in the initial state, which will be restored after all full-screen components are closed
4405
+ * @example
4406
+ * ```
4407
+ * import { usePreventBodyScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
4408
+ *
4409
+ * usePreventBodyScroll(visible, preventBodyScroll, initialBodyOverflow);
4410
+ * ```
4411
+ */
4412
+
3500
4413
  function usePreventBodyScroll(visible, preventBodyScroll, initialBodyOverflow) {
3501
- // 新出现一个全屏组件则计数+1,并设置body hidden样式
4414
+ if (preventBodyScroll === void 0) {
4415
+ preventBodyScroll = true;
4416
+ } // 新出现一个全屏组件则计数+1,并设置body hidden样式
3502
4417
  // @en When a new full-screen component appears, count + 1 and set the body hidden style
4418
+
4419
+
3503
4420
  var addFullScreen = React.useCallback(function () {
3504
4421
  var count = arcoFullScreenCount; // 在当前没有全屏组件出现时,记下body overflow的初始值
3505
4422
  // @en Note the initial value of body overflow when no full-screen components are currently present
@@ -3544,6 +4461,18 @@
3544
4461
  };
3545
4462
  }, [visible]);
3546
4463
  }
4464
+ /**
4465
+ * 进度条计算公共逻辑,根据传入的参数计算出当前百分比和过渡效果开关,进度类组件内部使用
4466
+ * @desc {en} Progress bar calculation common logic, used internally by the progress class component
4467
+ * @returns [当前计算的百分比, 当前是否应有过渡效果]
4468
+ * @example
4469
+ * ```
4470
+ * import { usePreventBodyScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
4471
+ *
4472
+ * const [currentPercentage, transitionControl] = useProgress(mountedTransition, percentage, duration, mountedBezier, step);
4473
+ * ```
4474
+ */
4475
+
3547
4476
  function useProgress(mountedTransition, percentage, duration, mountedBezier, step) {
3548
4477
  var _a = React.useState(0),
3549
4478
  currentPercentage = _a[0],
@@ -3579,6 +4508,24 @@
3579
4508
  }, [count, percentage, step]);
3580
4509
  return [currentPercentage, transitionControl];
3581
4510
  }
4511
+ /**
4512
+ * 单击和双击事件统一处理
4513
+ * @desc {en} Unified processing of single and double click events
4514
+ * @param onClick 单击事件回调
4515
+ * @param onClick {en} Callback of single click event
4516
+ * @param onDoubleClick 双击事件回调
4517
+ * @param onDoubleClick {en} Callback of double click event
4518
+ * @param delay 两次点击被判定为双击事件的最大间隔时间
4519
+ * @param delay {en} The maximum interval between two clicks is judged as a double-click event
4520
+ * @returns clickHandler,统一后的事件处理方法
4521
+ * @example
4522
+ * ```
4523
+ * import { useSingleAndDoubleClick } from '@arco-design/mobile-react/esm/_helpers/hooks';
4524
+ *
4525
+ * const handleClick = useSingleAndDoubleClick(handleImageClick, handleImageDoubleClick);
4526
+ * ```
4527
+ */
4528
+
3582
4529
  function useSingleAndDoubleClick(onClick, onDoubleClick, delay) {
3583
4530
  if (delay === void 0) {
3584
4531
  delay = 200;
@@ -3607,6 +4554,24 @@
3607
4554
  };
3608
4555
  }
3609
4556
  var arcoSvgKeyCount = 0;
4557
+ /**
4558
+ * 自动生成svg <def>标签的唯一标识,用于区分不同svg的<def>内容
4559
+ * @desc {en} Automatically generate the unique identifier of the svg <def> tag, which is used to distinguish the <def> content of different svg
4560
+ * @param userSetSvgKey 自定义唯一标识,传入则覆盖自动生成的值
4561
+ * @param userSetSvgKey {en} Customize the unique identifier, if passed in, it will override the automatically generated value
4562
+ * @returns 包含svgKey的对象 生成后的唯一标识
4563
+ * @globalVariable
4564
+ * ```
4565
+ * let arcoSvgKeyCount = 0;
4566
+ * ```
4567
+ * @example
4568
+ * ```
4569
+ * import { useGenSvgKey } from '@arco-design/mobile-react/esm/_helpers/hooks';
4570
+ *
4571
+ * const { svgKey } = useGenSvgKey(userSetSvgKey);
4572
+ * ```
4573
+ */
4574
+
3610
4575
  function useGenSvgKey(userSetSvgKey) {
3611
4576
  var _a = React.useState(''),
3612
4577
  innerSvgKey = _a[0],
@@ -3680,6 +4645,38 @@
3680
4645
 
3681
4646
  var render = copyRender;
3682
4647
 
4648
+ /**
4649
+ * 获取带浏览器前缀的样式
4650
+ * @desc {en} Get style with browser vendor prefix
4651
+ * @param {CSSProperties} style 原始样式
4652
+ * @param {CSSProperties} style {en} Original style
4653
+ * @returns {CSSProperties} newStyle 添加了浏览器前缀的新样式
4654
+ * @returns {CSSProperties} newStyle {en} New style with browser vendor prefix
4655
+ * @example
4656
+ * ```
4657
+ * import { getStyleWithVendor } from '@arco-design/mobile-react/esm/_helpers';
4658
+ *
4659
+ * // Example usage:
4660
+ * const originalStyle = {
4661
+ * transform: 'translateX(50px)',
4662
+ * transition: 'all 0.3s ease',
4663
+ * opacity: 0.8,
4664
+ * };
4665
+ *
4666
+ * const styleWithPrefix = getStyleWithVendor(originalStyle);
4667
+ *
4668
+ * // Result:
4669
+ * // styleWithPrefix will be:
4670
+ * // {
4671
+ * // transform: 'translateX(50px)',
4672
+ * // WebkitTransform: 'translateX(50px)', // Browser-specific prefix added
4673
+ * // transition: 'all 0.3s ease',
4674
+ * // WebkitTransition: 'all 0.3s ease', // Browser-specific prefix added
4675
+ * // opacity: 0.8,
4676
+ * // }
4677
+ * ```
4678
+ */
4679
+
3683
4680
  function getStyleWithVendor(style) {
3684
4681
  var allowReg = /(transform|transition|animation)/i;
3685
4682
  var newStyle = Object.keys(style).reduce(function (acc, key) {
@@ -3692,6 +4689,37 @@
3692
4689
  }, {});
3693
4690
  return newStyle;
3694
4691
  }
4692
+ /**
4693
+ * 给元素设置带浏览器前缀的样式
4694
+ * @desc {en} Set element style with browser vendor prefix
4695
+ * @param {HTMLElement} dom 需要设置样式的元素
4696
+ * @param {HTMLElement} dom {en} Element to set style
4697
+ * @param {CSSProperties} style Original style
4698
+ * @param {CSSProperties} style {en} Original style
4699
+ * @returns {void}
4700
+ * @example
4701
+ * ```
4702
+ * import { setStyleWithVendor } from '@arco-design/mobile-utils';
4703
+ *
4704
+ * // Example: Setting and displaying styles with the Webkit browser vendor prefix
4705
+ * const element = document.getElementById('myElement');
4706
+ * const originalStyle = {
4707
+ * transform: 'translateX(100px)',
4708
+ * transition: 'transform 0.5s ease',
4709
+ * borderRadius: '5px',
4710
+ * };
4711
+ *
4712
+ * // Set the styles with the Webkit browser vendor prefix
4713
+ * setStyleWithVendor(element, originalStyle);
4714
+ *
4715
+ * // Display the styles with the Webkit browser vendor prefixes applied
4716
+ * const computedStyle = getComputedStyle(element);
4717
+ * console.log(computedStyle.getPropertyValue('-webkit-transform')); // Output: The transformed style with the Webkit browser vendor prefix
4718
+ * console.log(computedStyle.getPropertyValue('-webkit-transition')); // Output: The transition style with the Webkit browser vendor prefix
4719
+ * console.log(computedStyle.getPropertyValue('border-radius')); // Output: The borderRadius style without a vendor prefix
4720
+ * ```
4721
+ */
4722
+
3695
4723
  function setStyleWithVendor(dom, style) {
3696
4724
  var vendorStyle = getStyleWithVendor(style);
3697
4725
 
@@ -3702,6 +4730,22 @@
3702
4730
  /**
3703
4731
  * 计算默认值,仅未定义时使用默认值
3704
4732
  * @desc {en} Calculate the default value, use default value only if undefined
4733
+ * @param {T | undefined} value 输入的值
4734
+ * @param {T | undefined} value {en} The input value
4735
+ * @param {T} defaultValue 默认值
4736
+ * @param {T} defaultValue {en} The default value
4737
+ * @returns {T} 如果输入的值是未定义的,那么返回默认值,否则返回输入的值
4738
+ * @returns {T} {en} Returns the default value if the input is undefined, otherwise returns the input value
4739
+ * @example
4740
+ * ```
4741
+ * import { getDefaultValue } from '@arco-design/mobile-react/esm/_helpers';
4742
+ *
4743
+ * const result = getDefaultValue(42, 0);
4744
+ * console.log(result); // Output: 42
4745
+ *
4746
+ * const result2 = getDefaultValue(undefined, 100);
4747
+ * console.log(result2); // Output: 100
4748
+ * ```
3705
4749
  */
3706
4750
 
3707
4751
  var getDefaultValue = function getDefaultValue(value, defaultValue) {
@@ -4310,7 +5354,7 @@
4310
5354
  fixed: tabBarFixed
4311
5355
  }, {
4312
5356
  'has-divider': hasDivider
4313
- }),
5357
+ }, system),
4314
5358
  style: typeof tabBarFixed === 'object' ? tabBarFixed : {}
4315
5359
  }, /*#__PURE__*/React__default["default"].createElement("div", {
4316
5360
  className: cls(prefix + "-container", tabDirection, "pos-" + tabBarPosition, "arrange-" + (originArrange || tabBarArrange), "type-" + type, {
@@ -5311,7 +6355,10 @@
5311
6355
  // 利用受控手动更改index时,给cell line加上动画
5312
6356
  // @en Animate the cell line when changeing the index
5313
6357
  setCellTrans(true);
5314
- changeFromRef.current = 'manual';
6358
+
6359
+ if (!changeFromRef.current) {
6360
+ changeFromRef.current = 'manual';
6361
+ }
5315
6362
  }, [activeTab]);
5316
6363
  useUpdateEffect(function () {
5317
6364
  onDistanceChange && onDistanceChange(distance, wrapWidth, activeIndex);
@@ -7306,9 +8353,7 @@
7306
8353
  }, normalize(config)), {
7307
8354
  visible: false,
7308
8355
  close: function close() {}
7309
- });
7310
-
7311
- var dynamicProps = __assign$2({}, baseProps); // 不同的key用不同的容器挂载
8356
+ }); // 不同的key用不同的容器挂载
7312
8357
 
7313
8358
 
7314
8359
  var id = "_" + (containerId || 'ARCO_MASKING') + "_DIV_" + (config.key || '') + "_";
@@ -7316,6 +8361,12 @@
7316
8361
  var leaving = false;
7317
8362
  var render = new ReactDOMRender(Component, div, context).render;
7318
8363
 
8364
+ var dynamicProps = __assign$2(__assign$2({}, baseProps), {
8365
+ getContainer: function getContainer() {
8366
+ return div;
8367
+ }
8368
+ });
8369
+
7319
8370
  function update(newConfig) {
7320
8371
  dynamicProps = __assign$2(__assign$2({}, dynamicProps), normalize(newConfig));
7321
8372
  render(dynamicProps);
@@ -7736,69 +8787,69 @@
7736
8787
  */
7737
8788
 
7738
8789
  var BaseImage = /*#__PURE__*/React.forwardRef(function (props, ref) {
7739
- var system = useSystem();
7740
-
7741
- var _a = useWindowSize(),
7742
- windowWidth = _a.windowWidth,
7743
- windowHeight = _a.windowHeight;
7744
-
7745
- var _b = useMountedState('init'),
7746
- imageStatus = _b[0],
7747
- setImageStatus = _b[1];
7748
-
7749
- var _c = useMountedState(''),
7750
- wrapClass = _c[0],
7751
- setWrapClass = _c[1];
7752
-
7753
- var _d = useMountedState(false),
7754
- staticRetrying = _d[0],
7755
- setStaticRetrying = _d[1];
7756
-
7757
- var imageRef = React.useRef(null);
7758
- var imageDomRef = React.useRef(null);
7759
- var wrapRef = React.useRef(null);
7760
- var retryCountRef = React.useRef(0);
7761
- var loadingImageRef = React.useRef(null);
7762
- var hasLoadedRef = React.useRef(false);
7763
8790
  var style = props.style,
7764
8791
  className = props.className,
7765
8792
  status = props.status,
7766
8793
  src = props.src,
7767
8794
  width = props.width,
7768
8795
  height = props.height,
7769
- _e = props.alt,
7770
- alt = _e === void 0 ? '' : _e,
7771
- _f = props.fit,
7772
- fit = _f === void 0 ? 'cover' : _f,
7773
- _g = props.position,
7774
- position = _g === void 0 ? 'center' : _g,
8796
+ _a = props.alt,
8797
+ alt = _a === void 0 ? '' : _a,
8798
+ _b = props.fit,
8799
+ fit = _b === void 0 ? 'cover' : _b,
8800
+ _c = props.position,
8801
+ position = _c === void 0 ? 'center' : _c,
7775
8802
  radius = props.radius,
7776
8803
  bordered = props.bordered,
7777
8804
  loadingArea = props.loadingArea,
7778
8805
  errorArea = props.errorArea,
7779
8806
  showLoading = props.showLoading,
7780
8807
  showError = props.showError,
7781
- _h = props.animateDuration,
7782
- animateDuration = _h === void 0 ? 200 : _h,
7783
- _j = props.retryTime,
7784
- retryTime = _j === void 0 ? 0 : _j,
8808
+ _d = props.animateDuration,
8809
+ animateDuration = _d === void 0 ? 200 : _d,
8810
+ _e = props.retryTime,
8811
+ retryTime = _e === void 0 ? 0 : _e,
7785
8812
  forceHttps = props.forceHttps,
7786
- _k = props.boxWidth,
7787
- boxWidth = _k === void 0 ? 0 : _k,
7788
- _l = props.boxHeight,
7789
- boxHeight = _l === void 0 ? 0 : _l,
8813
+ _f = props.boxWidth,
8814
+ boxWidth = _f === void 0 ? 0 : _f,
8815
+ _g = props.boxHeight,
8816
+ boxHeight = _g === void 0 ? 0 : _g,
7790
8817
  topOverlap = props.topOverlap,
7791
8818
  bottomOverlap = props.bottomOverlap,
7792
- _m = props.showImage,
7793
- showImage = _m === void 0 ? true : _m,
8819
+ _h = props.showImage,
8820
+ showImage = _h === void 0 ? true : _h,
7794
8821
  staticLabel = props.staticLabel,
7795
- _o = props.nativeProps,
7796
- nativeProps = _o === void 0 ? {} : _o,
8822
+ _j = props.nativeProps,
8823
+ nativeProps = _j === void 0 ? {} : _j,
7797
8824
  onChange = props.onChange,
7798
8825
  onClick = props.onClick,
7799
- _onLoad = props.onLoad,
8826
+ onLoad = props.onLoad,
7800
8827
  onError = props.onError,
7801
8828
  onAutoRetry = props.onAutoRetry;
8829
+ var system = useSystem();
8830
+
8831
+ var _k = useWindowSize(),
8832
+ windowWidth = _k.windowWidth,
8833
+ windowHeight = _k.windowHeight;
8834
+
8835
+ var _l = useMountedState(staticLabel && showLoading ? 'loading' : 'init'),
8836
+ imageStatus = _l[0],
8837
+ setImageStatus = _l[1];
8838
+
8839
+ var _m = useMountedState(''),
8840
+ wrapClass = _m[0],
8841
+ setWrapClass = _m[1];
8842
+
8843
+ var _o = useMountedState(false),
8844
+ staticRetrying = _o[0],
8845
+ setStaticRetrying = _o[1];
8846
+
8847
+ var imageRef = React.useRef(null);
8848
+ var imageDomRef = React.useRef(null);
8849
+ var wrapRef = React.useRef(null);
8850
+ var retryCountRef = React.useRef(0);
8851
+ var loadingImageRef = React.useRef(null);
8852
+ var hasLoadedRef = React.useRef(false);
7802
8853
  var isPreview = Boolean(fit.indexOf('preview') >= 0);
7803
8854
  var actualBoxWidth = boxWidth || windowWidth;
7804
8855
  var actualBoxHeight = boxHeight || windowHeight;
@@ -7834,6 +8885,21 @@
7834
8885
  retryCountRef.current = 0;
7835
8886
  loadImage();
7836
8887
  }, [attrs, width, height, showImage, staticLabel]);
8888
+ React.useEffect(function () {
8889
+ var _a; // 当使用img标签时,onLoad可能加载完成前已经执行完,此时手动触发一次
8890
+ // @en When using the img tag, onLoad may have been executed before loading is complete, and it needs to be triggered manually
8891
+
8892
+
8893
+ if (staticLabel && !hasLoadedRef.current && ((_a = imageDomRef.current) === null || _a === void 0 ? void 0 : _a.complete)) {
8894
+ // 图片有宽高认为正常加载,否则认为加载错误
8895
+ // @en If the image has width and height, it is considered to be loaded normally, otherwise it is considered to be a loading error
8896
+ if (imageDomRef.current.naturalWidth || imageDomRef.current.naturalHeight) {
8897
+ handleImageLoaded(null, imageDomRef.current);
8898
+ } else {
8899
+ handleStaticImageError(null);
8900
+ }
8901
+ }
8902
+ }, [staticLabel]);
7837
8903
 
7838
8904
  function changeStatus(newStatus) {
7839
8905
  setImageStatus(newStatus);
@@ -7854,6 +8920,43 @@
7854
8920
  }
7855
8921
  }
7856
8922
 
8923
+ function handleImageLoaded(evt, image) {
8924
+ hasLoadedRef.current = true;
8925
+ changeStatus('loaded');
8926
+ var _a = image.width,
8927
+ imageWidth = _a === void 0 ? 0 : _a,
8928
+ _b = image.height,
8929
+ imageHeight = _b === void 0 ? 0 : _b;
8930
+ var extraClass = '';
8931
+
8932
+ if (isPreview) {
8933
+ var scale = imageWidth / imageHeight;
8934
+ var windowScale = actualBoxWidth / actualBoxHeight;
8935
+
8936
+ if (fit === 'preview-y') {
8937
+ if (scale < windowScale) {
8938
+ image.style.width = actualBoxWidth + "px";
8939
+ image.style.height = actualBoxWidth / scale + "px";
8940
+ extraClass = 'preview-overflow-y';
8941
+ } else {
8942
+ extraClass = 'preview-fit-contain-y';
8943
+ }
8944
+ } else if (fit === 'preview-x') {
8945
+ if (scale > windowScale) {
8946
+ image.style.width = actualBoxHeight * scale + "px";
8947
+ image.style.height = actualBoxHeight + "px";
8948
+ extraClass = 'preview-overflow-x';
8949
+ } else {
8950
+ extraClass = 'preview-fit-contain-x';
8951
+ }
8952
+ }
8953
+ }
8954
+
8955
+ extraClass && image.classList.add(extraClass);
8956
+ setWrapClass(extraClass ? extraClass + "-container" : '');
8957
+ onLoad && onLoad(evt, image);
8958
+ }
8959
+
7857
8960
  function loadImage(isFromRetry) {
7858
8961
  // 如果在加载图片前发现上一个图片还没加载完,则抛弃上一个图片的加载
7859
8962
  // @en Abort last image before starting loading new image
@@ -7879,41 +8982,8 @@
7879
8982
  image.onload = function (evt) {
7880
8983
  loadingImageRef.current = null;
7881
8984
  imageDomRef.current = image;
7882
- hasLoadedRef.current = true;
7883
- changeStatus('loaded');
7884
- var _a = image.width,
7885
- imageWidth = _a === void 0 ? 0 : _a,
7886
- _b = image.height,
7887
- imageHeight = _b === void 0 ? 0 : _b;
7888
- var extraClass = '';
7889
-
7890
- if (isPreview) {
7891
- var scale = imageWidth / imageHeight;
7892
- var windowScale = actualBoxWidth / actualBoxHeight;
7893
-
7894
- if (fit === 'preview-y') {
7895
- if (scale < windowScale) {
7896
- image.style.width = actualBoxWidth + "px";
7897
- image.style.height = actualBoxWidth / scale + "px";
7898
- extraClass = 'preview-overflow-y';
7899
- } else {
7900
- extraClass = 'preview-fit-contain-y';
7901
- }
7902
- } else if (fit === 'preview-x') {
7903
- if (scale > windowScale) {
7904
- image.style.width = actualBoxHeight * scale + "px";
7905
- image.style.height = actualBoxHeight + "px";
7906
- extraClass = 'preview-overflow-x';
7907
- } else {
7908
- extraClass = 'preview-fit-contain-x';
7909
- }
7910
- }
7911
- }
7912
-
7913
- extraClass && image.classList.add(extraClass);
7914
- setWrapClass(extraClass ? extraClass + "-container" : '');
8985
+ handleImageLoaded(evt, image);
7915
8986
  replaceChild(image);
7916
- _onLoad && _onLoad(evt, image);
7917
8987
  };
7918
8988
 
7919
8989
  image.onerror = function (evt) {
@@ -7939,9 +9009,10 @@
7939
9009
  }
7940
9010
 
7941
9011
  function handleStaticImageError(e) {
7942
- var evt = e.nativeEvent;
9012
+ var evt = e ? e.nativeEvent : null;
7943
9013
 
7944
9014
  if (retryCountRef.current >= retryTime) {
9015
+ changeStatus('error');
7945
9016
  onError && onError(evt);
7946
9017
  } else {
7947
9018
  retryCountRef.current += 1;
@@ -8006,7 +9077,7 @@
8006
9077
  }, staticLabel && showImage && !staticRetrying ? /*#__PURE__*/React__default["default"].createElement("img", __assign$2({}, nativeProps, attrs, {
8007
9078
  ref: imageDomRef,
8008
9079
  onLoad: function onLoad(e) {
8009
- return _onLoad && _onLoad(e.nativeEvent, imageDomRef.current);
9080
+ return handleImageLoaded(e.nativeEvent, imageDomRef.current);
8010
9081
  },
8011
9082
  onError: handleStaticImageError
8012
9083
  })) : null), showLoading && validStatus === 'loading' ? /*#__PURE__*/React__default["default"].createElement("div", {
@@ -19596,9 +20667,7 @@
19596
20667
  unmountOnExit: true
19597
20668
  }, config || {}), {
19598
20669
  close: function close() {}
19599
- });
19600
-
19601
- var dynamicProps = __assign$2({}, baseProps); // 不同的key用不同的容器挂载
20670
+ }); // 不同的key用不同的容器挂载
19602
20671
  // @en Different keys are mounted in different containers
19603
20672
 
19604
20673
 
@@ -19607,6 +20676,12 @@
19607
20676
  var leaving = false;
19608
20677
  var render = new ReactDOMRender(Component, div, context).render;
19609
20678
 
20679
+ var dynamicProps = __assign$2(__assign$2({}, baseProps), {
20680
+ getContainer: function getContainer() {
20681
+ return div;
20682
+ }
20683
+ });
20684
+
19610
20685
  function update(newConfig) {
19611
20686
  dynamicProps = __assign$2(__assign$2({}, dynamicProps), newConfig || {});
19612
20687
  render(dynamicProps);
@@ -20444,7 +21519,9 @@
20444
21519
  return renderIndicator(currentIndex, total, lastIndex);
20445
21520
  }
20446
21521
 
20447
- return openLoaded ? /*#__PURE__*/React__default["default"].createElement(Portal, null, /*#__PURE__*/React__default["default"].createElement("div", {
21522
+ return openLoaded ? /*#__PURE__*/React__default["default"].createElement(Portal, {
21523
+ getContainer: getContainer
21524
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
20448
21525
  className: "image-preview-indicator"
20449
21526
  }, currentIndex + 1, "/", total)) : null;
20450
21527
  } // ios在重设style时图片会消失一下造成闪动,因此在底下垫一张图
@@ -20482,7 +21559,9 @@
20482
21559
  function renderLoadingArea(index) {
20483
21560
  // loadingArea提出来,放到过渡图上层
20484
21561
  // @en The loadingArea is extracted and placed on the upper layer of the transition image
20485
- return index === openIndex ? /*#__PURE__*/React__default["default"].createElement(Portal, null, /*#__PURE__*/React__default["default"].createElement("div", {
21562
+ return index === openIndex ? /*#__PURE__*/React__default["default"].createElement(Portal, {
21563
+ getContainer: getContainer
21564
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
20486
21565
  className: "image-preview-loading-area"
20487
21566
  }, loadingArea || /*#__PURE__*/React__default["default"].createElement(Loading, {
20488
21567
  type: "circle",