vxe-table 3.14.0-beta.9 → 3.14.0

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 +17 -11
  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 -2
  34. package/es/table/render/index.js +2 -2
  35. package/es/table/src/body.js +39 -20
  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 +761 -698
  43. package/es/table/src/props.js +4 -0
  44. package/es/table/src/table.js +85 -49
  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 +1558 -1232
  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 +19 -13
  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 +3 -3
  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 +47 -20
  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 +898 -825
  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 +93 -52
  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 +20 -14
  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 +2 -2
  190. package/packages/table/render/index.ts +2 -2
  191. package/packages/table/src/body.ts +39 -20
  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 +840 -734
  199. package/packages/table/src/props.ts +16 -12
  200. package/packages/table/src/table.ts +99 -52
  201. package/packages/table/src/util.ts +63 -21
  202. package/packages/toolbar/src/toolbar.ts +3 -3
  203. package/packages/ui/index.ts +1 -0
  204. /package/es/{iconfont.1741336976538.ttf → iconfont.1742955973002.ttf} +0 -0
  205. /package/es/{iconfont.1741336976538.woff → iconfont.1742955973002.woff} +0 -0
  206. /package/es/{iconfont.1741336976538.woff2 → iconfont.1742955973002.woff2} +0 -0
  207. /package/lib/{iconfont.1741336976538.ttf → iconfont.1742955973002.ttf} +0 -0
  208. /package/lib/{iconfont.1741336976538.woff → iconfont.1742955973002.woff} +0 -0
  209. /package/lib/{iconfont.1741336976538.woff2 → iconfont.1742955973002.woff2} +0 -0
@@ -99,8 +99,9 @@ const renderSimplePanel = (h: CreateElement, _vm: any) => {
99
99
 
100
100
  const props = _vm
101
101
 
102
- const $xeTable = _vm.$xeTable
103
- const reactData = $xeTable
102
+ const $xeTable = _vm.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
103
+ const reactData = $xeTable as unknown as TableReactData
104
+ const $xeGrid = $xeTable.$xeGrid
104
105
 
105
106
  const { customStore } = props
106
107
  const { isCustomStatus, customColumnList } = reactData
@@ -128,7 +129,7 @@ const renderSimplePanel = (h: CreateElement, _vm: any) => {
128
129
  }
129
130
  const params = {
130
131
  $table: $xeTable,
131
- $grid: $xeTable.xegrid,
132
+ $grid: $xeGrid,
132
133
  columns: customColumnList,
133
134
  isAllChecked,
134
135
  isAllIndeterminate,
@@ -268,7 +269,7 @@ const renderSimplePanel = (h: CreateElement, _vm: any) => {
268
269
  class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
269
270
  'is--active': customStore.visible
270
271
  }],
271
- style: maxHeight && !['left', 'right'].includes(placement)
272
+ style: maxHeight && !['left', 'right'].includes(placement || '')
272
273
  ? {
273
274
  maxHeight: `${maxHeight}px`
274
275
  }
@@ -406,9 +407,10 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
406
407
 
407
408
  const props = _vm
408
409
 
409
- const $xeTable = _vm.$xeTable
410
+ const $xeTable = _vm.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
410
411
  const tableProps = $xeTable
411
- const reactData = $xeTable
412
+ const reactData = $xeTable as unknown as TableReactData
413
+ const $xeGrid = $xeTable.$xeGrid
412
414
 
413
415
  const { customStore } = props
414
416
  const { resizable: allResizable } = tableProps
@@ -436,7 +438,7 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
436
438
  const isAllIndeterminate = customStore.isIndeterminate
437
439
  const params = {
438
440
  $table: $xeTable,
439
- $grid: $xeTable.xegrid,
441
+ $grid: $xeGrid,
440
442
  columns: customColumnList,
441
443
  isAllChecked,
442
444
  isAllIndeterminate,
@@ -829,9 +831,6 @@ export default {
829
831
  inject: {
830
832
  $xeTable: {
831
833
  default: null
832
- },
833
- $xetable: {
834
- default: null
835
834
  }
836
835
  },
837
836
  data () {
@@ -851,8 +850,9 @@ export default {
851
850
  const VxeUIRadioGroupComponent = VxeUI.getComponent<VxeRadioGroupComponent>('VxeRadioGroup')
852
851
 
853
852
  this.$nextTick(() => {
854
- const { $xetable } = this
855
- const { customOpts } = $xetable
853
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
854
+
855
+ const { customOpts } = $xeTable
856
856
  const { mode } = customOpts
857
857
  if (!VxeUIModalComponent) {
858
858
  errLog('vxe.error.reqComp', ['vxe-modal'])
@@ -882,16 +882,20 @@ export default {
882
882
  },
883
883
  methods: {
884
884
  handleWrapperMouseenterEvent (evnt: any) {
885
- const { $xetable, customStore } = this
885
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
886
+
887
+ const { customStore } = this
886
888
  customStore.activeWrapper = true
887
- $xetable.customOpenEvent(evnt)
889
+ $xeTable.customOpenEvent(evnt)
888
890
  },
889
891
  handleWrapperMouseleaveEvent (evnt: any) {
890
- const { $xetable, customStore } = this
892
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
893
+
894
+ const { customStore } = this
891
895
  customStore.activeWrapper = false
892
896
  setTimeout(() => {
893
897
  if (!customStore.activeBtn && !customStore.activeWrapper) {
894
- $xetable.customCloseEvent(evnt)
898
+ $xeTable.customCloseEvent(evnt)
895
899
  }
896
900
  }, 300)
897
901
  },
@@ -899,8 +903,8 @@ export default {
899
903
  return {}
900
904
  },
901
905
  confirmCustomEvent ({ $event }: any) {
902
- const $xeTable = this.$xeTable
903
- const reactData = $xeTable
906
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
907
+ const reactData = $xeTable as unknown as TableReactData
904
908
 
905
909
  reactData.isCustomStatus = true
906
910
  $xeTable.saveCustom()
@@ -908,23 +912,24 @@ export default {
908
912
  $xeTable.emitCustomEvent('confirm', $event)
909
913
  },
910
914
  cancelCloseEvent ({ $event }: any) {
911
- const $xeTable = this.$xeTable
915
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
912
916
 
913
917
  $xeTable.closeCustom()
914
918
  $xeTable.emitCustomEvent('close', $event)
915
919
  },
916
920
  cancelCustomEvent ({ $event }: any) {
917
- const $xeTable = this.$xeTable
921
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
918
922
 
919
923
  $xeTable.cancelCustom()
920
924
  $xeTable.closeCustom()
921
925
  $xeTable.emitCustomEvent('cancel', $event)
922
926
  },
923
927
  handleResetCustomEvent (evnt: any) {
924
- const { $xetable } = this
925
- $xetable.resetCustom(true)
926
- $xetable.closeCustom()
927
- $xetable.emitCustomEvent('reset', evnt)
928
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
929
+
930
+ $xeTable.resetCustom(true)
931
+ $xeTable.closeCustom()
932
+ $xeTable.emitCustomEvent('reset', evnt)
928
933
  },
929
934
  resetCustomEvent (evnt: any) {
930
935
  if (VxeUI.modal) {
@@ -957,8 +962,8 @@ export default {
957
962
  }
958
963
  },
959
964
  handleOptionCheck (column: any) {
960
- const $xeTable = this.$xeTable
961
- const reactData = $xeTable
965
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
966
+ const reactData = $xeTable as unknown as TableReactData
962
967
 
963
968
  const { customColumnList } = reactData
964
969
  const matchObj = XEUtils.findTree(customColumnList, item => item === column) as any
@@ -972,8 +977,8 @@ export default {
972
977
  }
973
978
  },
974
979
  changeCheckboxOption (column: any) {
975
- const $xeTable = this.$xeTable
976
- const reactData = $xeTable
980
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
981
+ const reactData = $xeTable as unknown as TableReactData
977
982
 
978
983
  const customOpts = $xeTable.computeCustomOpts
979
984
  const isChecked = !column.renderVisible
@@ -996,8 +1001,8 @@ export default {
996
1001
  $xeTable.checkCustomStatus()
997
1002
  },
998
1003
  changeColumnWidth (column: VxeTableDefines.ColumnInfo) {
999
- const $xeTable = this.$xetable
1000
- const reactData = $xeTable
1004
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
1005
+ const reactData = $xeTable as unknown as TableReactData
1001
1006
 
1002
1007
  const customOpts = $xeTable.computeCustomOpts
1003
1008
  if (customOpts.immediate) {
@@ -1011,8 +1016,8 @@ export default {
1011
1016
  }
1012
1017
  },
1013
1018
  changeFixedOption (column: any, colFixed: any) {
1014
- const $xeTable = this.$xetable
1015
- const reactData = $xeTable
1019
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
1020
+ const reactData = $xeTable as unknown as TableReactData
1016
1021
 
1017
1022
  const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
1018
1023
  const customOpts = $xeTable.computeCustomOpts
@@ -1048,12 +1053,12 @@ export default {
1048
1053
  }
1049
1054
  },
1050
1055
  allOptionEvent () {
1051
- const { $xetable } = this
1056
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
1052
1057
 
1053
- $xetable.toggleCustomAllCheckbox()
1058
+ $xeTable.toggleCustomAllCheckbox()
1054
1059
  },
1055
1060
  sortMousedownEvent (evnt: MouseEvent) {
1056
- const $xeTable = this.$xetable
1061
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
1057
1062
 
1058
1063
  const btnEl = evnt.currentTarget as HTMLElement
1059
1064
  const cellEl = btnEl.parentElement as HTMLElement
@@ -1081,7 +1086,7 @@ export default {
1081
1086
  }
1082
1087
  },
1083
1088
  sortDragendEvent (evnt: any) {
1084
- const $xeTable = this.$xetable as VxeTableConstructor & VxeTablePrivateMethods
1089
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
1085
1090
  const tableProps = $xeTable
1086
1091
  const reactData = $xeTable as unknown as TableReactData
1087
1092
  const internalData = $xeTable as unknown as TableInternalData
@@ -1269,7 +1274,7 @@ export default {
1269
1274
  removeClass(trEl, 'active--drag-origin')
1270
1275
  },
1271
1276
  sortDragoverEvent (evnt: any) {
1272
- const $xeTable = this.$xetable
1277
+ const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
1273
1278
 
1274
1279
  const { dragCol } = this
1275
1280
 
@@ -323,6 +323,7 @@ function handleClearEdit ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
323
323
  function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, params: any, evnt: Event | null, isFocus: boolean, isPos: boolean) {
324
324
  const props = $xeTable
325
325
  const reactData = $xeTable as unknown as TableReactData
326
+ const $xeGrid = $xeTable.$xeGrid
326
327
 
327
328
  const { editConfig, mouseConfig } = props
328
329
  const { editStore, tableColumn } = reactData
@@ -340,7 +341,7 @@ function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
340
341
  if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
341
342
  // 判断是否禁用编辑
342
343
  let type: 'edit-disabled' | 'edit-activated' = 'edit-disabled'
343
- if (!beforeEditMethod || beforeEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })) {
344
+ if (!beforeEditMethod || beforeEditMethod({ ...params, $table: $xeTable, $grid: $xeGrid })) {
344
345
  if (mouseConfig) {
345
346
  $xeTable.clearSelected()
346
347
  if ($xeTable.clearCellAreas) {
@@ -368,7 +369,7 @@ function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
368
369
  $xeTable.handleFocus(params, evnt)
369
370
  }
370
371
  if (afterEditMethod) {
371
- afterEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })
372
+ afterEditMethod({ ...params, $table: $xeTable, $grid: $xeGrid })
372
373
  }
373
374
  })
374
375
  }
@@ -494,19 +495,20 @@ export default {
494
495
  * 如果为空则删除所有
495
496
  */
496
497
  _remove (rows: any[]) {
497
- const $xeTable = this
498
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
498
499
  const props = $xeTable
499
- const reactData = $xeTable
500
- const internalData = $xeTable
500
+ const reactData = $xeTable as unknown as TableReactData
501
+ const internalData = $xeTable as unknown as TableInternalData
501
502
 
502
503
  const { treeConfig } = props
503
- const { mergeList, editStore, selectCheckboxMaps } = reactData
504
- const { tableFullTreeData, afterFullData, tableFullData } = internalData
504
+ const { mergeList, editStore } = reactData
505
+ const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps } = internalData
505
506
  const checkboxOpts = $xeTable.computeCheckboxOpts
506
507
  const treeOpts = $xeTable.computeTreeOpts
507
508
  const { transform, mapChildrenField } = treeOpts
508
509
  const childrenField = treeOpts.children || treeOpts.childrenField
509
- const { actived, removeMaps, insertMaps } = editStore
510
+ const { actived, removeMaps } = editStore
511
+ const insertDataRowMaps = Object.assign({}, editStore.insertMaps)
510
512
  const { checkField } = checkboxOpts
511
513
  let delList: any[] = []
512
514
  if (!rows) {
@@ -523,14 +525,13 @@ export default {
523
525
  })
524
526
  // 如果绑定了多选属性,则更新状态
525
527
  if (!checkField) {
526
- const selectRowMaps = { ...selectCheckboxMaps }
527
528
  rows.forEach((row) => {
528
529
  const rowid = getRowid(this, row)
529
- if (selectRowMaps[rowid]) {
530
- delete selectRowMaps[rowid]
530
+ if (selectCheckboxMaps[rowid]) {
531
+ delete selectCheckboxMaps[rowid]
531
532
  }
532
533
  })
533
- this.selectCheckboxMaps = selectRowMaps
534
+ reactData.updateCheckboxFlag++
534
535
  }
535
536
  // 从数据源中移除
536
537
  if (tableFullData === rows) {
@@ -587,10 +588,15 @@ export default {
587
588
  // 从新增中移除已删除的数据
588
589
  rows.forEach((row: any) => {
589
590
  const rowid = getRowid($xeTable, row)
590
- if (insertMaps[rowid]) {
591
- delete insertMaps[rowid]
591
+ if (insertDataRowMaps[rowid]) {
592
+ delete insertDataRowMaps[rowid]
593
+ }
594
+ if (pendingRowMaps[rowid]) {
595
+ delete pendingRowMaps[rowid]
592
596
  }
593
597
  })
598
+ editStore.insertMaps = insertDataRowMaps
599
+ reactData.pendingRowFlag++
594
600
  $xeTable.updateFooter()
595
601
  $xeTable.cacheRowMap(false)
596
602
  $xeTable.handleTableData(treeConfig && transform)
@@ -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(() => {
@@ -204,27 +204,27 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
204
204
  })
205
205
  }
206
206
 
207
- function getExportData ($xetable: any, opts: VxeTablePropTypes.ExportHandleOptions) {
207
+ function getExportData ($xeTable: any, opts: VxeTablePropTypes.ExportHandleOptions) {
208
208
  const { columns, dataFilterMethod } = opts
209
209
  let datas = opts.data
210
210
  if (dataFilterMethod) {
211
211
  datas = datas.filter((row: any, index: any) => dataFilterMethod({ row, $rowIndex: index }))
212
212
  }
213
- return getBodyLabelData($xetable, opts, columns, datas)
213
+ return getBodyLabelData($xeTable, opts, columns, datas)
214
214
  }
215
215
 
216
216
  function getBooleanValue (cellValue: any) {
217
217
  return cellValue === 'TRUE' || cellValue === 'true' || cellValue === true
218
218
  }
219
219
 
220
- function getHeaderTitle ($xetable: any, opts: any, column: any) {
221
- const { columnOpts } = $xetable
220
+ function getHeaderTitle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: any, column: any) {
221
+ const columnOpts = $xeTable.computeColumnOpts
222
222
  const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod
223
- return headExportMethod ? headExportMethod({ column, options: opts, $table: $xetable }) : ((opts.original ? column.field : column.getTitle()) || '')
223
+ return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.original ? column.field : column.getTitle()) || '')
224
224
  }
225
225
 
226
- function getFooterCellValue ($xetable: any, opts: any, row: any, column: any) {
227
- const { columnOpts } = $xetable
226
+ function getFooterCellValue ($xeTable: any, opts: any, row: any, column: any) {
227
+ const columnOpts = $xeTable.computeColumnOpts
228
228
  const renderOpts = column.editRender || column.cellRender
229
229
  let footLabelMethod = column.footerExportMethod
230
230
  if (!footLabelMethod && renderOpts && renderOpts.name) {
@@ -236,9 +236,9 @@ function getFooterCellValue ($xetable: any, opts: any, row: any, column: any) {
236
236
  if (!footLabelMethod) {
237
237
  footLabelMethod = columnOpts.footerExportMethod
238
238
  }
239
- const _columnIndex = $xetable.getVTColumnIndex(column)
239
+ const _columnIndex = $xeTable.getVTColumnIndex(column)
240
240
  if (footLabelMethod) {
241
- return footLabelMethod({ $table: $xetable, items: row, itemIndex: _columnIndex, row, _columnIndex, column, options: opts })
241
+ return footLabelMethod({ $table: $xeTable, items: row, itemIndex: _columnIndex, row, _columnIndex, column, options: opts })
242
242
  }
243
243
  // 兼容老模式
244
244
  if (XEUtils.isArray(row)) {
@@ -282,7 +282,7 @@ function toTxtCellLabel (val: any) {
282
282
  return val
283
283
  }
284
284
 
285
- function toCsv ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
285
+ function toCsv ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
286
286
  const reactData = $xeTable as unknown as TableReactData
287
287
 
288
288
  let content = csvBOM
@@ -302,7 +302,7 @@ function toCsv ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHan
302
302
  return content
303
303
  }
304
304
 
305
- function toTxt ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
305
+ function toTxt ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
306
306
  const reactData = $xeTable as unknown as TableReactData
307
307
 
308
308
  let content = ''
@@ -322,7 +322,7 @@ function toTxt ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHan
322
322
  return content
323
323
  }
324
324
 
325
- function hasEllipsis ($xeTable: VxeTableConstructor, column: VxeTableDefines.ColumnInfo, property: 'showOverflow' | 'showHeaderOverflow', allColumnOverflow: VxeTablePropTypes.ShowOverflow | undefined) {
325
+ function hasEllipsis ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, column: VxeTableDefines.ColumnInfo, property: 'showOverflow' | 'showHeaderOverflow', allColumnOverflow: VxeTablePropTypes.ShowOverflow | undefined) {
326
326
  const reactData = $xeTable as unknown as TableReactData
327
327
 
328
328
  const columnOverflow = column[property]
@@ -339,7 +339,7 @@ function hasEllipsis ($xeTable: VxeTableConstructor, column: VxeTableDefines.Col
339
339
  return isEllipsis
340
340
  }
341
341
 
342
- function toHtml ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
342
+ function toHtml ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
343
343
  const props = $xeTable
344
344
  const reactData = $xeTable as unknown as TableReactData
345
345
 
@@ -506,7 +506,9 @@ function toHtml ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHa
506
506
  return isPrint ? tables.join('') : createHtmlPage(opts, tables.join(''))
507
507
  }
508
508
 
509
- function toXML ($xetable: any, opts: any, columns: any[], datas: any[]) {
509
+ function toXML ($xeTable: any, opts: any, columns: any[], datas: any[]) {
510
+ const reactData = $xeTable as unknown as TableReactData
511
+
510
512
  let xml = [
511
513
  '<?xml version="1.0"?>',
512
514
  '<?mso-application progid="Excel.Sheet"?>',
@@ -527,22 +529,22 @@ function toXML ($xetable: any, opts: any, columns: any[], datas: any[]) {
527
529
  columns.map(column => `<Column ss:Width="${column.renderWidth}"/>`).join('')
528
530
  ].join('')
529
531
  if (opts.isHeader) {
530
- xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getHeaderTitle($xetable, opts, column)}</Data></Cell>`).join('')}</Row>`
532
+ xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getHeaderTitle($xeTable, opts, column)}</Data></Cell>`).join('')}</Row>`
531
533
  }
532
534
  datas.forEach(row => {
533
535
  xml += '<Row>' + columns.map(column => `<Cell><Data ss:Type="String">${row[column.id]}</Data></Cell>`).join('') + '</Row>'
534
536
  })
535
537
  if (opts.isFooter) {
536
- const footerTableData = $xetable.footerTableData
538
+ const { footerTableData } = reactData
537
539
  const footers = getFooterData(opts, footerTableData)
538
540
  footers.forEach((row: any) => {
539
- xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getFooterCellValue($xetable, opts, row, column)}</Data></Cell>`).join('')}</Row>`
541
+ xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getFooterCellValue($xeTable, opts, row, column)}</Data></Cell>`).join('')}</Row>`
540
542
  })
541
543
  }
542
544
  return `${xml}</Table></Worksheet></Workbook>`
543
545
  }
544
546
 
545
- function getContent ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
547
+ function getContent ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
546
548
  if (columns.length) {
547
549
  switch (opts.type) {
548
550
  case 'csv':
@@ -590,7 +592,7 @@ export function saveLocalFile (options: any) {
590
592
  return Promise.reject(new Error(getI18n('vxe.error.notExp')))
591
593
  }
592
594
 
593
- function downloadFile ($xetable: any, opts: any, content: any) {
595
+ function downloadFile ($xeTable: any, opts: any, content: any) {
594
596
  const { filename, type, download } = opts
595
597
  if (!download) {
596
598
  const blob = getExportBlobByContent(content, opts)
@@ -886,8 +888,10 @@ function handleImport ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, c
886
888
  }
887
889
  }
888
890
 
889
- function handleFileImport ($xetable: any, file: any, opts: any) {
890
- const { importOpts } = $xetable
891
+ function handleFileImport ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, file: any, opts: any) {
892
+ const internalData = $xeTable as unknown as TableInternalData
893
+
894
+ const importOpts = $xeTable.computeImportOpts
891
895
  const { importMethod, afterImportMethod } = opts
892
896
  const { type, filename } = parseFile(file)
893
897
 
@@ -907,21 +911,21 @@ function handleFileImport ($xetable: any, file: any, opts: any) {
907
911
  const rest = new Promise((resolve, reject) => {
908
912
  const _importResolve = (params: any) => {
909
913
  resolve(params)
910
- $xetable._importResolve = null
911
- $xetable._importReject = null
914
+ ;($xeTable as any)._importResolve = null
915
+ ;($xeTable as any)._importReject = null
912
916
  }
913
917
  const _importReject = (params: any) => {
914
918
  reject(params)
915
- $xetable._importResolve = null
916
- $xetable._importReject = null
919
+ ;($xeTable as any)._importResolve = null
920
+ ;($xeTable as any)._importReject = null
917
921
  }
918
- $xetable._importResolve = _importResolve
919
- $xetable._importReject = _importReject
922
+ ;($xeTable as any)._importResolve = _importResolve
923
+ ;($xeTable as any)._importReject = _importReject
920
924
  if (window.FileReader) {
921
925
  const options = Object.assign({ mode: 'insertTop' }, opts, { type, filename })
922
926
  if (options.remote) {
923
927
  if (importMethod) {
924
- Promise.resolve(importMethod({ file, options, $table: $xetable })).then(() => {
928
+ Promise.resolve(importMethod({ file, options, $table: $xeTable })).then(() => {
925
929
  _importResolve({ status: true })
926
930
  }).catch(() => {
927
931
  _importResolve({ status: true })
@@ -930,14 +934,15 @@ function handleFileImport ($xetable: any, file: any, opts: any) {
930
934
  _importResolve({ status: true })
931
935
  }
932
936
  } else {
933
- $xetable.preventEvent(null, 'event.import', { file, options, columns: $xetable.tableFullColumn }, () => {
937
+ const { tableFullColumn } = internalData
938
+ $xeTable.preventEvent(null, 'event.import', { file, options, columns: tableFullColumn }, () => {
934
939
  const reader = new FileReader()
935
940
  reader.onerror = () => {
936
941
  errLog('vxe.error.notType', [type])
937
942
  _importReject({ status: false })
938
943
  }
939
944
  reader.onload = (e: any) => {
940
- handleImport($xetable, e.target.result, options)
945
+ handleImport($xeTable, e.target.result, options)
941
946
  }
942
947
  reader.readAsText(file, options.encoding || 'UTF-8')
943
948
  })
@@ -951,11 +956,11 @@ function handleFileImport ($xetable: any, file: any, opts: any) {
951
956
 
952
957
  return rest.then(() => {
953
958
  if (afterImportMethod) {
954
- afterImportMethod({ status: true, options: opts, $table: $xetable })
959
+ afterImportMethod({ status: true, options: opts, $table: $xeTable })
955
960
  }
956
961
  }).catch((e) => {
957
962
  if (afterImportMethod) {
958
- afterImportMethod({ status: false, options: opts, $table: $xetable })
963
+ afterImportMethod({ status: false, options: opts, $table: $xeTable })
959
964
  }
960
965
  return Promise.reject(e)
961
966
  })