vxe-table 4.7.86 → 4.7.88

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.
@@ -391,13 +391,13 @@ var _default = exports.default = (0, _vue.defineComponent)({
391
391
  return '';
392
392
  });
393
393
  const computeValidOpts = (0, _vue.computed)(() => {
394
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.validConfig, true), props.validConfig);
394
+ return Object.assign({}, getConfig().table.validConfig, props.validConfig);
395
395
  });
396
396
  const computeSXOpts = (0, _vue.computed)(() => {
397
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.scrollX, true), props.scrollX);
397
+ return Object.assign({}, getConfig().table.scrollX, props.scrollX);
398
398
  });
399
399
  const computeSYOpts = (0, _vue.computed)(() => {
400
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.scrollY, true), props.scrollY);
400
+ return Object.assign({}, getConfig().table.scrollY, props.scrollY);
401
401
  });
402
402
  const computeRowHeightMaps = (0, _vue.computed)(() => {
403
403
  return {
@@ -408,31 +408,31 @@ var _default = exports.default = (0, _vue.defineComponent)({
408
408
  };
409
409
  });
410
410
  const computeColumnOpts = (0, _vue.computed)(() => {
411
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.columnConfig, true), props.columnConfig);
411
+ return Object.assign({}, getConfig().table.columnConfig, props.columnConfig);
412
412
  });
413
413
  const computeRowOpts = (0, _vue.computed)(() => {
414
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.rowConfig, true), props.rowConfig);
414
+ return Object.assign({}, getConfig().table.rowConfig, props.rowConfig);
415
415
  });
416
416
  const computeResizeOpts = (0, _vue.computed)(() => {
417
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.resizeConfig, true), props.resizeConfig);
417
+ return Object.assign({}, getConfig().table.resizeConfig, props.resizeConfig);
418
418
  });
419
419
  const computeResizableOpts = (0, _vue.computed)(() => {
420
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.resizableConfig, true), props.resizableConfig);
420
+ return Object.assign({}, getConfig().table.resizableConfig, props.resizableConfig);
421
421
  });
422
422
  const computeSeqOpts = (0, _vue.computed)(() => {
423
423
  return Object.assign({
424
424
  startIndex: 0
425
- }, _xeUtils.default.clone(getConfig().table.seqConfig, true), props.seqConfig);
425
+ }, getConfig().table.seqConfig, props.seqConfig);
426
426
  });
427
427
  const computeRadioOpts = (0, _vue.computed)(() => {
428
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.radioConfig, true), props.radioConfig);
428
+ return Object.assign({}, getConfig().table.radioConfig, props.radioConfig);
429
429
  });
430
430
  const computeCheckboxOpts = (0, _vue.computed)(() => {
431
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.checkboxConfig, true), props.checkboxConfig);
431
+ return Object.assign({}, getConfig().table.checkboxConfig, props.checkboxConfig);
432
432
  });
433
433
  let computeTooltipOpts = (0, _vue.ref)();
434
434
  computeTooltipOpts = (0, _vue.computed)(() => {
435
- return Object.assign({}, _xeUtils.default.clone(getConfig().tooltip, true), _xeUtils.default.clone(getConfig().table.tooltipConfig, true), props.tooltipConfig);
435
+ return Object.assign({}, getConfig().tooltip, getConfig().table.tooltipConfig, props.tooltipConfig);
436
436
  });
437
437
  const computeTipConfig = (0, _vue.computed)(() => {
438
438
  const tooltipOpts = computeTooltipOpts.value;
@@ -445,33 +445,33 @@ var _default = exports.default = (0, _vue.defineComponent)({
445
445
  }, tooltipOpts);
446
446
  });
447
447
  const computeEditOpts = (0, _vue.computed)(() => {
448
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.editConfig, true), props.editConfig);
448
+ return Object.assign({}, getConfig().table.editConfig, props.editConfig);
449
449
  });
450
450
  const computeSortOpts = (0, _vue.computed)(() => {
451
451
  return Object.assign({
452
452
  orders: ['asc', 'desc', null]
453
- }, _xeUtils.default.clone(getConfig().table.sortConfig, true), props.sortConfig);
453
+ }, getConfig().table.sortConfig, props.sortConfig);
454
454
  });
455
455
  const computeFilterOpts = (0, _vue.computed)(() => {
456
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.filterConfig, true), props.filterConfig);
456
+ return Object.assign({}, getConfig().table.filterConfig, props.filterConfig);
457
457
  });
458
458
  const computeMouseOpts = (0, _vue.computed)(() => {
459
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.mouseConfig, true), props.mouseConfig);
459
+ return Object.assign({}, getConfig().table.mouseConfig, props.mouseConfig);
460
460
  });
461
461
  const computeAreaOpts = (0, _vue.computed)(() => {
462
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.areaConfig, true), props.areaConfig);
462
+ return Object.assign({}, getConfig().table.areaConfig, props.areaConfig);
463
463
  });
464
464
  const computeKeyboardOpts = (0, _vue.computed)(() => {
465
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.keyboardConfig, true), props.keyboardConfig);
465
+ return Object.assign({}, getConfig().table.keyboardConfig, props.keyboardConfig);
466
466
  });
467
467
  const computeClipOpts = (0, _vue.computed)(() => {
468
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.clipConfig, true), props.clipConfig);
468
+ return Object.assign({}, getConfig().table.clipConfig, props.clipConfig);
469
469
  });
470
470
  const computeFNROpts = (0, _vue.computed)(() => {
471
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.fnrConfig, true), props.fnrConfig);
471
+ return Object.assign({}, getConfig().table.fnrConfig, props.fnrConfig);
472
472
  });
473
473
  const computeMenuOpts = (0, _vue.computed)(() => {
474
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.menuConfig, true), props.menuConfig);
474
+ return Object.assign({}, getConfig().table.menuConfig, props.menuConfig);
475
475
  });
476
476
  const computeHeaderMenu = (0, _vue.computed)(() => {
477
477
  const menuOpts = computeMenuOpts.value;
@@ -508,31 +508,31 @@ var _default = exports.default = (0, _vue.defineComponent)({
508
508
  return rest;
509
509
  });
510
510
  const computeExportOpts = (0, _vue.computed)(() => {
511
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.exportConfig, true), props.exportConfig);
511
+ return Object.assign({}, getConfig().table.exportConfig, props.exportConfig);
512
512
  });
513
513
  const computeImportOpts = (0, _vue.computed)(() => {
514
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.importConfig, true), props.importConfig);
514
+ return Object.assign({}, getConfig().table.importConfig, props.importConfig);
515
515
  });
516
516
  const computePrintOpts = (0, _vue.computed)(() => {
517
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.printConfig, true), props.printConfig);
517
+ return Object.assign({}, getConfig().table.printConfig, props.printConfig);
518
518
  });
519
519
  const computeExpandOpts = (0, _vue.computed)(() => {
520
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.expandConfig, true), props.expandConfig);
520
+ return Object.assign({}, getConfig().table.expandConfig, props.expandConfig);
521
521
  });
522
522
  const computeTreeOpts = (0, _vue.computed)(() => {
523
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.treeConfig, true), props.treeConfig);
523
+ return Object.assign({}, getConfig().table.treeConfig, props.treeConfig);
524
524
  });
525
525
  const computeEmptyOpts = (0, _vue.computed)(() => {
526
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.emptyRender, true), props.emptyRender);
526
+ return Object.assign({}, getConfig().table.emptyRender, props.emptyRender);
527
527
  });
528
528
  const computeLoadingOpts = (0, _vue.computed)(() => {
529
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.loadingConfig, true), props.loadingConfig);
529
+ return Object.assign({}, getConfig().table.loadingConfig, props.loadingConfig);
530
530
  });
531
531
  const computeCellOffsetWidth = (0, _vue.computed)(() => {
532
532
  return props.border ? Math.max(2, Math.ceil(reactData.scrollbarWidth / reactData.tableColumn.length)) : 1;
533
533
  });
534
534
  const computeCustomOpts = (0, _vue.computed)(() => {
535
- return Object.assign({}, _xeUtils.default.clone(getConfig().table.customConfig, true), props.customConfig);
535
+ return Object.assign({}, getConfig().table.customConfig, props.customConfig);
536
536
  });
537
537
  const computeAutoWidthColumnList = (0, _vue.computed)(() => {
538
538
  const {
@@ -807,7 +807,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
807
807
  visibleSize: 8
808
808
  };
809
809
  };
810
- const calculateMergerOffserIndex = (list, offsetItem, type) => {
810
+ const calculateMergerOffsetIndex = (list, offsetItem, type) => {
811
811
  for (let mcIndex = 0, len = list.length; mcIndex < len; mcIndex++) {
812
812
  const mergeItem = list[mcIndex];
813
813
  const {
@@ -1190,7 +1190,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
1190
1190
  });
1191
1191
  } else {
1192
1192
  const labelEl = cellEl.firstChild;
1193
- titleWidth = labelEl.offsetWidth;
1193
+ if (labelEl) {
1194
+ titleWidth = labelEl.offsetWidth;
1195
+ }
1194
1196
  }
1195
1197
  if (titleWidth) {
1196
1198
  colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
@@ -1470,6 +1472,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1470
1472
  treeExpandedMaps
1471
1473
  } = reactData;
1472
1474
  const treeOpts = computeTreeOpts.value;
1475
+ const childrenField = treeOpts.children || treeOpts.childrenField;
1473
1476
  if (treeConfig && treeOpts.transform) {
1474
1477
  const fullData = [];
1475
1478
  const expandMaps = {};
@@ -1481,7 +1484,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1481
1484
  fullData.push(row);
1482
1485
  }
1483
1486
  }, {
1484
- children: treeOpts.mapChildrenField
1487
+ children: childrenField
1485
1488
  });
1486
1489
  internalData.afterFullData = fullData;
1487
1490
  updateScrollYStatus(fullData);
@@ -1505,6 +1508,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1505
1508
  const filterOpts = computeFilterOpts.value;
1506
1509
  const sortOpts = computeSortOpts.value;
1507
1510
  const treeOpts = computeTreeOpts.value;
1511
+ const childrenField = treeOpts.children || treeOpts.childrenField;
1508
1512
  const {
1509
1513
  transform
1510
1514
  } = treeOpts;
@@ -1619,9 +1623,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
1619
1623
  };
1620
1624
  if (treeConfig && transform) {
1621
1625
  // 筛选虚拟树
1622
- tableTree = _xeUtils.default.searchTree(tableFullTreeData, handleFilter, Object.assign(Object.assign({}, treeOpts), {
1623
- original: true
1624
- }));
1626
+ tableTree = _xeUtils.default.searchTree(tableFullTreeData, handleFilter, {
1627
+ original: true,
1628
+ isEvery: true,
1629
+ children: treeOpts.mapChildrenField,
1630
+ mapChildren: childrenField
1631
+ });
1625
1632
  tableData = tableTree;
1626
1633
  } else {
1627
1634
  tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
@@ -1630,9 +1637,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
1630
1637
  } else {
1631
1638
  if (treeConfig && transform) {
1632
1639
  // 还原虚拟树
1633
- tableTree = _xeUtils.default.searchTree(tableFullTreeData, () => true, Object.assign(Object.assign({}, treeOpts), {
1634
- original: true
1635
- }));
1640
+ tableTree = _xeUtils.default.searchTree(tableFullTreeData, () => true, {
1641
+ original: true,
1642
+ isEvery: true,
1643
+ children: treeOpts.mapChildrenField,
1644
+ mapChildren: childrenField
1645
+ });
1636
1646
  tableData = tableTree;
1637
1647
  } else {
1638
1648
  tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
@@ -1678,9 +1688,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
1678
1688
  } else {
1679
1689
  if (treeConfig && transform) {
1680
1690
  // 还原虚拟树
1681
- tableTree = _xeUtils.default.searchTree(tableFullTreeData, () => true, Object.assign(Object.assign({}, treeOpts), {
1682
- original: true
1683
- }));
1691
+ tableTree = _xeUtils.default.searchTree(tableFullTreeData, () => true, {
1692
+ original: true,
1693
+ isEvery: true,
1694
+ children: treeOpts.mapChildrenField,
1695
+ mapChildren: childrenField
1696
+ });
1684
1697
  tableData = tableTree;
1685
1698
  } else {
1686
1699
  tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
@@ -2779,7 +2792,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
2779
2792
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
2780
2793
  endIndex: toVisibleIndex + visibleSize + offsetSize
2781
2794
  };
2782
- calculateMergerOffserIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
2795
+ calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
2783
2796
  const {
2784
2797
  startIndex: offsetStartIndex,
2785
2798
  endIndex: offsetEndIndex
@@ -3113,7 +3126,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
3113
3126
  startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
3114
3127
  endIndex: toVisibleIndex + visibleSize + offsetSize
3115
3128
  };
3116
- calculateMergerOffserIndex(mergeList, offsetItem, 'row');
3129
+ calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
3117
3130
  const {
3118
3131
  startIndex: offsetStartIndex,
3119
3132
  endIndex: offsetEndIndex
@@ -6249,8 +6262,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
6249
6262
  treeConfig
6250
6263
  } = props;
6251
6264
  const treeOpts = computeTreeOpts.value;
6252
- let {
6253
- fullDataRowIdData,
6265
+ const {
6254
6266
  fullAllDataRowIdData,
6255
6267
  tableFullData,
6256
6268
  tableFullTreeData
@@ -6259,6 +6271,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
6259
6271
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
6260
6272
  const rowkey = (0, _util.getRowkey)($xeTable);
6261
6273
  const isLazy = treeConfig && treeOpts.lazy;
6274
+ const fullAllDataRowIdMaps = {};
6275
+ const fullDataRowIdMaps = {};
6262
6276
  const handleRow = (row, index, items, path, parent, nodes) => {
6263
6277
  let rowid = (0, _util.getRowid)($xeTable, row);
6264
6278
  const seq = treeConfig && path ? (0, _util.toTreePathSeq)(path) : index + 1;
@@ -6270,26 +6284,30 @@ var _default = exports.default = (0, _vue.defineComponent)({
6270
6284
  if (isLazy && row[hasChildField] && _xeUtils.default.isUndefined(row[childrenField])) {
6271
6285
  row[childrenField] = null;
6272
6286
  }
6273
- const rest = {
6274
- row,
6275
- rowid,
6276
- seq,
6277
- index: treeConfig && parent ? -1 : index,
6278
- _index: -1,
6279
- $index: -1,
6280
- items,
6281
- parent,
6282
- level
6283
- };
6287
+ let cacheItem = fullAllDataRowIdData[rowid];
6288
+ if (!cacheItem) {
6289
+ cacheItem = {
6290
+ row,
6291
+ rowid,
6292
+ seq,
6293
+ index: -1,
6294
+ _index: -1,
6295
+ $index: -1,
6296
+ items,
6297
+ parent,
6298
+ level
6299
+ };
6300
+ }
6284
6301
  if (isSource) {
6285
- fullDataRowIdData[rowid] = rest;
6302
+ cacheItem.index = treeConfig && parent ? -1 : index;
6303
+ fullDataRowIdMaps[rowid] = cacheItem;
6286
6304
  }
6287
- fullAllDataRowIdData[rowid] = rest;
6305
+ fullAllDataRowIdMaps[rowid] = cacheItem;
6288
6306
  };
6289
6307
  if (isSource) {
6290
- fullDataRowIdData = internalData.fullDataRowIdData = {};
6308
+ internalData.fullDataRowIdData = fullDataRowIdMaps;
6291
6309
  }
6292
- fullAllDataRowIdData = internalData.fullAllDataRowIdData = {};
6310
+ internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
6293
6311
  if (treeConfig) {
6294
6312
  _xeUtils.default.eachTree(tableFullTreeData, handleRow, {
6295
6313
  children: childrenField