@cloudbase/weda-ui-mp 3.20.4 → 3.20.6
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.
|
@@ -4,6 +4,7 @@ import itemBehavior from '../form-field-behavior/item-behavior';
|
|
|
4
4
|
import { convertFixedIcon, SELECT_ICON_H5 } from '../../utils/getFormLegacy';
|
|
5
5
|
import debounce from '../../utils/debounce';
|
|
6
6
|
import { arrayToMap, getSelected } from '../../utils/tool';
|
|
7
|
+
import { isFormatNeedFetch } from './select/formats-util';
|
|
7
8
|
|
|
8
9
|
Component({
|
|
9
10
|
options: { virtualHost: true, styleIsolation: 'shared' },
|
|
@@ -80,7 +81,9 @@ Component({
|
|
|
80
81
|
this.setData({ _suffixType, _suffixIcon });
|
|
81
82
|
},
|
|
82
83
|
range: function (range) {
|
|
83
|
-
|
|
84
|
+
if (!isFormatNeedFetch(this.data.format)) {
|
|
85
|
+
this.updateSelect({ detail: { value: this.data.value, option: range } });
|
|
86
|
+
}
|
|
84
87
|
},
|
|
85
88
|
selectFieldLabel: function (selectFieldLabel) {
|
|
86
89
|
this.setData({
|
|
@@ -6,6 +6,7 @@ import deepEqual from '../../../utils/deepEqual';
|
|
|
6
6
|
import { getDefaultQuery } from '../../../utils/getModelParams';
|
|
7
7
|
import { isFormatNeedFetch, isFormatWithFilterable } from './formats-util';
|
|
8
8
|
import { textToString } from '../../../utils/platform';
|
|
9
|
+
import { errorHandler } from '../../../utils/error';
|
|
9
10
|
|
|
10
11
|
const STATUS_CLOSED = 0;
|
|
11
12
|
const STATUS_LOADING = 1;
|
|
@@ -108,6 +109,7 @@ Component({
|
|
|
108
109
|
currentPageNo: 1,
|
|
109
110
|
_filterable: false,
|
|
110
111
|
hasNextPage: true,
|
|
112
|
+
preDisplayValue: '',
|
|
111
113
|
},
|
|
112
114
|
lifetimes: {
|
|
113
115
|
attached() {
|
|
@@ -154,6 +156,15 @@ Component({
|
|
|
154
156
|
displayValue: label,
|
|
155
157
|
});
|
|
156
158
|
},
|
|
159
|
+
displayValue: function (displayValue) {
|
|
160
|
+
if (!deepEqual(this.data.preDisplayValue, displayValue)) {
|
|
161
|
+
const { value, option } = this.data;
|
|
162
|
+
this.triggerEvent('updateSelect', { value, option });
|
|
163
|
+
this.setData({
|
|
164
|
+
preDisplayValue: displayValue,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
},
|
|
157
168
|
enumName: function (enumName) {
|
|
158
169
|
if (this.properties.format === 'x-enum' && enumName) {
|
|
159
170
|
this._fetchEnumData();
|
|
@@ -276,7 +287,6 @@ Component({
|
|
|
276
287
|
currentPageNo: pageNo,
|
|
277
288
|
hasNextPage: stringRange?.length < res?.total,
|
|
278
289
|
});
|
|
279
|
-
this.triggerEvent('updateSelect', { value: value, option: stringRange });
|
|
280
290
|
},
|
|
281
291
|
_childFetchData: function (data) {
|
|
282
292
|
if (this.data.hasNextPage) {
|
|
@@ -337,28 +347,43 @@ Component({
|
|
|
337
347
|
},
|
|
338
348
|
// 获取通用选项集列表
|
|
339
349
|
_fetchEnumData: async function () {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
350
|
+
try {
|
|
351
|
+
let data = await callWedaApi({
|
|
352
|
+
action: 'DescribeGeneralOptionsDetailList',
|
|
353
|
+
data: {
|
|
354
|
+
OptNameList: [this.properties.enumName],
|
|
355
|
+
PageIndex: 1,
|
|
356
|
+
PageSize: 10,
|
|
357
|
+
},
|
|
358
|
+
});
|
|
348
359
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
const config = destr(data?.Items?.[0]?.Config) ?? [];
|
|
361
|
+
const option = config.map((item) => {
|
|
362
|
+
return {
|
|
363
|
+
label: item.value,
|
|
364
|
+
value: item.key,
|
|
365
|
+
name: item.value,
|
|
366
|
+
};
|
|
367
|
+
});
|
|
368
|
+
const label = this.getLabels(this.data.value, option);
|
|
369
|
+
this.setData({
|
|
370
|
+
selectRange: option.map((item) => item.label),
|
|
371
|
+
option,
|
|
372
|
+
loadStatus: option.length > 0 ? 0 : STATUS_EMPTY,
|
|
373
|
+
displayValue: label,
|
|
374
|
+
});
|
|
375
|
+
} catch (error) {
|
|
376
|
+
errorHandler({
|
|
377
|
+
code: 'wdSelect.GetEnumDataError',
|
|
378
|
+
error: error,
|
|
379
|
+
});
|
|
380
|
+
this.setData({
|
|
381
|
+
loadStatus: STATUS_FAILED,
|
|
382
|
+
selectRange: [],
|
|
383
|
+
option: [],
|
|
384
|
+
displayValue: '',
|
|
385
|
+
});
|
|
386
|
+
}
|
|
362
387
|
},
|
|
363
388
|
getUniqueOption: function (option) {
|
|
364
389
|
const optionMap = option.reduce((acc, item) => {
|
|
@@ -4,6 +4,7 @@ import itemBehavior from '../form-field-behavior/item-behavior';
|
|
|
4
4
|
import { convertFixedIcon, SELECT_ICON_H5 } from '../../utils/getFormLegacy';
|
|
5
5
|
import { safeObj, arrayToMap, getSelected } from '../../utils/tool';
|
|
6
6
|
import debounce from '../../utils/debounce';
|
|
7
|
+
import { isFormatNeedFetch } from '../wd-select/select/formats-util';
|
|
7
8
|
|
|
8
9
|
Component({
|
|
9
10
|
options: { virtualHost: true, styleIsolation: 'shared' },
|
|
@@ -83,7 +84,9 @@ Component({
|
|
|
83
84
|
this.setData({ _suffixType, _suffixIcon });
|
|
84
85
|
},
|
|
85
86
|
range: function (range) {
|
|
86
|
-
|
|
87
|
+
if (!isFormatNeedFetch(this.data.format)) {
|
|
88
|
+
this.updateSelect({ detail: { value: this.data.value, option: range } });
|
|
89
|
+
}
|
|
87
90
|
},
|
|
88
91
|
selectFieldLabel: function (selectFieldLabel) {
|
|
89
92
|
this.setData({
|