@cloudbase/weda-ui 3.2.0 → 3.3.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 (356) hide show
  1. package/dist/cypress/support/commands.d.ts +1 -0
  2. package/dist/cypress/support/commands.js +40 -0
  3. package/dist/cypress/support/e2e.d.ts +24 -0
  4. package/dist/cypress/support/e2e.js +22 -0
  5. package/dist/src/configs/actions/showModal.json +48 -0
  6. package/dist/src/configs/actions/showToast.json +41 -0
  7. package/dist/src/configs/components/auth.json +16 -0
  8. package/dist/src/configs/components/button.json +239 -0
  9. package/dist/src/configs/components/calendar.json +81 -0
  10. package/dist/src/configs/components/carousel.json +292 -0
  11. package/dist/src/configs/components/chart/bar.json +962 -0
  12. package/dist/src/configs/components/chart/line.json +878 -0
  13. package/dist/src/configs/components/chart/pie.json +685 -0
  14. package/dist/src/configs/components/chart/statisticsCard.json +376 -0
  15. package/dist/src/configs/components/container.json +50 -0
  16. package/dist/src/configs/components/dataView.json +247 -0
  17. package/dist/src/configs/components/drawer.json +115 -0
  18. package/dist/src/configs/components/form/checkbox.json +179 -0
  19. package/dist/src/configs/components/form/departTreeSelect.json +124 -0
  20. package/dist/src/configs/components/form/form.json +73 -0
  21. package/dist/src/configs/components/form/input.json +154 -0
  22. package/dist/src/configs/components/form/location.json +216 -0
  23. package/dist/src/configs/components/form/radio.json +203 -0
  24. package/dist/src/configs/components/form/richText.json +133 -0
  25. package/dist/src/configs/components/form/select.json +449 -0
  26. package/dist/src/configs/components/form/switch.json +58 -0
  27. package/dist/src/configs/components/form/textarea.json +116 -0
  28. package/dist/src/configs/components/form/tips.json +34 -0
  29. package/dist/src/configs/components/form/uploader.json +171 -0
  30. package/dist/src/configs/components/form/uploaderFile.json +158 -0
  31. package/dist/src/configs/components/form/userTreeSelect.json +128 -0
  32. package/dist/src/configs/components/formdetail.json +105 -0
  33. package/dist/src/configs/components/graphicCard.json +413 -0
  34. package/dist/src/configs/components/image.json +187 -0
  35. package/dist/src/configs/components/link.json +79 -0
  36. package/dist/src/configs/components/listView.json +378 -0
  37. package/dist/src/configs/components/lottery.json +163 -0
  38. package/dist/src/configs/components/modal.json +72 -0
  39. package/dist/src/configs/components/navLayout.json +368 -0
  40. package/dist/src/configs/components/navigationBar.json +62 -0
  41. package/dist/src/configs/components/richtextview.json +26 -0
  42. package/dist/src/configs/components/scrollVeiw.json +253 -0
  43. package/dist/src/configs/components/slot.json +17 -0
  44. package/dist/src/configs/components/swiper.json +90 -0
  45. package/dist/src/configs/components/tabs.json +122 -0
  46. package/dist/src/configs/components/text.json +95 -0
  47. package/dist/src/configs/components/wedaVideo.json +89 -0
  48. package/dist/src/configs/components/wxOpenApi/phone.json +127 -0
  49. package/dist/src/configs/components/wxOpenApi/phoneCode.json +109 -0
  50. package/dist/src/configs/components/wxOpenApi/share.json +160 -0
  51. package/dist/src/configs/components/wxOpenApi/userInfo.json +156 -0
  52. package/dist/src/configs/index.d.ts +103 -0
  53. package/dist/src/configs/index.js +111 -0
  54. package/dist/src/docs/common/format.d.ts +13 -0
  55. package/dist/src/docs/common/format.js +122 -0
  56. package/dist/src/docs/common/tableView.d.ts +30 -0
  57. package/dist/src/docs/common/tableView.js +156 -0
  58. package/dist/src/index.d.ts +2 -0
  59. package/dist/src/index.js +3 -0
  60. package/dist/src/setupTests.d.ts +2 -0
  61. package/dist/src/setupTests.js +19 -0
  62. package/dist/src/web/actions/index.d.ts +2 -0
  63. package/dist/src/web/actions/index.js +2 -0
  64. package/dist/src/web/actions/showModal/index.d.ts +4 -0
  65. package/dist/src/web/actions/showModal/index.js +66 -0
  66. package/dist/src/web/actions/showToast/index.d.ts +1 -0
  67. package/dist/src/web/actions/showToast/index.js +3 -0
  68. package/dist/src/web/components/button/index.d.ts +32 -0
  69. package/dist/src/web/components/button/index.js +48 -0
  70. package/dist/src/web/components/calendar/index.d.ts +19 -0
  71. package/dist/src/web/components/calendar/index.js +191 -0
  72. package/dist/src/web/components/calendar/util.d.ts +13 -0
  73. package/dist/src/web/components/calendar/util.js +74 -0
  74. package/dist/src/web/components/carousel/index.d.ts +41 -0
  75. package/dist/src/web/components/carousel/index.js +244 -0
  76. package/dist/src/web/components/chart/bar/index.d.ts +3 -0
  77. package/dist/src/web/components/chart/bar/index.js +45 -0
  78. package/dist/src/web/components/chart/bar/index.old.d.ts +40 -0
  79. package/dist/src/web/components/chart/bar/index.old.js +56 -0
  80. package/dist/src/web/components/chart/common/Chart.d.ts +10 -0
  81. package/dist/src/web/components/chart/common/Chart.js +31 -0
  82. package/dist/src/web/components/chart/common/chart-custom-connector.d.ts +6 -0
  83. package/dist/src/web/components/chart/common/chart-custom-connector.js +35 -0
  84. package/dist/src/web/components/chart/common/chart-error.d.ts +2 -0
  85. package/dist/src/web/components/chart/common/chart-error.js +2 -0
  86. package/dist/src/web/components/chart/common/config/bar.d.ts +48 -0
  87. package/dist/src/web/components/chart/common/config/bar.js +49 -0
  88. package/dist/src/web/components/chart/common/config/global.d.ts +13 -0
  89. package/dist/src/web/components/chart/common/config/global.js +16 -0
  90. package/dist/src/web/components/chart/common/config/line.d.ts +46 -0
  91. package/dist/src/web/components/chart/common/config/line.js +49 -0
  92. package/dist/src/web/components/chart/common/config/pie.d.ts +29 -0
  93. package/dist/src/web/components/chart/common/config/pie.js +36 -0
  94. package/dist/src/web/components/chart/common/core/eChartBar.d.ts +66 -0
  95. package/dist/src/web/components/chart/common/core/eChartBar.js +201 -0
  96. package/dist/src/web/components/chart/common/core/eChartBase.d.ts +127 -0
  97. package/dist/src/web/components/chart/common/core/eChartBase.js +394 -0
  98. package/dist/src/web/components/chart/common/core/eChartLine.d.ts +60 -0
  99. package/dist/src/web/components/chart/common/core/eChartLine.js +173 -0
  100. package/dist/src/web/components/chart/common/core/eChartPie.d.ts +48 -0
  101. package/dist/src/web/components/chart/common/core/eChartPie.js +135 -0
  102. package/dist/src/web/components/chart/common/core/type.d.ts +35 -0
  103. package/dist/src/web/components/chart/common/core/type.js +9 -0
  104. package/dist/src/web/components/chart/common/data-transform.d.ts +6 -0
  105. package/dist/src/web/components/chart/common/data-transform.js +248 -0
  106. package/dist/src/web/components/chart/common/echarts.d.ts +5 -0
  107. package/dist/src/web/components/chart/common/echarts.js +24 -0
  108. package/dist/src/web/components/chart/common/error-boundary.d.ts +5 -0
  109. package/dist/src/web/components/chart/common/error-boundary.js +26 -0
  110. package/dist/src/web/components/chart/common/useChart.d.ts +8 -0
  111. package/dist/src/web/components/chart/common/useChart.js +72 -0
  112. package/dist/src/web/components/chart/line/index.d.ts +3 -0
  113. package/dist/src/web/components/chart/line/index.js +42 -0
  114. package/dist/src/web/components/chart/line/index.old.d.ts +38 -0
  115. package/dist/src/web/components/chart/line/index.old.js +53 -0
  116. package/dist/src/web/components/chart/pie/index.d.ts +3 -0
  117. package/dist/src/web/components/chart/pie/index.js +42 -0
  118. package/dist/src/web/components/chart/pie/index.old.d.ts +27 -0
  119. package/dist/src/web/components/chart/pie/index.old.js +40 -0
  120. package/dist/src/web/components/chart/statisticsCard/index.d.ts +85 -0
  121. package/dist/src/web/components/chart/statisticsCard/index.js +203 -0
  122. package/dist/src/web/components/chart/statisticsCard/interface.d.ts +13 -0
  123. package/dist/src/web/components/chart/statisticsCard/interface.js +1 -0
  124. package/dist/src/web/components/common/error-boundary.d.ts +5 -0
  125. package/dist/src/web/components/common/error-boundary.js +33 -0
  126. package/dist/src/web/components/common/portal.d.ts +7 -0
  127. package/dist/src/web/components/common/portal.js +14 -0
  128. package/dist/src/web/components/common/use-loop-render-detect.d.ts +11 -0
  129. package/dist/src/web/components/common/use-loop-render-detect.js +124 -0
  130. package/dist/src/web/components/container/index.d.ts +6 -0
  131. package/dist/src/web/components/container/index.js +6 -0
  132. package/dist/src/web/components/dataView/index.d.ts +6 -0
  133. package/dist/src/web/components/dataView/index.js +8 -0
  134. package/dist/src/web/components/dataView/interface.d.ts +5 -0
  135. package/dist/src/web/components/dataView/interface.js +1 -0
  136. package/dist/src/web/components/drawer/index.d.ts +13 -0
  137. package/dist/src/web/components/drawer/index.js +12 -0
  138. package/dist/src/web/components/form/checkbox/index.d.ts +13 -0
  139. package/dist/src/web/components/form/checkbox/index.js +167 -0
  140. package/dist/src/web/components/form/enumSelect/MultipleSelect.d.ts +78 -0
  141. package/dist/src/web/components/form/enumSelect/MultipleSelect.js +52 -0
  142. package/dist/src/web/components/form/enumSelect/NormalSelect.d.ts +83 -0
  143. package/dist/src/web/components/form/enumSelect/NormalSelect.js +52 -0
  144. package/dist/src/web/components/form/enumSelect/SelectContainer.d.ts +16 -0
  145. package/dist/src/web/components/form/enumSelect/SelectContainer.js +30 -0
  146. package/dist/src/web/components/form/enumSelect/index.d.ts +82 -0
  147. package/dist/src/web/components/form/enumSelect/index.js +6 -0
  148. package/dist/src/web/components/form/enumSelect/props/defaultProps.d.ts +34 -0
  149. package/dist/src/web/components/form/enumSelect/props/defaultProps.js +40 -0
  150. package/dist/src/web/components/form/enumSelect/props/propsTypes.d.ts +39 -0
  151. package/dist/src/web/components/form/enumSelect/props/propsTypes.js +47 -0
  152. package/dist/src/web/components/form/form/index.d.ts +32 -0
  153. package/dist/src/web/components/form/form/index.js +150 -0
  154. package/dist/src/web/components/form/formcell/index.d.ts +8 -0
  155. package/dist/src/web/components/form/formcell/index.js +40 -0
  156. package/dist/src/web/components/form/input/index.d.ts +14 -0
  157. package/dist/src/web/components/form/input/index.js +94 -0
  158. package/dist/src/web/components/form/location/common/mapChoose.d.ts +15 -0
  159. package/dist/src/web/components/form/location/common/mapChoose.js +496 -0
  160. package/dist/src/web/components/form/location/common/mapView.d.ts +19 -0
  161. package/dist/src/web/components/form/location/common/mapView.js +175 -0
  162. package/dist/src/web/components/form/location/common/propsConfig.d.ts +59 -0
  163. package/dist/src/web/components/form/location/common/propsConfig.js +50 -0
  164. package/dist/src/web/components/form/location/common/selectModal.d.ts +21 -0
  165. package/dist/src/web/components/form/location/common/selectModal.js +44 -0
  166. package/dist/src/web/components/form/location/common/tmap.d.ts +3 -0
  167. package/dist/src/web/components/form/location/common/tmap.js +21 -0
  168. package/dist/src/web/components/form/location/common/useLocationInfo.d.ts +36 -0
  169. package/dist/src/web/components/form/location/common/useLocationInfo.js +105 -0
  170. package/dist/src/web/components/form/location/components/LocationH5/location.h5.d.ts +8 -0
  171. package/dist/src/web/components/form/location/components/LocationH5/location.h5.js +328 -0
  172. package/dist/src/web/components/form/location/components/LocationPC/Header.d.ts +12 -0
  173. package/dist/src/web/components/form/location/components/LocationPC/Header.js +43 -0
  174. package/dist/src/web/components/form/location/components/LocationPC/location.PC.d.ts +8 -0
  175. package/dist/src/web/components/form/location/components/LocationPC/location.PC.js +228 -0
  176. package/dist/src/web/components/form/location/constants.d.ts +2 -0
  177. package/dist/src/web/components/form/location/constants.js +3 -0
  178. package/dist/src/web/components/form/location/index.d.ts +1 -0
  179. package/dist/src/web/components/form/location/index.js +24 -0
  180. package/dist/src/web/components/form/radio/index.d.ts +11 -0
  181. package/dist/src/web/components/form/radio/index.js +115 -0
  182. package/dist/src/web/components/form/renderDecorator.d.ts +6 -0
  183. package/dist/src/web/components/form/renderDecorator.js +20 -0
  184. package/dist/src/web/components/form/select/allTimePicker/calendar.d.ts +13 -0
  185. package/dist/src/web/components/form/select/allTimePicker/calendar.js +104 -0
  186. package/dist/src/web/components/form/select/allTimePicker/dataUtils.d.ts +24 -0
  187. package/dist/src/web/components/form/select/allTimePicker/dataUtils.js +265 -0
  188. package/dist/src/web/components/form/select/allTimePicker/index.d.ts +14 -0
  189. package/dist/src/web/components/form/select/allTimePicker/index.js +944 -0
  190. package/dist/src/web/components/form/select/dropdown-select/ui.d.ts +15 -0
  191. package/dist/src/web/components/form/select/dropdown-select/ui.js +55 -0
  192. package/dist/src/web/components/form/select/h5.d.ts +16 -0
  193. package/dist/src/web/components/form/select/h5.js +466 -0
  194. package/dist/src/web/components/form/select/index.d.ts +66 -0
  195. package/dist/src/web/components/form/select/index.js +255 -0
  196. package/dist/src/web/components/form/select/region/index.d.ts +6 -0
  197. package/dist/src/web/components/form/select/region/index.js +147 -0
  198. package/dist/src/web/components/form/select/time.d.ts +9 -0
  199. package/dist/src/web/components/form/select/time.js +146 -0
  200. package/dist/src/web/components/form/select/use-options.d.ts +26 -0
  201. package/dist/src/web/components/form/select/use-options.js +103 -0
  202. package/dist/src/web/components/form/select/year.d.ts +7 -0
  203. package/dist/src/web/components/form/select/year.js +72 -0
  204. package/dist/src/web/components/form/switch/index.d.ts +6 -0
  205. package/dist/src/web/components/form/switch/index.js +58 -0
  206. package/dist/src/web/components/form/textarea/index.d.ts +12 -0
  207. package/dist/src/web/components/form/textarea/index.js +66 -0
  208. package/dist/src/web/components/form/tips/index.d.ts +8 -0
  209. package/dist/src/web/components/form/tips/index.js +17 -0
  210. package/dist/src/web/components/form/uploader/index.d.ts +3 -0
  211. package/dist/src/web/components/form/uploader/index.js +42 -0
  212. package/dist/src/web/components/form/uploader/uploader.h5.d.ts +20 -0
  213. package/dist/src/web/components/form/uploader/uploader.h5.js +199 -0
  214. package/dist/src/web/components/form/uploader/uploader.pc.d.ts +29 -0
  215. package/dist/src/web/components/form/uploader/uploader.pc.js +208 -0
  216. package/dist/src/web/components/form/uploaderFile/index.d.ts +4 -0
  217. package/dist/src/web/components/form/uploaderFile/index.js +19 -0
  218. package/dist/src/web/components/form/uploaderFile/uploadFile.h5.d.ts +23 -0
  219. package/dist/src/web/components/form/uploaderFile/uploadFile.h5.js +330 -0
  220. package/dist/src/web/components/form/uploaderFile/uploadFile.pc.d.ts +24 -0
  221. package/dist/src/web/components/form/uploaderFile/uploadFile.pc.js +302 -0
  222. package/dist/src/web/components/form/userOrgSelect/comTool.d.ts +8 -0
  223. package/dist/src/web/components/form/userOrgSelect/comTool.js +101 -0
  224. package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.d.ts +19 -0
  225. package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +252 -0
  226. package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.d.ts +4 -0
  227. package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +157 -0
  228. package/dist/src/web/components/form/userOrgSelect/departTreeSelect/index.d.ts +2 -0
  229. package/dist/src/web/components/form/userOrgSelect/departTreeSelect/index.js +17 -0
  230. package/dist/src/web/components/form/userOrgSelect/getUserService.d.ts +11 -0
  231. package/dist/src/web/components/form/userOrgSelect/getUserService.js +159 -0
  232. package/dist/src/web/components/form/userOrgSelect/index.d.ts +2 -0
  233. package/dist/src/web/components/form/userOrgSelect/index.js +17 -0
  234. package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.d.ts +27 -0
  235. package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.js +276 -0
  236. package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.d.ts +9 -0
  237. package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.js +253 -0
  238. package/dist/src/web/components/form/userOrgSelect/utils.d.ts +36 -0
  239. package/dist/src/web/components/form/userOrgSelect/utils.js +80 -0
  240. package/dist/src/web/components/formdetail/index.d.ts +28 -0
  241. package/dist/src/web/components/formdetail/index.js +173 -0
  242. package/dist/src/web/components/graphicCard/index.d.ts +46 -0
  243. package/dist/src/web/components/graphicCard/index.js +178 -0
  244. package/dist/src/web/components/image/image.d.ts +9 -0
  245. package/dist/src/web/components/image/image.js +119 -0
  246. package/dist/src/web/components/image/index.d.ts +13 -0
  247. package/dist/src/web/components/image/index.js +77 -0
  248. package/dist/src/web/components/index.d.ts +50 -0
  249. package/dist/src/web/components/index.js +99 -0
  250. package/dist/src/web/components/link/index.d.ts +24 -0
  251. package/dist/src/web/components/link/index.js +71 -0
  252. package/dist/src/web/components/listView/index.d.ts +7 -0
  253. package/dist/src/web/components/listView/index.js +297 -0
  254. package/dist/src/web/components/listView/interface.d.ts +127 -0
  255. package/dist/src/web/components/listView/interface.js +1 -0
  256. package/dist/src/web/components/lottery/index.d.ts +22 -0
  257. package/dist/src/web/components/lottery/index.js +385 -0
  258. package/dist/src/web/components/lottery/lotteryUtil.d.ts +23 -0
  259. package/dist/src/web/components/lottery/lotteryUtil.js +181 -0
  260. package/dist/src/web/components/modal/index.d.ts +17 -0
  261. package/dist/src/web/components/modal/index.js +11 -0
  262. package/dist/src/web/components/modal/modal.h5.d.ts +4 -0
  263. package/dist/src/web/components/modal/modal.h5.js +46 -0
  264. package/dist/src/web/components/modal/modal.pc.d.ts +3 -0
  265. package/dist/src/web/components/modal/modal.pc.js +31 -0
  266. package/dist/src/web/components/navLayout/index.d.ts +61 -0
  267. package/dist/src/web/components/navLayout/index.js +127 -0
  268. package/dist/src/web/components/navigationBar/common.d.ts +15 -0
  269. package/dist/src/web/components/navigationBar/common.js +127 -0
  270. package/dist/src/web/components/navigationBar/h5Menu.d.ts +14 -0
  271. package/dist/src/web/components/navigationBar/h5Menu.js +72 -0
  272. package/dist/src/web/components/navigationBar/horizontalMenu.d.ts +12 -0
  273. package/dist/src/web/components/navigationBar/horizontalMenu.js +99 -0
  274. package/dist/src/web/components/navigationBar/index.d.ts +13 -0
  275. package/dist/src/web/components/navigationBar/index.js +157 -0
  276. package/dist/src/web/components/navigationBar/verticalMenu.d.ts +13 -0
  277. package/dist/src/web/components/navigationBar/verticalMenu.js +38 -0
  278. package/dist/src/web/components/phone/index.d.ts +18 -0
  279. package/dist/src/web/components/phone/index.js +4 -0
  280. package/dist/src/web/components/phoneCode/index.d.ts +18 -0
  281. package/dist/src/web/components/phoneCode/index.js +4 -0
  282. package/dist/src/web/components/picker/datePicker.d.ts +10 -0
  283. package/dist/src/web/components/picker/datePicker.js +31 -0
  284. package/dist/src/web/components/picker/picker.d.ts +6 -0
  285. package/dist/src/web/components/picker/picker.js +45 -0
  286. package/dist/src/web/components/picker/timePicker.d.ts +7 -0
  287. package/dist/src/web/components/picker/timePicker.js +42 -0
  288. package/dist/src/web/components/richText/const.d.ts +1 -0
  289. package/dist/src/web/components/richText/const.js +2 -0
  290. package/dist/src/web/components/richText/index.d.ts +50 -0
  291. package/dist/src/web/components/richText/index.js +351 -0
  292. package/dist/src/web/components/richTextView/index.d.ts +7 -0
  293. package/dist/src/web/components/richTextView/index.js +46 -0
  294. package/dist/src/web/components/scrollView/index.d.ts +26 -0
  295. package/dist/src/web/components/scrollView/index.js +97 -0
  296. package/dist/src/web/components/share/index.d.ts +34 -0
  297. package/dist/src/web/components/share/index.js +4 -0
  298. package/dist/src/web/components/slot/index.d.ts +6 -0
  299. package/dist/src/web/components/slot/index.js +9 -0
  300. package/dist/src/web/components/swiper/index.d.ts +24 -0
  301. package/dist/src/web/components/swiper/index.js +153 -0
  302. package/dist/src/web/components/tabs/index.d.ts +13 -0
  303. package/dist/src/web/components/tabs/index.js +20 -0
  304. package/dist/src/web/components/tabs/tabs.h5.d.ts +4 -0
  305. package/dist/src/web/components/tabs/tabs.h5.js +44 -0
  306. package/dist/src/web/components/tabs/tabs.pc.d.ts +3 -0
  307. package/dist/src/web/components/tabs/tabs.pc.js +40 -0
  308. package/dist/src/web/components/text/index.d.ts +14 -0
  309. package/dist/src/web/components/text/index.js +19 -0
  310. package/dist/src/web/components/uploaderFileView/index.d.ts +10 -0
  311. package/dist/src/web/components/uploaderFileView/index.js +46 -0
  312. package/dist/src/web/components/uploaderView/index.d.ts +17 -0
  313. package/dist/src/web/components/uploaderView/index.js +48 -0
  314. package/dist/src/web/components/userInfo/index.d.ts +26 -0
  315. package/dist/src/web/components/userInfo/index.js +4 -0
  316. package/dist/src/web/components/wedaVideo/index.d.ts +17 -0
  317. package/dist/src/web/components/wedaVideo/index.js +156 -0
  318. package/dist/src/web/index.d.ts +8 -0
  319. package/dist/src/web/index.js +4 -0
  320. package/dist/src/web/utils/classnames.d.ts +2 -0
  321. package/dist/src/web/utils/classnames.js +37 -0
  322. package/dist/src/web/utils/console.d.ts +3 -0
  323. package/dist/src/web/utils/console.js +26 -0
  324. package/dist/src/web/utils/constant.d.ts +23 -0
  325. package/dist/src/web/utils/constant.js +24 -0
  326. package/dist/src/web/utils/debounce.d.ts +2 -0
  327. package/dist/src/web/utils/debounce.js +92 -0
  328. package/dist/src/web/utils/getLocalCounter.d.ts +1 -0
  329. package/dist/src/web/utils/getLocalCounter.js +4 -0
  330. package/dist/src/web/utils/getUserService.d.ts +11 -0
  331. package/dist/src/web/utils/getUserService.js +156 -0
  332. package/dist/src/web/utils/isObjectEqual.d.ts +2 -0
  333. package/dist/src/web/utils/isObjectEqual.js +12 -0
  334. package/dist/src/web/utils/loading-fallback.d.ts +2 -0
  335. package/dist/src/web/utils/loading-fallback.js +2 -0
  336. package/dist/src/web/utils/lodash.d.ts +1 -0
  337. package/dist/src/web/utils/lodash.js +2 -0
  338. package/dist/src/web/utils/platform.d.ts +18 -0
  339. package/dist/src/web/utils/platform.js +193 -0
  340. package/dist/src/web/utils/tcb.d.ts +33 -0
  341. package/dist/src/web/utils/tcb.js +118 -0
  342. package/dist/src/web/utils/tmap.d.ts +3 -0
  343. package/dist/src/web/utils/tmap.js +21 -0
  344. package/dist/src/web/utils/use-cloud-id-temp-url.d.ts +1 -0
  345. package/dist/src/web/utils/use-cloud-id-temp-url.js +15 -0
  346. package/dist/src/web/utils/useSetState.d.ts +1 -0
  347. package/dist/src/web/utils/useSetState.js +8 -0
  348. package/dist/src/web/utils/useSyncValue.d.ts +4 -0
  349. package/dist/src/web/utils/useSyncValue.js +16 -0
  350. package/dist/src/web/utils/weui.d.ts +1 -0
  351. package/dist/src/web/utils/weui.js +2 -0
  352. package/dist/web/components/form/input/index.css +16 -0
  353. package/dist/web/components/form/select/allTimePicker/calendar.css +114 -0
  354. package/dist/web/components/form/select/allTimePicker/index.css +136 -0
  355. package/dist/web/components/form/userOrgSelect/userOrgSelect.css +809 -0
  356. package/package.json +34 -21
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import type { CommonPropsType, ICompRef } from '../../types';
3
+ import './index.css';
4
+ export interface PropsType extends CommonPropsType {
5
+ name?: string;
6
+ value?: any;
7
+ isPureArray?: boolean;
8
+ parent: any;
9
+ }
10
+ declare type TCompRef = ICompRef<{
11
+ addition: () => void;
12
+ remove: (key: string) => void;
13
+ }>;
14
+ export declare const reorderContext: (data: any, name: any, isPureArray: any) => any;
15
+ export declare const newContextItem: (childFormItem: any, name: any, isPureArray: any) => {
16
+ index: number;
17
+ _id: string;
18
+ };
19
+ export declare const changeHandle: ({ type, name, data, childFormItem, isPureArray, params, }: {
20
+ type: any;
21
+ name: any;
22
+ data: any;
23
+ childFormItem: any;
24
+ isPureArray: any;
25
+ params: any;
26
+ }) => any;
27
+ declare const _default: React.ForwardRefExoticComponent<PropsType & React.RefAttributes<TCompRef>>;
28
+ export default _default;
@@ -0,0 +1,173 @@
1
+ import React, { useEffect, forwardRef, useImperativeHandle, useState, useCallback, } from 'react';
2
+ import destr from 'destr';
3
+ import classNames from '../../utils/classnames';
4
+ import { usePlatform, randomStr } from '../../utils/platform';
5
+ import isObjectEqual from '../../utils/isObjectEqual';
6
+ import './index.css';
7
+ export const reorderContext = (data, name, isPureArray) => data.map((i, index) => {
8
+ const item = { ...i };
9
+ Object.keys(i).forEach((j) => {
10
+ var _a;
11
+ if ((_a = item[j]) === null || _a === void 0 ? void 0 : _a.name) {
12
+ item[j].name = isPureArray
13
+ ? `${name}[${index}]`
14
+ : `${name}[${index}].${j}`;
15
+ }
16
+ });
17
+ item.index = index;
18
+ return item;
19
+ });
20
+ export const newContextItem = (childFormItem, name, isPureArray) => {
21
+ const mock = { index: 0, _id: randomStr() };
22
+ childFormItem === null || childFormItem === void 0 ? void 0 : childFormItem.forEach((i) => {
23
+ mock[i] = {
24
+ name: isPureArray ? `${name}[0]` : `${name}[0].${i}`,
25
+ value: null,
26
+ };
27
+ });
28
+ return mock;
29
+ };
30
+ export const changeHandle = ({ type, name, data, childFormItem, isPureArray, params, }) => {
31
+ switch (type) {
32
+ case 'add': {
33
+ const mock = newContextItem(childFormItem, name, isPureArray);
34
+ data.push({ ...mock, _id: randomStr() });
35
+ data = reorderContext(data, name, isPureArray);
36
+ break;
37
+ }
38
+ case 'remove': {
39
+ data.splice(params.index, 1);
40
+ data = reorderContext(data, name, isPureArray);
41
+ break;
42
+ }
43
+ case 'change': {
44
+ data = data.map((i) => {
45
+ const item = { ...i };
46
+ for (const [key, subItem] of Object.entries(item)) {
47
+ if (params.name === (subItem === null || subItem === void 0 ? void 0 : subItem.name)) {
48
+ item[key].value = params === null || params === void 0 ? void 0 : params.value;
49
+ }
50
+ }
51
+ return item;
52
+ });
53
+ break;
54
+ }
55
+ default: {
56
+ break;
57
+ }
58
+ }
59
+ return data;
60
+ };
61
+ export default forwardRef(function FormDetail(props, ref) {
62
+ const { className, id, style, children, events, name, value: initDetailValue, isPureArray, parent, } = props;
63
+ const [defaultValue, setDetailValue] = useState([]);
64
+ const [contextData, setContextData] = useState([]);
65
+ const [childFormItem, setCildFormItem] = useState([]);
66
+ const platform = usePlatform();
67
+ const init = useCallback((defaultValue) => {
68
+ var _a;
69
+ const formDetailItemValue = {};
70
+ let childFormItem = defaultValue[0] ? Object.keys(defaultValue[0]) : [];
71
+ // 纯数组,默认key值为'arrayItem'
72
+ if (isPureArray) {
73
+ childFormItem = ['arrayItem'];
74
+ }
75
+ setCildFormItem(childFormItem);
76
+ let initialValues = [];
77
+ try {
78
+ initialValues = defaultValue.map((i, index) => {
79
+ let item = {};
80
+ if (isPureArray) {
81
+ // eslint-disable-next-line no-prototype-builtins
82
+ const val = (i === null || i === void 0 ? void 0 : i.hasOwnProperty('arrayItem')) ? null : i;
83
+ item['arrayItem'] = { name: `${name}[${index}]`, value: val };
84
+ formDetailItemValue[`${name}[${index}]`] = val;
85
+ }
86
+ else {
87
+ item = { ...i };
88
+ Object.keys(i).forEach((j) => {
89
+ const key = `${name}[${index}].${j}`;
90
+ const val = i[j];
91
+ item[j] = { name: key, value: val };
92
+ formDetailItemValue[key] = val;
93
+ });
94
+ }
95
+ item.index = index;
96
+ item._id = randomStr();
97
+ return item;
98
+ });
99
+ }
100
+ catch (error) {
101
+ console.error(error);
102
+ }
103
+ const mock = newContextItem(childFormItem, name, isPureArray);
104
+ const data = (initialValues === null || initialValues === void 0 ? void 0 : initialValues.length) ? initialValues : [mock];
105
+ setContextData(data);
106
+ (_a = events === null || events === void 0 ? void 0 : events.onDataChange) === null || _a === void 0 ? void 0 : _a.call(events, {
107
+ data,
108
+ });
109
+ // 解决web端,编辑场景不回显初始值的问题
110
+ // eslint-disable-next-line rulesdir/no-timer
111
+ setTimeout(() => {
112
+ if (!isObjectEqual(formDetailItemValue, {})) {
113
+ if ((parent === null || parent === void 0 ? void 0 : parent.setValue) && typeof (parent === null || parent === void 0 ? void 0 : parent.setValue) === 'function') {
114
+ parent === null || parent === void 0 ? void 0 : parent.setValue(formDetailItemValue);
115
+ }
116
+ }
117
+ }, 0);
118
+ }, [events, isPureArray, name, parent]);
119
+ // 初始化context的值
120
+ useEffect(() => {
121
+ if (!isObjectEqual(initDetailValue, defaultValue)) {
122
+ setDetailValue(initDetailValue);
123
+ init(initDetailValue);
124
+ }
125
+ // eslint-disable-next-line react-hooks/exhaustive-deps
126
+ }, [initDetailValue]);
127
+ useEffect(() => {
128
+ init(initDetailValue);
129
+ setDetailValue(initDetailValue);
130
+ // 组件卸载时触发
131
+ return () => {
132
+ var _a;
133
+ (_a = events === null || events === void 0 ? void 0 : events.onDataChange) === null || _a === void 0 ? void 0 : _a.call(events, { data: [] });
134
+ };
135
+ // 只执行一次;
136
+ // eslint-disable-next-line react-hooks/exhaustive-deps
137
+ }, []);
138
+ const onChange = useCallback((type, params) => {
139
+ var _a;
140
+ let data = destr(contextData);
141
+ data = changeHandle({
142
+ type,
143
+ name,
144
+ data,
145
+ childFormItem,
146
+ isPureArray,
147
+ params,
148
+ });
149
+ setContextData(data);
150
+ (_a = events === null || events === void 0 ? void 0 : events.onDataChange) === null || _a === void 0 ? void 0 : _a.call(events, { data });
151
+ }, [childFormItem, contextData, events, isPureArray, name]);
152
+ useImperativeHandle(ref, () => {
153
+ return {
154
+ methods: {
155
+ addition: () => {
156
+ onChange('add', null);
157
+ },
158
+ remove: (params) => {
159
+ onChange('remove', params);
160
+ },
161
+ change: (params) => {
162
+ onChange('change', params);
163
+ },
164
+ },
165
+ };
166
+ }, [onChange]);
167
+ return (React.createElement("div", { className: classNames({
168
+ 'weda-ui': true,
169
+ 'form-detail-wrap': true,
170
+ 'h5-form-detail-wrap': platform === 'h5',
171
+ [className]: className,
172
+ }), id: id, style: style, role: "container", "data-testid": "formDetail" }, children));
173
+ });
@@ -0,0 +1,46 @@
1
+ /// <reference types="react" />
2
+ import './index.css';
3
+ import type { CommonPropsType } from '../../types';
4
+ export declare type INavOption = {
5
+ params: Array<{
6
+ key: string;
7
+ value: string;
8
+ }>;
9
+ paramObj?: any;
10
+ icon: string;
11
+ title: string;
12
+ des: string;
13
+ tapStatus: 'tap' | 'inside' | 'outer';
14
+ insideUrl?: string;
15
+ outerUrl?: string;
16
+ newPage?: boolean;
17
+ withParams?: boolean;
18
+ };
19
+ export interface IGraphicCardPropsType extends CommonPropsType {
20
+ /**
21
+ * 导航配置
22
+ */
23
+ navOption?: Readonly<INavOption[]>;
24
+ titleVisible: boolean;
25
+ titleColor: string;
26
+ titleFontWeight: string;
27
+ titleFontSize: number;
28
+ titleLineHeight: string;
29
+ titleMaxLines: number;
30
+ desColor: string;
31
+ desFontWeight: string;
32
+ desVisible: boolean;
33
+ desFontSize: number;
34
+ desLineHeight: string;
35
+ desMaxLines: number;
36
+ buttonVisible: boolean;
37
+ buttonText: string;
38
+ ColMobile: number;
39
+ ColPC: number;
40
+ percentageVisible: boolean;
41
+ iconWidthSize: string;
42
+ iconHeightSize: string;
43
+ textAlign?: 'start' | 'end' | 'left' | 'right' | 'center' | 'justify';
44
+ imageStyle: any;
45
+ }
46
+ export default function GraphicCard({ navOption, ColMobile, ColPC, iconWidthSize, iconHeightSize, titleVisible, desVisible, buttonVisible, textAlign, className, titleColor, titleFontWeight, titleFontSize, titleLineHeight, titleMaxLines, desColor, desFontWeight, desFontSize, desLineHeight, desMaxLines, buttonText, style, }: IGraphicCardPropsType): JSX.Element;
@@ -0,0 +1,178 @@
1
+ import React, { useMemo } from 'react';
2
+ import './index.css';
3
+ import classNames from '../../utils/classnames';
4
+ import { Row, Col, ConfigProvider, Button, Text } from 'tea-component';
5
+ import { usePlatform } from '../../utils/platform';
6
+ import { IconFont } from 'tdesign-icons-react';
7
+ import Image from '../image';
8
+ import { useWindowSize } from '@react-hookz/web';
9
+ import isObjectEqual from '../../utils/isObjectEqual';
10
+ import { emptyArray } from '../../utils/constant';
11
+ const CLASS_PREFIX = 'weda-graphic-card';
12
+ export default function GraphicCard({ navOption = emptyArray, ColMobile, ColPC, iconWidthSize, iconHeightSize, titleVisible, desVisible, buttonVisible, textAlign, className, titleColor, titleFontWeight, titleFontSize, titleLineHeight, titleMaxLines, desColor, desFontWeight, desFontSize, desLineHeight, desMaxLines, buttonText, style, }) {
13
+ const platform = usePlatform();
14
+ const isH5 = platform === 'h5';
15
+ // 一个栅格的宽度
16
+ const { width } = useWindowSize();
17
+ const singleGrid = useMemo(() => (width - 24 * 2) / 12, [width]);
18
+ // 两次默认值不同, 需要刷新
19
+ const prevNavOptionRef = React.useRef(null);
20
+ const prevColRef = React.useRef(0);
21
+ const cls = classNames({
22
+ [CLASS_PREFIX]: true,
23
+ [className]: className,
24
+ [`${CLASS_PREFIX}-mobile`]: isH5,
25
+ });
26
+ const colCount = useMemo(() => {
27
+ const col = isH5 ? ColMobile : ColPC;
28
+ return col !== null && col !== void 0 ? col : 2;
29
+ }, [ColMobile, ColPC, isH5]);
30
+ const cardList = useMemo(() => {
31
+ const list = [];
32
+ if (prevColRef.current !== colCount ||
33
+ (navOption.length > 0 &&
34
+ !isObjectEqual(prevNavOptionRef.current !== navOption))) {
35
+ list.length = Math.floor(navOption.length / colCount);
36
+ list.forEach((item, index) => {
37
+ list[index] = [];
38
+ });
39
+ navOption.forEach((item, index) => {
40
+ const _index = Math.floor(index / colCount);
41
+ if (!list[_index] || list[_index].length <= 0) {
42
+ // 保证每个col 的数据都是有的,列入总共7个数据,那么第二行的3, 4,5数据是undefined, 占位
43
+ list[_index] = Array(colCount).fill(null);
44
+ }
45
+ const paramObj = {};
46
+ if (item === null || item === void 0 ? void 0 : item.params) {
47
+ for (const info of item.params) {
48
+ paramObj[info.key] = info.value;
49
+ }
50
+ }
51
+ item.paramObj = paramObj;
52
+ list[_index][index - _index * colCount] = item;
53
+ prevNavOptionRef.current = [...navOption];
54
+ prevColRef.current = colCount;
55
+ });
56
+ }
57
+ return list;
58
+ }, [colCount, navOption]);
59
+ const elementStyle = document.createElement('body').style;
60
+ const vendor = (() => {
61
+ const transformNames = {
62
+ webkit: 'webkitTransform',
63
+ Moz: 'MozTransform',
64
+ O: 'OTransform',
65
+ ms: 'msTransform',
66
+ standard: 'transform',
67
+ };
68
+ for (const key in transformNames) {
69
+ if (elementStyle[transformNames[key]] !== undefined) {
70
+ return key;
71
+ }
72
+ }
73
+ return false;
74
+ })();
75
+ function prefixStyle(style) {
76
+ if (vendor === false) {
77
+ return false;
78
+ }
79
+ if (vendor === 'standard') {
80
+ return style;
81
+ }
82
+ return '-' + vendor + style.charAt(0).toUpperCase() + style.substr(1);
83
+ }
84
+ const boxStyle = prefixStyle('-box');
85
+ //标题样式
86
+ const titleStyle = {
87
+ display: `${boxStyle}`,
88
+ WebkitLineClamp: `${titleMaxLines ? titleMaxLines : 'inherit'}`,
89
+ overflow: 'hidden',
90
+ color: `${titleColor}`,
91
+ fontWeight: `${titleFontWeight}`,
92
+ fontSize: `${titleFontSize}` + 'px',
93
+ textAlign: `${textAlign}`,
94
+ lineHeight: `${titleLineHeight == 'auto' ? 'normal' : titleLineHeight}`,
95
+ };
96
+ const desStyle = {
97
+ display: `${boxStyle}`,
98
+ WebkitLineClamp: `${desMaxLines ? desMaxLines : 'inherit'}`,
99
+ overflow: 'hidden',
100
+ color: `${desColor}`,
101
+ fontWeight: `${desFontWeight}`,
102
+ fontSize: `${desFontSize}` + 'px',
103
+ textAlign: `${textAlign}`,
104
+ lineHeight: `${desLineHeight == 'auto' ? 'normal' : desLineHeight}`,
105
+ };
106
+ // 图片高度: 100% 基础下 H5: 1列 200px;2列 98px PC: 3列 220px 4列 162px
107
+ const imageStyle = React.useMemo(() => {
108
+ let width = '100%';
109
+ let height = platform === 'h5' ? '200' : '220';
110
+ if (platform === 'h5' && ColMobile === 2) {
111
+ height = '98';
112
+ }
113
+ if (platform !== 'h5' && ColPC === 4) {
114
+ height = '162';
115
+ }
116
+ const numReg = /^\d+$/;
117
+ width = numReg.test(iconWidthSize) ? iconWidthSize + 'px' : iconWidthSize;
118
+ height = numReg.test(iconHeightSize)
119
+ ? iconHeightSize + 'px' //纯数字
120
+ : iconHeightSize.indexOf('%') == -1
121
+ ? iconHeightSize
122
+ : (Number(height) * parseInt(iconHeightSize)) / 100 + 'px';
123
+ return { width, height };
124
+ }, [platform, ColMobile, ColPC, iconWidthSize, iconHeightSize]);
125
+ const tapTo = (colInfo = navOption[0]) => {
126
+ switch (colInfo === null || colInfo === void 0 ? void 0 : colInfo.tapStatus) {
127
+ case 'tap':
128
+ return null;
129
+ case 'inside':
130
+ if (colInfo.insideUrl) {
131
+ app.navigateTo({
132
+ mode: 'weDa',
133
+ pageId: colInfo.insideUrl,
134
+ params: (colInfo === null || colInfo === void 0 ? void 0 : colInfo.withParams) && (colInfo === null || colInfo === void 0 ? void 0 : colInfo.params.length) > 0
135
+ ? colInfo.paramObj
136
+ : null,
137
+ });
138
+ }
139
+ break;
140
+ //return renderCancel();
141
+ case 'outer':
142
+ if (colInfo.newPage) {
143
+ colInfo.outerUrl ? window.open(colInfo.outerUrl) : false;
144
+ }
145
+ else {
146
+ colInfo.outerUrl ? (window.location.href = colInfo.outerUrl) : false;
147
+ }
148
+ break;
149
+ default:
150
+ return null;
151
+ }
152
+ };
153
+ return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
154
+ React.createElement("div", { className: cls, "data-testid": "graphicCard", style: style },
155
+ React.createElement("div", { className: `${CLASS_PREFIX}__wrapper` }, cardList.map((row, rowIndex) => {
156
+ return (React.createElement(Row, { className: `${CLASS_PREFIX}__row`, key: rowIndex },
157
+ React.createElement(React.Fragment, null, row &&
158
+ row.map((col, colIndex) => {
159
+ return (
160
+ // 每列内容左右间距为0.1栅格列宽
161
+ React.createElement(Col, { style: {
162
+ width: `${(1 / colCount) * 100}%`,
163
+ padding: `0 ${singleGrid * 0.1}px`,
164
+ cursor: (col === null || col === void 0 ? void 0 : col.tapStatus) != 'tap' ? 'pointer' : 'auto',
165
+ }, className: `${CLASS_PREFIX}__col ${CLASS_PREFIX}__col--${textAlign}`, key: colIndex },
166
+ React.createElement("div", { className: "wedatea2td-grid__box", "data-testid": `${colIndex}_click`, onClick: () => tapTo(col) },
167
+ React.createElement("div", { className: `${CLASS_PREFIX}__col-body` },
168
+ col && (React.createElement("div", { className: `${CLASS_PREFIX}__icon`, style: imageStyle },
169
+ React.createElement(Image, { mode: 'scaleToFill', lazyLoad: false, maskClosable: false, imgPreview: false, fit: 'cover', alt: '', src: col === null || col === void 0 ? void 0 : col.icon, className: `${CLASS_PREFIX}__img` }))),
170
+ React.createElement("div", { className: `${CLASS_PREFIX}__detail` },
171
+ titleVisible && (col === null || col === void 0 ? void 0 : col.title) && (React.createElement("div", { className: `${CLASS_PREFIX}__title`, style: titleStyle }, col === null || col === void 0 ? void 0 : col.title)),
172
+ desVisible && (col === null || col === void 0 ? void 0 : col.des) && (React.createElement("div", { className: `${CLASS_PREFIX}__desc`, style: desStyle }, col === null || col === void 0 ? void 0 : col.des)))),
173
+ buttonVisible && col && (React.createElement(Button, { type: "link", className: `${CLASS_PREFIX}__btn` },
174
+ React.createElement(Text, { className: `${CLASS_PREFIX}__btn--text` }, buttonText),
175
+ React.createElement(IconFont, { name: "arrow-right", className: `${CLASS_PREFIX}__btn-icon` }))))));
176
+ }))));
177
+ })))));
178
+ }
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import { PropsType } from './index';
3
+ interface ImageInnerPropsType extends Omit<PropsType, 'fit' | 'mode'> {
4
+ objectFit: React.CSSProperties['objectFit'];
5
+ isError: boolean;
6
+ setIsError: React.Dispatch<React.SetStateAction<boolean>>;
7
+ }
8
+ export declare function ImageInner({ objectFit, style, className, alt, src, isError, setIsError, events, lazyLoad, maskClosable, imgPreview, }: ImageInnerPropsType): JSX.Element;
9
+ export {};
@@ -0,0 +1,119 @@
1
+ import * as React from 'react';
2
+ import { ConfigProvider, ImagePreview } from 'tea-component';
3
+ import { usePlatform } from '../../utils/platform';
4
+ import { useGesture } from '@use-gesture/react';
5
+ export function ImageInner({ objectFit, style, className, alt, src, isError, setIsError, events, lazyLoad, maskClosable, imgPreview, }) {
6
+ const platform = usePlatform();
7
+ const [imgShow, setImgShow] = React.useState(false);
8
+ const onMaskClick = () => {
9
+ if (maskClosable) {
10
+ setImgShow(false);
11
+ }
12
+ };
13
+ const [showHeight, setShowHeight] = React.useState(0);
14
+ const realWidth = React.useRef(0);
15
+ const realHeight = React.useRef(0);
16
+ const [offsetHeight, setOffsetHeight] = React.useState(0);
17
+ const [translateX, setTranslateX] = React.useState(0);
18
+ const [translateY, setTranslateY] = React.useState(0);
19
+ const [previewScale, setPreviewScale] = React.useState(1);
20
+ React.useEffect(() => {
21
+ // 防止触发浏览器的放大缩小
22
+ const handler = (e) => e.preventDefault();
23
+ document.addEventListener('gesturestart', handler);
24
+ document.addEventListener('gesturechange', handler);
25
+ return () => {
26
+ document.removeEventListener('gesturestart', handler);
27
+ document.removeEventListener('gesturechange', handler);
28
+ };
29
+ }, []);
30
+ const bind = useGesture({
31
+ onClick: ({ event }) => {
32
+ // 防止冒泡出发关闭预览
33
+ event.stopPropagation();
34
+ },
35
+ onPinch: ({ offset }) => {
36
+ const [s] = offset;
37
+ setPreviewScale(s);
38
+ },
39
+ onDrag: ({ offset, event }) => {
40
+ event.stopPropagation();
41
+ const [x, y] = offset;
42
+ setTranslateX(x);
43
+ setTranslateY(y);
44
+ },
45
+ }, {
46
+ drag: {
47
+ delay: true,
48
+ preventDefault: true,
49
+ },
50
+ pinch: {
51
+ scaleBounds: { min: 0.6, max: 5 },
52
+ pointer: {
53
+ touch: true,
54
+ },
55
+ },
56
+ });
57
+ if (platform === 'h5' || !imgPreview || isError) {
58
+ return (React.createElement(React.Fragment, null,
59
+ React.createElement("img", { style: {
60
+ objectFit,
61
+ ...style,
62
+ }, className: className, alt: alt, src: src, onLoad: (e) => {
63
+ const img = e.target;
64
+ const { naturalHeight, naturalWidth } = img;
65
+ realHeight.current = naturalHeight;
66
+ realWidth.current = naturalWidth;
67
+ setIsError(false);
68
+ events.load && events.load({}, { originEvent: e });
69
+ }, onError: (e) => {
70
+ setIsError(true);
71
+ events.error && events.error({}, { originEvent: e });
72
+ }, onClick: (e) => {
73
+ if (imgPreview && !isError) {
74
+ setTranslateX(0);
75
+ setTranslateY(0);
76
+ setPreviewScale(1);
77
+ const windowHeight = window.innerHeight;
78
+ const windowWidth = window.innerWidth;
79
+ let ratio = realWidth.current / realHeight.current;
80
+ if (Number.isNaN(ratio)) {
81
+ ratio = 1;
82
+ }
83
+ const height = windowWidth / ratio;
84
+ setOffsetHeight(windowHeight / 2 - height / 2);
85
+ setShowHeight(height);
86
+ setImgShow(true);
87
+ }
88
+ events.tap && events.tap({}, { originEvent: e });
89
+ }, loading: lazyLoad ? 'lazy' : undefined }),
90
+ imgShow && (React.createElement("div", { className: "weda-img-mask", onClick: onMaskClick },
91
+ React.createElement("div", { onClick: () => setImgShow(false), className: "weda-img-modal-close-btn" },
92
+ React.createElement("i", { className: "weui-icon-clear", style: { color: 'white' } })),
93
+ React.createElement("div", { ...bind(), className: "weda-img-preview", style: {
94
+ touchAction: 'none',
95
+ backgroundImage: `url(${src})`,
96
+ width: '100%',
97
+ height: showHeight,
98
+ marginTop: offsetHeight,
99
+ transform: `translate(${translateX}px, ${translateY}px) scale(${previewScale})`,
100
+ } })))));
101
+ }
102
+ else {
103
+ return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
104
+ React.createElement(ImagePreview, { previewSrc: src, maskClosable: maskClosable, className: className, style: { ...style, objectFit } }, (open) => (React.createElement("img", { style: {
105
+ objectFit,
106
+ cursor: 'zoom-in',
107
+ ...style,
108
+ }, className: className, alt: alt, src: src, onLoad: (e) => {
109
+ setIsError(false);
110
+ events.load && events.load({}, { originEvent: e });
111
+ }, onError: (e) => {
112
+ setIsError(true);
113
+ events.error && events.error({}, { originEvent: e });
114
+ }, loading: lazyLoad ? 'lazy' : undefined, onClick: (e) => {
115
+ open();
116
+ events.tap && events.tap({}, { originEvent: e });
117
+ } })))));
118
+ }
119
+ }
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import './index.css';
3
+ import type { CommonPropsType } from '../../types';
4
+ declare type TMode = 'scaleToFill' | 'aspectFit' | 'aspectFill' | 'widthFix' | 'heightFix' | 'top' | 'bottom' | 'center' | 'left' | 'right' | 'top left' | 'top right' | 'bottom left' | 'bottom right';
5
+ export interface PropsType extends CommonPropsType, Pick<HTMLImageElement, 'src' | 'alt'> {
6
+ mode: TMode;
7
+ lazyLoad: boolean;
8
+ maskClosable: boolean;
9
+ imgPreview: boolean;
10
+ fit: React.CSSProperties['objectFit'] | ('widthFix' | 'heightFix');
11
+ }
12
+ export default function Image({ className, events, style, src, alt, mode, lazyLoad, imgPreview, maskClosable, fit, }: PropsType): JSX.Element;
13
+ export {};
@@ -0,0 +1,77 @@
1
+ import * as React from 'react';
2
+ import { useState, useMemo } from 'react';
3
+ import classNames from '../../utils/classnames';
4
+ import './index.css';
5
+ import { ImageInner } from './image';
6
+ import { emptyObject } from '../../utils/constant';
7
+ import { useTempUrl } from '../../utils/use-cloud-id-temp-url';
8
+ export default function Image({
9
+ // 系统属性
10
+ className, events = emptyObject, style,
11
+ // 组件属性
12
+ src, alt, mode, lazyLoad, imgPreview, maskClosable, fit, }) {
13
+ const [isError, setIsError] = useState(false);
14
+ const cls = classNames({
15
+ 'weda-ui': true,
16
+ 'weda-image': true,
17
+ 'weda-image-error': isError,
18
+ [className]: className,
19
+ });
20
+ const objectFit = fit || getObjectFitByWxImageMode(mode);
21
+ const { data: realSrc } = useTempUrl(src);
22
+ /**
23
+ * 模拟小程序的widthFix、heightFix模式
24
+ */
25
+ const realFit = useMemo(() => {
26
+ if (objectFit === 'widthFix' || objectFit === 'heightFix') {
27
+ return 'scale-down';
28
+ }
29
+ else {
30
+ return objectFit;
31
+ }
32
+ }, [objectFit]);
33
+ const realStyle = useMemo(() => {
34
+ if (objectFit === 'widthFix') {
35
+ return {
36
+ ...style,
37
+ height: 'auto',
38
+ };
39
+ }
40
+ else if (objectFit === 'heightFix') {
41
+ return {
42
+ ...style,
43
+ width: 'auto',
44
+ };
45
+ }
46
+ else {
47
+ return style;
48
+ }
49
+ }, [objectFit, style]);
50
+ return src === realSrc || (realSrc !== undefined && src !== realSrc) ? (React.createElement(ImageInner, { objectFit: realFit, style: realStyle, className: cls, alt: alt, src: realSrc, isError: isError, setIsError: setIsError, events: events, lazyLoad: lazyLoad, imgPreview: imgPreview, maskClosable: maskClosable })) : null;
51
+ }
52
+ function getObjectFitByWxImageMode(mode) {
53
+ const array = [
54
+ {
55
+ mode: 'scaleToFill',
56
+ h5: 'fill',
57
+ },
58
+ {
59
+ mode: 'aspectFit',
60
+ h5: 'contain',
61
+ },
62
+ {
63
+ mode: 'aspectFill',
64
+ h5: 'cover',
65
+ },
66
+ {
67
+ mode: 'widthFix',
68
+ h5: 'cover',
69
+ },
70
+ {
71
+ mode: 'heightFix',
72
+ h5: 'contain',
73
+ },
74
+ ];
75
+ const item = array.find((item) => item.mode === mode);
76
+ return item === null || item === void 0 ? void 0 : item.h5;
77
+ }