vxe-table 3.13.17 → 3.13.18
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 +42 -72
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +25 -27
- package/es/table/module/edit/mixin.js +3 -5
- 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 +113 -68
- 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 +42 -72
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +324 -336
- 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/edit/mixin.js +3 -5
- package/lib/table/module/edit/mixin.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 +121 -65
- 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 +42 -72
- package/packages/table/module/custom/panel.ts +25 -27
- package/packages/table/module/edit/mixin.ts +3 -5
- 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 +115 -66
- 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.1741051533862.ttf → iconfont.1741140503645.ttf} +0 -0
- /package/es/{iconfont.1741051533862.woff → iconfont.1741140503645.woff} +0 -0
- /package/es/{iconfont.1741051533862.woff2 → iconfont.1741140503645.woff2} +0 -0
- /package/lib/{iconfont.1741051533862.ttf → iconfont.1741140503645.ttf} +0 -0
- /package/lib/{iconfont.1741051533862.woff → iconfont.1741140503645.woff} +0 -0
- /package/lib/{iconfont.1741051533862.woff2 → iconfont.1741140503645.woff2} +0 -0
|
@@ -157,11 +157,9 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
|
|
|
157
157
|
const parentLevel = parentRest ? parentRest.level : 0;
|
|
158
158
|
newRecords.forEach((item, i) => {
|
|
159
159
|
const rowid = getRowid($xeTable, item);
|
|
160
|
-
if (
|
|
161
|
-
if (item[treeOpts.parentField]) {
|
|
162
|
-
|
|
163
|
-
errLog('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`]);
|
|
164
|
-
}
|
|
160
|
+
if (item[treeOpts.parentField]) {
|
|
161
|
+
if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
|
|
162
|
+
errLog('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`]);
|
|
165
163
|
}
|
|
166
164
|
}
|
|
167
165
|
if (parentRow) {
|
|
@@ -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
|
@@ -2295,28 +2295,26 @@ const Methods = {
|
|
|
2295
2295
|
if (treeConfig) {
|
|
2296
2296
|
// 树结构自动转换
|
|
2297
2297
|
if (treeOpts.transform) {
|
|
2298
|
-
if (
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
errLog('vxe.error.reqProp', ['tree-config.mapChildrenField']);
|
|
2310
|
-
}
|
|
2311
|
-
if (childrenField === treeOpts.mapChildrenField) {
|
|
2312
|
-
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
|
|
2313
|
-
}
|
|
2314
|
-
// fullData.forEach(row => {
|
|
2315
|
-
// if (row[childrenField] && row[childrenField].length) {
|
|
2316
|
-
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${childrenField}`])
|
|
2317
|
-
// }
|
|
2318
|
-
// })
|
|
2298
|
+
if (!treeOpts.rowField) {
|
|
2299
|
+
errLog('vxe.error.reqProp', ['table.tree-config.rowField']);
|
|
2300
|
+
}
|
|
2301
|
+
if (!treeOpts.parentField) {
|
|
2302
|
+
errLog('vxe.error.reqProp', ['table.tree-config.parentField']);
|
|
2303
|
+
}
|
|
2304
|
+
if (!childrenField) {
|
|
2305
|
+
errLog('vxe.error.reqProp', ['tree-config.childrenField']);
|
|
2306
|
+
}
|
|
2307
|
+
if (!treeOpts.mapChildrenField) {
|
|
2308
|
+
errLog('vxe.error.reqProp', ['tree-config.mapChildrenField']);
|
|
2319
2309
|
}
|
|
2310
|
+
if (childrenField === treeOpts.mapChildrenField) {
|
|
2311
|
+
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField']);
|
|
2312
|
+
}
|
|
2313
|
+
// fullData.forEach(row => {
|
|
2314
|
+
// if (row[childrenField] && row[childrenField].length) {
|
|
2315
|
+
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${childrenField}`])
|
|
2316
|
+
// }
|
|
2317
|
+
// })
|
|
2320
2318
|
treeData = XEUtils.toArrayTree(fullData, {
|
|
2321
2319
|
key: treeOpts.rowField,
|
|
2322
2320
|
parentKey: treeOpts.parentField,
|
|
@@ -2381,16 +2379,14 @@ const Methods = {
|
|
|
2381
2379
|
// }
|
|
2382
2380
|
// }
|
|
2383
2381
|
// }
|
|
2384
|
-
if (
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
warnLog('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2393
|
-
}
|
|
2382
|
+
if (!(this.height || this.maxHeight)) {
|
|
2383
|
+
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
2384
|
+
}
|
|
2385
|
+
// if (!this.showOverflow) {
|
|
2386
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2387
|
+
// }
|
|
2388
|
+
if (this.spanMethod) {
|
|
2389
|
+
warnLog('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2394
2390
|
}
|
|
2395
2391
|
}
|
|
2396
2392
|
handleReserveStatus($xeTable);
|
|
@@ -2535,16 +2531,18 @@ const Methods = {
|
|
|
2535
2531
|
cacheRowMap() {
|
|
2536
2532
|
const $xeTable = this;
|
|
2537
2533
|
const props = $xeTable;
|
|
2534
|
+
const reactData = $xeTable;
|
|
2538
2535
|
const internalData = $xeTable;
|
|
2539
2536
|
const { treeConfig } = props;
|
|
2540
|
-
const
|
|
2537
|
+
const { treeExpandedMaps } = reactData;
|
|
2541
2538
|
const { fullAllDataRowIdData, tableFullData, tableFullTreeData } = internalData;
|
|
2539
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
2542
2540
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2543
2541
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
2544
2542
|
const rowkey = getRowkey($xeTable);
|
|
2545
|
-
const
|
|
2546
|
-
const fullAllDataRowIdMaps = {};
|
|
2543
|
+
const fullAllDataRowIdMaps = Object.assign({}, fullAllDataRowIdData); // 存在已删除数据
|
|
2547
2544
|
const fullDataRowIdMaps = {};
|
|
2545
|
+
const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
|
|
2548
2546
|
const handleRow = (row, index, items, path, parentRow, nodes) => {
|
|
2549
2547
|
let rowid = getRowid($xeTable, row);
|
|
2550
2548
|
const seq = treeConfig && path ? toTreePathSeq(path) : index + 1;
|
|
@@ -2553,13 +2551,23 @@ const Methods = {
|
|
|
2553
2551
|
rowid = getRowUniqueId();
|
|
2554
2552
|
XEUtils.set(row, rowkey, rowid);
|
|
2555
2553
|
}
|
|
2556
|
-
if (
|
|
2557
|
-
|
|
2554
|
+
if (treeConfig && treeOpts.lazy) {
|
|
2555
|
+
const treeExpRest = treeExpandedMaps[rowid];
|
|
2556
|
+
if (row[hasChildField] && XEUtils.isUndefined(row[childrenField])) {
|
|
2557
|
+
row[childrenField] = null;
|
|
2558
|
+
}
|
|
2559
|
+
if (treeExpRest) {
|
|
2560
|
+
if (!row[childrenField] || !row[childrenField].length) {
|
|
2561
|
+
delete treeTempExpandedMaps[rowid];
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2558
2564
|
}
|
|
2559
2565
|
let rowRest = fullAllDataRowIdData[rowid];
|
|
2560
2566
|
if (!rowRest) {
|
|
2561
2567
|
rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
2562
2568
|
}
|
|
2569
|
+
rowRest.treeLoaded = false;
|
|
2570
|
+
rowRest.expandLoaded = false;
|
|
2563
2571
|
rowRest.row = row;
|
|
2564
2572
|
rowRest.items = items;
|
|
2565
2573
|
rowRest.parent = parentRow;
|
|
@@ -2568,14 +2576,15 @@ const Methods = {
|
|
|
2568
2576
|
fullDataRowIdMaps[rowid] = rowRest;
|
|
2569
2577
|
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
2570
2578
|
};
|
|
2571
|
-
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
2572
|
-
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
2573
2579
|
if (treeConfig) {
|
|
2574
2580
|
XEUtils.eachTree(tableFullTreeData, handleRow, { children: childrenField });
|
|
2575
2581
|
}
|
|
2576
2582
|
else {
|
|
2577
2583
|
tableFullData.forEach(handleRow);
|
|
2578
2584
|
}
|
|
2585
|
+
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
2586
|
+
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
2587
|
+
reactData.treeExpandedMaps = treeTempExpandedMaps;
|
|
2579
2588
|
},
|
|
2580
2589
|
cacheSourceMap(fullData) {
|
|
2581
2590
|
let { treeConfig, treeOpts, sourceDataRowIdData } = this;
|
|
@@ -2912,12 +2921,19 @@ const Methods = {
|
|
|
2912
2921
|
* 如果还额外传了 field 则还原指定的单元格数据
|
|
2913
2922
|
*/
|
|
2914
2923
|
revertData(rows, field) {
|
|
2915
|
-
const
|
|
2924
|
+
const $xeTable = this;
|
|
2925
|
+
const props = $xeTable;
|
|
2926
|
+
const reactData = $xeTable;
|
|
2927
|
+
const internalData = $xeTable;
|
|
2928
|
+
const { keepSource, treeConfig } = props;
|
|
2929
|
+
const { fullAllDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData;
|
|
2930
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
2931
|
+
const { transform } = treeOpts;
|
|
2916
2932
|
if (!keepSource) {
|
|
2917
2933
|
if (process.env.NODE_ENV === 'development') {
|
|
2918
2934
|
warnLog('vxe.error.reqProp', ['keep-source']);
|
|
2919
2935
|
}
|
|
2920
|
-
return
|
|
2936
|
+
return $xeTable.$nextTick();
|
|
2921
2937
|
}
|
|
2922
2938
|
let targetRows = rows;
|
|
2923
2939
|
if (rows) {
|
|
@@ -2926,16 +2942,14 @@ const Methods = {
|
|
|
2926
2942
|
}
|
|
2927
2943
|
}
|
|
2928
2944
|
else {
|
|
2929
|
-
targetRows = XEUtils.toArray(
|
|
2945
|
+
targetRows = XEUtils.toArray($xeTable.getUpdateRecords());
|
|
2930
2946
|
}
|
|
2947
|
+
let reDelFlag = false;
|
|
2931
2948
|
if (targetRows.length) {
|
|
2932
2949
|
targetRows.forEach((row) => {
|
|
2933
|
-
if (
|
|
2934
|
-
const
|
|
2935
|
-
|
|
2936
|
-
errLog('vxe.error.noTree', ['revertData']);
|
|
2937
|
-
}
|
|
2938
|
-
const oRow = tableSourceData[rowIndex];
|
|
2950
|
+
if (!$xeTable.isInsertByRow(row)) {
|
|
2951
|
+
const rowid = getRowid($xeTable, row);
|
|
2952
|
+
const oRow = sourceDataRowIdData[rowid];
|
|
2939
2953
|
if (oRow && row) {
|
|
2940
2954
|
if (field) {
|
|
2941
2955
|
XEUtils.set(row, field, XEUtils.clone(XEUtils.get(oRow, field), true));
|
|
@@ -2943,14 +2957,38 @@ const Methods = {
|
|
|
2943
2957
|
else {
|
|
2944
2958
|
XEUtils.destructuring(row, XEUtils.clone(oRow, true));
|
|
2945
2959
|
}
|
|
2960
|
+
if ($xeTable.isRemoveByRow(row)) {
|
|
2961
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
2962
|
+
if (rowRest) {
|
|
2963
|
+
const reRow = rowRest.row;
|
|
2964
|
+
tableFullData.unshift(reRow);
|
|
2965
|
+
afterFullData.unshift(reRow);
|
|
2966
|
+
reDelFlag = true;
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2946
2969
|
}
|
|
2947
2970
|
}
|
|
2948
2971
|
});
|
|
2949
2972
|
}
|
|
2950
2973
|
if (rows) {
|
|
2951
|
-
|
|
2974
|
+
if (reDelFlag) {
|
|
2975
|
+
$xeTable.updateFooter();
|
|
2976
|
+
$xeTable.cacheRowMap(false);
|
|
2977
|
+
$xeTable.handleTableData(treeConfig && transform);
|
|
2978
|
+
if (!(treeConfig && transform)) {
|
|
2979
|
+
$xeTable.updateAfterDataIndex();
|
|
2980
|
+
}
|
|
2981
|
+
$xeTable.checkSelectionStatus();
|
|
2982
|
+
if (reactData.scrollYLoad) {
|
|
2983
|
+
$xeTable.updateScrollYSpace();
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
return $xeTable.$nextTick().then(() => {
|
|
2987
|
+
$xeTable.updateCellAreas();
|
|
2988
|
+
return $xeTable.recalculate();
|
|
2989
|
+
});
|
|
2952
2990
|
}
|
|
2953
|
-
return
|
|
2991
|
+
return $xeTable.reloadData(tableSourceData);
|
|
2954
2992
|
},
|
|
2955
2993
|
/**
|
|
2956
2994
|
* 清空单元格内容
|
|
@@ -3069,10 +3107,19 @@ const Methods = {
|
|
|
3069
3107
|
* @param {Row} row 行对象
|
|
3070
3108
|
*/
|
|
3071
3109
|
isInsertByRow(row) {
|
|
3072
|
-
const
|
|
3073
|
-
const
|
|
3110
|
+
const $xeTable = this;
|
|
3111
|
+
const reactData = $xeTable;
|
|
3112
|
+
const { editStore } = reactData;
|
|
3113
|
+
const rowid = getRowid($xeTable, row);
|
|
3074
3114
|
return !!editStore.insertMaps[rowid];
|
|
3075
3115
|
},
|
|
3116
|
+
isRemoveByRow(row) {
|
|
3117
|
+
const $xeTable = this;
|
|
3118
|
+
const reactData = $xeTable;
|
|
3119
|
+
const { editStore } = reactData;
|
|
3120
|
+
const rowid = getRowid($xeTable, row);
|
|
3121
|
+
return !!editStore.removeMaps[rowid];
|
|
3122
|
+
},
|
|
3076
3123
|
/**
|
|
3077
3124
|
* 删除所有新增的临时数据
|
|
3078
3125
|
* @returns
|
|
@@ -8829,23 +8876,21 @@ const Methods = {
|
|
|
8829
8876
|
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(',');
|
|
8830
8877
|
funcs.forEach(name => {
|
|
8831
8878
|
Methods[name] = function (...args) {
|
|
8832
|
-
if (
|
|
8833
|
-
if (
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
errLog('vxe.error.reqModule', ['VxeTableCustomModule']);
|
|
8848
|
-
}
|
|
8879
|
+
if (!this[`_${name}`]) {
|
|
8880
|
+
if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
|
|
8881
|
+
errLog('vxe.error.reqModule', ['VxeTableExportModule']);
|
|
8882
|
+
}
|
|
8883
|
+
else if ('fullValidate,validate'.split(',').includes(name)) {
|
|
8884
|
+
errLog('vxe.error.reqModule', ['VxeTableValidatorModule']);
|
|
8885
|
+
}
|
|
8886
|
+
else if ('setFilter,openFilter,clearFilter,getCheckedFilters'.split(',').includes(name)) {
|
|
8887
|
+
errLog('vxe.error.reqModule', ['VxeTableFilterModule']);
|
|
8888
|
+
}
|
|
8889
|
+
else if ('insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell'.split(',').includes(name)) {
|
|
8890
|
+
errLog('vxe.error.reqModule', ['VxeTableEditModule']);
|
|
8891
|
+
}
|
|
8892
|
+
else if ('openCustom'.split(',').includes(name)) {
|
|
8893
|
+
errLog('vxe.error.reqModule', ['VxeTableCustomModule']);
|
|
8849
8894
|
}
|
|
8850
8895
|
}
|
|
8851
8896
|
return this[`_${name}`] ? this[`_${name}`](...args) : null;
|
package/es/table/src/table.js
CHANGED
|
@@ -1492,26 +1492,24 @@ export default {
|
|
|
1492
1492
|
warnLog('vxe.error.reqProp', ['tooltip-config']);
|
|
1493
1493
|
}
|
|
1494
1494
|
}
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
if (
|
|
1501
|
-
|
|
1502
|
-
errLog('vxe.error.reqComp', ['vxe-loading']);
|
|
1503
|
-
}
|
|
1495
|
+
// 使用已安装的组件,如果未安装则不渲染
|
|
1496
|
+
const VxeUILoadingComponent = VxeUI.getComponent('VxeLoading');
|
|
1497
|
+
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
|
|
1498
|
+
$xeTable.$nextTick(() => {
|
|
1499
|
+
if (props.loading) {
|
|
1500
|
+
if (!VxeUILoadingComponent && !this.$scopedSlots.loading) {
|
|
1501
|
+
errLog('vxe.error.reqComp', ['vxe-loading']);
|
|
1504
1502
|
}
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1503
|
+
}
|
|
1504
|
+
if ((props.showOverflow === true || props.showOverflow === 'tooltip') ||
|
|
1505
|
+
(props.showHeaderOverflow === true || props.showHeaderOverflow === 'tooltip') ||
|
|
1506
|
+
(props.showFooterOverflow === true || props.showFooterOverflow === 'tooltip') ||
|
|
1507
|
+
props.tooltipConfig || props.editRules) {
|
|
1508
|
+
if (!VxeUITooltipComponent) {
|
|
1509
|
+
errLog('vxe.error.reqComp', ['vxe-tooltip']);
|
|
1512
1510
|
}
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1511
|
+
}
|
|
1512
|
+
});
|
|
1515
1513
|
if (this.autoResize) {
|
|
1516
1514
|
const resizeObserver = globalResize.create(() => {
|
|
1517
1515
|
if (this.autoResize) {
|