@reltio/components 1.4.890 → 1.4.894

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 (57) hide show
  1. package/cjs/components/ErrorPopup/ErrorPopup.d.ts +4 -0
  2. package/cjs/components/ErrorPopup/ErrorPopup.js +37 -2
  3. package/cjs/components/MatchRulesBlock/MatchRulesBlock.d.ts +5 -2
  4. package/cjs/components/MatchRulesBlock/MatchRulesBlock.js +2 -11
  5. package/cjs/components/ProfileCard/ProfileCard.d.ts +11 -19
  6. package/cjs/components/ProfileCard/ProfileCard.js +3 -12
  7. package/cjs/components/ProfileCard/styles.d.ts +1 -1
  8. package/cjs/components/ProfileMatchCard/ProfileMatchCard.d.ts +13 -0
  9. package/cjs/components/ProfileMatchCard/ProfileMatchCard.js +21 -0
  10. package/cjs/components/ProfileMatchCard/styles.d.ts +1 -0
  11. package/cjs/components/ProfileMatchCard/styles.js +28 -0
  12. package/cjs/components/editors/TimestampEditor/TimestampEditor.js +5 -1
  13. package/cjs/components/index.d.ts +1 -0
  14. package/cjs/components/index.js +3 -1
  15. package/cjs/components/workflow/cards/PotentialMatchTaskCard/PotentialMatchTaskCard.d.ts +7 -0
  16. package/cjs/components/workflow/cards/PotentialMatchTaskCard/PotentialMatchTaskCard.js +41 -0
  17. package/cjs/components/workflow/cards/PotentialMatchTaskCard/styles.d.ts +1 -0
  18. package/cjs/components/workflow/cards/PotentialMatchTaskCard/styles.js +9 -0
  19. package/cjs/components/workflow/cards/WorkflowTaskCardsFactory.js +2 -2
  20. package/cjs/components/workflow/components/LineDecorator/styles.js +1 -1
  21. package/cjs/hooks/helpers/pagingSimulator.d.ts +12 -0
  22. package/cjs/hooks/helpers/pagingSimulator.js +86 -0
  23. package/cjs/hooks/index.d.ts +2 -0
  24. package/cjs/hooks/index.js +5 -1
  25. package/cjs/hooks/useMatchesLoader.d.ts +27 -0
  26. package/cjs/hooks/useMatchesLoader.js +106 -0
  27. package/cjs/hooks/usePagingSimulator.d.ts +10 -0
  28. package/cjs/hooks/usePagingSimulator.js +10 -0
  29. package/esm/components/ErrorPopup/ErrorPopup.d.ts +4 -0
  30. package/esm/components/ErrorPopup/ErrorPopup.js +19 -3
  31. package/esm/components/MatchRulesBlock/MatchRulesBlock.d.ts +5 -2
  32. package/esm/components/MatchRulesBlock/MatchRulesBlock.js +3 -12
  33. package/esm/components/ProfileCard/ProfileCard.d.ts +11 -19
  34. package/esm/components/ProfileCard/ProfileCard.js +4 -13
  35. package/esm/components/ProfileCard/styles.d.ts +1 -1
  36. package/esm/components/ProfileMatchCard/ProfileMatchCard.d.ts +13 -0
  37. package/esm/components/ProfileMatchCard/ProfileMatchCard.js +14 -0
  38. package/esm/components/ProfileMatchCard/styles.d.ts +1 -0
  39. package/esm/components/ProfileMatchCard/styles.js +25 -0
  40. package/esm/components/editors/TimestampEditor/TimestampEditor.js +5 -1
  41. package/esm/components/index.d.ts +1 -0
  42. package/esm/components/index.js +1 -0
  43. package/esm/components/workflow/cards/PotentialMatchTaskCard/PotentialMatchTaskCard.d.ts +7 -0
  44. package/esm/components/workflow/cards/PotentialMatchTaskCard/PotentialMatchTaskCard.js +36 -0
  45. package/esm/components/workflow/cards/PotentialMatchTaskCard/styles.d.ts +1 -0
  46. package/esm/components/workflow/cards/PotentialMatchTaskCard/styles.js +6 -0
  47. package/esm/components/workflow/cards/WorkflowTaskCardsFactory.js +2 -2
  48. package/esm/components/workflow/components/LineDecorator/styles.js +1 -1
  49. package/esm/hooks/helpers/pagingSimulator.d.ts +12 -0
  50. package/esm/hooks/helpers/pagingSimulator.js +82 -0
  51. package/esm/hooks/index.d.ts +2 -0
  52. package/esm/hooks/index.js +2 -0
  53. package/esm/hooks/useMatchesLoader.d.ts +27 -0
  54. package/esm/hooks/useMatchesLoader.js +99 -0
  55. package/esm/hooks/usePagingSimulator.d.ts +10 -0
  56. package/esm/hooks/usePagingSimulator.js +6 -0
  57. package/package.json +3 -3
@@ -0,0 +1,106 @@
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.useMatchesLoader = 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 usePagingSimulator_1 = require("./usePagingSimulator");
12
+ var useSafePromise_1 = require("./useSafePromise");
13
+ var ramda_1 = require("ramda");
14
+ var useMatchesLoader = function (_a) {
15
+ var enabled = _a.enabled, entity = _a.entity, filter = _a.filter, onFinishLoading = _a.onFinishLoading, onStartLoading = _a.onStartLoading, options = _a.options, page = _a.page, rowsPerPage = _a.rowsPerPage, sorting = _a.sorting;
16
+ var _b = sorting || {}, order = _b.order, field = _b.field;
17
+ var _c = react_1.useState(0), total = _c[0], setTotal = _c[1];
18
+ var _d = react_1.useState([]), matches = _d[0], setMatches = _d[1];
19
+ var _e = react_1.useState({}), entitiesMap = _e[0], setEntitiesMap = _e[1];
20
+ var tenant = react_redux_1.useSelector(mdm_module_1.default.selectors.getTenant);
21
+ var dtssPath = react_redux_1.useSelector(mdm_module_1.default.selectors.getDtssPath);
22
+ var dataTenants = react_redux_1.useSelector(mdm_module_1.default.selectors.getDataTenants);
23
+ var dtssParams = react_1.useMemo(function () { return ({
24
+ dtssPath: dtssPath,
25
+ dataTenants: dataTenants,
26
+ entity: entity,
27
+ customerTenant: tenant,
28
+ dtssRequest: mdm_sdk_1.getMatchesFromDataTenants
29
+ }); }, [dtssPath, dataTenants, entity, tenant]);
30
+ //eslint-disable-next-line react-hooks/exhaustive-deps
31
+ var getTransitiveMatchesWithDtss = react_1.useCallback(mdm_sdk_1.withDtssPotentialItems(dtssParams, mdm_sdk_1.getTransitiveMatches), [
32
+ dtssParams
33
+ ]);
34
+ var getTransitiveMatchesWithPaging = usePagingSimulator_1.usePagingSimulator(getTransitiveMatchesWithDtss);
35
+ var getPagedMatchesForDataTenantEntity = usePagingSimulator_1.usePagingSimulator(mdm_sdk_1.getMatchesForDataTenantEntity);
36
+ var entityUri = ramda_1.prop('uri', entity);
37
+ var safePromise = useSafePromise_1.useSafePromise();
38
+ var getMatches = react_1.useCallback(function (force) {
39
+ if (force === void 0) { force = false; }
40
+ if (!enabled) {
41
+ return;
42
+ }
43
+ onStartLoading === null || onStartLoading === void 0 ? void 0 : onStartLoading();
44
+ safePromise(mdm_sdk_1.isDataTenantEntity(entity)
45
+ ? getPagedMatchesForDataTenantEntity({
46
+ dtssPath: dtssPath,
47
+ entity: entity,
48
+ customerTenant: tenant,
49
+ offset: page * rowsPerPage,
50
+ max: rowsPerPage,
51
+ force: force
52
+ })
53
+ : getTransitiveMatchesWithPaging({
54
+ entityUri: entityUri,
55
+ offset: page * rowsPerPage,
56
+ max: rowsPerPage,
57
+ filter: filter,
58
+ sort: field,
59
+ order: order,
60
+ force: force,
61
+ deep: options.showTransitiveMatches ? undefined : 1,
62
+ activeness: options.showInactiveEntities ? mdm_sdk_1.ActivityFilters.ALL : mdm_sdk_1.ActivityFilters.ACTIVE_ONLY
63
+ }))
64
+ .then(function (result) {
65
+ var response = result.response, total = result.total, originalResponse = result.originalResponse;
66
+ setTotal(total);
67
+ setMatches(response);
68
+ var matchUris = mdm_sdk_1.collectAllTransitiveEntitiesUris(originalResponse);
69
+ if (matchUris.length > 0) {
70
+ setEntitiesMap(mdm_sdk_1.getEntitiesMap(originalResponse));
71
+ }
72
+ })
73
+ .finally(function () {
74
+ onFinishLoading === null || onFinishLoading === void 0 ? void 0 : onFinishLoading();
75
+ });
76
+ }, [
77
+ dtssPath,
78
+ enabled,
79
+ entityUri,
80
+ field,
81
+ filter,
82
+ getPagedMatchesForDataTenantEntity,
83
+ getTransitiveMatchesWithPaging,
84
+ onFinishLoading,
85
+ onStartLoading,
86
+ options,
87
+ order,
88
+ page,
89
+ rowsPerPage,
90
+ safePromise,
91
+ tenant
92
+ ]); // eslint-disable-line
93
+ react_1.useEffect(function () {
94
+ getMatches();
95
+ }, [getMatches]);
96
+ var loadMatches = react_1.useCallback(function () {
97
+ getMatches(true);
98
+ }, [getMatches]);
99
+ return {
100
+ total: total,
101
+ matches: matches,
102
+ entitiesMap: entitiesMap,
103
+ loadMatches: loadMatches
104
+ };
105
+ };
106
+ exports.useMatchesLoader = useMatchesLoader;
@@ -0,0 +1,10 @@
1
+ export declare const usePagingSimulator: (request: any) => ({ max, offset, force, ...requestParams }: {
2
+ [key: string]: unknown;
3
+ max: number;
4
+ offset: number;
5
+ force?: boolean;
6
+ }) => Promise<{
7
+ response: any[];
8
+ total: number;
9
+ originalResponse: any[];
10
+ }>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePagingSimulator = void 0;
4
+ var react_1 = require("react");
5
+ var pagingSimulator_1 = require("./helpers/pagingSimulator");
6
+ var usePagingSimulator = function (request) {
7
+ // eslint-disable-next-line react-hooks/exhaustive-deps
8
+ return react_1.useCallback(pagingSimulator_1.createPagingSimulator(request), [request]);
9
+ };
10
+ exports.usePagingSimulator = usePagingSimulator;
@@ -1,5 +1,9 @@
1
1
  export default ErrorPopup;
2
2
  declare function ErrorPopup(props: any): JSX.Element;
3
3
  declare namespace ErrorPopup {
4
+ namespace propTypes {
5
+ const showErrorFromStore: PropTypes.Requireable<boolean>;
6
+ }
4
7
  const addError: any;
5
8
  }
9
+ import PropTypes from "prop-types";
@@ -9,19 +9,35 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import React from 'react';
13
- import { useSelector } from 'react-redux';
12
+ import React, { useEffect } from 'react';
13
+ import { useDispatch, useSelector } from 'react-redux';
14
+ import PropTypes from 'prop-types';
14
15
  import classnames from 'classnames';
15
16
  import { path } from 'ramda';
17
+ import i18n from 'ui-i18n';
16
18
  import Portal from '@material-ui/core/Portal';
17
19
  import RCErrorPopup from 'react-components/dist/ErrorPopup/ErrorPopup';
18
- import mdmModule from '@reltio/mdm-module';
20
+ import mdmModule, { ui } from '@reltio/mdm-module';
19
21
  import { useStyles } from './styles';
20
22
  var ErrorPopup = function (props) {
21
23
  var styles = useStyles();
22
24
  var autoCloseInterval = useSelector(mdmModule.selectors.getAutoCloseInterval);
25
+ var uiError = useSelector(mdmModule.selectors.getUiError);
26
+ var dispatch = useDispatch();
27
+ useEffect(function () {
28
+ if (uiError && props.showErrorFromStore) {
29
+ ErrorPopup.addError({
30
+ title: i18n.text('Error'),
31
+ message: uiError
32
+ });
33
+ dispatch(ui.actions.errorSet(null));
34
+ }
35
+ }, [dispatch, uiError, props.showErrorFromStore]);
23
36
  return (React.createElement(Portal, { container: document.body },
24
37
  React.createElement(RCErrorPopup, __assign({ classes: { errorBlock: classnames(styles.errorBlock, path(['classes', 'errorBlock'], props)) }, autoCloseInterval: autoCloseInterval }, props))));
25
38
  };
39
+ ErrorPopup.propTypes = {
40
+ showErrorFromStore: PropTypes.bool
41
+ };
26
42
  ErrorPopup.addError = RCErrorPopup.addError;
27
43
  export default ErrorPopup;
@@ -1,9 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { Entity, Metadata, PotentialMatch } from '@reltio/mdm-sdk';
3
3
  declare type Props = {
4
+ entitiesMap: {
5
+ [key: string]: Pick<Entity, 'uri' | 'type' | 'label'>;
6
+ };
4
7
  entity: Entity;
8
+ match: PotentialMatch;
5
9
  metadata: Metadata;
6
- transitiveMatches: PotentialMatch[];
7
10
  };
8
- declare const MatchRulesBlock: ({ entity, metadata, transitiveMatches }: Props) => JSX.Element;
11
+ declare const MatchRulesBlock: ({ entitiesMap, entity, match, metadata }: Props) => JSX.Element;
9
12
  export default MatchRulesBlock;
@@ -1,19 +1,10 @@
1
1
  import React from 'react';
2
- import { isEmpty } from 'ramda';
3
- import { getEntityMatchRules, getMatchRules, getTransitiveMatchesForEntity } from '@reltio/mdm-sdk';
2
+ import { getMatchRules, getTransitiveMatchRules, isTransitiveMatch } from '@reltio/mdm-sdk';
4
3
  import SimpleMatchRulesBlock from './SimpleMatchRulesBlock/SimpleMatchRulesBlock';
5
4
  import TransitiveMatchBlock from './TransitiveMatchBlock/TransitiveMatchBlock';
6
5
  import SimpleMatchRulesBuilder from './SimpleMatchRulesBuilder/SimpleMatchRulesBuilder';
7
6
  var MatchRulesBlock = function (_a) {
8
- var entity = _a.entity, metadata = _a.metadata, transitiveMatches = _a.transitiveMatches;
9
- var transitiveMatchRules = getTransitiveMatchesForEntity(metadata, transitiveMatches, entity);
10
- if (isEmpty(transitiveMatchRules)) {
11
- var entityMatchRules = getEntityMatchRules(entity);
12
- var matchRules = getMatchRules(metadata, entity.type, entityMatchRules);
13
- return React.createElement(SimpleMatchRulesBuilder, { matchRules: matchRules, Component: SimpleMatchRulesBlock });
14
- }
15
- else {
16
- return React.createElement(TransitiveMatchBlock, { transitiveMatchRules: transitiveMatchRules });
17
- }
7
+ var entitiesMap = _a.entitiesMap, entity = _a.entity, match = _a.match, metadata = _a.metadata;
8
+ return isTransitiveMatch(match) ? (React.createElement(TransitiveMatchBlock, { transitiveMatchRules: getTransitiveMatchRules(metadata, match, entitiesMap) })) : (React.createElement(SimpleMatchRulesBuilder, { matchRules: getMatchRules(metadata, entity.type, match.matchRules), Component: SimpleMatchRulesBlock }));
18
9
  };
19
10
  export default MatchRulesBlock;
@@ -1,21 +1,13 @@
1
- declare var _default: React.MemoExoticComponent<{
2
- ({ entity, classes, ...otherProps }: {
3
- [x: string]: any;
4
- entity: any;
5
- classes?: {};
6
- }): JSX.Element;
7
- propTypes: {
8
- entity: PropTypes.Requireable<PropTypes.InferProps<{
9
- uri: PropTypes.Requireable<string>;
10
- type: PropTypes.Requireable<string>;
11
- }>>;
12
- classes: PropTypes.Requireable<PropTypes.InferProps<{
13
- label: PropTypes.Requireable<string>;
14
- secondaryLabel: PropTypes.Requireable<string>;
15
- container: PropTypes.Requireable<string>;
16
- }>>;
1
+ import React from 'react';
2
+ import { Entity } from '@reltio/mdm-sdk';
3
+ declare type Props = {
4
+ entity: Entity;
5
+ disableEntityTypeColor?: boolean;
6
+ classes?: {
7
+ label?: string;
8
+ secondaryLabel?: string;
9
+ container?: string;
17
10
  };
18
- }>;
11
+ } & React.HTMLAttributes<HTMLDivElement>;
12
+ declare const _default: React.MemoExoticComponent<({ entity, classes, disableEntityTypeColor, ...otherProps }: Props) => JSX.Element>;
19
13
  export default _default;
20
- import PropTypes from "prop-types";
21
- import React from "react";
@@ -21,10 +21,9 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import React, { memo } from 'react';
24
- import PropTypes from 'prop-types';
25
24
  import classnames from 'classnames';
26
25
  import { useSelector } from 'react-redux';
27
- import { EntityType, getEntityId, getEntityType, getEntityUriForLink, getLabel, getPropWithInheritance, theme } from '@reltio/mdm-sdk';
26
+ import { getEntityId, getEntityType, getEntityUriForLink, getLabel, getPropWithInheritance, theme } from '@reltio/mdm-sdk';
28
27
  import mdmModule from '@reltio/mdm-module';
29
28
  import useStyles from './styles';
30
29
  import EntityAvatar from '../EntityAvatar/EntityAvatar';
@@ -32,7 +31,7 @@ import EntityUriLink from '../EntityUriLink/EntityUriLink';
32
31
  import ExpandedValueTooltip from '../ExpandedValueTooltip/ExpandedValueTooltip';
33
32
  import EntityTypeBadge from '../EntityTypeBadge/EntityTypeBadge';
34
33
  var ProfileCard = function (_a) {
35
- var entity = _a.entity, _b = _a.classes, classes = _b === void 0 ? {} : _b, otherProps = __rest(_a, ["entity", "classes"]);
34
+ var entity = _a.entity, _b = _a.classes, classes = _b === void 0 ? {} : _b, disableEntityTypeColor = _a.disableEntityTypeColor, otherProps = __rest(_a, ["entity", "classes", "disableEntityTypeColor"]);
36
35
  var styles = useStyles();
37
36
  var secondaryLabelClass = classes.secondaryLabel, labelClass = classes.label, containerClass = classes.container;
38
37
  var metadata = useSelector(mdmModule.selectors.getMetadata);
@@ -41,7 +40,7 @@ var ProfileCard = function (_a) {
41
40
  var entityType = getEntityType(metadata, type) || {};
42
41
  var entityTypeColor = getPropWithInheritance(metadata, entityType, 'typeColor') || theme.palette.primary.main;
43
42
  return (React.createElement("div", __assign({ className: classnames(styles.container, containerClass) }, otherProps),
44
- React.createElement("div", { className: styles.colorBox, style: { backgroundColor: entityTypeColor } }),
43
+ React.createElement("div", { className: styles.colorBox, style: disableEntityTypeColor ? undefined : { backgroundColor: entityTypeColor } }),
45
44
  React.createElement(EntityAvatar, { entity: entity, avatarClassName: styles.avatar, imageClassName: styles.image }),
46
45
  React.createElement("div", { className: styles.info },
47
46
  React.createElement("div", { className: styles.firstRow },
@@ -49,17 +48,9 @@ var ProfileCard = function (_a) {
49
48
  React.createElement(ExpandedValueTooltip, { value: label, placement: "top", showOnExceededHeight: true },
50
49
  React.createElement("span", { className: classnames(styles.label, labelClass) }, label)))),
51
50
  React.createElement("div", { className: styles.secondRow }, secondaryLabel && (React.createElement(ExpandedValueTooltip, { value: secondaryLabel, placement: "top", showOnExceededHeight: true },
52
- React.createElement("span", { className: classnames(styles.secondaryLabel, secondaryLabelClass) }, secondaryLabel)))),
51
+ React.createElement("span", { className: secondaryLabelClass }, secondaryLabel)))),
53
52
  React.createElement("div", { className: styles.thirdRow },
54
53
  React.createElement(EntityTypeBadge, { entity: entity }),
55
54
  React.createElement("div", null, getEntityId(entity))))));
56
55
  };
57
- ProfileCard.propTypes = {
58
- entity: EntityType,
59
- classes: PropTypes.shape({
60
- label: PropTypes.string,
61
- secondaryLabel: PropTypes.string,
62
- container: PropTypes.string
63
- })
64
- };
65
56
  export default memo(ProfileCard);
@@ -1,2 +1,2 @@
1
+ declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "image" | "link" | "avatar" | "firstRow" | "container" | "colorBox" | "info" | "secondRow" | "thirdRow">;
1
2
  export default useStyles;
2
- declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "image" | "link" | "avatar" | "firstRow" | "container" | "info" | "colorBox" | "secondRow" | "thirdRow">;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { Entity, Metadata, PotentialMatch } from '@reltio/mdm-sdk';
3
+ declare type Props = {
4
+ entitiesMap: {
5
+ [key: string]: Pick<Entity, 'uri' | 'type' | 'label'>;
6
+ };
7
+ entity: Entity;
8
+ match: PotentialMatch;
9
+ metadata: Metadata;
10
+ children?: React.ReactNode;
11
+ };
12
+ export declare const ProfileMatchCard: ({ children, entitiesMap, entity, match, metadata }: Props) => JSX.Element;
13
+ export {};
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { useStyles } from './styles';
3
+ import ProfileCard from '../ProfileCard/ProfileCard';
4
+ import MatchRulesBlock from '../MatchRulesBlock/MatchRulesBlock';
5
+ export var ProfileMatchCard = function (_a) {
6
+ var children = _a.children, entitiesMap = _a.entitiesMap, entity = _a.entity, match = _a.match, metadata = _a.metadata;
7
+ var styles = useStyles();
8
+ return (React.createElement("div", { className: styles.root },
9
+ React.createElement("div", { className: styles.profileCardWrapper },
10
+ React.createElement(ProfileCard, { entity: match.object, classes: { container: styles.profileCardContainer }, disableEntityTypeColor: true }),
11
+ children),
12
+ React.createElement("div", { className: styles.rulesContainer },
13
+ React.createElement(MatchRulesBlock, { match: match, metadata: metadata, entitiesMap: entitiesMap, entity: entity }))));
14
+ };
@@ -0,0 +1 @@
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"root" | "rulesContainer" | "profileCardWrapper" | "profileCardContainer">;
@@ -0,0 +1,25 @@
1
+ import { makeStyles } from '@material-ui/core/styles';
2
+ export var useStyles = makeStyles({
3
+ root: {
4
+ display: 'flex',
5
+ flexDirection: 'column',
6
+ paddingRight: '12px',
7
+ paddingTop: '8px',
8
+ paddingBottom: '8px',
9
+ '& + &': {
10
+ borderTop: '1px solid rgba(0,0,0, 0.12)'
11
+ }
12
+ },
13
+ profileCardWrapper: {
14
+ display: 'flex',
15
+ flexDirection: 'row',
16
+ alignItems: 'center',
17
+ gap: '4px'
18
+ },
19
+ profileCardContainer: {
20
+ flexGrow: 1
21
+ },
22
+ rulesContainer: {
23
+ paddingLeft: '40px'
24
+ }
25
+ });
@@ -40,7 +40,11 @@ var TimestampEditor = function (_a) {
40
40
  var _e = useState(false), isCalendarOpen = _e[0], setIsCalendarOpen = _e[1];
41
41
  var timestampFormat = format || dateFormat + " " + timeFormat;
42
42
  var isAmPmFormat = timestampFormat && timestampFormat.toLowerCase().includes('a');
43
- return (React.createElement(KeyboardDateTimePicker, __assign({ format: timestampFormat, rifmFormatter: isAmPmFormat ? makeAmPmFormatter(timestampFormat) : undefined, variant: "inline", invalidDateMessage: i18n.text('Invalid Date Format'), maxDateMessage: i18n.text('Date should not be after maximal date'), minDateMessage: i18n.text('Date should not be before minimal date'), inputVariant: variant, views: ['year', 'date', 'hours', 'minutes'], autoOk: true, InputAdornmentProps: { position: 'end' }, KeyboardButtonProps: {
43
+ return (React.createElement(KeyboardDateTimePicker, __assign({ format: timestampFormat, rifmFormatter: isAmPmFormat ? makeAmPmFormatter(timestampFormat) : undefined, variant: "inline", invalidDateMessage: i18n.text('Invalid Date Format'), maxDateMessage: i18n.text('Date should not be after maximal date'), minDateMessage: i18n.text('Date should not be before minimal date'), inputVariant: variant,
44
+ //there is a bug in the picker types that prevents time picker from showing seconds picker (see https://github.com/mui-org/material-ui-pickers/issues/739)
45
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
46
+ // @ts-ignore: wrong type
47
+ views: ['year', 'date', 'hours', 'minutes', 'seconds'], autoOk: true, InputAdornmentProps: { position: 'end' }, KeyboardButtonProps: {
44
48
  classes: { root: styles.iconButtonRoot },
45
49
  onKeyPress: invoker(0, 'stopPropagation')
46
50
  }, keyboardIcon: React.createElement(DateRangeIcon, null), onChange: when(utils.dates.isValidMomentDateOrNull, pipe(utils.dates.momentToDate, onChange)), label: label, "aria-label": label, value: value, placeholder: i18n.text((dateFormat + " HH:MM").toUpperCase()), ampm: false, onClose: function () { return setIsCalendarOpen(false); }, onOpen: function () { return setIsCalendarOpen(true); }, InputProps: __assign({ classes: {
@@ -121,3 +121,4 @@ export * from './history';
121
121
  export { default as OvIcon } from './attributes/OvIcon';
122
122
  export { default as RelationEditor } from './RelationEditor';
123
123
  export * from './workflow';
124
+ export { ProfileMatchCard } from './ProfileMatchCard/ProfileMatchCard';
@@ -120,3 +120,4 @@ export * from './history';
120
120
  export { default as OvIcon } from './attributes/OvIcon';
121
121
  export { default as RelationEditor } from './RelationEditor';
122
122
  export * from './workflow';
123
+ export { ProfileMatchCard } from './ProfileMatchCard/ProfileMatchCard';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { WorkflowTaskData } from '@reltio/mdm-sdk';
3
+ declare type Props = {
4
+ task: WorkflowTaskData;
5
+ };
6
+ declare const PotentialMatchTaskCard: ({ task }: Props) => JSX.Element;
7
+ export default PotentialMatchTaskCard;
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { useSelector } from 'react-redux';
3
+ import mdmModule from '@reltio/mdm-module';
4
+ import { useStyles } from './styles';
5
+ import GenericWorkflowTaskCard from '../GenericWorkflowTaskCard/GenericWorkflowTaskCard';
6
+ import LineDecorator from '../../components/LineDecorator/LineDecorator';
7
+ import PmTaskIcon from '../../../../icons/PmTaskIcon';
8
+ import { useMatchesLoader } from '../../../../hooks/useMatchesLoader';
9
+ import { ProfileMatchCard } from '../../../ProfileMatchCard/ProfileMatchCard';
10
+ var defaultOptions = {
11
+ showTransitiveMatches: true,
12
+ showInactiveEntities: false
13
+ };
14
+ var PotentialMatchTaskCard = function (_a) {
15
+ var task = _a.task;
16
+ var styles = useStyles();
17
+ var objectURIs = task.objectURIs;
18
+ var entity = useSelector(mdmModule.selectors.getEntity);
19
+ var metadata = useSelector(mdmModule.selectors.getMetadata);
20
+ var _b = useMatchesLoader({
21
+ enabled: !!entity.uri,
22
+ entity: entity,
23
+ filter: '',
24
+ rowsPerPage: Number.MAX_SAFE_INTEGER,
25
+ page: 0,
26
+ options: defaultOptions
27
+ }), matches = _b.matches, entitiesMap = _b.entitiesMap;
28
+ var match = matches === null || matches === void 0 ? void 0 : matches.find(function (_a) {
29
+ var object = _a.object;
30
+ return objectURIs.includes(object.uri);
31
+ });
32
+ return (React.createElement(GenericWorkflowTaskCard, { task: task, Icon: PmTaskIcon }, match && (React.createElement(LineDecorator, { last: true },
33
+ React.createElement("div", { className: styles.pmCard },
34
+ React.createElement(ProfileMatchCard, { metadata: metadata, entity: entity, match: match, entitiesMap: entitiesMap }))))));
35
+ };
36
+ export default PotentialMatchTaskCard;
@@ -0,0 +1 @@
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"pmCard">;
@@ -0,0 +1,6 @@
1
+ import { makeStyles } from '@material-ui/core/styles';
2
+ export var useStyles = makeStyles({
3
+ pmCard: {
4
+ marginLeft: '-15px'
5
+ }
6
+ });
@@ -2,9 +2,9 @@ import React from 'react';
2
2
  import { PredefinedWorkflowProcessType } from '@reltio/mdm-sdk';
3
3
  import GenericWorkflowTaskCard from './GenericWorkflowTaskCard/GenericWorkflowTaskCard';
4
4
  import DataChangeRequestTaskCard from './DataChangeRequestTaskCard/DataChangeRequestTaskCard';
5
+ import PotentialMatchTaskCard from './PotentialMatchTaskCard/PotentialMatchTaskCard';
5
6
  import DefaultTaskIcon from '../../../icons/DefaultTaskIcon';
6
7
  import DeleteRequestTaskIcon from '../../../icons/DeleteRequestTaskIcon';
7
- import PmTaskIcon from '../../../icons/PmTaskIcon';
8
8
  var WorkflowTaskCardsFactory = /** @class */ (function () {
9
9
  function WorkflowTaskCardsFactory() {
10
10
  }
@@ -15,7 +15,7 @@ var WorkflowTaskCardsFactory = /** @class */ (function () {
15
15
  case PredefinedWorkflowProcessType.dataChangeRequestReview:
16
16
  return React.createElement(DataChangeRequestTaskCard, { task: task });
17
17
  case PredefinedWorkflowProcessType.potentialMatchReview:
18
- return React.createElement(GenericWorkflowTaskCard, { task: task, Icon: PmTaskIcon });
18
+ return React.createElement(PotentialMatchTaskCard, { task: task });
19
19
  case PredefinedWorkflowProcessType.recommendForDelete:
20
20
  return React.createElement(GenericWorkflowTaskCard, { task: task, Icon: DeleteRequestTaskIcon });
21
21
  default:
@@ -4,7 +4,7 @@ var lineStyle = '2px solid rgba(0,0,0,0.06)';
4
4
  var pointSize = 6;
5
5
  var blockWidth = 56;
6
6
  var linePadding = 10;
7
- var pointPadding = 10;
7
+ var pointPadding = 15;
8
8
  export var useStyles = makeStyles({
9
9
  decorator: {
10
10
  display: 'flex',
@@ -0,0 +1,12 @@
1
+ declare type RequestProps = {
2
+ max: number;
3
+ offset: number;
4
+ force?: boolean;
5
+ [key: string]: unknown;
6
+ };
7
+ export declare const createPagingSimulator: (request: any) => ({ max, offset, force, ...requestParams }: RequestProps) => Promise<{
8
+ response: any[];
9
+ total: number;
10
+ originalResponse: any[];
11
+ }>;
12
+ export {};
@@ -0,0 +1,82 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ var __rest = (this && this.__rest) || function (s, e) {
38
+ var t = {};
39
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
40
+ t[p] = s[p];
41
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
42
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
43
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
44
+ t[p[i]] = s[p[i]];
45
+ }
46
+ return t;
47
+ };
48
+ import { equals } from 'ramda';
49
+ export var createPagingSimulator = function (request) {
50
+ var previousValues = {};
51
+ var requestResponse = [];
52
+ return function (_a) { return __awaiter(void 0, void 0, void 0, function () {
53
+ var shouldSendRequest, previousValuesKeys, _i, previousValuesKeys_1, key;
54
+ var max = _a.max, offset = _a.offset, force = _a.force, requestParams = __rest(_a, ["max", "offset", "force"]);
55
+ return __generator(this, function (_b) {
56
+ switch (_b.label) {
57
+ case 0:
58
+ shouldSendRequest = force;
59
+ previousValuesKeys = Object.keys(previousValues);
60
+ shouldSendRequest = shouldSendRequest || !equals(Object.keys(requestParams), previousValuesKeys);
61
+ if (!shouldSendRequest) {
62
+ for (_i = 0, previousValuesKeys_1 = previousValuesKeys; _i < previousValuesKeys_1.length; _i++) {
63
+ key = previousValuesKeys_1[_i];
64
+ shouldSendRequest = shouldSendRequest || !equals(previousValues[key], requestParams[key]);
65
+ }
66
+ }
67
+ if (!shouldSendRequest) return [3 /*break*/, 2];
68
+ return [4 /*yield*/, request(requestParams)];
69
+ case 1:
70
+ // eslint-disable-next-line no-unused-vars
71
+ requestResponse = _b.sent();
72
+ previousValues = requestParams;
73
+ _b.label = 2;
74
+ case 2: return [2 /*return*/, {
75
+ response: requestResponse.slice(offset, offset + max),
76
+ total: requestResponse.length,
77
+ originalResponse: requestResponse
78
+ }];
79
+ }
80
+ });
81
+ }); };
82
+ };
@@ -11,3 +11,5 @@ export { useSavedState } from './useSavedState';
11
11
  export { useUsers } from './useUsers';
12
12
  export { useWhyDidYouUpdate } from './useWhyDidYouUpdate';
13
13
  export { useConfigPermissions } from './useConfigPermissions';
14
+ export { useMatchesLoader } from './useMatchesLoader';
15
+ export { usePagingSimulator } from './usePagingSimulator';
@@ -11,3 +11,5 @@ export { useSavedState } from './useSavedState';
11
11
  export { useUsers } from './useUsers';
12
12
  export { useWhyDidYouUpdate } from './useWhyDidYouUpdate';
13
13
  export { useConfigPermissions } from './useConfigPermissions';
14
+ export { useMatchesLoader } from './useMatchesLoader';
15
+ export { usePagingSimulator } from './usePagingSimulator';
@@ -0,0 +1,27 @@
1
+ import { Entity, PotentialMatch } from '@reltio/mdm-sdk';
2
+ declare type Props = {
3
+ enabled: boolean;
4
+ entity: Entity;
5
+ filter: string;
6
+ onFinishLoading?: () => void;
7
+ onStartLoading?: () => void;
8
+ options: {
9
+ showTransitiveMatches?: boolean;
10
+ showInactiveEntities?: boolean;
11
+ };
12
+ page: number;
13
+ rowsPerPage: number;
14
+ sorting?: {
15
+ order: string;
16
+ field: string;
17
+ };
18
+ };
19
+ export declare const useMatchesLoader: ({ enabled, entity, filter, onFinishLoading, onStartLoading, options, page, rowsPerPage, sorting }: Props) => {
20
+ total: number;
21
+ matches: PotentialMatch[];
22
+ entitiesMap: {
23
+ [key: string]: Pick<Entity, "uri" | "type" | "label">;
24
+ };
25
+ loadMatches: () => void;
26
+ };
27
+ export {};