@cloudbase/weda-ui 0.2.17 → 1.0.21
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 +3 -0
- package/package.json +6 -3
- package/src/configs/components/calendar.json +4 -1
- package/src/configs/components/chart/bar.json +19 -6
- package/src/configs/components/chart/line.json +19 -6
- package/src/configs/components/chart/pie.json +14 -4
- package/src/configs/components/chart/statisticsCard.json +61 -13
- package/src/configs/components/container.json +7 -2
- package/src/configs/components/dataView.json +21 -6
- package/src/configs/components/form/checkbox.json +97 -5
- package/src/configs/components/form/radio.json +96 -4
- package/src/configs/components/form/select.json +245 -11
- package/src/configs/components/graphicCard.json +84 -73
- package/src/configs/components/image.json +7 -2
- package/src/configs/components/link.json +19 -3
- package/src/configs/components/listView.json +63 -17
- package/src/configs/components/modal.json +37 -5
- package/src/configs/components/navLayout.json +87 -75
- package/src/configs/components/navigationBar.json +59 -0
- package/src/configs/components/richtextview.json +4 -1
- package/src/configs/components/scrollVeiw.json +74 -22
- package/src/configs/components/swiper.json +4 -1
- package/src/configs/components/tabs.json +51 -8
- package/src/configs/components/text.json +33 -25
- package/src/configs/components/wxOpenApi/phone.json +141 -0
- package/src/configs/components/wxOpenApi/phoneCode.json +121 -0
- package/src/configs/components/wxOpenApi/share.json +167 -0
- package/src/configs/components/wxOpenApi/userInfo.json +174 -0
- package/src/configs/index.js +11 -0
- package/src/mp/components/chart/bar/index.js +6 -2
- package/src/mp/components/chart/common/core/eChartBar.js +9 -8
- package/src/mp/components/chart/common/core/eChartBase.js +20 -16
- package/src/mp/components/chart/common/core/eChartLine.js +6 -5
- package/src/mp/components/chart/line/index.js +10 -6
- package/src/mp/components/chart/pie/index.js +6 -2
- package/src/mp/components/chart/statisticsCard/index.js +33 -6
- package/src/mp/components/dataView/index.json +1 -1
- package/src/mp/components/form/checkbox/index.js +41 -2
- package/src/mp/components/form/checkbox/index.wxml +1 -1
- package/src/mp/components/form/input/index.js +1 -1
- package/src/mp/components/form/location/index.js +43 -2
- package/src/mp/components/form/radio/index.js +34 -1
- package/src/mp/components/form/select/index.js +360 -40
- package/src/mp/components/form/select/index.wxml +17 -2
- package/src/mp/components/form/select/region/index.js +98 -0
- package/src/mp/components/form/uploader/index.js +39 -27
- package/src/mp/components/form/uploaderFile/index.js +10 -6
- package/src/mp/components/listView/index.js +33 -27
- package/src/mp/components/listView/index.wxml +1 -1
- package/src/mp/components/listView/index.wxss +5 -0
- package/src/mp/components/navigationBar/index.js +193 -0
- package/src/mp/components/navigationBar/index.json +6 -0
- package/src/mp/components/navigationBar/index.wxml +88 -0
- package/src/mp/components/navigationBar/index.wxss +1257 -0
- package/src/mp/components/tabs/index.js +7 -2
- package/src/mp/components/tabs/index.wxml +2 -1
- package/src/mp/components/text/index.js +0 -25
- package/src/mp/components/text/index.wxml +3 -3
- package/src/mp/components/wxOpenApi/phone/index.js +117 -0
- package/src/mp/components/{internals/listView → wxOpenApi/phone}/index.json +0 -0
- package/src/mp/components/wxOpenApi/phone/index.wxml +15 -0
- package/src/mp/components/wxOpenApi/phone/index.wxss +22 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.js +89 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.json +4 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +15 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.wxss +22 -0
- package/src/mp/components/wxOpenApi/share/index.js +117 -0
- package/src/mp/components/wxOpenApi/share/index.json +4 -0
- package/src/mp/components/wxOpenApi/share/index.wxml +15 -0
- package/src/mp/components/wxOpenApi/share/index.wxss +22 -0
- package/src/mp/components/wxOpenApi/userInfo/index.js +88 -0
- package/src/mp/components/wxOpenApi/userInfo/index.json +4 -0
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +14 -0
- package/src/mp/components/wxOpenApi/userInfo/index.wxss +22 -0
- package/src/mp/index.json +7 -2
- package/src/mp/style/weda-ui.wxss +2 -0
- package/src/mp/utils/destr.js +48 -0
- package/src/mp/utils/platform.js +10 -0
- package/src/mp/utils/tcb.js +44 -0
- package/src/web/components/button/index.css +8 -1
- package/src/web/components/button/index.tsx +3 -2
- package/src/web/components/chart/bar/index.tsx +40 -39
- package/src/web/components/chart/common/core/eChartBar.js +7 -6
- package/src/web/components/chart/common/core/eChartBase.ts +20 -16
- package/src/web/components/chart/common/core/eChartLine.js +8 -6
- package/src/web/components/chart/line/index.tsx +40 -39
- package/src/web/components/chart/statisticsCard/index.tsx +29 -8
- package/src/web/components/form/checkbox/index.tsx +55 -23
- package/src/web/components/form/radio/index.tsx +84 -53
- package/src/web/components/form/select/h5.tsx +388 -72
- package/src/web/components/form/select/index.css +10 -0
- package/src/web/components/form/select/index.tsx +404 -144
- package/src/web/components/form/select/region/index.ts +122 -31
- package/src/web/components/form/select/time.jsx +89 -0
- package/src/web/components/form/select/year.tsx +170 -0
- package/src/web/components/form/uploader/uploader.h5.tsx +9 -2
- package/src/web/components/form/uploader/uploader.pc.tsx +4 -4
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +13 -7
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +13 -5
- package/src/web/components/image/image.tsx +1 -1
- package/src/web/components/image/index.tsx +1 -1
- package/src/web/components/index.js +7 -0
- package/src/web/components/link/index.tsx +6 -3
- package/src/web/components/listView/index.css +4 -0
- package/src/web/components/listView/index.tsx +6 -1
- package/src/web/components/modal/index.tsx +3 -1
- package/src/web/components/navigationBar/chevron-right--double.svg +3 -0
- package/src/web/components/navigationBar/common.tsx +198 -0
- package/src/web/components/navigationBar/h5Menu.tsx +179 -0
- package/src/web/components/navigationBar/horizontalMenu.tsx +200 -0
- package/src/web/components/navigationBar/index.css +762 -0
- package/src/web/components/navigationBar/index.tsx +231 -0
- package/src/web/components/navigationBar/type.d.ts +111 -0
- package/src/web/components/navigationBar/verticalMenu.tsx +81 -0
- package/src/web/components/phone/index.css +0 -0
- package/src/web/components/phone/index.tsx +22 -0
- package/src/web/components/phoneCode/index.css +0 -0
- package/src/web/components/phoneCode/index.tsx +22 -0
- package/src/web/components/richTextView/index.tsx +3 -5
- package/src/web/components/share/index.css +0 -0
- package/src/web/components/share/index.tsx +38 -0
- package/src/web/components/tabs/index.tsx +2 -0
- package/src/web/components/tabs/tabs.h5.tsx +43 -33
- package/src/web/components/tabs/tabs.pc.tsx +23 -10
- package/src/web/components/text/index.tsx +6 -14
- package/src/web/components/userInfo/index.css +0 -0
- package/src/web/components/userInfo/index.tsx +30 -0
- package/src/web/utils/platform.js +9 -0
- package/src/web/utils/tcb.js +26 -0
- package/src/web/weda-ui.css +2 -0
- package/src/mp/components/internals/listView/arrow-right-line.svg +0 -3
- package/src/mp/components/internals/listView/index.js +0 -286
- package/src/mp/components/internals/listView/index.wxml +0 -40
- package/src/mp/components/internals/listView/index.wxss +0 -150
- package/src/mp/components/internals/listView/more-line.svg +0 -3
- package/src/web/components/form/select/region/cities.ts +0 -2410
- package/src/web/components/form/select/region/provinces.ts +0 -240
- package/src/web/components/form/select/region/regions.ts +0 -20645
|
@@ -1,40 +1,131 @@
|
|
|
1
|
-
// 暂时把地区信息打包在本地, 后续移到COS桶内
|
|
2
|
-
import {provinces} from './provinces';
|
|
3
|
-
import {cities} from './cities';
|
|
4
|
-
import {regions} from './regions';
|
|
5
1
|
import weui from '../../../../utils/weui';
|
|
2
|
+
import { callWedaApi } from '../../../../utils/tcb';
|
|
6
3
|
|
|
7
4
|
let tree;
|
|
8
5
|
|
|
9
|
-
export function getRegionTree() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
}),
|
|
29
|
-
};
|
|
30
|
-
}),
|
|
31
|
-
};
|
|
6
|
+
export async function getRegionTree(regionData,regionType,regionMode) {
|
|
7
|
+
tree = [];
|
|
8
|
+
tree = formatTreeData(regionData,regionType,regionMode);
|
|
9
|
+
return tree;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function regionPicker(options,regionTree:any[]) {
|
|
13
|
+
const weRegionTree =regionTree.length==0?[{label:'地区数据加载中,请关闭弹窗后重试',value:null,children:null}]:regionTree;
|
|
14
|
+
weui.picker(weRegionTree, options);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 获取运行态地区数据
|
|
18
|
+
*/
|
|
19
|
+
export async function getAreaCode() {
|
|
20
|
+
try {
|
|
21
|
+
const res = await callWedaApi({
|
|
22
|
+
action: 'QueryRuntimeAreaCode',
|
|
23
|
+
data: {Mask: "11100"},
|
|
32
24
|
});
|
|
25
|
+
return res?.AreaCodeList;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error('错误', error);
|
|
28
|
+
return {};
|
|
33
29
|
}
|
|
34
|
-
|
|
35
|
-
return tree;
|
|
36
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* 构建树形结构
|
|
33
|
+
*/
|
|
34
|
+
function formatTreeData(arr,regionType,regionMode) {
|
|
35
|
+
let provicesData = [];
|
|
36
|
+
arr.forEach(item=>{
|
|
37
|
+
//省数据集合
|
|
38
|
+
if(item?.Type==1&&item?.Deprecated==false){
|
|
39
|
+
provicesData.push({
|
|
40
|
+
label: item.Value,
|
|
41
|
+
value: item.Value,
|
|
42
|
+
code:item.Code,
|
|
43
|
+
type:item.Type,
|
|
44
|
+
centralCity:item.CentralCity,
|
|
45
|
+
children: regionType!= 'levelOne'||regionMode=='region'?[{
|
|
46
|
+
label: item.Value,
|
|
47
|
+
value: item.Value,
|
|
48
|
+
code:item.Code,
|
|
49
|
+
type:item.Type,
|
|
50
|
+
children: regionType!= 'levelTwo'||regionMode=='region'?[{
|
|
51
|
+
label: item.Value,
|
|
52
|
+
value: item.Value,
|
|
53
|
+
code:item.Code,
|
|
54
|
+
type:item.Type,
|
|
55
|
+
centralCity:item.CentralCity,
|
|
56
|
+
}]:null
|
|
57
|
+
}]:null
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
if(regionType!= 'levelOne'||regionMode=='region'){
|
|
62
|
+
arr.forEach(item=>{
|
|
63
|
+
//市数据集合
|
|
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']=[];
|
|
69
|
+
}
|
|
70
|
+
provice['children'].push({
|
|
71
|
+
label: item.Value,
|
|
72
|
+
value: item.Value,
|
|
73
|
+
code:item.Code,
|
|
74
|
+
type:item.Type,
|
|
75
|
+
centralCity:item.CentralCity,
|
|
76
|
+
children: regionType!= 'levelTwo'||regionMode=='region'?[{
|
|
77
|
+
label: item.Value,
|
|
78
|
+
value: item.Value,
|
|
79
|
+
code:item.Code,
|
|
80
|
+
type:item.Type,
|
|
81
|
+
centralCity:item.CentralCity,
|
|
82
|
+
}]:null
|
|
83
|
+
});
|
|
37
84
|
|
|
38
|
-
|
|
39
|
-
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
if(regionType != 'levelTwo'||regionMode=='region'){
|
|
90
|
+
arr.forEach(item=>{
|
|
91
|
+
//区数据集合
|
|
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']=[];
|
|
99
|
+
}
|
|
100
|
+
city['children'].push({
|
|
101
|
+
label: item.Value,
|
|
102
|
+
value: item.Value,
|
|
103
|
+
code:item.Code,
|
|
104
|
+
//type:item.Type
|
|
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']=[];
|
|
113
|
+
}
|
|
114
|
+
city['children'].push({
|
|
115
|
+
label: item.Value,
|
|
116
|
+
value: item.Value,
|
|
117
|
+
code:item.Code,
|
|
118
|
+
//type:item.Type
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
}});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
return provicesData;
|
|
40
131
|
}
|
|
@@ -54,3 +54,92 @@ export function timePicker(options) {
|
|
|
54
54
|
defaultValue,
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 年选择器
|
|
60
|
+
*/
|
|
61
|
+
export function yearPicker(options) {
|
|
62
|
+
const { startDate, endDate, defaultDate } = options;
|
|
63
|
+
if (startDate > endDate) {
|
|
64
|
+
throw 'startDate is bigger then endDate';
|
|
65
|
+
}
|
|
66
|
+
// 当前年
|
|
67
|
+
const currentYear = new Date().getFullYear();
|
|
68
|
+
// 默认传入年
|
|
69
|
+
const defaultYear = defaultDate
|
|
70
|
+
? new Date(defaultDate).getFullYear()
|
|
71
|
+
: currentYear;
|
|
72
|
+
// 最小年份
|
|
73
|
+
const minYear = startDate
|
|
74
|
+
? new Date(startDate).getFullYear()
|
|
75
|
+
: currentYear - 100;
|
|
76
|
+
// 最大年份
|
|
77
|
+
const maxYear = endDate ? new Date(endDate).getFullYear() : currentYear + 100;
|
|
78
|
+
const years = Array.from({ length: maxYear - minYear + 1 }).map(
|
|
79
|
+
(item, index) => ({
|
|
80
|
+
label: `${minYear + index}年`,
|
|
81
|
+
value: minYear + index,
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
weui.picker(years, {
|
|
85
|
+
...options,
|
|
86
|
+
defaultValue: [defaultYear],
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 年月选择器
|
|
92
|
+
*/
|
|
93
|
+
export function monthPicker(options) {
|
|
94
|
+
const { startDate, endDate, defaultDate } = options;
|
|
95
|
+
if (startDate > endDate) {
|
|
96
|
+
throw 'startDate is bigger then endDate';
|
|
97
|
+
}
|
|
98
|
+
const _getYear = (d) => d.getFullYear();
|
|
99
|
+
const _getMonth = (d) => d.getMonth() + 1;
|
|
100
|
+
// 当前年月
|
|
101
|
+
const now = new Date();
|
|
102
|
+
const [currentYear, currentMonth] = [_getYear(now), _getMonth(now)];
|
|
103
|
+
// 默认传入年月
|
|
104
|
+
const def = defaultDate ? new Date(defaultDate) : now;
|
|
105
|
+
const [defaultYear, defaultMonth] = [_getYear(def), _getMonth(def)];
|
|
106
|
+
// 最小年月
|
|
107
|
+
const min = startDate && new Date(startDate);
|
|
108
|
+
const [minYear, minMonth] = [
|
|
109
|
+
min ? _getYear(min) : currentYear - 100,
|
|
110
|
+
min ? _getMonth(min) : 1,
|
|
111
|
+
];
|
|
112
|
+
// 最大年月
|
|
113
|
+
const max = endDate && new Date(endDate);
|
|
114
|
+
const [maxYear, maxMonth] = [
|
|
115
|
+
max ? _getYear(max) : currentYear + 100,
|
|
116
|
+
max ? _getMonth(max) : 12,
|
|
117
|
+
];
|
|
118
|
+
// 年份月份
|
|
119
|
+
const years = Array.from({ length: maxYear - minYear + 1 }).map((item, i) => {
|
|
120
|
+
const year = i + minYear;
|
|
121
|
+
let months = [];
|
|
122
|
+
let [minMonthWithYear, maxMonthWithYear] = [1, 12];
|
|
123
|
+
if (year === minYear) {
|
|
124
|
+
minMonthWithYear = Math.max(minMonth, 1);
|
|
125
|
+
}
|
|
126
|
+
if (year === maxYear) {
|
|
127
|
+
maxMonthWithYear = Math.min(maxMonth, 12);
|
|
128
|
+
}
|
|
129
|
+
months = Array.from({
|
|
130
|
+
length: maxMonthWithYear - minMonthWithYear + 1,
|
|
131
|
+
}).map((item, i) => ({
|
|
132
|
+
label: `${i + minMonthWithYear}月`,
|
|
133
|
+
value: i + minMonthWithYear,
|
|
134
|
+
}));
|
|
135
|
+
return {
|
|
136
|
+
label: `${i + minYear}年`,
|
|
137
|
+
value: i + minYear,
|
|
138
|
+
children: months,
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
weui.picker(years, {
|
|
142
|
+
...options,
|
|
143
|
+
defaultValue: [defaultYear, defaultMonth],
|
|
144
|
+
});
|
|
145
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Popover,
|
|
4
|
+
ConfigProvider,
|
|
5
|
+
useConfig,
|
|
6
|
+
Input,
|
|
7
|
+
Icon,
|
|
8
|
+
Button,
|
|
9
|
+
} from 'tea-component';
|
|
10
|
+
import classNames from '../../../utils/classnames';
|
|
11
|
+
import { moment } from './index';
|
|
12
|
+
import './index.css';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* pc 版简易年份选择器
|
|
16
|
+
* 传参与 DatePicker 保持一致
|
|
17
|
+
*/
|
|
18
|
+
export default function YearPicker(props) {
|
|
19
|
+
const {
|
|
20
|
+
range = [],
|
|
21
|
+
disabled,
|
|
22
|
+
value,
|
|
23
|
+
onChange,
|
|
24
|
+
className,
|
|
25
|
+
placeholder,
|
|
26
|
+
...rest
|
|
27
|
+
} = props;
|
|
28
|
+
const { classPrefix } = useConfig();
|
|
29
|
+
const inputRef = React.useRef(null);
|
|
30
|
+
const [show, setShow] = React.useState(false);
|
|
31
|
+
const [page, setPage] = React.useState(0);
|
|
32
|
+
const [inputValue, setInputValue] = React.useState(transValueToYear(value));
|
|
33
|
+
const { pageYears, pageStart, pageEnd } = getYears(inputValue, page);
|
|
34
|
+
const [min, max] = [
|
|
35
|
+
transValueToYear(range?.[0]),
|
|
36
|
+
transValueToYear(range?.[1]),
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
setInputValue(transValueToYear(value));
|
|
41
|
+
}, [value]);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<ConfigProvider classPrefix="wedatea2td">
|
|
45
|
+
<Popover
|
|
46
|
+
trigger="click"
|
|
47
|
+
visible={show}
|
|
48
|
+
onVisibleChange={(v) => !v && setShow(v)}
|
|
49
|
+
overlay={
|
|
50
|
+
<div
|
|
51
|
+
className={classNames(
|
|
52
|
+
`${classPrefix}-dropdown-box`,
|
|
53
|
+
'year-picker__overlay'
|
|
54
|
+
)}
|
|
55
|
+
>
|
|
56
|
+
<div
|
|
57
|
+
className={classNames(
|
|
58
|
+
`${classPrefix}-calendar__caption`,
|
|
59
|
+
'year-picker__header'
|
|
60
|
+
)}
|
|
61
|
+
>
|
|
62
|
+
<div className="year-picker__header-title">
|
|
63
|
+
{pageStart}-{pageEnd}
|
|
64
|
+
</div>
|
|
65
|
+
<div className="year-picker__header-actions">
|
|
66
|
+
<Button
|
|
67
|
+
type="link"
|
|
68
|
+
icon="arrowleft"
|
|
69
|
+
title="上二十年"
|
|
70
|
+
onClick={() => setPage((d) => d - 1)}
|
|
71
|
+
/>
|
|
72
|
+
<Button
|
|
73
|
+
type="link"
|
|
74
|
+
icon="cur-active"
|
|
75
|
+
title="当前二十年"
|
|
76
|
+
onClick={() => setPage(0)}
|
|
77
|
+
/>
|
|
78
|
+
<Button
|
|
79
|
+
type="link"
|
|
80
|
+
icon="arrowright"
|
|
81
|
+
title="下二十年"
|
|
82
|
+
onClick={() => setPage((d) => d + 1)}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
<div
|
|
87
|
+
className={classNames(
|
|
88
|
+
`${classPrefix}-calendar__type--year`,
|
|
89
|
+
'year-picker__body'
|
|
90
|
+
)}
|
|
91
|
+
>
|
|
92
|
+
{pageYears.map((list) => (
|
|
93
|
+
<div
|
|
94
|
+
key={list.join()}
|
|
95
|
+
className={classNames(`${classPrefix}-calendar__row`)}
|
|
96
|
+
>
|
|
97
|
+
{list.map((item) => {
|
|
98
|
+
const isSelected = item === inputValue;
|
|
99
|
+
const isDisabled =
|
|
100
|
+
(min && Number(item) < Number(min)) ||
|
|
101
|
+
(max && Number(item) > Number(max));
|
|
102
|
+
return (
|
|
103
|
+
<div
|
|
104
|
+
key={item}
|
|
105
|
+
className={classNames(
|
|
106
|
+
`${classPrefix}-calendar__cell`,
|
|
107
|
+
'year-picker__cell',
|
|
108
|
+
{
|
|
109
|
+
'is-selected': isSelected,
|
|
110
|
+
'is-disabled': isDisabled,
|
|
111
|
+
}
|
|
112
|
+
)}
|
|
113
|
+
onClick={() => {
|
|
114
|
+
if (isDisabled) return;
|
|
115
|
+
setShow(false);
|
|
116
|
+
setInputValue(item);
|
|
117
|
+
onChange?.(moment(item));
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<span>{item}</span>
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
})}
|
|
124
|
+
</div>
|
|
125
|
+
))}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
}
|
|
129
|
+
>
|
|
130
|
+
<div
|
|
131
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
132
|
+
{...rest}
|
|
133
|
+
onClick={() => !disabled && setShow(true)}
|
|
134
|
+
className={classNames(`${classPrefix}-datepicker`, className)}
|
|
135
|
+
>
|
|
136
|
+
<div className={classNames(`${classPrefix}-datepicker__input`)}>
|
|
137
|
+
<Input
|
|
138
|
+
ref={inputRef}
|
|
139
|
+
disabled={disabled}
|
|
140
|
+
placeholder={placeholder}
|
|
141
|
+
value={inputValue}
|
|
142
|
+
onFocus={() => inputRef.current.blur()}
|
|
143
|
+
/>
|
|
144
|
+
<Icon type="dismiss" />
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
</Popover>
|
|
148
|
+
</ConfigProvider>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* 获取当前20年,page 表示分页,1表示下一页,-1表示上一页
|
|
154
|
+
* @returns [][]
|
|
155
|
+
*/
|
|
156
|
+
const getYears = (currentYear, page = 0, range = []) => {
|
|
157
|
+
currentYear = currentYear || new Date().getFullYear();
|
|
158
|
+
const startYear = (Math.floor(parseInt(currentYear) / 20) + page) * 20;
|
|
159
|
+
const pageYears = Array.from({ length: 5 }).map((item, i1) =>
|
|
160
|
+
Array.from({ length: 4 }).map((item, i2) => i1 * 4 + i2 + startYear + '')
|
|
161
|
+
);
|
|
162
|
+
return { pageYears, pageStart: startYear, pageEnd: startYear + 20 - 1 };
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* 输入 moment 值转 string 年份
|
|
167
|
+
*/
|
|
168
|
+
const transValueToYear = (val) => {
|
|
169
|
+
return moment.isMoment(val) ? val.format('YYYY') : '';
|
|
170
|
+
};
|
|
@@ -106,6 +106,7 @@ export function ImageUploaderH5({
|
|
|
106
106
|
fileID && setInputValue((list) => [...list, fileID]);
|
|
107
107
|
fileID && events.success && events.success({ value: fileID, file });
|
|
108
108
|
} catch (err) {
|
|
109
|
+
weui.alert(`${err}` || '上传失败');
|
|
109
110
|
events.error && events.error(err);
|
|
110
111
|
} finally {
|
|
111
112
|
setUploading(false);
|
|
@@ -120,6 +121,13 @@ export function ImageUploaderH5({
|
|
|
120
121
|
: Array.from(new Set(acceptTypes));
|
|
121
122
|
}, [acceptTypes]);
|
|
122
123
|
|
|
124
|
+
const showAdd = React.useMemo(() => {
|
|
125
|
+
if(single) {
|
|
126
|
+
// single 模式时,仅当数组为空时显示
|
|
127
|
+
return fileIdList.length < 1;
|
|
128
|
+
}
|
|
129
|
+
return fileIdList.length < maxUploadCount;
|
|
130
|
+
}, [fileIdList, single, maxUploadCount]);
|
|
123
131
|
return (
|
|
124
132
|
<div className={cls} id={id} style={style}>
|
|
125
133
|
<div className="weui-cell">
|
|
@@ -148,8 +156,7 @@ export function ImageUploaderH5({
|
|
|
148
156
|
</li>
|
|
149
157
|
)}
|
|
150
158
|
</ul>
|
|
151
|
-
{
|
|
152
|
-
(single && fileIdList.length < 1)) && ( // single 模式时,仅当数组为空时显示
|
|
159
|
+
{showAdd && (
|
|
153
160
|
<div className="weui-uploader__input-box">
|
|
154
161
|
<input
|
|
155
162
|
id="uploaderInput"
|
|
@@ -80,7 +80,6 @@ export function UploaderPCInner(props) {
|
|
|
80
80
|
// 文件列表
|
|
81
81
|
const [fileIDList, setfileIDList] = React.useState([]);
|
|
82
82
|
const fileRef = React.useRef(fileIDList);
|
|
83
|
-
|
|
84
83
|
React.useEffect(() => {
|
|
85
84
|
let initialValue = []
|
|
86
85
|
.concat(defaultValue)
|
|
@@ -89,7 +88,7 @@ export function UploaderPCInner(props) {
|
|
|
89
88
|
initialValue = initialValue[0] ? [initialValue[0]] : [];
|
|
90
89
|
}
|
|
91
90
|
setfileIDList(initialValue);
|
|
92
|
-
}, []);
|
|
91
|
+
}, [defaultValue]);
|
|
93
92
|
|
|
94
93
|
// 值变化事件
|
|
95
94
|
React.useEffect(() => {
|
|
@@ -141,8 +140,9 @@ export function UploaderPCInner(props) {
|
|
|
141
140
|
});
|
|
142
141
|
fileID && setfileIDList((list) => [...list, fileID]);
|
|
143
142
|
fileID && events.success && events.success({ value: fileID, file });
|
|
144
|
-
} catch (
|
|
145
|
-
|
|
143
|
+
} catch (err) {
|
|
144
|
+
message.error({ content: `${err}` || '上传失败' });
|
|
145
|
+
events.error && events.error(err);
|
|
146
146
|
} finally {
|
|
147
147
|
setUploading(false);
|
|
148
148
|
setProgress(0);
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import * as PropTypes from 'prop-types';
|
|
3
3
|
import weui from '../../../utils/weui';
|
|
4
4
|
import { CommonFormPropsType } from '../types';
|
|
5
|
-
|
|
5
|
+
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
6
6
|
import {
|
|
7
7
|
Upload,
|
|
8
8
|
ConfigProvider,
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
|
|
27
27
|
import classNames from '../../../utils/classnames';
|
|
28
28
|
import { renderDecorator } from '../renderDecorator';
|
|
29
|
-
|
|
30
29
|
// 默认组件类前缀
|
|
31
30
|
const CLASS_PREFIX = 'weda-upload-file-mobile';
|
|
32
31
|
// 默认图片类型
|
|
@@ -75,11 +74,18 @@ export function UploadFileH5({
|
|
|
75
74
|
onChange = null,
|
|
76
75
|
isEdit = true,
|
|
77
76
|
}: IUploadFileH5) {
|
|
78
|
-
const [fileIDList, setfileIDList] = React.useState(
|
|
79
|
-
filterStrList([].concat(defaultValue, value))
|
|
80
|
-
); // 上传成功文件ID列表,fileID[]
|
|
77
|
+
const [fileIDList, setfileIDList] = React.useState(filterStrList([].concat(defaultValue, value))); // 上传成功文件ID列表,fileID[]
|
|
81
78
|
const [fileList, setFileList] = React.useState([]); // 上传中的文件列表,file[],file为原始文件 + uuid属性
|
|
82
79
|
const [fileSizeObj, setFileSizeObj] = React.useState({}); // 管理上传文件大小 {uuid:size}
|
|
80
|
+
// 两次默认值不同, 需要刷新
|
|
81
|
+
const prevDefaultRef = React.useRef<any>([]);
|
|
82
|
+
React.useMemo(()=>{
|
|
83
|
+
//有有效默认值时不刷新,解决初次渲染默认值不显示问题
|
|
84
|
+
if(defaultValue&&!isObjectEqual(prevDefaultRef.current,defaultValue)&&(JSON.stringify(prevDefaultRef.current)=='[]'||!prevDefaultRef.current)){
|
|
85
|
+
prevDefaultRef.current =defaultValue;
|
|
86
|
+
setfileIDList(filterStrList([].concat(defaultValue)));
|
|
87
|
+
}
|
|
88
|
+
},[defaultValue]);
|
|
83
89
|
React.useEffect(() => {
|
|
84
90
|
// 外部 onChange 事件
|
|
85
91
|
const pureFileIDList = fileIDList.filter(
|
|
@@ -115,9 +121,9 @@ export function UploadFileH5({
|
|
|
115
121
|
// 上传时新增事件
|
|
116
122
|
if (type === 'add') {
|
|
117
123
|
fileID && setFileSizeObj((obj) => ({ ...obj, [fileID]: size }));
|
|
118
|
-
fileID && setfileIDList(
|
|
124
|
+
fileID && setfileIDList([...fileIDList, fileID]);
|
|
119
125
|
} else {
|
|
120
|
-
fileID && setfileIDList(
|
|
126
|
+
fileID && setfileIDList(fileIDList.filter((f) => f !== fileID));
|
|
121
127
|
}
|
|
122
128
|
uuid && setFileList((list) => list.filter((item) => uuid !== item?._uuid));
|
|
123
129
|
};
|
|
@@ -22,6 +22,7 @@ import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
|
|
|
22
22
|
import classNames from '../../../utils/classnames';
|
|
23
23
|
import { renderDecorator } from '../renderDecorator';
|
|
24
24
|
import { CommonFormPropsType } from '../types';
|
|
25
|
+
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
25
26
|
|
|
26
27
|
// 默认组件类前缀
|
|
27
28
|
const CLASS_PREFIX = 'weda-upload-file-pc';
|
|
@@ -67,12 +68,20 @@ export function UploadFilePc({
|
|
|
67
68
|
onChange = null,
|
|
68
69
|
isEdit = true,
|
|
69
70
|
}: IUploaderFilePc) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
); // 上传成功文件ID列表,fileID[]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
const [fileIDList, setfileIDList] = React.useState(filterStrList([].concat(defaultValue, value))); // 上传成功文件ID列表,fileID[]
|
|
73
74
|
const [fileList, setFileList] = React.useState([]); // 上传中的文件列表,file[],file为原始文件 + uuid属性
|
|
74
75
|
const [fileSizeObj, setFileSizeObj] = React.useState({}); // 管理上传文件大小 {uuid:size}
|
|
75
|
-
|
|
76
|
+
// 两次默认值不同, 需要刷新
|
|
77
|
+
const prevDefaultRef = React.useRef<any>([]);
|
|
78
|
+
React.useMemo(()=>{
|
|
79
|
+
//有有效默认值时不刷新,解决初次渲染默认值不显示问题
|
|
80
|
+
if(defaultValue&&!isObjectEqual(prevDefaultRef.current,defaultValue)&&(JSON.stringify(prevDefaultRef.current)=='[]'||!prevDefaultRef.current)){
|
|
81
|
+
prevDefaultRef.current =defaultValue;
|
|
82
|
+
setfileIDList(filterStrList([].concat(defaultValue)));
|
|
83
|
+
}
|
|
84
|
+
},[defaultValue]);
|
|
76
85
|
React.useEffect(() => {
|
|
77
86
|
// 外部 onChange 事件
|
|
78
87
|
const pureFileIDList = fileIDList.filter(
|
|
@@ -89,7 +98,6 @@ export function UploadFilePc({
|
|
|
89
98
|
events?.success?.({ value: pureFileIDList });
|
|
90
99
|
}
|
|
91
100
|
}, [fileIDList]);
|
|
92
|
-
|
|
93
101
|
// 外层组件类
|
|
94
102
|
const cls = classNames({
|
|
95
103
|
'weda-ui': true,
|
|
@@ -72,6 +72,7 @@ export { default as NavLayout } from './navLayout';
|
|
|
72
72
|
|
|
73
73
|
// Data Contaier
|
|
74
74
|
export { default as ListView } from './listView';
|
|
75
|
+
export { default as NavigationBar } from './navigationBar';
|
|
75
76
|
export { default as Line } from './chart/line';
|
|
76
77
|
export { default as Bar } from './chart/bar';
|
|
77
78
|
export { default as Pie } from './chart/pie';
|
|
@@ -79,6 +80,12 @@ export { default as DataView } from './dataView';
|
|
|
79
80
|
|
|
80
81
|
export { default as StatisticsCard } from './chart/statisticsCard';
|
|
81
82
|
export { default as GraphicCard } from './graphicCard';
|
|
83
|
+
|
|
84
|
+
export { default as UserInfo } from './userInfo';
|
|
85
|
+
export { default as Phone } from './phone';
|
|
86
|
+
export { default as PhoneCode } from './phoneCode';
|
|
87
|
+
export { default as Share } from './share';
|
|
88
|
+
|
|
82
89
|
// open
|
|
83
90
|
// import Auth from './auth';
|
|
84
91
|
|
|
@@ -17,6 +17,7 @@ export interface PropsType extends CommonPropsType {
|
|
|
17
17
|
*/
|
|
18
18
|
params?: {key: string, value: string}[];
|
|
19
19
|
contentSlot?: React.ReactNode;
|
|
20
|
+
isOpenInNewWindow: boolean;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
// 所有绝对地址直接交由浏览器,新开窗口交由浏览器
|
|
@@ -28,7 +29,8 @@ export default function Link({
|
|
|
28
29
|
style,
|
|
29
30
|
className,
|
|
30
31
|
contentSlot,
|
|
31
|
-
params = [], // TODO
|
|
32
|
+
params = [], // TODO 格式定义,
|
|
33
|
+
isOpenInNewWindow = false,
|
|
32
34
|
}: PropsType) {
|
|
33
35
|
url = url.trim();
|
|
34
36
|
const cls = classNames({
|
|
@@ -91,6 +93,7 @@ export default function Link({
|
|
|
91
93
|
<a
|
|
92
94
|
style={{ ...style }}
|
|
93
95
|
className={cls}
|
|
96
|
+
target={isOpenInNewWindow ? '_blank' : '_self'}
|
|
94
97
|
href={href}
|
|
95
98
|
onClick={(e) => {
|
|
96
99
|
events.tap && events.tap({}, { originEvent: e });
|
|
@@ -107,10 +110,10 @@ export default function Link({
|
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
}}
|
|
110
|
-
rel=
|
|
113
|
+
rel='noopener noreferrer'
|
|
111
114
|
>
|
|
112
115
|
{contentSlot && <div className="weda-link-slot">{contentSlot}</div>}
|
|
113
116
|
{content}
|
|
114
117
|
</a>
|
|
115
118
|
);
|
|
116
|
-
}
|
|
119
|
+
}
|
|
@@ -60,6 +60,10 @@
|
|
|
60
60
|
.weda-list-view__containor .weda-list-view__more {
|
|
61
61
|
background-color: #fff;
|
|
62
62
|
}
|
|
63
|
+
.weda-list-view__containor
|
|
64
|
+
.weda-list-view__more.weda-list-view__more-bottomLoad {
|
|
65
|
+
background-color: transparent;
|
|
66
|
+
}
|
|
63
67
|
.weda-list-view__containor
|
|
64
68
|
.weda-list-view__more
|
|
65
69
|
.weda-list-view__more-pagination {
|
|
@@ -344,7 +344,12 @@ export default function ListView(props: IListView) {
|
|
|
344
344
|
{children}
|
|
345
345
|
</div>
|
|
346
346
|
)}
|
|
347
|
-
<div
|
|
347
|
+
<div
|
|
348
|
+
className={classNames(
|
|
349
|
+
`${BLOCK_NAME}__more`,
|
|
350
|
+
`${BLOCK_NAME}__more-${pagination}`
|
|
351
|
+
)}
|
|
352
|
+
>
|
|
348
353
|
{pagination === 'bottomLoad' && renderBottomLoad()}
|
|
349
354
|
{pagination === 'loadMoreButton' && renderLoadMore()}
|
|
350
355
|
{pagination === 'pagination' && renderPagination()}
|