@finos/legend-query-builder 2.1.2 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/{src/stores/QueryBuilderBootstraper.ts → lib/application/QueryBuilderDocumentation.d.ts} +6 -8
  2. package/lib/application/QueryBuilderDocumentation.d.ts.map +1 -0
  3. package/lib/application/QueryBuilderDocumentation.js +23 -0
  4. package/lib/application/QueryBuilderDocumentation.js.map +1 -0
  5. package/lib/components/QueryBuilder.js +3 -2
  6. package/lib/components/QueryBuilder.js.map +1 -1
  7. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -1
  8. package/lib/components/QueryBuilderConstantExpressionPanel.js +3 -2
  9. package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
  10. package/lib/components/QueryBuilderDiffPanel.d.ts.map +1 -1
  11. package/lib/components/QueryBuilderDiffPanel.js +9 -8
  12. package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
  13. package/lib/components/QueryBuilderParametersPanel.js +3 -2
  14. package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
  15. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  16. package/lib/components/QueryBuilderResultPanel.js +8 -7
  17. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  18. package/lib/components/QueryBuilderTextEditor.js +3 -2
  19. package/lib/components/QueryBuilderTextEditor.js.map +1 -1
  20. package/lib/components/QueryBuilder_LegendApplicationPlugin.d.ts +2 -1
  21. package/lib/components/QueryBuilder_LegendApplicationPlugin.d.ts.map +1 -1
  22. package/lib/components/QueryBuilder_LegendApplicationPlugin.js +8 -0
  23. package/lib/components/QueryBuilder_LegendApplicationPlugin.js.map +1 -1
  24. package/lib/{stores/QueryBuilderBootstraper.js → components/execution-plan/ExecutionPlanViewer.d.ts} +12 -6
  25. package/lib/components/execution-plan/ExecutionPlanViewer.d.ts.map +1 -0
  26. package/lib/components/execution-plan/ExecutionPlanViewer.js +182 -0
  27. package/lib/components/execution-plan/ExecutionPlanViewer.js.map +1 -0
  28. package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts +31 -0
  29. package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts.map +1 -0
  30. package/lib/components/execution-plan/SQLExecutionNodeViewer.js +32 -0
  31. package/lib/components/execution-plan/SQLExecutionNodeViewer.js.map +1 -0
  32. package/lib/components/explorer/QueryBuilderPropertySearchPanel.js +2 -2
  33. package/lib/components/explorer/QueryBuilderPropertySearchPanel.js.map +1 -1
  34. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -1
  35. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +4 -4
  36. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
  37. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  38. package/lib/components/shared/BasicValueSpecificationEditor.js +2 -3
  39. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  40. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  41. package/lib/components/shared/LambdaEditor.js +20 -19
  42. package/lib/components/shared/LambdaEditor.js.map +1 -1
  43. package/lib/index.css +1 -17
  44. package/lib/index.css.map +1 -1
  45. package/lib/index.d.ts +3 -2
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/index.js +3 -2
  48. package/lib/index.js.map +1 -1
  49. package/lib/package.json +9 -17
  50. package/lib/stores/QueryBuilderResultState.d.ts +1 -1
  51. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  52. package/lib/stores/QueryBuilderResultState.js +2 -1
  53. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  54. package/lib/stores/execution-plan/ExecutionPlanState.d.ts +61 -0
  55. package/lib/stores/execution-plan/ExecutionPlanState.d.ts.map +1 -0
  56. package/lib/stores/execution-plan/ExecutionPlanState.js +118 -0
  57. package/lib/stores/execution-plan/ExecutionPlanState.js.map +1 -0
  58. package/lib/stores/explorer/QueryBuilderPropertySearchState.d.ts +3 -4
  59. package/lib/stores/explorer/QueryBuilderPropertySearchState.d.ts.map +1 -1
  60. package/lib/stores/explorer/QueryBuilderPropertySearchState.js +3 -4
  61. package/lib/stores/explorer/QueryBuilderPropertySearchState.js.map +1 -1
  62. package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
  63. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  64. package/package.json +16 -24
  65. package/{lib/stores/QueryBuilderBootstraper.d.ts → src/application/QueryBuilderDocumentation.ts} +8 -2
  66. package/src/components/QueryBuilder.tsx +2 -2
  67. package/src/components/QueryBuilderConstantExpressionPanel.tsx +2 -2
  68. package/src/components/QueryBuilderDiffPanel.tsx +16 -19
  69. package/src/components/QueryBuilderParametersPanel.tsx +2 -2
  70. package/src/components/QueryBuilderResultPanel.tsx +14 -14
  71. package/src/components/QueryBuilderTextEditor.tsx +4 -4
  72. package/src/components/QueryBuilder_LegendApplicationPlugin.ts +10 -0
  73. package/src/components/execution-plan/ExecutionPlanViewer.tsx +543 -0
  74. package/src/components/execution-plan/SQLExecutionNodeViewer.tsx +46 -0
  75. package/src/components/explorer/QueryBuilderPropertySearchPanel.tsx +2 -2
  76. package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +12 -18
  77. package/src/components/shared/BasicValueSpecificationEditor.tsx +2 -2
  78. package/src/components/shared/LambdaEditor.tsx +27 -25
  79. package/src/index.ts +3 -2
  80. package/src/stores/QueryBuilderResultState.ts +2 -1
  81. package/src/stores/execution-plan/ExecutionPlanState.ts +153 -0
  82. package/src/stores/explorer/QueryBuilderPropertySearchState.ts +4 -4
  83. package/src/stores/filter/QueryBuilderFilterState.ts +2 -0
  84. package/tsconfig.json +4 -1
  85. package/lib/stores/QueryBuilderBootstraper.d.ts.map +0 -1
  86. package/lib/stores/QueryBuilderBootstraper.js.map +0 -1
@@ -13,5 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const setupQueryBuilderUILibrary: () => Promise<void>;
17
- //# sourceMappingURL=QueryBuilderBootstraper.d.ts.map
16
+
17
+ export enum QUERY_BUILDER_DOCUMENTATION_KEY {
18
+ TUTORIAL_QUERY_BUILDER = 'tutorial.query.builder',
19
+
20
+ // questions
21
+ QUESTION_HOW_TO_ADD_PARAMETERS_TO_QUERY = 'question.how-to-add-parameters-to-query',
22
+ QUESTION_HOW_TO_ADD_CONSTANTS_TO_QUERY = 'question.how-to-add-constants-to-query',
23
+ }
@@ -56,7 +56,6 @@ import {
56
56
  BackdropContainer,
57
57
  useApplicationStore,
58
58
  useCommands,
59
- LEGEND_APPLICATION_DOCUMENTATION_KEY,
60
59
  } from '@finos/legend-application';
61
60
  import { QueryBuilderParametersPanel } from './QueryBuilderParametersPanel.js';
62
61
  import { QueryBuilderFunctionsExplorerPanel } from './explorer/QueryBuilderFunctionsExplorerPanel.js';
@@ -70,6 +69,7 @@ import { QueryBuilderConstantExpressionPanel } from './QueryBuilderConstantExpre
70
69
  import { QueryBuilder_LegendApplicationPlugin } from './QueryBuilder_LegendApplicationPlugin.js';
71
70
  import { QUERY_BUILDER_SETTING_KEY } from '../application/QueryBuilderSetting.js';
72
71
  import { QUERY_BUILDER_COMPONENT_ELEMENT_ID } from './QueryBuilderComponentElement.js';
72
+ import { QUERY_BUILDER_DOCUMENTATION_KEY } from '../application/QueryBuilderDocumentation.js';
73
73
 
74
74
  const QueryBuilderStatusBar = observer(
75
75
  (props: { queryBuilderState: QueryBuilderState }) => {
@@ -253,7 +253,7 @@ export const QueryBuilder = observer(
253
253
  const toggleAssistant = (): void =>
254
254
  applicationStore.assistantService.toggleAssistant();
255
255
  const queryDocEntry = applicationStore.documentationService.getDocEntry(
256
- LEGEND_APPLICATION_DOCUMENTATION_KEY.TUTORIAL_QUERY_BUILDER,
256
+ QUERY_BUILDER_DOCUMENTATION_KEY.TUTORIAL_QUERY_BUILDER,
257
257
  );
258
258
  const openQueryTutorial = (): void => {
259
259
  if (queryDocEntry?.url) {
@@ -18,7 +18,6 @@ import {
18
18
  type PackageableElementOption,
19
19
  buildElementOption,
20
20
  getPackageableElementOptionFormatter,
21
- LEGEND_APPLICATION_DOCUMENTATION_KEY,
22
21
  } from '@finos/legend-application';
23
22
  import {
24
23
  BlankPanelPlaceholder,
@@ -51,6 +50,7 @@ import { variableExpression_setName } from '../stores/shared/ValueSpecificationM
51
50
  import { BasicValueSpecificationEditor } from './shared/BasicValueSpecificationEditor.js';
52
51
  import { VariableViewer } from './shared/QueryBuilderVariableSelector.js';
53
52
  import { QUERY_BUILDER_TEST_ID } from '../application/QueryBuilderTesting.js';
53
+ import { QUERY_BUILDER_DOCUMENTATION_KEY } from '../application/QueryBuilderDocumentation.js';
54
54
 
55
55
  // NOTE: We currently only allow constant variables for primitive types of multiplicity ONE.
56
56
  // This is why we don't show multiplicity in the editor.
@@ -203,7 +203,7 @@ export const QueryBuilderConstantExpressionPanel = observer(
203
203
  const varNames = queryBuilderState.allVariableNames;
204
204
  const seeDocumentation = (): void =>
205
205
  queryBuilderState.applicationStore.assistantService.openDocumentationEntry(
206
- LEGEND_APPLICATION_DOCUMENTATION_KEY.QUESTION_HOW_TO_ADD_CONSTANTS_TO_QUERY,
206
+ QUERY_BUILDER_DOCUMENTATION_KEY.QUESTION_HOW_TO_ADD_CONSTANTS_TO_QUERY,
207
207
  );
208
208
  const addConstant = (): void => {
209
209
  if (!isReadOnly) {
@@ -15,19 +15,12 @@
15
15
  */
16
16
 
17
17
  import {
18
- EDITOR_LANGUAGE,
19
- EDITOR_THEME,
18
+ CODE_EDITOR_LANGUAGE,
19
+ CODE_EDITOR_THEME,
20
20
  TAB_SIZE,
21
21
  useApplicationStore,
22
22
  } from '@finos/legend-application';
23
- import {
24
- getBaseTextEditorOptions,
25
- clsx,
26
- Dialog,
27
- disposeDiffEditor,
28
- useResizeDetector,
29
- Button,
30
- } from '@finos/legend-art';
23
+ import { clsx, Dialog, useResizeDetector, Button } from '@finos/legend-art';
31
24
  import { observer } from 'mobx-react-lite';
32
25
  import { editor as monacoEditorAPI } from 'monaco-editor';
33
26
  import { useEffect, useRef, useState } from 'react';
@@ -36,10 +29,14 @@ import {
36
29
  QueryBuilderDiffViewMode,
37
30
  } from '../stores/QueryBuilderChangeDetectionState.js';
38
31
  import { pruneSourceInformation } from '@finos/legend-graph';
32
+ import {
33
+ disposeDiffCodeEditor,
34
+ getBaseCodeEditorOptions,
35
+ } from '@finos/legend-lego/code-editor';
39
36
 
40
37
  const TextDiffView = observer(
41
38
  (props: {
42
- language: EDITOR_LANGUAGE;
39
+ language: CODE_EDITOR_LANGUAGE;
43
40
  from?: string | undefined;
44
41
  to?: string | undefined;
45
42
  }) => {
@@ -63,11 +60,11 @@ const TextDiffView = observer(
63
60
  if (!editor && editorRef.current) {
64
61
  const element = editorRef.current;
65
62
  const _editor = monacoEditorAPI.createDiffEditor(element, {
66
- ...getBaseTextEditorOptions(),
63
+ ...getBaseCodeEditorOptions(),
67
64
  theme: applicationStore.layoutService
68
65
  .TEMPORARY__isLightColorThemeEnabled
69
- ? EDITOR_THEME.TEMPORARY__VSCODE_LIGHT
70
- : EDITOR_THEME.LEGEND,
66
+ ? CODE_EDITOR_THEME.TEMPORARY__VSCODE_LIGHT
67
+ : CODE_EDITOR_THEME.LEGEND,
71
68
  readOnly: true,
72
69
  wordWrap: 'on',
73
70
  });
@@ -87,15 +84,15 @@ const TextDiffView = observer(
87
84
  useEffect(
88
85
  () => (): void => {
89
86
  if (editor) {
90
- disposeDiffEditor(editor);
87
+ disposeDiffCodeEditor(editor);
91
88
  }
92
89
  },
93
90
  [editor],
94
91
  ); // dispose editor
95
92
 
96
93
  return (
97
- <div ref={ref} className="text-editor__container">
98
- <div className="text-editor__body" ref={editorRef} />
94
+ <div ref={ref} className="code-editor__container">
95
+ <div className="code-editor__body" ref={editorRef} />
99
96
  </div>
100
97
  );
101
98
  },
@@ -153,14 +150,14 @@ export const QueryBuilderDiffViewPanel = observer(
153
150
  <div className="query-builder__diff-panel__content">
154
151
  {diffViewState.mode === QueryBuilderDiffViewMode.GRAMMAR && (
155
152
  <TextDiffView
156
- language={EDITOR_LANGUAGE.PURE}
153
+ language={CODE_EDITOR_LANGUAGE.PURE}
157
154
  from={fromGrammarText}
158
155
  to={toGrammarText}
159
156
  />
160
157
  )}
161
158
  {diffViewState.mode === QueryBuilderDiffViewMode.JSON && (
162
159
  <TextDiffView
163
- language={EDITOR_LANGUAGE.JSON}
160
+ language={CODE_EDITOR_LANGUAGE.JSON}
164
161
  from={JSON.stringify(
165
162
  {
166
163
  parameters: diffViewState.initialQuery.parameters
@@ -44,7 +44,6 @@ import {
44
44
  buildElementOption,
45
45
  getPackageableElementOptionFormatter,
46
46
  useApplicationStore,
47
- LEGEND_APPLICATION_DOCUMENTATION_KEY,
48
47
  } from '@finos/legend-application';
49
48
  import { generateEnumerableNameFromToken } from '@finos/legend-shared';
50
49
  import { DEFAULT_VARIABLE_NAME } from '../stores/QueryBuilderConfig.js';
@@ -53,6 +52,7 @@ import { LambdaParameterState } from '../stores/shared/LambdaParameterState.js';
53
52
  import { LambdaParameterValuesEditor } from './shared/LambdaParameterValuesEditor.js';
54
53
  import { VariableViewer } from './shared/QueryBuilderVariableSelector.js';
55
54
  import { QUERY_BUILDER_TEST_ID } from '../application/QueryBuilderTesting.js';
55
+ import { QUERY_BUILDER_DOCUMENTATION_KEY } from '../application/QueryBuilderDocumentation.js';
56
56
 
57
57
  type MultiplicityOption = { label: string; value: Multiplicity };
58
58
 
@@ -237,7 +237,7 @@ export const QueryBuilderParametersPanel = observer(
237
237
  );
238
238
  const seeDocumentation = (): void =>
239
239
  queryBuilderState.applicationStore.assistantService.openDocumentationEntry(
240
- LEGEND_APPLICATION_DOCUMENTATION_KEY.QUESTION_HOW_TO_ADD_PARAMETERS_TO_QUERY,
240
+ QUERY_BUILDER_DOCUMENTATION_KEY.QUESTION_HOW_TO_ADD_PARAMETERS_TO_QUERY,
241
241
  );
242
242
  const addParameter = (): void => {
243
243
  if (!isReadOnly && !queryBuilderState.isParameterSupportDisabled) {
@@ -14,8 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { AgGridReact } from '@ag-grid-community/react';
18
- import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
19
17
  import {
20
18
  BlankPanelContent,
21
19
  PanelLoadingIndicator,
@@ -47,10 +45,8 @@ import {
47
45
  import {
48
46
  ActionAlertActionType,
49
47
  ActionAlertType,
50
- EDITOR_LANGUAGE,
51
- ExecutionPlanViewer,
48
+ CODE_EDITOR_LANGUAGE,
52
49
  TAB_SIZE,
53
- TextInputEditor,
54
50
  useApplicationStore,
55
51
  } from '@finos/legend-application';
56
52
  import {
@@ -62,7 +58,6 @@ import {
62
58
  prettyCONSTName,
63
59
  } from '@finos/legend-shared';
64
60
  import { forwardRef, useState } from 'react';
65
- import type { CellMouseOverEvent } from '@ag-grid-community/core';
66
61
  import {
67
62
  QueryBuilderDerivationProjectionColumnState,
68
63
  QueryBuilderProjectionColumnState,
@@ -88,12 +83,18 @@ import {
88
83
  } from '../stores/shared/ValueSpecificationModifierHelper.js';
89
84
  import { PARAMETER_SUBMIT_ACTION } from '../stores/shared/LambdaParameterState.js';
90
85
  import { QUERY_BUILDER_TEST_ID } from '../application/QueryBuilderTesting.js';
86
+ import {
87
+ DataGrid,
88
+ type DataGridCellMouseOverEvent,
89
+ } from '@finos/legend-lego/data-grid';
90
+ import { CodeEditor } from '@finos/legend-lego/code-editor';
91
+ import { ExecutionPlanViewer } from './execution-plan/ExecutionPlanViewer.js';
91
92
 
92
93
  const QueryBuilderGridResultContextMenu = observer(
93
94
  forwardRef<
94
95
  HTMLDivElement,
95
96
  {
96
- event: CellMouseOverEvent | null;
97
+ event: DataGridCellMouseOverEvent | null;
97
98
  tdsState: QueryBuilderTDSState;
98
99
  }
99
100
  >(function QueryBuilderResultContextMenu(props, ref) {
@@ -330,7 +331,7 @@ const QueryBuilderGridResult = observer(
330
331
  const fetchStructureImplementation =
331
332
  queryBuilderState.fetchStructureState.implementation;
332
333
  const [cellDoubleClickedEvent, setCellDoubleClickedEvent] =
333
- useState<CellMouseOverEvent | null>(null);
334
+ useState<DataGridCellMouseOverEvent | null>(null);
334
335
  const columns = executionResult.result.columns;
335
336
  const rowData = executionResult.result.rows.map((_row, rowIdx) => {
336
337
  const row: PlainObject = {};
@@ -365,7 +366,7 @@ const QueryBuilderGridResult = observer(
365
366
  key={executionResult._UUID}
366
367
  className={clsx('ag-theme-balham-dark query-builder__result__tds-grid')}
367
368
  >
368
- <AgGridReact
369
+ <DataGrid
369
370
  rowData={rowData}
370
371
  gridOptions={{
371
372
  suppressScrollOnNewData: true,
@@ -373,7 +374,6 @@ const QueryBuilderGridResult = observer(
373
374
  return data.data.rowNumber as string;
374
375
  },
375
376
  }}
376
- modules={[ClientSideRowModelModule]}
377
377
  // NOTE: we use onCellMouseOver as a bit of a workaround
378
378
  // since we use the context menu so we want the user to be
379
379
  // able to right click any cell and have the context menu
@@ -412,16 +412,16 @@ const QueryBuilderResultValues = observer(
412
412
  );
413
413
  } else if (executionResult instanceof RawExecutionResult) {
414
414
  return (
415
- <TextInputEditor
416
- language={EDITOR_LANGUAGE.TEXT}
415
+ <CodeEditor
416
+ language={CODE_EDITOR_LANGUAGE.TEXT}
417
417
  inputValue={executionResult.value}
418
418
  isReadOnly={true}
419
419
  />
420
420
  );
421
421
  }
422
422
  return (
423
- <TextInputEditor
424
- language={EDITOR_LANGUAGE.JSON}
423
+ <CodeEditor
424
+ language={CODE_EDITOR_LANGUAGE.JSON}
425
425
  inputValue={JSON.stringify(
426
426
  extractExecutionResultValues(executionResult),
427
427
  null,
@@ -32,11 +32,11 @@ import type { QueryBuilderState } from '../stores/QueryBuilderState.js';
32
32
  import { QueryBuilderTextEditorMode } from '../stores/QueryBuilderTextEditorState.js';
33
33
  import { flowResult } from 'mobx';
34
34
  import {
35
- EDITOR_LANGUAGE,
36
- TextInputEditor,
35
+ CODE_EDITOR_LANGUAGE,
37
36
  useApplicationStore,
38
37
  } from '@finos/legend-application';
39
38
  import { LambdaEditor } from './shared/LambdaEditor.js';
39
+ import { CodeEditor } from '@finos/legend-lego/code-editor';
40
40
 
41
41
  export const QueryBuilderTextEditor = observer(
42
42
  (props: { queryBuilderState: QueryBuilderState }) => {
@@ -108,8 +108,8 @@ export const QueryBuilderTextEditor = observer(
108
108
  />
109
109
  )}
110
110
  {mode === QueryBuilderTextEditorMode.JSON && (
111
- <TextInputEditor
112
- language={EDITOR_LANGUAGE.JSON}
111
+ <CodeEditor
112
+ language={CODE_EDITOR_LANGUAGE.JSON}
113
113
  inputValue={queryTextEditorState.readOnlylambdaJson}
114
114
  isReadOnly={true}
115
115
  />
@@ -21,11 +21,13 @@ import {
21
21
  type SettingConfigurationEntry,
22
22
  type KeyedCommandConfigEntry,
23
23
  type LegendApplicationPluginManager,
24
+ type LegendApplicationSetup,
24
25
  } from '@finos/legend-application';
25
26
  import packageJson from '../../package.json';
26
27
  import { QUERY_BUILDER_SETTING_CONFIG } from '../application/QueryBuilderSetting.js';
27
28
  import { QUERY_BUILDER_COMMAND_CONFIG } from '../stores/QueryBuilderCommand.js';
28
29
  import type { QueryBuilderState } from '../stores/QueryBuilderState.js';
30
+ import { configureDataGridComponent } from '@finos/legend-lego/data-grid';
29
31
 
30
32
  export type CheckEntitlementEditorRender = (
31
33
  queryBuilderState: QueryBuilderState,
@@ -44,6 +46,14 @@ export class QueryBuilder_LegendApplicationPlugin extends LegendApplicationPlugi
44
46
  pluginManager.registerApplicationPlugin(this);
45
47
  }
46
48
 
49
+ override getExtraApplicationSetups(): LegendApplicationSetup[] {
50
+ return [
51
+ async (applicationStore) => {
52
+ configureDataGridComponent();
53
+ },
54
+ ];
55
+ }
56
+
47
57
  override getExtraKeyedCommandConfigEntries(): KeyedCommandConfigEntry[] {
48
58
  return collectKeyedCommandConfigEntriesFromConfig(
49
59
  QUERY_BUILDER_COMMAND_CONFIG,