@finos/legend-query-builder 4.14.47 → 4.14.49

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. package/lib/__lib__/QueryBuilderDocumentation.d.ts +3 -1
  2. package/lib/__lib__/QueryBuilderDocumentation.d.ts.map +1 -1
  3. package/lib/__lib__/QueryBuilderDocumentation.js +2 -0
  4. package/lib/__lib__/QueryBuilderDocumentation.js.map +1 -1
  5. package/lib/components/QueryBuilder.d.ts +1 -1
  6. package/lib/components/QueryBuilder.d.ts.map +1 -1
  7. package/lib/components/QueryBuilder.js +59 -46
  8. package/lib/components/QueryBuilder.js.map +1 -1
  9. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts +1 -1
  10. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -1
  11. package/lib/components/QueryBuilderConstantExpressionPanel.js +22 -22
  12. package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
  13. package/lib/components/QueryBuilderDiffPanel.d.ts +2 -2
  14. package/lib/components/QueryBuilderDiffPanel.js +7 -6
  15. package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
  16. package/lib/components/QueryBuilderParametersPanel.d.ts +1 -1
  17. package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
  18. package/lib/components/QueryBuilderParametersPanel.js +29 -10
  19. package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
  20. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +3 -3
  21. package/lib/components/QueryBuilderPropertyExpressionEditor.js +14 -13
  22. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  23. package/lib/components/QueryBuilderSideBar.d.ts +2 -2
  24. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  25. package/lib/components/QueryBuilderSideBar.js +14 -24
  26. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  27. package/lib/components/QueryBuilderTextEditor.d.ts +1 -1
  28. package/lib/components/QueryBuilderTextEditor.js +8 -7
  29. package/lib/components/QueryBuilderTextEditor.js.map +1 -1
  30. package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts +1 -1
  31. package/lib/components/QueryBuilderUnsupportedQueryEditor.js +4 -3
  32. package/lib/components/QueryBuilderUnsupportedQueryEditor.js.map +1 -1
  33. package/lib/components/QueryChat.d.ts +1 -1
  34. package/lib/components/QueryChat.js +3 -2
  35. package/lib/components/QueryChat.js.map +1 -1
  36. package/lib/components/QueryLoader.d.ts +2 -2
  37. package/lib/components/QueryLoader.js +25 -24
  38. package/lib/components/QueryLoader.js.map +1 -1
  39. package/lib/components/QueryUsageViewer.d.ts +1 -1
  40. package/lib/components/QueryUsageViewer.js +4 -3
  41. package/lib/components/QueryUsageViewer.js.map +1 -1
  42. package/lib/components/ServiceQuerySetupUtils.js +4 -3
  43. package/lib/components/ServiceQuerySetupUtils.js.map +1 -1
  44. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js +3 -2
  45. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js.map +1 -1
  46. package/lib/components/data-access/DataAccessOverview.d.ts +1 -1
  47. package/lib/components/data-access/DataAccessOverview.js +17 -16
  48. package/lib/components/data-access/DataAccessOverview.js.map +1 -1
  49. package/lib/components/execution-plan/AllocationExecutionNodeViewer.js +4 -3
  50. package/lib/components/execution-plan/AllocationExecutionNodeViewer.js.map +1 -1
  51. package/lib/components/execution-plan/ConstantExecutionNodeViewer.js +3 -2
  52. package/lib/components/execution-plan/ConstantExecutionNodeViewer.js.map +1 -1
  53. package/lib/components/execution-plan/DataTypeResultTypeViewer.js +4 -3
  54. package/lib/components/execution-plan/DataTypeResultTypeViewer.js.map +1 -1
  55. package/lib/components/execution-plan/ExecutionPlanViewer.d.ts +3 -3
  56. package/lib/components/execution-plan/ExecutionPlanViewer.js +34 -33
  57. package/lib/components/execution-plan/ExecutionPlanViewer.js.map +1 -1
  58. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js +3 -2
  59. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js.map +1 -1
  60. package/lib/components/execution-plan/ImplementationViewer.js +4 -3
  61. package/lib/components/execution-plan/ImplementationViewer.js.map +1 -1
  62. package/lib/components/execution-plan/PartialClassResultViewer.js +3 -2
  63. package/lib/components/execution-plan/PartialClassResultViewer.js.map +1 -1
  64. package/lib/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.js +6 -5
  65. package/lib/components/execution-plan/RelationalClassQueryTempTableGraphFetchExecutionNodeViewer.js.map +1 -1
  66. package/lib/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.js +7 -6
  67. package/lib/components/execution-plan/RelationalCrossRootQueryTempTableGraphFetchExecutionNodeViewer.js.map +1 -1
  68. package/lib/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.js +6 -5
  69. package/lib/components/execution-plan/RelationalRootQueryTempTableGraphFetchExecutionNodeViewer.js.map +1 -1
  70. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.js +4 -3
  71. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.js.map +1 -1
  72. package/lib/components/execution-plan/ResultTypeViewer.js +5 -4
  73. package/lib/components/execution-plan/ResultTypeViewer.js.map +1 -1
  74. package/lib/components/execution-plan/SQLExecutionNodeViewer.js +7 -6
  75. package/lib/components/execution-plan/SQLExecutionNodeViewer.js.map +1 -1
  76. package/lib/components/execution-plan/SequenceExecutionNodeViewer.js +6 -5
  77. package/lib/components/execution-plan/SequenceExecutionNodeViewer.js.map +1 -1
  78. package/lib/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.js +6 -5
  79. package/lib/components/execution-plan/StoreMappingGlobalGraphFetchExecutionNodeViewer.js.map +1 -1
  80. package/lib/components/execution-plan/TDSResultTypeViewer.js +4 -3
  81. package/lib/components/execution-plan/TDSResultTypeViewer.js.map +1 -1
  82. package/lib/components/execution-plan/TempTableStrategyViewer.js +3 -2
  83. package/lib/components/execution-plan/TempTableStrategyViewer.js.map +1 -1
  84. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts +1 -1
  85. package/lib/components/explorer/QueryBuilderExplorerPanel.js +31 -30
  86. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  87. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts +1 -1
  88. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.js +20 -19
  89. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.js.map +1 -1
  90. package/lib/components/explorer/{QueryBuilderMilestoningEditor.d.ts → QueryBuilderMilestoningParameterEditor.d.ts} +6 -3
  91. package/lib/components/explorer/QueryBuilderMilestoningParameterEditor.d.ts.map +1 -0
  92. package/lib/components/explorer/QueryBuilderMilestoningParameterEditor.js +53 -0
  93. package/lib/components/explorer/QueryBuilderMilestoningParameterEditor.js.map +1 -0
  94. package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts +1 -1
  95. package/lib/components/explorer/QueryBuilderPropertySearchPanel.js +18 -17
  96. package/lib/components/explorer/QueryBuilderPropertySearchPanel.js.map +1 -1
  97. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts +1 -1
  98. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.js +9 -8
  99. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.js.map +1 -1
  100. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +3 -3
  101. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js +24 -23
  102. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js.map +1 -1
  103. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts +4 -3
  104. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  105. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +76 -54
  106. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  107. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts +1 -1
  108. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js +3 -2
  109. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js.map +1 -1
  110. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts +1 -1
  111. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  112. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +201 -29
  113. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  114. package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.js +9 -8
  115. package/lib/components/fetch-structure/QueryBuilderTDSComponentHelper.js.map +1 -1
  116. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts +1 -1
  117. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  118. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +55 -36
  119. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  120. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts +1 -1
  121. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +29 -28
  122. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
  123. package/lib/components/filter/QueryBuilderFilterPanel.d.ts +1 -1
  124. package/lib/components/filter/QueryBuilderFilterPanel.js +20 -19
  125. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  126. package/lib/components/result/QueryBuilderResultPanel.d.ts +2 -2
  127. package/lib/components/result/QueryBuilderResultPanel.d.ts.map +1 -1
  128. package/lib/components/result/QueryBuilderResultPanel.js +19 -17
  129. package/lib/components/result/QueryBuilderResultPanel.js.map +1 -1
  130. package/lib/components/result/tds/QueryBuilderTDSGridResult.d.ts +1 -1
  131. package/lib/components/result/tds/QueryBuilderTDSGridResult.js +11 -10
  132. package/lib/components/result/tds/QueryBuilderTDSGridResult.js.map +1 -1
  133. package/lib/components/result/tds/QueryBuilderTDSResultShared.js +5 -4
  134. package/lib/components/result/tds/QueryBuilderTDSResultShared.js.map +1 -1
  135. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.d.ts +1 -1
  136. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js +9 -8
  137. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js.map +1 -1
  138. package/lib/components/shared/BasicValueSpecificationEditor.js +38 -37
  139. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  140. package/lib/components/shared/CustomDatePicker.js +21 -20
  141. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  142. package/lib/components/shared/LambdaEditor.d.ts +2 -2
  143. package/lib/components/shared/LambdaEditor.js +14 -13
  144. package/lib/components/shared/LambdaEditor.js.map +1 -1
  145. package/lib/components/shared/LambdaParameterValuesEditor.d.ts +1 -1
  146. package/lib/components/shared/LambdaParameterValuesEditor.js +7 -6
  147. package/lib/components/shared/LambdaParameterValuesEditor.js.map +1 -1
  148. package/lib/components/shared/QueryBuilderPanelIssueCountBadge.js +4 -3
  149. package/lib/components/shared/QueryBuilderPanelIssueCountBadge.js.map +1 -1
  150. package/lib/components/shared/QueryBuilderPropertyInfoTooltip.js +10 -9
  151. package/lib/components/shared/QueryBuilderPropertyInfoTooltip.js.map +1 -1
  152. package/lib/components/shared/QueryBuilderRootClassInfoTooltip.js +4 -3
  153. package/lib/components/shared/QueryBuilderRootClassInfoTooltip.js.map +1 -1
  154. package/lib/components/shared/QueryBuilderVariableSelector.d.ts +2 -2
  155. package/lib/components/shared/QueryBuilderVariableSelector.d.ts.map +1 -1
  156. package/lib/components/shared/QueryBuilderVariableSelector.js +15 -7
  157. package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -1
  158. package/lib/components/workflows/ClassQueryBuilder.js +6 -5
  159. package/lib/components/workflows/ClassQueryBuilder.js.map +1 -1
  160. package/lib/components/workflows/MappingQueryBuilder.js +6 -5
  161. package/lib/components/workflows/MappingQueryBuilder.js.map +1 -1
  162. package/lib/components/workflows/ServiceQueryBuilder.js +6 -5
  163. package/lib/components/workflows/ServiceQueryBuilder.js.map +1 -1
  164. package/lib/graph-manager/QueryBuilderConfig.d.ts +4 -0
  165. package/lib/graph-manager/QueryBuilderConfig.d.ts.map +1 -1
  166. package/lib/graph-manager/QueryBuilderConfig.js +5 -0
  167. package/lib/graph-manager/QueryBuilderConfig.js.map +1 -1
  168. package/lib/index.css +2 -2
  169. package/lib/index.css.map +1 -1
  170. package/lib/package.json +1 -1
  171. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +2 -1
  172. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  173. package/lib/stores/QueryBuilderValueSpecificationHelper.js +3 -3
  174. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  175. package/lib/stores/QueryLoaderState.d.ts +1 -0
  176. package/lib/stores/QueryLoaderState.d.ts.map +1 -1
  177. package/lib/stores/QueryLoaderState.js +1 -0
  178. package/lib/stores/QueryLoaderState.js.map +1 -1
  179. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +1 -0
  180. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  181. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +8 -0
  182. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  183. package/lib/stores/fetch-structure/tds/aggregation/operators/QueryBuilderAggregateOperator_Percentile.d.ts.map +1 -1
  184. package/lib/stores/fetch-structure/tds/aggregation/operators/QueryBuilderAggregateOperator_Percentile.js +4 -2
  185. package/lib/stores/fetch-structure/tds/aggregation/operators/QueryBuilderAggregateOperator_Percentile.js.map +1 -1
  186. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  187. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +1 -1
  188. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  189. package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts.map +1 -1
  190. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +1 -1
  191. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -1
  192. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts +2 -0
  193. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts.map +1 -1
  194. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js +13 -2
  195. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js.map +1 -1
  196. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts +2 -0
  197. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts.map +1 -1
  198. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js +8 -1
  199. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js.map +1 -1
  200. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts +1 -1
  201. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts.map +1 -1
  202. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js +25 -1
  203. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js.map +1 -1
  204. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts +2 -0
  205. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts.map +1 -1
  206. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.js.map +1 -1
  207. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts +5 -0
  208. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -1
  209. package/lib/stores/milestoning/QueryBuilderMilestoningState.js +62 -3
  210. package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -1
  211. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts +2 -0
  212. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts.map +1 -1
  213. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js +8 -1
  214. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js.map +1 -1
  215. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +1 -0
  216. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
  217. package/lib/stores/shared/ValueSpecificationEditorHelper.js +7 -1
  218. package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
  219. package/package.json +4 -4
  220. package/src/__lib__/QueryBuilderDocumentation.ts +2 -0
  221. package/src/components/QueryBuilder.tsx +44 -0
  222. package/src/components/QueryBuilderConstantExpressionPanel.tsx +13 -4
  223. package/src/components/QueryBuilderParametersPanel.tsx +55 -0
  224. package/src/components/QueryBuilderSideBar.tsx +0 -42
  225. package/src/components/explorer/QueryBuilderMilestoningParameterEditor.tsx +114 -0
  226. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +143 -78
  227. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +445 -19
  228. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +134 -21
  229. package/src/components/result/QueryBuilderResultPanel.tsx +9 -1
  230. package/src/components/shared/QueryBuilderVariableSelector.tsx +22 -0
  231. package/src/graph-manager/QueryBuilderConfig.ts +6 -0
  232. package/src/stores/QueryBuilderValueSpecificationHelper.ts +4 -1
  233. package/src/stores/QueryLoaderState.ts +1 -0
  234. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +11 -0
  235. package/src/stores/fetch-structure/tds/aggregation/operators/QueryBuilderAggregateOperator_Percentile.ts +6 -2
  236. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +1 -0
  237. package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +1 -0
  238. package/src/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.ts +23 -0
  239. package/src/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.ts +13 -0
  240. package/src/stores/milestoning/QueryBuilderMilestoningHelper.ts +45 -0
  241. package/src/stores/milestoning/QueryBuilderMilestoningImplementation.ts +3 -0
  242. package/src/stores/milestoning/QueryBuilderMilestoningState.ts +95 -7
  243. package/src/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.ts +13 -0
  244. package/src/stores/shared/ValueSpecificationEditorHelper.ts +11 -0
  245. package/tsconfig.json +1 -1
  246. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +0 -1
  247. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +0 -102
  248. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +0 -1
  249. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +0 -364
@@ -33,6 +33,8 @@ import {
33
33
  PanelFormSection,
34
34
  ArrowUpIcon,
35
35
  ArrowDownIcon,
36
+ PanelFormBooleanField,
37
+ PanelFormListItems,
36
38
  } from '@finos/legend-art';
37
39
  import { SortColumnState } from '../../stores/fetch-structure/tds/QueryResultSetModifierState.js';
38
40
  import {
@@ -41,21 +43,36 @@ import {
41
43
  deepClone,
42
44
  deleteEntry,
43
45
  guaranteeNonNullable,
46
+ isNonNullable,
44
47
  } from '@finos/legend-shared';
45
48
  import { useApplicationStore } from '@finos/legend-application';
46
49
  import type { QueryBuilderTDSState } from '../../stores/fetch-structure/tds/QueryBuilderTDSState.js';
47
50
  import type { QueryBuilderTDSColumnState } from '../../stores/fetch-structure/tds/QueryBuilderTDSColumnState.js';
48
- import { COLUMN_SORT_TYPE } from '../../graph/QueryBuilderMetaModelConst.js';
51
+ import {
52
+ COLUMN_SORT_TYPE,
53
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
54
+ } from '../../graph/QueryBuilderMetaModelConst.js';
49
55
  import { useCallback, useEffect, useState } from 'react';
50
56
  import type { QueryBuilderProjectionColumnState } from '../../stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js';
51
57
  import { QUERY_BUILDER_TEST_ID } from '../../__lib__/QueryBuilderTesting.js';
52
- import { VariableSelector } from '../shared/QueryBuilderVariableSelector.js';
58
+ import {
59
+ VariableSelector,
60
+ VariableViewer,
61
+ } from '../shared/QueryBuilderVariableSelector.js';
53
62
  import {
54
63
  type ValueSpecification,
55
- type VariableExpression,
64
+ VariableExpression,
56
65
  PrimitiveType,
57
66
  Multiplicity,
58
67
  areMultiplicitiesEqual,
68
+ PRIMITIVE_TYPE,
69
+ MILESTONING_START_DATE_PARAMETER_NAME,
70
+ GenericType,
71
+ GenericTypeExplicitReference,
72
+ MILESTONING_END_DATE_PARAMETER_NAME,
73
+ getMilestoneTemporalStereotype,
74
+ BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
75
+ PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
59
76
  } from '@finos/legend-graph';
60
77
  import {
61
78
  BasicValueSpecificationEditor,
@@ -63,6 +80,9 @@ import {
63
80
  type QueryBuilderVariableDragSource,
64
81
  } from '../shared/BasicValueSpecificationEditor.js';
65
82
  import { useDrop } from 'react-dnd';
83
+ import { MilestoningParameterEditor } from '../explorer/QueryBuilderMilestoningParameterEditor.js';
84
+ import { QueryBuilderSimpleConstantExpressionState } from '../../stores/QueryBuilderConstantsState.js';
85
+ import { LambdaParameterState } from '../../stores/shared/LambdaParameterState.js';
66
86
 
67
87
  const ColumnSortEditor = observer(
68
88
  (props: {
@@ -275,21 +295,6 @@ export const QueryResultModifierModal = observer(
275
295
  stateSlice,
276
296
  ]);
277
297
 
278
- // Handle user actions
279
- const closeModal = (): void => resultSetModifierState.setShowModal(false);
280
- const applyChanges = (): void => {
281
- resultSetModifierState.setSortColumns(sortColumns);
282
- resultSetModifierState.setDistinct(distinct);
283
- resultSetModifierState.setLimit(limitResults);
284
- if (slice[0] !== undefined && slice[1] !== undefined) {
285
- resultSetModifierState.setSlice([slice[0], slice[1]]);
286
- } else {
287
- resultSetModifierState.setSlice(undefined);
288
- }
289
- resultSetModifierState.setShowModal(false);
290
- watermarkState.setValue(watermarkValue);
291
- };
292
-
293
298
  const handleLimitResultsChange: React.ChangeEventHandler<
294
299
  HTMLInputElement
295
300
  > = (event) => {
@@ -380,6 +385,292 @@ export const QueryResultModifierModal = observer(
380
385
  [handleDrop],
381
386
  );
382
387
 
388
+ //milestoning config
389
+ const isCompatibleMilestoningParameter = (
390
+ variable: VariableExpression,
391
+ ): boolean =>
392
+ variable.genericType?.value.rawType.name === PRIMITIVE_TYPE.STRICTDATE ||
393
+ variable.genericType?.value.rawType.name === PRIMITIVE_TYPE.LATESTDATE ||
394
+ variable.genericType?.value.rawType.name === PRIMITIVE_TYPE.DATE ||
395
+ variable.genericType?.value.rawType.name === PRIMITIVE_TYPE.DATETIME;
396
+
397
+ const milestoningState = tdsState.queryBuilderState.milestoningState;
398
+ const [parameterStates, setParameterStates] = useState(
399
+ milestoningState.queryBuilderState.parametersState.parameterStates,
400
+ );
401
+ const filteredParameterStates = parameterStates.filter((p) =>
402
+ isCompatibleMilestoningParameter(p.parameter),
403
+ );
404
+ const filteredConstantState =
405
+ milestoningState.queryBuilderState.constantState.constants.filter((c) =>
406
+ isCompatibleMilestoningParameter(c.variable),
407
+ );
408
+
409
+ const [isAllVersionsEnabled, setIsAllVersionsEnabled] = useState(
410
+ milestoningState.isAllVersionsEnabled,
411
+ );
412
+ const [isAllVersionsInRangeEnabled, setIsAllVersionsInRangeEnabled] =
413
+ useState(milestoningState.isAllVersionsInRangeEnabled);
414
+ const [businessDate, setBusinessDate] = useState(
415
+ milestoningState.businessDate,
416
+ );
417
+ const [processingDate, setProcessingDate] = useState(
418
+ milestoningState.processingDate,
419
+ );
420
+ const [startDate, setStartDate] = useState(milestoningState.startDate);
421
+ const [endDate, setEndDate] = useState(milestoningState.endDate);
422
+
423
+ const shouldFilterMilestoningParamIfNotUsed = (
424
+ param: ValueSpecification | undefined,
425
+ resetParameter: (val: ValueSpecification | undefined) => void,
426
+ ): ((lambdaParamState: LambdaParameterState) => boolean) => {
427
+ if (param && param instanceof VariableExpression) {
428
+ if (
429
+ !milestoningState.queryBuilderState.isVariableUsed(param, {
430
+ exculdeMilestoningState: true,
431
+ })
432
+ ) {
433
+ resetParameter(undefined);
434
+ return (lambdaParamState: LambdaParameterState) =>
435
+ lambdaParamState.parameter.name !== param.name;
436
+ }
437
+ }
438
+ return (lambdaParamState: LambdaParameterState) => true;
439
+ };
440
+
441
+ const setAllVersions = (value: boolean | undefined): void => {
442
+ if (value) {
443
+ //clean all unused milestoning parameters e.g. businessDate, ..., endDate.
444
+ setParameterStates([
445
+ ...parameterStates.filter(
446
+ (ps) =>
447
+ shouldFilterMilestoningParamIfNotUsed(
448
+ businessDate,
449
+ setBusinessDate,
450
+ )(ps) &&
451
+ shouldFilterMilestoningParamIfNotUsed(
452
+ processingDate,
453
+ setProcessingDate,
454
+ )(ps) &&
455
+ shouldFilterMilestoningParamIfNotUsed(
456
+ startDate,
457
+ setStartDate,
458
+ )(ps) &&
459
+ shouldFilterMilestoningParamIfNotUsed(endDate, setEndDate)(ps),
460
+ ),
461
+ ]);
462
+ } else {
463
+ //get or initialize getAll() parameters
464
+ setIsAllVersionsInRangeEnabled(false);
465
+ let newParamStates: LambdaParameterState[] = [];
466
+ if (
467
+ (!businessDate || !processingDate) &&
468
+ milestoningState.queryBuilderState.class
469
+ ) {
470
+ const stereotype = getMilestoneTemporalStereotype(
471
+ milestoningState.queryBuilderState.class,
472
+ milestoningState.queryBuilderState.graphManagerState.graph,
473
+ );
474
+ if (stereotype) {
475
+ const existingParamStates = parameterStates.map(
476
+ (ps) => ps.variableName,
477
+ );
478
+ newParamStates = milestoningState
479
+ .getMilestoningImplementation(stereotype)
480
+ .buildParameterStatesFromMilestoningParameters()
481
+ .filter((ps) => !existingParamStates.includes(ps.parameter.name));
482
+ }
483
+ }
484
+ const allParamStates = [...newParamStates, ...parameterStates].filter(
485
+ (ps) =>
486
+ shouldFilterMilestoningParamIfNotUsed(
487
+ startDate,
488
+ setStartDate,
489
+ )(ps) &&
490
+ shouldFilterMilestoningParamIfNotUsed(endDate, setEndDate)(ps),
491
+ );
492
+ setParameterStates(allParamStates);
493
+ if (!businessDate) {
494
+ setBusinessDate(
495
+ allParamStates.find(
496
+ (ps) =>
497
+ ps.variableName ===
498
+ (milestoningState.businessDate &&
499
+ milestoningState.businessDate instanceof VariableExpression
500
+ ? milestoningState.businessDate.name
501
+ : BUSINESS_DATE_MILESTONING_PROPERTY_NAME),
502
+ )?.parameter,
503
+ );
504
+ }
505
+ if (!processingDate) {
506
+ setProcessingDate(
507
+ allParamStates.find(
508
+ (ps) =>
509
+ ps.variableName ===
510
+ (milestoningState.businessDate &&
511
+ milestoningState.processingDate instanceof VariableExpression
512
+ ? milestoningState.processingDate.name
513
+ : PROCESSING_DATE_MILESTONING_PROPERTY_NAME),
514
+ )?.parameter,
515
+ );
516
+ }
517
+ }
518
+ setIsAllVersionsEnabled(Boolean(value));
519
+ };
520
+
521
+ const getOrCreateNewLambdaParameterState = (
522
+ lamdaStates: LambdaParameterState[],
523
+ varName: string,
524
+ ): LambdaParameterState => {
525
+ const lamdaState = lamdaStates.find((ls) => ls.variableName === varName);
526
+ if (lamdaState) {
527
+ return lamdaState;
528
+ } else {
529
+ const varExp = new VariableExpression(
530
+ varName,
531
+ Multiplicity.ONE,
532
+ GenericTypeExplicitReference.create(
533
+ new GenericType(PrimitiveType.DATE),
534
+ ),
535
+ );
536
+ const newParamState = new LambdaParameterState(
537
+ varExp,
538
+ milestoningState.queryBuilderState.observerContext,
539
+ milestoningState.queryBuilderState.graphManagerState.graph,
540
+ );
541
+ newParamState.mockParameterValue();
542
+ return newParamState;
543
+ }
544
+ };
545
+
546
+ const buildAllVersionsInRangeParameters = (): void => {
547
+ let startDateParameterState;
548
+ let endDateParameterState;
549
+ if (!(startDate && startDate instanceof VariableExpression)) {
550
+ startDateParameterState = getOrCreateNewLambdaParameterState(
551
+ parameterStates,
552
+ MILESTONING_START_DATE_PARAMETER_NAME,
553
+ );
554
+ setStartDate(startDateParameterState.parameter);
555
+ }
556
+ if (!(endDate && endDate instanceof VariableExpression)) {
557
+ endDateParameterState = getOrCreateNewLambdaParameterState(
558
+ parameterStates,
559
+ MILESTONING_END_DATE_PARAMETER_NAME,
560
+ );
561
+ setEndDate(endDateParameterState.parameter);
562
+ }
563
+ setParameterStates([
564
+ ...new Set([
565
+ ...parameterStates.filter(
566
+ (ps) =>
567
+ shouldFilterMilestoningParamIfNotUsed(
568
+ businessDate,
569
+ setBusinessDate,
570
+ )(ps) &&
571
+ shouldFilterMilestoningParamIfNotUsed(
572
+ processingDate,
573
+ setProcessingDate,
574
+ )(ps),
575
+ ),
576
+ ...[startDateParameterState, endDateParameterState].filter(
577
+ isNonNullable,
578
+ ),
579
+ ]),
580
+ ]);
581
+ };
582
+
583
+ const setAllVersionsInRange = (value: boolean | undefined): void => {
584
+ if (value) {
585
+ buildAllVersionsInRangeParameters();
586
+ } else {
587
+ setAllVersions(true);
588
+ }
589
+ setIsAllVersionsInRangeEnabled(Boolean(value));
590
+ };
591
+
592
+ const resetMilestoningConfig = (): void => {
593
+ setIsAllVersionsEnabled(milestoningState.isAllVersionsEnabled);
594
+ setIsAllVersionsInRangeEnabled(
595
+ milestoningState.isAllVersionsInRangeEnabled,
596
+ );
597
+ setStartDate(milestoningState.startDate);
598
+ setEndDate(milestoningState.endDate);
599
+ setBusinessDate(milestoningState.businessDate);
600
+ setProcessingDate(milestoningState.processingDate);
601
+ setParameterStates(
602
+ milestoningState.queryBuilderState.parametersState.parameterStates,
603
+ );
604
+ };
605
+
606
+ // Handle user actions
607
+ const closeModal = (): void => {
608
+ resetMilestoningConfig();
609
+ resultSetModifierState.setShowModal(false);
610
+ };
611
+
612
+ const applyChanges = (): void => {
613
+ resultSetModifierState.setSortColumns(sortColumns);
614
+ resultSetModifierState.setDistinct(distinct);
615
+ resultSetModifierState.setLimit(limitResults);
616
+ if (slice[0] !== undefined && slice[1] !== undefined) {
617
+ resultSetModifierState.setSlice([slice[0], slice[1]]);
618
+ } else {
619
+ resultSetModifierState.setSlice(undefined);
620
+ }
621
+ resultSetModifierState.setShowModal(false);
622
+ watermarkState.setValue(watermarkValue);
623
+ milestoningState.queryBuilderState.parametersState.setParameters(
624
+ parameterStates,
625
+ );
626
+ if (isAllVersionsInRangeEnabled) {
627
+ milestoningState.setStartDate(startDate);
628
+ milestoningState.setEndDate(endDate);
629
+ milestoningState.clearGetAllParameters();
630
+ milestoningState.queryBuilderState.setGetAllFunction(
631
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS_IN_RANGE,
632
+ );
633
+ } else if (isAllVersionsEnabled) {
634
+ milestoningState.clearGetAllParameters();
635
+ milestoningState.queryBuilderState.setGetAllFunction(
636
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS,
637
+ );
638
+ } else if (
639
+ tdsState.queryBuilderState.milestoningState.isMilestonedQuery
640
+ ) {
641
+ milestoningState.clearAllVersionsInRangeParameters();
642
+ milestoningState.setBusinessDate(businessDate);
643
+ milestoningState.setProcessingDate(processingDate);
644
+ milestoningState.queryBuilderState.setGetAllFunction(
645
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL,
646
+ );
647
+ }
648
+ milestoningState.updateQueryBuilderState();
649
+ };
650
+
651
+ useEffect(() => {
652
+ setIsAllVersionsEnabled(milestoningState.isAllVersionsEnabled);
653
+ setIsAllVersionsInRangeEnabled(
654
+ milestoningState.isAllVersionsInRangeEnabled,
655
+ );
656
+ setStartDate(milestoningState.startDate);
657
+ setEndDate(milestoningState.endDate);
658
+ setBusinessDate(milestoningState.businessDate);
659
+ setProcessingDate(milestoningState.processingDate);
660
+ setParameterStates(
661
+ milestoningState.queryBuilderState.parametersState.parameterStates,
662
+ );
663
+ }, [
664
+ milestoningState.isAllVersionsEnabled,
665
+ milestoningState.isAllVersionsInRangeEnabled,
666
+ milestoningState.queryBuilderState.parametersState.parameterStates,
667
+ milestoningState.businessDate,
668
+ milestoningState.processingDate,
669
+ milestoningState.startDate,
670
+ milestoningState.endDate,
671
+ milestoningState.queryBuilderState.class,
672
+ ]);
673
+
383
674
  return (
384
675
  <Dialog
385
676
  open={Boolean(resultSetModifierState.showModal)}
@@ -397,9 +688,144 @@ export const QueryResultModifierModal = observer(
397
688
  }
398
689
  className="editor-modal query-builder__projection__modal"
399
690
  >
400
- <ModalHeader title="Result Set Modifier" />
691
+ <ModalHeader title="Query Options" />
401
692
  <ModalBody className="query-builder__projection__modal__body">
402
693
  <div className="query-builder__projection__options">
694
+ {tdsState.queryBuilderState.milestoningState
695
+ .isMilestonedQuery && (
696
+ <>
697
+ <div className="query-builder__projection__options__section-name">
698
+ Milestoning
699
+ </div>
700
+ {milestoningState.isCurrentClassMilestoned && (
701
+ <PanelFormBooleanField
702
+ isReadOnly={false}
703
+ value={isAllVersionsEnabled}
704
+ name="all Versions"
705
+ prompt="Query All Milestoned Versions of the Root Class"
706
+ update={setAllVersions}
707
+ />
708
+ )}
709
+ {isAllVersionsEnabled &&
710
+ milestoningState.isCurrentClassSupportsVersionsInRange && (
711
+ <>
712
+ <PanelFormBooleanField
713
+ isReadOnly={false}
714
+ value={isAllVersionsInRangeEnabled}
715
+ name=" All Versions In Range"
716
+ prompt="Optionally apply a date range to get All Versions for"
717
+ update={setAllVersionsInRange}
718
+ />
719
+ {isAllVersionsInRangeEnabled &&
720
+ startDate &&
721
+ endDate && (
722
+ <div className="query-builder__milestoning-panel__all-versions-in-range-editor">
723
+ <PanelFormSection>
724
+ <div className="panel__content__form__section__header__label">
725
+ Start Date
726
+ </div>
727
+ <MilestoningParameterEditor
728
+ queryBuilderState={
729
+ milestoningState.queryBuilderState
730
+ }
731
+ parameter={startDate}
732
+ setParameter={setStartDate}
733
+ />
734
+ </PanelFormSection>
735
+ <PanelFormSection>
736
+ <div className="panel__content__form__section__header__label">
737
+ End Date
738
+ </div>
739
+ <MilestoningParameterEditor
740
+ queryBuilderState={
741
+ milestoningState.queryBuilderState
742
+ }
743
+ parameter={endDate}
744
+ setParameter={setEndDate}
745
+ />
746
+ </PanelFormSection>
747
+ </div>
748
+ )}
749
+ </>
750
+ )}
751
+ {!isAllVersionsEnabled && (
752
+ <>
753
+ {processingDate && (
754
+ <PanelFormSection>
755
+ <div className="panel__content__form__section__header__label">
756
+ Processing Date
757
+ </div>
758
+ <MilestoningParameterEditor
759
+ queryBuilderState={
760
+ milestoningState.queryBuilderState
761
+ }
762
+ parameter={processingDate}
763
+ setParameter={setProcessingDate}
764
+ />
765
+ </PanelFormSection>
766
+ )}
767
+ {businessDate && (
768
+ <PanelFormSection>
769
+ <div className="panel__content__form__section__header__label">
770
+ Business Date
771
+ </div>
772
+ <MilestoningParameterEditor
773
+ queryBuilderState={
774
+ milestoningState.queryBuilderState
775
+ }
776
+ parameter={businessDate}
777
+ setParameter={setBusinessDate}
778
+ />
779
+ </PanelFormSection>
780
+ )}
781
+ </>
782
+ )}
783
+ <PanelFormSection>
784
+ <div className="panel__content__form__section__header__label">
785
+ List of compatible milestoning parameters
786
+ </div>
787
+ </PanelFormSection>
788
+ <div className="panel__content__form__section__list__items">
789
+ <PanelFormListItems title="Available parameters">
790
+ {filteredParameterStates.length === 0 && (
791
+ <> No available parameters </>
792
+ )}
793
+ {filteredParameterStates.map((pState) => (
794
+ <VariableViewer
795
+ key={pState.uuid}
796
+ variable={pState.parameter}
797
+ isReadOnly={true}
798
+ queryBuilderState={milestoningState.queryBuilderState}
799
+ />
800
+ ))}
801
+ </PanelFormListItems>
802
+ {Boolean(filteredConstantState.length) && (
803
+ <PanelFormListItems title="Available constants">
804
+ {filteredConstantState.map((constantState) => (
805
+ <VariableViewer
806
+ key={constantState.uuid}
807
+ variable={constantState.variable}
808
+ value={{
809
+ val:
810
+ constantState instanceof
811
+ QueryBuilderSimpleConstantExpressionState
812
+ ? constantState.value
813
+ : undefined,
814
+ }}
815
+ queryBuilderState={
816
+ milestoningState.queryBuilderState
817
+ }
818
+ isReadOnly={true}
819
+ />
820
+ ))}
821
+ </PanelFormListItems>
822
+ )}
823
+ </div>
824
+ <div className="query-builder__projection__options__section-name">
825
+ Other
826
+ </div>
827
+ </>
828
+ )}
403
829
  <ColumnsSortEditor
404
830
  projectionColumns={tdsState.projectionColumns}
405
831
  sortColumns={sortColumns}