@cloudbase/weda-ui 2.0.10 → 2.0.11
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/package.json +9 -2
- package/src/mp/components/button/index.js +1 -1
- package/src/mp/components/button/index.wxml +19 -19
- package/src/mp/components/calendar/index.js +64 -37
- package/src/mp/components/calendar/index.wxml +28 -8
- package/src/mp/components/carousel/index.wxml +30 -3
- package/src/mp/components/chart/bar/index.js +1 -2
- package/src/mp/components/chart/bar/index.wxml +7 -2
- package/src/mp/components/chart/common/config/bar.js +1 -1
- package/src/mp/components/chart/common/core/eChartBar.js +29 -34
- package/src/mp/components/chart/common/core/eChartBase.js +46 -32
- package/src/mp/components/chart/common/core/eChartLine.js +34 -40
- package/src/mp/components/chart/common/core/eChartPie.js +12 -9
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +19 -2
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +24 -22
- package/src/mp/components/chart/line/index.js +2 -2
- package/src/mp/components/chart/line/index.wxml +7 -2
- package/src/mp/components/chart/pie/index.js +1 -1
- package/src/mp/components/chart/pie/index.wxml +7 -3
- package/src/mp/components/chart/statisticsCard/index.wxml +5 -1
- package/src/mp/components/dataView/index.wxml +2 -2
- package/src/mp/components/form/checkbox/index.js +10 -6
- package/src/mp/components/form/checkbox/index.wxml +26 -23
- package/src/mp/components/form/form/index.wxml +3 -3
- package/src/mp/components/form/formcell/index.wxml +9 -9
- package/src/mp/components/form/formcell/index.wxss +1 -1
- package/src/mp/components/form/input/index.js +3 -3
- package/src/mp/components/form/input/index.wxml +36 -30
- package/src/mp/components/form/input/index.wxss +2 -2
- package/src/mp/components/form/location/components/mapChoose/index.wxml +59 -12
- package/src/mp/components/form/location/index.wxml +39 -7
- package/src/mp/components/form/radio/index.js +9 -5
- package/src/mp/components/form/radio/index.wxml +23 -23
- package/src/mp/components/form/select/index.js +156 -97
- package/src/mp/components/form/select/index.wxml +39 -37
- package/src/mp/components/form/select/index.wxss +1 -1
- package/src/mp/components/form/select/region/index.js +18 -12
- package/src/mp/components/form/switch/index.wxml +20 -16
- package/src/mp/components/form/textarea/index.wxml +12 -8
- package/src/mp/components/form/tips/index.wxml +1 -3
- package/src/mp/components/form/uploader/index.js +1 -1
- package/src/mp/components/form/uploader/index.wxml +19 -18
- package/src/mp/components/form/uploader/weui-uploader.js +210 -200
- package/src/mp/components/form/uploader/weui-uploader.wxml +81 -38
- package/src/mp/components/form/uploaderFile/index.js +5 -4
- package/src/mp/components/form/uploaderFile/index.wxml +97 -41
- package/src/mp/components/graphicCard/index.js +26 -24
- package/src/mp/components/graphicCard/index.wxml +30 -6
- package/src/mp/components/image/index.wxml +25 -18
- package/src/mp/components/image/index.wxss +3 -1
- package/src/mp/components/listView/index.wxml +34 -11
- package/src/mp/components/lottery/index.wxml +29 -7
- package/src/mp/components/lottery/index.wxss +31 -25
- package/src/mp/components/navLayout/index.wxml +29 -7
- package/src/mp/components/navigationBar/index.wxml +162 -53
- package/src/mp/components/swiper/index.wxml +12 -7
- package/src/mp/components/tabs/index.js +14 -10
- package/src/mp/components/tabs/index.wxml +2 -1
- package/src/mp/components/text/index.wxml +2 -1
- package/src/mp/components/text/index.wxss +1 -1
- package/src/mp/components/wxOpenApi/phone/index.wxml +11 -12
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +11 -12
- package/src/mp/components/wxOpenApi/share/index.wxml +11 -12
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +10 -11
- package/src/mp/style/weda-ui.wxss +8 -3
- package/src/mp/utils/deepEqual.js +37 -37
- package/src/mp/utils/destr.js +41 -40
- package/src/mp/utils/dr_square_point.js +10 -6
- package/src/setupTests.js +13 -13
- package/src/web/components/button/index.tsx +44 -40
- package/src/web/components/carousel/index.tsx +1 -1
- package/src/web/components/chart/common/config/bar.js +1 -1
- package/src/web/components/chart/common/core/eChartBar.js +28 -34
- package/src/web/components/chart/common/core/eChartLine.js +34 -40
- package/src/web/components/chart/common/core/eChartPie.js +12 -9
- package/src/web/components/form/form/index.tsx +5 -5
- package/src/web/components/form/formcell/index.css +5 -1
- package/src/web/components/form/formcell/index.tsx +1 -1
- package/src/web/components/form/select/h5.tsx +154 -103
- package/src/web/components/form/select/index.css +0 -3
- package/src/web/components/form/textarea/index.tsx +1 -1
- package/src/web/components/form/uploader/uploader.h5.tsx +26 -20
- package/src/web/components/image/index.tsx +1 -1
- package/src/web/components/link/index.tsx +1 -1
- package/src/web/components/navLayout/index.tsx +1 -1
- package/src/web/components/navigationBar/index.tsx +2 -2
- package/src/web/components/picker/timePicker.tsx +1 -1
- package/src/web/components/text/index.tsx +13 -14
- package/src/web/utils/isObjectEqual.js +2 -1
- package/src/web/weda-ui.css +4 -0
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
.weda-formcells__flag {
|
|
2
2
|
display: inline-block;
|
|
3
|
-
margin-
|
|
3
|
+
margin-left: 4px;
|
|
4
4
|
font-family: SimSun;
|
|
5
5
|
font-size: 12px;
|
|
6
6
|
color: #f60;
|
|
7
7
|
align-self: flex-start;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
.weda-formcells__label.weui-cell {
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
.weda-ui .weui-cells__group_form .weui-cells {
|
|
11
15
|
margin: 0;
|
|
12
16
|
}
|
|
@@ -4,7 +4,7 @@ import classNames from '../../../utils/classnames';
|
|
|
4
4
|
import './index.css';
|
|
5
5
|
import { usePlatform } from '../../../utils/platform';
|
|
6
6
|
import { ConfigProvider, Form as TeaForm } from 'tea-component';
|
|
7
|
-
import { CommonFormPropsType } from '../types';
|
|
7
|
+
import type { CommonFormPropsType } from '../types';
|
|
8
8
|
|
|
9
9
|
export default function FormCell({
|
|
10
10
|
className,
|
|
@@ -2,8 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import weui from '../../../utils/weui';
|
|
3
3
|
import classNames from '../../../utils/classnames';
|
|
4
4
|
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
5
|
-
import { regionPicker,getRegionTree,getAreaCode } from './region/index';
|
|
6
|
-
import { PropsType
|
|
5
|
+
import { regionPicker, getRegionTree, getAreaCode } from './region/index';
|
|
6
|
+
import { PropsType, defaultProps, moment } from './index';
|
|
7
7
|
import { timePicker, yearPicker, monthPicker } from './time';
|
|
8
8
|
import { callDataSource, callWedaApi } from '../../../utils/tcb';
|
|
9
9
|
import destr from 'destr';
|
|
@@ -12,7 +12,7 @@ import { isNil } from '../../../utils/lodash';
|
|
|
12
12
|
|
|
13
13
|
export default function Select({
|
|
14
14
|
// 系统属性
|
|
15
|
-
events = {change: null },
|
|
15
|
+
events = { change: null },
|
|
16
16
|
// 组件属性
|
|
17
17
|
name,
|
|
18
18
|
placeholder,
|
|
@@ -43,20 +43,20 @@ export default function Select({
|
|
|
43
43
|
defaultMutiRegion,
|
|
44
44
|
regionType,
|
|
45
45
|
separator,
|
|
46
|
-
onChange
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
onChange,
|
|
47
|
+
}: //regionTree,
|
|
48
|
+
PropsType) {
|
|
49
49
|
const [date, setDate] = React.useState(
|
|
50
50
|
decodeIsoDatetime(defaultDate, 'date', dateMode)
|
|
51
51
|
);
|
|
52
52
|
const [time, setTime] = React.useState(
|
|
53
53
|
decodeIsoDatetime(defaultTime, 'time')
|
|
54
54
|
);
|
|
55
|
-
const [regioDepth,setRegionDepth] = React.useState(3);
|
|
56
|
-
const [regionData,setRegionData] = React.useState([]);
|
|
57
|
-
const [regionTree,setRegionTree] = React.useState([]);
|
|
55
|
+
const [regioDepth, setRegionDepth] = React.useState(3);
|
|
56
|
+
const [regionData, setRegionData] = React.useState([]);
|
|
57
|
+
const [regionTree, setRegionTree] = React.useState([]);
|
|
58
58
|
const [region, setRegion] = React.useState(defaultRegion);
|
|
59
|
-
const [mutiRegion,setMutiRegion]=React.useState([]);
|
|
59
|
+
const [mutiRegion, setMutiRegion] = React.useState([]);
|
|
60
60
|
const [typeRegion, setTypeRegion] = React.useState(regionType);
|
|
61
61
|
const [selectedValue, setSelectedValue] = React.useState(defaultValue);
|
|
62
62
|
const [option, setOption] = React.useState([{ label: '', value: '' }]);
|
|
@@ -64,7 +64,7 @@ export default function Select({
|
|
|
64
64
|
|
|
65
65
|
// 两次默认值不同, 需要刷新
|
|
66
66
|
const prevDefaultRef = React.useRef<any>({});
|
|
67
|
-
React.useEffect(
|
|
67
|
+
React.useEffect(() => {
|
|
68
68
|
let hasChange = false;
|
|
69
69
|
if (prevDefaultRef.current?.defaultValue !== defaultValue) {
|
|
70
70
|
setSelectedValue(defaultValue);
|
|
@@ -82,10 +82,14 @@ export default function Select({
|
|
|
82
82
|
setRegion(defaultRegion);
|
|
83
83
|
hasChange = true;
|
|
84
84
|
}
|
|
85
|
-
if (
|
|
86
|
-
|
|
85
|
+
if (
|
|
86
|
+
!isObjectEqual(
|
|
87
|
+
prevDefaultRef.current?.defaultMutiRegion,
|
|
88
|
+
defaultMutiRegion
|
|
89
|
+
)
|
|
90
|
+
) {
|
|
87
91
|
//setMutiRegion((defaultMutiRegion || ".").split(','));
|
|
88
|
-
setMutiRegion(defaultMutiRegion?defaultMutiRegion.split(','):[]);
|
|
92
|
+
setMutiRegion(defaultMutiRegion ? defaultMutiRegion.split(',') : []);
|
|
89
93
|
hasChange = true;
|
|
90
94
|
}
|
|
91
95
|
if (prevDefaultRef.current?.regionType !== regionType) {
|
|
@@ -98,57 +102,57 @@ export default function Select({
|
|
|
98
102
|
defaultDate,
|
|
99
103
|
defaultTime,
|
|
100
104
|
defaultRegion,
|
|
101
|
-
defaultMutiRegion
|
|
105
|
+
defaultMutiRegion,
|
|
102
106
|
};
|
|
103
107
|
}
|
|
104
|
-
|
|
105
108
|
});
|
|
106
109
|
//实现初始值触发change事件
|
|
107
|
-
const defaultMutiRegionChange = function(treeValue,defaultMutiRegion){
|
|
108
|
-
const defaultValue =defaultMutiRegion
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
const defaultMutiRegionChange = function (treeValue, defaultMutiRegion) {
|
|
111
|
+
const defaultValue = defaultMutiRegion
|
|
112
|
+
? defaultMutiRegion.split(',')
|
|
113
|
+
: null;
|
|
114
|
+
const changeValue = [];
|
|
115
|
+
if (Array.isArray(defaultValue) && defaultValue.length > 0) {
|
|
116
|
+
defaultValue.forEach((element) => {
|
|
117
|
+
treeValue.map((item) => {
|
|
118
|
+
if (item?.Value == element) {
|
|
114
119
|
changeValue.push({
|
|
115
|
-
value:item?.Value,
|
|
116
|
-
code:item?.Code
|
|
117
|
-
}
|
|
118
|
-
);
|
|
120
|
+
value: item?.Value,
|
|
121
|
+
code: item?.Code,
|
|
122
|
+
});
|
|
119
123
|
}
|
|
120
|
-
|
|
124
|
+
});
|
|
121
125
|
});
|
|
122
126
|
|
|
123
|
-
events?.change?.({ value:defaultMutiRegion,result:changeValue });
|
|
127
|
+
events?.change?.({ value: defaultMutiRegion, result: changeValue });
|
|
124
128
|
}
|
|
125
129
|
};
|
|
126
|
-
const regionTreeMode = React.useMemo(()=>{
|
|
127
|
-
if(
|
|
128
|
-
if(regionData.length<1){
|
|
129
|
-
getAreaCode().then((value)=>{
|
|
130
|
-
defaultMutiRegionChange(value,defaultMutiRegion);
|
|
130
|
+
const regionTreeMode = React.useMemo(() => {
|
|
131
|
+
if (mode == 'region' || mode == 'mutiRegion') {
|
|
132
|
+
if (regionData.length < 1) {
|
|
133
|
+
getAreaCode().then((value) => {
|
|
134
|
+
defaultMutiRegionChange(value, defaultMutiRegion);
|
|
131
135
|
setRegionData(value);
|
|
132
|
-
getRegionTree(value,regionType,mode).then(tree=>{
|
|
136
|
+
getRegionTree(value, regionType, mode).then((tree) => {
|
|
133
137
|
setRegionTree(tree);
|
|
134
138
|
});
|
|
135
139
|
});
|
|
136
|
-
}else{
|
|
137
|
-
getRegionTree(regionData,regionType,mode).then(tree=>{
|
|
140
|
+
} else {
|
|
141
|
+
getRegionTree(regionData, regionType, mode).then((tree) => {
|
|
138
142
|
setRegionTree(tree);
|
|
139
143
|
});
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
|
-
switch(regionType){
|
|
143
|
-
case 'levelOne':{
|
|
146
|
+
switch (regionType) {
|
|
147
|
+
case 'levelOne': {
|
|
144
148
|
setRegionDepth(1);
|
|
145
149
|
break;
|
|
146
150
|
}
|
|
147
|
-
case 'levelTwo':{
|
|
151
|
+
case 'levelTwo': {
|
|
148
152
|
setRegionDepth(2);
|
|
149
153
|
break;
|
|
150
154
|
}
|
|
151
|
-
case 'levelThree':{
|
|
155
|
+
case 'levelThree': {
|
|
152
156
|
setRegionDepth(3);
|
|
153
157
|
break;
|
|
154
158
|
}
|
|
@@ -156,18 +160,21 @@ export default function Select({
|
|
|
156
160
|
break;
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
|
-
|
|
160
|
-
},[regionType,mode,regionData]);
|
|
163
|
+
}, [regionType, mode, regionData]);
|
|
161
164
|
|
|
162
165
|
React.useEffect(() => {
|
|
163
166
|
// tcb过滤参数
|
|
164
167
|
const whereEffected = [].concat(getWhereList(where));
|
|
165
|
-
if (
|
|
168
|
+
if (
|
|
169
|
+
(format === 'father-son' || format === 'related') &&
|
|
170
|
+
dataSourceName &&
|
|
171
|
+
viewId
|
|
172
|
+
) {
|
|
166
173
|
fetchData({
|
|
167
174
|
dataSourceName: dataSourceName,
|
|
168
175
|
viewId: viewId,
|
|
169
176
|
methodName: 'wedaGetRecords',
|
|
170
|
-
params: whereEffected
|
|
177
|
+
params: whereEffected,
|
|
171
178
|
});
|
|
172
179
|
}
|
|
173
180
|
}, [where]);
|
|
@@ -175,10 +182,10 @@ export default function Select({
|
|
|
175
182
|
// 获取数据列表中主列字段,将其作为选项
|
|
176
183
|
React.useEffect(() => {
|
|
177
184
|
if (records && records.length !== 0 && primaryField) {
|
|
178
|
-
const option = records.map(item => {
|
|
185
|
+
const option = records.map((item) => {
|
|
179
186
|
return {
|
|
180
187
|
label: item[primaryField],
|
|
181
|
-
value: item._id
|
|
188
|
+
value: item._id,
|
|
182
189
|
};
|
|
183
190
|
});
|
|
184
191
|
setOption(option);
|
|
@@ -187,10 +194,10 @@ export default function Select({
|
|
|
187
194
|
|
|
188
195
|
// 获取数据列表
|
|
189
196
|
const fetchData = async (param: {
|
|
190
|
-
dataSourceName?: string
|
|
191
|
-
viewId?: string
|
|
192
|
-
methodName?: string
|
|
193
|
-
params?: any
|
|
197
|
+
dataSourceName?: string;
|
|
198
|
+
viewId?: string;
|
|
199
|
+
methodName?: string;
|
|
200
|
+
params?: any;
|
|
194
201
|
}) => {
|
|
195
202
|
let pageNo = 1;
|
|
196
203
|
let pageSize = 200;
|
|
@@ -204,7 +211,7 @@ export default function Select({
|
|
|
204
211
|
params: {
|
|
205
212
|
where: param.params,
|
|
206
213
|
pageNo: pageNo,
|
|
207
|
-
pageSize: pageSize
|
|
214
|
+
pageSize: pageSize,
|
|
208
215
|
},
|
|
209
216
|
});
|
|
210
217
|
pageNo = pageNo + 1;
|
|
@@ -212,7 +219,6 @@ export default function Select({
|
|
|
212
219
|
total = data?.total || 0;
|
|
213
220
|
records = records.concat(data?.records);
|
|
214
221
|
}
|
|
215
|
-
|
|
216
222
|
}
|
|
217
223
|
|
|
218
224
|
if (records) {
|
|
@@ -228,15 +234,17 @@ export default function Select({
|
|
|
228
234
|
}, [enumName]);
|
|
229
235
|
|
|
230
236
|
// 获取自定义选项集
|
|
231
|
-
const fetchEnumData = async (param:
|
|
232
|
-
|
|
233
|
-
|
|
237
|
+
const fetchEnumData = async (param: {
|
|
238
|
+
OptNameList?: object;
|
|
239
|
+
PageIndex?: number;
|
|
240
|
+
PageSize?: number;
|
|
241
|
+
}) => {
|
|
234
242
|
let data = await callWedaApi({
|
|
235
243
|
action: 'DescribeGeneralOptionsDetailList',
|
|
236
244
|
data: param,
|
|
237
245
|
});
|
|
238
246
|
const config = destr(data?.Items[0]?.Config) ?? [];
|
|
239
|
-
const enumOption = config.map(item => {
|
|
247
|
+
const enumOption = config.map((item) => {
|
|
240
248
|
return {
|
|
241
249
|
label: item.value,
|
|
242
250
|
value: item.key,
|
|
@@ -265,10 +273,14 @@ export default function Select({
|
|
|
265
273
|
!!startDate && (options.startDate = startDate);
|
|
266
274
|
!!endDate && (options.endDate = endDate);
|
|
267
275
|
}
|
|
276
|
+
|
|
268
277
|
options.onConfirm = (result) => {
|
|
269
278
|
const value = formatDateModeValue(result, dateMode);
|
|
279
|
+
const formatNewDateValue = getFormatNewDateParams(dateMode, value) as [];
|
|
270
280
|
setDate(value);
|
|
271
|
-
events.change({
|
|
281
|
+
events.change({
|
|
282
|
+
value: new Date(...formatNewDateValue).getTime(),
|
|
283
|
+
});
|
|
272
284
|
};
|
|
273
285
|
|
|
274
286
|
if (dateMode === 'year') {
|
|
@@ -329,7 +341,11 @@ export default function Select({
|
|
|
329
341
|
};
|
|
330
342
|
|
|
331
343
|
const onSelect = function () {
|
|
332
|
-
if (
|
|
344
|
+
if (
|
|
345
|
+
format === 'father-son' ||
|
|
346
|
+
format === 'related' ||
|
|
347
|
+
format === 'x-enum'
|
|
348
|
+
) {
|
|
333
349
|
weui.picker(option, {
|
|
334
350
|
id: String(Date.now()),
|
|
335
351
|
defaultValue: [selectedValue || option[0].value],
|
|
@@ -354,55 +370,59 @@ export default function Select({
|
|
|
354
370
|
}
|
|
355
371
|
};
|
|
356
372
|
let regionTimer;
|
|
357
|
-
const momentClick =async () => {
|
|
358
|
-
regionTimer = setInterval(
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
373
|
+
const momentClick = async () => {
|
|
374
|
+
regionTimer = setInterval(
|
|
375
|
+
() => {
|
|
376
|
+
setTimeout(() => {
|
|
377
|
+
if (regionTree.length != 0) {
|
|
378
|
+
onRegionClick();
|
|
379
|
+
}
|
|
380
|
+
}, 0);
|
|
381
|
+
},
|
|
382
|
+
regionTree.length == 0 ? 500 : 0
|
|
383
|
+
);
|
|
365
384
|
};
|
|
366
385
|
const onRegionClick = function () {
|
|
367
386
|
clearInterval(regionTimer);
|
|
368
|
-
let defaultValue=[];
|
|
369
|
-
if(mode=='region'){
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}else{
|
|
387
|
+
let defaultValue = [];
|
|
388
|
+
if (mode == 'region') {
|
|
389
|
+
defaultRegion && defaultRegion.length <= 0
|
|
390
|
+
? (defaultValue = ['北京市', '北京市', '东城区'])
|
|
391
|
+
: (defaultValue = defaultRegion);
|
|
392
|
+
} else {
|
|
374
393
|
mutiRegion && mutiRegion.length <= 0
|
|
375
|
-
|
|
376
|
-
|
|
394
|
+
? (defaultValue = ['北京市', '北京市', '东城区'])
|
|
395
|
+
: (defaultValue = mutiRegion);
|
|
377
396
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
397
|
+
regionPicker(
|
|
398
|
+
{
|
|
399
|
+
defaultValue: defaultValue,
|
|
400
|
+
depth: regioDepth,
|
|
401
|
+
onConfirm(result) {
|
|
402
|
+
const value = result.map((item) => item.value);
|
|
403
|
+
//const value=regionValueSplit(typeRegion,defaultvalue);
|
|
404
|
+
mode == 'region' ? setRegion(value) : setMutiRegion(value);
|
|
405
|
+
const changeValue = mode == 'region' ? value : value.join(',');
|
|
406
|
+
onChange && onChange(changeValue);
|
|
407
|
+
events?.change?.({
|
|
408
|
+
value: changeValue,
|
|
409
|
+
result: result.map((item) => {
|
|
389
410
|
return {
|
|
390
|
-
value:item?.value,
|
|
391
|
-
code:item?.code
|
|
411
|
+
value: item?.value,
|
|
412
|
+
code: item?.code,
|
|
392
413
|
};
|
|
393
|
-
})
|
|
394
|
-
|
|
395
|
-
},
|
|
396
|
-
onChange(result) {
|
|
397
|
-
},
|
|
398
|
-
className: 'weda-ui weda-picker',
|
|
399
|
-
id: new Date().valueOf(),
|
|
414
|
+
}),
|
|
415
|
+
});
|
|
400
416
|
},
|
|
401
|
-
|
|
402
|
-
|
|
417
|
+
onChange(result) {},
|
|
418
|
+
className: 'weda-ui weda-picker',
|
|
419
|
+
id: new Date().valueOf(),
|
|
420
|
+
},
|
|
421
|
+
regionTree
|
|
422
|
+
);
|
|
403
423
|
};
|
|
404
424
|
|
|
405
|
-
const onClick =async function () {
|
|
425
|
+
const onClick = async function () {
|
|
406
426
|
if (disabled) {
|
|
407
427
|
return;
|
|
408
428
|
}
|
|
@@ -436,19 +456,27 @@ export default function Select({
|
|
|
436
456
|
|
|
437
457
|
const result = React.useMemo(() => {
|
|
438
458
|
let selectLabel = '';
|
|
439
|
-
if (
|
|
440
|
-
|
|
459
|
+
if (
|
|
460
|
+
format === 'father-son' ||
|
|
461
|
+
format === 'related' ||
|
|
462
|
+
format === 'x-enum'
|
|
463
|
+
) {
|
|
464
|
+
selectLabel = (option ?? []).find(
|
|
465
|
+
(item) => item.value === selectedValue
|
|
466
|
+
)?.label;
|
|
441
467
|
} else {
|
|
442
|
-
selectLabel = (range ?? []).find(
|
|
468
|
+
selectLabel = (range ?? []).find(
|
|
469
|
+
(item) => item.value === selectedValue
|
|
470
|
+
)?.label;
|
|
443
471
|
}
|
|
444
472
|
return {
|
|
445
473
|
selector: selectLabel,
|
|
446
474
|
date: date,
|
|
447
475
|
time: time,
|
|
448
476
|
region: (region || []).join(separator), // region 有可能是空串
|
|
449
|
-
mutiRegion:mutiRegion
|
|
477
|
+
mutiRegion: mutiRegion,
|
|
450
478
|
};
|
|
451
|
-
}, [range, selectedValue, date, time, region, separator,mutiRegion]);
|
|
479
|
+
}, [range, selectedValue, date, time, region, separator, mutiRegion]);
|
|
452
480
|
|
|
453
481
|
return (
|
|
454
482
|
<div className={subCls}>
|
|
@@ -510,6 +538,29 @@ export function decodeIsoDatetime(isoStringOrTimesnap, type, dateMode = 'day') {
|
|
|
510
538
|
}
|
|
511
539
|
}
|
|
512
540
|
|
|
541
|
+
/**
|
|
542
|
+
* 根据时间模式,构造 new Date()的传参格式单个日期和时间组件值
|
|
543
|
+
*/
|
|
544
|
+
export const getFormatNewDateParams = (
|
|
545
|
+
type: string,
|
|
546
|
+
timeStr: string
|
|
547
|
+
): any[] => {
|
|
548
|
+
let value = [];
|
|
549
|
+
let time = timeStr.split('-');
|
|
550
|
+
switch (type) {
|
|
551
|
+
case 'year':
|
|
552
|
+
value = [time[0], 0, [1]];
|
|
553
|
+
break;
|
|
554
|
+
case 'month':
|
|
555
|
+
value = [time[0], Number(time[1]) - 1, [1]];
|
|
556
|
+
break;
|
|
557
|
+
case 'day':
|
|
558
|
+
value = [time[0], Number(time[1]) - 1, [time[2]]];
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
return value;
|
|
562
|
+
};
|
|
563
|
+
|
|
513
564
|
/**
|
|
514
565
|
* 根据时间模式,将 picker 返回的值转成对应的 年-月-日
|
|
515
566
|
*/
|
|
@@ -6,7 +6,7 @@ import { ConfigProvider, Input } from 'tea-component';
|
|
|
6
6
|
import { usePlatform } from '../../../utils/platform';
|
|
7
7
|
import { renderDecorator } from '../renderDecorator';
|
|
8
8
|
import { useSyncValue } from '../../../utils/useSyncValue';
|
|
9
|
-
import { CommonFormPropsType } from '../types';
|
|
9
|
+
import type { CommonFormPropsType } from '../types';
|
|
10
10
|
|
|
11
11
|
export default function Textarea({
|
|
12
12
|
// 系统属性
|
|
@@ -6,7 +6,7 @@ import isObjectEqual from '../../../utils/isObjectEqual';
|
|
|
6
6
|
import { useSyncValue } from '../../../utils/useSyncValue';
|
|
7
7
|
import { isCloudFileID } from '../../../utils/platform';
|
|
8
8
|
import { IMAGE_TYPES } from './uploader.pc';
|
|
9
|
-
import { CommonFormPropsType } from '../types';
|
|
9
|
+
import type { CommonFormPropsType } from '../types';
|
|
10
10
|
import { v4 } from 'uuid';
|
|
11
11
|
|
|
12
12
|
const uploadPath = 'weda-uploader';
|
|
@@ -122,7 +122,7 @@ export function ImageUploaderH5({
|
|
|
122
122
|
}, [acceptTypes]);
|
|
123
123
|
|
|
124
124
|
const showAdd = React.useMemo(() => {
|
|
125
|
-
if(single) {
|
|
125
|
+
if (single) {
|
|
126
126
|
// single 模式时,仅当数组为空时显示
|
|
127
127
|
return fileIdList.length < 1;
|
|
128
128
|
}
|
|
@@ -132,7 +132,13 @@ export function ImageUploaderH5({
|
|
|
132
132
|
<div className={cls} id={id} style={style}>
|
|
133
133
|
<div className={classNames('weui-uploader', layout)}>
|
|
134
134
|
<div className={classNames('weui-uploader__hd', layout)}>
|
|
135
|
-
<UploaderLabel
|
|
135
|
+
<UploaderLabel
|
|
136
|
+
layout={layout}
|
|
137
|
+
title={title}
|
|
138
|
+
currentCount={fileIdList.length}
|
|
139
|
+
maxCount={finalMaxImgCount}
|
|
140
|
+
requiredFlag={requiredFlag}
|
|
141
|
+
/>
|
|
136
142
|
</div>
|
|
137
143
|
|
|
138
144
|
<div className="weui-uploader__bd">
|
|
@@ -142,9 +148,7 @@ export function ImageUploaderH5({
|
|
|
142
148
|
))}
|
|
143
149
|
{uploading && (
|
|
144
150
|
<li className="weui-uploader__file weui-uploader__file_status">
|
|
145
|
-
<div className="weui-uploader__file-content">
|
|
146
|
-
{progress}%
|
|
147
|
-
</div>
|
|
151
|
+
<div className="weui-uploader__file-content">{progress}%</div>
|
|
148
152
|
</li>
|
|
149
153
|
)}
|
|
150
154
|
</ul>
|
|
@@ -251,11 +255,17 @@ export interface H5UploaderProps extends CommonFormPropsType {
|
|
|
251
255
|
onChange?: (v: any) => void;
|
|
252
256
|
}
|
|
253
257
|
|
|
254
|
-
const UploaderLabel = ({
|
|
255
|
-
|
|
258
|
+
const UploaderLabel = ({
|
|
259
|
+
layout,
|
|
260
|
+
title,
|
|
261
|
+
currentCount,
|
|
262
|
+
maxCount,
|
|
263
|
+
requiredFlag,
|
|
264
|
+
}) => {
|
|
265
|
+
if (layout === 'horizontal') {
|
|
256
266
|
return (
|
|
257
267
|
<React.Fragment>
|
|
258
|
-
<div className=
|
|
268
|
+
<div className="weda-formcells__label weui-cell">
|
|
259
269
|
<div>
|
|
260
270
|
<p className="weui-uploader__title">{title}</p>
|
|
261
271
|
<div className="weui-uploader__info">
|
|
@@ -263,25 +273,21 @@ const UploaderLabel = ({layout, title, currentCount, maxCount, requiredFlag}) =>
|
|
|
263
273
|
{`/${maxCount}`}
|
|
264
274
|
</div>
|
|
265
275
|
</div>
|
|
266
|
-
{requiredFlag &&
|
|
267
|
-
<label className="weda-formcells__flag">*</label>
|
|
268
|
-
)}
|
|
276
|
+
{requiredFlag && <label className="weda-formcells__flag">*</label>}
|
|
269
277
|
</div>
|
|
270
278
|
</React.Fragment>
|
|
271
|
-
)
|
|
279
|
+
);
|
|
272
280
|
}
|
|
273
281
|
return (
|
|
274
|
-
<div className=
|
|
275
|
-
<div className=
|
|
282
|
+
<div className="weda-formcells__label weui-cell">
|
|
283
|
+
<div className="weui-uploader__label">
|
|
276
284
|
<p className="weui-uploader__title">{title}</p>
|
|
277
|
-
{requiredFlag &&
|
|
278
|
-
<label className="weda-formcells__flag">*</label>
|
|
279
|
-
)}
|
|
285
|
+
{requiredFlag && <label className="weda-formcells__flag">*</label>}
|
|
280
286
|
</div>
|
|
281
287
|
<div className="weui-uploader__info">
|
|
282
288
|
<span id="uploadCount">{currentCount}</span>
|
|
283
289
|
{`/${maxCount}`}
|
|
284
290
|
</div>
|
|
285
291
|
</div>
|
|
286
|
-
)
|
|
287
|
-
}
|
|
292
|
+
);
|
|
293
|
+
};
|
|
@@ -4,7 +4,7 @@ import { useState, useEffect } from 'react';
|
|
|
4
4
|
import classNames from '../../utils/classnames';
|
|
5
5
|
import './index.css';
|
|
6
6
|
import { ImageInner } from './image';
|
|
7
|
-
import { CommonPropsType } from '../../types';
|
|
7
|
+
import type { CommonPropsType } from '../../types';
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
const defaultSrc = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSI0MCIgY3k9IjQwIiByPSI0MCIgZmlsbD0iI0VCRUZGNSIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yMCA1NlYyNGg0MHYzMnoiLz48cGF0aCBmaWxsPSIjQzFDQ0REIiBkPSJNMjYgMzdoMjh2MkgyNnptMCA3aDIwdjJIMjZ6bS02LTIwaDQwdjdIMjB6Ii8+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNDggNDQpIj48Y2lyY2xlIGZpbGw9IiNGRkYiIGN4PSIxMCIgY3k9IjEwIiByPSI3Ii8+PHBhdGggZD0iTTEwIDJhOCA4IDAgMSAxIDAgMTYgOCA4IDAgMCAxIDAtMTZ6bTEgMTBIOXYyaDJ2LTJ6bTAtNkg5djVoMlY2eiIgZmlsbD0iIzAwNkVGRiIvPjwvZz48L2c+PC9zdmc+';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CommonPropsType } from '../../types';
|
|
2
|
+
import type { CommonPropsType } from '../../types';
|
|
3
3
|
import classNames from '../../utils/classnames';
|
|
4
4
|
import { Row, Col, ConfigProvider } from 'tea-component';
|
|
5
5
|
import { usePlatform } from '../../utils/platform';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { CommonPropsType } from '../../types';
|
|
2
|
+
import type { CommonPropsType } from '../../types';
|
|
3
3
|
import classNames from '../../utils/classnames';
|
|
4
4
|
import { ConfigProvider } from 'tea-component';
|
|
5
5
|
import { usePlatform, isInIde } from '../../utils/platform';
|
|
6
6
|
import { getAppCustomNav } from '../../utils/tcb';
|
|
7
|
-
import { IMenuItem, INavigationStyle } from './type';
|
|
7
|
+
import type { IMenuItem, INavigationStyle } from './type';
|
|
8
8
|
import './index.css';
|
|
9
9
|
import VerticalMenu from './verticalMenu';
|
|
10
10
|
import HorizontalMenu from './horizontalMenu';
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import weui from '../../utils/weui';
|
|
3
3
|
|
|
4
4
|
import classNames from '../../utils/classnames';
|
|
5
|
-
import { CommonPropsType } from '../../types';
|
|
5
|
+
import type { CommonPropsType } from '../../types';
|
|
6
6
|
|
|
7
7
|
export interface PropsType extends CommonPropsType {
|
|
8
8
|
defaultValue?: string;
|