vxe-table 3.9.0-rc.9 → 3.9.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 (222) hide show
  1. package/README.md +80 -9
  2. package/es/grid/src/grid.js +116 -62
  3. package/es/grid/style.css +0 -1
  4. package/es/grid/style.min.css +1 -1
  5. package/es/index.esm.js +22 -3
  6. package/es/locale/lang/en-US.js +6 -2
  7. package/es/locale/lang/es-ES.js +5 -1
  8. package/es/locale/lang/hu-HU.js +5 -1
  9. package/es/locale/lang/ja-JP.js +5 -1
  10. package/es/locale/lang/ko-KR.js +5 -1
  11. package/es/locale/lang/pt-BR.js +5 -1
  12. package/es/locale/lang/ru-RU.js +5 -1
  13. package/es/locale/lang/uk-UA.js +5 -1
  14. package/es/locale/lang/vi-VN.js +5 -1
  15. package/es/locale/lang/zh-CHT.js +5 -1
  16. package/es/locale/lang/zh-CN.js +5 -1
  17. package/es/style.css +1 -1
  18. package/es/style.min.css +1 -1
  19. package/es/table/module/custom/panel.js +183 -173
  20. package/es/table/module/edit/mixin.js +35 -40
  21. package/es/table/module/export/export-panel.js +32 -4
  22. package/es/table/module/export/import-panel.js +25 -6
  23. package/es/table/module/export/mixin.js +11 -11
  24. package/es/table/module/menu/mixin.js +2 -2
  25. package/es/table/module/validator/mixin.js +4 -4
  26. package/es/table/render/index.js +17 -11
  27. package/es/table/src/body.js +1 -0
  28. package/es/table/src/columnInfo.js +3 -3
  29. package/es/table/src/methods.js +69 -55
  30. package/es/table/src/props.js +65 -15
  31. package/es/table/src/table.js +63 -29
  32. package/es/table/src/util.js +3 -2
  33. package/es/table/style.css +37 -48
  34. package/es/table/style.min.css +1 -1
  35. package/es/toolbar/src/toolbar.js +21 -7
  36. package/es/toolbar/style.css +0 -1
  37. package/es/toolbar/style.min.css +1 -1
  38. package/es/ui/index.js +5 -3
  39. package/es/ui/src/log.js +1 -1
  40. package/es/vxe-grid/style.css +0 -1
  41. package/es/vxe-grid/style.min.css +1 -1
  42. package/es/vxe-table/style.css +37 -48
  43. package/es/vxe-table/style.min.css +1 -1
  44. package/es/vxe-toolbar/style.css +0 -1
  45. package/es/vxe-toolbar/style.min.css +1 -1
  46. package/lib/colgroup/index.js +3 -3
  47. package/lib/colgroup/index.min.js +1 -1
  48. package/lib/column/index.js +3 -3
  49. package/lib/column/index.min.js +1 -1
  50. package/lib/components.js +9 -11
  51. package/lib/components.min.js +1 -1
  52. package/lib/grid/index.js +3 -3
  53. package/lib/grid/index.min.js +1 -1
  54. package/lib/grid/src/grid.js +577 -487
  55. package/lib/grid/src/grid.min.js +1 -1
  56. package/lib/grid/style/style.css +0 -1
  57. package/lib/grid/style/style.min.css +1 -1
  58. package/lib/index.common.js +3 -4
  59. package/lib/index.umd.js +9148 -17246
  60. package/lib/index.umd.min.js +1 -1
  61. package/lib/locale/lang/en-US.js +6 -2
  62. package/lib/locale/lang/en-US.min.js +1 -1
  63. package/lib/locale/lang/en-US.umd.js +6 -2
  64. package/lib/locale/lang/es-ES.js +5 -1
  65. package/lib/locale/lang/es-ES.min.js +1 -1
  66. package/lib/locale/lang/es-ES.umd.js +5 -1
  67. package/lib/locale/lang/hu-HU.js +5 -1
  68. package/lib/locale/lang/hu-HU.min.js +1 -1
  69. package/lib/locale/lang/hu-HU.umd.js +5 -1
  70. package/lib/locale/lang/ja-JP.js +5 -1
  71. package/lib/locale/lang/ja-JP.min.js +1 -1
  72. package/lib/locale/lang/ja-JP.umd.js +5 -1
  73. package/lib/locale/lang/ko-KR.js +5 -1
  74. package/lib/locale/lang/ko-KR.min.js +1 -1
  75. package/lib/locale/lang/ko-KR.umd.js +5 -1
  76. package/lib/locale/lang/pt-BR.js +5 -1
  77. package/lib/locale/lang/pt-BR.min.js +1 -1
  78. package/lib/locale/lang/pt-BR.umd.js +5 -1
  79. package/lib/locale/lang/ru-RU.js +5 -1
  80. package/lib/locale/lang/ru-RU.min.js +1 -1
  81. package/lib/locale/lang/ru-RU.umd.js +5 -1
  82. package/lib/locale/lang/uk-UA.js +5 -1
  83. package/lib/locale/lang/uk-UA.min.js +1 -1
  84. package/lib/locale/lang/uk-UA.umd.js +5 -1
  85. package/lib/locale/lang/vi-VN.js +5 -1
  86. package/lib/locale/lang/vi-VN.min.js +1 -1
  87. package/lib/locale/lang/zh-CHT.js +5 -1
  88. package/lib/locale/lang/zh-CHT.min.js +1 -1
  89. package/lib/locale/lang/zh-CHT.umd.js +5 -1
  90. package/lib/locale/lang/zh-CN.js +5 -1
  91. package/lib/locale/lang/zh-CN.min.js +1 -1
  92. package/lib/locale/lang/zh-CN.umd.js +5 -1
  93. package/lib/style.css +1 -1
  94. package/lib/style.min.css +1 -1
  95. package/lib/table/index.js +4 -4
  96. package/lib/table/index.min.js +1 -1
  97. package/lib/table/module/custom/mixin.js +53 -44
  98. package/lib/table/module/custom/mixin.min.js +1 -1
  99. package/lib/table/module/custom/panel.js +310 -239
  100. package/lib/table/module/custom/panel.min.js +1 -1
  101. package/lib/table/module/edit/mixin.js +434 -383
  102. package/lib/table/module/edit/mixin.min.js +1 -1
  103. package/lib/table/module/export/export-panel.js +136 -106
  104. package/lib/table/module/export/export-panel.min.js +1 -1
  105. package/lib/table/module/export/import-panel.js +75 -54
  106. package/lib/table/module/export/import-panel.min.js +1 -1
  107. package/lib/table/module/export/mixin.js +592 -597
  108. package/lib/table/module/export/mixin.min.js +1 -1
  109. package/lib/table/module/export/util.js +6 -4
  110. package/lib/table/module/export/util.min.js +1 -1
  111. package/lib/table/module/filter/mixin.js +147 -118
  112. package/lib/table/module/filter/mixin.min.js +1 -1
  113. package/lib/table/module/filter/panel.js +86 -65
  114. package/lib/table/module/filter/panel.min.js +1 -1
  115. package/lib/table/module/keyboard/mixin.js +163 -151
  116. package/lib/table/module/keyboard/mixin.min.js +1 -1
  117. package/lib/table/module/menu/mixin.js +125 -114
  118. package/lib/table/module/menu/mixin.min.js +1 -1
  119. package/lib/table/module/menu/panel.js +36 -34
  120. package/lib/table/module/menu/panel.min.js +1 -1
  121. package/lib/table/module/validator/mixin.js +225 -214
  122. package/lib/table/module/validator/mixin.min.js +1 -1
  123. package/lib/table/render/index.js +401 -297
  124. package/lib/table/render/index.min.js +1 -1
  125. package/lib/table/src/body.js +411 -349
  126. package/lib/table/src/body.min.js +1 -1
  127. package/lib/table/src/cell.js +470 -344
  128. package/lib/table/src/cell.min.js +1 -1
  129. package/lib/table/src/column.js +10 -10
  130. package/lib/table/src/column.min.js +1 -1
  131. package/lib/table/src/columnInfo.js +46 -55
  132. package/lib/table/src/columnInfo.min.js +1 -1
  133. package/lib/table/src/footer.js +157 -132
  134. package/lib/table/src/footer.min.js +1 -1
  135. package/lib/table/src/group.js +1 -1
  136. package/lib/table/src/group.min.js +1 -1
  137. package/lib/table/src/header.js +170 -153
  138. package/lib/table/src/header.min.js +1 -1
  139. package/lib/table/src/methods.js +2770 -2491
  140. package/lib/table/src/methods.min.js +1 -1
  141. package/lib/table/src/props.js +33 -74
  142. package/lib/table/src/props.min.js +1 -1
  143. package/lib/table/src/table.js +436 -395
  144. package/lib/table/src/table.min.js +1 -1
  145. package/lib/table/src/util.js +143 -131
  146. package/lib/table/src/util.min.js +1 -1
  147. package/lib/table/style/style.css +37 -48
  148. package/lib/table/style/style.min.css +1 -1
  149. package/lib/toolbar/index.js +3 -3
  150. package/lib/toolbar/index.min.js +1 -1
  151. package/lib/toolbar/src/toolbar.js +332 -284
  152. package/lib/toolbar/src/toolbar.min.js +1 -1
  153. package/lib/toolbar/style/style.css +0 -1
  154. package/lib/toolbar/style/style.min.css +1 -1
  155. package/lib/ui/index.js +50 -41
  156. package/lib/ui/index.min.js +1 -1
  157. package/lib/ui/src/comp.js +2 -3
  158. package/lib/ui/src/comp.min.js +1 -1
  159. package/lib/ui/src/dom.js +29 -28
  160. package/lib/ui/src/dom.min.js +1 -1
  161. package/lib/ui/src/log.js +6 -4
  162. package/lib/ui/src/log.min.js +1 -1
  163. package/lib/ui/src/utils.js +7 -7
  164. package/lib/v-x-e-table/index.js +3 -4
  165. package/lib/v-x-e-table/index.min.js +1 -1
  166. package/lib/vxe-colgroup/index.js +3 -4
  167. package/lib/vxe-colgroup/index.min.js +1 -1
  168. package/lib/vxe-column/index.js +3 -4
  169. package/lib/vxe-column/index.min.js +1 -1
  170. package/lib/vxe-grid/index.js +3 -4
  171. package/lib/vxe-grid/index.min.js +1 -1
  172. package/lib/vxe-grid/style/style.css +0 -1
  173. package/lib/vxe-grid/style/style.min.css +1 -1
  174. package/lib/vxe-table/index.js +3 -4
  175. package/lib/vxe-table/index.min.js +1 -1
  176. package/lib/vxe-table/style/style.css +37 -48
  177. package/lib/vxe-table/style/style.min.css +1 -1
  178. package/lib/vxe-toolbar/index.js +3 -4
  179. package/lib/vxe-toolbar/index.min.js +1 -1
  180. package/lib/vxe-toolbar/style/style.css +0 -1
  181. package/lib/vxe-toolbar/style/style.min.css +1 -1
  182. package/lib/vxe-ui/index.js +3 -4
  183. package/lib/vxe-ui/index.min.js +1 -1
  184. package/lib/vxe-v-x-e-table/index.js +3 -4
  185. package/lib/vxe-v-x-e-table/index.min.js +1 -1
  186. package/package.json +5 -4
  187. package/packages/grid/src/grid.ts +123 -61
  188. package/packages/locale/lang/en-US.ts +6 -2
  189. package/packages/locale/lang/es-ES.ts +5 -1
  190. package/packages/locale/lang/hu-HU.ts +5 -1
  191. package/packages/locale/lang/ja-JP.ts +5 -1
  192. package/packages/locale/lang/ko-KR.ts +5 -1
  193. package/packages/locale/lang/pt-BR.ts +5 -1
  194. package/packages/locale/lang/ru-RU.ts +5 -1
  195. package/packages/locale/lang/uk-UA.ts +5 -1
  196. package/packages/locale/lang/vi-VN.ts +5 -1
  197. package/packages/locale/lang/zh-CHT.ts +5 -1
  198. package/packages/locale/lang/zh-CN.ts +5 -1
  199. package/packages/table/module/custom/panel.ts +186 -175
  200. package/packages/table/module/edit/mixin.ts +34 -39
  201. package/packages/table/module/export/export-panel.ts +36 -4
  202. package/packages/table/module/export/import-panel.ts +29 -6
  203. package/packages/table/module/export/mixin.ts +11 -11
  204. package/packages/table/module/menu/mixin.ts +2 -2
  205. package/packages/table/module/validator/mixin.ts +4 -4
  206. package/packages/table/render/index.ts +20 -11
  207. package/packages/table/src/body.ts +1 -0
  208. package/packages/table/src/columnInfo.ts +3 -3
  209. package/packages/table/src/methods.ts +70 -55
  210. package/packages/table/src/props.ts +68 -15
  211. package/packages/table/src/table.ts +71 -26
  212. package/packages/table/src/util.ts +3 -2
  213. package/packages/toolbar/src/toolbar.ts +21 -7
  214. package/packages/ui/index.ts +3 -1
  215. package/styles/components/table.scss +82 -17
  216. package/types/all.d.ts +1 -0
  217. /package/es/{iconfont.1726453742001.ttf → iconfont.1728483486168.ttf} +0 -0
  218. /package/es/{iconfont.1726453742001.woff → iconfont.1728483486168.woff} +0 -0
  219. /package/es/{iconfont.1726453742001.woff2 → iconfont.1728483486168.woff2} +0 -0
  220. /package/lib/{iconfont.1726453742001.ttf → iconfont.1728483486168.ttf} +0 -0
  221. /package/lib/{iconfont.1726453742001.woff → iconfont.1728483486168.woff} +0 -0
  222. /package/lib/{iconfont.1726453742001.woff2 → iconfont.1728483486168.woff2} +0 -0
@@ -11,44 +11,40 @@ var _util = require("../../src/util");
11
11
  var _dom = require("../../../ui/src/dom");
12
12
  var _log = require("../../../ui/src/log");
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
15
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
16
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
18
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
19
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
20
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
21
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
22
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
23
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
24
- var getConfig = _ui.VxeUI.getConfig,
25
- renderer = _ui.VxeUI.renderer,
26
- getI18n = _ui.VxeUI.getI18n;
14
+ const {
15
+ getConfig,
16
+ renderer,
17
+ getI18n
18
+ } = _ui.VxeUI;
27
19
  function insertTreeRow(_vm, newRecords, isAppend) {
28
- var tableFullTreeData = _vm.tableFullTreeData,
29
- afterFullData = _vm.afterFullData,
30
- fullDataRowIdData = _vm.fullDataRowIdData,
31
- fullAllDataRowIdData = _vm.fullAllDataRowIdData,
32
- treeOpts = _vm.treeOpts;
33
- var rowField = treeOpts.rowField,
34
- parentField = treeOpts.parentField,
35
- mapChildrenField = treeOpts.mapChildrenField;
36
- var childrenField = treeOpts.children || treeOpts.childrenField;
37
- var funcName = isAppend ? 'push' : 'unshift';
38
- newRecords.forEach(function (item) {
39
- var parentRowId = item[parentField];
40
- var rowid = (0, _util.getRowid)(_vm, item);
41
- var matchObj = parentRowId ? _xeUtils.default.findTree(tableFullTreeData, function (item) {
42
- return parentRowId === item[rowField];
43
- }, {
20
+ const {
21
+ tableFullTreeData,
22
+ afterFullData,
23
+ fullDataRowIdData,
24
+ fullAllDataRowIdData,
25
+ treeOpts
26
+ } = _vm;
27
+ const {
28
+ rowField,
29
+ parentField,
30
+ mapChildrenField
31
+ } = treeOpts;
32
+ const childrenField = treeOpts.children || treeOpts.childrenField;
33
+ const funcName = isAppend ? 'push' : 'unshift';
34
+ newRecords.forEach(item => {
35
+ const parentRowId = item[parentField];
36
+ const rowid = (0, _util.getRowid)(_vm, item);
37
+ const matchObj = parentRowId ? _xeUtils.default.findTree(tableFullTreeData, item => parentRowId === item[rowField], {
44
38
  children: mapChildrenField
45
39
  }) : null;
46
40
  if (matchObj) {
47
- var parentRow = matchObj.item;
48
- var parentRest = fullAllDataRowIdData[(0, _util.getRowid)(_vm, parentRow)];
49
- var parentLevel = parentRest ? parentRest.level : 0;
50
- var parentChilds = parentRow[childrenField];
51
- var mapChilds = parentRow[mapChildrenField];
41
+ const {
42
+ item: parentRow
43
+ } = matchObj;
44
+ const parentRest = fullAllDataRowIdData[(0, _util.getRowid)(_vm, parentRow)];
45
+ const parentLevel = parentRest ? parentRest.level : 0;
46
+ let parentChilds = parentRow[childrenField];
47
+ let mapChilds = parentRow[mapChildrenField];
52
48
  if (!_xeUtils.default.isArray(parentChilds)) {
53
49
  parentChilds = parentRow[childrenField] = [];
54
50
  }
@@ -57,9 +53,9 @@ function insertTreeRow(_vm, newRecords, isAppend) {
57
53
  }
58
54
  parentChilds[funcName](item);
59
55
  mapChilds[funcName](item);
60
- var rest = {
56
+ const rest = {
61
57
  row: item,
62
- rowid: rowid,
58
+ rowid,
63
59
  seq: -1,
64
60
  index: -1,
65
61
  _index: -1,
@@ -71,16 +67,16 @@ function insertTreeRow(_vm, newRecords, isAppend) {
71
67
  fullDataRowIdData[rowid] = rest;
72
68
  fullAllDataRowIdData[rowid] = rest;
73
69
  } else {
74
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
70
+ if (process.env.NODE_ENV === 'development') {
75
71
  if (parentRowId) {
76
72
  (0, _log.warnLog)('vxe.error.unableInsert');
77
73
  }
78
74
  }
79
75
  afterFullData[funcName](item);
80
76
  tableFullTreeData[funcName](item);
81
- var _rest = {
77
+ const rest = {
82
78
  row: item,
83
- rowid: rowid,
79
+ rowid,
84
80
  seq: -1,
85
81
  index: -1,
86
82
  _index: -1,
@@ -89,41 +85,48 @@ function insertTreeRow(_vm, newRecords, isAppend) {
89
85
  parent: null,
90
86
  level: 0
91
87
  };
92
- fullDataRowIdData[rowid] = _rest;
93
- fullAllDataRowIdData[rowid] = _rest;
88
+ fullDataRowIdData[rowid] = rest;
89
+ fullAllDataRowIdData[rowid] = rest;
94
90
  }
95
91
  });
96
92
  }
97
93
  function handleInsertRowAt(_vm, records, row, isInsertNextRow) {
98
- var tableFullTreeData = _vm.tableFullTreeData,
99
- mergeList = _vm.mergeList,
100
- afterFullData = _vm.afterFullData,
101
- editStore = _vm.editStore,
102
- tableFullData = _vm.tableFullData,
103
- treeConfig = _vm.treeConfig,
104
- fullDataRowIdData = _vm.fullDataRowIdData,
105
- fullAllDataRowIdData = _vm.fullAllDataRowIdData,
106
- treeOpts = _vm.treeOpts;
107
- var transform = treeOpts.transform,
108
- rowField = treeOpts.rowField,
109
- mapChildrenField = treeOpts.mapChildrenField;
110
- var childrenField = treeOpts.children || treeOpts.childrenField;
94
+ const {
95
+ tableFullTreeData,
96
+ mergeList,
97
+ afterFullData,
98
+ editStore,
99
+ tableFullData,
100
+ treeConfig,
101
+ fullDataRowIdData,
102
+ fullAllDataRowIdData,
103
+ treeOpts
104
+ } = _vm;
105
+ const {
106
+ transform,
107
+ rowField,
108
+ mapChildrenField
109
+ } = treeOpts;
110
+ const childrenField = treeOpts.children || treeOpts.childrenField;
111
111
  if (!_xeUtils.default.isArray(records)) {
112
112
  records = [records];
113
113
  }
114
- var newRecords = _vm.defineField(records.map(function (record) {
115
- return Object.assign(treeConfig && transform ? _defineProperty(_defineProperty({}, mapChildrenField, []), childrenField, []) : {}, record);
116
- }));
114
+ const newRecords = _vm.defineField(records.map(record => Object.assign(treeConfig && transform ? {
115
+ [mapChildrenField]: [],
116
+ [childrenField]: []
117
+ } : {}, record)));
117
118
  if (_xeUtils.default.eqNull(row)) {
118
119
  // 如果为虚拟树
119
120
  if (treeConfig && transform) {
120
121
  insertTreeRow(_vm, newRecords, false);
121
122
  } else {
122
- afterFullData.unshift.apply(afterFullData, _toConsumableArray(newRecords));
123
- tableFullData.unshift.apply(tableFullData, _toConsumableArray(newRecords));
123
+ afterFullData.unshift(...newRecords);
124
+ tableFullData.unshift(...newRecords);
124
125
  // 刷新单元格合并
125
- mergeList.forEach(function (mergeItem) {
126
- var mergeRowIndex = mergeItem.row;
126
+ mergeList.forEach(mergeItem => {
127
+ const {
128
+ row: mergeRowIndex
129
+ } = mergeItem;
127
130
  if (mergeRowIndex > 0) {
128
131
  mergeItem.row = mergeRowIndex + newRecords.length;
129
132
  }
@@ -135,12 +138,14 @@ function handleInsertRowAt(_vm, records, row, isInsertNextRow) {
135
138
  if (treeConfig && transform) {
136
139
  insertTreeRow(_vm, newRecords, true);
137
140
  } else {
138
- afterFullData.push.apply(afterFullData, _toConsumableArray(newRecords));
139
- tableFullData.push.apply(tableFullData, _toConsumableArray(newRecords));
141
+ afterFullData.push(...newRecords);
142
+ tableFullData.push(...newRecords);
140
143
  // 刷新单元格合并
141
- mergeList.forEach(function (mergeItem) {
142
- var mergeRowIndex = mergeItem.row,
143
- mergeRowspan = mergeItem.rowspan;
144
+ mergeList.forEach(mergeItem => {
145
+ const {
146
+ row: mergeRowIndex,
147
+ rowspan: mergeRowspan
148
+ } = mergeItem;
144
149
  if (mergeRowIndex + mergeRowspan > afterFullData.length) {
145
150
  mergeItem.rowspan = mergeRowspan + newRecords.length;
146
151
  }
@@ -149,36 +154,36 @@ function handleInsertRowAt(_vm, records, row, isInsertNextRow) {
149
154
  } else {
150
155
  // 如果为虚拟树
151
156
  if (treeConfig && transform) {
152
- var matchMapObj = _xeUtils.default.findTree(tableFullTreeData, function (item) {
153
- return row[rowField] === item[rowField];
154
- }, {
157
+ const matchMapObj = _xeUtils.default.findTree(tableFullTreeData, item => row[rowField] === item[rowField], {
155
158
  children: mapChildrenField
156
159
  });
157
160
  if (matchMapObj) {
158
- var parentRow = matchMapObj.parent;
159
- var parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData;
160
- var parentRest = fullAllDataRowIdData[(0, _util.getRowid)(_vm, parentRow)];
161
- var parentLevel = parentRest ? parentRest.level : 0;
162
- newRecords.forEach(function (item, i) {
163
- var rowid = (0, _util.getRowid)(_vm, item);
164
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
161
+ const {
162
+ parent: parentRow
163
+ } = matchMapObj;
164
+ const parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData;
165
+ const parentRest = fullAllDataRowIdData[(0, _util.getRowid)(_vm, parentRow)];
166
+ const parentLevel = parentRest ? parentRest.level : 0;
167
+ newRecords.forEach((item, i) => {
168
+ const rowid = (0, _util.getRowid)(_vm, item);
169
+ if (process.env.NODE_ENV === 'development') {
165
170
  if (item[treeOpts.parentField]) {
166
171
  if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
167
- (0, _log.errLog)('vxe.error.errProp', ["".concat(treeOpts.parentField, "=").concat(item[treeOpts.parentField]), "".concat(treeOpts.parentField, "=").concat(parentRow[rowField])]);
172
+ (0, _log.errLog)('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`]);
168
173
  }
169
174
  }
170
175
  }
171
176
  if (parentRow) {
172
177
  item[treeOpts.parentField] = parentRow[rowField];
173
178
  }
174
- var targetIndex = matchMapObj.index + i;
179
+ let targetIndex = matchMapObj.index + i;
175
180
  if (isInsertNextRow) {
176
181
  targetIndex = targetIndex + 1;
177
182
  }
178
183
  parentMapChilds.splice(targetIndex, 0, item);
179
- var rest = {
184
+ const rest = {
180
185
  row: item,
181
- rowid: rowid,
186
+ rowid,
182
187
  seq: -1,
183
188
  index: -1,
184
189
  _index: -1,
@@ -192,22 +197,20 @@ function handleInsertRowAt(_vm, records, row, isInsertNextRow) {
192
197
  });
193
198
  // 源
194
199
  if (parentRow) {
195
- var matchObj = _xeUtils.default.findTree(tableFullTreeData, function (item) {
196
- return row[rowField] === item[rowField];
197
- }, {
200
+ const matchObj = _xeUtils.default.findTree(tableFullTreeData, item => row[rowField] === item[rowField], {
198
201
  children: childrenField
199
202
  });
200
203
  if (matchObj) {
201
- var parentChilds = matchObj.items;
202
- var targetIndex = matchObj.index;
204
+ const parentChilds = matchObj.items;
205
+ let targetIndex = matchObj.index;
203
206
  if (isInsertNextRow) {
204
207
  targetIndex = targetIndex + 1;
205
208
  }
206
- parentChilds.splice.apply(parentChilds, [targetIndex, 0].concat(_toConsumableArray(newRecords)));
209
+ parentChilds.splice(targetIndex, 0, ...newRecords);
207
210
  }
208
211
  }
209
212
  } else {
210
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
213
+ if (process.env.NODE_ENV === 'development') {
211
214
  (0, _log.warnLog)('vxe.error.unableInsert');
212
215
  }
213
216
  insertTreeRow(_vm, newRecords, true);
@@ -216,7 +219,7 @@ function handleInsertRowAt(_vm, records, row, isInsertNextRow) {
216
219
  if (treeConfig) {
217
220
  throw new Error(getI18n('vxe.error.noTree', ['insert']));
218
221
  }
219
- var afIndex = -1;
222
+ let afIndex = -1;
220
223
  // 如果是可视索引
221
224
  if (_xeUtils.default.isNumber(row)) {
222
225
  if (row < afterFullData.length) {
@@ -232,12 +235,14 @@ function handleInsertRowAt(_vm, records, row, isInsertNextRow) {
232
235
  if (afIndex === -1) {
233
236
  throw new Error((0, _log.errLog)('vxe.error.unableInsert'));
234
237
  }
235
- afterFullData.splice.apply(afterFullData, [afIndex, 0].concat(_toConsumableArray(newRecords)));
236
- tableFullData.splice.apply(tableFullData, [_vm.findRowIndexOf(tableFullData, row), 0].concat(_toConsumableArray(newRecords)));
238
+ afterFullData.splice(afIndex, 0, ...newRecords);
239
+ tableFullData.splice(_vm.findRowIndexOf(tableFullData, row), 0, ...newRecords);
237
240
  // 刷新单元格合并
238
- mergeList.forEach(function (mergeItem) {
239
- var mergeRowIndex = mergeItem.row,
240
- mergeRowspan = mergeItem.rowspan;
241
+ mergeList.forEach(mergeItem => {
242
+ const {
243
+ row: mergeRowIndex,
244
+ rowspan: mergeRowspan
245
+ } = mergeItem;
241
246
  if (mergeRowIndex > afIndex) {
242
247
  mergeItem.row = mergeRowIndex + newRecords.length;
243
248
  } else if (mergeRowIndex + mergeRowspan > afIndex) {
@@ -247,13 +252,15 @@ function handleInsertRowAt(_vm, records, row, isInsertNextRow) {
247
252
  }
248
253
  }
249
254
  }
250
- var insertList = editStore.insertList,
251
- insertMaps = editStore.insertMaps;
252
- newRecords.forEach(function (newRow) {
253
- var rowid = (0, _util.getRowid)(_vm, newRow);
255
+ const {
256
+ insertList,
257
+ insertMaps
258
+ } = editStore;
259
+ newRecords.forEach(newRow => {
260
+ const rowid = (0, _util.getRowid)(_vm, newRow);
254
261
  insertMaps[rowid] = newRow;
255
262
  });
256
- insertList.unshift.apply(insertList, _toConsumableArray(newRecords));
263
+ insertList.unshift(...newRecords);
257
264
  _vm.cacheRowMap();
258
265
  _vm.updateScrollYStatus();
259
266
  _vm.handleTableData(treeConfig && transform);
@@ -265,10 +272,10 @@ function handleInsertRowAt(_vm, records, row, isInsertNextRow) {
265
272
  if (_vm.scrollYLoad) {
266
273
  _vm.updateScrollYSpace();
267
274
  }
268
- return _vm.$nextTick().then(function () {
275
+ return _vm.$nextTick().then(() => {
269
276
  _vm.updateCellAreas();
270
277
  return _vm.recalculate();
271
- }).then(function () {
278
+ }).then(() => {
272
279
  return {
273
280
  row: newRecords.length ? newRecords[newRecords.length - 1] : null,
274
281
  rows: newRecords
@@ -282,7 +289,7 @@ var _default = exports.default = {
282
289
  *
283
290
  * @param {*} records
284
291
  */
285
- _insert: function _insert(records) {
292
+ _insert(records) {
286
293
  return handleInsertRowAt(this, records, null);
287
294
  },
288
295
  /**
@@ -294,10 +301,10 @@ var _default = exports.default = {
294
301
  * @param {Row} row 指定行
295
302
  * @returns
296
303
  */
297
- _insertAt: function _insertAt(records, row) {
304
+ _insertAt(records, row) {
298
305
  return handleInsertRowAt(this, records, row);
299
306
  },
300
- _insertNextAt: function _insertNextAt(records, row) {
307
+ _insertNextAt(records, row) {
301
308
  return handleInsertRowAt(this, records, row, true);
302
309
  },
303
310
  /**
@@ -306,43 +313,50 @@ var _default = exports.default = {
306
313
  * 如果传 rows 则删除多行
307
314
  * 如果为空则删除所有
308
315
  */
309
- _remove: function _remove(rows) {
310
- var _this = this;
311
- var afterFullData = this.afterFullData,
312
- tableFullData = this.tableFullData,
313
- tableFullTreeData = this.tableFullTreeData,
314
- treeConfig = this.treeConfig,
315
- mergeList = this.mergeList,
316
- editStore = this.editStore,
317
- checkboxOpts = this.checkboxOpts,
318
- selectCheckboxMaps = this.selectCheckboxMaps,
319
- isInsertByRow = this.isInsertByRow,
320
- treeOpts = this.treeOpts;
321
- var transform = treeOpts.transform,
322
- mapChildrenField = treeOpts.mapChildrenField;
323
- var childrenField = treeOpts.children || treeOpts.childrenField;
324
- var actived = editStore.actived,
325
- removeList = editStore.removeList,
326
- insertList = editStore.insertList,
327
- insertMaps = editStore.insertMaps;
328
- var checkField = checkboxOpts.checkField;
329
- var delList = [];
316
+ _remove(rows) {
317
+ const {
318
+ afterFullData,
319
+ tableFullData,
320
+ tableFullTreeData,
321
+ treeConfig,
322
+ mergeList,
323
+ editStore,
324
+ checkboxOpts,
325
+ selectCheckboxMaps,
326
+ isInsertByRow,
327
+ treeOpts
328
+ } = this;
329
+ const {
330
+ transform,
331
+ mapChildrenField
332
+ } = treeOpts;
333
+ const childrenField = treeOpts.children || treeOpts.childrenField;
334
+ const {
335
+ actived,
336
+ removeList,
337
+ insertList,
338
+ insertMaps
339
+ } = editStore;
340
+ const {
341
+ checkField
342
+ } = checkboxOpts;
343
+ let delList = [];
330
344
  if (!rows) {
331
345
  rows = tableFullData;
332
346
  } else if (!_xeUtils.default.isArray(rows)) {
333
347
  rows = [rows];
334
348
  }
335
349
  // 如果是新增,则保存记录
336
- rows.forEach(function (row) {
350
+ rows.forEach(row => {
337
351
  if (!isInsertByRow(row)) {
338
352
  removeList.push(row);
339
353
  }
340
354
  });
341
355
  // 如果绑定了多选属性,则更新状态
342
356
  if (!checkField) {
343
- var selectRowMaps = Object.assign({}, selectCheckboxMaps);
344
- rows.forEach(function (row) {
345
- var rowid = (0, _util.getRowid)(_this, row);
357
+ const selectRowMaps = Object.assign({}, selectCheckboxMaps);
358
+ rows.forEach(row => {
359
+ const rowid = (0, _util.getRowid)(this, row);
346
360
  if (selectRowMaps[rowid]) {
347
361
  delete selectRowMaps[rowid];
348
362
  }
@@ -358,43 +372,41 @@ var _default = exports.default = {
358
372
  } else {
359
373
  // 如果为虚拟树
360
374
  if (treeConfig && transform) {
361
- rows.forEach(function (row) {
362
- var rowid = (0, _util.getRowid)(_this, row);
363
- var matchMapObj = _xeUtils.default.findTree(tableFullTreeData, function (item) {
364
- return rowid === (0, _util.getRowid)(_this, item);
365
- }, {
375
+ rows.forEach(row => {
376
+ const rowid = (0, _util.getRowid)(this, row);
377
+ const matchMapObj = _xeUtils.default.findTree(tableFullTreeData, item => rowid === (0, _util.getRowid)(this, item), {
366
378
  children: mapChildrenField
367
379
  });
368
380
  if (matchMapObj) {
369
- var rItems = matchMapObj.items.splice(matchMapObj.index, 1);
381
+ const rItems = matchMapObj.items.splice(matchMapObj.index, 1);
370
382
  delList.push(rItems[0]);
371
383
  }
372
- var matchObj = _xeUtils.default.findTree(tableFullTreeData, function (item) {
373
- return rowid === (0, _util.getRowid)(_this, item);
374
- }, {
384
+ const matchObj = _xeUtils.default.findTree(tableFullTreeData, item => rowid === (0, _util.getRowid)(this, item), {
375
385
  children: childrenField
376
386
  });
377
387
  if (matchObj) {
378
388
  matchObj.items.splice(matchObj.index, 1);
379
389
  }
380
- var afIndex = _this.findRowIndexOf(afterFullData, row);
390
+ const afIndex = this.findRowIndexOf(afterFullData, row);
381
391
  if (afIndex > -1) {
382
392
  afterFullData.splice(afIndex, 1);
383
393
  }
384
394
  });
385
395
  } else {
386
- rows.forEach(function (row) {
387
- var tfIndex = _this.findRowIndexOf(tableFullData, row);
396
+ rows.forEach(row => {
397
+ const tfIndex = this.findRowIndexOf(tableFullData, row);
388
398
  if (tfIndex > -1) {
389
- var rItems = tableFullData.splice(tfIndex, 1);
399
+ const rItems = tableFullData.splice(tfIndex, 1);
390
400
  delList.push(rItems[0]);
391
401
  }
392
- var afIndex = _this.findRowIndexOf(afterFullData, row);
402
+ const afIndex = this.findRowIndexOf(afterFullData, row);
393
403
  if (afIndex > -1) {
394
404
  // 刷新单元格合并
395
- mergeList.forEach(function (mergeItem) {
396
- var mergeRowIndex = mergeItem.row,
397
- mergeRowspan = mergeItem.rowspan;
405
+ mergeList.forEach(mergeItem => {
406
+ const {
407
+ row: mergeRowIndex,
408
+ rowspan: mergeRowspan
409
+ } = mergeItem;
398
410
  if (mergeRowIndex > afIndex) {
399
411
  mergeItem.row = mergeRowIndex - 1;
400
412
  } else if (mergeRowIndex + mergeRowspan > afIndex) {
@@ -411,9 +423,9 @@ var _default = exports.default = {
411
423
  this.clearEdit();
412
424
  }
413
425
  // 从新增中移除已删除的数据
414
- rows.forEach(function (row) {
415
- var rowid = (0, _util.getRowid)(_this, row);
416
- var iIndex = _this.findRowIndexOf(insertList, row);
426
+ rows.forEach(row => {
427
+ const rowid = (0, _util.getRowid)(this, row);
428
+ const iIndex = this.findRowIndexOf(insertList, row);
417
429
  if (iIndex > -1) {
418
430
  insertList.splice(iIndex, 1);
419
431
  }
@@ -429,10 +441,10 @@ var _default = exports.default = {
429
441
  if (this.scrollYLoad) {
430
442
  this.updateScrollYSpace();
431
443
  }
432
- return this.$nextTick().then(function () {
433
- _this.updateCellAreas();
434
- return _this.recalculate();
435
- }).then(function () {
444
+ return this.$nextTick().then(() => {
445
+ this.updateCellAreas();
446
+ return this.recalculate();
447
+ }).then(() => {
436
448
  return {
437
449
  row: delList.length ? delList[delList.length - 1] : null,
438
450
  rows: delList
@@ -442,66 +454,61 @@ var _default = exports.default = {
442
454
  /**
443
455
  * 删除复选框选中的数据
444
456
  */
445
- _removeCheckboxRow: function _removeCheckboxRow() {
446
- var _this2 = this;
447
- return this.remove(this.getCheckboxRecords()).then(function (params) {
448
- _this2.clearCheckboxRow();
457
+ _removeCheckboxRow() {
458
+ return this.remove(this.getCheckboxRecords()).then(params => {
459
+ this.clearCheckboxRow();
449
460
  return params;
450
461
  });
451
462
  },
452
463
  /**
453
464
  * 删除单选框选中的数据
454
465
  */
455
- _removeRadioRow: function _removeRadioRow() {
456
- var _this3 = this;
457
- var radioRecord = this.getRadioRecord();
458
- return this.remove(radioRecord || []).then(function (params) {
459
- _this3.clearRadioRow();
466
+ _removeRadioRow() {
467
+ const radioRecord = this.getRadioRecord();
468
+ return this.remove(radioRecord || []).then(params => {
469
+ this.clearRadioRow();
460
470
  return params;
461
471
  });
462
472
  },
463
473
  /**
464
474
  * 删除当前行选中的数据
465
475
  */
466
- _removeCurrentRow: function _removeCurrentRow() {
467
- var _this4 = this;
468
- var currentRecord = this.getCurrentRecord();
469
- return this.remove(currentRecord || []).then(function (params) {
470
- _this4.clearCurrentRow();
476
+ _removeCurrentRow() {
477
+ const currentRecord = this.getCurrentRecord();
478
+ return this.remove(currentRecord || []).then(params => {
479
+ this.clearCurrentRow();
471
480
  return params;
472
481
  });
473
482
  },
474
483
  /**
475
484
  * 获取表格数据集,包含新增、删除、修改
476
485
  */
477
- _getRecordset: function _getRecordset() {
478
- var _this5 = this;
479
- var removeRecords = this.getRemoveRecords();
480
- var pendingRecords = this.getPendingRecords();
481
- var delRecords = removeRecords.concat(pendingRecords);
486
+ _getRecordset() {
487
+ const removeRecords = this.getRemoveRecords();
488
+ const pendingRecords = this.getPendingRecords();
489
+ const delRecords = removeRecords.concat(pendingRecords);
482
490
  // 如果已经被删除,则无需放到更新数组
483
- var updateRecords = this.getUpdateRecords().filter(function (row) {
484
- return !delRecords.some(function (item) {
485
- return _this5.eqRow(item, row);
486
- });
491
+ const updateRecords = this.getUpdateRecords().filter(row => {
492
+ return !delRecords.some(item => this.eqRow(item, row));
487
493
  });
488
494
  return {
489
495
  insertRecords: this.getInsertRecords(),
490
- removeRecords: removeRecords,
491
- updateRecords: updateRecords,
492
- pendingRecords: pendingRecords
496
+ removeRecords,
497
+ updateRecords,
498
+ pendingRecords
493
499
  };
494
500
  },
495
501
  /**
496
502
  * 获取新增的临时数据
497
503
  */
498
- _getInsertRecords: function _getInsertRecords() {
499
- var _this6 = this;
500
- var fullAllDataRowIdData = this.fullAllDataRowIdData;
501
- var insertList = this.editStore.insertList;
502
- var insertRecords = [];
503
- insertList.forEach(function (row) {
504
- var rowid = (0, _util.getRowid)(_this6, row);
504
+ _getInsertRecords() {
505
+ const {
506
+ fullAllDataRowIdData
507
+ } = this;
508
+ const insertList = this.editStore.insertList;
509
+ const insertRecords = [];
510
+ insertList.forEach(row => {
511
+ const rowid = (0, _util.getRowid)(this, row);
505
512
  if (fullAllDataRowIdData[rowid]) {
506
513
  insertRecords.push(row);
507
514
  }
@@ -511,7 +518,7 @@ var _default = exports.default = {
511
518
  /**
512
519
  * 获取已删除的数据
513
520
  */
514
- _getRemoveRecords: function _getRemoveRecords() {
521
+ _getRemoveRecords() {
515
522
  return this.editStore.removeList;
516
523
  },
517
524
  /**
@@ -519,55 +526,66 @@ var _default = exports.default = {
519
526
  * 只精准匹配 row 的更改
520
527
  * 如果是树表格,子节点更改状态不会影响父节点的更新状态
521
528
  */
522
- _getUpdateRecords: function _getUpdateRecords() {
523
- var keepSource = this.keepSource,
524
- tableFullData = this.tableFullData,
525
- isUpdateByRow = this.isUpdateByRow,
526
- treeConfig = this.treeConfig,
527
- treeOpts = this.treeOpts,
528
- editStore = this.editStore;
529
+ _getUpdateRecords() {
530
+ const {
531
+ keepSource,
532
+ tableFullData,
533
+ isUpdateByRow,
534
+ treeConfig,
535
+ treeOpts,
536
+ editStore
537
+ } = this;
529
538
  if (keepSource) {
530
- var actived = editStore.actived;
531
- var row = actived.row,
532
- column = actived.column;
539
+ const {
540
+ actived
541
+ } = editStore;
542
+ const {
543
+ row,
544
+ column
545
+ } = actived;
533
546
  if (row || column) {
534
547
  this._syncActivedCell();
535
548
  }
536
549
  if (treeConfig) {
537
- return _xeUtils.default.filterTree(tableFullData, function (row) {
538
- return isUpdateByRow(row);
539
- }, treeOpts);
550
+ return _xeUtils.default.filterTree(tableFullData, row => isUpdateByRow(row), treeOpts);
540
551
  }
541
- return tableFullData.filter(function (row) {
542
- return isUpdateByRow(row);
543
- });
552
+ return tableFullData.filter(row => isUpdateByRow(row));
544
553
  }
545
554
  return [];
546
555
  },
547
556
  /**
548
557
  * 处理激活编辑
549
558
  */
550
- handleEdit: function handleEdit(params, evnt) {
551
- var _this7 = this;
552
- var editStore = this.editStore,
553
- editOpts = this.editOpts,
554
- tableColumn = this.tableColumn,
555
- editConfig = this.editConfig,
556
- mouseConfig = this.mouseConfig;
557
- var mode = editOpts.mode;
558
- var actived = editStore.actived,
559
- focused = editStore.focused;
560
- var row = params.row,
561
- column = params.column;
562
- var editRender = column.editRender;
563
- var cell = params.cell = params.cell || this.getCellElement(row, column);
564
- var beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
559
+ handleEdit(params, evnt) {
560
+ const {
561
+ editStore,
562
+ editOpts,
563
+ tableColumn,
564
+ editConfig,
565
+ mouseConfig
566
+ } = this;
567
+ const {
568
+ mode
569
+ } = editOpts;
570
+ const {
571
+ actived,
572
+ focused
573
+ } = editStore;
574
+ const {
575
+ row,
576
+ column
577
+ } = params;
578
+ const {
579
+ editRender
580
+ } = column;
581
+ const cell = params.cell = params.cell || this.getCellElement(row, column);
582
+ const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
565
583
  if (cell && (0, _utils.isEnableConf)(editConfig) && (0, _utils.isEnableConf)(editRender)) {
566
584
  // 激活编辑
567
585
  if (!this.hasPendingByRow(row)) {
568
586
  if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
569
587
  // 判断是否禁用编辑
570
- var type = 'edit-disabled';
588
+ let type = 'edit-disabled';
571
589
  if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, params), {
572
590
  $table: this,
573
591
  $grid: this.$xegrid
@@ -587,51 +605,39 @@ var _default = exports.default = {
587
605
  actived.row = row;
588
606
  actived.column = column;
589
607
  if (mode === 'row') {
590
- tableColumn.forEach(function (column) {
591
- return _this7._getColumnModel(row, column);
592
- });
608
+ tableColumn.forEach(column => this._getColumnModel(row, column));
593
609
  } else {
594
610
  this._getColumnModel(row, column);
595
611
  }
596
- var afterEditMethod = editOpts.afterEditMethod;
597
- this.$nextTick(function () {
598
- _this7.handleFocus(params, evnt);
612
+ const afterEditMethod = editOpts.afterEditMethod;
613
+ this.$nextTick(() => {
614
+ this.handleFocus(params, evnt);
599
615
  if (afterEditMethod) {
600
616
  afterEditMethod(Object.assign(Object.assign({}, params), {
601
- $table: _this7,
602
- $grid: _this7.$xegrid
617
+ $table: this,
618
+ $grid: this.$xegrid
603
619
  }));
604
620
  }
605
621
  });
606
622
  }
607
- this.emitEvent(type, {
608
- row: row,
609
- rowIndex: this.getRowIndex(row),
610
- $rowIndex: this.getVMRowIndex(row),
611
- column: column,
612
- columnIndex: this.getColumnIndex(column),
613
- $columnIndex: this.getVMColumnIndex(column)
614
- }, evnt);
623
+ this.emitEvent(type, params, evnt);
615
624
  // v4已废弃
616
625
  if (type === 'edit-activated') {
617
- this.emitEvent('edit-actived', {
618
- row: row,
619
- rowIndex: this.getRowIndex(row),
620
- $rowIndex: this.getVMRowIndex(row),
621
- column: column,
622
- columnIndex: this.getColumnIndex(column),
623
- $columnIndex: this.getVMColumnIndex(column)
624
- }, evnt);
626
+ this.emitEvent('edit-actived', params, evnt);
625
627
  }
626
628
  } else {
627
- var oldColumn = actived.column;
629
+ const {
630
+ column: oldColumn
631
+ } = actived;
628
632
  if (mouseConfig) {
629
633
  this.clearSelected(evnt);
630
634
  this.clearCellAreas(evnt);
631
635
  this.clearCopyCellArea(evnt);
632
636
  }
633
637
  if (oldColumn !== column) {
634
- var oldModel = oldColumn.model;
638
+ const {
639
+ model: oldModel
640
+ } = oldColumn;
635
641
  if (oldModel.update) {
636
642
  (0, _util.setCellValue)(row, oldColumn, oldModel.value);
637
643
  }
@@ -640,8 +646,8 @@ var _default = exports.default = {
640
646
  column.renderHeight = cell.offsetHeight;
641
647
  actived.args = params;
642
648
  actived.column = column;
643
- setTimeout(function () {
644
- _this7.handleFocus(params, evnt);
649
+ setTimeout(() => {
650
+ this.handleFocus(params, evnt);
645
651
  });
646
652
  }
647
653
  focused.column = null;
@@ -654,46 +660,53 @@ var _default = exports.default = {
654
660
  /**
655
661
  * @deprecated
656
662
  */
657
- handleActived: function handleActived(params, evnt) {
663
+ handleActived(params, evnt) {
658
664
  return this.handleEdit(params, evnt);
659
665
  },
660
- _getColumnModel: function _getColumnModel(row, column) {
661
- var model = column.model,
662
- editRender = column.editRender;
666
+ _getColumnModel(row, column) {
667
+ const {
668
+ model,
669
+ editRender
670
+ } = column;
663
671
  if (editRender) {
664
672
  model.value = (0, _util.getCellValue)(row, column);
665
673
  model.update = false;
666
674
  }
667
675
  },
668
- _setColumnModel: function _setColumnModel(row, column) {
669
- var model = column.model,
670
- editRender = column.editRender;
676
+ _setColumnModel(row, column) {
677
+ const {
678
+ model,
679
+ editRender
680
+ } = column;
671
681
  if (editRender && model.update) {
672
682
  (0, _util.setCellValue)(row, column, model.value);
673
683
  model.update = false;
674
684
  model.value = null;
675
685
  }
676
686
  },
677
- _syncActivedCell: function _syncActivedCell() {
678
- var _this8 = this;
679
- var tableColumn = this.tableColumn,
680
- editStore = this.editStore,
681
- editOpts = this.editOpts;
682
- var actived = editStore.actived;
683
- var row = actived.row,
684
- column = actived.column;
687
+ _syncActivedCell() {
688
+ const {
689
+ tableColumn,
690
+ editStore,
691
+ editOpts
692
+ } = this;
693
+ const {
694
+ actived
695
+ } = editStore;
696
+ const {
697
+ row,
698
+ column
699
+ } = actived;
685
700
  if (row || column) {
686
701
  if (editOpts.mode === 'row') {
687
- tableColumn.forEach(function (column) {
688
- return _this8._setColumnModel(row, column);
689
- });
702
+ tableColumn.forEach(column => this._setColumnModel(row, column));
690
703
  } else {
691
704
  this._setColumnModel(row, column);
692
705
  }
693
706
  }
694
707
  },
695
- _clearActived: function _clearActived(evnt) {
696
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
708
+ _clearActived(evnt) {
709
+ if (process.env.NODE_ENV === 'development') {
697
710
  (0, _log.warnLog)('vxe.error.delFunc', ['clearActived', 'clearEdit']);
698
711
  }
699
712
  // 即将废弃
@@ -702,12 +715,18 @@ var _default = exports.default = {
702
715
  /**
703
716
  * 清除激活的编辑
704
717
  */
705
- _clearEdit: function _clearEdit(evnt) {
706
- var editStore = this.editStore;
707
- var actived = editStore.actived,
708
- focused = editStore.focused;
709
- var row = actived.row,
710
- column = actived.column;
718
+ _clearEdit(evnt) {
719
+ const {
720
+ editStore
721
+ } = this;
722
+ const {
723
+ actived,
724
+ focused
725
+ } = editStore;
726
+ const {
727
+ row,
728
+ column
729
+ } = actived;
711
730
  if (row || column) {
712
731
  this._syncActivedCell();
713
732
  actived.args = null;
@@ -715,10 +734,10 @@ var _default = exports.default = {
715
734
  actived.column = null;
716
735
  this.updateFooter();
717
736
  this.emitEvent('edit-closed', {
718
- row: row,
737
+ row,
719
738
  rowIndex: this.getRowIndex(row),
720
739
  $rowIndex: this.getVMRowIndex(row),
721
- column: column,
740
+ column,
722
741
  columnIndex: this.getColumnIndex(column),
723
742
  $columnIndex: this.getVMColumnIndex(column)
724
743
  }, evnt);
@@ -732,27 +751,33 @@ var _default = exports.default = {
732
751
  }
733
752
  return this.$nextTick();
734
753
  },
735
- _getActiveRecord: function _getActiveRecord() {
736
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
754
+ _getActiveRecord() {
755
+ if (process.env.NODE_ENV === 'development') {
737
756
  (0, _log.warnLog)('vxe.error.delFunc', ['getActiveRecord', 'getEditRecord']);
738
757
  }
739
758
  // 即将废弃
740
759
  return this.getEditRecord();
741
760
  },
742
- _getEditRecord: function _getEditRecord() {
743
- var $el = this.$el,
744
- editStore = this.editStore,
745
- afterFullData = this.afterFullData;
746
- var actived = editStore.actived;
747
- var args = actived.args,
748
- row = actived.row;
761
+ _getEditRecord() {
762
+ const {
763
+ $el,
764
+ editStore,
765
+ afterFullData
766
+ } = this;
767
+ const {
768
+ actived
769
+ } = editStore;
770
+ const {
771
+ args,
772
+ row
773
+ } = actived;
749
774
  if (args && this.findRowIndexOf(afterFullData, row) > -1 && $el.querySelectorAll('.vxe-body--column.col--active').length) {
750
775
  return Object.assign({}, args);
751
776
  }
752
777
  return null;
753
778
  },
754
- _isActiveByRow: function _isActiveByRow(row) {
755
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
779
+ _isActiveByRow(row) {
780
+ if (process.env.NODE_ENV === 'development') {
756
781
  (0, _log.warnLog)('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow']);
757
782
  }
758
783
  // 即将废弃
@@ -762,35 +787,45 @@ var _default = exports.default = {
762
787
  * 判断行是否为激活编辑状态
763
788
  * @param {Row} row 行对象
764
789
  */
765
- _isEditByRow: function _isEditByRow(row) {
790
+ _isEditByRow(row) {
766
791
  return this.editStore.actived.row === row;
767
792
  },
768
793
  /**
769
794
  * 处理聚焦
770
795
  */
771
- handleFocus: function handleFocus(params) {
772
- var row = params.row,
773
- column = params.column,
774
- cell = params.cell;
775
- var editRender = column.editRender;
796
+ handleFocus(params) {
797
+ const {
798
+ editOpts
799
+ } = this;
800
+ const {
801
+ row,
802
+ column,
803
+ cell
804
+ } = params;
805
+ const {
806
+ editRender
807
+ } = column;
776
808
  if ((0, _utils.isEnableConf)(editRender)) {
777
- var compRender = renderer.get(editRender.name);
778
- var autoFocus = editRender.autofocus || editRender.autoFocus;
779
- var autoSelect = editRender.autoSelect || editRender.autoselect;
780
- var inputElem;
781
- if (!autoFocus && compRender) {
782
- autoFocus = compRender.tableAutoFocus || compRender.tableAutofocus || compRender.autoFocus || compRender.autofocus;
783
- }
784
- if (!autoSelect && compRender) {
785
- autoSelect = compRender.tableAutoSelect || compRender.autoSelect || compRender.autoselect;
786
- }
787
- // 如果指定了聚焦 class
788
- if (_xeUtils.default.isFunction(autoFocus)) {
789
- inputElem = autoFocus.call(this, params);
790
- } else if (autoFocus) {
791
- inputElem = cell.querySelector(autoFocus);
792
- if (inputElem) {
793
- inputElem.focus();
809
+ const compRender = renderer.get(editRender.name);
810
+ let autoFocus = editRender.autofocus || editRender.autoFocus;
811
+ let autoSelect = editRender.autoSelect || editRender.autoselect;
812
+ let inputElem;
813
+ // 是否启用聚焦
814
+ if (editOpts.autoFocus) {
815
+ if (!autoFocus && compRender) {
816
+ autoFocus = compRender.tableAutoFocus || compRender.tableAutofocus || compRender.autoFocus || compRender.autofocus;
817
+ }
818
+ if (!autoSelect && compRender) {
819
+ autoSelect = compRender.tableAutoSelect || compRender.autoSelect || compRender.autoselect;
820
+ }
821
+ // 如果指定了聚焦 class
822
+ if (_xeUtils.default.isFunction(autoFocus)) {
823
+ inputElem = autoFocus.call(this, params);
824
+ } else if (autoFocus) {
825
+ inputElem = cell.querySelector(autoFocus);
826
+ if (inputElem) {
827
+ inputElem.focus();
828
+ }
794
829
  }
795
830
  }
796
831
  if (inputElem) {
@@ -799,19 +834,24 @@ var _default = exports.default = {
799
834
  } else {
800
835
  // 保持一致行为,光标移到末端
801
836
  if (_dom.browse.msie) {
802
- var textRange = inputElem.createTextRange();
837
+ const textRange = inputElem.createTextRange();
803
838
  textRange.collapse(false);
804
839
  textRange.select();
805
840
  }
806
841
  }
807
842
  } else {
808
- // 显示到可视区中
809
- this.scrollToRow(row, column);
843
+ // 是否自动定位
844
+ if (editOpts.autoPos) {
845
+ if (!column.fixed) {
846
+ // 显示到可视区中
847
+ this.scrollToRow(row, column);
848
+ }
849
+ }
810
850
  }
811
851
  }
812
852
  },
813
- _setActiveRow: function _setActiveRow(row) {
814
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
853
+ _setActiveRow(row) {
854
+ if (process.env.NODE_ENV === 'development') {
815
855
  (0, _log.warnLog)('vxe.error.delFunc', ['setActiveRow', 'setEditRow']);
816
856
  }
817
857
  // 即将废弃
@@ -820,17 +860,15 @@ var _default = exports.default = {
820
860
  /**
821
861
  * 激活行编辑
822
862
  */
823
- _setEditRow: function _setEditRow(row, fieldOrColumn) {
824
- var column = _xeUtils.default.find(this.visibleColumn, function (column) {
825
- return (0, _utils.isEnableConf)(column.editRender);
826
- });
863
+ _setEditRow(row, fieldOrColumn) {
864
+ let column = _xeUtils.default.find(this.visibleColumn, column => (0, _utils.isEnableConf)(column.editRender));
827
865
  if (fieldOrColumn) {
828
866
  column = _xeUtils.default.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
829
867
  }
830
868
  return this.setEditCell(row, column);
831
869
  },
832
- _setActiveCell: function _setActiveCell(row, fieldOrColumn) {
833
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
870
+ _setActiveCell(row, fieldOrColumn) {
871
+ if (process.env.NODE_ENV === 'development') {
834
872
  (0, _log.warnLog)('vxe.error.delFunc', ['setActiveCell', 'setEditCell']);
835
873
  }
836
874
  // 即将废弃
@@ -839,23 +877,24 @@ var _default = exports.default = {
839
877
  /**
840
878
  * 激活单元格编辑
841
879
  */
842
- _setEditCell: function _setEditCell(row, fieldOrColumn) {
843
- var _this9 = this;
844
- var editConfig = this.editConfig;
845
- var column = _xeUtils.default.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
880
+ _setEditCell(row, fieldOrColumn) {
881
+ const {
882
+ editConfig
883
+ } = this;
884
+ const column = _xeUtils.default.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
846
885
  if (row && column && (0, _utils.isEnableConf)(editConfig) && (0, _utils.isEnableConf)(column.editRender)) {
847
- return this.scrollToRow(row, true).then(function () {
848
- var cell = _this9.getCellElement(row, column);
886
+ return this.scrollToRow(row, true).then(() => {
887
+ const cell = this.getCellElement(row, column);
849
888
  if (cell) {
850
- _this9.handleEdit({
851
- row: row,
852
- rowIndex: _this9.getRowIndex(row),
853
- column: column,
854
- columnIndex: _this9.getColumnIndex(column),
855
- cell: cell,
856
- $table: _this9
889
+ this.handleEdit({
890
+ row,
891
+ rowIndex: this.getRowIndex(row),
892
+ column,
893
+ columnIndex: this.getColumnIndex(column),
894
+ cell,
895
+ $table: this
857
896
  });
858
- _this9.lastCallTime = Date.now();
897
+ this.lastCallTime = Date.now();
859
898
  }
860
899
  });
861
900
  }
@@ -864,21 +903,23 @@ var _default = exports.default = {
864
903
  /**
865
904
  * 只对 trigger=dblclick 有效,选中单元格
866
905
  */
867
- _setSelectCell: function _setSelectCell(row, fieldOrColumn) {
868
- var tableData = this.tableData,
869
- editOpts = this.editOpts,
870
- visibleColumn = this.visibleColumn;
871
- var column = _xeUtils.default.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
906
+ _setSelectCell(row, fieldOrColumn) {
907
+ const {
908
+ tableData,
909
+ editOpts,
910
+ visibleColumn
911
+ } = this;
912
+ const column = _xeUtils.default.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
872
913
  if (row && column && editOpts.trigger !== 'manual') {
873
- var rowIndex = this.findRowIndexOf(tableData, row);
914
+ const rowIndex = this.findRowIndexOf(tableData, row);
874
915
  if (rowIndex > -1) {
875
- var cell = this.getCellElement(row, column);
876
- var params = {
877
- row: row,
878
- rowIndex: rowIndex,
879
- column: column,
916
+ const cell = this.getCellElement(row, column);
917
+ const params = {
918
+ row,
919
+ rowIndex,
920
+ column,
880
921
  columnIndex: visibleColumn.indexOf(column),
881
- cell: cell
922
+ cell
882
923
  };
883
924
  this.handleSelected(params, {});
884
925
  }
@@ -888,47 +929,53 @@ var _default = exports.default = {
888
929
  /**
889
930
  * 处理选中源
890
931
  */
891
- handleSelected: function handleSelected(params, evnt) {
892
- var _this10 = this;
893
- var mouseConfig = this.mouseConfig,
894
- mouseOpts = this.mouseOpts,
895
- editOpts = this.editOpts,
896
- editStore = this.editStore;
897
- var actived = editStore.actived,
898
- selected = editStore.selected;
899
- var row = params.row,
900
- column = params.column;
901
- var isMouseSelected = mouseConfig && mouseOpts.selected;
902
- var selectMethod = function selectMethod() {
932
+ handleSelected(params, evnt) {
933
+ const {
934
+ mouseConfig,
935
+ mouseOpts,
936
+ editOpts,
937
+ editStore
938
+ } = this;
939
+ const {
940
+ actived,
941
+ selected
942
+ } = editStore;
943
+ const {
944
+ row,
945
+ column
946
+ } = params;
947
+ const isMouseSelected = mouseConfig && mouseOpts.selected;
948
+ const selectMethod = () => {
903
949
  if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
904
950
  if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
905
- _this10.clearEdit(evnt);
906
- _this10.clearSelected(evnt);
907
- _this10.clearCellAreas(evnt);
908
- _this10.clearCopyCellArea(evnt);
951
+ this.clearEdit(evnt);
952
+ this.clearSelected(evnt);
953
+ this.clearCellAreas(evnt);
954
+ this.clearCopyCellArea(evnt);
909
955
  selected.args = params;
910
956
  selected.row = row;
911
957
  selected.column = column;
912
958
  if (isMouseSelected) {
913
- _this10.addColSdCls();
959
+ this.addColSdCls();
914
960
  }
915
- _this10.focus();
961
+ this.focus();
916
962
  if (evnt) {
917
- _this10.emitEvent('cell-selected', params, evnt);
963
+ this.emitEvent('cell-selected', params, evnt);
918
964
  }
919
965
  }
920
966
  }
921
- return _this10.$nextTick();
967
+ return this.$nextTick();
922
968
  };
923
969
  return selectMethod();
924
970
  },
925
971
  /**
926
972
  * 获取选中的单元格
927
973
  */
928
- _getSelectedCell: function _getSelectedCell() {
929
- var _this$editStore$selec = this.editStore.selected,
930
- args = _this$editStore$selec.args,
931
- column = _this$editStore$selec.column;
974
+ _getSelectedCell() {
975
+ const {
976
+ args,
977
+ column
978
+ } = this.editStore.selected;
932
979
  if (args && column) {
933
980
  return Object.assign({}, args);
934
981
  }
@@ -937,35 +984,39 @@ var _default = exports.default = {
937
984
  /**
938
985
  * 清除所选中源状态
939
986
  */
940
- _clearSelected: function _clearSelected() {
941
- var selected = this.editStore.selected;
987
+ _clearSelected() {
988
+ const {
989
+ selected
990
+ } = this.editStore;
942
991
  selected.row = null;
943
992
  selected.column = null;
944
993
  this.reColTitleSdCls();
945
994
  this.reColSdCls();
946
995
  return this.$nextTick();
947
996
  },
948
- reColTitleSdCls: function reColTitleSdCls() {
949
- var headerElem = this.elemStore['main-header-list'];
997
+ reColTitleSdCls() {
998
+ const headerElem = this.elemStore['main-header-list'];
950
999
  if (headerElem) {
951
- _xeUtils.default.arrayEach(headerElem.querySelectorAll('.col--title-selected'), function (elem) {
952
- return (0, _dom.removeClass)(elem, 'col--title-selected');
953
- });
1000
+ _xeUtils.default.arrayEach(headerElem.querySelectorAll('.col--title-selected'), elem => (0, _dom.removeClass)(elem, 'col--title-selected'));
954
1001
  }
955
1002
  },
956
- reColSdCls: function reColSdCls() {
957
- var cell = this.$el.querySelector('.col--selected');
1003
+ reColSdCls() {
1004
+ const cell = this.$el.querySelector('.col--selected');
958
1005
  if (cell) {
959
1006
  (0, _dom.removeClass)(cell, 'col--selected');
960
1007
  }
961
1008
  },
962
- addColSdCls: function addColSdCls() {
963
- var selected = this.editStore.selected;
964
- var row = selected.row,
965
- column = selected.column;
1009
+ addColSdCls() {
1010
+ const {
1011
+ selected
1012
+ } = this.editStore;
1013
+ const {
1014
+ row,
1015
+ column
1016
+ } = selected;
966
1017
  this.reColSdCls();
967
1018
  if (row && column) {
968
- var cell = this.getCellElement(row, column);
1019
+ const cell = this.getCellElement(row, column);
969
1020
  if (cell) {
970
1021
  (0, _dom.addClass)(cell, 'col--selected');
971
1022
  }