@finos/legend-application-repl 0.0.21 → 0.0.23

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 (291) hide show
  1. package/lib/{stores/CompletionResult.d.ts → __lib__/LegendREPLEvent.d.ts} +4 -6
  2. package/lib/__lib__/LegendREPLEvent.d.ts.map +1 -0
  3. package/lib/__lib__/LegendREPLEvent.js +21 -0
  4. package/lib/__lib__/LegendREPLEvent.js.map +1 -0
  5. package/lib/{stores/dataCube/DataCubePanelState.js → __lib__/LegendREPLSetting.d.ts} +3 -6
  6. package/lib/__lib__/LegendREPLSetting.d.ts.map +1 -0
  7. package/lib/{components/grid/TDSLambdaBuilder.d.ts → __lib__/LegendREPLSetting.js} +5 -4
  8. package/lib/__lib__/LegendREPLSetting.js.map +1 -0
  9. package/lib/application/{LegendREPLGridClient.d.ts → LegendREPL.d.ts} +10 -10
  10. package/lib/application/LegendREPL.d.ts.map +1 -0
  11. package/lib/application/{LegendREPLGridClient.js → LegendREPL.js} +10 -15
  12. package/lib/application/LegendREPL.js.map +1 -0
  13. package/lib/application/{LegendREPLGridClientApplicationConfig.d.ts → LegendREPLApplicationConfig.d.ts} +4 -4
  14. package/lib/application/LegendREPLApplicationConfig.d.ts.map +1 -0
  15. package/lib/application/{LegendREPLGridClientApplicationConfig.js → LegendREPLApplicationConfig.js} +2 -2
  16. package/lib/application/LegendREPLApplicationConfig.js.map +1 -0
  17. package/lib/application/{LegendREPLGridClientPluginManager.d.ts → LegendREPLPluginManager.d.ts} +4 -4
  18. package/lib/application/LegendREPLPluginManager.d.ts.map +1 -0
  19. package/lib/application/{LegendREPLGridClientPluginManager.js → LegendREPLPluginManager.js} +3 -3
  20. package/lib/application/LegendREPLPluginManager.js.map +1 -0
  21. package/lib/components/{Core_LegendREPLGridClientApplicationPlugin.d.ts → Core_LegendREPLApplicationPlugin.d.ts} +3 -3
  22. package/lib/components/Core_LegendREPLApplicationPlugin.d.ts.map +1 -0
  23. package/lib/components/{Core_LegendREPLGridClientApplicationPlugin.js → Core_LegendREPLApplicationPlugin.js} +12 -7
  24. package/lib/components/Core_LegendREPLApplicationPlugin.js.map +1 -0
  25. package/lib/components/{AgGrid.d.ts → LegendREPLApplication.d.ts} +8 -6
  26. package/lib/components/LegendREPLApplication.d.ts.map +1 -0
  27. package/lib/components/LegendREPLApplication.js +32 -0
  28. package/lib/components/LegendREPLApplication.js.map +1 -0
  29. package/lib/components/{LegendREPLGridClientFrameworkProvider.d.ts → LegendREPLFrameworkProvider.d.ts} +4 -4
  30. package/lib/components/LegendREPLFrameworkProvider.d.ts.map +1 -0
  31. package/lib/components/{LegendREPLGridClientFrameworkProvider.js → LegendREPLFrameworkProvider.js} +9 -9
  32. package/lib/components/LegendREPLFrameworkProvider.js.map +1 -0
  33. package/lib/components/{REPLGridClientStoreProvider.d.ts → REPLStoreProvider.d.ts} +5 -5
  34. package/lib/components/REPLStoreProvider.d.ts.map +1 -0
  35. package/lib/components/{REPLGridClientStoreProvider.js → REPLStoreProvider.js} +9 -9
  36. package/lib/components/REPLStoreProvider.js.map +1 -0
  37. package/lib/components/dataCube/DataCube.d.ts +19 -0
  38. package/lib/components/dataCube/DataCube.d.ts.map +1 -0
  39. package/lib/components/dataCube/DataCube.js +33 -0
  40. package/lib/components/dataCube/DataCube.js.map +1 -0
  41. package/lib/components/{REPLGridClient.d.ts → dataCube/editor/DataCubeEditor.d.ts} +5 -9
  42. package/lib/components/dataCube/editor/DataCubeEditor.d.ts.map +1 -0
  43. package/lib/components/dataCube/editor/DataCubeEditor.js +54 -0
  44. package/lib/components/dataCube/editor/DataCubeEditor.js.map +1 -0
  45. package/lib/components/dataCube/editor/DataCubeEditorCodePanel.d.ts +19 -0
  46. package/lib/components/dataCube/editor/DataCubeEditorCodePanel.d.ts.map +1 -0
  47. package/lib/components/dataCube/{DataCubeQueryTextEditor.js → editor/DataCubeEditorCodePanel.js} +20 -20
  48. package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js.map +1 -0
  49. package/lib/components/dataCube/{DataCubeGridEditor.d.ts → editor/DataCubeEditorSortPanel.d.ts} +4 -4
  50. package/lib/components/dataCube/editor/DataCubeEditorSortPanel.d.ts.map +1 -0
  51. package/lib/components/dataCube/editor/DataCubeEditorSortPanel.js +61 -0
  52. package/lib/components/dataCube/editor/DataCubeEditorSortPanel.js.map +1 -0
  53. package/lib/components/dataCube/{DataCubeQueryTextEditor.d.ts → grid/DataCubeGrid.d.ts} +4 -4
  54. package/lib/components/dataCube/grid/DataCubeGrid.d.ts.map +1 -0
  55. package/lib/components/dataCube/grid/DataCubeGrid.js +59 -0
  56. package/lib/components/dataCube/grid/DataCubeGrid.js.map +1 -0
  57. package/lib/grid.css +1 -1
  58. package/lib/index.css +2 -2
  59. package/lib/index.css.map +1 -1
  60. package/lib/index.d.ts +1 -1
  61. package/lib/index.d.ts.map +1 -1
  62. package/lib/index.js +8 -8
  63. package/lib/index.js.map +1 -1
  64. package/lib/package.json +3 -3
  65. package/lib/repl.css +1 -1
  66. package/lib/server/REPLServerClient.d.ts +11 -13
  67. package/lib/server/REPLServerClient.d.ts.map +1 -1
  68. package/lib/server/REPLServerClient.js +27 -15
  69. package/lib/server/REPLServerClient.js.map +1 -1
  70. package/lib/server/models/DataCubeEngineModels.d.ts +50 -0
  71. package/lib/server/models/DataCubeEngineModels.d.ts.map +1 -0
  72. package/lib/server/models/DataCubeEngineModels.js +39 -0
  73. package/lib/server/models/DataCubeEngineModels.js.map +1 -0
  74. package/lib/server/models/DataCubeQuery.d.ts +41 -0
  75. package/lib/server/models/DataCubeQuery.d.ts.map +1 -0
  76. package/lib/server/models/DataCubeQuery.js +78 -0
  77. package/lib/server/models/DataCubeQuery.js.map +1 -0
  78. package/lib/stores/{LegendREPLGridClientApplicationPlugin.d.ts → LegendREPLApplicationPlugin.d.ts} +4 -4
  79. package/lib/stores/LegendREPLApplicationPlugin.d.ts.map +1 -0
  80. package/lib/stores/{LegendREPLGridClientApplicationPlugin.js → LegendREPLApplicationPlugin.js} +2 -2
  81. package/lib/stores/LegendREPLApplicationPlugin.js.map +1 -0
  82. package/lib/stores/LegendREPLBaseStore.d.ts +25 -0
  83. package/lib/stores/LegendREPLBaseStore.d.ts.map +1 -0
  84. package/lib/stores/{LegendREPLGridClientBaseStore.js → LegendREPLBaseStore.js} +2 -2
  85. package/lib/stores/LegendREPLBaseStore.js.map +1 -0
  86. package/lib/stores/dataCube/DataCubeMetaModelConst.d.ts +49 -0
  87. package/lib/stores/dataCube/DataCubeMetaModelConst.d.ts.map +1 -0
  88. package/lib/stores/dataCube/DataCubeMetaModelConst.js +57 -0
  89. package/lib/stores/dataCube/DataCubeMetaModelConst.js.map +1 -0
  90. package/lib/stores/dataCube/DataCubeState.d.ts +18 -23
  91. package/lib/stores/dataCube/DataCubeState.d.ts.map +1 -1
  92. package/lib/stores/dataCube/DataCubeState.js +31 -181
  93. package/lib/stores/dataCube/DataCubeState.js.map +1 -1
  94. package/lib/stores/{REPLGridClientStore.d.ts → dataCube/DataCubeStore.d.ts} +7 -7
  95. package/lib/stores/dataCube/DataCubeStore.d.ts.map +1 -0
  96. package/lib/stores/{REPLGridClientStore.js → dataCube/DataCubeStore.js} +5 -4
  97. package/lib/stores/dataCube/DataCubeStore.js.map +1 -0
  98. package/lib/stores/dataCube/core/DataCubeEngine.d.ts +29 -0
  99. package/lib/stores/dataCube/core/DataCubeEngine.d.ts.map +1 -0
  100. package/lib/stores/dataCube/core/DataCubeEngine.js +47 -0
  101. package/lib/stores/dataCube/core/DataCubeEngine.js.map +1 -0
  102. package/lib/stores/dataCube/core/DataCubeQueryAnalyzer.d.ts +37 -0
  103. package/lib/stores/dataCube/core/DataCubeQueryAnalyzer.d.ts.map +1 -0
  104. package/lib/stores/dataCube/core/DataCubeQueryAnalyzer.js +269 -0
  105. package/lib/stores/dataCube/core/DataCubeQueryAnalyzer.js.map +1 -0
  106. package/lib/stores/dataCube/core/DataCubeQueryBuilder.d.ts +19 -0
  107. package/lib/stores/dataCube/core/DataCubeQueryBuilder.d.ts.map +1 -0
  108. package/lib/stores/dataCube/core/DataCubeQueryBuilder.js +98 -0
  109. package/lib/stores/dataCube/core/DataCubeQueryBuilder.js.map +1 -0
  110. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts +73 -0
  111. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts.map +1 -0
  112. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js +56 -0
  113. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js.map +1 -0
  114. package/lib/stores/dataCube/{DataCubePanelState.d.ts → core/DataCubeQuerySnapshotManager.d.ts} +11 -6
  115. package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.d.ts.map +1 -0
  116. package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.js +46 -0
  117. package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.js.map +1 -0
  118. package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.d.ts +27 -0
  119. package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.d.ts.map +1 -0
  120. package/lib/{components/grid/REPLGridServerResult.js → stores/dataCube/core/DataCubeQuerySnapshotSubscriber.js} +18 -10
  121. package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.js.map +1 -0
  122. package/lib/stores/dataCube/{DataCubeQueryEditorState.d.ts → editor/DataCubeEditorCodeState.d.ts} +12 -2
  123. package/lib/stores/dataCube/editor/DataCubeEditorCodeState.d.ts.map +1 -0
  124. package/lib/stores/dataCube/editor/DataCubeEditorCodeState.js +87 -0
  125. package/lib/stores/dataCube/editor/DataCubeEditorCodeState.js.map +1 -0
  126. package/lib/stores/dataCube/editor/DataCubeEditorQuerySnapshotBuilder.d.ts +28 -0
  127. package/lib/stores/dataCube/editor/DataCubeEditorQuerySnapshotBuilder.d.ts.map +1 -0
  128. package/lib/stores/dataCube/editor/DataCubeEditorQuerySnapshotBuilder.js +17 -0
  129. package/lib/stores/dataCube/editor/DataCubeEditorQuerySnapshotBuilder.js.map +1 -0
  130. package/lib/stores/dataCube/editor/DataCubeEditorSortState.d.ts +46 -0
  131. package/lib/stores/dataCube/editor/DataCubeEditorSortState.d.ts.map +1 -0
  132. package/lib/stores/dataCube/editor/DataCubeEditorSortState.js +133 -0
  133. package/lib/stores/dataCube/editor/DataCubeEditorSortState.js.map +1 -0
  134. package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts +44 -0
  135. package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts.map +1 -0
  136. package/lib/stores/dataCube/editor/DataCubeEditorState.js +77 -0
  137. package/lib/stores/dataCube/editor/DataCubeEditorState.js.map +1 -0
  138. package/lib/{components/grid/ServerSideDataSource.d.ts → stores/dataCube/grid/DataCubeGridClientEngine.d.ts} +17 -14
  139. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts.map +1 -0
  140. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js +96 -0
  141. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js.map +1 -0
  142. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.d.ts +19 -0
  143. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.d.ts.map +1 -0
  144. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js +224 -0
  145. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js.map +1 -0
  146. package/lib/stores/dataCube/grid/DataCubeGridState.d.ts +33 -0
  147. package/lib/stores/dataCube/grid/DataCubeGridState.d.ts.map +1 -0
  148. package/lib/stores/dataCube/grid/DataCubeGridState.js +50 -0
  149. package/lib/stores/dataCube/grid/DataCubeGridState.js.map +1 -0
  150. package/package.json +9 -9
  151. package/src/{Const.ts → __lib__/LegendREPLEvent.ts} +1 -16
  152. package/{lib/components/grid/REPLGridServerResult.d.ts → src/__lib__/LegendREPLSetting.ts} +3 -6
  153. package/src/application/LegendREPL.tsx +64 -0
  154. package/src/application/{LegendREPLGridClientApplicationConfig.ts → LegendREPLApplicationConfig.ts} +3 -3
  155. package/src/application/{LegendREPLGridClientPluginManager.ts → LegendREPLPluginManager.ts} +5 -5
  156. package/src/components/{Core_LegendREPLGridClientApplicationPlugin.tsx → Core_LegendREPLApplicationPlugin.tsx} +11 -6
  157. package/src/components/{LegendREPLGridClientApplication.tsx → LegendREPLApplication.tsx} +11 -28
  158. package/src/components/LegendREPLFrameworkProvider.tsx +57 -0
  159. package/src/components/{REPLGridClientStoreProvider.tsx → REPLStoreProvider.tsx} +17 -21
  160. package/src/components/dataCube/DataCube.tsx +63 -0
  161. package/src/components/dataCube/editor/DataCubeEditor.tsx +127 -0
  162. package/src/components/dataCube/{DataCubeQueryTextEditor.tsx → editor/DataCubeEditorCodePanel.tsx} +69 -76
  163. package/src/components/dataCube/editor/DataCubeEditorSortPanel.tsx +274 -0
  164. package/src/components/dataCube/grid/DataCubeGrid.tsx +77 -0
  165. package/src/index.tsx +12 -8
  166. package/src/server/REPLServerClient.ts +50 -78
  167. package/src/server/models/DataCubeEngineModels.ts +84 -0
  168. package/src/server/models/DataCubeQuery.ts +130 -0
  169. package/src/stores/{LegendREPLGridClientApplicationPlugin.ts → LegendREPLApplicationPlugin.ts} +4 -4
  170. package/src/stores/{LegendREPLGridClientBaseStore.ts → LegendREPLBaseStore.ts} +9 -9
  171. package/src/stores/dataCube/DataCubeMetaModelConst.ts +61 -0
  172. package/src/stores/dataCube/DataCubeState.ts +39 -303
  173. package/src/stores/{REPLGridClientStore.ts → dataCube/DataCubeStore.ts} +8 -6
  174. package/src/stores/dataCube/core/DataCubeEngine.ts +79 -0
  175. package/src/stores/dataCube/core/DataCubeQueryAnalyzer.ts +424 -0
  176. package/src/stores/dataCube/core/DataCubeQueryBuilder.ts +151 -0
  177. package/src/stores/dataCube/core/DataCubeQuerySnapshot.ts +201 -0
  178. package/src/stores/dataCube/core/DataCubeQuerySnapshotManager.ts +67 -0
  179. package/src/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.ts +43 -0
  180. package/src/stores/dataCube/editor/DataCubeEditorCodeState.ts +166 -0
  181. package/src/{components/grid/REPLGridServerResult.ts → stores/dataCube/editor/DataCubeEditorQuerySnapshotBuilder.ts} +14 -11
  182. package/src/stores/dataCube/editor/DataCubeEditorSortState.ts +198 -0
  183. package/src/stores/dataCube/editor/DataCubeEditorState.ts +94 -0
  184. package/src/stores/dataCube/grid/DataCubeGridClientEngine.ts +152 -0
  185. package/src/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.ts +245 -0
  186. package/src/stores/dataCube/grid/DataCubeGridState.ts +62 -0
  187. package/tsconfig.json +33 -29
  188. package/lib/Const.d.ts +0 -32
  189. package/lib/Const.d.ts.map +0 -1
  190. package/lib/Const.js +0 -35
  191. package/lib/Const.js.map +0 -1
  192. package/lib/application/LegendREPLGridClient.d.ts.map +0 -1
  193. package/lib/application/LegendREPLGridClient.js.map +0 -1
  194. package/lib/application/LegendREPLGridClientApplicationConfig.d.ts.map +0 -1
  195. package/lib/application/LegendREPLGridClientApplicationConfig.js.map +0 -1
  196. package/lib/application/LegendREPLGridClientPluginManager.d.ts.map +0 -1
  197. package/lib/application/LegendREPLGridClientPluginManager.js.map +0 -1
  198. package/lib/components/AgGrid.d.ts.map +0 -1
  199. package/lib/components/AgGrid.js +0 -41
  200. package/lib/components/AgGrid.js.map +0 -1
  201. package/lib/components/Core_LegendREPLGridClientApplicationPlugin.d.ts.map +0 -1
  202. package/lib/components/Core_LegendREPLGridClientApplicationPlugin.js.map +0 -1
  203. package/lib/components/LegendREPLGridClientApplication.d.ts +0 -31
  204. package/lib/components/LegendREPLGridClientApplication.d.ts.map +0 -1
  205. package/lib/components/LegendREPLGridClientApplication.js +0 -39
  206. package/lib/components/LegendREPLGridClientApplication.js.map +0 -1
  207. package/lib/components/LegendREPLGridClientFrameworkProvider.d.ts.map +0 -1
  208. package/lib/components/LegendREPLGridClientFrameworkProvider.js.map +0 -1
  209. package/lib/components/REPLGridClient.d.ts.map +0 -1
  210. package/lib/components/REPLGridClient.js +0 -143
  211. package/lib/components/REPLGridClient.js.map +0 -1
  212. package/lib/components/REPLGridClientStoreProvider.d.ts.map +0 -1
  213. package/lib/components/REPLGridClientStoreProvider.js.map +0 -1
  214. package/lib/components/dataCube/DataCubeGridEditor.d.ts.map +0 -1
  215. package/lib/components/dataCube/DataCubeGridEditor.js +0 -37
  216. package/lib/components/dataCube/DataCubeGridEditor.js.map +0 -1
  217. package/lib/components/dataCube/DataCubeQueryTextEditor.d.ts.map +0 -1
  218. package/lib/components/dataCube/DataCubeQueryTextEditor.js.map +0 -1
  219. package/lib/components/grid/GridUtils.d.ts +0 -31
  220. package/lib/components/grid/GridUtils.d.ts.map +0 -1
  221. package/lib/components/grid/GridUtils.js +0 -174
  222. package/lib/components/grid/GridUtils.js.map +0 -1
  223. package/lib/components/grid/REPLGridServerResult.d.ts.map +0 -1
  224. package/lib/components/grid/REPLGridServerResult.js.map +0 -1
  225. package/lib/components/grid/ServerSideDataSource.d.ts.map +0 -1
  226. package/lib/components/grid/ServerSideDataSource.js +0 -109
  227. package/lib/components/grid/ServerSideDataSource.js.map +0 -1
  228. package/lib/components/grid/TDSLambdaBuilder.d.ts.map +0 -1
  229. package/lib/components/grid/TDSLambdaBuilder.js +0 -314
  230. package/lib/components/grid/TDSLambdaBuilder.js.map +0 -1
  231. package/lib/components/grid/TDSQuery.d.ts +0 -25
  232. package/lib/components/grid/TDSQuery.d.ts.map +0 -1
  233. package/lib/components/grid/TDSQuery.js +0 -32
  234. package/lib/components/grid/TDSQuery.js.map +0 -1
  235. package/lib/components/grid/TDSRequest.d.ts +0 -103
  236. package/lib/components/grid/TDSRequest.d.ts.map +0 -1
  237. package/lib/components/grid/TDSRequest.js +0 -172
  238. package/lib/components/grid/TDSRequest.js.map +0 -1
  239. package/lib/stores/CompletionResult.d.ts.map +0 -1
  240. package/lib/stores/CompletionResult.js +0 -26
  241. package/lib/stores/CompletionResult.js.map +0 -1
  242. package/lib/stores/LegendREPLGridClientApplicationPlugin.d.ts.map +0 -1
  243. package/lib/stores/LegendREPLGridClientApplicationPlugin.js.map +0 -1
  244. package/lib/stores/LegendREPLGridClientBaseStore.d.ts +0 -25
  245. package/lib/stores/LegendREPLGridClientBaseStore.d.ts.map +0 -1
  246. package/lib/stores/LegendREPLGridClientBaseStore.js.map +0 -1
  247. package/lib/stores/REPLGridClientStore.d.ts.map +0 -1
  248. package/lib/stores/REPLGridClientStore.js.map +0 -1
  249. package/lib/stores/dataCube/DataCubeConfigState.d.ts +0 -32
  250. package/lib/stores/dataCube/DataCubeConfigState.d.ts.map +0 -1
  251. package/lib/stores/dataCube/DataCubeConfigState.js +0 -62
  252. package/lib/stores/dataCube/DataCubeConfigState.js.map +0 -1
  253. package/lib/stores/dataCube/DataCubeGridState.d.ts +0 -39
  254. package/lib/stores/dataCube/DataCubeGridState.d.ts.map +0 -1
  255. package/lib/stores/dataCube/DataCubeGridState.js +0 -108
  256. package/lib/stores/dataCube/DataCubeGridState.js.map +0 -1
  257. package/lib/stores/dataCube/DataCubePanelState.d.ts.map +0 -1
  258. package/lib/stores/dataCube/DataCubePanelState.js.map +0 -1
  259. package/lib/stores/dataCube/DataCubePropertiesPanelState.d.ts +0 -34
  260. package/lib/stores/dataCube/DataCubePropertiesPanelState.d.ts.map +0 -1
  261. package/lib/stores/dataCube/DataCubePropertiesPanelState.js +0 -57
  262. package/lib/stores/dataCube/DataCubePropertiesPanelState.js.map +0 -1
  263. package/lib/stores/dataCube/DataCubeQueryEditorState.d.ts.map +0 -1
  264. package/lib/stores/dataCube/DataCubeQueryEditorState.js +0 -49
  265. package/lib/stores/dataCube/DataCubeQueryEditorState.js.map +0 -1
  266. package/lib/stores/dataCube/DataCubeQueryTextEditorState.d.ts +0 -25
  267. package/lib/stores/dataCube/DataCubeQueryTextEditorState.d.ts.map +0 -1
  268. package/lib/stores/dataCube/DataCubeQueryTextEditorState.js +0 -35
  269. package/lib/stores/dataCube/DataCubeQueryTextEditorState.js.map +0 -1
  270. package/lib/stores/dataCube/HPivotAndSortPanelState.d.ts +0 -40
  271. package/lib/stores/dataCube/HPivotAndSortPanelState.d.ts.map +0 -1
  272. package/lib/stores/dataCube/HPivotAndSortPanelState.js +0 -130
  273. package/lib/stores/dataCube/HPivotAndSortPanelState.js.map +0 -1
  274. package/src/application/LegendREPLGridClient.tsx +0 -72
  275. package/src/components/AgGrid.tsx +0 -59
  276. package/src/components/LegendREPLGridClientFrameworkProvider.tsx +0 -63
  277. package/src/components/REPLGridClient.tsx +0 -560
  278. package/src/components/dataCube/DataCubeGridEditor.tsx +0 -69
  279. package/src/components/grid/GridUtils.ts +0 -220
  280. package/src/components/grid/ServerSideDataSource.ts +0 -197
  281. package/src/components/grid/TDSLambdaBuilder.ts +0 -456
  282. package/src/components/grid/TDSQuery.ts +0 -37
  283. package/src/components/grid/TDSRequest.ts +0 -231
  284. package/src/stores/CompletionResult.ts +0 -30
  285. package/src/stores/dataCube/DataCubeConfigState.ts +0 -79
  286. package/src/stores/dataCube/DataCubeGridState.ts +0 -143
  287. package/src/stores/dataCube/DataCubePanelState.ts +0 -28
  288. package/src/stores/dataCube/DataCubePropertiesPanelState.ts +0 -65
  289. package/src/stores/dataCube/DataCubeQueryEditorState.ts +0 -66
  290. package/src/stores/dataCube/DataCubeQueryTextEditorState.ts +0 -41
  291. package/src/stores/dataCube/HPivotAndSortPanelState.ts +0 -170
@@ -0,0 +1,198 @@
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 { action, computed, makeObservable, observable } from 'mobx';
18
+ import type { DataCubeState } from '../DataCubeState.js';
19
+ import type {
20
+ DataCubeQuerySnapshot,
21
+ DataCubeQuerySnapshotColumn,
22
+ DataCubeQuerySnapshotSortColumn,
23
+ } from '../core/DataCubeQuerySnapshot.js';
24
+ import type { DataCubeQueryEditorSubState } from './DataCubeEditorQuerySnapshotBuilder.js';
25
+ import { deepEqual } from '@finos/legend-shared';
26
+ import { DATA_CUBE_COLUMN_SORT_DIRECTION } from '../DataCubeMetaModelConst.js';
27
+
28
+ export class DataCubeEditorSortColumnState {
29
+ readonly column: DataCubeQuerySnapshotColumn;
30
+ direction: DATA_CUBE_COLUMN_SORT_DIRECTION;
31
+
32
+ constructor(
33
+ column: DataCubeQuerySnapshotColumn,
34
+ direction: DATA_CUBE_COLUMN_SORT_DIRECTION,
35
+ ) {
36
+ makeObservable(this, {
37
+ direction: observable,
38
+ setDirection: action,
39
+ });
40
+
41
+ this.column = column;
42
+ this.direction = direction;
43
+ }
44
+
45
+ setDirection(val: DATA_CUBE_COLUMN_SORT_DIRECTION): void {
46
+ this.direction = val;
47
+ }
48
+ }
49
+
50
+ export class DataCubeEditorSortState implements DataCubeQueryEditorSubState {
51
+ readonly dataCubeState!: DataCubeState;
52
+
53
+ availableColumns: DataCubeEditorSortColumnState[] = [];
54
+ selectedColumns: DataCubeEditorSortColumnState[] = [];
55
+ availableColumnsSearchText = '';
56
+ selectedColumnsSearchText = '';
57
+
58
+ constructor(dataCubeState: DataCubeState) {
59
+ this.dataCubeState = dataCubeState;
60
+
61
+ makeObservable(this, {
62
+ availableColumns: observable,
63
+ selectedColumns: observable,
64
+ availableColumnsSearchText: observable,
65
+ selectedColumnsSearchText: observable,
66
+ setAvailableColumns: action,
67
+ setSelectedColumns: action,
68
+ addAvailableColumn: action,
69
+ addSelectedColumn: action,
70
+ addAllAvailableColumns: action,
71
+ addAllSelectedColumns: action,
72
+ setSelectedColumnsSearchText: action,
73
+ setAvailableColumnsSearchText: action,
74
+ availableColumnsSearchResults: computed,
75
+ selectedColumnsSearchResults: computed,
76
+ });
77
+ }
78
+
79
+ setAvailableColumns(val: DataCubeEditorSortColumnState[]): void {
80
+ this.availableColumns = val;
81
+ }
82
+
83
+ setSelectedColumns(val: DataCubeEditorSortColumnState[]): void {
84
+ this.selectedColumns = val;
85
+ }
86
+
87
+ addAvailableColumn(columnName: string): void {
88
+ const column = this.availableColumns.find(
89
+ (col) => col.column.name === columnName,
90
+ );
91
+ if (column) {
92
+ this.setAvailableColumns(
93
+ this.availableColumns.filter((col) => col.column.name !== columnName),
94
+ );
95
+ this.setSelectedColumns(this.selectedColumns.concat(column));
96
+ }
97
+ }
98
+
99
+ addSelectedColumn(columnName: string): void {
100
+ const column = this.selectedColumns.find(
101
+ (col) => col.column.name === columnName,
102
+ );
103
+ if (column) {
104
+ this.setSelectedColumns(
105
+ this.selectedColumns.filter((col) => col.column.name !== columnName),
106
+ );
107
+ this.setAvailableColumns(this.availableColumns.concat(column));
108
+ }
109
+ }
110
+
111
+ addAllAvailableColumns(): void {
112
+ this.setSelectedColumns(this.selectedColumns.concat(this.availableColumns));
113
+ this.setAvailableColumns([]);
114
+ }
115
+
116
+ addAllSelectedColumns(): void {
117
+ this.setAvailableColumns(
118
+ this.availableColumns.concat(this.selectedColumns),
119
+ );
120
+ this.setSelectedColumns([]);
121
+ }
122
+
123
+ setAvailableColumnsSearchText(val: string): void {
124
+ this.availableColumnsSearchText = val;
125
+ }
126
+
127
+ setSelectedColumnsSearchText(val: string): void {
128
+ this.selectedColumnsSearchText = val;
129
+ }
130
+
131
+ get availableColumnsSearchResults(): DataCubeEditorSortColumnState[] {
132
+ if (this.availableColumnsSearchText) {
133
+ return this.availableColumns.filter((col) =>
134
+ col.column.name
135
+ .toLowerCase()
136
+ .includes(this.availableColumnsSearchText.toLowerCase()),
137
+ );
138
+ } else {
139
+ return this.availableColumns;
140
+ }
141
+ }
142
+
143
+ get selectedColumnsSearchResults(): DataCubeEditorSortColumnState[] {
144
+ if (this.selectedColumnsSearchText) {
145
+ return this.selectedColumns.filter((col) =>
146
+ col.column.name
147
+ .toLowerCase()
148
+ .includes(this.selectedColumnsSearchText.toLowerCase()),
149
+ );
150
+ } else {
151
+ return this.selectedColumns;
152
+ }
153
+ }
154
+
155
+ applySnaphot(snapshot: DataCubeQuerySnapshot): void {
156
+ const sortColumns = snapshot.sortColumns;
157
+ this.setAvailableColumns(
158
+ snapshot.columns
159
+ .filter(
160
+ (col) => !sortColumns.find((sortCol) => sortCol.name === col.name),
161
+ )
162
+ .map(
163
+ (col) =>
164
+ new DataCubeEditorSortColumnState(
165
+ col,
166
+ DATA_CUBE_COLUMN_SORT_DIRECTION.ASCENDING,
167
+ ),
168
+ ),
169
+ );
170
+ this.setSelectedColumns(
171
+ sortColumns.map(
172
+ (sortCol) =>
173
+ new DataCubeEditorSortColumnState(
174
+ snapshot.columns.find((col) => col.name === sortCol.name)!,
175
+ sortCol.direction,
176
+ ),
177
+ ),
178
+ );
179
+ }
180
+
181
+ buildSnapshot(
182
+ newSnapshot: DataCubeQuerySnapshot,
183
+ baseSnapshot: DataCubeQuerySnapshot,
184
+ ): boolean {
185
+ const newSortColumns: DataCubeQuerySnapshotSortColumn[] =
186
+ this.selectedColumns.map((sortInfo) => ({
187
+ name: sortInfo.column.name,
188
+ type: sortInfo.column.type,
189
+ direction: sortInfo.direction,
190
+ }));
191
+
192
+ if (!deepEqual(newSortColumns, baseSnapshot.sortColumns)) {
193
+ newSnapshot.sortColumns = newSortColumns;
194
+ return true;
195
+ }
196
+ return false;
197
+ }
198
+ }
@@ -0,0 +1,94 @@
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 { action, makeObservable, observable } from 'mobx';
18
+ import type { DataCubeState } from '../DataCubeState.js';
19
+ import { DataCubeEditorSortState } from './DataCubeEditorSortState.js';
20
+ import { DataCubeQueryCodeEditorState } from './DataCubeEditorCodeState.js';
21
+ import { DataCubeQuerySnapshotSubscriber } from '../core/DataCubeQuerySnapshotSubscriber.js';
22
+ import {
23
+ cloneSnapshot,
24
+ type DataCubeQuerySnapshot,
25
+ } from '../core/DataCubeQuerySnapshot.js';
26
+ import { guaranteeNonNullable } from '@finos/legend-shared';
27
+
28
+ export enum DATA_CUBE_EDITOR_TAB {
29
+ COLUMNS = 'Columns',
30
+ VERTICAL_PIVOTS = 'VPivots',
31
+ HORIZONTAL_PIVOTS = 'HPivots',
32
+ SORTS = 'Sorts',
33
+ EXTENDED_COLUMNS = 'Extended Columns',
34
+ GENERAL_PROPERTIES = 'General Properties',
35
+ COLUMN_PROPERTIES = 'Column Properties',
36
+ Code = 'Code',
37
+ // DEVELOPER_OPTIONS = 'Developer',
38
+ // PIVOT_LAYOUT = 'Pivot Layout',
39
+ }
40
+
41
+ export class DataCubeEditorState extends DataCubeQuerySnapshotSubscriber {
42
+ readonly dataCubeState!: DataCubeState;
43
+ readonly sort!: DataCubeEditorSortState;
44
+ readonly codeEditorState!: DataCubeQueryCodeEditorState; // TODO: move to editor state
45
+
46
+ isPanelOpen = false;
47
+ currentTab = DATA_CUBE_EDITOR_TAB.SORTS;
48
+
49
+ constructor(dataCubeState: DataCubeState) {
50
+ super(dataCubeState.snapshotManager);
51
+
52
+ makeObservable(this, {
53
+ applyChanges: action,
54
+
55
+ currentTab: observable,
56
+ setCurrentTab: action,
57
+
58
+ isPanelOpen: observable,
59
+ openPanel: action,
60
+ closePanel: action,
61
+ });
62
+
63
+ this.codeEditorState = new DataCubeQueryCodeEditorState(this.dataCubeState);
64
+ this.dataCubeState = dataCubeState;
65
+ this.sort = new DataCubeEditorSortState(this.dataCubeState);
66
+ }
67
+
68
+ openPanel(): void {
69
+ this.isPanelOpen = true;
70
+ }
71
+
72
+ closePanel(): void {
73
+ this.isPanelOpen = false;
74
+ }
75
+
76
+ setCurrentTab(val: DATA_CUBE_EDITOR_TAB): void {
77
+ this.currentTab = val;
78
+ }
79
+
80
+ applyChanges(): void {
81
+ // let createNew = false;
82
+ const baseSnapshot = guaranteeNonNullable(this.getLatestSnapshot());
83
+ const snapshot = cloneSnapshot(baseSnapshot);
84
+ const createNew = this.sort.buildSnapshot(snapshot, baseSnapshot);
85
+
86
+ if (createNew) {
87
+ this.publishSnapshot(snapshot);
88
+ }
89
+ }
90
+
91
+ override async applySnapshot(snapshot: DataCubeQuerySnapshot): Promise<void> {
92
+ this.sort.applySnaphot(snapshot);
93
+ }
94
+ }
@@ -0,0 +1,152 @@
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 type {
18
+ IServerSideDatasource,
19
+ IServerSideGetRowsParams,
20
+ IServerSideGetRowsRequest,
21
+ } from '@ag-grid-community/core';
22
+ import type { DataCubeGridState } from './DataCubeGridState.js';
23
+ import {
24
+ cloneSnapshot,
25
+ type DataCubeQuerySnapshot,
26
+ type DataCubeQuerySnapshotSortColumn,
27
+ } from '../core/DataCubeQuerySnapshot.js';
28
+ import {
29
+ LogEvent,
30
+ assertErrorThrown,
31
+ deepEqual,
32
+ guaranteeNonNullable,
33
+ isBoolean,
34
+ } from '@finos/legend-shared';
35
+ import { buildExecutableQueryFromSnapshot } from '../core/DataCubeQueryBuilder.js';
36
+ import { type TabularDataSet, V1_Lambda } from '@finos/legend-graph';
37
+ import { DATA_CUBE_COLUMN_SORT_DIRECTION } from '../DataCubeMetaModelConst.js';
38
+ import { APPLICATION_EVENT } from '@finos/legend-application';
39
+
40
+ export type GridClientResultCellDataType =
41
+ | string
42
+ | number
43
+ | boolean
44
+ | null
45
+ | undefined;
46
+
47
+ export type GridClientRowDataType = {
48
+ [key: string]: GridClientResultCellDataType;
49
+ };
50
+
51
+ export enum GridClientSortDirection {
52
+ ASCENDING = 'asc',
53
+ DESCENDING = 'desc',
54
+ }
55
+
56
+ export const toRowData = (tds: TabularDataSet): GridClientRowDataType[] =>
57
+ tds.rows.map((_row, rowIdx) => {
58
+ const row: GridClientRowDataType = {};
59
+ const cols = tds.columns;
60
+ _row.values.forEach((value, colIdx) => {
61
+ // `ag-grid` shows `false` value as empty string so we have
62
+ // call `.toString()` to avoid this behavior.
63
+ row[cols[colIdx] as string] = isBoolean(value) ? String(value) : value;
64
+ });
65
+ row.rowNumber = rowIdx;
66
+ return row;
67
+ });
68
+
69
+ export class DataCubeGridClientServerSideDataSource
70
+ implements IServerSideDatasource
71
+ {
72
+ readonly grid: DataCubeGridState;
73
+
74
+ constructor(grid: DataCubeGridState) {
75
+ this.grid = grid;
76
+ }
77
+
78
+ async fetchRows(
79
+ params: IServerSideGetRowsParams<unknown, unknown>,
80
+ ): Promise<void> {
81
+ const currentSnapshot = guaranteeNonNullable(this.grid.getLatestSnapshot());
82
+ const syncedSnapshot = this.syncSnapshot(params.request, currentSnapshot);
83
+ if (syncedSnapshot.uuid !== currentSnapshot.uuid) {
84
+ this.grid.publishSnapshot(syncedSnapshot);
85
+ }
86
+ try {
87
+ const executableQuery = buildExecutableQueryFromSnapshot(syncedSnapshot);
88
+ const lambda = new V1_Lambda();
89
+ lambda.body.push(executableQuery);
90
+ const result = await this.grid.dataCubeState.engine.executeQuery(lambda);
91
+ const rowData = toRowData(result.result);
92
+ params.success({ rowData });
93
+ } catch (error) {
94
+ assertErrorThrown(error);
95
+ this.grid.dataCubeState.applicationStore.notificationService.notifyError(
96
+ error,
97
+ );
98
+ params.fail();
99
+ }
100
+ }
101
+
102
+ getRows(params: IServerSideGetRowsParams<unknown, unknown>): void {
103
+ this.fetchRows(params).catch((error: unknown) => {
104
+ assertErrorThrown(error);
105
+ this.grid.dataCubeState.applicationStore.logService.error(
106
+ LogEvent.create(APPLICATION_EVENT.ILLEGAL_APPLICATION_STATE_OCCURRED),
107
+ `Error ocurred while fetching data for grid should have been handled gracefully`,
108
+ error,
109
+ );
110
+ });
111
+ }
112
+
113
+ private syncSnapshot(
114
+ request: IServerSideGetRowsRequest,
115
+ baseSnapshot: DataCubeQuerySnapshot,
116
+ ): DataCubeQuerySnapshot {
117
+ let createNew = false;
118
+
119
+ // --------------------------------- GROUP BY ---------------------------------
120
+ // TODO: @akphi - Implement this
121
+
122
+ // --------------------------------- SORT ---------------------------------
123
+
124
+ const newSortColumns: DataCubeQuerySnapshotSortColumn[] =
125
+ request.sortModel.map((sortInfo) => {
126
+ const column = guaranteeNonNullable(
127
+ baseSnapshot.columns.find((col) => col.name === sortInfo.colId),
128
+ );
129
+ return {
130
+ name: sortInfo.colId,
131
+ type: column.type,
132
+ direction:
133
+ sortInfo.sort === GridClientSortDirection.ASCENDING
134
+ ? DATA_CUBE_COLUMN_SORT_DIRECTION.ASCENDING
135
+ : DATA_CUBE_COLUMN_SORT_DIRECTION.DESCENDING,
136
+ };
137
+ });
138
+
139
+ if (!deepEqual(newSortColumns, baseSnapshot.sortColumns)) {
140
+ createNew = true;
141
+ }
142
+
143
+ // --------------------------------- FINALIZE ---------------------------------
144
+
145
+ if (createNew) {
146
+ const newSnapshot = cloneSnapshot(baseSnapshot);
147
+ newSnapshot.sortColumns = newSortColumns;
148
+ return newSnapshot;
149
+ }
150
+ return baseSnapshot;
151
+ }
152
+ }
@@ -0,0 +1,245 @@
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 type { DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
18
+ import type { GridOptions } from '@ag-grid-community/core';
19
+ import { DATA_CUBE_COLUMN_SORT_DIRECTION } from '../DataCubeMetaModelConst.js';
20
+ import { GridClientSortDirection } from './DataCubeGridClientEngine.js';
21
+
22
+ // export const getTDSSortOrder = (sortOrder: string): TDS_SORT_ORDER => {
23
+ // switch (sortOrder) {
24
+ // case 'asc':
25
+ // return TDS_SORT_ORDER.ASCENDING;
26
+ // case 'desc':
27
+ // return TDS_SORT_ORDER.DESCENDING;
28
+ // default:
29
+ // throw new Error(`Unsupported tds sort order ${sortOrder}`);
30
+ // }
31
+ // };
32
+
33
+ // const getTDSSortModel = (sort: TDS_SORT_ORDER): string => {
34
+ // switch (sort) {
35
+ // case TDS_SORT_ORDER.ASCENDING:
36
+ // return 'asc';
37
+ // case TDS_SORT_ORDER.DESCENDING:
38
+ // return 'desc';
39
+ // default:
40
+ // throw new Error(`Unsupported`);
41
+ // }
42
+ // };
43
+
44
+ // export const getAggregationFunction = (
45
+ // aggFunc: string,
46
+ // ): TDS_AGGREGATION_FUNCTION => {
47
+ // switch (aggFunc) {
48
+ // case 'sum':
49
+ // return TDS_AGGREGATION_FUNCTION.SUM;
50
+ // case 'min':
51
+ // return TDS_AGGREGATION_FUNCTION.MIN;
52
+ // case 'max':
53
+ // return TDS_AGGREGATION_FUNCTION.MAX;
54
+ // case 'count':
55
+ // return TDS_AGGREGATION_FUNCTION.COUNT;
56
+ // default:
57
+ // throw new Error(`Unsupported aggregation function ${aggFunc}`);
58
+ // }
59
+ // };
60
+
61
+ // export const getTDSFilterOperation = (
62
+ // filterOperation: string,
63
+ // ): TDS_FILTER_OPERATION => {
64
+ // switch (filterOperation) {
65
+ // case 'equals':
66
+ // return TDS_FILTER_OPERATION.EQUALS;
67
+ // case 'notEqual':
68
+ // return TDS_FILTER_OPERATION.NOT_EQUAL;
69
+ // case 'greaterThan':
70
+ // return TDS_FILTER_OPERATION.GREATER_THAN;
71
+ // case 'greaterThanOrEqual':
72
+ // return TDS_FILTER_OPERATION.GREATER_THAN_OR_EQUAL;
73
+ // case 'lessThan':
74
+ // return TDS_FILTER_OPERATION.LESS_THAN;
75
+ // case 'lessThanOrEqual':
76
+ // return TDS_FILTER_OPERATION.LESS_THAN_OR_EQUAL;
77
+ // case 'blank':
78
+ // return TDS_FILTER_OPERATION.BLANK;
79
+ // case 'notBlank':
80
+ // return TDS_FILTER_OPERATION.NOT_BLANK;
81
+ // case 'contains':
82
+ // return TDS_FILTER_OPERATION.CONTAINS;
83
+ // case 'notContains':
84
+ // return TDS_FILTER_OPERATION.NOT_CONTAINS;
85
+ // case 'startsWith':
86
+ // return TDS_FILTER_OPERATION.STARTS_WITH;
87
+ // case 'endsWith':
88
+ // return TDS_FILTER_OPERATION.ENDS_WITH;
89
+ // default:
90
+ // throw new Error(`Unsupported filter operation ${filterOperation}`);
91
+ // }
92
+ // };
93
+
94
+ // export const getFilterColumnType = (type: string): PRIMITIVE_TYPE => {
95
+ // switch (type) {
96
+ // case 'text':
97
+ // return PRIMITIVE_TYPE.STRING;
98
+ // case 'number':
99
+ // return PRIMITIVE_TYPE.NUMBER;
100
+ // case 'boolean':
101
+ // return PRIMITIVE_TYPE.BOOLEAN;
102
+ // case 'date':
103
+ // return PRIMITIVE_TYPE.DATE;
104
+ // default:
105
+ // throw new Error(`Unsupported filter type ${type}`);
106
+ // }
107
+ // };
108
+
109
+ // export const getFilterModeltype = (type: PRIMITIVE_TYPE): string => {
110
+ // switch (type) {
111
+ // case PRIMITIVE_TYPE.STRING:
112
+ // return 'text';
113
+ // case PRIMITIVE_TYPE.NUMBER:
114
+ // return 'number';
115
+ // case PRIMITIVE_TYPE.BOOLEAN:
116
+ // return 'boolean';
117
+ // case PRIMITIVE_TYPE.DATE:
118
+ // return 'date';
119
+ // default:
120
+ // throw new Error(`Unsupported filter type ${type}`);
121
+ // }
122
+ // };
123
+
124
+ // export const getTDSColumnCustomizations = (
125
+ // result: TDSExecutionResult,
126
+ // columnName: string,
127
+ // tdsRequest?: TDSRequest | undefined,
128
+ // ): object => {
129
+ // if (!tdsRequest) {
130
+ // return {};
131
+ // }
132
+ // const sort = tdsRequest.sort.find((c) => c.column === columnName)?.order;
133
+ // const rowGroup = tdsRequest.groupBy.columns.find((c) => c === columnName);
134
+ // const aggFunc = tdsRequest.groupBy.aggregations.find(
135
+ // (c) => c.column === columnName,
136
+ // );
137
+ // return {
138
+ // sort: sort ? getTDSSortModel(sort) : undefined,
139
+ // rowGroup: Boolean(rowGroup),
140
+ // hide: Boolean(rowGroup),
141
+ // aggFunc: aggFunc?.function,
142
+ // };
143
+ // };
144
+
145
+ // export const getAggregationTDSColumnCustomizations = (
146
+ // result: TDSExecutionResult,
147
+ // columnName: string,
148
+ // ): object => {
149
+ // const columnType = result.builder.columns.find(
150
+ // (col) => col.name === columnName,
151
+ // )?.type;
152
+ // switch (columnType) {
153
+ // case PRIMITIVE_TYPE.STRING:
154
+ // return {
155
+ // filter: 'agTextColumnFilter',
156
+ // allowedAggFuncs: ['count'],
157
+ // };
158
+ // case PRIMITIVE_TYPE.DATE:
159
+ // case PRIMITIVE_TYPE.DATETIME:
160
+ // case PRIMITIVE_TYPE.STRICTDATE:
161
+ // return {
162
+ // filter: 'agDateColumnFilter',
163
+ // allowedAggFuncs: ['count'],
164
+ // };
165
+ // case PRIMITIVE_TYPE.DECIMAL:
166
+ // case PRIMITIVE_TYPE.INTEGER:
167
+ // case PRIMITIVE_TYPE.FLOAT:
168
+ // return {
169
+ // filter: 'agNumberColumnFilter',
170
+ // allowedAggFuncs: ['count', 'sum', 'max', 'min', 'avg'],
171
+ // };
172
+ // default:
173
+ // return {
174
+ // allowedAggFuncs: ['count'],
175
+ // };
176
+ // }
177
+ // };
178
+
179
+ // TODO: @akphi - do we need a default column definition?
180
+ // export const getDefaultColumnDefintions = (): object => ({
181
+ // minWidth: 50,
182
+ // sortable: true,
183
+ // flex: 1,
184
+ // resizable: true,
185
+ // enableRowGroup: true,
186
+ // allowedAggFuncs: ['count', 'sum', 'max', 'min', 'avg'],
187
+ // enableValue: true,
188
+ // menuTabs: ['filterMenuTab', 'generalMenuTab', 'columnsMenuTab'],
189
+ // });
190
+
191
+ // export const getTDSRowData = (tds: TabularDataSet): TDSRowDataType[] =>
192
+ // tds.rows.map((_row, rowIdx) => {
193
+ // const row: TDSRowDataType = {};
194
+ // const cols = tds.columns;
195
+ // _row.values.forEach((value, colIdx) => {
196
+ // // `ag-grid` shows `false` value as empty string so we have
197
+ // // call `.toString()` to avoid this behavior.
198
+ // row[cols[colIdx] as string] = isBoolean(value) ? String(value) : value;
199
+ // });
200
+ // row.rowNumber = rowIdx;
201
+ // return row;
202
+ // });
203
+
204
+ function buildColumnSortSpecification(
205
+ colName: string,
206
+ snapshot: DataCubeQuerySnapshot,
207
+ ) {
208
+ const sortCol = snapshot.sortColumns.find((c) => c.name === colName);
209
+ if (!sortCol) {
210
+ return {
211
+ sort: null,
212
+ sortIndex: null,
213
+ };
214
+ }
215
+ return {
216
+ sort:
217
+ sortCol.direction === DATA_CUBE_COLUMN_SORT_DIRECTION.ASCENDING
218
+ ? GridClientSortDirection.ASCENDING
219
+ : GridClientSortDirection.DESCENDING,
220
+ sortIndex: snapshot.sortColumns.indexOf(sortCol),
221
+ };
222
+ }
223
+
224
+ export function generateGridOptionsFromSnapshot(
225
+ snapshot: DataCubeQuerySnapshot,
226
+ ): GridOptions {
227
+ const gridOptions: GridOptions = {
228
+ columnDefs: snapshot.columns.map((col) => ({
229
+ headerName: col.name,
230
+ field: col.name,
231
+ ...buildColumnSortSpecification(col.name, snapshot),
232
+
233
+ // configurable
234
+ minWidth: 50,
235
+ sortable: true,
236
+ flex: 1,
237
+ resizable: true,
238
+ // enableRowGroup: true,
239
+ // allowedAggFuncs: ['count', 'sum', 'max', 'min', 'avg'],
240
+ // enableValue: true,
241
+ // menuTabs: ['filterMenuTab', 'generalMenuTab', 'columnsMenuTab'],
242
+ })),
243
+ };
244
+ return gridOptions;
245
+ }