@finos/legend-query-builder 0.1.2 → 0.2.0

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,837 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { useApplicationStore } from '@finos/legend-application';
18
+ import {
19
+ type TooltipPlacement,
20
+ type InputActionMeta,
21
+ Tooltip,
22
+ DollarIcon,
23
+ clsx,
24
+ InfoCircleIcon,
25
+ RefreshIcon,
26
+ CheckSquareIcon,
27
+ SquareIcon,
28
+ CustomSelectorInput,
29
+ SaveIcon,
30
+ PencilIcon,
31
+ } from '@finos/legend-art';
32
+ import {
33
+ type Enum,
34
+ type Type,
35
+ type ValueSpecification,
36
+ type PureModel,
37
+ PrimitiveInstanceValue,
38
+ CollectionInstanceValue,
39
+ EnumValueInstanceValue,
40
+ INTERNAL__PropagatedValue,
41
+ SimpleFunctionExpression,
42
+ VariableExpression,
43
+ EnumValueExplicitReference,
44
+ TYPICAL_MULTIPLICITY_TYPE,
45
+ PrimitiveType,
46
+ PRIMITIVE_TYPE,
47
+ GenericTypeExplicitReference,
48
+ GenericType,
49
+ Enumeration,
50
+ getEnumValue,
51
+ getMultiplicityDescription,
52
+ type ObserverContext,
53
+ } from '@finos/legend-graph';
54
+ import {
55
+ type DebouncedFunc,
56
+ type GeneratorFn,
57
+ guaranteeNonNullable,
58
+ isNonNullable,
59
+ returnUndefOnError,
60
+ uniq,
61
+ } from '@finos/legend-shared';
62
+ import { flowResult } from 'mobx';
63
+ import { observer } from 'mobx-react-lite';
64
+ import CSVParser from 'papaparse';
65
+ import { useEffect, useRef, useState } from 'react';
66
+ import {
67
+ instanceValue_setValue,
68
+ instanceValue_setValues,
69
+ } from '../../stores/shared/ValueSpecificationModifierHelper.js';
70
+ import { CustomDatePicker } from './CustomDatePicker.js';
71
+
72
+ type TypeCheckOption = {
73
+ expectedType: Type;
74
+ /**
75
+ * Indicates if a strict type-matching will happen.
76
+ * Sometimes, auto-boxing allow some rooms to wiggle,
77
+ * for example we can assign a Float to an Integer, a
78
+ * Date to a DateTime. With this flag set to `true`
79
+ * we will not allow this.
80
+ */
81
+ match?: boolean;
82
+ };
83
+
84
+ const ParameterInfoTooltip: React.FC<{
85
+ variable: VariableExpression;
86
+ children: React.ReactElement;
87
+ placement?: TooltipPlacement | undefined;
88
+ }> = (props) => {
89
+ const { variable, children, placement } = props;
90
+ const type = variable.genericType?.value.rawType;
91
+ return (
92
+ <Tooltip
93
+ arrow={true}
94
+ {...(placement !== undefined ? { placement } : {})}
95
+ classes={{
96
+ tooltip: 'value-spec-paramater__tooltip',
97
+ arrow: 'value-spec-paramater__tooltip__arrow',
98
+ tooltipPlacementRight: 'value-spec-paramater__tooltip--right',
99
+ }}
100
+ TransitionProps={{
101
+ // disable transition
102
+ // NOTE: somehow, this is the only workaround we have, if for example
103
+ // we set `appear = true`, the tooltip will jump out of position
104
+ timeout: 0,
105
+ }}
106
+ title={
107
+ <div className="value-spec-paramater__tooltip__content">
108
+ <div className="value-spec-paramater__tooltip__item">
109
+ <div className="value-spec-paramater__tooltip__item__label">
110
+ Type
111
+ </div>
112
+ <div className="value-spec-paramater__tooltip__item__value">
113
+ {type?.name ?? ''}
114
+ </div>
115
+ </div>
116
+ <div className="value-spec-paramater__tooltip__item">
117
+ <div className="value-spec-paramater__tooltip__item__label">
118
+ Var Name
119
+ </div>
120
+ <div className="value-spec-paramater__tooltip__item__value">
121
+ {variable.name}
122
+ </div>
123
+ </div>
124
+ <div className="value-spec-paramater__tooltip__item">
125
+ <div className="value-spec-paramater__tooltip__item__label">
126
+ Multiplicity
127
+ </div>
128
+ <div className="value-spec-paramater__tooltip__item__value">
129
+ {getMultiplicityDescription(variable.multiplicity)}
130
+ </div>
131
+ </div>
132
+ </div>
133
+ }
134
+ >
135
+ {children}
136
+ </Tooltip>
137
+ );
138
+ };
139
+
140
+ const VariableExpressionParameterEditor = observer(
141
+ (props: {
142
+ valueSpecification: VariableExpression;
143
+ className?: string | undefined;
144
+ resetValue: () => void;
145
+ }) => {
146
+ const { valueSpecification, className, resetValue } = props;
147
+ const varName = valueSpecification.name;
148
+ return (
149
+ <div className={clsx('value-spec-editor__parameter', className)}>
150
+ <div className="value-spec-editor__parameter__icon">
151
+ <DollarIcon />
152
+ </div>
153
+ <div className="value-spec-editor__parameter__label">
154
+ <div className="value-spec-editor__parameter__text">{varName}</div>
155
+ <ParameterInfoTooltip variable={valueSpecification}>
156
+ <div className="value-spec-editor__parameter__info">
157
+ <InfoCircleIcon />
158
+ </div>
159
+ </ParameterInfoTooltip>
160
+ <button
161
+ className="value-spec-editor__parameter__reset-btn"
162
+ title="Reset"
163
+ onClick={resetValue}
164
+ >
165
+ <RefreshIcon />
166
+ </button>
167
+ </div>
168
+ </div>
169
+ );
170
+ },
171
+ );
172
+
173
+ const StringPrimitiveInstanceValueEditor = observer(
174
+ (props: {
175
+ valueSpecification: PrimitiveInstanceValue;
176
+ className?: string | undefined;
177
+ setValueSpecification: (val: ValueSpecification) => void;
178
+ resetValue: () => void;
179
+ selectorConfig?:
180
+ | {
181
+ values: string[] | undefined;
182
+ isLoading: boolean;
183
+ reloadValues:
184
+ | DebouncedFunc<(inputValue: string) => GeneratorFn<void>>
185
+ | undefined;
186
+ cleanUpReloadValues?: () => void;
187
+ }
188
+ | undefined;
189
+ }) => {
190
+ const {
191
+ valueSpecification,
192
+ className,
193
+ resetValue,
194
+ setValueSpecification,
195
+ selectorConfig,
196
+ } = props;
197
+ const useSelector = Boolean(selectorConfig);
198
+ const applicationStore = useApplicationStore();
199
+ const value = valueSpecification.values[0] as string;
200
+ const updateValueSpec = (val: string): void => {
201
+ instanceValue_setValue(valueSpecification, val, 0);
202
+ setValueSpecification(valueSpecification);
203
+ };
204
+ const changeInputValue: React.ChangeEventHandler<HTMLInputElement> = (
205
+ event,
206
+ ) => {
207
+ updateValueSpec(event.target.value);
208
+ };
209
+ // custom select
210
+ const selectedValue = { value: value, label: value };
211
+ const reloadValuesFunc = selectorConfig?.reloadValues;
212
+ const changeValue = (
213
+ val: null | { value: number | string; label: string },
214
+ ): void => {
215
+ const newValue = val === null ? '' : val.value.toString();
216
+ updateValueSpec(newValue);
217
+ };
218
+ const handleInputChange = (
219
+ inputValue: string,
220
+ actionChange: InputActionMeta,
221
+ ): void => {
222
+ if (actionChange.action === 'input-change') {
223
+ updateValueSpec(inputValue);
224
+ reloadValuesFunc?.cancel();
225
+ const reloadValuesFuncTransformation = reloadValuesFunc?.(inputValue);
226
+ if (reloadValuesFuncTransformation) {
227
+ flowResult(reloadValuesFuncTransformation).catch(
228
+ applicationStore.alertUnhandledError,
229
+ );
230
+ }
231
+ }
232
+ if (actionChange.action === 'input-blur') {
233
+ reloadValuesFunc?.cancel();
234
+ selectorConfig?.cleanUpReloadValues?.();
235
+ }
236
+ };
237
+ const isLoading = selectorConfig?.isLoading;
238
+ const queryOptions = selectorConfig?.values?.length
239
+ ? selectorConfig.values.map((e) => ({
240
+ value: e,
241
+ label: e.toString(),
242
+ }))
243
+ : undefined;
244
+ const noOptionsMessage =
245
+ selectorConfig?.values === undefined ? (): null => null : undefined;
246
+
247
+ return (
248
+ <div className={clsx('value-spec-editor', className)}>
249
+ {useSelector ? (
250
+ <CustomSelectorInput
251
+ className="value-spec-editor__enum-selector"
252
+ options={queryOptions}
253
+ onChange={changeValue}
254
+ value={selectedValue}
255
+ onInputChange={handleInputChange}
256
+ darkMode={!applicationStore.TEMPORARY__isLightThemeEnabled}
257
+ isLoading={isLoading}
258
+ allowCreateWhileLoading={true}
259
+ noOptionsMessage={noOptionsMessage}
260
+ components={{
261
+ DropdownIndicator: null,
262
+ }}
263
+ />
264
+ ) : (
265
+ <input
266
+ className="panel__content__form__section__input value-spec-editor__input"
267
+ spellCheck={false}
268
+ value={value}
269
+ placeholder={value === '' ? '(empty)' : undefined}
270
+ onChange={changeInputValue}
271
+ />
272
+ )}
273
+ <button
274
+ className="value-spec-editor__reset-btn"
275
+ title="Reset"
276
+ onClick={resetValue}
277
+ >
278
+ <RefreshIcon />
279
+ </button>
280
+ </div>
281
+ );
282
+ },
283
+ );
284
+
285
+ const BooleanPrimitiveInstanceValueEditor = observer(
286
+ (props: {
287
+ valueSpecification: PrimitiveInstanceValue;
288
+ className?: string | undefined;
289
+ resetValue: () => void;
290
+ setValueSpecification: (val: ValueSpecification) => void;
291
+ }) => {
292
+ const { valueSpecification, className, resetValue, setValueSpecification } =
293
+ props;
294
+ const value = valueSpecification.values[0] as boolean;
295
+ const toggleValue = (): void => {
296
+ instanceValue_setValue(valueSpecification, !value, 0);
297
+ setValueSpecification(valueSpecification);
298
+ };
299
+
300
+ return (
301
+ <div className={clsx('value-spec-editor', className)}>
302
+ <button
303
+ className={clsx('value-spec-editor__toggler__btn', {
304
+ 'value-spec-editor__toggler__btn--toggled': value,
305
+ })}
306
+ onClick={toggleValue}
307
+ >
308
+ {value ? <CheckSquareIcon /> : <SquareIcon />}
309
+ </button>
310
+ <button
311
+ className="value-spec-editor__reset-btn"
312
+ title="Reset"
313
+ onClick={resetValue}
314
+ >
315
+ <RefreshIcon />
316
+ </button>
317
+ </div>
318
+ );
319
+ },
320
+ );
321
+
322
+ const NumberPrimitiveInstanceValueEditor = observer(
323
+ (props: {
324
+ valueSpecification: PrimitiveInstanceValue;
325
+ isInteger: boolean;
326
+ className?: string | undefined;
327
+ resetValue: () => void;
328
+ setValueSpecification: (val: ValueSpecification) => void;
329
+ }) => {
330
+ const {
331
+ valueSpecification,
332
+ isInteger,
333
+ className,
334
+ resetValue,
335
+ setValueSpecification,
336
+ } = props;
337
+ const value = valueSpecification.values[0] as number;
338
+ const changeValue: React.ChangeEventHandler<HTMLInputElement> = (event) => {
339
+ let inputVal = isInteger
340
+ ? parseInt(event.target.value, 10)
341
+ : parseFloat(event.target.value);
342
+ inputVal = isNaN(inputVal) ? 0 : inputVal;
343
+ instanceValue_setValue(valueSpecification, inputVal, 0);
344
+ setValueSpecification(valueSpecification);
345
+ };
346
+
347
+ return (
348
+ <div className={clsx('value-spec-editor', className)}>
349
+ <input
350
+ className="panel__content__form__section__input value-spec-editor__input"
351
+ spellCheck={false}
352
+ type="number"
353
+ value={value}
354
+ onChange={changeValue}
355
+ />
356
+ <button
357
+ className="value-spec-editor__reset-btn"
358
+ title="Reset"
359
+ onClick={resetValue}
360
+ >
361
+ <RefreshIcon />
362
+ </button>
363
+ </div>
364
+ );
365
+ },
366
+ );
367
+
368
+ const EnumValueInstanceValueEditor = observer(
369
+ (props: {
370
+ valueSpecification: EnumValueInstanceValue;
371
+ className?: string | undefined;
372
+ setValueSpecification: (val: ValueSpecification) => void;
373
+ resetValue: () => void;
374
+ }) => {
375
+ const { valueSpecification, className, resetValue, setValueSpecification } =
376
+ props;
377
+ const enumValueRef = guaranteeNonNullable(valueSpecification.values[0]);
378
+ const enumValue = enumValueRef.value;
379
+ const options = enumValue._OWNER.values.map((value) => ({
380
+ label: value.name,
381
+ value: value,
382
+ }));
383
+ const changeValue = (val: { value: Enum; label: string }): void => {
384
+ instanceValue_setValue(
385
+ valueSpecification,
386
+ EnumValueExplicitReference.create(val.value),
387
+ 0,
388
+ );
389
+ setValueSpecification(valueSpecification);
390
+ };
391
+
392
+ return (
393
+ <div className={clsx('value-spec-editor', className)}>
394
+ <CustomSelectorInput
395
+ className="value-spec-editor__enum-selector"
396
+ options={options}
397
+ onChange={changeValue}
398
+ value={{ value: enumValue, label: enumValue.name }}
399
+ darkMode={true}
400
+ />
401
+ <button
402
+ className="value-spec-editor__reset-btn"
403
+ title="Reset"
404
+ onClick={resetValue}
405
+ >
406
+ <RefreshIcon />
407
+ </button>
408
+ </div>
409
+ );
410
+ },
411
+ );
412
+
413
+ const stringifyValue = (values: ValueSpecification[]): string => {
414
+ if (values.length === 0) {
415
+ return '';
416
+ }
417
+ return CSVParser.unparse([
418
+ values
419
+ .map((val) => {
420
+ if (val instanceof PrimitiveInstanceValue) {
421
+ return val.values[0];
422
+ } else if (val instanceof EnumValueInstanceValue) {
423
+ return guaranteeNonNullable(val.values[0]).value.name;
424
+ }
425
+ return undefined;
426
+ })
427
+ .filter(isNonNullable),
428
+ ]).trim();
429
+ };
430
+
431
+ /**
432
+ * NOTE: We attempt to be less disruptive here by not throwing errors left and right, instead
433
+ * we silently remove values which are not valid or parsable. But perhaps, we can consider
434
+ * passing in logger or notifier to show give the users some idea of what went wrong instead
435
+ * of silently swallow parts of their inputs like this.
436
+ */
437
+ const setCollectionValue = (
438
+ valueSpecification: CollectionInstanceValue,
439
+ graph: PureModel,
440
+ expectedType: Type,
441
+ value: string,
442
+ ): void => {
443
+ if (value.trim().length === 0) {
444
+ instanceValue_setValues(valueSpecification, []);
445
+ return;
446
+ }
447
+ const multiplicityOne = graph.getTypicalMultiplicity(
448
+ TYPICAL_MULTIPLICITY_TYPE.ONE,
449
+ );
450
+ let result: unknown[] = [];
451
+ const parseResult = CSVParser.parse<string[]>(value.trim(), {
452
+ delimiter: ',',
453
+ });
454
+ const parseData = parseResult.data[0] as string[]; // only take the first line
455
+ if (parseResult.errors.length) {
456
+ if (
457
+ parseResult.errors[0] &&
458
+ parseResult.errors[0].code === 'UndetectableDelimiter' &&
459
+ parseResult.errors[0].type === 'Delimiter' &&
460
+ parseResult.data.length === 1
461
+ ) {
462
+ // NOTE: this happens when the user only put one item in the value input
463
+ // we can go the other way by ensure the input has a comma but this is arguably neater
464
+ // as it tinkers with the parser
465
+ } else {
466
+ // there were some parsing error, escape
467
+ // NOTE: ideally, we could show a warning here
468
+ return;
469
+ }
470
+ } else if (expectedType instanceof PrimitiveType) {
471
+ switch (expectedType.path) {
472
+ case PRIMITIVE_TYPE.STRING: {
473
+ result = uniq(parseData)
474
+ .map((item): PrimitiveInstanceValue | undefined => {
475
+ const primitiveInstanceValue = new PrimitiveInstanceValue(
476
+ GenericTypeExplicitReference.create(
477
+ new GenericType(expectedType),
478
+ ),
479
+ multiplicityOne,
480
+ );
481
+ instanceValue_setValues(primitiveInstanceValue, [item.toString()]);
482
+ return primitiveInstanceValue;
483
+ })
484
+ .filter(isNonNullable);
485
+ break;
486
+ }
487
+ case PRIMITIVE_TYPE.NUMBER:
488
+ case PRIMITIVE_TYPE.FLOAT:
489
+ case PRIMITIVE_TYPE.DECIMAL:
490
+ case PRIMITIVE_TYPE.INTEGER: {
491
+ result = uniq(
492
+ parseData
493
+ .filter((val) => !isNaN(Number(val)))
494
+ .map((val) => Number(val)),
495
+ )
496
+ .map((item): PrimitiveInstanceValue | undefined => {
497
+ const primitiveInstanceValue = new PrimitiveInstanceValue(
498
+ GenericTypeExplicitReference.create(
499
+ new GenericType(expectedType),
500
+ ),
501
+ multiplicityOne,
502
+ );
503
+ instanceValue_setValues(primitiveInstanceValue, [item]);
504
+ return primitiveInstanceValue;
505
+ })
506
+ .filter(isNonNullable);
507
+ break;
508
+ }
509
+ default:
510
+ // unsupported expected type, just escape
511
+ return;
512
+ }
513
+ } else if (expectedType instanceof Enumeration) {
514
+ result = uniq(parseData.map((item) => item.trim()))
515
+ .map((item): EnumValueInstanceValue | undefined => {
516
+ const _enum = returnUndefOnError(() =>
517
+ getEnumValue(expectedType, item),
518
+ );
519
+ if (!_enum) {
520
+ return undefined;
521
+ }
522
+ const enumValueInstanceValue = new EnumValueInstanceValue(
523
+ GenericTypeExplicitReference.create(new GenericType(expectedType)),
524
+ multiplicityOne,
525
+ );
526
+ instanceValue_setValues(enumValueInstanceValue, [
527
+ EnumValueExplicitReference.create(_enum),
528
+ ]);
529
+ return enumValueInstanceValue;
530
+ })
531
+ .filter(isNonNullable);
532
+ }
533
+ instanceValue_setValues(valueSpecification, result);
534
+ };
535
+
536
+ const COLLECTION_PREVIEW_CHAR_LIMIT = 50;
537
+
538
+ const CollectionValueInstanceValueEditor = observer(
539
+ (props: {
540
+ valueSpecification: CollectionInstanceValue;
541
+ graph: PureModel;
542
+ expectedType: Type;
543
+ className?: string | undefined;
544
+ resetValue: () => void;
545
+ setValueSpecification: (val: ValueSpecification) => void;
546
+ }) => {
547
+ const {
548
+ valueSpecification,
549
+ graph,
550
+ expectedType,
551
+ className,
552
+ resetValue,
553
+ setValueSpecification,
554
+ } = props;
555
+ const inputRef = useRef<HTMLInputElement>(null);
556
+ const [text, setText] = useState(stringifyValue(valueSpecification.values));
557
+ const [editable, setEditable] = useState(false);
558
+ const valueText = stringifyValue(valueSpecification.values);
559
+ const previewText = `List(${
560
+ valueSpecification.values.length === 0
561
+ ? 'empty'
562
+ : valueSpecification.values.length
563
+ })${
564
+ valueSpecification.values.length === 0
565
+ ? ''
566
+ : `: ${
567
+ valueText.length > COLLECTION_PREVIEW_CHAR_LIMIT
568
+ ? `${valueText.substring(0, COLLECTION_PREVIEW_CHAR_LIMIT)}...`
569
+ : valueText
570
+ }`
571
+ }`;
572
+ const enableEdit = (): void => setEditable(true);
573
+ const saveEdit = (): void => {
574
+ setEditable(false);
575
+ setCollectionValue(valueSpecification, graph, expectedType, text);
576
+ setText(stringifyValue(valueSpecification.values));
577
+ setValueSpecification(valueSpecification);
578
+ };
579
+ const changeValue: React.ChangeEventHandler<HTMLInputElement> = (event) =>
580
+ setText(event.target.value);
581
+
582
+ // focus the input box when edit is enabled
583
+ useEffect(() => {
584
+ if (editable) {
585
+ inputRef.current?.focus();
586
+ }
587
+ }, [editable]);
588
+
589
+ if (editable) {
590
+ return (
591
+ <div className={clsx('value-spec-editor', className)}>
592
+ <input
593
+ ref={inputRef}
594
+ className="panel__content__form__section__input value-spec-editor__input"
595
+ spellCheck={false}
596
+ value={text}
597
+ placeholder={text === '' ? '(empty)' : undefined}
598
+ onChange={changeValue}
599
+ />
600
+ <button
601
+ className="value-spec-editor__list-editor__save-button btn--dark"
602
+ onClick={saveEdit}
603
+ >
604
+ <SaveIcon />
605
+ </button>
606
+ <button
607
+ className="value-spec-editor__reset-btn"
608
+ title="Reset"
609
+ onClick={resetValue}
610
+ >
611
+ <RefreshIcon />
612
+ </button>
613
+ </div>
614
+ );
615
+ }
616
+ return (
617
+ <div
618
+ className={clsx('value-spec-editor', className)}
619
+ onClick={enableEdit}
620
+ title="Click to edit"
621
+ >
622
+ <input
623
+ className="value-spec-editor__list-editor__preview"
624
+ spellCheck={false}
625
+ value={previewText}
626
+ disabled={true}
627
+ />
628
+ <button className="value-spec-editor__list-editor__edit-icon">
629
+ <PencilIcon />
630
+ </button>
631
+ </div>
632
+ );
633
+ },
634
+ );
635
+
636
+ const UnsupportedValueSpecificationEditor: React.FC = () => (
637
+ <div className="value-spec-editor--unsupported">unsupported</div>
638
+ );
639
+
640
+ const DateInstanceValueEditor = observer(
641
+ (props: {
642
+ valueSpecification: PrimitiveInstanceValue | SimpleFunctionExpression;
643
+ graph: PureModel;
644
+ obseverContext: ObserverContext;
645
+ typeCheckOption: TypeCheckOption;
646
+ className?: string | undefined;
647
+ setValueSpecification: (val: ValueSpecification) => void;
648
+ resetValue: () => void;
649
+ }) => {
650
+ const {
651
+ valueSpecification,
652
+ setValueSpecification,
653
+ graph,
654
+ obseverContext,
655
+ typeCheckOption,
656
+ resetValue,
657
+ } = props;
658
+
659
+ return (
660
+ <div className="value-spec-editor">
661
+ <CustomDatePicker
662
+ valueSpecification={valueSpecification}
663
+ graph={graph}
664
+ observerContext={obseverContext}
665
+ typeCheckOption={typeCheckOption}
666
+ setValueSpecification={setValueSpecification}
667
+ />
668
+ <button
669
+ className="value-spec-editor__reset-btn"
670
+ title="Reset"
671
+ onClick={resetValue}
672
+ >
673
+ <RefreshIcon />
674
+ </button>
675
+ </div>
676
+ );
677
+ },
678
+ );
679
+
680
+ /**
681
+ * TODO we should pass in the props `resetValueSpecification`. Reset
682
+ * should be part of this editor. Also through here we can call `observe_` accordingly.
683
+ *
684
+ * See https://github.com/finos/legend-studio/pull/1021
685
+ */
686
+ export const BasicValueSpecificationEditor: React.FC<{
687
+ valueSpecification: ValueSpecification;
688
+ graph: PureModel;
689
+ obseverContext: ObserverContext;
690
+ typeCheckOption: TypeCheckOption;
691
+ className?: string | undefined;
692
+ setValueSpecification: (val: ValueSpecification) => void;
693
+ resetValue: () => void;
694
+ selectorConfig?:
695
+ | {
696
+ values: string[] | undefined;
697
+ isLoading: boolean;
698
+ reloadValues:
699
+ | DebouncedFunc<(inputValue: string) => GeneratorFn<void>>
700
+ | undefined;
701
+ cleanUpReloadValues?: () => void;
702
+ }
703
+ | undefined;
704
+ }> = (props) => {
705
+ const {
706
+ className,
707
+ valueSpecification,
708
+ graph,
709
+ obseverContext,
710
+ typeCheckOption,
711
+ setValueSpecification,
712
+ resetValue,
713
+ selectorConfig,
714
+ } = props;
715
+ if (valueSpecification instanceof PrimitiveInstanceValue) {
716
+ const _type = valueSpecification.genericType.value.rawType;
717
+ switch (_type.path) {
718
+ case PRIMITIVE_TYPE.STRING:
719
+ return (
720
+ <StringPrimitiveInstanceValueEditor
721
+ valueSpecification={valueSpecification}
722
+ setValueSpecification={setValueSpecification}
723
+ className={className}
724
+ resetValue={resetValue}
725
+ selectorConfig={selectorConfig}
726
+ />
727
+ );
728
+ case PRIMITIVE_TYPE.BOOLEAN:
729
+ return (
730
+ <BooleanPrimitiveInstanceValueEditor
731
+ valueSpecification={valueSpecification}
732
+ setValueSpecification={setValueSpecification}
733
+ className={className}
734
+ resetValue={resetValue}
735
+ />
736
+ );
737
+ case PRIMITIVE_TYPE.NUMBER:
738
+ case PRIMITIVE_TYPE.FLOAT:
739
+ case PRIMITIVE_TYPE.DECIMAL:
740
+ case PRIMITIVE_TYPE.INTEGER:
741
+ return (
742
+ <NumberPrimitiveInstanceValueEditor
743
+ valueSpecification={valueSpecification}
744
+ isInteger={_type.path === PRIMITIVE_TYPE.INTEGER}
745
+ setValueSpecification={setValueSpecification}
746
+ className={className}
747
+ resetValue={resetValue}
748
+ />
749
+ );
750
+ case PRIMITIVE_TYPE.DATE:
751
+ case PRIMITIVE_TYPE.STRICTDATE:
752
+ case PRIMITIVE_TYPE.DATETIME:
753
+ case PRIMITIVE_TYPE.LATESTDATE:
754
+ return (
755
+ <DateInstanceValueEditor
756
+ valueSpecification={valueSpecification}
757
+ graph={graph}
758
+ obseverContext={obseverContext}
759
+ typeCheckOption={typeCheckOption}
760
+ className={className}
761
+ setValueSpecification={setValueSpecification}
762
+ resetValue={resetValue}
763
+ />
764
+ );
765
+ default:
766
+ return <UnsupportedValueSpecificationEditor />;
767
+ }
768
+ } else if (valueSpecification instanceof EnumValueInstanceValue) {
769
+ return (
770
+ <EnumValueInstanceValueEditor
771
+ valueSpecification={valueSpecification}
772
+ className={className}
773
+ resetValue={resetValue}
774
+ setValueSpecification={setValueSpecification}
775
+ />
776
+ );
777
+ } else if (
778
+ valueSpecification instanceof CollectionInstanceValue &&
779
+ valueSpecification.genericType
780
+ ) {
781
+ // NOTE: since when we fill in the arguments, `[]` (or `nullish` value in Pure)
782
+ // is used for parameters we don't handle, we should not attempt to support empty collection
783
+ // without generic type here as that is equivalent to `[]`
784
+ return (
785
+ <CollectionValueInstanceValueEditor
786
+ valueSpecification={valueSpecification}
787
+ graph={graph}
788
+ expectedType={typeCheckOption.expectedType}
789
+ className={className}
790
+ resetValue={resetValue}
791
+ setValueSpecification={setValueSpecification}
792
+ />
793
+ );
794
+ }
795
+ // property expression
796
+ else if (valueSpecification instanceof VariableExpression) {
797
+ return (
798
+ <VariableExpressionParameterEditor
799
+ valueSpecification={valueSpecification}
800
+ className={className}
801
+ resetValue={resetValue}
802
+ />
803
+ );
804
+ } else if (valueSpecification instanceof INTERNAL__PropagatedValue) {
805
+ return (
806
+ <BasicValueSpecificationEditor
807
+ valueSpecification={valueSpecification.getValue()}
808
+ graph={graph}
809
+ obseverContext={obseverContext}
810
+ typeCheckOption={typeCheckOption}
811
+ setValueSpecification={setValueSpecification}
812
+ resetValue={resetValue}
813
+ />
814
+ );
815
+ } else if (
816
+ valueSpecification instanceof SimpleFunctionExpression &&
817
+ [
818
+ PRIMITIVE_TYPE.DATE.toString(),
819
+ PRIMITIVE_TYPE.STRICTDATE.toString(),
820
+ PRIMITIVE_TYPE.DATETIME.toString(),
821
+ PRIMITIVE_TYPE.LATESTDATE.toString(),
822
+ ].includes(typeCheckOption.expectedType.path)
823
+ ) {
824
+ return (
825
+ <DateInstanceValueEditor
826
+ valueSpecification={valueSpecification}
827
+ graph={graph}
828
+ obseverContext={obseverContext}
829
+ typeCheckOption={typeCheckOption}
830
+ className={className}
831
+ setValueSpecification={setValueSpecification}
832
+ resetValue={resetValue}
833
+ />
834
+ );
835
+ }
836
+ return <UnsupportedValueSpecificationEditor />;
837
+ };