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.
Files changed (148) hide show
  1. package/dist/all.esm.js +5859 -4018
  2. package/es/colgroup/index.js +1 -1
  3. package/es/column/index.js +1 -1
  4. package/es/components.d.ts +3 -0
  5. package/es/components.js +4 -8
  6. package/es/grid/index.js +1 -1
  7. package/es/grid/src/emits.js +1 -15
  8. package/es/grid/src/grid.js +398 -121
  9. package/es/grid/src/props.js +1 -1
  10. package/es/index.esm.js +6 -0
  11. package/es/index.js +6 -0
  12. package/es/table/index.js +1 -1
  13. package/es/table/module/custom/hook.js +50 -43
  14. package/es/table/module/custom/panel.js +778 -528
  15. package/es/table/module/edit/hook.js +141 -63
  16. package/es/table/module/export/export-panel.js +400 -317
  17. package/es/table/module/export/hook.js +396 -338
  18. package/es/table/module/export/import-panel.js +153 -124
  19. package/es/table/module/filter/hook.js +17 -3
  20. package/es/table/module/filter/panel.js +147 -85
  21. package/es/table/module/keyboard/hook.js +9 -5
  22. package/es/table/module/menu/hook.js +1 -1
  23. package/es/table/module/menu/panel.js +198 -127
  24. package/es/table/module/validator/hook.js +1 -1
  25. package/es/table/render/index.js +152 -99
  26. package/es/table/src/body.js +356 -234
  27. package/es/table/src/cell.js +427 -270
  28. package/es/table/src/columnInfo.js +2 -1
  29. package/es/table/src/footer.js +145 -100
  30. package/es/table/src/group.js +7 -3
  31. package/es/table/src/header.js +230 -173
  32. package/es/table/src/props.js +1 -1
  33. package/es/table/src/table.js +1504 -1031
  34. package/es/table/src/util.js +15 -19
  35. package/es/toolbar/index.js +1 -1
  36. package/es/toolbar/src/toolbar.js +133 -76
  37. package/es/ui/index.d.ts +0 -1
  38. package/es/ui/index.js +1 -2
  39. package/es/ui/src/dom.js +9 -6
  40. package/es/ui/src/log.js +1 -1
  41. package/es/ui/src/utils.d.ts +1 -1
  42. package/es/v-x-e-table/index.d.ts +0 -1
  43. package/es/v-x-e-table/index.js +0 -1
  44. package/lib/colgroup/index.js +5 -5
  45. package/lib/column/index.js +5 -5
  46. package/lib/components.js +8 -12
  47. package/lib/grid/index.js +4 -4
  48. package/lib/grid/src/emits.js +1 -15
  49. package/lib/grid/src/grid.js +419 -142
  50. package/lib/grid/src/props.js +2 -2
  51. package/lib/index.common.js +6 -0
  52. package/lib/index.js +6 -0
  53. package/lib/index.umd.js +5825 -3945
  54. package/lib/index.umd.min.js +3 -3
  55. package/lib/table/index.js +5 -5
  56. package/lib/table/module/custom/hook.js +51 -44
  57. package/lib/table/module/custom/panel.js +790 -540
  58. package/lib/table/module/edit/hook.js +142 -64
  59. package/lib/table/module/export/export-panel.js +406 -323
  60. package/lib/table/module/export/hook.js +419 -361
  61. package/lib/table/module/export/import-panel.js +157 -128
  62. package/lib/table/module/filter/hook.js +18 -4
  63. package/lib/table/module/filter/panel.js +149 -87
  64. package/lib/table/module/keyboard/hook.js +10 -6
  65. package/lib/table/module/menu/hook.js +2 -2
  66. package/lib/table/module/menu/panel.js +199 -128
  67. package/lib/table/module/validator/hook.js +2 -2
  68. package/lib/table/render/index.js +153 -100
  69. package/lib/table/src/body.js +357 -235
  70. package/lib/table/src/cell.js +428 -271
  71. package/lib/table/src/columnInfo.js +3 -2
  72. package/lib/table/src/footer.js +146 -101
  73. package/lib/table/src/group.js +7 -3
  74. package/lib/table/src/header.js +231 -174
  75. package/lib/table/src/props.js +2 -2
  76. package/lib/table/src/table.js +1487 -1045
  77. package/lib/table/src/util.js +15 -19
  78. package/lib/toolbar/index.js +4 -4
  79. package/lib/toolbar/src/toolbar.js +135 -78
  80. package/lib/ui/index.js +1 -3
  81. package/lib/ui/src/dom.js +9 -6
  82. package/lib/ui/src/log.js +1 -1
  83. package/lib/v-x-e-table/index.js +0 -2
  84. package/package.json +8 -3
  85. package/packages/colgroup/index.ts +22 -22
  86. package/packages/column/index.ts +22 -22
  87. package/packages/components.ts +41 -43
  88. package/packages/grid/index.ts +18 -18
  89. package/packages/grid/src/emits.ts +5 -19
  90. package/packages/grid/src/grid.ts +2229 -1925
  91. package/packages/grid/src/props.ts +22 -23
  92. package/packages/index.ts +11 -4
  93. package/packages/locale/lang/fr-FR.ts +15 -15
  94. package/packages/locale/lang/it-IT.ts +4 -4
  95. package/packages/locale/lang/uk-UA.ts +1 -1
  96. package/packages/locale/lang/uz-UZ.ts +13 -13
  97. package/packages/locale/lang/zh-CN.ts +907 -907
  98. package/packages/table/index.ts +26 -26
  99. package/packages/table/module/custom/hook.ts +510 -503
  100. package/packages/table/module/custom/panel.ts +2002 -1743
  101. package/packages/table/module/edit/hook.ts +1224 -1131
  102. package/packages/table/module/export/export-panel.ts +697 -611
  103. package/packages/table/module/export/hook.ts +2160 -2059
  104. package/packages/table/module/export/import-panel.ts +319 -279
  105. package/packages/table/module/export/util.ts +25 -24
  106. package/packages/table/module/filter/hook.ts +519 -501
  107. package/packages/table/module/filter/panel.ts +368 -304
  108. package/packages/table/module/keyboard/hook.ts +498 -494
  109. package/packages/table/module/menu/hook.ts +330 -330
  110. package/packages/table/module/menu/panel.ts +272 -201
  111. package/packages/table/module/validator/hook.ts +653 -635
  112. package/packages/table/render/index.ts +1819 -1744
  113. package/packages/table/src/body.ts +1078 -955
  114. package/packages/table/src/cell.ts +1524 -1359
  115. package/packages/table/src/column.ts +192 -192
  116. package/packages/table/src/columnInfo.ts +232 -232
  117. package/packages/table/src/emits.ts +134 -134
  118. package/packages/table/src/footer.ts +425 -380
  119. package/packages/table/src/group.ts +67 -63
  120. package/packages/table/src/header.ts +642 -581
  121. package/packages/table/src/props.ts +336 -336
  122. package/packages/table/src/store.ts +14 -14
  123. package/packages/table/src/table.ts +16011 -15454
  124. package/packages/table/src/use/cell-view.ts +41 -44
  125. package/packages/table/src/use/index.ts +1 -1
  126. package/packages/table/src/util.ts +1206 -1216
  127. package/packages/toolbar/index.ts +18 -18
  128. package/packages/toolbar/src/toolbar.ts +768 -706
  129. package/packages/ui/index.ts +519 -521
  130. package/packages/ui/src/anime.ts +51 -52
  131. package/packages/ui/src/comp.ts +3 -3
  132. package/packages/ui/src/dom.ts +466 -463
  133. package/packages/ui/src/log.ts +19 -19
  134. package/packages/ui/src/utils.ts +66 -66
  135. package/packages/ui/src/vn.ts +55 -55
  136. package/packages/v-x-e-table/index.d.ts +3 -4
  137. package/packages/v-x-e-table/index.ts +3 -4
  138. package/types/all.d.ts +76 -76
  139. package/types/index.d.ts +4 -4
  140. /package/dist/{iconfont.1792979665397.ttf → iconfont.1793009263429.ttf} +0 -0
  141. /package/dist/{iconfont.1792979665397.woff → iconfont.1793009263429.woff} +0 -0
  142. /package/dist/{iconfont.1792979665397.woff2 → iconfont.1793009263429.woff2} +0 -0
  143. /package/es/{iconfont.1792979665397.ttf → iconfont.1793009263429.ttf} +0 -0
  144. /package/es/{iconfont.1792979665397.woff → iconfont.1793009263429.woff} +0 -0
  145. /package/es/{iconfont.1792979665397.woff2 → iconfont.1793009263429.woff2} +0 -0
  146. /package/lib/{iconfont.1792979665397.ttf → iconfont.1793009263429.ttf} +0 -0
  147. /package/lib/{iconfont.1792979665397.woff → iconfont.1793009263429.woff} +0 -0
  148. /package/lib/{iconfont.1792979665397.woff2 → iconfont.1793009263429.woff2} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { nextTick } from "vue";
2
2
  import XEUtils from "xe-utils";
3
- import { VxeUI } from "../../../ui";
3
+ import { VxeUI } from "@vxe-ui/core";
4
4
  import { isColumnInfo, getCellValue, createHandleGetRowId } from "../../src/util";
5
5
  import { parseFile, formatText, eqEmptyValue, hasEnableConf } from "../../../ui/src/utils";
6
6
  import { hasClass, toCssUnit } from "../../../ui/src/dom";
@@ -240,13 +240,17 @@ function parseXML(tableConf, content) {
240
240
  return { fields, rows };
241
241
  }
242
242
  function clearColumnConvert(columns) {
243
- XEUtils.eachTree(columns, (column) => {
244
- delete column._level;
245
- delete column._colSpan;
246
- delete column._rowSpan;
247
- delete column._children;
248
- delete column.childNodes;
249
- }, { children: "children" });
243
+ XEUtils.eachTree(
244
+ columns,
245
+ (column) => {
246
+ delete column._level;
247
+ delete column._colSpan;
248
+ delete column._rowSpan;
249
+ delete column._children;
250
+ delete column.childNodes;
251
+ },
252
+ { children: "children" }
253
+ );
250
254
  }
251
255
  const tableExportMethodKeys = ["exportData", "importByFile", "importData", "saveFile", "readFile", "print", "getPrintHtml", "openImport", "closeImport", "openExport", "closeExport", "openPrint", "closePrint"];
252
256
  hooks.add("tableExportModule", {
@@ -302,136 +306,140 @@ hooks.add("tableExportModule", {
302
306
  const rest = [];
303
307
  const expandMaps = {};
304
308
  const useMaps = {};
305
- XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
306
- const row = item._row || item;
307
- const rowid = handleGetRowId(row);
308
- if (useMaps[rowid]) {
309
- return;
310
- }
311
- const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem;
312
- const pRowid = parentRow ? handleGetRowId(parentRow) : "";
313
- if (isRowGroupAllExpanded || !parentRow || expandMaps[pRowid] && $xeTable.isRowExpandByRow(parentRow)) {
314
- const hasRowChild = mapChildrenField && row[mapChildrenField] && row[mapChildrenField].length;
315
- const item2 = {
316
- _row: row,
317
- _level: nodes.length - 1,
318
- _hasChild: hasRowChild,
319
- _expand: hasRowChild && $xeTable.isRowExpandByRow(row)
320
- };
321
- columns.forEach((column, $columnIndex) => {
322
- const { field, editRender, cellRender, aggFunc, rowGroupNode } = column;
323
- let cellValue = "";
324
- const renderOpts = editRender || cellRender;
325
- let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
326
- if (!bodyExportMethod && renderOpts && renderOpts.name) {
327
- const compConf = rendererOpts[renderOpts.name] || renderer.get(renderOpts.name);
328
- if (compConf) {
329
- bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod;
330
- }
331
- }
332
- if (!bodyExportMethod) {
333
- bodyExportMethod = columnOpts.exportMethod;
334
- }
335
- if (bodyExportMethod) {
336
- cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts });
337
- } else {
338
- switch (column.type) {
339
- case "seq": {
340
- const seqVal = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : ".").join("");
341
- cellValue = expMode === "all" ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex);
342
- break;
343
- }
344
- case "checkbox": {
345
- cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
346
- item2._checkboxLabel = checkboxOpts.labelField ? XEUtils.get(row, checkboxOpts.labelField) : "";
347
- item2._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row });
348
- break;
349
- }
350
- case "radio": {
351
- cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
352
- item2._radioLabel = radioOpts.labelField ? XEUtils.get(row, radioOpts.labelField) : "";
353
- item2._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row });
354
- break;
309
+ XEUtils.eachTree(
310
+ datas,
311
+ (item, $rowIndex, items, path, parentItem, nodes) => {
312
+ const row = item._row || item;
313
+ const rowid = handleGetRowId(row);
314
+ if (useMaps[rowid]) {
315
+ return;
316
+ }
317
+ const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem;
318
+ const pRowid = parentRow ? handleGetRowId(parentRow) : "";
319
+ if (isRowGroupAllExpanded || !parentRow || expandMaps[pRowid] && $xeTable.isRowExpandByRow(parentRow)) {
320
+ const hasRowChild = mapChildrenField && row[mapChildrenField] && row[mapChildrenField].length;
321
+ const item2 = {
322
+ _row: row,
323
+ _level: nodes.length - 1,
324
+ _hasChild: hasRowChild,
325
+ _expand: hasRowChild && $xeTable.isRowExpandByRow(row)
326
+ };
327
+ columns.forEach((column, $columnIndex) => {
328
+ const { field, editRender, cellRender, aggFunc, rowGroupNode } = column;
329
+ let cellValue = "";
330
+ const renderOpts = editRender || cellRender;
331
+ let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
332
+ if (!bodyExportMethod && renderOpts && renderOpts.name) {
333
+ const compConf = rendererOpts[renderOpts.name] || renderer.get(renderOpts.name);
334
+ if (compConf) {
335
+ bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod;
355
336
  }
356
- default: {
357
- if (field && row.isAggregate) {
358
- const aggRow = row;
359
- const aggData = aggRow.aggData;
360
- const currAggData = aggData ? aggData[field] : null;
361
- const groupField = aggRow.groupField;
362
- const groupContent = aggRow.groupContent;
363
- const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
364
- const childCount = aggRow.childCount;
365
- const colRest = fullColumnFieldData[groupField] || {};
366
- const ctParams = {
367
- $table: $xeTable,
368
- groupField,
369
- groupColumn: colRest ? colRest.column : null,
370
- column,
371
- groupValue: groupContent,
372
- childList,
373
- childCount,
374
- aggValue: null,
375
- /**
376
- * 已废弃
377
- * @deprecated
378
- */
379
- children: childList,
380
- /**
381
- * 已废弃
382
- * @deprecated
383
- */
384
- totalValue: childCount
385
- };
386
- if (aggMode === "column" ? field === aggRow.groupField : rowGroupNode) {
387
- cellValue = groupContent;
388
- if (contentMethod) {
389
- cellValue = `${contentMethod(ctParams)}`;
390
- }
391
- if (showTotal) {
392
- cellValue = getI18n("vxe.table.rowGroupContentTotal", [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount]);
393
- }
394
- } else if ($xeTable.getPivotTableAggregateCellAggValue) {
395
- const aggParams = {
337
+ }
338
+ if (!bodyExportMethod) {
339
+ bodyExportMethod = columnOpts.exportMethod;
340
+ }
341
+ if (bodyExportMethod) {
342
+ cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts });
343
+ } else {
344
+ switch (column.type) {
345
+ case "seq": {
346
+ const seqVal = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : ".").join("");
347
+ cellValue = expMode === "all" ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex);
348
+ break;
349
+ }
350
+ case "checkbox": {
351
+ cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
352
+ item2._checkboxLabel = checkboxOpts.labelField ? XEUtils.get(row, checkboxOpts.labelField) : "";
353
+ item2._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row });
354
+ break;
355
+ }
356
+ case "radio": {
357
+ cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
358
+ item2._radioLabel = radioOpts.labelField ? XEUtils.get(row, radioOpts.labelField) : "";
359
+ item2._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row });
360
+ break;
361
+ }
362
+ default: {
363
+ if (field && row.isAggregate) {
364
+ const aggRow = row;
365
+ const aggData = aggRow.aggData;
366
+ const currAggData = aggData ? aggData[field] : null;
367
+ const groupField = aggRow.groupField;
368
+ const groupContent = aggRow.groupContent;
369
+ const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
370
+ const childCount = aggRow.childCount;
371
+ const colRest = fullColumnFieldData[groupField] || {};
372
+ const ctParams = {
396
373
  $table: $xeTable,
397
- row,
398
- column
374
+ groupField,
375
+ groupColumn: colRest ? colRest.column : null,
376
+ column,
377
+ groupValue: groupContent,
378
+ childList,
379
+ childCount,
380
+ aggValue: null,
381
+ /**
382
+ * 已废弃
383
+ * @deprecated
384
+ */
385
+ children: childList,
386
+ /**
387
+ * 已废弃
388
+ * @deprecated
389
+ */
390
+ totalValue: childCount
399
391
  };
400
- cellValue = $xeTable.getPivotTableAggregateCellAggValue(aggParams);
401
- } else if (aggFunc === true || countFields && countFields.includes(field)) {
402
- cellValue = currAggData ? currAggData.value : childCount;
403
- ctParams.aggValue = cellValue;
404
- if (formatValuesMethod) {
405
- cellValue = formatValuesMethod(ctParams);
392
+ if (aggMode === "column" ? field === aggRow.groupField : rowGroupNode) {
393
+ cellValue = groupContent;
394
+ if (contentMethod) {
395
+ cellValue = `${contentMethod(ctParams)}`;
396
+ }
397
+ if (showTotal) {
398
+ cellValue = getI18n("vxe.table.rowGroupContentTotal", [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount]);
399
+ }
400
+ } else if ($xeTable.getPivotTableAggregateCellAggValue) {
401
+ const aggParams = {
402
+ $table: $xeTable,
403
+ row,
404
+ column
405
+ };
406
+ cellValue = $xeTable.getPivotTableAggregateCellAggValue(aggParams);
407
+ } else if (aggFunc === true || countFields && countFields.includes(field)) {
408
+ cellValue = currAggData ? currAggData.value : childCount;
409
+ ctParams.aggValue = cellValue;
410
+ if (formatValuesMethod) {
411
+ cellValue = formatValuesMethod(ctParams);
412
+ }
406
413
  }
407
- }
408
- } else if (opts.original) {
409
- cellValue = getCellValue(row, column);
410
- } else {
411
- cellValue = $xeTable.getCellLabel(row, column);
412
- if (column.type === "html") {
413
- htmlCellElem.innerHTML = cellValue;
414
- cellValue = htmlCellElem.innerText.trim();
414
+ } else if (opts.original) {
415
+ cellValue = getCellValue(row, column);
415
416
  } else {
416
- const cell = $xeTable.getCellElement(row, column);
417
- if (cell && !hasClass(cell, "is--progress")) {
418
- cellValue = cell.innerText.trim();
417
+ cellValue = $xeTable.getCellLabel(row, column);
418
+ if (column.type === "html") {
419
+ htmlCellElem.innerHTML = cellValue;
420
+ cellValue = htmlCellElem.innerText.trim();
421
+ } else {
422
+ const cell = $xeTable.getCellElement(row, column);
423
+ if (cell && !hasClass(cell, "is--progress")) {
424
+ cellValue = cell.innerText.trim();
425
+ }
419
426
  }
420
427
  }
428
+ break;
421
429
  }
422
- break;
423
430
  }
424
431
  }
432
+ item2[column.id] = toStringValue(cellValue);
433
+ });
434
+ useMaps[rowid] = true;
435
+ if (pRowid) {
436
+ expandMaps[pRowid] = true;
425
437
  }
426
- item2[column.id] = toStringValue(cellValue);
427
- });
428
- useMaps[rowid] = true;
429
- if (pRowid) {
430
- expandMaps[pRowid] = true;
438
+ rest.push(Object.assign(item2, row));
431
439
  }
432
- rest.push(Object.assign(item2, row));
433
- }
434
- }, { children: mapChildrenField });
440
+ },
441
+ { children: mapChildrenField }
442
+ );
435
443
  return rest;
436
444
  }
437
445
  if (treeConfig) {
@@ -440,84 +448,88 @@ hooks.add("tableExportModule", {
440
448
  const rest = [];
441
449
  const expandMaps = {};
442
450
  const useMaps = {};
443
- XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
444
- const row = item._row || item;
445
- const rowid = handleGetRowId(row);
446
- if (useMaps[rowid]) {
447
- return;
448
- }
449
- const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem;
450
- const pRowid = parentRow ? handleGetRowId(parentRow) : "";
451
- if (isTreeAllExpanded || !parentRow || expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)) {
452
- const hasRowChild = row[childrenField] && row[childrenField].length;
453
- const item2 = {
454
- _row: row,
455
- _level: nodes.length - 1,
456
- _hasChild: hasRowChild,
457
- _expand: hasRowChild && $xeTable.isTreeExpandByRow(row)
458
- };
459
- const rowRest = fullAllDataRowIdData[rowid] || {};
460
- columns.forEach((column, $columnIndex) => {
461
- let cellValue = "";
462
- const renderOpts = column.editRender || column.cellRender;
463
- let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
464
- if (!bodyExportMethod && renderOpts && renderOpts.name) {
465
- const compConf = rendererOpts[renderOpts.name] || renderer.get(renderOpts.name);
466
- if (compConf) {
467
- bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod;
451
+ XEUtils.eachTree(
452
+ datas,
453
+ (item, $rowIndex, items, path, parentItem, nodes) => {
454
+ const row = item._row || item;
455
+ const rowid = handleGetRowId(row);
456
+ if (useMaps[rowid]) {
457
+ return;
458
+ }
459
+ const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem;
460
+ const pRowid = parentRow ? handleGetRowId(parentRow) : "";
461
+ if (isTreeAllExpanded || !parentRow || expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)) {
462
+ const hasRowChild = row[childrenField] && row[childrenField].length;
463
+ const item2 = {
464
+ _row: row,
465
+ _level: nodes.length - 1,
466
+ _hasChild: hasRowChild,
467
+ _expand: hasRowChild && $xeTable.isTreeExpandByRow(row)
468
+ };
469
+ const rowRest = fullAllDataRowIdData[rowid] || {};
470
+ columns.forEach((column, $columnIndex) => {
471
+ let cellValue = "";
472
+ const renderOpts = column.editRender || column.cellRender;
473
+ let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
474
+ if (!bodyExportMethod && renderOpts && renderOpts.name) {
475
+ const compConf = rendererOpts[renderOpts.name] || renderer.get(renderOpts.name);
476
+ if (compConf) {
477
+ bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod;
478
+ }
468
479
  }
469
- }
470
- if (!bodyExportMethod) {
471
- bodyExportMethod = columnOpts.exportMethod;
472
- }
473
- if (bodyExportMethod) {
474
- cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts });
475
- } else {
476
- switch (column.type) {
477
- case "seq": {
478
- let seqVal = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : ".").join("");
479
- if (seqMode === "increasing") {
480
- seqVal = rowRest ? rowRest._index + 1 : -1;
480
+ if (!bodyExportMethod) {
481
+ bodyExportMethod = columnOpts.exportMethod;
482
+ }
483
+ if (bodyExportMethod) {
484
+ cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts });
485
+ } else {
486
+ switch (column.type) {
487
+ case "seq": {
488
+ let seqVal = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : ".").join("");
489
+ if (seqMode === "increasing") {
490
+ seqVal = rowRest ? rowRest._index + 1 : -1;
491
+ }
492
+ cellValue = expMode === "all" ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex);
493
+ break;
481
494
  }
482
- cellValue = expMode === "all" ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex);
483
- break;
484
- }
485
- case "checkbox":
486
- cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
487
- item2._checkboxLabel = checkboxOpts.labelField ? XEUtils.get(row, checkboxOpts.labelField) : "";
488
- item2._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row });
489
- break;
490
- case "radio":
491
- cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
492
- item2._radioLabel = radioOpts.labelField ? XEUtils.get(row, radioOpts.labelField) : "";
493
- item2._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row });
494
- break;
495
- default:
496
- if (opts.original) {
497
- cellValue = getCellValue(row, column);
498
- } else {
499
- cellValue = $xeTable.getCellLabel(row, column);
500
- if (column.type === "html") {
501
- htmlCellElem.innerHTML = cellValue;
502
- cellValue = htmlCellElem.innerText.trim();
495
+ case "checkbox":
496
+ cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
497
+ item2._checkboxLabel = checkboxOpts.labelField ? XEUtils.get(row, checkboxOpts.labelField) : "";
498
+ item2._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row });
499
+ break;
500
+ case "radio":
501
+ cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
502
+ item2._radioLabel = radioOpts.labelField ? XEUtils.get(row, radioOpts.labelField) : "";
503
+ item2._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row });
504
+ break;
505
+ default:
506
+ if (opts.original) {
507
+ cellValue = getCellValue(row, column);
503
508
  } else {
504
- const cell = $xeTable.getCellElement(row, column);
505
- if (cell && !hasClass(cell, "is--progress")) {
506
- cellValue = cell.innerText.trim();
509
+ cellValue = $xeTable.getCellLabel(row, column);
510
+ if (column.type === "html") {
511
+ htmlCellElem.innerHTML = cellValue;
512
+ cellValue = htmlCellElem.innerText.trim();
513
+ } else {
514
+ const cell = $xeTable.getCellElement(row, column);
515
+ if (cell && !hasClass(cell, "is--progress")) {
516
+ cellValue = cell.innerText.trim();
517
+ }
507
518
  }
508
519
  }
509
- }
520
+ }
510
521
  }
522
+ item2[column.id] = toStringValue(cellValue);
523
+ });
524
+ useMaps[rowid] = true;
525
+ if (pRowid) {
526
+ expandMaps[pRowid] = true;
511
527
  }
512
- item2[column.id] = toStringValue(cellValue);
513
- });
514
- useMaps[rowid] = true;
515
- if (pRowid) {
516
- expandMaps[pRowid] = true;
528
+ rest.push(Object.assign(item2, row));
517
529
  }
518
- rest.push(Object.assign(item2, row));
519
- }
520
- }, { children: childrenField });
530
+ },
531
+ { children: childrenField }
532
+ );
521
533
  return rest;
522
534
  }
523
535
  return datas.map((row, $rowIndex) => {
@@ -690,13 +702,17 @@ hooks.add("tableExportModule", {
690
702
  }
691
703
  let childWidth = 0;
692
704
  let countChild = 0;
693
- XEUtils.eachTree([column], (item) => {
694
- if (!item.childNodes || !column.childNodes.length) {
695
- countChild++;
696
- }
697
- const ptWidth = printWidthMaps[item.id];
698
- childWidth += ptWidth || 0;
699
- }, { children: "childNodes" });
705
+ XEUtils.eachTree(
706
+ [column],
707
+ (item) => {
708
+ if (!item.childNodes || !column.childNodes.length) {
709
+ countChild++;
710
+ }
711
+ const ptWidth = printWidthMaps[item.id];
712
+ childWidth += ptWidth || 0;
713
+ },
714
+ { children: "childNodes" }
715
+ );
700
716
  const colWidth = childWidth - countChild;
701
717
  colWidthMaps[column.id] = colWidth;
702
718
  printWidthMaps[column.id] = XEUtils.floor(colWidth / tableWidth * 180, 2);
@@ -740,19 +756,8 @@ hooks.add("tableExportModule", {
740
756
  return colWidthMaps[column.id] ? "width:" + toCssUnit(colWidthMaps[column.id]) : "";
741
757
  };
742
758
  const allCls = "check-all";
743
- const clss = [
744
- "vxe-table",
745
- `border--${toTableBorder(border)}`,
746
- isPrint ? "is--print" : "",
747
- isAutoWidth ? "is--auto-width" : "",
748
- isScaleWidth ? "is--scale-width" : "",
749
- isDefaultWidth ? "is--default-width" : "",
750
- isHeader ? "is--header" : ""
751
- ].filter((cls) => cls);
752
- const tables = [
753
- `<table class="${clss.join(" ")}" border="0" cellspacing="0" cellpadding="0">`,
754
- `<colgroup>${columns.map((column) => `<col style="${getHeaderWidthStyle(column)}">`).join("")}</colgroup>`
755
- ];
759
+ 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);
760
+ const tables = [`<table class="${clss.join(" ")}" border="0" cellspacing="0" cellpadding="0">`, `<colgroup>${columns.map((column) => `<col style="${getHeaderWidthStyle(column)}">`).join("")}</colgroup>`];
756
761
  if (isHeader) {
757
762
  tables.push("<thead>");
758
763
  if (isColgroup && !original) {
@@ -1198,17 +1203,20 @@ hooks.add("tableExportModule", {
1198
1203
  const proxyOpts = $xeGGWrapper ? $xeGGWrapper.getComputeMaps().computeProxyOpts.value : {};
1199
1204
  const hasFooter = !!footerTableData.length;
1200
1205
  const hasMerge = !!(mergeBodyList.length || mergeFooterList.length);
1201
- const defOpts = Object.assign({
1202
- message: true,
1203
- isHeader: showHeader,
1204
- isTitle: showHeader,
1205
- isFooter: showFooter,
1206
- isColgroup: isGroup,
1207
- isMerge: hasMerge,
1208
- useStyle: true,
1209
- current: "current",
1210
- modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ["all"] : []).concat(["current", "selected", "empty"])
1211
- }, options);
1206
+ const defOpts = Object.assign(
1207
+ {
1208
+ message: true,
1209
+ isHeader: showHeader,
1210
+ isTitle: showHeader,
1211
+ isFooter: showFooter,
1212
+ isColgroup: isGroup,
1213
+ isMerge: hasMerge,
1214
+ useStyle: true,
1215
+ current: "current",
1216
+ modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ["all"] : []).concat(["current", "selected", "empty"])
1217
+ },
1218
+ options
1219
+ );
1212
1220
  if (XEUtils.isBoolean(defOpts.isAllExpand)) {
1213
1221
  warnLog("vxe.error.delProp", ["isAllExpand", "isTreeAllExpanded"]);
1214
1222
  defOpts.isTreeAllExpanded = defOpts.isAllExpand;
@@ -1283,9 +1291,13 @@ hooks.add("tableExportModule", {
1283
1291
  exportStore.isPrint = !!isPrint;
1284
1292
  exportStore.hasColgroup = isGroup;
1285
1293
  exportStore.visible = true;
1286
- Object.assign(exportParams, {
1287
- mode: selectRecords.length ? "selected" : "current"
1288
- }, defOpts);
1294
+ Object.assign(
1295
+ exportParams,
1296
+ {
1297
+ mode: selectRecords.length ? "selected" : "current"
1298
+ },
1299
+ defOpts
1300
+ );
1289
1301
  const { filename, sheetName, mode, type } = exportParams;
1290
1302
  if (filename) {
1291
1303
  if (XEUtils.isFunction(filename)) {
@@ -1347,32 +1359,36 @@ hooks.add("tableExportModule", {
1347
1359
  const treeOpts = computeTreeOpts.value;
1348
1360
  const proxyOpts = $xeGGWrapper ? $xeGGWrapper.getComputeMaps().computeProxyOpts.value : {};
1349
1361
  const hasMerge = !!(mergeBodyList.length || mergeFooterList.length);
1350
- const opts = Object.assign({
1351
- message: true,
1352
- isHeader: showHeader,
1353
- isTitle: showHeader,
1354
- isFooter: showFooter,
1355
- isColgroup: isGroup,
1356
- isMerge: hasMerge,
1357
- useStyle: true,
1358
- current: "current",
1359
- modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ["all"] : []).concat(["current", "selected", "empty"]),
1360
- download: true,
1361
- type: "csv"
1362
- // filename: '',
1363
- // sheetName: '',
1364
- // original: false,
1365
- // isTreeAllExpanded: false,
1366
- // isRowGroupAllExpanded: false,
1367
- // data: null,
1368
- // remote: false,
1369
- // dataFilterMethod: null,
1370
- // footerFilterMethod: null,
1371
- // exportMethod: null,
1372
- // columnFilterMethod: null,
1373
- // beforeExportMethod: null,
1374
- // afterExportMethod: null
1375
- }, exportOpts, options);
1362
+ const opts = Object.assign(
1363
+ {
1364
+ message: true,
1365
+ isHeader: showHeader,
1366
+ isTitle: showHeader,
1367
+ isFooter: showFooter,
1368
+ isColgroup: isGroup,
1369
+ isMerge: hasMerge,
1370
+ useStyle: true,
1371
+ current: "current",
1372
+ modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ["all"] : []).concat(["current", "selected", "empty"]),
1373
+ download: true,
1374
+ type: "csv"
1375
+ // filename: '',
1376
+ // sheetName: '',
1377
+ // original: false,
1378
+ // isTreeAllExpanded: false,
1379
+ // isRowGroupAllExpanded: false,
1380
+ // data: null,
1381
+ // remote: false,
1382
+ // dataFilterMethod: null,
1383
+ // footerFilterMethod: null,
1384
+ // exportMethod: null,
1385
+ // columnFilterMethod: null,
1386
+ // beforeExportMethod: null,
1387
+ // afterExportMethod: null
1388
+ },
1389
+ exportOpts,
1390
+ options
1391
+ );
1376
1392
  if (XEUtils.isBoolean(opts.isAllExpand)) {
1377
1393
  warnLog("vxe.error.delProp", ["isAllExpand", "isTreeAllExpanded"]);
1378
1394
  opts.isTreeAllExpanded = opts.isAllExpand;
@@ -1411,23 +1427,27 @@ hooks.add("tableExportModule", {
1411
1427
  isCustomCol = true;
1412
1428
  customCols = XEUtils.searchTree(columns, () => true, { children: "children", mapChildren: "childNodes", original: true });
1413
1429
  } else {
1414
- customCols = XEUtils.searchTree(collectColumn, (column) => {
1415
- const isColGroup = column.children && column.children.length > 0;
1416
- let isChecked = false;
1417
- const isExtraChecked = extraFdMaps[column.field];
1418
- if (columns) {
1419
- isChecked = handleFilterColumns(opts, column, columns);
1420
- } else if (excludeFields || includeFields) {
1421
- isChecked = handleFilterFields(opts, column, includeFields, includeFdMaps, excludeFdMaps, extraFdMaps);
1422
- } else {
1423
- if (isExtraChecked) {
1424
- isChecked = true;
1430
+ customCols = XEUtils.searchTree(
1431
+ collectColumn,
1432
+ (column) => {
1433
+ const isColGroup = column.children && column.children.length > 0;
1434
+ let isChecked = false;
1435
+ const isExtraChecked = extraFdMaps[column.field];
1436
+ if (columns) {
1437
+ isChecked = handleFilterColumns(opts, column, columns);
1438
+ } else if (excludeFields || includeFields) {
1439
+ isChecked = handleFilterFields(opts, column, includeFields, includeFdMaps, excludeFdMaps, extraFdMaps);
1425
1440
  } else {
1426
- isChecked = column.visible && (isColGroup || defaultFilterExportColumn(column));
1441
+ if (isExtraChecked) {
1442
+ isChecked = true;
1443
+ } else {
1444
+ isChecked = column.visible && (isColGroup || defaultFilterExportColumn(column));
1445
+ }
1427
1446
  }
1428
- }
1429
- return isChecked;
1430
- }, { children: "children", mapChildren: "childNodes", original: true });
1447
+ return isChecked;
1448
+ },
1449
+ { children: "children", mapChildren: "childNodes", original: true }
1450
+ );
1431
1451
  }
1432
1452
  const handleOptions = Object.assign({}, opts, { filename: "", sheetName: "", _columnConfs: columns });
1433
1453
  if (!isCustomCol && !columnFilterMethod) {
@@ -1437,33 +1457,37 @@ hooks.add("tableExportModule", {
1437
1457
  if (customCols) {
1438
1458
  handleOptions._isCustomColumn = true;
1439
1459
  groups = XEUtils.searchTree(
1440
- XEUtils.mapTree(customCols, (item) => {
1441
- let targetColumn;
1442
- if (item) {
1443
- if (isColumnInfo(item)) {
1444
- targetColumn = item;
1445
- } else if (XEUtils.isString(item)) {
1446
- targetColumn = $xeTable.getColumnByField(item);
1447
- } else {
1448
- const colid = item.id || item.colId;
1449
- const type2 = item.type;
1450
- const field = item.field;
1451
- if (colid) {
1452
- targetColumn = $xeTable.getColumnById(colid);
1453
- } else if (field && type2) {
1454
- targetColumn = tableFullColumn.find((column) => column.field === field && column.type === type2);
1455
- } else if (field) {
1456
- targetColumn = $xeTable.getColumnByField(field);
1457
- } else if (type2) {
1458
- targetColumn = tableFullColumn.find((column) => column.type === type2);
1460
+ XEUtils.mapTree(
1461
+ customCols,
1462
+ (item) => {
1463
+ let targetColumn;
1464
+ if (item) {
1465
+ if (isColumnInfo(item)) {
1466
+ targetColumn = item;
1467
+ } else if (XEUtils.isString(item)) {
1468
+ targetColumn = $xeTable.getColumnByField(item);
1469
+ } else {
1470
+ const colid = item.id || item.colId;
1471
+ const type2 = item.type;
1472
+ const field = item.field;
1473
+ if (colid) {
1474
+ targetColumn = $xeTable.getColumnById(colid);
1475
+ } else if (field && type2) {
1476
+ targetColumn = tableFullColumn.find((column) => column.field === field && column.type === type2);
1477
+ } else if (field) {
1478
+ targetColumn = $xeTable.getColumnByField(field);
1479
+ } else if (type2) {
1480
+ targetColumn = tableFullColumn.find((column) => column.type === type2);
1481
+ }
1459
1482
  }
1483
+ return targetColumn || {};
1460
1484
  }
1461
- return targetColumn || {};
1485
+ },
1486
+ {
1487
+ children: "childNodes",
1488
+ mapChildren: "_children"
1462
1489
  }
1463
- }, {
1464
- children: "childNodes",
1465
- mapChildren: "_children"
1466
- }),
1490
+ ),
1467
1491
  (column, index) => isColumnInfo(column) && (!columnFilterMethod || columnFilterMethod({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, column, $columnIndex: index })),
1468
1492
  {
1469
1493
  children: "_children",
@@ -1472,15 +1496,23 @@ hooks.add("tableExportModule", {
1472
1496
  }
1473
1497
  );
1474
1498
  } else {
1475
- groups = XEUtils.searchTree(isGroup ? collectColumn : tableFullColumn, (column, index) => column.visible && (!columnFilterMethod || columnFilterMethod({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, column, $columnIndex: index })), { children: "children", mapChildren: "childNodes", original: true });
1499
+ groups = XEUtils.searchTree(isGroup ? collectColumn : tableFullColumn, (column, index) => column.visible && (!columnFilterMethod || columnFilterMethod({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, column, $columnIndex: index })), {
1500
+ children: "children",
1501
+ mapChildren: "childNodes",
1502
+ original: true
1503
+ });
1476
1504
  }
1477
1505
  const cols = [];
1478
- XEUtils.eachTree(groups, (column) => {
1479
- const isColGroup = column.children && column.children.length;
1480
- if (!isColGroup) {
1481
- cols.push(column);
1482
- }
1483
- }, { children: "childNodes" });
1506
+ XEUtils.eachTree(
1507
+ groups,
1508
+ (column) => {
1509
+ const isColGroup = column.children && column.children.length;
1510
+ if (!isColGroup) {
1511
+ cols.push(column);
1512
+ }
1513
+ },
1514
+ { children: "childNodes" }
1515
+ );
1484
1516
  handleOptions.columns = cols;
1485
1517
  handleOptions.colgroups = convertToRows(groups);
1486
1518
  if (filename) {
@@ -1645,11 +1677,15 @@ hooks.add("tableExportModule", {
1645
1677
  },
1646
1678
  importData(options) {
1647
1679
  const importOpts = computeImportOpts.value;
1648
- const opts = Object.assign({
1649
- types: XEUtils.keys(importOpts._typeMaps)
1650
- // beforeImportMethod: null,
1651
- // afterImportMethod: null
1652
- }, importOpts, options);
1680
+ const opts = Object.assign(
1681
+ {
1682
+ types: XEUtils.keys(importOpts._typeMaps)
1683
+ // beforeImportMethod: null,
1684
+ // afterImportMethod: null
1685
+ },
1686
+ importOpts,
1687
+ options
1688
+ );
1653
1689
  const { beforeImportMethod, afterImportMethod } = opts;
1654
1690
  if (beforeImportMethod) {
1655
1691
  const biRest = beforeImportMethod({ options: opts, $table: $xeTable });
@@ -1682,15 +1718,20 @@ hooks.add("tableExportModule", {
1682
1718
  const $xeGrid = $xeTable.xeGrid;
1683
1719
  const $xeGantt = $xeTable.xeGantt;
1684
1720
  const printOpts = computePrintOpts.value;
1685
- const opts = Object.assign({
1686
- original: false
1687
- // beforePrintMethod
1688
- }, printOpts, options, {
1689
- type: "html",
1690
- download: false,
1691
- remote: false,
1692
- print: true
1693
- });
1721
+ const opts = Object.assign(
1722
+ {
1723
+ original: false
1724
+ // beforePrintMethod
1725
+ },
1726
+ printOpts,
1727
+ options,
1728
+ {
1729
+ type: "html",
1730
+ download: false,
1731
+ remote: false,
1732
+ print: true
1733
+ }
1734
+ );
1694
1735
  const { sheetName } = opts;
1695
1736
  let printTitle = "";
1696
1737
  if (sheetName) {
@@ -1801,15 +1842,20 @@ hooks.add("tableExportModule", {
1801
1842
  },
1802
1843
  getPrintHtml(options) {
1803
1844
  const printOpts = computePrintOpts.value;
1804
- const opts = Object.assign({
1805
- original: false
1806
- // beforePrintMethod
1807
- }, printOpts, options, {
1808
- type: "html",
1809
- download: false,
1810
- remote: false,
1811
- print: true
1812
- });
1845
+ const opts = Object.assign(
1846
+ {
1847
+ original: false
1848
+ // beforePrintMethod
1849
+ },
1850
+ printOpts,
1851
+ options,
1852
+ {
1853
+ type: "html",
1854
+ download: false,
1855
+ remote: false,
1856
+ print: true
1857
+ }
1858
+ );
1813
1859
  return $xeTable.exportData(opts).then(({ content }) => {
1814
1860
  return {
1815
1861
  html: content
@@ -1826,12 +1872,16 @@ hooks.add("tableExportModule", {
1826
1872
  const { treeConfig, importConfig } = props;
1827
1873
  const { initStore, importStore, importParams } = reactData;
1828
1874
  const importOpts = computeImportOpts.value;
1829
- const defOpts = Object.assign({
1830
- mode: "insertTop",
1831
- message: true,
1832
- types: XEUtils.keys(importOpts._typeMaps),
1833
- modes: ["insertTop", "covering"]
1834
- }, importOpts, options);
1875
+ const defOpts = Object.assign(
1876
+ {
1877
+ mode: "insertTop",
1878
+ message: true,
1879
+ types: XEUtils.keys(importOpts._typeMaps),
1880
+ modes: ["insertTop", "covering"]
1881
+ },
1882
+ importOpts,
1883
+ options
1884
+ );
1835
1885
  const types = defOpts.types || [];
1836
1886
  const modes = defOpts.modes || [];
1837
1887
  const isTree = !!treeConfig;
@@ -1882,10 +1932,14 @@ hooks.add("tableExportModule", {
1882
1932
  openExport(options) {
1883
1933
  const { exportConfig } = props;
1884
1934
  const exportOpts = computeExportOpts.value;
1885
- const defOpts = Object.assign({
1886
- message: true,
1887
- types: XEUtils.keys(exportOpts._typeMaps)
1888
- }, exportOpts, options);
1935
+ const defOpts = Object.assign(
1936
+ {
1937
+ message: true,
1938
+ types: XEUtils.keys(exportOpts._typeMaps)
1939
+ },
1940
+ exportOpts,
1941
+ options
1942
+ );
1889
1943
  if (!hasEnableConf(exportConfig, exportOpts)) {
1890
1944
  errLog("vxe.error.reqProp", ["export-config"]);
1891
1945
  }
@@ -1895,9 +1949,13 @@ hooks.add("tableExportModule", {
1895
1949
  openPrint(options) {
1896
1950
  const { printConfig } = props;
1897
1951
  const printOpts = computePrintOpts.value;
1898
- const defOpts = Object.assign({
1899
- message: true
1900
- }, printOpts, options);
1952
+ const defOpts = Object.assign(
1953
+ {
1954
+ message: true
1955
+ },
1956
+ printOpts,
1957
+ options
1958
+ );
1901
1959
  if (!hasEnableConf(printConfig, printOpts)) {
1902
1960
  errLog("vxe.error.reqProp", ["print-config"]);
1903
1961
  }