ztxkui 4.2.18-98 → 4.2.18-99

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.
@@ -301,7 +301,7 @@ function UploadDemo() {
301
301
  rotationSlider: true,
302
302
  aspect: 4 / 5,
303
303
  quality: 1,
304
- }, maxSize: 2 * 1024 * 1024, minSize: 200 * 1024, maxResolution: { width: 960, height: 1200 }, minResolution: { width: 480, height: 600 }, ztAccept: ['.jpg', '.jpeg'], listType: "picture-card", method: "post", headers: {
304
+ }, maxSize: 2 * 1024 * 1024, minSize: 20 * 1024, maxResolution: { width: 960, height: 1200 }, minResolution: { width: 480, height: 600 }, ztAccept: ['.jpg', '.jpeg'], listType: "picture-card", method: "post", headers: {
305
305
  'Zmdms-Auth': token,
306
306
  }, showUploadList: {
307
307
  showPreviewIcon: true,
@@ -283,9 +283,18 @@ var Upload = function (props) {
283
283
  (dimensions.width > maxResolution.width ||
284
284
  dimensions.height > maxResolution.height)) {
285
285
  if (needMessage) {
286
- message.warning(i18next.t('图片分辨率超出最大值宽*高 {{maxResolution}}!', {
287
- maxResolution: maxResolution.width + 'x' + maxResolution.height,
288
- }));
286
+ if (isCrop) {
287
+ message.warning(i18next.t('裁剪后的图片分辨率宽*高:{{currentResolution}},超出最大值{{maxResolution}}!', {
288
+ maxResolution: maxResolution.width + 'x' + maxResolution.height,
289
+ currentResolution: dimensions.width + 'x' + dimensions.height,
290
+ }));
291
+ }
292
+ else {
293
+ message.warning(i18next.t('图片分辨率超出最大值宽*高 {{maxResolution}}!当前图片分辨率:{{currentResolution}}', {
294
+ maxResolution: maxResolution.width + 'x' + maxResolution.height,
295
+ currentResolution: dimensions.width + 'x' + dimensions.height,
296
+ }));
297
+ }
289
298
  }
290
299
  return AntUpload.LIST_IGNORE;
291
300
  }
@@ -293,9 +302,18 @@ var Upload = function (props) {
293
302
  (dimensions.width < minResolution.width ||
294
303
  dimensions.height < minResolution.height)) {
295
304
  if (needMessage) {
296
- message.warning(i18next.t('图片分辨率低于最小值宽*高 {{minResolution}}!', {
297
- minResolution: minResolution.width + 'x' + minResolution.height,
298
- }));
305
+ if (isCrop) {
306
+ message.warning(i18next.t('裁剪后的图片分辨率宽*高:{{currentResolution}},低于最小值{{minResolution}}!', {
307
+ minResolution: minResolution.width + 'x' + minResolution.height,
308
+ currentResolution: dimensions.width + 'x' + dimensions.height,
309
+ }));
310
+ }
311
+ else {
312
+ message.warning(i18next.t('图片分辨率低于最小值宽*高 {{minResolution}}!当前图片分辨率:{{currentResolution}}', {
313
+ minResolution: minResolution.width + 'x' + minResolution.height,
314
+ currentResolution: dimensions.width + 'x' + dimensions.height,
315
+ }));
316
+ }
299
317
  }
300
318
  return AntUpload.LIST_IGNORE;
301
319
  }
@@ -332,11 +350,33 @@ var Upload = function (props) {
332
350
  return AntUpload.LIST_IGNORE;
333
351
  }
334
352
  if (fileSize > MAXSIZE) {
335
- message.warning(i18next.t('文件超出 {{MAXSIZESTR}}!', { MAXSIZESTR: MAXSIZESTR }));
353
+ if (isCrop) {
354
+ message.warning(i18next.t('裁剪后的图片大小:{{fileSizeStr}},超出最大值{{MAXSIZESTR}}!', {
355
+ MAXSIZESTR: MAXSIZESTR,
356
+ fileSizeStr: transformFileSize(fileSize),
357
+ }));
358
+ }
359
+ else {
360
+ message.warning(i18next.t('文件超出 {{MAXSIZESTR}}!当前文件大小:{{fileSizeStr}}', {
361
+ MAXSIZESTR: MAXSIZESTR,
362
+ fileSizeStr: transformFileSize(fileSize),
363
+ }));
364
+ }
336
365
  return AntUpload.LIST_IGNORE;
337
366
  }
338
367
  if (MINSIZE && fileSize < MINSIZE) {
339
- message.warning(i18next.t('文件小于 {{MINSIZSTR}}!', { MINSIZSTR: MINSIZSTR }));
368
+ if (isCrop) {
369
+ message.warning(i18next.t('裁剪后的图片大小:{{fileSizeStr}},低于最小值{{MINSIZSTR}}!', {
370
+ MINSIZSTR: MINSIZSTR,
371
+ fileSizeStr: transformFileSize(fileSize),
372
+ }));
373
+ }
374
+ else {
375
+ message.warning(i18next.t('文件小于 {{MINSIZSTR}}!当前文件大小:{{fileSizeStr}}', {
376
+ MINSIZSTR: MINSIZSTR,
377
+ fileSizeStr: transformFileSize(fileSize),
378
+ }));
379
+ }
340
380
  return AntUpload.LIST_IGNORE;
341
381
  }
342
382
  // 如果是图片,获取文件分辨率
@@ -351,10 +391,6 @@ var Upload = function (props) {
351
391
  var onFileChange = function (info) {
352
392
  var file = info.file, fileList = info.fileList;
353
393
  setFileList(fileList);
354
- var originalFile = file.originFileObj;
355
- if (originalFile && listType === 'picture-card') {
356
- fileResolution(originalFile, false);
357
- }
358
394
  callback &&
359
395
  callback(fileList, {
360
396
  currentResolution: currentResolutionRef.current,
@@ -532,24 +568,21 @@ var Upload = function (props) {
532
568
  }))) : maxCount && fileList.length >= maxCount && !isDirect ? null : (React.createElement("div", null,
533
569
  React.createElement(UploadOutlined, { style: { fontSize: 18 } }),
534
570
  React.createElement("div", { style: { marginTop: 8 } }, fileBtnText || i18next.t('添加图片'))))));
535
- var beforeCropUpload = function (file, fileList) {
536
- var result = beforeFileUpload(file, fileList);
537
- if (typeof result === 'string') {
538
- return result;
571
+ /**裁剪模式下,选择图片时只校验文件类型,裁剪完成后再校验大小和分辨率 */
572
+ var beforeCropUpload = function (file, _fileList) {
573
+ var fileName = file.name, fileSize = file.size;
574
+ var fileNameSuffix = getFileSuffix(fileName);
575
+ if (!ACCEPT.includes(fileNameSuffix)) {
576
+ message.warning(i18next.t('不支持 {{fileNameSuffix}} 文件格式!', {
577
+ fileNameSuffix: fileNameSuffix,
578
+ }));
579
+ return AntUpload.LIST_IGNORE;
539
580
  }
540
- return result
541
- .then(function (res) {
542
- console.log(res);
543
- if (typeof res === 'string') {
544
- return res;
545
- }
546
- else {
547
- return true;
548
- }
549
- })
550
- .catch(function () {
551
- return true;
552
- });
581
+ if (fileSize === 0) {
582
+ message.warning(i18next.t('不能上传空文件!', {}));
583
+ return AntUpload.LIST_IGNORE;
584
+ }
585
+ return true;
553
586
  };
554
587
  return (React.createElement(React.Fragment, null,
555
588
  showAllDeleteloadBtnInner && !showUploadBtn && (React.createElement(Button, { type: "primary", style: { marginRight: '10px' }, onClick: onAllDeleteHandle }, i18next.t('批量删除'))),
@@ -429,6 +429,10 @@
429
429
  "不支持 {{fileNameSuffix}} 文件格式!": "{{fileName Suffix}} file format is not supported!",
430
430
  "不能上传空文件!": "Cannot upload an empty file!",
431
431
  "文件超出 {{MAXSIZESTR}}!": "File exceeds {{MAX SIZESTR}}!",
432
+ "文件超出 {{MAXSIZESTR}}!当前文件大小:{{fileSizeStr}}": "File exceeds {{MAX SIZESTR}}! Current file size: {{fileSizeStr}}",
433
+ "裁剪后的图片大小:{{fileSizeStr}},超出最大值{{MAXSIZESTR}}!": "Cropped image size: {{fileSizeStr}} exceeds the maximum value {{MAXSIZESTR}}!",
434
+ "文件小于 {{MINSIZSTR}}!当前文件大小:{{fileSizeStr}}": "File is {{MINSIZSTR}}! Current file size: {{fileSizeStr}}",
435
+ "裁剪后的图片大小:{{fileSizeStr}},低于最小值{{MINSIZSTR}}!": "Cropped image size: {{fileSizeStr}} is below the minimum value {{MINSIZSTR}}!",
432
436
  "请选择需要删除得附件!": "Please select the attachment to be deleted!",
433
437
  "批量下载": "Batch download",
434
438
  "批量删除": "Mass delete",
@@ -816,5 +820,9 @@
816
820
  "反选": "Invert selection",
817
821
  "请至少保留一个展示项!": "Please keep at least one display item!",
818
822
  "图片分辨率低于最小值宽*高 {{minResolution}}!": "Image resolution is below the minimum value width*height {{minResolution}}!",
819
- "图片分辨率超出最大值宽*高 {{maxResolution}}!": "Image resolution is above the maximum value width*height {{maxResolution}}!"
823
+ "图片分辨率超出最大值宽*高 {{maxResolution}}!": "Image resolution is above the maximum value width*height {{maxResolution}}!",
824
+ "图片分辨率超出最大值宽*高 {{maxResolution}}!当前图片分辨率:{{currentResolution}}": "Image resolution is above the maximum value width*height {{maxResolution}}! Current image resolution: {{currentResolution}}",
825
+ "图片分辨率低于最小值宽*高 {{minResolution}}!当前图片分辨率:{{currentResolution}}": "Image resolution is below the minimum value width*height {{minResolution}}! Current image resolution: {{currentResolution}}",
826
+ "裁剪后的图片分辨率宽*高:{{currentResolution}},超出最大值{{maxResolution}}!": "Cropped image resolution: {{currentResolution}} exceeds the maximum value {{maxResolution}}!",
827
+ "裁剪后的图片分辨率宽*高:{{currentResolution}},低于最小值{{minResolution}}!": "Cropped image resolution: {{currentResolution}} is below the minimum value {{minResolution}}!"
820
828
  }
@@ -429,6 +429,10 @@
429
429
  "不支持 {{fileNameSuffix}} 文件格式!": "不支持 {{fileNameSuffix}} 文件格式!",
430
430
  "不能上传空文件!": "不能上传空文件!",
431
431
  "文件超出 {{MAXSIZESTR}}!": "文件超出 {{MAXSIZESTR}}!",
432
+ "文件超出 {{MAXSIZESTR}}!当前文件大小:{{fileSizeStr}}": "文件超出 {{MAXSIZESTR}}!当前文件大小:{{fileSizeStr}}",
433
+ "裁剪后的图片大小:{{fileSizeStr}},超出最大值{{MAXSIZESTR}}!": "裁剪后的图片大小:{{fileSizeStr}},超出最大值{{MAXSIZESTR}}!",
434
+ "文件小于 {{MINSIZSTR}}!当前文件大小:{{fileSizeStr}}": "文件小于 {{MINSIZSTR}}!当前文件大小:{{fileSizeStr}}",
435
+ "裁剪后的图片大小:{{fileSizeStr}},低于最小值{{MINSIZSTR}}!": "裁剪后的图片大小:{{fileSizeStr}},低于最小值{{MINSIZSTR}}!",
432
436
  "请选择需要删除得附件!": "请选择需要删除得附件!",
433
437
  "批量下载": "批量下载",
434
438
  "批量删除": "批量删除",
@@ -816,5 +820,9 @@
816
820
  "反选": "反选",
817
821
  "请至少保留一个展示项!": "请至少保留一个展示项!",
818
822
  "图片分辨率低于最小值宽*高 {{minResolution}}!": "图片分辨率低于最小值宽*高 {{minResolution}}!",
819
- "图片分辨率超出最大值宽*高 {{maxResolution}}!": "图片分辨率超出最大值宽*高 {{maxResolution}}!"
823
+ "图片分辨率超出最大值宽*高 {{maxResolution}}!": "图片分辨率超出最大值宽*高 {{maxResolution}}!",
824
+ "图片分辨率超出最大值宽*高 {{maxResolution}}!当前图片分辨率:{{currentResolution}}": "图片分辨率超出最大值宽*高 {{maxResolution}}!当前图片分辨率:{{currentResolution}}",
825
+ "图片分辨率低于最小值宽*高 {{minResolution}}!当前图片分辨率:{{currentResolution}}": "图片分辨率低于最小值宽*高 {{minResolution}}!当前图片分辨率:{{currentResolution}}",
826
+ "裁剪后的图片分辨率宽*高:{{currentResolution}},超出最大值{{maxResolution}}!": "裁剪后的图片分辨率宽*高:{{currentResolution}},超出最大值{{maxResolution}}!",
827
+ "裁剪后的图片分辨率宽*高:{{currentResolution}},低于最小值{{minResolution}}!": "裁剪后的图片分辨率宽*高:{{currentResolution}},低于最小值{{minResolution}}!"
820
828
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "4.2.18-98",
3
+ "version": "4.2.18-99",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",