@finos/legend-application-repl 0.0.30 → 0.0.32

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 (229) hide show
  1. package/lib/components/LegendREPLFrameworkProvider.js +1 -1
  2. package/lib/components/LegendREPLFrameworkProvider.js.map +1 -1
  3. package/lib/components/REPLStoreProvider.d.ts +1 -1
  4. package/lib/components/REPLStoreProvider.d.ts.map +1 -1
  5. package/lib/components/REPLStoreProvider.js +1 -1
  6. package/lib/components/REPLStoreProvider.js.map +1 -1
  7. package/lib/components/REPLWindow.d.ts +33 -0
  8. package/lib/components/REPLWindow.d.ts.map +1 -0
  9. package/lib/components/REPLWindow.js +117 -0
  10. package/lib/components/REPLWindow.js.map +1 -0
  11. package/lib/components/dataCube/DataCube.d.ts.map +1 -1
  12. package/lib/components/dataCube/DataCube.js +13 -9
  13. package/lib/components/dataCube/DataCube.js.map +1 -1
  14. package/lib/components/dataCube/editor/DataCubeEditor.d.ts.map +1 -1
  15. package/lib/components/dataCube/editor/DataCubeEditor.js +13 -90
  16. package/lib/components/dataCube/editor/DataCubeEditor.js.map +1 -1
  17. package/lib/components/dataCube/editor/DataCubeEditorCodePanel.d.ts.map +1 -1
  18. package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js +3 -2
  19. package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js.map +1 -1
  20. package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.d.ts.map +1 -1
  21. package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js +237 -6
  22. package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js.map +1 -1
  23. package/lib/components/dataCube/editor/DataCubeEditorColumnsPanel.js +2 -2
  24. package/lib/components/dataCube/editor/DataCubeEditorColumnsPanel.js.map +1 -1
  25. package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.d.ts +5 -0
  26. package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.d.ts.map +1 -1
  27. package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.js +130 -48
  28. package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.js.map +1 -1
  29. package/lib/{stores/dataCube/DataCubeDefaultConfig.d.ts → components/dataCube/editor/DataCubeEditorDeveloperPanel.d.ts} +4 -2
  30. package/lib/components/dataCube/editor/DataCubeEditorDeveloperPanel.d.ts.map +1 -0
  31. package/lib/components/dataCube/editor/DataCubeEditorDeveloperPanel.js +28 -0
  32. package/lib/components/dataCube/editor/DataCubeEditorDeveloperPanel.js.map +1 -0
  33. package/lib/components/dataCube/editor/DataCubeEditorExtendedColumnsPanel.d.ts.map +1 -1
  34. package/lib/components/dataCube/editor/DataCubeEditorExtendedColumnsPanel.js +3 -2
  35. package/lib/components/dataCube/editor/DataCubeEditorExtendedColumnsPanel.js.map +1 -1
  36. package/lib/components/dataCube/editor/DataCubeEditorFilterPanel.d.ts.map +1 -1
  37. package/lib/components/dataCube/editor/DataCubeEditorFilterPanel.js +3 -2
  38. package/lib/components/dataCube/editor/DataCubeEditorFilterPanel.js.map +1 -1
  39. package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.d.ts.map +1 -1
  40. package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.js +145 -5
  41. package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.js.map +1 -1
  42. package/lib/components/dataCube/editor/DataCubeEditorHPivotsPanel.d.ts.map +1 -1
  43. package/lib/components/dataCube/editor/DataCubeEditorHPivotsPanel.js +3 -2
  44. package/lib/components/dataCube/editor/DataCubeEditorHPivotsPanel.js.map +1 -1
  45. package/lib/components/dataCube/editor/DataCubeEditorShared.d.ts +47 -0
  46. package/lib/components/dataCube/editor/DataCubeEditorShared.d.ts.map +1 -0
  47. package/lib/components/dataCube/editor/DataCubeEditorShared.js +188 -0
  48. package/lib/components/dataCube/editor/DataCubeEditorShared.js.map +1 -0
  49. package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.d.ts.map +1 -1
  50. package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.js +36 -3
  51. package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.js.map +1 -1
  52. package/lib/components/dataCube/editor/DataCubeEditorVPivotsPanel.d.ts.map +1 -1
  53. package/lib/components/dataCube/editor/DataCubeEditorVPivotsPanel.js +3 -2
  54. package/lib/components/dataCube/editor/DataCubeEditorVPivotsPanel.js.map +1 -1
  55. package/lib/components/dataCube/grid/DataCubeGrid.d.ts +3 -0
  56. package/lib/components/dataCube/grid/DataCubeGrid.d.ts.map +1 -1
  57. package/lib/components/dataCube/grid/DataCubeGrid.js +190 -63
  58. package/lib/components/dataCube/grid/DataCubeGrid.js.map +1 -1
  59. package/lib/{stores/dataCube/DataCubeDefaultConfig.js → components/dataCube/grid/DataCubeGridShared.d.ts} +3 -2
  60. package/lib/components/dataCube/grid/DataCubeGridShared.d.ts.map +1 -0
  61. package/lib/components/dataCube/grid/DataCubeGridShared.js +25 -0
  62. package/lib/components/dataCube/grid/DataCubeGridShared.js.map +1 -0
  63. package/lib/components/dataCube/grid/menu/DataCubeGridMenu.d.ts +23 -0
  64. package/lib/components/dataCube/grid/menu/DataCubeGridMenu.d.ts.map +1 -0
  65. package/lib/components/dataCube/grid/menu/DataCubeGridMenu.js +413 -0
  66. package/lib/components/dataCube/grid/menu/DataCubeGridMenu.js.map +1 -0
  67. package/{src/stores/dataCube/DataCubeDefaultConfig.ts → lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.d.ts} +4 -2
  68. package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.d.ts.map +1 -0
  69. package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.js +83 -0
  70. package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.js.map +1 -0
  71. package/lib/index.css +2 -2
  72. package/lib/index.css.map +1 -1
  73. package/lib/package.json +14 -12
  74. package/lib/server/models/DataCubeQuery.d.ts +3 -5
  75. package/lib/server/models/DataCubeQuery.d.ts.map +1 -1
  76. package/lib/server/models/DataCubeQuery.js +0 -2
  77. package/lib/server/models/DataCubeQuery.js.map +1 -1
  78. package/lib/stores/{dataCube/REPLStore.d.ts → REPLStore.d.ts} +6 -4
  79. package/lib/stores/REPLStore.d.ts.map +1 -0
  80. package/lib/stores/{dataCube/REPLStore.js → REPLStore.js} +8 -5
  81. package/lib/stores/REPLStore.js.map +1 -0
  82. package/lib/stores/dataCube/{core/DataCubeEngine.d.ts → DataCubeInfrastructure.d.ts} +20 -4
  83. package/lib/stores/dataCube/DataCubeInfrastructure.d.ts.map +1 -0
  84. package/lib/stores/dataCube/{core/DataCubeEngine.js → DataCubeInfrastructure.js} +31 -3
  85. package/lib/stores/dataCube/DataCubeInfrastructure.js.map +1 -0
  86. package/lib/stores/dataCube/DataCubeState.d.ts +14 -5
  87. package/lib/stores/dataCube/DataCubeState.d.ts.map +1 -1
  88. package/lib/stores/dataCube/DataCubeState.js +37 -9
  89. package/lib/stores/dataCube/DataCubeState.js.map +1 -1
  90. package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts +93 -0
  91. package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts.map +1 -0
  92. package/lib/stores/dataCube/core/DataCubeConfiguration.js +167 -0
  93. package/lib/stores/dataCube/core/DataCubeConfiguration.js.map +1 -0
  94. package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.d.ts +25 -0
  95. package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.d.ts.map +1 -0
  96. package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.js +45 -0
  97. package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.js.map +1 -0
  98. package/lib/stores/dataCube/core/DataCubeCoreState.d.ts +1 -1
  99. package/lib/stores/dataCube/core/DataCubeCoreState.d.ts.map +1 -1
  100. package/lib/stores/dataCube/core/DataCubeCoreState.js +4 -4
  101. package/lib/stores/dataCube/core/DataCubeCoreState.js.map +1 -1
  102. package/lib/stores/dataCube/core/DataCubeQueryBuilder.js +12 -12
  103. package/lib/stores/dataCube/core/DataCubeQueryBuilder.js.map +1 -1
  104. package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts +99 -4
  105. package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts.map +1 -1
  106. package/lib/stores/dataCube/core/DataCubeQueryEngine.js +149 -3
  107. package/lib/stores/dataCube/core/DataCubeQueryEngine.js.map +1 -1
  108. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts +19 -5
  109. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts.map +1 -1
  110. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js +36 -6
  111. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js.map +1 -1
  112. package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.d.ts.map +1 -1
  113. package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js +42 -23
  114. package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js.map +1 -1
  115. package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.d.ts.map +1 -1
  116. package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.js +6 -2
  117. package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.js.map +1 -1
  118. package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.d.ts +1 -3
  119. package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.d.ts.map +1 -1
  120. package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.js +2 -3
  121. package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.js.map +1 -1
  122. package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.d.ts +3 -1
  123. package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.d.ts.map +1 -1
  124. package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.js +4 -2
  125. package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.js.map +1 -1
  126. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts +36 -0
  127. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts.map +1 -0
  128. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js +66 -0
  129. package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js.map +1 -0
  130. package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.d.ts +3 -0
  131. package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.d.ts.map +1 -1
  132. package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.js +10 -0
  133. package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.js.map +1 -1
  134. package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts +8 -3
  135. package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts.map +1 -1
  136. package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.js +20 -24
  137. package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.js.map +1 -1
  138. package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.d.ts +27 -0
  139. package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.d.ts.map +1 -0
  140. package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.js +30 -0
  141. package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.js.map +1 -0
  142. package/lib/stores/dataCube/editor/DataCubeEditorPanelState.d.ts +1 -1
  143. package/lib/stores/dataCube/editor/DataCubeEditorPanelState.d.ts.map +1 -1
  144. package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.d.ts +13 -6
  145. package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.d.ts.map +1 -1
  146. package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.js +64 -19
  147. package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.js.map +1 -1
  148. package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts +8 -4
  149. package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts.map +1 -1
  150. package/lib/stores/dataCube/editor/DataCubeEditorState.js +26 -17
  151. package/lib/stores/dataCube/editor/DataCubeEditorState.js.map +1 -1
  152. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts +100 -0
  153. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts.map +1 -0
  154. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js +450 -0
  155. package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js.map +1 -0
  156. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts +39 -2
  157. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts.map +1 -1
  158. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js +63 -3
  159. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js.map +1 -1
  160. package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.d.ts.map +1 -1
  161. package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js +0 -9
  162. package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js.map +1 -1
  163. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.d.ts +4 -1
  164. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.d.ts.map +1 -1
  165. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js +330 -38
  166. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js.map +1 -1
  167. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.d.ts.map +1 -1
  168. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js +16 -28
  169. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js.map +1 -1
  170. package/lib/stores/dataCube/grid/DataCubeGridState.d.ts +16 -2
  171. package/lib/stores/dataCube/grid/DataCubeGridState.d.ts.map +1 -1
  172. package/lib/stores/dataCube/grid/DataCubeGridState.js +51 -21
  173. package/lib/stores/dataCube/grid/DataCubeGridState.js.map +1 -1
  174. package/package.json +20 -18
  175. package/src/components/LegendREPLFrameworkProvider.tsx +1 -1
  176. package/src/components/REPLStoreProvider.tsx +1 -1
  177. package/src/components/REPLWindow.tsx +179 -0
  178. package/src/components/dataCube/DataCube.tsx +44 -23
  179. package/src/components/dataCube/editor/DataCubeEditor.tsx +80 -186
  180. package/src/components/dataCube/editor/DataCubeEditorCodePanel.tsx +4 -2
  181. package/src/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.tsx +1044 -13
  182. package/src/components/dataCube/editor/DataCubeEditorColumnsPanel.tsx +2 -2
  183. package/src/components/dataCube/editor/DataCubeEditorColumnsSelector.tsx +264 -51
  184. package/src/components/dataCube/editor/DataCubeEditorDeveloperPanel.tsx +43 -0
  185. package/src/components/dataCube/editor/DataCubeEditorExtendedColumnsPanel.tsx +4 -2
  186. package/src/components/dataCube/editor/DataCubeEditorFilterPanel.tsx +4 -2
  187. package/src/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.tsx +743 -13
  188. package/src/components/dataCube/editor/DataCubeEditorHPivotsPanel.tsx +4 -2
  189. package/src/components/dataCube/editor/DataCubeEditorShared.tsx +484 -0
  190. package/src/components/dataCube/editor/DataCubeEditorSortsPanel.tsx +103 -4
  191. package/src/components/dataCube/editor/DataCubeEditorVPivotsPanel.tsx +4 -2
  192. package/src/components/dataCube/grid/DataCubeGrid.tsx +314 -120
  193. package/src/components/dataCube/grid/DataCubeGridShared.tsx +45 -0
  194. package/src/components/dataCube/grid/menu/DataCubeGridMenu.tsx +441 -0
  195. package/src/components/dataCube/grid/menu/DataCubeGridSortsMenu.tsx +119 -0
  196. package/src/server/models/DataCubeQuery.ts +2 -6
  197. package/src/stores/{dataCube/REPLStore.ts → REPLStore.ts} +9 -6
  198. package/src/stores/dataCube/{core/DataCubeEngine.ts → DataCubeInfrastructure.ts} +40 -3
  199. package/src/stores/dataCube/DataCubeState.ts +44 -10
  200. package/src/stores/dataCube/core/DataCubeConfiguration.ts +220 -0
  201. package/src/stores/dataCube/core/DataCubeConfigurationBuilder.ts +60 -0
  202. package/src/stores/dataCube/core/DataCubeCoreState.ts +7 -4
  203. package/src/stores/dataCube/core/DataCubeQueryBuilder.ts +18 -18
  204. package/src/stores/dataCube/core/DataCubeQueryEngine.ts +157 -4
  205. package/src/stores/dataCube/core/DataCubeQuerySnapshot.ts +43 -6
  206. package/src/stores/dataCube/core/DataCubeQuerySnapshotBuilder.ts +49 -29
  207. package/src/stores/dataCube/core/DataCubeQuerySnapshotManager.ts +9 -2
  208. package/src/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.ts +6 -5
  209. package/src/stores/dataCube/editor/DataCubeEditorCodePanelState.ts +5 -2
  210. package/src/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.ts +96 -0
  211. package/src/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.ts +12 -0
  212. package/src/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.ts +31 -28
  213. package/src/stores/dataCube/editor/DataCubeEditorHPivotPanelState.ts +43 -0
  214. package/src/stores/dataCube/editor/DataCubeEditorPanelState.ts +1 -1
  215. package/src/stores/dataCube/editor/DataCubeEditorSortsPanelState.ts +92 -25
  216. package/src/stores/dataCube/editor/DataCubeEditorState.ts +32 -18
  217. package/src/stores/dataCube/editor/DataCubeMutableConfiguration.ts +641 -0
  218. package/src/stores/dataCube/grid/DataCubeGridClientEngine.ts +88 -3
  219. package/src/stores/dataCube/grid/DataCubeGridQueryBuilder.ts +0 -10
  220. package/src/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.tsx +494 -45
  221. package/src/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.ts +16 -36
  222. package/src/stores/dataCube/grid/DataCubeGridState.ts +73 -20
  223. package/tsconfig.json +13 -3
  224. package/lib/stores/dataCube/DataCubeDefaultConfig.d.ts.map +0 -1
  225. package/lib/stores/dataCube/DataCubeDefaultConfig.js.map +0 -1
  226. package/lib/stores/dataCube/REPLStore.d.ts.map +0 -1
  227. package/lib/stores/dataCube/REPLStore.js.map +0 -1
  228. package/lib/stores/dataCube/core/DataCubeEngine.d.ts.map +0 -1
  229. package/lib/stores/dataCube/core/DataCubeEngine.js.map +0 -1
@@ -19,16 +19,37 @@ import { LicenseManager } from '@ag-grid-enterprise/core';
19
19
  import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
20
20
  import { ServerSideRowModelModule } from '@ag-grid-enterprise/server-side-row-model';
21
21
  import { RowGroupingModule } from '@ag-grid-enterprise/row-grouping';
22
+ import { ClipboardModule } from '@ag-grid-enterprise/clipboard';
22
23
  import { MenuModule } from '@ag-grid-enterprise/menu';
23
24
  import { AgGridReact } from '@ag-grid-community/react';
24
- import { useEffect, useState } from 'react';
25
+ import { useEffect } from 'react';
25
26
  import { useREPLStore } from '../../REPLStoreProvider.js';
26
- import { DataCubeIcon, Switch, cn } from '@finos/legend-art';
27
+ import { DataCubeIcon, Switch, cn, Global, css } from '@finos/legend-art';
27
28
  import {
28
- INTERNAL__GRID_CLIENT_HEADER_HEIGHT,
29
- INTERNAL__GRID_CLIENT_ROW_BUFFER,
30
- INTERNAL__GRID_CLIENT_ROW_HEIGHT,
29
+ generateBackgroundColorUtilityClassName,
30
+ generateFontCaseUtilityClassName,
31
+ generateFontFamilyUtilityClassName,
32
+ generateFontSizeUtilityClassName,
33
+ generateFontUnderlineUtilityClassName,
34
+ generateTextAlignUtilityClassName,
35
+ generateTextColorUtilityClassName,
36
+ INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME,
31
37
  } from '../../../stores/dataCube/grid/DataCubeGridClientEngine.js';
38
+ import { RangeSelectionModule } from '@ag-grid-enterprise/range-selection';
39
+ import {
40
+ DataCubeFont,
41
+ DataCubeFontCase,
42
+ DataCubeFontFormatUnderlineVariant,
43
+ DataCubeFontTextAlignment,
44
+ DEFAULT_ROW_BACKGROUND_COLOR,
45
+ DEFAULT_ROW_HIGHLIGHT_BACKGROUND_COLOR,
46
+ } from '../../../stores/dataCube/core/DataCubeQueryEngine.js';
47
+ import { isNonNullable } from '@finos/legend-shared';
48
+ import type {
49
+ DataCubeConfiguration,
50
+ DataCubeConfigurationColorKey,
51
+ } from '../../../stores/dataCube/core/DataCubeConfiguration.js';
52
+ import { generateBaseGridOptions } from '../../../stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js';
32
53
 
33
54
  // NOTE: This is a workaround to prevent ag-grid license key check from flooding the console screen
34
55
  // with its stack trace in Chrome.
@@ -40,12 +61,292 @@ console.error = (message?: unknown, ...agrs: unknown[]): void => {
40
61
  console.log(`%c ${message}`, 'color: silver'); // eslint-disable-line no-console
41
62
  };
42
63
 
43
- export const DataCubeGrid = observer(() => {
64
+ function textColorStyle(
65
+ key: DataCubeConfigurationColorKey,
66
+ configuration: DataCubeConfiguration,
67
+ ) {
68
+ return `${Array.from(
69
+ new Set([
70
+ configuration[`${key}ForegroundColor`],
71
+ ...configuration.columns
72
+ .map((column) => column[`${key}ForegroundColor`])
73
+ .filter(isNonNullable),
74
+ ]).values(),
75
+ )
76
+ .map(
77
+ (color) =>
78
+ `.${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT} .${generateTextColorUtilityClassName(color, key)}{color:${color};}`,
79
+ )
80
+ .join('\n')}`;
81
+ }
82
+
83
+ function backgroundColorStyle(
84
+ key: DataCubeConfigurationColorKey,
85
+ configuration: DataCubeConfiguration,
86
+ ) {
87
+ return `${Array.from(
88
+ new Set([
89
+ configuration[`${key}BackgroundColor`],
90
+ ...configuration.columns
91
+ .map((column) => column[`${key}BackgroundColor`])
92
+ .filter(isNonNullable),
93
+ ]).values(),
94
+ )
95
+ .map(
96
+ (color) =>
97
+ `.${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT} .${generateBackgroundColorUtilityClassName(color, key)}{background-color:${color};}`,
98
+ )
99
+ .join('\n')};`;
100
+ }
101
+
102
+ export const DataCubeGridStyleController = observer(() => {
44
103
  const replStore = useREPLStore();
45
- const dataCubeState = replStore.dataCubeState;
46
- const grid = dataCubeState.grid;
104
+ const dataCube = replStore.dataCube;
105
+ const grid = dataCube.grid;
106
+ const configuration = grid.queryConfiguration;
47
107
 
48
- const [scrollHintText, setScrollHintText] = useState('');
108
+ return (
109
+ <Global
110
+ styles={css`
111
+ .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT} {
112
+ --ag-odd-row-background-color: ${grid.queryConfiguration
113
+ .alternateRowsStandardMode && !grid.queryConfiguration.alternateRows
114
+ ? DEFAULT_ROW_HIGHLIGHT_BACKGROUND_COLOR
115
+ : DEFAULT_ROW_BACKGROUND_COLOR};
116
+ --ag-cell-horizontal-border: ${grid.queryConfiguration
117
+ .showVerticalGridLines
118
+ ? `1px solid
119
+ ${grid.queryConfiguration.gridLineColor}`
120
+ : 'none'};
121
+ --ag-row-border-color: ${grid.queryConfiguration
122
+ .showHorizontalGridLines
123
+ ? grid.queryConfiguration.gridLineColor
124
+ : 'transparent'};
125
+ }
126
+ .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT}
127
+ .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.HIGHLIGHT_ROW} {
128
+ background-color: ${grid.queryConfiguration.alternateRows
129
+ ? grid.queryConfiguration.alternateRowsColor
130
+ : DEFAULT_ROW_BACKGROUND_COLOR};
131
+ }
132
+ ${[
133
+ DataCubeFont.ARIAL,
134
+ DataCubeFont.ROBOTO,
135
+ DataCubeFont.ROBOTO_CONDENSED,
136
+ ]
137
+ .map(
138
+ (fontFamily) =>
139
+ `.${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT} .${generateFontFamilyUtilityClassName(fontFamily)}{font-family:${fontFamily},sans-serif;}`,
140
+ )
141
+ .join('\n')}
142
+ ${[
143
+ DataCubeFont.GEORGIA,
144
+ DataCubeFont.ROBOTO_SERIF,
145
+ DataCubeFont.TIMES_NEW_ROMAN,
146
+ ]
147
+ .map(
148
+ (fontFamily) =>
149
+ `.${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT} .${generateFontFamilyUtilityClassName(fontFamily)}{font-family:${fontFamily},serif;}`,
150
+ )
151
+ .join('\n')}
152
+ ${[
153
+ DataCubeFont.JERBRAINS_MONO,
154
+ DataCubeFont.ROBOTO_MONO,
155
+ DataCubeFont.UBUNTU_MONO,
156
+ ]
157
+ .map(
158
+ (fontFamily) =>
159
+ `.${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT} .${generateFontFamilyUtilityClassName(fontFamily)}{font-family:${fontFamily},monospace;}`,
160
+ )
161
+ .join('\n')}
162
+ .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.FONT_BOLD} {
163
+ font-weight: 700;
164
+ }
165
+ ${[
166
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 32, 36,
167
+ 48, 72,
168
+ ]
169
+ .map(
170
+ (fontSize) =>
171
+ `.${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT} .${generateFontSizeUtilityClassName(fontSize)}{font-size:${fontSize}px;}`,
172
+ )
173
+ .join('\n')}
174
+ .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT}
175
+ .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.FONT_ITALIC} {
176
+ font-style: italic;
177
+ }
178
+ ${[
179
+ DataCubeFontFormatUnderlineVariant.SOLID,
180
+ DataCubeFontFormatUnderlineVariant.DASHED,
181
+ DataCubeFontFormatUnderlineVariant.DOTTED,
182
+ DataCubeFontFormatUnderlineVariant.DOUBLE,
183
+ DataCubeFontFormatUnderlineVariant.WAVY,
184
+ ]
185
+ .map(
186
+ (variant) =>
187
+ `.${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT} .${generateFontUnderlineUtilityClassName(variant)}{text-decoration:underline ${variant};}`,
188
+ )
189
+ .join('\n')}
190
+ .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT} .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.FONT_STRIKETHROUGH} {
191
+ text-decoration: line-through;
192
+ }
193
+ ${[
194
+ DataCubeFontCase.LOWERCASE,
195
+ DataCubeFontCase.UPPERCASE,
196
+ DataCubeFontCase.CAPITALIZE,
197
+ ]
198
+ .map(
199
+ (fontCase) =>
200
+ `.${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT} .${generateFontCaseUtilityClassName(fontCase)}{text-transform:${fontCase};}`,
201
+ )
202
+ .join('\n')}
203
+ ${[
204
+ DataCubeFontTextAlignment.LEFT,
205
+ DataCubeFontTextAlignment.CENTER,
206
+ DataCubeFontTextAlignment.RIGHT,
207
+ ]
208
+ .map(
209
+ (alignment) =>
210
+ `.${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT} .${generateTextAlignUtilityClassName(alignment)}{text-align:${alignment};}`,
211
+ )
212
+ .join('\n')};
213
+ ${backgroundColorStyle('normal', configuration)}
214
+ ${backgroundColorStyle('zero', configuration)}
215
+ ${backgroundColorStyle('negative', configuration)}
216
+ ${backgroundColorStyle('error', configuration)}
217
+ ${textColorStyle('normal', configuration)}
218
+ ${textColorStyle('zero', configuration)}
219
+ ${textColorStyle('negative', configuration)}
220
+ ${textColorStyle('error', configuration)}
221
+ .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT}
222
+ .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.BLUR} {
223
+ filter: blur(3px);
224
+ }
225
+ .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.ROOT}
226
+ .${INTERNAL__GRID_CLIENT_UTILITY_CSS_CLASS_NAME.BLUR}:hover {
227
+ filter: none;
228
+ }
229
+ `}
230
+ />
231
+ );
232
+ });
233
+
234
+ const DataCubeGridStatusBar = observer(() => {
235
+ const replStore = useREPLStore();
236
+ const dataCube = replStore.dataCube;
237
+ const grid = dataCube.grid;
238
+ const scrollHintText = grid.scrollHintText;
239
+
240
+ return (
241
+ <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
+ )}
248
+ <div />
249
+ <div className="flex h-full items-center">
250
+ <div className="flex h-full items-center px-2 font-mono text-sm text-neutral-500">
251
+ {grid.clientDataSource.rowCount
252
+ ? `Rows: ${grid.clientDataSource.rowCount}`
253
+ : ''}
254
+ </div>
255
+ {grid.datasourceConfiguration.limit !== undefined &&
256
+ grid.queryConfiguration.showWarningForTruncatedResult && (
257
+ // TODO: if we want to properly warn if the data has been truncated due to row limit,
258
+ // this would require us to fetch n+1 rows when limit=n
259
+ // This is feature is not difficult to implement, but it would be implemented most cleanly
260
+ // when we change the query execution engine to return the total number of rows,
261
+ // so for now, we simply just warn about truncation whenever a limit != -1 is specified
262
+ <>
263
+ <div className="h-3 w-[1px] bg-neutral-200" />
264
+ <div className="flex h-full items-center px-2 text-orange-500">
265
+ <DataCubeIcon.Warning className="stroke-[3px]" />
266
+ <div className="ml-1 text-sm font-semibold">{`Results truncated to fit within row limit (${grid.datasourceConfiguration.limit})`}</div>
267
+ </div>
268
+ </>
269
+ )}
270
+ <div className="h-3 w-[1px] bg-neutral-200" />
271
+ <button
272
+ className="flex h-full items-center p-2"
273
+ onClick={(): void =>
274
+ grid.setPaginationEnabled(!grid.isPaginationEnabled)
275
+ }
276
+ >
277
+ <Switch
278
+ checked={grid.isPaginationEnabled}
279
+ classes={{
280
+ root: 'p-0 w-6 h-5 flex items-center',
281
+ input: 'w-2',
282
+ checked: '!translate-x-2 ease-in-out duration-100 transition',
283
+ thumb: cn('w-2 h-2', {
284
+ 'bg-sky-600': grid.isPaginationEnabled,
285
+ 'bg-neutral-500': !grid.isPaginationEnabled,
286
+ }),
287
+ switchBase:
288
+ 'p-0.5 mt-1 translate-x-0 ease-in-out duration-100 transition',
289
+ track: cn('h-3 w-5 border', {
290
+ '!bg-sky-100 border-sky-600': grid.isPaginationEnabled,
291
+ '!bg-neutral-100 border-neutral-500': !grid.isPaginationEnabled,
292
+ }),
293
+ }}
294
+ disableRipple={true}
295
+ disableFocusRipple={true}
296
+ />
297
+ <div
298
+ className={cn('text-sm', {
299
+ 'text-sky-600': grid.isPaginationEnabled,
300
+ 'text-neutral-500': !grid.isPaginationEnabled,
301
+ })}
302
+ >
303
+ Pagination
304
+ </div>
305
+ </button>
306
+ </div>
307
+ </div>
308
+ );
309
+ });
310
+
311
+ const DataCubeGridClient = observer(() => {
312
+ const replStore = useREPLStore();
313
+ const dataCube = replStore.dataCube;
314
+ const grid = dataCube.grid;
315
+
316
+ return (
317
+ <div className="relative h-[calc(100%_-_20px)] w-full">
318
+ <AgGridReact
319
+ className="data-cube-grid ag-theme-balham"
320
+ rowModelType="serverSide"
321
+ serverSideDatasource={grid.clientDataSource}
322
+ context={{
323
+ dataCube,
324
+ }}
325
+ onGridReady={(params): void => {
326
+ grid.configureClient(params.api);
327
+ // restore original error logging
328
+ console.error = __INTERNAL__original_console_error; // eslint-disable-line no-console
329
+ }}
330
+ modules={[
331
+ // community
332
+ ClientSideRowModelModule,
333
+ // enterprise
334
+ ServerSideRowModelModule,
335
+ RowGroupingModule,
336
+ MenuModule,
337
+ ClipboardModule,
338
+ RangeSelectionModule,
339
+ ]}
340
+ {...generateBaseGridOptions(dataCube)}
341
+ />
342
+ </div>
343
+ );
344
+ });
345
+
346
+ export const DataCubeGrid = observer(() => {
347
+ const replStore = useREPLStore();
348
+ const dataCube = replStore.dataCube;
349
+ const grid = dataCube.grid;
49
350
 
50
351
  useEffect(() => {
51
352
  if (grid.clientLicenseKey) {
@@ -54,117 +355,10 @@ export const DataCubeGrid = observer(() => {
54
355
  }, [grid.clientLicenseKey]);
55
356
 
56
357
  return (
57
- <div className="data-cube-grid flex-1">
58
- <div className="h-[calc(100%_-_20px)] w-full">
59
- <AgGridReact
60
- className="ag-theme-balham"
61
- modules={[
62
- // community
63
- ClientSideRowModelModule,
64
- // enterprise
65
- ServerSideRowModelModule,
66
- RowGroupingModule,
67
- MenuModule,
68
- ]}
69
- onGridReady={(params): void => {
70
- grid.configureClient(params.api);
71
- // restore original error logging
72
- console.error = __INTERNAL__original_console_error; // eslint-disable-line no-console
73
- }}
74
- // -------------------------------------- ROW GROUPING --------------------------------------
75
- rowGroupPanelShow="always"
76
- suppressScrollOnNewData={true}
77
- groupDisplayType="custom" // keeps the column set stable even when row grouping is used
78
- suppressRowGroupHidesColumns={true} // keeps the column set stable even when row grouping is used
79
- // -------------------------------------- PIVOT --------------------------------------
80
- // pivotPanelShow="always"
81
- // pivotMode={true}
82
- // -------------------------------------- SERVER SIDE ROW MODEL --------------------------------------
83
- rowModelType="serverSide"
84
- serverSideDatasource={grid.clientDataSource}
85
- // -------------------------------------- GENERIC --------------------------------------
86
- suppressBrowserResizeObserver={true}
87
- animateRows={false} // improve performance
88
- // NOTE: since we shrink the spacing, more rows can be shown, as such, setting higher row
89
- // buffer will improve scrolling performance, but compromise initial load and various
90
- // actions performance
91
- rowBuffer={INTERNAL__GRID_CLIENT_ROW_BUFFER}
92
- rowHeight={INTERNAL__GRID_CLIENT_ROW_HEIGHT}
93
- headerHeight={INTERNAL__GRID_CLIENT_HEADER_HEIGHT}
94
- // Force multi-sorting since this is what the query supports anyway
95
- alwaysMultiSort={true}
96
- // Keeps the columns stable even when aggregation is used
97
- suppressAggFuncInHeader={true}
98
- // Show cursor position when scrolling
99
- onBodyScroll={(event) => {
100
- const rowCount = event.api.getDisplayedRowCount();
101
- const range = event.api.getVerticalPixelRange();
102
- const start = Math.max(
103
- 1,
104
- Math.ceil(range.top / INTERNAL__GRID_CLIENT_ROW_HEIGHT) + 1,
105
- );
106
- const end = Math.min(
107
- rowCount,
108
- Math.floor(range.bottom / INTERNAL__GRID_CLIENT_ROW_HEIGHT),
109
- );
110
- setScrollHintText(`${start}-${end}/${rowCount}`);
111
- }}
112
- onBodyScrollEnd={() => setScrollHintText('')}
113
- />
114
- </div>
115
- <div className="relative flex h-5 w-full justify-between border-b border-b-neutral-200 bg-neutral-100">
116
- {Boolean(scrollHintText) && (
117
- <div className="absolute -top-8 right-4 flex items-center rounded-sm border border-neutral-300 bg-neutral-100 p-1 pr-2 text-neutral-500 shadow-sm">
118
- <DataCubeIcon.TableScroll className="text-lg" />
119
- <div className="ml-1 font-mono text-sm">{scrollHintText}</div>
120
- </div>
121
- )}
122
- <div />
123
- <div className="flex items-center">
124
- <div className="select-none p-2 font-mono text-sm text-neutral-500">
125
- {grid.clientDataSource.rowCount
126
- ? `(${grid.clientDataSource.rowCount} rows)`
127
- : ''}
128
- </div>
129
- <div className="h-3 w-[1px] bg-neutral-200" />
130
- <button
131
- className="flex h-full items-center p-2"
132
- onClick={(): void =>
133
- grid.setPaginationEnabled(!grid.isPaginationEnabled)
134
- }
135
- >
136
- <Switch
137
- checked={grid.isPaginationEnabled}
138
- classes={{
139
- root: 'p-0 w-6 h-5 flex items-center',
140
- input: 'w-2',
141
- checked: '!translate-x-2 ease-in-out duration-100 transition',
142
- thumb: cn('w-2 h-2', {
143
- 'bg-sky-600': grid.isPaginationEnabled,
144
- 'bg-neutral-500': !grid.isPaginationEnabled,
145
- }),
146
- switchBase:
147
- 'p-0.5 mt-1 translate-x-0 ease-in-out duration-100 transition',
148
- track: cn('h-3 w-5 border', {
149
- '!bg-sky-100 border-sky-600': grid.isPaginationEnabled,
150
- '!bg-neutral-100 border-neutral-500':
151
- !grid.isPaginationEnabled,
152
- }),
153
- }}
154
- disableRipple={true}
155
- disableFocusRipple={true}
156
- />
157
- <div
158
- className={cn('text-sm', {
159
- 'text-sky-600': grid.isPaginationEnabled,
160
- 'text-neutral-500': !grid.isPaginationEnabled,
161
- })}
162
- >
163
- Pagination
164
- </div>
165
- </button>
166
- </div>
167
- </div>
358
+ <div className="flex-1">
359
+ <DataCubeGridStyleController />
360
+ <DataCubeGridClient />
361
+ <DataCubeGridStatusBar />
168
362
  </div>
169
363
  );
170
364
  });
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import {
18
+ useGridMenuItem,
19
+ type CustomMenuItemProps,
20
+ } from '@ag-grid-community/react';
21
+ import { WIP_Badge } from '../editor/DataCubeEditorShared.js';
22
+
23
+ export function WIP_GridMenuItem({
24
+ name,
25
+ subMenu,
26
+ checked,
27
+ }: CustomMenuItemProps) {
28
+ useGridMenuItem({
29
+ configureDefaults: () => true,
30
+ });
31
+
32
+ return (
33
+ <div>
34
+ <span className="ag-menu-option-part ag-menu-option-icon"></span>
35
+ <span className="ag-menu-option-part ag-menu-option-text !inline-flex items-center">
36
+ <span className="opacity-50">{name}</span>
37
+ <WIP_Badge />
38
+ </span>
39
+ <span className="ag-menu-option-part ag-menu-option-shortcut"></span>
40
+ <span className="ag-menu-option-part ag-menu-option-popup-pointer select-none">
41
+ {subMenu && <span className="ag-icon ag-icon-small-right"></span>}
42
+ </span>
43
+ </div>
44
+ );
45
+ }