@finos/legend-query-builder 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/QueryBuilderConstantExpressionPanel.js +1 -1
- package/lib/components/QueryBuilderResultPanel.js +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.js +41 -2
- package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
- package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
- package/lib/components/shared/LambdaEditor.js +1 -1
- package/lib/components/shared/LambdaEditor.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderState.d.ts +5 -4
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +21 -17
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/QueryBuilderStateBuilder.d.ts +2 -2
- package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
- package/lib/stores/QueryBuilderStateBuilder.js +17 -11
- package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
- package/lib/stores/QueryBuilderTextEditorState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderTextEditorState.js +4 -1
- package/lib/stores/QueryBuilderTextEditorState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts +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 +14 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +14 -1
- package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -1
- package/package.json +7 -7
- package/src/components/QueryBuilderConstantExpressionPanel.tsx +1 -1
- package/src/components/QueryBuilderResultPanel.tsx +1 -1
- package/src/components/shared/BasicValueSpecificationEditor.tsx +72 -2
- package/src/components/shared/LambdaEditor.tsx +0 -1
- package/src/stores/QueryBuilderState.ts +31 -18
- package/src/stores/QueryBuilderStateBuilder.ts +21 -17
- package/src/stores/QueryBuilderTextEditorState.ts +4 -1
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts +20 -1
- package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +20 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderTextEditorState.d.ts","sourceRoot":"","sources":["../../src/stores/QueryBuilderTextEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAIL,SAAS,EAGV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,WAAW,EAGhB,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,qBAAa,0BAA0B;IACrC,MAAM,EAAE,SAAS,CAAC;gBAEN,MAAM,EAAE,SAAS;IAS7B,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;CAGnC;AAED,oBAAY,0BAA0B;IACpC,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,qBAAa,2BAA4B,SAAQ,iBAAiB;IAChE,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,cAAc,EAAE,0BAA0B,CAAC;IAC3C,0BAA0B,UAAS;IACnC,IAAI,EAAE,0BAA0B,GAAG,SAAS,CAAC;IAC7C,iBAAiB,cAAwB;IAEzC;;;OAGG;IACH,kBAAkB,SAAM;gBAEZ,iBAAiB,EAAE,iBAAiB;IAiBhD,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,sBAAsB,CAAC,cAAc,EAAE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EAAE,0BAA0B,GAAG,IAAI;IAIxE,OAAO,CAAC,SAAS,EAAE,0BAA0B,GAAG,SAAS,GAAG,IAAI;IAIhE,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAItC,kCAAkC,IAAI,WAAW,CAAC,IAAI,CAAC;IA4BvD,kCAAkC,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC;IAuCvE,SAAS,CAAC,IAAI,EAAE,0BAA0B,GAAG,IAAI;IAqBhD,UAAU,IAAI,WAAW,CAAC,IAAI,CAAC;CAqBjC"}
|
@@ -137,7 +137,10 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
137
137
|
this.queryBuilderState.applicationStore.notificationService.notifyError(`Can't parse query. Please fix error before closing: ${this.parserError.message}`);
|
138
138
|
}
|
139
139
|
else {
|
140
|
-
this.queryBuilderState.rebuildWithQuery(this.rawLambdaState.lambda
|
140
|
+
this.queryBuilderState.rebuildWithQuery(this.rawLambdaState.lambda, {
|
141
|
+
preserveParameterValues: true,
|
142
|
+
preserveResult: true,
|
143
|
+
});
|
141
144
|
this.setMode(undefined);
|
142
145
|
}
|
143
146
|
return;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderTextEditorState.js","sourceRoot":"","sources":["../../src/stores/QueryBuilderTextEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,WAAW,EACX,SAAS,EACT,cAAc,EACd,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,iBAAiB,EACjB,QAAQ,EACR,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,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AI,CAAC,sBAAsB,CAAC,IAAI,0BAA0B,CAAC,SAAS,CAAC,CAAC,CAAC;SACxE;QACD,IAAI,IAAI,KAAK,0BAA0B,CAAC,IAAI,EAAE;YAC5C,IAAI,CAAC,aAAa,CAChB,IAAI,CAAC,SAAS,CACZ,sBAAsB,CACpB,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,YAAY,CAAC,8BAA8B,CAClF,SAAS,CACV,CACF,EACD,IAAI,EACJ,QAAQ,CACT,CACF,CAAC;SACH;QACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IAED,CAAC,UAAU;QACT,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,IAAI,KAAK,0BAA0B,CAAC,IAAI,EAAE;YACjD,MAAM,UAAU,CAAC,IAAI,CAAC,kCAAkC,EAAE,CAAC,CAAC;YAC5D,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,CACrE,uDAAuD,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAClF,CAAC;aACH;iBAAM;gBACL,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"QueryBuilderTextEditorState.js","sourceRoot":"","sources":["../../src/stores/QueryBuilderTextEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,WAAW,EACX,SAAS,EACT,cAAc,EACd,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,iBAAiB,EACjB,QAAQ,EACR,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,UA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ific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { FunctionExpression,
|
16
|
+
import { FunctionExpression, SimpleFunctionExpression } from '@finos/legend-graph';
|
17
17
|
import type { QueryBuilderPostFilterOperator } from './QueryBuilderPostFilterOperator.js';
|
18
18
|
import { type QueryBuilderPostFilterState, PostFilterConditionState } from './QueryBuilderPostFilterState.js';
|
19
19
|
import type { QueryBuilderState } from '../../../QueryBuilderState.js';
|
package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderPostFilterStateBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAOL,kBAAkB,EAClB,
|
1
|
+
{"version":3,"file":"QueryBuilderPostFilterStateBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAOL,kBAAkB,EAClB,wBAAwB,EAEzB,MAAM,qBAAqB,CAAC;AAY7B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAC1F,OAAO,EACL,KAAK,2BAA2B,EAEhC,wBAAwB,EAKzB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAuDvE,eAAO,MAAM,6BAA6B,oBACvB,2BAA2B,cAChC,kBAAkB,4BACJ,MAAM,GAAG,SAAS,YAClC,8BAA8B,KACvC,wBAAwB,GAAG,SAiE7B,CAAC;AA2EF,eAAO,MAAM,8BAA8B,eAC7B,wBAAwB,qBACjB,iBAAiB,KACnC,IAqDF,CAAC"}
|
@@ -13,7 +13,7 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { LambdaFunctionInstanceValue, AbstractPropertyExpression, extractElementNameFromPath, PrimitiveInstanceValue, matchFunctionName, VariableExpression, FunctionExpression, } from '@finos/legend-graph';
|
16
|
+
import { LambdaFunctionInstanceValue, AbstractPropertyExpression, extractElementNameFromPath, PrimitiveInstanceValue, matchFunctionName, VariableExpression, FunctionExpression, SimpleFunctionExpression, MINUS_STRING, } from '@finos/legend-graph';
|
17
17
|
import { assertTrue, assertType, guaranteeIsString, guaranteeNonNullable, guaranteeType, UnsupportedOperationError, } from '@finos/legend-shared';
|
18
18
|
import { QueryBuilderDerivationProjectionColumnState } from '../projection/QueryBuilderProjectionColumnState.js';
|
19
19
|
import { getTDSColumnState } from '../QueryBuilderTDSHelper.js';
|
@@ -71,6 +71,19 @@ export const buildPostFilterConditionState = (postFilterState, expression, opera
|
|
71
71
|
return postConditionState;
|
72
72
|
};
|
73
73
|
const processPostFilterTree = (expression, postFilterState, parentPostFilterNodeId) => {
|
74
|
+
// NOTE: This checks if the expression is a simple function expression of Minus
|
75
|
+
// since negative numbers are returned as a SimpleFunctionExpression of minus(number)
|
76
|
+
// rather than a PrimitiveInstanceValue of -number, so here
|
77
|
+
// we replace the parameter value of the expression directly with a PrimitiveInstanceValue
|
78
|
+
if (expression.parametersValues[1] instanceof SimpleFunctionExpression &&
|
79
|
+
expression.parametersValues[1].functionName === MINUS_STRING &&
|
80
|
+
expression.parametersValues[1].parametersValues[0] instanceof
|
81
|
+
PrimitiveInstanceValue) {
|
82
|
+
expression.parametersValues[1].parametersValues[0].values[0] =
|
83
|
+
parseFloat(expression.parametersValues[1].parametersValues[0].values[0]) * -1;
|
84
|
+
expression.parametersValues[1] =
|
85
|
+
expression.parametersValues[1].parametersValues[0];
|
86
|
+
}
|
74
87
|
const parentNode = parentPostFilterNodeId
|
75
88
|
? postFilterState.getNode(parentPostFilterNodeId)
|
76
89
|
: undefined;
|
package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderPostFilterStateBuilder.js","sourceRoot":"","sources":["../../../../../src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,
|
1
|
+
{"version":3,"file":"QueryBuilderPostFilterStateBuilder.js","sourceRoot":"","sources":["../../../../../src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,2CAA2C,EAAE,MAAM,oDAAoD,CAAC;AAEjH,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAEL,kCAAkC,EAClC,wBAAwB,EACxB,2CAA2C,EAC3C,uCAAuC,EACvC,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,iCAAiC,EAAE,MAAM,4DAA4D,CAAC;AAE/G,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAEhF,MAAM,yBAAyB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mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;QACzD,MAAM,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACxD,UAAU,CACR,gBAAgB,EAChB,2BAA2B,EAC3B,mFAAmF,CACpF,CAAC;QAEF,UAAU,CACR,mBAAmB,CAAC,cAAc,EAClC,oBAAoB,EACpB,0FAA0F,CAC3F,CAAC;QACF,UAAU,CACR,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAC1C,gGAAgG,CACjG,CAAC;QACF,MAAM,UAAU,GAAG,oBAAoB,CACrC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAC1B,0EAA0E,CAC3E,CAAC;QACF,UAAU,CACR,UAAU,CAAC,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAC1C,0FAA0F,CAC3F,CAAC;QACF,MAAM,cAAc,GAAG,aAAa,CAClC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAChC,kBAAkB,EAClB,qGAAqG,CACtG,CAAC;QACF,UAAU,CACR,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAC/C,oFAAoF,CACrF,CAAC;QACF,eAAe,CAAC,sBAAsB,CACpC,aAAa,CACX,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,EACrC,kBAAkB,EAClB,8GAA8G,CAC/G,CAAC,IAAI,CACP,CAAC;QACF,qBAAqB,CAAC,cAAc,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC;QAElE,QAAQ,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QACtC,eAAe,CAAC,YAAY,EAAE,CAAC;KAChC;AACH,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderFilterStateBuilder.d.ts","sourceRoot":"","sources":["../../../src/stores/filter/QueryBuilderFilterStateBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
1
|
+
{"version":3,"file":"QueryBuilderFilterStateBuilder.d.ts","sourceRoot":"","sources":["../../../src/stores/filter/QueryBuilderFilterStateBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAML,wBAAwB,EAEzB,MAAM,qBAAqB,CAAC;AAW7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AA4FjE,eAAO,MAAM,uBAAuB,eACtB,wBAAwB,qBACjB,iBAAiB,KACnC,IA4CF,CAAC"}
|
@@ -13,13 +13,26 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { AbstractPropertyExpression, LambdaFunctionInstanceValue, matchFunctionName, SimpleFunctionExpression, VariableExpression, } from '@finos/legend-graph';
|
16
|
+
import { AbstractPropertyExpression, LambdaFunctionInstanceValue, matchFunctionName, MINUS_STRING, PrimitiveInstanceValue, SimpleFunctionExpression, VariableExpression, } from '@finos/legend-graph';
|
17
17
|
import { assertTrue, assertType, guaranteeNonNullable, guaranteeType, returnUndefOnError, UnsupportedOperationError, } from '@finos/legend-shared';
|
18
18
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../graphManager/QueryBuilderSupportedFunctions.js';
|
19
19
|
import { toGroupOperation } from '../QueryBuilderGroupOperationHelper.js';
|
20
20
|
import { validatePropertyExpressionChain } from '../QueryBuilderValueSpecificationHelper.js';
|
21
21
|
import { QueryBuilderFilterTreeConditionNodeData, QueryBuilderFilterTreeGroupNodeData, } from './QueryBuilderFilterState.js';
|
22
22
|
const processFilterTree = (expression, filterState, parentFilterNodeId) => {
|
23
|
+
// NOTE: This checks if the expression is a simple function expression of Minus
|
24
|
+
// since negative numbers are returned as a SimpleFunctionExpression of minus(number)
|
25
|
+
// rather than a PrimitiveInstanceValue of -number, so here
|
26
|
+
// we replace the parameter value of the expression directly with a PrimitiveInstanceValue
|
27
|
+
if (expression.parametersValues[1] instanceof SimpleFunctionExpression &&
|
28
|
+
expression.parametersValues[1].functionName === MINUS_STRING &&
|
29
|
+
expression.parametersValues[1].parametersValues[0] instanceof
|
30
|
+
PrimitiveInstanceValue) {
|
31
|
+
expression.parametersValues[1].parametersValues[0].values[0] =
|
32
|
+
parseFloat(expression.parametersValues[1].parametersValues[0].values[0]) * -1;
|
33
|
+
expression.parametersValues[1] =
|
34
|
+
expression.parametersValues[1].parametersValues[0];
|
35
|
+
}
|
23
36
|
const parentNode = parentFilterNodeId
|
24
37
|
? filterState.getNode(parentFilterNodeId)
|
25
38
|
: undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderFilterStateBuilder.js","sourceRoot":"","sources":["../../../src/stores/filter/QueryBuilderFilterStateBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iCAAiC,EAAE,MAAM,sDAAsD,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AAC7F,OAAO,EAEL,uCAAuC,EACvC,mCAAmC,GACpC,MAAM,8BAA8B,CAAC;AAEtC,MAAM,iBAAiB,GAAG,CACxB,UAAoC,EACpC,WAAoC,EACpC,kBAAsC,EAChC,EAAE;IACR,MAAM,UAAU,GAAG,kBAAkB;QACnC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC;QACzC,CAAC,CAAC,SAAS,CAAC;IACd,IACE,iBAAiB,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CACX,CAAC;gBACF,OAAO;aACR;SACF;QACD,MAAM,IAAI,yBAAyB,CACjC,mGAAmG,CACpG,CAAC;KACH;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,UAAoC,EACpC,iBAAoC,EAC9B,EAAE;IACR,MAAM,WAAW,GAAG,iBAAiB,CAAC,WAAW,CAAC;IAClD,MAAM,YAAY,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACpD,UAAU,CACR,YAAY,EACZ,2BAA2B,EAC3B,yFAAyF,CAC1F,CAAC;IAEF,MAAM,UAAU,GAAG,oBAAoB,CACrC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EACtB,oEAAoE,CACrE,CAAC;IACF,UAAU,CACR,UAAU,CAAC,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAC1C,oFAAoF,CACrF,CAAC;IACF,MAAM,cAAc,GAAG,aAAa,CAClC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAChC,wBAAwB,EACxB,oFAAoF,CACrF,CAAC;IAEF,UAAU,CACR,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAC/C,8EAA8E,CAC/E,CAAC;IACF,WAAW,CAAC,sBAAsB,CAChC,aAAa,CACX,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,EACrC,kBAAkB,EAClB,8EAA8E,CAC/E,CAAC,IAAI,CACP,CAAC;IAEF,iBAAiB,CAAC,cAAc,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAE1D;;;;;OAKG;IACH,WAAW,CAAC,YAAY,EAAE,CAAC;AAC7B,CAAC,CAAC"}
|
1
|
+
{"version":3,"file":"QueryBuilderFilterStateBuilder.js","sourceRoot":"","sources":["../../../src/stores/filter/QueryBuilderFilterStateBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,0BAA0B,EAC1B,2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
"name": "@finos/legend-query-builder",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.3",
|
4
4
|
"description": "Legend query builder core",
|
5
5
|
"keywords": [
|
6
6
|
"legend",
|
@@ -45,12 +45,12 @@
|
|
45
45
|
"@ag-grid-community/core": "29.1.0",
|
46
46
|
"@ag-grid-community/react": "29.1.0",
|
47
47
|
"@ag-grid-community/styles": "29.1.0",
|
48
|
-
"@finos/legend-application": "13.0.
|
49
|
-
"@finos/legend-art": "5.0.
|
50
|
-
"@finos/legend-graph": "24.0
|
51
|
-
"@finos/legend-server-depot": "4.4.
|
52
|
-
"@finos/legend-shared": "8.0.
|
53
|
-
"@finos/legend-storage": "3.0.
|
48
|
+
"@finos/legend-application": "13.0.3",
|
49
|
+
"@finos/legend-art": "5.0.37",
|
50
|
+
"@finos/legend-graph": "24.1.0",
|
51
|
+
"@finos/legend-server-depot": "4.4.7",
|
52
|
+
"@finos/legend-shared": "8.0.2",
|
53
|
+
"@finos/legend-storage": "3.0.42",
|
54
54
|
"@testing-library/react": "14.0.0",
|
55
55
|
"@types/papaparse": "5.3.7",
|
56
56
|
"@types/react": "18.0.28",
|
@@ -52,7 +52,7 @@ import { BasicValueSpecificationEditor } from './shared/BasicValueSpecificationE
|
|
52
52
|
import { VariableViewer } from './shared/QueryBuilderVariableSelector.js';
|
53
53
|
import { QUERY_BUILDER_TEST_ID } from '../application/QueryBuilderTesting.js';
|
54
54
|
|
55
|
-
//
|
55
|
+
// NOTE: We currently only allow constant variables for primitive types of multiplicity ONE.
|
56
56
|
// This is why we don't show multiplicity in the editor.
|
57
57
|
const QueryBuilderConstantExpressionEditor = observer(
|
58
58
|
(props: { constantState: QueryBuilderConstantExpressionState }) => {
|
@@ -370,7 +370,7 @@ const QueryBuilderGridResult = observer(
|
|
370
370
|
},
|
371
371
|
}}
|
372
372
|
modules={[ClientSideRowModelModule]}
|
373
|
-
//
|
373
|
+
// NOTE: we use onCellMouseOver as a bit of a workaround
|
374
374
|
// since we use the context menu so we want the user to be
|
375
375
|
// able to right click any cell and have the context menu
|
376
376
|
// options use the data belonging to the row that they are
|
@@ -362,13 +362,82 @@ const NumberPrimitiveInstanceValueEditor = observer(
|
|
362
362
|
resetValue,
|
363
363
|
setValueSpecification,
|
364
364
|
} = props;
|
365
|
+
|
366
|
+
const DECIMAL_POINT = '.';
|
367
|
+
const NEGATIVE_SIGN = '-';
|
368
|
+
|
369
|
+
// NOTE: Although we want to allow the user to type
|
370
|
+
// '-' and '.' for negative and decimal numbers respectively,
|
371
|
+
// we want to check for when user leaves the input to not
|
372
|
+
// leave the number value at an invalid state (i.e. if
|
373
|
+
// user just left '-' without an actual number)
|
374
|
+
const onBlur = (): void => {
|
375
|
+
if (valueSpecification.values[0] === NEGATIVE_SIGN) {
|
376
|
+
instanceValue_setValue(valueSpecification, 0, 0);
|
377
|
+
}
|
378
|
+
const numberInputValue = valueSpecification.values[0] as string;
|
379
|
+
if (
|
380
|
+
numberInputValue.length > 0 &&
|
381
|
+
numberInputValue.at(-1) === DECIMAL_POINT
|
382
|
+
) {
|
383
|
+
instanceValue_setValue(
|
384
|
+
valueSpecification,
|
385
|
+
parseInt(
|
386
|
+
numberInputValue.substring(0, numberInputValue.length - 1),
|
387
|
+
10,
|
388
|
+
),
|
389
|
+
0,
|
390
|
+
);
|
391
|
+
}
|
392
|
+
const val = isInteger
|
393
|
+
? parseInt(numberInputValue, 10)
|
394
|
+
: parseFloat(numberInputValue);
|
395
|
+
instanceValue_setValue(valueSpecification, val, 0);
|
396
|
+
setValueSpecification(valueSpecification);
|
397
|
+
};
|
398
|
+
|
365
399
|
const value = valueSpecification.values[0] as number;
|
366
400
|
const changeValue: React.ChangeEventHandler<HTMLInputElement> = (event) => {
|
401
|
+
const valueIsDecimalPoint =
|
402
|
+
(event.nativeEvent as InputEvent).data === DECIMAL_POINT;
|
403
|
+
|
404
|
+
const valueIsNegativeSymbol =
|
405
|
+
(event.nativeEvent as InputEvent).data === NEGATIVE_SIGN;
|
406
|
+
|
407
|
+
if (
|
408
|
+
!isInteger &&
|
409
|
+
valueIsDecimalPoint &&
|
410
|
+
value.toString().length > 0 &&
|
411
|
+
!value.toString().includes(DECIMAL_POINT)
|
412
|
+
) {
|
413
|
+
instanceValue_setValue(
|
414
|
+
valueSpecification,
|
415
|
+
valueSpecification.values[0] + DECIMAL_POINT,
|
416
|
+
0,
|
417
|
+
);
|
418
|
+
return;
|
419
|
+
}
|
420
|
+
if (
|
421
|
+
value.toString().includes(DECIMAL_POINT) &&
|
422
|
+
(event.nativeEvent as InputEvent).data === '0'
|
423
|
+
) {
|
424
|
+
instanceValue_setValue(
|
425
|
+
valueSpecification,
|
426
|
+
`${valueSpecification.values[0]}0`,
|
427
|
+
0,
|
428
|
+
);
|
429
|
+
setValueSpecification(valueSpecification);
|
430
|
+
return;
|
431
|
+
}
|
432
|
+
|
367
433
|
let inputVal = isInteger
|
368
434
|
? parseInt(event.target.value, 10)
|
369
435
|
: parseFloat(event.target.value);
|
370
436
|
inputVal = isNaN(inputVal) ? 0 : inputVal;
|
371
|
-
|
437
|
+
|
438
|
+
valueIsNegativeSymbol
|
439
|
+
? instanceValue_setValue(valueSpecification, NEGATIVE_SIGN, 0)
|
440
|
+
: instanceValue_setValue(valueSpecification, inputVal, 0);
|
372
441
|
setValueSpecification(valueSpecification);
|
373
442
|
};
|
374
443
|
|
@@ -377,8 +446,9 @@ const NumberPrimitiveInstanceValueEditor = observer(
|
|
377
446
|
<input
|
378
447
|
className="panel__content__form__section__input value-spec-editor__input"
|
379
448
|
spellCheck={false}
|
380
|
-
type="
|
449
|
+
type="text"
|
381
450
|
value={value}
|
451
|
+
onBlur={onBlur}
|
382
452
|
onChange={changeValue}
|
383
453
|
/>
|
384
454
|
<button
|
@@ -61,6 +61,7 @@ import {
|
|
61
61
|
isStubbed_RawLambda,
|
62
62
|
buildLambdaVariableExpressions,
|
63
63
|
buildRawLambdaFromLambdaFunction,
|
64
|
+
type ValueSpecification,
|
64
65
|
} from '@finos/legend-graph';
|
65
66
|
import { buildLambdaFunction } from './QueryBuilderValueSpecificationBuilder.js';
|
66
67
|
import type {
|
@@ -158,8 +159,6 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
158
159
|
|
159
160
|
resetQueryResult: action,
|
160
161
|
resetQueryContent: action,
|
161
|
-
resetQueryBodyContent: action,
|
162
|
-
resetQueryParameterContent: action,
|
163
162
|
changeClass: action,
|
164
163
|
changeMapping: action,
|
165
164
|
|
@@ -296,13 +295,18 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
296
295
|
);
|
297
296
|
}
|
298
297
|
|
299
|
-
resetQueryResult(): void {
|
298
|
+
resetQueryResult(preserveResult?: boolean): void {
|
300
299
|
const resultState = new QueryBuilderResultState(this);
|
301
300
|
resultState.setPreviewLimit(this.resultState.previewLimit);
|
301
|
+
if (preserveResult) {
|
302
|
+
resultState.setExecutionResult(this.resultState.executionResult);
|
303
|
+
resultState.setExecutionDuration(this.resultState.executionDuration);
|
304
|
+
resultState.latestRunHashCode = this.resultState.latestRunHashCode;
|
305
|
+
}
|
302
306
|
this.resultState = resultState;
|
303
307
|
}
|
304
308
|
|
305
|
-
|
309
|
+
resetQueryContent(): void {
|
306
310
|
this.textEditorState = new QueryBuilderTextEditorState(this);
|
307
311
|
this.unsupportedQueryState = new QueryBuilderUnsupportedQueryState(this);
|
308
312
|
this.milestoningState = new QueryBuilderMilestoningState(this);
|
@@ -316,6 +320,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
316
320
|
this.explorerState.refreshTreeData();
|
317
321
|
this.constantState = new QueryBuilderConstantsState(this);
|
318
322
|
this.functionsExplorerState = new QueryFunctionsExplorerState(this);
|
323
|
+
this.parametersState = new QueryBuilderParametersState(this);
|
319
324
|
this.filterState = new QueryBuilderFilterState(this, this.filterOperators);
|
320
325
|
this.watermarkState = new QueryBuilderWatermarkState(this);
|
321
326
|
this.checkEntitlementsState = new QueryBuilderCheckEntitlementsState(this);
|
@@ -333,15 +338,6 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
333
338
|
}
|
334
339
|
}
|
335
340
|
|
336
|
-
resetQueryParameterContent(): void {
|
337
|
-
this.parametersState = new QueryBuilderParametersState(this);
|
338
|
-
}
|
339
|
-
|
340
|
-
resetQueryContent(): void {
|
341
|
-
this.resetQueryParameterContent();
|
342
|
-
this.resetQueryBodyContent();
|
343
|
-
}
|
344
|
-
|
345
341
|
changeClass(val: Class): void {
|
346
342
|
this.resetQueryResult();
|
347
343
|
this.resetQueryContent();
|
@@ -386,18 +382,34 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
386
382
|
}
|
387
383
|
|
388
384
|
initializeWithQuery(query: RawLambda): void {
|
389
|
-
this.resetQueryParameterContent();
|
390
385
|
this.rebuildWithQuery(query);
|
386
|
+
this.resetQueryResult();
|
391
387
|
this.changeDetectionState.initialize(query);
|
392
388
|
}
|
393
389
|
|
394
390
|
/**
|
395
391
|
* Process the provided query, and rebuild the query builder state.
|
396
392
|
*/
|
397
|
-
rebuildWithQuery(
|
393
|
+
rebuildWithQuery(
|
394
|
+
query: RawLambda,
|
395
|
+
options?: {
|
396
|
+
preserveParameterValues?: boolean | undefined;
|
397
|
+
preserveResult?: boolean | undefined;
|
398
|
+
},
|
399
|
+
): void {
|
400
|
+
const previousStateParameterValues = new Map<
|
401
|
+
VariableExpression,
|
402
|
+
ValueSpecification | undefined
|
403
|
+
>();
|
398
404
|
try {
|
399
|
-
|
400
|
-
|
405
|
+
if (options?.preserveParameterValues) {
|
406
|
+
// Preserving parameter values
|
407
|
+
this.parametersState.parameterStates.forEach((ps) => {
|
408
|
+
previousStateParameterValues.set(ps.parameter, ps.value);
|
409
|
+
});
|
410
|
+
}
|
411
|
+
this.resetQueryResult(options?.preserveResult);
|
412
|
+
this.resetQueryContent();
|
401
413
|
|
402
414
|
if (!isStubbed_RawLambda(query)) {
|
403
415
|
const valueSpec = observe_ValueSpecification(
|
@@ -417,6 +429,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
417
429
|
processQueryLambdaFunction(
|
418
430
|
guaranteeNonNullable(compiledValueSpecification.values[0]),
|
419
431
|
this,
|
432
|
+
previousStateParameterValues,
|
420
433
|
);
|
421
434
|
}
|
422
435
|
if (this.parametersState.parameterStates.length > 0) {
|
@@ -424,8 +437,8 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
424
437
|
}
|
425
438
|
} catch (error) {
|
426
439
|
assertErrorThrown(error);
|
427
|
-
this.resetQueryBodyContent();
|
428
440
|
this.resetQueryResult();
|
441
|
+
this.resetQueryContent();
|
429
442
|
this.unsupportedQueryState.setLambdaError(error);
|
430
443
|
this.unsupportedQueryState.setRawLambda(query);
|
431
444
|
this.setClass(undefined);
|
@@ -70,7 +70,6 @@ import { processTDS_OLAPGroupByExpression } from './fetch-structure/tds/window/Q
|
|
70
70
|
import { processWatermarkExpression } from './watermark/QueryBuilderWatermarkStateBuilder.js';
|
71
71
|
import { QueryBuilderConstantExpressionState } from './QueryBuilderConstantsState.js';
|
72
72
|
import { checkIfEquivalent } from './milestoning/QueryBuilderMilestoningHelper.js';
|
73
|
-
import { QueryBuilderParametersState } from './QueryBuilderParametersState.js';
|
74
73
|
|
75
74
|
const processGetAllExpression = (
|
76
75
|
expression: SimpleFunctionExpression,
|
@@ -608,28 +607,31 @@ export class QueryBuilderValueSpecificationProcessor
|
|
608
607
|
export const processParameters = (
|
609
608
|
parameters: VariableExpression[],
|
610
609
|
queryBuilderState: QueryBuilderState,
|
610
|
+
preservedParameters?: Map<VariableExpression, ValueSpecification | undefined>,
|
611
611
|
): void => {
|
612
|
-
const queryParameterState =
|
613
|
-
|
614
|
-
);
|
615
|
-
// Here we won't process the parameters which are present in the previous state
|
612
|
+
const queryParameterState = queryBuilderState.parametersState;
|
613
|
+
// Here we won't mock the values for parameters which are present in the previous state
|
616
614
|
// because we don't want to lose the parameter value
|
617
615
|
parameters.forEach((parameter) => {
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
616
|
+
let oldParamterValue: ValueSpecification | undefined;
|
617
|
+
if (preservedParameters) {
|
618
|
+
Array.from(preservedParameters.entries()).forEach(([key, value]) => {
|
619
|
+
if (checkIfEquivalent(key, parameter)) {
|
620
|
+
oldParamterValue = value;
|
621
|
+
}
|
622
|
+
});
|
623
|
+
}
|
624
|
+
const parameterState = new LambdaParameterState(
|
625
|
+
parameter,
|
626
|
+
queryBuilderState.observableContext,
|
627
|
+
queryBuilderState.graphManagerState.graph,
|
628
|
+
);
|
629
|
+
if (oldParamterValue) {
|
630
|
+
parameterState.setValue(oldParamterValue);
|
624
631
|
} else {
|
625
|
-
const parameterState = new LambdaParameterState(
|
626
|
-
parameter,
|
627
|
-
queryBuilderState.observableContext,
|
628
|
-
queryBuilderState.graphManagerState.graph,
|
629
|
-
);
|
630
632
|
parameterState.mockParameterValue();
|
631
|
-
queryParameterState.addParameter(parameterState);
|
632
633
|
}
|
634
|
+
queryParameterState.addParameter(parameterState);
|
633
635
|
});
|
634
636
|
queryBuilderState.parametersState = queryParameterState;
|
635
637
|
};
|
@@ -637,11 +639,13 @@ export const processParameters = (
|
|
637
639
|
export const processQueryLambdaFunction = (
|
638
640
|
lambdaFunction: LambdaFunction,
|
639
641
|
queryBuilderState: QueryBuilderState,
|
642
|
+
preservedParameters?: Map<VariableExpression, ValueSpecification | undefined>,
|
640
643
|
): void => {
|
641
644
|
if (lambdaFunction.functionType.parameters.length) {
|
642
645
|
processParameters(
|
643
646
|
lambdaFunction.functionType.parameters,
|
644
647
|
queryBuilderState,
|
648
|
+
preservedParameters,
|
645
649
|
);
|
646
650
|
}
|
647
651
|
lambdaFunction.expressionSequence.map((expression) =>
|
@@ -198,7 +198,10 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
198
198
|
`Can't parse query. Please fix error before closing: ${this.parserError.message}`,
|
199
199
|
);
|
200
200
|
} else {
|
201
|
-
this.queryBuilderState.rebuildWithQuery(this.rawLambdaState.lambda
|
201
|
+
this.queryBuilderState.rebuildWithQuery(this.rawLambdaState.lambda, {
|
202
|
+
preserveParameterValues: true,
|
203
|
+
preserveResult: true,
|
204
|
+
});
|
202
205
|
this.setMode(undefined);
|
203
206
|
}
|
204
207
|
return;
|
@@ -22,7 +22,8 @@ import {
|
|
22
22
|
matchFunctionName,
|
23
23
|
VariableExpression,
|
24
24
|
FunctionExpression,
|
25
|
-
|
25
|
+
SimpleFunctionExpression,
|
26
|
+
MINUS_STRING,
|
26
27
|
} from '@finos/legend-graph';
|
27
28
|
import {
|
28
29
|
assertTrue,
|
@@ -178,6 +179,24 @@ const processPostFilterTree = (
|
|
178
179
|
postFilterState: QueryBuilderPostFilterState,
|
179
180
|
parentPostFilterNodeId: string | undefined,
|
180
181
|
): void => {
|
182
|
+
// NOTE: This checks if the expression is a simple function expression of Minus
|
183
|
+
// since negative numbers are returned as a SimpleFunctionExpression of minus(number)
|
184
|
+
// rather than a PrimitiveInstanceValue of -number, so here
|
185
|
+
// we replace the parameter value of the expression directly with a PrimitiveInstanceValue
|
186
|
+
if (
|
187
|
+
expression.parametersValues[1] instanceof SimpleFunctionExpression &&
|
188
|
+
expression.parametersValues[1].functionName === MINUS_STRING &&
|
189
|
+
expression.parametersValues[1].parametersValues[0] instanceof
|
190
|
+
PrimitiveInstanceValue
|
191
|
+
) {
|
192
|
+
expression.parametersValues[1].parametersValues[0].values[0] =
|
193
|
+
parseFloat(
|
194
|
+
expression.parametersValues[1].parametersValues[0].values[0] as string,
|
195
|
+
) * -1;
|
196
|
+
expression.parametersValues[1] =
|
197
|
+
expression.parametersValues[1].parametersValues[0];
|
198
|
+
}
|
199
|
+
|
181
200
|
const parentNode = parentPostFilterNodeId
|
182
201
|
? postFilterState.getNode(parentPostFilterNodeId)
|
183
202
|
: undefined;
|
@@ -18,6 +18,8 @@ import {
|
|
18
18
|
AbstractPropertyExpression,
|
19
19
|
LambdaFunctionInstanceValue,
|
20
20
|
matchFunctionName,
|
21
|
+
MINUS_STRING,
|
22
|
+
PrimitiveInstanceValue,
|
21
23
|
SimpleFunctionExpression,
|
22
24
|
VariableExpression,
|
23
25
|
} from '@finos/legend-graph';
|
@@ -44,6 +46,24 @@ const processFilterTree = (
|
|
44
46
|
filterState: QueryBuilderFilterState,
|
45
47
|
parentFilterNodeId: string | undefined,
|
46
48
|
): void => {
|
49
|
+
// NOTE: This checks if the expression is a simple function expression of Minus
|
50
|
+
// since negative numbers are returned as a SimpleFunctionExpression of minus(number)
|
51
|
+
// rather than a PrimitiveInstanceValue of -number, so here
|
52
|
+
// we replace the parameter value of the expression directly with a PrimitiveInstanceValue
|
53
|
+
if (
|
54
|
+
expression.parametersValues[1] instanceof SimpleFunctionExpression &&
|
55
|
+
expression.parametersValues[1].functionName === MINUS_STRING &&
|
56
|
+
expression.parametersValues[1].parametersValues[0] instanceof
|
57
|
+
PrimitiveInstanceValue
|
58
|
+
) {
|
59
|
+
expression.parametersValues[1].parametersValues[0].values[0] =
|
60
|
+
parseFloat(
|
61
|
+
expression.parametersValues[1].parametersValues[0].values[0] as string,
|
62
|
+
) * -1;
|
63
|
+
expression.parametersValues[1] =
|
64
|
+
expression.parametersValues[1].parametersValues[0];
|
65
|
+
}
|
66
|
+
|
47
67
|
const parentNode = parentFilterNodeId
|
48
68
|
? filterState.getNode(parentFilterNodeId)
|
49
69
|
: undefined;
|