@finos/legend-query-builder 4.14.18 → 4.14.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +5 -3
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderConstantExpressionPanel.js +71 -45
  6. package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
  7. package/lib/components/QueryBuilderDiffPanel.d.ts.map +1 -1
  8. package/lib/components/QueryBuilderDiffPanel.js +2 -1
  9. package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
  10. package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
  11. package/lib/components/QueryBuilderParametersPanel.js +25 -26
  12. package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
  13. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +11 -2
  14. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  15. package/lib/components/QueryBuilderPropertyExpressionEditor.js +35 -10
  16. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  17. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  18. package/lib/components/QueryBuilderSideBar.js +6 -1
  19. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  20. package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
  21. package/lib/components/QueryBuilderTextEditor.js +3 -3
  22. package/lib/components/QueryBuilderTextEditor.js.map +1 -1
  23. package/lib/components/QueryLoader.d.ts.map +1 -1
  24. package/lib/components/QueryLoader.js +90 -39
  25. package/lib/components/QueryLoader.js.map +1 -1
  26. package/lib/components/QueryUsageViewer.d.ts.map +1 -1
  27. package/lib/components/QueryUsageViewer.js +2 -2
  28. package/lib/components/QueryUsageViewer.js.map +1 -1
  29. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts +2 -0
  30. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts.map +1 -1
  31. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js +19 -2
  32. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js.map +1 -1
  33. package/lib/components/data-access/DataAccessOverview.d.ts.map +1 -1
  34. package/lib/components/data-access/DataAccessOverview.js +6 -1
  35. package/lib/components/data-access/DataAccessOverview.js.map +1 -1
  36. package/lib/components/execution-plan/ExecutionPlanViewer.d.ts.map +1 -1
  37. package/lib/components/execution-plan/ExecutionPlanViewer.js +6 -6
  38. package/lib/components/execution-plan/ExecutionPlanViewer.js.map +1 -1
  39. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
  40. package/lib/components/explorer/QueryBuilderExplorerPanel.js +3 -2
  41. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  42. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  43. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +3 -2
  44. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  45. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
  46. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js +6 -3
  47. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js.map +1 -1
  48. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  49. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +4 -3
  50. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  51. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  52. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +11 -22
  53. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  54. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -1
  55. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +2 -2
  56. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
  57. package/lib/components/result/QueryBuilderResultPanel.d.ts.map +1 -1
  58. package/lib/components/result/QueryBuilderResultPanel.js +2 -1
  59. package/lib/components/result/QueryBuilderResultPanel.js.map +1 -1
  60. package/lib/components/result/tds/QueryBuilderTDSGridResult.d.ts.map +1 -1
  61. package/lib/components/result/tds/QueryBuilderTDSGridResult.js +5 -1
  62. package/lib/components/result/tds/QueryBuilderTDSGridResult.js.map +1 -1
  63. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.d.ts.map +1 -1
  64. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js +11 -2
  65. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js.map +1 -1
  66. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  67. package/lib/components/shared/BasicValueSpecificationEditor.js +25 -22
  68. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  69. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  70. package/lib/components/shared/CustomDatePicker.js +8 -5
  71. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  72. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  73. package/lib/components/shared/LambdaEditor.js +17 -3
  74. package/lib/components/shared/LambdaEditor.js.map +1 -1
  75. package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -1
  76. package/lib/components/shared/LambdaParameterValuesEditor.js +2 -2
  77. package/lib/components/shared/LambdaParameterValuesEditor.js.map +1 -1
  78. package/lib/components/shared/QueryBuilderPropertyInfoTooltip.d.ts +6 -0
  79. package/lib/components/shared/QueryBuilderPropertyInfoTooltip.d.ts.map +1 -1
  80. package/lib/components/shared/QueryBuilderPropertyInfoTooltip.js +40 -3
  81. package/lib/components/shared/QueryBuilderPropertyInfoTooltip.js.map +1 -1
  82. package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +1 -1
  83. package/lib/components/watermark/QueryBuilderWatermark.js +28 -12
  84. package/lib/components/watermark/QueryBuilderWatermark.js.map +1 -1
  85. package/lib/index.css +17 -1
  86. package/lib/index.css.map +1 -1
  87. package/lib/package.json +1 -1
  88. package/lib/stores/QueryBuilderConstantsState.d.ts +1 -0
  89. package/lib/stores/QueryBuilderConstantsState.d.ts.map +1 -1
  90. package/lib/stores/QueryBuilderConstantsState.js +7 -1
  91. package/lib/stores/QueryBuilderConstantsState.js.map +1 -1
  92. package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts +24 -1
  93. package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts.map +1 -1
  94. package/lib/stores/QueryLoaderState.d.ts +14 -4
  95. package/lib/stores/QueryLoaderState.d.ts.map +1 -1
  96. package/lib/stores/QueryLoaderState.js +35 -5
  97. package/lib/stores/QueryLoaderState.js.map +1 -1
  98. package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts +1 -2
  99. package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts.map +1 -1
  100. package/lib/stores/watermark/QueryBuilderWatermarkState.js +2 -12
  101. package/lib/stores/watermark/QueryBuilderWatermarkState.js.map +1 -1
  102. package/package.json +8 -8
  103. package/src/components/QueryBuilder.tsx +14 -2
  104. package/src/components/QueryBuilderConstantExpressionPanel.tsx +145 -69
  105. package/src/components/QueryBuilderDiffPanel.tsx +10 -2
  106. package/src/components/QueryBuilderParametersPanel.tsx +42 -37
  107. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +87 -24
  108. package/src/components/QueryBuilderSideBar.tsx +20 -0
  109. package/src/components/QueryBuilderTextEditor.tsx +6 -4
  110. package/src/components/QueryLoader.tsx +291 -130
  111. package/src/components/QueryUsageViewer.tsx +7 -1
  112. package/src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx +40 -4
  113. package/src/components/data-access/DataAccessOverview.tsx +9 -1
  114. package/src/components/execution-plan/ExecutionPlanViewer.tsx +11 -8
  115. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +5 -2
  116. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +5 -2
  117. package/src/components/fetch-structure/QueryBuilderGraphFetchTreePanel.tsx +12 -5
  118. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +8 -4
  119. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +56 -72
  120. package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +8 -2
  121. package/src/components/result/QueryBuilderResultPanel.tsx +8 -1
  122. package/src/components/result/tds/QueryBuilderTDSGridResult.tsx +6 -3
  123. package/src/components/result/tds/QueryBuilderTDSSimpleGridResult.tsx +14 -4
  124. package/src/components/shared/BasicValueSpecificationEditor.tsx +39 -25
  125. package/src/components/shared/CustomDatePicker.tsx +18 -5
  126. package/src/components/shared/LambdaEditor.tsx +27 -11
  127. package/src/components/shared/LambdaParameterValuesEditor.tsx +4 -1
  128. package/src/components/shared/QueryBuilderPropertyInfoTooltip.tsx +115 -64
  129. package/src/components/watermark/QueryBuilderWatermark.tsx +60 -19
  130. package/src/stores/QueryBuilderConstantsState.ts +12 -0
  131. package/src/stores/QueryBuilder_LegendApplicationPlugin_Extension.ts +39 -1
  132. package/src/stores/QueryLoaderState.ts +64 -12
  133. package/src/stores/watermark/QueryBuilderWatermarkState.ts +2 -12
@@ -14,7 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { useCallback } from 'react';
17
+ import {
18
+ useCallback,
19
+ useEffect,
20
+ useRef,
21
+ useState,
22
+ type ChangeEvent,
23
+ } from 'react';
18
24
  import {
19
25
  clsx,
20
26
  Dialog,
@@ -26,6 +32,7 @@ import {
26
32
  ModalBody,
27
33
  ModalFooter,
28
34
  ModalFooterButton,
35
+ InputWithInlineValidation,
29
36
  } from '@finos/legend-art';
30
37
  import { observer } from 'mobx-react-lite';
31
38
  import {
@@ -301,6 +308,8 @@ const DerivedPropertyExpressionEditor = observer(
301
308
  export const QueryBuilderPropertyExpressionEditor = observer(
302
309
  (props: { propertyExpressionState: QueryBuilderPropertyExpressionState }) => {
303
310
  const { propertyExpressionState } = props;
311
+ const applicationStore =
312
+ propertyExpressionState.queryBuilderState.applicationStore;
304
313
  const handleClose = (): void =>
305
314
  propertyExpressionState.setIsEditingDerivedProperty(false);
306
315
  const isParameterCompatibleWithDerivedProperty = (
@@ -334,7 +343,9 @@ export const QueryBuilderPropertyExpressionEditor = observer(
334
343
  }}
335
344
  >
336
345
  <Modal
337
- darkMode={true}
346
+ darkMode={
347
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
348
+ }
338
349
  className="editor-modal query-builder-property-editor"
339
350
  >
340
351
  <ModalHeader title="Derived Property" />
@@ -368,6 +379,72 @@ export const QueryBuilderPropertyExpressionEditor = observer(
368
379
  },
369
380
  );
370
381
 
382
+ export const QueryBuilderEditablePropertyName = observer(
383
+ (props: {
384
+ columnName: string;
385
+ changeColumnName?:
386
+ | ((event: ChangeEvent<HTMLInputElement>) => void)
387
+ | undefined;
388
+ error: string | undefined;
389
+ title: string;
390
+ }) => {
391
+ const { columnName, changeColumnName, error, title } = props;
392
+
393
+ const [isEditingColumnName, setIsEditingColumnName] = useState(false);
394
+ const columnNameInputRef = useRef<HTMLInputElement>(null);
395
+
396
+ useEffect(() => {
397
+ if (isEditingColumnName) {
398
+ columnNameInputRef.current?.focus();
399
+ }
400
+ }, [isEditingColumnName, columnNameInputRef]);
401
+
402
+ return isEditingColumnName ? (
403
+ <div className="query-builder__property__name__editor">
404
+ <InputWithInlineValidation
405
+ className="query-builder__property__name__editor__input input-group__input"
406
+ spellCheck={false}
407
+ value={columnName}
408
+ onChange={changeColumnName}
409
+ onKeyDown={(event: React.KeyboardEvent<HTMLInputElement>) => {
410
+ if (event.key === 'Enter') {
411
+ setIsEditingColumnName(false);
412
+ }
413
+ }}
414
+ onBlur={() => {
415
+ setIsEditingColumnName(false);
416
+ }}
417
+ error={error}
418
+ ref={columnNameInputRef}
419
+ draggable={true}
420
+ onDragStart={(e: React.DragEvent<HTMLInputElement>) => {
421
+ // The below 2 lines are to allow dragging to select text in the input instead of
422
+ // dragging the draggable element containing the input.
423
+ e.preventDefault();
424
+ e.stopPropagation();
425
+ }}
426
+ />
427
+ </div>
428
+ ) : (
429
+ <div className="query-builder__property__name__display" title={title}>
430
+ <span
431
+ className={clsx('query-builder__property__name__display__content', {
432
+ 'query-builder__property__name__display__content--error': error,
433
+ 'editable-value': changeColumnName,
434
+ })}
435
+ onClick={() => {
436
+ if (changeColumnName) {
437
+ setIsEditingColumnName(true);
438
+ }
439
+ }}
440
+ >
441
+ {columnName}
442
+ </span>
443
+ </div>
444
+ );
445
+ },
446
+ );
447
+
371
448
  export const QueryBuilderPropertyExpressionBadge = observer(
372
449
  (props: {
373
450
  columnName?: string;
@@ -375,14 +452,14 @@ export const QueryBuilderPropertyExpressionBadge = observer(
375
452
  onPropertyExpressionChange: (
376
453
  node: QueryBuilderExplorerTreePropertyNodeData,
377
454
  ) => void;
378
- setIsEditingColumnName?: (isEditing: boolean) => void;
379
- error?: boolean | undefined;
455
+ changeColumnName?: (event: ChangeEvent<HTMLInputElement>) => void;
456
+ error?: string | undefined;
380
457
  }) => {
381
458
  const {
382
459
  columnName,
383
460
  propertyExpressionState,
384
461
  onPropertyExpressionChange,
385
- setIsEditingColumnName,
462
+ changeColumnName,
386
463
  error,
387
464
  } = props;
388
465
  const type =
@@ -446,26 +523,12 @@ export const QueryBuilderPropertyExpressionBadge = observer(
446
523
  },
447
524
  )}
448
525
  >
449
- <div
450
- className="query-builder-property-expression-badge__property"
526
+ <QueryBuilderEditablePropertyName
527
+ columnName={columnName ?? propertyExpressionState.title}
528
+ changeColumnName={changeColumnName}
529
+ error={error}
451
530
  title={`${propertyExpressionState.title} - ${propertyExpressionState.path}`}
452
- >
453
- <span
454
- className={clsx(
455
- 'query-builder-property-expression-badge__property__content',
456
- {
457
- 'query-builder-property-expression-badge__property__content--error':
458
- error,
459
- 'editable-value': !!setIsEditingColumnName,
460
- },
461
- )}
462
- onClick={() => {
463
- setIsEditingColumnName?.(true);
464
- }}
465
- >
466
- {columnName ?? propertyExpressionState.title}
467
- </span>
468
- </div>
531
+ />
469
532
  {hasDerivedPropertyInExpression && (
470
533
  <button
471
534
  className={clsx(
@@ -49,6 +49,7 @@ import {
49
49
  type PackageableElementOption,
50
50
  } from '@finos/legend-lego/graph-editor';
51
51
  import { MilestoningParametersEditor } from './explorer/QueryBuilderMilestoningEditor.js';
52
+ import type { QueryBuilder_LegendApplicationPlugin_Extension } from '../stores/QueryBuilder_LegendApplicationPlugin_Extension.js';
52
53
 
53
54
  export const getParameterValue = (
54
55
  parameter: ValueSpecification | undefined,
@@ -602,6 +603,22 @@ export const QueryBuilderSidebar = observer(
602
603
  children: React.ReactNode;
603
604
  }) => {
604
605
  const { queryBuilderState, children } = props;
606
+ const applicationStore = useApplicationStore();
607
+ const extraTemplateQueryPanelContentRenderer =
608
+ applicationStore.pluginManager
609
+ .getApplicationPlugins()
610
+ .flatMap(
611
+ (plugin) =>
612
+ (
613
+ plugin as QueryBuilder_LegendApplicationPlugin_Extension
614
+ ).getExtraTemplateQueryPanelContentRenderer?.() ?? [],
615
+ );
616
+ const templateQueryPanelContentTab =
617
+ extraTemplateQueryPanelContentRenderer[0] ? (
618
+ extraTemplateQueryPanelContentRenderer[0](queryBuilderState)
619
+ ) : (
620
+ <></>
621
+ );
605
622
 
606
623
  return (
607
624
  <div
@@ -620,6 +637,9 @@ export const QueryBuilderSidebar = observer(
620
637
  )}
621
638
  </div>
622
639
  </div>
640
+ <div className="query-builder__template-query">
641
+ {templateQueryPanelContentTab}
642
+ </div>
623
643
  <div className="query-builder__side-bar__content">{children}</div>
624
644
  </div>
625
645
  );
@@ -71,7 +71,9 @@ export const QueryBuilderTextEditor = observer(
71
71
  }}
72
72
  >
73
73
  <Modal
74
- darkMode={true}
74
+ darkMode={
75
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
76
+ }
75
77
  className={clsx('editor-modal query-builder-text-mode__modal', {
76
78
  'query-builder-text-mode__modal--has-error': Boolean(
77
79
  queryTextEditorState.parserError,
@@ -135,13 +137,13 @@ export const QueryBuilderTextEditor = observer(
135
137
  text="Discard Changes"
136
138
  />
137
139
  )}
138
- <button
139
- className="btn btn--dark"
140
+ <ModalFooterButton
140
141
  onClick={close}
141
142
  disabled={
142
143
  Boolean(queryTextEditorState.parserError) ||
143
144
  queryBuilderState.textEditorState.closingQueryState.isInProgress
144
145
  }
146
+ type="secondary"
145
147
  >
146
148
  {queryBuilderState.textEditorState.closingQueryState
147
149
  .isInProgress ? (
@@ -154,7 +156,7 @@ export const QueryBuilderTextEditor = observer(
154
156
  ) : (
155
157
  <> Close </>
156
158
  )}
157
- </button>
159
+ </ModalFooterButton>
158
160
  </ModalFooter>
159
161
  </Modal>
160
162
  </Dialog>