@ant-design/agentic-ui 2.12.0 → 2.12.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.
|
@@ -285,7 +285,7 @@ import { isMobileDevice, isVivoOrOppoDevice, isWeChat } from "../AttachmentButto
|
|
|
285
285
|
input.style.display = 'none';
|
|
286
286
|
input.onchange = /*#__PURE__*/ function() {
|
|
287
287
|
var _ref = _async_to_generator(function(e) {
|
|
288
|
-
var error;
|
|
288
|
+
var selectedFiles, currentFileCount, errorMsg, totalFileCount, errorMsg1, error;
|
|
289
289
|
return _ts_generator(this, function(_state) {
|
|
290
290
|
switch(_state.label){
|
|
291
291
|
case 0:
|
|
@@ -303,9 +303,36 @@ import { isMobileDevice, isVivoOrOppoDevice, isWeChat } from "../AttachmentButto
|
|
|
303
303
|
4,
|
|
304
304
|
5
|
|
305
305
|
]);
|
|
306
|
+
selectedFiles = e.target.files;
|
|
307
|
+
if (!selectedFiles || selectedFiles.length === 0) {
|
|
308
|
+
return [
|
|
309
|
+
2
|
|
310
|
+
];
|
|
311
|
+
}
|
|
312
|
+
// 检查选择的文件数量是否超过限制
|
|
313
|
+
currentFileCount = (fileMap === null || fileMap === void 0 ? void 0 : fileMap.size) || 0;
|
|
314
|
+
if (attachment === null || attachment === void 0 ? void 0 : attachment.maxFileCount) {
|
|
315
|
+
// 如果一次选择的文件数量超过最大限制,完全拒绝
|
|
316
|
+
if (selectedFiles.length > attachment.maxFileCount) {
|
|
317
|
+
errorMsg = (locale === null || locale === void 0 ? void 0 : locale['markdownInput.maxFileCountExceeded']) ? locale['markdownInput.maxFileCountExceeded'].replace('${maxFileCount}', String(attachment.maxFileCount)) : "最多只能上传 ".concat(attachment.maxFileCount, " 个文件");
|
|
318
|
+
message.error(errorMsg);
|
|
319
|
+
return [
|
|
320
|
+
2
|
|
321
|
+
];
|
|
322
|
+
}
|
|
323
|
+
// 如果选择的文件数量加上已有文件数量超过限制,完全拒绝
|
|
324
|
+
totalFileCount = selectedFiles.length + currentFileCount;
|
|
325
|
+
if (totalFileCount > attachment.maxFileCount) {
|
|
326
|
+
errorMsg1 = (locale === null || locale === void 0 ? void 0 : locale['markdownInput.maxFileCountExceeded']) ? locale['markdownInput.maxFileCountExceeded'].replace('${maxFileCount}', String(attachment.maxFileCount)) : "最多只能上传 ".concat(attachment.maxFileCount, " 个文件");
|
|
327
|
+
message.error(errorMsg1);
|
|
328
|
+
return [
|
|
329
|
+
2
|
|
330
|
+
];
|
|
331
|
+
}
|
|
332
|
+
}
|
|
306
333
|
return [
|
|
307
334
|
4,
|
|
308
|
-
upLoadFileToServer(
|
|
335
|
+
upLoadFileToServer(selectedFiles, _object_spread_props(_object_spread({}, attachment), {
|
|
309
336
|
fileMap: fileMap,
|
|
310
337
|
onFileMapChange: function(newFileMap) {
|
|
311
338
|
updateAttachmentFiles(newFileMap);
|