vxe-table 3.14.0-beta.9 → 3.14.1

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 (209) hide show
  1. package/es/grid/src/grid.js +62 -42
  2. package/es/locale/lang/ar-EG.js +7 -1
  3. package/es/locale/lang/de-DE.js +7 -1
  4. package/es/locale/lang/en-US.js +7 -1
  5. package/es/locale/lang/es-ES.js +7 -1
  6. package/es/locale/lang/fr-FR.js +7 -1
  7. package/es/locale/lang/hu-HU.js +7 -1
  8. package/es/locale/lang/hy-AM.js +7 -1
  9. package/es/locale/lang/id-ID.js +7 -1
  10. package/es/locale/lang/it-IT.js +7 -1
  11. package/es/locale/lang/ja-JP.js +7 -1
  12. package/es/locale/lang/ko-KR.js +7 -1
  13. package/es/locale/lang/nb-NO.js +7 -1
  14. package/es/locale/lang/pt-BR.js +7 -1
  15. package/es/locale/lang/ru-RU.js +7 -1
  16. package/es/locale/lang/th-TH.js +7 -1
  17. package/es/locale/lang/ug-CN.js +7 -1
  18. package/es/locale/lang/uk-UA.js +7 -1
  19. package/es/locale/lang/vi-VN.js +7 -1
  20. package/es/locale/lang/zh-CHT.js +7 -1
  21. package/es/locale/lang/zh-CN.js +7 -1
  22. package/es/style.css +1 -1
  23. package/es/table/module/custom/mixin.js +4 -2
  24. package/es/table/module/custom/panel.js +24 -23
  25. package/es/table/module/edit/mixin.js +103 -68
  26. package/es/table/module/export/export-panel.js +5 -4
  27. package/es/table/module/export/import-panel.js +8 -7
  28. package/es/table/module/export/mixin.js +30 -27
  29. package/es/table/module/filter/panel.js +21 -10
  30. package/es/table/module/keyboard/mixin.js +141 -41
  31. package/es/table/module/menu/mixin.js +6 -3
  32. package/es/table/module/menu/panel.js +7 -7
  33. package/es/table/module/validator/mixin.js +2 -5
  34. package/es/table/render/index.js +2 -2
  35. package/es/table/src/body.js +43 -25
  36. package/es/table/src/cell.js +27 -22
  37. package/es/table/src/column.js +11 -9
  38. package/es/table/src/columnInfo.js +6 -6
  39. package/es/table/src/footer.js +12 -7
  40. package/es/table/src/group.js +6 -5
  41. package/es/table/src/header.js +15 -9
  42. package/es/table/src/methods.js +1047 -971
  43. package/es/table/src/props.js +4 -0
  44. package/es/table/src/table.js +100 -64
  45. package/es/table/src/util.js +55 -20
  46. package/es/toolbar/src/toolbar.js +3 -3
  47. package/es/ui/index.js +2 -1
  48. package/es/ui/src/log.js +1 -1
  49. package/helper/vetur/attributes.json +1 -1
  50. package/helper/vetur/tags.json +1 -1
  51. package/lib/grid/src/grid.js +69 -59
  52. package/lib/grid/src/grid.min.js +1 -1
  53. package/lib/index.umd.js +2006 -1686
  54. package/lib/index.umd.min.js +1 -1
  55. package/lib/locale/lang/ar-EG.js +7 -1
  56. package/lib/locale/lang/ar-EG.min.js +1 -1
  57. package/lib/locale/lang/de-DE.js +7 -1
  58. package/lib/locale/lang/de-DE.min.js +1 -1
  59. package/lib/locale/lang/en-US.js +7 -1
  60. package/lib/locale/lang/en-US.min.js +1 -1
  61. package/lib/locale/lang/en-US.umd.js +7 -1
  62. package/lib/locale/lang/es-ES.js +7 -1
  63. package/lib/locale/lang/es-ES.min.js +1 -1
  64. package/lib/locale/lang/es-ES.umd.js +7 -1
  65. package/lib/locale/lang/fr-FR.js +7 -1
  66. package/lib/locale/lang/fr-FR.min.js +1 -1
  67. package/lib/locale/lang/hu-HU.js +7 -1
  68. package/lib/locale/lang/hu-HU.min.js +1 -1
  69. package/lib/locale/lang/hu-HU.umd.js +7 -1
  70. package/lib/locale/lang/hy-AM.js +7 -1
  71. package/lib/locale/lang/hy-AM.min.js +1 -1
  72. package/lib/locale/lang/id-ID.js +7 -1
  73. package/lib/locale/lang/id-ID.min.js +1 -1
  74. package/lib/locale/lang/it-IT.js +7 -1
  75. package/lib/locale/lang/it-IT.min.js +1 -1
  76. package/lib/locale/lang/ja-JP.js +7 -1
  77. package/lib/locale/lang/ja-JP.min.js +1 -1
  78. package/lib/locale/lang/ja-JP.umd.js +7 -1
  79. package/lib/locale/lang/ko-KR.js +7 -1
  80. package/lib/locale/lang/ko-KR.min.js +1 -1
  81. package/lib/locale/lang/ko-KR.umd.js +7 -1
  82. package/lib/locale/lang/nb-NO.js +7 -1
  83. package/lib/locale/lang/nb-NO.min.js +1 -1
  84. package/lib/locale/lang/pt-BR.js +7 -1
  85. package/lib/locale/lang/pt-BR.min.js +1 -1
  86. package/lib/locale/lang/pt-BR.umd.js +7 -1
  87. package/lib/locale/lang/ru-RU.js +7 -1
  88. package/lib/locale/lang/ru-RU.min.js +1 -1
  89. package/lib/locale/lang/ru-RU.umd.js +7 -1
  90. package/lib/locale/lang/th-TH.js +7 -1
  91. package/lib/locale/lang/th-TH.min.js +1 -1
  92. package/lib/locale/lang/ug-CN.js +7 -1
  93. package/lib/locale/lang/ug-CN.min.js +1 -1
  94. package/lib/locale/lang/uk-UA.js +7 -1
  95. package/lib/locale/lang/uk-UA.min.js +1 -1
  96. package/lib/locale/lang/uk-UA.umd.js +7 -1
  97. package/lib/locale/lang/vi-VN.js +7 -1
  98. package/lib/locale/lang/vi-VN.min.js +1 -1
  99. package/lib/locale/lang/zh-CHT.js +7 -1
  100. package/lib/locale/lang/zh-CHT.min.js +1 -1
  101. package/lib/locale/lang/zh-CHT.umd.js +7 -1
  102. package/lib/locale/lang/zh-CN.js +7 -1
  103. package/lib/locale/lang/zh-CN.min.js +1 -1
  104. package/lib/locale/lang/zh-CN.umd.js +7 -1
  105. package/lib/style.css +1 -1
  106. package/lib/table/module/custom/mixin.js +5 -3
  107. package/lib/table/module/custom/mixin.min.js +1 -1
  108. package/lib/table/module/custom/panel.js +22 -29
  109. package/lib/table/module/custom/panel.min.js +1 -1
  110. package/lib/table/module/edit/mixin.js +119 -105
  111. package/lib/table/module/edit/mixin.min.js +1 -1
  112. package/lib/table/module/export/export-panel.js +5 -4
  113. package/lib/table/module/export/export-panel.min.js +1 -1
  114. package/lib/table/module/export/import-panel.js +8 -7
  115. package/lib/table/module/export/import-panel.min.js +1 -1
  116. package/lib/table/module/export/mixin.js +35 -34
  117. package/lib/table/module/export/mixin.min.js +1 -1
  118. package/lib/table/module/filter/panel.js +16 -16
  119. package/lib/table/module/filter/panel.min.js +1 -1
  120. package/lib/table/module/keyboard/mixin.js +149 -47
  121. package/lib/table/module/keyboard/mixin.min.js +1 -1
  122. package/lib/table/module/menu/mixin.js +6 -3
  123. package/lib/table/module/menu/mixin.min.js +1 -1
  124. package/lib/table/module/menu/panel.js +7 -7
  125. package/lib/table/module/menu/panel.min.js +1 -1
  126. package/lib/table/module/validator/mixin.js +4 -10
  127. package/lib/table/module/validator/mixin.min.js +1 -1
  128. package/lib/table/render/index.js +3 -2
  129. package/lib/table/render/index.min.js +1 -1
  130. package/lib/table/src/body.js +51 -25
  131. package/lib/table/src/body.min.js +1 -1
  132. package/lib/table/src/cell.js +39 -23
  133. package/lib/table/src/cell.min.js +1 -1
  134. package/lib/table/src/column.js +11 -9
  135. package/lib/table/src/column.min.js +1 -1
  136. package/lib/table/src/columnInfo.js +6 -6
  137. package/lib/table/src/columnInfo.min.js +1 -1
  138. package/lib/table/src/footer.js +12 -5
  139. package/lib/table/src/footer.min.js +1 -1
  140. package/lib/table/src/group.js +6 -5
  141. package/lib/table/src/group.min.js +1 -1
  142. package/lib/table/src/header.js +16 -8
  143. package/lib/table/src/header.min.js +1 -1
  144. package/lib/table/src/methods.js +1219 -1151
  145. package/lib/table/src/methods.min.js +1 -1
  146. package/lib/table/src/props.js +4 -0
  147. package/lib/table/src/props.min.js +1 -1
  148. package/lib/table/src/table.js +108 -67
  149. package/lib/table/src/table.min.js +1 -1
  150. package/lib/table/src/util.js +62 -21
  151. package/lib/table/src/util.min.js +1 -1
  152. package/lib/toolbar/src/toolbar.js +3 -3
  153. package/lib/ui/index.js +2 -1
  154. package/lib/ui/index.min.js +1 -1
  155. package/lib/ui/src/log.js +1 -1
  156. package/lib/ui/src/log.min.js +1 -1
  157. package/package.json +2 -2
  158. package/packages/grid/src/grid.ts +75 -51
  159. package/packages/locale/lang/ar-EG.ts +7 -1
  160. package/packages/locale/lang/de-DE.ts +7 -1
  161. package/packages/locale/lang/en-US.ts +7 -1
  162. package/packages/locale/lang/es-ES.ts +7 -1
  163. package/packages/locale/lang/fr-FR.ts +7 -1
  164. package/packages/locale/lang/hu-HU.ts +7 -1
  165. package/packages/locale/lang/hy-AM.ts +7 -1
  166. package/packages/locale/lang/id-ID.ts +7 -1
  167. package/packages/locale/lang/it-IT.ts +7 -1
  168. package/packages/locale/lang/ja-JP.ts +7 -1
  169. package/packages/locale/lang/ko-KR.ts +7 -1
  170. package/packages/locale/lang/nb-NO.ts +7 -1
  171. package/packages/locale/lang/pt-BR.ts +7 -1
  172. package/packages/locale/lang/ru-RU.ts +7 -1
  173. package/packages/locale/lang/th-TH.ts +7 -1
  174. package/packages/locale/lang/ug-CN.ts +7 -1
  175. package/packages/locale/lang/uk-UA.ts +7 -1
  176. package/packages/locale/lang/vi-VN.ts +7 -1
  177. package/packages/locale/lang/zh-CHT.ts +7 -1
  178. package/packages/locale/lang/zh-CN.ts +7 -1
  179. package/packages/table/module/custom/mixin.ts +6 -3
  180. package/packages/table/module/custom/panel.ts +42 -37
  181. package/packages/table/module/edit/mixin.ts +139 -95
  182. package/packages/table/module/export/export-panel.ts +8 -5
  183. package/packages/table/module/export/import-panel.ts +11 -7
  184. package/packages/table/module/export/mixin.ts +37 -32
  185. package/packages/table/module/filter/panel.ts +25 -10
  186. package/packages/table/module/keyboard/mixin.ts +155 -49
  187. package/packages/table/module/menu/mixin.ts +12 -6
  188. package/packages/table/module/menu/panel.ts +10 -7
  189. package/packages/table/module/validator/mixin.ts +3 -6
  190. package/packages/table/render/index.ts +2 -2
  191. package/packages/table/src/body.ts +43 -25
  192. package/packages/table/src/cell.ts +27 -22
  193. package/packages/table/src/column.ts +14 -10
  194. package/packages/table/src/columnInfo.ts +9 -6
  195. package/packages/table/src/footer.ts +12 -7
  196. package/packages/table/src/group.ts +9 -5
  197. package/packages/table/src/header.ts +16 -9
  198. package/packages/table/src/methods.ts +1174 -1027
  199. package/packages/table/src/props.ts +16 -12
  200. package/packages/table/src/table.ts +117 -70
  201. package/packages/table/src/util.ts +65 -23
  202. package/packages/toolbar/src/toolbar.ts +3 -3
  203. package/packages/ui/index.ts +1 -0
  204. /package/es/{iconfont.1741336976538.ttf → iconfont.1743045564244.ttf} +0 -0
  205. /package/es/{iconfont.1741336976538.woff → iconfont.1743045564244.woff} +0 -0
  206. /package/es/{iconfont.1741336976538.woff2 → iconfont.1743045564244.woff2} +0 -0
  207. /package/lib/{iconfont.1741336976538.ttf → iconfont.1743045564244.ttf} +0 -0
  208. /package/lib/{iconfont.1741336976538.woff → iconfont.1743045564244.woff} +0 -0
  209. /package/lib/{iconfont.1741336976538.woff2 → iconfont.1743045564244.woff2} +0 -0
@@ -26,7 +26,7 @@ function setEditColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
26
26
  }
27
27
  }
28
28
 
29
- function removeCellSelectedClass ($xeTable: VxeTableConstructor) {
29
+ function removeCellSelectedClass ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
30
30
  const el = $xeTable.$refs.refElem as HTMLDivElement
31
31
  if (el) {
32
32
  const cell = el.querySelector('.col--selected')
@@ -36,7 +36,7 @@ function removeCellSelectedClass ($xeTable: VxeTableConstructor) {
36
36
  }
37
37
  }
38
38
 
39
- function syncActivedCell ($xeTable: VxeTableConstructor) {
39
+ function syncActivedCell ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
40
40
  const reactData = $xeTable as unknown as TableReactData
41
41
 
42
42
  const { editStore, tableColumn } = reactData
@@ -52,18 +52,21 @@ function syncActivedCell ($xeTable: VxeTableConstructor) {
52
52
  }
53
53
  }
54
54
 
55
- function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
56
- const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = _vm
55
+ function insertTreeRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, newRecords: any[], isAppend: boolean) {
56
+ const internalData = $xeTable as unknown as TableInternalData
57
+
58
+ const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
59
+ const treeOpts = $xeTable.computeTreeOpts
57
60
  const { rowField, parentField, mapChildrenField } = treeOpts
58
- const childrenField: any = treeOpts.children || treeOpts.childrenField
61
+ const childrenField = treeOpts.children || treeOpts.childrenField
59
62
  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
63
+ newRecords.forEach((item) => {
64
+ const parentRowId = item[parentField]
65
+ const rowid = getRowid($xeTable, item)
66
+ const matchObj = parentRowId ? XEUtils.findTree(tableFullTreeData, (item) => parentRowId === item[rowField], { children: mapChildrenField }) : null
64
67
  if (matchObj) {
65
- const { item: parentRow } = matchObj as any
66
- const parentRest = fullAllDataRowIdData[getRowid(_vm, parentRow)]
68
+ const { item: parentRow } = matchObj
69
+ const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)]
67
70
  const parentLevel = parentRest ? parentRest.level : 0
68
71
  let parentChilds = parentRow[childrenField]
69
72
  let mapChilds = parentRow[mapChildrenField]
@@ -93,14 +96,14 @@ function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
93
96
  })
94
97
  }
95
98
 
96
- function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isInsertNextRow?: any) {
99
+ function handleInsertRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, records: any[], targetRow: any, isInsertNextRow?: any) {
97
100
  const props = $xeTable
98
- const reactData = $xeTable
99
- const internalData = $xeTable
101
+ const reactData = $xeTable as unknown as TableReactData
102
+ const internalData = $xeTable as unknown as TableInternalData
100
103
 
101
104
  const { treeConfig } = props
102
- const { mergeList, editStore } = reactData
103
- const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
105
+ const { mergeList } = reactData
106
+ const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps } = internalData
104
107
  const treeOpts = $xeTable.computeTreeOpts
105
108
  const { transform, rowField, mapChildrenField } = treeOpts
106
109
  const childrenField = treeOpts.children || treeOpts.childrenField
@@ -239,11 +242,11 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
239
242
  }
240
243
  }
241
244
  }
242
- const { insertMaps } = editStore
243
245
  newRecords.forEach(newRow => {
244
246
  const rowid = getRowid($xeTable, newRow)
245
- insertMaps[rowid] = newRow
247
+ insertRowMaps[rowid] = newRow
246
248
  })
249
+ reactData.insertRowFlag++
247
250
  $xeTable.cacheRowMap(false)
248
251
  $xeTable.updateScrollYStatus()
249
252
  $xeTable.handleTableData(treeConfig && transform)
@@ -252,7 +255,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
252
255
  }
253
256
  $xeTable.updateFooter()
254
257
  $xeTable.checkSelectionStatus()
255
- if ($xeTable.scrollYLoad) {
258
+ if (reactData.scrollYLoad) {
256
259
  $xeTable.updateScrollYSpace()
257
260
  }
258
261
  return $xeTable.$nextTick().then(() => {
@@ -266,7 +269,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
266
269
  })
267
270
  }
268
271
 
269
- function handleInsertChildRowAt ($xeTable: VxeTableConstructor, records: any, parentRow: any, targetRow: any, isInsertNextRow?: boolean) {
272
+ function handleInsertChildRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, records: any, parentRow: any, targetRow: any, isInsertNextRow?: boolean) {
270
273
  const props = $xeTable
271
274
 
272
275
  const { treeConfig } = props
@@ -323,6 +326,7 @@ function handleClearEdit ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
323
326
  function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, params: any, evnt: Event | null, isFocus: boolean, isPos: boolean) {
324
327
  const props = $xeTable
325
328
  const reactData = $xeTable as unknown as TableReactData
329
+ const $xeGrid = $xeTable.$xeGrid
326
330
 
327
331
  const { editConfig, mouseConfig } = props
328
332
  const { editStore, tableColumn } = reactData
@@ -340,7 +344,7 @@ function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
340
344
  if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
341
345
  // 判断是否禁用编辑
342
346
  let type: 'edit-disabled' | 'edit-activated' = 'edit-disabled'
343
- if (!beforeEditMethod || beforeEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })) {
347
+ if (!beforeEditMethod || beforeEditMethod({ ...params, $table: $xeTable, $grid: $xeGrid })) {
344
348
  if (mouseConfig) {
345
349
  $xeTable.clearSelected()
346
350
  if ($xeTable.clearCellAreas) {
@@ -368,7 +372,7 @@ function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
368
372
  $xeTable.handleFocus(params, evnt)
369
373
  }
370
374
  if (afterEditMethod) {
371
- afterEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })
375
+ afterEditMethod({ ...params, $table: $xeTable, $grid: $xeGrid })
372
376
  }
373
377
  })
374
378
  }
@@ -494,19 +498,19 @@ export default {
494
498
  * 如果为空则删除所有
495
499
  */
496
500
  _remove (rows: any[]) {
497
- const $xeTable = this
501
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
498
502
  const props = $xeTable
499
- const reactData = $xeTable
500
- const internalData = $xeTable
503
+ const reactData = $xeTable as unknown as TableReactData
504
+ const internalData = $xeTable as unknown as TableInternalData
501
505
 
502
506
  const { treeConfig } = props
503
- const { mergeList, editStore, selectCheckboxMaps } = reactData
504
- const { tableFullTreeData, afterFullData, tableFullData } = internalData
507
+ const { mergeList, editStore } = reactData
508
+ const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps, insertRowMaps, removeRowMaps } = internalData
505
509
  const checkboxOpts = $xeTable.computeCheckboxOpts
506
510
  const treeOpts = $xeTable.computeTreeOpts
507
511
  const { transform, mapChildrenField } = treeOpts
508
512
  const childrenField = treeOpts.children || treeOpts.childrenField
509
- const { actived, removeMaps, insertMaps } = editStore
513
+ const { actived } = editStore
510
514
  const { checkField } = checkboxOpts
511
515
  let delList: any[] = []
512
516
  if (!rows) {
@@ -518,19 +522,18 @@ export default {
518
522
  rows.forEach(row => {
519
523
  if (!$xeTable.isInsertByRow(row)) {
520
524
  const rowid = getRowid($xeTable, row)
521
- removeMaps[rowid] = row
525
+ removeRowMaps[rowid] = row
522
526
  }
523
527
  })
524
528
  // 如果绑定了多选属性,则更新状态
525
529
  if (!checkField) {
526
- const selectRowMaps = { ...selectCheckboxMaps }
527
530
  rows.forEach((row) => {
528
531
  const rowid = getRowid(this, row)
529
- if (selectRowMaps[rowid]) {
530
- delete selectRowMaps[rowid]
532
+ if (selectCheckboxMaps[rowid]) {
533
+ delete selectCheckboxMaps[rowid]
531
534
  }
532
535
  })
533
- this.selectCheckboxMaps = selectRowMaps
536
+ reactData.updateCheckboxFlag++
534
537
  }
535
538
  // 从数据源中移除
536
539
  if (tableFullData === rows) {
@@ -587,10 +590,16 @@ export default {
587
590
  // 从新增中移除已删除的数据
588
591
  rows.forEach((row: any) => {
589
592
  const rowid = getRowid($xeTable, row)
590
- if (insertMaps[rowid]) {
591
- delete insertMaps[rowid]
593
+ if (insertRowMaps[rowid]) {
594
+ delete insertRowMaps[rowid]
595
+ }
596
+ if (pendingRowMaps[rowid]) {
597
+ delete pendingRowMaps[rowid]
592
598
  }
593
599
  })
600
+ reactData.removeRowFlag++
601
+ reactData.insertRowFlag++
602
+ reactData.pendingRowFlag++
594
603
  $xeTable.updateFooter()
595
604
  $xeTable.cacheRowMap(false)
596
605
  $xeTable.handleTableData(treeConfig && transform)
@@ -659,15 +668,12 @@ export default {
659
668
  * 获取新增的临时数据
660
669
  */
661
670
  _getInsertRecords () {
662
- const $xeTable = this
663
- const reactData = $xeTable
664
- const internalData = $xeTable
671
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
672
+ const internalData = $xeTable as unknown as TableInternalData
665
673
 
666
- const { editStore } = reactData
667
- const { fullAllDataRowIdData } = internalData
668
- const { insertMaps } = editStore
674
+ const { fullAllDataRowIdData, insertRowMaps } = internalData
669
675
  const insertRecords: any[] = []
670
- XEUtils.each(insertMaps, (row, rowid) => {
676
+ XEUtils.each(insertRowMaps, (row, rowid) => {
671
677
  if (fullAllDataRowIdData[rowid]) {
672
678
  insertRecords.push(row)
673
679
  }
@@ -678,13 +684,12 @@ export default {
678
684
  * 获取已删除的数据
679
685
  */
680
686
  _getRemoveRecords () {
681
- const $xeTable = this
682
- const reactData = $xeTable
687
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
688
+ const internalData = $xeTable as unknown as TableInternalData
683
689
 
684
- const { editStore } = reactData
685
- const { removeMaps } = editStore
690
+ const { removeRowMaps } = internalData
686
691
  const removeRecords: any[] = []
687
- XEUtils.each(removeMaps, (row) => {
692
+ XEUtils.each(removeRowMaps, (row) => {
688
693
  removeRecords.push(row)
689
694
  })
690
695
  return removeRecords
@@ -695,19 +700,19 @@ export default {
695
700
  * 如果是树表格,子节点更改状态不会影响父节点的更新状态
696
701
  */
697
702
  _getUpdateRecords () {
698
- const $xeTable = this
703
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
704
+ const props = $xeTable
705
+ const internalData = $xeTable as unknown as TableInternalData
699
706
 
700
- const { keepSource, tableFullData, isUpdateByRow, treeConfig, treeOpts, editStore } = this
707
+ const { keepSource, treeConfig } = props
708
+ const { tableFullData } = internalData
709
+ const treeOpts = $xeTable.computeTreeOpts
701
710
  if (keepSource) {
702
- const { actived } = editStore
703
- const { row, column } = actived
704
- if (row || column) {
705
- syncActivedCell($xeTable)
706
- }
711
+ syncActivedCell($xeTable)
707
712
  if (treeConfig) {
708
- return XEUtils.filterTree(tableFullData, row => isUpdateByRow(row), treeOpts)
713
+ return XEUtils.filterTree(tableFullData, row => $xeTable.isUpdateByRow(row), treeOpts)
709
714
  }
710
- return tableFullData.filter((row: any) => isUpdateByRow(row))
715
+ return tableFullData.filter((row) => $xeTable.isUpdateByRow(row))
711
716
  }
712
717
  return []
713
718
  },
@@ -715,7 +720,7 @@ export default {
715
720
  * 处理激活编辑
716
721
  */
717
722
  handleEdit (params: any, evnt: any) {
718
- const $xeTable = this
723
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
719
724
 
720
725
  return handleEditActive($xeTable, params, evnt, true, true)
721
726
  },
@@ -747,7 +752,7 @@ export default {
747
752
  * 清除激活的编辑
748
753
  */
749
754
  _clearEdit (row: any) {
750
- const $xeTable = this
755
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
751
756
 
752
757
  return handleClearEdit($xeTable, null, row)
753
758
  },
@@ -760,42 +765,57 @@ export default {
760
765
  return handleClearEdit($xeTable, evnt, targetRow)
761
766
  },
762
767
  _getActiveRecord () {
768
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
769
+
763
770
  if (process.env.VUE_APP_VXE_ENV === 'development') {
764
771
  warnLog('vxe.error.delFunc', ['getActiveRecord', 'getEditRecord'])
765
772
  }
766
773
  // 即将废弃
767
- return this.getEditRecord()
774
+ return $xeTable.getEditRecord()
768
775
  },
769
776
  _getEditRecord () {
770
- const { $el, editStore, afterFullData } = this
771
- const { actived } = editStore
772
- const { args, row } = actived
773
- if (args && this.findRowIndexOf(afterFullData, row) > -1 && $el.querySelectorAll('.vxe-body--column.col--active').length) {
777
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
778
+ const reactData = $xeTable as unknown as TableReactData
779
+ const internalData = $xeTable as unknown as TableInternalData
780
+
781
+ const { editStore } = reactData
782
+ const { afterFullData } = internalData
783
+ const el = $xeTable.$refs.refElem as HTMLDivElement
784
+ const { args, row } = editStore.actived
785
+ if (args && $xeTable.findRowIndexOf(afterFullData, row) > -1 && el.querySelectorAll('.vxe-body--column.col--active').length) {
774
786
  return Object.assign({}, args)
775
787
  }
776
788
  return null
777
789
  },
778
790
  _isActiveByRow (row: any) {
791
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
792
+
779
793
  if (process.env.VUE_APP_VXE_ENV === 'development') {
780
794
  warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow'])
781
795
  }
782
796
  // 即将废弃
783
- return this.isEditByRow(row)
797
+ return $xeTable.isEditByRow(row)
784
798
  },
785
799
  /**
786
800
  * 判断行是否为激活编辑状态
787
801
  * @param {Row} row 行对象
788
802
  */
789
803
  _isEditByRow (row: any) {
790
- return this.editStore.actived.row === row
804
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
805
+ const reactData = $xeTable as unknown as TableReactData
806
+
807
+ const { editStore } = reactData
808
+ return editStore.actived.row === row
791
809
  },
792
810
  /**
793
811
  * 处理聚焦
794
812
  */
795
813
  handleFocus (params: any) {
796
- const { editOpts } = this
814
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
815
+
797
816
  const { row, column, cell } = params
798
817
  const { editRender } = column
818
+ const editOpts = $xeTable.computeEditOpts
799
819
  if (isEnableConf(editRender)) {
800
820
  const compRender = renderer.get(editRender.name)
801
821
  let autoFocus = editRender.autofocus || editRender.autoFocus
@@ -811,7 +831,7 @@ export default {
811
831
  }
812
832
  // 如果指定了聚焦 class
813
833
  if (XEUtils.isFunction(autoFocus)) {
814
- inputElem = autoFocus.call(this, params)
834
+ inputElem = autoFocus.call($xeTable, params)
815
835
  } else if (autoFocus) {
816
836
  if (autoFocus === true) {
817
837
  // 自动匹配模式,会自动匹配第一个可输入元素
@@ -840,31 +860,33 @@ export default {
840
860
  if (editOpts.autoPos) {
841
861
  if (!column.fixed) {
842
862
  // 显示到可视区中
843
- this.scrollToRow(row, column)
863
+ $xeTable.scrollToRow(row, column)
844
864
  }
845
865
  }
846
866
  }
847
867
  }
848
868
  },
849
869
  _setActiveRow (row: any) {
870
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
871
+
850
872
  if (process.env.VUE_APP_VXE_ENV === 'development') {
851
873
  warnLog('vxe.error.delFunc', ['setActiveRow', 'setEditRow'])
852
874
  }
853
875
  // 即将废弃
854
- return this.setEditRow(row)
876
+ return $xeTable.setEditRow(row)
855
877
  },
856
878
  /**
857
879
  * 激活行编辑
858
880
  */
859
881
  _setEditRow (row: any, fieldOrColumn: any) {
860
- const $xeTable = this
882
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
861
883
 
862
884
  let column = XEUtils.find(this.visibleColumn, column => isEnableConf(column.editRender))
863
885
  let isPos = false
864
886
  if (fieldOrColumn) {
865
887
  isPos = true
866
888
  if (fieldOrColumn !== true) {
867
- column = XEUtils.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn
889
+ column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
868
890
  }
869
891
  }
870
892
  return handleEditCell($xeTable, row, column, isPos)
@@ -880,33 +902,48 @@ export default {
880
902
  * 激活单元格编辑
881
903
  */
882
904
  _setEditCell (row: any, fieldOrColumn: any) {
883
- const $xeTable = this
905
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
884
906
 
885
907
  return handleEditCell($xeTable, row, fieldOrColumn, true)
886
908
  },
887
909
  /**
888
910
  * 只对 trigger=dblclick 有效,选中单元格
889
911
  */
890
- _setSelectCell (row: any, fieldOrColumn: any) {
891
- const { tableData, editOpts, visibleColumn } = this
892
- const column = XEUtils.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn
912
+ _setSelectCell (row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo) {
913
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
914
+ const reactData = $xeTable as unknown as TableReactData
915
+
916
+ const { tableData } = reactData
917
+ const editOpts = $xeTable.computeEditOpts
918
+ const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
893
919
  if (row && column && editOpts.trigger !== 'manual') {
894
- const rowIndex = this.findRowIndexOf(tableData, row)
920
+ const rowIndex = $xeTable.findRowIndexOf(tableData, row)
895
921
  if (rowIndex > -1) {
896
- const cell = this.getCellElement(row, column)
897
- const params = { row, rowIndex, column, columnIndex: visibleColumn.indexOf(column), cell }
898
- this.handleSelected(params, {})
922
+ const cell = $xeTable.getCellElement(row, column)
923
+ const params = {
924
+ row,
925
+ rowIndex,
926
+ column,
927
+ columnIndex: $xeTable.getColumnIndex(column),
928
+ cell
929
+ }
930
+ $xeTable.handleSelected(params, {})
899
931
  }
900
932
  }
901
- return this.$nextTick()
933
+ return $xeTable.$nextTick()
902
934
  },
903
935
  /**
904
936
  * 处理选中源
905
937
  */
906
938
  handleSelected (params: any, evnt: any) {
907
- const $xeTable = this
939
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
940
+ const props = $xeTable
941
+ const reactData = $xeTable as unknown as TableReactData
908
942
 
909
- const { mouseConfig, mouseOpts, editOpts, editStore } = this
943
+ const { mouseConfig } = props
944
+ const { editStore } = reactData
945
+ const mouseOpts = $xeTable.computeMouseOpts
946
+ const editOpts = $xeTable.computeEditOpts
910
947
  const { actived, selected } = editStore
911
948
  const { row, column } = params
912
949
  const isMouseSelected = mouseConfig && mouseOpts.selected
@@ -914,22 +951,24 @@ export default {
914
951
  if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
915
952
  if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
916
953
  handleClearEdit($xeTable, evnt)
917
- this.clearSelected(evnt)
918
- this.clearCellAreas(evnt)
919
- this.clearCopyCellArea(evnt)
954
+ $xeTable.clearSelected()
955
+ if ($xeTable.clearCellAreas) {
956
+ $xeTable.clearCellAreas()
957
+ $xeTable.clearCopyCellArea()
958
+ }
920
959
  selected.args = params
921
960
  selected.row = row
922
961
  selected.column = column
923
962
  if (isMouseSelected) {
924
963
  this.addCellSelectedClass()
925
964
  }
926
- this.focus()
965
+ $xeTable.focus()
927
966
  if (evnt) {
928
- this.emitEvent('cell-selected', params, evnt)
967
+ $xeTable.dispatchEvent('cell-selected', params, evnt)
929
968
  }
930
969
  }
931
970
  }
932
- return this.$nextTick()
971
+ return $xeTable.$nextTick()
933
972
  }
934
973
  return selectMethod()
935
974
  },
@@ -937,7 +976,11 @@ export default {
937
976
  * 获取选中的单元格
938
977
  */
939
978
  _getSelectedCell () {
940
- const { args, column } = this.editStore.selected
979
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
980
+ const reactData = $xeTable as unknown as TableReactData
981
+
982
+ const { editStore } = reactData
983
+ const { args, column } = editStore.selected
941
984
  if (args && column) {
942
985
  return Object.assign({}, args)
943
986
  }
@@ -947,14 +990,15 @@ export default {
947
990
  * 清除所选中源状态
948
991
  */
949
992
  _clearSelected () {
950
- const $xeTable = this
993
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
994
+ const reactData = $xeTable as unknown as TableReactData
951
995
 
952
- const { selected } = this.editStore
996
+ const { editStore } = reactData
997
+ const { selected } = editStore
953
998
  selected.row = null
954
999
  selected.column = null
955
- this.reColTitleSdCls()
956
1000
  removeCellSelectedClass($xeTable)
957
- return this.$nextTick()
1001
+ return $xeTable.$nextTick()
958
1002
  },
959
1003
  reColTitleSdCls () {
960
1004
  const headerElem = this.elemStore['main-header-list']
@@ -963,8 +1007,8 @@ export default {
963
1007
  }
964
1008
  },
965
1009
  addCellSelectedClass () {
966
- const $xeTable = this
967
- const reactData = $xeTable as TableReactData
1010
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1011
+ const reactData = $xeTable as unknown as TableReactData
968
1012
 
969
1013
  const { editStore } = reactData
970
1014
  const { selected } = editStore
@@ -5,6 +5,7 @@ import { formatText } from '../../../ui/src/utils'
5
5
  import { errLog } from '../../../ui/src/log'
6
6
 
7
7
  import type { VxeModalComponent, VxeInputComponent, VxeCheckboxComponent, VxeSelectComponent, VxeButtonComponent } from 'vxe-pc-ui'
8
+ import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../../types'
8
9
 
9
10
  const { getI18n, getIcon, globalMixins, renderEmptyElement } = VxeUI
10
11
 
@@ -84,7 +85,8 @@ export default {
84
85
  })
85
86
  },
86
87
  render (this: any, h: CreateElement) {
87
- const $xeTable = this.$xeTable
88
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
89
+ const $xeGrid = $xeTable.$xeGrid
88
90
 
89
91
  const { _e, checkedAll, isAll: isAllChecked, isIndeterminate: isAllIndeterminate, showSheet, supportMerge, supportStyle, defaultOptions, storeData } = this
90
92
  const { hasTree, hasMerge, isPrint, hasColgroup, columns } = storeData
@@ -168,7 +170,7 @@ export default {
168
170
  default: () => {
169
171
  const params = {
170
172
  $table: $xeTable,
171
- $grid: $xeTable.xegrid,
173
+ $grid: $xeGrid,
172
174
  options: defaultOptions,
173
175
  columns,
174
176
  params: defaultOptions.params as any
@@ -437,7 +439,7 @@ export default {
437
439
  footer: () => {
438
440
  const params = {
439
441
  $table: $xeTable,
440
- $grid: $xeTable.xegrid,
442
+ $grid: $xeGrid,
441
443
  options: defaultOptions,
442
444
  columns,
443
445
  params: defaultOptions.params as any
@@ -541,9 +543,10 @@ export default {
541
543
  }
542
544
  },
543
545
  printEvent () {
544
- const $xetable = this.$parent
546
+ const $xeTable = this.$parent as VxeTableConstructor & VxeTablePrivateMethods
547
+
545
548
  this.storeData.visible = false
546
- $xetable.print(Object.assign({}, $xetable.printOpts, this.getExportOption()))
549
+ $xeTable.print(Object.assign({}, $xeTable.printOpts, this.getExportOption()))
547
550
  },
548
551
  exportEvent () {
549
552
  const $xeTable = this.$xeTable
@@ -5,6 +5,7 @@ import { parseFile } from '../../../ui/src/utils'
5
5
  import { errLog } from '../../../ui/src/log'
6
6
 
7
7
  import type { VxeModalComponent, VxeSelectComponent, VxeButtonComponent } from 'vxe-pc-ui'
8
+ import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../../types'
8
9
 
9
10
  const { getI18n, getIcon, globalMixins, renderEmptyElement } = VxeUI
10
11
 
@@ -68,7 +69,8 @@ export default {
68
69
  })
69
70
  },
70
71
  render (this: any, h: CreateElement) {
71
- const $xeTable = this.$xeTable
72
+ const $xeTable = this.$parent as VxeTableConstructor & VxeTablePrivateMethods
73
+ const $xeGrid = $xeTable.$xeGrid
72
74
 
73
75
  const { hasFile, loading, parseTypeLabel, defaultOptions, storeData, selectName } = this
74
76
  const slots = defaultOptions.slots || {}
@@ -105,7 +107,7 @@ export default {
105
107
  default: () => {
106
108
  const params = {
107
109
  $table: $xeTable,
108
- $grid: $xeTable.xegrid,
110
+ $grid: $xeGrid,
109
111
  options: defaultOptions,
110
112
  params: defaultOptions.params as any
111
113
  }
@@ -196,7 +198,7 @@ export default {
196
198
  footer: () => {
197
199
  const params = {
198
200
  $table: $xeTable,
199
- $grid: $xeTable.xegrid,
201
+ $grid: $xeGrid,
200
202
  options: defaultOptions,
201
203
  params: defaultOptions.params as any
202
204
  }
@@ -238,8 +240,9 @@ export default {
238
240
  })
239
241
  },
240
242
  selectFileEvent () {
241
- const $xetable = this.$parent
242
- $xetable.readFile(this.defaultOptions).then((params: any) => {
243
+ const $xeTable = this.$parent as VxeTableConstructor & VxeTablePrivateMethods
244
+
245
+ $xeTable.readFile(this.defaultOptions).then((params: any) => {
243
246
  const { file } = params
244
247
  Object.assign(this.storeData, parseFile(file), { file })
245
248
  }).catch((e: any) => e)
@@ -257,9 +260,10 @@ export default {
257
260
  this.storeData.visible = false
258
261
  },
259
262
  importEvent () {
260
- const $xetable = this.$parent
263
+ const $xeTable = this.$parent as VxeTableConstructor & VxeTablePrivateMethods
264
+
261
265
  this.loading = true
262
- $xetable.importByFile(this.storeData.file, Object.assign({}, $xetable.importOpts, this.defaultOptions)).then(() => {
266
+ $xeTable.importByFile(this.storeData.file, Object.assign({}, $xeTable.importOpts, this.defaultOptions)).then(() => {
263
267
  this.loading = false
264
268
  this.storeData.visible = false
265
269
  }).catch(() => {