vxe-table 4.12.0-beta.20 → 4.12.0-beta.21

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 (41) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/edit/hook.js +8 -10
  3. package/es/table/module/validator/hook.js +2 -2
  4. package/es/table/src/body.js +10 -10
  5. package/es/table/src/cell.js +15 -11
  6. package/es/table/src/table.js +255 -234
  7. package/es/table/src/util.js +2 -2
  8. package/es/ui/index.js +1 -1
  9. package/es/ui/src/log.js +1 -1
  10. package/lib/index.umd.js +127 -117
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/style.css +1 -1
  13. package/lib/table/module/edit/hook.js +10 -11
  14. package/lib/table/module/edit/hook.min.js +1 -1
  15. package/lib/table/module/validator/hook.js +3 -3
  16. package/lib/table/module/validator/hook.min.js +1 -1
  17. package/lib/table/src/body.js +16 -11
  18. package/lib/table/src/body.min.js +1 -1
  19. package/lib/table/src/cell.js +22 -13
  20. package/lib/table/src/cell.min.js +1 -1
  21. package/lib/table/src/table.js +333 -265
  22. package/lib/table/src/table.min.js +1 -1
  23. package/lib/table/src/util.js +2 -2
  24. package/lib/table/src/util.min.js +1 -1
  25. package/lib/ui/index.js +1 -1
  26. package/lib/ui/index.min.js +1 -1
  27. package/lib/ui/src/log.js +1 -1
  28. package/lib/ui/src/log.min.js +1 -1
  29. package/package.json +2 -2
  30. package/packages/table/module/edit/hook.ts +8 -10
  31. package/packages/table/module/validator/hook.ts +2 -2
  32. package/packages/table/src/body.ts +10 -10
  33. package/packages/table/src/cell.ts +15 -11
  34. package/packages/table/src/table.ts +257 -233
  35. package/packages/table/src/util.ts +2 -2
  36. /package/es/{iconfont.1742353689933.ttf → iconfont.1742437957812.ttf} +0 -0
  37. /package/es/{iconfont.1742353689933.woff → iconfont.1742437957812.woff} +0 -0
  38. /package/es/{iconfont.1742353689933.woff2 → iconfont.1742437957812.woff2} +0 -0
  39. /package/lib/{iconfont.1742353689933.ttf → iconfont.1742437957812.ttf} +0 -0
  40. /package/lib/{iconfont.1742353689933.woff → iconfont.1742437957812.woff} +0 -0
  41. /package/lib/{iconfont.1742353689933.woff2 → iconfont.1742437957812.woff2} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, TransitionGroup, h, ref, inject, nextTick, onMounted, onUnmounted } from 'vue';
2
2
  import XEUtils from 'xe-utils';
3
3
  import { VxeUI } from '../../ui';
4
- import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid } from './util';
4
+ import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid, createHandleGetRowId } from './util';
5
5
  import { updateCellTitle, getPropClass } from '../../ui/src/dom';
6
6
  import { isEnableConf } from '../../ui/src/utils';
7
7
  import { getSlotVNs } from '../../ui/src/vn';
@@ -36,7 +36,7 @@ export default defineComponent({
36
36
  const { lastScrollTime, isDragResize } = tableReactData;
37
37
  return !!(isDragResize || (lastScrollTime && Date.now() < lastScrollTime + delayHover));
38
38
  };
39
- const renderLine = (params, cellHeight) => {
39
+ const renderLine = (rowid, params, cellHeight) => {
40
40
  const { row, column } = params;
41
41
  const { afterFullData } = tableInternalData;
42
42
  const { treeConfig } = tableProps;
@@ -46,7 +46,6 @@ export default defineComponent({
46
46
  if (slots && slots.line) {
47
47
  return $xeTable.callSlot(slots.line, params);
48
48
  }
49
- const rowid = getRowid($xeTable, row);
50
49
  const rest = fullAllDataRowIdData[rowid];
51
50
  let rLevel = 0;
52
51
  let prevRow = null;
@@ -283,7 +282,7 @@ export default defineComponent({
283
282
  }
284
283
  else {
285
284
  // 渲染单元格
286
- tdVNs.push(...renderLine(cellParams, cellHeight), h('div', {
285
+ tdVNs.push(...renderLine(rowid, cellParams, cellHeight), h('div', {
287
286
  key: 'tc',
288
287
  class: ['vxe-cell', {
289
288
  'c--title': showTitle,
@@ -386,8 +385,8 @@ export default defineComponent({
386
385
  };
387
386
  const renderRows = (fixedType, isOptimizeMode, tableData, tableColumn) => {
388
387
  const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps;
389
- const { hasFixedColumn, treeExpandedMaps, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove, rowExpandHeightFlag } = tableReactData;
390
- const { fullAllDataRowIdData } = tableInternalData;
388
+ const { hasFixedColumn, treeExpandedFlag, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, isDragColMove, rowExpandHeightFlag } = tableReactData;
389
+ const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps } = tableInternalData;
391
390
  const checkboxOpts = computeCheckboxOpts.value;
392
391
  const radioOpts = computeRadioOpts.value;
393
392
  const treeOpts = computeTreeOpts.value;
@@ -398,6 +397,7 @@ export default defineComponent({
398
397
  const { transform, seqMode } = treeOpts;
399
398
  const childrenField = treeOpts.children || treeOpts.childrenField;
400
399
  const rows = [];
400
+ const { handleGetRowId } = createHandleGetRowId($xeTable);
401
401
  tableData.forEach((row, $rowIndex) => {
402
402
  const trOn = {};
403
403
  let rowIndex = $rowIndex;
@@ -418,7 +418,7 @@ export default defineComponent({
418
418
  $xeTable.clearHoverRow();
419
419
  };
420
420
  }
421
- const rowid = getRowid($xeTable, row);
421
+ const rowid = handleGetRowId(row);
422
422
  const rowRest = fullAllDataRowIdData[rowid];
423
423
  let rowLevel = 0;
424
424
  let seq = -1;
@@ -435,7 +435,7 @@ export default defineComponent({
435
435
  }
436
436
  const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex };
437
437
  // 行是否被展开
438
- const isExpandRow = expandColumn && !!rowExpandedMaps[rowid];
438
+ const isExpandRow = expandColumn && !!rowExpandedFlag && !!rowExpandedMaps[rowid];
439
439
  // 树节点是否被展开
440
440
  let isExpandTree = false;
441
441
  let rowChildren = [];
@@ -445,7 +445,7 @@ export default defineComponent({
445
445
  }
446
446
  if (treeConfig && !scrollYLoad && !transform) {
447
447
  rowChildren = row[childrenField];
448
- isExpandTree = rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
448
+ isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
449
449
  }
450
450
  // 拖拽行事件
451
451
  if (rowOpts.drag && (!treeConfig || transform)) {
@@ -464,7 +464,7 @@ export default defineComponent({
464
464
  'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
465
465
  'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
466
466
  'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
467
- 'row--pending': !!pendingRowMaps[rowid]
467
+ 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
468
468
  },
469
469
  getPropClass(rowClassName, params)
470
470
  ];
@@ -380,8 +380,8 @@ export const Cell = {
380
380
  const tableReactData = $table.reactData;
381
381
  const tableInternalData = $table.internalData;
382
382
  const { computeTreeOpts } = $table.getComputeMaps();
383
- const { treeExpandedMaps, treeExpandLazyLoadedMaps } = tableReactData;
384
- const { fullAllDataRowIdData } = tableInternalData;
383
+ const { treeExpandedFlag } = tableReactData;
384
+ const { fullAllDataRowIdData, treeExpandedMaps, treeExpandLazyLoadedMaps } = tableInternalData;
385
385
  const treeOpts = computeTreeOpts.value;
386
386
  const { row, column, level } = params;
387
387
  const { slots } = column;
@@ -401,7 +401,7 @@ export const Cell = {
401
401
  }
402
402
  if (!isHidden) {
403
403
  const rowid = getRowid($table, row);
404
- isActive = !!treeExpandedMaps[rowid];
404
+ isActive = !!treeExpandedFlag && !!treeExpandedMaps[rowid];
405
405
  if (lazy) {
406
406
  const rest = fullAllDataRowIdData[rowid];
407
407
  isLazyLoading = !!treeExpandLazyLoadedMaps[rowid];
@@ -591,8 +591,10 @@ export const Cell = {
591
591
  const { $table, row, column, isHidden } = params;
592
592
  const tableProps = $table.props;
593
593
  const tableReactData = $table.reactData;
594
+ const tableInternalData = $table.internalData;
594
595
  const { treeConfig } = tableProps;
595
- const { selectCheckboxMaps, treeIndeterminateMaps } = tableReactData;
596
+ const { updateCheckboxFlag } = tableReactData;
597
+ const { selectCheckboxMaps, treeIndeterminateRowMaps } = tableInternalData;
596
598
  const { computeCheckboxOpts } = $table.getComputeMaps();
597
599
  const checkboxOpts = computeCheckboxOpts.value;
598
600
  const { labelField, checkMethod, visibleMethod } = checkboxOpts;
@@ -606,7 +608,7 @@ export const Cell = {
606
608
  const ons = {};
607
609
  if (!isHidden) {
608
610
  const rowid = getRowid($table, row);
609
- isChecked = !!selectCheckboxMaps[rowid];
611
+ isChecked = !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
610
612
  ons.onClick = (evnt) => {
611
613
  if (!isDisabled && isVisible) {
612
614
  $table.triggerCheckRowEvent(evnt, params, !isChecked);
@@ -616,7 +618,7 @@ export const Cell = {
616
618
  isDisabled = !checkMethod({ row });
617
619
  }
618
620
  if (treeConfig) {
619
- indeterminate = !!treeIndeterminateMaps[rowid];
621
+ indeterminate = !!treeIndeterminateRowMaps[rowid];
620
622
  }
621
623
  }
622
624
  const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate });
@@ -650,8 +652,10 @@ export const Cell = {
650
652
  const { $table, row, column, isHidden } = params;
651
653
  const tableProps = $table.props;
652
654
  const tableReactData = $table.reactData;
655
+ const tableInternalData = $table.internalData;
653
656
  const { treeConfig } = tableProps;
654
- const { treeIndeterminateMaps } = tableReactData;
657
+ const { updateCheckboxFlag } = tableReactData;
658
+ const { treeIndeterminateRowMaps } = tableInternalData;
655
659
  const { computeCheckboxOpts } = $table.getComputeMaps();
656
660
  const checkboxOpts = computeCheckboxOpts.value;
657
661
  const { labelField, checkField, checkMethod, visibleMethod } = checkboxOpts;
@@ -666,7 +670,7 @@ export const Cell = {
666
670
  const ons = {};
667
671
  if (!isHidden) {
668
672
  const rowid = getRowid($table, row);
669
- isChecked = XEUtils.get(row, checkField);
673
+ isChecked = !!updateCheckboxFlag && XEUtils.get(row, checkField);
670
674
  ons.onClick = (evnt) => {
671
675
  if (!isDisabled && isVisible) {
672
676
  $table.triggerCheckRowEvent(evnt, params, !isChecked);
@@ -676,7 +680,7 @@ export const Cell = {
676
680
  isDisabled = !checkMethod({ row });
677
681
  }
678
682
  if (treeConfig) {
679
- isIndeterminate = !!treeIndeterminateMaps[rowid];
683
+ isIndeterminate = !!treeIndeterminateRowMaps[rowid];
680
684
  }
681
685
  }
682
686
  const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate: isIndeterminate });
@@ -711,8 +715,8 @@ export const Cell = {
711
715
  */
712
716
  renderExpandCell(params) {
713
717
  const { $table, isHidden, row, column } = params;
714
- const tableReactData = $table.reactData;
715
- const { rowExpandedMaps, rowExpandLazyLoadedMaps } = tableReactData;
718
+ const tableInternalData = $table.internalData;
719
+ const { rowExpandedMaps, rowExpandLazyLoadedMaps } = tableInternalData;
716
720
  const { computeExpandOpts } = $table.getComputeMaps();
717
721
  const expandOpts = computeExpandOpts.value;
718
722
  const { lazy, labelField, iconLoaded, showIcon, iconOpen, iconClose, visibleMethod } = expandOpts;