@cloudbase/weda-ui 2.0.10 → 2.0.26

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 (297) hide show
  1. package/README.md +1 -0
  2. package/package.json +47 -36
  3. package/src/configs/components/button.json +60 -13
  4. package/src/configs/components/calendar.json +3 -3
  5. package/src/configs/components/carousel.json +57 -47
  6. package/src/configs/components/chart/bar.json +4 -13
  7. package/src/configs/components/chart/line.json +4 -13
  8. package/src/configs/components/chart/pie.json +3 -10
  9. package/src/configs/components/chart/statisticsCard.json +1 -4
  10. package/src/configs/components/container.json +1 -3
  11. package/src/configs/components/dataView.json +7 -15
  12. package/src/configs/components/drawer.json +24 -6
  13. package/src/configs/components/form/form.json +19 -0
  14. package/src/configs/components/form/input.json +20 -5
  15. package/src/configs/components/form/location.json +51 -48
  16. package/src/configs/components/form/radio.json +1 -3
  17. package/src/configs/components/form/richText.json +14 -14
  18. package/src/configs/components/form/select.json +62 -82
  19. package/src/configs/components/form/textarea.json +14 -1
  20. package/src/configs/components/form/uploader.json +64 -64
  21. package/src/configs/components/form/uploaderFile.json +1 -2
  22. package/src/configs/components/graphicCard.json +44 -45
  23. package/src/configs/components/image.json +44 -40
  24. package/src/configs/components/link.json +5 -10
  25. package/src/configs/components/listView.json +2 -8
  26. package/src/configs/components/lottery.json +7 -3
  27. package/src/configs/components/modal.json +26 -21
  28. package/src/configs/components/navLayout.json +68 -68
  29. package/src/configs/components/navigationBar.json +4 -1
  30. package/src/configs/components/richtextview.json +1 -1
  31. package/src/configs/components/scrollVeiw.json +14 -42
  32. package/src/configs/components/swiper.json +9 -9
  33. package/src/configs/components/wedaVideo.json +89 -0
  34. package/src/configs/components/wxOpenApi/phone.json +7 -21
  35. package/src/configs/components/wxOpenApi/phoneCode.json +7 -19
  36. package/src/configs/components/wxOpenApi/share.json +14 -24
  37. package/src/configs/components/wxOpenApi/userInfo.json +9 -27
  38. package/src/configs/index.js +2 -0
  39. package/src/mp/components/button/index.js +1 -1
  40. package/src/mp/components/button/index.wxml +19 -19
  41. package/src/mp/components/calendar/index.js +68 -38
  42. package/src/mp/components/calendar/index.json +3 -2
  43. package/src/mp/components/calendar/index.wxml +5 -7
  44. package/src/mp/components/calendar/index.wxss +17 -16
  45. package/src/mp/components/carousel/index.json +1 -1
  46. package/src/mp/components/carousel/index.wxml +2 -2
  47. package/src/mp/components/chart/bar/index.js +1 -2
  48. package/src/mp/components/chart/bar/index.wxml +1 -1
  49. package/src/mp/components/chart/common/config/bar.js +1 -1
  50. package/src/mp/components/chart/common/core/eChartBar.js +29 -34
  51. package/src/mp/components/chart/common/core/eChartBase.js +46 -32
  52. package/src/mp/components/chart/common/core/eChartLine.js +34 -40
  53. package/src/mp/components/chart/common/core/eChartPie.js +12 -9
  54. package/src/mp/components/chart/ec-canvas/ec-canvas.json +1 -1
  55. package/src/mp/components/chart/ec-canvas/wx-canvas.js +24 -22
  56. package/src/mp/components/chart/line/index.js +2 -2
  57. package/src/mp/components/chart/line/index.wxml +1 -1
  58. package/src/mp/components/chart/pie/index.js +1 -1
  59. package/src/mp/components/chart/pie/index.wxml +1 -2
  60. package/src/mp/components/chart/statisticsCard/index.wxss +7 -10
  61. package/src/mp/components/dataView/index.wxml +2 -14
  62. package/src/mp/components/form/checkbox/index.js +15 -7
  63. package/src/mp/components/form/checkbox/index.wxml +13 -25
  64. package/src/mp/components/form/form/index.wxml +3 -3
  65. package/src/mp/components/form/formcell/index.wxml +9 -9
  66. package/src/mp/components/form/formcell/index.wxss +6 -1
  67. package/src/mp/components/form/input/index.js +4 -4
  68. package/src/mp/components/form/input/index.wxml +24 -31
  69. package/src/mp/components/form/input/index.wxss +9 -3
  70. package/src/mp/components/form/location/components/mapChoose/index.json +1 -1
  71. package/src/mp/components/form/location/components/mapChoose/index.wxml +6 -6
  72. package/src/mp/components/form/location/index.js +7 -1
  73. package/src/mp/components/form/location/index.json +1 -1
  74. package/src/mp/components/form/location/index.wxml +6 -10
  75. package/src/mp/components/form/radio/index.js +14 -6
  76. package/src/mp/components/form/radio/index.wxml +12 -24
  77. package/src/mp/components/form/select/index.js +157 -98
  78. package/src/mp/components/form/select/index.wxml +11 -39
  79. package/src/mp/components/form/select/index.wxss +10 -1
  80. package/src/mp/components/form/select/region/index.js +18 -12
  81. package/src/mp/components/form/switch/index.wxml +11 -18
  82. package/src/mp/components/form/textarea/index.js +6 -0
  83. package/src/mp/components/form/textarea/index.wxml +2 -17
  84. package/src/mp/components/form/textarea/index.wxss +5 -0
  85. package/src/mp/components/form/tips/index.wxml +1 -3
  86. package/src/mp/components/form/uploader/index.js +1 -1
  87. package/src/mp/components/form/uploader/index.wxml +3 -20
  88. package/src/mp/components/form/uploader/weui-uploader.js +210 -200
  89. package/src/mp/components/form/uploader/weui-uploader.json +6 -6
  90. package/src/mp/components/form/uploader/weui-uploader.wxml +38 -38
  91. package/src/mp/components/form/uploaderFile/index.js +5 -4
  92. package/src/mp/components/form/uploaderFile/index.wxml +40 -41
  93. package/src/mp/components/graphicCard/index.js +35 -35
  94. package/src/mp/components/graphicCard/index.wxml +2 -6
  95. package/src/mp/components/graphicCard/index.wxss +6 -6
  96. package/src/mp/components/image/index.wxml +9 -20
  97. package/src/mp/components/image/index.wxss +3 -1
  98. package/src/mp/components/listView/index.wxml +5 -7
  99. package/src/mp/components/listView/index.wxss +2 -2
  100. package/src/mp/components/lottery/index.wxml +1 -3
  101. package/src/mp/components/lottery/index.wxss +31 -25
  102. package/src/mp/components/navLayout/index.js +9 -12
  103. package/src/mp/components/navLayout/index.wxml +2 -4
  104. package/src/mp/components/navLayout/index.wxss +10 -10
  105. package/src/mp/components/navigationBar/index.json +1 -2
  106. package/src/mp/components/navigationBar/index.wxml +43 -51
  107. package/src/mp/components/navigationBar/index.wxss +10 -10
  108. package/src/mp/components/richText/index.wxml +1 -1
  109. package/src/mp/components/richText/index.wxss +7 -5
  110. package/src/mp/components/swiper/index.wxml +1 -9
  111. package/src/mp/components/tabs/index.js +14 -10
  112. package/src/mp/components/tabs/index.json +1 -1
  113. package/src/mp/components/tabs/index.wxml +3 -21
  114. package/src/mp/components/tabs/index.wxss +1 -2
  115. package/src/mp/components/text/index.wxml +1 -6
  116. package/src/mp/components/text/index.wxss +1 -1
  117. package/src/mp/components/wedaVideo/index.js +86 -0
  118. package/src/mp/components/wedaVideo/index.json +4 -0
  119. package/src/mp/components/wedaVideo/index.wxml +4 -0
  120. package/src/mp/components/wedaVideo/index.wxss +20 -0
  121. package/src/mp/components/wxOpenApi/phone/index.js +1 -9
  122. package/src/mp/components/wxOpenApi/phone/index.wxml +3 -14
  123. package/src/mp/components/wxOpenApi/phoneCode/index.json +1 -1
  124. package/src/mp/components/wxOpenApi/phoneCode/index.wxml +3 -14
  125. package/src/mp/components/wxOpenApi/share/index.wxml +3 -14
  126. package/src/mp/components/wxOpenApi/userInfo/index.wxml +3 -13
  127. package/src/mp/index.json +1 -0
  128. package/src/mp/style/weda-ui.wxss +24 -9
  129. package/src/mp/utils/deepEqual.js +37 -37
  130. package/src/mp/utils/destr.js +41 -40
  131. package/src/mp/utils/dr_square_point.js +10 -6
  132. package/src/setupTests.js +13 -13
  133. package/src/web/actions/showModal/index.tsx +5 -4
  134. package/src/web/components/button/index.tsx +44 -40
  135. package/src/web/components/calendar/index.css +99 -65
  136. package/src/web/components/carousel/index.tsx +1 -1
  137. package/src/web/components/chart/common/config/bar.js +1 -1
  138. package/src/web/components/chart/common/core/eChartBar.js +28 -34
  139. package/src/web/components/chart/common/core/eChartBase.ts +55 -42
  140. package/src/web/components/chart/common/core/eChartLine.js +34 -40
  141. package/src/web/components/chart/common/core/eChartPie.js +12 -9
  142. package/src/web/components/chart/common/core/type.ts +23 -23
  143. package/src/web/components/chart/common/echart.css +12 -12
  144. package/src/web/components/chart/common/echarts.ts +3 -5
  145. package/src/web/components/chart/common/useChart.tsx +34 -16
  146. package/src/web/components/chart/statisticsCard/index.css +9 -8
  147. package/src/web/components/container/index.tsx +3 -4
  148. package/src/web/components/drawer/index.tsx +15 -4
  149. package/src/web/components/form/checkbox/index.tsx +32 -31
  150. package/src/web/components/form/enumSelect/NormalSelect.tsx +0 -2
  151. package/src/web/components/form/form/index.css +3 -6
  152. package/src/web/components/form/form/index.tsx +7 -6
  153. package/src/web/components/form/formcell/index.css +11 -18
  154. package/src/web/components/form/formcell/index.tsx +3 -7
  155. package/src/web/components/form/input/index.css +8 -4
  156. package/src/web/components/form/input/index.tsx +61 -53
  157. package/src/web/components/form/location/common/mapChoose.css +13 -11
  158. package/src/web/components/form/location/common/selectModal.jsx +2 -11
  159. package/src/web/components/form/location/common/useLocationInfo.js +4 -0
  160. package/src/web/components/form/location/components/LocationH5/index.css +19 -20
  161. package/src/web/components/form/location/components/LocationH5/location.h5.jsx +11 -1
  162. package/src/web/components/form/location/components/LocationPC/Header.jsx +0 -13
  163. package/src/web/components/form/location/components/LocationPC/location.PC.jsx +14 -5
  164. package/src/web/components/form/radio/index.tsx +32 -26
  165. package/src/web/components/form/renderDecorator.tsx +23 -26
  166. package/src/web/components/form/select/h5.tsx +155 -104
  167. package/src/web/components/form/select/index.css +9 -3
  168. package/src/web/components/form/select/index.tsx +76 -49
  169. package/src/web/components/form/select/region/index.ts +101 -80
  170. package/src/web/components/form/select/year.tsx +2 -0
  171. package/src/web/components/form/switch/index.tsx +40 -40
  172. package/src/web/components/form/textarea/index.css +4 -0
  173. package/src/web/components/form/textarea/index.tsx +39 -26
  174. package/src/web/components/form/types.d.ts +10 -10
  175. package/src/web/components/form/uploader/index.css +10 -0
  176. package/src/web/components/form/uploader/uploader.h5.tsx +29 -26
  177. package/src/web/components/form/uploader/uploader.pc.tsx +3 -6
  178. package/src/web/components/form/uploaderFile/index.css +24 -23
  179. package/src/web/components/form/uploaderFile/index.jsx +0 -5
  180. package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +24 -15
  181. package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +21 -13
  182. package/src/web/components/graphicCard/index.css +6 -6
  183. package/src/web/components/image/image.tsx +2 -2
  184. package/src/web/components/image/index.css +9 -7
  185. package/src/web/components/image/index.tsx +29 -12
  186. package/src/web/components/index.js +1 -0
  187. package/src/web/components/link/index.tsx +13 -13
  188. package/src/web/components/listView/index.css +8 -8
  189. package/src/web/components/lottery/index.css +43 -37
  190. package/src/web/components/lottery/index.tsx +3 -3
  191. package/src/web/components/modal/index.tsx +34 -34
  192. package/src/web/components/navLayout/index.css +25 -25
  193. package/src/web/components/navLayout/index.tsx +1 -1
  194. package/src/web/components/navigationBar/index.css +26 -26
  195. package/src/web/components/navigationBar/index.tsx +2 -2
  196. package/src/web/components/picker/datePicker.tsx +3 -3
  197. package/src/web/components/picker/picker.tsx +3 -3
  198. package/src/web/components/picker/timePicker.tsx +1 -1
  199. package/src/web/components/richText/index.jsx +41 -46
  200. package/src/web/components/richTextView/index.css +7 -3
  201. package/src/web/components/richTextView/index.tsx +4 -6
  202. package/src/web/components/scrollView/index.tsx +2 -2
  203. package/src/web/components/slot/index.tsx +3 -4
  204. package/src/web/components/swiper/index.css +1 -1
  205. package/src/web/components/swiper/index.tsx +33 -15
  206. package/src/web/components/tabs/index.css +2 -3
  207. package/src/web/components/tabs/index.tsx +6 -6
  208. package/src/web/components/tabs/tabs.h5.tsx +17 -12
  209. package/src/web/components/tabs/tabs.pc.tsx +45 -34
  210. package/src/web/components/text/index.css +1 -1
  211. package/src/web/components/text/index.tsx +13 -14
  212. package/src/web/components/wedaVideo/index.css +42 -0
  213. package/src/web/components/wedaVideo/index.tsx +208 -0
  214. package/src/web/utils/constant.ts +2 -1
  215. package/src/web/utils/isObjectEqual.js +2 -1
  216. package/src/web/utils/loading-fallback.tsx +2 -2
  217. package/src/web/utils/lodash.ts +1 -1
  218. package/src/web/utils/platform.js +13 -0
  219. package/src/web/utils/useSetState.ts +6 -2
  220. package/src/web/weda-ui.css +23 -8
  221. package/src/docs/common/format.tsx +0 -112
  222. package/src/docs/common/tableView.css +0 -164
  223. package/src/docs/common/tableView.tsx +0 -273
  224. package/src/docs/compsdocs/chart/Bar.mdx +0 -159
  225. package/src/docs/compsdocs/chart/Line.mdx +0 -100
  226. package/src/docs/compsdocs/chart/Pie.mdx +0 -83
  227. package/src/docs/compsdocs/chart/_category_.json +0 -1
  228. package/src/docs/compsdocs/chart/statisticsCard.mdx +0 -51
  229. package/src/docs/compsdocs/database/DataView.mdx +0 -33
  230. package/src/docs/compsdocs/database/ListView.mdx +0 -33
  231. package/src/docs/compsdocs/database/_category_.json +0 -1
  232. package/src/docs/compsdocs/form/Form.mdx +0 -35
  233. package/src/docs/compsdocs/form/FormCheckbox.mdx +0 -35
  234. package/src/docs/compsdocs/form/FormDate.mdx +0 -30
  235. package/src/docs/compsdocs/form/FormEmail.mdx +0 -30
  236. package/src/docs/compsdocs/form/FormImageUploader.mdx +0 -31
  237. package/src/docs/compsdocs/form/FormInput.mdx +0 -30
  238. package/src/docs/compsdocs/form/FormLocation.mdx +0 -64
  239. package/src/docs/compsdocs/form/FormPhone.mdx +0 -30
  240. package/src/docs/compsdocs/form/FormRadio.mdx +0 -35
  241. package/src/docs/compsdocs/form/FormRegion.mdx +0 -30
  242. package/src/docs/compsdocs/form/FormSelect.mdx +0 -36
  243. package/src/docs/compsdocs/form/FormSwitch.mdx +0 -30
  244. package/src/docs/compsdocs/form/FormTextarea.mdx +0 -30
  245. package/src/docs/compsdocs/form/FormTime.mdx +0 -30
  246. package/src/docs/compsdocs/form/FormUploadFile.mdx +0 -30
  247. package/src/docs/compsdocs/form/FormUrl.mdx +0 -30
  248. package/src/docs/compsdocs/form/_category_.json +0 -1
  249. package/src/docs/compsdocs/grid/Card.mdx +0 -32
  250. package/src/docs/compsdocs/grid/Container.mdx +0 -42
  251. package/src/docs/compsdocs/grid/Footer.mdx +0 -31
  252. package/src/docs/compsdocs/grid/GridLayout.mdx +0 -32
  253. package/src/docs/compsdocs/grid/Header.mdx +0 -31
  254. package/src/docs/compsdocs/grid/Layout.mdx +0 -25
  255. package/src/docs/compsdocs/grid/List.mdx +0 -31
  256. package/src/docs/compsdocs/grid/ScrollView.mdx +0 -37
  257. package/src/docs/compsdocs/grid/Swiper.mdx +0 -58
  258. package/src/docs/compsdocs/grid/_category_.json +0 -1
  259. package/src/docs/compsdocs/media/Icon.mdx +0 -31
  260. package/src/docs/compsdocs/media/Image.mdx +0 -55
  261. package/src/docs/compsdocs/media/_category_.json +0 -1
  262. package/src/docs/compsdocs/model/ModelCreate.mdx +0 -20
  263. package/src/docs/compsdocs/model/ModelDetail.mdx +0 -20
  264. package/src/docs/compsdocs/model/ModelTable.mdx +0 -24
  265. package/src/docs/compsdocs/model/ModelUpdate.mdx +0 -21
  266. package/src/docs/compsdocs/model/PageLayout.mdx +0 -21
  267. package/src/docs/compsdocs/model/_category_.json +0 -1
  268. package/src/docs/compsdocs/navmenu/Classification.mdx +0 -38
  269. package/src/docs/compsdocs/navmenu/NavBar.mdx +0 -43
  270. package/src/docs/compsdocs/navmenu/NavLayout.mdx +0 -30
  271. package/src/docs/compsdocs/navmenu/TabBar.mdx +0 -43
  272. package/src/docs/compsdocs/navmenu/TabBarItem.mdx +0 -29
  273. package/src/docs/compsdocs/navmenu/_category_.json +0 -1
  274. package/src/docs/compsdocs/senior/Lottery.mdx +0 -48
  275. package/src/docs/compsdocs/senior/Modal.mdx +0 -58
  276. package/src/docs/compsdocs/senior/SlotMachine.mdx +0 -52
  277. package/src/docs/compsdocs/senior/_category_.json +0 -1
  278. package/src/docs/compsdocs/show/Calendar.mdx +0 -29
  279. package/src/docs/compsdocs/show/Divider.mdx +0 -31
  280. package/src/docs/compsdocs/show/GraphicCard.mdx +0 -30
  281. package/src/docs/compsdocs/show/Item.mdx +0 -32
  282. package/src/docs/compsdocs/show/ItemList.mdx +0 -47
  283. package/src/docs/compsdocs/show/Media.mdx +0 -25
  284. package/src/docs/compsdocs/show/StatusTip.mdx +0 -25
  285. package/src/docs/compsdocs/show/Swiper.mdx +0 -33
  286. package/src/docs/compsdocs/show/Tabs.mdx +0 -38
  287. package/src/docs/compsdocs/show/_category_.json +0 -1
  288. package/src/docs/compsdocs/show/button.mdx +0 -25
  289. package/src/docs/compsdocs/text/Link.mdx +0 -43
  290. package/src/docs/compsdocs/text/RichTextView.mdx +0 -36
  291. package/src/docs/compsdocs/text/Text.mdx +0 -31
  292. package/src/docs/compsdocs/text/Title.mdx +0 -32
  293. package/src/docs/compsdocs/text/_category_.json +0 -1
  294. package/src/docs/compsdocs/wxOpen/Phone.mdx +0 -60
  295. package/src/docs/compsdocs/wxOpen/Share.mdx +0 -46
  296. package/src/docs/compsdocs/wxOpen/UserInfo.mdx +0 -60
  297. package/src/docs/compsdocs/wxOpen/_category_.json +0 -4
@@ -1,7 +1,7 @@
1
1
  import { callDataSource, callWedaApi } from '../../../../utils/tcb';
2
2
  import getConfig from '../config/global';
3
3
 
4
- export type IEchartModalBase = typeof EchartBase
4
+ export type IEchartModalBase = typeof EchartBase;
5
5
  export abstract class AbstractEchartBaseModal {
6
6
  abstract setOptions(options: any): Promise<void>;
7
7
  abstract getOptions(option: any): Promise<void>;
@@ -11,18 +11,18 @@ type IReturnData = {
11
11
  value: {
12
12
  Key: string;
13
13
  OperationType: 'count' | 'sum' | 'avg' | 'max' | 'min';
14
- }[],
15
- where: [],
14
+ }[];
15
+ where: [];
16
16
  dimension: {
17
17
  TimeSpan?: string;
18
18
  Key?: string;
19
19
  IsCountEmpty?: boolean;
20
- },
20
+ };
21
21
  group: {
22
22
  TimeSpan?: string;
23
23
  Key?: string;
24
- },
25
- }
24
+ };
25
+ };
26
26
 
27
27
  /**
28
28
  * 图表处理基类
@@ -39,7 +39,6 @@ class EchartBase extends AbstractEchartBaseModal {
39
39
 
40
40
  public async setOptions(options: any): Promise<void> {}
41
41
 
42
-
43
42
  /** 获取所有配置好的图表数据 */
44
43
  public getOptions() {
45
44
  return this.config;
@@ -52,8 +51,8 @@ class EchartBase extends AbstractEchartBaseModal {
52
51
  xStatistics,
53
52
  xIsCountEmpty,
54
53
  yField,
55
- groupKey=({} as Record<string, any>),
56
- groupKeyTimeSpan='',
54
+ groupKey = {} as Record<string, any>,
55
+ groupKeyTimeSpan = '',
57
56
  }) {
58
57
  const objReturnData: IReturnData = {
59
58
  value: [],
@@ -61,28 +60,29 @@ class EchartBase extends AbstractEchartBaseModal {
61
60
  dimension: {},
62
61
  group: {},
63
62
  };
64
- if (filterData && filterData.length > 0) { // 协议转化,把首字母改成大写
63
+ if (filterData && filterData.length > 0) {
64
+ // 协议转化,把首字母改成大写
65
65
  objReturnData.where = filterData.map((val) => {
66
66
  let arrLogicData = val.logicData;
67
67
  if (val.logicData && val.logicData.length > 0) {
68
- arrLogicData = val.logicData.map((mval)=>{
68
+ arrLogicData = val.logicData.map((mval) => {
69
69
  return {
70
70
  Key: mval.key,
71
71
  Rel: mval.rel,
72
72
  Value: mval.value,
73
73
  Logic: mval.logic,
74
74
  Extra: {
75
- Type:mval?.extra?.type,
76
- Format:mval?.extra?.format,
77
- IsExpression:mval?.extra?.isExpression,
75
+ Type: mval?.extra?.type,
76
+ Format: mval?.extra?.format,
77
+ IsExpression: mval?.extra?.isExpression,
78
78
  },
79
- ValueType:mval.valueType,
80
- Expression:mval.expression
79
+ ValueType: mval.valueType,
80
+ Expression: mval.expression,
81
81
  };
82
82
  });
83
83
  }
84
84
  return {
85
- GroupLogic:val.groupLogic,
85
+ GroupLogic: val.groupLogic,
86
86
  LogicData: arrLogicData,
87
87
  };
88
88
  });
@@ -121,7 +121,7 @@ class EchartBase extends AbstractEchartBaseModal {
121
121
  sourceName = '',
122
122
  methods = '',
123
123
  dataSourceType = '',
124
- params,
124
+ params
125
125
  ) {
126
126
  try {
127
127
  if (dataSourceType === 'database') {
@@ -157,20 +157,20 @@ class EchartBase extends AbstractEchartBaseModal {
157
157
  this.config.title.right = null;
158
158
  }
159
159
 
160
- protected setLegend({ isLegend, legend= 'top'}) {
160
+ protected setLegend({ isLegend, legend = 'top' }) {
161
161
  this.config.legend.show = isLegend;
162
162
  switch (legend) {
163
- case 'top' :
163
+ case 'top':
164
164
  this.config.legend.orient = 'horizontal';
165
165
  this.config.legend.x = 'center';
166
166
  this.config.legend.top = '6%';
167
167
  break;
168
- case 'left' :
168
+ case 'left':
169
169
  this.config.legend.orient = 'vertical';
170
170
  this.config.legend.top = '30%';
171
171
  this.config.legend.left = '1%';
172
172
  break;
173
- case 'right' :
173
+ case 'right':
174
174
  this.config.legend.orient = 'vertical';
175
175
  this.config.legend.top = '30%';
176
176
  this.config.legend.right = '6%';
@@ -194,11 +194,11 @@ class EchartBase extends AbstractEchartBaseModal {
194
194
  sortedXAxisData.forEach((itemSource) => {
195
195
  let value = itemSource.XLabel.Value;
196
196
  if (formatType === 'datetime') {
197
- value = this.formatTime(itemSource.XLabel.Value, 'dt');
197
+ value = this.formatTime(itemSource.XLabel.Value, 'dt');
198
198
  } else if (formatType === 'date') {
199
- value = this.formatTime(itemSource.XLabel.Value, 'd');
199
+ value = this.formatTime(itemSource.XLabel.Value, 'd');
200
200
  } else if (formatType === 'time') {
201
- value = this.formatTime(itemSource.XLabel.Value, 't');
201
+ value = this.formatTime(itemSource.XLabel.Value, 't');
202
202
  }
203
203
  xAxisData.push(value);
204
204
  });
@@ -208,16 +208,19 @@ class EchartBase extends AbstractEchartBaseModal {
208
208
  }
209
209
  protected sortXAxisData(arrData, formatType = ''): Array<any> {
210
210
  let xFields = [...arrData];
211
- if(['datetime', 'date', 'time'].includes(formatType)) {
211
+ if (['datetime', 'date', 'time'].includes(formatType)) {
212
212
  xFields.sort((a, b) => {
213
- if(a.XLabel.Value && b.XLabel.Value ) {
214
- return new Date(a.XLabel.Value).getTime() - new Date(b.XLabel.Value).getTime();
213
+ if (a.XLabel.Value && b.XLabel.Value) {
214
+ return (
215
+ new Date(a.XLabel.Value).getTime() -
216
+ new Date(b.XLabel.Value).getTime()
217
+ );
215
218
  }
216
219
  // 产品需求空值放最后
217
- if(!a.XLabel.Value) {
220
+ if (!a.XLabel.Value) {
218
221
  return 1;
219
222
  }
220
- if(!b.XLabel.Value) {
223
+ if (!b.XLabel.Value) {
221
224
  return -1;
222
225
  }
223
226
  });
@@ -232,16 +235,17 @@ class EchartBase extends AbstractEchartBaseModal {
232
235
  * @param { string } timeType 需要格式化的类型 dt:日期时间,d:日期,t:时间
233
236
  * @returns { string } 格式化结果
234
237
  */
235
- private formatTime(time, timeType='dt') {
236
- if(typeof time === 'undefined' || time === null) {
238
+ private formatTime(time, timeType = 'dt') {
239
+ if (typeof time === 'undefined' || time === null) {
237
240
  return '空';
238
241
  }
239
- if (typeof(time) === 'string') { // 如果是字符串,代表后台返回的就是格式化的时间格式,则这里不再做格式化处理
242
+ if (typeof time === 'string') {
243
+ // 如果是字符串,代表后台返回的就是格式化的时间格式,则这里不再做格式化处理
240
244
  return time;
241
245
  }
242
246
  const date = new Date(time + 8 * 3600 * 1000);
243
247
  let startNum = 0;
244
- let endNum = 19;
248
+ let endNum = 19;
245
249
  if (timeType === 'd') {
246
250
  startNum = 0;
247
251
  endNum = 10;
@@ -301,13 +305,18 @@ class EchartBase extends AbstractEchartBaseModal {
301
305
  this.config.xAxis.name = isXaxisName ? xAxisName : '';
302
306
  }
303
307
  // 显示X轴刻度线
304
- protected setIsXaxisAxisTickShow({ isXaxisAxisTickShow }) {
305
- this.config.xAxis.axisTick = {show:isXaxisAxisTickShow};
308
+ protected setIsXaxisAxisTickShow({ isXaxisAxisTickShow }) {
309
+ this.config.xAxis.axisTick = { show: isXaxisAxisTickShow };
306
310
  }
307
311
  // X 轴文字倾斜
308
- protected setIsXaxisAxisLabelRotate({ isXaxisAxisLabelRotate, xStatistics, angle = 30}) {
312
+ protected setIsXaxisAxisLabelRotate({
313
+ isXaxisAxisLabelRotate,
314
+ xStatistics,
315
+ angle = 30,
316
+ }) {
309
317
  this.config.xAxis.axisLabel.rotate = isXaxisAxisLabelRotate ? angle : 0;
310
- if (isXaxisAxisLabelRotate || xStatistics) { // 如果X轴是时间类型,自动斜30度展示
318
+ if (isXaxisAxisLabelRotate || xStatistics) {
319
+ // 如果X轴是时间类型,自动斜30度展示
311
320
  this.config.xAxis.axisLabel.rotate = angle;
312
321
  } else {
313
322
  this.config.xAxis.axisLabel.rotate = 0;
@@ -319,8 +328,10 @@ class EchartBase extends AbstractEchartBaseModal {
319
328
  isYAxisSplitlineLinestyleWidth,
320
329
  yAxisSplitlineLinestyleType,
321
330
  }) {
322
- this.config.yAxis.splitLine = {lineStyle:{}};
323
- this.config.yAxis.splitLine.lineStyle.width = isYAxisSplitlineLinestyleWidth ? 1 : 0;
331
+ this.config.yAxis.splitLine = { lineStyle: {} };
332
+ this.config.yAxis.splitLine.lineStyle.width = isYAxisSplitlineLinestyleWidth
333
+ ? 1
334
+ : 0;
324
335
  this.config.yAxis.splitLine.lineStyle.type = yAxisSplitlineLinestyleType;
325
336
  }
326
337
  // 显示 Y 轴刻度 最大值,最小值
@@ -344,7 +355,9 @@ class EchartBase extends AbstractEchartBaseModal {
344
355
  */
345
356
  protected setEmptyValue(xIsCountEmpty) {
346
357
  if (!xIsCountEmpty) {
347
- const nonEmpty = this.config.xAxis.data.filter(item => item !== undefined && item !== null);
358
+ const nonEmpty = this.config.xAxis.data.filter(
359
+ (item) => item !== undefined && item !== null
360
+ );
348
361
  this.config.xAxis.data = nonEmpty;
349
362
  }
350
363
  }
@@ -357,7 +370,7 @@ class EchartBase extends AbstractEchartBaseModal {
357
370
  private removeEmpty(arrXAxis) {
358
371
  const arrNewxAxis = [];
359
372
  if (arrXAxis.length > 0) {
360
- for(let i = 0; i < arrXAxis.length; i++) {
373
+ for (let i = 0; i < arrXAxis.length; i++) {
361
374
  if (arrXAxis[i]) {
362
375
  arrNewxAxis.push(arrXAxis[i]);
363
376
  }
@@ -35,7 +35,7 @@ class EchartLine extends EchartBase {
35
35
  name,
36
36
  methodName,
37
37
  type,
38
- params,
38
+ params
39
39
  );
40
40
  // 获取 x 轴数据
41
41
 
@@ -57,12 +57,18 @@ class EchartLine extends EchartBase {
57
57
  },
58
58
  data: [],
59
59
  };
60
- sortedXAxisData.forEach((itemSource,index) => {
60
+ sortedXAxisData.forEach((itemSource, index) => {
61
61
  this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
62
- if ((itemSource.YLabels[j].Value === undefined || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
62
+ if (
63
+ (itemSource.YLabels[j].Value === undefined ||
64
+ itemSource.YLabels[j].Value === null) &&
65
+ !xIsCountEmpty
66
+ ) {
63
67
  arrXisCountEmptyIndex.push(index);
64
68
  } else {
65
- const value = itemSource.YLabels[j].Value ? itemSource.YLabels[j].Value : 0;
69
+ const value = itemSource.YLabels[j].Value
70
+ ? itemSource.YLabels[j].Value
71
+ : 0;
66
72
  this.config.series[j].data.push(value);
67
73
  }
68
74
  });
@@ -90,38 +96,28 @@ class EchartLine extends EchartBase {
90
96
  // 组装图表需要的数据
91
97
  const groupNames = Object.keys(objGroupKey);
92
98
  this.config.series = groupNames.map((groupKey) => {
93
- // groupKey分组字段中文名
94
- const serie = {
95
- name: groupKey,
96
- connectNulls: true,
97
- data: this.getSeriesDataGroup(
98
- arrXaxisData,
99
- objGroupKey[groupKey],
100
- ),
101
- type: 'line',
102
- smooth: true,
103
- showSymbol: true, // 是否显示线条上数据标签
104
- label: {
105
- show: true, // 显示线条上的数据
106
- },
107
- };
108
- return serie;
109
- });
110
- this.config.tooltip.formatter = params => (
111
- `${params.data.dimensionality
112
- }\r\n${
113
- params.data.name
114
- }\r\n${
115
- params.seriesName
116
- }:${
117
- params.value}`
118
- );
99
+ // groupKey分组字段中文名
100
+ const serie = {
101
+ name: groupKey,
102
+ connectNulls: true,
103
+ data: this.getSeriesDataGroup(arrXaxisData, objGroupKey[groupKey]),
104
+ type: 'line',
105
+ smooth: true,
106
+ showSymbol: true, // 是否显示线条上数据标签
107
+ label: {
108
+ show: true, // 显示线条上的数据
109
+ },
110
+ };
111
+ return serie;
112
+ });
113
+ this.config.tooltip.formatter = (params) =>
114
+ `${params.data.dimensionality}\r\n${params.data.name}\r\n${params.seriesName}:${params.value}`;
119
115
  }
120
116
  }
121
117
  }
122
118
  setChartType({ chartType }) {
123
- this.config.series.length > 0
124
- && this.config.series.forEach((itemSeries) => {
119
+ this.config.series.length > 0 &&
120
+ this.config.series.forEach((itemSeries) => {
125
121
  itemSeries.smooth = chartType !== 'line';
126
122
  });
127
123
  }
@@ -132,19 +128,17 @@ class EchartLine extends EchartBase {
132
128
  isUnit,
133
129
  unit,
134
130
  decimalDigits,
135
- suffix
131
+ suffix,
136
132
  }) {
137
133
  decimalDigits = decimalDigits < 0 ? 0 : decimalDigits;
138
- this.config.series.length > 0
139
- && this.config.series.forEach((itemSeries) => {
134
+ this.config.series.length > 0 &&
135
+ this.config.series.forEach((itemSeries) => {
140
136
  itemSeries.showSymbol = isSeriesShowSymbol;
141
137
  itemSeries.label.show = isSeriesShowSymbol;
142
138
  if (isUnit) {
143
139
  itemSeries.label.formatter = (params) => {
144
140
  const objNewValue = this.getValueByUnit(params.value, unit);
145
- return (
146
- `${objNewValue.toFixed(decimalDigits)}${suffix}`
147
- );
141
+ return `${objNewValue.toFixed(decimalDigits)}${suffix}`;
148
142
  };
149
143
  }
150
144
  });
@@ -189,7 +183,7 @@ class EchartLine extends EchartBase {
189
183
  isUnit,
190
184
  unit,
191
185
  decimalDigits,
192
- suffix
186
+ suffix,
193
187
  }) {
194
188
  if (dataSource) {
195
189
  await this.setSourceData({
@@ -223,7 +217,7 @@ class EchartLine extends EchartBase {
223
217
  isUnit,
224
218
  unit,
225
219
  decimalDigits,
226
- suffix
220
+ suffix,
227
221
  });
228
222
  }
229
223
  }
@@ -32,7 +32,7 @@ class EchartPie extends EchartBase {
32
32
  name,
33
33
  methodName,
34
34
  type,
35
- params,
35
+ params
36
36
  );
37
37
  // 获取 x 轴数据
38
38
  if (arrSourData.length >= 0) {
@@ -59,8 +59,8 @@ class EchartPie extends EchartBase {
59
59
  }
60
60
  }
61
61
  setChartType({ chartType }) {
62
- this.config.series.length > 0
63
- && this.config.series.forEach((itemSeries) => {
62
+ this.config.series.length > 0 &&
63
+ this.config.series.forEach((itemSeries) => {
64
64
  if (chartType === 'pie') {
65
65
  itemSeries.radius = '70%';
66
66
  } else {
@@ -77,7 +77,7 @@ class EchartPie extends EchartBase {
77
77
  isUnit,
78
78
  unit,
79
79
  decimalDigits,
80
- suffix
80
+ suffix,
81
81
  }) {
82
82
  decimalDigits = decimalDigits < 0 ? 0 : decimalDigits;
83
83
  let show = false;
@@ -94,10 +94,12 @@ class EchartPie extends EchartBase {
94
94
  } else {
95
95
  this.config.series[0].label.normal.formatter = (objValue) => {
96
96
  let reData = '';
97
- if (isSeriesShowSymbol) { // 显示数值
97
+ if (isSeriesShowSymbol) {
98
+ // 显示数值
98
99
  reData = objValue.value;
99
100
  }
100
- if (isUnit) { // 显示单位
101
+ if (isUnit) {
102
+ // 显示单位
101
103
  if (unit) {
102
104
  const objNewValue = this.getValueByUnit(objValue.value, unit);
103
105
  reData = `${objNewValue.toFixed(decimalDigits)}${suffix}`;
@@ -111,7 +113,8 @@ class EchartPie extends EchartBase {
111
113
  };
112
114
  });
113
115
  }
114
- if (isPercent) { // 显示百分比
116
+ if (isPercent) {
117
+ // 显示百分比
115
118
  reData = `${reData}(${objValue.percent}%)`;
116
119
  }
117
120
  return reData;
@@ -138,7 +141,7 @@ class EchartPie extends EchartBase {
138
141
  isUnit,
139
142
  unit,
140
143
  decimalDigits,
141
- suffix
144
+ suffix,
142
145
  }) {
143
146
  legend = document.body.clientWidth < 1024 ? legend : legend2;
144
147
  if (dataSource) {
@@ -162,7 +165,7 @@ class EchartPie extends EchartBase {
162
165
  isUnit,
163
166
  unit,
164
167
  decimalDigits,
165
- suffix
168
+ suffix,
166
169
  });
167
170
  }
168
171
  }
@@ -1,34 +1,34 @@
1
1
  export interface DataSource {
2
- name:string, // 数据源名
3
- type:string, // 数据源类型
4
- subType:string, // 数据源子类型
5
- provider?:string, // 内置连接器类型
6
- methodName:string // 数据源方法名
2
+ name: string; // 数据源名
3
+ type: string; // 数据源类型
4
+ subType: string; // 数据源子类型
5
+ provider?: string; // 内置连接器类型
6
+ methodName: string; // 数据源方法名
7
7
  }
8
8
  export interface ObjSource {
9
- dataSourceName:string, // 数据源名
10
- dataSourceType:string, // 数据源类型
11
- dataSourceMethodName:string // 数据源方法名
9
+ dataSourceName: string; // 数据源名
10
+ dataSourceType: string; // 数据源类型
11
+ dataSourceMethodName: string; // 数据源方法名
12
12
  }
13
13
  export interface Xfield {
14
- format:string,
15
- type:string,
16
- title:string,
17
- name:string,
14
+ format: string;
15
+ type: string;
16
+ title: string;
17
+ name: string;
18
18
  }
19
19
  enum CountType {
20
- 'count',
21
- 'sum',
22
- 'avg',
23
- 'max',
24
- 'min'
20
+ 'count',
21
+ 'sum',
22
+ 'avg',
23
+ 'max',
24
+ 'min',
25
25
  }
26
26
  export interface YfieldOne {
27
- key:string,
28
- operationType:CountType,
29
- title?:string,
27
+ key: string;
28
+ operationType: CountType;
29
+ title?: string;
30
30
  }
31
31
  export interface Yfield {
32
- groupKey?:string,
33
- numValue?:Array<YfieldOne>,
34
- }
32
+ groupKey?: string;
33
+ numValue?: Array<YfieldOne>;
34
+ }
@@ -17,17 +17,17 @@
17
17
  }
18
18
  .weda-ui-echart .echart-light-box {
19
19
  position: relative;
20
- background-color: #F4F5F6;
20
+ background-color: #f4f5f6;
21
21
  }
22
22
  .weda-ui-echart .echart-light-body {
23
23
  background-color: #ffffff;
24
24
  }
25
25
  .weda-ui-echart .echart-dark-box {
26
26
  position: relative;
27
- background-color: #4B5D6C;
27
+ background-color: #4b5d6c;
28
28
  }
29
29
  .weda-ui-echart .echart-dark-body {
30
- background-color: #1D1F24;
30
+ background-color: #1d1f24;
31
31
  margin: 6px;
32
32
  }
33
33
  .weda-ui-echart .btn-grounp {
@@ -67,20 +67,20 @@
67
67
  user-select: none;
68
68
  transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
69
69
  position: relative;
70
- color: #4B5D6C;
70
+ color: #4b5d6c;
71
71
  background-color: #fff;
72
- border-color: #CCD2D8;
72
+ border-color: #ccd2d8;
73
73
  }
74
74
  .weda-ui-echart .button,
75
- .weda-ui-echart html [type="button"],
76
- .weda-ui-echart [type="reset"],
77
- .weda-ui-echart [type="submit"] {
75
+ .weda-ui-echart html [type='button'],
76
+ .weda-ui-echart [type='reset'],
77
+ .weda-ui-echart [type='submit'] {
78
78
  -webkit-appearance: button;
79
79
  }
80
80
  .weda-ui-echart .ant-btn-primary {
81
81
  color: #fff;
82
- background-color: #4A62E7;
83
- border-color: #4A62E7;
82
+ background-color: #4a62e7;
83
+ border-color: #4a62e7;
84
84
  }
85
85
  .weda-ui-echart .ant-btn:not([disabled]):hover {
86
86
  text-decoration: none;
@@ -94,9 +94,9 @@
94
94
  }
95
95
  .weda-ui-echart .ant-btn:hover,
96
96
  .weda-ui-echart .ant-btn:focus {
97
- color: #4A62E7;
97
+ color: #4a62e7;
98
98
  background-color: #fff;
99
- border-color: #4A62E7;
99
+ border-color: #4a62e7;
100
100
  }
101
101
  .weda-ui-echart .ant-btn-primary:hover,
102
102
  .weda-ui-echart .ant-btn-primary:focus {
@@ -7,7 +7,7 @@ import {
7
7
  TitleComponent,
8
8
  TooltipComponent,
9
9
  LegendComponent,
10
- GridComponent
10
+ GridComponent,
11
11
  } from 'echarts/components';
12
12
  // 标签自动布局,全局过渡动画等特性
13
13
  import { LabelLayout, UniversalTransition } from 'echarts/features';
@@ -25,9 +25,7 @@ echarts.use([
25
25
  CanvasRenderer,
26
26
  BarChart,
27
27
  LineChart,
28
- PieChart
28
+ PieChart,
29
29
  ]);
30
30
 
31
- export {
32
- echarts
33
- };
31
+ export { echarts };
@@ -1,14 +1,28 @@
1
- import { useAsync, useDeepCompareEffect, useEventListener, useIsMounted, useMountEffect } from "@react-hookz/web";
2
- import { MutableRefObject, RefObject, useCallback, useEffect, useMemo, useRef } from "react";
3
- import { IEchartModalBase } from "./core/eChartBase";
4
- import { echarts } from "./echarts";
1
+ import {
2
+ useAsync,
3
+ useDeepCompareEffect,
4
+ useEventListener,
5
+ useIsMounted,
6
+ useMountEffect,
7
+ } from '@react-hookz/web';
8
+ import {
9
+ MutableRefObject,
10
+ RefObject,
11
+ useCallback,
12
+ useEffect,
13
+ useMemo,
14
+ useRef,
15
+ } from 'react';
16
+ import { IEchartModalBase } from './core/eChartBase';
17
+ import { echarts } from './echarts';
5
18
 
6
- export function useChart(ref: RefObject<HTMLElement> | MutableRefObject<HTMLElement>) {
19
+ export function useChart(
20
+ ref: RefObject<HTMLElement> | MutableRefObject<HTMLElement>
21
+ ) {
7
22
  const chartRef = useRef<echarts.ECharts>();
8
23
  const isMounted = useIsMounted();
9
24
  useMountEffect(() => {
10
-
11
- if(!ref.current || !isMounted) {
25
+ if (!ref.current || !isMounted) {
12
26
  return;
13
27
  }
14
28
 
@@ -28,16 +42,19 @@ export function useChart(ref: RefObject<HTMLElement> | MutableRefObject<HTMLElem
28
42
  return chartRef.current;
29
43
  }
30
44
 
31
-
32
45
  /**
33
46
  * @deprecated The method should not be used
34
47
  */
35
- export function useWedaChart(domRef, ModalClass: IEchartModalBase, options: echarts.EChartsCoreOption) {
48
+ export function useWedaChart(
49
+ domRef,
50
+ ModalClass: IEchartModalBase,
51
+ options: echarts.EChartsCoreOption
52
+ ) {
36
53
  const chart = useChart(domRef);
37
- const getOptions = async() => {
54
+ const getOptions = async () => {
38
55
  const chartModal = new ModalClass();
39
56
  let finalOptions: any = await chartModal.setOptions(options);
40
- if(!finalOptions) {
57
+ if (!finalOptions) {
41
58
  finalOptions = chartModal.getOptions() as any;
42
59
  }
43
60
  return finalOptions;
@@ -50,18 +67,19 @@ export function useWedaChart(domRef, ModalClass: IEchartModalBase, options: echa
50
67
  useDeepCompareEffect(() => {
51
68
  actions.execute();
52
69
  }, [
53
- // options 变化,包含所有配置项,包括纯前端的配置项变化都会触发setOptions里发请求,但改不动了
54
- options,
55
- actions]);
70
+ // options 变化,包含所有配置项,包括纯前端的配置项变化都会触发setOptions里发请求,但改不动了
71
+ options,
72
+ actions,
73
+ ]);
56
74
  useEffect(() => {
57
- if(state.status === 'success' && chart) {
75
+ if (state.status === 'success' && chart) {
58
76
  console.log(ModalClass.name, options, state.result, window.location.href);
59
77
  chart.setOption(
60
78
  state.result,
61
79
  true // noMerge 全刷
62
80
  );
63
81
  } else {
64
- if(state.status === 'error') {
82
+ if (state.status === 'error') {
65
83
  console.error(state.error);
66
84
  }
67
85
  }