@reltio/components 1.4.2278 → 1.4.2279
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/ScreenProfileBand/ScreenProfileBand.d.ts +2 -1
- package/ScreenProfileBand/ScreenProfileBand.js +3 -3
- package/ScreenProfileBand/ScreenProfileBand.test.js +15 -0
- package/cjs/ScreenProfileBand/ScreenProfileBand.d.ts +2 -1
- package/cjs/ScreenProfileBand/ScreenProfileBand.js +3 -3
- package/cjs/ScreenProfileBand/ScreenProfileBand.test.js +15 -0
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ type Props = {
|
|
|
5
5
|
className?: string;
|
|
6
6
|
historySlice?: HistorySlice;
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
+
hideNavigation?: boolean;
|
|
8
9
|
};
|
|
9
|
-
export declare const ScreenProfileBand: React.MemoExoticComponent<({ entity, className, historySlice, children }: Props) => React.JSX.Element>;
|
|
10
|
+
export declare const ScreenProfileBand: React.MemoExoticComponent<({ entity, className, historySlice, children, hideNavigation }: Props) => React.JSX.Element>;
|
|
10
11
|
export {};
|
|
@@ -10,15 +10,15 @@ import { useCollaboration } from '../hooks/useCollaboration';
|
|
|
10
10
|
import { ProfileBandHistory } from '../features/history';
|
|
11
11
|
import styles from './ScreenProfileBand.module.css';
|
|
12
12
|
export var ScreenProfileBand = memo(function (_a) {
|
|
13
|
-
var entity = _a.entity, className = _a.className, historySlice = _a.historySlice, children = _a.children;
|
|
13
|
+
var entity = _a.entity, className = _a.className, historySlice = _a.historySlice, children = _a.children, _b = _a.hideNavigation, hideNavigation = _b === void 0 ? false : _b;
|
|
14
14
|
var objectIds = useMemo(function () { return getProfileBandObjectIdsForCollaboration(entity); }, [entity]);
|
|
15
15
|
var collaboration = useCollaboration({ objectIds: objectIds });
|
|
16
16
|
var entityUri = getEntityUriForLink(entity);
|
|
17
17
|
return (React.createElement(CollaborationContextProvider, { collaboration: collaboration },
|
|
18
18
|
React.createElement(ProfileBand, { className: classnames(className, COMMENTS_CONTAINER_VISIBILITY_AREA), entity: (historySlice === null || historySlice === void 0 ? void 0 : historySlice.aEntity) || entity }, historySlice ? (React.createElement(ProfileBandHistory, null)) : (React.createElement(React.Fragment, null,
|
|
19
19
|
children ? (React.createElement("div", { className: classnames(styles.profileBandNavigation, styles.navigationRow) },
|
|
20
|
-
React.createElement(ProfileBandNavigation, null),
|
|
21
|
-
children)) : (React.createElement(ProfileBandNavigation, { className: styles.profileBandNavigation })),
|
|
20
|
+
!hideNavigation && React.createElement(ProfileBandNavigation, null),
|
|
21
|
+
children)) : (!hideNavigation && React.createElement(ProfileBandNavigation, { className: styles.profileBandNavigation })),
|
|
22
22
|
React.createElement(CommentsContainer, { className: styles.comments, uri: entityUri, relatedObjectUris: createRelatedObjectUris(CollaborationObjectTypes.ENTITY, {
|
|
23
23
|
entityUri: entityUri
|
|
24
24
|
}), objectType: CollaborationObjectTypes.ENTITY }))))));
|
|
@@ -127,6 +127,21 @@ describe('Screen profile band tests', function () {
|
|
|
127
127
|
setUp({ props: props });
|
|
128
128
|
expect(screen.getByRole('button', { name: 'Custom Action' })).toBeInTheDocument();
|
|
129
129
|
});
|
|
130
|
+
it('should hide navigation but keep children when hideNavigation is true and children are provided', function () {
|
|
131
|
+
var props = __assign(__assign({}, defaultProps), { hideNavigation: true, children: React.createElement("button", null, "Custom Action") });
|
|
132
|
+
setUp({ props: props });
|
|
133
|
+
expect(screen.getByRole('button', { name: 'Custom Action' })).toBeInTheDocument();
|
|
134
|
+
expect(screen.queryByText('3 Search results')).not.toBeInTheDocument();
|
|
135
|
+
expect(screen.queryByLabelText('Go to previous profile')).not.toBeInTheDocument();
|
|
136
|
+
expect(screen.queryByLabelText('Go to next profile')).not.toBeInTheDocument();
|
|
137
|
+
});
|
|
138
|
+
it('should hide navigation when hideNavigation is true and no children provided', function () {
|
|
139
|
+
var props = __assign(__assign({}, defaultProps), { hideNavigation: true });
|
|
140
|
+
setUp({ props: props });
|
|
141
|
+
expect(screen.queryByText('3 Search results')).not.toBeInTheDocument();
|
|
142
|
+
expect(screen.queryByLabelText('Go to previous profile')).not.toBeInTheDocument();
|
|
143
|
+
expect(screen.queryByLabelText('Go to next profile')).not.toBeInTheDocument();
|
|
144
|
+
});
|
|
130
145
|
it('should render profile band history if historySlice prop is provided', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
131
146
|
var historySlice, props, mdmValues;
|
|
132
147
|
return __generator(this, function (_a) {
|
|
@@ -5,6 +5,7 @@ type Props = {
|
|
|
5
5
|
className?: string;
|
|
6
6
|
historySlice?: HistorySlice;
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
+
hideNavigation?: boolean;
|
|
8
9
|
};
|
|
9
|
-
export declare const ScreenProfileBand: React.MemoExoticComponent<({ entity, className, historySlice, children }: Props) => React.JSX.Element>;
|
|
10
|
+
export declare const ScreenProfileBand: React.MemoExoticComponent<({ entity, className, historySlice, children, hideNavigation }: Props) => React.JSX.Element>;
|
|
10
11
|
export {};
|
|
@@ -39,15 +39,15 @@ var useCollaboration_1 = require("../hooks/useCollaboration");
|
|
|
39
39
|
var history_1 = require("../features/history");
|
|
40
40
|
var ScreenProfileBand_module_css_1 = __importDefault(require("./ScreenProfileBand.module.css"));
|
|
41
41
|
exports.ScreenProfileBand = (0, react_1.memo)(function (_a) {
|
|
42
|
-
var entity = _a.entity, className = _a.className, historySlice = _a.historySlice, children = _a.children;
|
|
42
|
+
var entity = _a.entity, className = _a.className, historySlice = _a.historySlice, children = _a.children, _b = _a.hideNavigation, hideNavigation = _b === void 0 ? false : _b;
|
|
43
43
|
var objectIds = (0, react_1.useMemo)(function () { return (0, mdm_sdk_1.getProfileBandObjectIdsForCollaboration)(entity); }, [entity]);
|
|
44
44
|
var collaboration = (0, useCollaboration_1.useCollaboration)({ objectIds: objectIds });
|
|
45
45
|
var entityUri = (0, mdm_sdk_1.getEntityUriForLink)(entity);
|
|
46
46
|
return (react_1.default.createElement(CollaborationContext_1.CollaborationContextProvider, { collaboration: collaboration },
|
|
47
47
|
react_1.default.createElement(ProfileBand_1.ProfileBand, { className: (0, classnames_1.default)(className, constants_1.COMMENTS_CONTAINER_VISIBILITY_AREA), entity: (historySlice === null || historySlice === void 0 ? void 0 : historySlice.aEntity) || entity }, historySlice ? (react_1.default.createElement(history_1.ProfileBandHistory, null)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
48
48
|
children ? (react_1.default.createElement("div", { className: (0, classnames_1.default)(ScreenProfileBand_module_css_1.default.profileBandNavigation, ScreenProfileBand_module_css_1.default.navigationRow) },
|
|
49
|
-
react_1.default.createElement(ProfileBandNavigation_1.ProfileBandNavigation, null),
|
|
50
|
-
children)) : (react_1.default.createElement(ProfileBandNavigation_1.ProfileBandNavigation, { className: ScreenProfileBand_module_css_1.default.profileBandNavigation })),
|
|
49
|
+
!hideNavigation && react_1.default.createElement(ProfileBandNavigation_1.ProfileBandNavigation, null),
|
|
50
|
+
children)) : (!hideNavigation && react_1.default.createElement(ProfileBandNavigation_1.ProfileBandNavigation, { className: ScreenProfileBand_module_css_1.default.profileBandNavigation })),
|
|
51
51
|
react_1.default.createElement(CommentsContainer_1.CommentsContainer, { className: ScreenProfileBand_module_css_1.default.comments, uri: entityUri, relatedObjectUris: (0, mdm_sdk_1.createRelatedObjectUris)(mdm_sdk_1.CollaborationObjectTypes.ENTITY, {
|
|
52
52
|
entityUri: entityUri
|
|
53
53
|
}), objectType: mdm_sdk_1.CollaborationObjectTypes.ENTITY }))))));
|
|
@@ -132,6 +132,21 @@ describe('Screen profile band tests', function () {
|
|
|
132
132
|
setUp({ props: props });
|
|
133
133
|
expect(react_2.screen.getByRole('button', { name: 'Custom Action' })).toBeInTheDocument();
|
|
134
134
|
});
|
|
135
|
+
it('should hide navigation but keep children when hideNavigation is true and children are provided', function () {
|
|
136
|
+
var props = __assign(__assign({}, defaultProps), { hideNavigation: true, children: react_1.default.createElement("button", null, "Custom Action") });
|
|
137
|
+
setUp({ props: props });
|
|
138
|
+
expect(react_2.screen.getByRole('button', { name: 'Custom Action' })).toBeInTheDocument();
|
|
139
|
+
expect(react_2.screen.queryByText('3 Search results')).not.toBeInTheDocument();
|
|
140
|
+
expect(react_2.screen.queryByLabelText('Go to previous profile')).not.toBeInTheDocument();
|
|
141
|
+
expect(react_2.screen.queryByLabelText('Go to next profile')).not.toBeInTheDocument();
|
|
142
|
+
});
|
|
143
|
+
it('should hide navigation when hideNavigation is true and no children provided', function () {
|
|
144
|
+
var props = __assign(__assign({}, defaultProps), { hideNavigation: true });
|
|
145
|
+
setUp({ props: props });
|
|
146
|
+
expect(react_2.screen.queryByText('3 Search results')).not.toBeInTheDocument();
|
|
147
|
+
expect(react_2.screen.queryByLabelText('Go to previous profile')).not.toBeInTheDocument();
|
|
148
|
+
expect(react_2.screen.queryByLabelText('Go to next profile')).not.toBeInTheDocument();
|
|
149
|
+
});
|
|
135
150
|
it('should render profile band history if historySlice prop is provided', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
136
151
|
var historySlice, props, mdmValues;
|
|
137
152
|
return __generator(this, function (_a) {
|