@finos/legend-query-builder 4.14.8 → 4.14.10
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/__lib__/QueryBuilderEvent.d.ts +2 -1
- package/lib/__lib__/QueryBuilderEvent.d.ts.map +1 -1
- package/lib/__lib__/QueryBuilderEvent.js +1 -0
- package/lib/__lib__/QueryBuilderEvent.js.map +1 -1
- package/lib/components/QueryBuilder.d.ts.map +1 -1
- package/lib/components/QueryBuilder.js +45 -27
- package/lib/components/QueryBuilder.js.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +2 -0
- package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.js +6 -3
- package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
- package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderExplorerPanel.js +12 -9
- package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.js +6 -5
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +19 -5
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
- package/lib/components/shared/QueryBuilderPropertyInfoTooltip.d.ts +3 -0
- package/lib/components/shared/QueryBuilderPropertyInfoTooltip.d.ts.map +1 -1
- package/lib/components/shared/QueryBuilderPropertyInfoTooltip.js +3 -3
- package/lib/components/shared/QueryBuilderPropertyInfoTooltip.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderChangeHistoryState.d.ts +35 -0
- package/lib/stores/QueryBuilderChangeHistoryState.d.ts.map +1 -0
- package/lib/stores/QueryBuilderChangeHistoryState.js +106 -0
- package/lib/stores/QueryBuilderChangeHistoryState.js.map +1 -0
- package/lib/stores/QueryBuilderState.d.ts +2 -0
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +6 -0
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/explorer/QueryBuilderExplorerState.d.ts +5 -0
- package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
- package/lib/stores/explorer/QueryBuilderExplorerState.js +32 -0
- package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
- package/package.json +5 -5
- package/src/__lib__/QueryBuilderEvent.ts +2 -0
- package/src/components/QueryBuilder.tsx +41 -0
- package/src/components/QueryBuilderPropertyExpressionEditor.tsx +16 -2
- package/src/components/explorer/QueryBuilderExplorerPanel.tsx +18 -8
- package/src/components/explorer/QueryBuilderPropertySearchPanel.tsx +8 -5
- package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +65 -24
- package/src/components/shared/QueryBuilderPropertyInfoTooltip.tsx +29 -2
- package/src/stores/QueryBuilderChangeHistoryState.ts +129 -0
- package/src/stores/QueryBuilderState.ts +6 -0
- package/src/stores/explorer/QueryBuilderExplorerState.ts +35 -0
- package/tsconfig.json +1 -0
@@ -104,6 +104,7 @@ import {
|
|
104
104
|
} from './QueryBuilderExecutionContextState.js';
|
105
105
|
import type { QueryBuilderConfig } from '../graph-manager/QueryBuilderConfig.js';
|
106
106
|
import { QUERY_BUILDER_EVENT } from '../__lib__/QueryBuilderEvent.js';
|
107
|
+
import { QueryBuilderChangeHistoryState } from './QueryBuilderChangeHistoryState.js';
|
107
108
|
|
108
109
|
export interface QuerySDLC {}
|
109
110
|
|
@@ -136,6 +137,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
136
137
|
resultState: QueryBuilderResultState;
|
137
138
|
textEditorState: QueryBuilderTextEditorState;
|
138
139
|
unsupportedQueryState: QueryBuilderUnsupportedQueryState;
|
140
|
+
changeHistoryState: QueryBuilderChangeHistoryState;
|
139
141
|
showFunctionsExplorerPanel = false;
|
140
142
|
showParametersPanel = false;
|
141
143
|
isEditingWatermark = false;
|
@@ -184,6 +186,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
184
186
|
isCheckingEntitlments: observable,
|
185
187
|
isCalendarEnabled: observable,
|
186
188
|
changeDetectionState: observable,
|
189
|
+
changeHistoryState: observable,
|
187
190
|
executionContextState: observable,
|
188
191
|
class: observable,
|
189
192
|
isQueryChatOpened: observable,
|
@@ -236,6 +239,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
236
239
|
this.graphManagerState.pluginManager.getPureGraphManagerPlugins(),
|
237
240
|
);
|
238
241
|
this.changeDetectionState = new QueryBuilderChangeDetectionState(this);
|
242
|
+
this.changeHistoryState = new QueryBuilderChangeHistoryState(this);
|
239
243
|
this.config = config;
|
240
244
|
this.sourceInfo = sourceInfo;
|
241
245
|
}
|
@@ -441,6 +445,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
441
445
|
this.explorerState.refreshTreeData();
|
442
446
|
this.fetchStructureState.implementation.onClassChange(val);
|
443
447
|
this.milestoningState.updateMilestoningConfiguration();
|
448
|
+
this.changeHistoryState.cacheNewQuery(this.buildQuery());
|
444
449
|
}
|
445
450
|
|
446
451
|
changeMapping(val: Mapping, options?: { keepQueryContent?: boolean }): void {
|
@@ -553,6 +558,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
553
558
|
});
|
554
559
|
this.resetQueryResult();
|
555
560
|
this.changeDetectionState.initialize(query);
|
561
|
+
this.changeHistoryState.initialize(query);
|
556
562
|
}
|
557
563
|
|
558
564
|
/**
|
@@ -72,6 +72,7 @@ import { QueryBuilderPropertySearchState } from './QueryBuilderPropertySearchSta
|
|
72
72
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../graph/QueryBuilderMetaModelConst.js';
|
73
73
|
import { propertyExpression_setFunc } from '../shared/ValueSpecificationModifierHelper.js';
|
74
74
|
import { QueryBuilderTelemetryHelper } from '../../__lib__/QueryBuilderTelemetryHelper.js';
|
75
|
+
import { createRef } from 'react';
|
75
76
|
|
76
77
|
export enum QUERY_BUILDER_EXPLORER_TREE_DND_TYPE {
|
77
78
|
ROOT = 'ROOT',
|
@@ -97,6 +98,7 @@ export interface QueryBuilderExplorerTreeDragSource {
|
|
97
98
|
export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
|
98
99
|
isSelected?: boolean | undefined;
|
99
100
|
isOpen?: boolean | undefined;
|
101
|
+
isHighlighting?: boolean | undefined;
|
100
102
|
id: string;
|
101
103
|
label: string;
|
102
104
|
dndText: string;
|
@@ -104,6 +106,7 @@ export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
|
|
104
106
|
isPartOfDerivedPropertyBranch: boolean;
|
105
107
|
type: Type;
|
106
108
|
mappingData: QueryBuilderExplorerTreeNodeMappingData;
|
109
|
+
elementRef: React.RefObject<HTMLDivElement>;
|
107
110
|
|
108
111
|
constructor(
|
109
112
|
id: string,
|
@@ -114,7 +117,9 @@ export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
|
|
114
117
|
mappingData: QueryBuilderExplorerTreeNodeMappingData,
|
115
118
|
) {
|
116
119
|
makeObservable(this, {
|
120
|
+
isHighlighting: observable,
|
117
121
|
isSelected: observable,
|
122
|
+
setIsHighlighting: action,
|
118
123
|
setIsSelected: action,
|
119
124
|
});
|
120
125
|
|
@@ -124,11 +129,16 @@ export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
|
|
124
129
|
this.isPartOfDerivedPropertyBranch = isPartOfDerivedPropertyBranch;
|
125
130
|
this.type = type;
|
126
131
|
this.mappingData = mappingData;
|
132
|
+
this.elementRef = createRef();
|
127
133
|
}
|
128
134
|
|
129
135
|
setIsSelected(val: boolean | undefined): void {
|
130
136
|
this.isSelected = val;
|
131
137
|
}
|
138
|
+
|
139
|
+
setIsHighlighting(val: boolean | undefined): void {
|
140
|
+
this.isHighlighting = val;
|
141
|
+
}
|
132
142
|
}
|
133
143
|
|
134
144
|
export type QueryBuilderExplorerTreeNodeMappingData = {
|
@@ -663,6 +673,7 @@ export class QueryBuilderExplorerState {
|
|
663
673
|
setHumanizePropertyName: action,
|
664
674
|
setShowUnmappedProperties: action,
|
665
675
|
setHighlightUsedProperties: action,
|
676
|
+
highlightTreeNode: action,
|
666
677
|
analyzeMappingModelCoverage: flow,
|
667
678
|
previewData: flow,
|
668
679
|
});
|
@@ -717,6 +728,30 @@ export class QueryBuilderExplorerState {
|
|
717
728
|
);
|
718
729
|
}
|
719
730
|
|
731
|
+
highlightTreeNode(key: string): void {
|
732
|
+
const nodeToHighlight = this.treeData?.nodes.get(key);
|
733
|
+
if (nodeToHighlight instanceof QueryBuilderExplorerTreePropertyNodeData) {
|
734
|
+
let nodeToOpen: QueryBuilderExplorerTreeNodeData | null =
|
735
|
+
this.treeData?.nodes.get(nodeToHighlight.parentId) ?? null;
|
736
|
+
while (nodeToOpen !== null) {
|
737
|
+
if (!nodeToOpen.isOpen) {
|
738
|
+
nodeToOpen.isOpen = true;
|
739
|
+
}
|
740
|
+
nodeToOpen =
|
741
|
+
nodeToOpen instanceof QueryBuilderExplorerTreePropertyNodeData
|
742
|
+
? this.treeData?.nodes.get(nodeToOpen.parentId) ?? null
|
743
|
+
: null;
|
744
|
+
}
|
745
|
+
this.refreshTree();
|
746
|
+
nodeToHighlight.setIsHighlighting(true);
|
747
|
+
// scrollIntoView must be called in a setTimeout because it must happen after
|
748
|
+
// the tree nodes are recursively opened and the tree is refreshed.
|
749
|
+
setTimeout(() => {
|
750
|
+
nodeToHighlight.elementRef.current?.scrollIntoView();
|
751
|
+
}, 0);
|
752
|
+
}
|
753
|
+
}
|
754
|
+
|
720
755
|
*analyzeMappingModelCoverage(): GeneratorFn<void> {
|
721
756
|
// We will only refetch if the analysis result's mapping has changed.
|
722
757
|
// This makes the assumption that the mapping has not been edited, which is a valid assumption since query is not for editing mappings
|
package/tsconfig.json
CHANGED
@@ -56,6 +56,7 @@
|
|
56
56
|
"./src/graph-manager/protocol/pure/v1/V1_QueryBuilder_PureGraphManagerExtension.ts",
|
57
57
|
"./src/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts",
|
58
58
|
"./src/stores/QueryBuilderChangeDetectionState.ts",
|
59
|
+
"./src/stores/QueryBuilderChangeHistoryState.ts",
|
59
60
|
"./src/stores/QueryBuilderCommand.ts",
|
60
61
|
"./src/stores/QueryBuilderConfig.ts",
|
61
62
|
"./src/stores/QueryBuilderConstantsState.ts",
|