@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
@@ -0,0 +1,60 @@
1
+ # 获取手机号
2
+
3
+ <TableLayoutView
4
+ componentKey="Phone"
5
+ type="description"
6
+ origin="sourceCode"
7
+ ></TableLayoutView>
8
+
9
+ ## 使用说明
10
+
11
+ 使用获取手机号组件能够在小程序运行态对用户的手机号进行获取,使用方式如下:
12
+
13
+ 1.创建应用,应用构建类型需要为小程序构建或三端构建。
14
+
15
+ ![](https://qcloudimg.tencent-cloud.cn/raw/b9e5a27263fe0f992618757086010017.png)
16
+
17
+ 2.在编辑器中添加**获取手机号**组件。
18
+
19
+ ![](https://qcloudimg.tencent-cloud.cn/raw/6eac32bcf54b345c5d23ee3ec49de19c.png)
20
+
21
+ 3.为应用创建一个字符串类型的普通变量,用于接收获取到的手机号信息。
22
+
23
+ ![](https://qcloudimg.tencent-cloud.cn/raw/5bd62e877d0a5805368ca55633627403.png)
24
+
25
+ 4.为获取手机号组件配置变量赋值事件,实现当用户授权成功后将返回的手机号信息赋值给步骤3中的普通变量。
26
+
27
+ ![](https://qcloudimg.tencent-cloud.cn/raw/98e456ef06ee76e138dcc13d03705f33.png)
28
+
29
+ 5.该组件仅在小程序真实运行状态下生效,因此我们在编辑器中添加一个文本组件并与普通变量进行绑定,当用户在小程序中点击获取手机号按钮并授权成功时,文本组件便会展示对应的手机号信息。
30
+
31
+ ![](https://qcloudimg.tencent-cloud.cn/raw/9373c76dd92a98cd222eab37e7cca495.png)
32
+
33
+ 6.将应用发布到小程序,可以看到当点击获取手机号按钮并授权时,文本组件便会对获取到的手机号码信息进行展示。
34
+
35
+ ![](https://qcloudimg.tencent-cloud.cn/raw/1b4c8a656ae0298534e9f5c2749c9b04.png)
36
+
37
+
38
+ ## 组件使用限制
39
+
40
+ 1.该组件仅支持在小程序端使用,并且小程序必须为**企业主体**。
41
+
42
+ 2.该组件必须在小程序真实环境使用才能够看到实际效果。
43
+
44
+ ## 属性
45
+
46
+ import TableLayoutView from '../../common/tableView';
47
+
48
+ <TableLayoutView
49
+ componentKey="Phone"
50
+ type="attribute"
51
+ origin="sourceCode"
52
+ ></TableLayoutView>
53
+
54
+ ## 事件
55
+
56
+ <TableLayoutView
57
+ componentKey="Phone"
58
+ type="event"
59
+ origin="sourceCode"
60
+ ></TableLayoutView>
@@ -0,0 +1,46 @@
1
+ # 小程序分享
2
+
3
+ <TableLayoutView
4
+ componentKey="Share"
5
+ type="description"
6
+ origin="sourceCode"
7
+ ></TableLayoutView>
8
+
9
+ ## 使用说明
10
+
11
+ 小程序分享组件支持快捷实现小程序分享功能,在小程序中点击该组件时,便会根据当前组件配置进行页面的分享,使用方法如下:
12
+
13
+ 1.创建应用,应用构建类型需要为小程序构建或三端构建。
14
+
15
+ ![](https://qcloudimg.tencent-cloud.cn/raw/b9e5a27263fe0f992618757086010017.png)
16
+
17
+ 2.为编辑区中添加**小程序分享**组件,并在右侧配置区进行分享参数的设置。
18
+
19
+ ![](https://qcloudimg.tencent-cloud.cn/raw/500bda4094df6b2c519eec8976ec4acd.png)
20
+
21
+ 3.将应用发布到小程序,可以看到当点击小程序分享按钮时,会自动调起分享弹窗,分享信息与配置区的配置相同。
22
+
23
+ ![](https://qcloudimg.tencent-cloud.cn/raw/5f9add0024c8cb8f65464a4700a12652.png)
24
+
25
+
26
+ ## 组件使用限制
27
+
28
+ 1.该组件必须在小程序真实环境使用才能够看到实际效果。
29
+
30
+ ## 属性
31
+
32
+ import TableLayoutView from '../../common/tableView';
33
+
34
+ <TableLayoutView
35
+ componentKey="Share"
36
+ type="attribute"
37
+ origin="sourceCode"
38
+ ></TableLayoutView>
39
+
40
+ ## 事件
41
+
42
+ <TableLayoutView
43
+ componentKey="Share"
44
+ type="event"
45
+ origin="sourceCode"
46
+ ></TableLayoutView>
@@ -0,0 +1,60 @@
1
+ # 获取用户信息
2
+
3
+ <TableLayoutView
4
+ componentKey="UserInfo"
5
+ type="description"
6
+ origin="sourceCode"
7
+ ></TableLayoutView>
8
+
9
+ ## 使用说明
10
+
11
+ 使用获取用户信息组件能够在小程序运行态对用户的微信头像、微信昵称等信息进行获取,使用方式如下:
12
+
13
+ 1.创建应用,应用构建类型需要为小程序构建或三端构建。
14
+
15
+ ![](https://qcloudimg.tencent-cloud.cn/raw/b9e5a27263fe0f992618757086010017.png)
16
+
17
+ 2.在编辑器中添加**获取用户信息**组件,并且在组件的右侧配置区填写**信息用途**。(若不填写**信息用途**,将导致功能不可用,请注意)
18
+
19
+ ![](https://qcloudimg.tencent-cloud.cn/raw/44d4f6bf1c9aaffa4bf7e3a1c0bcf83e.png)
20
+
21
+ 3.为应用创建一个字符串类型的普通变量,用于接收获取到的用户信息。
22
+
23
+ ![](https://qcloudimg.tencent-cloud.cn/raw/1dd6a703ff51f0fe45059fdb504d25ff.png)
24
+
25
+ 4.为获取用户信息组件配置变量赋值事件,实现当用户授权成功后将返回的用户信息赋值给步骤3中的普通变量。
26
+
27
+ ![](https://qcloudimg.tencent-cloud.cn/raw/ed12e3858ffba97f9ecbae7557ed03db.png)
28
+
29
+ 5.该组件仅在小程序真实运行状态下生效,因此我们在编辑器中添加一个文本组件并与普通变量进行绑定,当用户在小程序中点击获取用户信息按钮并授权成功时,文本组件便会展示对应的用户信息。
30
+
31
+ ![](https://qcloudimg.tencent-cloud.cn/raw/a55e1ab45de33489a1d61557a4f5f1b0.png)
32
+
33
+ 6.将应用发布到小程序,可以看到当点击获取用户信息按钮并授权时,文本组件便会对获取到的用户信息进行展示。
34
+
35
+ ![](https://qcloudimg.tencent-cloud.cn/raw/7aa344e9347a894975598ba1ab7b987e.png)
36
+
37
+
38
+ ## 组件使用限制
39
+
40
+ 1.该组件必须在小程序真实环境使用才能够看到实际效果。
41
+
42
+ 2.组件右侧配置区中**信息用途**必须进行填写,否则组件将无法正常使用。
43
+
44
+ ## 属性
45
+
46
+ import TableLayoutView from '../../common/tableView';
47
+
48
+ <TableLayoutView
49
+ componentKey="UserInfo"
50
+ type="attribute"
51
+ origin="sourceCode"
52
+ ></TableLayoutView>
53
+
54
+ ## 事件
55
+
56
+ <TableLayoutView
57
+ componentKey="UserInfo"
58
+ type="event"
59
+ origin="sourceCode"
60
+ ></TableLayoutView>
@@ -0,0 +1,4 @@
1
+ {
2
+ "label": "微信开放能力",
3
+ "position": 100
4
+ }
package/src/index.js CHANGED
@@ -1,2 +1,4 @@
1
+ /* eslint-disable import/export */
2
+
1
3
  export * from './web/index';
2
4
  export { default as default } from './web/index';
@@ -41,6 +41,24 @@ Component({
41
41
  openType: {
42
42
  type: String,
43
43
  },
44
+ sessionFrom: {
45
+ type: String,
46
+ },
47
+ sendMessageTitle: {
48
+ type: String,
49
+ },
50
+ sendMessagePath: {
51
+ type: String,
52
+ },
53
+ sendMessageImg: {
54
+ type: String,
55
+ },
56
+ showMessageCard: {
57
+ type: Boolean,
58
+ },
59
+ appParameter: {
60
+ type: String,
61
+ }
44
62
  },
45
63
  data: {
46
64
  cls: '',
@@ -48,9 +66,7 @@ Component({
48
66
  methods: {
49
67
  ...handleEvents([
50
68
  { title: '点击', name: 'tap' },
51
- { title: '获取手机号', name: 'getPhoneNumber' },
52
69
  { title: '打开客服会话', name: 'contact' },
53
- { title: '获取用户信息', name: 'getUserInfo' },
54
70
  { title: '打开App', name: 'launchApp' },
55
71
  { title: '打开授权设置', name: 'openSetting' },
56
72
  ]),
@@ -7,13 +7,16 @@
7
7
  open-type="{{openType}}"
8
8
  form-type="{{formType}}"
9
9
  bind:tap="tap"
10
- bindgetphonenumber="{{'getP' + 'honeN' + 'umber'}}"
11
10
  bindcontact="contact"
12
- bindgetuserinfo="getUserInfo"
13
11
  bindlaunchapp="launchApp"
14
12
  bindopensetting="openSetting"
13
+ session-from="{{sessionFrom}}"
14
+ send-message-title="{{sendMessageTitle}}"
15
+ send-message-path="{{sendMessagePath}}"
16
+ send-message-img="{{sendMessageImg}}"
17
+ show-message-card="{{showMessageCard}}"
18
+ app-parameter="{{appParameter}}"
15
19
  >
16
- {{text ? text : ''}}
20
+ <block>{{text ? text : ''}}</block>
17
21
  <slot name="contentSlot" wx:if="{{!text}}" />
18
22
  </button>
19
-
@@ -223,8 +223,11 @@ Component({
223
223
  },
224
224
  observers: {
225
225
  // 当参数变化时
226
- option() {
227
- this.initData();
226
+ '**': async function() {
227
+ const objEChartBar = new EchartBar();
228
+ await objEChartBar.setOptions(this.properties);
229
+ const options = await objEChartBar.getOptions();
230
+ this._chart && this._chart.setOption(options);
228
231
  },
229
232
  },
230
233
  methods: {
@@ -248,6 +251,7 @@ Component({
248
251
  // objEchart.clear();
249
252
  console.log('设置前参数bar', options);
250
253
  objEchart.setOption(options);
254
+ this._chart = objEchart;
251
255
  return objEchart;
252
256
  },
253
257
  },
@@ -21,7 +21,7 @@ class EchartBar extends EchartBase {
21
21
  groupKey,
22
22
  groupKeyTimeSpan,
23
23
  }) {
24
- xField = xField || {};
24
+ xField = xField || {}; // 向前兼容
25
25
  const { name = '', type = '', methodName = '' } = dataSource;
26
26
  if (name !== '') {
27
27
  const params = this.createWhere({
@@ -40,9 +40,10 @@ class EchartBar extends EchartBase {
40
40
  params,
41
41
  );
42
42
  // 获取 x 轴数据
43
- const arrXaxisData = this.setXaxis(arrSourData, xField.format);
43
+ const sortedXAxisData = this.sortXAxisData(arrSourData, xField.format);
44
+ const arrXaxisData = this.setXaxis(sortedXAxisData, xField.format);
44
45
  const arrXisCountEmptyIndex = []; // 记录空值的key
45
- if (!groupKey) { // 没有分组
46
+ if (Object.keys(groupKey ?? {}).length === 0) { // 没有分组
46
47
  const numLine = arrSourData[0].YLabels.length;
47
48
  if (numLine > 0) {
48
49
  for (let j = 0; j < numLine; j++) {
@@ -57,9 +58,9 @@ class EchartBar extends EchartBase {
57
58
  stack: isPile ? 'pile' : null,
58
59
  data: [],
59
60
  };
60
- arrSourData.forEach((itemSource,index) => {
61
+ sortedXAxisData.forEach((itemSource,index) => {
61
62
  this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
62
- if ((!itemSource.YLabels[j].Value || itemSource.YLabels[j].Value === 0 || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
63
+ if ((!itemSource.YLabels[j].Value === undefined || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
63
64
  arrXisCountEmptyIndex.push(index);
64
65
  } else {
65
66
  const value = itemSource.YLabels[j].Value ? itemSource.YLabels[j].Value : 0;
@@ -75,7 +76,7 @@ class EchartBar extends EchartBase {
75
76
  // 如果是分组,则这里需要特殊处理
76
77
  // 按groupKey分组存放数据值
77
78
  const objGroupKey = {}; // {'分组字段':[{value:'统计的值', dimensionality:'维度名', name:'统计的数值字段名'}]}
78
- arrSourData.forEach((itemSourData) => {
79
+ sortedXAxisData.forEach((itemSourData) => {
79
80
  itemSourData.YLabels.forEach((yLabel) => {
80
81
  if (!objGroupKey[yLabel.Group_Name]) {
81
82
  objGroupKey[yLabel.Group_Name] = [];
@@ -150,7 +151,7 @@ class EchartBar extends EchartBase {
150
151
  itemSeries.label.formatter = (params) => {
151
152
  const objNewValue = this.getValueByUnit(params.value, unit);
152
153
  return (
153
- `${objNewValue.toFixed(decimalDigits)}${objNewValue.unit}${suffix}`
154
+ `${objNewValue.toFixed(decimalDigits)}${suffix}`
154
155
  );
155
156
  };
156
157
  }
@@ -158,7 +159,7 @@ class EchartBar extends EchartBase {
158
159
  if (isUnit) {
159
160
  this.config.yAxis.axisLabel.formatter = (value) => {
160
161
  const objNewValue = this.getValueByUnit(value, unit);
161
- return `${objNewValue.toFixed(decimalDigits)}${objNewValue.unit}${suffix}`;
162
+ return `${objNewValue.toFixed(decimalDigits)}${suffix}`;
162
163
  };
163
164
  } else {
164
165
  this.config.yAxis.axisLabel.formatter = null;
@@ -180,8 +180,26 @@ class EchartBase {
180
180
  * @param { Array<object> } arrData 后台返回的数据
181
181
  * @param { string } formatType 类型 datetime:日期时间;date:日期,time:时间,其它
182
182
  */
183
- setXaxis(arrData, formatType = '') {
183
+ setXaxis(sortedXAxisData, formatType = '') {
184
184
  const xAxisData = [];
185
+ if (sortedXAxisData.length > 0) {
186
+ sortedXAxisData.forEach((itemSource) => {
187
+ let value = itemSource.XLabel.Value;
188
+ if (formatType === 'datetime') {
189
+ value = this.formatTime(itemSource.XLabel.Value, 'dt');
190
+ } else if (formatType === 'date') {
191
+ value = this.formatTime(itemSource.XLabel.Value, 'd');
192
+ } else if (formatType === 'time') {
193
+ value = this.formatTime(itemSource.XLabel.Value, 't');
194
+ }
195
+ xAxisData.push(value);
196
+ });
197
+ this.config.xAxis.data = xAxisData;
198
+ }
199
+ return xAxisData;
200
+ }
201
+
202
+ sortXAxisData(arrData, formatType = '') {
185
203
  let xFields = [...arrData];
186
204
  if(['datetime', 'date', 'time'].includes(formatType)) {
187
205
  xFields.sort((a, b) => {
@@ -197,21 +215,7 @@ class EchartBase {
197
215
  }
198
216
  });
199
217
  }
200
- if (arrData.length > 0) {
201
- xFields.forEach((itemSource) => {
202
- let value = itemSource.XLabel.Value;
203
- if (formatType === 'datetime') {
204
- value = this.formatTime(itemSource.XLabel.Value, 'dt');
205
- } else if (formatType === 'date') {
206
- value = this.formatTime(itemSource.XLabel.Value, 'd');
207
- } else if (formatType === 'time') {
208
- value = this.formatTime(itemSource.XLabel.Value, 't');
209
- }
210
- xAxisData.push(value);
211
- });
212
- this.config.xAxis.data = xAxisData;
213
- }
214
- return xAxisData;
218
+ return xFields;
215
219
  }
216
220
 
217
221
  /**
@@ -39,9 +39,10 @@ class EchartLine 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
+ if (Object.keys(groupKey ?? {}).length === 0) {
45
46
  const numLine = arrSourData[0].YLabels.length;
46
47
  if (numLine > 0) {
47
48
  for (let j = 0; j < numLine; j++) {
@@ -56,9 +57,9 @@ class EchartLine 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 EchartLine 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] = [];
@@ -210,12 +210,6 @@ Component({
210
210
  detached() {
211
211
  // 在组件实例被从页面节点树移除时执行
212
212
  },
213
- observers: {
214
- // 当参数变化时
215
- option() {
216
- this.initData();
217
- },
218
- },
219
213
  methods: {
220
214
  initData() {
221
215
  this.setData({
@@ -237,7 +231,17 @@ Component({
237
231
  // objEchart.clear();
238
232
  console.log('设置前参数line', options);
239
233
  objEchart.setOption(options);
234
+ this._chart = objEchart;
240
235
  return objEchart;
241
236
  },
242
237
  },
238
+ observers: {
239
+ // 当参数变化时
240
+ '**': async function() {
241
+ const objEChartLine = new EchartLine();
242
+ await objEChartLine.setOptions(this.properties);
243
+ const options = objEChartLine.getOptions();
244
+ this._chart && this._chart.setOption(options);
245
+ },
246
+ }
243
247
  });
@@ -147,8 +147,11 @@ Component({
147
147
  },
148
148
  observers: {
149
149
  // 当参数变化时
150
- option() {
151
- this.initData();
150
+ '**': async function() {
151
+ const objEChartPie = new EchartPie();
152
+ await objEChartPie.setOptions(this.properties);
153
+ const options = await objEChartPie.getOptions();
154
+ this._chart && this._chart.setOption(options);
152
155
  },
153
156
  },
154
157
  methods: {
@@ -172,6 +175,7 @@ Component({
172
175
  // objEchart.clear();
173
176
  console.log('设置前参数pie', options);
174
177
  objEchart.setOption(options);
178
+ this._chart = objEchart;
175
179
  return objEchart;
176
180
  },
177
181
  },
@@ -108,15 +108,32 @@ Component({
108
108
  }
109
109
  return integer;
110
110
  },
111
+ addDelimiter: function (fixedString, digit) {
112
+ let len = fixedString.length;
113
+ let result = '';
114
+ const decimalPoint = digit > 0 ? digit + 1 : 0;
115
+ for (let i = len - 1; i >= 0; i--) {
116
+ let stepFromTail = len - 1 - i;
117
+ let char = fixedString.charAt(i);
118
+
119
+ if (stepFromTail <= decimalPoint) {
120
+ // 小数部分不处理
121
+ result = char + result;
122
+ } else {
123
+ if ((stepFromTail - decimalPoint) % 3 === 0) {
124
+ if (char !== '-') {
125
+ result = ',' + result;
126
+ }
127
+ }
128
+ result = char + result;
129
+ }
130
+ }
131
+ return result;
132
+ },
111
133
  formatNumber: function (val, digits = 0) {
112
134
  return isNaN(val)
113
135
  ? val
114
- : Intl
115
- ? Intl.NumberFormat('en-US', {
116
- maximumFractionDigits: 10,
117
- minimumFractionDigits: digits,
118
- }).format(this.customToFixed(val, digits))
119
- : val;
136
+ : this.addDelimiter(this.customToFixed(val, digits), digits);
120
137
  },
121
138
  getSourceData: async function (
122
139
  dataSource,
@@ -223,4 +240,14 @@ Component({
223
240
  this._fetchData();
224
241
  },
225
242
  },
243
+ attached() {
244
+ this._fetchData();
245
+ },
246
+ observers: {
247
+ // 当参数变化时
248
+ 'datasource,filterData,field,operationType,label,isCountEmpty,isShowUnit,unit,decimalDigits,suffix':
249
+ function () {
250
+ this._fetchData();
251
+ },
252
+ },
226
253
  });
@@ -2,6 +2,6 @@
2
2
  "component": true,
3
3
  "styleIsolation": "shared",
4
4
  "usingComponents": {
5
- "list-view": "../internals/listView"
5
+ "list-view": "../listView"
6
6
  }
7
7
  }
@@ -1,5 +1,7 @@
1
1
  import classNames from '../../../utils/classnames';
2
+ import destr from '../../../utils/destr';
2
3
  import handleEvents from '../../../utils/handleEvents';
4
+ import { callWedaApi } from '../../../utils/tcb';
3
5
 
4
6
  Component({
5
7
  options: {
@@ -41,15 +43,24 @@ Component({
41
43
  type: Boolean,
42
44
  value: false,
43
45
  },
46
+ format: {
47
+ type: String,
48
+ value: '',
49
+ },
50
+ enumName: {
51
+ type: String,
52
+ value: '',
53
+ }
44
54
  },
45
55
  data: {
46
56
  cls: '',
47
57
  subCls: '',
48
58
  isFlex: true,
59
+ defaultRange: []
49
60
  },
50
61
  lifetimes: {
51
62
  attached() {
52
- const { className, layout, disabled } = this.properties;
63
+ const { className, layout, disabled, range } = this.properties;
53
64
  const isFlex = layout !== 'vertical';
54
65
  const cls = classNames({
55
66
  'weda-ui': true,
@@ -63,10 +74,26 @@ Component({
63
74
  'weui-cell_disabled': disabled,
64
75
  });
65
76
 
66
- this.setData({ cls, subCls, isFlex });
77
+ this.setData({ cls, subCls, isFlex, defaultRange: range });
67
78
  },
68
79
  },
69
80
  methods: {
81
+ _fetchData: async function () {
82
+ let data = await callWedaApi({
83
+ action: 'DescribeGeneralOptionsDetailList',
84
+ data: { OptNameList: [this.properties.enumName], PageIndex: 1, PageSize: 10 },
85
+ });
86
+ const config = destr(data?.Items?.[0]?.Config) ?? [];
87
+ const option = config.map(item => {
88
+ return {
89
+ label: item.value,
90
+ value: item.key,
91
+ checked: false
92
+ };
93
+ });
94
+ this.setData({ defaultRange: option });
95
+ },
96
+
70
97
  ...handleEvents([
71
98
  {
72
99
  name: 'change',
@@ -74,4 +101,16 @@ Component({
74
101
  },
75
102
  ]),
76
103
  },
104
+ observers: {
105
+ range: function (range) {
106
+ if (this.properties.format !== 'x-enum') {
107
+ this.setData({ defaultRange: range });
108
+ }
109
+ },
110
+ format: function (format) {
111
+ if (format === 'x-enum' && this.properties.enumName) {
112
+ this._fetchData();
113
+ }
114
+ }
115
+ },
77
116
  });
@@ -7,7 +7,7 @@
7
7
  requiredFlag="{{requiredFlag}}"
8
8
  >
9
9
  <checkbox-group class="{{isFlex ? 'weui-flex__item' : ''}}" bindchange="change">
10
- <label class="{{subCls}}" wx:for="{{range}}" wx:key="value">
10
+ <label class="{{subCls}}" wx:for="{{defaultRange}}" wx:key="value">
11
11
  <view class="weui-cell__hd">
12
12
  <checkbox
13
13
  class="weui-check"
@@ -1,6 +1,5 @@
1
- <view class="weui-form weda-ui {{className}} {{style}}">
1
+ <view class="weui-form weda-ui {{className}}" style="{{style}}">
2
2
  <view class="weui-cells__group weui-cells__group_form">
3
3
  <slot name="contentSlot" />
4
4
  </view>
5
5
  </view>
6
-
@@ -1,8 +1,8 @@
1
1
  <view class="{{className}}" style="{{style}}">
2
2
  <view class="{{cls}}">
3
3
  <view wx:if="{{!!label}}" class="weda-formcells__label weui-cell">
4
- <label wx:if="{{requiredFlag}}" class="weda-formcells__flag">*</label>
5
4
  <label>{{label}}</label>
5
+ <label wx:if="{{requiredFlag}}" class="weda-formcells__flag">*</label>
6
6
  </view>
7
7
  <view class="weda-formcells__content {{isFlex ? 'weui-flex__item' : ''}}">
8
8
  <slot></slot>
@@ -6,4 +6,21 @@
6
6
  font-family: SimSun;
7
7
  font-size: 12px;
8
8
  color: #f60;
9
+ align-self: flex-start;
10
+ }
11
+
12
+ .weda-formcells.weui-flex .weda-formcells__label {
13
+ width: 130px;
14
+ }
15
+
16
+ .weui-cells__group_form .weui-cell {
17
+ padding: 16px 16px;
18
+ }
19
+
20
+ .weda-formcells__content.weui-flex__item .weui-cell_form {
21
+ padding: 0;
22
+ }
23
+
24
+ .weda-formcells__content.weui-flex__item .weui-cell_form {
25
+ padding-right: 16px;
9
26
  }
@@ -101,7 +101,7 @@ Component({
101
101
  this.setData({
102
102
  value: '',
103
103
  });
104
- this.triggerEvent('change', e.detail);
104
+ this.triggerEvent('clear', e.detail);
105
105
  },
106
106
  handleConfirm: function (e) {
107
107
  this.triggerEvent('confirm', e.detail);