@reltio/components 1.4.1654 → 1.4.1656

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 (39) hide show
  1. package/cjs/components/AttributesErrorsPanel/AttributesErrorsPanel.d.ts +7 -0
  2. package/cjs/components/AttributesErrorsPanel/AttributesErrorsPanel.js +84 -0
  3. package/cjs/components/AttributesErrorsPanel/ErrorsPanel/Error.d.ts +7 -0
  4. package/cjs/components/AttributesErrorsPanel/ErrorsPanel/Error.js +55 -0
  5. package/cjs/components/AttributesErrorsPanel/ErrorsPanel/ErrorsPanel.d.ts +17 -0
  6. package/cjs/components/AttributesErrorsPanel/ErrorsPanel/ErrorsPanel.js +55 -0
  7. package/cjs/components/AttributesErrorsPanel/ErrorsPanel/helpers.d.ts +5 -0
  8. package/cjs/components/AttributesErrorsPanel/ErrorsPanel/helpers.js +44 -0
  9. package/cjs/components/AttributesErrorsPanel/styles.d.ts +2 -0
  10. package/cjs/components/AttributesErrorsPanel/styles.js +99 -0
  11. package/cjs/components/AttributesErrorsPanel/useCachedErrors.d.ts +1 -0
  12. package/cjs/components/AttributesErrorsPanel/useCachedErrors.js +14 -0
  13. package/cjs/components/index.d.ts +1 -0
  14. package/cjs/components/index.js +5 -3
  15. package/cjs/components/workflow/components/WorkflowComments/WorkflowComments.js +14 -2
  16. package/cjs/components/workflow/components/WorkflowComments/styles.d.ts +1 -1
  17. package/cjs/components/workflow/components/WorkflowComments/styles.js +5 -1
  18. package/cjs/icons/Hyperlink.d.ts +3 -0
  19. package/cjs/icons/Hyperlink.js +22 -0
  20. package/esm/components/AttributesErrorsPanel/AttributesErrorsPanel.d.ts +7 -0
  21. package/esm/components/AttributesErrorsPanel/AttributesErrorsPanel.js +54 -0
  22. package/esm/components/AttributesErrorsPanel/ErrorsPanel/Error.d.ts +7 -0
  23. package/esm/components/AttributesErrorsPanel/ErrorsPanel/Error.js +26 -0
  24. package/esm/components/AttributesErrorsPanel/ErrorsPanel/ErrorsPanel.d.ts +17 -0
  25. package/esm/components/AttributesErrorsPanel/ErrorsPanel/ErrorsPanel.js +26 -0
  26. package/esm/components/AttributesErrorsPanel/ErrorsPanel/helpers.d.ts +5 -0
  27. package/esm/components/AttributesErrorsPanel/ErrorsPanel/helpers.js +34 -0
  28. package/esm/components/AttributesErrorsPanel/styles.d.ts +2 -0
  29. package/esm/components/AttributesErrorsPanel/styles.js +97 -0
  30. package/esm/components/AttributesErrorsPanel/useCachedErrors.d.ts +1 -0
  31. package/esm/components/AttributesErrorsPanel/useCachedErrors.js +10 -0
  32. package/esm/components/index.d.ts +1 -0
  33. package/esm/components/index.js +1 -0
  34. package/esm/components/workflow/components/WorkflowComments/WorkflowComments.js +15 -3
  35. package/esm/components/workflow/components/WorkflowComments/styles.d.ts +1 -1
  36. package/esm/components/workflow/components/WorkflowComments/styles.js +5 -1
  37. package/esm/icons/Hyperlink.d.ts +3 -0
  38. package/esm/icons/Hyperlink.js +17 -0
  39. package/package.json +2 -2
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { AttributeError } from '@reltio/mdm-sdk';
3
+ type Props = {
4
+ attributesWithErrors?: AttributeError[];
5
+ };
6
+ export declare const AttributesErrorsPanel: ({ attributesWithErrors }: Props) => JSX.Element;
7
+ export {};
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.AttributesErrorsPanel = void 0;
30
+ var react_1 = __importStar(require("react"));
31
+ var classnames_1 = __importDefault(require("classnames"));
32
+ var ui_i18n_1 = __importDefault(require("ui-i18n"));
33
+ var ramda_1 = require("ramda");
34
+ var Warning_1 = __importDefault(require("@mui/icons-material/Warning"));
35
+ var Error_1 = __importDefault(require("@mui/icons-material/Error"));
36
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
37
+ var useCachedErrors_1 = require("./useCachedErrors");
38
+ var ErrorsPanel_1 = require("./ErrorsPanel/ErrorsPanel");
39
+ var Error_2 = require("./ErrorsPanel/Error");
40
+ var styles_1 = __importDefault(require("./styles"));
41
+ var AttributesErrorsPanel = function (_a) {
42
+ var _b = _a.attributesWithErrors, attributesWithErrors = _b === void 0 ? [] : _b;
43
+ var styles = (0, styles_1.default)();
44
+ var cachedErrors = (0, useCachedErrors_1.useCachedErrors)(attributesWithErrors);
45
+ var _c = (0, react_1.useMemo)(function () { return (0, ramda_1.partition)(mdm_sdk_1.isCriticalError, cachedErrors); }, [cachedErrors]), errors = _c[0], warnings = _c[1];
46
+ var _d = (0, react_1.useState)(null), expandedPanelId = _d[0], setExpandedPanelId = _d[1];
47
+ var panels = (0, react_1.useMemo)(function () {
48
+ return [
49
+ {
50
+ id: 'errors',
51
+ title: ui_i18n_1.default.text('${number} ${errors}', {
52
+ number: errors.length,
53
+ errors: errors.length === 1 ? ui_i18n_1.default.text('error') : ui_i18n_1.default.text('errors')
54
+ }),
55
+ icon: react_1.default.createElement(Warning_1.default, { className: (0, classnames_1.default)(styles.icon, styles.errorIcon) }),
56
+ items: errors,
57
+ accordionClassName: styles.errorsAccordion,
58
+ accordionDetailsClassName: styles.errorsAccordionDetails
59
+ },
60
+ {
61
+ id: 'warnings',
62
+ title: ui_i18n_1.default.text('${number} ${warnings}', {
63
+ number: warnings.length,
64
+ warnings: warnings.length === 1 ? ui_i18n_1.default.text('warning') : ui_i18n_1.default.text('warnings')
65
+ }),
66
+ icon: react_1.default.createElement(Error_1.default, { className: (0, classnames_1.default)(styles.icon, styles.warningIcon) }),
67
+ items: warnings,
68
+ accordionClassName: styles.warningsAccordion,
69
+ accordionDetailsClassName: styles.warningsAccordionDetails
70
+ }
71
+ ].filter(function (_a) {
72
+ var items = _a.items;
73
+ return items.length > 0;
74
+ });
75
+ }, [errors, warnings, styles]);
76
+ (0, react_1.useEffect)(function () {
77
+ setExpandedPanelId('errors');
78
+ }, [errors]);
79
+ var handleChange = (0, react_1.useCallback)(function (panelId) { return function (event, isExpanded) {
80
+ setExpandedPanelId(isExpanded ? panelId : null);
81
+ }; }, []);
82
+ return panels.length > 0 ? (react_1.default.createElement(ErrorsPanel_1.ErrorsPanel, { panels: panels, expandedPanelId: expandedPanelId, onToggle: handleChange, ErrorComponent: Error_2.Error })) : null;
83
+ };
84
+ exports.AttributesErrorsPanel = AttributesErrorsPanel;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { AttributeError } from '@reltio/mdm-sdk';
3
+ type Props = {
4
+ error: AttributeError;
5
+ };
6
+ export declare const Error: React.MemoExoticComponent<({ error }: Props) => JSX.Element>;
7
+ export {};
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.Error = void 0;
30
+ var react_1 = __importStar(require("react"));
31
+ var ui_i18n_1 = __importDefault(require("ui-i18n"));
32
+ var Hyperlink_1 = __importDefault(require("../../../icons/Hyperlink"));
33
+ var SmallIconButton_1 = require("../../SmallIconButton");
34
+ var contexts_1 = require("../../../contexts");
35
+ var helpers_1 = require("./helpers");
36
+ var styles_1 = __importDefault(require("../styles"));
37
+ exports.Error = (0, react_1.memo)(function (_a) {
38
+ var error = _a.error;
39
+ var styles = (0, styles_1.default)();
40
+ var metadata = (0, contexts_1.useMdmMetadata)();
41
+ var isEditableMode = (0, contexts_1.useMdmIsEditableMode)();
42
+ var displayedMessage = (0, helpers_1.getDisplayedErrorMessage)(metadata, error);
43
+ var displayedErrorPath = (0, helpers_1.getDisplayedErrorPath)(error);
44
+ var displayedAttributeTypesPath = (0, helpers_1.getDisplayedAttributeTypesPath)(error);
45
+ var highlightError = (0, react_1.useContext)(contexts_1.ScrollToElementContext).highlightError;
46
+ var showLink = error.uri || (error.parentUri && error.attributeTypeUri);
47
+ return (react_1.default.createElement("li", null,
48
+ react_1.default.createElement("div", { className: styles.errorWrapper },
49
+ displayedAttributeTypesPath && (react_1.default.createElement("span", { className: styles.attributeTypesPath }, displayedAttributeTypesPath)),
50
+ react_1.default.createElement("span", { className: styles.errorTitle },
51
+ displayedMessage,
52
+ showLink && isEditableMode && (react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, { icon: Hyperlink_1.default, size: "XXS", onClick: function () { return highlightError(error); }, tooltipTitle: ui_i18n_1.default.text('Go to error'), className: styles.goToIcon }))),
53
+ displayedErrorPath && react_1.default.createElement("span", { className: styles.parents }, displayedErrorPath))));
54
+ });
55
+ exports.Error.displayName = 'Error';
@@ -0,0 +1,17 @@
1
+ import React, { ReactNode, ElementType } from 'react';
2
+ import { AttributeError } from '@reltio/mdm-sdk';
3
+ type Props = {
4
+ panels: {
5
+ id: string;
6
+ title: string;
7
+ icon: ReactNode;
8
+ items: AttributeError[];
9
+ accordionClassName: string;
10
+ accordionDetailsClassName: string;
11
+ }[];
12
+ expandedPanelId: string;
13
+ onToggle: (id: string) => (e: any, isExpanded: boolean) => void;
14
+ ErrorComponent: ElementType;
15
+ };
16
+ export declare const ErrorsPanel: React.MemoExoticComponent<({ panels, expandedPanelId, onToggle, ErrorComponent }: Props) => JSX.Element>;
17
+ export {};
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ErrorsPanel = void 0;
30
+ var react_1 = __importStar(require("react"));
31
+ var classnames_1 = __importDefault(require("classnames"));
32
+ var Accordion_1 = __importDefault(require("@mui/material/Accordion"));
33
+ var AccordionSummary_1 = __importDefault(require("@mui/material/AccordionSummary"));
34
+ var AccordionDetails_1 = __importDefault(require("@mui/material/AccordionDetails"));
35
+ var ExpandMore_1 = __importDefault(require("@mui/icons-material/ExpandMore"));
36
+ var Typography_1 = __importDefault(require("@mui/material/Typography"));
37
+ var styles_1 = __importDefault(require("../styles"));
38
+ exports.ErrorsPanel = (0, react_1.memo)(function (_a) {
39
+ var panels = _a.panels, expandedPanelId = _a.expandedPanelId, onToggle = _a.onToggle, ErrorComponent = _a.ErrorComponent;
40
+ var styles = (0, styles_1.default)();
41
+ return panels.length > 0 ? (react_1.default.createElement("div", null, panels.map(function (_a) {
42
+ var id = _a.id, icon = _a.icon, title = _a.title, items = _a.items, accordionClassName = _a.accordionClassName, accordionDetailsClassName = _a.accordionDetailsClassName;
43
+ return (react_1.default.createElement(Accordion_1.default, { key: id, square: true, expanded: expandedPanelId === id, onChange: onToggle(id), className: accordionClassName, classes: { root: styles.accordion, expanded: styles.accordionExpanded } },
44
+ react_1.default.createElement(AccordionSummary_1.default, { classes: {
45
+ root: styles.accordionSummary,
46
+ expanded: styles.accordionSummaryExpanded,
47
+ content: styles.accordionSummaryContent
48
+ }, expandIcon: react_1.default.createElement(ExpandMore_1.default, null) },
49
+ icon,
50
+ react_1.default.createElement(Typography_1.default, { className: styles.accordionSummaryHeading }, title)),
51
+ react_1.default.createElement(AccordionDetails_1.default, { className: (0, classnames_1.default)(styles.accordionDetails, accordionDetailsClassName) },
52
+ react_1.default.createElement("ul", null, items.map(function (error, i) { return (react_1.default.createElement(ErrorComponent, { key: i, error: error })); })))));
53
+ }))) : null;
54
+ });
55
+ exports.ErrorsPanel.displayName = 'ErrorsPanel';
@@ -0,0 +1,5 @@
1
+ import { AttributeError, Metadata } from '@reltio/mdm-sdk';
2
+ export declare const areErrorsEqual: (errors1?: AttributeError[], errors2?: AttributeError[]) => any;
3
+ export declare const getDisplayedErrorMessage: (metadata: Metadata, { type, source, message, attributeTypeUri, attributeType }: AttributeError) => string;
4
+ export declare const getDisplayedErrorPath: ({ path: errorPath, uri }: AttributeError) => string;
5
+ export declare const getDisplayedAttributeTypesPath: ({ path: errorPath }: AttributeError) => string;
@@ -0,0 +1,44 @@
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.getDisplayedAttributeTypesPath = exports.getDisplayedErrorPath = exports.getDisplayedErrorMessage = exports.areErrorsEqual = void 0;
7
+ var ramda_1 = require("ramda");
8
+ var ui_i18n_1 = __importDefault(require("ui-i18n"));
9
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
10
+ var clearError = (0, ramda_1.omit)(['deactivated', 'path']);
11
+ var areErrorsEqual = function (errors1, errors2) {
12
+ if (errors1 === void 0) { errors1 = []; }
13
+ if (errors2 === void 0) { errors2 = []; }
14
+ return errors1.length === errors2.length && (0, ramda_1.equals)(errors1.map(clearError), errors2.map(clearError));
15
+ };
16
+ exports.areErrorsEqual = areErrorsEqual;
17
+ var getDisplayedErrorMessage = function (metadata, _a) {
18
+ var type = _a.type, source = _a.source, message = _a.message, _b = _a.attributeTypeUri, attributeTypeUri = _b === void 0 ? '' : _b, attributeType = _a.attributeType;
19
+ if (type === mdm_sdk_1.ErrorType.missed && source === mdm_sdk_1.ErrorSource.local) {
20
+ var attrType = attributeType || (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, attributeTypeUri);
21
+ return attrType ? ui_i18n_1.default.text('${attribute} is required', { attribute: attrType.label }) : message;
22
+ }
23
+ return message;
24
+ };
25
+ exports.getDisplayedErrorMessage = getDisplayedErrorMessage;
26
+ var getDisplayedErrorPath = function (_a) {
27
+ var errorPath = _a.path, uri = _a.uri;
28
+ return errorPath === null || errorPath === void 0 ? void 0 : errorPath.slice(0, uri ? errorPath.length - 1 : errorPath.length).filter(function (_a) {
29
+ var type = _a.type;
30
+ return [mdm_sdk_1.AttributeValuePathItemType.attributeValue, mdm_sdk_1.AttributeValuePathItemType.relationConnection].includes(type);
31
+ }).map(function (_a) {
32
+ var label = _a.label;
33
+ return label;
34
+ }).filter(ramda_1.identity).join(' / ');
35
+ };
36
+ exports.getDisplayedErrorPath = getDisplayedErrorPath;
37
+ var getDisplayedAttributeTypesPath = function (_a) {
38
+ var errorPath = _a.path;
39
+ return errorPath === null || errorPath === void 0 ? void 0 : errorPath.filter(function (_a) {
40
+ var type = _a.type;
41
+ return type === mdm_sdk_1.AttributeValuePathItemType.attributeValue;
42
+ }).map((0, ramda_1.either)((0, ramda_1.path)(['valueType', 'label']), (0, ramda_1.path)(['valueType', 'name']))).filter(ramda_1.identity).join(' > ');
43
+ };
44
+ exports.getDisplayedAttributeTypesPath = getDisplayedAttributeTypesPath;
@@ -0,0 +1,2 @@
1
+ declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"icon" | "parents" | "errorWrapper" | "accordion" | "accordionExpanded" | "accordionSummary" | "accordionSummaryHeading" | "accordionSummaryExpanded" | "accordionSummaryContent" | "accordionDetails" | "errorTitle" | "attributeTypesPath" | "goToIcon" | "errorsAccordion" | "errorsAccordionDetails" | "warningsAccordion" | "warningsAccordionDetails" | "errorIcon" | "warningIcon">;
2
+ export default useStyles;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var styles_1 = require("@mui/styles");
4
+ var accordionSummaryHeight = '48px';
5
+ var defaultBorderStyle = '1px solid rgba(0, 0, 0, .125)';
6
+ var useStyles = (0, styles_1.makeStyles)(function (theme) { return ({
7
+ accordion: {
8
+ borderTop: defaultBorderStyle,
9
+ borderBottom: defaultBorderStyle,
10
+ fontSize: '13px',
11
+ boxShadow: 'none',
12
+ '&:not(:first-child)': {
13
+ borderTop: 0
14
+ },
15
+ '&:before': {
16
+ display: 'none'
17
+ },
18
+ '&$accordionExpanded': {
19
+ margin: 'auto'
20
+ }
21
+ },
22
+ accordionExpanded: {},
23
+ accordionSummary: {
24
+ display: 'flex',
25
+ alignItems: 'center',
26
+ height: accordionSummaryHeight,
27
+ minHeight: accordionSummaryHeight,
28
+ '&$accordionSummaryExpanded': {
29
+ height: accordionSummaryHeight,
30
+ minHeight: accordionSummaryHeight
31
+ }
32
+ },
33
+ accordionSummaryHeading: {
34
+ flex: 1,
35
+ fontSize: theme.typography.pxToRem(13),
36
+ fontWeight: theme.typography.fontWeightRegular
37
+ },
38
+ accordionSummaryExpanded: {},
39
+ accordionSummaryContent: {
40
+ display: 'flex',
41
+ alignItems: 'center'
42
+ },
43
+ accordionDetails: {
44
+ maxHeight: '21vh',
45
+ overflow: 'auto',
46
+ paddingTop: 0,
47
+ paddingBottom: 0,
48
+ '& ul': {
49
+ paddingLeft: '23px',
50
+ marginTop: '3px'
51
+ },
52
+ '& li': {
53
+ paddingLeft: '9px',
54
+ paddingBottom: '8px'
55
+ }
56
+ },
57
+ parents: {
58
+ color: theme.palette.text.primary
59
+ },
60
+ errorWrapper: {
61
+ lineHeight: '18px',
62
+ display: 'flex',
63
+ flexDirection: 'column'
64
+ },
65
+ errorTitle: {
66
+ display: 'flex',
67
+ alignItems: 'center'
68
+ },
69
+ attributeTypesPath: {
70
+ color: theme.palette.text.secondary
71
+ },
72
+ goToIcon: {
73
+ marginLeft: '4px'
74
+ },
75
+ errorsAccordion: {
76
+ backgroundColor: '#FFF4F6',
77
+ borderColor: '#FFB8B3'
78
+ },
79
+ errorsAccordionDetails: {
80
+ color: '#DD2C00'
81
+ },
82
+ warningsAccordion: {
83
+ backgroundColor: '#FFF9ED',
84
+ borderColor: '#FFDD91'
85
+ },
86
+ warningsAccordionDetails: {
87
+ color: '#CC7500'
88
+ },
89
+ icon: {
90
+ marginRight: '8px'
91
+ },
92
+ errorIcon: {
93
+ fill: '#FF1744'
94
+ },
95
+ warningIcon: {
96
+ fill: '#F9A825'
97
+ }
98
+ }); });
99
+ exports.default = useStyles;
@@ -0,0 +1 @@
1
+ export declare const useCachedErrors: (allErrors: any) => any;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCachedErrors = void 0;
4
+ var react_1 = require("react");
5
+ var helpers_1 = require("./ErrorsPanel/helpers");
6
+ var useCachedErrors = function (allErrors) {
7
+ var cacheForAllErrors = (0, react_1.useRef)(allErrors);
8
+ var areEqualErrors = (0, helpers_1.areErrorsEqual)(allErrors, cacheForAllErrors.current);
9
+ if (!areEqualErrors) {
10
+ cacheForAllErrors.current = allErrors;
11
+ }
12
+ return cacheForAllErrors.current;
13
+ };
14
+ exports.useCachedErrors = useCachedErrors;
@@ -57,6 +57,7 @@ export { EntityTypesSelector } from './EntityTypesSelector/EntityTypesSelector';
57
57
  export { RelationTypesSelector } from './RelationTypesSelector/RelationTypesSelector';
58
58
  export { default as EntityUriLink } from './EntityUriLink/EntityUriLink';
59
59
  export { default as ErrorBoundary } from './ErrorBoundary/ErrorBoundary';
60
+ export { AttributesErrorsPanel } from './AttributesErrorsPanel/AttributesErrorsPanel';
60
61
  export { default as ErrorPopup } from './ErrorPopup/ErrorPopup';
61
62
  export { default as ErrorWrapper } from './ErrorWrapper/ErrorWrapper';
62
63
  export { default as ExpandedValueTooltip } from './ExpandedValueTooltip/ExpandedValueTooltip';
@@ -18,9 +18,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.EmptyState = exports.NoResults = exports.NoData = exports.DropDownSelector = exports.DropDownMenuButton = exports.Drawer = exports.DataTypeValue = exports.ConnectionRelationTypeSelector = exports.ConfigureColumnsPopup = exports.MenuWithPopper = exports.MenuList = exports.LoadMoreButton = exports.DropdownIndicatorWithIconButton = exports.DropdownIndicator = exports.CommentsContainer = exports.ColorBar = exports.CollapseButton = exports.CollaborationItem = exports.ClickAwayProvider = exports.BasicViewHeader = exports.BasicViewContent = exports.BasicView = exports.ScreenProfileBand = exports.ProfileBandNavigation = exports.AvatarWithFallback = exports.AutoSizeList = exports.ReadOnlyAttributesPager = exports.SimpleAttribute = exports.ReferenceAttribute = exports.NestedAttribute = exports.EditableImageAttributesLine = exports.ImageAttributesLine = exports.ReadOnlyAttributesList = exports.ReadOnlyAttributeValuesBlock = exports.EditableAttribute = exports.ReadOnlyAttribute = exports.CardinalityMessage = exports.AttributesPager = exports.SimpleAttributeEditor = exports.RelationTypeSelector = exports.ReferenceAttributeEditor = exports.NestedAttributeEditor = exports.MoreAttributesButton = exports.EntitySelector = exports.EntityCreator = exports.AttributesList = exports.BranchDecorator = exports.DescriptionIcon = exports.AttributesView = exports.AttributeListItem = void 0;
21
- exports.SelectionPopupPopper = exports.SelectionPopup = exports.useKeyboardNavigation = exports.WhiteSearchInput = exports.SearchInput = exports.ProfileResizablePanes = exports.ResizablePanes = exports.ReltioGridLayout = exports.ReactSortableTreeUtils = exports.ReactSortableTreeHandlers = exports.ReactSortableTree = exports.ReactSelectOptionFilters = exports.MultiSelect = exports.QueryBuilderRowsGroup = exports.QueryBuilderRow = exports.ProfileCard = exports.ProfileBand = exports.PotentialMatchReviewCard = exports.PopupWithArrow = exports.Popper = exports.MultipleInput = exports.ModeSwitcherSelect = exports.ModeSwitcher = exports.TransitiveMatchBlock = exports.SimpleMatchRulesBlock = exports.MatchRuleVariant = exports.MatchRulesBlock = exports.LoadingSpinner = exports.Link = exports.LinearLoadIndicator = exports.ImportModes = exports.ImportButton = exports.ImageGalleryDialog = exports.Highlighter = exports.HierarchicalAttributeTooltip = exports.HideOnShrink = exports.FlipCard = exports.FacetViewHeader = exports.ExpandedValueTooltip = exports.ErrorWrapper = exports.ErrorPopup = exports.ErrorBoundary = exports.EntityUriLink = exports.RelationTypesSelector = exports.EntityTypesSelector = exports.EntityTypeIcon = exports.EntityTypeBadge = exports.EntityAvatar = exports.EMPTY_STATE_VARIANTS = exports.EMPTY_STATE_ICONS = void 0;
22
- exports.MultilineMenuItem = exports.RelevanceScoreBadge = exports.RequiredMark = exports.HierarchyNodeTitle = exports.DataTenantBadge = exports.SettingsMenu = exports.TenantsDropDownSelector = exports.TenantIcon = exports.SourceSystemsSelector = exports.MatchRulesSelector = exports.MultiValueSelector = exports.DragAndDrop = exports.ConnectionEditor = exports.AttributesFiltersBuilder = exports.AttributesFiltersButton = exports.AttributeGroupIcon = exports.BasicAttributeSelector = exports.ProfilesList = exports.ActionButtonMode = exports.ActionButton = exports.NotMatchButton = exports.MergeButton = exports.ProfileMatchCard = exports.RelationEditor = exports.OvIcon = exports.ErrorMessage = exports.ReltioMap = exports.ConfirmDeleteDialog = exports.ConfirmationDialog = exports.Marginator = exports.LightArrowTooltip = exports.ArrowExpandButton = exports.ScrollableTabs = exports.ExpandableSearchInput = exports.VirtualGroupedList = exports.ViewMoreToggle = exports.VerticalHeadingsTable = exports.VerticalDivider = exports.AttributeTitle = exports.Spacer = exports.ColoredSourceIcon = exports.SourceIcon = exports.SmallIconButtonWithTooltip = exports.SmallIconButton = exports.SimpleDropDownSelector = exports.SidePanelContentHeader = exports.SidePanel = exports.SidePanelEmptyState = exports.SideButtonsPanel = exports.SelectorWithOnlyOptionAutoSelect = void 0;
23
- exports.StepNavigation = exports.TenantLabel = void 0;
21
+ exports.SelectionPopup = exports.useKeyboardNavigation = exports.WhiteSearchInput = exports.SearchInput = exports.ProfileResizablePanes = exports.ResizablePanes = exports.ReltioGridLayout = exports.ReactSortableTreeUtils = exports.ReactSortableTreeHandlers = exports.ReactSortableTree = exports.ReactSelectOptionFilters = exports.MultiSelect = exports.QueryBuilderRowsGroup = exports.QueryBuilderRow = exports.ProfileCard = exports.ProfileBand = exports.PotentialMatchReviewCard = exports.PopupWithArrow = exports.Popper = exports.MultipleInput = exports.ModeSwitcherSelect = exports.ModeSwitcher = exports.TransitiveMatchBlock = exports.SimpleMatchRulesBlock = exports.MatchRuleVariant = exports.MatchRulesBlock = exports.LoadingSpinner = exports.Link = exports.LinearLoadIndicator = exports.ImportModes = exports.ImportButton = exports.ImageGalleryDialog = exports.Highlighter = exports.HierarchicalAttributeTooltip = exports.HideOnShrink = exports.FlipCard = exports.FacetViewHeader = exports.ExpandedValueTooltip = exports.ErrorWrapper = exports.ErrorPopup = exports.AttributesErrorsPanel = exports.ErrorBoundary = exports.EntityUriLink = exports.RelationTypesSelector = exports.EntityTypesSelector = exports.EntityTypeIcon = exports.EntityTypeBadge = exports.EntityAvatar = exports.EMPTY_STATE_VARIANTS = exports.EMPTY_STATE_ICONS = void 0;
22
+ exports.RelevanceScoreBadge = exports.RequiredMark = exports.HierarchyNodeTitle = exports.DataTenantBadge = exports.SettingsMenu = exports.TenantsDropDownSelector = exports.TenantIcon = exports.SourceSystemsSelector = exports.MatchRulesSelector = exports.MultiValueSelector = exports.DragAndDrop = exports.ConnectionEditor = exports.AttributesFiltersBuilder = exports.AttributesFiltersButton = exports.AttributeGroupIcon = exports.BasicAttributeSelector = exports.ProfilesList = exports.ActionButtonMode = exports.ActionButton = exports.NotMatchButton = exports.MergeButton = exports.ProfileMatchCard = exports.RelationEditor = exports.OvIcon = exports.ErrorMessage = exports.ReltioMap = exports.ConfirmDeleteDialog = exports.ConfirmationDialog = exports.Marginator = exports.LightArrowTooltip = exports.ArrowExpandButton = exports.ScrollableTabs = exports.ExpandableSearchInput = exports.VirtualGroupedList = exports.ViewMoreToggle = exports.VerticalHeadingsTable = exports.VerticalDivider = exports.AttributeTitle = exports.Spacer = exports.ColoredSourceIcon = exports.SourceIcon = exports.SmallIconButtonWithTooltip = exports.SmallIconButton = exports.SimpleDropDownSelector = exports.SidePanelContentHeader = exports.SidePanel = exports.SidePanelEmptyState = exports.SideButtonsPanel = exports.SelectorWithOnlyOptionAutoSelect = exports.SelectionPopupPopper = void 0;
23
+ exports.StepNavigation = exports.TenantLabel = exports.MultilineMenuItem = void 0;
24
24
  __exportStar(require("./activityLog"), exports);
25
25
  var AttributeListItem_1 = require("./AttributeListItem/AttributeListItem");
26
26
  Object.defineProperty(exports, "AttributeListItem", { enumerable: true, get: function () { return __importDefault(AttributeListItem_1).default; } });
@@ -139,6 +139,8 @@ var EntityUriLink_1 = require("./EntityUriLink/EntityUriLink");
139
139
  Object.defineProperty(exports, "EntityUriLink", { enumerable: true, get: function () { return __importDefault(EntityUriLink_1).default; } });
140
140
  var ErrorBoundary_1 = require("./ErrorBoundary/ErrorBoundary");
141
141
  Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return __importDefault(ErrorBoundary_1).default; } });
142
+ var AttributesErrorsPanel_1 = require("./AttributesErrorsPanel/AttributesErrorsPanel");
143
+ Object.defineProperty(exports, "AttributesErrorsPanel", { enumerable: true, get: function () { return AttributesErrorsPanel_1.AttributesErrorsPanel; } });
142
144
  var ErrorPopup_1 = require("./ErrorPopup/ErrorPopup");
143
145
  Object.defineProperty(exports, "ErrorPopup", { enumerable: true, get: function () { return __importDefault(ErrorPopup_1).default; } });
144
146
  var ErrorWrapper_1 = require("./ErrorWrapper/ErrorWrapper");
@@ -66,6 +66,18 @@ var WorkflowComments = function (_a) {
66
66
  setComment('');
67
67
  }, [comment, writeComment]);
68
68
  var onChange = (0, ramda_1.pipe)(getValue, setComment);
69
+ var onKeyPressHandler = function (e) {
70
+ if (e.key === 'Enter') {
71
+ if (comment.length > 0 && !e.shiftKey) {
72
+ e.preventDefault();
73
+ sendComment();
74
+ }
75
+ if (comment.length > 0 && e.shiftKey) {
76
+ return;
77
+ }
78
+ e.preventDefault();
79
+ }
80
+ };
69
81
  var BUTTONS_GROUP = (0, react_1.useMemo)(function () { return __spreadArray([], actions.map(function (_a) {
70
82
  var text = _a.text, onClick = _a.onClick;
71
83
  return ({
@@ -83,8 +95,8 @@ var WorkflowComments = function (_a) {
83
95
  ui_i18n_1.default.text('Comments'),
84
96
  " "),
85
97
  react_1.default.createElement("div", { className: styles.commentsContainer }, expanded || comments.length < 3 ? (react_1.default.createElement(ExpandedComments_1.ExpandedComments, { comments: comments })) : (react_1.default.createElement(CollapsedComments_1.CollapsedComments, { onClick: function () { return setExpanded(true); }, comments: comments }))),
86
- !readOnly && (react_1.default.createElement(Input_1.default, { endAdornment: react_1.default.createElement(InputAdornment_1.default, { position: "end" },
87
- react_1.default.createElement(SmallIconButton_1.SmallIconButton, { icon: Send_1.default, disabled: comment.length === 0, onClick: sendComment, "data-reltio-id": "send-button" })), classes: { root: styles.filledInputRoot }, placeholder: ui_i18n_1.default.text('Write a comment'), value: comment, onKeyPress: (0, ramda_1.when)((0, ramda_1.allPass)([(0, ramda_1.propEq)('key', 'Enter'), (0, ramda_1.always)(comment.length > 0), (0, ramda_1.propEq)('shiftKey', false)]), sendComment), onChange: onChange, disableUnderline: true, multiline: true })),
98
+ !readOnly && (react_1.default.createElement(Input_1.default, { endAdornment: react_1.default.createElement(InputAdornment_1.default, { position: "end", className: styles.sendButton },
99
+ react_1.default.createElement(SmallIconButton_1.SmallIconButton, { icon: Send_1.default, disabled: comment.length === 0, onClick: sendComment, "data-reltio-id": "send-button" })), classes: { root: styles.filledInputRoot }, placeholder: ui_i18n_1.default.text('Write a comment'), value: comment, onKeyPress: onKeyPressHandler, onChange: onChange, disableUnderline: true, multiline: true })),
88
100
  react_1.default.createElement("div", { className: styles.modeSwitcherWrapper },
89
101
  BUTTONS_GROUP.length === 1 && (react_1.default.createElement(Button_1.default, { variant: "outlined", onClick: BUTTONS_GROUP[0].onClick, disabled: actionRequestIsInProgress }, BUTTONS_GROUP[0].label)),
90
102
  BUTTONS_GROUP.length > 1 && (react_1.default.createElement(ModeSwitcherSelect_1.ModeSwitcherSelect, { buttonsGroup: BUTTONS_GROUP, value: currentAction, disabled: actionRequestIsInProgress })))));
@@ -1,4 +1,4 @@
1
1
  export declare const useCommentStyles: (props?: any) => import("@mui/styles").ClassNameMap<"date" | "icon" | "comment" | "text" | "info" | "avatar" | "firstLine" | "author">;
2
2
  export declare const useCollapsedCommentsStyles: (props?: any) => import("@mui/styles").ClassNameMap<"delimiter" | "circleButton">;
3
- export declare const useWorkflowStyles: (props?: any) => import("@mui/styles").ClassNameMap<"title" | "container" | "commentsContainer" | "filledInputRoot" | "modeSwitcherWrapper">;
3
+ export declare const useWorkflowStyles: (props?: any) => import("@mui/styles").ClassNameMap<"title" | "container" | "commentsContainer" | "filledInputRoot" | "modeSwitcherWrapper" | "sendButton">;
4
4
  export declare const useExpandedComments: (props?: any) => import("@mui/styles").ClassNameMap<"messageContainer">;
@@ -90,7 +90,7 @@ exports.useWorkflowStyles = (0, styles_1.makeStyles)(function (_theme) { return
90
90
  },
91
91
  filledInputRoot: {
92
92
  backgroundColor: 'rgba(0, 0, 0, 0.03)',
93
- padding: '0 6px',
93
+ padding: '10px 6px',
94
94
  minHeight: '40px',
95
95
  margin: '10px 17px 0 6px',
96
96
  fontSize: '14px',
@@ -105,6 +105,10 @@ exports.useWorkflowStyles = (0, styles_1.makeStyles)(function (_theme) { return
105
105
  marginLeft: 'auto',
106
106
  marginRight: '16px',
107
107
  marginTop: '8px'
108
+ },
109
+ sendButton: {
110
+ alignSelf: 'end',
111
+ marginBottom: '10px'
108
112
  }
109
113
  }); });
110
114
  exports.useExpandedComments = (0, styles_1.makeStyles)(function (_theme) { return ({
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const SvgHyperlink: React.FC<React.SVGProps<SVGSVGElement>>;
3
+ export default SvgHyperlink;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var react_1 = __importDefault(require("react"));
18
+ var SvgHyperlink = function (props) {
19
+ return (react_1.default.createElement("svg", __assign({ width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
20
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M14.245 12.75c0 .825-.467 1.5-1.045 1.5H4.8c-.583 0-1.05-.675-1.05-1.5v-7.5c0-.832.467-1.5 1.05-1.5h8.4c.578 0 1.05.668 1.05 1.5l-.005 7.5zM9.75 9.96v1.642l3-2.805L9.75 6v1.598c-2.918.404-4.08 2.4-4.5 4.402 1.043-1.402 2.415-2.04 4.5-2.04z", fill: "#000", fillOpacity: 0.54 })));
21
+ };
22
+ exports.default = SvgHyperlink;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { AttributeError } from '@reltio/mdm-sdk';
3
+ type Props = {
4
+ attributesWithErrors?: AttributeError[];
5
+ };
6
+ export declare const AttributesErrorsPanel: ({ attributesWithErrors }: Props) => JSX.Element;
7
+ export {};
@@ -0,0 +1,54 @@
1
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
+ import classnames from 'classnames';
3
+ import i18n from 'ui-i18n';
4
+ import { partition } from 'ramda';
5
+ import ErrorIcon from '@mui/icons-material/Warning';
6
+ import WarningIcon from '@mui/icons-material/Error';
7
+ import { isCriticalError } from '@reltio/mdm-sdk';
8
+ import { useCachedErrors } from './useCachedErrors';
9
+ import { ErrorsPanel } from './ErrorsPanel/ErrorsPanel';
10
+ import { Error } from './ErrorsPanel/Error';
11
+ import useStyles from './styles';
12
+ export var AttributesErrorsPanel = function (_a) {
13
+ var _b = _a.attributesWithErrors, attributesWithErrors = _b === void 0 ? [] : _b;
14
+ var styles = useStyles();
15
+ var cachedErrors = useCachedErrors(attributesWithErrors);
16
+ var _c = useMemo(function () { return partition(isCriticalError, cachedErrors); }, [cachedErrors]), errors = _c[0], warnings = _c[1];
17
+ var _d = useState(null), expandedPanelId = _d[0], setExpandedPanelId = _d[1];
18
+ var panels = useMemo(function () {
19
+ return [
20
+ {
21
+ id: 'errors',
22
+ title: i18n.text('${number} ${errors}', {
23
+ number: errors.length,
24
+ errors: errors.length === 1 ? i18n.text('error') : i18n.text('errors')
25
+ }),
26
+ icon: React.createElement(ErrorIcon, { className: classnames(styles.icon, styles.errorIcon) }),
27
+ items: errors,
28
+ accordionClassName: styles.errorsAccordion,
29
+ accordionDetailsClassName: styles.errorsAccordionDetails
30
+ },
31
+ {
32
+ id: 'warnings',
33
+ title: i18n.text('${number} ${warnings}', {
34
+ number: warnings.length,
35
+ warnings: warnings.length === 1 ? i18n.text('warning') : i18n.text('warnings')
36
+ }),
37
+ icon: React.createElement(WarningIcon, { className: classnames(styles.icon, styles.warningIcon) }),
38
+ items: warnings,
39
+ accordionClassName: styles.warningsAccordion,
40
+ accordionDetailsClassName: styles.warningsAccordionDetails
41
+ }
42
+ ].filter(function (_a) {
43
+ var items = _a.items;
44
+ return items.length > 0;
45
+ });
46
+ }, [errors, warnings, styles]);
47
+ useEffect(function () {
48
+ setExpandedPanelId('errors');
49
+ }, [errors]);
50
+ var handleChange = useCallback(function (panelId) { return function (event, isExpanded) {
51
+ setExpandedPanelId(isExpanded ? panelId : null);
52
+ }; }, []);
53
+ return panels.length > 0 ? (React.createElement(ErrorsPanel, { panels: panels, expandedPanelId: expandedPanelId, onToggle: handleChange, ErrorComponent: Error })) : null;
54
+ };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { AttributeError } from '@reltio/mdm-sdk';
3
+ type Props = {
4
+ error: AttributeError;
5
+ };
6
+ export declare const Error: React.MemoExoticComponent<({ error }: Props) => JSX.Element>;
7
+ export {};
@@ -0,0 +1,26 @@
1
+ import React, { memo, useContext } from 'react';
2
+ import i18n from 'ui-i18n';
3
+ import HyperlinkIcon from '../../../icons/Hyperlink';
4
+ import { SmallIconButtonWithTooltip } from '../../SmallIconButton';
5
+ import { ScrollToElementContext, useMdmIsEditableMode, useMdmMetadata } from '../../../contexts';
6
+ import { getDisplayedAttributeTypesPath, getDisplayedErrorMessage, getDisplayedErrorPath } from './helpers';
7
+ import useStyles from '../styles';
8
+ export var Error = memo(function (_a) {
9
+ var error = _a.error;
10
+ var styles = useStyles();
11
+ var metadata = useMdmMetadata();
12
+ var isEditableMode = useMdmIsEditableMode();
13
+ var displayedMessage = getDisplayedErrorMessage(metadata, error);
14
+ var displayedErrorPath = getDisplayedErrorPath(error);
15
+ var displayedAttributeTypesPath = getDisplayedAttributeTypesPath(error);
16
+ var highlightError = useContext(ScrollToElementContext).highlightError;
17
+ var showLink = error.uri || (error.parentUri && error.attributeTypeUri);
18
+ return (React.createElement("li", null,
19
+ React.createElement("div", { className: styles.errorWrapper },
20
+ displayedAttributeTypesPath && (React.createElement("span", { className: styles.attributeTypesPath }, displayedAttributeTypesPath)),
21
+ React.createElement("span", { className: styles.errorTitle },
22
+ displayedMessage,
23
+ showLink && isEditableMode && (React.createElement(SmallIconButtonWithTooltip, { icon: HyperlinkIcon, size: "XXS", onClick: function () { return highlightError(error); }, tooltipTitle: i18n.text('Go to error'), className: styles.goToIcon }))),
24
+ displayedErrorPath && React.createElement("span", { className: styles.parents }, displayedErrorPath))));
25
+ });
26
+ Error.displayName = 'Error';
@@ -0,0 +1,17 @@
1
+ import React, { ReactNode, ElementType } from 'react';
2
+ import { AttributeError } from '@reltio/mdm-sdk';
3
+ type Props = {
4
+ panels: {
5
+ id: string;
6
+ title: string;
7
+ icon: ReactNode;
8
+ items: AttributeError[];
9
+ accordionClassName: string;
10
+ accordionDetailsClassName: string;
11
+ }[];
12
+ expandedPanelId: string;
13
+ onToggle: (id: string) => (e: any, isExpanded: boolean) => void;
14
+ ErrorComponent: ElementType;
15
+ };
16
+ export declare const ErrorsPanel: React.MemoExoticComponent<({ panels, expandedPanelId, onToggle, ErrorComponent }: Props) => JSX.Element>;
17
+ export {};
@@ -0,0 +1,26 @@
1
+ import React, { memo } from 'react';
2
+ import classnames from 'classnames';
3
+ import Accordion from '@mui/material/Accordion';
4
+ import AccordionSummary from '@mui/material/AccordionSummary';
5
+ import AccordionDetails from '@mui/material/AccordionDetails';
6
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
7
+ import Typography from '@mui/material/Typography';
8
+ import useStyles from '../styles';
9
+ export var ErrorsPanel = memo(function (_a) {
10
+ var panels = _a.panels, expandedPanelId = _a.expandedPanelId, onToggle = _a.onToggle, ErrorComponent = _a.ErrorComponent;
11
+ var styles = useStyles();
12
+ return panels.length > 0 ? (React.createElement("div", null, panels.map(function (_a) {
13
+ var id = _a.id, icon = _a.icon, title = _a.title, items = _a.items, accordionClassName = _a.accordionClassName, accordionDetailsClassName = _a.accordionDetailsClassName;
14
+ return (React.createElement(Accordion, { key: id, square: true, expanded: expandedPanelId === id, onChange: onToggle(id), className: accordionClassName, classes: { root: styles.accordion, expanded: styles.accordionExpanded } },
15
+ React.createElement(AccordionSummary, { classes: {
16
+ root: styles.accordionSummary,
17
+ expanded: styles.accordionSummaryExpanded,
18
+ content: styles.accordionSummaryContent
19
+ }, expandIcon: React.createElement(ExpandMoreIcon, null) },
20
+ icon,
21
+ React.createElement(Typography, { className: styles.accordionSummaryHeading }, title)),
22
+ React.createElement(AccordionDetails, { className: classnames(styles.accordionDetails, accordionDetailsClassName) },
23
+ React.createElement("ul", null, items.map(function (error, i) { return (React.createElement(ErrorComponent, { key: i, error: error })); })))));
24
+ }))) : null;
25
+ });
26
+ ErrorsPanel.displayName = 'ErrorsPanel';
@@ -0,0 +1,5 @@
1
+ import { AttributeError, Metadata } from '@reltio/mdm-sdk';
2
+ export declare const areErrorsEqual: (errors1?: AttributeError[], errors2?: AttributeError[]) => any;
3
+ export declare const getDisplayedErrorMessage: (metadata: Metadata, { type, source, message, attributeTypeUri, attributeType }: AttributeError) => string;
4
+ export declare const getDisplayedErrorPath: ({ path: errorPath, uri }: AttributeError) => string;
5
+ export declare const getDisplayedAttributeTypesPath: ({ path: errorPath }: AttributeError) => string;
@@ -0,0 +1,34 @@
1
+ import { either, equals, identity, omit, path } from 'ramda';
2
+ import i18n from 'ui-i18n';
3
+ import { AttributeValuePathItemType, ErrorSource, ErrorType, findAttributeTypeByUri } from '@reltio/mdm-sdk';
4
+ var clearError = omit(['deactivated', 'path']);
5
+ export var areErrorsEqual = function (errors1, errors2) {
6
+ if (errors1 === void 0) { errors1 = []; }
7
+ if (errors2 === void 0) { errors2 = []; }
8
+ return errors1.length === errors2.length && equals(errors1.map(clearError), errors2.map(clearError));
9
+ };
10
+ export var getDisplayedErrorMessage = function (metadata, _a) {
11
+ var type = _a.type, source = _a.source, message = _a.message, _b = _a.attributeTypeUri, attributeTypeUri = _b === void 0 ? '' : _b, attributeType = _a.attributeType;
12
+ if (type === ErrorType.missed && source === ErrorSource.local) {
13
+ var attrType = attributeType || findAttributeTypeByUri(metadata, attributeTypeUri);
14
+ return attrType ? i18n.text('${attribute} is required', { attribute: attrType.label }) : message;
15
+ }
16
+ return message;
17
+ };
18
+ export var getDisplayedErrorPath = function (_a) {
19
+ var errorPath = _a.path, uri = _a.uri;
20
+ return errorPath === null || errorPath === void 0 ? void 0 : errorPath.slice(0, uri ? errorPath.length - 1 : errorPath.length).filter(function (_a) {
21
+ var type = _a.type;
22
+ return [AttributeValuePathItemType.attributeValue, AttributeValuePathItemType.relationConnection].includes(type);
23
+ }).map(function (_a) {
24
+ var label = _a.label;
25
+ return label;
26
+ }).filter(identity).join(' / ');
27
+ };
28
+ export var getDisplayedAttributeTypesPath = function (_a) {
29
+ var errorPath = _a.path;
30
+ return errorPath === null || errorPath === void 0 ? void 0 : errorPath.filter(function (_a) {
31
+ var type = _a.type;
32
+ return type === AttributeValuePathItemType.attributeValue;
33
+ }).map(either(path(['valueType', 'label']), path(['valueType', 'name']))).filter(identity).join(' > ');
34
+ };
@@ -0,0 +1,2 @@
1
+ declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"icon" | "parents" | "errorWrapper" | "accordion" | "accordionExpanded" | "accordionSummary" | "accordionSummaryHeading" | "accordionSummaryExpanded" | "accordionSummaryContent" | "accordionDetails" | "errorTitle" | "attributeTypesPath" | "goToIcon" | "errorsAccordion" | "errorsAccordionDetails" | "warningsAccordion" | "warningsAccordionDetails" | "errorIcon" | "warningIcon">;
2
+ export default useStyles;
@@ -0,0 +1,97 @@
1
+ import { makeStyles } from '@mui/styles';
2
+ var accordionSummaryHeight = '48px';
3
+ var defaultBorderStyle = '1px solid rgba(0, 0, 0, .125)';
4
+ var useStyles = makeStyles(function (theme) { return ({
5
+ accordion: {
6
+ borderTop: defaultBorderStyle,
7
+ borderBottom: defaultBorderStyle,
8
+ fontSize: '13px',
9
+ boxShadow: 'none',
10
+ '&:not(:first-child)': {
11
+ borderTop: 0
12
+ },
13
+ '&:before': {
14
+ display: 'none'
15
+ },
16
+ '&$accordionExpanded': {
17
+ margin: 'auto'
18
+ }
19
+ },
20
+ accordionExpanded: {},
21
+ accordionSummary: {
22
+ display: 'flex',
23
+ alignItems: 'center',
24
+ height: accordionSummaryHeight,
25
+ minHeight: accordionSummaryHeight,
26
+ '&$accordionSummaryExpanded': {
27
+ height: accordionSummaryHeight,
28
+ minHeight: accordionSummaryHeight
29
+ }
30
+ },
31
+ accordionSummaryHeading: {
32
+ flex: 1,
33
+ fontSize: theme.typography.pxToRem(13),
34
+ fontWeight: theme.typography.fontWeightRegular
35
+ },
36
+ accordionSummaryExpanded: {},
37
+ accordionSummaryContent: {
38
+ display: 'flex',
39
+ alignItems: 'center'
40
+ },
41
+ accordionDetails: {
42
+ maxHeight: '21vh',
43
+ overflow: 'auto',
44
+ paddingTop: 0,
45
+ paddingBottom: 0,
46
+ '& ul': {
47
+ paddingLeft: '23px',
48
+ marginTop: '3px'
49
+ },
50
+ '& li': {
51
+ paddingLeft: '9px',
52
+ paddingBottom: '8px'
53
+ }
54
+ },
55
+ parents: {
56
+ color: theme.palette.text.primary
57
+ },
58
+ errorWrapper: {
59
+ lineHeight: '18px',
60
+ display: 'flex',
61
+ flexDirection: 'column'
62
+ },
63
+ errorTitle: {
64
+ display: 'flex',
65
+ alignItems: 'center'
66
+ },
67
+ attributeTypesPath: {
68
+ color: theme.palette.text.secondary
69
+ },
70
+ goToIcon: {
71
+ marginLeft: '4px'
72
+ },
73
+ errorsAccordion: {
74
+ backgroundColor: '#FFF4F6',
75
+ borderColor: '#FFB8B3'
76
+ },
77
+ errorsAccordionDetails: {
78
+ color: '#DD2C00'
79
+ },
80
+ warningsAccordion: {
81
+ backgroundColor: '#FFF9ED',
82
+ borderColor: '#FFDD91'
83
+ },
84
+ warningsAccordionDetails: {
85
+ color: '#CC7500'
86
+ },
87
+ icon: {
88
+ marginRight: '8px'
89
+ },
90
+ errorIcon: {
91
+ fill: '#FF1744'
92
+ },
93
+ warningIcon: {
94
+ fill: '#F9A825'
95
+ }
96
+ }); });
97
+ export default useStyles;
@@ -0,0 +1 @@
1
+ export declare const useCachedErrors: (allErrors: any) => any;
@@ -0,0 +1,10 @@
1
+ import { useRef } from 'react';
2
+ import { areErrorsEqual } from './ErrorsPanel/helpers';
3
+ export var useCachedErrors = function (allErrors) {
4
+ var cacheForAllErrors = useRef(allErrors);
5
+ var areEqualErrors = areErrorsEqual(allErrors, cacheForAllErrors.current);
6
+ if (!areEqualErrors) {
7
+ cacheForAllErrors.current = allErrors;
8
+ }
9
+ return cacheForAllErrors.current;
10
+ };
@@ -57,6 +57,7 @@ export { EntityTypesSelector } from './EntityTypesSelector/EntityTypesSelector';
57
57
  export { RelationTypesSelector } from './RelationTypesSelector/RelationTypesSelector';
58
58
  export { default as EntityUriLink } from './EntityUriLink/EntityUriLink';
59
59
  export { default as ErrorBoundary } from './ErrorBoundary/ErrorBoundary';
60
+ export { AttributesErrorsPanel } from './AttributesErrorsPanel/AttributesErrorsPanel';
60
61
  export { default as ErrorPopup } from './ErrorPopup/ErrorPopup';
61
62
  export { default as ErrorWrapper } from './ErrorWrapper/ErrorWrapper';
62
63
  export { default as ExpandedValueTooltip } from './ExpandedValueTooltip/ExpandedValueTooltip';
@@ -57,6 +57,7 @@ export { EntityTypesSelector } from './EntityTypesSelector/EntityTypesSelector';
57
57
  export { RelationTypesSelector } from './RelationTypesSelector/RelationTypesSelector';
58
58
  export { default as EntityUriLink } from './EntityUriLink/EntityUriLink';
59
59
  export { default as ErrorBoundary } from './ErrorBoundary/ErrorBoundary';
60
+ export { AttributesErrorsPanel } from './AttributesErrorsPanel/AttributesErrorsPanel';
60
61
  export { default as ErrorPopup } from './ErrorPopup/ErrorPopup';
61
62
  export { default as ErrorWrapper } from './ErrorWrapper/ErrorWrapper';
62
63
  export { default as ExpandedValueTooltip } from './ExpandedValueTooltip/ExpandedValueTooltip';
@@ -8,7 +8,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
8
8
  return to.concat(ar || Array.prototype.slice.call(from));
9
9
  };
10
10
  import React, { useCallback, useState, useMemo } from 'react';
11
- import { allPass, pipe, propEq, when, always } from 'ramda';
11
+ import { pipe } from 'ramda';
12
12
  import Input from '@mui/material/Input';
13
13
  import InputAdornment from '@mui/material/InputAdornment';
14
14
  import SendIcon from '@mui/icons-material/Send';
@@ -37,6 +37,18 @@ export var WorkflowComments = function (_a) {
37
37
  setComment('');
38
38
  }, [comment, writeComment]);
39
39
  var onChange = pipe(getValue, setComment);
40
+ var onKeyPressHandler = function (e) {
41
+ if (e.key === 'Enter') {
42
+ if (comment.length > 0 && !e.shiftKey) {
43
+ e.preventDefault();
44
+ sendComment();
45
+ }
46
+ if (comment.length > 0 && e.shiftKey) {
47
+ return;
48
+ }
49
+ e.preventDefault();
50
+ }
51
+ };
40
52
  var BUTTONS_GROUP = useMemo(function () { return __spreadArray([], actions.map(function (_a) {
41
53
  var text = _a.text, onClick = _a.onClick;
42
54
  return ({
@@ -54,8 +66,8 @@ export var WorkflowComments = function (_a) {
54
66
  i18n.text('Comments'),
55
67
  " "),
56
68
  React.createElement("div", { className: styles.commentsContainer }, expanded || comments.length < 3 ? (React.createElement(ExpandedComments, { comments: comments })) : (React.createElement(CollapsedComments, { onClick: function () { return setExpanded(true); }, comments: comments }))),
57
- !readOnly && (React.createElement(Input, { endAdornment: React.createElement(InputAdornment, { position: "end" },
58
- React.createElement(SmallIconButton, { icon: SendIcon, disabled: comment.length === 0, onClick: sendComment, "data-reltio-id": "send-button" })), classes: { root: styles.filledInputRoot }, placeholder: i18n.text('Write a comment'), value: comment, onKeyPress: when(allPass([propEq('key', 'Enter'), always(comment.length > 0), propEq('shiftKey', false)]), sendComment), onChange: onChange, disableUnderline: true, multiline: true })),
69
+ !readOnly && (React.createElement(Input, { endAdornment: React.createElement(InputAdornment, { position: "end", className: styles.sendButton },
70
+ React.createElement(SmallIconButton, { icon: SendIcon, disabled: comment.length === 0, onClick: sendComment, "data-reltio-id": "send-button" })), classes: { root: styles.filledInputRoot }, placeholder: i18n.text('Write a comment'), value: comment, onKeyPress: onKeyPressHandler, onChange: onChange, disableUnderline: true, multiline: true })),
59
71
  React.createElement("div", { className: styles.modeSwitcherWrapper },
60
72
  BUTTONS_GROUP.length === 1 && (React.createElement(Button, { variant: "outlined", onClick: BUTTONS_GROUP[0].onClick, disabled: actionRequestIsInProgress }, BUTTONS_GROUP[0].label)),
61
73
  BUTTONS_GROUP.length > 1 && (React.createElement(ModeSwitcherSelect, { buttonsGroup: BUTTONS_GROUP, value: currentAction, disabled: actionRequestIsInProgress })))));
@@ -1,4 +1,4 @@
1
1
  export declare const useCommentStyles: (props?: any) => import("@mui/styles").ClassNameMap<"date" | "icon" | "comment" | "text" | "info" | "avatar" | "firstLine" | "author">;
2
2
  export declare const useCollapsedCommentsStyles: (props?: any) => import("@mui/styles").ClassNameMap<"delimiter" | "circleButton">;
3
- export declare const useWorkflowStyles: (props?: any) => import("@mui/styles").ClassNameMap<"title" | "container" | "commentsContainer" | "filledInputRoot" | "modeSwitcherWrapper">;
3
+ export declare const useWorkflowStyles: (props?: any) => import("@mui/styles").ClassNameMap<"title" | "container" | "commentsContainer" | "filledInputRoot" | "modeSwitcherWrapper" | "sendButton">;
4
4
  export declare const useExpandedComments: (props?: any) => import("@mui/styles").ClassNameMap<"messageContainer">;
@@ -87,7 +87,7 @@ export var useWorkflowStyles = makeStyles(function (_theme) { return ({
87
87
  },
88
88
  filledInputRoot: {
89
89
  backgroundColor: 'rgba(0, 0, 0, 0.03)',
90
- padding: '0 6px',
90
+ padding: '10px 6px',
91
91
  minHeight: '40px',
92
92
  margin: '10px 17px 0 6px',
93
93
  fontSize: '14px',
@@ -102,6 +102,10 @@ export var useWorkflowStyles = makeStyles(function (_theme) { return ({
102
102
  marginLeft: 'auto',
103
103
  marginRight: '16px',
104
104
  marginTop: '8px'
105
+ },
106
+ sendButton: {
107
+ alignSelf: 'end',
108
+ marginBottom: '10px'
105
109
  }
106
110
  }); });
107
111
  export var useExpandedComments = makeStyles(function (_theme) { return ({
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const SvgHyperlink: React.FC<React.SVGProps<SVGSVGElement>>;
3
+ export default SvgHyperlink;
@@ -0,0 +1,17 @@
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
+ import React from 'react';
13
+ var SvgHyperlink = function (props) {
14
+ return (React.createElement("svg", __assign({ width: 18, height: 18, viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
15
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M14.245 12.75c0 .825-.467 1.5-1.045 1.5H4.8c-.583 0-1.05-.675-1.05-1.5v-7.5c0-.832.467-1.5 1.05-1.5h8.4c.578 0 1.05.668 1.05 1.5l-.005 7.5zM9.75 9.96v1.642l3-2.805L9.75 6v1.598c-2.918.404-4.08 2.4-4.5 4.402 1.043-1.402 2.415-2.04 4.5-2.04z", fill: "#000", fillOpacity: 0.54 })));
16
+ };
17
+ export default SvgHyperlink;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1654",
3
+ "version": "1.4.1656",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -8,7 +8,7 @@
8
8
  "@date-io/moment": "^1.3.5",
9
9
  "@fluentui/react-context-selector": "^9.1.26",
10
10
  "@react-google-maps/api": "2.7.0",
11
- "@reltio/mdm-sdk": "^1.4.1654",
11
+ "@reltio/mdm-sdk": "^1.4.1656",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",