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
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- 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); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -15,78 +14,77 @@ var _props = _interopRequireDefault(require("../../table/src/props"));
15
14
  var _vn = require("../../ui/src/vn");
16
15
  var _log = require("../../ui/src/log");
17
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
19
- 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."); }
20
- 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; } }
21
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
22
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
23
- 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; }
24
- 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; }
25
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
26
- 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); }
27
- function _readOnlyError(r) { throw new TypeError('"' + r + '" is read-only'); }
28
- var getConfig = _ui.VxeUI.getConfig,
29
- getI18n = _ui.VxeUI.getI18n,
30
- commands = _ui.VxeUI.commands,
31
- globalEvents = _ui.VxeUI.globalEvents,
32
- globalMixins = _ui.VxeUI.globalMixins;
33
- var methods = {};
34
- var propKeys = Object.keys(_props.default);
35
- function renderDefaultForm(h, _vm) {
36
- var $scopedSlots = _vm.$scopedSlots,
37
- proxyConfig = _vm.proxyConfig,
38
- proxyOpts = _vm.proxyOpts,
39
- formData = _vm.formData,
40
- formConfig = _vm.formConfig,
41
- formOpts = _vm.formOpts;
17
+ const {
18
+ getConfig,
19
+ getI18n,
20
+ commands,
21
+ globalEvents,
22
+ globalMixins,
23
+ renderEmptyElement
24
+ } = _ui.VxeUI;
25
+ const methods = {};
26
+ const propKeys = Object.keys(_props.default);
27
+ function renderDefaultForm(h, $xeGrid) {
28
+ const VxeUIFormComponent = _ui.VxeUI.getComponent('VxeForm');
29
+ const props = $xeGrid;
30
+ const slots = $xeGrid.$scopedSlots;
31
+ const {
32
+ proxyConfig,
33
+ formConfig
34
+ } = props;
35
+ const {
36
+ proxyOpts,
37
+ formData,
38
+ formOpts
39
+ } = $xeGrid;
42
40
  if ((0, _utils.isEnableConf)(formConfig) && formOpts.items && formOpts.items.length) {
43
- var formSlots = {};
41
+ const formSlots = {};
44
42
  if (!formOpts.inited) {
45
43
  formOpts.inited = true;
46
- var beforeItem = proxyOpts.beforeItem;
44
+ const beforeItem = proxyOpts.beforeItem;
47
45
  if (proxyOpts && beforeItem) {
48
- formOpts.items.forEach(function (item) {
49
- beforeItem.call(_vm, {
50
- $grid: _vm,
51
- item: item
46
+ formOpts.items.forEach(item => {
47
+ beforeItem.call($xeGrid, {
48
+ $grid: $xeGrid,
49
+ item
52
50
  });
53
51
  });
54
52
  }
55
53
  }
56
54
  // 处理插槽
57
- formOpts.items.forEach(function (item) {
58
- _xeUtils.default.each(item.slots, function (func) {
55
+ formOpts.items.forEach(item => {
56
+ _xeUtils.default.each(item.slots, func => {
59
57
  if (!_xeUtils.default.isFunction(func)) {
60
- if ($scopedSlots[func]) {
61
- formSlots[func] = $scopedSlots[func];
58
+ if (slots[func]) {
59
+ formSlots[func] = slots[func];
62
60
  }
63
61
  }
64
62
  });
65
63
  });
66
- return [h('vxe-form', {
64
+ return [VxeUIFormComponent ? h(VxeUIFormComponent, {
67
65
  props: Object.assign({}, formOpts, {
68
66
  data: proxyConfig && proxyOpts.form ? formData : formOpts.data
69
67
  }),
70
68
  on: {
71
- submit: _vm.submitEvent,
72
- reset: _vm.resetEvent,
73
- collapse: _vm.collapseEvent,
74
- 'submit-invalid': _vm.submitInvalidEvent
69
+ submit: $xeGrid.submitEvent,
70
+ reset: $xeGrid.resetEvent,
71
+ collapse: $xeGrid.collapseEvent,
72
+ 'submit-invalid': $xeGrid.submitInvalidEvent
75
73
  },
76
74
  scopedSlots: formSlots
77
- })];
75
+ }) : renderEmptyElement($xeGrid)];
78
76
  }
79
77
  return [];
80
78
  }
81
- function getFuncSlot(_vm, optSlots, slotKey) {
82
- var $scopedSlots = _vm.$scopedSlots;
83
- var funcSlot = optSlots[slotKey];
79
+ function getFuncSlot($xeGrid, optSlots, slotKey) {
80
+ const slots = $xeGrid.$scopedSlots;
81
+ const funcSlot = optSlots[slotKey];
84
82
  if (funcSlot) {
85
83
  if (_xeUtils.default.isString(funcSlot)) {
86
- if ($scopedSlots[funcSlot]) {
87
- return $scopedSlots[funcSlot];
84
+ if (slots[funcSlot]) {
85
+ return slots[funcSlot];
88
86
  } else {
89
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
87
+ if (process.env.NODE_ENV === 'development') {
90
88
  (0, _log.errLog)('vxe.error.notSlot', [funcSlot]);
91
89
  }
92
90
  }
@@ -97,13 +95,15 @@ function getFuncSlot(_vm, optSlots, slotKey) {
97
95
  return null;
98
96
  }
99
97
  function getToolbarSlots(_vm) {
100
- var $scopedSlots = _vm.$scopedSlots,
101
- toolbarOpts = _vm.toolbarOpts;
102
- var toolbarOptSlots = toolbarOpts.slots;
103
- var buttonsSlot;
104
- var toolsSlot;
105
- var slots = {};
106
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
98
+ const {
99
+ $scopedSlots,
100
+ toolbarOpts
101
+ } = _vm;
102
+ const toolbarOptSlots = toolbarOpts.slots;
103
+ let buttonsSlot;
104
+ let toolsSlot;
105
+ const slots = {};
106
+ if (process.env.NODE_ENV === 'development') {
107
107
  if ($scopedSlots.buttons && (!toolbarOptSlots || toolbarOptSlots.buttons !== 'buttons')) {
108
108
  (0, _log.warnLog)('vxe.error.reqProp', ['toolbar-config.slots.buttons']);
109
109
  }
@@ -124,11 +124,13 @@ function getToolbarSlots(_vm) {
124
124
  return slots;
125
125
  }
126
126
  function getPagerSlots(_vm) {
127
- var pagerOpts = _vm.pagerOpts;
128
- var pagerOptSlots = pagerOpts.slots;
129
- var slots = {};
130
- var leftSlot;
131
- var rightSlot;
127
+ const {
128
+ pagerOpts
129
+ } = _vm;
130
+ const pagerOptSlots = pagerOpts.slots;
131
+ const slots = {};
132
+ let leftSlot;
133
+ let rightSlot;
132
134
  if (pagerOptSlots) {
133
135
  leftSlot = getFuncSlot(_vm, pagerOptSlots, 'left');
134
136
  rightSlot = getFuncSlot(_vm, pagerOptSlots, 'right');
@@ -142,16 +144,15 @@ function getPagerSlots(_vm) {
142
144
  return slots;
143
145
  }
144
146
  function getTableOns(_vm) {
145
- var $listeners = _vm.$listeners,
146
- proxyConfig = _vm.proxyConfig,
147
- proxyOpts = _vm.proxyOpts;
148
- var ons = {};
149
- _xeUtils.default.each($listeners, function (cb, type) {
150
- ons[type] = function () {
151
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
152
- args[_key] = arguments[_key];
153
- }
154
- _vm.$emit.apply(_vm, [type].concat(args));
147
+ const {
148
+ $listeners,
149
+ proxyConfig,
150
+ proxyOpts
151
+ } = _vm;
152
+ const ons = {};
153
+ _xeUtils.default.each($listeners, (cb, type) => {
154
+ ons[type] = (...args) => {
155
+ _vm.$emit(type, ...args);
155
156
  };
156
157
  });
157
158
  if (proxyConfig) {
@@ -168,11 +169,13 @@ function getTableOns(_vm) {
168
169
  * 渲染表单
169
170
  */
170
171
  function renderForm(h, _vm) {
171
- var _e = _vm._e,
172
- $scopedSlots = _vm.$scopedSlots,
173
- formConfig = _vm.formConfig;
174
- var formSlot = $scopedSlots.form;
175
- var hasForm = !!(formSlot || (0, _utils.isEnableConf)(formConfig));
172
+ const {
173
+ _e,
174
+ $scopedSlots,
175
+ formConfig
176
+ } = _vm;
177
+ const formSlot = $scopedSlots.form;
178
+ const hasForm = !!(formSlot || (0, _utils.isEnableConf)(formConfig));
176
179
  if (hasForm) {
177
180
  return h('div', {
178
181
  key: 'form',
@@ -188,12 +191,14 @@ function renderForm(h, _vm) {
188
191
  * 渲染工具栏
189
192
  */
190
193
  function renderToolbar(h, _vm) {
191
- var _e = _vm._e,
192
- $scopedSlots = _vm.$scopedSlots,
193
- toolbarConfig = _vm.toolbarConfig,
194
- toolbar = _vm.toolbar;
195
- var toolbarSlot = $scopedSlots.toolbar;
196
- var hasToolbar = !!(toolbarSlot || (0, _utils.isEnableConf)(toolbarConfig) || toolbar);
194
+ const {
195
+ _e,
196
+ $scopedSlots,
197
+ toolbarConfig,
198
+ toolbar
199
+ } = _vm;
200
+ const toolbarSlot = $scopedSlots.toolbar;
201
+ const hasToolbar = !!(toolbarSlot || (0, _utils.isEnableConf)(toolbarConfig) || toolbar);
197
202
  if (hasToolbar) {
198
203
  return h('div', {
199
204
  key: 'toolbar',
@@ -213,9 +218,11 @@ function renderToolbar(h, _vm) {
213
218
  * 渲染表格顶部区域
214
219
  */
215
220
  function renderTop(h, _vm) {
216
- var _e = _vm._e,
217
- $scopedSlots = _vm.$scopedSlots;
218
- var topSlot = $scopedSlots.top;
221
+ const {
222
+ _e,
223
+ $scopedSlots
224
+ } = _vm;
225
+ const topSlot = $scopedSlots.top;
219
226
  return topSlot ? h('div', {
220
227
  key: 'top',
221
228
  ref: 'topWrapper',
@@ -225,9 +232,11 @@ function renderTop(h, _vm) {
225
232
  }, h)) : _e();
226
233
  }
227
234
  function renderTableLeft(h, _vm) {
228
- var _e = _vm._e,
229
- $scopedSlots = _vm.$scopedSlots;
230
- var leftSlot = $scopedSlots.left;
235
+ const {
236
+ _e,
237
+ $scopedSlots
238
+ } = _vm;
239
+ const leftSlot = $scopedSlots.left;
231
240
  if (leftSlot) {
232
241
  return h('div', {
233
242
  class: 'vxe-grid--left-wrapper'
@@ -238,9 +247,11 @@ function renderTableLeft(h, _vm) {
238
247
  return _e();
239
248
  }
240
249
  function renderTableRight(h, _vm) {
241
- var _e = _vm._e,
242
- $scopedSlots = _vm.$scopedSlots;
243
- var rightSlot = $scopedSlots.right;
250
+ const {
251
+ _e,
252
+ $scopedSlots
253
+ } = _vm;
254
+ const rightSlot = $scopedSlots.right;
244
255
  if (rightSlot) {
245
256
  return h('div', {
246
257
  class: 'vxe-grid--right-wrapper'
@@ -254,8 +265,10 @@ function renderTableRight(h, _vm) {
254
265
  * 渲染表格
255
266
  */
256
267
  function renderTable(h, _vm) {
257
- var $scopedSlots = _vm.$scopedSlots,
258
- tableProps = _vm.tableProps;
268
+ const {
269
+ $scopedSlots,
270
+ tableProps
271
+ } = _vm;
259
272
  return h('div', {
260
273
  class: 'vxe-grid--table-wrapper'
261
274
  }, [h('vxe-table', {
@@ -270,9 +283,11 @@ function renderTable(h, _vm) {
270
283
  * 渲染表格底部区域
271
284
  */
272
285
  function renderBottom(h, _vm) {
273
- var _e = _vm._e,
274
- $scopedSlots = _vm.$scopedSlots;
275
- var bottomSlot = $scopedSlots.bottom;
286
+ const {
287
+ _e,
288
+ $scopedSlots
289
+ } = _vm;
290
+ const bottomSlot = $scopedSlots.bottom;
276
291
  return bottomSlot ? h('div', {
277
292
  key: 'bottom',
278
293
  ref: 'bottomWrapper',
@@ -284,37 +299,44 @@ function renderBottom(h, _vm) {
284
299
  /**
285
300
  * 渲染分页
286
301
  */
287
- function renderPager(h, _vm) {
288
- var _e = _vm._e,
289
- $scopedSlots = _vm.$scopedSlots,
290
- pagerConfig = _vm.pagerConfig,
291
- proxyConfig = _vm.proxyConfig,
292
- tablePage = _vm.tablePage;
293
- var pagerSlot = $scopedSlots.pager;
294
- var hasPager = !!(pagerSlot || (0, _utils.isEnableConf)(pagerConfig));
302
+ function renderPager(h, $xeGrid) {
303
+ const VxeUIPagerComponent = _ui.VxeUI.getComponent('VxePager');
304
+ const props = $xeGrid;
305
+ const {
306
+ pagerConfig,
307
+ proxyConfig
308
+ } = props;
309
+ const {
310
+ $scopedSlots,
311
+ tablePage
312
+ } = $xeGrid;
313
+ const pagerSlot = $scopedSlots.pager;
314
+ const hasPager = !!(pagerSlot || (0, _utils.isEnableConf)(pagerConfig));
295
315
  if (hasPager) {
296
316
  return h('div', {
297
317
  key: 'pager',
298
318
  ref: 'pagerWrapper',
299
319
  class: 'vxe-grid--pager-wrapper'
300
- }, pagerSlot ? pagerSlot.call(_vm, {
301
- $grid: _vm
302
- }, h) : [h('vxe-pager', {
303
- props: Object.assign(Object.assign({}, _vm.pagerOpts), proxyConfig ? tablePage : {}),
320
+ }, pagerSlot ? pagerSlot.call($xeGrid, {
321
+ $grid: $xeGrid
322
+ }, h) : [VxeUIPagerComponent ? h(VxeUIPagerComponent, {
323
+ props: Object.assign(Object.assign({}, $xeGrid.pagerOpts), proxyConfig ? tablePage : {}),
304
324
  on: {
305
- 'page-change': _vm.pageChangeEvent
325
+ 'page-change': $xeGrid.pageChangeEvent
306
326
  },
307
- scopedSlots: getPagerSlots(_vm)
308
- })]);
327
+ scopedSlots: getPagerSlots($xeGrid)
328
+ }) : renderEmptyElement($xeGrid)]);
309
329
  }
310
- return _e();
330
+ return renderEmptyElement($xeGrid);
311
331
  }
312
- var defaultLayouts = ['Form', 'Toolbar', 'Top', 'Table', 'Bottom', 'Pager'];
332
+ const defaultLayouts = ['Form', 'Toolbar', 'Top', 'Table', 'Bottom', 'Pager'];
313
333
  function renderLayout(h, _vm) {
314
- var layouts = _vm.layouts;
315
- var vns = [];
316
- var currLayouts = layouts && layouts.length ? layouts : getConfig().grid.layouts || defaultLayouts;
317
- currLayouts.forEach(function (name) {
334
+ const {
335
+ layouts
336
+ } = _vm;
337
+ const vns = [];
338
+ const currLayouts = layouts && layouts.length ? layouts : getConfig().grid.layouts || defaultLayouts;
339
+ currLayouts.forEach(name => {
318
340
  switch (name) {
319
341
  case 'Form':
320
342
  vns.push(renderForm(h, _vm));
@@ -338,21 +360,20 @@ function renderLayout(h, _vm) {
338
360
  vns.push(renderPager(h, _vm));
339
361
  break;
340
362
  default:
341
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
342
- (0, _log.errLog)('vxe.error.notProp', ["layouts -> ".concat(name)]);
363
+ if (process.env.NODE_ENV === 'development') {
364
+ (0, _log.errLog)('vxe.error.notProp', [`layouts -> ${name}`]);
343
365
  }
344
366
  break;
345
367
  }
346
368
  });
347
369
  return vns;
348
370
  }
349
- Object.keys(_table.default.methods).forEach(function (name) {
350
- methods[name] = function () {
351
- var _this$$refs$xTable;
352
- return this.$refs.xTable && (_this$$refs$xTable = this.$refs.xTable)[name].apply(_this$$refs$xTable, arguments);
371
+ Object.keys(_table.default.methods).forEach(name => {
372
+ methods[name] = function (...args) {
373
+ return this.$refs.xTable && this.$refs.xTable[name](...args);
353
374
  };
354
375
  });
355
- var _default2 = exports.default = {
376
+ var _default = exports.default = {
356
377
  name: 'VxeGrid',
357
378
  mixins: [globalMixins.sizeMixin],
358
379
  props: Object.assign(Object.assign({}, _props.default), {
@@ -366,18 +387,17 @@ var _default2 = exports.default = {
366
387
  zoomConfig: Object,
367
388
  size: {
368
389
  type: String,
369
- default: function _default() {
370
- return getConfig().grid.size || getConfig().size;
371
- }
390
+ default: () => getConfig().grid.size || getConfig().size
372
391
  }
373
392
  }),
374
- provide: function provide() {
393
+ provide() {
375
394
  return {
376
395
  $xeGrid: this,
377
396
  $xegrid: this
378
397
  };
379
398
  },
380
- data: function data() {
399
+ data() {
400
+ var _a;
381
401
  return {
382
402
  tableLoading: false,
383
403
  isZMax: false,
@@ -388,60 +408,78 @@ var _default2 = exports.default = {
388
408
  tZindex: 0,
389
409
  tablePage: {
390
410
  total: 0,
391
- pageSize: getConfig().pager.pageSize || 10,
411
+ pageSize: ((_a = getConfig().pager) === null || _a === void 0 ? void 0 : _a.pageSize) || 10,
392
412
  currentPage: 1
393
413
  }
394
414
  };
395
415
  },
396
416
  computed: {
397
- isRespMsg: function isRespMsg() {
398
- var proxyOpts = this.proxyOpts;
417
+ isRespMsg() {
418
+ const {
419
+ proxyOpts
420
+ } = this;
399
421
  return _xeUtils.default.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg;
400
422
  },
401
- isActiveMsg: function isActiveMsg() {
423
+ isActiveMsg() {
402
424
  return this.proxyOpts.showActiveMsg;
403
425
  },
404
- proxyOpts: function proxyOpts() {
405
- return _xeUtils.default.merge({}, getConfig().grid.proxyConfig, this.proxyConfig);
426
+ proxyOpts() {
427
+ return this.computeProxyOpts;
428
+ },
429
+ computeProxyOpts() {
430
+ return _xeUtils.default.merge({}, _xeUtils.default.clone(getConfig().grid.proxyConfig, true), this.proxyConfig);
431
+ },
432
+ pagerOpts() {
433
+ return this.computePagerOpts;
434
+ },
435
+ computePagerOpts() {
436
+ return Object.assign({}, _xeUtils.default.clone(getConfig().grid.pagerConfig, true), this.pagerConfig);
437
+ },
438
+ formOpts() {
439
+ return this.computeFormOpts;
440
+ },
441
+ computeFormOpts() {
442
+ return Object.assign({}, _xeUtils.default.clone(getConfig().grid.formConfig, true), this.formConfig);
406
443
  },
407
- pagerOpts: function pagerOpts() {
408
- return Object.assign({}, getConfig().grid.pagerConfig, this.pagerConfig);
444
+ toolbarOpts() {
445
+ return this.computeToolbarOpts;
409
446
  },
410
- formOpts: function formOpts() {
411
- return Object.assign({}, getConfig().grid.formConfig, this.formConfig);
447
+ computeToolbarOpts() {
448
+ return Object.assign({}, _xeUtils.default.clone(getConfig().grid.toolbarConfig, true), this.toolbarConfig || this.toolbar);
412
449
  },
413
- toolbarOpts: function toolbarOpts() {
414
- return Object.assign({}, getConfig().grid.toolbarConfig, this.toolbarConfig || this.toolbar);
450
+ zoomOpts() {
451
+ return this.computeZoomOpts;
415
452
  },
416
- zoomOpts: function zoomOpts() {
417
- return Object.assign({}, getConfig().grid.zoomConfig, this.zoomConfig);
453
+ computeZoomOpts() {
454
+ return Object.assign({}, _xeUtils.default.clone(getConfig().grid.zoomConfig, true), this.zoomConfig);
418
455
  },
419
- renderStyle: function renderStyle() {
456
+ renderStyle() {
420
457
  return this.isZMax ? {
421
458
  zIndex: this.tZindex
422
459
  } : null;
423
460
  },
424
- tableExtendProps: function tableExtendProps() {
425
- var _this = this;
426
- var rest = {};
427
- propKeys.forEach(function (key) {
428
- rest[key] = _this[key];
461
+ tableExtendProps() {
462
+ const rest = {};
463
+ propKeys.forEach(key => {
464
+ rest[key] = this[key];
429
465
  });
430
466
  return rest;
431
467
  },
432
- tableProps: function tableProps() {
433
- var isZMax = this.isZMax,
434
- seqConfig = this.seqConfig,
435
- pagerConfig = this.pagerConfig,
436
- loading = this.loading,
437
- editConfig = this.editConfig,
438
- proxyConfig = this.proxyConfig,
439
- proxyOpts = this.proxyOpts,
440
- tableExtendProps = this.tableExtendProps,
441
- tableLoading = this.tableLoading,
442
- tablePage = this.tablePage,
443
- tableData = this.tableData;
444
- var tableProps = Object.assign({}, tableExtendProps);
468
+ tableProps() {
469
+ const {
470
+ isZMax,
471
+ seqConfig,
472
+ pagerConfig,
473
+ loading,
474
+ editConfig,
475
+ proxyConfig,
476
+ proxyOpts,
477
+ tableExtendProps,
478
+ tableLoading,
479
+ tablePage,
480
+ tableData
481
+ } = this;
482
+ const tableProps = Object.assign({}, tableExtendProps);
445
483
  if (isZMax) {
446
484
  if (tableExtendProps.maxHeight) {
447
485
  tableProps.maxHeight = '100%';
@@ -465,70 +503,97 @@ var _default2 = exports.default = {
465
503
  }
466
504
  },
467
505
  watch: {
468
- columns: function columns(value) {
469
- var _this2 = this;
470
- this.$nextTick(function () {
471
- return _this2.loadColumn(value);
472
- });
506
+ columns(value) {
507
+ this.$nextTick(() => this.loadColumn(value));
473
508
  },
474
- toolbar: function toolbar(value) {
509
+ toolbar(value) {
475
510
  if (value) {
476
511
  this.initToolbar();
477
512
  }
478
513
  },
479
- toolbarConfig: function toolbarConfig(value) {
514
+ toolbarConfig(value) {
480
515
  if (value) {
481
516
  this.initToolbar();
482
517
  }
483
518
  },
484
- proxyConfig: function proxyConfig() {
519
+ proxyConfig() {
485
520
  this.initProxy();
486
521
  },
487
- pagerConfig: function pagerConfig() {
522
+ pagerConfig() {
488
523
  this.initPages();
489
524
  }
490
525
  },
491
- created: function created() {
526
+ created() {
527
+ const $xeGrid = this;
528
+ const props = $xeGrid;
492
529
  // const { data, formOpts, proxyOpts, proxyConfig } = this
493
530
  // if (proxyConfig && (data || (proxyOpts.form && formOpts.data))) {
494
531
  // errLog('vxe.error.errConflicts', ['grid.data', 'grid.proxy-config'])
495
532
  // }
496
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
533
+ if (process.env.NODE_ENV === 'development') {
497
534
  if (this.toolbar) {
498
535
  (0, _log.warnLog)('vxe.error.delProp', ['grid.toolbar', 'grid.toolbar-config']);
499
536
  }
500
537
  if (this.toolbarConfig && !_xeUtils.default.isObject(this.toolbarConfig)) {
501
- (0, _log.warnLog)('vxe.error.errProp', ["grid.toolbar-config=".concat(this.toolbarConfig), 'grid.toolbar-config={}']);
538
+ (0, _log.warnLog)('vxe.error.errProp', [`grid.toolbar-config=${this.toolbarConfig}`, 'grid.toolbar-config={}']);
502
539
  }
503
540
  // if (proxyOpts.props) {
504
541
  // warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response'])
505
542
  // }
506
543
  }
544
+ if (process.env.NODE_ENV === 'development') {
545
+ // 使用已安装的组件,如果未安装则不渲染
546
+ const VxeUIFormComponent = _ui.VxeUI.getComponent('VxeForm');
547
+ const VxeUIPagerComponent = _ui.VxeUI.getComponent('VxePager');
548
+ $xeGrid.$nextTick(() => {
549
+ if (props.formConfig) {
550
+ if (!VxeUIFormComponent) {
551
+ (0, _log.errLog)('vxe.error.reqComp', ['vxe-form']);
552
+ }
553
+ }
554
+ if (props.pagerConfig) {
555
+ if (!VxeUIPagerComponent) {
556
+ (0, _log.errLog)('vxe.error.reqComp', ['vxe-pager']);
557
+ }
558
+ }
559
+ });
560
+ }
507
561
  this.initPages();
508
562
  globalEvents.on(this, 'keydown', this.handleGlobalKeydownEvent);
509
563
  },
510
- mounted: function mounted() {
564
+ mounted() {
511
565
  if (this.columns && this.columns.length) {
512
566
  this.loadColumn(this.columns);
513
567
  }
514
568
  this.initToolbar();
515
569
  this.initProxy();
516
570
  },
517
- destroyed: function destroyed() {
571
+ destroyed() {
518
572
  globalEvents.off(this, 'keydown');
519
573
  },
520
- render: function render(h) {
521
- var vSize = this.vSize,
522
- isZMax = this.isZMax;
574
+ render(h) {
575
+ const {
576
+ computeSize,
577
+ isZMax
578
+ } = this;
579
+ const vSize = computeSize;
523
580
  return h('div', {
524
- class: ['vxe-grid', _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "size--".concat(vSize), vSize), 'is--animat', !!this.animat), 'is--round', this.round), 'is--maximize', isZMax), 'is--loading', this.loading || this.tableLoading)],
581
+ class: ['vxe-grid', {
582
+ [`size--${vSize}`]: vSize,
583
+ 'is--animat': !!this.animat,
584
+ 'is--round': this.round,
585
+ 'is--maximize': isZMax,
586
+ 'is--loading': this.loading || this.tableLoading
587
+ }],
525
588
  style: this.renderStyle
526
589
  }, renderLayout(h, this));
527
590
  },
528
591
  methods: Object.assign(Object.assign(Object.assign({}, methods), {
529
- callSlot: function callSlot(slotFunc, params, h, vNodes) {
592
+ callSlot(slotFunc, params, h, vNodes) {
530
593
  if (slotFunc) {
531
- var $scopedSlots = this.$scopedSlots;
594
+ const {
595
+ $scopedSlots
596
+ } = this;
532
597
  if (_xeUtils.default.isString(slotFunc)) {
533
598
  slotFunc = $scopedSlots[slotFunc] || null;
534
599
  }
@@ -538,44 +603,54 @@ var _default2 = exports.default = {
538
603
  }
539
604
  return [];
540
605
  },
541
- getParentHeight: function getParentHeight() {
542
- var $el = this.$el,
543
- isZMax = this.isZMax;
606
+ getParentHeight() {
607
+ const {
608
+ $el,
609
+ isZMax
610
+ } = this;
544
611
  return (isZMax ? (0, _dom.getDomNode)().visibleHeight : _xeUtils.default.toNumber(getComputedStyle($el.parentNode).height)) - this.getExcludeHeight();
545
612
  },
546
613
  /**
547
614
  * 获取需要排除的高度
548
615
  */
549
- getExcludeHeight: function getExcludeHeight() {
550
- var $refs = this.$refs,
551
- $el = this.$el,
552
- isZMax = this.isZMax,
553
- height = this.height;
554
- var formWrapper = $refs.formWrapper,
555
- toolbarWrapper = $refs.toolbarWrapper,
556
- topWrapper = $refs.topWrapper,
557
- bottomWrapper = $refs.bottomWrapper,
558
- pagerWrapper = $refs.pagerWrapper;
559
- var parentPaddingSize = isZMax || !(height === 'auto' || height === '100%') ? 0 : (0, _dom.getPaddingTopBottomSize)($el.parentNode);
616
+ getExcludeHeight() {
617
+ const {
618
+ $refs,
619
+ $el,
620
+ isZMax,
621
+ height
622
+ } = this;
623
+ const {
624
+ formWrapper,
625
+ toolbarWrapper,
626
+ topWrapper,
627
+ bottomWrapper,
628
+ pagerWrapper
629
+ } = $refs;
630
+ const parentPaddingSize = isZMax || !(height === 'auto' || height === '100%') ? 0 : (0, _dom.getPaddingTopBottomSize)($el.parentNode);
560
631
  return parentPaddingSize + (0, _dom.getPaddingTopBottomSize)($el) + (0, _dom.getOffsetHeight)(formWrapper) + (0, _dom.getOffsetHeight)(toolbarWrapper) + (0, _dom.getOffsetHeight)(topWrapper) + (0, _dom.getOffsetHeight)(bottomWrapper) + (0, _dom.getOffsetHeight)(pagerWrapper);
561
632
  },
562
- initToolbar: function initToolbar() {
563
- var _this3 = this;
564
- this.$nextTick(function () {
565
- var _this3$$refs = _this3.$refs,
566
- xTable = _this3$$refs.xTable,
567
- xToolbar = _this3$$refs.xToolbar;
633
+ initToolbar() {
634
+ this.$nextTick(() => {
635
+ const {
636
+ xTable,
637
+ xToolbar
638
+ } = this.$refs;
568
639
  if (xTable && xToolbar) {
569
640
  xTable.connect(xToolbar);
570
641
  }
571
642
  });
572
643
  },
573
- initPages: function initPages() {
574
- var tablePage = this.tablePage,
575
- pagerConfig = this.pagerConfig,
576
- pagerOpts = this.pagerOpts;
577
- var currentPage = pagerOpts.currentPage,
578
- pageSize = pagerOpts.pageSize;
644
+ initPages() {
645
+ const {
646
+ tablePage,
647
+ pagerConfig,
648
+ pagerOpts
649
+ } = this;
650
+ const {
651
+ currentPage,
652
+ pageSize
653
+ } = pagerOpts;
579
654
  if (pagerConfig) {
580
655
  if (currentPage) {
581
656
  tablePage.currentPage = currentPage;
@@ -585,26 +660,31 @@ var _default2 = exports.default = {
585
660
  }
586
661
  }
587
662
  },
588
- initProxy: function initProxy() {
589
- var _this4 = this;
590
- var proxyInited = this.proxyInited,
591
- proxyConfig = this.proxyConfig,
592
- proxyOpts = this.proxyOpts,
593
- formConfig = this.formConfig,
594
- formOpts = this.formOpts;
663
+ initProxy() {
664
+ const {
665
+ proxyInited,
666
+ proxyConfig,
667
+ proxyOpts,
668
+ formConfig,
669
+ formOpts
670
+ } = this;
595
671
  if (proxyConfig) {
596
672
  if ((0, _utils.isEnableConf)(formConfig) && proxyOpts.form && formOpts.items) {
597
- var fData = {};
598
- formOpts.items.forEach(function (item) {
599
- var field = item.field,
600
- itemRender = item.itemRender;
673
+ const fData = {};
674
+ formOpts.items.forEach(item => {
675
+ const {
676
+ field,
677
+ itemRender
678
+ } = item;
601
679
  if (field) {
602
- var itemValue = null;
680
+ let itemValue = null;
603
681
  if (itemRender) {
604
- var defaultValue = itemRender.defaultValue;
682
+ const {
683
+ defaultValue
684
+ } = itemRender;
605
685
  if (_xeUtils.default.isFunction(defaultValue)) {
606
686
  itemValue = defaultValue({
607
- item: item
687
+ item
608
688
  });
609
689
  } else if (!_xeUtils.default.isUndefined(defaultValue)) {
610
690
  itemValue = defaultValue;
@@ -617,20 +697,18 @@ var _default2 = exports.default = {
617
697
  }
618
698
  if (!proxyInited && proxyOpts.autoLoad !== false) {
619
699
  this.proxyInited = true;
620
- this.$nextTick().then(function () {
621
- return _this4.commitProxy('_init');
622
- }).then(function (rest) {
623
- _this4.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
700
+ this.$nextTick().then(() => this.commitProxy('_init')).then(rest => {
701
+ this.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
624
702
  isInited: true,
625
- $grid: _this4,
703
+ $grid: this,
626
704
  $event: new Event('init')
627
705
  }));
628
706
  });
629
707
  }
630
708
  }
631
709
  },
632
- handleGlobalKeydownEvent: function handleGlobalKeydownEvent(evnt) {
633
- var isEsc = evnt.keyCode === 27;
710
+ handleGlobalKeydownEvent(evnt) {
711
+ const isEsc = evnt.keyCode === 27;
634
712
  if (isEsc && this.isZMax && this.zoomOpts.escRestore !== false) {
635
713
  this.triggerZoomEvent(evnt);
636
714
  }
@@ -639,37 +717,37 @@ var _default2 = exports.default = {
639
717
  * 提交指令,支持 code 或 button
640
718
  * @param {String/Object} code 字符串或对象
641
719
  */
642
- commitProxy: function commitProxy(proxyTarget) {
643
- var _this5 = this;
644
- var $refs = this.$refs,
645
- toolbar = this.toolbar,
646
- toolbarConfig = this.toolbarConfig,
647
- toolbarOpts = this.toolbarOpts,
648
- proxyOpts = this.proxyOpts,
649
- tablePage = this.tablePage,
650
- pagerConfig = this.pagerConfig,
651
- editRules = this.editRules,
652
- isRespMsg = this.isRespMsg,
653
- isActiveMsg = this.isActiveMsg,
654
- validConfig = this.validConfig,
655
- pagerOpts = this.pagerOpts;
656
- var beforeQuery = proxyOpts.beforeQuery,
657
- afterQuery = proxyOpts.afterQuery,
658
- beforeDelete = proxyOpts.beforeDelete,
659
- afterDelete = proxyOpts.afterDelete,
660
- beforeSave = proxyOpts.beforeSave,
661
- afterSave = proxyOpts.afterSave,
662
- _proxyOpts$ajax = proxyOpts.ajax,
663
- ajax = _proxyOpts$ajax === void 0 ? {} : _proxyOpts$ajax;
664
- var resConfigs = proxyOpts.response || proxyOpts.props || {};
665
- var $xetable = $refs.xTable;
666
- var formData = this.getFormData();
667
- var button;
668
- var code;
720
+ commitProxy(proxyTarget, ...args) {
721
+ const {
722
+ $refs,
723
+ toolbar,
724
+ toolbarConfig,
725
+ toolbarOpts,
726
+ proxyOpts,
727
+ tablePage,
728
+ pagerConfig,
729
+ editRules,
730
+ isRespMsg,
731
+ isActiveMsg,
732
+ validConfig,
733
+ pagerOpts
734
+ } = this;
735
+ const {
736
+ beforeQuery,
737
+ afterQuery,
738
+ beforeDelete,
739
+ afterDelete,
740
+ beforeSave,
741
+ afterSave,
742
+ ajax = {}
743
+ } = proxyOpts;
744
+ const resConfigs = proxyOpts.response || proxyOpts.props || {};
745
+ const $xetable = $refs.xTable;
746
+ const formData = this.getFormData();
747
+ let button;
748
+ let code;
669
749
  if (_xeUtils.default.isString(proxyTarget)) {
670
- var matchObj = toolbarConfig || toolbar ? _xeUtils.default.findTree(toolbarOpts.buttons, function (item) {
671
- return item.code === proxyTarget;
672
- }, {
750
+ const matchObj = toolbarConfig || toolbar ? _xeUtils.default.findTree(toolbarOpts.buttons, item => item.code === proxyTarget, {
673
751
  children: 'dropdowns'
674
752
  }) : null;
675
753
  code = proxyTarget;
@@ -678,32 +756,25 @@ var _default2 = exports.default = {
678
756
  button = proxyTarget;
679
757
  code = button.code;
680
758
  }
681
- var btnParams = button ? button.params : null;
682
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
683
- args[_key2 - 1] = arguments[_key2];
684
- }
759
+ const btnParams = button ? button.params : null;
685
760
  switch (code) {
686
761
  case 'insert':
687
762
  return this.insert();
688
763
  case 'insert_edit':
689
- return this.insert().then(function (_ref2) {
690
- var row = _ref2.row;
691
- return _this5.setEditRow(row);
692
- });
764
+ return this.insert().then(({
765
+ row
766
+ }) => this.setEditRow(row));
693
767
  // 已废弃
694
768
  case 'insert_actived':
695
- return this.insert().then(function (_ref3) {
696
- var row = _ref3.row;
697
- return _this5.setEditRow(row);
698
- });
769
+ return this.insert().then(({
770
+ row
771
+ }) => this.setEditRow(row));
699
772
  // 已废弃
700
773
  case 'mark_cancel':
701
774
  this.triggerPendingEvent(code);
702
775
  break;
703
776
  case 'remove':
704
- return this.handleDeleteRow(code, 'vxe.grid.removeSelectRecord', function () {
705
- return _this5.removeCheckboxRow();
706
- });
777
+ return this.handleDeleteRow(code, 'vxe.grid.removeSelectRecord', () => this.removeCheckboxRow());
707
778
  case 'import':
708
779
  this.importData(btnParams);
709
780
  break;
@@ -723,15 +794,15 @@ var _default2 = exports.default = {
723
794
  case 'reload':
724
795
  case 'query':
725
796
  {
726
- var ajaxMethods = ajax.query;
727
- var querySuccessMethods = ajax.querySuccess;
728
- var queryErrorMethods = ajax.queryError;
797
+ const ajaxMethods = ajax.query;
798
+ const querySuccessMethods = ajax.querySuccess;
799
+ const queryErrorMethods = ajax.queryError;
729
800
  if (ajaxMethods) {
730
- var isInited = code === '_init';
731
- var isReload = code === 'reload';
732
- var sortList = [];
733
- var filterList = [];
734
- var pageParams = {};
801
+ const isInited = code === '_init';
802
+ const isReload = code === 'reload';
803
+ let sortList = [];
804
+ let filterList = [];
805
+ let pageParams = {};
735
806
  if (pagerConfig) {
736
807
  if (isInited || isReload) {
737
808
  tablePage.currentPage = 1;
@@ -741,14 +812,19 @@ var _default2 = exports.default = {
741
812
  }
742
813
  }
743
814
  if (isInited) {
744
- var sortOpts = $xetable.sortOpts;
745
- var defaultSort = sortOpts.defaultSort;
815
+ let defaultSort = null;
816
+ if ($xetable) {
817
+ const {
818
+ sortOpts
819
+ } = $xetable;
820
+ defaultSort = sortOpts.defaultSort;
821
+ }
746
822
  // 如果使用默认排序
747
823
  if (defaultSort) {
748
824
  if (!_xeUtils.default.isArray(defaultSort)) {
749
825
  defaultSort = [defaultSort];
750
826
  }
751
- sortList = defaultSort.map(function (item) {
827
+ sortList = defaultSort.map(item => {
752
828
  return {
753
829
  field: item.field,
754
830
  property: item.field,
@@ -756,20 +832,24 @@ var _default2 = exports.default = {
756
832
  };
757
833
  });
758
834
  }
759
- filterList = $xetable.getCheckedFilters();
760
- } else {
761
- if (isReload) {
762
- $xetable.clearAll();
763
- } else {
764
- sortList = $xetable.getSortColumns();
835
+ if ($xetable) {
765
836
  filterList = $xetable.getCheckedFilters();
766
837
  }
838
+ } else {
839
+ if ($xetable) {
840
+ if (isReload) {
841
+ $xetable.clearAll();
842
+ } else {
843
+ sortList = $xetable.getSortColumns();
844
+ filterList = $xetable.getCheckedFilters();
845
+ }
846
+ }
767
847
  }
768
- var commitParams = {
769
- code: code,
770
- button: button,
771
- isInited: isInited,
772
- isReload: isReload,
848
+ const commitParams = {
849
+ code,
850
+ button,
851
+ isInited,
852
+ isReload,
773
853
  $grid: this,
774
854
  page: pageParams,
775
855
  sort: sortList.length ? sortList[0] : {},
@@ -781,39 +861,39 @@ var _default2 = exports.default = {
781
861
  this.sortData = sortList;
782
862
  this.filterData = filterList;
783
863
  this.tableLoading = true;
784
- var applyArgs = [commitParams].concat(args);
785
- return Promise.resolve((beforeQuery || ajaxMethods).apply(void 0, _toConsumableArray(applyArgs))).then(function (rest) {
786
- _this5.tableLoading = false;
864
+ const applyArgs = [commitParams].concat(args);
865
+ return Promise.resolve((beforeQuery || ajaxMethods)(...applyArgs)).then(rest => {
866
+ this.tableLoading = false;
787
867
  if (rest) {
788
868
  if (pagerConfig && (0, _utils.isEnableConf)(pagerOpts)) {
789
- var totalProp = resConfigs.total;
790
- var total = (_xeUtils.default.isFunction(totalProp) ? totalProp({
869
+ const totalProp = resConfigs.total;
870
+ const total = (_xeUtils.default.isFunction(totalProp) ? totalProp({
791
871
  data: rest,
792
- $grid: _this5
872
+ $grid: this
793
873
  }) : _xeUtils.default.get(rest, totalProp || 'page.total')) || 0;
794
874
  tablePage.total = _xeUtils.default.toNumber(total);
795
- var resultProp = resConfigs.result;
796
- _this5.tableData = (_xeUtils.default.isFunction(resultProp) ? resultProp({
875
+ const resultProp = resConfigs.result;
876
+ this.tableData = (_xeUtils.default.isFunction(resultProp) ? resultProp({
797
877
  data: rest,
798
- $grid: _this5
878
+ $grid: this
799
879
  }) : _xeUtils.default.get(rest, resultProp || 'result')) || [];
800
880
  // 检验当前页码,不能超出当前最大页数
801
- var pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
881
+ const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
802
882
  if (tablePage.currentPage > pageCount) {
803
883
  tablePage.currentPage = pageCount;
804
884
  }
805
885
  } else {
806
- var listProp = resConfigs.list;
807
- _this5.tableData = (listProp ? _xeUtils.default.isFunction(listProp) ? listProp({
886
+ const listProp = resConfigs.list;
887
+ this.tableData = (listProp ? _xeUtils.default.isFunction(listProp) ? listProp({
808
888
  data: rest,
809
- $grid: _this5
889
+ $grid: this
810
890
  }) : _xeUtils.default.get(rest, listProp) : rest) || [];
811
891
  }
812
892
  } else {
813
- _this5.tableData = [];
893
+ this.tableData = [];
814
894
  }
815
895
  if (afterQuery) {
816
- afterQuery.apply(void 0, _toConsumableArray(applyArgs));
896
+ afterQuery(...applyArgs);
817
897
  }
818
898
  if (querySuccessMethods) {
819
899
  querySuccessMethods(Object.assign(Object.assign({}, commitParams), {
@@ -823,8 +903,8 @@ var _default2 = exports.default = {
823
903
  return {
824
904
  status: true
825
905
  };
826
- }).catch(function (rest) {
827
- _this5.tableLoading = false;
906
+ }).catch(rest => {
907
+ this.tableLoading = false;
828
908
  if (queryErrorMethods) {
829
909
  queryErrorMethods(Object.assign(Object.assign({}, commitParams), {
830
910
  response: rest
@@ -835,7 +915,7 @@ var _default2 = exports.default = {
835
915
  };
836
916
  });
837
917
  } else {
838
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
918
+ if (process.env.NODE_ENV === 'development') {
839
919
  (0, _log.errLog)('vxe.error.notFunc', ['proxy-config.ajax.query']);
840
920
  }
841
921
  }
@@ -843,77 +923,75 @@ var _default2 = exports.default = {
843
923
  }
844
924
  case 'delete':
845
925
  {
846
- var _ajaxMethods = ajax.delete;
847
- var deleteSuccessMethods = ajax.deleteSuccess;
848
- var deleteErrorMethods = ajax.deleteError;
849
- if (_ajaxMethods) {
850
- var selectRecords = $xetable.getCheckboxRecords();
851
- var removeRecords = selectRecords.filter(function (row) {
852
- return !$xetable.isInsertByRow(row);
853
- });
854
- var body = {
855
- removeRecords: removeRecords
926
+ const ajaxMethods = ajax.delete;
927
+ const deleteSuccessMethods = ajax.deleteSuccess;
928
+ const deleteErrorMethods = ajax.deleteError;
929
+ if (ajaxMethods) {
930
+ const selectRecords = $xetable.getCheckboxRecords();
931
+ const removeRecords = selectRecords.filter(row => !$xetable.isInsertByRow(row));
932
+ const body = {
933
+ removeRecords
856
934
  };
857
- var _commitParams = {
935
+ const commitParams = {
858
936
  $grid: this,
859
- code: code,
860
- button: button,
861
- body: body,
937
+ code,
938
+ button,
939
+ body,
862
940
  form: formData,
863
- options: _ajaxMethods
941
+ options: ajaxMethods
864
942
  };
865
- var _applyArgs = [_commitParams].concat(args);
943
+ const applyArgs = [commitParams].concat(args);
866
944
  if (selectRecords.length) {
867
- return this.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', function () {
945
+ return this.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
868
946
  if (!removeRecords.length) {
869
947
  return $xetable.remove(selectRecords);
870
948
  }
871
- _this5.tableLoading = true;
872
- return Promise.resolve((beforeDelete || _ajaxMethods).apply(void 0, _toConsumableArray(_applyArgs))).then(function (rest) {
873
- _this5.tableLoading = false;
949
+ this.tableLoading = true;
950
+ return Promise.resolve((beforeDelete || ajaxMethods)(...applyArgs)).then(rest => {
951
+ this.tableLoading = false;
874
952
  $xetable.setPendingRow(removeRecords, false);
875
953
  if (isRespMsg) {
876
954
  // 检测弹窗模块
877
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
955
+ if (process.env.NODE_ENV === 'development') {
878
956
  if (!_ui.VxeUI.modal) {
879
957
  (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
880
958
  }
881
959
  }
882
960
  _ui.VxeUI.modal.message({
883
- content: _this5.getRespMsg(rest, 'vxe.grid.delSuccess'),
961
+ content: this.getRespMsg(rest, 'vxe.grid.delSuccess'),
884
962
  status: 'success'
885
963
  });
886
964
  }
887
965
  if (afterDelete) {
888
- afterDelete.apply(void 0, _toConsumableArray(_applyArgs));
966
+ afterDelete(...applyArgs);
889
967
  } else {
890
- _this5.commitProxy('query');
968
+ this.commitProxy('query');
891
969
  }
892
970
  if (deleteSuccessMethods) {
893
- deleteSuccessMethods(Object.assign(Object.assign({}, _commitParams), {
971
+ deleteSuccessMethods(Object.assign(Object.assign({}, commitParams), {
894
972
  response: rest
895
973
  }));
896
974
  }
897
975
  return {
898
976
  status: true
899
977
  };
900
- }).catch(function (rest) {
901
- _this5.tableLoading = false;
978
+ }).catch(rest => {
979
+ this.tableLoading = false;
902
980
  if (isRespMsg) {
903
981
  // 检测弹窗模块
904
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
982
+ if (process.env.NODE_ENV === 'development') {
905
983
  if (!_ui.VxeUI.modal) {
906
984
  (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
907
985
  }
908
986
  }
909
987
  _ui.VxeUI.modal.message({
910
988
  id: code,
911
- content: _this5.getRespMsg(rest, 'vxe.grid.operError'),
989
+ content: this.getRespMsg(rest, 'vxe.grid.operError'),
912
990
  status: 'error'
913
991
  });
914
992
  }
915
993
  if (deleteErrorMethods) {
916
- deleteErrorMethods(Object.assign(Object.assign({}, _commitParams), {
994
+ deleteErrorMethods(Object.assign(Object.assign({}, commitParams), {
917
995
  response: rest
918
996
  }));
919
997
  }
@@ -925,7 +1003,7 @@ var _default2 = exports.default = {
925
1003
  } else {
926
1004
  if (isActiveMsg) {
927
1005
  // 检测弹窗模块
928
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1006
+ if (process.env.NODE_ENV === 'development') {
929
1007
  if (!_ui.VxeUI.modal) {
930
1008
  (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
931
1009
  }
@@ -938,7 +1016,7 @@ var _default2 = exports.default = {
938
1016
  }
939
1017
  }
940
1018
  } else {
941
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1019
+ if (process.env.NODE_ENV === 'development') {
942
1020
  (0, _log.errLog)('vxe.error.notFunc', ['proxy-config.ajax.delete']);
943
1021
  }
944
1022
  }
@@ -946,93 +1024,91 @@ var _default2 = exports.default = {
946
1024
  }
947
1025
  case 'save':
948
1026
  {
949
- var _ajaxMethods2 = ajax.save;
950
- var saveSuccessMethods = ajax.saveSuccess;
951
- var saveErrorMethods = ajax.saveError;
952
- if (_ajaxMethods2) {
953
- var _body = this.getRecordset();
954
- var insertRecords = _body.insertRecords,
955
- _removeRecords = _body.removeRecords,
956
- updateRecords = _body.updateRecords,
957
- pendingRecords = _body.pendingRecords;
958
- var _commitParams2 = {
1027
+ const ajaxMethods = ajax.save;
1028
+ const saveSuccessMethods = ajax.saveSuccess;
1029
+ const saveErrorMethods = ajax.saveError;
1030
+ if (ajaxMethods) {
1031
+ const body = this.getRecordset();
1032
+ const {
1033
+ insertRecords,
1034
+ removeRecords,
1035
+ updateRecords,
1036
+ pendingRecords
1037
+ } = body;
1038
+ const commitParams = {
959
1039
  $grid: this,
960
- code: code,
961
- button: button,
962
- body: _body,
1040
+ code,
1041
+ button,
1042
+ body,
963
1043
  form: formData,
964
- options: _ajaxMethods2
1044
+ options: ajaxMethods
965
1045
  };
966
- var _applyArgs2 = [_commitParams2].concat(args);
1046
+ const applyArgs = [commitParams].concat(args);
967
1047
  // 排除掉新增且标记为删除的数据
968
1048
  if (insertRecords.length) {
969
- _body.pendingRecords = pendingRecords.filter(function (row) {
970
- return insertRecords.indexOf(row) === -1;
971
- });
1049
+ body.pendingRecords = pendingRecords.filter(row => insertRecords.indexOf(row) === -1);
972
1050
  }
973
1051
  // 排除已标记为删除的数据
974
1052
  if (pendingRecords.length) {
975
- _body.insertRecords = insertRecords.filter(function (row) {
976
- return pendingRecords.indexOf(row) === -1;
977
- });
1053
+ body.insertRecords = insertRecords.filter(row => pendingRecords.indexOf(row) === -1);
978
1054
  }
979
- var restPromise = Promise.resolve();
1055
+ let restPromise = Promise.resolve();
980
1056
  if (editRules) {
981
1057
  // 只校验新增和修改的数据
982
- restPromise = this[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](_body.insertRecords.concat(updateRecords));
1058
+ restPromise = this[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](body.insertRecords.concat(updateRecords));
983
1059
  }
984
- return restPromise.then(function (errMap) {
1060
+ return restPromise.then(errMap => {
985
1061
  if (errMap) {
986
1062
  // 如果校验不通过
987
1063
  return;
988
1064
  }
989
- if (_body.insertRecords.length || _removeRecords.length || updateRecords.length || _body.pendingRecords.length) {
990
- _this5.tableLoading = true;
991
- return Promise.resolve((beforeSave || _ajaxMethods2).apply(void 0, _toConsumableArray(_applyArgs2))).then(function (rest) {
992
- _this5.tableLoading = false;
1065
+ if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
1066
+ this.tableLoading = true;
1067
+ return Promise.resolve((beforeSave || ajaxMethods)(...applyArgs)).then(rest => {
1068
+ this.tableLoading = false;
993
1069
  $xetable.clearPendingRow();
994
1070
  if (isRespMsg) {
995
1071
  // 检测弹窗模块
996
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1072
+ if (process.env.NODE_ENV === 'development') {
997
1073
  if (!_ui.VxeUI.modal) {
998
1074
  (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
999
1075
  }
1000
1076
  }
1001
1077
  _ui.VxeUI.modal.message({
1002
- content: _this5.getRespMsg(rest, 'vxe.grid.saveSuccess'),
1078
+ content: this.getRespMsg(rest, 'vxe.grid.saveSuccess'),
1003
1079
  status: 'success'
1004
1080
  });
1005
1081
  }
1006
1082
  if (afterSave) {
1007
- afterSave.apply(void 0, _toConsumableArray(_applyArgs2));
1083
+ afterSave(...applyArgs);
1008
1084
  } else {
1009
- _this5.commitProxy('query');
1085
+ this.commitProxy('query');
1010
1086
  }
1011
1087
  if (saveSuccessMethods) {
1012
- saveSuccessMethods(Object.assign(Object.assign({}, _commitParams2), {
1088
+ saveSuccessMethods(Object.assign(Object.assign({}, commitParams), {
1013
1089
  response: rest
1014
1090
  }));
1015
1091
  }
1016
1092
  return {
1017
1093
  status: true
1018
1094
  };
1019
- }).catch(function (rest) {
1020
- _this5.tableLoading = false;
1095
+ }).catch(rest => {
1096
+ this.tableLoading = false;
1021
1097
  if (isRespMsg) {
1022
1098
  // 检测弹窗模块
1023
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1099
+ if (process.env.NODE_ENV === 'development') {
1024
1100
  if (!_ui.VxeUI.modal) {
1025
1101
  (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
1026
1102
  }
1027
1103
  }
1028
1104
  _ui.VxeUI.modal.message({
1029
1105
  id: code,
1030
- content: _this5.getRespMsg(rest, 'vxe.grid.operError'),
1106
+ content: this.getRespMsg(rest, 'vxe.grid.operError'),
1031
1107
  status: 'error'
1032
1108
  });
1033
1109
  }
1034
1110
  if (saveErrorMethods) {
1035
- saveErrorMethods(Object.assign(Object.assign({}, _commitParams2), {
1111
+ saveErrorMethods(Object.assign(Object.assign({}, commitParams), {
1036
1112
  response: rest
1037
1113
  }));
1038
1114
  }
@@ -1043,7 +1119,7 @@ var _default2 = exports.default = {
1043
1119
  } else {
1044
1120
  if (isActiveMsg) {
1045
1121
  // 检测弹窗模块
1046
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1122
+ if (process.env.NODE_ENV === 'development') {
1047
1123
  if (!_ui.VxeUI.modal) {
1048
1124
  (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
1049
1125
  }
@@ -1057,7 +1133,7 @@ var _default2 = exports.default = {
1057
1133
  }
1058
1134
  });
1059
1135
  } else {
1060
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1136
+ if (process.env.NODE_ENV === 'development') {
1061
1137
  (0, _log.errLog)('vxe.error.notFunc', ['proxy-config.ajax.save']);
1062
1138
  }
1063
1139
  }
@@ -1065,17 +1141,17 @@ var _default2 = exports.default = {
1065
1141
  }
1066
1142
  default:
1067
1143
  {
1068
- var gCommandOpts = commands.get(code);
1144
+ const gCommandOpts = commands.get(code);
1069
1145
  if (gCommandOpts) {
1070
1146
  if (gCommandOpts.commandMethod) {
1071
- gCommandOpts.commandMethod.apply(gCommandOpts, [{
1072
- code: code,
1073
- button: button,
1147
+ gCommandOpts.commandMethod({
1148
+ code,
1149
+ button,
1074
1150
  $grid: this,
1075
1151
  $table: $xetable
1076
- }].concat(args));
1152
+ }, ...args);
1077
1153
  } else {
1078
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1154
+ if (process.env.NODE_ENV === 'development') {
1079
1155
  (0, _log.errLog)('vxe.error.notCommands', [code]);
1080
1156
  }
1081
1157
  }
@@ -1084,37 +1160,39 @@ var _default2 = exports.default = {
1084
1160
  }
1085
1161
  return this.$nextTick();
1086
1162
  },
1087
- getRespMsg: function getRespMsg(rest, defaultMsg) {
1088
- var proxyOpts = this.proxyOpts;
1089
- var resConfigs = proxyOpts.response || proxyOpts.props || {};
1090
- var msg;
1163
+ getRespMsg(rest, defaultMsg) {
1164
+ const {
1165
+ proxyOpts
1166
+ } = this;
1167
+ const resConfigs = proxyOpts.response || proxyOpts.props || {};
1168
+ let msg;
1091
1169
  if (rest && resConfigs.message) {
1092
1170
  msg = _xeUtils.default.get(rest, resConfigs.message);
1093
1171
  }
1094
1172
  return msg || getI18n(defaultMsg);
1095
1173
  },
1096
- handleDeleteRow: function handleDeleteRow(code, alertKey, callback) {
1097
- var selectRecords = this.getCheckboxRecords();
1174
+ handleDeleteRow(code, alertKey, callback) {
1175
+ const selectRecords = this.getCheckboxRecords();
1098
1176
  if (this.isActiveMsg) {
1099
1177
  if (selectRecords.length) {
1100
1178
  return _ui.VxeUI.modal.confirm({
1101
- id: "cfm_".concat(code),
1179
+ id: `cfm_${code}`,
1102
1180
  content: getI18n(alertKey),
1103
1181
  escClosable: true
1104
- }).then(function (type) {
1182
+ }).then(type => {
1105
1183
  if (type === 'confirm') {
1106
1184
  return callback();
1107
1185
  }
1108
1186
  });
1109
1187
  } else {
1110
1188
  // 检测弹窗模块
1111
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1189
+ if (process.env.NODE_ENV === 'development') {
1112
1190
  if (!_ui.VxeUI.modal) {
1113
1191
  (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
1114
1192
  }
1115
1193
  }
1116
1194
  _ui.VxeUI.modal.message({
1117
- id: "msg_".concat(code),
1195
+ id: `msg_${code}`,
1118
1196
  content: getI18n('vxe.grid.selectOneRecord'),
1119
1197
  status: 'warning'
1120
1198
  });
@@ -1126,65 +1204,72 @@ var _default2 = exports.default = {
1126
1204
  }
1127
1205
  return Promise.resolve();
1128
1206
  },
1129
- getFormData: function getFormData() {
1130
- var proxyConfig = this.proxyConfig,
1131
- proxyOpts = this.proxyOpts,
1132
- formOpts = this.formOpts,
1133
- formData = this.formData;
1207
+ getFormData() {
1208
+ const {
1209
+ proxyConfig,
1210
+ proxyOpts,
1211
+ formOpts,
1212
+ formData
1213
+ } = this;
1134
1214
  return proxyConfig && (0, _utils.isEnableConf)(proxyOpts) && proxyOpts.form ? formData : formOpts.data;
1135
1215
  },
1136
- getFormItems: function getFormItems(itemIndex) {
1137
- var formConfig = this.formConfig,
1138
- formOpts = this.formOpts;
1139
- var itemList = [];
1140
- _xeUtils.default.eachTree((0, _utils.isEnableConf)(formConfig) && formOpts.items ? formOpts.items : [], function (item) {
1216
+ getFormItems(itemIndex) {
1217
+ const {
1218
+ formConfig,
1219
+ formOpts
1220
+ } = this;
1221
+ const itemList = [];
1222
+ _xeUtils.default.eachTree((0, _utils.isEnableConf)(formConfig) && formOpts.items ? formOpts.items : [], item => {
1141
1223
  itemList.push(item);
1142
1224
  }, {
1143
1225
  children: 'children'
1144
1226
  });
1145
1227
  return _xeUtils.default.isUndefined(itemIndex) ? itemList : itemList[itemIndex];
1146
1228
  },
1147
- triggerToolbarCommitEvent: function triggerToolbarCommitEvent(params, evnt) {
1148
- var _this6 = this;
1149
- var code = params.code;
1150
- return this.commitProxy(params, evnt).then(function (rest) {
1229
+ triggerToolbarCommitEvent(params, evnt) {
1230
+ const {
1231
+ code
1232
+ } = params;
1233
+ return this.commitProxy(params, evnt).then(rest => {
1151
1234
  if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
1152
- _this6.$emit(code === 'delete' || code === 'save' ? "proxy-".concat(code) : 'proxy-query', Object.assign(Object.assign({}, rest), {
1235
+ this.$emit(code === 'delete' || code === 'save' ? `proxy-${code}` : 'proxy-query', Object.assign(Object.assign({}, rest), {
1153
1236
  isReload: code === 'reload',
1154
- $grid: _this6,
1237
+ $grid: this,
1155
1238
  $event: evnt
1156
1239
  }));
1157
1240
  }
1158
1241
  });
1159
1242
  },
1160
- triggerToolbarBtnEvent: function triggerToolbarBtnEvent(button, evnt) {
1243
+ triggerToolbarBtnEvent(button, evnt) {
1161
1244
  this.triggerToolbarCommitEvent(button, evnt);
1162
1245
  this.$emit('toolbar-button-click', {
1163
1246
  code: button.code,
1164
- button: button,
1247
+ button,
1165
1248
  $grid: this,
1166
1249
  $event: evnt
1167
1250
  });
1168
1251
  },
1169
- triggerToolbarTolEvent: function triggerToolbarTolEvent(tool, evnt) {
1252
+ triggerToolbarTolEvent(tool, evnt) {
1170
1253
  this.triggerToolbarCommitEvent(tool, evnt);
1171
1254
  this.$emit('toolbar-tool-click', {
1172
1255
  code: tool.code,
1173
- tool: tool,
1256
+ tool,
1174
1257
  $grid: this,
1175
1258
  $event: evnt
1176
1259
  });
1177
1260
  },
1178
- triggerPendingEvent: function triggerPendingEvent(code) {
1179
- var isActiveMsg = this.isActiveMsg;
1180
- var selectRecords = this.getCheckboxRecords();
1261
+ triggerPendingEvent(code) {
1262
+ const {
1263
+ isActiveMsg
1264
+ } = this;
1265
+ const selectRecords = this.getCheckboxRecords();
1181
1266
  if (selectRecords.length) {
1182
1267
  this.togglePendingRow(selectRecords);
1183
1268
  this.clearCheckboxRow();
1184
1269
  } else {
1185
1270
  if (isActiveMsg) {
1186
1271
  // 检测弹窗模块
1187
- if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1272
+ if (process.env.NODE_ENV === 'development') {
1188
1273
  if (!_ui.VxeUI.modal) {
1189
1274
  (0, _log.errLog)('vxe.error.reqModule', ['Modal']);
1190
1275
  }
@@ -1197,40 +1282,44 @@ var _default2 = exports.default = {
1197
1282
  }
1198
1283
  }
1199
1284
  },
1200
- pageChangeEvent: function pageChangeEvent(params) {
1201
- var _this7 = this;
1202
- var proxyConfig = this.proxyConfig,
1203
- tablePage = this.tablePage;
1204
- var currentPage = params.currentPage,
1205
- pageSize = params.pageSize;
1285
+ pageChangeEvent(params) {
1286
+ const {
1287
+ proxyConfig,
1288
+ tablePage
1289
+ } = this;
1290
+ const {
1291
+ currentPage,
1292
+ pageSize
1293
+ } = params;
1206
1294
  tablePage.currentPage = currentPage;
1207
1295
  tablePage.pageSize = pageSize;
1208
1296
  this.$emit('page-change', Object.assign({
1209
1297
  $grid: this
1210
1298
  }, params));
1211
1299
  if (proxyConfig) {
1212
- this.commitProxy('query').then(function (rest) {
1213
- _this7.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
1214
- $grid: _this7,
1300
+ this.commitProxy('query').then(rest => {
1301
+ this.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
1302
+ $grid: this,
1215
1303
  $event: params.$event
1216
1304
  }));
1217
1305
  });
1218
1306
  }
1219
1307
  },
1220
- sortChangeEvent: function sortChangeEvent(params) {
1221
- var _this8 = this;
1222
- var $table = params.$table,
1223
- column = params.column,
1224
- sortList = params.sortList;
1225
- var isRemote = _xeUtils.default.isBoolean(column.remoteSort) ? column.remoteSort : $table.sortOpts.remote;
1308
+ sortChangeEvent(params) {
1309
+ const {
1310
+ $table,
1311
+ column,
1312
+ sortList
1313
+ } = params;
1314
+ const isRemote = _xeUtils.default.isBoolean(column.remoteSort) ? column.remoteSort : $table.sortOpts.remote;
1226
1315
  // 如果是服务端排序
1227
1316
  if (isRemote) {
1228
1317
  this.sortData = sortList;
1229
1318
  if (this.proxyConfig) {
1230
1319
  this.tablePage.currentPage = 1;
1231
- this.commitProxy('query').then(function (rest) {
1232
- _this8.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
1233
- $grid: _this8,
1320
+ this.commitProxy('query').then(rest => {
1321
+ this.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
1322
+ $grid: this,
1234
1323
  $event: params.$event
1235
1324
  }));
1236
1325
  });
@@ -1240,18 +1329,19 @@ var _default2 = exports.default = {
1240
1329
  $grid: this
1241
1330
  }, params));
1242
1331
  },
1243
- filterChangeEvent: function filterChangeEvent(params) {
1244
- var _this9 = this;
1245
- var $table = params.$table,
1246
- filterList = params.filterList;
1332
+ filterChangeEvent(params) {
1333
+ const {
1334
+ $table,
1335
+ filterList
1336
+ } = params;
1247
1337
  // 如果是服务端过滤
1248
1338
  if ($table.filterOpts.remote) {
1249
1339
  this.filterData = filterList;
1250
1340
  if (this.proxyConfig) {
1251
1341
  this.tablePage.currentPage = 1;
1252
- this.commitProxy('query').then(function (rest) {
1253
- _this9.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
1254
- $grid: _this9,
1342
+ this.commitProxy('query').then(rest => {
1343
+ this.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
1344
+ $grid: this,
1255
1345
  $event: params.$event
1256
1346
  }));
1257
1347
  });
@@ -1261,14 +1351,15 @@ var _default2 = exports.default = {
1261
1351
  $grid: this
1262
1352
  }, params));
1263
1353
  },
1264
- submitEvent: function submitEvent(params) {
1265
- var _this10 = this;
1266
- var proxyConfig = this.proxyConfig;
1354
+ submitEvent(params) {
1355
+ const {
1356
+ proxyConfig
1357
+ } = this;
1267
1358
  if (proxyConfig) {
1268
- this.commitProxy('reload').then(function (rest) {
1269
- _this10.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
1359
+ this.commitProxy('reload').then(rest => {
1360
+ this.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
1270
1361
  isReload: true,
1271
- $grid: _this10,
1362
+ $grid: this,
1272
1363
  $event: params.$event
1273
1364
  }));
1274
1365
  });
@@ -1277,14 +1368,15 @@ var _default2 = exports.default = {
1277
1368
  $grid: this
1278
1369
  }, params));
1279
1370
  },
1280
- resetEvent: function resetEvent(params) {
1281
- var _this11 = this;
1282
- var proxyConfig = this.proxyConfig;
1371
+ resetEvent(params) {
1372
+ const {
1373
+ proxyConfig
1374
+ } = this;
1283
1375
  if (proxyConfig) {
1284
- this.commitProxy('reload').then(function (rest) {
1285
- _this11.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
1376
+ this.commitProxy('reload').then(rest => {
1377
+ this.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
1286
1378
  isReload: true,
1287
- $grid: _this11,
1379
+ $grid: this,
1288
1380
  $event: params.$event
1289
1381
  }));
1290
1382
  });
@@ -1293,16 +1385,13 @@ var _default2 = exports.default = {
1293
1385
  $grid: this
1294
1386
  }, params));
1295
1387
  },
1296
- submitInvalidEvent: function submitInvalidEvent(params) {
1388
+ submitInvalidEvent(params) {
1297
1389
  this.$emit('form-submit-invalid', Object.assign({
1298
1390
  $grid: this
1299
1391
  }, params));
1300
1392
  },
1301
- collapseEvent: function collapseEvent(params) {
1302
- var _this12 = this;
1303
- this.$nextTick(function () {
1304
- return _this12.recalculate(true);
1305
- });
1393
+ collapseEvent(params) {
1394
+ this.$nextTick(() => this.recalculate(true));
1306
1395
  this.$emit('form-toggle-collapse', Object.assign({
1307
1396
  $grid: this
1308
1397
  }, params));
@@ -1310,7 +1399,7 @@ var _default2 = exports.default = {
1310
1399
  $grid: this
1311
1400
  }, params));
1312
1401
  },
1313
- triggerZoomEvent: function triggerZoomEvent(evnt) {
1402
+ triggerZoomEvent(evnt) {
1314
1403
  this.zoom();
1315
1404
  this.$emit('zoom', {
1316
1405
  $grid: this,
@@ -1318,38 +1407,37 @@ var _default2 = exports.default = {
1318
1407
  $event: evnt
1319
1408
  });
1320
1409
  },
1321
- zoom: function zoom() {
1410
+ zoom() {
1322
1411
  return this[this.isZMax ? 'revert' : 'maximize']();
1323
1412
  },
1324
- isMaximized: function isMaximized() {
1413
+ isMaximized() {
1325
1414
  return this.isZMax;
1326
1415
  },
1327
- maximize: function maximize() {
1416
+ maximize() {
1328
1417
  return this.handleZoom(true);
1329
1418
  },
1330
- revert: function revert() {
1419
+ revert() {
1331
1420
  return this.handleZoom();
1332
1421
  },
1333
- handleZoom: function handleZoom(isMax) {
1334
- var _this13 = this;
1335
- var isZMax = this.isZMax;
1422
+ handleZoom(isMax) {
1423
+ const {
1424
+ isZMax
1425
+ } = this;
1336
1426
  if (isMax ? !isZMax : isZMax) {
1337
1427
  this.isZMax = !isZMax;
1338
1428
  if (this.tZindex < (0, _utils.getLastZIndex)()) {
1339
1429
  this.tZindex = (0, _utils.nextZIndex)();
1340
1430
  }
1341
1431
  }
1342
- return this.$nextTick().then(function () {
1343
- return _this13.recalculate(true);
1344
- }).then(function () {
1345
- return _this13.isZMax;
1346
- });
1432
+ return this.$nextTick().then(() => this.recalculate(true)).then(() => this.isZMax);
1347
1433
  },
1348
- getProxyInfo: function getProxyInfo() {
1349
- var $refs = this.$refs,
1350
- sortData = this.sortData,
1351
- proxyConfig = this.proxyConfig;
1352
- var $xetable = $refs.xTable;
1434
+ getProxyInfo() {
1435
+ const {
1436
+ $refs,
1437
+ sortData,
1438
+ proxyConfig
1439
+ } = this;
1440
+ const $xetable = $refs.xTable;
1353
1441
  if (proxyConfig) {
1354
1442
  return {
1355
1443
  data: this.tableData,
@@ -1363,12 +1451,14 @@ var _default2 = exports.default = {
1363
1451
  }
1364
1452
  return null;
1365
1453
  }
1366
- }), process.env.VUE_APP_VXE_TABLE_ENV === 'development' ? {
1367
- loadColumn: function loadColumn(columns) {
1368
- var $scopedSlots = this.$scopedSlots;
1369
- _xeUtils.default.eachTree(columns, function (column) {
1454
+ }), process.env.NODE_ENV === 'development' ? {
1455
+ loadColumn(columns) {
1456
+ const {
1457
+ $scopedSlots
1458
+ } = this;
1459
+ _xeUtils.default.eachTree(columns, column => {
1370
1460
  if (column.slots) {
1371
- _xeUtils.default.each(column.slots, function (func) {
1461
+ _xeUtils.default.each(column.slots, func => {
1372
1462
  if (!_xeUtils.default.isFunction(func)) {
1373
1463
  if (!$scopedSlots[func]) {
1374
1464
  (0, _log.errLog)('vxe.error.notSlot', [func]);
@@ -1379,7 +1469,7 @@ var _default2 = exports.default = {
1379
1469
  });
1380
1470
  return this.$refs.xTable.loadColumn(columns);
1381
1471
  },
1382
- reloadColumn: function reloadColumn(columns) {
1472
+ reloadColumn(columns) {
1383
1473
  this.clearAll();
1384
1474
  return this.loadColumn(columns);
1385
1475
  }