@reltio/components 1.4.2228 → 1.4.2230
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/AttributesFiltersBuilder/AttributesFiltersBuilder.js +5 -4
- package/AttributesFiltersBuilder/helpers.js +6 -1
- package/FacetsSelector/FacetsSelector.d.ts +1 -1
- package/FacetsSelector/FacetsSelector.js +1 -1
- package/cjs/AttributesFiltersBuilder/AttributesFiltersBuilder.js +3 -2
- package/cjs/AttributesFiltersBuilder/helpers.js +6 -1
- package/cjs/FacetsSelector/FacetsSelector.d.ts +1 -1
- package/cjs/FacetsSelector/FacetsSelector.js +1 -1
- package/cjs/helpers/attributesSelector.d.ts +2 -3
- package/cjs/helpers/attributesSelector.js +16 -18
- package/cjs/types/index.d.ts +1 -0
- package/helpers/attributesSelector.d.ts +2 -3
- package/helpers/attributesSelector.js +16 -17
- package/package.json +2 -2
- package/types/index.d.ts +1 -0
|
@@ -20,9 +20,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
20
20
|
};
|
|
21
21
|
import React, { useCallback, useRef, useMemo, memo } from 'react';
|
|
22
22
|
import { always, evolve } from 'ramda';
|
|
23
|
-
import { SearchOperator, findClosestCommonAncestor, getEntityType } from '@reltio/mdm-sdk';
|
|
23
|
+
import { SearchOperator, findClosestCommonAncestor, findRegularAttribute, getBaseUri, getEntityType } from '@reltio/mdm-sdk';
|
|
24
24
|
import { EmptyStub } from '../EmptyStub';
|
|
25
|
-
import { getAttributeSelectorItems
|
|
25
|
+
import { getAttributeSelectorItems } from '../helpers/attributesSelector';
|
|
26
26
|
import { getRowsDataFromFilters } from './helpers';
|
|
27
27
|
import { AttributesFilterSelector } from '../AttributesFilterSelector';
|
|
28
28
|
import { RowActions } from './components/RowActions';
|
|
@@ -51,12 +51,13 @@ var AttributesFiltersBuilder = function (_a) {
|
|
|
51
51
|
var currentEntityType = useMemo(function () {
|
|
52
52
|
var entityTypesUris = attributesTypesGroups.map(function (_a) {
|
|
53
53
|
var attributeTypes = _a.attributeTypes;
|
|
54
|
-
|
|
54
|
+
var regularAttribute = findRegularAttribute(attributeTypes);
|
|
55
|
+
return regularAttribute ? getBaseUri(regularAttribute.uri) : null;
|
|
55
56
|
});
|
|
56
57
|
var closestEntityTypeAncestorUri = findClosestCommonAncestor(metadata, entityTypesUris);
|
|
57
58
|
return getEntityType(metadata, closestEntityTypeAncestorUri);
|
|
58
59
|
}, [attributesTypesGroups, metadata]);
|
|
59
|
-
var attributeSelectorItemsGroups = useMemo(function () { return getAttributeSelectorItems(metadata, attributesTypesGroups, attributesTypesGroupFilter); }, [
|
|
60
|
+
var attributeSelectorItemsGroups = useMemo(function () { return getAttributeSelectorItems(metadata, attributesTypesGroups, attributesTypesGroupFilter); }, [metadata, attributesTypesGroups]);
|
|
60
61
|
var rowsData = useMemo(function () { return (filters.length ? getRowsDataFromFilters(filters, attributeSelectorItemsGroups) : []); }, [attributeSelectorItemsGroups, filters]);
|
|
61
62
|
var _f = useFilterAutoFocus(rowsData), attributeFilterRef = _f.attributeFilterRef, lastAttributesCountRef = _f.lastAttributesCountRef;
|
|
62
63
|
attributesCountRef.current = rowsData.length;
|
|
@@ -14,10 +14,15 @@ var findAttributeSelectorItem = function (fieldName, attributesGroup) {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
findAttribute(fieldName, attributesGroupItem.attributes);
|
|
17
|
+
if (attrGroup) {
|
|
18
|
+
return "break";
|
|
19
|
+
}
|
|
17
20
|
};
|
|
18
21
|
for (var _i = 0, attributesGroup_1 = attributesGroup; _i < attributesGroup_1.length; _i++) {
|
|
19
22
|
var attributesGroupItem = attributesGroup_1[_i];
|
|
20
|
-
_loop_1(attributesGroupItem);
|
|
23
|
+
var state_1 = _loop_1(attributesGroupItem);
|
|
24
|
+
if (state_1 === "break")
|
|
25
|
+
break;
|
|
21
26
|
}
|
|
22
27
|
return attrGroup;
|
|
23
28
|
};
|
|
@@ -7,7 +7,7 @@ type Props = {
|
|
|
7
7
|
selectedFacetsFieldNames: string[];
|
|
8
8
|
onOpen: () => void;
|
|
9
9
|
onClose: () => void;
|
|
10
|
-
onFacetToggle: (item: FacetConfig, selected: boolean) => void;
|
|
10
|
+
onFacetToggle: (item: FacetConfig, selected: boolean, groupId?: string) => void;
|
|
11
11
|
};
|
|
12
12
|
export declare const FacetsSelector: ({ open, data, selectedFacetsFieldNames, onOpen, onClose, onFacetToggle }: Props) => React.JSX.Element;
|
|
13
13
|
export default FacetsSelector;
|
|
@@ -18,7 +18,7 @@ export var FacetsSelector = function (_a) {
|
|
|
18
18
|
}, [onClose]);
|
|
19
19
|
var handleListItemClick = useCallback(function (facetConfig, checked, groupId) {
|
|
20
20
|
setLastFacetClicked({ facetConfig: facetConfig, groupId: groupId });
|
|
21
|
-
onFacetToggle(facetConfig, checked);
|
|
21
|
+
onFacetToggle(facetConfig, checked, groupId);
|
|
22
22
|
}, [onFacetToggle]);
|
|
23
23
|
var handleOpen = useCallback(function () {
|
|
24
24
|
showSearchInput();
|
|
@@ -79,12 +79,13 @@ var AttributesFiltersBuilder = function (_a) {
|
|
|
79
79
|
var currentEntityType = (0, react_1.useMemo)(function () {
|
|
80
80
|
var entityTypesUris = attributesTypesGroups.map(function (_a) {
|
|
81
81
|
var attributeTypes = _a.attributeTypes;
|
|
82
|
-
|
|
82
|
+
var regularAttribute = (0, mdm_sdk_1.findRegularAttribute)(attributeTypes);
|
|
83
|
+
return regularAttribute ? (0, mdm_sdk_1.getBaseUri)(regularAttribute.uri) : null;
|
|
83
84
|
});
|
|
84
85
|
var closestEntityTypeAncestorUri = (0, mdm_sdk_1.findClosestCommonAncestor)(metadata, entityTypesUris);
|
|
85
86
|
return (0, mdm_sdk_1.getEntityType)(metadata, closestEntityTypeAncestorUri);
|
|
86
87
|
}, [attributesTypesGroups, metadata]);
|
|
87
|
-
var attributeSelectorItemsGroups = (0, react_1.useMemo)(function () { return (0, attributesSelector_1.getAttributeSelectorItems)(metadata, attributesTypesGroups, attributesTypesGroupFilter); }, [
|
|
88
|
+
var attributeSelectorItemsGroups = (0, react_1.useMemo)(function () { return (0, attributesSelector_1.getAttributeSelectorItems)(metadata, attributesTypesGroups, attributesTypesGroupFilter); }, [metadata, attributesTypesGroups]);
|
|
88
89
|
var rowsData = (0, react_1.useMemo)(function () { return (filters.length ? (0, helpers_1.getRowsDataFromFilters)(filters, attributeSelectorItemsGroups) : []); }, [attributeSelectorItemsGroups, filters]);
|
|
89
90
|
var _f = (0, useFilterAutoFocus_1.useFilterAutoFocus)(rowsData), attributeFilterRef = _f.attributeFilterRef, lastAttributesCountRef = _f.lastAttributesCountRef;
|
|
90
91
|
attributesCountRef.current = rowsData.length;
|
|
@@ -17,10 +17,15 @@ var findAttributeSelectorItem = function (fieldName, attributesGroup) {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
findAttribute(fieldName, attributesGroupItem.attributes);
|
|
20
|
+
if (attrGroup) {
|
|
21
|
+
return "break";
|
|
22
|
+
}
|
|
20
23
|
};
|
|
21
24
|
for (var _i = 0, attributesGroup_1 = attributesGroup; _i < attributesGroup_1.length; _i++) {
|
|
22
25
|
var attributesGroupItem = attributesGroup_1[_i];
|
|
23
|
-
_loop_1(attributesGroupItem);
|
|
26
|
+
var state_1 = _loop_1(attributesGroupItem);
|
|
27
|
+
if (state_1 === "break")
|
|
28
|
+
break;
|
|
24
29
|
}
|
|
25
30
|
return attrGroup;
|
|
26
31
|
};
|
|
@@ -7,7 +7,7 @@ type Props = {
|
|
|
7
7
|
selectedFacetsFieldNames: string[];
|
|
8
8
|
onOpen: () => void;
|
|
9
9
|
onClose: () => void;
|
|
10
|
-
onFacetToggle: (item: FacetConfig, selected: boolean) => void;
|
|
10
|
+
onFacetToggle: (item: FacetConfig, selected: boolean, groupId?: string) => void;
|
|
11
11
|
};
|
|
12
12
|
export declare const FacetsSelector: ({ open, data, selectedFacetsFieldNames, onOpen, onClose, onFacetToggle }: Props) => React.JSX.Element;
|
|
13
13
|
export default FacetsSelector;
|
|
@@ -47,7 +47,7 @@ var FacetsSelector = function (_a) {
|
|
|
47
47
|
}, [onClose]);
|
|
48
48
|
var handleListItemClick = (0, react_1.useCallback)(function (facetConfig, checked, groupId) {
|
|
49
49
|
setLastFacetClicked({ facetConfig: facetConfig, groupId: groupId });
|
|
50
|
-
onFacetToggle(facetConfig, checked);
|
|
50
|
+
onFacetToggle(facetConfig, checked, groupId);
|
|
51
51
|
}, [onFacetToggle]);
|
|
52
52
|
var handleOpen = (0, react_1.useCallback)(function () {
|
|
53
53
|
showSearchInput();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AttributesTypesGroup,
|
|
1
|
+
import { AttributesTypesGroup, Metadata } from '@reltio/mdm-sdk';
|
|
2
2
|
import { AttributeSelectorItemsGroup } from '../types';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const getAttributeSelectorItems: (metadata: Metadata, attributesTypesGroups: AttributesTypesGroup[], attributesTypesGroupFilter: (attributeSelectorItemsGroup: AttributeSelectorItemsGroup[]) => AttributeSelectorItemsGroup[]) => AttributeSelectorItemsGroup[];
|
|
3
|
+
export declare const getAttributeSelectorItems: (metadata: Metadata, attributesTypesGroups: AttributesTypesGroup[], attributesTypesGroupFilter?: (attributeSelectorItemsGroup: AttributeSelectorItemsGroup[]) => AttributeSelectorItemsGroup[]) => AttributeSelectorItemsGroup[];
|
|
@@ -20,33 +20,38 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
20
20
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.getAttributeSelectorItems =
|
|
23
|
+
exports.getAttributeSelectorItems = void 0;
|
|
24
24
|
var ramda_1 = require("ramda");
|
|
25
25
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
26
|
-
var createAttributeItem = function (metadata, attrType,
|
|
26
|
+
var createAttributeItem = function (metadata, attrType, groupId, parents) {
|
|
27
27
|
var title = attrType.label || attrType.name;
|
|
28
28
|
if ((0, mdm_sdk_1.isSpecialAttribute)(attrType)) {
|
|
29
|
-
return {
|
|
29
|
+
return {
|
|
30
|
+
attrType: attrType,
|
|
31
|
+
title: title,
|
|
32
|
+
fieldName: attrType.name,
|
|
33
|
+
groupId: groupId
|
|
34
|
+
};
|
|
30
35
|
}
|
|
31
|
-
if ((0, mdm_sdk_1.isInteractionTypeUri)(
|
|
32
|
-
return { attrType: attrType, title: title, fieldName: (0, mdm_sdk_1.attributeUriToSearchUri)(attrType.uri, parents) };
|
|
36
|
+
if ((0, mdm_sdk_1.isInteractionTypeUri)(groupId)) {
|
|
37
|
+
return { attrType: attrType, title: title, fieldName: (0, mdm_sdk_1.attributeUriToSearchUri)(attrType.uri, parents), groupId: groupId };
|
|
33
38
|
}
|
|
34
|
-
var entityTypeLabel = (0, mdm_sdk_1.getEntityTypeLabel)(metadata, { type:
|
|
39
|
+
var entityTypeLabel = (0, mdm_sdk_1.getEntityTypeLabel)(metadata, { type: groupId });
|
|
35
40
|
return {
|
|
36
41
|
attrType: attrType,
|
|
37
42
|
title: title,
|
|
38
|
-
|
|
43
|
+
groupId: groupId,
|
|
39
44
|
pathToTitle: Array.isArray(parents)
|
|
40
45
|
? __spreadArray(__spreadArray([entityTypeLabel], (0, ramda_1.chain)((0, ramda_1.prop)('label'), parents), true), [title], false) : [entityTypeLabel, title],
|
|
41
46
|
fieldName: (0, mdm_sdk_1.attributeUriToSearchUri)(attrType.uri, parents)
|
|
42
47
|
};
|
|
43
48
|
};
|
|
44
|
-
var createAttributesConfig = function (metadata, attrNode,
|
|
49
|
+
var createAttributesConfig = function (metadata, attrNode, groupId, parents) {
|
|
45
50
|
if (parents === void 0) { parents = []; }
|
|
46
|
-
var resConfig = __assign(__assign({}, createAttributeItem(metadata, attrNode,
|
|
51
|
+
var resConfig = __assign(__assign({}, createAttributeItem(metadata, attrNode, groupId, parents)), { uri: attrNode.uri });
|
|
47
52
|
var children = attrNode.children
|
|
48
53
|
? attrNode.children.map(function (childNode) {
|
|
49
|
-
return createAttributesConfig(metadata, childNode,
|
|
54
|
+
return createAttributesConfig(metadata, childNode, groupId, parents.concat(attrNode));
|
|
50
55
|
})
|
|
51
56
|
: [];
|
|
52
57
|
if (children.length) {
|
|
@@ -54,21 +59,14 @@ var createAttributesConfig = function (metadata, attrNode, operationalTypeUri, p
|
|
|
54
59
|
}
|
|
55
60
|
return resConfig;
|
|
56
61
|
};
|
|
57
|
-
var getOperationalTypeUriFromAttrTypes = function (attributeTypes) {
|
|
58
|
-
var regularAttribute = (0, mdm_sdk_1.findRegularAttribute)(attributeTypes);
|
|
59
|
-
return regularAttribute ? (0, mdm_sdk_1.getBaseUri)(regularAttribute.uri) : null;
|
|
60
|
-
};
|
|
61
|
-
exports.getOperationalTypeUriFromAttrTypes = getOperationalTypeUriFromAttrTypes;
|
|
62
62
|
var getAttributeSelectorItems = function (metadata, attributesTypesGroups, attributesTypesGroupFilter) {
|
|
63
63
|
var attributeSelectorItemsGroup = attributesTypesGroups.map(function (_a) {
|
|
64
64
|
var id = _a.id, title = _a.title, attributeTypes = _a.attributeTypes;
|
|
65
|
-
var operationalTypeUri = (0, exports.getOperationalTypeUriFromAttrTypes)(attributeTypes);
|
|
66
65
|
return {
|
|
67
66
|
id: id,
|
|
68
67
|
title: title,
|
|
69
68
|
attributes: (0, mdm_sdk_1.getAttributesTreeFromAttributes)(attributeTypes, metadata).map(function (attrNode) {
|
|
70
|
-
|
|
71
|
-
return createAttributesConfig(metadata, attrNode, uri);
|
|
69
|
+
return createAttributesConfig(metadata, attrNode, id);
|
|
72
70
|
})
|
|
73
71
|
};
|
|
74
72
|
});
|
package/cjs/types/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AttributesTypesGroup,
|
|
1
|
+
import { AttributesTypesGroup, Metadata } from '@reltio/mdm-sdk';
|
|
2
2
|
import { AttributeSelectorItemsGroup } from '../types';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const getAttributeSelectorItems: (metadata: Metadata, attributesTypesGroups: AttributesTypesGroup[], attributesTypesGroupFilter: (attributeSelectorItemsGroup: AttributeSelectorItemsGroup[]) => AttributeSelectorItemsGroup[]) => AttributeSelectorItemsGroup[];
|
|
3
|
+
export declare const getAttributeSelectorItems: (metadata: Metadata, attributesTypesGroups: AttributesTypesGroup[], attributesTypesGroupFilter?: (attributeSelectorItemsGroup: AttributeSelectorItemsGroup[]) => AttributeSelectorItemsGroup[]) => AttributeSelectorItemsGroup[];
|
|
@@ -19,31 +19,36 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
19
19
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
20
|
};
|
|
21
21
|
import { chain, prop } from 'ramda';
|
|
22
|
-
import { attributeUriToSearchUri,
|
|
23
|
-
var createAttributeItem = function (metadata, attrType,
|
|
22
|
+
import { attributeUriToSearchUri, getAttributesTreeFromAttributes, getEntityTypeLabel, isInteractionTypeUri, isSpecialAttribute } from '@reltio/mdm-sdk';
|
|
23
|
+
var createAttributeItem = function (metadata, attrType, groupId, parents) {
|
|
24
24
|
var title = attrType.label || attrType.name;
|
|
25
25
|
if (isSpecialAttribute(attrType)) {
|
|
26
|
-
return {
|
|
26
|
+
return {
|
|
27
|
+
attrType: attrType,
|
|
28
|
+
title: title,
|
|
29
|
+
fieldName: attrType.name,
|
|
30
|
+
groupId: groupId
|
|
31
|
+
};
|
|
27
32
|
}
|
|
28
|
-
if (isInteractionTypeUri(
|
|
29
|
-
return { attrType: attrType, title: title, fieldName: attributeUriToSearchUri(attrType.uri, parents) };
|
|
33
|
+
if (isInteractionTypeUri(groupId)) {
|
|
34
|
+
return { attrType: attrType, title: title, fieldName: attributeUriToSearchUri(attrType.uri, parents), groupId: groupId };
|
|
30
35
|
}
|
|
31
|
-
var entityTypeLabel = getEntityTypeLabel(metadata, { type:
|
|
36
|
+
var entityTypeLabel = getEntityTypeLabel(metadata, { type: groupId });
|
|
32
37
|
return {
|
|
33
38
|
attrType: attrType,
|
|
34
39
|
title: title,
|
|
35
|
-
|
|
40
|
+
groupId: groupId,
|
|
36
41
|
pathToTitle: Array.isArray(parents)
|
|
37
42
|
? __spreadArray(__spreadArray([entityTypeLabel], chain(prop('label'), parents), true), [title], false) : [entityTypeLabel, title],
|
|
38
43
|
fieldName: attributeUriToSearchUri(attrType.uri, parents)
|
|
39
44
|
};
|
|
40
45
|
};
|
|
41
|
-
var createAttributesConfig = function (metadata, attrNode,
|
|
46
|
+
var createAttributesConfig = function (metadata, attrNode, groupId, parents) {
|
|
42
47
|
if (parents === void 0) { parents = []; }
|
|
43
|
-
var resConfig = __assign(__assign({}, createAttributeItem(metadata, attrNode,
|
|
48
|
+
var resConfig = __assign(__assign({}, createAttributeItem(metadata, attrNode, groupId, parents)), { uri: attrNode.uri });
|
|
44
49
|
var children = attrNode.children
|
|
45
50
|
? attrNode.children.map(function (childNode) {
|
|
46
|
-
return createAttributesConfig(metadata, childNode,
|
|
51
|
+
return createAttributesConfig(metadata, childNode, groupId, parents.concat(attrNode));
|
|
47
52
|
})
|
|
48
53
|
: [];
|
|
49
54
|
if (children.length) {
|
|
@@ -51,20 +56,14 @@ var createAttributesConfig = function (metadata, attrNode, operationalTypeUri, p
|
|
|
51
56
|
}
|
|
52
57
|
return resConfig;
|
|
53
58
|
};
|
|
54
|
-
export var getOperationalTypeUriFromAttrTypes = function (attributeTypes) {
|
|
55
|
-
var regularAttribute = findRegularAttribute(attributeTypes);
|
|
56
|
-
return regularAttribute ? getBaseUri(regularAttribute.uri) : null;
|
|
57
|
-
};
|
|
58
59
|
export var getAttributeSelectorItems = function (metadata, attributesTypesGroups, attributesTypesGroupFilter) {
|
|
59
60
|
var attributeSelectorItemsGroup = attributesTypesGroups.map(function (_a) {
|
|
60
61
|
var id = _a.id, title = _a.title, attributeTypes = _a.attributeTypes;
|
|
61
|
-
var operationalTypeUri = getOperationalTypeUriFromAttrTypes(attributeTypes);
|
|
62
62
|
return {
|
|
63
63
|
id: id,
|
|
64
64
|
title: title,
|
|
65
65
|
attributes: getAttributesTreeFromAttributes(attributeTypes, metadata).map(function (attrNode) {
|
|
66
|
-
|
|
67
|
-
return createAttributesConfig(metadata, attrNode, uri);
|
|
66
|
+
return createAttributesConfig(metadata, attrNode, id);
|
|
68
67
|
})
|
|
69
68
|
};
|
|
70
69
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2230",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"react-mentions": "^4.3.0",
|
|
32
32
|
"react-number-format": "^4.9.2",
|
|
33
33
|
"react-resizable-panels": "^2.0.20",
|
|
34
|
-
"react-router-dom": "^6.2
|
|
34
|
+
"react-router-dom": "^6.30.2",
|
|
35
35
|
"react-select": "^5.8.0",
|
|
36
36
|
"react-simple-maps": "^3.0.0",
|
|
37
37
|
"react-virtualized": "^9.22.5",
|