@finos/legend-query-builder 4.14.18 → 4.14.19
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/QueryBuilder.d.ts.map +1 -1
- package/lib/components/QueryBuilder.js +5 -3
- package/lib/components/QueryBuilder.js.map +1 -1
- package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderConstantExpressionPanel.js +71 -45
- package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
- package/lib/components/QueryBuilderDiffPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderDiffPanel.js +2 -1
- package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
- package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderParametersPanel.js +25 -26
- package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +11 -2
- package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.js +35 -10
- package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
- package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
- package/lib/components/QueryBuilderSideBar.js +6 -1
- package/lib/components/QueryBuilderSideBar.js.map +1 -1
- package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderTextEditor.js +3 -3
- package/lib/components/QueryBuilderTextEditor.js.map +1 -1
- package/lib/components/QueryLoader.d.ts.map +1 -1
- package/lib/components/QueryLoader.js +5 -3
- package/lib/components/QueryLoader.js.map +1 -1
- package/lib/components/QueryUsageViewer.d.ts.map +1 -1
- package/lib/components/QueryUsageViewer.js +2 -2
- package/lib/components/QueryUsageViewer.js.map +1 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts +2 -0
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js +19 -2
- package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js.map +1 -1
- package/lib/components/data-access/DataAccessOverview.d.ts.map +1 -1
- package/lib/components/data-access/DataAccessOverview.js +6 -1
- package/lib/components/data-access/DataAccessOverview.js.map +1 -1
- package/lib/components/execution-plan/ExecutionPlanViewer.d.ts.map +1 -1
- package/lib/components/execution-plan/ExecutionPlanViewer.js +6 -6
- package/lib/components/execution-plan/ExecutionPlanViewer.js.map +1 -1
- package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderExplorerPanel.js +3 -2
- package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
- package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderMilestoningEditor.js +3 -2
- package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js +6 -3
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +4 -3
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +11 -22
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +2 -2
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
- package/lib/components/result/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/result/QueryBuilderResultPanel.js +2 -1
- package/lib/components/result/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/result/tds/QueryBuilderTDSGridResult.d.ts.map +1 -1
- package/lib/components/result/tds/QueryBuilderTDSGridResult.js +5 -1
- package/lib/components/result/tds/QueryBuilderTDSGridResult.js.map +1 -1
- package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.d.ts.map +1 -1
- package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js +11 -2
- package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.js +25 -22
- package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
- package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
- package/lib/components/shared/CustomDatePicker.js +8 -5
- package/lib/components/shared/CustomDatePicker.js.map +1 -1
- package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
- package/lib/components/shared/LambdaEditor.js +17 -3
- package/lib/components/shared/LambdaEditor.js.map +1 -1
- package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -1
- package/lib/components/shared/LambdaParameterValuesEditor.js +2 -2
- package/lib/components/shared/LambdaParameterValuesEditor.js.map +1 -1
- package/lib/components/shared/QueryBuilderPropertyInfoTooltip.d.ts +6 -0
- package/lib/components/shared/QueryBuilderPropertyInfoTooltip.d.ts.map +1 -1
- package/lib/components/shared/QueryBuilderPropertyInfoTooltip.js +40 -3
- package/lib/components/shared/QueryBuilderPropertyInfoTooltip.js.map +1 -1
- package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +1 -1
- package/lib/components/watermark/QueryBuilderWatermark.js +28 -12
- package/lib/components/watermark/QueryBuilderWatermark.js.map +1 -1
- package/lib/index.css +17 -1
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderConstantsState.d.ts +1 -0
- package/lib/stores/QueryBuilderConstantsState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderConstantsState.js +7 -1
- package/lib/stores/QueryBuilderConstantsState.js.map +1 -1
- package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts +5 -0
- package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts.map +1 -1
- package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts +1 -2
- package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts.map +1 -1
- package/lib/stores/watermark/QueryBuilderWatermarkState.js +2 -12
- package/lib/stores/watermark/QueryBuilderWatermarkState.js.map +1 -1
- package/package.json +8 -8
- package/src/components/QueryBuilder.tsx +14 -2
- package/src/components/QueryBuilderConstantExpressionPanel.tsx +145 -69
- package/src/components/QueryBuilderDiffPanel.tsx +10 -2
- package/src/components/QueryBuilderParametersPanel.tsx +42 -37
- package/src/components/QueryBuilderPropertyExpressionEditor.tsx +87 -24
- package/src/components/QueryBuilderSideBar.tsx +20 -0
- package/src/components/QueryBuilderTextEditor.tsx +6 -4
- package/src/components/QueryLoader.tsx +12 -3
- package/src/components/QueryUsageViewer.tsx +7 -1
- package/src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx +40 -4
- package/src/components/data-access/DataAccessOverview.tsx +9 -1
- package/src/components/execution-plan/ExecutionPlanViewer.tsx +11 -8
- package/src/components/explorer/QueryBuilderExplorerPanel.tsx +5 -2
- package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +5 -2
- package/src/components/fetch-structure/QueryBuilderGraphFetchTreePanel.tsx +12 -5
- package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +8 -4
- package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +56 -72
- package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +8 -2
- package/src/components/result/QueryBuilderResultPanel.tsx +8 -1
- package/src/components/result/tds/QueryBuilderTDSGridResult.tsx +6 -3
- package/src/components/result/tds/QueryBuilderTDSSimpleGridResult.tsx +14 -4
- package/src/components/shared/BasicValueSpecificationEditor.tsx +39 -25
- package/src/components/shared/CustomDatePicker.tsx +18 -5
- package/src/components/shared/LambdaEditor.tsx +27 -11
- package/src/components/shared/LambdaParameterValuesEditor.tsx +4 -1
- package/src/components/shared/QueryBuilderPropertyInfoTooltip.tsx +115 -64
- package/src/components/watermark/QueryBuilderWatermark.tsx +60 -19
- package/src/stores/QueryBuilderConstantsState.ts +12 -0
- package/src/stores/QueryBuilder_LegendApplicationPlugin_Extension.ts +9 -0
- package/src/stores/watermark/QueryBuilderWatermarkState.ts +2 -12
@@ -117,26 +117,18 @@ export const QueryBuilderTaggedValueInfoTooltip: React.FC<{
|
|
117
117
|
);
|
118
118
|
};
|
119
119
|
|
120
|
-
|
120
|
+
const QueryBuilderBaseInfoTooltip: React.FC<{
|
121
121
|
title: string;
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
122
|
+
data: {
|
123
|
+
label: string;
|
124
|
+
value: string;
|
125
|
+
actionButton?: JSX.Element | undefined;
|
126
|
+
}[];
|
126
127
|
placement?: TooltipPlacement | undefined;
|
127
|
-
|
128
|
-
|
128
|
+
children: React.ReactElement;
|
129
|
+
footerElement?: React.ReactElement;
|
129
130
|
}> = (props) => {
|
130
|
-
const {
|
131
|
-
title,
|
132
|
-
property,
|
133
|
-
path,
|
134
|
-
isMapped,
|
135
|
-
children,
|
136
|
-
placement,
|
137
|
-
type,
|
138
|
-
explorerState,
|
139
|
-
} = props;
|
131
|
+
const { title, data, placement, children, footerElement } = props;
|
140
132
|
|
141
133
|
const [open, setIsOpen] = useState(false);
|
142
134
|
|
@@ -165,55 +157,18 @@ export const QueryBuilderPropertyInfoTooltip: React.FC<{
|
|
165
157
|
title={
|
166
158
|
<div className="query-builder__tooltip__content">
|
167
159
|
<div className="query-builder__tooltip__header">{title}</div>
|
168
|
-
|
169
|
-
<div className="query-
|
170
|
-
|
171
|
-
|
172
|
-
</div>
|
173
|
-
</div>
|
174
|
-
<div className="query-builder__tooltip__item">
|
175
|
-
<div className="query-builder__tooltip__item__label">Path</div>
|
176
|
-
<div className="query-builder__tooltip__item__value">
|
177
|
-
{path}
|
178
|
-
</div>
|
179
|
-
{explorerState && (
|
180
|
-
<div className="query-builder__tooltip__item__action">
|
181
|
-
<button
|
182
|
-
onClick={() => explorerState.highlightTreeNode(path)}
|
183
|
-
title="Show in tree"
|
184
|
-
>
|
185
|
-
<ShareBoxIcon color="white" />
|
186
|
-
</button>
|
160
|
+
{data.map((elem) => (
|
161
|
+
<div key={elem.label} className="query-builder__tooltip__item">
|
162
|
+
<div className="query-builder__tooltip__item__label">
|
163
|
+
{elem.label}
|
187
164
|
</div>
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
Multiplicity
|
193
|
-
</div>
|
194
|
-
<div className="query-builder__tooltip__item__value">
|
195
|
-
{getMultiplicityDescription(property.multiplicity)}
|
196
|
-
</div>
|
197
|
-
</div>
|
198
|
-
<div className="query-builder__tooltip__item">
|
199
|
-
<div className="query-builder__tooltip__item__label">
|
200
|
-
Derived Property
|
201
|
-
</div>
|
202
|
-
<div className="query-builder__tooltip__item__value">
|
203
|
-
{property instanceof DerivedProperty ? 'Yes' : 'No'}
|
204
|
-
</div>
|
205
|
-
</div>
|
206
|
-
<div className="query-builder__tooltip__item">
|
207
|
-
<div className="query-builder__tooltip__item__label">
|
208
|
-
Mapped
|
209
|
-
</div>
|
210
|
-
<div className="query-builder__tooltip__item__value">
|
211
|
-
{isMapped ? 'Yes' : 'No'}
|
165
|
+
<div className="query-builder__tooltip__item__value">
|
166
|
+
{elem.value}
|
167
|
+
</div>
|
168
|
+
{elem.actionButton}
|
212
169
|
</div>
|
213
|
-
|
214
|
-
|
215
|
-
taggedValues={property.taggedValues}
|
216
|
-
/>
|
170
|
+
))}
|
171
|
+
{footerElement}
|
217
172
|
</div>
|
218
173
|
}
|
219
174
|
>
|
@@ -223,3 +178,99 @@ export const QueryBuilderPropertyInfoTooltip: React.FC<{
|
|
223
178
|
</ClickAwayListener>
|
224
179
|
);
|
225
180
|
};
|
181
|
+
|
182
|
+
export const QueryBuilderPropertyInfoTooltip: React.FC<{
|
183
|
+
title: string;
|
184
|
+
property: AbstractProperty;
|
185
|
+
path: string;
|
186
|
+
isMapped: boolean;
|
187
|
+
children: React.ReactElement;
|
188
|
+
placement?: TooltipPlacement | undefined;
|
189
|
+
type?: Type | undefined;
|
190
|
+
explorerState?: QueryBuilderExplorerState | undefined;
|
191
|
+
}> = (props) => {
|
192
|
+
const {
|
193
|
+
title,
|
194
|
+
property,
|
195
|
+
path,
|
196
|
+
isMapped,
|
197
|
+
children,
|
198
|
+
placement,
|
199
|
+
type,
|
200
|
+
explorerState,
|
201
|
+
} = props;
|
202
|
+
|
203
|
+
const data = [
|
204
|
+
{
|
205
|
+
label: 'Type',
|
206
|
+
value: type?.path ?? property.genericType.value.rawType.path,
|
207
|
+
},
|
208
|
+
{
|
209
|
+
label: 'Path',
|
210
|
+
value: path,
|
211
|
+
actionButton: explorerState ? (
|
212
|
+
<div className="query-builder__tooltip__item__action">
|
213
|
+
<button
|
214
|
+
onClick={() => explorerState.highlightTreeNode(path)}
|
215
|
+
title="Show in tree"
|
216
|
+
>
|
217
|
+
<ShareBoxIcon color="white" />
|
218
|
+
</button>
|
219
|
+
</div>
|
220
|
+
) : undefined,
|
221
|
+
},
|
222
|
+
{
|
223
|
+
label: 'Multiplicity',
|
224
|
+
value: getMultiplicityDescription(property.multiplicity),
|
225
|
+
},
|
226
|
+
{
|
227
|
+
label: 'Derived Property',
|
228
|
+
value: property instanceof DerivedProperty ? 'Yes' : 'No',
|
229
|
+
},
|
230
|
+
{
|
231
|
+
label: 'Mapped',
|
232
|
+
value: isMapped ? 'Yes' : 'No',
|
233
|
+
},
|
234
|
+
];
|
235
|
+
|
236
|
+
return (
|
237
|
+
<QueryBuilderBaseInfoTooltip
|
238
|
+
title={title}
|
239
|
+
data={data}
|
240
|
+
placement={placement}
|
241
|
+
footerElement={
|
242
|
+
<QueryBuilderTaggedValueInfoTooltip
|
243
|
+
taggedValues={property.taggedValues}
|
244
|
+
/>
|
245
|
+
}
|
246
|
+
>
|
247
|
+
{children}
|
248
|
+
</QueryBuilderBaseInfoTooltip>
|
249
|
+
);
|
250
|
+
};
|
251
|
+
|
252
|
+
export const QueryBuilderDerivationInfoTooltip: React.FC<{
|
253
|
+
title: string;
|
254
|
+
children: React.ReactElement;
|
255
|
+
placement?: TooltipPlacement | undefined;
|
256
|
+
type?: Type | undefined;
|
257
|
+
}> = (props) => {
|
258
|
+
const { title, children, placement, type } = props;
|
259
|
+
|
260
|
+
const data = [
|
261
|
+
{
|
262
|
+
label: 'Type',
|
263
|
+
value: type?.path ?? 'undefined',
|
264
|
+
},
|
265
|
+
];
|
266
|
+
|
267
|
+
return (
|
268
|
+
<QueryBuilderBaseInfoTooltip
|
269
|
+
title={title}
|
270
|
+
data={data}
|
271
|
+
placement={placement}
|
272
|
+
>
|
273
|
+
{children}
|
274
|
+
</QueryBuilderBaseInfoTooltip>
|
275
|
+
);
|
276
|
+
};
|
@@ -35,7 +35,7 @@ import {
|
|
35
35
|
type ValueSpecification,
|
36
36
|
} from '@finos/legend-graph';
|
37
37
|
import { observer } from 'mobx-react-lite';
|
38
|
-
import { useCallback } from 'react';
|
38
|
+
import { useCallback, useState } from 'react';
|
39
39
|
import { useDrop } from 'react-dnd';
|
40
40
|
import type { QueryBuilderState } from '../../stores/QueryBuilderState.js';
|
41
41
|
import type { QueryBuilderWatermarkState } from '../../stores/watermark/QueryBuilderWatermarkState.js';
|
@@ -45,6 +45,7 @@ import {
|
|
45
45
|
type QueryBuilderVariableDragSource,
|
46
46
|
} from '../shared/BasicValueSpecificationEditor.js';
|
47
47
|
import { VariableSelector } from '../shared/QueryBuilderVariableSelector.js';
|
48
|
+
import { clone, deepClone } from '@finos/legend-shared';
|
48
49
|
|
49
50
|
const isParamaterCompatibleWithWaterMark = (
|
50
51
|
parameter: VariableExpression,
|
@@ -54,18 +55,25 @@ const isParamaterCompatibleWithWaterMark = (
|
|
54
55
|
|
55
56
|
const WatermarkValueEditor = observer(
|
56
57
|
(props: {
|
57
|
-
|
58
|
+
selectedValue: ValueSpecification;
|
59
|
+
setSelectedValue: (val: ValueSpecification) => void;
|
60
|
+
handleResetValue: () => void;
|
58
61
|
watermarkState: QueryBuilderWatermarkState;
|
59
62
|
}) => {
|
60
|
-
const {
|
63
|
+
const {
|
64
|
+
selectedValue,
|
65
|
+
setSelectedValue,
|
66
|
+
handleResetValue,
|
67
|
+
watermarkState,
|
68
|
+
} = props;
|
61
69
|
|
62
70
|
const graph = watermarkState.queryBuilderState.graphManagerState.graph;
|
63
71
|
|
64
72
|
const handleDrop = useCallback(
|
65
73
|
(item: QueryBuilderVariableDragSource): void => {
|
66
|
-
|
74
|
+
setSelectedValue(item.variable);
|
67
75
|
},
|
68
|
-
[
|
76
|
+
[setSelectedValue],
|
69
77
|
);
|
70
78
|
|
71
79
|
const [{ isParameterValueDragOver }, dropTargetConnector] = useDrop<
|
@@ -101,20 +109,18 @@ const WatermarkValueEditor = observer(
|
|
101
109
|
dropTargetConnector={dropTargetConnector}
|
102
110
|
>
|
103
111
|
<BasicValueSpecificationEditor
|
104
|
-
valueSpecification={
|
112
|
+
valueSpecification={selectedValue}
|
105
113
|
setValueSpecification={(val: ValueSpecification): void => {
|
106
|
-
|
114
|
+
setSelectedValue(clone(val));
|
107
115
|
}}
|
108
116
|
graph={graph}
|
109
117
|
obseverContext={watermarkState.queryBuilderState.observerContext}
|
110
118
|
typeCheckOption={{
|
111
119
|
expectedType: PrimitiveType.STRING,
|
112
120
|
}}
|
113
|
-
resetValue={
|
114
|
-
watermarkState.resetValue();
|
115
|
-
}}
|
121
|
+
resetValue={handleResetValue}
|
116
122
|
isConstant={watermarkState.queryBuilderState.constantState.isValueSpecConstant(
|
117
|
-
|
123
|
+
selectedValue,
|
118
124
|
)}
|
119
125
|
/>
|
120
126
|
</PanelDropZone>
|
@@ -127,36 +133,66 @@ const WatermarkValueEditor = observer(
|
|
127
133
|
export const QueryBuilderWatermarkEditor = observer(
|
128
134
|
(props: { queryBuilderState: QueryBuilderState }) => {
|
129
135
|
const { queryBuilderState } = props;
|
136
|
+
const applicationStore = queryBuilderState.applicationStore;
|
130
137
|
const watermarkState = queryBuilderState.watermarkState;
|
131
|
-
|
138
|
+
|
139
|
+
const [selectedValue, setSelectedValue] = useState(
|
140
|
+
deepClone(watermarkState.value),
|
141
|
+
);
|
142
|
+
|
143
|
+
const handleCancel = (): void => {
|
132
144
|
watermarkState.setIsEditingWatermark(false);
|
133
145
|
};
|
134
146
|
|
147
|
+
const handleApply = (): void => {
|
148
|
+
watermarkState.setValue(selectedValue);
|
149
|
+
handleCancel();
|
150
|
+
};
|
151
|
+
|
152
|
+
const handleResetValue = (): void => {
|
153
|
+
setSelectedValue(watermarkState.getDefaultValue());
|
154
|
+
};
|
155
|
+
|
156
|
+
const toggleWatermark = (): void => {
|
157
|
+
if (selectedValue) {
|
158
|
+
setSelectedValue(undefined);
|
159
|
+
} else {
|
160
|
+
handleResetValue();
|
161
|
+
}
|
162
|
+
};
|
163
|
+
|
135
164
|
return (
|
136
165
|
<Dialog
|
137
166
|
open={Boolean(watermarkState.isEditingWatermark)}
|
138
|
-
onClose={
|
167
|
+
onClose={handleCancel}
|
139
168
|
classes={{
|
140
169
|
root: 'editor-modal__root-container',
|
141
170
|
container: 'editor-modal__container',
|
142
171
|
paper: 'editor-modal__content',
|
143
172
|
}}
|
144
173
|
>
|
145
|
-
<Modal
|
174
|
+
<Modal
|
175
|
+
darkMode={
|
176
|
+
!applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
|
177
|
+
}
|
178
|
+
className="editor-modal query-builder__watermark__modal"
|
179
|
+
>
|
146
180
|
<ModalHeader title="Watermark" />
|
147
181
|
<ModalBody>
|
148
182
|
<PanelForm>
|
149
183
|
<PanelFormBooleanField
|
150
184
|
isReadOnly={false}
|
151
|
-
value={
|
185
|
+
value={selectedValue !== undefined}
|
152
186
|
prompt="Enable watermark"
|
153
|
-
update={
|
187
|
+
update={toggleWatermark}
|
154
188
|
/>
|
155
|
-
{
|
189
|
+
{selectedValue && (
|
156
190
|
<>
|
157
191
|
<WatermarkValueEditor
|
192
|
+
selectedValue={selectedValue}
|
193
|
+
setSelectedValue={setSelectedValue}
|
194
|
+
handleResetValue={handleResetValue}
|
158
195
|
watermarkState={watermarkState}
|
159
|
-
watermarkValue={watermarkState.value}
|
160
196
|
/>
|
161
197
|
<PanelDivider />
|
162
198
|
<VariableSelector
|
@@ -168,7 +204,12 @@ export const QueryBuilderWatermarkEditor = observer(
|
|
168
204
|
</PanelForm>
|
169
205
|
</ModalBody>
|
170
206
|
<ModalFooter>
|
171
|
-
<ModalFooterButton text="
|
207
|
+
<ModalFooterButton text="Apply" onClick={handleApply} />
|
208
|
+
<ModalFooterButton
|
209
|
+
text="Cancel"
|
210
|
+
onClick={handleCancel}
|
211
|
+
type="secondary"
|
212
|
+
/>
|
172
213
|
</ModalFooter>
|
173
214
|
</Modal>
|
174
215
|
</Dialog>
|
@@ -45,6 +45,7 @@ import {
|
|
45
45
|
changeEntry,
|
46
46
|
assertTrue,
|
47
47
|
ActionState,
|
48
|
+
deepClone,
|
48
49
|
} from '@finos/legend-shared';
|
49
50
|
import { action, makeObservable, observable } from 'mobx';
|
50
51
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from './QueryBuilderStateHashUtils.js';
|
@@ -386,3 +387,14 @@ export class QueryBuilderConstantsState implements Hashable {
|
|
386
387
|
]);
|
387
388
|
}
|
388
389
|
}
|
390
|
+
|
391
|
+
export const cloneQueryBuilderConstantLambdaEditorState = (
|
392
|
+
state: QueryBuilderConstantLambdaEditorState,
|
393
|
+
): QueryBuilderConstantLambdaEditorState => {
|
394
|
+
const clonedState = new QueryBuilderConstantLambdaEditorState(
|
395
|
+
deepClone(state.calculatedState),
|
396
|
+
);
|
397
|
+
clonedState.lambdaString = state.lambdaString;
|
398
|
+
clonedState.parserError = deepClone(state.parserError);
|
399
|
+
return clonedState;
|
400
|
+
};
|
@@ -53,6 +53,10 @@ export type QueryChatRenderer = (
|
|
53
53
|
queryBuilderState: QueryBuilderState,
|
54
54
|
) => React.ReactNode;
|
55
55
|
|
56
|
+
export type TemplateQueryPanelContentRenderer = (
|
57
|
+
queryBuilderState: QueryBuilderState,
|
58
|
+
) => React.ReactNode;
|
59
|
+
|
56
60
|
export interface QueryBuilder_LegendApplicationPlugin_Extension
|
57
61
|
extends LegendApplicationPlugin {
|
58
62
|
/**
|
@@ -79,4 +83,9 @@ export interface QueryBuilder_LegendApplicationPlugin_Extension
|
|
79
83
|
* Get the list of query chat configurations
|
80
84
|
*/
|
81
85
|
getExtraQueryChatRenderers?(): QueryChatRenderer[];
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Get the list of template query panel content render
|
89
|
+
*/
|
90
|
+
getExtraTemplateQueryPanelContentRenderer?(): TemplateQueryPanelContentRenderer[];
|
82
91
|
}
|
@@ -39,8 +39,6 @@ export class QueryBuilderWatermarkState implements Hashable {
|
|
39
39
|
value: observable,
|
40
40
|
isEditingWatermark: observable,
|
41
41
|
setValue: action,
|
42
|
-
resetValue: action,
|
43
|
-
enableWatermark: action,
|
44
42
|
setIsEditingWatermark: action,
|
45
43
|
hashCode: computed,
|
46
44
|
});
|
@@ -48,7 +46,7 @@ export class QueryBuilderWatermarkState implements Hashable {
|
|
48
46
|
this.queryBuilderState = queryBuilderState;
|
49
47
|
}
|
50
48
|
|
51
|
-
|
49
|
+
getDefaultValue(): ValueSpecification {
|
52
50
|
const watermarkConstant = new PrimitiveInstanceValue(
|
53
51
|
GenericTypeExplicitReference.create(
|
54
52
|
new GenericType(PrimitiveType.STRING),
|
@@ -56,21 +54,13 @@ export class QueryBuilderWatermarkState implements Hashable {
|
|
56
54
|
);
|
57
55
|
|
58
56
|
watermarkConstant.values = ['watermarkValue'];
|
59
|
-
|
57
|
+
return watermarkConstant;
|
60
58
|
}
|
61
59
|
|
62
60
|
setIsEditingWatermark(val: boolean): void {
|
63
61
|
this.isEditingWatermark = val;
|
64
62
|
}
|
65
63
|
|
66
|
-
enableWatermark(): void {
|
67
|
-
if (this.value) {
|
68
|
-
this.setValue(undefined);
|
69
|
-
} else {
|
70
|
-
this.resetValue();
|
71
|
-
}
|
72
|
-
}
|
73
|
-
|
74
64
|
setValue(val: ValueSpecification | undefined): void {
|
75
65
|
this.value = val
|
76
66
|
? observe_ValueSpecification(val, this.queryBuilderState.observerContext)
|