Skip to content

Commit

Permalink
releases 3.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Oct 11, 2024
1 parent 32f2070 commit b4ed13e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vxe-table",
"version": "3.9.1",
"version": "3.9.2",
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...",
"scripts": {
"update": "npm install --legacy-peer-deps",
Expand Down Expand Up @@ -28,7 +28,7 @@
"style": "lib/style.css",
"typings": "types/index.d.ts",
"dependencies": {
"vxe-pc-ui": "^3.1.26"
"vxe-pc-ui": "^3.1.27"
},
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.25.7",
Expand Down
65 changes: 56 additions & 9 deletions packages/table/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -914,10 +914,10 @@ const Methods = {
* @param {Row} row 行对象
*/
getRowSeq (row: any) {
const { fullDataRowIdData } = this
const { fullAllDataRowIdData } = this
if (row) {
const rowid = getRowid(this, row)
const rest = fullDataRowIdData[rowid]
const rest = fullAllDataRowIdData[rowid]
if (rest) {
return rest.seq
}
Expand All @@ -929,14 +929,30 @@ const Methods = {
* @param {Row} row 行对象
*/
getRowIndex (row: any) {
return this.fullDataRowMap.has(row) ? this.fullDataRowMap.get(row).index : -1
const { fullAllDataRowIdData } = this
if (row) {
const rowid = getRowid(this, row)
const rest = fullAllDataRowIdData[rowid]
if (rest) {
return rest.index
}
}
return -1
},
/**
* 根据 row 获取相对于当前数据中的索引
* @param {Row} row 行对象
*/
getVTRowIndex (row: any) {
return this.afterFullData.indexOf(row)
const { fullAllDataRowIdData } = this
if (row) {
const rowid = getRowid(this, row)
const rest = fullAllDataRowIdData[rowid]
if (rest) {
return rest._index
}
}
return -1
},
// 在 v3 中废弃
_getRowIndex (row: any) {
Expand All @@ -950,7 +966,15 @@ const Methods = {
* @param {Row} row 行对象
*/
getVMRowIndex (row: any) {
return this.tableData.indexOf(row)
const { fullAllDataRowIdData } = this
if (row) {
const rowid = getRowid(this, row)
const rest = fullAllDataRowIdData[rowid]
if (rest) {
return rest.$index
}
}
return -1
},
// 在 v3 中废弃
$getRowIndex (row: any) {
Expand All @@ -964,14 +988,28 @@ const Methods = {
* @param {ColumnInfo} column 列配置
*/
getColumnIndex (column: any) {
return this.fullColumnMap.has(column) ? this.fullColumnMap.get(column).index : -1
const { fullColumnIdData } = this
if (column) {
const rest = fullColumnIdData[column.id]
if (rest) {
return rest.index
}
}
return -1
},
/**
* 根据 column 获取相对于当前表格列中的索引
* @param {ColumnInfo} column 列配置
*/
getVTColumnIndex (column: any) {
return this.visibleColumn.indexOf(column)
const { fullColumnIdData } = this
if (column) {
const rest = fullColumnIdData[column.id]
if (rest) {
return rest._index
}
}
return -1
},
// 在 v3 中废弃
_getColumnIndex (column: any) {
Expand All @@ -985,7 +1023,14 @@ const Methods = {
* @param {ColumnInfo} column 列配置
*/
getVMColumnIndex (column: any) {
return this.tableColumn.indexOf(column)
const { fullColumnIdData } = this
if (column) {
const rest = fullColumnIdData[column.id]
if (rest) {
return rest.$index
}
}
return -1
},
// 在 v3 中废弃
$getColumnIndex (column: any) {
Expand Down Expand Up @@ -2151,7 +2196,9 @@ const Methods = {
})
} else {
const labelEl = cellEl.firstChild as HTMLElement
titleWidth = labelEl.offsetWidth
if (labelEl) {
titleWidth = labelEl.offsetWidth
}
}
if (titleWidth) {
colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4)
Expand Down

0 comments on commit b4ed13e

Please sign in to comment.