@reltio/components 1.4.907 → 1.4.911

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 (79) hide show
  1. package/cjs/components/ActionButton/ActionButton.d.ts +16 -0
  2. package/cjs/components/ActionButton/ActionButton.js +90 -0
  3. package/cjs/components/ActionButton/styles.d.ts +1 -0
  4. package/cjs/components/ActionButton/styles.js +50 -0
  5. package/cjs/components/MergeButton/MergeButton.d.ts +15 -0
  6. package/cjs/components/MergeButton/MergeButton.js +64 -0
  7. package/cjs/components/NotMatchButton/NotMatchButton.d.ts +15 -0
  8. package/cjs/components/NotMatchButton/NotMatchButton.js +64 -0
  9. package/cjs/components/ProfileMatchCard/ProfileMatchCard.d.ts +2 -1
  10. package/cjs/components/ProfileMatchCard/ProfileMatchCard.js +3 -2
  11. package/cjs/components/attributes/AttributesView/AttributesView.d.ts +1 -1
  12. package/cjs/components/attributes/AttributesView/AttributesView.js +2 -2
  13. package/cjs/components/attributes/AttributesView/index.d.ts +1 -1
  14. package/cjs/components/attributes/editMode/AttributesList/AttributesList.js +3 -1
  15. package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.js +4 -1
  16. package/cjs/components/attributes/editMode/AttributesView/AttributesView.d.ts +1 -1
  17. package/cjs/components/attributes/editMode/AttributesView/AttributesView.js +9 -2
  18. package/cjs/components/attributes/editMode/AttributesView/index.d.ts +9 -1
  19. package/cjs/components/attributes/editMode/contexts/PinnedAttributesContext.d.ts +2 -0
  20. package/cjs/components/attributes/editMode/contexts/PinnedAttributesContext.js +8 -0
  21. package/cjs/components/attributes/readMode/AttributesView/index.d.ts +8 -0
  22. package/cjs/components/attributes/types/attributesView.d.ts +4 -0
  23. package/cjs/components/history/HistoryMenuButton/HistoryMenuButton.js +46 -1
  24. package/cjs/components/history/HistoryMenuButton/MenuItemRenderer.d.ts +12 -0
  25. package/cjs/components/history/HistoryMenuButton/MenuItemRenderer.js +44 -0
  26. package/cjs/components/history/HistoryMenuButton/styles.d.ts +1 -1
  27. package/cjs/components/history/HistoryMenuButton/styles.js +13 -0
  28. package/cjs/components/index.d.ts +3 -0
  29. package/cjs/components/index.js +8 -1
  30. package/cjs/contexts/CollaborationContext/index.d.ts +1 -0
  31. package/cjs/contexts/CollaborationContext/index.js +1 -0
  32. package/cjs/hooks/index.d.ts +2 -0
  33. package/cjs/hooks/index.js +5 -1
  34. package/cjs/hooks/useCollaboration.d.ts +11 -10
  35. package/cjs/hooks/useCollaboration.js +24 -15
  36. package/cjs/hooks/useMarkAsNotMatchRequest.d.ts +12 -0
  37. package/cjs/hooks/useMarkAsNotMatchRequest.js +29 -0
  38. package/cjs/hooks/useMergeAllRequest.d.ts +12 -0
  39. package/cjs/hooks/useMergeAllRequest.js +29 -0
  40. package/esm/components/ActionButton/ActionButton.d.ts +16 -0
  41. package/esm/components/ActionButton/ActionButton.js +65 -0
  42. package/esm/components/ActionButton/styles.d.ts +1 -0
  43. package/esm/components/ActionButton/styles.js +47 -0
  44. package/esm/components/MergeButton/MergeButton.d.ts +15 -0
  45. package/esm/components/MergeButton/MergeButton.js +39 -0
  46. package/esm/components/NotMatchButton/NotMatchButton.d.ts +15 -0
  47. package/esm/components/NotMatchButton/NotMatchButton.js +39 -0
  48. package/esm/components/ProfileMatchCard/ProfileMatchCard.d.ts +2 -1
  49. package/esm/components/ProfileMatchCard/ProfileMatchCard.js +3 -2
  50. package/esm/components/attributes/AttributesView/AttributesView.d.ts +1 -1
  51. package/esm/components/attributes/AttributesView/AttributesView.js +2 -2
  52. package/esm/components/attributes/AttributesView/index.d.ts +1 -1
  53. package/esm/components/attributes/editMode/AttributesList/AttributesList.js +4 -2
  54. package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.js +5 -2
  55. package/esm/components/attributes/editMode/AttributesView/AttributesView.d.ts +1 -1
  56. package/esm/components/attributes/editMode/AttributesView/AttributesView.js +10 -3
  57. package/esm/components/attributes/editMode/AttributesView/index.d.ts +9 -1
  58. package/esm/components/attributes/editMode/contexts/PinnedAttributesContext.d.ts +2 -0
  59. package/esm/components/attributes/editMode/contexts/PinnedAttributesContext.js +2 -0
  60. package/esm/components/attributes/readMode/AttributesView/index.d.ts +8 -0
  61. package/esm/components/attributes/types/attributesView.d.ts +4 -0
  62. package/esm/components/history/HistoryMenuButton/HistoryMenuButton.js +27 -1
  63. package/esm/components/history/HistoryMenuButton/MenuItemRenderer.d.ts +12 -0
  64. package/esm/components/history/HistoryMenuButton/MenuItemRenderer.js +20 -0
  65. package/esm/components/history/HistoryMenuButton/styles.d.ts +1 -1
  66. package/esm/components/history/HistoryMenuButton/styles.js +13 -0
  67. package/esm/components/index.d.ts +3 -0
  68. package/esm/components/index.js +3 -0
  69. package/esm/contexts/CollaborationContext/index.d.ts +1 -0
  70. package/esm/contexts/CollaborationContext/index.js +1 -0
  71. package/esm/hooks/index.d.ts +2 -0
  72. package/esm/hooks/index.js +2 -0
  73. package/esm/hooks/useCollaboration.d.ts +11 -10
  74. package/esm/hooks/useCollaboration.js +25 -16
  75. package/esm/hooks/useMarkAsNotMatchRequest.d.ts +12 -0
  76. package/esm/hooks/useMarkAsNotMatchRequest.js +22 -0
  77. package/esm/hooks/useMergeAllRequest.d.ts +12 -0
  78. package/esm/hooks/useMergeAllRequest.js +22 -0
  79. package/package.json +3 -3
@@ -3,5 +3,5 @@ import { AttributesViewOwnProps } from '../types';
3
3
  import AttributesView from './AttributesView';
4
4
  declare type Props = Pick<AttributesViewOwnProps, 'entity' | 'mode'>;
5
5
  export { AttributesView };
6
- declare const _default: import("react-redux").ConnectedComponent<({ mode, attributesCount, ...restProps }: AttributesViewOwnProps) => JSX.Element, import("react-redux").Omit<AttributesViewOwnProps, "entity" | "mode"> & Props>;
6
+ declare const _default: import("react-redux").ConnectedComponent<({ mode, attributesCount, pinnedAttributes, ...restProps }: AttributesViewOwnProps) => JSX.Element, import("react-redux").Omit<AttributesViewOwnProps, "entity" | "mode"> & Props>;
7
7
  export default _default;
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import React, { memo, useCallback, useMemo } from 'react';
12
+ import React, { memo, useCallback, useContext, useMemo } from 'react';
13
13
  import PropTypes from 'prop-types';
14
14
  import i18n from 'ui-i18n';
15
15
  import { getCreatableAttributeTypes, getAttributesListForEditMode, ModeType } from '@reltio/mdm-sdk';
@@ -20,12 +20,14 @@ import MoreAttributesButton from '../MoreAttributesButton';
20
20
  import { ALWAYS_VISIBLE_TYPE_URIS } from '../../../../constants';
21
21
  import { splitPagersData } from '../../helpers/attributesView';
22
22
  import { getMoreAttrTypes } from './helpers';
23
+ import { PinnedAttributesContext } from '../contexts/PinnedAttributesContext';
23
24
  var AttributesList = function (_a) {
24
25
  var attrTypes = _a.attrTypes, entity = _a.entity, parentUri = _a.parentUri, showEmptyEditors = _a.showEmptyEditors, mode = _a.mode, crosswalks = _a.crosswalks, drawLines = _a.drawLines, children = _a.children, className = _a.className, _b = _a.alwaysVisibleTypeUris, alwaysVisibleTypeUris = _b === void 0 ? ALWAYS_VISIBLE_TYPE_URIS : _b, onAddAttributes = _a.onAddAttributes, onChangeAttribute = _a.onChangeAttribute, onDeleteAttribute = _a.onDeleteAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, showNonOv = _a.showNonOv;
25
26
  var _c = entity.attributes, attributes = _c === void 0 ? {} : _c;
26
27
  var creatableAttrTypes = useMemo(function () { return getCreatableAttributeTypes(mode, attrTypes); }, [attrTypes, mode]);
27
28
  var moreAttrTypes = getMoreAttrTypes(creatableAttrTypes, entity);
28
- var pagersData = useMemo(function () { return getAttributesListForEditMode(attrTypes, mode, entity, showEmptyEditors, showNonOv); }, [attrTypes, mode, entity, showEmptyEditors, showNonOv]);
29
+ var pinnedAttributes = useContext(PinnedAttributesContext);
30
+ var pagersData = useMemo(function () { return getAttributesListForEditMode(attrTypes, mode, entity, showEmptyEditors, showNonOv, pinnedAttributes); }, [attrTypes, mode, entity, showEmptyEditors, showNonOv, pinnedAttributes]);
29
31
  var _d = useMemo(function () { return splitPagersData(alwaysVisibleTypeUris, pagersData); }, [pagersData, alwaysVisibleTypeUris]), alwaysVisiblePagersData = _d[0], regularPagersData = _d[1];
30
32
  var onAddMoreAttributes = useCallback(function (attributeTypes) {
31
33
  onAddAttributes(attributeTypes.map(function (attributeType) { return ({ attributeType: attributeType, parentUri: parentUri }); }));
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useRef, useState } from 'react';
1
+ import React, { useCallback, useRef, useState, useContext, useMemo } from 'react';
2
2
  import { createNewAttribute, getAttributeOwnError, isComplexAttribute, isEditableMode as checkIsEditableMode, isEmptyValue } from '@reltio/mdm-sdk';
3
3
  import { add, always, has, ifElse, min, pipe, prop, T } from 'ramda';
4
4
  import BranchDecorator from '../../BranchDecorator/BranchDecorator';
@@ -10,6 +10,7 @@ import Attribute from '../AttributesFactory/Attribute';
10
10
  import Cardinality from './CardinalityMessage';
11
11
  import { useStyles } from './styles';
12
12
  import { filterNewValues } from './utils';
13
+ import { PinnedAttributesContext } from '../contexts/PinnedAttributesContext';
13
14
  var AttributeRenderer = function (_a) {
14
15
  var max = _a.max, values = _a.values, attributeType = _a.attributeType, parentUri = _a.parentUri, mode = _a.mode, drawLines = _a.drawLines, showEmptyEditors = _a.showEmptyEditors, errorMessage = _a.errorMessage, errors = _a.errors, paging = _a.paging, crosswalks = _a.crosswalks, showNonOv = _a.showNonOv, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, onDeactivateError = _a.onDeactivateError, additionalControlsRenderer = _a.additionalControlsRenderer, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
15
16
  var styles = useStyles();
@@ -17,8 +18,10 @@ var AttributeRenderer = function (_a) {
17
18
  var _c = useState(false), hadDeletions = _c[0], setHadDeletions = _c[1];
18
19
  var label = attributeType.label, isRequired = attributeType.required, cardinality = attributeType.cardinality, name = attributeType.name, attributeTypeUri = attributeType.uri;
19
20
  var isEditableMode = checkIsEditableMode(mode);
21
+ var pinnedAttributes = useContext(PinnedAttributesContext);
22
+ var isPinned = useMemo(function () { return pinnedAttributes === null || pinnedAttributes === void 0 ? void 0 : pinnedAttributes.includes(attributeTypeUri); }, [attributeTypeUri, pinnedAttributes]);
20
23
  var isEmptyValues = isEmptyValue(values);
21
- var showEmpty = ((!hadDeletions && showEmptyEditors) || isRequired) && isEmptyValues;
24
+ var showEmpty = ((!hadDeletions && showEmptyEditors) || isRequired || isPinned) && isEmptyValues;
22
25
  var emptyEditorValue = useRef(createNewAttribute({
23
26
  parentUri: parentUri,
24
27
  attributeType: attributeType
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { AttributesViewProps } from '../../types';
3
3
  declare type Props = Omit<AttributesViewProps, 'attributesCount'>;
4
- declare const AttributesView: ({ className, entity, mode, metadata, caption, excludeUris, includeUris }: Props) => JSX.Element;
4
+ declare const AttributesView: ({ className, entity, mode, metadata, caption, excludeUris, includeUris, pinnedAttributes }: Props) => JSX.Element;
5
5
  export default AttributesView;
@@ -14,7 +14,7 @@ import { useDispatch, useSelector } from 'react-redux';
14
14
  import classnames from 'classnames';
15
15
  import { pipe } from 'ramda';
16
16
  import mdmModule, { profile } from '@reltio/mdm-module';
17
- import { isTempUri } from '@reltio/mdm-sdk';
17
+ import { isTempUri, getPinnedAttributesForUser } from '@reltio/mdm-sdk';
18
18
  import Box from '@material-ui/core/Box';
19
19
  import BasicView from '../../../BasicView/BasicView';
20
20
  import FacetViewHeader from '../../../FacetViewHeader/FacetViewHeader';
@@ -22,12 +22,18 @@ import AttributesList from '../AttributesList';
22
22
  import { ViewIdContext } from '../../../../contexts';
23
23
  import { getFilteredAttrTypes } from '../../helpers/attributesView';
24
24
  import { useStyles } from './styles';
25
+ import { PinnedAttributesContext } from '../contexts/PinnedAttributesContext';
25
26
  var AttributesView = function (_a) {
26
27
  var _b;
27
- var className = _a.className, _c = _a.entity, entity = _c === void 0 ? {} : _c, mode = _a.mode, metadata = _a.metadata, _d = _a.caption, caption = _d === void 0 ? '' : _d, _e = _a.excludeUris, excludeUris = _e === void 0 ? [] : _e, _f = _a.includeUris, includeUris = _f === void 0 ? [] : _f;
28
+ var className = _a.className, _c = _a.entity, entity = _c === void 0 ? {} : _c, mode = _a.mode, metadata = _a.metadata, _d = _a.caption, caption = _d === void 0 ? '' : _d, _e = _a.excludeUris, excludeUris = _e === void 0 ? [] : _e, _f = _a.includeUris, includeUris = _f === void 0 ? [] : _f, pinnedAttributes = _a.pinnedAttributes;
28
29
  var styles = useStyles();
29
30
  var dispatch = useDispatch();
30
31
  var viewId = useContext(ViewIdContext);
32
+ var userRoles = useSelector(mdmModule.selectors.getUserRoles);
33
+ var pinnedAttributeUris = useMemo(function () { return getPinnedAttributesForUser(pinnedAttributes, userRoles); }, [
34
+ pinnedAttributes,
35
+ userRoles
36
+ ]);
31
37
  var modifiedEntity = useSelector(function (state) { return mdmModule.selectors.getModifiedEntity(state, entity.uri) || {}; });
32
38
  var filteredAttrTypes = useMemo(function () { return getFilteredAttrTypes(metadata, modifiedEntity.type, includeUris, excludeUris); }, [excludeUris, includeUris, metadata, modifiedEntity.type]);
33
39
  var onAddAttributes = useCallback(function (params) {
@@ -38,6 +44,7 @@ var AttributesView = function (_a) {
38
44
  return (React.createElement(BasicView, { className: className },
39
45
  caption && React.createElement(FacetViewHeader, { className: styles.header, title: caption }),
40
46
  React.createElement(Box, { className: classnames(styles.attributesContainer, (_b = {}, _b[styles.noCaption] = !caption, _b)) },
41
- React.createElement(AttributesList, { entity: modifiedEntity, attrTypes: filteredAttrTypes, parentUri: modifiedEntity.uri, drawLines: false, mode: mode, showEmptyEditors: isTempUri(modifiedEntity.uri), crosswalks: modifiedEntity.crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute }))));
47
+ React.createElement(PinnedAttributesContext.Provider, { value: pinnedAttributeUris },
48
+ React.createElement(AttributesList, { entity: modifiedEntity, attrTypes: filteredAttrTypes, parentUri: modifiedEntity.uri, drawLines: false, mode: mode, showEmptyEditors: isTempUri(modifiedEntity.uri), crosswalks: modifiedEntity.crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute })))));
42
49
  };
43
50
  export default AttributesView;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import AttributesView from './AttributesView';
3
3
  export { AttributesView };
4
- declare const _default: import("react-redux").ConnectedComponent<({ className, entity, mode, metadata, caption, excludeUris, includeUris }: {
4
+ declare const _default: import("react-redux").ConnectedComponent<({ className, entity, mode, metadata, caption, excludeUris, includeUris, pinnedAttributes }: {
5
5
  entity?: import("@reltio/mdm-sdk").Entity | Record<string, never>;
6
6
  metadata: import("@reltio/mdm-sdk").Metadata;
7
7
  mode?: import("@reltio/mdm-sdk").Mode;
@@ -9,6 +9,10 @@ declare const _default: import("react-redux").ConnectedComponent<({ className, e
9
9
  includeUris?: string[];
10
10
  excludeUris?: string[];
11
11
  className?: string;
12
+ pinnedAttributes?: {
13
+ attributes: string[];
14
+ roles?: string[];
15
+ }[];
12
16
  }) => JSX.Element, import("react-redux").Omit<{
13
17
  entity?: import("@reltio/mdm-sdk").Entity | Record<string, never>;
14
18
  metadata: import("@reltio/mdm-sdk").Metadata;
@@ -17,5 +21,9 @@ declare const _default: import("react-redux").ConnectedComponent<({ className, e
17
21
  includeUris?: string[];
18
22
  excludeUris?: string[];
19
23
  className?: string;
24
+ pinnedAttributes?: {
25
+ attributes: string[];
26
+ roles?: string[];
27
+ }[];
20
28
  }, "metadata">>;
21
29
  export default _default;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const PinnedAttributesContext: React.Context<string[]>;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export var PinnedAttributesContext = React.createContext(null);
@@ -9,6 +9,10 @@ declare const _default: import("react-redux").ConnectedComponent<({ className, e
9
9
  excludeUris?: string[];
10
10
  className?: string;
11
11
  attributesCount?: number;
12
+ pinnedAttributes?: {
13
+ attributes: string[];
14
+ roles?: string[];
15
+ }[];
12
16
  }) => JSX.Element, import("react-redux").Omit<{
13
17
  entity?: import("@reltio/mdm-sdk").Entity | Record<string, never>;
14
18
  metadata: import("@reltio/mdm-sdk").Metadata;
@@ -17,5 +21,9 @@ declare const _default: import("react-redux").ConnectedComponent<({ className, e
17
21
  excludeUris?: string[];
18
22
  className?: string;
19
23
  attributesCount?: number;
24
+ pinnedAttributes?: {
25
+ attributes: string[];
26
+ roles?: string[];
27
+ }[];
20
28
  }, "metadata">>;
21
29
  export default _default;
@@ -6,6 +6,10 @@ declare type OwnProps = {
6
6
  entity?: Entity | Record<string, never>;
7
7
  excludeUris?: string[];
8
8
  includeUris?: string[];
9
+ pinnedAttributes?: {
10
+ attributes: string[];
11
+ roles?: string[];
12
+ }[];
9
13
  mode?: Mode;
10
14
  };
11
15
  declare type StateProps = {
@@ -1,9 +1,35 @@
1
1
  import React from 'react';
2
+ import { useDispatch, useSelector } from 'react-redux';
3
+ import i18n from 'ui-i18n';
2
4
  import MoreVertIcon from '@material-ui/icons/MoreVert';
5
+ import mdmModule, { HistoryMode, profile } from '@reltio/mdm-module';
3
6
  import { SmallIconButton } from '../../SmallIconButton';
7
+ import DropDownMenuButton from '../../DropDownMenuButton/DropDownMenuButton';
8
+ import MenuItemRenderer from './MenuItemRenderer';
4
9
  import { useStyles } from './styles';
5
10
  var HistoryMenuButton = function () {
6
11
  var styles = useStyles();
7
- return React.createElement(SmallIconButton, { icon: MoreVertIcon, size: "XS", onClick: function () { }, className: styles.icon });
12
+ var mode = useSelector(mdmModule.selectors.getHistoryMode);
13
+ var dispatch = useDispatch();
14
+ var handleModeChange = function (selectedMode) {
15
+ dispatch(profile.history.actions.setHistoryMode(selectedMode));
16
+ };
17
+ var menuItems = [
18
+ {
19
+ text: i18n.text('Compare to Current view'),
20
+ selected: mode === HistoryMode.Current,
21
+ onClick: function () { return handleModeChange(HistoryMode.Current); }
22
+ },
23
+ {
24
+ text: i18n.text('Compare to Previous view'),
25
+ selected: mode === HistoryMode.Previous,
26
+ onClick: function () { return handleModeChange(HistoryMode.Previous); }
27
+ }
28
+ ];
29
+ return (React.createElement(DropDownMenuButton, { MenuItemRenderer: MenuItemRenderer, buttonComponent: SmallIconButton, buttonProps: {
30
+ icon: MoreVertIcon,
31
+ size: 'L',
32
+ className: styles.icon
33
+ }, menuId: 'history-menu', menuItems: menuItems }));
8
34
  };
9
35
  export default HistoryMenuButton;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ declare type Item = {
3
+ text: string;
4
+ selected: boolean;
5
+ onClick: (e: any) => void;
6
+ };
7
+ declare type Props = {
8
+ item: Item;
9
+ onMenuClose?: () => void;
10
+ };
11
+ declare const MenuItemRenderer: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLLIElement>>;
12
+ export default MenuItemRenderer;
@@ -0,0 +1,20 @@
1
+ import React, { forwardRef } from 'react';
2
+ import MenuItem from '@material-ui/core/MenuItem';
3
+ import Typography from '@material-ui/core/Typography';
4
+ import CheckIcon from '@material-ui/icons/Check';
5
+ import { noop } from '../../../core';
6
+ import { useStyles } from './styles';
7
+ var MenuItemRenderer = forwardRef(function (_a, ref) {
8
+ var item = _a.item, _b = _a.onMenuClose, onMenuClose = _b === void 0 ? noop : _b;
9
+ var styles = useStyles();
10
+ var text = item.text, selected = item.selected, onClick = item.onClick;
11
+ var handleClick = function (e) {
12
+ onMenuClose();
13
+ onClick(e);
14
+ };
15
+ return (React.createElement(MenuItem, { classes: { root: styles.menuItem }, onClick: handleClick, ref: ref },
16
+ selected && React.createElement(CheckIcon, { className: styles.checkIcon }),
17
+ React.createElement(Typography, { classes: { root: styles.menuText } }, text)));
18
+ });
19
+ MenuItemRenderer.displayName = 'MenuItemRenderer';
20
+ export default MenuItemRenderer;
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"icon">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"icon" | "menuItem" | "menuText" | "checkIcon">;
@@ -2,5 +2,18 @@ import { makeStyles } from '@material-ui/core/styles';
2
2
  export var useStyles = makeStyles({
3
3
  icon: {
4
4
  margin: 5
5
+ },
6
+ menuItem: {
7
+ minHeight: '32px'
8
+ },
9
+ menuText: {
10
+ fontSize: '13px',
11
+ lineHeight: '15px',
12
+ letterSpacing: 0,
13
+ marginLeft: '30px'
14
+ },
15
+ checkIcon: {
16
+ position: 'absolute',
17
+ color: 'rgba(0, 0, 0, 0.54)'
5
18
  }
6
19
  });
@@ -122,3 +122,6 @@ export { default as OvIcon } from './attributes/OvIcon';
122
122
  export { default as RelationEditor } from './RelationEditor';
123
123
  export * from './workflow';
124
124
  export { ProfileMatchCard } from './ProfileMatchCard/ProfileMatchCard';
125
+ export { MergeButton } from './MergeButton/MergeButton';
126
+ export { NotMatchButton } from './NotMatchButton/NotMatchButton';
127
+ export { ActionButton, ActionButtonMode } from './ActionButton/ActionButton';
@@ -121,3 +121,6 @@ export { default as OvIcon } from './attributes/OvIcon';
121
121
  export { default as RelationEditor } from './RelationEditor';
122
122
  export * from './workflow';
123
123
  export { ProfileMatchCard } from './ProfileMatchCard/ProfileMatchCard';
124
+ export { MergeButton } from './MergeButton/MergeButton';
125
+ export { NotMatchButton } from './NotMatchButton/NotMatchButton';
126
+ export { ActionButton, ActionButtonMode } from './ActionButton/ActionButton';
@@ -6,6 +6,7 @@ export declare const CollaborationContext: React.Context<{
6
6
  comments: Comment[];
7
7
  currentComment: Comment;
8
8
  getComments: (uri: string, pageToken?: string) => void;
9
+ getCommentsCount: (objectIds: string[]) => void;
9
10
  getComment: (commentId: Comment['commentId']) => void;
10
11
  createComment: (params: Pick<Comment, 'content' | 'namedUsers' | 'objectType' | 'relatedObjectUris'> & {
11
12
  uri: string;
@@ -6,6 +6,7 @@ export var CollaborationContext = React.createContext({
6
6
  currentComment: null,
7
7
  getComment: noop,
8
8
  getComments: function () { return new Promise(noop); },
9
+ getCommentsCount: noop,
9
10
  createComment: function () { return new Promise(noop); },
10
11
  editComment: function () { return new Promise(noop); },
11
12
  createReply: function () { return new Promise(noop); },
@@ -13,3 +13,5 @@ export { useWhyDidYouUpdate } from './useWhyDidYouUpdate';
13
13
  export { useConfigPermissions } from './useConfigPermissions';
14
14
  export { useMatchesLoader } from './useMatchesLoader';
15
15
  export { usePagingSimulator } from './usePagingSimulator';
16
+ export { useMergeAllRequest } from './useMergeAllRequest';
17
+ export { useMarkAsNotMatchRequest } from './useMarkAsNotMatchRequest';
@@ -13,3 +13,5 @@ export { useWhyDidYouUpdate } from './useWhyDidYouUpdate';
13
13
  export { useConfigPermissions } from './useConfigPermissions';
14
14
  export { useMatchesLoader } from './useMatchesLoader';
15
15
  export { usePagingSimulator } from './usePagingSimulator';
16
+ export { useMergeAllRequest } from './useMergeAllRequest';
17
+ export { useMarkAsNotMatchRequest } from './useMarkAsNotMatchRequest';
@@ -1,19 +1,20 @@
1
1
  import { CollaborationObjectTypes, Comment, CommentsMap } from '@reltio/mdm-sdk';
2
2
  export declare const useCollaboration: (objectIds?: string[], objectTypes?: CollaborationObjectTypes[]) => {
3
- commentsMap: CommentsMap;
4
- currentComment: Comment;
3
+ clearCurrentComment: () => void;
5
4
  comments: Comment[];
6
- getComment: (commentId: string) => void;
5
+ commentsMap: CommentsMap;
6
+ createComment: ({ content, namedUsers, objectType, uri, relatedObjectUris }: any) => Promise<void>;
7
7
  createReply: ({ content, namedUsers, commentId, action, uri }: any) => Promise<void>;
8
- editComment: ({ content, namedUsers, objectType, uri, relatedObjectUris, commentId, replies }: any) => Promise<void>;
8
+ currentComment: Comment;
9
9
  deleteComment: ({ uri, commentId }: any) => void;
10
- createComment: ({ content, namedUsers, objectType, uri, relatedObjectUris }: any) => Promise<void>;
11
- clearCurrentComment: () => void;
12
- resolveThread: ({ commentId, uri }: any) => void;
13
- reOpenThread: ({ commentId, uri }: any) => void;
14
- sending: boolean;
10
+ editComment: ({ content, namedUsers, objectType, uri, relatedObjectUris, commentId, replies }: any) => Promise<void>;
11
+ getComment: (commentId: string) => void;
12
+ getComments: (relatedObjectUri: string, pageToken?: string) => void;
13
+ getCommentsCount: (objectIds: string[], shouldResetCommentsMap?: any) => void;
15
14
  loading: boolean;
16
15
  objectTypes: CollaborationObjectTypes[];
17
- getComments: (relatedObjectUri: string, pageToken?: string) => void;
18
16
  pageToken: string;
17
+ reOpenThread: ({ commentId, uri }: any) => void;
18
+ resolveThread: ({ commentId, uri }: any) => void;
19
+ sending: boolean;
19
20
  };
@@ -17,7 +17,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
17
17
  import { useCallback, useEffect, useState } from 'react';
18
18
  import { useSelector } from 'react-redux';
19
19
  import { andThen, fromPairs, map, otherwise, pipe, props, uniqBy, prop, propEq, when, always } from 'ramda';
20
- import { createComment as createCommentRequest, createReply as createReplyRequest, getComment as getCommentRequest, getCommentsCount, updateComment as updateCommentRequest, deleteComment as deleteCommentRequest, getComments as getCommentsRequest, isTempUri } from '@reltio/mdm-sdk';
20
+ import { createComment as createCommentRequest, createReply as createReplyRequest, getComment as getCommentRequest, getCommentsCount as getCommentsCountRequest, updateComment as updateCommentRequest, deleteComment as deleteCommentRequest, getComments as getCommentsRequest, isTempUri } from '@reltio/mdm-sdk';
21
21
  import mdm from '@reltio/mdm-module';
22
22
  var defaultObjectIds = [];
23
23
  var catchErrorInRequest = function (e) { return console.error('Collaboration error', e); };
@@ -33,18 +33,26 @@ export var useCollaboration = function (objectIds, objectTypes) {
33
33
  var _d = useState(null), currentComment = _d[0], setCurrentComment = _d[1];
34
34
  var _e = useState(false), sending = _e[0], setSending = _e[1];
35
35
  var _f = useState(false), loading = _f[0], setLoading = _f[1];
36
- useEffect(function () {
37
- if (isCollaborationEnabled && entity && !isTempUri(entity.uri)) {
36
+ var addCommentsToCommentsMap = useCallback(function (commentsMap) {
37
+ setCommentsMap(function (currentCommentsMap) { return (__assign(__assign({}, currentCommentsMap), commentsMap)); });
38
+ }, []);
39
+ var entityUri = entity === null || entity === void 0 ? void 0 : entity.uri;
40
+ var getCommentsCount = useCallback(function (objectIds, shouldResetCommentsMap) {
41
+ if (shouldResetCommentsMap === void 0) { shouldResetCommentsMap = false; }
42
+ if (isCollaborationEnabled && entityUri && !isTempUri(entityUri)) {
38
43
  var onError = function (e) {
39
44
  console.warn('Collaboration error', e);
40
45
  setCommentsMap(null);
41
46
  };
42
- pipe(getCommentsCount, andThen(map(props(['objectId', 'comments']))), andThen(fromPairs), andThen(setCommentsMap), otherwise(onError))({ uris: objectIds, tenant: tenant, collaborationPath: collaborationPath });
47
+ pipe(getCommentsCountRequest, andThen(map(props(['objectId', 'comments']))), andThen(fromPairs), andThen(shouldResetCommentsMap ? setCommentsMap : addCommentsToCommentsMap), otherwise(onError))({ uris: objectIds, tenant: tenant, collaborationPath: collaborationPath });
43
48
  }
44
49
  else {
45
50
  setCommentsMap(null);
46
51
  }
47
- }, [entity, isCollaborationEnabled, tenant, collaborationPath, objectIds]);
52
+ }, [addCommentsToCommentsMap, collaborationPath, entityUri, isCollaborationEnabled, tenant]);
53
+ useEffect(function () {
54
+ getCommentsCount(objectIds, true);
55
+ }, [objectIds, getCommentsCount]);
48
56
  var getComments = useCallback(function (relatedObjectUri, pageToken) {
49
57
  getCommentsRequest({ collaborationPath: collaborationPath, tenant: tenant, relatedObjectUri: relatedObjectUri, pageToken: pageToken })
50
58
  .then(function (_a) {
@@ -198,21 +206,22 @@ export var useCollaboration = function (objectIds, objectTypes) {
198
206
  setCurrentComment(null);
199
207
  }, []);
200
208
  return {
201
- commentsMap: commentsMap,
202
- currentComment: currentComment,
209
+ clearCurrentComment: clearCurrentComment,
203
210
  comments: comments,
204
- getComment: getComment,
211
+ commentsMap: commentsMap,
212
+ createComment: createComment,
205
213
  createReply: createReply,
206
- editComment: editComment,
214
+ currentComment: currentComment,
207
215
  deleteComment: deleteComment,
208
- createComment: createComment,
209
- clearCurrentComment: clearCurrentComment,
210
- resolveThread: resolveThread,
211
- reOpenThread: reOpenThread,
212
- sending: sending,
216
+ editComment: editComment,
217
+ getComment: getComment,
218
+ getComments: getComments,
219
+ getCommentsCount: getCommentsCount,
213
220
  loading: loading,
214
221
  objectTypes: objectTypes,
215
- getComments: getComments,
216
- pageToken: pageToken
222
+ pageToken: pageToken,
223
+ reOpenThread: reOpenThread,
224
+ resolveThread: resolveThread,
225
+ sending: sending
217
226
  };
218
227
  };
@@ -0,0 +1,12 @@
1
+ import { Entity } from '@reltio/mdm-sdk';
2
+ declare type Props = {
3
+ entities: Entity[];
4
+ entity: Entity;
5
+ onFinishRequest?: () => void;
6
+ onStartRequest?: () => void;
7
+ };
8
+ export declare const useMarkAsNotMatchRequest: ({ entities, entity, onFinishRequest, onStartRequest }: Props) => {
9
+ isPending: boolean;
10
+ sendMarkAsNotMatchRequest: () => void;
11
+ };
12
+ export {};
@@ -0,0 +1,22 @@
1
+ import { isDataTenantEntity, markDataTenantEntityAsNotMatch, markMixedEntitiesAsNotMatches } from '@reltio/mdm-sdk';
2
+ import { useSelector } from 'react-redux';
3
+ import mdmModule from '@reltio/mdm-module';
4
+ import { useCallback, useState } from 'react';
5
+ export var useMarkAsNotMatchRequest = function (_a) {
6
+ var entities = _a.entities, entity = _a.entity, onFinishRequest = _a.onFinishRequest, onStartRequest = _a.onStartRequest;
7
+ var tenant = useSelector(mdmModule.selectors.getTenant);
8
+ var dtssPath = useSelector(mdmModule.selectors.getDtssPath);
9
+ var _b = useState(false), isPending = _b[0], setIsPending = _b[1];
10
+ var sendMarkAsNotMatchRequest = useCallback(function () {
11
+ onStartRequest === null || onStartRequest === void 0 ? void 0 : onStartRequest();
12
+ setIsPending(true);
13
+ var params = { dtssPath: dtssPath, customerTenant: tenant, entity: entity, entities: entities };
14
+ (isDataTenantEntity(entity)
15
+ ? markDataTenantEntityAsNotMatch(params)
16
+ : markMixedEntitiesAsNotMatches(params)).finally(function () {
17
+ onFinishRequest === null || onFinishRequest === void 0 ? void 0 : onFinishRequest();
18
+ setIsPending(false);
19
+ });
20
+ }, [dtssPath, entities, entity, onFinishRequest, onStartRequest, tenant]);
21
+ return { isPending: isPending, sendMarkAsNotMatchRequest: sendMarkAsNotMatchRequest };
22
+ };
@@ -0,0 +1,12 @@
1
+ import { Entity } from '@reltio/mdm-sdk';
2
+ declare type Props = {
3
+ entities: Entity[];
4
+ entity: Entity;
5
+ onFinishRequest?: () => void;
6
+ onStartRequest?: () => void;
7
+ };
8
+ export declare const useMergeAllRequest: ({ entities, entity, onFinishRequest, onStartRequest }: Props) => {
9
+ isPending: boolean;
10
+ sendMergeAllRequest: () => void;
11
+ };
12
+ export {};
@@ -0,0 +1,22 @@
1
+ import { useCallback, useState } from 'react';
2
+ import { useSelector } from 'react-redux';
3
+ import mdmModule from '@reltio/mdm-module';
4
+ import { isDataTenantEntity, mergeCustomerTenantEntityWithMixedEntities, mergeDataTenantEntity } from '@reltio/mdm-sdk';
5
+ export var useMergeAllRequest = function (_a) {
6
+ var entities = _a.entities, entity = _a.entity, onFinishRequest = _a.onFinishRequest, onStartRequest = _a.onStartRequest;
7
+ var tenant = useSelector(mdmModule.selectors.getTenant);
8
+ var dtssPath = useSelector(mdmModule.selectors.getDtssPath);
9
+ var _b = useState(false), isPending = _b[0], setIsPending = _b[1];
10
+ var sendMergeAllRequest = useCallback(function () {
11
+ onStartRequest === null || onStartRequest === void 0 ? void 0 : onStartRequest();
12
+ setIsPending(true);
13
+ var params = { dtssPath: dtssPath, customerTenant: tenant, entity: entity, entities: entities };
14
+ (isDataTenantEntity(entity)
15
+ ? mergeDataTenantEntity(params)
16
+ : mergeCustomerTenantEntityWithMixedEntities(params)).finally(function () {
17
+ onFinishRequest === null || onFinishRequest === void 0 ? void 0 : onFinishRequest();
18
+ setIsPending(false);
19
+ });
20
+ }, [dtssPath, entities, entity, onFinishRequest, onStartRequest, tenant]);
21
+ return { isPending: isPending, sendMergeAllRequest: sendMergeAllRequest };
22
+ };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.907",
3
+ "version": "1.4.911",
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.907",
11
- "@reltio/mdm-sdk": "^1.4.907",
10
+ "@reltio/mdm-module": "^1.4.911",
11
+ "@reltio/mdm-sdk": "^1.4.911",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",