@visactor/vtable-plugins 1.22.2 → 1.22.3

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 (53) hide show
  1. package/cjs/filter/filter-engine.js +3 -1
  2. package/cjs/filter/filter-engine.js.map +1 -1
  3. package/cjs/filter/filter-state-manager.d.ts +0 -1
  4. package/cjs/filter/filter-state-manager.js +1 -12
  5. package/cjs/filter/filter-state-manager.js.map +1 -1
  6. package/cjs/filter/filter.js +16 -3
  7. package/cjs/filter/filter.js.map +1 -1
  8. package/cjs/master-detail-plugin/config.d.ts +6 -1
  9. package/cjs/master-detail-plugin/config.js +54 -7
  10. package/cjs/master-detail-plugin/config.js.map +1 -1
  11. package/cjs/master-detail-plugin/core.d.ts +2 -1
  12. package/cjs/master-detail-plugin/core.js +31 -12
  13. package/cjs/master-detail-plugin/core.js.map +1 -1
  14. package/cjs/master-detail-plugin/events.js +1 -1
  15. package/cjs/master-detail-plugin/events.js.map +1 -1
  16. package/cjs/master-detail-plugin/subtable.d.ts +4 -0
  17. package/cjs/master-detail-plugin/subtable.js +42 -4
  18. package/cjs/master-detail-plugin/subtable.js.map +1 -1
  19. package/cjs/master-detail-plugin/types.d.ts +1 -1
  20. package/cjs/master-detail-plugin/types.js.map +1 -1
  21. package/cjs/table-carousel-animation.js +3 -3
  22. package/cjs/table-carousel-animation.js.map +1 -1
  23. package/cjs/table-series-number.d.ts +4 -0
  24. package/cjs/table-series-number.js +12 -4
  25. package/cjs/table-series-number.js.map +1 -1
  26. package/dist/vtable-plugins.js +240 -69
  27. package/dist/vtable-plugins.min.js +3 -3
  28. package/es/filter/filter-engine.js +3 -1
  29. package/es/filter/filter-engine.js.map +1 -1
  30. package/es/filter/filter-state-manager.d.ts +0 -1
  31. package/es/filter/filter-state-manager.js +1 -12
  32. package/es/filter/filter-state-manager.js.map +1 -1
  33. package/es/filter/filter.js +15 -3
  34. package/es/filter/filter.js.map +1 -1
  35. package/es/master-detail-plugin/config.d.ts +6 -1
  36. package/es/master-detail-plugin/config.js +54 -7
  37. package/es/master-detail-plugin/config.js.map +1 -1
  38. package/es/master-detail-plugin/core.d.ts +2 -1
  39. package/es/master-detail-plugin/core.js +30 -12
  40. package/es/master-detail-plugin/core.js.map +1 -1
  41. package/es/master-detail-plugin/events.js +1 -1
  42. package/es/master-detail-plugin/events.js.map +1 -1
  43. package/es/master-detail-plugin/subtable.d.ts +4 -0
  44. package/es/master-detail-plugin/subtable.js +41 -4
  45. package/es/master-detail-plugin/subtable.js.map +1 -1
  46. package/es/master-detail-plugin/types.d.ts +1 -1
  47. package/es/master-detail-plugin/types.js.map +1 -1
  48. package/es/table-carousel-animation.js +3 -3
  49. package/es/table-carousel-animation.js.map +1 -1
  50. package/es/table-series-number.d.ts +4 -0
  51. package/es/table-series-number.js +12 -4
  52. package/es/table-series-number.js.map +1 -1
  53. package/package.json +8 -8
@@ -1954,16 +1954,17 @@
1954
1954
  return;
1955
1955
  }
1956
1956
  let animation = true;
1957
+ const screenTopRow = Math.max(this.table.scenegraph.proxy.screenTopRow, this.table.frozenRowCount);
1957
1958
  const customRow = this.customDistRowFunction && this.customDistRowFunction(this.row, this.table);
1958
1959
  if (customRow) {
1959
1960
  this.row = customRow.distRow;
1960
1961
  animation = customRow.animation ?? true;
1961
1962
  }
1962
- else if (isInteger(this.row) && this.table.scenegraph.proxy.screenTopRow !== this.row) {
1963
+ else if (isInteger(this.row) && screenTopRow !== this.row) {
1963
1964
  this.row = this.table.frozenRowCount;
1964
1965
  animation = false;
1965
1966
  }
1966
- else if (!isInteger(this.row) && this.table.scenegraph.proxy.screenTopRow !== Math.floor(this.row)) {
1967
+ else if (!isInteger(this.row) && screenTopRow !== Math.floor(this.row)) {
1967
1968
  this.row = this.table.frozenRowCount;
1968
1969
  animation = false;
1969
1970
  }
@@ -5901,10 +5902,14 @@
5901
5902
  class ConfigManager {
5902
5903
  pluginOptions;
5903
5904
  table;
5905
+ expandRowCallback;
5904
5906
  constructor(pluginOptions, table) {
5905
5907
  this.pluginOptions = pluginOptions;
5906
5908
  this.table = table;
5907
5909
  }
5910
+ setExpandRowCallback(callback) {
5911
+ this.expandRowCallback = callback;
5912
+ }
5908
5913
  hasChildren(record) {
5909
5914
  if (record && typeof record === 'object' && 'children' in record) {
5910
5915
  const children = record.children;
@@ -5951,12 +5956,6 @@
5951
5956
  }
5952
5957
  this.disableRefreshHierarchyState();
5953
5958
  }
5954
- getDataCount() {
5955
- if (this.table.pagination) {
5956
- return this.table.dataSource?.currentPagerIndexedData?.length ?? 0;
5957
- }
5958
- return this.table.dataSource?.sourceLength ?? 0;
5959
- }
5960
5959
  disableRefreshHierarchyState() {
5961
5960
  setTimeout(() => {
5962
5961
  const tableWithPrivateMethod = this.table;
@@ -5976,20 +5975,101 @@
5976
5975
  }
5977
5976
  processRecordsHierarchyStates(records) {
5978
5977
  const HierarchyState = VTable__namespace.TYPES.HierarchyState;
5978
+ const headerExpandLevel = this.table.options.headerExpandLevel;
5979
5979
  const processRecords = (recordList) => {
5980
5980
  recordList.forEach(record => {
5981
5981
  if (record && typeof record === 'object') {
5982
5982
  const recordObj = record;
5983
- if (this.hasChildren(record)) {
5984
- recordObj.hierarchyState = HierarchyState.collapse;
5985
- }
5986
- else if (recordObj.children === true) {
5987
- recordObj.hierarchyState = HierarchyState.collapse;
5983
+ if (this.hasChildren(record) || recordObj.children === true) {
5984
+ if (recordObj.hierarchyState === 'expand') {
5985
+ recordObj.hierarchyState = HierarchyState.expand;
5986
+ }
5987
+ else if (recordObj.hierarchyState === 'collapse') {
5988
+ recordObj.hierarchyState = HierarchyState.collapse;
5989
+ }
5990
+ else if (!recordObj.hierarchyState) {
5991
+ if (headerExpandLevel && headerExpandLevel > 1) {
5992
+ recordObj.hierarchyState = HierarchyState.expand;
5993
+ }
5994
+ else {
5995
+ recordObj.hierarchyState = HierarchyState.collapse;
5996
+ }
5997
+ }
5988
5998
  }
5989
5999
  }
5990
6000
  });
5991
6001
  };
5992
6002
  processRecords(records);
6003
+ this.performInitialExpansion();
6004
+ }
6005
+ performInitialExpansion() {
6006
+ const expandableRecords = this.getExpandableRecords();
6007
+ if (expandableRecords.length === 0) {
6008
+ return;
6009
+ }
6010
+ this.startAsyncExpansion(expandableRecords);
6011
+ }
6012
+ getExpandableRecords() {
6013
+ const dataSource = this.table.dataSource;
6014
+ const allRecords = dataSource.source || dataSource._source || this.table.dataSource.records;
6015
+ const HierarchyState = VTable__namespace.TYPES.HierarchyState;
6016
+ const expandableRecords = [];
6017
+ const tableWithInternalProps = this.table;
6018
+ if (!tableWithInternalProps.internalProps.expandedRecordIndices) {
6019
+ tableWithInternalProps.internalProps.expandedRecordIndices = [];
6020
+ }
6021
+ const expandedRecordIndices = tableWithInternalProps.internalProps.expandedRecordIndices;
6022
+ for (let recordIndex = 0; recordIndex < allRecords.length; recordIndex++) {
6023
+ const record = allRecords[recordIndex];
6024
+ if (record && typeof record === 'object') {
6025
+ const recordObj = record;
6026
+ if ((this.hasChildren(record) || recordObj.children === true) &&
6027
+ recordObj.hierarchyState === HierarchyState.expand) {
6028
+ if (!expandedRecordIndices.includes(recordIndex)) {
6029
+ expandedRecordIndices.push(recordIndex);
6030
+ }
6031
+ try {
6032
+ const bodyRowIndex = this.table.getBodyRowIndexByRecordIndex(recordIndex);
6033
+ if (bodyRowIndex >= 0) {
6034
+ const actualRowIndex = bodyRowIndex + this.table.columnHeaderLevelCount;
6035
+ expandableRecords.push({ recordIndex, actualRowIndex, record });
6036
+ }
6037
+ }
6038
+ catch (error) {
6039
+ }
6040
+ }
6041
+ }
6042
+ }
6043
+ return expandableRecords;
6044
+ }
6045
+ startAsyncExpansion(expandableRecords) {
6046
+ let currentIndex = 0;
6047
+ const processNextExpansion = () => {
6048
+ if (currentIndex >= expandableRecords.length) {
6049
+ return;
6050
+ }
6051
+ const { actualRowIndex } = expandableRecords[currentIndex];
6052
+ if (this.isCellGroupCreated(actualRowIndex)) {
6053
+ if (this.expandRowCallback) {
6054
+ this.expandRowCallback(actualRowIndex);
6055
+ }
6056
+ currentIndex++;
6057
+ setTimeout(processNextExpansion, 0);
6058
+ }
6059
+ else {
6060
+ setTimeout(processNextExpansion, 16);
6061
+ }
6062
+ };
6063
+ setTimeout(processNextExpansion, 0);
6064
+ }
6065
+ isCellGroupCreated(rowIndex) {
6066
+ try {
6067
+ const cellGroup = this.table.scenegraph.getCell(0, rowIndex);
6068
+ return cellGroup && cellGroup.role === 'cell';
6069
+ }
6070
+ catch (error) {
6071
+ return false;
6072
+ }
5993
6073
  }
5994
6074
  getDetailConfigForRecord(record, bodyRowIndex) {
5995
6075
  const detailOptions = this.pluginOptions.detailTableOptions;
@@ -6056,7 +6136,7 @@
6056
6136
  effectiveCellHeight = originalHeight;
6057
6137
  const newHeight = effectiveCellHeight - (padding[0] + padding[2]);
6058
6138
  cellGroup.forEachChildren((child) => {
6059
- if (child.type === 'rect' || child.type === 'chart' || child.name === 'custom-container') {
6139
+ if (child.type === 'rect' || child.type === 'chart' || child.name === VTable__namespace.CUSTOM_CONTAINER_NAME) {
6060
6140
  return;
6061
6141
  }
6062
6142
  if (child.name === 'mark') {
@@ -6573,6 +6653,67 @@
6573
6653
  this.setupAntiFlickerMechanism(subTable);
6574
6654
  this.setupSubTableEventForwarding(bodyRowIndex, subTable);
6575
6655
  subTable.render();
6656
+ if (detailConfig?.style?.height === 'auto') {
6657
+ this.handleAutoHeightAfterRender(bodyRowIndex, subTable, detailConfig);
6658
+ }
6659
+ }
6660
+ handleAutoHeightAfterRender(bodyRowIndex, subTable, detailConfig) {
6661
+ try {
6662
+ const actualContentHeight = this.calculateSubTableContentHeight(subTable);
6663
+ const [marginTop, , marginBottom] = parseMargin(detailConfig?.style?.margin);
6664
+ const totalRequiredHeight = actualContentHeight + marginTop + marginBottom;
6665
+ if (this.onAutoHeightCalculated) {
6666
+ this.onAutoHeightCalculated(bodyRowIndex, totalRequiredHeight);
6667
+ }
6668
+ }
6669
+ catch (error) {
6670
+ }
6671
+ }
6672
+ calculateSubTableContentHeight(subTable) {
6673
+ try {
6674
+ const contentHeight = subTable.getAllRowsHeight();
6675
+ let frameExtraHeight = 0;
6676
+ const theme = subTable.theme;
6677
+ if (theme?.frameStyle) {
6678
+ const frameStyle = theme.frameStyle;
6679
+ let borderTopWidth = 0;
6680
+ let borderBottomWidth = 0;
6681
+ if (frameStyle.borderLineWidth) {
6682
+ if (typeof frameStyle.borderLineWidth === 'number') {
6683
+ borderTopWidth = borderBottomWidth = frameStyle.borderLineWidth;
6684
+ }
6685
+ else if (Array.isArray(frameStyle.borderLineWidth)) {
6686
+ const borders = frameStyle.borderLineWidth;
6687
+ borderTopWidth = borders[0] || 0;
6688
+ borderBottomWidth = borders[2] || 0;
6689
+ }
6690
+ }
6691
+ let shadowTopHeight = 0;
6692
+ let shadowBottomHeight = 0;
6693
+ if (frameStyle.shadowBlur) {
6694
+ if (typeof frameStyle.shadowBlur === 'number') {
6695
+ shadowTopHeight = shadowBottomHeight = frameStyle.shadowBlur;
6696
+ }
6697
+ else if (Array.isArray(frameStyle.shadowBlur)) {
6698
+ const shadows = frameStyle.shadowBlur;
6699
+ shadowTopHeight = shadows[0] || 0;
6700
+ shadowBottomHeight = shadows[2] || 0;
6701
+ }
6702
+ }
6703
+ if (!frameStyle.innerBorder) {
6704
+ frameExtraHeight = borderTopWidth + borderBottomWidth + shadowTopHeight + shadowBottomHeight;
6705
+ }
6706
+ }
6707
+ const totalHeight = contentHeight + frameExtraHeight;
6708
+ return totalHeight;
6709
+ }
6710
+ catch (error) {
6711
+ return 300;
6712
+ }
6713
+ }
6714
+ onAutoHeightCalculated;
6715
+ setAutoHeightCallback(callback) {
6716
+ this.onAutoHeightCalculated = callback;
6576
6717
  }
6577
6718
  columnRangeCache = null;
6578
6719
  getColumnRange() {
@@ -6614,7 +6755,14 @@
6614
6755
  }
6615
6756
  const [marginTop, marginRight, marginBottom, marginLeft] = parseMargin(detailConfig?.style?.margin);
6616
6757
  const configHeight = height ? height : detailConfig?.style?.height || 300;
6617
- if (configHeight <= marginTop + marginBottom) {
6758
+ let actualHeight;
6759
+ if (configHeight === 'auto') {
6760
+ actualHeight = 300;
6761
+ }
6762
+ else {
6763
+ actualHeight = typeof configHeight === 'number' ? configHeight : 300;
6764
+ }
6765
+ if (actualHeight <= marginTop + marginBottom) {
6618
6766
  return {
6619
6767
  x1: firstColRect.left + marginLeft,
6620
6768
  y1: detailRowRect.top + originalHeight,
@@ -6626,7 +6774,7 @@
6626
6774
  x1: firstColRect.left + marginLeft,
6627
6775
  y1: detailRowRect.top + originalHeight + marginTop,
6628
6776
  x2: lastColRect.right - marginRight,
6629
- y2: detailRowRect.top + originalHeight - marginBottom + configHeight
6777
+ y2: detailRowRect.top + originalHeight - marginBottom + actualHeight
6630
6778
  };
6631
6779
  if (viewBox.x2 <= viewBox.x1 || viewBox.y2 <= viewBox.y1) {
6632
6780
  return null;
@@ -7972,6 +8120,7 @@
7972
8120
  const enableCheckboxCascade = this.pluginOptions.enableCheckboxCascade ?? true;
7973
8121
  this.subTableManager = new SubTableManager(this.table, enableCheckboxCascade);
7974
8122
  this.configManager.setRowExpandedChecker((row) => this.eventManager.isRowExpanded(row));
8123
+ this.configManager.setExpandRowCallback((rowIndex) => this.expandRow(rowIndex));
7975
8124
  this.eventManager.setCallbacks({
7976
8125
  onUpdateSubTablePositions: () => this.subTableManager.recalculateAllSubTablePositions(),
7977
8126
  onUpdateSubTablePositionsForRow: () => this.subTableManager.updateSubTablePositionsForRowResize(),
@@ -7984,6 +8133,9 @@
7984
8133
  this.subTableManager.setCallbacks({
7985
8134
  getDetailConfigForRecord: (record, bodyRowIndex) => this.configManager.getDetailConfigForRecord(record, bodyRowIndex)
7986
8135
  });
8136
+ this.subTableManager.setAutoHeightCallback((bodyRowIndex, newTotalHeight) => {
8137
+ this.handleAutoHeightUpdate(bodyRowIndex, newTotalHeight);
8138
+ });
7987
8139
  }
7988
8140
  setupMasterDetailFeatures() {
7989
8141
  this.initInternalProps();
@@ -8073,18 +8225,19 @@
8073
8225
  this.eventManager.addExpandedRow(rowIndex);
8074
8226
  const originalHeight = this.table.getRowHeight(rowIndex);
8075
8227
  if (internalProps.originalRowHeights) {
8228
+ this.table.scenegraph.getCell(colIndex, rowIndex);
8076
8229
  internalProps.originalRowHeights.set(bodyRowIndex, originalHeight);
8077
8230
  }
8078
8231
  const record = getRecordByRowIndex(this.table, bodyRowIndex);
8079
8232
  const detailConfig = this.configManager.getDetailConfigForRecord(record, bodyRowIndex);
8080
8233
  const height = detailConfig?.style?.height || 300;
8081
8234
  const childrenData = Array.isArray(record.children) ? record.children : [];
8082
- const deltaHeight = height;
8235
+ const isAutoHeight = height === 'auto';
8236
+ const deltaHeight = isAutoHeight ? 300 : typeof height === 'number' ? height : 300;
8083
8237
  this.updateRowHeightForExpand(rowIndex, deltaHeight);
8084
8238
  this.table.scenegraph.updateContainerHeight(rowIndex, deltaHeight);
8085
8239
  internalProps._heightResizedRowMap.add(rowIndex);
8086
8240
  this.subTableManager.renderSubTable(bodyRowIndex, childrenData, (record, bodyRowIndex) => this.configManager.getDetailConfigForRecord(record, bodyRowIndex));
8087
- this.subTableManager.recalculateAllSubTablePositions(bodyRowIndex + 1, undefined, (record, bodyRowIndex) => this.configManager.getDetailConfigForRecord(record, bodyRowIndex));
8088
8241
  if (rowIndex !== this.table.rowCount - 1) {
8089
8242
  this.drawUnderlineForRow(rowIndex);
8090
8243
  }
@@ -8092,6 +8245,21 @@
8092
8245
  if (this.table.heightMode === 'adaptive') {
8093
8246
  this.table.scenegraph.dealHeightMode();
8094
8247
  }
8248
+ this.updateFrozenColumnShadowHeight();
8249
+ }
8250
+ handleAutoHeightUpdate(bodyRowIndex, newTotalHeight) {
8251
+ try {
8252
+ const rowIndex = bodyRowIndex + this.table.columnHeaderLevelCount;
8253
+ const currentRowHeight = this.table.getRowHeight(rowIndex);
8254
+ const internalProps = getInternalProps(this.table);
8255
+ const originalHeight = internalProps.originalRowHeights?.get(bodyRowIndex) || 0;
8256
+ const currentDetailHeight = currentRowHeight - originalHeight;
8257
+ const heightDifference = newTotalHeight - currentDetailHeight;
8258
+ this.updateRowHeightForExpand(rowIndex, heightDifference);
8259
+ this.table.scenegraph.updateContainerHeight(rowIndex, heightDifference);
8260
+ }
8261
+ catch (error) {
8262
+ }
8095
8263
  }
8096
8264
  collapseRow(rowIndex, colIndex) {
8097
8265
  const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;
@@ -8123,11 +8291,11 @@
8123
8291
  if (rowIndex !== this.table.rowCount - 1) {
8124
8292
  this.removeUnderlineFromRow(rowIndex);
8125
8293
  }
8126
- this.subTableManager.recalculateAllSubTablePositions(bodyRowIndex + 1, undefined, (record, bodyRowIndex) => this.configManager.getDetailConfigForRecord(record, bodyRowIndex));
8127
8294
  this.refreshRowIcon(rowIndex, colIndex);
8128
8295
  if (this.table.heightMode === 'adaptive') {
8129
8296
  this.table.scenegraph.dealHeightMode();
8130
8297
  }
8298
+ this.updateFrozenColumnShadowHeight();
8131
8299
  }
8132
8300
  collapseRowToNoRealRecordIndex(rowIndex) {
8133
8301
  const bodyRowIndex = rowIndex - this.table.columnHeaderLevelCount;
@@ -8149,11 +8317,11 @@
8149
8317
  if (rowIndex !== this.table.rowCount - 1) {
8150
8318
  this.removeUnderlineFromRow(rowIndex);
8151
8319
  }
8152
- this.subTableManager.recalculateAllSubTablePositions(bodyRowIndex + 1, undefined, (record, bodyRowIndex) => this.configManager.getDetailConfigForRecord(record, bodyRowIndex));
8153
8320
  this.refreshRowIcon(rowIndex);
8154
8321
  if (this.table.heightMode === 'adaptive') {
8155
8322
  this.table.scenegraph.dealHeightMode();
8156
8323
  }
8324
+ this.updateFrozenColumnShadowHeight();
8157
8325
  }
8158
8326
  toggleRowExpand(rowIndex, colIndex) {
8159
8327
  if (this.eventManager.isRowExpanded(rowIndex)) {
@@ -8286,11 +8454,6 @@
8286
8454
  this.table.scenegraph.updateHierarchyIcon(targetColumnIndex, rowIndex);
8287
8455
  }
8288
8456
  }
8289
- update() {
8290
- if (this.table) {
8291
- this.subTableManager.recalculateAllSubTablePositions(0, undefined, (record, bodyRowIndex) => this.configManager.getDetailConfigForRecord(record, bodyRowIndex));
8292
- }
8293
- }
8294
8457
  setRecordChildren(children, col, row) {
8295
8458
  const recordIndex = this.table.getRecordIndexByCell(col, row);
8296
8459
  if (recordIndex === undefined || recordIndex === null) {
@@ -8408,6 +8571,16 @@
8408
8571
  }
8409
8572
  return result;
8410
8573
  }
8574
+ updateFrozenColumnShadowHeight() {
8575
+ try {
8576
+ const frozenColCount = this.table.frozenColCount;
8577
+ if (frozenColCount > 0) {
8578
+ this.table.scenegraph.component.setFrozenColumnShadow(frozenColCount - 1);
8579
+ }
8580
+ }
8581
+ catch (error) {
8582
+ }
8583
+ }
8411
8584
  cleanupMasterDetailFeatures() {
8412
8585
  if (this.mainTableClickHandler) {
8413
8586
  this.table.off('click_cell', this.mainTableClickHandler);
@@ -9075,10 +9248,10 @@ ${recordsStr}
9075
9248
  }
9076
9249
  }, pluginOptions.cornerCellStyle),
9077
9250
  checkMoveColumnOrder: (colIndex) => {
9078
- return this.table.isColumnSelected(colIndex);
9251
+ return this.pluginOptions.dragOrder?.enableDragColumnOrder ? this.table.isColumnSelected(colIndex) : false;
9079
9252
  },
9080
9253
  checkMoveRowOrder: (rowIndex) => {
9081
- return this.table.isRowSelected(rowIndex);
9254
+ return this.pluginOptions.dragOrder?.enableDragRowOrder ? this.table.isRowSelected(rowIndex) : false;
9082
9255
  }
9083
9256
  });
9084
9257
  this.listenComponentEvents();
@@ -9101,6 +9274,7 @@ ${recordsStr}
9101
9274
  for (let i = options.columns.length; i < this.pluginOptions.colCount; i++) {
9102
9275
  const columnFields = {
9103
9276
  field: i,
9277
+ key: i,
9104
9278
  title: ``
9105
9279
  };
9106
9280
  options.columns.push(columnFields);
@@ -9327,8 +9501,12 @@ ${recordsStr}
9327
9501
  this.seriesNumberComponent.on(vrender.SeriesNumberEvent.rowSeriesNumberWidthChange, this.handleRowSeriesNumberWidthChange);
9328
9502
  this.seriesNumberComponent.on(vrender.SeriesNumberEvent.resizeColWidthStart, this.handleResizeColWidthStart);
9329
9503
  this.seriesNumberComponent.on(vrender.SeriesNumberEvent.resizeRowHeightStart, this.handleResizeRowHeightStart);
9330
- this.seriesNumberComponent.on(vrender.SeriesNumberEvent.dragColumnOrderStart, this.handleDragColumOrderStart);
9331
- this.seriesNumberComponent.on(vrender.SeriesNumberEvent.dragRowOrderStart, this.handleDragRowOrderStart);
9504
+ if (this.pluginOptions.dragOrder?.enableDragColumnOrder) {
9505
+ this.seriesNumberComponent.on(vrender.SeriesNumberEvent.dragColumnOrderStart, this.handleDragColumOrderStart);
9506
+ }
9507
+ if (this.pluginOptions.dragOrder?.enableDragRowOrder) {
9508
+ this.seriesNumberComponent.on(vrender.SeriesNumberEvent.dragRowOrderStart, this.handleDragRowOrderStart);
9509
+ }
9332
9510
  }
9333
9511
  release() {
9334
9512
  if (this.componentLayoutLayer) {
@@ -9791,7 +9969,9 @@ ${recordsStr}
9791
9969
  });
9792
9970
  }
9793
9971
  });
9794
- table.updateFilterRules([...this.filterFuncRule, ...this.filterValueRule]);
9972
+ table.updateFilterRules([...this.filterFuncRule, ...this.filterValueRule], {
9973
+ clearRowHeightCache: false
9974
+ });
9795
9975
  }
9796
9976
  createFilterFunction(filter) {
9797
9977
  const { field, operator, condition } = filter;
@@ -9969,40 +10149,6 @@ ${recordsStr}
9969
10149
  }
9970
10150
  applyFilters() {
9971
10151
  this.engine.applyFilter(this.state, this.table);
9972
- this.updateColumnIcons();
9973
- }
9974
- updateColumnIcons() {
9975
- const columns = this.table.columns;
9976
- if (!columns) {
9977
- return;
9978
- }
9979
- const plugin = this.table.pluginManager.getPluginByName('Filter');
9980
- if (!plugin || !plugin.pluginOptions) {
9981
- return;
9982
- }
9983
- const filterIcon = plugin.pluginOptions.filterIcon;
9984
- const filteringIcon = plugin.pluginOptions.filteringIcon;
9985
- columns.forEach((col, index) => {
9986
- const field = col.field;
9987
- const filterConfig = this.state.filters.get(field);
9988
- const shouldEnableFilter = plugin.shouldEnableFilterForColumn
9989
- ? plugin.shouldEnableFilterForColumn(index, col)
9990
- : true;
9991
- if (shouldEnableFilter) {
9992
- if (filterConfig && filterConfig.enable) {
9993
- col.headerIcon = filteringIcon;
9994
- }
9995
- else {
9996
- col.headerIcon = filterIcon;
9997
- }
9998
- }
9999
- else {
10000
- if (col.headerIcon === filterIcon || col.headerIcon === filteringIcon) {
10001
- delete col.headerIcon;
10002
- }
10003
- }
10004
- });
10005
- this.table.updateColumns(columns);
10006
10152
  }
10007
10153
  shouldApplyFilter(action) {
10008
10154
  const shouldApplyActions = [
@@ -11085,6 +11231,12 @@ ${recordsStr}
11085
11231
  this.filterToolbar = new FilterToolbar(this.table, this.filterStateManager);
11086
11232
  this.filterToolbar.render(document.body);
11087
11233
  this.updateFilterIcons(eventArgs.options);
11234
+ this.filterStateManager.subscribe(() => {
11235
+ this.updateFilterIcons(eventArgs.options);
11236
+ this.table.updateColumns(eventArgs.options.columns, {
11237
+ clearRowHeightCache: false
11238
+ });
11239
+ });
11088
11240
  }
11089
11241
  else if (runtime === VTable.TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION) {
11090
11242
  this.pluginOptions = {
@@ -11141,14 +11293,33 @@ ${recordsStr}
11141
11293
  });
11142
11294
  }
11143
11295
  updateFilterIcons(options) {
11144
- const columns = options.columns;
11145
- columns.forEach((col) => {
11146
- if (this.shouldEnableFilterForColumn(col.field, col)) {
11147
- col.headerIcon = this.pluginOptions.filterIcon;
11296
+ const filterIcon = this.pluginOptions.filterIcon;
11297
+ const filteringIcon = this.pluginOptions.filteringIcon;
11298
+ const isIconEqual = (a, b) => a === b || (a && b && typeof a === 'object' && typeof b === 'object' && a.name === b.name);
11299
+ const toIconList = icons => (icons ? (Array.isArray(icons) ? icons : [icons]) : []);
11300
+ const compactIcons = list => (list.length === 0 ? undefined : list.length === 1 ? list[0] : list);
11301
+ options.columns.forEach(column => {
11302
+ const shouldShow = this.shouldEnableFilterForColumn(column.field, column);
11303
+ const isFiltering = !!this.filterStateManager.getFilterState(column.field)?.enable;
11304
+ let icons = toIconList(column.headerIcon);
11305
+ if (shouldShow) {
11306
+ if (isFiltering) {
11307
+ if (!icons.some(icon => isIconEqual(icon, filteringIcon))) {
11308
+ icons = icons.filter(icon => !isIconEqual(icon, filterIcon));
11309
+ icons.push(filteringIcon);
11310
+ }
11311
+ }
11312
+ else {
11313
+ if (!icons.some(icon => isIconEqual(icon, filterIcon))) {
11314
+ icons = icons.filter(icon => !isIconEqual(icon, filteringIcon));
11315
+ icons.push(filterIcon);
11316
+ }
11317
+ }
11148
11318
  }
11149
11319
  else {
11150
- delete col.headerIcon;
11320
+ icons = icons.filter(icon => !isIconEqual(icon, filterIcon));
11151
11321
  }
11322
+ column.headerIcon = compactIcons(icons);
11152
11323
  });
11153
11324
  }
11154
11325
  shouldEnableFilterForColumn(field, column) {