@finos/legend-query-builder 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/QueryBuilder.d.ts +1 -0
- package/lib/components/QueryBuilder.d.ts.map +1 -1
- package/lib/components/QueryBuilderDiffPanel.d.ts +1 -0
- package/lib/components/QueryBuilderDiffPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderParametersPanel.d.ts +1 -0
- package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderParametersPanel.js +2 -2
- package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +1 -0
- package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultPanel.d.ts +1 -0
- package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultPanel.js +2 -2
- package/lib/components/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/QueryBuilderSideBar.d.ts +1 -0
- package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
- package/lib/components/QueryBuilderTextEditor.d.ts +1 -0
- package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts +1 -0
- package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderUnsupportedQueryEditor.js +2 -2
- package/lib/components/QueryBuilderUnsupportedQueryEditor.js.map +1 -1
- package/lib/components/QuerySetupUtils.d.ts +22 -0
- package/lib/components/QuerySetupUtils.d.ts.map +1 -0
- package/lib/components/QuerySetupUtils.js +20 -0
- package/lib/components/QuerySetupUtils.js.map +1 -0
- package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts +1 -0
- package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts +1 -0
- package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts +1 -0
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts +1 -0
- package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.js +3 -3
- package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +1 -0
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts +1 -0
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +3 -3
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderProjectionPanel.d.ts +1 -0
- package/lib/components/fetch-structure/QueryBuilderProjectionPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderProjectionPanel.js +2 -2
- package/lib/components/fetch-structure/QueryBuilderProjectionPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts +1 -0
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.d.ts +1 -0
- package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js +2 -2
- package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
- package/lib/components/shared/QueryBuilderLambdaEditor.d.ts +1 -0
- package/lib/components/shared/QueryBuilderLambdaEditor.d.ts.map +1 -1
- package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_FunctionExpressionBuilder.d.ts.map +1 -1
- package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_FunctionExpressionBuilder.js +4 -4
- package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_FunctionExpressionBuilder.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +6 -6
- package/lib/stores/QueryBuilderChangeDetectionState.d.ts +1 -0
- package/lib/stores/QueryBuilderChangeDetectionState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderChangeDetectionState.js +24 -0
- package/lib/stores/QueryBuilderChangeDetectionState.js.map +1 -1
- package/lib/stores/QueryBuilderParametersState.d.ts +1 -1
- package/lib/stores/QueryBuilderParametersState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderParametersState.js +1 -1
- package/lib/stores/QueryBuilderParametersState.js.map +1 -1
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +2 -1
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/QueryBuilderTypeaheadHelper.d.ts.map +1 -1
- package/lib/stores/QueryBuilderTypeaheadHelper.js +3 -4
- package/lib/stores/QueryBuilderTypeaheadHelper.js.map +1 -1
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js +7 -7
- package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
- package/package.json +13 -13
- package/src/components/QueryBuilderParametersPanel.tsx +1 -2
- package/src/components/QueryBuilderResultPanel.tsx +3 -2
- package/src/components/QueryBuilderUnsupportedQueryEditor.tsx +8 -9
- package/src/components/QuerySetupUtils.ts +23 -0
- package/src/components/fetch-structure/QueryBuilderFetchStructurePanel.tsx +10 -5
- package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +5 -4
- package/src/components/fetch-structure/QueryBuilderProjectionPanel.tsx +3 -2
- package/src/components/filter/QueryBuilderFilterPanel.tsx +3 -2
- package/src/graphManager/protocol/pure/v1/V1_QueryBuilder_FunctionExpressionBuilder.ts +3 -4
- package/src/index.ts +1 -0
- package/src/stores/QueryBuilderChangeDetectionState.ts +31 -0
- package/src/stores/QueryBuilderParametersState.ts +3 -1
- package/src/stores/QueryBuilderState.ts +2 -1
- package/src/stores/QueryBuilderTypeaheadHelper.ts +6 -5
- package/src/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +10 -10
- package/tsconfig.json +1 -0
package/src/index.ts
CHANGED
@@ -39,3 +39,4 @@ export type { ServiceExecutionAnalysisResult } from './graphManager/action/analy
|
|
39
39
|
export type { MappingRuntimeCompatibilityAnalysisResult } from './graphManager/action/analytics/MappingRuntimeCompatibilityAnalysis.js';
|
40
40
|
export * from './stores/ServiceInfo.js';
|
41
41
|
export * from './components/ServiceQuerySetupUtils.js';
|
42
|
+
export * from './components/QuerySetupUtils.js';
|
@@ -14,6 +14,10 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
+
import {
|
18
|
+
ActionAlertActionType,
|
19
|
+
ActionAlertType,
|
20
|
+
} from '@finos/legend-application';
|
17
21
|
import type { RawLambda } from '@finos/legend-graph';
|
18
22
|
import {
|
19
23
|
ActionState,
|
@@ -136,4 +140,31 @@ export class QueryBuilderChangeDetectionState {
|
|
136
140
|
this.initialQuery = initialQuery;
|
137
141
|
this.initState.complete();
|
138
142
|
}
|
143
|
+
|
144
|
+
alertUnsavedChanges(onProceed: () => void): void {
|
145
|
+
if (this.hasChanged) {
|
146
|
+
this.querybuilderState.applicationStore.setActionAlertInfo({
|
147
|
+
message:
|
148
|
+
'Unsaved changes to your query will be lost if you continue. Do you still want to proceed?',
|
149
|
+
type: ActionAlertType.CAUTION,
|
150
|
+
actions: [
|
151
|
+
{
|
152
|
+
label: 'Proceed',
|
153
|
+
type: ActionAlertActionType.PROCEED_WITH_CAUTION,
|
154
|
+
handler:
|
155
|
+
this.querybuilderState.applicationStore.guardUnhandledError(
|
156
|
+
async () => onProceed(),
|
157
|
+
),
|
158
|
+
},
|
159
|
+
{
|
160
|
+
label: 'Cancel',
|
161
|
+
type: ActionAlertActionType.PROCEED,
|
162
|
+
default: true,
|
163
|
+
},
|
164
|
+
],
|
165
|
+
});
|
166
|
+
} else {
|
167
|
+
onProceed();
|
168
|
+
}
|
169
|
+
}
|
139
170
|
}
|
@@ -33,11 +33,13 @@ export class QueryBuilderParametersState
|
|
33
33
|
extends LambdaParametersState
|
34
34
|
implements Hashable
|
35
35
|
{
|
36
|
+
readonly queryBuilderState: QueryBuilderState;
|
37
|
+
|
36
38
|
selectedParameter: LambdaParameterState | undefined;
|
37
|
-
queryBuilderState: QueryBuilderState;
|
38
39
|
|
39
40
|
constructor(queryBuilderState: QueryBuilderState) {
|
40
41
|
super();
|
42
|
+
|
41
43
|
makeObservable(this, {
|
42
44
|
parameterValuesEditorState: observable,
|
43
45
|
parameterStates: observable,
|
@@ -246,13 +246,14 @@ export abstract class QueryBuilderState {
|
|
246
246
|
this.resetQueryContent();
|
247
247
|
this.setClass(val);
|
248
248
|
this.explorerState.refreshTreeData();
|
249
|
-
this.milestoningState.updateMilestoningConfiguration();
|
250
249
|
this.fetchStructureState.implementation.onClassChange(val);
|
250
|
+
this.milestoningState.updateMilestoningConfiguration();
|
251
251
|
}
|
252
252
|
|
253
253
|
changeMapping(val: Mapping): void {
|
254
254
|
this.resetQueryResult();
|
255
255
|
this.resetQueryContent();
|
256
|
+
this.milestoningState.updateMilestoningConfiguration();
|
256
257
|
this.setMapping(val);
|
257
258
|
}
|
258
259
|
|
@@ -36,9 +36,10 @@ import {
|
|
36
36
|
} from './fetch-structure/projection/QueryBuilderProjectionColumnState.js';
|
37
37
|
import type { QueryBuilderState } from './QueryBuilderState.js';
|
38
38
|
import { QueryBuilderProjectionState } from './fetch-structure/projection/QueryBuilderProjectionState.js';
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
import {
|
40
|
+
DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
|
41
|
+
DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
|
42
|
+
} from '@finos/legend-application';
|
42
43
|
|
43
44
|
const initializeQueryBuilderState = (
|
44
45
|
queryBuilderState: QueryBuilderState,
|
@@ -49,7 +50,7 @@ const initializeQueryBuilderState = (
|
|
49
50
|
QueryBuilderProjectionState,
|
50
51
|
);
|
51
52
|
projectionState.resultSetModifierState.distinct = true;
|
52
|
-
projectionState.resultSetModifierState.limit =
|
53
|
+
projectionState.resultSetModifierState.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
|
53
54
|
return builderState;
|
54
55
|
};
|
55
56
|
|
@@ -142,7 +143,7 @@ export const performTypeahead = (
|
|
142
143
|
switch (_type.path) {
|
143
144
|
case PRIMITIVE_TYPE.STRING: {
|
144
145
|
const value = val.values[0] as string;
|
145
|
-
return value.length >=
|
146
|
+
return value.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
146
147
|
}
|
147
148
|
default:
|
148
149
|
return false;
|
package/src/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.ts
CHANGED
@@ -20,7 +20,6 @@ import {
|
|
20
20
|
extractElementNameFromPath,
|
21
21
|
GenericType,
|
22
22
|
GenericTypeExplicitReference,
|
23
|
-
Multiplicity,
|
24
23
|
PrimitiveInstanceValue,
|
25
24
|
PRIMITIVE_TYPE,
|
26
25
|
SimpleFunctionExpression,
|
@@ -126,10 +125,11 @@ const appendResultSetModifier = (
|
|
126
125
|
),
|
127
126
|
multiplicityOne,
|
128
127
|
);
|
129
|
-
const multiplicity =
|
130
|
-
resultModifierState.
|
131
|
-
|
132
|
-
|
128
|
+
const multiplicity =
|
129
|
+
resultModifierState.projectionState.queryBuilderState.graphManagerState.graph.getMultiplicity(
|
130
|
+
resultModifierState.sortColumns.length,
|
131
|
+
resultModifierState.sortColumns.length,
|
132
|
+
);
|
133
133
|
const collection = new CollectionInstanceValue(
|
134
134
|
multiplicity,
|
135
135
|
undefined,
|
@@ -215,7 +215,7 @@ export const appendProjection = (
|
|
215
215
|
);
|
216
216
|
|
217
217
|
const colLambdas = new CollectionInstanceValue(
|
218
|
-
|
218
|
+
queryBuilderState.graphManagerState.graph.getMultiplicity(
|
219
219
|
projectionState.columns.length -
|
220
220
|
projectionState.aggregationState.columns.length,
|
221
221
|
projectionState.columns.length -
|
@@ -223,13 +223,13 @@ export const appendProjection = (
|
|
223
223
|
),
|
224
224
|
);
|
225
225
|
const aggregateLambdas = new CollectionInstanceValue(
|
226
|
-
|
226
|
+
queryBuilderState.graphManagerState.graph.getMultiplicity(
|
227
227
|
projectionState.aggregationState.columns.length,
|
228
228
|
projectionState.aggregationState.columns.length,
|
229
229
|
),
|
230
230
|
);
|
231
231
|
const colAliases = new CollectionInstanceValue(
|
232
|
-
|
232
|
+
queryBuilderState.graphManagerState.graph.getMultiplicity(
|
233
233
|
projectionState.columns.length,
|
234
234
|
projectionState.columns.length,
|
235
235
|
),
|
@@ -330,13 +330,13 @@ export const appendProjection = (
|
|
330
330
|
multiplicityOne,
|
331
331
|
);
|
332
332
|
const colLambdas = new CollectionInstanceValue(
|
333
|
-
|
333
|
+
queryBuilderState.graphManagerState.graph.getMultiplicity(
|
334
334
|
projectionState.columns.length,
|
335
335
|
projectionState.columns.length,
|
336
336
|
),
|
337
337
|
);
|
338
338
|
const colAliases = new CollectionInstanceValue(
|
339
|
-
|
339
|
+
queryBuilderState.graphManagerState.graph.getMultiplicity(
|
340
340
|
projectionState.columns.length,
|
341
341
|
projectionState.columns.length,
|
342
342
|
),
|
package/tsconfig.json
CHANGED
@@ -35,6 +35,7 @@
|
|
35
35
|
"files": [
|
36
36
|
"./src/index.ts",
|
37
37
|
"./src/components/QueryBuilder_TestID.ts",
|
38
|
+
"./src/components/QuerySetupUtils.ts",
|
38
39
|
"./src/graphManager/QueryBuilderHashUtils.ts",
|
39
40
|
"./src/graphManager/QueryBuilderSupportedFunctions.ts",
|
40
41
|
"./src/graphManager/QueryBuilder_GraphManagerPlugin.ts",
|