@reltio/components 1.4.908 → 1.4.909

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 (69) 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/index.d.ts +3 -0
  24. package/cjs/components/index.js +8 -1
  25. package/cjs/contexts/CollaborationContext/index.d.ts +1 -0
  26. package/cjs/contexts/CollaborationContext/index.js +1 -0
  27. package/cjs/hooks/index.d.ts +2 -0
  28. package/cjs/hooks/index.js +5 -1
  29. package/cjs/hooks/useCollaboration.d.ts +11 -10
  30. package/cjs/hooks/useCollaboration.js +24 -15
  31. package/cjs/hooks/useMarkAsNotMatchRequest.d.ts +12 -0
  32. package/cjs/hooks/useMarkAsNotMatchRequest.js +29 -0
  33. package/cjs/hooks/useMergeAllRequest.d.ts +12 -0
  34. package/cjs/hooks/useMergeAllRequest.js +29 -0
  35. package/esm/components/ActionButton/ActionButton.d.ts +16 -0
  36. package/esm/components/ActionButton/ActionButton.js +65 -0
  37. package/esm/components/ActionButton/styles.d.ts +1 -0
  38. package/esm/components/ActionButton/styles.js +47 -0
  39. package/esm/components/MergeButton/MergeButton.d.ts +15 -0
  40. package/esm/components/MergeButton/MergeButton.js +39 -0
  41. package/esm/components/NotMatchButton/NotMatchButton.d.ts +15 -0
  42. package/esm/components/NotMatchButton/NotMatchButton.js +39 -0
  43. package/esm/components/ProfileMatchCard/ProfileMatchCard.d.ts +2 -1
  44. package/esm/components/ProfileMatchCard/ProfileMatchCard.js +3 -2
  45. package/esm/components/attributes/AttributesView/AttributesView.d.ts +1 -1
  46. package/esm/components/attributes/AttributesView/AttributesView.js +2 -2
  47. package/esm/components/attributes/AttributesView/index.d.ts +1 -1
  48. package/esm/components/attributes/editMode/AttributesList/AttributesList.js +4 -2
  49. package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.js +5 -2
  50. package/esm/components/attributes/editMode/AttributesView/AttributesView.d.ts +1 -1
  51. package/esm/components/attributes/editMode/AttributesView/AttributesView.js +10 -3
  52. package/esm/components/attributes/editMode/AttributesView/index.d.ts +9 -1
  53. package/esm/components/attributes/editMode/contexts/PinnedAttributesContext.d.ts +2 -0
  54. package/esm/components/attributes/editMode/contexts/PinnedAttributesContext.js +2 -0
  55. package/esm/components/attributes/readMode/AttributesView/index.d.ts +8 -0
  56. package/esm/components/attributes/types/attributesView.d.ts +4 -0
  57. package/esm/components/index.d.ts +3 -0
  58. package/esm/components/index.js +3 -0
  59. package/esm/contexts/CollaborationContext/index.d.ts +1 -0
  60. package/esm/contexts/CollaborationContext/index.js +1 -0
  61. package/esm/hooks/index.d.ts +2 -0
  62. package/esm/hooks/index.js +2 -0
  63. package/esm/hooks/useCollaboration.d.ts +11 -10
  64. package/esm/hooks/useCollaboration.js +25 -16
  65. package/esm/hooks/useMarkAsNotMatchRequest.d.ts +12 -0
  66. package/esm/hooks/useMarkAsNotMatchRequest.js +22 -0
  67. package/esm/hooks/useMergeAllRequest.d.ts +12 -0
  68. package/esm/hooks/useMergeAllRequest.js +22 -0
  69. package/package.json +3 -3
@@ -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
  };
@@ -39,18 +39,26 @@ var useCollaboration = function (objectIds, objectTypes) {
39
39
  var _d = react_1.useState(null), currentComment = _d[0], setCurrentComment = _d[1];
40
40
  var _e = react_1.useState(false), sending = _e[0], setSending = _e[1];
41
41
  var _f = react_1.useState(false), loading = _f[0], setLoading = _f[1];
42
- react_1.useEffect(function () {
43
- if (isCollaborationEnabled && entity && !mdm_sdk_1.isTempUri(entity.uri)) {
42
+ var addCommentsToCommentsMap = react_1.useCallback(function (commentsMap) {
43
+ setCommentsMap(function (currentCommentsMap) { return (__assign(__assign({}, currentCommentsMap), commentsMap)); });
44
+ }, []);
45
+ var entityUri = entity === null || entity === void 0 ? void 0 : entity.uri;
46
+ var getCommentsCount = react_1.useCallback(function (objectIds, shouldResetCommentsMap) {
47
+ if (shouldResetCommentsMap === void 0) { shouldResetCommentsMap = false; }
48
+ if (isCollaborationEnabled && entityUri && !mdm_sdk_1.isTempUri(entityUri)) {
44
49
  var onError = function (e) {
45
50
  console.warn('Collaboration error', e);
46
51
  setCommentsMap(null);
47
52
  };
48
- ramda_1.pipe(mdm_sdk_1.getCommentsCount, ramda_1.andThen(ramda_1.map(ramda_1.props(['objectId', 'comments']))), ramda_1.andThen(ramda_1.fromPairs), ramda_1.andThen(setCommentsMap), ramda_1.otherwise(onError))({ uris: objectIds, tenant: tenant, collaborationPath: collaborationPath });
53
+ ramda_1.pipe(mdm_sdk_1.getCommentsCount, ramda_1.andThen(ramda_1.map(ramda_1.props(['objectId', 'comments']))), ramda_1.andThen(ramda_1.fromPairs), ramda_1.andThen(shouldResetCommentsMap ? setCommentsMap : addCommentsToCommentsMap), ramda_1.otherwise(onError))({ uris: objectIds, tenant: tenant, collaborationPath: collaborationPath });
49
54
  }
50
55
  else {
51
56
  setCommentsMap(null);
52
57
  }
53
- }, [entity, isCollaborationEnabled, tenant, collaborationPath, objectIds]);
58
+ }, [addCommentsToCommentsMap, collaborationPath, entityUri, isCollaborationEnabled, tenant]);
59
+ react_1.useEffect(function () {
60
+ getCommentsCount(objectIds, true);
61
+ }, [objectIds, getCommentsCount]);
54
62
  var getComments = react_1.useCallback(function (relatedObjectUri, pageToken) {
55
63
  mdm_sdk_1.getComments({ collaborationPath: collaborationPath, tenant: tenant, relatedObjectUri: relatedObjectUri, pageToken: pageToken })
56
64
  .then(function (_a) {
@@ -204,22 +212,23 @@ var useCollaboration = function (objectIds, objectTypes) {
204
212
  setCurrentComment(null);
205
213
  }, []);
206
214
  return {
207
- commentsMap: commentsMap,
208
- currentComment: currentComment,
215
+ clearCurrentComment: clearCurrentComment,
209
216
  comments: comments,
210
- getComment: getComment,
217
+ commentsMap: commentsMap,
218
+ createComment: createComment,
211
219
  createReply: createReply,
212
- editComment: editComment,
220
+ currentComment: currentComment,
213
221
  deleteComment: deleteComment,
214
- createComment: createComment,
215
- clearCurrentComment: clearCurrentComment,
216
- resolveThread: resolveThread,
217
- reOpenThread: reOpenThread,
218
- sending: sending,
222
+ editComment: editComment,
223
+ getComment: getComment,
224
+ getComments: getComments,
225
+ getCommentsCount: getCommentsCount,
219
226
  loading: loading,
220
227
  objectTypes: objectTypes,
221
- getComments: getComments,
222
- pageToken: pageToken
228
+ pageToken: pageToken,
229
+ reOpenThread: reOpenThread,
230
+ resolveThread: resolveThread,
231
+ sending: sending
223
232
  };
224
233
  };
225
234
  exports.useCollaboration = useCollaboration;
@@ -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,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useMarkAsNotMatchRequest = void 0;
7
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
8
+ var react_redux_1 = require("react-redux");
9
+ var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
10
+ var react_1 = require("react");
11
+ var useMarkAsNotMatchRequest = function (_a) {
12
+ var entities = _a.entities, entity = _a.entity, onFinishRequest = _a.onFinishRequest, onStartRequest = _a.onStartRequest;
13
+ var tenant = react_redux_1.useSelector(mdm_module_1.default.selectors.getTenant);
14
+ var dtssPath = react_redux_1.useSelector(mdm_module_1.default.selectors.getDtssPath);
15
+ var _b = react_1.useState(false), isPending = _b[0], setIsPending = _b[1];
16
+ var sendMarkAsNotMatchRequest = react_1.useCallback(function () {
17
+ onStartRequest === null || onStartRequest === void 0 ? void 0 : onStartRequest();
18
+ setIsPending(true);
19
+ var params = { dtssPath: dtssPath, customerTenant: tenant, entity: entity, entities: entities };
20
+ (mdm_sdk_1.isDataTenantEntity(entity)
21
+ ? mdm_sdk_1.markDataTenantEntityAsNotMatch(params)
22
+ : mdm_sdk_1.markMixedEntitiesAsNotMatches(params)).finally(function () {
23
+ onFinishRequest === null || onFinishRequest === void 0 ? void 0 : onFinishRequest();
24
+ setIsPending(false);
25
+ });
26
+ }, [dtssPath, entities, entity, onFinishRequest, onStartRequest, tenant]);
27
+ return { isPending: isPending, sendMarkAsNotMatchRequest: sendMarkAsNotMatchRequest };
28
+ };
29
+ exports.useMarkAsNotMatchRequest = useMarkAsNotMatchRequest;
@@ -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,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useMergeAllRequest = void 0;
7
+ var react_1 = require("react");
8
+ var react_redux_1 = require("react-redux");
9
+ var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
10
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
11
+ var useMergeAllRequest = function (_a) {
12
+ var entities = _a.entities, entity = _a.entity, onFinishRequest = _a.onFinishRequest, onStartRequest = _a.onStartRequest;
13
+ var tenant = react_redux_1.useSelector(mdm_module_1.default.selectors.getTenant);
14
+ var dtssPath = react_redux_1.useSelector(mdm_module_1.default.selectors.getDtssPath);
15
+ var _b = react_1.useState(false), isPending = _b[0], setIsPending = _b[1];
16
+ var sendMergeAllRequest = react_1.useCallback(function () {
17
+ onStartRequest === null || onStartRequest === void 0 ? void 0 : onStartRequest();
18
+ setIsPending(true);
19
+ var params = { dtssPath: dtssPath, customerTenant: tenant, entity: entity, entities: entities };
20
+ (mdm_sdk_1.isDataTenantEntity(entity)
21
+ ? mdm_sdk_1.mergeDataTenantEntity(params)
22
+ : mdm_sdk_1.mergeCustomerTenantEntityWithMixedEntities(params)).finally(function () {
23
+ onFinishRequest === null || onFinishRequest === void 0 ? void 0 : onFinishRequest();
24
+ setIsPending(false);
25
+ });
26
+ }, [dtssPath, entities, entity, onFinishRequest, onStartRequest, tenant]);
27
+ return { isPending: isPending, sendMergeAllRequest: sendMergeAllRequest };
28
+ };
29
+ exports.useMergeAllRequest = useMergeAllRequest;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ export declare enum ActionButtonMode {
3
+ iconButton = "iconButton",
4
+ button = "button",
5
+ menuItem = "menuItem"
6
+ }
7
+ export declare type Props = {
8
+ className?: string;
9
+ disabled?: boolean;
10
+ icon: React.ElementType;
11
+ label: string;
12
+ mode: ActionButtonMode;
13
+ onClick: () => void;
14
+ onMenuClose?: () => void;
15
+ };
16
+ export declare const ActionButton: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLLIElement>>;
@@ -0,0 +1,65 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React, { forwardRef } from 'react';
24
+ import classnames from 'classnames';
25
+ import Button from '@material-ui/core/Button';
26
+ import MenuItem from '@material-ui/core/MenuItem';
27
+ import Typography from '@material-ui/core/Typography';
28
+ import { useStyles } from './styles';
29
+ import { noop } from '../../core';
30
+ import ExpandedValueTooltip from '../ExpandedValueTooltip/ExpandedValueTooltip';
31
+ import { SmallIconButtonWithTooltip } from '../SmallIconButton';
32
+ export var ActionButtonMode;
33
+ (function (ActionButtonMode) {
34
+ ActionButtonMode["iconButton"] = "iconButton";
35
+ ActionButtonMode["button"] = "button";
36
+ ActionButtonMode["menuItem"] = "menuItem";
37
+ })(ActionButtonMode || (ActionButtonMode = {}));
38
+ export var ActionButton = forwardRef(function (_a, ref) {
39
+ var className = _a.className, _b = _a.mode, mode = _b === void 0 ? ActionButtonMode.iconButton : _b, label = _a.label, disabled = _a.disabled, Icon = _a.icon, _c = _a.onClick, onClick = _c === void 0 ? noop : _c, _d = _a.onMenuClose, onMenuClose = _d === void 0 ? noop : _d, otherProps = __rest(_a, ["className", "mode", "label", "disabled", "icon", "onClick", "onMenuClose"]);
40
+ var styles = useStyles();
41
+ var getButtonView = function () {
42
+ switch (mode) {
43
+ case 'iconButton': {
44
+ return (React.createElement(SmallIconButtonWithTooltip, __assign({ disabled: disabled, className: classnames(styles.iconButton, className), size: "S", tooltipTitle: label, onClick: onClick, icon: Icon }, otherProps)));
45
+ }
46
+ case 'button': {
47
+ return (React.createElement(Button, __assign({ className: classnames(styles.button, className), disabled: disabled, startIcon: React.createElement(Icon, null), onClick: onClick, color: "primary", classes: { startIcon: styles.startIcon, label: styles.label } }, otherProps),
48
+ React.createElement(ExpandedValueTooltip, { value: label },
49
+ React.createElement("div", { className: styles.overflowStyle }, label))));
50
+ }
51
+ case 'menuItem': {
52
+ var handleClick = function () {
53
+ onMenuClose();
54
+ onClick();
55
+ };
56
+ return (React.createElement(MenuItem, __assign({ classes: { root: styles.menuItem }, onClick: handleClick, disabled: disabled, ref: ref }, otherProps),
57
+ React.createElement(React.Fragment, null,
58
+ React.createElement(Icon, { className: styles.menuIcon }),
59
+ React.createElement(Typography, { classes: { root: styles.menuText } }, label))));
60
+ }
61
+ }
62
+ };
63
+ return getButtonView();
64
+ });
65
+ ActionButton.displayName = 'ActionButton';
@@ -0,0 +1 @@
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "button" | "startIcon" | "menuItem" | "menuText" | "iconButton" | "overflowStyle" | "menuIcon">;
@@ -0,0 +1,47 @@
1
+ import { makeStyles } from '@material-ui/core/styles';
2
+ export var useStyles = makeStyles(function (theme) { return ({
3
+ button: {
4
+ padding: '9px 16px 9px 12px',
5
+ '& svg g path': {
6
+ fill: theme.palette.primary.main,
7
+ fillOpacity: 1
8
+ }
9
+ },
10
+ iconButton: {
11
+ '& svg g path': {
12
+ fill: theme.palette.primary.main,
13
+ fillOpacity: 1
14
+ }
15
+ },
16
+ startIcon: {
17
+ marginLeft: 0,
18
+ marginRight: '8px',
19
+ width: '18px',
20
+ height: '18px',
21
+ alignItems: 'center'
22
+ },
23
+ label: {
24
+ whiteSpace: 'nowrap',
25
+ fontSize: '14px',
26
+ lineHeight: '16px',
27
+ letterSpacing: 0
28
+ },
29
+ overflowStyle: {
30
+ overflow: 'hidden',
31
+ whiteSpace: 'nowrap',
32
+ textOverflow: 'ellipsis'
33
+ },
34
+ menuIcon: {
35
+ marginRight: '12px'
36
+ },
37
+ menuItem: {
38
+ minHeight: '28px',
39
+ padding: '2px 16px 2px 12px'
40
+ },
41
+ menuText: {
42
+ color: theme.palette.text.primary,
43
+ fontSize: '13px',
44
+ lineHeight: '15px',
45
+ letterSpacing: 0
46
+ }
47
+ }); });
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { ActionButtonMode } from '../ActionButton/ActionButton';
3
+ import { Entity } from '@reltio/mdm-sdk';
4
+ declare type Props = {
5
+ className?: string;
6
+ entities: Entity[];
7
+ entity: Entity;
8
+ mode?: ActionButtonMode;
9
+ onMenuClose?: () => void;
10
+ disabled?: boolean;
11
+ onStartRequest?: () => void;
12
+ onFinishRequest?: () => void;
13
+ };
14
+ export declare const MergeButton: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLLIElement>>;
15
+ export {};
@@ -0,0 +1,39 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React, { forwardRef } from 'react';
24
+ import i18n from 'ui-i18n';
25
+ import MergeIcon from './mergeIcon.svg';
26
+ import { noop } from '../../core';
27
+ import { ActionButton, ActionButtonMode } from '../ActionButton/ActionButton';
28
+ import { useMergeAllRequest } from '../../hooks';
29
+ export var MergeButton = forwardRef(function (_a, ref) {
30
+ var className = _a.className, _b = _a.mode, mode = _b === void 0 ? ActionButtonMode.iconButton : _b, _c = _a.onMenuClose, onMenuClose = _c === void 0 ? noop : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, entity = _a.entity, entities = _a.entities, onStartRequest = _a.onStartRequest, onFinishRequest = _a.onFinishRequest, otherProps = __rest(_a, ["className", "mode", "onMenuClose", "disabled", "entity", "entities", "onStartRequest", "onFinishRequest"]);
31
+ var sendMergeAllRequest = useMergeAllRequest({
32
+ entity: entity,
33
+ entities: entities,
34
+ onStartRequest: onStartRequest,
35
+ onFinishRequest: onFinishRequest
36
+ }).sendMergeAllRequest;
37
+ return (React.createElement(ActionButton, __assign({ className: className, disabled: disabled, mode: mode, label: i18n.text('Merge'), icon: MergeIcon, onClick: sendMergeAllRequest, onMenuClose: onMenuClose, ref: ref }, otherProps)));
38
+ });
39
+ MergeButton.displayName = 'mergeButton';
@@ -0,0 +1,15 @@
1
+ import { Entity } from '@reltio/mdm-sdk';
2
+ import { ActionButtonMode } from '../ActionButton/ActionButton';
3
+ import React from 'react';
4
+ declare type Props = {
5
+ className?: string;
6
+ entities: Entity[];
7
+ entity: Entity;
8
+ mode?: ActionButtonMode;
9
+ onMenuClose?: () => void;
10
+ disabled?: boolean;
11
+ onStartRequest?: () => void;
12
+ onFinishRequest?: () => void;
13
+ };
14
+ export declare const NotMatchButton: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLLIElement>>;
15
+ export {};
@@ -0,0 +1,39 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { ActionButton, ActionButtonMode } from '../ActionButton/ActionButton';
24
+ import React, { forwardRef } from 'react';
25
+ import NotMatchIcon from './notMatch.svg';
26
+ import { noop } from '../../core';
27
+ import i18n from 'ui-i18n';
28
+ import { useMarkAsNotMatchRequest } from '../../hooks/useMarkAsNotMatchRequest';
29
+ export var NotMatchButton = forwardRef(function (_a, ref) {
30
+ var className = _a.className, _b = _a.mode, mode = _b === void 0 ? ActionButtonMode.iconButton : _b, _c = _a.onMenuClose, onMenuClose = _c === void 0 ? noop : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, entity = _a.entity, entities = _a.entities, onStartRequest = _a.onStartRequest, onFinishRequest = _a.onFinishRequest, otherProps = __rest(_a, ["className", "mode", "onMenuClose", "disabled", "entity", "entities", "onStartRequest", "onFinishRequest"]);
31
+ var sendMarkAsNotMatchRequest = useMarkAsNotMatchRequest({
32
+ entity: entity,
33
+ entities: entities,
34
+ onStartRequest: onStartRequest,
35
+ onFinishRequest: onFinishRequest
36
+ }).sendMarkAsNotMatchRequest;
37
+ return (React.createElement(ActionButton, __assign({ className: className, disabled: disabled, mode: mode, label: i18n.text('Not a match'), icon: NotMatchIcon, onClick: sendMarkAsNotMatchRequest, onMenuClose: onMenuClose, ref: ref }, otherProps)));
38
+ });
39
+ NotMatchButton.displayName = 'notMatchButton';
@@ -8,6 +8,7 @@ declare type Props = {
8
8
  match: PotentialMatch;
9
9
  metadata: Metadata;
10
10
  children?: React.ReactNode;
11
+ className?: string;
11
12
  };
12
- export declare const ProfileMatchCard: ({ children, entitiesMap, entity, match, metadata }: Props) => JSX.Element;
13
+ export declare const ProfileMatchCard: ({ children, entitiesMap, entity, match, metadata, className }: Props) => JSX.Element;
13
14
  export {};
@@ -2,10 +2,11 @@ import React from 'react';
2
2
  import { useStyles } from './styles';
3
3
  import ProfileCard from '../ProfileCard/ProfileCard';
4
4
  import MatchRulesBlock from '../MatchRulesBlock/MatchRulesBlock';
5
+ import classnames from 'classnames';
5
6
  export var ProfileMatchCard = function (_a) {
6
- var children = _a.children, entitiesMap = _a.entitiesMap, entity = _a.entity, match = _a.match, metadata = _a.metadata;
7
+ var children = _a.children, entitiesMap = _a.entitiesMap, entity = _a.entity, match = _a.match, metadata = _a.metadata, className = _a.className;
7
8
  var styles = useStyles();
8
- return (React.createElement("div", { className: styles.root },
9
+ return (React.createElement("div", { className: classnames(styles.root, className) },
9
10
  React.createElement("div", { className: styles.profileCardWrapper },
10
11
  React.createElement(ProfileCard, { entity: match.object, classes: { container: styles.profileCardContainer }, disableEntityTypeColor: true }),
11
12
  children),
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { AttributesViewOwnProps } from '../types';
3
- declare const AttributesView: ({ mode, attributesCount, ...restProps }: AttributesViewOwnProps) => JSX.Element;
3
+ declare const AttributesView: ({ mode, attributesCount, pinnedAttributes, ...restProps }: AttributesViewOwnProps) => JSX.Element;
4
4
  export default AttributesView;
@@ -25,7 +25,7 @@ import { isViewMode, Mode } from '@reltio/mdm-sdk';
25
25
  import ReadModeAttributesView from '../readMode/AttributesView';
26
26
  import EditModeAttributesView from '../editMode/AttributesView';
27
27
  var AttributesView = function (_a) {
28
- var _b = _a.mode, mode = _b === void 0 ? Mode.Viewing : _b, attributesCount = _a.attributesCount, restProps = __rest(_a, ["mode", "attributesCount"]);
29
- return isViewMode(mode) ? (React.createElement(ReadModeAttributesView, __assign({ attributesCount: attributesCount }, restProps))) : (React.createElement(EditModeAttributesView, __assign({ mode: mode }, restProps)));
28
+ var _b = _a.mode, mode = _b === void 0 ? Mode.Viewing : _b, attributesCount = _a.attributesCount, pinnedAttributes = _a.pinnedAttributes, restProps = __rest(_a, ["mode", "attributesCount", "pinnedAttributes"]);
29
+ return isViewMode(mode) ? (React.createElement(ReadModeAttributesView, __assign({ attributesCount: attributesCount }, restProps))) : (React.createElement(EditModeAttributesView, __assign({ mode: mode, pinnedAttributes: pinnedAttributes }, restProps)));
30
30
  };
31
31
  export default AttributesView;
@@ -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);