@reltio/components 1.4.1870 → 1.4.1871
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/contexts/MdmModuleContext/context.d.ts +2 -2
- package/cjs/contexts/MdmModuleContext/hooks.js +3 -2
- package/cjs/contexts/MdmModuleContext/selectors/dependentLookupEditorContext.d.ts +2 -1
- package/cjs/contexts/MdmModuleContext/selectors/dependentLookupEditorContext.js +12 -8
- package/esm/contexts/MdmModuleContext/context.d.ts +2 -2
- package/esm/contexts/MdmModuleContext/hooks.js +3 -2
- package/esm/contexts/MdmModuleContext/selectors/dependentLookupEditorContext.d.ts +2 -1
- package/esm/contexts/MdmModuleContext/selectors/dependentLookupEditorContext.js +12 -8
- package/package.json +2 -2
|
@@ -32,7 +32,7 @@ export type MdmModuleValuesContextProps = Partial<{
|
|
|
32
32
|
mode: Mode;
|
|
33
33
|
isViewMode: boolean;
|
|
34
34
|
isEditableMode: boolean;
|
|
35
|
-
hiddenAttributes: string[]
|
|
35
|
+
hiddenAttributes: Record<string, string[]>;
|
|
36
36
|
historyDiff: HistoryDiff;
|
|
37
37
|
historyMode: HistoryMode;
|
|
38
38
|
historySlice: HistorySlice;
|
|
@@ -218,7 +218,7 @@ export declare const MdmModuleValuesContext: import("@fluentui/react-context-sel
|
|
|
218
218
|
mode: Mode;
|
|
219
219
|
isViewMode: boolean;
|
|
220
220
|
isEditableMode: boolean;
|
|
221
|
-
hiddenAttributes: string[]
|
|
221
|
+
hiddenAttributes: Record<string, string[]>;
|
|
222
222
|
historyDiff: HistoryDiff;
|
|
223
223
|
historyMode: HistoryMode;
|
|
224
224
|
historySlice: HistorySlice;
|
|
@@ -182,7 +182,7 @@ var useMdmRelationsDrafts = function (viewId) {
|
|
|
182
182
|
exports.useMdmRelationsDrafts = useMdmRelationsDrafts;
|
|
183
183
|
var useMdmDependentLookupEditorContext = function (attributeValue, attributeType) {
|
|
184
184
|
var value = useMdmModuleValuesContext(function (context) {
|
|
185
|
-
var _a;
|
|
185
|
+
var _a, _b, _c;
|
|
186
186
|
return (0, dependentLookupEditorContext_1.getDependentLookupEditorContext)({
|
|
187
187
|
dependentLookups: context.dependentLookups,
|
|
188
188
|
metadata: context.metadata,
|
|
@@ -190,7 +190,8 @@ var useMdmDependentLookupEditorContext = function (attributeValue, attributeType
|
|
|
190
190
|
modifiedEntities: context.modifiedEntities,
|
|
191
191
|
entityUri: (_a = context.entity) === null || _a === void 0 ? void 0 : _a.uri,
|
|
192
192
|
attributeValue: attributeValue,
|
|
193
|
-
attributeType: attributeType
|
|
193
|
+
attributeType: attributeType,
|
|
194
|
+
hiddenAttributes: (_b = context.hiddenAttributes) === null || _b === void 0 ? void 0 : _b[(_c = context.entity) === null || _c === void 0 ? void 0 : _c.uri]
|
|
194
195
|
});
|
|
195
196
|
});
|
|
196
197
|
return value;
|
|
@@ -17,6 +17,7 @@ type CommonProps = {
|
|
|
17
17
|
type GetDependentLookupEditorContextProps = CommonProps & {
|
|
18
18
|
attributeValue: SimpleAttributeValue;
|
|
19
19
|
attributeType: AttributeType;
|
|
20
|
+
hiddenAttributes?: string[];
|
|
20
21
|
};
|
|
21
|
-
export declare const getDependentLookupEditorContext: ({ dependentLookups, metadata, modifiedEntities, entityUri, relations, attributeValue, attributeType }: GetDependentLookupEditorContextProps) => DependentLookupEditorContext;
|
|
22
|
+
export declare const getDependentLookupEditorContext: ({ dependentLookups, metadata, modifiedEntities, entityUri, relations, attributeValue, attributeType, hiddenAttributes }: GetDependentLookupEditorContextProps) => DependentLookupEditorContext;
|
|
22
23
|
export {};
|
|
@@ -57,8 +57,10 @@ exports.buildMissedParentsMessage = buildMissedParentsMessage;
|
|
|
57
57
|
var getTypesMapKey = function (parent) { return "".concat(parent.type, "_").concat((0, mdm_sdk_1.getParentUri)(parent.uri)); };
|
|
58
58
|
var getParents = function (_a) {
|
|
59
59
|
var _b;
|
|
60
|
-
var dependentLookups = _a.dependentLookups, metadata = _a.metadata, modifiedEntities = _a.modifiedEntities, entityUri = _a.entityUri, relations = _a.relations, node = _a.node, valueUri = _a.valueUri;
|
|
61
|
-
var parentNodesValues = node.parents
|
|
60
|
+
var dependentLookups = _a.dependentLookups, metadata = _a.metadata, modifiedEntities = _a.modifiedEntities, entityUri = _a.entityUri, relations = _a.relations, node = _a.node, valueUri = _a.valueUri, hiddenAttributes = _a.hiddenAttributes;
|
|
61
|
+
var parentNodesValues = node.parents
|
|
62
|
+
.filter(function (type) { return !hiddenAttributes.includes(type); })
|
|
63
|
+
.flatMap(function (type) {
|
|
62
64
|
var parentNode = (0, mdm_sdk_1.getDependentLookupsStructureNode)(dependentLookups, type);
|
|
63
65
|
return parentNode.values.map(function (value) { return (__assign(__assign({}, value), { type: type, dependentLookupCode: parentNode.attrType.dependentLookupCode })); });
|
|
64
66
|
});
|
|
@@ -72,6 +74,7 @@ var getParents = function (_a) {
|
|
|
72
74
|
});
|
|
73
75
|
var possibleParentBaseTypeUris = (0, ramda_1.pipe)(mdm_sdk_1.getAttributeValuePath, (0, ramda_1.defaultTo)([]), (0, ramda_1.map)((0, ramda_1.pipe)((0, ramda_1.path)(['valueType', 'uri']), mdm_sdk_1.getBaseUri)), (0, ramda_1.prepend)((_b = modifiedEntities[entityUri]) === null || _b === void 0 ? void 0 : _b.type), (0, ramda_1.reject)(ramda_1.isNil), ramda_1.uniq)({ entityUri: entityUri, entitiesMap: modifiedEntities, connections: connections, metadata: metadata }, valueUri);
|
|
74
76
|
var neededParentsAttributeTypes = node.parents
|
|
77
|
+
.filter(function (type) { return !hiddenAttributes.includes(type); })
|
|
75
78
|
.filter(function (typeUri) { return possibleParentBaseTypeUris.some((0, mdm_sdk_1.areOneHierarchyUris)(typeUri)); })
|
|
76
79
|
.map(function (typeUri) {
|
|
77
80
|
var parentNode = (0, mdm_sdk_1.getDependentLookupsStructureNode)(dependentLookups, typeUri);
|
|
@@ -95,24 +98,25 @@ var getParents = function (_a) {
|
|
|
95
98
|
return { parents: parents, missedParentsAttributeTypes: missedParentsAttributeTypes };
|
|
96
99
|
};
|
|
97
100
|
var getDependentLookupEditorContext = function (_a) {
|
|
98
|
-
var dependentLookups = _a.dependentLookups, metadata = _a.metadata, modifiedEntities = _a.modifiedEntities, entityUri = _a.entityUri, relations = _a.relations, attributeValue = _a.attributeValue, attributeType = _a.attributeType;
|
|
99
|
-
if (!(0, mdm_sdk_1.isDependentLookupAttrType)(attributeType)) {
|
|
101
|
+
var dependentLookups = _a.dependentLookups, metadata = _a.metadata, modifiedEntities = _a.modifiedEntities, entityUri = _a.entityUri, relations = _a.relations, attributeValue = _a.attributeValue, attributeType = _a.attributeType, _b = _a.hiddenAttributes, hiddenAttributes = _b === void 0 ? [] : _b;
|
|
102
|
+
if (!(0, mdm_sdk_1.isDependentLookupAttrType)(attributeType) || hiddenAttributes.includes(attributeType.uri)) {
|
|
100
103
|
return null;
|
|
101
104
|
}
|
|
102
105
|
var attributeTypeUri = attributeType.uri;
|
|
103
106
|
var node = (0, mdm_sdk_1.getDependentLookupsStructureNode)(dependentLookups, attributeTypeUri);
|
|
104
107
|
if (node) {
|
|
105
108
|
var valueUri = attributeValue.uri;
|
|
106
|
-
var
|
|
109
|
+
var _c = getParents({
|
|
107
110
|
dependentLookups: dependentLookups,
|
|
108
111
|
metadata: metadata,
|
|
109
112
|
modifiedEntities: modifiedEntities,
|
|
110
113
|
entityUri: entityUri,
|
|
111
114
|
relations: relations,
|
|
112
115
|
valueUri: valueUri,
|
|
113
|
-
node: node
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
node: node,
|
|
117
|
+
hiddenAttributes: hiddenAttributes
|
|
118
|
+
}), parents = _c.parents, missedParentsAttributeTypes = _c.missedParentsAttributeTypes;
|
|
119
|
+
var _d = ((0, mdm_sdk_1.getDependentLookupEditorState)(dependentLookups, valueUri) || {}).isBlocked, isBlocked = _d === void 0 ? false : _d;
|
|
116
120
|
var missedParentsMessage = (0, exports.buildMissedParentsMessage)(missedParentsAttributeTypes);
|
|
117
121
|
var isEmptyValue = !(attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.lookupCode) && !(attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value);
|
|
118
122
|
var placeholder = (isEmptyValue && isBlocked && ui_i18n_1.default.text('Populating values...')) ||
|
|
@@ -32,7 +32,7 @@ export type MdmModuleValuesContextProps = Partial<{
|
|
|
32
32
|
mode: Mode;
|
|
33
33
|
isViewMode: boolean;
|
|
34
34
|
isEditableMode: boolean;
|
|
35
|
-
hiddenAttributes: string[]
|
|
35
|
+
hiddenAttributes: Record<string, string[]>;
|
|
36
36
|
historyDiff: HistoryDiff;
|
|
37
37
|
historyMode: HistoryMode;
|
|
38
38
|
historySlice: HistorySlice;
|
|
@@ -218,7 +218,7 @@ export declare const MdmModuleValuesContext: import("@fluentui/react-context-sel
|
|
|
218
218
|
mode: Mode;
|
|
219
219
|
isViewMode: boolean;
|
|
220
220
|
isEditableMode: boolean;
|
|
221
|
-
hiddenAttributes: string[]
|
|
221
|
+
hiddenAttributes: Record<string, string[]>;
|
|
222
222
|
historyDiff: HistoryDiff;
|
|
223
223
|
historyMode: HistoryMode;
|
|
224
224
|
historySlice: HistorySlice;
|
|
@@ -117,7 +117,7 @@ export var useMdmRelationsDrafts = function (viewId) {
|
|
|
117
117
|
};
|
|
118
118
|
export var useMdmDependentLookupEditorContext = function (attributeValue, attributeType) {
|
|
119
119
|
var value = useMdmModuleValuesContext(function (context) {
|
|
120
|
-
var _a;
|
|
120
|
+
var _a, _b, _c;
|
|
121
121
|
return getDependentLookupEditorContext({
|
|
122
122
|
dependentLookups: context.dependentLookups,
|
|
123
123
|
metadata: context.metadata,
|
|
@@ -125,7 +125,8 @@ export var useMdmDependentLookupEditorContext = function (attributeValue, attrib
|
|
|
125
125
|
modifiedEntities: context.modifiedEntities,
|
|
126
126
|
entityUri: (_a = context.entity) === null || _a === void 0 ? void 0 : _a.uri,
|
|
127
127
|
attributeValue: attributeValue,
|
|
128
|
-
attributeType: attributeType
|
|
128
|
+
attributeType: attributeType,
|
|
129
|
+
hiddenAttributes: (_b = context.hiddenAttributes) === null || _b === void 0 ? void 0 : _b[(_c = context.entity) === null || _c === void 0 ? void 0 : _c.uri]
|
|
129
130
|
});
|
|
130
131
|
});
|
|
131
132
|
return value;
|
|
@@ -17,6 +17,7 @@ type CommonProps = {
|
|
|
17
17
|
type GetDependentLookupEditorContextProps = CommonProps & {
|
|
18
18
|
attributeValue: SimpleAttributeValue;
|
|
19
19
|
attributeType: AttributeType;
|
|
20
|
+
hiddenAttributes?: string[];
|
|
20
21
|
};
|
|
21
|
-
export declare const getDependentLookupEditorContext: ({ dependentLookups, metadata, modifiedEntities, entityUri, relations, attributeValue, attributeType }: GetDependentLookupEditorContextProps) => DependentLookupEditorContext;
|
|
22
|
+
export declare const getDependentLookupEditorContext: ({ dependentLookups, metadata, modifiedEntities, entityUri, relations, attributeValue, attributeType, hiddenAttributes }: GetDependentLookupEditorContextProps) => DependentLookupEditorContext;
|
|
22
23
|
export {};
|
|
@@ -49,8 +49,10 @@ export var buildMissedParentsMessage = function (missedAttributeTypes) {
|
|
|
49
49
|
var getTypesMapKey = function (parent) { return "".concat(parent.type, "_").concat(getParentUri(parent.uri)); };
|
|
50
50
|
var getParents = function (_a) {
|
|
51
51
|
var _b;
|
|
52
|
-
var dependentLookups = _a.dependentLookups, metadata = _a.metadata, modifiedEntities = _a.modifiedEntities, entityUri = _a.entityUri, relations = _a.relations, node = _a.node, valueUri = _a.valueUri;
|
|
53
|
-
var parentNodesValues = node.parents
|
|
52
|
+
var dependentLookups = _a.dependentLookups, metadata = _a.metadata, modifiedEntities = _a.modifiedEntities, entityUri = _a.entityUri, relations = _a.relations, node = _a.node, valueUri = _a.valueUri, hiddenAttributes = _a.hiddenAttributes;
|
|
53
|
+
var parentNodesValues = node.parents
|
|
54
|
+
.filter(function (type) { return !hiddenAttributes.includes(type); })
|
|
55
|
+
.flatMap(function (type) {
|
|
54
56
|
var parentNode = getDependentLookupsStructureNode(dependentLookups, type);
|
|
55
57
|
return parentNode.values.map(function (value) { return (__assign(__assign({}, value), { type: type, dependentLookupCode: parentNode.attrType.dependentLookupCode })); });
|
|
56
58
|
});
|
|
@@ -64,6 +66,7 @@ var getParents = function (_a) {
|
|
|
64
66
|
});
|
|
65
67
|
var possibleParentBaseTypeUris = pipe(getAttributeValuePath, defaultTo([]), map(pipe(path(['valueType', 'uri']), getBaseUri)), prepend((_b = modifiedEntities[entityUri]) === null || _b === void 0 ? void 0 : _b.type), reject(isNil), uniq)({ entityUri: entityUri, entitiesMap: modifiedEntities, connections: connections, metadata: metadata }, valueUri);
|
|
66
68
|
var neededParentsAttributeTypes = node.parents
|
|
69
|
+
.filter(function (type) { return !hiddenAttributes.includes(type); })
|
|
67
70
|
.filter(function (typeUri) { return possibleParentBaseTypeUris.some(areOneHierarchyUris(typeUri)); })
|
|
68
71
|
.map(function (typeUri) {
|
|
69
72
|
var parentNode = getDependentLookupsStructureNode(dependentLookups, typeUri);
|
|
@@ -87,24 +90,25 @@ var getParents = function (_a) {
|
|
|
87
90
|
return { parents: parents, missedParentsAttributeTypes: missedParentsAttributeTypes };
|
|
88
91
|
};
|
|
89
92
|
export var getDependentLookupEditorContext = function (_a) {
|
|
90
|
-
var dependentLookups = _a.dependentLookups, metadata = _a.metadata, modifiedEntities = _a.modifiedEntities, entityUri = _a.entityUri, relations = _a.relations, attributeValue = _a.attributeValue, attributeType = _a.attributeType;
|
|
91
|
-
if (!isDependentLookupAttrType(attributeType)) {
|
|
93
|
+
var dependentLookups = _a.dependentLookups, metadata = _a.metadata, modifiedEntities = _a.modifiedEntities, entityUri = _a.entityUri, relations = _a.relations, attributeValue = _a.attributeValue, attributeType = _a.attributeType, _b = _a.hiddenAttributes, hiddenAttributes = _b === void 0 ? [] : _b;
|
|
94
|
+
if (!isDependentLookupAttrType(attributeType) || hiddenAttributes.includes(attributeType.uri)) {
|
|
92
95
|
return null;
|
|
93
96
|
}
|
|
94
97
|
var attributeTypeUri = attributeType.uri;
|
|
95
98
|
var node = getDependentLookupsStructureNode(dependentLookups, attributeTypeUri);
|
|
96
99
|
if (node) {
|
|
97
100
|
var valueUri = attributeValue.uri;
|
|
98
|
-
var
|
|
101
|
+
var _c = getParents({
|
|
99
102
|
dependentLookups: dependentLookups,
|
|
100
103
|
metadata: metadata,
|
|
101
104
|
modifiedEntities: modifiedEntities,
|
|
102
105
|
entityUri: entityUri,
|
|
103
106
|
relations: relations,
|
|
104
107
|
valueUri: valueUri,
|
|
105
|
-
node: node
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
node: node,
|
|
109
|
+
hiddenAttributes: hiddenAttributes
|
|
110
|
+
}), parents = _c.parents, missedParentsAttributeTypes = _c.missedParentsAttributeTypes;
|
|
111
|
+
var _d = (getDependentLookupEditorState(dependentLookups, valueUri) || {}).isBlocked, isBlocked = _d === void 0 ? false : _d;
|
|
108
112
|
var missedParentsMessage = buildMissedParentsMessage(missedParentsAttributeTypes);
|
|
109
113
|
var isEmptyValue = !(attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.lookupCode) && !(attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value);
|
|
110
114
|
var placeholder = (isEmptyValue && isBlocked && i18n.text('Populating values...')) ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1871",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
10
|
"@react-sigma/core": "3.4.0",
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1812",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|