@visactor/vtable 0.25.4 → 0.26.0-alpha.0
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.
- package/cjs/PivotChart.d.ts +9 -0
- package/cjs/PivotChart.js +90 -28
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +5 -2
- package/cjs/PivotTable.js +186 -152
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +20 -15
- package/cjs/dataset/dataset.js +85 -59
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/statistics-helper.d.ts +13 -2
- package/cjs/dataset/statistics-helper.js +22 -27
- package/cjs/dataset/statistics-helper.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.d.ts +2 -1
- package/cjs/layout/chart-helper/get-chart-spec.js +3 -3
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/layout/layout-helper.d.ts +12 -0
- package/cjs/layout/layout-helper.js +52 -4
- package/cjs/layout/layout-helper.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +4 -3
- package/cjs/layout/pivot-header-layout.js +36 -46
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/tree-helper.d.ts +1 -0
- package/cjs/layout/tree-helper.js +12 -7
- package/cjs/layout/tree-helper.js.map +1 -1
- package/cjs/state/cell-move/adjust-header.js +1 -1
- package/cjs/state/cell-move/adjust-header.js.map +1 -1
- package/cjs/state/resize/update-resize-column.js +1 -1
- package/cjs/state/resize/update-resize-column.js.map +1 -1
- package/cjs/state/resize/update-resize-row.js +5 -4
- package/cjs/state/resize/update-resize-row.js.map +1 -1
- package/cjs/themes/ARCO.js +1 -1
- package/cjs/themes/BRIGHT.js +1 -1
- package/cjs/themes/DARK.js +1 -1
- package/cjs/themes/DEFAULT.js +1 -1
- package/cjs/themes/SIMPLIFY.js +1 -1
- package/cjs/tools/LimitPromiseQueue.js +1 -1
- package/cjs/tools/NumberMap.js +1 -1
- package/cjs/tools/Rect.js +1 -1
- package/cjs/tools/calc.js +1 -1
- package/cjs/tools/debounce.js +1 -1
- package/cjs/tools/get-data-path/create-dataset.d.ts +9 -1
- package/cjs/tools/get-data-path/create-dataset.js +19 -8
- package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
- package/cjs/tools/get-data-path/index.js +12 -3
- package/cjs/tools/get-data-path/index.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +6 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/common.d.ts +2 -0
- package/cjs/ts-types/common.js.map +1 -1
- package/cjs/ts-types/menu.d.ts +1 -1
- package/cjs/ts-types/menu.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +1 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +882 -546
- package/dist/vtable.min.js +2 -2
- package/es/PivotChart.d.ts +9 -0
- package/es/PivotChart.js +97 -29
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +5 -2
- package/es/PivotTable.js +188 -148
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset.d.ts +20 -15
- package/es/dataset/dataset.js +85 -59
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/statistics-helper.d.ts +13 -2
- package/es/dataset/statistics-helper.js +22 -27
- package/es/dataset/statistics-helper.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.d.ts +2 -1
- package/es/layout/chart-helper/get-chart-spec.js +3 -3
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/layout/layout-helper.d.ts +12 -0
- package/es/layout/layout-helper.js +50 -0
- package/es/layout/layout-helper.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +4 -3
- package/es/layout/pivot-header-layout.js +34 -45
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/tree-helper.d.ts +1 -0
- package/es/layout/tree-helper.js +12 -7
- package/es/layout/tree-helper.js.map +1 -1
- package/es/state/cell-move/adjust-header.js +1 -1
- package/es/state/cell-move/adjust-header.js.map +1 -1
- package/es/state/resize/update-resize-column.js +1 -1
- package/es/state/resize/update-resize-column.js.map +1 -1
- package/es/state/resize/update-resize-row.js +5 -4
- package/es/state/resize/update-resize-row.js.map +1 -1
- package/es/themes/ARCO.js +1 -1
- package/es/themes/BRIGHT.js +1 -1
- package/es/themes/DARK.js +1 -1
- package/es/themes/DEFAULT.js +1 -1
- package/es/themes/SIMPLIFY.js +1 -1
- package/es/tools/LimitPromiseQueue.js +1 -1
- package/es/tools/NumberMap.js +1 -1
- package/es/tools/Rect.js +1 -1
- package/es/tools/calc.js +1 -1
- package/es/tools/debounce.js +1 -1
- package/es/tools/get-data-path/create-dataset.d.ts +9 -1
- package/es/tools/get-data-path/create-dataset.js +20 -7
- package/es/tools/get-data-path/create-dataset.js.map +1 -1
- package/es/tools/get-data-path/index.js +15 -2
- package/es/tools/get-data-path/index.js.map +1 -1
- package/es/ts-types/base-table.d.ts +6 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/common.d.ts +2 -0
- package/es/ts-types/common.js.map +1 -1
- package/es/ts-types/menu.d.ts +1 -1
- package/es/ts-types/menu.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +1 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
33436
|
-
|
|
33437
|
-
|
|
33438
|
-
|
|
33439
|
-
|
|
33440
|
-
|
|
33441
|
-
if (
|
|
33442
|
-
|
|
33443
|
-
|
|
33444
|
-
|
|
33445
|
-
|
|
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
|
-
|
|
33450
|
-
|
|
33451
|
-
|
|
33452
|
-
|
|
33453
|
-
|
|
33454
|
-
|
|
33455
|
-
|
|
33456
|
-
|
|
33457
|
-
|
|
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
|
-
|
|
33494
|
-
|
|
33495
|
-
|
|
33496
|
-
|
|
33497
|
-
|
|
33498
|
-
|
|
33499
|
-
|
|
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
|
-
|
|
33539
|
-
|
|
33540
|
-
|
|
33541
|
-
|
|
33542
|
-
|
|
33543
|
-
|
|
33544
|
-
|
|
33545
|
-
this.
|
|
33546
|
-
|
|
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
|
-
|
|
33587
|
-
|
|
33588
|
-
|
|
33589
|
-
|
|
33590
|
-
|
|
33591
|
-
|
|
33592
|
-
|
|
33593
|
-
|
|
33594
|
-
|
|
33595
|
-
|
|
33596
|
-
|
|
33597
|
-
|
|
33598
|
-
|
|
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
|
-
|
|
33636
|
-
|
|
33637
|
-
|
|
33638
|
-
|
|
33639
|
-
|
|
33640
|
-
|
|
33641
|
-
|
|
33642
|
-
|
|
33643
|
-
|
|
33644
|
-
|
|
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.
|
|
50990
|
+
const sourceRowHeaderPaths = layoutMap.getCellHeaderPathsWithTreeNode(source.col, source.row)
|
|
50977
50991
|
.rowHeaderPaths;
|
|
50978
|
-
const targetRowHeaderPaths = layoutMap.
|
|
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.
|
|
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
|
|
51781
|
-
resizeDimensionValue = headerPath
|
|
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.
|
|
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);
|
|
@@ -58244,7 +58258,7 @@
|
|
|
58244
58258
|
return TABLE_EVENT_TYPE;
|
|
58245
58259
|
}
|
|
58246
58260
|
options;
|
|
58247
|
-
version = "0.
|
|
58261
|
+
version = "0.26.0-alpha.0";
|
|
58248
58262
|
pagination;
|
|
58249
58263
|
id = `VTable${Date.now()}`;
|
|
58250
58264
|
headerStyleCache;
|
|
@@ -61093,10 +61107,10 @@
|
|
|
61093
61107
|
}
|
|
61094
61108
|
return true;
|
|
61095
61109
|
}
|
|
61096
|
-
function checkHasCartesianChart(
|
|
61110
|
+
function checkHasCartesianChart(indicatorsDefine) {
|
|
61097
61111
|
let isHasCartesianChart = false;
|
|
61098
|
-
for (let i = 0; i <
|
|
61099
|
-
const columnObj =
|
|
61112
|
+
for (let i = 0; i < indicatorsDefine.length; i++) {
|
|
61113
|
+
const columnObj = indicatorsDefine[i];
|
|
61100
61114
|
if (columnObj.chartSpec) {
|
|
61101
61115
|
if (columnObj.chartSpec.type !== 'wordCloud' &&
|
|
61102
61116
|
columnObj.chartSpec.type !== 'radar' &&
|
|
@@ -61370,59 +61384,6 @@
|
|
|
61370
61384
|
return isHasChart;
|
|
61371
61385
|
}
|
|
61372
61386
|
|
|
61373
|
-
function checkHasAggregation(layoutMap) {
|
|
61374
|
-
const columnObjects = layoutMap.columnObjects;
|
|
61375
|
-
for (let i = 0; i < columnObjects.length; i++) {
|
|
61376
|
-
const column = columnObjects[i];
|
|
61377
|
-
if (column?.aggregation) {
|
|
61378
|
-
return true;
|
|
61379
|
-
}
|
|
61380
|
-
}
|
|
61381
|
-
return false;
|
|
61382
|
-
}
|
|
61383
|
-
function checkHasAggregationOnTop(layoutMap) {
|
|
61384
|
-
const columnObjects = layoutMap.columnObjects;
|
|
61385
|
-
let count = 0;
|
|
61386
|
-
for (let i = 0; i < columnObjects.length; i++) {
|
|
61387
|
-
const column = columnObjects[i];
|
|
61388
|
-
if (column?.aggregation) {
|
|
61389
|
-
if (Array.isArray(column?.aggregation)) {
|
|
61390
|
-
count = Math.max(count, column.aggregation.filter(item => item.showOnTop === true).length);
|
|
61391
|
-
}
|
|
61392
|
-
else if (column.aggregation.showOnTop === true) {
|
|
61393
|
-
count = Math.max(count, 1);
|
|
61394
|
-
}
|
|
61395
|
-
}
|
|
61396
|
-
}
|
|
61397
|
-
return count;
|
|
61398
|
-
}
|
|
61399
|
-
function checkHasAggregationOnBottom(layoutMap) {
|
|
61400
|
-
const columnObjects = layoutMap.columnObjects;
|
|
61401
|
-
let count = 0;
|
|
61402
|
-
for (let i = 0; i < columnObjects.length; i++) {
|
|
61403
|
-
const column = columnObjects[i];
|
|
61404
|
-
if (column?.aggregation) {
|
|
61405
|
-
if (Array.isArray(column?.aggregation)) {
|
|
61406
|
-
count = Math.max(count, column.aggregation.filter(item => item.showOnTop === false).length);
|
|
61407
|
-
}
|
|
61408
|
-
else if (column.aggregation.showOnTop === false) {
|
|
61409
|
-
count = Math.max(count, 1);
|
|
61410
|
-
}
|
|
61411
|
-
}
|
|
61412
|
-
}
|
|
61413
|
-
return count;
|
|
61414
|
-
}
|
|
61415
|
-
function checkHasTreeDefine(layoutMap) {
|
|
61416
|
-
const columnObjects = layoutMap.columnObjects;
|
|
61417
|
-
for (let i = 0; i < columnObjects.length; i++) {
|
|
61418
|
-
const column = columnObjects[i];
|
|
61419
|
-
if (column?.define?.tree) {
|
|
61420
|
-
return true;
|
|
61421
|
-
}
|
|
61422
|
-
}
|
|
61423
|
-
return false;
|
|
61424
|
-
}
|
|
61425
|
-
|
|
61426
61387
|
class DimensionTree {
|
|
61427
61388
|
sharedVar;
|
|
61428
61389
|
sizeIncludeParent = false;
|
|
@@ -61455,14 +61416,15 @@
|
|
|
61455
61416
|
this.dimensionKeys = new NumberMap();
|
|
61456
61417
|
this.tree.children = tree;
|
|
61457
61418
|
this.setTreeNode(this.tree, 0, this.tree);
|
|
61458
|
-
this.totalLevel = this.dimensionKeys.count();
|
|
61459
61419
|
}
|
|
61460
61420
|
setTreeNode(node, startIndex, parent) {
|
|
61461
61421
|
node.startIndex = startIndex;
|
|
61462
61422
|
node.startInTotal = (parent.startInTotal ?? 0) + node.startIndex;
|
|
61463
61423
|
if (node.dimensionKey ?? node.indicatorKey) {
|
|
61464
|
-
!
|
|
61424
|
+
if (!node.virtual &&
|
|
61425
|
+
!this.dimensionKeys.contain(node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey)) {
|
|
61465
61426
|
this.dimensionKeys.put(node.level, node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey);
|
|
61427
|
+
}
|
|
61466
61428
|
if (!node.id) {
|
|
61467
61429
|
node.id = ++this.sharedVar.seqId;
|
|
61468
61430
|
}
|
|
@@ -61473,6 +61435,7 @@
|
|
|
61473
61435
|
if (children?.length >= 1) {
|
|
61474
61436
|
children.forEach((n) => {
|
|
61475
61437
|
n.level = (node.level ?? 0) + 1;
|
|
61438
|
+
this.totalLevel = Math.max(this.totalLevel, n.level + 1);
|
|
61476
61439
|
size += this.setTreeNode(n, size, node);
|
|
61477
61440
|
});
|
|
61478
61441
|
}
|
|
@@ -61483,12 +61446,14 @@
|
|
|
61483
61446
|
else if (node.hierarchyState === HierarchyState.expand && children?.length >= 1) {
|
|
61484
61447
|
children.forEach((n) => {
|
|
61485
61448
|
n.level = (node.level ?? 0) + 1;
|
|
61449
|
+
this.totalLevel = Math.max(this.totalLevel, n.level + 1);
|
|
61486
61450
|
size += this.setTreeNode(n, size, node);
|
|
61487
61451
|
});
|
|
61488
61452
|
}
|
|
61489
61453
|
else if (node.hierarchyState === HierarchyState.collapse && children?.length >= 1) {
|
|
61490
61454
|
children.forEach((n) => {
|
|
61491
61455
|
n.level = (node.level ?? 0) + 1;
|
|
61456
|
+
this.totalLevel = Math.max(this.totalLevel, n.level + 1);
|
|
61492
61457
|
this.setTreeNode(n, size, node);
|
|
61493
61458
|
});
|
|
61494
61459
|
}
|
|
@@ -61499,6 +61464,7 @@
|
|
|
61499
61464
|
children?.length >= 1 &&
|
|
61500
61465
|
children.forEach((n) => {
|
|
61501
61466
|
n.level = (node.level ?? 0) + 1;
|
|
61467
|
+
this.totalLevel = Math.max(this.totalLevel, n.level + 1);
|
|
61502
61468
|
size += this.setTreeNode(n, size, node);
|
|
61503
61469
|
});
|
|
61504
61470
|
}
|
|
@@ -61507,6 +61473,7 @@
|
|
|
61507
61473
|
children?.length >= 1 &&
|
|
61508
61474
|
children.forEach((n) => {
|
|
61509
61475
|
n.level = (node.level ?? 0) + 1;
|
|
61476
|
+
this.totalLevel = Math.max(this.totalLevel, n.level + 1);
|
|
61510
61477
|
this.setTreeNode(n, size, node);
|
|
61511
61478
|
});
|
|
61512
61479
|
}
|
|
@@ -61832,6 +61799,164 @@
|
|
|
61832
61799
|
}
|
|
61833
61800
|
}
|
|
61834
61801
|
|
|
61802
|
+
function checkHasAggregation(layoutMap) {
|
|
61803
|
+
const columnObjects = layoutMap.columnObjects;
|
|
61804
|
+
for (let i = 0; i < columnObjects.length; i++) {
|
|
61805
|
+
const column = columnObjects[i];
|
|
61806
|
+
if (column?.aggregation) {
|
|
61807
|
+
return true;
|
|
61808
|
+
}
|
|
61809
|
+
}
|
|
61810
|
+
return false;
|
|
61811
|
+
}
|
|
61812
|
+
function checkHasAggregationOnTop(layoutMap) {
|
|
61813
|
+
const columnObjects = layoutMap.columnObjects;
|
|
61814
|
+
let count = 0;
|
|
61815
|
+
for (let i = 0; i < columnObjects.length; i++) {
|
|
61816
|
+
const column = columnObjects[i];
|
|
61817
|
+
if (column?.aggregation) {
|
|
61818
|
+
if (Array.isArray(column?.aggregation)) {
|
|
61819
|
+
count = Math.max(count, column.aggregation.filter(item => item.showOnTop === true).length);
|
|
61820
|
+
}
|
|
61821
|
+
else if (column.aggregation.showOnTop === true) {
|
|
61822
|
+
count = Math.max(count, 1);
|
|
61823
|
+
}
|
|
61824
|
+
}
|
|
61825
|
+
}
|
|
61826
|
+
return count;
|
|
61827
|
+
}
|
|
61828
|
+
function checkHasAggregationOnBottom(layoutMap) {
|
|
61829
|
+
const columnObjects = layoutMap.columnObjects;
|
|
61830
|
+
let count = 0;
|
|
61831
|
+
for (let i = 0; i < columnObjects.length; i++) {
|
|
61832
|
+
const column = columnObjects[i];
|
|
61833
|
+
if (column?.aggregation) {
|
|
61834
|
+
if (Array.isArray(column?.aggregation)) {
|
|
61835
|
+
count = Math.max(count, column.aggregation.filter(item => item.showOnTop === false).length);
|
|
61836
|
+
}
|
|
61837
|
+
else if (column.aggregation.showOnTop === false) {
|
|
61838
|
+
count = Math.max(count, 1);
|
|
61839
|
+
}
|
|
61840
|
+
}
|
|
61841
|
+
}
|
|
61842
|
+
return count;
|
|
61843
|
+
}
|
|
61844
|
+
function checkHasTreeDefine(layoutMap) {
|
|
61845
|
+
const columnObjects = layoutMap.columnObjects;
|
|
61846
|
+
for (let i = 0; i < columnObjects.length; i++) {
|
|
61847
|
+
const column = columnObjects[i];
|
|
61848
|
+
if (column?.define?.tree) {
|
|
61849
|
+
return true;
|
|
61850
|
+
}
|
|
61851
|
+
}
|
|
61852
|
+
return false;
|
|
61853
|
+
}
|
|
61854
|
+
function parseColKeyRowKeyForPivotTable(table, options) {
|
|
61855
|
+
let columnDimensionTree;
|
|
61856
|
+
let rowDimensionTree;
|
|
61857
|
+
let isNeedResetColumnDimensionTree = false;
|
|
61858
|
+
let isNeedResetRowDimensionTree = false;
|
|
61859
|
+
if (options.columnTree) {
|
|
61860
|
+
columnDimensionTree = new DimensionTree(table.internalProps.columnTree ?? [], table.layoutNodeId);
|
|
61861
|
+
if (table.options.indicatorsAsCol !== false &&
|
|
61862
|
+
!columnDimensionTree.dimensionKeys.contain(IndicatorDimensionKeyPlaceholder) &&
|
|
61863
|
+
options.indicators?.length >= 1) {
|
|
61864
|
+
isNeedResetColumnDimensionTree = true;
|
|
61865
|
+
}
|
|
61866
|
+
}
|
|
61867
|
+
if (options.rowTree) {
|
|
61868
|
+
rowDimensionTree = new DimensionTree(table.internalProps.rowTree ?? [], table.layoutNodeId, table.options.rowHierarchyType, table.options.rowHierarchyType === 'tree' ? table.options.rowExpandLevel ?? 1 : undefined);
|
|
61869
|
+
if (table.options.indicatorsAsCol === false &&
|
|
61870
|
+
!rowDimensionTree.dimensionKeys.contain(IndicatorDimensionKeyPlaceholder) &&
|
|
61871
|
+
options.indicators?.length >= 1) {
|
|
61872
|
+
isNeedResetRowDimensionTree = true;
|
|
61873
|
+
}
|
|
61874
|
+
}
|
|
61875
|
+
const rowKeys = rowDimensionTree?.dimensionKeys?.count
|
|
61876
|
+
? rowDimensionTree.dimensionKeys.valueArr()
|
|
61877
|
+
: options.rows?.reduce((keys, rowObj) => {
|
|
61878
|
+
if (typeof rowObj === 'string') {
|
|
61879
|
+
keys.push(rowObj);
|
|
61880
|
+
}
|
|
61881
|
+
else {
|
|
61882
|
+
keys.push(rowObj.dimensionKey);
|
|
61883
|
+
}
|
|
61884
|
+
return keys;
|
|
61885
|
+
}, []) ?? [];
|
|
61886
|
+
const columnKeys = columnDimensionTree?.dimensionKeys?.count
|
|
61887
|
+
? columnDimensionTree.dimensionKeys.valueArr()
|
|
61888
|
+
: options.columns?.reduce((keys, columnObj) => {
|
|
61889
|
+
if (typeof columnObj === 'string') {
|
|
61890
|
+
keys.push(columnObj);
|
|
61891
|
+
}
|
|
61892
|
+
else {
|
|
61893
|
+
keys.push(columnObj.dimensionKey);
|
|
61894
|
+
}
|
|
61895
|
+
return keys;
|
|
61896
|
+
}, []) ?? [];
|
|
61897
|
+
const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
|
|
61898
|
+
if (typeof indicatorObj === 'string') {
|
|
61899
|
+
keys.push(indicatorObj);
|
|
61900
|
+
}
|
|
61901
|
+
else {
|
|
61902
|
+
keys.push(indicatorObj.indicatorKey);
|
|
61903
|
+
if (indicatorObj.chartSpec) {
|
|
61904
|
+
if (table.internalProps.dataConfig?.aggregationRules) {
|
|
61905
|
+
table.internalProps.dataConfig?.aggregationRules.push({
|
|
61906
|
+
field: indicatorObj.indicatorKey,
|
|
61907
|
+
indicatorKey: indicatorObj.indicatorKey,
|
|
61908
|
+
aggregationType: AggregationType.NONE
|
|
61909
|
+
});
|
|
61910
|
+
}
|
|
61911
|
+
else if (table.internalProps.dataConfig) {
|
|
61912
|
+
table.internalProps.dataConfig.aggregationRules = [
|
|
61913
|
+
{
|
|
61914
|
+
field: indicatorObj.indicatorKey,
|
|
61915
|
+
indicatorKey: indicatorObj.indicatorKey,
|
|
61916
|
+
aggregationType: AggregationType.NONE
|
|
61917
|
+
}
|
|
61918
|
+
];
|
|
61919
|
+
}
|
|
61920
|
+
else {
|
|
61921
|
+
table.internalProps.dataConfig = {
|
|
61922
|
+
aggregationRules: [
|
|
61923
|
+
{
|
|
61924
|
+
field: indicatorObj.indicatorKey,
|
|
61925
|
+
indicatorKey: indicatorObj.indicatorKey,
|
|
61926
|
+
aggregationType: AggregationType.NONE
|
|
61927
|
+
}
|
|
61928
|
+
]
|
|
61929
|
+
};
|
|
61930
|
+
}
|
|
61931
|
+
}
|
|
61932
|
+
}
|
|
61933
|
+
return keys;
|
|
61934
|
+
}, []) ?? [];
|
|
61935
|
+
if (options.rowHierarchyType === 'tree' && (options.extensionRows?.length ?? 0) >= 1) {
|
|
61936
|
+
options.extensionRows?.forEach(extensionRow => {
|
|
61937
|
+
const extension_rowKeys = [];
|
|
61938
|
+
extensionRow.rows.forEach(row => {
|
|
61939
|
+
if (typeof row === 'string') {
|
|
61940
|
+
extension_rowKeys.push(row);
|
|
61941
|
+
}
|
|
61942
|
+
else {
|
|
61943
|
+
extension_rowKeys.push(row.dimensionKey);
|
|
61944
|
+
}
|
|
61945
|
+
});
|
|
61946
|
+
rowKeys.push(...extension_rowKeys);
|
|
61947
|
+
});
|
|
61948
|
+
}
|
|
61949
|
+
return {
|
|
61950
|
+
rowKeys,
|
|
61951
|
+
columnKeys,
|
|
61952
|
+
indicatorKeys,
|
|
61953
|
+
isNeedResetColumnDimensionTree,
|
|
61954
|
+
isNeedResetRowDimensionTree,
|
|
61955
|
+
columnDimensionTree,
|
|
61956
|
+
rowDimensionTree
|
|
61957
|
+
};
|
|
61958
|
+
}
|
|
61959
|
+
|
|
61835
61960
|
class SimpleHeaderLayoutMap {
|
|
61836
61961
|
seqId = 0;
|
|
61837
61962
|
_headerObjects;
|
|
@@ -64784,8 +64909,8 @@
|
|
|
64784
64909
|
leftRowSeriesNumberColumnCount = 0;
|
|
64785
64910
|
rightRowSeriesNumberColumn;
|
|
64786
64911
|
rightRowSeriesNumberColumnCount = 0;
|
|
64787
|
-
constructor(table, dataset) {
|
|
64788
|
-
this.sharedVar =
|
|
64912
|
+
constructor(table, dataset, columnDimensionTree, rowDimensionTree) {
|
|
64913
|
+
this.sharedVar = table.layoutNodeId;
|
|
64789
64914
|
this._table = table;
|
|
64790
64915
|
if (table.options.rowHierarchyType === 'tree') {
|
|
64791
64916
|
this.extensionRows = table.options.extensionRows;
|
|
@@ -64813,34 +64938,6 @@
|
|
|
64813
64938
|
if (dataset) {
|
|
64814
64939
|
this.rowTree = dataset.rowHeaderTree;
|
|
64815
64940
|
this.columnTree = dataset.colHeaderTree;
|
|
64816
|
-
if (this.indicatorsAsCol && this._table.isPivotChart() && checkHasCartesianChart(this)) {
|
|
64817
|
-
const supplyAxisNode = (nodes) => {
|
|
64818
|
-
nodes.forEach((node) => {
|
|
64819
|
-
if (node.children?.length) {
|
|
64820
|
-
supplyAxisNode(node.children);
|
|
64821
|
-
}
|
|
64822
|
-
else {
|
|
64823
|
-
node.children = [
|
|
64824
|
-
{
|
|
64825
|
-
dimensionKey: 'axis',
|
|
64826
|
-
value: ''
|
|
64827
|
-
}
|
|
64828
|
-
];
|
|
64829
|
-
}
|
|
64830
|
-
});
|
|
64831
|
-
};
|
|
64832
|
-
if (this.rowTree?.length) {
|
|
64833
|
-
supplyAxisNode(this.rowTree);
|
|
64834
|
-
}
|
|
64835
|
-
else {
|
|
64836
|
-
this.rowTree = [
|
|
64837
|
-
{
|
|
64838
|
-
dimensionKey: 'axis',
|
|
64839
|
-
value: ''
|
|
64840
|
-
}
|
|
64841
|
-
];
|
|
64842
|
-
}
|
|
64843
|
-
}
|
|
64844
64941
|
}
|
|
64845
64942
|
this.indicatorsDefine?.forEach(indicator => {
|
|
64846
64943
|
if (typeof indicator === 'string') {
|
|
@@ -64850,8 +64947,8 @@
|
|
|
64850
64947
|
this.indicatorKeys.push(indicator.indicatorKey);
|
|
64851
64948
|
}
|
|
64852
64949
|
});
|
|
64853
|
-
this.columnDimensionTree =
|
|
64854
|
-
this.rowDimensionTree =
|
|
64950
|
+
this.columnDimensionTree = columnDimensionTree;
|
|
64951
|
+
this.rowDimensionTree = rowDimensionTree;
|
|
64855
64952
|
this.colDimensionKeys = this.columnDimensionTree.dimensionKeys.valueArr();
|
|
64856
64953
|
this.rowDimensionKeys = this.rowDimensionTree.dimensionKeys.valueArr();
|
|
64857
64954
|
this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys);
|
|
@@ -65571,7 +65668,7 @@
|
|
|
65571
65668
|
if (this._table.isPivotChart() &&
|
|
65572
65669
|
this.indicatorsAsCol &&
|
|
65573
65670
|
!this.hasTwoIndicatorAxes &&
|
|
65574
|
-
checkHasCartesianChart(this)) {
|
|
65671
|
+
checkHasCartesianChart(this.indicatorsDefine)) {
|
|
65575
65672
|
count -= 1;
|
|
65576
65673
|
}
|
|
65577
65674
|
this.columnHeaderLevelCount = count;
|
|
@@ -65591,7 +65688,7 @@
|
|
|
65591
65688
|
this.rowHeaderLevelCount = 1 + extensionRowCount;
|
|
65592
65689
|
return;
|
|
65593
65690
|
}
|
|
65594
|
-
const rowLevelCount = this.
|
|
65691
|
+
const rowLevelCount = this.rowDimensionTree.totalLevel;
|
|
65595
65692
|
let count = rowLevelCount;
|
|
65596
65693
|
if (this.indicatorsAsCol) ;
|
|
65597
65694
|
else if (this.hideIndicatorName &&
|
|
@@ -65647,7 +65744,7 @@
|
|
|
65647
65744
|
}
|
|
65648
65745
|
return 0;
|
|
65649
65746
|
}
|
|
65650
|
-
if (this.indicatorKeys.length >= 1 && checkHasCartesianChart(this)) {
|
|
65747
|
+
if (this.indicatorKeys.length >= 1 && checkHasCartesianChart(this.indicatorsDefine)) {
|
|
65651
65748
|
const axisOption = this._table.pivotChartAxes.find(axisOption => {
|
|
65652
65749
|
return axisOption.orient === 'bottom';
|
|
65653
65750
|
});
|
|
@@ -65917,7 +66014,7 @@
|
|
|
65917
66014
|
getRecordShowIndexByCell(col, row) {
|
|
65918
66015
|
return undefined;
|
|
65919
66016
|
}
|
|
65920
|
-
|
|
66017
|
+
getCellHeaderPathsWithTreeNode(col, row) {
|
|
65921
66018
|
if (col === this._lastCellCol && row === this._lastCellRow) {
|
|
65922
66019
|
return this._lastCellHeaderPath;
|
|
65923
66020
|
}
|
|
@@ -65974,7 +66071,7 @@
|
|
|
65974
66071
|
return p;
|
|
65975
66072
|
}
|
|
65976
66073
|
getCellHeaderPaths(col, row) {
|
|
65977
|
-
const headerPathsWidthNode = this.
|
|
66074
|
+
const headerPathsWidthNode = this.getCellHeaderPathsWithTreeNode(col, row);
|
|
65978
66075
|
const headerPaths = {
|
|
65979
66076
|
colHeaderPaths: [],
|
|
65980
66077
|
rowHeaderPaths: [],
|
|
@@ -65985,6 +66082,7 @@
|
|
|
65985
66082
|
colHeaderPath.dimensionKey = colHeader.dimensionKey;
|
|
65986
66083
|
colHeaderPath.indicatorKey = colHeader.indicatorKey;
|
|
65987
66084
|
colHeaderPath.value = colHeader.value ?? this.getIndicatorInfoByIndicatorKey(colHeader.indicatorKey)?.title ?? '';
|
|
66085
|
+
colHeaderPath.virtual = colHeader.virtual;
|
|
65988
66086
|
headerPaths.colHeaderPaths.push(colHeaderPath);
|
|
65989
66087
|
});
|
|
65990
66088
|
headerPathsWidthNode.rowHeaderPaths?.forEach((rowHeader) => {
|
|
@@ -65994,6 +66092,7 @@
|
|
|
65994
66092
|
rowHeaderPath.indicatorKey = rowHeader.indicatorKey;
|
|
65995
66093
|
rowHeaderPath.value =
|
|
65996
66094
|
rowHeader.value ?? this.getIndicatorInfoByIndicatorKey(rowHeader.indicatorKey)?.title ?? '';
|
|
66095
|
+
rowHeaderPath.virtual = rowHeader.virtual;
|
|
65997
66096
|
headerPaths.rowHeaderPaths.push(rowHeaderPath);
|
|
65998
66097
|
}
|
|
65999
66098
|
});
|
|
@@ -66290,8 +66389,8 @@
|
|
|
66290
66389
|
}
|
|
66291
66390
|
else if (this.isRowHeader(source.col, source.row)) {
|
|
66292
66391
|
if (this.rowHierarchyType === 'tree') {
|
|
66293
|
-
const sourceRowHeaderPaths = cloneDeep(this.
|
|
66294
|
-
const targetRowHeaderPaths = cloneDeep(this.
|
|
66392
|
+
const sourceRowHeaderPaths = cloneDeep(this.getCellHeaderPathsWithTreeNode(source.col, source.row).rowHeaderPaths);
|
|
66393
|
+
const targetRowHeaderPaths = cloneDeep(this.getCellHeaderPathsWithTreeNode(target.col, target.row).rowHeaderPaths);
|
|
66295
66394
|
sourceRowHeaderPaths.pop();
|
|
66296
66395
|
targetRowHeaderPaths.pop();
|
|
66297
66396
|
if (sourceRowHeaderPaths.length <= targetRowHeaderPaths.length) {
|
|
@@ -66342,7 +66441,7 @@
|
|
|
66342
66441
|
const sourceColumns = this._columnWidths.splice(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceSize);
|
|
66343
66442
|
sourceColumns.unshift((targetIndex - this.leftRowSeriesNumberColumnCount), 0);
|
|
66344
66443
|
Array.prototype.splice.apply(this._columnWidths, sourceColumns);
|
|
66345
|
-
this.columnDimensionTree.movePosition(this.
|
|
66444
|
+
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);
|
|
66346
66445
|
this.columnDimensionTree.reset(this.columnDimensionTree.tree.children, true);
|
|
66347
66446
|
this._CellHeaderPathMap = new Map();
|
|
66348
66447
|
this._largeCellRangeCache.length = 0;
|
|
@@ -66356,8 +66455,8 @@
|
|
|
66356
66455
|
}
|
|
66357
66456
|
else if (this.isRowHeader(source.col, source.row)) {
|
|
66358
66457
|
let targetIndex;
|
|
66359
|
-
const sourceRowHeaderPaths = this.
|
|
66360
|
-
const targetRowHeaderPaths = this.
|
|
66458
|
+
const sourceRowHeaderPaths = this.getCellHeaderPathsWithTreeNode(source.col, source.row).rowHeaderPaths;
|
|
66459
|
+
const targetRowHeaderPaths = this.getCellHeaderPathsWithTreeNode(target.col, target.row).rowHeaderPaths;
|
|
66361
66460
|
const sourceRowHeaderNode = sourceRowHeaderPaths[sourceRowHeaderPaths.length - 1];
|
|
66362
66461
|
const targetRowHeaderNode = targetRowHeaderPaths[sourceRowHeaderPaths.length - 1];
|
|
66363
66462
|
const sourceSize = sourceRowHeaderNode.size;
|
|
@@ -66601,7 +66700,7 @@
|
|
|
66601
66700
|
if (!this._table.isPivotChart()) {
|
|
66602
66701
|
return false;
|
|
66603
66702
|
}
|
|
66604
|
-
if (this.indicatorKeys.length >= 1 && checkHasCartesianChart(this)) {
|
|
66703
|
+
if (this.indicatorKeys.length >= 1 && checkHasCartesianChart(this.indicatorsDefine)) {
|
|
66605
66704
|
if ((this.isBottomFrozenRow(col, row) && isHasCartesianChartInline(col, row, 'col', this)) ||
|
|
66606
66705
|
(this.isRightFrozenColumn(col, row) && isHasCartesianChartInline(col, row, 'row', this))) {
|
|
66607
66706
|
return true;
|
|
@@ -66667,7 +66766,18 @@
|
|
|
66667
66766
|
indicatorObject.chartInstance?.release();
|
|
66668
66767
|
});
|
|
66669
66768
|
}
|
|
66670
|
-
getHeadNode(
|
|
66769
|
+
getHeadNode(col, row) {
|
|
66770
|
+
let dimensions;
|
|
66771
|
+
const headerPaths = this.getCellHeaderPaths(col, row);
|
|
66772
|
+
if (headerPaths.rowHeaderPaths && (headerPaths.rowHeaderPaths?.length ?? 0) > 0) {
|
|
66773
|
+
dimensions = headerPaths.rowHeaderPaths?.slice(0, headerPaths.rowHeaderPaths.length);
|
|
66774
|
+
}
|
|
66775
|
+
else if (headerPaths.colHeaderPaths && headerPaths.colHeaderPaths.length > 0) {
|
|
66776
|
+
dimensions = headerPaths.colHeaderPaths.slice(0, headerPaths.colHeaderPaths.length);
|
|
66777
|
+
}
|
|
66778
|
+
return this.getHeadNodeByRowOrColDimensions(dimensions, col, row);
|
|
66779
|
+
}
|
|
66780
|
+
getHeadNodeByRowOrColDimensions(dimensions, col, row) {
|
|
66671
66781
|
if (!Array.isArray(dimensions)) {
|
|
66672
66782
|
return undefined;
|
|
66673
66783
|
}
|
|
@@ -66675,6 +66785,14 @@
|
|
|
66675
66785
|
let rowDimension;
|
|
66676
66786
|
let colArr = this.columnTree;
|
|
66677
66787
|
let colDimension;
|
|
66788
|
+
if (isValid$3(row) &&
|
|
66789
|
+
isValid$3(col) &&
|
|
66790
|
+
this.rowHierarchyType === 'tree' &&
|
|
66791
|
+
this.extensionRows &&
|
|
66792
|
+
col >= 1 + this.leftRowSeriesNumberColumnCount) {
|
|
66793
|
+
const hdId = this.getCellId(col - 1, row);
|
|
66794
|
+
rowArr = this._rowHeaderExtensionTree[hdId].tree.children;
|
|
66795
|
+
}
|
|
66678
66796
|
for (let i = 0; i < dimensions.length; i++) {
|
|
66679
66797
|
const highlightDimension = dimensions[i];
|
|
66680
66798
|
if ((highlightDimension.isPivotCorner || !highlightDimension.value) &&
|
|
@@ -66701,7 +66819,7 @@
|
|
|
66701
66819
|
if (isCol) {
|
|
66702
66820
|
continue;
|
|
66703
66821
|
}
|
|
66704
|
-
for (let k = 0; k < rowArr
|
|
66822
|
+
for (let k = 0; k < rowArr?.length ?? 0; k++) {
|
|
66705
66823
|
const dimension = rowArr[k];
|
|
66706
66824
|
if ((isValid$3(highlightDimension.dimensionKey) &&
|
|
66707
66825
|
dimension.dimensionKey === highlightDimension.dimensionKey &&
|
|
@@ -67109,15 +67227,8 @@
|
|
|
67109
67227
|
return undefined;
|
|
67110
67228
|
}
|
|
67111
67229
|
changeTreeNodeTitle(col, row, value) {
|
|
67112
|
-
const
|
|
67113
|
-
|
|
67114
|
-
const headerTreeNode = this.getHeadNode(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length));
|
|
67115
|
-
headerTreeNode.value = value;
|
|
67116
|
-
}
|
|
67117
|
-
else if (headerPaths.colHeaderPaths.length > 0) {
|
|
67118
|
-
const headerTreeNode = this.getHeadNode(headerPaths.colHeaderPaths.slice(0, headerPaths.colHeaderPaths.length));
|
|
67119
|
-
headerTreeNode.value = value;
|
|
67120
|
-
}
|
|
67230
|
+
const headerTreeNode = this.getHeadNode(col, row);
|
|
67231
|
+
headerTreeNode.value = value;
|
|
67121
67232
|
const id = this.getCellId(col, row);
|
|
67122
67233
|
this._headerObjectMap[id].title = value;
|
|
67123
67234
|
}
|
|
@@ -67440,15 +67551,15 @@
|
|
|
67440
67551
|
this.needSplitPositiveAndNegative = needSplitPositiveAndNegative ?? false;
|
|
67441
67552
|
this.rowsIsTotal = new Array(this.rows?.length ?? 0).fill(false);
|
|
67442
67553
|
this.colsIsTotal = new Array(this.columns?.length ?? 0).fill(false);
|
|
67443
|
-
if (this.totals?.row && this.totals.row.showSubTotals !== false) {
|
|
67444
|
-
for (let i = 0, len = this.totals?.row?.subTotalsDimensions?.length; i < len; i++) {
|
|
67554
|
+
if (this.totals?.row && this.totals.row.showSubTotals !== false && this.totals.row.subTotalsDimensions) {
|
|
67555
|
+
for (let i = 0, len = this.totals?.row?.subTotalsDimensions?.length ?? 0; i < len; i++) {
|
|
67445
67556
|
const dimension = this.totals.row.subTotalsDimensions[i];
|
|
67446
67557
|
const dimensionIndex = this.rows.indexOf(dimension);
|
|
67447
67558
|
this.rowsIsTotal[dimensionIndex] = true;
|
|
67448
67559
|
}
|
|
67449
67560
|
}
|
|
67450
|
-
if (this.totals?.column && this.totals.column.showSubTotals !== false) {
|
|
67451
|
-
for (let i = 0, len = this.totals?.column?.subTotalsDimensions?.length; i < len; i++) {
|
|
67561
|
+
if (this.totals?.column && this.totals.column.showSubTotals !== false && this.totals.column.subTotalsDimensions) {
|
|
67562
|
+
for (let i = 0, len = this.totals?.column?.subTotalsDimensions?.length ?? 0; i < len; i++) {
|
|
67452
67563
|
const dimension = this.totals.column.subTotalsDimensions[i];
|
|
67453
67564
|
const dimensionIndex = this.columns.indexOf(dimension);
|
|
67454
67565
|
this.colsIsTotal[dimensionIndex] = true;
|
|
@@ -67526,7 +67637,7 @@
|
|
|
67526
67637
|
}
|
|
67527
67638
|
processCollectedValuesWithSumBy() {
|
|
67528
67639
|
for (const field in this.collectedValues) {
|
|
67529
|
-
if (this.collectValuesBy[field]?.sumBy) {
|
|
67640
|
+
if (this.collectValuesBy?.[field]?.sumBy) {
|
|
67530
67641
|
for (const byKeys in this.collectedValues[field]) {
|
|
67531
67642
|
let max;
|
|
67532
67643
|
if (this.collectValuesBy[field]?.extendRange === 'sum') {
|
|
@@ -67571,17 +67682,19 @@
|
|
|
67571
67682
|
}
|
|
67572
67683
|
}
|
|
67573
67684
|
processCollectedValuesWithSortBy() {
|
|
67685
|
+
const that = this;
|
|
67574
67686
|
for (const field in this.collectedValues) {
|
|
67575
|
-
if (this.collectValuesBy[field]?.sortBy) {
|
|
67687
|
+
if (this.collectValuesBy?.[field]?.sortBy) {
|
|
67576
67688
|
for (const byKeys in this.collectedValues[field]) {
|
|
67577
|
-
this.collectedValues[field][byKeys] = this.collectedValues[field][byKeys].sort((a, b) =>
|
|
67689
|
+
this.collectedValues[field][byKeys] = this.collectedValues[field][byKeys].sort((a, b) => (that.collectValuesBy[field].sortBy?.indexOf(a) ?? -1) -
|
|
67690
|
+
(that.collectValuesBy[field].sortBy?.indexOf(b) ?? -1));
|
|
67578
67691
|
}
|
|
67579
67692
|
}
|
|
67580
67693
|
}
|
|
67581
67694
|
}
|
|
67582
67695
|
generateCollectedValuesSortRule() {
|
|
67583
67696
|
for (const field in this.collectedValues) {
|
|
67584
|
-
if (this.collectValuesBy[field] && !this.collectValuesBy[field].sortBy) {
|
|
67697
|
+
if (this.collectValuesBy && this.collectValuesBy[field] && !this.collectValuesBy[field].sortBy) {
|
|
67585
67698
|
let sortByRule = [];
|
|
67586
67699
|
for (const byKeys in this.collectedValues[field]) {
|
|
67587
67700
|
if (Array.isArray(this.collectedValues[field][byKeys])) {
|
|
@@ -67597,7 +67710,7 @@
|
|
|
67597
67710
|
}
|
|
67598
67711
|
processRecords() {
|
|
67599
67712
|
let isNeedFilter = false;
|
|
67600
|
-
if (this.dataConfig?.filterRules?.length >= 1) {
|
|
67713
|
+
if ((this.dataConfig?.filterRules?.length ?? 0) >= 1) {
|
|
67601
67714
|
isNeedFilter = true;
|
|
67602
67715
|
}
|
|
67603
67716
|
if (Array.isArray(this.records)) {
|
|
@@ -67623,25 +67736,29 @@
|
|
|
67623
67736
|
}
|
|
67624
67737
|
filterRecord(record) {
|
|
67625
67738
|
let isReserved = true;
|
|
67626
|
-
|
|
67627
|
-
|
|
67628
|
-
|
|
67629
|
-
|
|
67630
|
-
|
|
67739
|
+
if (this.dataConfig?.filterRules) {
|
|
67740
|
+
for (let i = 0; i < this.dataConfig.filterRules.length; i++) {
|
|
67741
|
+
const filterRule = this.dataConfig?.filterRules[i];
|
|
67742
|
+
if (filterRule.filterKey) {
|
|
67743
|
+
const filterValue = record[filterRule.filterKey];
|
|
67744
|
+
if (filterRule.filteredValues?.indexOf(filterValue) === -1) {
|
|
67745
|
+
isReserved = false;
|
|
67746
|
+
break;
|
|
67747
|
+
}
|
|
67748
|
+
}
|
|
67749
|
+
else if (!filterRule.filterFunc?.(record)) {
|
|
67631
67750
|
isReserved = false;
|
|
67632
67751
|
break;
|
|
67633
67752
|
}
|
|
67634
67753
|
}
|
|
67635
|
-
else if (!filterRule.filterFunc?.(record)) {
|
|
67636
|
-
isReserved = false;
|
|
67637
|
-
break;
|
|
67638
|
-
}
|
|
67639
67754
|
}
|
|
67640
67755
|
return isReserved;
|
|
67641
67756
|
}
|
|
67642
67757
|
processRecord(record, assignedIndicatorKey) {
|
|
67643
67758
|
this.derivedFieldRules?.forEach((derivedFieldRule, i) => {
|
|
67644
|
-
|
|
67759
|
+
if (derivedFieldRule.fieldName && derivedFieldRule.derivedFunc) {
|
|
67760
|
+
record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record);
|
|
67761
|
+
}
|
|
67645
67762
|
});
|
|
67646
67763
|
for (const field in this.collectValuesBy) {
|
|
67647
67764
|
if (isValid$3(record[field])) {
|
|
@@ -67664,7 +67781,9 @@
|
|
|
67664
67781
|
}
|
|
67665
67782
|
}
|
|
67666
67783
|
if (this.collectValuesBy[field].sumBy) {
|
|
67667
|
-
const sumByKeys = this.collectValuesBy[field]
|
|
67784
|
+
const sumByKeys = this.collectValuesBy[field]
|
|
67785
|
+
.sumBy.map(byField => record[byField])
|
|
67786
|
+
.join(this.stringJoinChar);
|
|
67668
67787
|
if (!this.collectedValues[field][collectKeys][sumByKeys]) {
|
|
67669
67788
|
this.collectedValues[field][collectKeys][sumByKeys] = new this.aggregators[AggregationType.SUM](field, undefined, undefined, this.needSplitPositiveAndNegative);
|
|
67670
67789
|
}
|
|
@@ -67705,7 +67824,8 @@
|
|
|
67705
67824
|
isToTalRecord = true;
|
|
67706
67825
|
break;
|
|
67707
67826
|
}
|
|
67708
|
-
else if (this.dataConfig?.totals?.row?.subTotalsDimensions
|
|
67827
|
+
else if (this.dataConfig?.totals?.row?.subTotalsDimensions &&
|
|
67828
|
+
this.dataConfig?.totals?.row?.subTotalsDimensions.indexOf(this.rows[l - 1]) >= 0) {
|
|
67709
67829
|
if (this.rowHierarchyType === 'grid') {
|
|
67710
67830
|
rowKey.push(this.rowSubTotalLabel);
|
|
67711
67831
|
}
|
|
@@ -67729,7 +67849,8 @@
|
|
|
67729
67849
|
isToTalRecord = true;
|
|
67730
67850
|
break;
|
|
67731
67851
|
}
|
|
67732
|
-
else if (this.dataConfig?.totals?.column?.subTotalsDimensions
|
|
67852
|
+
else if (this.dataConfig?.totals?.column?.subTotalsDimensions &&
|
|
67853
|
+
this.dataConfig?.totals?.column?.subTotalsDimensions.indexOf(this.columns[n - 1]) >= 0) {
|
|
67733
67854
|
colKey.push(this.colSubTotalLabel);
|
|
67734
67855
|
isToTalRecord = true;
|
|
67735
67856
|
break;
|
|
@@ -67781,31 +67902,35 @@
|
|
|
67781
67902
|
}
|
|
67782
67903
|
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
67783
67904
|
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
67784
|
-
|
|
67785
|
-
this.tree[flatRowKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
|
|
67786
|
-
this.indicators?.find((indicator) => {
|
|
67787
|
-
if (typeof indicator !== 'string') {
|
|
67788
|
-
return indicator.indicatorKey === this.indicatorKeys[i];
|
|
67789
|
-
}
|
|
67790
|
-
return false;
|
|
67791
|
-
})?.format);
|
|
67792
|
-
}
|
|
67905
|
+
let needAddToAggregator = false;
|
|
67793
67906
|
if (assignedIndicatorKey) {
|
|
67794
|
-
this.indicatorKeys[i] === assignedIndicatorKey &&
|
|
67907
|
+
this.indicatorKeys[i] === assignedIndicatorKey && (needAddToAggregator = true);
|
|
67795
67908
|
}
|
|
67796
67909
|
else if (aggRule?.field) {
|
|
67797
67910
|
if (typeof aggRule?.field === 'string') {
|
|
67798
|
-
aggRule?.field in record &&
|
|
67911
|
+
aggRule?.field in record && (needAddToAggregator = true);
|
|
67799
67912
|
}
|
|
67800
67913
|
else {
|
|
67801
67914
|
const isPush = aggRule?.field.find((field) => {
|
|
67802
67915
|
return field in record;
|
|
67803
67916
|
});
|
|
67804
|
-
isPush &&
|
|
67917
|
+
isPush && (needAddToAggregator = true);
|
|
67805
67918
|
}
|
|
67806
67919
|
}
|
|
67807
67920
|
else {
|
|
67808
|
-
this.indicatorKeys[i] in record &&
|
|
67921
|
+
this.indicatorKeys[i] in record && (needAddToAggregator = true);
|
|
67922
|
+
}
|
|
67923
|
+
if (!this.tree[flatRowKey]?.[flatColKey]?.[i] && needAddToAggregator) {
|
|
67924
|
+
this.tree[flatRowKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
|
|
67925
|
+
this.indicators?.find((indicator) => {
|
|
67926
|
+
if (typeof indicator !== 'string') {
|
|
67927
|
+
return indicator.indicatorKey === this.indicatorKeys[i];
|
|
67928
|
+
}
|
|
67929
|
+
return false;
|
|
67930
|
+
})?.format);
|
|
67931
|
+
}
|
|
67932
|
+
if (needAddToAggregator) {
|
|
67933
|
+
this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
|
|
67809
67934
|
}
|
|
67810
67935
|
}
|
|
67811
67936
|
}
|
|
@@ -67884,12 +68009,22 @@
|
|
|
67884
68009
|
flatRowKey = rowKey;
|
|
67885
68010
|
}
|
|
67886
68011
|
else {
|
|
68012
|
+
rowKey.map((key, i) => {
|
|
68013
|
+
if (key === indicator) {
|
|
68014
|
+
rowKey.splice(i, 1);
|
|
68015
|
+
}
|
|
68016
|
+
});
|
|
67887
68017
|
flatRowKey = rowKey.join(this.stringJoinChar);
|
|
67888
68018
|
}
|
|
67889
68019
|
if (typeof colKey === 'string') {
|
|
67890
68020
|
flatColKey = colKey;
|
|
67891
68021
|
}
|
|
67892
68022
|
else {
|
|
68023
|
+
colKey.map((key, i) => {
|
|
68024
|
+
if (key === indicator) {
|
|
68025
|
+
colKey.splice(i, 1);
|
|
68026
|
+
}
|
|
68027
|
+
});
|
|
67893
68028
|
flatColKey = colKey.join(this.stringJoinChar);
|
|
67894
68029
|
}
|
|
67895
68030
|
const agg = this.tree[flatRowKey]?.[flatColKey]?.[indicatorIndex];
|
|
@@ -67943,9 +68078,6 @@
|
|
|
67943
68078
|
value() {
|
|
67944
68079
|
return null;
|
|
67945
68080
|
},
|
|
67946
|
-
formatValue() {
|
|
67947
|
-
return '';
|
|
67948
|
-
},
|
|
67949
68081
|
clearCacheValue() {
|
|
67950
68082
|
},
|
|
67951
68083
|
reset() {
|
|
@@ -68074,8 +68206,8 @@
|
|
|
68074
68206
|
}
|
|
68075
68207
|
totalStatistics() {
|
|
68076
68208
|
const that = this;
|
|
68077
|
-
if (that?.totals?.column?.subTotalsDimensions?.length >= 1 ||
|
|
68078
|
-
that?.totals?.row?.subTotalsDimensions?.length >= 1 ||
|
|
68209
|
+
if ((that?.totals?.column?.subTotalsDimensions && that?.totals?.column?.subTotalsDimensions?.length >= 1) ||
|
|
68210
|
+
(that?.totals?.row?.subTotalsDimensions && that?.totals?.row?.subTotalsDimensions?.length >= 1) ||
|
|
68079
68211
|
that?.totals?.column?.showGrandTotals ||
|
|
68080
68212
|
that?.totals?.row?.showGrandTotals) {
|
|
68081
68213
|
const rowTotalKeys = [];
|
|
@@ -68085,32 +68217,34 @@
|
|
|
68085
68217
|
return;
|
|
68086
68218
|
}
|
|
68087
68219
|
const colKey = flatColKey.split(this.stringJoinChar);
|
|
68088
|
-
|
|
68089
|
-
|
|
68090
|
-
|
|
68091
|
-
|
|
68092
|
-
|
|
68093
|
-
|
|
68094
|
-
|
|
68095
|
-
|
|
68096
|
-
|
|
68097
|
-
|
|
68098
|
-
|
|
68099
|
-
|
|
68100
|
-
this.tree[flatRowKey][flatColTotalKey]
|
|
68101
|
-
|
|
68102
|
-
|
|
68103
|
-
|
|
68104
|
-
|
|
68105
|
-
|
|
68106
|
-
this.
|
|
68107
|
-
|
|
68108
|
-
|
|
68109
|
-
|
|
68110
|
-
|
|
68111
|
-
|
|
68220
|
+
if (that.totals?.column?.subTotalsDimensions) {
|
|
68221
|
+
for (let i = 0, len = that.totals?.column?.subTotalsDimensions?.length; i < len; i++) {
|
|
68222
|
+
const dimension = that.totals.column.subTotalsDimensions[i];
|
|
68223
|
+
const dimensionIndex = that.columns.indexOf(dimension);
|
|
68224
|
+
if (dimensionIndex >= 0) {
|
|
68225
|
+
const colTotalKey = colKey.slice(0, dimensionIndex + 1);
|
|
68226
|
+
colTotalKey.push(that.colSubTotalLabel);
|
|
68227
|
+
const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
|
|
68228
|
+
if (this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey]) {
|
|
68229
|
+
this.tree[flatRowKey][flatColTotalKey] = this.totalRecordsTree?.[flatRowKey]?.[flatColTotalKey];
|
|
68230
|
+
return;
|
|
68231
|
+
}
|
|
68232
|
+
if (!this.tree[flatRowKey][flatColTotalKey]) {
|
|
68233
|
+
this.tree[flatRowKey][flatColTotalKey] = [];
|
|
68234
|
+
}
|
|
68235
|
+
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
68236
|
+
if (!this.tree[flatRowKey][flatColTotalKey][i]) {
|
|
68237
|
+
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
68238
|
+
this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
|
|
68239
|
+
this.indicators?.find((indicator) => {
|
|
68240
|
+
if (typeof indicator !== 'string') {
|
|
68241
|
+
return indicator.indicatorKey === this.indicatorKeys[i];
|
|
68242
|
+
}
|
|
68243
|
+
return false;
|
|
68244
|
+
})?.format);
|
|
68245
|
+
}
|
|
68246
|
+
this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
|
|
68112
68247
|
}
|
|
68113
|
-
this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
|
|
68114
68248
|
}
|
|
68115
68249
|
}
|
|
68116
68250
|
}
|
|
@@ -68141,34 +68275,36 @@
|
|
|
68141
68275
|
Object.keys(that.tree).forEach(flatRowKey => {
|
|
68142
68276
|
const rowKey = flatRowKey.split(this.stringJoinChar);
|
|
68143
68277
|
Object.keys(that.tree[flatRowKey]).forEach(flatColKey => {
|
|
68144
|
-
|
|
68145
|
-
|
|
68146
|
-
|
|
68147
|
-
|
|
68148
|
-
|
|
68149
|
-
|
|
68150
|
-
|
|
68151
|
-
|
|
68152
|
-
|
|
68153
|
-
|
|
68154
|
-
this.tree[flatRowTotalKey]
|
|
68155
|
-
|
|
68156
|
-
|
|
68157
|
-
|
|
68158
|
-
this.tree[flatRowTotalKey][flatColKey]
|
|
68159
|
-
|
|
68160
|
-
|
|
68161
|
-
|
|
68162
|
-
|
|
68163
|
-
|
|
68164
|
-
this.
|
|
68165
|
-
|
|
68166
|
-
|
|
68167
|
-
|
|
68168
|
-
|
|
68169
|
-
|
|
68278
|
+
if (that.totals?.row?.subTotalsDimensions) {
|
|
68279
|
+
for (let i = 0, len = that.totals?.row?.subTotalsDimensions?.length; i < len; i++) {
|
|
68280
|
+
const dimension = that.totals.row.subTotalsDimensions[i];
|
|
68281
|
+
const dimensionIndex = that.rows.indexOf(dimension);
|
|
68282
|
+
if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
|
|
68283
|
+
const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
|
|
68284
|
+
if (this.rowHierarchyType === 'grid') {
|
|
68285
|
+
rowTotalKey.push(that.rowSubTotalLabel);
|
|
68286
|
+
}
|
|
68287
|
+
const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
|
|
68288
|
+
if (!this.tree[flatRowTotalKey]) {
|
|
68289
|
+
this.tree[flatRowTotalKey] = {};
|
|
68290
|
+
rowTotalKeys.push(flatRowTotalKey);
|
|
68291
|
+
}
|
|
68292
|
+
if (!this.tree[flatRowTotalKey][flatColKey]) {
|
|
68293
|
+
this.tree[flatRowTotalKey][flatColKey] = [];
|
|
68294
|
+
}
|
|
68295
|
+
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
68296
|
+
if (!this.tree[flatRowTotalKey][flatColKey][i]) {
|
|
68297
|
+
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
68298
|
+
this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[aggRule?.aggregationType ?? AggregationType.SUM](aggRule?.field ?? this.indicatorKeys[i], aggRule?.formatFun ??
|
|
68299
|
+
this.indicators?.find((indicator) => {
|
|
68300
|
+
if (typeof indicator !== 'string') {
|
|
68301
|
+
return indicator.indicatorKey === this.indicatorKeys[i];
|
|
68302
|
+
}
|
|
68303
|
+
return false;
|
|
68304
|
+
})?.format);
|
|
68305
|
+
}
|
|
68306
|
+
this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
|
|
68170
68307
|
}
|
|
68171
|
-
this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
|
|
68172
68308
|
}
|
|
68173
68309
|
}
|
|
68174
68310
|
}
|
|
@@ -68220,7 +68356,7 @@
|
|
|
68220
68356
|
item = {
|
|
68221
68357
|
value,
|
|
68222
68358
|
dimensionKey: rows[index],
|
|
68223
|
-
children: index === list.length - 1 && indicators?.length >= 1
|
|
68359
|
+
children: index === list.length - 1 && (indicators?.length ?? 0) >= 1
|
|
68224
68360
|
? indicators?.map(indicator => {
|
|
68225
68361
|
if (typeof indicator === 'string') {
|
|
68226
68362
|
return {
|
|
@@ -68267,7 +68403,7 @@
|
|
|
68267
68403
|
item = {
|
|
68268
68404
|
value,
|
|
68269
68405
|
dimensionKey: rows[index],
|
|
68270
|
-
children: index === list.length - 1 && indicators?.length >= 1
|
|
68406
|
+
children: index === list.length - 1 && (indicators?.length ?? 0) >= 1
|
|
68271
68407
|
? indicators?.map(indicator => {
|
|
68272
68408
|
if (typeof indicator === 'string') {
|
|
68273
68409
|
return {
|
|
@@ -68283,12 +68419,12 @@
|
|
|
68283
68419
|
: []
|
|
68284
68420
|
};
|
|
68285
68421
|
if (subTotalFlags[index]) {
|
|
68286
|
-
let curChild = item.children;
|
|
68422
|
+
let curChild = item.children ?? [];
|
|
68287
68423
|
const totalChild = {
|
|
68288
68424
|
value: subTotalLabel,
|
|
68289
68425
|
dimensionKey: rows[index + 1],
|
|
68290
68426
|
levelSpan: subTotalFlags.length - index - 1,
|
|
68291
|
-
children: indicators?.length >= 1
|
|
68427
|
+
children: (indicators?.length ?? 0) >= 1
|
|
68292
68428
|
? indicators?.map(indicator => {
|
|
68293
68429
|
if (typeof indicator === 'string') {
|
|
68294
68430
|
return {
|
|
@@ -68304,7 +68440,7 @@
|
|
|
68304
68440
|
: []
|
|
68305
68441
|
};
|
|
68306
68442
|
curChild.push(totalChild);
|
|
68307
|
-
curChild = totalChild.children;
|
|
68443
|
+
curChild = totalChild.children ?? [];
|
|
68308
68444
|
}
|
|
68309
68445
|
map.set(flatKey, item);
|
|
68310
68446
|
if (node) {
|
|
@@ -68327,6 +68463,9 @@
|
|
|
68327
68463
|
}
|
|
68328
68464
|
else if (indicators) {
|
|
68329
68465
|
result = indicators?.map((indicator) => {
|
|
68466
|
+
if (typeof indicator === 'string') {
|
|
68467
|
+
return { indicatorKey: indicator, value: indicator };
|
|
68468
|
+
}
|
|
68330
68469
|
return { indicatorKey: indicator.indicatorKey, value: indicator.title ?? indicator.indicatorKey };
|
|
68331
68470
|
});
|
|
68332
68471
|
}
|
|
@@ -68390,6 +68529,9 @@
|
|
|
68390
68529
|
!isHasIndicator &&
|
|
68391
68530
|
(!node.children?.length || !node.children)) {
|
|
68392
68531
|
node.children = this.indicators?.map((indicator) => {
|
|
68532
|
+
if (typeof indicator === 'string') {
|
|
68533
|
+
return { indicatorKey: indicator, value: indicator };
|
|
68534
|
+
}
|
|
68393
68535
|
return { indicatorKey: indicator.indicatorKey, value: indicator.title ?? indicator.indicatorKey };
|
|
68394
68536
|
});
|
|
68395
68537
|
}
|
|
@@ -68403,6 +68545,9 @@
|
|
|
68403
68545
|
}
|
|
68404
68546
|
else {
|
|
68405
68547
|
customTree = this.indicators?.map((indicator) => {
|
|
68548
|
+
if (typeof indicator === 'string') {
|
|
68549
|
+
return { indicatorKey: indicator, value: indicator };
|
|
68550
|
+
}
|
|
68406
68551
|
return { indicatorKey: indicator.indicatorKey, value: indicator.title ?? indicator.indicatorKey };
|
|
68407
68552
|
});
|
|
68408
68553
|
}
|
|
@@ -68469,6 +68614,19 @@
|
|
|
68469
68614
|
this.processRecords();
|
|
68470
68615
|
}
|
|
68471
68616
|
}
|
|
68617
|
+
changeDataConfig(dataConfig) {
|
|
68618
|
+
this.rows = dataConfig.rows;
|
|
68619
|
+
this.columns = dataConfig.columns;
|
|
68620
|
+
}
|
|
68621
|
+
addRecords(records) {
|
|
68622
|
+
for (let i = 0, len = records.length; i < len; i++) {
|
|
68623
|
+
const record = records[i];
|
|
68624
|
+
this.processRecord(record);
|
|
68625
|
+
}
|
|
68626
|
+
if (Array.isArray(this.records)) {
|
|
68627
|
+
this.records.push(records);
|
|
68628
|
+
}
|
|
68629
|
+
}
|
|
68472
68630
|
}
|
|
68473
68631
|
function arraySortByAnotherArray(array, sortArray) {
|
|
68474
68632
|
return array.sort((a, b) => {
|
|
@@ -68485,6 +68643,7 @@
|
|
|
68485
68643
|
}
|
|
68486
68644
|
|
|
68487
68645
|
class PivotTable extends BaseTable {
|
|
68646
|
+
layoutNodeId = { seqId: 0 };
|
|
68488
68647
|
pivotSortState;
|
|
68489
68648
|
editorManager;
|
|
68490
68649
|
dataset;
|
|
@@ -68504,96 +68663,77 @@
|
|
|
68504
68663
|
}
|
|
68505
68664
|
}
|
|
68506
68665
|
super(container, options);
|
|
68507
|
-
if (options
|
|
68508
|
-
|
|
68509
|
-
|
|
68510
|
-
this.internalProps.columns = cloneDeep(options.columns);
|
|
68511
|
-
this.internalProps.rows = cloneDeep(options.rows);
|
|
68512
|
-
this.internalProps.indicators = cloneDeepSpec(options.indicators);
|
|
68513
|
-
options.indicators?.forEach((indicatorDefine, index) => {
|
|
68514
|
-
if (typeof indicatorDefine === 'object' && indicatorDefine?.editor) {
|
|
68515
|
-
this.internalProps.indicators[index].editor = indicatorDefine.editor;
|
|
68666
|
+
if (options) {
|
|
68667
|
+
if (options.layout) {
|
|
68668
|
+
Object.assign(options, options.layout);
|
|
68516
68669
|
}
|
|
68517
|
-
|
|
68518
|
-
|
|
68519
|
-
|
|
68520
|
-
|
|
68521
|
-
|
|
68522
|
-
|
|
68523
|
-
this.pagination = options.pagination;
|
|
68524
|
-
this.internalProps.columnResizeType = options.columnResizeType ?? 'column';
|
|
68525
|
-
this.internalProps.rowResizeType = options.rowResizeType ?? 'row';
|
|
68526
|
-
this.internalProps.dataConfig = cloneDeep(options.dataConfig);
|
|
68527
|
-
if (!options.rowTree && !options.columnTree) {
|
|
68528
|
-
this.internalProps.enableDataAnalysis = true;
|
|
68529
|
-
}
|
|
68530
|
-
else {
|
|
68531
|
-
this.internalProps.enableDataAnalysis = false;
|
|
68532
|
-
}
|
|
68533
|
-
const records = this.internalProps.records;
|
|
68534
|
-
if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {
|
|
68535
|
-
const rowKeys = options.rows?.reduce((keys, rowObj) => {
|
|
68536
|
-
if (typeof rowObj === 'string') {
|
|
68537
|
-
keys.push(rowObj);
|
|
68538
|
-
}
|
|
68539
|
-
else {
|
|
68540
|
-
keys.push(rowObj.dimensionKey);
|
|
68541
|
-
}
|
|
68542
|
-
return keys;
|
|
68543
|
-
}, []) ?? [];
|
|
68544
|
-
const columnKeys = options.columns?.reduce((keys, columnObj) => {
|
|
68545
|
-
if (typeof columnObj === 'string') {
|
|
68546
|
-
keys.push(columnObj);
|
|
68670
|
+
this.internalProps.columns = cloneDeep(options.columns);
|
|
68671
|
+
this.internalProps.rows = cloneDeep(options.rows);
|
|
68672
|
+
this.internalProps.indicators = cloneDeepSpec(options.indicators);
|
|
68673
|
+
options.indicators?.forEach((indicatorDefine, index) => {
|
|
68674
|
+
if (typeof indicatorDefine === 'object' && indicatorDefine?.editor) {
|
|
68675
|
+
this.internalProps.indicators[index].editor = indicatorDefine.editor;
|
|
68547
68676
|
}
|
|
68548
|
-
|
|
68549
|
-
|
|
68677
|
+
});
|
|
68678
|
+
this.internalProps.columnTree =
|
|
68679
|
+
options.indicatorsAsCol && !options.columns?.length && !options.columnTree ? [] : cloneDeep(options.columnTree);
|
|
68680
|
+
this.internalProps.rowTree =
|
|
68681
|
+
!options.indicatorsAsCol && !options.rows?.length && !options.rowTree ? [] : cloneDeep(options.rowTree);
|
|
68682
|
+
this.internalProps.records = options.records;
|
|
68683
|
+
this.pagination = options.pagination;
|
|
68684
|
+
this.internalProps.columnResizeType = options.columnResizeType ?? 'column';
|
|
68685
|
+
this.internalProps.rowResizeType = options.rowResizeType ?? 'row';
|
|
68686
|
+
this.internalProps.dataConfig = cloneDeep(options.dataConfig);
|
|
68687
|
+
const records = this.internalProps.records;
|
|
68688
|
+
this.internalProps.recordsIsTwoDimensionalArray = false;
|
|
68689
|
+
if (records?.[0]?.constructor === Array) {
|
|
68690
|
+
this.internalProps.recordsIsTwoDimensionalArray = true;
|
|
68691
|
+
}
|
|
68692
|
+
if (options.customConfig?.enableDataAnalysis === false) {
|
|
68693
|
+
const columnDimensionTree = new DimensionTree(this.internalProps.columnTree ?? [], this.layoutNodeId);
|
|
68694
|
+
const rowDimensionTree = new DimensionTree(this.internalProps.rowTree ?? [], this.layoutNodeId, this.options.rowHierarchyType, this.options.rowHierarchyType === 'tree' ? this.options.rowExpandLevel ?? 1 : undefined);
|
|
68695
|
+
this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, null, columnDimensionTree, rowDimensionTree);
|
|
68696
|
+
if (this.internalProps.recordsIsTwoDimensionalArray === false) {
|
|
68697
|
+
this.flatDataToObjects = new FlatDataToObjects({
|
|
68698
|
+
rows: this.internalProps.layoutMap.fullRowDimensionKeys,
|
|
68699
|
+
columns: this.internalProps.layoutMap.colDimensionKeys,
|
|
68700
|
+
indicators: this.internalProps.layoutMap.indicatorKeys,
|
|
68701
|
+
indicatorsAsCol: this.internalProps.layoutMap.indicatorsAsCol,
|
|
68702
|
+
indicatorDimensionKey: this.internalProps.layoutMap.indicatorDimensionKey
|
|
68703
|
+
}, records);
|
|
68550
68704
|
}
|
|
68551
|
-
|
|
68552
|
-
|
|
68553
|
-
|
|
68554
|
-
|
|
68555
|
-
|
|
68705
|
+
}
|
|
68706
|
+
else {
|
|
68707
|
+
const keysResults = parseColKeyRowKeyForPivotTable(this, options);
|
|
68708
|
+
const { rowKeys, columnKeys, indicatorKeys, isNeedResetColumnDimensionTree, isNeedResetRowDimensionTree } = keysResults;
|
|
68709
|
+
let { columnDimensionTree, rowDimensionTree } = keysResults;
|
|
68710
|
+
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);
|
|
68711
|
+
if (!options.columnTree || isNeedResetColumnDimensionTree) {
|
|
68712
|
+
columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
|
|
68556
68713
|
}
|
|
68557
|
-
|
|
68558
|
-
|
|
68714
|
+
if (!options.rowTree || isNeedResetRowDimensionTree) {
|
|
68715
|
+
rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId, this.options.rowHierarchyType, this.options.rowHierarchyType === 'tree' ? this.options.rowExpandLevel ?? 1 : undefined);
|
|
68559
68716
|
}
|
|
68560
|
-
|
|
68561
|
-
}, []) ?? [];
|
|
68562
|
-
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);
|
|
68563
|
-
this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
|
|
68564
|
-
}
|
|
68565
|
-
else if (Array.isArray(this.internalProps.columnTree) || Array.isArray(this.internalProps.rowTree)) {
|
|
68566
|
-
this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, null);
|
|
68567
|
-
if (records?.[0]?.constructor !== Array) {
|
|
68568
|
-
this.flatDataToObjects = new FlatDataToObjects({
|
|
68569
|
-
rows: this.internalProps.layoutMap.fullRowDimensionKeys,
|
|
68570
|
-
columns: this.internalProps.layoutMap.colDimensionKeys,
|
|
68571
|
-
indicators: this.internalProps.layoutMap.indicatorKeys,
|
|
68572
|
-
indicatorsAsCol: this.internalProps.layoutMap.indicatorsAsCol,
|
|
68573
|
-
indicatorDimensionKey: this.internalProps.layoutMap.indicatorDimensionKey
|
|
68574
|
-
}, records);
|
|
68717
|
+
this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
|
|
68575
68718
|
}
|
|
68719
|
+
this.pivotSortState = [];
|
|
68720
|
+
if (options.pivotSortState) {
|
|
68721
|
+
this.updatePivotSortState(options.pivotSortState);
|
|
68722
|
+
}
|
|
68723
|
+
if (Env.mode !== 'node') {
|
|
68724
|
+
this.editorManager = new EditManeger(this);
|
|
68725
|
+
}
|
|
68726
|
+
this.refreshHeader();
|
|
68727
|
+
this.stateManager.initCheckedState(records);
|
|
68728
|
+
this.scenegraph.createSceneGraph();
|
|
68729
|
+
if (options.title) {
|
|
68730
|
+
this.internalProps.title = new Title(options.title, this);
|
|
68731
|
+
this.scenegraph.resize();
|
|
68732
|
+
}
|
|
68733
|
+
setTimeout(() => {
|
|
68734
|
+
this.fireListeners(TABLE_EVENT_TYPE.INITIALIZED, null);
|
|
68735
|
+
}, 0);
|
|
68576
68736
|
}
|
|
68577
|
-
else {
|
|
68578
|
-
return;
|
|
68579
|
-
}
|
|
68580
|
-
this.pivotSortState = [];
|
|
68581
|
-
if (options.pivotSortState) {
|
|
68582
|
-
this.updatePivotSortState(options.pivotSortState);
|
|
68583
|
-
}
|
|
68584
|
-
if (Env.mode !== 'node') {
|
|
68585
|
-
this.editorManager = new EditManeger(this);
|
|
68586
|
-
}
|
|
68587
|
-
this.refreshHeader();
|
|
68588
|
-
this.stateManager.initCheckedState(records);
|
|
68589
|
-
this.scenegraph.createSceneGraph();
|
|
68590
|
-
if (options.title) {
|
|
68591
|
-
this.internalProps.title = new Title(options.title, this);
|
|
68592
|
-
this.scenegraph.resize();
|
|
68593
|
-
}
|
|
68594
|
-
setTimeout(() => {
|
|
68595
|
-
this.fireListeners(TABLE_EVENT_TYPE.INITIALIZED, null);
|
|
68596
|
-
}, 0);
|
|
68597
68737
|
}
|
|
68598
68738
|
static get EVENT_TYPE() {
|
|
68599
68739
|
return PIVOT_TABLE_EVENT_TYPE;
|
|
@@ -68625,6 +68765,7 @@
|
|
|
68625
68765
|
updateOption(options) {
|
|
68626
68766
|
const internalProps = this.internalProps;
|
|
68627
68767
|
super.updateOption(options);
|
|
68768
|
+
this.layoutNodeId = { seqId: 0 };
|
|
68628
68769
|
this.internalProps.columns = cloneDeep(options.columns);
|
|
68629
68770
|
this.internalProps.rows = cloneDeep(options.rows);
|
|
68630
68771
|
this.internalProps.indicators = !options.indicators?.length ? [] : cloneDeepSpec(options.indicators);
|
|
@@ -68644,12 +68785,6 @@
|
|
|
68644
68785
|
internalProps.columnResizeType = options.columnResizeType ?? 'column';
|
|
68645
68786
|
internalProps.rowResizeType = options.rowResizeType ?? 'row';
|
|
68646
68787
|
internalProps.dataConfig = cloneDeep(options.dataConfig);
|
|
68647
|
-
if (!options.rowTree && !options.columnTree) {
|
|
68648
|
-
internalProps.enableDataAnalysis = true;
|
|
68649
|
-
}
|
|
68650
|
-
else {
|
|
68651
|
-
internalProps.enableDataAnalysis = false;
|
|
68652
|
-
}
|
|
68653
68788
|
if (options?.rowHierarchyType === 'tree' &&
|
|
68654
68789
|
this.internalProps.layoutMap.rowHierarchyType === 'tree' &&
|
|
68655
68790
|
this.internalProps.layoutMap.rowExpandLevel === options?.rowExpandLevel) {
|
|
@@ -68662,40 +68797,21 @@
|
|
|
68662
68797
|
});
|
|
68663
68798
|
}
|
|
68664
68799
|
const records = this.internalProps.records;
|
|
68665
|
-
|
|
68666
|
-
|
|
68667
|
-
|
|
68668
|
-
keys.push(rowObj);
|
|
68669
|
-
}
|
|
68670
|
-
else {
|
|
68671
|
-
keys.push(rowObj.dimensionKey);
|
|
68672
|
-
}
|
|
68673
|
-
return keys;
|
|
68674
|
-
}, []);
|
|
68675
|
-
const columnKeys = options.columns?.reduce((keys, columnObj) => {
|
|
68676
|
-
if (typeof columnObj === 'string') {
|
|
68677
|
-
keys.push(columnObj);
|
|
68678
|
-
}
|
|
68679
|
-
else {
|
|
68680
|
-
keys.push(columnObj.dimensionKey);
|
|
68681
|
-
}
|
|
68682
|
-
return keys;
|
|
68683
|
-
}, []);
|
|
68684
|
-
const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
|
|
68685
|
-
if (typeof indicatorObj === 'string') {
|
|
68686
|
-
keys.push(indicatorObj);
|
|
68687
|
-
}
|
|
68688
|
-
else {
|
|
68689
|
-
keys.push(indicatorObj.indicatorKey);
|
|
68690
|
-
}
|
|
68691
|
-
return keys;
|
|
68692
|
-
}, []);
|
|
68693
|
-
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);
|
|
68694
|
-
internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
|
|
68800
|
+
this.internalProps.recordsIsTwoDimensionalArray = false;
|
|
68801
|
+
if (records?.[0]?.constructor === Array) {
|
|
68802
|
+
this.internalProps.recordsIsTwoDimensionalArray = true;
|
|
68695
68803
|
}
|
|
68696
|
-
|
|
68697
|
-
|
|
68698
|
-
|
|
68804
|
+
if (options.customConfig?.enableDataAnalysis === false) {
|
|
68805
|
+
let columnDimensionTree;
|
|
68806
|
+
let rowDimensionTree;
|
|
68807
|
+
if (options.columnTree) {
|
|
68808
|
+
columnDimensionTree = new DimensionTree(this.internalProps.columnTree ?? [], this.layoutNodeId);
|
|
68809
|
+
}
|
|
68810
|
+
if (options.rowTree) {
|
|
68811
|
+
rowDimensionTree = new DimensionTree(this.internalProps.rowTree ?? [], this.layoutNodeId, this.options.rowHierarchyType, this.options.rowHierarchyType === 'tree' ? this.options.rowExpandLevel ?? 1 : undefined);
|
|
68812
|
+
}
|
|
68813
|
+
internalProps.layoutMap = new PivotHeaderLayoutMap(this, null, columnDimensionTree, rowDimensionTree);
|
|
68814
|
+
if (this.internalProps.recordsIsTwoDimensionalArray === false) {
|
|
68699
68815
|
this.flatDataToObjects = new FlatDataToObjects({
|
|
68700
68816
|
rows: internalProps.layoutMap.fullRowDimensionKeys,
|
|
68701
68817
|
columns: internalProps.layoutMap.colDimensionKeys,
|
|
@@ -68706,7 +68822,17 @@
|
|
|
68706
68822
|
}
|
|
68707
68823
|
}
|
|
68708
68824
|
else {
|
|
68709
|
-
|
|
68825
|
+
const keysResults = parseColKeyRowKeyForPivotTable(this, options);
|
|
68826
|
+
const { rowKeys, columnKeys, indicatorKeys, isNeedResetColumnDimensionTree, isNeedResetRowDimensionTree } = keysResults;
|
|
68827
|
+
let { columnDimensionTree, rowDimensionTree } = keysResults;
|
|
68828
|
+
this.dataset = new Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, options.indicatorsAsCol ?? true, records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree);
|
|
68829
|
+
if (!options.columnTree || isNeedResetColumnDimensionTree) {
|
|
68830
|
+
columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
|
|
68831
|
+
}
|
|
68832
|
+
if (!options.rowTree || isNeedResetRowDimensionTree) {
|
|
68833
|
+
rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId, this.options.rowHierarchyType, this.options.rowHierarchyType === 'tree' ? this.options.rowExpandLevel ?? 1 : undefined);
|
|
68834
|
+
}
|
|
68835
|
+
internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
|
|
68710
68836
|
}
|
|
68711
68837
|
this.pivotSortState = [];
|
|
68712
68838
|
if (options.pivotSortState) {
|
|
@@ -68819,7 +68945,12 @@
|
|
|
68819
68945
|
if (table.internalProps.layoutMap.isHeader(col, row)) {
|
|
68820
68946
|
return undefined;
|
|
68821
68947
|
}
|
|
68822
|
-
if (this.
|
|
68948
|
+
if (this.internalProps.recordsIsTwoDimensionalArray) {
|
|
68949
|
+
const rowIndex = this.getBodyIndexByRow(row);
|
|
68950
|
+
const colIndex = this.getBodyIndexByCol(col);
|
|
68951
|
+
return this.records[rowIndex]?.[colIndex];
|
|
68952
|
+
}
|
|
68953
|
+
else if (this.dataset) {
|
|
68823
68954
|
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
|
|
68824
68955
|
if (cellDimensionPath) {
|
|
68825
68956
|
const colKeys = cellDimensionPath.colHeaderPaths.map((colPath) => {
|
|
@@ -68828,7 +68959,7 @@
|
|
|
68828
68959
|
const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
|
|
68829
68960
|
return rowPath.indicatorKey ?? rowPath.value;
|
|
68830
68961
|
});
|
|
68831
|
-
const aggregator = this.dataset.getAggregator(
|
|
68962
|
+
const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
|
|
68832
68963
|
if (aggregator.records && aggregator.records.length >= 1) {
|
|
68833
68964
|
return aggregator.records[0][field];
|
|
68834
68965
|
}
|
|
@@ -68847,9 +68978,6 @@
|
|
|
68847
68978
|
return treeNode?.record[field];
|
|
68848
68979
|
}
|
|
68849
68980
|
}
|
|
68850
|
-
const rowIndex = this.getBodyIndexByRow(row);
|
|
68851
|
-
const colIndex = this.getBodyIndexByCol(col);
|
|
68852
|
-
return this.records[rowIndex]?.[colIndex];
|
|
68853
68981
|
}
|
|
68854
68982
|
getCellValue(col, row, skipCustomMerge) {
|
|
68855
68983
|
if (!skipCustomMerge) {
|
|
@@ -68870,16 +68998,40 @@
|
|
|
68870
68998
|
const { title, fieldFormat } = this.internalProps.layoutMap.getHeader(col, row);
|
|
68871
68999
|
return typeof fieldFormat === 'function' ? fieldFormat(title, col, row, this) : title;
|
|
68872
69000
|
}
|
|
68873
|
-
if (this.
|
|
69001
|
+
if (this.internalProps.recordsIsTwoDimensionalArray) {
|
|
69002
|
+
const { fieldFormat } = this.internalProps.layoutMap.getBody(col, row);
|
|
69003
|
+
const rowIndex = this.getBodyIndexByRow(row);
|
|
69004
|
+
const colIndex = this.getBodyIndexByCol(col);
|
|
69005
|
+
const dataValue = this.records[rowIndex]?.[colIndex];
|
|
69006
|
+
if (typeof fieldFormat === 'function') {
|
|
69007
|
+
const fieldResult = fieldFormat(dataValue, col, row, this);
|
|
69008
|
+
return fieldResult;
|
|
69009
|
+
}
|
|
69010
|
+
return dataValue;
|
|
69011
|
+
}
|
|
69012
|
+
else if (this.dataset) {
|
|
68874
69013
|
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
|
|
68875
|
-
const colKeys = cellDimensionPath.colHeaderPaths
|
|
69014
|
+
const colKeys = cellDimensionPath.colHeaderPaths
|
|
69015
|
+
?.filter((path) => {
|
|
69016
|
+
return !path.virtual;
|
|
69017
|
+
})
|
|
69018
|
+
?.map((colPath) => {
|
|
68876
69019
|
return colPath.indicatorKey ?? colPath.value;
|
|
68877
69020
|
});
|
|
68878
|
-
const rowKeys = cellDimensionPath.rowHeaderPaths
|
|
69021
|
+
const rowKeys = cellDimensionPath.rowHeaderPaths
|
|
69022
|
+
?.filter((path) => {
|
|
69023
|
+
return !path.virtual;
|
|
69024
|
+
})
|
|
69025
|
+
?.map((rowPath) => {
|
|
68879
69026
|
return rowPath.indicatorKey ?? rowPath.value;
|
|
68880
69027
|
});
|
|
68881
|
-
const aggregator = this.dataset.getAggregator(
|
|
68882
|
-
|
|
69028
|
+
const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
|
|
69029
|
+
const { fieldFormat } = this.internalProps.layoutMap.getBody(col, row);
|
|
69030
|
+
return aggregator.formatValue
|
|
69031
|
+
? aggregator.formatValue(col, row, this)
|
|
69032
|
+
: typeof fieldFormat === 'function'
|
|
69033
|
+
? fieldFormat(aggregator?.value(), col, row, this)
|
|
69034
|
+
: aggregator?.value() ?? '';
|
|
68883
69035
|
}
|
|
68884
69036
|
else if (this.flatDataToObjects) {
|
|
68885
69037
|
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
|
|
@@ -68895,15 +69047,6 @@
|
|
|
68895
69047
|
? fieldFormat(valueNode?.value, col, row, this)
|
|
68896
69048
|
: valueNode?.value ?? '';
|
|
68897
69049
|
}
|
|
68898
|
-
const { fieldFormat } = this.internalProps.layoutMap.getBody(col, row);
|
|
68899
|
-
const rowIndex = this.getBodyIndexByRow(row);
|
|
68900
|
-
const colIndex = this.getBodyIndexByCol(col);
|
|
68901
|
-
const dataValue = this.records[rowIndex]?.[colIndex];
|
|
68902
|
-
if (typeof fieldFormat === 'function') {
|
|
68903
|
-
const fieldResult = fieldFormat(dataValue, col, row, this);
|
|
68904
|
-
return fieldResult;
|
|
68905
|
-
}
|
|
68906
|
-
return dataValue;
|
|
68907
69050
|
}
|
|
68908
69051
|
getCellOriginValue(col, row) {
|
|
68909
69052
|
const table = this;
|
|
@@ -68911,7 +69054,13 @@
|
|
|
68911
69054
|
const { title } = table.internalProps.layoutMap.getHeader(col, row);
|
|
68912
69055
|
return typeof title === 'function' ? title() : title;
|
|
68913
69056
|
}
|
|
68914
|
-
if (this.
|
|
69057
|
+
if (this.internalProps.recordsIsTwoDimensionalArray) {
|
|
69058
|
+
const rowIndex = this.getBodyIndexByRow(row);
|
|
69059
|
+
const colIndex = this.getBodyIndexByCol(col);
|
|
69060
|
+
const dataValue = this.records[rowIndex]?.[colIndex];
|
|
69061
|
+
return dataValue;
|
|
69062
|
+
}
|
|
69063
|
+
else if (this.dataset) {
|
|
68915
69064
|
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
|
|
68916
69065
|
const colKeys = cellDimensionPath.colHeaderPaths.map((colPath) => {
|
|
68917
69066
|
return colPath.indicatorKey ?? colPath.value;
|
|
@@ -68919,7 +69068,7 @@
|
|
|
68919
69068
|
const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
|
|
68920
69069
|
return rowPath.indicatorKey ?? rowPath.value;
|
|
68921
69070
|
});
|
|
68922
|
-
const aggregator = this.dataset.getAggregator(
|
|
69071
|
+
const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
|
|
68923
69072
|
return aggregator.value ? aggregator.value() : undefined;
|
|
68924
69073
|
}
|
|
68925
69074
|
else if (this.flatDataToObjects) {
|
|
@@ -68933,10 +69082,6 @@
|
|
|
68933
69082
|
const treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey);
|
|
68934
69083
|
return treeNode?.value;
|
|
68935
69084
|
}
|
|
68936
|
-
const rowIndex = this.getBodyIndexByRow(row);
|
|
68937
|
-
const colIndex = this.getBodyIndexByCol(col);
|
|
68938
|
-
const dataValue = this.records[rowIndex]?.[colIndex];
|
|
68939
|
-
return dataValue;
|
|
68940
69085
|
}
|
|
68941
69086
|
getCellRawValue(col, row) {
|
|
68942
69087
|
const table = this;
|
|
@@ -68944,7 +69089,13 @@
|
|
|
68944
69089
|
const { title } = table.internalProps.layoutMap.getHeader(col, row);
|
|
68945
69090
|
return typeof title === 'function' ? title() : title;
|
|
68946
69091
|
}
|
|
68947
|
-
if (this.
|
|
69092
|
+
if (this.internalProps.recordsIsTwoDimensionalArray) {
|
|
69093
|
+
const rowIndex = this.getBodyIndexByRow(row);
|
|
69094
|
+
const colIndex = this.getBodyIndexByCol(col);
|
|
69095
|
+
const dataValue = this.records[rowIndex]?.[colIndex];
|
|
69096
|
+
return dataValue;
|
|
69097
|
+
}
|
|
69098
|
+
else if (this.dataset) {
|
|
68948
69099
|
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
|
|
68949
69100
|
const colKeys = cellDimensionPath.colHeaderPaths.map((colPath) => {
|
|
68950
69101
|
return colPath.indicatorKey ?? colPath.value;
|
|
@@ -68952,7 +69103,7 @@
|
|
|
68952
69103
|
const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
|
|
68953
69104
|
return rowPath.indicatorKey ?? rowPath.value;
|
|
68954
69105
|
});
|
|
68955
|
-
const aggregator = this.dataset.getAggregator(
|
|
69106
|
+
const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row), false);
|
|
68956
69107
|
return aggregator.value ? aggregator.value() : undefined;
|
|
68957
69108
|
}
|
|
68958
69109
|
else if (this.flatDataToObjects) {
|
|
@@ -68966,17 +69117,19 @@
|
|
|
68966
69117
|
const treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, false);
|
|
68967
69118
|
return treeNode?.value;
|
|
68968
69119
|
}
|
|
68969
|
-
const rowIndex = this.getBodyIndexByRow(row);
|
|
68970
|
-
const colIndex = this.getBodyIndexByCol(col);
|
|
68971
|
-
const dataValue = this.records[rowIndex]?.[colIndex];
|
|
68972
|
-
return dataValue;
|
|
68973
69120
|
}
|
|
68974
69121
|
getCellOriginRecord(col, row) {
|
|
68975
69122
|
const table = this;
|
|
68976
69123
|
if (table.internalProps.layoutMap.isHeader(col, row)) {
|
|
68977
69124
|
return undefined;
|
|
68978
69125
|
}
|
|
68979
|
-
if (this.
|
|
69126
|
+
if (this.internalProps.recordsIsTwoDimensionalArray) {
|
|
69127
|
+
const rowIndex = this.getBodyIndexByRow(row);
|
|
69128
|
+
const colIndex = this.getBodyIndexByCol(col);
|
|
69129
|
+
const dataValue = this.records[rowIndex]?.[colIndex];
|
|
69130
|
+
return dataValue;
|
|
69131
|
+
}
|
|
69132
|
+
else if (this.dataset) {
|
|
68980
69133
|
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
|
|
68981
69134
|
const colKeys = cellDimensionPath.colHeaderPaths.map((colPath) => {
|
|
68982
69135
|
return colPath.indicatorKey ?? colPath.value;
|
|
@@ -68984,7 +69137,7 @@
|
|
|
68984
69137
|
const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
|
|
68985
69138
|
return rowPath.indicatorKey ?? rowPath.value;
|
|
68986
69139
|
});
|
|
68987
|
-
const aggregator = this.dataset.getAggregator(
|
|
69140
|
+
const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
|
|
68988
69141
|
return aggregator.records;
|
|
68989
69142
|
}
|
|
68990
69143
|
else if (this.flatDataToObjects) {
|
|
@@ -68998,17 +69151,19 @@
|
|
|
68998
69151
|
const treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey);
|
|
68999
69152
|
return treeNode?.record;
|
|
69000
69153
|
}
|
|
69001
|
-
const rowIndex = this.getBodyIndexByRow(row);
|
|
69002
|
-
const colIndex = this.getBodyIndexByCol(col);
|
|
69003
|
-
const dataValue = this.records[rowIndex]?.[colIndex];
|
|
69004
|
-
return dataValue;
|
|
69005
69154
|
}
|
|
69006
69155
|
getCellRawRecord(col, row) {
|
|
69007
69156
|
const table = this;
|
|
69008
69157
|
if (table.internalProps.layoutMap.isHeader(col, row)) {
|
|
69009
69158
|
return undefined;
|
|
69010
69159
|
}
|
|
69011
|
-
if (this.
|
|
69160
|
+
if (this.internalProps.recordsIsTwoDimensionalArray) {
|
|
69161
|
+
const rowIndex = this.getBodyIndexByRow(row);
|
|
69162
|
+
const colIndex = this.getBodyIndexByCol(col);
|
|
69163
|
+
const dataValue = this.records[rowIndex]?.[colIndex];
|
|
69164
|
+
return dataValue;
|
|
69165
|
+
}
|
|
69166
|
+
else if (this.dataset) {
|
|
69012
69167
|
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
|
|
69013
69168
|
const colKeys = cellDimensionPath.colHeaderPaths.map((colPath) => {
|
|
69014
69169
|
return colPath.indicatorKey ?? colPath.value;
|
|
@@ -69016,7 +69171,7 @@
|
|
|
69016
69171
|
const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
|
|
69017
69172
|
return rowPath.indicatorKey ?? rowPath.value;
|
|
69018
69173
|
});
|
|
69019
|
-
const aggregator = this.dataset.getAggregator(
|
|
69174
|
+
const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
|
|
69020
69175
|
return aggregator.records;
|
|
69021
69176
|
}
|
|
69022
69177
|
else if (this.flatDataToObjects) {
|
|
@@ -69030,10 +69185,6 @@
|
|
|
69030
69185
|
const treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, false);
|
|
69031
69186
|
return treeNode?.record;
|
|
69032
69187
|
}
|
|
69033
|
-
const rowIndex = this.getBodyIndexByRow(row);
|
|
69034
|
-
const colIndex = this.getBodyIndexByCol(col);
|
|
69035
|
-
const dataValue = this.records[rowIndex]?.[colIndex];
|
|
69036
|
-
return dataValue;
|
|
69037
69188
|
}
|
|
69038
69189
|
updateSortRules(sortRules) {
|
|
69039
69190
|
this.internalProps.dataConfig.sortRules = sortRules;
|
|
@@ -69075,7 +69226,7 @@
|
|
|
69075
69226
|
const moveContext = this.internalProps.layoutMap.moveHeaderPosition(source, target);
|
|
69076
69227
|
if (moveContext) {
|
|
69077
69228
|
if (moveContext.moveType === 'column') {
|
|
69078
|
-
if (this.
|
|
69229
|
+
if (this.internalProps.recordsIsTwoDimensionalArray) {
|
|
69079
69230
|
for (let row = 0; row < this.internalProps.records.length; row++) {
|
|
69080
69231
|
const sourceColumns = this.internalProps.records[row].splice(moveContext.sourceIndex - this.rowHeaderLevelCount, moveContext.sourceSize);
|
|
69081
69232
|
sourceColumns.unshift(moveContext.targetIndex - this.rowHeaderLevelCount, 0);
|
|
@@ -69086,7 +69237,7 @@
|
|
|
69086
69237
|
this.setMinMaxLimitWidth();
|
|
69087
69238
|
}
|
|
69088
69239
|
else if (moveContext.moveType === 'row') {
|
|
69089
|
-
if (this.
|
|
69240
|
+
if (this.internalProps.recordsIsTwoDimensionalArray) {
|
|
69090
69241
|
const sourceRows = this.internalProps.records.splice(moveContext.sourceIndex - this.columnHeaderLevelCount, moveContext.sourceSize);
|
|
69091
69242
|
sourceRows.unshift(moveContext.targetIndex - this.columnHeaderLevelCount, 0);
|
|
69092
69243
|
Array.prototype.splice.apply(this.internalProps.records, sourceRows);
|
|
@@ -69113,8 +69264,7 @@
|
|
|
69113
69264
|
});
|
|
69114
69265
|
}
|
|
69115
69266
|
else if (hierarchyState === HierarchyState.collapse) {
|
|
69116
|
-
const
|
|
69117
|
-
const headerTreeNode = this.internalProps.layoutMap.getHeadNode(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length));
|
|
69267
|
+
const headerTreeNode = this.internalProps.layoutMap.getHeadNode(col, row);
|
|
69118
69268
|
if (Array.isArray(headerTreeNode.children)) {
|
|
69119
69269
|
this._refreshHierarchyState(col, row);
|
|
69120
69270
|
}
|
|
@@ -69197,7 +69347,7 @@
|
|
|
69197
69347
|
}
|
|
69198
69348
|
getCellHeaderTreeNodes(col, row) {
|
|
69199
69349
|
const layoutMap = this.internalProps.layoutMap;
|
|
69200
|
-
const headerNodes = layoutMap.
|
|
69350
|
+
const headerNodes = layoutMap.getCellHeaderPathsWithTreeNode(col, row);
|
|
69201
69351
|
return headerNodes;
|
|
69202
69352
|
}
|
|
69203
69353
|
_hasHierarchyTreeHeader() {
|
|
@@ -69217,18 +69367,14 @@
|
|
|
69217
69367
|
setRecords(records) {
|
|
69218
69368
|
const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
|
|
69219
69369
|
this.options.records = this.internalProps.records = records;
|
|
69370
|
+
this.internalProps.recordsIsTwoDimensionalArray = false;
|
|
69371
|
+
if (records?.[0]?.constructor === Array) {
|
|
69372
|
+
this.internalProps.recordsIsTwoDimensionalArray = true;
|
|
69373
|
+
}
|
|
69220
69374
|
const options = this.options;
|
|
69221
69375
|
const internalProps = this.internalProps;
|
|
69222
|
-
if (this.
|
|
69223
|
-
this.
|
|
69224
|
-
internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset);
|
|
69225
|
-
this.pivotSortState = [];
|
|
69226
|
-
if (options.pivotSortState) {
|
|
69227
|
-
this.updatePivotSortState(options.pivotSortState);
|
|
69228
|
-
}
|
|
69229
|
-
}
|
|
69230
|
-
else if (Array.isArray(this.internalProps.columnTree) || Array.isArray(this.internalProps.rowTree)) {
|
|
69231
|
-
if (records?.[0]?.constructor !== Array) {
|
|
69376
|
+
if (this.options.customConfig?.enableDataAnalysis === false) {
|
|
69377
|
+
if (this.internalProps.recordsIsTwoDimensionalArray === false) {
|
|
69232
69378
|
this.flatDataToObjects = new FlatDataToObjects({
|
|
69233
69379
|
rows: internalProps.layoutMap.fullRowDimensionKeys,
|
|
69234
69380
|
columns: internalProps.layoutMap.colDimensionKeys,
|
|
@@ -69238,6 +69384,28 @@
|
|
|
69238
69384
|
}, records);
|
|
69239
69385
|
}
|
|
69240
69386
|
}
|
|
69387
|
+
else {
|
|
69388
|
+
this.dataset.setRecords(records);
|
|
69389
|
+
let columnDimensionTree;
|
|
69390
|
+
let rowDimensionTree;
|
|
69391
|
+
if (options.columnTree) {
|
|
69392
|
+
columnDimensionTree = internalProps.layoutMap.columnDimensionTree;
|
|
69393
|
+
}
|
|
69394
|
+
else {
|
|
69395
|
+
columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
|
|
69396
|
+
}
|
|
69397
|
+
if (options.rowTree) {
|
|
69398
|
+
rowDimensionTree = internalProps.layoutMap.rowDimensionTree;
|
|
69399
|
+
}
|
|
69400
|
+
else {
|
|
69401
|
+
rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId, this.options.rowHierarchyType, this.options.rowHierarchyType === 'tree' ? this.options.rowExpandLevel ?? 1 : undefined);
|
|
69402
|
+
}
|
|
69403
|
+
internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
|
|
69404
|
+
this.pivotSortState = [];
|
|
69405
|
+
if (options.pivotSortState) {
|
|
69406
|
+
this.updatePivotSortState(options.pivotSortState);
|
|
69407
|
+
}
|
|
69408
|
+
}
|
|
69241
69409
|
this.refreshHeader();
|
|
69242
69410
|
this.scenegraph.clearCells();
|
|
69243
69411
|
this.clearCellStyleCache();
|
|
@@ -69431,7 +69599,12 @@
|
|
|
69431
69599
|
this.scenegraph.updateNextFrame();
|
|
69432
69600
|
}
|
|
69433
69601
|
_changeCellValueToDataSet(col, row, oldValue, newValue) {
|
|
69434
|
-
if (this.
|
|
69602
|
+
if (this.internalProps.recordsIsTwoDimensionalArray) {
|
|
69603
|
+
const rowIndex = this.getBodyIndexByRow(row);
|
|
69604
|
+
const colIndex = this.getBodyIndexByCol(col);
|
|
69605
|
+
this.records[rowIndex][colIndex] = newValue;
|
|
69606
|
+
}
|
|
69607
|
+
else if (this.dataset) {
|
|
69435
69608
|
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
|
|
69436
69609
|
if (this.isHeader(col, row)) {
|
|
69437
69610
|
this.internalProps.layoutMap.changeTreeNodeTitle(col, row, newValue);
|
|
@@ -69473,11 +69646,6 @@
|
|
|
69473
69646
|
this.flatDataToObjects.changeTreeNodeValue(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, newValue);
|
|
69474
69647
|
}
|
|
69475
69648
|
}
|
|
69476
|
-
else {
|
|
69477
|
-
const rowIndex = this.getBodyIndexByRow(row);
|
|
69478
|
-
const colIndex = this.getBodyIndexByCol(col);
|
|
69479
|
-
this.records[rowIndex][colIndex] = newValue;
|
|
69480
|
-
}
|
|
69481
69649
|
}
|
|
69482
69650
|
_hasCustomRenderOrLayout() {
|
|
69483
69651
|
if (this.options.customRender) {
|
|
@@ -69512,8 +69680,7 @@
|
|
|
69512
69680
|
}
|
|
69513
69681
|
setTreeNodeChildren(children, records, col, row) {
|
|
69514
69682
|
if (this.flatDataToObjects) {
|
|
69515
|
-
const
|
|
69516
|
-
const headerTreeNode = this.internalProps.layoutMap.getHeadNode(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length));
|
|
69683
|
+
const headerTreeNode = this.internalProps.layoutMap.getHeadNode(col, row);
|
|
69517
69684
|
headerTreeNode.children = children;
|
|
69518
69685
|
this._refreshHierarchyState(col, row, () => {
|
|
69519
69686
|
this.flatDataToObjects.changeDataConfig({
|
|
@@ -69526,10 +69693,22 @@
|
|
|
69526
69693
|
this.flatDataToObjects.addRecords(records);
|
|
69527
69694
|
});
|
|
69528
69695
|
}
|
|
69696
|
+
else {
|
|
69697
|
+
const headerTreeNode = this.internalProps.layoutMap.getHeadNode(col, row);
|
|
69698
|
+
headerTreeNode.children = children;
|
|
69699
|
+
this._refreshHierarchyState(col, row, () => {
|
|
69700
|
+
this.dataset.changeDataConfig({
|
|
69701
|
+
rows: this.internalProps.layoutMap.fullRowDimensionKeys,
|
|
69702
|
+
columns: this.internalProps.layoutMap.colDimensionKeys
|
|
69703
|
+
});
|
|
69704
|
+
this.dataset.addRecords(records);
|
|
69705
|
+
});
|
|
69706
|
+
}
|
|
69529
69707
|
}
|
|
69530
69708
|
}
|
|
69531
69709
|
|
|
69532
69710
|
class PivotChart extends BaseTable {
|
|
69711
|
+
layoutNodeId = { seqId: 0 };
|
|
69533
69712
|
pivotSortState;
|
|
69534
69713
|
dataset;
|
|
69535
69714
|
_selectedDataItemsInChart = [];
|
|
@@ -69567,24 +69746,36 @@
|
|
|
69567
69746
|
this.internalProps.rowResizeType = options.rowResizeType ?? 'row';
|
|
69568
69747
|
this.internalProps.dataConfig = { isPivotChart: true };
|
|
69569
69748
|
this._axes = isArray$3(options.axes) ? options.axes : [];
|
|
69570
|
-
|
|
69571
|
-
|
|
69572
|
-
|
|
69573
|
-
|
|
69574
|
-
|
|
69575
|
-
|
|
69576
|
-
|
|
69577
|
-
|
|
69578
|
-
|
|
69579
|
-
|
|
69580
|
-
|
|
69581
|
-
|
|
69582
|
-
|
|
69583
|
-
|
|
69584
|
-
|
|
69585
|
-
|
|
69586
|
-
|
|
69587
|
-
|
|
69749
|
+
let columnDimensionTree;
|
|
69750
|
+
let rowDimensionTree;
|
|
69751
|
+
if (options.columnTree) {
|
|
69752
|
+
columnDimensionTree = new DimensionTree(this.internalProps.columnTree ?? [], this.layoutNodeId);
|
|
69753
|
+
}
|
|
69754
|
+
if (options.rowTree) {
|
|
69755
|
+
rowDimensionTree = new DimensionTree(this.internalProps.rowTree ?? [], this.layoutNodeId);
|
|
69756
|
+
}
|
|
69757
|
+
const rowKeys = rowDimensionTree?.dimensionKeys?.count
|
|
69758
|
+
? rowDimensionTree.dimensionKeys.valueArr()
|
|
69759
|
+
: options.rows?.reduce((keys, rowObj) => {
|
|
69760
|
+
if (typeof rowObj === 'string') {
|
|
69761
|
+
keys.push(rowObj);
|
|
69762
|
+
}
|
|
69763
|
+
else {
|
|
69764
|
+
keys.push(rowObj.dimensionKey);
|
|
69765
|
+
}
|
|
69766
|
+
return keys;
|
|
69767
|
+
}, []) ?? [];
|
|
69768
|
+
const columnKeys = columnDimensionTree?.dimensionKeys?.count
|
|
69769
|
+
? columnDimensionTree.dimensionKeys.valueArr()
|
|
69770
|
+
: options.columns?.reduce((keys, columnObj) => {
|
|
69771
|
+
if (typeof columnObj === 'string') {
|
|
69772
|
+
keys.push(columnObj);
|
|
69773
|
+
}
|
|
69774
|
+
else {
|
|
69775
|
+
keys.push(columnObj.dimensionKey);
|
|
69776
|
+
}
|
|
69777
|
+
return keys;
|
|
69778
|
+
}, []) ?? [];
|
|
69588
69779
|
const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
|
|
69589
69780
|
if (typeof indicatorObj === 'string') {
|
|
69590
69781
|
keys.push(indicatorObj);
|
|
@@ -69598,7 +69789,37 @@
|
|
|
69598
69789
|
this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules();
|
|
69599
69790
|
this.internalProps.dataConfig.dimensionSortArray = this._getDimensionSortArray();
|
|
69600
69791
|
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);
|
|
69601
|
-
this.
|
|
69792
|
+
if (this.options.indicatorsAsCol && checkHasCartesianChart(this.internalProps.indicators)) {
|
|
69793
|
+
const supplyAxisNode = (nodes) => {
|
|
69794
|
+
nodes.forEach((node) => {
|
|
69795
|
+
if (node.children?.length) {
|
|
69796
|
+
supplyAxisNode(node.children);
|
|
69797
|
+
}
|
|
69798
|
+
else {
|
|
69799
|
+
node.children = [
|
|
69800
|
+
{
|
|
69801
|
+
dimensionKey: 'axis',
|
|
69802
|
+
value: ''
|
|
69803
|
+
}
|
|
69804
|
+
];
|
|
69805
|
+
}
|
|
69806
|
+
});
|
|
69807
|
+
};
|
|
69808
|
+
if (this.dataset.rowHeaderTree?.length) {
|
|
69809
|
+
supplyAxisNode(this.dataset.rowHeaderTree);
|
|
69810
|
+
}
|
|
69811
|
+
else {
|
|
69812
|
+
this.dataset.rowHeaderTree = [
|
|
69813
|
+
{
|
|
69814
|
+
dimensionKey: 'axis',
|
|
69815
|
+
value: ''
|
|
69816
|
+
}
|
|
69817
|
+
];
|
|
69818
|
+
}
|
|
69819
|
+
}
|
|
69820
|
+
columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
|
|
69821
|
+
rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId);
|
|
69822
|
+
this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
|
|
69602
69823
|
this.refreshHeader();
|
|
69603
69824
|
this.scenegraph.createSceneGraph();
|
|
69604
69825
|
if (options.title) {
|
|
@@ -69642,6 +69863,7 @@
|
|
|
69642
69863
|
updateOption(options) {
|
|
69643
69864
|
const internalProps = this.internalProps;
|
|
69644
69865
|
super.updateOption(options);
|
|
69866
|
+
this.layoutNodeId = { seqId: 0 };
|
|
69645
69867
|
this.internalProps.columns = cloneDeep(options.columns);
|
|
69646
69868
|
this.internalProps.rows = cloneDeep(options.rows);
|
|
69647
69869
|
this.internalProps.indicators = !options.indicators?.length ? [] : cloneDeepSpec(options.indicators);
|
|
@@ -69656,24 +69878,36 @@
|
|
|
69656
69878
|
internalProps.rowResizeType = options.rowResizeType ?? 'row';
|
|
69657
69879
|
internalProps.dataConfig = { isPivotChart: true };
|
|
69658
69880
|
this._axes = isArray$3(options.axes) ? options.axes : [];
|
|
69659
|
-
|
|
69660
|
-
|
|
69661
|
-
|
|
69662
|
-
|
|
69663
|
-
|
|
69664
|
-
|
|
69665
|
-
|
|
69666
|
-
|
|
69667
|
-
|
|
69668
|
-
|
|
69669
|
-
|
|
69670
|
-
|
|
69671
|
-
|
|
69672
|
-
|
|
69673
|
-
|
|
69674
|
-
|
|
69675
|
-
|
|
69676
|
-
|
|
69881
|
+
let columnDimensionTree;
|
|
69882
|
+
let rowDimensionTree;
|
|
69883
|
+
if (options.columnTree) {
|
|
69884
|
+
columnDimensionTree = new DimensionTree(this.internalProps.columnTree ?? [], this.layoutNodeId);
|
|
69885
|
+
}
|
|
69886
|
+
if (options.rowTree) {
|
|
69887
|
+
rowDimensionTree = new DimensionTree(this.internalProps.rowTree ?? [], this.layoutNodeId);
|
|
69888
|
+
}
|
|
69889
|
+
const rowKeys = rowDimensionTree?.dimensionKeys?.count
|
|
69890
|
+
? rowDimensionTree.dimensionKeys.valueArr()
|
|
69891
|
+
: options.rows?.reduce((keys, rowObj) => {
|
|
69892
|
+
if (typeof rowObj === 'string') {
|
|
69893
|
+
keys.push(rowObj);
|
|
69894
|
+
}
|
|
69895
|
+
else {
|
|
69896
|
+
keys.push(rowObj.dimensionKey);
|
|
69897
|
+
}
|
|
69898
|
+
return keys;
|
|
69899
|
+
}, []) ?? [];
|
|
69900
|
+
const columnKeys = columnDimensionTree?.dimensionKeys?.count
|
|
69901
|
+
? columnDimensionTree.dimensionKeys.valueArr()
|
|
69902
|
+
: options.columns?.reduce((keys, columnObj) => {
|
|
69903
|
+
if (typeof columnObj === 'string') {
|
|
69904
|
+
keys.push(columnObj);
|
|
69905
|
+
}
|
|
69906
|
+
else {
|
|
69907
|
+
keys.push(columnObj.dimensionKey);
|
|
69908
|
+
}
|
|
69909
|
+
return keys;
|
|
69910
|
+
}, []) ?? [];
|
|
69677
69911
|
const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
|
|
69678
69912
|
if (typeof indicatorObj === 'string') {
|
|
69679
69913
|
keys.push(indicatorObj);
|
|
@@ -69687,7 +69921,37 @@
|
|
|
69687
69921
|
this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules();
|
|
69688
69922
|
this.internalProps.dataConfig.dimensionSortArray = this._getDimensionSortArray();
|
|
69689
69923
|
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);
|
|
69690
|
-
|
|
69924
|
+
if (this.options.indicatorsAsCol && checkHasCartesianChart(this.internalProps.indicators)) {
|
|
69925
|
+
const supplyAxisNode = (nodes) => {
|
|
69926
|
+
nodes.forEach((node) => {
|
|
69927
|
+
if (node.children?.length) {
|
|
69928
|
+
supplyAxisNode(node.children);
|
|
69929
|
+
}
|
|
69930
|
+
else {
|
|
69931
|
+
node.children = [
|
|
69932
|
+
{
|
|
69933
|
+
dimensionKey: 'axis',
|
|
69934
|
+
value: ''
|
|
69935
|
+
}
|
|
69936
|
+
];
|
|
69937
|
+
}
|
|
69938
|
+
});
|
|
69939
|
+
};
|
|
69940
|
+
if (this.dataset.rowHeaderTree?.length) {
|
|
69941
|
+
supplyAxisNode(this.dataset.rowHeaderTree);
|
|
69942
|
+
}
|
|
69943
|
+
else {
|
|
69944
|
+
this.dataset.rowHeaderTree = [
|
|
69945
|
+
{
|
|
69946
|
+
dimensionKey: 'axis',
|
|
69947
|
+
value: ''
|
|
69948
|
+
}
|
|
69949
|
+
];
|
|
69950
|
+
}
|
|
69951
|
+
}
|
|
69952
|
+
columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
|
|
69953
|
+
rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId);
|
|
69954
|
+
internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
|
|
69691
69955
|
this.refreshHeader();
|
|
69692
69956
|
if (internalProps.releaseList) {
|
|
69693
69957
|
internalProps.releaseList.forEach(releaseObj => releaseObj?.release?.());
|
|
@@ -69792,7 +70056,7 @@
|
|
|
69792
70056
|
const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
|
|
69793
70057
|
return rowPath.indicatorKey ?? rowPath.value;
|
|
69794
70058
|
});
|
|
69795
|
-
const aggregator = this.dataset.getAggregator(
|
|
70059
|
+
const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
|
|
69796
70060
|
return aggregator.value ? aggregator.value() : undefined;
|
|
69797
70061
|
}
|
|
69798
70062
|
const { fieldFormat } = this.internalProps.layoutMap.getBody(col, row);
|
|
@@ -69831,7 +70095,7 @@
|
|
|
69831
70095
|
const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
|
|
69832
70096
|
return rowPath.indicatorKey ?? rowPath.value;
|
|
69833
70097
|
});
|
|
69834
|
-
const aggregator = this.dataset.getAggregator(
|
|
70098
|
+
const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
|
|
69835
70099
|
return aggregator.value ? aggregator.value() : undefined;
|
|
69836
70100
|
}
|
|
69837
70101
|
const rowIndex = this.getBodyIndexByRow(row);
|
|
@@ -69855,7 +70119,7 @@
|
|
|
69855
70119
|
const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath) => {
|
|
69856
70120
|
return rowPath.indicatorKey ?? rowPath.value;
|
|
69857
70121
|
});
|
|
69858
|
-
const aggregator = this.dataset.getAggregator(
|
|
70122
|
+
const aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
|
|
69859
70123
|
return aggregator.records;
|
|
69860
70124
|
}
|
|
69861
70125
|
return undefined;
|
|
@@ -69983,6 +70247,8 @@
|
|
|
69983
70247
|
return result;
|
|
69984
70248
|
}
|
|
69985
70249
|
_generateCollectValuesConfig(columnKeys, rowKeys) {
|
|
70250
|
+
columnKeys = columnKeys.filter(key => key !== IndicatorDimensionKeyPlaceholder);
|
|
70251
|
+
rowKeys = rowKeys.filter(key => key !== IndicatorDimensionKeyPlaceholder);
|
|
69986
70252
|
const indicators = this.internalProps.indicators;
|
|
69987
70253
|
const collectValuesBy = {};
|
|
69988
70254
|
for (let i = 0, len = indicators?.length; i < len; i++) {
|
|
@@ -70342,10 +70608,24 @@
|
|
|
70342
70608
|
setRecords(records) {
|
|
70343
70609
|
const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
|
|
70344
70610
|
this.options.records = this.internalProps.records = records;
|
|
70345
|
-
this.options;
|
|
70611
|
+
const options = this.options;
|
|
70346
70612
|
const internalProps = this.internalProps;
|
|
70347
70613
|
this.dataset.setRecords(records);
|
|
70348
|
-
|
|
70614
|
+
let columnDimensionTree;
|
|
70615
|
+
let rowDimensionTree;
|
|
70616
|
+
if (options.columnTree) {
|
|
70617
|
+
columnDimensionTree = internalProps.layoutMap.columnDimensionTree;
|
|
70618
|
+
}
|
|
70619
|
+
else {
|
|
70620
|
+
columnDimensionTree = new DimensionTree(this.dataset.colHeaderTree ?? [], this.layoutNodeId);
|
|
70621
|
+
}
|
|
70622
|
+
if (options.rowTree) {
|
|
70623
|
+
rowDimensionTree = internalProps.layoutMap.rowDimensionTree;
|
|
70624
|
+
}
|
|
70625
|
+
else {
|
|
70626
|
+
rowDimensionTree = new DimensionTree(this.dataset.rowHeaderTree ?? [], this.layoutNodeId);
|
|
70627
|
+
}
|
|
70628
|
+
internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
|
|
70349
70629
|
this.refreshHeader();
|
|
70350
70630
|
this.scenegraph.clearCells();
|
|
70351
70631
|
this.clearCellStyleCache();
|
|
@@ -70389,6 +70669,27 @@
|
|
|
70389
70669
|
}
|
|
70390
70670
|
changeRecordOrder(source, target) {
|
|
70391
70671
|
}
|
|
70672
|
+
getLayoutColumnTree() {
|
|
70673
|
+
const layoutMap = this.internalProps.layoutMap;
|
|
70674
|
+
return layoutMap.getLayoutColumnTree();
|
|
70675
|
+
}
|
|
70676
|
+
getLayoutColumnTreeCount() {
|
|
70677
|
+
const layoutMap = this.internalProps.layoutMap;
|
|
70678
|
+
return layoutMap.getLayoutColumnTreeCount();
|
|
70679
|
+
}
|
|
70680
|
+
getLayoutRowTree() {
|
|
70681
|
+
const layoutMap = this.internalProps.layoutMap;
|
|
70682
|
+
return layoutMap.getLayoutRowTree();
|
|
70683
|
+
}
|
|
70684
|
+
getLayoutRowTreeCount() {
|
|
70685
|
+
const layoutMap = this.internalProps.layoutMap;
|
|
70686
|
+
return layoutMap.getLayoutRowTreeCount();
|
|
70687
|
+
}
|
|
70688
|
+
getCellHeaderTreeNodes(col, row) {
|
|
70689
|
+
const layoutMap = this.internalProps.layoutMap;
|
|
70690
|
+
const headerNodes = layoutMap.getCellHeaderPathsWithTreeNode(col, row);
|
|
70691
|
+
return headerNodes;
|
|
70692
|
+
}
|
|
70392
70693
|
}
|
|
70393
70694
|
|
|
70394
70695
|
class Circle extends Circle$1 {
|
|
@@ -70652,25 +70953,38 @@
|
|
|
70652
70953
|
});
|
|
70653
70954
|
|
|
70654
70955
|
function createDataset(options) {
|
|
70956
|
+
const layoutNodeId = { seqId: 0 };
|
|
70655
70957
|
const dataConfig = { isPivotChart: true };
|
|
70656
|
-
|
|
70657
|
-
|
|
70658
|
-
|
|
70659
|
-
|
|
70660
|
-
|
|
70661
|
-
|
|
70662
|
-
|
|
70663
|
-
|
|
70664
|
-
|
|
70665
|
-
|
|
70666
|
-
|
|
70667
|
-
|
|
70668
|
-
|
|
70669
|
-
|
|
70670
|
-
|
|
70671
|
-
|
|
70672
|
-
|
|
70673
|
-
|
|
70958
|
+
let columnDimensionTree;
|
|
70959
|
+
let rowDimensionTree;
|
|
70960
|
+
if (options.columnTree) {
|
|
70961
|
+
columnDimensionTree = new DimensionTree(options.columnTree ?? [], layoutNodeId);
|
|
70962
|
+
}
|
|
70963
|
+
if (options.rowTree) {
|
|
70964
|
+
rowDimensionTree = new DimensionTree(options.rowTree ?? [], layoutNodeId);
|
|
70965
|
+
}
|
|
70966
|
+
const rowKeys = rowDimensionTree.dimensionKeys?.count
|
|
70967
|
+
? rowDimensionTree.dimensionKeys.valueArr()
|
|
70968
|
+
: options.rows?.reduce((keys, rowObj) => {
|
|
70969
|
+
if (typeof rowObj === 'string') {
|
|
70970
|
+
keys.push(rowObj);
|
|
70971
|
+
}
|
|
70972
|
+
else {
|
|
70973
|
+
keys.push(rowObj.dimensionKey);
|
|
70974
|
+
}
|
|
70975
|
+
return keys;
|
|
70976
|
+
}, []) ?? [];
|
|
70977
|
+
const columnKeys = columnDimensionTree.dimensionKeys?.count
|
|
70978
|
+
? columnDimensionTree.dimensionKeys.valueArr()
|
|
70979
|
+
: options.columns?.reduce((keys, columnObj) => {
|
|
70980
|
+
if (typeof columnObj === 'string') {
|
|
70981
|
+
keys.push(columnObj);
|
|
70982
|
+
}
|
|
70983
|
+
else {
|
|
70984
|
+
keys.push(columnObj.dimensionKey);
|
|
70985
|
+
}
|
|
70986
|
+
return keys;
|
|
70987
|
+
}, []) ?? [];
|
|
70674
70988
|
const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
|
|
70675
70989
|
if (typeof indicatorObj === 'string') {
|
|
70676
70990
|
keys.push(indicatorObj);
|
|
@@ -70683,7 +70997,7 @@
|
|
|
70683
70997
|
dataConfig.collectValuesBy = _generateCollectValuesConfig(options, columnKeys, rowKeys);
|
|
70684
70998
|
dataConfig.aggregationRules = _generateAggregationRules(options);
|
|
70685
70999
|
const dataset = new Dataset(dataConfig, rowKeys, columnKeys, indicatorKeys, options.indicators, options.indicatorsAsCol ?? true, options.records, undefined, options.columnTree, options.rowTree, true);
|
|
70686
|
-
return dataset;
|
|
71000
|
+
return { dataset, columnDimensionTree, rowDimensionTree, layoutNodeId };
|
|
70687
71001
|
}
|
|
70688
71002
|
function _generateCollectValuesConfig(option, columnKeys, rowKeys) {
|
|
70689
71003
|
const collectValuesBy = {};
|
|
@@ -70846,9 +71160,25 @@
|
|
|
70846
71160
|
}
|
|
70847
71161
|
|
|
70848
71162
|
function getDataCellPath(options, data, compareFunc) {
|
|
70849
|
-
const
|
|
71163
|
+
const results = createDataset(options);
|
|
71164
|
+
let columnDimensionTree = results.columnDimensionTree;
|
|
71165
|
+
let rowDimensionTree = results.rowDimensionTree;
|
|
71166
|
+
let isNeedResetColumnDimensionTree = false;
|
|
71167
|
+
let isNeedResetRowDimensionTree = false;
|
|
71168
|
+
if (options.columnTree) {
|
|
71169
|
+
if (options.indicatorsAsCol && !columnDimensionTree.dimensionKeys.contain(IndicatorDimensionKeyPlaceholder)) {
|
|
71170
|
+
isNeedResetColumnDimensionTree = true;
|
|
71171
|
+
}
|
|
71172
|
+
}
|
|
71173
|
+
if (options.rowTree) {
|
|
71174
|
+
if (!options.indicatorsAsCol && !rowDimensionTree.dimensionKeys.contain(IndicatorDimensionKeyPlaceholder)) {
|
|
71175
|
+
isNeedResetRowDimensionTree = true;
|
|
71176
|
+
}
|
|
71177
|
+
}
|
|
71178
|
+
const { dataset, layoutNodeId } = results;
|
|
70850
71179
|
const mockTable = {
|
|
70851
71180
|
options,
|
|
71181
|
+
layoutNodeId,
|
|
70852
71182
|
internalProps: options,
|
|
70853
71183
|
isPivotChart: () => true,
|
|
70854
71184
|
pivotChartAxes: [],
|
|
@@ -70860,7 +71190,13 @@
|
|
|
70860
71190
|
};
|
|
70861
71191
|
}
|
|
70862
71192
|
};
|
|
70863
|
-
|
|
71193
|
+
if (!options.columnTree || isNeedResetColumnDimensionTree) {
|
|
71194
|
+
columnDimensionTree = new DimensionTree(dataset.colHeaderTree ?? [], layoutNodeId);
|
|
71195
|
+
}
|
|
71196
|
+
if (!options.rowTree || isNeedResetRowDimensionTree) {
|
|
71197
|
+
rowDimensionTree = new DimensionTree(dataset.rowHeaderTree ?? [], layoutNodeId);
|
|
71198
|
+
}
|
|
71199
|
+
const layoutMap = new PivotHeaderLayoutMap(mockTable, dataset, columnDimensionTree, rowDimensionTree);
|
|
70864
71200
|
for (let col = 0; col < layoutMap.colCount; col++) {
|
|
70865
71201
|
for (let row = 0; row < layoutMap.rowCount; row++) {
|
|
70866
71202
|
if (layoutMap.isHeader(col, row)) {
|
|
@@ -70907,7 +71243,7 @@
|
|
|
70907
71243
|
}
|
|
70908
71244
|
|
|
70909
71245
|
registerForVrender();
|
|
70910
|
-
const version = "0.
|
|
71246
|
+
const version = "0.26.0-alpha.0";
|
|
70911
71247
|
function getIcons() {
|
|
70912
71248
|
return get$2();
|
|
70913
71249
|
}
|