@cloudbase/weda-ui-mp 3.8.0 → 3.8.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.
|
@@ -184,7 +184,7 @@ Component({
|
|
|
184
184
|
stepMinus(e) {
|
|
185
185
|
this.onRealChange(e, 'minus');
|
|
186
186
|
},
|
|
187
|
-
onRealChange(e, type = '') {
|
|
187
|
+
onRealChange(e, type = '', { needSetData = true, value = '' } = {}) {
|
|
188
188
|
const { readOnly, disabled, status, format, step } = this.properties;
|
|
189
189
|
if (readOnly || disabled || (status && status !== 'edit'))
|
|
190
190
|
return this.data.realValue;
|
|
@@ -200,31 +200,39 @@ Component({
|
|
|
200
200
|
(type === 'plus' && stepPlusDisabled) ||
|
|
201
201
|
(type === 'minus' && stepMinusDisabled)
|
|
202
202
|
) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
203
|
+
needSetData &&
|
|
204
|
+
this.setData({
|
|
205
|
+
stepPlusDisabled,
|
|
206
|
+
stepMinusDisabled,
|
|
207
|
+
});
|
|
208
|
+
return Number(value || this.data.showValue);
|
|
208
209
|
}
|
|
209
210
|
}
|
|
210
211
|
|
|
211
212
|
const toShow = this.getShowValue({
|
|
212
213
|
...this.properties,
|
|
213
|
-
value: this.data.showValue,
|
|
214
|
+
value: value || this.data.showValue,
|
|
214
215
|
type,
|
|
216
|
+
needSetData,
|
|
215
217
|
});
|
|
216
218
|
const toReal = getRealValue({ value: toShow, format });
|
|
217
219
|
const detail = { ...e.detail, value: toReal };
|
|
218
|
-
|
|
219
|
-
|
|
220
|
+
|
|
221
|
+
if (needSetData) {
|
|
222
|
+
this.changeForm(detail);
|
|
223
|
+
this.triggerEvent('change', detail);
|
|
224
|
+
} else {
|
|
225
|
+
this.triggerEvent('input', detail);
|
|
226
|
+
}
|
|
220
227
|
|
|
221
228
|
const upDownState = this.getStepDisabled(null, toReal);
|
|
222
229
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
230
|
+
needSetData &&
|
|
231
|
+
this.setData({
|
|
232
|
+
realValue: toReal,
|
|
233
|
+
showValue: toShow,
|
|
234
|
+
...upDownState,
|
|
235
|
+
});
|
|
228
236
|
|
|
229
237
|
return toReal;
|
|
230
238
|
},
|
|
@@ -251,6 +259,7 @@ Component({
|
|
|
251
259
|
|
|
252
260
|
if (value === 'Infinity' || value === '-Infinity') {
|
|
253
261
|
this.setData({ showValue: value });
|
|
262
|
+
this.triggerEvent('input', { ...e.detail, value });
|
|
254
263
|
return;
|
|
255
264
|
}
|
|
256
265
|
|
|
@@ -265,6 +274,8 @@ Component({
|
|
|
265
274
|
}
|
|
266
275
|
|
|
267
276
|
this.setData({ showValue: value });
|
|
277
|
+
|
|
278
|
+
this.onRealChange(e, '', { needSetData: false, value });
|
|
268
279
|
},
|
|
269
280
|
handleClear: function (e) {
|
|
270
281
|
const detail = { ...e.detail, value: null };
|
|
@@ -340,6 +351,7 @@ Component({
|
|
|
340
351
|
min,
|
|
341
352
|
format,
|
|
342
353
|
type = '',
|
|
354
|
+
needSetData = true,
|
|
343
355
|
}) {
|
|
344
356
|
if (value === '' && !['plus', 'minus'].includes(type)) return '';
|
|
345
357
|
|
|
@@ -399,11 +411,12 @@ Component({
|
|
|
399
411
|
}`;
|
|
400
412
|
}
|
|
401
413
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
414
|
+
needSetData &&
|
|
415
|
+
this.setData({
|
|
416
|
+
validateState: validState,
|
|
417
|
+
validateErrorMsg: validMsg,
|
|
418
|
+
selfDefineRules: rules,
|
|
419
|
+
});
|
|
407
420
|
|
|
408
421
|
return res;
|
|
409
422
|
},
|
|
@@ -50,6 +50,10 @@ Component({
|
|
|
50
50
|
this.setData({
|
|
51
51
|
currentIndex: e.detail,
|
|
52
52
|
});
|
|
53
|
+
const idx = e.detail;
|
|
54
|
+
this.triggerEvent('change', {
|
|
55
|
+
value: this.data.tabsData?.[idx]?.value,
|
|
56
|
+
});
|
|
53
57
|
},
|
|
54
58
|
choooseTab: function (params) {
|
|
55
59
|
const value = params?.value;
|
|
@@ -91,7 +95,7 @@ Component({
|
|
|
91
95
|
]),
|
|
92
96
|
},
|
|
93
97
|
observers: {
|
|
94
|
-
selectedValue: function (selectedValue) {
|
|
98
|
+
'selectedValue, list': function (selectedValue) {
|
|
95
99
|
this.setCurrentIndex(selectedValue);
|
|
96
100
|
},
|
|
97
101
|
'currentIndex, list': function (currentIndex, list) {
|
|
@@ -104,9 +108,6 @@ Component({
|
|
|
104
108
|
this.setData({
|
|
105
109
|
tabsData: tabData,
|
|
106
110
|
});
|
|
107
|
-
this.triggerEvent('change', {
|
|
108
|
-
value: tabData.find((v) => v.selected)?.value,
|
|
109
|
-
});
|
|
110
111
|
this.updateWidgetAPI();
|
|
111
112
|
},
|
|
112
113
|
},
|