@finos/legend-query-builder 4.16.20 → 4.16.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts +21 -1
  2. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.d.ts.map +1 -1
  3. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js +16 -2
  4. package/lib/components/__test-utils__/QueryBuilderComponentTestUtils.js.map +1 -1
  5. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +1 -1
  6. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  7. package/lib/components/filter/QueryBuilderFilterPanel.js +1 -1
  8. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  9. package/lib/components/shared/BasicValueSpecificationEditor.d.ts +155 -4
  10. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  11. package/lib/components/shared/BasicValueSpecificationEditor.js +239 -158
  12. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  13. package/lib/components/shared/CustomDatePicker.d.ts +8 -55
  14. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  15. package/lib/components/shared/CustomDatePicker.js +31 -415
  16. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  17. package/lib/components/shared/CustomDatePickerHelper.d.ts +145 -0
  18. package/lib/components/shared/CustomDatePickerHelper.d.ts.map +1 -0
  19. package/lib/components/shared/CustomDatePickerHelper.js +517 -0
  20. package/lib/components/shared/CustomDatePickerHelper.js.map +1 -0
  21. package/lib/components/shared/QueryBuilderVariableSelector.js +1 -1
  22. package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -1
  23. package/lib/components/shared/V1_BasicValueSpecificationEditor.d.ts +36 -0
  24. package/lib/components/shared/V1_BasicValueSpecificationEditor.d.ts.map +1 -0
  25. package/lib/components/shared/V1_BasicValueSpecificationEditor.js +166 -0
  26. package/lib/components/shared/V1_BasicValueSpecificationEditor.js.map +1 -0
  27. package/lib/index.css +1 -1
  28. package/lib/index.d.ts +3 -0
  29. package/lib/index.d.ts.map +1 -1
  30. package/lib/index.js +3 -0
  31. package/lib/index.js.map +1 -1
  32. package/lib/package.json +1 -1
  33. package/lib/stores/shared/V1_ValueSpecificationEditorHelper.d.ts +23 -0
  34. package/lib/stores/shared/V1_ValueSpecificationEditorHelper.d.ts.map +1 -0
  35. package/lib/stores/shared/V1_ValueSpecificationEditorHelper.js +69 -0
  36. package/lib/stores/shared/V1_ValueSpecificationEditorHelper.js.map +1 -0
  37. package/lib/stores/shared/V1_ValueSpecificationModifierHelper.d.ts +20 -0
  38. package/lib/stores/shared/V1_ValueSpecificationModifierHelper.d.ts.map +1 -0
  39. package/lib/stores/shared/V1_ValueSpecificationModifierHelper.js +38 -0
  40. package/lib/stores/shared/V1_ValueSpecificationModifierHelper.js.map +1 -0
  41. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +4 -1
  42. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
  43. package/lib/stores/shared/ValueSpecificationEditorHelper.js +23 -2
  44. package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
  45. package/package.json +5 -5
  46. package/src/components/__test-utils__/QueryBuilderComponentTestUtils.tsx +101 -12
  47. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +1 -1
  48. package/src/components/filter/QueryBuilderFilterPanel.tsx +1 -1
  49. package/src/components/shared/BasicValueSpecificationEditor.tsx +1417 -1085
  50. package/src/components/shared/CustomDatePicker.tsx +136 -902
  51. package/src/components/shared/CustomDatePickerHelper.ts +984 -0
  52. package/src/components/shared/QueryBuilderVariableSelector.tsx +1 -1
  53. package/src/components/shared/V1_BasicValueSpecificationEditor.tsx +396 -0
  54. package/src/index.ts +5 -0
  55. package/src/stores/shared/V1_ValueSpecificationEditorHelper.ts +113 -0
  56. package/src/stores/shared/V1_ValueSpecificationModifierHelper.ts +76 -0
  57. package/src/stores/shared/ValueSpecificationEditorHelper.ts +71 -2
  58. package/tsconfig.json +4 -0
@@ -28,8 +28,15 @@ import {
28
28
  import { LogService, guaranteeNonNullable } from '@finos/legend-shared';
29
29
  import { createSpy } from '@finos/legend-shared/test';
30
30
  import {
31
- type RawMappingModelCoverageAnalysisResult,
31
+ type GraphManagerPluginManager,
32
+ type ObserverContext,
33
+ type PureModel,
32
34
  type RawLambda,
35
+ type RawMappingModelCoverageAnalysisResult,
36
+ type V1_Enumeration,
37
+ type V1_Multiplicity,
38
+ type V1_ValueSpecification,
39
+ type ValueSpecification,
33
40
  GraphManagerState,
34
41
  PackageableElementExplicitReference,
35
42
  RuntimePointer,
@@ -56,6 +63,14 @@ import { STYLE_PREFIX, STYLE_PREFIX__DARK } from '@finos/legend-art';
56
63
  import { expect } from '@jest/globals';
57
64
  import { QueryBuilderAdvancedWorkflowState } from '../../stores/query-workflow/QueryBuilderWorkFlowState.js';
58
65
  import { Route, Routes } from '@finos/legend-application/browser';
66
+ import {
67
+ BasicValueSpecificationEditor,
68
+ type TypeCheckOption,
69
+ } from '../shared/BasicValueSpecificationEditor.js';
70
+ import {
71
+ V1_BasicValueSpecificationEditor,
72
+ type V1_TypeCheckOption,
73
+ } from '../shared/V1_BasicValueSpecificationEditor.js';
59
74
 
60
75
  const getSelectorContainerClassName = (lightMode?: boolean): string =>
61
76
  '.' + `${lightMode ? STYLE_PREFIX : STYLE_PREFIX__DARK}__value-container`;
@@ -189,23 +204,15 @@ export const setDerivedPropertyValue = async (
189
204
  await waitFor(() => expect(renderResult.queryByRole('dialog')).toBeNull());
190
205
  };
191
206
 
192
- export const TEST__setUpQueryBuilder = async (
207
+ export const TEST__setUpGraphManagerState = async (
193
208
  entities: Entity[],
194
- lambda: RawLambda,
195
- mappingPath: string,
196
- runtimePath: string,
197
- rawMappingModelCoverageAnalysisResult?: RawMappingModelCoverageAnalysisResult,
198
- ): Promise<{
199
- renderResult: RenderResult;
200
- queryBuilderState: QueryBuilderState;
201
- }> => {
202
- const pluginManager = TEST__LegendApplicationPluginManager.create();
209
+ pluginManager: GraphManagerPluginManager,
210
+ ): Promise<GraphManagerState> => {
203
211
  pluginManager.usePresets([new QueryBuilder_GraphManagerPreset()]).install();
204
212
  const graphManagerState = new GraphManagerState(
205
213
  pluginManager,
206
214
  new LogService(),
207
215
  );
208
-
209
216
  await graphManagerState.graphManager.initialize({
210
217
  env: 'test',
211
218
  tabSize: 2,
@@ -217,6 +224,24 @@ export const TEST__setUpQueryBuilder = async (
217
224
  entities,
218
225
  graphManagerState.graphBuildState,
219
226
  );
227
+ return graphManagerState;
228
+ };
229
+
230
+ export const TEST__setUpQueryBuilder = async (
231
+ entities: Entity[],
232
+ lambda: RawLambda,
233
+ mappingPath: string,
234
+ runtimePath: string,
235
+ rawMappingModelCoverageAnalysisResult?: RawMappingModelCoverageAnalysisResult,
236
+ ): Promise<{
237
+ renderResult: RenderResult;
238
+ queryBuilderState: QueryBuilderState;
239
+ }> => {
240
+ const pluginManager = TEST__LegendApplicationPluginManager.create();
241
+ const graphManagerState = await TEST__setUpGraphManagerState(
242
+ entities,
243
+ pluginManager,
244
+ );
220
245
 
221
246
  const MOCK__applicationStore = new ApplicationStore(
222
247
  TEST__getGenericApplicationConfig(),
@@ -275,3 +300,67 @@ export const TEST__setUpQueryBuilder = async (
275
300
  queryBuilderState,
276
301
  };
277
302
  };
303
+
304
+ export const TEST__setUpBasicValueSpecificationEditor = (
305
+ pluginManager: TEST__LegendApplicationPluginManager,
306
+ props: {
307
+ valueSpecification: ValueSpecification;
308
+ setValueSpecification: (val: ValueSpecification) => void;
309
+ typeCheckOption: TypeCheckOption;
310
+ resetValue: () => void;
311
+ graph: PureModel;
312
+ observerContext: ObserverContext;
313
+ },
314
+ ): void => {
315
+ const MOCK__applicationStore = new ApplicationStore(
316
+ TEST__getGenericApplicationConfig(),
317
+ pluginManager,
318
+ );
319
+
320
+ render(
321
+ <ApplicationStoreProvider store={MOCK__applicationStore}>
322
+ <TEST__BrowserEnvironmentProvider initialEntries={['/']}>
323
+ <ApplicationFrameworkProvider>
324
+ <Routes>
325
+ <Route
326
+ path="*"
327
+ element={<BasicValueSpecificationEditor {...props} />}
328
+ />
329
+ </Routes>
330
+ </ApplicationFrameworkProvider>
331
+ </TEST__BrowserEnvironmentProvider>
332
+ </ApplicationStoreProvider>,
333
+ );
334
+ };
335
+
336
+ export const TEST__setUpV1BasicValueSpecificationEditor = (
337
+ pluginManager: TEST__LegendApplicationPluginManager,
338
+ props: {
339
+ valueSpecification: V1_ValueSpecification;
340
+ setValueSpecification: (val: V1_ValueSpecification) => void;
341
+ multiplicity: V1_Multiplicity;
342
+ typeCheckOption: V1_TypeCheckOption;
343
+ resetValue: () => void;
344
+ enumeration?: V1_Enumeration | undefined;
345
+ },
346
+ ): void => {
347
+ const MOCK__applicationStore = new ApplicationStore(
348
+ TEST__getGenericApplicationConfig(),
349
+ pluginManager,
350
+ );
351
+
352
+ render(
353
+ <ApplicationStoreProvider store={MOCK__applicationStore}>
354
+ <TEST__BrowserEnvironmentProvider initialEntries={['/']}>
355
+ <ApplicationFrameworkProvider>
356
+ <Routes>
357
+ <Route
358
+ path="*"
359
+ element={<V1_BasicValueSpecificationEditor {...props} />}
360
+ />
361
+ </Routes>
362
+ </ApplicationFrameworkProvider>
363
+ </TEST__BrowserEnvironmentProvider>
364
+ </ApplicationStoreProvider>,
365
+ );
366
+ };
@@ -446,7 +446,7 @@ const QueryBuilderPostFilterConditionEditor = observer(
446
446
  ),
447
447
  }}
448
448
  resetValue={resetNode}
449
- selectorConfig={selectorConfig}
449
+ selectorSearchConfig={selectorConfig}
450
450
  isConstant={queryBuilderState.constantState.isValueSpecConstant(
451
451
  rightConditionValue.value,
452
452
  )}
@@ -1046,7 +1046,7 @@ const QueryBuilderFilterConditionEditor = observer(
1046
1046
  .func.value.genericType.value.rawType,
1047
1047
  }}
1048
1048
  resetValue={resetNode}
1049
- selectorConfig={selectorConfig}
1049
+ selectorSearchConfig={selectorConfig}
1050
1050
  isConstant={queryBuilderState.constantState.isValueSpecConstant(
1051
1051
  rightConditionValue.value,
1052
1052
  )}