vxe-table 3.8.10 → 3.8.12

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 (65) hide show
  1. package/lib/export/src/mixin.js +1 -1
  2. package/lib/export/src/mixin.min.js +1 -1
  3. package/lib/filter/src/panel.js +2 -2
  4. package/lib/filter/src/panel.min.js +1 -1
  5. package/lib/form/src/form-config-item.js +5 -1
  6. package/lib/form/src/form-config-item.min.js +1 -1
  7. package/lib/form/src/form-item.js +5 -1
  8. package/lib/form/src/form-item.min.js +1 -1
  9. package/lib/form/src/form.js +16 -0
  10. package/lib/form/src/form.min.js +1 -1
  11. package/lib/form/src/render.js +4 -0
  12. package/lib/form/src/render.min.js +1 -1
  13. package/lib/grid/src/grid.js +3 -3
  14. package/lib/grid/src/grid.min.js +1 -1
  15. package/lib/icon/style/style.css +1 -1
  16. package/lib/icon/style/style.min.css +1 -1
  17. package/lib/index.css +1 -1
  18. package/lib/index.umd.js +437 -312
  19. package/lib/index.umd.min.js +1 -1
  20. package/lib/style.css +1 -1
  21. package/lib/style.min.css +1 -1
  22. package/lib/table/src/cell.js +51 -11
  23. package/lib/table/src/cell.min.js +1 -1
  24. package/lib/table/src/column.js +2 -0
  25. package/lib/table/src/column.min.js +1 -1
  26. package/lib/table/src/columnInfo.js +2 -0
  27. package/lib/table/src/columnInfo.min.js +1 -1
  28. package/lib/table/src/methods.js +335 -287
  29. package/lib/table/src/methods.min.js +1 -1
  30. package/lib/table/src/table.js +12 -3
  31. package/lib/table/src/table.min.js +1 -1
  32. package/lib/table/style/style.css +11 -4
  33. package/lib/table/style/style.min.css +1 -1
  34. package/lib/tools/dom.js +1 -1
  35. package/lib/tools/dom.min.js +1 -1
  36. package/lib/tools/log.js +1 -1
  37. package/lib/tools/log.min.js +1 -1
  38. package/lib/v-x-e-table/index.js +1 -1
  39. package/lib/v-x-e-table/index.min.js +1 -1
  40. package/lib/v-x-e-table/src/conf.js +1 -1
  41. package/lib/v-x-e-table/src/conf.min.js +1 -1
  42. package/lib/vxe-table/style/style.css +11 -4
  43. package/lib/vxe-table/style/style.min.css +1 -1
  44. package/package.json +1 -1
  45. package/packages/export/src/mixin.js +1 -0
  46. package/packages/filter/src/panel.js +2 -2
  47. package/packages/form/src/form-config-item.js +3 -3
  48. package/packages/form/src/form-item.js +3 -3
  49. package/packages/form/src/form.js +14 -0
  50. package/packages/form/src/render.js +2 -2
  51. package/packages/grid/src/grid.js +3 -3
  52. package/packages/table/src/cell.js +51 -10
  53. package/packages/table/src/column.js +2 -0
  54. package/packages/table/src/columnInfo.js +2 -0
  55. package/packages/table/src/methods.js +54 -10
  56. package/packages/table/src/table.js +10 -2
  57. package/packages/tools/dom.js +1 -1
  58. package/packages/v-x-e-table/src/conf.js +1 -1
  59. package/styles/table.scss +21 -7
  60. /package/lib/icon/style/{iconfont.1720403140187.ttf → iconfont.1721008774130.ttf} +0 -0
  61. /package/lib/icon/style/{iconfont.1720403140187.woff → iconfont.1721008774130.woff} +0 -0
  62. /package/lib/icon/style/{iconfont.1720403140187.woff2 → iconfont.1721008774130.woff2} +0 -0
  63. /package/lib/{iconfont.1720403140187.ttf → iconfont.1721008774130.ttf} +0 -0
  64. /package/lib/{iconfont.1720403140187.woff → iconfont.1721008774130.woff} +0 -0
  65. /package/lib/{iconfont.1720403140187.woff2 → iconfont.1721008774130.woff2} +0 -0
@@ -2005,6 +2005,7 @@ const Methods = {
2005
2005
  const scaleList = []
2006
2006
  const scaleMinList = []
2007
2007
  const autoList = []
2008
+ const remainList = []
2008
2009
  this.tableFullColumn.forEach(column => {
2009
2010
  if (defaultWidth && !column.width) {
2010
2011
  column.width = defaultWidth
@@ -2015,6 +2016,8 @@ const Methods = {
2015
2016
  if (column.visible) {
2016
2017
  if (column.resizeWidth) {
2017
2018
  resizeList.push(column)
2019
+ } else if (column.width === 'auto') {
2020
+ autoList.push(column)
2018
2021
  } else if (DomTools.isPx(column.width)) {
2019
2022
  pxList.push(column)
2020
2023
  } else if (DomTools.isScale(column.width)) {
@@ -2024,11 +2027,11 @@ const Methods = {
2024
2027
  } else if (DomTools.isScale(column.minWidth)) {
2025
2028
  scaleMinList.push(column)
2026
2029
  } else {
2027
- autoList.push(column)
2030
+ remainList.push(column)
2028
2031
  }
2029
2032
  }
2030
2033
  })
2031
- Object.assign(this.columnStore, { resizeList, pxList, pxMinList, scaleList, scaleMinList, autoList })
2034
+ Object.assign(this.columnStore, { resizeList, pxList, pxMinList, scaleList, scaleMinList, autoList, remainList })
2032
2035
  },
2033
2036
  /**
2034
2037
  * 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
@@ -2069,6 +2072,7 @@ const Methods = {
2069
2072
  const headerElem = tableHeader ? tableHeader.$el : null
2070
2073
  const footerElem = tableFooter ? tableFooter.$el : null
2071
2074
  if (bodyElem) {
2075
+ this.calcCellWidth()
2072
2076
  this.autoCellWidth(headerElem, bodyElem, footerElem)
2073
2077
  if (refull === true) {
2074
2078
  // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
@@ -2080,6 +2084,38 @@ const Methods = {
2080
2084
  }
2081
2085
  return this.computeScrollLoad()
2082
2086
  },
2087
+ calcCellWidth () {
2088
+ const { autoWidthColumnList, tableData } = this
2089
+ if (!tableData.length || !autoWidthColumnList.length) {
2090
+ this.isCalcColumn = false
2091
+ return this.$nextTick()
2092
+ }
2093
+ this.isCalcColumn = true
2094
+ return this.$nextTick().then(() => {
2095
+ const el = this.$el
2096
+ if (el) {
2097
+ autoWidthColumnList.forEach(column => {
2098
+ const cellElList = el.querySelectorAll(`.vxe-body--column.${column.id}>.vxe-cell`)
2099
+ const firstCellEl = cellElList[0]
2100
+ let paddingSize = 0
2101
+ if (firstCellEl) {
2102
+ const cellStyle = getComputedStyle(firstCellEl)
2103
+ paddingSize = Math.floor(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight)) + 2
2104
+ }
2105
+ let colWidth = column.renderAutoWidth - paddingSize + 2
2106
+ XEUtils.arrayEach(cellElList, (cellEl) => {
2107
+ const labelEl = cellEl.firstChild
2108
+ if (labelEl) {
2109
+ colWidth = Math.max(colWidth, labelEl.offsetWidth)
2110
+ }
2111
+ })
2112
+ column.renderAutoWidth = colWidth + paddingSize
2113
+ })
2114
+ this.analyColumnWidth()
2115
+ }
2116
+ this.isCalcColumn = false
2117
+ })
2118
+ },
2083
2119
  /**
2084
2120
  * 列宽算法
2085
2121
  * 支持 px、%、固定 混合分配
@@ -2097,7 +2133,7 @@ const Methods = {
2097
2133
  let remainWidth = bodyWidth
2098
2134
  let meanWidth = remainWidth / 100
2099
2135
  const { fit, columnStore } = this
2100
- const { resizeList, pxMinList, pxList, scaleList, scaleMinList, autoList } = columnStore
2136
+ const { resizeList, pxMinList, pxList, scaleList, scaleMinList, autoList, remainList } = columnStore
2101
2137
  // 最小宽
2102
2138
  pxMinList.forEach(column => {
2103
2139
  const minWidth = parseInt(column.minWidth)
@@ -2122,6 +2158,12 @@ const Methods = {
2122
2158
  tableWidth += width
2123
2159
  column.renderWidth = width
2124
2160
  })
2161
+ // 自适应宽
2162
+ autoList.forEach((column) => {
2163
+ const width = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
2164
+ tableWidth += width
2165
+ column.renderWidth = width
2166
+ })
2125
2167
  // 调整了列宽
2126
2168
  resizeList.forEach(column => {
2127
2169
  const width = parseInt(column.resizeWidth)
@@ -2129,7 +2171,7 @@ const Methods = {
2129
2171
  column.renderWidth = width
2130
2172
  })
2131
2173
  remainWidth -= tableWidth
2132
- meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoList.length)) : 0
2174
+ meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + remainList.length)) : 0
2133
2175
  if (fit) {
2134
2176
  if (remainWidth > 0) {
2135
2177
  scaleMinList.concat(pxMinList).forEach(column => {
@@ -2140,8 +2182,8 @@ const Methods = {
2140
2182
  } else {
2141
2183
  meanWidth = minCellWidth
2142
2184
  }
2143
- // 自适应
2144
- autoList.forEach(column => {
2185
+ // 剩余均分
2186
+ remainList.forEach(column => {
2145
2187
  const width = Math.max(meanWidth, minCellWidth)
2146
2188
  column.renderWidth = width
2147
2189
  tableWidth += width
@@ -2151,7 +2193,7 @@ const Methods = {
2151
2193
  * 偏移量算法
2152
2194
  * 如果所有列足够放的情况下,从最后动态列开始分配
2153
2195
  */
2154
- const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoList)
2196
+ const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(remainList)
2155
2197
  let dynamicSize = dynamicList.length - 1
2156
2198
  if (dynamicSize > 0) {
2157
2199
  let odiffer = bodyWidth - tableWidth
@@ -2978,7 +3020,7 @@ const Methods = {
2978
3020
  tooltipStore.row = null
2979
3021
  tooltipStore.column = column
2980
3022
  tooltipStore.visible = true
2981
- // tooltipStore.currOpts = { content: null }
3023
+ tooltipStore.currOpts = iconParams
2982
3024
  this.$nextTick(() => {
2983
3025
  const $tooltip = $refs.tooltip
2984
3026
  if ($tooltip) {
@@ -3064,7 +3106,8 @@ const Methods = {
3064
3106
  Object.assign(tooltipStore, {
3065
3107
  row,
3066
3108
  column,
3067
- visible: true
3109
+ visible: true,
3110
+ currOpts: {}
3068
3111
  })
3069
3112
  this.$nextTick(() => {
3070
3113
  const $tooltip = $refs.tooltip
@@ -3095,7 +3138,8 @@ const Methods = {
3095
3138
  row: null,
3096
3139
  column: null,
3097
3140
  content: null,
3098
- visible: false
3141
+ visible: false,
3142
+ currOpts: {}
3099
3143
  })
3100
3144
  if (tooltip) {
3101
3145
  tooltip.close()
@@ -273,6 +273,7 @@ export default {
273
273
  data () {
274
274
  return {
275
275
  tId: `${XEUtils.uniqueId()}`,
276
+ isCalcColumn: false,
276
277
  // 低性能的静态列
277
278
  staticColumns: [],
278
279
  // 渲染的列分组
@@ -432,7 +433,8 @@ export default {
432
433
  tooltipStore: {
433
434
  row: null,
434
435
  column: null,
435
- visible: false
436
+ visible: false,
437
+ currOpts: {}
436
438
  },
437
439
  // 存放数据校验相关信息
438
440
  validStore: {
@@ -614,6 +616,10 @@ export default {
614
616
  customOpts () {
615
617
  return Object.assign({}, GlobalConfig.table.customConfig, this.customConfig)
616
618
  },
619
+ autoWidthColumnList () {
620
+ const { visibleColumn } = this
621
+ return visibleColumn.filter(column => column.width === 'auto')
622
+ },
617
623
  fixedColumnSize () {
618
624
  const { collectColumn } = this
619
625
  let fixedSize = 0
@@ -1021,6 +1027,7 @@ export default {
1021
1027
  _e,
1022
1028
  $scopedSlots,
1023
1029
  tId,
1030
+ isCalcColumn,
1024
1031
  tableData,
1025
1032
  tableColumn,
1026
1033
  tableGroupColumn,
@@ -1074,6 +1081,7 @@ export default {
1074
1081
  'row--highlight': rowOpts.isHover || highlightHoverRow,
1075
1082
  'column--highlight': columnOpts.isHover || highlightHoverColumn,
1076
1083
  'checkbox--range': checkboxOpts.range,
1084
+ 'column--calc': isCalcColumn,
1077
1085
  'is--header': showHeader,
1078
1086
  'is--footer': showFooter,
1079
1087
  'is--group': isGroup,
@@ -1254,7 +1262,7 @@ export default {
1254
1262
  */
1255
1263
  hasTip ? h('vxe-tooltip', {
1256
1264
  ref: 'tooltip',
1257
- props: this.tipConfig
1265
+ props: Object.assign({}, this.tipConfig, this.tooltipStore.currOpts)
1258
1266
  }) : _e(),
1259
1267
  /**
1260
1268
  * 校验提示
@@ -159,7 +159,7 @@ export const DomTools = {
159
159
  const val = $xetable[key]
160
160
  let num = 0
161
161
  if (val) {
162
- if (val === 'auto') {
162
+ if (val === '100%' || val === 'auto') {
163
163
  num = $xetable.parentHeight
164
164
  } else {
165
165
  const excludeHeight = $xetable.getExcludeHeight()
@@ -219,7 +219,7 @@ export default {
219
219
  MODAL_CLOSE: iconPrefix + 'close',
220
220
  MODAL_INFO: iconPrefix + 'info-circle-fill',
221
221
  MODAL_SUCCESS: iconPrefix + 'success-circle-fill',
222
- MODAL_WARNING: iconPrefix + 'warnion-circle-fill',
222
+ MODAL_WARNING: iconPrefix + 'warning-circle-fill',
223
223
  MODAL_ERROR: iconPrefix + 'error-circle-fill',
224
224
  MODAL_QUESTION: iconPrefix + 'question-circle-fill',
225
225
  MODAL_LOADING: iconPrefix + 'spinner roll',
package/styles/table.scss CHANGED
@@ -315,6 +315,19 @@
315
315
  }
316
316
  }
317
317
 
318
+ /*列宽*/
319
+ .vxe-table {
320
+ &.column--calc {
321
+ .vxe-header--column,
322
+ .vxe-body--column {
323
+ .vxe-cell {
324
+ word-break: break-all;
325
+ white-space: nowrap;
326
+ }
327
+ }
328
+ }
329
+ }
330
+
318
331
  /*header*/
319
332
  .vxe-table {
320
333
  .vxe-table--header-wrapper {
@@ -611,12 +624,6 @@
611
624
  }
612
625
  }
613
626
  }
614
- &.checkbox--range,
615
- &.cell--selected {
616
- .vxe-body--column {
617
- user-select: none;
618
- }
619
- }
620
627
  &.cell--area {
621
628
  .vxe-table--body-wrapper,
622
629
  .vxe-body--column {
@@ -624,10 +631,17 @@
624
631
  }
625
632
  }
626
633
  &.drag--range {
627
- .vxe-cell--checkbox {
634
+ .vxe-body--column {
628
635
  user-select: none;
629
636
  }
630
637
  }
638
+ &.checkbox--range {
639
+ .vxe-body--column {
640
+ &.col--checkbox {
641
+ user-select: none;
642
+ }
643
+ }
644
+ }
631
645
  .vxe-header--column,
632
646
  .vxe-body--column,
633
647
  .vxe-footer--column {