vxe-table 3.6.6 → 3.6.8
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.
- package/lib/all.js +11 -82
- package/lib/all.min.js +1 -1
- package/lib/button/index.js +0 -3
- package/lib/button/src/button.js +39 -82
- package/lib/button/src/button.min.js +1 -1
- package/lib/button/style/style.css +475 -349
- package/lib/button/style/style.min.css +1 -1
- package/lib/checkbox/index.js +0 -3
- package/lib/checkbox/src/checkbox.js +15 -29
- package/lib/checkbox/src/checkbox.min.js +1 -1
- package/lib/checkbox/src/group.js +4 -12
- package/lib/checkbox/style/style.css +158 -128
- package/lib/checkbox/style/style.min.css +1 -1
- package/lib/checkbox-group/index.js +0 -3
- package/lib/checkbox-group/style/style.css +1 -1
- package/lib/colgroup/index.js +2 -5
- package/lib/colgroup/style/style.css +1 -1
- package/lib/column/index.js +2 -5
- package/lib/column/style/style.css +1 -1
- package/lib/edit/index.js +0 -6
- package/lib/edit/src/mixin.js +91 -252
- package/lib/edit/src/mixin.min.js +1 -1
- package/lib/edit/style/style.css +1 -1
- package/lib/export/index.js +1 -16
- package/lib/export/index.min.js +1 -1
- package/lib/export/src/export-panel.js +16 -41
- package/lib/export/src/export-panel.min.js +1 -1
- package/lib/export/src/import-panel.js +5 -19
- package/lib/export/src/import-panel.min.js +1 -1
- package/lib/export/src/mixin.js +105 -387
- package/lib/export/src/mixin.min.js +1 -1
- package/lib/export/style/style.css +138 -105
- package/lib/filter/index.js +0 -8
- package/lib/filter/src/mixin.js +18 -66
- package/lib/filter/src/mixin.min.js +1 -1
- package/lib/filter/src/panel.js +10 -22
- package/lib/filter/src/panel.min.js +1 -1
- package/lib/filter/style/style.css +105 -81
- package/lib/footer/index.js +0 -3
- package/lib/footer/src/footer.js +52 -84
- package/lib/footer/src/footer.min.js +1 -1
- package/lib/footer/style/style.css +1 -1
- package/lib/form/index.js +0 -3
- package/lib/form/src/form-config-item.js +23 -40
- package/lib/form/src/form-config-item.min.js +1 -1
- package/lib/form/src/form-gather.js +0 -5
- package/lib/form/src/form-item.js +18 -35
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/form.js +45 -137
- package/lib/form/src/form.min.js +1 -1
- package/lib/form/src/render.js +7 -22
- package/lib/form/src/render.min.js +1 -1
- package/lib/form/src/util.js +9 -42
- package/lib/form/src/util.min.js +1 -1
- package/lib/form/style/style.css +227 -185
- package/lib/form-gather/index.js +0 -3
- package/lib/form-gather/style/style.css +1 -1
- package/lib/form-item/index.js +0 -3
- package/lib/form-item/style/style.css +1 -1
- package/lib/grid/index.js +0 -4
- package/lib/grid/src/grid.js +87 -261
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/grid/style/style.css +62 -50
- package/lib/header/index.js +0 -3
- package/lib/header/src/header.js +54 -87
- package/lib/header/src/header.min.js +1 -1
- package/lib/header/src/util.js +0 -17
- package/lib/header/src/util.min.js +1 -1
- package/lib/header/style/style.css +1 -1
- package/lib/icon/index.js +0 -3
- package/lib/icon/style/iconfont.1669391208345.ttf +0 -0
- package/lib/icon/style/iconfont.1669391208345.woff +0 -0
- package/lib/icon/style/iconfont.1669391208345.woff2 +0 -0
- package/lib/icon/style/style.css +384 -197
- package/lib/icon/style/style.min.css +738 -1
- package/lib/iconfont.1669391208345.ttf +0 -0
- package/lib/iconfont.1669391208345.woff +0 -0
- package/lib/iconfont.1669391208345.woff2 +0 -0
- package/lib/index.common.js +1 -7
- package/lib/index.common.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +11884 -13141
- package/lib/index.umd.min.js +1 -1
- package/lib/input/index.js +0 -3
- package/lib/input/src/date.js +0 -10
- package/lib/input/src/date.min.js +1 -1
- package/lib/input/src/input.js +208 -473
- package/lib/input/src/input.min.js +1 -1
- package/lib/input/src/number.js +0 -5
- package/lib/input/style/style.css +820 -611
- package/lib/keyboard/index.js +0 -6
- package/lib/keyboard/src/mixin.js +35 -111
- package/lib/keyboard/src/mixin.min.js +1 -1
- package/lib/keyboard/style/style.css +1 -1
- package/lib/list/index.js +0 -3
- package/lib/list/src/list.js +23 -64
- package/lib/list/src/list.min.js +1 -1
- package/lib/list/style/style.css +19 -14
- package/lib/loading/index.js +0 -3
- package/lib/loading/index.min.js +1 -1
- package/lib/loading/src/loading.js +1 -4
- package/lib/loading/style/style.css +60 -45
- package/lib/locale/lang/zh-HK.js +0 -3
- package/lib/locale/lang/zh-MO.js +0 -3
- package/lib/locale/lang/zh-TW.js +0 -3
- package/lib/menu/index.js +0 -8
- package/lib/menu/src/mixin.js +38 -100
- package/lib/menu/src/mixin.min.js +1 -1
- package/lib/menu/src/panel.js +2 -5
- package/lib/menu/style/style.css +74 -55
- package/lib/mixins/size.js +1 -1
- package/lib/modal/index.js +3 -21
- package/lib/modal/index.min.js +1 -1
- package/lib/modal/src/modal.js +97 -254
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/modal/style/style.css +346 -280
- package/lib/modal/style/style.min.css +1 -1
- package/lib/optgroup/index.js +0 -3
- package/lib/optgroup/style/style.css +1 -1
- package/lib/option/index.js +0 -3
- package/lib/option/style/style.css +1 -1
- package/lib/pager/index.js +0 -3
- package/lib/pager/src/pager.js +13 -41
- package/lib/pager/src/pager.min.js +1 -1
- package/lib/pager/style/style.css +314 -262
- package/lib/pulldown/index.js +0 -3
- package/lib/pulldown/src/pulldown.js +29 -72
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/pulldown/style/style.css +51 -39
- package/lib/radio/index.js +0 -3
- package/lib/radio/src/button.js +11 -22
- package/lib/radio/src/group.js +2 -6
- package/lib/radio/src/radio.js +11 -23
- package/lib/radio/style/style.css +186 -152
- package/lib/radio/style/style.min.css +1 -1
- package/lib/radio-button/index.js +0 -3
- package/lib/radio-button/style/style.css +1 -1
- package/lib/radio-group/index.js +0 -3
- package/lib/radio-group/style/style.css +1 -1
- package/lib/select/index.js +0 -5
- package/lib/select/src/optgroup.js +0 -2
- package/lib/select/src/optgroup.min.js +1 -1
- package/lib/select/src/option.js +0 -2
- package/lib/select/src/option.min.js +1 -1
- package/lib/select/src/select.js +79 -211
- package/lib/select/src/select.min.js +1 -1
- package/lib/select/src/util.js +5 -24
- package/lib/select/src/util.min.js +1 -1
- package/lib/select/style/style.css +120 -89
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/switch/index.js +0 -3
- package/lib/switch/src/switch.js +7 -20
- package/lib/switch/src/switch.min.js +1 -1
- package/lib/switch/style/style.css +92 -71
- package/lib/table/index.js +0 -9
- package/lib/table/src/body.js +167 -261
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +107 -222
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +2 -4
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +6 -35
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/group.js +0 -3
- package/lib/table/src/methods.js +570 -1461
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +123 -231
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +28 -105
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +1080 -863
- package/lib/table/style/style.min.css +1 -1
- package/lib/textarea/index.js +0 -3
- package/lib/textarea/src/textarea.js +23 -55
- package/lib/textarea/src/textarea.min.js +1 -1
- package/lib/textarea/style/style.css +66 -45
- package/lib/toolbar/index.js +0 -3
- package/lib/toolbar/src/toolbar.js +43 -117
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/toolbar/style/style.css +232 -187
- package/lib/tools/dom.js +7 -42
- package/lib/tools/dom.min.js +1 -1
- package/lib/tools/event.js +4 -14
- package/lib/tools/event.min.js +1 -1
- package/lib/tools/log.js +1 -6
- package/lib/tools/log.min.js +1 -1
- package/lib/tools/resize.js +3 -24
- package/lib/tools/resize.min.js +1 -1
- package/lib/tools/utils.js +7 -29
- package/lib/tools/utils.min.js +1 -1
- package/lib/tools/vn.js +0 -4
- package/lib/tooltip/index.js +0 -4
- package/lib/tooltip/src/tooltip.js +29 -76
- package/lib/tooltip/src/tooltip.min.js +1 -1
- package/lib/tooltip/style/style.css +88 -64
- package/lib/v-x-e-table/index.js +6 -41
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/v-x-e-table/src/commands.js +0 -4
- package/lib/v-x-e-table/src/conf.js +30 -18
- package/lib/v-x-e-table/src/formats.js +0 -4
- package/lib/v-x-e-table/src/interceptor.js +4 -15
- package/lib/v-x-e-table/src/menus.js +0 -4
- package/lib/v-x-e-table/src/renderer.js +62 -169
- package/lib/v-x-e-table/src/renderer.min.js +1 -1
- package/lib/v-x-e-table/src/setup.js +0 -4
- package/lib/v-x-e-table/src/store.js +3 -16
- package/lib/v-x-e-table/src/store.min.js +1 -1
- package/lib/v-x-e-table/style/style.css +444 -242
- package/lib/v-x-e-table/style/style.min.css +1 -1
- package/lib/validator/index.js +0 -6
- package/lib/validator/src/mixin.js +31 -100
- package/lib/validator/src/mixin.min.js +1 -1
- package/lib/validator/style/style.css +1 -1
- package/lib/vxe-table/style/style.css +1 -1
- package/package.json +28 -29
- package/packages/export/src/mixin.js +2 -1
- package/packages/filter/src/mixin.js +1 -1
- package/packages/form/src/form.js +5 -4
- package/packages/grid/src/grid.js +14 -14
- package/packages/table/src/column.js +2 -0
- package/packages/table/src/columnInfo.js +1 -0
- package/packages/table/src/methods.js +18 -18
- package/styles/icon/iconfont.ttf +0 -0
- package/styles/icon/iconfont.woff +0 -0
- package/styles/icon/iconfont.woff2 +0 -0
- package/styles/icon.scss +9 -1
- package/styles/table.scss +1 -1
- package/styles/variable.scss +2 -2
- package/types/column.d.ts +3 -0
package/lib/grid/src/grid.js
CHANGED
|
@@ -1,74 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
4
|
-
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _table = _interopRequireDefault(require("../../table"));
|
|
11
|
-
|
|
12
9
|
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
13
|
-
|
|
14
10
|
var _conf = _interopRequireDefault(require("../../v-x-e-table/src/conf"));
|
|
15
|
-
|
|
16
11
|
var _size = _interopRequireDefault(require("../../mixins/size"));
|
|
17
|
-
|
|
18
12
|
var _vXETable = _interopRequireDefault(require("../../v-x-e-table"));
|
|
19
|
-
|
|
20
13
|
var _utils = _interopRequireWildcard(require("../../tools/utils"));
|
|
21
|
-
|
|
22
14
|
var _dom = _interopRequireWildcard(require("../../tools/dom"));
|
|
23
|
-
|
|
24
15
|
var _event = require("../../tools/event");
|
|
25
|
-
|
|
26
16
|
var _log = require("../../tools/log");
|
|
27
|
-
|
|
28
17
|
var _vn = require("../../tools/vn");
|
|
29
|
-
|
|
30
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
-
|
|
32
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
34
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
-
|
|
36
21
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
37
|
-
|
|
38
22
|
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."); }
|
|
39
|
-
|
|
40
23
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
41
|
-
|
|
42
24
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
43
|
-
|
|
44
25
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
45
|
-
|
|
46
26
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
47
|
-
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
51
|
-
|
|
27
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
52
29
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
53
|
-
|
|
54
30
|
var methods = {};
|
|
55
31
|
var propKeys = Object.keys(_table.default.props);
|
|
56
|
-
|
|
57
32
|
function renderDefaultForm(h, _vm) {
|
|
58
33
|
var $scopedSlots = _vm.$scopedSlots,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
34
|
+
proxyConfig = _vm.proxyConfig,
|
|
35
|
+
proxyOpts = _vm.proxyOpts,
|
|
36
|
+
formData = _vm.formData,
|
|
37
|
+
formConfig = _vm.formConfig,
|
|
38
|
+
formOpts = _vm.formOpts;
|
|
65
39
|
if ((0, _utils.isEnableConf)(formConfig) && formOpts.items && formOpts.items.length) {
|
|
66
40
|
var formSlots = {};
|
|
67
|
-
|
|
68
41
|
if (!formOpts.inited) {
|
|
69
42
|
formOpts.inited = true;
|
|
70
43
|
var beforeItem = proxyOpts.beforeItem;
|
|
71
|
-
|
|
72
44
|
if (proxyOpts && beforeItem) {
|
|
73
45
|
formOpts.items.forEach(function (item) {
|
|
74
46
|
beforeItem.call(_vm, {
|
|
@@ -77,9 +49,8 @@ function renderDefaultForm(h, _vm) {
|
|
|
77
49
|
});
|
|
78
50
|
});
|
|
79
51
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
52
|
+
}
|
|
53
|
+
// 处理插槽
|
|
83
54
|
formOpts.items.forEach(function (item) {
|
|
84
55
|
_xeUtils.default.each(item.slots, function (func) {
|
|
85
56
|
if (!_xeUtils.default.isFunction(func)) {
|
|
@@ -102,14 +73,11 @@ function renderDefaultForm(h, _vm) {
|
|
|
102
73
|
scopedSlots: formSlots
|
|
103
74
|
})];
|
|
104
75
|
}
|
|
105
|
-
|
|
106
76
|
return [];
|
|
107
77
|
}
|
|
108
|
-
|
|
109
78
|
function getFuncSlot(_vm, optSlots, slotKey) {
|
|
110
79
|
var $scopedSlots = _vm.$scopedSlots;
|
|
111
80
|
var funcSlot = optSlots[slotKey];
|
|
112
|
-
|
|
113
81
|
if (funcSlot) {
|
|
114
82
|
if (_xeUtils.default.isString(funcSlot)) {
|
|
115
83
|
if ($scopedSlots[funcSlot]) {
|
|
@@ -123,100 +91,79 @@ function getFuncSlot(_vm, optSlots, slotKey) {
|
|
|
123
91
|
return funcSlot;
|
|
124
92
|
}
|
|
125
93
|
}
|
|
126
|
-
|
|
127
94
|
return null;
|
|
128
95
|
}
|
|
129
|
-
|
|
130
96
|
function getToolbarSlots(_vm) {
|
|
131
97
|
var $scopedSlots = _vm.$scopedSlots,
|
|
132
|
-
|
|
98
|
+
toolbarOpts = _vm.toolbarOpts;
|
|
133
99
|
var toolbarOptSlots = toolbarOpts.slots;
|
|
134
100
|
var buttonsSlot;
|
|
135
101
|
var toolsSlot;
|
|
136
102
|
var slots = {};
|
|
137
|
-
|
|
138
103
|
if (process.env.NODE_ENV === 'development') {
|
|
139
104
|
if ($scopedSlots.buttons && (!toolbarOptSlots || toolbarOptSlots.buttons !== 'buttons')) {
|
|
140
105
|
(0, _log.warnLog)('vxe.error.reqProp', ['toolbar-config.slots.buttons']);
|
|
141
106
|
}
|
|
142
|
-
|
|
143
107
|
if ($scopedSlots.tools && (!toolbarOptSlots || toolbarOptSlots.tools !== 'tools')) {
|
|
144
108
|
(0, _log.warnLog)('vxe.error.reqProp', ['toolbar-config.slots.tools']);
|
|
145
109
|
}
|
|
146
110
|
}
|
|
147
|
-
|
|
148
111
|
if (toolbarOptSlots) {
|
|
149
112
|
buttonsSlot = getFuncSlot(_vm, toolbarOptSlots, 'buttons');
|
|
150
113
|
toolsSlot = getFuncSlot(_vm, toolbarOptSlots, 'tools');
|
|
151
|
-
|
|
152
114
|
if (buttonsSlot) {
|
|
153
115
|
slots.buttons = buttonsSlot;
|
|
154
116
|
}
|
|
155
|
-
|
|
156
117
|
if (toolsSlot) {
|
|
157
118
|
slots.tools = toolsSlot;
|
|
158
119
|
}
|
|
159
120
|
}
|
|
160
|
-
|
|
161
121
|
return slots;
|
|
162
122
|
}
|
|
163
|
-
|
|
164
123
|
function getPagerSlots(_vm) {
|
|
165
124
|
var pagerOpts = _vm.pagerOpts;
|
|
166
125
|
var pagerOptSlots = pagerOpts.slots;
|
|
167
126
|
var slots = {};
|
|
168
127
|
var leftSlot;
|
|
169
128
|
var rightSlot;
|
|
170
|
-
|
|
171
129
|
if (pagerOptSlots) {
|
|
172
130
|
leftSlot = getFuncSlot(_vm, pagerOptSlots, 'left');
|
|
173
131
|
rightSlot = getFuncSlot(_vm, pagerOptSlots, 'right');
|
|
174
|
-
|
|
175
132
|
if (leftSlot) {
|
|
176
133
|
slots.left = leftSlot;
|
|
177
134
|
}
|
|
178
|
-
|
|
179
135
|
if (rightSlot) {
|
|
180
136
|
slots.right = rightSlot;
|
|
181
137
|
}
|
|
182
138
|
}
|
|
183
|
-
|
|
184
139
|
return slots;
|
|
185
140
|
}
|
|
186
|
-
|
|
187
141
|
function getTableOns(_vm) {
|
|
188
142
|
var $listeners = _vm.$listeners,
|
|
189
|
-
|
|
190
|
-
|
|
143
|
+
proxyConfig = _vm.proxyConfig,
|
|
144
|
+
proxyOpts = _vm.proxyOpts;
|
|
191
145
|
var ons = {};
|
|
192
|
-
|
|
193
146
|
_xeUtils.default.each($listeners, function (cb, type) {
|
|
194
147
|
ons[type] = function () {
|
|
195
148
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
196
149
|
args[_key] = arguments[_key];
|
|
197
150
|
}
|
|
198
|
-
|
|
199
151
|
_vm.$emit.apply(_vm, [type].concat(args));
|
|
200
152
|
};
|
|
201
153
|
});
|
|
202
|
-
|
|
203
154
|
if (proxyConfig) {
|
|
204
155
|
if (proxyOpts.sort) {
|
|
205
156
|
ons['sort-change'] = _vm.sortChangeEvent;
|
|
206
157
|
}
|
|
207
|
-
|
|
208
158
|
if (proxyOpts.filter) {
|
|
209
159
|
ons['filter-change'] = _vm.filterChangeEvent;
|
|
210
160
|
}
|
|
211
161
|
}
|
|
212
|
-
|
|
213
162
|
return ons;
|
|
214
163
|
}
|
|
215
|
-
|
|
216
164
|
Object.keys(_table.default.methods).forEach(function (name) {
|
|
217
165
|
methods[name] = function () {
|
|
218
166
|
var _this$$refs$xTable;
|
|
219
|
-
|
|
220
167
|
return this.$refs.xTable && (_this$$refs$xTable = this.$refs.xTable)[name].apply(_this$$refs$xTable, arguments);
|
|
221
168
|
};
|
|
222
169
|
});
|
|
@@ -286,7 +233,6 @@ var _default2 = {
|
|
|
286
233
|
},
|
|
287
234
|
tableExtendProps: function tableExtendProps() {
|
|
288
235
|
var _this = this;
|
|
289
|
-
|
|
290
236
|
var rest = {};
|
|
291
237
|
propKeys.forEach(function (key) {
|
|
292
238
|
rest[key] = _this[key];
|
|
@@ -295,18 +241,17 @@ var _default2 = {
|
|
|
295
241
|
},
|
|
296
242
|
tableProps: function tableProps() {
|
|
297
243
|
var isZMax = this.isZMax,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
244
|
+
seqConfig = this.seqConfig,
|
|
245
|
+
pagerConfig = this.pagerConfig,
|
|
246
|
+
loading = this.loading,
|
|
247
|
+
editConfig = this.editConfig,
|
|
248
|
+
proxyConfig = this.proxyConfig,
|
|
249
|
+
proxyOpts = this.proxyOpts,
|
|
250
|
+
tableExtendProps = this.tableExtendProps,
|
|
251
|
+
tableLoading = this.tableLoading,
|
|
252
|
+
tablePage = this.tablePage,
|
|
253
|
+
tableData = this.tableData;
|
|
308
254
|
var tableProps = Object.assign({}, tableExtendProps);
|
|
309
|
-
|
|
310
255
|
if (isZMax) {
|
|
311
256
|
if (tableExtendProps.maxHeight) {
|
|
312
257
|
tableProps.maxHeight = 'auto';
|
|
@@ -314,32 +259,27 @@ var _default2 = {
|
|
|
314
259
|
tableProps.height = 'auto';
|
|
315
260
|
}
|
|
316
261
|
}
|
|
317
|
-
|
|
318
262
|
if (proxyConfig) {
|
|
319
263
|
tableProps.loading = loading || tableLoading;
|
|
320
264
|
tableProps.data = tableData;
|
|
321
265
|
tableProps.rowClassName = this.handleRowClassName;
|
|
322
|
-
|
|
323
266
|
if (proxyOpts.seq && (0, _utils.isEnableConf)(pagerConfig)) {
|
|
324
267
|
tableProps.seqConfig = Object.assign({}, seqConfig, {
|
|
325
268
|
startIndex: (tablePage.currentPage - 1) * tablePage.pageSize
|
|
326
269
|
});
|
|
327
270
|
}
|
|
328
271
|
}
|
|
329
|
-
|
|
330
272
|
if (editConfig) {
|
|
331
273
|
tableProps.editConfig = Object.assign({}, editConfig, {
|
|
332
274
|
beforeEditMethod: this.handleBeforeEditMethod
|
|
333
275
|
});
|
|
334
276
|
}
|
|
335
|
-
|
|
336
277
|
return tableProps;
|
|
337
278
|
}
|
|
338
279
|
},
|
|
339
280
|
watch: {
|
|
340
281
|
columns: function columns(value) {
|
|
341
282
|
var _this2 = this;
|
|
342
|
-
|
|
343
283
|
this.$nextTick(function () {
|
|
344
284
|
return _this2.loadColumn(value);
|
|
345
285
|
});
|
|
@@ -363,33 +303,27 @@ var _default2 = {
|
|
|
363
303
|
},
|
|
364
304
|
created: function created() {
|
|
365
305
|
var data = this.data,
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
306
|
+
formOpts = this.formOpts,
|
|
307
|
+
proxyOpts = this.proxyOpts,
|
|
308
|
+
proxyConfig = this.proxyConfig;
|
|
370
309
|
if (proxyConfig && (data || proxyOpts.form && formOpts.data)) {
|
|
371
310
|
(0, _log.errLog)('vxe.error.errConflicts', ['grid.data', 'grid.proxy-config']);
|
|
372
311
|
}
|
|
373
|
-
|
|
374
312
|
if (process.env.NODE_ENV === 'development') {
|
|
375
313
|
if (this.toolbar) {
|
|
376
314
|
(0, _log.warnLog)('vxe.error.delProp', ['grid.toolbar', 'grid.toolbar-config']);
|
|
377
315
|
}
|
|
378
|
-
|
|
379
316
|
if (this.toolbarConfig && !_xeUtils.default.isObject(this.toolbarConfig)) {
|
|
380
317
|
(0, _log.warnLog)('vxe.error.errProp', ["grid.toolbar-config=".concat(this.toolbarConfig), 'grid.toolbar-config={}']);
|
|
381
318
|
}
|
|
382
319
|
}
|
|
383
|
-
|
|
384
320
|
this.initPages();
|
|
385
|
-
|
|
386
321
|
_event.GlobalEvent.on(this, 'keydown', this.handleGlobalKeydownEvent);
|
|
387
322
|
},
|
|
388
323
|
mounted: function mounted() {
|
|
389
324
|
if (this.columns && this.columns.length) {
|
|
390
325
|
this.loadColumn(this.columns);
|
|
391
326
|
}
|
|
392
|
-
|
|
393
327
|
this.initToolbar();
|
|
394
328
|
this.initProxy();
|
|
395
329
|
},
|
|
@@ -398,10 +332,9 @@ var _default2 = {
|
|
|
398
332
|
},
|
|
399
333
|
render: function render(h) {
|
|
400
334
|
var _ref;
|
|
401
|
-
|
|
402
335
|
var $scopedSlots = this.$scopedSlots,
|
|
403
|
-
|
|
404
|
-
|
|
336
|
+
vSize = this.vSize,
|
|
337
|
+
isZMax = this.isZMax;
|
|
405
338
|
var hasForm = !!($scopedSlots.form || (0, _utils.isEnableConf)(this.formConfig));
|
|
406
339
|
var hasToolbar = !!($scopedSlots.toolbar || (0, _utils.isEnableConf)(this.toolbarConfig) || this.toolbar);
|
|
407
340
|
var hasPager = !!($scopedSlots.pager || (0, _utils.isEnableConf)(this.pagerConfig));
|
|
@@ -478,73 +411,63 @@ var _default2 = {
|
|
|
478
411
|
callSlot: function callSlot(slotFunc, params, h, vNodes) {
|
|
479
412
|
if (slotFunc) {
|
|
480
413
|
var $scopedSlots = this.$scopedSlots;
|
|
481
|
-
|
|
482
414
|
if (_xeUtils.default.isString(slotFunc)) {
|
|
483
415
|
slotFunc = $scopedSlots[slotFunc] || null;
|
|
484
416
|
}
|
|
485
|
-
|
|
486
417
|
if (_xeUtils.default.isFunction(slotFunc)) {
|
|
487
418
|
return (0, _vn.getSlotVNs)(slotFunc.call(this, params, h, vNodes));
|
|
488
419
|
}
|
|
489
420
|
}
|
|
490
|
-
|
|
491
421
|
return [];
|
|
492
422
|
},
|
|
493
423
|
getParentHeight: function getParentHeight() {
|
|
494
424
|
var $el = this.$el,
|
|
495
|
-
|
|
425
|
+
isZMax = this.isZMax;
|
|
496
426
|
return (isZMax ? _dom.default.getDomNode().visibleHeight : _xeUtils.default.toNumber(getComputedStyle($el.parentNode).height)) - this.getExcludeHeight();
|
|
497
427
|
},
|
|
498
|
-
|
|
499
428
|
/**
|
|
500
429
|
* 获取需要排除的高度
|
|
501
430
|
*/
|
|
502
431
|
getExcludeHeight: function getExcludeHeight() {
|
|
503
432
|
var $refs = this.$refs,
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
433
|
+
$el = this.$el,
|
|
434
|
+
isZMax = this.isZMax,
|
|
435
|
+
height = this.height;
|
|
507
436
|
var formWrapper = $refs.formWrapper,
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
437
|
+
toolbarWrapper = $refs.toolbarWrapper,
|
|
438
|
+
topWrapper = $refs.topWrapper,
|
|
439
|
+
bottomWrapper = $refs.bottomWrapper,
|
|
440
|
+
pagerWrapper = $refs.pagerWrapper;
|
|
512
441
|
var parentPaddingSize = isZMax || height !== 'auto' ? 0 : (0, _dom.getPaddingTopBottomSize)($el.parentNode);
|
|
513
442
|
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);
|
|
514
443
|
},
|
|
515
444
|
handleRowClassName: function handleRowClassName(params) {
|
|
516
445
|
var rowClassName = this.rowClassName;
|
|
517
446
|
var clss = [];
|
|
518
|
-
|
|
519
447
|
if (this.pendingRecords.some(function (item) {
|
|
520
448
|
return item === params.row;
|
|
521
449
|
})) {
|
|
522
450
|
clss.push('row--pending');
|
|
523
451
|
}
|
|
524
|
-
|
|
525
452
|
clss.push(rowClassName ? _xeUtils.default.isFunction(rowClassName) ? rowClassName(params) : rowClassName : '');
|
|
526
453
|
return clss;
|
|
527
454
|
},
|
|
528
455
|
handleBeforeEditMethod: function handleBeforeEditMethod(params) {
|
|
529
456
|
var editConfig = this.editConfig;
|
|
530
457
|
var beforeEditMethod = editConfig ? editConfig.beforeEditMethod || editConfig.activeMethod : null;
|
|
531
|
-
|
|
532
458
|
if (this.pendingRecords.indexOf(params.row) === -1) {
|
|
533
459
|
return !beforeEditMethod || beforeEditMethod(_objectSpread(_objectSpread({}, params), {}, {
|
|
534
460
|
$grid: this
|
|
535
461
|
}));
|
|
536
462
|
}
|
|
537
|
-
|
|
538
463
|
return false;
|
|
539
464
|
},
|
|
540
465
|
initToolbar: function initToolbar() {
|
|
541
466
|
var _this3 = this;
|
|
542
|
-
|
|
543
467
|
this.$nextTick(function () {
|
|
544
468
|
var _this3$$refs = _this3.$refs,
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
469
|
+
xTable = _this3$$refs.xTable,
|
|
470
|
+
xToolbar = _this3$$refs.xToolbar;
|
|
548
471
|
if (xTable && xToolbar) {
|
|
549
472
|
xTable.connect(xToolbar);
|
|
550
473
|
}
|
|
@@ -552,16 +475,14 @@ var _default2 = {
|
|
|
552
475
|
},
|
|
553
476
|
initPages: function initPages() {
|
|
554
477
|
var tablePage = this.tablePage,
|
|
555
|
-
|
|
556
|
-
|
|
478
|
+
pagerConfig = this.pagerConfig,
|
|
479
|
+
pagerOpts = this.pagerOpts;
|
|
557
480
|
var currentPage = pagerOpts.currentPage,
|
|
558
|
-
|
|
559
|
-
|
|
481
|
+
pageSize = pagerOpts.pageSize;
|
|
560
482
|
if (pagerConfig) {
|
|
561
483
|
if (currentPage) {
|
|
562
484
|
tablePage.currentPage = currentPage;
|
|
563
485
|
}
|
|
564
|
-
|
|
565
486
|
if (pageSize) {
|
|
566
487
|
tablePage.pageSize = pageSize;
|
|
567
488
|
}
|
|
@@ -569,26 +490,21 @@ var _default2 = {
|
|
|
569
490
|
},
|
|
570
491
|
initProxy: function initProxy() {
|
|
571
492
|
var _this4 = this;
|
|
572
|
-
|
|
573
493
|
var proxyInited = this.proxyInited,
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
494
|
+
proxyConfig = this.proxyConfig,
|
|
495
|
+
proxyOpts = this.proxyOpts,
|
|
496
|
+
formConfig = this.formConfig,
|
|
497
|
+
formOpts = this.formOpts;
|
|
579
498
|
if (proxyConfig) {
|
|
580
499
|
if ((0, _utils.isEnableConf)(formConfig) && proxyOpts.form && formOpts.items) {
|
|
581
500
|
var formData = {};
|
|
582
501
|
formOpts.items.forEach(function (item) {
|
|
583
502
|
var field = item.field,
|
|
584
|
-
|
|
585
|
-
|
|
503
|
+
itemRender = item.itemRender;
|
|
586
504
|
if (field) {
|
|
587
505
|
var itemValue = null;
|
|
588
|
-
|
|
589
506
|
if (itemRender) {
|
|
590
507
|
var defaultValue = itemRender.defaultValue;
|
|
591
|
-
|
|
592
508
|
if (_xeUtils.default.isFunction(defaultValue)) {
|
|
593
509
|
itemValue = defaultValue({
|
|
594
510
|
item: item
|
|
@@ -597,13 +513,11 @@ var _default2 = {
|
|
|
597
513
|
itemValue = defaultValue;
|
|
598
514
|
}
|
|
599
515
|
}
|
|
600
|
-
|
|
601
516
|
formData[field] = itemValue;
|
|
602
517
|
}
|
|
603
518
|
});
|
|
604
519
|
this.formData = formData;
|
|
605
520
|
}
|
|
606
|
-
|
|
607
521
|
if (!proxyInited && proxyOpts.autoLoad !== false) {
|
|
608
522
|
this.proxyInited = true;
|
|
609
523
|
this.$nextTick(function () {
|
|
@@ -614,43 +528,39 @@ var _default2 = {
|
|
|
614
528
|
},
|
|
615
529
|
handleGlobalKeydownEvent: function handleGlobalKeydownEvent(evnt) {
|
|
616
530
|
var isEsc = evnt.keyCode === 27;
|
|
617
|
-
|
|
618
531
|
if (isEsc && this.isZMax && this.zoomOpts.escRestore !== false) {
|
|
619
532
|
this.triggerZoomEvent(evnt);
|
|
620
533
|
}
|
|
621
534
|
},
|
|
622
|
-
|
|
623
535
|
/**
|
|
624
536
|
* 提交指令,支持 code 或 button
|
|
625
537
|
* @param {String/Object} code 字符串或对象
|
|
626
538
|
*/
|
|
627
539
|
commitProxy: function commitProxy(proxyTarget) {
|
|
628
540
|
var _this5 = this;
|
|
629
|
-
|
|
630
541
|
var $refs = this.$refs,
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
542
|
+
toolbar = this.toolbar,
|
|
543
|
+
toolbarConfig = this.toolbarConfig,
|
|
544
|
+
toolbarOpts = this.toolbarOpts,
|
|
545
|
+
proxyOpts = this.proxyOpts,
|
|
546
|
+
tablePage = this.tablePage,
|
|
547
|
+
pagerConfig = this.pagerConfig,
|
|
548
|
+
editRules = this.editRules,
|
|
549
|
+
formData = this.formData,
|
|
550
|
+
isMsg = this.isMsg;
|
|
640
551
|
var beforeQuery = proxyOpts.beforeQuery,
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
552
|
+
afterQuery = proxyOpts.afterQuery,
|
|
553
|
+
beforeDelete = proxyOpts.beforeDelete,
|
|
554
|
+
afterDelete = proxyOpts.afterDelete,
|
|
555
|
+
beforeSave = proxyOpts.beforeSave,
|
|
556
|
+
afterSave = proxyOpts.afterSave,
|
|
557
|
+
_proxyOpts$ajax = proxyOpts.ajax,
|
|
558
|
+
ajax = _proxyOpts$ajax === void 0 ? {} : _proxyOpts$ajax,
|
|
559
|
+
_proxyOpts$props = proxyOpts.props,
|
|
560
|
+
proxyProps = _proxyOpts$props === void 0 ? {} : _proxyOpts$props;
|
|
650
561
|
var $xetable = $refs.xTable;
|
|
651
562
|
var button;
|
|
652
563
|
var code;
|
|
653
|
-
|
|
654
564
|
if (_xeUtils.default.isString(proxyTarget)) {
|
|
655
565
|
var matchObj = toolbarConfig || toolbar ? _xeUtils.default.findTree(toolbarOpts.buttons, function (item) {
|
|
656
566
|
return item.code === proxyTarget;
|
|
@@ -663,86 +573,69 @@ var _default2 = {
|
|
|
663
573
|
button = proxyTarget;
|
|
664
574
|
code = button.code;
|
|
665
575
|
}
|
|
666
|
-
|
|
667
576
|
var btnParams = button ? button.params : null;
|
|
668
|
-
|
|
669
577
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
670
578
|
args[_key2 - 1] = arguments[_key2];
|
|
671
579
|
}
|
|
672
|
-
|
|
673
580
|
switch (code) {
|
|
674
581
|
case 'insert':
|
|
675
582
|
this.insert();
|
|
676
583
|
break;
|
|
677
|
-
|
|
678
584
|
case 'insert_actived':
|
|
679
585
|
this.insert().then(function (_ref2) {
|
|
680
586
|
var row = _ref2.row;
|
|
681
587
|
return _this5.setActiveRow(row);
|
|
682
588
|
});
|
|
683
589
|
break;
|
|
684
|
-
|
|
685
590
|
case 'mark_cancel':
|
|
686
591
|
this.triggerPendingEvent(code);
|
|
687
592
|
break;
|
|
688
|
-
|
|
689
593
|
case 'remove':
|
|
690
594
|
return this.handleDeleteRow(code, 'vxe.grid.removeSelectRecord', function () {
|
|
691
595
|
return _this5.removeCheckboxRow();
|
|
692
596
|
});
|
|
693
|
-
|
|
694
597
|
case 'import':
|
|
695
598
|
this.importData(btnParams);
|
|
696
599
|
break;
|
|
697
|
-
|
|
698
600
|
case 'open_import':
|
|
699
601
|
this.openImport(btnParams);
|
|
700
602
|
break;
|
|
701
|
-
|
|
702
603
|
case 'export':
|
|
703
604
|
this.exportData(btnParams);
|
|
704
605
|
break;
|
|
705
|
-
|
|
706
606
|
case 'open_export':
|
|
707
607
|
this.openExport(btnParams);
|
|
708
608
|
break;
|
|
709
|
-
|
|
710
609
|
case 'reset_custom':
|
|
711
610
|
this.resetColumn(true);
|
|
712
611
|
break;
|
|
713
|
-
|
|
714
612
|
case '_init':
|
|
715
613
|
case 'reload':
|
|
716
614
|
case 'query':
|
|
717
615
|
{
|
|
718
616
|
var ajaxMethods = ajax.query;
|
|
719
|
-
|
|
720
617
|
if (ajaxMethods) {
|
|
721
618
|
var isInited = code === '_init';
|
|
722
619
|
var isReload = code === 'reload';
|
|
723
620
|
var sortList = [];
|
|
724
621
|
var filterList = [];
|
|
725
622
|
var pageParams = {};
|
|
726
|
-
|
|
727
623
|
if (pagerConfig) {
|
|
728
624
|
if (isInited || isReload) {
|
|
729
625
|
tablePage.currentPage = 1;
|
|
730
626
|
}
|
|
731
|
-
|
|
732
627
|
if ((0, _utils.isEnableConf)(pagerConfig)) {
|
|
733
628
|
pageParams = _objectSpread({}, tablePage);
|
|
734
629
|
}
|
|
735
630
|
}
|
|
736
|
-
|
|
737
631
|
if (isInited) {
|
|
738
632
|
var sortOpts = $xetable.sortOpts;
|
|
739
|
-
var defaultSort = sortOpts.defaultSort;
|
|
740
|
-
|
|
633
|
+
var defaultSort = sortOpts.defaultSort;
|
|
634
|
+
// 如果使用默认排序
|
|
741
635
|
if (defaultSort) {
|
|
742
636
|
if (!_xeUtils.default.isArray(defaultSort)) {
|
|
743
637
|
defaultSort = [defaultSort];
|
|
744
638
|
}
|
|
745
|
-
|
|
746
639
|
sortList = defaultSort.map(function (item) {
|
|
747
640
|
return {
|
|
748
641
|
field: item.field,
|
|
@@ -751,7 +644,6 @@ var _default2 = {
|
|
|
751
644
|
};
|
|
752
645
|
});
|
|
753
646
|
}
|
|
754
|
-
|
|
755
647
|
filterList = $xetable.getCheckedFilters();
|
|
756
648
|
} else {
|
|
757
649
|
if (isReload) {
|
|
@@ -762,7 +654,6 @@ var _default2 = {
|
|
|
762
654
|
filterList = $xetable.getCheckedFilters();
|
|
763
655
|
}
|
|
764
656
|
}
|
|
765
|
-
|
|
766
657
|
var params = {
|
|
767
658
|
code: code,
|
|
768
659
|
button: button,
|
|
@@ -782,15 +673,13 @@ var _default2 = {
|
|
|
782
673
|
return e;
|
|
783
674
|
}).then(function (rest) {
|
|
784
675
|
_this5.tableLoading = false;
|
|
785
|
-
|
|
786
676
|
if (rest) {
|
|
787
677
|
if ((0, _utils.isEnableConf)(pagerConfig)) {
|
|
788
678
|
var total = _xeUtils.default.get(rest, proxyProps.total || 'page.total') || 0;
|
|
789
679
|
tablePage.total = _xeUtils.default.toNumber(total);
|
|
790
|
-
_this5.tableData = _xeUtils.default.get(rest, proxyProps.result || 'result') || [];
|
|
791
|
-
|
|
680
|
+
_this5.tableData = _xeUtils.default.get(rest, proxyProps.result || 'result') || [];
|
|
681
|
+
// 检验当前页码,不能超出当前最大页数
|
|
792
682
|
var pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
|
|
793
|
-
|
|
794
683
|
if (tablePage.currentPage > pageCount) {
|
|
795
684
|
tablePage.currentPage = pageCount;
|
|
796
685
|
}
|
|
@@ -800,7 +689,6 @@ var _default2 = {
|
|
|
800
689
|
} else {
|
|
801
690
|
_this5.tableData = [];
|
|
802
691
|
}
|
|
803
|
-
|
|
804
692
|
if (afterQuery) {
|
|
805
693
|
afterQuery.apply(void 0, _toConsumableArray(applyArgs));
|
|
806
694
|
}
|
|
@@ -810,14 +698,11 @@ var _default2 = {
|
|
|
810
698
|
(0, _log.errLog)('vxe.error.notFunc', ['proxy-config.ajax.query']);
|
|
811
699
|
}
|
|
812
700
|
}
|
|
813
|
-
|
|
814
701
|
break;
|
|
815
702
|
}
|
|
816
|
-
|
|
817
703
|
case 'delete':
|
|
818
704
|
{
|
|
819
705
|
var _ajaxMethods = ajax.delete;
|
|
820
|
-
|
|
821
706
|
if (_ajaxMethods) {
|
|
822
707
|
var selectRecords = $xetable.getCheckboxRecords();
|
|
823
708
|
var removeRecords = selectRecords.filter(function (row) {
|
|
@@ -826,7 +711,6 @@ var _default2 = {
|
|
|
826
711
|
var body = {
|
|
827
712
|
removeRecords: removeRecords
|
|
828
713
|
};
|
|
829
|
-
|
|
830
714
|
var _applyArgs = [{
|
|
831
715
|
$grid: this,
|
|
832
716
|
code: code,
|
|
@@ -834,20 +718,17 @@ var _default2 = {
|
|
|
834
718
|
body: body,
|
|
835
719
|
options: _ajaxMethods
|
|
836
720
|
}].concat(args);
|
|
837
|
-
|
|
838
721
|
if (selectRecords.length) {
|
|
839
722
|
return this.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', function () {
|
|
840
723
|
if (!removeRecords.length) {
|
|
841
724
|
return $xetable.remove(selectRecords);
|
|
842
725
|
}
|
|
843
|
-
|
|
844
726
|
_this5.tableLoading = true;
|
|
845
727
|
return Promise.resolve((beforeDelete || _ajaxMethods).apply(void 0, _toConsumableArray(_applyArgs))).then(function (rest) {
|
|
846
728
|
_this5.tableLoading = false;
|
|
847
729
|
_this5.pendingRecords = _this5.pendingRecords.filter(function (row) {
|
|
848
730
|
return removeRecords.indexOf(row) === -1;
|
|
849
731
|
});
|
|
850
|
-
|
|
851
732
|
if (isMsg) {
|
|
852
733
|
// 检测弹窗模块
|
|
853
734
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -855,13 +736,11 @@ var _default2 = {
|
|
|
855
736
|
(0, _log.errLog)('vxe.error.reqModule', ['Modal']);
|
|
856
737
|
}
|
|
857
738
|
}
|
|
858
|
-
|
|
859
739
|
_vXETable.default.modal.message({
|
|
860
740
|
content: _this5.getRespMsg(rest, 'vxe.grid.delSuccess'),
|
|
861
741
|
status: 'success'
|
|
862
742
|
});
|
|
863
743
|
}
|
|
864
|
-
|
|
865
744
|
if (afterDelete) {
|
|
866
745
|
afterDelete.apply(void 0, _toConsumableArray(_applyArgs));
|
|
867
746
|
} else {
|
|
@@ -869,7 +748,6 @@ var _default2 = {
|
|
|
869
748
|
}
|
|
870
749
|
}).catch(function (rest) {
|
|
871
750
|
_this5.tableLoading = false;
|
|
872
|
-
|
|
873
751
|
if (isMsg) {
|
|
874
752
|
// 检测弹窗模块
|
|
875
753
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -877,7 +755,6 @@ var _default2 = {
|
|
|
877
755
|
(0, _log.errLog)('vxe.error.reqModule', ['Modal']);
|
|
878
756
|
}
|
|
879
757
|
}
|
|
880
|
-
|
|
881
758
|
_vXETable.default.modal.message({
|
|
882
759
|
id: code,
|
|
883
760
|
content: _this5.getRespMsg(rest, 'vxe.grid.operError'),
|
|
@@ -894,7 +771,6 @@ var _default2 = {
|
|
|
894
771
|
(0, _log.errLog)('vxe.error.reqModule', ['Modal']);
|
|
895
772
|
}
|
|
896
773
|
}
|
|
897
|
-
|
|
898
774
|
_vXETable.default.modal.message({
|
|
899
775
|
id: code,
|
|
900
776
|
content: _conf.default.i18n('vxe.grid.selectOneRecord'),
|
|
@@ -907,65 +783,53 @@ var _default2 = {
|
|
|
907
783
|
(0, _log.errLog)('vxe.error.notFunc', ['proxy-config.ajax.delete']);
|
|
908
784
|
}
|
|
909
785
|
}
|
|
910
|
-
|
|
911
786
|
break;
|
|
912
787
|
}
|
|
913
|
-
|
|
914
788
|
case 'save':
|
|
915
789
|
{
|
|
916
790
|
var _ajaxMethods2 = ajax.save;
|
|
917
|
-
|
|
918
791
|
if (_ajaxMethods2) {
|
|
919
792
|
var _body = Object.assign({
|
|
920
793
|
pendingRecords: this.pendingRecords
|
|
921
794
|
}, this.getRecordset());
|
|
922
|
-
|
|
923
795
|
var insertRecords = _body.insertRecords,
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
796
|
+
_removeRecords = _body.removeRecords,
|
|
797
|
+
updateRecords = _body.updateRecords,
|
|
798
|
+
pendingRecords = _body.pendingRecords;
|
|
928
799
|
var _applyArgs2 = [{
|
|
929
800
|
$grid: this,
|
|
930
801
|
code: code,
|
|
931
802
|
button: button,
|
|
932
803
|
body: _body,
|
|
933
804
|
options: _ajaxMethods2
|
|
934
|
-
}].concat(args);
|
|
935
|
-
|
|
936
|
-
|
|
805
|
+
}].concat(args);
|
|
806
|
+
// 排除掉新增且标记为删除的数据
|
|
937
807
|
if (insertRecords.length) {
|
|
938
808
|
_body.pendingRecords = pendingRecords.filter(function (row) {
|
|
939
809
|
return insertRecords.indexOf(row) === -1;
|
|
940
810
|
});
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
|
|
811
|
+
}
|
|
812
|
+
// 排除已标记为删除的数据
|
|
944
813
|
if (pendingRecords.length) {
|
|
945
814
|
_body.insertRecords = insertRecords.filter(function (row) {
|
|
946
815
|
return pendingRecords.indexOf(row) === -1;
|
|
947
816
|
});
|
|
948
817
|
}
|
|
949
|
-
|
|
950
818
|
var restPromise = Promise.resolve();
|
|
951
|
-
|
|
952
819
|
if (editRules) {
|
|
953
820
|
// 只校验新增和修改的数据
|
|
954
821
|
restPromise = this.validate(_body.insertRecords.concat(updateRecords));
|
|
955
822
|
}
|
|
956
|
-
|
|
957
823
|
return restPromise.then(function (errMap) {
|
|
958
824
|
if (errMap) {
|
|
959
825
|
// 如果校验不通过
|
|
960
826
|
return;
|
|
961
827
|
}
|
|
962
|
-
|
|
963
828
|
if (_body.insertRecords.length || _removeRecords.length || updateRecords.length || _body.pendingRecords.length) {
|
|
964
829
|
_this5.tableLoading = true;
|
|
965
830
|
return Promise.resolve((beforeSave || _ajaxMethods2).apply(void 0, _toConsumableArray(_applyArgs2))).then(function (rest) {
|
|
966
831
|
_this5.tableLoading = false;
|
|
967
832
|
_this5.pendingRecords = [];
|
|
968
|
-
|
|
969
833
|
if (isMsg) {
|
|
970
834
|
// 检测弹窗模块
|
|
971
835
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -973,13 +837,11 @@ var _default2 = {
|
|
|
973
837
|
(0, _log.errLog)('vxe.error.reqModule', ['Modal']);
|
|
974
838
|
}
|
|
975
839
|
}
|
|
976
|
-
|
|
977
840
|
_vXETable.default.modal.message({
|
|
978
841
|
content: _this5.getRespMsg(rest, 'vxe.grid.saveSuccess'),
|
|
979
842
|
status: 'success'
|
|
980
843
|
});
|
|
981
844
|
}
|
|
982
|
-
|
|
983
845
|
if (afterSave) {
|
|
984
846
|
afterSave.apply(void 0, _toConsumableArray(_applyArgs2));
|
|
985
847
|
} else {
|
|
@@ -987,7 +849,6 @@ var _default2 = {
|
|
|
987
849
|
}
|
|
988
850
|
}).catch(function (rest) {
|
|
989
851
|
_this5.tableLoading = false;
|
|
990
|
-
|
|
991
852
|
if (isMsg) {
|
|
992
853
|
// 检测弹窗模块
|
|
993
854
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -995,7 +856,6 @@ var _default2 = {
|
|
|
995
856
|
(0, _log.errLog)('vxe.error.reqModule', ['Modal']);
|
|
996
857
|
}
|
|
997
858
|
}
|
|
998
|
-
|
|
999
859
|
_vXETable.default.modal.message({
|
|
1000
860
|
id: code,
|
|
1001
861
|
content: _this5.getRespMsg(rest, 'vxe.grid.operError'),
|
|
@@ -1011,7 +871,6 @@ var _default2 = {
|
|
|
1011
871
|
(0, _log.errLog)('vxe.error.reqModule', ['Modal']);
|
|
1012
872
|
}
|
|
1013
873
|
}
|
|
1014
|
-
|
|
1015
874
|
_vXETable.default.modal.message({
|
|
1016
875
|
id: code,
|
|
1017
876
|
content: _conf.default.i18n('vxe.grid.dataUnchanged'),
|
|
@@ -1025,14 +884,11 @@ var _default2 = {
|
|
|
1025
884
|
(0, _log.errLog)('vxe.error.notFunc', ['proxy-config.ajax.save']);
|
|
1026
885
|
}
|
|
1027
886
|
}
|
|
1028
|
-
|
|
1029
887
|
break;
|
|
1030
888
|
}
|
|
1031
|
-
|
|
1032
889
|
default:
|
|
1033
890
|
{
|
|
1034
891
|
var btnMethod = _vXETable.default.commands.get(code);
|
|
1035
|
-
|
|
1036
892
|
if (btnMethod) {
|
|
1037
893
|
btnMethod.apply(void 0, [{
|
|
1038
894
|
code: code,
|
|
@@ -1043,23 +899,19 @@ var _default2 = {
|
|
|
1043
899
|
}
|
|
1044
900
|
}
|
|
1045
901
|
}
|
|
1046
|
-
|
|
1047
902
|
return this.$nextTick();
|
|
1048
903
|
},
|
|
1049
904
|
getRespMsg: function getRespMsg(rest, defaultMsg) {
|
|
1050
905
|
var _this$proxyOpts$props = this.proxyOpts.props,
|
|
1051
|
-
|
|
906
|
+
proxyProps = _this$proxyOpts$props === void 0 ? {} : _this$proxyOpts$props;
|
|
1052
907
|
var msg;
|
|
1053
|
-
|
|
1054
908
|
if (rest && proxyProps.message) {
|
|
1055
909
|
msg = _xeUtils.default.get(rest, proxyProps.message);
|
|
1056
910
|
}
|
|
1057
|
-
|
|
1058
911
|
return msg || _conf.default.i18n(defaultMsg);
|
|
1059
912
|
},
|
|
1060
913
|
handleDeleteRow: function handleDeleteRow(code, alertKey, callback) {
|
|
1061
914
|
var selectRecords = this.getCheckboxRecords();
|
|
1062
|
-
|
|
1063
915
|
if (this.isMsg) {
|
|
1064
916
|
if (selectRecords.length) {
|
|
1065
917
|
return _vXETable.default.modal.confirm({
|
|
@@ -1078,7 +930,6 @@ var _default2 = {
|
|
|
1078
930
|
(0, _log.errLog)('vxe.error.reqModule', ['Modal']);
|
|
1079
931
|
}
|
|
1080
932
|
}
|
|
1081
|
-
|
|
1082
933
|
_vXETable.default.modal.message({
|
|
1083
934
|
id: "msg_".concat(code),
|
|
1084
935
|
content: _conf.default.i18n('vxe.grid.selectOneRecord'),
|
|
@@ -1090,20 +941,17 @@ var _default2 = {
|
|
|
1090
941
|
callback();
|
|
1091
942
|
}
|
|
1092
943
|
}
|
|
1093
|
-
|
|
1094
944
|
return Promise.resolve();
|
|
1095
945
|
},
|
|
1096
946
|
getFormItems: function getFormItems(itemIndex) {
|
|
1097
947
|
var formConfig = this.formConfig,
|
|
1098
|
-
|
|
948
|
+
formOpts = this.formOpts;
|
|
1099
949
|
var itemList = [];
|
|
1100
|
-
|
|
1101
950
|
_xeUtils.default.eachTree((0, _utils.isEnableConf)(formConfig) && formOpts.items ? formOpts.items : [], function (item) {
|
|
1102
951
|
itemList.push(item);
|
|
1103
952
|
}, {
|
|
1104
953
|
children: 'children'
|
|
1105
954
|
});
|
|
1106
|
-
|
|
1107
955
|
return _xeUtils.default.isUndefined(itemIndex) ? itemList : itemList[itemIndex];
|
|
1108
956
|
},
|
|
1109
957
|
getPendingRecords: function getPendingRecords() {
|
|
@@ -1129,9 +977,8 @@ var _default2 = {
|
|
|
1129
977
|
},
|
|
1130
978
|
triggerPendingEvent: function triggerPendingEvent(code) {
|
|
1131
979
|
var pendingRecords = this.pendingRecords,
|
|
1132
|
-
|
|
980
|
+
isMsg = this.isMsg;
|
|
1133
981
|
var selectRecords = this.getCheckboxRecords();
|
|
1134
|
-
|
|
1135
982
|
if (selectRecords.length) {
|
|
1136
983
|
var plus = [];
|
|
1137
984
|
var minus = [];
|
|
@@ -1144,7 +991,6 @@ var _default2 = {
|
|
|
1144
991
|
plus.push(data);
|
|
1145
992
|
}
|
|
1146
993
|
});
|
|
1147
|
-
|
|
1148
994
|
if (minus.length) {
|
|
1149
995
|
this.pendingRecords = pendingRecords.filter(function (item) {
|
|
1150
996
|
return minus.indexOf(item) === -1;
|
|
@@ -1152,7 +998,6 @@ var _default2 = {
|
|
|
1152
998
|
} else if (plus.length) {
|
|
1153
999
|
this.pendingRecords = pendingRecords.concat(plus);
|
|
1154
1000
|
}
|
|
1155
|
-
|
|
1156
1001
|
this.clearCheckboxRow();
|
|
1157
1002
|
} else {
|
|
1158
1003
|
if (isMsg) {
|
|
@@ -1162,7 +1007,6 @@ var _default2 = {
|
|
|
1162
1007
|
(0, _log.errLog)('vxe.error.reqModule', ['Modal']);
|
|
1163
1008
|
}
|
|
1164
1009
|
}
|
|
1165
|
-
|
|
1166
1010
|
_vXETable.default.modal.message({
|
|
1167
1011
|
id: code,
|
|
1168
1012
|
content: _conf.default.i18n('vxe.grid.selectOneRecord'),
|
|
@@ -1173,73 +1017,64 @@ var _default2 = {
|
|
|
1173
1017
|
},
|
|
1174
1018
|
pageChangeEvent: function pageChangeEvent(params) {
|
|
1175
1019
|
var proxyConfig = this.proxyConfig,
|
|
1176
|
-
|
|
1020
|
+
tablePage = this.tablePage;
|
|
1177
1021
|
var currentPage = params.currentPage,
|
|
1178
|
-
|
|
1022
|
+
pageSize = params.pageSize;
|
|
1179
1023
|
tablePage.currentPage = currentPage;
|
|
1180
1024
|
tablePage.pageSize = pageSize;
|
|
1181
1025
|
this.$emit('page-change', Object.assign({
|
|
1182
1026
|
$grid: this
|
|
1183
1027
|
}, params));
|
|
1184
|
-
|
|
1185
1028
|
if (proxyConfig) {
|
|
1186
1029
|
this.commitProxy('query');
|
|
1187
1030
|
}
|
|
1188
1031
|
},
|
|
1189
1032
|
sortChangeEvent: function sortChangeEvent(params) {
|
|
1190
1033
|
var $table = params.$table,
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
var isRemote = _xeUtils.default.isBoolean(column.remoteSort) ? column.remoteSort : $table.sortOpts.remote;
|
|
1194
|
-
|
|
1034
|
+
column = params.column,
|
|
1035
|
+
sortList = params.sortList;
|
|
1036
|
+
var isRemote = _xeUtils.default.isBoolean(column.remoteSort) ? column.remoteSort : $table.sortOpts.remote;
|
|
1037
|
+
// 如果是服务端排序
|
|
1195
1038
|
if (isRemote) {
|
|
1196
1039
|
this.sortData = sortList;
|
|
1197
|
-
|
|
1198
1040
|
if (this.proxyConfig) {
|
|
1199
1041
|
this.tablePage.currentPage = 1;
|
|
1200
1042
|
this.commitProxy('query');
|
|
1201
1043
|
}
|
|
1202
1044
|
}
|
|
1203
|
-
|
|
1204
1045
|
this.$emit('sort-change', Object.assign({
|
|
1205
1046
|
$grid: this
|
|
1206
1047
|
}, params));
|
|
1207
1048
|
},
|
|
1208
1049
|
filterChangeEvent: function filterChangeEvent(params) {
|
|
1209
1050
|
var $table = params.$table,
|
|
1210
|
-
|
|
1211
|
-
|
|
1051
|
+
filterList = params.filterList;
|
|
1052
|
+
// 如果是服务端过滤
|
|
1212
1053
|
if ($table.filterOpts.remote) {
|
|
1213
1054
|
this.filterData = filterList;
|
|
1214
|
-
|
|
1215
1055
|
if (this.proxyConfig) {
|
|
1216
1056
|
this.tablePage.currentPage = 1;
|
|
1217
1057
|
this.commitProxy('query');
|
|
1218
1058
|
}
|
|
1219
1059
|
}
|
|
1220
|
-
|
|
1221
1060
|
this.$emit('filter-change', Object.assign({
|
|
1222
1061
|
$grid: this
|
|
1223
1062
|
}, params));
|
|
1224
1063
|
},
|
|
1225
1064
|
submitEvent: function submitEvent(params) {
|
|
1226
1065
|
var proxyConfig = this.proxyConfig;
|
|
1227
|
-
|
|
1228
1066
|
if (proxyConfig) {
|
|
1229
1067
|
this.commitProxy('reload');
|
|
1230
1068
|
}
|
|
1231
|
-
|
|
1232
1069
|
this.$emit('form-submit', Object.assign({
|
|
1233
1070
|
$grid: this
|
|
1234
1071
|
}, params));
|
|
1235
1072
|
},
|
|
1236
1073
|
resetEvent: function resetEvent(params) {
|
|
1237
1074
|
var proxyConfig = this.proxyConfig;
|
|
1238
|
-
|
|
1239
1075
|
if (proxyConfig) {
|
|
1240
1076
|
this.commitProxy('reload');
|
|
1241
1077
|
}
|
|
1242
|
-
|
|
1243
1078
|
this.$emit('form-reset', Object.assign({
|
|
1244
1079
|
$grid: this
|
|
1245
1080
|
}, params));
|
|
@@ -1251,7 +1086,6 @@ var _default2 = {
|
|
|
1251
1086
|
},
|
|
1252
1087
|
collapseEvent: function collapseEvent(params) {
|
|
1253
1088
|
var _this6 = this;
|
|
1254
|
-
|
|
1255
1089
|
this.$nextTick(function () {
|
|
1256
1090
|
return _this6.recalculate(true);
|
|
1257
1091
|
});
|
|
@@ -1284,17 +1118,13 @@ var _default2 = {
|
|
|
1284
1118
|
},
|
|
1285
1119
|
handleZoom: function handleZoom(isMax) {
|
|
1286
1120
|
var _this7 = this;
|
|
1287
|
-
|
|
1288
1121
|
var isZMax = this.isZMax;
|
|
1289
|
-
|
|
1290
1122
|
if (isMax ? !isZMax : isZMax) {
|
|
1291
1123
|
this.isZMax = !isZMax;
|
|
1292
|
-
|
|
1293
1124
|
if (this.tZindex < _utils.default.getLastZIndex()) {
|
|
1294
1125
|
this.tZindex = _utils.default.nextZIndex();
|
|
1295
1126
|
}
|
|
1296
1127
|
}
|
|
1297
|
-
|
|
1298
1128
|
return this.$nextTick().then(function () {
|
|
1299
1129
|
return _this7.recalculate(true);
|
|
1300
1130
|
}).then(function () {
|
|
@@ -1303,8 +1133,7 @@ var _default2 = {
|
|
|
1303
1133
|
},
|
|
1304
1134
|
getProxyInfo: function getProxyInfo() {
|
|
1305
1135
|
var sortData = this.sortData,
|
|
1306
|
-
|
|
1307
|
-
|
|
1136
|
+
proxyConfig = this.proxyConfig;
|
|
1308
1137
|
if (proxyConfig) {
|
|
1309
1138
|
return {
|
|
1310
1139
|
data: this.tableData,
|
|
@@ -1316,13 +1145,11 @@ var _default2 = {
|
|
|
1316
1145
|
pendingRecords: this.pendingRecords
|
|
1317
1146
|
};
|
|
1318
1147
|
}
|
|
1319
|
-
|
|
1320
1148
|
return null;
|
|
1321
1149
|
}
|
|
1322
1150
|
}, process.env.NODE_ENV === 'development' ? {
|
|
1323
1151
|
loadColumn: function loadColumn(columns) {
|
|
1324
1152
|
var $scopedSlots = this.$scopedSlots;
|
|
1325
|
-
|
|
1326
1153
|
_xeUtils.default.eachTree(columns, function (column) {
|
|
1327
1154
|
if (column.slots) {
|
|
1328
1155
|
_xeUtils.default.each(column.slots, function (func) {
|
|
@@ -1334,7 +1161,6 @@ var _default2 = {
|
|
|
1334
1161
|
});
|
|
1335
1162
|
}
|
|
1336
1163
|
});
|
|
1337
|
-
|
|
1338
1164
|
return this.$refs.xTable.loadColumn(columns);
|
|
1339
1165
|
},
|
|
1340
1166
|
reloadColumn: function reloadColumn(columns) {
|