vxe-pc-ui 4.6.7 → 4.6.9

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.
Files changed (158) hide show
  1. package/es/alert/src/alert.js +5 -5
  2. package/es/anchor/src/anchor-link.js +3 -2
  3. package/es/anchor/src/anchor.js +3 -3
  4. package/es/breadcrumb/src/breadcrumb-item.js +3 -2
  5. package/es/button/src/button-group.js +3 -3
  6. package/es/button/src/button.js +5 -4
  7. package/es/card/src/card.js +7 -7
  8. package/es/carousel/src/carousel.js +3 -3
  9. package/es/countdown/src/countdown.js +4 -4
  10. package/es/form/src/form-group.js +5 -3
  11. package/es/form/src/form-item.js +6 -4
  12. package/es/form-design/src/default-setting-form.js +1 -1
  13. package/es/form-design/src/form-view.js +6 -6
  14. package/es/icon/style.css +1 -1
  15. package/es/icon-picker/src/icon-picker.js +4 -4
  16. package/es/image/src/group.js +3 -1
  17. package/es/image/src/image.js +3 -1
  18. package/es/image/src/preview.js +33 -19
  19. package/es/image/src/util.js +1 -0
  20. package/es/list-design/src/list-view.js +3 -3
  21. package/es/loading/src/loading.js +3 -3
  22. package/es/menu/src/menu.js +9 -9
  23. package/es/modal/src/modal.js +14 -14
  24. package/es/password-input/src/password-input.js +7 -7
  25. package/es/print/src/print.js +6 -6
  26. package/es/pulldown/src/pulldown.js +4 -4
  27. package/es/style.css +1 -1
  28. package/es/style.min.css +1 -1
  29. package/es/switch/src/switch.js +4 -4
  30. package/es/tabs/src/tabs.js +9 -9
  31. package/es/tag/src/tag.js +3 -3
  32. package/es/tip/src/tip.js +5 -5
  33. package/es/tree/src/tree.js +7 -7
  34. package/es/ui/index.js +1 -1
  35. package/es/ui/src/log.js +1 -1
  36. package/es/upload/src/upload.js +26 -26
  37. package/lib/alert/src/alert.js +3 -3
  38. package/lib/alert/src/alert.min.js +1 -1
  39. package/lib/anchor/src/anchor-link.js +2 -1
  40. package/lib/anchor/src/anchor-link.min.js +1 -1
  41. package/lib/anchor/src/anchor.js +3 -3
  42. package/lib/anchor/src/anchor.min.js +1 -1
  43. package/lib/breadcrumb/src/breadcrumb-item.js +2 -1
  44. package/lib/breadcrumb/src/breadcrumb-item.min.js +1 -1
  45. package/lib/button/src/button-group.js +6 -6
  46. package/lib/button/src/button-group.min.js +1 -1
  47. package/lib/button/src/button.js +2 -2
  48. package/lib/button/src/button.min.js +1 -1
  49. package/lib/card/src/card.js +4 -4
  50. package/lib/card/src/card.min.js +1 -1
  51. package/lib/carousel/src/carousel.js +1 -1
  52. package/lib/carousel/src/carousel.min.js +1 -1
  53. package/lib/countdown/src/countdown.js +2 -2
  54. package/lib/countdown/src/countdown.min.js +1 -1
  55. package/lib/form/src/form-group.js +3 -1
  56. package/lib/form/src/form-group.min.js +1 -1
  57. package/lib/form/src/form-item.js +4 -2
  58. package/lib/form/src/form-item.min.js +1 -1
  59. package/lib/form-design/src/default-setting-form.js +12 -12
  60. package/lib/form-design/src/default-setting-form.min.js +1 -1
  61. package/lib/form-design/src/form-view.js +4 -4
  62. package/lib/form-design/src/form-view.min.js +1 -1
  63. package/lib/icon/style/style.css +1 -1
  64. package/lib/icon/style/style.min.css +1 -1
  65. package/lib/icon-picker/src/icon-picker.js +2 -2
  66. package/lib/icon-picker/src/icon-picker.min.js +1 -1
  67. package/lib/image/src/group.js +3 -0
  68. package/lib/image/src/group.min.js +1 -1
  69. package/lib/image/src/image.js +3 -0
  70. package/lib/image/src/image.min.js +1 -1
  71. package/lib/image/src/preview.js +20 -8
  72. package/lib/image/src/preview.min.js +1 -1
  73. package/lib/image/src/util.js +1 -0
  74. package/lib/image/src/util.min.js +1 -1
  75. package/lib/index.umd.js +129 -104
  76. package/lib/index.umd.min.js +1 -1
  77. package/lib/list-design/src/list-view.js +1 -1
  78. package/lib/list-design/src/list-view.min.js +1 -1
  79. package/lib/loading/src/loading.js +1 -1
  80. package/lib/loading/src/loading.min.js +1 -1
  81. package/lib/menu/src/menu.js +6 -6
  82. package/lib/menu/src/menu.min.js +1 -1
  83. package/lib/modal/src/modal.js +10 -10
  84. package/lib/modal/src/modal.min.js +1 -1
  85. package/lib/password-input/src/password-input.js +4 -4
  86. package/lib/password-input/src/password-input.min.js +1 -1
  87. package/lib/print/src/print.js +4 -4
  88. package/lib/print/src/print.min.js +1 -1
  89. package/lib/pulldown/src/pulldown.js +2 -2
  90. package/lib/pulldown/src/pulldown.min.js +1 -1
  91. package/lib/style.css +1 -1
  92. package/lib/style.min.css +1 -1
  93. package/lib/switch/src/switch.js +2 -2
  94. package/lib/switch/src/switch.min.js +1 -1
  95. package/lib/tabs/src/tabs.js +8 -8
  96. package/lib/tabs/src/tabs.min.js +1 -1
  97. package/lib/tag/src/tag.js +1 -1
  98. package/lib/tag/src/tag.min.js +1 -1
  99. package/lib/tip/src/tip.js +3 -3
  100. package/lib/tip/src/tip.min.js +1 -1
  101. package/lib/tree/src/tree.js +5 -5
  102. package/lib/tree/src/tree.min.js +1 -1
  103. package/lib/ui/index.js +1 -1
  104. package/lib/ui/index.min.js +1 -1
  105. package/lib/ui/src/log.js +1 -1
  106. package/lib/ui/src/log.min.js +1 -1
  107. package/lib/upload/src/upload.js +22 -22
  108. package/lib/upload/src/upload.min.js +1 -1
  109. package/package.json +1 -1
  110. package/packages/alert/src/alert.ts +5 -5
  111. package/packages/anchor/src/anchor-link.ts +3 -2
  112. package/packages/anchor/src/anchor.ts +3 -3
  113. package/packages/breadcrumb/src/breadcrumb-item.ts +3 -2
  114. package/packages/button/src/button-group.ts +3 -3
  115. package/packages/button/src/button.ts +5 -4
  116. package/packages/card/src/card.ts +7 -7
  117. package/packages/carousel/src/carousel.ts +3 -3
  118. package/packages/countdown/src/countdown.ts +4 -4
  119. package/packages/form/src/form-group.ts +7 -3
  120. package/packages/form/src/form-item.ts +7 -4
  121. package/packages/form-design/src/default-setting-form.ts +1 -1
  122. package/packages/form-design/src/form-view.ts +6 -6
  123. package/packages/icon-picker/src/icon-picker.ts +4 -4
  124. package/packages/image/src/group.ts +3 -1
  125. package/packages/image/src/image.ts +3 -1
  126. package/packages/image/src/preview.ts +37 -22
  127. package/packages/image/src/util.ts +1 -0
  128. package/packages/list-design/src/list-view.ts +3 -3
  129. package/packages/loading/src/loading.ts +3 -3
  130. package/packages/menu/src/menu.ts +9 -9
  131. package/packages/modal/src/modal.ts +14 -14
  132. package/packages/password-input/src/password-input.ts +7 -7
  133. package/packages/print/src/print.ts +6 -6
  134. package/packages/pulldown/src/pulldown.ts +5 -5
  135. package/packages/switch/src/switch.ts +4 -4
  136. package/packages/tabs/src/tabs.ts +9 -9
  137. package/packages/tag/src/tag.ts +3 -3
  138. package/packages/tip/src/tip.ts +5 -5
  139. package/packages/tree/src/tree.ts +7 -7
  140. package/packages/upload/src/upload.ts +26 -26
  141. package/types/components/button.d.ts +2 -1
  142. package/types/components/image-group.d.ts +3 -0
  143. package/types/components/image-preview.d.ts +32 -0
  144. package/types/components/image.d.ts +2 -0
  145. package/types/components/table-module/filter.d.ts +2 -7
  146. package/types/components/table.d.ts +10 -5
  147. /package/es/icon/{iconfont.1747176327959.ttf → iconfont.1747279440023.ttf} +0 -0
  148. /package/es/icon/{iconfont.1747176327959.woff → iconfont.1747279440023.woff} +0 -0
  149. /package/es/icon/{iconfont.1747176327959.woff2 → iconfont.1747279440023.woff2} +0 -0
  150. /package/es/{iconfont.1747176327959.ttf → iconfont.1747279440023.ttf} +0 -0
  151. /package/es/{iconfont.1747176327959.woff → iconfont.1747279440023.woff} +0 -0
  152. /package/es/{iconfont.1747176327959.woff2 → iconfont.1747279440023.woff2} +0 -0
  153. /package/lib/icon/style/{iconfont.1747176327959.ttf → iconfont.1747279440023.ttf} +0 -0
  154. /package/lib/icon/style/{iconfont.1747176327959.woff → iconfont.1747279440023.woff} +0 -0
  155. /package/lib/icon/style/{iconfont.1747176327959.woff2 → iconfont.1747279440023.woff2} +0 -0
  156. /package/lib/{iconfont.1747176327959.ttf → iconfont.1747279440023.ttf} +0 -0
  157. /package/lib/{iconfont.1747176327959.woff → iconfont.1747279440023.woff} +0 -0
  158. /package/lib/{iconfont.1747176327959.woff2 → iconfont.1747279440023.woff2} +0 -0
@@ -1260,11 +1260,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
1260
1260
  class: 'vxe-upload--file-item-loading-icon'
1261
1261
  }, [(0, _vue.h)('i', {
1262
1262
  class: (0, _ui.getIcon)().UPLOAD_LOADING
1263
- })]) : (0, _vue.createCommentVNode)(), showProgress && isLoading && cacheItem ? (0, _vue.h)('div', {
1263
+ })]) : (0, _ui.renderEmptyElement)($xeUpload), showProgress && isLoading && cacheItem ? (0, _vue.h)('div', {
1264
1264
  class: 'vxe-upload--file-item-loading-text'
1265
1265
  }, progressText ? _xeUtils.default.toFormatString(`${_xeUtils.default.isFunction(progressText) ? progressText({}) : progressText}`, {
1266
1266
  percent: cacheItem.percent
1267
- }) : (0, _ui.getI18n)('vxe.upload.uploadProgress', [cacheItem.percent])) : (0, _vue.createCommentVNode)(), showErrorStatus && isError ? (0, _vue.h)('div', {
1267
+ }) : (0, _ui.getI18n)('vxe.upload.uploadProgress', [cacheItem.percent])) : (0, _ui.renderEmptyElement)($xeUpload), showErrorStatus && isError ? (0, _vue.h)('div', {
1268
1268
  class: 'vxe-upload--image-item-error'
1269
1269
  }, [(0, _vue.h)(_button.default, {
1270
1270
  icon: (0, _ui.getIcon)().UPLOAD_IMAGE_RE_UPLOAD,
@@ -1274,7 +1274,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1274
1274
  onClick() {
1275
1275
  handleReUpload(item);
1276
1276
  }
1277
- })]) : (0, _vue.createCommentVNode)(), (0, _vue.h)('div', {
1277
+ })]) : (0, _ui.renderEmptyElement)($xeUpload), (0, _vue.h)('div', {
1278
1278
  class: 'vxe-upload--file-item-btn-wrapper'
1279
1279
  }, [cornerSlot ? (0, _vue.h)('div', {
1280
1280
  class: 'vxe-upload--file-item-corner'
@@ -1282,21 +1282,21 @@ var _default = exports.default = (0, _vue.defineComponent)({
1282
1282
  option: item,
1283
1283
  isMoreView,
1284
1284
  readonly: formReadonly
1285
- }))) : (0, _vue.createCommentVNode)(), showDownloadButton && !isLoading ? (0, _vue.h)('div', {
1285
+ }))) : (0, _ui.renderEmptyElement)($xeUpload), showDownloadButton && !isLoading ? (0, _vue.h)('div', {
1286
1286
  class: 'vxe-upload--file-item-download-btn',
1287
1287
  onClick(evnt) {
1288
1288
  downloadFileEvent(evnt, item);
1289
1289
  }
1290
1290
  }, [(0, _vue.h)('i', {
1291
1291
  class: (0, _ui.getIcon)().UPLOAD_FILE_DOWNLOAD
1292
- })]) : (0, _vue.createCommentVNode)(), showRemoveButton && !formReadonly && !isDisabled && !isLoading ? (0, _vue.h)('div', {
1292
+ })]) : (0, _ui.renderEmptyElement)($xeUpload), showRemoveButton && !formReadonly && !isDisabled && !isLoading ? (0, _vue.h)('div', {
1293
1293
  class: 'vxe-upload--file-item-remove-btn',
1294
1294
  onClick(evnt) {
1295
1295
  removeFileEvent(evnt, item, index);
1296
1296
  }
1297
1297
  }, [(0, _vue.h)('i', {
1298
1298
  class: (0, _ui.getIcon)().UPLOAD_FILE_REMOVE
1299
- })]) : (0, _vue.createCommentVNode)()])]);
1299
+ })]) : (0, _ui.renderEmptyElement)($xeUpload)])]);
1300
1300
  });
1301
1301
  };
1302
1302
  const renderFileAction = isMoreView => {
@@ -1316,11 +1316,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
1316
1316
  const defaultSlot = slots.default;
1317
1317
  const tipSlot = slots.tip || slots.hint;
1318
1318
  if (formReadonly || !showUploadButton) {
1319
- return (0, _vue.createCommentVNode)();
1319
+ return (0, _ui.renderEmptyElement)($xeUpload);
1320
1320
  }
1321
1321
  return (0, _vue.h)('div', {
1322
1322
  class: 'vxe-upload--file-action'
1323
- }, [autoHiddenButton && overCount ? (0, _vue.createCommentVNode)() : (0, _vue.h)('div', {
1323
+ }, [autoHiddenButton && overCount ? (0, _ui.renderEmptyElement)($xeUpload) : (0, _vue.h)('div', {
1324
1324
  class: 'vxe-upload--file-action-btn',
1325
1325
  onClick: clickEvent
1326
1326
  }, defaultSlot ? (0, _vn.getSlotVNs)(defaultSlot({
@@ -1334,7 +1334,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1334
1334
  class: 'vxe-upload--file-action-tip'
1335
1335
  }, tipSlot ? (0, _vn.getSlotVNs)(tipSlot({
1336
1336
  $upload: $xeUpload
1337
- })) : `${defTipText}`) : (0, _vue.createCommentVNode)()]);
1337
+ })) : `${defTipText}`) : (0, _ui.renderEmptyElement)($xeUpload)]);
1338
1338
  };
1339
1339
  const renderAllMode = () => {
1340
1340
  const {
@@ -1362,7 +1362,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1362
1362
  return (0, _vue.h)('div', {
1363
1363
  key: 'all',
1364
1364
  class: 'vxe-upload--file-wrapper'
1365
- }, showList ? [showMoreButton && moreConfig && isHorizontal ? (0, _vue.createCommentVNode)() : renderFileAction(true), currList.length || showMoreButton && isHorizontal ? (0, _vue.h)('div', {
1365
+ }, showList ? [showMoreButton && moreConfig && isHorizontal ? (0, _ui.renderEmptyElement)($xeUpload) : renderFileAction(true), currList.length || showMoreButton && isHorizontal ? (0, _vue.h)('div', {
1366
1366
  class: ['vxe-upload--file-list-wrapper', {
1367
1367
  'is--horizontal': isHorizontal
1368
1368
  }]
@@ -1374,14 +1374,14 @@ var _default = exports.default = (0, _vue.defineComponent)({
1374
1374
  default: () => renderFileItemList(currList, false)
1375
1375
  }) : (0, _vue.h)('div', {
1376
1376
  class: 'vxe-upload--file-list'
1377
- }, renderFileItemList(currList, false)) : (0, _vue.createCommentVNode)(), showMoreButton && overMaxNum ? (0, _vue.h)('div', {
1377
+ }, renderFileItemList(currList, false)) : (0, _ui.renderEmptyElement)($xeUpload), showMoreButton && overMaxNum ? (0, _vue.h)('div', {
1378
1378
  class: 'vxe-upload--file-over-more'
1379
1379
  }, [(0, _vue.h)(_button.default, {
1380
1380
  mode: 'text',
1381
1381
  content: (0, _ui.getI18n)('vxe.upload.moreBtnText', [fileList.length]),
1382
1382
  status: 'primary',
1383
1383
  onClick: handleMoreEvent
1384
- })]) : (0, _vue.createCommentVNode)(), showMoreButton && moreConfig && isHorizontal ? renderFileAction(false) : (0, _vue.createCommentVNode)()]) : (0, _vue.createCommentVNode)()] : [renderFileAction(false)]);
1384
+ })]) : (0, _ui.renderEmptyElement)($xeUpload), showMoreButton && moreConfig && isHorizontal ? renderFileAction(false) : (0, _ui.renderEmptyElement)($xeUpload)]) : (0, _ui.renderEmptyElement)($xeUpload)] : [renderFileAction(false)]);
1385
1385
  };
1386
1386
  const renderImageItemList = (currList, isMoreView) => {
1387
1387
  const {
@@ -1442,7 +1442,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1442
1442
  class: 'vxe-upload--image-item-loading-text'
1443
1443
  }, progressText ? _xeUtils.default.toFormatString(`${_xeUtils.default.isFunction(progressText) ? progressText({}) : progressText}`, {
1444
1444
  percent: cacheItem.percent
1445
- }) : (0, _ui.getI18n)('vxe.upload.uploadProgress', [cacheItem.percent])) : (0, _vue.createCommentVNode)()]) : (0, _vue.createCommentVNode)(), !isLoading ? isError && showErrorStatus ? (0, _vue.h)('div', {
1445
+ }) : (0, _ui.getI18n)('vxe.upload.uploadProgress', [cacheItem.percent])) : (0, _ui.renderEmptyElement)($xeUpload)]) : (0, _ui.renderEmptyElement)($xeUpload), !isLoading ? isError && showErrorStatus ? (0, _vue.h)('div', {
1446
1446
  class: 'vxe-upload--image-item-error'
1447
1447
  }, [(0, _vue.h)(_button.default, {
1448
1448
  icon: (0, _ui.getIcon)().UPLOAD_IMAGE_RE_UPLOAD,
@@ -1457,7 +1457,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1457
1457
  }, [(0, _vue.h)('img', {
1458
1458
  class: 'vxe-upload--image-item-img',
1459
1459
  src: getThumbnailFileUrl(item)
1460
- })]) : (0, _vue.createCommentVNode)(), (0, _vue.h)('div', {
1460
+ })]) : (0, _ui.renderEmptyElement)($xeUpload), (0, _vue.h)('div', {
1461
1461
  class: 'vxe-upload--image-item-btn-wrapper',
1462
1462
  onClick(evnt) {
1463
1463
  evnt.stopPropagation();
@@ -1468,7 +1468,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1468
1468
  option: item,
1469
1469
  isMoreView,
1470
1470
  readonly: formReadonly
1471
- }))) : (0, _vue.createCommentVNode)(), showRemoveButton && !formReadonly && !isDisabled && !isLoading ? (0, _vue.h)('div', {
1471
+ }))) : (0, _ui.renderEmptyElement)($xeUpload), showRemoveButton && !formReadonly && !isDisabled && !isLoading ? (0, _vue.h)('div', {
1472
1472
  class: 'vxe-upload--image-item-remove-btn',
1473
1473
  onClick(evnt) {
1474
1474
  evnt.stopPropagation();
@@ -1476,7 +1476,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1476
1476
  }
1477
1477
  }, [(0, _vue.h)('i', {
1478
1478
  class: (0, _ui.getIcon)().UPLOAD_IMAGE_REMOVE
1479
- })]) : (0, _vue.createCommentVNode)()])])]);
1479
+ })]) : (0, _ui.renderEmptyElement)($xeUpload)])])]);
1480
1480
  });
1481
1481
  };
1482
1482
  const renderImageAction = isMoreView => {
@@ -1496,7 +1496,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1496
1496
  const defaultSlot = slots.default;
1497
1497
  const tipSlot = slots.tip || slots.hint;
1498
1498
  if (formReadonly || !showUploadButton || autoHiddenButton && overCount) {
1499
- return (0, _vue.createCommentVNode)();
1499
+ return (0, _ui.renderEmptyElement)($xeUpload);
1500
1500
  }
1501
1501
  return (0, _vue.h)('div', {
1502
1502
  key: 'action',
@@ -1513,13 +1513,13 @@ var _default = exports.default = (0, _vue.defineComponent)({
1513
1513
  class: 'vxe-upload--image-action-icon'
1514
1514
  }, [(0, _vue.h)('i', {
1515
1515
  class: buttonIcon || (0, _ui.getIcon)().UPLOAD_IMAGE_ADD
1516
- })]) : (0, _vue.createCommentVNode)(), isMoreView || showButtonText ? (0, _vue.h)('div', {
1516
+ })]) : (0, _ui.renderEmptyElement)($xeUpload), isMoreView || showButtonText ? (0, _vue.h)('div', {
1517
1517
  class: 'vxe-upload--image-action-content'
1518
- }, buttonText ? `${_xeUtils.default.isFunction(buttonText) ? buttonText({}) : buttonText}` : (0, _ui.getI18n)('vxe.upload.imgBtnText')) : (0, _vue.createCommentVNode)(), showTipText && (defTipText || tipSlot) ? (0, _vue.h)('div', {
1518
+ }, buttonText ? `${_xeUtils.default.isFunction(buttonText) ? buttonText({}) : buttonText}` : (0, _ui.getI18n)('vxe.upload.imgBtnText')) : (0, _ui.renderEmptyElement)($xeUpload), showTipText && (defTipText || tipSlot) ? (0, _vue.h)('div', {
1519
1519
  class: 'vxe-upload--image-action-hint'
1520
1520
  }, tipSlot ? (0, _vn.getSlotVNs)(tipSlot({
1521
1521
  $upload: $xeUpload
1522
- })) : `${defTipText}`) : (0, _vue.createCommentVNode)()])])]);
1522
+ })) : `${defTipText}`) : (0, _ui.renderEmptyElement)($xeUpload)])])]);
1523
1523
  };
1524
1524
  const renderImageMode = () => {
1525
1525
  const {
@@ -1557,7 +1557,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1557
1557
  content: (0, _ui.getI18n)('vxe.upload.moreBtnText', [fileList.length]),
1558
1558
  status: 'primary',
1559
1559
  onClick: handleMoreEvent
1560
- })]) : (0, _vue.createCommentVNode)(), renderImageAction(false)])
1560
+ })]) : (0, _ui.renderEmptyElement)($xeUpload), renderImageAction(false)])
1561
1561
  }) : (0, _vue.h)('div', {
1562
1562
  class: 'vxe-upload--image-list'
1563
1563
  }, renderImageItemList(currList, false).concat([showMoreButton && overMaxNum ? (0, _vue.h)('div', {
@@ -1567,7 +1567,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1567
1567
  content: (0, _ui.getI18n)('vxe.upload.moreBtnText', [fileList.length]),
1568
1568
  status: 'primary',
1569
1569
  onClick: handleMoreEvent
1570
- })]) : (0, _vue.createCommentVNode)(), renderImageAction(false)]))] : [(0, _vue.h)('div', {
1570
+ })]) : (0, _ui.renderEmptyElement)($xeUpload), renderImageAction(false)]))] : [(0, _vue.h)('div', {
1571
1571
  class: 'vxe-upload--image-list'
1572
1572
  }, [renderImageAction(false)])]);
1573
1573
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_vn=require("../../ui/src/vn"),_log=require("../../ui/src/log"),_dom=require("../../ui/src/dom"),_util=require("./util"),_button=_interopRequireDefault(require("../../button/src/button"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_vue.defineComponent)({name:"VxeUpload",props:{modelValue:[Array,String,Object],showList:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showList},moreConfig:Object,readonly:{type:Boolean,default:null},disabled:{type:Boolean,default:null},mode:{type:String,default:()=>(0,_ui.getConfig)().upload.mode},imageTypes:{type:Array,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageTypes,!0)},imageConfig:{type:Object,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageConfig,!0)},imageStyle:{type:Object,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageStyle,!0)},fileTypes:{type:Array,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.fileTypes,!0)},dragSort:Boolean,dragToUpload:{type:Boolean,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.dragToUpload,!0)},pasteToUpload:{type:Boolean,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.pasteToUpload,!0)},keyField:String,singleMode:Boolean,urlMode:Boolean,multiple:Boolean,limitSize:{type:[String,Number],default:()=>(0,_ui.getConfig)().upload.limitSize},showLimitSize:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showLimitSize},limitSizeText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.limitSizeText},limitCount:{type:[String,Number],default:()=>(0,_ui.getConfig)().upload.limitCount},showLimitCount:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showLimitCount},limitCountText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.limitCountText},nameField:{type:String,default:()=>(0,_ui.getConfig)().upload.nameField},typeField:{type:String,default:()=>(0,_ui.getConfig)().upload.typeField},urlField:{type:String,default:()=>(0,_ui.getConfig)().upload.urlField},sizeField:{type:String,default:()=>(0,_ui.getConfig)().upload.sizeField},showErrorStatus:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showErrorStatus},showProgress:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showProgress},progressText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.progressText},autoHiddenButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.autoHiddenButton},showUploadButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showUploadButton},buttonText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.buttonText},buttonIcon:{type:String,default:()=>(0,_ui.getConfig)().upload.buttonIcon},showButtonText:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showButtonText},showButtonIcon:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showButtonIcon},showRemoveButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showRemoveButton},showDownloadButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showDownloadButton},showPreview:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showPreview},showTip:{type:Boolean,default:()=>null},tipText:[String,Number,Function],hintText:String,previewMethod:Function,uploadMethod:Function,beforeRemoveMethod:Function,removeMethod:Function,beforeDownloadMethod:Function,downloadMethod:Function,getUrlMethod:Function,getThumbnailUrlMethod:Function,size:{type:String,default:()=>(0,_ui.getConfig)().upload.size||(0,_ui.getConfig)().size}},emits:["update:modelValue","add","remove","remove-fail","download","download-fail","upload-success","upload-error","sort-dragend"],setup(U,e){const{emit:u,slots:w}=e,b=(0,_vue.inject)("$xeForm",null),T=(0,_vue.inject)("xeFormItemInfo",null),a=(0,_vue.inject)("$xeTable",null);var t=_xeUtils.default.uniqueId();const R=(0,_ui.useSize)(U)["computeSize"],g=(0,_vue.ref)(),p=(0,_vue.ref)(),c=(0,_vue.ref)(),m=(0,_vue.ref)(),M=(0,_vue.reactive)({isDragUploadStatus:!1,showMorePopup:!1,isActivated:!1,fileList:[],fileCacheMaps:{},isDragMove:!1,dragIndex:-1,dragTipText:""}),r={imagePreviewTypes:["jpg","jpeg","png","gif"],prevDragIndex:-1},i={refElem:g},y=(0,_vue.computed)(()=>{var e=U["readonly"];return null===e?!!b&&b.props.readonly:e}),I=(0,_vue.computed)(()=>{var e=U["disabled"];return null===e?!!b&&b.props.disabled:e}),D=(0,_vue.computed)(()=>U.keyField||"_X_KEY"),_=(0,_vue.computed)(()=>"image"===U.mode),S=(0,_vue.computed)(()=>U.nameField||"name"),B=(0,_vue.computed)(()=>U.typeField||"type"),E=(0,_vue.computed)(()=>U.urlField||"url"),V=(0,_vue.computed)(()=>U.sizeField||"size"),$=(0,_vue.computed)(()=>1024*_xeUtils.default.toNumber(U.limitSize)*1024),L=(0,_vue.computed)(()=>U.multiple?_xeUtils.default.toNumber(U.limitCount):1),f=(0,_vue.computed)(()=>{var e=U["multiple"],t=M["fileList"],o=L.value;return e?!o||t.length>=o:1<=t.length}),q=(0,_vue.computed)(()=>{var e=_xeUtils.default.toNumber(U.limitSize);return e?1048576<e?e/1048576+"T":1024<e?e/1024+"G":e+"M":""}),G=(0,_vue.computed)(()=>{var{showTip:e,tipText:t}=U;return _xeUtils.default.isBoolean(e)||(e=(0,_ui.getConfig)().upload.showTip,_xeUtils.default.isBoolean(e))?e:!!t}),H=(0,_vue.computed)(()=>{var{limitSize:e,fileTypes:t,multiple:o,limitCount:a}=U,i=U.tipText||U.hintText,l=_.value,u=q.value;return _xeUtils.default.isString(i)?i:_xeUtils.default.isFunction(i)?""+i({}):(i=[],l?(o&&a&&i.push((0,_ui.getI18n)("vxe.upload.imgCountHint",[a])),e&&u&&i.push((0,_ui.getI18n)("vxe.upload.imgSizeHint",[u]))):(t&&t.length&&i.push((0,_ui.getI18n)("vxe.upload.fileTypeHint",[t.join("/")])),e&&u&&i.push((0,_ui.getI18n)("vxe.upload.fileSizeHint",[u])),o&&a&&i.push((0,_ui.getI18n)("vxe.upload.fileCountHint",[a]))),i.join((0,_ui.getI18n)("vxe.base.comma")))}),l=(0,_vue.computed)(()=>Object.assign({},U.imageConfig||U.imageStyle)),Y=(0,_vue.computed)(()=>{var{width:e,height:t}=l.value,o={};return e&&(o.width=(0,_dom.toCssUnit)(e)),t&&(o.height=(0,_dom.toCssUnit)(t)),o}),Q=(0,_vue.computed)(()=>Object.assign({showMoreButton:!0},U.moreConfig)),d={},h={xID:t,props:U,context:e,reactData:M,internalData:r,getRefMaps:()=>i,getComputeMaps:()=>d},P=()=>_xeUtils.default.uniqueId(),N=e=>{return e[D.value]},s=()=>{var{modelValue:e,multiple:t}=U,o=y.value;const i=D.value,l=S.value,u=B.value,n=E.value,r=V.value;e=e?(e?_xeUtils.default.isArray(e)?e:[e]:[]).map(e=>{if(!e||_xeUtils.default.isString(e)){var t=""+(e||""),o=_xeUtils.default.parseUrl(e);const a=(o?o.searchQuery[l]:"")||decodeURIComponent(""+(t||"")).split("/").pop()||"";return{[l]:a,[u]:(o?o.searchQuery[u]:"")||F(a),[n]:t,[r]:_xeUtils.default.toNumber(o?o.searchQuery[r]:0)||0,[i]:P()}}const a=e[l]||"";return e[l]=a,e[u]=e[u]||F(a),e[n]=e[n]||"",e[r]=e[r]||0,e[i]=e[i]||P(),e}):[];M.fileList=o||t?e:e.slice(0,1)},F=e=>{var t=e.lastIndexOf(".");return 0<t?e.substring(t+1).toLowerCase():""},O=(e,t,o)=>{u(e,(0,_ui.createEvent)(o,{$upload:h},t))},A=e=>{var{singleMode:t,urlMode:o}=U;const a=E.value,i=S.value;let l=e?e.slice(0):[];o&&(l=l.map(e=>{var t=e[a];if(t&&!_xeUtils.default.parseUrl(t).searchQuery[i])return""+t+(-1===t.indexOf("?")?"?":"&")+i+"="+encodeURIComponent(e[i]||"");return t})),u("update:modelValue",t?l[0]||null:l)},X=e=>{var t=U.getThumbnailUrlMethod||(0,_ui.getConfig)().upload.getThumbnailUrlMethod;return t?t({$upload:h,option:e}):n(e)},n=e=>{var t=U.getUrlMethod||(0,_ui.getConfig)().upload.getUrlMethod,o=E.value;return t?t({$upload:h,option:e}):e[o]},W=(e,t)=>{var o=U.previewMethod||(0,_ui.getConfig)().upload.previewMethod;if(U.showPreview)if(o)o({$upload:h,option:t});else{var a=t;var{imageTypes:o,showDownloadButton:t}=U;const l=B.value,u=U.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;var i=r["imagePreviewTypes"];i.concat(o||[]).some(e=>(""+e).toLowerCase()===(""+a[l]).toLowerCase())&&_ui.VxeUI.previewImage&&_ui.VxeUI.previewImage({urlList:[n(a)],showDownloadButton:t,beforeDownloadMethod:u?()=>u({$upload:h,option:a}):void 0})}},K=(e,t,o)=>{var a=U["showDownloadButton"];const i=M["fileList"],l=U.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;U.showPreview&&_ui.VxeUI.previewImage&&_ui.VxeUI.previewImage({urlList:i.map(e=>n(e)),activeIndex:o,showDownloadButton:a,beforeDownloadMethod:l?({index:e})=>l({$upload:h,option:i[e]}):void 0})},J=(o,e)=>{const a=U["showErrorStatus"],i=N(o);var t=U.uploadMethod||(0,_ui.getConfig)().upload.uploadMethod;return t?Promise.resolve(t({$upload:h,file:e,option:o,updateProgress(e){var t=M["fileCacheMaps"],t=t[N(o)];t&&(t.percent=Math.max(0,Math.min(99,_xeUtils.default.toNumber(e))))}})).then(e=>{var t=M["fileCacheMaps"],t=t[i];t&&(t.percent=100),Object.assign(o,e),O("upload-success",{option:o,data:e},null)}).catch(e=>{var t=M["fileCacheMaps"],t=t[i];t&&(t.status="error"),a?Object.assign(o,e):M.fileList=M.fileList.filter(e=>N(e)!==i),O("upload-error",{option:o,data:e},null)}).finally(()=>{var e=M["fileCacheMaps"],e=e[i];e&&(e.loading=!1)}):(t=M["fileCacheMaps"],(e=t[i])&&(e.loading=!1),Promise.resolve())},Z=e=>{const{uploadMethod:t,urlMode:o}=U;var a,i=M["fileCacheMaps"],i=i[N(e)];(t||(0,_ui.getConfig)().upload.uploadMethod)&&i&&(a=i.file,i.loading=!0,i.status="",i.percent=0,J(e,a).then(()=>{o&&A(M.fileList)}))},v=(t,a)=>{var{multiple:e,urlMode:o,showLimitSize:i,limitSizeText:l,showLimitCount:u,limitCountText:n}=U,r=M["fileList"];const d=U.uploadMethod||(0,_ui.getConfig)().upload.uploadMethod,s=D.value,v=S.value,p=B.value,g=E.value,c=V.value;var m=$.value;const _=L.value;var f=q.value;let h=t;if(e&&_){if(u&&r.length>=_)return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:n?""+(_xeUtils.default.isFunction(n)?n({maxCount:_}):n):(0,_ui.getI18n)("vxe.upload.overCountErr",[_])}));const y=h.length-(_-r.length);if(u&&0<y){const I=h.slice(_-r.length);n?_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:""+(_xeUtils.default.isFunction(n)?n({maxCount:_}):n)}):_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",width:null,slots:{default(){return(0,_vue.h)("div",{class:"vxe-upload--file-message-over-error"},[(0,_vue.h)("div",{},(0,_ui.getI18n)("vxe.upload.overCountExtraErr",[_,y])),(0,_vue.h)("div",{class:"vxe-upload--file-message-over-extra"},I.map((e,t)=>(0,_vue.h)("div",{key:t,class:"vxe-upload--file-message-over-extra-item"},e.name)))])}}})}h=h.slice(0,_-r.length)}if(i&&m)for(let e=0;e<t.length;e++)if(t[0].size>m)return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:l?""+(_xeUtils.default.isFunction(l)?l({maxSize:m}):l):(0,_ui.getI18n)("vxe.upload.overSizeErr",[f])}));const x=Object.assign({},M.fileCacheMaps),C=e?r:[],w=[];h.forEach(e=>{var t=e["name"],o=P(),t={[v]:t,[p]:F(t),[c]:e.size,[g]:URL.createObjectURL(e),[s]:o},o=(d&&(x[o]={file:e,loading:!0,status:"",percent:0}),(0,_vue.reactive)(t));d&&w.push(J(o,e)),C.push(o),O("add",{option:o},a)}),M.fileList=C,M.fileCacheMaps=x,Promise.all(o?w:[]).then(()=>{A(C),b&&T&&b.triggerItemEvent(a,T.itemConfig.field,C)})},ee=t=>{var{multiple:e,imageTypes:o,fileTypes:a}=U,i=I.value,l=_.value;return i?Promise.resolve({status:!1,files:[],file:null}):(0,_util.readLocalFile)({multiple:e,types:l?o:a}).then(e=>(v(e.files,t),e))},te=e=>{ee(e).catch(()=>{})},oe=(e,t,o)=>{var a=M["fileList"];a.splice(o,1),A(a),b&&T&&b.triggerItemEvent(e,T.itemConfig.field,a),O("remove",{option:t},e)},ae=(t,o,a)=>{var e=U.beforeRemoveMethod||(0,_ui.getConfig)().upload.beforeRemoveMethod;const i=U.removeMethod||(0,_ui.getConfig)().upload.removeMethod;Promise.resolve(!e||e({$upload:h,option:o})).then(e=>{e?i?Promise.resolve(i({$upload:h,option:o})).then(()=>{oe(t,o,a)}).catch(e=>e):oe(t,o,a):O("remove-fail",{option:o},t)})},ie=(e,t)=>{O("download",{option:t},e)},le=(t,o)=>{var e=U.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;const a=U.downloadMethod||(0,_ui.getConfig)().upload.downloadMethod;Promise.resolve(!e||e({$upload:h,option:o})).then(e=>{e?a?Promise.resolve(a({$upload:h,option:o})).then(()=>{ie(t,o)}).catch(e=>e):ie(t,o):O("download-fail",{option:o},t)})},ue=e=>{var t,o,a,i=e.currentTarget,{clientX:e,clientY:l}=e;i&&({x:i,y:t,height:o,width:a}=i.getBoundingClientRect(),e<i||i+a<e||l<t||t+o<l)&&(M.isDragUploadStatus=!1)},ne=e=>{var t=e.dataTransfer;t&&(t=t["items"],t)&&t.length&&(e.preventDefault(),M.isDragUploadStatus=!0)},re=(e,t)=>{const{imageTypes:o,fileTypes:a}=U;var i=r["imagePreviewTypes"];if(_.value){const l=i.concat(o&&o.length?o:[]);t=t.filter(e=>{const t=(""+(e.type.split("/")[1]||"")).toLowerCase();return!!l.some(e=>(""+e).toLowerCase()===t)})}else if(a&&a.length){const u=[];if(t.forEach(e=>{const t=F(e.name);a.some(e=>(""+e).toLowerCase()===t)||u.push(t)}),u.length)return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.message({content:(0,_ui.getI18n)("vxe.error.notType",[u.join(", ")]),status:"error"}))}t.length?v(t,e):_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:(0,_ui.getI18n)("vxe.upload.uploadTypeErr")})},de=e=>{var t=e.dataTransfer;t&&(t=t["items"],t)&&t.length&&(e.preventDefault(),(t=se(t)).length)&&re(e,t),M.isDragUploadStatus=!1},se=e=>{const t=[];return _xeUtils.default.arrayEach(e,e=>{e=e.getAsFile();e&&t.push(e)}),t},x=()=>{const s=y.value,v=_.value;_ui.VxeUI.modal&&_ui.VxeUI.modal.open({title:s?(0,_ui.getI18n)("vxe.upload.morePopup.readTitle"):(0,_ui.getI18n)("vxe.upload.morePopup."+(v?"imageTitle":"fileTitle")),width:660,height:500,escClosable:!0,showMaximize:!0,resize:!0,maskClosable:!0,slots:{default(){var{showErrorStatus:e,dragToUpload:t,dragSort:o}=U,{isActivated:a,isDragMove:i,isDragUploadStatus:l,dragIndex:u}=M;const n=M["fileList"];var r=I.value,d={};return t&&-1===u&&(d.onDragover=ne,d.onDragleave=ue,d.onDrop=de),(0,_vue.h)("div",Object.assign({ref:p,class:["vxe-upload--more-popup",{"is--readonly":s,"is--disabled":r,"is--active":a,"show--error":e,"is--drag":l}]},d),[v?o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(i?"":"-disabled"),tag:"div",class:"vxe-upload--image-more-list"},{default:()=>j(n,!0).concat(k(!0))}):(0,_vue.h)("div",{class:"vxe-upload--image-more-list"},j(n,!0).concat(k(!0))):(0,_vue.h)("div",{class:"vxe-upload--file-more-list"},[z(!0),o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(i?"":"-disabled"),tag:"div",class:"vxe-upload--file-list"},{default:()=>C(n,!1)}):(0,_vue.h)("div",{class:"vxe-upload--file-list"},C(n,!0))]),o?(0,_vue.h)("div",{ref:m,class:"vxe-upload--drag-line"}):(0,_ui.renderEmptyElement)(h),l?(0,_vue.h)("div",{class:"vxe-upload--drag-placeholder"},(0,_ui.getI18n)("vxe.upload.dragPlaceholder")):(0,_ui.renderEmptyElement)(h)])}},onShow(){M.showMorePopup=!0},onHide(){M.showMorePopup=!1}})},ve=(e,t,o)=>{var a,i=M["showMorePopup"],l=g.value,u=p.value,u=i?u:l;u&&(l=u.getBoundingClientRect(),u=c.value,a=m.value,i=i?a:u)&&(a=t.getBoundingClientRect(),i.style.display="block",i.style.top=Math.max(1,a.y-l.y)+"px",i.style.left=Math.max(1,a.x-l.x)+"px",i.style.height=a.height+"px",i.style.width=a.width-1+"px",i.setAttribute("drag-pos",o))},pe=e=>{e.stopPropagation(),e.dataTransfer&&e.dataTransfer.setDragImage((0,_dom.getTpImg)(),0,0);const t=e.currentTarget;e=t.parentElement,e=_xeUtils.default.findIndexOf(Array.from(e.children),e=>t===e);M.isDragMove=!0,M.dragIndex=e,setTimeout(()=>{M.isDragMove=!1},500)},ge=t=>{t.stopPropagation(),t.preventDefault();var o=M["dragIndex"];if(-1!==o){var a=_.value;const l=t.currentTarget;var i=l.parentElement,i=_xeUtils.default.findIndexOf(Array.from(i.children),e=>l===e);let e="";e=a?t.clientX-l.getBoundingClientRect().x<l.clientWidth/2?"left":"right":t.clientY-l.getBoundingClientRect().y<l.clientHeight/2?"top":"bottom",o===i?ve(0,l,e):(ve(0,l,e),r.prevDragIndex=i,r.prevDragPos=e)}},ce=e=>{var{fileList:t,dragIndex:o}=M,{prevDragIndex:a,prevDragPos:i}=r,l="bottom"===i||"right"===i?1:0,u=t[o];const n=t[a];u&&n&&(t.splice(o,1),a=_xeUtils.default.findIndexOf(t,e=>n===e)+l,t.splice(a,0,u),O("sort-dragend",{oldItem:u,newItem:n,dragPos:i,offsetIndex:l,_index:{newIndex:a,oldIndex:o}},e)),t=c.value,u=m.value,t&&(t.style.display=""),u&&(u.style.display=""),M.dragIndex=-1},me=e=>{a&&e.stopPropagation(),M.isActivated=!0},_e=e=>{var t=U["pasteToUpload"],o=M["isActivated"];o&&t&&(o=e.clipboardData||e.originalEvent.clipboardData)&&(t=o["items"],t)&&(o=se(t)).length&&(e.preventDefault(),re(e,o))},fe=e=>{var t=g.value,o=p.value;let a=(0,_dom.getEventTargetNode)(e,t).flag;!a&&o&&(o=(t=o.parentElement||o)&&t.parentElement,a=(0,_dom.getEventTargetNode)(e,o).flag),M.isActivated=a},he=()=>{M.isActivated=!1};t={dispatchEvent:O,choose(){return ee(null)}};Object.assign(h,t,{});const C=(e,u)=>{const{showRemoveButton:n,showDownloadButton:r,showProgress:d,progressText:s,showPreview:v,showErrorStatus:p,dragSort:g}=U,c=M["fileCacheMaps"],m=I.value,_=y.value,f=S.value,h=B.value,x=w.corner,C={};return g&&1<e.length&&(C.onDragstart=pe,C.onDragover=ge,C.onDragend=ce),e.map((t,o)=>{var e=N(t),a=c[e];const i=a&&a.loading,l=a&&"error"===a.status;return(0,_vue.h)("div",Object.assign({key:g?e:o,class:["vxe-upload--file-item",{"is--preview":v,"is--loading":i,"is--error":l}],fileid:e,draggable:!!g||null},C),[(0,_vue.h)("div",{class:"vxe-upload--file-item-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)()["UPLOAD_FILE_TYPE_"+(""+t[h]).toLocaleUpperCase()]||(0,_ui.getIcon)().UPLOAD_FILE_TYPE_DEFAULT})]),(0,_vue.h)("div",{class:"vxe-upload--file-item-name",onClick(e){i||l||W(e,t)}},""+(t[f]||"")),i?(0,_vue.h)("div",{class:"vxe-upload--file-item-loading-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_LOADING})]):(0,_vue.createCommentVNode)(),d&&i&&a?(0,_vue.h)("div",{class:"vxe-upload--file-item-loading-text"},s?_xeUtils.default.toFormatString(""+(_xeUtils.default.isFunction(s)?s({}):s),{percent:a.percent}):(0,_ui.getI18n)("vxe.upload.uploadProgress",[a.percent])):(0,_vue.createCommentVNode)(),p&&l?(0,_vue.h)("div",{class:"vxe-upload--image-item-error"},[(0,_vue.h)(_button.default,{icon:(0,_ui.getIcon)().UPLOAD_IMAGE_RE_UPLOAD,mode:"text",status:"primary",content:(0,_ui.getI18n)("vxe.upload.reUpload"),onClick(){Z(t)}})]):(0,_vue.createCommentVNode)(),(0,_vue.h)("div",{class:"vxe-upload--file-item-btn-wrapper"},[x?(0,_vue.h)("div",{class:"vxe-upload--file-item-corner"},(0,_vn.getSlotVNs)(x({option:t,isMoreView:u,readonly:_}))):(0,_vue.createCommentVNode)(),r&&!i?(0,_vue.h)("div",{class:"vxe-upload--file-item-download-btn",onClick(e){le(e,t)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_FILE_DOWNLOAD})]):(0,_vue.createCommentVNode)(),!n||_||m||i?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--file-item-remove-btn",onClick(e){ae(e,t,o)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_FILE_REMOVE})])])])})},z=e=>{var{showUploadButton:t,buttonText:o,buttonIcon:a,showButtonText:i,showButtonIcon:l,autoHiddenButton:u}=U,n=I.value,r=y.value,d=G.value,s=H.value,v=f.value,p=w.default,g=w.tip||w.hint;return r||!t?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--file-action"},[u&&v?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--file-action-btn",onClick:te},p?(0,_vn.getSlotVNs)(p({$upload:h})):[(0,_vue.h)(_button.default,{class:"vxe-upload--file-action-button",content:e||i?o?""+(_xeUtils.default.isFunction(o)?o({}):o):(0,_ui.getI18n)("vxe.upload.fileBtnText"):"",icon:l?a||(0,_ui.getIcon)().UPLOAD_FILE_ADD:"",disabled:n})]),d&&(s||g)?(0,_vue.h)("div",{class:"vxe-upload--file-action-tip"},g?(0,_vn.getSlotVNs)(g({$upload:h})):""+s):(0,_vue.createCommentVNode)()])},j=(e,u)=>{const{showRemoveButton:n,showProgress:r,progressText:d,showPreview:s,showErrorStatus:v,dragSort:p}=U,g=M["fileCacheMaps"],c=I.value,m=y.value,_=l.value,f=Y.value,h=w.corner,x={onMousedown:me};return p&&1<e.length&&(x.onDragstart=pe,x.onDragover=ge,x.onDragend=ce),e.map((t,o)=>{var e=N(t),a=g[e];const i=a&&a.loading,l=a&&"error"===a.status;return(0,_vue.h)("div",Object.assign({key:p?e:o,class:["vxe-upload--image-item",{"is--preview":s,"is--circle":_.circle,"is--loading":i,"is--error":l}],fileid:e,draggable:!!p||null},x),[(0,_vue.h)("div",{class:"vxe-upload--image-item-box",style:u?null:f,title:(0,_ui.getI18n)("vxe.upload.viewItemTitle"),onClick(e){i||l||K(e,t,o)}},[i&&a?(0,_vue.h)("div",{class:"vxe-upload--image-item-loading"},[(0,_vue.h)("div",{class:"vxe-upload--image-item-loading-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_LOADING})]),r?(0,_vue.h)("div",{class:"vxe-upload--image-item-loading-text"},d?_xeUtils.default.toFormatString(""+(_xeUtils.default.isFunction(d)?d({}):d),{percent:a.percent}):(0,_ui.getI18n)("vxe.upload.uploadProgress",[a.percent])):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)(),i?(0,_vue.createCommentVNode)():l&&v?(0,_vue.h)("div",{class:"vxe-upload--image-item-error"},[(0,_vue.h)(_button.default,{icon:(0,_ui.getIcon)().UPLOAD_IMAGE_RE_UPLOAD,mode:"text",status:"primary",content:(0,_ui.getI18n)("vxe.upload.reUpload"),onClick(){Z(t)}})]):(0,_vue.h)("div",{class:"vxe-upload--image-item-img-wrapper"},[(0,_vue.h)("img",{class:"vxe-upload--image-item-img",src:X(t)})]),(0,_vue.h)("div",{class:"vxe-upload--image-item-btn-wrapper",onClick(e){e.stopPropagation()}},[h?(0,_vue.h)("div",{class:"vxe-upload--file-item-corner"},(0,_vn.getSlotVNs)(h({option:t,isMoreView:u,readonly:m}))):(0,_vue.createCommentVNode)(),!n||m||c||i?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{class:"vxe-upload--image-item-remove-btn",onClick(e){e.stopPropagation(),ae(e,t,o)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_IMAGE_REMOVE})])])])])})},k=e=>{var{showUploadButton:t,buttonText:o,buttonIcon:a,showButtonText:i,showButtonIcon:l,autoHiddenButton:u}=U,n=y.value,r=G.value,d=H.value,s=f.value,v=Y.value,p=w.default,g=w.tip||w.hint;return n||!t||u&&s?(0,_vue.createCommentVNode)():(0,_vue.h)("div",{key:"action",class:"vxe-upload--image-action"},[(0,_vue.h)("div",{class:"vxe-upload--image-action-btn",onClick:te},p?p({$upload:h}):[(0,_vue.h)("div",{class:"vxe-upload--image-action-box",style:e?null:v},[l?(0,_vue.h)("div",{class:"vxe-upload--image-action-icon"},[(0,_vue.h)("i",{class:a||(0,_ui.getIcon)().UPLOAD_IMAGE_ADD})]):(0,_vue.createCommentVNode)(),e||i?(0,_vue.h)("div",{class:"vxe-upload--image-action-content"},o?""+(_xeUtils.default.isFunction(o)?o({}):o):(0,_ui.getI18n)("vxe.upload.imgBtnText")):(0,_vue.createCommentVNode)(),r&&(d||g)?(0,_vue.h)("div",{class:"vxe-upload--image-action-hint"},g?(0,_vn.getSlotVNs)(g({$upload:h})):""+d):(0,_vue.createCommentVNode)()])])])};const o=(0,_vue.ref)(0);return(0,_vue.watch)(()=>U.modelValue?U.modelValue.length:0,()=>{o.value++}),(0,_vue.watch)(()=>U.modelValue,()=>{o.value++}),(0,_vue.watch)(o,()=>{s()}),(0,_vue.onMounted)(()=>{"development"===process.env.NODE_ENV&&(U.multiple&&U.singleMode&&(0,_log.errLog)("vxe.error.errConflicts",["multiple","single-mode"]),U.imageStyle)&&(0,_log.warnLog)("vxe.error.delProp",["image-style","image-config"]),U.dragSort&&(0,_dom.initTpImg)(),_ui.globalEvents.on(h,"paste",_e),_ui.globalEvents.on(h,"mousedown",fe),_ui.globalEvents.on(h,"blur",he)}),(0,_vue.onUnmounted)(()=>{M.isDragUploadStatus=!1,_ui.globalEvents.off(h,"paste"),_ui.globalEvents.off(h,"mousedown"),_ui.globalEvents.off(h,"blur")}),s(),h.renderVN=()=>{var{showErrorStatus:e,dragToUpload:t,pasteToUpload:o,dragSort:a}=U,{isDragUploadStatus:i,showMorePopup:l,isActivated:u,dragIndex:n}=M,r=R.value,d=I.value,s=y.value,v=_.value,p={onMousedown:me};return t&&-1===n&&(p.onDragover=ne,p.onDragleave=ue,p.onDrop=de),(0,_vue.h)("div",Object.assign({ref:g,class:["vxe-upload",{["size--"+r]:r,"is--active":u,"is--readonly":s,"is--disabled":d,"is--paste":o,"show--error":e,"is--drag":i}]},p),[(v?()=>{var{showList:e,dragSort:t}=U;const{fileList:o,isDragMove:a}=M,{maxCount:i,showMoreButton:l}=Q.value;let u=o,n=0;return i&&o.length>i&&(n=o.length-i,u=o.slice(0,i)),(0,_vue.h)("div",{key:"image",class:"vxe-upload--image-wrapper"},e?[t?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(a?"":"-disabled"),tag:"div",class:"vxe-upload--image-list"},{default:()=>j(u,!1).concat([l&&n?(0,_vue.h)("div",{key:"om",class:"vxe-upload--image-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[o.length]),status:"primary",onClick:x})]):(0,_vue.createCommentVNode)(),k(!1)])}):(0,_vue.h)("div",{class:"vxe-upload--image-list"},j(u,!1).concat([l&&n?(0,_vue.h)("div",{class:"vxe-upload--image-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[o.length]),status:"primary",onClick:x})]):(0,_vue.createCommentVNode)(),k(!1)]))]:[(0,_vue.h)("div",{class:"vxe-upload--image-list"},[k(!1)])])}:()=>{var{showList:e,moreConfig:t,dragSort:o}=U,{fileList:a,isDragMove:i}=M,{maxCount:l,showMoreButton:u,layout:n}=Q.value,n="horizontal"===n;let r=a,d=0;return l&&a.length>l&&(d=a.length-l,r=a.slice(0,l)),(0,_vue.h)("div",{key:"all",class:"vxe-upload--file-wrapper"},e?[u&&t&&n?(0,_vue.createCommentVNode)():z(!0),r.length||u&&n?(0,_vue.h)("div",{class:["vxe-upload--file-list-wrapper",{"is--horizontal":n}]},[r.length?o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(i?"":"-disabled"),tag:"div",class:"vxe-upload--file-list"},{default:()=>C(r,!1)}):(0,_vue.h)("div",{class:"vxe-upload--file-list"},C(r,!1)):(0,_vue.createCommentVNode)(),u&&d?(0,_vue.h)("div",{class:"vxe-upload--file-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[a.length]),status:"primary",onClick:x})]):(0,_vue.createCommentVNode)(),u&&t&&n?z(!1):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)()]:[z(!1)])})(),a?(0,_vue.h)("div",{ref:c,class:"vxe-upload--drag-line"}):(0,_ui.renderEmptyElement)(h),i&&!l?(0,_vue.h)("div",{class:"vxe-upload--drag-placeholder"},(0,_ui.getI18n)("vxe.upload.dragPlaceholder")):(0,_ui.renderEmptyElement)(h)])},h},render(){return this.renderVN()}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_vn=require("../../ui/src/vn"),_log=require("../../ui/src/log"),_dom=require("../../ui/src/dom"),_util=require("./util"),_button=_interopRequireDefault(require("../../button/src/button"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_vue.defineComponent)({name:"VxeUpload",props:{modelValue:[Array,String,Object],showList:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showList},moreConfig:Object,readonly:{type:Boolean,default:null},disabled:{type:Boolean,default:null},mode:{type:String,default:()=>(0,_ui.getConfig)().upload.mode},imageTypes:{type:Array,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageTypes,!0)},imageConfig:{type:Object,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageConfig,!0)},imageStyle:{type:Object,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.imageStyle,!0)},fileTypes:{type:Array,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.fileTypes,!0)},dragSort:Boolean,dragToUpload:{type:Boolean,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.dragToUpload,!0)},pasteToUpload:{type:Boolean,default:()=>_xeUtils.default.clone((0,_ui.getConfig)().upload.pasteToUpload,!0)},keyField:String,singleMode:Boolean,urlMode:Boolean,multiple:Boolean,limitSize:{type:[String,Number],default:()=>(0,_ui.getConfig)().upload.limitSize},showLimitSize:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showLimitSize},limitSizeText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.limitSizeText},limitCount:{type:[String,Number],default:()=>(0,_ui.getConfig)().upload.limitCount},showLimitCount:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showLimitCount},limitCountText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.limitCountText},nameField:{type:String,default:()=>(0,_ui.getConfig)().upload.nameField},typeField:{type:String,default:()=>(0,_ui.getConfig)().upload.typeField},urlField:{type:String,default:()=>(0,_ui.getConfig)().upload.urlField},sizeField:{type:String,default:()=>(0,_ui.getConfig)().upload.sizeField},showErrorStatus:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showErrorStatus},showProgress:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showProgress},progressText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.progressText},autoHiddenButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.autoHiddenButton},showUploadButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showUploadButton},buttonText:{type:[String,Number,Function],default:()=>(0,_ui.getConfig)().upload.buttonText},buttonIcon:{type:String,default:()=>(0,_ui.getConfig)().upload.buttonIcon},showButtonText:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showButtonText},showButtonIcon:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showButtonIcon},showRemoveButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showRemoveButton},showDownloadButton:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showDownloadButton},showPreview:{type:Boolean,default:()=>(0,_ui.getConfig)().upload.showPreview},showTip:{type:Boolean,default:()=>null},tipText:[String,Number,Function],hintText:String,previewMethod:Function,uploadMethod:Function,beforeRemoveMethod:Function,removeMethod:Function,beforeDownloadMethod:Function,downloadMethod:Function,getUrlMethod:Function,getThumbnailUrlMethod:Function,size:{type:String,default:()=>(0,_ui.getConfig)().upload.size||(0,_ui.getConfig)().size}},emits:["update:modelValue","add","remove","remove-fail","download","download-fail","upload-success","upload-error","sort-dragend"],setup(E,e){const{emit:u,slots:w}=e,U=(0,_vue.inject)("$xeForm",null),b=(0,_vue.inject)("xeFormItemInfo",null),i=(0,_vue.inject)("$xeTable",null);var t=_xeUtils.default.uniqueId();const R=(0,_ui.useSize)(E)["computeSize"],g=(0,_vue.ref)(),v=(0,_vue.ref)(),m=(0,_vue.ref)(),c=(0,_vue.ref)(),T=(0,_vue.reactive)({isDragUploadStatus:!1,showMorePopup:!1,isActivated:!1,fileList:[],fileCacheMaps:{},isDragMove:!1,dragIndex:-1,dragTipText:""}),r={imagePreviewTypes:["jpg","jpeg","png","gif"],prevDragIndex:-1},l={refElem:g},C=(0,_vue.computed)(()=>{var e=E["readonly"];return null===e?!!U&&U.props.readonly:e}),I=(0,_vue.computed)(()=>{var e=E["disabled"];return null===e?!!U&&U.props.disabled:e}),M=(0,_vue.computed)(()=>E.keyField||"_X_KEY"),_=(0,_vue.computed)(()=>"image"===E.mode),D=(0,_vue.computed)(()=>E.nameField||"name"),S=(0,_vue.computed)(()=>E.typeField||"type"),B=(0,_vue.computed)(()=>E.urlField||"url"),L=(0,_vue.computed)(()=>E.sizeField||"size"),$=(0,_vue.computed)(()=>1024*_xeUtils.default.toNumber(E.limitSize)*1024),P=(0,_vue.computed)(()=>E.multiple?_xeUtils.default.toNumber(E.limitCount):1),f=(0,_vue.computed)(()=>{var e=E["multiple"],t=T["fileList"],o=P.value;return e?!o||t.length>=o:1<=t.length}),q=(0,_vue.computed)(()=>{var e=_xeUtils.default.toNumber(E.limitSize);return e?1048576<e?e/1048576+"T":1024<e?e/1024+"G":e+"M":""}),G=(0,_vue.computed)(()=>{var{showTip:e,tipText:t}=E;return _xeUtils.default.isBoolean(e)||(e=(0,_ui.getConfig)().upload.showTip,_xeUtils.default.isBoolean(e))?e:!!t}),H=(0,_vue.computed)(()=>{var{limitSize:e,fileTypes:t,multiple:o,limitCount:i}=E,l=E.tipText||E.hintText,a=_.value,u=q.value;return _xeUtils.default.isString(l)?l:_xeUtils.default.isFunction(l)?""+l({}):(l=[],a?(o&&i&&l.push((0,_ui.getI18n)("vxe.upload.imgCountHint",[i])),e&&u&&l.push((0,_ui.getI18n)("vxe.upload.imgSizeHint",[u]))):(t&&t.length&&l.push((0,_ui.getI18n)("vxe.upload.fileTypeHint",[t.join("/")])),e&&u&&l.push((0,_ui.getI18n)("vxe.upload.fileSizeHint",[u])),o&&i&&l.push((0,_ui.getI18n)("vxe.upload.fileCountHint",[i]))),l.join((0,_ui.getI18n)("vxe.base.comma")))}),a=(0,_vue.computed)(()=>Object.assign({},E.imageConfig||E.imageStyle)),Y=(0,_vue.computed)(()=>{var{width:e,height:t}=a.value,o={};return e&&(o.width=(0,_dom.toCssUnit)(e)),t&&(o.height=(0,_dom.toCssUnit)(t)),o}),Q=(0,_vue.computed)(()=>Object.assign({showMoreButton:!0},E.moreConfig)),d={},F={xID:t,props:E,context:e,reactData:T,internalData:r,getRefMaps:()=>l,getComputeMaps:()=>d},O=()=>_xeUtils.default.uniqueId(),A=e=>{return e[M.value]},s=()=>{var{modelValue:e,multiple:t}=E,o=C.value;const l=M.value,a=D.value,u=S.value,n=B.value,r=L.value;e=e?(e?_xeUtils.default.isArray(e)?e:[e]:[]).map(e=>{if(!e||_xeUtils.default.isString(e)){var t=""+(e||""),o=_xeUtils.default.parseUrl(e);const i=(o?o.searchQuery[a]:"")||decodeURIComponent(""+(t||"")).split("/").pop()||"";return{[a]:i,[u]:(o?o.searchQuery[u]:"")||V(i),[n]:t,[r]:_xeUtils.default.toNumber(o?o.searchQuery[r]:0)||0,[l]:O()}}const i=e[a]||"";return e[a]=i,e[u]=e[u]||V(i),e[n]=e[n]||"",e[r]=e[r]||0,e[l]=e[l]||O(),e}):[];T.fileList=o||t?e:e.slice(0,1)},V=e=>{var t=e.lastIndexOf(".");return 0<t?e.substring(t+1).toLowerCase():""},z=(e,t,o)=>{u(e,(0,_ui.createEvent)(o,{$upload:F},t))},N=e=>{var{singleMode:t,urlMode:o}=E;const i=B.value,l=D.value;let a=e?e.slice(0):[];o&&(a=a.map(e=>{var t=e[i];if(t&&!_xeUtils.default.parseUrl(t).searchQuery[l])return""+t+(-1===t.indexOf("?")?"?":"&")+l+"="+encodeURIComponent(e[l]||"");return t})),u("update:modelValue",t?a[0]||null:a)},X=e=>{var t=E.getThumbnailUrlMethod||(0,_ui.getConfig)().upload.getThumbnailUrlMethod;return t?t({$upload:F,option:e}):n(e)},n=e=>{var t=E.getUrlMethod||(0,_ui.getConfig)().upload.getUrlMethod,o=B.value;return t?t({$upload:F,option:e}):e[o]},W=(e,t)=>{var o=E.previewMethod||(0,_ui.getConfig)().upload.previewMethod;if(E.showPreview)if(o)o({$upload:F,option:t});else{var i=t;var{imageTypes:o,showDownloadButton:t}=E;const a=S.value,u=E.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;var l=r["imagePreviewTypes"];l.concat(o||[]).some(e=>(""+e).toLowerCase()===(""+i[a]).toLowerCase())&&_ui.VxeUI.previewImage&&_ui.VxeUI.previewImage({urlList:[n(i)],showDownloadButton:t,beforeDownloadMethod:u?()=>u({$upload:F,option:i}):void 0})}},K=(e,t,o)=>{var i=E["showDownloadButton"];const l=T["fileList"],a=E.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;E.showPreview&&_ui.VxeUI.previewImage&&_ui.VxeUI.previewImage({urlList:l.map(e=>n(e)),activeIndex:o,showDownloadButton:i,beforeDownloadMethod:a?({index:e})=>a({$upload:F,option:l[e]}):void 0})},J=(o,e)=>{const i=E["showErrorStatus"],l=A(o);var t=E.uploadMethod||(0,_ui.getConfig)().upload.uploadMethod;return t?Promise.resolve(t({$upload:F,file:e,option:o,updateProgress(e){var t=T["fileCacheMaps"],t=t[A(o)];t&&(t.percent=Math.max(0,Math.min(99,_xeUtils.default.toNumber(e))))}})).then(e=>{var t=T["fileCacheMaps"],t=t[l];t&&(t.percent=100),Object.assign(o,e),z("upload-success",{option:o,data:e},null)}).catch(e=>{var t=T["fileCacheMaps"],t=t[l];t&&(t.status="error"),i?Object.assign(o,e):T.fileList=T.fileList.filter(e=>A(e)!==l),z("upload-error",{option:o,data:e},null)}).finally(()=>{var e=T["fileCacheMaps"],e=e[l];e&&(e.loading=!1)}):(t=T["fileCacheMaps"],(e=t[l])&&(e.loading=!1),Promise.resolve())},Z=e=>{const{uploadMethod:t,urlMode:o}=E;var i,l=T["fileCacheMaps"],l=l[A(e)];(t||(0,_ui.getConfig)().upload.uploadMethod)&&l&&(i=l.file,l.loading=!0,l.status="",l.percent=0,J(e,i).then(()=>{o&&N(T.fileList)}))},p=(t,i)=>{var{multiple:e,urlMode:o,showLimitSize:l,limitSizeText:a,showLimitCount:u,limitCountText:n}=E,r=T["fileList"];const d=E.uploadMethod||(0,_ui.getConfig)().upload.uploadMethod,s=M.value,p=D.value,v=S.value,g=B.value,m=L.value;var c=$.value;const _=P.value;var f=q.value;let h=t;if(e&&_){if(u&&r.length>=_)return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:n?""+(_xeUtils.default.isFunction(n)?n({maxCount:_}):n):(0,_ui.getI18n)("vxe.upload.overCountErr",[_])}));const C=h.length-(_-r.length);if(u&&0<C){const I=h.slice(_-r.length);n?_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:""+(_xeUtils.default.isFunction(n)?n({maxCount:_}):n)}):_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",width:null,slots:{default(){return(0,_vue.h)("div",{class:"vxe-upload--file-message-over-error"},[(0,_vue.h)("div",{},(0,_ui.getI18n)("vxe.upload.overCountExtraErr",[_,C])),(0,_vue.h)("div",{class:"vxe-upload--file-message-over-extra"},I.map((e,t)=>(0,_vue.h)("div",{key:t,class:"vxe-upload--file-message-over-extra-item"},e.name)))])}}})}h=h.slice(0,_-r.length)}if(l&&c)for(let e=0;e<t.length;e++)if(t[0].size>c)return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:a?""+(_xeUtils.default.isFunction(a)?a({maxSize:c}):a):(0,_ui.getI18n)("vxe.upload.overSizeErr",[f])}));const x=Object.assign({},T.fileCacheMaps),y=e?r:[],w=[];h.forEach(e=>{var t=e["name"],o=O(),t={[p]:t,[v]:V(t),[m]:e.size,[g]:URL.createObjectURL(e),[s]:o},o=(d&&(x[o]={file:e,loading:!0,status:"",percent:0}),(0,_vue.reactive)(t));d&&w.push(J(o,e)),y.push(o),z("add",{option:o},i)}),T.fileList=y,T.fileCacheMaps=x,Promise.all(o?w:[]).then(()=>{N(y),U&&b&&U.triggerItemEvent(i,b.itemConfig.field,y)})},ee=t=>{var{multiple:e,imageTypes:o,fileTypes:i}=E,l=I.value,a=_.value;return l?Promise.resolve({status:!1,files:[],file:null}):(0,_util.readLocalFile)({multiple:e,types:a?o:i}).then(e=>(p(e.files,t),e))},te=e=>{ee(e).catch(()=>{})},oe=(e,t,o)=>{var i=T["fileList"];i.splice(o,1),N(i),U&&b&&U.triggerItemEvent(e,b.itemConfig.field,i),z("remove",{option:t},e)},ie=(t,o,i)=>{var e=E.beforeRemoveMethod||(0,_ui.getConfig)().upload.beforeRemoveMethod;const l=E.removeMethod||(0,_ui.getConfig)().upload.removeMethod;Promise.resolve(!e||e({$upload:F,option:o})).then(e=>{e?l?Promise.resolve(l({$upload:F,option:o})).then(()=>{oe(t,o,i)}).catch(e=>e):oe(t,o,i):z("remove-fail",{option:o},t)})},le=(e,t)=>{z("download",{option:t},e)},ae=(t,o)=>{var e=E.beforeDownloadMethod||(0,_ui.getConfig)().upload.beforeDownloadMethod;const i=E.downloadMethod||(0,_ui.getConfig)().upload.downloadMethod;Promise.resolve(!e||e({$upload:F,option:o})).then(e=>{e?i?Promise.resolve(i({$upload:F,option:o})).then(()=>{le(t,o)}).catch(e=>e):le(t,o):z("download-fail",{option:o},t)})},ue=e=>{var t,o,i,l=e.currentTarget,{clientX:e,clientY:a}=e;l&&({x:l,y:t,height:o,width:i}=l.getBoundingClientRect(),e<l||l+i<e||a<t||t+o<a)&&(T.isDragUploadStatus=!1)},ne=e=>{var t=e.dataTransfer;t&&(t=t["items"],t)&&t.length&&(e.preventDefault(),T.isDragUploadStatus=!0)},re=(e,t)=>{const{imageTypes:o,fileTypes:i}=E;var l=r["imagePreviewTypes"];if(_.value){const a=l.concat(o&&o.length?o:[]);t=t.filter(e=>{const t=(""+(e.type.split("/")[1]||"")).toLowerCase();return!!a.some(e=>(""+e).toLowerCase()===t)})}else if(i&&i.length){const u=[];if(t.forEach(e=>{const t=V(e.name);i.some(e=>(""+e).toLowerCase()===t)||u.push(t)}),u.length)return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.message({content:(0,_ui.getI18n)("vxe.error.notType",[u.join(", ")]),status:"error"}))}t.length?p(t,e):_ui.VxeUI.modal&&_ui.VxeUI.modal.notification({title:(0,_ui.getI18n)("vxe.modal.errTitle"),status:"error",content:(0,_ui.getI18n)("vxe.upload.uploadTypeErr")})},de=e=>{var t=e.dataTransfer;t&&(t=t["items"],t)&&t.length&&(e.preventDefault(),(t=se(t)).length)&&re(e,t),T.isDragUploadStatus=!1},se=e=>{const t=[];return _xeUtils.default.arrayEach(e,e=>{e=e.getAsFile();e&&t.push(e)}),t},h=()=>{const s=C.value,p=_.value;_ui.VxeUI.modal&&_ui.VxeUI.modal.open({title:s?(0,_ui.getI18n)("vxe.upload.morePopup.readTitle"):(0,_ui.getI18n)("vxe.upload.morePopup."+(p?"imageTitle":"fileTitle")),width:660,height:500,escClosable:!0,showMaximize:!0,resize:!0,maskClosable:!0,slots:{default(){var{showErrorStatus:e,dragToUpload:t,dragSort:o}=E,{isActivated:i,isDragMove:l,isDragUploadStatus:a,dragIndex:u}=T;const n=T["fileList"];var r=I.value,d={};return t&&-1===u&&(d.onDragover=ne,d.onDragleave=ue,d.onDrop=de),(0,_vue.h)("div",Object.assign({ref:v,class:["vxe-upload--more-popup",{"is--readonly":s,"is--disabled":r,"is--active":i,"show--error":e,"is--drag":a}]},d),[p?o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(l?"":"-disabled"),tag:"div",class:"vxe-upload--image-more-list"},{default:()=>j(n,!0).concat(k(!0))}):(0,_vue.h)("div",{class:"vxe-upload--image-more-list"},j(n,!0).concat(k(!0))):(0,_vue.h)("div",{class:"vxe-upload--file-more-list"},[y(!0),o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(l?"":"-disabled"),tag:"div",class:"vxe-upload--file-list"},{default:()=>x(n,!1)}):(0,_vue.h)("div",{class:"vxe-upload--file-list"},x(n,!0))]),o?(0,_vue.h)("div",{ref:c,class:"vxe-upload--drag-line"}):(0,_ui.renderEmptyElement)(F),a?(0,_vue.h)("div",{class:"vxe-upload--drag-placeholder"},(0,_ui.getI18n)("vxe.upload.dragPlaceholder")):(0,_ui.renderEmptyElement)(F)])}},onShow(){T.showMorePopup=!0},onHide(){T.showMorePopup=!1}})},pe=(e,t,o)=>{var i,l=T["showMorePopup"],a=g.value,u=v.value,u=l?u:a;u&&(a=u.getBoundingClientRect(),u=m.value,i=c.value,l=l?i:u)&&(i=t.getBoundingClientRect(),l.style.display="block",l.style.top=Math.max(1,i.y-a.y)+"px",l.style.left=Math.max(1,i.x-a.x)+"px",l.style.height=i.height+"px",l.style.width=i.width-1+"px",l.setAttribute("drag-pos",o))},ve=e=>{e.stopPropagation(),e.dataTransfer&&e.dataTransfer.setDragImage((0,_dom.getTpImg)(),0,0);const t=e.currentTarget;e=t.parentElement,e=_xeUtils.default.findIndexOf(Array.from(e.children),e=>t===e);T.isDragMove=!0,T.dragIndex=e,setTimeout(()=>{T.isDragMove=!1},500)},ge=t=>{t.stopPropagation(),t.preventDefault();var o=T["dragIndex"];if(-1!==o){var i=_.value;const a=t.currentTarget;var l=a.parentElement,l=_xeUtils.default.findIndexOf(Array.from(l.children),e=>a===e);let e="";e=i?t.clientX-a.getBoundingClientRect().x<a.clientWidth/2?"left":"right":t.clientY-a.getBoundingClientRect().y<a.clientHeight/2?"top":"bottom",o===l?pe(0,a,e):(pe(0,a,e),r.prevDragIndex=l,r.prevDragPos=e)}},me=e=>{var{fileList:t,dragIndex:o}=T,{prevDragIndex:i,prevDragPos:l}=r,a="bottom"===l||"right"===l?1:0,u=t[o];const n=t[i];u&&n&&(t.splice(o,1),i=_xeUtils.default.findIndexOf(t,e=>n===e)+a,t.splice(i,0,u),z("sort-dragend",{oldItem:u,newItem:n,dragPos:l,offsetIndex:a,_index:{newIndex:i,oldIndex:o}},e)),t=m.value,u=c.value,t&&(t.style.display=""),u&&(u.style.display=""),T.dragIndex=-1},ce=e=>{i&&e.stopPropagation(),T.isActivated=!0},_e=e=>{var t=E["pasteToUpload"],o=T["isActivated"];o&&t&&(o=e.clipboardData||e.originalEvent.clipboardData)&&(t=o["items"],t)&&(o=se(t)).length&&(e.preventDefault(),re(e,o))},fe=e=>{var t=g.value,o=v.value;let i=(0,_dom.getEventTargetNode)(e,t).flag;!i&&o&&(o=(t=o.parentElement||o)&&t.parentElement,i=(0,_dom.getEventTargetNode)(e,o).flag),T.isActivated=i},he=()=>{T.isActivated=!1};t={dispatchEvent:z,choose(){return ee(null)}};Object.assign(F,t,{});const x=(e,u)=>{const{showRemoveButton:n,showDownloadButton:r,showProgress:d,progressText:s,showPreview:p,showErrorStatus:v,dragSort:g}=E,m=T["fileCacheMaps"],c=I.value,_=C.value,f=D.value,h=S.value,x=w.corner,y={};return g&&1<e.length&&(y.onDragstart=ve,y.onDragover=ge,y.onDragend=me),e.map((t,o)=>{var e=A(t),i=m[e];const l=i&&i.loading,a=i&&"error"===i.status;return(0,_vue.h)("div",Object.assign({key:g?e:o,class:["vxe-upload--file-item",{"is--preview":p,"is--loading":l,"is--error":a}],fileid:e,draggable:!!g||null},y),[(0,_vue.h)("div",{class:"vxe-upload--file-item-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)()["UPLOAD_FILE_TYPE_"+(""+t[h]).toLocaleUpperCase()]||(0,_ui.getIcon)().UPLOAD_FILE_TYPE_DEFAULT})]),(0,_vue.h)("div",{class:"vxe-upload--file-item-name",onClick(e){l||a||W(e,t)}},""+(t[f]||"")),l?(0,_vue.h)("div",{class:"vxe-upload--file-item-loading-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_LOADING})]):(0,_ui.renderEmptyElement)(F),d&&l&&i?(0,_vue.h)("div",{class:"vxe-upload--file-item-loading-text"},s?_xeUtils.default.toFormatString(""+(_xeUtils.default.isFunction(s)?s({}):s),{percent:i.percent}):(0,_ui.getI18n)("vxe.upload.uploadProgress",[i.percent])):(0,_ui.renderEmptyElement)(F),v&&a?(0,_vue.h)("div",{class:"vxe-upload--image-item-error"},[(0,_vue.h)(_button.default,{icon:(0,_ui.getIcon)().UPLOAD_IMAGE_RE_UPLOAD,mode:"text",status:"primary",content:(0,_ui.getI18n)("vxe.upload.reUpload"),onClick(){Z(t)}})]):(0,_ui.renderEmptyElement)(F),(0,_vue.h)("div",{class:"vxe-upload--file-item-btn-wrapper"},[x?(0,_vue.h)("div",{class:"vxe-upload--file-item-corner"},(0,_vn.getSlotVNs)(x({option:t,isMoreView:u,readonly:_}))):(0,_ui.renderEmptyElement)(F),r&&!l?(0,_vue.h)("div",{class:"vxe-upload--file-item-download-btn",onClick(e){ae(e,t)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_FILE_DOWNLOAD})]):(0,_ui.renderEmptyElement)(F),!n||_||c||l?(0,_ui.renderEmptyElement)(F):(0,_vue.h)("div",{class:"vxe-upload--file-item-remove-btn",onClick(e){ie(e,t,o)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_FILE_REMOVE})])])])})},y=e=>{var{showUploadButton:t,buttonText:o,buttonIcon:i,showButtonText:l,showButtonIcon:a,autoHiddenButton:u}=E,n=I.value,r=C.value,d=G.value,s=H.value,p=f.value,v=w.default,g=w.tip||w.hint;return r||!t?(0,_ui.renderEmptyElement)(F):(0,_vue.h)("div",{class:"vxe-upload--file-action"},[u&&p?(0,_ui.renderEmptyElement)(F):(0,_vue.h)("div",{class:"vxe-upload--file-action-btn",onClick:te},v?(0,_vn.getSlotVNs)(v({$upload:F})):[(0,_vue.h)(_button.default,{class:"vxe-upload--file-action-button",content:e||l?o?""+(_xeUtils.default.isFunction(o)?o({}):o):(0,_ui.getI18n)("vxe.upload.fileBtnText"):"",icon:a?i||(0,_ui.getIcon)().UPLOAD_FILE_ADD:"",disabled:n})]),d&&(s||g)?(0,_vue.h)("div",{class:"vxe-upload--file-action-tip"},g?(0,_vn.getSlotVNs)(g({$upload:F})):""+s):(0,_ui.renderEmptyElement)(F)])},j=(e,u)=>{const{showRemoveButton:n,showProgress:r,progressText:d,showPreview:s,showErrorStatus:p,dragSort:v}=E,g=T["fileCacheMaps"],m=I.value,c=C.value,_=a.value,f=Y.value,h=w.corner,x={onMousedown:ce};return v&&1<e.length&&(x.onDragstart=ve,x.onDragover=ge,x.onDragend=me),e.map((t,o)=>{var e=A(t),i=g[e];const l=i&&i.loading,a=i&&"error"===i.status;return(0,_vue.h)("div",Object.assign({key:v?e:o,class:["vxe-upload--image-item",{"is--preview":s,"is--circle":_.circle,"is--loading":l,"is--error":a}],fileid:e,draggable:!!v||null},x),[(0,_vue.h)("div",{class:"vxe-upload--image-item-box",style:u?null:f,title:(0,_ui.getI18n)("vxe.upload.viewItemTitle"),onClick(e){l||a||K(e,t,o)}},[l&&i?(0,_vue.h)("div",{class:"vxe-upload--image-item-loading"},[(0,_vue.h)("div",{class:"vxe-upload--image-item-loading-icon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_LOADING})]),r?(0,_vue.h)("div",{class:"vxe-upload--image-item-loading-text"},d?_xeUtils.default.toFormatString(""+(_xeUtils.default.isFunction(d)?d({}):d),{percent:i.percent}):(0,_ui.getI18n)("vxe.upload.uploadProgress",[i.percent])):(0,_ui.renderEmptyElement)(F)]):(0,_ui.renderEmptyElement)(F),l?(0,_ui.renderEmptyElement)(F):a&&p?(0,_vue.h)("div",{class:"vxe-upload--image-item-error"},[(0,_vue.h)(_button.default,{icon:(0,_ui.getIcon)().UPLOAD_IMAGE_RE_UPLOAD,mode:"text",status:"primary",content:(0,_ui.getI18n)("vxe.upload.reUpload"),onClick(){Z(t)}})]):(0,_vue.h)("div",{class:"vxe-upload--image-item-img-wrapper"},[(0,_vue.h)("img",{class:"vxe-upload--image-item-img",src:X(t)})]),(0,_vue.h)("div",{class:"vxe-upload--image-item-btn-wrapper",onClick(e){e.stopPropagation()}},[h?(0,_vue.h)("div",{class:"vxe-upload--file-item-corner"},(0,_vn.getSlotVNs)(h({option:t,isMoreView:u,readonly:c}))):(0,_ui.renderEmptyElement)(F),!n||c||m||l?(0,_ui.renderEmptyElement)(F):(0,_vue.h)("div",{class:"vxe-upload--image-item-remove-btn",onClick(e){e.stopPropagation(),ie(e,t,o)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().UPLOAD_IMAGE_REMOVE})])])])])})},k=e=>{var{showUploadButton:t,buttonText:o,buttonIcon:i,showButtonText:l,showButtonIcon:a,autoHiddenButton:u}=E,n=C.value,r=G.value,d=H.value,s=f.value,p=Y.value,v=w.default,g=w.tip||w.hint;return n||!t||u&&s?(0,_ui.renderEmptyElement)(F):(0,_vue.h)("div",{key:"action",class:"vxe-upload--image-action"},[(0,_vue.h)("div",{class:"vxe-upload--image-action-btn",onClick:te},v?v({$upload:F}):[(0,_vue.h)("div",{class:"vxe-upload--image-action-box",style:e?null:p},[a?(0,_vue.h)("div",{class:"vxe-upload--image-action-icon"},[(0,_vue.h)("i",{class:i||(0,_ui.getIcon)().UPLOAD_IMAGE_ADD})]):(0,_ui.renderEmptyElement)(F),e||l?(0,_vue.h)("div",{class:"vxe-upload--image-action-content"},o?""+(_xeUtils.default.isFunction(o)?o({}):o):(0,_ui.getI18n)("vxe.upload.imgBtnText")):(0,_ui.renderEmptyElement)(F),r&&(d||g)?(0,_vue.h)("div",{class:"vxe-upload--image-action-hint"},g?(0,_vn.getSlotVNs)(g({$upload:F})):""+d):(0,_ui.renderEmptyElement)(F)])])])};const o=(0,_vue.ref)(0);return(0,_vue.watch)(()=>E.modelValue?E.modelValue.length:0,()=>{o.value++}),(0,_vue.watch)(()=>E.modelValue,()=>{o.value++}),(0,_vue.watch)(o,()=>{s()}),(0,_vue.onMounted)(()=>{"development"===process.env.NODE_ENV&&(E.multiple&&E.singleMode&&(0,_log.errLog)("vxe.error.errConflicts",["multiple","single-mode"]),E.imageStyle)&&(0,_log.warnLog)("vxe.error.delProp",["image-style","image-config"]),E.dragSort&&(0,_dom.initTpImg)(),_ui.globalEvents.on(F,"paste",_e),_ui.globalEvents.on(F,"mousedown",fe),_ui.globalEvents.on(F,"blur",he)}),(0,_vue.onUnmounted)(()=>{T.isDragUploadStatus=!1,_ui.globalEvents.off(F,"paste"),_ui.globalEvents.off(F,"mousedown"),_ui.globalEvents.off(F,"blur")}),s(),F.renderVN=()=>{var{showErrorStatus:e,dragToUpload:t,pasteToUpload:o,dragSort:i}=E,{isDragUploadStatus:l,showMorePopup:a,isActivated:u,dragIndex:n}=T,r=R.value,d=I.value,s=C.value,p=_.value,v={onMousedown:ce};return t&&-1===n&&(v.onDragover=ne,v.onDragleave=ue,v.onDrop=de),(0,_vue.h)("div",Object.assign({ref:g,class:["vxe-upload",{["size--"+r]:r,"is--active":u,"is--readonly":s,"is--disabled":d,"is--paste":o,"show--error":e,"is--drag":l}]},v),[(p?()=>{var{showList:e,dragSort:t}=E;const{fileList:o,isDragMove:i}=T,{maxCount:l,showMoreButton:a}=Q.value;let u=o,n=0;return l&&o.length>l&&(n=o.length-l,u=o.slice(0,l)),(0,_vue.h)("div",{key:"image",class:"vxe-upload--image-wrapper"},e?[t?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(i?"":"-disabled"),tag:"div",class:"vxe-upload--image-list"},{default:()=>j(u,!1).concat([a&&n?(0,_vue.h)("div",{key:"om",class:"vxe-upload--image-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[o.length]),status:"primary",onClick:h})]):(0,_ui.renderEmptyElement)(F),k(!1)])}):(0,_vue.h)("div",{class:"vxe-upload--image-list"},j(u,!1).concat([a&&n?(0,_vue.h)("div",{class:"vxe-upload--image-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[o.length]),status:"primary",onClick:h})]):(0,_ui.renderEmptyElement)(F),k(!1)]))]:[(0,_vue.h)("div",{class:"vxe-upload--image-list"},[k(!1)])])}:()=>{var{showList:e,moreConfig:t,dragSort:o}=E,{fileList:i,isDragMove:l}=T,{maxCount:a,showMoreButton:u,layout:n}=Q.value,n="horizontal"===n;let r=i,d=0;return a&&i.length>a&&(d=i.length-a,r=i.slice(0,a)),(0,_vue.h)("div",{key:"all",class:"vxe-upload--file-wrapper"},e?[u&&t&&n?(0,_ui.renderEmptyElement)(F):y(!0),r.length||u&&n?(0,_vue.h)("div",{class:["vxe-upload--file-list-wrapper",{"is--horizontal":n}]},[r.length?o?(0,_vue.h)(_vue.TransitionGroup,{name:"vxe-upload--drag-list"+(l?"":"-disabled"),tag:"div",class:"vxe-upload--file-list"},{default:()=>x(r,!1)}):(0,_vue.h)("div",{class:"vxe-upload--file-list"},x(r,!1)):(0,_ui.renderEmptyElement)(F),u&&d?(0,_vue.h)("div",{class:"vxe-upload--file-over-more"},[(0,_vue.h)(_button.default,{mode:"text",content:(0,_ui.getI18n)("vxe.upload.moreBtnText",[i.length]),status:"primary",onClick:h})]):(0,_ui.renderEmptyElement)(F),u&&t&&n?y(!1):(0,_ui.renderEmptyElement)(F)]):(0,_ui.renderEmptyElement)(F)]:[y(!1)])})(),i?(0,_vue.h)("div",{ref:m,class:"vxe-upload--drag-line"}):(0,_ui.renderEmptyElement)(F),l&&!a?(0,_vue.h)("div",{class:"vxe-upload--drag-placeholder"},(0,_ui.getI18n)("vxe.upload.dragPlaceholder")):(0,_ui.renderEmptyElement)(F)])},F},render(){return this.renderVN()}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-pc-ui",
3
- "version": "4.6.7",
3
+ "version": "4.6.9",
4
4
  "description": "A vue based PC component library",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -1,6 +1,6 @@
1
- import { defineComponent, ref, h, reactive, PropType, createCommentVNode } from 'vue'
1
+ import { defineComponent, ref, h, reactive, PropType } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
- import { getConfig, getIcon, createEvent } from '../../ui'
3
+ import { getConfig, getIcon, createEvent, renderEmptyElement } from '../../ui'
4
4
  import { getSlotVNs } from '../../ui/src/vn'
5
5
 
6
6
  import type { VxeAlertPropTypes, AlertReactData, AlertPrivateRef, VxeAlertEmits, AlertMethods, AlertPrivateMethods, VxeAlertPrivateComputed, VxeAlertConstructor, VxeAlertPrivateMethods } from '../../../types'
@@ -87,7 +87,7 @@ export default defineComponent({
87
87
  class: icon || getIcon()[`ALERT_${status?.toUpperCase()}` as 'ALERT_SUCCESS']
88
88
  })
89
89
  ])
90
- : createCommentVNode(),
90
+ : renderEmptyElement($xeAlert),
91
91
  h('div', {
92
92
  class: 'vxe-alert--body'
93
93
  }, [
@@ -95,7 +95,7 @@ export default defineComponent({
95
95
  ? h('div', {
96
96
  class: 'vxe-alert--title'
97
97
  }, titleSlot ? getSlotVNs(titleSlot({})) : XEUtils.toValueString(title))
98
- : createCommentVNode(),
98
+ : renderEmptyElement($xeAlert),
99
99
  h('div', {
100
100
  class: 'vxe-alert--content'
101
101
  }, defaultSlot ? getSlotVNs(defaultSlot({})) : XEUtils.toValueString(content))
@@ -109,7 +109,7 @@ export default defineComponent({
109
109
  class: getIcon().ALERT_CLOSE
110
110
  })
111
111
  ])
112
- : createCommentVNode()
112
+ : renderEmptyElement($xeAlert)
113
113
  ])
114
114
  }
115
115
 
@@ -1,5 +1,6 @@
1
- import { defineComponent, ref, h, computed, reactive, PropType, inject, createCommentVNode, onMounted, onUnmounted, provide, watch } from 'vue'
1
+ import { defineComponent, ref, h, computed, reactive, PropType, inject, onMounted, onUnmounted, provide, watch } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
+ import { renderEmptyElement } from '../../ui'
3
4
  import { assembleAnchorLink, destroyAnchorLink } from './util'
4
5
 
5
6
  import type { VxeAnchorLinkDefines, VxeAnchorLinkPropTypes, VxeAnchorLinkEmits, AnchorLinkReactData, AnchorLinkPrivateRef, VxeAnchorLinkPrivateComputed, VxeAnchorLinkConstructor, VxeAnchorLinkPrivateMethods, VxeAnchorConstructor, VxeAnchorPrivateMethods } from '../../../types'
@@ -103,7 +104,7 @@ export default defineComponent({
103
104
  ? h('div', {
104
105
  class: 'vxe-anchor-link--sub-items'
105
106
  }, subSlot({}))
106
- : createCommentVNode()
107
+ : renderEmptyElement($xeAnchorLink)
107
108
  ])
108
109
  }
109
110
 
@@ -1,6 +1,6 @@
1
- import { defineComponent, ref, h, reactive, PropType, VNode, provide, nextTick, onBeforeUnmount, onMounted, watch, createCommentVNode, computed } from 'vue'
1
+ import { defineComponent, ref, h, reactive, PropType, VNode, provide, nextTick, onBeforeUnmount, onMounted, watch, computed } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
- import { createEvent } from '@vxe-ui/core'
3
+ import { createEvent, renderEmptyElement } from '../../ui'
4
4
  import { getOffsetPos } from '../../ui/src/dom'
5
5
  import VxeAnchorLinkComponent from './anchor-link'
6
6
 
@@ -197,7 +197,7 @@ export default defineComponent({
197
197
  ref: refMarkerElem,
198
198
  class: 'vxe-anchor--marker'
199
199
  })
200
- : createCommentVNode()
200
+ : renderEmptyElement($xeAnchor)
201
201
  ])
202
202
  }
203
203
 
@@ -1,5 +1,6 @@
1
- import { defineComponent, ref, h, reactive, computed, resolveComponent, inject, createCommentVNode, PropType } from 'vue'
1
+ import { defineComponent, ref, h, reactive, computed, resolveComponent, inject, PropType } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
+ import { renderEmptyElement } from '../../ui'
3
4
 
4
5
  import type { VxeBreadcrumbItemPropTypes, VxeBreadcrumbItemEmits, BreadcrumbItemReactData, BreadcrumbItemPrivateRef, VxeBreadcrumbItemPrivateComputed, VxeBreadcrumbItemConstructor, VxeBreadcrumbItemPrivateMethods, VxeBreadcrumbConstructor, VxeBreadcrumbPrivateMethods } from '../../../types'
5
6
 
@@ -90,7 +91,7 @@ export default defineComponent({
90
91
  ? h('span', {
91
92
  class: 'vxe-breadcrumb-item--separator'
92
93
  }, `${separator}`)
93
- : createCommentVNode()
94
+ : renderEmptyElement($xeBreadcrumbItem)
94
95
  ])
95
96
  }
96
97
 
@@ -1,5 +1,5 @@
1
- import { defineComponent, h, reactive, provide, PropType, createCommentVNode } from 'vue'
2
- import { getConfig, createEvent, useSize, usePermission } from '@vxe-ui/core'
1
+ import { defineComponent, h, reactive, provide, PropType } from 'vue'
2
+ import { getConfig, createEvent, useSize, usePermission, renderEmptyElement } from '../../ui'
3
3
  import XEUtils from 'xe-utils'
4
4
  import VxeButtonComponent from './button'
5
5
 
@@ -71,7 +71,7 @@ export default defineComponent({
71
71
  const permissionInfo = computePermissionInfo.value
72
72
  const defaultSlot = slots.default
73
73
  if (!permissionInfo.visible) {
74
- return createCommentVNode()
74
+ return renderEmptyElement($xeButtonGroup)
75
75
  }
76
76
  return h('div', {
77
77
  class: ['vxe-button-group', className ? (XEUtils.isFunction(className) ? className({ $buttonGroup: $xeButtonGroup }) : className) : '', {
@@ -1,6 +1,6 @@
1
- import { defineComponent, h, ref, computed, Teleport, resolveComponent, VNode, onUnmounted, reactive, nextTick, PropType, onMounted, inject, createCommentVNode } from 'vue'
1
+ import { defineComponent, h, ref, computed, Teleport, resolveComponent, VNode, onUnmounted, reactive, nextTick, PropType, onMounted, inject } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
- import { getConfig, globalEvents, getIcon, createEvent, useSize, usePermission, permission } from '../../ui'
3
+ import { getConfig, globalEvents, getIcon, createEvent, useSize, usePermission, permission, renderEmptyElement } from '../../ui'
4
4
  import { getEventTargetNode, updatePanelPlacement } from '../../ui/src/dom'
5
5
  import { getFuncText, getLastZIndex, nextZIndex } from '../../ui/src/utils'
6
6
  import { warnLog } from '../../ui/src/log'
@@ -98,7 +98,8 @@ const VxeButtonComponent = defineComponent({
98
98
  'click',
99
99
  'mouseenter',
100
100
  'mouseleave',
101
- 'dropdown-click'
101
+ 'dropdown-click',
102
+ 'dropdownClick'
102
103
  ] as VxeButtonEmits,
103
104
  setup (props, context) {
104
105
  const { slots, emit } = context
@@ -545,7 +546,7 @@ const VxeButtonComponent = defineComponent({
545
546
  const dropdownsSlot = slots.dropdowns
546
547
 
547
548
  if (!permissionInfo.visible) {
548
- return createCommentVNode()
549
+ return renderEmptyElement($xeButton)
549
550
  }
550
551
  if (dropdownsSlot || downBtnList.length) {
551
552
  const btnOns: Record<string, any> = {}
@@ -1,6 +1,6 @@
1
- import { defineComponent, ref, h, reactive, PropType, createCommentVNode, computed } from 'vue'
1
+ import { defineComponent, ref, h, reactive, PropType, computed } from 'vue'
2
2
  import { getSlotVNs } from '../../ui/src/vn'
3
- import { getConfig, createEvent } from '../../ui'
3
+ import { getConfig, createEvent, renderEmptyElement } from '../../ui'
4
4
  import { toCssUnit } from '../../ui/src/dom'
5
5
  import VxeLoadingComponent from '../../loading/src/loading'
6
6
  import XEUtils from 'xe-utils'
@@ -120,9 +120,9 @@ export default defineComponent({
120
120
  ? h('div', {
121
121
  class: 'vxe-card--header-extra'
122
122
  }, getSlotVNs(extraSlot({})))
123
- : createCommentVNode()
123
+ : renderEmptyElement($xeCard)
124
124
  ])
125
- : createCommentVNode(),
125
+ : renderEmptyElement($xeCard),
126
126
  h('div', {
127
127
  class: 'vxe-card--body'
128
128
  }, [
@@ -130,7 +130,7 @@ export default defineComponent({
130
130
  ? h('div', {
131
131
  class: 'vxe-card--body-left'
132
132
  }, getSlotVNs(leftSlot({})))
133
- : createCommentVNode(),
133
+ : renderEmptyElement($xeCard),
134
134
  h('div', {
135
135
  class: 'vxe-card--body-content'
136
136
  }, defaultSlot ? getSlotVNs(defaultSlot({})) : []),
@@ -138,13 +138,13 @@ export default defineComponent({
138
138
  ? h('div', {
139
139
  class: 'vxe-card--body-right'
140
140
  }, getSlotVNs(rightSlot({})))
141
- : createCommentVNode()
141
+ : renderEmptyElement($xeCard)
142
142
  ]),
143
143
  footerSlot
144
144
  ? h('div', {
145
145
  class: 'vxe-card--footer'
146
146
  }, getSlotVNs(footerSlot({})))
147
- : createCommentVNode(),
147
+ : renderEmptyElement($xeCard),
148
148
  /**
149
149
  * 加载中
150
150
  */
@@ -1,5 +1,5 @@
1
- import { defineComponent, ref, h, reactive, provide, PropType, watch, nextTick, onMounted, computed, onUnmounted, createCommentVNode } from 'vue'
2
- import { getConfig, getIcon, createEvent } from '../../ui'
1
+ import { defineComponent, ref, h, reactive, provide, PropType, watch, nextTick, onMounted, computed, onUnmounted } from 'vue'
2
+ import { getConfig, getIcon, createEvent, renderEmptyElement } from '../../ui'
3
3
  import { getSlotVNs } from '../../ui/src/vn'
4
4
  import { toCssUnit } from '../../ui/src/dom'
5
5
  import VxeLoadingComponent from '../../loading/src/loading'
@@ -333,7 +333,7 @@ export default defineComponent({
333
333
  }, [
334
334
  renderItemWrapper(list)
335
335
  ]),
336
- showIndicators ? renderIndicators(list) : createCommentVNode(),
336
+ showIndicators ? renderIndicators(list) : renderEmptyElement($xeCarousel),
337
337
  h('div', {
338
338
  class: 'vxe-carousel--btn-wrapper'
339
339
  }, [
@@ -1,5 +1,5 @@
1
- import { defineComponent, ref, h, reactive, watch, computed, PropType, onUnmounted, onMounted, createCommentVNode } from 'vue'
2
- import { getConfig, getI18n, createEvent, useSize } from '../../ui'
1
+ import { defineComponent, ref, h, reactive, watch, computed, PropType, onUnmounted, onMounted } from 'vue'
2
+ import { getConfig, getI18n, createEvent, useSize, renderEmptyElement } from '../../ui'
3
3
  import { getSlotVNs } from '../../ui/src/vn'
4
4
  import VxeTextComponent from '../../text/src/text'
5
5
  import XEUtils from 'xe-utils'
@@ -211,7 +211,7 @@ export default defineComponent({
211
211
  status: prefixOpts.status
212
212
  })
213
213
  ])
214
- : createCommentVNode(),
214
+ : renderEmptyElement($xeCountdown),
215
215
  h('div', {
216
216
  class: 'vxe-countdown--content'
217
217
  }, defaultSlot
@@ -230,7 +230,7 @@ export default defineComponent({
230
230
  status: suffixOpts.status
231
231
  })
232
232
  ])
233
- : createCommentVNode()
233
+ : renderEmptyElement($xeCountdown)
234
234
  ])
235
235
  }
236
236
 
@@ -1,6 +1,6 @@
1
- import { defineComponent, onUnmounted, inject, ref, h, reactive, onMounted, provide, createCommentVNode } from 'vue'
1
+ import { defineComponent, onUnmounted, inject, ref, h, reactive, onMounted, provide } from 'vue'
2
2
  import { createItem, watchItem, destroyItem, assembleItem, XEFormItemProvide } from './util'
3
- import { renderer } from '../../ui'
3
+ import { renderer, renderEmptyElement } from '../../ui'
4
4
  import { isEnableConf } from '../../ui/src/utils'
5
5
  import { formItemProps } from './form-item'
6
6
  import { renderTitle, getItemClass, getItemContentClass } from './render'
@@ -13,6 +13,9 @@ export default defineComponent({
13
13
  props: formItemProps,
14
14
  setup (props, context) {
15
15
  const { slots } = context
16
+
17
+ const xID = XEUtils.uniqueId()
18
+
16
19
  const refElem = ref<HTMLDivElement>()
17
20
  const $xeForm = inject('$xeForm', {} as VxeFormConstructor & VxeFormPrivateMethods)
18
21
  const $xeParentFormGroup = inject<XEFormItemProvide | null>('$xeFormGroup', null)
@@ -36,7 +39,7 @@ export default defineComponent({
36
39
  const defaultSlot = slots ? slots.default : null
37
40
  const params = { data, disabled, readonly, field, property: field, item, $form: $xeForm, $grid: $xeGrid }
38
41
  if (visible === false) {
39
- return createCommentVNode()
42
+ return renderEmptyElement($xeFormGroup)
40
43
  }
41
44
  return h('div', {
42
45
  ref: refElem,
@@ -53,6 +56,7 @@ export default defineComponent({
53
56
  }
54
57
 
55
58
  const $xeFormGroup = {
59
+ xID,
56
60
  formItem,
57
61
 
58
62
  renderVN