@finos/legend-application-repl 0.0.40 → 0.0.41
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/application/LegendREPL.d.ts +2 -2
- package/lib/application/LegendREPL.d.ts.map +1 -1
- package/lib/application/LegendREPL.js.map +1 -1
- package/lib/application/LegendREPLApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendREPLDocumentation.d.ts +2 -1
- package/lib/application/LegendREPLDocumentation.d.ts.map +1 -1
- package/lib/application/LegendREPLDocumentation.js +1 -0
- package/lib/application/LegendREPLDocumentation.js.map +1 -1
- package/lib/application/LegendREPLPluginManager.d.ts.map +1 -1
- package/lib/application/LegendREPLPluginManager.js.map +1 -1
- package/lib/components/LegendREPLApplication.js +2 -2
- package/lib/components/LegendREPLApplication.js.map +1 -1
- package/lib/components/LegendREPLFrameworkProvider.d.ts +3 -2
- package/lib/components/LegendREPLFrameworkProvider.d.ts.map +1 -1
- package/lib/components/LegendREPLFrameworkProvider.js +1 -1
- package/lib/components/LegendREPLFrameworkProvider.js.map +1 -1
- package/lib/components/REPLStoreProvider.d.ts.map +1 -1
- package/lib/components/REPLStoreProvider.js.map +1 -1
- package/lib/components/dataCube/DataCube.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditor.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js +3 -3
- package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js +14 -12
- package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.js +4 -4
- package/lib/components/dataCube/grid/DataCubeGrid.d.ts.map +1 -1
- package/lib/components/dataCube/grid/DataCubeGrid.js +1 -1
- package/lib/components/dataCube/grid/DataCubeGrid.js.map +1 -1
- package/lib/components/repl/Alert.d.ts +14 -2
- package/lib/components/repl/Alert.d.ts.map +1 -1
- package/lib/components/repl/Alert.js +42 -24
- package/lib/components/repl/Alert.js.map +1 -1
- package/lib/components/repl/DocumentationPanel.d.ts +0 -5
- package/lib/components/repl/DocumentationPanel.d.ts.map +1 -1
- package/lib/components/repl/DocumentationPanel.js +2 -28
- package/lib/components/repl/DocumentationPanel.js.map +1 -1
- package/lib/components/repl/Form.d.ts +5 -0
- package/lib/components/repl/Form.d.ts.map +1 -1
- package/lib/components/repl/Form.js +27 -0
- package/lib/components/repl/Form.js.map +1 -1
- package/lib/components/repl/SettingsPanel.d.ts.map +1 -1
- package/lib/components/repl/SettingsPanel.js +6 -3
- package/lib/components/repl/SettingsPanel.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/server/REPLEngine.d.ts +1 -0
- package/lib/server/REPLEngine.d.ts.map +1 -1
- package/lib/server/REPLEngine.js.map +1 -1
- package/lib/stores/LayoutManagerState.d.ts +2 -1
- package/lib/stores/LayoutManagerState.d.ts.map +1 -1
- package/lib/stores/LayoutManagerState.js +8 -1
- package/lib/stores/LayoutManagerState.js.map +1 -1
- package/lib/stores/LegendREPLApplicationPlugin.d.ts +2 -1
- package/lib/stores/LegendREPLApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/REPLStore.d.ts +17 -2
- package/lib/stores/REPLStore.d.ts.map +1 -1
- package/lib/stores/REPLStore.js +15 -5
- package/lib/stores/REPLStore.js.map +1 -1
- package/lib/stores/dataCube/DataCubeEngine.d.ts +6 -1
- package/lib/stores/dataCube/DataCubeEngine.d.ts.map +1 -1
- package/lib/stores/dataCube/DataCubeEngine.js +19 -7
- package/lib/stores/dataCube/DataCubeEngine.js.map +1 -1
- package/lib/stores/dataCube/DataCubeState.d.ts.map +1 -1
- package/lib/stores/dataCube/DataCubeState.js +1 -0
- package/lib/stores/dataCube/DataCubeState.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts +2 -3
- package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeConfiguration.js +2 -4
- package/lib/stores/dataCube/core/DataCubeConfiguration.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeCoreState.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQueryBuilder.d.ts +4 -4
- package/lib/stores/dataCube/core/DataCubeQueryBuilder.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQueryBuilder.js +70 -12
- package/lib/stores/dataCube/core/DataCubeQueryBuilder.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts +8 -2
- package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQueryEngine.js +20 -15
- package/lib/stores/dataCube/core/DataCubeQueryEngine.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts +5 -4
- package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.d.ts +2 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js +131 -11
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js +28 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorColumnsPanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorColumnsPanelState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.js +2 -1
- package/lib/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts +9 -4
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js +20 -4
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts +3 -0
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js +64 -9
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridClientExportEngine.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridConfigurationBuilder.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridConfigurationBuilder.js +23 -27
- package/lib/stores/dataCube/grid/DataCubeGridConfigurationBuilder.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridControllerState.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridControllerState.js +2 -9
- package/lib/stores/dataCube/grid/DataCubeGridControllerState.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.d.ts +2 -1
- package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js +63 -11
- package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.d.ts +3 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js +14 -26
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridState.d.ts +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridState.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridState.js +16 -2
- package/lib/stores/dataCube/grid/DataCubeGridState.js.map +1 -1
- package/package.json +6 -6
- package/src/application/LegendREPL.tsx +3 -6
- package/src/application/LegendREPLApplicationConfig.ts +1 -1
- package/src/application/LegendREPLDocumentation.ts +1 -0
- package/src/application/LegendREPLPluginManager.ts +7 -9
- package/src/components/LegendREPLApplication.tsx +2 -2
- package/src/components/LegendREPLFrameworkProvider.tsx +2 -5
- package/src/components/REPLStoreProvider.tsx +1 -1
- package/src/components/dataCube/DataCube.tsx +1 -1
- package/src/components/dataCube/editor/DataCubeEditor.tsx +2 -2
- package/src/components/dataCube/editor/DataCubeEditorCodePanel.tsx +3 -3
- package/src/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.tsx +35 -12
- package/src/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.tsx +6 -6
- package/src/components/dataCube/grid/DataCubeGrid.tsx +4 -6
- package/src/components/repl/Alert.tsx +138 -94
- package/src/components/repl/DocumentationPanel.tsx +2 -50
- package/src/components/repl/Form.tsx +47 -0
- package/src/components/repl/SettingsPanel.tsx +42 -8
- package/src/index.tsx +4 -8
- package/src/server/REPLEngine.ts +1 -0
- package/src/stores/LayoutManagerState.ts +12 -4
- package/src/stores/LegendREPLApplicationPlugin.ts +2 -2
- package/src/stores/REPLStore.tsx +54 -7
- package/src/stores/dataCube/DataCubeEngine.ts +30 -13
- package/src/stores/dataCube/DataCubeState.ts +5 -4
- package/src/stores/dataCube/core/DataCubeConfiguration.ts +2 -6
- package/src/stores/dataCube/core/DataCubeCoreState.ts +3 -3
- package/src/stores/dataCube/core/DataCubeQueryBuilder.ts +89 -17
- package/src/stores/dataCube/core/DataCubeQueryEngine.ts +11 -2
- package/src/stores/dataCube/core/DataCubeQuerySnapshot.ts +11 -9
- package/src/stores/dataCube/core/DataCubeQuerySnapshotBuilder.ts +154 -15
- package/src/stores/dataCube/core/DataCubeQuerySnapshotManager.ts +6 -6
- package/src/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.ts +3 -3
- package/src/stores/dataCube/editor/DataCubeEditorCodePanelState.ts +4 -6
- package/src/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.ts +43 -12
- package/src/stores/dataCube/editor/DataCubeEditorColumnsPanelState.ts +6 -8
- package/src/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.ts +4 -4
- package/src/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.ts +5 -5
- package/src/stores/dataCube/editor/DataCubeEditorSortsPanelState.ts +5 -7
- package/src/stores/dataCube/editor/DataCubeEditorState.tsx +4 -4
- package/src/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.ts +4 -3
- package/src/stores/dataCube/editor/DataCubeMutableConfiguration.ts +102 -87
- package/src/stores/dataCube/grid/DataCubeGridClientEngine.ts +75 -15
- package/src/stores/dataCube/grid/DataCubeGridClientExportEngine.ts +2 -2
- package/src/stores/dataCube/grid/DataCubeGridConfigurationBuilder.tsx +28 -29
- package/src/stores/dataCube/grid/DataCubeGridControllerState.ts +7 -16
- package/src/stores/dataCube/grid/DataCubeGridQueryBuilder.ts +72 -10
- package/src/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.ts +27 -37
- package/src/stores/dataCube/grid/DataCubeGridState.ts +27 -9
|
@@ -52,13 +52,14 @@ import {
|
|
|
52
52
|
INTERNAL__GRID_CLIENT_TOOLTIP_SHOW_DELAY,
|
|
53
53
|
INTERNAL__GRID_CLIENT_SIDE_BAR_WIDTH,
|
|
54
54
|
INTERNAL__GRID_CLIENT_ROW_GROUPING_COUNT_AGG_COLUMN_ID,
|
|
55
|
+
INTERNAL__GRID_CLIENT_MISSING_VALUE,
|
|
55
56
|
} from './DataCubeGridClientEngine.js';
|
|
56
57
|
import { PRIMITIVE_TYPE } from '@finos/legend-graph';
|
|
57
58
|
import {
|
|
58
59
|
getQueryParameters,
|
|
59
60
|
getQueryParameterValue,
|
|
60
|
-
IllegalStateError,
|
|
61
61
|
isNonNullable,
|
|
62
|
+
isNullable,
|
|
62
63
|
isNumber,
|
|
63
64
|
isValidUrl,
|
|
64
65
|
} from '@finos/legend-shared';
|
|
@@ -67,7 +68,6 @@ import type {
|
|
|
67
68
|
DataCubeConfiguration,
|
|
68
69
|
} from '../core/DataCubeConfiguration.js';
|
|
69
70
|
import {
|
|
70
|
-
DataCubeAggregateFunction,
|
|
71
71
|
DataCubeColumnDataType,
|
|
72
72
|
DataCubeColumnPinPlacement,
|
|
73
73
|
DataCubeNumberScale,
|
|
@@ -76,6 +76,7 @@ import {
|
|
|
76
76
|
getDataType,
|
|
77
77
|
DataCubeQuerySortOperation,
|
|
78
78
|
DataCubeColumnKind,
|
|
79
|
+
DEFAULT_MISSING_VALUE_DISPLAY_TEXT,
|
|
79
80
|
} from '../core/DataCubeQueryEngine.js';
|
|
80
81
|
import type { CustomLoadingCellRendererProps } from '@ag-grid-community/react';
|
|
81
82
|
import { DataCubeIcon } from '@finos/legend-art';
|
|
@@ -83,7 +84,7 @@ import type { DataCubeState } from '../DataCubeState.js';
|
|
|
83
84
|
|
|
84
85
|
// --------------------------------- UTILITIES ---------------------------------
|
|
85
86
|
|
|
86
|
-
// See https://www.ag-grid.com/
|
|
87
|
+
// See https://www.ag-grid.com/react-data-grid/cell-data-types/
|
|
87
88
|
function _cellDataType(column: DataCubeQuerySnapshotColumn) {
|
|
88
89
|
switch (column.type) {
|
|
89
90
|
case PRIMITIVE_TYPE.NUMBER:
|
|
@@ -124,25 +125,6 @@ function _allowedAggFuncs(column: DataCubeQuerySnapshotColumn) {
|
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
function _aggFunc(
|
|
128
|
-
func: DataCubeAggregateFunction,
|
|
129
|
-
): GridClientAggregateOperation {
|
|
130
|
-
switch (func) {
|
|
131
|
-
case DataCubeAggregateFunction.AVERAGE:
|
|
132
|
-
return GridClientAggregateOperation.AVERAGE;
|
|
133
|
-
case DataCubeAggregateFunction.COUNT:
|
|
134
|
-
return GridClientAggregateOperation.COUNT;
|
|
135
|
-
case DataCubeAggregateFunction.MAX:
|
|
136
|
-
return GridClientAggregateOperation.MAX;
|
|
137
|
-
case DataCubeAggregateFunction.MIN:
|
|
138
|
-
return GridClientAggregateOperation.MIN;
|
|
139
|
-
case DataCubeAggregateFunction.SUM:
|
|
140
|
-
return GridClientAggregateOperation.SUM;
|
|
141
|
-
default:
|
|
142
|
-
throw new IllegalStateError(`Unsupported aggregate function '${func}'`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
128
|
function scaleNumber(
|
|
147
129
|
value: number,
|
|
148
130
|
type: DataCubeNumberScale | undefined,
|
|
@@ -267,8 +249,15 @@ function _displaySpec(columnData: ColumnData) {
|
|
|
267
249
|
dataType === DataCubeColumnDataType.NUMBER
|
|
268
250
|
? (params) => {
|
|
269
251
|
const value = params.value as number | null | undefined;
|
|
270
|
-
if (
|
|
271
|
-
|
|
252
|
+
if (
|
|
253
|
+
isNullable(value) ||
|
|
254
|
+
(value as unknown as string) ===
|
|
255
|
+
INTERNAL__GRID_CLIENT_MISSING_VALUE
|
|
256
|
+
) {
|
|
257
|
+
return (
|
|
258
|
+
column.missingValueDisplayText ??
|
|
259
|
+
DEFAULT_MISSING_VALUE_DISPLAY_TEXT
|
|
260
|
+
);
|
|
272
261
|
}
|
|
273
262
|
const showNegativeNumberInParens =
|
|
274
263
|
column.negativeNumberInParens && value < 0;
|
|
@@ -296,7 +285,11 @@ function _displaySpec(columnData: ColumnData) {
|
|
|
296
285
|
(scaledNumber.unit ? ` ${scaledNumber.unit}` : '')
|
|
297
286
|
);
|
|
298
287
|
}
|
|
299
|
-
: (params) =>
|
|
288
|
+
: (params) =>
|
|
289
|
+
params.value === INTERNAL__GRID_CLIENT_MISSING_VALUE
|
|
290
|
+
? (column.missingValueDisplayText ??
|
|
291
|
+
DEFAULT_MISSING_VALUE_DISPLAY_TEXT)
|
|
292
|
+
: params.value,
|
|
300
293
|
loadingCellRenderer: DataCubeGridLoadingCellRenderer,
|
|
301
294
|
cellClassRules: {
|
|
302
295
|
[generateFontFamilyUtilityClassName(fontFamily)]: () => true,
|
|
@@ -355,7 +348,8 @@ function _displaySpec(columnData: ColumnData) {
|
|
|
355
348
|
: GridClientPinnedAlignement.LEFT
|
|
356
349
|
: null,
|
|
357
350
|
tooltipValueGetter: (params) =>
|
|
358
|
-
isNonNullable(params.value)
|
|
351
|
+
isNonNullable(params.value) &&
|
|
352
|
+
params.value !== INTERNAL__GRID_CLIENT_MISSING_VALUE
|
|
359
353
|
? `Value = ${params.value === '' ? "''" : params.value === true ? 'TRUE' : params.value === false ? 'FALSE' : params.value}`
|
|
360
354
|
: `Missing Value`,
|
|
361
355
|
} as ColDef;
|
|
@@ -410,9 +404,15 @@ function _rowGroupSpec(columnData: ColumnData) {
|
|
|
410
404
|
enableRowGroup: column.kind === DataCubeColumnKind.DIMENSION,
|
|
411
405
|
enableValue: column.kind === DataCubeColumnKind.MEASURE,
|
|
412
406
|
rowGroup: Boolean(groupByCol),
|
|
413
|
-
|
|
407
|
+
rowGroupIndex: groupByCol
|
|
408
|
+
? (data.groupBy?.columns.indexOf(groupByCol) ?? null)
|
|
409
|
+
: null,
|
|
410
|
+
// NOTE: we don't quite care about populating these accurately
|
|
411
|
+
// since ag-grid aggregation does not support parameters, so
|
|
412
|
+
// its set of supported aggregators will never match that specified
|
|
413
|
+
// in the editor, so we just assign dummy values here
|
|
414
414
|
aggFunc: aggCol
|
|
415
|
-
?
|
|
415
|
+
? aggCol.operation
|
|
416
416
|
: rowGroupColumn
|
|
417
417
|
? (
|
|
418
418
|
[
|
|
@@ -425,7 +425,6 @@ function _rowGroupSpec(columnData: ColumnData) {
|
|
|
425
425
|
? GridClientAggregateOperation.SUM
|
|
426
426
|
: null
|
|
427
427
|
: null,
|
|
428
|
-
// TODO: @akphi - add this from configuration object
|
|
429
428
|
allowedAggFuncs: rowGroupColumn ? _allowedAggFuncs(rowGroupColumn) : [],
|
|
430
429
|
} satisfies ColDef;
|
|
431
430
|
}
|
|
@@ -34,6 +34,7 @@ import type {
|
|
|
34
34
|
} from '@ag-grid-community/core';
|
|
35
35
|
import type { DataCubeState } from '../DataCubeState.js';
|
|
36
36
|
import { generateMenuBuilder } from './DataCubeGridMenuBuilder.js';
|
|
37
|
+
import { _groupByAggCols } from './DataCubeGridQuerySnapshotBuilder.js';
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* This state is responsible for capturing edition to the data cube query
|
|
@@ -96,7 +97,7 @@ export class DataCubeGridControllerState extends DataCubeQuerySnapshotSubscriber
|
|
|
96
97
|
this.applyChanges();
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
showColumn(colName: string | undefined, isVisible: boolean)
|
|
100
|
+
showColumn(colName: string | undefined, isVisible: boolean) {
|
|
100
101
|
const columnConfiguration = this.getColumnConfiguration(colName);
|
|
101
102
|
if (columnConfiguration) {
|
|
102
103
|
columnConfiguration.hideFromView = !isVisible;
|
|
@@ -184,7 +185,7 @@ export class DataCubeGridControllerState extends DataCubeQuerySnapshotSubscriber
|
|
|
184
185
|
this.applyChanges();
|
|
185
186
|
}
|
|
186
187
|
|
|
187
|
-
private applyChanges()
|
|
188
|
+
private applyChanges() {
|
|
188
189
|
const baseSnapshot = guaranteeNonNullable(this.getLatestSnapshot());
|
|
189
190
|
const snapshot = baseSnapshot.clone();
|
|
190
191
|
|
|
@@ -197,20 +198,10 @@ export class DataCubeGridControllerState extends DataCubeQuerySnapshotSubscriber
|
|
|
197
198
|
snapshot.data.groupBy = this.verticalPivotedColumns.length
|
|
198
199
|
? {
|
|
199
200
|
columns: this.verticalPivotedColumns,
|
|
200
|
-
aggColumns:
|
|
201
|
-
.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
column.aggregateFunction !== undefined &&
|
|
205
|
-
!this.verticalPivotedColumns.find(
|
|
206
|
-
(col) => col.name === column.name,
|
|
207
|
-
),
|
|
208
|
-
)
|
|
209
|
-
.map((column) => ({
|
|
210
|
-
name: column.name,
|
|
211
|
-
type: column.type,
|
|
212
|
-
function: guaranteeNonNullable(column.aggregateFunction),
|
|
213
|
-
})),
|
|
201
|
+
aggColumns: _groupByAggCols(
|
|
202
|
+
baseSnapshot.data.groupBy,
|
|
203
|
+
this.configuration,
|
|
204
|
+
),
|
|
214
205
|
}
|
|
215
206
|
: undefined;
|
|
216
207
|
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
|
+
PRIMITIVE_TYPE,
|
|
18
19
|
type V1_AppliedFunction,
|
|
19
20
|
extractElementNameFromPath as _name,
|
|
20
21
|
} from '@finos/legend-graph';
|
|
@@ -25,9 +26,9 @@ import {
|
|
|
25
26
|
DataCubeFunction,
|
|
26
27
|
type DataCubeQueryFunctionMap,
|
|
27
28
|
} from '../core/DataCubeQueryEngine.js';
|
|
28
|
-
import { guaranteeNonNullable } from '@finos/legend-shared';
|
|
29
|
+
import { guaranteeNonNullable, isNullable } from '@finos/legend-shared';
|
|
29
30
|
import {
|
|
30
|
-
|
|
31
|
+
_groupByAggCols,
|
|
31
32
|
_colSpec,
|
|
32
33
|
_cols,
|
|
33
34
|
_filter,
|
|
@@ -36,7 +37,11 @@ import {
|
|
|
36
37
|
_lambda,
|
|
37
38
|
_var,
|
|
38
39
|
} from '../core/DataCubeQueryBuilder.js';
|
|
39
|
-
import {
|
|
40
|
+
import {
|
|
41
|
+
INTERNAL__GRID_CLIENT_MISSING_VALUE,
|
|
42
|
+
INTERNAL__GRID_CLIENT_ROW_GROUPING_COUNT_AGG_COLUMN_ID,
|
|
43
|
+
} from './DataCubeGridClientEngine.js';
|
|
44
|
+
import type { DataCubeConfiguration } from '../core/DataCubeConfiguration.js';
|
|
40
45
|
|
|
41
46
|
/*****************************************************************************
|
|
42
47
|
* [GRID]
|
|
@@ -60,12 +65,13 @@ function _rowGroupingCountCol() {
|
|
|
60
65
|
// --------------------------------- MAIN ---------------------------------
|
|
61
66
|
|
|
62
67
|
export function generateRowGroupingDrilldownExecutableQueryPostProcessor(
|
|
63
|
-
drilldownValues: string[],
|
|
68
|
+
drilldownValues: (string | null | undefined)[],
|
|
64
69
|
) {
|
|
65
70
|
return (
|
|
66
71
|
snapshot: DataCubeQuerySnapshot,
|
|
67
72
|
sequence: V1_AppliedFunction[],
|
|
68
73
|
funcMap: DataCubeQueryFunctionMap,
|
|
74
|
+
configuration: DataCubeConfiguration,
|
|
69
75
|
) => {
|
|
70
76
|
const _unprocess = (funcMapKey: keyof DataCubeQueryFunctionMap) => {
|
|
71
77
|
const func = funcMap[funcMapKey];
|
|
@@ -91,11 +97,64 @@ export function generateRowGroupingDrilldownExecutableQueryPostProcessor(
|
|
|
91
97
|
[_var()],
|
|
92
98
|
[
|
|
93
99
|
_filter({
|
|
94
|
-
conditions: drilldownValues.map((
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
conditions: drilldownValues.map((value, i) => {
|
|
101
|
+
const groupByColumn = guaranteeNonNullable(
|
|
102
|
+
groupBy.columns[i],
|
|
103
|
+
);
|
|
104
|
+
if (
|
|
105
|
+
isNullable(value) ||
|
|
106
|
+
value === INTERNAL__GRID_CLIENT_MISSING_VALUE
|
|
107
|
+
) {
|
|
108
|
+
return {
|
|
109
|
+
...groupByColumn,
|
|
110
|
+
operation: DataCubeQueryFilterOperation.BLANK,
|
|
111
|
+
value: undefined,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const condition = {
|
|
115
|
+
...groupByColumn,
|
|
116
|
+
operation: DataCubeQueryFilterOperation.EQUAL,
|
|
117
|
+
value: undefined,
|
|
118
|
+
};
|
|
119
|
+
switch (groupByColumn.type) {
|
|
120
|
+
case PRIMITIVE_TYPE.BOOLEAN:
|
|
121
|
+
return {
|
|
122
|
+
...condition,
|
|
123
|
+
value: {
|
|
124
|
+
type: PRIMITIVE_TYPE.BOOLEAN,
|
|
125
|
+
value: value === 'true',
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
case PRIMITIVE_TYPE.INTEGER:
|
|
129
|
+
return {
|
|
130
|
+
...condition,
|
|
131
|
+
value: {
|
|
132
|
+
type: groupByColumn.type,
|
|
133
|
+
value: parseInt(value, 10),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
case PRIMITIVE_TYPE.NUMBER:
|
|
137
|
+
case PRIMITIVE_TYPE.DECIMAL:
|
|
138
|
+
case PRIMITIVE_TYPE.FLOAT:
|
|
139
|
+
return {
|
|
140
|
+
...condition,
|
|
141
|
+
value: {
|
|
142
|
+
type: groupByColumn.type,
|
|
143
|
+
value: parseFloat(value),
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
case PRIMITIVE_TYPE.STRING:
|
|
147
|
+
case PRIMITIVE_TYPE.DATE:
|
|
148
|
+
case PRIMITIVE_TYPE.DATETIME:
|
|
149
|
+
case PRIMITIVE_TYPE.STRICTDATE:
|
|
150
|
+
case PRIMITIVE_TYPE.STRICTTIME:
|
|
151
|
+
default:
|
|
152
|
+
return {
|
|
153
|
+
...condition,
|
|
154
|
+
value: { type: groupByColumn.type, value },
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}),
|
|
99
158
|
groupOperation: DataCubeQueryFilterGroupOperation.AND,
|
|
100
159
|
}),
|
|
101
160
|
],
|
|
@@ -113,7 +172,10 @@ export function generateRowGroupingDrilldownExecutableQueryPostProcessor(
|
|
|
113
172
|
);
|
|
114
173
|
const groupByFunc = _function(_name(DataCubeFunction.GROUP_BY), [
|
|
115
174
|
_cols(groupByColumns.map((col) => _colSpec(col.name))),
|
|
116
|
-
_cols([
|
|
175
|
+
_cols([
|
|
176
|
+
..._groupByAggCols(groupBy.aggColumns),
|
|
177
|
+
_rowGroupingCountCol(),
|
|
178
|
+
]),
|
|
117
179
|
]);
|
|
118
180
|
sequence[groupByIdx] = groupByFunc;
|
|
119
181
|
funcMap.groupBy = groupByFunc;
|
|
@@ -24,41 +24,34 @@
|
|
|
24
24
|
import type { IServerSideGetRowsRequest } from '@ag-grid-community/core';
|
|
25
25
|
import {
|
|
26
26
|
type DataCubeQuerySnapshot,
|
|
27
|
+
type DataCubeQuerySnapshotGroupBy,
|
|
27
28
|
_getCol,
|
|
28
29
|
} from '../core/DataCubeQuerySnapshot.js';
|
|
30
|
+
import { GridClientSortDirection } from './DataCubeGridClientEngine.js';
|
|
29
31
|
import {
|
|
30
|
-
|
|
31
|
-
guaranteeNonNullable,
|
|
32
|
-
isNonNullable,
|
|
33
|
-
} from '@finos/legend-shared';
|
|
34
|
-
import {
|
|
35
|
-
GridClientAggregateOperation,
|
|
36
|
-
GridClientSortDirection,
|
|
37
|
-
} from './DataCubeGridClientEngine.js';
|
|
38
|
-
import {
|
|
32
|
+
DataCubeColumnKind,
|
|
39
33
|
DataCubeQuerySortOperation,
|
|
40
|
-
DataCubeAggregateFunction,
|
|
41
34
|
} from '../core/DataCubeQueryEngine.js';
|
|
35
|
+
import { DataCubeConfiguration } from '../core/DataCubeConfiguration.js';
|
|
36
|
+
import { _defaultAggCol } from '../core/DataCubeQuerySnapshotBuilder.js';
|
|
37
|
+
import { isNonNullable } from '@finos/legend-shared';
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
default:
|
|
60
|
-
throw new IllegalStateError(`Unsupported aggregate function '${func}'`);
|
|
61
|
-
}
|
|
39
|
+
export function _groupByAggCols(
|
|
40
|
+
groupBy: DataCubeQuerySnapshotGroupBy | undefined,
|
|
41
|
+
configuration: DataCubeConfiguration,
|
|
42
|
+
) {
|
|
43
|
+
return configuration.columns
|
|
44
|
+
.filter(
|
|
45
|
+
(column) =>
|
|
46
|
+
column.kind === DataCubeColumnKind.MEASURE &&
|
|
47
|
+
!groupBy?.columns.find((col) => col.name === column.name),
|
|
48
|
+
)
|
|
49
|
+
.map(
|
|
50
|
+
(column) =>
|
|
51
|
+
groupBy?.aggColumns.find((col) => col.name === column.name) ??
|
|
52
|
+
_defaultAggCol(column.name, column.type),
|
|
53
|
+
)
|
|
54
|
+
.filter(isNonNullable);
|
|
62
55
|
}
|
|
63
56
|
|
|
64
57
|
// --------------------------------- MAIN ---------------------------------
|
|
@@ -66,7 +59,10 @@ function _aggFunc(
|
|
|
66
59
|
export function buildQuerySnapshot(
|
|
67
60
|
request: IServerSideGetRowsRequest,
|
|
68
61
|
baseSnapshot: DataCubeQuerySnapshot,
|
|
69
|
-
)
|
|
62
|
+
) {
|
|
63
|
+
const configuration = DataCubeConfiguration.serialization.fromJson(
|
|
64
|
+
baseSnapshot.data.configuration,
|
|
65
|
+
);
|
|
70
66
|
const snapshot = baseSnapshot.clone();
|
|
71
67
|
|
|
72
68
|
// --------------------------------- GROUP BY ---------------------------------
|
|
@@ -78,13 +74,7 @@ export function buildQuerySnapshot(
|
|
|
78
74
|
name: col.id,
|
|
79
75
|
type: _getCol(availableCols, col.id).type,
|
|
80
76
|
})),
|
|
81
|
-
aggColumns:
|
|
82
|
-
.filter((col) => isNonNullable(col.field) && isNonNullable(col.aggFunc))
|
|
83
|
-
.map((col) => ({
|
|
84
|
-
name: guaranteeNonNullable(col.field),
|
|
85
|
-
type: _getCol(availableCols, guaranteeNonNullable(col.field)).type,
|
|
86
|
-
function: _aggFunc(col.aggFunc as GridClientAggregateOperation),
|
|
87
|
-
})),
|
|
77
|
+
aggColumns: _groupByAggCols(baseSnapshot.data.groupBy, configuration),
|
|
88
78
|
};
|
|
89
79
|
} else {
|
|
90
80
|
snapshot.data.groupBy = undefined;
|
|
@@ -18,7 +18,11 @@ import { guaranteeNonNullable, hashArray } from '@finos/legend-shared';
|
|
|
18
18
|
import { action, makeObservable, observable, runInAction } from 'mobx';
|
|
19
19
|
import type { GridApi } from '@ag-grid-community/core';
|
|
20
20
|
import type { DataCubeState } from '../DataCubeState.js';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
DataCubeGridClientServerSideDataSource,
|
|
23
|
+
INTERNAL__GRID_CLIENT_DEFAULT_CACHE_BLOCK_SIZE,
|
|
24
|
+
INTERNAL__GRID_CLIENT_MAX_CACHE_BLOCK_SIZE,
|
|
25
|
+
} from './DataCubeGridClientEngine.js';
|
|
22
26
|
import { DataCubeQuerySnapshotSubscriber } from '../core/DataCubeQuerySnapshotSubscriber.js';
|
|
23
27
|
import type { DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
|
|
24
28
|
import { generateGridOptionsFromSnapshot } from './DataCubeGridConfigurationBuilder.js';
|
|
@@ -37,7 +41,7 @@ class DataCubeGridDatasourceConfiguration {
|
|
|
37
41
|
this.limit = snapshot?.data.limit;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
get hashCode()
|
|
44
|
+
get hashCode() {
|
|
41
45
|
return hashArray([`limit: ${this.limit ?? ''}`]);
|
|
42
46
|
}
|
|
43
47
|
}
|
|
@@ -76,7 +80,7 @@ export class DataCubeGridState extends DataCubeQuerySnapshotSubscriber {
|
|
|
76
80
|
this.clientDataSource = new DataCubeGridClientServerSideDataSource(this);
|
|
77
81
|
}
|
|
78
82
|
|
|
79
|
-
setPaginationEnabled(val: boolean)
|
|
83
|
+
setPaginationEnabled(val: boolean) {
|
|
80
84
|
this.isPaginationEnabled = val;
|
|
81
85
|
|
|
82
86
|
// hard reset the grid, this will force the grid to fetch data again
|
|
@@ -84,24 +88,31 @@ export class DataCubeGridState extends DataCubeQuerySnapshotSubscriber {
|
|
|
84
88
|
// for how many page that we loaded when pagination is off, the datasource
|
|
85
89
|
// will fire that many data fetch operations which is expensive.
|
|
86
90
|
this.clientDataSource = new DataCubeGridClientServerSideDataSource(this);
|
|
91
|
+
// NOTE: ag-grid uses the cache block size as page size, so it's important to set this
|
|
92
|
+
// in corresponding to the pagination setting, else it would cause unexpected scrolling behavior
|
|
93
|
+
this.client.updateGridOptions({
|
|
94
|
+
cacheBlockSize: val
|
|
95
|
+
? INTERNAL__GRID_CLIENT_DEFAULT_CACHE_BLOCK_SIZE
|
|
96
|
+
: INTERNAL__GRID_CLIENT_MAX_CACHE_BLOCK_SIZE,
|
|
97
|
+
});
|
|
87
98
|
}
|
|
88
99
|
|
|
89
|
-
setScrollHintText(val: string | undefined)
|
|
100
|
+
setScrollHintText(val: string | undefined) {
|
|
90
101
|
this.scrollHintText = val;
|
|
91
102
|
}
|
|
92
103
|
|
|
93
|
-
get client()
|
|
104
|
+
get client() {
|
|
94
105
|
return guaranteeNonNullable(this._client, 'Grid client is not configured');
|
|
95
106
|
}
|
|
96
107
|
|
|
97
|
-
configureClient(val: GridApi | undefined)
|
|
108
|
+
configureClient(val: GridApi | undefined) {
|
|
98
109
|
this._client = val;
|
|
99
110
|
}
|
|
100
111
|
|
|
101
112
|
override async applySnapshot(
|
|
102
113
|
snapshot: DataCubeQuerySnapshot,
|
|
103
114
|
previousSnapshot: DataCubeQuerySnapshot | undefined,
|
|
104
|
-
)
|
|
115
|
+
) {
|
|
105
116
|
const existingExtraConfiguration = this.datasourceConfiguration;
|
|
106
117
|
const queryConfiguration = DataCubeConfiguration.serialization.fromJson(
|
|
107
118
|
snapshot.data.configuration,
|
|
@@ -130,10 +141,17 @@ export class DataCubeGridState extends DataCubeQuerySnapshotSubscriber {
|
|
|
130
141
|
queryConfiguration,
|
|
131
142
|
this.dataCube,
|
|
132
143
|
);
|
|
133
|
-
this.client.updateGridOptions(
|
|
144
|
+
this.client.updateGridOptions({
|
|
145
|
+
...gridOptions,
|
|
146
|
+
// NOTE: ag-grid uses the cache block size as page size, so it's important to set this
|
|
147
|
+
// in corresponding to the pagination setting, else it would cause unexpected scrolling behavior
|
|
148
|
+
cacheBlockSize: this.isPaginationEnabled
|
|
149
|
+
? INTERNAL__GRID_CLIENT_DEFAULT_CACHE_BLOCK_SIZE
|
|
150
|
+
: INTERNAL__GRID_CLIENT_MAX_CACHE_BLOCK_SIZE,
|
|
151
|
+
});
|
|
134
152
|
}
|
|
135
153
|
|
|
136
|
-
override async initialize()
|
|
154
|
+
override async initialize() {
|
|
137
155
|
// do nothing
|
|
138
156
|
}
|
|
139
157
|
}
|