@finos/legend-application-query 5.0.1 → 5.2.1
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/application/LegendQueryApplicationConfig.d.ts +17 -1
- package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.js +23 -1
- package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
- package/lib/components/QueryBuilder.d.ts.map +1 -1
- package/lib/components/QueryBuilder.js +3 -1
- package/lib/components/QueryBuilder.js.map +1 -1
- package/lib/components/QueryBuilderExplorerPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderExplorerPanel.js +10 -35
- package/lib/components/QueryBuilderExplorerPanel.js.map +1 -1
- package/lib/components/QueryBuilderFetchStructurePanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderFetchStructurePanel.js +78 -35
- package/lib/components/QueryBuilderFetchStructurePanel.js.map +1 -1
- package/lib/components/QueryBuilderFilterPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderFilterPanel.js +80 -66
- package/lib/components/QueryBuilderFilterPanel.js.map +1 -1
- package/lib/components/QueryBuilderFunctionsExplorerPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderFunctionsExplorerPanel.js +9 -39
- package/lib/components/QueryBuilderFunctionsExplorerPanel.js.map +1 -1
- package/lib/components/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderGraphFetchTreePanel.js +5 -5
- package/lib/components/QueryBuilderGraphFetchTreePanel.js.map +1 -1
- package/lib/components/QueryBuilderLambdaEditor.d.ts +1 -0
- package/lib/components/QueryBuilderLambdaEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderLambdaEditor.js +2 -2
- package/lib/components/QueryBuilderLambdaEditor.js.map +1 -1
- package/lib/components/QueryBuilderMilestoneEditor.js +5 -5
- package/lib/components/QueryBuilderMilestoneEditor.js.map +1 -1
- package/lib/components/QueryBuilderPanelIssueCountBadge.d.ts +20 -0
- package/lib/components/QueryBuilderPanelIssueCountBadge.d.ts.map +1 -0
- package/lib/components/QueryBuilderPanelIssueCountBadge.js +28 -0
- package/lib/components/QueryBuilderPanelIssueCountBadge.js.map +1 -0
- package/lib/components/QueryBuilderParameterPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderParameterPanel.js +13 -33
- package/lib/components/QueryBuilderParameterPanel.js.map +1 -1
- package/lib/components/QueryBuilderPostFilterPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderPostFilterPanel.js +59 -62
- package/lib/components/QueryBuilderPostFilterPanel.js.map +1 -1
- package/lib/components/QueryBuilderProjectionPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderProjectionPanel.js +47 -63
- package/lib/components/QueryBuilderProjectionPanel.js.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.js +11 -11
- package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
- package/lib/components/QueryBuilderPropertySearchPanel.js +5 -7
- package/lib/components/QueryBuilderPropertySearchPanel.js.map +1 -1
- package/lib/components/QueryBuilderResultModifierPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultModifierPanel.js +3 -1
- package/lib/components/QueryBuilderResultModifierPanel.js.map +1 -1
- package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultPanel.js +37 -23
- package/lib/components/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/QueryBuilderSetupPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderSetupPanel.js +10 -9
- package/lib/components/QueryBuilderSetupPanel.js.map +1 -1
- package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderUnsupportedQueryEditor.js +4 -2
- package/lib/components/QueryBuilderUnsupportedQueryEditor.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +16 -4
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +10 -9
- package/lib/stores/QueryBuilderExplorerState.d.ts +1 -1
- package/lib/stores/QueryBuilderExplorerState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderExplorerState.js +18 -3
- package/lib/stores/QueryBuilderExplorerState.js.map +1 -1
- package/lib/stores/QueryBuilderFetchStructureState.d.ts +8 -1
- package/lib/stores/QueryBuilderFetchStructureState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderFetchStructureState.js +10 -2
- package/lib/stores/QueryBuilderFetchStructureState.js.map +1 -1
- package/lib/stores/QueryBuilderFilterState.d.ts +10 -5
- package/lib/stores/QueryBuilderFilterState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderFilterState.js +34 -8
- package/lib/stores/QueryBuilderFilterState.js.map +1 -1
- package/lib/stores/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderGraphFetchTreeState.js +6 -3
- package/lib/stores/QueryBuilderGraphFetchTreeState.js.map +1 -1
- package/lib/stores/QueryBuilderLambdaProcessor.d.ts.map +1 -1
- package/lib/stores/QueryBuilderLambdaProcessor.js +2 -0
- package/lib/stores/QueryBuilderLambdaProcessor.js.map +1 -1
- package/lib/stores/QueryBuilderOperatorLoader.d.ts +47 -0
- package/lib/stores/QueryBuilderOperatorLoader.d.ts.map +1 -0
- package/lib/stores/QueryBuilderOperatorLoader.js +94 -0
- package/lib/stores/QueryBuilderOperatorLoader.js.map +1 -0
- package/lib/stores/QueryBuilderOperatorsHelper.d.ts +1 -0
- package/lib/stores/QueryBuilderOperatorsHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderOperatorsHelper.js +28 -1
- package/lib/stores/QueryBuilderOperatorsHelper.js.map +1 -1
- package/lib/stores/QueryBuilderPostFilterState.d.ts +9 -6
- package/lib/stores/QueryBuilderPostFilterState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderPostFilterState.js +31 -7
- package/lib/stores/QueryBuilderPostFilterState.js.map +1 -1
- package/lib/stores/QueryBuilderPreviewDataHelper.d.ts +4 -3
- package/lib/stores/QueryBuilderPreviewDataHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderPreviewDataHelper.js +77 -97
- package/lib/stores/QueryBuilderPreviewDataHelper.js.map +1 -1
- package/lib/stores/QueryBuilderProjectionState.d.ts +4 -7
- package/lib/stores/QueryBuilderProjectionState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderProjectionState.js +23 -39
- package/lib/stores/QueryBuilderProjectionState.js.map +1 -1
- package/lib/stores/QueryBuilderPropertySearchPanelState.js +1 -1
- package/lib/stores/QueryBuilderPropertySearchPanelState.js.map +1 -1
- package/lib/stores/QueryBuilderResultState.d.ts +5 -2
- package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderResultState.js +19 -7
- package/lib/stores/QueryBuilderResultState.js.map +1 -1
- package/lib/stores/QueryBuilderSetupState.js +1 -1
- package/lib/stores/QueryBuilderSetupState.js.map +1 -1
- package/lib/stores/QueryBuilderState.d.ts +7 -0
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +18 -58
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/QueryBuilderTestUtils.d.ts +24 -0
- package/lib/stores/QueryBuilderTestUtils.d.ts.map +1 -0
- package/lib/stores/QueryBuilderTestUtils.js +49 -0
- package/lib/stores/QueryBuilderTestUtils.js.map +1 -0
- package/lib/stores/QueryBuilderTypeaheadHelper.d.ts +24 -0
- package/lib/stores/QueryBuilderTypeaheadHelper.d.ts.map +1 -0
- package/lib/stores/QueryBuilderTypeaheadHelper.js +89 -0
- package/lib/stores/QueryBuilderTypeaheadHelper.js.map +1 -0
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +7 -7
- package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +14 -3
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/QueryFunctionsExplorerState.d.ts +2 -6
- package/lib/stores/QueryFunctionsExplorerState.d.ts.map +1 -1
- package/lib/stores/QueryFunctionsExplorerState.js +2 -11
- package/lib/stores/QueryFunctionsExplorerState.js.map +1 -1
- package/lib/stores/QueryParametersState.d.ts +1 -3
- package/lib/stores/QueryParametersState.d.ts.map +1 -1
- package/lib/stores/QueryParametersState.js +1 -4
- package/lib/stores/QueryParametersState.js.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_Equal.d.ts.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_Equal.js +9 -32
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_Equal.js.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThan.d.ts.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThan.js +9 -32
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThan.js.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThanEqual.d.ts.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThanEqual.js +9 -32
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_GreaterThanEqual.js.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThan.d.ts.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThan.js +9 -33
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThan.js.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThanEqual.d.ts.map +1 -1
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThanEqual.js +9 -32
- package/lib/stores/filterOperators/QueryBuilderFilterOperator_LessThanEqual.js.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_Equal.d.ts.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_Equal.js +7 -30
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_GreaterThan.d.ts.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_GreaterThan.js +8 -31
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_LessThan.d.ts.map +1 -1
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_LessThan.js +8 -31
- package/lib/stores/postFilterOperators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
- package/package.json +17 -16
- package/src/application/LegendQueryApplicationConfig.ts +35 -1
- package/src/components/QueryBuilder.tsx +13 -2
- package/src/components/QueryBuilderExplorerPanel.tsx +20 -57
- package/src/components/QueryBuilderFetchStructurePanel.tsx +94 -41
- package/src/components/QueryBuilderFilterPanel.tsx +271 -232
- package/src/components/QueryBuilderFunctionsExplorerPanel.tsx +24 -68
- package/src/components/QueryBuilderGraphFetchTreePanel.tsx +34 -25
- package/src/components/QueryBuilderLambdaEditor.tsx +3 -0
- package/src/components/QueryBuilderMilestoneEditor.tsx +34 -34
- package/src/components/QueryBuilderPanelIssueCountBadge.tsx +38 -0
- package/src/components/QueryBuilderParameterPanel.tsx +23 -55
- package/src/components/QueryBuilderPostFilterPanel.tsx +245 -233
- package/src/components/QueryBuilderProjectionPanel.tsx +127 -154
- package/src/components/QueryBuilderPropertyExpressionEditor.tsx +61 -57
- package/src/components/QueryBuilderPropertySearchPanel.tsx +9 -9
- package/src/components/QueryBuilderResultModifierPanel.tsx +4 -2
- package/src/components/QueryBuilderResultPanel.tsx +139 -91
- package/src/components/QueryBuilderSetupPanel.tsx +13 -12
- package/src/components/QueryBuilderUnsupportedQueryEditor.tsx +4 -2
- package/src/components/QueryEditor.tsx +39 -1
- package/src/stores/QueryBuilderExplorerState.ts +22 -3
- package/src/stores/QueryBuilderFetchStructureState.ts +18 -2
- package/src/stores/QueryBuilderFilterState.ts +52 -7
- package/src/stores/QueryBuilderGraphFetchTreeState.ts +14 -8
- package/src/stores/QueryBuilderLambdaProcessor.ts +8 -0
- package/src/stores/QueryBuilderOperatorLoader.ts +133 -0
- package/src/stores/QueryBuilderOperatorsHelper.ts +35 -0
- package/src/stores/QueryBuilderPostFilterState.ts +47 -8
- package/src/stores/QueryBuilderPreviewDataHelper.ts +122 -217
- package/src/stores/QueryBuilderProjectionState.ts +40 -53
- package/src/stores/QueryBuilderPropertySearchPanelState.ts +1 -1
- package/src/stores/QueryBuilderResultState.ts +27 -9
- package/src/stores/QueryBuilderSetupState.ts +1 -1
- package/src/stores/QueryBuilderState.ts +35 -94
- package/src/stores/QueryBuilderTestUtils.ts +93 -0
- package/src/stores/QueryBuilderTypeaheadHelper.ts +149 -0
- package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +9 -7
- package/src/stores/QueryEditorStore.ts +19 -3
- package/src/stores/QueryFunctionsExplorerState.ts +1 -11
- package/src/stores/QueryParametersState.ts +1 -3
- package/src/stores/filterOperators/QueryBuilderFilterOperator_Equal.ts +14 -36
- package/src/stores/filterOperators/QueryBuilderFilterOperator_GreaterThan.ts +17 -36
- package/src/stores/filterOperators/QueryBuilderFilterOperator_GreaterThanEqual.ts +17 -36
- package/src/stores/filterOperators/QueryBuilderFilterOperator_LessThan.ts +17 -37
- package/src/stores/filterOperators/QueryBuilderFilterOperator_LessThanEqual.ts +17 -36
- package/src/stores/postFilterOperators/QueryBuilderPostFilterOperator_Equal.ts +14 -34
- package/src/stores/postFilterOperators/QueryBuilderPostFilterOperator_GreaterThan.ts +19 -37
- package/src/stores/postFilterOperators/QueryBuilderPostFilterOperator_LessThan.ts +19 -37
- package/tsconfig.json +4 -0
@@ -24,7 +24,6 @@ import {
|
|
24
24
|
type SimpleFunctionExpression,
|
25
25
|
type AbstractPropertyExpression,
|
26
26
|
PRIMITIVE_TYPE,
|
27
|
-
isSuperType,
|
28
27
|
SUPPORTED_FUNCTIONS,
|
29
28
|
buildPrimitiveInstanceValue,
|
30
29
|
} from '@finos/legend-graph';
|
@@ -35,7 +34,10 @@ import {
|
|
35
34
|
} from './QueryBuilderFilterOperatorHelper.js';
|
36
35
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
37
36
|
import { generateDefaultValueForPrimitiveType } from '../QueryBuilderValueSpecificationBuilderHelper.js';
|
38
|
-
import {
|
37
|
+
import {
|
38
|
+
getNonCollectionValueSpecificationType,
|
39
|
+
isTypeCompatibleWithConditionValueType,
|
40
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
39
41
|
|
40
42
|
export class QueryBuilderFilterOperator_GreaterThan extends QueryBuilderFilterOperator {
|
41
43
|
getLabel(filterConditionState: FilterConditionState): string {
|
@@ -64,40 +66,12 @@ export class QueryBuilderFilterOperator_GreaterThan extends QueryBuilderFilterOp
|
|
64
66
|
isCompatibleWithFilterConditionValue(
|
65
67
|
filterConditionState: FilterConditionState,
|
66
68
|
): boolean {
|
67
|
-
|
69
|
+
return isTypeCompatibleWithConditionValueType(
|
70
|
+
filterConditionState.value
|
71
|
+
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
+
: undefined,
|
68
73
|
filterConditionState.propertyExpressionState.propertyExpression.func
|
69
|
-
.genericType.value.rawType
|
70
|
-
const type = filterConditionState.value
|
71
|
-
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
-
: undefined;
|
73
|
-
const NUMERIC_PRIMITIVE_TYPES = [
|
74
|
-
PRIMITIVE_TYPE.NUMBER,
|
75
|
-
PRIMITIVE_TYPE.INTEGER,
|
76
|
-
PRIMITIVE_TYPE.DECIMAL,
|
77
|
-
PRIMITIVE_TYPE.FLOAT,
|
78
|
-
] as string[];
|
79
|
-
|
80
|
-
const DATE_PRIMITIVE_TYPES = [
|
81
|
-
PRIMITIVE_TYPE.DATE,
|
82
|
-
PRIMITIVE_TYPE.DATETIME,
|
83
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
84
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
85
|
-
] as string[];
|
86
|
-
|
87
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
88
|
-
return (
|
89
|
-
type !== undefined &&
|
90
|
-
// Numeric value is handled loosely because of autoboxing
|
91
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
92
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
93
|
-
NUMERIC_PRIMITIVE_TYPES.includes(propertyType.path)) ||
|
94
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
95
|
-
// This is because we would simulate auto-boxing for date by altering the
|
96
|
-
// Pure function used for the operation
|
97
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
98
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
99
|
-
type === propertyType ||
|
100
|
-
isSuperType(propertyType, type))
|
74
|
+
.genericType.value.rawType,
|
101
75
|
);
|
102
76
|
}
|
103
77
|
|
@@ -112,7 +86,6 @@ export class QueryBuilderFilterOperator_GreaterThan extends QueryBuilderFilterOp
|
|
112
86
|
case PRIMITIVE_TYPE.DECIMAL:
|
113
87
|
case PRIMITIVE_TYPE.FLOAT:
|
114
88
|
case PRIMITIVE_TYPE.INTEGER:
|
115
|
-
case PRIMITIVE_TYPE.DATE:
|
116
89
|
case PRIMITIVE_TYPE.STRICTDATE:
|
117
90
|
case PRIMITIVE_TYPE.DATETIME: {
|
118
91
|
return buildPrimitiveInstanceValue(
|
@@ -122,6 +95,14 @@ export class QueryBuilderFilterOperator_GreaterThan extends QueryBuilderFilterOp
|
|
122
95
|
generateDefaultValueForPrimitiveType(propertyType.path),
|
123
96
|
);
|
124
97
|
}
|
98
|
+
case PRIMITIVE_TYPE.DATE: {
|
99
|
+
return buildPrimitiveInstanceValue(
|
100
|
+
filterConditionState.filterState.queryBuilderState.graphManagerState
|
101
|
+
.graph,
|
102
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
103
|
+
generateDefaultValueForPrimitiveType(propertyType.path),
|
104
|
+
);
|
105
|
+
}
|
125
106
|
default:
|
126
107
|
throw new UnsupportedOperationError(
|
127
108
|
`Can't get default value for filter operator '${this.getLabel(
|
@@ -24,7 +24,6 @@ import {
|
|
24
24
|
type ValueSpecification,
|
25
25
|
type SimpleFunctionExpression,
|
26
26
|
type AbstractPropertyExpression,
|
27
|
-
isSuperType,
|
28
27
|
SUPPORTED_FUNCTIONS,
|
29
28
|
buildPrimitiveInstanceValue,
|
30
29
|
} from '@finos/legend-graph';
|
@@ -35,7 +34,10 @@ import {
|
|
35
34
|
} from './QueryBuilderFilterOperatorHelper.js';
|
36
35
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
37
36
|
import { generateDefaultValueForPrimitiveType } from '../QueryBuilderValueSpecificationBuilderHelper.js';
|
38
|
-
import {
|
37
|
+
import {
|
38
|
+
getNonCollectionValueSpecificationType,
|
39
|
+
isTypeCompatibleWithConditionValueType,
|
40
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
39
41
|
|
40
42
|
export class QueryBuilderFilterOperator_GreaterThanEqual extends QueryBuilderFilterOperator {
|
41
43
|
getLabel(filterConditionState: FilterConditionState): string {
|
@@ -64,40 +66,12 @@ export class QueryBuilderFilterOperator_GreaterThanEqual extends QueryBuilderFil
|
|
64
66
|
isCompatibleWithFilterConditionValue(
|
65
67
|
filterConditionState: FilterConditionState,
|
66
68
|
): boolean {
|
67
|
-
|
69
|
+
return isTypeCompatibleWithConditionValueType(
|
70
|
+
filterConditionState.value
|
71
|
+
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
+
: undefined,
|
68
73
|
filterConditionState.propertyExpressionState.propertyExpression.func
|
69
|
-
.genericType.value.rawType
|
70
|
-
const type = filterConditionState.value
|
71
|
-
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
-
: undefined;
|
73
|
-
const NUMERIC_PRIMITIVE_TYPES = [
|
74
|
-
PRIMITIVE_TYPE.NUMBER,
|
75
|
-
PRIMITIVE_TYPE.INTEGER,
|
76
|
-
PRIMITIVE_TYPE.DECIMAL,
|
77
|
-
PRIMITIVE_TYPE.FLOAT,
|
78
|
-
] as string[];
|
79
|
-
|
80
|
-
const DATE_PRIMITIVE_TYPES = [
|
81
|
-
PRIMITIVE_TYPE.DATE,
|
82
|
-
PRIMITIVE_TYPE.DATETIME,
|
83
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
84
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
85
|
-
] as string[];
|
86
|
-
|
87
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
88
|
-
return (
|
89
|
-
type !== undefined &&
|
90
|
-
// Numeric value is handled loosely because of autoboxing
|
91
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
92
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
93
|
-
NUMERIC_PRIMITIVE_TYPES.includes(propertyType.path)) ||
|
94
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
95
|
-
// This is because we would simulate auto-boxing for date by altering the
|
96
|
-
// Pure function used for the operation
|
97
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
98
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
99
|
-
type === propertyType ||
|
100
|
-
isSuperType(propertyType, type))
|
74
|
+
.genericType.value.rawType,
|
101
75
|
);
|
102
76
|
}
|
103
77
|
|
@@ -112,7 +86,6 @@ export class QueryBuilderFilterOperator_GreaterThanEqual extends QueryBuilderFil
|
|
112
86
|
case PRIMITIVE_TYPE.DECIMAL:
|
113
87
|
case PRIMITIVE_TYPE.FLOAT:
|
114
88
|
case PRIMITIVE_TYPE.INTEGER:
|
115
|
-
case PRIMITIVE_TYPE.DATE:
|
116
89
|
case PRIMITIVE_TYPE.STRICTDATE:
|
117
90
|
case PRIMITIVE_TYPE.DATETIME: {
|
118
91
|
return buildPrimitiveInstanceValue(
|
@@ -122,6 +95,14 @@ export class QueryBuilderFilterOperator_GreaterThanEqual extends QueryBuilderFil
|
|
122
95
|
generateDefaultValueForPrimitiveType(propertyType.path),
|
123
96
|
);
|
124
97
|
}
|
98
|
+
case PRIMITIVE_TYPE.DATE: {
|
99
|
+
return buildPrimitiveInstanceValue(
|
100
|
+
filterConditionState.filterState.queryBuilderState.graphManagerState
|
101
|
+
.graph,
|
102
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
103
|
+
generateDefaultValueForPrimitiveType(propertyType.path),
|
104
|
+
);
|
105
|
+
}
|
125
106
|
default:
|
126
107
|
throw new UnsupportedOperationError(
|
127
108
|
`Can't get default value for filter operator '${this.getLabel(
|
@@ -24,7 +24,6 @@ import {
|
|
24
24
|
type ValueSpecification,
|
25
25
|
type SimpleFunctionExpression,
|
26
26
|
type AbstractPropertyExpression,
|
27
|
-
isSuperType,
|
28
27
|
SUPPORTED_FUNCTIONS,
|
29
28
|
buildPrimitiveInstanceValue,
|
30
29
|
} from '@finos/legend-graph';
|
@@ -35,7 +34,10 @@ import {
|
|
35
34
|
} from './QueryBuilderFilterOperatorHelper.js';
|
36
35
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
37
36
|
import { generateDefaultValueForPrimitiveType } from '../QueryBuilderValueSpecificationBuilderHelper.js';
|
38
|
-
import {
|
37
|
+
import {
|
38
|
+
getNonCollectionValueSpecificationType,
|
39
|
+
isTypeCompatibleWithConditionValueType,
|
40
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
39
41
|
|
40
42
|
export class QueryBuilderFilterOperator_LessThan extends QueryBuilderFilterOperator {
|
41
43
|
getLabel(filterConditionState: FilterConditionState): string {
|
@@ -64,41 +66,12 @@ export class QueryBuilderFilterOperator_LessThan extends QueryBuilderFilterOpera
|
|
64
66
|
isCompatibleWithFilterConditionValue(
|
65
67
|
filterConditionState: FilterConditionState,
|
66
68
|
): boolean {
|
67
|
-
|
69
|
+
return isTypeCompatibleWithConditionValueType(
|
70
|
+
filterConditionState.value
|
71
|
+
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
+
: undefined,
|
68
73
|
filterConditionState.propertyExpressionState.propertyExpression.func
|
69
|
-
.genericType.value.rawType
|
70
|
-
const type = filterConditionState.value
|
71
|
-
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
-
: undefined;
|
73
|
-
const NUMERIC_PRIMITIVE_TYPES = [
|
74
|
-
PRIMITIVE_TYPE.NUMBER,
|
75
|
-
PRIMITIVE_TYPE.INTEGER,
|
76
|
-
PRIMITIVE_TYPE.DECIMAL,
|
77
|
-
PRIMITIVE_TYPE.FLOAT,
|
78
|
-
] as string[];
|
79
|
-
|
80
|
-
const DATE_PRIMITIVE_TYPES = [
|
81
|
-
PRIMITIVE_TYPE.DATE,
|
82
|
-
PRIMITIVE_TYPE.DATETIME,
|
83
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
84
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
85
|
-
] as string[];
|
86
|
-
|
87
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
88
|
-
return (
|
89
|
-
type !== undefined &&
|
90
|
-
// Numeric value is handled loosely because of autoboxing
|
91
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
92
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
93
|
-
NUMERIC_PRIMITIVE_TYPES.includes(propertyType.path)) ||
|
94
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
95
|
-
// This is because we would simulate auto-boxing for date by altering the
|
96
|
-
// Pure function used for the operation
|
97
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
98
|
-
(propertyType.path === PRIMITIVE_TYPE.DATETIME &&
|
99
|
-
DATE_PRIMITIVE_TYPES.includes(type.path)) ||
|
100
|
-
type === propertyType ||
|
101
|
-
isSuperType(propertyType, type))
|
74
|
+
.genericType.value.rawType,
|
102
75
|
);
|
103
76
|
}
|
104
77
|
|
@@ -113,7 +86,6 @@ export class QueryBuilderFilterOperator_LessThan extends QueryBuilderFilterOpera
|
|
113
86
|
case PRIMITIVE_TYPE.DECIMAL:
|
114
87
|
case PRIMITIVE_TYPE.FLOAT:
|
115
88
|
case PRIMITIVE_TYPE.INTEGER:
|
116
|
-
case PRIMITIVE_TYPE.DATE:
|
117
89
|
case PRIMITIVE_TYPE.STRICTDATE:
|
118
90
|
case PRIMITIVE_TYPE.DATETIME: {
|
119
91
|
return buildPrimitiveInstanceValue(
|
@@ -123,6 +95,14 @@ export class QueryBuilderFilterOperator_LessThan extends QueryBuilderFilterOpera
|
|
123
95
|
generateDefaultValueForPrimitiveType(propertyType.path),
|
124
96
|
);
|
125
97
|
}
|
98
|
+
case PRIMITIVE_TYPE.DATE: {
|
99
|
+
return buildPrimitiveInstanceValue(
|
100
|
+
filterConditionState.filterState.queryBuilderState.graphManagerState
|
101
|
+
.graph,
|
102
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
103
|
+
generateDefaultValueForPrimitiveType(propertyType.path),
|
104
|
+
);
|
105
|
+
}
|
126
106
|
default:
|
127
107
|
throw new UnsupportedOperationError(
|
128
108
|
`Can't get default value for filter operator '${this.getLabel(
|
@@ -24,7 +24,6 @@ import {
|
|
24
24
|
type ValueSpecification,
|
25
25
|
type SimpleFunctionExpression,
|
26
26
|
type AbstractPropertyExpression,
|
27
|
-
isSuperType,
|
28
27
|
SUPPORTED_FUNCTIONS,
|
29
28
|
buildPrimitiveInstanceValue,
|
30
29
|
} from '@finos/legend-graph';
|
@@ -35,7 +34,10 @@ import {
|
|
35
34
|
} from './QueryBuilderFilterOperatorHelper.js';
|
36
35
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
37
36
|
import { generateDefaultValueForPrimitiveType } from '../QueryBuilderValueSpecificationBuilderHelper.js';
|
38
|
-
import {
|
37
|
+
import {
|
38
|
+
getNonCollectionValueSpecificationType,
|
39
|
+
isTypeCompatibleWithConditionValueType,
|
40
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
39
41
|
|
40
42
|
export class QueryBuilderFilterOperator_LessThanEqual extends QueryBuilderFilterOperator {
|
41
43
|
getLabel(filterConditionState: FilterConditionState): string {
|
@@ -64,40 +66,12 @@ export class QueryBuilderFilterOperator_LessThanEqual extends QueryBuilderFilter
|
|
64
66
|
isCompatibleWithFilterConditionValue(
|
65
67
|
filterConditionState: FilterConditionState,
|
66
68
|
): boolean {
|
67
|
-
|
69
|
+
return isTypeCompatibleWithConditionValueType(
|
70
|
+
filterConditionState.value
|
71
|
+
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
+
: undefined,
|
68
73
|
filterConditionState.propertyExpressionState.propertyExpression.func
|
69
|
-
.genericType.value.rawType
|
70
|
-
const type = filterConditionState.value
|
71
|
-
? getNonCollectionValueSpecificationType(filterConditionState.value)
|
72
|
-
: undefined;
|
73
|
-
const NUMERIC_PRIMITIVE_TYPES = [
|
74
|
-
PRIMITIVE_TYPE.NUMBER,
|
75
|
-
PRIMITIVE_TYPE.INTEGER,
|
76
|
-
PRIMITIVE_TYPE.DECIMAL,
|
77
|
-
PRIMITIVE_TYPE.FLOAT,
|
78
|
-
] as string[];
|
79
|
-
|
80
|
-
const DATE_PRIMITIVE_TYPES = [
|
81
|
-
PRIMITIVE_TYPE.DATE,
|
82
|
-
PRIMITIVE_TYPE.DATETIME,
|
83
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
84
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
85
|
-
] as string[];
|
86
|
-
|
87
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
88
|
-
return (
|
89
|
-
type !== undefined &&
|
90
|
-
// Numeric value is handled loosely because of autoboxing
|
91
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
92
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
93
|
-
NUMERIC_PRIMITIVE_TYPES.includes(propertyType.path)) ||
|
94
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
95
|
-
// This is because we would simulate auto-boxing for date by altering the
|
96
|
-
// Pure function used for the operation
|
97
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
98
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
99
|
-
type === propertyType ||
|
100
|
-
isSuperType(propertyType, type))
|
74
|
+
.genericType.value.rawType,
|
101
75
|
);
|
102
76
|
}
|
103
77
|
|
@@ -112,7 +86,6 @@ export class QueryBuilderFilterOperator_LessThanEqual extends QueryBuilderFilter
|
|
112
86
|
case PRIMITIVE_TYPE.DECIMAL:
|
113
87
|
case PRIMITIVE_TYPE.FLOAT:
|
114
88
|
case PRIMITIVE_TYPE.INTEGER:
|
115
|
-
case PRIMITIVE_TYPE.DATE:
|
116
89
|
case PRIMITIVE_TYPE.STRICTDATE:
|
117
90
|
case PRIMITIVE_TYPE.DATETIME: {
|
118
91
|
return buildPrimitiveInstanceValue(
|
@@ -122,6 +95,14 @@ export class QueryBuilderFilterOperator_LessThanEqual extends QueryBuilderFilter
|
|
122
95
|
generateDefaultValueForPrimitiveType(propertyType.path),
|
123
96
|
);
|
124
97
|
}
|
98
|
+
case PRIMITIVE_TYPE.DATE: {
|
99
|
+
return buildPrimitiveInstanceValue(
|
100
|
+
filterConditionState.filterState.queryBuilderState.graphManagerState
|
101
|
+
.graph,
|
102
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
103
|
+
generateDefaultValueForPrimitiveType(propertyType.path),
|
104
|
+
);
|
105
|
+
}
|
125
106
|
default:
|
126
107
|
throw new UnsupportedOperationError(
|
127
108
|
`Can't get default value for filter operator '${this.getLabel(
|
@@ -28,7 +28,6 @@ import {
|
|
28
28
|
GenericTypeExplicitReference,
|
29
29
|
PRIMITIVE_TYPE,
|
30
30
|
TYPICAL_MULTIPLICITY_TYPE,
|
31
|
-
isSuperType,
|
32
31
|
SUPPORTED_FUNCTIONS,
|
33
32
|
buildPrimitiveInstanceValue,
|
34
33
|
} from '@finos/legend-graph';
|
@@ -40,6 +39,7 @@ import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
|
40
39
|
import {
|
41
40
|
buildNotExpression,
|
42
41
|
getNonCollectionValueSpecificationType,
|
42
|
+
isTypeCompatibleWithConditionValueType,
|
43
43
|
unwrapNotExpression,
|
44
44
|
} from '../QueryBuilderOperatorsHelper.js';
|
45
45
|
import { QueryBuilderPostFilterOperator } from '../QueryBuilderPostFilterOperator.js';
|
@@ -79,40 +79,13 @@ export class QueryBuilderPostFilterOperator_Equal extends QueryBuilderPostFilter
|
|
79
79
|
isCompatibleWithConditionValue(
|
80
80
|
postFilterConditionState: PostFilterConditionState,
|
81
81
|
): boolean {
|
82
|
-
const lhsType = guaranteeNonNullable(
|
83
|
-
postFilterConditionState.columnState.getReturnType(),
|
84
|
-
);
|
85
82
|
const valueSpecification = postFilterConditionState.value;
|
86
83
|
if (valueSpecification) {
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
PRIMITIVE_TYPE.FLOAT,
|
93
|
-
] as string[];
|
94
|
-
|
95
|
-
const DATE_PRIMITIVE_TYPES = [
|
96
|
-
PRIMITIVE_TYPE.DATE,
|
97
|
-
PRIMITIVE_TYPE.DATETIME,
|
98
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
99
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
100
|
-
] as string[];
|
101
|
-
|
102
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
103
|
-
return (
|
104
|
-
type !== undefined &&
|
105
|
-
// Numeric value is handled loosely because of autoboxing
|
106
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
107
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
108
|
-
NUMERIC_PRIMITIVE_TYPES.includes(lhsType.path)) ||
|
109
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
110
|
-
// This is because we would simulate auto-boxing for date by altering the
|
111
|
-
// Pure function used for the operation
|
112
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
113
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
114
|
-
type === lhsType ||
|
115
|
-
isSuperType(lhsType, type))
|
84
|
+
return isTypeCompatibleWithConditionValueType(
|
85
|
+
getNonCollectionValueSpecificationType(valueSpecification),
|
86
|
+
guaranteeNonNullable(
|
87
|
+
postFilterConditionState.columnState.getReturnType(),
|
88
|
+
),
|
116
89
|
);
|
117
90
|
}
|
118
91
|
return false;
|
@@ -127,7 +100,6 @@ export class QueryBuilderPostFilterOperator_Equal extends QueryBuilderPostFilter
|
|
127
100
|
switch (propertyType.path) {
|
128
101
|
case PRIMITIVE_TYPE.STRING:
|
129
102
|
case PRIMITIVE_TYPE.BOOLEAN:
|
130
|
-
case PRIMITIVE_TYPE.DATE:
|
131
103
|
case PRIMITIVE_TYPE.STRICTDATE:
|
132
104
|
case PRIMITIVE_TYPE.DATETIME:
|
133
105
|
case PRIMITIVE_TYPE.NUMBER:
|
@@ -141,6 +113,14 @@ export class QueryBuilderPostFilterOperator_Equal extends QueryBuilderPostFilter
|
|
141
113
|
generateDefaultValueForPrimitiveType(propertyType.path),
|
142
114
|
);
|
143
115
|
}
|
116
|
+
case PRIMITIVE_TYPE.DATE: {
|
117
|
+
return buildPrimitiveInstanceValue(
|
118
|
+
postFilterConditionState.postFilterState.queryBuilderState
|
119
|
+
.graphManagerState.graph,
|
120
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
121
|
+
generateDefaultValueForPrimitiveType(propertyType.path),
|
122
|
+
);
|
123
|
+
}
|
144
124
|
default:
|
145
125
|
if (propertyType instanceof Enumeration) {
|
146
126
|
if (propertyType.values.length > 0) {
|
@@ -20,7 +20,6 @@ import {
|
|
20
20
|
type FunctionExpression,
|
21
21
|
AbstractPropertyExpression,
|
22
22
|
PRIMITIVE_TYPE,
|
23
|
-
isSuperType,
|
24
23
|
SUPPORTED_FUNCTIONS,
|
25
24
|
buildPrimitiveInstanceValue,
|
26
25
|
} from '@finos/legend-graph';
|
@@ -29,7 +28,10 @@ import {
|
|
29
28
|
UnsupportedOperationError,
|
30
29
|
} from '@finos/legend-shared';
|
31
30
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
32
|
-
import {
|
31
|
+
import {
|
32
|
+
getNonCollectionValueSpecificationType,
|
33
|
+
isTypeCompatibleWithConditionValueType,
|
34
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
33
35
|
import { QueryBuilderPostFilterOperator } from '../QueryBuilderPostFilterOperator.js';
|
34
36
|
import { buildPostFilterConditionState } from '../QueryBuilderPostFilterProcessor.js';
|
35
37
|
import type {
|
@@ -61,40 +63,13 @@ export class QueryBuilderPostFilterOperator_GreaterThan extends QueryBuilderPost
|
|
61
63
|
isCompatibleWithConditionValue(
|
62
64
|
postFilterConditionState: PostFilterConditionState,
|
63
65
|
): boolean {
|
64
|
-
|
65
|
-
postFilterConditionState.
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
PRIMITIVE_TYPE.NUMBER,
|
72
|
-
PRIMITIVE_TYPE.INTEGER,
|
73
|
-
PRIMITIVE_TYPE.DECIMAL,
|
74
|
-
PRIMITIVE_TYPE.FLOAT,
|
75
|
-
] as string[];
|
76
|
-
|
77
|
-
const DATE_PRIMITIVE_TYPES = [
|
78
|
-
PRIMITIVE_TYPE.DATE,
|
79
|
-
PRIMITIVE_TYPE.DATETIME,
|
80
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
81
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
82
|
-
] as string[];
|
83
|
-
|
84
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
85
|
-
return (
|
86
|
-
type !== undefined &&
|
87
|
-
// Numeric value is handled loosely because of autoboxing
|
88
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
89
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
90
|
-
NUMERIC_PRIMITIVE_TYPES.includes(lhsType.path)) ||
|
91
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
92
|
-
// This is because we would simulate auto-boxing for date by altering the
|
93
|
-
// Pure function used for the operation
|
94
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
95
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
96
|
-
type === lhsType ||
|
97
|
-
isSuperType(lhsType, type))
|
66
|
+
return isTypeCompatibleWithConditionValueType(
|
67
|
+
postFilterConditionState.value
|
68
|
+
? getNonCollectionValueSpecificationType(postFilterConditionState.value)
|
69
|
+
: undefined,
|
70
|
+
guaranteeNonNullable(
|
71
|
+
postFilterConditionState.columnState.getReturnType(),
|
72
|
+
),
|
98
73
|
);
|
99
74
|
}
|
100
75
|
|
@@ -107,7 +82,6 @@ export class QueryBuilderPostFilterOperator_GreaterThan extends QueryBuilderPost
|
|
107
82
|
case PRIMITIVE_TYPE.DECIMAL:
|
108
83
|
case PRIMITIVE_TYPE.FLOAT:
|
109
84
|
case PRIMITIVE_TYPE.INTEGER:
|
110
|
-
case PRIMITIVE_TYPE.DATE:
|
111
85
|
case PRIMITIVE_TYPE.STRICTDATE:
|
112
86
|
case PRIMITIVE_TYPE.DATETIME: {
|
113
87
|
return buildPrimitiveInstanceValue(
|
@@ -117,6 +91,14 @@ export class QueryBuilderPostFilterOperator_GreaterThan extends QueryBuilderPost
|
|
117
91
|
generateDefaultValueForPrimitiveType(propertyType.path),
|
118
92
|
);
|
119
93
|
}
|
94
|
+
case PRIMITIVE_TYPE.DATE: {
|
95
|
+
return buildPrimitiveInstanceValue(
|
96
|
+
postFilterConditionState.postFilterState.queryBuilderState
|
97
|
+
.graphManagerState.graph,
|
98
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
99
|
+
generateDefaultValueForPrimitiveType(propertyType.path),
|
100
|
+
);
|
101
|
+
}
|
120
102
|
default:
|
121
103
|
throw new UnsupportedOperationError(
|
122
104
|
`Can't get default value for post-filter operator '${this.getLabel()}' when the LHS property is of type '${
|
@@ -21,7 +21,6 @@ import {
|
|
21
21
|
type FunctionExpression,
|
22
22
|
PRIMITIVE_TYPE,
|
23
23
|
SUPPORTED_FUNCTIONS,
|
24
|
-
isSuperType,
|
25
24
|
buildPrimitiveInstanceValue,
|
26
25
|
} from '@finos/legend-graph';
|
27
26
|
import {
|
@@ -29,7 +28,10 @@ import {
|
|
29
28
|
UnsupportedOperationError,
|
30
29
|
} from '@finos/legend-shared';
|
31
30
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../QueryBuilder_Const.js';
|
32
|
-
import {
|
31
|
+
import {
|
32
|
+
getNonCollectionValueSpecificationType,
|
33
|
+
isTypeCompatibleWithConditionValueType,
|
34
|
+
} from '../QueryBuilderOperatorsHelper.js';
|
33
35
|
import { QueryBuilderPostFilterOperator } from '../QueryBuilderPostFilterOperator.js';
|
34
36
|
import { buildPostFilterConditionState } from '../QueryBuilderPostFilterProcessor.js';
|
35
37
|
import type {
|
@@ -61,40 +63,13 @@ export class QueryBuilderPostFilterOperator_LessThan extends QueryBuilderPostFil
|
|
61
63
|
isCompatibleWithConditionValue(
|
62
64
|
postFilterConditionState: PostFilterConditionState,
|
63
65
|
): boolean {
|
64
|
-
|
65
|
-
postFilterConditionState.
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
PRIMITIVE_TYPE.NUMBER,
|
72
|
-
PRIMITIVE_TYPE.INTEGER,
|
73
|
-
PRIMITIVE_TYPE.DECIMAL,
|
74
|
-
PRIMITIVE_TYPE.FLOAT,
|
75
|
-
] as string[];
|
76
|
-
|
77
|
-
const DATE_PRIMITIVE_TYPES = [
|
78
|
-
PRIMITIVE_TYPE.DATE,
|
79
|
-
PRIMITIVE_TYPE.DATETIME,
|
80
|
-
PRIMITIVE_TYPE.STRICTDATE,
|
81
|
-
PRIMITIVE_TYPE.LATESTDATE,
|
82
|
-
] as string[];
|
83
|
-
|
84
|
-
// When changing the return type for LHS, the RHS value should be adjusted accordingly.
|
85
|
-
return (
|
86
|
-
type !== undefined &&
|
87
|
-
// Numeric value is handled loosely because of autoboxing
|
88
|
-
// e.g. LHS (integer) = RHS (float) is acceptable
|
89
|
-
((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
|
90
|
-
NUMERIC_PRIMITIVE_TYPES.includes(lhsType.path)) ||
|
91
|
-
// Date value is handled loosely as well if the LHS is of type DateTime
|
92
|
-
// This is because we would simulate auto-boxing for date by altering the
|
93
|
-
// Pure function used for the operation
|
94
|
-
// e.g. LHS(DateTime) = RHS(Date) -> we use isOnDay() instead of is()
|
95
|
-
DATE_PRIMITIVE_TYPES.includes(type.path) ||
|
96
|
-
type === lhsType ||
|
97
|
-
isSuperType(lhsType, type))
|
66
|
+
return isTypeCompatibleWithConditionValueType(
|
67
|
+
postFilterConditionState.value
|
68
|
+
? getNonCollectionValueSpecificationType(postFilterConditionState.value)
|
69
|
+
: undefined,
|
70
|
+
guaranteeNonNullable(
|
71
|
+
postFilterConditionState.columnState.getReturnType(),
|
72
|
+
),
|
98
73
|
);
|
99
74
|
}
|
100
75
|
|
@@ -107,7 +82,6 @@ export class QueryBuilderPostFilterOperator_LessThan extends QueryBuilderPostFil
|
|
107
82
|
case PRIMITIVE_TYPE.DECIMAL:
|
108
83
|
case PRIMITIVE_TYPE.FLOAT:
|
109
84
|
case PRIMITIVE_TYPE.INTEGER:
|
110
|
-
case PRIMITIVE_TYPE.DATE:
|
111
85
|
case PRIMITIVE_TYPE.STRICTDATE:
|
112
86
|
case PRIMITIVE_TYPE.DATETIME: {
|
113
87
|
return buildPrimitiveInstanceValue(
|
@@ -117,6 +91,14 @@ export class QueryBuilderPostFilterOperator_LessThan extends QueryBuilderPostFil
|
|
117
91
|
generateDefaultValueForPrimitiveType(propertyType.path),
|
118
92
|
);
|
119
93
|
}
|
94
|
+
case PRIMITIVE_TYPE.DATE: {
|
95
|
+
return buildPrimitiveInstanceValue(
|
96
|
+
postFilterConditionState.postFilterState.queryBuilderState
|
97
|
+
.graphManagerState.graph,
|
98
|
+
PRIMITIVE_TYPE.STRICTDATE,
|
99
|
+
generateDefaultValueForPrimitiveType(propertyType.path),
|
100
|
+
);
|
101
|
+
}
|
120
102
|
default:
|
121
103
|
throw new UnsupportedOperationError(
|
122
104
|
`Can't get default value for post-filter operator '${this.getLabel()}' when the LHS property is of type '${
|
package/tsconfig.json
CHANGED
@@ -61,6 +61,7 @@
|
|
61
61
|
"./src/stores/QueryBuilderGraphFetchTreeUtil.ts",
|
62
62
|
"./src/stores/QueryBuilderLambdaBuilder.ts",
|
63
63
|
"./src/stores/QueryBuilderLambdaProcessor.ts",
|
64
|
+
"./src/stores/QueryBuilderOperatorLoader.ts",
|
64
65
|
"./src/stores/QueryBuilderOperatorsHelper.ts",
|
65
66
|
"./src/stores/QueryBuilderPostFilterOperator.ts",
|
66
67
|
"./src/stores/QueryBuilderPostFilterProcessor.ts",
|
@@ -72,6 +73,8 @@
|
|
72
73
|
"./src/stores/QueryBuilderResultState.ts",
|
73
74
|
"./src/stores/QueryBuilderSetupState.ts",
|
74
75
|
"./src/stores/QueryBuilderState.ts",
|
76
|
+
"./src/stores/QueryBuilderTestUtils.ts",
|
77
|
+
"./src/stores/QueryBuilderTypeaheadHelper.ts",
|
75
78
|
"./src/stores/QueryBuilderUnsupportedState.ts",
|
76
79
|
"./src/stores/QueryBuilderValueSpecificationBuilderHelper.ts",
|
77
80
|
"./src/stores/QueryEditorStore.ts",
|
@@ -125,6 +128,7 @@
|
|
125
128
|
"./src/components/QueryBuilderGraphFetchTreePanel.tsx",
|
126
129
|
"./src/components/QueryBuilderLambdaEditor.tsx",
|
127
130
|
"./src/components/QueryBuilderMilestoneEditor.tsx",
|
131
|
+
"./src/components/QueryBuilderPanelIssueCountBadge.tsx",
|
128
132
|
"./src/components/QueryBuilderParameterPanel.tsx",
|
129
133
|
"./src/components/QueryBuilderPostFilterPanel.tsx",
|
130
134
|
"./src/components/QueryBuilderProjectionPanel.tsx",
|