@finos/legend-query-builder 4.14.40 → 4.14.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts +0 -5
  2. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  3. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +5 -10
  4. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  5. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  6. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +3 -35
  7. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  8. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  9. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +1 -11
  10. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  11. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  12. package/lib/components/filter/QueryBuilderFilterPanel.js +6 -2
  13. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  14. package/lib/components/shared/BasicValueSpecificationEditor.d.ts +11 -9
  15. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  16. package/lib/components/shared/BasicValueSpecificationEditor.js +160 -143
  17. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  18. package/lib/index.css +2 -2
  19. package/lib/index.css.map +1 -1
  20. package/lib/package.json +1 -1
  21. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +0 -1
  22. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  23. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +0 -8
  24. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  25. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.js +2 -2
  26. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.js.map +1 -1
  27. package/lib/stores/filter/QueryBuilderFilterState.d.ts +1 -1
  28. package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
  29. package/lib/stores/filter/QueryBuilderFilterState.js +4 -3
  30. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  31. package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js +2 -2
  32. package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js.map +1 -1
  33. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -1
  34. package/lib/stores/milestoning/QueryBuilderMilestoningState.js +3 -9
  35. package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -1
  36. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +1 -0
  37. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
  38. package/lib/stores/shared/ValueSpecificationEditorHelper.js +48 -0
  39. package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
  40. package/package.json +8 -8
  41. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +46 -60
  42. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +3 -53
  43. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +19 -116
  44. package/src/components/filter/QueryBuilderFilterPanel.tsx +13 -5
  45. package/src/components/shared/BasicValueSpecificationEditor.tsx +299 -285
  46. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +0 -11
  47. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +2 -2
  48. package/src/stores/filter/QueryBuilderFilterState.ts +6 -3
  49. package/src/stores/filter/operators/QueryBuilderFilterOperator_In.ts +2 -2
  50. package/src/stores/milestoning/QueryBuilderMilestoningState.ts +7 -11
  51. package/src/stores/shared/ValueSpecificationEditorHelper.ts +63 -0
@@ -146,7 +146,6 @@ export class QueryBuilderTDSState
146
146
  TEMPORARY__showPostFetchStructurePanel: computed,
147
147
  derivations: computed,
148
148
  hasParserError: computed,
149
- isQueryOptionsSet: computed,
150
149
  addColumn: action,
151
150
  moveColumn: action,
152
151
  removeAllColumns: action,
@@ -357,16 +356,6 @@ export class QueryBuilderTDSState
357
356
  return fetchStructureValidationIssues;
358
357
  }
359
358
 
360
- get isQueryOptionsSet(): boolean {
361
- return (
362
- this.resultSetModifierState.limit !== undefined ||
363
- this.queryBuilderState.milestoningState.isMilestonedQuery ||
364
- this.resultSetModifierState.slice !== undefined ||
365
- this.resultSetModifierState.sortColumns.length > 0 ||
366
- this.resultSetModifierState.distinct
367
- );
368
- }
369
-
370
359
  get tdsColumns(): QueryBuilderTDSColumnState[] {
371
360
  const aggregationStateCols = this.aggregationState.columns.map(
372
361
  (c) => c.projectionColumnState,
@@ -53,7 +53,7 @@ export class QueryBuilderPostFilterOperator_In
53
53
  implements Hashable
54
54
  {
55
55
  getLabel(): string {
56
- return 'is in';
56
+ return 'is in list of';
57
57
  }
58
58
 
59
59
  isCompatibleWithType(type: Type): boolean {
@@ -168,7 +168,7 @@ export class QueryBuilderPostFilterOperator_In
168
168
 
169
169
  export class QueryBuilderPostFilterOperator_NotIn extends QueryBuilderPostFilterOperator_In {
170
170
  override getLabel(): string {
171
- return `is not in`;
171
+ return `is not in list of`;
172
172
  }
173
173
 
174
174
  override buildPostFilterConditionExpression(
@@ -128,17 +128,20 @@ export class FilterConditionState implements Hashable {
128
128
  );
129
129
  }
130
130
 
131
- *handleTypeaheadSearch(): GeneratorFn<void> {
131
+ *handleTypeaheadSearch(
132
+ searchValue?: ValueSpecification | undefined,
133
+ ): GeneratorFn<void> {
134
+ const value = searchValue ?? this.value;
132
135
  try {
133
136
  this.typeaheadSearchState.inProgress();
134
137
  this.typeaheadSearchResults = undefined;
135
- if (performTypeahead(this.value)) {
138
+ if (performTypeahead(value)) {
136
139
  const result =
137
140
  (yield this.filterState.queryBuilderState.graphManagerState.graphManager.runQuery(
138
141
  buildPropertyTypeaheadQuery(
139
142
  this.filterState.queryBuilderState,
140
143
  this.propertyExpressionState.propertyExpression,
141
- this.value,
144
+ value,
142
145
  ),
143
146
  guaranteeNonNullable(
144
147
  this.filterState.queryBuilderState.executionContextState.mapping,
@@ -48,7 +48,7 @@ export class QueryBuilderFilterOperator_In
48
48
  implements Hashable
49
49
  {
50
50
  getLabel(filterConditionState: FilterConditionState): string {
51
- return 'is in';
51
+ return 'is in list of';
52
52
  }
53
53
 
54
54
  isCompatibleWithFilterConditionProperty(
@@ -172,7 +172,7 @@ export class QueryBuilderFilterOperator_In
172
172
 
173
173
  export class QueryBuilderFilterOperator_NotIn extends QueryBuilderFilterOperator_In {
174
174
  override getLabel(filterConditionState: FilterConditionState): string {
175
- return `is not in`;
175
+ return `is not in list of`;
176
176
  }
177
177
 
178
178
  override buildFilterConditionExpression(
@@ -75,7 +75,7 @@ export class QueryBuilderMilestoningState implements Hashable {
75
75
  startDate: observable,
76
76
  endDate: observable,
77
77
  showMilestoningEditor: observable,
78
-
78
+ isMilestonedQuery: computed,
79
79
  setProcessingDate: action,
80
80
  setBusinessDate: action,
81
81
  setStartDate: action,
@@ -87,10 +87,6 @@ export class QueryBuilderMilestoningState implements Hashable {
87
87
  initializeAllVersionsInRangeParameters: action,
88
88
  clearAllVersionsInRangeParameters: action,
89
89
  clearGetAllParameters: action,
90
-
91
- isAllVersionsEnabled: computed,
92
- isAllVersionsInRangeEnabled: computed,
93
- isMilestonedQuery: computed,
94
90
  hashCode: computed,
95
91
  });
96
92
 
@@ -384,9 +380,9 @@ export class QueryBuilderMilestoningState implements Hashable {
384
380
  this.queryBuilderState.parametersState.parameterStates.find(
385
381
  (p) => p.parameter === this.startDate,
386
382
  );
387
- if (paramState) {
388
- this.queryBuilderState.parametersState.removeParameter(paramState);
389
- }
383
+ this.queryBuilderState.parametersState.removeParameter(
384
+ guaranteeNonNullable(paramState),
385
+ );
390
386
  }
391
387
  if (
392
388
  this.endDate instanceof VariableExpression &&
@@ -398,9 +394,9 @@ export class QueryBuilderMilestoningState implements Hashable {
398
394
  this.queryBuilderState.parametersState.parameterStates.find(
399
395
  (p) => p.parameter === this.endDate,
400
396
  );
401
- if (paramState) {
402
- this.queryBuilderState.parametersState.removeParameter(paramState);
403
- }
397
+ this.queryBuilderState.parametersState.removeParameter(
398
+ guaranteeNonNullable(paramState),
399
+ );
404
400
  }
405
401
  this.setStartDate(undefined);
406
402
  this.setEndDate(undefined);
@@ -321,3 +321,66 @@ export const valueSpecReturnTDS = (
321
321
  retunType && tdsType && (retunType === tdsType || retunType === tdsRowType),
322
322
  );
323
323
  };
324
+
325
+ export const convertTextToPrimitiveInstanceValue = (
326
+ expectedType: Type,
327
+ value: string,
328
+ obseverContext: ObserverContext,
329
+ ): PrimitiveInstanceValue | null => {
330
+ let result = null;
331
+ if (expectedType instanceof PrimitiveType) {
332
+ switch (expectedType.path) {
333
+ case PRIMITIVE_TYPE.STRING: {
334
+ result = new PrimitiveInstanceValue(
335
+ GenericTypeExplicitReference.create(new GenericType(expectedType)),
336
+ );
337
+ instanceValue_setValues(result, [value.toString()], obseverContext);
338
+ break;
339
+ }
340
+ case PRIMITIVE_TYPE.NUMBER:
341
+ case PRIMITIVE_TYPE.FLOAT:
342
+ case PRIMITIVE_TYPE.DECIMAL:
343
+ case PRIMITIVE_TYPE.INTEGER: {
344
+ if (isNaN(Number(value))) {
345
+ return null;
346
+ }
347
+ result = new PrimitiveInstanceValue(
348
+ GenericTypeExplicitReference.create(new GenericType(expectedType)),
349
+ );
350
+ instanceValue_setValues(result, [Number(value)], obseverContext);
351
+ break;
352
+ }
353
+ case PRIMITIVE_TYPE.DATE:
354
+ case PRIMITIVE_TYPE.STRICTDATE: {
355
+ if (isNaN(Date.parse(value))) {
356
+ return null;
357
+ }
358
+ result = new PrimitiveInstanceValue(
359
+ GenericTypeExplicitReference.create(new GenericType(expectedType)),
360
+ );
361
+ instanceValue_setValues(result, [value], obseverContext);
362
+ break;
363
+ }
364
+ case PRIMITIVE_TYPE.DATETIME: {
365
+ if (
366
+ isNaN(Date.parse(value)) ||
367
+ !new Date(value).getTime() ||
368
+ (value.includes('%') &&
369
+ (isNaN(Date.parse(value.slice(1))) ||
370
+ !new Date(value.slice(1)).getTime()))
371
+ ) {
372
+ return null;
373
+ }
374
+ result = new PrimitiveInstanceValue(
375
+ GenericTypeExplicitReference.create(new GenericType(expectedType)),
376
+ );
377
+ instanceValue_setValues(result, [value], obseverContext);
378
+ break;
379
+ }
380
+ default:
381
+ // unsupported expected type, just escape
382
+ return null;
383
+ }
384
+ }
385
+ return result;
386
+ };