@finos/legend-query-builder 4.14.35 → 4.14.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. package/lib/__lib__/QueryBuilderTesting.d.ts +1 -0
  2. package/lib/__lib__/QueryBuilderTesting.d.ts.map +1 -1
  3. package/lib/__lib__/QueryBuilderTesting.js +1 -0
  4. package/lib/__lib__/QueryBuilderTesting.js.map +1 -1
  5. package/lib/components/QueryBuilder.d.ts.map +1 -1
  6. package/lib/components/QueryBuilder.js +37 -17
  7. package/lib/components/QueryBuilder.js.map +1 -1
  8. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -1
  9. package/lib/components/QueryBuilderConstantExpressionPanel.js +30 -13
  10. package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
  11. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  12. package/lib/components/QueryBuilderPropertyExpressionEditor.js +2 -1
  13. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  14. package/lib/components/QueryBuilderSideBar.d.ts +0 -16
  15. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  16. package/lib/components/QueryBuilderSideBar.js +32 -104
  17. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  18. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  19. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +2 -1
  20. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  21. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  22. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +50 -5
  23. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  24. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  25. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +2 -1
  26. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  27. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  28. package/lib/components/filter/QueryBuilderFilterPanel.js +2 -1
  29. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  30. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  31. package/lib/components/shared/BasicValueSpecificationEditor.js +62 -28
  32. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  33. package/lib/components/shared/CustomDatePicker.d.ts +1 -0
  34. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  35. package/lib/components/shared/CustomDatePicker.js +13 -9
  36. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  37. package/lib/components/shared/QueryBuilderVariableSelector.d.ts +1 -0
  38. package/lib/components/shared/QueryBuilderVariableSelector.d.ts.map +1 -1
  39. package/lib/components/shared/QueryBuilderVariableSelector.js +2 -2
  40. package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -1
  41. package/lib/components/workflows/ClassQueryBuilder.d.ts.map +1 -1
  42. package/lib/components/workflows/ClassQueryBuilder.js +19 -16
  43. package/lib/components/workflows/ClassQueryBuilder.js.map +1 -1
  44. package/lib/components/workflows/MappingQueryBuilder.d.ts.map +1 -1
  45. package/lib/components/workflows/MappingQueryBuilder.js +18 -15
  46. package/lib/components/workflows/MappingQueryBuilder.js.map +1 -1
  47. package/lib/components/workflows/ServiceQueryBuilder.d.ts.map +1 -1
  48. package/lib/components/workflows/ServiceQueryBuilder.js +13 -10
  49. package/lib/components/workflows/ServiceQueryBuilder.js.map +1 -1
  50. package/lib/index.css +2 -2
  51. package/lib/index.css.map +1 -1
  52. package/lib/index.d.ts +2 -1
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +1 -0
  55. package/lib/index.js.map +1 -1
  56. package/lib/package.json +1 -1
  57. package/lib/stores/QueryBuilderConstantsState.d.ts.map +1 -1
  58. package/lib/stores/QueryBuilderConstantsState.js +2 -1
  59. package/lib/stores/QueryBuilderConstantsState.js.map +1 -1
  60. package/lib/stores/QueryBuilderPropertyEditorState.d.ts +1 -1
  61. package/lib/stores/QueryBuilderPropertyEditorState.d.ts.map +1 -1
  62. package/lib/stores/QueryBuilderPropertyEditorState.js +12 -34
  63. package/lib/stores/QueryBuilderPropertyEditorState.js.map +1 -1
  64. package/lib/stores/QueryBuilderState.d.ts +3 -0
  65. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  66. package/lib/stores/QueryBuilderState.js +15 -1
  67. package/lib/stores/QueryBuilderState.js.map +1 -1
  68. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +2 -1
  69. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  70. package/lib/stores/QueryBuilderValueSpecificationHelper.js +23 -1
  71. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  72. package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts +13 -0
  73. package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts.map +1 -1
  74. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +2 -0
  75. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
  76. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js +2 -0
  77. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
  78. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts +2 -0
  79. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
  80. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +6 -0
  81. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  82. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +2 -0
  83. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  84. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +15 -0
  85. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  86. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts +3 -0
  87. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts.map +1 -1
  88. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +42 -3
  89. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
  90. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.d.ts.map +1 -1
  91. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +6 -5
  92. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js.map +1 -1
  93. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.d.ts.map +1 -1
  94. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +6 -5
  95. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js.map +1 -1
  96. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.d.ts.map +1 -1
  97. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +8 -37
  98. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
  99. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.d.ts.map +1 -1
  100. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +7 -10
  101. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
  102. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.d.ts.map +1 -1
  103. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +7 -10
  104. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
  105. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.d.ts.map +1 -1
  106. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +6 -5
  107. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
  108. package/lib/stores/filter/QueryBuilderFilterState.d.ts +3 -0
  109. package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
  110. package/lib/stores/filter/QueryBuilderFilterState.js +30 -2
  111. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  112. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.d.ts.map +1 -1
  113. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js +5 -4
  114. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js.map +1 -1
  115. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.d.ts.map +1 -1
  116. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js +5 -4
  117. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js.map +1 -1
  118. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.d.ts.map +1 -1
  119. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js +7 -35
  120. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js.map +1 -1
  121. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.d.ts.map +1 -1
  122. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js +6 -8
  123. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js.map +1 -1
  124. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.d.ts.map +1 -1
  125. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js +6 -8
  126. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js.map +1 -1
  127. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.d.ts.map +1 -1
  128. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js +6 -8
  129. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js.map +1 -1
  130. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.d.ts.map +1 -1
  131. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js +6 -8
  132. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js.map +1 -1
  133. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.d.ts.map +1 -1
  134. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js +5 -4
  135. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js.map +1 -1
  136. package/lib/stores/query-workflow/QueryBuilderWorkFlowState.d.ts +5 -0
  137. package/lib/stores/query-workflow/QueryBuilderWorkFlowState.d.ts.map +1 -1
  138. package/lib/stores/query-workflow/QueryBuilderWorkFlowState.js +7 -0
  139. package/lib/stores/query-workflow/QueryBuilderWorkFlowState.js.map +1 -1
  140. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +1 -1
  141. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
  142. package/lib/stores/shared/ValueSpecificationEditorHelper.js +20 -10
  143. package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
  144. package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts +0 -2
  145. package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts.map +1 -1
  146. package/lib/stores/watermark/QueryBuilderWatermarkState.js +0 -6
  147. package/lib/stores/watermark/QueryBuilderWatermarkState.js.map +1 -1
  148. package/lib/stores/workflows/MappingQueryBuilderState.d.ts +2 -2
  149. package/lib/stores/workflows/MappingQueryBuilderState.d.ts.map +1 -1
  150. package/lib/stores/workflows/MappingQueryBuilderState.js +2 -1
  151. package/lib/stores/workflows/MappingQueryBuilderState.js.map +1 -1
  152. package/lib/stores/workflows/ServiceQueryBuilderState.d.ts +2 -2
  153. package/lib/stores/workflows/ServiceQueryBuilderState.d.ts.map +1 -1
  154. package/lib/stores/workflows/ServiceQueryBuilderState.js +2 -1
  155. package/lib/stores/workflows/ServiceQueryBuilderState.js.map +1 -1
  156. package/package.json +4 -4
  157. package/src/__lib__/QueryBuilderTesting.ts +1 -0
  158. package/src/components/QueryBuilder.tsx +89 -46
  159. package/src/components/QueryBuilderConstantExpressionPanel.tsx +36 -14
  160. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +2 -0
  161. package/src/components/QueryBuilderSideBar.tsx +138 -339
  162. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +6 -1
  163. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +139 -1
  164. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +17 -0
  165. package/src/components/filter/QueryBuilderFilterPanel.tsx +6 -0
  166. package/src/components/shared/BasicValueSpecificationEditor.tsx +96 -34
  167. package/src/components/shared/CustomDatePicker.tsx +18 -11
  168. package/src/components/shared/QueryBuilderVariableSelector.tsx +2 -2
  169. package/src/components/workflows/ClassQueryBuilder.tsx +79 -77
  170. package/src/components/workflows/MappingQueryBuilder.tsx +75 -76
  171. package/src/components/workflows/ServiceQueryBuilder.tsx +71 -70
  172. package/src/index.ts +2 -1
  173. package/src/stores/QueryBuilderConstantsState.ts +2 -0
  174. package/src/stores/QueryBuilderPropertyEditorState.ts +15 -53
  175. package/src/stores/QueryBuilderState.ts +23 -1
  176. package/src/stores/QueryBuilderValueSpecificationHelper.ts +32 -0
  177. package/src/stores/QueryBuilder_LegendApplicationPlugin_Extension.ts +18 -0
  178. package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +4 -0
  179. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +8 -0
  180. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +32 -0
  181. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +59 -0
  182. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +5 -5
  183. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +5 -5
  184. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +10 -69
  185. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +7 -18
  186. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +7 -18
  187. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +5 -5
  188. package/src/stores/filter/QueryBuilderFilterState.ts +48 -2
  189. package/src/stores/filter/operators/QueryBuilderFilterOperator_Contain.ts +5 -5
  190. package/src/stores/filter/operators/QueryBuilderFilterOperator_EndWith.ts +5 -5
  191. package/src/stores/filter/operators/QueryBuilderFilterOperator_Equal.ts +10 -71
  192. package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.ts +6 -14
  193. package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.ts +6 -14
  194. package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThan.ts +6 -14
  195. package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.ts +6 -14
  196. package/src/stores/filter/operators/QueryBuilderFilterOperator_StartWith.ts +5 -5
  197. package/src/stores/query-workflow/QueryBuilderWorkFlowState.ts +10 -0
  198. package/src/stores/shared/ValueSpecificationEditorHelper.ts +32 -16
  199. package/src/stores/watermark/QueryBuilderWatermarkState.ts +0 -7
  200. package/src/stores/workflows/MappingQueryBuilderState.ts +7 -1
  201. package/src/stores/workflows/ServiceQueryBuilderState.ts +6 -1
  202. package/tsconfig.json +0 -1
  203. package/lib/components/watermark/QueryBuilderWatermark.d.ts +0 -22
  204. package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +0 -1
  205. package/lib/components/watermark/QueryBuilderWatermark.js +0 -83
  206. package/lib/components/watermark/QueryBuilderWatermark.js.map +0 -1
  207. package/src/components/watermark/QueryBuilderWatermark.tsx +0 -218
@@ -29,7 +29,6 @@ import {
29
29
  CheckIcon,
30
30
  CaretDownIcon,
31
31
  DiffIcon,
32
- WaterDropIcon,
33
32
  MenuContentDivider,
34
33
  Dialog,
35
34
  Modal,
@@ -74,16 +73,16 @@ import { QueryBuilderDiffViewPanelDiaglog } from './QueryBuilderDiffPanel.js';
74
73
  import { guaranteeType } from '@finos/legend-shared';
75
74
  import { QueryBuilderGraphFetchTreeState } from '../stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js';
76
75
  import { QueryBuilderPostTDSPanel } from './fetch-structure/QueryBuilderPostTDSPanel.js';
77
- import { QueryBuilderWatermarkEditor } from './watermark/QueryBuilderWatermark.js';
78
76
  import { QueryBuilderConstantExpressionPanel } from './QueryBuilderConstantExpressionPanel.js';
79
77
  import { QUERY_BUILDER_SETTING_KEY } from '../__lib__/QueryBuilderSetting.js';
80
78
  import { QUERY_BUILDER_COMPONENT_ELEMENT_ID } from './QueryBuilderComponentElement.js';
81
79
  import { DataAccessOverview } from './data-access/DataAccessOverview.js';
82
80
  import { QueryChat } from './QueryChat.js';
83
- import { useEffect, useRef } from 'react';
81
+ import { Fragment, useEffect, useRef } from 'react';
84
82
  import { RedoButton, UndoButton } from '@finos/legend-lego/application';
85
83
  import { FETCH_STRUCTURE_IMPLEMENTATION } from '../stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js';
86
84
  import { onChangeFetchStructureImplementation } from '../stores/fetch-structure/QueryBuilderFetchStructureState.js';
85
+ import type { QueryBuilder_LegendApplicationPlugin_Extension } from '../stores/QueryBuilder_LegendApplicationPlugin_Extension.js';
87
86
 
88
87
  const QueryBuilderPostGraphFetchPanel = observer(
89
88
  (props: { graphFetchState: QueryBuilderGraphFetchTreeState }) => {
@@ -126,13 +125,18 @@ const QueryBuilderStatusBar = observer(
126
125
  className={clsx(
127
126
  'query-builder__status-bar__action query-builder__status-bar__view-diff-btn',
128
127
  )}
129
- disabled={!queryBuilderState.changeDetectionState.hasChanged}
128
+ disabled={
129
+ !queryBuilderState.changeDetectionState.hasChanged ||
130
+ !queryBuilderState.canBuildQuery
131
+ }
130
132
  onClick={showDiff}
131
133
  tabIndex={-1}
132
134
  title={
133
- queryBuilderState.changeDetectionState.hasChanged
134
- ? 'Show changes'
135
- : 'Query has not been changed'
135
+ !queryBuilderState.canBuildQuery
136
+ ? 'Please fix query errors to show changes'
137
+ : queryBuilderState.changeDetectionState.hasChanged
138
+ ? 'Show changes'
139
+ : 'Query has not been changed'
136
140
  }
137
141
  >
138
142
  <DiffIcon />
@@ -193,7 +197,12 @@ const QueryBuilderStatusBar = observer(
193
197
  openLambdaEditor(QueryBuilderTextEditorMode.JSON)
194
198
  }
195
199
  tabIndex={-1}
196
- title="View Query Protocol"
200
+ disabled={!queryBuilderState.canBuildQuery}
201
+ title={
202
+ !queryBuilderState.canBuildQuery
203
+ ? 'Please fix query errors to show query protocol'
204
+ : 'Show Query Protocol'
205
+ }
197
206
  >{`{ }`}</button>
198
207
  <button
199
208
  className={clsx(
@@ -208,7 +217,12 @@ const QueryBuilderStatusBar = observer(
208
217
  openLambdaEditor(QueryBuilderTextEditorMode.TEXT)
209
218
  }
210
219
  tabIndex={-1}
211
- title="View Query in Pure"
220
+ disabled={!queryBuilderState.canBuildQuery}
221
+ title={
222
+ !queryBuilderState.canBuildQuery
223
+ ? 'Please fix query errors to edit in Pure'
224
+ : 'Edit Query in Pure'
225
+ }
212
226
  >
213
227
  <HackerIcon />
214
228
  </button>
@@ -277,10 +291,6 @@ export const QueryBuilder = observer(
277
291
  }
278
292
  };
279
293
 
280
- const openWatermark = (): void => {
281
- queryBuilderState.watermarkState.setIsEditingWatermark(true);
282
- };
283
-
284
294
  const toggleEnableCalendar = (): void => {
285
295
  if (queryBuilderState.isCalendarEnabled) {
286
296
  queryBuilderState.applicationStore.alertService.setActionAlertInfo({
@@ -431,7 +441,11 @@ export const QueryBuilder = observer(
431
441
  useEffect(() => {
432
442
  // this condition is for passing all exisitng tests because when we initialize a queryBuilderState for a test,
433
443
  // we use an empty RawLambda with an empty class and this useEffect is called earlier than initializeWithQuery()
434
- if (queryBuilderState.isQuerySupported && queryBuilderState.class) {
444
+ if (
445
+ queryBuilderState.isQuerySupported &&
446
+ queryBuilderState.class &&
447
+ queryBuilderState.canBuildQuery
448
+ ) {
435
449
  queryBuilderState.changeHistoryState.cacheNewQuery(
436
450
  queryBuilderState.buildQuery(),
437
451
  );
@@ -457,19 +471,11 @@ export const QueryBuilder = observer(
457
471
  isLoading={queryBuilderState.resultState.exportState.isInProgress}
458
472
  />
459
473
  <div className="query-builder__content">
460
- <div className="query-builder__header">
474
+ <div
475
+ data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_ACTIONS}
476
+ className="query-builder__header"
477
+ >
461
478
  <div className="query-builder__header__statuses">
462
- {queryBuilderState.watermarkState.value && (
463
- <button
464
- className="query-builder__header__status query-builder__header__status--action"
465
- onClick={openWatermark}
466
- tabIndex={-1}
467
- title="Used watermark"
468
- name="Used watermark"
469
- >
470
- <WaterDropIcon />
471
- </button>
472
- )}
473
479
  {queryBuilderState.isCalendarEnabled && (
474
480
  <div
475
481
  className="query-builder__header__status"
@@ -478,11 +484,19 @@ export const QueryBuilder = observer(
478
484
  <CalendarClockIcon className="query-builder__header__status__icon--calendar" />
479
485
  </div>
480
486
  )}
481
- {queryBuilderState.watermarkState.isEditingWatermark && (
482
- <QueryBuilderWatermarkEditor
483
- queryBuilderState={queryBuilderState}
484
- />
485
- )}
487
+ {applicationStore.pluginManager
488
+ .getApplicationPlugins()
489
+ .flatMap(
490
+ (plugin) =>
491
+ (
492
+ plugin as QueryBuilder_LegendApplicationPlugin_Extension
493
+ ).getExtraQueryBuilderHeaderTitleConfigurations?.() ?? [],
494
+ )
495
+ .map((actionConfig) => (
496
+ <Fragment key={actionConfig.key}>
497
+ {actionConfig.renderer(queryBuilderState)}
498
+ </Fragment>
499
+ ))}
486
500
  </div>
487
501
  <div className="query-builder__header__actions">
488
502
  <div className="query-builder__header__actions__undo-redo">
@@ -503,6 +517,21 @@ export const QueryBuilder = observer(
503
517
  redo={redo}
504
518
  />
505
519
  </div>
520
+ {applicationStore.pluginManager
521
+ .getApplicationPlugins()
522
+ .flatMap(
523
+ (plugin) =>
524
+ (
525
+ plugin as QueryBuilder_LegendApplicationPlugin_Extension
526
+ ).getExtraQueryBuilderHeaderActionConfigurations?.() ??
527
+ [],
528
+ )
529
+ .sort((A, B) => B.category - A.category)
530
+ .map((actionConfig) => (
531
+ <Fragment key={actionConfig.key}>
532
+ {actionConfig.renderer(queryBuilderState)}
533
+ </Fragment>
534
+ ))}
506
535
  <DropdownMenu
507
536
  className="query-builder__header__advanced-dropdown"
508
537
  title="Show Advanced Menu..."
@@ -643,14 +672,6 @@ export const QueryBuilder = observer(
643
672
  Show Post-Filter
644
673
  </MenuContentItemLabel>
645
674
  </MenuContentItem>
646
- <MenuContentItem onClick={openWatermark}>
647
- <MenuContentItemIcon>
648
- <WaterDropIcon />
649
- </MenuContentItemIcon>
650
- <MenuContentItemLabel>
651
- Show Watermark
652
- </MenuContentItemLabel>
653
- </MenuContentItem>
654
675
  <MenuContentItem
655
676
  onClick={toggleEnableCalendar}
656
677
  disabled={
@@ -695,11 +716,17 @@ export const QueryBuilder = observer(
695
716
  <MenuContentItem
696
717
  onClick={openCheckEntitlmentsEditor}
697
718
  disabled={
698
- queryBuilderState.isQuerySupported &&
699
- queryBuilderState.fetchStructureState
700
- .implementation instanceof QueryBuilderTDSState &&
701
- queryBuilderState.fetchStructureState.implementation
702
- .projectionColumns.length === 0
719
+ (queryBuilderState.isQuerySupported &&
720
+ queryBuilderState.fetchStructureState
721
+ .implementation instanceof QueryBuilderTDSState &&
722
+ queryBuilderState.fetchStructureState.implementation
723
+ .projectionColumns.length === 0) ||
724
+ !queryBuilderState.canBuildQuery
725
+ }
726
+ title={
727
+ !queryBuilderState.canBuildQuery
728
+ ? 'Please fix query errors to check entitlements'
729
+ : ''
703
730
  }
704
731
  >
705
732
  <MenuContentItemIcon>
@@ -709,7 +736,15 @@ export const QueryBuilder = observer(
709
736
  Check Entitlements
710
737
  </MenuContentItemLabel>
711
738
  </MenuContentItem>
712
- <MenuContentItem onClick={editQueryInPure}>
739
+ <MenuContentItem
740
+ onClick={editQueryInPure}
741
+ disabled={!queryBuilderState.canBuildQuery}
742
+ title={
743
+ !queryBuilderState.canBuildQuery
744
+ ? 'Please fix query errors to edit in Pure'
745
+ : undefined
746
+ }
747
+ >
713
748
  <MenuContentItemIcon>
714
749
  <HackerIcon />
715
750
  </MenuContentItemIcon>
@@ -717,7 +752,15 @@ export const QueryBuilder = observer(
717
752
  Edit Query in Pure
718
753
  </MenuContentItemLabel>
719
754
  </MenuContentItem>
720
- <MenuContentItem onClick={showQueryProtocol}>
755
+ <MenuContentItem
756
+ onClick={showQueryProtocol}
757
+ disabled={!queryBuilderState.canBuildQuery}
758
+ title={
759
+ !queryBuilderState.canBuildQuery
760
+ ? 'Please fix query errors to show query protocol'
761
+ : undefined
762
+ }
763
+ >
721
764
  <MenuContentItemIcon>
722
765
  <SerializeIcon />
723
766
  </MenuContentItemIcon>
@@ -41,6 +41,7 @@ import {
41
41
  VariableExpression,
42
42
  Multiplicity,
43
43
  isValidIdentifier,
44
+ InstanceValue,
44
45
  } from '@finos/legend-graph';
45
46
  import { deepClone } from '@finos/legend-shared';
46
47
  import { observer } from 'mobx-react-lite';
@@ -60,6 +61,7 @@ import { variableExpression_setName } from '../stores/shared/ValueSpecificationM
60
61
  import { LambdaEditor } from './shared/LambdaEditor.js';
61
62
  import { VariableViewer } from './shared/QueryBuilderVariableSelector.js';
62
63
  import { flowResult } from 'mobx';
64
+ import { isValidInstanceValue } from '../stores/QueryBuilderValueSpecificationHelper.js';
63
65
 
64
66
  const getConstantNameValidationMessage = (
65
67
  constantInput: string,
@@ -93,13 +95,9 @@ const QueryBuilderSimpleConstantExpressionEditor = observer(
93
95
  const [selectedName, setSelectedName] = useState(stateName);
94
96
  const [isNameValid, setIsNameValid] = useState<boolean>(true);
95
97
  const [hasEditedName, setHasEditedName] = useState<boolean>(false);
96
- const [nameInputRef, setNameInputRef] = useState<HTMLInputElement | null>(
97
- null,
98
- );
99
98
  const handleNameInputRef = useCallback(
100
99
  (ref: HTMLInputElement | null): void => {
101
100
  ref?.focus();
102
- setNameInputRef(ref);
103
101
  },
104
102
  [],
105
103
  );
@@ -107,6 +105,17 @@ const QueryBuilderSimpleConstantExpressionEditor = observer(
107
105
  // Value
108
106
  const stateValue = constantState.value;
109
107
  const [selectedValue, setSelectedValue] = useState(deepClone(stateValue));
108
+ const [shouldFocusOnValue, setShouldFocusOnValue] =
109
+ useState<boolean>(!isCreating);
110
+ const handleValueInputRef = useCallback(
111
+ (ref: HTMLInputElement | null): void => {
112
+ if (shouldFocusOnValue) {
113
+ ref?.focus();
114
+ setShouldFocusOnValue(false);
115
+ }
116
+ },
117
+ [shouldFocusOnValue],
118
+ );
110
119
 
111
120
  // Type
112
121
  const stateType =
@@ -121,12 +130,28 @@ const QueryBuilderSimpleConstantExpressionEditor = observer(
121
130
  queryBuilderState.graphManagerState.graph,
122
131
  val.value,
123
132
  queryBuilderState.observerContext,
133
+ queryBuilderState.INTERNAL__enableInitializingDefaultSimpleExpressionValue,
124
134
  );
125
135
  setSelectedValue(newValSpec);
126
136
  }
137
+ setShouldFocusOnValue(true);
127
138
  };
139
+ // Disabling binary, strict time, latest date, and byte as we
140
+ // don't support these constant types
141
+ const supportedPrimitiveTypes: PrimitiveType[] = [
142
+ PrimitiveType.STRING,
143
+ PrimitiveType.BOOLEAN,
144
+ PrimitiveType.NUMBER,
145
+ PrimitiveType.INTEGER,
146
+ PrimitiveType.FLOAT,
147
+ PrimitiveType.DECIMAL,
148
+ PrimitiveType.DATE,
149
+ PrimitiveType.STRICTDATE,
150
+ PrimitiveType.DATETIME,
151
+ ];
128
152
  const typeOptions: PackageableElementOption<Type>[] =
129
153
  queryBuilderState.graphManagerState.graph.primitiveTypes
154
+ .filter((type) => supportedPrimitiveTypes.includes(type))
130
155
  .map(buildElementOption)
131
156
  .concat(
132
157
  queryBuilderState.graphManagerState.graph.enumerations.map(
@@ -134,15 +159,6 @@ const QueryBuilderSimpleConstantExpressionEditor = observer(
134
159
  ),
135
160
  );
136
161
 
137
- const handleValueInputRef = (ref: HTMLInputElement | null): void => {
138
- if (
139
- (!isCreating || hasEditedName) &&
140
- document.activeElement !== nameInputRef
141
- ) {
142
- ref?.focus();
143
- }
144
- };
145
-
146
162
  // Modal lifecycle actions
147
163
  const handleCancel = (): void => {
148
164
  variableState.setSelectedConstant(undefined);
@@ -163,6 +179,7 @@ const QueryBuilderSimpleConstantExpressionEditor = observer(
163
179
  queryBuilderState.graphManagerState.graph,
164
180
  selectedType.value,
165
181
  queryBuilderState.observerContext,
182
+ queryBuilderState.INTERNAL__enableInitializingDefaultSimpleExpressionValue,
166
183
  );
167
184
  setSelectedValue(valSpec);
168
185
  };
@@ -259,7 +276,11 @@ const QueryBuilderSimpleConstantExpressionEditor = observer(
259
276
  <ModalFooter>
260
277
  <ModalFooterButton
261
278
  text={isCreating ? 'Create' : 'Apply'}
262
- disabled={!isNameValid}
279
+ disabled={
280
+ !isNameValid ||
281
+ (selectedValue instanceof InstanceValue &&
282
+ !isValidInstanceValue(selectedValue))
283
+ }
263
284
  onClick={handleApply}
264
285
  />
265
286
  <ModalFooterButton
@@ -415,6 +436,7 @@ export const QueryBuilderConstantExpressionPanel = observer(
415
436
  graph,
416
437
  PrimitiveType.STRING,
417
438
  queryBuilderState.observerContext,
439
+ queryBuilderState.INTERNAL__enableInitializingDefaultSimpleExpressionValue,
418
440
  );
419
441
  const variableEx = new VariableExpression('', Multiplicity.ONE);
420
442
  variableEx.genericType = defaultVal.genericType;
@@ -207,6 +207,8 @@ const DerivedPropertyParameterValueEditor = observer(
207
207
  variable,
208
208
  derivedPropertyExpressionState.queryBuilderState.graphManagerState
209
209
  .graph,
210
+ derivedPropertyExpressionState.queryBuilderState
211
+ .INTERNAL__enableInitializingDefaultSimpleExpressionValue,
210
212
  derivedPropertyExpressionState.queryBuilderState.observerContext,
211
213
  ),
212
214
  idx + 1,