vxe-table 4.7.63 → 4.7.64

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");const log=_core.VxeUI["log"],version="table v4.7.63",warnLog=exports.warnLog=log.create("warn",version),errLog=exports.errLog=log.create("error",version);
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");const log=_core.VxeUI["log"],version="table v4.7.64",warnLog=exports.warnLog=log.create("warn",version),errLog=exports.errLog=log.create("error",version);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-table",
3
- "version": "4.7.63",
3
+ "version": "4.7.64",
4
4
  "description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -28,7 +28,7 @@
28
28
  "style": "lib/style.css",
29
29
  "typings": "types/index.d.ts",
30
30
  "dependencies": {
31
- "vxe-pc-ui": "^4.0.92"
31
+ "vxe-pc-ui": "^4.0.93"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/resize-observer-browser": "^0.1.11",
@@ -154,6 +154,7 @@ export default defineComponent({
154
154
  resizeList: [],
155
155
  pxList: [],
156
156
  pxMinList: [],
157
+ autoMinList: [],
157
158
  scaleList: [],
158
159
  scaleMinList: [],
159
160
  autoList: [],
@@ -552,7 +553,8 @@ export default defineComponent({
552
553
 
553
554
  const computeAutoWidthColumnList = computed(() => {
554
555
  const { visibleColumn } = internalData
555
- return visibleColumn.filter(column => column.width === 'auto')
556
+ const { tableColumn } = reactData
557
+ return tableColumn.length || visibleColumn.length ? visibleColumn.filter(column => column.width === 'auto' || column.minWidth === 'auto') : []
556
558
  })
557
559
 
558
560
  const computeFixedColumnSize = computed(() => {
@@ -1123,11 +1125,11 @@ export default defineComponent({
1123
1125
  const cellStyle = getComputedStyle(firstCellEl)
1124
1126
  paddingSize = Math.floor(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight)) + 2
1125
1127
  }
1126
- let colWidth = column.renderAutoWidth - paddingSize + 2
1128
+ let colWidth = column.renderAutoWidth - paddingSize
1127
1129
  XEUtils.arrayEach(cellElList, (cellEl) => {
1128
1130
  const labelEl = cellEl.firstChild as HTMLElement
1129
1131
  if (labelEl) {
1130
- colWidth = Math.max(colWidth, labelEl.offsetWidth)
1132
+ colWidth = Math.max(colWidth, Math.ceil(labelEl.offsetWidth) + 4)
1131
1133
  }
1132
1134
  })
1133
1135
  column.renderAutoWidth = colWidth + paddingSize
@@ -1161,13 +1163,19 @@ export default defineComponent({
1161
1163
  let meanWidth = remainWidth / 100
1162
1164
  const { fit } = props
1163
1165
  const { columnStore } = reactData
1164
- const { resizeList, pxMinList, pxList, scaleList, scaleMinList, autoList, remainList } = columnStore
1166
+ const { resizeList, pxMinList, autoMinList, pxList, scaleList, scaleMinList, autoList, remainList } = columnStore
1165
1167
  // 最小宽
1166
1168
  pxMinList.forEach((column) => {
1167
1169
  const minWidth = XEUtils.toInteger(column.minWidth)
1168
1170
  tableWidth += minWidth
1169
1171
  column.renderWidth = minWidth
1170
1172
  })
1173
+ // 最小自适应
1174
+ autoMinList.forEach((column) => {
1175
+ const scaleWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
1176
+ tableWidth += scaleWidth
1177
+ column.renderWidth = scaleWidth
1178
+ })
1171
1179
  // 最小百分比
1172
1180
  scaleMinList.forEach((column) => {
1173
1181
  const scaleWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth)
@@ -1199,10 +1207,10 @@ export default defineComponent({
1199
1207
  column.renderWidth = width
1200
1208
  })
1201
1209
  remainWidth -= tableWidth
1202
- meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + remainList.length)) : 0
1210
+ meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0
1203
1211
  if (fit) {
1204
1212
  if (remainWidth > 0) {
1205
- scaleMinList.concat(pxMinList).forEach((column) => {
1213
+ scaleMinList.concat(pxMinList).concat(autoMinList).forEach((column) => {
1206
1214
  tableWidth += meanWidth
1207
1215
  column.renderWidth += meanWidth
1208
1216
  })
@@ -1221,7 +1229,7 @@ export default defineComponent({
1221
1229
  * 偏移量算法
1222
1230
  * 如果所有列足够放的情况下,从最后动态列开始分配
1223
1231
  */
1224
- const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(remainList)
1232
+ const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList)
1225
1233
  let dynamicSize = dynamicList.length - 1
1226
1234
  if (dynamicSize > 0) {
1227
1235
  let odiffer = bodyWidth - tableWidth
@@ -5484,6 +5492,7 @@ export default defineComponent({
5484
5492
  const resizeList: VxeTableDefines.ColumnInfo[] = []
5485
5493
  const pxList: VxeTableDefines.ColumnInfo[] = []
5486
5494
  const pxMinList: VxeTableDefines.ColumnInfo[] = []
5495
+ const autoMinList: VxeTableDefines.ColumnInfo[] = []
5487
5496
  const scaleList: VxeTableDefines.ColumnInfo[] = []
5488
5497
  const scaleMinList: VxeTableDefines.ColumnInfo[] = []
5489
5498
  const autoList: VxeTableDefines.ColumnInfo[] = []
@@ -5506,6 +5515,8 @@ export default defineComponent({
5506
5515
  scaleList.push(column)
5507
5516
  } else if (isPx(column.minWidth)) {
5508
5517
  pxMinList.push(column)
5518
+ } else if (column.minWidth === 'auto') {
5519
+ autoMinList.push(column)
5509
5520
  } else if (isScale(column.minWidth)) {
5510
5521
  scaleMinList.push(column)
5511
5522
  } else {
@@ -5513,7 +5524,7 @@ export default defineComponent({
5513
5524
  }
5514
5525
  }
5515
5526
  })
5516
- Object.assign(reactData.columnStore, { resizeList, pxList, pxMinList, scaleList, scaleMinList, autoList, remainList })
5527
+ Object.assign(reactData.columnStore, { resizeList, pxList, pxMinList, autoMinList, scaleList, scaleMinList, autoList, remainList })
5517
5528
  },
5518
5529
  saveCustomStore (type) {
5519
5530
  const tableId = computeTableId.value