vxe-table 3.9.0-rc.9 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -9
- package/es/grid/src/grid.js +116 -62
- package/es/grid/style.css +0 -1
- package/es/grid/style.min.css +1 -1
- package/es/index.esm.js +22 -3
- package/es/locale/lang/en-US.js +6 -2
- package/es/locale/lang/es-ES.js +5 -1
- package/es/locale/lang/hu-HU.js +5 -1
- package/es/locale/lang/ja-JP.js +5 -1
- package/es/locale/lang/ko-KR.js +5 -1
- package/es/locale/lang/pt-BR.js +5 -1
- package/es/locale/lang/ru-RU.js +5 -1
- package/es/locale/lang/uk-UA.js +5 -1
- package/es/locale/lang/vi-VN.js +5 -1
- package/es/locale/lang/zh-CHT.js +5 -1
- package/es/locale/lang/zh-CN.js +5 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/panel.js +183 -173
- package/es/table/module/edit/mixin.js +35 -40
- package/es/table/module/export/export-panel.js +32 -4
- package/es/table/module/export/import-panel.js +25 -6
- package/es/table/module/export/mixin.js +11 -11
- package/es/table/module/menu/mixin.js +2 -2
- package/es/table/module/validator/mixin.js +4 -4
- package/es/table/render/index.js +17 -11
- package/es/table/src/body.js +1 -0
- package/es/table/src/columnInfo.js +3 -3
- package/es/table/src/methods.js +69 -55
- package/es/table/src/props.js +65 -15
- package/es/table/src/table.js +63 -29
- package/es/table/src/util.js +3 -2
- package/es/table/style.css +37 -48
- package/es/table/style.min.css +1 -1
- package/es/toolbar/src/toolbar.js +21 -7
- package/es/toolbar/style.css +0 -1
- package/es/toolbar/style.min.css +1 -1
- package/es/ui/index.js +5 -3
- package/es/ui/src/log.js +1 -1
- package/es/vxe-grid/style.css +0 -1
- package/es/vxe-grid/style.min.css +1 -1
- package/es/vxe-table/style.css +37 -48
- package/es/vxe-table/style.min.css +1 -1
- package/es/vxe-toolbar/style.css +0 -1
- package/es/vxe-toolbar/style.min.css +1 -1
- package/lib/colgroup/index.js +3 -3
- package/lib/colgroup/index.min.js +1 -1
- package/lib/column/index.js +3 -3
- package/lib/column/index.min.js +1 -1
- package/lib/components.js +9 -11
- package/lib/components.min.js +1 -1
- package/lib/grid/index.js +3 -3
- package/lib/grid/index.min.js +1 -1
- package/lib/grid/src/grid.js +577 -487
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/grid/style/style.css +0 -1
- package/lib/grid/style/style.min.css +1 -1
- package/lib/index.common.js +3 -4
- package/lib/index.umd.js +9148 -17246
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/en-US.js +6 -2
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +6 -2
- package/lib/locale/lang/es-ES.js +5 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +5 -1
- package/lib/locale/lang/hu-HU.js +5 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +5 -1
- package/lib/locale/lang/ja-JP.js +5 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +5 -1
- package/lib/locale/lang/ko-KR.js +5 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +5 -1
- package/lib/locale/lang/pt-BR.js +5 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +5 -1
- package/lib/locale/lang/ru-RU.js +5 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +5 -1
- package/lib/locale/lang/uk-UA.js +5 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +5 -1
- package/lib/locale/lang/vi-VN.js +5 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +5 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +5 -1
- package/lib/locale/lang/zh-CN.js +5 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +5 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/index.js +4 -4
- package/lib/table/index.min.js +1 -1
- package/lib/table/module/custom/mixin.js +53 -44
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +310 -239
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +434 -383
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/export-panel.js +136 -106
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/import-panel.js +75 -54
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +592 -597
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/export/util.js +6 -4
- package/lib/table/module/export/util.min.js +1 -1
- package/lib/table/module/filter/mixin.js +147 -118
- package/lib/table/module/filter/mixin.min.js +1 -1
- package/lib/table/module/filter/panel.js +86 -65
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +163 -151
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +125 -114
- package/lib/table/module/menu/mixin.min.js +1 -1
- package/lib/table/module/menu/panel.js +36 -34
- package/lib/table/module/menu/panel.min.js +1 -1
- package/lib/table/module/validator/mixin.js +225 -214
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/render/index.js +401 -297
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +411 -349
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +470 -344
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +10 -10
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +46 -55
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +157 -132
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/group.js +1 -1
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/header.js +170 -153
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +2770 -2491
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +33 -74
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +436 -395
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +143 -131
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +37 -48
- package/lib/table/style/style.min.css +1 -1
- package/lib/toolbar/index.js +3 -3
- package/lib/toolbar/index.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +332 -284
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/toolbar/style/style.css +0 -1
- package/lib/toolbar/style/style.min.css +1 -1
- package/lib/ui/index.js +50 -41
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/comp.js +2 -3
- package/lib/ui/src/comp.min.js +1 -1
- package/lib/ui/src/dom.js +29 -28
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +6 -4
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/utils.js +7 -7
- package/lib/v-x-e-table/index.js +3 -4
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/vxe-colgroup/index.js +3 -4
- package/lib/vxe-colgroup/index.min.js +1 -1
- package/lib/vxe-column/index.js +3 -4
- package/lib/vxe-column/index.min.js +1 -1
- package/lib/vxe-grid/index.js +3 -4
- package/lib/vxe-grid/index.min.js +1 -1
- package/lib/vxe-grid/style/style.css +0 -1
- package/lib/vxe-grid/style/style.min.css +1 -1
- package/lib/vxe-table/index.js +3 -4
- package/lib/vxe-table/index.min.js +1 -1
- package/lib/vxe-table/style/style.css +37 -48
- package/lib/vxe-table/style/style.min.css +1 -1
- package/lib/vxe-toolbar/index.js +3 -4
- package/lib/vxe-toolbar/index.min.js +1 -1
- package/lib/vxe-toolbar/style/style.css +0 -1
- package/lib/vxe-toolbar/style/style.min.css +1 -1
- package/lib/vxe-ui/index.js +3 -4
- package/lib/vxe-ui/index.min.js +1 -1
- package/lib/vxe-v-x-e-table/index.js +3 -4
- package/lib/vxe-v-x-e-table/index.min.js +1 -1
- package/package.json +5 -4
- package/packages/grid/src/grid.ts +123 -61
- package/packages/locale/lang/en-US.ts +6 -2
- package/packages/locale/lang/es-ES.ts +5 -1
- package/packages/locale/lang/hu-HU.ts +5 -1
- package/packages/locale/lang/ja-JP.ts +5 -1
- package/packages/locale/lang/ko-KR.ts +5 -1
- package/packages/locale/lang/pt-BR.ts +5 -1
- package/packages/locale/lang/ru-RU.ts +5 -1
- package/packages/locale/lang/uk-UA.ts +5 -1
- package/packages/locale/lang/vi-VN.ts +5 -1
- package/packages/locale/lang/zh-CHT.ts +5 -1
- package/packages/locale/lang/zh-CN.ts +5 -1
- package/packages/table/module/custom/panel.ts +186 -175
- package/packages/table/module/edit/mixin.ts +34 -39
- package/packages/table/module/export/export-panel.ts +36 -4
- package/packages/table/module/export/import-panel.ts +29 -6
- package/packages/table/module/export/mixin.ts +11 -11
- package/packages/table/module/menu/mixin.ts +2 -2
- package/packages/table/module/validator/mixin.ts +4 -4
- package/packages/table/render/index.ts +20 -11
- package/packages/table/src/body.ts +1 -0
- package/packages/table/src/columnInfo.ts +3 -3
- package/packages/table/src/methods.ts +70 -55
- package/packages/table/src/props.ts +68 -15
- package/packages/table/src/table.ts +71 -26
- package/packages/table/src/util.ts +3 -2
- package/packages/toolbar/src/toolbar.ts +21 -7
- package/packages/ui/index.ts +3 -1
- package/styles/components/table.scss +82 -17
- package/types/all.d.ts +1 -0
- /package/es/{iconfont.1726453742001.ttf → iconfont.1728483486168.ttf} +0 -0
- /package/es/{iconfont.1726453742001.woff → iconfont.1728483486168.woff} +0 -0
- /package/es/{iconfont.1726453742001.woff2 → iconfont.1728483486168.woff2} +0 -0
- /package/lib/{iconfont.1726453742001.ttf → iconfont.1728483486168.ttf} +0 -0
- /package/lib/{iconfont.1726453742001.woff → iconfont.1728483486168.woff} +0 -0
- /package/lib/{iconfont.1726453742001.woff2 → iconfont.1728483486168.woff2} +0 -0
package/lib/grid/src/grid.js
CHANGED
|
@@ -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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
41
|
+
const formSlots = {};
|
|
44
42
|
if (!formOpts.inited) {
|
|
45
43
|
formOpts.inited = true;
|
|
46
|
-
|
|
44
|
+
const beforeItem = proxyOpts.beforeItem;
|
|
47
45
|
if (proxyOpts && beforeItem) {
|
|
48
|
-
formOpts.items.forEach(
|
|
49
|
-
beforeItem.call(
|
|
50
|
-
$grid:
|
|
51
|
-
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(
|
|
58
|
-
_xeUtils.default.each(item.slots,
|
|
55
|
+
formOpts.items.forEach(item => {
|
|
56
|
+
_xeUtils.default.each(item.slots, func => {
|
|
59
57
|
if (!_xeUtils.default.isFunction(func)) {
|
|
60
|
-
if (
|
|
61
|
-
formSlots[func] =
|
|
58
|
+
if (slots[func]) {
|
|
59
|
+
formSlots[func] = slots[func];
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
});
|
|
65
63
|
});
|
|
66
|
-
return [h(
|
|
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:
|
|
72
|
-
reset:
|
|
73
|
-
collapse:
|
|
74
|
-
'submit-invalid':
|
|
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(
|
|
82
|
-
|
|
83
|
-
|
|
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 (
|
|
87
|
-
return
|
|
84
|
+
if (slots[funcSlot]) {
|
|
85
|
+
return slots[funcSlot];
|
|
88
86
|
} else {
|
|
89
|
-
if (process.env.
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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
|
-
|
|
258
|
-
|
|
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
|
-
|
|
274
|
-
|
|
275
|
-
|
|
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,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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(
|
|
301
|
-
$grid:
|
|
302
|
-
}, h) : [h(
|
|
303
|
-
props: Object.assign(Object.assign({},
|
|
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':
|
|
325
|
+
'page-change': $xeGrid.pageChangeEvent
|
|
306
326
|
},
|
|
307
|
-
scopedSlots: getPagerSlots(
|
|
308
|
-
})]);
|
|
327
|
+
scopedSlots: getPagerSlots($xeGrid)
|
|
328
|
+
}) : renderEmptyElement($xeGrid)]);
|
|
309
329
|
}
|
|
310
|
-
return
|
|
330
|
+
return renderEmptyElement($xeGrid);
|
|
311
331
|
}
|
|
312
|
-
|
|
332
|
+
const defaultLayouts = ['Form', 'Toolbar', 'Top', 'Table', 'Bottom', 'Pager'];
|
|
313
333
|
function renderLayout(h, _vm) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
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.
|
|
342
|
-
(0, _log.errLog)('vxe.error.notProp', [
|
|
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(
|
|
350
|
-
methods[name] = function () {
|
|
351
|
-
|
|
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
|
|
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:
|
|
370
|
-
return getConfig().grid.size || getConfig().size;
|
|
371
|
-
}
|
|
390
|
+
default: () => getConfig().grid.size || getConfig().size
|
|
372
391
|
}
|
|
373
392
|
}),
|
|
374
|
-
provide
|
|
393
|
+
provide() {
|
|
375
394
|
return {
|
|
376
395
|
$xeGrid: this,
|
|
377
396
|
$xegrid: this
|
|
378
397
|
};
|
|
379
398
|
},
|
|
380
|
-
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
|
|
398
|
-
|
|
417
|
+
isRespMsg() {
|
|
418
|
+
const {
|
|
419
|
+
proxyOpts
|
|
420
|
+
} = this;
|
|
399
421
|
return _xeUtils.default.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg;
|
|
400
422
|
},
|
|
401
|
-
isActiveMsg
|
|
423
|
+
isActiveMsg() {
|
|
402
424
|
return this.proxyOpts.showActiveMsg;
|
|
403
425
|
},
|
|
404
|
-
proxyOpts
|
|
405
|
-
return
|
|
426
|
+
proxyOpts() {
|
|
427
|
+
return this.computeProxyOpts;
|
|
406
428
|
},
|
|
407
|
-
|
|
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() {
|
|
408
436
|
return Object.assign({}, getConfig().grid.pagerConfig, this.pagerConfig);
|
|
409
437
|
},
|
|
410
|
-
formOpts
|
|
438
|
+
formOpts() {
|
|
439
|
+
return this.computeFormOpts;
|
|
440
|
+
},
|
|
441
|
+
computeFormOpts() {
|
|
411
442
|
return Object.assign({}, getConfig().grid.formConfig, this.formConfig);
|
|
412
443
|
},
|
|
413
|
-
toolbarOpts
|
|
444
|
+
toolbarOpts() {
|
|
445
|
+
return this.computeToolbarOpts;
|
|
446
|
+
},
|
|
447
|
+
computeToolbarOpts() {
|
|
414
448
|
return Object.assign({}, getConfig().grid.toolbarConfig, this.toolbarConfig || this.toolbar);
|
|
415
449
|
},
|
|
416
|
-
zoomOpts
|
|
450
|
+
zoomOpts() {
|
|
451
|
+
return this.computeZoomOpts;
|
|
452
|
+
},
|
|
453
|
+
computeZoomOpts() {
|
|
417
454
|
return Object.assign({}, getConfig().grid.zoomConfig, this.zoomConfig);
|
|
418
455
|
},
|
|
419
|
-
renderStyle
|
|
456
|
+
renderStyle() {
|
|
420
457
|
return this.isZMax ? {
|
|
421
458
|
zIndex: this.tZindex
|
|
422
459
|
} : null;
|
|
423
460
|
},
|
|
424
|
-
tableExtendProps
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
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
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
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
|
|
469
|
-
|
|
470
|
-
this.$nextTick(function () {
|
|
471
|
-
return _this2.loadColumn(value);
|
|
472
|
-
});
|
|
506
|
+
columns(value) {
|
|
507
|
+
this.$nextTick(() => this.loadColumn(value));
|
|
473
508
|
},
|
|
474
|
-
toolbar
|
|
509
|
+
toolbar(value) {
|
|
475
510
|
if (value) {
|
|
476
511
|
this.initToolbar();
|
|
477
512
|
}
|
|
478
513
|
},
|
|
479
|
-
toolbarConfig
|
|
514
|
+
toolbarConfig(value) {
|
|
480
515
|
if (value) {
|
|
481
516
|
this.initToolbar();
|
|
482
517
|
}
|
|
483
518
|
},
|
|
484
|
-
proxyConfig
|
|
519
|
+
proxyConfig() {
|
|
485
520
|
this.initProxy();
|
|
486
521
|
},
|
|
487
|
-
pagerConfig
|
|
522
|
+
pagerConfig() {
|
|
488
523
|
this.initPages();
|
|
489
524
|
}
|
|
490
525
|
},
|
|
491
|
-
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.
|
|
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', [
|
|
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
|
|
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
|
|
571
|
+
destroyed() {
|
|
518
572
|
globalEvents.off(this, 'keydown');
|
|
519
573
|
},
|
|
520
|
-
render
|
|
521
|
-
|
|
522
|
-
|
|
574
|
+
render(h) {
|
|
575
|
+
const {
|
|
576
|
+
computeSize,
|
|
577
|
+
isZMax
|
|
578
|
+
} = this;
|
|
579
|
+
const vSize = computeSize;
|
|
523
580
|
return h('div', {
|
|
524
|
-
class: ['vxe-grid',
|
|
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
|
|
592
|
+
callSlot(slotFunc, params, h, vNodes) {
|
|
530
593
|
if (slotFunc) {
|
|
531
|
-
|
|
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
|
|
542
|
-
|
|
543
|
-
|
|
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
|
|
550
|
-
|
|
551
|
-
$
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
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
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
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
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
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
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
proxyConfig
|
|
592
|
-
proxyOpts
|
|
593
|
-
formConfig
|
|
594
|
-
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
|
-
|
|
598
|
-
formOpts.items.forEach(
|
|
599
|
-
|
|
600
|
-
|
|
673
|
+
const fData = {};
|
|
674
|
+
formOpts.items.forEach(item => {
|
|
675
|
+
const {
|
|
676
|
+
field,
|
|
677
|
+
itemRender
|
|
678
|
+
} = item;
|
|
601
679
|
if (field) {
|
|
602
|
-
|
|
680
|
+
let itemValue = null;
|
|
603
681
|
if (itemRender) {
|
|
604
|
-
|
|
682
|
+
const {
|
|
683
|
+
defaultValue
|
|
684
|
+
} = itemRender;
|
|
605
685
|
if (_xeUtils.default.isFunction(defaultValue)) {
|
|
606
686
|
itemValue = defaultValue({
|
|
607
|
-
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(
|
|
621
|
-
|
|
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:
|
|
703
|
+
$grid: this,
|
|
626
704
|
$event: new Event('init')
|
|
627
705
|
}));
|
|
628
706
|
});
|
|
629
707
|
}
|
|
630
708
|
}
|
|
631
709
|
},
|
|
632
|
-
handleGlobalKeydownEvent
|
|
633
|
-
|
|
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
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
toolbar
|
|
646
|
-
toolbarConfig
|
|
647
|
-
toolbarOpts
|
|
648
|
-
proxyOpts
|
|
649
|
-
tablePage
|
|
650
|
-
pagerConfig
|
|
651
|
-
editRules
|
|
652
|
-
isRespMsg
|
|
653
|
-
isActiveMsg
|
|
654
|
-
validConfig
|
|
655
|
-
pagerOpts
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
});
|
|
764
|
+
return this.insert().then(({
|
|
765
|
+
row
|
|
766
|
+
}) => this.setEditRow(row));
|
|
693
767
|
// 已废弃
|
|
694
768
|
case 'insert_actived':
|
|
695
|
-
return this.insert().then(
|
|
696
|
-
|
|
697
|
-
|
|
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',
|
|
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
|
-
|
|
727
|
-
|
|
728
|
-
|
|
797
|
+
const ajaxMethods = ajax.query;
|
|
798
|
+
const querySuccessMethods = ajax.querySuccess;
|
|
799
|
+
const queryErrorMethods = ajax.queryError;
|
|
729
800
|
if (ajaxMethods) {
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
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
|
-
|
|
745
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
769
|
-
code
|
|
770
|
-
button
|
|
771
|
-
isInited
|
|
772
|
-
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
|
-
|
|
785
|
-
return Promise.resolve((beforeQuery || ajaxMethods)
|
|
786
|
-
|
|
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
|
-
|
|
790
|
-
|
|
869
|
+
const totalProp = resConfigs.total;
|
|
870
|
+
const total = (_xeUtils.default.isFunction(totalProp) ? totalProp({
|
|
791
871
|
data: rest,
|
|
792
|
-
$grid:
|
|
872
|
+
$grid: this
|
|
793
873
|
}) : _xeUtils.default.get(rest, totalProp || 'page.total')) || 0;
|
|
794
874
|
tablePage.total = _xeUtils.default.toNumber(total);
|
|
795
|
-
|
|
796
|
-
|
|
875
|
+
const resultProp = resConfigs.result;
|
|
876
|
+
this.tableData = (_xeUtils.default.isFunction(resultProp) ? resultProp({
|
|
797
877
|
data: rest,
|
|
798
|
-
$grid:
|
|
878
|
+
$grid: this
|
|
799
879
|
}) : _xeUtils.default.get(rest, resultProp || 'result')) || [];
|
|
800
880
|
// 检验当前页码,不能超出当前最大页数
|
|
801
|
-
|
|
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
|
-
|
|
807
|
-
|
|
886
|
+
const listProp = resConfigs.list;
|
|
887
|
+
this.tableData = (listProp ? _xeUtils.default.isFunction(listProp) ? listProp({
|
|
808
888
|
data: rest,
|
|
809
|
-
$grid:
|
|
889
|
+
$grid: this
|
|
810
890
|
}) : _xeUtils.default.get(rest, listProp) : rest) || [];
|
|
811
891
|
}
|
|
812
892
|
} else {
|
|
813
|
-
|
|
893
|
+
this.tableData = [];
|
|
814
894
|
}
|
|
815
895
|
if (afterQuery) {
|
|
816
|
-
afterQuery
|
|
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(
|
|
827
|
-
|
|
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.
|
|
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
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
if (
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
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
|
-
|
|
935
|
+
const commitParams = {
|
|
858
936
|
$grid: this,
|
|
859
|
-
code
|
|
860
|
-
button
|
|
861
|
-
body
|
|
937
|
+
code,
|
|
938
|
+
button,
|
|
939
|
+
body,
|
|
862
940
|
form: formData,
|
|
863
|
-
options:
|
|
941
|
+
options: ajaxMethods
|
|
864
942
|
};
|
|
865
|
-
|
|
943
|
+
const applyArgs = [commitParams].concat(args);
|
|
866
944
|
if (selectRecords.length) {
|
|
867
|
-
return this.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord',
|
|
945
|
+
return this.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
|
|
868
946
|
if (!removeRecords.length) {
|
|
869
947
|
return $xetable.remove(selectRecords);
|
|
870
948
|
}
|
|
871
|
-
|
|
872
|
-
return Promise.resolve((beforeDelete ||
|
|
873
|
-
|
|
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.
|
|
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:
|
|
961
|
+
content: this.getRespMsg(rest, 'vxe.grid.delSuccess'),
|
|
884
962
|
status: 'success'
|
|
885
963
|
});
|
|
886
964
|
}
|
|
887
965
|
if (afterDelete) {
|
|
888
|
-
afterDelete
|
|
966
|
+
afterDelete(...applyArgs);
|
|
889
967
|
} else {
|
|
890
|
-
|
|
968
|
+
this.commitProxy('query');
|
|
891
969
|
}
|
|
892
970
|
if (deleteSuccessMethods) {
|
|
893
|
-
deleteSuccessMethods(Object.assign(Object.assign({},
|
|
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(
|
|
901
|
-
|
|
978
|
+
}).catch(rest => {
|
|
979
|
+
this.tableLoading = false;
|
|
902
980
|
if (isRespMsg) {
|
|
903
981
|
// 检测弹窗模块
|
|
904
|
-
if (process.env.
|
|
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:
|
|
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({},
|
|
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.
|
|
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.
|
|
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
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
if (
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
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
|
|
961
|
-
button
|
|
962
|
-
body
|
|
1040
|
+
code,
|
|
1041
|
+
button,
|
|
1042
|
+
body,
|
|
963
1043
|
form: formData,
|
|
964
|
-
options:
|
|
1044
|
+
options: ajaxMethods
|
|
965
1045
|
};
|
|
966
|
-
|
|
1046
|
+
const applyArgs = [commitParams].concat(args);
|
|
967
1047
|
// 排除掉新增且标记为删除的数据
|
|
968
1048
|
if (insertRecords.length) {
|
|
969
|
-
|
|
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
|
-
|
|
976
|
-
return pendingRecords.indexOf(row) === -1;
|
|
977
|
-
});
|
|
1053
|
+
body.insertRecords = insertRecords.filter(row => pendingRecords.indexOf(row) === -1);
|
|
978
1054
|
}
|
|
979
|
-
|
|
1055
|
+
let restPromise = Promise.resolve();
|
|
980
1056
|
if (editRules) {
|
|
981
1057
|
// 只校验新增和修改的数据
|
|
982
|
-
restPromise = this[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](
|
|
1058
|
+
restPromise = this[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](body.insertRecords.concat(updateRecords));
|
|
983
1059
|
}
|
|
984
|
-
return restPromise.then(
|
|
1060
|
+
return restPromise.then(errMap => {
|
|
985
1061
|
if (errMap) {
|
|
986
1062
|
// 如果校验不通过
|
|
987
1063
|
return;
|
|
988
1064
|
}
|
|
989
|
-
if (
|
|
990
|
-
|
|
991
|
-
return Promise.resolve((beforeSave ||
|
|
992
|
-
|
|
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.
|
|
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:
|
|
1078
|
+
content: this.getRespMsg(rest, 'vxe.grid.saveSuccess'),
|
|
1003
1079
|
status: 'success'
|
|
1004
1080
|
});
|
|
1005
1081
|
}
|
|
1006
1082
|
if (afterSave) {
|
|
1007
|
-
afterSave
|
|
1083
|
+
afterSave(...applyArgs);
|
|
1008
1084
|
} else {
|
|
1009
|
-
|
|
1085
|
+
this.commitProxy('query');
|
|
1010
1086
|
}
|
|
1011
1087
|
if (saveSuccessMethods) {
|
|
1012
|
-
saveSuccessMethods(Object.assign(Object.assign({},
|
|
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(
|
|
1020
|
-
|
|
1095
|
+
}).catch(rest => {
|
|
1096
|
+
this.tableLoading = false;
|
|
1021
1097
|
if (isRespMsg) {
|
|
1022
1098
|
// 检测弹窗模块
|
|
1023
|
-
if (process.env.
|
|
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:
|
|
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({},
|
|
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.
|
|
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.
|
|
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
|
-
|
|
1144
|
+
const gCommandOpts = commands.get(code);
|
|
1069
1145
|
if (gCommandOpts) {
|
|
1070
1146
|
if (gCommandOpts.commandMethod) {
|
|
1071
|
-
gCommandOpts.commandMethod
|
|
1072
|
-
code
|
|
1073
|
-
button
|
|
1147
|
+
gCommandOpts.commandMethod({
|
|
1148
|
+
code,
|
|
1149
|
+
button,
|
|
1074
1150
|
$grid: this,
|
|
1075
1151
|
$table: $xetable
|
|
1076
|
-
}
|
|
1152
|
+
}, ...args);
|
|
1077
1153
|
} else {
|
|
1078
|
-
if (process.env.
|
|
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
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
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
|
|
1097
|
-
|
|
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:
|
|
1179
|
+
id: `cfm_${code}`,
|
|
1102
1180
|
content: getI18n(alertKey),
|
|
1103
1181
|
escClosable: true
|
|
1104
|
-
}).then(
|
|
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.
|
|
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:
|
|
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
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
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
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
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
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
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
|
-
|
|
1235
|
+
this.$emit(code === 'delete' || code === 'save' ? `proxy-${code}` : 'proxy-query', Object.assign(Object.assign({}, rest), {
|
|
1153
1236
|
isReload: code === 'reload',
|
|
1154
|
-
$grid:
|
|
1237
|
+
$grid: this,
|
|
1155
1238
|
$event: evnt
|
|
1156
1239
|
}));
|
|
1157
1240
|
}
|
|
1158
1241
|
});
|
|
1159
1242
|
},
|
|
1160
|
-
triggerToolbarBtnEvent
|
|
1243
|
+
triggerToolbarBtnEvent(button, evnt) {
|
|
1161
1244
|
this.triggerToolbarCommitEvent(button, evnt);
|
|
1162
1245
|
this.$emit('toolbar-button-click', {
|
|
1163
1246
|
code: button.code,
|
|
1164
|
-
button
|
|
1247
|
+
button,
|
|
1165
1248
|
$grid: this,
|
|
1166
1249
|
$event: evnt
|
|
1167
1250
|
});
|
|
1168
1251
|
},
|
|
1169
|
-
triggerToolbarTolEvent
|
|
1252
|
+
triggerToolbarTolEvent(tool, evnt) {
|
|
1170
1253
|
this.triggerToolbarCommitEvent(tool, evnt);
|
|
1171
1254
|
this.$emit('toolbar-tool-click', {
|
|
1172
1255
|
code: tool.code,
|
|
1173
|
-
tool
|
|
1256
|
+
tool,
|
|
1174
1257
|
$grid: this,
|
|
1175
1258
|
$event: evnt
|
|
1176
1259
|
});
|
|
1177
1260
|
},
|
|
1178
|
-
triggerPendingEvent
|
|
1179
|
-
|
|
1180
|
-
|
|
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.
|
|
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
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
tablePage
|
|
1204
|
-
|
|
1205
|
-
|
|
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(
|
|
1213
|
-
|
|
1214
|
-
$grid:
|
|
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
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
column
|
|
1224
|
-
sortList
|
|
1225
|
-
|
|
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(
|
|
1232
|
-
|
|
1233
|
-
$grid:
|
|
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
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
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(
|
|
1253
|
-
|
|
1254
|
-
$grid:
|
|
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
|
|
1265
|
-
|
|
1266
|
-
|
|
1354
|
+
submitEvent(params) {
|
|
1355
|
+
const {
|
|
1356
|
+
proxyConfig
|
|
1357
|
+
} = this;
|
|
1267
1358
|
if (proxyConfig) {
|
|
1268
|
-
this.commitProxy('reload').then(
|
|
1269
|
-
|
|
1359
|
+
this.commitProxy('reload').then(rest => {
|
|
1360
|
+
this.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
|
|
1270
1361
|
isReload: true,
|
|
1271
|
-
$grid:
|
|
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
|
|
1281
|
-
|
|
1282
|
-
|
|
1371
|
+
resetEvent(params) {
|
|
1372
|
+
const {
|
|
1373
|
+
proxyConfig
|
|
1374
|
+
} = this;
|
|
1283
1375
|
if (proxyConfig) {
|
|
1284
|
-
this.commitProxy('reload').then(
|
|
1285
|
-
|
|
1376
|
+
this.commitProxy('reload').then(rest => {
|
|
1377
|
+
this.$emit('proxy-query', Object.assign(Object.assign({}, rest), {
|
|
1286
1378
|
isReload: true,
|
|
1287
|
-
$grid:
|
|
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
|
|
1388
|
+
submitInvalidEvent(params) {
|
|
1297
1389
|
this.$emit('form-submit-invalid', Object.assign({
|
|
1298
1390
|
$grid: this
|
|
1299
1391
|
}, params));
|
|
1300
1392
|
},
|
|
1301
|
-
collapseEvent
|
|
1302
|
-
|
|
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
|
|
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
|
|
1410
|
+
zoom() {
|
|
1322
1411
|
return this[this.isZMax ? 'revert' : 'maximize']();
|
|
1323
1412
|
},
|
|
1324
|
-
isMaximized
|
|
1413
|
+
isMaximized() {
|
|
1325
1414
|
return this.isZMax;
|
|
1326
1415
|
},
|
|
1327
|
-
maximize
|
|
1416
|
+
maximize() {
|
|
1328
1417
|
return this.handleZoom(true);
|
|
1329
1418
|
},
|
|
1330
|
-
revert
|
|
1419
|
+
revert() {
|
|
1331
1420
|
return this.handleZoom();
|
|
1332
1421
|
},
|
|
1333
|
-
handleZoom
|
|
1334
|
-
|
|
1335
|
-
|
|
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(
|
|
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
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
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.
|
|
1367
|
-
loadColumn
|
|
1368
|
-
|
|
1369
|
-
|
|
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,
|
|
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
|
|
1472
|
+
reloadColumn(columns) {
|
|
1383
1473
|
this.clearAll();
|
|
1384
1474
|
return this.loadColumn(columns);
|
|
1385
1475
|
}
|