@finos/legend-query-builder 0.6.17 → 0.6.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +19 -4
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderConstantExpressionPanel.js +1 -1
  5. package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
  6. package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
  7. package/lib/components/QueryBuilderTextEditor.js +6 -4
  8. package/lib/components/QueryBuilderTextEditor.js.map +1 -1
  9. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  10. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +1 -1
  11. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  12. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  13. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +9 -2
  14. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  15. package/lib/index.css +2 -2
  16. package/lib/index.css.map +1 -1
  17. package/lib/package.json +3 -3
  18. package/lib/stores/QueryBuilderTextEditorState.d.ts +2 -1
  19. package/lib/stores/QueryBuilderTextEditorState.d.ts.map +1 -1
  20. package/lib/stores/QueryBuilderTextEditorState.js +4 -1
  21. package/lib/stores/QueryBuilderTextEditorState.js.map +1 -1
  22. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +2 -0
  23. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  24. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +22 -0
  25. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  26. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.d.ts +4 -4
  27. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.d.ts.map +1 -1
  28. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.js +1 -1
  29. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.js.map +1 -1
  30. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  31. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +3 -1
  32. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  33. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
  34. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js +1 -0
  35. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  36. package/package.json +10 -10
  37. package/src/components/QueryBuilder.tsx +54 -2
  38. package/src/components/QueryBuilderConstantExpressionPanel.tsx +1 -1
  39. package/src/components/QueryBuilderTextEditor.tsx +19 -2
  40. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +3 -3
  41. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +20 -0
  42. package/src/stores/QueryBuilderTextEditorState.ts +6 -0
  43. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +27 -0
  44. package/src/stores/fetch-structure/tds/QueryResultSetModifierState.ts +6 -6
  45. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +5 -4
  46. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +1 -0
@@ -428,6 +428,11 @@ export class QueryBuilderTDSState
428
428
  changeEntry(this.projectionColumns, oldVal, newVal);
429
429
  }
430
430
 
431
+ removeAllColumns(): void {
432
+ this.projectionColumns = [];
433
+ this.aggregationState.columns = [];
434
+ }
435
+
431
436
  removeColumn(val: QueryBuilderProjectionColumnState): void {
432
437
  deleteEntry(this.projectionColumns, val);
433
438
 
@@ -603,6 +608,28 @@ export class QueryBuilderTDSState
603
608
  });
604
609
  }
605
610
 
611
+ checkBeforeClearingColumns(onChange: () => void): void {
612
+ this.queryBuilderState.applicationStore.setActionAlertInfo({
613
+ message:
614
+ 'You will be clearing all projection columns. Do you still want to proceed?',
615
+ type: ActionAlertType.CAUTION,
616
+ actions: [
617
+ {
618
+ label: 'Proceed',
619
+ type: ActionAlertActionType.PROCEED_WITH_CAUTION,
620
+ handler: this.queryBuilderState.applicationStore.guardUnhandledError(
621
+ async () => onChange(),
622
+ ),
623
+ },
624
+ {
625
+ label: 'Cancel',
626
+ type: ActionAlertActionType.PROCEED,
627
+ default: true,
628
+ },
629
+ ],
630
+ });
631
+ }
632
+
606
633
  checkBeforeChangingImplementation(onChange: () => void): void {
607
634
  if (
608
635
  this.projectionColumns.length > 0
@@ -16,7 +16,6 @@
16
16
 
17
17
  import { action, computed, makeObservable, observable } from 'mobx';
18
18
  import type { QueryBuilderTDSState } from './QueryBuilderTDSState.js';
19
- import type { QueryBuilderProjectionColumnState } from './projection/QueryBuilderProjectionColumnState.js';
20
19
  import {
21
20
  addUniqueEntry,
22
21
  deleteEntry,
@@ -24,6 +23,7 @@ import {
24
23
  hashArray,
25
24
  } from '@finos/legend-shared';
26
25
  import { QUERY_BUILDER_HASH_STRUCTURE } from '../../../graphManager/QueryBuilderHashUtils.js';
26
+ import type { QueryBuilderTDSColumnState } from './QueryBuilderTDSColumnState.js';
27
27
 
28
28
  export enum COLUMN_SORT_TYPE {
29
29
  ASC = 'ASC',
@@ -31,10 +31,10 @@ export enum COLUMN_SORT_TYPE {
31
31
  }
32
32
 
33
33
  export class SortColumnState implements Hashable {
34
- columnState: QueryBuilderProjectionColumnState;
34
+ columnState: QueryBuilderTDSColumnState;
35
35
  sortType = COLUMN_SORT_TYPE.ASC;
36
36
 
37
- constructor(columnState: QueryBuilderProjectionColumnState) {
37
+ constructor(columnState: QueryBuilderTDSColumnState) {
38
38
  makeObservable(this, {
39
39
  columnState: observable,
40
40
  sortType: observable,
@@ -46,7 +46,7 @@ export class SortColumnState implements Hashable {
46
46
  this.columnState = columnState;
47
47
  }
48
48
 
49
- setColumnState(val: QueryBuilderProjectionColumnState): void {
49
+ setColumnState(val: QueryBuilderTDSColumnState): void {
50
50
  this.columnState = val;
51
51
  }
52
52
 
@@ -109,8 +109,8 @@ export class QueryResultSetModifierState implements Hashable {
109
109
  }
110
110
 
111
111
  updateSortColumns(): void {
112
- this.sortColumns = this.sortColumns.filter((e) =>
113
- this.tdsState.projectionColumns.includes(e.columnState),
112
+ this.sortColumns = this.sortColumns.filter((colState) =>
113
+ this.tdsState.tdsColumns.includes(colState.columnState),
114
114
  );
115
115
  }
116
116
 
@@ -263,6 +263,7 @@ export const processTDSTakeExpression = (
263
263
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT,
264
264
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY,
265
265
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_FILTER,
266
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.OLAP_GROUPBY,
266
267
  ]),
267
268
  `Can't process take() expression: only support take() in TDS expression`,
268
269
  );
@@ -311,6 +312,7 @@ export const processTDSDistinctExpression = (
311
312
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT,
312
313
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY,
313
314
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_FILTER,
315
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.OLAP_GROUPBY,
314
316
  ]),
315
317
  `Can't process distinct() expression: only support distinct() in TDS expression`,
316
318
  );
@@ -418,10 +420,9 @@ export const processTDSSortDirectionExpression = (
418
420
  const sortColumnName = extractNullableStringFromInstanceValue(
419
421
  guaranteeNonNullable(expression.parametersValues[0]),
420
422
  );
421
- const queryBuilderProjectionColumnState =
422
- projectionState.projectionColumns.find(
423
- (e) => e.columnName === sortColumnName,
424
- );
423
+ const queryBuilderProjectionColumnState = projectionState.tdsColumns.find(
424
+ (e) => e.columnName === sortColumnName,
425
+ );
425
426
  if (queryBuilderProjectionColumnState) {
426
427
  const sortColumnState = new SortColumnState(
427
428
  queryBuilderProjectionColumnState,
@@ -85,6 +85,7 @@ const appendResultSetModifier = (
85
85
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT,
86
86
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY,
87
87
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_FILTER,
88
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.OLAP_GROUPBY,
88
89
  ])
89
90
  ) {
90
91
  let currentExpression = func;