vxe-table 3.22.2 → 3.22.3

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 (160) hide show
  1. package/es/locale/lang/ar-EG.js +7 -0
  2. package/es/locale/lang/de-DE.js +7 -0
  3. package/es/locale/lang/en-US.js +7 -0
  4. package/es/locale/lang/es-ES.js +7 -0
  5. package/es/locale/lang/fr-FR.js +7 -0
  6. package/es/locale/lang/hu-HU.js +7 -0
  7. package/es/locale/lang/hy-AM.js +7 -0
  8. package/es/locale/lang/id-ID.js +7 -0
  9. package/es/locale/lang/it-IT.js +7 -0
  10. package/es/locale/lang/ja-JP.js +7 -0
  11. package/es/locale/lang/ko-KR.js +7 -0
  12. package/es/locale/lang/ms-MY.js +7 -0
  13. package/es/locale/lang/nb-NO.js +7 -0
  14. package/es/locale/lang/pt-BR.js +7 -0
  15. package/es/locale/lang/ru-RU.js +7 -0
  16. package/es/locale/lang/th-TH.js +7 -0
  17. package/es/locale/lang/ug-CN.js +7 -0
  18. package/es/locale/lang/uk-UA.js +7 -0
  19. package/es/locale/lang/uz-UZ.js +7 -0
  20. package/es/locale/lang/vi-VN.js +7 -0
  21. package/es/locale/lang/zh-CHT.js +7 -0
  22. package/es/locale/lang/zh-CN.js +7 -0
  23. package/es/style.css +1 -1
  24. package/es/table/module/export/export-panel.js +384 -335
  25. package/es/table/module/export/mixin.js +106 -28
  26. package/es/table/module/export/util.js +1 -1
  27. package/es/table/src/body.js +1 -1
  28. package/es/table/src/footer.js +1 -1
  29. package/es/table/src/header.js +4 -2
  30. package/es/table/src/table.js +24 -24
  31. package/es/table/src/util.js +1 -0
  32. package/es/ui/index.js +2 -1
  33. package/es/ui/src/log.js +1 -1
  34. package/lib/index.umd.js +202 -79
  35. package/lib/index.umd.min.js +1 -1
  36. package/lib/locale/lang/ar-EG.js +7 -0
  37. package/lib/locale/lang/ar-EG.min.js +1 -1
  38. package/lib/locale/lang/ar-EG.umd.js +7 -0
  39. package/lib/locale/lang/de-DE.js +7 -0
  40. package/lib/locale/lang/de-DE.min.js +1 -1
  41. package/lib/locale/lang/de-DE.umd.js +7 -0
  42. package/lib/locale/lang/en-US.js +7 -0
  43. package/lib/locale/lang/en-US.min.js +1 -1
  44. package/lib/locale/lang/en-US.umd.js +7 -0
  45. package/lib/locale/lang/es-ES.js +7 -0
  46. package/lib/locale/lang/es-ES.min.js +1 -1
  47. package/lib/locale/lang/es-ES.umd.js +7 -0
  48. package/lib/locale/lang/fr-FR.js +7 -0
  49. package/lib/locale/lang/fr-FR.min.js +1 -1
  50. package/lib/locale/lang/fr-FR.umd.js +7 -0
  51. package/lib/locale/lang/hu-HU.js +7 -0
  52. package/lib/locale/lang/hu-HU.min.js +1 -1
  53. package/lib/locale/lang/hu-HU.umd.js +7 -0
  54. package/lib/locale/lang/hy-AM.js +7 -0
  55. package/lib/locale/lang/hy-AM.min.js +1 -1
  56. package/lib/locale/lang/hy-AM.umd.js +7 -0
  57. package/lib/locale/lang/id-ID.js +7 -0
  58. package/lib/locale/lang/id-ID.min.js +1 -1
  59. package/lib/locale/lang/id-ID.umd.js +7 -0
  60. package/lib/locale/lang/it-IT.js +7 -0
  61. package/lib/locale/lang/it-IT.min.js +1 -1
  62. package/lib/locale/lang/it-IT.umd.js +7 -0
  63. package/lib/locale/lang/ja-JP.js +7 -0
  64. package/lib/locale/lang/ja-JP.min.js +1 -1
  65. package/lib/locale/lang/ja-JP.umd.js +7 -0
  66. package/lib/locale/lang/ko-KR.js +7 -0
  67. package/lib/locale/lang/ko-KR.min.js +1 -1
  68. package/lib/locale/lang/ko-KR.umd.js +7 -0
  69. package/lib/locale/lang/ms-MY.js +7 -0
  70. package/lib/locale/lang/ms-MY.min.js +1 -1
  71. package/lib/locale/lang/ms-MY.umd.js +7 -0
  72. package/lib/locale/lang/nb-NO.js +7 -0
  73. package/lib/locale/lang/nb-NO.min.js +1 -1
  74. package/lib/locale/lang/nb-NO.umd.js +7 -0
  75. package/lib/locale/lang/pt-BR.js +7 -0
  76. package/lib/locale/lang/pt-BR.min.js +1 -1
  77. package/lib/locale/lang/pt-BR.umd.js +7 -0
  78. package/lib/locale/lang/ru-RU.js +7 -0
  79. package/lib/locale/lang/ru-RU.min.js +1 -1
  80. package/lib/locale/lang/ru-RU.umd.js +7 -0
  81. package/lib/locale/lang/th-TH.js +7 -0
  82. package/lib/locale/lang/th-TH.min.js +1 -1
  83. package/lib/locale/lang/th-TH.umd.js +7 -0
  84. package/lib/locale/lang/ug-CN.js +7 -0
  85. package/lib/locale/lang/ug-CN.min.js +1 -1
  86. package/lib/locale/lang/ug-CN.umd.js +7 -0
  87. package/lib/locale/lang/uk-UA.js +7 -0
  88. package/lib/locale/lang/uk-UA.min.js +1 -1
  89. package/lib/locale/lang/uk-UA.umd.js +7 -0
  90. package/lib/locale/lang/uz-UZ.js +7 -0
  91. package/lib/locale/lang/uz-UZ.min.js +1 -1
  92. package/lib/locale/lang/uz-UZ.umd.js +7 -0
  93. package/lib/locale/lang/vi-VN.js +7 -0
  94. package/lib/locale/lang/vi-VN.min.js +1 -1
  95. package/lib/locale/lang/vi-VN.umd.js +7 -0
  96. package/lib/locale/lang/zh-CHT.js +7 -0
  97. package/lib/locale/lang/zh-CHT.min.js +1 -1
  98. package/lib/locale/lang/zh-CHT.umd.js +7 -0
  99. package/lib/locale/lang/zh-CN.js +7 -0
  100. package/lib/locale/lang/zh-CN.min.js +1 -1
  101. package/lib/locale/lang/zh-CN.umd.js +7 -0
  102. package/lib/style.css +1 -1
  103. package/lib/table/module/export/export-panel.js +50 -22
  104. package/lib/table/module/export/export-panel.min.js +1 -1
  105. package/lib/table/module/export/mixin.js +106 -28
  106. package/lib/table/module/export/mixin.min.js +1 -1
  107. package/lib/table/module/export/util.js +1 -1
  108. package/lib/table/module/export/util.min.js +1 -1
  109. package/lib/table/src/body.js +1 -1
  110. package/lib/table/src/body.min.js +1 -1
  111. package/lib/table/src/footer.js +1 -1
  112. package/lib/table/src/footer.min.js +1 -1
  113. package/lib/table/src/header.js +4 -2
  114. package/lib/table/src/header.min.js +1 -1
  115. package/lib/table/src/table.js +28 -22
  116. package/lib/table/src/table.min.js +1 -1
  117. package/lib/table/src/util.js +1 -0
  118. package/lib/table/src/util.min.js +1 -1
  119. package/lib/ui/index.js +2 -1
  120. package/lib/ui/index.min.js +1 -1
  121. package/lib/ui/src/log.js +1 -1
  122. package/lib/ui/src/log.min.js +1 -1
  123. package/package.json +2 -2
  124. package/packages/locale/lang/ar-EG.ts +7 -0
  125. package/packages/locale/lang/de-DE.ts +7 -0
  126. package/packages/locale/lang/en-US.ts +7 -0
  127. package/packages/locale/lang/es-ES.ts +7 -0
  128. package/packages/locale/lang/fr-FR.ts +7 -0
  129. package/packages/locale/lang/hu-HU.ts +7 -0
  130. package/packages/locale/lang/hy-AM.ts +7 -0
  131. package/packages/locale/lang/id-ID.ts +7 -0
  132. package/packages/locale/lang/it-IT.ts +7 -0
  133. package/packages/locale/lang/ja-JP.ts +7 -0
  134. package/packages/locale/lang/ko-KR.ts +7 -0
  135. package/packages/locale/lang/ms-MY.ts +7 -0
  136. package/packages/locale/lang/nb-NO.ts +7 -0
  137. package/packages/locale/lang/pt-BR.ts +7 -0
  138. package/packages/locale/lang/ru-RU.ts +7 -0
  139. package/packages/locale/lang/th-TH.ts +7 -0
  140. package/packages/locale/lang/ug-CN.ts +7 -0
  141. package/packages/locale/lang/uk-UA.ts +7 -0
  142. package/packages/locale/lang/uz-UZ.ts +7 -0
  143. package/packages/locale/lang/vi-VN.ts +7 -0
  144. package/packages/locale/lang/zh-CHT.ts +7 -0
  145. package/packages/locale/lang/zh-CN.ts +7 -0
  146. package/packages/table/module/export/export-panel.ts +383 -333
  147. package/packages/table/module/export/mixin.ts +130 -46
  148. package/packages/table/module/export/util.ts +1 -1
  149. package/packages/table/src/body.ts +1 -1
  150. package/packages/table/src/footer.ts +1 -1
  151. package/packages/table/src/header.ts +4 -2
  152. package/packages/table/src/table.ts +24 -24
  153. package/packages/table/src/util.ts +1 -0
  154. package/packages/ui/index.ts +1 -0
  155. /package/es/{iconfont.1784122379007.ttf → iconfont.1784251254538.ttf} +0 -0
  156. /package/es/{iconfont.1784122379007.woff → iconfont.1784251254538.woff} +0 -0
  157. /package/es/{iconfont.1784122379007.woff2 → iconfont.1784251254538.woff2} +0 -0
  158. /package/lib/{iconfont.1784122379007.ttf → iconfont.1784251254538.ttf} +0 -0
  159. /package/lib/{iconfont.1784122379007.woff → iconfont.1784251254538.woff} +0 -0
  160. /package/lib/{iconfont.1784122379007.woff2 → iconfont.1784251254538.woff2} +0 -0
@@ -2,7 +2,7 @@ import XEUtils from 'xe-utils'
2
2
  import { VxeUI } from '../../../ui'
3
3
  import { isColumnInfo, getCellValue, createHandleGetRowId } from '../../src/util'
4
4
  import { parseFile, formatText, eqEmptyValue } from '../../../ui/src/utils'
5
- import { hasClass } from '../../../ui/src/dom'
5
+ import { hasClass, toCssUnit } from '../../../ui/src/dom'
6
6
  import { createHtmlPage, getExportBlobByContent } from './util'
7
7
  import { createComponentLog } from '../../../ui/src/log'
8
8
 
@@ -491,6 +491,10 @@ function hasEllipsis ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, co
491
491
  return isEllipsis
492
492
  }
493
493
 
494
+ function getCustomColKey (conf: VxeTableDefines.ColumnInfo<any> | VxeTablePropTypes.ExportOrPrintColumnOption) {
495
+ return `${conf.field || ''}:${conf.type || ''}`
496
+ }
497
+
494
498
  function toHtml ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
495
499
  const props = $xeTable
496
500
  const reactData = $xeTable as unknown as TableReactData
@@ -500,17 +504,103 @@ function toHtml ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: V
500
504
  const { isAllSelected, isIndeterminate } = reactData
501
505
  const { mergeBodyCellMaps, mergeFooterCellMaps } = internalData
502
506
  const treeOpts = $xeTable.computeTreeOpts
503
- const { print: isPrint, isHeader, isFooter, isColgroup, isMerge, colgroups, original } = opts
507
+ const { print: isPrint, widthMode, isHeader, isFooter, isColgroup, isMerge, colgroups, _columnConfs, original } = opts
508
+ const isAutoWidth = widthMode === 'auto'
509
+ const isScaleWidth = widthMode === 'scale'
510
+ const isDefaultWidth = !isAutoWidth && !isScaleWidth
511
+
512
+ const customWidthMaps: Record<string, number | string> = {}
513
+ if (_columnConfs) {
514
+ _columnConfs.forEach(conf => {
515
+ if (!isColumnInfo(conf)) {
516
+ if ((conf.field || conf.type) && conf.width) {
517
+ customWidthMaps[getCustomColKey(conf)] = conf.width
518
+ }
519
+ }
520
+ })
521
+ }
522
+
523
+ // 计算宽度
524
+ const colWidthMaps: Record<string, number> = {}
525
+ const printWidthMaps: Record<string, number> = {}
526
+ if (isPrint) {
527
+ let tableWidth = 0
528
+ columns.forEach(column => {
529
+ tableWidth += column.renderWidth
530
+ })
531
+ if (colgroups) {
532
+ colgroups.forEach((cols) => {
533
+ cols.forEach((column: any) => {
534
+ if (!column.childNodes || !column.childNodes.length) {
535
+ return
536
+ }
537
+ let childWidth = 0
538
+ let countChild = 0
539
+ XEUtils.eachTree([column], item => {
540
+ if (!item.childNodes || !column.childNodes.length) {
541
+ countChild++
542
+ }
543
+ const ptWidth = printWidthMaps[item.id]
544
+ childWidth += ptWidth || 0
545
+ }, { children: 'childNodes' })
546
+ const colWidth = childWidth - countChild
547
+ colWidthMaps[column.id] = colWidth
548
+ printWidthMaps[column.id] = XEUtils.floor(colWidth / tableWidth * 180, 2)
549
+ })
550
+ })
551
+ }
552
+ columns.forEach(column => {
553
+ const colWidth = column.renderWidth
554
+ if (column.width) {
555
+ colWidthMaps[column.id] = colWidth
556
+ }
557
+ printWidthMaps[column.id] = XEUtils.floor(colWidth / tableWidth * 180, 2)
558
+ })
559
+ }
560
+
561
+ const getHeaderWidthStyle = (column: VxeTableDefines.ColumnInfo) => {
562
+ const cmColKey = getCustomColKey(column)
563
+ const cmWidthMaps = customWidthMaps[cmColKey]
564
+ if (cmWidthMaps) {
565
+ return 'width:' + toCssUnit(cmWidthMaps)
566
+ }
567
+ if (isAutoWidth) {
568
+ return ''
569
+ }
570
+ if (isScaleWidth) {
571
+ return printWidthMaps[column.id] ? ('width:' + printWidthMaps[column.id] + 'mm') : ''
572
+ }
573
+ return colWidthMaps[column.id] ? ('width:' + toCssUnit(colWidthMaps[column.id])) : ''
574
+ }
575
+
576
+ const getCellWidthStyle = (column: VxeTableDefines.ColumnInfo) => {
577
+ const cmColKey = getCustomColKey(column)
578
+ const cmWidthMaps = customWidthMaps[cmColKey]
579
+ if (cmWidthMaps) {
580
+ return 'width:' + toCssUnit(cmWidthMaps)
581
+ }
582
+ if (isAutoWidth || isDefaultWidth) {
583
+ return ''
584
+ }
585
+ if (isScaleWidth) {
586
+ return printWidthMaps[column.id] ? ('width:' + printWidthMaps[column.id] + 'mm') : ''
587
+ }
588
+ return colWidthMaps[column.id] ? ('width:' + toCssUnit(colWidthMaps[column.id])) : ''
589
+ }
590
+
504
591
  const allCls = 'check-all'
505
592
  const clss = [
506
593
  'vxe-table',
507
594
  `border--${toTableBorder(border)}`,
508
595
  isPrint ? 'is--print' : '',
596
+ isAutoWidth ? 'is--auto-width' : '',
597
+ isScaleWidth ? 'is--scale-width' : '',
598
+ isDefaultWidth ? 'is--default-width' : '',
509
599
  isHeader ? 'is--header' : ''
510
600
  ].filter(cls => cls)
511
601
  const tables = [
512
602
  `<table class="${clss.join(' ')}" border="0" cellspacing="0" cellpadding="0">`,
513
- `<colgroup>${columns.map(column => `<col style="width:${column.renderWidth}px">`).join('')}</colgroup>`
603
+ `<colgroup>${columns.map((column) => `<col style="${getHeaderWidthStyle(column)}">`).join('')}</colgroup>`
514
604
  ]
515
605
  if (isHeader) {
516
606
  tables.push('<thead>')
@@ -521,22 +611,13 @@ function toHtml ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: V
521
611
  const headAlign = column.headerAlign || column.align || allHeaderAlign || allAlign
522
612
  const classNames = hasEllipsis($xeTable, column, 'showHeaderOverflow', allColumnHeaderOverflow) ? ['col--ellipsis'] : []
523
613
  const cellTitle = getHeaderTitle($xeTable, opts, column)
524
- let childWidth = 0
525
- let countChild = 0
526
- XEUtils.eachTree([column], item => {
527
- if (!item.childNodes || !column.childNodes.length) {
528
- countChild++
529
- }
530
- childWidth += item.renderWidth
531
- }, { children: 'childNodes' })
532
- const cellWidth = childWidth - countChild
533
- if (headAlign) {
614
+ if (headAlign) {
534
615
  classNames.push(`col--${headAlign}`)
535
616
  }
536
617
  if (column.type === 'checkbox') {
537
- return `<th class="${classNames.join(' ')}" colspan="${column._colSpan}" rowspan="${column._rowSpan}"><div ${isPrint ? '' : `style="width: ${cellWidth}px"`}><input type="checkbox" class="${allCls}" ${isAllSelected ? 'checked' : ''}><span>${cellTitle}</span></div></th>`
618
+ return `<th class="${classNames.join(' ')}" colspan="${column._colSpan}" rowspan="${column._rowSpan}"><div style="${getCellWidthStyle(column)}"><input type="checkbox" class="${allCls}" ${isAllSelected ? 'checked' : ''}><span>${cellTitle}</span></div></th>`
538
619
  }
539
- return `<th class="${classNames.join(' ')}" colspan="${column._colSpan}" rowspan="${column._rowSpan}" title="${cellTitle}"><div ${isPrint ? '' : `style="width: ${cellWidth}px"`}><span>${formatText(cellTitle, true)}</span></div></th>`
620
+ return `<th class="${classNames.join(' ')}" colspan="${column._colSpan}" rowspan="${column._rowSpan}" title="${cellTitle}"><div style="${getCellWidthStyle(column)}"><span>${formatText(cellTitle, true)}</span></div></th>`
540
621
  }).join('')}</tr>`
541
622
  )
542
623
  })
@@ -550,9 +631,9 @@ function toHtml ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: V
550
631
  classNames.push(`col--${headAlign}`)
551
632
  }
552
633
  if (column.type === 'checkbox') {
553
- return `<th class="${classNames.join(' ')}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><input type="checkbox" class="${allCls}" ${isAllSelected ? 'checked' : ''}><span>${cellTitle}</span></div></th>`
634
+ return `<th class="${classNames.join(' ')}"><div style="${getCellWidthStyle(column)}"><input type="checkbox" class="${allCls}" ${isAllSelected ? 'checked' : ''}><span>${cellTitle}</span></div></th>`
554
635
  }
555
- return `<th class="${classNames.join(' ')}" title="${cellTitle}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><span>${formatText(cellTitle, true)}</span></div></th>`
636
+ return `<th class="${classNames.join(' ')}" title="${cellTitle}"><div style="${getCellWidthStyle(column)}"><span>${formatText(cellTitle, true)}</span></div></th>`
556
637
  }).join('')}</tr>`
557
638
  )
558
639
  }
@@ -577,18 +658,18 @@ function toHtml ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: V
577
658
  }
578
659
  classNames.push('vxe-table--tree-node')
579
660
  if (column.type === 'radio') {
580
- return `<td class="${classNames.join(' ')}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell"><input type="radio" name="radio_${id}" ${item._radioDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._radioLabel}</span></div></div></div></td>`
661
+ return `<td class="${classNames.join(' ')}" title="${cellValue}"><div style="${getCellWidthStyle(column)}"><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell"><input type="radio" name="radio_${id}" ${item._radioDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._radioLabel}</span></div></div></div></td>`
581
662
  } else if (column.type === 'checkbox') {
582
- return `<td class="${classNames.join(' ')}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell"><input type="checkbox" ${item._checkboxDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._checkboxLabel}</span></div></div></div></td>`
663
+ return `<td class="${classNames.join(' ')}" title="${cellValue}"><div style="${getCellWidthStyle(column)}"><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell"><input type="checkbox" ${item._checkboxDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._checkboxLabel}</span></div></div></div></td>`
583
664
  }
584
- return `<td class="${classNames.join(' ')}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell">${cellValue}</div></div></div></td>`
665
+ return `<td class="${classNames.join(' ')}" title="${cellValue}"><div style="${getCellWidthStyle(column)}"><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell">${cellValue}</div></div></div></td>`
585
666
  }
586
667
  if (column.type === 'radio') {
587
- return `<td class="${classNames.join(' ')}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><input type="radio" name="radio_${id}" ${item._radioDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._radioLabel}</span></div></td>`
668
+ return `<td class="${classNames.join(' ')}"><div style="${getCellWidthStyle(column)}"><input type="radio" name="radio_${id}" ${item._radioDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._radioLabel}</span></div></td>`
588
669
  } else if (column.type === 'checkbox') {
589
- return `<td class="${classNames.join(' ')}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><input type="checkbox" ${item._checkboxDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._checkboxLabel}</span></div></td>`
670
+ return `<td class="${classNames.join(' ')}"><div style="${getCellWidthStyle(column)}"><input type="checkbox" ${item._checkboxDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._checkboxLabel}</span></div></td>`
590
671
  }
591
- return `<td class="${classNames.join(' ')}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}>${formatText(cellValue, true)}</div></td>`
672
+ return `<td class="${classNames.join(' ')}" title="${cellValue}"><div style="${getCellWidthStyle(column)}">${formatText(cellValue, true)}</div></td>`
592
673
  }).join('') + '</tr>'
593
674
  )
594
675
  })
@@ -623,11 +704,11 @@ function toHtml ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: V
623
704
  classNames.push(`col--${cellAlign}`)
624
705
  }
625
706
  if (column.type === 'radio') {
626
- return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><input type="radio" name="radio_${id}" ${item._radioDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._radioLabel}</span></div></td>`
707
+ return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}"><div style="${getCellWidthStyle(column)}"><input type="radio" name="radio_${id}" ${item._radioDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._radioLabel}</span></div></td>`
627
708
  } else if (column.type === 'checkbox') {
628
- return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}><input type="checkbox" ${item._checkboxDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._checkboxLabel}</span></div></td>`
709
+ return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}"><div style="${getCellWidthStyle(column)}"><input type="checkbox" ${item._checkboxDisabled ? 'disabled ' : ''}${getBooleanValue(cellValue) ? 'checked' : ''}><span>${item._checkboxLabel}</span></div></td>`
629
710
  }
630
- return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}>${formatText(cellValue, true)}</div></td>`
711
+ return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}" title="${cellValue}"><div style="${getCellWidthStyle(column)}">${formatText(cellValue, true)}</div></td>`
631
712
  }).join('') + '</tr>'
632
713
  )
633
714
  })
@@ -646,28 +727,28 @@ function toHtml ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: V
646
727
  const classNames = hasEllipsis($xeTable, column, 'showOverflow', allColumnOverflow) ? ['col--ellipsis'] : []
647
728
  const cellValue = getFooterCellValue($xeTable, opts, row, column)
648
729
  let rowSpan = 1
649
- let colSpan = 1
650
- if (isMerge) {
651
- const _rowIndex = rIndex
652
- const _columnIndex = $xeTable.getVTColumnIndex(column)
653
- const spanRest = mergeFooterCellMaps[`${_rowIndex}:${_columnIndex}`]
654
- if (spanRest) {
655
- const { rowspan, colspan } = spanRest
656
- if (!rowspan || !colspan) {
657
- return ''
658
- }
659
- if (rowspan > 1) {
660
- rowSpan = rowspan
661
- }
662
- if (colspan > 1) {
663
- colSpan = colspan
664
- }
665
- }
730
+ let colSpan = 1
731
+ if (isMerge) {
732
+ const _rowIndex = rIndex
733
+ const _columnIndex = $xeTable.getVTColumnIndex(column)
734
+ const spanRest = mergeFooterCellMaps[`${_rowIndex}:${_columnIndex}`]
735
+ if (spanRest) {
736
+ const { rowspan, colspan } = spanRest
737
+ if (!rowspan || !colspan) {
738
+ return ''
739
+ }
740
+ if (rowspan > 1) {
741
+ rowSpan = rowspan
666
742
  }
743
+ if (colspan > 1) {
744
+ colSpan = colspan
745
+ }
746
+ }
747
+ }
667
748
  if (footAlign) {
668
749
  classNames.push(`col--${footAlign}`)
669
750
  }
670
- return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}" title="${cellValue}"><div ${isPrint ? '' : `style="width: ${column.renderWidth}px"`}>${formatText(cellValue, true)}</div></td>`
751
+ return `<td class="${classNames.join(' ')}" rowspan="${rowSpan}" colspan="${colSpan}" title="${cellValue}"><div style="${getCellWidthStyle(column)}">${formatText(cellValue, true)}</div></td>`
671
752
  }).join('')}</tr>`
672
753
  )
673
754
  })
@@ -677,7 +758,7 @@ function toHtml ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: V
677
758
  // 是否半选状态
678
759
  const script = !isAllSelected && isIndeterminate ? `<script>(function(){var a=document.querySelector(".${allCls}");if(a){a.indeterminate=true}})()</script>` : ''
679
760
  tables.push('</table>', script)
680
- return isPrint ? tables.join('') : createHtmlPage(opts, tables.join(''))
761
+ return isAutoWidth ? tables.join('') : createHtmlPage(opts, tables.join(''))
681
762
  }
682
763
 
683
764
  function toXML ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: any, columns: any[], datas: any[]) {
@@ -1277,6 +1358,9 @@ function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTableP
1277
1358
  if (!typeList.some(item => item.value === type)) {
1278
1359
  exportParams.type = typeList[0].value
1279
1360
  }
1361
+ if (!exportParams.widthMode) {
1362
+ exportParams.widthMode = ''
1363
+ }
1280
1364
  initStore.export = true
1281
1365
  return $xeTable.$nextTick()
1282
1366
  }
@@ -1421,7 +1505,7 @@ export default {
1421
1505
  return isChecked
1422
1506
  }, { children: 'children', mapChildren: 'childNodes', original: true })
1423
1507
  }
1424
- const handleOptions: VxeTablePropTypes.ExportHandleOptions = Object.assign({ } as { data: any[], colgroups: any[], columns: any[] }, opts, { filename: '', sheetName: '' })
1508
+ const handleOptions: VxeTablePropTypes.ExportHandleOptions = Object.assign({ } as { data: any[], colgroups: any[], columns: any[] }, opts, { filename: '', sheetName: '', _columnConfs: columns })
1425
1509
  // 如果设置源数据,则默认导出设置了字段的列
1426
1510
  if (!isCustomCol && !columnFilterMethod) {
1427
1511
  columnFilterMethod = ({ column }) => {
@@ -1,7 +1,7 @@
1
1
  import type { VxeTablePropTypes } from '../../../../types'
2
2
 
3
3
  // 默认导出或打印的 HTML 样式
4
- const defaultHtmlStyle = 'body{margin:0;padding: 0 1px;color:#333333;font-size:14px;font-family:"Microsoft YaHei",微软雅黑,"MicrosoftJhengHei",华文细黑,STHeiti,MingLiu}body *{-webkit-box-sizing:border-box;box-sizing:border-box}.vxe-table{border-collapse:collapse;text-align:left;border-spacing:0}.vxe-table:not(.is--print){table-layout:fixed}.vxe-table,.vxe-table th,.vxe-table td,.vxe-table td{border-color:#D0D0D0;border-style:solid;border-width:0}.vxe-table.is--print{width:100%}.border--default,.border--full,.border--outer{border-top-width:1px}.border--default,.border--full,.border--outer{border-left-width:1px}.border--outer,.border--default th,.border--default td,.border--full th,.border--full td,.border--outer th,.border--inner th,.border--inner td{border-bottom-width:1px}.border--default,.border--outer,.border--full th,.border--full td{border-right-width:1px}.border--default th,.border--full th,.border--outer th{background-color:#f8f8f9}.vxe-table td>div,.vxe-table th>div{padding:.5em .4em}.col--center{text-align:center}.col--right{text-align:right}.vxe-table:not(.is--print) .col--ellipsis>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all}.vxe-table--tree-node{text-align:left}.vxe-table--tree-node-wrapper{position:relative}.vxe-table--tree-icon-wrapper{position:absolute;top:50%;width:1em;height:1em;text-align:center;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.vxe-table--tree-unfold-icon,.vxe-table--tree-fold-icon{position:absolute;width:0;height:0;border-style:solid;border-width:.5em;border-right-color:transparent;border-bottom-color:transparent}.vxe-table--tree-unfold-icon{left:.3em;top:0;border-left-color:#939599;border-top-color:transparent}.vxe-table--tree-fold-icon{left:0;top:.3em;border-left-color:transparent;border-top-color:#939599}.vxe-table--tree-cell{display:block;padding-left:1.5em}.vxe-table input[type="checkbox"]{margin:0}.vxe-table input[type="checkbox"],.vxe-table input[type="radio"],.vxe-table input[type="checkbox"]+span,.vxe-table input[type="radio"]+span{vertical-align:middle;padding-left:0.4em}'
4
+ const defaultHtmlStyle = 'body{padding:0;color:rgba(0,0,0,0.7);font-family:"Microsoft YaHei",微软雅黑,"MicrosoftJhengHei",华文细黑,STHeiti,MingLiu;}body *{-webkit-box-sizing:border-box;box-sizing:border-box;}.vxe-table{border-collapse:collapse;text-align:left;border-spacing:0;}.vxe-table.is--default-width,.vxe-table.is--auto-width{width:100%;}.vxe-table.is--scale-width{table-layout:fixed;}.vxe-table,.vxe-table th,.vxe-table td,.vxe-table td{word-break:break-all;border-color:#D0D0D0;border-style:solid;border-width:0;}.border--default,.border--full,.border--outer{border-top-width:1px;}.border--default,.border--full,.border--outer{border-left-width:1px}.border--outer,.border--default th,.border--default td,.border--full th,.border--full td,.border--outer th,.border--inner th,.border--inner td{border-bottom-width:1px;}.border--default,.border--outer,.border--full th,.border--full td{border-right-width:1px;}.border--default th,.border--full th,.border--outer th{background-color:#f8f8f9;}.vxe-table td>div,.vxe-table th>div{padding:0.5em 0.4em;}.col--center{text-align:center;}.col--right{text-align:right;}.vxe-table .col--ellipsis>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all;}.vxe-table--tree-node{text-align:left;}.vxe-table--tree-node-wrapper{position:relative;}.vxe-table--tree-icon-wrapper{position:absolute;top:50%;width:1em;height:1em;text-align:center;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;}.vxe-table--tree-unfold-icon,.vxe-table--tree-fold-icon{position:absolute;width:0;height:0;border-style:solid;border-width:0.5em;border-right-color:transparent;border-bottom-color:transparent;}.vxe-table--tree-unfold-icon{left:.3em;top:0;border-left-color:#939599;border-top-color:transparent;}.vxe-table--tree-fold-icon{left:0;top:.3em;border-left-color:transparent;border-top-color:#939599;}.vxe-table--tree-cell{display:block;padding-left:1.5em;}.vxe-table input[type="checkbox"]{margin:0;}.vxe-table input[type="checkbox"],.vxe-table input[type="radio"],.vxe-table input[type="checkbox"]+span,.vxe-table input[type="radio"]+span{vertical-align:middle;padding-left:0.4em}'
5
5
 
6
6
  export function getExportBlobByContent (content: string, options: { type: string }) {
7
7
  return new Blob([content], { type: `text/${options.type};charset=utf-8;` })
@@ -148,7 +148,7 @@ function renderTdColumn (
148
148
  const cellOverflow = XEUtils.eqNull(showOverflow) ? allShowOverflow : showOverflow
149
149
  const showEllipsis = cellOverflow === 'ellipsis'
150
150
  const showTitle = cellOverflow === 'title'
151
- const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
151
+ const showTooltip = cellOverflow === true ? tooltipOpts.mode === 'tooltip' : cellOverflow === 'tooltip'
152
152
  const hasEllipsis = isAllOverflow || showTitle || showTooltip || showEllipsis
153
153
  const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
154
154
  const isCsHeight = !!customCellHeight
@@ -49,7 +49,7 @@ function renderRows (h: CreateElement, _vm: any, isOptimizeMode: boolean, tableC
49
49
  const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign
50
50
  const showEllipsis = footOverflow === 'ellipsis'
51
51
  const showTitle = footOverflow === 'title'
52
- const showTooltip = footOverflow === true || footOverflow === 'tooltip'
52
+ const showTooltip = footOverflow === true ? footerTooltipOpts.mode === 'tooltip' : footOverflow === 'tooltip'
53
53
  const hasEllipsis = showTitle || showTooltip || showEllipsis
54
54
  const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
55
55
  const attrs: any = { colid }
@@ -29,6 +29,7 @@ function renderRows (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMod
29
29
  const virtualXOpts = $xeTable.computeVirtualXOpts
30
30
  const columnOpts = $xeTable.computeColumnOpts
31
31
  const columnDragOpts = $xeTable.computeColumnDragOpts
32
+ const headerTooltipOpts = $xeTable.computeHeaderTooltipOpts
32
33
  const cellOpts = $xeTable.computeCellOpts
33
34
  const defaultRowHeight = $xeTable.computeDefaultRowHeight
34
35
  const headerCellOpts = $xeTable.computeHeaderCellOpts
@@ -50,7 +51,7 @@ function renderRows (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMod
50
51
  const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign
51
52
  const showEllipsis = headOverflow === 'ellipsis'
52
53
  const showTitle = headOverflow === 'title'
53
- const showTooltip = headOverflow === true || headOverflow === 'tooltip'
54
+ const showTooltip = headOverflow === true ? headerTooltipOpts.mode === 'tooltip' : headOverflow === 'tooltip'
54
55
  const hasEllipsis = showTitle || showTooltip || showEllipsis
55
56
  let hasFilter = false
56
57
  let firstFilterOption: VxeColumnPropTypes.FilterItem | null = null
@@ -228,6 +229,7 @@ function renderFilterRows (h: CreateElement, _vm: any, isOptimizeMode: boolean,
228
229
  const { showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign } = tableProps
229
230
  const { currentColumn, overflowX } = tableReactData
230
231
  const { fullColumnIdData } = tableInternalData
232
+ const headerTooltipOpts = $xeTable.computeHeaderTooltipOpts
231
233
  const cellOpts = $xeTable.computeCellOpts
232
234
  const defaultRowHeight = $xeTable.computeDefaultRowHeight
233
235
  const headerCellOpts = $xeTable.computeHeaderCellOpts
@@ -250,7 +252,7 @@ function renderFilterRows (h: CreateElement, _vm: any, isOptimizeMode: boolean,
250
252
  const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign
251
253
  const showEllipsis = headOverflow === 'ellipsis'
252
254
  const showTitle = headOverflow === 'title'
253
- const showTooltip = headOverflow === true || headOverflow === 'tooltip'
255
+ const showTooltip = headOverflow === true ? headerTooltipOpts.mode === 'tooltip' : headOverflow === 'tooltip'
254
256
  const hasEllipsis = showTitle || showTooltip || showEllipsis
255
257
  let hasFilter = false
256
258
  let firstFilterOption: VxeTableDefines.FilterOption | null = null
@@ -2070,35 +2070,35 @@ export default {
2070
2070
  const VxeUILoadingComponent = VxeUI.getComponent('VxeLoading')
2071
2071
  const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
2072
2072
 
2073
+ const { showOverflow, showHeaderOverflow, showFooterOverflow } = props
2074
+ const tooltipOpts = $xeTable.computeTooltipOpts
2075
+ const headerTooltipOpts = $xeTable.computeHeaderTooltipOpts
2076
+ const footerTooltipOpts = $xeTable.computeFooterTooltipOpts
2073
2077
  if (props.loading) {
2074
2078
  if (!VxeUILoadingComponent && !this.$scopedSlots.loading) {
2075
- errLog('vxe.error.errProp', ['loading=true', 'loading=false | <template #loading>...</template>'])
2076
2079
  errLog('vxe.error.reqComp', ['vxe-loading'])
2080
+ errLog('vxe.error.errProp', ['loading=true', 'loading=false | <template #loading>...</template>'])
2077
2081
  }
2078
2082
  }
2079
- if ((props.showOverflow === true || props.showOverflow === 'tooltip') ||
2080
- (props.showHeaderOverflow === true || props.showHeaderOverflow === 'tooltip') ||
2081
- (props.showFooterOverflow === true || props.showFooterOverflow === 'tooltip')) {
2082
- if (!VxeUITooltipComponent) {
2083
- if (props.showOverflow === true) {
2084
- errLog('vxe.error.errProp', ['show-overflow=true', 'show-overflow=title'])
2085
- }
2086
- if (props.showOverflow === 'tooltip') {
2087
- errLog('vxe.error.errProp', ['show-overflow=tooltip', 'show-overflow=title'])
2088
- }
2089
- if (props.showHeaderOverflow === true) {
2090
- errLog('vxe.error.errProp', ['show-header-overflow=true', 'show-header-overflow=title'])
2091
- }
2092
- if (props.showHeaderOverflow === 'tooltip') {
2093
- errLog('vxe.error.errProp', ['show-header-overflow=tooltip', 'show-header-overflow=title'])
2094
- }
2095
- if (props.showFooterOverflow === true) {
2096
- errLog('vxe.error.errProp', ['show-footer-overflow=true', 'show-footer-overflow=title'])
2097
- }
2098
- if (props.showFooterOverflow === 'tooltip') {
2099
- errLog('vxe.error.errProp', ['show-footer-overflow=tooltip', 'show-footer-overflow=title'])
2100
- }
2101
- errLog('vxe.error.reqComp', ['vxe-tooltip'])
2083
+ if (!VxeUITooltipComponent) {
2084
+ errLog('vxe.error.reqComp', ['vxe-tooltip'])
2085
+ if (showOverflow === 'tooltip') {
2086
+ errLog('vxe.error.errProp', ['show-overflow=' + showOverflow, 'show-overflow=false,title,ellipsis'])
2087
+ }
2088
+ if (showOverflow === true && tooltipOpts.mode === 'tooltip') {
2089
+ errLog('vxe.error.notSupportProp', ['show-overflow=' + showOverflow, 'tooltip-config.mode=tooltip', 'tooltip-config.mode=title,ellipsis'])
2090
+ }
2091
+ if (showHeaderOverflow === 'tooltip') {
2092
+ errLog('vxe.error.errProp', ['show-header-overflow=' + showHeaderOverflow, 'show-header-overflow=false,title,ellipsis'])
2093
+ }
2094
+ if (showHeaderOverflow === true && headerTooltipOpts.mode === 'tooltip') {
2095
+ errLog('vxe.error.notSupportProp', ['show-header-overflow=' + showHeaderOverflow, 'header-tooltip-config.mode=tooltip', 'header-tooltip-config.mode=title,ellipsis'])
2096
+ }
2097
+ if (showFooterOverflow === 'tooltip') {
2098
+ errLog('vxe.error.errProp', ['show-footer-overflow=' + showFooterOverflow, 'show-footer-overflow=false,title,ellipsis'])
2099
+ }
2100
+ if (showFooterOverflow === true && footerTooltipOpts.mode === 'tooltip') {
2101
+ errLog('vxe.error.notSupportProp', ['show-footer-overflow=' + showFooterOverflow, 'footer-tooltip-config.mode=tooltip', 'footer-tooltip-config.mode=title,ellipsis'])
2102
2102
  }
2103
2103
  }
2104
2104
 
@@ -390,6 +390,7 @@ export function createReactData (): TableReactData {
390
390
  mergeFootFlag: 1,
391
391
 
392
392
  rowHeightStore: {
393
+ xlarge: 54,
393
394
  large: 52,
394
395
  default: 48,
395
396
  medium: 44,
@@ -73,6 +73,7 @@ VxeUI.setConfig({
73
73
  strict: true
74
74
  },
75
75
  tooltipConfig: {
76
+ mode: 'tooltip',
76
77
  enterable: true,
77
78
  defaultPlacement: 'top'
78
79
  },