@reltio/components 1.4.1852 → 1.4.1854
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.
- package/cjs/AttributesFiltersBuilder/AttributesFiltersBuilder.js +1 -1
- package/cjs/ConnectionEditor/ConnectionEditor.d.ts +3 -3
- package/cjs/ConnectionEditor/ConnectionEditor.test.js +2 -2
- package/cjs/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.d.ts +14 -34
- package/cjs/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.js +1 -20
- package/cjs/DependentLookupEditor/DependentLookupEditor.d.ts +27 -44
- package/cjs/DependentLookupEditor/DependentLookupEditor.js +3 -21
- package/cjs/DropDownEditor/DropDownEditor.d.ts +14 -15
- package/cjs/DropDownEditor/DropDownEditor.js +0 -6
- package/cjs/EditModeAttributesList/EditModeAttributesList.d.ts +14 -3
- package/cjs/EditModeAttributesList/EditModeAttributesList.js +0 -20
- package/cjs/EditModeAttributesPager/EditModeAttributesPager.d.ts +3 -2
- package/cjs/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.d.ts +2 -3
- package/cjs/EditModeAttributesPager/types.d.ts +7 -6
- package/cjs/EditModeComplexAttribute/EditModeComplexAttribute.d.ts +41 -4
- package/cjs/EditModeComplexAttribute/EditModeComplexAttribute.js +6 -17
- package/cjs/EditModeComplexAttribute/index.d.ts +1 -0
- package/cjs/EntitySelector/EntitySelector.d.ts +19 -31
- package/cjs/EntitySelector/EntitySelector.js +0 -14
- package/cjs/EntitySelector/components/EntityOption/EntityOption.d.ts +17 -22
- package/cjs/EntitySelector/components/EntityOption/EntityOption.js +0 -18
- package/cjs/ErrorWrapper/ErrorWrapper.d.ts +2 -2
- package/cjs/FilterEditor/FilterEditor.d.ts +16 -23
- package/cjs/FilterEditor/FilterEditor.js +2 -14
- package/cjs/FilterValueEditor/FilterValueEditor.d.ts +14 -24
- package/cjs/FilterValueEditor/FilterValueEditor.js +0 -9
- package/cjs/HOCs/withFilter/ColumnFilter.js +1 -1
- package/cjs/LookupEditor/LookupEditor.d.ts +11 -33
- package/cjs/LookupEditor/LookupEditor.js +1 -14
- package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.d.ts +11 -21
- package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.js +0 -7
- package/cjs/LookupEditor/components/GroupedDropDownEditor/helpers.d.ts +9 -2
- package/cjs/LookupEditor/components/GroupedDropDownEditor/helpers.js +7 -7
- package/cjs/LookupEditor/components/GroupedDropDownEditor/styles.d.ts +1 -1
- package/cjs/NestedAttribute/NestedAttribute.d.ts +4 -124
- package/cjs/NestedAttribute/NestedAttribute.js +0 -1
- package/cjs/NestedAttributeEditor/NestedAttributeEditor.d.ts +5 -1
- package/cjs/NestedAttributeEditor/NestedAttributeEditor.js +0 -1
- package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +14 -44
- package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +0 -12
- package/cjs/ReadOnlyComplexAttribute/index.d.ts +1 -0
- package/cjs/ReferenceAttribute/ReferenceAttribute.d.ts +3 -24
- package/cjs/ReferenceAttribute/ReferenceAttribute.test.js +2 -2
- package/cjs/ReferenceAttributeEditor/ReferenceAttributeEditor.d.ts +5 -2
- package/cjs/ReferenceAttributeEditor/ReferenceAttributeEditor.js +2 -3
- package/cjs/RelationTypeSelector/RelationTypeSelector.d.ts +9 -26
- package/cjs/RelationTypeSelector/RelationTypeSelector.js +2 -14
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.d.ts +39 -16
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.js +0 -17
- package/cjs/SimpleAttributeEditor/useAttributeValuePermissions.d.ts +1 -1
- package/cjs/components/ImageDetailsView/helpers/index.d.ts +5 -2
- package/cjs/components/ImportButton/ImportButton.d.ts +2 -1
- package/cjs/components/MultipliableSelect/MultipliableSelect.d.ts +20 -30
- package/cjs/components/MultipliableSelect/MultipliableSelect.js +0 -15
- package/cjs/components/ProfileBand/styles.d.ts +1 -1
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.d.ts +43 -107
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +0 -25
- package/cjs/components/QueryBuilderRow/components/ReadOnlyFilter.d.ts +4 -3
- package/cjs/components/QueryBuilderRow/components/ReadOnlyLogicOperator.d.ts +4 -10
- package/cjs/components/QueryBuilderRow/components/ReadOnlyLogicOperator.js +1 -6
- package/cjs/components/QueryBuilderRowsGroup/QueryBuilderRowsGroup.d.ts +33 -64
- package/cjs/components/QueryBuilderRowsGroup/QueryBuilderRowsGroup.js +3 -51
- package/cjs/components/ReactSelect/AsyncSelect.d.ts +0 -45
- package/cjs/components/ReactSelect/CreatableSelect.d.ts +0 -45
- package/cjs/components/ReactSelect/Select.d.ts +0 -45
- package/cjs/components/ReactSelect/withMuiSkin.d.ts +3 -48
- package/cjs/components/ReactSelect/withMuiSkin.js +0 -50
- package/cjs/components/ReactSortableTree/node-renderer-default.d.ts +2 -2
- package/cjs/components/ReadableSearchQuery/ReadableSearchQuery.d.ts +2 -4
- package/cjs/components/SearchInput/SearchInput.d.ts +1 -1
- package/cjs/components/SelectionPopup/SelectionPopup.d.ts +1 -1
- package/cjs/constants/index.d.ts +1 -1
- package/cjs/constants/index.js +1 -4
- package/cjs/constants/prop-types.d.ts +0 -81
- package/cjs/constants/prop-types.js +17 -46
- package/cjs/constants/textField.d.ts +2 -2
- package/cjs/contexts/ScrollToElementContext/index.d.ts +1 -1
- package/cjs/features/graph/DataModelGraph/DataModelGraph.d.ts +6 -5
- package/cjs/features/graph/DataModelGraph/DataModelGraph.js +4 -3
- package/cjs/features/graph/DataModelGraph/DataModelGraph.test.js +3 -8
- package/cjs/features/graph/DataModelGraph/components/DataModelCircleLayout/{DataModelCircleLayuot.d.ts → DataModelCircleLayout.d.ts} +2 -2
- package/cjs/features/graph/DataModelGraph/components/DataModelCircleLayout/{DataModelCircleLayuot.js → DataModelCircleLayout.js} +5 -7
- package/cjs/features/graph/DataModelGraph/hooks/defaultGraph.test-data.js +4 -2
- package/cjs/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.d.ts +6 -5
- package/cjs/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.js +43 -13
- package/cjs/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.test.js +39 -17
- package/cjs/features/graph/DataModelGraph/hooks/useEdgeLabelsRenderer.js +4 -3
- package/cjs/features/graph/DataModelGraph/hooks/useEdgeLabelsRenderer.test.js +3 -3
- package/cjs/features/graph/index.d.ts +1 -1
- package/cjs/features/graph/rendering/canvas/label.js +1 -1
- package/cjs/features/graph/types/graphDataTypes.d.ts +2 -1
- package/cjs/helpers/basicTable.d.ts +2 -7
- package/cjs/hooks/useRelationTypeSelector.d.ts +12 -8
- package/cjs/hooks/useRelationTypeSelector.js +3 -1
- package/cjs/types/index.d.ts +19 -2
- package/esm/AttributesFiltersBuilder/AttributesFiltersBuilder.js +1 -1
- package/esm/ConnectionEditor/ConnectionEditor.d.ts +3 -3
- package/esm/ConnectionEditor/ConnectionEditor.test.js +2 -2
- package/esm/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.d.ts +14 -34
- package/esm/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.js +1 -17
- package/esm/DependentLookupEditor/DependentLookupEditor.d.ts +27 -44
- package/esm/DependentLookupEditor/DependentLookupEditor.js +4 -22
- package/esm/DropDownEditor/DropDownEditor.d.ts +14 -15
- package/esm/DropDownEditor/DropDownEditor.js +0 -6
- package/esm/EditModeAttributesList/EditModeAttributesList.d.ts +14 -3
- package/esm/EditModeAttributesList/EditModeAttributesList.js +1 -21
- package/esm/EditModeAttributesPager/EditModeAttributesPager.d.ts +3 -2
- package/esm/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.d.ts +2 -3
- package/esm/EditModeAttributesPager/types.d.ts +7 -6
- package/esm/EditModeComplexAttribute/EditModeComplexAttribute.d.ts +41 -4
- package/esm/EditModeComplexAttribute/EditModeComplexAttribute.js +7 -18
- package/esm/EditModeComplexAttribute/index.d.ts +1 -0
- package/esm/EntitySelector/EntitySelector.d.ts +19 -31
- package/esm/EntitySelector/EntitySelector.js +1 -15
- package/esm/EntitySelector/components/EntityOption/EntityOption.d.ts +17 -22
- package/esm/EntitySelector/components/EntityOption/EntityOption.js +0 -18
- package/esm/ErrorWrapper/ErrorWrapper.d.ts +2 -2
- package/esm/FilterEditor/FilterEditor.d.ts +16 -23
- package/esm/FilterEditor/FilterEditor.js +3 -15
- package/esm/FilterValueEditor/FilterValueEditor.d.ts +14 -24
- package/esm/FilterValueEditor/FilterValueEditor.js +1 -10
- package/esm/HOCs/withFilter/ColumnFilter.js +1 -1
- package/esm/LookupEditor/LookupEditor.d.ts +11 -33
- package/esm/LookupEditor/LookupEditor.js +1 -11
- package/esm/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.d.ts +11 -21
- package/esm/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.js +0 -7
- package/esm/LookupEditor/components/GroupedDropDownEditor/helpers.d.ts +9 -2
- package/esm/LookupEditor/components/GroupedDropDownEditor/helpers.js +7 -7
- package/esm/LookupEditor/components/GroupedDropDownEditor/styles.d.ts +1 -1
- package/esm/NestedAttribute/NestedAttribute.d.ts +4 -124
- package/esm/NestedAttribute/NestedAttribute.js +1 -2
- package/esm/NestedAttributeEditor/NestedAttributeEditor.d.ts +5 -1
- package/esm/NestedAttributeEditor/NestedAttributeEditor.js +1 -2
- package/esm/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.d.ts +14 -44
- package/esm/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.js +1 -13
- package/esm/ReadOnlyComplexAttribute/index.d.ts +1 -0
- package/esm/ReferenceAttribute/ReferenceAttribute.d.ts +3 -24
- package/esm/ReferenceAttribute/ReferenceAttribute.test.js +2 -2
- package/esm/ReferenceAttributeEditor/ReferenceAttributeEditor.d.ts +5 -2
- package/esm/ReferenceAttributeEditor/ReferenceAttributeEditor.js +3 -4
- package/esm/RelationTypeSelector/RelationTypeSelector.d.ts +9 -26
- package/esm/RelationTypeSelector/RelationTypeSelector.js +2 -14
- package/esm/SimpleAttributeEditor/SimpleAttributeEditor.d.ts +39 -16
- package/esm/SimpleAttributeEditor/SimpleAttributeEditor.js +1 -18
- package/esm/SimpleAttributeEditor/useAttributeValuePermissions.d.ts +1 -1
- package/esm/components/ImageDetailsView/helpers/index.d.ts +5 -2
- package/esm/components/ImportButton/ImportButton.d.ts +2 -1
- package/esm/components/MultipliableSelect/MultipliableSelect.d.ts +20 -30
- package/esm/components/MultipliableSelect/MultipliableSelect.js +0 -15
- package/esm/components/ProfileBand/styles.d.ts +1 -1
- package/esm/components/QueryBuilderRow/QueryBuilderRow.d.ts +43 -107
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +0 -25
- package/esm/components/QueryBuilderRow/components/ReadOnlyFilter.d.ts +4 -3
- package/esm/components/QueryBuilderRow/components/ReadOnlyLogicOperator.d.ts +4 -10
- package/esm/components/QueryBuilderRow/components/ReadOnlyLogicOperator.js +1 -6
- package/esm/components/QueryBuilderRowsGroup/QueryBuilderRowsGroup.d.ts +33 -64
- package/esm/components/QueryBuilderRowsGroup/QueryBuilderRowsGroup.js +3 -28
- package/esm/components/ReactSelect/AsyncSelect.d.ts +0 -45
- package/esm/components/ReactSelect/CreatableSelect.d.ts +0 -45
- package/esm/components/ReactSelect/Select.d.ts +0 -45
- package/esm/components/ReactSelect/withMuiSkin.d.ts +3 -48
- package/esm/components/ReactSelect/withMuiSkin.js +0 -50
- package/esm/components/ReactSortableTree/node-renderer-default.d.ts +2 -2
- package/esm/components/ReadableSearchQuery/ReadableSearchQuery.d.ts +2 -4
- package/esm/components/SearchInput/SearchInput.d.ts +1 -1
- package/esm/components/SelectionPopup/SelectionPopup.d.ts +1 -1
- package/esm/constants/index.d.ts +1 -1
- package/esm/constants/index.js +1 -1
- package/esm/constants/prop-types.d.ts +0 -81
- package/esm/constants/prop-types.js +17 -38
- package/esm/constants/textField.d.ts +2 -2
- package/esm/contexts/ScrollToElementContext/index.d.ts +1 -1
- package/esm/features/graph/DataModelGraph/DataModelGraph.d.ts +6 -5
- package/esm/features/graph/DataModelGraph/DataModelGraph.js +4 -3
- package/esm/features/graph/DataModelGraph/DataModelGraph.test.js +3 -8
- package/esm/features/graph/DataModelGraph/components/DataModelCircleLayout/{DataModelCircleLayuot.d.ts → DataModelCircleLayout.d.ts} +2 -2
- package/esm/features/graph/DataModelGraph/components/DataModelCircleLayout/{DataModelCircleLayuot.js → DataModelCircleLayout.js} +3 -5
- package/esm/features/graph/DataModelGraph/hooks/defaultGraph.test-data.js +4 -2
- package/esm/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.d.ts +6 -5
- package/esm/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.js +44 -14
- package/esm/features/graph/DataModelGraph/hooks/useDataModelGraphAppearance.test.js +40 -18
- package/esm/features/graph/DataModelGraph/hooks/useEdgeLabelsRenderer.js +4 -3
- package/esm/features/graph/DataModelGraph/hooks/useEdgeLabelsRenderer.test.js +3 -3
- package/esm/features/graph/index.d.ts +1 -1
- package/esm/features/graph/rendering/canvas/label.js +1 -1
- package/esm/features/graph/types/graphDataTypes.d.ts +2 -1
- package/esm/helpers/basicTable.d.ts +2 -7
- package/esm/hooks/useRelationTypeSelector.d.ts +12 -8
- package/esm/hooks/useRelationTypeSelector.js +3 -1
- package/esm/types/index.d.ts +19 -2
- package/package.json +2 -2
|
@@ -3,66 +3,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.QueryBuilderAttributeType = exports.
|
|
6
|
+
exports.QueryBuilderAttributeType = exports.SortingType = void 0;
|
|
7
7
|
var prop_types_1 = __importDefault(require("prop-types"));
|
|
8
|
-
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
9
|
-
var SelectValueType = prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.number, prop_types_1.default.object]);
|
|
10
|
-
exports.SelectValueType = SelectValueType;
|
|
11
|
-
var DropDownEntryType = prop_types_1.default.shape({
|
|
12
|
-
value: SelectValueType.isRequired,
|
|
13
|
-
label: prop_types_1.default.string
|
|
14
|
-
});
|
|
15
|
-
exports.DropDownEntryType = DropDownEntryType;
|
|
16
|
-
var DropDownGroupEntryType = prop_types_1.default.shape({
|
|
17
|
-
label: prop_types_1.default.string.isRequired,
|
|
18
|
-
values: prop_types_1.default.arrayOf(prop_types_1.default.object).isRequired
|
|
19
|
-
});
|
|
20
|
-
exports.DropDownGroupEntryType = DropDownGroupEntryType;
|
|
21
|
-
var ColumnDataType = prop_types_1.default.shape({
|
|
22
|
-
id: prop_types_1.default.string,
|
|
23
|
-
label: prop_types_1.default.string,
|
|
24
|
-
dataTypeDefinition: prop_types_1.default.object,
|
|
25
|
-
resizable: prop_types_1.default.bool,
|
|
26
|
-
sortable: prop_types_1.default.bool,
|
|
27
|
-
filterable: prop_types_1.default.bool,
|
|
28
|
-
headCellRenderer: prop_types_1.default.func,
|
|
29
|
-
rowCellValueRenderer: prop_types_1.default.func,
|
|
30
|
-
nestedPath: prop_types_1.default.arrayOf(prop_types_1.default.string)
|
|
31
|
-
});
|
|
32
|
-
exports.ColumnDataType = ColumnDataType;
|
|
33
8
|
var SortingType = prop_types_1.default.shape({
|
|
34
9
|
field: prop_types_1.default.string,
|
|
35
|
-
order:
|
|
10
|
+
order: prop_types_1.default.oneOf(['asc', 'desc'])
|
|
36
11
|
});
|
|
37
12
|
exports.SortingType = SortingType;
|
|
38
|
-
var
|
|
39
|
-
value: prop_types_1.default.oneOfType([mdm_sdk_1.FilterValueType, prop_types_1.default.arrayOf(mdm_sdk_1.FilterValueType)]),
|
|
40
|
-
filter: prop_types_1.default.string
|
|
41
|
-
});
|
|
42
|
-
exports.ColumnFilterType = ColumnFilterType;
|
|
43
|
-
var PlainColumnsDataType = prop_types_1.default.arrayOf(prop_types_1.default.shape({
|
|
44
|
-
id: prop_types_1.default.string,
|
|
45
|
-
label: prop_types_1.default.string,
|
|
46
|
-
dataTypeDefinition: prop_types_1.default.object
|
|
47
|
-
}));
|
|
48
|
-
var GroupedColumnsDataType = prop_types_1.default.arrayOf(prop_types_1.default.shape({
|
|
49
|
-
id: prop_types_1.default.string,
|
|
13
|
+
var AttrType = prop_types_1.default.shape({
|
|
50
14
|
label: prop_types_1.default.string,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
15
|
+
name: prop_types_1.default.string,
|
|
16
|
+
description: prop_types_1.default.string,
|
|
17
|
+
type: prop_types_1.default.string,
|
|
18
|
+
hidden: prop_types_1.default.bool,
|
|
19
|
+
faceted: prop_types_1.default.bool,
|
|
20
|
+
searchable: prop_types_1.default.bool,
|
|
21
|
+
uri: prop_types_1.default.string,
|
|
22
|
+
access: prop_types_1.default.arrayOf(prop_types_1.default.string),
|
|
23
|
+
cardinality: prop_types_1.default.shape({
|
|
24
|
+
minValue: prop_types_1.default.number,
|
|
25
|
+
maxValue: prop_types_1.default.number
|
|
26
|
+
})
|
|
27
|
+
});
|
|
56
28
|
var QueryBuilderAttributeDataType = prop_types_1.default.shape({
|
|
57
29
|
title: prop_types_1.default.string,
|
|
58
30
|
pathToTitle: prop_types_1.default.arrayOf(prop_types_1.default.string),
|
|
59
31
|
fieldName: prop_types_1.default.string,
|
|
60
32
|
entityTypeUri: prop_types_1.default.string,
|
|
61
|
-
attrType:
|
|
33
|
+
attrType: AttrType,
|
|
62
34
|
uri: prop_types_1.default.string,
|
|
63
35
|
groupName: prop_types_1.default.string
|
|
64
36
|
});
|
|
65
|
-
exports.QueryBuilderAttributeDataType = QueryBuilderAttributeDataType;
|
|
66
37
|
var QueryBuilderAttributeType = prop_types_1.default.shape({
|
|
67
38
|
id: prop_types_1.default.oneOfType([prop_types_1.default.number, prop_types_1.default.string]),
|
|
68
39
|
values: prop_types_1.default.array,
|
|
@@ -6,7 +6,7 @@ export declare enum ScrollType {
|
|
|
6
6
|
NewView = "NewView"
|
|
7
7
|
}
|
|
8
8
|
type ScrollToElementContextProps = {
|
|
9
|
-
element:
|
|
9
|
+
element: AttributeError | AttributeType | string;
|
|
10
10
|
type: ScrollType;
|
|
11
11
|
highlightError?: (element: AttributeError) => void;
|
|
12
12
|
highlightAttribute?: (element: AttributeType) => void;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Graph from 'graphology';
|
|
3
|
+
import { DataModelGraphEdgeAttributes, DataModelGraphNodeAttributes } from '../types/graphDataTypes';
|
|
3
4
|
type Props = {
|
|
4
|
-
graph
|
|
5
|
+
graph: Graph<Partial<DataModelGraphNodeAttributes>, Partial<DataModelGraphEdgeAttributes>>;
|
|
5
6
|
children?: React.ReactNode;
|
|
6
7
|
selectedNode?: string;
|
|
7
|
-
onNodeClick
|
|
8
|
-
|
|
9
|
-
onEdgeLabelClick
|
|
8
|
+
onNodeClick?: (nodeId: string) => void;
|
|
9
|
+
selectedEdges?: string[];
|
|
10
|
+
onEdgeLabelClick?: (edgeId: string, event: MouseEvent) => void;
|
|
10
11
|
hideInteractionTypes?: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare const DataModelGraph: ({ graph, children, selectedNode, onNodeClick,
|
|
13
|
+
export declare const DataModelGraph: ({ graph, children, selectedNode, onNodeClick, selectedEdges, onEdgeLabelClick, hideInteractionTypes }: Props) => JSX.Element;
|
|
13
14
|
export default DataModelGraph;
|
|
@@ -5,8 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DataModelGraph = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var core_1 = require("../../../core");
|
|
8
9
|
var SigmaGraphContainer_1 = require("../SigmaGraphContainer/SigmaGraphContainer");
|
|
9
|
-
var
|
|
10
|
+
var DataModelCircleLayout_1 = require("./components/DataModelCircleLayout/DataModelCircleLayout");
|
|
10
11
|
var ZoomSlider_1 = require("../ZoomSlider");
|
|
11
12
|
var styles_1 = require("./styles");
|
|
12
13
|
var settings = {
|
|
@@ -14,12 +15,12 @@ var settings = {
|
|
|
14
15
|
zIndex: true
|
|
15
16
|
};
|
|
16
17
|
var DataModelGraph = function (_a) {
|
|
17
|
-
var graph = _a.graph, children = _a.children, selectedNode = _a.selectedNode,
|
|
18
|
+
var graph = _a.graph, children = _a.children, selectedNode = _a.selectedNode, _b = _a.onNodeClick, onNodeClick = _b === void 0 ? core_1.noop : _b, selectedEdges = _a.selectedEdges, _c = _a.onEdgeLabelClick, onEdgeLabelClick = _c === void 0 ? core_1.noop : _c, hideInteractionTypes = _a.hideInteractionTypes;
|
|
18
19
|
var styles = (0, styles_1.useStyles)();
|
|
19
20
|
return (react_1.default.createElement("div", { className: styles.wrapper },
|
|
20
21
|
react_1.default.createElement("div", { className: styles.graph }, graph && (react_1.default.createElement(SigmaGraphContainer_1.SigmaGraphContainer, { initialSettings: settings },
|
|
21
22
|
react_1.default.createElement(react_1.default.Fragment, null,
|
|
22
|
-
react_1.default.createElement(
|
|
23
|
+
react_1.default.createElement(DataModelCircleLayout_1.DataModelCircleLayout, { graph: graph, selectedNode: selectedNode, onNodeClick: onNodeClick, selectedEdges: selectedEdges, onEdgeLabelClick: onEdgeLabelClick, hideInteractionTypes: hideInteractionTypes }),
|
|
23
24
|
react_1.default.createElement("div", { className: styles.rightBottomControls },
|
|
24
25
|
react_1.default.createElement(ZoomSlider_1.ZoomSlider, { className: styles.zoomSlider, min: 30, max: 300 })))))),
|
|
25
26
|
children));
|
|
@@ -8,7 +8,6 @@ var graphology_1 = __importDefault(require("graphology"));
|
|
|
8
8
|
var react_2 = require("@testing-library/react");
|
|
9
9
|
var DataModelGraph_1 = require("../DataModelGraph");
|
|
10
10
|
var useDataModelGraphAppearance_1 = require("./hooks/useDataModelGraphAppearance");
|
|
11
|
-
var useFakeCenterNode_1 = require("./hooks/useFakeCenterNode");
|
|
12
11
|
var useCircleLayout_1 = require("../hooks/useCircleLayout");
|
|
13
12
|
jest.mock('@react-sigma/core', function () { return ({
|
|
14
13
|
SigmaContainer: function (_a) {
|
|
@@ -29,9 +28,6 @@ jest.mock('../hooks/useSigmaCustomRenderers', function () { return ({
|
|
|
29
28
|
jest.mock('./hooks/useDataModelGraphAppearance', function () { return ({
|
|
30
29
|
useDataModelGraphAppearance: jest.fn()
|
|
31
30
|
}); });
|
|
32
|
-
jest.mock('./hooks/useFakeCenterNode', function () { return ({
|
|
33
|
-
useFakeCenterNode: jest.fn()
|
|
34
|
-
}); });
|
|
35
31
|
jest.mock('../ZoomSlider', function () { return ({
|
|
36
32
|
ZoomSlider: function () { return react_1.default.createElement("div", null, "ZoomSlider"); }
|
|
37
33
|
}); });
|
|
@@ -39,10 +35,10 @@ describe('DataModelGraph tests', function () {
|
|
|
39
35
|
var graph = new graphology_1.default();
|
|
40
36
|
var selectedNode = 'node1';
|
|
41
37
|
var onNodeClick = jest.fn();
|
|
42
|
-
var
|
|
38
|
+
var selectedEdges = ['edge1'];
|
|
43
39
|
var onEdgeLabelClick = jest.fn();
|
|
44
40
|
var setUp = function () {
|
|
45
|
-
(0, react_2.render)(react_1.default.createElement(DataModelGraph_1.DataModelGraph, { graph: graph, selectedNode: selectedNode, onNodeClick: onNodeClick,
|
|
41
|
+
(0, react_2.render)(react_1.default.createElement(DataModelGraph_1.DataModelGraph, { graph: graph, selectedNode: selectedNode, onNodeClick: onNodeClick, selectedEdges: selectedEdges, onEdgeLabelClick: onEdgeLabelClick, hideInteractionTypes: false }));
|
|
46
42
|
};
|
|
47
43
|
afterEach(function () {
|
|
48
44
|
jest.clearAllMocks();
|
|
@@ -52,11 +48,10 @@ describe('DataModelGraph tests', function () {
|
|
|
52
48
|
expect(useDataModelGraphAppearance_1.useDataModelGraphAppearance).toHaveBeenCalledWith(expect.objectContaining({
|
|
53
49
|
graph: graph,
|
|
54
50
|
selectedNode: selectedNode,
|
|
55
|
-
|
|
51
|
+
selectedEdges: selectedEdges,
|
|
56
52
|
onNodeClick: onNodeClick,
|
|
57
53
|
onEdgeLabelClick: onEdgeLabelClick
|
|
58
54
|
}));
|
|
59
|
-
expect(useFakeCenterNode_1.useFakeCenterNode).toHaveBeenCalledWith(expect.objectContaining({ graph: graph, timeout: 3100 }));
|
|
60
55
|
expect(useCircleLayout_1.useCircleLayout).toHaveBeenCalledWith(expect.objectContaining({ graph: graph, animationDuration: 3000 }));
|
|
61
56
|
expect(react_2.screen.getByText('ZoomSlider')).toBeInTheDocument();
|
|
62
57
|
});
|
|
@@ -3,10 +3,10 @@ type Props = {
|
|
|
3
3
|
graph: Graph;
|
|
4
4
|
selectedNode?: string;
|
|
5
5
|
onNodeClick: (nodeId: string) => void;
|
|
6
|
-
|
|
6
|
+
selectedEdges?: string[];
|
|
7
7
|
onEdgeLabelClick: (edgeId: string, event: MouseEvent) => void;
|
|
8
8
|
hideInteractionTypes?: boolean;
|
|
9
9
|
};
|
|
10
10
|
export declare const LAYOUT_ANIMATION_DURATION = 3000;
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const DataModelCircleLayout: ({ graph, selectedNode, onNodeClick, selectedEdges, onEdgeLabelClick, hideInteractionTypes }: Props) => any;
|
|
12
12
|
export {};
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DataModelCircleLayout = exports.LAYOUT_ANIMATION_DURATION = void 0;
|
|
4
4
|
var useCircleLayout_1 = require("../../../hooks/useCircleLayout");
|
|
5
|
-
var useFakeCenterNode_1 = require("../../hooks/useFakeCenterNode");
|
|
6
5
|
var useDataModelGraphAppearance_1 = require("../../hooks/useDataModelGraphAppearance");
|
|
7
6
|
exports.LAYOUT_ANIMATION_DURATION = 3000;
|
|
8
|
-
var
|
|
9
|
-
var graph = _a.graph, selectedNode = _a.selectedNode, onNodeClick = _a.onNodeClick,
|
|
10
|
-
(0, useFakeCenterNode_1.useFakeCenterNode)({ graph: graph, timeout: exports.LAYOUT_ANIMATION_DURATION + 100 });
|
|
7
|
+
var DataModelCircleLayout = function (_a) {
|
|
8
|
+
var graph = _a.graph, selectedNode = _a.selectedNode, onNodeClick = _a.onNodeClick, selectedEdges = _a.selectedEdges, onEdgeLabelClick = _a.onEdgeLabelClick, hideInteractionTypes = _a.hideInteractionTypes;
|
|
11
9
|
(0, useCircleLayout_1.useCircleLayout)({ graph: graph, animationDuration: exports.LAYOUT_ANIMATION_DURATION });
|
|
12
10
|
(0, useDataModelGraphAppearance_1.useDataModelGraphAppearance)({
|
|
13
11
|
graph: graph,
|
|
14
12
|
selectedNode: selectedNode,
|
|
15
|
-
|
|
13
|
+
selectedEdges: selectedEdges,
|
|
16
14
|
onNodeClick: onNodeClick,
|
|
17
15
|
onEdgeLabelClick: onEdgeLabelClick,
|
|
18
16
|
hideInteractionTypes: hideInteractionTypes
|
|
19
17
|
});
|
|
20
18
|
return null;
|
|
21
19
|
};
|
|
22
|
-
exports.
|
|
20
|
+
exports.DataModelCircleLayout = DataModelCircleLayout;
|
|
@@ -39,10 +39,12 @@ var createDefaultGraph = function () {
|
|
|
39
39
|
y: 200
|
|
40
40
|
});
|
|
41
41
|
graph.addEdgeWithKey('hcp->hca', 'hcp', 'hca', {
|
|
42
|
-
label: '1'
|
|
42
|
+
label: '1',
|
|
43
|
+
relationTypes: [{ uri: 'relType1' }]
|
|
43
44
|
});
|
|
44
45
|
graph.addEdgeWithKey('hca->gpo', 'hca', 'gpo', {
|
|
45
|
-
label: '2'
|
|
46
|
+
label: '2',
|
|
47
|
+
relationTypes: [{ uri: 'relType2' }]
|
|
46
48
|
});
|
|
47
49
|
graph.addEdgeWithKey('hcp->prescriptions', 'hcp', 'prescriptions', {
|
|
48
50
|
type: 'dashed'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Graph from 'graphology';
|
|
2
|
-
export declare const EDGE_COLOR = "rgba(
|
|
3
|
-
export declare const DASHED_EDGE_COLOR = "rgba(
|
|
2
|
+
export declare const EDGE_COLOR = "rgba(0, 0, 0, 0.2)";
|
|
3
|
+
export declare const DASHED_EDGE_COLOR = "rgba(0, 0, 0, 0.2)";
|
|
4
4
|
export declare const INACTIVE_EDGE_COLOR = "rgba(224, 224, 224, 1)";
|
|
5
5
|
export declare const SELECTED_EDGE_COLOR = "rgba(79, 79, 79, 1)";
|
|
6
6
|
export declare const RELATED_EDGE_COLOR = "rgba(130, 130, 130, 1)";
|
|
@@ -8,11 +8,12 @@ export declare const RELATED_DASHED_EDGE_COLOR = "rgba(79, 79, 79, 1)";
|
|
|
8
8
|
export declare const INACTIVE_LABEL_COLOR = "rgba(0, 0, 0, 0.38)";
|
|
9
9
|
type Props = {
|
|
10
10
|
graph: Graph;
|
|
11
|
-
selectedNode
|
|
12
|
-
|
|
11
|
+
selectedNode?: string;
|
|
12
|
+
selectedEdges?: string[];
|
|
13
13
|
onNodeClick: (node: string) => void;
|
|
14
14
|
onEdgeLabelClick: (edgeId: string, event: MouseEvent) => void;
|
|
15
15
|
hideInteractionTypes?: boolean;
|
|
16
|
+
relationEdgesLabelsAmountThreshold?: number;
|
|
16
17
|
};
|
|
17
|
-
export declare const useDataModelGraphAppearance: ({ graph, selectedNode,
|
|
18
|
+
export declare const useDataModelGraphAppearance: ({ graph, selectedNode, selectedEdges, onNodeClick, onEdgeLabelClick, hideInteractionTypes, relationEdgesLabelsAmountThreshold }: Props) => void;
|
|
18
19
|
export {};
|
|
@@ -36,25 +36,35 @@ var DEFAULT_NODE_STYLE = {
|
|
|
36
36
|
color: 'rgba(55, 71, 79, 1)'
|
|
37
37
|
};
|
|
38
38
|
var DEFAULT_EDGE_STYLE = {
|
|
39
|
-
size:
|
|
39
|
+
size: 1
|
|
40
40
|
};
|
|
41
|
-
exports.EDGE_COLOR = 'rgba(
|
|
42
|
-
exports.DASHED_EDGE_COLOR = 'rgba(
|
|
41
|
+
exports.EDGE_COLOR = 'rgba(0, 0, 0, 0.2)';
|
|
42
|
+
exports.DASHED_EDGE_COLOR = 'rgba(0, 0, 0, 0.2)';
|
|
43
43
|
exports.INACTIVE_EDGE_COLOR = 'rgba(224, 224, 224, 1)';
|
|
44
44
|
exports.SELECTED_EDGE_COLOR = 'rgba(79, 79, 79, 1)';
|
|
45
45
|
exports.RELATED_EDGE_COLOR = 'rgba(130, 130, 130, 1)';
|
|
46
46
|
exports.RELATED_DASHED_EDGE_COLOR = 'rgba(79, 79, 79, 1)';
|
|
47
47
|
exports.INACTIVE_LABEL_COLOR = 'rgba(0, 0, 0, 0.38)';
|
|
48
|
+
var RELATION_EDGES_LABELS_AMOUNT_THRESHOLD = 29;
|
|
48
49
|
var useDataModelGraphAppearance = function (_a) {
|
|
49
|
-
var graph = _a.graph, selectedNode = _a.selectedNode,
|
|
50
|
+
var graph = _a.graph, selectedNode = _a.selectedNode, selectedEdges = _a.selectedEdges, onNodeClick = _a.onNodeClick, onEdgeLabelClick = _a.onEdgeLabelClick, hideInteractionTypes = _a.hideInteractionTypes, _b = _a.relationEdgesLabelsAmountThreshold, relationEdgesLabelsAmountThreshold = _b === void 0 ? RELATION_EDGES_LABELS_AMOUNT_THRESHOLD : _b;
|
|
50
51
|
var sigma = (0, core_2.useSigma)();
|
|
51
52
|
var container = (0, core_1.useSigmaContext)().container;
|
|
52
|
-
var
|
|
53
|
+
var _c = (0, react_1.useState)(null), hoveredNode = _c[0], setHoveredNode = _c[1];
|
|
53
54
|
var registerEvents = (0, core_2.useRegisterEvents)();
|
|
54
55
|
var setSettings = (0, core_2.useSetSettings)();
|
|
55
56
|
(0, useLoopRenderer_1.useLoopRenderer)(graph);
|
|
56
57
|
var hoveredEdge = (0, useEdgeLabelsRenderer_1.useEdgeLabelsRenderer)({ graph: graph, onEdgeLabelClick: onEdgeLabelClick });
|
|
57
58
|
(0, useSelectedNodeRenderer_1.useSelectedNodeRenderer)(graph);
|
|
59
|
+
var relationsEdgesAmount = (0, react_1.useMemo)(function () {
|
|
60
|
+
return graph.reduceEdges(function (count, _edgeId, edgeData) {
|
|
61
|
+
var _a;
|
|
62
|
+
if (((_a = edgeData.relationTypes) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
63
|
+
return count + 1;
|
|
64
|
+
}
|
|
65
|
+
return count;
|
|
66
|
+
}, 0);
|
|
67
|
+
}, [graph]);
|
|
58
68
|
(0, react_1.useEffect)(function () {
|
|
59
69
|
registerEvents({
|
|
60
70
|
enterNode: function (_a) {
|
|
@@ -88,7 +98,8 @@ var useDataModelGraphAppearance = function (_a) {
|
|
|
88
98
|
var isInactiveNode = (selectedNode &&
|
|
89
99
|
selectedNodeNeighbours &&
|
|
90
100
|
__spreadArray(__spreadArray([], selectedNodeNeighbours, true), [selectedNode], false).every(function (n) { return n !== node; })) ||
|
|
91
|
-
(
|
|
101
|
+
((selectedEdges === null || selectedEdges === void 0 ? void 0 : selectedEdges.length) > 0 &&
|
|
102
|
+
selectedEdges.every(function (selectedEdge) { return !graph.hasExtremity(selectedEdge, node); })) ||
|
|
92
103
|
false;
|
|
93
104
|
var newData = __assign(__assign({}, DEFAULT_NODE_STYLE), data);
|
|
94
105
|
if (data.nodeType === graphDataTypes_1.DataModelGraphNodeType.interactionType) {
|
|
@@ -115,9 +126,9 @@ var useDataModelGraphAppearance = function (_a) {
|
|
|
115
126
|
edgeReducer: function (edge, data) {
|
|
116
127
|
var isDashedLine = data.type === 'dashed';
|
|
117
128
|
var newData = __assign(__assign({}, DEFAULT_EDGE_STYLE), data);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
var isSelected = selectedEdges === null || selectedEdges === void 0 ? void 0 : selectedEdges.includes(edge);
|
|
130
|
+
newData.selected = isSelected;
|
|
131
|
+
var showOnlyRelatedEdgesLabels = relationsEdgesAmount > relationEdgesLabelsAmountThreshold;
|
|
121
132
|
if (selectedNode) {
|
|
122
133
|
if (graph.hasExtremity(edge, selectedNode)) {
|
|
123
134
|
newData.color = isDashedLine ? exports.RELATED_DASHED_EDGE_COLOR : exports.RELATED_EDGE_COLOR;
|
|
@@ -125,18 +136,37 @@ var useDataModelGraphAppearance = function (_a) {
|
|
|
125
136
|
else {
|
|
126
137
|
newData.color = exports.INACTIVE_EDGE_COLOR;
|
|
127
138
|
newData.labelColor = exports.INACTIVE_LABEL_COLOR;
|
|
139
|
+
if (showOnlyRelatedEdgesLabels) {
|
|
140
|
+
delete newData.label;
|
|
141
|
+
}
|
|
128
142
|
}
|
|
129
143
|
}
|
|
130
|
-
else if (
|
|
131
|
-
newData.color =
|
|
132
|
-
newData.labelColor =
|
|
144
|
+
else if (selectedEdges === null || selectedEdges === void 0 ? void 0 : selectedEdges.length) {
|
|
145
|
+
newData.color = isSelected ? exports.SELECTED_EDGE_COLOR : exports.INACTIVE_EDGE_COLOR;
|
|
146
|
+
newData.labelColor = isSelected ? undefined : exports.INACTIVE_LABEL_COLOR;
|
|
147
|
+
if (showOnlyRelatedEdgesLabels && !isSelected) {
|
|
148
|
+
delete newData.label;
|
|
149
|
+
}
|
|
133
150
|
}
|
|
134
151
|
else {
|
|
135
152
|
newData.color = isDashedLine ? exports.DASHED_EDGE_COLOR : exports.EDGE_COLOR;
|
|
153
|
+
if (showOnlyRelatedEdgesLabels) {
|
|
154
|
+
delete newData.label;
|
|
155
|
+
}
|
|
136
156
|
}
|
|
137
157
|
return newData;
|
|
138
158
|
}
|
|
139
159
|
});
|
|
140
|
-
}, [
|
|
160
|
+
}, [
|
|
161
|
+
sigma,
|
|
162
|
+
setSettings,
|
|
163
|
+
selectedNode,
|
|
164
|
+
selectedEdges,
|
|
165
|
+
hoveredEdge,
|
|
166
|
+
hoveredNode,
|
|
167
|
+
relationsEdgesAmount,
|
|
168
|
+
relationEdgesLabelsAmountThreshold,
|
|
169
|
+
hideInteractionTypes
|
|
170
|
+
]);
|
|
141
171
|
};
|
|
142
172
|
exports.useDataModelGraphAppearance = useDataModelGraphAppearance;
|
|
@@ -88,7 +88,7 @@ describe('useDataModelGraphAppearance tests', function () {
|
|
|
88
88
|
getGraph: function () { return graph; }
|
|
89
89
|
});
|
|
90
90
|
return __assign({ graph: graph }, (0, react_hooks_1.renderHook)(useDataModelGraphAppearance_1.useDataModelGraphAppearance, {
|
|
91
|
-
initialProps: __assign({ graph: graph, selectedNode: null, onNodeClick: jest.fn(),
|
|
91
|
+
initialProps: __assign({ graph: graph, selectedNode: null, onNodeClick: jest.fn(), selectedEdges: null, onEdgeLabelClick: jest.fn(), hideInteractionTypes: false }, props)
|
|
92
92
|
}));
|
|
93
93
|
};
|
|
94
94
|
var setSettings = jest.fn();
|
|
@@ -150,8 +150,8 @@ describe('useDataModelGraphAppearance tests', function () {
|
|
|
150
150
|
expect(nodeReducer('prescriptions', graph.getNodeAttributes('prescriptions'))).toEqual(__assign(__assign({}, getDefaultNodeAttributes(graph.getNodeAttributes('prescriptions'))), { hasBorder: true, image: expect.stringContaining('data:image/svg+xml'), label: 'Prescriptions', nodeType: graphDataTypes_1.DataModelGraphNodeType.interactionType }));
|
|
151
151
|
expect(result.error).toBeUndefined();
|
|
152
152
|
});
|
|
153
|
-
it('should apply correct styles when
|
|
154
|
-
var _a = setUp({
|
|
153
|
+
it('should apply correct styles when selectedEdges is specified', function () {
|
|
154
|
+
var _a = setUp({ selectedEdges: ['hcp->hca'] }), graph = _a.graph, result = _a.result;
|
|
155
155
|
var nodeReducer = getNodeReducer();
|
|
156
156
|
expect(nodeReducer('hcp', graph.getNodeAttributes('hcp'))).toEqual(__assign(__assign({}, getDefaultNodeAttributes(graph.getNodeAttributes('hcp'))), { image: 'HCP.svg', label: 'HCP', nodeType: graphDataTypes_1.DataModelGraphNodeType.entityType }));
|
|
157
157
|
expect(nodeReducer('hca', graph.getNodeAttributes('hca'))).toEqual(__assign(__assign({}, getDefaultNodeAttributes(graph.getNodeAttributes('hca'))), { image: 'HCA.svg', label: 'HCA', nodeType: graphDataTypes_1.DataModelGraphNodeType.entityType }));
|
|
@@ -167,31 +167,53 @@ describe('useDataModelGraphAppearance tests', function () {
|
|
|
167
167
|
});
|
|
168
168
|
});
|
|
169
169
|
describe('edges reducer behavior', function () {
|
|
170
|
-
var
|
|
171
|
-
size: 2
|
|
172
|
-
};
|
|
170
|
+
var getDefaultEdgeAttributes = function (attributes) { return (__assign(__assign({}, attributes), { size: 1 })); };
|
|
173
171
|
it('should apply default edge style', function () {
|
|
174
172
|
var _a = setUp(), result = _a.result, graph = _a.graph;
|
|
175
173
|
var edgeReducer = getEdgeReducer();
|
|
176
|
-
expect(edgeReducer('hcp->hca', graph.getEdgeAttributes('hcp->hca'))).toEqual(__assign(__assign({},
|
|
177
|
-
expect(edgeReducer('hca->gpo', graph.getEdgeAttributes('hca->gpo'))).toEqual(__assign(__assign({},
|
|
178
|
-
expect(edgeReducer('hcp->prescriptions', graph.getEdgeAttributes('hcp->prescriptions'))).toEqual(__assign(__assign({},
|
|
174
|
+
expect(edgeReducer('hcp->hca', graph.getEdgeAttributes('hcp->hca'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->hca'))), { color: useDataModelGraphAppearance_1.EDGE_COLOR }));
|
|
175
|
+
expect(edgeReducer('hca->gpo', graph.getEdgeAttributes('hca->gpo'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hca->gpo'))), { color: useDataModelGraphAppearance_1.EDGE_COLOR }));
|
|
176
|
+
expect(edgeReducer('hcp->prescriptions', graph.getEdgeAttributes('hcp->prescriptions'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->prescriptions'))), { type: 'dashed', color: useDataModelGraphAppearance_1.DASHED_EDGE_COLOR }));
|
|
179
177
|
expect(result.error).toBeUndefined();
|
|
180
178
|
});
|
|
181
179
|
it('should apply correct styles when selectedNode is specified', function () {
|
|
182
180
|
var _a = setUp({ selectedNode: 'hcp' }), graph = _a.graph, result = _a.result;
|
|
183
181
|
var edgeReducer = getEdgeReducer();
|
|
184
|
-
expect(edgeReducer('hcp->hca', graph.getEdgeAttributes('hcp->hca'))).toEqual(__assign(__assign({},
|
|
185
|
-
expect(edgeReducer('hca->gpo', graph.getEdgeAttributes('hca->gpo'))).toEqual(__assign(__assign({},
|
|
186
|
-
expect(edgeReducer('hcp->prescriptions', graph.getEdgeAttributes('hcp->prescriptions'))).toEqual(__assign(__assign({},
|
|
182
|
+
expect(edgeReducer('hcp->hca', graph.getEdgeAttributes('hcp->hca'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->hca'))), { color: useDataModelGraphAppearance_1.RELATED_EDGE_COLOR }));
|
|
183
|
+
expect(edgeReducer('hca->gpo', graph.getEdgeAttributes('hca->gpo'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hca->gpo'))), { color: useDataModelGraphAppearance_1.INACTIVE_EDGE_COLOR, labelColor: useDataModelGraphAppearance_1.INACTIVE_LABEL_COLOR }));
|
|
184
|
+
expect(edgeReducer('hcp->prescriptions', graph.getEdgeAttributes('hcp->prescriptions'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->prescriptions'))), { type: 'dashed', color: useDataModelGraphAppearance_1.RELATED_DASHED_EDGE_COLOR }));
|
|
185
|
+
expect(result.error).toBeUndefined();
|
|
186
|
+
});
|
|
187
|
+
it('should apply correct styles when selectedEdges is specified', function () {
|
|
188
|
+
var _a = setUp({ selectedEdges: ['hcp->hca'] }), graph = _a.graph, result = _a.result;
|
|
189
|
+
var edgeReducer = getEdgeReducer();
|
|
190
|
+
expect(edgeReducer('hcp->hca', graph.getEdgeAttributes('hcp->hca'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->hca'))), { color: useDataModelGraphAppearance_1.SELECTED_EDGE_COLOR, selected: true }));
|
|
191
|
+
expect(edgeReducer('hca->gpo', graph.getEdgeAttributes('hca->gpo'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hca->gpo'))), { selected: false, color: useDataModelGraphAppearance_1.INACTIVE_EDGE_COLOR, labelColor: useDataModelGraphAppearance_1.INACTIVE_LABEL_COLOR }));
|
|
192
|
+
expect(edgeReducer('hcp->prescriptions', graph.getEdgeAttributes('hcp->prescriptions'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->prescriptions'))), { type: 'dashed', selected: false, color: useDataModelGraphAppearance_1.INACTIVE_EDGE_COLOR, labelColor: useDataModelGraphAppearance_1.INACTIVE_LABEL_COLOR }));
|
|
193
|
+
expect(result.error).toBeUndefined();
|
|
194
|
+
});
|
|
195
|
+
it('should remove edge label prop when relations edges amount bigger than relationEdgesLabelsAmountThreshold', function () {
|
|
196
|
+
var _a = setUp({ relationEdgesLabelsAmountThreshold: 1 }), graph = _a.graph, result = _a.result;
|
|
197
|
+
var edgeReducer = getEdgeReducer();
|
|
198
|
+
expect(edgeReducer('hcp->hca', graph.getEdgeAttributes('hcp->hca'))).toEqual(__assign(__assign({}, (0, ramda_1.omit)(['label'], getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->hca')))), { color: useDataModelGraphAppearance_1.EDGE_COLOR }));
|
|
199
|
+
expect(edgeReducer('hca->gpo', graph.getEdgeAttributes('hca->gpo'))).toEqual(__assign(__assign({}, (0, ramda_1.omit)(['label'], getDefaultEdgeAttributes(graph.getEdgeAttributes('hca->gpo')))), { color: useDataModelGraphAppearance_1.EDGE_COLOR }));
|
|
200
|
+
expect(edgeReducer('hcp->prescriptions', graph.getEdgeAttributes('hcp->prescriptions'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->prescriptions'))), { type: 'dashed', color: useDataModelGraphAppearance_1.DASHED_EDGE_COLOR }));
|
|
201
|
+
expect(result.error).toBeUndefined();
|
|
202
|
+
});
|
|
203
|
+
it('should keep edge label prop for edge related with selected node even if relations edges amount bigger than relationEdgesLabelsAmountThreshold', function () {
|
|
204
|
+
var _a = setUp({ relationEdgesLabelsAmountThreshold: 1, selectedNode: 'hcp' }), graph = _a.graph, result = _a.result;
|
|
205
|
+
var edgeReducer = getEdgeReducer();
|
|
206
|
+
expect(edgeReducer('hcp->hca', graph.getEdgeAttributes('hcp->hca'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->hca'))), { color: useDataModelGraphAppearance_1.RELATED_EDGE_COLOR }));
|
|
207
|
+
expect(edgeReducer('hca->gpo', graph.getEdgeAttributes('hca->gpo'))).toEqual(__assign(__assign({}, (0, ramda_1.omit)(['label'], getDefaultEdgeAttributes(graph.getEdgeAttributes('hca->gpo')))), { color: useDataModelGraphAppearance_1.INACTIVE_EDGE_COLOR, labelColor: useDataModelGraphAppearance_1.INACTIVE_LABEL_COLOR }));
|
|
208
|
+
expect(edgeReducer('hcp->prescriptions', graph.getEdgeAttributes('hcp->prescriptions'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->prescriptions'))), { type: 'dashed', color: useDataModelGraphAppearance_1.RELATED_DASHED_EDGE_COLOR }));
|
|
187
209
|
expect(result.error).toBeUndefined();
|
|
188
210
|
});
|
|
189
|
-
it('should
|
|
190
|
-
var _a = setUp({
|
|
211
|
+
it('should keep edge label prop for selected edge even if relations edges amount bigger than relationEdgesLabelsAmountThreshold', function () {
|
|
212
|
+
var _a = setUp({ relationEdgesLabelsAmountThreshold: 1, selectedEdges: ['hcp->hca'] }), graph = _a.graph, result = _a.result;
|
|
191
213
|
var edgeReducer = getEdgeReducer();
|
|
192
|
-
expect(edgeReducer('hcp->hca', graph.getEdgeAttributes('hcp->hca'))).toEqual(__assign(__assign({},
|
|
193
|
-
expect(edgeReducer('hca->gpo', graph.getEdgeAttributes('hca->gpo'))).toEqual(__assign(__assign({},
|
|
194
|
-
expect(edgeReducer('hcp->prescriptions', graph.getEdgeAttributes('hcp->prescriptions'))).toEqual(__assign(__assign({},
|
|
214
|
+
expect(edgeReducer('hcp->hca', graph.getEdgeAttributes('hcp->hca'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->hca'))), { color: useDataModelGraphAppearance_1.SELECTED_EDGE_COLOR, selected: true }));
|
|
215
|
+
expect(edgeReducer('hca->gpo', graph.getEdgeAttributes('hca->gpo'))).toEqual(__assign(__assign({}, (0, ramda_1.omit)(['label'], getDefaultEdgeAttributes(graph.getEdgeAttributes('hca->gpo')))), { selected: false, color: useDataModelGraphAppearance_1.INACTIVE_EDGE_COLOR, labelColor: useDataModelGraphAppearance_1.INACTIVE_LABEL_COLOR }));
|
|
216
|
+
expect(edgeReducer('hcp->prescriptions', graph.getEdgeAttributes('hcp->prescriptions'))).toEqual(__assign(__assign({}, getDefaultEdgeAttributes(graph.getEdgeAttributes('hcp->prescriptions'))), { type: 'dashed', selected: false, color: useDataModelGraphAppearance_1.INACTIVE_EDGE_COLOR, labelColor: useDataModelGraphAppearance_1.INACTIVE_LABEL_COLOR }));
|
|
195
217
|
expect(result.error).toBeUndefined();
|
|
196
218
|
});
|
|
197
219
|
});
|
|
@@ -14,6 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.useEdgeLabelsRenderer = exports.HOVERS_CUSTOM_EDGE_LABELS_CANVAS_NAME = exports.EDGE_DOTS_CANVAS_NAME = exports.CUSTOM_EDGE_LABELS_CANVAS_NAME = void 0;
|
|
15
15
|
var react_1 = require("react");
|
|
16
16
|
var core_1 = require("@react-sigma/core");
|
|
17
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
17
18
|
var useSigmaCustomRenderers_1 = require("../../hooks/useSigmaCustomRenderers");
|
|
18
19
|
var graphDataTypes_1 = require("../../types/graphDataTypes");
|
|
19
20
|
var label_1 = require("../../rendering/canvas/label");
|
|
@@ -37,7 +38,7 @@ var useEdgeLabelsRenderer = function (_a) {
|
|
|
37
38
|
var sourceDisplayData = sigma.getNodeDisplayData(sourceId);
|
|
38
39
|
var targetDisplayData = sigma.getNodeDisplayData(targetId);
|
|
39
40
|
var relationEdge = [sourceDisplayData.nodeType, targetDisplayData.nodeType].every(function (type) { return type === graphDataTypes_1.DataModelGraphNodeType.entityType; });
|
|
40
|
-
return relationEdge && !edgeDisplayData.hidden;
|
|
41
|
+
return relationEdge && !edgeDisplayData.hidden && edgeDisplayData.label;
|
|
41
42
|
}, [sigma]);
|
|
42
43
|
var drawEdgeLabel = (0, react_1.useCallback)(function (context, edgeId, sourceId, targetId) {
|
|
43
44
|
delete edgeLabelsPathsMap.current[edgeId];
|
|
@@ -68,11 +69,11 @@ var useEdgeLabelsRenderer = function (_a) {
|
|
|
68
69
|
var isHovered = hoveredEdgeLabel === edgeId;
|
|
69
70
|
var isSelected = edgeDisplayData.selected;
|
|
70
71
|
var dotScale = isHovered || isSelected ? 1.4 : 1;
|
|
71
|
-
var circleRadius = sigma.scaleSize(2
|
|
72
|
+
var circleRadius = sigma.scaleSize(2 * dotScale);
|
|
72
73
|
var _a = (0, edgeLabelHelpers_1.getEdgeCenter)(edgeId, sourceId, targetId, sigma), x = _a.x, y = _a.y;
|
|
73
74
|
context.beginPath();
|
|
74
75
|
context.arc(x, y, circleRadius, 0, Math.PI * 2);
|
|
75
|
-
context.fillStyle = edgeDisplayData.color;
|
|
76
|
+
context.fillStyle = (0, mdm_sdk_1.rgbaToRgb)(edgeDisplayData.color);
|
|
76
77
|
context.fill();
|
|
77
78
|
}
|
|
78
79
|
}, [sigma, hoveredEdgeLabel, shouldRenderLabels]);
|
|
@@ -107,8 +107,8 @@ describe('useEdgeLabelsRenderer tests', function () {
|
|
|
107
107
|
'arc',
|
|
108
108
|
'fill'
|
|
109
109
|
]);
|
|
110
|
-
expect(canvasContext.arc).toHaveBeenCalledWith(150, 100, 2
|
|
111
|
-
expect(canvasContext.arc).toHaveBeenCalledWith(250, 100, 2
|
|
110
|
+
expect(canvasContext.arc).toHaveBeenCalledWith(150, 100, 2, 0, 2 * Math.PI);
|
|
111
|
+
expect(canvasContext.arc).toHaveBeenCalledWith(250, 100, 2, 0, 2 * Math.PI);
|
|
112
112
|
});
|
|
113
113
|
it('should correctly draw a hover state of edge', function () {
|
|
114
114
|
setUp();
|
|
@@ -129,7 +129,7 @@ describe('useEdgeLabelsRenderer tests', function () {
|
|
|
129
129
|
});
|
|
130
130
|
expect(getCanvasContextEventTypes(hoversCanvasContext)).toEqual(expect.arrayContaining(['beginPath', 'arc', 'fill']));
|
|
131
131
|
expect(hoversCanvasContext.arc).toBeCalledTimes(1);
|
|
132
|
-
expect(hoversCanvasContext.arc).toHaveBeenCalledWith(150, 100,
|
|
132
|
+
expect(hoversCanvasContext.arc).toHaveBeenCalledWith(150, 100, 2.8, 0, 2 * Math.PI);
|
|
133
133
|
expect(label_1.drawLabel).toBeCalledTimes(1);
|
|
134
134
|
expect(label_1.drawLabel).toHaveBeenCalledWith(hoversCanvasContext, { label: '1', size: 4, x: 150, y: 100 }, { labelColor: 'black', labelSize: 12 * 1.2 }, { backgroundColor: 'rgba(250, 250, 250, 1)' });
|
|
135
135
|
});
|
|
@@ -11,6 +11,6 @@ export { NodeBorderProgram } from './rendering/webgl/node.border';
|
|
|
11
11
|
export { NodeDashedBorderProgram } from './rendering/webgl/node.dashed.border';
|
|
12
12
|
export { WebGLImageLoader } from './rendering/webgl/image';
|
|
13
13
|
export { getCanvasMousePos } from './rendering/canvas/utils';
|
|
14
|
-
export type { GraphNodeAttributes, GraphEdgeAttributes } from './types/graphDataTypes';
|
|
14
|
+
export type { GraphNodeAttributes, GraphEdgeAttributes, DataModelGraphNodeAttributes, DataModelGraphEdgeAttributes } from './types/graphDataTypes';
|
|
15
15
|
export { DataModelGraphNodeType } from './types/graphDataTypes';
|
|
16
16
|
export type { Canvas } from './types/sigmaCustomRenderersTypes';
|
|
@@ -9,6 +9,7 @@ var drawLabel = function (context, data, settings, _a) {
|
|
|
9
9
|
return;
|
|
10
10
|
var size = settings.labelSize, font = settings.labelFont, weight = settings.labelWeight, marginLeft = data.selected ? 6 : 2, lineHeight = size * 1.2;
|
|
11
11
|
var PERMANENT_MARGIN_LEFT = 9;
|
|
12
|
+
context.font = "".concat(weight, " ").concat(size, "px ").concat(font);
|
|
12
13
|
var labelBackgroundPath = (0, labelBackground_1.drawLabelBackground)(context, data, settings, {
|
|
13
14
|
backgroundColor: data.selected ? '#FFF' : backgroundColor,
|
|
14
15
|
marginLeft: marginLeft,
|
|
@@ -18,7 +19,6 @@ var drawLabel = function (context, data, settings, _a) {
|
|
|
18
19
|
context.fillStyle = ((_b = settings.labelColor) === null || _b === void 0 ? void 0 : _b.attribute)
|
|
19
20
|
? data[settings.labelColor.attribute] || settings.labelColor.color || '#000'
|
|
20
21
|
: settings.labelColor.color;
|
|
21
|
-
context.font = "".concat(weight, " ").concat(size, "px ").concat(font);
|
|
22
22
|
var y = data.secondaryLabel ? data.y - size / (3 * 1.25) : data.y + size / 3;
|
|
23
23
|
context.fillText(data.label, data.x + data.size + PERMANENT_MARGIN_LEFT + marginLeft, y);
|
|
24
24
|
if (data.secondaryLabel) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Graph from 'graphology';
|
|
2
2
|
import { NodeDisplayData, EdgeDisplayData } from 'sigma/types';
|
|
3
3
|
import { Settings } from 'sigma/settings';
|
|
4
|
+
import { TRelationType } from '@reltio/mdm-sdk';
|
|
4
5
|
export type GraphEdgeAttributes = EdgeDisplayData & {
|
|
5
6
|
loop: boolean;
|
|
6
7
|
arrowSizeRatio?: number;
|
|
@@ -21,7 +22,7 @@ export declare enum DataModelGraphNodeType {
|
|
|
21
22
|
interactionType = "interactionType"
|
|
22
23
|
}
|
|
23
24
|
export type DataModelGraphEdgeAttributes = GraphEdgeAttributes & {
|
|
24
|
-
|
|
25
|
+
relationTypes: TRelationType[];
|
|
25
26
|
};
|
|
26
27
|
export type DataModelGraphNodeAttributes = GraphNodeAttributes & {
|
|
27
28
|
nodeType: DataModelGraphNodeType;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FacetFilter } from '@reltio/mdm-sdk';
|
|
2
2
|
import { ColumnData, ColumnFilter } from '../types/basicTable';
|
|
3
3
|
export declare const defaultGetRowCellHeight: ({ columnData, cell }: {
|
|
4
4
|
columnData: any;
|
|
@@ -9,10 +9,5 @@ export declare const defaultRenderRowCell: ({ cell, CellValueRenderer, ...otherP
|
|
|
9
9
|
cell: any;
|
|
10
10
|
CellValueRenderer: any;
|
|
11
11
|
}) => any;
|
|
12
|
-
export declare const columnFilterToMdmFilter: (columnData: Pick<ColumnData, 'id' | 'dataTypeDefinition'>, columnFilter?: ColumnFilter) =>
|
|
13
|
-
fieldName: string;
|
|
14
|
-
filter: string;
|
|
15
|
-
values: import("@reltio/mdm-sdk").SearchValue[];
|
|
16
|
-
type: DataTypes;
|
|
17
|
-
};
|
|
12
|
+
export declare const columnFilterToMdmFilter: (columnData: Pick<ColumnData, 'id' | 'dataTypeDefinition'>, columnFilter?: ColumnFilter) => FacetFilter;
|
|
18
13
|
export declare const buildColumnsFilter: (columnsData: ColumnData[], filters?: Record<string, ColumnFilter>) => string;
|