vxe-table 3.9.0-rc.9 → 3.9.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 (222) hide show
  1. package/README.md +1 -1
  2. package/es/grid/src/grid.js +120 -66
  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 +2 -1
  7. package/es/locale/lang/es-ES.js +2 -1
  8. package/es/locale/lang/hu-HU.js +2 -1
  9. package/es/locale/lang/ja-JP.js +2 -1
  10. package/es/locale/lang/ko-KR.js +2 -1
  11. package/es/locale/lang/pt-BR.js +2 -1
  12. package/es/locale/lang/ru-RU.js +2 -1
  13. package/es/locale/lang/uk-UA.js +2 -1
  14. package/es/locale/lang/vi-VN.js +2 -1
  15. package/es/locale/lang/zh-CHT.js +2 -1
  16. package/es/locale/lang/zh-CN.js +2 -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 +33 -24
  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 +54 -42
  30. package/es/table/src/props.js +65 -15
  31. package/es/table/src/table.js +91 -57
  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 +581 -491
  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 +9174 -17260
  60. package/lib/index.umd.min.js +1 -1
  61. package/lib/locale/lang/en-US.js +2 -1
  62. package/lib/locale/lang/en-US.min.js +1 -1
  63. package/lib/locale/lang/en-US.umd.js +2 -1
  64. package/lib/locale/lang/es-ES.js +2 -1
  65. package/lib/locale/lang/es-ES.min.js +1 -1
  66. package/lib/locale/lang/es-ES.umd.js +2 -1
  67. package/lib/locale/lang/hu-HU.js +2 -1
  68. package/lib/locale/lang/hu-HU.min.js +1 -1
  69. package/lib/locale/lang/hu-HU.umd.js +2 -1
  70. package/lib/locale/lang/ja-JP.js +2 -1
  71. package/lib/locale/lang/ja-JP.min.js +1 -1
  72. package/lib/locale/lang/ja-JP.umd.js +2 -1
  73. package/lib/locale/lang/ko-KR.js +2 -1
  74. package/lib/locale/lang/ko-KR.min.js +1 -1
  75. package/lib/locale/lang/ko-KR.umd.js +2 -1
  76. package/lib/locale/lang/pt-BR.js +2 -1
  77. package/lib/locale/lang/pt-BR.min.js +1 -1
  78. package/lib/locale/lang/pt-BR.umd.js +2 -1
  79. package/lib/locale/lang/ru-RU.js +2 -1
  80. package/lib/locale/lang/ru-RU.min.js +1 -1
  81. package/lib/locale/lang/ru-RU.umd.js +2 -1
  82. package/lib/locale/lang/uk-UA.js +2 -1
  83. package/lib/locale/lang/uk-UA.min.js +1 -1
  84. package/lib/locale/lang/uk-UA.umd.js +2 -1
  85. package/lib/locale/lang/vi-VN.js +2 -1
  86. package/lib/locale/lang/vi-VN.min.js +1 -1
  87. package/lib/locale/lang/zh-CHT.js +2 -1
  88. package/lib/locale/lang/zh-CHT.min.js +1 -1
  89. package/lib/locale/lang/zh-CHT.umd.js +2 -1
  90. package/lib/locale/lang/zh-CN.js +2 -1
  91. package/lib/locale/lang/zh-CN.min.js +1 -1
  92. package/lib/locale/lang/zh-CN.umd.js +2 -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 +436 -371
  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 +2758 -2478
  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 +465 -424
  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 +127 -65
  188. package/packages/locale/lang/en-US.ts +2 -1
  189. package/packages/locale/lang/es-ES.ts +2 -1
  190. package/packages/locale/lang/hu-HU.ts +2 -1
  191. package/packages/locale/lang/ja-JP.ts +2 -1
  192. package/packages/locale/lang/ko-KR.ts +2 -1
  193. package/packages/locale/lang/pt-BR.ts +2 -1
  194. package/packages/locale/lang/ru-RU.ts +2 -1
  195. package/packages/locale/lang/uk-UA.ts +2 -1
  196. package/packages/locale/lang/vi-VN.ts +2 -1
  197. package/packages/locale/lang/zh-CHT.ts +2 -1
  198. package/packages/locale/lang/zh-CN.ts +2 -1
  199. package/packages/table/module/custom/panel.ts +186 -175
  200. package/packages/table/module/edit/mixin.ts +32 -23
  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 +53 -42
  210. package/packages/table/src/props.ts +68 -15
  211. package/packages/table/src/table.ts +99 -54
  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.1728348263835.ttf} +0 -0
  218. /package/es/{iconfont.1726453742001.woff → iconfont.1728348263835.woff} +0 -0
  219. /package/es/{iconfont.1726453742001.woff2 → iconfont.1728348263835.woff2} +0 -0
  220. /package/lib/{iconfont.1726453742001.ttf → iconfont.1728348263835.ttf} +0 -0
  221. /package/lib/{iconfont.1726453742001.woff → iconfont.1728348263835.woff} +0 -0
  222. /package/lib/{iconfont.1726453742001.woff2 → iconfont.1728348263835.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,53 @@ 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
623
  this.emitEvent(type, {
608
- row: row,
624
+ row,
609
625
  rowIndex: this.getRowIndex(row),
610
626
  $rowIndex: this.getVMRowIndex(row),
611
- column: column,
627
+ column,
612
628
  columnIndex: this.getColumnIndex(column),
613
629
  $columnIndex: this.getVMColumnIndex(column)
614
630
  }, evnt);
615
631
  // v4已废弃
616
632
  if (type === 'edit-activated') {
617
633
  this.emitEvent('edit-actived', {
618
- row: row,
634
+ row,
619
635
  rowIndex: this.getRowIndex(row),
620
636
  $rowIndex: this.getVMRowIndex(row),
621
- column: column,
637
+ column,
622
638
  columnIndex: this.getColumnIndex(column),
623
639
  $columnIndex: this.getVMColumnIndex(column)
624
640
  }, evnt);
625
641
  }
626
642
  } else {
627
- var oldColumn = actived.column;
643
+ const {
644
+ column: oldColumn
645
+ } = actived;
628
646
  if (mouseConfig) {
629
647
  this.clearSelected(evnt);
630
648
  this.clearCellAreas(evnt);
631
649
  this.clearCopyCellArea(evnt);
632
650
  }
633
651
  if (oldColumn !== column) {
634
- var oldModel = oldColumn.model;
652
+ const {
653
+ model: oldModel
654
+ } = oldColumn;
635
655
  if (oldModel.update) {
636
656
  (0, _util.setCellValue)(row, oldColumn, oldModel.value);
637
657
  }
@@ -640,8 +660,8 @@ var _default = exports.default = {
640
660
  column.renderHeight = cell.offsetHeight;
641
661
  actived.args = params;
642
662
  actived.column = column;
643
- setTimeout(function () {
644
- _this7.handleFocus(params, evnt);
663
+ setTimeout(() => {
664
+ this.handleFocus(params, evnt);
645
665
  });
646
666
  }
647
667
  focused.column = null;
@@ -654,46 +674,53 @@ var _default = exports.default = {
654
674
  /**
655
675
  * @deprecated
656
676
  */
657
- handleActived: function handleActived(params, evnt) {
677
+ handleActived(params, evnt) {
658
678
  return this.handleEdit(params, evnt);
659
679
  },
660
- _getColumnModel: function _getColumnModel(row, column) {
661
- var model = column.model,
662
- editRender = column.editRender;
680
+ _getColumnModel(row, column) {
681
+ const {
682
+ model,
683
+ editRender
684
+ } = column;
663
685
  if (editRender) {
664
686
  model.value = (0, _util.getCellValue)(row, column);
665
687
  model.update = false;
666
688
  }
667
689
  },
668
- _setColumnModel: function _setColumnModel(row, column) {
669
- var model = column.model,
670
- editRender = column.editRender;
690
+ _setColumnModel(row, column) {
691
+ const {
692
+ model,
693
+ editRender
694
+ } = column;
671
695
  if (editRender && model.update) {
672
696
  (0, _util.setCellValue)(row, column, model.value);
673
697
  model.update = false;
674
698
  model.value = null;
675
699
  }
676
700
  },
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;
701
+ _syncActivedCell() {
702
+ const {
703
+ tableColumn,
704
+ editStore,
705
+ editOpts
706
+ } = this;
707
+ const {
708
+ actived
709
+ } = editStore;
710
+ const {
711
+ row,
712
+ column
713
+ } = actived;
685
714
  if (row || column) {
686
715
  if (editOpts.mode === 'row') {
687
- tableColumn.forEach(function (column) {
688
- return _this8._setColumnModel(row, column);
689
- });
716
+ tableColumn.forEach(column => this._setColumnModel(row, column));
690
717
  } else {
691
718
  this._setColumnModel(row, column);
692
719
  }
693
720
  }
694
721
  },
695
- _clearActived: function _clearActived(evnt) {
696
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
722
+ _clearActived(evnt) {
723
+ if (process.env.NODE_ENV === 'development') {
697
724
  (0, _log.warnLog)('vxe.error.delFunc', ['clearActived', 'clearEdit']);
698
725
  }
699
726
  // 即将废弃
@@ -702,12 +729,18 @@ var _default = exports.default = {
702
729
  /**
703
730
  * 清除激活的编辑
704
731
  */
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;
732
+ _clearEdit(evnt) {
733
+ const {
734
+ editStore
735
+ } = this;
736
+ const {
737
+ actived,
738
+ focused
739
+ } = editStore;
740
+ const {
741
+ row,
742
+ column
743
+ } = actived;
711
744
  if (row || column) {
712
745
  this._syncActivedCell();
713
746
  actived.args = null;
@@ -715,10 +748,10 @@ var _default = exports.default = {
715
748
  actived.column = null;
716
749
  this.updateFooter();
717
750
  this.emitEvent('edit-closed', {
718
- row: row,
751
+ row,
719
752
  rowIndex: this.getRowIndex(row),
720
753
  $rowIndex: this.getVMRowIndex(row),
721
- column: column,
754
+ column,
722
755
  columnIndex: this.getColumnIndex(column),
723
756
  $columnIndex: this.getVMColumnIndex(column)
724
757
  }, evnt);
@@ -732,27 +765,33 @@ var _default = exports.default = {
732
765
  }
733
766
  return this.$nextTick();
734
767
  },
735
- _getActiveRecord: function _getActiveRecord() {
736
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
768
+ _getActiveRecord() {
769
+ if (process.env.NODE_ENV === 'development') {
737
770
  (0, _log.warnLog)('vxe.error.delFunc', ['getActiveRecord', 'getEditRecord']);
738
771
  }
739
772
  // 即将废弃
740
773
  return this.getEditRecord();
741
774
  },
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;
775
+ _getEditRecord() {
776
+ const {
777
+ $el,
778
+ editStore,
779
+ afterFullData
780
+ } = this;
781
+ const {
782
+ actived
783
+ } = editStore;
784
+ const {
785
+ args,
786
+ row
787
+ } = actived;
749
788
  if (args && this.findRowIndexOf(afterFullData, row) > -1 && $el.querySelectorAll('.vxe-body--column.col--active').length) {
750
789
  return Object.assign({}, args);
751
790
  }
752
791
  return null;
753
792
  },
754
- _isActiveByRow: function _isActiveByRow(row) {
755
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
793
+ _isActiveByRow(row) {
794
+ if (process.env.NODE_ENV === 'development') {
756
795
  (0, _log.warnLog)('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow']);
757
796
  }
758
797
  // 即将废弃
@@ -762,35 +801,45 @@ var _default = exports.default = {
762
801
  * 判断行是否为激活编辑状态
763
802
  * @param {Row} row 行对象
764
803
  */
765
- _isEditByRow: function _isEditByRow(row) {
804
+ _isEditByRow(row) {
766
805
  return this.editStore.actived.row === row;
767
806
  },
768
807
  /**
769
808
  * 处理聚焦
770
809
  */
771
- handleFocus: function handleFocus(params) {
772
- var row = params.row,
773
- column = params.column,
774
- cell = params.cell;
775
- var editRender = column.editRender;
810
+ handleFocus(params) {
811
+ const {
812
+ editOpts
813
+ } = this;
814
+ const {
815
+ row,
816
+ column,
817
+ cell
818
+ } = params;
819
+ const {
820
+ editRender
821
+ } = column;
776
822
  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();
823
+ const compRender = renderer.get(editRender.name);
824
+ let autoFocus = editRender.autofocus || editRender.autoFocus;
825
+ let autoSelect = editRender.autoSelect || editRender.autoselect;
826
+ let inputElem;
827
+ // 是否启用聚焦
828
+ if (editOpts.autoFocus) {
829
+ if (!autoFocus && compRender) {
830
+ autoFocus = compRender.tableAutoFocus || compRender.tableAutofocus || compRender.autoFocus || compRender.autofocus;
831
+ }
832
+ if (!autoSelect && compRender) {
833
+ autoSelect = compRender.tableAutoSelect || compRender.autoSelect || compRender.autoselect;
834
+ }
835
+ // 如果指定了聚焦 class
836
+ if (_xeUtils.default.isFunction(autoFocus)) {
837
+ inputElem = autoFocus.call(this, params);
838
+ } else if (autoFocus) {
839
+ inputElem = cell.querySelector(autoFocus);
840
+ if (inputElem) {
841
+ inputElem.focus();
842
+ }
794
843
  }
795
844
  }
796
845
  if (inputElem) {
@@ -799,19 +848,24 @@ var _default = exports.default = {
799
848
  } else {
800
849
  // 保持一致行为,光标移到末端
801
850
  if (_dom.browse.msie) {
802
- var textRange = inputElem.createTextRange();
851
+ const textRange = inputElem.createTextRange();
803
852
  textRange.collapse(false);
804
853
  textRange.select();
805
854
  }
806
855
  }
807
856
  } else {
808
- // 显示到可视区中
809
- this.scrollToRow(row, column);
857
+ // 是否自动定位
858
+ if (editOpts.autoPos) {
859
+ if (!column.fixed) {
860
+ // 显示到可视区中
861
+ this.scrollToRow(row, column);
862
+ }
863
+ }
810
864
  }
811
865
  }
812
866
  },
813
- _setActiveRow: function _setActiveRow(row) {
814
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
867
+ _setActiveRow(row) {
868
+ if (process.env.NODE_ENV === 'development') {
815
869
  (0, _log.warnLog)('vxe.error.delFunc', ['setActiveRow', 'setEditRow']);
816
870
  }
817
871
  // 即将废弃
@@ -820,17 +874,15 @@ var _default = exports.default = {
820
874
  /**
821
875
  * 激活行编辑
822
876
  */
823
- _setEditRow: function _setEditRow(row, fieldOrColumn) {
824
- var column = _xeUtils.default.find(this.visibleColumn, function (column) {
825
- return (0, _utils.isEnableConf)(column.editRender);
826
- });
877
+ _setEditRow(row, fieldOrColumn) {
878
+ let column = _xeUtils.default.find(this.visibleColumn, column => (0, _utils.isEnableConf)(column.editRender));
827
879
  if (fieldOrColumn) {
828
880
  column = _xeUtils.default.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
829
881
  }
830
882
  return this.setEditCell(row, column);
831
883
  },
832
- _setActiveCell: function _setActiveCell(row, fieldOrColumn) {
833
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
884
+ _setActiveCell(row, fieldOrColumn) {
885
+ if (process.env.NODE_ENV === 'development') {
834
886
  (0, _log.warnLog)('vxe.error.delFunc', ['setActiveCell', 'setEditCell']);
835
887
  }
836
888
  // 即将废弃
@@ -839,23 +891,24 @@ var _default = exports.default = {
839
891
  /**
840
892
  * 激活单元格编辑
841
893
  */
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;
894
+ _setEditCell(row, fieldOrColumn) {
895
+ const {
896
+ editConfig
897
+ } = this;
898
+ const column = _xeUtils.default.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
846
899
  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);
900
+ return this.scrollToRow(row, true).then(() => {
901
+ const cell = this.getCellElement(row, column);
849
902
  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
903
+ this.handleEdit({
904
+ row,
905
+ rowIndex: this.getRowIndex(row),
906
+ column,
907
+ columnIndex: this.getColumnIndex(column),
908
+ cell,
909
+ $table: this
857
910
  });
858
- _this9.lastCallTime = Date.now();
911
+ this.lastCallTime = Date.now();
859
912
  }
860
913
  });
861
914
  }
@@ -864,21 +917,23 @@ var _default = exports.default = {
864
917
  /**
865
918
  * 只对 trigger=dblclick 有效,选中单元格
866
919
  */
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;
920
+ _setSelectCell(row, fieldOrColumn) {
921
+ const {
922
+ tableData,
923
+ editOpts,
924
+ visibleColumn
925
+ } = this;
926
+ const column = _xeUtils.default.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn;
872
927
  if (row && column && editOpts.trigger !== 'manual') {
873
- var rowIndex = this.findRowIndexOf(tableData, row);
928
+ const rowIndex = this.findRowIndexOf(tableData, row);
874
929
  if (rowIndex > -1) {
875
- var cell = this.getCellElement(row, column);
876
- var params = {
877
- row: row,
878
- rowIndex: rowIndex,
879
- column: column,
930
+ const cell = this.getCellElement(row, column);
931
+ const params = {
932
+ row,
933
+ rowIndex,
934
+ column,
880
935
  columnIndex: visibleColumn.indexOf(column),
881
- cell: cell
936
+ cell
882
937
  };
883
938
  this.handleSelected(params, {});
884
939
  }
@@ -888,47 +943,53 @@ var _default = exports.default = {
888
943
  /**
889
944
  * 处理选中源
890
945
  */
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() {
946
+ handleSelected(params, evnt) {
947
+ const {
948
+ mouseConfig,
949
+ mouseOpts,
950
+ editOpts,
951
+ editStore
952
+ } = this;
953
+ const {
954
+ actived,
955
+ selected
956
+ } = editStore;
957
+ const {
958
+ row,
959
+ column
960
+ } = params;
961
+ const isMouseSelected = mouseConfig && mouseOpts.selected;
962
+ const selectMethod = () => {
903
963
  if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
904
964
  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);
965
+ this.clearEdit(evnt);
966
+ this.clearSelected(evnt);
967
+ this.clearCellAreas(evnt);
968
+ this.clearCopyCellArea(evnt);
909
969
  selected.args = params;
910
970
  selected.row = row;
911
971
  selected.column = column;
912
972
  if (isMouseSelected) {
913
- _this10.addColSdCls();
973
+ this.addColSdCls();
914
974
  }
915
- _this10.focus();
975
+ this.focus();
916
976
  if (evnt) {
917
- _this10.emitEvent('cell-selected', params, evnt);
977
+ this.emitEvent('cell-selected', params, evnt);
918
978
  }
919
979
  }
920
980
  }
921
- return _this10.$nextTick();
981
+ return this.$nextTick();
922
982
  };
923
983
  return selectMethod();
924
984
  },
925
985
  /**
926
986
  * 获取选中的单元格
927
987
  */
928
- _getSelectedCell: function _getSelectedCell() {
929
- var _this$editStore$selec = this.editStore.selected,
930
- args = _this$editStore$selec.args,
931
- column = _this$editStore$selec.column;
988
+ _getSelectedCell() {
989
+ const {
990
+ args,
991
+ column
992
+ } = this.editStore.selected;
932
993
  if (args && column) {
933
994
  return Object.assign({}, args);
934
995
  }
@@ -937,35 +998,39 @@ var _default = exports.default = {
937
998
  /**
938
999
  * 清除所选中源状态
939
1000
  */
940
- _clearSelected: function _clearSelected() {
941
- var selected = this.editStore.selected;
1001
+ _clearSelected() {
1002
+ const {
1003
+ selected
1004
+ } = this.editStore;
942
1005
  selected.row = null;
943
1006
  selected.column = null;
944
1007
  this.reColTitleSdCls();
945
1008
  this.reColSdCls();
946
1009
  return this.$nextTick();
947
1010
  },
948
- reColTitleSdCls: function reColTitleSdCls() {
949
- var headerElem = this.elemStore['main-header-list'];
1011
+ reColTitleSdCls() {
1012
+ const headerElem = this.elemStore['main-header-list'];
950
1013
  if (headerElem) {
951
- _xeUtils.default.arrayEach(headerElem.querySelectorAll('.col--title-selected'), function (elem) {
952
- return (0, _dom.removeClass)(elem, 'col--title-selected');
953
- });
1014
+ _xeUtils.default.arrayEach(headerElem.querySelectorAll('.col--title-selected'), elem => (0, _dom.removeClass)(elem, 'col--title-selected'));
954
1015
  }
955
1016
  },
956
- reColSdCls: function reColSdCls() {
957
- var cell = this.$el.querySelector('.col--selected');
1017
+ reColSdCls() {
1018
+ const cell = this.$el.querySelector('.col--selected');
958
1019
  if (cell) {
959
1020
  (0, _dom.removeClass)(cell, 'col--selected');
960
1021
  }
961
1022
  },
962
- addColSdCls: function addColSdCls() {
963
- var selected = this.editStore.selected;
964
- var row = selected.row,
965
- column = selected.column;
1023
+ addColSdCls() {
1024
+ const {
1025
+ selected
1026
+ } = this.editStore;
1027
+ const {
1028
+ row,
1029
+ column
1030
+ } = selected;
966
1031
  this.reColSdCls();
967
1032
  if (row && column) {
968
- var cell = this.getCellElement(row, column);
1033
+ const cell = this.getCellElement(row, column);
969
1034
  if (cell) {
970
1035
  (0, _dom.addClass)(cell, 'col--selected');
971
1036
  }