@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
@@ -80,7 +80,6 @@ export function UploaderPCInner(props) {
80
80
  // 文件列表
81
81
  const [fileIDList, setfileIDList] = React.useState([]);
82
82
  const fileRef = React.useRef(fileIDList);
83
-
84
83
  React.useEffect(() => {
85
84
  let initialValue = []
86
85
  .concat(defaultValue)
@@ -89,7 +88,7 @@ export function UploaderPCInner(props) {
89
88
  initialValue = initialValue[0] ? [initialValue[0]] : [];
90
89
  }
91
90
  setfileIDList(initialValue);
92
- }, []);
91
+ }, [defaultValue]);
93
92
 
94
93
  // 值变化事件
95
94
  React.useEffect(() => {
@@ -141,8 +140,9 @@ export function UploaderPCInner(props) {
141
140
  });
142
141
  fileID && setfileIDList((list) => [...list, fileID]);
143
142
  fileID && events.success && events.success({ value: fileID, file });
144
- } catch (e) {
145
- events.error && events.error({ value: e, file });
143
+ } catch (err) {
144
+ message.error({ content: `${err}` || '上传失败' });
145
+ events.error && events.error(err);
146
146
  } finally {
147
147
  setUploading(false);
148
148
  setProgress(0);
@@ -76,9 +76,6 @@
76
76
  display: flex;
77
77
  justify-content: space-between;
78
78
  }
79
- .weui-uploader.horizontal .weui-uploader__bd {
80
- padding-left: 2.28571rem;
81
- }
82
79
 
83
80
  /* ----上传文件---- pc */
84
81
  .weda-upload-file-pc .weda-upload-file-pc__file-item {
@@ -230,7 +227,8 @@
230
227
 
231
228
  .weda-upload-file-mobile .weda-upload-file-mobile__hd {
232
229
  width: 100%;
233
- padding: 24px 20px 8px 20px;
230
+ padding: 16px;
231
+ padding-left: 0;
234
232
  display: flex;
235
233
  background-color: #fff;
236
234
  }
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import * as PropTypes from 'prop-types';
3
3
  import weui from '../../../utils/weui';
4
4
  import { CommonFormPropsType } from '../types';
5
-
5
+ import isObjectEqual from '../../../utils/isObjectEqual';
6
6
  import {
7
7
  Upload,
8
8
  ConfigProvider,
@@ -26,7 +26,6 @@ import {
26
26
  import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
27
27
  import classNames from '../../../utils/classnames';
28
28
  import { renderDecorator } from '../renderDecorator';
29
-
30
29
  // 默认组件类前缀
31
30
  const CLASS_PREFIX = 'weda-upload-file-mobile';
32
31
  // 默认图片类型
@@ -75,11 +74,18 @@ export function UploadFileH5({
75
74
  onChange = null,
76
75
  isEdit = true,
77
76
  }: IUploadFileH5) {
78
- const [fileIDList, setfileIDList] = React.useState(
79
- filterStrList([].concat(defaultValue, value))
80
- ); // 上传成功文件ID列表,fileID[]
77
+ const [fileIDList, setfileIDList] = React.useState(filterStrList([].concat(defaultValue, value))); // 上传成功文件ID列表,fileID[]
81
78
  const [fileList, setFileList] = React.useState([]); // 上传中的文件列表,file[],file为原始文件 + uuid属性
82
79
  const [fileSizeObj, setFileSizeObj] = React.useState({}); // 管理上传文件大小 {uuid:size}
80
+ // 两次默认值不同, 需要刷新
81
+ const prevDefaultRef = React.useRef<any>([]);
82
+ React.useMemo(()=>{
83
+ //有有效默认值时不刷新,解决初次渲染默认值不显示问题
84
+ if(defaultValue&&!isObjectEqual(prevDefaultRef.current,defaultValue)&&(JSON.stringify(prevDefaultRef.current)=='[]'||!prevDefaultRef.current)){
85
+ prevDefaultRef.current =defaultValue;
86
+ setfileIDList(filterStrList([].concat(defaultValue)));
87
+ }
88
+ },[defaultValue]);
83
89
  React.useEffect(() => {
84
90
  // 外部 onChange 事件
85
91
  const pureFileIDList = fileIDList.filter(
@@ -115,9 +121,9 @@ export function UploadFileH5({
115
121
  // 上传时新增事件
116
122
  if (type === 'add') {
117
123
  fileID && setFileSizeObj((obj) => ({ ...obj, [fileID]: size }));
118
- fileID && setfileIDList((list) => [...list, fileID]);
124
+ fileID && setfileIDList([...fileIDList, fileID]);
119
125
  } else {
120
- fileID && setfileIDList((list) => list.filter((f) => f !== fileID));
126
+ fileID && setfileIDList(fileIDList.filter((f) => f !== fileID));
121
127
  }
122
128
  uuid && setFileList((list) => list.filter((item) => uuid !== item?._uuid));
123
129
  };
@@ -22,6 +22,7 @@ import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
22
22
  import classNames from '../../../utils/classnames';
23
23
  import { renderDecorator } from '../renderDecorator';
24
24
  import { CommonFormPropsType } from '../types';
25
+ import isObjectEqual from '../../../utils/isObjectEqual';
25
26
 
26
27
  // 默认组件类前缀
27
28
  const CLASS_PREFIX = 'weda-upload-file-pc';
@@ -67,12 +68,20 @@ export function UploadFilePc({
67
68
  onChange = null,
68
69
  isEdit = true,
69
70
  }: IUploaderFilePc) {
70
- const [fileIDList, setfileIDList] = React.useState(
71
- filterStrList([].concat(defaultValue, value))
72
- ); // 上传成功文件ID列表,fileID[]
71
+
72
+
73
+ const [fileIDList, setfileIDList] = React.useState(filterStrList([].concat(defaultValue, value))); // 上传成功文件ID列表,fileID[]
73
74
  const [fileList, setFileList] = React.useState([]); // 上传中的文件列表,file[],file为原始文件 + uuid属性
74
75
  const [fileSizeObj, setFileSizeObj] = React.useState({}); // 管理上传文件大小 {uuid:size}
75
-
76
+ // 两次默认值不同, 需要刷新
77
+ const prevDefaultRef = React.useRef<any>([]);
78
+ React.useMemo(()=>{
79
+ //有有效默认值时不刷新,解决初次渲染默认值不显示问题
80
+ if(defaultValue&&!isObjectEqual(prevDefaultRef.current,defaultValue)&&(JSON.stringify(prevDefaultRef.current)=='[]'||!prevDefaultRef.current)){
81
+ prevDefaultRef.current =defaultValue;
82
+ setfileIDList(filterStrList([].concat(defaultValue)));
83
+ }
84
+ },[defaultValue]);
76
85
  React.useEffect(() => {
77
86
  // 外部 onChange 事件
78
87
  const pureFileIDList = fileIDList.filter(
@@ -89,7 +98,6 @@ export function UploadFilePc({
89
98
  events?.success?.({ value: pureFileIDList });
90
99
  }
91
100
  }, [fileIDList]);
92
-
93
101
  // 外层组件类
94
102
  const cls = classNames({
95
103
  'weda-ui': true,
@@ -184,4 +184,4 @@ export function ImageInner({
184
184
  </ConfigProvider>
185
185
  );
186
186
  }
187
- }
187
+ }
@@ -36,8 +36,8 @@
36
36
  }
37
37
 
38
38
  .weda-image.weda-image-error {
39
- position: relative;
40
- display: inline-block;
39
+ position: relative !important;
40
+ display: inline-block !important;
41
41
  }
42
42
 
43
43
  .weda-image:not([src]):before,
@@ -49,4 +49,4 @@
49
49
  top: 0;
50
50
  width: 100%;
51
51
  height: 100%;
52
- }
52
+ }
@@ -23,12 +23,12 @@ export default function Image({
23
23
  events = {},
24
24
  style = {},
25
25
  // 组件属性
26
- src = defaultSrc,
27
- alt = '[图片]',
28
- mode = 'scaleToFill',
29
- lazyLoad = false,
30
- imgPreview = false,
31
- maskClosable = true,
26
+ src,
27
+ alt,
28
+ mode,
29
+ lazyLoad,
30
+ imgPreview,
31
+ maskClosable,
32
32
  fit,
33
33
  }: PropsType) {
34
34
  const [isError, setIsError] = useState(false);
@@ -102,4 +102,3 @@ function getObjectFitByWxImageMode(mode: TMode): React.CSSProperties['objectFit'
102
102
  const item = array.find((item) => item.mode === mode);
103
103
  return item?.h5;
104
104
  }
105
-
@@ -72,6 +72,7 @@ export { default as NavLayout } from './navLayout';
72
72
 
73
73
  // Data Contaier
74
74
  export { default as ListView } from './listView';
75
+ export { default as NavigationBar } from './navigationBar';
75
76
  export { default as Line } from './chart/line';
76
77
  export { default as Bar } from './chart/bar';
77
78
  export { default as Pie } from './chart/pie';
@@ -79,6 +80,13 @@ export { default as DataView } from './dataView';
79
80
 
80
81
  export { default as StatisticsCard } from './chart/statisticsCard';
81
82
  export { default as GraphicCard } from './graphicCard';
83
+
84
+ export { default as UserInfo } from './userInfo';
85
+ export { default as Phone } from './phone';
86
+ export { default as PhoneCode } from './phoneCode';
87
+ export { default as Share } from './share';
88
+
89
+ export { default as Lottery } from './lottery';
82
90
  // open
83
91
  // import Auth from './auth';
84
92
 
@@ -17,18 +17,20 @@ export interface PropsType extends CommonPropsType {
17
17
  */
18
18
  params?: {key: string, value: string}[];
19
19
  contentSlot?: React.ReactNode;
20
+ isOpenInNewWindow: boolean;
20
21
  }
21
22
 
22
23
  // 所有绝对地址直接交由浏览器,新开窗口交由浏览器
23
24
  // 当前窗口相对地址交给平台
24
25
  export default function Link({
25
- content = '这是一个链接',
26
+ content,
26
27
  url = '',
27
28
  events = {},
28
29
  style,
29
30
  className,
30
31
  contentSlot,
31
- params = [], // TODO 格式定义
32
+ params = [], // TODO 格式定义,
33
+ isOpenInNewWindow,
32
34
  }: PropsType) {
33
35
  url = url.trim();
34
36
  const cls = classNames({
@@ -91,6 +93,7 @@ export default function Link({
91
93
  <a
92
94
  style={{ ...style }}
93
95
  className={cls}
96
+ target={isOpenInNewWindow ? '_blank' : '_self'}
94
97
  href={href}
95
98
  onClick={(e) => {
96
99
  events.tap && events.tap({}, { originEvent: e });
@@ -107,10 +110,10 @@ export default function Link({
107
110
  }
108
111
  }
109
112
  }}
110
- rel="noreferrer"
113
+ rel='noopener noreferrer'
111
114
  >
112
115
  {contentSlot && <div className="weda-link-slot">{contentSlot}</div>}
113
116
  {content}
114
117
  </a>
115
118
  );
116
- }
119
+ }
@@ -60,6 +60,10 @@
60
60
  .weda-list-view__containor .weda-list-view__more {
61
61
  background-color: #fff;
62
62
  }
63
+ .weda-list-view__containor
64
+ .weda-list-view__more.weda-list-view__more-bottomLoad {
65
+ background-color: transparent;
66
+ }
63
67
  .weda-list-view__containor
64
68
  .weda-list-view__more
65
69
  .weda-list-view__more-pagination {
@@ -11,24 +11,11 @@ import { isInIde } from '../../utils/platform';
11
11
  import classNames from '../../utils/classnames';
12
12
  import isequal from 'lodash.isequal';
13
13
  import './index.css';
14
+ import { REL_DICT } from '../../utils/constant';
15
+ import { isNil } from '../../utils/lodash';
14
16
 
15
- const REL_DICT = {
16
- equal: 'eq', // 等于
17
- unequal: 'neq', // 不等于
18
- include: 'search', // 包含
19
- exclude: '_exclude', // 不包含
20
- begin_with: '_begin_with', // 开头是
21
- greater: 'gt', // 大于
22
- greater_or_equal: 'gte', // 大于等于
23
- bigger_or_equal: 'gte', //大于等于
24
- less: 'lt', // 小于
25
- less_or_equal: 'lte', // 小于等于
26
- in: 'in', // 多选值
27
- not_in: 'nin', // 不在多选值
28
- };
29
17
  const ORDERTYPE = ['asc', 'desc'];
30
18
  const BLOCK_NAME = 'weda-list-view';
31
- const isNull = (val) => [undefined, null].includes(val);
32
19
  const getIdeMockData = (length = 3) => Array.from({ length }).map((d) => ({}));
33
20
  const getWhereList = (where) => {
34
21
  let result = [];
@@ -45,7 +32,7 @@ const getWhereList = (where) => {
45
32
  rel = 'regex';
46
33
  val = `^((?!${val}).)*$`;
47
34
  }
48
- if (item2?.logic !== 'or' && item2?.key && rel && !isNull(val)) {
35
+ if (item2?.logic !== 'or' && item2?.key && rel && !isNil(val)) {
49
36
  result.push({ key: item2.key, rel, val });
50
37
  }
51
38
  });
@@ -63,9 +50,9 @@ export default function ListView(props: IListView) {
63
50
  orderBy,
64
51
  orderType,
65
52
  where,
66
- template = 'simpleList',
53
+ template,
67
54
  pageSize = 5,
68
- pagination = 'loadMoreButton',
55
+ pagination,
69
56
  events,
70
57
  className,
71
58
  children,
@@ -185,7 +172,7 @@ export default function ListView(props: IListView) {
185
172
  const { orderBy, orderType, pageNo, pageSize, where } = params || {};
186
173
  const tcbParams = {};
187
174
  // tcb分页参数
188
- if (!isNull(pageNo) && !isNull(pageSize)) {
175
+ if (!isNil(pageNo) && !isNil(pageSize)) {
189
176
  tcbParams['pageNo'] = pageNo;
190
177
  tcbParams['pageSize'] = pageSize;
191
178
  }
@@ -344,7 +331,12 @@ export default function ListView(props: IListView) {
344
331
  {children}
345
332
  </div>
346
333
  )}
347
- <div className={classNames(`${BLOCK_NAME}__more`)}>
334
+ <div
335
+ className={classNames(
336
+ `${BLOCK_NAME}__more`,
337
+ `${BLOCK_NAME}__more-${pagination}`
338
+ )}
339
+ >
348
340
  {pagination === 'bottomLoad' && renderBottomLoad()}
349
341
  {pagination === 'loadMoreButton' && renderLoadMore()}
350
342
  {pagination === 'pagination' && renderPagination()}
@@ -0,0 +1,327 @@
1
+ /* pc style start */
2
+ .weda-lottery {
3
+ width: 326px;
4
+ height: 326px;
5
+ position: relative;
6
+ }
7
+ .weda-lottery .weda-lottery__wrap {
8
+ position: relative;
9
+ width: 100%;
10
+ height: 100%;
11
+ background: #FF465C;
12
+ border: 1px solid rgba(255, 255, 255, 0.6);
13
+ box-shadow: inset 0px 0px 4px rgba(255, 255, 255, 0.5);
14
+ border-radius: 10px;
15
+ }
16
+
17
+ .weda-lottery .weda-lottery__dot-top {
18
+ position: absolute;
19
+ top: 4px;
20
+ left: calc((100% - 217px) / 2);
21
+ }
22
+
23
+ .weda-lottery .weda-lottery__dot-bottom {
24
+ position: absolute;
25
+ bottom: 4px;
26
+ left: calc((100% - 217px) / 2);
27
+ }
28
+
29
+ .weda-lottery .weda-lottery__dot-left {
30
+ position: absolute;
31
+ left: 4px;
32
+ top: calc((100% - 217px) / 2);
33
+ }
34
+
35
+ .weda-lottery .weda-lottery__dot-right {
36
+ position: absolute;
37
+ right: 4px;
38
+ top: calc((100% - 217px) / 2);
39
+ }
40
+
41
+ .weda-lottery .weda-lottery__dot {
42
+ display: flex;
43
+ }
44
+
45
+ .weda-lottery .weda-lottery__dot-horizontal {
46
+ flex-direction: row;
47
+ }
48
+
49
+ .weda-lottery .weda-lottery__dot-vertical {
50
+ flex-direction: column;
51
+ }
52
+
53
+ .weda-lottery .weda-lottery__dot .weda-lottery__dot-item,
54
+ .weda-lottery .weda-lottery__dot-single {
55
+ width: 9px;
56
+ height: 9px;
57
+ box-shadow: 0px 0px 4px rgba(255, 255, 255, 0.3);
58
+ border-radius: 50%;
59
+ background: #FFFFFF;
60
+ }
61
+
62
+ .weda-lottery .weda-lottery__dot .weda-lottery__dot-item:nth-child(odd) {
63
+ background: #FFEE52;
64
+ }
65
+
66
+ .weda-lottery .weda-lottery__dot .weda-lottery__dot-item:nth-child(even) {
67
+ background: #FFFFFF
68
+ }
69
+
70
+ .weda-lottery .weda-lottery__dot-horizontal .weda-lottery__dot-item {
71
+ margin-right: 43px;
72
+ }
73
+
74
+ .weda-lottery .weda-lottery__dot-horizontal .weda-lottery__dot-item:last-child {
75
+ margin-right: 0 !important;
76
+ }
77
+
78
+ .weda-lottery .weda-lottery__dot-vertical .weda-lottery__dot-item {
79
+ margin-bottom: 43px;
80
+ }
81
+
82
+ .weda-lottery .weda-lottery__dot-vertical .weda-lottery__dot-item:last-child {
83
+ margin-bottom: 0 !important;
84
+ }
85
+
86
+ .weda-lottery .weda-lottery__dot-left-top {
87
+ position: absolute;
88
+ top: 9px;
89
+ left: 6px;
90
+ }
91
+
92
+ .weda-lottery .weda-lottery__dot-right-top {
93
+ position: absolute;
94
+ top: 9px;
95
+ right: 6px;
96
+ }
97
+
98
+ .weda-lottery .weda-lottery__dot-left-bottom {
99
+ position: absolute;
100
+ left: 6px;
101
+ bottom: 9px;
102
+ }
103
+
104
+ .weda-lottery .weda-lottery__dot-right-bottom {
105
+ position: absolute;
106
+ right: 6px;
107
+ bottom: 9px;
108
+ }
109
+
110
+ .weda-lottery .weda-lottery__inner {
111
+ padding: 18px;
112
+ width: 100%;
113
+ height: 100%;
114
+ box-sizing: border-box;
115
+ }
116
+
117
+ .weda-lottery .weda-lottery__inner .weda-lottery__inner-wrap {
118
+ position: relative;
119
+ width: 100%;
120
+ box-sizing: border-box;
121
+ background: linear-gradient(180deg, #DD0D00 0%, #D80027 100%);
122
+ border: 1px solid rgba(255, 255, 255, 0.25);
123
+ box-shadow: inset 0px 0px 4px rgba(255, 255, 255, 0.5);
124
+ border-radius: 10px;
125
+ height: 100%;
126
+ }
127
+
128
+ .weda-lottery .weda-lottery__inner .weda-lottery__list {
129
+ position: absolute;
130
+ top: 0;
131
+ left: 0;
132
+ right: 0;
133
+ bottom: 0;
134
+ z-index: 1;
135
+ box-sizing: border-box;
136
+ }
137
+
138
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item {
139
+ position: absolute;
140
+ width: calc((100% - 32px)/ 3);
141
+ height: calc((100% - 32px)/ 3);
142
+ font-size: 0;
143
+ text-align: center;
144
+ background: #FFF8EE;
145
+ box-shadow: inset 0px -2px 0px #FFDDBD;
146
+ border-radius: 8px;
147
+ }
148
+
149
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item.is-actived {
150
+ background: #FFF8EE;
151
+ box-shadow: 0px 0px 6px #FFFFFF;
152
+ }
153
+
154
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item.is-selected {
155
+ background: #FF6666;
156
+ box-shadow: inset 0px -2px 0px #FFA4A4;
157
+ }
158
+
159
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item:first-child {
160
+ top: 8px;
161
+ left: 8px;
162
+ }
163
+
164
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item:nth-child(2) {
165
+ top: 8px;
166
+ left: calc((100% - 32px)/ 3 + 16px);
167
+ }
168
+
169
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item:nth-child(3) {
170
+ top: 8px;
171
+ right: 8px;
172
+ }
173
+
174
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item:nth-child(4) {
175
+ top: calc((100% - 32px)/ 3 + 16px);
176
+ right: 8px;
177
+ }
178
+
179
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item:nth-child(5) {
180
+ bottom: 8px;
181
+ right: 8px;
182
+ }
183
+
184
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item:nth-child(6) {
185
+ bottom: 8px;
186
+ left: calc((100% - 32px)/ 3 + 16px);
187
+ }
188
+
189
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item:nth-child(7) {
190
+ bottom: 8px;
191
+ left: 8px;
192
+ }
193
+
194
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item:nth-child(8) {
195
+ bottom: calc((100% - 32px)/ 3 + 16px);
196
+ left: 8px;
197
+ }
198
+
199
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-cell {
200
+ width: 100%;
201
+ height: 100%;
202
+ max-width: 100%;
203
+ max-height: 100%;
204
+ box-sizing: border-box;
205
+ border-style: solid;
206
+ border-color: transparent;
207
+ border-radius: 8px;
208
+ display: flex;
209
+ flex-direction: column;
210
+ align-items: center;
211
+ }
212
+
213
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item.is-actived .weda-lottery__turntable-cell {
214
+ border-color: #FFE05F;
215
+ }
216
+
217
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-cell-image {
218
+ height: 40px;
219
+ display: flex;
220
+ align-items: center;
221
+ justify-content: center;
222
+ }
223
+
224
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-cell-icon {
225
+ display: block;
226
+ width: 40px;
227
+ height: 40px;
228
+ object-fit: contain;
229
+ }
230
+
231
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-cell-desc {
232
+ margin-top: 6px;
233
+ font-weight: 400;
234
+ font-size: 12px;
235
+ line-height: 17px;
236
+ text-align: center;
237
+ color: #BA0000;
238
+ white-space: nowrap;
239
+ text-overflow: ellipsis;
240
+ overflow: hidden;
241
+ width: 100%;
242
+ }
243
+
244
+ .weda-lottery .weda-lottery__inner .weda-lottery__turntable-item.is-selected .weda-lottery__turntable-cell-desc {
245
+ color: #FFFFFF;
246
+ }
247
+
248
+ .weda-lottery .weda-lottery__turntable-btn {
249
+ z-index: 2;
250
+ position: absolute;
251
+ width: calc((100% - 32px)/ 3);
252
+ height: calc((100% - 32px)/ 3);
253
+ top: calc((100% - 32px)/ 3 + 16px);
254
+ left: calc((100% - 32px)/ 3 + 16px);
255
+ background: linear-gradient(180deg, #FFEE81 0%, #FFD646 100%);
256
+ box-shadow: inset 0px -2px 0px #FF7A00;
257
+ border-radius: 50%;
258
+ }
259
+
260
+ .weda-lottery .weda-lottery__turntable-btn.is-actived {
261
+ background: linear-gradient(180deg, #FFEE81 0%, #FFD646 100%);
262
+ box-shadow: inset 0px 2px 0px #FFFFFF;
263
+ }
264
+
265
+ .weda-lottery .weda-lottery__btn-inner {
266
+ padding: 9px;
267
+ width: 100%;
268
+ height: 100%;
269
+ }
270
+
271
+ .weda-lottery .weda-lottery__btn {
272
+ width: 100%;
273
+ height: 100%;
274
+ background: linear-gradient(180deg, #FF922D 0%, #FF3C76 100%);
275
+ box-shadow: inset 0px 0px 8px rgba(234, 27, 53, 0.5);
276
+ border-radius: 50%;
277
+ display: flex;
278
+ align-items: center;
279
+ justify-content: center;
280
+ }
281
+
282
+ .weda-lottery .weda-lottery__turntable-btn.is-actived .weda-lottery__btn {
283
+ background: linear-gradient(180deg, #FF922D 0%, #FF3C76 100%);
284
+ box-shadow: inset 0px 0px 8px rgba(234, 27, 53, 0.5);
285
+ }
286
+
287
+ .weda-lottery .weda-lottery__btn-image {
288
+ padding: 11px 15px;
289
+ width: 100%;
290
+ height: 100%;
291
+ box-sizing: border-box;
292
+ display: flex;
293
+ align-items: center;
294
+ text-decoration: none
295
+ }
296
+
297
+ .weda-lottery .weda-lottery__btn-image .weda-lottery__btn-text {
298
+ font-weight: 600;
299
+ font-size: 18px;
300
+ line-height: 22px;
301
+ text-align: center;
302
+ color: #FFFFFF;
303
+ text-shadow: 0px 0.5px 0px #E42B27;
304
+ max-height: 100%;
305
+ display: -webkit-box;
306
+ overflow: hidden;
307
+ text-overflow: ellipsis;
308
+ -webkit-box-orient: vertical;
309
+ -webkit-line-clamp: 2;
310
+ width: 100%;
311
+ }
312
+
313
+ .weda-lottery .weda-lottery__turntable-btn.is-actived .weda-lottery__btn-image {
314
+ opacity: 0.6;
315
+ }
316
+ /* pc style end */
317
+
318
+ /* mobile style start */
319
+ .weda-lottery-mobile {
320
+ width: 100%;
321
+ }
322
+
323
+ .weda-lottery-mobile .weda-lottery__wrap,
324
+ .weda-lottery-mobile .weda-lottery__content {
325
+ width: 100%;
326
+ }
327
+ /* mobile style end */