@reltio/components 1.4.1962 → 1.4.1963
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.
|
@@ -162,6 +162,16 @@ describe('AttributesView tests', function () {
|
|
|
162
162
|
expect(react_2.screen.getByText('Last Name')).toBeInTheDocument();
|
|
163
163
|
expect(react_2.screen.getByText('Phone')).toBeInTheDocument();
|
|
164
164
|
});
|
|
165
|
+
it('should render always visible attributes in read mode for entity without filled attributes', function () {
|
|
166
|
+
var alwaysVisible = [
|
|
167
|
+
'configuration/entityTypes/HCP/attributes/LastName',
|
|
168
|
+
'configuration/entityTypes/HCP/attributes/Phone'
|
|
169
|
+
];
|
|
170
|
+
var notFilledEntity = __assign(__assign({}, entity), { attributes: {} });
|
|
171
|
+
setUp({ mode: mdm_sdk_1.Mode.Viewing, entity: notFilledEntity, alwaysVisible: alwaysVisible });
|
|
172
|
+
expect(react_2.screen.getByText('Last Name')).toBeInTheDocument();
|
|
173
|
+
expect(react_2.screen.getByText('Phone')).toBeInTheDocument();
|
|
174
|
+
});
|
|
165
175
|
it('should show control attribute icon if an attribute is a always visible control attribute in view mode', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
166
176
|
var alwaysVisible, user, controlAttribute, icon, _a;
|
|
167
177
|
return __generator(this, function (_b) {
|
|
@@ -35,6 +35,7 @@ var Box_1 = __importDefault(require("@mui/material/Box"));
|
|
|
35
35
|
var Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
36
36
|
var PivotingAttributeContext_1 = require("../contexts/PivotingAttributeContext");
|
|
37
37
|
var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
38
|
+
var AllwaysVisibleAttributesContext_1 = require("../contexts/AllwaysVisibleAttributesContext");
|
|
38
39
|
var BasicView_1 = require("../BasicView");
|
|
39
40
|
var FacetViewHeader_1 = require("../FacetViewHeader");
|
|
40
41
|
var ReadOnlyAttributesList_1 = require("../ReadOnlyAttributesList");
|
|
@@ -50,10 +51,11 @@ var ReadOnlyAttributesView = function (_a) {
|
|
|
50
51
|
var filteredAttrTypes = (0, react_1.useMemo)(function () { return (0, attributesView_1.getFilteredAttrTypes)(metadata, entity.type, includeUris, excludeUris); }, [excludeUris, includeUris, metadata, entity]);
|
|
51
52
|
var attributesCount = attributesCountProp || DEFAULT_ATTRIBUTES_COUNT;
|
|
52
53
|
var attributesList = (0, mdm_sdk_1.getAttributesListForReadMode)(filteredAttrTypes, entity);
|
|
54
|
+
var alwaysVisible = (0, react_1.useContext)(AllwaysVisibleAttributesContext_1.AlwaysVisibleAttributesContext);
|
|
53
55
|
var isShowAttributeList = attributesList.filter(function (_a) {
|
|
54
56
|
var values = _a.values;
|
|
55
57
|
return !(0, mdm_sdk_1.isEmptyValue)(values);
|
|
56
|
-
}).length > 0;
|
|
58
|
+
}).length > 0 || alwaysVisible.length > 0;
|
|
57
59
|
return isShowAttributeList || !(0, mdm_sdk_1.isEmptyValue)(caption) ? (react_1.default.createElement(PivotingAttributeContext_1.PivotingAttributeContext.Provider, { value: pivotingAttributes },
|
|
58
60
|
react_1.default.createElement(BasicView_1.BasicView, { className: className },
|
|
59
61
|
caption && react_1.default.createElement(FacetViewHeader_1.FacetViewHeader, { title: caption }),
|
|
@@ -157,6 +157,16 @@ describe('AttributesView tests', function () {
|
|
|
157
157
|
expect(screen.getByText('Last Name')).toBeInTheDocument();
|
|
158
158
|
expect(screen.getByText('Phone')).toBeInTheDocument();
|
|
159
159
|
});
|
|
160
|
+
it('should render always visible attributes in read mode for entity without filled attributes', function () {
|
|
161
|
+
var alwaysVisible = [
|
|
162
|
+
'configuration/entityTypes/HCP/attributes/LastName',
|
|
163
|
+
'configuration/entityTypes/HCP/attributes/Phone'
|
|
164
|
+
];
|
|
165
|
+
var notFilledEntity = __assign(__assign({}, entity), { attributes: {} });
|
|
166
|
+
setUp({ mode: Mode.Viewing, entity: notFilledEntity, alwaysVisible: alwaysVisible });
|
|
167
|
+
expect(screen.getByText('Last Name')).toBeInTheDocument();
|
|
168
|
+
expect(screen.getByText('Phone')).toBeInTheDocument();
|
|
169
|
+
});
|
|
160
170
|
it('should show control attribute icon if an attribute is a always visible control attribute in view mode', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
161
171
|
var alwaysVisible, user, controlAttribute, icon, _a;
|
|
162
172
|
return __generator(this, function (_b) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
1
|
+
import React, { useContext, useMemo } from 'react';
|
|
2
2
|
import { getAttributesListForReadMode, isEmptyValue } from '@reltio/mdm-sdk';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import i18n from 'ui-i18n';
|
|
@@ -6,6 +6,7 @@ import Box from '@mui/material/Box';
|
|
|
6
6
|
import Typography from '@mui/material/Typography';
|
|
7
7
|
import { PivotingAttributeContext } from '../contexts/PivotingAttributeContext';
|
|
8
8
|
import { useMdmMetadata, useMdmPivotingAttributes } from '../contexts/MdmModuleContext';
|
|
9
|
+
import { AlwaysVisibleAttributesContext } from '../contexts/AllwaysVisibleAttributesContext';
|
|
9
10
|
import { BasicView } from '../BasicView';
|
|
10
11
|
import { FacetViewHeader } from '../FacetViewHeader';
|
|
11
12
|
import { ReadOnlyAttributesList } from '../ReadOnlyAttributesList';
|
|
@@ -21,10 +22,11 @@ export var ReadOnlyAttributesView = function (_a) {
|
|
|
21
22
|
var filteredAttrTypes = useMemo(function () { return getFilteredAttrTypes(metadata, entity.type, includeUris, excludeUris); }, [excludeUris, includeUris, metadata, entity]);
|
|
22
23
|
var attributesCount = attributesCountProp || DEFAULT_ATTRIBUTES_COUNT;
|
|
23
24
|
var attributesList = getAttributesListForReadMode(filteredAttrTypes, entity);
|
|
25
|
+
var alwaysVisible = useContext(AlwaysVisibleAttributesContext);
|
|
24
26
|
var isShowAttributeList = attributesList.filter(function (_a) {
|
|
25
27
|
var values = _a.values;
|
|
26
28
|
return !isEmptyValue(values);
|
|
27
|
-
}).length > 0;
|
|
29
|
+
}).length > 0 || alwaysVisible.length > 0;
|
|
28
30
|
return isShowAttributeList || !isEmptyValue(caption) ? (React.createElement(PivotingAttributeContext.Provider, { value: pivotingAttributes },
|
|
29
31
|
React.createElement(BasicView, { className: className },
|
|
30
32
|
caption && React.createElement(FacetViewHeader, { title: caption }),
|