@finos/legend-query-builder 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/lib/components/QueryBuilderConstantExpressionPanel.js +1 -1
  2. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  3. package/lib/components/QueryBuilderResultPanel.js +2 -2
  4. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  5. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  6. package/lib/components/shared/BasicValueSpecificationEditor.js +41 -2
  7. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  8. package/lib/index.css +1 -1
  9. package/lib/package.json +1 -1
  10. package/lib/stores/QueryBuilderState.d.ts +5 -2
  11. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  12. package/lib/stores/QueryBuilderState.js +19 -6
  13. package/lib/stores/QueryBuilderState.js.map +1 -1
  14. package/lib/stores/QueryBuilderStateBuilder.d.ts +2 -2
  15. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
  16. package/lib/stores/QueryBuilderStateBuilder.js +21 -4
  17. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  18. package/lib/stores/QueryBuilderTextEditorState.d.ts.map +1 -1
  19. package/lib/stores/QueryBuilderTextEditorState.js +4 -1
  20. package/lib/stores/QueryBuilderTextEditorState.js.map +1 -1
  21. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts +1 -1
  22. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts.map +1 -1
  23. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js +14 -1
  24. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -1
  25. package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts.map +1 -1
  26. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +14 -1
  27. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -1
  28. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts +1 -0
  29. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts.map +1 -1
  30. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js +21 -17
  31. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js.map +1 -1
  32. package/package.json +7 -7
  33. package/src/components/QueryBuilderConstantExpressionPanel.tsx +1 -1
  34. package/src/components/QueryBuilderResultPanel.tsx +2 -1
  35. package/src/components/shared/BasicValueSpecificationEditor.tsx +72 -2
  36. package/src/stores/QueryBuilderState.ts +29 -5
  37. package/src/stores/QueryBuilderStateBuilder.ts +20 -1
  38. package/src/stores/QueryBuilderTextEditorState.ts +4 -1
  39. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts +20 -1
  40. package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +20 -0
  41. package/src/stores/milestoning/QueryBuilderMilestoningHelper.ts +34 -27
@@ -133,6 +133,40 @@ export const isDefaultDatePropagationSupported = (
133
133
  return false;
134
134
  };
135
135
 
136
+ export const checkIfEquivalent = (
137
+ param1: ValueSpecification | undefined,
138
+ param2: ValueSpecification | undefined,
139
+ ): boolean => {
140
+ if (
141
+ param1?.multiplicity.lowerBound !== param2?.multiplicity.lowerBound ||
142
+ param1?.multiplicity.upperBound !== param2?.multiplicity.upperBound
143
+ ) {
144
+ return false;
145
+ }
146
+ if (
147
+ param1 instanceof VariableExpression &&
148
+ param2 instanceof VariableExpression
149
+ ) {
150
+ return param1.name === param2.name;
151
+ } else if (
152
+ param1 instanceof PrimitiveInstanceValue &&
153
+ param2 instanceof PrimitiveInstanceValue
154
+ ) {
155
+ if (
156
+ param1.genericType.value.rawType.name === PRIMITIVE_TYPE.LATESTDATE &&
157
+ param2.genericType.value.rawType.name === PRIMITIVE_TYPE.LATESTDATE
158
+ ) {
159
+ return true;
160
+ }
161
+ return (
162
+ param1.genericType.value.rawType.name ===
163
+ param2.genericType.value.rawType.name &&
164
+ param1.values[0] === param2.values[0]
165
+ );
166
+ }
167
+ return false;
168
+ };
169
+
136
170
  /**
137
171
  * Check if the parameter value of the milestoned property is
138
172
  * the same as those specified in global scope, so that we can
@@ -144,33 +178,6 @@ export const matchMilestoningParameterValue = (
144
178
  parameterValue: ValueSpecification,
145
179
  milestoningDate: QueryBuilderMilestoningState,
146
180
  ): boolean => {
147
- const checkIfEquivalent = (
148
- param1: ValueSpecification | undefined,
149
- param2: ValueSpecification | undefined,
150
- ): boolean => {
151
- if (
152
- param1 instanceof VariableExpression &&
153
- param2 instanceof VariableExpression
154
- ) {
155
- return param1.name === param2.name;
156
- } else if (
157
- param1 instanceof PrimitiveInstanceValue &&
158
- param2 instanceof PrimitiveInstanceValue
159
- ) {
160
- if (
161
- param1.genericType.value.rawType.name === PRIMITIVE_TYPE.LATESTDATE &&
162
- param2.genericType.value.rawType.name === PRIMITIVE_TYPE.LATESTDATE
163
- ) {
164
- return true;
165
- }
166
- return (
167
- param1.genericType.value.rawType.name ===
168
- param2.genericType.value.rawType.name &&
169
- param1.values[0] === param2.values[0]
170
- );
171
- }
172
- return false;
173
- };
174
181
  switch (stereotype) {
175
182
  case MILESTONING_STEREOTYPE.BITEMPORAL:
176
183
  return (