@reltio/components 1.4.1522 → 1.4.1523

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.
Files changed (43) hide show
  1. package/cjs/components/ProfileResizablePanes/ProfileResizablePanes.d.ts +14 -0
  2. package/cjs/components/ProfileResizablePanes/ProfileResizablePanes.js +64 -0
  3. package/cjs/components/ProfileResizablePanes/styles.d.ts +2 -0
  4. package/cjs/components/ProfileResizablePanes/styles.js +22 -0
  5. package/cjs/components/ResizablePanes/ResizablePanes.d.ts +26 -27
  6. package/cjs/components/ResizablePanes/ResizablePanes.js +11 -21
  7. package/cjs/components/ResizablePanes/styles.d.ts +2 -1
  8. package/cjs/components/SideIconPanel/SideButtonsPanel.d.ts +4 -4
  9. package/cjs/components/SideIconPanel/SideButtonsPanel.js +2 -2
  10. package/cjs/components/SidePanel/SidePanel.d.ts +1 -1
  11. package/cjs/components/SidePanel/SidePanel.js +1 -1
  12. package/cjs/components/SidePanel/styles.js +2 -1
  13. package/cjs/components/history/hooks/useHistoryEnabled.d.ts +3 -2
  14. package/cjs/components/history/hooks/useHistoryEnabled.js +5 -1
  15. package/cjs/components/index.d.ts +2 -1
  16. package/cjs/components/index.js +5 -3
  17. package/cjs/contexts/PerspectivesSettingsContext/index.d.ts +12 -0
  18. package/cjs/contexts/PerspectivesSettingsContext/index.js +41 -0
  19. package/cjs/contexts/index.d.ts +1 -0
  20. package/cjs/contexts/index.js +4 -1
  21. package/cjs/types/index.d.ts +24 -0
  22. package/esm/components/ProfileResizablePanes/ProfileResizablePanes.d.ts +14 -0
  23. package/esm/components/ProfileResizablePanes/ProfileResizablePanes.js +37 -0
  24. package/esm/components/ProfileResizablePanes/styles.d.ts +2 -0
  25. package/esm/components/ProfileResizablePanes/styles.js +19 -0
  26. package/esm/components/ResizablePanes/ResizablePanes.d.ts +26 -27
  27. package/esm/components/ResizablePanes/ResizablePanes.js +10 -22
  28. package/esm/components/ResizablePanes/styles.d.ts +2 -1
  29. package/esm/components/SideIconPanel/SideButtonsPanel.d.ts +4 -4
  30. package/esm/components/SideIconPanel/SideButtonsPanel.js +2 -2
  31. package/esm/components/SidePanel/SidePanel.d.ts +1 -1
  32. package/esm/components/SidePanel/SidePanel.js +1 -1
  33. package/esm/components/SidePanel/styles.js +2 -1
  34. package/esm/components/history/hooks/useHistoryEnabled.d.ts +3 -2
  35. package/esm/components/history/hooks/useHistoryEnabled.js +5 -1
  36. package/esm/components/index.d.ts +2 -1
  37. package/esm/components/index.js +2 -1
  38. package/esm/contexts/PerspectivesSettingsContext/index.d.ts +12 -0
  39. package/esm/contexts/PerspectivesSettingsContext/index.js +14 -0
  40. package/esm/contexts/index.d.ts +1 -0
  41. package/esm/contexts/index.js +1 -0
  42. package/esm/types/index.d.ts +24 -0
  43. package/package.json +3 -3
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { RightPanelTab } from '../../types';
3
+ declare type Props = {
4
+ perspectiveId: string;
5
+ children: [React.ReactElement, React.ReactElement];
6
+ buttonsProps: Array<RightPanelTab['buttonProps']>;
7
+ disabled?: boolean;
8
+ defaultTab?: number;
9
+ };
10
+ export declare const ProfileResizablePanes: {
11
+ ({ perspectiveId, children, buttonsProps, disabled, defaultTab }: Props): JSX.Element;
12
+ displayName: string;
13
+ };
14
+ export {};
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ProfileResizablePanes = void 0;
27
+ var react_1 = __importStar(require("react"));
28
+ var ResizablePanes_1 = require("../ResizablePanes/ResizablePanes");
29
+ var SideButtonsPanel_1 = require("../SideIconPanel/SideButtonsPanel");
30
+ var contexts_1 = require("../../contexts");
31
+ var ramda_1 = require("ramda");
32
+ var styles_1 = require("./styles");
33
+ var DEFAULT_R_PANE_SIZE = 480;
34
+ var MIN_R_PANE_SIZE = 320;
35
+ var MAX_R_PANE_SIZE = 640;
36
+ var ProfileResizablePanes = function (_a) {
37
+ var perspectiveId = _a.perspectiveId, children = _a.children, buttonsProps = _a.buttonsProps, disabled = _a.disabled, defaultTab = _a.defaultTab;
38
+ var styles = (0, styles_1.useStyles)();
39
+ var _b = (0, contexts_1.usePerspectivesSettings)(perspectiveId), perspectiveSettings = _b.perspectiveSettings, updatePerspectiveSettings = _b.updatePerspectiveSettings;
40
+ var _c = (perspectiveSettings || {}).width, width = _c === void 0 ? DEFAULT_R_PANE_SIZE : _c;
41
+ var active = defaultTab || (perspectiveSettings === null || perspectiveSettings === void 0 ? void 0 : perspectiveSettings.active);
42
+ var isSidePanelOpen = !(0, ramda_1.isNil)(active) && !disabled;
43
+ var handleUpdateSettings = (0, react_1.useCallback)(function (newSetting) {
44
+ updatePerspectiveSettings(newSetting);
45
+ }, [updatePerspectiveSettings]);
46
+ var toggleActive = (0, react_1.useCallback)(function (newId) {
47
+ var newActive = active === newId ? null : newId;
48
+ handleUpdateSettings({ active: newActive });
49
+ }, [active, handleUpdateSettings]);
50
+ var resetActive = (0, react_1.useCallback)(function () {
51
+ handleUpdateSettings({ active: null });
52
+ }, [handleUpdateSettings]);
53
+ var handlePaneSizeChange = (0, react_1.useCallback)(function (_a) {
54
+ var size = _a.size;
55
+ handleUpdateSettings({ width: size });
56
+ }, [handleUpdateSettings]);
57
+ return (react_1.default.createElement(react_1.default.Fragment, null,
58
+ react_1.default.createElement(ResizablePanes_1.ResizablePanes, { className: styles.resizablePanesWrapper, primary: "second", orientation: "vertical", size: isSidePanelOpen ? width : 0, minSize: MIN_R_PANE_SIZE, maxSize: MAX_R_PANE_SIZE, allowResize: isSidePanelOpen, onChange: handlePaneSizeChange, debounceInterval: 2500 },
59
+ react_1.default.createElement("div", { className: styles.pane }, children[0]),
60
+ react_1.default.createElement("div", { className: styles.pane }, (0, react_1.cloneElement)(children[1], { active: active, onClose: resetActive }))),
61
+ react_1.default.createElement(SideButtonsPanel_1.SideButtonsPanel, { disabled: disabled, buttonsProps: buttonsProps, onButtonClick: toggleActive, activeIndexId: active })));
62
+ };
63
+ exports.ProfileResizablePanes = ProfileResizablePanes;
64
+ exports.ProfileResizablePanes.displayName = 'ProfileResizablePanes';
@@ -0,0 +1,2 @@
1
+ declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"resizablePanesWrapper" | "pane">;
2
+ export { useStyles };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useStyles = void 0;
4
+ var styles_1 = require("@material-ui/core/styles");
5
+ var useStyles = (0, styles_1.makeStyles)(function () { return ({
6
+ resizablePanesWrapper: {
7
+ flexGrow: 1,
8
+ height: '100%',
9
+ marginRight: '1px'
10
+ },
11
+ pane: {
12
+ position: 'absolute',
13
+ top: 0,
14
+ left: 0,
15
+ right: 0,
16
+ bottom: 0,
17
+ display: 'flex',
18
+ flexDirection: 'column',
19
+ overflow: 'hidden'
20
+ }
21
+ }); });
22
+ exports.useStyles = useStyles;
@@ -1,27 +1,26 @@
1
- export default ResizablePanes;
2
- declare function ResizablePanes({ className, children, orientation, defaultSize, size, minSize, maxSize, allowResize, onChange }: {
3
- className: any;
4
- children: any;
5
- orientation: any;
6
- defaultSize: any;
7
- size: any;
8
- minSize: any;
9
- maxSize: any;
10
- allowResize: any;
11
- onChange: any;
12
- }): JSX.Element;
13
- declare namespace ResizablePanes {
14
- namespace propTypes {
15
- export const className: PropTypes.Requireable<string>;
16
- export const children: PropTypes.Validator<PropTypes.ReactNodeLike[]>;
17
- export const orientation: PropTypes.Validator<string>;
18
- export { SizePropType as defaultSize };
19
- export { SizePropType as size };
20
- export { SizePropType as minSize };
21
- export { SizePropType as maxSize };
22
- export const allowResize: PropTypes.Requireable<boolean>;
23
- export const onChange: PropTypes.Requireable<(...args: any[]) => any>;
24
- }
25
- }
26
- import PropTypes from "prop-types";
27
- declare const SizePropType: PropTypes.Requireable<NonNullable<string | number>>;
1
+ import React from 'react';
2
+ export declare type Size = string | number;
3
+ declare type OnChange = {
4
+ size: number;
5
+ percentageSize: string;
6
+ isMaxSize: boolean;
7
+ isMinSize: boolean;
8
+ };
9
+ declare type Props = {
10
+ className?: string;
11
+ children: React.ReactElement[];
12
+ allowResize?: boolean;
13
+ primary?: 'first' | 'second';
14
+ minSize?: Size;
15
+ maxSize?: Size;
16
+ defaultSize?: Size;
17
+ debounceInterval?: number;
18
+ size?: Size;
19
+ orientation?: 'vertical' | 'horizontal';
20
+ onChange?: ({ size, percentageSize, isMaxSize, isMinSize }: OnChange) => void;
21
+ };
22
+ export declare const ResizablePanes: {
23
+ ({ className, children, orientation, primary, defaultSize, size, minSize, maxSize, allowResize, debounceInterval, onChange }: Props): JSX.Element;
24
+ displayName: string;
25
+ };
26
+ export {};
@@ -26,21 +26,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ResizablePanes = void 0;
29
30
  var react_1 = __importStar(require("react"));
30
31
  var classnames_1 = __importDefault(require("classnames"));
31
- var prop_types_1 = __importDefault(require("prop-types"));
32
32
  var react_split_pane_1 = __importDefault(require("react-split-pane"));
33
33
  var styles_1 = require("@material-ui/core/styles");
34
- var styles_2 = require("./styles");
35
34
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
35
+ var styles_2 = require("./styles");
36
36
  var HANDLE_CHANGE_DEBOUNCE_INTERVAL = 250;
37
37
  var isHorizontal = function (orientation) { return orientation === 'horizontal'; };
38
38
  var ResizablePanes = function (_a) {
39
- var className = _a.className, children = _a.children, orientation = _a.orientation, defaultSize = _a.defaultSize, size = _a.size, minSize = _a.minSize, maxSize = _a.maxSize, allowResize = _a.allowResize, onChange = _a.onChange;
39
+ var className = _a.className, children = _a.children, orientation = _a.orientation, primary = _a.primary, defaultSize = _a.defaultSize, size = _a.size, minSize = _a.minSize, maxSize = _a.maxSize, allowResize = _a.allowResize, _b = _a.debounceInterval, debounceInterval = _b === void 0 ? HANDLE_CHANGE_DEBOUNCE_INTERVAL : _b, onChange = _a.onChange;
40
40
  var styles = (0, styles_2.useStyles)();
41
41
  var theme = (0, styles_1.useTheme)();
42
- var _b = (0, react_1.useState)(), containerEl = _b[0], setContainerEl = _b[1];
43
- var _c = (0, react_1.useState)(true), isPaneAnimationEnabled = _c[0], setIsPaneAnimationEnabled = _c[1];
42
+ var _c = (0, react_1.useState)(null), containerEl = _c[0], setContainerEl = _c[1];
43
+ var _d = (0, react_1.useState)(true), isPaneAnimationEnabled = _d[0], setIsPaneAnimationEnabled = _d[1];
44
44
  var enableAnimation = (0, react_1.useCallback)(function () { return setIsPaneAnimationEnabled(true); }, []);
45
45
  var disableAnimation = (0, react_1.useCallback)(function () { return setIsPaneAnimationEnabled(false); }, []);
46
46
  var getContainerSize = function () { return (isHorizontal(orientation) ? containerEl === null || containerEl === void 0 ? void 0 : containerEl.clientHeight : containerEl === null || containerEl === void 0 ? void 0 : containerEl.clientWidth); };
@@ -49,9 +49,10 @@ var ResizablePanes = function (_a) {
49
49
  onChange({
50
50
  percentageSize: "".concat((size / containerSize) * 100, "%"),
51
51
  isMaxSize: maxSize > 0 ? size === maxSize : size === containerSize + maxSize,
52
- isMinSize: size === minSize
52
+ isMinSize: size === minSize,
53
+ size: size
53
54
  });
54
- }, HANDLE_CHANGE_DEBOUNCE_INTERVAL), [onChange, orientation, maxSize, containerEl]);
55
+ }, debounceInterval), [onChange, orientation, maxSize, containerEl]);
55
56
  var paneAnimationStyle = (0, react_1.useMemo)(function () { return ({
56
57
  transition: theme.transitions.create(isHorizontal(orientation) ? 'height' : 'width', {
57
58
  easing: theme.transitions.easing.sharp,
@@ -62,18 +63,7 @@ var ResizablePanes = function (_a) {
62
63
  size = (getContainerSize() || 0) + size;
63
64
  }
64
65
  return (react_1.default.createElement("div", { ref: setContainerEl, className: (0, classnames_1.default)(styles.container, className) },
65
- react_1.default.createElement(react_split_pane_1.default, { split: orientation, size: size, allowResize: allowResize, onChange: handleChange, defaultSize: defaultSize, minSize: minSize, maxSize: maxSize, onDragStarted: disableAnimation, onDragFinished: enableAnimation, pane1Style: isPaneAnimationEnabled ? paneAnimationStyle : undefined }, children)));
66
- };
67
- var SizePropType = prop_types_1.default.oneOfType([prop_types_1.default.number, prop_types_1.default.string]);
68
- ResizablePanes.propTypes = {
69
- className: prop_types_1.default.string,
70
- children: prop_types_1.default.arrayOf(prop_types_1.default.node).isRequired,
71
- orientation: prop_types_1.default.oneOf(['horizontal', 'vertical']).isRequired,
72
- defaultSize: SizePropType,
73
- size: SizePropType,
74
- minSize: SizePropType,
75
- maxSize: SizePropType,
76
- allowResize: prop_types_1.default.bool,
77
- onChange: prop_types_1.default.func
66
+ react_1.default.createElement(react_split_pane_1.default, { split: orientation, size: size, primary: primary, allowResize: allowResize, onChange: handleChange, defaultSize: defaultSize, minSize: minSize, maxSize: maxSize, onDragStarted: disableAnimation, onDragFinished: enableAnimation, pane1Style: isPaneAnimationEnabled ? paneAnimationStyle : undefined }, children)));
78
67
  };
79
- exports.default = ResizablePanes;
68
+ exports.ResizablePanes = ResizablePanes;
69
+ exports.ResizablePanes.displayName = 'ResizablePanes';
@@ -1 +1,2 @@
1
- export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"container">;
1
+ declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"container">;
2
+ export { useStyles };
@@ -1,12 +1,12 @@
1
1
  import { ElementType } from 'react';
2
2
  import { IconButtonProps } from '@material-ui/core/IconButton';
3
3
  declare type Props = {
4
- buttonsProps: {
4
+ disabled: boolean;
5
+ buttonsProps: Array<{
5
6
  icon: ElementType;
6
7
  tooltipTitle: string;
7
8
  id: number;
8
- disabled?: boolean;
9
- }[];
9
+ }>;
10
10
  classes?: {
11
11
  active?: string;
12
12
  buttonWrapper?: string;
@@ -15,5 +15,5 @@ declare type Props = {
15
15
  className?: string;
16
16
  onButtonClick: (id: number) => void;
17
17
  };
18
- export declare const SideButtonsPanel: ({ buttonsProps, activeIndexId, className, onButtonClick, classes }: Props) => JSX.Element;
18
+ export declare const SideButtonsPanel: ({ disabled, buttonsProps, activeIndexId, className, onButtonClick, classes }: Props) => JSX.Element;
19
19
  export {};
@@ -31,13 +31,13 @@ var classnames_1 = __importDefault(require("classnames"));
31
31
  var SmallIconButton_1 = require("../SmallIconButton");
32
32
  var styles_1 = require("./styles");
33
33
  var SideButtonsPanel = function (_a) {
34
- var buttonsProps = _a.buttonsProps, activeIndexId = _a.activeIndexId, className = _a.className, onButtonClick = _a.onButtonClick, _b = _a.classes, classes = _b === void 0 ? {} : _b;
34
+ var disabled = _a.disabled, buttonsProps = _a.buttonsProps, activeIndexId = _a.activeIndexId, className = _a.className, onButtonClick = _a.onButtonClick, _b = _a.classes, classes = _b === void 0 ? {} : _b;
35
35
  var styles = (0, styles_1.useStyles)();
36
36
  var active = classes.active, buttonWrapper = classes.buttonWrapper, iconButtonClasses = __rest(classes, ["active", "buttonWrapper"]);
37
37
  return (react_1.default.createElement("div", { className: (0, classnames_1.default)(styles.container, className) }, buttonsProps.map(function (_a) {
38
38
  var _b;
39
39
  var id = _a.id, buttonProps = __rest(_a, ["id"]);
40
- return (react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, __assign({}, buttonProps, { classes: iconButtonClasses, size: "S", key: id, className: (0, classnames_1.default)((_b = {}, _b[(0, classnames_1.default)(styles.active, active)] = activeIndexId === id, _b), styles.buttonWrapper, buttonWrapper), onClick: function () { return onButtonClick(id); }, "data-reltio-id": "reltio-profile-right-side-button-".concat(id) })));
40
+ return (react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, __assign({}, buttonProps, { disabled: disabled, classes: iconButtonClasses, size: "S", key: id, className: (0, classnames_1.default)((_b = {}, _b[(0, classnames_1.default)(styles.active, active)] = activeIndexId === id, _b), styles.buttonWrapper, buttonWrapper), onClick: function () { return onButtonClick(id); }, "data-reltio-id": "reltio-profile-right-side-button-".concat(id) })));
41
41
  })));
42
42
  };
43
43
  exports.SideButtonsPanel = SideButtonsPanel;
@@ -1,6 +1,6 @@
1
1
  import { ReactNode, VFC } from 'react';
2
2
  declare type Props = {
3
- width: number;
3
+ width?: number;
4
4
  open: boolean;
5
5
  children: ReactNode;
6
6
  };
@@ -10,7 +10,7 @@ var SidePanel = function (_a) {
10
10
  var width = _a.width, open = _a.open, children = _a.children;
11
11
  var styles = (0, styles_1.useStyles)();
12
12
  return (react_1.default.createElement("div", { className: styles.contentWrapper, style: {
13
- width: "".concat(open ? width : 0, "px")
13
+ width: width ? "".concat(open ? width : 0, "px") : '100%'
14
14
  } }, open && react_1.default.createElement(react_1.default.Fragment, null, children)));
15
15
  };
16
16
  exports.SidePanel = SidePanel;
@@ -5,10 +5,11 @@ var styles_1 = require("@material-ui/core/styles");
5
5
  exports.useStyles = (0, styles_1.makeStyles)(function (theme) { return ({
6
6
  contentWrapper: {
7
7
  display: 'flex',
8
+ boxSizing: 'border-box',
9
+ flex: 1,
8
10
  flexDirection: 'column',
9
11
  backgroundColor: theme.palette.background.paper,
10
12
  boxShadow: '0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 3px 0 rgba(0,0,0,0.2)',
11
- marginLeft: '3px',
12
13
  transition: theme.transitions.create(['width'], {
13
14
  duration: theme.transitions.duration.enteringScreen
14
15
  })
@@ -1,9 +1,10 @@
1
1
  import { Entity } from '@reltio/mdm-sdk';
2
2
  declare type Props = {
3
- isHistoryTabActive: boolean;
4
3
  entity: Entity;
4
+ perspectiveId: string;
5
+ historyButtonId: number;
5
6
  };
6
- export declare const useHistoryEnabled: ({ isHistoryTabActive, entity }: Props) => {
7
+ export declare const useHistoryEnabled: ({ perspectiveId, entity, historyButtonId }: Props) => {
7
8
  isHistoryEnabled: boolean;
8
9
  isProfilePersisted: boolean;
9
10
  };
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useHistoryEnabled = void 0;
4
4
  var react_1 = require("react");
5
5
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
6
+ var contexts_1 = require("../../../contexts");
6
7
  var useHistoryEnabled = function (_a) {
7
- var isHistoryTabActive = _a.isHistoryTabActive, entity = _a.entity;
8
+ var perspectiveId = _a.perspectiveId, entity = _a.entity, historyButtonId = _a.historyButtonId;
9
+ var perspectiveSettings = (0, contexts_1.usePerspectivesSettings)(perspectiveId).perspectiveSettings;
10
+ var active = (perspectiveSettings || {}).active;
11
+ var isHistoryTabActive = active === historyButtonId;
8
12
  var _b = (0, react_1.useState)(false), wasHistoryTabActive = _b[0], setWasHistoryTabActive = _b[1];
9
13
  var entityUri = entity === null || entity === void 0 ? void 0 : entity.uri;
10
14
  (0, react_1.useEffect)(function () {
@@ -90,7 +90,8 @@ export { default as ReactSortableTree } from './ReactSortableTree';
90
90
  export { default as ReactSortableTreeHandlers } from './ReactSortableTree/utils/default-handlers';
91
91
  export { default as ReactSortableTreeUtils } from './ReactSortableTree/utils/tree-data-utils';
92
92
  export { default as ReltioGridLayout } from './ReltioGridLayout/ReltioGridLayout';
93
- export { default as ResizablePanes } from './ResizablePanes/ResizablePanes';
93
+ export { ResizablePanes } from './ResizablePanes/ResizablePanes';
94
+ export { ProfileResizablePanes } from './ProfileResizablePanes/ProfileResizablePanes';
94
95
  export { default as SearchInput } from './SearchInput/SearchInput';
95
96
  export { default as WhiteSearchInput } from './SearchInput/WhiteSearchInput';
96
97
  export { useKeyboardNavigation } from './SelectionPopup/helpers';
@@ -18,8 +18,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.EmptyState = exports.NoResults = exports.NoData = exports.DropDownSelector = exports.DropDownMenuButton = exports.Drawer = exports.DataTypeValue = exports.ConnectionRelationTypeSelector = exports.ConfigureColumnsPopup = exports.MenuWithPopper = exports.MenuList = exports.LoadMoreButton = exports.DropdownIndicatorWithIconButton = exports.DropdownIndicator = exports.CommentsContainer = exports.ColorBar = exports.CollapseButton = exports.CollaborationItem = exports.ClickAwayProvider = exports.BasicViewHeader = exports.BasicViewContent = exports.BasicView = exports.ScreenProfileBand = exports.ProfileBandNavigation = exports.AvatarWithFallback = exports.AutoSizeList = exports.ReadOnlyAttributesPager = exports.SimpleAttribute = exports.ReferenceAttribute = exports.NestedAttribute = exports.EditableImageAttributesLine = exports.ImageAttributesLine = exports.ReadOnlyAttributesList = exports.ReadOnlyAttributeValuesBlock = exports.EditableAttribute = exports.ReadOnlyAttribute = exports.CardinalityMessage = exports.AttributesPager = exports.SimpleAttributeEditor = exports.RelationTypeSelector = exports.ReferenceAttributeEditor = exports.NestedAttributeEditor = exports.MoreAttributesButton = exports.EntitySelector = exports.EntityCreator = exports.AttributesList = exports.BranchDecorator = exports.DescriptionIcon = exports.AttributesView = exports.AttributeListItem = void 0;
21
- exports.SelectorWithOnlyOptionAutoSelect = exports.SelectionPopupPopper = exports.SelectionPopup = exports.useKeyboardNavigation = exports.WhiteSearchInput = exports.SearchInput = exports.ResizablePanes = exports.ReltioGridLayout = exports.ReactSortableTreeUtils = exports.ReactSortableTreeHandlers = exports.ReactSortableTree = exports.ReactSelectOptionFilters = exports.MultiSelect = exports.QueryBuilderRowsGroup = exports.QueryBuilderRow = exports.ProfileCard = exports.ProfileBand = exports.PotentialMatchReviewCard = exports.PopupWithArrow = exports.Popper = exports.MultipleInput = exports.ModeSwitcherSelect = exports.ModeSwitcher = exports.TransitiveMatchBlock = exports.SimpleMatchRulesBlock = exports.MatchRuleVariant = exports.MatchRulesBlock = exports.LoadingSpinner = exports.Link = exports.LinearLoadIndicator = exports.ImportModes = exports.ImportButton = exports.ImageGalleryDialog = exports.Highlighter = exports.HierarchicalAttributeTooltip = exports.HideOnShrink = exports.FlipCard = exports.FacetViewHeader = exports.ExpandedValueTooltip = exports.ErrorWrapper = exports.ErrorPopup = exports.ErrorBoundary = exports.EntityUriLink = exports.RelationTypesSelector = exports.EntityTypesSelector = exports.EntityTypeIcon = exports.EntityTypeBadge = exports.EntityAvatar = exports.EMPTY_STATE_VARIANTS = exports.EMPTY_STATE_ICONS = void 0;
22
- exports.RequiredMark = exports.HierarchyNodeTitle = exports.DataTenantBadge = exports.SettingsMenu = exports.TenantsDropDownSelector = exports.TenantIcon = exports.SourceSystemsSelector = exports.MatchRulesSelector = exports.MultiValueSelector = exports.DragAndDrop = exports.ConnectionEditor = exports.AttributesFiltersBuilder = exports.AttributesFiltersButton = exports.AttributeGroupIcon = exports.BasicAttributeSelector = exports.ProfilesList = exports.ActionButtonMode = exports.ActionButton = exports.NotMatchButton = exports.MergeButton = exports.ProfileMatchCard = exports.RelationEditor = exports.OvIcon = exports.ErrorMessage = exports.ReltioMap = exports.ConfirmDeleteDialog = exports.ConfirmationDialog = exports.Marginator = exports.LightArrowTooltip = exports.ArrowExpandButton = exports.ScrollableTabs = exports.ExpandableSearchInput = exports.VirtualGroupedList = exports.ViewMoreToggle = exports.VerticalHeadingsTable = exports.VerticalDivider = exports.AttributeTitle = exports.Spacer = exports.SourceIcon = exports.SmallIconButtonWithTooltip = exports.SmallIconButton = exports.SimpleDropDownSelector = exports.SidePanelContentHeader = exports.SidePanel = exports.SidePanelEmptyState = exports.SideButtonsPanel = void 0;
21
+ exports.SelectionPopupPopper = exports.SelectionPopup = exports.useKeyboardNavigation = exports.WhiteSearchInput = exports.SearchInput = exports.ProfileResizablePanes = exports.ResizablePanes = exports.ReltioGridLayout = exports.ReactSortableTreeUtils = exports.ReactSortableTreeHandlers = exports.ReactSortableTree = exports.ReactSelectOptionFilters = exports.MultiSelect = exports.QueryBuilderRowsGroup = exports.QueryBuilderRow = exports.ProfileCard = exports.ProfileBand = exports.PotentialMatchReviewCard = exports.PopupWithArrow = exports.Popper = exports.MultipleInput = exports.ModeSwitcherSelect = exports.ModeSwitcher = exports.TransitiveMatchBlock = exports.SimpleMatchRulesBlock = exports.MatchRuleVariant = exports.MatchRulesBlock = exports.LoadingSpinner = exports.Link = exports.LinearLoadIndicator = exports.ImportModes = exports.ImportButton = exports.ImageGalleryDialog = exports.Highlighter = exports.HierarchicalAttributeTooltip = exports.HideOnShrink = exports.FlipCard = exports.FacetViewHeader = exports.ExpandedValueTooltip = exports.ErrorWrapper = exports.ErrorPopup = exports.ErrorBoundary = exports.EntityUriLink = exports.RelationTypesSelector = exports.EntityTypesSelector = exports.EntityTypeIcon = exports.EntityTypeBadge = exports.EntityAvatar = exports.EMPTY_STATE_VARIANTS = exports.EMPTY_STATE_ICONS = void 0;
22
+ exports.RequiredMark = exports.HierarchyNodeTitle = exports.DataTenantBadge = exports.SettingsMenu = exports.TenantsDropDownSelector = exports.TenantIcon = exports.SourceSystemsSelector = exports.MatchRulesSelector = exports.MultiValueSelector = exports.DragAndDrop = exports.ConnectionEditor = exports.AttributesFiltersBuilder = exports.AttributesFiltersButton = exports.AttributeGroupIcon = exports.BasicAttributeSelector = exports.ProfilesList = exports.ActionButtonMode = exports.ActionButton = exports.NotMatchButton = exports.MergeButton = exports.ProfileMatchCard = exports.RelationEditor = exports.OvIcon = exports.ErrorMessage = exports.ReltioMap = exports.ConfirmDeleteDialog = exports.ConfirmationDialog = exports.Marginator = exports.LightArrowTooltip = exports.ArrowExpandButton = exports.ScrollableTabs = exports.ExpandableSearchInput = exports.VirtualGroupedList = exports.ViewMoreToggle = exports.VerticalHeadingsTable = exports.VerticalDivider = exports.AttributeTitle = exports.Spacer = exports.SourceIcon = exports.SmallIconButtonWithTooltip = exports.SmallIconButton = exports.SimpleDropDownSelector = exports.SidePanelContentHeader = exports.SidePanel = exports.SidePanelEmptyState = exports.SideButtonsPanel = exports.SelectorWithOnlyOptionAutoSelect = void 0;
23
23
  __exportStar(require("./activityLog"), exports);
24
24
  var AttributeListItem_1 = require("./AttributeListItem/AttributeListItem");
25
25
  Object.defineProperty(exports, "AttributeListItem", { enumerable: true, get: function () { return __importDefault(AttributeListItem_1).default; } });
@@ -206,7 +206,9 @@ Object.defineProperty(exports, "ReactSortableTreeUtils", { enumerable: true, get
206
206
  var ReltioGridLayout_1 = require("./ReltioGridLayout/ReltioGridLayout");
207
207
  Object.defineProperty(exports, "ReltioGridLayout", { enumerable: true, get: function () { return __importDefault(ReltioGridLayout_1).default; } });
208
208
  var ResizablePanes_1 = require("./ResizablePanes/ResizablePanes");
209
- Object.defineProperty(exports, "ResizablePanes", { enumerable: true, get: function () { return __importDefault(ResizablePanes_1).default; } });
209
+ Object.defineProperty(exports, "ResizablePanes", { enumerable: true, get: function () { return ResizablePanes_1.ResizablePanes; } });
210
+ var ProfileResizablePanes_1 = require("./ProfileResizablePanes/ProfileResizablePanes");
211
+ Object.defineProperty(exports, "ProfileResizablePanes", { enumerable: true, get: function () { return ProfileResizablePanes_1.ProfileResizablePanes; } });
210
212
  var SearchInput_1 = require("./SearchInput/SearchInput");
211
213
  Object.defineProperty(exports, "SearchInput", { enumerable: true, get: function () { return __importDefault(SearchInput_1).default; } });
212
214
  var WhiteSearchInput_1 = require("./SearchInput/WhiteSearchInput");
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { PerspectivesSettings, PerspectiveSettingItem } from '../../types';
3
+ declare type PerspectivesSettingsProps = {
4
+ settings: PerspectivesSettings;
5
+ onChange: (perspectiveId: string, newSetting: Partial<PerspectiveSettingItem>) => void;
6
+ };
7
+ export declare const PerspectivesSettingsContext: React.Context<PerspectivesSettingsProps>;
8
+ export declare const usePerspectivesSettings: (perspectiveId: string) => {
9
+ updatePerspectiveSettings: (newSetting: Partial<PerspectiveSettingItem>) => void;
10
+ perspectiveSettings: PerspectiveSettingItem;
11
+ };
12
+ export {};
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.usePerspectivesSettings = exports.PerspectivesSettingsContext = void 0;
27
+ var react_1 = __importStar(require("react"));
28
+ exports.PerspectivesSettingsContext = react_1.default.createContext({
29
+ settings: {},
30
+ onChange: function () { }
31
+ });
32
+ exports.PerspectivesSettingsContext.displayName = 'PerspectivesSettingsContext';
33
+ var usePerspectivesSettings = function (perspectiveId) {
34
+ var _a = (0, react_1.useContext)(exports.PerspectivesSettingsContext) || {}, settings = _a.settings, onChange = _a.onChange;
35
+ var perspectiveSettings = settings === null || settings === void 0 ? void 0 : settings[perspectiveId];
36
+ var updatePerspectiveSettings = (0, react_1.useCallback)(function (newSetting) {
37
+ onChange(perspectiveId, newSetting);
38
+ }, [perspectiveId, onChange]);
39
+ return { updatePerspectiveSettings: updatePerspectiveSettings, perspectiveSettings: perspectiveSettings };
40
+ };
41
+ exports.usePerspectivesSettings = usePerspectivesSettings;
@@ -6,6 +6,7 @@ export { BlockImageGalleryDialogContext } from './BlockImageGalleryDialogContext
6
6
  export { CollaborationContext, CollaborationContextProvider } from './CollaborationContext';
7
7
  export { UsersContext } from './UsersContext';
8
8
  export { PivotingAttributeContext } from './PivotingAttributeContext';
9
+ export { PerspectivesSettingsContext, usePerspectivesSettings } from './PerspectivesSettingsContext';
9
10
  export { ProfilePerspectiveViewContext } from './ProfilePerspectiveViewContext';
10
11
  export { IdContext } from './IdContext';
11
12
  export { EntitiesMapContext } from './EntitiesMapContext';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useActionsHook = exports.ActionsHookProvider = exports.PageRequestsAbortingContext = exports.DependentLookupAutopopulationContext = exports.FeaturesContext = exports.LabelsContext = exports.UrlGeneratorsContext = exports.isHighlightedAttributeType = exports.isHighlightedErrorType = exports.ScrollType = exports.ScrollToElementProvider = exports.ScrollToElementContext = exports.SearchValueContext = exports.InterceptHandlersContext = exports.HighlightedValuesContext = exports.SnackbarContext = exports.SearchFiltersContext = exports.useReloadFacet = exports.ReloadFacetProvider = exports.useReloadAllFacets = exports.SandboxAPIContext = exports.EntityContext = exports.RelatedObjectUrisContext = exports.WorkflowTasksContext = exports.useEntityLoadingIndication = exports.EntityLoadingIndicationProvider = exports.EntityMarkerContext = exports.useAttributeExpanded = exports.ExpandedAttributesProvider = exports.useHighlightedCrosswalks = exports.useCrosswalkHighlight = exports.useCrosswalkFocus = exports.useCrosswalkColor = exports.CrosswalksDisplayProvider = exports.EntitiesMapContext = exports.IdContext = exports.ProfilePerspectiveViewContext = exports.PivotingAttributeContext = exports.UsersContext = exports.CollaborationContextProvider = exports.CollaborationContext = exports.BlockImageGalleryDialogContext = exports.ViewIdContext = exports.PopupBoundariesContext = exports.HistoryDiffContext = exports.AsyncMountContext = void 0;
3
+ exports.useActionsHook = exports.ActionsHookProvider = exports.PageRequestsAbortingContext = exports.DependentLookupAutopopulationContext = exports.FeaturesContext = exports.LabelsContext = exports.UrlGeneratorsContext = exports.isHighlightedAttributeType = exports.isHighlightedErrorType = exports.ScrollType = exports.ScrollToElementProvider = exports.ScrollToElementContext = exports.SearchValueContext = exports.InterceptHandlersContext = exports.HighlightedValuesContext = exports.SnackbarContext = exports.SearchFiltersContext = exports.useReloadFacet = exports.ReloadFacetProvider = exports.useReloadAllFacets = exports.SandboxAPIContext = exports.EntityContext = exports.RelatedObjectUrisContext = exports.WorkflowTasksContext = exports.useEntityLoadingIndication = exports.EntityLoadingIndicationProvider = exports.EntityMarkerContext = exports.useAttributeExpanded = exports.ExpandedAttributesProvider = exports.useHighlightedCrosswalks = exports.useCrosswalkHighlight = exports.useCrosswalkFocus = exports.useCrosswalkColor = exports.CrosswalksDisplayProvider = exports.EntitiesMapContext = exports.IdContext = exports.ProfilePerspectiveViewContext = exports.usePerspectivesSettings = exports.PerspectivesSettingsContext = exports.PivotingAttributeContext = exports.UsersContext = exports.CollaborationContextProvider = exports.CollaborationContext = exports.BlockImageGalleryDialogContext = exports.ViewIdContext = exports.PopupBoundariesContext = exports.HistoryDiffContext = exports.AsyncMountContext = void 0;
4
4
  var AsyncMountContext_1 = require("./AsyncMountContext");
5
5
  Object.defineProperty(exports, "AsyncMountContext", { enumerable: true, get: function () { return AsyncMountContext_1.AsyncMountContext; } });
6
6
  var HistoryAppearanceContext_1 = require("./HistoryAppearanceContext");
@@ -18,6 +18,9 @@ var UsersContext_1 = require("./UsersContext");
18
18
  Object.defineProperty(exports, "UsersContext", { enumerable: true, get: function () { return UsersContext_1.UsersContext; } });
19
19
  var PivotingAttributeContext_1 = require("./PivotingAttributeContext");
20
20
  Object.defineProperty(exports, "PivotingAttributeContext", { enumerable: true, get: function () { return PivotingAttributeContext_1.PivotingAttributeContext; } });
21
+ var PerspectivesSettingsContext_1 = require("./PerspectivesSettingsContext");
22
+ Object.defineProperty(exports, "PerspectivesSettingsContext", { enumerable: true, get: function () { return PerspectivesSettingsContext_1.PerspectivesSettingsContext; } });
23
+ Object.defineProperty(exports, "usePerspectivesSettings", { enumerable: true, get: function () { return PerspectivesSettingsContext_1.usePerspectivesSettings; } });
21
24
  var ProfilePerspectiveViewContext_1 = require("./ProfilePerspectiveViewContext");
22
25
  Object.defineProperty(exports, "ProfilePerspectiveViewContext", { enumerable: true, get: function () { return ProfilePerspectiveViewContext_1.ProfilePerspectiveViewContext; } });
23
26
  var IdContext_1 = require("./IdContext");
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { AttributeType, SearchFilter } from '@reltio/mdm-sdk';
2
3
  export declare type ReactGridLayoutItem = {
3
4
  i: string;
@@ -104,3 +105,26 @@ export declare type DropDownMenuItem = {
104
105
  selectable?: boolean;
105
106
  selected?: boolean;
106
107
  };
108
+ export declare type PerspectivesSettings = Record<string, PerspectiveSettingItem>;
109
+ export declare type PerspectiveSettingItem = {
110
+ active?: number;
111
+ width?: number;
112
+ };
113
+ export declare type RightPanelTab = {
114
+ content?: React.ReactElement;
115
+ title?: React.ReactElement;
116
+ buttonProps?: {
117
+ id: number;
118
+ icon: React.FC;
119
+ tooltipTitle: string;
120
+ showForDisabled?: boolean;
121
+ };
122
+ headerProps?: {
123
+ content: React.ReactElement;
124
+ } | {
125
+ mainTitle: string;
126
+ secondTitle?: string;
127
+ rightContent?: React.ReactElement;
128
+ };
129
+ hidden?: boolean;
130
+ };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { RightPanelTab } from '../../types';
3
+ declare type Props = {
4
+ perspectiveId: string;
5
+ children: [React.ReactElement, React.ReactElement];
6
+ buttonsProps: Array<RightPanelTab['buttonProps']>;
7
+ disabled?: boolean;
8
+ defaultTab?: number;
9
+ };
10
+ export declare const ProfileResizablePanes: {
11
+ ({ perspectiveId, children, buttonsProps, disabled, defaultTab }: Props): JSX.Element;
12
+ displayName: string;
13
+ };
14
+ export {};
@@ -0,0 +1,37 @@
1
+ import React, { useCallback, cloneElement } from 'react';
2
+ import { ResizablePanes } from '../ResizablePanes/ResizablePanes';
3
+ import { SideButtonsPanel } from '../SideIconPanel/SideButtonsPanel';
4
+ import { usePerspectivesSettings } from '../../contexts';
5
+ import { isNil } from 'ramda';
6
+ import { useStyles } from './styles';
7
+ var DEFAULT_R_PANE_SIZE = 480;
8
+ var MIN_R_PANE_SIZE = 320;
9
+ var MAX_R_PANE_SIZE = 640;
10
+ export var ProfileResizablePanes = function (_a) {
11
+ var perspectiveId = _a.perspectiveId, children = _a.children, buttonsProps = _a.buttonsProps, disabled = _a.disabled, defaultTab = _a.defaultTab;
12
+ var styles = useStyles();
13
+ var _b = usePerspectivesSettings(perspectiveId), perspectiveSettings = _b.perspectiveSettings, updatePerspectiveSettings = _b.updatePerspectiveSettings;
14
+ var _c = (perspectiveSettings || {}).width, width = _c === void 0 ? DEFAULT_R_PANE_SIZE : _c;
15
+ var active = defaultTab || (perspectiveSettings === null || perspectiveSettings === void 0 ? void 0 : perspectiveSettings.active);
16
+ var isSidePanelOpen = !isNil(active) && !disabled;
17
+ var handleUpdateSettings = useCallback(function (newSetting) {
18
+ updatePerspectiveSettings(newSetting);
19
+ }, [updatePerspectiveSettings]);
20
+ var toggleActive = useCallback(function (newId) {
21
+ var newActive = active === newId ? null : newId;
22
+ handleUpdateSettings({ active: newActive });
23
+ }, [active, handleUpdateSettings]);
24
+ var resetActive = useCallback(function () {
25
+ handleUpdateSettings({ active: null });
26
+ }, [handleUpdateSettings]);
27
+ var handlePaneSizeChange = useCallback(function (_a) {
28
+ var size = _a.size;
29
+ handleUpdateSettings({ width: size });
30
+ }, [handleUpdateSettings]);
31
+ return (React.createElement(React.Fragment, null,
32
+ React.createElement(ResizablePanes, { className: styles.resizablePanesWrapper, primary: "second", orientation: "vertical", size: isSidePanelOpen ? width : 0, minSize: MIN_R_PANE_SIZE, maxSize: MAX_R_PANE_SIZE, allowResize: isSidePanelOpen, onChange: handlePaneSizeChange, debounceInterval: 2500 },
33
+ React.createElement("div", { className: styles.pane }, children[0]),
34
+ React.createElement("div", { className: styles.pane }, cloneElement(children[1], { active: active, onClose: resetActive }))),
35
+ React.createElement(SideButtonsPanel, { disabled: disabled, buttonsProps: buttonsProps, onButtonClick: toggleActive, activeIndexId: active })));
36
+ };
37
+ ProfileResizablePanes.displayName = 'ProfileResizablePanes';
@@ -0,0 +1,2 @@
1
+ declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"resizablePanesWrapper" | "pane">;
2
+ export { useStyles };
@@ -0,0 +1,19 @@
1
+ import { makeStyles } from '@material-ui/core/styles';
2
+ var useStyles = makeStyles(function () { return ({
3
+ resizablePanesWrapper: {
4
+ flexGrow: 1,
5
+ height: '100%',
6
+ marginRight: '1px'
7
+ },
8
+ pane: {
9
+ position: 'absolute',
10
+ top: 0,
11
+ left: 0,
12
+ right: 0,
13
+ bottom: 0,
14
+ display: 'flex',
15
+ flexDirection: 'column',
16
+ overflow: 'hidden'
17
+ }
18
+ }); });
19
+ export { useStyles };
@@ -1,27 +1,26 @@
1
- export default ResizablePanes;
2
- declare function ResizablePanes({ className, children, orientation, defaultSize, size, minSize, maxSize, allowResize, onChange }: {
3
- className: any;
4
- children: any;
5
- orientation: any;
6
- defaultSize: any;
7
- size: any;
8
- minSize: any;
9
- maxSize: any;
10
- allowResize: any;
11
- onChange: any;
12
- }): JSX.Element;
13
- declare namespace ResizablePanes {
14
- namespace propTypes {
15
- export const className: PropTypes.Requireable<string>;
16
- export const children: PropTypes.Validator<PropTypes.ReactNodeLike[]>;
17
- export const orientation: PropTypes.Validator<string>;
18
- export { SizePropType as defaultSize };
19
- export { SizePropType as size };
20
- export { SizePropType as minSize };
21
- export { SizePropType as maxSize };
22
- export const allowResize: PropTypes.Requireable<boolean>;
23
- export const onChange: PropTypes.Requireable<(...args: any[]) => any>;
24
- }
25
- }
26
- import PropTypes from "prop-types";
27
- declare const SizePropType: PropTypes.Requireable<NonNullable<string | number>>;
1
+ import React from 'react';
2
+ export declare type Size = string | number;
3
+ declare type OnChange = {
4
+ size: number;
5
+ percentageSize: string;
6
+ isMaxSize: boolean;
7
+ isMinSize: boolean;
8
+ };
9
+ declare type Props = {
10
+ className?: string;
11
+ children: React.ReactElement[];
12
+ allowResize?: boolean;
13
+ primary?: 'first' | 'second';
14
+ minSize?: Size;
15
+ maxSize?: Size;
16
+ defaultSize?: Size;
17
+ debounceInterval?: number;
18
+ size?: Size;
19
+ orientation?: 'vertical' | 'horizontal';
20
+ onChange?: ({ size, percentageSize, isMaxSize, isMinSize }: OnChange) => void;
21
+ };
22
+ export declare const ResizablePanes: {
23
+ ({ className, children, orientation, primary, defaultSize, size, minSize, maxSize, allowResize, debounceInterval, onChange }: Props): JSX.Element;
24
+ displayName: string;
25
+ };
26
+ export {};
@@ -1,18 +1,17 @@
1
1
  import React, { useCallback, useMemo, useState } from 'react';
2
2
  import classnames from 'classnames';
3
- import PropTypes from 'prop-types';
4
3
  import SplitPane from 'react-split-pane';
5
4
  import { useTheme } from '@material-ui/core/styles';
6
- import { useStyles } from './styles';
7
5
  import { debounce } from '@reltio/mdm-sdk';
6
+ import { useStyles } from './styles';
8
7
  var HANDLE_CHANGE_DEBOUNCE_INTERVAL = 250;
9
8
  var isHorizontal = function (orientation) { return orientation === 'horizontal'; };
10
- var ResizablePanes = function (_a) {
11
- var className = _a.className, children = _a.children, orientation = _a.orientation, defaultSize = _a.defaultSize, size = _a.size, minSize = _a.minSize, maxSize = _a.maxSize, allowResize = _a.allowResize, onChange = _a.onChange;
9
+ export var ResizablePanes = function (_a) {
10
+ var className = _a.className, children = _a.children, orientation = _a.orientation, primary = _a.primary, defaultSize = _a.defaultSize, size = _a.size, minSize = _a.minSize, maxSize = _a.maxSize, allowResize = _a.allowResize, _b = _a.debounceInterval, debounceInterval = _b === void 0 ? HANDLE_CHANGE_DEBOUNCE_INTERVAL : _b, onChange = _a.onChange;
12
11
  var styles = useStyles();
13
12
  var theme = useTheme();
14
- var _b = useState(), containerEl = _b[0], setContainerEl = _b[1];
15
- var _c = useState(true), isPaneAnimationEnabled = _c[0], setIsPaneAnimationEnabled = _c[1];
13
+ var _c = useState(null), containerEl = _c[0], setContainerEl = _c[1];
14
+ var _d = useState(true), isPaneAnimationEnabled = _d[0], setIsPaneAnimationEnabled = _d[1];
16
15
  var enableAnimation = useCallback(function () { return setIsPaneAnimationEnabled(true); }, []);
17
16
  var disableAnimation = useCallback(function () { return setIsPaneAnimationEnabled(false); }, []);
18
17
  var getContainerSize = function () { return (isHorizontal(orientation) ? containerEl === null || containerEl === void 0 ? void 0 : containerEl.clientHeight : containerEl === null || containerEl === void 0 ? void 0 : containerEl.clientWidth); };
@@ -21,9 +20,10 @@ var ResizablePanes = function (_a) {
21
20
  onChange({
22
21
  percentageSize: "".concat((size / containerSize) * 100, "%"),
23
22
  isMaxSize: maxSize > 0 ? size === maxSize : size === containerSize + maxSize,
24
- isMinSize: size === minSize
23
+ isMinSize: size === minSize,
24
+ size: size
25
25
  });
26
- }, HANDLE_CHANGE_DEBOUNCE_INTERVAL), [onChange, orientation, maxSize, containerEl]);
26
+ }, debounceInterval), [onChange, orientation, maxSize, containerEl]);
27
27
  var paneAnimationStyle = useMemo(function () { return ({
28
28
  transition: theme.transitions.create(isHorizontal(orientation) ? 'height' : 'width', {
29
29
  easing: theme.transitions.easing.sharp,
@@ -34,18 +34,6 @@ var ResizablePanes = function (_a) {
34
34
  size = (getContainerSize() || 0) + size;
35
35
  }
36
36
  return (React.createElement("div", { ref: setContainerEl, className: classnames(styles.container, className) },
37
- React.createElement(SplitPane, { split: orientation, size: size, allowResize: allowResize, onChange: handleChange, defaultSize: defaultSize, minSize: minSize, maxSize: maxSize, onDragStarted: disableAnimation, onDragFinished: enableAnimation, pane1Style: isPaneAnimationEnabled ? paneAnimationStyle : undefined }, children)));
38
- };
39
- var SizePropType = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
40
- ResizablePanes.propTypes = {
41
- className: PropTypes.string,
42
- children: PropTypes.arrayOf(PropTypes.node).isRequired,
43
- orientation: PropTypes.oneOf(['horizontal', 'vertical']).isRequired,
44
- defaultSize: SizePropType,
45
- size: SizePropType,
46
- minSize: SizePropType,
47
- maxSize: SizePropType,
48
- allowResize: PropTypes.bool,
49
- onChange: PropTypes.func
37
+ React.createElement(SplitPane, { split: orientation, size: size, primary: primary, allowResize: allowResize, onChange: handleChange, defaultSize: defaultSize, minSize: minSize, maxSize: maxSize, onDragStarted: disableAnimation, onDragFinished: enableAnimation, pane1Style: isPaneAnimationEnabled ? paneAnimationStyle : undefined }, children)));
50
38
  };
51
- export default ResizablePanes;
39
+ ResizablePanes.displayName = 'ResizablePanes';
@@ -1 +1,2 @@
1
- export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"container">;
1
+ declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"container">;
2
+ export { useStyles };
@@ -1,12 +1,12 @@
1
1
  import { ElementType } from 'react';
2
2
  import { IconButtonProps } from '@material-ui/core/IconButton';
3
3
  declare type Props = {
4
- buttonsProps: {
4
+ disabled: boolean;
5
+ buttonsProps: Array<{
5
6
  icon: ElementType;
6
7
  tooltipTitle: string;
7
8
  id: number;
8
- disabled?: boolean;
9
- }[];
9
+ }>;
10
10
  classes?: {
11
11
  active?: string;
12
12
  buttonWrapper?: string;
@@ -15,5 +15,5 @@ declare type Props = {
15
15
  className?: string;
16
16
  onButtonClick: (id: number) => void;
17
17
  };
18
- export declare const SideButtonsPanel: ({ buttonsProps, activeIndexId, className, onButtonClick, classes }: Props) => JSX.Element;
18
+ export declare const SideButtonsPanel: ({ disabled, buttonsProps, activeIndexId, className, onButtonClick, classes }: Props) => JSX.Element;
19
19
  export {};
@@ -25,12 +25,12 @@ import classnames from 'classnames';
25
25
  import { SmallIconButtonWithTooltip } from '../SmallIconButton';
26
26
  import { useStyles } from './styles';
27
27
  export var SideButtonsPanel = function (_a) {
28
- var buttonsProps = _a.buttonsProps, activeIndexId = _a.activeIndexId, className = _a.className, onButtonClick = _a.onButtonClick, _b = _a.classes, classes = _b === void 0 ? {} : _b;
28
+ var disabled = _a.disabled, buttonsProps = _a.buttonsProps, activeIndexId = _a.activeIndexId, className = _a.className, onButtonClick = _a.onButtonClick, _b = _a.classes, classes = _b === void 0 ? {} : _b;
29
29
  var styles = useStyles();
30
30
  var active = classes.active, buttonWrapper = classes.buttonWrapper, iconButtonClasses = __rest(classes, ["active", "buttonWrapper"]);
31
31
  return (React.createElement("div", { className: classnames(styles.container, className) }, buttonsProps.map(function (_a) {
32
32
  var _b;
33
33
  var id = _a.id, buttonProps = __rest(_a, ["id"]);
34
- return (React.createElement(SmallIconButtonWithTooltip, __assign({}, buttonProps, { classes: iconButtonClasses, size: "S", key: id, className: classnames((_b = {}, _b[classnames(styles.active, active)] = activeIndexId === id, _b), styles.buttonWrapper, buttonWrapper), onClick: function () { return onButtonClick(id); }, "data-reltio-id": "reltio-profile-right-side-button-".concat(id) })));
34
+ return (React.createElement(SmallIconButtonWithTooltip, __assign({}, buttonProps, { disabled: disabled, classes: iconButtonClasses, size: "S", key: id, className: classnames((_b = {}, _b[classnames(styles.active, active)] = activeIndexId === id, _b), styles.buttonWrapper, buttonWrapper), onClick: function () { return onButtonClick(id); }, "data-reltio-id": "reltio-profile-right-side-button-".concat(id) })));
35
35
  })));
36
36
  };
@@ -1,6 +1,6 @@
1
1
  import { ReactNode, VFC } from 'react';
2
2
  declare type Props = {
3
- width: number;
3
+ width?: number;
4
4
  open: boolean;
5
5
  children: ReactNode;
6
6
  };
@@ -4,6 +4,6 @@ export var SidePanel = function (_a) {
4
4
  var width = _a.width, open = _a.open, children = _a.children;
5
5
  var styles = useStyles();
6
6
  return (React.createElement("div", { className: styles.contentWrapper, style: {
7
- width: "".concat(open ? width : 0, "px")
7
+ width: width ? "".concat(open ? width : 0, "px") : '100%'
8
8
  } }, open && React.createElement(React.Fragment, null, children)));
9
9
  };
@@ -2,10 +2,11 @@ import { makeStyles } from '@material-ui/core/styles';
2
2
  export var useStyles = makeStyles(function (theme) { return ({
3
3
  contentWrapper: {
4
4
  display: 'flex',
5
+ boxSizing: 'border-box',
6
+ flex: 1,
5
7
  flexDirection: 'column',
6
8
  backgroundColor: theme.palette.background.paper,
7
9
  boxShadow: '0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 3px 0 rgba(0,0,0,0.2)',
8
- marginLeft: '3px',
9
10
  transition: theme.transitions.create(['width'], {
10
11
  duration: theme.transitions.duration.enteringScreen
11
12
  })
@@ -1,9 +1,10 @@
1
1
  import { Entity } from '@reltio/mdm-sdk';
2
2
  declare type Props = {
3
- isHistoryTabActive: boolean;
4
3
  entity: Entity;
4
+ perspectiveId: string;
5
+ historyButtonId: number;
5
6
  };
6
- export declare const useHistoryEnabled: ({ isHistoryTabActive, entity }: Props) => {
7
+ export declare const useHistoryEnabled: ({ perspectiveId, entity, historyButtonId }: Props) => {
7
8
  isHistoryEnabled: boolean;
8
9
  isProfilePersisted: boolean;
9
10
  };
@@ -1,7 +1,11 @@
1
1
  import { useEffect, useState } from 'react';
2
2
  import { isTempUri, isDataTenantEntity } from '@reltio/mdm-sdk';
3
+ import { usePerspectivesSettings } from '../../../contexts';
3
4
  export var useHistoryEnabled = function (_a) {
4
- var isHistoryTabActive = _a.isHistoryTabActive, entity = _a.entity;
5
+ var perspectiveId = _a.perspectiveId, entity = _a.entity, historyButtonId = _a.historyButtonId;
6
+ var perspectiveSettings = usePerspectivesSettings(perspectiveId).perspectiveSettings;
7
+ var active = (perspectiveSettings || {}).active;
8
+ var isHistoryTabActive = active === historyButtonId;
5
9
  var _b = useState(false), wasHistoryTabActive = _b[0], setWasHistoryTabActive = _b[1];
6
10
  var entityUri = entity === null || entity === void 0 ? void 0 : entity.uri;
7
11
  useEffect(function () {
@@ -90,7 +90,8 @@ export { default as ReactSortableTree } from './ReactSortableTree';
90
90
  export { default as ReactSortableTreeHandlers } from './ReactSortableTree/utils/default-handlers';
91
91
  export { default as ReactSortableTreeUtils } from './ReactSortableTree/utils/tree-data-utils';
92
92
  export { default as ReltioGridLayout } from './ReltioGridLayout/ReltioGridLayout';
93
- export { default as ResizablePanes } from './ResizablePanes/ResizablePanes';
93
+ export { ResizablePanes } from './ResizablePanes/ResizablePanes';
94
+ export { ProfileResizablePanes } from './ProfileResizablePanes/ProfileResizablePanes';
94
95
  export { default as SearchInput } from './SearchInput/SearchInput';
95
96
  export { default as WhiteSearchInput } from './SearchInput/WhiteSearchInput';
96
97
  export { useKeyboardNavigation } from './SelectionPopup/helpers';
@@ -90,7 +90,8 @@ export { default as ReactSortableTree } from './ReactSortableTree';
90
90
  export { default as ReactSortableTreeHandlers } from './ReactSortableTree/utils/default-handlers';
91
91
  export { default as ReactSortableTreeUtils } from './ReactSortableTree/utils/tree-data-utils';
92
92
  export { default as ReltioGridLayout } from './ReltioGridLayout/ReltioGridLayout';
93
- export { default as ResizablePanes } from './ResizablePanes/ResizablePanes';
93
+ export { ResizablePanes } from './ResizablePanes/ResizablePanes';
94
+ export { ProfileResizablePanes } from './ProfileResizablePanes/ProfileResizablePanes';
94
95
  export { default as SearchInput } from './SearchInput/SearchInput';
95
96
  export { default as WhiteSearchInput } from './SearchInput/WhiteSearchInput';
96
97
  export { useKeyboardNavigation } from './SelectionPopup/helpers';
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { PerspectivesSettings, PerspectiveSettingItem } from '../../types';
3
+ declare type PerspectivesSettingsProps = {
4
+ settings: PerspectivesSettings;
5
+ onChange: (perspectiveId: string, newSetting: Partial<PerspectiveSettingItem>) => void;
6
+ };
7
+ export declare const PerspectivesSettingsContext: React.Context<PerspectivesSettingsProps>;
8
+ export declare const usePerspectivesSettings: (perspectiveId: string) => {
9
+ updatePerspectiveSettings: (newSetting: Partial<PerspectiveSettingItem>) => void;
10
+ perspectiveSettings: PerspectiveSettingItem;
11
+ };
12
+ export {};
@@ -0,0 +1,14 @@
1
+ import React, { useCallback, useContext } from 'react';
2
+ export var PerspectivesSettingsContext = React.createContext({
3
+ settings: {},
4
+ onChange: function () { }
5
+ });
6
+ PerspectivesSettingsContext.displayName = 'PerspectivesSettingsContext';
7
+ export var usePerspectivesSettings = function (perspectiveId) {
8
+ var _a = useContext(PerspectivesSettingsContext) || {}, settings = _a.settings, onChange = _a.onChange;
9
+ var perspectiveSettings = settings === null || settings === void 0 ? void 0 : settings[perspectiveId];
10
+ var updatePerspectiveSettings = useCallback(function (newSetting) {
11
+ onChange(perspectiveId, newSetting);
12
+ }, [perspectiveId, onChange]);
13
+ return { updatePerspectiveSettings: updatePerspectiveSettings, perspectiveSettings: perspectiveSettings };
14
+ };
@@ -6,6 +6,7 @@ export { BlockImageGalleryDialogContext } from './BlockImageGalleryDialogContext
6
6
  export { CollaborationContext, CollaborationContextProvider } from './CollaborationContext';
7
7
  export { UsersContext } from './UsersContext';
8
8
  export { PivotingAttributeContext } from './PivotingAttributeContext';
9
+ export { PerspectivesSettingsContext, usePerspectivesSettings } from './PerspectivesSettingsContext';
9
10
  export { ProfilePerspectiveViewContext } from './ProfilePerspectiveViewContext';
10
11
  export { IdContext } from './IdContext';
11
12
  export { EntitiesMapContext } from './EntitiesMapContext';
@@ -6,6 +6,7 @@ export { BlockImageGalleryDialogContext } from './BlockImageGalleryDialogContext
6
6
  export { CollaborationContext, CollaborationContextProvider } from './CollaborationContext';
7
7
  export { UsersContext } from './UsersContext';
8
8
  export { PivotingAttributeContext } from './PivotingAttributeContext';
9
+ export { PerspectivesSettingsContext, usePerspectivesSettings } from './PerspectivesSettingsContext';
9
10
  export { ProfilePerspectiveViewContext } from './ProfilePerspectiveViewContext';
10
11
  export { IdContext } from './IdContext';
11
12
  export { EntitiesMapContext } from './EntitiesMapContext';
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { AttributeType, SearchFilter } from '@reltio/mdm-sdk';
2
3
  export declare type ReactGridLayoutItem = {
3
4
  i: string;
@@ -104,3 +105,26 @@ export declare type DropDownMenuItem = {
104
105
  selectable?: boolean;
105
106
  selected?: boolean;
106
107
  };
108
+ export declare type PerspectivesSettings = Record<string, PerspectiveSettingItem>;
109
+ export declare type PerspectiveSettingItem = {
110
+ active?: number;
111
+ width?: number;
112
+ };
113
+ export declare type RightPanelTab = {
114
+ content?: React.ReactElement;
115
+ title?: React.ReactElement;
116
+ buttonProps?: {
117
+ id: number;
118
+ icon: React.FC;
119
+ tooltipTitle: string;
120
+ showForDisabled?: boolean;
121
+ };
122
+ headerProps?: {
123
+ content: React.ReactElement;
124
+ } | {
125
+ mainTitle: string;
126
+ secondTitle?: string;
127
+ rightContent?: React.ReactElement;
128
+ };
129
+ hidden?: boolean;
130
+ };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1522",
3
+ "version": "1.4.1523",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
7
7
  "dependencies": {
8
8
  "@date-io/moment": "^1.3.5",
9
9
  "@react-google-maps/api": "2.7.0",
10
- "@reltio/mdm-module": "^1.4.1522",
11
- "@reltio/mdm-sdk": "^1.4.1522",
10
+ "@reltio/mdm-module": "^1.4.1523",
11
+ "@reltio/mdm-sdk": "^1.4.1523",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",