@cloudbase/weda-ui-mp 3.17.7 → 3.18.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/wd-select/index.js +17 -3
- package/components/wd-select/index.wxml +1 -1
- package/components/wd-select/select/dropdown-select/index.js +15 -7
- package/components/wd-select/select/dropdown-select/index.wxml +1 -1
- package/components/wd-select/select/index.js +5 -11
- package/components/wd-select/select.wxss +2 -2
- package/components/wd-select-multiple/index.js +16 -3
- package/components/wd-select-multiple/index.wxml +1 -1
- package/package.json +1 -1
|
@@ -33,6 +33,10 @@ Component({
|
|
|
33
33
|
type: Boolean,
|
|
34
34
|
value: false,
|
|
35
35
|
},
|
|
36
|
+
selectFieldLabel: {
|
|
37
|
+
type: String,
|
|
38
|
+
value: '',
|
|
39
|
+
},
|
|
36
40
|
},
|
|
37
41
|
data: {
|
|
38
42
|
itemMap: {},
|
|
@@ -40,14 +44,15 @@ Component({
|
|
|
40
44
|
selectedItem: null,
|
|
41
45
|
_suffixType: '',
|
|
42
46
|
_suffixIcon: '',
|
|
47
|
+
showLabel: '',
|
|
43
48
|
},
|
|
44
49
|
methods: {
|
|
45
50
|
finalUpdateWidgetAPI: function () {
|
|
46
|
-
const { selectedLabel, primaryField, selectedItem } = this.properties;
|
|
51
|
+
const { selectedLabel, primaryField, selectFieldLabel, selectedItem } = this.properties;
|
|
47
52
|
this.setReadonlyAttributes &&
|
|
48
53
|
this.setReadonlyAttributes({
|
|
49
54
|
selectedLabel,
|
|
50
|
-
selectFields: [primaryField],
|
|
55
|
+
selectFields: [selectFieldLabel || primaryField],
|
|
51
56
|
item: selectedItem,
|
|
52
57
|
});
|
|
53
58
|
this.updateWidgetAPI();
|
|
@@ -66,7 +71,7 @@ Component({
|
|
|
66
71
|
},
|
|
67
72
|
},
|
|
68
73
|
observers: {
|
|
69
|
-
'name, value, label, required, visible, disabled, readOnly, before, after, primaryField, selectedLabel, selectedItem':
|
|
74
|
+
'name, value, label, required, visible, disabled, readOnly, before, after, primaryField, selectedLabel, selectedItem,selectFieldLabel':
|
|
70
75
|
function () {
|
|
71
76
|
this.finalUpdateWidgetAPI();
|
|
72
77
|
},
|
|
@@ -77,9 +82,18 @@ Component({
|
|
|
77
82
|
range: function (range) {
|
|
78
83
|
this.updateSelect({ detail: { value: this.data.value, option: range } });
|
|
79
84
|
},
|
|
85
|
+
selectFieldLabel: function (selectFieldLabel) {
|
|
86
|
+
this.setData({
|
|
87
|
+
showLabel: selectFieldLabel || this.data.primaryField,
|
|
88
|
+
});
|
|
89
|
+
},
|
|
80
90
|
},
|
|
81
91
|
lifetimes: {
|
|
82
92
|
attached: function () {
|
|
93
|
+
const { selectFieldLabel, primaryField } = this.data;
|
|
94
|
+
this.setData({
|
|
95
|
+
showLabel: selectFieldLabel || primaryField,
|
|
96
|
+
});
|
|
83
97
|
this.finalUpdateWidgetAPI();
|
|
84
98
|
},
|
|
85
99
|
},
|
|
@@ -47,7 +47,7 @@ Component({
|
|
|
47
47
|
},
|
|
48
48
|
data: {
|
|
49
49
|
height: '390px',
|
|
50
|
-
focus: false,
|
|
50
|
+
focus: false, // 聚焦在搜索框
|
|
51
51
|
searchValue: '',
|
|
52
52
|
index: -1,
|
|
53
53
|
status: 0,
|
|
@@ -57,12 +57,18 @@ Component({
|
|
|
57
57
|
},
|
|
58
58
|
|
|
59
59
|
methods: {
|
|
60
|
-
cancelPicker: function (
|
|
61
|
-
if (this.data.
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
cancelPicker: function () {
|
|
61
|
+
if (this.data.focus) {
|
|
62
|
+
this.setData({
|
|
63
|
+
focus: false,
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
if (this.data.multiple) {
|
|
67
|
+
const { option } = this.properties;
|
|
68
|
+
this.setData({ selectedCache: option.filter((item) => item.check) });
|
|
69
|
+
}
|
|
70
|
+
this.triggerEvent('onClosePicker');
|
|
64
71
|
}
|
|
65
|
-
this.triggerEvent('onClosePicker');
|
|
66
72
|
},
|
|
67
73
|
// 监听输入
|
|
68
74
|
bindinput: function (event) {
|
|
@@ -116,11 +122,13 @@ Component({
|
|
|
116
122
|
},
|
|
117
123
|
// 选中项
|
|
118
124
|
onItemClick: function (e) {
|
|
119
|
-
const item = e.currentTarget.dataset.value;
|
|
125
|
+
const item = e.currentTarget?.dataset?.value ? Object.assign({}, e.currentTarget.dataset.value) : {};
|
|
120
126
|
if (item.disabled) return;
|
|
127
|
+
item.check = true;
|
|
121
128
|
if (this.data.multiple) {
|
|
122
129
|
this.setData({
|
|
123
130
|
selectedCache: this.dealSelectedValue(item),
|
|
131
|
+
focus: false,
|
|
124
132
|
});
|
|
125
133
|
} else {
|
|
126
134
|
this.triggerEvent('onSelectPicker', item);
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<view class="weda-ui-custom-picker__columns">
|
|
22
22
|
<view class="weda-ui-custom-picker__column">
|
|
23
23
|
<view wx:for="{{showOption}}" wx:key="i" wx:for-index="i" class="weda-ui-custom-picker__column-item {{multiple?'multiple':''}} {{ tools.includes(selectedCache, item) ? 'is-selected':''}} {{ (item.disabled) ? 'is-disabled':''}}" bindtap="onItemClick" data-value="{{item}}">
|
|
24
|
-
<text class="weda-ui-custom-picker__column-item-text {{multiple?'multiple':''}}">{{item.label}}</text>
|
|
24
|
+
<text class="weda-ui-custom-picker__column-item-text {{multiple?'multiple':''}}">{{item.label||item.value}}</text>
|
|
25
25
|
</view>
|
|
26
26
|
<view wx:if="{{status === 1}}" class="weda-ui-custom-picker__status weda-ui-custom-picker__status--loading"> <i class="weda-ui-custom-picker__loading-icon"></i>加载中... </view>
|
|
27
27
|
<view wx:if="{{status === 2}}" class="weda-ui-custom-picker__status">
|
|
@@ -113,12 +113,6 @@ Component({
|
|
|
113
113
|
attached() {
|
|
114
114
|
const { range, filterable, format, defaultValue } = this.properties;
|
|
115
115
|
const label = this.getLabels(defaultValue, range);
|
|
116
|
-
console.log(filterable, format);
|
|
117
|
-
if (this.data.value?.[0] === '1') {
|
|
118
|
-
console.log(filterable);
|
|
119
|
-
console.log('99');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
116
|
this.setData({
|
|
123
117
|
option: range,
|
|
124
118
|
_filterable: format && isFormatWithFilterable(format) ? true : filterable,
|
|
@@ -216,6 +210,7 @@ Component({
|
|
|
216
210
|
this.setData({ value: [].concat(e.detail.value), allPickerShow: false });
|
|
217
211
|
this.onChange({ detail: { value: e.detail.value, context: { option: e.detail } } });
|
|
218
212
|
}
|
|
213
|
+
this._initFetchData({ searchValue: '' });
|
|
219
214
|
},
|
|
220
215
|
// 获取数据列表:关联关系和主子明细
|
|
221
216
|
_fetchData: async function ({ queryParam = this.data.queryParam, searchValue = '', pageNo = 1, _init = false }) {
|
|
@@ -300,7 +295,7 @@ Component({
|
|
|
300
295
|
});
|
|
301
296
|
}
|
|
302
297
|
if (this.data.multiple) {
|
|
303
|
-
return labels.join(',');
|
|
298
|
+
return labels && labels.join(',');
|
|
304
299
|
} else {
|
|
305
300
|
return labels?.[0];
|
|
306
301
|
}
|
|
@@ -310,9 +305,8 @@ Component({
|
|
|
310
305
|
const _options = Array.isArray(options) ? options : [];
|
|
311
306
|
const stringRange = _options.map((item) => {
|
|
312
307
|
const obj = _values.find((el) => el === item.value);
|
|
313
|
-
const check = !!obj;
|
|
314
|
-
|
|
315
|
-
return { ...item, value, check };
|
|
308
|
+
const check = typeof obj === 'number' || !!obj;
|
|
309
|
+
return { ...item, check };
|
|
316
310
|
});
|
|
317
311
|
return stringRange;
|
|
318
312
|
},
|
|
@@ -320,7 +314,7 @@ Component({
|
|
|
320
314
|
const { queryParam, dataSourceName, primaryField } = this.data;
|
|
321
315
|
const _filter = {
|
|
322
316
|
where: {
|
|
323
|
-
$and: [{ $or: values.map((i) => ({ _id: { $
|
|
317
|
+
$and: [{ $or: values.map((i) => ({ _id: { $eq: i } })) }],
|
|
324
318
|
},
|
|
325
319
|
};
|
|
326
320
|
let data = await callDataSourceApi({
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
.wd-custom-backdrop {
|
|
195
195
|
position: fixed;
|
|
196
196
|
/* 与weui-mask 一致 */
|
|
197
|
-
z-index:
|
|
197
|
+
z-index: 1002;
|
|
198
198
|
top: 0;
|
|
199
199
|
left: 0;
|
|
200
200
|
bottom: 0;
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
position: fixed;
|
|
312
312
|
bottom: 0;
|
|
313
313
|
left: 0;
|
|
314
|
-
z-index:
|
|
314
|
+
z-index: 1002;
|
|
315
315
|
}
|
|
316
316
|
.wd-custom-picker__inner.is-full {
|
|
317
317
|
height: 100vh;
|
|
@@ -33,6 +33,10 @@ Component({
|
|
|
33
33
|
type: Boolean,
|
|
34
34
|
value: false,
|
|
35
35
|
},
|
|
36
|
+
selectFieldLabel: {
|
|
37
|
+
type: String,
|
|
38
|
+
value: '',
|
|
39
|
+
},
|
|
36
40
|
},
|
|
37
41
|
data: {
|
|
38
42
|
itemMap: {},
|
|
@@ -43,11 +47,11 @@ Component({
|
|
|
43
47
|
},
|
|
44
48
|
methods: {
|
|
45
49
|
finalUpdateWidgetAPI: function () {
|
|
46
|
-
const { selectedLabel, primaryField, selectedItem } = this.properties;
|
|
50
|
+
const { selectedLabel, primaryField, selectedItem, selectFieldLabel } = this.properties;
|
|
47
51
|
this.setReadonlyAttributes &&
|
|
48
52
|
this.setReadonlyAttributes({
|
|
49
53
|
selectedLabel,
|
|
50
|
-
selectFields: [primaryField],
|
|
54
|
+
selectFields: [selectFieldLabel || primaryField],
|
|
51
55
|
item: selectedItem,
|
|
52
56
|
});
|
|
53
57
|
this.updateWidgetAPI();
|
|
@@ -70,7 +74,7 @@ Component({
|
|
|
70
74
|
},
|
|
71
75
|
},
|
|
72
76
|
observers: {
|
|
73
|
-
'name, value, label, required, visible, disabled, readOnly, before, after, primaryField, selectedLabel, selectedItem':
|
|
77
|
+
'name, value, label, required, visible, disabled, readOnly, before, after, primaryField, selectedLabel, selectedItem,selectFieldLabel':
|
|
74
78
|
function () {
|
|
75
79
|
this.finalUpdateWidgetAPI();
|
|
76
80
|
},
|
|
@@ -81,9 +85,18 @@ Component({
|
|
|
81
85
|
range: function (range) {
|
|
82
86
|
this.updateSelect({ detail: { value: this.data.value, option: range } });
|
|
83
87
|
},
|
|
88
|
+
selectFieldLabel: function (selectFieldLabel) {
|
|
89
|
+
this.setData({
|
|
90
|
+
showLabel: selectFieldLabel || this.data.primaryField,
|
|
91
|
+
});
|
|
92
|
+
},
|
|
84
93
|
},
|
|
85
94
|
lifetimes: {
|
|
86
95
|
attached: function () {
|
|
96
|
+
const { selectFieldLabel, primaryField } = this.data;
|
|
97
|
+
this.setData({
|
|
98
|
+
showLabel: selectFieldLabel || primaryField,
|
|
99
|
+
});
|
|
87
100
|
this.finalUpdateWidgetAPI();
|
|
88
101
|
},
|
|
89
102
|
},
|