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,21 +11,15 @@ var _dom = require("../../../ui/src/dom");
11
11
  var _util = require("../../src/util");
12
12
  var _log = require("../../../ui/src/log");
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- 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; }
15
- 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); }
16
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
17
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
18
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
19
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
20
- 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); }
21
- var getConfig = _ui.VxeUI.getConfig,
22
- validators = _ui.VxeUI.validators;
14
+ const {
15
+ getConfig,
16
+ validators
17
+ } = _ui.VxeUI;
23
18
  /**
24
19
  * 校验规则
25
20
  */
26
- var Rule = /*#__PURE__*/function () {
27
- function Rule(rule) {
28
- _classCallCheck(this, Rule);
21
+ class Rule {
22
+ constructor(rule) {
29
23
  Object.defineProperty(this, "$options", {
30
24
  enumerable: true,
31
25
  configurable: true,
@@ -48,25 +42,22 @@ var Rule = /*#__PURE__*/function () {
48
42
  * 获取校验不通过的消息
49
43
  * 支持国际化翻译
50
44
  */
51
- return _createClass(Rule, [{
52
- key: "content",
53
- get: function get() {
54
- return (0, _utils.getFuncText)(this.$options.content || this.$options.message);
55
- }
56
- }, {
57
- key: "message",
58
- get: function get() {
59
- return this.content;
60
- }
61
- }]);
62
- }();
45
+ get content() {
46
+ return (0, _utils.getFuncText)(this.$options.content || this.$options.message);
47
+ }
48
+ get message() {
49
+ return this.content;
50
+ }
51
+ }
63
52
  function validErrorRuleValue(rule, val) {
64
- var type = rule.type,
65
- min = rule.min,
66
- max = rule.max,
67
- pattern = rule.pattern;
68
- var isNumType = type === 'number';
69
- var numVal = isNumType ? _xeUtils.default.toNumber(val) : _xeUtils.default.getSize(val);
53
+ const {
54
+ type,
55
+ min,
56
+ max,
57
+ pattern
58
+ } = rule;
59
+ const isNumType = type === 'number';
60
+ const numVal = isNumType ? _xeUtils.default.toNumber(val) : _xeUtils.default.getSize(val);
70
61
  // 判断数值
71
62
  if (isNumType && isNaN(val)) {
72
63
  return true;
@@ -90,8 +81,8 @@ var _default = exports.default = {
90
81
  /**
91
82
  * 完整校验,和 validate 的区别就是会给有效数据中的每一行进行校验
92
83
  */
93
- _fullValidate: function _fullValidate(rows, cb) {
94
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
84
+ _fullValidate(rows, cb) {
85
+ if (process.env.NODE_ENV === 'development') {
95
86
  if (_xeUtils.default.isFunction(cb)) {
96
87
  (0, _log.warnLog)('vxe.error.notValidators', ['fullValidate(rows, callback)', 'fullValidate(rows)']);
97
88
  }
@@ -101,8 +92,8 @@ var _default = exports.default = {
101
92
  /**
102
93
  * 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
103
94
  */
104
- _validate: function _validate(rows, cb) {
105
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
95
+ _validate(rows, cb) {
96
+ if (process.env.NODE_ENV === 'development') {
106
97
  if (_xeUtils.default.isFunction(cb)) {
107
98
  (0, _log.warnLog)('vxe.error.notValidators', ['validate(rows, callback)', 'validate(rows)']);
108
99
  }
@@ -112,32 +103,35 @@ var _default = exports.default = {
112
103
  /**
113
104
  * 聚焦到校验通过的单元格并弹出校验错误提示
114
105
  */
115
- handleValidError: function handleValidError(params) {
116
- var _this = this;
117
- var validOpts = this.validOpts;
118
- return new Promise(function (resolve) {
106
+ handleValidError(params) {
107
+ const {
108
+ validOpts
109
+ } = this;
110
+ return new Promise(resolve => {
119
111
  if (validOpts.autoPos === false) {
120
- _this.emitEvent('valid-error', params);
112
+ this.emitEvent('valid-error', params);
121
113
  resolve();
122
114
  } else {
123
- _this.handleEdit(params, {
115
+ this.handleEdit(params, {
124
116
  type: 'valid-error',
125
117
  trigger: 'call'
126
- }).then(function () {
127
- setTimeout(function () {
128
- resolve(_this.showValidTooltip(params));
118
+ }).then(() => {
119
+ setTimeout(() => {
120
+ resolve(this.showValidTooltip(params));
129
121
  }, 10);
130
122
  });
131
123
  }
132
124
  });
133
125
  },
134
- handleErrMsgMode: function handleErrMsgMode(validErrMaps) {
135
- var validOpts = this.validOpts;
126
+ handleErrMsgMode(validErrMaps) {
127
+ const {
128
+ validOpts
129
+ } = this;
136
130
  if (validOpts.msgMode === 'single') {
137
- var keys = Object.keys(validErrMaps);
138
- var resMaps = validErrMaps;
131
+ const keys = Object.keys(validErrMaps);
132
+ const resMaps = validErrMaps;
139
133
  if (keys.length) {
140
- var firstKey = keys[0];
134
+ const firstKey = keys[0];
141
135
  resMaps[firstKey] = validErrMaps[firstKey];
142
136
  }
143
137
  return resMaps;
@@ -153,16 +147,17 @@ var _default = exports.default = {
153
147
  * 如果只传 callback 否则默认验证整个表格数据
154
148
  * 返回 Promise 对象,或者使用回调方式
155
149
  */
156
- beginValidate: function beginValidate(rows, cb, isFull) {
157
- var _this2 = this;
158
- var validRest = {};
159
- var editRules = this.editRules,
160
- afterFullData = this.afterFullData,
161
- visibleColumn = this.visibleColumn,
162
- treeConfig = this.treeConfig,
163
- treeOpts = this.treeOpts;
164
- var childrenField = treeOpts.children || treeOpts.childrenField;
165
- var validList;
150
+ beginValidate(rows, cb, isFull) {
151
+ const validRest = {};
152
+ const {
153
+ editRules,
154
+ afterFullData,
155
+ visibleColumn,
156
+ treeConfig,
157
+ treeOpts
158
+ } = this;
159
+ const childrenField = treeOpts.children || treeOpts.childrenField;
160
+ let validList;
166
161
  if (rows === true) {
167
162
  validList = afterFullData;
168
163
  } else if (rows) {
@@ -175,43 +170,44 @@ var _default = exports.default = {
175
170
  if (!validList) {
176
171
  validList = this.getInsertRecords().concat(this.getUpdateRecords());
177
172
  }
178
- var rowValidErrs = [];
173
+ const rowValidErrs = [];
179
174
  this.lastCallTime = Date.now();
180
175
  this.validRuleErr = false; // 如果为快速校验,当存在某列校验不通过时将终止执行
181
176
  this.clearValidate();
182
- var validErrMaps = {};
177
+ const validErrMaps = {};
183
178
  if (editRules) {
184
- var columns = this.getColumns();
185
- var handleVaild = function handleVaild(row) {
186
- if (isFull || !_this2.validRuleErr) {
187
- var colVailds = [];
188
- columns.forEach(function (column) {
189
- if ((isFull || !_this2.validRuleErr) && _xeUtils.default.has(editRules, column.property)) {
190
- colVailds.push(_this2.validCellRules('all', row, column).catch(function (_ref) {
191
- var rule = _ref.rule,
192
- rules = _ref.rules;
193
- var rest = {
194
- rule: rule,
195
- rules: rules,
196
- rowIndex: _this2.getRowIndex(row),
197
- row: row,
198
- columnIndex: _this2.getColumnIndex(column),
199
- column: column,
179
+ const columns = this.getColumns();
180
+ const handleVaild = row => {
181
+ if (isFull || !this.validRuleErr) {
182
+ const colVailds = [];
183
+ columns.forEach(column => {
184
+ if ((isFull || !this.validRuleErr) && _xeUtils.default.has(editRules, column.property)) {
185
+ colVailds.push(this.validCellRules('all', row, column).catch(({
186
+ rule,
187
+ rules
188
+ }) => {
189
+ const rest = {
190
+ rule,
191
+ rules,
192
+ rowIndex: this.getRowIndex(row),
193
+ row,
194
+ columnIndex: this.getColumnIndex(column),
195
+ column,
200
196
  field: column.property,
201
- $table: _this2
197
+ $table: this
202
198
  };
203
199
  if (!validRest[column.property]) {
204
200
  validRest[column.property] = [];
205
201
  }
206
- validErrMaps["".concat((0, _util.getRowid)(_this2, row), ":").concat(column.id)] = {
207
- column: column,
208
- row: row,
209
- rule: rule,
202
+ validErrMaps[`${(0, _util.getRowid)(this, row)}:${column.id}`] = {
203
+ column,
204
+ row,
205
+ rule,
210
206
  content: rule.content
211
207
  };
212
208
  validRest[column.property].push(rest);
213
209
  if (!isFull) {
214
- _this2.validRuleErr = true;
210
+ this.validRuleErr = true;
215
211
  return Promise.reject(rest);
216
212
  }
217
213
  }));
@@ -227,10 +223,10 @@ var _default = exports.default = {
227
223
  } else {
228
224
  validList.forEach(handleVaild);
229
225
  }
230
- return Promise.all(rowValidErrs).then(function () {
231
- var ruleProps = Object.keys(validRest);
232
- _this2.validErrorMaps = _this2.handleErrMsgMode(validErrMaps);
233
- return _this2.$nextTick().then(function () {
226
+ return Promise.all(rowValidErrs).then(() => {
227
+ const ruleProps = Object.keys(validRest);
228
+ this.validErrorMaps = this.handleErrMsgMode(validErrMaps);
229
+ return this.$nextTick().then(() => {
234
230
  if (ruleProps.length) {
235
231
  return Promise.reject(validRest[ruleProps[0]][0]);
236
232
  }
@@ -238,10 +234,10 @@ var _default = exports.default = {
238
234
  cb();
239
235
  }
240
236
  });
241
- }).catch(function (firstErrParams) {
242
- return new Promise(function (resolve, reject) {
243
- var finish = function finish() {
244
- _this2.$nextTick(function () {
237
+ }).catch(firstErrParams => {
238
+ return new Promise((resolve, reject) => {
239
+ const finish = () => {
240
+ this.$nextTick(() => {
245
241
  if (cb) {
246
242
  cb(validRest);
247
243
  resolve();
@@ -255,46 +251,48 @@ var _default = exports.default = {
255
251
  }
256
252
  });
257
253
  };
258
- var posAndFinish = function posAndFinish() {
259
- firstErrParams.cell = _this2.getCellElement(firstErrParams.row, firstErrParams.column);
254
+ const posAndFinish = () => {
255
+ firstErrParams.cell = this.getCellElement(firstErrParams.row, firstErrParams.column);
260
256
  (0, _dom.scrollToView)(firstErrParams.cell);
261
- _this2.handleValidError(firstErrParams).then(finish);
257
+ this.handleValidError(firstErrParams).then(finish);
262
258
  };
263
259
  /**
264
260
  * 当校验不通过时
265
261
  * 将表格滚动到可视区
266
262
  * 由于提示信息至少需要占一行,定位向上偏移一行
267
263
  */
268
- if (_this2.validOpts.autoPos === false) {
264
+ if (this.validOpts.autoPos === false) {
269
265
  finish();
270
266
  } else {
271
- var row = firstErrParams.row;
272
- var column = firstErrParams.column;
273
- var rowIndex = afterFullData.indexOf(row);
274
- var columnIndex = visibleColumn.indexOf(column);
275
- var targetRow = rowIndex > 0 ? afterFullData[rowIndex - 1] : row;
276
- var targetColumn = columnIndex > 0 ? visibleColumn[columnIndex - 1] : column;
277
- _this2.scrollToRow(targetRow, targetColumn).then(posAndFinish);
267
+ const row = firstErrParams.row;
268
+ const column = firstErrParams.column;
269
+ const rowIndex = afterFullData.indexOf(row);
270
+ const columnIndex = visibleColumn.indexOf(column);
271
+ const targetRow = rowIndex > 0 ? afterFullData[rowIndex - 1] : row;
272
+ const targetColumn = columnIndex > 0 ? visibleColumn[columnIndex - 1] : column;
273
+ this.scrollToRow(targetRow, targetColumn).then(posAndFinish);
278
274
  }
279
275
  });
280
276
  });
281
277
  } else {
282
278
  this.validErrorMaps = {};
283
279
  }
284
- return this.$nextTick().then(function () {
280
+ return this.$nextTick().then(() => {
285
281
  if (cb) {
286
282
  cb();
287
283
  }
288
284
  });
289
285
  },
290
- hasCellRules: function hasCellRules(type, row, column) {
291
- var editRules = this.editRules;
292
- var property = column.property;
286
+ hasCellRules(type, row, column) {
287
+ const {
288
+ editRules
289
+ } = this;
290
+ const {
291
+ property
292
+ } = column;
293
293
  if (property && editRules) {
294
- var rules = _xeUtils.default.get(editRules, property);
295
- return rules && _xeUtils.default.find(rules, function (rule) {
296
- return type === 'all' || !rule.trigger || type === rule.trigger;
297
- });
294
+ const rules = _xeUtils.default.get(editRules, property);
295
+ return rules && _xeUtils.default.find(rules, rule => type === 'all' || !rule.trigger || type === rule.trigger);
298
296
  }
299
297
  return false;
300
298
  },
@@ -312,47 +310,52 @@ var _default = exports.default = {
312
310
  * validator=Function({ cellValue, rule, rules, row, column, rowIndex, columnIndex }) 自定义校验,接收一个 Promise
313
311
  * trigger=blur|change 触发方式(除非特殊场景,否则默认为空就行)
314
312
  */
315
- validCellRules: function validCellRules(validType, row, column, val) {
316
- var _this3 = this;
317
- var editRules = this.editRules;
318
- var property = column.property;
319
- var errorRules = [];
320
- var syncValidList = [];
313
+ validCellRules(validType, row, column, val) {
314
+ const {
315
+ editRules
316
+ } = this;
317
+ const {
318
+ property
319
+ } = column;
320
+ const errorRules = [];
321
+ const syncValidList = [];
321
322
  if (property && editRules) {
322
- var rules = _xeUtils.default.get(editRules, property);
323
+ const rules = _xeUtils.default.get(editRules, property);
323
324
  if (rules) {
324
- var cellValue = _xeUtils.default.isUndefined(val) ? _xeUtils.default.get(row, property) : val;
325
- rules.forEach(function (rule) {
326
- var type = rule.type,
327
- trigger = rule.trigger,
328
- required = rule.required,
329
- validator = rule.validator;
325
+ const cellValue = _xeUtils.default.isUndefined(val) ? _xeUtils.default.get(row, property) : val;
326
+ rules.forEach(rule => {
327
+ const {
328
+ type,
329
+ trigger,
330
+ required,
331
+ validator
332
+ } = rule;
330
333
  if (validType === 'all' || !trigger || validType === trigger) {
331
334
  if (validator) {
332
- var validParams = {
333
- cellValue: cellValue,
334
- rule: rule,
335
- rules: rules,
336
- row: row,
337
- rowIndex: _this3.getRowIndex(row),
338
- column: column,
339
- columnIndex: _this3.getColumnIndex(column),
335
+ const validParams = {
336
+ cellValue,
337
+ rule,
338
+ rules,
339
+ row,
340
+ rowIndex: this.getRowIndex(row),
341
+ column,
342
+ columnIndex: this.getColumnIndex(column),
340
343
  field: column.property,
341
- $table: _this3
344
+ $table: this
342
345
  };
343
- var customValid;
346
+ let customValid;
344
347
  if (_xeUtils.default.isString(validator)) {
345
- var gvItem = validators.get(validator);
348
+ const gvItem = validators.get(validator);
346
349
  if (gvItem) {
347
350
  if (gvItem.cellValidatorMethod) {
348
351
  customValid = gvItem.cellValidatorMethod(validParams);
349
352
  } else {
350
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
353
+ if (process.env.NODE_ENV === 'development') {
351
354
  (0, _log.warnLog)('vxe.error.notValidators', [validator]);
352
355
  }
353
356
  }
354
357
  } else {
355
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
358
+ if (process.env.NODE_ENV === 'development') {
356
359
  (0, _log.errLog)('vxe.error.notValidators', [validator]);
357
360
  }
358
361
  }
@@ -361,20 +364,20 @@ var _default = exports.default = {
361
364
  }
362
365
  if (customValid) {
363
366
  if (_xeUtils.default.isError(customValid)) {
364
- _this3.validRuleErr = true;
367
+ this.validRuleErr = true;
365
368
  errorRules.push(new Rule({
366
369
  type: 'custom',
367
- trigger: trigger,
370
+ trigger,
368
371
  content: customValid.message,
369
372
  rule: new Rule(rule)
370
373
  }));
371
374
  } else if (customValid.catch) {
372
375
  // 如果为异步校验(注:异步校验是并发无序的)
373
- syncValidList.push(customValid.catch(function (e) {
374
- _this3.validRuleErr = true;
376
+ syncValidList.push(customValid.catch(e => {
377
+ this.validRuleErr = true;
375
378
  errorRules.push(new Rule({
376
379
  type: 'custom',
377
- trigger: trigger,
380
+ trigger,
378
381
  content: e && e.message ? e.message : rule.content || rule.message,
379
382
  rule: new Rule(rule)
380
383
  }));
@@ -382,9 +385,9 @@ var _default = exports.default = {
382
385
  }
383
386
  }
384
387
  } else {
385
- var isArrType = type === 'array';
386
- var isArrVal = _xeUtils.default.isArray(cellValue);
387
- var hasEmpty = true;
388
+ const isArrType = type === 'array';
389
+ const isArrVal = _xeUtils.default.isArray(cellValue);
390
+ let hasEmpty = true;
388
391
  if (isArrType || isArrVal) {
389
392
  hasEmpty = !isArrVal || !cellValue.length;
390
393
  } else if (_xeUtils.default.isString(cellValue)) {
@@ -393,7 +396,7 @@ var _default = exports.default = {
393
396
  hasEmpty = (0, _utils.eqEmptyValue)(cellValue);
394
397
  }
395
398
  if (required ? hasEmpty || validErrorRuleValue(rule, cellValue) : !hasEmpty && validErrorRuleValue(rule, cellValue)) {
396
- _this3.validRuleErr = true;
399
+ this.validRuleErr = true;
397
400
  errorRules.push(new Rule(rule));
398
401
  }
399
402
  }
@@ -401,9 +404,9 @@ var _default = exports.default = {
401
404
  });
402
405
  }
403
406
  }
404
- return Promise.all(syncValidList).then(function () {
407
+ return Promise.all(syncValidList).then(() => {
405
408
  if (errorRules.length) {
406
- var rest = {
409
+ const rest = {
407
410
  rules: errorRules,
408
411
  rule: errorRules[0]
409
412
  };
@@ -411,16 +414,15 @@ var _default = exports.default = {
411
414
  }
412
415
  });
413
416
  },
414
- _clearValidate: function _clearValidate(rows, fieldOrColumn) {
415
- var _this4 = this;
416
- var validOpts = this.validOpts,
417
- validErrorMaps = this.validErrorMaps;
418
- var validTip = this.$refs.validTip;
419
- var rowList = _xeUtils.default.isArray(rows) ? rows : rows ? [rows] : [];
420
- var colList = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : (fieldOrColumn ? [fieldOrColumn] : []).map(function (column) {
421
- return (0, _util.handleFieldOrColumn)(_this4, column);
422
- });
423
- var validErrMaps = {};
417
+ _clearValidate(rows, fieldOrColumn) {
418
+ const {
419
+ validOpts,
420
+ validErrorMaps
421
+ } = this;
422
+ const validTip = this.$refs.validTip;
423
+ const rowList = _xeUtils.default.isArray(rows) ? rows : rows ? [rows] : [];
424
+ const colList = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : (fieldOrColumn ? [fieldOrColumn] : []).map(column => (0, _util.handleFieldOrColumn)(this, column));
425
+ let validErrMaps = {};
424
426
  if (validTip && validTip.visible) {
425
427
  validTip.close();
426
428
  }
@@ -431,28 +433,24 @@ var _default = exports.default = {
431
433
  }
432
434
  if (rowList.length && colList.length) {
433
435
  validErrMaps = Object.assign({}, validErrorMaps);
434
- rowList.forEach(function (row) {
435
- colList.forEach(function (column) {
436
- var validKey = "".concat((0, _util.getRowid)(_this4, row), ":").concat(column.id);
436
+ rowList.forEach(row => {
437
+ colList.forEach(column => {
438
+ const validKey = `${(0, _util.getRowid)(this, row)}:${column.id}`;
437
439
  if (validErrMaps[validKey]) {
438
440
  delete validErrMaps[validKey];
439
441
  }
440
442
  });
441
443
  });
442
444
  } else if (rowList.length) {
443
- var rowIdList = rowList.map(function (row) {
444
- return "".concat((0, _util.getRowid)(_this4, row));
445
- });
446
- _xeUtils.default.each(validErrorMaps, function (item, key) {
445
+ const rowIdList = rowList.map(row => `${(0, _util.getRowid)(this, row)}`);
446
+ _xeUtils.default.each(validErrorMaps, (item, key) => {
447
447
  if (rowIdList.indexOf(key.split(':')[0]) > -1) {
448
448
  validErrMaps[key] = item;
449
449
  }
450
450
  });
451
451
  } else if (colList.length) {
452
- var colidList = colList.map(function (column) {
453
- return "".concat(column.id);
454
- });
455
- _xeUtils.default.each(validErrorMaps, function (item, key) {
452
+ const colidList = colList.map(column => `${column.id}`);
453
+ _xeUtils.default.each(validErrorMaps, (item, key) => {
456
454
  if (colidList.indexOf(key.split(':')[1]) > -1) {
457
455
  validErrMaps[key] = item;
458
456
  }
@@ -464,40 +462,45 @@ var _default = exports.default = {
464
462
  /**
465
463
  * 触发校验
466
464
  */
467
- triggerValidate: function triggerValidate(type) {
468
- var _this5 = this;
469
- var editConfig = this.editConfig,
470
- editStore = this.editStore,
471
- editRules = this.editRules,
472
- editOpts = this.editOpts,
473
- validOpts = this.validOpts;
474
- var actived = editStore.actived;
465
+ triggerValidate(type) {
466
+ const {
467
+ editConfig,
468
+ editStore,
469
+ editRules,
470
+ editOpts,
471
+ validOpts
472
+ } = this;
473
+ const {
474
+ actived
475
+ } = editStore;
475
476
  // 检查清除校验消息
476
477
  if (editRules && validOpts.msgMode === 'single') {
477
478
  this.validErrorMaps = {};
478
479
  }
479
480
  // 校验单元格
480
481
  if (editConfig && editRules && actived.row) {
481
- var _actived$args = actived.args,
482
- row = _actived$args.row,
483
- column = _actived$args.column,
484
- cell = _actived$args.cell;
482
+ const {
483
+ row,
484
+ column,
485
+ cell
486
+ } = actived.args;
485
487
  if (this.hasCellRules(type, row, column)) {
486
- return this.validCellRules(type, row, column).then(function () {
488
+ return this.validCellRules(type, row, column).then(() => {
487
489
  if (editOpts.mode === 'row') {
488
- _this5.clearValidate(row, column);
490
+ this.clearValidate(row, column);
489
491
  }
490
- }).catch(function (_ref2) {
491
- var rule = _ref2.rule;
492
+ }).catch(({
493
+ rule
494
+ }) => {
492
495
  // 如果校验不通过与触发方式一致,则聚焦提示错误,否则跳过并不作任何处理
493
496
  if (!rule.trigger || type === rule.trigger) {
494
- var rest = {
495
- rule: rule,
496
- row: row,
497
- column: column,
498
- cell: cell
497
+ const rest = {
498
+ rule,
499
+ row,
500
+ column,
501
+ cell
499
502
  };
500
- _this5.showValidTooltip(rest);
503
+ this.showValidTooltip(rest);
501
504
  return Promise.reject(rest);
502
505
  }
503
506
  return Promise.resolve();
@@ -509,34 +512,42 @@ var _default = exports.default = {
509
512
  /**
510
513
  * 弹出校验错误提示
511
514
  */
512
- showValidTooltip: function showValidTooltip(params) {
513
- var $refs = this.$refs,
514
- height = this.height,
515
- validStore = this.validStore,
516
- validErrorMaps = this.validErrorMaps,
517
- tableData = this.tableData,
518
- validOpts = this.validOpts;
519
- var rule = params.rule,
520
- row = params.row,
521
- column = params.column,
522
- cell = params.cell;
523
- var validTip = $refs.validTip;
524
- var content = rule.content;
515
+ showValidTooltip(params) {
516
+ const {
517
+ $refs,
518
+ height,
519
+ validStore,
520
+ validErrorMaps,
521
+ tableData,
522
+ validOpts
523
+ } = this;
524
+ const {
525
+ rule,
526
+ row,
527
+ column,
528
+ cell
529
+ } = params;
530
+ const validTip = $refs.validTip;
531
+ const content = rule.content;
525
532
  validStore.visible = true;
526
533
  if (validOpts.msgMode === 'single') {
527
- this.validErrorMaps = _defineProperty({}, "".concat((0, _util.getRowid)(this, row), ":").concat(column.id), {
528
- column: column,
529
- row: row,
530
- rule: rule,
531
- content: content
532
- });
534
+ this.validErrorMaps = {
535
+ [`${(0, _util.getRowid)(this, row)}:${column.id}`]: {
536
+ column,
537
+ row,
538
+ rule,
539
+ content
540
+ }
541
+ };
533
542
  } else {
534
- this.validErrorMaps = Object.assign({}, validErrorMaps, _defineProperty({}, "".concat((0, _util.getRowid)(this, row), ":").concat(column.id), {
535
- column: column,
536
- row: row,
537
- rule: rule,
538
- content: content
539
- }));
543
+ this.validErrorMaps = Object.assign({}, validErrorMaps, {
544
+ [`${(0, _util.getRowid)(this, row)}:${column.id}`]: {
545
+ column,
546
+ row,
547
+ rule,
548
+ content
549
+ }
550
+ });
540
551
  }
541
552
  this.emitEvent('valid-error', params, null);
542
553
  if (validTip) {