@cloudbase/weda-ui-mp 3.9.8 → 3.10.0
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/form/form/wd-form.wxss +5 -0
- package/components/form/uploaderFile/index.js +8 -0
- package/components/form/uploaderFile/index.wxml +2 -2
- package/components/listView/index.js +8 -3
- package/components/wd-form/wd-form.wxss +5 -0
- package/components/wd-form-item/wd-form-item.wxss +5 -0
- package/components/wd-form-item-obj/wd-form-item.wxss +5 -0
- package/components/wd-input/inner-input/wd-input.wxss +5 -0
- package/components/wd-progress/wd-progress.wxss +5 -0
- package/components/wd-rating/wd-rating.wxss +5 -0
- package/components/wd-side-tab/index.js +7 -0
- package/components/wd-side-tab/index.wxml +2 -1
- package/components/wd-switch/wd-switch.wxss +5 -0
- package/components/wd-tag-select/wd-tag-select.wxss +5 -0
- package/components/wd-textarea/index.js +3 -0
- package/components/wd-textarea/index.wxml +1 -1
- package/components/wd-top-tab/index.js +11 -6
- package/components/wd-top-tab/index.wxml +2 -2
- package/components/wd-upload-file/index.js +8 -0
- package/components/wd-upload-file/index.wxml +2 -0
- package/components/wedaVideo/index.js +6 -2
- package/package.json +1 -1
- package/style/wd-design.wxss +3 -1
- package/utils/color.js +5 -0
- package/utils/date.js +5 -1
- package/utils/error.js +2 -2
- package/utils/getModelParams.js +35 -3
- package/utils/platform.js +5 -1
- package/utils/tcb.js +19 -4
|
@@ -125,6 +125,8 @@
|
|
|
125
125
|
display: flex;
|
|
126
126
|
}
|
|
127
127
|
.wd-form-item-wrap__label {
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
128
130
|
word-break: break-all;
|
|
129
131
|
width: var(--wd-form-item-label-width);
|
|
130
132
|
margin-right: var(--wd-form-item-label-mr);
|
|
@@ -137,6 +139,9 @@
|
|
|
137
139
|
.wd-form-item-wrap__label.is-disabled {
|
|
138
140
|
color: var(--wd-form-item-label-color-disabled);
|
|
139
141
|
}
|
|
142
|
+
.wd-form-item-wrap__label-content {
|
|
143
|
+
flex: 1;
|
|
144
|
+
}
|
|
140
145
|
.wd-form-item-wrap__label > label {
|
|
141
146
|
display: inline-block;
|
|
142
147
|
line-height: var(--wd-font-line-height-default);
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
{{label}}
|
|
7
7
|
</view>
|
|
8
8
|
<view class="weda-uploader-files__btn-contain">
|
|
9
|
-
<button class="weui-btn weda-uploader-files__btn" bindtap="onButtonTap" disabled="{{disabled}}"
|
|
9
|
+
<button class="weui-btn weda-uploader-files__btn" bindtap="onButtonTap" disabled="{{disabled}}">{{uploadButtonText}}</button>
|
|
10
10
|
|
|
11
|
-
<view wx:if="{{maxCount!=1}}" class="weda-uploader-files__tips"
|
|
11
|
+
<view wx:if="{{maxCount!=1}}" class="weda-uploader-files__tips">{{uploadTipText}}</view>
|
|
12
12
|
<view wx:else>
|
|
13
13
|
<slot name="tips"></slot>
|
|
14
14
|
</view>
|
|
@@ -142,6 +142,14 @@ Component({
|
|
|
142
142
|
type: Boolean,
|
|
143
143
|
value: false,
|
|
144
144
|
},
|
|
145
|
+
isSupportMultipleSort: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
value: false,
|
|
148
|
+
},
|
|
149
|
+
sorter: {
|
|
150
|
+
type: Array,
|
|
151
|
+
value: [],
|
|
152
|
+
},
|
|
145
153
|
},
|
|
146
154
|
data: {
|
|
147
155
|
pageNo: 1,
|
|
@@ -208,9 +216,6 @@ Component({
|
|
|
208
216
|
params.getCount = true;
|
|
209
217
|
params.compatibleWithV1 = true;
|
|
210
218
|
params.pageNumber = params.pageNo;
|
|
211
|
-
if (params.orderBy && ['asc', 'desc'].includes(params.orderType)) {
|
|
212
|
-
params.orderBy = [{ [params.orderBy]: params.orderType }];
|
|
213
|
-
}
|
|
214
219
|
}
|
|
215
220
|
return params;
|
|
216
221
|
},
|
|
@@ -125,6 +125,8 @@
|
|
|
125
125
|
display: flex;
|
|
126
126
|
}
|
|
127
127
|
.wd-form-item-wrap__label {
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
128
130
|
word-break: break-all;
|
|
129
131
|
width: var(--wd-form-item-label-width);
|
|
130
132
|
margin-right: var(--wd-form-item-label-mr);
|
|
@@ -137,6 +139,9 @@
|
|
|
137
139
|
.wd-form-item-wrap__label.is-disabled {
|
|
138
140
|
color: var(--wd-form-item-label-color-disabled);
|
|
139
141
|
}
|
|
142
|
+
.wd-form-item-wrap__label-content {
|
|
143
|
+
flex: 1;
|
|
144
|
+
}
|
|
140
145
|
.wd-form-item-wrap__label > label {
|
|
141
146
|
display: inline-block;
|
|
142
147
|
line-height: var(--wd-font-line-height-default);
|
|
@@ -125,6 +125,8 @@
|
|
|
125
125
|
display: flex;
|
|
126
126
|
}
|
|
127
127
|
.wd-form-item-wrap__label {
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
128
130
|
word-break: break-all;
|
|
129
131
|
width: var(--wd-form-item-label-width);
|
|
130
132
|
margin-right: var(--wd-form-item-label-mr);
|
|
@@ -137,6 +139,9 @@
|
|
|
137
139
|
.wd-form-item-wrap__label.is-disabled {
|
|
138
140
|
color: var(--wd-form-item-label-color-disabled);
|
|
139
141
|
}
|
|
142
|
+
.wd-form-item-wrap__label-content {
|
|
143
|
+
flex: 1;
|
|
144
|
+
}
|
|
140
145
|
.wd-form-item-wrap__label > label {
|
|
141
146
|
display: inline-block;
|
|
142
147
|
line-height: var(--wd-font-line-height-default);
|
|
@@ -125,6 +125,8 @@
|
|
|
125
125
|
display: flex;
|
|
126
126
|
}
|
|
127
127
|
.wd-form-item-wrap__label {
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
128
130
|
word-break: break-all;
|
|
129
131
|
width: var(--wd-form-item-label-width);
|
|
130
132
|
margin-right: var(--wd-form-item-label-mr);
|
|
@@ -137,6 +139,9 @@
|
|
|
137
139
|
.wd-form-item-wrap__label.is-disabled {
|
|
138
140
|
color: var(--wd-form-item-label-color-disabled);
|
|
139
141
|
}
|
|
142
|
+
.wd-form-item-wrap__label-content {
|
|
143
|
+
flex: 1;
|
|
144
|
+
}
|
|
140
145
|
.wd-form-item-wrap__label > label {
|
|
141
146
|
display: inline-block;
|
|
142
147
|
line-height: var(--wd-font-line-height-default);
|
|
@@ -287,6 +287,8 @@
|
|
|
287
287
|
display: flex;
|
|
288
288
|
}
|
|
289
289
|
.wd-form-item-wrap__label {
|
|
290
|
+
display: flex;
|
|
291
|
+
align-items: center;
|
|
290
292
|
word-break: break-all;
|
|
291
293
|
width: var(--wd-form-item-label-width);
|
|
292
294
|
margin-right: var(--wd-form-item-label-mr);
|
|
@@ -299,6 +301,9 @@
|
|
|
299
301
|
.wd-form-item-wrap__label.is-disabled {
|
|
300
302
|
color: var(--wd-form-item-label-color-disabled);
|
|
301
303
|
}
|
|
304
|
+
.wd-form-item-wrap__label-content {
|
|
305
|
+
flex: 1;
|
|
306
|
+
}
|
|
302
307
|
.wd-form-item-wrap__label > label {
|
|
303
308
|
display: inline-block;
|
|
304
309
|
line-height: var(--wd-font-line-height-default);
|
|
@@ -157,6 +157,8 @@
|
|
|
157
157
|
display: flex;
|
|
158
158
|
}
|
|
159
159
|
.wd-form-item-wrap__label {
|
|
160
|
+
display: flex;
|
|
161
|
+
align-items: center;
|
|
160
162
|
word-break: break-all;
|
|
161
163
|
width: var(--wd-form-item-label-width);
|
|
162
164
|
margin-right: var(--wd-form-item-label-mr);
|
|
@@ -169,6 +171,9 @@
|
|
|
169
171
|
.wd-form-item-wrap__label.is-disabled {
|
|
170
172
|
color: var(--wd-form-item-label-color-disabled);
|
|
171
173
|
}
|
|
174
|
+
.wd-form-item-wrap__label-content {
|
|
175
|
+
flex: 1;
|
|
176
|
+
}
|
|
172
177
|
.wd-form-item-wrap__label > label {
|
|
173
178
|
display: inline-block;
|
|
174
179
|
line-height: var(--wd-font-line-height-default);
|
|
@@ -150,6 +150,8 @@
|
|
|
150
150
|
display: flex;
|
|
151
151
|
}
|
|
152
152
|
.wd-form-item-wrap__label {
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
153
155
|
word-break: break-all;
|
|
154
156
|
width: var(--wd-form-item-label-width);
|
|
155
157
|
margin-right: var(--wd-form-item-label-mr);
|
|
@@ -162,6 +164,9 @@
|
|
|
162
164
|
.wd-form-item-wrap__label.is-disabled {
|
|
163
165
|
color: var(--wd-form-item-label-color-disabled);
|
|
164
166
|
}
|
|
167
|
+
.wd-form-item-wrap__label-content {
|
|
168
|
+
flex: 1;
|
|
169
|
+
}
|
|
165
170
|
.wd-form-item-wrap__label > label {
|
|
166
171
|
display: inline-block;
|
|
167
172
|
line-height: var(--wd-font-line-height-default);
|
|
@@ -24,6 +24,10 @@ Component({
|
|
|
24
24
|
type: Boolean,
|
|
25
25
|
value: false,
|
|
26
26
|
},
|
|
27
|
+
isSlotAuto: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
value: false,
|
|
30
|
+
},
|
|
27
31
|
selectedValue: {
|
|
28
32
|
type: String,
|
|
29
33
|
value: '1',
|
|
@@ -38,6 +42,7 @@ Component({
|
|
|
38
42
|
classPrefix: WD_PREFIX,
|
|
39
43
|
currentIndex: 0,
|
|
40
44
|
tabsData: [],
|
|
45
|
+
slotKey: '1',
|
|
41
46
|
},
|
|
42
47
|
lifetimes: {
|
|
43
48
|
attached() {
|
|
@@ -80,6 +85,7 @@ Component({
|
|
|
80
85
|
if (index !== this.data.currentIndex) {
|
|
81
86
|
this.setData({
|
|
82
87
|
currentIndex: index,
|
|
88
|
+
slotKey: this.properties.list[index]?.slotKey || '1',
|
|
83
89
|
});
|
|
84
90
|
}
|
|
85
91
|
},
|
|
@@ -107,6 +113,7 @@ Component({
|
|
|
107
113
|
});
|
|
108
114
|
this.setData({
|
|
109
115
|
tabsData: tabData,
|
|
116
|
+
slotKey: this.properties.list[currentIndex]?.slotKey || '1',
|
|
110
117
|
});
|
|
111
118
|
this.updateWidgetAPI();
|
|
112
119
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<view id="{{id}}" style="{{style}}" class="{{classPrefix + '-side-tab-root'}} {{classPrefix + '-mp-side-tab-root'}} {{className}}">
|
|
2
2
|
<wd-tabs list="{{tabsData}}" selectedIndex="{{selectedValue}}" direction="vertical" bind:onCurrent="getCurrent" bind:change="change">
|
|
3
|
-
<slot wx:if="{{
|
|
3
|
+
<slot wx:if="{{isSlotAuto}}" name="autoPanel_{{isMultipleSlot?slotKey:'1'}}"></slot>
|
|
4
|
+
<slot wx:elif="{{isMultipleSlot}}" name="panel{{currentIndex + 1}}"></slot>
|
|
4
5
|
<slot wx:else name="panel1"></slot>
|
|
5
6
|
</wd-tabs>
|
|
6
7
|
</view>
|
|
@@ -246,6 +246,8 @@
|
|
|
246
246
|
display: flex;
|
|
247
247
|
}
|
|
248
248
|
.wd-form-item-wrap__label {
|
|
249
|
+
display: flex;
|
|
250
|
+
align-items: center;
|
|
249
251
|
word-break: break-all;
|
|
250
252
|
width: var(--wd-form-item-label-width);
|
|
251
253
|
margin-right: var(--wd-form-item-label-mr);
|
|
@@ -258,6 +260,9 @@
|
|
|
258
260
|
.wd-form-item-wrap__label.is-disabled {
|
|
259
261
|
color: var(--wd-form-item-label-color-disabled);
|
|
260
262
|
}
|
|
263
|
+
.wd-form-item-wrap__label-content {
|
|
264
|
+
flex: 1;
|
|
265
|
+
}
|
|
261
266
|
.wd-form-item-wrap__label > label {
|
|
262
267
|
display: inline-block;
|
|
263
268
|
line-height: var(--wd-font-line-height-default);
|
|
@@ -287,6 +287,8 @@
|
|
|
287
287
|
display: flex;
|
|
288
288
|
}
|
|
289
289
|
.wd-form-item-wrap__label {
|
|
290
|
+
display: flex;
|
|
291
|
+
align-items: center;
|
|
290
292
|
word-break: break-all;
|
|
291
293
|
width: var(--wd-form-item-label-width);
|
|
292
294
|
margin-right: var(--wd-form-item-label-mr);
|
|
@@ -299,6 +301,9 @@
|
|
|
299
301
|
.wd-form-item-wrap__label.is-disabled {
|
|
300
302
|
color: var(--wd-form-item-label-color-disabled);
|
|
301
303
|
}
|
|
304
|
+
.wd-form-item-wrap__label-content {
|
|
305
|
+
flex: 1;
|
|
306
|
+
}
|
|
302
307
|
.wd-form-item-wrap__label > label {
|
|
303
308
|
display: inline-block;
|
|
304
309
|
line-height: var(--wd-font-line-height-default);
|
|
@@ -37,6 +37,9 @@ Component({
|
|
|
37
37
|
handleBlur: function (e) {
|
|
38
38
|
this.triggerEvent('blur', e.detail);
|
|
39
39
|
},
|
|
40
|
+
handleConfirm: function (e) {
|
|
41
|
+
this.triggerEvent('confirm', e.detail);
|
|
42
|
+
},
|
|
40
43
|
updateWidgetAPI: function () {
|
|
41
44
|
const { name, value, label, required, visible, disabled, readOnly } =
|
|
42
45
|
this.data;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
borderedH5="{{borderedH5}}"
|
|
23
23
|
>
|
|
24
24
|
<view class="{{cls}}" wx:if="{{!readOnly}}">
|
|
25
|
-
<textarea placeholder-class="{{placeholderCls}}" auto-focus="{{focus}}" auto-height="{{autoHeight}}" cursor-spacing="{{cursorSpacing}}" focus="{{focus}}" placeholder="{{placeholder}}" value="{{value}}" disabled="{{disabled}}" maxlength="{{maxLength}}" bind:input="handleChange" bind:focus="handleFocus" bind:blur="handleBlur"></textarea>
|
|
25
|
+
<textarea placeholder-class="{{placeholderCls}}" auto-focus="{{focus}}" auto-height="{{autoHeight}}" cursor-spacing="{{cursorSpacing}}" focus="{{focus}}" placeholder="{{placeholder}}" value="{{value}}" disabled="{{disabled}}" maxlength="{{maxLength}}" bind:input="handleChange" bind:focus="handleFocus" bind:blur="handleBlur" bindconfirm="handleConfirm"></textarea>
|
|
26
26
|
<block wx:if="{{counterVisible}}">
|
|
27
27
|
<label class="{{countCls}}">{{counter}}/{{maxLength}}</label>
|
|
28
28
|
</block>
|
|
@@ -24,6 +24,10 @@ Component({
|
|
|
24
24
|
type: Boolean,
|
|
25
25
|
value: false,
|
|
26
26
|
},
|
|
27
|
+
isSlotAuto: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
value: false,
|
|
30
|
+
},
|
|
27
31
|
selectedValue: {
|
|
28
32
|
type: String,
|
|
29
33
|
value: '1',
|
|
@@ -38,6 +42,7 @@ Component({
|
|
|
38
42
|
classPrefix: WD_PREFIX,
|
|
39
43
|
currentIndex: 0,
|
|
40
44
|
tabsData: [],
|
|
45
|
+
slotKey: '1',
|
|
41
46
|
},
|
|
42
47
|
lifetimes: {
|
|
43
48
|
attached() {
|
|
@@ -50,6 +55,10 @@ Component({
|
|
|
50
55
|
this.setData({
|
|
51
56
|
currentIndex: e.detail,
|
|
52
57
|
});
|
|
58
|
+
const idx = e.detail;
|
|
59
|
+
this.triggerEvent('change', {
|
|
60
|
+
value: this.data.tabsData?.[idx]?.value,
|
|
61
|
+
});
|
|
53
62
|
},
|
|
54
63
|
choooseTab: function (params) {
|
|
55
64
|
const value = params?.value;
|
|
@@ -91,7 +100,7 @@ Component({
|
|
|
91
100
|
]),
|
|
92
101
|
},
|
|
93
102
|
observers: {
|
|
94
|
-
selectedValue: function (selectedValue) {
|
|
103
|
+
'selectedValue, list': function (selectedValue) {
|
|
95
104
|
this.setCurrentIndex(selectedValue);
|
|
96
105
|
},
|
|
97
106
|
'currentIndex, list': function (currentIndex, list) {
|
|
@@ -103,14 +112,10 @@ Component({
|
|
|
103
112
|
});
|
|
104
113
|
this.setData({
|
|
105
114
|
tabsData: tabData,
|
|
115
|
+
slotKey: this.properties.list[currentIndex]?.slotKey || '1',
|
|
106
116
|
});
|
|
107
117
|
|
|
108
118
|
this.updateWidgetAPI();
|
|
109
119
|
},
|
|
110
|
-
currentIndex: function (currentIndex) {
|
|
111
|
-
this.triggerEvent('change', {
|
|
112
|
-
value: this.properties.list[currentIndex]?.value,
|
|
113
|
-
});
|
|
114
|
-
},
|
|
115
120
|
},
|
|
116
121
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<view id="{{id}}" style="{{style}}" class="{{classPrefix + '-top-tab-root'}} {{classPrefix + '-mp-top-tab-root'}} {{className}}">
|
|
2
2
|
<wd-tabs list="{{tabsData}}" selectedIndex="{{selectedValue}}" direction="horizontal" bind:onCurrent="getCurrent" bind:change="change" currentIndex="{{currentIndex}}">
|
|
3
|
-
<slot wx:if="
|
|
4
|
-
<slot wx:
|
|
3
|
+
<slot wx:if="{{isSlotAuto}}" name="autoPanel_{{isMultipleSlot?slotKey:'1'}}"></slot>
|
|
4
|
+
<slot wx:elif="{{isMultipleSlot}}" name="panel{{currentIndex + 1}}"></slot>
|
|
5
5
|
</wd-tabs>
|
|
6
6
|
</view>
|
|
@@ -2,7 +2,7 @@ import { getTempFileURL } from '../../utils/tcb';
|
|
|
2
2
|
import handleEvents from '../../utils/handleEvents';
|
|
3
3
|
import { commonCompBehavior } from '../../utils/common-behavior';
|
|
4
4
|
import { getWedaAPI } from '../../utils/getWedaApi';
|
|
5
|
-
|
|
5
|
+
import { errorHandler } from '../../utils/error';
|
|
6
6
|
// component/videojs.js
|
|
7
7
|
Component({
|
|
8
8
|
/**
|
|
@@ -160,7 +160,11 @@ Component({
|
|
|
160
160
|
.then((res) => {
|
|
161
161
|
this.setData({ realSrc: res || '' });
|
|
162
162
|
})
|
|
163
|
-
.catch(() => {
|
|
163
|
+
.catch((e) => {
|
|
164
|
+
errorHandler({
|
|
165
|
+
code: 'WedaVideo.GetVideoDataSourceError',
|
|
166
|
+
error: e,
|
|
167
|
+
});
|
|
164
168
|
this.setData({
|
|
165
169
|
realSrc: videoDataSource,
|
|
166
170
|
});
|
package/package.json
CHANGED
package/style/wd-design.wxss
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
:root,
|
|
8
|
-
page
|
|
8
|
+
page,
|
|
9
|
+
:host {
|
|
9
10
|
--wd-font-size-1: 0.625rem;
|
|
10
11
|
--wd-font-size-2: 0.75rem;
|
|
11
12
|
--wd-font-size-3: 0.875rem;
|
|
@@ -254,6 +255,7 @@ page {
|
|
|
254
255
|
|
|
255
256
|
:root,
|
|
256
257
|
page,
|
|
258
|
+
:host,
|
|
257
259
|
:root[theme-mode=light],
|
|
258
260
|
page[theme-mode=light],
|
|
259
261
|
.wd-theme-light {
|
package/utils/color.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { errorHandler } from './error';
|
|
1
2
|
/**
|
|
2
3
|
* 十六进制、rgba、rgb、hsl、hsla 都换算成 rgba
|
|
3
4
|
*/
|
|
@@ -47,6 +48,10 @@ export function colorToRgba(color, alpha = 1) {
|
|
|
47
48
|
a = a * alpha;
|
|
48
49
|
return `rgba(${r},${g},${b},${a})`;
|
|
49
50
|
} catch (e) {
|
|
51
|
+
errorHandler({
|
|
52
|
+
code: 'ColorToRgbaError',
|
|
53
|
+
error: e,
|
|
54
|
+
});
|
|
50
55
|
return color;
|
|
51
56
|
}
|
|
52
57
|
}
|
package/utils/date.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import dayjs from './dayjs.min.js';
|
|
2
|
-
|
|
2
|
+
import { errorHandler } from './error.js';
|
|
3
3
|
export const isDateNil = (v) => v === '' || v == null;
|
|
4
4
|
|
|
5
5
|
// 将时间值转 dayjs 类型
|
|
@@ -11,6 +11,10 @@ export const convertDayjs = (val) => {
|
|
|
11
11
|
if (!m?.isValid()) return null;
|
|
12
12
|
} catch (e) {
|
|
13
13
|
console.warn('[function convertDayjs]: ', e);
|
|
14
|
+
errorHandler({
|
|
15
|
+
code: 'ConvertDayjsError',
|
|
16
|
+
error: e,
|
|
17
|
+
});
|
|
14
18
|
}
|
|
15
19
|
return m;
|
|
16
20
|
};
|
package/utils/error.js
CHANGED
|
@@ -13,12 +13,12 @@ export class WdCompError extends Error {
|
|
|
13
13
|
|
|
14
14
|
export const errorHandler = ({ id = '', code, error }) => {
|
|
15
15
|
const comErrorInfo = {
|
|
16
|
-
code
|
|
16
|
+
code,
|
|
17
17
|
requestId: error?.requestId,
|
|
18
18
|
original: error,
|
|
19
19
|
message: `[组件${id}:${code}]${error?.message || error?.errMsg || code}`,
|
|
20
20
|
};
|
|
21
21
|
const compError = new WdCompError(comErrorInfo.message, comErrorInfo);
|
|
22
|
-
console.error(comErrorInfo);
|
|
22
|
+
console.error(`${comErrorInfo.code}:`, comErrorInfo);
|
|
23
23
|
return { compError, comErrorInfo };
|
|
24
24
|
};
|
package/utils/getModelParams.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getWhereList, getParseValue } from './platform';
|
|
2
2
|
import { getDataSourceByName } from './tcb';
|
|
3
3
|
import { isNil } from './lodash';
|
|
4
|
-
|
|
4
|
+
import { errorHandler } from './error';
|
|
5
5
|
/**
|
|
6
6
|
* 兼容新旧查询条件协议
|
|
7
7
|
*/
|
|
@@ -10,7 +10,12 @@ export const convertWhere = (props) => {
|
|
|
10
10
|
try {
|
|
11
11
|
where = props.queryCondition || getWhereList(props.where);
|
|
12
12
|
where = getParseValue(where);
|
|
13
|
-
} catch (e) {
|
|
13
|
+
} catch (e) {
|
|
14
|
+
errorHandler({
|
|
15
|
+
code: 'ConvertQueryError',
|
|
16
|
+
error: e,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
14
19
|
return Array.isArray(where) ? where : [];
|
|
15
20
|
};
|
|
16
21
|
|
|
@@ -95,6 +100,14 @@ export const getModelParams = async (props) => {
|
|
|
95
100
|
params['filter'] = getFilter(props.queryCondition);
|
|
96
101
|
}
|
|
97
102
|
params.select = await getSelectFields(props);
|
|
103
|
+
// 处理排序字段
|
|
104
|
+
if (params.orderBy && ['asc', 'desc'].includes(params.orderType)) {
|
|
105
|
+
params.orderBy = [{ [params.orderBy]: params.orderType }];
|
|
106
|
+
}
|
|
107
|
+
// 支持多字段排序
|
|
108
|
+
if (props.isSupportMultipleSort) {
|
|
109
|
+
params.orderBy = transformSorter(props.sorter);
|
|
110
|
+
}
|
|
98
111
|
} else {
|
|
99
112
|
const where = convertWhere(props);
|
|
100
113
|
if (Array.isArray(where) && where.length > 0) {
|
|
@@ -102,7 +115,10 @@ export const getModelParams = async (props) => {
|
|
|
102
115
|
}
|
|
103
116
|
}
|
|
104
117
|
} catch (e) {
|
|
105
|
-
|
|
118
|
+
errorHandler({
|
|
119
|
+
code: 'GetModelParamsError',
|
|
120
|
+
error: e,
|
|
121
|
+
});
|
|
106
122
|
}
|
|
107
123
|
return params;
|
|
108
124
|
};
|
|
@@ -115,3 +131,19 @@ export const getPageParams = (pageNo, pageSize) => {
|
|
|
115
131
|
}
|
|
116
132
|
return tcbParams;
|
|
117
133
|
};
|
|
134
|
+
|
|
135
|
+
const transformSorter = (sorter = []) => {
|
|
136
|
+
return sorter
|
|
137
|
+
?.filter((n) => (n.orderBy && n.orderType) || n.relationalTableName)
|
|
138
|
+
?.map((i) => {
|
|
139
|
+
if (i.relationalTableName) {
|
|
140
|
+
return {
|
|
141
|
+
[i.relationalTableName]: i.sorter
|
|
142
|
+
?.filter((j) => j.orderBy && j.orderType)
|
|
143
|
+
?.map((k) => ({ [k.orderBy]: k.orderType })),
|
|
144
|
+
};
|
|
145
|
+
} else {
|
|
146
|
+
return { [i.orderBy]: i.orderType };
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
};
|
package/utils/platform.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { REL_DICT } from './constant';
|
|
2
|
-
|
|
2
|
+
import { errorHandler } from './error';
|
|
3
3
|
/**
|
|
4
4
|
* 文件字节转换
|
|
5
5
|
*/
|
|
@@ -88,6 +88,10 @@ export const getWhereList = (where) => {
|
|
|
88
88
|
}
|
|
89
89
|
return [];
|
|
90
90
|
} catch (error) {
|
|
91
|
+
errorHandler({
|
|
92
|
+
code: 'GetWhereListError',
|
|
93
|
+
error,
|
|
94
|
+
});
|
|
91
95
|
return [];
|
|
92
96
|
}
|
|
93
97
|
};
|
package/utils/tcb.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getWedaAPI } from './getWedaApi';
|
|
2
2
|
import { deepClone } from './lodash';
|
|
3
|
-
|
|
3
|
+
import { errorHandler } from './error';
|
|
4
4
|
// 默认使用swr的methodName
|
|
5
5
|
const SWR_METHOD_DEFAULT = ['wedaGetItem', 'wedaGetRecords', 'getApiKey'];
|
|
6
6
|
// 默认使用swr的action
|
|
@@ -51,7 +51,12 @@ export async function getTempFileURL(data) {
|
|
|
51
51
|
if (/^cloud:\/\//.test(data)) {
|
|
52
52
|
return await getWedaAPI()?.app.cloud.getTempFileURL?.(data);
|
|
53
53
|
}
|
|
54
|
-
} catch (e) {
|
|
54
|
+
} catch (e) {
|
|
55
|
+
errorHandler({
|
|
56
|
+
code: 'GetTempFileURLError',
|
|
57
|
+
error: e,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
55
60
|
return data;
|
|
56
61
|
}
|
|
57
62
|
|
|
@@ -76,7 +81,10 @@ export async function getAppCustomNav() {
|
|
|
76
81
|
});
|
|
77
82
|
return res;
|
|
78
83
|
} catch (error) {
|
|
79
|
-
|
|
84
|
+
errorHandler({
|
|
85
|
+
code: 'GetAppCustomNavError',
|
|
86
|
+
error,
|
|
87
|
+
});
|
|
80
88
|
return {};
|
|
81
89
|
}
|
|
82
90
|
}
|
|
@@ -129,7 +137,10 @@ export async function callDataSourceApi(param) {
|
|
|
129
137
|
try {
|
|
130
138
|
return await callDataSource(param);
|
|
131
139
|
} catch (error) {
|
|
132
|
-
|
|
140
|
+
errorHandler({
|
|
141
|
+
code: 'CallDataSourceError',
|
|
142
|
+
error,
|
|
143
|
+
});
|
|
133
144
|
return {};
|
|
134
145
|
}
|
|
135
146
|
}
|
|
@@ -143,6 +154,10 @@ export const resolveStaticResourceUrl = (path) => {
|
|
|
143
154
|
getWedaAPI()?.app?.__internal__?.resolveStaticResourceUrl(path);
|
|
144
155
|
return resourceUrl;
|
|
145
156
|
} catch (error) {
|
|
157
|
+
errorHandler({
|
|
158
|
+
code: 'ResolveStaticResourceUrlError',
|
|
159
|
+
error,
|
|
160
|
+
});
|
|
146
161
|
return '';
|
|
147
162
|
}
|
|
148
163
|
};
|