@finos/legend-data-cube 0.1.10 → 0.1.12
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/DataCubePlaceholder.d.ts.map +1 -1
- package/lib/components/core/DataCubeLayout.d.ts.map +1 -1
- package/lib/components/view/editor/DataCubeEditor.d.ts.map +1 -1
- package/lib/components/view/editor/DataCubeEditor.js +4 -2
- package/lib/components/view/editor/DataCubeEditor.js.map +1 -1
- package/lib/components/view/editor/DataCubeEditorColumnsPanel.d.ts.map +1 -1
- package/lib/components/view/editor/DataCubeEditorColumnsPanel.js +3 -3
- package/lib/components/view/editor/DataCubeEditorColumnsPanel.js.map +1 -1
- package/lib/components/view/editor/DataCubeEditorColumnsSelector.d.ts +47 -0
- package/lib/components/view/editor/DataCubeEditorColumnsSelector.d.ts.map +1 -0
- package/lib/components/view/editor/{DataCubeEditorColumnSelector.js → DataCubeEditorColumnsSelector.js} +70 -55
- package/lib/components/view/editor/DataCubeEditorColumnsSelector.js.map +1 -0
- package/lib/components/view/editor/DataCubeEditorDimensionsPanel.d.ts +3 -13
- package/lib/components/view/editor/DataCubeEditorDimensionsPanel.d.ts.map +1 -1
- package/lib/components/view/editor/DataCubeEditorDimensionsPanel.js +707 -264
- package/lib/components/view/editor/DataCubeEditorDimensionsPanel.js.map +1 -1
- package/lib/components/view/editor/DataCubeEditorHorizontalPivotsPanel.js +2 -2
- package/lib/components/view/editor/DataCubeEditorHorizontalPivotsPanel.js.map +1 -1
- package/lib/components/view/editor/DataCubeEditorSortsPanel.js +2 -2
- package/lib/components/view/editor/DataCubeEditorSortsPanel.js.map +1 -1
- package/lib/components/view/editor/DataCubeEditorVerticalPivotsPanel.js +2 -2
- package/lib/components/view/editor/DataCubeEditorVerticalPivotsPanel.js.map +1 -1
- package/lib/components/view/grid/DataCubeGrid.d.ts +2 -1
- package/lib/components/view/grid/DataCubeGrid.d.ts.map +1 -1
- package/lib/components/view/grid/DataCubeGrid.js +31 -28
- package/lib/components/view/grid/DataCubeGrid.js.map +1 -1
- package/lib/components/view/grid/DataCubeMultidimensionalGrid.d.ts +1 -1
- package/lib/components/view/grid/DataCubeMultidimensionalGrid.d.ts.map +1 -1
- package/lib/components/view/grid/DataCubeMultidimensionalGrid.js +2 -1
- package/lib/components/view/grid/DataCubeMultidimensionalGrid.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +8 -8
- package/lib/stores/DataCubeAPI.d.ts.map +1 -1
- package/lib/stores/DataCubeAPI.js +3 -1
- package/lib/stores/DataCubeAPI.js.map +1 -1
- package/lib/stores/core/DataCubeEngine.d.ts +1 -1
- package/lib/stores/core/DataCubeEngine.d.ts.map +1 -1
- package/lib/stores/core/DataCubeEngine.js.map +1 -1
- package/lib/stores/core/DataCubeQueryBuilderUtils.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQueryEngine.d.ts +5 -0
- package/lib/stores/core/DataCubeQueryEngine.d.ts.map +1 -1
- package/lib/stores/core/DataCubeQueryEngine.js +6 -0
- package/lib/stores/core/DataCubeQueryEngine.js.map +1 -1
- package/lib/stores/core/DataCubeSnapshot.d.ts +1 -1
- package/lib/stores/core/DataCubeSnapshot.d.ts.map +1 -1
- package/lib/stores/core/model/DataCubeColumn.d.ts.map +1 -1
- package/lib/stores/core/model/DataCubeConfiguration.d.ts +11 -0
- package/lib/stores/core/model/DataCubeConfiguration.d.ts.map +1 -1
- package/lib/stores/core/model/DataCubeConfiguration.js +19 -1
- package/lib/stores/core/model/DataCubeConfiguration.js.map +1 -1
- package/lib/stores/services/DataCubeSettingService.d.ts.map +1 -1
- package/lib/stores/services/DataCubeSettingService.js +10 -6
- package/lib/stores/services/DataCubeSettingService.js.map +1 -1
- package/lib/stores/view/DataCubeInfoState.d.ts +2 -0
- package/lib/stores/view/DataCubeInfoState.d.ts.map +1 -1
- package/lib/stores/view/DataCubeInfoState.js +3 -0
- package/lib/stores/view/DataCubeInfoState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorColumnsPanelState.d.ts +8 -8
- package/lib/stores/view/editor/DataCubeEditorColumnsPanelState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorColumnsPanelState.js +6 -6
- package/lib/stores/view/editor/DataCubeEditorColumnsPanelState.js.map +1 -1
- package/lib/stores/view/editor/{DataCubeEditorColumnSelectorState.d.ts → DataCubeEditorColumnsSelectorState.d.ts} +6 -6
- package/lib/stores/view/editor/DataCubeEditorColumnsSelectorState.d.ts.map +1 -0
- package/lib/stores/view/editor/{DataCubeEditorColumnSelectorState.js → DataCubeEditorColumnsSelectorState.js} +4 -4
- package/lib/stores/view/editor/DataCubeEditorColumnsSelectorState.js.map +1 -0
- package/lib/stores/view/editor/DataCubeEditorDimensionsPanelState.d.ts +29 -6
- package/lib/stores/view/editor/DataCubeEditorDimensionsPanelState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorDimensionsPanelState.js +102 -39
- package/lib/stores/view/editor/DataCubeEditorDimensionsPanelState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorHorizontalPivotsPanelState.d.ts +5 -5
- package/lib/stores/view/editor/DataCubeEditorHorizontalPivotsPanelState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorHorizontalPivotsPanelState.js +7 -6
- package/lib/stores/view/editor/DataCubeEditorHorizontalPivotsPanelState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorMutableConfiguration.d.ts +2 -1
- package/lib/stores/view/editor/DataCubeEditorMutableConfiguration.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorMutableConfiguration.js +5 -0
- package/lib/stores/view/editor/DataCubeEditorMutableConfiguration.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorSortsPanelState.d.ts +5 -5
- package/lib/stores/view/editor/DataCubeEditorSortsPanelState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorSortsPanelState.js +6 -6
- package/lib/stores/view/editor/DataCubeEditorSortsPanelState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorState.d.ts +3 -0
- package/lib/stores/view/editor/DataCubeEditorState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorState.js +6 -0
- package/lib/stores/view/editor/DataCubeEditorState.js.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorVerticalPivotsPanelState.d.ts +5 -5
- package/lib/stores/view/editor/DataCubeEditorVerticalPivotsPanelState.d.ts.map +1 -1
- package/lib/stores/view/editor/DataCubeEditorVerticalPivotsPanelState.js +6 -6
- package/lib/stores/view/editor/DataCubeEditorVerticalPivotsPanelState.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridClientEngine.d.ts +2 -1
- package/lib/stores/view/grid/DataCubeGridClientEngine.d.ts.map +1 -1
- package/lib/stores/view/grid/DataCubeGridClientEngine.js +11 -1
- package/lib/stores/view/grid/DataCubeGridClientEngine.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridClientExportEngine.js +1 -1
- package/lib/stores/view/grid/DataCubeGridClientExportEngine.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridMenuBuilder.d.ts +2 -0
- package/lib/stores/view/grid/DataCubeGridMenuBuilder.d.ts.map +1 -1
- package/lib/stores/view/grid/DataCubeGridMenuBuilder.js +9 -16
- package/lib/stores/view/grid/DataCubeGridMenuBuilder.js.map +1 -1
- package/lib/stores/view/grid/DataCubeGridState.d.ts +2 -2
- package/lib/stores/view/grid/DataCubeGridState.d.ts.map +1 -1
- package/lib/stores/view/grid/DataCubeGridState.js +19 -6
- package/lib/stores/view/grid/DataCubeGridState.js.map +1 -1
- package/package.json +13 -13
- package/src/components/view/editor/DataCubeEditor.tsx +8 -3
- package/src/components/view/editor/DataCubeEditorColumnsPanel.tsx +6 -8
- package/src/components/view/editor/{DataCubeEditorColumnSelector.tsx → DataCubeEditorColumnsSelector.tsx} +108 -83
- package/src/components/view/editor/DataCubeEditorDimensionsPanel.tsx +1259 -503
- package/src/components/view/editor/DataCubeEditorHorizontalPivotsPanel.tsx +5 -5
- package/src/components/view/editor/DataCubeEditorSortsPanel.tsx +10 -10
- package/src/components/view/editor/DataCubeEditorVerticalPivotsPanel.tsx +2 -2
- package/src/components/view/grid/DataCubeGrid.tsx +68 -60
- package/src/components/view/grid/DataCubeMultidimensionalGrid.tsx +3 -1
- package/src/stores/DataCubeAPI.ts +3 -1
- package/src/stores/core/DataCubeEngine.tsx +2 -1
- package/src/stores/core/DataCubeQueryEngine.ts +6 -0
- package/src/stores/core/DataCubeSnapshot.ts +1 -1
- package/src/stores/core/model/DataCubeConfiguration.ts +31 -0
- package/src/stores/services/DataCubeSettingService.tsx +10 -6
- package/src/stores/view/DataCubeInfoState.ts +4 -0
- package/src/stores/view/editor/DataCubeEditorColumnsPanelState.ts +13 -13
- package/src/stores/view/editor/{DataCubeEditorColumnSelectorState.ts → DataCubeEditorColumnsSelectorState.ts} +6 -6
- package/src/stores/view/editor/DataCubeEditorDimensionsPanelState.ts +162 -58
- package/src/stores/view/editor/DataCubeEditorHorizontalPivotsPanelState.ts +12 -11
- package/src/stores/view/editor/DataCubeEditorMutableConfiguration.ts +8 -0
- package/src/stores/view/editor/DataCubeEditorSortsPanelState.ts +10 -10
- package/src/stores/view/editor/DataCubeEditorState.tsx +6 -0
- package/src/stores/view/editor/DataCubeEditorVerticalPivotsPanelState.ts +11 -11
- package/src/stores/view/grid/DataCubeGridClientEngine.ts +12 -1
- package/src/stores/view/grid/DataCubeGridClientExportEngine.ts +1 -1
- package/src/stores/view/grid/DataCubeGridMenuBuilder.tsx +26 -1
- package/src/stores/view/grid/DataCubeGridState.ts +23 -6
- package/tsconfig.json +2 -3
- package/lib/components/view/editor/DataCubeEditorColumnSelector.d.ts +0 -38
- package/lib/components/view/editor/DataCubeEditorColumnSelector.d.ts.map +0 -1
- package/lib/components/view/editor/DataCubeEditorColumnSelector.js.map +0 -1
- package/lib/components/view/grid/DataCubeGridShared.d.ts +0 -18
- package/lib/components/view/grid/DataCubeGridShared.d.ts.map +0 -1
- package/lib/components/view/grid/DataCubeGridShared.js +0 -25
- package/lib/components/view/grid/DataCubeGridShared.js.map +0 -1
- package/lib/stores/view/editor/DataCubeEditorColumnSelectorState.d.ts.map +0 -1
- package/lib/stores/view/editor/DataCubeEditorColumnSelectorState.js.map +0 -1
- package/src/components/view/grid/DataCubeGridShared.tsx +0 -42
|
@@ -14,48 +14,62 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import type { DataCubeConfiguration } from '../../core/model/DataCubeConfiguration.js';
|
|
18
|
-
import { DataCubeColumnKind } from '../../core/DataCubeQueryEngine.js';
|
|
19
|
-
import { type DataCubeSnapshot } from '../../core/DataCubeSnapshot.js';
|
|
20
|
-
import { _findCol } from '../../core/model/DataCubeColumn.js';
|
|
21
17
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} from '
|
|
18
|
+
DataCubeDimensionsConfiguration,
|
|
19
|
+
type DataCubeConfiguration,
|
|
20
|
+
} from '../../core/model/DataCubeConfiguration.js';
|
|
21
|
+
import {
|
|
22
|
+
DataCubeColumnKind,
|
|
23
|
+
DataCubeGridMode,
|
|
24
|
+
} from '../../core/DataCubeQueryEngine.js';
|
|
25
|
+
import { type DataCubeSnapshot } from '../../core/DataCubeSnapshot.js';
|
|
26
|
+
import { _findCol, _sortByColName } from '../../core/model/DataCubeColumn.js';
|
|
27
|
+
import { DataCubeEditorColumnsSelectorColumnState } from './DataCubeEditorColumnsSelectorState.js';
|
|
25
28
|
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
26
29
|
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
27
30
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
31
|
+
import {
|
|
32
|
+
generateEnumerableNameFromToken,
|
|
33
|
+
guaranteeNonNullable,
|
|
34
|
+
} from '@finos/legend-shared';
|
|
28
35
|
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
export type DataCubeEditorDimensionsTreeNode = {
|
|
37
|
+
name: string;
|
|
38
|
+
data: DataCubeEditorDimensionState | DataCubeEditorColumnsSelectorColumnState;
|
|
39
|
+
children?: DataCubeEditorDimensionsTreeNode[] | undefined;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export class DataCubeEditorDimensionState {
|
|
43
|
+
name: string;
|
|
44
|
+
isRenaming = false;
|
|
45
|
+
columns: DataCubeEditorColumnsSelectorColumnState[] = [];
|
|
46
|
+
|
|
47
|
+
constructor(name: string) {
|
|
48
|
+
makeObservable(this, {
|
|
49
|
+
name: observable,
|
|
50
|
+
setName: action,
|
|
51
|
+
|
|
52
|
+
isRenaming: observable,
|
|
53
|
+
setIsRenaming: action,
|
|
54
|
+
|
|
55
|
+
columns: observable,
|
|
56
|
+
setColumns: action,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
this.name = name;
|
|
37
60
|
}
|
|
38
61
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
!_findCol(this._editor.groupExtendColumns, column.name) &&
|
|
46
|
-
// exclude pivot columns
|
|
47
|
-
!_findCol(
|
|
48
|
-
this._editor.horizontalPivots.selector.selectedColumns,
|
|
49
|
-
column.name,
|
|
50
|
-
),
|
|
51
|
-
)
|
|
52
|
-
.map(
|
|
53
|
-
(col) =>
|
|
54
|
-
new DataCubeEditorColumnSelectorColumnState(col.name, col.type),
|
|
55
|
-
);
|
|
62
|
+
setName(name: string) {
|
|
63
|
+
this.name = name;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
setIsRenaming(val: boolean) {
|
|
67
|
+
this.isRenaming = val;
|
|
56
68
|
}
|
|
57
69
|
|
|
58
|
-
|
|
70
|
+
setColumns(columns: DataCubeEditorColumnsSelectorColumnState[]) {
|
|
71
|
+
this.columns = columns;
|
|
72
|
+
}
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
export class DataCubeEditorDimensionsPanelState
|
|
@@ -64,14 +78,32 @@ export class DataCubeEditorDimensionsPanelState
|
|
|
64
78
|
readonly _editor!: DataCubeEditorState;
|
|
65
79
|
|
|
66
80
|
availableColumnsSearchText = '';
|
|
67
|
-
|
|
81
|
+
dimensions: DataCubeEditorDimensionState[] = [];
|
|
82
|
+
dimensionsTreeData: {
|
|
83
|
+
nodes: DataCubeEditorDimensionsTreeNode[];
|
|
84
|
+
} = { nodes: [] };
|
|
85
|
+
dimensionsTreeSearchText = '';
|
|
68
86
|
|
|
69
87
|
constructor(editor: DataCubeEditorState) {
|
|
70
88
|
makeObservable(this, {
|
|
89
|
+
availableColumns: computed,
|
|
90
|
+
availableColumnsForDisplay: computed,
|
|
91
|
+
|
|
71
92
|
availableColumnsSearchText: observable,
|
|
72
93
|
setAvailableColumnsSearchText: action,
|
|
73
94
|
|
|
74
|
-
|
|
95
|
+
selectedColumns: computed,
|
|
96
|
+
deselectColumns: action,
|
|
97
|
+
|
|
98
|
+
dimensions: observable,
|
|
99
|
+
setDimensions: action,
|
|
100
|
+
newDimension: action,
|
|
101
|
+
|
|
102
|
+
dimensionsTreeData: observable.ref,
|
|
103
|
+
refreshDimensionsTreeData: action,
|
|
104
|
+
|
|
105
|
+
dimensionsTreeSearchText: observable,
|
|
106
|
+
setDimensionsTreeSearchText: action,
|
|
75
107
|
});
|
|
76
108
|
|
|
77
109
|
this._editor = editor;
|
|
@@ -92,43 +124,115 @@ export class DataCubeEditorDimensionsPanelState
|
|
|
92
124
|
)
|
|
93
125
|
.map(
|
|
94
126
|
(col) =>
|
|
95
|
-
new
|
|
127
|
+
new DataCubeEditorColumnsSelectorColumnState(col.name, col.type),
|
|
96
128
|
);
|
|
97
129
|
}
|
|
98
130
|
|
|
131
|
+
get availableColumnsForDisplay() {
|
|
132
|
+
return this.availableColumns
|
|
133
|
+
.filter((column) => !_findCol(this.selectedColumns, column.name))
|
|
134
|
+
.sort(_sortByColName);
|
|
135
|
+
}
|
|
136
|
+
|
|
99
137
|
setAvailableColumnsSearchText(val: string) {
|
|
100
138
|
this.availableColumnsSearchText = val;
|
|
101
139
|
}
|
|
102
140
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
141
|
+
get selectedColumns() {
|
|
142
|
+
return this.dimensions.flatMap((dimension) => dimension.columns);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
deselectColumns(columns: DataCubeEditorColumnsSelectorColumnState[]) {
|
|
146
|
+
this.dimensions.forEach((dimension) => {
|
|
147
|
+
dimension.setColumns(
|
|
148
|
+
dimension.columns.filter((column) => !_findCol(columns, column.name)),
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
setDimensions(dimensions: DataCubeEditorDimensionState[]) {
|
|
154
|
+
this.dimensions = dimensions;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
newDimension() {
|
|
158
|
+
const newDimension = new DataCubeEditorDimensionState(
|
|
159
|
+
generateEnumerableNameFromToken(
|
|
160
|
+
this.dimensions.map((dimension) => dimension.name),
|
|
161
|
+
'Dimension',
|
|
162
|
+
'whitespace',
|
|
163
|
+
),
|
|
164
|
+
);
|
|
165
|
+
this.dimensions.push(newDimension);
|
|
166
|
+
return newDimension;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
refreshDimensionsTreeData() {
|
|
170
|
+
this.dimensionsTreeData = {
|
|
171
|
+
nodes: this.dimensions.map((dimension) => ({
|
|
172
|
+
name: dimension.name,
|
|
173
|
+
data: dimension,
|
|
174
|
+
children: dimension.columns.map((column) => ({
|
|
175
|
+
name: column.name,
|
|
176
|
+
data: column,
|
|
177
|
+
})),
|
|
178
|
+
})),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
setDimensionsTreeSearchText(val: string) {
|
|
183
|
+
this.dimensionsTreeSearchText = val;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
adaptPropagatedChanges(): void {
|
|
187
|
+
this.deselectColumns(
|
|
188
|
+
this.selectedColumns.filter(
|
|
189
|
+
(column) => !_findCol(this.availableColumns, column.name),
|
|
190
|
+
),
|
|
191
|
+
);
|
|
192
|
+
this.refreshDimensionsTreeData();
|
|
193
|
+
}
|
|
110
194
|
|
|
111
195
|
applySnaphot(
|
|
112
196
|
snapshot: DataCubeSnapshot,
|
|
113
197
|
configuration: DataCubeConfiguration,
|
|
114
198
|
) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
199
|
+
this.setDimensions(
|
|
200
|
+
configuration.dimensions.dimensions.map((dimension) => {
|
|
201
|
+
const _dimension = new DataCubeEditorDimensionState(dimension.name);
|
|
202
|
+
_dimension.setColumns(
|
|
203
|
+
dimension.columns.map((colName) => {
|
|
204
|
+
const column = guaranteeNonNullable(
|
|
205
|
+
_findCol(configuration.columns, colName),
|
|
206
|
+
);
|
|
207
|
+
return new DataCubeEditorColumnsSelectorColumnState(
|
|
208
|
+
column.name,
|
|
209
|
+
column.type,
|
|
210
|
+
);
|
|
211
|
+
}),
|
|
212
|
+
);
|
|
213
|
+
return _dimension;
|
|
214
|
+
}),
|
|
215
|
+
);
|
|
121
216
|
}
|
|
122
217
|
|
|
123
218
|
buildSnapshot(newSnapshot: DataCubeSnapshot, baseSnapshot: DataCubeSnapshot) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
219
|
+
const dimensionsConfiguration = new DataCubeDimensionsConfiguration();
|
|
220
|
+
|
|
221
|
+
if (
|
|
222
|
+
this._editor.generalProperties.configuration.gridMode ===
|
|
223
|
+
DataCubeGridMode.MULTIDIMENSIONAL
|
|
224
|
+
) {
|
|
225
|
+
dimensionsConfiguration.dimensions = this.dimensions.map((dimension) => ({
|
|
226
|
+
name: dimension.name,
|
|
227
|
+
columns: dimension.columns.map((column) => column.name),
|
|
228
|
+
}));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
newSnapshot.data.configuration = {
|
|
232
|
+
...newSnapshot.data.configuration,
|
|
233
|
+
dimensions: DataCubeDimensionsConfiguration.serialization.toJson(
|
|
234
|
+
dimensionsConfiguration,
|
|
235
|
+
),
|
|
236
|
+
};
|
|
133
237
|
}
|
|
134
238
|
}
|
|
@@ -28,18 +28,18 @@ import {
|
|
|
28
28
|
type DataCubeColumn,
|
|
29
29
|
} from '../../core/model/DataCubeColumn.js';
|
|
30
30
|
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} from './
|
|
31
|
+
DataCubeEditorColumnsSelectorState,
|
|
32
|
+
DataCubeEditorColumnsSelectorSortColumnState,
|
|
33
|
+
} from './DataCubeEditorColumnsSelectorState.js';
|
|
34
34
|
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
35
35
|
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
36
36
|
import { uniqBy } from '@finos/legend-shared';
|
|
37
37
|
|
|
38
|
-
export class
|
|
38
|
+
export class DataCubeEditorHorizontalPivotColumnsSelectorState extends DataCubeEditorColumnsSelectorState<DataCubeEditorColumnsSelectorSortColumnState> {
|
|
39
39
|
override cloneColumn(
|
|
40
|
-
column:
|
|
41
|
-
):
|
|
42
|
-
return new
|
|
40
|
+
column: DataCubeEditorColumnsSelectorSortColumnState,
|
|
41
|
+
): DataCubeEditorColumnsSelectorSortColumnState {
|
|
42
|
+
return new DataCubeEditorColumnsSelectorSortColumnState(
|
|
43
43
|
column.name,
|
|
44
44
|
column.type,
|
|
45
45
|
column.direction,
|
|
@@ -57,7 +57,7 @@ export class DataCubeEditorHorizontalPivotColumnSelectorState extends DataCubeEd
|
|
|
57
57
|
)
|
|
58
58
|
.map(
|
|
59
59
|
(col) =>
|
|
60
|
-
new
|
|
60
|
+
new DataCubeEditorColumnsSelectorSortColumnState(
|
|
61
61
|
col.name,
|
|
62
62
|
col.type,
|
|
63
63
|
DataCubeQuerySortDirection.ASCENDING,
|
|
@@ -72,7 +72,7 @@ export class DataCubeEditorHorizontalPivotsPanelState
|
|
|
72
72
|
{
|
|
73
73
|
private readonly _editor!: DataCubeEditorState;
|
|
74
74
|
|
|
75
|
-
readonly selector!:
|
|
75
|
+
readonly selector!: DataCubeEditorHorizontalPivotColumnsSelectorState;
|
|
76
76
|
|
|
77
77
|
castColumns: DataCubeColumn[] = [];
|
|
78
78
|
|
|
@@ -86,7 +86,7 @@ export class DataCubeEditorHorizontalPivotsPanelState
|
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
this._editor = editor;
|
|
89
|
-
this.selector = new
|
|
89
|
+
this.selector = new DataCubeEditorHorizontalPivotColumnsSelectorState(
|
|
90
90
|
editor,
|
|
91
91
|
{
|
|
92
92
|
onChange: (selector) => {
|
|
@@ -113,6 +113,7 @@ export class DataCubeEditorHorizontalPivotsPanelState
|
|
|
113
113
|
|
|
114
114
|
propagateChanges() {
|
|
115
115
|
this._editor.verticalPivots.adaptPropagatedChanges();
|
|
116
|
+
this._editor.dimensions.adaptPropagatedChanges();
|
|
116
117
|
this._editor.sorts.adaptPropagatedChanges();
|
|
117
118
|
}
|
|
118
119
|
|
|
@@ -123,7 +124,7 @@ export class DataCubeEditorHorizontalPivotsPanelState
|
|
|
123
124
|
this.selector.setSelectedColumns(
|
|
124
125
|
(snapshot.data.pivot?.columns ?? []).map(
|
|
125
126
|
(col) =>
|
|
126
|
-
new
|
|
127
|
+
new DataCubeEditorColumnsSelectorSortColumnState(
|
|
127
128
|
col.name,
|
|
128
129
|
col.type,
|
|
129
130
|
_findCol(configuration.columns, col.name)?.pivotSortDirection ??
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
DEFAULT_ERROR_FOREGROUND_COLOR,
|
|
40
40
|
DEFAULT_BACKGROUND_COLOR,
|
|
41
41
|
type DataCubeColumnDataType,
|
|
42
|
+
type DataCubeGridMode,
|
|
42
43
|
} from '../../core/DataCubeQueryEngine.js';
|
|
43
44
|
import { type PlainObject, type Writable } from '@finos/legend-shared';
|
|
44
45
|
import { makeObservable, observable, action, computed } from 'mobx';
|
|
@@ -434,6 +435,9 @@ export class DataCubeEditorMutableConfiguration extends DataCubeConfiguration {
|
|
|
434
435
|
gridLineColor: observable,
|
|
435
436
|
setGridLineColor: action,
|
|
436
437
|
|
|
438
|
+
gridMode: observable,
|
|
439
|
+
setGridMode: action,
|
|
440
|
+
|
|
437
441
|
fontFamily: observable,
|
|
438
442
|
setFontFamily: action,
|
|
439
443
|
|
|
@@ -583,6 +587,10 @@ export class DataCubeEditorMutableConfiguration extends DataCubeConfiguration {
|
|
|
583
587
|
this.gridLineColor = value;
|
|
584
588
|
}
|
|
585
589
|
|
|
590
|
+
setGridMode(value: DataCubeGridMode) {
|
|
591
|
+
this.gridMode = value;
|
|
592
|
+
}
|
|
593
|
+
|
|
586
594
|
setFontFamily(value: DataCubeFont) {
|
|
587
595
|
this.fontFamily = value;
|
|
588
596
|
}
|
|
@@ -22,16 +22,16 @@ import {
|
|
|
22
22
|
} from '../../core/DataCubeQueryEngine.js';
|
|
23
23
|
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
24
24
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from './
|
|
25
|
+
DataCubeEditorColumnsSelectorState,
|
|
26
|
+
DataCubeEditorColumnsSelectorSortColumnState,
|
|
27
|
+
} from './DataCubeEditorColumnsSelectorState.js';
|
|
28
28
|
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
29
29
|
import type { DataCubeConfiguration } from '../../core/model/DataCubeConfiguration.js';
|
|
30
30
|
import { uniqBy } from '@finos/legend-shared';
|
|
31
31
|
|
|
32
|
-
export class
|
|
33
|
-
override cloneColumn(column:
|
|
34
|
-
return new
|
|
32
|
+
export class DataCubeEditorSortColumnsSelectorState extends DataCubeEditorColumnsSelectorState<DataCubeEditorColumnsSelectorSortColumnState> {
|
|
33
|
+
override cloneColumn(column: DataCubeEditorColumnsSelectorSortColumnState) {
|
|
34
|
+
return new DataCubeEditorColumnsSelectorSortColumnState(
|
|
35
35
|
column.name,
|
|
36
36
|
column.type,
|
|
37
37
|
column.direction,
|
|
@@ -69,7 +69,7 @@ export class DataCubeEditorSortColumnSelectorState extends DataCubeEditorColumnS
|
|
|
69
69
|
(col) => col.name,
|
|
70
70
|
).map(
|
|
71
71
|
(col) =>
|
|
72
|
-
new
|
|
72
|
+
new DataCubeEditorColumnsSelectorSortColumnState(
|
|
73
73
|
col.name,
|
|
74
74
|
col.type,
|
|
75
75
|
DataCubeQuerySortDirection.ASCENDING,
|
|
@@ -81,10 +81,10 @@ export class DataCubeEditorSortColumnSelectorState extends DataCubeEditorColumnS
|
|
|
81
81
|
export class DataCubeEditorSortsPanelState
|
|
82
82
|
implements DataCubeQueryEditorPanelState
|
|
83
83
|
{
|
|
84
|
-
readonly selector!:
|
|
84
|
+
readonly selector!: DataCubeEditorColumnsSelectorState<DataCubeEditorColumnsSelectorSortColumnState>;
|
|
85
85
|
|
|
86
86
|
constructor(editor: DataCubeEditorState) {
|
|
87
|
-
this.selector = new
|
|
87
|
+
this.selector = new DataCubeEditorSortColumnsSelectorState(editor);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
adaptPropagatedChanges(): void {
|
|
@@ -102,7 +102,7 @@ export class DataCubeEditorSortsPanelState
|
|
|
102
102
|
this.selector.setSelectedColumns(
|
|
103
103
|
snapshot.data.sortColumns.map((col) => {
|
|
104
104
|
const column = this.selector.getColumn(col.name);
|
|
105
|
-
return new
|
|
105
|
+
return new DataCubeEditorColumnsSelectorSortColumnState(
|
|
106
106
|
column.name,
|
|
107
107
|
column.type,
|
|
108
108
|
col.direction,
|
|
@@ -43,12 +43,14 @@ import { DataCubeEditorHorizontalPivotsPanelState } from './DataCubeEditorHorizo
|
|
|
43
43
|
import { DataCubeEditorPivotLayoutPanelState } from './DataCubeEditorPivotLayoutPanelState.js';
|
|
44
44
|
import { _lambda } from '../../core/DataCubeQueryBuilderUtils.js';
|
|
45
45
|
import { EngineError } from '@finos/legend-graph';
|
|
46
|
+
import { DataCubeEditorDimensionsPanelState } from './DataCubeEditorDimensionsPanelState.js';
|
|
46
47
|
|
|
47
48
|
export enum DataCubeEditorTab {
|
|
48
49
|
GENERAL_PROPERTIES = 'General Properties',
|
|
49
50
|
COLUMN_PROPERTIES = 'Column Properties',
|
|
50
51
|
COLUMNS = 'Columns',
|
|
51
52
|
VERTICAL_PIVOTS = 'Vertical Pivots',
|
|
53
|
+
DIMENSIONS = 'Dimensions',
|
|
52
54
|
HORIZONTAL_PIVOTS = 'Horizontal Pivots',
|
|
53
55
|
SORTS = 'Sorts',
|
|
54
56
|
}
|
|
@@ -74,6 +76,7 @@ export class DataCubeEditorState extends DataCubeSnapshotController {
|
|
|
74
76
|
readonly columns: DataCubeEditorColumnsPanelState;
|
|
75
77
|
readonly horizontalPivots: DataCubeEditorHorizontalPivotsPanelState;
|
|
76
78
|
readonly verticalPivots: DataCubeEditorVerticalPivotsPanelState;
|
|
79
|
+
readonly dimensions: DataCubeEditorDimensionsPanelState;
|
|
77
80
|
readonly sorts: DataCubeEditorSortsPanelState;
|
|
78
81
|
|
|
79
82
|
currentTab = DataCubeEditorTab.GENERAL_PROPERTIES;
|
|
@@ -107,6 +110,7 @@ export class DataCubeEditorState extends DataCubeSnapshotController {
|
|
|
107
110
|
);
|
|
108
111
|
this.pivotLayout = new DataCubeEditorPivotLayoutPanelState(this);
|
|
109
112
|
this.columnProperties = new DataCubeEditorColumnPropertiesPanelState(this);
|
|
113
|
+
this.dimensions = new DataCubeEditorDimensionsPanelState(this);
|
|
110
114
|
this.columns = new DataCubeEditorColumnsPanelState(this);
|
|
111
115
|
this.horizontalPivots = new DataCubeEditorHorizontalPivotsPanelState(this);
|
|
112
116
|
this.verticalPivots = new DataCubeEditorVerticalPivotsPanelState(this);
|
|
@@ -131,6 +135,7 @@ export class DataCubeEditorState extends DataCubeSnapshotController {
|
|
|
131
135
|
this.generalProperties.applySnaphot(snapshot, configuration);
|
|
132
136
|
this.pivotLayout.applySnaphot(snapshot, configuration);
|
|
133
137
|
this.columnProperties.applySnaphot(snapshot, configuration);
|
|
138
|
+
this.dimensions.applySnaphot(snapshot, configuration);
|
|
134
139
|
|
|
135
140
|
this.columns.applySnaphot(snapshot, configuration);
|
|
136
141
|
this.horizontalPivots.applySnaphot(snapshot, configuration);
|
|
@@ -153,6 +158,7 @@ export class DataCubeEditorState extends DataCubeSnapshotController {
|
|
|
153
158
|
this.generalProperties.buildSnapshot(newSnapshot, baseSnapshot);
|
|
154
159
|
this.pivotLayout.buildSnapshot(newSnapshot, baseSnapshot);
|
|
155
160
|
this.columnProperties.buildSnapshot(newSnapshot, baseSnapshot);
|
|
161
|
+
this.dimensions.buildSnapshot(newSnapshot, baseSnapshot);
|
|
156
162
|
|
|
157
163
|
// NOTE: column selection must be processed first since the snapshot
|
|
158
164
|
// processing of other parts of the query can be affected by column selection.
|
|
@@ -20,17 +20,17 @@ import { DataCubeColumnKind } from '../../core/DataCubeQueryEngine.js';
|
|
|
20
20
|
import { type DataCubeSnapshot } from '../../core/DataCubeSnapshot.js';
|
|
21
21
|
import { _findCol, _toCol } from '../../core/model/DataCubeColumn.js';
|
|
22
22
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} from './
|
|
23
|
+
DataCubeEditorColumnsSelectorColumnState,
|
|
24
|
+
DataCubeEditorColumnsSelectorState,
|
|
25
|
+
} from './DataCubeEditorColumnsSelectorState.js';
|
|
26
26
|
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
27
27
|
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
28
28
|
|
|
29
|
-
export class
|
|
29
|
+
export class DataCubeEditorVerticalPivotColumnsSelectorState extends DataCubeEditorColumnsSelectorState<DataCubeEditorColumnsSelectorColumnState> {
|
|
30
30
|
override cloneColumn(
|
|
31
|
-
column:
|
|
32
|
-
):
|
|
33
|
-
return new
|
|
31
|
+
column: DataCubeEditorColumnsSelectorColumnState,
|
|
32
|
+
): DataCubeEditorColumnsSelectorColumnState {
|
|
33
|
+
return new DataCubeEditorColumnsSelectorColumnState(
|
|
34
34
|
column.name,
|
|
35
35
|
column.type,
|
|
36
36
|
);
|
|
@@ -51,7 +51,7 @@ export class DataCubeEditorVerticalPivotColumnSelectorState extends DataCubeEdit
|
|
|
51
51
|
)
|
|
52
52
|
.map(
|
|
53
53
|
(col) =>
|
|
54
|
-
new
|
|
54
|
+
new DataCubeEditorColumnsSelectorColumnState(col.name, col.type),
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -59,10 +59,10 @@ export class DataCubeEditorVerticalPivotColumnSelectorState extends DataCubeEdit
|
|
|
59
59
|
export class DataCubeEditorVerticalPivotsPanelState
|
|
60
60
|
implements DataCubeQueryEditorPanelState
|
|
61
61
|
{
|
|
62
|
-
readonly selector!:
|
|
62
|
+
readonly selector!: DataCubeEditorVerticalPivotColumnsSelectorState;
|
|
63
63
|
|
|
64
64
|
constructor(editor: DataCubeEditorState) {
|
|
65
|
-
this.selector = new
|
|
65
|
+
this.selector = new DataCubeEditorVerticalPivotColumnsSelectorState(editor);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
adaptPropagatedChanges(): void {
|
|
@@ -80,7 +80,7 @@ export class DataCubeEditorVerticalPivotsPanelState
|
|
|
80
80
|
this.selector.setSelectedColumns(
|
|
81
81
|
(snapshot.data.groupBy?.columns ?? []).map(
|
|
82
82
|
(col) =>
|
|
83
|
-
new
|
|
83
|
+
new DataCubeEditorColumnsSelectorColumnState(col.name, col.type),
|
|
84
84
|
),
|
|
85
85
|
);
|
|
86
86
|
}
|
|
@@ -152,6 +152,14 @@ export enum DataCubeGridClientSortDirection {
|
|
|
152
152
|
DESCENDING = 'desc',
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
export function getAllNodes<T>(client: GridApi<T>): IRowNode<T>[] {
|
|
156
|
+
const rows: IRowNode<T>[] = [];
|
|
157
|
+
client.forEachNode((node: IRowNode<T>) => {
|
|
158
|
+
rows.push(node);
|
|
159
|
+
});
|
|
160
|
+
return rows;
|
|
161
|
+
}
|
|
162
|
+
|
|
155
163
|
export function getDataForAllNodes<T>(client: GridApi<T>): T[] {
|
|
156
164
|
const rows: T[] = [];
|
|
157
165
|
client.forEachNode((node: IRowNode<T>) => {
|
|
@@ -455,7 +463,10 @@ export class DataCubeGridClientServerSideDataSource
|
|
|
455
463
|
'Stats',
|
|
456
464
|
`${rowData.length} rows, ${result.result.result.columns.length} columns`,
|
|
457
465
|
],
|
|
458
|
-
[
|
|
466
|
+
[
|
|
467
|
+
'SQL',
|
|
468
|
+
result.executedSQL ?? `-- Error: failed to extract executed SQL`,
|
|
469
|
+
],
|
|
459
470
|
['SQL Execution Time', result.executionTime],
|
|
460
471
|
);
|
|
461
472
|
}
|
|
@@ -87,7 +87,7 @@ export class DataCubeGridClientExportEngine {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
private generateFileName() {
|
|
90
|
-
return `${this._grid.
|
|
90
|
+
return `${this._grid.configuration.name} - ${formatDate(new Date(), 'EEE MMM dd yyyy HH_mm_ss')}`;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
exportFile(format: DataCubeGridClientExportFormat) {
|
|
@@ -20,7 +20,6 @@ import type {
|
|
|
20
20
|
GetMainMenuItemsParams,
|
|
21
21
|
MenuItemDef,
|
|
22
22
|
} from 'ag-grid-community';
|
|
23
|
-
import { WIP_GridMenuItem } from '../../../components/view/grid/DataCubeGridShared.js';
|
|
24
23
|
import {
|
|
25
24
|
DataCubeQuerySortDirection,
|
|
26
25
|
DataCubeColumnPinPlacement,
|
|
@@ -48,6 +47,32 @@ import type { DataCubeColumnConfiguration } from '../../core/model/DataCubeConfi
|
|
|
48
47
|
import { DataCubeFilterEditorConditionTreeNode } from '../../core/filter/DataCubeQueryFilterEditorState.js';
|
|
49
48
|
import { DataCubeEditorTab } from '../editor/DataCubeEditorState.js';
|
|
50
49
|
import { _findCol } from '../../core/model/DataCubeColumn.js';
|
|
50
|
+
import { useGridMenuItem, type CustomMenuItemProps } from 'ag-grid-react';
|
|
51
|
+
import { FormBadge_WIP } from '../../../components/core/DataCubeFormUtils.js';
|
|
52
|
+
|
|
53
|
+
export function WIP_GridMenuItem({
|
|
54
|
+
name,
|
|
55
|
+
subMenu,
|
|
56
|
+
checked,
|
|
57
|
+
}: CustomMenuItemProps) {
|
|
58
|
+
useGridMenuItem({
|
|
59
|
+
configureDefaults: () => true,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div>
|
|
64
|
+
<span className="ag-menu-option-part ag-menu-option-icon"></span>
|
|
65
|
+
<span className="ag-menu-option-part ag-menu-option-text !inline-flex items-center">
|
|
66
|
+
<span className="opacity-50">{name}</span>
|
|
67
|
+
<FormBadge_WIP />
|
|
68
|
+
</span>
|
|
69
|
+
<span className="ag-menu-option-part ag-menu-option-shortcut"></span>
|
|
70
|
+
<span className="ag-menu-option-part ag-menu-option-popup-pointer select-none">
|
|
71
|
+
{subMenu && <span className="ag-icon ag-icon-small-right"></span>}
|
|
72
|
+
</span>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
51
76
|
|
|
52
77
|
function toFilterValue(
|
|
53
78
|
value: unknown,
|
|
@@ -40,6 +40,7 @@ import { DataCubeGridClientExportEngine } from './DataCubeGridClientExportEngine
|
|
|
40
40
|
import { DataCubeSettingKey } from '../../../__lib__/DataCubeSetting.js';
|
|
41
41
|
import { DEFAULT_ALERT_WINDOW_CONFIG } from '../../services/DataCubeLayoutService.js';
|
|
42
42
|
import { AlertType } from '../../services/DataCubeAlertService.js';
|
|
43
|
+
import { DataCubeGridMode } from '../../core/DataCubeQueryEngine.js';
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
46
|
* This query editor state is responsible for syncing the internal state of ag-grid
|
|
@@ -65,7 +66,7 @@ export class DataCubeGridState extends DataCubeSnapshotController {
|
|
|
65
66
|
private _client?: GridApi | undefined;
|
|
66
67
|
clientDataSource: DataCubeGridClientServerSideDataSource;
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
configuration: DataCubeConfiguration = new DataCubeConfiguration();
|
|
69
70
|
rowLimit?: number | undefined;
|
|
70
71
|
isPaginationEnabled = INTERNAL__GRID_CLIENT_DEFAULT_ENABLE_PAGINATION;
|
|
71
72
|
isCachingEnabled = INTERNAL__GRID_CLIENT_DEFAULT_ENABLE_CACHING;
|
|
@@ -80,7 +81,7 @@ export class DataCubeGridState extends DataCubeSnapshotController {
|
|
|
80
81
|
makeObservable(this, {
|
|
81
82
|
clientDataSource: observable,
|
|
82
83
|
|
|
83
|
-
|
|
84
|
+
configuration: observable,
|
|
84
85
|
|
|
85
86
|
rowLimit: observable,
|
|
86
87
|
|
|
@@ -99,7 +100,6 @@ export class DataCubeGridState extends DataCubeSnapshotController {
|
|
|
99
100
|
this._view = view;
|
|
100
101
|
this.controller = new DataCubeGridControllerState(this._view);
|
|
101
102
|
this.exportEngine = new DataCubeGridClientExportEngine(this);
|
|
102
|
-
this.queryConfiguration = new DataCubeConfiguration();
|
|
103
103
|
this.clientDataSource = new DataCubeGridClientServerSideDataSource(
|
|
104
104
|
this,
|
|
105
105
|
this._view,
|
|
@@ -236,12 +236,19 @@ export class DataCubeGridState extends DataCubeSnapshotController {
|
|
|
236
236
|
return guaranteeNonNullable(this._client, 'Grid client is not configured');
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
configureClient(val: GridApi | undefined) {
|
|
239
|
+
async configureClient(val: GridApi | undefined) {
|
|
240
240
|
this._client = val;
|
|
241
241
|
this.debouncedAutoResizeColumns = debounce(
|
|
242
242
|
() => val?.autoSizeAllColumns(),
|
|
243
243
|
100,
|
|
244
244
|
);
|
|
245
|
+
|
|
246
|
+
// reapply latest snapshot when grid client is configured
|
|
247
|
+
// this happens during initialization/switching between grid modes
|
|
248
|
+
const latestSnapshot = this.getLatestSnapshot();
|
|
249
|
+
if (latestSnapshot) {
|
|
250
|
+
await this.applySnapshot(latestSnapshot, undefined);
|
|
251
|
+
}
|
|
245
252
|
}
|
|
246
253
|
|
|
247
254
|
override getSnapshotSubscriberName() {
|
|
@@ -255,8 +262,18 @@ export class DataCubeGridState extends DataCubeSnapshotController {
|
|
|
255
262
|
const configuration = DataCubeConfiguration.serialization.fromJson(
|
|
256
263
|
snapshot.data.configuration,
|
|
257
264
|
);
|
|
258
|
-
this.
|
|
259
|
-
|
|
265
|
+
this.configuration = configuration;
|
|
266
|
+
|
|
267
|
+
// Only proceed if the grid mode is standard, else the client won't be populated properly
|
|
268
|
+
// and we cannot continue anyway.
|
|
269
|
+
if (
|
|
270
|
+
configuration.gridMode !== DataCubeGridMode.STANDARD ||
|
|
271
|
+
// NOTE: have to make sure the grid API client has been properly configured before proceeding
|
|
272
|
+
!this._client ||
|
|
273
|
+
this._client.isDestroyed()
|
|
274
|
+
) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
260
277
|
|
|
261
278
|
const gridOptions = generateGridOptionsFromSnapshot(
|
|
262
279
|
snapshot,
|