@visactor/vtable 1.7.8-alpha.4 → 1.7.8

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.js +12 -8
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotTable.js +3 -3
  4. package/cjs/PivotTable.js.map +1 -1
  5. package/cjs/core/BaseTable.d.ts +7 -0
  6. package/cjs/core/BaseTable.js +26 -9
  7. package/cjs/core/BaseTable.js.map +1 -1
  8. package/cjs/core/record-helper.js +83 -10
  9. package/cjs/core/record-helper.js.map +1 -1
  10. package/cjs/core/tableHelper.d.ts +2 -0
  11. package/cjs/core/tableHelper.js +26 -3
  12. package/cjs/core/tableHelper.js.map +1 -1
  13. package/cjs/data/CachedDataSource.d.ts +3 -3
  14. package/cjs/data/CachedDataSource.js +4 -4
  15. package/cjs/data/CachedDataSource.js.map +1 -1
  16. package/cjs/data/DataSource.d.ts +3 -3
  17. package/cjs/data/DataSource.js +28 -21
  18. package/cjs/data/DataSource.js.map +1 -1
  19. package/cjs/dataset/dataset.d.ts +20 -2
  20. package/cjs/dataset/dataset.js +259 -159
  21. package/cjs/dataset/dataset.js.map +1 -1
  22. package/cjs/dataset/statistics-helper.d.ts +22 -0
  23. package/cjs/dataset/statistics-helper.js +114 -8
  24. package/cjs/dataset/statistics-helper.js.map +1 -1
  25. package/cjs/edit/edit-manager.js +1 -0
  26. package/cjs/edit/edit-manager.js.map +1 -1
  27. package/cjs/event/listener/table-group.js +1 -0
  28. package/cjs/event/listener/table-group.js.map +1 -1
  29. package/cjs/header-helper/header-helper.js +3 -3
  30. package/cjs/header-helper/header-helper.js.map +1 -1
  31. package/cjs/icons.js +2 -2
  32. package/cjs/icons.js.map +1 -1
  33. package/cjs/index.d.ts +1 -1
  34. package/cjs/index.js +1 -1
  35. package/cjs/index.js.map +1 -1
  36. package/cjs/layout/layout-helper.js +2 -2
  37. package/cjs/layout/layout-helper.js.map +1 -1
  38. package/cjs/layout/simple-header-layout.d.ts +3 -4
  39. package/cjs/layout/simple-header-layout.js +15 -25
  40. package/cjs/layout/simple-header-layout.js.map +1 -1
  41. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +25 -10
  42. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  43. package/cjs/scenegraph/layout/frozen-react.d.ts +5 -0
  44. package/cjs/scenegraph/layout/frozen-react.js +86 -0
  45. package/cjs/scenegraph/layout/frozen-react.js.map +1 -0
  46. package/cjs/scenegraph/layout/frozen.js +6 -5
  47. package/cjs/scenegraph/layout/frozen.js.map +1 -1
  48. package/cjs/scenegraph/scenegraph.js +2 -15
  49. package/cjs/scenegraph/scenegraph.js.map +1 -1
  50. package/cjs/scenegraph/utils/text-measure.js +1 -1
  51. package/cjs/scenegraph/utils/text-measure.js.map +1 -1
  52. package/cjs/ts-types/base-table.d.ts +14 -0
  53. package/cjs/ts-types/base-table.js.map +1 -1
  54. package/cjs/ts-types/table-engine.d.ts +1 -0
  55. package/cjs/ts-types/table-engine.js.map +1 -1
  56. package/cjs/vrender.js.map +1 -1
  57. package/dist/vtable.js +1231 -443
  58. package/dist/vtable.min.js +2 -2
  59. package/es/ListTable.js +10 -10
  60. package/es/ListTable.js.map +1 -1
  61. package/es/PivotTable.js +3 -3
  62. package/es/PivotTable.js.map +1 -1
  63. package/es/core/BaseTable.d.ts +7 -0
  64. package/es/core/BaseTable.js +27 -9
  65. package/es/core/BaseTable.js.map +1 -1
  66. package/es/core/record-helper.js +83 -10
  67. package/es/core/record-helper.js.map +1 -1
  68. package/es/core/tableHelper.d.ts +2 -0
  69. package/es/core/tableHelper.js +23 -1
  70. package/es/core/tableHelper.js.map +1 -1
  71. package/es/data/CachedDataSource.d.ts +3 -3
  72. package/es/data/CachedDataSource.js +4 -4
  73. package/es/data/CachedDataSource.js.map +1 -1
  74. package/es/data/DataSource.d.ts +3 -3
  75. package/es/data/DataSource.js +28 -21
  76. package/es/data/DataSource.js.map +1 -1
  77. package/es/dataset/dataset.d.ts +20 -2
  78. package/es/dataset/dataset.js +258 -159
  79. package/es/dataset/dataset.js.map +1 -1
  80. package/es/dataset/statistics-helper.d.ts +22 -0
  81. package/es/dataset/statistics-helper.js +114 -8
  82. package/es/dataset/statistics-helper.js.map +1 -1
  83. package/es/edit/edit-manager.js +1 -0
  84. package/es/edit/edit-manager.js.map +1 -1
  85. package/es/event/listener/table-group.js +1 -0
  86. package/es/event/listener/table-group.js.map +1 -1
  87. package/es/header-helper/header-helper.js +3 -3
  88. package/es/header-helper/header-helper.js.map +1 -1
  89. package/es/icons.js +2 -2
  90. package/es/icons.js.map +1 -1
  91. package/es/index.d.ts +1 -1
  92. package/es/index.js +1 -1
  93. package/es/index.js.map +1 -1
  94. package/es/layout/layout-helper.js +2 -2
  95. package/es/layout/layout-helper.js.map +1 -1
  96. package/es/layout/simple-header-layout.d.ts +3 -4
  97. package/es/layout/simple-header-layout.js +15 -25
  98. package/es/layout/simple-header-layout.js.map +1 -1
  99. package/es/scenegraph/graphic/contributions/group-contribution-render.js +25 -10
  100. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  101. package/es/scenegraph/layout/frozen-react.d.ts +5 -0
  102. package/es/scenegraph/layout/frozen-react.js +77 -0
  103. package/es/scenegraph/layout/frozen-react.js.map +1 -0
  104. package/es/scenegraph/layout/frozen.js +6 -4
  105. package/es/scenegraph/layout/frozen.js.map +1 -1
  106. package/es/scenegraph/scenegraph.js +3 -14
  107. package/es/scenegraph/scenegraph.js.map +1 -1
  108. package/es/scenegraph/utils/text-measure.js +2 -2
  109. package/es/scenegraph/utils/text-measure.js.map +1 -1
  110. package/es/ts-types/base-table.d.ts +14 -0
  111. package/es/ts-types/base-table.js.map +1 -1
  112. package/es/ts-types/table-engine.d.ts +1 -0
  113. package/es/ts-types/table-engine.js.map +1 -1
  114. package/es/vrender.js.map +1 -1
  115. package/package.json +5 -5
package/dist/vtable.js CHANGED
@@ -28900,6 +28900,28 @@
28900
28900
  this.records.push(record);
28901
28901
  }
28902
28902
  }
28903
+ this.clearCacheValue();
28904
+ }
28905
+ deleteRecord(record) {
28906
+ if (record) {
28907
+ if (this.isRecord && this.records) {
28908
+ this.records = this.records.filter(item => item !== record);
28909
+ }
28910
+ }
28911
+ this.clearCacheValue();
28912
+ }
28913
+ updateRecord(oldRecord, newRecord) {
28914
+ if (oldRecord && newRecord) {
28915
+ if (this.isRecord && this.records) {
28916
+ this.records = this.records.map(item => {
28917
+ if (item === oldRecord) {
28918
+ return newRecord;
28919
+ }
28920
+ return item;
28921
+ });
28922
+ }
28923
+ this.clearCacheValue();
28924
+ }
28903
28925
  }
28904
28926
  value() {
28905
28927
  return this.records;
@@ -28923,6 +28945,34 @@
28923
28945
  this.fieldValue = record[this.field];
28924
28946
  }
28925
28947
  }
28948
+ this.clearCacheValue();
28949
+ }
28950
+ deleteRecord(record) {
28951
+ if (record) {
28952
+ if (this.isRecord && this.records) {
28953
+ this.records = this.records.filter(item => item !== record);
28954
+ }
28955
+ if (this.field && this.records.length) {
28956
+ this.fieldValue = this.records[this.records.length - 1][this.field];
28957
+ }
28958
+ }
28959
+ this.clearCacheValue();
28960
+ }
28961
+ updateRecord(oldRecord, newRecord) {
28962
+ if (oldRecord && newRecord) {
28963
+ if (this.isRecord && this.records) {
28964
+ this.records = this.records.map(item => {
28965
+ if (item === oldRecord) {
28966
+ return newRecord;
28967
+ }
28968
+ return item;
28969
+ });
28970
+ }
28971
+ if (this.field && this.records.length) {
28972
+ this.fieldValue = this.records[this.records.length - 1][this.field];
28973
+ }
28974
+ this.clearCacheValue();
28975
+ }
28926
28976
  }
28927
28977
  value() {
28928
28978
  return this.fieldValue;
@@ -28958,6 +29008,34 @@
28958
29008
  this.values.push(record[this.field]);
28959
29009
  }
28960
29010
  }
29011
+ this.clearCacheValue();
29012
+ }
29013
+ updateRecord(oldRecord, newRecord) {
29014
+ if (oldRecord && newRecord) {
29015
+ if (this.isRecord && this.records) {
29016
+ this.records = this.records.map(item => {
29017
+ if (item === oldRecord) {
29018
+ return newRecord;
29019
+ }
29020
+ return item;
29021
+ });
29022
+ }
29023
+ if (this.field && this.records.length) {
29024
+ this.values = this.records.map(item => item[this.field]);
29025
+ }
29026
+ this.clearCacheValue();
29027
+ }
29028
+ }
29029
+ deleteRecord(record) {
29030
+ if (record) {
29031
+ if (this.isRecord && this.records) {
29032
+ this.records = this.records.filter(item => item !== record);
29033
+ }
29034
+ if (this.field && this.records.length) {
29035
+ this.values = this.records.map(item => item[this.field]);
29036
+ }
29037
+ }
29038
+ this.clearCacheValue();
28961
29039
  }
28962
29040
  value() {
28963
29041
  if (!this.fieldValue) {
@@ -28994,6 +29072,28 @@
28994
29072
  this.records.push(record);
28995
29073
  }
28996
29074
  }
29075
+ this.clearCacheValue();
29076
+ }
29077
+ deleteRecord(record) {
29078
+ if (record) {
29079
+ if (this.isRecord && this.records) {
29080
+ this.records = this.records.filter(item => item !== record);
29081
+ }
29082
+ }
29083
+ this.clearCacheValue();
29084
+ }
29085
+ updateRecord(oldRecord, newRecord) {
29086
+ if (oldRecord && newRecord) {
29087
+ if (this.isRecord && this.records) {
29088
+ this.records = this.records.map(item => {
29089
+ if (item === oldRecord) {
29090
+ return newRecord;
29091
+ }
29092
+ return item;
29093
+ });
29094
+ }
29095
+ this.clearCacheValue();
29096
+ }
28997
29097
  }
28998
29098
  value() {
28999
29099
  if (!this.fieldValue) {
@@ -29054,6 +29154,90 @@
29054
29154
  }
29055
29155
  }
29056
29156
  }
29157
+ this.clearCacheValue();
29158
+ }
29159
+ deleteRecord(record) {
29160
+ if (record) {
29161
+ if (this.isRecord && this.records) {
29162
+ this.records = this.records.filter(item => item !== record);
29163
+ }
29164
+ if (record.className === 'Aggregator') {
29165
+ const value = record.value();
29166
+ this.sum -= value ?? 0;
29167
+ if (this.needSplitPositiveAndNegativeForSum) {
29168
+ if (value > 0) {
29169
+ this.positiveSum -= value;
29170
+ }
29171
+ else if (value < 0) {
29172
+ this.nagetiveSum -= value;
29173
+ }
29174
+ }
29175
+ }
29176
+ else if (this.field && !isNaN(parseFloat(record[this.field]))) {
29177
+ const value = parseFloat(record[this.field]);
29178
+ this.sum -= value;
29179
+ if (this.needSplitPositiveAndNegativeForSum) {
29180
+ if (value > 0) {
29181
+ this.positiveSum -= value;
29182
+ }
29183
+ else if (value < 0) {
29184
+ this.nagetiveSum -= value;
29185
+ }
29186
+ }
29187
+ }
29188
+ }
29189
+ this.clearCacheValue();
29190
+ }
29191
+ updateRecord(oldRecord, newRecord) {
29192
+ if (oldRecord && newRecord) {
29193
+ if (this.isRecord && this.records) {
29194
+ this.records = this.records.map(item => {
29195
+ if (item === oldRecord) {
29196
+ return newRecord;
29197
+ }
29198
+ return item;
29199
+ });
29200
+ }
29201
+ if (oldRecord.className === 'Aggregator') {
29202
+ const oldValue = oldRecord.value();
29203
+ const newValue = newRecord.value();
29204
+ this.sum += newValue - oldValue;
29205
+ if (this.needSplitPositiveAndNegativeForSum) {
29206
+ if (oldValue > 0) {
29207
+ this.positiveSum -= oldValue;
29208
+ }
29209
+ else if (oldValue < 0) {
29210
+ this.nagetiveSum -= oldValue;
29211
+ }
29212
+ if (newValue > 0) {
29213
+ this.positiveSum += newValue;
29214
+ }
29215
+ else if (newValue < 0) {
29216
+ this.nagetiveSum += newValue;
29217
+ }
29218
+ }
29219
+ }
29220
+ else if (this.field && !isNaN(parseFloat(oldRecord[this.field]))) {
29221
+ const oldValue = parseFloat(oldRecord[this.field]);
29222
+ const newValue = parseFloat(newRecord[this.field]);
29223
+ this.sum += newValue - oldValue;
29224
+ if (this.needSplitPositiveAndNegativeForSum) {
29225
+ if (oldValue > 0) {
29226
+ this.positiveSum -= oldValue;
29227
+ }
29228
+ else if (oldValue < 0) {
29229
+ this.nagetiveSum -= oldValue;
29230
+ }
29231
+ if (newValue > 0) {
29232
+ this.positiveSum += newValue;
29233
+ }
29234
+ else if (newValue < 0) {
29235
+ this.nagetiveSum += newValue;
29236
+ }
29237
+ }
29238
+ }
29239
+ this.clearCacheValue();
29240
+ }
29057
29241
  }
29058
29242
  value() {
29059
29243
  return this.records?.length >= 1 ? this.sum : undefined;
@@ -29123,6 +29307,36 @@
29123
29307
  this.count++;
29124
29308
  }
29125
29309
  }
29310
+ this.clearCacheValue();
29311
+ }
29312
+ deleteRecord(record) {
29313
+ if (record) {
29314
+ if (this.isRecord && this.records) {
29315
+ this.records = this.records.filter(item => item !== record);
29316
+ }
29317
+ if (record.className === 'Aggregator') {
29318
+ this.count -= record.value();
29319
+ }
29320
+ else {
29321
+ this.count--;
29322
+ }
29323
+ }
29324
+ this.clearCacheValue();
29325
+ }
29326
+ updateRecord(oldRecord, newRecord) {
29327
+ if (oldRecord && newRecord) {
29328
+ if (this.isRecord && this.records) {
29329
+ this.records = this.records.map(item => {
29330
+ if (item === oldRecord) {
29331
+ return newRecord;
29332
+ }
29333
+ return item;
29334
+ });
29335
+ }
29336
+ if (oldRecord.className === 'Aggregator') {
29337
+ this.count += newRecord.value() - oldRecord.value();
29338
+ }
29339
+ }
29126
29340
  }
29127
29341
  value() {
29128
29342
  return this.count;
@@ -29170,6 +29384,43 @@
29170
29384
  this.count++;
29171
29385
  }
29172
29386
  }
29387
+ this.clearCacheValue();
29388
+ }
29389
+ deleteRecord(record) {
29390
+ if (record) {
29391
+ if (this.isRecord && this.records) {
29392
+ this.records = this.records.filter(item => item !== record);
29393
+ }
29394
+ if (record.className === 'Aggregator' && record.type === AggregationType.AVG) {
29395
+ this.sum -= record.sum;
29396
+ this.count -= record.count;
29397
+ }
29398
+ else if (this.field && !isNaN(parseFloat(record[this.field]))) {
29399
+ this.sum -= parseFloat(record[this.field]);
29400
+ this.count--;
29401
+ }
29402
+ }
29403
+ this.clearCacheValue();
29404
+ }
29405
+ updateRecord(oldRecord, newRecord) {
29406
+ if (oldRecord && newRecord) {
29407
+ if (this.isRecord && this.records) {
29408
+ this.records = this.records.map(item => {
29409
+ if (item === oldRecord) {
29410
+ return newRecord;
29411
+ }
29412
+ return item;
29413
+ });
29414
+ }
29415
+ if (oldRecord.className === 'Aggregator' && oldRecord.type === AggregationType.AVG) {
29416
+ this.sum += newRecord.sum - oldRecord.sum;
29417
+ this.count += newRecord.count - oldRecord.count;
29418
+ }
29419
+ else if (this.field && !isNaN(parseFloat(oldRecord[this.field]))) {
29420
+ this.sum += parseFloat(newRecord[this.field]) - parseFloat(oldRecord[this.field]);
29421
+ }
29422
+ this.clearCacheValue();
29423
+ }
29173
29424
  }
29174
29425
  value() {
29175
29426
  return this.records?.length >= 1 ? this.sum / this.count : undefined;
@@ -29224,6 +29475,28 @@
29224
29475
  this.max = parseFloat(record[this.field]) > this.max ? parseFloat(record[this.field]) : this.max;
29225
29476
  }
29226
29477
  }
29478
+ this.clearCacheValue();
29479
+ }
29480
+ deleteRecord(record) {
29481
+ if (record) {
29482
+ if (this.isRecord && this.records) {
29483
+ this.records = this.records.filter(item => item !== record);
29484
+ }
29485
+ this.recalculate();
29486
+ }
29487
+ }
29488
+ updateRecord(oldRecord, newRecord) {
29489
+ if (oldRecord && newRecord) {
29490
+ if (this.isRecord && this.records) {
29491
+ this.records = this.records.map(item => {
29492
+ if (item === oldRecord) {
29493
+ return newRecord;
29494
+ }
29495
+ return item;
29496
+ });
29497
+ }
29498
+ this.recalculate();
29499
+ }
29227
29500
  }
29228
29501
  value() {
29229
29502
  return this.records?.length >= 1 ? this.max : undefined;
@@ -29277,6 +29550,28 @@
29277
29550
  this.min = record[this.field] < this.min ? record[this.field] : this.min;
29278
29551
  }
29279
29552
  }
29553
+ this.clearCacheValue();
29554
+ }
29555
+ deleteRecord(record) {
29556
+ if (record) {
29557
+ if (this.isRecord && this.records) {
29558
+ this.records = this.records.filter(item => item !== record);
29559
+ }
29560
+ this.recalculate();
29561
+ }
29562
+ }
29563
+ updateRecord(oldRecord, newRecord) {
29564
+ if (oldRecord && newRecord) {
29565
+ if (this.isRecord && this.records) {
29566
+ this.records = this.records.map(item => {
29567
+ if (item === oldRecord) {
29568
+ return newRecord;
29569
+ }
29570
+ return item;
29571
+ });
29572
+ }
29573
+ this.recalculate();
29574
+ }
29280
29575
  }
29281
29576
  value() {
29282
29577
  return this.records?.length >= 1 ? this.min : undefined;
@@ -29530,15 +29825,15 @@
29530
29825
  registedAggregators = {};
29531
29826
  rowHierarchyType;
29532
29827
  fieldAggregators = [];
29533
- layoutColumnObjects = [];
29828
+ columns;
29534
29829
  lastFilterRules;
29535
- constructor(dataSourceObj, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel) {
29830
+ constructor(dataSourceObj, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
29536
29831
  super();
29537
29832
  this.registerAggregators();
29538
29833
  this.dataSourceObj = dataSourceObj;
29539
29834
  this.dataConfig = dataConfig;
29540
29835
  this._get = dataSourceObj?.get;
29541
- this.layoutColumnObjects = columnObjs;
29836
+ this.columns = columns;
29542
29837
  this._source = dataSourceObj?.records ? this.processRecords(dataSourceObj?.records) : dataSourceObj;
29543
29838
  this._sourceLength = this._source?.length || 0;
29544
29839
  this.sortedIndexMap = new Map();
@@ -29600,9 +29895,9 @@
29600
29895
  this.registerAggregator(AggregationType.CUSTOM, CustomAggregator);
29601
29896
  }
29602
29897
  _generateFieldAggragations() {
29603
- const columnObjs = this.layoutColumnObjects;
29898
+ const columnObjs = this.columns;
29604
29899
  for (let i = 0; i < columnObjs?.length; i++) {
29605
- columnObjs[i].aggregator = null;
29900
+ delete columnObjs[i].vtable_aggregator;
29606
29901
  const field = columnObjs[i].field;
29607
29902
  const aggragation = columnObjs[i].aggregation;
29608
29903
  if (!aggragation) {
@@ -29618,10 +29913,10 @@
29618
29913
  aggregationFun: item.aggregationFun
29619
29914
  });
29620
29915
  this.fieldAggregators.push(aggregator);
29621
- if (!columnObjs[i].aggregator) {
29622
- columnObjs[i].aggregator = [];
29916
+ if (!columnObjs[i].vtable_aggregator) {
29917
+ columnObjs[i].vtable_aggregator = [];
29623
29918
  }
29624
- columnObjs[i].aggregator.push(aggregator);
29919
+ columnObjs[i].vtable_aggregator.push(aggregator);
29625
29920
  }
29626
29921
  }
29627
29922
  else {
@@ -29632,7 +29927,7 @@
29632
29927
  aggregationFun: aggragation.aggregationFun
29633
29928
  });
29634
29929
  this.fieldAggregators.push(aggregator);
29635
- columnObjs[i].aggregator = aggregator;
29930
+ columnObjs[i].vtable_aggregator = aggregator;
29636
29931
  }
29637
29932
  }
29638
29933
  }
@@ -29710,6 +30005,9 @@
29710
30005
  if (childNodeData.hierarchyState === HierarchyState.expand) {
29711
30006
  childTotalLength += this.initChildrenNodeHierarchy(childIndexKey, hierarchyExpandLevel, currentLevel + 1, childNodeData);
29712
30007
  }
30008
+ if (childNodeData.children === true) {
30009
+ !childNodeData.hierarchyState && (childNodeData.hierarchyState = HierarchyState.collapse);
30010
+ }
29713
30011
  }
29714
30012
  return childTotalLength;
29715
30013
  }
@@ -29921,6 +30219,9 @@
29921
30219
  this.adjustBeforeChangedRecordsMap(index, 1);
29922
30220
  this.currentIndexedData.push(this.currentIndexedData.length);
29923
30221
  this._sourceLength += 1;
30222
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
30223
+ this.fieldAggregators[i].push(record);
30224
+ }
29924
30225
  if (this.rowHierarchyType === 'tree') {
29925
30226
  this.initTreeHierarchyState();
29926
30227
  }
@@ -29952,6 +30253,11 @@
29952
30253
  this.currentIndexedData.push(this.currentIndexedData.length);
29953
30254
  }
29954
30255
  this._sourceLength += recordArr.length;
30256
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
30257
+ for (let j = 0; j < recordArr.length; j++) {
30258
+ this.fieldAggregators[i].push(recordArr[j]);
30259
+ }
30260
+ }
29955
30261
  }
29956
30262
  if (this.userPagination) {
29957
30263
  this.pagination.totalCount = this._sourceLength;
@@ -30021,6 +30327,10 @@
30021
30327
  }
30022
30328
  delete this.beforeChangedRecordsMap[recordIndex];
30023
30329
  realDeletedRecordIndexs.push(recordIndex);
30330
+ const deletedRecord = this.records[recordIndex];
30331
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
30332
+ this.fieldAggregators[i].deleteRecord(deletedRecord);
30333
+ }
30024
30334
  this.records.splice(recordIndex, 1);
30025
30335
  this.currentIndexedData.pop();
30026
30336
  this._sourceLength -= 1;
@@ -30069,6 +30379,9 @@
30069
30379
  }
30070
30380
  delete this.beforeChangedRecordsMap[recordIndex];
30071
30381
  realDeletedRecordIndexs.push(recordIndex);
30382
+ for (let i = 0; i < this.fieldAggregators.length; i++) {
30383
+ this.fieldAggregators[i].updateRecord(this.records[recordIndex], records[index]);
30384
+ }
30072
30385
  this.records[recordIndex] = records[index];
30073
30386
  }
30074
30387
  if (this.userPagination) {
@@ -30093,8 +30406,8 @@
30093
30406
  }
30094
30407
  sort(states) {
30095
30408
  states = (Array.isArray(states) ? states : [states]).filter(state => {
30096
- let column = this.layoutColumnObjects.find(obj => obj.field == state.field);
30097
- return column?.define?.sort !== false && state.order !== 'normal';
30409
+ const column = this.columns.find(obj => obj.field === state.field);
30410
+ return column?.sort !== false && state.order !== 'normal';
30098
30411
  });
30099
30412
  this.lastSortStates = states;
30100
30413
  let filedMapArray = states.map(state => this.sortedIndexMap.get(state?.field) || { asc: [], desc: [], normal: [] });
@@ -30527,20 +30840,20 @@
30527
30840
  static get EVENT_TYPE() {
30528
30841
  return DataSource.EVENT_TYPE;
30529
30842
  }
30530
- static ofArray(array, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel) {
30843
+ static ofArray(array, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
30531
30844
  return new CachedDataSource({
30532
30845
  get: (index) => {
30533
30846
  return array[index];
30534
30847
  },
30535
30848
  length: array.length,
30536
30849
  records: array
30537
- }, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel);
30850
+ }, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel);
30538
30851
  }
30539
- constructor(opt, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel) {
30852
+ constructor(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
30540
30853
  if (isArray$1(dataConfig?.groupByRules)) {
30541
30854
  rowHierarchyType = 'tree';
30542
30855
  }
30543
- super(opt, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel);
30856
+ super(opt, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel);
30544
30857
  this._recordCache = [];
30545
30858
  this._fieldCache = {};
30546
30859
  }
@@ -31212,7 +31525,7 @@
31212
31525
  function _setRecords(table, records = []) {
31213
31526
  _dealWithUpdateDataSource(table, () => {
31214
31527
  table.internalProps.records = records;
31215
- const newDataSource = (table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.layoutMap.columnObjects, table.internalProps.layoutMap.rowHierarchyType, getHierarchyExpandLevel(table)));
31528
+ const newDataSource = (table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.columns, table.internalProps.layoutMap.rowHierarchyType, getHierarchyExpandLevel(table)));
31216
31529
  table.addReleaseObj(newDataSource);
31217
31530
  });
31218
31531
  }
@@ -31516,6 +31829,36 @@
31516
31829
  }
31517
31830
  return undefined;
31518
31831
  }
31832
+ function generateAggregationForColumn(table) {
31833
+ for (let col = 0; col < table.internalProps.columns.length; col++) {
31834
+ const colDef = table.internalProps.columns[col];
31835
+ if (colDef.aggregation) ;
31836
+ else if (table.options.aggregation) {
31837
+ let aggregation;
31838
+ if (typeof table.options.aggregation === 'function') {
31839
+ aggregation = table.options.aggregation({
31840
+ col: col,
31841
+ field: colDef.field
31842
+ });
31843
+ }
31844
+ else {
31845
+ aggregation = table.options.aggregation;
31846
+ }
31847
+ if (aggregation) {
31848
+ if (Array.isArray(aggregation)) {
31849
+ const aggregations = [];
31850
+ aggregation.forEach(item => {
31851
+ aggregations.push(Object.assign({ showOnTop: false }, item));
31852
+ });
31853
+ colDef.aggregation = aggregations;
31854
+ }
31855
+ else {
31856
+ colDef.aggregation = Object.assign({ showOnTop: false }, aggregation);
31857
+ }
31858
+ }
31859
+ }
31860
+ }
31861
+ }
31519
31862
 
31520
31863
  let Icon$1 = class Icon extends Image$2 {
31521
31864
  role;
@@ -32248,9 +32591,9 @@
32248
32591
  return {
32249
32592
  type: 'svg',
32250
32593
  svg: '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">' +
32251
- ' <path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#282F38" fill-opacity="0.35"/>' +
32252
- '<path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#416EFF"/>' +
32253
- ' </svg>',
32594
+ ' <path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#416EFF"/>' +
32595
+ '<path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#282F38" fill-opacity="0.35"/>' +
32596
+ '</svg> ',
32254
32597
  width: 16,
32255
32598
  height: 16,
32256
32599
  funcType: IconFuncTypeEnum.sort,
@@ -32269,9 +32612,9 @@
32269
32612
  return {
32270
32613
  type: 'svg',
32271
32614
  svg: '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">' +
32272
- ' <path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#416EFF"/>' +
32273
- '<path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#282F38" fill-opacity="0.35"/>' +
32274
- '</svg> ',
32615
+ ' <path d="M4.6665 9H11.3332L7.99984 13.1667L4.6665 9Z" fill="#282F38" fill-opacity="0.35"/>' +
32616
+ '<path d="M11.3335 7L4.66683 7L8.00016 2.83333L11.3335 7Z" fill="#416EFF"/>' +
32617
+ ' </svg>',
32275
32618
  width: 16,
32276
32619
  height: 16,
32277
32620
  funcType: IconFuncTypeEnum.sort,
@@ -34657,7 +35000,7 @@
34657
35000
  fontSize: DefaultTextStyle.fontSize
34658
35001
  },
34659
35002
  getTextBounds: useNaiveCanvas ? undefined : getTextBounds,
34660
- specialCharSet: `{}()//&-/: .,@%'"~…=${TextMeasure.ALPHABET_CHAR_SET}${TextMeasure.ALPHABET_CHAR_SET.toUpperCase()}0123456789${customAlphabetCharSet}`,
35003
+ specialCharSet: `{}()//&-/: .,@%'"~…=——${TextMeasure.ALPHABET_CHAR_SET}${TextMeasure.ALPHABET_CHAR_SET.toUpperCase()}0123456789${customAlphabetCharSet}`,
34661
35004
  ...(option ?? {})
34662
35005
  }, textSpec);
34663
35006
  };
@@ -38298,6 +38641,16 @@
38298
38641
  if (bottomRight) {
38299
38642
  x = Math.floor(x) - 0.5;
38300
38643
  y = Math.floor(y) - 0.5;
38644
+ if (group.role === 'cell') {
38645
+ const col = group.col;
38646
+ const row = group.row;
38647
+ if (col === 0) {
38648
+ x += 1;
38649
+ }
38650
+ if (row === 0) {
38651
+ y += 1;
38652
+ }
38653
+ }
38301
38654
  }
38302
38655
  else {
38303
38656
  x = Math.floor(x) + 0.5;
@@ -38574,6 +38927,16 @@
38574
38927
  if (bottomRight) {
38575
38928
  x = Math.floor(x) - 0.5;
38576
38929
  y = Math.floor(y) - 0.5;
38930
+ if (group.role === 'cell') {
38931
+ const col = group.col;
38932
+ const row = group.row;
38933
+ if (col === 0) {
38934
+ x += 1;
38935
+ }
38936
+ if (row === 0) {
38937
+ y += 1;
38938
+ }
38939
+ }
38577
38940
  }
38578
38941
  else {
38579
38942
  x = Math.floor(x) + 0.5;
@@ -38668,6 +39031,16 @@
38668
39031
  if (bottomRight) {
38669
39032
  x = Math.floor(x) - 0.5;
38670
39033
  y = Math.floor(y) - 0.5;
39034
+ if (group.role === 'cell') {
39035
+ const col = group.col;
39036
+ const row = group.row;
39037
+ if (col === 0) {
39038
+ x += 1;
39039
+ }
39040
+ if (row === 0) {
39041
+ y += 1;
39042
+ }
39043
+ }
38671
39044
  }
38672
39045
  else {
38673
39046
  x = Math.floor(x) + 0.5;
@@ -38824,6 +39197,9 @@
38824
39197
  }
38825
39198
  function getCellSizeForDraw(group, width, height, bottomRight) {
38826
39199
  const table = group.stage.table;
39200
+ if (!table) {
39201
+ return { width, height };
39202
+ }
38827
39203
  if (group.role === 'cell') {
38828
39204
  let col = group.col;
38829
39205
  let row = group.row;
@@ -38832,24 +39208,30 @@
38832
39208
  col = mergeInfo.end.col;
38833
39209
  row = mergeInfo.end.row;
38834
39210
  }
38835
- if (table && col === table.colCount - 1 && !bottomRight) {
39211
+ if (col === table.colCount - 1 && !bottomRight) {
38836
39212
  width -= 1;
38837
39213
  }
38838
- else if (table && col === table.frozenColCount - 1 && table.scrollLeft && !bottomRight) {
39214
+ else if (col === table.frozenColCount - 1 && table.scrollLeft && !bottomRight) {
38839
39215
  width -= 1;
38840
39216
  }
38841
- if (table && row === table.rowCount - 1 && !bottomRight) {
39217
+ else if (col === 0 && bottomRight) {
39218
+ width -= 1;
39219
+ }
39220
+ if (row === table.rowCount - 1 && !bottomRight) {
39221
+ height -= 1;
39222
+ }
39223
+ else if (row === table.frozenRowCount - 1 && table.scrollTop && !bottomRight) {
38842
39224
  height -= 1;
38843
39225
  }
38844
- else if (table && row === table.frozenRowCount - 1 && table.scrollTop && !bottomRight) {
39226
+ else if (row === 0 && bottomRight) {
38845
39227
  height -= 1;
38846
39228
  }
38847
39229
  }
38848
39230
  else if (group.role === 'corner-frozen') {
38849
- if (table && table.scrollLeft && !bottomRight) {
39231
+ if (table.scrollLeft && !bottomRight) {
38850
39232
  width -= 1;
38851
39233
  }
38852
- if (table && table.scrollTop && !bottomRight) {
39234
+ if (table.scrollTop && !bottomRight) {
38853
39235
  height -= 1;
38854
39236
  }
38855
39237
  }
@@ -42664,6 +43046,174 @@
42664
43046
  }
42665
43047
  }
42666
43048
 
43049
+ function createReactContainer(table) {
43050
+ const { internalProps } = table;
43051
+ internalProps.bodyDomContainer = document.createElement('div');
43052
+ internalProps.bodyDomContainer.id = 'vtable-body-dom-container';
43053
+ internalProps.bodyDomContainer.classList.add('table-component-container');
43054
+ internalProps.element.appendChild(internalProps.bodyDomContainer);
43055
+ internalProps.headerDomContainer = document.createElement('div');
43056
+ internalProps.headerDomContainer.id = 'vtable-header-dom-container';
43057
+ internalProps.headerDomContainer.classList.add('table-component-container');
43058
+ internalProps.element.appendChild(internalProps.headerDomContainer);
43059
+ internalProps.frozenBodyDomContainer = document.createElement('div');
43060
+ internalProps.frozenBodyDomContainer.id = 'vtable-frozen-body-dom-container';
43061
+ internalProps.frozenBodyDomContainer.classList.add('table-component-container');
43062
+ internalProps.element.appendChild(internalProps.frozenBodyDomContainer);
43063
+ internalProps.frozenHeaderDomContainer = document.createElement('div');
43064
+ internalProps.frozenHeaderDomContainer.id = 'vtable-frozen-header-dom-container';
43065
+ internalProps.frozenHeaderDomContainer.classList.add('table-component-container');
43066
+ internalProps.element.appendChild(internalProps.frozenHeaderDomContainer);
43067
+ internalProps.rightFrozenBodyDomContainer = document.createElement('div');
43068
+ internalProps.rightFrozenBodyDomContainer.id = 'vtable-right-frozen-body-dom-container';
43069
+ internalProps.rightFrozenBodyDomContainer.classList.add('table-component-container');
43070
+ internalProps.element.appendChild(internalProps.rightFrozenBodyDomContainer);
43071
+ internalProps.rightFrozenHeaderDomContainer = document.createElement('div');
43072
+ internalProps.rightFrozenHeaderDomContainer.id = 'vtable-right-frozen-header-dom-container';
43073
+ internalProps.rightFrozenHeaderDomContainer.classList.add('table-component-container');
43074
+ internalProps.element.appendChild(internalProps.rightFrozenHeaderDomContainer);
43075
+ internalProps.frozenBottomDomContainer = document.createElement('div');
43076
+ internalProps.frozenBottomDomContainer.id = 'vtable-frozen-bottom-dom-container';
43077
+ internalProps.frozenBottomDomContainer.classList.add('table-component-container');
43078
+ internalProps.element.appendChild(internalProps.frozenBottomDomContainer);
43079
+ internalProps.bottomDomContainer = document.createElement('div');
43080
+ internalProps.bottomDomContainer.id = 'vtable-bottom-dom-container';
43081
+ internalProps.bottomDomContainer.classList.add('table-component-container');
43082
+ internalProps.element.appendChild(internalProps.bottomDomContainer);
43083
+ internalProps.rightFrozenBottomDomContainer = document.createElement('div');
43084
+ internalProps.rightFrozenBottomDomContainer.id = 'vtable-right-frozen-bottom-dom-container';
43085
+ internalProps.rightFrozenBottomDomContainer.classList.add('table-component-container');
43086
+ internalProps.element.appendChild(internalProps.rightFrozenBottomDomContainer);
43087
+ }
43088
+ function updateReactContainer(table) {
43089
+ const { headerDomContainer, bodyDomContainer, frozenBodyDomContainer, frozenHeaderDomContainer, rightFrozenBodyDomContainer, rightFrozenHeaderDomContainer, bottomDomContainer, frozenBottomDomContainer, rightFrozenBottomDomContainer } = table.internalProps;
43090
+ if (!headerDomContainer &&
43091
+ !bodyDomContainer &&
43092
+ !frozenBodyDomContainer &&
43093
+ !frozenHeaderDomContainer &&
43094
+ !rightFrozenBodyDomContainer &&
43095
+ !rightFrozenHeaderDomContainer &&
43096
+ !bottomDomContainer &&
43097
+ !frozenBottomDomContainer &&
43098
+ !rightFrozenBottomDomContainer) {
43099
+ return;
43100
+ }
43101
+ const allColsWidth = table.getAllColsWidth();
43102
+ const frozenColsWidth = table.getFrozenColsWidth();
43103
+ const rightFrozenColsWidth = table.getRightFrozenColsWidth();
43104
+ const totalFrozenColsWidth = frozenColsWidth + rightFrozenColsWidth;
43105
+ const bodyWidth = Math.min(allColsWidth - totalFrozenColsWidth, table.tableNoFrameWidth - totalFrozenColsWidth);
43106
+ const allRowsHeight = table.getAllRowsHeight();
43107
+ const frozenRowsHeight = table.getFrozenRowsHeight();
43108
+ const bottomFrozenRowsHeight = table.getBottomFrozenRowsHeight();
43109
+ const totalFrozenRowsHeight = frozenRowsHeight + bottomFrozenRowsHeight;
43110
+ const bodyHeight = Math.min(allRowsHeight - totalFrozenRowsHeight, table.tableNoFrameHeight - totalFrozenRowsHeight);
43111
+ if (table.frozenColCount > 0) {
43112
+ headerDomContainer.style.left = `${table.tableX + frozenColsWidth}px`;
43113
+ bodyDomContainer.style.left = `${table.tableX + frozenColsWidth}px`;
43114
+ bottomDomContainer.style.left = `${table.tableX + frozenColsWidth}px`;
43115
+ }
43116
+ else if (table.frozenColCount === 0) {
43117
+ headerDomContainer.style.left = `${table.tableX}px`;
43118
+ bodyDomContainer.style.left = `${table.tableX}px`;
43119
+ bottomDomContainer.style.left = `${table.tableX}px`;
43120
+ }
43121
+ frozenBodyDomContainer.style.left = `${table.tableX}px`;
43122
+ frozenHeaderDomContainer.style.left = `${table.tableX}px`;
43123
+ headerDomContainer.style.width = `${bodyWidth}px`;
43124
+ headerDomContainer.style.height = `${frozenRowsHeight}px`;
43125
+ bodyDomContainer.style.top = `${table.tableY}px`;
43126
+ bodyDomContainer.style.width = `${bodyWidth}px`;
43127
+ bodyDomContainer.style.height = `${bodyHeight}px`;
43128
+ bodyDomContainer.style.top = `${table.tableY + frozenRowsHeight}px`;
43129
+ frozenBodyDomContainer.style.width = `${frozenColsWidth}px`;
43130
+ frozenBodyDomContainer.style.height = `${bodyHeight}px`;
43131
+ frozenBodyDomContainer.style.top = `${table.tableY + frozenRowsHeight}px`;
43132
+ frozenHeaderDomContainer.style.width = `${frozenColsWidth}px`;
43133
+ frozenHeaderDomContainer.style.height = `${frozenRowsHeight}px`;
43134
+ frozenHeaderDomContainer.style.top = `${table.tableY}px`;
43135
+ rightFrozenBodyDomContainer.style.width = `${rightFrozenColsWidth}px`;
43136
+ rightFrozenBodyDomContainer.style.height = `${bodyHeight}px`;
43137
+ rightFrozenBodyDomContainer.style.top = `${table.tableY + frozenRowsHeight}px`;
43138
+ rightFrozenBodyDomContainer.style.left = `${table.tableX + table.tableNoFrameWidth - rightFrozenColsWidth}px`;
43139
+ rightFrozenHeaderDomContainer.style.width = `${rightFrozenColsWidth}px`;
43140
+ rightFrozenHeaderDomContainer.style.height = `${frozenRowsHeight}px`;
43141
+ rightFrozenHeaderDomContainer.style.top = `${table.tableY}px`;
43142
+ rightFrozenHeaderDomContainer.style.left = `${table.tableX + table.tableNoFrameWidth - rightFrozenColsWidth}px`;
43143
+ bottomDomContainer.style.width = `${bodyWidth}px`;
43144
+ bottomDomContainer.style.height = `${bottomFrozenRowsHeight}px`;
43145
+ bottomDomContainer.style.top = `${table.tableY + table.tableNoFrameHeight - bottomFrozenRowsHeight}px`;
43146
+ frozenBottomDomContainer.style.width = `${frozenColsWidth}px`;
43147
+ frozenBottomDomContainer.style.height = `${bottomFrozenRowsHeight}px`;
43148
+ frozenBottomDomContainer.style.top = `${table.tableY + table.tableNoFrameHeight - bottomFrozenRowsHeight}px`;
43149
+ rightFrozenBottomDomContainer.style.width = `${rightFrozenColsWidth}px`;
43150
+ rightFrozenBottomDomContainer.style.height = `${bottomFrozenRowsHeight}px`;
43151
+ rightFrozenBottomDomContainer.style.top = `${table.tableY + table.tableNoFrameHeight - bottomFrozenRowsHeight}px`;
43152
+ rightFrozenBottomDomContainer.style.left = `${table.tableX + table.tableNoFrameWidth - rightFrozenColsWidth}px`;
43153
+ }
43154
+ function updateReactComponentContainer(scene) {
43155
+ if (!scene.table.reactCustomLayout) {
43156
+ return;
43157
+ }
43158
+ const { table, stage } = scene;
43159
+ const plugin = stage.pluginService.findPluginsByName('ReactAttributePlugin')[0];
43160
+ const { htmlMap } = plugin;
43161
+ for (const key in htmlMap) {
43162
+ const item = htmlMap[key];
43163
+ const { graphic, wrapContainer } = item;
43164
+ let targetContainer;
43165
+ if (scene.frozenColCount > table.frozenColCount) {
43166
+ const { col, row } = getTargetCell(graphic);
43167
+ if (row >= table.rowCount - table.bottomFrozenRowCount &&
43168
+ col < scene.frozenColCount &&
43169
+ col >= table.frozenColCount &&
43170
+ graphic.attribute.react.container === table.frozenBottomDomContainer) {
43171
+ targetContainer = table.bottomDomContainer;
43172
+ }
43173
+ else if (row >= table.frozenRowCount &&
43174
+ col < scene.frozenColCount &&
43175
+ col >= table.frozenColCount &&
43176
+ graphic.attribute.react.container === table.frozenBodyDomContainer) {
43177
+ targetContainer = table.bodyDomContainer;
43178
+ }
43179
+ else if (row < table.frozenRowCount &&
43180
+ col < scene.frozenColCount &&
43181
+ col >= table.frozenColCount &&
43182
+ graphic.attribute.react.container === table.frozenHeaderDomContainer) {
43183
+ targetContainer = table.headerDomContainer;
43184
+ }
43185
+ }
43186
+ else if (scene.frozenColCount < table.frozenColCount) {
43187
+ const { col, row } = getTargetCell(graphic);
43188
+ if (row >= table.rowCount - table.bottomFrozenRowCount &&
43189
+ col < table.frozenColCount &&
43190
+ col >= scene.frozenColCount &&
43191
+ graphic.attribute.react.container === table.bottomDomContainer) {
43192
+ targetContainer = table.frozenBottomDomContainer;
43193
+ }
43194
+ else if (row >= table.frozenRowCount &&
43195
+ col < table.frozenColCount &&
43196
+ col >= scene.frozenColCount &&
43197
+ graphic.attribute.react.container === table.bodyDomContainer) {
43198
+ targetContainer = table.frozenBodyDomContainer;
43199
+ }
43200
+ else if (row < table.frozenRowCount &&
43201
+ col < table.frozenColCount &&
43202
+ col >= scene.frozenColCount &&
43203
+ graphic.attribute.react.container === table.headerDomContainer) {
43204
+ targetContainer = table.frozenHeaderDomContainer;
43205
+ }
43206
+ }
43207
+ if (targetContainer) {
43208
+ targetContainer.appendChild(wrapContainer);
43209
+ item.nativeContainer = targetContainer;
43210
+ item.container = targetContainer;
43211
+ graphic.attribute.react.container = targetContainer;
43212
+ plugin.updateStyleOfWrapContainer(graphic, stage, wrapContainer, targetContainer, graphic.attribute.react);
43213
+ }
43214
+ }
43215
+ }
43216
+
42667
43217
  function dealFrozen(scene) {
42668
43218
  if (scene.table.frozenColCount > scene.table.rowHeaderLevelCount) {
42669
43219
  scene.rowHeaderGroup.setAttribute('height', scene.bodyGroup.attribute.height);
@@ -42724,13 +43274,14 @@
42724
43274
  moveColumnFromBottomToLeftBottomCorner(scene);
42725
43275
  }
42726
43276
  }
43277
+ updateReactComponentContainer(scene);
42727
43278
  scene.deleteAllSelectBorder();
42728
43279
  scene.table.stateManager.select.ranges.forEach(range => {
42729
43280
  scene.updateCellSelectBorder(range);
42730
43281
  });
42731
43282
  scene.frozenColCount = scene.table.frozenColCount;
42732
43283
  scene.frozenRowCount = scene.colHeaderGroup.firstChild?.childrenCount ?? 0;
42733
- scene.proxy.colStart = scene.table.frozenColCount;
43284
+ scene.proxy.colStart = scene.bodyGroup.firstChild?.col ?? scene.table.frozenColCount;
42734
43285
  scene.bodyGroup.setAttribute('x', scene.rowHeaderGroup.attribute.width);
42735
43286
  scene.colHeaderGroup.setAttribute('x', scene.cornerHeaderGroup.attribute.width);
42736
43287
  scene.updateContainer();
@@ -45397,22 +45948,7 @@
45397
45948
  return 0;
45398
45949
  }
45399
45950
  updateDomContainer() {
45400
- const { headerDomContainer, bodyDomContainer } = this.table.internalProps;
45401
- if (this.table.frozenColCount > 0 && (headerDomContainer || bodyDomContainer)) {
45402
- const frozenColsWidth = this.table.getFrozenColsWidth();
45403
- headerDomContainer && (headerDomContainer.style.left = `${frozenColsWidth}px`);
45404
- bodyDomContainer && (bodyDomContainer.style.left = `${frozenColsWidth}px`);
45405
- }
45406
- if (headerDomContainer) {
45407
- headerDomContainer.style.width = `${Math.min(this.table.getAllColsWidth(), this.table.tableNoFrameWidth)}px`;
45408
- headerDomContainer.style.height = `${this.table.getFrozenRowsHeight()}px`;
45409
- }
45410
- if (bodyDomContainer) {
45411
- const totalFrozenRowsHeight = this.table.getFrozenRowsHeight() + this.table.getBottomFrozenRowsHeight();
45412
- bodyDomContainer.style.width = `${Math.min(this.table.getAllColsWidth(), this.table.tableNoFrameWidth)}px`;
45413
- bodyDomContainer.style.height = `${(bodyDomContainer.parentElement?.offsetHeight ?? 1) - 1 - totalFrozenRowsHeight}px`;
45414
- bodyDomContainer.style.top = `${this.table.getFrozenRowsHeight()}px`;
45415
- }
45951
+ updateReactContainer(this.table);
45416
45952
  }
45417
45953
  }
45418
45954
 
@@ -48819,6 +49355,9 @@
48819
49355
  }
48820
49356
  });
48821
49357
  table.scenegraph.tableGroup.addEventListener('pointertap', (e) => {
49358
+ if (table.stateManager.columnResize.resizing) {
49359
+ return;
49360
+ }
48822
49361
  const eventArgsSet = getCellEventArgsSet(e);
48823
49362
  if (!eventManager.touchMove &&
48824
49363
  e.button === 0 &&
@@ -51888,7 +52427,7 @@
51888
52427
  if (order) {
51889
52428
  order = order.toUpperCase();
51890
52429
  }
51891
- const sortIcon = order === 'ASC' ? this.downIcon : order === 'DESC' ? this.upIcon : this.normalIcon;
52430
+ const sortIcon = order === 'ASC' ? this.upIcon : order === 'DESC' ? this.downIcon : this.normalIcon;
51892
52431
  if (sortIcon) {
51893
52432
  icons.push(sortIcon);
51894
52433
  }
@@ -52007,7 +52546,7 @@
52007
52546
  return frozen;
52008
52547
  }
52009
52548
  getSortIcon(order, _table, col, row) {
52010
- const icon = order === 'asc' ? this.downIcon : order === 'desc' ? this.upIcon : this.normalIcon;
52549
+ const icon = order === 'asc' ? this.upIcon : order === 'desc' ? this.downIcon : this.normalIcon;
52011
52550
  const headerC = _table.getHeaderDefine(col, row);
52012
52551
  if (!headerC ||
52013
52552
  headerC.showSort === false ||
@@ -52025,7 +52564,7 @@
52025
52564
  (headerC.columns && headerC.columns.length > 0)) {
52026
52565
  return null;
52027
52566
  }
52028
- const icon = order?.toUpperCase() === 'ASC' ? this.downIcon : order?.toUpperCase() === 'DESC' ? this.upIcon : this.normalIcon;
52567
+ const icon = order?.toUpperCase() === 'ASC' ? this.upIcon : order?.toUpperCase() === 'DESC' ? this.downIcon : this.normalIcon;
52029
52568
  return icon;
52030
52569
  }
52031
52570
  getDropDownStateIcons(_table, col, row) {
@@ -53165,9 +53704,9 @@
53165
53704
  const column = columnObjects[i];
53166
53705
  if (column?.aggregation) {
53167
53706
  if (Array.isArray(column?.aggregation)) {
53168
- count = Math.max(count, column.aggregation.filter(item => item.showOnTop === true).length);
53707
+ count = Math.max(count, column.aggregation.filter(item => item.showOnTop).length);
53169
53708
  }
53170
- else if (column.aggregation.showOnTop === true) {
53709
+ else if (column.aggregation.showOnTop) {
53171
53710
  count = Math.max(count, 1);
53172
53711
  }
53173
53712
  }
@@ -53181,9 +53720,9 @@
53181
53720
  const column = columnObjects[i];
53182
53721
  if (column?.aggregation) {
53183
53722
  if (Array.isArray(column?.aggregation)) {
53184
- count = Math.max(count, column.aggregation.filter(item => item.showOnTop === false).length);
53723
+ count = Math.max(count, column.aggregation.filter(item => !item.showOnTop).length);
53185
53724
  }
53186
- else if (column.aggregation.showOnTop === false) {
53725
+ else if (!column.aggregation.showOnTop) {
53187
53726
  count = Math.max(count, 1);
53188
53727
  }
53189
53728
  }
@@ -54627,7 +55166,7 @@
54627
55166
  return TABLE_EVENT_TYPE;
54628
55167
  }
54629
55168
  options;
54630
- version = "1.7.8-alpha.4";
55169
+ version = "1.7.8";
54631
55170
  pagination;
54632
55171
  id = `VTable${Date.now()}`;
54633
55172
  headerStyleCache;
@@ -54698,12 +55237,7 @@
54698
55237
  internalProps.element.appendChild(internalProps.canvas);
54699
55238
  internalProps.context = internalProps.canvas.getContext('2d');
54700
55239
  if (options.customConfig?.createReactContainer) {
54701
- internalProps.bodyDomContainer = document.createElement('div');
54702
- internalProps.bodyDomContainer.classList.add('table-component-container');
54703
- internalProps.element.appendChild(internalProps.bodyDomContainer);
54704
- internalProps.headerDomContainer = document.createElement('div');
54705
- internalProps.headerDomContainer.classList.add('table-component-container');
54706
- internalProps.element.appendChild(internalProps.headerDomContainer);
55240
+ createReactContainer(this);
54707
55241
  }
54708
55242
  }
54709
55243
  internalProps.handler = new EventHandler();
@@ -55161,14 +55695,6 @@
55161
55695
  canvas.style.width = `${widthP}px`;
55162
55696
  canvas.style.height = `${heightP}px`;
55163
55697
  }
55164
- if (this.internalProps.bodyDomContainer) {
55165
- this.internalProps.bodyDomContainer.style.width = `${widthP}px`;
55166
- this.internalProps.bodyDomContainer.style.height = `${heightP}px`;
55167
- }
55168
- if (this.internalProps.headerDomContainer) {
55169
- this.internalProps.headerDomContainer.style.width = `${widthP}px`;
55170
- this.internalProps.headerDomContainer.style.height = `${heightP}px`;
55171
- }
55172
55698
  }
55173
55699
  else if (Env.mode === 'node') {
55174
55700
  widthP = this.canvasWidth - 1;
@@ -57242,6 +57768,27 @@
57242
57768
  get headerDomContainer() {
57243
57769
  return this.internalProps.headerDomContainer;
57244
57770
  }
57771
+ get frozenBodyDomContainer() {
57772
+ return this.internalProps.frozenBodyDomContainer;
57773
+ }
57774
+ get frozenHeaderDomContainer() {
57775
+ return this.internalProps.frozenHeaderDomContainer;
57776
+ }
57777
+ get rightFrozenBodyDomContainer() {
57778
+ return this.internalProps.rightFrozenBodyDomContainer;
57779
+ }
57780
+ get rightFrozenHeaderDomContainer() {
57781
+ return this.internalProps.rightFrozenHeaderDomContainer;
57782
+ }
57783
+ get frozenBottomDomContainer() {
57784
+ return this.internalProps.frozenBottomDomContainer;
57785
+ }
57786
+ get bottomDomContainer() {
57787
+ return this.internalProps.bottomDomContainer;
57788
+ }
57789
+ get rightFrozenBottomDomContainer() {
57790
+ return this.internalProps.rightFrozenBottomDomContainer;
57791
+ }
57245
57792
  showMoverLine(col, row) {
57246
57793
  this.scenegraph.component.showMoveCol(col, row, 0);
57247
57794
  this.scenegraph.renderSceneGraph();
@@ -58734,25 +59281,25 @@
58734
59281
  return this._hasAggregationOnBottomCount;
58735
59282
  }
58736
59283
  getAggregatorsByCell(col, row) {
58737
- const column = this.getBody(col, row);
58738
- const aggregators = column.aggregator;
59284
+ const column = this.getColumnDefine(col, row);
59285
+ const aggregators = column.vtable_aggregator;
58739
59286
  return aggregators;
58740
59287
  }
58741
59288
  getAggregatorsByCellRange(startCol, startRow, endCol, endRow) {
58742
59289
  let aggregators = [];
58743
59290
  if (this.transpose) {
58744
59291
  for (let i = startRow; i <= endRow; i++) {
58745
- const column = this.getBody(startCol, i);
58746
- if (column.aggregator) {
58747
- aggregators = aggregators.concat(Array.isArray(column.aggregator) ? column.aggregator : [column.aggregator]);
59292
+ const column = this.getColumnDefine(startCol, i);
59293
+ if (column.vtable_aggregator) {
59294
+ aggregators = aggregators.concat(Array.isArray(column.vtable_aggregator) ? column.vtable_aggregator : [column.vtable_aggregator]);
58748
59295
  }
58749
59296
  }
58750
59297
  }
58751
59298
  else {
58752
59299
  for (let i = startCol; i <= endCol; i++) {
58753
- const column = this.getBody(i, startRow);
58754
- if (column.aggregator) {
58755
- aggregators = aggregators.concat(Array.isArray(column.aggregator) ? column.aggregator : [column.aggregator]);
59300
+ const column = this.getColumnDefine(i, startRow);
59301
+ if (column.vtable_aggregator) {
59302
+ aggregators = aggregators.concat(Array.isArray(column.vtable_aggregator) ? column.vtable_aggregator : [column.vtable_aggregator]);
58756
59303
  }
58757
59304
  }
58758
59305
  return aggregators;
@@ -58760,8 +59307,8 @@
58760
59307
  return [];
58761
59308
  }
58762
59309
  getAggregatorOnTop(col, row) {
58763
- const column = this.getBody(col, row);
58764
- const aggregators = column.aggregator;
59310
+ const column = this.getColumnDefine(col, row);
59311
+ const aggregators = column.vtable_aggregator;
58765
59312
  const aggregation = column.aggregation;
58766
59313
  if (Array.isArray(aggregation)) {
58767
59314
  const topAggregationIndexs = aggregation.reduce((indexs, agg, index) => {
@@ -58785,12 +59332,12 @@
58785
59332
  return null;
58786
59333
  }
58787
59334
  getAggregatorOnBottom(col, row) {
58788
- const column = this.getBody(col, row);
58789
- const aggregators = column.aggregator;
59335
+ const column = this.getColumnDefine(col, row);
59336
+ const aggregators = column.vtable_aggregator;
58790
59337
  const aggregation = column.aggregation;
58791
59338
  if (Array.isArray(aggregation)) {
58792
59339
  const bottomAggregationIndexs = aggregation.reduce((indexs, agg, index) => {
58793
- if (agg.showOnTop === false) {
59340
+ if (!agg.showOnTop) {
58794
59341
  indexs.push(index);
58795
59342
  }
58796
59343
  return indexs;
@@ -58802,10 +59349,10 @@
58802
59349
  return bottomAggregators[row - (this.rowCount - this.hasAggregationOnBottomCount)];
58803
59350
  }
58804
59351
  if (this.transpose && col - (this.colCount - this.hasAggregationOnBottomCount) === 0) {
58805
- return aggregation?.showOnTop === false ? aggregators : null;
59352
+ return !aggregation?.showOnTop ? aggregators : null;
58806
59353
  }
58807
59354
  else if (!this.transpose && row - (this.rowCount - this.hasAggregationOnBottomCount) === 0) {
58808
- return aggregation?.showOnTop === false ? aggregators : null;
59355
+ return !aggregation?.showOnTop ? aggregators : null;
58809
59356
  }
58810
59357
  return null;
58811
59358
  }
@@ -58815,8 +59362,8 @@
58815
59362
  const bottomCount = this.hasAggregationOnBottomCount;
58816
59363
  if (this.transpose) {
58817
59364
  for (let row = startRow; row <= endRow; row++) {
58818
- const column = this.getBody(startCol, row);
58819
- if (column.aggregator) {
59365
+ const column = this.getColumnDefine(startCol, row);
59366
+ if (column.vtable_aggregator) {
58820
59367
  for (let i = 0; i < topCount; i++) {
58821
59368
  cellAddrs.push({ col: this.headerLevelCount + i, row });
58822
59369
  }
@@ -58828,8 +59375,8 @@
58828
59375
  }
58829
59376
  else {
58830
59377
  for (let col = startCol; col <= endCol; col++) {
58831
- const column = this.getBody(col, startRow);
58832
- if (column.aggregator) {
59378
+ const column = this.getColumnDefine(col, startRow);
59379
+ if (column.vtable_aggregator) {
58833
59380
  for (let i = 0; i < topCount; i++) {
58834
59381
  cellAddrs.push({ col, row: this.headerLevelCount + i });
58835
59382
  }
@@ -59295,7 +59842,7 @@
59295
59842
  define: hd,
59296
59843
  columnWidthComputeMode: hd.columnWidthComputeMode,
59297
59844
  disableColumnResize: hd?.disableColumnResize,
59298
- aggregation: this._getAggregationForColumn(hd, col),
59845
+ aggregation: hd.aggregation,
59299
59846
  isChildNode: row >= 1
59300
59847
  };
59301
59848
  this._columnsIncludeHided.push(colDef);
@@ -59309,35 +59856,6 @@
59309
59856
  });
59310
59857
  return results;
59311
59858
  }
59312
- _getAggregationForColumn(colDef, col) {
59313
- let aggregation;
59314
- if (colDef.aggregation) {
59315
- aggregation = colDef.aggregation;
59316
- }
59317
- else if (this._table.options.aggregation) {
59318
- if (typeof this._table.options.aggregation === 'function') {
59319
- aggregation = this._table.options.aggregation({
59320
- col: col,
59321
- field: colDef.field
59322
- });
59323
- }
59324
- else {
59325
- aggregation = this._table.options.aggregation;
59326
- }
59327
- }
59328
- if (aggregation) {
59329
- if (Array.isArray(aggregation)) {
59330
- return aggregation.map(item => {
59331
- if (!isValid$1(item.showOnTop)) {
59332
- item.showOnTop = false;
59333
- }
59334
- return item;
59335
- });
59336
- }
59337
- return Object.assign({ showOnTop: false }, aggregation);
59338
- }
59339
- return null;
59340
- }
59341
59859
  _newRow(row, hideColumnsSubHeader = false) {
59342
59860
  if (this._headerCellIds[row]) {
59343
59861
  const prev = this._headerCellIds[row - 1];
@@ -59417,8 +59935,8 @@
59417
59935
  else if (this.transpose &&
59418
59936
  this.isSeriesNumberInBody(target.col, target.row) &&
59419
59937
  this.isSeriesNumberInBody(source.col, source.row)) {
59420
- if (this._getColumnDefine(source.col + this.leftRowSeriesNumberColumnCount, source.row).isChildNode &&
59421
- this._getColumnDefine(target.col + this.leftRowSeriesNumberColumnCount, target.row).isChildNode) {
59938
+ if (this.getBody(source.col + this.leftRowSeriesNumberColumnCount, source.row).isChildNode &&
59939
+ this.getBody(target.col + this.leftRowSeriesNumberColumnCount, target.row).isChildNode) {
59422
59940
  source.col = source.col + this.leftRowSeriesNumberColumnCount + this.rowHeaderLevelCount - 1;
59423
59941
  target.col = target.col + this.leftRowSeriesNumberColumnCount + this.rowHeaderLevelCount - 1;
59424
59942
  }
@@ -59623,15 +60141,15 @@
59623
60141
  }, []);
59624
60142
  return result;
59625
60143
  }
59626
- _getColumnDefine(col, row) {
60144
+ getColumnDefine(col, row) {
59627
60145
  if (col >= 0) {
59628
60146
  if (col < this.leftRowSeriesNumberColumnCount) {
59629
- return this.leftRowSeriesNumberColumn[col];
60147
+ return this.leftRowSeriesNumberColumn[col].define;
59630
60148
  }
59631
60149
  if (this.transpose) {
59632
- return this._columns[row];
60150
+ return this._columns[row].define;
59633
60151
  }
59634
- return this._columns[col - this.leftRowSeriesNumberColumnCount];
60152
+ return this._columns[col - this.leftRowSeriesNumberColumnCount].define;
59635
60153
  }
59636
60154
  return undefined;
59637
60155
  }
@@ -59669,6 +60187,9 @@
59669
60187
  });
59670
60188
  }
59671
60189
  startEditCell(col, row, value) {
60190
+ if (this.editingEditor) {
60191
+ return;
60192
+ }
59672
60193
  const editor = this.table.getEditor(col, row);
59673
60194
  if (editor) {
59674
60195
  if (this.table.internalProps.layoutMap?.isAggregation?.(col, row)) {
@@ -60098,6 +60619,14 @@
60098
60619
  addRows.push({ col: 0, row });
60099
60620
  }
60100
60621
  }
60622
+ const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount;
60623
+ const bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
60624
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) {
60625
+ if (table.transpose) ;
60626
+ }
60627
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) {
60628
+ if (table.transpose) ;
60629
+ }
60101
60630
  table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
60102
60631
  }
60103
60632
  }
@@ -60184,7 +60713,28 @@
60184
60713
  addRows.push({ col: 0, row });
60185
60714
  }
60186
60715
  }
60187
- table.transpose ? table.scenegraph.updateCol([], addRows, []) : table.scenegraph.updateRow([], addRows, []);
60716
+ const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount;
60717
+ const bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
60718
+ const updateRows = [];
60719
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) {
60720
+ if (table.transpose) {
60721
+ updateRows.push({ col: row, row: 0 });
60722
+ }
60723
+ else {
60724
+ updateRows.push({ col: 0, row });
60725
+ }
60726
+ }
60727
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) {
60728
+ if (table.transpose) {
60729
+ updateRows.push({ col: row, row: 0 });
60730
+ }
60731
+ else {
60732
+ updateRows.push({ col: 0, row });
60733
+ }
60734
+ }
60735
+ table.transpose
60736
+ ? table.scenegraph.updateCol([], addRows, updateRows)
60737
+ : table.scenegraph.updateRow([], addRows, updateRows);
60188
60738
  }
60189
60739
  }
60190
60740
  }
@@ -60224,9 +60774,12 @@
60224
60774
  table.scenegraph.createSceneGraph();
60225
60775
  }
60226
60776
  else {
60777
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
60778
+ const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount;
60227
60779
  const minRowNum = minRecordIndex -
60228
60780
  (endIndex - perPageCount) +
60229
- (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);
60781
+ (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount) +
60782
+ topAggregationCount;
60230
60783
  const updateRows = [];
60231
60784
  const delRows = [];
60232
60785
  for (let row = minRowNum; row < newRowCount; row++) {
@@ -60237,6 +60790,14 @@
60237
60790
  updateRows.push({ col: 0, row });
60238
60791
  }
60239
60792
  }
60793
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) {
60794
+ if (table.transpose) {
60795
+ updateRows.push({ col: row, row: 0 });
60796
+ }
60797
+ else {
60798
+ updateRows.push({ col: 0, row });
60799
+ }
60800
+ }
60240
60801
  if (newRowCount < oldRowCount) {
60241
60802
  for (let row = newRowCount; row < oldRowCount; row++) {
60242
60803
  if (table.transpose) {
@@ -60255,9 +60816,12 @@
60255
60816
  }
60256
60817
  else {
60257
60818
  const delRows = [];
60819
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
60820
+ const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount;
60821
+ const bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
60258
60822
  for (let index = 0; index < recordIndexsMinToMax.length; index++) {
60259
60823
  const recordIndex = recordIndexsMinToMax[index];
60260
- const rowNum = recordIndex + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);
60824
+ const rowNum = recordIndex + headerCount + topAggregationCount;
60261
60825
  if (table.transpose) {
60262
60826
  delRows.push({ col: rowNum, row: 0 });
60263
60827
  }
@@ -60265,7 +60829,26 @@
60265
60829
  delRows.push({ col: 0, row: rowNum });
60266
60830
  }
60267
60831
  }
60268
- table.transpose ? table.scenegraph.updateCol(delRows, [], []) : table.scenegraph.updateRow(delRows, [], []);
60832
+ const updateRows = [];
60833
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) {
60834
+ if (table.transpose) {
60835
+ updateRows.push({ col: row, row: 0 });
60836
+ }
60837
+ else {
60838
+ updateRows.push({ col: 0, row });
60839
+ }
60840
+ }
60841
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) {
60842
+ if (table.transpose) {
60843
+ updateRows.push({ col: row, row: 0 });
60844
+ }
60845
+ else {
60846
+ updateRows.push({ col: 0, row });
60847
+ }
60848
+ }
60849
+ table.transpose
60850
+ ? table.scenegraph.updateCol(delRows, [], updateRows)
60851
+ : table.scenegraph.updateRow(delRows, [], updateRows);
60269
60852
  }
60270
60853
  }
60271
60854
  }
@@ -60294,6 +60877,8 @@
60294
60877
  const recordIndexsMinToMax = updateRecordIndexs.sort((a, b) => a - b);
60295
60878
  if (table.pagination) {
60296
60879
  const { perPageCount, currentPage } = table.pagination;
60880
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
60881
+ const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount;
60297
60882
  const startIndex = perPageCount * (currentPage || 0);
60298
60883
  const endIndex = startIndex + perPageCount;
60299
60884
  const updateRows = [];
@@ -60302,7 +60887,8 @@
60302
60887
  if (recordIndex < endIndex && recordIndex >= endIndex - perPageCount) {
60303
60888
  const rowNum = recordIndex -
60304
60889
  (endIndex - perPageCount) +
60305
- (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);
60890
+ (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount) +
60891
+ topAggregationCount;
60306
60892
  updateRows.push(rowNum);
60307
60893
  }
60308
60894
  }
@@ -60317,6 +60903,14 @@
60317
60903
  updateRowCells.push({ col: 0, row: updateRow });
60318
60904
  }
60319
60905
  }
60906
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) {
60907
+ if (table.transpose) {
60908
+ updateRowCells.push({ col: row, row: 0 });
60909
+ }
60910
+ else {
60911
+ updateRowCells.push({ col: 0, row });
60912
+ }
60913
+ }
60320
60914
  table.transpose
60321
60915
  ? table.scenegraph.updateCol([], [], updateRowCells)
60322
60916
  : table.scenegraph.updateRow([], [], updateRowCells);
@@ -60324,9 +60918,12 @@
60324
60918
  }
60325
60919
  else {
60326
60920
  const updateRows = [];
60921
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
60922
+ const topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount;
60923
+ const bottomAggregationCount = table.internalProps.layoutMap.hasAggregationOnBottomCount;
60327
60924
  for (let index = 0; index < recordIndexsMinToMax.length; index++) {
60328
60925
  const recordIndex = recordIndexsMinToMax[index];
60329
- const rowNum = recordIndex + (table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount);
60926
+ const rowNum = recordIndex + headerCount + topAggregationCount;
60330
60927
  if (table.transpose) {
60331
60928
  updateRows.push({ col: rowNum, row: 0 });
60332
60929
  }
@@ -60334,6 +60931,22 @@
60334
60931
  updateRows.push({ col: 0, row: rowNum });
60335
60932
  }
60336
60933
  }
60934
+ for (let row = headerCount; row < headerCount + topAggregationCount; row++) {
60935
+ if (table.transpose) {
60936
+ updateRows.push({ col: row, row: 0 });
60937
+ }
60938
+ else {
60939
+ updateRows.push({ col: 0, row });
60940
+ }
60941
+ }
60942
+ for (let row = (table.transpose ? table.colCount : table.rowCount) - bottomAggregationCount; row < (table.transpose ? table.colCount : table.rowCount); row++) {
60943
+ if (table.transpose) {
60944
+ updateRows.push({ col: row, row: 0 });
60945
+ }
60946
+ else {
60947
+ updateRows.push({ col: 0, row });
60948
+ }
60949
+ }
60337
60950
  table.transpose
60338
60951
  ? table.scenegraph.updateCol([], [], updateRows)
60339
60952
  : table.scenegraph.updateRow([], [], updateRows);
@@ -60371,6 +60984,7 @@
60371
60984
  : options.header
60372
60985
  ? cloneDeepSpec(options.header, ['children'])
60373
60986
  : [];
60987
+ generateAggregationForColumn(this);
60374
60988
  internalProps.enableTreeNodeMerge = options.enableTreeNodeMerge ?? isValid$1(options.groupBy) ?? false;
60375
60989
  this.internalProps.headerHelper.setTableColumnsEditor();
60376
60990
  this.showHeader = options.showHeader ?? true;
@@ -60433,6 +61047,7 @@
60433
61047
  updateColumns(columns) {
60434
61048
  const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
60435
61049
  this.internalProps.columns = cloneDeepSpec(columns, ['children']);
61050
+ generateAggregationForColumn(this);
60436
61051
  this.options.columns = columns;
60437
61052
  this.internalProps.headerHelper.setTableColumnsEditor();
60438
61053
  this._hasAutoImageColumn = undefined;
@@ -60455,6 +61070,7 @@
60455
61070
  }
60456
61071
  set header(header) {
60457
61072
  this.internalProps.columns = header;
61073
+ generateAggregationForColumn(this);
60458
61074
  this.options.header = header;
60459
61075
  this.refreshHeader();
60460
61076
  this.internalProps.useOneRowHeightFillAll = false;
@@ -60638,6 +61254,7 @@
60638
61254
  : options.header
60639
61255
  ? cloneDeepSpec(options.header, ['children'])
60640
61256
  : [];
61257
+ generateAggregationForColumn(this);
60641
61258
  internalProps.enableTreeNodeMerge = options.enableTreeNodeMerge ?? isValid$1(options.groupBy) ?? false;
60642
61259
  this.internalProps.headerHelper.setTableColumnsEditor();
60643
61260
  this.transpose = options.transpose ?? false;
@@ -69179,13 +69796,17 @@
69179
69796
  indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
69180
69797
  customRowTree;
69181
69798
  customColTree;
69799
+ customRowTreeDimensionPaths;
69800
+ customColTreeDimensionPaths;
69182
69801
  colHeaderTree;
69183
69802
  rowHeaderTree;
69184
69803
  rowHierarchyType;
69185
69804
  indicators;
69186
69805
  indicatorsAsCol;
69187
69806
  totalRecordsTree = {};
69188
- constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative) {
69807
+ hasExtensionRowTree;
69808
+ parseCustomTreeToMatchRecords;
69809
+ constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative, hasExtensionRowTree, parseCustomTreeToMatchRecords) {
69189
69810
  this.registerAggregators();
69190
69811
  this.dataConfig = dataConfig;
69191
69812
  this.filterRules = this.dataConfig?.filterRules;
@@ -69219,6 +69840,14 @@
69219
69840
  this.indicators = indicators;
69220
69841
  this.customColTree = customColTree;
69221
69842
  this.customRowTree = customRowTree;
69843
+ this.hasExtensionRowTree = hasExtensionRowTree;
69844
+ this.parseCustomTreeToMatchRecords = parseCustomTreeToMatchRecords;
69845
+ if (this.parseCustomTreeToMatchRecords) {
69846
+ this.customColTreeDimensionPaths = this.customTreeToDimensionPathArr(this.customColTree, 'col');
69847
+ if (!this.hasExtensionRowTree) {
69848
+ this.customRowTreeDimensionPaths = this.customTreeToDimensionPathArr(this.customRowTree, 'row');
69849
+ }
69850
+ }
69222
69851
  this.colGrandTotalLabel = this.totals?.column?.grandTotalLabel ?? '总计';
69223
69852
  this.colSubTotalLabel = this.totals?.column?.subTotalLabel ?? '小计';
69224
69853
  this.rowGrandTotalLabel = this.totals?.row?.grandTotalLabel ?? '总计';
@@ -69503,217 +70132,291 @@
69503
70132
  }
69504
70133
  }
69505
70134
  }
69506
- const colKey = [];
69507
- const rowKey = [];
69508
70135
  let isToTalRecord = false;
69509
- for (let l = 0, len1 = this.rows.length; l < len1; l++) {
69510
- const rowAttr = this.rows[l];
69511
- if (rowAttr in record) {
69512
- this.rowsHasValue[l] = true;
69513
- rowKey.push(record[rowAttr]);
69514
- }
69515
- else if (rowAttr !== IndicatorDimensionKeyPlaceholder) {
69516
- if (this.dataConfig?.totals?.row?.showGrandTotals &&
69517
- l === 0 &&
69518
- !this.rows.find((rk) => {
69519
- return rk in record;
69520
- })) {
69521
- rowKey.push(this.rowGrandTotalLabel);
69522
- isToTalRecord = true;
69523
- break;
69524
- }
69525
- else if (this.dataConfig?.totals?.row?.subTotalsDimensions &&
69526
- this.dataConfig?.totals?.row?.subTotalsDimensions.indexOf(this.rows[l - 1]) >= 0) {
69527
- if (this.rowHierarchyType === 'grid') {
69528
- rowKey.push(this.rowSubTotalLabel);
70136
+ const colKeys = [];
70137
+ const rowKeys = [];
70138
+ if (this.parseCustomTreeToMatchRecords &&
70139
+ !this.dataConfig?.isPivotChart &&
70140
+ this.customRowTree?.length &&
70141
+ !assignedIndicatorKey &&
70142
+ !this.hasExtensionRowTree) {
70143
+ const rowTreePath = this.getFieldMatchRowDimensionPaths(record);
70144
+ if (rowTreePath.length > 0) {
70145
+ for (let i = 0, len = rowTreePath.length; i < len; i++) {
70146
+ const rowPath = rowTreePath[i];
70147
+ const rowKey = [];
70148
+ let indicatorKey;
70149
+ for (let j = 0, len1 = rowPath.length; j < len1; j++) {
70150
+ if (isValid$1(rowPath[j].indicatorKey)) {
70151
+ indicatorKey = rowPath[j].indicatorKey;
70152
+ }
70153
+ else {
70154
+ rowKey.push(rowPath[j].value);
70155
+ }
69529
70156
  }
69530
- isToTalRecord = true;
69531
- break;
70157
+ rowKeys.push({ rowKey, indicatorKey });
69532
70158
  }
69533
70159
  }
69534
70160
  }
69535
- for (let n = 0, len2 = this.columns.length; n < len2; n++) {
69536
- const colAttr = this.columns[n];
69537
- if (colAttr in record) {
69538
- this.columnsHasValue[n] = true;
69539
- colKey.push(record[colAttr]);
69540
- }
69541
- else if (colAttr !== IndicatorDimensionKeyPlaceholder) {
69542
- if (this.dataConfig?.totals?.column?.showGrandTotals &&
69543
- n === 0 &&
69544
- !this.columns.find((ck) => {
69545
- return ck in record;
69546
- })) {
69547
- colKey.push(this.colGrandTotalLabel);
69548
- isToTalRecord = true;
69549
- break;
69550
- }
69551
- else if (this.dataConfig?.totals?.column?.subTotalsDimensions &&
69552
- this.dataConfig?.totals?.column?.subTotalsDimensions.indexOf(this.columns[n - 1]) >= 0) {
69553
- colKey.push(this.colSubTotalLabel);
69554
- isToTalRecord = true;
69555
- break;
70161
+ else {
70162
+ const rowKey = [];
70163
+ rowKeys.push({ rowKey, indicatorKey: assignedIndicatorKey });
70164
+ for (let l = 0, len1 = this.rows.length; l < len1; l++) {
70165
+ const rowAttr = this.rows[l];
70166
+ if (rowAttr in record) {
70167
+ this.rowsHasValue[l] = true;
70168
+ rowKey.push(record[rowAttr]);
70169
+ }
70170
+ else if (rowAttr !== IndicatorDimensionKeyPlaceholder) {
70171
+ if (this.dataConfig?.totals?.row?.showGrandTotals &&
70172
+ l === 0 &&
70173
+ !this.rows.find((rk) => {
70174
+ return rk in record;
70175
+ })) {
70176
+ rowKey.push(this.rowGrandTotalLabel);
70177
+ isToTalRecord = true;
70178
+ break;
70179
+ }
70180
+ else if (this.dataConfig?.totals?.row?.subTotalsDimensions &&
70181
+ this.dataConfig?.totals?.row?.subTotalsDimensions.indexOf(this.rows[l - 1]) >= 0) {
70182
+ if (this.rowHierarchyType === 'grid') {
70183
+ rowKey.push(this.rowSubTotalLabel);
70184
+ }
70185
+ isToTalRecord = true;
70186
+ break;
70187
+ }
69556
70188
  }
69557
70189
  }
69558
70190
  }
69559
- const flatRowKey = rowKey.join(this.stringJoinChar);
69560
- const flatColKey = colKey.join(this.stringJoinChar);
69561
- if (isToTalRecord) {
69562
- if (!this.totalRecordsTree[flatRowKey]) {
69563
- this.totalRecordsTree[flatRowKey] = {};
69564
- }
69565
- if (!this.totalRecordsTree[flatRowKey][flatColKey]) {
69566
- this.totalRecordsTree[flatRowKey][flatColKey] = [];
69567
- }
69568
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
69569
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
69570
- if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
69571
- const calculatedFieldRule = this.calculatedFieldRules?.find(rule => rule.key === toComputeIndicatorKeys[i]);
69572
- if (!this.totalRecordsTree[flatRowKey]?.[flatColKey]?.[i]) {
69573
- this.totalRecordsTree[flatRowKey][flatColKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
69574
- key: toComputeIndicatorKeys[i],
69575
- dimension: toComputeIndicatorKeys[i],
69576
- isRecord: true,
69577
- formatFun: this.indicators?.find((indicator) => {
69578
- if (typeof indicator !== 'string') {
69579
- return indicator.indicatorKey === toComputeIndicatorKeys[i];
69580
- }
69581
- return false;
69582
- })?.format,
69583
- calculateFun: calculatedFieldRule?.calculateFun,
69584
- dependAggregators: this.totalRecordsTree[flatRowKey][flatColKey],
69585
- dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
69586
- });
69587
- }
69588
- toComputeIndicatorKeys[i] in record && this.totalRecordsTree[flatRowKey]?.[flatColKey]?.[i].push(record);
69589
- }
69590
- else {
69591
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
69592
- if (!this.totalRecordsTree[flatRowKey]?.[flatColKey]?.[i]) {
69593
- this.totalRecordsTree[flatRowKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM]({
69594
- key: toComputeIndicatorKeys[i],
69595
- dimension: aggRule?.field ?? toComputeIndicatorKeys[i],
69596
- formatFun: aggRule?.formatFun ??
69597
- this.indicators?.find((indicator) => {
69598
- if (typeof indicator !== 'string') {
69599
- return indicator.indicatorKey === toComputeIndicatorKeys[i];
69600
- }
69601
- return false;
69602
- })?.format
69603
- });
70191
+ if (this.parseCustomTreeToMatchRecords &&
70192
+ !this.dataConfig?.isPivotChart &&
70193
+ this.customColTree?.length &&
70194
+ !assignedIndicatorKey &&
70195
+ !this.hasExtensionRowTree) {
70196
+ const colTreePath = this.getFieldMatchColDimensionPaths(record);
70197
+ if (colTreePath.length > 0) {
70198
+ for (let i = 0, len = colTreePath.length; i < len; i++) {
70199
+ const colPath = colTreePath[i];
70200
+ const colKey = [];
70201
+ let indicatorKey;
70202
+ for (let j = 0, len1 = colPath.length; j < len1; j++) {
70203
+ if (isValid$1(colPath[j].indicatorKey)) {
70204
+ indicatorKey = colPath[j].indicatorKey;
70205
+ }
70206
+ else {
70207
+ colKey.push(colPath[j].value);
70208
+ }
69604
70209
  }
69605
- toComputeIndicatorKeys[i] in record && this.totalRecordsTree[flatRowKey]?.[flatColKey]?.[i].push(record);
70210
+ colKeys.push({ colKey: colKey, indicatorKey });
69606
70211
  }
69607
70212
  }
69608
- return;
69609
70213
  }
69610
- if (rowKey.length !== 0) {
69611
- if (!this.rowFlatKeys[flatRowKey]) {
69612
- this.rowKeys.push(rowKey);
69613
- this.rowFlatKeys[flatRowKey] = 1;
70214
+ else {
70215
+ const colKey = [];
70216
+ colKeys.push({ colKey, indicatorKey: assignedIndicatorKey });
70217
+ for (let n = 0, len2 = this.columns.length; n < len2; n++) {
70218
+ const colAttr = this.columns[n];
70219
+ if (colAttr in record) {
70220
+ this.columnsHasValue[n] = true;
70221
+ colKey.push(record[colAttr]);
70222
+ }
70223
+ else if (colAttr !== IndicatorDimensionKeyPlaceholder) {
70224
+ if (this.dataConfig?.totals?.column?.showGrandTotals &&
70225
+ n === 0 &&
70226
+ !this.columns.find((ck) => {
70227
+ return ck in record;
70228
+ })) {
70229
+ colKey.push(this.colGrandTotalLabel);
70230
+ isToTalRecord = true;
70231
+ break;
70232
+ }
70233
+ else if (this.dataConfig?.totals?.column?.subTotalsDimensions &&
70234
+ this.dataConfig?.totals?.column?.subTotalsDimensions.indexOf(this.columns[n - 1]) >= 0) {
70235
+ colKey.push(this.colSubTotalLabel);
70236
+ isToTalRecord = true;
70237
+ break;
70238
+ }
70239
+ }
69614
70240
  }
69615
70241
  }
69616
- if (colKey.length !== 0) {
69617
- if (!this.colFlatKeys[flatColKey]) {
69618
- this.colKeys.push(colKey);
69619
- this.colFlatKeys[flatColKey] = 1;
70242
+ for (let row_i = 0; row_i < rowKeys.length; row_i++) {
70243
+ const rowKey = rowKeys[row_i].rowKey;
70244
+ let assignedIndicatorKey_value;
70245
+ if (!this.indicatorsAsCol) {
70246
+ assignedIndicatorKey_value = rowKeys[row_i].indicatorKey;
69620
70247
  }
69621
- }
69622
- if (!this.tree[flatRowKey]) {
69623
- this.tree[flatRowKey] = {};
69624
- }
69625
- if (!this.tree[flatRowKey]?.[flatColKey]) {
69626
- this.tree[flatRowKey][flatColKey] = [];
69627
- }
69628
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
69629
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
69630
- if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
69631
- const calculatedFieldRule = this.calculatedFieldRules?.find(rule => rule.key === toComputeIndicatorKeys[i]);
69632
- if (!this.tree[flatRowKey]?.[flatColKey]?.[i]) {
69633
- this.tree[flatRowKey][flatColKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
69634
- key: toComputeIndicatorKeys[i],
69635
- dimension: toComputeIndicatorKeys[i],
69636
- isRecord: true,
69637
- formatFun: this.indicators?.find((indicator) => {
69638
- if (typeof indicator !== 'string') {
69639
- return indicator.indicatorKey === toComputeIndicatorKeys[i];
70248
+ for (let col_j = 0; col_j < colKeys.length; col_j++) {
70249
+ const colKey = colKeys[col_j].colKey;
70250
+ if (this.indicatorsAsCol) {
70251
+ assignedIndicatorKey_value = colKeys[col_j].indicatorKey;
70252
+ }
70253
+ const flatRowKey = rowKey.join(this.stringJoinChar);
70254
+ const flatColKey = colKey.join(this.stringJoinChar);
70255
+ if (isToTalRecord) {
70256
+ if (!this.totalRecordsTree[flatRowKey]) {
70257
+ this.totalRecordsTree[flatRowKey] = {};
70258
+ }
70259
+ if (!this.totalRecordsTree[flatRowKey][flatColKey]) {
70260
+ this.totalRecordsTree[flatRowKey][flatColKey] = [];
70261
+ }
70262
+ const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
70263
+ for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
70264
+ if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
70265
+ const calculatedFieldRule = this.calculatedFieldRules?.find(rule => rule.key === toComputeIndicatorKeys[i]);
70266
+ if (!this.totalRecordsTree[flatRowKey]?.[flatColKey]?.[i]) {
70267
+ this.totalRecordsTree[flatRowKey][flatColKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
70268
+ key: toComputeIndicatorKeys[i],
70269
+ dimension: toComputeIndicatorKeys[i],
70270
+ isRecord: true,
70271
+ formatFun: this.indicators?.find((indicator) => {
70272
+ if (typeof indicator !== 'string') {
70273
+ return indicator.indicatorKey === toComputeIndicatorKeys[i];
70274
+ }
70275
+ return false;
70276
+ })?.format,
70277
+ calculateFun: calculatedFieldRule?.calculateFun,
70278
+ dependAggregators: this.totalRecordsTree[flatRowKey][flatColKey],
70279
+ dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
70280
+ });
69640
70281
  }
69641
- return false;
69642
- })?.format,
69643
- calculateFun: calculatedFieldRule?.calculateFun,
69644
- dependAggregators: this.tree[flatRowKey][flatColKey],
69645
- dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
69646
- });
70282
+ toComputeIndicatorKeys[i] in record && this.totalRecordsTree[flatRowKey]?.[flatColKey]?.[i].push(record);
70283
+ }
70284
+ else {
70285
+ const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
70286
+ if (!this.totalRecordsTree[flatRowKey]?.[flatColKey]?.[i]) {
70287
+ this.totalRecordsTree[flatRowKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM]({
70288
+ key: toComputeIndicatorKeys[i],
70289
+ dimension: aggRule?.field ?? toComputeIndicatorKeys[i],
70290
+ formatFun: aggRule?.formatFun ??
70291
+ this.indicators?.find((indicator) => {
70292
+ if (typeof indicator !== 'string') {
70293
+ return indicator.indicatorKey === toComputeIndicatorKeys[i];
70294
+ }
70295
+ return false;
70296
+ })?.format
70297
+ });
70298
+ }
70299
+ toComputeIndicatorKeys[i] in record && this.totalRecordsTree[flatRowKey]?.[flatColKey]?.[i].push(record);
70300
+ }
70301
+ }
70302
+ return;
69647
70303
  }
69648
- this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
69649
- }
69650
- else {
69651
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
69652
- let needAddToAggregator = false;
69653
- if (assignedIndicatorKey) {
69654
- toComputeIndicatorKeys[i] === assignedIndicatorKey && (needAddToAggregator = true);
69655
- }
69656
- else if (aggRule?.field) {
69657
- if (typeof aggRule?.field === 'string') {
69658
- aggRule?.field in record && (needAddToAggregator = true);
70304
+ if (rowKey.length !== 0) {
70305
+ if (!this.rowFlatKeys[flatRowKey]) {
70306
+ this.rowKeys.push(rowKey);
70307
+ this.rowFlatKeys[flatRowKey] = 1;
69659
70308
  }
69660
- else {
69661
- const isPush = aggRule?.field.find((field) => {
69662
- return field in record;
69663
- });
69664
- isPush && (needAddToAggregator = true);
70309
+ }
70310
+ if (colKey.length !== 0) {
70311
+ if (!this.colFlatKeys[flatColKey]) {
70312
+ this.colKeys.push(colKey);
70313
+ this.colFlatKeys[flatColKey] = 1;
69665
70314
  }
69666
70315
  }
69667
- else {
69668
- toComputeIndicatorKeys[i] in record && (needAddToAggregator = true);
69669
- }
69670
- if (!this.tree[flatRowKey]?.[flatColKey]?.[i] && needAddToAggregator) {
69671
- this.tree[flatRowKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM]({
69672
- key: toComputeIndicatorKeys[i],
69673
- dimension: aggRule?.field ?? toComputeIndicatorKeys[i],
69674
- formatFun: aggRule?.formatFun ??
69675
- this.indicators?.find((indicator) => {
69676
- if (typeof indicator !== 'string') {
69677
- return indicator.indicatorKey === toComputeIndicatorKeys[i];
69678
- }
69679
- return false;
69680
- })?.format
69681
- });
70316
+ if (!this.tree[flatRowKey]) {
70317
+ this.tree[flatRowKey] = {};
69682
70318
  }
69683
- if (needAddToAggregator) {
69684
- this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
69685
- }
69686
- }
69687
- }
69688
- if (this.mappingRules) {
69689
- for (let i = 0; i < this.indicatorKeys.length; i++) {
69690
- if (!this.indicatorStatistics[i]) {
69691
- const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
69692
- this.indicatorStatistics[i] = {
69693
- max: new this.aggregators[AggregationType.MAX]({
69694
- key: this.indicatorKeys[i],
69695
- dimension: this.indicatorKeys[i]
69696
- }),
69697
- min: new this.aggregators[AggregationType.MIN]({
69698
- key: this.indicatorKeys[i],
69699
- dimension: this.indicatorKeys[i]
69700
- }),
69701
- total: new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM]({
69702
- key: this.indicatorKeys[i],
69703
- dimension: aggRule?.field ?? this.indicatorKeys[i],
69704
- formatFun: aggRule?.formatFun ??
69705
- this.indicators?.find((indicator) => {
70319
+ if (!this.tree[flatRowKey]?.[flatColKey]) {
70320
+ this.tree[flatRowKey][flatColKey] = [];
70321
+ }
70322
+ const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
70323
+ for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
70324
+ if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
70325
+ const calculatedFieldRule = this.calculatedFieldRules?.find(rule => rule.key === toComputeIndicatorKeys[i]);
70326
+ if (!this.tree[flatRowKey]?.[flatColKey]?.[i]) {
70327
+ this.tree[flatRowKey][flatColKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
70328
+ key: toComputeIndicatorKeys[i],
70329
+ dimension: toComputeIndicatorKeys[i],
70330
+ isRecord: true,
70331
+ formatFun: this.indicators?.find((indicator) => {
69706
70332
  if (typeof indicator !== 'string') {
69707
- return indicator.indicatorKey === this.indicatorKeys[i];
70333
+ return indicator.indicatorKey === toComputeIndicatorKeys[i];
69708
70334
  }
69709
70335
  return false;
69710
- })?.format
69711
- })
69712
- };
70336
+ })?.format,
70337
+ calculateFun: calculatedFieldRule?.calculateFun,
70338
+ dependAggregators: this.tree[flatRowKey][flatColKey],
70339
+ dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
70340
+ });
70341
+ }
70342
+ this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
70343
+ }
70344
+ else {
70345
+ const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
70346
+ let needAddToAggregator = false;
70347
+ if (assignedIndicatorKey_value) {
70348
+ if (assignedIndicatorKey === assignedIndicatorKey_value) {
70349
+ toComputeIndicatorKeys[i] === assignedIndicatorKey_value && (needAddToAggregator = true);
70350
+ }
70351
+ else {
70352
+ toComputeIndicatorKeys[i] === assignedIndicatorKey_value &&
70353
+ toComputeIndicatorKeys[i] in record &&
70354
+ (needAddToAggregator = true);
70355
+ }
70356
+ }
70357
+ else if (aggRule?.field) {
70358
+ if (typeof aggRule?.field === 'string') {
70359
+ aggRule?.field in record && (needAddToAggregator = true);
70360
+ }
70361
+ else {
70362
+ const isPush = aggRule?.field.find((field) => {
70363
+ return field in record;
70364
+ });
70365
+ isPush && (needAddToAggregator = true);
70366
+ }
70367
+ }
70368
+ else {
70369
+ toComputeIndicatorKeys[i] in record && (needAddToAggregator = true);
70370
+ }
70371
+ if (!this.tree[flatRowKey]?.[flatColKey]?.[i] && needAddToAggregator) {
70372
+ this.tree[flatRowKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM]({
70373
+ key: toComputeIndicatorKeys[i],
70374
+ dimension: aggRule?.field ?? toComputeIndicatorKeys[i],
70375
+ formatFun: aggRule?.formatFun ??
70376
+ this.indicators?.find((indicator) => {
70377
+ if (typeof indicator !== 'string') {
70378
+ return indicator.indicatorKey === toComputeIndicatorKeys[i];
70379
+ }
70380
+ return false;
70381
+ })?.format
70382
+ });
70383
+ }
70384
+ if (needAddToAggregator) {
70385
+ this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
70386
+ }
70387
+ }
70388
+ }
70389
+ if (this.mappingRules) {
70390
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
70391
+ if (!this.indicatorStatistics[i]) {
70392
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
70393
+ this.indicatorStatistics[i] = {
70394
+ max: new this.aggregators[AggregationType.MAX]({
70395
+ key: this.indicatorKeys[i],
70396
+ dimension: this.indicatorKeys[i]
70397
+ }),
70398
+ min: new this.aggregators[AggregationType.MIN]({
70399
+ key: this.indicatorKeys[i],
70400
+ dimension: this.indicatorKeys[i]
70401
+ }),
70402
+ total: new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM]({
70403
+ key: this.indicatorKeys[i],
70404
+ dimension: aggRule?.field ?? this.indicatorKeys[i],
70405
+ formatFun: aggRule?.formatFun ??
70406
+ this.indicators?.find((indicator) => {
70407
+ if (typeof indicator !== 'string') {
70408
+ return indicator.indicatorKey === this.indicatorKeys[i];
70409
+ }
70410
+ return false;
70411
+ })?.format
70412
+ })
70413
+ };
70414
+ }
70415
+ this.indicatorStatistics[i].max.push(this.tree[flatRowKey]?.[flatColKey]?.[i].value());
70416
+ this.indicatorStatistics[i].min.push(this.tree[flatRowKey]?.[flatColKey]?.[i].value());
70417
+ this.indicatorStatistics[i].total.push(record);
70418
+ }
69713
70419
  }
69714
- this.indicatorStatistics[i].max.push(this.tree[flatRowKey]?.[flatColKey]?.[i].value());
69715
- this.indicatorStatistics[i].min.push(this.tree[flatRowKey]?.[flatColKey]?.[i].value());
69716
- this.indicatorStatistics[i].total.push(record);
69717
70420
  }
69718
70421
  }
69719
70422
  }
@@ -69751,7 +70454,7 @@
69751
70454
  for (const treeRowKey in this.tree) {
69752
70455
  for (const treeColKey in this.tree[treeRowKey]) {
69753
70456
  for (let i = 0; i < this.tree[treeRowKey][treeColKey].length; i++) {
69754
- this.tree[treeRowKey][treeColKey][i].reset();
70457
+ this.tree[treeRowKey][treeColKey][i]?.reset();
69755
70458
  }
69756
70459
  }
69757
70460
  }
@@ -69962,136 +70665,139 @@
69962
70665
  }
69963
70666
  totalStatistics() {
69964
70667
  const that = this;
69965
- if ((that?.totals?.column?.subTotalsDimensions && that?.totals?.column?.subTotalsDimensions?.length >= 1) ||
69966
- (that?.totals?.row?.subTotalsDimensions && that?.totals?.row?.subTotalsDimensions?.length >= 1) ||
69967
- that?.totals?.column?.showGrandTotals ||
69968
- that?.totals?.row?.showGrandTotals) {
69969
- const rowTotalKeys = [];
69970
- const colCompute = (flatRowKey, flatColKey) => {
69971
- if (this.totalRecordsTree?.[flatRowKey]?.[flatColKey]) {
69972
- this.tree[flatRowKey][flatColKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColKey];
69973
- return;
70668
+ const colCompute = (flatRowKey, flatColKey) => {
70669
+ if (this.totalRecordsTree?.[flatRowKey]?.[flatColKey]) {
70670
+ if (!this.tree[flatRowKey]) {
70671
+ this.tree[flatRowKey] = {};
69974
70672
  }
69975
- const colKey = flatColKey.split(this.stringJoinChar);
69976
- if (that.totals?.column?.subTotalsDimensions &&
69977
- that.totals?.column?.subTotalsDimensions?.length > 0 &&
69978
- that.totals.column.showSubTotals !== false) {
69979
- for (let i = 0, len = that.totals?.column?.subTotalsDimensions?.length; i < len; i++) {
69980
- const dimension = that.totals.column.subTotalsDimensions[i];
69981
- const dimensionIndex = that.columns.indexOf(dimension);
69982
- if (dimensionIndex >= 0) {
69983
- const colTotalKey = colKey.slice(0, dimensionIndex + 1);
69984
- colTotalKey.push(that.colSubTotalLabel);
69985
- const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
69986
- if (this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey]) {
69987
- this.tree[flatRowKey][flatColTotalKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey];
69988
- return;
69989
- }
69990
- if (!this.tree[flatRowKey][flatColTotalKey]) {
69991
- this.tree[flatRowKey][flatColTotalKey] = [];
70673
+ this.tree[flatRowKey][flatColKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColKey];
70674
+ return;
70675
+ }
70676
+ const colKey = flatColKey.split(this.stringJoinChar);
70677
+ if (that.totals?.column?.subTotalsDimensions &&
70678
+ that.totals?.column?.subTotalsDimensions?.length > 0 &&
70679
+ that.totals.column.showSubTotals !== false) {
70680
+ for (let i = 0, len = that.totals?.column?.subTotalsDimensions?.length; i < len; i++) {
70681
+ const dimension = that.totals.column.subTotalsDimensions[i];
70682
+ const dimensionIndex = that.columns.indexOf(dimension);
70683
+ if (dimensionIndex >= 0) {
70684
+ const colTotalKey = colKey.slice(0, dimensionIndex + 1);
70685
+ colTotalKey.push(that.colSubTotalLabel);
70686
+ const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
70687
+ if (this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey]) {
70688
+ this.tree[flatRowKey][flatColTotalKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey];
70689
+ return;
70690
+ }
70691
+ if (!this.tree[flatRowKey][flatColTotalKey]) {
70692
+ this.tree[flatRowKey][flatColTotalKey] = [];
70693
+ }
70694
+ const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
70695
+ for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
70696
+ if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
70697
+ const calculatedFieldRule = this.calculatedFieldRules?.find(rule => rule.key === toComputeIndicatorKeys[i]);
70698
+ if (!this.tree[flatRowKey]?.[flatColTotalKey]?.[i]) {
70699
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
70700
+ key: toComputeIndicatorKeys[i],
70701
+ dimension: toComputeIndicatorKeys[i],
70702
+ isRecord: true,
70703
+ formatFun: this.indicators?.find((indicator) => {
70704
+ if (typeof indicator !== 'string') {
70705
+ return indicator.indicatorKey === toComputeIndicatorKeys[i];
70706
+ }
70707
+ return false;
70708
+ })?.format,
70709
+ calculateFun: calculatedFieldRule?.calculateFun,
70710
+ dependAggregators: this.tree[flatRowKey][flatColTotalKey],
70711
+ dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
70712
+ });
70713
+ }
70714
+ if (flatColTotalKey !== flatColKey) {
70715
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
70716
+ }
69992
70717
  }
69993
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
69994
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
69995
- if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
69996
- const calculatedFieldRule = this.calculatedFieldRules?.find(rule => rule.key === toComputeIndicatorKeys[i]);
69997
- if (!this.tree[flatRowKey]?.[flatColTotalKey]?.[i]) {
69998
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
69999
- key: toComputeIndicatorKeys[i],
70000
- dimension: toComputeIndicatorKeys[i],
70001
- isRecord: true,
70002
- formatFun: this.indicators?.find((indicator) => {
70718
+ else {
70719
+ if (!this.tree[flatRowKey][flatColTotalKey][i]) {
70720
+ const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
70721
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM]({
70722
+ key: toComputeIndicatorKeys[i],
70723
+ dimension: aggRule?.field ?? toComputeIndicatorKeys[i],
70724
+ formatFun: aggRule?.formatFun ??
70725
+ this.indicators?.find((indicator) => {
70003
70726
  if (typeof indicator !== 'string') {
70004
70727
  return indicator.indicatorKey === toComputeIndicatorKeys[i];
70005
70728
  }
70006
70729
  return false;
70007
- })?.format,
70008
- calculateFun: calculatedFieldRule?.calculateFun,
70009
- dependAggregators: this.tree[flatRowKey][flatColTotalKey],
70010
- dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
70011
- });
70012
- }
70013
- if (flatColTotalKey !== flatColKey) {
70014
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
70015
- }
70730
+ })?.format
70731
+ });
70016
70732
  }
70017
- else {
70018
- if (!this.tree[flatRowKey][flatColTotalKey][i]) {
70019
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
70020
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM]({
70021
- key: toComputeIndicatorKeys[i],
70022
- dimension: aggRule?.field ?? toComputeIndicatorKeys[i],
70023
- formatFun: aggRule?.formatFun ??
70024
- this.indicators?.find((indicator) => {
70025
- if (typeof indicator !== 'string') {
70026
- return indicator.indicatorKey === toComputeIndicatorKeys[i];
70027
- }
70028
- return false;
70029
- })?.format
70030
- });
70031
- }
70032
- if (flatColTotalKey !== flatColKey) {
70033
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
70034
- }
70733
+ if (flatColTotalKey !== flatColKey) {
70734
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
70035
70735
  }
70036
70736
  }
70037
70737
  }
70038
70738
  }
70039
70739
  }
70040
- if (that.totals?.column?.showGrandTotals || this.rows.length === 0) {
70041
- const flatColTotalKey = that.colGrandTotalLabel;
70042
- if (this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey]) {
70043
- this.tree[flatRowKey][flatColTotalKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey];
70044
- return;
70045
- }
70046
- if (!this.tree[flatRowKey][flatColTotalKey]) {
70047
- this.tree[flatRowKey][flatColTotalKey] = [];
70740
+ }
70741
+ if (that.totals?.column?.showGrandTotals || this.rows.length === 0) {
70742
+ const flatColTotalKey = that.colGrandTotalLabel;
70743
+ if (this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey]) {
70744
+ this.tree[flatRowKey][flatColTotalKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey];
70745
+ return;
70746
+ }
70747
+ if (!this.tree[flatRowKey][flatColTotalKey]) {
70748
+ this.tree[flatRowKey][flatColTotalKey] = [];
70749
+ }
70750
+ const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
70751
+ for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
70752
+ if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
70753
+ const calculatedFieldRule = this.calculatedFieldRules?.find(rule => rule.key === toComputeIndicatorKeys[i]);
70754
+ if (!this.tree[flatRowKey]?.[flatColTotalKey]?.[i]) {
70755
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
70756
+ key: toComputeIndicatorKeys[i],
70757
+ dimension: toComputeIndicatorKeys[i],
70758
+ isRecord: true,
70759
+ formatFun: this.indicators?.find((indicator) => {
70760
+ if (typeof indicator !== 'string') {
70761
+ return indicator.indicatorKey === toComputeIndicatorKeys[i];
70762
+ }
70763
+ return false;
70764
+ })?.format,
70765
+ calculateFun: calculatedFieldRule?.calculateFun,
70766
+ dependAggregators: this.tree[flatRowKey][flatColTotalKey],
70767
+ dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
70768
+ });
70769
+ }
70770
+ if (flatColTotalKey !== flatColKey) {
70771
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
70772
+ }
70048
70773
  }
70049
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
70050
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
70051
- if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
70052
- const calculatedFieldRule = this.calculatedFieldRules?.find(rule => rule.key === toComputeIndicatorKeys[i]);
70053
- if (!this.tree[flatRowKey]?.[flatColTotalKey]?.[i]) {
70054
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
70055
- key: toComputeIndicatorKeys[i],
70056
- dimension: toComputeIndicatorKeys[i],
70057
- isRecord: true,
70058
- formatFun: this.indicators?.find((indicator) => {
70774
+ else {
70775
+ if (!this.tree[flatRowKey][flatColTotalKey][i]) {
70776
+ const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
70777
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM]({
70778
+ key: toComputeIndicatorKeys[i],
70779
+ dimension: aggRule?.field ?? toComputeIndicatorKeys[i],
70780
+ formatFun: aggRule?.formatFun ??
70781
+ this.indicators?.find((indicator) => {
70059
70782
  if (typeof indicator !== 'string') {
70060
70783
  return indicator.indicatorKey === toComputeIndicatorKeys[i];
70061
70784
  }
70062
70785
  return false;
70063
- })?.format,
70064
- calculateFun: calculatedFieldRule?.calculateFun,
70065
- dependAggregators: this.tree[flatRowKey][flatColTotalKey],
70066
- dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
70067
- });
70068
- }
70069
- if (flatColTotalKey !== flatColKey) {
70070
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
70071
- }
70786
+ })?.format
70787
+ });
70072
70788
  }
70073
- else {
70074
- if (!this.tree[flatRowKey][flatColTotalKey][i]) {
70075
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
70076
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM]({
70077
- key: toComputeIndicatorKeys[i],
70078
- dimension: aggRule?.field ?? toComputeIndicatorKeys[i],
70079
- formatFun: aggRule?.formatFun ??
70080
- this.indicators?.find((indicator) => {
70081
- if (typeof indicator !== 'string') {
70082
- return indicator.indicatorKey === toComputeIndicatorKeys[i];
70083
- }
70084
- return false;
70085
- })?.format
70086
- });
70087
- }
70088
- if (flatColTotalKey !== flatColKey) {
70089
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
70090
- }
70789
+ if (flatColTotalKey !== flatColKey) {
70790
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
70091
70791
  }
70092
70792
  }
70093
70793
  }
70094
- };
70794
+ }
70795
+ };
70796
+ if ((that?.totals?.column?.subTotalsDimensions && that?.totals?.column?.subTotalsDimensions?.length >= 1) ||
70797
+ (that?.totals?.row?.subTotalsDimensions && that?.totals?.row?.subTotalsDimensions?.length >= 1) ||
70798
+ that?.totals?.column?.showGrandTotals ||
70799
+ that?.totals?.row?.showGrandTotals) {
70800
+ const rowTotalKeys = [];
70095
70801
  Object.keys(that.tree).forEach(flatRowKey => {
70096
70802
  const rowKey = flatRowKey.split(this.stringJoinChar);
70097
70803
  Object.keys(that.tree[flatRowKey]).forEach(flatColKey => {
@@ -70214,6 +70920,11 @@
70214
70920
  });
70215
70921
  });
70216
70922
  }
70923
+ for (const flatRowKey in that.totalRecordsTree) {
70924
+ for (const flatColKey in that.totalRecordsTree[flatRowKey]) {
70925
+ colCompute(flatRowKey, flatColKey);
70926
+ }
70927
+ }
70217
70928
  }
70218
70929
  ArrToTree1(arr, rows, indicators, isGrandTotal, grandTotalLabel) {
70219
70930
  const result = [];
@@ -70370,20 +71081,6 @@
70370
71081
  }
70371
71082
  return result;
70372
71083
  }
70373
- TreeToArr(tree) {
70374
- const result = [];
70375
- function getPath(node, arr) {
70376
- arr.push(node.id);
70377
- if (node.children.length > 0) {
70378
- node.children?.forEach((childItem) => getPath(childItem, [...arr]));
70379
- }
70380
- else {
70381
- result.push(arr);
70382
- }
70383
- }
70384
- tree.forEach((treeNode) => getPath(treeNode, []));
70385
- return result;
70386
- }
70387
71084
  cacheDeminsionCollectedValues() {
70388
71085
  for (const key in this.collectValuesBy) {
70389
71086
  if (this.collectValuesBy[key].type === 'xField' || this.collectValuesBy[key].type === 'yField') {
@@ -70461,6 +71158,11 @@
70461
71158
  this.processRecords();
70462
71159
  }
70463
71160
  }
71161
+ _rowTreeHasChanged() {
71162
+ if (!this.hasExtensionRowTree) {
71163
+ this.customRowTreeDimensionPaths = this.customTreeToDimensionPathArr(this.customRowTree, 'row');
71164
+ }
71165
+ }
70464
71166
  changeDataConfig(dataConfig) {
70465
71167
  this.rows = dataConfig.rows;
70466
71168
  this.columns = dataConfig.columns;
@@ -70474,6 +71176,91 @@
70474
71176
  this.records.push(records);
70475
71177
  }
70476
71178
  }
71179
+ customTreeToDimensionPathArr(tree, type) {
71180
+ const result = [];
71181
+ const that = this;
71182
+ function getPath(node, arr) {
71183
+ if (!node.virtual) {
71184
+ if (arr[arr.length - 1]?.childKeys &&
71185
+ node.dimensionKey &&
71186
+ arr[arr.length - 1].childKeys.indexOf(node.dimensionKey) === -1 &&
71187
+ node.dimensionKey !== arr[arr.length - 1].dimensionKey) {
71188
+ arr[arr.length - 1].childKeys.push(node.dimensionKey);
71189
+ }
71190
+ arr.push({
71191
+ dimensionKey: isValid$1(node.indicatorKey) ? undefined : node.dimensionKey,
71192
+ value: node.value,
71193
+ indicatorKey: node.indicatorKey,
71194
+ virtual: node.virtual
71195
+ });
71196
+ }
71197
+ if (node.children?.length > 0) {
71198
+ if (that.rowHierarchyType === 'tree' && type === 'row') {
71199
+ arr[arr.length - 1].childKeys = [];
71200
+ result.push([...arr]);
71201
+ }
71202
+ node.children?.forEach((childItem) => getPath(childItem, [...arr]));
71203
+ }
71204
+ else {
71205
+ result.push(arr);
71206
+ }
71207
+ }
71208
+ tree?.forEach((treeNode) => getPath(treeNode, []));
71209
+ return result;
71210
+ }
71211
+ getFieldMatchColDimensionPaths(record) {
71212
+ const fieldMatchDimensionPaths = [];
71213
+ for (let i = 0; i < this.customColTreeDimensionPaths?.length ?? 0; i++) {
71214
+ const dimensionPath = this.customColTreeDimensionPaths[i];
71215
+ let isMatch = true;
71216
+ for (let j = 0; j < dimensionPath.length; j++) {
71217
+ const dimension = dimensionPath[j];
71218
+ if ((dimension.dimensionKey && record[dimension.dimensionKey] !== dimension.value) ||
71219
+ (dimension.indicatorKey && record[dimension.indicatorKey] === undefined)) {
71220
+ isMatch = false;
71221
+ break;
71222
+ }
71223
+ }
71224
+ if (isMatch) {
71225
+ fieldMatchDimensionPaths.push(dimensionPath);
71226
+ }
71227
+ }
71228
+ return fieldMatchDimensionPaths;
71229
+ }
71230
+ getFieldMatchRowDimensionPaths(record) {
71231
+ const fieldMatchDimensionPaths = [];
71232
+ for (let i = 0; i < this.customRowTreeDimensionPaths?.length ?? 0; i++) {
71233
+ const dimensionPath = this.customRowTreeDimensionPaths[i];
71234
+ let isMatch = true;
71235
+ for (let j = 0; j < dimensionPath.length; j++) {
71236
+ const dimension = dimensionPath[j];
71237
+ if ((dimension.dimensionKey && record[dimension.dimensionKey] !== dimension.value) ||
71238
+ (dimension.indicatorKey && record[dimension.indicatorKey] === undefined)) {
71239
+ isMatch = false;
71240
+ break;
71241
+ }
71242
+ if (dimension.childKeys && j === dimensionPath.length - 1) {
71243
+ if (dimension.childKeys.length > 0 && dimension.childKeys.find(key => isValid$1(record[key]))) {
71244
+ isMatch = false;
71245
+ break;
71246
+ }
71247
+ }
71248
+ }
71249
+ if (isMatch) {
71250
+ if (!this.indicatorsAsCol && this.rowHierarchyType === 'tree') {
71251
+ if (!dimensionPath.find(path => {
71252
+ return path.indicatorKey;
71253
+ })) {
71254
+ isMatch = false;
71255
+ }
71256
+ }
71257
+ }
71258
+ if (isMatch) {
71259
+ fieldMatchDimensionPaths.push(dimensionPath);
71260
+ }
71261
+ }
71262
+ return fieldMatchDimensionPaths;
71263
+ }
70477
71264
  }
70478
71265
  function arraySortByAnotherArray(array, sortArray) {
70479
71266
  return array.sort((a, b) => {
@@ -70553,7 +71340,7 @@
70553
71340
  const keysResults = parseColKeyRowKeyForPivotTable(this, options);
70554
71341
  const { rowKeys, columnKeys, indicatorKeys } = keysResults;
70555
71342
  let { columnDimensionTree, rowDimensionTree } = keysResults;
70556
- this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, options.indicatorsAsCol ?? true, options.records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree);
71343
+ this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, options.indicatorsAsCol ?? true, options.records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree, false, !!options.extensionRows, !!options.parseCustomTreeToMatchRecords);
70557
71344
  if (!options.columnTree) {
70558
71345
  if (options.indicatorsAsCol !== false) {
70559
71346
  this.dataset.colHeaderTree = supplementIndicatorNodesForCustomTree(this.dataset.colHeaderTree, options.indicators);
@@ -70694,7 +71481,7 @@
70694
71481
  const keysResults = parseColKeyRowKeyForPivotTable(this, options);
70695
71482
  const { rowKeys, columnKeys, indicatorKeys } = keysResults;
70696
71483
  let { columnDimensionTree, rowDimensionTree } = keysResults;
70697
- this.dataset = new Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, options.indicatorsAsCol ?? true, records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree);
71484
+ this.dataset = new Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, options.indicatorsAsCol ?? true, records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree, false, !!options.extensionRows, !!options.parseCustomTreeToMatchRecords);
70698
71485
  if (!options.columnTree) {
70699
71486
  if (options.indicatorsAsCol !== false) {
70700
71487
  this.dataset.colHeaderTree = supplementIndicatorNodesForCustomTree(this.dataset.colHeaderTree, options.indicators);
@@ -71900,6 +72687,7 @@
71900
72687
  const headerTreeNode = this.internalProps.layoutMap.getHeadNode(col, row);
71901
72688
  headerTreeNode.children = children;
71902
72689
  this._refreshHierarchyState(col, row, () => {
72690
+ this.dataset._rowTreeHasChanged();
71903
72691
  this.dataset.changeDataConfig({
71904
72692
  rows: this.internalProps.layoutMap.fullRowDimensionKeys,
71905
72693
  columns: this.internalProps.layoutMap.colDimensionKeys
@@ -73566,7 +74354,7 @@
73566
74354
  }
73567
74355
 
73568
74356
  registerForVrender();
73569
- const version = "1.7.8-alpha.4";
74357
+ const version = "1.7.8";
73570
74358
  function getIcons() {
73571
74359
  return get$2();
73572
74360
  }