@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
|
@@ -3,24 +3,33 @@ import { callWedaApi } from '../../../../utils/tcb';
|
|
|
3
3
|
|
|
4
4
|
let tree;
|
|
5
5
|
|
|
6
|
-
export async function getRegionTree(regionData,regionType,regionMode) {
|
|
6
|
+
export async function getRegionTree(regionData, regionType, regionMode) {
|
|
7
7
|
tree = [];
|
|
8
|
-
tree = formatTreeData(regionData,regionType,regionMode);
|
|
8
|
+
tree = formatTreeData(regionData, regionType, regionMode);
|
|
9
9
|
return tree;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export
|
|
13
|
-
const weRegionTree =
|
|
12
|
+
export function regionPicker(options, regionTree: any[]) {
|
|
13
|
+
const weRegionTree =
|
|
14
|
+
regionTree.length == 0
|
|
15
|
+
? [
|
|
16
|
+
{
|
|
17
|
+
label: '地区数据加载中,请关闭弹窗后重试',
|
|
18
|
+
value: null,
|
|
19
|
+
children: null,
|
|
20
|
+
},
|
|
21
|
+
]
|
|
22
|
+
: regionTree;
|
|
14
23
|
weui.picker(weRegionTree, options);
|
|
15
24
|
}
|
|
16
25
|
/**
|
|
17
26
|
* 获取运行态地区数据
|
|
18
27
|
*/
|
|
19
|
-
|
|
28
|
+
export async function getAreaCode() {
|
|
20
29
|
try {
|
|
21
30
|
const res = await callWedaApi({
|
|
22
31
|
action: 'QueryRuntimeAreaCode',
|
|
23
|
-
data: {Mask:
|
|
32
|
+
data: { Mask: '11100' },
|
|
24
33
|
});
|
|
25
34
|
return res?.AreaCodeList;
|
|
26
35
|
} catch (error) {
|
|
@@ -31,101 +40,113 @@ export function regionPicker(options,regionTree:any[]) {
|
|
|
31
40
|
/**
|
|
32
41
|
* 构建树形结构
|
|
33
42
|
*/
|
|
34
|
-
|
|
43
|
+
function formatTreeData(arr, regionType, regionMode) {
|
|
35
44
|
let provicesData = [];
|
|
36
|
-
|
|
45
|
+
arr.forEach((item) => {
|
|
37
46
|
//省数据集合
|
|
38
|
-
if(item?.Type==1&&item?.Deprecated==false){
|
|
47
|
+
if (item?.Type == 1 && item?.Deprecated == false) {
|
|
39
48
|
provicesData.push({
|
|
40
49
|
label: item.Value,
|
|
41
50
|
value: item.Value,
|
|
42
|
-
code:item.Code,
|
|
43
|
-
type:item.Type,
|
|
44
|
-
centralCity:item.CentralCity,
|
|
45
|
-
children:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
code: item.Code,
|
|
52
|
+
type: item.Type,
|
|
53
|
+
centralCity: item.CentralCity,
|
|
54
|
+
children:
|
|
55
|
+
regionType != 'levelOne' || regionMode == 'region'
|
|
56
|
+
? [
|
|
57
|
+
{
|
|
58
|
+
label: item.Value,
|
|
59
|
+
value: item.Value,
|
|
60
|
+
code: item.Code,
|
|
61
|
+
type: item.Type,
|
|
62
|
+
children:
|
|
63
|
+
regionType != 'levelTwo' || regionMode == 'region'
|
|
64
|
+
? [
|
|
65
|
+
{
|
|
66
|
+
label: item.Value,
|
|
67
|
+
value: item.Value,
|
|
68
|
+
code: item.Code,
|
|
69
|
+
type: item.Type,
|
|
70
|
+
centralCity: item.CentralCity,
|
|
71
|
+
},
|
|
72
|
+
]
|
|
73
|
+
: null,
|
|
74
|
+
},
|
|
75
|
+
]
|
|
76
|
+
: null,
|
|
58
77
|
});
|
|
59
78
|
}
|
|
60
79
|
});
|
|
61
|
-
if(regionType!= 'levelOne'||regionMode=='region'){
|
|
62
|
-
arr.forEach(item=>{
|
|
80
|
+
if (regionType != 'levelOne' || regionMode == 'region') {
|
|
81
|
+
arr.forEach((item) => {
|
|
63
82
|
//市数据集合
|
|
64
|
-
if(item?.Type==2&&item?.Deprecated==false){
|
|
65
|
-
provicesData.map(provice=>{
|
|
66
|
-
if(provice.code.substr(0, 2) == item.Code.substr(0,2)){
|
|
67
|
-
if(provice['children'][0].type==1){
|
|
68
|
-
provice['children']=[];
|
|
83
|
+
if (item?.Type == 2 && item?.Deprecated == false) {
|
|
84
|
+
provicesData.map((provice) => {
|
|
85
|
+
if (provice.code.substr(0, 2) == item.Code.substr(0, 2)) {
|
|
86
|
+
if (provice['children'][0].type == 1) {
|
|
87
|
+
provice['children'] = [];
|
|
69
88
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
provice['children'].push({
|
|
90
|
+
label: item.Value,
|
|
91
|
+
value: item.Value,
|
|
92
|
+
code: item.Code,
|
|
93
|
+
type: item.Type,
|
|
94
|
+
centralCity: item.CentralCity,
|
|
95
|
+
children:
|
|
96
|
+
regionType != 'levelTwo' || regionMode == 'region'
|
|
97
|
+
? [
|
|
98
|
+
{
|
|
99
|
+
label: item.Value,
|
|
100
|
+
value: item.Value,
|
|
101
|
+
code: item.Code,
|
|
102
|
+
type: item.Type,
|
|
103
|
+
centralCity: item.CentralCity,
|
|
104
|
+
},
|
|
105
|
+
]
|
|
106
|
+
: null,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
86
109
|
});
|
|
87
110
|
}
|
|
88
111
|
});
|
|
89
|
-
if(regionType != 'levelTwo'||regionMode=='region'){
|
|
90
|
-
arr.forEach(item=>{
|
|
112
|
+
if (regionType != 'levelTwo' || regionMode == 'region') {
|
|
113
|
+
arr.forEach((item) => {
|
|
91
114
|
//区数据集合
|
|
92
|
-
if(item?.Type==3&&item?.Deprecated==false){
|
|
93
|
-
provicesData.map(provice=>{
|
|
94
|
-
if(provice.centralCity){
|
|
95
|
-
provice.children.map(city=>{
|
|
96
|
-
if(city.code.substr(0, 2) == item.Code.substr(0,2)){
|
|
97
|
-
if(city['children'][0].type==1){
|
|
98
|
-
city['children']=[];
|
|
115
|
+
if (item?.Type == 3 && item?.Deprecated == false) {
|
|
116
|
+
provicesData.map((provice) => {
|
|
117
|
+
if (provice.centralCity) {
|
|
118
|
+
provice.children.map((city) => {
|
|
119
|
+
if (city.code.substr(0, 2) == item.Code.substr(0, 2)) {
|
|
120
|
+
if (city['children'][0].type == 1) {
|
|
121
|
+
city['children'] = [];
|
|
99
122
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
}else{
|
|
109
|
-
provice.children.map(city=>{
|
|
110
|
-
if(city.code.substr(0, 4) == item.Code.substr(0,4)){
|
|
111
|
-
if(city['children'][0].type==2){
|
|
112
|
-
city['children']=[];
|
|
123
|
+
city['children'].push({
|
|
124
|
+
label: item.Value,
|
|
125
|
+
value: item.Value,
|
|
126
|
+
code: item.Code,
|
|
127
|
+
//type:item.Type
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
provice.children.map((city) => {
|
|
133
|
+
if (city.code.substr(0, 4) == item.Code.substr(0, 4)) {
|
|
134
|
+
if (city['children'][0].type == 2) {
|
|
135
|
+
city['children'] = [];
|
|
113
136
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
137
|
+
city['children'].push({
|
|
138
|
+
label: item.Value,
|
|
139
|
+
value: item.Value,
|
|
140
|
+
code: item.Code,
|
|
141
|
+
//type:item.Type
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
});
|
|
122
145
|
}
|
|
123
|
-
|
|
124
146
|
});
|
|
125
147
|
}
|
|
126
148
|
});
|
|
127
149
|
}
|
|
128
|
-
|
|
129
150
|
}
|
|
130
151
|
return provicesData;
|
|
131
152
|
}
|
|
@@ -23,6 +23,7 @@ export default function YearPicker(props) {
|
|
|
23
23
|
onChange,
|
|
24
24
|
className,
|
|
25
25
|
placeholder,
|
|
26
|
+
size,
|
|
26
27
|
...rest
|
|
27
28
|
} = props;
|
|
28
29
|
const { classPrefix } = useConfig();
|
|
@@ -135,6 +136,7 @@ export default function YearPicker(props) {
|
|
|
135
136
|
>
|
|
136
137
|
<div className={classNames(`${classPrefix}-datepicker__input`)}>
|
|
137
138
|
<Input
|
|
139
|
+
size={size}
|
|
138
140
|
ref={inputRef}
|
|
139
141
|
disabled={disabled}
|
|
140
142
|
placeholder={placeholder}
|
|
@@ -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 =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
57
|
-
type="checkbox"
|
|
58
|
-
checked={checked}
|
|
73
|
+
value={checked}
|
|
59
74
|
disabled={disabled}
|
|
60
|
-
onChange={(
|
|
61
|
-
const
|
|
75
|
+
onChange={(value, context) => {
|
|
76
|
+
const originEvent = context.event;
|
|
62
77
|
setChecked(value);
|
|
63
|
-
events.change({ value }, {
|
|
78
|
+
events.change({ value }, { originEvent });
|
|
64
79
|
}}
|
|
65
80
|
/>
|
|
66
|
-
|
|
67
|
-
|
|
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
|
+
}
|
|
@@ -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(() =>
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
|
2
|
-
import { CommonPropsType } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { CommonPropsType } from '../../types';
|
|
3
3
|
|
|
4
4
|
export interface CommonFormPropsType extends CommonPropsType {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
+
}
|
|
@@ -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(
|
|
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
|
-
|
|
82
|
-
|
|
79
|
+
// 两次默认值不同, 需要刷新
|
|
80
|
+
const prevDefaultRef = React.useRef<any>([]);
|
|
81
|
+
React.useMemo(() => {
|
|
83
82
|
//有有效默认值时不刷新,解决初次渲染默认值不显示问题
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
81
|
-
|
|
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
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
}
|