@visactor/vtable 1.26.4-alpha.0 → 1.26.4

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 (115) hide show
  1. package/cjs/ListTable.d.ts +0 -1
  2. package/cjs/ListTable.js +4 -25
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/body-helper/style.js +1 -2
  5. package/cjs/core/BaseTable.js +3 -4
  6. package/cjs/core/BaseTable.js.map +1 -1
  7. package/cjs/core/FouseInput.js +2 -1
  8. package/cjs/core/tableHelper.d.ts +0 -2
  9. package/cjs/core/tableHelper.js +8 -13
  10. package/cjs/core/tableHelper.js.map +1 -1
  11. package/cjs/data/CachedDataSource.d.ts +0 -1
  12. package/cjs/data/CachedDataSource.js +0 -22
  13. package/cjs/data/CachedDataSource.js.map +1 -1
  14. package/cjs/dataset/DataStatistics.js +1 -2
  15. package/cjs/dataset/flatDataToObject.js +2 -1
  16. package/cjs/event/helper.js +1 -1
  17. package/cjs/event/listener/table-group.js +52 -52
  18. package/cjs/event/listener/table-group.js.map +1 -1
  19. package/cjs/event/media-click.js +1 -1
  20. package/cjs/event/scroll.js +1 -1
  21. package/cjs/event/sparkline-event.js +1 -1
  22. package/cjs/event/util.js +1 -1
  23. package/cjs/header-helper/style.js +1 -2
  24. package/cjs/index.d.ts +1 -1
  25. package/cjs/index.js +1 -1
  26. package/cjs/index.js.map +1 -1
  27. package/cjs/plugins/index.js +1 -1
  28. package/cjs/plugins/interface.js +2 -1
  29. package/cjs/plugins/invert-highlight.js +1 -1
  30. package/cjs/plugins/list-tree-stick-cell.js +1 -1
  31. package/cjs/plugins/plugin-manager.js +1 -1
  32. package/cjs/scenegraph/component/custom.js +2 -2
  33. package/cjs/scenegraph/component/custom.js.map +1 -1
  34. package/cjs/scenegraph/group-creater/cell-helper.d.ts +1 -1
  35. package/cjs/scenegraph/group-creater/cell-helper.js +5 -5
  36. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  37. package/cjs/scenegraph/group-creater/cell-type/image-cell.js +1 -1
  38. package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  39. package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
  40. package/cjs/scenegraph/group-creater/cell-type/text-cell.js +2 -3
  41. package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  42. package/cjs/scenegraph/group-creater/cell-type/video-cell.js +94 -8
  43. package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  44. package/cjs/scenegraph/group-creater/column-helper.js +6 -9
  45. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  46. package/cjs/scenegraph/layout/compute-col-width.js +1 -1
  47. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  48. package/cjs/scenegraph/layout/compute-row-height.js +1 -1
  49. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  50. package/cjs/scenegraph/scenegraph.js +13 -22
  51. package/cjs/scenegraph/scenegraph.js.map +1 -1
  52. package/cjs/scenegraph/utils/text-icon-layout.js +4 -4
  53. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  54. package/cjs/ts-types/base-table.d.ts +3 -0
  55. package/cjs/ts-types/base-table.js.map +1 -1
  56. package/cjs/vrender.js.map +1 -1
  57. package/dist/vtable.js +227 -183
  58. package/dist/vtable.min.js +1 -1
  59. package/es/ListTable.d.ts +0 -1
  60. package/es/ListTable.js +6 -26
  61. package/es/ListTable.js.map +1 -1
  62. package/es/body-helper/style.js +1 -2
  63. package/es/core/BaseTable.js +2 -2
  64. package/es/core/BaseTable.js.map +1 -1
  65. package/es/core/FouseInput.js +2 -1
  66. package/es/core/tableHelper.d.ts +0 -2
  67. package/es/core/tableHelper.js +7 -11
  68. package/es/core/tableHelper.js.map +1 -1
  69. package/es/data/CachedDataSource.d.ts +0 -1
  70. package/es/data/CachedDataSource.js +0 -22
  71. package/es/data/CachedDataSource.js.map +1 -1
  72. package/es/dataset/DataStatistics.js +1 -2
  73. package/es/dataset/flatDataToObject.js +2 -1
  74. package/es/event/helper.js +1 -1
  75. package/es/event/listener/table-group.js +52 -52
  76. package/es/event/listener/table-group.js.map +1 -1
  77. package/es/event/media-click.js +1 -1
  78. package/es/event/scroll.js +1 -1
  79. package/es/event/sparkline-event.js +1 -1
  80. package/es/event/util.js +1 -1
  81. package/es/header-helper/style.js +1 -2
  82. package/es/index.d.ts +1 -1
  83. package/es/index.js +1 -1
  84. package/es/index.js.map +1 -1
  85. package/es/plugins/index.js +1 -1
  86. package/es/plugins/interface.js +2 -1
  87. package/es/plugins/invert-highlight.js +1 -1
  88. package/es/plugins/list-tree-stick-cell.js +1 -1
  89. package/es/plugins/plugin-manager.js +1 -1
  90. package/es/scenegraph/component/custom.js +2 -2
  91. package/es/scenegraph/component/custom.js.map +1 -1
  92. package/es/scenegraph/group-creater/cell-helper.d.ts +1 -1
  93. package/es/scenegraph/group-creater/cell-helper.js +5 -5
  94. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  95. package/es/scenegraph/group-creater/cell-type/image-cell.js +1 -1
  96. package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  97. package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
  98. package/es/scenegraph/group-creater/cell-type/text-cell.js +2 -3
  99. package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  100. package/es/scenegraph/group-creater/cell-type/video-cell.js +92 -8
  101. package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  102. package/es/scenegraph/group-creater/column-helper.js +6 -9
  103. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  104. package/es/scenegraph/layout/compute-col-width.js +1 -1
  105. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  106. package/es/scenegraph/layout/compute-row-height.js +1 -1
  107. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  108. package/es/scenegraph/scenegraph.js +10 -22
  109. package/es/scenegraph/scenegraph.js.map +1 -1
  110. package/es/scenegraph/utils/text-icon-layout.js +4 -4
  111. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  112. package/es/ts-types/base-table.d.ts +3 -0
  113. package/es/ts-types/base-table.js.map +1 -1
  114. package/es/vrender.js.map +1 -1
  115. package/package.json +4 -4
package/dist/vtable.js CHANGED
@@ -41545,41 +41545,6 @@
41545
41545
  getGroupLength() {
41546
41546
  return this.dataConfig?.groupByRules?.length ?? 0;
41547
41547
  }
41548
- refreshRecords(records = [], dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
41549
- this.clearCache();
41550
- this.beforeChangedRecordsMap.clear();
41551
- this.groupAggregator = null;
41552
- this.addRecordRule = dataConfig?.addRecordRule || 'Object';
41553
- this.dataConfig = dataConfig;
41554
- this.columns = columns;
41555
- this._isGrouped = isArray$5(dataConfig?.groupByRules);
41556
- this.rowHierarchyType = rowHierarchyType;
41557
- this.dataSourceObj = {
41558
- get: (index) => records[index],
41559
- length: records.length,
41560
- records
41561
- };
41562
- this._source = this.processRecords(records);
41563
- this.sourceLength = this.source?.length || 0;
41564
- this.sortedIndexMap.clear();
41565
- this._currentPagerIndexedData = [];
41566
- this.userPagination = pagination;
41567
- this.pagination = pagination || {
41568
- totalCount: this.sourceLength,
41569
- perPageCount: this.sourceLength,
41570
- currentPage: 0
41571
- };
41572
- this.hierarchyExpandLevel = hierarchyExpandLevel >= 1 ? hierarchyExpandLevel : 0;
41573
- this.currentIndexedData = Array.from({ length: this.sourceLength }, (_, i) => i);
41574
- if (!this.userPagination) {
41575
- this.pagination.perPageCount = this.sourceLength;
41576
- this.pagination.totalCount = this.sourceLength;
41577
- }
41578
- if (rowHierarchyType === 'tree') {
41579
- this.initTreeHierarchyState();
41580
- }
41581
- this.updatePagerData();
41582
- }
41583
41548
  updateGroup() {
41584
41549
  this.clearCache();
41585
41550
  const oldSource = this.source;
@@ -42343,21 +42308,17 @@
42343
42308
  })
42344
42309
  ];
42345
42310
  }
42346
- function getListTableRowHierarchyType(table) {
42347
- const tableWithPlugins = table;
42348
- let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
42349
- if (isArray$5(table.internalProps.dataConfig?.groupByRules)) {
42350
- rowHierarchyType = 'tree';
42351
- }
42352
- if (tableWithPlugins.pluginManager?.getPluginByName('Master Detail Plugin')) {
42353
- rowHierarchyType = 'grid';
42354
- }
42355
- return rowHierarchyType;
42356
- }
42357
42311
  function _setRecords(table, records = []) {
42312
+ const tableWithPlugins = table;
42358
42313
  _dealWithUpdateDataSource(table, () => {
42359
42314
  table.internalProps.records = records;
42360
- const rowHierarchyType = getListTableRowHierarchyType(table);
42315
+ let rowHierarchyType = table.internalProps.layoutMap.rowHierarchyType;
42316
+ if (isArray$5(table.internalProps.dataConfig?.groupByRules)) {
42317
+ rowHierarchyType = 'tree';
42318
+ }
42319
+ if (tableWithPlugins.pluginManager.getPluginByName('Master Detail Plugin')) {
42320
+ rowHierarchyType = 'grid';
42321
+ }
42361
42322
  const newDataSource = (table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, rowHierarchyType, getHierarchyExpandLevel(table)));
42362
42323
  table.addReleaseObj(newDataSource);
42363
42324
  });
@@ -43572,7 +43533,7 @@
43572
43533
  col: range?.start.col ?? col,
43573
43534
  row: range?.start.row ?? row,
43574
43535
  dataValue: table.getCellOriginValue(col, row),
43575
- value: table.getCellValue(col, row) || '',
43536
+ value: table.getCellValue(col, row),
43576
43537
  rect: {
43577
43538
  left: 0,
43578
43539
  top: 0,
@@ -43608,7 +43569,7 @@
43608
43569
  col,
43609
43570
  row,
43610
43571
  dataValue: table.getCellOriginValue(col, row),
43611
- value: table.getCellValue(col, row) || '',
43572
+ value: table.getCellValue(col, row),
43612
43573
  rect: {
43613
43574
  left: 0,
43614
43575
  top: 0,
@@ -44661,7 +44622,7 @@
44661
44622
  }
44662
44623
 
44663
44624
  function createCellContent(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, lineClamp, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme, range) {
44664
- let contentWidth = 0;
44625
+ let contentWidth;
44665
44626
  let leftIconWidth = 0;
44666
44627
  let rightIconWidth = 0;
44667
44628
  let absoluteRightIconWidth = 0;
@@ -44706,9 +44667,8 @@
44706
44667
  wrapText.name = 'text';
44707
44668
  wrapText.textBaseline = textBaseline;
44708
44669
  cellGroup.appendChild(wrapText);
44709
- if (autoColWidth) {
44710
- contentWidth = wrapText.AABBBounds.width();
44711
- }
44670
+ contentWidth = wrapText.AABBBounds.width();
44671
+ wrapText.AABBBounds.height();
44712
44672
  }
44713
44673
  }
44714
44674
  else {
@@ -44822,9 +44782,8 @@
44822
44782
  cellContent.addContent(textMark);
44823
44783
  cellGroup.appendChild(cellContent);
44824
44784
  cellContent.layout();
44825
- if (autoColWidth) {
44826
- contentWidth = cellContent.AABBBounds.width();
44827
- }
44785
+ contentWidth = cellContent.AABBBounds.width();
44786
+ cellContent.AABBBounds.height();
44828
44787
  }
44829
44788
  else {
44830
44789
  if (cellGroup.firstChild) {
@@ -44833,9 +44792,8 @@
44833
44792
  else {
44834
44793
  cellGroup.appendChild(textMark);
44835
44794
  }
44836
- if (autoColWidth) {
44837
- contentWidth = textMark.AABBBounds.width();
44838
- }
44795
+ contentWidth = textMark.AABBBounds.width();
44796
+ textMark.AABBBounds.height();
44839
44797
  }
44840
44798
  }
44841
44799
  const width = autoColWidth
@@ -45553,7 +45511,7 @@
45553
45511
  const rowEnd = cellGroup.mergeEndCol ?? cellGroup.row;
45554
45512
  const leftIconWidth = cellGroup._cellLeftIconWidth ?? 0;
45555
45513
  const rightIconWidth = cellGroup._cellRightIconWidth ?? 0;
45556
- if (image.keepAspectRatio) {
45514
+ if (image.keepAspectRatio || isDamagePic(image)) {
45557
45515
  const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize(originImage.width || originImage.videoWidth, originImage.height || originImage.videoHeight, cellWidth - (padding[1] + padding[3]), cellHeight - (padding[0] + padding[2]));
45558
45516
  const pos = calcStartPosition(0, 0, cellWidth, cellHeight, imageWidth, imageHeight, textAlign, textBaseline, padding);
45559
45517
  for (let col = colStart; col <= colEnd; col++) {
@@ -45721,7 +45679,7 @@
45721
45679
  }
45722
45680
  }
45723
45681
 
45724
- function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, headerStyle) {
45682
+ function createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult) {
45725
45683
  let isAsync = false;
45726
45684
  let cellGroup;
45727
45685
  if (isPromise(value)) {
@@ -45770,7 +45728,7 @@
45770
45728
  }
45771
45729
  const { customElementsGroup, renderDefault } = _generateCustomElementsGroup(table, define, col, row, cellWidth, cellHeight, padding, range, customResult);
45772
45730
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45773
- cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle);
45731
+ cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync);
45774
45732
  const axisConfig = table.internalProps.layoutMap.getAxisConfigInPivotChart(col, row);
45775
45733
  if (axisConfig) {
45776
45734
  const CartesianAxis = Factory.getComponent('axis');
@@ -45808,7 +45766,7 @@
45808
45766
  const style = table._getCellStyle(col, row);
45809
45767
  const dataValue = table.getCellOriginValue(col, row);
45810
45768
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45811
- cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle);
45769
+ cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync);
45812
45770
  const createProgressBarCell = Factory.getFunction('createProgressBarCell');
45813
45771
  const progressBarGroup = createProgressBarCell(define, style, colWidth, value, dataValue, col, row, padding, table, range);
45814
45772
  if (cellGroup.firstChild) {
@@ -45826,7 +45784,7 @@
45826
45784
  const isAggregation = 'isAggregation' in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row);
45827
45785
  if (isAggregation) {
45828
45786
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45829
- cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, false, undefined, true, cellTheme, range, isAsync, headerStyle);
45787
+ cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, false, undefined, true, cellTheme, range, isAsync);
45830
45788
  }
45831
45789
  else {
45832
45790
  const createCheckboxCellGroup = Factory.getFunction('createCheckboxCellGroup');
@@ -45837,7 +45795,7 @@
45837
45795
  const isAggregation = 'isAggregation' in table.internalProps.layoutMap && table.internalProps.layoutMap.isAggregation(col, row);
45838
45796
  if (isAggregation) {
45839
45797
  const createTextCellGroup = Factory.getFunction('createTextCellGroup');
45840
- cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, false, undefined, true, cellTheme, range, isAsync, headerStyle);
45798
+ cellGroup = createTextCellGroup(table, value, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, false, undefined, true, cellTheme, range, isAsync);
45841
45799
  }
45842
45800
  else {
45843
45801
  const createRadioCellGroup = Factory.getFunction('createRadioCellGroup');
@@ -47054,7 +47012,7 @@
47054
47012
  col: cellRange?.start.col ?? col,
47055
47013
  row: cellRange?.start.row ?? row,
47056
47014
  dataValue: table.getCellOriginValue(col, row),
47057
- value: table.getCellValue(col, row) || '',
47015
+ value: table.getCellValue(col, row),
47058
47016
  rect: getCellRect$1(col, row, table),
47059
47017
  table,
47060
47018
  originCol: col,
@@ -53609,7 +53567,7 @@
53609
53567
  col: cellRange?.start.col ?? col,
53610
53568
  row: cellRange?.start.row ?? row,
53611
53569
  dataValue: table.getCellOriginValue(col, row),
53612
- value: table.getCellValue(col, row) || '',
53570
+ value: table.getCellValue(col, row),
53613
53571
  rect: getCellRect(col, row, table),
53614
53572
  table,
53615
53573
  originCol: col,
@@ -54014,7 +53972,6 @@
54014
53972
  let customStyle;
54015
53973
  let customResult;
54016
53974
  let isCustomMerge = false;
54017
- let rawRecord;
54018
53975
  if (table.internalProps.customMergeCell) {
54019
53976
  const customMerge = table.getCustomMerge(col, row);
54020
53977
  if (customMerge) {
@@ -54064,19 +54021,8 @@
54064
54021
  !(isAggregation && isSeriesNumber);
54065
54022
  if (!range &&
54066
54023
  (table.internalProps.enableTreeNodeMerge || cellLocation !== 'body' || define?.mergeCell)) {
54067
- if (table.internalProps.enableTreeNodeMerge &&
54068
- cellLocation === 'body' &&
54069
- !define?.mergeCell) {
54070
- rawRecord = table.getCellRawRecord(col, row);
54071
- if (rawRecord?.vtableMerge) {
54072
- range = table.getCellRange(col, row);
54073
- isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
54074
- }
54075
- }
54076
- else {
54077
- range = table.getCellRange(col, row);
54078
- isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
54079
- }
54024
+ range = table.getCellRange(col, row);
54025
+ isMerge = range.start.col !== range.end.col || range.start.row !== range.end.row;
54080
54026
  if (isMerge) {
54081
54027
  const needUpdateRange = rowStart > range.start.row;
54082
54028
  const mergeSize = dealMerge(range, mergeMap, table, needUpdateRange);
@@ -54086,7 +54032,7 @@
54086
54032
  }
54087
54033
  let isVtableMerge = false;
54088
54034
  if (table.internalProps.enableTreeNodeMerge && isMerge) {
54089
- rawRecord = rawRecord ?? table.getCellRawRecord(range.start.col, range.start.row);
54035
+ const rawRecord = table.getCellRawRecord(range.start.col, range.start.row);
54090
54036
  const { vtableMergeName, vtableMerge } = rawRecord ?? {};
54091
54037
  isVtableMerge = vtableMerge;
54092
54038
  if (vtableMerge) {
@@ -54147,7 +54093,7 @@
54147
54093
  if (cellLocation !== 'body' && !cellTheme.group.fill) {
54148
54094
  cellTheme.group.fill = '#fff';
54149
54095
  }
54150
- const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, cellStyle);
54096
+ const cellGroup = createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
54151
54097
  columnGroup.updateColumnRowNumber(row);
54152
54098
  if (isMerge) {
54153
54099
  const rangeHeight = table.getRowHeight(row);
@@ -54197,7 +54143,7 @@
54197
54143
  if (cellLocation !== 'body' && !cellTheme.group.fill) {
54198
54144
  cellTheme.group.fill = '#fff';
54199
54145
  }
54200
- createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult, cellStyle);
54146
+ createCell(type, value, define, table, col, row, colWidth, cellWidth, cellHeight, columnGroup, y, padding, textAlign, textBaseline, mayHaveIcon, cellTheme, range, customResult);
54201
54147
  }
54202
54148
  function dealMerge(range, mergeMap, table, forceUpdate) {
54203
54149
  let cellWidth = 0;
@@ -60271,42 +60217,42 @@
60271
60217
  this.updateNextFrame();
60272
60218
  }
60273
60219
  updateContainerAttrHeightAndY() {
60274
- this.cornerHeaderGroup.forEachChildrenSkipChild((column) => {
60275
- updateContainerChildrenY(column, 0);
60276
- });
60277
- this.colHeaderGroup.forEachChildrenSkipChild((column) => {
60278
- updateContainerChildrenY(column, 0);
60279
- });
60280
- this.rightTopCornerGroup.forEachChildrenSkipChild((column) => {
60281
- updateContainerChildrenY(column, 0);
60282
- });
60283
- this.rowHeaderGroup.forEachChildrenSkipChild((column) => {
60284
- column.firstChild &&
60285
- updateContainerChildrenY(column, column.firstChild.row > 0
60286
- ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, column.firstChild.row - 1)
60220
+ for (let i = 0; i < this.cornerHeaderGroup.children.length; i++) {
60221
+ updateContainerChildrenY(this.cornerHeaderGroup.children[i], 0);
60222
+ }
60223
+ for (let i = 0; i < this.colHeaderGroup.children.length; i++) {
60224
+ updateContainerChildrenY(this.colHeaderGroup.children[i], 0);
60225
+ }
60226
+ for (let i = 0; i < this.rightTopCornerGroup.children.length; i++) {
60227
+ updateContainerChildrenY(this.rightTopCornerGroup.children[i], 0);
60228
+ }
60229
+ for (let i = 0; i < this.rowHeaderGroup.children.length; i++) {
60230
+ this.rowHeaderGroup.children[i].firstChild &&
60231
+ updateContainerChildrenY(this.rowHeaderGroup.children[i], this.rowHeaderGroup.children[i].firstChild.row > 0
60232
+ ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, this.rowHeaderGroup.children[i].firstChild.row - 1)
60287
60233
  : 0);
60288
- });
60289
- this.bodyGroup.forEachChildrenSkipChild((column) => {
60290
- column.firstChild &&
60291
- updateContainerChildrenY(column, column.firstChild.row > 0
60292
- ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, column.firstChild.row - 1)
60234
+ }
60235
+ for (let i = 0; i < this.bodyGroup.children.length; i++) {
60236
+ this.bodyGroup.children[i].firstChild &&
60237
+ updateContainerChildrenY(this.bodyGroup.children[i], this.bodyGroup.children[i].firstChild.row > 0
60238
+ ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, this.bodyGroup.children[i].firstChild.row - 1)
60293
60239
  : 0);
60294
- });
60295
- this.rightFrozenGroup.forEachChildrenSkipChild((column) => {
60296
- column.firstChild &&
60297
- updateContainerChildrenY(column, column.firstChild.row > 0
60298
- ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, column.firstChild.row - 1)
60240
+ }
60241
+ for (let i = 0; i < this.rightFrozenGroup.children.length; i++) {
60242
+ this.rightFrozenGroup.children[i].firstChild &&
60243
+ updateContainerChildrenY(this.rightFrozenGroup.children[i], this.rightFrozenGroup.children[i].firstChild.row > 0
60244
+ ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, this.rightFrozenGroup.children[i].firstChild.row - 1)
60299
60245
  : 0);
60300
- });
60301
- this.leftBottomCornerGroup.forEachChildrenSkipChild((column) => {
60302
- updateContainerChildrenY(column, 0);
60303
- });
60304
- this.bottomFrozenGroup.forEachChildrenSkipChild((column) => {
60305
- updateContainerChildrenY(column, 0);
60306
- });
60307
- this.rightBottomCornerGroup.forEachChildrenSkipChild((column) => {
60308
- updateContainerChildrenY(column, 0);
60309
- });
60246
+ }
60247
+ for (let i = 0; i < this.leftBottomCornerGroup.children.length; i++) {
60248
+ updateContainerChildrenY(this.leftBottomCornerGroup.children[i], 0);
60249
+ }
60250
+ for (let i = 0; i < this.bottomFrozenGroup.children.length; i++) {
60251
+ updateContainerChildrenY(this.bottomFrozenGroup.children[i], 0);
60252
+ }
60253
+ for (let i = 0; i < this.rightBottomCornerGroup.children.length; i++) {
60254
+ updateContainerChildrenY(this.rightBottomCornerGroup.children[i], 0);
60255
+ }
60310
60256
  }
60311
60257
  updateContainer(updateConfig = { async: false, needUpdateCellY: false }) {
60312
60258
  if (updateConfig.async) {
@@ -65220,15 +65166,19 @@
65220
65166
  if (e.button !== 0) {
65221
65167
  return;
65222
65168
  }
65169
+ const endedResizeCol = stateManager.isResizeCol();
65170
+ const endedResizeRow = stateManager.isResizeRow();
65171
+ const endedMoveCol = stateManager.isMoveCol();
65172
+ const shouldSkipClickCell = endedResizeCol || endedResizeRow;
65223
65173
  if (stateManager.interactionState === 'grabing') {
65224
65174
  stateManager.updateInteractionState(InteractionState.default);
65225
- if (stateManager.isResizeCol()) {
65175
+ if (endedResizeCol) {
65226
65176
  endResizeCol(table);
65227
65177
  }
65228
- else if (stateManager.isResizeRow()) {
65178
+ else if (endedResizeRow) {
65229
65179
  endResizeRow(table);
65230
65180
  }
65231
- else if (stateManager.isMoveCol()) {
65181
+ else if (endedMoveCol) {
65232
65182
  const endMoveColSuccess = table.stateManager.endMoveCol();
65233
65183
  fireMoveColEventListeners(table, endMoveColSuccess, e.nativeEvent);
65234
65184
  }
@@ -65258,7 +65208,7 @@
65258
65208
  else if (stateManager.interactionState === InteractionState.scrolling) {
65259
65209
  stateManager.updateInteractionState(InteractionState.default);
65260
65210
  }
65261
- if (!table.eventManager.isDraging) {
65211
+ if (!table.eventManager.isDraging && !shouldSkipClickCell) {
65262
65212
  const eventArgsSet = getEventArgsSet(e);
65263
65213
  if (!eventManager.isTouchMove &&
65264
65214
  e.button === 0 &&
@@ -72109,7 +72059,7 @@
72109
72059
  return TABLE_EVENT_TYPE;
72110
72060
  }
72111
72061
  options;
72112
- version = "1.26.2";
72062
+ version = "1.26.4";
72113
72063
  pagination;
72114
72064
  id = `VTable${Date.now()}`;
72115
72065
  headerStyleCache;
@@ -73964,9 +73914,7 @@
73964
73914
  internalProps.emptyTip = null;
73965
73915
  internalProps.layoutMap.release();
73966
73916
  clearChartRenderQueue();
73967
- if (!updateConfig?.skipClearCells) {
73968
- this.scenegraph.clearCells();
73969
- }
73917
+ this.scenegraph.clearCells();
73970
73918
  this.scenegraph.updateComponent();
73971
73919
  this.stateManager.updateOptionSetState();
73972
73920
  this._updateSize();
@@ -80232,19 +80180,8 @@
80232
80180
  clearRowHeightCache: true
80233
80181
  }) {
80234
80182
  const internalProps = this.internalProps;
80235
- const prevSortState = internalProps.sortState;
80236
- const nextSortStates = Array.isArray(options.sortState)
80237
- ? options.sortState
80238
- : options.sortState
80239
- ? [options.sortState]
80240
- : [];
80241
- const hasActiveSortState = nextSortStates.some(item => item?.field && item?.order && item.order !== 'normal');
80242
- const shouldSkipInitialClearCells = Boolean(options.records) || (!!options.dataSource && this.dataSource !== options.dataSource);
80243
80183
  this.pluginManager.removeOrAddPlugins(options.plugins);
80244
- super.updateOption(options, {
80245
- ...updateConfig,
80246
- skipClearCells: shouldSkipInitialClearCells
80247
- });
80184
+ super.updateOption(options, updateConfig);
80248
80185
  internalProps.frozenColDragHeaderMode =
80249
80186
  options.dragOrder?.frozenColDragHeaderMode ?? options.frozenColDragHeaderMode;
80250
80187
  this.pagination = options.pagination;
@@ -80282,13 +80219,6 @@
80282
80219
  if (options.dataSource && this.dataSource !== options.dataSource) {
80283
80220
  this.dataSource = options.dataSource;
80284
80221
  }
80285
- else if (options.records &&
80286
- options.records === internalProps.records &&
80287
- options.sortState === prevSortState &&
80288
- !hasActiveSortState &&
80289
- this.dataSource instanceof CachedDataSource) {
80290
- this._refreshCurrentRecordsForOptionUpdate(options.records);
80291
- }
80292
80222
  else if (options.records) {
80293
80223
  this.setRecords(options.records, {
80294
80224
  sortState: options.sortState
@@ -80323,34 +80253,6 @@
80323
80253
  setTimeout(resolve, 0);
80324
80254
  });
80325
80255
  }
80326
- _refreshCurrentRecordsForOptionUpdate(records) {
80327
- const dataSource = this.dataSource;
80328
- this.stateManager.endResizeIfResizing();
80329
- clearChartRenderQueue();
80330
- const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
80331
- this.scenegraph.clearCells();
80332
- this.internalProps.records = records;
80333
- dataSource.refreshRecords(records, this.internalProps.dataConfig, this.pagination, this.internalProps.columns, getListTableRowHierarchyType(this), getHierarchyExpandLevel(this));
80334
- this.refreshRowColCount();
80335
- this.stateManager.initCheckedState(records);
80336
- this.clearCellStyleCache();
80337
- this.scenegraph.createSceneGraph();
80338
- this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row);
80339
- this._updateSize();
80340
- const layoutOrder = this.options.componentLayoutOrder ?? ['legend', 'title'];
80341
- layoutOrder.forEach(component => {
80342
- if (component === 'legend') {
80343
- this.internalProps.legends?.forEach(legend => {
80344
- legend?.resize();
80345
- });
80346
- }
80347
- else if (component === 'title') {
80348
- this.internalProps.title?.resize();
80349
- }
80350
- });
80351
- this.scenegraph.resize();
80352
- this.render();
80353
- }
80354
80256
  updatePagination(pagination) {
80355
80257
  if (this.pagination) {
80356
80258
  typeof pagination.currentPage === 'number' &&
@@ -86054,6 +85956,77 @@
86054
85956
  }
86055
85957
 
86056
85958
  const regedIcons = get$2();
85959
+ function releaseVideoResource(video) {
85960
+ try {
85961
+ video.pause();
85962
+ }
85963
+ catch (err) {
85964
+ }
85965
+ video.removeAttribute('src');
85966
+ try {
85967
+ video.load();
85968
+ }
85969
+ catch (err) {
85970
+ }
85971
+ }
85972
+ function getVideoFirstFrameTimeout(table) {
85973
+ const timeout = table.options.customConfig?.videoFirstFrameTimeout;
85974
+ return typeof timeout === 'number' && timeout >= 0 ? timeout : 8000;
85975
+ }
85976
+ function getVideoFirstFrameMaxCanvasSize(table) {
85977
+ const maxCanvasSize = table.options.customConfig?.videoFirstFrameMaxCanvasSize;
85978
+ return typeof maxCanvasSize === 'number' && maxCanvasSize > 0 ? maxCanvasSize : 512;
85979
+ }
85980
+ function snapshotVideoFirstFrame(video, image, table) {
85981
+ const displayWidth = image.attribute.width;
85982
+ const displayHeight = image.attribute.height;
85983
+ if (typeof displayWidth !== 'number' ||
85984
+ typeof displayHeight !== 'number' ||
85985
+ displayWidth <= 0 ||
85986
+ displayHeight <= 0) {
85987
+ return false;
85988
+ }
85989
+ const canvas = document.createElement('canvas');
85990
+ const context = canvas.getContext('2d');
85991
+ if (!context) {
85992
+ return false;
85993
+ }
85994
+ const dpr = Math.min((typeof window === 'undefined' ? 1 : window.devicePixelRatio) || 1, 2);
85995
+ const maxSize = getVideoFirstFrameMaxCanvasSize(table);
85996
+ const scale = Math.min(dpr, maxSize / Math.max(displayWidth, displayHeight));
85997
+ canvas.width = Math.max(1, Math.ceil(displayWidth * scale));
85998
+ canvas.height = Math.max(1, Math.ceil(displayHeight * scale));
85999
+ canvas.style.width = `${displayWidth}px`;
86000
+ canvas.style.height = `${displayHeight}px`;
86001
+ try {
86002
+ context.drawImage(video, 0, 0, canvas.width, canvas.height);
86003
+ image.setAttributes({ image: canvas });
86004
+ return true;
86005
+ }
86006
+ catch (err) {
86007
+ return false;
86008
+ }
86009
+ }
86010
+ function getSvgSize(svg) {
86011
+ const svgTag = svg.match(/<svg\b[^>]*>/i)?.[0];
86012
+ if (!svgTag) {
86013
+ return undefined;
86014
+ }
86015
+ const widthMatch = svgTag.match(/\bwidth=["']?([\d.]+)/i);
86016
+ const heightMatch = svgTag.match(/\bheight=["']?([\d.]+)/i);
86017
+ const width = widthMatch ? Number(widthMatch[1]) : undefined;
86018
+ const height = heightMatch ? Number(heightMatch[1]) : undefined;
86019
+ if (width > 0 && height > 0) {
86020
+ return { width, height };
86021
+ }
86022
+ const viewBoxMatch = svgTag.match(/\bviewBox=["']\s*[-\d.]+\s+[-\d.]+\s+([\d.]+)\s+([\d.]+)\s*["']/i);
86023
+ const viewBoxWidth = viewBoxMatch ? Number(viewBoxMatch[1]) : undefined;
86024
+ const viewBoxHeight = viewBoxMatch ? Number(viewBoxMatch[2]) : undefined;
86025
+ if (viewBoxWidth > 0 && viewBoxHeight > 0) {
86026
+ return { width: viewBoxWidth, height: viewBoxHeight };
86027
+ }
86028
+ return undefined;
86029
+ }
86057
86030
  function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync) {
86058
86031
  const headerStyle = table._getCellStyle(col, row);
86059
86032
  const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
@@ -86157,7 +86130,75 @@
86157
86130
  }
86158
86131
  const value = table.getCellValue(col, row);
86159
86132
  const video = document.createElement('video');
86133
+ video.muted = true;
86134
+ video.playsInline = true;
86135
+ const shouldSnapshot = table.options.customConfig?.videoFirstFrameSnapshot === true;
86136
+ let loadTimer;
86137
+ let videoReleased = false;
86138
+ const clearVideoLoadTimer = () => {
86139
+ if (loadTimer !== undefined) {
86140
+ clearTimeout(loadTimer);
86141
+ loadTimer = undefined;
86142
+ }
86143
+ };
86144
+ const releaseCurrentVideo = () => {
86145
+ if (videoReleased) {
86146
+ return;
86147
+ }
86148
+ videoReleased = true;
86149
+ clearVideoLoadTimer();
86150
+ releaseVideoResource(video);
86151
+ };
86152
+ const isCurrentImage = () => cellGroup.getChildByName('image', true) === image;
86153
+ const setVideoDamageImage = () => {
86154
+ const regedIcons = get$2();
86155
+ const damageIcon = regedIcons.video_damage_pic || regedIcons.damage_pic;
86156
+ const damageImage = damageIcon.svg;
86157
+ image.setAttributes({
86158
+ image: damageImage
86159
+ });
86160
+ const originImage = image.resources?.get(damageImage)?.data;
86161
+ const svgSize = typeof damageImage === 'string' ? getSvgSize(damageImage) : undefined;
86162
+ const originWidth = originImage?.width || damageIcon.width || svgSize?.width || 24;
86163
+ const originHeight = originImage?.height || damageIcon.height || svgSize?.height || 24;
86164
+ const { width: cellWidth, height: cellHeight, isMerge } = getCellRange$1(cellGroup, table);
86165
+ const availableWidth = cellWidth - padding[1] - padding[3];
86166
+ const availableHeight = cellHeight - padding[0] - padding[2];
86167
+ if (originWidth > 0 && originHeight > 0 && availableWidth > 0 && availableHeight > 0) {
86168
+ const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize(originWidth, originHeight, availableWidth, availableHeight);
86169
+ const pos = calcStartPosition(0, 0, cellWidth, cellHeight, imageWidth, imageHeight, textAlign, textBaseline, padding);
86170
+ image.setAttributes({
86171
+ x: pos.x,
86172
+ y: pos.y,
86173
+ width: imageWidth,
86174
+ height: imageHeight
86175
+ });
86176
+ if (isMerge) {
86177
+ updateImageDxDy(cellGroup.mergeStartCol, cellGroup.mergeEndCol, cellGroup.mergeStartRow, cellGroup.mergeEndRow, table);
86178
+ }
86179
+ }
86180
+ };
86181
+ const handleVideoLoadFail = () => {
86182
+ if (videoReleased) {
86183
+ return;
86184
+ }
86185
+ if (isCurrentImage()) {
86186
+ setVideoDamageImage();
86187
+ table.scenegraph.updateNextFrame();
86188
+ }
86189
+ if (shouldSnapshot) {
86190
+ releaseCurrentVideo();
86191
+ }
86192
+ };
86160
86193
  video.addEventListener('loadeddata', () => {
86194
+ clearVideoLoadTimer();
86195
+ if (videoReleased) {
86196
+ return;
86197
+ }
86198
+ if (!isCurrentImage()) {
86199
+ releaseCurrentVideo();
86200
+ return;
86201
+ }
86161
86202
  if (imageAutoSizing) {
86162
86203
  _adjustWidthHeight(col, row, video.videoWidth, video.videoHeight, table.scenegraph, padding, cellGroup);
86163
86204
  }
@@ -86205,16 +86246,13 @@
86205
86246
  });
86206
86247
  playIcon.name = 'play-icon';
86207
86248
  cellGroup.appendChild(playIcon);
86249
+ if (shouldSnapshot && snapshotVideoFirstFrame(video, image, table)) {
86250
+ releaseCurrentVideo();
86251
+ }
86208
86252
  table.scenegraph.updateNextFrame();
86209
86253
  });
86210
- video.onerror = () => {
86211
- const regedIcons = get$2();
86212
- image.image = regedIcons.video_damage_pic
86213
- ? regedIcons.video_damage_pic.svg
86214
- : regedIcons.damage_pic.svg;
86215
- };
86216
- video.src = value;
86217
- video.setAttribute('preload', 'auto');
86254
+ video.addEventListener('error', handleVideoLoadFail);
86255
+ video.addEventListener('abort', handleVideoLoadFail);
86218
86256
  const image = createImage({
86219
86257
  x: padding[3],
86220
86258
  y: padding[0],
@@ -86234,6 +86272,12 @@
86234
86272
  table.scenegraph.updateNextFrame();
86235
86273
  }
86236
86274
  };
86275
+ video.setAttribute('preload', 'auto');
86276
+ video.src = value;
86277
+ const timeout = getVideoFirstFrameTimeout(table);
86278
+ if (shouldSnapshot && timeout > 0) {
86279
+ loadTimer = setTimeout(handleVideoLoadFail, timeout);
86280
+ }
86237
86281
  return cellGroup;
86238
86282
  }
86239
86283
 
@@ -86375,8 +86419,8 @@
86375
86419
  }
86376
86420
  }
86377
86421
 
86378
- function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync, headerStyle) {
86379
- headerStyle = headerStyle || table._getCellStyle(col, row);
86422
+ function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range, isAsync) {
86423
+ const headerStyle = table._getCellStyle(col, row);
86380
86424
  const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
86381
86425
  if (isValid$1(functionalPadding)) {
86382
86426
  padding = functionalPadding;
@@ -96821,7 +96865,7 @@
96821
96865
  }
96822
96866
 
96823
96867
  registerForVrender();
96824
- const version = "1.26.2";
96868
+ const version = "1.26.4";
96825
96869
  function getIcons() {
96826
96870
  return get$2();
96827
96871
  }