@finos/legend-query-builder 4.13.9 → 4.13.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__lib__/QueryBuilderTesting.d.ts +1 -0
- package/lib/__lib__/QueryBuilderTesting.d.ts.map +1 -1
- package/lib/__lib__/QueryBuilderTesting.js +1 -0
- package/lib/__lib__/QueryBuilderTesting.js.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
- package/lib/components/result/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/result/QueryBuilderResultPanel.js +3 -3
- package/lib/components/result/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/result/tds/QueryBuilderTDSResultShared.d.ts +1 -1
- package/lib/components/result/tds/QueryBuilderTDSResultShared.d.ts.map +1 -1
- package/lib/components/result/tds/QueryBuilderTDSResultShared.js +3 -2
- package/lib/components/result/tds/QueryBuilderTDSResultShared.js.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.js +7 -1
- package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
- package/lib/components/shared/CustomDatePicker.js +14 -14
- package/lib/components/shared/CustomDatePicker.js.map +1 -1
- package/lib/graph/QueryBuilderMetaModelConst.d.ts +4 -2
- package/lib/graph/QueryBuilderMetaModelConst.d.ts.map +1 -1
- package/lib/graph/QueryBuilderMetaModelConst.js +4 -2
- package/lib/graph/QueryBuilderMetaModelConst.js.map +1 -1
- package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +2 -0
- package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderStateBuilder.d.ts +2 -1
- package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
- package/lib/stores/QueryBuilderStateBuilder.js +28 -1
- package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
- package/package.json +8 -8
- package/src/__lib__/QueryBuilderTesting.ts +1 -0
- package/src/components/filter/QueryBuilderFilterPanel.tsx +3 -0
- package/src/components/result/QueryBuilderResultPanel.tsx +3 -6
- package/src/components/result/tds/QueryBuilderTDSResultShared.tsx +3 -1
- package/src/components/shared/BasicValueSpecificationEditor.tsx +16 -11
- package/src/components/shared/CustomDatePicker.tsx +15 -15
- package/src/graph/QueryBuilderMetaModelConst.ts +4 -2
- package/src/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +2 -0
- package/src/stores/QueryBuilderStateBuilder.ts +54 -12
@@ -26,25 +26,25 @@ import {
|
|
26
26
|
} from '@finos/legend-shared';
|
27
27
|
import type { QueryBuilderState } from './QueryBuilderState.js';
|
28
28
|
import {
|
29
|
+
type AbstractPropertyExpression,
|
29
30
|
type EnumValueInstanceValue,
|
30
31
|
type FunctionExpression,
|
31
32
|
type GraphFetchTreeInstanceValue,
|
32
33
|
type ValueSpecificationVisitor,
|
33
|
-
InstanceValue,
|
34
|
-
INTERNAL__UnknownValueSpecification,
|
35
34
|
type LambdaFunction,
|
36
35
|
type KeyExpressionInstanceValue,
|
37
|
-
|
38
|
-
|
36
|
+
type INTERNAL__PropagatedValue,
|
37
|
+
type ValueSpecification,
|
39
38
|
type CollectionInstanceValue,
|
40
39
|
type LambdaFunctionInstanceValue,
|
40
|
+
InstanceValue,
|
41
|
+
INTERNAL__UnknownValueSpecification,
|
42
|
+
matchFunctionName,
|
43
|
+
Class,
|
41
44
|
PrimitiveInstanceValue,
|
42
45
|
SimpleFunctionExpression,
|
43
46
|
VariableExpression,
|
44
|
-
type AbstractPropertyExpression,
|
45
47
|
getMilestoneTemporalStereotype,
|
46
|
-
type INTERNAL__PropagatedValue,
|
47
|
-
type ValueSpecification,
|
48
48
|
SUPPORTED_FUNCTIONS,
|
49
49
|
isSuperType,
|
50
50
|
PackageableElementReference,
|
@@ -206,6 +206,33 @@ const processGetAllVersionsInRangeExpression = (
|
|
206
206
|
);
|
207
207
|
};
|
208
208
|
|
209
|
+
// a recursive function to check if there are some date functions
|
210
|
+
// unsupported in the custom date picker dropdown.
|
211
|
+
// For now, it's just QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_YEAR and QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_MONTH.
|
212
|
+
export const isUsedDateFunctionSupportedInFormMode = (
|
213
|
+
valueSpec: ValueSpecification,
|
214
|
+
): boolean => {
|
215
|
+
if (valueSpec instanceof SimpleFunctionExpression) {
|
216
|
+
if (
|
217
|
+
matchFunctionName(
|
218
|
+
valueSpec.functionName,
|
219
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_YEAR,
|
220
|
+
) ||
|
221
|
+
matchFunctionName(
|
222
|
+
valueSpec.functionName,
|
223
|
+
QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_MONTH,
|
224
|
+
)
|
225
|
+
) {
|
226
|
+
return false;
|
227
|
+
}
|
228
|
+
return !valueSpec.parametersValues
|
229
|
+
.map((value) => isUsedDateFunctionSupportedInFormMode(value))
|
230
|
+
.includes(false);
|
231
|
+
} else {
|
232
|
+
return true;
|
233
|
+
}
|
234
|
+
};
|
235
|
+
|
209
236
|
const processLetExpression = (
|
210
237
|
expression: SimpleFunctionExpression,
|
211
238
|
queryBuilderState: QueryBuilderState,
|
@@ -239,11 +266,26 @@ const processLetExpression = (
|
|
239
266
|
rightSide.content,
|
240
267
|
);
|
241
268
|
} else {
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
269
|
+
// Even if a valueSpecification is successfully built, it might contain some date functions
|
270
|
+
// unsupported in the custom date picker dropdown, e.g., QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_YEAR
|
271
|
+
// or QUERY_BUILDER_SUPPORTED_FUNCTIONS.FIRST_DAY_OF_MONTH.
|
272
|
+
// If it doesn't contain any unsupported date functions, a QueryBuilderSimpleConstantExpressionState should be created.
|
273
|
+
// Otherwise, a QueryBuilderCalculatedConstantExpressionState should be created.
|
274
|
+
if (isUsedDateFunctionSupportedInFormMode(rightSide)) {
|
275
|
+
constantExpression = new QueryBuilderSimpleConstantExpressionState(
|
276
|
+
queryBuilderState,
|
277
|
+
varExp,
|
278
|
+
rightSide,
|
279
|
+
);
|
280
|
+
} else {
|
281
|
+
constantExpression = new QueryBuilderCalculatedConstantExpressionState(
|
282
|
+
queryBuilderState,
|
283
|
+
varExp,
|
284
|
+
queryBuilderState.graphManagerState.graphManager.serializeValueSpecification(
|
285
|
+
rightSide,
|
286
|
+
),
|
287
|
+
);
|
288
|
+
}
|
247
289
|
}
|
248
290
|
queryBuilderState.constantState.setShowConstantPanel(true);
|
249
291
|
queryBuilderState.constantState.addConstant(constantExpression);
|