vxe-table 3.14.0-beta.1 → 3.14.0-beta.2
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/es/grid/src/grid.js +34 -62
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +25 -27
- package/es/table/module/export/export-panel.js +22 -24
- package/es/table/module/export/import-panel.js +14 -16
- package/es/table/module/export/mixin.js +15 -31
- package/es/table/module/validator/mixin.js +1 -3
- package/es/table/render/index.js +2 -4
- package/es/table/src/columnInfo.js +30 -32
- package/es/table/src/methods.js +121 -94
- package/es/table/src/table.js +16 -18
- package/es/table/src/util.js +5 -7
- package/es/toolbar/src/toolbar.js +18 -26
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +34 -62
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +323 -340
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/panel.js +31 -33
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/export/export-panel.js +22 -24
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/import-panel.js +14 -16
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +15 -31
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +1 -3
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/render/index.js +2 -4
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/columnInfo.js +32 -34
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +129 -91
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +13 -15
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +4 -6
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +18 -26
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +34 -62
- package/packages/table/module/custom/panel.ts +25 -27
- package/packages/table/module/export/export-panel.ts +22 -24
- package/packages/table/module/export/import-panel.ts +14 -16
- package/packages/table/module/export/mixin.ts +15 -31
- package/packages/table/module/validator/mixin.ts +1 -3
- package/packages/table/render/index.ts +2 -4
- package/packages/table/src/columnInfo.ts +30 -32
- package/packages/table/src/methods.ts +126 -95
- package/packages/table/src/table.ts +13 -15
- package/packages/table/src/util.ts +4 -6
- package/packages/toolbar/src/toolbar.ts +18 -26
- /package/es/{iconfont.1741051885975.ttf → iconfont.1741079977180.ttf} +0 -0
- /package/es/{iconfont.1741051885975.woff → iconfont.1741079977180.woff} +0 -0
- /package/es/{iconfont.1741051885975.woff2 → iconfont.1741079977180.woff2} +0 -0
- /package/lib/{iconfont.1741051885975.ttf → iconfont.1741079977180.ttf} +0 -0
- /package/lib/{iconfont.1741051885975.woff → iconfont.1741079977180.woff} +0 -0
- /package/lib/{iconfont.1741051885975.woff2 → iconfont.1741079977180.woff2} +0 -0
|
@@ -53,30 +53,28 @@ export default {
|
|
|
53
53
|
},
|
|
54
54
|
created() {
|
|
55
55
|
const $xeTableExportPanel = this;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
79
|
-
}
|
|
56
|
+
const VxeUIModalComponent = VxeUI.getComponent('VxeModal');
|
|
57
|
+
const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
|
|
58
|
+
const VxeUISelectComponent = VxeUI.getComponent('VxeSelect');
|
|
59
|
+
const VxeUIInputComponent = VxeUI.getComponent('VxeInput');
|
|
60
|
+
const VxeUICheckboxComponent = VxeUI.getComponent('VxeCheckbox');
|
|
61
|
+
$xeTableExportPanel.$nextTick(() => {
|
|
62
|
+
if (!VxeUIModalComponent) {
|
|
63
|
+
errLog('vxe.error.reqComp', ['vxe-modal']);
|
|
64
|
+
}
|
|
65
|
+
if (!VxeUIButtonComponent) {
|
|
66
|
+
errLog('vxe.error.reqComp', ['vxe-button']);
|
|
67
|
+
}
|
|
68
|
+
if (!VxeUISelectComponent) {
|
|
69
|
+
errLog('vxe.error.reqComp', ['vxe-select']);
|
|
70
|
+
}
|
|
71
|
+
if (!VxeUIInputComponent) {
|
|
72
|
+
errLog('vxe.error.reqComp', ['vxe-input']);
|
|
73
|
+
}
|
|
74
|
+
if (!VxeUICheckboxComponent) {
|
|
75
|
+
errLog('vxe.error.reqComp', ['vxe-checkbox']);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
80
78
|
},
|
|
81
79
|
render(h) {
|
|
82
80
|
const $xeTable = this.$xeTable;
|
|
@@ -45,22 +45,20 @@ export default {
|
|
|
45
45
|
},
|
|
46
46
|
created() {
|
|
47
47
|
const $xeTableImportPanel = this;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
}
|
|
48
|
+
const VxeUIModalComponent = VxeUI.getComponent('VxeModal');
|
|
49
|
+
const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
|
|
50
|
+
const VxeUISelectComponent = VxeUI.getComponent('VxeSelect');
|
|
51
|
+
$xeTableImportPanel.$nextTick(() => {
|
|
52
|
+
if (!VxeUIModalComponent) {
|
|
53
|
+
errLog('vxe.error.reqComp', ['vxe-modal']);
|
|
54
|
+
}
|
|
55
|
+
if (!VxeUIButtonComponent) {
|
|
56
|
+
errLog('vxe.error.reqComp', ['vxe-button']);
|
|
57
|
+
}
|
|
58
|
+
if (!VxeUISelectComponent) {
|
|
59
|
+
errLog('vxe.error.reqComp', ['vxe-select']);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
64
62
|
},
|
|
65
63
|
render(h) {
|
|
66
64
|
const $xeTable = this.$xeTable;
|
|
@@ -568,10 +568,8 @@ function downloadFile($xetable, opts, content) {
|
|
|
568
568
|
saveLocalFile({ filename, type, content }).then(() => {
|
|
569
569
|
if (opts.message !== false) {
|
|
570
570
|
// 检测弹窗模块
|
|
571
|
-
if (
|
|
572
|
-
|
|
573
|
-
errLog('vxe.error.reqModule', ['Modal']);
|
|
574
|
-
}
|
|
571
|
+
if (!VxeUI.modal) {
|
|
572
|
+
errLog('vxe.error.reqModule', ['Modal']);
|
|
575
573
|
}
|
|
576
574
|
VxeUI.modal.message({ content: getI18n('vxe.table.expSuccess'), status: 'success' });
|
|
577
575
|
}
|
|
@@ -800,10 +798,8 @@ function handleImport($xeTable, content, opts) {
|
|
|
800
798
|
}
|
|
801
799
|
if (opts.message !== false) {
|
|
802
800
|
// 检测弹窗模块
|
|
803
|
-
if (
|
|
804
|
-
|
|
805
|
-
errLog('vxe.error.reqModule', ['Modal']);
|
|
806
|
-
}
|
|
801
|
+
if (!VxeUI.modal) {
|
|
802
|
+
errLog('vxe.error.reqModule', ['Modal']);
|
|
807
803
|
}
|
|
808
804
|
VxeUI.modal.message({ content: getI18n('vxe.table.impSuccess', [rows.length]), status: 'success' });
|
|
809
805
|
}
|
|
@@ -816,10 +812,8 @@ function handleImport($xeTable, content, opts) {
|
|
|
816
812
|
}
|
|
817
813
|
else if (opts.message !== false) {
|
|
818
814
|
// 检测弹窗模块
|
|
819
|
-
if (
|
|
820
|
-
|
|
821
|
-
errLog('vxe.error.reqModule', ['Modal']);
|
|
822
|
-
}
|
|
815
|
+
if (!VxeUI.modal) {
|
|
816
|
+
errLog('vxe.error.reqModule', ['Modal']);
|
|
823
817
|
}
|
|
824
818
|
VxeUI.modal.message({ content: getI18n('vxe.error.impFields'), status: 'error' });
|
|
825
819
|
if (_importReject) {
|
|
@@ -835,10 +829,8 @@ function handleFileImport($xetable, file, opts) {
|
|
|
835
829
|
if (!importMethod && !XEUtils.includes(XEUtils.keys(importOpts._typeMaps), type)) {
|
|
836
830
|
if (opts.message !== false) {
|
|
837
831
|
// 检测弹窗模块
|
|
838
|
-
if (
|
|
839
|
-
|
|
840
|
-
errLog('vxe.error.reqModule', ['Modal']);
|
|
841
|
-
}
|
|
832
|
+
if (!VxeUI.modal) {
|
|
833
|
+
errLog('vxe.error.reqModule', ['Modal']);
|
|
842
834
|
}
|
|
843
835
|
VxeUI.modal.message({ content: getI18n('vxe.error.notType', [type]), status: 'error' });
|
|
844
836
|
}
|
|
@@ -888,9 +880,7 @@ function handleFileImport($xetable, file, opts) {
|
|
|
888
880
|
}
|
|
889
881
|
else {
|
|
890
882
|
// 不支持的浏览器
|
|
891
|
-
|
|
892
|
-
errLog('vxe.error.notExp');
|
|
893
|
-
}
|
|
883
|
+
errLog('vxe.error.notExp');
|
|
894
884
|
_importResolve({ status: true });
|
|
895
885
|
}
|
|
896
886
|
});
|
|
@@ -950,10 +940,8 @@ export function readLocalFile(options = {}) {
|
|
|
950
940
|
else {
|
|
951
941
|
if (options.message !== false) {
|
|
952
942
|
// 检测弹窗模块
|
|
953
|
-
if (
|
|
954
|
-
|
|
955
|
-
errLog('vxe.error.reqModule', ['Modal']);
|
|
956
|
-
}
|
|
943
|
+
if (!VxeUI.modal) {
|
|
944
|
+
errLog('vxe.error.reqModule', ['Modal']);
|
|
957
945
|
}
|
|
958
946
|
VxeUI.modal.message({ content: getI18n('vxe.error.notType', [errType]), status: 'error' });
|
|
959
947
|
}
|
|
@@ -1618,20 +1606,16 @@ export default {
|
|
|
1618
1606
|
_closeExport: handleCloseExport,
|
|
1619
1607
|
_openExport(options) {
|
|
1620
1608
|
const { exportOpts } = this;
|
|
1621
|
-
if (
|
|
1622
|
-
|
|
1623
|
-
errLog('vxe.error.reqProp', ['export-config']);
|
|
1624
|
-
}
|
|
1609
|
+
if (!this.exportConfig) {
|
|
1610
|
+
errLog('vxe.error.reqProp', ['export-config']);
|
|
1625
1611
|
}
|
|
1626
1612
|
return handleExportAndPrint(this, Object.assign({}, exportOpts, options));
|
|
1627
1613
|
},
|
|
1628
1614
|
_closePrint: handleCloseExport,
|
|
1629
1615
|
_openPrint(options) {
|
|
1630
1616
|
const { printOpts } = this;
|
|
1631
|
-
if (
|
|
1632
|
-
|
|
1633
|
-
errLog('vxe.error.reqProp', ['print-config']);
|
|
1634
|
-
}
|
|
1617
|
+
if (!this.printConfig) {
|
|
1618
|
+
errLog('vxe.error.reqProp', ['print-config']);
|
|
1635
1619
|
}
|
|
1636
1620
|
return handleExportAndPrint(this, Object.assign({}, printOpts, options), true);
|
|
1637
1621
|
}
|
package/es/table/render/index.js
CHANGED
|
@@ -151,10 +151,8 @@ function getComponentOns(renderOpts, params, eFns) {
|
|
|
151
151
|
const ons = {};
|
|
152
152
|
XEUtils.objectEach(events, (func, key) => {
|
|
153
153
|
ons[getOnName(key)] = function (...args) {
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
errLog('vxe.error.errFunc', [func]);
|
|
157
|
-
}
|
|
154
|
+
if (!XEUtils.isFunction(func)) {
|
|
155
|
+
errLog('vxe.error.errFunc', [func]);
|
|
158
156
|
}
|
|
159
157
|
func(params, ...args);
|
|
160
158
|
};
|
|
@@ -12,41 +12,39 @@ export class ColumnInfo {
|
|
|
12
12
|
const formatter = _vm.formatter;
|
|
13
13
|
const visible = XEUtils.isBoolean(_vm.visible) ? _vm.visible : true;
|
|
14
14
|
const tableProps = $xetable;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
|
|
16
|
+
if (_vm.type && types.indexOf(_vm.type) === -1) {
|
|
17
|
+
warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
|
|
18
|
+
}
|
|
19
|
+
if (XEUtils.isBoolean(_vm.cellRender) || (_vm.cellRender && !XEUtils.isObject(_vm.cellRender))) {
|
|
20
|
+
warnLog('vxe.error.errProp', [`column.cell-render=${_vm.cellRender}`, 'column.cell-render={}']);
|
|
21
|
+
}
|
|
22
|
+
if (XEUtils.isBoolean(_vm.editRender) || (_vm.editRender && !XEUtils.isObject(_vm.editRender))) {
|
|
23
|
+
warnLog('vxe.error.errProp', [`column.edit-render=${_vm.editRender}`, 'column.edit-render={}']);
|
|
24
|
+
}
|
|
25
|
+
if (_vm.type === 'expand') {
|
|
26
|
+
const { treeConfig } = tableProps;
|
|
27
|
+
if (treeConfig && ($xetable.treeOpts.showLine || $xetable.treeOpts.line)) {
|
|
28
|
+
errLog('vxe.error.errConflicts', ['tree-config.line', 'column.type=expand']);
|
|
25
29
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
}
|
|
31
|
+
if (_vm.remoteSort) {
|
|
32
|
+
warnLog('vxe.error.delProp', ['column.remote-sort', 'sort-config.remote']);
|
|
33
|
+
}
|
|
34
|
+
if (_vm.sortMethod) {
|
|
35
|
+
warnLog('vxe.error.delProp', ['column.sort-method', 'sort-config.sortMethod']);
|
|
36
|
+
}
|
|
37
|
+
if (formatter) {
|
|
38
|
+
if (XEUtils.isString(formatter)) {
|
|
39
|
+
const gFormatOpts = formats.get(formatter) || XEUtils[formatter];
|
|
40
|
+
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
|
|
41
|
+
errLog('vxe.error.notFormats', [formatter]);
|
|
30
42
|
}
|
|
31
43
|
}
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
warnLog('vxe.error.delProp', ['column.sort-method', 'sort-config.sortMethod']);
|
|
37
|
-
}
|
|
38
|
-
if (formatter) {
|
|
39
|
-
if (XEUtils.isString(formatter)) {
|
|
40
|
-
const gFormatOpts = formats.get(formatter) || XEUtils[formatter];
|
|
41
|
-
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
|
|
42
|
-
errLog('vxe.error.notFormats', [formatter]);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else if (XEUtils.isArray(formatter)) {
|
|
46
|
-
const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]];
|
|
47
|
-
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
|
|
48
|
-
errLog('vxe.error.notFormats', [formatter[0]]);
|
|
49
|
-
}
|
|
44
|
+
else if (XEUtils.isArray(formatter)) {
|
|
45
|
+
const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]];
|
|
46
|
+
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
|
|
47
|
+
errLog('vxe.error.notFormats', [formatter[0]]);
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
50
|
}
|
package/es/table/src/methods.js
CHANGED
|
@@ -285,14 +285,12 @@ function cacheColumnMap($xeTable) {
|
|
|
285
285
|
if ((expandColumn && expandOpts.mode !== 'fixed') && mouseOpts.area) {
|
|
286
286
|
errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
|
|
287
287
|
}
|
|
288
|
-
if (
|
|
289
|
-
if (
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
|
|
295
|
-
}
|
|
288
|
+
if (htmlColumn) {
|
|
289
|
+
if (!columnOpts.useKey) {
|
|
290
|
+
errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
|
|
291
|
+
}
|
|
292
|
+
if (!rowOpts.useKey) {
|
|
293
|
+
errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
|
|
296
294
|
}
|
|
297
295
|
}
|
|
298
296
|
reactData.isGroup = isGroup;
|
|
@@ -2370,28 +2368,26 @@ const Methods = {
|
|
|
2370
2368
|
if (treeConfig) {
|
|
2371
2369
|
// 树结构自动转换
|
|
2372
2370
|
if (treeOpts.transform) {
|
|
2373
|
-
if (
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
errLog('vxe.error.reqProp', ['table.tree-config.parentField']);
|
|
2379
|
-
}
|
|
2380
|
-
if (!childrenField) {
|
|
2381
|
-
errLog('vxe.error.reqProp', ['tree-config.childrenField']);
|
|
2382
|
-
}
|
|
2383
|
-
if (!treeOpts.mapChildrenField) {
|
|
2384
|
-
errLog('vxe.error.reqProp', ['tree-config.mapChildrenField']);
|
|
2385
|
-
}
|
|
2386
|
-
if (childrenField === treeOpts.mapChildrenField) {
|
|
2387
|
-
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
|
|
2388
|
-
}
|
|
2389
|
-
// fullData.forEach(row => {
|
|
2390
|
-
// if (row[childrenField] && row[childrenField].length) {
|
|
2391
|
-
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${childrenField}`])
|
|
2392
|
-
// }
|
|
2393
|
-
// })
|
|
2371
|
+
if (!treeOpts.rowField) {
|
|
2372
|
+
errLog('vxe.error.reqProp', ['table.tree-config.rowField']);
|
|
2373
|
+
}
|
|
2374
|
+
if (!treeOpts.parentField) {
|
|
2375
|
+
errLog('vxe.error.reqProp', ['table.tree-config.parentField']);
|
|
2394
2376
|
}
|
|
2377
|
+
if (!childrenField) {
|
|
2378
|
+
errLog('vxe.error.reqProp', ['tree-config.childrenField']);
|
|
2379
|
+
}
|
|
2380
|
+
if (!treeOpts.mapChildrenField) {
|
|
2381
|
+
errLog('vxe.error.reqProp', ['tree-config.mapChildrenField']);
|
|
2382
|
+
}
|
|
2383
|
+
if (childrenField === treeOpts.mapChildrenField) {
|
|
2384
|
+
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
|
|
2385
|
+
}
|
|
2386
|
+
// fullData.forEach(row => {
|
|
2387
|
+
// if (row[childrenField] && row[childrenField].length) {
|
|
2388
|
+
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${childrenField}`])
|
|
2389
|
+
// }
|
|
2390
|
+
// })
|
|
2395
2391
|
treeData = XEUtils.toArrayTree(fullData, {
|
|
2396
2392
|
key: treeOpts.rowField,
|
|
2397
2393
|
parentKey: treeOpts.parentField,
|
|
@@ -2456,16 +2452,14 @@ const Methods = {
|
|
|
2456
2452
|
// }
|
|
2457
2453
|
// }
|
|
2458
2454
|
// }
|
|
2459
|
-
if (
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
warnLog('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2468
|
-
}
|
|
2455
|
+
if (!(this.height || this.maxHeight)) {
|
|
2456
|
+
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
2457
|
+
}
|
|
2458
|
+
// if (!this.showOverflow) {
|
|
2459
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2460
|
+
// }
|
|
2461
|
+
if (this.spanMethod) {
|
|
2462
|
+
warnLog('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2469
2463
|
}
|
|
2470
2464
|
}
|
|
2471
2465
|
handleReserveStatus($xeTable);
|
|
@@ -2610,16 +2604,18 @@ const Methods = {
|
|
|
2610
2604
|
cacheRowMap() {
|
|
2611
2605
|
const $xeTable = this;
|
|
2612
2606
|
const props = $xeTable;
|
|
2607
|
+
const reactData = $xeTable;
|
|
2613
2608
|
const internalData = $xeTable;
|
|
2614
2609
|
const { treeConfig } = props;
|
|
2615
|
-
const
|
|
2610
|
+
const { treeExpandedMaps } = reactData;
|
|
2616
2611
|
const { fullAllDataRowIdData, tableFullData, tableFullTreeData } = internalData;
|
|
2612
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
2617
2613
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2618
2614
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
2619
2615
|
const rowkey = getRowkey($xeTable);
|
|
2620
|
-
const
|
|
2621
|
-
const fullAllDataRowIdMaps = {};
|
|
2616
|
+
const fullAllDataRowIdMaps = Object.assign({}, fullAllDataRowIdData); // 存在已删除数据
|
|
2622
2617
|
const fullDataRowIdMaps = {};
|
|
2618
|
+
const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
|
|
2623
2619
|
const handleRow = (row, index, items, path, parentRow, nodes) => {
|
|
2624
2620
|
let rowid = getRowid($xeTable, row);
|
|
2625
2621
|
const seq = treeConfig && path ? toTreePathSeq(path) : index + 1;
|
|
@@ -2628,13 +2624,23 @@ const Methods = {
|
|
|
2628
2624
|
rowid = getRowUniqueId();
|
|
2629
2625
|
XEUtils.set(row, rowkey, rowid);
|
|
2630
2626
|
}
|
|
2631
|
-
if (
|
|
2632
|
-
|
|
2627
|
+
if (treeConfig && treeOpts.lazy) {
|
|
2628
|
+
const treeExpRest = treeExpandedMaps[rowid];
|
|
2629
|
+
if (row[hasChildField] && XEUtils.isUndefined(row[childrenField])) {
|
|
2630
|
+
row[childrenField] = null;
|
|
2631
|
+
}
|
|
2632
|
+
if (treeExpRest) {
|
|
2633
|
+
if (!row[childrenField] || !row[childrenField].length) {
|
|
2634
|
+
delete treeTempExpandedMaps[rowid];
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2633
2637
|
}
|
|
2634
2638
|
let rowRest = fullAllDataRowIdData[rowid];
|
|
2635
2639
|
if (!rowRest) {
|
|
2636
2640
|
rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
2637
2641
|
}
|
|
2642
|
+
rowRest.treeLoaded = false;
|
|
2643
|
+
rowRest.expandLoaded = false;
|
|
2638
2644
|
rowRest.row = row;
|
|
2639
2645
|
rowRest.items = items;
|
|
2640
2646
|
rowRest.parent = parentRow;
|
|
@@ -2643,14 +2649,15 @@ const Methods = {
|
|
|
2643
2649
|
fullDataRowIdMaps[rowid] = rowRest;
|
|
2644
2650
|
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
2645
2651
|
};
|
|
2646
|
-
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
2647
|
-
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
2648
2652
|
if (treeConfig) {
|
|
2649
2653
|
XEUtils.eachTree(tableFullTreeData, handleRow, { children: childrenField });
|
|
2650
2654
|
}
|
|
2651
2655
|
else {
|
|
2652
2656
|
tableFullData.forEach(handleRow);
|
|
2653
2657
|
}
|
|
2658
|
+
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
2659
|
+
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
2660
|
+
reactData.treeExpandedMaps = treeTempExpandedMaps;
|
|
2654
2661
|
},
|
|
2655
2662
|
cacheSourceMap(fullData) {
|
|
2656
2663
|
let { treeConfig, treeOpts, sourceDataRowIdData } = this;
|
|
@@ -2962,23 +2969,6 @@ const Methods = {
|
|
|
2962
2969
|
}
|
|
2963
2970
|
return this.createData(records).then((rows) => isArr ? rows : rows[0]);
|
|
2964
2971
|
},
|
|
2965
|
-
// toOriginalRecords (rows: any[]) {
|
|
2966
|
-
// const { treeConfig } = props
|
|
2967
|
-
// const treeOpts = computeTreeOpts.value
|
|
2968
|
-
// const { transform, mapChildrenField } = treeOpts
|
|
2969
|
-
// const rowkey = getRowkey($xeTable)
|
|
2970
|
-
// if (treeConfig) {
|
|
2971
|
-
// if (transform) {
|
|
2972
|
-
// return []
|
|
2973
|
-
// }
|
|
2974
|
-
// return []
|
|
2975
|
-
// }
|
|
2976
|
-
// return rows.map(item => {
|
|
2977
|
-
// const obj = Object.assign({}, item)
|
|
2978
|
-
// delete obj.rowkey
|
|
2979
|
-
// return obj
|
|
2980
|
-
// })
|
|
2981
|
-
// },
|
|
2982
2972
|
/**
|
|
2983
2973
|
* 还原数据
|
|
2984
2974
|
* 如果不传任何参数,则还原整个表格
|
|
@@ -2987,12 +2977,19 @@ const Methods = {
|
|
|
2987
2977
|
* 如果还额外传了 field 则还原指定的单元格数据
|
|
2988
2978
|
*/
|
|
2989
2979
|
revertData(rows, field) {
|
|
2990
|
-
const
|
|
2980
|
+
const $xeTable = this;
|
|
2981
|
+
const props = $xeTable;
|
|
2982
|
+
const reactData = $xeTable;
|
|
2983
|
+
const internalData = $xeTable;
|
|
2984
|
+
const { keepSource, treeConfig } = props;
|
|
2985
|
+
const { fullAllDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData;
|
|
2986
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
2987
|
+
const { transform } = treeOpts;
|
|
2991
2988
|
if (!keepSource) {
|
|
2992
2989
|
if (process.env.NODE_ENV === 'development') {
|
|
2993
2990
|
warnLog('vxe.error.reqProp', ['keep-source']);
|
|
2994
2991
|
}
|
|
2995
|
-
return
|
|
2992
|
+
return $xeTable.$nextTick();
|
|
2996
2993
|
}
|
|
2997
2994
|
let targetRows = rows;
|
|
2998
2995
|
if (rows) {
|
|
@@ -3001,16 +2998,14 @@ const Methods = {
|
|
|
3001
2998
|
}
|
|
3002
2999
|
}
|
|
3003
3000
|
else {
|
|
3004
|
-
targetRows = XEUtils.toArray(
|
|
3001
|
+
targetRows = XEUtils.toArray($xeTable.getUpdateRecords());
|
|
3005
3002
|
}
|
|
3003
|
+
let reDelFlag = false;
|
|
3006
3004
|
if (targetRows.length) {
|
|
3007
3005
|
targetRows.forEach((row) => {
|
|
3008
|
-
if (
|
|
3009
|
-
const
|
|
3010
|
-
|
|
3011
|
-
errLog('vxe.error.noTree', ['revertData']);
|
|
3012
|
-
}
|
|
3013
|
-
const oRow = tableSourceData[rowIndex];
|
|
3006
|
+
if (!$xeTable.isInsertByRow(row)) {
|
|
3007
|
+
const rowid = getRowid($xeTable, row);
|
|
3008
|
+
const oRow = sourceDataRowIdData[rowid];
|
|
3014
3009
|
if (oRow && row) {
|
|
3015
3010
|
if (field) {
|
|
3016
3011
|
XEUtils.set(row, field, XEUtils.clone(XEUtils.get(oRow, field), true));
|
|
@@ -3018,14 +3013,38 @@ const Methods = {
|
|
|
3018
3013
|
else {
|
|
3019
3014
|
XEUtils.destructuring(row, XEUtils.clone(oRow, true));
|
|
3020
3015
|
}
|
|
3016
|
+
if ($xeTable.isRemoveByRow(row)) {
|
|
3017
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3018
|
+
if (rowRest) {
|
|
3019
|
+
const reRow = rowRest.row;
|
|
3020
|
+
tableFullData.unshift(reRow);
|
|
3021
|
+
afterFullData.unshift(reRow);
|
|
3022
|
+
reDelFlag = true;
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3021
3025
|
}
|
|
3022
3026
|
}
|
|
3023
3027
|
});
|
|
3024
3028
|
}
|
|
3025
3029
|
if (rows) {
|
|
3026
|
-
|
|
3030
|
+
if (reDelFlag) {
|
|
3031
|
+
$xeTable.updateFooter();
|
|
3032
|
+
$xeTable.cacheRowMap(false);
|
|
3033
|
+
$xeTable.handleTableData(treeConfig && transform);
|
|
3034
|
+
if (!(treeConfig && transform)) {
|
|
3035
|
+
$xeTable.updateAfterDataIndex();
|
|
3036
|
+
}
|
|
3037
|
+
$xeTable.checkSelectionStatus();
|
|
3038
|
+
if (reactData.scrollYLoad) {
|
|
3039
|
+
$xeTable.updateScrollYSpace();
|
|
3040
|
+
}
|
|
3041
|
+
}
|
|
3042
|
+
return $xeTable.$nextTick().then(() => {
|
|
3043
|
+
$xeTable.updateCellAreas();
|
|
3044
|
+
return $xeTable.recalculate();
|
|
3045
|
+
});
|
|
3027
3046
|
}
|
|
3028
|
-
return
|
|
3047
|
+
return $xeTable.reloadData(tableSourceData);
|
|
3029
3048
|
},
|
|
3030
3049
|
/**
|
|
3031
3050
|
* 清空单元格内容
|
|
@@ -3095,6 +3114,7 @@ const Methods = {
|
|
|
3095
3114
|
},
|
|
3096
3115
|
getCellLabel(row, fieldOrColumn) {
|
|
3097
3116
|
const $xeTable = this;
|
|
3117
|
+
const internalData = $xeTable;
|
|
3098
3118
|
const column = handleFieldOrColumn(this, fieldOrColumn);
|
|
3099
3119
|
if (!column) {
|
|
3100
3120
|
return null;
|
|
@@ -3104,7 +3124,7 @@ const Methods = {
|
|
|
3104
3124
|
let cellLabel = cellValue;
|
|
3105
3125
|
if (formatter) {
|
|
3106
3126
|
let formatData;
|
|
3107
|
-
const { fullAllDataRowIdData } =
|
|
3127
|
+
const { fullAllDataRowIdData } = internalData;
|
|
3108
3128
|
const rowid = getRowid($xeTable, row);
|
|
3109
3129
|
const colid = column.id;
|
|
3110
3130
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
@@ -3144,10 +3164,19 @@ const Methods = {
|
|
|
3144
3164
|
* @param {Row} row 行对象
|
|
3145
3165
|
*/
|
|
3146
3166
|
isInsertByRow(row) {
|
|
3147
|
-
const
|
|
3148
|
-
const
|
|
3167
|
+
const $xeTable = this;
|
|
3168
|
+
const reactData = $xeTable;
|
|
3169
|
+
const { editStore } = reactData;
|
|
3170
|
+
const rowid = getRowid($xeTable, row);
|
|
3149
3171
|
return !!editStore.insertMaps[rowid];
|
|
3150
3172
|
},
|
|
3173
|
+
isRemoveByRow(row) {
|
|
3174
|
+
const $xeTable = this;
|
|
3175
|
+
const reactData = $xeTable;
|
|
3176
|
+
const { editStore } = reactData;
|
|
3177
|
+
const rowid = getRowid($xeTable, row);
|
|
3178
|
+
return !!editStore.removeMaps[rowid];
|
|
3179
|
+
},
|
|
3151
3180
|
/**
|
|
3152
3181
|
* 删除所有新增的临时数据
|
|
3153
3182
|
* @returns
|
|
@@ -8948,23 +8977,21 @@ const Methods = {
|
|
|
8948
8977
|
const funcs = 'setFilter,openFilter,clearFilter,saveFilterPanel,resetFilterPanel,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,insertChild,insertChildAt,insertChildNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
|
|
8949
8978
|
funcs.forEach(name => {
|
|
8950
8979
|
Methods[name] = function (...args) {
|
|
8951
|
-
if (
|
|
8952
|
-
if (
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
errLog('vxe.error.reqModule', ['VxeTableCustomModule']);
|
|
8967
|
-
}
|
|
8980
|
+
if (!this[`_${name}`]) {
|
|
8981
|
+
if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
|
|
8982
|
+
errLog('vxe.error.reqModule', ['VxeTableExportModule']);
|
|
8983
|
+
}
|
|
8984
|
+
else if ('fullValidate,validate'.split(',').includes(name)) {
|
|
8985
|
+
errLog('vxe.error.reqModule', ['VxeTableValidatorModule']);
|
|
8986
|
+
}
|
|
8987
|
+
else if ('setFilter,openFilter,clearFilter,getCheckedFilters'.split(',').includes(name)) {
|
|
8988
|
+
errLog('vxe.error.reqModule', ['VxeTableFilterModule']);
|
|
8989
|
+
}
|
|
8990
|
+
else if ('insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell'.split(',').includes(name)) {
|
|
8991
|
+
errLog('vxe.error.reqModule', ['VxeTableEditModule']);
|
|
8992
|
+
}
|
|
8993
|
+
else if ('openCustom'.split(',').includes(name)) {
|
|
8994
|
+
errLog('vxe.error.reqModule', ['VxeTableCustomModule']);
|
|
8968
8995
|
}
|
|
8969
8996
|
}
|
|
8970
8997
|
return this[`_${name}`] ? this[`_${name}`](...args) : null;
|