@cloudbase/weda-ui 2.0.11 → 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.
- package/README.md +1 -0
- package/package.json +5 -4
- package/src/configs/components/button.json +60 -13
- package/src/configs/components/calendar.json +3 -3
- package/src/configs/components/carousel.json +57 -47
- package/src/configs/components/chart/bar.json +4 -13
- package/src/configs/components/chart/line.json +4 -13
- package/src/configs/components/chart/pie.json +3 -10
- package/src/configs/components/chart/statisticsCard.json +1 -4
- package/src/configs/components/container.json +1 -3
- package/src/configs/components/dataView.json +7 -15
- package/src/configs/components/drawer.json +24 -6
- package/src/configs/components/form/form.json +19 -0
- package/src/configs/components/form/input.json +20 -5
- package/src/configs/components/form/location.json +51 -48
- package/src/configs/components/form/radio.json +1 -3
- package/src/configs/components/form/richText.json +14 -14
- package/src/configs/components/form/select.json +62 -82
- package/src/configs/components/form/textarea.json +6 -1
- package/src/configs/components/form/uploader.json +64 -64
- package/src/configs/components/form/uploaderFile.json +1 -2
- package/src/configs/components/graphicCard.json +43 -44
- package/src/configs/components/image.json +44 -40
- package/src/configs/components/link.json +5 -10
- package/src/configs/components/listView.json +2 -8
- package/src/configs/components/lottery.json +7 -3
- package/src/configs/components/modal.json +26 -21
- package/src/configs/components/navLayout.json +66 -67
- package/src/configs/components/navigationBar.json +4 -1
- package/src/configs/components/richtextview.json +1 -1
- package/src/configs/components/scrollVeiw.json +14 -42
- package/src/configs/components/swiper.json +9 -9
- package/src/configs/components/wedaVideo.json +86 -0
- package/src/configs/components/wxOpenApi/phone.json +7 -21
- package/src/configs/components/wxOpenApi/phoneCode.json +7 -19
- package/src/configs/components/wxOpenApi/share.json +14 -24
- package/src/configs/components/wxOpenApi/userInfo.json +9 -27
- package/src/configs/index.js +2 -0
- package/src/docs/common/format.tsx +4 -1
- package/src/docs/common/tableView.css +3 -3
- package/src/docs/common/tableView.tsx +18 -8
- package/src/docs/compsdocs/form/FormLocation.mdx +1 -1
- package/src/docs/compsdocs/form/FormSelect.mdx +0 -1
- package/src/docs/compsdocs/grid/Card.mdx +0 -1
- package/src/docs/compsdocs/grid/Container.mdx +0 -1
- package/src/docs/compsdocs/grid/GridLayout.mdx +0 -1
- package/src/docs/compsdocs/grid/ScrollView.mdx +2 -2
- package/src/docs/compsdocs/grid/Swiper.mdx +1 -2
- package/src/docs/compsdocs/media/Icon.mdx +1 -1
- package/src/docs/compsdocs/media/Image.mdx +6 -6
- package/src/docs/compsdocs/model/ModelCreate.mdx +24 -0
- package/src/docs/compsdocs/model/ModelDetail.mdx +24 -0
- package/src/docs/compsdocs/model/ModelTable.mdx +133 -1
- package/src/docs/compsdocs/model/ModelUpdate.mdx +24 -1
- package/src/docs/compsdocs/navmenu/Classification.mdx +2 -3
- package/src/docs/compsdocs/navmenu/NavBar.mdx +14 -5
- package/src/docs/compsdocs/navmenu/NavLayout.mdx +0 -1
- package/src/docs/compsdocs/navmenu/TabBar.mdx +3 -3
- package/src/docs/compsdocs/navmenu/TabBarItem.mdx +1 -1
- package/src/docs/compsdocs/senior/Lottery.mdx +3 -6
- package/src/docs/compsdocs/senior/Modal.mdx +2 -3
- package/src/docs/compsdocs/senior/SlotMachine.mdx +2 -5
- package/src/docs/compsdocs/senior/_category_.json +1 -1
- package/src/docs/compsdocs/show/GraphicCard.mdx +0 -1
- package/src/docs/compsdocs/show/Item.mdx +0 -1
- package/src/docs/compsdocs/show/ItemList.mdx +1 -0
- package/src/docs/compsdocs/show/Tabs.mdx +2 -3
- package/src/docs/compsdocs/text/Link.mdx +1 -1
- package/src/docs/compsdocs/text/RichTextView.mdx +1 -2
- package/src/docs/compsdocs/text/Text.mdx +1 -1
- package/src/docs/compsdocs/text/Title.mdx +1 -2
- package/src/docs/compsdocs/wxOpen/Phone.mdx +1 -2
- package/src/docs/compsdocs/wxOpen/Share.mdx +0 -1
- package/src/docs/compsdocs/wxOpen/UserInfo.mdx +1 -2
- package/src/mp/components/calendar/index.json +1 -1
- package/src/mp/components/calendar/index.wxml +5 -27
- package/src/mp/components/carousel/index.json +1 -1
- package/src/mp/components/carousel/index.wxml +3 -30
- package/src/mp/components/chart/bar/index.wxml +1 -6
- package/src/mp/components/chart/ec-canvas/ec-canvas.json +1 -1
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +2 -19
- package/src/mp/components/chart/line/index.wxml +1 -6
- package/src/mp/components/chart/pie/index.wxml +1 -6
- package/src/mp/components/chart/statisticsCard/index.wxml +1 -5
- package/src/mp/components/dataView/index.wxml +1 -13
- package/src/mp/components/form/checkbox/index.wxml +3 -18
- package/src/mp/components/form/formcell/index.wxss +5 -0
- package/src/mp/components/form/input/index.wxml +3 -16
- package/src/mp/components/form/input/index.wxss +7 -1
- package/src/mp/components/form/location/components/mapChoose/index.json +1 -1
- package/src/mp/components/form/location/components/mapChoose/index.wxml +11 -58
- package/src/mp/components/form/location/index.js +7 -1
- package/src/mp/components/form/location/index.json +1 -1
- package/src/mp/components/form/location/index.wxml +7 -43
- package/src/mp/components/form/radio/index.wxml +2 -14
- package/src/mp/components/form/select/index.wxml +3 -33
- package/src/mp/components/form/select/index.wxss +9 -0
- package/src/mp/components/form/switch/index.wxml +2 -13
- package/src/mp/components/form/textarea/index.wxml +4 -23
- package/src/mp/components/form/textarea/index.wxss +5 -0
- package/src/mp/components/form/uploader/index.wxml +2 -20
- package/src/mp/components/form/uploader/weui-uploader.json +6 -6
- package/src/mp/components/form/uploader/weui-uploader.wxml +10 -53
- package/src/mp/components/form/uploaderFile/index.wxml +14 -71
- package/src/mp/components/graphicCard/index.js +9 -11
- package/src/mp/components/graphicCard/index.wxml +6 -34
- package/src/mp/components/image/index.wxml +3 -21
- package/src/mp/components/listView/index.wxml +8 -33
- package/src/mp/components/lottery/index.wxml +7 -31
- package/src/mp/components/navLayout/index.js +9 -12
- package/src/mp/components/navLayout/index.wxml +6 -30
- package/src/mp/components/navigationBar/index.json +1 -2
- package/src/mp/components/navigationBar/index.wxml +29 -146
- package/src/mp/components/swiper/index.wxml +1 -14
- package/src/mp/components/tabs/index.json +1 -1
- package/src/mp/components/tabs/index.wxml +3 -22
- package/src/mp/components/text/index.wxml +1 -7
- package/src/mp/components/wedaVideo/index.js +86 -0
- package/src/mp/components/wedaVideo/index.json +4 -0
- package/src/mp/components/wedaVideo/index.wxml +4 -0
- package/src/mp/components/wedaVideo/index.wxss +20 -0
- package/src/mp/components/wxOpenApi/phone/index.js +1 -9
- package/src/mp/components/wxOpenApi/phone/index.wxml +1 -11
- package/src/mp/components/wxOpenApi/phoneCode/index.json +1 -1
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +1 -11
- package/src/mp/components/wxOpenApi/share/index.wxml +1 -11
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +1 -10
- package/src/mp/index.json +1 -0
- package/src/mp/style/weda-ui.wxss +12 -4
- package/src/web/actions/showModal/index.tsx +5 -4
- package/src/web/components/calendar/index.css +81 -34
- package/src/web/components/chart/common/core/eChartBase.ts +55 -42
- package/src/web/components/chart/common/core/type.ts +23 -23
- package/src/web/components/chart/common/echart.css +12 -12
- package/src/web/components/chart/common/echarts.ts +3 -5
- package/src/web/components/chart/common/useChart.tsx +34 -16
- package/src/web/components/container/index.tsx +3 -4
- package/src/web/components/drawer/index.tsx +15 -4
- package/src/web/components/form/checkbox/index.tsx +32 -31
- package/src/web/components/form/enumSelect/NormalSelect.tsx +0 -2
- package/src/web/components/form/form/index.css +3 -6
- package/src/web/components/form/form/index.tsx +2 -1
- package/src/web/components/form/formcell/index.css +5 -3
- package/src/web/components/form/formcell/index.tsx +2 -6
- package/src/web/components/form/input/index.css +4 -4
- package/src/web/components/form/input/index.tsx +61 -53
- package/src/web/components/form/location/common/selectModal.jsx +2 -11
- package/src/web/components/form/location/common/useLocationInfo.js +4 -0
- package/src/web/components/form/location/components/LocationH5/index.css +0 -1
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +11 -1
- package/src/web/components/form/location/components/LocationPC/Header.jsx +0 -13
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +14 -5
- package/src/web/components/form/radio/index.tsx +32 -26
- package/src/web/components/form/renderDecorator.tsx +23 -26
- package/src/web/components/form/select/h5.tsx +1 -1
- package/src/web/components/form/select/index.css +9 -0
- package/src/web/components/form/select/index.tsx +75 -48
- package/src/web/components/form/select/region/index.ts +101 -80
- package/src/web/components/form/select/year.tsx +2 -0
- package/src/web/components/form/switch/index.tsx +40 -40
- package/src/web/components/form/textarea/index.css +4 -0
- package/src/web/components/form/textarea/index.tsx +26 -25
- package/src/web/components/form/types.d.ts +10 -10
- package/src/web/components/form/uploaderFile/index.jsx +0 -5
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +15 -11
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +14 -9
- package/src/web/components/image/image.tsx +2 -2
- package/src/web/components/image/index.css +9 -7
- package/src/web/components/image/index.tsx +28 -11
- package/src/web/components/index.js +1 -0
- package/src/web/components/link/index.tsx +12 -12
- package/src/web/components/lottery/index.css +43 -37
- package/src/web/components/lottery/index.tsx +2 -2
- package/src/web/components/modal/index.tsx +34 -34
- package/src/web/components/picker/datePicker.tsx +3 -3
- package/src/web/components/picker/picker.tsx +3 -3
- package/src/web/components/richText/index.jsx +41 -46
- package/src/web/components/richTextView/index.tsx +4 -6
- package/src/web/components/scrollView/index.tsx +2 -2
- package/src/web/components/slot/index.tsx +3 -4
- package/src/web/components/swiper/index.css +1 -1
- package/src/web/components/swiper/index.tsx +33 -15
- package/src/web/components/tabs/index.css +1 -1
- package/src/web/components/tabs/index.tsx +6 -6
- package/src/web/components/tabs/tabs.h5.tsx +17 -12
- package/src/web/components/tabs/tabs.pc.tsx +45 -34
- package/src/web/components/text/index.css +1 -1
- package/src/web/components/wedaVideo/index.css +42 -0
- package/src/web/components/wedaVideo/index.tsx +198 -0
- package/src/web/utils/constant.ts +2 -1
- package/src/web/utils/loading-fallback.tsx +2 -2
- package/src/web/utils/lodash.ts +1 -1
- package/src/web/utils/useSetState.ts +6 -2
- package/src/web/weda-ui.css +13 -0
|
@@ -53,6 +53,7 @@ export default function LocationH5(props) {
|
|
|
53
53
|
message: '地图定位中',
|
|
54
54
|
});
|
|
55
55
|
const [location, setLocation] = useState({
|
|
56
|
+
detailedAddress: '',
|
|
56
57
|
poiname: '',
|
|
57
58
|
latlng: { lat: 39.98410411, lng: 116.307503 },
|
|
58
59
|
});
|
|
@@ -63,10 +64,12 @@ export default function LocationH5(props) {
|
|
|
63
64
|
// 重置表单时
|
|
64
65
|
const {
|
|
65
66
|
poiname,
|
|
67
|
+
detailedAddress,
|
|
66
68
|
latlng: { lat, lng },
|
|
67
69
|
} = currentLocations.current;
|
|
68
70
|
let location = {
|
|
69
71
|
poiname,
|
|
72
|
+
detailedAddress,
|
|
70
73
|
latlng: { lat, lng },
|
|
71
74
|
};
|
|
72
75
|
if (locationType === 1) {
|
|
@@ -76,6 +79,7 @@ export default function LocationH5(props) {
|
|
|
76
79
|
let res = {
|
|
77
80
|
value: {
|
|
78
81
|
address: poiname,
|
|
82
|
+
detailedAddress,
|
|
79
83
|
geopoint: {
|
|
80
84
|
coordinates: [lng, lat],
|
|
81
85
|
type: 'Point',
|
|
@@ -94,6 +98,7 @@ export default function LocationH5(props) {
|
|
|
94
98
|
lng: 116.307503,
|
|
95
99
|
},
|
|
96
100
|
poiname: '',
|
|
101
|
+
detailedAddress: '',
|
|
97
102
|
locationType,
|
|
98
103
|
};
|
|
99
104
|
switch (locationType) {
|
|
@@ -133,6 +138,7 @@ export default function LocationH5(props) {
|
|
|
133
138
|
lng: longitude,
|
|
134
139
|
},
|
|
135
140
|
poiname: poiname,
|
|
141
|
+
detailedAddress: '',
|
|
136
142
|
};
|
|
137
143
|
setLocation(loc);
|
|
138
144
|
}, [customLocation, locationType]);
|
|
@@ -161,6 +167,7 @@ export default function LocationH5(props) {
|
|
|
161
167
|
const { city, lat, lng, addr } = ipLocation;
|
|
162
168
|
let loc = {
|
|
163
169
|
poiname: city + addr,
|
|
170
|
+
detailedAddress: city + addr,
|
|
164
171
|
latlng: { lat, lng },
|
|
165
172
|
};
|
|
166
173
|
if (locationType === 1) {
|
|
@@ -175,6 +182,7 @@ export default function LocationH5(props) {
|
|
|
175
182
|
events.change({
|
|
176
183
|
value: {
|
|
177
184
|
address: city + addr,
|
|
185
|
+
detailedAddress: city + addr,
|
|
178
186
|
geopoint: {
|
|
179
187
|
coordinates: [lng, lat],
|
|
180
188
|
type: 'Point',
|
|
@@ -210,6 +218,7 @@ export default function LocationH5(props) {
|
|
|
210
218
|
});
|
|
211
219
|
setLocation({
|
|
212
220
|
poiname: '',
|
|
221
|
+
detailedAddress: '',
|
|
213
222
|
latlng: { lat: 39.98410411, lng: 116.307503 },
|
|
214
223
|
});
|
|
215
224
|
weui.alert('定位失败');
|
|
@@ -278,10 +287,11 @@ export default function LocationH5(props) {
|
|
|
278
287
|
};
|
|
279
288
|
|
|
280
289
|
const onChangeLocation = (value) => {
|
|
281
|
-
const { poiname, latlng } = value;
|
|
290
|
+
const { poiname, latlng, detailedAddress } = value;
|
|
282
291
|
let res = {
|
|
283
292
|
value: {
|
|
284
293
|
address: poiname,
|
|
294
|
+
detailedAddress,
|
|
285
295
|
geopoint: {
|
|
286
296
|
coordinates: [latlng.lng, latlng.lat],
|
|
287
297
|
type: 'Point',
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Button } from 'tea-component';
|
|
3
|
-
import * as PropTypes from 'prop-types';
|
|
4
3
|
import classNames from '../../../../../utils/classnames';
|
|
5
4
|
|
|
6
5
|
const Header = ({
|
|
@@ -94,16 +93,4 @@ const Header = ({
|
|
|
94
93
|
);
|
|
95
94
|
};
|
|
96
95
|
|
|
97
|
-
Header.propTypes = {
|
|
98
|
-
onClick: PropTypes.func,
|
|
99
|
-
isEdit: PropTypes.bool,
|
|
100
|
-
info: PropTypes.object,
|
|
101
|
-
disabled: PropTypes.bool,
|
|
102
|
-
showLngLat: PropTypes.bool,
|
|
103
|
-
currentLocStatus: PropTypes.bool,
|
|
104
|
-
dataSourceStatus: PropTypes.bool,
|
|
105
|
-
locationType: PropTypes.number,
|
|
106
|
-
apiKeyStatus: PropTypes.object,
|
|
107
|
-
};
|
|
108
|
-
|
|
109
96
|
export default Header;
|
|
@@ -54,9 +54,10 @@ export default function LocationPC(props) {
|
|
|
54
54
|
const [APIKEY, setAPIKEY] = useState('');
|
|
55
55
|
|
|
56
56
|
const eventsChange = (value, noaddr) => {
|
|
57
|
-
const { poiname, latitude, longitude } = value;
|
|
57
|
+
const { poiname, detailedAddress, latitude, longitude } = value;
|
|
58
58
|
let res = {
|
|
59
59
|
address: poiname,
|
|
60
|
+
detailedAddress,
|
|
60
61
|
geopoint: {
|
|
61
62
|
coordinates: [longitude, latitude],
|
|
62
63
|
type: 'Point',
|
|
@@ -90,10 +91,12 @@ export default function LocationPC(props) {
|
|
|
90
91
|
// 重置表单时
|
|
91
92
|
const {
|
|
92
93
|
poiname,
|
|
94
|
+
detailedAddress,
|
|
93
95
|
latlng: { lat, lng },
|
|
94
96
|
} = currentLocations.current;
|
|
95
97
|
let location = {
|
|
96
98
|
poiname,
|
|
99
|
+
detailedAddress,
|
|
97
100
|
latlng: { lat, lng },
|
|
98
101
|
};
|
|
99
102
|
if (locationType === 1) {
|
|
@@ -103,7 +106,8 @@ export default function LocationPC(props) {
|
|
|
103
106
|
eventsChange({
|
|
104
107
|
latitude: lat,
|
|
105
108
|
longitude: lng,
|
|
106
|
-
poiname
|
|
109
|
+
poiname,
|
|
110
|
+
detailedAddress,
|
|
107
111
|
});
|
|
108
112
|
}
|
|
109
113
|
setLocation(location);
|
|
@@ -118,11 +122,12 @@ export default function LocationPC(props) {
|
|
|
118
122
|
setIsSelectMapVisible(true);
|
|
119
123
|
};
|
|
120
124
|
const onChangeLocation = (value) => {
|
|
121
|
-
const { poiname, latlng } = value;
|
|
125
|
+
const { poiname, latlng, detailedAddress } = value;
|
|
122
126
|
events.change &&
|
|
123
127
|
events.change({
|
|
124
128
|
value: {
|
|
125
129
|
address: poiname,
|
|
130
|
+
detailedAddress,
|
|
126
131
|
geopoint: {
|
|
127
132
|
coordinates: [latlng.lng, latlng.lat],
|
|
128
133
|
type: 'Point',
|
|
@@ -172,6 +177,7 @@ export default function LocationPC(props) {
|
|
|
172
177
|
lng: 116.307503,
|
|
173
178
|
},
|
|
174
179
|
poiname: '',
|
|
180
|
+
detailedAddress: '',
|
|
175
181
|
locationType,
|
|
176
182
|
};
|
|
177
183
|
switch (locationType) {
|
|
@@ -183,6 +189,7 @@ export default function LocationPC(props) {
|
|
|
183
189
|
lng: location.latlng.lng,
|
|
184
190
|
},
|
|
185
191
|
poiname: location.poiname,
|
|
192
|
+
detailedAddress: location.detailedAddress,
|
|
186
193
|
};
|
|
187
194
|
break;
|
|
188
195
|
case 3:
|
|
@@ -207,6 +214,7 @@ export default function LocationPC(props) {
|
|
|
207
214
|
latitude: loc.latlng.lat,
|
|
208
215
|
longitude: loc.latlng.lng,
|
|
209
216
|
poiname: loc.poiname,
|
|
217
|
+
detailedAddress: loc.detailedAddress,
|
|
210
218
|
},
|
|
211
219
|
true
|
|
212
220
|
);
|
|
@@ -220,13 +228,14 @@ export default function LocationPC(props) {
|
|
|
220
228
|
weui.alert('位置输入格式错误 请检查');
|
|
221
229
|
return;
|
|
222
230
|
}
|
|
223
|
-
let { latitude, longitude, poiname } = customLocation;
|
|
231
|
+
let { latitude, longitude, poiname, detailedAddress } = customLocation;
|
|
224
232
|
let loc = {
|
|
225
233
|
latlng: {
|
|
226
234
|
lat: latitude,
|
|
227
235
|
lng: longitude,
|
|
228
236
|
},
|
|
229
|
-
poiname
|
|
237
|
+
poiname,
|
|
238
|
+
detailedAddress,
|
|
230
239
|
};
|
|
231
240
|
setLocation(loc);
|
|
232
241
|
}, [customLocation, locationType]);
|
|
@@ -9,7 +9,7 @@ import { callWedaApi } from '../../../utils/tcb';
|
|
|
9
9
|
|
|
10
10
|
import './index.css';
|
|
11
11
|
import { renderDecorator } from '../renderDecorator';
|
|
12
|
-
import { CommonFormPropsType } from '../types';
|
|
12
|
+
import type { CommonFormPropsType } from '../types';
|
|
13
13
|
import destr from 'destr';
|
|
14
14
|
|
|
15
15
|
export default function Radio({
|
|
@@ -28,7 +28,7 @@ export default function Radio({
|
|
|
28
28
|
layout = 'horizontal',
|
|
29
29
|
disabled = false,
|
|
30
30
|
requiredFlag = false,
|
|
31
|
-
decorator
|
|
31
|
+
decorator,
|
|
32
32
|
}: PropsType) {
|
|
33
33
|
const platform = usePlatform();
|
|
34
34
|
const isH5 = platform === 'h5';
|
|
@@ -65,23 +65,25 @@ export default function Radio({
|
|
|
65
65
|
|
|
66
66
|
useEffect(() => {
|
|
67
67
|
if (format !== 'x-enum') {
|
|
68
|
-
setOption(range)
|
|
68
|
+
setOption(range);
|
|
69
69
|
}
|
|
70
70
|
}, [range]);
|
|
71
71
|
|
|
72
|
-
const fetchData = async (param:
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
const fetchData = async (param: {
|
|
73
|
+
OptNameList?: object;
|
|
74
|
+
PageIndex?: number;
|
|
75
|
+
PageSize?: number;
|
|
76
|
+
}) => {
|
|
75
77
|
let data = await callWedaApi({
|
|
76
78
|
action: 'DescribeGeneralOptionsDetailList',
|
|
77
79
|
data: param,
|
|
78
80
|
});
|
|
79
81
|
const config = destr(data?.Items?.[0]?.Config) ?? [];
|
|
80
|
-
const enumOption = config.map(item => {
|
|
82
|
+
const enumOption = config.map((item) => {
|
|
81
83
|
return {
|
|
82
84
|
label: item.value,
|
|
83
85
|
value: item.key,
|
|
84
|
-
checked: false
|
|
86
|
+
checked: false,
|
|
85
87
|
};
|
|
86
88
|
});
|
|
87
89
|
setOption(enumOption);
|
|
@@ -106,7 +108,6 @@ export default function Radio({
|
|
|
106
108
|
const hashcode = React.useMemo(() => getLocalCounter(), []);
|
|
107
109
|
let radioElement;
|
|
108
110
|
if (isH5) {
|
|
109
|
-
|
|
110
111
|
radioElement = option.map(({ label, value }, index) => {
|
|
111
112
|
const _id = `radio-${hashcode}-${index}`;
|
|
112
113
|
const _name = `radio-${hashcode}-${name}`;
|
|
@@ -137,24 +138,29 @@ export default function Radio({
|
|
|
137
138
|
});
|
|
138
139
|
} else {
|
|
139
140
|
// pc
|
|
140
|
-
radioElement = (
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
{
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
141
|
+
radioElement = (
|
|
142
|
+
<ConfigProvider classPrefix="wedatea2td">
|
|
143
|
+
<TeaRadio.Group
|
|
144
|
+
disabled={disabled}
|
|
145
|
+
value={checkedItemValue}
|
|
146
|
+
onChange={(value, { event }) => getChangeHandler(value)(event)}
|
|
147
|
+
>
|
|
148
|
+
{option.map(({ value, label }, index) => {
|
|
149
|
+
const _id = `radio-${hashcode}-${index}`;
|
|
150
|
+
return (
|
|
151
|
+
<TeaRadio key={_id} name={value} id={_id}>
|
|
152
|
+
{label}
|
|
153
|
+
</TeaRadio>
|
|
154
|
+
);
|
|
155
|
+
})}
|
|
156
|
+
</TeaRadio.Group>
|
|
157
|
+
</ConfigProvider>
|
|
158
|
+
);
|
|
156
159
|
}
|
|
157
|
-
return renderDecorator(
|
|
160
|
+
return renderDecorator(
|
|
161
|
+
radioElement,
|
|
162
|
+
decorator
|
|
163
|
+
)({
|
|
158
164
|
id,
|
|
159
165
|
className: cls,
|
|
160
166
|
style,
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import FormCell from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import FormCell from './formcell';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* @returns {(props: any) => JSX.Element}
|
|
7
7
|
*/
|
|
8
|
-
export function renderDecorator<D=any>(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return function WedaFormFiled(decoratorProps) {
|
|
20
|
-
if(Array.isArray(DecoratorComponent) && DecoratorComponent.length === 2) {
|
|
21
|
-
decoratorProps = DecoratorComponent[1];
|
|
22
|
-
DecoratorComponent = DecoratorComponent[0];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<DecoratorComponent {...decoratorProps} >
|
|
27
|
-
{filedNode}
|
|
28
|
-
</DecoratorComponent>
|
|
29
|
-
);
|
|
8
|
+
export function renderDecorator<D = any>(
|
|
9
|
+
filedNode: React.ReactNode,
|
|
10
|
+
DecoratorComponent: React.FC<D> = FormCell
|
|
11
|
+
) {
|
|
12
|
+
if (!DecoratorComponent) {
|
|
13
|
+
return function WedaFormField() {
|
|
14
|
+
return <React.Fragment>{filedNode}</React.Fragment>;
|
|
30
15
|
};
|
|
31
|
-
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return function WedaFormFiled(decoratorProps) {
|
|
19
|
+
if (Array.isArray(DecoratorComponent) && DecoratorComponent.length === 2) {
|
|
20
|
+
decoratorProps = DecoratorComponent[1];
|
|
21
|
+
DecoratorComponent = DecoratorComponent[0];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<DecoratorComponent {...decoratorProps}>{filedNode}</DecoratorComponent>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -476,7 +476,7 @@ PropsType) {
|
|
|
476
476
|
region: (region || []).join(separator), // region 有可能是空串
|
|
477
477
|
mutiRegion: mutiRegion,
|
|
478
478
|
};
|
|
479
|
-
}, [range, selectedValue, date, time, region, separator, mutiRegion]);
|
|
479
|
+
}, [range, selectedValue, date, time, region, separator, mutiRegion, option]);
|
|
480
480
|
|
|
481
481
|
return (
|
|
482
482
|
<div className={subCls}>
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
ConfigProvider,
|
|
12
12
|
} from 'tea-component';
|
|
13
13
|
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
14
|
-
import { getRegionTree,getAreaCode } from './region';
|
|
14
|
+
import { getRegionTree, getAreaCode } from './region';
|
|
15
15
|
import { renderDecorator } from '../renderDecorator';
|
|
16
16
|
import type { CommonFormPropsType } from '../types';
|
|
17
17
|
import YearPicker from './year';
|
|
@@ -90,7 +90,7 @@ export default function Select(props) {
|
|
|
90
90
|
export interface PropsType extends CommonFormPropsType {
|
|
91
91
|
size: 's' | 'm' | 'l' | 'full';
|
|
92
92
|
placeholder: string;
|
|
93
|
-
mode: 'selector' | 'date' | 'time' | 'region'| 'mutiRegion';
|
|
93
|
+
mode: 'selector' | 'date' | 'time' | 'region' | 'mutiRegion';
|
|
94
94
|
dateMode: 'day' | 'month' | 'year';
|
|
95
95
|
// selector mode
|
|
96
96
|
range?: any[];
|
|
@@ -132,8 +132,8 @@ export interface PropsType extends CommonFormPropsType {
|
|
|
132
132
|
regionType?: 'levelOne' | 'levelTwo' | 'levelThree';
|
|
133
133
|
separator?: string;
|
|
134
134
|
requiredFlag?: boolean;
|
|
135
|
-
regionTree?:any[]
|
|
136
|
-
defaultMutiRegion?:string;
|
|
135
|
+
regionTree?: any[];
|
|
136
|
+
defaultMutiRegion?: string;
|
|
137
137
|
onChange?: (v: any) => void; // 配合 fomily 受控使用
|
|
138
138
|
}
|
|
139
139
|
|
|
@@ -170,7 +170,7 @@ function SelectPc({
|
|
|
170
170
|
placeholder = '请选择',
|
|
171
171
|
mode = 'selector',
|
|
172
172
|
dateMode = 'day',
|
|
173
|
-
events = {change: null },
|
|
173
|
+
events = { change: null },
|
|
174
174
|
disabled = false,
|
|
175
175
|
range = defaultProps.range,
|
|
176
176
|
startDate,
|
|
@@ -184,7 +184,7 @@ function SelectPc({
|
|
|
184
184
|
regionType,
|
|
185
185
|
separator = defaultProps.separator,
|
|
186
186
|
size = defaultProps.size,
|
|
187
|
-
onChange
|
|
187
|
+
onChange,
|
|
188
188
|
}: PropsType) {
|
|
189
189
|
// 两次默认值不同, 需要刷新
|
|
190
190
|
const prevDefaultRef = React.useRef<any>();
|
|
@@ -194,10 +194,12 @@ function SelectPc({
|
|
|
194
194
|
const [time, setTime] = React.useState(
|
|
195
195
|
decodeIsoDatetime(defaultTime, 'time')
|
|
196
196
|
);
|
|
197
|
-
const [regionTree,setRegionTree] = React.useState([]);
|
|
198
|
-
const [regionData,setRegionData] = React.useState([]);
|
|
197
|
+
const [regionTree, setRegionTree] = React.useState([]);
|
|
198
|
+
const [regionData, setRegionData] = React.useState([]);
|
|
199
199
|
const [region, setRegion] = React.useState(defaultRegion || undefined);
|
|
200
|
-
const [mutiRegion, setMutiRegion] = React.useState(
|
|
200
|
+
const [mutiRegion, setMutiRegion] = React.useState(
|
|
201
|
+
defaultMutiRegion != null ? defaultMutiRegion.split(',') : []
|
|
202
|
+
);
|
|
201
203
|
const [selectedValue, setSelectedValue] = React.useState(defaultValue);
|
|
202
204
|
|
|
203
205
|
const [option, setOption] = React.useState([]);
|
|
@@ -206,12 +208,16 @@ function SelectPc({
|
|
|
206
208
|
React.useEffect(() => {
|
|
207
209
|
// 筛选参数
|
|
208
210
|
const whereEffected = [].concat(getWhereList(where));
|
|
209
|
-
if (
|
|
211
|
+
if (
|
|
212
|
+
(format === 'father-son' || format === 'related') &&
|
|
213
|
+
dataSourceName &&
|
|
214
|
+
viewId
|
|
215
|
+
) {
|
|
210
216
|
fetchData({
|
|
211
217
|
dataSourceName: dataSourceName,
|
|
212
218
|
viewId: viewId,
|
|
213
219
|
methodName: 'wedaGetRecords',
|
|
214
|
-
params: whereEffected
|
|
220
|
+
params: whereEffected,
|
|
215
221
|
});
|
|
216
222
|
}
|
|
217
223
|
}, [where]);
|
|
@@ -219,10 +225,10 @@ function SelectPc({
|
|
|
219
225
|
// 获取数据列表中主列字段,将其作为选项
|
|
220
226
|
React.useEffect(() => {
|
|
221
227
|
if (records && records.length !== 0 && primaryField) {
|
|
222
|
-
const option = records.map(item => {
|
|
228
|
+
const option = records.map((item) => {
|
|
223
229
|
return {
|
|
224
230
|
label: item[primaryField],
|
|
225
|
-
value: item._id
|
|
231
|
+
value: item._id,
|
|
226
232
|
};
|
|
227
233
|
});
|
|
228
234
|
setOption(option);
|
|
@@ -231,10 +237,10 @@ function SelectPc({
|
|
|
231
237
|
|
|
232
238
|
// 获取数据源列表
|
|
233
239
|
const fetchData = async (param: {
|
|
234
|
-
dataSourceName?: string
|
|
235
|
-
viewId?: string
|
|
236
|
-
methodName?: string
|
|
237
|
-
params?: any
|
|
240
|
+
dataSourceName?: string;
|
|
241
|
+
viewId?: string;
|
|
242
|
+
methodName?: string;
|
|
243
|
+
params?: any;
|
|
238
244
|
}) => {
|
|
239
245
|
let pageNo = 1;
|
|
240
246
|
let pageSize = 200;
|
|
@@ -256,7 +262,6 @@ function SelectPc({
|
|
|
256
262
|
total = data?.total || 0;
|
|
257
263
|
records = records.concat(data?.records);
|
|
258
264
|
}
|
|
259
|
-
|
|
260
265
|
}
|
|
261
266
|
|
|
262
267
|
if (records) {
|
|
@@ -272,15 +277,17 @@ function SelectPc({
|
|
|
272
277
|
}, [enumName]);
|
|
273
278
|
|
|
274
279
|
// 获取自定义选项集
|
|
275
|
-
const fetchEnumData = async (param:
|
|
276
|
-
|
|
277
|
-
|
|
280
|
+
const fetchEnumData = async (param: {
|
|
281
|
+
OptNameList?: object;
|
|
282
|
+
PageIndex?: number;
|
|
283
|
+
PageSize?: number;
|
|
284
|
+
}) => {
|
|
278
285
|
let data = await callWedaApi({
|
|
279
286
|
action: 'DescribeGeneralOptionsDetailList',
|
|
280
287
|
data: param,
|
|
281
288
|
});
|
|
282
289
|
const config = destr(data?.Items?.[0]?.Config) ?? [];
|
|
283
|
-
const enumOption = config.map(item => {
|
|
290
|
+
const enumOption = config.map((item) => {
|
|
284
291
|
return {
|
|
285
292
|
label: item.value,
|
|
286
293
|
value: item.key,
|
|
@@ -308,8 +315,13 @@ function SelectPc({
|
|
|
308
315
|
setRegion(defaultRegion || []); // region 有可能是空串
|
|
309
316
|
hasChange = true;
|
|
310
317
|
}
|
|
311
|
-
if (
|
|
312
|
-
|
|
318
|
+
if (
|
|
319
|
+
!isObjectEqual(
|
|
320
|
+
prevDefaultRef.current?.defaultMutiRegion,
|
|
321
|
+
defaultMutiRegion
|
|
322
|
+
)
|
|
323
|
+
) {
|
|
324
|
+
setMutiRegion(defaultMutiRegion ? defaultMutiRegion.split(',') : []);
|
|
313
325
|
hasChange = true;
|
|
314
326
|
}
|
|
315
327
|
if (hasChange) {
|
|
@@ -317,29 +329,29 @@ function SelectPc({
|
|
|
317
329
|
defaultDate,
|
|
318
330
|
defaultTime,
|
|
319
331
|
defaultRegion,
|
|
320
|
-
defaultMutiRegion
|
|
332
|
+
defaultMutiRegion,
|
|
321
333
|
};
|
|
322
334
|
}
|
|
323
335
|
});
|
|
324
|
-
const regionTreeMode = React.useMemo(()=>{
|
|
325
|
-
if(mode=='region'||mode=='mutiRegion'){
|
|
326
|
-
if(regionData.length<1){
|
|
327
|
-
getAreaCode().then((value)=>{
|
|
336
|
+
const regionTreeMode = React.useMemo(() => {
|
|
337
|
+
if (mode == 'region' || mode == 'mutiRegion') {
|
|
338
|
+
if (regionData.length < 1) {
|
|
339
|
+
getAreaCode().then((value) => {
|
|
328
340
|
setRegionData(value);
|
|
329
|
-
getRegionTree(value,regionType,mode).then(tree=>{
|
|
341
|
+
getRegionTree(value, regionType, mode).then((tree) => {
|
|
330
342
|
setRegionTree(tree);
|
|
331
343
|
});
|
|
332
344
|
});
|
|
333
|
-
}else{
|
|
334
|
-
getRegionTree(regionData,regionType,mode).then(tree=>{
|
|
345
|
+
} else {
|
|
346
|
+
getRegionTree(regionData, regionType, mode).then((tree) => {
|
|
335
347
|
setRegionTree(tree);
|
|
336
348
|
});
|
|
337
349
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
},[regionType,mode,regionData]);
|
|
350
|
+
}
|
|
351
|
+
getRegionTree(regionData, regionType, mode).then((value) => {
|
|
352
|
+
setRegionTree(value);
|
|
353
|
+
});
|
|
354
|
+
}, [regionType, mode, regionData]);
|
|
343
355
|
const onDataChange = (value) => {
|
|
344
356
|
let finalVal;
|
|
345
357
|
if (mode === 'date') {
|
|
@@ -352,17 +364,21 @@ function SelectPc({
|
|
|
352
364
|
} else if (mode === 'mutiRegion') {
|
|
353
365
|
finalVal = value.join(',');
|
|
354
366
|
setMutiRegion(value);
|
|
355
|
-
}
|
|
367
|
+
} else {
|
|
356
368
|
finalVal = value;
|
|
357
369
|
}
|
|
358
370
|
onChange && onChange(finalVal);
|
|
359
371
|
events?.change?.({ value: finalVal });
|
|
360
372
|
};
|
|
373
|
+
const sizeClassName = classNames({
|
|
374
|
+
[`size-${size}`]: size,
|
|
375
|
+
});
|
|
376
|
+
|
|
361
377
|
const createDropdown = () => {
|
|
362
378
|
switch (mode) {
|
|
363
379
|
case 'selector':
|
|
364
380
|
return (
|
|
365
|
-
<div data-testid="form-select"
|
|
381
|
+
<div data-testid="form-select">
|
|
366
382
|
<TeaSelect
|
|
367
383
|
matchButtonWidth
|
|
368
384
|
size={size}
|
|
@@ -372,8 +388,15 @@ function SelectPc({
|
|
|
372
388
|
type="simulate"
|
|
373
389
|
appearance="button"
|
|
374
390
|
placeholder={placeholder}
|
|
375
|
-
options={
|
|
376
|
-
|
|
391
|
+
options={
|
|
392
|
+
format === 'father-son' ||
|
|
393
|
+
format === 'related' ||
|
|
394
|
+
format === 'x-enum'
|
|
395
|
+
? option.map((i) => ({ text: i.label, value: i.value }))
|
|
396
|
+
: range.map((i) => ({ text: i.label, value: i.value }))
|
|
397
|
+
}
|
|
398
|
+
/>
|
|
399
|
+
</div>
|
|
377
400
|
);
|
|
378
401
|
case 'date': {
|
|
379
402
|
const now = moment();
|
|
@@ -390,6 +413,7 @@ function SelectPc({
|
|
|
390
413
|
placeholder,
|
|
391
414
|
value: date ? moment(date) : undefined,
|
|
392
415
|
'data-testid': 'form-item-select',
|
|
416
|
+
size,
|
|
393
417
|
};
|
|
394
418
|
if (dateMode === 'year') {
|
|
395
419
|
return (
|
|
@@ -402,9 +426,11 @@ function SelectPc({
|
|
|
402
426
|
/>
|
|
403
427
|
);
|
|
404
428
|
} else if (dateMode === 'month') {
|
|
405
|
-
return
|
|
429
|
+
return (
|
|
430
|
+
<DatePicker.MonthPicker className={sizeClassName} {...dateProps} />
|
|
431
|
+
);
|
|
406
432
|
} else {
|
|
407
|
-
return <DatePicker {...dateProps} />;
|
|
433
|
+
return <DatePicker className={sizeClassName} {...dateProps} />;
|
|
408
434
|
}
|
|
409
435
|
}
|
|
410
436
|
case 'time': {
|
|
@@ -414,6 +440,7 @@ function SelectPc({
|
|
|
414
440
|
const end = endTime ? decodeIsoDatetime(endTime, 'time') : '23:59';
|
|
415
441
|
return (
|
|
416
442
|
<TimePicker
|
|
443
|
+
className={sizeClassName}
|
|
417
444
|
onChange={onDataChange}
|
|
418
445
|
disabled={disabled}
|
|
419
446
|
placeholder={placeholder}
|
|
@@ -433,6 +460,7 @@ function SelectPc({
|
|
|
433
460
|
data={regionTree}
|
|
434
461
|
multiple={false}
|
|
435
462
|
onChange={onDataChange}
|
|
463
|
+
className={sizeClassName}
|
|
436
464
|
valueRender={(options) =>
|
|
437
465
|
options.map(({ label, value }, index) => (
|
|
438
466
|
<React.Fragment key={`${value}-${index}`}>
|
|
@@ -444,24 +472,23 @@ function SelectPc({
|
|
|
444
472
|
value={region}
|
|
445
473
|
/>
|
|
446
474
|
);
|
|
447
|
-
|
|
475
|
+
case 'mutiRegion':
|
|
448
476
|
return (
|
|
449
477
|
<Cascader
|
|
450
478
|
clearable
|
|
451
479
|
searchable
|
|
480
|
+
className={sizeClassName}
|
|
452
481
|
type="menu"
|
|
453
482
|
disabled={disabled}
|
|
454
483
|
data={regionTree}
|
|
455
484
|
multiple={false}
|
|
456
485
|
onChange={onDataChange}
|
|
457
|
-
onLoad={(regionTree, options)=>{
|
|
486
|
+
onLoad={(regionTree, options) => {
|
|
458
487
|
return new Promise((resolve) => {
|
|
459
488
|
setTimeout(() => {
|
|
460
489
|
resolve();
|
|
461
|
-
|
|
462
|
-
},1000);
|
|
490
|
+
}, 1000);
|
|
463
491
|
});
|
|
464
|
-
|
|
465
492
|
}}
|
|
466
493
|
valueRender={(options) =>
|
|
467
494
|
options.map(({ label, value }, index) => (
|