@finos/legend-application-repl 0.0.32 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/lib/components/dataCube/DataCube.js +3 -3
  2. package/lib/components/dataCube/DataCube.js.map +1 -1
  3. package/lib/components/dataCube/editor/DataCubeEditor.js +4 -4
  4. package/lib/components/dataCube/editor/DataCubeEditor.js.map +1 -1
  5. package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.d.ts.map +1 -1
  6. package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js +3 -3
  7. package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js.map +1 -1
  8. package/lib/components/dataCube/editor/DataCubeEditorColumnsPanel.d.ts.map +1 -1
  9. package/lib/components/dataCube/editor/DataCubeEditorColumnsPanel.js +10 -3
  10. package/lib/components/dataCube/editor/DataCubeEditorColumnsPanel.js.map +1 -1
  11. package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.d.ts +3 -2
  12. package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.d.ts.map +1 -1
  13. package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.js +23 -37
  14. package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.js.map +1 -1
  15. package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.d.ts.map +1 -1
  16. package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.js +1 -1
  17. package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.js.map +1 -1
  18. package/lib/components/dataCube/editor/{DataCubeEditorVPivotsPanel.d.ts → DataCubeEditorHorizontalPivotsPanel.d.ts} +2 -2
  19. package/lib/components/dataCube/editor/DataCubeEditorHorizontalPivotsPanel.d.ts.map +1 -0
  20. package/lib/components/dataCube/editor/{DataCubeEditorHPivotsPanel.js → DataCubeEditorHorizontalPivotsPanel.js} +2 -2
  21. package/lib/components/dataCube/editor/DataCubeEditorHorizontalPivotsPanel.js.map +1 -0
  22. package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.d.ts.map +1 -1
  23. package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.js +6 -6
  24. package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.js.map +1 -1
  25. package/lib/components/dataCube/editor/{DataCubeEditorHPivotsPanel.d.ts → DataCubeEditorVerticalPivotsPanel.d.ts} +2 -2
  26. package/lib/components/dataCube/editor/DataCubeEditorVerticalPivotsPanel.d.ts.map +1 -0
  27. package/lib/components/dataCube/editor/{DataCubeEditorVPivotsPanel.js → DataCubeEditorVerticalPivotsPanel.js} +5 -7
  28. package/lib/components/dataCube/editor/DataCubeEditorVerticalPivotsPanel.js.map +1 -0
  29. package/lib/components/dataCube/grid/DataCubeGrid.d.ts.map +1 -1
  30. package/lib/components/dataCube/grid/DataCubeGrid.js +22 -3
  31. package/lib/components/dataCube/grid/DataCubeGrid.js.map +1 -1
  32. package/lib/index.css +2 -2
  33. package/lib/index.css.map +1 -1
  34. package/lib/package.json +17 -13
  35. package/lib/stores/dataCube/DataCubeState.d.ts.map +1 -1
  36. package/lib/stores/dataCube/DataCubeState.js +2 -2
  37. package/lib/stores/dataCube/DataCubeState.js.map +1 -1
  38. package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts +3 -1
  39. package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts.map +1 -1
  40. package/lib/stores/dataCube/core/DataCubeConfiguration.js +4 -0
  41. package/lib/stores/dataCube/core/DataCubeConfiguration.js.map +1 -1
  42. package/lib/stores/dataCube/core/DataCubeQueryBuilder.d.ts.map +1 -1
  43. package/lib/stores/dataCube/core/DataCubeQueryBuilder.js +15 -15
  44. package/lib/stores/dataCube/core/DataCubeQueryBuilder.js.map +1 -1
  45. package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts +22 -0
  46. package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts.map +1 -1
  47. package/lib/stores/dataCube/core/DataCubeQueryEngine.js +25 -0
  48. package/lib/stores/dataCube/core/DataCubeQueryEngine.js.map +1 -1
  49. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts +5 -40
  50. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts.map +1 -1
  51. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js +9 -54
  52. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js.map +1 -1
  53. package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.d.ts.map +1 -1
  54. package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js +13 -7
  55. package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js.map +1 -1
  56. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts +4 -1
  57. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts.map +1 -1
  58. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js +20 -5
  59. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js.map +1 -1
  60. package/lib/stores/dataCube/editor/DataCubeEditorColumnsPanelState.d.ts +45 -0
  61. package/lib/stores/dataCube/editor/DataCubeEditorColumnsPanelState.d.ts.map +1 -0
  62. package/lib/stores/dataCube/editor/DataCubeEditorColumnsPanelState.js +102 -0
  63. package/lib/stores/dataCube/editor/DataCubeEditorColumnsPanelState.js.map +1 -0
  64. package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.d.ts +26 -9
  65. package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.d.ts.map +1 -1
  66. package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.js +50 -20
  67. package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.js.map +1 -1
  68. package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts +2 -1
  69. package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts.map +1 -1
  70. package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.js +1 -1
  71. package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.js.map +1 -1
  72. package/lib/stores/dataCube/editor/DataCubeEditorPanelState.d.ts +2 -1
  73. package/lib/stores/dataCube/editor/DataCubeEditorPanelState.d.ts.map +1 -1
  74. package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.d.ts +12 -13
  75. package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.d.ts.map +1 -1
  76. package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.js +23 -70
  77. package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.js.map +1 -1
  78. package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts +11 -7
  79. package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts.map +1 -1
  80. package/lib/stores/dataCube/editor/DataCubeEditorState.js +28 -13
  81. package/lib/stores/dataCube/editor/DataCubeEditorState.js.map +1 -1
  82. package/lib/stores/dataCube/editor/{DataCubeEditorHPivotPanelState.d.ts → DataCubeEditorVerticalPivotsPanelState.d.ts} +11 -4
  83. package/lib/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.d.ts.map +1 -0
  84. package/lib/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.js +62 -0
  85. package/lib/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.js.map +1 -0
  86. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts +5 -3
  87. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts.map +1 -1
  88. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js +8 -6
  89. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js.map +1 -1
  90. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts +8 -0
  91. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts.map +1 -1
  92. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js +9 -0
  93. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js.map +1 -1
  94. package/lib/stores/dataCube/grid/DataCubeGridClientExportEngine.d.ts +31 -0
  95. package/lib/stores/dataCube/grid/DataCubeGridClientExportEngine.d.ts.map +1 -0
  96. package/lib/stores/dataCube/grid/DataCubeGridClientExportEngine.js +147 -0
  97. package/lib/stores/dataCube/grid/DataCubeGridClientExportEngine.js.map +1 -0
  98. package/lib/stores/dataCube/grid/{DataCubeGridQuerySnapshotAnalyzer.d.ts → DataCubeGridConfigurationBuilder.d.ts} +1 -1
  99. package/lib/stores/dataCube/grid/DataCubeGridConfigurationBuilder.d.ts.map +1 -0
  100. package/lib/stores/dataCube/grid/{DataCubeGridQuerySnapshotAnalyzer.js → DataCubeGridConfigurationBuilder.js} +95 -68
  101. package/lib/stores/dataCube/grid/DataCubeGridConfigurationBuilder.js.map +1 -0
  102. package/lib/stores/dataCube/grid/DataCubeGridControllerState.d.ts +62 -0
  103. package/lib/stores/dataCube/grid/DataCubeGridControllerState.d.ts.map +1 -0
  104. package/lib/stores/dataCube/grid/DataCubeGridControllerState.js +174 -0
  105. package/lib/stores/dataCube/grid/DataCubeGridControllerState.js.map +1 -0
  106. package/lib/{components/dataCube/grid/menu/DataCubeGridMenu.d.ts → stores/dataCube/grid/DataCubeGridMenuBuilder.d.ts} +3 -7
  107. package/lib/stores/dataCube/grid/DataCubeGridMenuBuilder.d.ts.map +1 -0
  108. package/lib/stores/dataCube/grid/DataCubeGridMenuBuilder.js +462 -0
  109. package/lib/stores/dataCube/grid/DataCubeGridMenuBuilder.js.map +1 -0
  110. package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.d.ts.map +1 -1
  111. package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js +3 -3
  112. package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js.map +1 -1
  113. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.d.ts.map +1 -1
  114. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js +9 -8
  115. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js.map +1 -1
  116. package/lib/stores/dataCube/grid/DataCubeGridState.d.ts +6 -2
  117. package/lib/stores/dataCube/grid/DataCubeGridState.d.ts.map +1 -1
  118. package/lib/stores/dataCube/grid/DataCubeGridState.js +8 -2
  119. package/lib/stores/dataCube/grid/DataCubeGridState.js.map +1 -1
  120. package/package.json +23 -19
  121. package/src/components/dataCube/DataCube.tsx +3 -3
  122. package/src/components/dataCube/editor/DataCubeEditor.tsx +17 -17
  123. package/src/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.tsx +5 -7
  124. package/src/components/dataCube/editor/DataCubeEditorColumnsPanel.tsx +42 -8
  125. package/src/components/dataCube/editor/DataCubeEditorColumnsSelector.tsx +38 -79
  126. package/src/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.tsx +3 -1
  127. package/src/components/dataCube/editor/{DataCubeEditorHPivotsPanel.tsx → DataCubeEditorHorizontalPivotsPanel.tsx} +1 -1
  128. package/src/components/dataCube/editor/DataCubeEditorSortsPanel.tsx +7 -9
  129. package/src/components/dataCube/editor/{DataCubeEditorVPivotsPanel.tsx → DataCubeEditorVerticalPivotsPanel.tsx} +6 -8
  130. package/src/components/dataCube/grid/DataCubeGrid.tsx +35 -8
  131. package/src/stores/dataCube/DataCubeState.ts +7 -5
  132. package/src/stores/dataCube/core/DataCubeConfiguration.ts +6 -0
  133. package/src/stores/dataCube/core/DataCubeQueryBuilder.ts +16 -16
  134. package/src/stores/dataCube/core/DataCubeQueryEngine.ts +25 -0
  135. package/src/stores/dataCube/core/DataCubeQuerySnapshot.ts +19 -58
  136. package/src/stores/dataCube/core/DataCubeQuerySnapshotBuilder.ts +12 -7
  137. package/src/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.ts +37 -5
  138. package/src/stores/dataCube/editor/DataCubeEditorColumnsPanelState.ts +162 -0
  139. package/src/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.ts +98 -23
  140. package/src/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.ts +5 -1
  141. package/src/stores/dataCube/editor/DataCubeEditorPanelState.ts +5 -1
  142. package/src/stores/dataCube/editor/DataCubeEditorSortsPanelState.ts +48 -117
  143. package/src/stores/dataCube/editor/DataCubeEditorState.ts +33 -13
  144. package/src/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.ts +105 -0
  145. package/src/stores/dataCube/editor/DataCubeMutableConfiguration.ts +16 -7
  146. package/src/stores/dataCube/grid/DataCubeGridClientEngine.ts +9 -0
  147. package/src/stores/dataCube/grid/DataCubeGridClientExportEngine.ts +170 -0
  148. package/src/stores/dataCube/grid/{DataCubeGridQuerySnapshotAnalyzer.tsx → DataCubeGridConfigurationBuilder.tsx} +105 -77
  149. package/src/stores/dataCube/grid/DataCubeGridControllerState.ts +254 -0
  150. package/src/stores/dataCube/grid/DataCubeGridMenuBuilder.tsx +535 -0
  151. package/src/stores/dataCube/grid/DataCubeGridQueryBuilder.ts +3 -5
  152. package/src/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.ts +12 -10
  153. package/src/stores/dataCube/grid/DataCubeGridState.ts +10 -3
  154. package/tsconfig.json +8 -6
  155. package/lib/components/dataCube/editor/DataCubeEditorHPivotsPanel.d.ts.map +0 -1
  156. package/lib/components/dataCube/editor/DataCubeEditorHPivotsPanel.js.map +0 -1
  157. package/lib/components/dataCube/editor/DataCubeEditorVPivotsPanel.d.ts.map +0 -1
  158. package/lib/components/dataCube/editor/DataCubeEditorVPivotsPanel.js.map +0 -1
  159. package/lib/components/dataCube/grid/menu/DataCubeGridMenu.d.ts.map +0 -1
  160. package/lib/components/dataCube/grid/menu/DataCubeGridMenu.js +0 -413
  161. package/lib/components/dataCube/grid/menu/DataCubeGridMenu.js.map +0 -1
  162. package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.d.ts +0 -19
  163. package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.d.ts.map +0 -1
  164. package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.js +0 -83
  165. package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.js.map +0 -1
  166. package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.d.ts.map +0 -1
  167. package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.js +0 -30
  168. package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.js.map +0 -1
  169. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.d.ts.map +0 -1
  170. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js.map +0 -1
  171. package/src/components/dataCube/grid/menu/DataCubeGridMenu.tsx +0 -441
  172. package/src/components/dataCube/grid/menu/DataCubeGridSortsMenu.tsx +0 -119
  173. package/src/stores/dataCube/editor/DataCubeEditorHPivotPanelState.ts +0 -43
@@ -17,14 +17,11 @@
17
17
  import { DataCubeIcon } from '@finos/legend-art';
18
18
  import { observer } from 'mobx-react-lite';
19
19
  import { useREPLStore } from '../../REPLStoreProvider.js';
20
- import { useEffect } from 'react';
21
- import { WIP_Badge } from './DataCubeEditorShared.js';
20
+ import { DataCubeEditorColumnsSelector } from './DataCubeEditorColumnsSelector.js';
22
21
 
23
- export const DataCubeEditorVPivotsPanel = observer(() => {
22
+ export const DataCubeEditorVerticalPivotsPanel = observer(() => {
24
23
  const replStore = useREPLStore();
25
- const panel = replStore.dataCube.editor.sorts;
26
-
27
- useEffect(() => {}, [panel]); // TODO: @akphi - remove this dummy useEffect
24
+ const panel = replStore.dataCube.editor.verticalPivots;
28
25
 
29
26
  return (
30
27
  <div className="h-full w-full select-none p-2">
@@ -34,10 +31,11 @@ export const DataCubeEditorVPivotsPanel = observer(() => {
34
31
  </div>
35
32
  <div className="ml-1 flex h-6 items-center text-xl font-medium">
36
33
  Vertical Pivots
37
- <WIP_Badge />
38
34
  </div>
39
35
  </div>
40
- <div className="flex h-[calc(100%_-_24px)] w-full"></div>
36
+ <div className="flex h-[calc(100%_-_24px)] w-full">
37
+ <DataCubeEditorColumnsSelector selector={panel.selector} />
38
+ </div>
41
39
  </div>
42
40
  );
43
41
  });
@@ -21,7 +21,11 @@ import { ServerSideRowModelModule } from '@ag-grid-enterprise/server-side-row-mo
21
21
  import { RowGroupingModule } from '@ag-grid-enterprise/row-grouping';
22
22
  import { ClipboardModule } from '@ag-grid-enterprise/clipboard';
23
23
  import { MenuModule } from '@ag-grid-enterprise/menu';
24
+ import { SideBarModule } from '@ag-grid-enterprise/side-bar';
25
+ import { ColumnsToolPanelModule } from '@ag-grid-enterprise/column-tool-panel';
24
26
  import { AgGridReact } from '@ag-grid-community/react';
27
+ import { CsvExportModule } from '@ag-grid-community/csv-export';
28
+ import { ExcelExportModule } from '@ag-grid-enterprise/excel-export';
25
29
  import { useEffect } from 'react';
26
30
  import { useREPLStore } from '../../REPLStoreProvider.js';
27
31
  import { DataCubeIcon, Switch, cn, Global, css } from '@finos/legend-art';
@@ -49,7 +53,7 @@ import type {
49
53
  DataCubeConfiguration,
50
54
  DataCubeConfigurationColorKey,
51
55
  } from '../../../stores/dataCube/core/DataCubeConfiguration.js';
52
- import { generateBaseGridOptions } from '../../../stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js';
56
+ import { generateBaseGridOptions } from '../../../stores/dataCube/grid/DataCubeGridConfigurationBuilder.js';
53
57
 
54
58
  // NOTE: This is a workaround to prevent ag-grid license key check from flooding the console screen
55
59
  // with its stack trace in Chrome.
@@ -231,20 +235,39 @@ export const DataCubeGridStyleController = observer(() => {
231
235
  );
232
236
  });
233
237
 
234
- const DataCubeGridStatusBar = observer(() => {
238
+ const DataCubeGridScroller = observer(() => {
235
239
  const replStore = useREPLStore();
236
240
  const dataCube = replStore.dataCube;
237
241
  const grid = dataCube.grid;
238
242
  const scrollHintText = grid.scrollHintText;
243
+ const gridClientSideBarElement = document.querySelector(
244
+ '.data-cube-grid .ag-side-bar',
245
+ );
246
+
247
+ return (
248
+ <div
249
+ className="absolute -top-9 flex items-center rounded-sm border border-neutral-300 bg-neutral-100 p-1 pr-2 text-neutral-500 shadow-sm"
250
+ style={{
251
+ right:
252
+ gridClientSideBarElement !== null
253
+ ? gridClientSideBarElement.getBoundingClientRect().width + 12
254
+ : 16,
255
+ }}
256
+ >
257
+ <DataCubeIcon.TableScroll className="text-lg" />
258
+ <div className="ml-1 font-mono text-sm">{scrollHintText ?? ''}</div>
259
+ </div>
260
+ );
261
+ });
262
+
263
+ const DataCubeGridStatusBar = observer(() => {
264
+ const replStore = useREPLStore();
265
+ const dataCube = replStore.dataCube;
266
+ const grid = dataCube.grid;
239
267
 
240
268
  return (
241
269
  <div className="relative flex h-5 w-full select-none justify-between border-b border-neutral-200 bg-neutral-100">
242
- {Boolean(scrollHintText) && (
243
- <div className="absolute -top-9 right-4 flex items-center rounded-sm border border-neutral-300 bg-neutral-100 p-1 pr-2 text-neutral-500 shadow-sm">
244
- <DataCubeIcon.TableScroll className="text-lg" />
245
- <div className="ml-1 font-mono text-sm">{scrollHintText}</div>
246
- </div>
247
- )}
270
+ {Boolean(grid.scrollHintText) && <DataCubeGridScroller />}
248
271
  <div />
249
272
  <div className="flex h-full items-center">
250
273
  <div className="flex h-full items-center px-2 font-mono text-sm text-neutral-500">
@@ -330,12 +353,16 @@ const DataCubeGridClient = observer(() => {
330
353
  modules={[
331
354
  // community
332
355
  ClientSideRowModelModule,
356
+ CsvExportModule,
333
357
  // enterprise
334
358
  ServerSideRowModelModule,
335
359
  RowGroupingModule,
336
360
  MenuModule,
337
361
  ClipboardModule,
338
362
  RangeSelectionModule,
363
+ SideBarModule,
364
+ ColumnsToolPanelModule,
365
+ ExcelExportModule,
339
366
  ]}
340
367
  {...generateBaseGridOptions(dataCube)}
341
368
  />
@@ -66,8 +66,8 @@ export class DataCubeState {
66
66
  // NOTE: snapshot manager must be instantiated before subscribers
67
67
  this.snapshotManager = new DataCubeQuerySnapshotManager(this);
68
68
  this.core = new DataCubeCoreState(this);
69
- this.grid = new DataCubeGridState(this);
70
69
  this.editor = new DataCubeEditorState(this);
70
+ this.grid = new DataCubeGridState(this);
71
71
  }
72
72
 
73
73
  newTask(name: string): DataCubeTask {
@@ -86,10 +86,12 @@ export class DataCubeState {
86
86
  const task = this.newTask('Initializing');
87
87
  try {
88
88
  await Promise.all(
89
- [this.core, this.editor, this.grid].map(async (state) => {
90
- this.snapshotManager.registerSubscriber(state);
91
- await state.initialize();
92
- }),
89
+ [this.core, this.editor, this.grid, this.grid.controller].map(
90
+ async (state) => {
91
+ this.snapshotManager.registerSubscriber(state);
92
+ await state.initialize();
93
+ },
94
+ ),
93
95
  );
94
96
  const result = await this.infrastructure.engine.getBaseQuery();
95
97
  const initialSnapshot = validateAndBuildQuerySnapshot(
@@ -38,6 +38,7 @@ import {
38
38
  type DataCubeSelectionStat,
39
39
  type DataCubeColumnPinPlacement,
40
40
  type DataCubeFontCase,
41
+ type DataCubeAggregateFunction,
41
42
  } from './DataCubeQueryEngine.js';
42
43
  import { SerializationFactory, usingModelSchema } from '@finos/legend-shared';
43
44
  import { createModelSchema, list, optional, primitive } from 'serializr';
@@ -89,6 +90,9 @@ export class DataCubeColumnConfiguration {
89
90
  displayAsLink = false;
90
91
  linkLabelParameter?: string | undefined;
91
92
 
93
+ aggregateFunction?: DataCubeAggregateFunction | undefined;
94
+ excludedFromHorizontalPivot = false;
95
+
92
96
  constructor(name: string, type: string) {
93
97
  this.name = name;
94
98
  this.type = type;
@@ -96,6 +100,7 @@ export class DataCubeColumnConfiguration {
96
100
 
97
101
  static readonly serialization = new SerializationFactory(
98
102
  createModelSchema(DataCubeColumnConfiguration, {
103
+ aggregateFunction: optional(primitive()),
99
104
  blur: primitive(),
100
105
  decimals: optional(primitive()),
101
106
  displayAsLink: primitive(),
@@ -103,6 +108,7 @@ export class DataCubeColumnConfiguration {
103
108
  displayName: optional(primitive()),
104
109
  errorBackgroundColor: optional(primitive()),
105
110
  errorForegroundColor: optional(primitive()),
111
+ excludedFromHorizontalPivot: primitive(),
106
112
  fixedWidth: optional(primitive()),
107
113
  fontBold: optional(primitive()),
108
114
  fontCase: optional(primitive()),
@@ -51,9 +51,6 @@ import {
51
51
  type DataCubeQuerySnapshotFilterCondition,
52
52
  type DataCubeQuerySnapshotFilter,
53
53
  type DataCubeQuerySnapshot,
54
- DataCubeQuerySnapshotSortOperation,
55
- DataCubeQuerySnapshotFilterOperation,
56
- DataCubeQueryFilterGroupOperation,
57
54
  _findCol,
58
55
  type DataCubeQuerySnapshotColumn,
59
56
  type DataCubeQuerySnapshotAggregateColumn,
@@ -71,6 +68,9 @@ import {
71
68
  DataCubeFunction,
72
69
  DEFAULT_LAMBDA_VARIABLE_NAME,
73
70
  INTERNAL__FILLER_COUNT_AGG_COLUMN_NAME,
71
+ DataCubeQuerySortOperation,
72
+ DataCubeQueryFilterOperation,
73
+ DataCubeQueryFilterGroupOperation,
74
74
  type DataCubeQueryFunctionMap,
75
75
  } from './DataCubeQueryEngine.js';
76
76
 
@@ -249,29 +249,29 @@ export function _filter(
249
249
  const _not = (fn: V1_AppliedFunction) =>
250
250
  _function(_name(DataCubeFunction.NOT), [fn]);
251
251
  switch (condition.operation) {
252
- case DataCubeQuerySnapshotFilterOperation.EQUAL:
252
+ case DataCubeQueryFilterOperation.EQUAL:
253
253
  return _cond(DataCubeFunction.EQUAL, _val());
254
- case DataCubeQuerySnapshotFilterOperation.GREATER_THAN:
254
+ case DataCubeQueryFilterOperation.GREATER_THAN:
255
255
  return _cond(DataCubeFunction.GREATER_THAN, _val());
256
- case DataCubeQuerySnapshotFilterOperation.GREATER_THAN_OR_EQUAL:
256
+ case DataCubeQueryFilterOperation.GREATER_THAN_OR_EQUAL:
257
257
  return _cond(DataCubeFunction.GREATER_THAN_EQUAL, _val());
258
- case DataCubeQuerySnapshotFilterOperation.LESS_THAN:
258
+ case DataCubeQueryFilterOperation.LESS_THAN:
259
259
  return _cond(DataCubeFunction.LESS_THAN, _val());
260
- case DataCubeQuerySnapshotFilterOperation.LESS_THAN_OR_EQUAL:
260
+ case DataCubeQueryFilterOperation.LESS_THAN_OR_EQUAL:
261
261
  return _cond(DataCubeFunction.LESS_THAN_EQUAL, _val());
262
- case DataCubeQuerySnapshotFilterOperation.CONTAINS:
262
+ case DataCubeQueryFilterOperation.CONTAINS:
263
263
  return _cond(DataCubeFunction.CONTAINS, _val());
264
- case DataCubeQuerySnapshotFilterOperation.ENDS_WITH:
264
+ case DataCubeQueryFilterOperation.ENDS_WITH:
265
265
  return _cond(DataCubeFunction.ENDS_WITH, _val());
266
- case DataCubeQuerySnapshotFilterOperation.STARTS_WITH:
266
+ case DataCubeQueryFilterOperation.STARTS_WITH:
267
267
  return _cond(DataCubeFunction.STARTS_WITH, _val());
268
- case DataCubeQuerySnapshotFilterOperation.BLANK:
268
+ case DataCubeQueryFilterOperation.BLANK:
269
269
  return _cond(DataCubeFunction.IS_EMPTY);
270
- case DataCubeQuerySnapshotFilterOperation.NOT_EQUAL:
270
+ case DataCubeQueryFilterOperation.NOT_EQUAL:
271
271
  return _not(_cond(DataCubeFunction.EQUAL, _val()));
272
- case DataCubeQuerySnapshotFilterOperation.NOT_BLANK:
272
+ case DataCubeQueryFilterOperation.NOT_BLANK:
273
273
  return _not(_cond(DataCubeFunction.IS_EMPTY));
274
- case DataCubeQuerySnapshotFilterOperation.NOT_CONTAINS:
274
+ case DataCubeQueryFilterOperation.NOT_CONTAINS:
275
275
  return _not(_cond(DataCubeFunction.CONTAINS, _val()));
276
276
  default:
277
277
  throw new UnsupportedOperationError(
@@ -419,7 +419,7 @@ export function buildExecutableQuery(
419
419
  data.sortColumns.map((col) =>
420
420
  _function(
421
421
  _name(
422
- col.operation === DataCubeQuerySnapshotSortOperation.ASCENDING
422
+ col.operation === DataCubeQuerySortOperation.ASCENDING
423
423
  ? DataCubeFunction.ASC
424
424
  : DataCubeFunction.DESC,
425
425
  ),
@@ -189,6 +189,31 @@ export enum DataCubeAggregateFunction {
189
189
  // custom
190
190
  }
191
191
 
192
+ export enum DataCubeQueryFilterOperation {
193
+ EQUAL = 'equal',
194
+ NOT_EQUAL = 'notEqual',
195
+ GREATER_THAN = 'greaterThan',
196
+ GREATER_THAN_OR_EQUAL = 'greaterThanOrEqual',
197
+ LESS_THAN = 'lessThan',
198
+ LESS_THAN_OR_EQUAL = 'lessThanOrEqual',
199
+ BLANK = 'isEmpty',
200
+ NOT_BLANK = 'isNotEmpty',
201
+ CONTAINS = 'contains',
202
+ NOT_CONTAINS = 'notContains',
203
+ STARTS_WITH = 'startsWith',
204
+ ENDS_WITH = 'endsWith',
205
+ }
206
+
207
+ export enum DataCubeQueryFilterGroupOperation {
208
+ AND = 'and',
209
+ OR = 'or',
210
+ }
211
+
212
+ export enum DataCubeQuerySortOperation {
213
+ ASCENDING = 'ascending',
214
+ DESCENDING = 'descending',
215
+ }
216
+
192
217
  export enum DataCubeColumnPinPlacement {
193
218
  LEFT = 'Left',
194
219
  RIGHT = 'Right',
@@ -25,51 +25,17 @@ import {
25
25
  type PlainObject,
26
26
  type Writable,
27
27
  } from '@finos/legend-shared';
28
-
29
- export enum DataCubeQuerySnapshotAggregateFunction {
30
- AVERAGE = 'average',
31
- COUNT = 'count',
32
- DISTINCT = 'distinct',
33
- FIRST = 'first',
34
- JOIN_STRINGS = 'joinStrings',
35
- LAST = 'last',
36
- MAX = 'max',
37
- MIN = 'min',
38
- SUM = 'sum',
39
- STD_DEV_POPULATION = 'stdDevPopulation',
40
- STD_DEV_SAMPLE = 'stdDevSample',
41
- UNIQUE_VALUE_ONLY = 'uniqueValueOnly',
42
- }
43
-
44
- export enum DataCubeQuerySnapshotFilterOperation {
45
- EQUAL = 'equal',
46
- NOT_EQUAL = 'notEqual',
47
- GREATER_THAN = 'greaterThan',
48
- GREATER_THAN_OR_EQUAL = 'greaterThanOrEqual',
49
- LESS_THAN = 'lessThan',
50
- LESS_THAN_OR_EQUAL = 'lessThanOrEqual',
51
- BLANK = 'isEmpty',
52
- NOT_BLANK = 'isNotEmpty',
53
- CONTAINS = 'contains',
54
- NOT_CONTAINS = 'notContains',
55
- STARTS_WITH = 'startsWith',
56
- ENDS_WITH = 'endsWith',
57
- }
58
-
59
- export enum DataCubeQuerySnapshotSortOperation {
60
- ASCENDING = 'ascending',
61
- DESCENDING = 'descending',
62
- }
63
-
64
- export enum DataCubeQueryFilterGroupOperation {
65
- AND = 'AND',
66
- OR = 'OR',
67
- }
28
+ import type {
29
+ DataCubeAggregateFunction,
30
+ DataCubeQueryFilterGroupOperation,
31
+ DataCubeQueryFilterOperation,
32
+ DataCubeQuerySortOperation,
33
+ } from './DataCubeQueryEngine.js';
68
34
 
69
35
  export type DataCubeQuerySnapshotFilterCondition =
70
36
  DataCubeQuerySnapshotColumn & {
71
37
  value: unknown;
72
- operation: DataCubeQuerySnapshotFilterOperation;
38
+ operation: DataCubeQueryFilterOperation;
73
39
  };
74
40
 
75
41
  export type DataCubeQuerySnapshotFilter = {
@@ -92,12 +58,12 @@ export type DataCubeQuerySnapshotExtendedColumn =
92
58
  };
93
59
 
94
60
  export type DataCubeQuerySnapshotSortColumn = DataCubeQuerySnapshotColumn & {
95
- operation: DataCubeQuerySnapshotSortOperation;
61
+ operation: DataCubeQuerySortOperation;
96
62
  };
97
63
 
98
64
  export type DataCubeQuerySnapshotAggregateColumn =
99
65
  DataCubeQuerySnapshotColumn & {
100
- function: DataCubeQuerySnapshotAggregateFunction;
66
+ function: DataCubeAggregateFunction;
101
67
  };
102
68
 
103
69
  export type DataCubeQuerySnapshotGroupBy = {
@@ -116,7 +82,7 @@ export type DataCubeQuerySnapshotData = {
116
82
  runtime: string;
117
83
  sourceQuery: PlainObject<V1_ValueSpecification>;
118
84
  configuration: PlainObject<DataCubeConfiguration>;
119
- originalColumns: DataCubeQuerySnapshotColumn[];
85
+ sourceColumns: DataCubeQuerySnapshotColumn[];
120
86
  leafExtendedColumns: DataCubeQuerySnapshotExtendedColumn[];
121
87
  filter?: DataCubeQuerySnapshotFilter | undefined;
122
88
  groupBy?: DataCubeQuerySnapshotGroupBy | undefined;
@@ -154,13 +120,13 @@ export class DataCubeQuerySnapshot {
154
120
  runtime,
155
121
  sourceQuery,
156
122
  configuration,
157
- originalColumns: [],
123
+ sourceColumns: [],
158
124
  leafExtendedColumns: [],
125
+ selectColumns: [],
159
126
  filter: undefined,
160
127
  groupBy: undefined,
161
128
  pivot: undefined,
162
129
  groupExtendedColumns: [],
163
- selectColumns: [],
164
130
  sortColumns: [],
165
131
  limit: undefined,
166
132
  };
@@ -188,23 +154,18 @@ export class DataCubeQuerySnapshot {
188
154
  */
189
155
  stageCols(stage: DataCubeQuerySnapshotStage): DataCubeQuerySnapshotColumn[] {
190
156
  switch (stage) {
191
- case 'leaf-extend':
192
- return [...this.data.originalColumns];
193
157
  case 'filter':
158
+ case 'leaf-extend':
159
+ return [...this.data.sourceColumns];
160
+ case 'select':
161
+ return [...this.data.sourceColumns, ...this.data.leafExtendedColumns];
194
162
  case 'aggregation':
195
- return [...this.data.originalColumns, ...this.data.leafExtendedColumns];
163
+ return [...this.data.selectColumns];
196
164
  case 'group-extend':
197
165
  // TODO: @akphi - add pivot columns
198
- return [...this.data.originalColumns, ...this.data.leafExtendedColumns];
199
- case 'select':
200
- // TODO: @akphi - add pivot columns
201
- return [
202
- ...this.data.originalColumns,
203
- ...this.data.leafExtendedColumns,
204
- ...this.data.groupExtendedColumns,
205
- ];
206
- case 'sort':
207
166
  return [...this.data.selectColumns];
167
+ case 'sort':
168
+ return [...this.data.selectColumns, ...this.data.groupExtendedColumns];
208
169
  default:
209
170
  throw new IllegalStateError(`Unknown stage '${stage}'`);
210
171
  }
@@ -36,7 +36,6 @@ import {
36
36
  import type { DataCubeQuery } from '../../../server/models/DataCubeQuery.js';
37
37
  import {
38
38
  DataCubeQuerySnapshot,
39
- DataCubeQuerySnapshotSortOperation,
40
39
  type DataCubeQuerySnapshotColumn,
41
40
  } from './DataCubeQuerySnapshot.js';
42
41
  import {
@@ -47,6 +46,7 @@ import {
47
46
  type Clazz,
48
47
  } from '@finos/legend-shared';
49
48
  import {
49
+ DataCubeQuerySortOperation,
50
50
  DataCubeFunction,
51
51
  type DataCubeQueryFunctionMap,
52
52
  } from './DataCubeQueryEngine.js';
@@ -332,16 +332,21 @@ export function validateAndBuildQuerySnapshot(
332
332
  );
333
333
  const data = snapshot.data;
334
334
  const colsMap = new Map<string, DataCubeQuerySnapshotColumn>();
335
- const _col = (colSpec: V1_ColSpec) =>
336
- guaranteeNonNullable(colsMap.get(colSpec.name));
335
+ const _col = (colSpec: V1_ColSpec) => {
336
+ const column = guaranteeNonNullable(colsMap.get(colSpec.name));
337
+ return {
338
+ name: column.name,
339
+ type: column.type,
340
+ };
341
+ };
337
342
 
338
343
  // --------------------------------- SOURCE ---------------------------------
339
344
 
340
- data.originalColumns = baseQuery.source.columns.map((col) => ({
345
+ data.sourceColumns = baseQuery.source.columns.map((col) => ({
341
346
  name: col.name,
342
347
  type: col.type,
343
348
  }));
344
- data.originalColumns.map((col) => colsMap.set(col.name, col));
349
+ data.sourceColumns.map((col) => colsMap.set(col.name, col));
345
350
 
346
351
  // --------------------------------- FILTER ---------------------------------
347
352
  // TODO: @akphi - implement this
@@ -383,8 +388,8 @@ export function validateAndBuildQuerySnapshot(
383
388
  ..._col(_colSpecParam(sortColFunc, 0)),
384
389
  operation:
385
390
  _name(sortColFunc.function) === DataCubeFunction.ASC
386
- ? DataCubeQuerySnapshotSortOperation.ASCENDING
387
- : DataCubeQuerySnapshotSortOperation.DESCENDING,
391
+ ? DataCubeQuerySortOperation.ASCENDING
392
+ : DataCubeQuerySortOperation.DESCENDING,
388
393
  };
389
394
  },
390
395
  );
@@ -20,7 +20,12 @@ import type { DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
20
20
  import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
21
21
  import type { DataCubeEditorState } from './DataCubeEditorState.js';
22
22
  import { DataCubeMutableColumnConfiguration } from './DataCubeMutableConfiguration.js';
23
- import { getNonNullableEntry, type PlainObject } from '@finos/legend-shared';
23
+ import {
24
+ getNonNullableEntry,
25
+ isNonNullable,
26
+ type PlainObject,
27
+ } from '@finos/legend-shared';
28
+ import type { DataCubeConfiguration } from '../core/DataCubeConfiguration.js';
24
29
 
25
30
  export class DataCubeEditorColumnPropertiesPanelState
26
31
  implements DataCubeQueryEditorPanelState
@@ -43,12 +48,29 @@ export class DataCubeEditorColumnPropertiesPanelState
43
48
 
44
49
  showAdvancedSettings: observable,
45
50
  setShowAdvancedSettings: action,
51
+
52
+ hiddenColumns: computed,
53
+ configurableColumns: computed,
46
54
  });
47
55
 
48
56
  this.editor = editor;
49
57
  this.dataCube = editor.dataCube;
50
58
  }
51
59
 
60
+ get hiddenColumns(): DataCubeMutableColumnConfiguration[] {
61
+ return this.columns.filter((column) => column.hideFromView);
62
+ }
63
+
64
+ get configurableColumns(): DataCubeMutableColumnConfiguration[] {
65
+ return this.columns
66
+ .filter((column) =>
67
+ this.editor.columns.selector.selectedColumns.find(
68
+ (col) => col.name === column.name,
69
+ ),
70
+ )
71
+ .sort((a, b) => a.name.localeCompare(b.name));
72
+ }
73
+
52
74
  getColumnConfiguration(
53
75
  colName: string | undefined,
54
76
  ): DataCubeMutableColumnConfiguration | undefined {
@@ -64,7 +86,7 @@ export class DataCubeEditorColumnPropertiesPanelState
64
86
  }
65
87
 
66
88
  get selectedColumn(): DataCubeMutableColumnConfiguration | undefined {
67
- return this.columns.find(
89
+ return this.configurableColumns.find(
68
90
  (column) => column.name === this.selectedColumnName,
69
91
  );
70
92
  }
@@ -73,14 +95,19 @@ export class DataCubeEditorColumnPropertiesPanelState
73
95
  this.showAdvancedSettings = val;
74
96
  }
75
97
 
76
- applySnaphot(snapshot: DataCubeQuerySnapshot): void {
98
+ applySnaphot(
99
+ snapshot: DataCubeQuerySnapshot,
100
+ configuration: DataCubeConfiguration,
101
+ ): void {
77
102
  this.setColumns(
78
103
  (snapshot.data.configuration as { columns: PlainObject[] }).columns.map(
79
104
  (column) => DataCubeMutableColumnConfiguration.create(column),
80
105
  ),
81
106
  );
82
107
  if (!this.selectedColumn && this.columns.length) {
83
- this.setSelectedColumnName(getNonNullableEntry(this.columns, 0).name);
108
+ this.setSelectedColumnName(
109
+ getNonNullableEntry(this.configurableColumns, 0).name,
110
+ );
84
111
  }
85
112
  }
86
113
 
@@ -90,7 +117,12 @@ export class DataCubeEditorColumnPropertiesPanelState
90
117
  ): void {
91
118
  newSnapshot.data.configuration = {
92
119
  ...newSnapshot.data.configuration,
93
- columns: this.columns.map((column) => column.serialize()),
120
+ // NOTE: make sure the order of column configurations is consistent with the order of selected columns
121
+ // as this would later be used to determine of order of displayed columns in the grid
122
+ columns: this.editor.columns.selector.selectedColumns
123
+ .map((col) => this.columns.find((column) => column.name === col.name))
124
+ .filter(isNonNullable)
125
+ .map((column) => column.serialize()),
94
126
  };
95
127
  }
96
128
  }