@finos/legend-query-builder 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. package/lib/components/QueryBuilder.d.ts +0 -1
  2. package/lib/components/QueryBuilder.d.ts.map +1 -1
  3. package/lib/components/QueryBuilder.js +42 -9
  4. package/lib/components/QueryBuilder.js.map +1 -1
  5. package/lib/components/QueryBuilderComponentTestUtils.d.ts.map +1 -1
  6. package/lib/components/QueryBuilderComponentTestUtils.js +2 -5
  7. package/lib/components/QueryBuilderComponentTestUtils.js.map +1 -1
  8. package/lib/components/QueryBuilderDiffPanel.d.ts +0 -1
  9. package/lib/components/QueryBuilderDiffPanel.d.ts.map +1 -1
  10. package/lib/components/QueryBuilderDiffPanel.js +2 -2
  11. package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
  12. package/lib/components/QueryBuilderParametersPanel.d.ts +0 -1
  13. package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
  14. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +0 -1
  15. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  16. package/lib/components/QueryBuilderResultPanel.d.ts +0 -1
  17. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  18. package/lib/components/QueryBuilderResultPanel.js +3 -3
  19. package/lib/components/QueryBuilderSideBar.d.ts +0 -1
  20. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  21. package/lib/components/QueryBuilderSideBar.js +2 -1
  22. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  23. package/lib/components/QueryBuilderTextEditor.d.ts +0 -1
  24. package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
  25. package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts +0 -1
  26. package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts.map +1 -1
  27. package/lib/components/QueryBuilder_TestID.d.ts +1 -0
  28. package/lib/components/QueryBuilder_TestID.d.ts.map +1 -1
  29. package/lib/components/QueryBuilder_TestID.js +1 -0
  30. package/lib/components/QueryBuilder_TestID.js.map +1 -1
  31. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts +0 -1
  32. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts.map +1 -1
  33. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.js +5 -5
  34. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.js.map +1 -1
  35. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts +0 -1
  36. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  37. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +2 -2
  38. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  39. package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts +0 -1
  40. package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts.map +1 -1
  41. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts +0 -1
  42. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts.map +1 -1
  43. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +0 -1
  44. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
  45. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.d.ts +22 -0
  46. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.d.ts.map +1 -0
  47. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.js +363 -0
  48. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.js.map +1 -0
  49. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts +0 -1
  50. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  51. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +21 -53
  52. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  53. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts +22 -0
  54. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts.map +1 -0
  55. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js +32 -0
  56. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js.map +1 -0
  57. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts +0 -1
  58. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  59. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +2 -1
  60. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  61. package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.d.ts +27 -0
  62. package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.d.ts.map +1 -0
  63. package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.js +61 -0
  64. package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.js.map +1 -0
  65. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts +0 -1
  66. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  67. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +4 -13
  68. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  69. package/lib/components/filter/QueryBuilderFilterPanel.d.ts +0 -1
  70. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  71. package/lib/components/shared/LambdaEditor.d.ts +0 -1
  72. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  73. package/lib/components/shared/LambdaEditor.js +23 -7
  74. package/lib/components/shared/LambdaEditor.js.map +1 -1
  75. package/lib/components/shared/LambdaParameterValuesEditor.d.ts +0 -1
  76. package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -1
  77. package/lib/components/workflows/ServiceQueryBuilder.d.ts.map +1 -1
  78. package/lib/components/workflows/ServiceQueryBuilder.js +5 -1
  79. package/lib/components/workflows/ServiceQueryBuilder.js.map +1 -1
  80. package/lib/graphManager/QueryBuilderHashUtils.d.ts +14 -0
  81. package/lib/graphManager/QueryBuilderHashUtils.d.ts.map +1 -1
  82. package/lib/graphManager/QueryBuilderHashUtils.js +15 -0
  83. package/lib/graphManager/QueryBuilderHashUtils.js.map +1 -1
  84. package/lib/graphManager/QueryBuilderSupportedFunctions.d.ts +7 -1
  85. package/lib/graphManager/QueryBuilderSupportedFunctions.d.ts.map +1 -1
  86. package/lib/graphManager/QueryBuilderSupportedFunctions.js +7 -0
  87. package/lib/graphManager/QueryBuilderSupportedFunctions.js.map +1 -1
  88. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
  89. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +4 -1
  90. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  91. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts +1 -0
  92. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -1
  93. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js +50 -0
  94. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -1
  95. package/lib/index.css +2 -2
  96. package/lib/index.css.map +1 -1
  97. package/lib/package.json +6 -6
  98. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
  99. package/lib/stores/QueryBuilderStateBuilder.js +7 -1
  100. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  101. package/lib/stores/QueryBuilderStateTestUtils.d.ts.map +1 -1
  102. package/lib/stores/QueryBuilderStateTestUtils.js +2 -4
  103. package/lib/stores/QueryBuilderStateTestUtils.js.map +1 -1
  104. package/lib/stores/QueryBuilderTypeaheadHelper.js +2 -2
  105. package/lib/stores/explorer/QueryBuilderExplorerState.js +3 -3
  106. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +1 -0
  107. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
  108. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js +3 -0
  109. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
  110. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
  111. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +2 -1
  112. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  113. package/lib/stores/fetch-structure/tds/QueryBuilderTDSColumnState_.d.ts +24 -0
  114. package/lib/stores/fetch-structure/tds/QueryBuilderTDSColumnState_.d.ts.map +1 -0
  115. package/lib/stores/fetch-structure/tds/QueryBuilderTDSColumnState_.js +20 -0
  116. package/lib/stores/fetch-structure/tds/QueryBuilderTDSColumnState_.js.map +1 -0
  117. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.d.ts +23 -0
  118. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.d.ts.map +1 -0
  119. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.js +41 -0
  120. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.js.map +1 -0
  121. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +11 -0
  122. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  123. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +44 -1
  124. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  125. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.d.ts +2 -2
  126. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.d.ts.map +1 -1
  127. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.js +2 -2
  128. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.js.map +1 -1
  129. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateOperator.js +1 -1
  130. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationState.d.ts +4 -4
  131. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationState.d.ts.map +1 -1
  132. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationState.js +8 -7
  133. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationState.js.map +1 -1
  134. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByOperatorLoader.d.ts +18 -0
  135. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByOperatorLoader.d.ts.map +1 -0
  136. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByOperatorLoader.js +36 -0
  137. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByOperatorLoader.js.map +1 -0
  138. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByState.d.ts +91 -0
  139. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByState.d.ts.map +1 -0
  140. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByState.js +272 -0
  141. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByState.js.map +1 -0
  142. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByStateBuilder.d.ts +19 -0
  143. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByStateBuilder.d.ts.map +1 -0
  144. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByStateBuilder.js +100 -0
  145. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByStateBuilder.js.map +1 -0
  146. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByValueSpecificationBuilder.d.ts +19 -0
  147. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByValueSpecificationBuilder.d.ts.map +1 -0
  148. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByValueSpecificationBuilder.js +83 -0
  149. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByValueSpecificationBuilder.js.map +1 -0
  150. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_.d.ts +29 -0
  151. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_.d.ts.map +1 -0
  152. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_.js +30 -0
  153. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_.js.map +1 -0
  154. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Average.d.ts +25 -0
  155. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Average.d.ts.map +1 -0
  156. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Average.js +50 -0
  157. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Average.js.map +1 -0
  158. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Count.d.ts +25 -0
  159. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Count.d.ts.map +1 -0
  160. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Count.js +51 -0
  161. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Count.js.map +1 -0
  162. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Max.d.ts +25 -0
  163. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Max.d.ts.map +1 -0
  164. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Max.js +50 -0
  165. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Max.js.map +1 -0
  166. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Min.d.ts +25 -0
  167. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Min.d.ts.map +1 -0
  168. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Min.js +50 -0
  169. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Min.js.map +1 -0
  170. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Sum.d.ts +25 -0
  171. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Sum.d.ts.map +1 -0
  172. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Sum.js +51 -0
  173. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Sum.js.map +1 -0
  174. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_AverageRank_.d.ts +24 -0
  175. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_AverageRank_.d.ts.map +1 -0
  176. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_AverageRank_.js +48 -0
  177. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_AverageRank_.js.map +1 -0
  178. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_DenseRank_.d.ts +24 -0
  179. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_DenseRank_.d.ts.map +1 -0
  180. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_DenseRank_.js +48 -0
  181. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_DenseRank_.js.map +1 -0
  182. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_Rank_.d.ts +24 -0
  183. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_Rank_.d.ts.map +1 -0
  184. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_Rank_.js +48 -0
  185. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_Rank_.js.map +1 -0
  186. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_RowNumber_.d.ts +24 -0
  187. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_RowNumber_.d.ts.map +1 -0
  188. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_RowNumber_.js +48 -0
  189. package/lib/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_RowNumber_.js.map +1 -0
  190. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.d.ts +1 -1
  191. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.js +2 -2
  192. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts +6 -4
  193. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts.map +1 -1
  194. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +14 -3
  195. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
  196. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts.map +1 -1
  197. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js +8 -11
  198. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -1
  199. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.d.ts +2 -2
  200. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.d.ts.map +1 -1
  201. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js +5 -1
  202. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js.map +1 -1
  203. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.js +4 -4
  204. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +1 -1
  205. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +1 -1
  206. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +3 -3
  207. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +3 -3
  208. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js +1 -1
  209. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.js +2 -2
  210. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.d.ts +2 -2
  211. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js +3 -3
  212. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +3 -3
  213. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js +1 -1
  214. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +1 -1
  215. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts +4 -6
  216. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
  217. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +6 -5
  218. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  219. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  220. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +1 -0
  221. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  222. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
  223. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js +6 -3
  224. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  225. package/lib/stores/filter/QueryBuilderFilterState.d.ts +2 -0
  226. package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
  227. package/lib/stores/filter/QueryBuilderFilterState.js +6 -0
  228. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  229. package/package.json +13 -13
  230. package/src/components/QueryBuilder.tsx +110 -35
  231. package/src/components/QueryBuilderComponentTestUtils.tsx +9 -11
  232. package/src/components/QueryBuilderDiffPanel.tsx +2 -2
  233. package/src/components/QueryBuilderResultPanel.tsx +4 -4
  234. package/src/components/QueryBuilderSideBar.tsx +4 -1
  235. package/src/components/QueryBuilder_TestID.ts +1 -0
  236. package/src/components/explorer/QueryBuilderFunctionsExplorerPanel.tsx +6 -6
  237. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +2 -3
  238. package/src/components/fetch-structure/QueryBuilderOlapGroupByPanel.tsx +1140 -0
  239. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +31 -106
  240. package/src/components/fetch-structure/QueryBuilderPostTDSPanel.tsx +69 -0
  241. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +4 -1
  242. package/src/components/fetch-structure/QueryBuilderTDSComponentHelper.tsx +118 -0
  243. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +4 -23
  244. package/src/components/shared/LambdaEditor.tsx +25 -22
  245. package/src/components/workflows/ServiceQueryBuilder.tsx +10 -2
  246. package/src/graphManager/QueryBuilderHashUtils.ts +16 -0
  247. package/src/graphManager/QueryBuilderSupportedFunctions.ts +7 -0
  248. package/src/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +14 -0
  249. package/src/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts +129 -0
  250. package/src/stores/QueryBuilderStateBuilder.ts +14 -1
  251. package/src/stores/QueryBuilderStateTestUtils.ts +9 -13
  252. package/src/stores/QueryBuilderTypeaheadHelper.ts +2 -2
  253. package/src/stores/explorer/QueryBuilderExplorerState.ts +3 -3
  254. package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +4 -0
  255. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +2 -1
  256. package/src/stores/fetch-structure/tds/QueryBuilderTDSColumnState_.ts +28 -0
  257. package/src/stores/fetch-structure/tds/QueryBuilderTDSHelper.ts +79 -0
  258. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +68 -1
  259. package/src/stores/fetch-structure/tds/QueryResultSetModifierState.ts +2 -2
  260. package/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateOperator.ts +1 -1
  261. package/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationState.ts +11 -9
  262. package/src/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByOperatorLoader.ts +39 -0
  263. package/src/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByState.ts +377 -0
  264. package/src/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByStateBuilder.ts +237 -0
  265. package/src/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByValueSpecificationBuilder.ts +148 -0
  266. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_.ts +43 -0
  267. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Average.ts +56 -0
  268. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Count.ts +57 -0
  269. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Max.ts +56 -0
  270. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Min.ts +56 -0
  271. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_Sum.ts +57 -0
  272. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_AverageRank_.ts +54 -0
  273. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_DenseRank_.ts +54 -0
  274. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_Rank_.ts +54 -0
  275. package/src/stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapRankOperator_RowNumber_.ts +54 -0
  276. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterOperator.ts +2 -2
  277. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +22 -10
  278. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts +11 -19
  279. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.ts +8 -7
  280. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.ts +4 -4
  281. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +1 -1
  282. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +1 -1
  283. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +3 -3
  284. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +3 -3
  285. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.ts +1 -1
  286. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +2 -2
  287. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.ts +3 -3
  288. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +3 -3
  289. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.ts +1 -1
  290. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +1 -1
  291. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +9 -11
  292. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +1 -0
  293. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +8 -4
  294. package/src/stores/filter/QueryBuilderFilterState.ts +7 -0
  295. package/tsconfig.json +19 -0
@@ -0,0 +1,1140 @@
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 { useApplicationStore } from '@finos/legend-application';
18
+ import {
19
+ PlusIcon,
20
+ PanelContent,
21
+ PanelDropZone,
22
+ BlankPanelPlaceholder,
23
+ DropdownMenu,
24
+ InputWithInlineValidation,
25
+ MenuContent,
26
+ MenuContentItem,
27
+ SigmaIcon,
28
+ CaretDownIcon,
29
+ clsx,
30
+ PanelEntryDropZonePlaceholder,
31
+ ContextMenu,
32
+ VerticalDragHandleIcon,
33
+ TimesIcon,
34
+ useDragPreviewLayer,
35
+ SortIcon,
36
+ Dialog,
37
+ CustomSelectorInput,
38
+ WindowIcon,
39
+ BasePopover,
40
+ EditIcon,
41
+ } from '@finos/legend-art';
42
+ import { assertErrorThrown, guaranteeNonNullable } from '@finos/legend-shared';
43
+ import { observer } from 'mobx-react-lite';
44
+ import { forwardRef, useCallback, useRef, useState } from 'react';
45
+ import { type DropTargetMonitor, useDrag, useDrop } from 'react-dnd';
46
+ import type { QueryBuilderTDSOlapOperator } from '../../stores/fetch-structure/tds/olapGroupBy/operators/QueryBuilderTDSOlapOperator_.js';
47
+ import {
48
+ type QueryBuilderOlapGroupByState,
49
+ type QueryBuilderOlapDropTarget,
50
+ type QueryBuilderOlapColumnDragSource,
51
+ QueryBuilderOlapGroupByColumnState,
52
+ QueryBuilderTDSOlapRankOperatorState,
53
+ QueryBuilderTDSOlapAggreationOperatorState,
54
+ QUERY_BUILDER_OLAP_COLUMN_DND_TYPE,
55
+ } from '../../stores/fetch-structure/tds/olapGroupBy/QueryBuilderOlapGroupByState.js';
56
+ import { QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE } from '../../stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js';
57
+ import type { QueryBuilderTDSColumnState } from '../../stores/fetch-structure/tds/QueryBuilderTDSColumnState_.js';
58
+ import type { QueryBuilderTDSState } from '../../stores/fetch-structure/tds/QueryBuilderTDSState.js';
59
+ import { COLUMN_SORT_TYPE } from '../../stores/fetch-structure/tds/QueryResultSetModifierState.js';
60
+ import { QUERY_BUILDER_TEST_ID } from '../QueryBuilder_TestID.js';
61
+
62
+ // helpers
63
+ const createOlapColumnState = (
64
+ columnState: QueryBuilderTDSColumnState,
65
+ tdsState: QueryBuilderTDSState,
66
+ ): QueryBuilderOlapGroupByColumnState => {
67
+ const operator = tdsState.olapGroupByState.operators.filter(
68
+ (o) =>
69
+ o.isColumnAggregator() &&
70
+ o.isCompatibleWithType(columnState.getColumnType()),
71
+ )[0];
72
+ const nonColoperator = guaranteeNonNullable(
73
+ tdsState.olapGroupByState.operators.filter(
74
+ (o) => !o.isColumnAggregator(),
75
+ )[0],
76
+ );
77
+ if (operator) {
78
+ const opState = new QueryBuilderTDSOlapAggreationOperatorState(
79
+ tdsState.olapGroupByState,
80
+ operator,
81
+ columnState,
82
+ );
83
+ return new QueryBuilderOlapGroupByColumnState(
84
+ tdsState.olapGroupByState,
85
+ [],
86
+ undefined,
87
+ opState,
88
+ `${operator.getLabel()} ${columnState.columnName}`,
89
+ );
90
+ } else {
91
+ return new QueryBuilderOlapGroupByColumnState(
92
+ tdsState.olapGroupByState,
93
+ [columnState],
94
+ undefined,
95
+ new QueryBuilderTDSOlapRankOperatorState(
96
+ tdsState.olapGroupByState,
97
+ nonColoperator,
98
+ ),
99
+ `${nonColoperator.getLabel()} ${columnState.columnName}`,
100
+ );
101
+ }
102
+ };
103
+
104
+ const QueryBuilderOlapGroupByColumnContextMenu = observer(
105
+ forwardRef<
106
+ HTMLDivElement,
107
+ {
108
+ columnState: QueryBuilderOlapGroupByColumnState;
109
+ }
110
+ >(function QueryBuilderOlapGroupByColumnContextMenu(props, ref) {
111
+ const { columnState } = props;
112
+ const editColumn = (): void =>
113
+ columnState.olapState.setEditColumn(columnState);
114
+ const removeColumn = (): void =>
115
+ columnState.olapState.removeColumn(columnState);
116
+
117
+ return (
118
+ <MenuContent ref={ref}>
119
+ <MenuContentItem onClick={editColumn}>Open Editor</MenuContentItem>
120
+ <MenuContentItem onClick={removeColumn}>Remove</MenuContentItem>
121
+ </MenuContent>
122
+ );
123
+ }),
124
+ );
125
+
126
+ const TDSColumnSelectorEditor = observer(
127
+ (props: {
128
+ colValue: QueryBuilderTDSColumnState;
129
+ tdsColOptions: QueryBuilderTDSColumnState[];
130
+ setColumn: (val: QueryBuilderTDSColumnState) => void;
131
+ deleteColumn: (val: QueryBuilderTDSColumnState) => void;
132
+ }) => {
133
+ const { tdsColOptions, colValue, setColumn, deleteColumn } = props;
134
+ const applicationStore = useApplicationStore();
135
+ const options = tdsColOptions.map((col) => ({
136
+ label: col.columnName,
137
+ value: col,
138
+ }));
139
+ const value = {
140
+ label: colValue.columnName,
141
+ value: colValue,
142
+ };
143
+ const onChange = (
144
+ val: { label: string; value: QueryBuilderTDSColumnState } | null,
145
+ ): void => {
146
+ if (val !== null) {
147
+ setColumn(val.value);
148
+ }
149
+ };
150
+ const removeColumn = (): void => deleteColumn(colValue);
151
+
152
+ return (
153
+ <div className="panel__content__form__section__list__item query-builder__projection__options__sort">
154
+ <CustomSelectorInput
155
+ className="query-builder__projection__options__sort__dropdown"
156
+ options={options}
157
+ disabled={options.length < 1}
158
+ onChange={onChange}
159
+ value={value}
160
+ darkMode={!applicationStore.TEMPORARY__isLightThemeEnabled}
161
+ />
162
+ <button
163
+ className="query-builder__olap__tds__column__remove-btn btn--dark btn--caution"
164
+ onClick={removeColumn}
165
+ tabIndex={-1}
166
+ title="Remove"
167
+ >
168
+ <TimesIcon />
169
+ </button>
170
+ </div>
171
+ );
172
+ },
173
+ );
174
+
175
+ const QueryBuilderOlapColumnModalEditor = observer(
176
+ (props: {
177
+ olapGroupByState: QueryBuilderOlapGroupByState;
178
+ olapColumnState: QueryBuilderOlapGroupByColumnState;
179
+ }) => {
180
+ const { olapGroupByState, olapColumnState } = props;
181
+ const createNewOlap =
182
+ !olapGroupByState.olapColumns.includes(olapColumnState);
183
+ const tdsState = olapGroupByState.tdsState;
184
+ const applicationStore = useApplicationStore();
185
+ const close = (): void => {
186
+ olapGroupByState.setEditColumn(undefined);
187
+ };
188
+ const isDuplicatedColumnName = createNewOlap
189
+ ? olapGroupByState.tdsState.tdsColumns
190
+ .map((c) => c.columnName)
191
+ .includes(olapColumnState.columnName)
192
+ : olapGroupByState.tdsState.isDuplicateColumn(olapColumnState);
193
+ const windowOptions = createNewOlap
194
+ ? tdsState.tdsColumns
195
+ : olapColumnState.possibleReferencedColumns;
196
+ const windowOptionsLabels = windowOptions.map((w) => ({
197
+ label: w.columnName,
198
+ value: w,
199
+ }));
200
+ // column Name
201
+ const changeColumnName: React.ChangeEventHandler<HTMLInputElement> = (
202
+ event,
203
+ ) => olapColumnState.setColumnName(event.target.value);
204
+ // operator
205
+ const operators = olapGroupByState.operators;
206
+ const operationState = olapColumnState.operationState;
207
+ const olapOpColumn =
208
+ operationState instanceof QueryBuilderTDSOlapAggreationOperatorState
209
+ ? operationState.columnState
210
+ : undefined;
211
+ const changeOperatorCol = (
212
+ val: { label: string; value: QueryBuilderTDSColumnState } | null,
213
+ ): void => {
214
+ if (
215
+ operationState instanceof QueryBuilderTDSOlapAggreationOperatorState
216
+ ) {
217
+ if (val !== null) {
218
+ operationState.setColumnState(val.value);
219
+ }
220
+ }
221
+ };
222
+ const changeOperator =
223
+ (olapOp: QueryBuilderTDSOlapOperator) => (): void => {
224
+ olapColumnState.changeOperator(olapOp);
225
+ };
226
+ // window
227
+ const addOptions = windowOptions.filter(
228
+ (e) => !olapColumnState.windowColumns.includes(e),
229
+ );
230
+ const create = (): void => {
231
+ olapGroupByState.addOlapColumn(olapColumnState);
232
+ close();
233
+ };
234
+ const addWindowValue = (): void => {
235
+ if (addOptions.length > 0) {
236
+ olapColumnState.addWindow(guaranteeNonNullable(addOptions[0]));
237
+ }
238
+ };
239
+ // sortby
240
+ const sortByState = olapColumnState.sortByState;
241
+ const changeSortBy = (sortOp: COLUMN_SORT_TYPE | undefined) => (): void => {
242
+ olapColumnState.changeSortBy(sortOp);
243
+ };
244
+ const changeSortCol = (
245
+ val: { label: string; value: QueryBuilderTDSColumnState } | null,
246
+ ): void => {
247
+ if (sortByState) {
248
+ if (val !== null) {
249
+ sortByState.setColumnState(val.value);
250
+ }
251
+ }
252
+ };
253
+ return (
254
+ <Dialog
255
+ open={Boolean(olapGroupByState.editColumn)}
256
+ onClose={close}
257
+ classes={{
258
+ root: 'editor-modal__root-container',
259
+ container: 'editor-modal__container',
260
+ paper: 'editor-modal__content',
261
+ }}
262
+ >
263
+ <div className="modal modal--dark query-builder__olap__modal">
264
+ <div className="modal__header">
265
+ <div className="modal__title">
266
+ {createNewOlap
267
+ ? 'Create OLAP GroupBy Column'
268
+ : 'Update OLAP GroupByColumn'}
269
+ </div>
270
+ </div>
271
+ <div className="query-builder__olap__modal__body">
272
+ <div className="panel__content__form__section">
273
+ <div className="panel__content__form__section__header__label">
274
+ OLAP Column Name
275
+ </div>
276
+ <div className="panel__content__form__section__header__prompt">
277
+ Name of OLAP Column that will be part of TDS Result
278
+ </div>
279
+ <InputWithInlineValidation
280
+ className="query-builder__olap__column__name__input input-group__input"
281
+ spellCheck={false}
282
+ value={olapColumnState.columnName}
283
+ onChange={changeColumnName}
284
+ validationErrorMessage={
285
+ isDuplicatedColumnName ? 'Duplicated column' : undefined
286
+ }
287
+ />
288
+ </div>
289
+ <div className="panel__content__form__section">
290
+ <div className="panel__content__form__section__header__label">
291
+ OLAP Operator
292
+ </div>
293
+ <div className="panel__content__form__section__header__prompt">
294
+ OLAP aggregation function to apply and column if required by
295
+ function
296
+ </div>
297
+ <div className="panel__content__form__section__list">
298
+ <div className="panel__content__form__section__list__items">
299
+ <div className="query-builder__olap__column__operation__operator">
300
+ <div
301
+ className={clsx(
302
+ 'query-builder__olap__column__operation__operator__label',
303
+ {
304
+ 'query-builder__olap__column__operation__operator__label__agg':
305
+ !olapOpColumn,
306
+ },
307
+ )}
308
+ >
309
+ {operationState.operator.getLabel()}
310
+ </div>
311
+ {olapOpColumn && (
312
+ <div className="panel__content__form__section__list__item query-builder__olap__tds__column__options">
313
+ <CustomSelectorInput
314
+ className="query-builder__olap__tds__column__dropdown"
315
+ options={windowOptionsLabels}
316
+ disabled={windowOptionsLabels.length < 1}
317
+ onChange={changeOperatorCol}
318
+ value={{
319
+ value: olapOpColumn,
320
+ label: olapOpColumn.columnName,
321
+ }}
322
+ darkMode={
323
+ !applicationStore.TEMPORARY__isLightThemeEnabled
324
+ }
325
+ />
326
+ </div>
327
+ )}
328
+ <DropdownMenu
329
+ className="query-builder__olap__column__operation__operator__dropdown"
330
+ disabled={!operators.length}
331
+ content={
332
+ <MenuContent>
333
+ {operators.map((op) => (
334
+ <MenuContentItem
335
+ key={op.uuid}
336
+ className="query-builder__olap__column__operation__operator__dropdown__option"
337
+ onClick={changeOperator(op)}
338
+ >
339
+ {op.getLabel()}
340
+ </MenuContentItem>
341
+ ))}
342
+ </MenuContent>
343
+ }
344
+ menuProps={{
345
+ anchorOrigin: {
346
+ vertical: 'bottom',
347
+ horizontal: 'left',
348
+ },
349
+ transformOrigin: {
350
+ vertical: 'top',
351
+ horizontal: 'left',
352
+ },
353
+ elevation: 7,
354
+ }}
355
+ >
356
+ <button
357
+ className="query-builder__olap__column__operation__operator__badge"
358
+ tabIndex={-1}
359
+ title="Choose OLAP GroupBy Operator..."
360
+ >
361
+ <SigmaIcon />
362
+ </button>
363
+ <button
364
+ className="query-builder__olap__column__operation__operator__dropdown__trigger"
365
+ tabIndex={-1}
366
+ title="Choose OLAP GroupBy Operator..."
367
+ >
368
+ <CaretDownIcon />
369
+ </button>
370
+ </DropdownMenu>
371
+ </div>
372
+ </div>
373
+ </div>
374
+ </div>
375
+ <div className="panel__content__form__section">
376
+ <div className="panel__content__form__section__header__label">
377
+ Window Columns
378
+ </div>
379
+ <div className="panel__content__form__section__header__prompt">
380
+ Represents the window of columns that will partition the rows
381
+ for which to apply the aggragte function
382
+ </div>
383
+ <div className="panel__content__form__section__list">
384
+ <div className="panel__content__form__section__list__items">
385
+ {olapColumnState.windowColumns.map((value, idx) => (
386
+ <TDSColumnSelectorEditor
387
+ key={value.uuid}
388
+ colValue={value}
389
+ setColumn={(v: QueryBuilderTDSColumnState) =>
390
+ olapColumnState.changeWindow(v, idx)
391
+ }
392
+ deleteColumn={(v: QueryBuilderTDSColumnState): void =>
393
+ olapColumnState.deleteWindow(v)
394
+ }
395
+ tdsColOptions={windowOptions}
396
+ />
397
+ ))}
398
+ </div>
399
+ <div className="panel__content__form__section__list__new-item__add">
400
+ <button
401
+ className="panel__content__form__section__list__new-item__add-btn btn btn--dark"
402
+ disabled={!addOptions.length}
403
+ onClick={addWindowValue}
404
+ tabIndex={-1}
405
+ >
406
+ Add Value
407
+ </button>
408
+ </div>
409
+ </div>
410
+ </div>
411
+ <div className="panel__content__form__section">
412
+ <div className="panel__content__form__section__header__label">
413
+ Sort By
414
+ </div>
415
+ <div className="panel__content__form__section__header__prompt">
416
+ Orders by the designated column
417
+ </div>
418
+ <div className="panel__content__form__section__header__prompt"></div>
419
+ <div className="panel__content__form__section__list">
420
+ <div className="query-builder__olap__column__sortby__operator">
421
+ {sortByState && (
422
+ <div className="query-builder__olap__column__sortby__operator__label">
423
+ {sortByState.sortType.toLowerCase()}
424
+ </div>
425
+ )}
426
+ {sortByState && (
427
+ <div className="panel__content__form__section__list__item query-builder__olap__tds__column__options">
428
+ <CustomSelectorInput
429
+ className="query-builder__olap__tds__column__dropdown"
430
+ options={windowOptionsLabels}
431
+ disabled={windowOptionsLabels.length < 1}
432
+ onChange={changeSortCol}
433
+ value={{
434
+ value: sortByState.columnState,
435
+ label: sortByState.columnState.columnName,
436
+ }}
437
+ darkMode={
438
+ !applicationStore.TEMPORARY__isLightThemeEnabled
439
+ }
440
+ />
441
+ </div>
442
+ )}
443
+ {!sortByState && (
444
+ <div className="query-builder__olap__column__sortby__none">
445
+ (none)
446
+ </div>
447
+ )}
448
+ <DropdownMenu
449
+ className="query-builder__olap__column__sortby__operator__dropdown"
450
+ content={
451
+ <MenuContent>
452
+ <MenuContentItem
453
+ key="none"
454
+ className="query-builder__olap__column__sortby__operator__dropdown__option"
455
+ onClick={changeSortBy(undefined)}
456
+ >
457
+ (none)
458
+ </MenuContentItem>
459
+
460
+ {Object.values(COLUMN_SORT_TYPE).map((op) => (
461
+ <MenuContentItem
462
+ key={op}
463
+ className="query-builder__olap__column__sortby__operator__dropdown__option"
464
+ onClick={changeSortBy(op)}
465
+ >
466
+ {op.toLowerCase()}
467
+ </MenuContentItem>
468
+ ))}
469
+ </MenuContent>
470
+ }
471
+ menuProps={{
472
+ anchorOrigin: { vertical: 'bottom', horizontal: 'left' },
473
+ transformOrigin: { vertical: 'top', horizontal: 'left' },
474
+ elevation: 7,
475
+ }}
476
+ >
477
+ <button
478
+ className={clsx(
479
+ 'query-builder__olap__column__sortby__operator__badge',
480
+ {
481
+ 'query-builder__olap__column__sortby__operator__badge--activated':
482
+ Boolean(sortByState),
483
+ },
484
+ )}
485
+ tabIndex={-1}
486
+ title="Choose OLAP SortBy Operator..."
487
+ >
488
+ <SortIcon />
489
+ </button>
490
+ <button
491
+ className="query-builder__olap__column__sortby__operator__dropdown__trigger"
492
+ tabIndex={-1}
493
+ title="Choose OLAP SortBy Operator..."
494
+ >
495
+ <CaretDownIcon />
496
+ </button>
497
+ </DropdownMenu>
498
+ </div>
499
+ </div>
500
+ </div>
501
+ </div>
502
+ <div className="modal__footer">
503
+ {createNewOlap ? (
504
+ <button className="btn modal__footer__close-btn" onClick={create}>
505
+ Create
506
+ </button>
507
+ ) : (
508
+ <button className="btn modal__footer__close-btn" onClick={close}>
509
+ Close
510
+ </button>
511
+ )}
512
+ </div>
513
+ </div>
514
+ </Dialog>
515
+ );
516
+ },
517
+ );
518
+
519
+ const TDSColumnReferenceEditor = observer(
520
+ (props: {
521
+ tdsColumn: QueryBuilderTDSColumnState;
522
+ handleChange: (val: QueryBuilderTDSColumnState) => void;
523
+ }) => {
524
+ const { handleChange, tdsColumn } = props;
525
+ const handleDrop = useCallback(
526
+ (item: QueryBuilderOlapColumnDragSource): void => {
527
+ handleChange(item.columnState);
528
+ },
529
+ [handleChange],
530
+ );
531
+ const [{ isDragOver }, dropOpConnector] = useDrop<
532
+ QueryBuilderOlapColumnDragSource,
533
+ void,
534
+ { isDragOver: boolean }
535
+ >(
536
+ () => ({
537
+ accept: [
538
+ QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE,
539
+ QUERY_BUILDER_OLAP_COLUMN_DND_TYPE,
540
+ ],
541
+ drop: (item, monitor): void => {
542
+ if (!monitor.didDrop()) {
543
+ handleDrop(item);
544
+ }
545
+ },
546
+ collect: (monitor) => ({
547
+ isDragOver: monitor.isOver({ shallow: true }),
548
+ }),
549
+ }),
550
+ [handleDrop],
551
+ );
552
+
553
+ return (
554
+ <div className="query-builder__olap__tds__column">
555
+ <div
556
+ ref={dropOpConnector}
557
+ className="query-builder__olap__tds__column-badge"
558
+ >
559
+ <PanelEntryDropZonePlaceholder
560
+ showPlaceholder={isDragOver}
561
+ label="Change Column"
562
+ className="query-builder__dnd__placeholder"
563
+ >
564
+ <div className="query-builder__olap__tds__column-badge__content">
565
+ <div
566
+ className="query-builder__olap__tds__column-badge__property"
567
+ title={`${tdsColumn.columnName}`}
568
+ >
569
+ {tdsColumn.columnName}
570
+ </div>
571
+ </div>
572
+ </PanelEntryDropZonePlaceholder>
573
+ </div>
574
+ </div>
575
+ );
576
+ },
577
+ );
578
+
579
+ const QueryBuilderOlapGroupByColumnEditor = observer(
580
+ (props: { olapColumnState: QueryBuilderOlapGroupByColumnState }) => {
581
+ const { olapColumnState } = props;
582
+ const olapState = olapColumnState.olapState;
583
+ const tdsState = olapState.tdsState;
584
+ const operators = olapState.operators;
585
+ // state
586
+ const ref = useRef<HTMLDivElement>(null);
587
+ const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
588
+ const [isSelectedFromContextMenu, setIsSelectedFromContextMenu] =
589
+ useState(false);
590
+ const openWindowPopover = (
591
+ event: React.MouseEvent<HTMLButtonElement>,
592
+ ): void => {
593
+ setAnchorEl(event.currentTarget);
594
+ };
595
+ const closeWindowPopover = (): void => {
596
+ setAnchorEl(null);
597
+ };
598
+ const onContextMenuOpen = (): void => setIsSelectedFromContextMenu(true);
599
+ const onContextMenuClose = (): void => setIsSelectedFromContextMenu(false);
600
+
601
+ // column Name
602
+ const changeColumnName: React.ChangeEventHandler<HTMLInputElement> = (
603
+ event,
604
+ ) => olapColumnState.setColumnName(event.target.value);
605
+ const isDuplicatedColumnName = tdsState.isDuplicateColumn(olapColumnState);
606
+
607
+ // window columns
608
+ const windowOptions = olapColumnState.possibleReferencedColumns;
609
+ const addWindowOptions = windowOptions.filter(
610
+ (e) => !olapColumnState.windowColumns.includes(e),
611
+ );
612
+ const addWindowValue = (): void => {
613
+ if (addWindowOptions.length > 0) {
614
+ olapColumnState.addWindow(guaranteeNonNullable(addWindowOptions[0]));
615
+ }
616
+ };
617
+
618
+ // operator
619
+ const operationState = olapColumnState.operationState;
620
+ const aggregateColumn =
621
+ operationState instanceof QueryBuilderTDSOlapAggreationOperatorState
622
+ ? operationState.columnState
623
+ : undefined;
624
+
625
+ const changeOperator =
626
+ (olapOp: QueryBuilderTDSOlapOperator) => (): void => {
627
+ olapColumnState.changeOperator(olapOp);
628
+ };
629
+
630
+ // sortby
631
+ const sortByState = olapColumnState.sortByState;
632
+ const changeSortBy = (sortOp: COLUMN_SORT_TYPE | undefined) => (): void => {
633
+ olapColumnState.changeSortBy(sortOp);
634
+ };
635
+
636
+ // action
637
+ const isRemovalDisabled = olapState.tdsState.isColumnInUse(olapColumnState);
638
+ const removeColumn = (): void => {
639
+ olapColumnState.olapState.removeColumn(olapColumnState);
640
+ };
641
+ const editoColumn = (): void => {
642
+ olapState.setEditColumn(olapColumnState);
643
+ };
644
+
645
+ // Drag and Drop
646
+ const handleHover = useCallback(
647
+ (
648
+ item: QueryBuilderOlapColumnDragSource,
649
+ monitor: DropTargetMonitor,
650
+ ): void => {
651
+ const dragIndex = tdsState.olapGroupByState.olapColumns.findIndex(
652
+ (e) => e === item.columnState,
653
+ );
654
+ const hoverIndex = tdsState.olapGroupByState.olapColumns.findIndex(
655
+ (e) => e === olapColumnState,
656
+ );
657
+ if (dragIndex === -1 || hoverIndex === -1 || dragIndex === hoverIndex) {
658
+ return;
659
+ }
660
+ // move the item being hovered on when the dragged item position is beyond the its middle point
661
+ const hoverBoundingReact = ref.current?.getBoundingClientRect();
662
+ const distanceThreshold =
663
+ ((hoverBoundingReact?.bottom ?? 0) - (hoverBoundingReact?.top ?? 0)) /
664
+ 2;
665
+ const dragDistance =
666
+ (monitor.getClientOffset()?.y ?? 0) - (hoverBoundingReact?.top ?? 0);
667
+ if (dragIndex < hoverIndex && dragDistance < distanceThreshold) {
668
+ return;
669
+ }
670
+ if (dragIndex > hoverIndex && dragDistance > distanceThreshold) {
671
+ return;
672
+ }
673
+ olapState.moveColumn(dragIndex, hoverIndex);
674
+ },
675
+ [olapColumnState, olapState, tdsState.olapGroupByState.olapColumns],
676
+ );
677
+ const [, dropConnector] = useDrop<QueryBuilderOlapColumnDragSource>(
678
+ () => ({
679
+ accept: [QUERY_BUILDER_OLAP_COLUMN_DND_TYPE],
680
+ hover: (item, monitor): void => handleHover(item, monitor),
681
+ }),
682
+ [handleHover],
683
+ );
684
+ const [{ olapColumnBeingDragged }, dragConnector, dragPreviewConnector] =
685
+ useDrag<
686
+ QueryBuilderOlapColumnDragSource,
687
+ void,
688
+ {
689
+ olapColumnBeingDragged:
690
+ | QueryBuilderOlapGroupByColumnState
691
+ | undefined;
692
+ }
693
+ >(
694
+ () => ({
695
+ type: QUERY_BUILDER_OLAP_COLUMN_DND_TYPE,
696
+ item: () => ({
697
+ columnState: olapColumnState,
698
+ }),
699
+ collect: (monitor) => ({
700
+ /**
701
+ * @workaround typings - https://github.com/react-dnd/react-dnd/pull/3484
702
+ */
703
+ olapColumnBeingDragged:
704
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
705
+ (monitor.getItem() as QueryBuilderOlapColumnDragSource | null)
706
+ ?.columnState,
707
+ }),
708
+ }),
709
+ [olapColumnState],
710
+ );
711
+ const isBeingDragged = olapColumnState === olapColumnBeingDragged;
712
+ dragConnector(dropConnector(ref));
713
+ useDragPreviewLayer(dragPreviewConnector);
714
+
715
+ const handleOpDrop = (val: QueryBuilderTDSColumnState): void => {
716
+ if (
717
+ operationState instanceof QueryBuilderTDSOlapAggreationOperatorState
718
+ ) {
719
+ operationState.setColumnState(val);
720
+ }
721
+ };
722
+ const handleSortDrop = (val: QueryBuilderTDSColumnState): void => {
723
+ if (sortByState) {
724
+ sortByState.setColumnState(val);
725
+ }
726
+ };
727
+ const handleWindowDrop = useCallback(
728
+ (item: QueryBuilderOlapColumnDragSource): void => {
729
+ const colState = item.columnState;
730
+ if (
731
+ olapColumnState.possibleReferencedColumns.includes(colState) &&
732
+ !olapColumnState.windowColumns.includes(colState)
733
+ ) {
734
+ olapColumnState.addWindow(colState);
735
+ }
736
+ },
737
+ [olapColumnState],
738
+ );
739
+ const [{ isDragOver }, dropOpConnector] = useDrop<
740
+ QueryBuilderOlapColumnDragSource,
741
+ void,
742
+ { isDragOver: boolean }
743
+ >(
744
+ () => ({
745
+ accept: [
746
+ QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE,
747
+ QUERY_BUILDER_OLAP_COLUMN_DND_TYPE,
748
+ ],
749
+ drop: (item, monitor): void => {
750
+ if (!monitor.didDrop()) {
751
+ handleWindowDrop(item);
752
+ }
753
+ },
754
+ collect: (monitor) => ({
755
+ isDragOver: monitor.isOver({ shallow: true }),
756
+ }),
757
+ }),
758
+ [handleWindowDrop],
759
+ );
760
+
761
+ return (
762
+ <div ref={ref} className="query-builder__olap__column">
763
+ <PanelEntryDropZonePlaceholder
764
+ showPlaceholder={isBeingDragged}
765
+ className="query-builder__dnd__placeholder"
766
+ >
767
+ <ContextMenu
768
+ content={
769
+ <QueryBuilderOlapGroupByColumnContextMenu
770
+ columnState={olapColumnState}
771
+ />
772
+ }
773
+ className={clsx('query-builder__olap__column__context-menu', {
774
+ 'query-builder__olap__column--selected-from-context-menu':
775
+ isSelectedFromContextMenu,
776
+ })}
777
+ menuProps={{ elevation: 7 }}
778
+ onOpen={onContextMenuOpen}
779
+ onClose={onContextMenuClose}
780
+ >
781
+ <div className="query-builder__olap__column__drag-handle__container">
782
+ <div className="query-builder__olap__column__drag-handle">
783
+ <VerticalDragHandleIcon />
784
+ </div>
785
+ </div>
786
+ <div className="query-builder__olap__column__operation">
787
+ <div className="query-builder__olap__column__operation__operator">
788
+ <div
789
+ className={clsx(
790
+ 'query-builder__olap__column__operation__operator__label',
791
+ {
792
+ 'query-builder__olap__column__operation__operator__label__agg':
793
+ !aggregateColumn,
794
+ },
795
+ )}
796
+ >
797
+ {operationState.operator.getLabel()}
798
+ </div>
799
+ {aggregateColumn && (
800
+ <TDSColumnReferenceEditor
801
+ tdsColumn={aggregateColumn}
802
+ handleChange={handleOpDrop}
803
+ />
804
+ )}
805
+ <DropdownMenu
806
+ className="query-builder__olap__column__operation__operator__dropdown"
807
+ disabled={!operators.length}
808
+ content={
809
+ <MenuContent>
810
+ {operators.map((op) => (
811
+ <MenuContentItem
812
+ key={op.uuid}
813
+ className="query-builder__olap__column__operation__operator__dropdown__option"
814
+ onClick={changeOperator(op)}
815
+ >
816
+ {op.getLabel()}
817
+ </MenuContentItem>
818
+ ))}
819
+ </MenuContent>
820
+ }
821
+ menuProps={{
822
+ anchorOrigin: { vertical: 'bottom', horizontal: 'left' },
823
+ transformOrigin: { vertical: 'top', horizontal: 'left' },
824
+ elevation: 7,
825
+ }}
826
+ >
827
+ <button
828
+ className="query-builder__olap__column__operation__operator__badge"
829
+ tabIndex={-1}
830
+ title="Choose OLAP GroupBy Operator..."
831
+ >
832
+ <SigmaIcon />
833
+ </button>
834
+ <button
835
+ className="query-builder__olap__column__operation__operator__dropdown__trigger"
836
+ tabIndex={-1}
837
+ title="Choose OLAP GroupBy Operator..."
838
+ >
839
+ <CaretDownIcon />
840
+ </button>
841
+ </DropdownMenu>
842
+ </div>
843
+ </div>
844
+ <div className="query-builder__olap__column__window">
845
+ <button
846
+ ref={dropOpConnector}
847
+ title="Click to edit or drag and drop columns"
848
+ onClick={openWindowPopover}
849
+ className="query-builder__olap__column__window__content"
850
+ >
851
+ <PanelEntryDropZonePlaceholder
852
+ showPlaceholder={isDragOver}
853
+ label="Add"
854
+ className="query-builder__dnd__placeholder"
855
+ >
856
+ <div
857
+ title={`${olapColumnState.windowColumns.length} columns partitioned`}
858
+ className="query-builder__olap__column__window__content__label"
859
+ >
860
+ ({olapColumnState.windowColumns.length})
861
+ </div>
862
+ <div
863
+ className={clsx(
864
+ 'query-builder__olap__column__window__operator__badge',
865
+ )}
866
+ tabIndex={-1}
867
+ title="Edit window columns..."
868
+ >
869
+ <WindowIcon />
870
+ </div>
871
+ </PanelEntryDropZonePlaceholder>
872
+ </button>
873
+ <BasePopover
874
+ open={Boolean(anchorEl)}
875
+ anchorEl={anchorEl}
876
+ onClose={closeWindowPopover}
877
+ anchorOrigin={{
878
+ vertical: 'bottom',
879
+ horizontal: 'center',
880
+ }}
881
+ transformOrigin={{
882
+ vertical: 'top',
883
+ horizontal: 'center',
884
+ }}
885
+ >
886
+ <div className="query-builder__olap__column__window__popover">
887
+ <div className="panel__content__form__section__list">
888
+ <div className="panel__content__form__section__list__items">
889
+ {olapColumnState.windowColumns.map((value, idx) => (
890
+ <TDSColumnSelectorEditor
891
+ key={value.uuid}
892
+ colValue={value}
893
+ setColumn={(v: QueryBuilderTDSColumnState) =>
894
+ olapColumnState.changeWindow(v, idx)
895
+ }
896
+ deleteColumn={(v: QueryBuilderTDSColumnState): void =>
897
+ olapColumnState.deleteWindow(v)
898
+ }
899
+ tdsColOptions={windowOptions}
900
+ />
901
+ ))}
902
+ </div>
903
+ <div className="panel__content__form__section__list__new-item__add">
904
+ <button
905
+ className="panel__content__form__section__list__new-item__add-btn btn btn--dark"
906
+ disabled={!addWindowOptions.length}
907
+ onClick={addWindowValue}
908
+ tabIndex={-1}
909
+ >
910
+ Add Value
911
+ </button>
912
+ </div>
913
+ </div>
914
+ </div>
915
+ </BasePopover>
916
+ </div>
917
+ <div className="query-builder__olap__column__sortby">
918
+ <div className="query-builder__olap__column__sortby__operator">
919
+ {sortByState && (
920
+ <div className="query-builder__olap__column__sortby__operator__label">
921
+ {sortByState.sortType.toLowerCase()}
922
+ </div>
923
+ )}
924
+ {sortByState && (
925
+ <TDSColumnReferenceEditor
926
+ tdsColumn={sortByState.columnState}
927
+ handleChange={handleSortDrop}
928
+ />
929
+ )}
930
+ {!sortByState && (
931
+ <div className="query-builder__olap__column__sortby__none">
932
+ (none)
933
+ </div>
934
+ )}
935
+ <DropdownMenu
936
+ className="query-builder__olap__column__sortby__operator__dropdown"
937
+ content={
938
+ <MenuContent>
939
+ <MenuContentItem
940
+ key="none"
941
+ className="query-builder__olap__column__sortby__operator__dropdown__option"
942
+ onClick={changeSortBy(undefined)}
943
+ >
944
+ (none)
945
+ </MenuContentItem>
946
+
947
+ {Object.values(COLUMN_SORT_TYPE).map((op) => (
948
+ <MenuContentItem
949
+ key={op}
950
+ className="query-builder__olap__column__sortby__operator__dropdown__option"
951
+ onClick={changeSortBy(op)}
952
+ >
953
+ {op.toLowerCase()}
954
+ </MenuContentItem>
955
+ ))}
956
+ </MenuContent>
957
+ }
958
+ menuProps={{
959
+ anchorOrigin: { vertical: 'bottom', horizontal: 'left' },
960
+ transformOrigin: { vertical: 'top', horizontal: 'left' },
961
+ elevation: 7,
962
+ }}
963
+ >
964
+ <button
965
+ className={clsx(
966
+ 'query-builder__olap__column__sortby__operator__badge',
967
+ {
968
+ 'query-builder__olap__column__sortby__operator__badge--activated':
969
+ Boolean(sortByState),
970
+ },
971
+ )}
972
+ tabIndex={-1}
973
+ title="Choose OLAP SortBy Operator..."
974
+ >
975
+ <SortIcon />
976
+ </button>
977
+ <button
978
+ className="query-builder__olap__column__sortby__operator__dropdown__trigger"
979
+ tabIndex={-1}
980
+ title="Choose OLAP SortBy Operator..."
981
+ >
982
+ <CaretDownIcon />
983
+ </button>
984
+ </DropdownMenu>
985
+ </div>
986
+ </div>
987
+ <div className="query-builder__olap__column__name">
988
+ <InputWithInlineValidation
989
+ className="query-builder__olap__column__name__input input-group__input"
990
+ spellCheck={false}
991
+ value={olapColumnState.columnName}
992
+ onChange={changeColumnName}
993
+ validationErrorMessage={
994
+ isDuplicatedColumnName ? 'Duplicated column' : undefined
995
+ }
996
+ />
997
+ </div>
998
+ <div className="query-builder__olap__column__actions">
999
+ <button
1000
+ className="query-builder__olap__column__action"
1001
+ tabIndex={-1}
1002
+ onClick={editoColumn}
1003
+ >
1004
+ <EditIcon />
1005
+ </button>
1006
+ <button
1007
+ className="query-builder__olap__column__action"
1008
+ tabIndex={-1}
1009
+ onClick={removeColumn}
1010
+ disabled={isRemovalDisabled}
1011
+ title={
1012
+ isRemovalDisabled
1013
+ ? "This column is used in the post filter and can't be removed"
1014
+ : 'Remove'
1015
+ }
1016
+ >
1017
+ <TimesIcon />
1018
+ </button>
1019
+ </div>
1020
+ </ContextMenu>
1021
+ </PanelEntryDropZonePlaceholder>
1022
+ </div>
1023
+ );
1024
+ },
1025
+ );
1026
+
1027
+ export const QueryBuilderOlapGroupByPanel = observer(
1028
+ (props: { olapGroupByState: QueryBuilderOlapGroupByState }) => {
1029
+ const { olapGroupByState } = props;
1030
+ const applicationStore = useApplicationStore();
1031
+ const createOlapGroupBy = (): void => {
1032
+ const col = olapGroupByState.tdsState.tdsColumns[0];
1033
+ if (col) {
1034
+ const newOlapState = createOlapColumnState(
1035
+ col,
1036
+ olapGroupByState.tdsState,
1037
+ );
1038
+ olapGroupByState.setEditColumn(newOlapState);
1039
+ }
1040
+ };
1041
+ // Drag and Drop
1042
+ const handleDrop = useCallback(
1043
+ async (item: QueryBuilderOlapDropTarget): Promise<void> => {
1044
+ try {
1045
+ const newOlapState = createOlapColumnState(
1046
+ item.columnState,
1047
+ olapGroupByState.tdsState,
1048
+ );
1049
+ olapGroupByState.addOlapColumn(newOlapState);
1050
+ } catch (error) {
1051
+ assertErrorThrown(error);
1052
+ applicationStore.notifyError(error.message);
1053
+ return;
1054
+ }
1055
+ },
1056
+ [applicationStore, olapGroupByState],
1057
+ );
1058
+ const [{ isDragOver }, dropTargetConnector] = useDrop<
1059
+ QueryBuilderOlapDropTarget,
1060
+ void,
1061
+ { isDragOver: boolean }
1062
+ >(
1063
+ () => ({
1064
+ accept: [
1065
+ QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE,
1066
+ QUERY_BUILDER_OLAP_COLUMN_DND_TYPE,
1067
+ ],
1068
+ drop: (item, monitor): void => {
1069
+ if (!monitor.didDrop()) {
1070
+ handleDrop(item).catch(applicationStore.alertUnhandledError);
1071
+ } // prevent drop event propagation to accomondate for nested DnD
1072
+ },
1073
+ collect: (monitor) => ({
1074
+ isDragOver: monitor.isOver({ shallow: true }),
1075
+ }),
1076
+ }),
1077
+ [applicationStore, handleDrop],
1078
+ );
1079
+ return (
1080
+ <div
1081
+ data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_OLAP_GROUPBY}
1082
+ className="panel"
1083
+ >
1084
+ <div
1085
+ data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_OLAP_GROUPBY}
1086
+ className="panel"
1087
+ >
1088
+ <div className="panel__header">
1089
+ <div className="panel__header__title">
1090
+ <div className="panel__header__title__label">OLAP</div>
1091
+ </div>
1092
+ <div className="panel__header__actions">
1093
+ <button
1094
+ className="panel__header__action"
1095
+ onClick={createOlapGroupBy}
1096
+ disabled={!olapGroupByState.tdsState.tdsColumns.length}
1097
+ tabIndex={-1}
1098
+ title="Create OLAP GroupBy Column"
1099
+ >
1100
+ <PlusIcon />
1101
+ </button>
1102
+ </div>
1103
+ </div>
1104
+ <PanelContent>
1105
+ <PanelDropZone
1106
+ isDragOver={isDragOver}
1107
+ dropTargetConnector={dropTargetConnector}
1108
+ >
1109
+ {olapGroupByState.isEmpty && (
1110
+ <BlankPanelPlaceholder
1111
+ text="Add OLAP GroupBy Column"
1112
+ tooltipText="Drag and drop columns here"
1113
+ />
1114
+ )}
1115
+ {!olapGroupByState.isEmpty && (
1116
+ <div
1117
+ data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_TDS}
1118
+ className="query-builder__olap__columns"
1119
+ >
1120
+ {olapGroupByState.olapColumns.map((col) => (
1121
+ <QueryBuilderOlapGroupByColumnEditor
1122
+ olapColumnState={col}
1123
+ key={col.uuid}
1124
+ />
1125
+ ))}
1126
+ </div>
1127
+ )}
1128
+ </PanelDropZone>
1129
+ </PanelContent>
1130
+ {olapGroupByState.editColumn && (
1131
+ <QueryBuilderOlapColumnModalEditor
1132
+ olapGroupByState={olapGroupByState}
1133
+ olapColumnState={olapGroupByState.editColumn}
1134
+ />
1135
+ )}
1136
+ </div>
1137
+ </div>
1138
+ );
1139
+ },
1140
+ );