@cloudbase/weda-ui 2.0.11 → 2.0.27

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 (262) hide show
  1. package/README.md +1 -0
  2. package/package.json +39 -35
  3. package/src/configs/components/button.json +60 -13
  4. package/src/configs/components/calendar.json +3 -3
  5. package/src/configs/components/carousel.json +57 -47
  6. package/src/configs/components/chart/bar.json +4 -13
  7. package/src/configs/components/chart/line.json +4 -13
  8. package/src/configs/components/chart/pie.json +3 -10
  9. package/src/configs/components/chart/statisticsCard.json +1 -4
  10. package/src/configs/components/container.json +1 -3
  11. package/src/configs/components/dataView.json +7 -15
  12. package/src/configs/components/drawer.json +24 -6
  13. package/src/configs/components/form/form.json +19 -0
  14. package/src/configs/components/form/input.json +20 -5
  15. package/src/configs/components/form/location.json +51 -48
  16. package/src/configs/components/form/radio.json +1 -3
  17. package/src/configs/components/form/richText.json +14 -14
  18. package/src/configs/components/form/select.json +62 -82
  19. package/src/configs/components/form/textarea.json +14 -1
  20. package/src/configs/components/form/uploader.json +64 -64
  21. package/src/configs/components/form/uploaderFile.json +1 -2
  22. package/src/configs/components/graphicCard.json +44 -45
  23. package/src/configs/components/image.json +44 -40
  24. package/src/configs/components/link.json +5 -10
  25. package/src/configs/components/listView.json +2 -8
  26. package/src/configs/components/lottery.json +7 -3
  27. package/src/configs/components/modal.json +26 -21
  28. package/src/configs/components/navLayout.json +68 -68
  29. package/src/configs/components/navigationBar.json +4 -1
  30. package/src/configs/components/richtextview.json +1 -1
  31. package/src/configs/components/scrollVeiw.json +14 -42
  32. package/src/configs/components/swiper.json +9 -9
  33. package/src/configs/components/wedaVideo.json +89 -0
  34. package/src/configs/components/wxOpenApi/phone.json +7 -21
  35. package/src/configs/components/wxOpenApi/phoneCode.json +7 -19
  36. package/src/configs/components/wxOpenApi/share.json +14 -24
  37. package/src/configs/components/wxOpenApi/userInfo.json +9 -27
  38. package/src/configs/index.js +2 -0
  39. package/src/mp/components/calendar/index.js +4 -1
  40. package/src/mp/components/calendar/index.json +3 -2
  41. package/src/mp/components/calendar/index.wxml +6 -28
  42. package/src/mp/components/calendar/index.wxss +17 -16
  43. package/src/mp/components/carousel/index.json +1 -1
  44. package/src/mp/components/carousel/index.wxml +3 -30
  45. package/src/mp/components/chart/bar/index.wxml +1 -6
  46. package/src/mp/components/chart/ec-canvas/ec-canvas.json +1 -1
  47. package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +2 -19
  48. package/src/mp/components/chart/line/index.wxml +1 -6
  49. package/src/mp/components/chart/pie/index.wxml +1 -6
  50. package/src/mp/components/chart/statisticsCard/index.wxml +1 -5
  51. package/src/mp/components/chart/statisticsCard/index.wxss +7 -10
  52. package/src/mp/components/dataView/index.wxml +1 -13
  53. package/src/mp/components/form/checkbox/index.js +5 -1
  54. package/src/mp/components/form/checkbox/index.wxml +3 -18
  55. package/src/mp/components/form/formcell/index.wxss +5 -0
  56. package/src/mp/components/form/input/index.js +1 -1
  57. package/src/mp/components/form/input/index.wxml +3 -16
  58. package/src/mp/components/form/input/index.wxss +7 -1
  59. package/src/mp/components/form/location/components/mapChoose/index.json +1 -1
  60. package/src/mp/components/form/location/components/mapChoose/index.wxml +11 -58
  61. package/src/mp/components/form/location/index.js +7 -1
  62. package/src/mp/components/form/location/index.json +1 -1
  63. package/src/mp/components/form/location/index.wxml +7 -43
  64. package/src/mp/components/form/radio/index.js +5 -1
  65. package/src/mp/components/form/radio/index.wxml +2 -14
  66. package/src/mp/components/form/select/index.js +2 -2
  67. package/src/mp/components/form/select/index.wxml +3 -33
  68. package/src/mp/components/form/select/index.wxss +9 -0
  69. package/src/mp/components/form/switch/index.wxml +2 -13
  70. package/src/mp/components/form/textarea/index.js +6 -0
  71. package/src/mp/components/form/textarea/index.wxml +4 -23
  72. package/src/mp/components/form/textarea/index.wxss +5 -0
  73. package/src/mp/components/form/uploader/index.wxml +2 -20
  74. package/src/mp/components/form/uploader/weui-uploader.json +6 -6
  75. package/src/mp/components/form/uploader/weui-uploader.wxml +10 -53
  76. package/src/mp/components/form/uploaderFile/index.wxml +14 -71
  77. package/src/mp/components/graphicCard/index.js +9 -11
  78. package/src/mp/components/graphicCard/index.wxml +6 -34
  79. package/src/mp/components/graphicCard/index.wxss +6 -6
  80. package/src/mp/components/image/index.wxml +3 -21
  81. package/src/mp/components/listView/index.wxml +8 -33
  82. package/src/mp/components/listView/index.wxss +2 -2
  83. package/src/mp/components/lottery/index.wxml +7 -31
  84. package/src/mp/components/navLayout/index.js +9 -12
  85. package/src/mp/components/navLayout/index.wxml +6 -30
  86. package/src/mp/components/navLayout/index.wxss +10 -10
  87. package/src/mp/components/navigationBar/index.json +1 -2
  88. package/src/mp/components/navigationBar/index.wxml +29 -146
  89. package/src/mp/components/navigationBar/index.wxss +10 -10
  90. package/src/mp/components/richText/index.wxml +1 -1
  91. package/src/mp/components/richText/index.wxss +7 -5
  92. package/src/mp/components/swiper/index.wxml +1 -14
  93. package/src/mp/components/tabs/index.json +1 -1
  94. package/src/mp/components/tabs/index.wxml +3 -22
  95. package/src/mp/components/tabs/index.wxss +1 -2
  96. package/src/mp/components/text/index.wxml +1 -7
  97. package/src/mp/components/wedaVideo/index.js +86 -0
  98. package/src/mp/components/wedaVideo/index.json +4 -0
  99. package/src/mp/components/wedaVideo/index.wxml +4 -0
  100. package/src/mp/components/wedaVideo/index.wxss +20 -0
  101. package/src/mp/components/wxOpenApi/phone/index.js +1 -9
  102. package/src/mp/components/wxOpenApi/phone/index.wxml +1 -11
  103. package/src/mp/components/wxOpenApi/phoneCode/index.json +1 -1
  104. package/src/mp/components/wxOpenApi/phoneCode/index.wxml +1 -11
  105. package/src/mp/components/wxOpenApi/share/index.wxml +1 -11
  106. package/src/mp/components/wxOpenApi/userInfo/index.wxml +1 -10
  107. package/src/mp/index.json +1 -0
  108. package/src/mp/style/weda-ui.wxss +16 -6
  109. package/src/web/actions/showModal/index.tsx +5 -4
  110. package/src/web/components/calendar/index.css +99 -65
  111. package/src/web/components/chart/common/core/eChartBase.ts +55 -42
  112. package/src/web/components/chart/common/core/type.ts +23 -23
  113. package/src/web/components/chart/common/echart.css +12 -12
  114. package/src/web/components/chart/common/echarts.ts +3 -5
  115. package/src/web/components/chart/common/useChart.tsx +34 -16
  116. package/src/web/components/chart/statisticsCard/index.css +9 -8
  117. package/src/web/components/container/index.tsx +3 -4
  118. package/src/web/components/drawer/index.tsx +15 -4
  119. package/src/web/components/form/checkbox/index.tsx +32 -31
  120. package/src/web/components/form/enumSelect/NormalSelect.tsx +0 -2
  121. package/src/web/components/form/form/index.css +3 -6
  122. package/src/web/components/form/form/index.tsx +2 -1
  123. package/src/web/components/form/formcell/index.css +6 -17
  124. package/src/web/components/form/formcell/index.tsx +2 -6
  125. package/src/web/components/form/input/index.css +8 -4
  126. package/src/web/components/form/input/index.tsx +61 -53
  127. package/src/web/components/form/location/common/mapChoose.css +13 -11
  128. package/src/web/components/form/location/common/selectModal.jsx +2 -11
  129. package/src/web/components/form/location/common/useLocationInfo.js +4 -0
  130. package/src/web/components/form/location/components/LocationH5/index.css +19 -20
  131. package/src/web/components/form/location/components/LocationH5/location.h5.jsx +11 -1
  132. package/src/web/components/form/location/components/LocationPC/Header.jsx +0 -13
  133. package/src/web/components/form/location/components/LocationPC/location.PC.jsx +14 -5
  134. package/src/web/components/form/radio/index.tsx +32 -26
  135. package/src/web/components/form/renderDecorator.tsx +23 -26
  136. package/src/web/components/form/select/h5.tsx +2 -2
  137. package/src/web/components/form/select/index.css +9 -0
  138. package/src/web/components/form/select/index.tsx +76 -49
  139. package/src/web/components/form/select/region/index.ts +101 -80
  140. package/src/web/components/form/select/year.tsx +2 -0
  141. package/src/web/components/form/switch/index.tsx +40 -40
  142. package/src/web/components/form/textarea/index.css +4 -0
  143. package/src/web/components/form/textarea/index.tsx +38 -25
  144. package/src/web/components/form/types.d.ts +10 -10
  145. package/src/web/components/form/uploader/index.css +10 -0
  146. package/src/web/components/form/uploader/uploader.h5.tsx +3 -6
  147. package/src/web/components/form/uploader/uploader.pc.tsx +3 -6
  148. package/src/web/components/form/uploaderFile/index.css +24 -23
  149. package/src/web/components/form/uploaderFile/index.jsx +0 -5
  150. package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +24 -15
  151. package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +21 -13
  152. package/src/web/components/graphicCard/index.css +6 -6
  153. package/src/web/components/image/image.tsx +2 -2
  154. package/src/web/components/image/index.css +9 -7
  155. package/src/web/components/image/index.tsx +28 -11
  156. package/src/web/components/index.js +1 -0
  157. package/src/web/components/link/index.tsx +12 -12
  158. package/src/web/components/listView/index.css +8 -8
  159. package/src/web/components/lottery/index.css +43 -37
  160. package/src/web/components/lottery/index.tsx +3 -3
  161. package/src/web/components/modal/index.tsx +34 -34
  162. package/src/web/components/navLayout/index.css +25 -25
  163. package/src/web/components/navigationBar/index.css +26 -26
  164. package/src/web/components/picker/datePicker.tsx +3 -3
  165. package/src/web/components/picker/picker.tsx +3 -3
  166. package/src/web/components/richText/index.jsx +41 -46
  167. package/src/web/components/richTextView/index.css +7 -3
  168. package/src/web/components/richTextView/index.tsx +4 -6
  169. package/src/web/components/scrollView/index.tsx +2 -2
  170. package/src/web/components/slot/index.tsx +3 -4
  171. package/src/web/components/swiper/index.css +1 -1
  172. package/src/web/components/swiper/index.tsx +33 -15
  173. package/src/web/components/tabs/index.css +2 -3
  174. package/src/web/components/tabs/index.tsx +6 -6
  175. package/src/web/components/tabs/tabs.h5.tsx +17 -12
  176. package/src/web/components/tabs/tabs.pc.tsx +45 -34
  177. package/src/web/components/text/index.css +1 -1
  178. package/src/web/components/wedaVideo/index.css +42 -0
  179. package/src/web/components/wedaVideo/index.tsx +208 -0
  180. package/src/web/utils/constant.ts +2 -1
  181. package/src/web/utils/loading-fallback.tsx +2 -2
  182. package/src/web/utils/lodash.ts +1 -1
  183. package/src/web/utils/platform.js +13 -0
  184. package/src/web/utils/useSetState.ts +6 -2
  185. package/src/web/weda-ui.css +23 -8
  186. package/src/docs/common/format.tsx +0 -112
  187. package/src/docs/common/tableView.css +0 -164
  188. package/src/docs/common/tableView.tsx +0 -273
  189. package/src/docs/compsdocs/chart/Bar.mdx +0 -159
  190. package/src/docs/compsdocs/chart/Line.mdx +0 -100
  191. package/src/docs/compsdocs/chart/Pie.mdx +0 -83
  192. package/src/docs/compsdocs/chart/_category_.json +0 -1
  193. package/src/docs/compsdocs/chart/statisticsCard.mdx +0 -51
  194. package/src/docs/compsdocs/database/DataView.mdx +0 -33
  195. package/src/docs/compsdocs/database/ListView.mdx +0 -33
  196. package/src/docs/compsdocs/database/_category_.json +0 -1
  197. package/src/docs/compsdocs/form/Form.mdx +0 -35
  198. package/src/docs/compsdocs/form/FormCheckbox.mdx +0 -35
  199. package/src/docs/compsdocs/form/FormDate.mdx +0 -30
  200. package/src/docs/compsdocs/form/FormEmail.mdx +0 -30
  201. package/src/docs/compsdocs/form/FormImageUploader.mdx +0 -31
  202. package/src/docs/compsdocs/form/FormInput.mdx +0 -30
  203. package/src/docs/compsdocs/form/FormLocation.mdx +0 -64
  204. package/src/docs/compsdocs/form/FormPhone.mdx +0 -30
  205. package/src/docs/compsdocs/form/FormRadio.mdx +0 -35
  206. package/src/docs/compsdocs/form/FormRegion.mdx +0 -30
  207. package/src/docs/compsdocs/form/FormSelect.mdx +0 -36
  208. package/src/docs/compsdocs/form/FormSwitch.mdx +0 -30
  209. package/src/docs/compsdocs/form/FormTextarea.mdx +0 -30
  210. package/src/docs/compsdocs/form/FormTime.mdx +0 -30
  211. package/src/docs/compsdocs/form/FormUploadFile.mdx +0 -30
  212. package/src/docs/compsdocs/form/FormUrl.mdx +0 -30
  213. package/src/docs/compsdocs/form/_category_.json +0 -1
  214. package/src/docs/compsdocs/grid/Card.mdx +0 -32
  215. package/src/docs/compsdocs/grid/Container.mdx +0 -42
  216. package/src/docs/compsdocs/grid/Footer.mdx +0 -31
  217. package/src/docs/compsdocs/grid/GridLayout.mdx +0 -32
  218. package/src/docs/compsdocs/grid/Header.mdx +0 -31
  219. package/src/docs/compsdocs/grid/Layout.mdx +0 -25
  220. package/src/docs/compsdocs/grid/List.mdx +0 -31
  221. package/src/docs/compsdocs/grid/ScrollView.mdx +0 -37
  222. package/src/docs/compsdocs/grid/Swiper.mdx +0 -58
  223. package/src/docs/compsdocs/grid/_category_.json +0 -1
  224. package/src/docs/compsdocs/media/Icon.mdx +0 -31
  225. package/src/docs/compsdocs/media/Image.mdx +0 -55
  226. package/src/docs/compsdocs/media/_category_.json +0 -1
  227. package/src/docs/compsdocs/model/ModelCreate.mdx +0 -20
  228. package/src/docs/compsdocs/model/ModelDetail.mdx +0 -20
  229. package/src/docs/compsdocs/model/ModelTable.mdx +0 -24
  230. package/src/docs/compsdocs/model/ModelUpdate.mdx +0 -21
  231. package/src/docs/compsdocs/model/PageLayout.mdx +0 -21
  232. package/src/docs/compsdocs/model/_category_.json +0 -1
  233. package/src/docs/compsdocs/navmenu/Classification.mdx +0 -38
  234. package/src/docs/compsdocs/navmenu/NavBar.mdx +0 -43
  235. package/src/docs/compsdocs/navmenu/NavLayout.mdx +0 -30
  236. package/src/docs/compsdocs/navmenu/TabBar.mdx +0 -43
  237. package/src/docs/compsdocs/navmenu/TabBarItem.mdx +0 -29
  238. package/src/docs/compsdocs/navmenu/_category_.json +0 -1
  239. package/src/docs/compsdocs/senior/Lottery.mdx +0 -48
  240. package/src/docs/compsdocs/senior/Modal.mdx +0 -58
  241. package/src/docs/compsdocs/senior/SlotMachine.mdx +0 -52
  242. package/src/docs/compsdocs/senior/_category_.json +0 -1
  243. package/src/docs/compsdocs/show/Calendar.mdx +0 -29
  244. package/src/docs/compsdocs/show/Divider.mdx +0 -31
  245. package/src/docs/compsdocs/show/GraphicCard.mdx +0 -30
  246. package/src/docs/compsdocs/show/Item.mdx +0 -32
  247. package/src/docs/compsdocs/show/ItemList.mdx +0 -47
  248. package/src/docs/compsdocs/show/Media.mdx +0 -25
  249. package/src/docs/compsdocs/show/StatusTip.mdx +0 -25
  250. package/src/docs/compsdocs/show/Swiper.mdx +0 -33
  251. package/src/docs/compsdocs/show/Tabs.mdx +0 -38
  252. package/src/docs/compsdocs/show/_category_.json +0 -1
  253. package/src/docs/compsdocs/show/button.mdx +0 -25
  254. package/src/docs/compsdocs/text/Link.mdx +0 -43
  255. package/src/docs/compsdocs/text/RichTextView.mdx +0 -36
  256. package/src/docs/compsdocs/text/Text.mdx +0 -31
  257. package/src/docs/compsdocs/text/Title.mdx +0 -32
  258. package/src/docs/compsdocs/text/_category_.json +0 -1
  259. package/src/docs/compsdocs/wxOpen/Phone.mdx +0 -60
  260. package/src/docs/compsdocs/wxOpen/Share.mdx +0 -46
  261. package/src/docs/compsdocs/wxOpen/UserInfo.mdx +0 -60
  262. package/src/docs/compsdocs/wxOpen/_category_.json +0 -4
@@ -2,11 +2,11 @@ import * as React from 'react';
2
2
 
3
3
  import classNames from '../../../utils/classnames';
4
4
  import getLocalCounter from '../../../utils/getLocalCounter';
5
- import {usePlatform} from '../../../utils/platform';
6
- import {ConfigProvider, Switch as TeaSwitch} from 'tea-component';
5
+ import { usePlatform } from '../../../utils/platform';
6
+ import { ConfigProvider, Switch as TeaSwitch } from 'tea-component';
7
7
  import { renderDecorator } from '../renderDecorator';
8
8
  import { useSyncValue } from '../../../utils/useSyncValue';
9
- import { CommonFormPropsType } from '../types';
9
+ import type { CommonFormPropsType } from '../types';
10
10
 
11
11
  export default function Switch({
12
12
  // 系统属性
@@ -21,7 +21,7 @@ export default function Switch({
21
21
  layout = 'horizontal',
22
22
  disabled = false,
23
23
  requiredFlag = false,
24
- decorator
24
+ decorator,
25
25
  }: PropsType) {
26
26
  const isFlex = layout !== 'vertical';
27
27
  const cls = classNames({
@@ -40,51 +40,51 @@ export default function Switch({
40
40
  const platform = usePlatform();
41
41
  // 两次默认值不同时, 需要刷新
42
42
  const [checked, setChecked] = useSyncValue(defaultChecked);
43
-
44
43
 
45
44
  // 现在低码组件往源码组件传入的id不唯一, 暂时使用hashcode替代
46
45
  const hashcode = getLocalCounter();
47
46
  const _id = `switch-${hashcode}`;
48
- const switchElement = platform === 'h5' ?
49
- (
50
- <div className={subCls}>
51
- {isFlex ? <div className="weui-cell__bd"></div> : null}
52
- <div className={isFlex ? 'weui-cell__ft' : 'weui-cell__bd'}>
53
- <label htmlFor={_id} key={_id} className="weui-switch-cp">
54
- <input
47
+ const switchElement =
48
+ platform === 'h5' ? (
49
+ <div className={subCls}>
50
+ {isFlex ? <div className="weui-cell__bd"></div> : null}
51
+ <div className={isFlex ? 'weui-cell__ft' : 'weui-cell__bd'}>
52
+ <label htmlFor={_id} key={_id} className="weui-switch-cp">
53
+ <input
54
+ id={_id}
55
+ className="weui-switch-cp__input"
56
+ type="checkbox"
57
+ checked={checked}
58
+ disabled={disabled}
59
+ onChange={(ev) => {
60
+ const value = ev.target.checked;
61
+ setChecked(value);
62
+ events.change({ value }, { orgianalEvent: ev });
63
+ }}
64
+ />
65
+ <div className="weui-switch-cp__box"></div>
66
+ </label>
67
+ </div>
68
+ </div>
69
+ ) : (
70
+ <ConfigProvider classPrefix="wedatea2td">
71
+ <TeaSwitch
55
72
  id={_id}
56
- className="weui-switch-cp__input"
57
- type="checkbox"
58
- checked={checked}
73
+ value={checked}
59
74
  disabled={disabled}
60
- onChange={(ev) => {
61
- const value = ev.target.checked;
75
+ onChange={(value, context) => {
76
+ const originEvent = context.event;
62
77
  setChecked(value);
63
- events.change({ value }, {orgianalEvent: ev});
78
+ events.change({ value }, { originEvent });
64
79
  }}
65
80
  />
66
- <div className="weui-switch-cp__box"></div>
67
- </label>
68
- </div>
69
- </div>
70
- ) :
71
- (
72
- <ConfigProvider classPrefix="wedatea2td">
73
- <TeaSwitch
74
- id={_id}
75
- value={checked}
76
- disabled={disabled}
77
- onChange={(value, context) => {
78
- const originEvent = context.event;
79
- setChecked(value);
80
- events.change({ value }, {originEvent});
81
- }}
82
- />
83
- </ConfigProvider>
84
- );
85
-
86
- return renderDecorator(switchElement, decorator)({
81
+ </ConfigProvider>
82
+ );
87
83
 
84
+ return renderDecorator(
85
+ switchElement,
86
+ decorator
87
+ )({
88
88
  id,
89
89
  className: cls,
90
90
  style,
@@ -97,4 +97,4 @@ export default function Switch({
97
97
 
98
98
  export interface PropsType extends CommonFormPropsType {
99
99
  checked?: boolean;
100
- }
100
+ }
@@ -5,3 +5,7 @@
5
5
  .weda-ui .weda-textarea .weui-cell_form {
6
6
  padding: 16px;
7
7
  }
8
+
9
+ .weda-ui .weda-textarea .weui-flex__item .weui-cell_form {
10
+ padding-left: 0;
11
+ }
@@ -26,7 +26,7 @@ export default function Textarea({
26
26
  requiredFlag = false,
27
27
  counterVisible = true,
28
28
  size = 'l',
29
- decorator
29
+ decorator,
30
30
  }: PropsType) {
31
31
  const platform = usePlatform();
32
32
 
@@ -44,7 +44,7 @@ export default function Textarea({
44
44
 
45
45
  // 两次默认值不同时, 需要刷新value
46
46
  const [value, setValue] = useSyncValue(defaultValue);
47
- const counter = React.useMemo(() => (value?.length || 0), [value]);
47
+ const counter = React.useMemo(() => value?.length || 0, [value]);
48
48
 
49
49
  const onChange = function (e) {
50
50
  const text = typeof e === 'string' ? e : e.target.value;
@@ -52,8 +52,16 @@ export default function Textarea({
52
52
  events.change({ value: text });
53
53
  };
54
54
 
55
+ const onFocus = function (e) {
56
+ events.focus?.({ value: e.target.value }, { originEvent: e });
57
+ };
58
+
59
+ const onBlur = function (e) {
60
+ events.blur?.({ value: e.target.value }, { originEvent: e });
61
+ };
62
+
55
63
  let textAreaElement;
56
- if(platform === 'h5') {
64
+ if (platform === 'h5') {
57
65
  textAreaElement = (
58
66
  <div className={subCls}>
59
67
  <div className="weui-cell__bd">
@@ -62,6 +70,8 @@ export default function Textarea({
62
70
  placeholder={placeholder}
63
71
  value={value}
64
72
  onChange={onChange}
73
+ onFocus={onFocus}
74
+ onBlur={onBlur}
65
75
  maxLength={maxLength}
66
76
  disabled={disabled}
67
77
  autoFocus={autoFocus}
@@ -77,32 +87,35 @@ export default function Textarea({
77
87
  } else {
78
88
  textAreaElement = (
79
89
  <ConfigProvider classPrefix="wedatea2td">
80
- <Input.TextArea
81
- size={size}
82
- placeholder={placeholder}
83
- value={value}
84
- onChange={onChange}
85
- maxLength={maxLength}
86
- disabled={disabled}
87
- autoFocus={autoFocus}
88
- showCount
89
- ></Input.TextArea>
90
+ <Input.TextArea
91
+ size={size}
92
+ placeholder={placeholder}
93
+ value={value}
94
+ onChange={onChange}
95
+ onFocus={onFocus}
96
+ onBlur={onBlur}
97
+ maxLength={maxLength}
98
+ disabled={disabled}
99
+ autoFocus={autoFocus}
100
+ showCount
101
+ ></Input.TextArea>
90
102
  </ConfigProvider>
91
103
  );
92
104
  }
93
105
 
94
- return renderDecorator(textAreaElement, decorator)(
95
- {
96
- id,
97
- className: cls,
98
- style,
99
- label: labelVisible ? label : null,
100
- layout,
101
- multiCell: false,
102
- requiredFlag,
103
- size
104
- }
105
- );
106
+ return renderDecorator(
107
+ textAreaElement,
108
+ decorator
109
+ )({
110
+ id,
111
+ className: cls,
112
+ style,
113
+ label: labelVisible ? label : null,
114
+ layout,
115
+ multiCell: false,
116
+ requiredFlag,
117
+ size,
118
+ });
106
119
  }
107
120
  export interface PropsType extends CommonFormPropsType {
108
121
  defaultValue?: string;
@@ -1,12 +1,12 @@
1
- import * as React from "react";
2
- import { CommonPropsType } from "../../types";
1
+ import * as React from 'react';
2
+ import type { CommonPropsType } from '../../types';
3
3
 
4
4
  export interface CommonFormPropsType extends CommonPropsType {
5
- name?: string;
6
- label?: string;
7
- labelVisible?: boolean;
8
- layout?: "horizontal" | "vertical";
9
- disabled?: boolean;
10
- requiredFlag?: boolean;
11
- decorator?: React.FC<any>;
12
- }
5
+ name?: string;
6
+ label?: string;
7
+ labelVisible?: boolean;
8
+ layout?: 'horizontal' | 'vertical';
9
+ disabled?: boolean;
10
+ requiredFlag?: boolean;
11
+ decorator?: React.FC<any>;
12
+ }
@@ -106,3 +106,13 @@
106
106
  .weui-uploader__hd.vertical {
107
107
  padding-bottom: 0;
108
108
  }
109
+
110
+ .weda-ui .weui-uploader__file {
111
+ width: 6.85714em;
112
+ height: 6.85714em;
113
+ }
114
+
115
+ .weda-ui .weui-uploader__input-box {
116
+ width: 6.85714em;
117
+ height: 6.85714em;
118
+ }
@@ -4,10 +4,9 @@ import classNames from '../../../utils/classnames';
4
4
  import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
5
5
  import isObjectEqual from '../../../utils/isObjectEqual';
6
6
  import { useSyncValue } from '../../../utils/useSyncValue';
7
- import { isCloudFileID } from '../../../utils/platform';
7
+ import { isCloudFileID, randomUuid } from '../../../utils/platform';
8
8
  import { IMAGE_TYPES } from './uploader.pc';
9
9
  import type { CommonFormPropsType } from '../types';
10
- import { v4 } from 'uuid';
11
10
 
12
11
  const uploadPath = 'weda-uploader';
13
12
  /**
@@ -40,7 +39,7 @@ export function ImageUploaderH5({
40
39
  //上传进度
41
40
  const [progress, setProgress] = React.useState(0);
42
41
  const [inputValue, setInputValue] = useSyncValue(defaultValue, isObjectEqual);
43
-
42
+ const inputValueRef = React.useRef(inputValue);
44
43
  const fileIdList = React.useMemo(() => {
45
44
  //兼容h5默认值为空时情况
46
45
  if (inputValue === null) {
@@ -94,9 +93,7 @@ export function ImageUploaderH5({
94
93
  getCloudInstance().then(async (tcb) => {
95
94
  try {
96
95
  const fileType = file.type.split('/')?.[1];
97
- const cloudPath = `${uploadPath}/${v4().replaceAll('-', '')}-${
98
- file?.name
99
- }`;
96
+ const cloudPath = `${uploadPath}/${randomUuid()}-${file?.name}`;
100
97
  const { fileID } = await tcb.uploadFile({
101
98
  cloudPath,
102
99
  filePath: file,
@@ -8,10 +8,9 @@ import {
8
8
  ImagePreview,
9
9
  ConfigProvider,
10
10
  } from 'tea-component';
11
- import { v4 } from 'uuid';
12
11
  import classNames from '../../../utils/classnames';
13
12
  import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
14
- import { isCloudFileID } from '../../../utils/platform';
13
+ import { isCloudFileID, randomUuid } from '../../../utils/platform';
15
14
  import isObjectEqual from '../../../utils/isObjectEqual';
16
15
  import { H5UploaderProps } from './uploader.h5';
17
16
  // 默认组件类前缀
@@ -79,7 +78,7 @@ export function UploaderPCInner(props) {
79
78
  const [progress, setProgress] = React.useState(0);
80
79
  // 文件列表
81
80
  const [fileIDList, setfileIDList] = React.useState([]);
82
- const fileRef = React.useRef(fileIDList);
81
+ const fileRef = React.useRef(['']);
83
82
  React.useEffect(() => {
84
83
  let initialValue = []
85
84
  .concat(defaultValue)
@@ -130,9 +129,7 @@ export function UploaderPCInner(props) {
130
129
  getCloudInstance().then(async (tcb) => {
131
130
  try {
132
131
  const fileType = file.type.split('/')?.[1];
133
- const cloudPath = `${uploadPath}/${v4().replaceAll('-', '')}-${
134
- file?.name
135
- }`;
132
+ const cloudPath = `${uploadPath}/${randomUuid()}-${file?.name}`;
136
133
  const { fileID } = await tcb.uploadFile({
137
134
  cloudPath,
138
135
  filePath: file,
@@ -87,7 +87,7 @@
87
87
 
88
88
  .weda-upload-file-pc .weda-upload-file-pc__btn-descripe {
89
89
  margin-left: 16px;
90
- font-size: 12px;
90
+ font-size: 0.75em;
91
91
  line-height: 20px;
92
92
  color: rgba(0, 0, 0, 0.4);
93
93
  }
@@ -103,13 +103,13 @@
103
103
 
104
104
  .weda-upload-file-pc .weda-upload-file-pc--item {
105
105
  display: flex;
106
- font-size: 14px;
106
+ font-size: 0.875em;
107
107
  }
108
108
 
109
109
  .weda-upload-file-pc .weda-upload-file-pc--item-header {
110
110
  border: 1px solid #e7e7e7;
111
- font-size: 14px;
112
- line-height: 22px;
111
+ font-size: 0.875em;
112
+ line-height: 1.375em;
113
113
  color: rgba(0, 0, 0, 0.4);
114
114
  margin-top: 16px;
115
115
  }
@@ -117,8 +117,8 @@
117
117
  .weda-upload-file-pc .weda-upload-file-pc--item-body {
118
118
  border-left: 1px dashed #e7e7e7;
119
119
  border-right: 1px dashed #e7e7e7;
120
- font-size: 14px;
121
- line-height: 22px;
120
+ font-size: 0.875em;
121
+ line-height: 1.375em;
122
122
  color: rgba(0, 0, 0, 0.9);
123
123
  }
124
124
 
@@ -166,7 +166,7 @@
166
166
  border-color: #dcdcdc;
167
167
  color: rgba(0, 0, 0, 0.9);
168
168
  width: 88px;
169
- font-size: 14px;
169
+ font-size: 0.875em;
170
170
  }
171
171
 
172
172
  .weda-upload-file-pc
@@ -187,8 +187,8 @@
187
187
  .weda-upload-file-pc--item
188
188
  .weda-upload-file-pc--item-action
189
189
  .wedatea2td-btn {
190
- font-size: 14px;
191
- line-height: 22px;
190
+ font-size: 0.875em;
191
+ line-height: 1.375em;
192
192
  color: #0052d9;
193
193
  margin-right: 12px;
194
194
  }
@@ -214,9 +214,9 @@
214
214
  .weda-upload-file-pc
215
215
  .weda-upload-file-pc--item-empty
216
216
  .weda-upload-file-pc--item {
217
- font-size: 14px;
217
+ font-size: 0.875em;
218
218
  color: rgba(0, 0, 0, 0.4);
219
- line-height: 22px;
219
+ line-height: 1.375em;
220
220
  }
221
221
 
222
222
  /* ----上传文件---- h5 */
@@ -236,8 +236,8 @@
236
236
  padding: 0 20px 8px 20px;
237
237
  }
238
238
  .weda-upload-file-mobile .weda-upload-file-mobile__title {
239
- font-size: 14px;
240
- line-height: 20px;
239
+ font-size: 0.875em;
240
+ line-height: 1.25em;
241
241
  color: #000;
242
242
  margin-right: 20px;
243
243
  padding-top: 6px;
@@ -246,18 +246,18 @@
246
246
  .weda-upload-file-mobile .weda-upload-file-mobile__btn--weak {
247
247
  width: 88px;
248
248
  padding: 0 16px;
249
- font-size: 14px;
249
+ font-size: 0.875em;
250
250
  color: rgba(0, 0, 0, 0.9);
251
251
  border: 1px solid #dcdcdc;
252
252
  border-radius: 3px;
253
- line-height: 22px;
253
+ line-height: 1.375em;
254
254
  }
255
255
 
256
256
  .weda-upload-file-mobile .weda-upload-file-mobile__tips {
257
257
  display: block;
258
258
  margin-top: 8px;
259
- font-size: 12px;
260
- line-height: 20px;
259
+ font-size: 0.75em;
260
+ line-height: 1.25em;
261
261
  color: rgba(0, 0, 0, 0.4);
262
262
  }
263
263
 
@@ -331,8 +331,8 @@
331
331
  .weda-upload-file-mobile
332
332
  .weda-upload-file-mobile__item
333
333
  .weda-upload-file-mobile__file-name {
334
- font-size: 14px;
335
- line-height: 22px;
334
+ font-size: 0.875em;
335
+ line-height: 1.375em;
336
336
  color: rgba(0, 0, 0, 0.9);
337
337
  max-width: 6.5rem;
338
338
  overflow: hidden;
@@ -373,16 +373,16 @@
373
373
  .weda-upload-file-mobile__file-status--msg {
374
374
  width: 4.2rem;
375
375
  margin-left: 4px;
376
- font-size: 12px;
377
- line-height: 20px;
376
+ font-size: 0.75em;
377
+ line-height: 1.25em;
378
378
  color: rgba(0, 0, 0, 0.9);
379
379
  }
380
380
 
381
381
  .weda-upload-file-mobile
382
382
  .weda-upload-file-mobile__item
383
383
  .weda-upload-file-mobile__file-foot {
384
- font-size: 12px;
385
- line-height: 20px;
384
+ font-size: 0.75em;
385
+ line-height: 1.25em;
386
386
  color: rgba(0, 0, 0, 0.4);
387
387
  margin-top: 8px;
388
388
  display: flex;
@@ -415,6 +415,7 @@
415
415
  }
416
416
  .weda-upload-file-mobile .weui-uploader-mobile__input {
417
417
  position: absolute;
418
+ font-size: 1em;
418
419
  opacity: 0;
419
420
  width: 92px;
420
421
  height: 32px;
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  import * as React from 'react';
3
- import * as PropTypes from 'prop-types';
4
3
  import { usePlatform } from '../../../utils/platform';
5
4
  import { UploadFileH5 as UploaderH5 } from './uploadFile.h5';
6
5
  import { UploadFilePc } from './uploadFile.pc';
@@ -24,7 +23,3 @@ export default function UploaderFile(props) {
24
23
  <UploadFilePc {...props} />
25
24
  );
26
25
  }
27
-
28
- UploaderFile.propTypes = {
29
- showType: PropTypes.string, // 强制展示某个平台 pc | h5
30
- };
@@ -1,20 +1,16 @@
1
1
  import * as React from 'react';
2
- import * as PropTypes from 'prop-types';
3
2
  import weui from '../../../utils/weui';
4
- import { CommonFormPropsType } from '../types';
3
+ import type { CommonFormPropsType } from '../types';
5
4
  import isObjectEqual from '../../../utils/isObjectEqual';
6
5
  import {
7
- Upload,
8
6
  ConfigProvider,
9
7
  Button,
10
- message,
11
8
  Icon,
12
9
  Text,
13
10
  List,
14
11
  Progress,
15
12
  Tooltip,
16
13
  } from 'tea-component';
17
- import { v4 } from 'uuid';
18
14
  import {
19
15
  filterStrList,
20
16
  isCloudFileID,
@@ -22,6 +18,7 @@ import {
22
18
  transSize,
23
19
  downloadFile,
24
20
  transFileCloudidToName,
21
+ randomUuid,
25
22
  } from '../../../utils/platform';
26
23
  import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
27
24
  import classNames from '../../../utils/classnames';
@@ -74,18 +71,26 @@ export function UploadFileH5({
74
71
  onChange = null,
75
72
  isEdit = true,
76
73
  }: IUploadFileH5) {
77
- const [fileIDList, setfileIDList] = React.useState(filterStrList([].concat(defaultValue, value))); // 上传成功文件ID列表,fileID[]
74
+ const [fileIDList, setfileIDList] = React.useState(
75
+ filterStrList([].concat(defaultValue, value))
76
+ ); // 上传成功文件ID列表,fileID[]
78
77
  const [fileList, setFileList] = React.useState([]); // 上传中的文件列表,file[],file为原始文件 + uuid属性
79
78
  const [fileSizeObj, setFileSizeObj] = React.useState({}); // 管理上传文件大小 {uuid:size}
80
- // 两次默认值不同, 需要刷新
81
- const prevDefaultRef = React.useRef<any>([]);
82
- React.useMemo(()=>{
79
+ // 两次默认值不同, 需要刷新
80
+ const prevDefaultRef = React.useRef<any>([]);
81
+ const fileRef = React.useRef(fileIDList);
82
+ React.useMemo(() => {
83
83
  //有有效默认值时不刷新,解决初次渲染默认值不显示问题
84
- if(defaultValue&&!isObjectEqual(prevDefaultRef.current,defaultValue)&&(JSON.stringify(prevDefaultRef.current)=='[]'||!prevDefaultRef.current)){
85
- prevDefaultRef.current =defaultValue;
84
+ if (
85
+ defaultValue &&
86
+ !isObjectEqual(prevDefaultRef.current, defaultValue) &&
87
+ (JSON.stringify(prevDefaultRef.current) == '[]' ||
88
+ !prevDefaultRef.current)
89
+ ) {
90
+ prevDefaultRef.current = defaultValue;
86
91
  setfileIDList(filterStrList([].concat(defaultValue)));
87
92
  }
88
- },[defaultValue]);
93
+ }, [defaultValue]);
89
94
  React.useEffect(() => {
90
95
  // 外部 onChange 事件
91
96
  const pureFileIDList = fileIDList.filter(
@@ -99,7 +104,10 @@ export function UploadFileH5({
99
104
  onChange && onChange(pureFileIDList);
100
105
  events?.change?.({ value: pureFileIDList });
101
106
  }
102
- events?.success?.({ value: pureFileIDList });
107
+ if (!isObjectEqual(fileRef.current, fileIDList)) {
108
+ events?.success?.({ value: pureFileIDList });
109
+ fileRef.current = fileIDList;
110
+ }
103
111
  }, [fileIDList]);
104
112
 
105
113
  // 外层组件类
@@ -202,13 +210,14 @@ export function UploadFileH5({
202
210
  weui.alert(`请上传不超过1024M的文件`);
203
211
  return false;
204
212
  }
205
- fileList.forEach((f) => (f['_uuid'] = v4()));
213
+ fileList.forEach((f) => (f['_uuid'] = randomUuid()));
206
214
  setFileList((list) => [...list, ...fileList]);
207
215
  }}
208
216
  />
209
217
  <a
210
218
  type="weak"
211
219
  className="wedatea2td-btn wedatea2td-btn--weak"
220
+ style={{ fontSize: '1em' }}
212
221
  >
213
222
  点击上传
214
223
  </a>
@@ -377,7 +386,7 @@ const TcbFileUpload = ({
377
386
  try {
378
387
  setStatus('UPLOAD_STATUS_PENDING');
379
388
  const { fileID } = await tcb.uploadFile({
380
- cloudPath: `${uploadPath}/${uuid.replaceAll('-', '')}-${file?.name}`,
389
+ cloudPath: `${uploadPath}/${randomUuid()}-${file?.name}`,
381
390
  filePath: file,
382
391
  onUploadProgress: (progressEvent) => {
383
392
  let percent = 0;
@@ -8,7 +8,6 @@ import {
8
8
  Text,
9
9
  List,
10
10
  } from 'tea-component';
11
- import { v4 } from 'uuid';
12
11
  import {
13
12
  filterStrList,
14
13
  isCloudFileID,
@@ -17,11 +16,12 @@ import {
17
16
  downloadFile,
18
17
  cutFileTitle,
19
18
  transFileCloudidToName,
19
+ randomUuid,
20
20
  } from '../../../utils/platform';
21
21
  import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
22
22
  import classNames from '../../../utils/classnames';
23
23
  import { renderDecorator } from '../renderDecorator';
24
- import { CommonFormPropsType } from '../types';
24
+ import type { CommonFormPropsType } from '../types';
25
25
  import isObjectEqual from '../../../utils/isObjectEqual';
26
26
 
27
27
  // 默认组件类前缀
@@ -68,20 +68,26 @@ export function UploadFilePc({
68
68
  onChange = null,
69
69
  isEdit = true,
70
70
  }: IUploaderFilePc) {
71
-
72
-
73
- const [fileIDList, setfileIDList] = React.useState(filterStrList([].concat(defaultValue, value))); // 上传成功文件ID列表,fileID[]
71
+ const [fileIDList, setfileIDList] = React.useState(
72
+ filterStrList([].concat(defaultValue, value))
73
+ ); // 上传成功文件ID列表,fileID[]
74
74
  const [fileList, setFileList] = React.useState([]); // 上传中的文件列表,file[],file为原始文件 + uuid属性
75
75
  const [fileSizeObj, setFileSizeObj] = React.useState({}); // 管理上传文件大小 {uuid:size}
76
- // 两次默认值不同, 需要刷新
76
+ // 两次默认值不同, 需要刷新
77
77
  const prevDefaultRef = React.useRef<any>([]);
78
- React.useMemo(()=>{
78
+ const fileRef = React.useRef(fileIDList);
79
+ React.useMemo(() => {
79
80
  //有有效默认值时不刷新,解决初次渲染默认值不显示问题
80
- if(defaultValue&&!isObjectEqual(prevDefaultRef.current,defaultValue)&&(JSON.stringify(prevDefaultRef.current)=='[]'||!prevDefaultRef.current)){
81
- prevDefaultRef.current =defaultValue;
81
+ if (
82
+ defaultValue &&
83
+ !isObjectEqual(prevDefaultRef.current, defaultValue) &&
84
+ (JSON.stringify(prevDefaultRef.current) == '[]' ||
85
+ !prevDefaultRef.current)
86
+ ) {
87
+ prevDefaultRef.current = defaultValue;
82
88
  setfileIDList(filterStrList([].concat(defaultValue)));
83
89
  }
84
- },[defaultValue]);
90
+ }, [defaultValue]);
85
91
  React.useEffect(() => {
86
92
  // 外部 onChange 事件
87
93
  const pureFileIDList = fileIDList.filter(
@@ -91,11 +97,13 @@ export function UploadFilePc({
91
97
  const file = pureFileIDList[0] || '';
92
98
  onChange?.(file);
93
99
  events?.change?.({ value: file });
94
- events?.success?.({ value: file });
95
100
  } else {
96
101
  onChange?.(pureFileIDList);
97
102
  events?.change?.({ value: pureFileIDList });
103
+ }
104
+ if (!isObjectEqual(fileRef.current, fileIDList)) {
98
105
  events?.success?.({ value: pureFileIDList });
106
+ fileRef.current = fileIDList;
99
107
  }
100
108
  }, [fileIDList]);
101
109
  // 外层组件类
@@ -123,7 +131,7 @@ export function UploadFilePc({
123
131
  } catch (e) {}
124
132
  return false;
125
133
  }
126
- file['_uuid'] = v4();
134
+ file['_uuid'] = randomUuid();
127
135
  setFileList((list) => [...list, file]);
128
136
  return false;
129
137
  };
@@ -347,7 +355,7 @@ const TcbFileUpload = ({ file }: ITcbFileUpload) => {
347
355
  try {
348
356
  setStatus('0');
349
357
  const { fileID } = await tcb.uploadFile({
350
- cloudPath: `${uploadPath}/${uuid.replaceAll('-', '')}-${file?.name}`,
358
+ cloudPath: `${uploadPath}/${randomUuid()}-${file?.name}`,
351
359
  filePath: file,
352
360
  onUploadProgress: (progressEvent) => {
353
361
  let percent = 0;