@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.
Files changed (184) hide show
  1. package/lib/application/LegendREPL.d.ts +2 -2
  2. package/lib/application/LegendREPL.d.ts.map +1 -1
  3. package/lib/application/LegendREPL.js.map +1 -1
  4. package/lib/application/LegendREPLApplicationConfig.d.ts.map +1 -1
  5. package/lib/application/LegendREPLDocumentation.d.ts +2 -1
  6. package/lib/application/LegendREPLDocumentation.d.ts.map +1 -1
  7. package/lib/application/LegendREPLDocumentation.js +1 -0
  8. package/lib/application/LegendREPLDocumentation.js.map +1 -1
  9. package/lib/application/LegendREPLPluginManager.d.ts.map +1 -1
  10. package/lib/application/LegendREPLPluginManager.js.map +1 -1
  11. package/lib/components/LegendREPLApplication.js +2 -2
  12. package/lib/components/LegendREPLApplication.js.map +1 -1
  13. package/lib/components/LegendREPLFrameworkProvider.d.ts +3 -2
  14. package/lib/components/LegendREPLFrameworkProvider.d.ts.map +1 -1
  15. package/lib/components/LegendREPLFrameworkProvider.js +1 -1
  16. package/lib/components/LegendREPLFrameworkProvider.js.map +1 -1
  17. package/lib/components/REPLStoreProvider.d.ts.map +1 -1
  18. package/lib/components/REPLStoreProvider.js.map +1 -1
  19. package/lib/components/dataCube/DataCube.js.map +1 -1
  20. package/lib/components/dataCube/editor/DataCubeEditor.js.map +1 -1
  21. package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js +3 -3
  22. package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js.map +1 -1
  23. package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.d.ts.map +1 -1
  24. package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js +14 -12
  25. package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js.map +1 -1
  26. package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.js +4 -4
  27. package/lib/components/dataCube/grid/DataCubeGrid.d.ts.map +1 -1
  28. package/lib/components/dataCube/grid/DataCubeGrid.js +1 -1
  29. package/lib/components/dataCube/grid/DataCubeGrid.js.map +1 -1
  30. package/lib/components/repl/Alert.d.ts +14 -2
  31. package/lib/components/repl/Alert.d.ts.map +1 -1
  32. package/lib/components/repl/Alert.js +42 -24
  33. package/lib/components/repl/Alert.js.map +1 -1
  34. package/lib/components/repl/DocumentationPanel.d.ts +0 -5
  35. package/lib/components/repl/DocumentationPanel.d.ts.map +1 -1
  36. package/lib/components/repl/DocumentationPanel.js +2 -28
  37. package/lib/components/repl/DocumentationPanel.js.map +1 -1
  38. package/lib/components/repl/Form.d.ts +5 -0
  39. package/lib/components/repl/Form.d.ts.map +1 -1
  40. package/lib/components/repl/Form.js +27 -0
  41. package/lib/components/repl/Form.js.map +1 -1
  42. package/lib/components/repl/SettingsPanel.d.ts.map +1 -1
  43. package/lib/components/repl/SettingsPanel.js +6 -3
  44. package/lib/components/repl/SettingsPanel.js.map +1 -1
  45. package/lib/index.css +1 -1
  46. package/lib/index.d.ts +4 -3
  47. package/lib/index.d.ts.map +1 -1
  48. package/lib/index.js +1 -1
  49. package/lib/index.js.map +1 -1
  50. package/lib/package.json +1 -1
  51. package/lib/server/REPLEngine.d.ts +1 -0
  52. package/lib/server/REPLEngine.d.ts.map +1 -1
  53. package/lib/server/REPLEngine.js.map +1 -1
  54. package/lib/stores/LayoutManagerState.d.ts +2 -1
  55. package/lib/stores/LayoutManagerState.d.ts.map +1 -1
  56. package/lib/stores/LayoutManagerState.js +8 -1
  57. package/lib/stores/LayoutManagerState.js.map +1 -1
  58. package/lib/stores/LegendREPLApplicationPlugin.d.ts +2 -1
  59. package/lib/stores/LegendREPLApplicationPlugin.d.ts.map +1 -1
  60. package/lib/stores/REPLStore.d.ts +17 -2
  61. package/lib/stores/REPLStore.d.ts.map +1 -1
  62. package/lib/stores/REPLStore.js +15 -5
  63. package/lib/stores/REPLStore.js.map +1 -1
  64. package/lib/stores/dataCube/DataCubeEngine.d.ts +6 -1
  65. package/lib/stores/dataCube/DataCubeEngine.d.ts.map +1 -1
  66. package/lib/stores/dataCube/DataCubeEngine.js +19 -7
  67. package/lib/stores/dataCube/DataCubeEngine.js.map +1 -1
  68. package/lib/stores/dataCube/DataCubeState.d.ts.map +1 -1
  69. package/lib/stores/dataCube/DataCubeState.js +1 -0
  70. package/lib/stores/dataCube/DataCubeState.js.map +1 -1
  71. package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts +2 -3
  72. package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts.map +1 -1
  73. package/lib/stores/dataCube/core/DataCubeConfiguration.js +2 -4
  74. package/lib/stores/dataCube/core/DataCubeConfiguration.js.map +1 -1
  75. package/lib/stores/dataCube/core/DataCubeCoreState.d.ts.map +1 -1
  76. package/lib/stores/dataCube/core/DataCubeQueryBuilder.d.ts +4 -4
  77. package/lib/stores/dataCube/core/DataCubeQueryBuilder.d.ts.map +1 -1
  78. package/lib/stores/dataCube/core/DataCubeQueryBuilder.js +70 -12
  79. package/lib/stores/dataCube/core/DataCubeQueryBuilder.js.map +1 -1
  80. package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts +8 -2
  81. package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts.map +1 -1
  82. package/lib/stores/dataCube/core/DataCubeQueryEngine.js +20 -15
  83. package/lib/stores/dataCube/core/DataCubeQueryEngine.js.map +1 -1
  84. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts +5 -4
  85. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts.map +1 -1
  86. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js.map +1 -1
  87. package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.d.ts +2 -1
  88. package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.d.ts.map +1 -1
  89. package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js +131 -11
  90. package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js.map +1 -1
  91. package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.d.ts.map +1 -1
  92. package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.d.ts.map +1 -1
  93. package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.d.ts.map +1 -1
  94. package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.js.map +1 -1
  95. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts +1 -1
  96. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts.map +1 -1
  97. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js +28 -0
  98. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js.map +1 -1
  99. package/lib/stores/dataCube/editor/DataCubeEditorColumnsPanelState.d.ts.map +1 -1
  100. package/lib/stores/dataCube/editor/DataCubeEditorColumnsPanelState.js.map +1 -1
  101. package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.d.ts.map +1 -1
  102. package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts.map +1 -1
  103. package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.d.ts.map +1 -1
  104. package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.js.map +1 -1
  105. package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts.map +1 -1
  106. package/lib/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.d.ts.map +1 -1
  107. package/lib/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.js +2 -1
  108. package/lib/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.js.map +1 -1
  109. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts +9 -4
  110. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts.map +1 -1
  111. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js +20 -4
  112. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js.map +1 -1
  113. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts +3 -0
  114. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts.map +1 -1
  115. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js +64 -9
  116. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js.map +1 -1
  117. package/lib/stores/dataCube/grid/DataCubeGridClientExportEngine.d.ts.map +1 -1
  118. package/lib/stores/dataCube/grid/DataCubeGridConfigurationBuilder.d.ts.map +1 -1
  119. package/lib/stores/dataCube/grid/DataCubeGridConfigurationBuilder.js +23 -27
  120. package/lib/stores/dataCube/grid/DataCubeGridConfigurationBuilder.js.map +1 -1
  121. package/lib/stores/dataCube/grid/DataCubeGridControllerState.d.ts.map +1 -1
  122. package/lib/stores/dataCube/grid/DataCubeGridControllerState.js +2 -9
  123. package/lib/stores/dataCube/grid/DataCubeGridControllerState.js.map +1 -1
  124. package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.d.ts +2 -1
  125. package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.d.ts.map +1 -1
  126. package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js +63 -11
  127. package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js.map +1 -1
  128. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.d.ts +3 -1
  129. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.d.ts.map +1 -1
  130. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js +14 -26
  131. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js.map +1 -1
  132. package/lib/stores/dataCube/grid/DataCubeGridState.d.ts +1 -1
  133. package/lib/stores/dataCube/grid/DataCubeGridState.d.ts.map +1 -1
  134. package/lib/stores/dataCube/grid/DataCubeGridState.js +16 -2
  135. package/lib/stores/dataCube/grid/DataCubeGridState.js.map +1 -1
  136. package/package.json +6 -6
  137. package/src/application/LegendREPL.tsx +3 -6
  138. package/src/application/LegendREPLApplicationConfig.ts +1 -1
  139. package/src/application/LegendREPLDocumentation.ts +1 -0
  140. package/src/application/LegendREPLPluginManager.ts +7 -9
  141. package/src/components/LegendREPLApplication.tsx +2 -2
  142. package/src/components/LegendREPLFrameworkProvider.tsx +2 -5
  143. package/src/components/REPLStoreProvider.tsx +1 -1
  144. package/src/components/dataCube/DataCube.tsx +1 -1
  145. package/src/components/dataCube/editor/DataCubeEditor.tsx +2 -2
  146. package/src/components/dataCube/editor/DataCubeEditorCodePanel.tsx +3 -3
  147. package/src/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.tsx +35 -12
  148. package/src/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.tsx +6 -6
  149. package/src/components/dataCube/grid/DataCubeGrid.tsx +4 -6
  150. package/src/components/repl/Alert.tsx +138 -94
  151. package/src/components/repl/DocumentationPanel.tsx +2 -50
  152. package/src/components/repl/Form.tsx +47 -0
  153. package/src/components/repl/SettingsPanel.tsx +42 -8
  154. package/src/index.tsx +4 -8
  155. package/src/server/REPLEngine.ts +1 -0
  156. package/src/stores/LayoutManagerState.ts +12 -4
  157. package/src/stores/LegendREPLApplicationPlugin.ts +2 -2
  158. package/src/stores/REPLStore.tsx +54 -7
  159. package/src/stores/dataCube/DataCubeEngine.ts +30 -13
  160. package/src/stores/dataCube/DataCubeState.ts +5 -4
  161. package/src/stores/dataCube/core/DataCubeConfiguration.ts +2 -6
  162. package/src/stores/dataCube/core/DataCubeCoreState.ts +3 -3
  163. package/src/stores/dataCube/core/DataCubeQueryBuilder.ts +89 -17
  164. package/src/stores/dataCube/core/DataCubeQueryEngine.ts +11 -2
  165. package/src/stores/dataCube/core/DataCubeQuerySnapshot.ts +11 -9
  166. package/src/stores/dataCube/core/DataCubeQuerySnapshotBuilder.ts +154 -15
  167. package/src/stores/dataCube/core/DataCubeQuerySnapshotManager.ts +6 -6
  168. package/src/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.ts +3 -3
  169. package/src/stores/dataCube/editor/DataCubeEditorCodePanelState.ts +4 -6
  170. package/src/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.ts +43 -12
  171. package/src/stores/dataCube/editor/DataCubeEditorColumnsPanelState.ts +6 -8
  172. package/src/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.ts +4 -4
  173. package/src/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.ts +5 -5
  174. package/src/stores/dataCube/editor/DataCubeEditorSortsPanelState.ts +5 -7
  175. package/src/stores/dataCube/editor/DataCubeEditorState.tsx +4 -4
  176. package/src/stores/dataCube/editor/DataCubeEditorVerticalPivotsPanelState.ts +4 -3
  177. package/src/stores/dataCube/editor/DataCubeMutableConfiguration.ts +102 -87
  178. package/src/stores/dataCube/grid/DataCubeGridClientEngine.ts +75 -15
  179. package/src/stores/dataCube/grid/DataCubeGridClientExportEngine.ts +2 -2
  180. package/src/stores/dataCube/grid/DataCubeGridConfigurationBuilder.tsx +28 -29
  181. package/src/stores/dataCube/grid/DataCubeGridControllerState.ts +7 -16
  182. package/src/stores/dataCube/grid/DataCubeGridQueryBuilder.ts +72 -10
  183. package/src/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.ts +27 -37
  184. package/src/stores/dataCube/grid/DataCubeGridState.ts +27 -9
@@ -18,7 +18,8 @@ import {
18
18
  getDataType,
19
19
  type DataCubeColumnKind,
20
20
  type DataCubeFont,
21
- type DataCubeAggregateFunction,
21
+ type DataCubeAggregateOperation,
22
+ type DataCubeOperationValue,
22
23
  type DataCubeNumberScale,
23
24
  type DataCubeSelectionStat,
24
25
  type DataCubeFontFormatUnderlineVariant,
@@ -50,6 +51,13 @@ import { buildDefaultColumnConfiguration } from '../core/DataCubeConfigurationBu
50
51
  export class DataCubeMutableColumnConfiguration extends DataCubeColumnConfiguration {
51
52
  readonly dataType!: DataCubeColumnDataType;
52
53
 
54
+ // NOTE: these configurations are synthesized from the data query, and materialized here
55
+ // to make editing more convenient. They should not be part of the persistent configuration
56
+ // to avoid duplication of information with the data query.
57
+ aggregateFunction?: DataCubeAggregateOperation | undefined;
58
+ aggregateFunctionParameters: DataCubeOperationValue[] = [];
59
+ excludedFromHorizontalPivot = false;
60
+
53
61
  static create(
54
62
  json: PlainObject<DataCubeColumnConfiguration>,
55
63
  ): DataCubeMutableColumnConfiguration {
@@ -79,6 +87,9 @@ export class DataCubeMutableColumnConfiguration extends DataCubeColumnConfigurat
79
87
  numberScale: observable,
80
88
  setNumberScale: action,
81
89
 
90
+ missingValueDisplayText: observable,
91
+ setMissingValueDisplayText: action,
92
+
82
93
  hPivotSortFunction: observable,
83
94
  setHPivotSortFunction: action,
84
95
 
@@ -136,12 +147,6 @@ export class DataCubeMutableColumnConfiguration extends DataCubeColumnConfigurat
136
147
  hideFromView: observable,
137
148
  setHideFromView: action,
138
149
 
139
- aggregateFunction: observable,
140
- setAggregateFunction: action,
141
-
142
- excludedFromHorizontalPivot: observable,
143
- setExcludedFromHorizontalPivot: action,
144
-
145
150
  fixedWidth: observable,
146
151
  setFixedWidth: action,
147
152
 
@@ -162,15 +167,21 @@ export class DataCubeMutableColumnConfiguration extends DataCubeColumnConfigurat
162
167
 
163
168
  isUsingDefaultStyling: computed,
164
169
  useDefaultStyling: action,
170
+
171
+ aggregateFunction: observable,
172
+ setAggregateFunction: action,
173
+
174
+ aggregateFunctionParameters: observable,
175
+ setAggregateFunctionParameters: action,
176
+
177
+ excludedFromHorizontalPivot: observable,
178
+ setExcludedFromHorizontalPivot: action,
165
179
  });
166
180
 
167
181
  return configuration;
168
182
  }
169
183
 
170
- static createDefault(column: {
171
- name: string;
172
- type: string;
173
- }): DataCubeMutableColumnConfiguration {
184
+ static createDefault(column: { name: string; type: string }) {
174
185
  return DataCubeMutableColumnConfiguration.create(
175
186
  DataCubeColumnConfiguration.serialization.toJson(
176
187
  buildDefaultColumnConfiguration(column),
@@ -178,11 +189,11 @@ export class DataCubeMutableColumnConfiguration extends DataCubeColumnConfigurat
178
189
  );
179
190
  }
180
191
 
181
- serialize(): PlainObject<DataCubeColumnConfiguration> {
192
+ serialize() {
182
193
  return DataCubeColumnConfiguration.serialization.toJson(this);
183
194
  }
184
195
 
185
- get isUsingDefaultStyling(): boolean {
196
+ get isUsingDefaultStyling() {
186
197
  return (
187
198
  this.fontFamily === undefined &&
188
199
  this.fontSize === undefined &&
@@ -202,7 +213,7 @@ export class DataCubeMutableColumnConfiguration extends DataCubeColumnConfigurat
202
213
  );
203
214
  }
204
215
 
205
- useDefaultStyling(): void {
216
+ useDefaultStyling() {
206
217
  this.fontFamily = undefined;
207
218
  this.fontSize = undefined;
208
219
  this.fontBold = undefined;
@@ -220,139 +231,145 @@ export class DataCubeMutableColumnConfiguration extends DataCubeColumnConfigurat
220
231
  this.errorBackgroundColor = undefined;
221
232
  }
222
233
 
223
- setKind(value: DataCubeColumnKind): void {
234
+ setKind(value: DataCubeColumnKind) {
224
235
  this.kind = value;
225
236
  }
226
237
 
227
- setDisplayName(value: string | undefined): void {
238
+ setDisplayName(value: string | undefined) {
228
239
  this.displayName = value;
229
240
  }
230
241
 
231
- setDecimals(value: number | undefined): void {
242
+ setDecimals(value: number | undefined) {
232
243
  this.decimals = value;
233
244
  }
234
245
 
235
- setDisplayCommas(value: boolean): void {
246
+ setDisplayCommas(value: boolean) {
236
247
  this.displayCommas = value;
237
248
  }
238
249
 
239
- setNegativeNumberInParens(value: boolean): void {
250
+ setNegativeNumberInParens(value: boolean) {
240
251
  this.negativeNumberInParens = value;
241
252
  }
242
253
 
243
- setNumberScale(value: DataCubeNumberScale | undefined): void {
254
+ setNumberScale(value: DataCubeNumberScale | undefined) {
244
255
  this.numberScale = value;
245
256
  }
246
257
 
247
- setHPivotSortFunction(value: string | undefined): void {
258
+ setMissingValueDisplayText(value: string | undefined) {
259
+ this.missingValueDisplayText = value;
260
+ }
261
+
262
+ setHPivotSortFunction(value: string | undefined) {
248
263
  this.hPivotSortFunction = value;
249
264
  }
250
265
 
251
- setFontFamily(value: DataCubeFont | undefined): void {
266
+ setFontFamily(value: DataCubeFont | undefined) {
252
267
  this.fontFamily = value;
253
268
  }
254
269
 
255
- setFontSize(value: number | undefined): void {
270
+ setFontSize(value: number | undefined) {
256
271
  this.fontSize = value;
257
272
  }
258
273
 
259
- setFontBold(value: boolean | undefined): void {
274
+ setFontBold(value: boolean | undefined) {
260
275
  this.fontBold = value;
261
276
  }
262
277
 
263
- setFontItalic(value: boolean | undefined): void {
278
+ setFontItalic(value: boolean | undefined) {
264
279
  this.fontItalic = value;
265
280
  }
266
281
 
267
- setFontUnderline(
268
- value: DataCubeFontFormatUnderlineVariant | undefined,
269
- ): void {
282
+ setFontUnderline(value: DataCubeFontFormatUnderlineVariant | undefined) {
270
283
  this.fontUnderline = value;
271
284
  }
272
285
 
273
- setFontStrikethrough(value: boolean | undefined): void {
286
+ setFontStrikethrough(value: boolean | undefined) {
274
287
  this.fontStrikethrough = value;
275
288
  }
276
289
 
277
- setFontCase(value: DataCubeFontCase | undefined): void {
290
+ setFontCase(value: DataCubeFontCase | undefined) {
278
291
  this.fontCase = value;
279
292
  }
280
293
 
281
- setTextAlign(value: DataCubeFontTextAlignment | undefined): void {
294
+ setTextAlign(value: DataCubeFontTextAlignment | undefined) {
282
295
  this.textAlign = value;
283
296
  }
284
297
 
285
- setNormalForegroundColor(value: string | undefined): void {
298
+ setNormalForegroundColor(value: string | undefined) {
286
299
  this.normalForegroundColor = value;
287
300
  }
288
301
 
289
- setNegativeForegroundColor(value: string | undefined): void {
302
+ setNegativeForegroundColor(value: string | undefined) {
290
303
  this.negativeForegroundColor = value;
291
304
  }
292
305
 
293
- setZeroForegroundColor(value: string | undefined): void {
306
+ setZeroForegroundColor(value: string | undefined) {
294
307
  this.zeroForegroundColor = value;
295
308
  }
296
309
 
297
- setErrorForegroundColor(value: string | undefined): void {
310
+ setErrorForegroundColor(value: string | undefined) {
298
311
  this.errorForegroundColor = value;
299
312
  }
300
313
 
301
- setNormalBackgroundColor(value: string | undefined): void {
314
+ setNormalBackgroundColor(value: string | undefined) {
302
315
  this.normalBackgroundColor = value;
303
316
  }
304
317
 
305
- setNegativeBackgroundColor(value: string | undefined): void {
318
+ setNegativeBackgroundColor(value: string | undefined) {
306
319
  this.negativeBackgroundColor = value;
307
320
  }
308
321
 
309
- setZeroBackgroundColor(value: string | undefined): void {
322
+ setZeroBackgroundColor(value: string | undefined) {
310
323
  this.zeroBackgroundColor = value;
311
324
  }
312
325
 
313
- setErrorBackgroundColor(value: string | undefined): void {
326
+ setErrorBackgroundColor(value: string | undefined) {
314
327
  this.errorBackgroundColor = value;
315
328
  }
316
329
 
317
- setBlur(value: boolean): void {
330
+ setBlur(value: boolean) {
318
331
  this.blur = value;
319
332
  }
320
333
 
321
- setHideFromView(value: boolean): void {
334
+ setHideFromView(value: boolean) {
322
335
  this.hideFromView = value;
323
336
  }
324
337
 
325
- setFixedWidth(value: number | undefined): void {
338
+ setFixedWidth(value: number | undefined) {
326
339
  this.fixedWidth = value;
327
340
  }
328
341
 
329
- setMinWidth(value: number | undefined): void {
342
+ setMinWidth(value: number | undefined) {
330
343
  this.minWidth = value;
331
344
  }
332
345
 
333
- setMaxWidth(value: number | undefined): void {
346
+ setMaxWidth(value: number | undefined) {
334
347
  this.maxWidth = value;
335
348
  }
336
349
 
337
- setPinned(value: DataCubeColumnPinPlacement | undefined): void {
350
+ setPinned(value: DataCubeColumnPinPlacement | undefined) {
338
351
  this.pinned = value;
339
352
  }
340
353
 
341
- setDisplayAsLink(value: boolean): void {
354
+ setDisplayAsLink(value: boolean) {
342
355
  this.displayAsLink = value;
343
356
  }
344
357
 
345
- setLinkLabelParameter(value: string | undefined): void {
358
+ setLinkLabelParameter(value: string | undefined) {
346
359
  this.linkLabelParameter = value;
347
360
  }
348
361
 
349
- setAggregateFunction(value: DataCubeAggregateFunction | undefined): void {
362
+ setAggregateFunction(value: DataCubeAggregateOperation | undefined) {
350
363
  this.aggregateFunction = value;
351
364
  }
352
365
 
353
- setExcludedFromHorizontalPivot(value: boolean): void {
366
+ setExcludedFromHorizontalPivot(value: boolean) {
354
367
  this.excludedFromHorizontalPivot = value;
355
368
  }
369
+
370
+ setAggregateFunctionParameters(value: DataCubeOperationValue[]) {
371
+ this.aggregateFunctionParameters = value;
372
+ }
356
373
  }
357
374
 
358
375
  export class DataCubeMutableConfiguration extends DataCubeConfiguration {
@@ -472,7 +489,7 @@ export class DataCubeMutableConfiguration extends DataCubeConfiguration {
472
489
  return configuration;
473
490
  }
474
491
 
475
- get isUsingDefaultStyling(): boolean {
492
+ get isUsingDefaultStyling() {
476
493
  return (
477
494
  this.fontFamily === DEFAULT_FONT_FAMILY &&
478
495
  this.fontSize === DEFAULT_FONT_SIZE &&
@@ -492,7 +509,7 @@ export class DataCubeMutableConfiguration extends DataCubeConfiguration {
492
509
  );
493
510
  }
494
511
 
495
- useDefaultStyling(): void {
512
+ useDefaultStyling() {
496
513
  this.fontFamily = DEFAULT_FONT_FAMILY;
497
514
  this.fontSize = DEFAULT_FONT_SIZE;
498
515
  this.fontBold = DEFAULT_FONT_BOLD;
@@ -510,141 +527,139 @@ export class DataCubeMutableConfiguration extends DataCubeConfiguration {
510
527
  this.errorBackgroundColor = DEFAULT_BACKGROUND_COLOR;
511
528
  }
512
529
 
513
- serialize(): PlainObject<DataCubeConfiguration> {
530
+ serialize() {
514
531
  return DataCubeConfiguration.serialization.toJson(this);
515
532
  }
516
533
 
517
- setDescription(value: string | undefined): void {
534
+ setDescription(value: string | undefined) {
518
535
  this.description = value;
519
536
  }
520
537
 
521
- setShowTreeLines(value: boolean): void {
538
+ setShowTreeLines(value: boolean) {
522
539
  this.showTreeLines = value;
523
540
  }
524
541
 
525
- setShowHorizontalGridLines(value: boolean): void {
542
+ setShowHorizontalGridLines(value: boolean) {
526
543
  this.showHorizontalGridLines = value;
527
544
  }
528
545
 
529
- setShowVerticalGridLines(value: boolean): void {
546
+ setShowVerticalGridLines(value: boolean) {
530
547
  this.showVerticalGridLines = value;
531
548
  }
532
549
 
533
- setGridLineColor(value: string): void {
550
+ setGridLineColor(value: string) {
534
551
  this.gridLineColor = value;
535
552
  }
536
553
 
537
- setFontFamily(value: DataCubeFont): void {
554
+ setFontFamily(value: DataCubeFont) {
538
555
  this.fontFamily = value;
539
556
  }
540
557
 
541
- setFontSize(value: number): void {
558
+ setFontSize(value: number) {
542
559
  this.fontSize = value;
543
560
  }
544
561
 
545
- setFontBold(value: boolean): void {
562
+ setFontBold(value: boolean) {
546
563
  this.fontBold = value;
547
564
  }
548
565
 
549
- setFontItalic(value: boolean): void {
566
+ setFontItalic(value: boolean) {
550
567
  this.fontItalic = value;
551
568
  }
552
569
 
553
- setFontUnderline(
554
- value: DataCubeFontFormatUnderlineVariant | undefined,
555
- ): void {
570
+ setFontUnderline(value: DataCubeFontFormatUnderlineVariant | undefined) {
556
571
  this.fontUnderline = value;
557
572
  }
558
573
 
559
- setFontStrikethrough(value: boolean): void {
574
+ setFontStrikethrough(value: boolean) {
560
575
  this.fontStrikethrough = value;
561
576
  }
562
577
 
563
- setFontCase(value: DataCubeFontCase | undefined): void {
578
+ setFontCase(value: DataCubeFontCase | undefined) {
564
579
  this.fontCase = value;
565
580
  }
566
581
 
567
- setTextAlign(value: DataCubeFontTextAlignment): void {
582
+ setTextAlign(value: DataCubeFontTextAlignment) {
568
583
  this.textAlign = value;
569
584
  }
570
585
 
571
- setNormalForegroundColor(value: string): void {
586
+ setNormalForegroundColor(value: string) {
572
587
  this.normalForegroundColor = value;
573
588
  }
574
589
 
575
- setNegativeForegroundColor(value: string): void {
590
+ setNegativeForegroundColor(value: string) {
576
591
  this.negativeForegroundColor = value;
577
592
  }
578
593
 
579
- setZeroForegroundColor(value: string): void {
594
+ setZeroForegroundColor(value: string) {
580
595
  this.zeroForegroundColor = value;
581
596
  }
582
597
 
583
- setErrorForegroundColor(value: string): void {
598
+ setErrorForegroundColor(value: string) {
584
599
  this.errorForegroundColor = value;
585
600
  }
586
601
 
587
- setNormalBackgroundColor(value: string): void {
602
+ setNormalBackgroundColor(value: string) {
588
603
  this.normalBackgroundColor = value;
589
604
  }
590
605
 
591
- setNegativeBackgroundColor(value: string): void {
606
+ setNegativeBackgroundColor(value: string) {
592
607
  this.negativeBackgroundColor = value;
593
608
  }
594
609
 
595
- setZeroBackgroundColor(value: string): void {
610
+ setZeroBackgroundColor(value: string) {
596
611
  this.zeroBackgroundColor = value;
597
612
  }
598
613
 
599
- setErrorBackgroundColor(value: string): void {
614
+ setErrorBackgroundColor(value: string) {
600
615
  this.errorBackgroundColor = value;
601
616
  }
602
617
 
603
- setAlternateRows(value: boolean): void {
618
+ setAlternateRows(value: boolean) {
604
619
  this.alternateRows = value;
605
620
  }
606
621
 
607
- setAlternateRowsColor(value: string): void {
622
+ setAlternateRowsColor(value: string) {
608
623
  this.alternateRowsColor = value;
609
624
  }
610
625
 
611
- setAlternateRowsCount(value: number): void {
626
+ setAlternateRowsCount(value: number) {
612
627
  this.alternateRowsCount = value;
613
628
  }
614
629
 
615
- setAlternateRowsStandardMode(value: boolean): void {
630
+ setAlternateRowsStandardMode(value: boolean) {
616
631
  this.alternateRowsStandardMode = value;
617
632
  }
618
633
 
619
- setSelectionStats(value: DataCubeSelectionStat[]): void {
634
+ setSelectionStats(value: DataCubeSelectionStat[]) {
620
635
  this.selectionStats = value;
621
636
  }
622
637
 
623
- setShowWarningForTruncatedResult(value: boolean): void {
638
+ setShowWarningForTruncatedResult(value: boolean) {
624
639
  this.showWarningForTruncatedResult = value;
625
640
  }
626
641
 
627
- setInitialExpandLevel(value: number | undefined): void {
642
+ setInitialExpandLevel(value: number | undefined) {
628
643
  this.initialExpandLevel = value;
629
644
  }
630
645
 
631
- setShowRootAggregation(value: boolean): void {
646
+ setShowRootAggregation(value: boolean) {
632
647
  this.showRootAggregation = value;
633
648
  }
634
649
 
635
- setShowLeafCount(value: boolean): void {
650
+ setShowLeafCount(value: boolean) {
636
651
  this.showLeafCount = value;
637
652
  }
638
653
 
639
- setAddPivotTotalColumn(value: boolean): void {
654
+ setAddPivotTotalColumn(value: boolean) {
640
655
  this.addPivotTotalColumn = value;
641
656
  }
642
657
 
643
- setAddPivotTotalColumnOnLeft(value: boolean): void {
658
+ setAddPivotTotalColumnOnLeft(value: boolean) {
644
659
  this.addPivotTotalColumnOnLeft = value;
645
660
  }
646
661
 
647
- setTreeGroupSortFunction(value: string | undefined): void {
662
+ setTreeGroupSortFunction(value: string | undefined) {
648
663
  this.treeGroupSortFunction = value;
649
664
  }
650
665
  }
@@ -26,6 +26,7 @@ import {
26
26
  assertErrorThrown,
27
27
  guaranteeNonNullable,
28
28
  isBoolean,
29
+ isNonNullable,
29
30
  } from '@finos/legend-shared';
30
31
  import { buildExecutableQuery } from '../core/DataCubeQueryBuilder.js';
31
32
  import { type TabularDataSet, V1_Lambda } from '@finos/legend-graph';
@@ -34,6 +35,8 @@ import { buildQuerySnapshot } from './DataCubeGridQuerySnapshotBuilder.js';
34
35
  import { generateRowGroupingDrilldownExecutableQueryPostProcessor } from './DataCubeGridQueryBuilder.js';
35
36
  import { makeObservable, observable, runInAction } from 'mobx';
36
37
  import type { DataCubeConfigurationColorKey } from '../core/DataCubeConfiguration.js';
38
+ import { AlertType } from '../../../components/repl/Alert.js';
39
+ import { DEFAULT_LARGE_ALERT_WINDOW_CONFIG } from '../../LayoutManagerState.js';
37
40
 
38
41
  type GridClientCellValue = string | number | boolean | null | undefined;
39
42
  type GridClientRowData = {
@@ -92,12 +95,21 @@ export const generateBackgroundColorUtilityClassName = (
92
95
  ) =>
93
96
  `${INTERNAL__GridClientUtilityCssClassName.BACKGROUND_COLOR_PREFIX}${key}-${color.substring(1)}`;
94
97
 
98
+ // Indicates how many rows for each block in the cache, i.e. how many rows returned from the server at a time.
99
+ // ag-grid will dedicte space in advanced to store these rows. In server-side row model, this is used as the page size.
100
+ // See https://www.ag-grid.com/react-data-grid/server-side-model-configuration/#server-side-cache
101
+ export const INTERNAL__GRID_CLIENT_DEFAULT_CACHE_BLOCK_SIZE = 100;
102
+ // NOTE: The cache block size is used by ag-grid to pre-allocate memory for the grid
103
+ // so the value set must be reasonable, or else it can crash the application!
104
+ export const INTERNAL__GRID_CLIENT_MAX_CACHE_BLOCK_SIZE = 1e5;
105
+
95
106
  export const INTERNAL__GRID_CLIENT_SIDE_BAR_WIDTH = 200;
96
107
  export const INTERNAL__GRID_CLIENT_COLUMN_MIN_WIDTH = 50;
97
108
  export const INTERNAL__GRID_CLIENT_HEADER_HEIGHT = 24;
98
109
  export const INTERNAL__GRID_CLIENT_ROW_HEIGHT = 20;
99
110
  export const INTERNAL__GRID_CLIENT_TOOLTIP_SHOW_DELAY = 1000;
100
111
  export const INTERNAL__GRID_CLIENT_AUTO_RESIZE_PADDING = 10;
112
+ export const INTERNAL__GRID_CLIENT_MISSING_VALUE = '__MISSING';
101
113
  export const INTERNAL__GRID_CLIENT_TREE_COLUMN_ID = 'INTERNAL__tree';
102
114
  export const INTERNAL__GRID_CLIENT_ROW_GROUPING_COUNT_AGG_COLUMN_ID =
103
115
  'INTERNAL__count';
@@ -151,9 +163,12 @@ function TDStoRowData(tds: TabularDataSet): GridClientRowData[] {
151
163
  _row.values.forEach((value, colIdx) => {
152
164
  // `ag-grid` shows `false` value as empty string so we have
153
165
  // call `.toString()` to avoid this behavior.
154
- row[cols[colIdx] as string] = isBoolean(value) ? String(value) : value;
166
+ row[cols[colIdx] as string] = isBoolean(value)
167
+ ? String(value)
168
+ : isNonNullable(value)
169
+ ? value
170
+ : INTERNAL__GRID_CLIENT_MISSING_VALUE;
155
171
  });
156
- row.rowNumber = rowIdx;
157
172
  return row;
158
173
  });
159
174
  }
@@ -172,9 +187,7 @@ export class DataCubeGridClientServerSideDataSource
172
187
  this.grid = grid;
173
188
  }
174
189
 
175
- async fetchRows(
176
- params: IServerSideGetRowsParams<unknown, unknown>,
177
- ): Promise<void> {
190
+ async fetchRows(params: IServerSideGetRowsParams<unknown, unknown>) {
178
191
  const task = this.grid.dataCube.newTask('Fetching data');
179
192
 
180
193
  // ------------------------------ GRID OPTIONS ------------------------------
@@ -229,27 +242,75 @@ export class DataCubeGridClientServerSideDataSource
229
242
  if (this.grid.dataCube.engine.enableDebugMode) {
230
243
  this.grid.dataCube.application.debugProcess(
231
244
  `Execution`,
245
+ `\nQuery: ${result.executedQuery}`,
232
246
  `\nConfig: pagination=${this.grid.isPaginationEnabled}`,
233
247
  `\nStats: ${rowData.length} rows, ${result.result.result.columns.length} columns`,
234
248
  `\nSQL: ${result.executedSQL}`,
235
249
  );
236
250
  }
251
+
237
252
  if (this.grid.isPaginationEnabled) {
238
253
  params.success({ rowData });
239
- // Only update row count when loading the top-level drilldown data
254
+ // only update row count when loading the top-level drilldown data
240
255
  if (params.request.groupKeys.length === 0) {
241
256
  runInAction(() => {
242
257
  this.rowCount = (params.request.startRow ?? 0) + rowData.length;
243
258
  });
244
259
  }
245
260
  } else {
261
+ // NOTE: When pagination is disabled and the user currently scrolls to somewhere in the grid, as data is fetched
262
+ // and the operation does not force a scroll top (for example, grouping will always force scrolling to the
263
+ // top, while sorting will leave scroll position as is), the grid ends up showing the wrong data because
264
+ // the data being displayed does not take into account the scroll position, but by the start and end row
265
+ // which stay constant as pagination is disabled.
266
+ //
267
+ // In order to handle this, when pagination is disabled, we tune the start and end row by setting the cache block size
268
+ // to a high-enough value (100k-1m). However, ag-grid use cache block size to pre-allocate memory for the rows,
269
+ // which means we must cap/tune this value reasonably to prevent the app from crashing.
270
+ //
271
+ // When there are just too many rows (exceeding the maximum cache block size), we will fallback to a slightly less ideal
272
+ // behavior by forcing a scroll top for every data fetch and also reset the cache block size to the default value to save memory
273
+ if (rowData.length > INTERNAL__GRID_CLIENT_MAX_CACHE_BLOCK_SIZE) {
274
+ if (
275
+ !this.grid.dataCube.repl.dataCubeEngine.disableLargeDatasetWarning
276
+ ) {
277
+ this.grid.dataCube.repl.alert({
278
+ message: `Large dataset (>${INTERNAL__GRID_CLIENT_MAX_CACHE_BLOCK_SIZE} rows) detected!`,
279
+ text: `Overall app performance can be impacted by large dataset due to longer query execution time and increased memory usage. At its limit, the application can crash!\nTo boost performance, consider enabling pagination while working with large dataset.`,
280
+ type: AlertType.WARNING,
281
+ actions: [
282
+ {
283
+ label: 'Enable Pagination',
284
+ handler: () => {
285
+ this.grid.setPaginationEnabled(true);
286
+ },
287
+ },
288
+ {
289
+ label: 'Dismiss Warning',
290
+ handler: () => {
291
+ // this.grid.setPaginationEnabled(true);
292
+ this.grid.dataCube.repl.dataCubeEngine.setDisableLargeDatasetWarning(
293
+ true,
294
+ );
295
+ },
296
+ },
297
+ ],
298
+ windowConfig: DEFAULT_LARGE_ALERT_WINDOW_CONFIG,
299
+ });
300
+ }
301
+
302
+ // NOTE: when drilldown occurs, we will scroll top until the drilldown row is reached
303
+ params.api.ensureIndexVisible(params.parentNode.rowIndex ?? 0, 'top');
304
+ }
305
+
246
306
  params.success({
247
307
  rowData,
248
- // Setting row count to disable inifite-scrolling when pagination is disabled
249
- // See https://www.ag-grid.com/javascript-data-grid/infinite-scrolling/#setting-last-row-index
308
+ // Setting row count to disable infinite-scrolling when pagination is disabled
309
+ // See https://www.ag-grid.com/react-data-grid/infinite-scrolling/#setting-last-row-index
250
310
  rowCount: rowData.length,
251
311
  });
252
- // Only update row count when loading the top-level drilldown data
312
+
313
+ // only update row count when loading the top-level drilldown data
253
314
  if (params.request.groupKeys.length === 0) {
254
315
  runInAction(() => {
255
316
  this.rowCount = rowData.length;
@@ -258,18 +319,17 @@ export class DataCubeGridClientServerSideDataSource
258
319
  }
259
320
  } catch (error) {
260
321
  assertErrorThrown(error);
261
- this.grid.dataCube.repl.notifyError(
262
- error,
263
- `Data fetch failure: ${error.message}`,
264
- error.stack,
265
- );
322
+ this.grid.dataCube.repl.alertError(error, {
323
+ message: `Data fetch failure: ${error.message}`,
324
+ text: error.stack,
325
+ });
266
326
  params.fail();
267
327
  } finally {
268
328
  this.grid.dataCube.endTask(task);
269
329
  }
270
330
  }
271
331
 
272
- getRows(params: IServerSideGetRowsParams<unknown, unknown>): void {
332
+ getRows(params: IServerSideGetRowsParams<unknown, unknown>) {
273
333
  this.fetchRows(params).catch((error: unknown) => {
274
334
  assertErrorThrown(error);
275
335
  this.grid.dataCube.application.logService.error(
@@ -89,11 +89,11 @@ export class DataCubeGridClientExportEngine {
89
89
  this.grid = grid;
90
90
  }
91
91
 
92
- private generateFileName(): string {
92
+ private generateFileName() {
93
93
  return `${this.dataCube.core.name} - ${formatDate(new Date(), 'EEE MMM dd yyyy HH_mm_ss')}`;
94
94
  }
95
95
 
96
- exportFile(format: DataCubeGridClientExportFormat): void {
96
+ exportFile(format: DataCubeGridClientExportFormat) {
97
97
  const fileName = this.generateFileName();
98
98
  switch (format) {
99
99
  case DataCubeGridClientExportFormat.CSV: {