@finos/legend-data-cube 0.0.3 → 0.0.5
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/lib/components/editor/DataCubeEditorColumnPropertiesPanel.d.ts.map +1 -1
- package/lib/components/editor/DataCubeEditorColumnPropertiesPanel.js +7 -4
- package/lib/components/editor/DataCubeEditorColumnPropertiesPanel.js.map +1 -1
- package/lib/components/editor/DataCubeEditorGeneralPropertiesPanel.d.ts.map +1 -1
- package/lib/components/editor/DataCubeEditorGeneralPropertiesPanel.js +10 -15
- package/lib/components/editor/DataCubeEditorGeneralPropertiesPanel.js.map +1 -1
- package/lib/components/editor/DataCubeEditorSortsPanel.d.ts.map +1 -1
- package/lib/components/editor/DataCubeEditorSortsPanel.js +9 -9
- package/lib/components/editor/DataCubeEditorSortsPanel.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/core/DataCubeConfiguration.d.ts +13 -7
- package/lib/stores/core/DataCubeConfiguration.d.ts.map +1 -1
- package/lib/stores/core/DataCubeConfiguration.js +25 -15
- package/lib/stores/core/DataCubeConfiguration.js.map +1 -1
- package/lib/stores/core/DataCubeConfigurationBuilder.d.ts.map +1 -1
- package/lib/stores/core/DataCubeConfigurationBuilder.js +3 -2
- package/lib/stores/core/DataCubeConfigurationBuilder.js.map +1 -1
- package/lib/stores/core/DataCubeQueryBuilder.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQueryBuilder.js +23 -17
- package/lib/stores/core/DataCubeQueryBuilder.js.map +1 -1
- package/lib/stores/core/DataCubeQueryBuilderUtils.js +2 -2
- package/lib/stores/core/DataCubeQueryBuilderUtils.js.map +1 -1
- package/lib/stores/core/DataCubeQueryEngine.d.ts +19 -11
- package/lib/stores/core/DataCubeQueryEngine.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQueryEngine.js +21 -14
- package/lib/stores/core/DataCubeQueryEngine.js.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshot.d.ts +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilder.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilder.js +131 -80
- package/lib/stores/core/DataCubeQuerySnapshotBuilder.js.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.d.ts +6 -7
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.js +27 -91
- package/lib/stores/core/DataCubeQuerySnapshotBuilderUtils.js.map +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotManager.js +1 -1
- package/lib/stores/core/DataCubeQuerySnapshotManager.js.map +1 -1
- package/lib/stores/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts +1 -2
- package/lib/stores/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts.map +1 -1
- package/lib/stores/editor/DataCubeEditorGeneralPropertiesPanelState.js +4 -6
- package/lib/stores/editor/DataCubeEditorGeneralPropertiesPanelState.js.map +1 -1
- package/lib/stores/editor/DataCubeEditorMutableConfiguration.d.ts +15 -8
- package/lib/stores/editor/DataCubeEditorMutableConfiguration.d.ts.map +1 -1
- package/lib/stores/editor/DataCubeEditorMutableConfiguration.js +50 -26
- package/lib/stores/editor/DataCubeEditorMutableConfiguration.js.map +1 -1
- package/lib/stores/editor/DataCubeEditorPivotLayoutPanelState.d.ts +30 -0
- package/lib/stores/editor/DataCubeEditorPivotLayoutPanelState.d.ts.map +1 -0
- package/lib/stores/editor/DataCubeEditorPivotLayoutPanelState.js +43 -0
- package/lib/stores/editor/DataCubeEditorPivotLayoutPanelState.js.map +1 -0
- package/lib/stores/editor/DataCubeEditorSortsPanelState.d.ts +3 -3
- package/lib/stores/editor/DataCubeEditorSortsPanelState.d.ts.map +1 -1
- package/lib/stores/editor/DataCubeEditorSortsPanelState.js +11 -11
- package/lib/stores/editor/DataCubeEditorSortsPanelState.js.map +1 -1
- package/lib/stores/editor/DataCubeEditorState.d.ts +2 -0
- package/lib/stores/editor/DataCubeEditorState.d.ts.map +1 -1
- package/lib/stores/editor/DataCubeEditorState.js +5 -0
- package/lib/stores/editor/DataCubeEditorState.js.map +1 -1
- package/lib/stores/extend/DataCubeExtendManagerState.js +1 -1
- package/lib/stores/extend/DataCubeExtendManagerState.js.map +1 -1
- package/lib/stores/grid/DataCubeGridClientEngine.d.ts.map +1 -1
- package/lib/stores/grid/DataCubeGridClientEngine.js +41 -36
- package/lib/stores/grid/DataCubeGridClientEngine.js.map +1 -1
- package/lib/stores/grid/DataCubeGridConfigurationBuilder.d.ts.map +1 -1
- package/lib/stores/grid/DataCubeGridConfigurationBuilder.js +39 -3
- package/lib/stores/grid/DataCubeGridConfigurationBuilder.js.map +1 -1
- package/lib/stores/grid/DataCubeGridControllerState.d.ts +6 -3
- package/lib/stores/grid/DataCubeGridControllerState.d.ts.map +1 -1
- package/lib/stores/grid/DataCubeGridControllerState.js +35 -17
- package/lib/stores/grid/DataCubeGridControllerState.js.map +1 -1
- package/lib/stores/grid/DataCubeGridMenuBuilder.d.ts.map +1 -1
- package/lib/stores/grid/DataCubeGridMenuBuilder.js +52 -31
- package/lib/stores/grid/DataCubeGridMenuBuilder.js.map +1 -1
- package/lib/stores/grid/DataCubeGridQueryBuilder.d.ts.map +1 -1
- package/lib/stores/grid/DataCubeGridQueryBuilder.js +3 -3
- package/lib/stores/grid/DataCubeGridQueryBuilder.js.map +1 -1
- package/lib/stores/grid/DataCubeGridQuerySnapshotBuilder.d.ts.map +1 -1
- package/lib/stores/grid/DataCubeGridQuerySnapshotBuilder.js +14 -7
- package/lib/stores/grid/DataCubeGridQuerySnapshotBuilder.js.map +1 -1
- package/lib/stores/grid/DataCubeGridState.d.ts.map +1 -1
- package/lib/stores/grid/DataCubeGridState.js +9 -5
- package/lib/stores/grid/DataCubeGridState.js.map +1 -1
- package/package.json +3 -3
- package/src/components/editor/DataCubeEditorColumnPropertiesPanel.tsx +11 -5
- package/src/components/editor/DataCubeEditorGeneralPropertiesPanel.tsx +94 -101
- package/src/components/editor/DataCubeEditorSortsPanel.tsx +12 -10
- package/src/stores/core/DataCubeConfiguration.ts +33 -15
- package/src/stores/core/DataCubeConfigurationBuilder.ts +3 -2
- package/src/stores/core/DataCubeQueryBuilder.ts +33 -20
- package/src/stores/core/DataCubeQueryBuilderUtils.ts +2 -2
- package/src/stores/core/DataCubeQueryEngine.ts +22 -12
- package/src/stores/core/DataCubeQuerySnapshot.ts +1 -1
- package/src/stores/core/DataCubeQuerySnapshotBuilder.ts +135 -120
- package/src/stores/core/DataCubeQuerySnapshotBuilderUtils.ts +33 -107
- package/src/stores/core/DataCubeQuerySnapshotManager.ts +1 -1
- package/src/stores/editor/DataCubeEditorGeneralPropertiesPanelState.ts +6 -9
- package/src/stores/editor/DataCubeEditorMutableConfiguration.ts +68 -28
- package/src/stores/editor/DataCubeEditorPivotLayoutPanelState.ts +71 -0
- package/src/stores/editor/DataCubeEditorSortsPanelState.ts +11 -11
- package/src/stores/editor/DataCubeEditorState.tsx +5 -0
- package/src/stores/extend/DataCubeExtendManagerState.tsx +1 -1
- package/src/stores/grid/DataCubeGridClientEngine.ts +52 -48
- package/src/stores/grid/DataCubeGridConfigurationBuilder.tsx +45 -4
- package/src/stores/grid/DataCubeGridControllerState.ts +44 -20
- package/src/stores/grid/DataCubeGridMenuBuilder.tsx +81 -52
- package/src/stores/grid/DataCubeGridQueryBuilder.ts +3 -7
- package/src/stores/grid/DataCubeGridQuerySnapshotBuilder.ts +20 -7
- package/src/stores/grid/DataCubeGridState.ts +9 -5
- package/tsconfig.json +1 -0
|
@@ -20,11 +20,11 @@ import {
|
|
|
20
20
|
type DataCubeFont,
|
|
21
21
|
type DataCubeOperationValue,
|
|
22
22
|
type DataCubeNumberScale,
|
|
23
|
-
type DataCubeSelectionStat,
|
|
24
23
|
type DataCubeFontFormatUnderlineVariant,
|
|
25
24
|
type DataCubeFontCase,
|
|
26
25
|
type DataCubeFontTextAlignment,
|
|
27
26
|
type DataCubeColumnPinPlacement,
|
|
27
|
+
type DataCubeQuerySortDirection,
|
|
28
28
|
DEFAULT_FONT_FAMILY,
|
|
29
29
|
DEFAULT_FONT_SIZE,
|
|
30
30
|
DEFAULT_FONT_BOLD,
|
|
@@ -44,6 +44,7 @@ import { makeObservable, observable, action, computed } from 'mobx';
|
|
|
44
44
|
import {
|
|
45
45
|
DataCubeColumnConfiguration,
|
|
46
46
|
DataCubeConfiguration,
|
|
47
|
+
DataCubePivotLayoutConfiguration,
|
|
47
48
|
} from '../core/DataCubeConfiguration.js';
|
|
48
49
|
import { buildDefaultColumnConfiguration } from '../core/DataCubeConfigurationBuilder.js';
|
|
49
50
|
import { type DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
|
|
@@ -180,11 +181,14 @@ export class DataCubeEditorMutableColumnConfiguration extends DataCubeColumnConf
|
|
|
180
181
|
aggregationParameters: observable,
|
|
181
182
|
setAggregationParameters: action,
|
|
182
183
|
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
excludedFromPivot: observable,
|
|
185
|
+
setExcludedFromPivot: action,
|
|
185
186
|
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
pivotSortDirection: observable,
|
|
188
|
+
setPivotSortDirection: action,
|
|
189
|
+
|
|
190
|
+
pivotStatisticColumnFunction: observable,
|
|
191
|
+
setPivotStatisticColumnFunction: action,
|
|
188
192
|
});
|
|
189
193
|
|
|
190
194
|
return configuration;
|
|
@@ -382,12 +386,42 @@ export class DataCubeEditorMutableColumnConfiguration extends DataCubeColumnConf
|
|
|
382
386
|
this.aggregationParameters = value;
|
|
383
387
|
}
|
|
384
388
|
|
|
385
|
-
|
|
386
|
-
this.
|
|
389
|
+
setExcludedFromPivot(value: boolean) {
|
|
390
|
+
this.excludedFromPivot = value;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
setPivotSortDirection(value: string | undefined) {
|
|
394
|
+
this.pivotSortDirection = value;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
setPivotStatisticColumnFunction(value: string | undefined) {
|
|
398
|
+
this.pivotStatisticColumnFunction = value;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export class DataCubeEditorMutablePivotLayoutConfiguration extends DataCubePivotLayoutConfiguration {
|
|
403
|
+
static create(
|
|
404
|
+
json: PlainObject<DataCubePivotLayoutConfiguration>,
|
|
405
|
+
): DataCubeEditorMutablePivotLayoutConfiguration {
|
|
406
|
+
const configuration = Object.assign(
|
|
407
|
+
new DataCubeEditorMutablePivotLayoutConfiguration(),
|
|
408
|
+
DataCubePivotLayoutConfiguration.serialization.fromJson(json),
|
|
409
|
+
);
|
|
410
|
+
|
|
411
|
+
makeObservable(configuration, {
|
|
412
|
+
expandedPaths: observable,
|
|
413
|
+
setExpandedPaths: action,
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
return configuration;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
serialize() {
|
|
420
|
+
return DataCubePivotLayoutConfiguration.serialization.toJson(this);
|
|
387
421
|
}
|
|
388
422
|
|
|
389
|
-
|
|
390
|
-
this.
|
|
423
|
+
setExpandedPaths(value: string[]) {
|
|
424
|
+
this.expandedPaths = value;
|
|
391
425
|
}
|
|
392
426
|
}
|
|
393
427
|
|
|
@@ -405,9 +439,6 @@ export class DataCubeEditorMutableConfiguration extends DataCubeConfiguration {
|
|
|
405
439
|
description: observable,
|
|
406
440
|
setDescription: action,
|
|
407
441
|
|
|
408
|
-
showTreeLines: observable,
|
|
409
|
-
setShowTreeLines: action,
|
|
410
|
-
|
|
411
442
|
showHorizontalGridLines: observable,
|
|
412
443
|
setShowHorizontalGridLines: action,
|
|
413
444
|
|
|
@@ -477,8 +508,8 @@ export class DataCubeEditorMutableConfiguration extends DataCubeConfiguration {
|
|
|
477
508
|
alternateRowsStandardMode: observable,
|
|
478
509
|
setAlternateRowsStandardMode: action,
|
|
479
510
|
|
|
480
|
-
|
|
481
|
-
|
|
511
|
+
showSelectionStats: observable,
|
|
512
|
+
setShowSelectionStats: action,
|
|
482
513
|
|
|
483
514
|
showWarningForTruncatedResult: observable,
|
|
484
515
|
setShowWarningForTruncatedResult: action,
|
|
@@ -492,11 +523,14 @@ export class DataCubeEditorMutableConfiguration extends DataCubeConfiguration {
|
|
|
492
523
|
showLeafCount: observable,
|
|
493
524
|
setShowLeafCount: action,
|
|
494
525
|
|
|
495
|
-
|
|
496
|
-
|
|
526
|
+
treeColumnSortDirection: observable,
|
|
527
|
+
setTreeColumnSortDirection: action,
|
|
528
|
+
|
|
529
|
+
pivotStatisticColumnName: observable,
|
|
530
|
+
setPivotStatisticColumnName: action,
|
|
497
531
|
|
|
498
|
-
|
|
499
|
-
|
|
532
|
+
pivotStatisticColumnPlacement: observable,
|
|
533
|
+
setPivotStatisticColumnPlacement: action,
|
|
500
534
|
|
|
501
535
|
isUsingDefaultStyling: computed,
|
|
502
536
|
useDefaultStyling: action,
|
|
@@ -551,10 +585,6 @@ export class DataCubeEditorMutableConfiguration extends DataCubeConfiguration {
|
|
|
551
585
|
this.description = value;
|
|
552
586
|
}
|
|
553
587
|
|
|
554
|
-
setShowTreeLines(value: boolean) {
|
|
555
|
-
this.showTreeLines = value;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
588
|
setShowHorizontalGridLines(value: boolean) {
|
|
559
589
|
this.showHorizontalGridLines = value;
|
|
560
590
|
}
|
|
@@ -647,8 +677,8 @@ export class DataCubeEditorMutableConfiguration extends DataCubeConfiguration {
|
|
|
647
677
|
this.alternateRowsStandardMode = value;
|
|
648
678
|
}
|
|
649
679
|
|
|
650
|
-
|
|
651
|
-
this.
|
|
680
|
+
setShowSelectionStats(value: boolean) {
|
|
681
|
+
this.showSelectionStats = value;
|
|
652
682
|
}
|
|
653
683
|
|
|
654
684
|
setShowWarningForTruncatedResult(value: boolean) {
|
|
@@ -667,11 +697,21 @@ export class DataCubeEditorMutableConfiguration extends DataCubeConfiguration {
|
|
|
667
697
|
this.showLeafCount = value;
|
|
668
698
|
}
|
|
669
699
|
|
|
670
|
-
|
|
671
|
-
this.
|
|
700
|
+
setTreeColumnSortDirection(value: DataCubeQuerySortDirection) {
|
|
701
|
+
this.treeColumnSortDirection = value;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
setPivotStatisticColumnPlacement(
|
|
705
|
+
value: DataCubeColumnPinPlacement | undefined,
|
|
706
|
+
) {
|
|
707
|
+
this.pivotStatisticColumnPlacement = value;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
setPivotStatisticColumnName(value: string) {
|
|
711
|
+
this.pivotStatisticColumnName = value;
|
|
672
712
|
}
|
|
673
713
|
|
|
674
|
-
|
|
675
|
-
this.
|
|
714
|
+
setExpandedPaths(value: string[]) {
|
|
715
|
+
this.pivotLayout.expandedPaths = value;
|
|
676
716
|
}
|
|
677
717
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { action, makeObservable, observable } from 'mobx';
|
|
18
|
+
import type { DataCubeViewState } from '../DataCubeViewState.js';
|
|
19
|
+
import { type DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
|
|
20
|
+
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
21
|
+
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
22
|
+
import { DataCubeEditorMutablePivotLayoutConfiguration } from './DataCubeEditorMutableConfiguration.js';
|
|
23
|
+
import type { DataCubeConfiguration } from '../core/DataCubeConfiguration.js';
|
|
24
|
+
import type { PlainObject } from '@finos/legend-shared';
|
|
25
|
+
import { _pruneExpandedPaths } from '../core/DataCubeQuerySnapshotBuilderUtils.js';
|
|
26
|
+
|
|
27
|
+
export class DataCubeEditorPivotLayoutPanelState
|
|
28
|
+
implements DataCubeQueryEditorPanelState
|
|
29
|
+
{
|
|
30
|
+
readonly view!: DataCubeViewState;
|
|
31
|
+
readonly editor!: DataCubeEditorState;
|
|
32
|
+
|
|
33
|
+
pivotLayout = new DataCubeEditorMutablePivotLayoutConfiguration();
|
|
34
|
+
|
|
35
|
+
constructor(editor: DataCubeEditorState) {
|
|
36
|
+
makeObservable(this, {
|
|
37
|
+
pivotLayout: observable,
|
|
38
|
+
|
|
39
|
+
applySnaphot: action,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
this.editor = editor;
|
|
43
|
+
this.view = editor.view;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
applySnaphot(
|
|
47
|
+
snapshot: DataCubeQuerySnapshot,
|
|
48
|
+
configuration: DataCubeConfiguration,
|
|
49
|
+
) {
|
|
50
|
+
this.pivotLayout = DataCubeEditorMutablePivotLayoutConfiguration.create(
|
|
51
|
+
snapshot.data.configuration.pivotLayout as PlainObject,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
buildSnapshot(
|
|
56
|
+
newSnapshot: DataCubeQuerySnapshot,
|
|
57
|
+
baseSnapshot: DataCubeQuerySnapshot,
|
|
58
|
+
) {
|
|
59
|
+
this.pivotLayout.setExpandedPaths(
|
|
60
|
+
_pruneExpandedPaths(
|
|
61
|
+
baseSnapshot.data.groupBy?.columns ?? [],
|
|
62
|
+
this.editor.verticalPivots.selector.selectedColumns,
|
|
63
|
+
this.pivotLayout.expandedPaths,
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
newSnapshot.data.configuration = {
|
|
67
|
+
...newSnapshot.data.configuration,
|
|
68
|
+
pivotLayout: this.pivotLayout.serialize(),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -19,7 +19,7 @@ import type { DataCubeViewState } from '../DataCubeViewState.js';
|
|
|
19
19
|
import { type DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
|
|
20
20
|
import {
|
|
21
21
|
DataCubeColumnKind,
|
|
22
|
-
|
|
22
|
+
DataCubeQuerySortDirection,
|
|
23
23
|
} from '../core/DataCubeQueryEngine.js';
|
|
24
24
|
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
25
25
|
import {
|
|
@@ -31,21 +31,21 @@ import type { DataCubeConfiguration } from '../core/DataCubeConfiguration.js';
|
|
|
31
31
|
import { uniqBy } from '@finos/legend-shared';
|
|
32
32
|
|
|
33
33
|
export class DataCubeEditorSortColumnState extends DataCubeEditorColumnsSelectorColumnState {
|
|
34
|
-
|
|
34
|
+
direction: string;
|
|
35
35
|
|
|
36
36
|
constructor(name: string, type: string, direction: string) {
|
|
37
37
|
super(name, type);
|
|
38
38
|
|
|
39
39
|
makeObservable(this, {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
direction: observable,
|
|
41
|
+
setDirection: action,
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
this.
|
|
44
|
+
this.direction = direction;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
this.
|
|
47
|
+
setDirection(val: DataCubeQuerySortDirection) {
|
|
48
|
+
this.direction = val;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -54,7 +54,7 @@ export class DataCubeEditorSortColumnsSelectorState extends DataCubeEditorColumn
|
|
|
54
54
|
return new DataCubeEditorSortColumnState(
|
|
55
55
|
column.name,
|
|
56
56
|
column.type,
|
|
57
|
-
column.
|
|
57
|
+
column.direction,
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -91,7 +91,7 @@ export class DataCubeEditorSortColumnsSelectorState extends DataCubeEditorColumn
|
|
|
91
91
|
new DataCubeEditorSortColumnState(
|
|
92
92
|
col.name,
|
|
93
93
|
col.type,
|
|
94
|
-
|
|
94
|
+
DataCubeQuerySortDirection.ASCENDING,
|
|
95
95
|
),
|
|
96
96
|
);
|
|
97
97
|
}
|
|
@@ -128,7 +128,7 @@ export class DataCubeEditorSortsPanelState
|
|
|
128
128
|
return new DataCubeEditorSortColumnState(
|
|
129
129
|
column.name,
|
|
130
130
|
column.type,
|
|
131
|
-
col.
|
|
131
|
+
col.direction,
|
|
132
132
|
);
|
|
133
133
|
}),
|
|
134
134
|
);
|
|
@@ -141,7 +141,7 @@ export class DataCubeEditorSortsPanelState
|
|
|
141
141
|
newSnapshot.data.sortColumns = this.selector.selectedColumns.map((col) => ({
|
|
142
142
|
name: col.name,
|
|
143
143
|
type: col.type,
|
|
144
|
-
|
|
144
|
+
direction: col.direction,
|
|
145
145
|
}));
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -39,6 +39,7 @@ import { DataCubeEditor } from '../../components/editor/DataCubeEditor.js';
|
|
|
39
39
|
import { buildExecutableQuery } from '../core/DataCubeQueryBuilder.js';
|
|
40
40
|
import { _lambda } from '../core/DataCubeQueryBuilderUtils.js';
|
|
41
41
|
import { DataCubeEditorHorizontalPivotsPanelState } from './DataCubeEditorHorizontalPivotsPanelState.js';
|
|
42
|
+
import { DataCubeEditorPivotLayoutPanelState } from './DataCubeEditorPivotLayoutPanelState.js';
|
|
42
43
|
|
|
43
44
|
export enum DataCubeEditorTab {
|
|
44
45
|
GENERAL_PROPERTIES = 'General Properties',
|
|
@@ -63,6 +64,7 @@ export class DataCubeEditorState extends DataCubeQuerySnapshotController {
|
|
|
63
64
|
readonly finalizationState = ActionState.create();
|
|
64
65
|
|
|
65
66
|
readonly generalProperties: DataCubeEditorGeneralPropertiesPanelState;
|
|
67
|
+
readonly pivotLayout: DataCubeEditorPivotLayoutPanelState;
|
|
66
68
|
readonly columnProperties: DataCubeEditorColumnPropertiesPanelState;
|
|
67
69
|
|
|
68
70
|
readonly columns: DataCubeEditorColumnsPanelState;
|
|
@@ -97,6 +99,7 @@ export class DataCubeEditorState extends DataCubeQuerySnapshotController {
|
|
|
97
99
|
this.generalProperties = new DataCubeEditorGeneralPropertiesPanelState(
|
|
98
100
|
this,
|
|
99
101
|
);
|
|
102
|
+
this.pivotLayout = new DataCubeEditorPivotLayoutPanelState(this);
|
|
100
103
|
this.columnProperties = new DataCubeEditorColumnPropertiesPanelState(this);
|
|
101
104
|
this.columns = new DataCubeEditorColumnsPanelState(this);
|
|
102
105
|
this.horizontalPivots = new DataCubeEditorHorizontalPivotsPanelState(this);
|
|
@@ -120,6 +123,7 @@ export class DataCubeEditorState extends DataCubeQuerySnapshotController {
|
|
|
120
123
|
snapshot.data.configuration,
|
|
121
124
|
);
|
|
122
125
|
this.generalProperties.applySnaphot(snapshot, configuration);
|
|
126
|
+
this.pivotLayout.applySnaphot(snapshot, configuration);
|
|
123
127
|
this.columnProperties.applySnaphot(snapshot, configuration);
|
|
124
128
|
|
|
125
129
|
this.columns.applySnaphot(snapshot, configuration);
|
|
@@ -138,6 +142,7 @@ export class DataCubeEditorState extends DataCubeQuerySnapshotController {
|
|
|
138
142
|
// grid configuration must be processed before processing columns' configuration
|
|
139
143
|
// to properly generate the container configuration
|
|
140
144
|
this.generalProperties.buildSnapshot(newSnapshot, baseSnapshot);
|
|
145
|
+
this.pivotLayout.buildSnapshot(newSnapshot, baseSnapshot);
|
|
141
146
|
this.columnProperties.buildSnapshot(newSnapshot, baseSnapshot);
|
|
142
147
|
|
|
143
148
|
// NOTE: column selection must be processed first since the snapshot
|
|
@@ -113,7 +113,7 @@ export class DataCubeExtendManagerState extends DataCubeQuerySnapshotController
|
|
|
113
113
|
const columnConfiguration = buildDefaultColumnConfiguration(column);
|
|
114
114
|
if (columnKind) {
|
|
115
115
|
columnConfiguration.kind = columnKind;
|
|
116
|
-
columnConfiguration.
|
|
116
|
+
columnConfiguration.excludedFromPivot =
|
|
117
117
|
columnKind === DataCubeColumnKind.DIMENSION;
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -49,7 +49,6 @@ import {
|
|
|
49
49
|
type DataCubeQuerySnapshotData,
|
|
50
50
|
} from '../core/DataCubeQuerySnapshot.js';
|
|
51
51
|
import type { DataCubeEngine } from '../engine/DataCubeEngine.js';
|
|
52
|
-
import { generateColumnDefs } from './DataCubeGridConfigurationBuilder.js';
|
|
53
52
|
import { type DataCubeQueryFunctionMap } from '../core/DataCubeQueryEngine.js';
|
|
54
53
|
import type { DataCubeQueryFilterOperation } from '../core/filter/DataCubeQueryFilterOperation.js';
|
|
55
54
|
import type { DataCubeQueryAggregateOperation } from '../core/aggregation/DataCubeQueryAggregateOperation.js';
|
|
@@ -186,10 +185,10 @@ export function computeHashCodeForDataFetchManualTrigger(
|
|
|
186
185
|
...snapshot.data,
|
|
187
186
|
name: '', // name change should not trigger data fetching
|
|
188
187
|
configuration: {
|
|
189
|
-
initialExpandLevel: configuration.initialExpandLevel,
|
|
190
188
|
showRootAggregation: configuration.showRootAggregation,
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
pivotStatisticColumnPlacement:
|
|
190
|
+
configuration.pivotStatisticColumnPlacement,
|
|
191
|
+
treeColumnSortDirection: configuration.treeColumnSortDirection,
|
|
193
192
|
columns: configuration.columns
|
|
194
193
|
.map((column) => ({
|
|
195
194
|
name: column.name,
|
|
@@ -197,8 +196,11 @@ export function computeHashCodeForDataFetchManualTrigger(
|
|
|
197
196
|
kind: column.kind,
|
|
198
197
|
aggregateOperator: column.aggregateOperator,
|
|
199
198
|
aggregationParameters: column.aggregationParameters,
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
excludedFromPivot: column.excludedFromPivot,
|
|
200
|
+
pivotSortDirection: column.pivotSortDirection,
|
|
201
|
+
// technically, we just need to refresh the row-data since this computation
|
|
202
|
+
// is done on the client-side, but to simplify the flow, we can just refetch data
|
|
203
|
+
pivotStatisticColumnFunction: column.pivotStatisticColumnFunction,
|
|
202
204
|
}))
|
|
203
205
|
.sort(_sortByColName), // sort to make sure column reordering does not trigger data fetching
|
|
204
206
|
},
|
|
@@ -317,49 +319,52 @@ export class DataCubeGridClientServerSideDataSource
|
|
|
317
319
|
// ------------------------------ SNAPSHOT ------------------------------
|
|
318
320
|
|
|
319
321
|
const currentSnapshot = guaranteeNonNullable(this.grid.getLatestSnapshot());
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
// if
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
newSnapshot.data.pivot
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
)
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
322
|
+
let newSnapshot = currentSnapshot;
|
|
323
|
+
|
|
324
|
+
// only recompute the snapshot if this is not a drilldown request
|
|
325
|
+
if (params.request.groupKeys.length === 0) {
|
|
326
|
+
newSnapshot = buildQuerySnapshot(params.request, currentSnapshot);
|
|
327
|
+
|
|
328
|
+
// NOTE: if h-pivot is enabled, update the cast columns
|
|
329
|
+
// and panels which might be affected by this (e.g. sorts)
|
|
330
|
+
// Because is an expensive operation in certain case, we only
|
|
331
|
+
// recompute when it's not a drilldown or paging request,
|
|
332
|
+
// but we could still optimize further if needed.
|
|
333
|
+
if (!this.grid.isPaginationEnabled || params.request.startRow === 0) {
|
|
334
|
+
if (newSnapshot.data.pivot) {
|
|
335
|
+
try {
|
|
336
|
+
const castColumns = await getCastColumns(
|
|
337
|
+
newSnapshot,
|
|
338
|
+
this.grid.view.engine,
|
|
339
|
+
);
|
|
340
|
+
newSnapshot.data.pivot.castColumns = castColumns;
|
|
341
|
+
newSnapshot.data.sortColumns = newSnapshot.data.sortColumns.filter(
|
|
342
|
+
(column) =>
|
|
343
|
+
[...castColumns, ...newSnapshot.data.groupExtendedColumns].find(
|
|
344
|
+
(col) => column.name === col.name,
|
|
345
|
+
),
|
|
346
|
+
);
|
|
347
|
+
} catch (error) {
|
|
348
|
+
assertErrorThrown(error);
|
|
349
|
+
this.grid.view.application.alertError(error, {
|
|
350
|
+
message: `Query Validation Failure: Can't retrieve pivot results column metadata. ${error.message}`,
|
|
351
|
+
});
|
|
352
|
+
// fail early since we can't proceed without the cast columns validated
|
|
353
|
+
params.fail();
|
|
354
|
+
this.grid.view.endTask(task);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
348
358
|
}
|
|
349
|
-
}
|
|
350
359
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
this.grid.view,
|
|
360
|
-
),
|
|
361
|
-
});
|
|
362
|
-
this.grid.publishSnapshot(newSnapshot);
|
|
360
|
+
newSnapshot.finalize();
|
|
361
|
+
if (newSnapshot.hashCode !== currentSnapshot.hashCode) {
|
|
362
|
+
// NOTE: if we mess up the computation of the snapshot, we run the risk
|
|
363
|
+
// of triggering an infinite loop, by keep updating the grid options
|
|
364
|
+
// so we need to be careful here when making this call!
|
|
365
|
+
await this.grid.applySnapshot(newSnapshot, currentSnapshot);
|
|
366
|
+
this.grid.publishSnapshot(newSnapshot);
|
|
367
|
+
}
|
|
363
368
|
}
|
|
364
369
|
|
|
365
370
|
// ------------------------------ DATA ------------------------------
|
|
@@ -447,7 +452,6 @@ export class DataCubeGridClientServerSideDataSource
|
|
|
447
452
|
{
|
|
448
453
|
label: 'Dismiss Warning',
|
|
449
454
|
handler: () => {
|
|
450
|
-
// this.grid.setPaginationEnabled(true);
|
|
451
455
|
this.grid.view.engine.setGridClientSuppressLargeDatasetWarning(
|
|
452
456
|
true,
|
|
453
457
|
);
|
|
@@ -74,14 +74,14 @@ import {
|
|
|
74
74
|
DataCubeColumnDataType,
|
|
75
75
|
DataCubeColumnPinPlacement,
|
|
76
76
|
DataCubeNumberScale,
|
|
77
|
-
DEFAULT_ROW_BUFFER,
|
|
78
77
|
DEFAULT_URL_LABEL_QUERY_PARAM,
|
|
79
78
|
getDataType,
|
|
80
|
-
|
|
79
|
+
DataCubeQuerySortDirection,
|
|
81
80
|
DataCubeColumnKind,
|
|
82
81
|
DEFAULT_MISSING_VALUE_DISPLAY_TEXT,
|
|
83
82
|
PIVOT_COLUMN_NAME_VALUE_SEPARATOR,
|
|
84
83
|
isPivotResultColumnName,
|
|
84
|
+
TREE_COLUMN_VALUE_SEPARATOR,
|
|
85
85
|
} from '../core/DataCubeQueryEngine.js';
|
|
86
86
|
import type { CustomLoadingCellRendererProps } from '@ag-grid-community/react';
|
|
87
87
|
import { DataCubeIcon } from '@finos/legend-art';
|
|
@@ -430,7 +430,7 @@ function _sortSpec(columnData: ColumnData) {
|
|
|
430
430
|
return {
|
|
431
431
|
sortable: true, // if this is pivot column, no sorting is supported yet
|
|
432
432
|
sort: sortCol
|
|
433
|
-
? sortCol.
|
|
433
|
+
? sortCol.direction === DataCubeQuerySortDirection.ASCENDING
|
|
434
434
|
? GridClientSortDirection.ASCENDING
|
|
435
435
|
: GridClientSortDirection.DESCENDING
|
|
436
436
|
: null,
|
|
@@ -851,6 +851,27 @@ export function generateGridOptionsFromSnapshot(
|
|
|
851
851
|
view: DataCubeViewState,
|
|
852
852
|
): GridOptions {
|
|
853
853
|
const gridOptions = {
|
|
854
|
+
isServerSideGroupOpenByDefault: (params) => {
|
|
855
|
+
if (
|
|
856
|
+
configuration.initialExpandLevel !== undefined &&
|
|
857
|
+
configuration.initialExpandLevel > 0 &&
|
|
858
|
+
params.rowNode.level <= configuration.initialExpandLevel - 1
|
|
859
|
+
) {
|
|
860
|
+
return true;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
const routes = params.rowNode.getRoute();
|
|
864
|
+
if (!routes) {
|
|
865
|
+
return false;
|
|
866
|
+
}
|
|
867
|
+
const path = routes.join(TREE_COLUMN_VALUE_SEPARATOR);
|
|
868
|
+
if (configuration.pivotLayout.expandedPaths.includes(path)) {
|
|
869
|
+
return true;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
return false;
|
|
873
|
+
},
|
|
874
|
+
|
|
854
875
|
/**
|
|
855
876
|
* NOTE: there is a strange issue where if we put dynamic configuration directly
|
|
856
877
|
* such as rowClassRules which depends on some changing state (e.g. alternateRows)
|
|
@@ -866,7 +887,6 @@ export function generateGridOptionsFromSnapshot(
|
|
|
866
887
|
configuration.alternateRowsCount,
|
|
867
888
|
}
|
|
868
889
|
: {},
|
|
869
|
-
rowBuffer: DEFAULT_ROW_BUFFER,
|
|
870
890
|
|
|
871
891
|
// -------------------------------------- EVENT HANDLERS --------------------------------------
|
|
872
892
|
// NOTE: make sure the event source must not be 'api' since these handlers are meant for direct
|
|
@@ -907,6 +927,24 @@ export function generateGridOptionsFromSnapshot(
|
|
|
907
927
|
}
|
|
908
928
|
},
|
|
909
929
|
|
|
930
|
+
onRowGroupOpened: (event) => {
|
|
931
|
+
// NOTE: only update the pivot layout expanded paths when the user manually expands/collapses
|
|
932
|
+
// a path. If the path is expanded/collapsed programmatically, such as when tree column initially-
|
|
933
|
+
// expanded-to-level is specified, causing the groups to be automatically drilled down, resultant
|
|
934
|
+
// expanded paths will not be kept for record.
|
|
935
|
+
if (event.event) {
|
|
936
|
+
const path = event.node.getRoute()?.join(TREE_COLUMN_VALUE_SEPARATOR);
|
|
937
|
+
if (!path) {
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
if (event.expanded) {
|
|
941
|
+
view.grid.controller.expandPath(path);
|
|
942
|
+
} else {
|
|
943
|
+
view.grid.controller.collapsePath(path);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
},
|
|
947
|
+
|
|
910
948
|
// -------------------------------------- COLUMNS --------------------------------------
|
|
911
949
|
|
|
912
950
|
columnDefs: generateColumnDefs(snapshot, configuration, view),
|
|
@@ -918,6 +956,9 @@ export function generateGridOptionsFromSnapshot(
|
|
|
918
956
|
colId: INTERNAL__GRID_CLIENT_TREE_COLUMN_ID,
|
|
919
957
|
headerName: '',
|
|
920
958
|
cellRenderer: 'agGroupCellRenderer',
|
|
959
|
+
cellRendererParams: {
|
|
960
|
+
suppressCount: !configuration.showLeafCount,
|
|
961
|
+
},
|
|
921
962
|
|
|
922
963
|
// display
|
|
923
964
|
..._groupDisplaySpec(snapshot, configuration),
|