vxe-table 3.14.0 → 3.14.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.
Files changed (46) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/edit/mixin.js +95 -65
  3. package/es/table/module/keyboard/mixin.js +3 -2
  4. package/es/table/module/validator/mixin.js +2 -5
  5. package/es/table/src/body.js +6 -7
  6. package/es/table/src/methods.js +301 -286
  7. package/es/table/src/table.js +21 -15
  8. package/es/ui/index.js +1 -1
  9. package/es/ui/src/dom.js +0 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/lib/index.umd.js +501 -498
  12. package/lib/index.umd.min.js +1 -1
  13. package/lib/style.css +1 -1
  14. package/lib/table/module/edit/mixin.js +108 -99
  15. package/lib/table/module/edit/mixin.min.js +1 -1
  16. package/lib/table/module/keyboard/mixin.js +2 -1
  17. package/lib/table/module/keyboard/mixin.min.js +1 -1
  18. package/lib/table/module/validator/mixin.js +3 -9
  19. package/lib/table/module/validator/mixin.min.js +1 -1
  20. package/lib/table/src/body.js +6 -7
  21. package/lib/table/src/body.min.js +1 -1
  22. package/lib/table/src/methods.js +352 -355
  23. package/lib/table/src/methods.min.js +1 -1
  24. package/lib/table/src/table.js +21 -15
  25. package/lib/table/src/table.min.js +1 -1
  26. package/lib/ui/index.js +1 -1
  27. package/lib/ui/index.min.js +1 -1
  28. package/lib/ui/src/dom.js +0 -2
  29. package/lib/ui/src/dom.min.js +1 -1
  30. package/lib/ui/src/log.js +1 -1
  31. package/lib/ui/src/log.min.js +1 -1
  32. package/package.json +2 -2
  33. package/packages/table/module/edit/mixin.ts +129 -89
  34. package/packages/table/module/keyboard/mixin.ts +4 -2
  35. package/packages/table/module/validator/mixin.ts +3 -6
  36. package/packages/table/src/body.ts +6 -7
  37. package/packages/table/src/methods.ts +345 -301
  38. package/packages/table/src/table.ts +24 -18
  39. package/packages/table/src/util.ts +2 -2
  40. package/packages/ui/src/dom.ts +0 -2
  41. /package/es/{iconfont.1742955973002.ttf → iconfont.1743125678150.ttf} +0 -0
  42. /package/es/{iconfont.1742955973002.woff → iconfont.1743125678150.woff} +0 -0
  43. /package/es/{iconfont.1742955973002.woff2 → iconfont.1743125678150.woff2} +0 -0
  44. /package/lib/{iconfont.1742955973002.ttf → iconfont.1743125678150.ttf} +0 -0
  45. /package/lib/{iconfont.1742955973002.woff → iconfont.1743125678150.woff} +0 -0
  46. /package/lib/{iconfont.1742955973002.woff2 → iconfont.1743125678150.woff2} +0 -0
@@ -2,13 +2,15 @@ import XEUtils from 'xe-utils'
2
2
  import { VxeUI } from '../../../ui'
3
3
  import { isEnableConf } from '../../../ui/src/utils'
4
4
  import { getCellValue, setCellValue, getRowid } from '../../src/util'
5
- import { browse, removeClass, addClass } from '../../../ui/src/dom'
5
+ import { removeClass, addClass } from '../../../ui/src/dom'
6
6
  import { warnLog, errLog } from '../../../ui/src/log'
7
7
 
8
8
  import type { VxeTableConstructor, TableInternalData, VxeTableDefines, TableReactData, VxeTablePrivateMethods } from '../../../../types'
9
9
 
10
10
  const { getConfig, renderer, getI18n } = VxeUI
11
11
 
12
+ const browseObj = XEUtils.browse()
13
+
12
14
  function getEditColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
13
15
  const { model, editRender } = column
14
16
  if (editRender) {
@@ -26,7 +28,7 @@ function setEditColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
26
28
  }
27
29
  }
28
30
 
29
- function removeCellSelectedClass ($xeTable: VxeTableConstructor) {
31
+ function removeCellSelectedClass ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
30
32
  const el = $xeTable.$refs.refElem as HTMLDivElement
31
33
  if (el) {
32
34
  const cell = el.querySelector('.col--selected')
@@ -36,7 +38,7 @@ function removeCellSelectedClass ($xeTable: VxeTableConstructor) {
36
38
  }
37
39
  }
38
40
 
39
- function syncActivedCell ($xeTable: VxeTableConstructor) {
41
+ function syncActivedCell ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
40
42
  const reactData = $xeTable as unknown as TableReactData
41
43
 
42
44
  const { editStore, tableColumn } = reactData
@@ -52,18 +54,21 @@ function syncActivedCell ($xeTable: VxeTableConstructor) {
52
54
  }
53
55
  }
54
56
 
55
- function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
56
- const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = _vm
57
+ function insertTreeRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, newRecords: any[], isAppend: boolean) {
58
+ const internalData = $xeTable as unknown as TableInternalData
59
+
60
+ const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
61
+ const treeOpts = $xeTable.computeTreeOpts
57
62
  const { rowField, parentField, mapChildrenField } = treeOpts
58
- const childrenField: any = treeOpts.children || treeOpts.childrenField
63
+ const childrenField = treeOpts.children || treeOpts.childrenField
59
64
  const funcName = isAppend ? 'push' : 'unshift'
60
- newRecords.forEach((item: any) => {
61
- const parentRowId: any = item[parentField]
62
- const rowid = getRowid(_vm, item)
63
- const matchObj = parentRowId ? XEUtils.findTree(tableFullTreeData, (item: any) => parentRowId === item[rowField], { children: mapChildrenField }) : null
65
+ newRecords.forEach((item) => {
66
+ const parentRowId = item[parentField]
67
+ const rowid = getRowid($xeTable, item)
68
+ const matchObj = parentRowId ? XEUtils.findTree(tableFullTreeData, (item) => parentRowId === item[rowField], { children: mapChildrenField }) : null
64
69
  if (matchObj) {
65
- const { item: parentRow } = matchObj as any
66
- const parentRest = fullAllDataRowIdData[getRowid(_vm, parentRow)]
70
+ const { item: parentRow } = matchObj
71
+ const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)]
67
72
  const parentLevel = parentRest ? parentRest.level : 0
68
73
  let parentChilds = parentRow[childrenField]
69
74
  let mapChilds = parentRow[mapChildrenField]
@@ -93,14 +98,14 @@ function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
93
98
  })
94
99
  }
95
100
 
96
- function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isInsertNextRow?: any) {
101
+ function handleInsertRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, records: any[], targetRow: any, isInsertNextRow?: any) {
97
102
  const props = $xeTable
98
- const reactData = $xeTable
99
- const internalData = $xeTable
103
+ const reactData = $xeTable as unknown as TableReactData
104
+ const internalData = $xeTable as unknown as TableInternalData
100
105
 
101
106
  const { treeConfig } = props
102
- const { mergeList, editStore } = reactData
103
- const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
107
+ const { mergeList } = reactData
108
+ const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps } = internalData
104
109
  const treeOpts = $xeTable.computeTreeOpts
105
110
  const { transform, rowField, mapChildrenField } = treeOpts
106
111
  const childrenField = treeOpts.children || treeOpts.childrenField
@@ -239,11 +244,11 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
239
244
  }
240
245
  }
241
246
  }
242
- const { insertMaps } = editStore
243
247
  newRecords.forEach(newRow => {
244
248
  const rowid = getRowid($xeTable, newRow)
245
- insertMaps[rowid] = newRow
249
+ insertRowMaps[rowid] = newRow
246
250
  })
251
+ reactData.insertRowFlag++
247
252
  $xeTable.cacheRowMap(false)
248
253
  $xeTable.updateScrollYStatus()
249
254
  $xeTable.handleTableData(treeConfig && transform)
@@ -252,7 +257,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
252
257
  }
253
258
  $xeTable.updateFooter()
254
259
  $xeTable.checkSelectionStatus()
255
- if ($xeTable.scrollYLoad) {
260
+ if (reactData.scrollYLoad) {
256
261
  $xeTable.updateScrollYSpace()
257
262
  }
258
263
  return $xeTable.$nextTick().then(() => {
@@ -266,7 +271,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
266
271
  })
267
272
  }
268
273
 
269
- function handleInsertChildRowAt ($xeTable: VxeTableConstructor, records: any, parentRow: any, targetRow: any, isInsertNextRow?: boolean) {
274
+ function handleInsertChildRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, records: any, parentRow: any, targetRow: any, isInsertNextRow?: boolean) {
270
275
  const props = $xeTable
271
276
 
272
277
  const { treeConfig } = props
@@ -502,13 +507,12 @@ export default {
502
507
 
503
508
  const { treeConfig } = props
504
509
  const { mergeList, editStore } = reactData
505
- const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps } = internalData
510
+ const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps, insertRowMaps, removeRowMaps } = internalData
506
511
  const checkboxOpts = $xeTable.computeCheckboxOpts
507
512
  const treeOpts = $xeTable.computeTreeOpts
508
513
  const { transform, mapChildrenField } = treeOpts
509
514
  const childrenField = treeOpts.children || treeOpts.childrenField
510
- const { actived, removeMaps } = editStore
511
- const insertDataRowMaps = Object.assign({}, editStore.insertMaps)
515
+ const { actived } = editStore
512
516
  const { checkField } = checkboxOpts
513
517
  let delList: any[] = []
514
518
  if (!rows) {
@@ -520,7 +524,7 @@ export default {
520
524
  rows.forEach(row => {
521
525
  if (!$xeTable.isInsertByRow(row)) {
522
526
  const rowid = getRowid($xeTable, row)
523
- removeMaps[rowid] = row
527
+ removeRowMaps[rowid] = row
524
528
  }
525
529
  })
526
530
  // 如果绑定了多选属性,则更新状态
@@ -588,14 +592,15 @@ export default {
588
592
  // 从新增中移除已删除的数据
589
593
  rows.forEach((row: any) => {
590
594
  const rowid = getRowid($xeTable, row)
591
- if (insertDataRowMaps[rowid]) {
592
- delete insertDataRowMaps[rowid]
595
+ if (insertRowMaps[rowid]) {
596
+ delete insertRowMaps[rowid]
593
597
  }
594
598
  if (pendingRowMaps[rowid]) {
595
599
  delete pendingRowMaps[rowid]
596
600
  }
597
601
  })
598
- editStore.insertMaps = insertDataRowMaps
602
+ reactData.removeRowFlag++
603
+ reactData.insertRowFlag++
599
604
  reactData.pendingRowFlag++
600
605
  $xeTable.updateFooter()
601
606
  $xeTable.cacheRowMap(false)
@@ -665,15 +670,12 @@ export default {
665
670
  * 获取新增的临时数据
666
671
  */
667
672
  _getInsertRecords () {
668
- const $xeTable = this
669
- const reactData = $xeTable
670
- const internalData = $xeTable
673
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
674
+ const internalData = $xeTable as unknown as TableInternalData
671
675
 
672
- const { editStore } = reactData
673
- const { fullAllDataRowIdData } = internalData
674
- const { insertMaps } = editStore
676
+ const { fullAllDataRowIdData, insertRowMaps } = internalData
675
677
  const insertRecords: any[] = []
676
- XEUtils.each(insertMaps, (row, rowid) => {
678
+ XEUtils.each(insertRowMaps, (row, rowid) => {
677
679
  if (fullAllDataRowIdData[rowid]) {
678
680
  insertRecords.push(row)
679
681
  }
@@ -684,13 +686,12 @@ export default {
684
686
  * 获取已删除的数据
685
687
  */
686
688
  _getRemoveRecords () {
687
- const $xeTable = this
688
- const reactData = $xeTable
689
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
690
+ const internalData = $xeTable as unknown as TableInternalData
689
691
 
690
- const { editStore } = reactData
691
- const { removeMaps } = editStore
692
+ const { removeRowMaps } = internalData
692
693
  const removeRecords: any[] = []
693
- XEUtils.each(removeMaps, (row) => {
694
+ XEUtils.each(removeRowMaps, (row) => {
694
695
  removeRecords.push(row)
695
696
  })
696
697
  return removeRecords
@@ -701,19 +702,19 @@ export default {
701
702
  * 如果是树表格,子节点更改状态不会影响父节点的更新状态
702
703
  */
703
704
  _getUpdateRecords () {
704
- const $xeTable = this
705
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
706
+ const props = $xeTable
707
+ const internalData = $xeTable as unknown as TableInternalData
705
708
 
706
- const { keepSource, tableFullData, isUpdateByRow, treeConfig, treeOpts, editStore } = this
709
+ const { keepSource, treeConfig } = props
710
+ const { tableFullData } = internalData
711
+ const treeOpts = $xeTable.computeTreeOpts
707
712
  if (keepSource) {
708
- const { actived } = editStore
709
- const { row, column } = actived
710
- if (row || column) {
711
- syncActivedCell($xeTable)
712
- }
713
+ syncActivedCell($xeTable)
713
714
  if (treeConfig) {
714
- return XEUtils.filterTree(tableFullData, row => isUpdateByRow(row), treeOpts)
715
+ return XEUtils.filterTree(tableFullData, row => $xeTable.isUpdateByRow(row), treeOpts)
715
716
  }
716
- return tableFullData.filter((row: any) => isUpdateByRow(row))
717
+ return tableFullData.filter((row) => $xeTable.isUpdateByRow(row))
717
718
  }
718
719
  return []
719
720
  },
@@ -721,7 +722,7 @@ export default {
721
722
  * 处理激活编辑
722
723
  */
723
724
  handleEdit (params: any, evnt: any) {
724
- const $xeTable = this
725
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
725
726
 
726
727
  return handleEditActive($xeTable, params, evnt, true, true)
727
728
  },
@@ -753,7 +754,7 @@ export default {
753
754
  * 清除激活的编辑
754
755
  */
755
756
  _clearEdit (row: any) {
756
- const $xeTable = this
757
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
757
758
 
758
759
  return handleClearEdit($xeTable, null, row)
759
760
  },
@@ -766,42 +767,57 @@ export default {
766
767
  return handleClearEdit($xeTable, evnt, targetRow)
767
768
  },
768
769
  _getActiveRecord () {
770
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
771
+
769
772
  if (process.env.VUE_APP_VXE_ENV === 'development') {
770
773
  warnLog('vxe.error.delFunc', ['getActiveRecord', 'getEditRecord'])
771
774
  }
772
775
  // 即将废弃
773
- return this.getEditRecord()
776
+ return $xeTable.getEditRecord()
774
777
  },
775
778
  _getEditRecord () {
776
- const { $el, editStore, afterFullData } = this
777
- const { actived } = editStore
778
- const { args, row } = actived
779
- if (args && this.findRowIndexOf(afterFullData, row) > -1 && $el.querySelectorAll('.vxe-body--column.col--active').length) {
779
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
780
+ const reactData = $xeTable as unknown as TableReactData
781
+ const internalData = $xeTable as unknown as TableInternalData
782
+
783
+ const { editStore } = reactData
784
+ const { afterFullData } = internalData
785
+ const el = $xeTable.$refs.refElem as HTMLDivElement
786
+ const { args, row } = editStore.actived
787
+ if (args && $xeTable.findRowIndexOf(afterFullData, row) > -1 && el.querySelectorAll('.vxe-body--column.col--active').length) {
780
788
  return Object.assign({}, args)
781
789
  }
782
790
  return null
783
791
  },
784
792
  _isActiveByRow (row: any) {
793
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
794
+
785
795
  if (process.env.VUE_APP_VXE_ENV === 'development') {
786
796
  warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow'])
787
797
  }
788
798
  // 即将废弃
789
- return this.isEditByRow(row)
799
+ return $xeTable.isEditByRow(row)
790
800
  },
791
801
  /**
792
802
  * 判断行是否为激活编辑状态
793
803
  * @param {Row} row 行对象
794
804
  */
795
805
  _isEditByRow (row: any) {
796
- return this.editStore.actived.row === row
806
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
807
+ const reactData = $xeTable as unknown as TableReactData
808
+
809
+ const { editStore } = reactData
810
+ return editStore.actived.row === row
797
811
  },
798
812
  /**
799
813
  * 处理聚焦
800
814
  */
801
815
  handleFocus (params: any) {
802
- const { editOpts } = this
816
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
817
+
803
818
  const { row, column, cell } = params
804
819
  const { editRender } = column
820
+ const editOpts = $xeTable.computeEditOpts
805
821
  if (isEnableConf(editRender)) {
806
822
  const compRender = renderer.get(editRender.name)
807
823
  let autoFocus = editRender.autofocus || editRender.autoFocus
@@ -817,7 +833,7 @@ export default {
817
833
  }
818
834
  // 如果指定了聚焦 class
819
835
  if (XEUtils.isFunction(autoFocus)) {
820
- inputElem = autoFocus.call(this, params)
836
+ inputElem = autoFocus.call($xeTable, params)
821
837
  } else if (autoFocus) {
822
838
  if (autoFocus === true) {
823
839
  // 自动匹配模式,会自动匹配第一个可输入元素
@@ -835,7 +851,7 @@ export default {
835
851
  inputElem.select()
836
852
  } else {
837
853
  // 保持一致行为,光标移到末端
838
- if (browse.msie) {
854
+ if (browseObj.msie) {
839
855
  const textRange = inputElem.createTextRange()
840
856
  textRange.collapse(false)
841
857
  textRange.select()
@@ -846,31 +862,33 @@ export default {
846
862
  if (editOpts.autoPos) {
847
863
  if (!column.fixed) {
848
864
  // 显示到可视区中
849
- this.scrollToRow(row, column)
865
+ $xeTable.scrollToRow(row, column)
850
866
  }
851
867
  }
852
868
  }
853
869
  }
854
870
  },
855
871
  _setActiveRow (row: any) {
872
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
873
+
856
874
  if (process.env.VUE_APP_VXE_ENV === 'development') {
857
875
  warnLog('vxe.error.delFunc', ['setActiveRow', 'setEditRow'])
858
876
  }
859
877
  // 即将废弃
860
- return this.setEditRow(row)
878
+ return $xeTable.setEditRow(row)
861
879
  },
862
880
  /**
863
881
  * 激活行编辑
864
882
  */
865
883
  _setEditRow (row: any, fieldOrColumn: any) {
866
- const $xeTable = this
884
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
867
885
 
868
886
  let column = XEUtils.find(this.visibleColumn, column => isEnableConf(column.editRender))
869
887
  let isPos = false
870
888
  if (fieldOrColumn) {
871
889
  isPos = true
872
890
  if (fieldOrColumn !== true) {
873
- column = XEUtils.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn
891
+ column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
874
892
  }
875
893
  }
876
894
  return handleEditCell($xeTable, row, column, isPos)
@@ -886,33 +904,48 @@ export default {
886
904
  * 激活单元格编辑
887
905
  */
888
906
  _setEditCell (row: any, fieldOrColumn: any) {
889
- const $xeTable = this
907
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
890
908
 
891
909
  return handleEditCell($xeTable, row, fieldOrColumn, true)
892
910
  },
893
911
  /**
894
912
  * 只对 trigger=dblclick 有效,选中单元格
895
913
  */
896
- _setSelectCell (row: any, fieldOrColumn: any) {
897
- const { tableData, editOpts, visibleColumn } = this
898
- const column = XEUtils.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn
914
+ _setSelectCell (row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo) {
915
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
916
+ const reactData = $xeTable as unknown as TableReactData
917
+
918
+ const { tableData } = reactData
919
+ const editOpts = $xeTable.computeEditOpts
920
+ const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
899
921
  if (row && column && editOpts.trigger !== 'manual') {
900
- const rowIndex = this.findRowIndexOf(tableData, row)
922
+ const rowIndex = $xeTable.findRowIndexOf(tableData, row)
901
923
  if (rowIndex > -1) {
902
- const cell = this.getCellElement(row, column)
903
- const params = { row, rowIndex, column, columnIndex: visibleColumn.indexOf(column), cell }
904
- this.handleSelected(params, {})
924
+ const cell = $xeTable.getCellElement(row, column)
925
+ const params = {
926
+ row,
927
+ rowIndex,
928
+ column,
929
+ columnIndex: $xeTable.getColumnIndex(column),
930
+ cell
931
+ }
932
+ $xeTable.handleSelected(params, {})
905
933
  }
906
934
  }
907
- return this.$nextTick()
935
+ return $xeTable.$nextTick()
908
936
  },
909
937
  /**
910
938
  * 处理选中源
911
939
  */
912
940
  handleSelected (params: any, evnt: any) {
913
- const $xeTable = this
941
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
942
+ const props = $xeTable
943
+ const reactData = $xeTable as unknown as TableReactData
914
944
 
915
- const { mouseConfig, mouseOpts, editOpts, editStore } = this
945
+ const { mouseConfig } = props
946
+ const { editStore } = reactData
947
+ const mouseOpts = $xeTable.computeMouseOpts
948
+ const editOpts = $xeTable.computeEditOpts
916
949
  const { actived, selected } = editStore
917
950
  const { row, column } = params
918
951
  const isMouseSelected = mouseConfig && mouseOpts.selected
@@ -920,22 +953,24 @@ export default {
920
953
  if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
921
954
  if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
922
955
  handleClearEdit($xeTable, evnt)
923
- this.clearSelected(evnt)
924
- this.clearCellAreas(evnt)
925
- this.clearCopyCellArea(evnt)
956
+ $xeTable.clearSelected()
957
+ if ($xeTable.clearCellAreas) {
958
+ $xeTable.clearCellAreas()
959
+ $xeTable.clearCopyCellArea()
960
+ }
926
961
  selected.args = params
927
962
  selected.row = row
928
963
  selected.column = column
929
964
  if (isMouseSelected) {
930
965
  this.addCellSelectedClass()
931
966
  }
932
- this.focus()
967
+ $xeTable.focus()
933
968
  if (evnt) {
934
- this.emitEvent('cell-selected', params, evnt)
969
+ $xeTable.dispatchEvent('cell-selected', params, evnt)
935
970
  }
936
971
  }
937
972
  }
938
- return this.$nextTick()
973
+ return $xeTable.$nextTick()
939
974
  }
940
975
  return selectMethod()
941
976
  },
@@ -943,7 +978,11 @@ export default {
943
978
  * 获取选中的单元格
944
979
  */
945
980
  _getSelectedCell () {
946
- const { args, column } = this.editStore.selected
981
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
982
+ const reactData = $xeTable as unknown as TableReactData
983
+
984
+ const { editStore } = reactData
985
+ const { args, column } = editStore.selected
947
986
  if (args && column) {
948
987
  return Object.assign({}, args)
949
988
  }
@@ -953,14 +992,15 @@ export default {
953
992
  * 清除所选中源状态
954
993
  */
955
994
  _clearSelected () {
956
- const $xeTable = this
995
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
996
+ const reactData = $xeTable as unknown as TableReactData
957
997
 
958
- const { selected } = this.editStore
998
+ const { editStore } = reactData
999
+ const { selected } = editStore
959
1000
  selected.row = null
960
1001
  selected.column = null
961
- this.reColTitleSdCls()
962
1002
  removeCellSelectedClass($xeTable)
963
- return this.$nextTick()
1003
+ return $xeTable.$nextTick()
964
1004
  },
965
1005
  reColTitleSdCls () {
966
1006
  const headerElem = this.elemStore['main-header-list']
@@ -969,8 +1009,8 @@ export default {
969
1009
  }
970
1010
  },
971
1011
  addCellSelectedClass () {
972
- const $xeTable = this
973
- const reactData = $xeTable as TableReactData
1012
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1013
+ const reactData = $xeTable as unknown as TableReactData
974
1014
 
975
1015
  const { editStore } = reactData
976
1016
  const { selected } = editStore
@@ -1,13 +1,15 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import { getRefElem } from '../../src/util'
3
- import { browse, hasClass, getAbsolutePos, addClass, removeClass } from '../../../ui/src/dom'
3
+ import { hasClass, getAbsolutePos, addClass, removeClass } from '../../../ui/src/dom'
4
4
 
5
5
  import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, TableReactData, TableInternalData } from '../../../../types'
6
6
 
7
+ const browseObj = XEUtils.browse()
8
+
7
9
  function getTargetOffset (target: any, container: any) {
8
10
  let offsetTop = 0
9
11
  let offsetLeft = 0
10
- const triggerCheckboxLabel = !browse.firefox && hasClass(target, 'vxe-checkbox--label')
12
+ const triggerCheckboxLabel = !browseObj.firefox && hasClass(target, 'vxe-checkbox--label')
11
13
  if (triggerCheckboxLabel) {
12
14
  const checkboxLabelStyle = getComputedStyle(target)
13
15
  offsetTop -= XEUtils.toNumber(checkboxLabelStyle.paddingTop)
@@ -5,7 +5,7 @@ import { scrollToView } from '../../../ui/src/dom'
5
5
  import { handleFieldOrColumn, getRowid } from '../../src/util'
6
6
  import { warnLog, errLog } from '../../../ui/src/log'
7
7
 
8
- import type { VxeTableDefines, TableReactData, TableInternalData } from '../../../../types'
8
+ import type { VxeTableDefines, TableInternalData } from '../../../../types'
9
9
 
10
10
  const { getConfig, validators } = VxeUI
11
11
 
@@ -156,14 +156,11 @@ export default {
156
156
  beginValidate (rows: any, cols: VxeTableDefines.ColumnInfo[] | null, cb: any, isFull: any) {
157
157
  const $xeTable = this
158
158
  const props = $xeTable
159
- const reactData = $xeTable as unknown as TableReactData
160
159
  const internalData = $xeTable as unknown as TableInternalData
161
160
 
162
161
  const validRest: any = {}
163
162
  const { editRules, treeConfig } = props
164
- const { editStore } = reactData
165
- const { afterFullData, pendingRowMaps } = internalData
166
- const { removeMaps } = editStore
163
+ const { afterFullData, pendingRowMaps, removeRowMaps } = internalData
167
164
  const treeOpts = $xeTable.computeTreeOpts
168
165
  const childrenField = treeOpts.children || treeOpts.childrenField
169
166
  let validList
@@ -189,7 +186,7 @@ export default {
189
186
  const handleVaild = (row: any) => {
190
187
  const rowid = getRowid($xeTable, row)
191
188
  // 是否删除
192
- if (removeMaps[rowid]) {
189
+ if (removeRowMaps[rowid]) {
193
190
  return
194
191
  }
195
192
  // 是否标记删除
@@ -465,9 +465,12 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
465
465
  const { handleGetRowId } = createHandleGetRowId($xeTable)
466
466
  tableData.forEach((row, $rowIndex) => {
467
467
  const trOn: Record<string, any> = {}
468
+ const rowid = handleGetRowId(row)
469
+ const rowRest = fullAllDataRowIdData[rowid] || {}
468
470
  let rowIndex = $rowIndex
469
- // 确保任何情况下 rowIndex 都精准指向真实 data 索引
470
- rowIndex = $xeTable.getRowIndex(row)
471
+ let rowLevel = 0
472
+ let seq: string | number = -1
473
+ let _rowIndex = -1
471
474
  // 当前行事件
472
475
  if (rowOpts.isHover || highlightHoverRow) {
473
476
  trOn.mouseenter = (evnt: MouseEvent) => {
@@ -483,11 +486,6 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
483
486
  $xeTable.clearHoverRow()
484
487
  }
485
488
  }
486
- const rowid = handleGetRowId(row)
487
- const rowRest = fullAllDataRowIdData[rowid] || {}
488
- let rowLevel = 0
489
- let seq: string | number = -1
490
- let _rowIndex = 0
491
489
  if (rowRest) {
492
490
  rowLevel = rowRest.level
493
491
  if (treeConfig && transform && seqMode === 'increasing') {
@@ -495,6 +493,7 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
495
493
  } else {
496
494
  seq = rowRest.seq
497
495
  }
496
+ rowIndex = rowRest.index
498
497
  _rowIndex = rowRest._index
499
498
  }
500
499
  const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }