@finos/legend-query-builder 0.1.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (329) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +1 -1
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderComponentTestUtils.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderComponentTestUtils.js +1 -3
  6. package/lib/components/QueryBuilderComponentTestUtils.js.map +1 -1
  7. package/lib/components/QueryBuilderDiffPanel.js +1 -2
  8. package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
  9. package/lib/components/QueryBuilderParametersPanel.d.ts +1 -1
  10. package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
  11. package/lib/components/QueryBuilderParametersPanel.js +8 -5
  12. package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
  13. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  14. package/lib/components/QueryBuilderPropertyExpressionEditor.js +11 -8
  15. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  16. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  17. package/lib/components/QueryBuilderResultPanel.js +6 -4
  18. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  19. package/lib/components/QueryBuilderTextEditor.js +2 -2
  20. package/lib/components/QueryBuilderTextEditor.js.map +1 -1
  21. package/lib/components/QueryBuilder_TestID.d.ts +1 -0
  22. package/lib/components/QueryBuilder_TestID.d.ts.map +1 -1
  23. package/lib/components/QueryBuilder_TestID.js +1 -0
  24. package/lib/components/QueryBuilder_TestID.js.map +1 -1
  25. package/lib/components/explorer/QueryBuilderExplorerPanel.js +2 -2
  26. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  27. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  28. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +5 -4
  29. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  30. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  31. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +4 -2
  32. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  33. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +1 -1
  34. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  35. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  36. package/lib/components/filter/QueryBuilderFilterPanel.js +7 -4
  37. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  38. package/lib/components/shared/BasicValueSpecificationEditor.d.ts +53 -0
  39. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -0
  40. package/lib/components/shared/BasicValueSpecificationEditor.js +323 -0
  41. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -0
  42. package/lib/components/shared/CustomDatePicker.d.ts +39 -0
  43. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -0
  44. package/lib/components/shared/CustomDatePicker.js +622 -0
  45. package/lib/components/shared/CustomDatePicker.js.map +1 -0
  46. package/lib/components/shared/LambdaEditor.d.ts +92 -0
  47. package/lib/components/shared/LambdaEditor.d.ts.map +1 -0
  48. package/lib/components/shared/LambdaEditor.js +432 -0
  49. package/lib/components/shared/LambdaEditor.js.map +1 -0
  50. package/lib/{graphManager/protocol/pure/v1/V1_QueryBuilder_PropertyExpressionTypeInferenceBuilder.d.ts → components/shared/LambdaParameterValuesEditor.d.ts} +11 -3
  51. package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -0
  52. package/lib/components/shared/LambdaParameterValuesEditor.js +52 -0
  53. package/lib/components/shared/LambdaParameterValuesEditor.js.map +1 -0
  54. package/lib/components/shared/QueryBuilderLambdaEditor.d.ts +1 -1
  55. package/lib/components/shared/QueryBuilderLambdaEditor.d.ts.map +1 -1
  56. package/lib/components/shared/QueryBuilderLambdaEditor.js +3 -2
  57. package/lib/components/shared/QueryBuilderLambdaEditor.js.map +1 -1
  58. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
  59. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +1 -2
  60. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  61. package/lib/graphManager/protocol/pure/v1/{V1_QueryBuilder_FunctionExpressionBuilder.d.ts → V1_QueryValueSpecificationBuilderHelper.d.ts} +3 -2
  62. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -0
  63. package/lib/graphManager/protocol/pure/v1/{V1_QueryBuilder_FunctionExpressionBuilder.js → V1_QueryValueSpecificationBuilderHelper.js} +3 -2
  64. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -0
  65. package/lib/index.css +2 -2
  66. package/lib/index.css.map +1 -1
  67. package/lib/index.d.ts +7 -0
  68. package/lib/index.d.ts.map +1 -1
  69. package/lib/index.js +8 -0
  70. package/lib/index.js.map +1 -1
  71. package/lib/package.json +7 -10
  72. package/lib/stores/QueryBuilderMilestoningState.d.ts.map +1 -1
  73. package/lib/stores/QueryBuilderMilestoningState.js +6 -6
  74. package/lib/stores/QueryBuilderMilestoningState.js.map +1 -1
  75. package/lib/stores/QueryBuilderParametersState.d.ts +1 -1
  76. package/lib/stores/QueryBuilderParametersState.d.ts.map +1 -1
  77. package/lib/stores/QueryBuilderParametersState.js +1 -1
  78. package/lib/stores/QueryBuilderParametersState.js.map +1 -1
  79. package/lib/stores/QueryBuilderPropertyEditorState.d.ts.map +1 -1
  80. package/lib/stores/QueryBuilderPropertyEditorState.js +35 -38
  81. package/lib/stores/QueryBuilderPropertyEditorState.js.map +1 -1
  82. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  83. package/lib/stores/QueryBuilderResultState.js +2 -1
  84. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  85. package/lib/stores/QueryBuilderState.d.ts +2 -2
  86. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  87. package/lib/stores/QueryBuilderState.js +5 -5
  88. package/lib/stores/QueryBuilderState.js.map +1 -1
  89. package/lib/stores/QueryBuilderStateBuilder.js +1 -1
  90. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  91. package/lib/stores/QueryBuilderTextEditorState.d.ts +1 -1
  92. package/lib/stores/QueryBuilderTextEditorState.d.ts.map +1 -1
  93. package/lib/stores/QueryBuilderTextEditorState.js +2 -1
  94. package/lib/stores/QueryBuilderTextEditorState.js.map +1 -1
  95. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
  96. package/lib/stores/QueryBuilderValueSpecificationBuilder.js +2 -2
  97. package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
  98. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts.map +1 -1
  99. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +23 -20
  100. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -1
  101. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +1 -1
  102. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  103. package/lib/stores/QueryBuilderValueSpecificationHelper.js +10 -9
  104. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  105. package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
  106. package/lib/stores/explorer/QueryBuilderExplorerState.js +4 -3
  107. package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
  108. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +1 -1
  109. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  110. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js +1 -1
  111. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js.map +1 -1
  112. package/lib/stores/fetch-structure/graph-fetch/{QueryBuilderGraphFetchValueSpecificationBuilder.d.ts → QueryBuilderGraphFetchTreeValueSpecificationBuilder.d.ts} +1 -1
  113. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeValueSpecificationBuilder.d.ts.map +1 -0
  114. package/lib/stores/fetch-structure/graph-fetch/{QueryBuilderGraphFetchValueSpecificationBuilder.js → QueryBuilderGraphFetchTreeValueSpecificationBuilder.js} +1 -1
  115. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeValueSpecificationBuilder.js.map +1 -0
  116. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.d.ts +1 -1
  117. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
  118. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.js +3 -3
  119. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  120. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.js +1 -1
  121. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.js.map +1 -1
  122. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.js +4 -4
  123. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  124. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
  125. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js +6 -6
  126. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  127. package/lib/stores/fetch-structure/projection/aggregation/operators/{QueryBuilderAggregateOperatorHelper.d.ts → QueryBuilderAggregateOperatorValueSpecificationBuilder.d.ts} +2 -2
  128. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperatorValueSpecificationBuilder.d.ts.map +1 -0
  129. package/lib/stores/fetch-structure/projection/aggregation/operators/{QueryBuilderAggregateOperatorHelper.js → QueryBuilderAggregateOperatorValueSpecificationBuilder.js} +2 -2
  130. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperatorValueSpecificationBuilder.js.map +1 -0
  131. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Average.js +3 -3
  132. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Average.js.map +1 -1
  133. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Count.js +3 -3
  134. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Count.js.map +1 -1
  135. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Distinct.js +3 -3
  136. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Distinct.js.map +1 -1
  137. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.js +1 -1
  138. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.js.map +1 -1
  139. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_JoinString.js +1 -1
  140. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_JoinString.js.map +1 -1
  141. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Max.js +5 -5
  142. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Max.js.map +1 -1
  143. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Min.js +5 -5
  144. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Min.js.map +1 -1
  145. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Population.js +3 -3
  146. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Population.js.map +1 -1
  147. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Sample.js +3 -3
  148. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Sample.js.map +1 -1
  149. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Sum.js +3 -3
  150. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Sum.js.map +1 -1
  151. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.js +2 -2
  152. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -1
  153. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.d.ts +1 -1
  154. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.d.ts.map +1 -1
  155. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js +10 -10
  156. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js.map +1 -1
  157. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorHelper.d.ts +1 -4
  158. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorHelper.d.ts.map +1 -1
  159. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js +3 -46
  160. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js.map +1 -1
  161. package/{src/graphManager/protocol/pure/v1/V1_QueryBuilder_PropertyExpressionTypeInferenceBuilder.ts → lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.d.ts} +5 -13
  162. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.d.ts.map +1 -0
  163. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.js +61 -0
  164. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.js.map +1 -0
  165. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.d.ts.map +1 -1
  166. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +5 -4
  167. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js.map +1 -1
  168. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.d.ts.map +1 -1
  169. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +5 -4
  170. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js.map +1 -1
  171. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.d.ts.map +1 -1
  172. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +10 -8
  173. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
  174. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.d.ts.map +1 -1
  175. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +5 -4
  176. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
  177. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js +3 -3
  178. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js.map +1 -1
  179. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.js +3 -3
  180. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.js.map +1 -1
  181. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js +1 -1
  182. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js.map +1 -1
  183. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.d.ts.map +1 -1
  184. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +5 -4
  185. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
  186. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js +3 -3
  187. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js.map +1 -1
  188. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.d.ts.map +1 -1
  189. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +5 -4
  190. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
  191. package/lib/stores/filter/operators/{QueryBuilderFilterOperatorHelper.d.ts → QueryBuilderFilterOperatorValueSpecificationBuilder.d.ts} +1 -1
  192. package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.d.ts.map +1 -0
  193. package/lib/stores/filter/operators/{QueryBuilderFilterOperatorHelper.js → QueryBuilderFilterOperatorValueSpecificationBuilder.js} +11 -13
  194. package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.js.map +1 -0
  195. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.d.ts.map +1 -1
  196. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js +7 -6
  197. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js.map +1 -1
  198. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.d.ts.map +1 -1
  199. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js +7 -6
  200. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js.map +1 -1
  201. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.d.ts.map +1 -1
  202. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js +13 -11
  203. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js.map +1 -1
  204. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.d.ts.map +1 -1
  205. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js +8 -7
  206. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js.map +1 -1
  207. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.d.ts.map +1 -1
  208. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js +8 -7
  209. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js.map +1 -1
  210. package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js +6 -6
  211. package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js.map +1 -1
  212. package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.js +4 -4
  213. package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.js.map +1 -1
  214. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.d.ts.map +1 -1
  215. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js +8 -7
  216. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js.map +1 -1
  217. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.d.ts.map +1 -1
  218. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js +8 -7
  219. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js.map +1 -1
  220. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.d.ts.map +1 -1
  221. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js +7 -6
  222. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js.map +1 -1
  223. package/lib/stores/shared/LambdaEditorState.d.ts +40 -0
  224. package/lib/stores/shared/LambdaEditorState.d.ts.map +1 -0
  225. package/lib/stores/shared/LambdaEditorState.js +81 -0
  226. package/lib/stores/shared/LambdaEditorState.js.map +1 -0
  227. package/lib/stores/shared/LambdaParameterState.d.ts +62 -0
  228. package/lib/stores/shared/LambdaParameterState.d.ts.map +1 -0
  229. package/lib/stores/shared/LambdaParameterState.js +157 -0
  230. package/lib/stores/shared/LambdaParameterState.js.map +1 -0
  231. package/lib/{graphManager/protocol/pure/v1/V1_QueryBuilder_PropertyExpressionTypeInferenceBuilder.js → stores/shared/ValueSpecificationEditorHelper.d.ts} +5 -3
  232. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -0
  233. package/lib/stores/shared/ValueSpecificationEditorHelper.js +77 -0
  234. package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -0
  235. package/lib/stores/shared/ValueSpecificationModifierHelper.d.ts +33 -0
  236. package/lib/stores/shared/ValueSpecificationModifierHelper.d.ts.map +1 -0
  237. package/lib/stores/shared/ValueSpecificationModifierHelper.js +71 -0
  238. package/lib/stores/shared/ValueSpecificationModifierHelper.js.map +1 -0
  239. package/package.json +14 -17
  240. package/src/components/QueryBuilder.tsx +4 -1
  241. package/src/components/QueryBuilderComponentTestUtils.tsx +2 -2
  242. package/src/components/QueryBuilderDiffPanel.tsx +1 -1
  243. package/src/components/QueryBuilderParametersPanel.tsx +8 -7
  244. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +15 -12
  245. package/src/components/QueryBuilderResultPanel.tsx +8 -6
  246. package/src/components/QueryBuilderTextEditor.tsx +2 -2
  247. package/src/components/QueryBuilder_TestID.ts +2 -0
  248. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +2 -2
  249. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +5 -3
  250. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +6 -4
  251. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +1 -1
  252. package/src/components/filter/QueryBuilderFilterPanel.tsx +9 -6
  253. package/src/components/shared/BasicValueSpecificationEditor.tsx +837 -0
  254. package/src/components/shared/CustomDatePicker.tsx +1363 -0
  255. package/src/components/shared/LambdaEditor.tsx +858 -0
  256. package/src/components/shared/LambdaParameterValuesEditor.tsx +121 -0
  257. package/src/components/shared/QueryBuilderLambdaEditor.tsx +5 -5
  258. package/src/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +2 -2
  259. package/src/graphManager/protocol/pure/v1/{V1_QueryBuilder_FunctionExpressionBuilder.ts → V1_QueryValueSpecificationBuilderHelper.ts} +9 -1
  260. package/src/index.ts +11 -0
  261. package/src/stores/QueryBuilderMilestoningState.ts +7 -7
  262. package/src/stores/QueryBuilderParametersState.ts +4 -4
  263. package/src/stores/QueryBuilderPropertyEditorState.ts +49 -56
  264. package/src/stores/QueryBuilderResultState.ts +2 -4
  265. package/src/stores/QueryBuilderState.ts +5 -5
  266. package/src/stores/QueryBuilderStateBuilder.ts +1 -1
  267. package/src/stores/QueryBuilderTextEditorState.ts +2 -1
  268. package/src/stores/QueryBuilderValueSpecificationBuilder.ts +5 -2
  269. package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +30 -42
  270. package/src/stores/QueryBuilderValueSpecificationHelper.ts +13 -8
  271. package/src/stores/explorer/QueryBuilderExplorerState.ts +12 -2
  272. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +1 -1
  273. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.ts +3 -3
  274. package/src/stores/fetch-structure/graph-fetch/{QueryBuilderGraphFetchValueSpecificationBuilder.ts → QueryBuilderGraphFetchTreeValueSpecificationBuilder.ts} +0 -1
  275. package/src/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.ts +3 -3
  276. package/src/stores/fetch-structure/projection/QueryBuilderProjectionState.ts +1 -1
  277. package/src/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.ts +4 -4
  278. package/src/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +6 -9
  279. package/src/stores/fetch-structure/projection/aggregation/operators/{QueryBuilderAggregateOperatorHelper.ts → QueryBuilderAggregateOperatorValueSpecificationBuilder.ts} +1 -1
  280. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Average.ts +3 -3
  281. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Count.ts +3 -3
  282. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Distinct.ts +3 -3
  283. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.ts +1 -1
  284. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_JoinString.ts +1 -1
  285. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Max.ts +5 -5
  286. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Min.ts +5 -5
  287. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Population.ts +3 -3
  288. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Sample.ts +3 -3
  289. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Sum.ts +3 -3
  290. package/src/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.ts +2 -2
  291. package/src/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.ts +12 -10
  292. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorHelper.ts +2 -86
  293. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.ts +104 -0
  294. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +3 -3
  295. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +3 -3
  296. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +8 -7
  297. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +4 -4
  298. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.ts +3 -3
  299. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +2 -2
  300. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.ts +1 -1
  301. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +4 -4
  302. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.ts +3 -3
  303. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +3 -3
  304. package/src/stores/filter/operators/{QueryBuilderFilterOperatorHelper.ts → QueryBuilderFilterOperatorValueSpecificationBuilder.ts} +10 -11
  305. package/src/stores/filter/operators/QueryBuilderFilterOperator_Contain.ts +5 -5
  306. package/src/stores/filter/operators/QueryBuilderFilterOperator_EndWith.ts +5 -5
  307. package/src/stores/filter/operators/QueryBuilderFilterOperator_Equal.ts +11 -10
  308. package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.ts +7 -7
  309. package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.ts +7 -7
  310. package/src/stores/filter/operators/QueryBuilderFilterOperator_In.ts +5 -5
  311. package/src/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.ts +3 -3
  312. package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThan.ts +7 -7
  313. package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.ts +7 -7
  314. package/src/stores/filter/operators/QueryBuilderFilterOperator_StartWith.ts +5 -5
  315. package/src/stores/shared/LambdaEditorState.ts +118 -0
  316. package/src/stores/shared/LambdaParameterState.ts +259 -0
  317. package/src/stores/shared/ValueSpecificationEditorHelper.ts +143 -0
  318. package/src/stores/shared/ValueSpecificationModifierHelper.ts +177 -0
  319. package/tsconfig.json +14 -7
  320. package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_FunctionExpressionBuilder.d.ts.map +0 -1
  321. package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_FunctionExpressionBuilder.js.map +0 -1
  322. package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_PropertyExpressionTypeInferenceBuilder.d.ts.map +0 -1
  323. package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_PropertyExpressionTypeInferenceBuilder.js.map +0 -1
  324. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.d.ts.map +0 -1
  325. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.js.map +0 -1
  326. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperatorHelper.d.ts.map +0 -1
  327. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperatorHelper.js.map +0 -1
  328. package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.d.ts.map +0 -1
  329. package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.js.map +0 -1
@@ -0,0 +1,622 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) 2020-present, Goldman Sachs
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { BasePopover, BaseRadioGroup, CustomSelectorInput, } from '@finos/legend-art';
18
+ import { PRIMITIVE_TYPE, SimpleFunctionExpression, InstanceValue, GenericType, PrimitiveInstanceValue, GenericTypeExplicitReference, EnumValueExplicitReference, EnumValueInstanceValue, matchFunctionName, TYPICAL_MULTIPLICITY_TYPE, SUPPORTED_FUNCTIONS, DAY_OF_WEEK, DURATION_UNIT, } from '@finos/legend-graph';
19
+ import { guaranteeNonNullable, parseNumber, returnUndefOnError, UnsupportedOperationError, } from '@finos/legend-shared';
20
+ import { useEffect, useRef, useState } from 'react';
21
+ import { buildPrimitiveInstanceValue } from '../../stores/shared/ValueSpecificationEditorHelper.js';
22
+ import { functionExpression_addParameterValue, instanceValue_setValue, instanceValue_setValues, valueSpecification_setGenericType, } from '../../stores/shared/ValueSpecificationModifierHelper.js';
23
+ var CUSTOM_DATE_PICKER_OPTION;
24
+ (function (CUSTOM_DATE_PICKER_OPTION) {
25
+ CUSTOM_DATE_PICKER_OPTION["ABSOLUTE_DATE"] = "Absolute Date";
26
+ CUSTOM_DATE_PICKER_OPTION["ABSOLUTE_TIME"] = "Absolute Time";
27
+ CUSTOM_DATE_PICKER_OPTION["TODAY"] = "Today";
28
+ CUSTOM_DATE_PICKER_OPTION["NOW"] = "Now";
29
+ CUSTOM_DATE_PICKER_OPTION["YESTERDAY"] = "Yesterday";
30
+ CUSTOM_DATE_PICKER_OPTION["ONE_YEAR_AGO"] = "One Year Ago";
31
+ CUSTOM_DATE_PICKER_OPTION["ONE_MONTH_AGO"] = "One Month Ago";
32
+ CUSTOM_DATE_PICKER_OPTION["ONE_WEEK_AGO"] = "One Week Ago";
33
+ CUSTOM_DATE_PICKER_OPTION["CUSTOM_DATE"] = "Custom Date";
34
+ CUSTOM_DATE_PICKER_OPTION["PREVIOUS_DAY_OF_WEEK"] = "Previous ... of Week";
35
+ CUSTOM_DATE_PICKER_OPTION["FIRST_DAY_OF"] = "First day of...";
36
+ CUSTOM_DATE_PICKER_OPTION["LATEST_DATE"] = "Latest Date";
37
+ })(CUSTOM_DATE_PICKER_OPTION || (CUSTOM_DATE_PICKER_OPTION = {}));
38
+ var CUSTOM_DATE_OPTION_UNIT;
39
+ (function (CUSTOM_DATE_OPTION_UNIT) {
40
+ CUSTOM_DATE_OPTION_UNIT["DAYS"] = "Day(s)";
41
+ CUSTOM_DATE_OPTION_UNIT["WEEKS"] = "Week(s)";
42
+ CUSTOM_DATE_OPTION_UNIT["MONTHS"] = "Month(s)";
43
+ CUSTOM_DATE_OPTION_UNIT["YEARS"] = "Year(s)";
44
+ })(CUSTOM_DATE_OPTION_UNIT || (CUSTOM_DATE_OPTION_UNIT = {}));
45
+ var CUSTOM_DATE_FIRST_DAY_OF_UNIT;
46
+ (function (CUSTOM_DATE_FIRST_DAY_OF_UNIT) {
47
+ CUSTOM_DATE_FIRST_DAY_OF_UNIT["WEEK"] = "Week";
48
+ CUSTOM_DATE_FIRST_DAY_OF_UNIT["MONTH"] = "Month";
49
+ CUSTOM_DATE_FIRST_DAY_OF_UNIT["QUARTER"] = "Quarter";
50
+ CUSTOM_DATE_FIRST_DAY_OF_UNIT["YEAR"] = "Year";
51
+ })(CUSTOM_DATE_FIRST_DAY_OF_UNIT || (CUSTOM_DATE_FIRST_DAY_OF_UNIT = {}));
52
+ var CUSTOM_DATE_DAY_OF_WEEK;
53
+ (function (CUSTOM_DATE_DAY_OF_WEEK) {
54
+ CUSTOM_DATE_DAY_OF_WEEK["MONDAY"] = "Monday";
55
+ CUSTOM_DATE_DAY_OF_WEEK["TUESDAY"] = "Tuesday";
56
+ CUSTOM_DATE_DAY_OF_WEEK["WENDNESDAY"] = "Wednesday";
57
+ CUSTOM_DATE_DAY_OF_WEEK["THURSDAY"] = "Thursday";
58
+ CUSTOM_DATE_DAY_OF_WEEK["FRIDAY"] = "Friday";
59
+ CUSTOM_DATE_DAY_OF_WEEK["SATURDAY"] = "Saturday";
60
+ CUSTOM_DATE_DAY_OF_WEEK["SUNDAY"] = "Sunday";
61
+ })(CUSTOM_DATE_DAY_OF_WEEK || (CUSTOM_DATE_DAY_OF_WEEK = {}));
62
+ var CUSTOM_DATE_OPTION_DIRECTION;
63
+ (function (CUSTOM_DATE_OPTION_DIRECTION) {
64
+ CUSTOM_DATE_OPTION_DIRECTION["BEFORE"] = "Before";
65
+ CUSTOM_DATE_OPTION_DIRECTION["AFTER"] = "After";
66
+ })(CUSTOM_DATE_OPTION_DIRECTION || (CUSTOM_DATE_OPTION_DIRECTION = {}));
67
+ var CUSTOM_DATE_OPTION_REFERENCE_MOMENT;
68
+ (function (CUSTOM_DATE_OPTION_REFERENCE_MOMENT) {
69
+ CUSTOM_DATE_OPTION_REFERENCE_MOMENT["TODAY"] = "Today";
70
+ CUSTOM_DATE_OPTION_REFERENCE_MOMENT["NOW"] = "Now";
71
+ CUSTOM_DATE_OPTION_REFERENCE_MOMENT["FIRST_DAY_OF_YEAR"] = "Start of Year";
72
+ CUSTOM_DATE_OPTION_REFERENCE_MOMENT["FIRST_DAY_OF_QUARTER"] = "Start of Quarter";
73
+ CUSTOM_DATE_OPTION_REFERENCE_MOMENT["FIRST_DAY_OF_MONTH"] = "Start of Month";
74
+ CUSTOM_DATE_OPTION_REFERENCE_MOMENT["FIRST_DAY_OF_WEEK"] = "Start of Week";
75
+ })(CUSTOM_DATE_OPTION_REFERENCE_MOMENT || (CUSTOM_DATE_OPTION_REFERENCE_MOMENT = {}));
76
+ /**
77
+ * DatePickerOption is the base class being used to display and generate the corresponding pure date function.
78
+ */
79
+ class DatePickerOption {
80
+ /**
81
+ * label is the text that shows up in the valueSpecification box.
82
+ */
83
+ label;
84
+ /**
85
+ * value is the selected date option in date-dropdown.
86
+ */
87
+ value;
88
+ constructor(label, value) {
89
+ this.label = label;
90
+ this.value = value;
91
+ }
92
+ }
93
+ class CustomDateOption extends DatePickerOption {
94
+ /**
95
+ * duration is the amount of time span that will be adjusted.
96
+ */
97
+ duration;
98
+ /**
99
+ * unit represents the time duration unit, e.g. year, week, etc.
100
+ */
101
+ unit;
102
+ /**
103
+ * direction means the direction in which time adjustment will go to.
104
+ */
105
+ direction;
106
+ /**
107
+ * referenceMoment is the date which adjustment starts from.
108
+ */
109
+ referenceMoment;
110
+ constructor(label, value, duration, unit, direction, referenceMoment) {
111
+ super(label, value);
112
+ this.duration = duration;
113
+ this.unit = unit;
114
+ this.direction = direction;
115
+ this.referenceMoment = referenceMoment;
116
+ }
117
+ generateDisplayLabel() {
118
+ return [
119
+ this.duration,
120
+ this.unit,
121
+ this.direction,
122
+ this.referenceMoment,
123
+ ].join(' ');
124
+ }
125
+ updateLabel() {
126
+ this.label = this.generateDisplayLabel();
127
+ }
128
+ }
129
+ class CustomFirstDayOfOption extends DatePickerOption {
130
+ /**
131
+ * unit: time unit, e.g. Week, Month, etc.
132
+ */
133
+ unit;
134
+ constructor(label, unit) {
135
+ super(label, CUSTOM_DATE_PICKER_OPTION.FIRST_DAY_OF);
136
+ this.unit = unit;
137
+ }
138
+ }
139
+ class CustomPreviousDayOfWeekOption extends DatePickerOption {
140
+ /**
141
+ * day: which day in the week will be selected.
142
+ */
143
+ day;
144
+ constructor(label, day) {
145
+ super(label, CUSTOM_DATE_PICKER_OPTION.PREVIOUS_DAY_OF_WEEK);
146
+ this.day = day;
147
+ }
148
+ }
149
+ const reservedCustomDateOptions = [
150
+ new CustomDateOption('Yesterday', CUSTOM_DATE_PICKER_OPTION.YESTERDAY, 1, CUSTOM_DATE_OPTION_UNIT.DAYS, CUSTOM_DATE_OPTION_DIRECTION.BEFORE, CUSTOM_DATE_OPTION_REFERENCE_MOMENT.TODAY),
151
+ new CustomDateOption('One Week Ago', CUSTOM_DATE_PICKER_OPTION.ONE_WEEK_AGO, 1, CUSTOM_DATE_OPTION_UNIT.WEEKS, CUSTOM_DATE_OPTION_DIRECTION.BEFORE, CUSTOM_DATE_OPTION_REFERENCE_MOMENT.TODAY),
152
+ new CustomDateOption('One Month Ago', CUSTOM_DATE_PICKER_OPTION.ONE_MONTH_AGO, 1, CUSTOM_DATE_OPTION_UNIT.MONTHS, CUSTOM_DATE_OPTION_DIRECTION.BEFORE, CUSTOM_DATE_OPTION_REFERENCE_MOMENT.TODAY),
153
+ new CustomDateOption('One Year Ago', CUSTOM_DATE_PICKER_OPTION.ONE_YEAR_AGO, 1, CUSTOM_DATE_OPTION_UNIT.YEARS, CUSTOM_DATE_OPTION_DIRECTION.BEFORE, CUSTOM_DATE_OPTION_REFERENCE_MOMENT.TODAY),
154
+ ];
155
+ /**
156
+ * Generate pure date functions based on the DatePickerOption.
157
+ */
158
+ const buildPureDateFunctionExpression = (datePickerOption, graph, observerContext) => {
159
+ const multiplicityOne = graph.getTypicalMultiplicity(TYPICAL_MULTIPLICITY_TYPE.ONE);
160
+ const strictDate = graph.getPrimitiveType(PRIMITIVE_TYPE.STRICTDATE);
161
+ const date = graph.getPrimitiveType(PRIMITIVE_TYPE.DATE);
162
+ const dateTime = graph.getPrimitiveType(PRIMITIVE_TYPE.DATETIME);
163
+ if (datePickerOption instanceof CustomPreviousDayOfWeekOption) {
164
+ const previousFridaySFE = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.PREVIOUS_DAY_OF_WEEK, multiplicityOne);
165
+ valueSpecification_setGenericType(previousFridaySFE, GenericTypeExplicitReference.create(new GenericType(date)));
166
+ const dayOfWeekEnumIntanceValue = new EnumValueInstanceValue(GenericTypeExplicitReference.create(new GenericType(graph.getType(DAY_OF_WEEK))), multiplicityOne);
167
+ instanceValue_setValues(dayOfWeekEnumIntanceValue, [
168
+ ...dayOfWeekEnumIntanceValue.values,
169
+ EnumValueExplicitReference.create(guaranteeNonNullable(graph
170
+ .getEnumeration(DAY_OF_WEEK)
171
+ .values.filter((e) => e.name === datePickerOption.day)[0])),
172
+ ]);
173
+ functionExpression_addParameterValue(previousFridaySFE, dayOfWeekEnumIntanceValue, observerContext);
174
+ return previousFridaySFE;
175
+ }
176
+ else if (datePickerOption instanceof CustomFirstDayOfOption) {
177
+ switch (datePickerOption.unit) {
178
+ case CUSTOM_DATE_FIRST_DAY_OF_UNIT.YEAR: {
179
+ const firstDayOfYearSFE = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.FIRST_DAY_OF_YEAR, multiplicityOne);
180
+ valueSpecification_setGenericType(firstDayOfYearSFE, GenericTypeExplicitReference.create(new GenericType(date)));
181
+ return firstDayOfYearSFE;
182
+ }
183
+ case CUSTOM_DATE_FIRST_DAY_OF_UNIT.QUARTER: {
184
+ const firstDayOfQuarterSFE = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.FIRST_DAY_OF_QUARTER, multiplicityOne);
185
+ valueSpecification_setGenericType(firstDayOfQuarterSFE, GenericTypeExplicitReference.create(new GenericType(strictDate)));
186
+ return firstDayOfQuarterSFE;
187
+ }
188
+ case CUSTOM_DATE_FIRST_DAY_OF_UNIT.MONTH: {
189
+ const firstDayOfMonthSFE = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.FIRST_DAY_OF_MONTH, multiplicityOne);
190
+ valueSpecification_setGenericType(firstDayOfMonthSFE, GenericTypeExplicitReference.create(new GenericType(date)));
191
+ return firstDayOfMonthSFE;
192
+ }
193
+ case CUSTOM_DATE_FIRST_DAY_OF_UNIT.WEEK: {
194
+ const firstDayOfWeekSFE = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.FIRST_DAY_OF_WEEK, multiplicityOne);
195
+ valueSpecification_setGenericType(firstDayOfWeekSFE, GenericTypeExplicitReference.create(new GenericType(date)));
196
+ return firstDayOfWeekSFE;
197
+ }
198
+ default:
199
+ throw new UnsupportedOperationError(`Can't build expression for 'First Day Of ...' date picker option for unit '${datePickerOption.unit}'`);
200
+ }
201
+ }
202
+ else {
203
+ switch (datePickerOption.value) {
204
+ case CUSTOM_DATE_PICKER_OPTION.TODAY: {
205
+ const todaySFE = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.TODAY, multiplicityOne);
206
+ valueSpecification_setGenericType(todaySFE, GenericTypeExplicitReference.create(new GenericType(strictDate)));
207
+ return todaySFE;
208
+ }
209
+ case CUSTOM_DATE_PICKER_OPTION.NOW: {
210
+ const nowSFE = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.NOW, multiplicityOne);
211
+ valueSpecification_setGenericType(nowSFE, GenericTypeExplicitReference.create(new GenericType(dateTime)));
212
+ return nowSFE;
213
+ }
214
+ case CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_YEAR: {
215
+ const firstDayOfYearSFE = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.FIRST_DAY_OF_YEAR, multiplicityOne);
216
+ valueSpecification_setGenericType(firstDayOfYearSFE, GenericTypeExplicitReference.create(new GenericType(date)));
217
+ return firstDayOfYearSFE;
218
+ }
219
+ case CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_QUARTER: {
220
+ const firstDayOfQuarterSFE = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.FIRST_DAY_OF_QUARTER, multiplicityOne);
221
+ valueSpecification_setGenericType(firstDayOfQuarterSFE, GenericTypeExplicitReference.create(new GenericType(strictDate)));
222
+ return firstDayOfQuarterSFE;
223
+ }
224
+ case CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_MONTH: {
225
+ const firstDayOfMonthSFE = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.FIRST_DAY_OF_MONTH, multiplicityOne);
226
+ valueSpecification_setGenericType(firstDayOfMonthSFE, GenericTypeExplicitReference.create(new GenericType(date)));
227
+ return firstDayOfMonthSFE;
228
+ }
229
+ case CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_WEEK: {
230
+ const firstDayOfWeekSFE = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.FIRST_DAY_OF_WEEK, multiplicityOne);
231
+ valueSpecification_setGenericType(firstDayOfWeekSFE, GenericTypeExplicitReference.create(new GenericType(date)));
232
+ return firstDayOfWeekSFE;
233
+ }
234
+ default:
235
+ throw new UnsupportedOperationError(`Can't build expression for date picker option '${datePickerOption.value}'`);
236
+ }
237
+ }
238
+ };
239
+ /**
240
+ * Generate the enum value of type Pure Enum, DURATION_UNIT, based on the input string.
241
+ */
242
+ const buildPureDurationEnumValue = (unitString, graph) => {
243
+ const durationUnitEnum = graph.getEnumeration(DURATION_UNIT);
244
+ const targetPureDurationEnumValue = durationUnitEnum.values.filter((e) => e.name ===
245
+ Object.keys(CUSTOM_DATE_OPTION_UNIT).filter((key) => CUSTOM_DATE_OPTION_UNIT[key] === unitString)[0])[0];
246
+ return (targetPureDurationEnumValue ??
247
+ guaranteeNonNullable(durationUnitEnum.values[0]));
248
+ };
249
+ /**
250
+ * Generate the pure date ajust() function based on the CustomDateOption.
251
+ */
252
+ const buildPureAdjustDateFunction = (customDateOption, graph, observerContext) => {
253
+ const multiplicityOne = graph.getTypicalMultiplicity(TYPICAL_MULTIPLICITY_TYPE.ONE);
254
+ const dateAdjustSimpleFunctionExpression = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.ADJUST, multiplicityOne);
255
+ functionExpression_addParameterValue(dateAdjustSimpleFunctionExpression, buildPureDateFunctionExpression(new DatePickerOption(guaranteeNonNullable(customDateOption.referenceMoment), guaranteeNonNullable(customDateOption.referenceMoment)), graph, observerContext), observerContext);
256
+ if (customDateOption.direction === CUSTOM_DATE_OPTION_DIRECTION.BEFORE) {
257
+ const minusFunc = new SimpleFunctionExpression(SUPPORTED_FUNCTIONS.MINUS, multiplicityOne);
258
+ functionExpression_addParameterValue(minusFunc, buildPrimitiveInstanceValue(graph, PRIMITIVE_TYPE.INTEGER, customDateOption.duration), observerContext);
259
+ functionExpression_addParameterValue(dateAdjustSimpleFunctionExpression, minusFunc, observerContext);
260
+ }
261
+ else {
262
+ const adjustmentInstanceValue = buildPrimitiveInstanceValue(graph, PRIMITIVE_TYPE.INTEGER, customDateOption.duration);
263
+ functionExpression_addParameterValue(dateAdjustSimpleFunctionExpression, adjustmentInstanceValue, observerContext);
264
+ }
265
+ const durationUnitEnumIntanceValue = new EnumValueInstanceValue(GenericTypeExplicitReference.create(new GenericType(graph.getType(DURATION_UNIT))), multiplicityOne);
266
+ instanceValue_setValues(durationUnitEnumIntanceValue, [
267
+ ...durationUnitEnumIntanceValue.values,
268
+ EnumValueExplicitReference.create(guaranteeNonNullable(buildPureDurationEnumValue(guaranteeNonNullable(customDateOption.unit), graph))),
269
+ ]);
270
+ functionExpression_addParameterValue(dateAdjustSimpleFunctionExpression, durationUnitEnumIntanceValue, observerContext);
271
+ valueSpecification_setGenericType(dateAdjustSimpleFunctionExpression, GenericTypeExplicitReference.create(new GenericType(graph.getPrimitiveType(PRIMITIVE_TYPE.DATE))));
272
+ return dateAdjustSimpleFunctionExpression;
273
+ };
274
+ /**
275
+ * Generate the value of CustomDateOption.duration from the pure date adjust() function.
276
+ */
277
+ const buildCustomDateOptionDurationValue = (pureDateAdjustFunction) => {
278
+ const durationParam = pureDateAdjustFunction.parametersValues[1];
279
+ return durationParam instanceof PrimitiveInstanceValue
280
+ ? durationParam.values[0]
281
+ : durationParam instanceof SimpleFunctionExpression &&
282
+ matchFunctionName(durationParam.functionName, SUPPORTED_FUNCTIONS.MINUS)
283
+ ? durationParam.parametersValues[0] instanceof PrimitiveInstanceValue
284
+ ? durationParam.parametersValues[0].values[0]
285
+ : 0
286
+ : 0;
287
+ };
288
+ /**
289
+ * Generate the value of CustomDateOption.direction from the pure date adjust() function.
290
+ */
291
+ const buildCustomDateOptionDirectionValue = (pureDateAdjustFunction) => pureDateAdjustFunction.parametersValues[1] instanceof
292
+ SimpleFunctionExpression &&
293
+ matchFunctionName(pureDateAdjustFunction.parametersValues[1].functionName, SUPPORTED_FUNCTIONS.MINUS)
294
+ ? CUSTOM_DATE_OPTION_DIRECTION.BEFORE
295
+ : CUSTOM_DATE_OPTION_DIRECTION.AFTER;
296
+ /**
297
+ * Generate the value of CustomDateOption.unit from the pure date adjust() function.
298
+ */
299
+ const buildCustomDateOptionUnitValue = (valueSpecification) => guaranteeNonNullable(Object.keys(CUSTOM_DATE_OPTION_UNIT)
300
+ .filter((key) => key ===
301
+ valueSpecification.parametersValues[2]
302
+ .values[0]?.value.name)
303
+ .map((key) => CUSTOM_DATE_OPTION_UNIT[key])[0]);
304
+ /**
305
+ * Generate the value of CustomDateOption.moment from the pure date adjust() function.
306
+ */
307
+ const buildCustomDateOptionReferenceMomentValue = (pureDateAjustFunction) => {
308
+ const funcName = pureDateAjustFunction.parametersValues[0].functionName;
309
+ switch (funcName) {
310
+ case SUPPORTED_FUNCTIONS.TODAY:
311
+ return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.TODAY;
312
+ case SUPPORTED_FUNCTIONS.NOW:
313
+ return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.NOW;
314
+ case SUPPORTED_FUNCTIONS.FIRST_DAY_OF_YEAR:
315
+ return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_YEAR;
316
+ case SUPPORTED_FUNCTIONS.FIRST_DAY_OF_QUARTER:
317
+ return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_QUARTER;
318
+ case SUPPORTED_FUNCTIONS.FIRST_DAY_OF_MONTH:
319
+ return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_MONTH;
320
+ case SUPPORTED_FUNCTIONS.FIRST_DAY_OF_WEEK:
321
+ return CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_WEEK;
322
+ default:
323
+ throw new UnsupportedOperationError(`Can't build custom date option reference moment '${funcName}'`);
324
+ }
325
+ };
326
+ /**
327
+ * Build CustomDateOption based on the pure date adjust() function.
328
+ * Transform CustomDateOption if it matches any preserved custom adjust date functions. e.g. One Month Ago..
329
+ */
330
+ const buildCustomDateOption = (valueSpecification) => {
331
+ if (valueSpecification instanceof SimpleFunctionExpression &&
332
+ matchFunctionName(valueSpecification.functionName, SUPPORTED_FUNCTIONS.ADJUST)) {
333
+ const customDateOption = new CustomDateOption('', CUSTOM_DATE_PICKER_OPTION.CUSTOM_DATE, buildCustomDateOptionDurationValue(valueSpecification), buildCustomDateOptionUnitValue(valueSpecification), buildCustomDateOptionDirectionValue(valueSpecification), buildCustomDateOptionReferenceMomentValue(valueSpecification));
334
+ const matchedPreservedCustomAdjustDates = reservedCustomDateOptions.filter((t) => t.generateDisplayLabel() === customDateOption.generateDisplayLabel());
335
+ if (matchedPreservedCustomAdjustDates.length > 0) {
336
+ customDateOption.label = guaranteeNonNullable(matchedPreservedCustomAdjustDates[0]?.label);
337
+ customDateOption.value = guaranteeNonNullable(matchedPreservedCustomAdjustDates[0]?.value);
338
+ return customDateOption;
339
+ }
340
+ customDateOption.updateLabel();
341
+ return customDateOption;
342
+ }
343
+ return new CustomDateOption('', '', 0, undefined, undefined, undefined);
344
+ };
345
+ /**
346
+ * Build DatePickerOption from pure date functions or PrimitiveInstanceValue
347
+ */
348
+ const buildDatePickerOption = (valueSpecification) => {
349
+ if (valueSpecification instanceof SimpleFunctionExpression) {
350
+ switch (valueSpecification.functionName) {
351
+ case SUPPORTED_FUNCTIONS.TODAY:
352
+ return new DatePickerOption(CUSTOM_DATE_PICKER_OPTION.TODAY, CUSTOM_DATE_PICKER_OPTION.TODAY);
353
+ case SUPPORTED_FUNCTIONS.NOW:
354
+ return new DatePickerOption(CUSTOM_DATE_PICKER_OPTION.NOW, CUSTOM_DATE_PICKER_OPTION.NOW);
355
+ case SUPPORTED_FUNCTIONS.FIRST_DAY_OF_YEAR:
356
+ return new CustomFirstDayOfOption(CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_YEAR, CUSTOM_DATE_FIRST_DAY_OF_UNIT.YEAR);
357
+ case SUPPORTED_FUNCTIONS.FIRST_DAY_OF_QUARTER:
358
+ return new CustomFirstDayOfOption(CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_QUARTER, CUSTOM_DATE_FIRST_DAY_OF_UNIT.QUARTER);
359
+ case SUPPORTED_FUNCTIONS.FIRST_DAY_OF_MONTH:
360
+ return new CustomFirstDayOfOption(CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_MONTH, CUSTOM_DATE_FIRST_DAY_OF_UNIT.MONTH);
361
+ case SUPPORTED_FUNCTIONS.FIRST_DAY_OF_WEEK:
362
+ return new CustomFirstDayOfOption(CUSTOM_DATE_OPTION_REFERENCE_MOMENT.FIRST_DAY_OF_WEEK, CUSTOM_DATE_FIRST_DAY_OF_UNIT.WEEK);
363
+ case SUPPORTED_FUNCTIONS.PREVIOUS_DAY_OF_WEEK:
364
+ return new CustomPreviousDayOfWeekOption(`Previous ${valueSpecification.parametersValues[0]
365
+ .values[0]?.value.name}`, valueSpecification.parametersValues[0]
366
+ .values[0]?.value.name);
367
+ case SUPPORTED_FUNCTIONS.ADJUST:
368
+ return buildCustomDateOption(valueSpecification);
369
+ default:
370
+ return new DatePickerOption('', '');
371
+ }
372
+ }
373
+ else {
374
+ return valueSpecification.genericType.value.rawType.path ===
375
+ PRIMITIVE_TYPE.LATESTDATE
376
+ ? new DatePickerOption(CUSTOM_DATE_PICKER_OPTION.LATEST_DATE, CUSTOM_DATE_PICKER_OPTION.LATEST_DATE)
377
+ : new DatePickerOption(valueSpecification.values[0], valueSpecification.genericType.value.rawType.path ===
378
+ PRIMITIVE_TYPE.DATETIME
379
+ ? CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_TIME
380
+ : CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_DATE);
381
+ }
382
+ };
383
+ const AbsoluteDateValueSpecificationEditor = (props) => {
384
+ const { valueSpecification, graph, setValueSpecification, setDatePickerOption, } = props;
385
+ const inputRef = useRef(null);
386
+ const absoluteDateValue = valueSpecification instanceof SimpleFunctionExpression
387
+ ? ''
388
+ : valueSpecification.values[0];
389
+ const updateAbsoluteDateValue = (event) => {
390
+ if (valueSpecification instanceof SimpleFunctionExpression) {
391
+ setValueSpecification(buildPrimitiveInstanceValue(graph, PRIMITIVE_TYPE.STRICTDATE, event.target.value));
392
+ }
393
+ else if (valueSpecification instanceof InstanceValue) {
394
+ instanceValue_setValue(valueSpecification, event.target.value, 0);
395
+ if (valueSpecification.genericType.value.rawType.path !==
396
+ PRIMITIVE_TYPE.STRICTDATE) {
397
+ valueSpecification_setGenericType(valueSpecification, GenericTypeExplicitReference.create(new GenericType(graph.getPrimitiveType(PRIMITIVE_TYPE.STRICTDATE))));
398
+ }
399
+ setValueSpecification(valueSpecification);
400
+ }
401
+ setDatePickerOption(new DatePickerOption(event.target.value, CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_DATE));
402
+ };
403
+ useEffect(() => {
404
+ inputRef.current?.focus();
405
+ }, []);
406
+ return (_jsx("div", { className: "value-spec-editor__date-picker__absolute-date", children: _jsx("input", { ref: inputRef, className: "panel__content__form__section__input value-spec-editor__date-picker__absolute-date__input input--dark", type: "date", spellCheck: false, value: absoluteDateValue, onChange: updateAbsoluteDateValue }) }));
407
+ };
408
+ const AbsoluteTimeValueSpecificationEditor = (props) => {
409
+ const { valueSpecification, graph, setValueSpecification, setDatePickerOption, } = props;
410
+ const inputRef = useRef(null);
411
+ const absoluteTimeValue = valueSpecification instanceof SimpleFunctionExpression
412
+ ? ''
413
+ : valueSpecification.values[0];
414
+ const updateAbsoluteTimeValue = (event) => {
415
+ if (valueSpecification instanceof SimpleFunctionExpression) {
416
+ setValueSpecification(buildPrimitiveInstanceValue(graph, PRIMITIVE_TYPE.DATETIME, event.target.value));
417
+ }
418
+ else {
419
+ instanceValue_setValue(valueSpecification, event.target.value, 0);
420
+ if (valueSpecification.genericType.value.rawType.path !==
421
+ PRIMITIVE_TYPE.DATETIME) {
422
+ valueSpecification_setGenericType(valueSpecification, GenericTypeExplicitReference.create(new GenericType(graph.getPrimitiveType(PRIMITIVE_TYPE.DATETIME))));
423
+ }
424
+ setValueSpecification(valueSpecification);
425
+ }
426
+ setDatePickerOption(new DatePickerOption(event.target.value, CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_TIME));
427
+ };
428
+ useEffect(() => {
429
+ inputRef.current?.focus();
430
+ }, []);
431
+ return (_jsx("div", { className: "value-spec-editor__date-picker__absolute-date", children: _jsx("input", { ref: inputRef, className: "panel__content__form__section__input value-spec-editor__date-picker__absolute-date__input input--dark",
432
+ // Despite its name this would actually allow us to register time in UTC
433
+ // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local#setting_timezones
434
+ type: "datetime-local", spellCheck: false, value: absoluteTimeValue, onChange: updateAbsoluteTimeValue }) }));
435
+ };
436
+ const CustomDateInstanceValueEditor = (props) => {
437
+ const { customDateOptionValue, graph, setValueSpecification, setDatePickerOption, observerContext, } = props;
438
+ const inputRef = useRef(null);
439
+ const [durationValue, setDurationValue] = useState(customDateOptionValue.duration);
440
+ const [unitValue, setUnitValue] = useState(customDateOptionValue.unit ?? CUSTOM_DATE_OPTION_UNIT.DAYS);
441
+ const [directionValue, setDirectionValue] = useState(customDateOptionValue.direction ?? CUSTOM_DATE_OPTION_DIRECTION.BEFORE);
442
+ const [referenceMomentValue, setReferenceMomentValueValue] = useState(customDateOptionValue.referenceMoment ??
443
+ CUSTOM_DATE_OPTION_REFERENCE_MOMENT.TODAY);
444
+ const changeValue = (latestDurationValue, latestUnitValue, latestDirectionValue, latestReferenceMomentValue) => {
445
+ if (latestDurationValue !== 0 &&
446
+ latestUnitValue !== '' &&
447
+ latestDirectionValue !== '' &&
448
+ latestReferenceMomentValue !== '') {
449
+ const dateOption = new CustomDateOption(CUSTOM_DATE_PICKER_OPTION.CUSTOM_DATE, CUSTOM_DATE_PICKER_OPTION.CUSTOM_DATE, latestDurationValue, latestUnitValue, latestDirectionValue, latestReferenceMomentValue);
450
+ setValueSpecification(buildPureAdjustDateFunction(dateOption, graph, observerContext));
451
+ const matchedPreservedCustomAdjustDates = reservedCustomDateOptions.filter((t) => t.generateDisplayLabel() === dateOption.generateDisplayLabel());
452
+ if (matchedPreservedCustomAdjustDates.length > 0) {
453
+ dateOption.label = guaranteeNonNullable(matchedPreservedCustomAdjustDates[0]?.label);
454
+ dateOption.value = guaranteeNonNullable(matchedPreservedCustomAdjustDates[0]?.value);
455
+ }
456
+ else {
457
+ dateOption.updateLabel();
458
+ }
459
+ setDatePickerOption(dateOption);
460
+ }
461
+ };
462
+ const changeDurationValue = (event) => {
463
+ const duration = event.target.value !== ''
464
+ ? returnUndefOnError(() => parseNumber(event.target.value)) ?? 0
465
+ : 0;
466
+ setDurationValue(duration);
467
+ changeValue(duration, unitValue, directionValue, referenceMomentValue);
468
+ };
469
+ useEffect(() => {
470
+ inputRef.current?.focus();
471
+ }, []);
472
+ return (_jsxs("div", { className: "value-spec-editor__date-picker__custom-date", children: [_jsx("div", { className: "value-spec-editor__date-picker__custom-date__input", children: _jsx("input", { ref: inputRef, className: "value-spec-editor__date-picker__custom-date__input-text-editor input--dark", spellCheck: false, value: durationValue, type: "number", onChange: changeDurationValue }) }), _jsx("div", { className: "value-spec-editor__date-picker__custom-date__input", children: _jsx(CustomSelectorInput, { placeholder: "Unit", className: "value-spec-editor__date-picker__custom-date__input-dropdown", options: Object.values(CUSTOM_DATE_OPTION_UNIT).map((t) => ({
473
+ value: t.toString(),
474
+ label: t.toString(),
475
+ })), onChange: (val) => {
476
+ setUnitValue(val.value);
477
+ changeValue(durationValue, val.value, directionValue, referenceMomentValue);
478
+ }, value: { value: unitValue, label: unitValue }, darkMode: true }) }), _jsx("div", { className: "value-spec-editor__date-picker__custom-date__input", children: _jsx(CustomSelectorInput, { className: "value-spec-editor__date-picker__custom-date__input-dropdown", options: Object.values(CUSTOM_DATE_OPTION_DIRECTION).map((t) => ({
479
+ value: t.toString(),
480
+ label: t.toString(),
481
+ })), onChange: (val) => {
482
+ setDirectionValue(val.value);
483
+ changeValue(durationValue, unitValue, val.value, referenceMomentValue);
484
+ }, value: { value: directionValue, label: directionValue }, darkMode: true }) }), _jsx("div", { className: "value-spec-editor__date-picker__custom-date__input", children: _jsx(CustomSelectorInput, { className: "value-spec-editor__date-picker__custom-date__input-dropdown", options: Object.values(CUSTOM_DATE_OPTION_REFERENCE_MOMENT).map((t) => ({
485
+ value: t.toString(),
486
+ label: t.toString(),
487
+ })), onChange: (val) => {
488
+ setReferenceMomentValueValue(val.value);
489
+ changeValue(durationValue, unitValue, directionValue, val.value);
490
+ }, value: { value: referenceMomentValue, label: referenceMomentValue }, darkMode: true }) })] }));
491
+ };
492
+ const CustomFirstDayOfValueSpecificationEditor = (props) => {
493
+ const { customDateAdjustOptionValue, graph, observerContext, setValueSpecification, setDatePickerOption, } = props;
494
+ const selectorRef = useRef(null);
495
+ const [unitValue, setUnitValue] = useState(customDateAdjustOptionValue instanceof CustomFirstDayOfOption
496
+ ? customDateAdjustOptionValue.unit
497
+ : null);
498
+ const changeValue = (latestUnitValue) => {
499
+ if (latestUnitValue !== '') {
500
+ const targetUnitValue = Object.values(CUSTOM_DATE_OPTION_REFERENCE_MOMENT).filter((moment) => moment.toString().includes(latestUnitValue));
501
+ const startDayOfDateOption = targetUnitValue.length > 0
502
+ ? new CustomFirstDayOfOption(guaranteeNonNullable(targetUnitValue[0]?.toString()), latestUnitValue)
503
+ : new CustomFirstDayOfOption('', undefined);
504
+ setValueSpecification(buildPureDateFunctionExpression(startDayOfDateOption, graph, observerContext));
505
+ setDatePickerOption(startDayOfDateOption);
506
+ }
507
+ };
508
+ useEffect(() => {
509
+ selectorRef.current?.focus();
510
+ }, []);
511
+ return (_jsx("div", { className: "value-spec-editor__date-picker__custom-date", children: _jsx("div", { className: "value-spec-editor__date-picker__custom-date__input", children: _jsx(CustomSelectorInput, { ref: selectorRef, placeholder: "Choose a unit...", className: "value-spec-editor__date-picker__custom-date__input-dropdown value-spec-editor__date-picker__custom-date__input-dropdown--full", options: Object.values(CUSTOM_DATE_FIRST_DAY_OF_UNIT).map((t) => ({
512
+ value: t.toString(),
513
+ label: t.toString(),
514
+ })), onChange: (val) => {
515
+ if (val) {
516
+ setUnitValue(val.value);
517
+ changeValue(val.value);
518
+ }
519
+ }, value: unitValue ? { value: unitValue, label: unitValue } : null, darkMode: true }) }) }));
520
+ };
521
+ const CustomPreviousDayOfWeekValueSpecificationEditor = (props) => {
522
+ const { customDateAdjustOptionValue, graph, observerContext, setValueSpecification, setDatePickerOption, } = props;
523
+ const selectorRef = useRef(null);
524
+ const [dayOfWeekValue, setDayOfWeekValue] = useState(customDateAdjustOptionValue instanceof CustomPreviousDayOfWeekOption
525
+ ? customDateAdjustOptionValue.day
526
+ : null);
527
+ const changeValue = (latestDurationUnitValue) => {
528
+ if (latestDurationUnitValue !== '') {
529
+ const previousDayOfWeekDateOption = new CustomPreviousDayOfWeekOption(`Previous ${latestDurationUnitValue}`, latestDurationUnitValue);
530
+ setValueSpecification(buildPureDateFunctionExpression(previousDayOfWeekDateOption, graph, observerContext));
531
+ setDatePickerOption(previousDayOfWeekDateOption);
532
+ }
533
+ };
534
+ useEffect(() => {
535
+ selectorRef.current?.focus();
536
+ }, []);
537
+ return (_jsx("div", { className: "value-spec-editor__date-picker__custom-date", children: _jsx("div", { className: "value-spec-editor__date-picker__custom-date__input", children: _jsx(CustomSelectorInput, { ref: selectorRef, placeholder: "Choose a day...", className: "value-spec-editor__date-picker__custom-date__input-dropdown value-spec-editor__date-picker__custom-date__input-dropdown--full", options: Object.values(CUSTOM_DATE_DAY_OF_WEEK).map((t) => ({
538
+ value: t.toString(),
539
+ label: t.toString(),
540
+ })), onChange: (val) => {
541
+ if (val) {
542
+ setDayOfWeekValue(val.value);
543
+ changeValue(val.value);
544
+ }
545
+ }, value: dayOfWeekValue
546
+ ? { value: dayOfWeekValue, label: dayOfWeekValue }
547
+ : null, darkMode: true }) }) }));
548
+ };
549
+ export const CustomDatePicker = (props) => {
550
+ const { valueSpecification, setValueSpecification, graph, observerContext, typeCheckOption, } = props;
551
+ // For some cases where types need to be matched strictly.
552
+ // Some options need to be filtered out for DateTime.
553
+ const targetDateOptionsEnum = typeCheckOption.match
554
+ ? Object.values([
555
+ CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_TIME,
556
+ CUSTOM_DATE_PICKER_OPTION.NOW,
557
+ ])
558
+ : Object.values(CUSTOM_DATE_PICKER_OPTION);
559
+ const [datePickerOption, setDatePickerOption] = useState(buildDatePickerOption(valueSpecification));
560
+ const [anchorEl, setAnchorEl] = useState(null);
561
+ const openCustomDatePickerPopover = (event) => {
562
+ setAnchorEl(event.currentTarget);
563
+ };
564
+ const handleEnter = () => {
565
+ setDatePickerOption(buildDatePickerOption(valueSpecification));
566
+ };
567
+ const closeCustomDatePickerPopover = () => {
568
+ setDatePickerOption(buildDatePickerOption(valueSpecification));
569
+ setAnchorEl(null);
570
+ };
571
+ const handleDatePickerOptionChange = (event) => {
572
+ const chosenDatePickerOption = new DatePickerOption(event.target.value, event.target.value);
573
+ if (CUSTOM_DATE_PICKER_OPTION.LATEST_DATE === chosenDatePickerOption.value) {
574
+ setValueSpecification(buildPrimitiveInstanceValue(graph, PRIMITIVE_TYPE.LATESTDATE, event.target.value));
575
+ }
576
+ else if (
577
+ // Elements in this list will trigger children date components
578
+ ![
579
+ CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_DATE,
580
+ CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_TIME,
581
+ CUSTOM_DATE_PICKER_OPTION.CUSTOM_DATE,
582
+ CUSTOM_DATE_PICKER_OPTION.FIRST_DAY_OF,
583
+ CUSTOM_DATE_PICKER_OPTION.PREVIOUS_DAY_OF_WEEK,
584
+ ].includes(chosenDatePickerOption.value)) {
585
+ const theReservedCustomDateOption = reservedCustomDateOptions.filter((d) => d.value === chosenDatePickerOption.value);
586
+ theReservedCustomDateOption.length > 0
587
+ ? setValueSpecification(buildPureAdjustDateFunction(guaranteeNonNullable(theReservedCustomDateOption[0]), graph, observerContext))
588
+ : setValueSpecification(buildPureDateFunctionExpression(chosenDatePickerOption, graph, observerContext));
589
+ }
590
+ setDatePickerOption(chosenDatePickerOption);
591
+ };
592
+ const renderChildrenDateComponents = () => {
593
+ switch (datePickerOption.value) {
594
+ case CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_DATE:
595
+ return (_jsx(AbsoluteDateValueSpecificationEditor, { graph: graph, valueSpecification: valueSpecification, setValueSpecification: setValueSpecification, setDatePickerOption: setDatePickerOption }));
596
+ case CUSTOM_DATE_PICKER_OPTION.ABSOLUTE_TIME:
597
+ return (_jsx(AbsoluteTimeValueSpecificationEditor, { graph: graph, valueSpecification: valueSpecification, setValueSpecification: setValueSpecification, setDatePickerOption: setDatePickerOption }));
598
+ case CUSTOM_DATE_PICKER_OPTION.CUSTOM_DATE:
599
+ return (_jsx(CustomDateInstanceValueEditor, { graph: graph, observerContext: observerContext, customDateOptionValue: buildCustomDateOption(valueSpecification), setValueSpecification: setValueSpecification, setDatePickerOption: setDatePickerOption }));
600
+ case CUSTOM_DATE_PICKER_OPTION.FIRST_DAY_OF:
601
+ return (_jsx(CustomFirstDayOfValueSpecificationEditor, { graph: graph, observerContext: observerContext, customDateAdjustOptionValue: buildDatePickerOption(valueSpecification), setValueSpecification: setValueSpecification, setDatePickerOption: setDatePickerOption }));
602
+ case CUSTOM_DATE_PICKER_OPTION.PREVIOUS_DAY_OF_WEEK:
603
+ return (_jsx(CustomPreviousDayOfWeekValueSpecificationEditor, { graph: graph, observerContext: observerContext, customDateAdjustOptionValue: buildDatePickerOption(valueSpecification), setValueSpecification: setValueSpecification, setDatePickerOption: setDatePickerOption }));
604
+ default:
605
+ return null;
606
+ }
607
+ };
608
+ // make sure the date picker label is updated when the value is reset or changed somehow
609
+ useEffect(() => {
610
+ setDatePickerOption(buildDatePickerOption(valueSpecification));
611
+ }, [valueSpecification]);
612
+ return (_jsxs(_Fragment, { children: [_jsx("button", { className: "value-spec-editor__date-picker__trigger", title: "Click to edit and pick from more date options", onClick: openCustomDatePickerPopover, children: datePickerOption.label }), _jsxs(BasePopover, { open: Boolean(anchorEl), TransitionProps: {
613
+ onEnter: handleEnter,
614
+ }, anchorEl: anchorEl, onClose: closeCustomDatePickerPopover, anchorOrigin: {
615
+ vertical: 'bottom',
616
+ horizontal: 'center',
617
+ }, transformOrigin: {
618
+ vertical: 'top',
619
+ horizontal: 'center',
620
+ }, children: [_jsx(BaseRadioGroup, { className: "value-spec-editor__date-picker__options", value: datePickerOption.value, onChange: handleDatePickerOptionChange, row: true, options: targetDateOptionsEnum, size: 2 }), renderChildrenDateComponents()] })] }));
621
+ };
622
+ //# sourceMappingURL=CustomDatePicker.js.map