vxe-table 4.23.7 → 4.23.9
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/dist/all.esm.js +5859 -4018
- package/es/colgroup/index.js +1 -1
- package/es/column/index.js +1 -1
- package/es/components.d.ts +3 -0
- package/es/components.js +4 -8
- package/es/grid/index.js +1 -1
- package/es/grid/src/emits.js +1 -15
- package/es/grid/src/grid.js +398 -121
- package/es/grid/src/props.js +1 -1
- package/es/index.esm.js +6 -0
- package/es/index.js +6 -0
- package/es/table/index.js +1 -1
- package/es/table/module/custom/hook.js +50 -43
- package/es/table/module/custom/panel.js +778 -528
- package/es/table/module/edit/hook.js +141 -63
- package/es/table/module/export/export-panel.js +400 -317
- package/es/table/module/export/hook.js +396 -338
- package/es/table/module/export/import-panel.js +153 -124
- package/es/table/module/filter/hook.js +17 -3
- package/es/table/module/filter/panel.js +147 -85
- package/es/table/module/keyboard/hook.js +9 -5
- package/es/table/module/menu/hook.js +1 -1
- package/es/table/module/menu/panel.js +198 -127
- package/es/table/module/validator/hook.js +1 -1
- package/es/table/render/index.js +152 -99
- package/es/table/src/body.js +356 -234
- package/es/table/src/cell.js +427 -270
- package/es/table/src/columnInfo.js +2 -1
- package/es/table/src/footer.js +145 -100
- package/es/table/src/group.js +7 -3
- package/es/table/src/header.js +230 -173
- package/es/table/src/props.js +1 -1
- package/es/table/src/table.js +1504 -1031
- package/es/table/src/util.js +15 -19
- package/es/toolbar/index.js +1 -1
- package/es/toolbar/src/toolbar.js +133 -76
- package/es/ui/index.d.ts +0 -1
- package/es/ui/index.js +1 -2
- package/es/ui/src/dom.js +9 -6
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/utils.d.ts +1 -1
- package/es/v-x-e-table/index.d.ts +0 -1
- package/es/v-x-e-table/index.js +0 -1
- package/lib/colgroup/index.js +5 -5
- package/lib/column/index.js +5 -5
- package/lib/components.js +8 -12
- package/lib/grid/index.js +4 -4
- package/lib/grid/src/emits.js +1 -15
- package/lib/grid/src/grid.js +419 -142
- package/lib/grid/src/props.js +2 -2
- package/lib/index.common.js +6 -0
- package/lib/index.js +6 -0
- package/lib/index.umd.js +5825 -3945
- package/lib/index.umd.min.js +3 -3
- package/lib/table/index.js +5 -5
- package/lib/table/module/custom/hook.js +51 -44
- package/lib/table/module/custom/panel.js +790 -540
- package/lib/table/module/edit/hook.js +142 -64
- package/lib/table/module/export/export-panel.js +406 -323
- package/lib/table/module/export/hook.js +419 -361
- package/lib/table/module/export/import-panel.js +157 -128
- package/lib/table/module/filter/hook.js +18 -4
- package/lib/table/module/filter/panel.js +149 -87
- package/lib/table/module/keyboard/hook.js +10 -6
- package/lib/table/module/menu/hook.js +2 -2
- package/lib/table/module/menu/panel.js +199 -128
- package/lib/table/module/validator/hook.js +2 -2
- package/lib/table/render/index.js +153 -100
- package/lib/table/src/body.js +357 -235
- package/lib/table/src/cell.js +428 -271
- package/lib/table/src/columnInfo.js +3 -2
- package/lib/table/src/footer.js +146 -101
- package/lib/table/src/group.js +7 -3
- package/lib/table/src/header.js +231 -174
- package/lib/table/src/props.js +2 -2
- package/lib/table/src/table.js +1487 -1045
- package/lib/table/src/util.js +15 -19
- package/lib/toolbar/index.js +4 -4
- package/lib/toolbar/src/toolbar.js +135 -78
- package/lib/ui/index.js +1 -3
- package/lib/ui/src/dom.js +9 -6
- package/lib/ui/src/log.js +1 -1
- package/lib/v-x-e-table/index.js +0 -2
- package/package.json +8 -3
- package/packages/colgroup/index.ts +22 -22
- package/packages/column/index.ts +22 -22
- package/packages/components.ts +41 -43
- package/packages/grid/index.ts +18 -18
- package/packages/grid/src/emits.ts +5 -19
- package/packages/grid/src/grid.ts +2229 -1925
- package/packages/grid/src/props.ts +22 -23
- package/packages/index.ts +11 -4
- package/packages/locale/lang/fr-FR.ts +15 -15
- package/packages/locale/lang/it-IT.ts +4 -4
- package/packages/locale/lang/uk-UA.ts +1 -1
- package/packages/locale/lang/uz-UZ.ts +13 -13
- package/packages/locale/lang/zh-CN.ts +907 -907
- package/packages/table/index.ts +26 -26
- package/packages/table/module/custom/hook.ts +510 -503
- package/packages/table/module/custom/panel.ts +2002 -1743
- package/packages/table/module/edit/hook.ts +1224 -1131
- package/packages/table/module/export/export-panel.ts +697 -611
- package/packages/table/module/export/hook.ts +2160 -2059
- package/packages/table/module/export/import-panel.ts +319 -279
- package/packages/table/module/export/util.ts +25 -24
- package/packages/table/module/filter/hook.ts +519 -501
- package/packages/table/module/filter/panel.ts +368 -304
- package/packages/table/module/keyboard/hook.ts +498 -494
- package/packages/table/module/menu/hook.ts +330 -330
- package/packages/table/module/menu/panel.ts +272 -201
- package/packages/table/module/validator/hook.ts +653 -635
- package/packages/table/render/index.ts +1819 -1744
- package/packages/table/src/body.ts +1078 -955
- package/packages/table/src/cell.ts +1524 -1359
- package/packages/table/src/column.ts +192 -192
- package/packages/table/src/columnInfo.ts +232 -232
- package/packages/table/src/emits.ts +134 -134
- package/packages/table/src/footer.ts +425 -380
- package/packages/table/src/group.ts +67 -63
- package/packages/table/src/header.ts +642 -581
- package/packages/table/src/props.ts +336 -336
- package/packages/table/src/store.ts +14 -14
- package/packages/table/src/table.ts +16011 -15454
- package/packages/table/src/use/cell-view.ts +41 -44
- package/packages/table/src/use/index.ts +1 -1
- package/packages/table/src/util.ts +1206 -1216
- package/packages/toolbar/index.ts +18 -18
- package/packages/toolbar/src/toolbar.ts +768 -706
- package/packages/ui/index.ts +519 -521
- package/packages/ui/src/anime.ts +51 -52
- package/packages/ui/src/comp.ts +3 -3
- package/packages/ui/src/dom.ts +466 -463
- package/packages/ui/src/log.ts +19 -19
- package/packages/ui/src/utils.ts +66 -66
- package/packages/ui/src/vn.ts +55 -55
- package/packages/v-x-e-table/index.d.ts +3 -4
- package/packages/v-x-e-table/index.ts +3 -4
- package/types/all.d.ts +76 -76
- package/types/index.d.ts +4 -4
- /package/dist/{iconfont.1792979665397.ttf → iconfont.1793009263429.ttf} +0 -0
- /package/dist/{iconfont.1792979665397.woff → iconfont.1793009263429.woff} +0 -0
- /package/dist/{iconfont.1792979665397.woff2 → iconfont.1793009263429.woff2} +0 -0
- /package/es/{iconfont.1792979665397.ttf → iconfont.1793009263429.ttf} +0 -0
- /package/es/{iconfont.1792979665397.woff → iconfont.1793009263429.woff} +0 -0
- /package/es/{iconfont.1792979665397.woff2 → iconfont.1793009263429.woff2} +0 -0
- /package/lib/{iconfont.1792979665397.ttf → iconfont.1793009263429.ttf} +0 -0
- /package/lib/{iconfont.1792979665397.woff → iconfont.1793009263429.woff} +0 -0
- /package/lib/{iconfont.1792979665397.woff2 → iconfont.1793009263429.woff2} +0 -0
|
@@ -23,14 +23,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
));
|
|
24
24
|
var import_vue = require("vue");
|
|
25
25
|
var import_xe_utils = __toESM(require("xe-utils"));
|
|
26
|
-
var
|
|
26
|
+
var import_core = require("@vxe-ui/core");
|
|
27
27
|
var import_util = require("../../src/util");
|
|
28
28
|
var import_utils = require("../../../ui/src/utils");
|
|
29
29
|
var import_dom = require("../../../ui/src/dom");
|
|
30
30
|
var import_util2 = require("./util");
|
|
31
31
|
var import_log = require("../../../ui/src/log");
|
|
32
32
|
const { warnLog, errLog } = (0, import_log.createComponentLog)("table");
|
|
33
|
-
const { getI18n, hooks, renderer } =
|
|
33
|
+
const { getI18n, hooks, renderer } = import_core.VxeUI;
|
|
34
34
|
let htmlCellElem;
|
|
35
35
|
const csvBOM = "\uFEFF";
|
|
36
36
|
const enterSymbol = "\r\n";
|
|
@@ -263,13 +263,17 @@ function parseXML(tableConf, content) {
|
|
|
263
263
|
return { fields, rows };
|
|
264
264
|
}
|
|
265
265
|
function clearColumnConvert(columns) {
|
|
266
|
-
import_xe_utils.default.eachTree(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
266
|
+
import_xe_utils.default.eachTree(
|
|
267
|
+
columns,
|
|
268
|
+
(column) => {
|
|
269
|
+
delete column._level;
|
|
270
|
+
delete column._colSpan;
|
|
271
|
+
delete column._rowSpan;
|
|
272
|
+
delete column._children;
|
|
273
|
+
delete column.childNodes;
|
|
274
|
+
},
|
|
275
|
+
{ children: "children" }
|
|
276
|
+
);
|
|
273
277
|
}
|
|
274
278
|
const tableExportMethodKeys = ["exportData", "importByFile", "importData", "saveFile", "readFile", "print", "getPrintHtml", "openImport", "closeImport", "openExport", "closeExport", "openPrint", "closePrint"];
|
|
275
279
|
hooks.add("tableExportModule", {
|
|
@@ -325,136 +329,140 @@ hooks.add("tableExportModule", {
|
|
|
325
329
|
const rest = [];
|
|
326
330
|
const expandMaps = {};
|
|
327
331
|
const useMaps = {};
|
|
328
|
-
import_xe_utils.default.eachTree(
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if (
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
if (!bodyExportMethod) {
|
|
356
|
-
bodyExportMethod = columnOpts.exportMethod;
|
|
357
|
-
}
|
|
358
|
-
if (bodyExportMethod) {
|
|
359
|
-
cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts });
|
|
360
|
-
} else {
|
|
361
|
-
switch (column.type) {
|
|
362
|
-
case "seq": {
|
|
363
|
-
const seqVal = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : ".").join("");
|
|
364
|
-
cellValue = expMode === "all" ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex);
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
367
|
-
case "checkbox": {
|
|
368
|
-
cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
|
|
369
|
-
item2._checkboxLabel = checkboxOpts.labelField ? import_xe_utils.default.get(row, checkboxOpts.labelField) : "";
|
|
370
|
-
item2._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row });
|
|
371
|
-
break;
|
|
372
|
-
}
|
|
373
|
-
case "radio": {
|
|
374
|
-
cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
|
|
375
|
-
item2._radioLabel = radioOpts.labelField ? import_xe_utils.default.get(row, radioOpts.labelField) : "";
|
|
376
|
-
item2._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row });
|
|
377
|
-
break;
|
|
332
|
+
import_xe_utils.default.eachTree(
|
|
333
|
+
datas,
|
|
334
|
+
(item, $rowIndex, items, path, parentItem, nodes) => {
|
|
335
|
+
const row = item._row || item;
|
|
336
|
+
const rowid = handleGetRowId(row);
|
|
337
|
+
if (useMaps[rowid]) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem;
|
|
341
|
+
const pRowid = parentRow ? handleGetRowId(parentRow) : "";
|
|
342
|
+
if (isRowGroupAllExpanded || !parentRow || expandMaps[pRowid] && $xeTable.isRowExpandByRow(parentRow)) {
|
|
343
|
+
const hasRowChild = mapChildrenField && row[mapChildrenField] && row[mapChildrenField].length;
|
|
344
|
+
const item2 = {
|
|
345
|
+
_row: row,
|
|
346
|
+
_level: nodes.length - 1,
|
|
347
|
+
_hasChild: hasRowChild,
|
|
348
|
+
_expand: hasRowChild && $xeTable.isRowExpandByRow(row)
|
|
349
|
+
};
|
|
350
|
+
columns.forEach((column, $columnIndex) => {
|
|
351
|
+
const { field, editRender, cellRender, aggFunc, rowGroupNode } = column;
|
|
352
|
+
let cellValue = "";
|
|
353
|
+
const renderOpts = editRender || cellRender;
|
|
354
|
+
let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
|
|
355
|
+
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
|
356
|
+
const compConf = rendererOpts[renderOpts.name] || renderer.get(renderOpts.name);
|
|
357
|
+
if (compConf) {
|
|
358
|
+
bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod;
|
|
378
359
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
cellValue = getI18n("vxe.table.rowGroupContentTotal", [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount]);
|
|
416
|
-
}
|
|
417
|
-
} else if ($xeTable.getPivotTableAggregateCellAggValue) {
|
|
418
|
-
const aggParams = {
|
|
360
|
+
}
|
|
361
|
+
if (!bodyExportMethod) {
|
|
362
|
+
bodyExportMethod = columnOpts.exportMethod;
|
|
363
|
+
}
|
|
364
|
+
if (bodyExportMethod) {
|
|
365
|
+
cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts });
|
|
366
|
+
} else {
|
|
367
|
+
switch (column.type) {
|
|
368
|
+
case "seq": {
|
|
369
|
+
const seqVal = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : ".").join("");
|
|
370
|
+
cellValue = expMode === "all" ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex);
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
case "checkbox": {
|
|
374
|
+
cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
|
|
375
|
+
item2._checkboxLabel = checkboxOpts.labelField ? import_xe_utils.default.get(row, checkboxOpts.labelField) : "";
|
|
376
|
+
item2._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row });
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
case "radio": {
|
|
380
|
+
cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
|
|
381
|
+
item2._radioLabel = radioOpts.labelField ? import_xe_utils.default.get(row, radioOpts.labelField) : "";
|
|
382
|
+
item2._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row });
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
default: {
|
|
386
|
+
if (field && row.isAggregate) {
|
|
387
|
+
const aggRow = row;
|
|
388
|
+
const aggData = aggRow.aggData;
|
|
389
|
+
const currAggData = aggData ? aggData[field] : null;
|
|
390
|
+
const groupField = aggRow.groupField;
|
|
391
|
+
const groupContent = aggRow.groupContent;
|
|
392
|
+
const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
|
|
393
|
+
const childCount = aggRow.childCount;
|
|
394
|
+
const colRest = fullColumnFieldData[groupField] || {};
|
|
395
|
+
const ctParams = {
|
|
419
396
|
$table: $xeTable,
|
|
420
|
-
|
|
421
|
-
column
|
|
397
|
+
groupField,
|
|
398
|
+
groupColumn: colRest ? colRest.column : null,
|
|
399
|
+
column,
|
|
400
|
+
groupValue: groupContent,
|
|
401
|
+
childList,
|
|
402
|
+
childCount,
|
|
403
|
+
aggValue: null,
|
|
404
|
+
/**
|
|
405
|
+
* 已废弃
|
|
406
|
+
* @deprecated
|
|
407
|
+
*/
|
|
408
|
+
children: childList,
|
|
409
|
+
/**
|
|
410
|
+
* 已废弃
|
|
411
|
+
* @deprecated
|
|
412
|
+
*/
|
|
413
|
+
totalValue: childCount
|
|
422
414
|
};
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
415
|
+
if (aggMode === "column" ? field === aggRow.groupField : rowGroupNode) {
|
|
416
|
+
cellValue = groupContent;
|
|
417
|
+
if (contentMethod) {
|
|
418
|
+
cellValue = `${contentMethod(ctParams)}`;
|
|
419
|
+
}
|
|
420
|
+
if (showTotal) {
|
|
421
|
+
cellValue = getI18n("vxe.table.rowGroupContentTotal", [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount]);
|
|
422
|
+
}
|
|
423
|
+
} else if ($xeTable.getPivotTableAggregateCellAggValue) {
|
|
424
|
+
const aggParams = {
|
|
425
|
+
$table: $xeTable,
|
|
426
|
+
row,
|
|
427
|
+
column
|
|
428
|
+
};
|
|
429
|
+
cellValue = $xeTable.getPivotTableAggregateCellAggValue(aggParams);
|
|
430
|
+
} else if (aggFunc === true || countFields && countFields.includes(field)) {
|
|
431
|
+
cellValue = currAggData ? currAggData.value : childCount;
|
|
432
|
+
ctParams.aggValue = cellValue;
|
|
433
|
+
if (formatValuesMethod) {
|
|
434
|
+
cellValue = formatValuesMethod(ctParams);
|
|
435
|
+
}
|
|
429
436
|
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
cellValue = (0, import_util.getCellValue)(row, column);
|
|
433
|
-
} else {
|
|
434
|
-
cellValue = $xeTable.getCellLabel(row, column);
|
|
435
|
-
if (column.type === "html") {
|
|
436
|
-
htmlCellElem.innerHTML = cellValue;
|
|
437
|
-
cellValue = htmlCellElem.innerText.trim();
|
|
437
|
+
} else if (opts.original) {
|
|
438
|
+
cellValue = (0, import_util.getCellValue)(row, column);
|
|
438
439
|
} else {
|
|
439
|
-
|
|
440
|
-
if (
|
|
441
|
-
|
|
440
|
+
cellValue = $xeTable.getCellLabel(row, column);
|
|
441
|
+
if (column.type === "html") {
|
|
442
|
+
htmlCellElem.innerHTML = cellValue;
|
|
443
|
+
cellValue = htmlCellElem.innerText.trim();
|
|
444
|
+
} else {
|
|
445
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
446
|
+
if (cell && !(0, import_dom.hasClass)(cell, "is--progress")) {
|
|
447
|
+
cellValue = cell.innerText.trim();
|
|
448
|
+
}
|
|
442
449
|
}
|
|
443
450
|
}
|
|
451
|
+
break;
|
|
444
452
|
}
|
|
445
|
-
break;
|
|
446
453
|
}
|
|
447
454
|
}
|
|
455
|
+
item2[column.id] = toStringValue(cellValue);
|
|
456
|
+
});
|
|
457
|
+
useMaps[rowid] = true;
|
|
458
|
+
if (pRowid) {
|
|
459
|
+
expandMaps[pRowid] = true;
|
|
448
460
|
}
|
|
449
|
-
item2
|
|
450
|
-
});
|
|
451
|
-
useMaps[rowid] = true;
|
|
452
|
-
if (pRowid) {
|
|
453
|
-
expandMaps[pRowid] = true;
|
|
461
|
+
rest.push(Object.assign(item2, row));
|
|
454
462
|
}
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
-
|
|
463
|
+
},
|
|
464
|
+
{ children: mapChildrenField }
|
|
465
|
+
);
|
|
458
466
|
return rest;
|
|
459
467
|
}
|
|
460
468
|
if (treeConfig) {
|
|
@@ -463,84 +471,88 @@ hooks.add("tableExportModule", {
|
|
|
463
471
|
const rest = [];
|
|
464
472
|
const expandMaps = {};
|
|
465
473
|
const useMaps = {};
|
|
466
|
-
import_xe_utils.default.eachTree(
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
if (
|
|
490
|
-
|
|
474
|
+
import_xe_utils.default.eachTree(
|
|
475
|
+
datas,
|
|
476
|
+
(item, $rowIndex, items, path, parentItem, nodes) => {
|
|
477
|
+
const row = item._row || item;
|
|
478
|
+
const rowid = handleGetRowId(row);
|
|
479
|
+
if (useMaps[rowid]) {
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem;
|
|
483
|
+
const pRowid = parentRow ? handleGetRowId(parentRow) : "";
|
|
484
|
+
if (isTreeAllExpanded || !parentRow || expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)) {
|
|
485
|
+
const hasRowChild = row[childrenField] && row[childrenField].length;
|
|
486
|
+
const item2 = {
|
|
487
|
+
_row: row,
|
|
488
|
+
_level: nodes.length - 1,
|
|
489
|
+
_hasChild: hasRowChild,
|
|
490
|
+
_expand: hasRowChild && $xeTable.isTreeExpandByRow(row)
|
|
491
|
+
};
|
|
492
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
493
|
+
columns.forEach((column, $columnIndex) => {
|
|
494
|
+
let cellValue = "";
|
|
495
|
+
const renderOpts = column.editRender || column.cellRender;
|
|
496
|
+
let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
|
|
497
|
+
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
|
498
|
+
const compConf = rendererOpts[renderOpts.name] || renderer.get(renderOpts.name);
|
|
499
|
+
if (compConf) {
|
|
500
|
+
bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod;
|
|
501
|
+
}
|
|
491
502
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
503
|
+
if (!bodyExportMethod) {
|
|
504
|
+
bodyExportMethod = columnOpts.exportMethod;
|
|
505
|
+
}
|
|
506
|
+
if (bodyExportMethod) {
|
|
507
|
+
cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts });
|
|
508
|
+
} else {
|
|
509
|
+
switch (column.type) {
|
|
510
|
+
case "seq": {
|
|
511
|
+
let seqVal = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : ".").join("");
|
|
512
|
+
if (seqMode === "increasing") {
|
|
513
|
+
seqVal = rowRest ? rowRest._index + 1 : -1;
|
|
514
|
+
}
|
|
515
|
+
cellValue = expMode === "all" ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex);
|
|
516
|
+
break;
|
|
504
517
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
default:
|
|
519
|
-
if (opts.original) {
|
|
520
|
-
cellValue = (0, import_util.getCellValue)(row, column);
|
|
521
|
-
} else {
|
|
522
|
-
cellValue = $xeTable.getCellLabel(row, column);
|
|
523
|
-
if (column.type === "html") {
|
|
524
|
-
htmlCellElem.innerHTML = cellValue;
|
|
525
|
-
cellValue = htmlCellElem.innerText.trim();
|
|
518
|
+
case "checkbox":
|
|
519
|
+
cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
|
|
520
|
+
item2._checkboxLabel = checkboxOpts.labelField ? import_xe_utils.default.get(row, checkboxOpts.labelField) : "";
|
|
521
|
+
item2._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row });
|
|
522
|
+
break;
|
|
523
|
+
case "radio":
|
|
524
|
+
cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
|
|
525
|
+
item2._radioLabel = radioOpts.labelField ? import_xe_utils.default.get(row, radioOpts.labelField) : "";
|
|
526
|
+
item2._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row });
|
|
527
|
+
break;
|
|
528
|
+
default:
|
|
529
|
+
if (opts.original) {
|
|
530
|
+
cellValue = (0, import_util.getCellValue)(row, column);
|
|
526
531
|
} else {
|
|
527
|
-
|
|
528
|
-
if (
|
|
529
|
-
|
|
532
|
+
cellValue = $xeTable.getCellLabel(row, column);
|
|
533
|
+
if (column.type === "html") {
|
|
534
|
+
htmlCellElem.innerHTML = cellValue;
|
|
535
|
+
cellValue = htmlCellElem.innerText.trim();
|
|
536
|
+
} else {
|
|
537
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
538
|
+
if (cell && !(0, import_dom.hasClass)(cell, "is--progress")) {
|
|
539
|
+
cellValue = cell.innerText.trim();
|
|
540
|
+
}
|
|
530
541
|
}
|
|
531
542
|
}
|
|
532
|
-
|
|
543
|
+
}
|
|
533
544
|
}
|
|
545
|
+
item2[column.id] = toStringValue(cellValue);
|
|
546
|
+
});
|
|
547
|
+
useMaps[rowid] = true;
|
|
548
|
+
if (pRowid) {
|
|
549
|
+
expandMaps[pRowid] = true;
|
|
534
550
|
}
|
|
535
|
-
item2
|
|
536
|
-
});
|
|
537
|
-
useMaps[rowid] = true;
|
|
538
|
-
if (pRowid) {
|
|
539
|
-
expandMaps[pRowid] = true;
|
|
551
|
+
rest.push(Object.assign(item2, row));
|
|
540
552
|
}
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
|
|
553
|
+
},
|
|
554
|
+
{ children: childrenField }
|
|
555
|
+
);
|
|
544
556
|
return rest;
|
|
545
557
|
}
|
|
546
558
|
return datas.map((row, $rowIndex) => {
|
|
@@ -713,13 +725,17 @@ hooks.add("tableExportModule", {
|
|
|
713
725
|
}
|
|
714
726
|
let childWidth = 0;
|
|
715
727
|
let countChild = 0;
|
|
716
|
-
import_xe_utils.default.eachTree(
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
728
|
+
import_xe_utils.default.eachTree(
|
|
729
|
+
[column],
|
|
730
|
+
(item) => {
|
|
731
|
+
if (!item.childNodes || !column.childNodes.length) {
|
|
732
|
+
countChild++;
|
|
733
|
+
}
|
|
734
|
+
const ptWidth = printWidthMaps[item.id];
|
|
735
|
+
childWidth += ptWidth || 0;
|
|
736
|
+
},
|
|
737
|
+
{ children: "childNodes" }
|
|
738
|
+
);
|
|
723
739
|
const colWidth = childWidth - countChild;
|
|
724
740
|
colWidthMaps[column.id] = colWidth;
|
|
725
741
|
printWidthMaps[column.id] = import_xe_utils.default.floor(colWidth / tableWidth * 180, 2);
|
|
@@ -763,19 +779,8 @@ hooks.add("tableExportModule", {
|
|
|
763
779
|
return colWidthMaps[column.id] ? "width:" + (0, import_dom.toCssUnit)(colWidthMaps[column.id]) : "";
|
|
764
780
|
};
|
|
765
781
|
const allCls = "check-all";
|
|
766
|
-
const clss = [
|
|
767
|
-
|
|
768
|
-
`border--${toTableBorder(border)}`,
|
|
769
|
-
isPrint ? "is--print" : "",
|
|
770
|
-
isAutoWidth ? "is--auto-width" : "",
|
|
771
|
-
isScaleWidth ? "is--scale-width" : "",
|
|
772
|
-
isDefaultWidth ? "is--default-width" : "",
|
|
773
|
-
isHeader ? "is--header" : ""
|
|
774
|
-
].filter((cls) => cls);
|
|
775
|
-
const tables = [
|
|
776
|
-
`<table class="${clss.join(" ")}" border="0" cellspacing="0" cellpadding="0">`,
|
|
777
|
-
`<colgroup>${columns.map((column) => `<col style="${getHeaderWidthStyle(column)}">`).join("")}</colgroup>`
|
|
778
|
-
];
|
|
782
|
+
const clss = ["vxe-table", `border--${toTableBorder(border)}`, isPrint ? "is--print" : "", isAutoWidth ? "is--auto-width" : "", isScaleWidth ? "is--scale-width" : "", isDefaultWidth ? "is--default-width" : "", isHeader ? "is--header" : ""].filter((cls) => cls);
|
|
783
|
+
const tables = [`<table class="${clss.join(" ")}" border="0" cellspacing="0" cellpadding="0">`, `<colgroup>${columns.map((column) => `<col style="${getHeaderWidthStyle(column)}">`).join("")}</colgroup>`];
|
|
779
784
|
if (isHeader) {
|
|
780
785
|
tables.push("<thead>");
|
|
781
786
|
if (isColgroup && !original) {
|
|
@@ -989,11 +994,11 @@ hooks.add("tableExportModule", {
|
|
|
989
994
|
const blob = (0, import_util2.getExportBlobByContent)(content, opts);
|
|
990
995
|
return Promise.resolve({ type, content, blob });
|
|
991
996
|
}
|
|
992
|
-
if (
|
|
993
|
-
|
|
997
|
+
if (import_core.VxeUI.saveFile) {
|
|
998
|
+
import_core.VxeUI.saveFile({ filename, type, content }).then(() => {
|
|
994
999
|
if (opts.message !== false) {
|
|
995
|
-
if (
|
|
996
|
-
|
|
1000
|
+
if (import_core.VxeUI.modal) {
|
|
1001
|
+
import_core.VxeUI.modal.message({ content: getI18n("vxe.table.expSuccess"), status: "success" });
|
|
997
1002
|
}
|
|
998
1003
|
}
|
|
999
1004
|
});
|
|
@@ -1080,8 +1085,8 @@ hooks.add("tableExportModule", {
|
|
|
1080
1085
|
loadRest = $xeTable.reloadData(data);
|
|
1081
1086
|
}
|
|
1082
1087
|
if (opts.message !== false) {
|
|
1083
|
-
if (
|
|
1084
|
-
|
|
1088
|
+
if (import_core.VxeUI.modal) {
|
|
1089
|
+
import_core.VxeUI.modal.message({ content: getI18n("vxe.table.impSuccess", [rows.length]), status: "success" });
|
|
1085
1090
|
}
|
|
1086
1091
|
}
|
|
1087
1092
|
return loadRest.then(() => {
|
|
@@ -1091,8 +1096,8 @@ hooks.add("tableExportModule", {
|
|
|
1091
1096
|
});
|
|
1092
1097
|
});
|
|
1093
1098
|
} else if (opts.message !== false) {
|
|
1094
|
-
if (
|
|
1095
|
-
|
|
1099
|
+
if (import_core.VxeUI.modal) {
|
|
1100
|
+
import_core.VxeUI.modal.message({ content: getI18n("vxe.error.impFields"), status: "error" });
|
|
1096
1101
|
}
|
|
1097
1102
|
if (_importReject) {
|
|
1098
1103
|
_importReject({ status: false, msg: "field mismatching" });
|
|
@@ -1105,8 +1110,8 @@ hooks.add("tableExportModule", {
|
|
|
1105
1110
|
const importOpts = computeImportOpts.value;
|
|
1106
1111
|
if (!importMethod && !import_xe_utils.default.includes(import_xe_utils.default.keys(importOpts._typeMaps), type)) {
|
|
1107
1112
|
if (opts.message !== false) {
|
|
1108
|
-
if (
|
|
1109
|
-
|
|
1113
|
+
if (import_core.VxeUI.modal) {
|
|
1114
|
+
import_core.VxeUI.modal.message({ content: getI18n("vxe.error.notType", [type]), status: "error" });
|
|
1110
1115
|
}
|
|
1111
1116
|
}
|
|
1112
1117
|
const params = { status: false, msg: "type error" };
|
|
@@ -1221,17 +1226,20 @@ hooks.add("tableExportModule", {
|
|
|
1221
1226
|
const proxyOpts = $xeGGWrapper ? $xeGGWrapper.getComputeMaps().computeProxyOpts.value : {};
|
|
1222
1227
|
const hasFooter = !!footerTableData.length;
|
|
1223
1228
|
const hasMerge = !!(mergeBodyList.length || mergeFooterList.length);
|
|
1224
|
-
const defOpts = Object.assign(
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1229
|
+
const defOpts = Object.assign(
|
|
1230
|
+
{
|
|
1231
|
+
message: true,
|
|
1232
|
+
isHeader: showHeader,
|
|
1233
|
+
isTitle: showHeader,
|
|
1234
|
+
isFooter: showFooter,
|
|
1235
|
+
isColgroup: isGroup,
|
|
1236
|
+
isMerge: hasMerge,
|
|
1237
|
+
useStyle: true,
|
|
1238
|
+
current: "current",
|
|
1239
|
+
modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ["all"] : []).concat(["current", "selected", "empty"])
|
|
1240
|
+
},
|
|
1241
|
+
options
|
|
1242
|
+
);
|
|
1235
1243
|
if (import_xe_utils.default.isBoolean(defOpts.isAllExpand)) {
|
|
1236
1244
|
warnLog("vxe.error.delProp", ["isAllExpand", "isTreeAllExpanded"]);
|
|
1237
1245
|
defOpts.isTreeAllExpanded = defOpts.isAllExpand;
|
|
@@ -1306,9 +1314,13 @@ hooks.add("tableExportModule", {
|
|
|
1306
1314
|
exportStore.isPrint = !!isPrint;
|
|
1307
1315
|
exportStore.hasColgroup = isGroup;
|
|
1308
1316
|
exportStore.visible = true;
|
|
1309
|
-
Object.assign(
|
|
1310
|
-
|
|
1311
|
-
|
|
1317
|
+
Object.assign(
|
|
1318
|
+
exportParams,
|
|
1319
|
+
{
|
|
1320
|
+
mode: selectRecords.length ? "selected" : "current"
|
|
1321
|
+
},
|
|
1322
|
+
defOpts
|
|
1323
|
+
);
|
|
1312
1324
|
const { filename, sheetName, mode, type } = exportParams;
|
|
1313
1325
|
if (filename) {
|
|
1314
1326
|
if (import_xe_utils.default.isFunction(filename)) {
|
|
@@ -1347,8 +1359,8 @@ hooks.add("tableExportModule", {
|
|
|
1347
1359
|
return (0, import_vue.nextTick)();
|
|
1348
1360
|
};
|
|
1349
1361
|
const handleCloseExport = () => {
|
|
1350
|
-
if (
|
|
1351
|
-
return
|
|
1362
|
+
if (import_core.VxeUI.modal) {
|
|
1363
|
+
return import_core.VxeUI.modal.close("VXE_EXPORT_MODAL");
|
|
1352
1364
|
}
|
|
1353
1365
|
return Promise.resolve();
|
|
1354
1366
|
};
|
|
@@ -1370,32 +1382,36 @@ hooks.add("tableExportModule", {
|
|
|
1370
1382
|
const treeOpts = computeTreeOpts.value;
|
|
1371
1383
|
const proxyOpts = $xeGGWrapper ? $xeGGWrapper.getComputeMaps().computeProxyOpts.value : {};
|
|
1372
1384
|
const hasMerge = !!(mergeBodyList.length || mergeFooterList.length);
|
|
1373
|
-
const opts = Object.assign(
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1385
|
+
const opts = Object.assign(
|
|
1386
|
+
{
|
|
1387
|
+
message: true,
|
|
1388
|
+
isHeader: showHeader,
|
|
1389
|
+
isTitle: showHeader,
|
|
1390
|
+
isFooter: showFooter,
|
|
1391
|
+
isColgroup: isGroup,
|
|
1392
|
+
isMerge: hasMerge,
|
|
1393
|
+
useStyle: true,
|
|
1394
|
+
current: "current",
|
|
1395
|
+
modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ["all"] : []).concat(["current", "selected", "empty"]),
|
|
1396
|
+
download: true,
|
|
1397
|
+
type: "csv"
|
|
1398
|
+
// filename: '',
|
|
1399
|
+
// sheetName: '',
|
|
1400
|
+
// original: false,
|
|
1401
|
+
// isTreeAllExpanded: false,
|
|
1402
|
+
// isRowGroupAllExpanded: false,
|
|
1403
|
+
// data: null,
|
|
1404
|
+
// remote: false,
|
|
1405
|
+
// dataFilterMethod: null,
|
|
1406
|
+
// footerFilterMethod: null,
|
|
1407
|
+
// exportMethod: null,
|
|
1408
|
+
// columnFilterMethod: null,
|
|
1409
|
+
// beforeExportMethod: null,
|
|
1410
|
+
// afterExportMethod: null
|
|
1411
|
+
},
|
|
1412
|
+
exportOpts,
|
|
1413
|
+
options
|
|
1414
|
+
);
|
|
1399
1415
|
if (import_xe_utils.default.isBoolean(opts.isAllExpand)) {
|
|
1400
1416
|
warnLog("vxe.error.delProp", ["isAllExpand", "isTreeAllExpanded"]);
|
|
1401
1417
|
opts.isTreeAllExpanded = opts.isAllExpand;
|
|
@@ -1434,23 +1450,27 @@ hooks.add("tableExportModule", {
|
|
|
1434
1450
|
isCustomCol = true;
|
|
1435
1451
|
customCols = import_xe_utils.default.searchTree(columns, () => true, { children: "children", mapChildren: "childNodes", original: true });
|
|
1436
1452
|
} else {
|
|
1437
|
-
customCols = import_xe_utils.default.searchTree(
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
isChecked = true;
|
|
1453
|
+
customCols = import_xe_utils.default.searchTree(
|
|
1454
|
+
collectColumn,
|
|
1455
|
+
(column) => {
|
|
1456
|
+
const isColGroup = column.children && column.children.length > 0;
|
|
1457
|
+
let isChecked = false;
|
|
1458
|
+
const isExtraChecked = extraFdMaps[column.field];
|
|
1459
|
+
if (columns) {
|
|
1460
|
+
isChecked = handleFilterColumns(opts, column, columns);
|
|
1461
|
+
} else if (excludeFields || includeFields) {
|
|
1462
|
+
isChecked = handleFilterFields(opts, column, includeFields, includeFdMaps, excludeFdMaps, extraFdMaps);
|
|
1448
1463
|
} else {
|
|
1449
|
-
|
|
1464
|
+
if (isExtraChecked) {
|
|
1465
|
+
isChecked = true;
|
|
1466
|
+
} else {
|
|
1467
|
+
isChecked = column.visible && (isColGroup || defaultFilterExportColumn(column));
|
|
1468
|
+
}
|
|
1450
1469
|
}
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1470
|
+
return isChecked;
|
|
1471
|
+
},
|
|
1472
|
+
{ children: "children", mapChildren: "childNodes", original: true }
|
|
1473
|
+
);
|
|
1454
1474
|
}
|
|
1455
1475
|
const handleOptions = Object.assign({}, opts, { filename: "", sheetName: "", _columnConfs: columns });
|
|
1456
1476
|
if (!isCustomCol && !columnFilterMethod) {
|
|
@@ -1460,33 +1480,37 @@ hooks.add("tableExportModule", {
|
|
|
1460
1480
|
if (customCols) {
|
|
1461
1481
|
handleOptions._isCustomColumn = true;
|
|
1462
1482
|
groups = import_xe_utils.default.searchTree(
|
|
1463
|
-
import_xe_utils.default.mapTree(
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1483
|
+
import_xe_utils.default.mapTree(
|
|
1484
|
+
customCols,
|
|
1485
|
+
(item) => {
|
|
1486
|
+
let targetColumn;
|
|
1487
|
+
if (item) {
|
|
1488
|
+
if ((0, import_util.isColumnInfo)(item)) {
|
|
1489
|
+
targetColumn = item;
|
|
1490
|
+
} else if (import_xe_utils.default.isString(item)) {
|
|
1491
|
+
targetColumn = $xeTable.getColumnByField(item);
|
|
1492
|
+
} else {
|
|
1493
|
+
const colid = item.id || item.colId;
|
|
1494
|
+
const type2 = item.type;
|
|
1495
|
+
const field = item.field;
|
|
1496
|
+
if (colid) {
|
|
1497
|
+
targetColumn = $xeTable.getColumnById(colid);
|
|
1498
|
+
} else if (field && type2) {
|
|
1499
|
+
targetColumn = tableFullColumn.find((column) => column.field === field && column.type === type2);
|
|
1500
|
+
} else if (field) {
|
|
1501
|
+
targetColumn = $xeTable.getColumnByField(field);
|
|
1502
|
+
} else if (type2) {
|
|
1503
|
+
targetColumn = tableFullColumn.find((column) => column.type === type2);
|
|
1504
|
+
}
|
|
1482
1505
|
}
|
|
1506
|
+
return targetColumn || {};
|
|
1483
1507
|
}
|
|
1484
|
-
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
children: "childNodes",
|
|
1511
|
+
mapChildren: "_children"
|
|
1485
1512
|
}
|
|
1486
|
-
|
|
1487
|
-
children: "childNodes",
|
|
1488
|
-
mapChildren: "_children"
|
|
1489
|
-
}),
|
|
1513
|
+
),
|
|
1490
1514
|
(column, index) => (0, import_util.isColumnInfo)(column) && (!columnFilterMethod || columnFilterMethod({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, column, $columnIndex: index })),
|
|
1491
1515
|
{
|
|
1492
1516
|
children: "_children",
|
|
@@ -1495,15 +1519,23 @@ hooks.add("tableExportModule", {
|
|
|
1495
1519
|
}
|
|
1496
1520
|
);
|
|
1497
1521
|
} else {
|
|
1498
|
-
groups = import_xe_utils.default.searchTree(isGroup ? collectColumn : tableFullColumn, (column, index) => column.visible && (!columnFilterMethod || columnFilterMethod({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, column, $columnIndex: index })), {
|
|
1522
|
+
groups = import_xe_utils.default.searchTree(isGroup ? collectColumn : tableFullColumn, (column, index) => column.visible && (!columnFilterMethod || columnFilterMethod({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, column, $columnIndex: index })), {
|
|
1523
|
+
children: "children",
|
|
1524
|
+
mapChildren: "childNodes",
|
|
1525
|
+
original: true
|
|
1526
|
+
});
|
|
1499
1527
|
}
|
|
1500
1528
|
const cols = [];
|
|
1501
|
-
import_xe_utils.default.eachTree(
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1529
|
+
import_xe_utils.default.eachTree(
|
|
1530
|
+
groups,
|
|
1531
|
+
(column) => {
|
|
1532
|
+
const isColGroup = column.children && column.children.length;
|
|
1533
|
+
if (!isColGroup) {
|
|
1534
|
+
cols.push(column);
|
|
1535
|
+
}
|
|
1536
|
+
},
|
|
1537
|
+
{ children: "childNodes" }
|
|
1538
|
+
);
|
|
1507
1539
|
handleOptions.columns = cols;
|
|
1508
1540
|
handleOptions.colgroups = convertToRows(groups);
|
|
1509
1541
|
if (filename) {
|
|
@@ -1668,11 +1700,15 @@ hooks.add("tableExportModule", {
|
|
|
1668
1700
|
},
|
|
1669
1701
|
importData(options) {
|
|
1670
1702
|
const importOpts = computeImportOpts.value;
|
|
1671
|
-
const opts = Object.assign(
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1703
|
+
const opts = Object.assign(
|
|
1704
|
+
{
|
|
1705
|
+
types: import_xe_utils.default.keys(importOpts._typeMaps)
|
|
1706
|
+
// beforeImportMethod: null,
|
|
1707
|
+
// afterImportMethod: null
|
|
1708
|
+
},
|
|
1709
|
+
importOpts,
|
|
1710
|
+
options
|
|
1711
|
+
);
|
|
1676
1712
|
const { beforeImportMethod, afterImportMethod } = opts;
|
|
1677
1713
|
if (beforeImportMethod) {
|
|
1678
1714
|
const biRest = beforeImportMethod({ options: opts, $table: $xeTable });
|
|
@@ -1685,7 +1721,7 @@ hooks.add("tableExportModule", {
|
|
|
1685
1721
|
warnLog("vxe.error.returnErr", ["beforeImportMethod", "boolean", biRest]);
|
|
1686
1722
|
}
|
|
1687
1723
|
}
|
|
1688
|
-
return
|
|
1724
|
+
return import_core.VxeUI.readFile(opts).catch((e) => {
|
|
1689
1725
|
if (afterImportMethod) {
|
|
1690
1726
|
afterImportMethod({ status: false, options: opts, $table: $xeTable });
|
|
1691
1727
|
}
|
|
@@ -1696,24 +1732,29 @@ hooks.add("tableExportModule", {
|
|
|
1696
1732
|
});
|
|
1697
1733
|
},
|
|
1698
1734
|
saveFile(options) {
|
|
1699
|
-
return
|
|
1735
|
+
return import_core.VxeUI.saveFile(options);
|
|
1700
1736
|
},
|
|
1701
1737
|
readFile(options) {
|
|
1702
|
-
return
|
|
1738
|
+
return import_core.VxeUI.readFile(options);
|
|
1703
1739
|
},
|
|
1704
1740
|
print(options) {
|
|
1705
1741
|
const $xeGrid = $xeTable.xeGrid;
|
|
1706
1742
|
const $xeGantt = $xeTable.xeGantt;
|
|
1707
1743
|
const printOpts = computePrintOpts.value;
|
|
1708
|
-
const opts = Object.assign(
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1744
|
+
const opts = Object.assign(
|
|
1745
|
+
{
|
|
1746
|
+
original: false
|
|
1747
|
+
// beforePrintMethod
|
|
1748
|
+
},
|
|
1749
|
+
printOpts,
|
|
1750
|
+
options,
|
|
1751
|
+
{
|
|
1752
|
+
type: "html",
|
|
1753
|
+
download: false,
|
|
1754
|
+
remote: false,
|
|
1755
|
+
print: true
|
|
1756
|
+
}
|
|
1757
|
+
);
|
|
1717
1758
|
const { sheetName } = opts;
|
|
1718
1759
|
let printTitle = "";
|
|
1719
1760
|
if (sheetName) {
|
|
@@ -1735,10 +1776,10 @@ hooks.add("tableExportModule", {
|
|
|
1735
1776
|
const printMethod = opts.printMethod;
|
|
1736
1777
|
const tableHtml = opts.html || opts.content;
|
|
1737
1778
|
return new Promise((resolve, reject) => {
|
|
1738
|
-
if (
|
|
1779
|
+
if (import_core.VxeUI.print) {
|
|
1739
1780
|
if (tableHtml) {
|
|
1740
1781
|
resolve(
|
|
1741
|
-
|
|
1782
|
+
import_core.VxeUI.print({
|
|
1742
1783
|
title: printTitle,
|
|
1743
1784
|
html: tableHtml,
|
|
1744
1785
|
customStyle: opts.style,
|
|
@@ -1777,7 +1818,7 @@ hooks.add("tableExportModule", {
|
|
|
1777
1818
|
} else {
|
|
1778
1819
|
resolve(
|
|
1779
1820
|
exportMethods.exportData(opts).then(({ content }) => {
|
|
1780
|
-
return
|
|
1821
|
+
return import_core.VxeUI.print({
|
|
1781
1822
|
title: printTitle,
|
|
1782
1823
|
html: content,
|
|
1783
1824
|
customStyle: opts.style,
|
|
@@ -1824,15 +1865,20 @@ hooks.add("tableExportModule", {
|
|
|
1824
1865
|
},
|
|
1825
1866
|
getPrintHtml(options) {
|
|
1826
1867
|
const printOpts = computePrintOpts.value;
|
|
1827
|
-
const opts = Object.assign(
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1868
|
+
const opts = Object.assign(
|
|
1869
|
+
{
|
|
1870
|
+
original: false
|
|
1871
|
+
// beforePrintMethod
|
|
1872
|
+
},
|
|
1873
|
+
printOpts,
|
|
1874
|
+
options,
|
|
1875
|
+
{
|
|
1876
|
+
type: "html",
|
|
1877
|
+
download: false,
|
|
1878
|
+
remote: false,
|
|
1879
|
+
print: true
|
|
1880
|
+
}
|
|
1881
|
+
);
|
|
1836
1882
|
return $xeTable.exportData(opts).then(({ content }) => {
|
|
1837
1883
|
return {
|
|
1838
1884
|
html: content
|
|
@@ -1840,8 +1886,8 @@ hooks.add("tableExportModule", {
|
|
|
1840
1886
|
});
|
|
1841
1887
|
},
|
|
1842
1888
|
closeImport() {
|
|
1843
|
-
if (
|
|
1844
|
-
return
|
|
1889
|
+
if (import_core.VxeUI.modal) {
|
|
1890
|
+
return import_core.VxeUI.modal.close("VXE_IMPORT_MODAL");
|
|
1845
1891
|
}
|
|
1846
1892
|
return Promise.resolve();
|
|
1847
1893
|
},
|
|
@@ -1849,19 +1895,23 @@ hooks.add("tableExportModule", {
|
|
|
1849
1895
|
const { treeConfig, importConfig } = props;
|
|
1850
1896
|
const { initStore, importStore, importParams } = reactData;
|
|
1851
1897
|
const importOpts = computeImportOpts.value;
|
|
1852
|
-
const defOpts = Object.assign(
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1898
|
+
const defOpts = Object.assign(
|
|
1899
|
+
{
|
|
1900
|
+
mode: "insertTop",
|
|
1901
|
+
message: true,
|
|
1902
|
+
types: import_xe_utils.default.keys(importOpts._typeMaps),
|
|
1903
|
+
modes: ["insertTop", "covering"]
|
|
1904
|
+
},
|
|
1905
|
+
importOpts,
|
|
1906
|
+
options
|
|
1907
|
+
);
|
|
1858
1908
|
const types = defOpts.types || [];
|
|
1859
1909
|
const modes = defOpts.modes || [];
|
|
1860
1910
|
const isTree = !!treeConfig;
|
|
1861
1911
|
if (isTree) {
|
|
1862
1912
|
if (defOpts.message) {
|
|
1863
|
-
if (
|
|
1864
|
-
|
|
1913
|
+
if (import_core.VxeUI.modal) {
|
|
1914
|
+
import_core.VxeUI.modal.message({ content: getI18n("vxe.error.treeNotImp"), status: "error" });
|
|
1865
1915
|
}
|
|
1866
1916
|
}
|
|
1867
1917
|
return;
|
|
@@ -1905,10 +1955,14 @@ hooks.add("tableExportModule", {
|
|
|
1905
1955
|
openExport(options) {
|
|
1906
1956
|
const { exportConfig } = props;
|
|
1907
1957
|
const exportOpts = computeExportOpts.value;
|
|
1908
|
-
const defOpts = Object.assign(
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1958
|
+
const defOpts = Object.assign(
|
|
1959
|
+
{
|
|
1960
|
+
message: true,
|
|
1961
|
+
types: import_xe_utils.default.keys(exportOpts._typeMaps)
|
|
1962
|
+
},
|
|
1963
|
+
exportOpts,
|
|
1964
|
+
options
|
|
1965
|
+
);
|
|
1912
1966
|
if (!(0, import_utils.hasEnableConf)(exportConfig, exportOpts)) {
|
|
1913
1967
|
errLog("vxe.error.reqProp", ["export-config"]);
|
|
1914
1968
|
}
|
|
@@ -1918,9 +1972,13 @@ hooks.add("tableExportModule", {
|
|
|
1918
1972
|
openPrint(options) {
|
|
1919
1973
|
const { printConfig } = props;
|
|
1920
1974
|
const printOpts = computePrintOpts.value;
|
|
1921
|
-
const defOpts = Object.assign(
|
|
1922
|
-
|
|
1923
|
-
|
|
1975
|
+
const defOpts = Object.assign(
|
|
1976
|
+
{
|
|
1977
|
+
message: true
|
|
1978
|
+
},
|
|
1979
|
+
printOpts,
|
|
1980
|
+
options
|
|
1981
|
+
);
|
|
1924
1982
|
if (!(0, import_utils.hasEnableConf)(printConfig, printOpts)) {
|
|
1925
1983
|
errLog("vxe.error.reqProp", ["print-config"]);
|
|
1926
1984
|
}
|