@finos/legend-query-builder 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. package/lib/components/QueryBuilder.d.ts +1 -0
  2. package/lib/components/QueryBuilder.d.ts.map +1 -1
  3. package/lib/components/QueryBuilder.js +24 -20
  4. package/lib/components/QueryBuilder.js.map +1 -1
  5. package/lib/components/QueryBuilderDiffPanel.d.ts +1 -0
  6. package/lib/components/QueryBuilderDiffPanel.d.ts.map +1 -1
  7. package/lib/components/QueryBuilderParametersPanel.d.ts +1 -0
  8. package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
  9. package/lib/components/QueryBuilderParametersPanel.js +4 -8
  10. package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
  11. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +1 -0
  12. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  13. package/lib/components/QueryBuilderPropertyExpressionEditor.js +2 -2
  14. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  15. package/lib/components/QueryBuilderResultPanel.d.ts +1 -0
  16. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  17. package/lib/components/QueryBuilderResultPanel.js +4 -2
  18. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  19. package/lib/components/QueryBuilderSideBar.d.ts +1 -0
  20. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  21. package/lib/components/QueryBuilderTextEditor.d.ts +1 -0
  22. package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
  23. package/lib/components/QueryBuilderTextEditor.js +4 -4
  24. package/lib/components/QueryBuilderTextEditor.js.map +1 -1
  25. package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts +1 -0
  26. package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts.map +1 -1
  27. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
  28. package/lib/components/explorer/QueryBuilderExplorerPanel.js +3 -3
  29. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  30. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts +1 -0
  31. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts.map +1 -1
  32. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts +1 -0
  33. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  34. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +6 -6
  35. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  36. package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts +1 -0
  37. package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts.map +1 -1
  38. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts +1 -0
  39. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts.map +1 -1
  40. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +1 -0
  41. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
  42. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.d.ts +1 -0
  43. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.d.ts.map +1 -1
  44. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.js +6 -6
  45. package/lib/components/fetch-structure/QueryBuilderOlapGroupByPanel.js.map +1 -1
  46. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts +1 -0
  47. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  48. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts +1 -0
  49. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts.map +1 -1
  50. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts +1 -0
  51. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  52. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +3 -3
  53. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  54. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts +1 -0
  55. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  56. package/lib/components/filter/QueryBuilderFilterPanel.d.ts +1 -0
  57. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  58. package/lib/components/shared/LambdaEditor.d.ts +1 -0
  59. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  60. package/lib/components/shared/LambdaEditor.js +3 -3
  61. package/lib/components/shared/LambdaEditor.js.map +1 -1
  62. package/lib/components/shared/LambdaParameterValuesEditor.d.ts +1 -0
  63. package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -1
  64. package/lib/components/shared/LambdaParameterValuesEditor.js +3 -3
  65. package/lib/components/shared/LambdaParameterValuesEditor.js.map +1 -1
  66. package/lib/components/watermark/QueryBuilderWatermark.d.ts +23 -0
  67. package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +1 -0
  68. package/lib/components/watermark/QueryBuilderWatermark.js +67 -0
  69. package/lib/components/watermark/QueryBuilderWatermark.js.map +1 -0
  70. package/lib/graphManager/QueryBuilderHashUtils.d.ts +1 -0
  71. package/lib/graphManager/QueryBuilderHashUtils.d.ts.map +1 -1
  72. package/lib/graphManager/QueryBuilderHashUtils.js +2 -0
  73. package/lib/graphManager/QueryBuilderHashUtils.js.map +1 -1
  74. package/lib/graphManager/QueryBuilderSupportedFunctions.d.ts +1 -0
  75. package/lib/graphManager/QueryBuilderSupportedFunctions.d.ts.map +1 -1
  76. package/lib/graphManager/QueryBuilderSupportedFunctions.js +2 -0
  77. package/lib/graphManager/QueryBuilderSupportedFunctions.js.map +1 -1
  78. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
  79. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +4 -1
  80. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  81. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts +1 -0
  82. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -1
  83. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js +29 -2
  84. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -1
  85. package/lib/index.css +2 -2
  86. package/lib/index.css.map +1 -1
  87. package/lib/package.json +2 -2
  88. package/lib/stores/QueryBuilderState.d.ts +4 -0
  89. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  90. package/lib/stores/QueryBuilderState.js +12 -0
  91. package/lib/stores/QueryBuilderState.js.map +1 -1
  92. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
  93. package/lib/stores/QueryBuilderStateBuilder.js +12 -1
  94. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  95. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
  96. package/lib/stores/QueryBuilderValueSpecificationBuilder.js +7 -1
  97. package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
  98. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  99. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +2 -1
  100. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  101. package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts +31 -0
  102. package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts.map +1 -0
  103. package/lib/stores/watermark/QueryBuilderWatermarkState.js +69 -0
  104. package/lib/stores/watermark/QueryBuilderWatermarkState.js.map +1 -0
  105. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.d.ts +19 -0
  106. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.d.ts.map +1 -0
  107. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.js +30 -0
  108. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.js.map +1 -0
  109. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.d.ts +19 -0
  110. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.d.ts.map +1 -0
  111. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.js +30 -0
  112. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.js.map +1 -0
  113. package/package.json +7 -7
  114. package/src/components/QueryBuilder.tsx +141 -109
  115. package/src/components/QueryBuilderParametersPanel.tsx +27 -35
  116. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +16 -11
  117. package/src/components/QueryBuilderResultPanel.tsx +18 -0
  118. package/src/components/QueryBuilderTextEditor.tsx +22 -17
  119. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +16 -11
  120. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +27 -18
  121. package/src/components/fetch-structure/QueryBuilderOlapGroupByPanel.tsx +22 -18
  122. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +11 -9
  123. package/src/components/shared/LambdaEditor.tsx +20 -17
  124. package/src/components/shared/LambdaParameterValuesEditor.tsx +17 -10
  125. package/src/components/watermark/QueryBuilderWatermark.tsx +185 -0
  126. package/src/graphManager/QueryBuilderHashUtils.ts +3 -0
  127. package/src/graphManager/QueryBuilderSupportedFunctions.ts +2 -0
  128. package/src/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +14 -0
  129. package/src/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts +76 -0
  130. package/src/stores/QueryBuilderState.ts +14 -0
  131. package/src/stores/QueryBuilderStateBuilder.ts +17 -1
  132. package/src/stores/QueryBuilderValueSpecificationBuilder.ts +11 -1
  133. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +2 -1
  134. package/src/stores/watermark/QueryBuilderWatermarkState.ts +114 -0
  135. package/src/stores/watermark/QueryBuilderWatermarkStateBuilder.ts +50 -0
  136. package/src/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.ts +46 -0
  137. package/tsconfig.json +4 -0
@@ -34,7 +34,15 @@ import {
34
34
  import { guaranteeNonNullable } from '@finos/legend-shared';
35
35
  import { useDrop } from 'react-dnd';
36
36
  import { VariableExpressionViewer } from '../QueryBuilderParametersPanel.js';
37
- import { Dialog, PanelEntryDropZonePlaceholder } from '@finos/legend-art';
37
+ import {
38
+ Dialog,
39
+ Modal,
40
+ ModalBody,
41
+ ModalFooter,
42
+ ModalHeader,
43
+ PanelEntryDropZonePlaceholder,
44
+ PanelFormSection,
45
+ } from '@finos/legend-art';
38
46
  import { generateDefaultValueForPrimitiveType } from '../../stores/QueryBuilderValueSpecificationHelper.js';
39
47
  import { BasicValueSpecificationEditor } from '../shared/BasicValueSpecificationEditor.js';
40
48
  import { instanceValue_setValues } from '../../stores/shared/ValueSpecificationModifierHelper.js';
@@ -152,7 +160,7 @@ const BiTemporalMilestoningEditor = observer(
152
160
  const { queryBuilderState } = props;
153
161
  return (
154
162
  <>
155
- <div className="panel__content__form__section">
163
+ <PanelFormSection>
156
164
  <div className="panel__content__form__section__header__label">
157
165
  Processing Date
158
166
  </div>
@@ -160,8 +168,8 @@ const BiTemporalMilestoningEditor = observer(
160
168
  queryBuilderState={queryBuilderState}
161
169
  stereotype={MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL}
162
170
  />
163
- </div>
164
- <div className="panel__content__form__section">
171
+ </PanelFormSection>
172
+ <PanelFormSection>
165
173
  <div className="panel__content__form__section__header__label">
166
174
  Business Date
167
175
  </div>
@@ -169,7 +177,7 @@ const BiTemporalMilestoningEditor = observer(
169
177
  queryBuilderState={queryBuilderState}
170
178
  stereotype={MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL}
171
179
  />
172
- </div>
180
+ </PanelFormSection>
173
181
  </>
174
182
  );
175
183
  },
@@ -179,7 +187,7 @@ const BusinessTemporalMilestoningEditor = observer(
179
187
  (props: { queryBuilderState: QueryBuilderState }) => {
180
188
  const { queryBuilderState } = props;
181
189
  return (
182
- <div className="panel__content__form__section">
190
+ <PanelFormSection>
183
191
  <div className="panel__content__form__section__header__label">
184
192
  Business Date
185
193
  </div>
@@ -188,7 +196,7 @@ const BusinessTemporalMilestoningEditor = observer(
188
196
  queryBuilderState={queryBuilderState}
189
197
  stereotype={MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL}
190
198
  />
191
- </div>
199
+ </PanelFormSection>
192
200
  );
193
201
  },
194
202
  );
@@ -197,7 +205,7 @@ const ProcessingTemporalMilestoningEditor = observer(
197
205
  (props: { queryBuilderState: QueryBuilderState }) => {
198
206
  const { queryBuilderState } = props;
199
207
  return (
200
- <div className="panel__content__form__section">
208
+ <PanelFormSection>
201
209
  <div className="panel__content__form__section__header__label">
202
210
  Processing Date
203
211
  </div>
@@ -206,7 +214,7 @@ const ProcessingTemporalMilestoningEditor = observer(
206
214
  queryBuilderState={queryBuilderState}
207
215
  stereotype={MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL}
208
216
  />
209
- </div>
217
+ </PanelFormSection>
210
218
  );
211
219
  },
212
220
  );
@@ -256,11 +264,12 @@ export const MilestoningParametersEditor = observer(
256
264
  paper: 'editor-modal__content',
257
265
  }}
258
266
  >
259
- <div className="modal modal--dark editor-modal query-builder__parameters__modal">
260
- <div className="modal__header">
261
- <div className="modal__title">Milestoning Parameters</div>
262
- </div>
263
- <div className="modal__body query-builder__parameters__modal__body">
267
+ <Modal
268
+ darkMode={true}
269
+ className="editor-modal query-builder__parameters__modal"
270
+ >
271
+ <ModalHeader title="Milestoning Parameters" />
272
+ <ModalBody className="query-builder__parameters__modal__body">
264
273
  <TemporalMilestoningEditor queryBuilderState={queryBuilderState} />
265
274
  <div className="panel__content__form__section__header__label">
266
275
  List of compatible milestoning parameters
@@ -288,13 +297,13 @@ export const MilestoningParametersEditor = observer(
288
297
  />
289
298
  ))}
290
299
  </div>
291
- </div>
292
- <div className="modal__footer">
300
+ </ModalBody>
301
+ <ModalFooter>
293
302
  <button className="btn modal__footer__close-btn" onClick={close}>
294
303
  Close
295
304
  </button>
296
- </div>
297
- </div>
305
+ </ModalFooter>
306
+ </Modal>
298
307
  </Dialog>
299
308
  );
300
309
  },
@@ -38,6 +38,10 @@ import {
38
38
  WindowIcon,
39
39
  BasePopover,
40
40
  EditIcon,
41
+ ModalHeader,
42
+ Modal,
43
+ ModalFooter,
44
+ PanelFormSection,
41
45
  } from '@finos/legend-art';
42
46
  import { assertErrorThrown, guaranteeNonNullable } from '@finos/legend-shared';
43
47
  import { observer } from 'mobx-react-lite';
@@ -260,16 +264,16 @@ const QueryBuilderOlapColumnModalEditor = observer(
260
264
  paper: 'editor-modal__content',
261
265
  }}
262
266
  >
263
- <div className="modal modal--dark query-builder__olap__modal">
264
- <div className="modal__header">
265
- <div className="modal__title">
266
- {createNewOlap
267
+ <Modal darkMode={true} className="query-builder__olap__modal">
268
+ <ModalHeader
269
+ title={
270
+ createNewOlap
267
271
  ? 'Create OLAP GroupBy Column'
268
- : 'Update OLAP GroupByColumn'}
269
- </div>
270
- </div>
272
+ : 'Update OLAP GroupByColumn'
273
+ }
274
+ />
271
275
  <div className="query-builder__olap__modal__body">
272
- <div className="panel__content__form__section">
276
+ <PanelFormSection>
273
277
  <div className="panel__content__form__section__header__label">
274
278
  OLAP Column Name
275
279
  </div>
@@ -285,8 +289,8 @@ const QueryBuilderOlapColumnModalEditor = observer(
285
289
  isDuplicatedColumnName ? 'Duplicated column' : undefined
286
290
  }
287
291
  />
288
- </div>
289
- <div className="panel__content__form__section">
292
+ </PanelFormSection>
293
+ <PanelFormSection>
290
294
  <div className="panel__content__form__section__header__label">
291
295
  OLAP Operator
292
296
  </div>
@@ -371,8 +375,8 @@ const QueryBuilderOlapColumnModalEditor = observer(
371
375
  </div>
372
376
  </div>
373
377
  </div>
374
- </div>
375
- <div className="panel__content__form__section">
378
+ </PanelFormSection>
379
+ <PanelFormSection>
376
380
  <div className="panel__content__form__section__header__label">
377
381
  Window Columns
378
382
  </div>
@@ -407,8 +411,8 @@ const QueryBuilderOlapColumnModalEditor = observer(
407
411
  </button>
408
412
  </div>
409
413
  </div>
410
- </div>
411
- <div className="panel__content__form__section">
414
+ </PanelFormSection>
415
+ <PanelFormSection>
412
416
  <div className="panel__content__form__section__header__label">
413
417
  Sort By
414
418
  </div>
@@ -497,9 +501,9 @@ const QueryBuilderOlapColumnModalEditor = observer(
497
501
  </DropdownMenu>
498
502
  </div>
499
503
  </div>
500
- </div>
504
+ </PanelFormSection>
501
505
  </div>
502
- <div className="modal__footer">
506
+ <ModalFooter>
503
507
  {createNewOlap ? (
504
508
  <button className="btn modal__footer__close-btn" onClick={create}>
505
509
  Create
@@ -509,8 +513,8 @@ const QueryBuilderOlapColumnModalEditor = observer(
509
513
  Close
510
514
  </button>
511
515
  )}
512
- </div>
513
- </div>
516
+ </ModalFooter>
517
+ </Modal>
514
518
  </Dialog>
515
519
  );
516
520
  },
@@ -24,6 +24,10 @@ import {
24
24
  SortDownAltIcon,
25
25
  SquareIcon,
26
26
  TimesIcon,
27
+ Modal,
28
+ ModalBody,
29
+ ModalFooter,
30
+ ModalHeader,
27
31
  } from '@finos/legend-art';
28
32
  import {
29
33
  COLUMN_SORT_TYPE,
@@ -192,11 +196,9 @@ export const QueryResultModifierModal = observer(
192
196
  paper: 'editor-modal__content',
193
197
  }}
194
198
  >
195
- <div className="modal modal--dark editor-modal">
196
- <div className="modal__header">
197
- <div className="modal__title">Result Set Modifier</div>
198
- </div>
199
- <div className="modal__body query-builder__projection__modal__body">
199
+ <Modal darkMode={true} className="editor-modal">
200
+ <ModalHeader title="Result Set Modifier" />
201
+ <ModalBody className="query-builder__projection__modal__body">
200
202
  <div className="query-builder__projection__options">
201
203
  <ColumnsSortEditor tdsState={tdsState} />
202
204
  <div className="panel__content__form__section">
@@ -241,13 +243,13 @@ export const QueryResultModifierModal = observer(
241
243
  />
242
244
  </div>
243
245
  </div>
244
- </div>
245
- <div className="modal__footer">
246
+ </ModalBody>
247
+ <ModalFooter>
246
248
  <button className="btn modal__footer__close-btn" onClick={close}>
247
249
  Close
248
250
  </button>
249
- </div>
250
- </div>
251
+ </ModalFooter>
252
+ </Modal>
251
253
  </Dialog>
252
254
  );
253
255
  },
@@ -30,6 +30,11 @@ import {
30
30
  useResizeDetector,
31
31
  clearMarkers,
32
32
  setErrorMarkers,
33
+ Modal,
34
+ ModalBody,
35
+ ModalFooter,
36
+ ModalHeader,
37
+ ModalTitle,
33
38
  } from '@finos/legend-art';
34
39
  import type { LambdaEditorState } from '../../stores/shared/LambdaEditorState.js';
35
40
  import {
@@ -589,25 +594,23 @@ const LambdaEditorPopUp = observer(
589
594
  paper: 'editor-modal__content',
590
595
  }}
591
596
  >
592
- <div
593
- className={clsx(
594
- 'modal modal--dark editor-modal lambda-editor__popup__modal',
595
- {
596
- 'lambda-editor__popup__modal--has-error': Boolean(
597
- lambdaEditorState.parserError,
598
- ),
599
- },
600
- )}
597
+ <Modal
598
+ darkMode={true}
599
+ className={clsx('editor-modal lambda-editor__popup__modal', {
600
+ 'lambda-editor__popup__modal--has-error': Boolean(
601
+ lambdaEditorState.parserError,
602
+ ),
603
+ })}
601
604
  >
602
- <div className="modal__header">
603
- <div className="modal__title">Edit Lambda</div>
605
+ <ModalHeader>
606
+ <ModalTitle title="Edit Lambda" />
604
607
  {lambdaEditorState.parserError && (
605
608
  <div className="modal__title__error-badge">
606
609
  Failed to parse lambda
607
610
  </div>
608
611
  )}
609
- </div>
610
- <div className="modal__body">
612
+ </ModalHeader>
613
+ <ModalBody>
611
614
  <div className={clsx('lambda-editor__popup__content', className)}>
612
615
  <div
613
616
  ref={ref}
@@ -617,8 +620,8 @@ const LambdaEditorPopUp = observer(
617
620
  <div className="text-editor__body" ref={textInputRef} />
618
621
  </div>
619
622
  </div>
620
- </div>
621
- <div className="modal__footer">
623
+ </ModalBody>
624
+ <ModalFooter>
622
625
  <button
623
626
  className="btn btn--dark btn--caution"
624
627
  onClick={discardChanges}
@@ -632,8 +635,8 @@ const LambdaEditorPopUp = observer(
632
635
  >
633
636
  Close
634
637
  </button>
635
- </div>
636
- </div>
638
+ </ModalFooter>
639
+ </Modal>
637
640
  </Dialog>
638
641
  );
639
642
  },
@@ -15,7 +15,13 @@
15
15
  */
16
16
 
17
17
  import { useApplicationStore } from '@finos/legend-application';
18
- import { Dialog } from '@finos/legend-art';
18
+ import {
19
+ Dialog,
20
+ Modal,
21
+ ModalBody,
22
+ ModalFooter,
23
+ ModalHeader,
24
+ } from '@finos/legend-art';
19
25
  import {
20
26
  type PureModel,
21
27
  type ValueSpecification,
@@ -55,11 +61,12 @@ export const LambdaParameterValuesEditor = observer(
55
61
  paper: 'editor-modal__content',
56
62
  }}
57
63
  >
58
- <div className="modal modal--dark editor-modal lambda-parameter-values__modal">
59
- <div className="modal__header">
60
- <div className="modal__title">Set Parameter Values</div>
61
- </div>
62
- <div className="modal__body lambda-parameter-values__modal__body">
64
+ <Modal
65
+ darkMode={true}
66
+ className="editor-modal lambda-parameter-values__modal"
67
+ >
68
+ <ModalHeader title="Set Parameter Values" />
69
+ <ModalBody className="lambda-parameter-values__modal__body">
63
70
  {lambdaParametersState.parameterStates.map((paramState) => {
64
71
  const stringType = graph.getPrimitiveType(PRIMITIVE_TYPE.STRING);
65
72
  const variableType = paramState.variableType ?? stringType;
@@ -99,8 +106,8 @@ export const LambdaParameterValuesEditor = observer(
99
106
  </div>
100
107
  );
101
108
  })}
102
- </div>
103
- <div className="modal__footer">
109
+ </ModalBody>
110
+ <ModalFooter>
104
111
  {submitAction && (
105
112
  <button
106
113
  className="btn modal__footer__close-btn"
@@ -113,8 +120,8 @@ export const LambdaParameterValuesEditor = observer(
113
120
  <button className="btn modal__footer__close-btn" onClick={close}>
114
121
  Close
115
122
  </button>
116
- </div>
117
- </div>
123
+ </ModalFooter>
124
+ </Modal>
118
125
  </Dialog>
119
126
  );
120
127
  },
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import {
18
+ Dialog,
19
+ PanelDropZone,
20
+ PanelFormBooleanField,
21
+ PanelForm,
22
+ PanelDivider,
23
+ Modal,
24
+ ModalBody,
25
+ ModalFooter,
26
+ ModalHeader,
27
+ PanelFormListItems,
28
+ PanelFormSection,
29
+ } from '@finos/legend-art';
30
+ import { PRIMITIVE_TYPE, type ValueSpecification } from '@finos/legend-graph';
31
+ import { observer } from 'mobx-react-lite';
32
+ import { useCallback } from 'react';
33
+ import { useDrop } from 'react-dnd';
34
+ import {
35
+ type QueryBuilderParameterDragSource,
36
+ QUERY_BUILDER_PARAMETER_DND_TYPE,
37
+ } from '../../stores/QueryBuilderParametersState.js';
38
+ import type { QueryBuilderState } from '../../stores/QueryBuilderState.js';
39
+ import type { QueryBuilderWatermarkState } from '../../stores/watermark/QueryBuilderWatermarkState.js';
40
+ import { VariableExpressionViewer } from '../QueryBuilderParametersPanel.js';
41
+ import { BasicValueSpecificationEditor } from '../shared/BasicValueSpecificationEditor.js';
42
+
43
+ const WatermarkValueEditor = observer(
44
+ (props: {
45
+ watermarkValue: ValueSpecification;
46
+ watermarkState: QueryBuilderWatermarkState;
47
+ }) => {
48
+ const { watermarkValue, watermarkState } = props;
49
+
50
+ const graph = watermarkState.queryBuilderState.graphManagerState.graph;
51
+
52
+ const handleDrop = useCallback(
53
+ (item: QueryBuilderParameterDragSource): void => {
54
+ watermarkState.setValue(item.variable.parameter);
55
+ },
56
+ [watermarkState],
57
+ );
58
+
59
+ const [{ isParameterValueDragOver }, dropTargetConnector] = useDrop<
60
+ QueryBuilderParameterDragSource,
61
+ void,
62
+ { isParameterValueDragOver: boolean }
63
+ >(
64
+ () => ({
65
+ accept: [QUERY_BUILDER_PARAMETER_DND_TYPE],
66
+ drop: (item, monitor): void => {
67
+ if (
68
+ !monitor.didDrop() &&
69
+ // Only allows parameters with muliplicity 1 and type string
70
+ watermarkState.isParamaterCompatibleWithWaterMark(
71
+ item.variable.parameter,
72
+ )
73
+ ) {
74
+ handleDrop(item);
75
+ } // prevent drop event propagation to accomondate for nested DnD
76
+ },
77
+ collect: (monitor) => ({
78
+ isParameterValueDragOver: monitor.isOver({
79
+ shallow: true,
80
+ }),
81
+ }),
82
+ }),
83
+ [handleDrop],
84
+ );
85
+
86
+ return (
87
+ <PanelFormSection>
88
+ <div className="query-builder__parameter-editor">
89
+ <PanelDropZone
90
+ isDragOver={isParameterValueDragOver}
91
+ dropTargetConnector={dropTargetConnector}
92
+ >
93
+ <BasicValueSpecificationEditor
94
+ valueSpecification={watermarkValue}
95
+ setValueSpecification={(val: ValueSpecification): void => {
96
+ watermarkState.setValue(val);
97
+ }}
98
+ graph={graph}
99
+ obseverContext={
100
+ watermarkState.queryBuilderState.observableContext
101
+ }
102
+ typeCheckOption={{
103
+ expectedType: graph.getPrimitiveType(PRIMITIVE_TYPE.STRING),
104
+ }}
105
+ resetValue={(): void => {
106
+ watermarkState.resetValue();
107
+ }}
108
+ />
109
+ </PanelDropZone>
110
+ </div>
111
+ </PanelFormSection>
112
+ );
113
+ },
114
+ );
115
+
116
+ export const QueryBuilderWatermarkEditor = observer(
117
+ (props: { queryBuilderState: QueryBuilderState }) => {
118
+ const { queryBuilderState } = props;
119
+ const watermarkState = queryBuilderState.watermarkState;
120
+ const handleClose = (): void => {
121
+ watermarkState.setIsEditingWatermark(false);
122
+ };
123
+ const compatibleParameters =
124
+ queryBuilderState.parametersState.parameterStates.filter((p) =>
125
+ watermarkState.isParamaterCompatibleWithWaterMark(p.parameter),
126
+ );
127
+
128
+ return (
129
+ <Dialog
130
+ open={Boolean(watermarkState.isEditingWatermark)}
131
+ onClose={handleClose}
132
+ classes={{
133
+ root: 'editor-modal__root-container',
134
+ container: 'editor-modal__container',
135
+ paper: 'editor-modal__content',
136
+ }}
137
+ >
138
+ <Modal darkMode={true} className="editor-modal">
139
+ <ModalHeader title="Watermark" />
140
+ <ModalBody>
141
+ <PanelForm>
142
+ <PanelFormBooleanField
143
+ isReadOnly={false}
144
+ value={watermarkState.value !== undefined}
145
+ prompt="Enable watermark"
146
+ update={(): void => watermarkState.enableWatermark()}
147
+ />
148
+ {watermarkState.value && (
149
+ <>
150
+ <WatermarkValueEditor
151
+ watermarkState={watermarkState}
152
+ watermarkValue={watermarkState.value}
153
+ />
154
+ <PanelDivider />
155
+ <PanelFormListItems title="List of available parameters">
156
+ {compatibleParameters.length === 0 && (
157
+ <> No available parameters </>
158
+ )}
159
+ {compatibleParameters.map((parameter) => (
160
+ <VariableExpressionViewer
161
+ key={parameter.uuid}
162
+ queryBuilderState={queryBuilderState}
163
+ variableExpressionState={parameter}
164
+ isReadOnly={true}
165
+ hideActions={true}
166
+ />
167
+ ))}
168
+ </PanelFormListItems>
169
+ </>
170
+ )}
171
+ </PanelForm>
172
+ </ModalBody>
173
+ <ModalFooter>
174
+ <button
175
+ className="btn modal__footer__close-btn"
176
+ onClick={handleClose}
177
+ >
178
+ Done
179
+ </button>
180
+ </ModalFooter>
181
+ </Modal>
182
+ </Dialog>
183
+ );
184
+ },
185
+ );
@@ -61,6 +61,9 @@ export enum QUERY_BUILDER_HASH_STRUCTURE {
61
61
  POST_FILTER_OPERATOR_NOT_START_WITH = 'POST_FILTER_OPERATOR_NOT_START_WITH',
62
62
  POST_FILTER_STATE = 'POST_FILTER_STATE',
63
63
 
64
+ // watermark state
65
+ WATERMARK_STATE = 'WATERMARK_STATE',
66
+
64
67
  // OLAPGroup state
65
68
  OLAP_GROUPBY_STATE = 'OLAP_GROUPBY_STATE',
66
69
  OLAP_GROUPBY_OPERATION_STATE = 'OLAP_GROUPBY_OPERATION_STATE',
@@ -65,6 +65,8 @@ export enum QUERY_BUILDER_SUPPORTED_FUNCTIONS {
65
65
  STD_DEV_SAMPLE = 'meta::pure::functions::math::stdDevSample',
66
66
  SUM = 'meta::pure::functions::math::sum',
67
67
  UNIQUE_VALUE_ONLY = 'meta::pure::functions::collection::uniqueValueOnly',
68
+ // watermark
69
+ WATERMARK = 'meta::datalake::functions::forWatermark',
68
70
  // OLAP
69
71
  OLAP_GROUPBY = 'meta::pure::tds::olapGroupBy',
70
72
  OLAP_RANK = 'meta::pure::functions::math::olap::rank',
@@ -23,6 +23,7 @@ import {
23
23
  V1_buildOlapGroupByFunctionExpression,
24
24
  V1_buildProjectFunctionExpression,
25
25
  V1_buildSubTypePropertyExpressionTypeInference,
26
+ V1_buildWatermarkFunctionExpression,
26
27
  } from './v1/V1_QueryValueSpecificationBuilderHelper.js';
27
28
  import {
28
29
  type V1_GraphBuilderContext,
@@ -96,6 +97,19 @@ export class QueryBuilder_PureProtocolProcessorPlugin extends PureProtocolProces
96
97
  compileContext,
97
98
  processingContext,
98
99
  );
100
+ } else if (
101
+ matchFunctionName(
102
+ functionName,
103
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.WATERMARK,
104
+ )
105
+ ) {
106
+ return V1_buildWatermarkFunctionExpression(
107
+ functionName,
108
+ parameters,
109
+ openVariables,
110
+ compileContext,
111
+ processingContext,
112
+ );
99
113
  } else if (
100
114
  matchFunctionName(
101
115
  functionName,