@finos/legend-query-builder 4.14.96 → 4.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +2 -1
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderSideBar.js +4 -4
  6. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  7. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts.map +1 -1
  8. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js +2 -1
  9. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js.map +1 -1
  10. package/lib/components/data-cube/QueryBuilderDataCube.d.ts +22 -0
  11. package/lib/components/data-cube/QueryBuilderDataCube.d.ts.map +1 -0
  12. package/lib/components/data-cube/QueryBuilderDataCube.js +48 -0
  13. package/lib/components/data-cube/QueryBuilderDataCube.js.map +1 -0
  14. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +1 -1
  15. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  16. package/lib/components/filter/QueryBuilderFilterPanel.js +2 -2
  17. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  18. package/lib/components/result/QueryBuilderResultPanel.d.ts.map +1 -1
  19. package/lib/components/result/QueryBuilderResultPanel.js +6 -3
  20. package/lib/components/result/QueryBuilderResultPanel.js.map +1 -1
  21. package/lib/components/result/tds/QueryBuilderTDSGridResult.d.ts.map +1 -1
  22. package/lib/components/result/tds/QueryBuilderTDSGridResult.js +6 -7
  23. package/lib/components/result/tds/QueryBuilderTDSGridResult.js.map +1 -1
  24. package/lib/components/result/tds/QueryBuilderTDSResultShared.d.ts +2 -2
  25. package/lib/components/result/tds/QueryBuilderTDSResultShared.d.ts.map +1 -1
  26. package/lib/components/result/tds/QueryBuilderTDSResultShared.js +19 -155
  27. package/lib/components/result/tds/QueryBuilderTDSResultShared.js.map +1 -1
  28. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  29. package/lib/components/shared/BasicValueSpecificationEditor.js +5 -5
  30. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  31. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  32. package/lib/components/shared/CustomDatePicker.js +2 -2
  33. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  34. package/lib/components/workflows/ClassQueryBuilder.d.ts.map +1 -1
  35. package/lib/components/workflows/ClassQueryBuilder.js +3 -3
  36. package/lib/components/workflows/ClassQueryBuilder.js.map +1 -1
  37. package/lib/components/workflows/MappingQueryBuilder.d.ts.map +1 -1
  38. package/lib/components/workflows/MappingQueryBuilder.js +3 -3
  39. package/lib/components/workflows/MappingQueryBuilder.js.map +1 -1
  40. package/lib/graph-manager/QueryBuilderConfig.d.ts +5 -1
  41. package/lib/graph-manager/QueryBuilderConfig.d.ts.map +1 -1
  42. package/lib/graph-manager/QueryBuilderConfig.js +6 -1
  43. package/lib/graph-manager/QueryBuilderConfig.js.map +1 -1
  44. package/lib/index.css +1 -1
  45. package/lib/index.d.ts +2 -0
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/index.js +2 -0
  48. package/lib/index.js.map +1 -1
  49. package/lib/package.json +8 -7
  50. package/lib/stores/QueryBuilderState.d.ts +2 -0
  51. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  52. package/lib/stores/QueryBuilderState.js +9 -19
  53. package/lib/stores/QueryBuilderState.js.map +1 -1
  54. package/lib/stores/data-cube/QueryBuilderDataCubeApplicationEngine.d.ts +38 -0
  55. package/lib/stores/data-cube/QueryBuilderDataCubeApplicationEngine.d.ts.map +1 -0
  56. package/lib/stores/data-cube/QueryBuilderDataCubeApplicationEngine.js +71 -0
  57. package/lib/stores/data-cube/QueryBuilderDataCubeApplicationEngine.js.map +1 -0
  58. package/lib/stores/data-cube/QueryBuilderDataCubeEngine.d.ts +52 -0
  59. package/lib/stores/data-cube/QueryBuilderDataCubeEngine.d.ts.map +1 -0
  60. package/lib/stores/data-cube/QueryBuilderDataCubeEngine.js +149 -0
  61. package/lib/stores/data-cube/QueryBuilderDataCubeEngine.js.map +1 -0
  62. package/lib/stores/data-cube/QueryBuilderDataCubeEngineHelper.d.ts +19 -0
  63. package/lib/stores/data-cube/QueryBuilderDataCubeEngineHelper.d.ts.map +1 -0
  64. package/lib/stores/data-cube/QueryBuilderDataCubeEngineHelper.js +31 -0
  65. package/lib/stores/data-cube/QueryBuilderDataCubeEngineHelper.js.map +1 -0
  66. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +1 -0
  67. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
  68. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
  69. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts +1 -0
  70. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
  71. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +3 -0
  72. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  73. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +1 -0
  74. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  75. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +3 -0
  76. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  77. package/lib/stores/filter/QueryBuilderFilterOperator.d.ts +1 -1
  78. package/lib/stores/filter/QueryBuilderFilterOperator.d.ts.map +1 -1
  79. package/lib/stores/filter/QueryBuilderFilterState.d.ts +1 -1
  80. package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
  81. package/lib/stores/filter/QueryBuilderFilterState.js +3 -8
  82. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  83. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +1 -1
  84. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -1
  85. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.d.ts +2 -2
  86. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.d.ts.map +1 -1
  87. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js +3 -3
  88. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js.map +1 -1
  89. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.d.ts +2 -2
  90. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.d.ts.map +1 -1
  91. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js +3 -3
  92. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js.map +1 -1
  93. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.d.ts +2 -2
  94. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.d.ts.map +1 -1
  95. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js +2 -2
  96. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js.map +1 -1
  97. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.d.ts +1 -1
  98. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.d.ts.map +1 -1
  99. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js +2 -2
  100. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js.map +1 -1
  101. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.d.ts +1 -1
  102. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.d.ts.map +1 -1
  103. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js +2 -2
  104. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js.map +1 -1
  105. package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.d.ts +2 -2
  106. package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.d.ts.map +1 -1
  107. package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js +2 -2
  108. package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js.map +1 -1
  109. package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.d.ts +2 -2
  110. package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.d.ts.map +1 -1
  111. package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.js +2 -2
  112. package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.js.map +1 -1
  113. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.d.ts +1 -1
  114. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.d.ts.map +1 -1
  115. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js +2 -2
  116. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js.map +1 -1
  117. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.d.ts +1 -1
  118. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.d.ts.map +1 -1
  119. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js +2 -2
  120. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js.map +1 -1
  121. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.d.ts +2 -2
  122. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.d.ts.map +1 -1
  123. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js +3 -3
  124. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js.map +1 -1
  125. package/package.json +17 -16
  126. package/src/components/QueryBuilder.tsx +4 -0
  127. package/src/components/QueryBuilderSideBar.tsx +11 -10
  128. package/src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx +8 -2
  129. package/src/components/data-cube/QueryBuilderDataCube.tsx +116 -0
  130. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +1 -1
  131. package/src/components/filter/QueryBuilderFilterPanel.tsx +2 -2
  132. package/src/components/result/QueryBuilderResultPanel.tsx +24 -0
  133. package/src/components/result/tds/QueryBuilderTDSGridResult.tsx +13 -9
  134. package/src/components/result/tds/QueryBuilderTDSResultShared.tsx +26 -332
  135. package/src/components/shared/BasicValueSpecificationEditor.tsx +21 -15
  136. package/src/components/shared/CustomDatePicker.tsx +10 -17
  137. package/src/components/workflows/ClassQueryBuilder.tsx +6 -5
  138. package/src/components/workflows/MappingQueryBuilder.tsx +6 -5
  139. package/src/graph-manager/QueryBuilderConfig.ts +7 -1
  140. package/src/index.ts +2 -0
  141. package/src/stores/QueryBuilderState.ts +13 -27
  142. package/src/stores/data-cube/QueryBuilderDataCubeApplicationEngine.ts +109 -0
  143. package/src/stores/data-cube/QueryBuilderDataCubeEngine.ts +255 -0
  144. package/src/stores/data-cube/QueryBuilderDataCubeEngineHelper.ts +41 -0
  145. package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +1 -0
  146. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +4 -0
  147. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +4 -0
  148. package/src/stores/filter/QueryBuilderFilterOperator.ts +1 -1
  149. package/src/stores/filter/QueryBuilderFilterState.ts +5 -10
  150. package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +1 -1
  151. package/src/stores/filter/operators/QueryBuilderFilterOperator_Contain.ts +5 -3
  152. package/src/stores/filter/operators/QueryBuilderFilterOperator_EndWith.ts +5 -3
  153. package/src/stores/filter/operators/QueryBuilderFilterOperator_Equal.ts +2 -2
  154. package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.ts +4 -2
  155. package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.ts +4 -2
  156. package/src/stores/filter/operators/QueryBuilderFilterOperator_In.ts +2 -2
  157. package/src/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.ts +2 -2
  158. package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThan.ts +4 -2
  159. package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.ts +4 -2
  160. package/src/stores/filter/operators/QueryBuilderFilterOperator_StartWith.ts +5 -3
  161. package/tsconfig.json +4 -0
@@ -22,13 +22,12 @@ import {
22
22
  import { observer } from 'mobx-react-lite';
23
23
  import { flowResult } from 'mobx';
24
24
  import {
25
- type AbstractPropertyExpression,
26
- type Enumeration,
27
- type ExecutionResult,
28
25
  type TDSExecutionResult,
29
- EnumValueExplicitReference,
30
- EnumValueInstanceValue,
26
+ type Enumeration,
31
27
  InstanceValue,
28
+ EnumValueInstanceValue,
29
+ EnumValueExplicitReference,
30
+ type ExecutionResult,
32
31
  RelationalExecutionActivities,
33
32
  } from '@finos/legend-graph';
34
33
  import { format as formatSQL } from 'sql-formatter';
@@ -48,7 +47,6 @@ import { forwardRef } from 'react';
48
47
  import {
49
48
  QueryBuilderDerivationProjectionColumnState,
50
49
  QueryBuilderProjectionColumnState,
51
- QueryBuilderSimpleProjectionColumnState,
52
50
  } from '../../../stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js';
53
51
  import {
54
52
  type QueryBuilderPostFilterTreeNodeData,
@@ -83,30 +81,6 @@ import {
83
81
  } from '../../../stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js';
84
82
  import { getTDSColumnState } from '../../../stores/fetch-structure/tds/QueryBuilderTDSHelper.js';
85
83
  import type { QueryBuilderTDSColumnState } from '../../../stores/fetch-structure/tds/QueryBuilderTDSColumnState.js';
86
- import {
87
- type QueryBuilderFilterState,
88
- type QueryBuilderFilterTreeNodeData,
89
- FilterConditionState,
90
- FilterValueSpecConditionValueState,
91
- isCollectionProperty,
92
- QueryBuilderFilterTreeConditionNodeData,
93
- } from '../../../stores/filter/QueryBuilderFilterState.js';
94
- import { QueryBuilderAggregateColumnState } from '../../../stores/fetch-structure/tds/aggregation/QueryBuilderAggregationState.js';
95
- import type { QueryBuilderFilterOperator } from '../../../stores/filter/QueryBuilderFilterOperator.js';
96
- import {
97
- QueryBuilderFilterOperator_Equal,
98
- QueryBuilderFilterOperator_NotEqual,
99
- } from '../../../stores/filter/operators/QueryBuilderFilterOperator_Equal.js';
100
- import {
101
- QueryBuilderFilterOperator_In,
102
- QueryBuilderFilterOperator_NotIn,
103
- } from '../../../stores/filter/operators/QueryBuilderFilterOperator_In.js';
104
- import {
105
- QueryBuilderFilterOperator_IsEmpty,
106
- QueryBuilderFilterOperator_IsNotEmpty,
107
- } from '../../../stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.js';
108
- import type { QueryBuilderState } from '../../../stores/QueryBuilderState.js';
109
- import type { QueryBuilderPropertyExpressionState } from '../../../stores/QueryBuilderPropertyEditorState.js';
110
84
 
111
85
  export const tryToFormatSql = (sql: string): string => {
112
86
  try {
@@ -165,13 +139,6 @@ export type IQueryRendererParamsWithGridType = DataGridCellRendererParams & {
165
139
  tdsExecutionResult: TDSExecutionResult;
166
140
  };
167
141
 
168
- const filterEqualOperator = new QueryBuilderFilterOperator_Equal();
169
- const filterNotEqualOperator = new QueryBuilderFilterOperator_NotEqual();
170
- const filterInOperator = new QueryBuilderFilterOperator_In();
171
- const filterNotInOperator = new QueryBuilderFilterOperator_NotIn();
172
- const filterEmptyOperator = new QueryBuilderFilterOperator_IsEmpty();
173
- const filterNotEmptyOperator = new QueryBuilderFilterOperator_IsNotEmpty();
174
-
175
142
  const postFilterEqualOperator = new QueryBuilderPostFilterOperator_Equal();
176
143
  const postFilterInOperator = new QueryBuilderPostFilterOperator_In();
177
144
  const postFilterEmptyOperator = new QueryBuilderPostFilterOperator_IsEmpty();
@@ -181,22 +148,6 @@ const postFilterNotEqualOperator =
181
148
  new QueryBuilderPostFilterOperator_NotEqual();
182
149
  const postFilterNotInOperator = new QueryBuilderPostFilterOperator_NotIn();
183
150
 
184
- const getExistingFilterNode = (
185
- operators: QueryBuilderFilterOperator[],
186
- propertyExpressionState: QueryBuilderPropertyExpressionState | undefined,
187
- filterState: QueryBuilderFilterState,
188
- ): QueryBuilderFilterTreeNodeData | undefined =>
189
- Array.from(filterState.nodes.values())
190
- .filter(filterByType(QueryBuilderFilterTreeConditionNodeData))
191
- .filter(
192
- (node) =>
193
- node.condition.propertyExpressionState.path ===
194
- propertyExpressionState?.path &&
195
- operators
196
- .map((op) => op.getLabel())
197
- .includes(node.condition.operator.getLabel()),
198
- )[0];
199
-
200
151
  const getExistingPostFilterNode = (
201
152
  operators: QueryBuilderPostFilterOperator[],
202
153
  projectionColumnName: string | undefined,
@@ -222,7 +173,7 @@ const getExistingPostFilterNode = (
222
173
  const updateFilterConditionValue = (
223
174
  conditionValue: InstanceValue,
224
175
  _cellData: QueryBuilderTDSResultCellData,
225
- queryBuilderState: QueryBuilderState,
176
+ tdsState: QueryBuilderTDSState,
226
177
  ): void => {
227
178
  if (_cellData.value) {
228
179
  instanceValue_setValue(
@@ -237,58 +188,11 @@ const updateFilterConditionValue = (
237
188
  )
238
189
  : _cellData.value,
239
190
  0,
240
- queryBuilderState.observerContext,
191
+ tdsState.queryBuilderState.observerContext,
241
192
  );
242
193
  }
243
194
  };
244
195
 
245
- const generateNewFilterConditionNodeData = (
246
- applicationStore: ApplicationStore<
247
- LegendApplicationConfig,
248
- LegendApplicationPluginManager<LegendApplicationPlugin>
249
- >,
250
- operator: QueryBuilderFilterOperator,
251
- _cellData: QueryBuilderTDSResultCellData,
252
- filterState: QueryBuilderFilterState,
253
- propertyExpression: AbstractPropertyExpression | undefined,
254
- ): void => {
255
- let filterConditionState: FilterConditionState;
256
- try {
257
- if (propertyExpression) {
258
- filterConditionState = new FilterConditionState(
259
- filterState,
260
- propertyExpression,
261
- operator,
262
- );
263
-
264
- const defaultFilterConditionValue =
265
- filterConditionState.operator.getDefaultFilterConditionValue(
266
- filterConditionState,
267
- );
268
-
269
- filterConditionState.buildRightConditionValueFromValueSpec(
270
- defaultFilterConditionValue,
271
- );
272
- updateFilterConditionValue(
273
- defaultFilterConditionValue as InstanceValue,
274
- _cellData,
275
- filterState.queryBuilderState,
276
- );
277
- filterState.addNodeFromNode(
278
- new QueryBuilderFilterTreeConditionNodeData(
279
- undefined,
280
- filterConditionState,
281
- ),
282
- undefined,
283
- );
284
- }
285
- } catch (error) {
286
- assertErrorThrown(error);
287
- applicationStore.notificationService.notifyWarning(error.message);
288
- return;
289
- }
290
- };
291
-
292
196
  const generateNewPostFilterConditionNodeData = async (
293
197
  applicationStore: ApplicationStore<
294
198
  LegendApplicationConfig,
@@ -331,7 +235,7 @@ const generateNewPostFilterConditionNodeData = async (
331
235
  updateFilterConditionValue(
332
236
  defaultFilterConditionValue as InstanceValue,
333
237
  _cellData,
334
- tdsState.queryBuilderState,
238
+ tdsState,
335
239
  );
336
240
  tdsState.postFilterState.addNodeFromNode(
337
241
  new QueryBuilderPostFilterTreeConditionNodeData(
@@ -348,91 +252,6 @@ const generateNewPostFilterConditionNodeData = async (
348
252
  }
349
253
  };
350
254
 
351
- const updateExistingFilterConditionNodeData = (
352
- existingPreFilterNode: QueryBuilderFilterTreeNodeData,
353
- isFilterBy: boolean,
354
- _cellData: QueryBuilderTDSResultCellData,
355
- operator: QueryBuilderFilterOperator,
356
- data: QueryBuilderTDSResultCellData | null,
357
- queryBuilderState: QueryBuilderState,
358
- ): void => {
359
- if (operator === filterEmptyOperator || operator === filterNotEmptyOperator) {
360
- const conditionState = (
361
- existingPreFilterNode as QueryBuilderFilterTreeConditionNodeData
362
- ).condition;
363
- if (conditionState.operator.getLabel() !== operator.getLabel()) {
364
- conditionState.changeOperator(
365
- isFilterBy ? filterEmptyOperator : filterNotEmptyOperator,
366
- );
367
- }
368
- return;
369
- }
370
- const conditionState = (
371
- existingPreFilterNode as QueryBuilderFilterTreeConditionNodeData
372
- ).condition;
373
-
374
- const rightSide = conditionState.rightConditionValue;
375
- if (rightSide instanceof FilterValueSpecConditionValueState) {
376
- if (conditionState.operator.getLabel() === operator.getLabel()) {
377
- const doesValueAlreadyExist =
378
- rightSide.value instanceof InstanceValue &&
379
- (rightSide.value instanceof EnumValueInstanceValue
380
- ? rightSide.value.values.map((ef) => ef.value.name)
381
- : rightSide.value.values
382
- ).includes(_cellData.value);
383
-
384
- if (!doesValueAlreadyExist) {
385
- const currentValueSpecificaton = rightSide.value;
386
- const newValueSpecification =
387
- conditionState.operator.getDefaultFilterConditionValue(
388
- conditionState,
389
- );
390
- updateFilterConditionValue(
391
- newValueSpecification as InstanceValue,
392
- _cellData,
393
- queryBuilderState,
394
- );
395
- conditionState.changeOperator(
396
- isFilterBy ? filterInOperator : filterNotInOperator,
397
- );
398
- instanceValue_setValues(
399
- rightSide.value as InstanceValue,
400
- [currentValueSpecificaton, newValueSpecification],
401
- queryBuilderState.observerContext,
402
- );
403
- }
404
- } else {
405
- const doesValueAlreadyExist =
406
- rightSide.value instanceof InstanceValue &&
407
- rightSide.value.values
408
- .filter((v) => v instanceof InstanceValue)
409
- .map((v) =>
410
- v instanceof EnumValueInstanceValue
411
- ? v.values.map((ef) => ef.value.name)
412
- : v.values,
413
- )
414
- .flat()
415
- .includes(_cellData.value ?? data?.value);
416
-
417
- if (!doesValueAlreadyExist) {
418
- const newValueSpecification = (
419
- isFilterBy ? filterEqualOperator : filterNotEqualOperator
420
- ).getDefaultFilterConditionValue(conditionState);
421
- updateFilterConditionValue(
422
- newValueSpecification as InstanceValue,
423
- _cellData,
424
- queryBuilderState,
425
- );
426
- instanceValue_setValues(
427
- rightSide.value as InstanceValue,
428
- [...(rightSide.value as InstanceValue).values, newValueSpecification],
429
- queryBuilderState.observerContext,
430
- );
431
- }
432
- }
433
- }
434
- };
435
-
436
255
  const updateExistingPostFilterConditionNodeData = (
437
256
  existingPostFilterNode: QueryBuilderPostFilterTreeNodeData,
438
257
  isFilterBy: boolean,
@@ -478,7 +297,7 @@ const updateExistingPostFilterConditionNodeData = (
478
297
  updateFilterConditionValue(
479
298
  newValueSpecification as InstanceValue,
480
299
  _cellData,
481
- tdsState.queryBuilderState,
300
+ tdsState,
482
301
  );
483
302
  conditionState.changeOperator(
484
303
  isFilterBy ? postFilterInOperator : postFilterNotInOperator,
@@ -509,7 +328,7 @@ const updateExistingPostFilterConditionNodeData = (
509
328
  updateFilterConditionValue(
510
329
  newValueSpecification as InstanceValue,
511
330
  _cellData,
512
- tdsState.queryBuilderState,
331
+ tdsState,
513
332
  );
514
333
  instanceValue_setValues(
515
334
  rightSide.value as InstanceValue,
@@ -524,25 +343,6 @@ const updateExistingPostFilterConditionNodeData = (
524
343
  const getFilterOperator = (
525
344
  isFilterBy: boolean,
526
345
  _cellData: QueryBuilderTDSResultCellData,
527
- ): QueryBuilderFilterOperator => {
528
- if (isFilterBy) {
529
- if (_cellData.value === null) {
530
- return filterEmptyOperator;
531
- } else {
532
- return filterEqualOperator;
533
- }
534
- } else {
535
- if (_cellData.value === null) {
536
- return filterNotEmptyOperator;
537
- } else {
538
- return filterNotEqualOperator;
539
- }
540
- }
541
- };
542
-
543
- const getPostFilterOperator = (
544
- isFilterBy: boolean,
545
- _cellData: QueryBuilderTDSResultCellData,
546
346
  ): QueryBuilderPostFilterOperator => {
547
347
  if (isFilterBy) {
548
348
  if (_cellData.value === null) {
@@ -559,54 +359,7 @@ const getPostFilterOperator = (
559
359
  }
560
360
  };
561
361
 
562
- const preFilterByOrOutValue = (
563
- applicationStore: ApplicationStore<
564
- LegendApplicationConfig,
565
- LegendApplicationPluginManager<LegendApplicationPlugin>
566
- >,
567
- isFilterBy: boolean,
568
- _cellData: QueryBuilderTDSResultCellData,
569
- data: QueryBuilderTDSResultCellData | null,
570
- propertyExpressionState: QueryBuilderPropertyExpressionState,
571
- queryBuilderState: QueryBuilderState,
572
- ): void => {
573
- queryBuilderState.filterState.setShowPanel(true);
574
- const operator = getFilterOperator(isFilterBy, _cellData);
575
- const existingPreFilterNode = getExistingFilterNode(
576
- _cellData.value === null
577
- ? [filterEmptyOperator, filterNotEmptyOperator]
578
- : isFilterBy
579
- ? [filterEqualOperator, filterInOperator]
580
- : [filterNotEqualOperator, filterNotInOperator],
581
- propertyExpressionState,
582
- queryBuilderState.filterState,
583
- );
584
- if (existingPreFilterNode) {
585
- updateExistingFilterConditionNodeData(
586
- existingPreFilterNode,
587
- isFilterBy,
588
- _cellData,
589
- operator,
590
- data,
591
- queryBuilderState,
592
- );
593
- } else {
594
- try {
595
- generateNewFilterConditionNodeData(
596
- applicationStore,
597
- operator,
598
- _cellData,
599
- queryBuilderState.filterState,
600
- propertyExpressionState.propertyExpression,
601
- );
602
- } catch (error) {
603
- assertErrorThrown(error);
604
- applicationStore.alertUnhandledError(error);
605
- }
606
- }
607
- };
608
-
609
- const postFilterByOrOutValue = async (
362
+ const filterByOrOutValue = (
610
363
  applicationStore: ApplicationStore<
611
364
  LegendApplicationConfig,
612
365
  LegendApplicationPluginManager<LegendApplicationPlugin>
@@ -614,11 +367,13 @@ const postFilterByOrOutValue = async (
614
367
  isFilterBy: boolean,
615
368
  _cellData: QueryBuilderTDSResultCellData,
616
369
  data: QueryBuilderTDSResultCellData | null,
617
- tdsColState: QueryBuilderTDSColumnState,
618
370
  tdsState: QueryBuilderTDSState,
619
- ): Promise<void> => {
371
+ ): void => {
620
372
  tdsState.setShowPostFilterPanel(true);
621
- const operator = getPostFilterOperator(isFilterBy, _cellData);
373
+ const operator = getFilterOperator(isFilterBy, _cellData);
374
+ const tdsColState = data?.columnName
375
+ ? getTDSColumnState(tdsState, data.columnName)
376
+ : undefined;
622
377
  const existingPostFilterNode = getExistingPostFilterNode(
623
378
  _cellData.value === null
624
379
  ? [postFilterEmptyOperator, postFilterNotEmptyOperator]
@@ -639,67 +394,17 @@ const postFilterByOrOutValue = async (
639
394
  tdsState,
640
395
  );
641
396
  } else {
642
- try {
643
- await generateNewPostFilterConditionNodeData(
644
- applicationStore,
645
- operator,
646
- _cellData,
647
- tdsState,
648
- tdsColState,
649
- );
650
- } catch (error) {
651
- assertErrorThrown(error);
652
- applicationStore.alertUnhandledError(error);
653
- }
654
- }
655
- };
656
-
657
- const filterByOrOutValue = async (
658
- applicationStore: ApplicationStore<
659
- LegendApplicationConfig,
660
- LegendApplicationPluginManager<LegendApplicationPlugin>
661
- >,
662
- isFilterBy: boolean,
663
- _cellData: QueryBuilderTDSResultCellData,
664
- data: QueryBuilderTDSResultCellData | null,
665
- tdsState: QueryBuilderTDSState,
666
- ): Promise<void> => {
667
- const tdsColState = data?.columnName
668
- ? getTDSColumnState(tdsState, data.columnName)
669
- : undefined;
670
- if (
671
- tdsColState instanceof QueryBuilderDerivationProjectionColumnState ||
672
- tdsColState instanceof QueryBuilderAggregateColumnState ||
673
- (tdsColState instanceof QueryBuilderSimpleProjectionColumnState &&
674
- isCollectionProperty(
675
- tdsColState.propertyExpressionState.propertyExpression,
676
- ))
677
- ) {
678
- await postFilterByOrOutValue(
397
+ generateNewPostFilterConditionNodeData(
679
398
  applicationStore,
680
- isFilterBy,
399
+ operator,
681
400
  _cellData,
682
- data,
683
- tdsColState,
684
401
  tdsState,
685
- );
686
- } else if (tdsColState instanceof QueryBuilderSimpleProjectionColumnState) {
687
- preFilterByOrOutValue(
688
- applicationStore,
689
- isFilterBy,
690
- _cellData,
691
- data,
692
- tdsColState.propertyExpressionState,
693
- tdsState.queryBuilderState,
694
- );
695
- } else {
696
- applicationStore.notificationService.notifyError(
697
- `Can't filter column '${data?.columnName}'`,
698
- );
402
+ tdsColState,
403
+ ).catch(applicationStore.alertUnhandledError);
699
404
  }
700
405
  };
701
406
 
702
- export const filterByOrOutValues = async (
407
+ export const filterByOrOutValues = (
703
408
  applicationStore: ApplicationStore<
704
409
  LegendApplicationConfig,
705
410
  LegendApplicationPluginManager<LegendApplicationPlugin>
@@ -707,17 +412,10 @@ export const filterByOrOutValues = async (
707
412
  data: QueryBuilderTDSResultCellData | null,
708
413
  isFilterBy: boolean,
709
414
  tdsState: QueryBuilderTDSState,
710
- ): Promise<void> => {
711
- for (const _cellData of tdsState.queryBuilderState.resultState
712
- .selectedCells) {
713
- await filterByOrOutValue(
714
- applicationStore,
715
- isFilterBy,
716
- _cellData,
717
- data,
718
- tdsState,
719
- );
720
- }
415
+ ): void => {
416
+ tdsState.queryBuilderState.resultState.selectedCells.forEach((_cellData) => {
417
+ filterByOrOutValue(applicationStore, isFilterBy, _cellData, data, tdsState);
418
+ });
721
419
  };
722
420
 
723
421
  export const QueryBuilderGridResultContextMenu = observer(
@@ -742,9 +440,7 @@ export const QueryBuilderGridResultContextMenu = observer(
742
440
  <MenuContentItem
743
441
  disabled={!tdsColState}
744
442
  onClick={(): void => {
745
- filterByOrOutValues(applicationStore, data, true, tdsState).catch(
746
- tdsState.queryBuilderState.applicationStore.alertUnhandledError,
747
- );
443
+ filterByOrOutValues(applicationStore, data, true, tdsState);
748
444
  }}
749
445
  >
750
446
  Filter By
@@ -752,9 +448,7 @@ export const QueryBuilderGridResultContextMenu = observer(
752
448
  <MenuContentItem
753
449
  disabled={!tdsColState}
754
450
  onClick={(): void => {
755
- filterByOrOutValues(applicationStore, data, false, tdsState).catch(
756
- tdsState.queryBuilderState.applicationStore.alertUnhandledError,
757
- );
451
+ filterByOrOutValues(applicationStore, data, false, tdsState);
758
452
  }}
759
453
  >
760
454
  Filter Out
@@ -233,9 +233,7 @@ const StringPrimitiveInstanceValueEditor = observer(
233
233
  selectorConfig?: BasicValueSpecificationEditorSelectorConfig | undefined;
234
234
  observerContext: ObserverContext;
235
235
  handleBlur?: (() => void) | undefined;
236
- handleKeyDown?:
237
- | ((event: React.KeyboardEvent<HTMLInputElement>) => void)
238
- | undefined;
236
+ handleKeyDown?: React.KeyboardEventHandler<HTMLDivElement> | undefined;
239
237
  }
240
238
  >(function StringPrimitiveInstanceValueEditor(props, ref) {
241
239
  const {
@@ -261,7 +259,7 @@ const StringPrimitiveInstanceValueEditor = observer(
261
259
  updateValueSpec(event.target.value);
262
260
  };
263
261
  // custom select
264
- const selectedValue = { value: value, label: value };
262
+ const selectedValue = value ? { value: value, label: value } : null;
265
263
  const reloadValuesFunc = selectorConfig?.reloadValues;
266
264
  const changeValue = (
267
265
  val: null | { value: number | string; label: string },
@@ -318,7 +316,7 @@ const StringPrimitiveInstanceValueEditor = observer(
318
316
  className="value-spec-editor__enum-selector"
319
317
  options={queryOptions}
320
318
  onChange={changeValue}
321
- value={selectedValue.label === '' ? '' : selectedValue}
319
+ value={selectedValue}
322
320
  inputValue={value ?? ''}
323
321
  onInputChange={handleInputChange}
324
322
  darkMode={
@@ -333,8 +331,10 @@ const StringPrimitiveInstanceValueEditor = observer(
333
331
  }}
334
332
  hasError={!isValidInstanceValue(valueSpecification)}
335
333
  placeholder={value === '' ? '(empty)' : undefined}
336
- ref={ref as React.Ref<SelectComponent>}
337
- onKeyDown={handleKeyDown}
334
+ inputRef={ref as React.Ref<SelectComponent>}
335
+ onKeyDown={
336
+ handleKeyDown as React.KeyboardEventHandler<HTMLDivElement>
337
+ }
338
338
  inputName={inputName}
339
339
  />
340
340
  ) : (
@@ -911,14 +911,18 @@ const PrimitiveCollectionInstanceValueEditor = observer(
911
911
  saveEdit();
912
912
  };
913
913
 
914
- const handleKeyDown = (event: KeyboardEvent): void => {
914
+ const handleKeyDown: React.KeyboardEventHandler<HTMLDivElement> = (
915
+ event,
916
+ ) => {
915
917
  if ((event.key === 'Enter' || event.key === ',') && !event.shiftKey) {
916
918
  addInputValueToSelectedOptions();
917
919
  event.preventDefault();
918
920
  }
919
921
  };
920
922
 
921
- const handlePaste = (event: React.ClipboardEvent<string>): void => {
923
+ const handlePaste: React.ClipboardEventHandler<HTMLInputElement> = (
924
+ event,
925
+ ) => {
922
926
  const pastedText = event.clipboardData.getData('text');
923
927
  const parsedData = parseCSVString(pastedText);
924
928
  if (!parsedData) {
@@ -982,8 +986,7 @@ const PrimitiveCollectionInstanceValueEditor = observer(
982
986
  }
983
987
  isLoading={isLoading}
984
988
  noMatchMessage={noMatchMessage}
985
- placeholder={null}
986
- inputPlaceholder={getPlaceHolder(expectedType)}
989
+ placeholder={getPlaceHolder(expectedType)}
987
990
  components={{
988
991
  DropdownIndicator: null,
989
992
  }}
@@ -1121,14 +1124,18 @@ const EnumCollectionInstanceValueEditor = observer(
1121
1124
  }
1122
1125
  };
1123
1126
 
1124
- const handleKeyDown = (event: KeyboardEvent): void => {
1127
+ const handleKeyDown: React.KeyboardEventHandler<HTMLDivElement> = (
1128
+ event,
1129
+ ) => {
1125
1130
  if ((event.key === 'Enter' || event.key === ',') && !event.shiftKey) {
1126
1131
  addInputValueToSelectedOptions();
1127
1132
  event.preventDefault();
1128
1133
  }
1129
1134
  };
1130
1135
 
1131
- const handlePaste = (event: React.ClipboardEvent<string>): void => {
1136
+ const handlePaste: React.ClipboardEventHandler<HTMLInputElement> = (
1137
+ event,
1138
+ ) => {
1132
1139
  const pastedText = event.clipboardData.getData('text');
1133
1140
  const parsedData = parseCSVString(pastedText);
1134
1141
  if (!parsedData) {
@@ -1199,8 +1206,7 @@ const EnumCollectionInstanceValueEditor = observer(
1199
1206
  darkMode={
1200
1207
  !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
1201
1208
  }
1202
- placeholder={null}
1203
- inputPlaceholder="Add"
1209
+ placeholder="Add"
1204
1210
  menuIsOpen={true}
1205
1211
  inputName={inputName}
1206
1212
  />
@@ -1007,11 +1007,8 @@ const CustomDateInstanceValueEditor: React.FC<{
1007
1007
  value: t.toString(),
1008
1008
  label: t.toString(),
1009
1009
  }))}
1010
- onChange={(val: {
1011
- label: string;
1012
- value: CUSTOM_DATE_OPTION_UNIT;
1013
- }): void => {
1014
- setUnitValue(val.value);
1010
+ onChange={(val: { label: string; value: string }): void => {
1011
+ setUnitValue(val.value as CUSTOM_DATE_OPTION_UNIT);
1015
1012
  changeValue(
1016
1013
  durationValue,
1017
1014
  val.value,
@@ -1032,11 +1029,8 @@ const CustomDateInstanceValueEditor: React.FC<{
1032
1029
  value: t.toString(),
1033
1030
  label: t.toString(),
1034
1031
  }))}
1035
- onChange={(val: {
1036
- label: string;
1037
- value: CUSTOM_DATE_OPTION_DIRECTION;
1038
- }): void => {
1039
- setDirectionValue(val.value);
1032
+ onChange={(val: { label: string; value: string }): void => {
1033
+ setDirectionValue(val.value as CUSTOM_DATE_OPTION_DIRECTION);
1040
1034
  changeValue(
1041
1035
  durationValue,
1042
1036
  unitValue,
@@ -1059,11 +1053,10 @@ const CustomDateInstanceValueEditor: React.FC<{
1059
1053
  label: t.toString(),
1060
1054
  }),
1061
1055
  )}
1062
- onChange={(val: {
1063
- label: string;
1064
- value: CUSTOM_DATE_OPTION_REFERENCE_MOMENT;
1065
- }): void => {
1066
- setReferenceMomentValueValue(val.value);
1056
+ onChange={(val: { label: string; value: string }): void => {
1057
+ setReferenceMomentValueValue(
1058
+ val.value as CUSTOM_DATE_OPTION_REFERENCE_MOMENT,
1059
+ );
1067
1060
  changeValue(durationValue, unitValue, directionValue, val.value);
1068
1061
  }}
1069
1062
  value={{ value: referenceMomentValue, label: referenceMomentValue }}
@@ -1128,7 +1121,7 @@ const CustomFirstDayOfValueSpecificationEditor: React.FC<{
1128
1121
  <div className="value-spec-editor__date-picker__custom-date">
1129
1122
  <div className="value-spec-editor__date-picker__custom-date__input">
1130
1123
  <CustomSelectorInput
1131
- ref={selectorRef}
1124
+ inputRef={selectorRef}
1132
1125
  placeholder="Choose a unit..."
1133
1126
  className="value-spec-editor__date-picker__custom-date__input-dropdown value-spec-editor__date-picker__custom-date__input-dropdown--full"
1134
1127
  options={Object.values(CUSTOM_DATE_FIRST_DAY_OF_UNIT).map((t) => ({
@@ -1197,7 +1190,7 @@ const CustomPreviousDayOfWeekValueSpecificationEditor: React.FC<{
1197
1190
  <div className="value-spec-editor__date-picker__custom-date">
1198
1191
  <div className="value-spec-editor__date-picker__custom-date__input">
1199
1192
  <CustomSelectorInput
1200
- ref={selectorRef}
1193
+ inputRef={selectorRef}
1201
1194
  placeholder="Choose a day..."
1202
1195
  className="value-spec-editor__date-picker__custom-date__input-dropdown value-spec-editor__date-picker__custom-date__input-dropdown--full"
1203
1196
  options={Object.values(CUSTOM_DATE_DAY_OF_WEEK).map((t) => ({
@@ -90,8 +90,9 @@ const ClassQueryBuilderSetupPanelContent = observer(
90
90
  const mappingFilterOption = createFilter({
91
91
  ignoreCase: true,
92
92
  ignoreAccents: false,
93
- stringify: (option: PackageableElementOption<Mapping>): string =>
94
- option.value.path,
93
+ stringify: (option: {
94
+ data: PackageableElementOption<Mapping>;
95
+ }): string => option.data.value.path,
95
96
  });
96
97
 
97
98
  // runtime
@@ -124,9 +125,9 @@ const ClassQueryBuilderSetupPanelContent = observer(
124
125
  const runtimeFilterOption = createFilter({
125
126
  ignoreCase: true,
126
127
  ignoreAccents: false,
127
- stringify: (option: { value: Runtime }): string =>
128
- option.value instanceof RuntimePointer
129
- ? option.value.packageableRuntime.value.path
128
+ stringify: (option: { data: { value: Runtime } }): string =>
129
+ option.data.value instanceof RuntimePointer
130
+ ? option.data.value.packageableRuntime.value.path
130
131
  : 'custom',
131
132
  });
132
133