@arco-design/mobile-react 2.30.10 → 2.31.1

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 (331) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/action-sheet/style/css/index.css +50 -34
  5. package/cjs/avatar/style/css/index.css +50 -34
  6. package/cjs/badge/style/css/index.css +50 -34
  7. package/cjs/button/style/css/index.css +50 -34
  8. package/cjs/carousel/style/css/index.css +50 -34
  9. package/cjs/cell/style/css/index.css +50 -34
  10. package/cjs/cell/style/index.less +2 -2
  11. package/cjs/checkbox/style/css/index.css +50 -34
  12. package/cjs/circle-progress/style/css/index.css +50 -34
  13. package/cjs/collapse/style/css/index.css +50 -34
  14. package/cjs/count-down/style/css/index.css +50 -34
  15. package/cjs/date-picker/style/css/index.css +50 -34
  16. package/cjs/dialog/style/css/index.css +50 -34
  17. package/cjs/divider/style/css/index.css +50 -34
  18. package/cjs/dropdown/style/css/index.css +50 -34
  19. package/cjs/dropdown-menu/style/css/index.css +50 -34
  20. package/cjs/ellipsis/style/css/index.css +50 -34
  21. package/cjs/form/form-item.d.ts +3 -0
  22. package/cjs/form/form-item.js +38 -10
  23. package/cjs/form/style/css/index.css +63 -34
  24. package/cjs/form/style/index.less +18 -0
  25. package/cjs/grid/style/css/index.css +50 -34
  26. package/cjs/icon/IconCheck/index.js +1 -2
  27. package/cjs/icon/IconDownload/index.d.ts +7 -0
  28. package/cjs/icon/IconDownload/index.js +41 -0
  29. package/cjs/icon/IconFile/index.d.ts +7 -0
  30. package/cjs/icon/IconFile/index.js +41 -0
  31. package/cjs/icon/IconKeyboard/index.js +1 -0
  32. package/cjs/icon/IconQuestionCircle/index.js +1 -2
  33. package/cjs/icon/IconUpload/index.js +6 -4
  34. package/cjs/icon/IconUserFill/index.js +1 -2
  35. package/cjs/icon/index.d.ts +3 -1
  36. package/cjs/icon/index.js +17 -7
  37. package/cjs/icon/type.d.ts +3 -1
  38. package/cjs/image/style/css/index.css +50 -34
  39. package/cjs/image-picker/index.js +15 -161
  40. package/cjs/image-picker/style/css/index.css +50 -34
  41. package/cjs/image-picker/type.d.ts +4 -73
  42. package/cjs/image-preview/style/css/index.css +50 -34
  43. package/cjs/index-bar/style/css/index.css +50 -34
  44. package/cjs/index.d.ts +1 -0
  45. package/cjs/index.js +6 -2
  46. package/cjs/input/hooks.js +2 -2
  47. package/cjs/input/props.d.ts +2 -2
  48. package/cjs/input/style/css/index.css +50 -34
  49. package/cjs/keyboard/style/css/index.css +50 -34
  50. package/cjs/load-more/style/css/index.css +50 -34
  51. package/cjs/loading/style/css/index.css +50 -34
  52. package/cjs/masking/style/css/index.css +50 -34
  53. package/cjs/nav-bar/style/css/index.css +50 -34
  54. package/cjs/notice-bar/style/css/index.css +50 -34
  55. package/cjs/notice-bar/style/index.less +2 -2
  56. package/cjs/notify/style/css/index.css +50 -34
  57. package/cjs/pagination/style/css/index.css +50 -34
  58. package/cjs/pagination/style/index.less +4 -4
  59. package/cjs/picker/index.js +59 -19
  60. package/cjs/picker/style/css/index.css +50 -34
  61. package/cjs/picker/type.d.ts +6 -1
  62. package/cjs/picker-view/style/css/index.css +50 -34
  63. package/cjs/popover/style/css/index.css +50 -34
  64. package/cjs/popover/style/css/menu.css +50 -34
  65. package/cjs/popup/style/css/index.css +50 -34
  66. package/cjs/popup-swiper/style/css/index.css +50 -34
  67. package/cjs/progress/style/css/index.css +50 -34
  68. package/cjs/pull-refresh/style/css/index.css +50 -34
  69. package/cjs/radio/style/css/index.css +50 -34
  70. package/cjs/rate/style/css/index.css +50 -34
  71. package/cjs/rate/style/index.less +2 -2
  72. package/cjs/search-bar/style/css/index.css +50 -34
  73. package/cjs/skeleton/style/css/index.css +50 -34
  74. package/cjs/skeleton/style/index.less +2 -2
  75. package/cjs/slider/style/css/index.css +50 -34
  76. package/cjs/slider/style/index.less +6 -6
  77. package/cjs/stepper/style/css/index.css +50 -34
  78. package/cjs/steps/style/css/index.css +50 -34
  79. package/cjs/sticky/style/css/index.css +50 -34
  80. package/cjs/style.d.ts +1 -0
  81. package/cjs/style.js +3 -1
  82. package/cjs/swipe-action/style/css/index.css +50 -34
  83. package/cjs/swipe-load/style/css/index.css +50 -34
  84. package/cjs/switch/style/css/index.css +50 -34
  85. package/cjs/switch/style/index.less +8 -8
  86. package/cjs/tab-bar/style/css/index.css +50 -34
  87. package/cjs/tabs/style/css/index.css +50 -34
  88. package/cjs/tabs/tab-cell.js +1 -1
  89. package/cjs/tag/style/css/index.css +50 -34
  90. package/cjs/textarea/style/css/index.css +50 -34
  91. package/cjs/toast/style/css/index.css +50 -34
  92. package/cjs/transition/style/css/index.css +50 -34
  93. package/cjs/uploader/index.d.ts +16 -0
  94. package/cjs/uploader/index.js +180 -0
  95. package/cjs/uploader/style/css/index.css +666 -0
  96. package/cjs/uploader/style/css/index.d.ts +4 -0
  97. package/cjs/uploader/style/css/index.js +9 -0
  98. package/cjs/uploader/style/index.d.ts +4 -0
  99. package/cjs/uploader/style/index.js +9 -0
  100. package/cjs/uploader/style/index.less +161 -0
  101. package/cjs/uploader/type.d.ts +108 -0
  102. package/cjs/uploader/type.js +3 -0
  103. package/cjs/uploader/upload/index.d.ts +2 -0
  104. package/cjs/uploader/upload/index.js +19 -0
  105. package/cjs/uploader/upload/type.d.ts +107 -0
  106. package/cjs/uploader/upload/type.js +3 -0
  107. package/cjs/uploader/upload/upload.d.ts +20 -0
  108. package/cjs/uploader/upload/upload.js +189 -0
  109. package/dist/index.js +589 -273
  110. package/dist/index.min.js +5 -5
  111. package/dist/style.css +3811 -2306
  112. package/dist/style.min.css +1 -1
  113. package/esm/action-sheet/style/css/index.css +50 -34
  114. package/esm/avatar/style/css/index.css +50 -34
  115. package/esm/badge/style/css/index.css +50 -34
  116. package/esm/button/style/css/index.css +50 -34
  117. package/esm/carousel/style/css/index.css +50 -34
  118. package/esm/cell/style/css/index.css +50 -34
  119. package/esm/cell/style/index.less +2 -2
  120. package/esm/checkbox/style/css/index.css +50 -34
  121. package/esm/circle-progress/style/css/index.css +50 -34
  122. package/esm/collapse/style/css/index.css +50 -34
  123. package/esm/count-down/style/css/index.css +50 -34
  124. package/esm/date-picker/style/css/index.css +50 -34
  125. package/esm/dialog/style/css/index.css +50 -34
  126. package/esm/divider/style/css/index.css +50 -34
  127. package/esm/dropdown/style/css/index.css +50 -34
  128. package/esm/dropdown-menu/style/css/index.css +50 -34
  129. package/esm/ellipsis/style/css/index.css +50 -34
  130. package/esm/form/form-item.d.ts +3 -0
  131. package/esm/form/form-item.js +36 -10
  132. package/esm/form/style/css/index.css +63 -34
  133. package/esm/form/style/index.less +18 -0
  134. package/esm/grid/style/css/index.css +50 -34
  135. package/esm/icon/IconCheck/index.js +1 -2
  136. package/esm/icon/IconDownload/index.d.ts +7 -0
  137. package/esm/icon/IconDownload/index.js +30 -0
  138. package/esm/icon/IconFile/index.d.ts +7 -0
  139. package/esm/icon/IconFile/index.js +30 -0
  140. package/esm/icon/IconKeyboard/index.js +1 -0
  141. package/esm/icon/IconQuestionCircle/index.js +1 -2
  142. package/esm/icon/IconUpload/index.js +6 -4
  143. package/esm/icon/IconUserFill/index.js +1 -2
  144. package/esm/icon/index.d.ts +3 -1
  145. package/esm/icon/index.js +3 -1
  146. package/esm/icon/type.d.ts +3 -1
  147. package/esm/image/style/css/index.css +50 -34
  148. package/esm/image-picker/index.js +14 -160
  149. package/esm/image-picker/style/css/index.css +50 -34
  150. package/esm/image-picker/type.d.ts +4 -73
  151. package/esm/image-preview/style/css/index.css +50 -34
  152. package/esm/index-bar/style/css/index.css +50 -34
  153. package/esm/index.d.ts +1 -0
  154. package/esm/index.js +2 -1
  155. package/esm/input/hooks.js +2 -2
  156. package/esm/input/props.d.ts +2 -2
  157. package/esm/input/style/css/index.css +50 -34
  158. package/esm/keyboard/style/css/index.css +50 -34
  159. package/esm/load-more/style/css/index.css +50 -34
  160. package/esm/loading/style/css/index.css +50 -34
  161. package/esm/masking/style/css/index.css +50 -34
  162. package/esm/nav-bar/style/css/index.css +50 -34
  163. package/esm/notice-bar/style/css/index.css +50 -34
  164. package/esm/notice-bar/style/index.less +2 -2
  165. package/esm/notify/style/css/index.css +50 -34
  166. package/esm/pagination/style/css/index.css +50 -34
  167. package/esm/pagination/style/index.less +4 -4
  168. package/esm/picker/index.js +60 -20
  169. package/esm/picker/style/css/index.css +50 -34
  170. package/esm/picker/type.d.ts +6 -1
  171. package/esm/picker-view/style/css/index.css +50 -34
  172. package/esm/popover/style/css/index.css +50 -34
  173. package/esm/popover/style/css/menu.css +50 -34
  174. package/esm/popup/style/css/index.css +50 -34
  175. package/esm/popup-swiper/style/css/index.css +50 -34
  176. package/esm/progress/style/css/index.css +50 -34
  177. package/esm/pull-refresh/style/css/index.css +50 -34
  178. package/esm/radio/style/css/index.css +50 -34
  179. package/esm/rate/style/css/index.css +50 -34
  180. package/esm/rate/style/index.less +2 -2
  181. package/esm/search-bar/style/css/index.css +50 -34
  182. package/esm/skeleton/style/css/index.css +50 -34
  183. package/esm/skeleton/style/index.less +2 -2
  184. package/esm/slider/style/css/index.css +50 -34
  185. package/esm/slider/style/index.less +6 -6
  186. package/esm/stepper/style/css/index.css +50 -34
  187. package/esm/steps/style/css/index.css +50 -34
  188. package/esm/sticky/style/css/index.css +50 -34
  189. package/esm/style.d.ts +1 -0
  190. package/esm/style.js +2 -1
  191. package/esm/swipe-action/style/css/index.css +50 -34
  192. package/esm/swipe-load/style/css/index.css +50 -34
  193. package/esm/switch/style/css/index.css +50 -34
  194. package/esm/switch/style/index.less +8 -8
  195. package/esm/tab-bar/style/css/index.css +50 -34
  196. package/esm/tabs/style/css/index.css +50 -34
  197. package/esm/tabs/tab-cell.js +2 -2
  198. package/esm/tag/style/css/index.css +50 -34
  199. package/esm/textarea/style/css/index.css +50 -34
  200. package/esm/toast/style/css/index.css +50 -34
  201. package/esm/transition/style/css/index.css +50 -34
  202. package/esm/uploader/index.d.ts +16 -0
  203. package/esm/uploader/index.js +150 -0
  204. package/esm/uploader/style/css/index.css +666 -0
  205. package/esm/uploader/style/css/index.d.ts +4 -0
  206. package/esm/uploader/style/css/index.js +4 -0
  207. package/esm/uploader/style/index.d.ts +4 -0
  208. package/esm/uploader/style/index.js +4 -0
  209. package/esm/uploader/style/index.less +161 -0
  210. package/esm/uploader/type.d.ts +108 -0
  211. package/esm/uploader/type.js +1 -0
  212. package/esm/uploader/upload/index.d.ts +2 -0
  213. package/esm/uploader/upload/index.js +2 -0
  214. package/esm/uploader/upload/type.d.ts +107 -0
  215. package/esm/uploader/upload/type.js +1 -0
  216. package/esm/uploader/upload/upload.d.ts +20 -0
  217. package/esm/uploader/upload/upload.js +175 -0
  218. package/package.json +3 -6
  219. package/style/css/public.css +50 -34
  220. package/tokens/app/arcodesign/default/css-variables.less +27 -0
  221. package/tokens/app/arcodesign/default/index.d.ts +27 -0
  222. package/tokens/app/arcodesign/default/index.js +28 -1
  223. package/tokens/app/arcodesign/default/index.json +292 -0
  224. package/tokens/app/arcodesign/default/index.less +27 -0
  225. package/tokens/mixin/index.less +80 -3
  226. package/tokens/mixin/vars-switch.less +1 -0
  227. package/umd/action-sheet/style/css/index.css +50 -34
  228. package/umd/avatar/style/css/index.css +50 -34
  229. package/umd/badge/style/css/index.css +50 -34
  230. package/umd/button/style/css/index.css +50 -34
  231. package/umd/carousel/style/css/index.css +50 -34
  232. package/umd/cell/style/css/index.css +50 -34
  233. package/umd/cell/style/index.less +2 -2
  234. package/umd/checkbox/style/css/index.css +50 -34
  235. package/umd/circle-progress/style/css/index.css +50 -34
  236. package/umd/collapse/style/css/index.css +50 -34
  237. package/umd/count-down/style/css/index.css +50 -34
  238. package/umd/date-picker/style/css/index.css +50 -34
  239. package/umd/dialog/style/css/index.css +50 -34
  240. package/umd/divider/style/css/index.css +50 -34
  241. package/umd/dropdown/style/css/index.css +50 -34
  242. package/umd/dropdown-menu/style/css/index.css +50 -34
  243. package/umd/ellipsis/style/css/index.css +50 -34
  244. package/umd/form/form-item.d.ts +3 -0
  245. package/umd/form/form-item.js +38 -10
  246. package/umd/form/style/css/index.css +63 -34
  247. package/umd/form/style/index.less +18 -0
  248. package/umd/grid/style/css/index.css +50 -34
  249. package/umd/icon/IconCheck/index.js +1 -2
  250. package/umd/icon/IconDownload/index.d.ts +7 -0
  251. package/umd/icon/IconDownload/index.js +49 -0
  252. package/umd/icon/IconFile/index.d.ts +7 -0
  253. package/umd/icon/IconFile/index.js +49 -0
  254. package/umd/icon/IconKeyboard/index.js +1 -0
  255. package/umd/icon/IconQuestionCircle/index.js +1 -2
  256. package/umd/icon/IconUpload/index.js +6 -4
  257. package/umd/icon/IconUserFill/index.js +1 -2
  258. package/umd/icon/index.d.ts +3 -1
  259. package/umd/icon/index.js +15 -9
  260. package/umd/icon/type.d.ts +3 -1
  261. package/umd/image/style/css/index.css +50 -34
  262. package/umd/image-picker/index.js +17 -163
  263. package/umd/image-picker/style/css/index.css +50 -34
  264. package/umd/image-picker/type.d.ts +4 -73
  265. package/umd/image-preview/style/css/index.css +50 -34
  266. package/umd/index-bar/style/css/index.css +50 -34
  267. package/umd/index.d.ts +1 -0
  268. package/umd/index.js +7 -5
  269. package/umd/input/hooks.js +2 -2
  270. package/umd/input/props.d.ts +2 -2
  271. package/umd/input/style/css/index.css +50 -34
  272. package/umd/keyboard/style/css/index.css +50 -34
  273. package/umd/load-more/style/css/index.css +50 -34
  274. package/umd/loading/style/css/index.css +50 -34
  275. package/umd/masking/style/css/index.css +50 -34
  276. package/umd/nav-bar/style/css/index.css +50 -34
  277. package/umd/notice-bar/style/css/index.css +50 -34
  278. package/umd/notice-bar/style/index.less +2 -2
  279. package/umd/notify/style/css/index.css +50 -34
  280. package/umd/pagination/style/css/index.css +50 -34
  281. package/umd/pagination/style/index.less +4 -4
  282. package/umd/picker/index.js +59 -19
  283. package/umd/picker/style/css/index.css +50 -34
  284. package/umd/picker/type.d.ts +6 -1
  285. package/umd/picker-view/style/css/index.css +50 -34
  286. package/umd/popover/style/css/index.css +50 -34
  287. package/umd/popover/style/css/menu.css +50 -34
  288. package/umd/popup/style/css/index.css +50 -34
  289. package/umd/popup-swiper/style/css/index.css +50 -34
  290. package/umd/progress/style/css/index.css +50 -34
  291. package/umd/pull-refresh/style/css/index.css +50 -34
  292. package/umd/radio/style/css/index.css +50 -34
  293. package/umd/rate/style/css/index.css +50 -34
  294. package/umd/rate/style/index.less +2 -2
  295. package/umd/search-bar/style/css/index.css +50 -34
  296. package/umd/skeleton/style/css/index.css +50 -34
  297. package/umd/skeleton/style/index.less +2 -2
  298. package/umd/slider/style/css/index.css +50 -34
  299. package/umd/slider/style/index.less +6 -6
  300. package/umd/stepper/style/css/index.css +50 -34
  301. package/umd/steps/style/css/index.css +50 -34
  302. package/umd/sticky/style/css/index.css +50 -34
  303. package/umd/style.d.ts +1 -0
  304. package/umd/style.js +4 -4
  305. package/umd/swipe-action/style/css/index.css +50 -34
  306. package/umd/swipe-load/style/css/index.css +50 -34
  307. package/umd/switch/style/css/index.css +50 -34
  308. package/umd/switch/style/index.less +8 -8
  309. package/umd/tab-bar/style/css/index.css +50 -34
  310. package/umd/tabs/style/css/index.css +50 -34
  311. package/umd/tabs/tab-cell.js +1 -1
  312. package/umd/tag/style/css/index.css +50 -34
  313. package/umd/textarea/style/css/index.css +50 -34
  314. package/umd/toast/style/css/index.css +50 -34
  315. package/umd/transition/style/css/index.css +50 -34
  316. package/umd/uploader/index.d.ts +16 -0
  317. package/umd/uploader/index.js +178 -0
  318. package/umd/uploader/style/css/index.css +666 -0
  319. package/umd/uploader/style/css/index.d.ts +4 -0
  320. package/umd/uploader/style/css/index.js +15 -0
  321. package/umd/uploader/style/index.d.ts +4 -0
  322. package/umd/uploader/style/index.js +15 -0
  323. package/umd/uploader/style/index.less +161 -0
  324. package/umd/uploader/type.d.ts +108 -0
  325. package/umd/uploader/type.js +17 -0
  326. package/umd/uploader/upload/index.d.ts +2 -0
  327. package/umd/uploader/upload/index.js +27 -0
  328. package/umd/uploader/upload/type.d.ts +107 -0
  329. package/umd/uploader/upload/type.js +17 -0
  330. package/umd/uploader/upload/upload.d.ts +20 -0
  331. package/umd/uploader/upload/upload.js +200 -0
@@ -1,4 +1,3 @@
1
- export { default as IconUpload } from './IconUpload';
2
1
  export { default as IconSquareChecked } from './IconSquareChecked';
3
2
  export { default as IconTriUp } from './IconTriUp';
4
3
  export { default as IconMore } from './IconMore';
@@ -54,4 +53,7 @@ export { default as IconGift } from './IconGift';
54
53
  export { default as IconStarHalf } from './IconStarHalf';
55
54
  export { default as IconKeyboard } from './IconKeyboard';
56
55
  export { default as IconKeyboardDelete } from './IconKeyboardDelete';
56
+ export { default as IconDownload } from './IconDownload';
57
+ export { default as IconFile } from './IconFile';
58
+ export { default as IconUpload } from './IconUpload';
57
59
  export * from './type';
package/esm/icon/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export { default as IconUpload } from './IconUpload';
2
1
  export { default as IconSquareChecked } from './IconSquareChecked';
3
2
  export { default as IconTriUp } from './IconTriUp';
4
3
  export { default as IconMore } from './IconMore';
@@ -54,4 +53,7 @@ export { default as IconGift } from './IconGift';
54
53
  export { default as IconStarHalf } from './IconStarHalf';
55
54
  export { default as IconKeyboard } from './IconKeyboard';
56
55
  export { default as IconKeyboardDelete } from './IconKeyboardDelete';
56
+ export { default as IconDownload } from './IconDownload';
57
+ export { default as IconFile } from './IconFile';
58
+ export { default as IconUpload } from './IconUpload';
57
59
  export * from './type';
@@ -1,8 +1,10 @@
1
1
  /// <reference types="react" />
2
- export interface IconProps extends React.SVGProps<SVGSVGElement> {
2
+ export interface OriginIconProps extends React.SVGProps<SVGSVGElement> {
3
3
  className?: string;
4
4
  prefix?: string;
5
5
  width?: string;
6
6
  height?: string;
7
7
  useCurrentColor?: boolean;
8
+ spin?: boolean;
8
9
  }
10
+ export declare type IconProps = React.PropsWithoutRef<OriginIconProps> & React.RefAttributes<SVGSVGElement>;
@@ -95,6 +95,56 @@
95
95
  * }
96
96
  * ```
97
97
  */
98
+ /**
99
+ * 设置涉及左右相关的属性名,在rtl模式下自动替换为相反的属性名
100
+ * @desc {en} set the property name related to left and right, and automatically replace it with the opposite attribute name in rtl mode
101
+ * @param @property css属性名
102
+ * @param @property {en} css property
103
+ * @param @value css属性值
104
+ * @param @value {en} css property value
105
+ * @param @rules 自定义的复写规则,默认重置为initial
106
+ * @param @rules {en} customized rewrite rules, default to initial
107
+ * @example
108
+ * ```
109
+ * @import '@arco-design/mobile-utils/style/mixin.less';
110
+ *
111
+ * .demo {
112
+ * .set-prop-with-rtl(right, auto);
113
+ * }
114
+ * ```
115
+ */
116
+ /**
117
+ * 设置涉及左右相关的属性值,在rtl模式下自动替换为相反的属性值
118
+ * @desc {en} set the property value related to left and right, and automatically replace it with the opposite attribute value in rtl mode
119
+ * @param @property css属性名
120
+ * @param @property {en} css property
121
+ * @param @value css属性值
122
+ * @param @value {en} css property value
123
+ * @example
124
+ * ```
125
+ * @import '@arco-design/mobile-utils/style/mixin.less';
126
+ *
127
+ * .demo {
128
+ * .set-value-with-rtl(text-align, left);
129
+ * }
130
+ * ```
131
+ */
132
+ /**
133
+ * 在 rtl 模式下,自定义样式规则
134
+ * @desc {en} custom style in RTL mode
135
+ * @param @rules 对应的rtl模式下的规则
136
+ * @param @rules {en} property with rtl
137
+ * @example
138
+ * ```
139
+ * @import '@arco-design/mobile-react/style/mixin.less';
140
+ *
141
+ * .demo {
142
+ * .style-with-rtl({
143
+ * transform: scale(-1);
144
+ * });
145
+ * }
146
+ * ```
147
+ */
98
148
  /**
99
149
  * 0.5px 的边框线
100
150
  * @desc {en} a border line of 0.5 pixels
@@ -396,40 +446,6 @@
396
446
  * }
397
447
  * ```
398
448
  */
399
- /**
400
- * 设置涉及左右相关的属性名,在rtl模式下自动替换为相反的属性名
401
- * @desc {en} set the property name related to left and right, and automatically replace it with the opposite attribute name in rtl mode
402
- * @param @property css属性名
403
- * @param @property {en} css property
404
- * @param @value css属性值
405
- * @param @value {en} css property value
406
- * @param @rules 自定义的复写规则,默认重置为initial
407
- * @param @rules {en} customized rewrite rules, default to initial
408
- * @example
409
- * ```
410
- * @import '@arco-design/mobile-utils/style/mixin.less';
411
- *
412
- * .demo {
413
- * .set-prop-with-rtl(right, auto);
414
- * }
415
- * ```
416
- */
417
- /**
418
- * 设置涉及左右相关的属性值,在rtl模式下自动替换为相反的属性值
419
- * @desc {en} set the property value related to left and right, and automatically replace it with the opposite attribute value in rtl mode
420
- * @param @property css属性名
421
- * @param @property {en} css property
422
- * @param @value css属性值
423
- * @param @value {en} css property value
424
- * @example
425
- * ```
426
- * @import '@arco-design/mobile-utils/style/mixin.less';
427
- *
428
- * .demo {
429
- * .set-value-with-rtl(text-align, left);
430
- * }
431
- * ```
432
- */
433
449
  /**
434
450
  * 设置Loading组件颜色
435
451
  * @desc {en} set Loading component color
@@ -1,6 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useRef, forwardRef, useImperativeHandle } from 'react';
3
- import { Promise } from 'es6-promise';
4
3
  import { cls, defaultLocale, componentWrapper } from '@arco-design/mobile-utils';
5
4
  import { ContextLayout } from '../context-provider';
6
5
  import { IconClose } from '../icon';
@@ -8,6 +7,7 @@ import Image from '../image';
8
7
  import Grid from '../grid';
9
8
  import AddIcon from './add-icon';
10
9
  import { useLatestRef } from '../_helpers';
10
+ import { Upload } from '../uploader/upload';
11
11
  export * from './type';
12
12
  var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
13
13
  var _props$className = props.className,
@@ -26,7 +26,6 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
26
26
  limit = _props$limit === void 0 ? 0 : _props$limit,
27
27
  _props$images = props.images,
28
28
  images = _props$images === void 0 ? [] : _props$images,
29
- maxSize = props.maxSize,
30
29
  disabled = props.disabled,
31
30
  deleteIcon = props.deleteIcon,
32
31
  selectIcon = props.selectIcon,
@@ -39,18 +38,7 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
39
38
  imageProps = props.imageProps,
40
39
  renderLoading = props.renderLoading,
41
40
  renderError = props.renderError,
42
- onLongPress = props.onLongPress,
43
- onClick = props.onClick,
44
- _props$onChange = props.onChange,
45
- onChange = _props$onChange === void 0 ? function () {
46
- return null;
47
- } : _props$onChange,
48
- onMaxSizeExceed = props.onMaxSizeExceed,
49
- onLimitExceed = props.onLimitExceed,
50
- upload = props.upload,
51
- selectAdapter = props.selectAdapter,
52
- onSelectClick = props.onSelectClick,
53
- onDeleteClick = props.onDeleteClick;
41
+ selectAdapter = props.selectAdapter;
54
42
  var domRef = useRef(null);
55
43
  var fileRef = useRef(null);
56
44
  var cacheRef = useLatestRef(images);
@@ -59,143 +47,9 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
59
47
  dom: domRef.current
60
48
  };
61
49
  });
62
-
63
- var parseFile = function parseFile(file) {
64
- return new Promise(function (resolve, reject) {
65
- if (file.url) {
66
- resolve(file.url);
67
- } else {
68
- var reader = new FileReader();
69
-
70
- reader.onload = function (e) {
71
- var _e$target;
72
-
73
- var dataURL = (_e$target = e.target) == null ? void 0 : _e$target.result;
74
-
75
- if (!dataURL) {
76
- reject(new Error('file parse error'));
77
- }
78
-
79
- resolve(dataURL);
80
- };
81
-
82
- reader.onerror = function () {
83
- reject(new Error('file parse error'));
84
- };
85
-
86
- reader.readAsDataURL(file);
87
- }
88
- });
89
- };
90
-
91
- var handleChange = function handleChange(event, fromAdapter) {
92
- var files = Array.prototype.filter.call(event.target.files || [], function (file) {
93
- // 过滤maxSize
94
- if (maxSize && file.size > maxSize * 1024) {
95
- onMaxSizeExceed && onMaxSizeExceed(file);
96
- return false;
97
- }
98
-
99
- return true;
100
- }) || [];
101
-
102
- if (!fromAdapter) {
103
- event.target.value = '';
104
- } // 截断limit
105
-
106
-
107
- if (limit !== 0 && files.length + images.length > limit) {
108
- onLimitExceed && onLimitExceed(files);
109
- files.length = limit - images.length;
110
- } // 解析文件生成预览
111
-
112
-
113
- Promise.all(files.map(function (file) {
114
- return parseFile(file);
115
- })).then(function (parseFiles) {
116
- var res = parseFiles.map(function (url, index) {
117
- return {
118
- url: url,
119
- status: typeof upload === 'function' ? 'loading' : 'loaded',
120
- file: files[index]
121
- };
122
- });
123
- cacheRef.current = [].concat(cacheRef.current, res);
124
- onChange([].concat(cacheRef.current)); // 执行upload
125
-
126
- if (typeof upload === 'function') {
127
- files.forEach(function (_file) {
128
- upload(cacheRef.current.find(function (_ref) {
129
- var file = _ref.file;
130
- return file === _file;
131
- })).then(function (data) {
132
- var index = cacheRef.current.findIndex(function (_ref2) {
133
- var file = _ref2.file;
134
- return file === _file;
135
- });
136
-
137
- if (index !== -1) {
138
- cacheRef.current[index] = _extends({}, cacheRef.current[index], data, {
139
- status: undefined
140
- });
141
- }
142
- }).catch(function () {
143
- var index = cacheRef.current.findIndex(function (_ref3) {
144
- var file = _ref3.file;
145
- return file === _file;
146
- });
147
-
148
- if (index !== -1) {
149
- cacheRef.current[index].status = 'error';
150
- }
151
- }).finally(function () {
152
- onChange([].concat(cacheRef.current));
153
- });
154
- });
155
- }
156
- });
157
- };
158
-
159
- var handleDelete = function handleDelete(index) {
160
- onDeleteClick && onDeleteClick(index);
161
- onChange(images.filter(function (_i, j) {
162
- return j !== index;
163
- }));
164
- }; // click && longPress
165
-
166
-
167
- var timeOutEvent;
168
-
169
- var handleTouchStart = function handleTouchStart(e, image, index) {
170
- timeOutEvent = setTimeout(function () {
171
- timeOutEvent = 0;
172
- onLongPress == null ? void 0 : onLongPress(e, image, index);
173
- }, 750);
174
- };
175
-
176
- var handleClick = function handleClick(e, image, index) {
177
- clearTimeout(timeOutEvent);
178
-
179
- if (timeOutEvent !== 0) {
180
- onClick == null ? void 0 : onClick(e, image, index);
181
- }
182
- };
183
-
184
- var handleSelect = function handleSelect(e) {
185
- if (e.target !== fileRef.current) {
186
- var _fileRef$current;
187
-
188
- onSelectClick && onSelectClick();
189
- selectAdapter ? selectAdapter().then(function (_ref4) {
190
- var files = _ref4.files;
191
- return handleChange({
192
- target: {
193
- files: files
194
- }
195
- }, true);
196
- }) : (_fileRef$current = fileRef.current) == null ? void 0 : _fileRef$current.click();
197
- }
198
- };
50
+ var uploadFunc = new Upload(_extends({}, props, {
51
+ files: images
52
+ }), fileRef, cacheRef);
199
53
 
200
54
  var getGridData = function getGridData(prefixCls, locale) {
201
55
  var errorNode = function errorNode(index) {
@@ -225,10 +79,10 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
225
79
  className: prefixCls + "-image-picker-image"
226
80
  }, /*#__PURE__*/React.createElement("div", {
227
81
  onTouchStart: function onTouchStart(e) {
228
- return handleTouchStart(e, image, index);
82
+ return uploadFunc.handleTouchStart(e, image, index);
229
83
  },
230
84
  onClick: function onClick(e) {
231
- return handleClick(e, image, index);
85
+ return uploadFunc.handleClick(e, image, index);
232
86
  },
233
87
  className: prefixCls + "-image-picker-image-container"
234
88
  }, /*#__PURE__*/React.createElement(Image, _extends({
@@ -244,7 +98,7 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
244
98
  })), !hideDelete && /*#__PURE__*/React.createElement("div", {
245
99
  className: prefixCls + "-image-picker-close",
246
100
  onClick: function onClick() {
247
- return handleDelete(index);
101
+ return uploadFunc.deleteFile(index);
248
102
  }
249
103
  }, deleteIcon || /*#__PURE__*/React.createElement("div", {
250
104
  className: prefixCls + "-image-picker-close-icon"
@@ -261,7 +115,7 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
261
115
  data.push({
262
116
  img: /*#__PURE__*/React.createElement("div", {
263
117
  className: cls(prefixCls + "-image-picker-add", (_cls = {}, _cls[prefixCls + "-image-picker-add-disabled"] = disableSelect, _cls)),
264
- onClick: handleSelect
118
+ onClick: uploadFunc.handleSelect
265
119
  }, /*#__PURE__*/React.createElement("div", {
266
120
  className: prefixCls + "-image-picker-add-container"
267
121
  }, selectIcon || /*#__PURE__*/React.createElement("div", {
@@ -272,7 +126,7 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
272
126
  multiple: multiple,
273
127
  type: "file",
274
128
  onChange: function onChange(e) {
275
- return handleChange(e);
129
+ return uploadFunc.handleChange(e);
276
130
  },
277
131
  ref: fileRef
278
132
  }) : null)),
@@ -283,12 +137,12 @@ var ImagePicker = /*#__PURE__*/forwardRef(function (props, ref) {
283
137
  return data;
284
138
  };
285
139
 
286
- return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref5) {
140
+ return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref) {
287
141
  var _cls2;
288
142
 
289
- var prefixCls = _ref5.prefixCls,
290
- _ref5$locale = _ref5.locale,
291
- locale = _ref5$locale === void 0 ? defaultLocale : _ref5$locale;
143
+ var prefixCls = _ref.prefixCls,
144
+ _ref$locale = _ref.locale,
145
+ locale = _ref$locale === void 0 ? defaultLocale : _ref$locale;
292
146
  return /*#__PURE__*/React.createElement("div", {
293
147
  className: cls(prefixCls + "-image-picker", className, (_cls2 = {}, _cls2[prefixCls + "-image-picker-disabled"] = disabled, _cls2)),
294
148
  style: style,
@@ -95,6 +95,56 @@
95
95
  * }
96
96
  * ```
97
97
  */
98
+ /**
99
+ * 设置涉及左右相关的属性名,在rtl模式下自动替换为相反的属性名
100
+ * @desc {en} set the property name related to left and right, and automatically replace it with the opposite attribute name in rtl mode
101
+ * @param @property css属性名
102
+ * @param @property {en} css property
103
+ * @param @value css属性值
104
+ * @param @value {en} css property value
105
+ * @param @rules 自定义的复写规则,默认重置为initial
106
+ * @param @rules {en} customized rewrite rules, default to initial
107
+ * @example
108
+ * ```
109
+ * @import '@arco-design/mobile-utils/style/mixin.less';
110
+ *
111
+ * .demo {
112
+ * .set-prop-with-rtl(right, auto);
113
+ * }
114
+ * ```
115
+ */
116
+ /**
117
+ * 设置涉及左右相关的属性值,在rtl模式下自动替换为相反的属性值
118
+ * @desc {en} set the property value related to left and right, and automatically replace it with the opposite attribute value in rtl mode
119
+ * @param @property css属性名
120
+ * @param @property {en} css property
121
+ * @param @value css属性值
122
+ * @param @value {en} css property value
123
+ * @example
124
+ * ```
125
+ * @import '@arco-design/mobile-utils/style/mixin.less';
126
+ *
127
+ * .demo {
128
+ * .set-value-with-rtl(text-align, left);
129
+ * }
130
+ * ```
131
+ */
132
+ /**
133
+ * 在 rtl 模式下,自定义样式规则
134
+ * @desc {en} custom style in RTL mode
135
+ * @param @rules 对应的rtl模式下的规则
136
+ * @param @rules {en} property with rtl
137
+ * @example
138
+ * ```
139
+ * @import '@arco-design/mobile-react/style/mixin.less';
140
+ *
141
+ * .demo {
142
+ * .style-with-rtl({
143
+ * transform: scale(-1);
144
+ * });
145
+ * }
146
+ * ```
147
+ */
98
148
  /**
99
149
  * 0.5px 的边框线
100
150
  * @desc {en} a border line of 0.5 pixels
@@ -396,40 +446,6 @@
396
446
  * }
397
447
  * ```
398
448
  */
399
- /**
400
- * 设置涉及左右相关的属性名,在rtl模式下自动替换为相反的属性名
401
- * @desc {en} set the property name related to left and right, and automatically replace it with the opposite attribute name in rtl mode
402
- * @param @property css属性名
403
- * @param @property {en} css property
404
- * @param @value css属性值
405
- * @param @value {en} css property value
406
- * @param @rules 自定义的复写规则,默认重置为initial
407
- * @param @rules {en} customized rewrite rules, default to initial
408
- * @example
409
- * ```
410
- * @import '@arco-design/mobile-utils/style/mixin.less';
411
- *
412
- * .demo {
413
- * .set-prop-with-rtl(right, auto);
414
- * }
415
- * ```
416
- */
417
- /**
418
- * 设置涉及左右相关的属性值,在rtl模式下自动替换为相反的属性值
419
- * @desc {en} set the property value related to left and right, and automatically replace it with the opposite attribute value in rtl mode
420
- * @param @property css属性名
421
- * @param @property {en} css property
422
- * @param @value css属性值
423
- * @param @value {en} css property value
424
- * @example
425
- * ```
426
- * @import '@arco-design/mobile-utils/style/mixin.less';
427
- *
428
- * .demo {
429
- * .set-value-with-rtl(text-align, left);
430
- * }
431
- * ```
432
- */
433
449
  /**
434
450
  * 设置Loading组件颜色
435
451
  * @desc {en} set Loading component color
@@ -1,33 +1,14 @@
1
1
  import { InputHTMLAttributes } from 'react';
2
2
  import { ImageProps } from '../image';
3
- export interface ImagePickItem {
3
+ import { UploadCommonProps, CommonFileItem } from '../uploader/upload/type';
4
+ export interface ImagePickItem extends CommonFileItem {
4
5
  /**
5
6
  * 图片地址
6
7
  * @en Image Url
7
8
  */
8
9
  url: string;
9
- /**
10
- * 图片文件
11
- * @en Image File
12
- */
13
- file?: File;
14
- /**
15
- * 图片状态
16
- * @en Image Status
17
- * @default 以图片自身加载状态而定
18
- * @default_en According to inner status of the image
19
- */
20
- status?: 'loaded' | 'loading' | 'error';
21
10
  }
22
- export interface AdapterFile {
23
- url?: string;
24
- size: number;
25
- name: string;
26
- }
27
- export interface SelectCallback {
28
- files: AdapterFile[];
29
- }
30
- export interface ImagePickerProps {
11
+ export interface ImagePickerProps extends Omit<UploadCommonProps<ImagePickItem>, 'files'> {
31
12
  /**
32
13
  * 自定义类名
33
14
  * @en Custom className
@@ -71,16 +52,6 @@ export interface ImagePickerProps {
71
52
  * @default 8
72
53
  */
73
54
  gutter?: number;
74
- /**
75
- * 最多选择图片张数,超出数量自动隐藏上传按钮,0表示不做限制
76
- * @en max Pictures Can Choose
77
- */
78
- limit?: number;
79
- /**
80
- * 文件大小限制,单位为K
81
- * @en File size limit, in K
82
- */
83
- maxSize?: number;
84
55
  /**
85
56
  * 是否隐藏删除Icon
86
57
  * @en Whether to hide delete Icon
@@ -129,51 +100,11 @@ export interface ImagePickerProps {
129
100
  * @en Defined uploading display
130
101
  */
131
102
  renderLoading?: (index?: number) => React.ReactNode | React.ReactNode;
132
- /**
133
- * 上传方法
134
- * @en upload function
135
- */
136
- upload?: (file: ImagePickItem) => Promise<ImagePickItem | null>;
137
- /**
138
- * 已选图片列表发生变化
139
- * @en The list of selected images changes
140
- */
141
- onChange?: (fileList: ImagePickItem[]) => void;
142
- /**
143
- * 图片超过限制大小
144
- * @en Image exceeds size limit
145
- */
146
- onMaxSizeExceed?: (file: File) => void;
147
- /**
148
- * 选择张数超过限制
149
- * @en The number of pictures exceeds the limit
150
- */
151
- onLimitExceed?: (files: File[]) => void;
152
- /**
153
- * 图片点击
154
- * @en click event
155
- */
156
- onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, image: ImagePickItem, index: number) => void;
157
- /**
158
- * 图片长按事件
159
- * @en long press event
160
- */
161
- onLongPress?: (e: React.TouchEvent<HTMLElement>, image: ImagePickItem, index: number) => void;
162
- /**
163
- * 图片选择适配器
164
- * @en Select Adaptor
165
- */
166
- selectAdapter?: () => Promise<SelectCallback>;
167
103
  /**
168
104
  * 选图点击事件
169
- * @en Select Icon Click Event
105
+ * @en Select icon click event
170
106
  */
171
107
  onSelectClick?: () => void;
172
- /**
173
- * 删除点击事件
174
- * @en Delete Icon Click Event
175
- */
176
- onDeleteClick?: (index: number) => void;
177
108
  }
178
109
  export interface ImagePickerRef {
179
110
  /**
@@ -95,6 +95,56 @@
95
95
  * }
96
96
  * ```
97
97
  */
98
+ /**
99
+ * 设置涉及左右相关的属性名,在rtl模式下自动替换为相反的属性名
100
+ * @desc {en} set the property name related to left and right, and automatically replace it with the opposite attribute name in rtl mode
101
+ * @param @property css属性名
102
+ * @param @property {en} css property
103
+ * @param @value css属性值
104
+ * @param @value {en} css property value
105
+ * @param @rules 自定义的复写规则,默认重置为initial
106
+ * @param @rules {en} customized rewrite rules, default to initial
107
+ * @example
108
+ * ```
109
+ * @import '@arco-design/mobile-utils/style/mixin.less';
110
+ *
111
+ * .demo {
112
+ * .set-prop-with-rtl(right, auto);
113
+ * }
114
+ * ```
115
+ */
116
+ /**
117
+ * 设置涉及左右相关的属性值,在rtl模式下自动替换为相反的属性值
118
+ * @desc {en} set the property value related to left and right, and automatically replace it with the opposite attribute value in rtl mode
119
+ * @param @property css属性名
120
+ * @param @property {en} css property
121
+ * @param @value css属性值
122
+ * @param @value {en} css property value
123
+ * @example
124
+ * ```
125
+ * @import '@arco-design/mobile-utils/style/mixin.less';
126
+ *
127
+ * .demo {
128
+ * .set-value-with-rtl(text-align, left);
129
+ * }
130
+ * ```
131
+ */
132
+ /**
133
+ * 在 rtl 模式下,自定义样式规则
134
+ * @desc {en} custom style in RTL mode
135
+ * @param @rules 对应的rtl模式下的规则
136
+ * @param @rules {en} property with rtl
137
+ * @example
138
+ * ```
139
+ * @import '@arco-design/mobile-react/style/mixin.less';
140
+ *
141
+ * .demo {
142
+ * .style-with-rtl({
143
+ * transform: scale(-1);
144
+ * });
145
+ * }
146
+ * ```
147
+ */
98
148
  /**
99
149
  * 0.5px 的边框线
100
150
  * @desc {en} a border line of 0.5 pixels
@@ -396,40 +446,6 @@
396
446
  * }
397
447
  * ```
398
448
  */
399
- /**
400
- * 设置涉及左右相关的属性名,在rtl模式下自动替换为相反的属性名
401
- * @desc {en} set the property name related to left and right, and automatically replace it with the opposite attribute name in rtl mode
402
- * @param @property css属性名
403
- * @param @property {en} css property
404
- * @param @value css属性值
405
- * @param @value {en} css property value
406
- * @param @rules 自定义的复写规则,默认重置为initial
407
- * @param @rules {en} customized rewrite rules, default to initial
408
- * @example
409
- * ```
410
- * @import '@arco-design/mobile-utils/style/mixin.less';
411
- *
412
- * .demo {
413
- * .set-prop-with-rtl(right, auto);
414
- * }
415
- * ```
416
- */
417
- /**
418
- * 设置涉及左右相关的属性值,在rtl模式下自动替换为相反的属性值
419
- * @desc {en} set the property value related to left and right, and automatically replace it with the opposite attribute value in rtl mode
420
- * @param @property css属性名
421
- * @param @property {en} css property
422
- * @param @value css属性值
423
- * @param @value {en} css property value
424
- * @example
425
- * ```
426
- * @import '@arco-design/mobile-utils/style/mixin.less';
427
- *
428
- * .demo {
429
- * .set-value-with-rtl(text-align, left);
430
- * }
431
- * ```
432
- */
433
449
  /**
434
450
  * 设置Loading组件颜色
435
451
  * @desc {en} set Loading component color