@finos/legend-query-builder 4.11.4 → 4.11.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/lib/components/QueryBuilder.js +1 -1
  2. package/lib/components/QueryBuilder.js.map +1 -1
  3. package/lib/components/execution-plan/SQLExecutionNodeViewer.js +1 -1
  4. package/lib/components/execution-plan/SQLExecutionNodeViewer.js.map +1 -1
  5. package/lib/components/{QueryBuilderResultPanel.d.ts → result/QueryBuilderResultPanel.d.ts} +1 -2
  6. package/lib/components/result/QueryBuilderResultPanel.d.ts.map +1 -0
  7. package/lib/components/result/QueryBuilderResultPanel.js +185 -0
  8. package/lib/components/result/QueryBuilderResultPanel.js.map +1 -0
  9. package/lib/components/result/tds/QueryBuilderTDSGridResult.d.ts +24 -0
  10. package/lib/components/result/tds/QueryBuilderTDSGridResult.d.ts.map +1 -0
  11. package/lib/components/result/tds/QueryBuilderTDSGridResult.js +140 -0
  12. package/lib/components/result/tds/QueryBuilderTDSGridResult.js.map +1 -0
  13. package/lib/components/result/tds/QueryBuilderTDSResultShared.d.ts +41 -0
  14. package/lib/components/result/tds/QueryBuilderTDSResultShared.d.ts.map +1 -0
  15. package/lib/components/result/tds/QueryBuilderTDSResultShared.js +465 -0
  16. package/lib/components/result/tds/QueryBuilderTDSResultShared.js.map +1 -0
  17. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.d.ts +24 -0
  18. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.d.ts.map +1 -0
  19. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js +47 -0
  20. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js.map +1 -0
  21. package/lib/index.css +2 -2
  22. package/lib/index.css.map +1 -1
  23. package/lib/package.json +1 -1
  24. package/lib/stores/QueryBuilderResultState.d.ts +5 -1
  25. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  26. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  27. package/package.json +2 -2
  28. package/src/components/QueryBuilder.tsx +1 -1
  29. package/src/components/execution-plan/SQLExecutionNodeViewer.tsx +1 -1
  30. package/src/components/result/QueryBuilderResultPanel.tsx +570 -0
  31. package/src/components/result/tds/QueryBuilderTDSGridResult.tsx +239 -0
  32. package/src/components/result/tds/QueryBuilderTDSResultShared.tsx +866 -0
  33. package/src/components/result/tds/QueryBuilderTDSSimpleGridResult.tsx +80 -0
  34. package/src/stores/QueryBuilderResultState.ts +12 -1
  35. package/tsconfig.json +4 -1
  36. package/lib/components/QueryBuilderResultPanel.d.ts.map +0 -1
  37. package/lib/components/QueryBuilderResultPanel.js +0 -633
  38. package/lib/components/QueryBuilderResultPanel.js.map +0 -1
  39. package/src/components/QueryBuilderResultPanel.tsx +0 -1412
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { clsx } from '@finos/legend-art';
18
+ import { observer } from 'mobx-react-lite';
19
+ import type { QueryBuilderState } from '../../../stores/QueryBuilderState.js';
20
+ import type { TDSExecutionResult } from '@finos/legend-graph';
21
+ import {
22
+ DataGrid,
23
+ type DataGridColumnDefinition,
24
+ } from '@finos/legend-lego/data-grid';
25
+ import {
26
+ getRowDataFromExecutionResult,
27
+ QueryResultCellRenderer,
28
+ } from './QueryBuilderTDSResultShared.js';
29
+
30
+ export const QueryBuilderTDSSimpleGridResult = observer(
31
+ (props: {
32
+ executionResult: TDSExecutionResult;
33
+ queryBuilderState: QueryBuilderState;
34
+ }) => {
35
+ const { executionResult, queryBuilderState } = props;
36
+ const resultState = queryBuilderState.resultState;
37
+ const colDefs = executionResult.result.columns.map(
38
+ (colName) =>
39
+ ({
40
+ minWidth: 50,
41
+ sortable: true,
42
+ resizable: true,
43
+ field: colName,
44
+ flex: 1,
45
+ cellRenderer: QueryResultCellRenderer,
46
+ cellRendererParams: {
47
+ resultState: resultState,
48
+ tdsExecutionResult: executionResult,
49
+ },
50
+ }) as DataGridColumnDefinition,
51
+ );
52
+
53
+ return (
54
+ <div className="query-builder__result__values__table">
55
+ <div
56
+ className={clsx(
57
+ 'ag-theme-balham-dark query-builder__result__tds-grid',
58
+ )}
59
+ >
60
+ <DataGrid
61
+ rowData={getRowDataFromExecutionResult(executionResult)}
62
+ gridOptions={{
63
+ suppressScrollOnNewData: true,
64
+ getRowId: (data) => data.data.rowNumber,
65
+ rowSelection: 'multiple',
66
+ }}
67
+ // NOTE: when column definition changed, we need to force refresh the cell to make sure the cell renderer is updated
68
+ // See https://stackoverflow.com/questions/56341073/how-to-refresh-an-ag-grid-when-a-change-occurs-inside-a-custom-cell-renderer-com
69
+ onRowDataUpdated={(params) => {
70
+ params.api.refreshCells({ force: true });
71
+ }}
72
+ suppressFieldDotNotation={true}
73
+ suppressContextMenu={false}
74
+ columnDefs={colDefs}
75
+ />
76
+ </div>
77
+ </div>
78
+ );
79
+ },
80
+ );
@@ -52,13 +52,24 @@ import type { DataGridColumnState } from '@finos/legend-lego/data-grid';
52
52
 
53
53
  export const DEFAULT_LIMIT = 1000;
54
54
 
55
+ export type QueryBuilderTDSResultCellDataType =
56
+ | string
57
+ | number
58
+ | boolean
59
+ | null
60
+ | undefined;
61
+
62
+ export interface QueryBuilderTDSRowDataType {
63
+ [key: string]: QueryBuilderTDSResultCellDataType;
64
+ }
65
+
55
66
  export interface ExportDataInfo {
56
67
  contentType: ContentType;
57
68
  serializationFormat?: EXECUTION_SERIALIZATION_FORMAT | undefined;
58
69
  }
59
70
 
60
71
  export interface QueryBuilderTDSResultCellData {
61
- value: string | number | boolean | null | undefined;
72
+ value: QueryBuilderTDSResultCellDataType;
62
73
  columnName: string;
63
74
  coordinates: QueryBuilderTDSResultCellCoordinate;
64
75
  }
package/tsconfig.json CHANGED
@@ -217,7 +217,6 @@
217
217
  "./src/components/QueryBuilderNavigationBlocker.tsx",
218
218
  "./src/components/QueryBuilderParametersPanel.tsx",
219
219
  "./src/components/QueryBuilderPropertyExpressionEditor.tsx",
220
- "./src/components/QueryBuilderResultPanel.tsx",
221
220
  "./src/components/QueryBuilderSideBar.tsx",
222
221
  "./src/components/QueryBuilderTextEditor.tsx",
223
222
  "./src/components/QueryBuilderUnsupportedQueryEditor.tsx",
@@ -257,6 +256,10 @@
257
256
  "./src/components/fetch-structure/QueryBuilderTDSPanel.tsx",
258
257
  "./src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx",
259
258
  "./src/components/filter/QueryBuilderFilterPanel.tsx",
259
+ "./src/components/result/QueryBuilderResultPanel.tsx",
260
+ "./src/components/result/tds/QueryBuilderTDSGridResult.tsx",
261
+ "./src/components/result/tds/QueryBuilderTDSResultShared.tsx",
262
+ "./src/components/result/tds/QueryBuilderTDSSimpleGridResult.tsx",
260
263
  "./src/components/shared/BasicValueSpecificationEditor.tsx",
261
264
  "./src/components/shared/CustomDatePicker.tsx",
262
265
  "./src/components/shared/LambdaEditor.tsx",
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueryBuilderResultPanel.d.ts","sourceRoot":"","sources":["../../src/components/QueryBuilderResultPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA+BH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAmFxE,eAAO,MAAM,cAAc,QAAS,MAAM,KAAG,MAY5C,CAAC;AAmzBF,eAAO,MAAM,uBAAuB,WAC1B;IAAE,iBAAiB,EAAE,iBAAiB,CAAA;CAAE;;CAmcjD,CAAC"}