@cloudbase/weda-ui-mp 3.17.4 → 3.17.5
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.
|
@@ -208,6 +208,8 @@ Component({
|
|
|
208
208
|
config.action = 'CHOOSE_MESSAGE_FILE';
|
|
209
209
|
break;
|
|
210
210
|
default:
|
|
211
|
+
config.type = 'all';
|
|
212
|
+
config.action = 'CHOOSE_MESSAGE_FILE';
|
|
211
213
|
break;
|
|
212
214
|
}
|
|
213
215
|
const uploadInstance = initUploadInstance({ config, previewFile: files }, this);
|
|
@@ -231,18 +233,19 @@ Component({
|
|
|
231
233
|
if (value && JSON.stringify(value) != '[]') {
|
|
232
234
|
const values = Array.isArray(value) ? value : [value];
|
|
233
235
|
for (let f of values) {
|
|
236
|
+
let hf = f;
|
|
234
237
|
if (f.startsWith('cloud:')) {
|
|
235
|
-
|
|
236
|
-
const label = getName(hf);
|
|
237
|
-
const httpFile = {
|
|
238
|
-
name: label,
|
|
239
|
-
cloudPath: f,
|
|
240
|
-
filePath: hf,
|
|
241
|
-
path: hf,
|
|
242
|
-
status: 'success',
|
|
243
|
-
};
|
|
244
|
-
httpFiles.push(httpFile);
|
|
238
|
+
hf = await getTempFileURL(f);
|
|
245
239
|
}
|
|
240
|
+
const label = getName(hf);
|
|
241
|
+
const httpFile = {
|
|
242
|
+
name: label,
|
|
243
|
+
cloudPath: f,
|
|
244
|
+
filePath: hf,
|
|
245
|
+
path: hf,
|
|
246
|
+
status: 'success',
|
|
247
|
+
};
|
|
248
|
+
httpFiles.push(httpFile);
|
|
246
249
|
}
|
|
247
250
|
this.setData({
|
|
248
251
|
oldValue: value,
|
|
@@ -10,8 +10,7 @@ const chooseFile = ({ action = 'CHOOSE_MEDIA', config, success, fail }) => {
|
|
|
10
10
|
switch (action) {
|
|
11
11
|
case ACTION['CHOOSE_MEDIA']:
|
|
12
12
|
_config = {
|
|
13
|
-
|
|
14
|
-
sourceType: ['album'],
|
|
13
|
+
sourceType: ['album', 'camera'],
|
|
15
14
|
...config,
|
|
16
15
|
};
|
|
17
16
|
break;
|
|
@@ -113,6 +113,11 @@ 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
|
+
}
|
|
116
121
|
|
|
117
122
|
this.setData({
|
|
118
123
|
option: range,
|
|
@@ -147,7 +152,7 @@ Component({
|
|
|
147
152
|
if (!isFormatNeedFetch(this.data.format)) {
|
|
148
153
|
_option = range;
|
|
149
154
|
}
|
|
150
|
-
const label = this.getLabels(value, _option
|
|
155
|
+
const label = this.getLabels(value, _option);
|
|
151
156
|
const checkRange = this.getChecks(value, _option);
|
|
152
157
|
// 默认
|
|
153
158
|
this.setData({
|
|
@@ -284,19 +289,18 @@ Component({
|
|
|
284
289
|
this._fetchData({ pageNo, searchValue });
|
|
285
290
|
}
|
|
286
291
|
},
|
|
287
|
-
getLabels: function (values, options
|
|
288
|
-
// 缓存展示值 _preLabel
|
|
292
|
+
getLabels: function (values, options) {
|
|
289
293
|
let labels = values;
|
|
290
294
|
if (Array.isArray(values) && Array.isArray(options)) {
|
|
291
295
|
const rm = arrayToMap(options, 'value');
|
|
292
296
|
labels = values.map((d) => {
|
|
293
297
|
const obj = rm[d];
|
|
294
|
-
let item = lodashGet(obj, 'text') ?? lodashGet(obj, 'label') ??
|
|
298
|
+
let item = lodashGet(obj, 'text') ?? lodashGet(obj, 'label') ?? d;
|
|
295
299
|
return textToString(item);
|
|
296
300
|
});
|
|
297
301
|
}
|
|
298
302
|
if (this.data.multiple) {
|
|
299
|
-
return labels
|
|
303
|
+
return labels.join(',');
|
|
300
304
|
} else {
|
|
301
305
|
return labels?.[0];
|
|
302
306
|
}
|
|
@@ -108,11 +108,18 @@ Component({
|
|
|
108
108
|
return uploadInstance;
|
|
109
109
|
},
|
|
110
110
|
setConfig: function (_config) {
|
|
111
|
-
const { single, maxUploadCount, config } = this.data;
|
|
111
|
+
const { single, maxUploadCount, sourceType, config = {} } = this.data;
|
|
112
112
|
const _maxUploadCount = _config.maxUploadCount ?? maxUploadCount;
|
|
113
113
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
114
|
+
let _sourceType = ['album', 'camera'];
|
|
115
|
+
_sourceType = Array.isArray(sourceType)
|
|
116
|
+
? sourceType
|
|
117
|
+
: ['album', 'camera'].includes(sourceType)
|
|
118
|
+
? [sourceType]
|
|
119
|
+
: ['album', 'camera'];
|
|
120
|
+
|
|
114
121
|
const maxCount = single ? 1 : _maxUploadCount;
|
|
115
|
-
const res = { ...config, count: maxCount,
|
|
122
|
+
const res = { ...config, ..._config, count: maxCount, sourceType: _sourceType };
|
|
116
123
|
this.setData({ config: res });
|
|
117
124
|
},
|
|
118
125
|
deleteHandle: function ({ cloudId }) {
|