@cloudbase/weda-ui 2.0.9 → 2.0.12

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 (235) hide show
  1. package/README.md +1 -0
  2. package/package.json +13 -5
  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 +6 -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 +43 -44
  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 +66 -67
  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 +86 -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/docs/common/format.tsx +4 -1
  40. package/src/docs/common/tableView.css +3 -3
  41. package/src/docs/common/tableView.tsx +18 -8
  42. package/src/docs/compsdocs/form/FormLocation.mdx +1 -1
  43. package/src/docs/compsdocs/form/FormSelect.mdx +0 -1
  44. package/src/docs/compsdocs/grid/Card.mdx +0 -1
  45. package/src/docs/compsdocs/grid/Container.mdx +0 -1
  46. package/src/docs/compsdocs/grid/GridLayout.mdx +0 -1
  47. package/src/docs/compsdocs/grid/ScrollView.mdx +2 -2
  48. package/src/docs/compsdocs/grid/Swiper.mdx +1 -2
  49. package/src/docs/compsdocs/media/Icon.mdx +1 -1
  50. package/src/docs/compsdocs/media/Image.mdx +6 -6
  51. package/src/docs/compsdocs/model/ModelCreate.mdx +24 -0
  52. package/src/docs/compsdocs/model/ModelDetail.mdx +24 -0
  53. package/src/docs/compsdocs/model/ModelTable.mdx +133 -1
  54. package/src/docs/compsdocs/model/ModelUpdate.mdx +24 -1
  55. package/src/docs/compsdocs/navmenu/Classification.mdx +2 -3
  56. package/src/docs/compsdocs/navmenu/NavBar.mdx +14 -5
  57. package/src/docs/compsdocs/navmenu/NavLayout.mdx +0 -1
  58. package/src/docs/compsdocs/navmenu/TabBar.mdx +3 -3
  59. package/src/docs/compsdocs/navmenu/TabBarItem.mdx +1 -1
  60. package/src/docs/compsdocs/senior/Lottery.mdx +3 -6
  61. package/src/docs/compsdocs/senior/Modal.mdx +2 -3
  62. package/src/docs/compsdocs/senior/SlotMachine.mdx +2 -5
  63. package/src/docs/compsdocs/senior/_category_.json +1 -1
  64. package/src/docs/compsdocs/show/GraphicCard.mdx +0 -1
  65. package/src/docs/compsdocs/show/Item.mdx +0 -1
  66. package/src/docs/compsdocs/show/ItemList.mdx +1 -0
  67. package/src/docs/compsdocs/show/Tabs.mdx +2 -3
  68. package/src/docs/compsdocs/text/Link.mdx +1 -1
  69. package/src/docs/compsdocs/text/RichTextView.mdx +1 -2
  70. package/src/docs/compsdocs/text/Text.mdx +1 -1
  71. package/src/docs/compsdocs/text/Title.mdx +1 -2
  72. package/src/docs/compsdocs/wxOpen/Phone.mdx +1 -2
  73. package/src/docs/compsdocs/wxOpen/Share.mdx +0 -1
  74. package/src/docs/compsdocs/wxOpen/UserInfo.mdx +1 -2
  75. package/src/mp/components/button/index.js +1 -1
  76. package/src/mp/components/button/index.wxml +19 -19
  77. package/src/mp/components/calendar/index.js +64 -37
  78. package/src/mp/components/calendar/index.json +1 -1
  79. package/src/mp/components/calendar/index.wxml +4 -6
  80. package/src/mp/components/carousel/index.json +1 -1
  81. package/src/mp/components/carousel/index.wxml +2 -2
  82. package/src/mp/components/chart/bar/index.js +1 -2
  83. package/src/mp/components/chart/bar/index.wxml +1 -1
  84. package/src/mp/components/chart/common/config/bar.js +1 -1
  85. package/src/mp/components/chart/common/core/eChartBar.js +29 -34
  86. package/src/mp/components/chart/common/core/eChartBase.js +46 -32
  87. package/src/mp/components/chart/common/core/eChartLine.js +34 -40
  88. package/src/mp/components/chart/common/core/eChartPie.js +12 -9
  89. package/src/mp/components/chart/ec-canvas/ec-canvas.json +1 -1
  90. package/src/mp/components/chart/ec-canvas/wx-canvas.js +24 -22
  91. package/src/mp/components/chart/line/index.js +2 -2
  92. package/src/mp/components/chart/line/index.wxml +1 -1
  93. package/src/mp/components/chart/pie/index.js +1 -1
  94. package/src/mp/components/chart/pie/index.wxml +1 -2
  95. package/src/mp/components/dataView/index.wxml +2 -14
  96. package/src/mp/components/form/checkbox/index.js +10 -6
  97. package/src/mp/components/form/checkbox/index.wxml +13 -25
  98. package/src/mp/components/form/form/index.wxml +3 -3
  99. package/src/mp/components/form/formcell/index.wxml +9 -9
  100. package/src/mp/components/form/formcell/index.wxss +6 -1
  101. package/src/mp/components/form/input/index.js +3 -3
  102. package/src/mp/components/form/input/index.wxml +24 -31
  103. package/src/mp/components/form/input/index.wxss +9 -3
  104. package/src/mp/components/form/location/components/mapChoose/index.json +1 -1
  105. package/src/mp/components/form/location/components/mapChoose/index.wxml +6 -6
  106. package/src/mp/components/form/location/index.js +7 -1
  107. package/src/mp/components/form/location/index.json +1 -1
  108. package/src/mp/components/form/location/index.wxml +6 -10
  109. package/src/mp/components/form/radio/index.js +9 -5
  110. package/src/mp/components/form/radio/index.wxml +12 -24
  111. package/src/mp/components/form/select/index.js +156 -97
  112. package/src/mp/components/form/select/index.wxml +11 -39
  113. package/src/mp/components/form/select/index.wxss +14 -3
  114. package/src/mp/components/form/select/region/index.js +18 -12
  115. package/src/mp/components/form/switch/index.wxml +11 -18
  116. package/src/mp/components/form/textarea/index.wxml +2 -17
  117. package/src/mp/components/form/textarea/index.wxss +5 -0
  118. package/src/mp/components/form/tips/index.wxml +1 -3
  119. package/src/mp/components/form/uploader/index.js +1 -1
  120. package/src/mp/components/form/uploader/index.wxml +3 -20
  121. package/src/mp/components/form/uploader/weui-uploader.js +210 -200
  122. package/src/mp/components/form/uploader/weui-uploader.json +6 -6
  123. package/src/mp/components/form/uploader/weui-uploader.wxml +38 -38
  124. package/src/mp/components/form/uploaderFile/index.js +5 -4
  125. package/src/mp/components/form/uploaderFile/index.wxml +40 -41
  126. package/src/mp/components/graphicCard/index.js +35 -35
  127. package/src/mp/components/graphicCard/index.wxml +2 -6
  128. package/src/mp/components/image/index.wxml +9 -20
  129. package/src/mp/components/image/index.wxss +3 -1
  130. package/src/mp/components/listView/index.wxml +5 -7
  131. package/src/mp/components/lottery/index.wxml +1 -3
  132. package/src/mp/components/lottery/index.wxss +31 -25
  133. package/src/mp/components/navLayout/index.js +9 -12
  134. package/src/mp/components/navLayout/index.wxml +2 -4
  135. package/src/mp/components/navigationBar/index.json +1 -2
  136. package/src/mp/components/navigationBar/index.wxml +43 -51
  137. package/src/mp/components/swiper/index.wxml +1 -9
  138. package/src/mp/components/tabs/index.js +14 -10
  139. package/src/mp/components/tabs/index.json +1 -1
  140. package/src/mp/components/tabs/index.wxml +3 -21
  141. package/src/mp/components/text/index.wxml +1 -6
  142. package/src/mp/components/text/index.wxss +1 -1
  143. package/src/mp/components/wedaVideo/index.js +86 -0
  144. package/src/mp/components/wedaVideo/index.json +4 -0
  145. package/src/mp/components/wedaVideo/index.wxml +4 -0
  146. package/src/mp/components/wedaVideo/index.wxss +20 -0
  147. package/src/mp/components/wxOpenApi/phone/index.js +1 -9
  148. package/src/mp/components/wxOpenApi/phone/index.wxml +3 -14
  149. package/src/mp/components/wxOpenApi/phoneCode/index.json +1 -1
  150. package/src/mp/components/wxOpenApi/phoneCode/index.wxml +3 -14
  151. package/src/mp/components/wxOpenApi/share/index.wxml +3 -14
  152. package/src/mp/components/wxOpenApi/userInfo/index.wxml +3 -13
  153. package/src/mp/index.json +1 -0
  154. package/src/mp/style/weda-ui.wxss +20 -7
  155. package/src/mp/utils/deepEqual.js +37 -37
  156. package/src/mp/utils/destr.js +41 -40
  157. package/src/mp/utils/dr_square_point.js +10 -6
  158. package/src/setupTests.js +13 -13
  159. package/src/web/actions/showModal/index.tsx +5 -4
  160. package/src/web/components/button/index.tsx +44 -40
  161. package/src/web/components/calendar/index.css +81 -34
  162. package/src/web/components/carousel/index.tsx +1 -1
  163. package/src/web/components/chart/common/config/bar.js +1 -1
  164. package/src/web/components/chart/common/core/eChartBar.js +28 -34
  165. package/src/web/components/chart/common/core/eChartBase.ts +55 -42
  166. package/src/web/components/chart/common/core/eChartLine.js +34 -40
  167. package/src/web/components/chart/common/core/eChartPie.js +12 -9
  168. package/src/web/components/chart/common/core/type.ts +23 -23
  169. package/src/web/components/chart/common/echart.css +12 -12
  170. package/src/web/components/chart/common/echarts.ts +3 -5
  171. package/src/web/components/chart/common/useChart.tsx +34 -16
  172. package/src/web/components/container/index.tsx +3 -4
  173. package/src/web/components/drawer/index.tsx +15 -4
  174. package/src/web/components/form/checkbox/index.tsx +32 -31
  175. package/src/web/components/form/enumSelect/NormalSelect.tsx +0 -2
  176. package/src/web/components/form/form/index.css +3 -6
  177. package/src/web/components/form/form/index.tsx +7 -6
  178. package/src/web/components/form/formcell/index.css +10 -4
  179. package/src/web/components/form/formcell/index.tsx +3 -7
  180. package/src/web/components/form/input/index.css +4 -4
  181. package/src/web/components/form/input/index.tsx +61 -53
  182. package/src/web/components/form/location/common/selectModal.jsx +2 -11
  183. package/src/web/components/form/location/common/useLocationInfo.js +4 -0
  184. package/src/web/components/form/location/components/LocationH5/index.css +0 -1
  185. package/src/web/components/form/location/components/LocationH5/location.h5.jsx +11 -1
  186. package/src/web/components/form/location/components/LocationPC/Header.jsx +0 -13
  187. package/src/web/components/form/location/components/LocationPC/location.PC.jsx +14 -5
  188. package/src/web/components/form/radio/index.tsx +32 -26
  189. package/src/web/components/form/renderDecorator.tsx +23 -26
  190. package/src/web/components/form/select/h5.tsx +154 -103
  191. package/src/web/components/form/select/index.css +9 -3
  192. package/src/web/components/form/select/index.tsx +75 -48
  193. package/src/web/components/form/select/region/index.ts +101 -80
  194. package/src/web/components/form/select/year.tsx +2 -0
  195. package/src/web/components/form/switch/index.tsx +40 -40
  196. package/src/web/components/form/textarea/index.css +4 -0
  197. package/src/web/components/form/textarea/index.tsx +27 -26
  198. package/src/web/components/form/types.d.ts +10 -10
  199. package/src/web/components/form/uploader/uploader.h5.tsx +26 -20
  200. package/src/web/components/form/uploaderFile/index.jsx +0 -5
  201. package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +15 -11
  202. package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +14 -9
  203. package/src/web/components/image/image.tsx +2 -2
  204. package/src/web/components/image/index.css +9 -7
  205. package/src/web/components/image/index.tsx +29 -12
  206. package/src/web/components/index.js +1 -0
  207. package/src/web/components/link/index.tsx +13 -13
  208. package/src/web/components/lottery/index.css +43 -37
  209. package/src/web/components/lottery/index.tsx +2 -2
  210. package/src/web/components/modal/index.tsx +34 -34
  211. package/src/web/components/navLayout/index.tsx +1 -1
  212. package/src/web/components/navigationBar/index.tsx +2 -2
  213. package/src/web/components/picker/datePicker.tsx +3 -3
  214. package/src/web/components/picker/picker.tsx +3 -3
  215. package/src/web/components/picker/timePicker.tsx +1 -1
  216. package/src/web/components/richText/index.jsx +41 -46
  217. package/src/web/components/richTextView/index.tsx +4 -6
  218. package/src/web/components/scrollView/index.tsx +2 -2
  219. package/src/web/components/slot/index.tsx +3 -4
  220. package/src/web/components/swiper/index.css +1 -1
  221. package/src/web/components/swiper/index.tsx +33 -15
  222. package/src/web/components/tabs/index.css +1 -1
  223. package/src/web/components/tabs/index.tsx +6 -6
  224. package/src/web/components/tabs/tabs.h5.tsx +17 -12
  225. package/src/web/components/tabs/tabs.pc.tsx +45 -34
  226. package/src/web/components/text/index.css +1 -1
  227. package/src/web/components/text/index.tsx +13 -14
  228. package/src/web/components/wedaVideo/index.css +42 -0
  229. package/src/web/components/wedaVideo/index.tsx +198 -0
  230. package/src/web/utils/constant.ts +2 -1
  231. package/src/web/utils/isObjectEqual.js +2 -1
  232. package/src/web/utils/loading-fallback.tsx +2 -2
  233. package/src/web/utils/lodash.ts +1 -1
  234. package/src/web/utils/useSetState.ts +6 -2
  235. package/src/web/weda-ui.css +17 -0
@@ -6,7 +6,7 @@ import { ConfigProvider, Input } from 'tea-component';
6
6
  import { usePlatform } from '../../../utils/platform';
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 Textarea({
12
12
  // 系统属性
@@ -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;
@@ -53,7 +53,7 @@ export default function Textarea({
53
53
  };
54
54
 
55
55
  let textAreaElement;
56
- if(platform === 'h5') {
56
+ if (platform === 'h5') {
57
57
  textAreaElement = (
58
58
  <div className={subCls}>
59
59
  <div className="weui-cell__bd">
@@ -77,32 +77,33 @@ export default function Textarea({
77
77
  } else {
78
78
  textAreaElement = (
79
79
  <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>
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
90
  </ConfigProvider>
91
91
  );
92
92
  }
93
93
 
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
- );
94
+ return renderDecorator(
95
+ textAreaElement,
96
+ decorator
97
+ )({
98
+ id,
99
+ className: cls,
100
+ style,
101
+ label: labelVisible ? label : null,
102
+ layout,
103
+ multiCell: false,
104
+ requiredFlag,
105
+ size,
106
+ });
106
107
  }
107
108
  export interface PropsType extends CommonFormPropsType {
108
109
  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
+ }
@@ -6,7 +6,7 @@ import isObjectEqual from '../../../utils/isObjectEqual';
6
6
  import { useSyncValue } from '../../../utils/useSyncValue';
7
7
  import { isCloudFileID } from '../../../utils/platform';
8
8
  import { IMAGE_TYPES } from './uploader.pc';
9
- import { CommonFormPropsType } from '../types';
9
+ import type { CommonFormPropsType } from '../types';
10
10
  import { v4 } from 'uuid';
11
11
 
12
12
  const uploadPath = 'weda-uploader';
@@ -122,7 +122,7 @@ export function ImageUploaderH5({
122
122
  }, [acceptTypes]);
123
123
 
124
124
  const showAdd = React.useMemo(() => {
125
- if(single) {
125
+ if (single) {
126
126
  // single 模式时,仅当数组为空时显示
127
127
  return fileIdList.length < 1;
128
128
  }
@@ -132,7 +132,13 @@ export function ImageUploaderH5({
132
132
  <div className={cls} id={id} style={style}>
133
133
  <div className={classNames('weui-uploader', layout)}>
134
134
  <div className={classNames('weui-uploader__hd', layout)}>
135
- <UploaderLabel layout={layout} title={title} currentCount={fileIdList.length} maxCount={finalMaxImgCount} requiredFlag={requiredFlag} />
135
+ <UploaderLabel
136
+ layout={layout}
137
+ title={title}
138
+ currentCount={fileIdList.length}
139
+ maxCount={finalMaxImgCount}
140
+ requiredFlag={requiredFlag}
141
+ />
136
142
  </div>
137
143
 
138
144
  <div className="weui-uploader__bd">
@@ -142,9 +148,7 @@ export function ImageUploaderH5({
142
148
  ))}
143
149
  {uploading && (
144
150
  <li className="weui-uploader__file weui-uploader__file_status">
145
- <div className="weui-uploader__file-content">
146
- {progress}%
147
- </div>
151
+ <div className="weui-uploader__file-content">{progress}%</div>
148
152
  </li>
149
153
  )}
150
154
  </ul>
@@ -251,11 +255,17 @@ export interface H5UploaderProps extends CommonFormPropsType {
251
255
  onChange?: (v: any) => void;
252
256
  }
253
257
 
254
- const UploaderLabel = ({layout, title, currentCount, maxCount, requiredFlag}) => {
255
- if(layout === 'horizontal') {
258
+ const UploaderLabel = ({
259
+ layout,
260
+ title,
261
+ currentCount,
262
+ maxCount,
263
+ requiredFlag,
264
+ }) => {
265
+ if (layout === 'horizontal') {
256
266
  return (
257
267
  <React.Fragment>
258
- <div className='weda-formcells__label weui-cell'>
268
+ <div className="weda-formcells__label weui-cell">
259
269
  <div>
260
270
  <p className="weui-uploader__title">{title}</p>
261
271
  <div className="weui-uploader__info">
@@ -263,25 +273,21 @@ const UploaderLabel = ({layout, title, currentCount, maxCount, requiredFlag}) =>
263
273
  {`/${maxCount}`}
264
274
  </div>
265
275
  </div>
266
- {requiredFlag && (
267
- <label className="weda-formcells__flag">*</label>
268
- )}
276
+ {requiredFlag && <label className="weda-formcells__flag">*</label>}
269
277
  </div>
270
278
  </React.Fragment>
271
- )
279
+ );
272
280
  }
273
281
  return (
274
- <div className='weda-formcells__label weui-cell'>
275
- <div className='weui-uploader__label'>
282
+ <div className="weda-formcells__label weui-cell">
283
+ <div className="weui-uploader__label">
276
284
  <p className="weui-uploader__title">{title}</p>
277
- {requiredFlag && (
278
- <label className="weda-formcells__flag">*</label>
279
- )}
285
+ {requiredFlag && <label className="weda-formcells__flag">*</label>}
280
286
  </div>
281
287
  <div className="weui-uploader__info">
282
288
  <span id="uploadCount">{currentCount}</span>
283
289
  {`/${maxCount}`}
284
290
  </div>
285
291
  </div>
286
- )
287
- }
292
+ );
293
+ };
@@ -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,13 +1,10 @@
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,
@@ -74,18 +71,25 @@ 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
+ React.useMemo(() => {
83
82
  //有有效默认值时不刷新,解决初次渲染默认值不显示问题
84
- if(defaultValue&&!isObjectEqual(prevDefaultRef.current,defaultValue)&&(JSON.stringify(prevDefaultRef.current)=='[]'||!prevDefaultRef.current)){
85
- prevDefaultRef.current =defaultValue;
83
+ if (
84
+ defaultValue &&
85
+ !isObjectEqual(prevDefaultRef.current, defaultValue) &&
86
+ (JSON.stringify(prevDefaultRef.current) == '[]' ||
87
+ !prevDefaultRef.current)
88
+ ) {
89
+ prevDefaultRef.current = defaultValue;
86
90
  setfileIDList(filterStrList([].concat(defaultValue)));
87
91
  }
88
- },[defaultValue]);
92
+ }, [defaultValue]);
89
93
  React.useEffect(() => {
90
94
  // 外部 onChange 事件
91
95
  const pureFileIDList = fileIDList.filter(
@@ -21,7 +21,7 @@ import {
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,25 @@ 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
+ React.useMemo(() => {
79
79
  //有有效默认值时不刷新,解决初次渲染默认值不显示问题
80
- if(defaultValue&&!isObjectEqual(prevDefaultRef.current,defaultValue)&&(JSON.stringify(prevDefaultRef.current)=='[]'||!prevDefaultRef.current)){
81
- prevDefaultRef.current =defaultValue;
80
+ if (
81
+ defaultValue &&
82
+ !isObjectEqual(prevDefaultRef.current, defaultValue) &&
83
+ (JSON.stringify(prevDefaultRef.current) == '[]' ||
84
+ !prevDefaultRef.current)
85
+ ) {
86
+ prevDefaultRef.current = defaultValue;
82
87
  setfileIDList(filterStrList([].concat(defaultValue)));
83
88
  }
84
- },[defaultValue]);
89
+ }, [defaultValue]);
85
90
  React.useEffect(() => {
86
91
  // 外部 onChange 事件
87
92
  const pureFileIDList = fileIDList.filter(
@@ -109,7 +109,7 @@ export function ImageInner({
109
109
  const windowHeight = window.innerHeight;
110
110
  const windowWidth = window.innerWidth;
111
111
  let ratio = realWidth.current / realHeight.current;
112
- if(Number.isNaN(ratio)) {
112
+ if (Number.isNaN(ratio)) {
113
113
  ratio = 1;
114
114
  }
115
115
  const height = windowWidth / ratio;
@@ -184,4 +184,4 @@ export function ImageInner({
184
184
  </ConfigProvider>
185
185
  );
186
186
  }
187
- }
187
+ }
@@ -42,11 +42,13 @@
42
42
  }
43
43
  .weda-image:not([src]):before,
44
44
  .weda-image-error::before {
45
- content: '';
46
- background: #f5f5f5 url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJNMjUuMzIgMTYuMzU5N0MyNi4wNzY0IDE2LjM1OTcgMjYuODI1NCAxNi41MDg3IDI3LjUyNDMgMTYuNzk4MUMyOC4yMjMxIDE3LjA4NzYgMjguODU4MSAxNy41MTE5IDI5LjM5MjkgMTguMDQ2OEMyOS45Mjc4IDE4LjU4MTYgMzAuMzUyMSAxOS4yMTY2IDMwLjY0MTYgMTkuOTE1NEMzMC45MzEgMjAuNjE0MyAzMS4wOCAyMS4zNjMzIDMxLjA4IDIyLjExOTdDMzEuMDggMjIuODc2MSAzMC45MzEgMjMuNjI1MSAzMC42NDE2IDI0LjMyMzlDMzAuMzUyMSAyNS4wMjI4IDI5LjkyNzggMjUuNjU3OCAyOS4zOTI5IDI2LjE5MjZDMjguODU4MSAyNi43Mjc1IDI4LjIyMzEgMjcuMTUxOCAyNy41MjQzIDI3LjQ0MTJDMjYuODI1NCAyNy43MzA3IDI2LjA3NjQgMjcuODc5NyAyNS4zMiAyNy44Nzk3QzIzLjc5MjQgMjcuODc5NyAyMi4zMjczIDI3LjI3MjggMjEuMjQ3MSAyNi4xOTI2QzIwLjE2NjkgMjUuMTEyNCAxOS41NiAyMy42NDczIDE5LjU2IDIyLjExOTdDMTkuNTYgMjAuNTkyIDIwLjE2NjkgMTkuMTI3IDIxLjI0NzEgMTguMDQ2OEMyMi4zMjczIDE2Ljk2NjUgMjMuNzkyNCAxNi4zNTk3IDI1LjMyIDE2LjM1OTdaTTI4IDMuNTU5NjlWMTQuODc2OEMyNy4xNzc3IDE0LjU4NjYgMjYuMTkyIDE0LjQzODggMjUuMzIgMTQuNDM5N0MyNC4wMzEgMTQuNDM5NyAyMi44MTU3IDE0Ljc1NzEgMjEuNzQ4OCAxNS4zMTg0TDIwLjc5NTIgMTMuMTU5N0wxNi4wMjU5IDIwLjAyNzVMOC40NDU3NiAxNi40NDFMMy41NiAyMy4zOTk3SDE3Ljc0NjJDMTcuOTg2NyAyNC44MjkgMTguNjI4MiAyNi4xNjA2IDE5LjU5NTggMjcuMjM5N0gxVjMuNTU5NjlIMjhaTTI1Ljk2IDI0LjAzOTdIMjQuNjhWMjUuMzE5N0gyNS45NlYyNC4wMzk3Wk0yNS45NiAxOC45MTk3SDI0LjY4VjIzLjM5OTdIMjUuOTZWMTguOTE5N1pNNi4xMiAxMC41OTk3QzYuMTIgMTEuOTk4MSA3LjE5OTA0IDEzLjEwODUgOC42MDc2OCAxMy4xNTg0QzEwLjAyMDggMTMuMjA3NyAxMS4yNCAxMi4wNDggMTEuMjQgMTAuNTk5N0MxMS4yNCA5LjI0NjA5IDEwLjA2NDMgOC4wODU3NyA4Ljc1MjMyIDguMDQwOTdDNy4yOTU2OCA3Ljk5MTY5IDYuMTIgOS4xNTEzNyA2LjEyIDEwLjU5OTdaIiBmaWxsPSIjQkNDNEQwIj48L3BhdGg+Cjwvc3ZnPgo=') no-repeat center / 50% 50%;
47
- position: absolute;
48
- left: 0;
49
- top: 0;
50
- width: 100%;
51
- height: 100%;
45
+ content: '';
46
+ background: #f5f5f5
47
+ url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJNMjUuMzIgMTYuMzU5N0MyNi4wNzY0IDE2LjM1OTcgMjYuODI1NCAxNi41MDg3IDI3LjUyNDMgMTYuNzk4MUMyOC4yMjMxIDE3LjA4NzYgMjguODU4MSAxNy41MTE5IDI5LjM5MjkgMTguMDQ2OEMyOS45Mjc4IDE4LjU4MTYgMzAuMzUyMSAxOS4yMTY2IDMwLjY0MTYgMTkuOTE1NEMzMC45MzEgMjAuNjE0MyAzMS4wOCAyMS4zNjMzIDMxLjA4IDIyLjExOTdDMzEuMDggMjIuODc2MSAzMC45MzEgMjMuNjI1MSAzMC42NDE2IDI0LjMyMzlDMzAuMzUyMSAyNS4wMjI4IDI5LjkyNzggMjUuNjU3OCAyOS4zOTI5IDI2LjE5MjZDMjguODU4MSAyNi43Mjc1IDI4LjIyMzEgMjcuMTUxOCAyNy41MjQzIDI3LjQ0MTJDMjYuODI1NCAyNy43MzA3IDI2LjA3NjQgMjcuODc5NyAyNS4zMiAyNy44Nzk3QzIzLjc5MjQgMjcuODc5NyAyMi4zMjczIDI3LjI3MjggMjEuMjQ3MSAyNi4xOTI2QzIwLjE2NjkgMjUuMTEyNCAxOS41NiAyMy42NDczIDE5LjU2IDIyLjExOTdDMTkuNTYgMjAuNTkyIDIwLjE2NjkgMTkuMTI3IDIxLjI0NzEgMTguMDQ2OEMyMi4zMjczIDE2Ljk2NjUgMjMuNzkyNCAxNi4zNTk3IDI1LjMyIDE2LjM1OTdaTTI4IDMuNTU5NjlWMTQuODc2OEMyNy4xNzc3IDE0LjU4NjYgMjYuMTkyIDE0LjQzODggMjUuMzIgMTQuNDM5N0MyNC4wMzEgMTQuNDM5NyAyMi44MTU3IDE0Ljc1NzEgMjEuNzQ4OCAxNS4zMTg0TDIwLjc5NTIgMTMuMTU5N0wxNi4wMjU5IDIwLjAyNzVMOC40NDU3NiAxNi40NDFMMy41NiAyMy4zOTk3SDE3Ljc0NjJDMTcuOTg2NyAyNC44MjkgMTguNjI4MiAyNi4xNjA2IDE5LjU5NTggMjcuMjM5N0gxVjMuNTU5NjlIMjhaTTI1Ljk2IDI0LjAzOTdIMjQuNjhWMjUuMzE5N0gyNS45NlYyNC4wMzk3Wk0yNS45NiAxOC45MTk3SDI0LjY4VjIzLjM5OTdIMjUuOTZWMTguOTE5N1pNNi4xMiAxMC41OTk3QzYuMTIgMTEuOTk4MSA3LjE5OTA0IDEzLjEwODUgOC42MDc2OCAxMy4xNTg0QzEwLjAyMDggMTMuMjA3NyAxMS4yNCAxMi4wNDggMTEuMjQgMTAuNTk5N0MxMS4yNCA5LjI0NjA5IDEwLjA2NDMgOC4wODU3NyA4Ljc1MjMyIDguMDQwOTdDNy4yOTU2OCA3Ljk5MTY5IDYuMTIgOS4xNTEzNyA2LjEyIDEwLjU5OTdaIiBmaWxsPSIjQkNDNEQwIj48L3BhdGg+Cjwvc3ZnPgo=')
48
+ no-repeat center / 50% 50%;
49
+ position: absolute;
50
+ left: 0;
51
+ top: 0;
52
+ width: 100%;
53
+ height: 100%;
52
54
  }
@@ -4,17 +4,33 @@ import { useState, useEffect } from 'react';
4
4
  import classNames from '../../utils/classnames';
5
5
  import './index.css';
6
6
  import { ImageInner } from './image';
7
- import { CommonPropsType } from '../../types';
7
+ import type { CommonPropsType } from '../../types';
8
8
 
9
-
10
- const defaultSrc = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSI0MCIgY3k9IjQwIiByPSI0MCIgZmlsbD0iI0VCRUZGNSIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yMCA1NlYyNGg0MHYzMnoiLz48cGF0aCBmaWxsPSIjQzFDQ0REIiBkPSJNMjYgMzdoMjh2MkgyNnptMCA3aDIwdjJIMjZ6bS02LTIwaDQwdjdIMjB6Ii8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNDggNDQpIj48Y2lyY2xlIGZpbGw9IiNGRkYiIGN4PSIxMCIgY3k9IjEwIiByPSI3Ii8+PHBhdGggZD0iTTEwIDJhOCA4IDAgMSAxIDAgMTYgOCA4IDAgMCAxIDAtMTZ6bTEgMTBIOXYyaDJ2LTJ6bTAtNkg5djVoMlY2eiIgZmlsbD0iIzAwNkVGRiIvPjwvZz48L2c+PC9zdmc+';
11
- type TMode = 'scaleToFill' | 'aspectFit' | 'aspectFill' | 'widthFix' | 'heightFix' | 'top' | 'bottom' | 'center' | 'left' | 'right' | 'top left' | 'top right' | 'bottom left' | 'bottom right';
12
- export interface PropsType extends CommonPropsType, Pick<HTMLImageElement, 'src'|'alt'> {
13
- mode: TMode,
14
- lazyLoad: boolean,
15
- maskClosable: boolean,
16
- imgPreview: boolean,
17
- fit: React.CSSProperties['objectFit']
9
+ const defaultSrc =
10
+ 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSI0MCIgY3k9IjQwIiByPSI0MCIgZmlsbD0iI0VCRUZGNSIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yMCA1NlYyNGg0MHYzMnoiLz48cGF0aCBmaWxsPSIjQzFDQ0REIiBkPSJNMjYgMzdoMjh2MkgyNnptMCA3aDIwdjJIMjZ6bS02LTIwaDQwdjdIMjB6Ii8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNDggNDQpIj48Y2lyY2xlIGZpbGw9IiNGRkYiIGN4PSIxMCIgY3k9IjEwIiByPSI3Ii8+PHBhdGggZD0iTTEwIDJhOCA4IDAgMSAxIDAgMTYgOCA4IDAgMCAxIDAtMTZ6bTEgMTBIOXYyaDJ2LTJ6bTAtNkg5djVoMlY2eiIgZmlsbD0iIzAwNkVGRiIvPjwvZz48L2c+PC9zdmc+';
11
+ type TMode =
12
+ | 'scaleToFill'
13
+ | 'aspectFit'
14
+ | 'aspectFill'
15
+ | 'widthFix'
16
+ | 'heightFix'
17
+ | 'top'
18
+ | 'bottom'
19
+ | 'center'
20
+ | 'left'
21
+ | 'right'
22
+ | 'top left'
23
+ | 'top right'
24
+ | 'bottom left'
25
+ | 'bottom right';
26
+ export interface PropsType
27
+ extends CommonPropsType,
28
+ Pick<HTMLImageElement, 'src' | 'alt'> {
29
+ mode: TMode;
30
+ lazyLoad: boolean;
31
+ maskClosable: boolean;
32
+ imgPreview: boolean;
33
+ fit: React.CSSProperties['objectFit'];
18
34
  }
19
35
 
20
36
  export default function Image({
@@ -75,8 +91,9 @@ export default function Image({
75
91
  ) : null;
76
92
  }
77
93
 
78
-
79
- function getObjectFitByWxImageMode(mode: TMode): React.CSSProperties['objectFit'] {
94
+ function getObjectFitByWxImageMode(
95
+ mode: TMode
96
+ ): React.CSSProperties['objectFit'] {
80
97
  const array = [
81
98
  {
82
99
  mode: 'scaleToFill',
@@ -47,6 +47,7 @@ export { default as Link } from './link';
47
47
  export { default as Drawer } from './drawer';
48
48
  export { default as UploaderView } from './uploaderView';
49
49
  export { default as UploaderFileView } from './uploaderFileView';
50
+ export { default as WedaVideo } from './wedaVideo/index';
50
51
 
51
52
  export { default as Picker } from './picker/picker';
52
53
  export { default as DatePicker } from './picker/datePicker';
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { CommonPropsType } from '../../types';
2
+ import type { CommonPropsType } from '../../types';
3
3
  import classNames from '../../utils/classnames';
4
4
  import './index.css';
5
5
 
@@ -7,17 +7,17 @@ export interface PropsType extends CommonPropsType {
7
7
  /**
8
8
  * 内容
9
9
  */
10
- content?: string;
11
- /**
12
- * 链接地址
13
- */
14
- url?: string;
15
- /**
16
- * 参数
17
- */
18
- params?: {key: string, value: string}[];
19
- contentSlot?: React.ReactNode;
20
- isOpenInNewWindow: boolean;
10
+ content?: string;
11
+ /**
12
+ * 链接地址
13
+ */
14
+ url?: string;
15
+ /**
16
+ * 参数
17
+ */
18
+ params?: { key: string; value: string }[];
19
+ contentSlot?: React.ReactNode;
20
+ isOpenInNewWindow: boolean;
21
21
  }
22
22
 
23
23
  // 所有绝对地址直接交由浏览器,新开窗口交由浏览器
@@ -110,7 +110,7 @@ export default function Link({
110
110
  }
111
111
  }
112
112
  }}
113
- rel='noopener noreferrer'
113
+ rel="noopener noreferrer"
114
114
  >
115
115
  {contentSlot && <div className="weda-link-slot">{contentSlot}</div>}
116
116
  {content}