@visactor/vtable 0.25.5 → 0.26.0-alpha.1

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 (105) hide show
  1. package/cjs/PivotChart.d.ts +9 -0
  2. package/cjs/PivotChart.js +90 -28
  3. package/cjs/PivotChart.js.map +1 -1
  4. package/cjs/PivotTable.d.ts +5 -2
  5. package/cjs/PivotTable.js +186 -152
  6. package/cjs/PivotTable.js.map +1 -1
  7. package/cjs/core/BaseTable.js +4 -5
  8. package/cjs/core/BaseTable.js.map +1 -1
  9. package/cjs/dataset/dataset.d.ts +20 -15
  10. package/cjs/dataset/dataset.js +88 -62
  11. package/cjs/dataset/dataset.js.map +1 -1
  12. package/cjs/dataset/statistics-helper.d.ts +13 -2
  13. package/cjs/dataset/statistics-helper.js +22 -27
  14. package/cjs/dataset/statistics-helper.js.map +1 -1
  15. package/cjs/event/listener/table-group.js +3 -10
  16. package/cjs/event/listener/table-group.js.map +1 -1
  17. package/cjs/index.d.ts +1 -1
  18. package/cjs/index.js +1 -1
  19. package/cjs/index.js.map +1 -1
  20. package/cjs/layout/chart-helper/get-chart-spec.d.ts +2 -1
  21. package/cjs/layout/chart-helper/get-chart-spec.js +3 -3
  22. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  23. package/cjs/layout/layout-helper.d.ts +12 -0
  24. package/cjs/layout/layout-helper.js +52 -4
  25. package/cjs/layout/layout-helper.js.map +1 -1
  26. package/cjs/layout/pivot-header-layout.d.ts +4 -3
  27. package/cjs/layout/pivot-header-layout.js +43 -47
  28. package/cjs/layout/pivot-header-layout.js.map +1 -1
  29. package/cjs/layout/tree-helper.d.ts +2 -0
  30. package/cjs/layout/tree-helper.js +19 -11
  31. package/cjs/layout/tree-helper.js.map +1 -1
  32. package/cjs/state/cell-move/adjust-header.js +1 -1
  33. package/cjs/state/cell-move/adjust-header.js.map +1 -1
  34. package/cjs/state/resize/update-resize-column.js +1 -1
  35. package/cjs/state/resize/update-resize-column.js.map +1 -1
  36. package/cjs/state/resize/update-resize-row.js +5 -4
  37. package/cjs/state/resize/update-resize-row.js.map +1 -1
  38. package/cjs/tools/get-data-path/create-dataset.d.ts +9 -1
  39. package/cjs/tools/get-data-path/create-dataset.js +19 -8
  40. package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
  41. package/cjs/tools/get-data-path/index.js +12 -3
  42. package/cjs/tools/get-data-path/index.js.map +1 -1
  43. package/cjs/ts-types/base-table.d.ts +6 -4
  44. package/cjs/ts-types/base-table.js.map +1 -1
  45. package/cjs/ts-types/common.d.ts +2 -0
  46. package/cjs/ts-types/common.js.map +1 -1
  47. package/cjs/ts-types/menu.d.ts +1 -1
  48. package/cjs/ts-types/menu.js.map +1 -1
  49. package/cjs/ts-types/table-engine.d.ts +1 -0
  50. package/cjs/ts-types/table-engine.js.map +1 -1
  51. package/cjs/vrender.js.map +1 -1
  52. package/dist/vtable.js +902 -566
  53. package/dist/vtable.min.js +2 -2
  54. package/es/PivotChart.d.ts +9 -0
  55. package/es/PivotChart.js +97 -29
  56. package/es/PivotChart.js.map +1 -1
  57. package/es/PivotTable.d.ts +5 -2
  58. package/es/PivotTable.js +188 -148
  59. package/es/PivotTable.js.map +1 -1
  60. package/es/core/BaseTable.js +4 -5
  61. package/es/core/BaseTable.js.map +1 -1
  62. package/es/dataset/dataset.d.ts +20 -15
  63. package/es/dataset/dataset.js +89 -61
  64. package/es/dataset/dataset.js.map +1 -1
  65. package/es/dataset/statistics-helper.d.ts +13 -2
  66. package/es/dataset/statistics-helper.js +22 -27
  67. package/es/dataset/statistics-helper.js.map +1 -1
  68. package/es/event/listener/table-group.js +2 -11
  69. package/es/event/listener/table-group.js.map +1 -1
  70. package/es/index.d.ts +1 -1
  71. package/es/index.js +1 -1
  72. package/es/index.js.map +1 -1
  73. package/es/layout/chart-helper/get-chart-spec.d.ts +2 -1
  74. package/es/layout/chart-helper/get-chart-spec.js +3 -3
  75. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  76. package/es/layout/layout-helper.d.ts +12 -0
  77. package/es/layout/layout-helper.js +50 -0
  78. package/es/layout/layout-helper.js.map +1 -1
  79. package/es/layout/pivot-header-layout.d.ts +4 -3
  80. package/es/layout/pivot-header-layout.js +41 -46
  81. package/es/layout/pivot-header-layout.js.map +1 -1
  82. package/es/layout/tree-helper.d.ts +2 -0
  83. package/es/layout/tree-helper.js +19 -11
  84. package/es/layout/tree-helper.js.map +1 -1
  85. package/es/state/cell-move/adjust-header.js +1 -1
  86. package/es/state/cell-move/adjust-header.js.map +1 -1
  87. package/es/state/resize/update-resize-column.js +1 -1
  88. package/es/state/resize/update-resize-column.js.map +1 -1
  89. package/es/state/resize/update-resize-row.js +5 -4
  90. package/es/state/resize/update-resize-row.js.map +1 -1
  91. package/es/tools/get-data-path/create-dataset.d.ts +9 -1
  92. package/es/tools/get-data-path/create-dataset.js +20 -7
  93. package/es/tools/get-data-path/create-dataset.js.map +1 -1
  94. package/es/tools/get-data-path/index.js +15 -2
  95. package/es/tools/get-data-path/index.js.map +1 -1
  96. package/es/ts-types/base-table.d.ts +6 -4
  97. package/es/ts-types/base-table.js.map +1 -1
  98. package/es/ts-types/common.d.ts +2 -0
  99. package/es/ts-types/common.js.map +1 -1
  100. package/es/ts-types/menu.d.ts +1 -1
  101. package/es/ts-types/menu.js.map +1 -1
  102. package/es/ts-types/table-engine.d.ts +1 -0
  103. package/es/ts-types/table-engine.js.map +1 -1
  104. package/es/vrender.js.map +1 -1
  105. package/package.json +5 -5
package/dist/vtable.js CHANGED
@@ -33300,7 +33300,7 @@
33300
33300
  type = AggregationType.RECORD;
33301
33301
  isRecord = true;
33302
33302
  push(record) {
33303
- if (this.isRecord) {
33303
+ if (this.isRecord && this.records) {
33304
33304
  if (record.className === 'Aggregator') {
33305
33305
  this.records.push(...record.records);
33306
33306
  }
@@ -33326,7 +33326,9 @@
33326
33326
  if (this.isRecord) {
33327
33327
  this.records = [record];
33328
33328
  }
33329
- this.fieldValue = record[this.field];
33329
+ if (this.field) {
33330
+ this.fieldValue = record[this.field];
33331
+ }
33330
33332
  }
33331
33333
  value() {
33332
33334
  return this.fieldValue;
@@ -33349,7 +33351,7 @@
33349
33351
  this.aggregationFun = aggregationFun;
33350
33352
  }
33351
33353
  push(record) {
33352
- if (this.isRecord) {
33354
+ if (this.isRecord && this.records) {
33353
33355
  if (record.className === 'Aggregator') {
33354
33356
  this.records.push(...record.records);
33355
33357
  }
@@ -33357,7 +33359,9 @@
33357
33359
  this.records.push(record);
33358
33360
  }
33359
33361
  }
33360
- this.values.push(record[this.field]);
33362
+ if (this.field) {
33363
+ this.values.push(record[this.field]);
33364
+ }
33361
33365
  }
33362
33366
  value() {
33363
33367
  if (!this.fieldValue) {
@@ -33383,7 +33387,7 @@
33383
33387
  this.needSplitPositiveAndNegativeForSum = needSplitPositiveAndNegative ?? false;
33384
33388
  }
33385
33389
  push(record) {
33386
- if (this.isRecord) {
33390
+ if (this.isRecord && this.records) {
33387
33391
  if (record.className === 'Aggregator') {
33388
33392
  this.records.push(...record.records);
33389
33393
  }
@@ -33403,7 +33407,7 @@
33403
33407
  }
33404
33408
  }
33405
33409
  }
33406
- else if (!isNaN(parseFloat(record[this.field]))) {
33410
+ else if (this.field && !isNaN(parseFloat(record[this.field]))) {
33407
33411
  const value = parseFloat(record[this.field]);
33408
33412
  this.sum += value;
33409
33413
  if (this.needSplitPositiveAndNegativeForSum) {
@@ -33432,29 +33436,31 @@
33432
33436
  recalculate() {
33433
33437
  this.sum = 0;
33434
33438
  this._formatedValue = undefined;
33435
- for (let i = 0; i < this.records.length; i++) {
33436
- const record = this.records[i];
33437
- if (record.className === 'Aggregator') {
33438
- const value = record.value();
33439
- this.sum += value;
33440
- if (this.needSplitPositiveAndNegativeForSum) {
33441
- if (value > 0) {
33442
- this.positiveSum += value;
33443
- }
33444
- else if (value < 0) {
33445
- this.nagetiveSum += value;
33439
+ if (this.records) {
33440
+ for (let i = 0; i < this.records.length; i++) {
33441
+ const record = this.records[i];
33442
+ if (record.className === 'Aggregator') {
33443
+ const value = record.value();
33444
+ this.sum += value;
33445
+ if (this.needSplitPositiveAndNegativeForSum) {
33446
+ if (value > 0) {
33447
+ this.positiveSum += value;
33448
+ }
33449
+ else if (value < 0) {
33450
+ this.nagetiveSum += value;
33451
+ }
33446
33452
  }
33447
33453
  }
33448
- }
33449
- else if (!isNaN(parseFloat(record[this.field]))) {
33450
- const value = parseFloat(record[this.field]);
33451
- this.sum += value;
33452
- if (this.needSplitPositiveAndNegativeForSum) {
33453
- if (value > 0) {
33454
- this.positiveSum += value;
33455
- }
33456
- else if (value < 0) {
33457
- this.nagetiveSum += value;
33454
+ else if (this.field && !isNaN(parseFloat(record[this.field]))) {
33455
+ const value = parseFloat(record[this.field]);
33456
+ this.sum += value;
33457
+ if (this.needSplitPositiveAndNegativeForSum) {
33458
+ if (value > 0) {
33459
+ this.positiveSum += value;
33460
+ }
33461
+ else if (value < 0) {
33462
+ this.nagetiveSum += value;
33463
+ }
33458
33464
  }
33459
33465
  }
33460
33466
  }
@@ -33465,7 +33471,7 @@
33465
33471
  type = AggregationType.COUNT;
33466
33472
  count = 0;
33467
33473
  push(record) {
33468
- if (this.isRecord) {
33474
+ if (this.isRecord && this.records) {
33469
33475
  if (record.className === 'Aggregator') {
33470
33476
  this.records.push(...record.records);
33471
33477
  }
@@ -33490,13 +33496,15 @@
33490
33496
  recalculate() {
33491
33497
  this.count = 0;
33492
33498
  this._formatedValue = undefined;
33493
- for (let i = 0; i < this.records.length; i++) {
33494
- const record = this.records[i];
33495
- if (record.className === 'Aggregator') {
33496
- this.count += record.value();
33497
- }
33498
- else {
33499
- this.count++;
33499
+ if (this.records) {
33500
+ for (let i = 0; i < this.records.length; i++) {
33501
+ const record = this.records[i];
33502
+ if (record.className === 'Aggregator') {
33503
+ this.count += record.value();
33504
+ }
33505
+ else {
33506
+ this.count++;
33507
+ }
33500
33508
  }
33501
33509
  }
33502
33510
  }
@@ -33506,7 +33514,7 @@
33506
33514
  sum = 0;
33507
33515
  count = 0;
33508
33516
  push(record) {
33509
- if (this.isRecord) {
33517
+ if (this.isRecord && this.records) {
33510
33518
  if (record.className === 'Aggregator') {
33511
33519
  this.records.push(...record.records);
33512
33520
  }
@@ -33518,7 +33526,7 @@
33518
33526
  this.sum += record.sum;
33519
33527
  this.count += record.count;
33520
33528
  }
33521
- else if (!isNaN(parseFloat(record[this.field]))) {
33529
+ else if (this.field && !isNaN(parseFloat(record[this.field]))) {
33522
33530
  this.sum += parseFloat(record[this.field]);
33523
33531
  this.count++;
33524
33532
  }
@@ -33535,15 +33543,17 @@
33535
33543
  this.sum = 0;
33536
33544
  this.count = 0;
33537
33545
  this._formatedValue = undefined;
33538
- for (let i = 0; i < this.records.length; i++) {
33539
- const record = this.records[i];
33540
- if (record.className === 'Aggregator' && record.type === AggregationType.AVG) {
33541
- this.sum += record.sum;
33542
- this.count += record.count;
33543
- }
33544
- else if (!isNaN(parseFloat(record[this.field]))) {
33545
- this.sum += parseFloat(record[this.field]);
33546
- this.count++;
33546
+ if (this.records) {
33547
+ for (let i = 0; i < this.records.length; i++) {
33548
+ const record = this.records[i];
33549
+ if (record.className === 'Aggregator' && record.type === AggregationType.AVG) {
33550
+ this.sum += record.sum;
33551
+ this.count += record.count;
33552
+ }
33553
+ else if (this.field && !isNaN(parseFloat(record[this.field]))) {
33554
+ this.sum += parseFloat(record[this.field]);
33555
+ this.count++;
33556
+ }
33547
33557
  }
33548
33558
  }
33549
33559
  }
@@ -33552,7 +33562,7 @@
33552
33562
  type = AggregationType.MAX;
33553
33563
  max = Number.MIN_SAFE_INTEGER;
33554
33564
  push(record) {
33555
- if (this.isRecord) {
33565
+ if (this.isRecord && this.records) {
33556
33566
  if (record.className === 'Aggregator') {
33557
33567
  this.records.push(...record.records);
33558
33568
  }
@@ -33566,10 +33576,10 @@
33566
33576
  else if (typeof record === 'number') {
33567
33577
  this.max = record > this.max ? record : this.max;
33568
33578
  }
33569
- else if (typeof record[this.field] === 'number') {
33579
+ else if (this.field && typeof record[this.field] === 'number') {
33570
33580
  this.max = record[this.field] > this.max ? record[this.field] : this.max;
33571
33581
  }
33572
- else if (!isNaN(record[this.field])) {
33582
+ else if (this.field && !isNaN(record[this.field])) {
33573
33583
  this.max = parseFloat(record[this.field]) > this.max ? parseFloat(record[this.field]) : this.max;
33574
33584
  }
33575
33585
  }
@@ -33583,19 +33593,21 @@
33583
33593
  recalculate() {
33584
33594
  this.max = Number.MIN_SAFE_INTEGER;
33585
33595
  this._formatedValue = undefined;
33586
- for (let i = 0; i < this.records.length; i++) {
33587
- const record = this.records[i];
33588
- if (record.className === 'Aggregator') {
33589
- this.max = record.max > this.max ? record.max : this.max;
33590
- }
33591
- else if (typeof record === 'number') {
33592
- this.max = record > this.max ? record : this.max;
33593
- }
33594
- else if (typeof record[this.field] === 'number') {
33595
- this.max = record[this.field] > this.max ? record[this.field] : this.max;
33596
- }
33597
- else if (!isNaN(record[this.field])) {
33598
- this.max = parseFloat(record[this.field]) > this.max ? parseFloat(record[this.field]) : this.max;
33596
+ if (this.records) {
33597
+ for (let i = 0; i < this.records.length; i++) {
33598
+ const record = this.records[i];
33599
+ if (record.className === 'Aggregator') {
33600
+ this.max = record.max > this.max ? record.max : this.max;
33601
+ }
33602
+ else if (typeof record === 'number') {
33603
+ this.max = record > this.max ? record : this.max;
33604
+ }
33605
+ else if (this.field && typeof record[this.field] === 'number') {
33606
+ this.max = record[this.field] > this.max ? record[this.field] : this.max;
33607
+ }
33608
+ else if (this.field && !isNaN(record[this.field])) {
33609
+ this.max = parseFloat(record[this.field]) > this.max ? parseFloat(record[this.field]) : this.max;
33610
+ }
33599
33611
  }
33600
33612
  }
33601
33613
  }
@@ -33604,7 +33616,7 @@
33604
33616
  type = AggregationType.MIN;
33605
33617
  min = Number.MAX_SAFE_INTEGER;
33606
33618
  push(record) {
33607
- if (this.isRecord) {
33619
+ if (this.isRecord && this.records) {
33608
33620
  if (record.className === 'Aggregator') {
33609
33621
  this.records.push(...record.records);
33610
33622
  }
@@ -33618,7 +33630,7 @@
33618
33630
  else if (typeof record === 'number') {
33619
33631
  this.min = record < this.min ? record : this.min;
33620
33632
  }
33621
- else if (typeof record[this.field] === 'number') {
33633
+ else if (this.field && typeof record[this.field] === 'number') {
33622
33634
  this.min = record[this.field] < this.min ? record[this.field] : this.min;
33623
33635
  }
33624
33636
  }
@@ -33632,16 +33644,18 @@
33632
33644
  recalculate() {
33633
33645
  this.min = Number.MAX_SAFE_INTEGER;
33634
33646
  this._formatedValue = undefined;
33635
- for (let i = 0; i < this.records.length; i++) {
33636
- const record = this.records[i];
33637
- if (record.className === 'Aggregator') {
33638
- this.min = record.min < this.min ? record.min : this.min;
33639
- }
33640
- else if (typeof record === 'number') {
33641
- this.min = record < this.min ? record : this.min;
33642
- }
33643
- else if (typeof record[this.field] === 'number') {
33644
- this.min = record[this.field] < this.min ? record[this.field] : this.min;
33647
+ if (this.records) {
33648
+ for (let i = 0; i < this.records.length; i++) {
33649
+ const record = this.records[i];
33650
+ if (record.className === 'Aggregator') {
33651
+ this.min = record.min < this.min ? record.min : this.min;
33652
+ }
33653
+ else if (typeof record === 'number') {
33654
+ this.min = record < this.min ? record : this.min;
33655
+ }
33656
+ else if (this.field && typeof record[this.field] === 'number') {
33657
+ this.min = record[this.field] < this.min ? record[this.field] : this.min;
33658
+ }
33645
33659
  }
33646
33660
  }
33647
33661
  }
@@ -50973,9 +50987,9 @@
50973
50987
  target.col = table.rowHeaderLevelCount + layoutMap.leftRowSeriesNumberColumnCount - 1;
50974
50988
  }
50975
50989
  if (layoutMap.rowHierarchyType === 'tree') {
50976
- const sourceRowHeaderPaths = layoutMap.getCellHeaderPathsWidthTreeNode(source.col, source.row)
50990
+ const sourceRowHeaderPaths = layoutMap.getCellHeaderPathsWithTreeNode(source.col, source.row)
50977
50991
  .rowHeaderPaths;
50978
- const targetRowHeaderPaths = layoutMap.getCellHeaderPathsWidthTreeNode(target.col, target.row)
50992
+ const targetRowHeaderPaths = layoutMap.getCellHeaderPathsWithTreeNode(target.col, target.row)
50979
50993
  .rowHeaderPaths;
50980
50994
  if (sourceRowHeaderPaths.length <= targetRowHeaderPaths.length) {
50981
50995
  const targetPathNode = targetRowHeaderPaths[sourceRowHeaderPaths.length - 1];
@@ -51374,7 +51388,7 @@
51374
51388
  function updateResizeColForIndicatorGroup$1(detaX, state) {
51375
51389
  const layout = state.table.internalProps.layoutMap;
51376
51390
  const headerPaths = layout.getCellHeaderPaths(state.columnResize.col, state.table.columnHeaderLevelCount);
51377
- const node = layout.getHeadNode(headerPaths.colHeaderPaths.slice(0, headerPaths.colHeaderPaths.length - 1));
51391
+ const node = layout.getHeadNodeByRowOrColDimensions(headerPaths.colHeaderPaths.slice(0, headerPaths.colHeaderPaths.length - 1));
51378
51392
  const startCol = node.startInTotal + state.table.frozenColCount;
51379
51393
  const endCol = node.startInTotal + state.table.frozenColCount + node.size - 1;
51380
51394
  const totalColWidth = state.table.getColsWidth(startCol, endCol);
@@ -51776,9 +51790,9 @@
51776
51790
  }
51777
51791
  else {
51778
51792
  const headerPaths = layout.getCellHeaderPaths(state.table.rowHeaderLevelCount - 1, state.rowResize.row);
51779
- const headerPath = headerPaths.rowHeaderPaths[headerPaths.rowHeaderPaths.length - 1];
51780
- resizeDimensionKey = headerPath.dimensionKey;
51781
- resizeDimensionValue = headerPath.value;
51793
+ const headerPath = headerPaths.rowHeaderPaths?.[headerPaths.rowHeaderPaths.length - 1];
51794
+ resizeDimensionKey = headerPath?.dimensionKey;
51795
+ resizeDimensionValue = headerPath?.value;
51782
51796
  }
51783
51797
  for (let row = state.table.columnHeaderLevelCount; row < state.table.rowCount - state.table.bottomFrozenRowCount; row++) {
51784
51798
  const indicatorKey = layout.getIndicatorKey(state.table.rowHeaderLevelCount, row);
@@ -51788,7 +51802,7 @@
51788
51802
  }
51789
51803
  else if (layout.indicatorsAsCol) {
51790
51804
  const headerPaths = layout.getCellHeaderPaths(state.table.rowHeaderLevelCount - 1, row);
51791
- const headerPath = headerPaths?.rowHeaderPaths[headerPaths.rowHeaderPaths.length - 1];
51805
+ const headerPath = headerPaths?.rowHeaderPaths?.[headerPaths.rowHeaderPaths.length - 1];
51792
51806
  if (headerPath && resizeDimensionKey === headerPath.dimensionKey && resizeDimensionValue === headerPath.value) {
51793
51807
  state.table.scenegraph.updateRowHeight(row, detaY);
51794
51808
  state.table.internalProps._heightResizedRowMap.add(row);
@@ -51799,7 +51813,7 @@
51799
51813
  function updateResizeColForIndicatorGroup(detaY, state) {
51800
51814
  const layout = state.table.internalProps.layoutMap;
51801
51815
  const headerPaths = layout.getCellHeaderPaths(state.table.rowHeaderLevelCount, state.rowResize.row);
51802
- const node = layout.getHeadNode(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length - 1));
51816
+ const node = layout.getHeadNodeByRowOrColDimensions(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length - 1));
51803
51817
  const startRow = node.startInTotal + state.table.frozenRowCount;
51804
51818
  const endRow = node.startInTotal + state.table.frozenRowCount + node.size - 1;
51805
51819
  const totalRowHeight = state.table.getRowsHeight(startRow, endRow);
@@ -53395,17 +53409,6 @@
53395
53409
  if (!eventManager.checkCellFillhandle(eventArgsSet) && eventManager.checkColumnResize(eventArgsSet, true)) {
53396
53410
  table.scenegraph.updateChartState(null);
53397
53411
  stateManager.updateInteractionState(InteractionState.grabing);
53398
- const { eventArgs } = eventArgsSet;
53399
- if (!eventArgs?.targetCell) {
53400
- const cell = table.getCellAt(eventArgsSet.abstractPos.x - ResizeColumnHotSpotSize / 2, eventArgsSet.abstractPos.y);
53401
- if (cell) {
53402
- if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE)) {
53403
- table.fireListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE, {
53404
- event: e.nativeEvent
53405
- });
53406
- }
53407
- }
53408
- }
53409
53412
  return;
53410
53413
  }
53411
53414
  });
@@ -58255,7 +58258,7 @@
58255
58258
  return TABLE_EVENT_TYPE;
58256
58259
  }
58257
58260
  options;
58258
- version = "0.25.5";
58261
+ version = "0.26.0-alpha.1";
58259
58262
  pagination;
58260
58263
  id = `VTable${Date.now()}`;
58261
58264
  headerStyleCache;
@@ -58271,7 +58274,7 @@
58271
58274
  if (!container && options.mode !== 'node') {
58272
58275
  throw new Error("vtable's container is undefined");
58273
58276
  }
58274
- const { frozenColCount = 0, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth, widthMode = 'standard', heightMode = 'standard', autoFillWidth = false, autoFillHeight = false, widthAdaptiveMode = 'only-body', heightAdaptiveMode = 'only-body', keyboardOptions, eventOptions, rowSeriesNumber, columnResizeMode, rowResizeMode = 'none', dragHeaderMode, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, customRender, pixelRatio = defaultPixelRatio, renderChartAsync, renderChartAsyncBatchCount, mode, modeParams, canvasWidth, canvasHeight, overscrollBehavior, limitMinWidth, limitMinHeight, clearDOM = true } = options;
58277
+ const { frozenColCount = 0, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth, widthMode = 'standard', heightMode = 'standard', autoFillWidth = false, autoFillHeight = false, widthAdaptiveMode = 'only-body', heightAdaptiveMode = 'only-body', keyboardOptions, eventOptions, rowSeriesNumber, columnResizeMode, rowResizeMode = 'none', dragHeaderMode, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, customRender, pixelRatio = defaultPixelRatio, renderChartAsync, renderChartAsyncBatchCount, mode, modeParams, canvasWidth, canvasHeight, overscrollBehavior, limitMinWidth, limitMinHeight } = options;
58275
58278
  this.container = container;
58276
58279
  this.options = options;
58277
58280
  this._widthMode = widthMode;
@@ -58354,9 +58357,6 @@
58354
58357
  internalProps.theme = themes.of(options.theme ?? themes.DEFAULT);
58355
58358
  internalProps.theme.isPivot = this.isPivotTable();
58356
58359
  if (container) {
58357
- if (clearDOM) {
58358
- container.innerHTML = '';
58359
- }
58360
58360
  container.appendChild(internalProps.element);
58361
58361
  this._updateSize();
58362
58362
  }
@@ -61107,10 +61107,10 @@
61107
61107
  }
61108
61108
  return true;
61109
61109
  }
61110
- function checkHasCartesianChart(layout) {
61110
+ function checkHasCartesianChart(indicatorsDefine) {
61111
61111
  let isHasCartesianChart = false;
61112
- for (let i = 0; i < layout.indicatorsDefine.length; i++) {
61113
- const columnObj = layout.indicatorsDefine[i];
61112
+ for (let i = 0; i < indicatorsDefine.length; i++) {
61113
+ const columnObj = indicatorsDefine[i];
61114
61114
  if (columnObj.chartSpec) {
61115
61115
  if (columnObj.chartSpec.type !== 'wordCloud' &&
61116
61116
  columnObj.chartSpec.type !== 'radar' &&
@@ -61384,59 +61384,6 @@
61384
61384
  return isHasChart;
61385
61385
  }
61386
61386
 
61387
- function checkHasAggregation(layoutMap) {
61388
- const columnObjects = layoutMap.columnObjects;
61389
- for (let i = 0; i < columnObjects.length; i++) {
61390
- const column = columnObjects[i];
61391
- if (column?.aggregation) {
61392
- return true;
61393
- }
61394
- }
61395
- return false;
61396
- }
61397
- function checkHasAggregationOnTop(layoutMap) {
61398
- const columnObjects = layoutMap.columnObjects;
61399
- let count = 0;
61400
- for (let i = 0; i < columnObjects.length; i++) {
61401
- const column = columnObjects[i];
61402
- if (column?.aggregation) {
61403
- if (Array.isArray(column?.aggregation)) {
61404
- count = Math.max(count, column.aggregation.filter(item => item.showOnTop === true).length);
61405
- }
61406
- else if (column.aggregation.showOnTop === true) {
61407
- count = Math.max(count, 1);
61408
- }
61409
- }
61410
- }
61411
- return count;
61412
- }
61413
- function checkHasAggregationOnBottom(layoutMap) {
61414
- const columnObjects = layoutMap.columnObjects;
61415
- let count = 0;
61416
- for (let i = 0; i < columnObjects.length; i++) {
61417
- const column = columnObjects[i];
61418
- if (column?.aggregation) {
61419
- if (Array.isArray(column?.aggregation)) {
61420
- count = Math.max(count, column.aggregation.filter(item => item.showOnTop === false).length);
61421
- }
61422
- else if (column.aggregation.showOnTop === false) {
61423
- count = Math.max(count, 1);
61424
- }
61425
- }
61426
- }
61427
- return count;
61428
- }
61429
- function checkHasTreeDefine(layoutMap) {
61430
- const columnObjects = layoutMap.columnObjects;
61431
- for (let i = 0; i < columnObjects.length; i++) {
61432
- const column = columnObjects[i];
61433
- if (column?.define?.tree) {
61434
- return true;
61435
- }
61436
- }
61437
- return false;
61438
- }
61439
-
61440
61387
  class DimensionTree {
61441
61388
  sharedVar;
61442
61389
  sizeIncludeParent = false;
@@ -61456,6 +61403,7 @@
61456
61403
  };
61457
61404
  totalLevel = 0;
61458
61405
  dimensionKeys = new NumberMap();
61406
+ dimensionKeysIncludeVirtual = new NumberMap();
61459
61407
  cache = new Map();
61460
61408
  constructor(tree, sharedVar, hierarchyType = 'grid', rowExpandLevel = undefined) {
61461
61409
  this.sizeIncludeParent = rowExpandLevel !== null && rowExpandLevel !== undefined;
@@ -61467,16 +61415,21 @@
61467
61415
  reset(tree, updateTreeNode = false) {
61468
61416
  this.cache.clear();
61469
61417
  this.dimensionKeys = new NumberMap();
61418
+ this.dimensionKeysIncludeVirtual = new NumberMap();
61470
61419
  this.tree.children = tree;
61471
61420
  this.setTreeNode(this.tree, 0, this.tree);
61472
- this.totalLevel = this.dimensionKeys.count();
61473
61421
  }
61474
61422
  setTreeNode(node, startIndex, parent) {
61475
61423
  node.startIndex = startIndex;
61476
61424
  node.startInTotal = (parent.startInTotal ?? 0) + node.startIndex;
61477
61425
  if (node.dimensionKey ?? node.indicatorKey) {
61478
- !this.dimensionKeys.contain(node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey) &&
61426
+ if (!node.virtual &&
61427
+ !this.dimensionKeys.contain(node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey)) {
61479
61428
  this.dimensionKeys.put(node.level, node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey);
61429
+ }
61430
+ if (!this.dimensionKeysIncludeVirtual.contain(node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey)) {
61431
+ this.dimensionKeysIncludeVirtual.put(node.level, node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey);
61432
+ }
61480
61433
  if (!node.id) {
61481
61434
  node.id = ++this.sharedVar.seqId;
61482
61435
  }
@@ -61487,6 +61440,7 @@
61487
61440
  if (children?.length >= 1) {
61488
61441
  children.forEach((n) => {
61489
61442
  n.level = (node.level ?? 0) + 1;
61443
+ this.totalLevel = Math.max(this.totalLevel, n.level + 1);
61490
61444
  size += this.setTreeNode(n, size, node);
61491
61445
  });
61492
61446
  }
@@ -61497,12 +61451,14 @@
61497
61451
  else if (node.hierarchyState === HierarchyState.expand && children?.length >= 1) {
61498
61452
  children.forEach((n) => {
61499
61453
  n.level = (node.level ?? 0) + 1;
61454
+ this.totalLevel = Math.max(this.totalLevel, n.level + 1);
61500
61455
  size += this.setTreeNode(n, size, node);
61501
61456
  });
61502
61457
  }
61503
61458
  else if (node.hierarchyState === HierarchyState.collapse && children?.length >= 1) {
61504
61459
  children.forEach((n) => {
61505
61460
  n.level = (node.level ?? 0) + 1;
61461
+ this.totalLevel = Math.max(this.totalLevel, n.level + 1);
61506
61462
  this.setTreeNode(n, size, node);
61507
61463
  });
61508
61464
  }
@@ -61513,6 +61469,7 @@
61513
61469
  children?.length >= 1 &&
61514
61470
  children.forEach((n) => {
61515
61471
  n.level = (node.level ?? 0) + 1;
61472
+ this.totalLevel = Math.max(this.totalLevel, n.level + 1);
61516
61473
  size += this.setTreeNode(n, size, node);
61517
61474
  });
61518
61475
  }
@@ -61521,6 +61478,7 @@
61521
61478
  children?.length >= 1 &&
61522
61479
  children.forEach((n) => {
61523
61480
  n.level = (node.level ?? 0) + 1;
61481
+ this.totalLevel = Math.max(this.totalLevel, n.level + 1);
61524
61482
  this.setTreeNode(n, size, node);
61525
61483
  });
61526
61484
  }
@@ -61651,7 +61609,8 @@
61651
61609
  indicatorKey: node.indicatorKey,
61652
61610
  value: node.value,
61653
61611
  hierarchyState: node.hierarchyState,
61654
- children: undefined
61612
+ children: undefined,
61613
+ virtual: node.virtual ?? false
61655
61614
  };
61656
61615
  tree.push(diemnsonNode);
61657
61616
  if (node.children) {
@@ -61846,6 +61805,170 @@
61846
61805
  }
61847
61806
  }
61848
61807
 
61808
+ function checkHasAggregation(layoutMap) {
61809
+ const columnObjects = layoutMap.columnObjects;
61810
+ for (let i = 0; i < columnObjects.length; i++) {
61811
+ const column = columnObjects[i];
61812
+ if (column?.aggregation) {
61813
+ return true;
61814
+ }
61815
+ }
61816
+ return false;
61817
+ }
61818
+ function checkHasAggregationOnTop(layoutMap) {
61819
+ const columnObjects = layoutMap.columnObjects;
61820
+ let count = 0;
61821
+ for (let i = 0; i < columnObjects.length; i++) {
61822
+ const column = columnObjects[i];
61823
+ if (column?.aggregation) {
61824
+ if (Array.isArray(column?.aggregation)) {
61825
+ count = Math.max(count, column.aggregation.filter(item => item.showOnTop === true).length);
61826
+ }
61827
+ else if (column.aggregation.showOnTop === true) {
61828
+ count = Math.max(count, 1);
61829
+ }
61830
+ }
61831
+ }
61832
+ return count;
61833
+ }
61834
+ function checkHasAggregationOnBottom(layoutMap) {
61835
+ const columnObjects = layoutMap.columnObjects;
61836
+ let count = 0;
61837
+ for (let i = 0; i < columnObjects.length; i++) {
61838
+ const column = columnObjects[i];
61839
+ if (column?.aggregation) {
61840
+ if (Array.isArray(column?.aggregation)) {
61841
+ count = Math.max(count, column.aggregation.filter(item => item.showOnTop === false).length);
61842
+ }
61843
+ else if (column.aggregation.showOnTop === false) {
61844
+ count = Math.max(count, 1);
61845
+ }
61846
+ }
61847
+ }
61848
+ return count;
61849
+ }
61850
+ function checkHasTreeDefine(layoutMap) {
61851
+ const columnObjects = layoutMap.columnObjects;
61852
+ for (let i = 0; i < columnObjects.length; i++) {
61853
+ const column = columnObjects[i];
61854
+ if (column?.define?.tree) {
61855
+ return true;
61856
+ }
61857
+ }
61858
+ return false;
61859
+ }
61860
+ function parseColKeyRowKeyForPivotTable(table, options) {
61861
+ let columnDimensionTree;
61862
+ let rowDimensionTree;
61863
+ let isNeedResetColumnDimensionTree = true;
61864
+ let isNeedResetRowDimensionTree = true;
61865
+ if (options.columnTree) {
61866
+ columnDimensionTree = new DimensionTree(table.internalProps.columnTree ?? [], table.layoutNodeId);
61867
+ if (table.options.indicatorsAsCol !== false &&
61868
+ !columnDimensionTree.dimensionKeys.contain(IndicatorDimensionKeyPlaceholder) &&
61869
+ options.indicators?.length >= 1) {
61870
+ isNeedResetColumnDimensionTree = true;
61871
+ }
61872
+ else {
61873
+ isNeedResetColumnDimensionTree = false;
61874
+ }
61875
+ }
61876
+ if (options.rowTree) {
61877
+ rowDimensionTree = new DimensionTree(table.internalProps.rowTree ?? [], table.layoutNodeId, table.options.rowHierarchyType, table.options.rowHierarchyType === 'tree' ? table.options.rowExpandLevel ?? 1 : undefined);
61878
+ if (table.options.indicatorsAsCol === false &&
61879
+ !rowDimensionTree.dimensionKeys.contain(IndicatorDimensionKeyPlaceholder) &&
61880
+ options.indicators?.length >= 1) {
61881
+ isNeedResetRowDimensionTree = true;
61882
+ }
61883
+ else {
61884
+ isNeedResetRowDimensionTree = false;
61885
+ }
61886
+ }
61887
+ const rowKeys = rowDimensionTree?.dimensionKeys?.count
61888
+ ? rowDimensionTree.dimensionKeys.valueArr()
61889
+ : options.rows?.reduce((keys, rowObj) => {
61890
+ if (typeof rowObj === 'string') {
61891
+ keys.push(rowObj);
61892
+ }
61893
+ else {
61894
+ keys.push(rowObj.dimensionKey);
61895
+ }
61896
+ return keys;
61897
+ }, []) ?? [];
61898
+ const columnKeys = columnDimensionTree?.dimensionKeys?.count
61899
+ ? columnDimensionTree.dimensionKeys.valueArr()
61900
+ : options.columns?.reduce((keys, columnObj) => {
61901
+ if (typeof columnObj === 'string') {
61902
+ keys.push(columnObj);
61903
+ }
61904
+ else {
61905
+ keys.push(columnObj.dimensionKey);
61906
+ }
61907
+ return keys;
61908
+ }, []) ?? [];
61909
+ const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
61910
+ if (typeof indicatorObj === 'string') {
61911
+ keys.push(indicatorObj);
61912
+ }
61913
+ else {
61914
+ keys.push(indicatorObj.indicatorKey);
61915
+ if (indicatorObj.chartSpec) {
61916
+ if (table.internalProps.dataConfig?.aggregationRules) {
61917
+ table.internalProps.dataConfig?.aggregationRules.push({
61918
+ field: indicatorObj.indicatorKey,
61919
+ indicatorKey: indicatorObj.indicatorKey,
61920
+ aggregationType: AggregationType.NONE
61921
+ });
61922
+ }
61923
+ else if (table.internalProps.dataConfig) {
61924
+ table.internalProps.dataConfig.aggregationRules = [
61925
+ {
61926
+ field: indicatorObj.indicatorKey,
61927
+ indicatorKey: indicatorObj.indicatorKey,
61928
+ aggregationType: AggregationType.NONE
61929
+ }
61930
+ ];
61931
+ }
61932
+ else {
61933
+ table.internalProps.dataConfig = {
61934
+ aggregationRules: [
61935
+ {
61936
+ field: indicatorObj.indicatorKey,
61937
+ indicatorKey: indicatorObj.indicatorKey,
61938
+ aggregationType: AggregationType.NONE
61939
+ }
61940
+ ]
61941
+ };
61942
+ }
61943
+ }
61944
+ }
61945
+ return keys;
61946
+ }, []) ?? [];
61947
+ if (options.rowHierarchyType === 'tree' && (options.extensionRows?.length ?? 0) >= 1) {
61948
+ options.extensionRows?.forEach(extensionRow => {
61949
+ const extension_rowKeys = [];
61950
+ extensionRow.rows.forEach(row => {
61951
+ if (typeof row === 'string') {
61952
+ extension_rowKeys.push(row);
61953
+ }
61954
+ else {
61955
+ extension_rowKeys.push(row.dimensionKey);
61956
+ }
61957
+ });
61958
+ rowKeys.push(...extension_rowKeys);
61959
+ });
61960
+ }
61961
+ return {
61962
+ rowKeys,
61963
+ columnKeys,
61964
+ indicatorKeys,
61965
+ isNeedResetColumnDimensionTree,
61966
+ isNeedResetRowDimensionTree,
61967
+ columnDimensionTree,
61968
+ rowDimensionTree
61969
+ };
61970
+ }
61971
+
61849
61972
  class SimpleHeaderLayoutMap {
61850
61973
  seqId = 0;
61851
61974
  _headerObjects;
@@ -64798,8 +64921,8 @@
64798
64921
  leftRowSeriesNumberColumnCount = 0;
64799
64922
  rightRowSeriesNumberColumn;
64800
64923
  rightRowSeriesNumberColumnCount = 0;
64801
- constructor(table, dataset) {
64802
- this.sharedVar = { seqId: 0 };
64924
+ constructor(table, dataset, columnDimensionTree, rowDimensionTree) {
64925
+ this.sharedVar = table.layoutNodeId;
64803
64926
  this._table = table;
64804
64927
  if (table.options.rowHierarchyType === 'tree') {
64805
64928
  this.extensionRows = table.options.extensionRows;
@@ -64827,34 +64950,6 @@
64827
64950
  if (dataset) {
64828
64951
  this.rowTree = dataset.rowHeaderTree;
64829
64952
  this.columnTree = dataset.colHeaderTree;
64830
- if (this.indicatorsAsCol && this._table.isPivotChart() && checkHasCartesianChart(this)) {
64831
- const supplyAxisNode = (nodes) => {
64832
- nodes.forEach((node) => {
64833
- if (node.children?.length) {
64834
- supplyAxisNode(node.children);
64835
- }
64836
- else {
64837
- node.children = [
64838
- {
64839
- dimensionKey: 'axis',
64840
- value: ''
64841
- }
64842
- ];
64843
- }
64844
- });
64845
- };
64846
- if (this.rowTree?.length) {
64847
- supplyAxisNode(this.rowTree);
64848
- }
64849
- else {
64850
- this.rowTree = [
64851
- {
64852
- dimensionKey: 'axis',
64853
- value: ''
64854
- }
64855
- ];
64856
- }
64857
- }
64858
64953
  }
64859
64954
  this.indicatorsDefine?.forEach(indicator => {
64860
64955
  if (typeof indicator === 'string') {
@@ -64864,8 +64959,8 @@
64864
64959
  this.indicatorKeys.push(indicator.indicatorKey);
64865
64960
  }
64866
64961
  });
64867
- this.columnDimensionTree = new DimensionTree(this.columnTree ?? [], this.sharedVar);
64868
- this.rowDimensionTree = new DimensionTree(this.rowTree ?? [], this.sharedVar, this.rowHierarchyType, this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined);
64962
+ this.columnDimensionTree = columnDimensionTree;
64963
+ this.rowDimensionTree = rowDimensionTree;
64869
64964
  this.colDimensionKeys = this.columnDimensionTree.dimensionKeys.valueArr();
64870
64965
  this.rowDimensionKeys = this.rowDimensionTree.dimensionKeys.valueArr();
64871
64966
  this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys);
@@ -64912,7 +65007,8 @@
64912
65007
  }
64913
65008
  this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length);
64914
65009
  if (this.cornerSetting.titleOnDimension === 'column') {
64915
- this.cornerHeaderObjs = this._addCornerHeaders(this.columnHeaderTitle ? [''].concat(this.colDimensionKeys) : this.colDimensionKeys, this.columnsDefine);
65010
+ const colDimensionKeys = this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr();
65011
+ this.cornerHeaderObjs = this._addCornerHeaders(this.columnHeaderTitle ? [''].concat(colDimensionKeys) : colDimensionKeys, this.columnsDefine);
64916
65012
  }
64917
65013
  else if (this.cornerSetting.titleOnDimension === 'row') {
64918
65014
  if (this.rowHierarchyType === 'tree' && this.extensionRows?.length >= 1) {
@@ -64927,7 +65023,8 @@
64927
65023
  this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [''].concat(rowTreeFirstKey) : rowTreeFirstKey, this.rowsDefine.concat(extensionRowDimensions));
64928
65024
  }
64929
65025
  else {
64930
- this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [''].concat(this.rowDimensionKeys) : this.rowDimensionKeys, this.rowsDefine);
65026
+ const rowDimensionKeys = this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr();
65027
+ this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [''].concat(rowDimensionKeys) : rowDimensionKeys, this.rowsDefine);
64931
65028
  }
64932
65029
  }
64933
65030
  else {
@@ -65585,7 +65682,7 @@
65585
65682
  if (this._table.isPivotChart() &&
65586
65683
  this.indicatorsAsCol &&
65587
65684
  !this.hasTwoIndicatorAxes &&
65588
- checkHasCartesianChart(this)) {
65685
+ checkHasCartesianChart(this.indicatorsDefine)) {
65589
65686
  count -= 1;
65590
65687
  }
65591
65688
  this.columnHeaderLevelCount = count;
@@ -65605,7 +65702,7 @@
65605
65702
  this.rowHeaderLevelCount = 1 + extensionRowCount;
65606
65703
  return;
65607
65704
  }
65608
- const rowLevelCount = this.rowDimensionKeys.length;
65705
+ const rowLevelCount = this.rowDimensionTree.totalLevel;
65609
65706
  let count = rowLevelCount;
65610
65707
  if (this.indicatorsAsCol) ;
65611
65708
  else if (this.hideIndicatorName &&
@@ -65661,7 +65758,7 @@
65661
65758
  }
65662
65759
  return 0;
65663
65760
  }
65664
- if (this.indicatorKeys.length >= 1 && checkHasCartesianChart(this)) {
65761
+ if (this.indicatorKeys.length >= 1 && checkHasCartesianChart(this.indicatorsDefine)) {
65665
65762
  const axisOption = this._table.pivotChartAxes.find(axisOption => {
65666
65763
  return axisOption.orient === 'bottom';
65667
65764
  });
@@ -65931,7 +66028,7 @@
65931
66028
  getRecordShowIndexByCell(col, row) {
65932
66029
  return undefined;
65933
66030
  }
65934
- getCellHeaderPathsWidthTreeNode(col, row) {
66031
+ getCellHeaderPathsWithTreeNode(col, row) {
65935
66032
  if (col === this._lastCellCol && row === this._lastCellRow) {
65936
66033
  return this._lastCellHeaderPath;
65937
66034
  }
@@ -65988,7 +66085,7 @@
65988
66085
  return p;
65989
66086
  }
65990
66087
  getCellHeaderPaths(col, row) {
65991
- const headerPathsWidthNode = this.getCellHeaderPathsWidthTreeNode(col, row);
66088
+ const headerPathsWidthNode = this.getCellHeaderPathsWithTreeNode(col, row);
65992
66089
  const headerPaths = {
65993
66090
  colHeaderPaths: [],
65994
66091
  rowHeaderPaths: [],
@@ -65999,6 +66096,7 @@
65999
66096
  colHeaderPath.dimensionKey = colHeader.dimensionKey;
66000
66097
  colHeaderPath.indicatorKey = colHeader.indicatorKey;
66001
66098
  colHeaderPath.value = colHeader.value ?? this.getIndicatorInfoByIndicatorKey(colHeader.indicatorKey)?.title ?? '';
66099
+ colHeaderPath.virtual = colHeader.virtual;
66002
66100
  headerPaths.colHeaderPaths.push(colHeaderPath);
66003
66101
  });
66004
66102
  headerPathsWidthNode.rowHeaderPaths?.forEach((rowHeader) => {
@@ -66008,6 +66106,7 @@
66008
66106
  rowHeaderPath.indicatorKey = rowHeader.indicatorKey;
66009
66107
  rowHeaderPath.value =
66010
66108
  rowHeader.value ?? this.getIndicatorInfoByIndicatorKey(rowHeader.indicatorKey)?.title ?? '';
66109
+ rowHeaderPath.virtual = rowHeader.virtual;
66011
66110
  headerPaths.rowHeaderPaths.push(rowHeaderPath);
66012
66111
  }
66013
66112
  });
@@ -66304,8 +66403,8 @@
66304
66403
  }
66305
66404
  else if (this.isRowHeader(source.col, source.row)) {
66306
66405
  if (this.rowHierarchyType === 'tree') {
66307
- const sourceRowHeaderPaths = cloneDeep(this.getCellHeaderPathsWidthTreeNode(source.col, source.row).rowHeaderPaths);
66308
- const targetRowHeaderPaths = cloneDeep(this.getCellHeaderPathsWidthTreeNode(target.col, target.row).rowHeaderPaths);
66406
+ const sourceRowHeaderPaths = cloneDeep(this.getCellHeaderPathsWithTreeNode(source.col, source.row).rowHeaderPaths);
66407
+ const targetRowHeaderPaths = cloneDeep(this.getCellHeaderPathsWithTreeNode(target.col, target.row).rowHeaderPaths);
66309
66408
  sourceRowHeaderPaths.pop();
66310
66409
  targetRowHeaderPaths.pop();
66311
66410
  if (sourceRowHeaderPaths.length <= targetRowHeaderPaths.length) {
@@ -66356,7 +66455,7 @@
66356
66455
  const sourceColumns = this._columnWidths.splice(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceSize);
66357
66456
  sourceColumns.unshift((targetIndex - this.leftRowSeriesNumberColumnCount), 0);
66358
66457
  Array.prototype.splice.apply(this._columnWidths, sourceColumns);
66359
- this.columnDimensionTree.movePosition(this.getCellHeaderPathsWidthTreeNode(source.col, source.row).colHeaderPaths.length - 1, sourceCellRange.start.col - this.rowHeaderLevelCount - this.leftRowSeriesNumberColumnCount, targetCellRange.start.col - this.rowHeaderLevelCount - this.leftRowSeriesNumberColumnCount);
66458
+ this.columnDimensionTree.movePosition(this.getCellHeaderPathsWithTreeNode(source.col, source.row).colHeaderPaths.length - 1, sourceCellRange.start.col - this.rowHeaderLevelCount - this.leftRowSeriesNumberColumnCount, targetCellRange.start.col - this.rowHeaderLevelCount - this.leftRowSeriesNumberColumnCount);
66360
66459
  this.columnDimensionTree.reset(this.columnDimensionTree.tree.children, true);
66361
66460
  this._CellHeaderPathMap = new Map();
66362
66461
  this._largeCellRangeCache.length = 0;
@@ -66370,8 +66469,8 @@
66370
66469
  }
66371
66470
  else if (this.isRowHeader(source.col, source.row)) {
66372
66471
  let targetIndex;
66373
- const sourceRowHeaderPaths = this.getCellHeaderPathsWidthTreeNode(source.col, source.row).rowHeaderPaths;
66374
- const targetRowHeaderPaths = this.getCellHeaderPathsWidthTreeNode(target.col, target.row).rowHeaderPaths;
66472
+ const sourceRowHeaderPaths = this.getCellHeaderPathsWithTreeNode(source.col, source.row).rowHeaderPaths;
66473
+ const targetRowHeaderPaths = this.getCellHeaderPathsWithTreeNode(target.col, target.row).rowHeaderPaths;
66375
66474
  const sourceRowHeaderNode = sourceRowHeaderPaths[sourceRowHeaderPaths.length - 1];
66376
66475
  const targetRowHeaderNode = targetRowHeaderPaths[sourceRowHeaderPaths.length - 1];
66377
66476
  const sourceSize = sourceRowHeaderNode.size;
@@ -66615,7 +66714,7 @@
66615
66714
  if (!this._table.isPivotChart()) {
66616
66715
  return false;
66617
66716
  }
66618
- if (this.indicatorKeys.length >= 1 && checkHasCartesianChart(this)) {
66717
+ if (this.indicatorKeys.length >= 1 && checkHasCartesianChart(this.indicatorsDefine)) {
66619
66718
  if ((this.isBottomFrozenRow(col, row) && isHasCartesianChartInline(col, row, 'col', this)) ||
66620
66719
  (this.isRightFrozenColumn(col, row) && isHasCartesianChartInline(col, row, 'row', this))) {
66621
66720
  return true;
@@ -66681,7 +66780,18 @@
66681
66780
  indicatorObject.chartInstance?.release();
66682
66781
  });
66683
66782
  }
66684
- getHeadNode(dimensions) {
66783
+ getHeadNode(col, row) {
66784
+ let dimensions;
66785
+ const headerPaths = this.getCellHeaderPaths(col, row);
66786
+ if (headerPaths.rowHeaderPaths && (headerPaths.rowHeaderPaths?.length ?? 0) > 0) {
66787
+ dimensions = headerPaths.rowHeaderPaths?.slice(0, headerPaths.rowHeaderPaths.length);
66788
+ }
66789
+ else if (headerPaths.colHeaderPaths && headerPaths.colHeaderPaths.length > 0) {
66790
+ dimensions = headerPaths.colHeaderPaths.slice(0, headerPaths.colHeaderPaths.length);
66791
+ }
66792
+ return this.getHeadNodeByRowOrColDimensions(dimensions, col, row);
66793
+ }
66794
+ getHeadNodeByRowOrColDimensions(dimensions, col, row) {
66685
66795
  if (!Array.isArray(dimensions)) {
66686
66796
  return undefined;
66687
66797
  }
@@ -66689,6 +66799,14 @@
66689
66799
  let rowDimension;
66690
66800
  let colArr = this.columnTree;
66691
66801
  let colDimension;
66802
+ if (isValid$3(row) &&
66803
+ isValid$3(col) &&
66804
+ this.rowHierarchyType === 'tree' &&
66805
+ this.extensionRows &&
66806
+ col >= 1 + this.leftRowSeriesNumberColumnCount) {
66807
+ const hdId = this.getCellId(col - 1, row);
66808
+ rowArr = this._rowHeaderExtensionTree[hdId].tree.children;
66809
+ }
66692
66810
  for (let i = 0; i < dimensions.length; i++) {
66693
66811
  const highlightDimension = dimensions[i];
66694
66812
  if ((highlightDimension.isPivotCorner || !highlightDimension.value) &&
@@ -66715,7 +66833,7 @@
66715
66833
  if (isCol) {
66716
66834
  continue;
66717
66835
  }
66718
- for (let k = 0; k < rowArr.length; k++) {
66836
+ for (let k = 0; k < rowArr?.length ?? 0; k++) {
66719
66837
  const dimension = rowArr[k];
66720
66838
  if ((isValid$3(highlightDimension.dimensionKey) &&
66721
66839
  dimension.dimensionKey === highlightDimension.dimensionKey &&
@@ -67123,15 +67241,8 @@
67123
67241
  return undefined;
67124
67242
  }
67125
67243
  changeTreeNodeTitle(col, row, value) {
67126
- const headerPaths = this.getCellHeaderPaths(col, row);
67127
- if (headerPaths.rowHeaderPaths.length > 0) {
67128
- const headerTreeNode = this.getHeadNode(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length));
67129
- headerTreeNode.value = value;
67130
- }
67131
- else if (headerPaths.colHeaderPaths.length > 0) {
67132
- const headerTreeNode = this.getHeadNode(headerPaths.colHeaderPaths.slice(0, headerPaths.colHeaderPaths.length));
67133
- headerTreeNode.value = value;
67134
- }
67244
+ const headerTreeNode = this.getHeadNode(col, row);
67245
+ headerTreeNode.value = value;
67135
67246
  const id = this.getCellId(col, row);
67136
67247
  this._headerObjectMap[id].title = value;
67137
67248
  }
@@ -67454,15 +67565,15 @@
67454
67565
  this.needSplitPositiveAndNegative = needSplitPositiveAndNegative ?? false;
67455
67566
  this.rowsIsTotal = new Array(this.rows?.length ?? 0).fill(false);
67456
67567
  this.colsIsTotal = new Array(this.columns?.length ?? 0).fill(false);
67457
- if (this.totals?.row && this.totals.row.showSubTotals !== false) {
67458
- for (let i = 0, len = this.totals?.row?.subTotalsDimensions?.length; i < len; i++) {
67568
+ if (this.totals?.row && this.totals.row.showSubTotals !== false && this.totals.row.subTotalsDimensions) {
67569
+ for (let i = 0, len = this.totals?.row?.subTotalsDimensions?.length ?? 0; i < len; i++) {
67459
67570
  const dimension = this.totals.row.subTotalsDimensions[i];
67460
67571
  const dimensionIndex = this.rows.indexOf(dimension);
67461
67572
  this.rowsIsTotal[dimensionIndex] = true;
67462
67573
  }
67463
67574
  }
67464
- if (this.totals?.column && this.totals.column.showSubTotals !== false) {
67465
- for (let i = 0, len = this.totals?.column?.subTotalsDimensions?.length; i < len; i++) {
67575
+ if (this.totals?.column && this.totals.column.showSubTotals !== false && this.totals.column.subTotalsDimensions) {
67576
+ for (let i = 0, len = this.totals?.column?.subTotalsDimensions?.length ?? 0; i < len; i++) {
67466
67577
  const dimension = this.totals.column.subTotalsDimensions[i];
67467
67578
  const dimensionIndex = this.columns.indexOf(dimension);
67468
67579
  this.colsIsTotal[dimensionIndex] = true;
@@ -67540,7 +67651,7 @@
67540
67651
  }
67541
67652
  processCollectedValuesWithSumBy() {
67542
67653
  for (const field in this.collectedValues) {
67543
- if (this.collectValuesBy[field]?.sumBy) {
67654
+ if (this.collectValuesBy?.[field]?.sumBy) {
67544
67655
  for (const byKeys in this.collectedValues[field]) {
67545
67656
  let max;
67546
67657
  if (this.collectValuesBy[field]?.extendRange === 'sum') {
@@ -67585,17 +67696,19 @@
67585
67696
  }
67586
67697
  }
67587
67698
  processCollectedValuesWithSortBy() {
67699
+ const that = this;
67588
67700
  for (const field in this.collectedValues) {
67589
- if (this.collectValuesBy[field]?.sortBy) {
67701
+ if (this.collectValuesBy?.[field]?.sortBy) {
67590
67702
  for (const byKeys in this.collectedValues[field]) {
67591
- this.collectedValues[field][byKeys] = this.collectedValues[field][byKeys].sort((a, b) => this.collectValuesBy[field]?.sortBy.indexOf(a) - this.collectValuesBy[field]?.sortBy.indexOf(b));
67703
+ this.collectedValues[field][byKeys] = this.collectedValues[field][byKeys].sort((a, b) => (that.collectValuesBy[field].sortBy?.indexOf(a) ?? -1) -
67704
+ (that.collectValuesBy[field].sortBy?.indexOf(b) ?? -1));
67592
67705
  }
67593
67706
  }
67594
67707
  }
67595
67708
  }
67596
67709
  generateCollectedValuesSortRule() {
67597
67710
  for (const field in this.collectedValues) {
67598
- if (this.collectValuesBy[field] && !this.collectValuesBy[field].sortBy) {
67711
+ if (this.collectValuesBy && this.collectValuesBy[field] && !this.collectValuesBy[field].sortBy) {
67599
67712
  let sortByRule = [];
67600
67713
  for (const byKeys in this.collectedValues[field]) {
67601
67714
  if (Array.isArray(this.collectedValues[field][byKeys])) {
@@ -67611,7 +67724,7 @@
67611
67724
  }
67612
67725
  processRecords() {
67613
67726
  let isNeedFilter = false;
67614
- if (this.dataConfig?.filterRules?.length >= 1) {
67727
+ if ((this.dataConfig?.filterRules?.length ?? 0) >= 1) {
67615
67728
  isNeedFilter = true;
67616
67729
  }
67617
67730
  if (Array.isArray(this.records)) {
@@ -67637,25 +67750,29 @@
67637
67750
  }
67638
67751
  filterRecord(record) {
67639
67752
  let isReserved = true;
67640
- for (let i = 0; i < this.dataConfig.filterRules.length; i++) {
67641
- const filterRule = this.dataConfig?.filterRules[i];
67642
- if (filterRule.filterKey) {
67643
- const filterValue = record[filterRule.filterKey];
67644
- if (filterRule.filteredValues.indexOf(filterValue) === -1) {
67753
+ if (this.dataConfig?.filterRules) {
67754
+ for (let i = 0; i < this.dataConfig.filterRules.length; i++) {
67755
+ const filterRule = this.dataConfig?.filterRules[i];
67756
+ if (filterRule.filterKey) {
67757
+ const filterValue = record[filterRule.filterKey];
67758
+ if (filterRule.filteredValues?.indexOf(filterValue) === -1) {
67759
+ isReserved = false;
67760
+ break;
67761
+ }
67762
+ }
67763
+ else if (!filterRule.filterFunc?.(record)) {
67645
67764
  isReserved = false;
67646
67765
  break;
67647
67766
  }
67648
67767
  }
67649
- else if (!filterRule.filterFunc?.(record)) {
67650
- isReserved = false;
67651
- break;
67652
- }
67653
67768
  }
67654
67769
  return isReserved;
67655
67770
  }
67656
67771
  processRecord(record, assignedIndicatorKey) {
67657
67772
  this.derivedFieldRules?.forEach((derivedFieldRule, i) => {
67658
- record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record);
67773
+ if (derivedFieldRule.fieldName && derivedFieldRule.derivedFunc) {
67774
+ record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record);
67775
+ }
67659
67776
  });
67660
67777
  for (const field in this.collectValuesBy) {
67661
67778
  if (isValid$3(record[field])) {
@@ -67678,7 +67795,9 @@
67678
67795
  }
67679
67796
  }
67680
67797
  if (this.collectValuesBy[field].sumBy) {
67681
- const sumByKeys = this.collectValuesBy[field].sumBy.map(byField => record[byField]).join(this.stringJoinChar);
67798
+ const sumByKeys = this.collectValuesBy[field]
67799
+ .sumBy.map(byField => record[byField])
67800
+ .join(this.stringJoinChar);
67682
67801
  if (!this.collectedValues[field][collectKeys][sumByKeys]) {
67683
67802
  this.collectedValues[field][collectKeys][sumByKeys] = new this.aggregators[AggregationType.SUM](field, undefined, undefined, this.needSplitPositiveAndNegative);
67684
67803
  }
@@ -67709,7 +67828,7 @@
67709
67828
  if (rowAttr in record) {
67710
67829
  rowKey.push(record[rowAttr]);
67711
67830
  }
67712
- else {
67831
+ else if (rowAttr !== IndicatorDimensionKeyPlaceholder) {
67713
67832
  if (this.dataConfig?.totals?.row?.showGrandTotals &&
67714
67833
  l === 0 &&
67715
67834
  !this.rows.find((rk) => {
@@ -67719,7 +67838,8 @@
67719
67838
  isToTalRecord = true;
67720
67839
  break;
67721
67840
  }
67722
- else if (this.dataConfig?.totals?.row?.subTotalsDimensions.indexOf(this.rows[l - 1]) >= 0) {
67841
+ else if (this.dataConfig?.totals?.row?.subTotalsDimensions &&
67842
+ this.dataConfig?.totals?.row?.subTotalsDimensions.indexOf(this.rows[l - 1]) >= 0) {
67723
67843
  if (this.rowHierarchyType === 'grid') {
67724
67844
  rowKey.push(this.rowSubTotalLabel);
67725
67845
  }
@@ -67733,7 +67853,7 @@
67733
67853
  if (colAttr in record) {
67734
67854
  colKey.push(record[colAttr]);
67735
67855
  }
67736
- else {
67856
+ else if (colAttr !== IndicatorDimensionKeyPlaceholder) {
67737
67857
  if (this.dataConfig?.totals?.column?.showGrandTotals &&
67738
67858
  n === 0 &&
67739
67859
  !this.columns.find((ck) => {
@@ -67743,7 +67863,8 @@
67743
67863
  isToTalRecord = true;
67744
67864
  break;
67745
67865
  }
67746
- else if (this.dataConfig?.totals?.column?.subTotalsDimensions.indexOf(this.columns[n - 1]) >= 0) {
67866
+ else if (this.dataConfig?.totals?.column?.subTotalsDimensions &&
67867
+ this.dataConfig?.totals?.column?.subTotalsDimensions.indexOf(this.columns[n - 1]) >= 0) {
67747
67868
  colKey.push(this.colSubTotalLabel);
67748
67869
  isToTalRecord = true;
67749
67870
  break;
@@ -67795,31 +67916,35 @@
67795
67916
  }
67796
67917
  for (let i = 0; i < this.indicatorKeys.length; i++) {
67797
67918
  const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
67798
- if (!this.tree[flatRowKey]?.[flatColKey]?.[i]) {
67799
- this.tree[flatRowKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
67800
- this.indicators?.find((indicator) => {
67801
- if (typeof indicator !== 'string') {
67802
- return indicator.indicatorKey === this.indicatorKeys[i];
67803
- }
67804
- return false;
67805
- })?.format);
67806
- }
67919
+ let needAddToAggregator = false;
67807
67920
  if (assignedIndicatorKey) {
67808
- this.indicatorKeys[i] === assignedIndicatorKey && this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
67921
+ this.indicatorKeys[i] === assignedIndicatorKey && (needAddToAggregator = true);
67809
67922
  }
67810
67923
  else if (aggRule?.field) {
67811
67924
  if (typeof aggRule?.field === 'string') {
67812
- aggRule?.field in record && this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
67925
+ aggRule?.field in record && (needAddToAggregator = true);
67813
67926
  }
67814
67927
  else {
67815
67928
  const isPush = aggRule?.field.find((field) => {
67816
67929
  return field in record;
67817
67930
  });
67818
- isPush && this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
67931
+ isPush && (needAddToAggregator = true);
67819
67932
  }
67820
67933
  }
67821
67934
  else {
67822
- this.indicatorKeys[i] in record && this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
67935
+ this.indicatorKeys[i] in record && (needAddToAggregator = true);
67936
+ }
67937
+ if (!this.tree[flatRowKey]?.[flatColKey]?.[i] && needAddToAggregator) {
67938
+ this.tree[flatRowKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
67939
+ this.indicators?.find((indicator) => {
67940
+ if (typeof indicator !== 'string') {
67941
+ return indicator.indicatorKey === this.indicatorKeys[i];
67942
+ }
67943
+ return false;
67944
+ })?.format);
67945
+ }
67946
+ if (needAddToAggregator) {
67947
+ this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
67823
67948
  }
67824
67949
  }
67825
67950
  }
@@ -67898,12 +68023,22 @@
67898
68023
  flatRowKey = rowKey;
67899
68024
  }
67900
68025
  else {
68026
+ rowKey.map((key, i) => {
68027
+ if (key === indicator) {
68028
+ rowKey.splice(i, 1);
68029
+ }
68030
+ });
67901
68031
  flatRowKey = rowKey.join(this.stringJoinChar);
67902
68032
  }
67903
68033
  if (typeof colKey === 'string') {
67904
68034
  flatColKey = colKey;
67905
68035
  }
67906
68036
  else {
68037
+ colKey.map((key, i) => {
68038
+ if (key === indicator) {
68039
+ colKey.splice(i, 1);
68040
+ }
68041
+ });
67907
68042
  flatColKey = colKey.join(this.stringJoinChar);
67908
68043
  }
67909
68044
  const agg = this.tree[flatRowKey]?.[flatColKey]?.[indicatorIndex];
@@ -67957,9 +68092,6 @@
67957
68092
  value() {
67958
68093
  return null;
67959
68094
  },
67960
- formatValue() {
67961
- return '';
67962
- },
67963
68095
  clearCacheValue() {
67964
68096
  },
67965
68097
  reset() {
@@ -68088,8 +68220,8 @@
68088
68220
  }
68089
68221
  totalStatistics() {
68090
68222
  const that = this;
68091
- if (that?.totals?.column?.subTotalsDimensions?.length >= 1 ||
68092
- that?.totals?.row?.subTotalsDimensions?.length >= 1 ||
68223
+ if ((that?.totals?.column?.subTotalsDimensions && that?.totals?.column?.subTotalsDimensions?.length >= 1) ||
68224
+ (that?.totals?.row?.subTotalsDimensions && that?.totals?.row?.subTotalsDimensions?.length >= 1) ||
68093
68225
  that?.totals?.column?.showGrandTotals ||
68094
68226
  that?.totals?.row?.showGrandTotals) {
68095
68227
  const rowTotalKeys = [];
@@ -68099,32 +68231,34 @@
68099
68231
  return;
68100
68232
  }
68101
68233
  const colKey = flatColKey.split(this.stringJoinChar);
68102
- for (let i = 0, len = that.totals?.column?.subTotalsDimensions?.length; i < len; i++) {
68103
- const dimension = that.totals.column.subTotalsDimensions[i];
68104
- const dimensionIndex = that.columns.indexOf(dimension);
68105
- if (dimensionIndex >= 0) {
68106
- const colTotalKey = colKey.slice(0, dimensionIndex + 1);
68107
- colTotalKey.push(that.colSubTotalLabel);
68108
- const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
68109
- if (this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey]) {
68110
- this.tree[flatRowKey][flatColTotalKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey];
68111
- return;
68112
- }
68113
- if (!this.tree[flatRowKey][flatColTotalKey]) {
68114
- this.tree[flatRowKey][flatColTotalKey] = [];
68115
- }
68116
- for (let i = 0; i < this.indicatorKeys.length; i++) {
68117
- if (!this.tree[flatRowKey][flatColTotalKey][i]) {
68118
- const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
68119
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
68120
- this.indicators?.find((indicator) => {
68121
- if (typeof indicator !== 'string') {
68122
- return indicator.indicatorKey === this.indicatorKeys[i];
68123
- }
68124
- return false;
68125
- })?.format);
68234
+ if (that.totals?.column?.subTotalsDimensions) {
68235
+ for (let i = 0, len = that.totals?.column?.subTotalsDimensions?.length; i < len; i++) {
68236
+ const dimension = that.totals.column.subTotalsDimensions[i];
68237
+ const dimensionIndex = that.columns.indexOf(dimension);
68238
+ if (dimensionIndex >= 0) {
68239
+ const colTotalKey = colKey.slice(0, dimensionIndex + 1);
68240
+ colTotalKey.push(that.colSubTotalLabel);
68241
+ const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
68242
+ if (this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey]) {
68243
+ this.tree[flatRowKey][flatColTotalKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey];
68244
+ return;
68245
+ }
68246
+ if (!this.tree[flatRowKey][flatColTotalKey]) {
68247
+ this.tree[flatRowKey][flatColTotalKey] = [];
68248
+ }
68249
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
68250
+ if (!this.tree[flatRowKey][flatColTotalKey][i]) {
68251
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
68252
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
68253
+ this.indicators?.find((indicator) => {
68254
+ if (typeof indicator !== 'string') {
68255
+ return indicator.indicatorKey === this.indicatorKeys[i];
68256
+ }
68257
+ return false;
68258
+ })?.format);
68259
+ }
68260
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
68126
68261
  }
68127
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
68128
68262
  }
68129
68263
  }
68130
68264
  }
@@ -68155,34 +68289,36 @@
68155
68289
  Object.keys(that.tree).forEach(flatRowKey => {
68156
68290
  const rowKey = flatRowKey.split(this.stringJoinChar);
68157
68291
  Object.keys(that.tree[flatRowKey]).forEach(flatColKey => {
68158
- for (let i = 0, len = that.totals?.row?.subTotalsDimensions?.length; i < len; i++) {
68159
- const dimension = that.totals.row.subTotalsDimensions[i];
68160
- const dimensionIndex = that.rows.indexOf(dimension);
68161
- if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
68162
- const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
68163
- if (this.rowHierarchyType === 'grid') {
68164
- rowTotalKey.push(that.rowSubTotalLabel);
68165
- }
68166
- const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
68167
- if (!this.tree[flatRowTotalKey]) {
68168
- this.tree[flatRowTotalKey] = {};
68169
- rowTotalKeys.push(flatRowTotalKey);
68170
- }
68171
- if (!this.tree[flatRowTotalKey][flatColKey]) {
68172
- this.tree[flatRowTotalKey][flatColKey] = [];
68173
- }
68174
- for (let i = 0; i < this.indicatorKeys.length; i++) {
68175
- if (!this.tree[flatRowTotalKey][flatColKey][i]) {
68176
- const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
68177
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
68178
- this.indicators?.find((indicator) => {
68179
- if (typeof indicator !== 'string') {
68180
- return indicator.indicatorKey === this.indicatorKeys[i];
68181
- }
68182
- return false;
68183
- })?.format);
68292
+ if (that.totals?.row?.subTotalsDimensions) {
68293
+ for (let i = 0, len = that.totals?.row?.subTotalsDimensions?.length; i < len; i++) {
68294
+ const dimension = that.totals.row.subTotalsDimensions[i];
68295
+ const dimensionIndex = that.rows.indexOf(dimension);
68296
+ if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
68297
+ const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
68298
+ if (this.rowHierarchyType === 'grid') {
68299
+ rowTotalKey.push(that.rowSubTotalLabel);
68300
+ }
68301
+ const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
68302
+ if (!this.tree[flatRowTotalKey]) {
68303
+ this.tree[flatRowTotalKey] = {};
68304
+ rowTotalKeys.push(flatRowTotalKey);
68305
+ }
68306
+ if (!this.tree[flatRowTotalKey][flatColKey]) {
68307
+ this.tree[flatRowTotalKey][flatColKey] = [];
68308
+ }
68309
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
68310
+ if (!this.tree[flatRowTotalKey][flatColKey][i]) {
68311
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
68312
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
68313
+ this.indicators?.find((indicator) => {
68314
+ if (typeof indicator !== 'string') {
68315
+ return indicator.indicatorKey === this.indicatorKeys[i];
68316
+ }
68317
+ return false;
68318
+ })?.format);
68319
+ }
68320
+ this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
68184
68321
  }
68185
- this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
68186
68322
  }
68187
68323
  }
68188
68324
  }
@@ -68234,7 +68370,7 @@
68234
68370
  item = {
68235
68371
  value,
68236
68372
  dimensionKey: rows[index],
68237
- children: index === list.length - 1 && indicators?.length >= 1
68373
+ children: index === list.length - 1 && (indicators?.length ?? 0) >= 1
68238
68374
  ? indicators?.map(indicator => {
68239
68375
  if (typeof indicator === 'string') {
68240
68376
  return {
@@ -68281,7 +68417,7 @@
68281
68417
  item = {
68282
68418
  value,
68283
68419
  dimensionKey: rows[index],
68284
- children: index === list.length - 1 && indicators?.length >= 1
68420
+ children: index === list.length - 1 && (indicators?.length ?? 0) >= 1
68285
68421
  ? indicators?.map(indicator => {
68286
68422
  if (typeof indicator === 'string') {
68287
68423
  return {
@@ -68297,12 +68433,12 @@
68297
68433
  : []
68298
68434
  };
68299
68435
  if (subTotalFlags[index]) {
68300
- let curChild = item.children;
68436
+ let curChild = item.children ?? [];
68301
68437
  const totalChild = {
68302
68438
  value: subTotalLabel,
68303
68439
  dimensionKey: rows[index + 1],
68304
68440
  levelSpan: subTotalFlags.length - index - 1,
68305
- children: indicators?.length >= 1
68441
+ children: (indicators?.length ?? 0) >= 1
68306
68442
  ? indicators?.map(indicator => {
68307
68443
  if (typeof indicator === 'string') {
68308
68444
  return {
@@ -68318,7 +68454,7 @@
68318
68454
  : []
68319
68455
  };
68320
68456
  curChild.push(totalChild);
68321
- curChild = totalChild.children;
68457
+ curChild = totalChild.children ?? [];
68322
68458
  }
68323
68459
  map.set(flatKey, item);
68324
68460
  if (node) {
@@ -68341,6 +68477,9 @@
68341
68477
  }
68342
68478
  else if (indicators) {
68343
68479
  result = indicators?.map((indicator) => {
68480
+ if (typeof indicator === 'string') {
68481
+ return { indicatorKey: indicator, value: indicator };
68482
+ }
68344
68483
  return { indicatorKey: indicator.indicatorKey, value: indicator.title ?? indicator.indicatorKey };
68345
68484
  });
68346
68485
  }
@@ -68404,6 +68543,9 @@
68404
68543
  !isHasIndicator &&
68405
68544
  (!node.children?.length || !node.children)) {
68406
68545
  node.children = this.indicators?.map((indicator) => {
68546
+ if (typeof indicator === 'string') {
68547
+ return { indicatorKey: indicator, value: indicator };
68548
+ }
68407
68549
  return { indicatorKey: indicator.indicatorKey, value: indicator.title ?? indicator.indicatorKey };
68408
68550
  });
68409
68551
  }
@@ -68417,6 +68559,9 @@
68417
68559
  }
68418
68560
  else {
68419
68561
  customTree = this.indicators?.map((indicator) => {
68562
+ if (typeof indicator === 'string') {
68563
+ return { indicatorKey: indicator, value: indicator };
68564
+ }
68420
68565
  return { indicatorKey: indicator.indicatorKey, value: indicator.title ?? indicator.indicatorKey };
68421
68566
  });
68422
68567
  }
@@ -68483,6 +68628,19 @@
68483
68628
  this.processRecords();
68484
68629
  }
68485
68630
  }
68631
+ changeDataConfig(dataConfig) {
68632
+ this.rows = dataConfig.rows;
68633
+ this.columns = dataConfig.columns;
68634
+ }
68635
+ addRecords(records) {
68636
+ for (let i = 0, len = records.length; i < len; i++) {
68637
+ const record = records[i];
68638
+ this.processRecord(record);
68639
+ }
68640
+ if (Array.isArray(this.records)) {
68641
+ this.records.push(records);
68642
+ }
68643
+ }
68486
68644
  }
68487
68645
  function arraySortByAnotherArray(array, sortArray) {
68488
68646
  return array.sort((a, b) => {
@@ -68499,6 +68657,7 @@
68499
68657
  }
68500
68658
 
68501
68659
  class PivotTable extends BaseTable {
68660
+ layoutNodeId = { seqId: 0 };
68502
68661
  pivotSortState;
68503
68662
  editorManager;
68504
68663
  dataset;
@@ -68518,96 +68677,77 @@
68518
68677
  }
68519
68678
  }
68520
68679
  super(container, options);
68521
- if (options.layout) {
68522
- Object.assign(options, options.layout);
68523
- }
68524
- this.internalProps.columns = cloneDeep(options.columns);
68525
- this.internalProps.rows = cloneDeep(options.rows);
68526
- this.internalProps.indicators = cloneDeepSpec(options.indicators);
68527
- options.indicators?.forEach((indicatorDefine, index) => {
68528
- if (typeof indicatorDefine === 'object' && indicatorDefine?.editor) {
68529
- this.internalProps.indicators[index].editor = indicatorDefine.editor;
68680
+ if (options) {
68681
+ if (options.layout) {
68682
+ Object.assign(options, options.layout);
68530
68683
  }
68531
- });
68532
- this.internalProps.columnTree =
68533
- options.indicatorsAsCol && !options.columns?.length && !options.columnTree ? [] : cloneDeep(options.columnTree);
68534
- this.internalProps.rowTree =
68535
- !options.indicatorsAsCol && !options.rows?.length && !options.rowTree ? [] : cloneDeep(options.rowTree);
68536
- this.internalProps.records = options.records;
68537
- this.pagination = options.pagination;
68538
- this.internalProps.columnResizeType = options.columnResizeType ?? 'column';
68539
- this.internalProps.rowResizeType = options.rowResizeType ?? 'row';
68540
- this.internalProps.dataConfig = cloneDeep(options.dataConfig);
68541
- if (!options.rowTree && !options.columnTree) {
68542
- this.internalProps.enableDataAnalysis = true;
68543
- }
68544
- else {
68545
- this.internalProps.enableDataAnalysis = false;
68546
- }
68547
- const records = this.internalProps.records;
68548
- if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {
68549
- const rowKeys = options.rows?.reduce((keys, rowObj) => {
68550
- if (typeof rowObj === 'string') {
68551
- keys.push(rowObj);
68552
- }
68553
- else {
68554
- keys.push(rowObj.dimensionKey);
68684
+ this.internalProps.columns = cloneDeep(options.columns);
68685
+ this.internalProps.rows = cloneDeep(options.rows);
68686
+ this.internalProps.indicators = cloneDeepSpec(options.indicators);
68687
+ options.indicators?.forEach((indicatorDefine, index) => {
68688
+ if (typeof indicatorDefine === 'object' && indicatorDefine?.editor) {
68689
+ this.internalProps.indicators[index].editor = indicatorDefine.editor;
68555
68690
  }
68556
- return keys;
68557
- }, []) ?? [];
68558
- const columnKeys = options.columns?.reduce((keys, columnObj) => {
68559
- if (typeof columnObj === 'string') {
68560
- keys.push(columnObj);
68561
- }
68562
- else {
68563
- keys.push(columnObj.dimensionKey);
68691
+ });
68692
+ this.internalProps.columnTree =
68693
+ options.indicatorsAsCol && !options.columns?.length && !options.columnTree ? [] : cloneDeep(options.columnTree);
68694
+ this.internalProps.rowTree =
68695
+ !options.indicatorsAsCol && !options.rows?.length && !options.rowTree ? [] : cloneDeep(options.rowTree);
68696
+ this.internalProps.records = options.records;
68697
+ this.pagination = options.pagination;
68698
+ this.internalProps.columnResizeType = options.columnResizeType ?? 'column';
68699
+ this.internalProps.rowResizeType = options.rowResizeType ?? 'row';
68700
+ this.internalProps.dataConfig = cloneDeep(options.dataConfig);
68701
+ const records = this.internalProps.records;
68702
+ this.internalProps.recordsIsTwoDimensionalArray = false;
68703
+ if (records?.[0]?.constructor === Array) {
68704
+ this.internalProps.recordsIsTwoDimensionalArray = true;
68705
+ }
68706
+ if (options.customConfig?.enableDataAnalysis === false) {
68707
+ const columnDimensionTree = new DimensionTree(this.internalProps.columnTree ?? [], this.layoutNodeId);
68708
+ const rowDimensionTree = new DimensionTree(this.internalProps.rowTree ?? [], this.layoutNodeId, this.options.rowHierarchyType, this.options.rowHierarchyType === 'tree' ? this.options.rowExpandLevel ?? 1 : undefined);
68709
+ this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, null, columnDimensionTree, rowDimensionTree);
68710
+ if (this.internalProps.recordsIsTwoDimensionalArray === false) {
68711
+ this.flatDataToObjects = new FlatDataToObjects({
68712
+ rows: this.internalProps.layoutMap.fullRowDimensionKeys,
68713
+ columns: this.internalProps.layoutMap.colDimensionKeys,
68714
+ indicators: this.internalProps.layoutMap.indicatorKeys,
68715
+ indicatorsAsCol: this.internalProps.layoutMap.indicatorsAsCol,
68716
+ indicatorDimensionKey: this.internalProps.layoutMap.indicatorDimensionKey
68717
+ }, records);
68564
68718
  }
68565
- return keys;
68566
- }, []) ?? [];
68567
- const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
68568
- if (typeof indicatorObj === 'string') {
68569
- keys.push(indicatorObj);
68719
+ }
68720
+ else {
68721
+ const keysResults = parseColKeyRowKeyForPivotTable(this, options);
68722
+ const { rowKeys, columnKeys, indicatorKeys, isNeedResetColumnDimensionTree, isNeedResetRowDimensionTree } = keysResults;
68723
+ let { columnDimensionTree, rowDimensionTree } = keysResults;
68724
+ 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);
68725
+ if (!options.columnTree || isNeedResetColumnDimensionTree) {
68726
+ columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
68570
68727
  }
68571
- else {
68572
- keys.push(indicatorObj.indicatorKey);
68728
+ if (!options.rowTree || isNeedResetRowDimensionTree) {
68729
+ rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId, this.options.rowHierarchyType, this.options.rowHierarchyType === 'tree' ? this.options.rowExpandLevel ?? 1 : undefined);
68573
68730
  }
68574
- return keys;
68575
- }, []) ?? [];
68576
- 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);
68577
- this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
68578
- }
68579
- else if (Array.isArray(this.internalProps.columnTree) || Array.isArray(this.internalProps.rowTree)) {
68580
- this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, null);
68581
- if (records?.[0]?.constructor !== Array) {
68582
- this.flatDataToObjects = new FlatDataToObjects({
68583
- rows: this.internalProps.layoutMap.fullRowDimensionKeys,
68584
- columns: this.internalProps.layoutMap.colDimensionKeys,
68585
- indicators: this.internalProps.layoutMap.indicatorKeys,
68586
- indicatorsAsCol: this.internalProps.layoutMap.indicatorsAsCol,
68587
- indicatorDimensionKey: this.internalProps.layoutMap.indicatorDimensionKey
68588
- }, records);
68731
+ this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
68589
68732
  }
68733
+ this.pivotSortState = [];
68734
+ if (options.pivotSortState) {
68735
+ this.updatePivotSortState(options.pivotSortState);
68736
+ }
68737
+ if (Env.mode !== 'node') {
68738
+ this.editorManager = new EditManeger(this);
68739
+ }
68740
+ this.refreshHeader();
68741
+ this.stateManager.initCheckedState(records);
68742
+ this.scenegraph.createSceneGraph();
68743
+ if (options.title) {
68744
+ this.internalProps.title = new Title(options.title, this);
68745
+ this.scenegraph.resize();
68746
+ }
68747
+ setTimeout(() => {
68748
+ this.fireListeners(TABLE_EVENT_TYPE.INITIALIZED, null);
68749
+ }, 0);
68590
68750
  }
68591
- else {
68592
- return;
68593
- }
68594
- this.pivotSortState = [];
68595
- if (options.pivotSortState) {
68596
- this.updatePivotSortState(options.pivotSortState);
68597
- }
68598
- if (Env.mode !== 'node') {
68599
- this.editorManager = new EditManeger(this);
68600
- }
68601
- this.refreshHeader();
68602
- this.stateManager.initCheckedState(records);
68603
- this.scenegraph.createSceneGraph();
68604
- if (options.title) {
68605
- this.internalProps.title = new Title(options.title, this);
68606
- this.scenegraph.resize();
68607
- }
68608
- setTimeout(() => {
68609
- this.fireListeners(TABLE_EVENT_TYPE.INITIALIZED, null);
68610
- }, 0);
68611
68751
  }
68612
68752
  static get EVENT_TYPE() {
68613
68753
  return PIVOT_TABLE_EVENT_TYPE;
@@ -68639,6 +68779,7 @@
68639
68779
  updateOption(options) {
68640
68780
  const internalProps = this.internalProps;
68641
68781
  super.updateOption(options);
68782
+ this.layoutNodeId = { seqId: 0 };
68642
68783
  this.internalProps.columns = cloneDeep(options.columns);
68643
68784
  this.internalProps.rows = cloneDeep(options.rows);
68644
68785
  this.internalProps.indicators = !options.indicators?.length ? [] : cloneDeepSpec(options.indicators);
@@ -68658,12 +68799,6 @@
68658
68799
  internalProps.columnResizeType = options.columnResizeType ?? 'column';
68659
68800
  internalProps.rowResizeType = options.rowResizeType ?? 'row';
68660
68801
  internalProps.dataConfig = cloneDeep(options.dataConfig);
68661
- if (!options.rowTree && !options.columnTree) {
68662
- internalProps.enableDataAnalysis = true;
68663
- }
68664
- else {
68665
- internalProps.enableDataAnalysis = false;
68666
- }
68667
68802
  if (options?.rowHierarchyType === 'tree' &&
68668
68803
  this.internalProps.layoutMap.rowHierarchyType === 'tree' &&
68669
68804
  this.internalProps.layoutMap.rowExpandLevel === options?.rowExpandLevel) {
@@ -68676,40 +68811,21 @@
68676
68811
  });
68677
68812
  }
68678
68813
  const records = this.internalProps.records;
68679
- if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {
68680
- const rowKeys = options.rows?.reduce((keys, rowObj) => {
68681
- if (typeof rowObj === 'string') {
68682
- keys.push(rowObj);
68683
- }
68684
- else {
68685
- keys.push(rowObj.dimensionKey);
68686
- }
68687
- return keys;
68688
- }, []);
68689
- const columnKeys = options.columns?.reduce((keys, columnObj) => {
68690
- if (typeof columnObj === 'string') {
68691
- keys.push(columnObj);
68692
- }
68693
- else {
68694
- keys.push(columnObj.dimensionKey);
68695
- }
68696
- return keys;
68697
- }, []);
68698
- const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
68699
- if (typeof indicatorObj === 'string') {
68700
- keys.push(indicatorObj);
68701
- }
68702
- else {
68703
- keys.push(indicatorObj.indicatorKey);
68704
- }
68705
- return keys;
68706
- }, []);
68707
- this.dataset = new Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, options.indicatorsAsCol ?? true, options.records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree);
68708
- internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
68814
+ this.internalProps.recordsIsTwoDimensionalArray = false;
68815
+ if (records?.[0]?.constructor === Array) {
68816
+ this.internalProps.recordsIsTwoDimensionalArray = true;
68709
68817
  }
68710
- else if (Array.isArray(this.internalProps.columnTree) || Array.isArray(this.internalProps.rowTree)) {
68711
- internalProps.layoutMap = new PivotHeaderLayoutMap(this, null);
68712
- if (records?.[0]?.constructor !== Array) {
68818
+ if (options.customConfig?.enableDataAnalysis === false) {
68819
+ let columnDimensionTree;
68820
+ let rowDimensionTree;
68821
+ if (options.columnTree) {
68822
+ columnDimensionTree = new DimensionTree(this.internalProps.columnTree ?? [], this.layoutNodeId);
68823
+ }
68824
+ if (options.rowTree) {
68825
+ rowDimensionTree = new DimensionTree(this.internalProps.rowTree ?? [], this.layoutNodeId, this.options.rowHierarchyType, this.options.rowHierarchyType === 'tree' ? this.options.rowExpandLevel ?? 1 : undefined);
68826
+ }
68827
+ internalProps.layoutMap = new PivotHeaderLayoutMap(this, null, columnDimensionTree, rowDimensionTree);
68828
+ if (this.internalProps.recordsIsTwoDimensionalArray === false) {
68713
68829
  this.flatDataToObjects = new FlatDataToObjects({
68714
68830
  rows: internalProps.layoutMap.fullRowDimensionKeys,
68715
68831
  columns: internalProps.layoutMap.colDimensionKeys,
@@ -68720,7 +68836,17 @@
68720
68836
  }
68721
68837
  }
68722
68838
  else {
68723
- return this;
68839
+ const keysResults = parseColKeyRowKeyForPivotTable(this, options);
68840
+ const { rowKeys, columnKeys, indicatorKeys, isNeedResetColumnDimensionTree, isNeedResetRowDimensionTree } = keysResults;
68841
+ let { columnDimensionTree, rowDimensionTree } = keysResults;
68842
+ this.dataset = new Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, options.indicatorsAsCol ?? true, records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree);
68843
+ if (!options.columnTree || isNeedResetColumnDimensionTree) {
68844
+ columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
68845
+ }
68846
+ if (!options.rowTree || isNeedResetRowDimensionTree) {
68847
+ rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId, this.options.rowHierarchyType, this.options.rowHierarchyType === 'tree' ? this.options.rowExpandLevel ?? 1 : undefined);
68848
+ }
68849
+ internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
68724
68850
  }
68725
68851
  this.pivotSortState = [];
68726
68852
  if (options.pivotSortState) {
@@ -68833,7 +68959,12 @@
68833
68959
  if (table.internalProps.layoutMap.isHeader(col, row)) {
68834
68960
  return undefined;
68835
68961
  }
68836
- if (this.dataset) {
68962
+ if (this.internalProps.recordsIsTwoDimensionalArray) {
68963
+ const rowIndex = this.getBodyIndexByRow(row);
68964
+ const colIndex = this.getBodyIndexByCol(col);
68965
+ return this.records[rowIndex]?.[colIndex];
68966
+ }
68967
+ else if (this.dataset) {
68837
68968
  const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
68838
68969
  if (cellDimensionPath) {
68839
68970
  const colKeys = cellDimensionPath.colHeaderPaths.map((colPath) => {
@@ -68842,7 +68973,7 @@
68842
68973
  const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
68843
68974
  return rowPath.indicatorKey ?? rowPath.value;
68844
68975
  });
68845
- const aggregator = this.dataset.getAggregator(!this.internalProps.layoutMap.indicatorsAsCol ? rowKeys.slice(0, -1) : rowKeys, this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
68976
+ const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
68846
68977
  if (aggregator.records && aggregator.records.length >= 1) {
68847
68978
  return aggregator.records[0][field];
68848
68979
  }
@@ -68861,9 +68992,6 @@
68861
68992
  return treeNode?.record[field];
68862
68993
  }
68863
68994
  }
68864
- const rowIndex = this.getBodyIndexByRow(row);
68865
- const colIndex = this.getBodyIndexByCol(col);
68866
- return this.records[rowIndex]?.[colIndex];
68867
68995
  }
68868
68996
  getCellValue(col, row, skipCustomMerge) {
68869
68997
  if (!skipCustomMerge) {
@@ -68884,16 +69012,40 @@
68884
69012
  const { title, fieldFormat } = this.internalProps.layoutMap.getHeader(col, row);
68885
69013
  return typeof fieldFormat === 'function' ? fieldFormat(title, col, row, this) : title;
68886
69014
  }
68887
- if (this.dataset) {
69015
+ if (this.internalProps.recordsIsTwoDimensionalArray) {
69016
+ const { fieldFormat } = this.internalProps.layoutMap.getBody(col, row);
69017
+ const rowIndex = this.getBodyIndexByRow(row);
69018
+ const colIndex = this.getBodyIndexByCol(col);
69019
+ const dataValue = this.records[rowIndex]?.[colIndex];
69020
+ if (typeof fieldFormat === 'function') {
69021
+ const fieldResult = fieldFormat(dataValue, col, row, this);
69022
+ return fieldResult;
69023
+ }
69024
+ return dataValue;
69025
+ }
69026
+ else if (this.dataset) {
68888
69027
  const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
68889
- const colKeys = cellDimensionPath.colHeaderPaths.map((colPath) => {
69028
+ const colKeys = cellDimensionPath.colHeaderPaths
69029
+ ?.filter((path) => {
69030
+ return !path.virtual;
69031
+ })
69032
+ ?.map((colPath) => {
68890
69033
  return colPath.indicatorKey ?? colPath.value;
68891
69034
  });
68892
- const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
69035
+ const rowKeys = cellDimensionPath.rowHeaderPaths
69036
+ ?.filter((path) => {
69037
+ return !path.virtual;
69038
+ })
69039
+ ?.map((rowPath) => {
68893
69040
  return rowPath.indicatorKey ?? rowPath.value;
68894
69041
  });
68895
- const aggregator = this.dataset.getAggregator(!this.internalProps.layoutMap.indicatorsAsCol ? rowKeys.slice(0, -1) : rowKeys, this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
68896
- return aggregator.formatValue ? aggregator.formatValue(col, row, this) : '';
69042
+ const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
69043
+ const { fieldFormat } = this.internalProps.layoutMap.getBody(col, row);
69044
+ return aggregator.formatValue
69045
+ ? aggregator.formatValue(col, row, this)
69046
+ : typeof fieldFormat === 'function'
69047
+ ? fieldFormat(aggregator?.value(), col, row, this)
69048
+ : aggregator?.value() ?? '';
68897
69049
  }
68898
69050
  else if (this.flatDataToObjects) {
68899
69051
  const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
@@ -68909,15 +69061,6 @@
68909
69061
  ? fieldFormat(valueNode?.value, col, row, this)
68910
69062
  : valueNode?.value ?? '';
68911
69063
  }
68912
- const { fieldFormat } = this.internalProps.layoutMap.getBody(col, row);
68913
- const rowIndex = this.getBodyIndexByRow(row);
68914
- const colIndex = this.getBodyIndexByCol(col);
68915
- const dataValue = this.records[rowIndex]?.[colIndex];
68916
- if (typeof fieldFormat === 'function') {
68917
- const fieldResult = fieldFormat(dataValue, col, row, this);
68918
- return fieldResult;
68919
- }
68920
- return dataValue;
68921
69064
  }
68922
69065
  getCellOriginValue(col, row) {
68923
69066
  const table = this;
@@ -68925,7 +69068,13 @@
68925
69068
  const { title } = table.internalProps.layoutMap.getHeader(col, row);
68926
69069
  return typeof title === 'function' ? title() : title;
68927
69070
  }
68928
- if (this.dataset) {
69071
+ if (this.internalProps.recordsIsTwoDimensionalArray) {
69072
+ const rowIndex = this.getBodyIndexByRow(row);
69073
+ const colIndex = this.getBodyIndexByCol(col);
69074
+ const dataValue = this.records[rowIndex]?.[colIndex];
69075
+ return dataValue;
69076
+ }
69077
+ else if (this.dataset) {
68929
69078
  const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
68930
69079
  const colKeys = cellDimensionPath.colHeaderPaths.map((colPath) => {
68931
69080
  return colPath.indicatorKey ?? colPath.value;
@@ -68933,7 +69082,7 @@
68933
69082
  const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
68934
69083
  return rowPath.indicatorKey ?? rowPath.value;
68935
69084
  });
68936
- const aggregator = this.dataset.getAggregator(!this.internalProps.layoutMap.indicatorsAsCol ? rowKeys.slice(0, -1) : rowKeys, this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
69085
+ const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
68937
69086
  return aggregator.value ? aggregator.value() : undefined;
68938
69087
  }
68939
69088
  else if (this.flatDataToObjects) {
@@ -68947,10 +69096,6 @@
68947
69096
  const treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey);
68948
69097
  return treeNode?.value;
68949
69098
  }
68950
- const rowIndex = this.getBodyIndexByRow(row);
68951
- const colIndex = this.getBodyIndexByCol(col);
68952
- const dataValue = this.records[rowIndex]?.[colIndex];
68953
- return dataValue;
68954
69099
  }
68955
69100
  getCellRawValue(col, row) {
68956
69101
  const table = this;
@@ -68958,7 +69103,13 @@
68958
69103
  const { title } = table.internalProps.layoutMap.getHeader(col, row);
68959
69104
  return typeof title === 'function' ? title() : title;
68960
69105
  }
68961
- if (this.dataset) {
69106
+ if (this.internalProps.recordsIsTwoDimensionalArray) {
69107
+ const rowIndex = this.getBodyIndexByRow(row);
69108
+ const colIndex = this.getBodyIndexByCol(col);
69109
+ const dataValue = this.records[rowIndex]?.[colIndex];
69110
+ return dataValue;
69111
+ }
69112
+ else if (this.dataset) {
68962
69113
  const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
68963
69114
  const colKeys = cellDimensionPath.colHeaderPaths.map((colPath) => {
68964
69115
  return colPath.indicatorKey ?? colPath.value;
@@ -68966,7 +69117,7 @@
68966
69117
  const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
68967
69118
  return rowPath.indicatorKey ?? rowPath.value;
68968
69119
  });
68969
- const aggregator = this.dataset.getAggregator(!this.internalProps.layoutMap.indicatorsAsCol ? rowKeys.slice(0, -1) : rowKeys, this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row), false);
69120
+ const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row), false);
68970
69121
  return aggregator.value ? aggregator.value() : undefined;
68971
69122
  }
68972
69123
  else if (this.flatDataToObjects) {
@@ -68980,17 +69131,19 @@
68980
69131
  const treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, false);
68981
69132
  return treeNode?.value;
68982
69133
  }
68983
- const rowIndex = this.getBodyIndexByRow(row);
68984
- const colIndex = this.getBodyIndexByCol(col);
68985
- const dataValue = this.records[rowIndex]?.[colIndex];
68986
- return dataValue;
68987
69134
  }
68988
69135
  getCellOriginRecord(col, row) {
68989
69136
  const table = this;
68990
69137
  if (table.internalProps.layoutMap.isHeader(col, row)) {
68991
69138
  return undefined;
68992
69139
  }
68993
- if (this.dataset) {
69140
+ if (this.internalProps.recordsIsTwoDimensionalArray) {
69141
+ const rowIndex = this.getBodyIndexByRow(row);
69142
+ const colIndex = this.getBodyIndexByCol(col);
69143
+ const dataValue = this.records[rowIndex]?.[colIndex];
69144
+ return dataValue;
69145
+ }
69146
+ else if (this.dataset) {
68994
69147
  const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
68995
69148
  const colKeys = cellDimensionPath.colHeaderPaths.map((colPath) => {
68996
69149
  return colPath.indicatorKey ?? colPath.value;
@@ -68998,7 +69151,7 @@
68998
69151
  const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
68999
69152
  return rowPath.indicatorKey ?? rowPath.value;
69000
69153
  });
69001
- const aggregator = this.dataset.getAggregator(!this.internalProps.layoutMap.indicatorsAsCol ? rowKeys.slice(0, -1) : rowKeys, this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
69154
+ const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
69002
69155
  return aggregator.records;
69003
69156
  }
69004
69157
  else if (this.flatDataToObjects) {
@@ -69012,17 +69165,19 @@
69012
69165
  const treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey);
69013
69166
  return treeNode?.record;
69014
69167
  }
69015
- const rowIndex = this.getBodyIndexByRow(row);
69016
- const colIndex = this.getBodyIndexByCol(col);
69017
- const dataValue = this.records[rowIndex]?.[colIndex];
69018
- return dataValue;
69019
69168
  }
69020
69169
  getCellRawRecord(col, row) {
69021
69170
  const table = this;
69022
69171
  if (table.internalProps.layoutMap.isHeader(col, row)) {
69023
69172
  return undefined;
69024
69173
  }
69025
- if (this.dataset) {
69174
+ if (this.internalProps.recordsIsTwoDimensionalArray) {
69175
+ const rowIndex = this.getBodyIndexByRow(row);
69176
+ const colIndex = this.getBodyIndexByCol(col);
69177
+ const dataValue = this.records[rowIndex]?.[colIndex];
69178
+ return dataValue;
69179
+ }
69180
+ else if (this.dataset) {
69026
69181
  const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
69027
69182
  const colKeys = cellDimensionPath.colHeaderPaths.map((colPath) => {
69028
69183
  return colPath.indicatorKey ?? colPath.value;
@@ -69030,7 +69185,7 @@
69030
69185
  const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
69031
69186
  return rowPath.indicatorKey ?? rowPath.value;
69032
69187
  });
69033
- const aggregator = this.dataset.getAggregator(!this.internalProps.layoutMap.indicatorsAsCol ? rowKeys.slice(0, -1) : rowKeys, this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
69188
+ const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
69034
69189
  return aggregator.records;
69035
69190
  }
69036
69191
  else if (this.flatDataToObjects) {
@@ -69044,10 +69199,6 @@
69044
69199
  const treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, false);
69045
69200
  return treeNode?.record;
69046
69201
  }
69047
- const rowIndex = this.getBodyIndexByRow(row);
69048
- const colIndex = this.getBodyIndexByCol(col);
69049
- const dataValue = this.records[rowIndex]?.[colIndex];
69050
- return dataValue;
69051
69202
  }
69052
69203
  updateSortRules(sortRules) {
69053
69204
  this.internalProps.dataConfig.sortRules = sortRules;
@@ -69089,7 +69240,7 @@
69089
69240
  const moveContext = this.internalProps.layoutMap.moveHeaderPosition(source, target);
69090
69241
  if (moveContext) {
69091
69242
  if (moveContext.moveType === 'column') {
69092
- if (this.options.records?.[0]?.constructor === Array) {
69243
+ if (this.internalProps.recordsIsTwoDimensionalArray) {
69093
69244
  for (let row = 0; row < this.internalProps.records.length; row++) {
69094
69245
  const sourceColumns = this.internalProps.records[row].splice(moveContext.sourceIndex - this.rowHeaderLevelCount, moveContext.sourceSize);
69095
69246
  sourceColumns.unshift(moveContext.targetIndex - this.rowHeaderLevelCount, 0);
@@ -69100,7 +69251,7 @@
69100
69251
  this.setMinMaxLimitWidth();
69101
69252
  }
69102
69253
  else if (moveContext.moveType === 'row') {
69103
- if (this.options.records?.[0]?.constructor === Array) {
69254
+ if (this.internalProps.recordsIsTwoDimensionalArray) {
69104
69255
  const sourceRows = this.internalProps.records.splice(moveContext.sourceIndex - this.columnHeaderLevelCount, moveContext.sourceSize);
69105
69256
  sourceRows.unshift(moveContext.targetIndex - this.columnHeaderLevelCount, 0);
69106
69257
  Array.prototype.splice.apply(this.internalProps.records, sourceRows);
@@ -69127,8 +69278,7 @@
69127
69278
  });
69128
69279
  }
69129
69280
  else if (hierarchyState === HierarchyState.collapse) {
69130
- const headerPaths = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
69131
- const headerTreeNode = this.internalProps.layoutMap.getHeadNode(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length));
69281
+ const headerTreeNode = this.internalProps.layoutMap.getHeadNode(col, row);
69132
69282
  if (Array.isArray(headerTreeNode.children)) {
69133
69283
  this._refreshHierarchyState(col, row);
69134
69284
  }
@@ -69211,7 +69361,7 @@
69211
69361
  }
69212
69362
  getCellHeaderTreeNodes(col, row) {
69213
69363
  const layoutMap = this.internalProps.layoutMap;
69214
- const headerNodes = layoutMap.getCellHeaderPathsWidthTreeNode(col, row);
69364
+ const headerNodes = layoutMap.getCellHeaderPathsWithTreeNode(col, row);
69215
69365
  return headerNodes;
69216
69366
  }
69217
69367
  _hasHierarchyTreeHeader() {
@@ -69231,18 +69381,14 @@
69231
69381
  setRecords(records) {
69232
69382
  const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
69233
69383
  this.options.records = this.internalProps.records = records;
69384
+ this.internalProps.recordsIsTwoDimensionalArray = false;
69385
+ if (records?.[0]?.constructor === Array) {
69386
+ this.internalProps.recordsIsTwoDimensionalArray = true;
69387
+ }
69234
69388
  const options = this.options;
69235
69389
  const internalProps = this.internalProps;
69236
- if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {
69237
- this.dataset.setRecords(records);
69238
- internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
69239
- this.pivotSortState = [];
69240
- if (options.pivotSortState) {
69241
- this.updatePivotSortState(options.pivotSortState);
69242
- }
69243
- }
69244
- else if (Array.isArray(this.internalProps.columnTree) || Array.isArray(this.internalProps.rowTree)) {
69245
- if (records?.[0]?.constructor !== Array) {
69390
+ if (this.options.customConfig?.enableDataAnalysis === false) {
69391
+ if (this.internalProps.recordsIsTwoDimensionalArray === false) {
69246
69392
  this.flatDataToObjects = new FlatDataToObjects({
69247
69393
  rows: internalProps.layoutMap.fullRowDimensionKeys,
69248
69394
  columns: internalProps.layoutMap.colDimensionKeys,
@@ -69252,6 +69398,28 @@
69252
69398
  }, records);
69253
69399
  }
69254
69400
  }
69401
+ else {
69402
+ this.dataset.setRecords(records);
69403
+ let columnDimensionTree;
69404
+ let rowDimensionTree;
69405
+ if (options.columnTree) {
69406
+ columnDimensionTree = internalProps.layoutMap.columnDimensionTree;
69407
+ }
69408
+ else {
69409
+ columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
69410
+ }
69411
+ if (options.rowTree) {
69412
+ rowDimensionTree = internalProps.layoutMap.rowDimensionTree;
69413
+ }
69414
+ else {
69415
+ rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId, this.options.rowHierarchyType, this.options.rowHierarchyType === 'tree' ? this.options.rowExpandLevel ?? 1 : undefined);
69416
+ }
69417
+ internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
69418
+ this.pivotSortState = [];
69419
+ if (options.pivotSortState) {
69420
+ this.updatePivotSortState(options.pivotSortState);
69421
+ }
69422
+ }
69255
69423
  this.refreshHeader();
69256
69424
  this.scenegraph.clearCells();
69257
69425
  this.clearCellStyleCache();
@@ -69445,7 +69613,12 @@
69445
69613
  this.scenegraph.updateNextFrame();
69446
69614
  }
69447
69615
  _changeCellValueToDataSet(col, row, oldValue, newValue) {
69448
- if (this.dataset) {
69616
+ if (this.internalProps.recordsIsTwoDimensionalArray) {
69617
+ const rowIndex = this.getBodyIndexByRow(row);
69618
+ const colIndex = this.getBodyIndexByCol(col);
69619
+ this.records[rowIndex][colIndex] = newValue;
69620
+ }
69621
+ else if (this.dataset) {
69449
69622
  const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
69450
69623
  if (this.isHeader(col, row)) {
69451
69624
  this.internalProps.layoutMap.changeTreeNodeTitle(col, row, newValue);
@@ -69487,11 +69660,6 @@
69487
69660
  this.flatDataToObjects.changeTreeNodeValue(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, newValue);
69488
69661
  }
69489
69662
  }
69490
- else {
69491
- const rowIndex = this.getBodyIndexByRow(row);
69492
- const colIndex = this.getBodyIndexByCol(col);
69493
- this.records[rowIndex][colIndex] = newValue;
69494
- }
69495
69663
  }
69496
69664
  _hasCustomRenderOrLayout() {
69497
69665
  if (this.options.customRender) {
@@ -69526,8 +69694,7 @@
69526
69694
  }
69527
69695
  setTreeNodeChildren(children, records, col, row) {
69528
69696
  if (this.flatDataToObjects) {
69529
- const headerPaths = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
69530
- const headerTreeNode = this.internalProps.layoutMap.getHeadNode(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length));
69697
+ const headerTreeNode = this.internalProps.layoutMap.getHeadNode(col, row);
69531
69698
  headerTreeNode.children = children;
69532
69699
  this._refreshHierarchyState(col, row, () => {
69533
69700
  this.flatDataToObjects.changeDataConfig({
@@ -69540,10 +69707,22 @@
69540
69707
  this.flatDataToObjects.addRecords(records);
69541
69708
  });
69542
69709
  }
69710
+ else {
69711
+ const headerTreeNode = this.internalProps.layoutMap.getHeadNode(col, row);
69712
+ headerTreeNode.children = children;
69713
+ this._refreshHierarchyState(col, row, () => {
69714
+ this.dataset.changeDataConfig({
69715
+ rows: this.internalProps.layoutMap.fullRowDimensionKeys,
69716
+ columns: this.internalProps.layoutMap.colDimensionKeys
69717
+ });
69718
+ this.dataset.addRecords(records);
69719
+ });
69720
+ }
69543
69721
  }
69544
69722
  }
69545
69723
 
69546
69724
  class PivotChart extends BaseTable {
69725
+ layoutNodeId = { seqId: 0 };
69547
69726
  pivotSortState;
69548
69727
  dataset;
69549
69728
  _selectedDataItemsInChart = [];
@@ -69581,24 +69760,36 @@
69581
69760
  this.internalProps.rowResizeType = options.rowResizeType ?? 'row';
69582
69761
  this.internalProps.dataConfig = { isPivotChart: true };
69583
69762
  this._axes = isArray$3(options.axes) ? options.axes : [];
69584
- const rowKeys = options.rows?.reduce((keys, rowObj) => {
69585
- if (typeof rowObj === 'string') {
69586
- keys.push(rowObj);
69587
- }
69588
- else {
69589
- keys.push(rowObj.dimensionKey);
69590
- }
69591
- return keys;
69592
- }, []) ?? [];
69593
- const columnKeys = options.columns?.reduce((keys, columnObj) => {
69594
- if (typeof columnObj === 'string') {
69595
- keys.push(columnObj);
69596
- }
69597
- else {
69598
- keys.push(columnObj.dimensionKey);
69599
- }
69600
- return keys;
69601
- }, []) ?? [];
69763
+ let columnDimensionTree;
69764
+ let rowDimensionTree;
69765
+ if (options.columnTree) {
69766
+ columnDimensionTree = new DimensionTree(this.internalProps.columnTree ?? [], this.layoutNodeId);
69767
+ }
69768
+ if (options.rowTree) {
69769
+ rowDimensionTree = new DimensionTree(this.internalProps.rowTree ?? [], this.layoutNodeId);
69770
+ }
69771
+ const rowKeys = rowDimensionTree?.dimensionKeys?.count
69772
+ ? rowDimensionTree.dimensionKeys.valueArr()
69773
+ : options.rows?.reduce((keys, rowObj) => {
69774
+ if (typeof rowObj === 'string') {
69775
+ keys.push(rowObj);
69776
+ }
69777
+ else {
69778
+ keys.push(rowObj.dimensionKey);
69779
+ }
69780
+ return keys;
69781
+ }, []) ?? [];
69782
+ const columnKeys = columnDimensionTree?.dimensionKeys?.count
69783
+ ? columnDimensionTree.dimensionKeys.valueArr()
69784
+ : options.columns?.reduce((keys, columnObj) => {
69785
+ if (typeof columnObj === 'string') {
69786
+ keys.push(columnObj);
69787
+ }
69788
+ else {
69789
+ keys.push(columnObj.dimensionKey);
69790
+ }
69791
+ return keys;
69792
+ }, []) ?? [];
69602
69793
  const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
69603
69794
  if (typeof indicatorObj === 'string') {
69604
69795
  keys.push(indicatorObj);
@@ -69612,7 +69803,37 @@
69612
69803
  this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules();
69613
69804
  this.internalProps.dataConfig.dimensionSortArray = this._getDimensionSortArray();
69614
69805
  this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, options.indicatorsAsCol ?? true, options.records, undefined, this.internalProps.columnTree, this.internalProps.rowTree, true);
69615
- this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
69806
+ if (this.options.indicatorsAsCol && checkHasCartesianChart(this.internalProps.indicators)) {
69807
+ const supplyAxisNode = (nodes) => {
69808
+ nodes.forEach((node) => {
69809
+ if (node.children?.length) {
69810
+ supplyAxisNode(node.children);
69811
+ }
69812
+ else {
69813
+ node.children = [
69814
+ {
69815
+ dimensionKey: 'axis',
69816
+ value: ''
69817
+ }
69818
+ ];
69819
+ }
69820
+ });
69821
+ };
69822
+ if (this.dataset.rowHeaderTree?.length) {
69823
+ supplyAxisNode(this.dataset.rowHeaderTree);
69824
+ }
69825
+ else {
69826
+ this.dataset.rowHeaderTree = [
69827
+ {
69828
+ dimensionKey: 'axis',
69829
+ value: ''
69830
+ }
69831
+ ];
69832
+ }
69833
+ }
69834
+ columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
69835
+ rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId);
69836
+ this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
69616
69837
  this.refreshHeader();
69617
69838
  this.scenegraph.createSceneGraph();
69618
69839
  if (options.title) {
@@ -69656,6 +69877,7 @@
69656
69877
  updateOption(options) {
69657
69878
  const internalProps = this.internalProps;
69658
69879
  super.updateOption(options);
69880
+ this.layoutNodeId = { seqId: 0 };
69659
69881
  this.internalProps.columns = cloneDeep(options.columns);
69660
69882
  this.internalProps.rows = cloneDeep(options.rows);
69661
69883
  this.internalProps.indicators = !options.indicators?.length ? [] : cloneDeepSpec(options.indicators);
@@ -69670,24 +69892,36 @@
69670
69892
  internalProps.rowResizeType = options.rowResizeType ?? 'row';
69671
69893
  internalProps.dataConfig = { isPivotChart: true };
69672
69894
  this._axes = isArray$3(options.axes) ? options.axes : [];
69673
- const rowKeys = options.rows?.reduce((keys, rowObj) => {
69674
- if (typeof rowObj === 'string') {
69675
- keys.push(rowObj);
69676
- }
69677
- else {
69678
- keys.push(rowObj.dimensionKey);
69679
- }
69680
- return keys;
69681
- }, []) ?? [];
69682
- const columnKeys = options.columns?.reduce((keys, columnObj) => {
69683
- if (typeof columnObj === 'string') {
69684
- keys.push(columnObj);
69685
- }
69686
- else {
69687
- keys.push(columnObj.dimensionKey);
69688
- }
69689
- return keys;
69690
- }, []) ?? [];
69895
+ let columnDimensionTree;
69896
+ let rowDimensionTree;
69897
+ if (options.columnTree) {
69898
+ columnDimensionTree = new DimensionTree(this.internalProps.columnTree ?? [], this.layoutNodeId);
69899
+ }
69900
+ if (options.rowTree) {
69901
+ rowDimensionTree = new DimensionTree(this.internalProps.rowTree ?? [], this.layoutNodeId);
69902
+ }
69903
+ const rowKeys = rowDimensionTree?.dimensionKeys?.count
69904
+ ? rowDimensionTree.dimensionKeys.valueArr()
69905
+ : options.rows?.reduce((keys, rowObj) => {
69906
+ if (typeof rowObj === 'string') {
69907
+ keys.push(rowObj);
69908
+ }
69909
+ else {
69910
+ keys.push(rowObj.dimensionKey);
69911
+ }
69912
+ return keys;
69913
+ }, []) ?? [];
69914
+ const columnKeys = columnDimensionTree?.dimensionKeys?.count
69915
+ ? columnDimensionTree.dimensionKeys.valueArr()
69916
+ : options.columns?.reduce((keys, columnObj) => {
69917
+ if (typeof columnObj === 'string') {
69918
+ keys.push(columnObj);
69919
+ }
69920
+ else {
69921
+ keys.push(columnObj.dimensionKey);
69922
+ }
69923
+ return keys;
69924
+ }, []) ?? [];
69691
69925
  const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
69692
69926
  if (typeof indicatorObj === 'string') {
69693
69927
  keys.push(indicatorObj);
@@ -69701,7 +69935,37 @@
69701
69935
  this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules();
69702
69936
  this.internalProps.dataConfig.dimensionSortArray = this._getDimensionSortArray();
69703
69937
  this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, options.indicatorsAsCol ?? true, options.records ?? this.internalProps.records, undefined, this.internalProps.columnTree, this.internalProps.rowTree, true);
69704
- internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
69938
+ if (this.options.indicatorsAsCol && checkHasCartesianChart(this.internalProps.indicators)) {
69939
+ const supplyAxisNode = (nodes) => {
69940
+ nodes.forEach((node) => {
69941
+ if (node.children?.length) {
69942
+ supplyAxisNode(node.children);
69943
+ }
69944
+ else {
69945
+ node.children = [
69946
+ {
69947
+ dimensionKey: 'axis',
69948
+ value: ''
69949
+ }
69950
+ ];
69951
+ }
69952
+ });
69953
+ };
69954
+ if (this.dataset.rowHeaderTree?.length) {
69955
+ supplyAxisNode(this.dataset.rowHeaderTree);
69956
+ }
69957
+ else {
69958
+ this.dataset.rowHeaderTree = [
69959
+ {
69960
+ dimensionKey: 'axis',
69961
+ value: ''
69962
+ }
69963
+ ];
69964
+ }
69965
+ }
69966
+ columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
69967
+ rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId);
69968
+ internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
69705
69969
  this.refreshHeader();
69706
69970
  if (internalProps.releaseList) {
69707
69971
  internalProps.releaseList.forEach(releaseObj => releaseObj?.release?.());
@@ -69806,7 +70070,7 @@
69806
70070
  const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
69807
70071
  return rowPath.indicatorKey ?? rowPath.value;
69808
70072
  });
69809
- const aggregator = this.dataset.getAggregator(!this.internalProps.layoutMap.indicatorsAsCol ? rowKeys.slice(0, -1) : rowKeys, this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
70073
+ const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
69810
70074
  return aggregator.value ? aggregator.value() : undefined;
69811
70075
  }
69812
70076
  const { fieldFormat } = this.internalProps.layoutMap.getBody(col, row);
@@ -69845,7 +70109,7 @@
69845
70109
  const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
69846
70110
  return rowPath.indicatorKey ?? rowPath.value;
69847
70111
  });
69848
- const aggregator = this.dataset.getAggregator(!this.internalProps.layoutMap.indicatorsAsCol ? rowKeys.slice(0, -1) : rowKeys, this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
70112
+ const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
69849
70113
  return aggregator.value ? aggregator.value() : undefined;
69850
70114
  }
69851
70115
  const rowIndex = this.getBodyIndexByRow(row);
@@ -69869,7 +70133,7 @@
69869
70133
  const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
69870
70134
  return rowPath.indicatorKey ?? rowPath.value;
69871
70135
  });
69872
- const aggregator = this.dataset.getAggregator(!this.internalProps.layoutMap.indicatorsAsCol ? rowKeys.slice(0, -1) : rowKeys, this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
70136
+ const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
69873
70137
  return aggregator.records;
69874
70138
  }
69875
70139
  return undefined;
@@ -69997,6 +70261,8 @@
69997
70261
  return result;
69998
70262
  }
69999
70263
  _generateCollectValuesConfig(columnKeys, rowKeys) {
70264
+ columnKeys = columnKeys.filter(key => key !== IndicatorDimensionKeyPlaceholder);
70265
+ rowKeys = rowKeys.filter(key => key !== IndicatorDimensionKeyPlaceholder);
70000
70266
  const indicators = this.internalProps.indicators;
70001
70267
  const collectValuesBy = {};
70002
70268
  for (let i = 0, len = indicators?.length; i < len; i++) {
@@ -70356,10 +70622,24 @@
70356
70622
  setRecords(records) {
70357
70623
  const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
70358
70624
  this.options.records = this.internalProps.records = records;
70359
- this.options;
70625
+ const options = this.options;
70360
70626
  const internalProps = this.internalProps;
70361
70627
  this.dataset.setRecords(records);
70362
- internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
70628
+ let columnDimensionTree;
70629
+ let rowDimensionTree;
70630
+ if (options.columnTree) {
70631
+ columnDimensionTree = internalProps.layoutMap.columnDimensionTree;
70632
+ }
70633
+ else {
70634
+ columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
70635
+ }
70636
+ if (options.rowTree) {
70637
+ rowDimensionTree = internalProps.layoutMap.rowDimensionTree;
70638
+ }
70639
+ else {
70640
+ rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId);
70641
+ }
70642
+ internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
70363
70643
  this.refreshHeader();
70364
70644
  this.scenegraph.clearCells();
70365
70645
  this.clearCellStyleCache();
@@ -70403,6 +70683,27 @@
70403
70683
  }
70404
70684
  changeRecordOrder(source, target) {
70405
70685
  }
70686
+ getLayoutColumnTree() {
70687
+ const layoutMap = this.internalProps.layoutMap;
70688
+ return layoutMap.getLayoutColumnTree();
70689
+ }
70690
+ getLayoutColumnTreeCount() {
70691
+ const layoutMap = this.internalProps.layoutMap;
70692
+ return layoutMap.getLayoutColumnTreeCount();
70693
+ }
70694
+ getLayoutRowTree() {
70695
+ const layoutMap = this.internalProps.layoutMap;
70696
+ return layoutMap.getLayoutRowTree();
70697
+ }
70698
+ getLayoutRowTreeCount() {
70699
+ const layoutMap = this.internalProps.layoutMap;
70700
+ return layoutMap.getLayoutRowTreeCount();
70701
+ }
70702
+ getCellHeaderTreeNodes(col, row) {
70703
+ const layoutMap = this.internalProps.layoutMap;
70704
+ const headerNodes = layoutMap.getCellHeaderPathsWithTreeNode(col, row);
70705
+ return headerNodes;
70706
+ }
70406
70707
  }
70407
70708
 
70408
70709
  class Circle extends Circle$1 {
@@ -70666,25 +70967,38 @@
70666
70967
  });
70667
70968
 
70668
70969
  function createDataset(options) {
70970
+ const layoutNodeId = { seqId: 0 };
70669
70971
  const dataConfig = { isPivotChart: true };
70670
- const rowKeys = options.rows?.reduce((keys, rowObj) => {
70671
- if (typeof rowObj === 'string') {
70672
- keys.push(rowObj);
70673
- }
70674
- else {
70675
- keys.push(rowObj.dimensionKey);
70676
- }
70677
- return keys;
70678
- }, []) ?? [];
70679
- const columnKeys = options.columns?.reduce((keys, columnObj) => {
70680
- if (typeof columnObj === 'string') {
70681
- keys.push(columnObj);
70682
- }
70683
- else {
70684
- keys.push(columnObj.dimensionKey);
70685
- }
70686
- return keys;
70687
- }, []) ?? [];
70972
+ let columnDimensionTree;
70973
+ let rowDimensionTree;
70974
+ if (options.columnTree) {
70975
+ columnDimensionTree = new DimensionTree(options.columnTree ?? [], layoutNodeId);
70976
+ }
70977
+ if (options.rowTree) {
70978
+ rowDimensionTree = new DimensionTree(options.rowTree ?? [], layoutNodeId);
70979
+ }
70980
+ const rowKeys = rowDimensionTree.dimensionKeys?.count
70981
+ ? rowDimensionTree.dimensionKeys.valueArr()
70982
+ : options.rows?.reduce((keys, rowObj) => {
70983
+ if (typeof rowObj === 'string') {
70984
+ keys.push(rowObj);
70985
+ }
70986
+ else {
70987
+ keys.push(rowObj.dimensionKey);
70988
+ }
70989
+ return keys;
70990
+ }, []) ?? [];
70991
+ const columnKeys = columnDimensionTree.dimensionKeys?.count
70992
+ ? columnDimensionTree.dimensionKeys.valueArr()
70993
+ : options.columns?.reduce((keys, columnObj) => {
70994
+ if (typeof columnObj === 'string') {
70995
+ keys.push(columnObj);
70996
+ }
70997
+ else {
70998
+ keys.push(columnObj.dimensionKey);
70999
+ }
71000
+ return keys;
71001
+ }, []) ?? [];
70688
71002
  const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
70689
71003
  if (typeof indicatorObj === 'string') {
70690
71004
  keys.push(indicatorObj);
@@ -70697,7 +71011,7 @@
70697
71011
  dataConfig.collectValuesBy = _generateCollectValuesConfig(options, columnKeys, rowKeys);
70698
71012
  dataConfig.aggregationRules = _generateAggregationRules(options);
70699
71013
  const dataset = new Dataset(dataConfig, rowKeys, columnKeys, indicatorKeys, options.indicators, options.indicatorsAsCol ?? true, options.records, undefined, options.columnTree, options.rowTree, true);
70700
- return dataset;
71014
+ return { dataset, columnDimensionTree, rowDimensionTree, layoutNodeId };
70701
71015
  }
70702
71016
  function _generateCollectValuesConfig(option, columnKeys, rowKeys) {
70703
71017
  const collectValuesBy = {};
@@ -70860,9 +71174,25 @@
70860
71174
  }
70861
71175
 
70862
71176
  function getDataCellPath(options, data, compareFunc) {
70863
- const dataset = createDataset(options);
71177
+ const results = createDataset(options);
71178
+ let columnDimensionTree = results.columnDimensionTree;
71179
+ let rowDimensionTree = results.rowDimensionTree;
71180
+ let isNeedResetColumnDimensionTree = false;
71181
+ let isNeedResetRowDimensionTree = false;
71182
+ if (options.columnTree) {
71183
+ if (options.indicatorsAsCol && !columnDimensionTree.dimensionKeys.contain(IndicatorDimensionKeyPlaceholder)) {
71184
+ isNeedResetColumnDimensionTree = true;
71185
+ }
71186
+ }
71187
+ if (options.rowTree) {
71188
+ if (!options.indicatorsAsCol && !rowDimensionTree.dimensionKeys.contain(IndicatorDimensionKeyPlaceholder)) {
71189
+ isNeedResetRowDimensionTree = true;
71190
+ }
71191
+ }
71192
+ const { dataset, layoutNodeId } = results;
70864
71193
  const mockTable = {
70865
71194
  options,
71195
+ layoutNodeId,
70866
71196
  internalProps: options,
70867
71197
  isPivotChart: () => true,
70868
71198
  pivotChartAxes: [],
@@ -70874,7 +71204,13 @@
70874
71204
  };
70875
71205
  }
70876
71206
  };
70877
- const layoutMap = new PivotHeaderLayoutMap(mockTable, dataset);
71207
+ if (!options.columnTree || isNeedResetColumnDimensionTree) {
71208
+ columnDimensionTree = new DimensionTree(dataset.colHeaderTree ?? [], layoutNodeId);
71209
+ }
71210
+ if (!options.rowTree || isNeedResetRowDimensionTree) {
71211
+ rowDimensionTree = new DimensionTree(dataset.rowHeaderTree ?? [], layoutNodeId);
71212
+ }
71213
+ const layoutMap = new PivotHeaderLayoutMap(mockTable, dataset, columnDimensionTree, rowDimensionTree);
70878
71214
  for (let col = 0; col < layoutMap.colCount; col++) {
70879
71215
  for (let row = 0; row < layoutMap.rowCount; row++) {
70880
71216
  if (layoutMap.isHeader(col, row)) {
@@ -70921,7 +71257,7 @@
70921
71257
  }
70922
71258
 
70923
71259
  registerForVrender();
70924
- const version = "0.25.5";
71260
+ const version = "0.26.0-alpha.1";
70925
71261
  function getIcons() {
70926
71262
  return get$2();
70927
71263
  }