@cloudbase/weda-ui-mp 3.9.0 → 3.9.2
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/components/dataView/index.js +5 -2
- package/components/form/location/components/mapChoose/index.js +33 -11
- package/components/form/location/index.js +39 -13
- package/components/form/location/index.wxml +1 -1
- package/components/listView/index.js +8 -4
- package/components/wd-input/inner-input/index.js +10 -2
- package/components/wd-input-phone/index.js +3 -0
- package/components/wd-input-phone/index.wxml +2 -2
- package/components/wd-location/index.js +8 -0
- package/components/wd-location/index.wxml +2 -0
- package/components/wd-markdown/index.js +14 -0
- package/components/web-view/index.js +0 -3
- package/package.json +1 -1
- package/utils/error.js +12 -0
|
@@ -26,7 +26,7 @@ Component({
|
|
|
26
26
|
value: [],
|
|
27
27
|
},
|
|
28
28
|
queryCondition: {
|
|
29
|
-
type:
|
|
29
|
+
type: null,
|
|
30
30
|
value: [],
|
|
31
31
|
},
|
|
32
32
|
bindConnectMetadata: {
|
|
@@ -105,7 +105,10 @@ Component({
|
|
|
105
105
|
record: this.data._oldData,
|
|
106
106
|
refresh,
|
|
107
107
|
deleteOne,
|
|
108
|
-
dataSourceVersion:
|
|
108
|
+
dataSourceVersion:
|
|
109
|
+
this.properties.datasource?.extra?.methodName === 'wedaGetRecordsV2'
|
|
110
|
+
? 'v2'
|
|
111
|
+
: 'v1',
|
|
109
112
|
});
|
|
110
113
|
},
|
|
111
114
|
},
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import debounce from '../../../../../utils/debounce';
|
|
2
2
|
import { getCurrentLocation } from '../../../../../utils/getCustomInfo';
|
|
3
|
+
import { errorHandler } from '../../../../../utils/error';
|
|
4
|
+
|
|
3
5
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
4
6
|
let QQMapWX = require('../../../../../utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk');
|
|
5
7
|
let qqmapsdk;
|
|
@@ -9,6 +11,10 @@ Component({
|
|
|
9
11
|
* 组件的属性列表
|
|
10
12
|
*/
|
|
11
13
|
properties: {
|
|
14
|
+
id: {
|
|
15
|
+
Type: String,
|
|
16
|
+
value: '',
|
|
17
|
+
},
|
|
12
18
|
location: {
|
|
13
19
|
type: Object,
|
|
14
20
|
value: {
|
|
@@ -44,6 +50,7 @@ Component({
|
|
|
44
50
|
lifetimes: {
|
|
45
51
|
attached: function () {
|
|
46
52
|
this.getInitialization();
|
|
53
|
+
this.setData({ id: this.id });
|
|
47
54
|
},
|
|
48
55
|
},
|
|
49
56
|
|
|
@@ -273,7 +280,12 @@ Component({
|
|
|
273
280
|
});
|
|
274
281
|
},
|
|
275
282
|
fail: function (error) {
|
|
276
|
-
|
|
283
|
+
const { comErrorInfo } = errorHandler({
|
|
284
|
+
id: this.id,
|
|
285
|
+
code: 'WdLocation.SearchError',
|
|
286
|
+
error: error,
|
|
287
|
+
});
|
|
288
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
277
289
|
_this.setData({
|
|
278
290
|
searchLoadingStatus: false,
|
|
279
291
|
});
|
|
@@ -297,11 +309,12 @@ Component({
|
|
|
297
309
|
}
|
|
298
310
|
},
|
|
299
311
|
fail: function (error) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
312
|
+
const { comErrorInfo } = errorHandler({
|
|
313
|
+
id: this.id,
|
|
314
|
+
code: 'WdLocation.GetSuggestionError',
|
|
315
|
+
error: error,
|
|
304
316
|
});
|
|
317
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
305
318
|
},
|
|
306
319
|
});
|
|
307
320
|
}
|
|
@@ -332,7 +345,12 @@ Component({
|
|
|
332
345
|
}
|
|
333
346
|
},
|
|
334
347
|
fail: (error) => {
|
|
335
|
-
|
|
348
|
+
const { comErrorInfo } = errorHandler({
|
|
349
|
+
id: this.id,
|
|
350
|
+
code: 'WdLocation.ReverseGeocoderError',
|
|
351
|
+
error: error,
|
|
352
|
+
});
|
|
353
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
336
354
|
let item = {
|
|
337
355
|
id: 'current-location',
|
|
338
356
|
location: {
|
|
@@ -479,15 +497,19 @@ Component({
|
|
|
479
497
|
latitude: Number(latitude.toFixed(6)),
|
|
480
498
|
longitude: Number(longitude.toFixed(6)),
|
|
481
499
|
};
|
|
482
|
-
} catch (e) {
|
|
500
|
+
} catch (e) {
|
|
501
|
+
const { comErrorInfo } = errorHandler({
|
|
502
|
+
id: this.id,
|
|
503
|
+
code: 'WdLocation.GetLatestLocationError',
|
|
504
|
+
error: e,
|
|
505
|
+
});
|
|
506
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
507
|
+
}
|
|
483
508
|
return location;
|
|
484
509
|
},
|
|
485
510
|
},
|
|
486
511
|
observers: {
|
|
487
|
-
apiKey: function () {
|
|
488
|
-
this.getInitialization();
|
|
489
|
-
},
|
|
490
|
-
location: function () {
|
|
512
|
+
'apiKey,location': function () {
|
|
491
513
|
this.getInitialization();
|
|
492
514
|
},
|
|
493
515
|
},
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { callDataSource } from '../../../utils/tcb';
|
|
2
2
|
import classNames from '../../../utils/classnames';
|
|
3
3
|
import customInfo from '../../../utils/getCustomInfo';
|
|
4
|
+
import { errorHandler } from '../../../utils/error';
|
|
5
|
+
|
|
4
6
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
7
|
let QQMapWX = require('../../../utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk');
|
|
6
8
|
let qqmapsdk;
|
|
@@ -17,6 +19,10 @@ Component({
|
|
|
17
19
|
type: String,
|
|
18
20
|
value: '',
|
|
19
21
|
},
|
|
22
|
+
id: {
|
|
23
|
+
Type: String,
|
|
24
|
+
value: '',
|
|
25
|
+
},
|
|
20
26
|
style: {
|
|
21
27
|
type: String,
|
|
22
28
|
value: '',
|
|
@@ -97,6 +103,7 @@ Component({
|
|
|
97
103
|
|
|
98
104
|
lifetimes: {
|
|
99
105
|
attached: function () {
|
|
106
|
+
this.setData({ id: this.id });
|
|
100
107
|
const { locationType, dataSource } = this.properties;
|
|
101
108
|
const getReverseGeocoder = async (location) => {
|
|
102
109
|
const { isApikeyStatus } = this.data;
|
|
@@ -182,7 +189,12 @@ Component({
|
|
|
182
189
|
}
|
|
183
190
|
getReverseGeocoder(location);
|
|
184
191
|
} catch (err) {
|
|
185
|
-
|
|
192
|
+
const { comErrorInfo } = errorHandler({
|
|
193
|
+
id: this.id,
|
|
194
|
+
code: 'WdLocation.DrowMapMarksError',
|
|
195
|
+
error: err,
|
|
196
|
+
});
|
|
197
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
186
198
|
}
|
|
187
199
|
};
|
|
188
200
|
const getCustomInfoLocation = () => {
|
|
@@ -206,6 +218,12 @@ Component({
|
|
|
206
218
|
},
|
|
207
219
|
currentLocations: {},
|
|
208
220
|
});
|
|
221
|
+
const { comErrorInfo } = errorHandler({
|
|
222
|
+
id: this.id,
|
|
223
|
+
code: 'WdLocation.GetCurrentLocationError',
|
|
224
|
+
error,
|
|
225
|
+
});
|
|
226
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
209
227
|
});
|
|
210
228
|
} else {
|
|
211
229
|
drowMapMarks(customInfoLocation);
|
|
@@ -225,7 +243,6 @@ Component({
|
|
|
225
243
|
getCustomInfoLocation();
|
|
226
244
|
},
|
|
227
245
|
fail: (err) => {
|
|
228
|
-
console.log('authorize fail', err);
|
|
229
246
|
this.setData({
|
|
230
247
|
currentPosition: {
|
|
231
248
|
status: false,
|
|
@@ -236,10 +253,12 @@ Component({
|
|
|
236
253
|
this.triggerEvent('change', {
|
|
237
254
|
value: {},
|
|
238
255
|
});
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
256
|
+
const { comErrorInfo } = errorHandler({
|
|
257
|
+
id: this.id,
|
|
258
|
+
code: 'WdLocation.AuthorizeFail',
|
|
259
|
+
error: err,
|
|
242
260
|
});
|
|
261
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
243
262
|
},
|
|
244
263
|
});
|
|
245
264
|
} else {
|
|
@@ -248,11 +267,12 @@ Component({
|
|
|
248
267
|
}
|
|
249
268
|
},
|
|
250
269
|
fail: (err) => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
270
|
+
const { comErrorInfo } = errorHandler({
|
|
271
|
+
id: this.id,
|
|
272
|
+
code: 'WdLocation.GetSettingFail',
|
|
273
|
+
error: err,
|
|
255
274
|
});
|
|
275
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
256
276
|
},
|
|
257
277
|
});
|
|
258
278
|
}
|
|
@@ -336,7 +356,6 @@ Component({
|
|
|
336
356
|
});
|
|
337
357
|
}
|
|
338
358
|
} catch (error) {
|
|
339
|
-
console.log('getApikey error', error);
|
|
340
359
|
this.setData({
|
|
341
360
|
isApikeyStatus: {
|
|
342
361
|
status: false,
|
|
@@ -344,6 +363,12 @@ Component({
|
|
|
344
363
|
apiKey: '',
|
|
345
364
|
},
|
|
346
365
|
});
|
|
366
|
+
const { comErrorInfo } = errorHandler({
|
|
367
|
+
id: this.id,
|
|
368
|
+
code: 'WdLocation.GetApikeyError',
|
|
369
|
+
error,
|
|
370
|
+
});
|
|
371
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
347
372
|
}
|
|
348
373
|
},
|
|
349
374
|
chooseLocation() {
|
|
@@ -424,15 +449,16 @@ Component({
|
|
|
424
449
|
});
|
|
425
450
|
},
|
|
426
451
|
mapChooseOnConfirm(event) {
|
|
452
|
+
this.setData({ isMapChooseVisible: false });
|
|
427
453
|
const value = event.detail;
|
|
428
454
|
this.changeLocation({
|
|
429
455
|
...value,
|
|
430
456
|
poiname: value.address,
|
|
431
457
|
detailedAddress: value.detailedAddress,
|
|
432
458
|
});
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
459
|
+
},
|
|
460
|
+
handleError: function (e) {
|
|
461
|
+
this.triggerEvent('error', e.detail);
|
|
436
462
|
},
|
|
437
463
|
},
|
|
438
464
|
observers: {
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
<view style="padding-left: 16px; padding-right: 16px; margin-top: 16px; padding-bottom: 16px" wx:if="{{showMap&&isAddrShow}}">
|
|
25
25
|
<map id="map" longitude="{{location.longitude}}" latitude="{{location.latitude}}" markers="{{markers}}" scale="16" enable-zoom="{{zoom}}" enable-scroll="{{drag}}" style="width: 100%; height: 200px"></map>
|
|
26
26
|
</view>
|
|
27
|
-
<mapChoose isVisible="{{isMapChooseVisible}}" bindonClose="mapChooseOnClose" bindonConfirm="mapChooseOnConfirm" location="{{location}}" apiKey="{{isApikeyStatus.apiKey}}" circleRadius="{{locationRange}}" customRange="{{customRange}}" currentLocations="{{currentLocations}}" />
|
|
27
|
+
<mapChoose id="{{id}}" wx:if="{{isMapChooseVisible}}" isVisible="{{isMapChooseVisible}}" bindonClose="mapChooseOnClose" bindonConfirm="mapChooseOnConfirm" location="{{location}}" apiKey="{{isApikeyStatus.apiKey}}" circleRadius="{{locationRange}}" customRange="{{customRange}}" currentLocations="{{currentLocations}}" bind:error="handleError" />
|
|
28
28
|
</view>
|
|
29
29
|
</formcell>
|
|
@@ -68,7 +68,7 @@ Component({
|
|
|
68
68
|
value: [],
|
|
69
69
|
},
|
|
70
70
|
queryCondition: {
|
|
71
|
-
type:
|
|
71
|
+
type: null,
|
|
72
72
|
value: [],
|
|
73
73
|
},
|
|
74
74
|
pageSize: {
|
|
@@ -266,7 +266,10 @@ Component({
|
|
|
266
266
|
? extra?.methodName
|
|
267
267
|
: 'wedaGetRecords';
|
|
268
268
|
eventDataSource = datasource;
|
|
269
|
-
const modelParams = await getModelParams(
|
|
269
|
+
const modelParams = await getModelParams({
|
|
270
|
+
...this.properties,
|
|
271
|
+
supportManyRelated: methodName === 'wedaGetRecordsV2',
|
|
272
|
+
});
|
|
270
273
|
tcbParams = { ...tcbParams, ...modelParams };
|
|
271
274
|
} else {
|
|
272
275
|
dataSourceName = bindConnectMetadata?.datasource?.name;
|
|
@@ -613,7 +616,7 @@ Component({
|
|
|
613
616
|
},
|
|
614
617
|
updateWidgetAPI() {
|
|
615
618
|
const { records, listTotal, pageNo, errorObj } = this.data;
|
|
616
|
-
let { pageSize,
|
|
619
|
+
let { pageSize, datasource } = this.properties;
|
|
617
620
|
this.setReadonlyAttributes &&
|
|
618
621
|
this.setReadonlyAttributes({
|
|
619
622
|
records,
|
|
@@ -623,7 +626,8 @@ Component({
|
|
|
623
626
|
refresh: this.methodRefresh.bind(this),
|
|
624
627
|
deleteOne: this.methodDeleteOne.bind(this),
|
|
625
628
|
error: errorObj,
|
|
626
|
-
dataSourceVersion:
|
|
629
|
+
dataSourceVersion:
|
|
630
|
+
datasource?.extra?.methodName === 'wedaGetRecordsV2' ? 'v2' : 'v1',
|
|
627
631
|
});
|
|
628
632
|
},
|
|
629
633
|
},
|
|
@@ -28,6 +28,9 @@ Component({
|
|
|
28
28
|
type: Boolean,
|
|
29
29
|
value: true,
|
|
30
30
|
},
|
|
31
|
+
inputPattern: {
|
|
32
|
+
type: null,
|
|
33
|
+
},
|
|
31
34
|
},
|
|
32
35
|
data: {
|
|
33
36
|
root: '',
|
|
@@ -76,9 +79,14 @@ Component({
|
|
|
76
79
|
this.setData({ isFocus: false });
|
|
77
80
|
},
|
|
78
81
|
handleChange: function (e) {
|
|
79
|
-
const
|
|
82
|
+
const text = e.detail.value;
|
|
83
|
+
const reg = new RegExp(this.properties.inputPattern);
|
|
84
|
+
if (this.properties.inputPattern && !reg.test(text)) {
|
|
85
|
+
this.setData({ currentInputValue: this.data.currentInputValue });
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
80
88
|
const detail = this.convertDetail(e);
|
|
81
|
-
this.setData({ currentInputValue });
|
|
89
|
+
this.setData({ currentInputValue: text });
|
|
82
90
|
this.changeForm(detail);
|
|
83
91
|
this.triggerEvent('change', detail);
|
|
84
92
|
},
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
after="{{after}}"
|
|
20
20
|
isUnionValue="{{isUnionValue}}"
|
|
21
21
|
prefixType="{{prefixType}}"
|
|
22
|
+
inputPattern="{{pattern}}"
|
|
22
23
|
prefixIcon="{{prefixIcon}}"
|
|
23
24
|
prefixSrc="{{prefixSrc}}"
|
|
24
25
|
suffixType="{{suffixType}}"
|
|
@@ -26,13 +27,12 @@
|
|
|
26
27
|
suffixSrc="{{suffixSrc}}"
|
|
27
28
|
extra="{{extra}}"
|
|
28
29
|
password="{{false}}"
|
|
29
|
-
type="number"
|
|
30
30
|
counterVisible="{{counterVisible}}"
|
|
31
31
|
focus="{{focus}}"
|
|
32
32
|
borderedH5="{{borderedH5}}"
|
|
33
33
|
borderedPc="{{borderedPc}}"
|
|
34
34
|
isNickNameType="{{false}}"
|
|
35
|
-
maxLength="
|
|
35
|
+
maxLength="20"
|
|
36
36
|
rules="{{rules}}"
|
|
37
37
|
status="{{status}}"
|
|
38
38
|
required="{{required}}"
|
|
@@ -14,6 +14,10 @@ Component({
|
|
|
14
14
|
customLocation: {
|
|
15
15
|
type: null,
|
|
16
16
|
},
|
|
17
|
+
id: {
|
|
18
|
+
Type: String,
|
|
19
|
+
value: '',
|
|
20
|
+
},
|
|
17
21
|
},
|
|
18
22
|
data: {
|
|
19
23
|
_oldLocationValue: null,
|
|
@@ -30,6 +34,9 @@ Component({
|
|
|
30
34
|
const e = { detail: { value: null } };
|
|
31
35
|
this.handleChange(e);
|
|
32
36
|
},
|
|
37
|
+
handleError: function (e) {
|
|
38
|
+
this.triggerEvent('error', e.detail);
|
|
39
|
+
},
|
|
33
40
|
},
|
|
34
41
|
observers: {
|
|
35
42
|
'name, value, label, required, visible, disabled, readOnly, before, after':
|
|
@@ -44,6 +51,7 @@ Component({
|
|
|
44
51
|
lifetimes: {
|
|
45
52
|
attached: function () {
|
|
46
53
|
this.updateWidgetAPI();
|
|
54
|
+
this.setData({ id: this.id });
|
|
47
55
|
},
|
|
48
56
|
},
|
|
49
57
|
});
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
<wd-input-group before="{{before}}" after="{{after}}" block="{{true}}" size="{{_size}}" classRoot="{{classRoot}}">
|
|
25
25
|
<wd-input-wrap block="{{block}}" classRoot="{{classRoot}}" before="{{before}}" after="{{after}}" disabled="{{disabled}}" prefixType="{{prefixType}}" prefixIcon="{{prefixIcon}}" prefixSrc="{{prefixSrc}}" suffixType="{{suffixType}}" suffixIcon="{{suffixIcon}}" suffixSrc="{{suffixSrc}}" hasClearIcon="{{hasClearIcon}}" bind:onClear="handleClear">
|
|
26
26
|
<old-location
|
|
27
|
+
id="{{id}}"
|
|
27
28
|
name="{{name}}"
|
|
28
29
|
labelVisible="{{false}}"
|
|
29
30
|
value="{{value}}"
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
readOnly="{{readOnly}}"
|
|
41
42
|
disabled="{{disabled || readOnly}}"
|
|
42
43
|
bind:change="handleChange"
|
|
44
|
+
bind:error="handleError"
|
|
43
45
|
/>
|
|
44
46
|
</wd-input-wrap>
|
|
45
47
|
</wd-input-group>
|
|
@@ -59,10 +59,20 @@ Component({
|
|
|
59
59
|
...options,
|
|
60
60
|
});
|
|
61
61
|
this.setData({ mdInstance: md });
|
|
62
|
+
this.triggerEvent('onReady', { markdownInstance: md });
|
|
62
63
|
this.setData({
|
|
63
64
|
__html: md.render(this.data.value),
|
|
64
65
|
});
|
|
65
66
|
},
|
|
67
|
+
updateWidgetAPI() {
|
|
68
|
+
this.setReadonlyAttributes &&
|
|
69
|
+
this.setReadonlyAttributes({
|
|
70
|
+
value: this.properties.value,
|
|
71
|
+
markdownInstance: this.data.mdInstance,
|
|
72
|
+
updateMarkdownInstance: ({ markdownInstance }) =>
|
|
73
|
+
this.setData({ mdInstance: markdownInstance }),
|
|
74
|
+
});
|
|
75
|
+
},
|
|
66
76
|
},
|
|
67
77
|
observers: {
|
|
68
78
|
value: function () {
|
|
@@ -76,10 +86,14 @@ Component({
|
|
|
76
86
|
options: function () {
|
|
77
87
|
this.init();
|
|
78
88
|
},
|
|
89
|
+
'value,mdInstance': function () {
|
|
90
|
+
this.updateWidgetAPI();
|
|
91
|
+
},
|
|
79
92
|
},
|
|
80
93
|
lifetimes: {
|
|
81
94
|
attached() {
|
|
82
95
|
this.init();
|
|
96
|
+
this.updateWidgetAPI();
|
|
83
97
|
},
|
|
84
98
|
},
|
|
85
99
|
});
|
package/package.json
CHANGED
package/utils/error.js
CHANGED
|
@@ -10,3 +10,15 @@ export class WdCompError extends Error {
|
|
|
10
10
|
this.original = context ? context.original : {};
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
export const errorHandler = ({ id = '', code, error }) => {
|
|
15
|
+
const comErrorInfo = {
|
|
16
|
+
code: error?.code || code,
|
|
17
|
+
requestId: error?.requestId,
|
|
18
|
+
original: error,
|
|
19
|
+
message: `[组件${id}:${code}]${error?.message || error?.errMsg || code}`,
|
|
20
|
+
};
|
|
21
|
+
const compError = new WdCompError(comErrorInfo.message, comErrorInfo);
|
|
22
|
+
console.error(comErrorInfo);
|
|
23
|
+
return { compError, comErrorInfo };
|
|
24
|
+
};
|