@finos/legend-query-builder 0.6.24 → 0.6.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +27 -27
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderComponentTestUtils.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderComponentTestUtils.js +4 -5
  6. package/lib/components/QueryBuilderComponentTestUtils.js.map +1 -1
  7. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -1
  8. package/lib/components/QueryBuilderConstantExpressionPanel.js +5 -4
  9. package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
  10. package/lib/components/QueryBuilderDiffPanel.d.ts.map +1 -1
  11. package/lib/components/QueryBuilderDiffPanel.js +2 -2
  12. package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
  13. package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
  14. package/lib/components/QueryBuilderParametersPanel.js +13 -8
  15. package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
  16. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  17. package/lib/components/QueryBuilderPropertyExpressionEditor.js +10 -2
  18. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  19. package/lib/components/QueryBuilder_TestID.d.ts +3 -1
  20. package/lib/components/QueryBuilder_TestID.d.ts.map +1 -1
  21. package/lib/components/QueryBuilder_TestID.js +2 -0
  22. package/lib/components/QueryBuilder_TestID.js.map +1 -1
  23. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
  24. package/lib/components/explorer/QueryBuilderExplorerPanel.js +23 -5
  25. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  26. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  27. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +2 -2
  28. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  29. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +2 -2
  30. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  31. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +9 -7
  32. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  33. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +2 -2
  34. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -1
  35. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +2 -2
  36. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
  37. package/lib/components/filter/QueryBuilderFilterPanel.js +2 -2
  38. package/lib/components/shared/CustomDatePicker.d.ts +33 -0
  39. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  40. package/lib/components/shared/CustomDatePicker.js +4 -4
  41. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  42. package/lib/components/shared/QueryBuilderVariableSelector.d.ts +1 -1
  43. package/lib/components/shared/QueryBuilderVariableSelector.d.ts.map +1 -1
  44. package/lib/components/shared/QueryBuilderVariableSelector.js +12 -1
  45. package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -1
  46. package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +1 -1
  47. package/lib/components/watermark/QueryBuilderWatermark.js +2 -2
  48. package/lib/components/watermark/QueryBuilderWatermark.js.map +1 -1
  49. package/lib/index.css +2 -2
  50. package/lib/index.css.map +1 -1
  51. package/lib/package.json +9 -9
  52. package/lib/stores/QueryBuilderState.d.ts +2 -0
  53. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  54. package/lib/stores/QueryBuilderState.js +6 -0
  55. package/lib/stores/QueryBuilderState.js.map +1 -1
  56. package/package.json +16 -16
  57. package/src/components/QueryBuilder.tsx +8 -6
  58. package/src/components/QueryBuilderComponentTestUtils.tsx +6 -5
  59. package/src/components/QueryBuilderConstantExpressionPanel.tsx +12 -11
  60. package/src/components/QueryBuilderDiffPanel.tsx +2 -3
  61. package/src/components/QueryBuilderParametersPanel.tsx +13 -7
  62. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +27 -7
  63. package/src/components/QueryBuilder_TestID.ts +2 -0
  64. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +39 -5
  65. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +2 -3
  66. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +2 -2
  67. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +34 -14
  68. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +2 -2
  69. package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +3 -6
  70. package/src/components/filter/QueryBuilderFilterPanel.tsx +2 -2
  71. package/src/components/shared/CustomDatePicker.tsx +3 -3
  72. package/src/components/shared/QueryBuilderVariableSelector.tsx +18 -4
  73. package/src/components/watermark/QueryBuilderWatermark.tsx +2 -6
  74. package/src/stores/QueryBuilderState.ts +8 -0
@@ -56,7 +56,7 @@ import {
56
56
  valueSpecification_setGenericType,
57
57
  } from '../../stores/shared/ValueSpecificationModifierHelper.js';
58
58
 
59
- enum CUSTOM_DATE_PICKER_OPTION {
59
+ export enum CUSTOM_DATE_PICKER_OPTION {
60
60
  ABSOLUTE_DATE = 'Absolute Date',
61
61
  ABSOLUTE_TIME = 'Absolute Time',
62
62
  TODAY = 'Today',
@@ -431,7 +431,7 @@ const buildPureDurationEnumValue = (
431
431
  };
432
432
 
433
433
  /**
434
- * Generate the pure date ajust() function based on the CustomDateOption.
434
+ * Generate the pure date adjust() function based on the CustomDateOption.
435
435
  */
436
436
  const buildPureAdjustDateFunction = (
437
437
  customDateOption: CustomDateOption,
@@ -634,7 +634,7 @@ const buildCustomDateOption = (
634
634
  /**
635
635
  * Build DatePickerOption from pure date functions or PrimitiveInstanceValue
636
636
  */
637
- const buildDatePickerOption = (
637
+ export const buildDatePickerOption = (
638
638
  valueSpecification: SimpleFunctionExpression | PrimitiveInstanceValue,
639
639
  ): DatePickerOption => {
640
640
  if (valueSpecification instanceof SimpleFunctionExpression) {
@@ -23,9 +23,10 @@ import {
23
23
  TimesIcon,
24
24
  useDragPreviewLayer,
25
25
  } from '@finos/legend-art';
26
- import type {
27
- ValueSpecification,
28
- VariableExpression,
26
+ import {
27
+ SimpleFunctionExpression,
28
+ type ValueSpecification,
29
+ type VariableExpression,
29
30
  } from '@finos/legend-graph';
30
31
  import { observer } from 'mobx-react-lite';
31
32
  import { useDrag } from 'react-dnd';
@@ -36,6 +37,7 @@ import {
36
37
  QUERY_BUILDER_VARIABLE_DND_TYPE,
37
38
  VariableInfoTooltip,
38
39
  } from './BasicValueSpecificationEditor.js';
40
+ import { buildDatePickerOption } from './CustomDatePicker.js';
39
41
 
40
42
  export const VariableViewer = observer(
41
43
  (props: {
@@ -50,8 +52,19 @@ export const VariableViewer = observer(
50
52
  }) => {
51
53
  const { variable, constantValue, actions, isReadOnly, queryBuilderState } =
52
54
  props;
55
+
56
+ const getNameOfValue = (value: ValueSpecification): string | undefined => {
57
+ if (value instanceof SimpleFunctionExpression) {
58
+ const possibleDateLabel = buildDatePickerOption(value).label;
59
+ if (possibleDateLabel) {
60
+ return possibleDateLabel;
61
+ }
62
+ }
63
+ return getValueSpecificationStringValue(value);
64
+ };
65
+
53
66
  const valueString = constantValue
54
- ? getValueSpecificationStringValue(constantValue)
67
+ ? getNameOfValue(constantValue)
55
68
  : undefined;
56
69
  const name = variable.name;
57
70
  const variableType = variable.genericType?.value.rawType;
@@ -159,6 +172,7 @@ export const VariableSelector = observer(
159
172
  queryBuilderState.constantState.constants.filter((c) =>
160
173
  filterBy ? filterBy(c.variable) : true,
161
174
  );
175
+
162
176
  return (
163
177
  <>
164
178
  <PanelFormListItems title="Available parameters">
@@ -25,6 +25,7 @@ import {
25
25
  ModalFooter,
26
26
  ModalHeader,
27
27
  PanelFormSection,
28
+ ModalFooterButton,
28
29
  } from '@finos/legend-art';
29
30
  import {
30
31
  areMultiplicitiesEqual,
@@ -169,12 +170,7 @@ export const QueryBuilderWatermarkEditor = observer(
169
170
  </PanelForm>
170
171
  </ModalBody>
171
172
  <ModalFooter>
172
- <button
173
- className="btn modal__footer__close-btn"
174
- onClick={handleClose}
175
- >
176
- Done
177
- </button>
173
+ <ModalFooterButton text="Done" onClick={handleClose} />
178
174
  </ModalFooter>
179
175
  </Modal>
180
176
  </Dialog>
@@ -99,6 +99,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
99
99
  textEditorState: QueryBuilderTextEditorState;
100
100
  unsupportedQueryState: QueryBuilderUnsupportedQueryState;
101
101
  observableContext: ObserverContext;
102
+ titleOfQuery: string | undefined;
102
103
 
103
104
  queryCompileState = ActionState.create();
104
105
  showFunctionsExplorerPanel = false;
@@ -126,6 +127,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
126
127
  fetchStructureState: observable,
127
128
  filterState: observable,
128
129
  watermarkState: observable,
130
+ titleOfQuery: observable,
129
131
  checkEntitlementsState: observable,
130
132
  resultState: observable,
131
133
  textEditorState: observable,
@@ -151,6 +153,8 @@ export abstract class QueryBuilderState implements CommandRegistrar {
151
153
  setMapping: action,
152
154
  setRuntimeValue: action,
153
155
 
156
+ setTitleOfQuery: action,
157
+
154
158
  resetQueryResult: action,
155
159
  resetQueryContent: action,
156
160
  changeClass: action,
@@ -253,6 +257,10 @@ export abstract class QueryBuilderState implements CommandRegistrar {
253
257
  this.runtimeValue = val;
254
258
  }
255
259
 
260
+ setTitleOfQuery(val: string | undefined): void {
261
+ this.titleOfQuery = val;
262
+ }
263
+
256
264
  get isQuerySupported(): boolean {
257
265
  return !this.unsupportedQueryState.rawLambda;
258
266
  }