@cloudbase/weda-ui 0.2.17 → 2.0.8

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 (269) hide show
  1. package/README.md +3 -0
  2. package/package.json +10 -5
  3. package/src/configs/components/button.json +0 -2
  4. package/src/configs/components/calendar.json +9 -3
  5. package/src/configs/components/carousel.json +18 -9
  6. package/src/configs/components/chart/bar.json +31 -12
  7. package/src/configs/components/chart/line.json +27 -10
  8. package/src/configs/components/chart/pie.json +22 -8
  9. package/src/configs/components/chart/statisticsCard.json +61 -13
  10. package/src/configs/components/container.json +7 -2
  11. package/src/configs/components/dataView.json +31 -11
  12. package/src/configs/components/form/checkbox.json +97 -5
  13. package/src/configs/components/form/radio.json +123 -4
  14. package/src/configs/components/form/select.json +247 -13
  15. package/src/configs/components/graphicCard.json +90 -75
  16. package/src/configs/components/image.json +19 -8
  17. package/src/configs/components/link.json +25 -6
  18. package/src/configs/components/listView.json +83 -27
  19. package/src/configs/components/lottery.json +153 -0
  20. package/src/configs/components/modal.json +37 -5
  21. package/src/configs/components/navLayout.json +97 -79
  22. package/src/configs/components/navigationBar.json +59 -0
  23. package/src/configs/components/richtextview.json +6 -2
  24. package/src/configs/components/scrollVeiw.json +98 -34
  25. package/src/configs/components/swiper.json +22 -10
  26. package/src/configs/components/tabs.json +54 -9
  27. package/src/configs/components/text.json +43 -30
  28. package/src/configs/components/wxOpenApi/phone.json +141 -0
  29. package/src/configs/components/wxOpenApi/phoneCode.json +121 -0
  30. package/src/configs/components/wxOpenApi/share.json +167 -0
  31. package/src/configs/components/wxOpenApi/userInfo.json +174 -0
  32. package/src/configs/index.js +13 -0
  33. package/src/docs/common/format.tsx +112 -0
  34. package/src/docs/common/tableView.css +164 -0
  35. package/src/docs/common/tableView.tsx +273 -0
  36. package/src/docs/compsdocs/chart/Bar.mdx +159 -0
  37. package/src/docs/compsdocs/chart/Line.mdx +100 -0
  38. package/src/docs/compsdocs/chart/Pie.mdx +83 -0
  39. package/src/docs/compsdocs/chart/_category_.json +1 -0
  40. package/src/docs/compsdocs/chart/statisticsCard.mdx +51 -0
  41. package/src/docs/compsdocs/database/DataView.mdx +33 -0
  42. package/src/docs/compsdocs/database/ListView.mdx +33 -0
  43. package/src/docs/compsdocs/database/_category_.json +1 -0
  44. package/src/docs/compsdocs/form/Form.mdx +35 -0
  45. package/src/docs/compsdocs/form/FormCheckbox.mdx +35 -0
  46. package/src/docs/compsdocs/form/FormDate.mdx +30 -0
  47. package/src/docs/compsdocs/form/FormEmail.mdx +30 -0
  48. package/src/docs/compsdocs/form/FormImageUploader.mdx +31 -0
  49. package/src/docs/compsdocs/form/FormInput.mdx +30 -0
  50. package/src/docs/compsdocs/form/FormLocation.mdx +64 -0
  51. package/src/docs/compsdocs/form/FormPhone.mdx +30 -0
  52. package/src/docs/compsdocs/form/FormRadio.mdx +35 -0
  53. package/src/docs/compsdocs/form/FormRegion.mdx +30 -0
  54. package/src/docs/compsdocs/form/FormSelect.mdx +36 -0
  55. package/src/docs/compsdocs/form/FormSwitch.mdx +30 -0
  56. package/src/docs/compsdocs/form/FormTextarea.mdx +30 -0
  57. package/src/docs/compsdocs/form/FormTime.mdx +30 -0
  58. package/src/docs/compsdocs/form/FormUploadFile.mdx +30 -0
  59. package/src/docs/compsdocs/form/FormUrl.mdx +30 -0
  60. package/src/docs/compsdocs/form/_category_.json +1 -0
  61. package/src/docs/compsdocs/grid/Card.mdx +32 -0
  62. package/src/docs/compsdocs/grid/Container.mdx +42 -0
  63. package/src/docs/compsdocs/grid/Footer.mdx +31 -0
  64. package/src/docs/compsdocs/grid/GridLayout.mdx +32 -0
  65. package/src/docs/compsdocs/grid/Header.mdx +31 -0
  66. package/src/docs/compsdocs/grid/Layout.mdx +25 -0
  67. package/src/docs/compsdocs/grid/List.mdx +31 -0
  68. package/src/docs/compsdocs/grid/ScrollView.mdx +37 -0
  69. package/src/docs/compsdocs/grid/Swiper.mdx +58 -0
  70. package/src/docs/compsdocs/grid/_category_.json +1 -0
  71. package/src/docs/compsdocs/media/Icon.mdx +31 -0
  72. package/src/docs/compsdocs/media/Image.mdx +55 -0
  73. package/src/docs/compsdocs/media/_category_.json +1 -0
  74. package/src/docs/compsdocs/model/ModelCreate.mdx +20 -0
  75. package/src/docs/compsdocs/model/ModelDetail.mdx +20 -0
  76. package/src/docs/compsdocs/model/ModelTable.mdx +24 -0
  77. package/src/docs/compsdocs/model/ModelUpdate.mdx +21 -0
  78. package/src/docs/compsdocs/model/PageLayout.mdx +21 -0
  79. package/src/docs/compsdocs/model/_category_.json +1 -0
  80. package/src/docs/compsdocs/navmenu/Classification.mdx +38 -0
  81. package/src/docs/compsdocs/navmenu/NavBar.mdx +43 -0
  82. package/src/docs/compsdocs/navmenu/NavLayout.mdx +30 -0
  83. package/src/docs/compsdocs/navmenu/TabBar.mdx +43 -0
  84. package/src/docs/compsdocs/navmenu/TabBarItem.mdx +29 -0
  85. package/src/docs/compsdocs/navmenu/_category_.json +1 -0
  86. package/src/docs/compsdocs/senior/Lottery.mdx +48 -0
  87. package/src/docs/compsdocs/senior/Modal.mdx +58 -0
  88. package/src/docs/compsdocs/senior/SlotMachine.mdx +52 -0
  89. package/src/docs/compsdocs/senior/_category_.json +1 -0
  90. package/src/docs/compsdocs/show/Calendar.mdx +29 -0
  91. package/src/docs/compsdocs/show/Divider.mdx +31 -0
  92. package/src/docs/compsdocs/show/GraphicCard.mdx +30 -0
  93. package/src/docs/compsdocs/show/Item.mdx +32 -0
  94. package/src/docs/compsdocs/show/ItemList.mdx +47 -0
  95. package/src/docs/compsdocs/show/Media.mdx +25 -0
  96. package/src/docs/compsdocs/show/StatusTip.mdx +25 -0
  97. package/src/docs/compsdocs/show/Swiper.mdx +33 -0
  98. package/src/docs/compsdocs/show/Tabs.mdx +38 -0
  99. package/src/docs/compsdocs/show/_category_.json +1 -0
  100. package/src/docs/compsdocs/show/button.mdx +25 -0
  101. package/src/docs/compsdocs/text/Link.mdx +43 -0
  102. package/src/docs/compsdocs/text/RichTextView.mdx +36 -0
  103. package/src/docs/compsdocs/text/Text.mdx +31 -0
  104. package/src/docs/compsdocs/text/Title.mdx +32 -0
  105. package/src/docs/compsdocs/text/_category_.json +1 -0
  106. package/src/docs/compsdocs/wxOpen/Phone.mdx +60 -0
  107. package/src/docs/compsdocs/wxOpen/Share.mdx +46 -0
  108. package/src/docs/compsdocs/wxOpen/UserInfo.mdx +60 -0
  109. package/src/docs/compsdocs/wxOpen/_category_.json +4 -0
  110. package/src/index.js +2 -0
  111. package/src/mp/components/button/index.js +18 -2
  112. package/src/mp/components/button/index.wxml +7 -4
  113. package/src/mp/components/chart/bar/index.js +6 -2
  114. package/src/mp/components/chart/common/core/eChartBar.js +9 -8
  115. package/src/mp/components/chart/common/core/eChartBase.js +20 -16
  116. package/src/mp/components/chart/common/core/eChartLine.js +6 -5
  117. package/src/mp/components/chart/line/index.js +10 -6
  118. package/src/mp/components/chart/pie/index.js +6 -2
  119. package/src/mp/components/chart/statisticsCard/index.js +33 -6
  120. package/src/mp/components/dataView/index.json +1 -1
  121. package/src/mp/components/form/checkbox/index.js +41 -2
  122. package/src/mp/components/form/checkbox/index.wxml +1 -1
  123. package/src/mp/components/form/form/index.wxml +1 -2
  124. package/src/mp/components/form/formcell/index.wxml +1 -1
  125. package/src/mp/components/form/formcell/index.wxss +17 -0
  126. package/src/mp/components/form/input/index.js +1 -1
  127. package/src/mp/components/form/input/index.wxss +15 -0
  128. package/src/mp/components/form/location/index.js +43 -2
  129. package/src/mp/components/form/location/index.wxss +4 -6
  130. package/src/mp/components/form/radio/index.js +34 -1
  131. package/src/mp/components/form/select/index.js +351 -41
  132. package/src/mp/components/form/select/index.wxml +17 -2
  133. package/src/mp/components/form/select/index.wxss +4 -0
  134. package/src/mp/components/form/select/region/index.js +101 -0
  135. package/src/mp/components/form/textarea/index.js +1 -1
  136. package/src/mp/components/form/textarea/index.wxss +4 -0
  137. package/src/mp/components/form/uploader/index.js +39 -27
  138. package/src/mp/components/form/uploader/index.json +3 -2
  139. package/src/mp/components/form/uploader/index.wxml +11 -7
  140. package/src/mp/components/form/uploader/index.wxss +20 -2
  141. package/src/mp/components/form/uploader/weui-uploader.js +209 -0
  142. package/src/mp/components/form/uploader/weui-uploader.json +7 -0
  143. package/src/mp/components/form/uploader/weui-uploader.wxml +45 -0
  144. package/src/mp/components/form/uploader/weui-uploader.wxss +1 -0
  145. package/src/mp/components/form/uploaderFile/index.js +10 -6
  146. package/src/mp/components/form/uploaderFile/index.wxss +4 -4
  147. package/src/mp/components/image/index.wxss +3 -2
  148. package/src/mp/components/listView/index.js +38 -43
  149. package/src/mp/components/listView/index.wxml +1 -1
  150. package/src/mp/components/listView/index.wxss +5 -0
  151. package/src/mp/components/lottery/index.js +270 -0
  152. package/src/mp/components/{internals/listView → lottery}/index.json +0 -0
  153. package/src/mp/components/lottery/index.wxml +43 -0
  154. package/src/mp/components/lottery/index.wxss +317 -0
  155. package/src/mp/components/navigationBar/index.js +193 -0
  156. package/src/mp/components/navigationBar/index.json +6 -0
  157. package/src/mp/components/navigationBar/index.wxml +88 -0
  158. package/src/mp/components/navigationBar/index.wxss +1257 -0
  159. package/src/mp/components/tabs/index.js +7 -2
  160. package/src/mp/components/tabs/index.wxml +2 -1
  161. package/src/mp/components/text/index.js +0 -25
  162. package/src/mp/components/text/index.wxml +3 -3
  163. package/src/mp/components/wxOpenApi/phone/index.js +117 -0
  164. package/src/mp/components/wxOpenApi/phone/index.json +4 -0
  165. package/src/mp/components/wxOpenApi/phone/index.wxml +15 -0
  166. package/src/mp/components/wxOpenApi/phone/index.wxss +22 -0
  167. package/src/mp/components/wxOpenApi/phoneCode/index.js +89 -0
  168. package/src/mp/components/wxOpenApi/phoneCode/index.json +4 -0
  169. package/src/mp/components/wxOpenApi/phoneCode/index.wxml +15 -0
  170. package/src/mp/components/wxOpenApi/phoneCode/index.wxss +22 -0
  171. package/src/mp/components/wxOpenApi/share/index.js +117 -0
  172. package/src/mp/components/wxOpenApi/share/index.json +4 -0
  173. package/src/mp/components/wxOpenApi/share/index.wxml +15 -0
  174. package/src/mp/components/wxOpenApi/share/index.wxss +22 -0
  175. package/src/mp/components/wxOpenApi/userInfo/index.js +88 -0
  176. package/src/mp/components/wxOpenApi/userInfo/index.json +4 -0
  177. package/src/mp/components/wxOpenApi/userInfo/index.wxml +14 -0
  178. package/src/mp/components/wxOpenApi/userInfo/index.wxss +22 -0
  179. package/src/mp/index.json +7 -1
  180. package/src/mp/style/weda-ui.wxss +16 -0
  181. package/src/mp/utils/constant.js +15 -0
  182. package/src/mp/utils/destr.js +48 -0
  183. package/src/mp/utils/lodash.js +2 -0
  184. package/src/mp/utils/platform.js +10 -0
  185. package/src/mp/utils/tcb.js +44 -0
  186. package/src/web/components/button/index.css +8 -1
  187. package/src/web/components/button/index.tsx +10 -9
  188. package/src/web/components/calendar/index.jsx +1 -1
  189. package/src/web/components/carousel/index.tsx +8 -8
  190. package/src/web/components/chart/bar/index.tsx +40 -39
  191. package/src/web/components/chart/common/config/line.js +1 -1
  192. package/src/web/components/chart/common/core/eChartBar.js +7 -6
  193. package/src/web/components/chart/common/core/eChartBase.ts +20 -16
  194. package/src/web/components/chart/common/core/eChartLine.js +8 -6
  195. package/src/web/components/chart/line/index.tsx +40 -39
  196. package/src/web/components/chart/statisticsCard/index.tsx +29 -8
  197. package/src/web/components/form/checkbox/index.tsx +61 -23
  198. package/src/web/components/form/form/index.css +5 -1
  199. package/src/web/components/form/form/index.tsx +3 -1
  200. package/src/web/components/form/formcell/index.css +22 -1
  201. package/src/web/components/form/formcell/index.tsx +11 -6
  202. package/src/web/components/form/input/index.css +7 -12
  203. package/src/web/components/form/location/components/LocationH5/index.css +4 -7
  204. package/src/web/components/form/location/components/LocationH5/location.h5.jsx +1 -1
  205. package/src/web/components/form/radio/index.tsx +90 -53
  206. package/src/web/components/form/select/h5.tsx +370 -73
  207. package/src/web/components/form/select/index.css +15 -0
  208. package/src/web/components/form/select/index.tsx +392 -145
  209. package/src/web/components/form/select/region/index.ts +122 -31
  210. package/src/web/components/form/select/time.jsx +89 -0
  211. package/src/web/components/form/select/year.tsx +170 -0
  212. package/src/web/components/form/textarea/index.css +4 -0
  213. package/src/web/components/form/textarea/index.tsx +2 -2
  214. package/src/web/components/form/tips/index.css +4 -0
  215. package/src/web/components/form/tips/index.tsx +4 -3
  216. package/src/web/components/form/uploader/index.css +26 -2
  217. package/src/web/components/form/uploader/uploader.h5.tsx +89 -57
  218. package/src/web/components/form/uploader/uploader.pc.tsx +4 -4
  219. package/src/web/components/form/uploaderFile/index.css +2 -4
  220. package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +13 -7
  221. package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +13 -5
  222. package/src/web/components/image/image.tsx +1 -1
  223. package/src/web/components/image/index.css +3 -3
  224. package/src/web/components/image/index.tsx +6 -7
  225. package/src/web/components/index.js +8 -0
  226. package/src/web/components/link/index.tsx +7 -4
  227. package/src/web/components/listView/index.css +4 -0
  228. package/src/web/components/listView/index.tsx +12 -20
  229. package/src/web/components/lottery/index.css +327 -0
  230. package/src/web/components/lottery/index.tsx +567 -0
  231. package/src/web/components/lottery/lotteryUtil.ts +130 -0
  232. package/src/web/components/modal/index.tsx +3 -1
  233. package/src/web/components/navLayout/index.tsx +2 -2
  234. package/src/web/components/navigationBar/chevron-right--double.svg +3 -0
  235. package/src/web/components/navigationBar/common.tsx +198 -0
  236. package/src/web/components/navigationBar/h5Menu.tsx +179 -0
  237. package/src/web/components/navigationBar/horizontalMenu.tsx +200 -0
  238. package/src/web/components/navigationBar/index.css +762 -0
  239. package/src/web/components/navigationBar/index.tsx +230 -0
  240. package/src/web/components/navigationBar/type.d.ts +111 -0
  241. package/src/web/components/navigationBar/verticalMenu.tsx +81 -0
  242. package/src/web/components/phone/index.css +0 -0
  243. package/src/web/components/phone/index.tsx +22 -0
  244. package/src/web/components/phoneCode/index.css +0 -0
  245. package/src/web/components/phoneCode/index.tsx +22 -0
  246. package/src/web/components/picker/timePicker.tsx +2 -2
  247. package/src/web/components/richTextView/index.tsx +3 -5
  248. package/src/web/components/share/index.css +0 -0
  249. package/src/web/components/share/index.tsx +38 -0
  250. package/src/web/components/slot/index.tsx +1 -1
  251. package/src/web/components/tabs/index.tsx +2 -0
  252. package/src/web/components/tabs/tabs.h5.tsx +43 -33
  253. package/src/web/components/tabs/tabs.pc.tsx +23 -10
  254. package/src/web/components/text/index.tsx +12 -20
  255. package/src/web/components/userInfo/index.css +0 -0
  256. package/src/web/components/userInfo/index.tsx +30 -0
  257. package/src/web/utils/{constant.js → constant.ts} +17 -2
  258. package/src/web/utils/lodash.ts +2 -0
  259. package/src/web/utils/platform.js +9 -0
  260. package/src/web/utils/tcb.js +26 -0
  261. package/src/web/weda-ui.css +7 -1
  262. package/src/mp/components/internals/listView/arrow-right-line.svg +0 -3
  263. package/src/mp/components/internals/listView/index.js +0 -286
  264. package/src/mp/components/internals/listView/index.wxml +0 -40
  265. package/src/mp/components/internals/listView/index.wxss +0 -150
  266. package/src/mp/components/internals/listView/more-line.svg +0 -3
  267. package/src/web/components/form/select/region/cities.ts +0 -2410
  268. package/src/web/components/form/select/region/provinces.ts +0 -240
  269. package/src/web/components/form/select/region/regions.ts +0 -20645
package/src/mp/index.json CHANGED
@@ -29,6 +29,7 @@
29
29
  "RichTextView": "components/richText/index",
30
30
  "Tabs": "components/tabs/index",
31
31
  "ListView": "components/listView/index",
32
+ "NavigationBar": "components/navigationBar/index",
32
33
  "DataView": "components/dataView/index",
33
34
  "Calendar": "components/calendar/index",
34
35
  "NavLayout": "components/navLayout/index",
@@ -36,7 +37,12 @@
36
37
  "Bar": "components/chart/bar/index",
37
38
  "Pie": "components/chart/pie/index",
38
39
  "StatisticsCard": "components/chart/statisticsCard/index",
39
- "GraphicCard": "components/graphicCard/index"
40
+ "GraphicCard": "components/graphicCard/index",
41
+ "UserInfo": "components/wxOpenApi/userInfo/index",
42
+ "Phone": "components/wxOpenApi/phone/index",
43
+ "Share": "components/wxOpenApi/share/index",
44
+ "Lottery": "components/lottery/index",
45
+ "PhoneCode": "components/wxOpenApi/phoneCode/index"
40
46
  },
41
47
  "actions": {
42
48
  "showToast": "actions/showToast/index",
@@ -6,6 +6,8 @@ page .weda-ui {
6
6
  --weui-BRAND: #006eff;
7
7
  --weui-TAG-TEXT-BLUE: #0067eb;
8
8
  --weui-BTN-DEFAULT-COLOR: #576b95;
9
+ --weui-WECHAT: #07c160;
10
+ --weui-TAG-TEXT-GREEN: #06ae56;
9
11
  --weui-BG-2: rgba(255, 255, 255, 0);
10
12
  }
11
13
 
@@ -38,3 +40,17 @@ page .weda-ui {
38
40
  .weda-ui.weda-picker .weui-btn_primary:not(.weui-btn_disabled):active {
39
41
  background-color: var(--weui-TAG-TEXT-BLUE);
40
42
  }
43
+
44
+ .weda-ui .weui-cell {
45
+ font-size: 16px; /* 修改默认weui的17为16 */
46
+ }
47
+
48
+ .weui-cells__group_form .weui-cell::before, .weui-cells__group_form .weui-cells::before {
49
+ left: 16px;
50
+ right: 16px;
51
+ }
52
+
53
+ .weui-cells__group_form .weui-cells::after {
54
+ left: 16px;
55
+ right: 16px;
56
+ }
@@ -3,3 +3,18 @@ export const TitleType = {
3
3
  TOP: 'top',
4
4
  NONE: 'none',
5
5
  };
6
+
7
+ export const REL_DICT = {
8
+ equal: 'eq', // 等于
9
+ unequal: 'neq', // 不等于
10
+ include: 'search', // 包含
11
+ exclude: '_exclude', // 不包含
12
+ begin_with: '_begin_with', // 开头是
13
+ greater: 'gt', // 大于
14
+ greater_or_equal: 'gte', // 大于等于
15
+ bigger_or_equal: 'gte', //大于等于
16
+ less: 'lt', // 小于
17
+ less_or_equal: 'lte', // 小于等于
18
+ in: 'in', // 多选值
19
+ not_in: 'nin', // 不在多选值
20
+ };
@@ -0,0 +1,48 @@
1
+ // https://github.com/unjs/destr/blob/2f6612533dd798d2ff5786274f2244558f86d09c/src/index.ts
2
+ // https://github.com/fastify/secure-json-parse
3
+ // https://github.com/hapijs/bourne
4
+ const suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
5
+ const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
6
+ const JsonSigRx = /^["{[]|^-?[0-9][0-9.]{0,14}$/;
7
+ function jsonParseTransform(key, value) {
8
+ if (key === '__proto__' || key === 'constructor') {
9
+ return;
10
+ }
11
+ return value;
12
+ }
13
+ export default function destr(val) {
14
+ if (typeof val !== 'string') {
15
+ return val;
16
+ }
17
+ const _lval = val.toLowerCase();
18
+ if (_lval === 'true') {
19
+ return true;
20
+ }
21
+ if (_lval === 'false') {
22
+ return false;
23
+ }
24
+ if (_lval === 'null') {
25
+ return null;
26
+ }
27
+ if (_lval === 'nan') {
28
+ return NaN;
29
+ }
30
+ if (_lval === 'infinity') {
31
+ return Infinity;
32
+ }
33
+ if (_lval === 'undefined') {
34
+ return undefined;
35
+ }
36
+ if (!JsonSigRx.test(val)) {
37
+ return val;
38
+ }
39
+ try {
40
+ if (suspectProtoRx.test(val) || suspectConstructorRx.test(val)) {
41
+ return JSON.parse(val, jsonParseTransform);
42
+ }
43
+ return JSON.parse(val);
44
+ }
45
+ catch (_e) {
46
+ return val;
47
+ }
48
+ }
@@ -0,0 +1,2 @@
1
+ // https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L11973
2
+ export const isNil = (val) => val == null;
@@ -18,6 +18,16 @@ export const transSize = (size) => {
18
18
  const g = getBig(m);
19
19
  return `${g}G`;
20
20
  };
21
+
22
+ /**
23
+ * 判断是否是url
24
+ */
25
+ const reg =
26
+ // eslint-disable-next-line no-useless-escape
27
+ /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
28
+
29
+ export const isUrl = (path) => reg.test(path);
30
+
21
31
  /**
22
32
  * 生成随机数
23
33
  */
@@ -13,6 +13,32 @@ export async function getTempFileURL(data) {
13
13
  }
14
14
  }
15
15
 
16
+ /**
17
+ * 云API:获取用户自定义导航内容
18
+ * param
19
+ * WeAppId: string,
20
+ * EnvId: string,
21
+ * PublishType?: string,
22
+ */
23
+ export async function getAppCustomNav() {
24
+ try {
25
+ const PublishType = getApp().app.cloud?.IS_WEDA_IDE ? 'preview' : '';
26
+ const WeAppId = getApp().app?.id;
27
+ const res = await callWedaApi({
28
+ action: 'DescribeAppCustomNav',
29
+ serviceType: 'lowcode',
30
+ data: {
31
+ WeAppId,
32
+ PublishType,
33
+ },
34
+ });
35
+ return res;
36
+ } catch (error) {
37
+ console.error('错误', error);
38
+ return {};
39
+ }
40
+ }
41
+
16
42
  /**
17
43
  * 调用微搭后端API服务
18
44
  */
@@ -30,3 +56,21 @@ export async function callDataSource(param) {
30
56
  return await getApp().app.cloud.callDataSource(param);
31
57
  }
32
58
  }
59
+
60
+ /**
61
+ * 云函数获取数据
62
+ */
63
+ export async function callDataSourceApi(param) {
64
+ const { params, dataSourceName, methodName } = param;
65
+ try {
66
+ const res = await getApp()?.app?.cloud?.callDataSource?.({
67
+ params,
68
+ dataSourceName,
69
+ methodName,
70
+ });
71
+ return res;
72
+ } catch (error) {
73
+ console.error('错误', error);
74
+ return {};
75
+ }
76
+ }
@@ -6,6 +6,14 @@
6
6
  background-color: var(--weui-BRAND);
7
7
  }
8
8
 
9
+ .weda-button.weui-btn.weui-btn_primary.weui-btn_wechat:not(.weui-btn_disabled):active {
10
+ background-color: var(--weui-TAG-TEXT-GREEN);
11
+ }
12
+
13
+ .weda-button.weui-btn_primary.weui-btn_wechat {
14
+ background-color: var(--weui-WECHAT);
15
+ }
16
+
9
17
  .weda-button.weda-button-mini {
10
18
  font-size: smaller;
11
19
  }
@@ -17,4 +25,3 @@
17
25
  text-align: center;
18
26
  width: 100%;
19
27
  }
20
-
@@ -8,13 +8,13 @@ import './index.css';
8
8
 
9
9
  // 不用 react-weui 而直接用底层实现的原因是 react-weui 不能支持表单类型
10
10
  const Button = ({
11
- text = '按钮',
12
- size = 'default',
13
- type = 'primary',
11
+ text,
12
+ size,
13
+ type,
14
14
  contentSlot,
15
15
  formType,
16
- loading = false,
17
- disabled = false,
16
+ loading,
17
+ disabled,
18
18
  events = ({} as Record<string, unknownFunction>),
19
19
  className,
20
20
  style,
@@ -29,9 +29,10 @@ const Button = ({
29
29
  'weda-button-mini': size === 'mini',
30
30
  'weui-btn': isH5,
31
31
  'weui-btn_mini': isH5 && size === 'mini',
32
- 'weui-btn_primary': isH5 && type === 'primary',
32
+ 'weui-btn_primary': isH5 && (type === 'primary' || type === 'wechat'),
33
33
  'weui-btn_default': isH5 && type === 'default',
34
34
  'weui-btn_warn': isH5 && type === 'warn',
35
+ 'weui-btn_wechat': isH5 && type === 'wechat',
35
36
  'weui-btn_disabled': isH5 && disabled,
36
37
  [className]: className,
37
38
  });
@@ -60,7 +61,7 @@ const Button = ({
60
61
  return (
61
62
  <ConfigProvider classPrefix="wedatea2td">
62
63
  <TeaButton
63
- loading={loading}
64
+ loading={loading}
64
65
  onClick={onClick}
65
66
  disabled={disabled}
66
67
  htmlType={formType}
@@ -90,7 +91,7 @@ export interface PropsType extends CommonPropsType {
90
91
  /**
91
92
  * 样式类型
92
93
  */
93
- type?: "primary" | "warn" | "default";
94
+ type?: 'primary' | 'warn' | 'wechat' | 'default';
94
95
  /**
95
96
  * 大小
96
97
  */
@@ -111,4 +112,4 @@ export interface PropsType extends CommonPropsType {
111
112
  contentSlot?: string;
112
113
  }
113
114
 
114
- export default Button;
115
+ export default Button;
@@ -19,7 +19,7 @@ const isShowWeekend = true; // 是否显示周末
19
19
  export default function Calendar({
20
20
  className,
21
21
  style,
22
- initVisible = true,
22
+ initVisible,
23
23
  initValue,
24
24
  configData = [],
25
25
  }) {
@@ -50,15 +50,15 @@ export interface PropsType extends CommonPropsType {
50
50
  export default function Carousel({
51
51
  className,
52
52
  style = {},
53
- autoplay = true,
54
- circular = true,
55
- vertical = false,
53
+ autoplay,
54
+ circular,
55
+ vertical,
56
56
  indicatorDots,
57
- indicatorColor = 'rgba(200, 200, 200, 0.9)',
58
- indicatorActiveColor = 'rgba(0, 0, 0, 0.9)',
59
- duration = 500,
60
- interval = 5000,
61
- current = 0,
57
+ indicatorColor,
58
+ indicatorActiveColor,
59
+ duration,
60
+ interval,
61
+ current,
62
62
  events = {},
63
63
  id,
64
64
  images,
@@ -40,45 +40,46 @@ interface PropsType extends CommonPropsType {
40
40
  decimalDigits?: number;
41
41
  suffix?: string;
42
42
  }
43
- export default function Bar({
44
- directionType,
45
- isPile,
46
- id,
47
- style,
48
- className,
49
- isTitle,
50
- title,
51
- titleLocation,
52
- dataSource,
53
- setColor,
54
- filterData,
55
- xField,
56
- xStatistics,
57
- groupKey,
58
- groupKeyTimeSpan,
59
- xIsCountEmpty,
60
- yField,
61
- isLegend,
62
- legend,
63
- legend2,
64
- isXaxisName,
65
- xAxisName,
66
- isXaxisAxisLabelShow,
67
- isXaxisAxisTickShow,
68
- isXaxisAxisLabelRotate,
69
- isYAxisSplitlineLinestyleWidth,
70
- yAxisSplitlineLinestyleType,
71
- yAxisMax,
72
- yAxisMin,
73
- isYAxisName,
74
- yAxisName,
75
- isSeriesShowSymbol,
76
- isYAxisShow,
77
- isUnit,
78
- unit,
79
- decimalDigits,
80
- suffix,
81
- }: PropsType) {
43
+ export default function Bar(opts: PropsType) {
44
+ const {
45
+ directionType,
46
+ isPile,
47
+ id,
48
+ style,
49
+ className,
50
+ isTitle,
51
+ title,
52
+ titleLocation,
53
+ dataSource,
54
+ setColor,
55
+ filterData,
56
+ xField,
57
+ xStatistics,
58
+ groupKey,
59
+ groupKeyTimeSpan,
60
+ xIsCountEmpty,
61
+ yField,
62
+ isLegend,
63
+ legend,
64
+ legend2,
65
+ isXaxisName,
66
+ xAxisName,
67
+ isXaxisAxisLabelShow,
68
+ isXaxisAxisTickShow,
69
+ isXaxisAxisLabelRotate,
70
+ isYAxisSplitlineLinestyleWidth,
71
+ yAxisSplitlineLinestyleType,
72
+ yAxisMax,
73
+ yAxisMin,
74
+ isYAxisName,
75
+ yAxisName,
76
+ isSeriesShowSymbol,
77
+ isYAxisShow,
78
+ isUnit,
79
+ unit,
80
+ decimalDigits,
81
+ suffix,
82
+ } = opts;
82
83
  const domRef = useRef<HTMLDivElement>();
83
84
  useWedaChart(domRef, EchartBar, {
84
85
  directionType,
@@ -47,4 +47,4 @@ const getConfig = () => {
47
47
  return lineH5;
48
48
  };
49
49
 
50
- module.exports = getConfig;
50
+ export default getConfig;
@@ -39,10 +39,11 @@ class EchartBar extends EchartBase {
39
39
  params,
40
40
  );
41
41
  // 获取 x 轴数据
42
- const arrXaxisData = this.setXaxis(arrSourData, xField.format);
42
+ const sortedXAxisData = this.sortXAxisData(arrSourData, xField.format);
43
+ const arrXaxisData = this.setXaxis(sortedXAxisData, xField.format);
43
44
  const arrXisCountEmptyIndex = []; // 记录空值的key
44
- if (!groupKey) {
45
- const numLine = arrSourData[0].YLabels.length;
45
+ if (Object.keys(groupKey ?? {}).length === 0) {
46
+ const numLine = sortedXAxisData[0].YLabels.length;
46
47
  if (numLine > 0) {
47
48
  for (let j = 0; j < numLine; j++) {
48
49
  this.config.series[j] = {
@@ -56,9 +57,9 @@ class EchartBar extends EchartBase {
56
57
  },
57
58
  data: [],
58
59
  };
59
- arrSourData.forEach((itemSource,index) => {
60
+ sortedXAxisData.forEach((itemSource,index) => {
60
61
  this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
61
- if ((!itemSource.YLabels[j].Value || itemSource.YLabels[j].Value === 0 || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
62
+ if ((itemSource.YLabels[j].Value === undefined || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
62
63
  arrXisCountEmptyIndex.push(index);
63
64
  } else {
64
65
  const value = itemSource.YLabels[j].Value ? itemSource.YLabels[j].Value : 0;
@@ -73,7 +74,7 @@ class EchartBar extends EchartBase {
73
74
  // 如果是分组,则这里需要特殊处理
74
75
  // 按groupKey分组存放数据值
75
76
  const objGroupKey = {}; // {'分组字段':[{value:'统计的值', dimensionality:'维度名', name:'统计的数值字段名'}]}
76
- arrSourData.forEach((itemSourData) => {
77
+ sortedXAxisData.forEach((itemSourData) => {
77
78
  itemSourData.YLabels.forEach((yLabel) => {
78
79
  if (!objGroupKey[yLabel.Group_Name]) {
79
80
  objGroupKey[yLabel.Group_Name] = [];
@@ -188,8 +188,25 @@ class EchartBase extends AbstractEchartBaseModal {
188
188
  * @param { Array<object> } arrData 后台返回的数据
189
189
  * @param { string } formatType 类型 datetime:日期时间;date:日期,time:时间,其它
190
190
  */
191
- protected setXaxis(arrData, formatType = '') {
191
+ protected setXaxis(sortedXAxisData, formatType) {
192
192
  const xAxisData = [];
193
+ if (sortedXAxisData.length > 0) {
194
+ sortedXAxisData.forEach((itemSource) => {
195
+ let value = itemSource.XLabel.Value;
196
+ if (formatType === 'datetime') {
197
+ value = this.formatTime(itemSource.XLabel.Value, 'dt');
198
+ } else if (formatType === 'date') {
199
+ value = this.formatTime(itemSource.XLabel.Value, 'd');
200
+ } else if (formatType === 'time') {
201
+ value = this.formatTime(itemSource.XLabel.Value, 't');
202
+ }
203
+ xAxisData.push(value);
204
+ });
205
+ this.config.xAxis.data = xAxisData;
206
+ }
207
+ return xAxisData;
208
+ }
209
+ protected sortXAxisData(arrData, formatType = ''): Array<any> {
193
210
  let xFields = [...arrData];
194
211
  if(['datetime', 'date', 'time'].includes(formatType)) {
195
212
  xFields.sort((a, b) => {
@@ -205,21 +222,8 @@ class EchartBase extends AbstractEchartBaseModal {
205
222
  }
206
223
  });
207
224
  }
208
- if (arrData.length > 0) {
209
- xFields.forEach((itemSource) => {
210
- let value = itemSource.XLabel.Value;
211
- if (formatType === 'datetime') {
212
- value = this.formatTime(itemSource.XLabel.Value, 'dt');
213
- } else if (formatType === 'date') {
214
- value = this.formatTime(itemSource.XLabel.Value, 'd');
215
- } else if (formatType === 'time') {
216
- value = this.formatTime(itemSource.XLabel.Value, 't');
217
- }
218
- xAxisData.push(value);
219
- });
220
- this.config.xAxis.data = xAxisData;
221
- }
222
- return xAxisData;
225
+
226
+ return xFields;
223
227
  }
224
228
 
225
229
  /**
@@ -38,10 +38,12 @@ class EchartLine extends EchartBase {
38
38
  params,
39
39
  );
40
40
  // 获取 x 轴数据
41
- const arrXaxisData = this.setXaxis(arrSourData, xField.format);
41
+
42
+ const sortedXAxisData = this.sortXAxisData(arrSourData, xField.format);
43
+ const arrXaxisData = this.setXaxis(sortedXAxisData, xField.format);
42
44
  const arrXisCountEmptyIndex = []; // 记录空值的key
43
- if (!groupKey) {
44
- const numLine = arrSourData[0].YLabels.length;
45
+ if (Object.keys(groupKey ?? {}).length === 0) {
46
+ const numLine = sortedXAxisData[0].YLabels.length;
45
47
  if (numLine > 0) {
46
48
  for (let j = 0; j < numLine; j++) {
47
49
  this.config.series[j] = {
@@ -55,9 +57,9 @@ class EchartLine extends EchartBase {
55
57
  },
56
58
  data: [],
57
59
  };
58
- arrSourData.forEach((itemSource,index) => {
60
+ sortedXAxisData.forEach((itemSource,index) => {
59
61
  this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
60
- if ((!itemSource.YLabels[j].Value || itemSource.YLabels[j].Value === 0 || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
62
+ if ((itemSource.YLabels[j].Value === undefined || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
61
63
  arrXisCountEmptyIndex.push(index);
62
64
  } else {
63
65
  const value = itemSource.YLabels[j].Value ? itemSource.YLabels[j].Value : 0;
@@ -72,7 +74,7 @@ class EchartLine extends EchartBase {
72
74
  // 如果是分组,则这里需要特殊处理
73
75
  // 按groupKey分组存放数据值
74
76
  const objGroupKey = {}; // {'分组字段':[{value:'统计的值', dimensionality:'维度名', name:'统计的数值字段名'}]}
75
- arrSourData.forEach((itemSourData) => {
77
+ sortedXAxisData.forEach((itemSourData) => {
76
78
  itemSourData.YLabels.forEach((yLabel) => {
77
79
  if (!objGroupKey[yLabel.Group_Name]) {
78
80
  objGroupKey[yLabel.Group_Name] = [];
@@ -38,45 +38,46 @@ interface PropsType extends CommonPropsType {
38
38
  decimalDigits?: number;
39
39
  suffix?: string;
40
40
  }
41
- export default function Line({
42
- id,
43
- style,
44
- events,
45
- className,
46
- children,
47
- chartType,
48
- isTitle,
49
- title,
50
- titleLocation,
51
- dataSource,
52
- filterData,
53
- xField,
54
- xStatistics,
55
- xIsCountEmpty,
56
- yField,
57
- groupKey,
58
- groupKeyTimeSpan,
59
- isLegend,
60
- legend,
61
- legend2,
62
- isXaxisName,
63
- xAxisName,
64
- isXaxisAxisLabelShow,
65
- isXaxisAxisTickShow,
66
- isXaxisAxisLabelRotate,
67
- isYAxisSplitlineLinestyleWidth,
68
- yAxisSplitlineLinestyleType,
69
- yAxisMax,
70
- yAxisMin,
71
- isYAxisName,
72
- yAxisName,
73
- isSeriesShowSymbol,
74
- isYAxisShow,
75
- isUnit,
76
- unit,
77
- decimalDigits,
78
- suffix,
79
- }: PropsType) {
41
+ export default function Line(opts: PropsType) {
42
+ const {
43
+ id,
44
+ style,
45
+ events,
46
+ className,
47
+ children,
48
+ chartType,
49
+ isTitle,
50
+ title,
51
+ titleLocation,
52
+ dataSource,
53
+ filterData,
54
+ xField,
55
+ xStatistics,
56
+ xIsCountEmpty,
57
+ yField,
58
+ groupKey,
59
+ groupKeyTimeSpan,
60
+ isLegend,
61
+ legend,
62
+ legend2,
63
+ isXaxisName,
64
+ xAxisName,
65
+ isXaxisAxisLabelShow,
66
+ isXaxisAxisTickShow,
67
+ isXaxisAxisLabelRotate,
68
+ isYAxisSplitlineLinestyleWidth,
69
+ yAxisSplitlineLinestyleType,
70
+ yAxisMax,
71
+ yAxisMin,
72
+ isYAxisName,
73
+ yAxisName,
74
+ isSeriesShowSymbol,
75
+ isYAxisShow,
76
+ isUnit,
77
+ unit,
78
+ decimalDigits,
79
+ suffix,
80
+ } = opts;
80
81
  const domRef = useRef<HTMLDivElement>();
81
82
  useWedaChart(domRef, EChartLine, {
82
83
  chartType,
@@ -127,20 +127,41 @@ export function customToFixed(num, digit = 0) {
127
127
  return integer;
128
128
  }
129
129
 
130
+ /**
131
+ * 添加千位分隔符
132
+ * @param fixedString
133
+ * @param digit
134
+ */
135
+ export function addDelimiter(fixedString, digit) {
136
+ let len = fixedString.length;
137
+ let result = '';
138
+ const decimalPoint = digit > 0 ? digit + 1 : 0;
139
+ for (let i = len - 1; i >= 0; i--) {
140
+ let stepFromTail = len - 1 - i;
141
+ let char = fixedString.charAt(i);
142
+
143
+ if (stepFromTail <= decimalPoint) {
144
+ // 小数部分不处理
145
+ result = char + result;
146
+ } else {
147
+ if ((stepFromTail - decimalPoint) % 3 === 0) {
148
+ if (char !== '-') {
149
+ result = ',' + result;
150
+ }
151
+ }
152
+ result = char + result;
153
+ }
154
+ }
155
+ return result;
156
+ }
157
+
130
158
  /**
131
159
  * 格式化:添加千分符,四舍五入
132
160
  * @param val
133
161
  * @param digits
134
162
  */
135
163
  const formatNumber = (val, digits = 0) => {
136
- return isNaN(val)
137
- ? val
138
- : Intl
139
- ? Intl.NumberFormat('en-US', {
140
- maximumFractionDigits: 10,
141
- minimumFractionDigits: digits,
142
- }).format(+customToFixed(val, digits))
143
- : val;
164
+ return isNaN(val) ? val : addDelimiter(customToFixed(val, digits), digits);
144
165
  };
145
166
 
146
167
  export default function StatisticsCard({