@cloudbase/weda-ui-mp 3.26.2 → 3.27.1
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/chart/common/core/eChartBar.js +1 -1
- package/components/chart/common/core/eChartLine.js +1 -1
- package/components/chart/common/data-transform.js +2 -2
- package/components/chart/statisticsCard/index.js +20 -0
- package/components/wd-form/index.js +5 -2
- package/components/wd-image/index.js +5 -9
- package/components/wd-input-number/index.wxml +2 -2
- package/package.json +1 -1
|
@@ -130,7 +130,7 @@ class EchartBar extends EchartBase {
|
|
|
130
130
|
if (this.config.series.length > 0 && setColor && setColor.length > 0) {
|
|
131
131
|
let i = 0;
|
|
132
132
|
this.config.series.forEach((itemSeries) => {
|
|
133
|
-
itemSeries.itemStyle.color = setColor[i %
|
|
133
|
+
itemSeries.itemStyle.color = setColor[i % (setColor?.length || 1)];
|
|
134
134
|
i = i + 1;
|
|
135
135
|
});
|
|
136
136
|
}
|
|
@@ -128,7 +128,7 @@ class EchartLine extends EchartBase {
|
|
|
128
128
|
if (this.config.series.length > 0 && setColor && setColor.length > 0) {
|
|
129
129
|
let i = 0;
|
|
130
130
|
this.config.series.forEach((itemSeries) => {
|
|
131
|
-
lodashSet(itemSeries, 'itemStyle.color', setColor[i %
|
|
131
|
+
lodashSet(itemSeries, 'itemStyle.color', setColor[i % (setColor?.length || 1)]);
|
|
132
132
|
i = i + 1;
|
|
133
133
|
});
|
|
134
134
|
}
|
|
@@ -105,7 +105,7 @@ export function transform(chartType, dataInput, chartInput) {
|
|
|
105
105
|
chartType === 'pie'
|
|
106
106
|
? undefined
|
|
107
107
|
: {
|
|
108
|
-
color: chartInput?.setColor?.[idx %
|
|
108
|
+
color: chartInput?.setColor?.[idx % (chartInput?.setColor?.length || 1)] ?? null,
|
|
109
109
|
},
|
|
110
110
|
data:
|
|
111
111
|
chartType === 'pie'
|
|
@@ -165,7 +165,7 @@ export function transform(chartType, dataInput, chartInput) {
|
|
|
165
165
|
chartType === 'pie'
|
|
166
166
|
? undefined
|
|
167
167
|
: {
|
|
168
|
-
color: chartInput?.setColor?.[idx %
|
|
168
|
+
color: chartInput?.setColor?.[idx % (chartInput?.setColor?.length || 1)] ?? null,
|
|
169
169
|
},
|
|
170
170
|
data: [],
|
|
171
171
|
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { callDataSource, callWedaApi } from '../../../utils/tcb';
|
|
2
|
+
import { commonCompBehavior } from '../../../utils/common-behavior';
|
|
2
3
|
|
|
3
4
|
const DEFAULT_VAL = 1000;
|
|
4
5
|
|
|
5
6
|
Component({
|
|
7
|
+
behaviors: [commonCompBehavior],
|
|
6
8
|
properties: {
|
|
7
9
|
className: {
|
|
8
10
|
type: String,
|
|
@@ -62,8 +64,18 @@ Component({
|
|
|
62
64
|
},
|
|
63
65
|
data: {
|
|
64
66
|
count: DEFAULT_VAL,
|
|
67
|
+
value: DEFAULT_VAL,
|
|
65
68
|
},
|
|
66
69
|
methods: {
|
|
70
|
+
updateWidgetAPI: function () {
|
|
71
|
+
const { label, unit, count, value } = this.data;
|
|
72
|
+
this.setReadonlyAttributes?.({
|
|
73
|
+
label,
|
|
74
|
+
unit,
|
|
75
|
+
calculatedValue: count,
|
|
76
|
+
value,
|
|
77
|
+
});
|
|
78
|
+
},
|
|
67
79
|
scientificToNumber: function (num) {
|
|
68
80
|
const str = num;
|
|
69
81
|
const reg = /^([-]?\d+\.?\d*)(e)([-|+]?\d+)$/;
|
|
@@ -206,17 +218,20 @@ Component({
|
|
|
206
218
|
count: this.properties.isShowUnit
|
|
207
219
|
? this.formatNumber(val / this.properties.unit, this.properties.decimalDigits)
|
|
208
220
|
: val,
|
|
221
|
+
value: val,
|
|
209
222
|
});
|
|
210
223
|
} else {
|
|
211
224
|
// 返回数据为空 使用 0
|
|
212
225
|
this.setData({
|
|
213
226
|
count: this.formatNumber(0, this.properties.decimalDigits),
|
|
227
|
+
value: 0,
|
|
214
228
|
});
|
|
215
229
|
}
|
|
216
230
|
} else {
|
|
217
231
|
// 没有配置数据使用默认数据
|
|
218
232
|
this.setData({
|
|
219
233
|
count: this.formatNumber(DEFAULT_VAL, this.properties.decimalDigits),
|
|
234
|
+
value: DEFAULT_VAL,
|
|
220
235
|
});
|
|
221
236
|
}
|
|
222
237
|
},
|
|
@@ -224,15 +239,20 @@ Component({
|
|
|
224
239
|
lifetimes: {
|
|
225
240
|
attached() {
|
|
226
241
|
this._fetchData();
|
|
242
|
+
this.updateWidgetAPI();
|
|
227
243
|
},
|
|
228
244
|
},
|
|
229
245
|
attached() {
|
|
230
246
|
this._fetchData();
|
|
247
|
+
this.updateWidgetAPI();
|
|
231
248
|
},
|
|
232
249
|
observers: {
|
|
233
250
|
// 当参数变化时
|
|
234
251
|
'datasource,filterData,field,operationType,label,isCountEmpty,isShowUnit,unit,decimalDigits,suffix': function () {
|
|
235
252
|
this._fetchData();
|
|
236
253
|
},
|
|
254
|
+
'unit,label,count,value': function () {
|
|
255
|
+
this.updateWidgetAPI();
|
|
256
|
+
},
|
|
237
257
|
},
|
|
238
258
|
});
|
|
@@ -563,7 +563,10 @@ Component({
|
|
|
563
563
|
value,
|
|
564
564
|
) {
|
|
565
565
|
const isDataModel = !['connector', 'custom-connector', 'expression'].includes(datasourceType);
|
|
566
|
-
if (isDataModel && formTypeWithInitValue
|
|
566
|
+
if (isDataModel && !formTypeWithInitValue.includes(formType)) {
|
|
567
|
+
this.setData({ _preDataId: undefined });
|
|
568
|
+
}
|
|
569
|
+
if (isDataModel && formTypeWithInitValue.includes(formType) && _id && !equal(_id, this.data._preDataId)) {
|
|
567
570
|
this.setData({ isLoadingData: true });
|
|
568
571
|
}
|
|
569
572
|
clearTimeout(this.data._delayRef.current.initTimer);
|
|
@@ -576,7 +579,7 @@ Component({
|
|
|
576
579
|
}
|
|
577
580
|
}
|
|
578
581
|
if (isDataModel) {
|
|
579
|
-
if (_id && !equal(_id, this.data._preDataId)) {
|
|
582
|
+
if (formTypeWithInitValue.includes(formType) && _id && !equal(_id, this.data._preDataId)) {
|
|
580
583
|
this.setData({ _preDataId: _id });
|
|
581
584
|
this._initValue();
|
|
582
585
|
}
|
|
@@ -95,15 +95,11 @@ Component({
|
|
|
95
95
|
const { windowWidth, windowHeight } = wx.getSystemInfoSync();
|
|
96
96
|
|
|
97
97
|
const widthRasio = (windowWidth * SCALE_RASIO_H5) / this.data.realWidth;
|
|
98
|
-
const heightRasio =
|
|
99
|
-
|
|
100
|
-
const scale
|
|
101
|
-
Math.min(widthRasio, heightRasio, ASPECT_RASIO) || ASPECT_RASIO;
|
|
102
|
-
const offsetHeight =
|
|
103
|
-
(windowHeight - this.data.realHeight * scale) * OFFSET_RASIO;
|
|
98
|
+
const heightRasio = (windowHeight * SCALE_RASIO_H5) / this.data.realHeight;
|
|
99
|
+
const scale = Math.min(widthRasio, heightRasio, ASPECT_RASIO) || ASPECT_RASIO;
|
|
100
|
+
const offsetHeight = (windowHeight - this.data.realHeight * scale) * OFFSET_RASIO;
|
|
104
101
|
|
|
105
|
-
const offsetWidth =
|
|
106
|
-
(windowWidth - this.data.realWidth * scale) * OFFSET_RASIO;
|
|
102
|
+
const offsetWidth = (windowWidth - this.data.realWidth * scale) * OFFSET_RASIO;
|
|
107
103
|
const showHeight = this.data.realHeight * scale;
|
|
108
104
|
const showWidth = this.data.realWidth * scale;
|
|
109
105
|
this.setData({
|
|
@@ -178,7 +174,7 @@ Component({
|
|
|
178
174
|
app.cloud
|
|
179
175
|
.getTempFileURL(src)
|
|
180
176
|
.then((res) => {
|
|
181
|
-
this.setData({ realSrc: res ||
|
|
177
|
+
this.setData({ realSrc: res || src });
|
|
182
178
|
})
|
|
183
179
|
.catch(() => {
|
|
184
180
|
this.setData({
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
after="{{after}}"
|
|
25
25
|
>
|
|
26
26
|
<block wx:if="{{stepOption === 'both'}}">
|
|
27
|
-
<wd-button className="{{root}}-btn size-{{_size}} {{stepMinusDisabled ? 'is-disabled' : ''}} {{root}}-btn__before " iconType="icon-only" iconPosition="before" iconSource="inner" variant="outline" theme="secondary" icon="td:remove" bind:
|
|
27
|
+
<wd-button className="{{root}}-btn size-{{_size}} {{stepMinusDisabled ? 'is-disabled' : ''}} {{root}}-btn__before " iconType="icon-only" iconPosition="before" iconSource="inner" variant="outline" theme="secondary" icon="td:remove" bind:tap="stepMinus"> </wd-button>
|
|
28
28
|
</block>
|
|
29
29
|
<wd-input-group before="{{before}}" after="{{after}}" block="{{true}}" size="{{_size}}" classRoot="{{classRoot}}" className="is-not-h5">
|
|
30
30
|
<view class="{{cls}}">
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
</view>
|
|
61
61
|
</wd-input-group>
|
|
62
62
|
<block wx:if="{{stepOption === 'both'}}">
|
|
63
|
-
<wd-button className="{{root}}-btn size-{{_size}} {{stepPlusDisabled ? 'is-disabled' : ''}} {{root}}-btn__after" iconType="icon-only" iconPosition="before" iconSource="inner" variant="outline" theme="secondary" icon="td:add" bind:
|
|
63
|
+
<wd-button className="{{root}}-btn size-{{_size}} {{stepPlusDisabled ? 'is-disabled' : ''}} {{root}}-btn__after" iconType="icon-only" iconPosition="before" iconSource="inner" variant="outline" theme="secondary" icon="td:add" bind:tap="stepAdd"> </wd-button>
|
|
64
64
|
</block>
|
|
65
65
|
</wd-form-item>
|
|
66
66
|
</block>
|