@cloudbase/weda-ui 3.1.0 → 3.1.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 (325) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/configs/actions/showModal.json +48 -0
  3. package/dist/configs/actions/showToast.json +41 -0
  4. package/dist/configs/components/auth.json +16 -0
  5. package/dist/configs/components/button.json +239 -0
  6. package/dist/configs/components/calendar.json +81 -0
  7. package/dist/configs/components/carousel.json +292 -0
  8. package/dist/configs/components/chart/bar.json +721 -0
  9. package/dist/configs/components/chart/line.json +674 -0
  10. package/dist/configs/components/chart/pie.json +494 -0
  11. package/dist/configs/components/chart/statisticsCard.json +376 -0
  12. package/dist/configs/components/container.json +50 -0
  13. package/dist/configs/components/dataView.json +239 -0
  14. package/dist/configs/components/drawer.json +115 -0
  15. package/dist/configs/components/form/checkbox.json +178 -0
  16. package/dist/configs/components/form/form.json +45 -0
  17. package/dist/configs/components/form/input.json +154 -0
  18. package/dist/configs/components/form/location.json +248 -0
  19. package/dist/configs/components/form/radio.json +203 -0
  20. package/dist/configs/components/form/richText.json +125 -0
  21. package/dist/configs/components/form/select.json +430 -0
  22. package/dist/configs/components/form/switch.json +58 -0
  23. package/dist/configs/components/form/textarea.json +116 -0
  24. package/dist/configs/components/form/tips.json +34 -0
  25. package/dist/configs/components/form/uploader.json +171 -0
  26. package/dist/configs/components/form/uploaderFile.json +158 -0
  27. package/dist/configs/components/graphicCard.json +413 -0
  28. package/dist/configs/components/image.json +187 -0
  29. package/dist/configs/components/link.json +79 -0
  30. package/dist/configs/components/listView.json +370 -0
  31. package/dist/configs/components/lottery.json +163 -0
  32. package/dist/configs/components/modal.json +72 -0
  33. package/dist/configs/components/navLayout.json +368 -0
  34. package/dist/configs/components/navigationBar.json +62 -0
  35. package/dist/configs/components/richtextview.json +26 -0
  36. package/dist/configs/components/scrollVeiw.json +253 -0
  37. package/dist/configs/components/slot.json +17 -0
  38. package/dist/configs/components/swiper.json +90 -0
  39. package/dist/configs/components/tabs.json +121 -0
  40. package/dist/configs/components/text.json +95 -0
  41. package/dist/configs/components/wedaVideo.json +89 -0
  42. package/dist/configs/components/wxOpenApi/phone.json +127 -0
  43. package/dist/configs/components/wxOpenApi/phoneCode.json +109 -0
  44. package/dist/configs/components/wxOpenApi/share.json +157 -0
  45. package/dist/configs/components/wxOpenApi/userInfo.json +156 -0
  46. package/dist/configs/index.d.ts +97 -0
  47. package/dist/configs/index.js +105 -0
  48. package/dist/docs/common/format.d.ts +13 -0
  49. package/dist/docs/common/format.js +103 -0
  50. package/dist/docs/common/tableView.d.ts +30 -0
  51. package/dist/docs/common/tableView.js +159 -0
  52. package/dist/index.d.ts +2 -0
  53. package/dist/index.js +3 -0
  54. package/dist/setupTests.d.ts +1 -0
  55. package/dist/setupTests.js +14 -0
  56. package/dist/web/actions/index.d.ts +2 -0
  57. package/dist/web/actions/index.js +2 -0
  58. package/dist/web/actions/showModal/index.d.ts +3 -0
  59. package/dist/web/actions/showModal/index.js +66 -0
  60. package/dist/web/actions/showToast/index.d.ts +1 -0
  61. package/dist/web/actions/showToast/index.js +3 -0
  62. package/dist/web/components/auth/index.d.ts +10 -0
  63. package/dist/web/components/auth/index.js +37 -0
  64. package/dist/web/components/button/index.css +27 -0
  65. package/dist/web/components/button/index.d.ts +32 -0
  66. package/dist/web/components/button/index.js +48 -0
  67. package/dist/web/components/calendar/index.css +416 -0
  68. package/dist/web/components/calendar/index.d.ts +19 -0
  69. package/dist/web/components/calendar/index.js +181 -0
  70. package/dist/web/components/calendar/util.d.ts +13 -0
  71. package/dist/web/components/calendar/util.js +74 -0
  72. package/dist/web/components/carousel/index.css +119 -0
  73. package/dist/web/components/carousel/index.d.ts +41 -0
  74. package/dist/web/components/carousel/index.js +240 -0
  75. package/dist/web/components/chart/bar/index.d.ts +41 -0
  76. package/dist/web/components/chart/bar/index.js +56 -0
  77. package/dist/web/components/chart/common/config/bar.d.ts +48 -0
  78. package/dist/web/components/chart/common/config/bar.js +49 -0
  79. package/dist/web/components/chart/common/config/global.d.ts +13 -0
  80. package/dist/web/components/chart/common/config/global.js +16 -0
  81. package/dist/web/components/chart/common/config/line.d.ts +46 -0
  82. package/dist/web/components/chart/common/config/line.js +49 -0
  83. package/dist/web/components/chart/common/config/pie.d.ts +29 -0
  84. package/dist/web/components/chart/common/config/pie.js +36 -0
  85. package/dist/web/components/chart/common/core/eChartBar.d.ts +32 -0
  86. package/dist/web/components/chart/common/core/eChartBar.js +196 -0
  87. package/dist/web/components/chart/common/core/eChartBase.d.ts +128 -0
  88. package/dist/web/components/chart/common/core/eChartBase.js +346 -0
  89. package/dist/web/components/chart/common/core/eChartLine.d.ts +28 -0
  90. package/dist/web/components/chart/common/core/eChartLine.js +168 -0
  91. package/dist/web/components/chart/common/core/eChartPie.d.ts +28 -0
  92. package/dist/web/components/chart/common/core/eChartPie.js +132 -0
  93. package/dist/web/components/chart/common/core/type.d.ts +35 -0
  94. package/dist/web/components/chart/common/core/type.js +9 -0
  95. package/dist/web/components/chart/common/echarts.d.ts +2 -0
  96. package/dist/web/components/chart/common/echarts.js +24 -0
  97. package/dist/web/components/chart/common/useChart.d.ts +8 -0
  98. package/dist/web/components/chart/common/useChart.js +60 -0
  99. package/dist/web/components/chart/line/index.d.ts +39 -0
  100. package/dist/web/components/chart/line/index.js +53 -0
  101. package/dist/web/components/chart/pie/index.d.ts +27 -0
  102. package/dist/web/components/chart/pie/index.js +40 -0
  103. package/dist/web/components/chart/statisticsCard/index.css +63 -0
  104. package/dist/web/components/chart/statisticsCard/index.d.ts +85 -0
  105. package/dist/web/components/chart/statisticsCard/index.js +203 -0
  106. package/dist/web/components/chart/statisticsCard/interface.d.ts +13 -0
  107. package/dist/web/components/chart/statisticsCard/interface.js +1 -0
  108. package/dist/web/components/container/index.d.ts +6 -0
  109. package/dist/web/components/container/index.js +6 -0
  110. package/dist/web/components/dataView/index.d.ts +6 -0
  111. package/dist/web/components/dataView/index.js +8 -0
  112. package/dist/web/components/dataView/interface.d.ts +5 -0
  113. package/dist/web/components/dataView/interface.js +1 -0
  114. package/dist/web/components/drawer/index.d.ts +13 -0
  115. package/dist/web/components/drawer/index.js +12 -0
  116. package/dist/web/components/form/checkbox/index.d.ts +13 -0
  117. package/dist/web/components/form/checkbox/index.js +167 -0
  118. package/dist/web/components/form/enumSelect/MultipleSelect.d.ts +78 -0
  119. package/dist/web/components/form/enumSelect/MultipleSelect.js +52 -0
  120. package/dist/web/components/form/enumSelect/NormalSelect.d.ts +83 -0
  121. package/dist/web/components/form/enumSelect/NormalSelect.js +52 -0
  122. package/dist/web/components/form/enumSelect/SelectContainer.d.ts +16 -0
  123. package/dist/web/components/form/enumSelect/SelectContainer.js +30 -0
  124. package/dist/web/components/form/enumSelect/index.d.ts +82 -0
  125. package/dist/web/components/form/enumSelect/index.js +6 -0
  126. package/dist/web/components/form/enumSelect/props/defaultProps.d.ts +34 -0
  127. package/dist/web/components/form/enumSelect/props/defaultProps.js +40 -0
  128. package/dist/web/components/form/enumSelect/props/propsTypes.d.ts +39 -0
  129. package/dist/web/components/form/enumSelect/props/propsTypes.js +47 -0
  130. package/dist/web/components/form/form/index.css +9 -0
  131. package/dist/web/components/form/form/index.d.ts +13 -0
  132. package/dist/web/components/form/form/index.js +31 -0
  133. package/dist/web/components/form/formcell/index.css +85 -0
  134. package/dist/web/components/form/formcell/index.d.ts +8 -0
  135. package/dist/web/components/form/formcell/index.js +40 -0
  136. package/dist/web/components/form/input/index.css +40 -0
  137. package/dist/web/components/form/input/index.d.ts +14 -0
  138. package/dist/web/components/form/input/index.js +86 -0
  139. package/dist/web/components/form/location/common/mapChoose.css +477 -0
  140. package/dist/web/components/form/location/common/mapChoose.d.ts +15 -0
  141. package/dist/web/components/form/location/common/mapChoose.js +431 -0
  142. package/dist/web/components/form/location/common/mapView.d.ts +19 -0
  143. package/dist/web/components/form/location/common/mapView.js +170 -0
  144. package/dist/web/components/form/location/common/propsConfig.d.ts +62 -0
  145. package/dist/web/components/form/location/common/propsConfig.js +52 -0
  146. package/dist/web/components/form/location/common/selectModal.css +45 -0
  147. package/dist/web/components/form/location/common/selectModal.d.ts +21 -0
  148. package/dist/web/components/form/location/common/selectModal.js +44 -0
  149. package/dist/web/components/form/location/common/useLocationInfo.d.ts +34 -0
  150. package/dist/web/components/form/location/common/useLocationInfo.js +88 -0
  151. package/dist/web/components/form/location/components/LocationH5/index.css +100 -0
  152. package/dist/web/components/form/location/components/LocationH5/location.h5.d.ts +8 -0
  153. package/dist/web/components/form/location/components/LocationH5/location.h5.js +347 -0
  154. package/dist/web/components/form/location/components/LocationPC/Header.d.ts +12 -0
  155. package/dist/web/components/form/location/components/LocationPC/Header.js +43 -0
  156. package/dist/web/components/form/location/components/LocationPC/index.css +40 -0
  157. package/dist/web/components/form/location/components/LocationPC/location.PC.d.ts +8 -0
  158. package/dist/web/components/form/location/components/LocationPC/location.PC.js +259 -0
  159. package/dist/web/components/form/location/constants.d.ts +2 -0
  160. package/dist/web/components/form/location/constants.js +3 -0
  161. package/dist/web/components/form/location/index.css +13 -0
  162. package/dist/web/components/form/location/index.d.ts +1 -0
  163. package/dist/web/components/form/location/index.js +17 -0
  164. package/dist/web/components/form/radio/index.css +12 -0
  165. package/dist/web/components/form/radio/index.d.ts +11 -0
  166. package/dist/web/components/form/radio/index.js +115 -0
  167. package/dist/web/components/form/renderDecorator.d.ts +6 -0
  168. package/dist/web/components/form/renderDecorator.js +20 -0
  169. package/dist/web/components/form/select/h5.d.ts +16 -0
  170. package/dist/web/components/form/select/h5.js +502 -0
  171. package/dist/web/components/form/select/index.css +27 -0
  172. package/dist/web/components/form/select/index.d.ts +65 -0
  173. package/dist/web/components/form/select/index.js +299 -0
  174. package/dist/web/components/form/select/region/index.d.ts +6 -0
  175. package/dist/web/components/form/select/region/index.js +147 -0
  176. package/dist/web/components/form/select/time.d.ts +9 -0
  177. package/dist/web/components/form/select/time.js +146 -0
  178. package/dist/web/components/form/select/year.d.ts +7 -0
  179. package/dist/web/components/form/select/year.js +72 -0
  180. package/dist/web/components/form/switch/index.d.ts +6 -0
  181. package/dist/web/components/form/switch/index.js +57 -0
  182. package/dist/web/components/form/textarea/index.css +11 -0
  183. package/dist/web/components/form/textarea/index.d.ts +12 -0
  184. package/dist/web/components/form/textarea/index.js +66 -0
  185. package/dist/web/components/form/tips/index.css +4 -0
  186. package/dist/web/components/form/tips/index.d.ts +8 -0
  187. package/dist/web/components/form/tips/index.js +17 -0
  188. package/dist/web/components/form/uploader/index.css +118 -0
  189. package/dist/web/components/form/uploader/index.d.ts +3 -0
  190. package/dist/web/components/form/uploader/index.js +42 -0
  191. package/dist/web/components/form/uploader/uploader.h5.d.ts +19 -0
  192. package/dist/web/components/form/uploader/uploader.h5.js +201 -0
  193. package/dist/web/components/form/uploader/uploader.pc.d.ts +29 -0
  194. package/dist/web/components/form/uploader/uploader.pc.js +182 -0
  195. package/dist/web/components/form/uploaderFile/index.css +422 -0
  196. package/dist/web/components/form/uploaderFile/index.d.ts +4 -0
  197. package/dist/web/components/form/uploaderFile/index.js +19 -0
  198. package/dist/web/components/form/uploaderFile/uploadFile.h5.d.ts +23 -0
  199. package/dist/web/components/form/uploaderFile/uploadFile.h5.js +315 -0
  200. package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +24 -0
  201. package/dist/web/components/form/uploaderFile/uploadFile.pc.js +290 -0
  202. package/dist/web/components/graphicCard/index.css +159 -0
  203. package/dist/web/components/graphicCard/index.d.ts +31 -0
  204. package/dist/web/components/graphicCard/index.js +166 -0
  205. package/dist/web/components/image/image.d.ts +9 -0
  206. package/dist/web/components/image/image.js +119 -0
  207. package/dist/web/components/image/index.css +54 -0
  208. package/dist/web/components/image/index.d.ts +13 -0
  209. package/dist/web/components/image/index.js +91 -0
  210. package/dist/web/components/index.d.ts +47 -0
  211. package/dist/web/components/index.js +94 -0
  212. package/dist/web/components/link/index.css +8 -0
  213. package/dist/web/components/link/index.d.ts +24 -0
  214. package/dist/web/components/link/index.js +71 -0
  215. package/dist/web/components/listView/index.css +143 -0
  216. package/dist/web/components/listView/index.d.ts +7 -0
  217. package/dist/web/components/listView/index.js +262 -0
  218. package/dist/web/components/listView/interface.d.ts +122 -0
  219. package/dist/web/components/listView/interface.js +1 -0
  220. package/dist/web/components/lottery/index.css +359 -0
  221. package/dist/web/components/lottery/index.d.ts +22 -0
  222. package/dist/web/components/lottery/index.js +390 -0
  223. package/dist/web/components/lottery/lotteryUtil.d.ts +23 -0
  224. package/dist/web/components/lottery/lotteryUtil.js +180 -0
  225. package/dist/web/components/modal/h5.css +53 -0
  226. package/dist/web/components/modal/index.d.ts +17 -0
  227. package/dist/web/components/modal/index.js +11 -0
  228. package/dist/web/components/modal/modal.h5.d.ts +4 -0
  229. package/dist/web/components/modal/modal.h5.js +46 -0
  230. package/dist/web/components/modal/modal.pc.d.ts +3 -0
  231. package/dist/web/components/modal/modal.pc.js +31 -0
  232. package/dist/web/components/navLayout/index.css +332 -0
  233. package/dist/web/components/navLayout/index.d.ts +46 -0
  234. package/dist/web/components/navLayout/index.js +116 -0
  235. package/dist/web/components/navigationBar/common.d.ts +15 -0
  236. package/dist/web/components/navigationBar/common.js +127 -0
  237. package/dist/web/components/navigationBar/h5Menu.d.ts +14 -0
  238. package/dist/web/components/navigationBar/h5Menu.js +72 -0
  239. package/dist/web/components/navigationBar/horizontalMenu.d.ts +12 -0
  240. package/dist/web/components/navigationBar/horizontalMenu.js +99 -0
  241. package/dist/web/components/navigationBar/index.css +762 -0
  242. package/dist/web/components/navigationBar/index.d.ts +13 -0
  243. package/dist/web/components/navigationBar/index.js +157 -0
  244. package/dist/web/components/navigationBar/verticalMenu.d.ts +13 -0
  245. package/dist/web/components/navigationBar/verticalMenu.js +38 -0
  246. package/dist/web/components/phone/index.d.ts +18 -0
  247. package/dist/web/components/phone/index.js +4 -0
  248. package/dist/web/components/phoneCode/index.d.ts +18 -0
  249. package/dist/web/components/phoneCode/index.js +4 -0
  250. package/dist/web/components/picker/datePicker.d.ts +10 -0
  251. package/dist/web/components/picker/datePicker.js +31 -0
  252. package/dist/web/components/picker/picker.d.ts +6 -0
  253. package/dist/web/components/picker/picker.js +45 -0
  254. package/dist/web/components/picker/timePicker.d.ts +7 -0
  255. package/dist/web/components/picker/timePicker.js +42 -0
  256. package/dist/web/components/richText/const.d.ts +1 -0
  257. package/dist/web/components/richText/const.js +2 -0
  258. package/dist/web/components/richText/index.css +93 -0
  259. package/dist/web/components/richText/index.d.ts +51 -0
  260. package/dist/web/components/richText/index.js +295 -0
  261. package/dist/web/components/richTextView/index.css +63 -0
  262. package/dist/web/components/richTextView/index.d.ts +7 -0
  263. package/dist/web/components/richTextView/index.js +44 -0
  264. package/dist/web/components/scrollView/index.d.ts +27 -0
  265. package/dist/web/components/scrollView/index.js +95 -0
  266. package/dist/web/components/share/index.d.ts +34 -0
  267. package/dist/web/components/share/index.js +4 -0
  268. package/dist/web/components/slot/index.d.ts +6 -0
  269. package/dist/web/components/slot/index.js +9 -0
  270. package/dist/web/components/swiper/index.css +106 -0
  271. package/dist/web/components/swiper/index.d.ts +24 -0
  272. package/dist/web/components/swiper/index.js +149 -0
  273. package/dist/web/components/tabs/index.css +64 -0
  274. package/dist/web/components/tabs/index.d.ts +13 -0
  275. package/dist/web/components/tabs/index.js +15 -0
  276. package/dist/web/components/tabs/tabs.h5.d.ts +4 -0
  277. package/dist/web/components/tabs/tabs.h5.js +42 -0
  278. package/dist/web/components/tabs/tabs.pc.d.ts +3 -0
  279. package/dist/web/components/tabs/tabs.pc.js +40 -0
  280. package/dist/web/components/text/index.css +26 -0
  281. package/dist/web/components/text/index.d.ts +14 -0
  282. package/dist/web/components/text/index.js +17 -0
  283. package/dist/web/components/uploaderFileView/index.css +11 -0
  284. package/dist/web/components/uploaderFileView/index.d.ts +10 -0
  285. package/dist/web/components/uploaderFileView/index.js +61 -0
  286. package/dist/web/components/uploaderView/index.css +31 -0
  287. package/dist/web/components/uploaderView/index.d.ts +17 -0
  288. package/dist/web/components/uploaderView/index.js +48 -0
  289. package/dist/web/components/userInfo/index.d.ts +26 -0
  290. package/dist/web/components/userInfo/index.js +4 -0
  291. package/dist/web/components/wedaVideo/index.css +42 -0
  292. package/dist/web/components/wedaVideo/index.d.ts +17 -0
  293. package/dist/web/components/wedaVideo/index.js +159 -0
  294. package/dist/web/index.d.ts +8 -0
  295. package/dist/web/index.js +4 -0
  296. package/dist/web/utils/classnames.d.ts +2 -0
  297. package/dist/web/utils/classnames.js +37 -0
  298. package/dist/web/utils/constant.d.ts +23 -0
  299. package/dist/web/utils/constant.js +24 -0
  300. package/dist/web/utils/debounce.d.ts +2 -0
  301. package/dist/web/utils/debounce.js +92 -0
  302. package/dist/web/utils/events.d.ts +1 -0
  303. package/dist/web/utils/events.js +2 -0
  304. package/dist/web/utils/getLocalCounter.d.ts +1 -0
  305. package/dist/web/utils/getLocalCounter.js +4 -0
  306. package/dist/web/utils/isObjectEqual.d.ts +2 -0
  307. package/dist/web/utils/isObjectEqual.js +12 -0
  308. package/dist/web/utils/loading-fallback.d.ts +2 -0
  309. package/dist/web/utils/loading-fallback.js +2 -0
  310. package/dist/web/utils/lodash.d.ts +1 -0
  311. package/dist/web/utils/lodash.js +2 -0
  312. package/dist/web/utils/platform.d.ts +18 -0
  313. package/dist/web/utils/platform.js +191 -0
  314. package/dist/web/utils/tcb.d.ts +23 -0
  315. package/dist/web/utils/tcb.js +82 -0
  316. package/dist/web/utils/tmap.d.ts +3 -0
  317. package/dist/web/utils/tmap.js +21 -0
  318. package/dist/web/utils/useSetState.d.ts +1 -0
  319. package/dist/web/utils/useSetState.js +8 -0
  320. package/dist/web/utils/useSyncValue.d.ts +4 -0
  321. package/dist/web/utils/useSyncValue.js +15 -0
  322. package/dist/web/utils/weui.d.ts +1 -0
  323. package/dist/web/utils/weui.js +2 -0
  324. package/dist/web/weda-ui.css +90 -0
  325. package/package.json +12 -11
@@ -0,0 +1,132 @@
1
+ import EchartBase from './eChartBase';
2
+ import getConfig from '../config/pie';
3
+ /**
4
+ * 饼状图表
5
+ * @author loonglong
6
+ **/
7
+ class EchartPie extends EchartBase {
8
+ constructor() {
9
+ super();
10
+ const config = getConfig();
11
+ this.config = { ...this.config, ...config };
12
+ }
13
+ async setSourceData({ dataSource, filterData, setColor, xField, xStatistics, xIsCountEmpty, yField, }) {
14
+ const { name = '', type = '', methodName = '' } = dataSource;
15
+ if (name !== '') {
16
+ const params = this.createWhere({
17
+ filterData,
18
+ xField,
19
+ xStatistics,
20
+ xIsCountEmpty,
21
+ yField,
22
+ });
23
+ const arrSourData = await this.getSourceData(name, methodName, type, params);
24
+ // 获取 x 轴数据
25
+ if (arrSourData.length > 0) {
26
+ const numPie = arrSourData[0].YLabels.length;
27
+ if (numPie > 0) {
28
+ const arrData = [];
29
+ let i = 0;
30
+ arrSourData.forEach((itemSource) => {
31
+ const numc = setColor ? setColor.length : 0;
32
+ const strColor = numc > 0 ? { color: setColor[i % numc] } : {};
33
+ arrData.push({
34
+ value: itemSource.YLabels[0].Value,
35
+ name: itemSource.XLabel.Value,
36
+ tooltip: {},
37
+ itemStyle: strColor,
38
+ });
39
+ i = i + 1;
40
+ });
41
+ this.config.series[0].data = arrData;
42
+ }
43
+ }
44
+ else {
45
+ // this.config['series'][0].data = [];
46
+ }
47
+ }
48
+ }
49
+ setChartType({ chartType }) {
50
+ this.config.series.length > 0 &&
51
+ this.config.series.forEach((itemSeries) => {
52
+ if (chartType === 'pie') {
53
+ itemSeries.radius = '70%';
54
+ }
55
+ else {
56
+ // @ts-ignore no type
57
+ itemSeries.radius = ['40%', '70%'];
58
+ }
59
+ });
60
+ }
61
+ // 显示图表上的数据标签 单位,标签,小数位数,后缀
62
+ setIsSeriesShowSymbol({ isSeriesShowSymbol, isPercent, isUnit, unit, decimalDigits, suffix, }) {
63
+ decimalDigits = decimalDigits < 0 ? 0 : decimalDigits;
64
+ let show = false;
65
+ let position = 'inner';
66
+ let formatter = null;
67
+ if (isSeriesShowSymbol || isPercent || isUnit) {
68
+ formatter = '';
69
+ }
70
+ this.config.series[0].label.show = show;
71
+ this.config.series[0].label.position = position;
72
+ if (formatter === null) {
73
+ this.config.series[0].label.normal = null;
74
+ }
75
+ else {
76
+ this.config.series[0].label.normal.formatter = (objValue) => {
77
+ let reData = '';
78
+ if (isSeriesShowSymbol) {
79
+ // 显示数值
80
+ reData = objValue.value;
81
+ }
82
+ if (isUnit) {
83
+ // 显示单位
84
+ if (unit) {
85
+ const objNewValue = this.getValueByUnit(objValue.value, unit);
86
+ reData = `${objNewValue.toFixed(decimalDigits)}${suffix}`;
87
+ }
88
+ else {
89
+ reData = `${objValue.value.toFixed(decimalDigits)}`;
90
+ }
91
+ this.config.series[0].data.forEach((itemData) => {
92
+ itemData.tooltip.formatter = (objVal) => {
93
+ const objItemData = this.getValueByUnit(objVal.value, unit);
94
+ return `${objItemData.toFixed(decimalDigits)}${suffix}`;
95
+ };
96
+ });
97
+ }
98
+ if (isPercent) {
99
+ // 显示百分比
100
+ reData = `${reData}(${objValue.percent}%)`;
101
+ }
102
+ return reData;
103
+ };
104
+ }
105
+ }
106
+ async setOptions({ chartType, isTitle, title, titleLocation, dataSource, filterData, setColor, xField, xStatistics, xIsCountEmpty, yField, isLegend, legend, legend2, isSeriesShowSymbol, isPercent, isUnit, unit, decimalDigits, suffix, }) {
107
+ legend = document.body.clientWidth < 1024 ? legend : legend2;
108
+ if (dataSource) {
109
+ await this.setSourceData({
110
+ dataSource,
111
+ filterData,
112
+ setColor,
113
+ xField,
114
+ xStatistics,
115
+ xIsCountEmpty,
116
+ yField,
117
+ });
118
+ }
119
+ this.setChartType({ chartType });
120
+ this.setTitle({ isTitle, title, titleLocation });
121
+ this.setLegend({ isLegend, legend });
122
+ this.setIsSeriesShowSymbol({
123
+ isSeriesShowSymbol,
124
+ isPercent,
125
+ isUnit,
126
+ unit,
127
+ decimalDigits,
128
+ suffix,
129
+ });
130
+ }
131
+ }
132
+ export default EchartPie;
@@ -0,0 +1,35 @@
1
+ export interface DataSource {
2
+ name: string;
3
+ type: string;
4
+ subType: string;
5
+ provider?: string;
6
+ methodName: string;
7
+ }
8
+ export interface ObjSource {
9
+ dataSourceName: string;
10
+ dataSourceType: string;
11
+ dataSourceMethodName: string;
12
+ }
13
+ export interface Xfield {
14
+ format: string;
15
+ type: string;
16
+ title: string;
17
+ name: string;
18
+ }
19
+ declare enum CountType {
20
+ 'count' = 0,
21
+ 'sum' = 1,
22
+ 'avg' = 2,
23
+ 'max' = 3,
24
+ 'min' = 4
25
+ }
26
+ export interface YfieldOne {
27
+ key: string;
28
+ operationType: CountType;
29
+ title?: string;
30
+ }
31
+ export interface Yfield {
32
+ groupKey?: string;
33
+ numValue?: Array<YfieldOne>;
34
+ }
35
+ export {};
@@ -0,0 +1,9 @@
1
+ var CountType;
2
+ (function (CountType) {
3
+ CountType[CountType["count"] = 0] = "count";
4
+ CountType[CountType["sum"] = 1] = "sum";
5
+ CountType[CountType["avg"] = 2] = "avg";
6
+ CountType[CountType["max"] = 3] = "max";
7
+ CountType[CountType["min"] = 4] = "min";
8
+ })(CountType || (CountType = {}));
9
+ export {};
@@ -0,0 +1,2 @@
1
+ import * as echarts from 'echarts/core';
2
+ export default echarts;
@@ -0,0 +1,24 @@
1
+ // 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
2
+ import * as echarts from 'echarts/core';
3
+ // 引入图表,图表后缀都为 Chart
4
+ import { BarChart, LineChart, PieChart } from 'echarts/charts';
5
+ //组件,组件后缀都为 Component
6
+ import { TitleComponent, TooltipComponent, LegendComponent, GridComponent, } from 'echarts/components';
7
+ // 标签自动布局,全局过渡动画等特性
8
+ import { LabelLayout, UniversalTransition } from 'echarts/features';
9
+ // 引入 Canvas 渲染器,注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
10
+ import { CanvasRenderer } from 'echarts/renderers';
11
+ // 注册必须的组件
12
+ echarts.use([
13
+ TitleComponent,
14
+ TooltipComponent,
15
+ GridComponent,
16
+ LegendComponent,
17
+ LabelLayout,
18
+ UniversalTransition,
19
+ CanvasRenderer,
20
+ BarChart,
21
+ LineChart,
22
+ PieChart,
23
+ ]);
24
+ export default echarts;
@@ -0,0 +1,8 @@
1
+ import { MutableRefObject, RefObject } from 'react';
2
+ import { IEchartModalBase } from './core/eChartBase';
3
+ import type IEcharts from './echarts';
4
+ export declare function useChart(ref: RefObject<HTMLElement> | MutableRefObject<HTMLElement>): IEcharts.ECharts;
5
+ /**
6
+ * @deprecated The method should not be used
7
+ */
8
+ export declare function useWedaChart(domRef: any, ModalClass: IEchartModalBase, options: IEcharts.EChartsCoreOption): void;
@@ -0,0 +1,60 @@
1
+ import { useAsync, useDeepCompareEffect, useEventListener, useIsMounted, useMountEffect, } from '@react-hookz/web';
2
+ import { useEffect, useRef, } from 'react';
3
+ export function useChart(ref) {
4
+ const chartRef = useRef();
5
+ const isMounted = useIsMounted();
6
+ useMountEffect(async () => {
7
+ if (!ref.current || !isMounted) {
8
+ return;
9
+ }
10
+ const echarts = (await import(/* webpackChunkName: "echarts" */ './echarts')).default;
11
+ const echartDom = ref.current;
12
+ const chart = echarts.init(echartDom);
13
+ chartRef.current = chart;
14
+ return () => {
15
+ chart.dispose();
16
+ chartRef.current = null;
17
+ };
18
+ });
19
+ useEventListener(window, 'resize', () => {
20
+ chartRef.current && chartRef.current.resize();
21
+ });
22
+ return chartRef.current;
23
+ }
24
+ /**
25
+ * @deprecated The method should not be used
26
+ */
27
+ export function useWedaChart(domRef, ModalClass, options) {
28
+ const chart = useChart(domRef);
29
+ const getOptions = async () => {
30
+ const chartModal = new ModalClass();
31
+ let finalOptions = await chartModal.setOptions(options);
32
+ if (!finalOptions) {
33
+ finalOptions = chartModal.getOptions();
34
+ }
35
+ return finalOptions;
36
+ };
37
+ const [state, actions] = useAsync(getOptions);
38
+ useMountEffect(() => {
39
+ actions.execute();
40
+ });
41
+ useDeepCompareEffect(() => {
42
+ actions.execute();
43
+ }, [
44
+ // options 变化,包含所有配置项,包括纯前端的配置项变化都会触发setOptions里发请求,但改不动了
45
+ options,
46
+ actions,
47
+ ]);
48
+ useEffect(() => {
49
+ if (state.status === 'success' && chart) {
50
+ console.log(ModalClass.name, options, state.result, window.location.href);
51
+ chart.setOption(state.result, true // noMerge 全刷
52
+ );
53
+ }
54
+ else {
55
+ if (state.status === 'error') {
56
+ console.error(state.error);
57
+ }
58
+ }
59
+ }, [state]);
60
+ }
@@ -0,0 +1,39 @@
1
+ /// <reference types="react" />
2
+ import type { CommonPropsType } from '../../../types';
3
+ import { DataSource, Xfield, Yfield } from '../common/core/type';
4
+ interface PropsType extends Omit<CommonPropsType, 'children'> {
5
+ chartType?: string;
6
+ isTitle?: boolean;
7
+ title?: string;
8
+ titleLocation?: string;
9
+ dataSource?: DataSource;
10
+ filterData?: string;
11
+ xField?: Xfield;
12
+ groupKey?: Xfield;
13
+ groupKeyTimeSpan?: string;
14
+ xStatistics?: string;
15
+ xIsCountEmpty?: boolean;
16
+ yField?: Yfield;
17
+ isLegend?: boolean;
18
+ legend?: string;
19
+ legend2?: string;
20
+ isXaxisName?: boolean;
21
+ xAxisName?: string;
22
+ isXaxisAxisLabelShow?: boolean;
23
+ isXaxisAxisTickShow?: boolean;
24
+ isXaxisAxisLabelRotate?: boolean;
25
+ isYAxisSplitlineLinestyleWidth?: boolean;
26
+ yAxisSplitlineLinestyleType?: string;
27
+ yAxisMax?: number;
28
+ yAxisMin?: number;
29
+ isYAxisName?: boolean;
30
+ yAxisName?: string;
31
+ isSeriesShowSymbol?: boolean;
32
+ isYAxisShow?: boolean;
33
+ isUnit?: boolean;
34
+ unit?: string;
35
+ decimalDigits?: number;
36
+ suffix?: string;
37
+ }
38
+ export default function Line(opts: PropsType): JSX.Element;
39
+ export {};
@@ -0,0 +1,53 @@
1
+ import React, { useRef } from 'react';
2
+ import EChartLine from '../common/core/eChartLine';
3
+ import classNames from '../../../utils/classnames';
4
+ import { useWedaChart } from '../common/useChart';
5
+ export default function Line(opts) {
6
+ const { id, style, className, chartType, isTitle, title, titleLocation, dataSource, filterData, xField, xStatistics, xIsCountEmpty, yField, groupKey, groupKeyTimeSpan, isLegend, legend, legend2, isXaxisName, xAxisName, isXaxisAxisLabelShow, isXaxisAxisTickShow, isXaxisAxisLabelRotate, isYAxisSplitlineLinestyleWidth, yAxisSplitlineLinestyleType, yAxisMax, yAxisMin, isYAxisName, yAxisName, isSeriesShowSymbol, isYAxisShow, isUnit, unit, decimalDigits, suffix, } = opts;
7
+ const domRef = useRef();
8
+ useWedaChart(domRef, EChartLine, {
9
+ chartType,
10
+ isTitle,
11
+ title,
12
+ titleLocation,
13
+ dataSource,
14
+ filterData,
15
+ xField,
16
+ xStatistics,
17
+ xIsCountEmpty,
18
+ yField,
19
+ groupKey,
20
+ groupKeyTimeSpan,
21
+ isLegend,
22
+ legend,
23
+ legend2,
24
+ isXaxisName,
25
+ xAxisName,
26
+ isXaxisAxisLabelShow,
27
+ isXaxisAxisTickShow,
28
+ isXaxisAxisLabelRotate,
29
+ isYAxisSplitlineLinestyleWidth,
30
+ yAxisSplitlineLinestyleType,
31
+ yAxisMax,
32
+ yAxisMin,
33
+ isYAxisName,
34
+ yAxisName,
35
+ isSeriesShowSymbol,
36
+ isYAxisShow,
37
+ isUnit,
38
+ unit,
39
+ decimalDigits,
40
+ suffix,
41
+ });
42
+ const inlineStyle = {
43
+ height: '380px',
44
+ width: '100%',
45
+ backgroundColor: '#ffffff',
46
+ ...style,
47
+ };
48
+ return (React.createElement("div", { id: id, ref: domRef, "data-testid": "line", style: inlineStyle, className: classNames({
49
+ 'echart-wrapper-canvas': true,
50
+ 'echart-dark-body': true,
51
+ [className]: className,
52
+ }) }));
53
+ }
@@ -0,0 +1,27 @@
1
+ /// <reference types="react" />
2
+ import type { CommonPropsType } from '../../../types';
3
+ import { DataSource, Xfield, Yfield } from '../common/core/type';
4
+ interface PropsType extends Omit<CommonPropsType, 'children'> {
5
+ chartType?: string;
6
+ isTitle?: boolean;
7
+ title?: string;
8
+ titleLocation?: string;
9
+ dataSource?: DataSource;
10
+ filterData?: string;
11
+ setColor?: Array<string>;
12
+ xField?: Xfield;
13
+ xStatistics?: string;
14
+ xIsCountEmpty?: boolean;
15
+ yField?: Yfield;
16
+ isLegend?: boolean;
17
+ legend?: string;
18
+ legend2?: string;
19
+ isSeriesShowSymbol?: boolean;
20
+ isPercent?: boolean;
21
+ isUnit?: boolean;
22
+ unit?: string;
23
+ decimalDigits?: number;
24
+ suffix?: string;
25
+ }
26
+ export default function Line({ id, style, className, chartType, isTitle, title, titleLocation, dataSource, filterData, setColor, xField, xStatistics, xIsCountEmpty, yField, isLegend, legend, legend2, isSeriesShowSymbol, isPercent, isUnit, unit, decimalDigits, suffix, }: PropsType): JSX.Element;
27
+ export {};
@@ -0,0 +1,40 @@
1
+ import React, { useRef } from 'react';
2
+ import EchartPie from '../common/core/eChartPie';
3
+ import { useWedaChart } from '../common/useChart';
4
+ import classNames from '../../../utils/classnames';
5
+ export default function Line({ id, style, className, chartType, isTitle, title, titleLocation, dataSource, filterData, setColor, xField, xStatistics, xIsCountEmpty, yField, isLegend, legend, legend2, isSeriesShowSymbol, isPercent, isUnit, unit, decimalDigits, suffix, }) {
6
+ const domRef = useRef();
7
+ useWedaChart(domRef, EchartPie, {
8
+ chartType,
9
+ isTitle,
10
+ title,
11
+ titleLocation,
12
+ dataSource,
13
+ filterData,
14
+ setColor,
15
+ xField,
16
+ xStatistics,
17
+ xIsCountEmpty,
18
+ yField,
19
+ isLegend,
20
+ legend,
21
+ legend2,
22
+ isSeriesShowSymbol,
23
+ isPercent,
24
+ isUnit,
25
+ unit,
26
+ decimalDigits,
27
+ suffix,
28
+ });
29
+ const inlineStyle = {
30
+ height: '380px',
31
+ width: '100%',
32
+ backgroundColor: '#ffffff',
33
+ ...style,
34
+ };
35
+ return (React.createElement("div", { id: id, "data-testid": "pie", ref: domRef, style: inlineStyle, className: classNames({
36
+ 'echart-wrapper-canvas': true,
37
+ 'echart-dark-body': true,
38
+ [className]: className,
39
+ }) }));
40
+ }
@@ -0,0 +1,63 @@
1
+ /* pc style */
2
+ .weda-statistics-card {
3
+ background: #ffffff;
4
+ border: 0.07143rem solid #f1f2f5;
5
+ box-sizing: border-box;
6
+ box-shadow: 0 0.07143rem 0.14286rem rgba(0, 0, 0, 0.1);
7
+ border-radius: 0.42857rem;
8
+ box-sizing: border-box;
9
+ font-size: 1rem;
10
+ }
11
+ .weda-statistics-card.weda-statistics-card-pc {
12
+ width: 19.71429rem;
13
+ min-height: 9.14286rem;
14
+ }
15
+
16
+ .weda-statistics-card .weda-statistics-card__wrapper {
17
+ width: 100%;
18
+ padding: 2rem 1.71429rem;
19
+ }
20
+
21
+ .weda-statistics-card .weda-statistics-card__title {
22
+ font-size: 1em;
23
+ line-height: 1.57142em;
24
+ color: rgba(0, 0, 0, 0.6);
25
+ }
26
+
27
+ .weda-statistics-card .weda-statistics-card__detail {
28
+ margin-top: 0.57143rem;
29
+ }
30
+
31
+ .weda-statistics-card .weda-statistics-card__count {
32
+ font-size: 2.28571em;
33
+ line-height: 3.14285em;
34
+ color: rgba(0, 0, 0, 0.9);
35
+ word-break: break-all;
36
+ }
37
+
38
+ .weda-statistics-card .weda-statistics-card__unit {
39
+ font-size: 1em;
40
+ line-height: 1.57142em;
41
+ color: rgba(0, 0, 0, 0.4);
42
+ margin-left: 0.28571rem;
43
+ vertical-align: middle;
44
+ }
45
+
46
+ /* h5 style */
47
+ .weda-statistics-card.weda-statistics-card-mobile {
48
+ max-width: 100%;
49
+ min-height: 10rem;
50
+ }
51
+ .weda-statistics-card-mobile .weda-statistics-card__wrapper {
52
+ width: 100%;
53
+ padding: 2.85714rem 1.71429rem;
54
+ }
55
+
56
+ .weda-statistics-card-mobile .weda-statistics-card__detail {
57
+ margin-top: 0.28571rem;
58
+ }
59
+
60
+ .weda-statistics-card-mobile .weda-statistics-card__count {
61
+ font-size: 2em;
62
+ line-height: 2.42857em;
63
+ }
@@ -0,0 +1,85 @@
1
+ /// <reference types="react" />
2
+ import type { CommonPropsType } from '../../../types';
3
+ import './index.css';
4
+ import { IDataSource, IField } from './interface';
5
+ interface PropsType extends CommonPropsType {
6
+ /**
7
+ * 数据源
8
+ */
9
+ dataSource?: IDataSource;
10
+ /**
11
+ * 数据筛选
12
+ */
13
+ filterData?: any;
14
+ /**
15
+ * 字段
16
+ */
17
+ field?: IField;
18
+ /**
19
+ * 统计方式
20
+ */
21
+ operationType?: string;
22
+ /**
23
+ * 字段展示名称
24
+ */
25
+ label?: string;
26
+ /**
27
+ * 是否统计空值
28
+ */
29
+ isCountEmpty?: boolean;
30
+ /**
31
+ * 是否显示单位
32
+ */
33
+ isShowUnit?: boolean;
34
+ /**
35
+ * 单位
36
+ */
37
+ unit?: number;
38
+ /**
39
+ * 小数位数
40
+ */
41
+ decimalDigits?: number;
42
+ /**
43
+ * 后缀
44
+ */
45
+ suffix?: number;
46
+ /**
47
+ * app.cloud 对象依赖,默认会从 window.app 取值
48
+ */
49
+ appCloud?: {
50
+ callDataSource?: any;
51
+ callWedaApi?: any;
52
+ };
53
+ /**
54
+ * 其他属性
55
+ */
56
+ [key: string]: any;
57
+ }
58
+ /**
59
+ * 修复科学计数法问题
60
+ * @param num 小数
61
+ * @returns {string}
62
+ */
63
+ export declare function scientificToNumber(num: any): any;
64
+ /**
65
+ * 补齐小数位数0
66
+ * @param source 源字符串
67
+ * @param targetLength 目标长度
68
+ * @returns {string}
69
+ */
70
+ export declare function padEnd(source: any, targetLength: any): any;
71
+ /**
72
+ * 修复toFixed四舍五入不准确问题
73
+ * @param num
74
+ * @param digit 小数位数
75
+ * @returns {string}
76
+ */
77
+ export declare function customToFixed(num: any, digit?: number): string;
78
+ /**
79
+ * 添加千位分隔符
80
+ * @param fixedString
81
+ * @param digit
82
+ */
83
+ export declare function addDelimiter(fixedString: any, digit: any): string;
84
+ export default function StatisticsCard({ dataSource, filterData, field, operationType, label, isCountEmpty, isShowUnit, unit, decimalDigits, suffix, className, style, events, id, role, appCloud, }: PropsType): JSX.Element;
85
+ export {};