@finos/legend-query-builder 4.18.19 → 4.18.21
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/components/filter/QueryBuilderFilterPanel.d.ts +7 -1
- package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js +28 -2
- package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.js +16 -1
- package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
- package/lib/components/shared/QueryBuilderFilterHelper.d.ts.map +1 -1
- package/lib/components/shared/QueryBuilderFilterHelper.js +3 -0
- package/lib/components/shared/QueryBuilderFilterHelper.js.map +1 -1
- package/lib/data-access-overview.css +1 -1
- package/lib/index.css +16 -0
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderStateHashUtils.d.ts +1 -0
- package/lib/stores/QueryBuilderStateHashUtils.d.ts.map +1 -1
- package/lib/stores/QueryBuilderStateHashUtils.js +1 -0
- package/lib/stores/QueryBuilderStateHashUtils.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js +11 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.js +20 -5
- package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.js.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterState.d.ts +12 -1
- package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterState.js +51 -0
- package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.js +26 -2
- package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.d.ts.map +1 -1
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js +20 -7
- package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js.map +1 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.js +22 -7
- package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
- package/package.json +5 -5
- package/src/components/filter/QueryBuilderFilterPanel.tsx +101 -0
- package/src/components/shared/BasicValueSpecificationEditor.tsx +16 -0
- package/src/components/shared/QueryBuilderFilterHelper.ts +4 -0
- package/src/stores/QueryBuilderStateHashUtils.ts +1 -0
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts +22 -0
- package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +25 -4
- package/src/stores/filter/QueryBuilderFilterState.ts +87 -1
- package/src/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.ts +43 -0
- package/src/stores/filter/operators/QueryBuilderFilterOperator_In.ts +25 -10
- package/src/stores/shared/ValueSpecificationEditorHelper.ts +22 -6
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
GenericTypeExplicitReference,
|
|
29
29
|
GenericType,
|
|
30
30
|
Enumeration,
|
|
31
|
+
getPrimitiveTypeInstanceFromEnum,
|
|
31
32
|
PRIMITIVE_TYPE,
|
|
32
33
|
Multiplicity,
|
|
33
34
|
} from '@finos/legend-graph';
|
|
@@ -97,6 +98,15 @@ export class QueryBuilderFilterOperator_In
|
|
|
97
98
|
if (!collectionType) {
|
|
98
99
|
return false;
|
|
99
100
|
}
|
|
101
|
+
// Compare standard primitive equivalents so columns declared with a
|
|
102
|
+
// precise primitive type (e.g. accessor relation columns: Varchar,
|
|
103
|
+
// BigInt, Timestamp) are still recognized as compatible with the
|
|
104
|
+
// standard primitives stored in the value collection.
|
|
105
|
+
const normalizedPropertyTypePath =
|
|
106
|
+
getStandardPrimitiveTypeEquivalent(propertyType) ?? propertyType.path;
|
|
107
|
+
const normalizedCollectionTypePath =
|
|
108
|
+
getStandardPrimitiveTypeEquivalent(collectionType) ??
|
|
109
|
+
collectionType.path;
|
|
100
110
|
if (
|
|
101
111
|
(
|
|
102
112
|
[
|
|
@@ -108,10 +118,7 @@ export class QueryBuilderFilterOperator_In
|
|
|
108
118
|
PRIMITIVE_TYPE.STRICTDATE,
|
|
109
119
|
PRIMITIVE_TYPE.DATETIME,
|
|
110
120
|
] as string[]
|
|
111
|
-
).includes(
|
|
112
|
-
getStandardPrimitiveTypeEquivalent(propertyType) ??
|
|
113
|
-
propertyType.path,
|
|
114
|
-
)
|
|
121
|
+
).includes(normalizedPropertyTypePath)
|
|
115
122
|
) {
|
|
116
123
|
return (
|
|
117
124
|
[
|
|
@@ -123,12 +130,12 @@ export class QueryBuilderFilterOperator_In
|
|
|
123
130
|
PRIMITIVE_TYPE.STRICTDATE,
|
|
124
131
|
PRIMITIVE_TYPE.DATETIME,
|
|
125
132
|
] as string[]
|
|
126
|
-
).includes(
|
|
127
|
-
getStandardPrimitiveTypeEquivalent(collectionType) ??
|
|
128
|
-
collectionType.path,
|
|
129
|
-
);
|
|
133
|
+
).includes(normalizedCollectionTypePath);
|
|
130
134
|
}
|
|
131
|
-
return
|
|
135
|
+
return (
|
|
136
|
+
collectionType === propertyType ||
|
|
137
|
+
normalizedPropertyTypePath === normalizedCollectionTypePath
|
|
138
|
+
);
|
|
132
139
|
} else if (valueSpec instanceof VariableExpression) {
|
|
133
140
|
// check if not a single value
|
|
134
141
|
if (valueSpec.multiplicity.upperBound === 1) {
|
|
@@ -144,9 +151,17 @@ export class QueryBuilderFilterOperator_In
|
|
|
144
151
|
filterConditionState: FilterConditionState,
|
|
145
152
|
): ValueSpecification | undefined {
|
|
146
153
|
const propertyType = filterConditionState.leftConditionType;
|
|
154
|
+
// Normalize precise primitive types (e.g. Varchar, BigInt) to their
|
|
155
|
+
// standard equivalent so the collection's generic type matches the
|
|
156
|
+
// standard primitive values that downstream editors produce.
|
|
157
|
+
const standardPrimitive = getStandardPrimitiveTypeEquivalent(propertyType);
|
|
158
|
+
const collectionType =
|
|
159
|
+
standardPrimitive !== undefined
|
|
160
|
+
? getPrimitiveTypeInstanceFromEnum(standardPrimitive)
|
|
161
|
+
: propertyType;
|
|
147
162
|
return new CollectionInstanceValue(
|
|
148
163
|
Multiplicity.ONE,
|
|
149
|
-
GenericTypeExplicitReference.create(new GenericType(
|
|
164
|
+
GenericTypeExplicitReference.create(new GenericType(collectionType)),
|
|
150
165
|
);
|
|
151
166
|
}
|
|
152
167
|
|
|
@@ -30,7 +30,9 @@ import {
|
|
|
30
30
|
GenericType,
|
|
31
31
|
GenericTypeExplicitReference,
|
|
32
32
|
getEnumValue,
|
|
33
|
+
getPrimitiveTypeInstanceFromEnum,
|
|
33
34
|
PrimitiveInstanceValue,
|
|
35
|
+
PrecisePrimitiveType,
|
|
34
36
|
PrimitiveType,
|
|
35
37
|
PRIMITIVE_TYPE,
|
|
36
38
|
INTERNAL__PropagatedValue,
|
|
@@ -484,11 +486,25 @@ export const convertTextToPrimitiveInstanceValue = (
|
|
|
484
486
|
observerContext: ObserverContext,
|
|
485
487
|
): PrimitiveInstanceValue | null => {
|
|
486
488
|
let result = null;
|
|
489
|
+
// Normalize precise primitive types (e.g. Varchar, BigInt, Timestamp) to
|
|
490
|
+
// their standard primitive equivalent so values entered through the editor
|
|
491
|
+
// are stored as standard PrimitiveInstanceValue regardless of whether the
|
|
492
|
+
// source column was declared with a precise type (e.g. accessor relation
|
|
493
|
+
// columns).
|
|
494
|
+
let resolvedType: PrimitiveType | undefined;
|
|
487
495
|
if (expectedType instanceof PrimitiveType) {
|
|
488
|
-
|
|
496
|
+
resolvedType = expectedType;
|
|
497
|
+
} else if (expectedType instanceof PrecisePrimitiveType) {
|
|
498
|
+
const standard = getStandardPrimitiveTypeEquivalent(expectedType);
|
|
499
|
+
resolvedType = standard
|
|
500
|
+
? getPrimitiveTypeInstanceFromEnum(standard)
|
|
501
|
+
: undefined;
|
|
502
|
+
}
|
|
503
|
+
if (resolvedType) {
|
|
504
|
+
switch (resolvedType.path) {
|
|
489
505
|
case PRIMITIVE_TYPE.STRING: {
|
|
490
506
|
result = new PrimitiveInstanceValue(
|
|
491
|
-
GenericTypeExplicitReference.create(new GenericType(
|
|
507
|
+
GenericTypeExplicitReference.create(new GenericType(resolvedType)),
|
|
492
508
|
);
|
|
493
509
|
instanceValue_setValues(result, [value.toString()], observerContext);
|
|
494
510
|
break;
|
|
@@ -501,11 +517,11 @@ export const convertTextToPrimitiveInstanceValue = (
|
|
|
501
517
|
return null;
|
|
502
518
|
}
|
|
503
519
|
const formattedNumber =
|
|
504
|
-
|
|
520
|
+
resolvedType.path === PRIMITIVE_TYPE.INTEGER
|
|
505
521
|
? Number.parseInt(Number(value).toString(), 10)
|
|
506
522
|
: Number(value);
|
|
507
523
|
result = new PrimitiveInstanceValue(
|
|
508
|
-
GenericTypeExplicitReference.create(new GenericType(
|
|
524
|
+
GenericTypeExplicitReference.create(new GenericType(resolvedType)),
|
|
509
525
|
);
|
|
510
526
|
instanceValue_setValues(result, [formattedNumber], observerContext);
|
|
511
527
|
break;
|
|
@@ -516,7 +532,7 @@ export const convertTextToPrimitiveInstanceValue = (
|
|
|
516
532
|
return null;
|
|
517
533
|
}
|
|
518
534
|
result = new PrimitiveInstanceValue(
|
|
519
|
-
GenericTypeExplicitReference.create(new GenericType(
|
|
535
|
+
GenericTypeExplicitReference.create(new GenericType(resolvedType)),
|
|
520
536
|
);
|
|
521
537
|
instanceValue_setValues(result, [value], observerContext);
|
|
522
538
|
break;
|
|
@@ -532,7 +548,7 @@ export const convertTextToPrimitiveInstanceValue = (
|
|
|
532
548
|
return null;
|
|
533
549
|
}
|
|
534
550
|
result = new PrimitiveInstanceValue(
|
|
535
|
-
GenericTypeExplicitReference.create(new GenericType(
|
|
551
|
+
GenericTypeExplicitReference.create(new GenericType(resolvedType)),
|
|
536
552
|
);
|
|
537
553
|
instanceValue_setValues(result, [value], observerContext);
|
|
538
554
|
break;
|