@reltio/components 1.4.2278 → 1.4.2280

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.
@@ -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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.2278",
3
+ "version": "1.4.2280",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -11,7 +11,7 @@
11
11
  "@fluentui/react-context-selector": "^9.1.26",
12
12
  "@googlemaps/markerclusterer": "^2.5.3",
13
13
  "@react-sigma/core": "3.4.0",
14
- "@reltio/mdm-sdk": "^1.4.2053",
14
+ "@reltio/mdm-sdk": "^1.4.2054",
15
15
  "@vis.gl/react-google-maps": "^1.3.0",
16
16
  "d3-cloud": "^1.2.5",
17
17
  "d3-geo": "^2.0.1",