@finos/legend-query-builder 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -1
  2. package/lib/components/QueryBuilderConstantExpressionPanel.js +4 -3
  3. package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
  4. package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderParametersPanel.js +4 -3
  6. package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
  7. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  8. package/lib/components/shared/CustomDatePicker.js +3 -3
  9. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  10. package/lib/components/shared/QueryBuilderVariableSelector.d.ts +1 -0
  11. package/lib/components/shared/QueryBuilderVariableSelector.d.ts.map +1 -1
  12. package/lib/components/shared/QueryBuilderVariableSelector.js +6 -3
  13. package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -1
  14. package/lib/index.css +1 -17
  15. package/lib/index.css.map +1 -1
  16. package/lib/package.json +1 -1
  17. package/lib/stores/QueryBuilderState.d.ts +1 -0
  18. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  19. package/lib/stores/QueryBuilderState.js +8 -0
  20. package/lib/stores/QueryBuilderState.js.map +1 -1
  21. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +2 -1
  22. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  23. package/lib/stores/QueryBuilderValueSpecificationHelper.js +10 -1
  24. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  25. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +2 -1
  26. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
  27. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
  28. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts +2 -1
  29. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
  30. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +4 -0
  31. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  32. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +2 -1
  33. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  34. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +13 -0
  35. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  36. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts +2 -1
  37. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts.map +1 -1
  38. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +9 -1
  39. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
  40. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts +2 -1
  41. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
  42. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +4 -0
  43. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  44. package/lib/stores/filter/QueryBuilderFilterState.d.ts +2 -1
  45. package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
  46. package/lib/stores/filter/QueryBuilderFilterState.js +9 -1
  47. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  48. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts +2 -1
  49. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -1
  50. package/lib/stores/milestoning/QueryBuilderMilestoningState.js +10 -0
  51. package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -1
  52. package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts +2 -1
  53. package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts.map +1 -1
  54. package/lib/stores/watermark/QueryBuilderWatermarkState.js +6 -0
  55. package/lib/stores/watermark/QueryBuilderWatermarkState.js.map +1 -1
  56. package/package.json +3 -3
  57. package/src/components/QueryBuilderConstantExpressionPanel.tsx +8 -1
  58. package/src/components/QueryBuilderParametersPanel.tsx +8 -1
  59. package/src/components/shared/CustomDatePicker.tsx +3 -2
  60. package/src/components/shared/QueryBuilderVariableSelector.tsx +10 -3
  61. package/src/stores/QueryBuilderState.ts +11 -0
  62. package/src/stores/QueryBuilderValueSpecificationHelper.ts +13 -0
  63. package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +2 -0
  64. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +14 -2
  65. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +19 -2
  66. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +13 -0
  67. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +12 -0
  68. package/src/stores/filter/QueryBuilderFilterState.ts +13 -0
  69. package/src/stores/milestoning/QueryBuilderMilestoningState.ts +11 -0
  70. package/src/stores/watermark/QueryBuilderWatermarkState.ts +8 -0
@@ -31,6 +31,7 @@ import {
31
31
  ActionState,
32
32
  type Hashable,
33
33
  hashArray,
34
+ isNonNullable,
34
35
  } from '@finos/legend-shared';
35
36
  import type { QueryBuilderExplorerTreeDragSource } from '../explorer/QueryBuilderExplorerState.js';
36
37
  import { QueryBuilderPropertyExpressionState } from '../QueryBuilderPropertyEditorState.js';
@@ -39,6 +40,7 @@ import {
39
40
  type ExecutionResult,
40
41
  type AbstractPropertyExpression,
41
42
  type ValueSpecification,
43
+ type VariableExpression,
42
44
  observe_ValueSpecification,
43
45
  } from '@finos/legend-graph';
44
46
  import { DEFAULT_LAMBDA_VARIABLE_NAME } from '../QueryBuilderConfig.js';
@@ -51,6 +53,7 @@ import {
51
53
  import type { QueryBuilderFilterOperator } from './QueryBuilderFilterOperator.js';
52
54
  import { QUERY_BUILDER_GROUP_OPERATION } from '../QueryBuilderGroupOperationHelper.js';
53
55
  import { QUERY_BUILDER_HASH_STRUCTURE } from '../../graphManager/QueryBuilderHashUtils.js';
56
+ import { isValueExpressionReferencesinValue } from '../QueryBuilderValueSpecificationHelper.js';
54
57
 
55
58
  export enum QUERY_BUILDER_FILTER_DND_TYPE {
56
59
  GROUP_CONDITION = 'GROUP_CONDITION',
@@ -791,6 +794,16 @@ export class QueryBuilderFilterState
791
794
  Array.from(this.nodes.values()).forEach((node) => node.setIsOpen(true));
792
795
  }
793
796
 
797
+ isVariableUsed(variable: VariableExpression): boolean {
798
+ return Boolean(
799
+ Array.from(this.nodes.values())
800
+ .filter(filterByType(QueryBuilderFilterTreeConditionNodeData))
801
+ .map((node) => node.condition.value)
802
+ .filter(isNonNullable)
803
+ .find((value) => isValueExpressionReferencesinValue(variable, value)),
804
+ );
805
+ }
806
+
794
807
  get hashCode(): string {
795
808
  return hashArray([
796
809
  QUERY_BUILDER_HASH_STRUCTURE.FILTER_STATE,
@@ -33,6 +33,7 @@ import {
33
33
  import { action, computed, makeObservable, observable } from 'mobx';
34
34
  import { QUERY_BUILDER_HASH_STRUCTURE } from '../../graphManager/QueryBuilderHashUtils.js';
35
35
  import type { QueryBuilderState } from '../QueryBuilderState.js';
36
+ import { isValueExpressionReferencesinValue } from '../QueryBuilderValueSpecificationHelper.js';
36
37
  import { LambdaParameterState } from '../shared/LambdaParameterState.js';
37
38
  import { QueryBuilderBitemporalMilestoningImplementation } from './QueryBuilderBitemporalMilestoningImplementation.js';
38
39
  import { QueryBuilderBusinessTemporalMilestoningImplementation } from './QueryBuilderBusinessTemporalMilestoningImplementation.js';
@@ -173,6 +174,16 @@ export class QueryBuilderMilestoningState implements Hashable {
173
174
  return milestoningParameter;
174
175
  }
175
176
 
177
+ isVariableUsed(variable: VariableExpression): boolean {
178
+ const usedInBusiness = this.businessDate
179
+ ? isValueExpressionReferencesinValue(variable, this.businessDate)
180
+ : false;
181
+ const usedInProcessingDate = this.processingDate
182
+ ? isValueExpressionReferencesinValue(variable, this.processingDate)
183
+ : false;
184
+ return usedInBusiness || usedInProcessingDate;
185
+ }
186
+
176
187
  get hashCode(): string {
177
188
  return hashArray([
178
189
  QUERY_BUILDER_HASH_STRUCTURE.MILESTONING_STATE,
@@ -16,6 +16,7 @@
16
16
 
17
17
  import {
18
18
  type ValueSpecification,
19
+ type VariableExpression,
19
20
  observe_ValueSpecification,
20
21
  GenericTypeExplicitReference,
21
22
  GenericType,
@@ -26,6 +27,7 @@ import { type Hashable, hashArray } from '@finos/legend-shared';
26
27
  import { makeObservable, observable, action, computed } from 'mobx';
27
28
  import { QUERY_BUILDER_HASH_STRUCTURE } from '../../graphManager/QueryBuilderHashUtils.js';
28
29
  import type { QueryBuilderState } from '../QueryBuilderState.js';
30
+ import { isValueExpressionReferencesinValue } from '../QueryBuilderValueSpecificationHelper.js';
29
31
 
30
32
  export class QueryBuilderWatermarkState implements Hashable {
31
33
  readonly queryBuilderState: QueryBuilderState;
@@ -78,6 +80,12 @@ export class QueryBuilderWatermarkState implements Hashable {
78
80
  : undefined;
79
81
  }
80
82
 
83
+ isVariableUsed(variable: VariableExpression): boolean {
84
+ return this.value
85
+ ? isValueExpressionReferencesinValue(variable, this.value)
86
+ : false;
87
+ }
88
+
81
89
  get hashCode(): string {
82
90
  return hashArray([
83
91
  QUERY_BUILDER_HASH_STRUCTURE.WATERMARK_STATE,