vxe-table 3.9.1 → 3.9.2

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.
@@ -914,10 +914,10 @@ const Methods = {
914
914
  * @param {Row} row 行对象
915
915
  */
916
916
  getRowSeq (row: any) {
917
- const { fullDataRowIdData } = this
917
+ const { fullAllDataRowIdData } = this
918
918
  if (row) {
919
919
  const rowid = getRowid(this, row)
920
- const rest = fullDataRowIdData[rowid]
920
+ const rest = fullAllDataRowIdData[rowid]
921
921
  if (rest) {
922
922
  return rest.seq
923
923
  }
@@ -929,14 +929,30 @@ const Methods = {
929
929
  * @param {Row} row 行对象
930
930
  */
931
931
  getRowIndex (row: any) {
932
- return this.fullDataRowMap.has(row) ? this.fullDataRowMap.get(row).index : -1
932
+ const { fullAllDataRowIdData } = this
933
+ if (row) {
934
+ const rowid = getRowid(this, row)
935
+ const rest = fullAllDataRowIdData[rowid]
936
+ if (rest) {
937
+ return rest.index
938
+ }
939
+ }
940
+ return -1
933
941
  },
934
942
  /**
935
943
  * 根据 row 获取相对于当前数据中的索引
936
944
  * @param {Row} row 行对象
937
945
  */
938
946
  getVTRowIndex (row: any) {
939
- return this.afterFullData.indexOf(row)
947
+ const { fullAllDataRowIdData } = this
948
+ if (row) {
949
+ const rowid = getRowid(this, row)
950
+ const rest = fullAllDataRowIdData[rowid]
951
+ if (rest) {
952
+ return rest._index
953
+ }
954
+ }
955
+ return -1
940
956
  },
941
957
  // 在 v3 中废弃
942
958
  _getRowIndex (row: any) {
@@ -950,7 +966,15 @@ const Methods = {
950
966
  * @param {Row} row 行对象
951
967
  */
952
968
  getVMRowIndex (row: any) {
953
- return this.tableData.indexOf(row)
969
+ const { fullAllDataRowIdData } = this
970
+ if (row) {
971
+ const rowid = getRowid(this, row)
972
+ const rest = fullAllDataRowIdData[rowid]
973
+ if (rest) {
974
+ return rest.$index
975
+ }
976
+ }
977
+ return -1
954
978
  },
955
979
  // 在 v3 中废弃
956
980
  $getRowIndex (row: any) {
@@ -964,14 +988,28 @@ const Methods = {
964
988
  * @param {ColumnInfo} column 列配置
965
989
  */
966
990
  getColumnIndex (column: any) {
967
- return this.fullColumnMap.has(column) ? this.fullColumnMap.get(column).index : -1
991
+ const { fullColumnIdData } = this
992
+ if (column) {
993
+ const rest = fullColumnIdData[column.id]
994
+ if (rest) {
995
+ return rest.index
996
+ }
997
+ }
998
+ return -1
968
999
  },
969
1000
  /**
970
1001
  * 根据 column 获取相对于当前表格列中的索引
971
1002
  * @param {ColumnInfo} column 列配置
972
1003
  */
973
1004
  getVTColumnIndex (column: any) {
974
- return this.visibleColumn.indexOf(column)
1005
+ const { fullColumnIdData } = this
1006
+ if (column) {
1007
+ const rest = fullColumnIdData[column.id]
1008
+ if (rest) {
1009
+ return rest._index
1010
+ }
1011
+ }
1012
+ return -1
975
1013
  },
976
1014
  // 在 v3 中废弃
977
1015
  _getColumnIndex (column: any) {
@@ -985,7 +1023,14 @@ const Methods = {
985
1023
  * @param {ColumnInfo} column 列配置
986
1024
  */
987
1025
  getVMColumnIndex (column: any) {
988
- return this.tableColumn.indexOf(column)
1026
+ const { fullColumnIdData } = this
1027
+ if (column) {
1028
+ const rest = fullColumnIdData[column.id]
1029
+ if (rest) {
1030
+ return rest.$index
1031
+ }
1032
+ }
1033
+ return -1
989
1034
  },
990
1035
  // 在 v3 中废弃
991
1036
  $getColumnIndex (column: any) {
@@ -2151,7 +2196,9 @@ const Methods = {
2151
2196
  })
2152
2197
  } else {
2153
2198
  const labelEl = cellEl.firstChild as HTMLElement
2154
- titleWidth = labelEl.offsetWidth
2199
+ if (labelEl) {
2200
+ titleWidth = labelEl.offsetWidth
2201
+ }
2155
2202
  }
2156
2203
  if (titleWidth) {
2157
2204
  colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4)