@finos/legend-query-builder 4.13.3 → 4.13.5

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 (42) hide show
  1. package/lib/__lib__/QueryBuilderTesting.d.ts +6 -4
  2. package/lib/__lib__/QueryBuilderTesting.d.ts.map +1 -1
  3. package/lib/__lib__/QueryBuilderTesting.js +6 -3
  4. package/lib/__lib__/QueryBuilderTesting.js.map +1 -1
  5. package/lib/components/data-access/DataAccessOverview.d.ts.map +1 -1
  6. package/lib/components/data-access/DataAccessOverview.js +47 -34
  7. package/lib/components/data-access/DataAccessOverview.js.map +1 -1
  8. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
  9. package/lib/components/explorer/QueryBuilderExplorerPanel.js +2 -1
  10. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  11. package/lib/components/result/tds/QueryBuilderTDSGridResult.d.ts.map +1 -1
  12. package/lib/components/result/tds/QueryBuilderTDSGridResult.js +2 -1
  13. package/lib/components/result/tds/QueryBuilderTDSGridResult.js.map +1 -1
  14. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.d.ts.map +1 -1
  15. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js +2 -1
  16. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js.map +1 -1
  17. package/lib/components/shared/QueryBuilderRootClassInfoTooltip.d.ts +24 -0
  18. package/lib/components/shared/QueryBuilderRootClassInfoTooltip.d.ts.map +1 -0
  19. package/lib/components/shared/QueryBuilderRootClassInfoTooltip.js +37 -0
  20. package/lib/components/shared/QueryBuilderRootClassInfoTooltip.js.map +1 -0
  21. package/lib/index.css +2 -2
  22. package/lib/index.css.map +1 -1
  23. package/lib/package.json +1 -1
  24. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  25. package/lib/stores/QueryBuilderResultState.js +1 -0
  26. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  27. package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts +7 -0
  28. package/lib/stores/QueryBuilder_LegendApplicationPlugin_Extension.d.ts.map +1 -1
  29. package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
  30. package/lib/stores/filter/QueryBuilderFilterState.js +13 -2
  31. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  32. package/package.json +8 -8
  33. package/src/__lib__/QueryBuilderTesting.ts +6 -3
  34. package/src/components/data-access/DataAccessOverview.tsx +60 -28
  35. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +11 -1
  36. package/src/components/result/tds/QueryBuilderTDSGridResult.tsx +5 -1
  37. package/src/components/result/tds/QueryBuilderTDSSimpleGridResult.tsx +5 -1
  38. package/src/components/shared/QueryBuilderRootClassInfoTooltip.tsx +79 -0
  39. package/src/stores/QueryBuilderResultState.ts +1 -0
  40. package/src/stores/QueryBuilder_LegendApplicationPlugin_Extension.ts +9 -0
  41. package/src/stores/filter/QueryBuilderFilterState.ts +21 -1
  42. package/tsconfig.json +1 -0
@@ -44,6 +44,7 @@ import { QueryBuilderTDSState } from '../../../stores/fetch-structure/tds/QueryB
44
44
  import { DEFAULT_LOCALE } from '../../../graph-manager/QueryBuilderConst.js';
45
45
  import { isNumber, isString, isValidURL } from '@finos/legend-shared';
46
46
  import { useApplicationStore } from '@finos/legend-application';
47
+ import { QUERY_BUILDER_TEST_ID } from '../../../__lib__/QueryBuilderTesting.js';
47
48
 
48
49
  const getAggregationTDSColumnCustomizations = (
49
50
  result: TDSExecutionResult,
@@ -332,7 +333,10 @@ export const QueryBuilderTDSGridResult = observer(
332
333
  );
333
334
 
334
335
  return (
335
- <div className="query-builder__result__values__table">
336
+ <div
337
+ data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_RESULT_VALUES_TDS}
338
+ className="query-builder__result__values__table"
339
+ >
336
340
  <div
337
341
  className={clsx(
338
342
  'ag-theme-balham-dark query-builder__result__tds-grid',
@@ -39,6 +39,7 @@ import type {
39
39
  QueryBuilderTDSResultCellDataType,
40
40
  QueryBuilderTDSRowDataType,
41
41
  } from '../../../stores/QueryBuilderResultState.js';
42
+ import { QUERY_BUILDER_TEST_ID } from '../../../__lib__/QueryBuilderTesting.js';
42
43
 
43
44
  const QueryResultCellRenderer = observer(
44
45
  (params: IQueryRendererParamsWithGridType) => {
@@ -358,7 +359,10 @@ export const QueryBuilderTDSSimpleGridResult = observer(
358
359
  );
359
360
 
360
361
  return (
361
- <div className="query-builder__result__values__table">
362
+ <div
363
+ data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_RESULT_VALUES_TDS}
364
+ className="query-builder__result__values__table"
365
+ >
362
366
  <div
363
367
  className={clsx(
364
368
  'ag-theme-balham-dark query-builder__result__tds-grid',
@@ -0,0 +1,79 @@
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 { type TooltipPlacement, Tooltip } from '@finos/legend-art';
18
+ import { CORE_PURE_PATH, PURE_DOC_TAG, type Class } from '@finos/legend-graph';
19
+
20
+ export const QueryBuilderRootClassInfoTooltip: React.FC<{
21
+ _class: Class;
22
+ children: React.ReactElement;
23
+ placement?: TooltipPlacement | undefined;
24
+ }> = (props) => {
25
+ const { _class, children, placement } = props;
26
+ const documentation = _class.taggedValues
27
+ .filter(
28
+ (taggedValue) =>
29
+ taggedValue.tag.ownerReference.value.path ===
30
+ CORE_PURE_PATH.PROFILE_DOC &&
31
+ taggedValue.tag.value.value === PURE_DOC_TAG,
32
+ )
33
+ .map((taggedValue) => taggedValue.value);
34
+
35
+ return (
36
+ <Tooltip
37
+ arrow={true}
38
+ {...(placement !== undefined ? { placement } : {})}
39
+ classes={{
40
+ tooltip: 'query-builder__tooltip',
41
+ arrow: 'query-builder__tooltip__arrow',
42
+ tooltipPlacementRight: 'query-builder__tooltip--right',
43
+ }}
44
+ TransitionProps={{
45
+ // disable transition
46
+ // NOTE: somehow, this is the only workaround we have, if for example
47
+ // we set `appear = true`, the tooltip will jump out of position
48
+ timeout: 0,
49
+ }}
50
+ title={
51
+ <div className="query-builder__tooltip__content">
52
+ <div className="query-builder__tooltip__item">
53
+ <div className="query-builder__tooltip__item__label">Type</div>
54
+ <div className="query-builder__tooltip__item__value">Unknown</div>
55
+ </div>
56
+ <div className="query-builder__tooltip__item">
57
+ <div className="query-builder__tooltip__item__label">Path</div>
58
+ <div className="query-builder__tooltip__item__value">
59
+ {_class.path}
60
+ </div>
61
+ </div>
62
+
63
+ {Boolean(documentation.length) && (
64
+ <div className="query-builder__tooltip__item">
65
+ <div className="query-builder__tooltip__item__label">
66
+ Documentation
67
+ </div>
68
+ <div className="query-builder__tooltip__item__value">
69
+ {documentation.join('\n\n')}
70
+ </div>
71
+ </div>
72
+ )}
73
+ </div>
74
+ }
75
+ >
76
+ {children}
77
+ </Tooltip>
78
+ );
79
+ };
@@ -316,6 +316,7 @@ export class QueryBuilderResultState {
316
316
  this.queryBuilderState.graphManagerState.graph,
317
317
  {
318
318
  parameterValues,
319
+ convertUnsafeNumbersToString: true,
319
320
  },
320
321
  );
321
322
 
@@ -45,6 +45,10 @@ export type QueryExportUsageConfiguration = {
45
45
  renderer(): React.ReactNode;
46
46
  };
47
47
 
48
+ export type WarehouseEntitlementRender = {
49
+ renderer: (dataAccessState: DataAccessState) => React.ReactNode | undefined;
50
+ };
51
+
48
52
  export type QueryChatRenderer = (
49
53
  queryBuilderState: QueryBuilderState,
50
54
  ) => React.ReactNode;
@@ -56,6 +60,11 @@ export interface QueryBuilder_LegendApplicationPlugin_Extension
56
60
  */
57
61
  getExtraLoadQueryFilterOptions?(): LoadQueryFilterOption[];
58
62
 
63
+ /**
64
+ * Get the list of warehouse entitlement configurations
65
+ */
66
+ getWarehouseEntitlementRenders?(): WarehouseEntitlementRender[] | undefined;
67
+
59
68
  /**
60
69
  * Get the list of dataset entitlement access report action configurations.
61
70
  */
@@ -42,6 +42,8 @@ import {
42
42
  type ValueSpecification,
43
43
  type VariableExpression,
44
44
  observe_ValueSpecification,
45
+ CollectionInstanceValue,
46
+ InstanceValue,
45
47
  } from '@finos/legend-graph';
46
48
  import { DEFAULT_LAMBDA_VARIABLE_NAME } from '../QueryBuilderConfig.js';
47
49
  import type { QueryBuilderProjectionColumnDragSource } from '../fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js';
@@ -54,6 +56,7 @@ import type { QueryBuilderFilterOperator } from './QueryBuilderFilterOperator.js
54
56
  import { QUERY_BUILDER_GROUP_OPERATION } from '../QueryBuilderGroupOperationHelper.js';
55
57
  import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../QueryBuilderStateHashUtils.js';
56
58
  import { isValueExpressionReferencedInValue } from '../QueryBuilderValueSpecificationHelper.js';
59
+ import { instanceValue_setValues } from '../shared/ValueSpecificationModifierHelper.js';
57
60
 
58
61
  export enum QUERY_BUILDER_FILTER_DND_TYPE {
59
62
  GROUP_CONDITION = 'GROUP_CONDITION',
@@ -195,7 +198,24 @@ export class FilterConditionState implements Hashable {
195
198
  changeOperator(val: QueryBuilderFilterOperator): void {
196
199
  this.setOperator(val);
197
200
  if (!this.operator.isCompatibleWithFilterConditionValue(this)) {
198
- this.setValue(this.operator.getDefaultFilterConditionValue(this));
201
+ let defaultValue = this.operator.getDefaultFilterConditionValue(this);
202
+ if (
203
+ defaultValue instanceof CollectionInstanceValue &&
204
+ this.value instanceof InstanceValue
205
+ ) {
206
+ instanceValue_setValues(
207
+ defaultValue,
208
+ [this.value],
209
+ this.filterState.queryBuilderState.observerContext,
210
+ );
211
+ } else if (
212
+ defaultValue instanceof InstanceValue &&
213
+ this.value instanceof CollectionInstanceValue &&
214
+ this.value.values.length
215
+ ) {
216
+ defaultValue = this.value.values[0];
217
+ }
218
+ this.setValue(defaultValue);
199
219
  }
200
220
  }
201
221
 
package/tsconfig.json CHANGED
@@ -266,6 +266,7 @@
266
266
  "./src/components/shared/LambdaParameterValuesEditor.tsx",
267
267
  "./src/components/shared/QueryBuilderPanelIssueCountBadge.tsx",
268
268
  "./src/components/shared/QueryBuilderPropertyInfoTooltip.tsx",
269
+ "./src/components/shared/QueryBuilderRootClassInfoTooltip.tsx",
269
270
  "./src/components/shared/QueryBuilderVariableSelector.tsx",
270
271
  "./src/components/watermark/QueryBuilderWatermark.tsx",
271
272
  "./src/components/workflows/ClassQueryBuilder.tsx",