@reltio/components 1.4.2302 → 1.4.2313

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 (86) hide show
  1. package/DropDownMenuButton/DropDownMenuButton.d.ts +28 -8
  2. package/DropDownMenuButton/DropDownMenuButton.js +89 -30
  3. package/DropDownMenuButton/DropDownMenuButton.module.css.js +9 -0
  4. package/DropDownMenuButton/index.d.ts +12 -1
  5. package/DropDownMenuButton/index.js +47 -1
  6. package/DropDownMenuButton/legacy/DropDownMenuButton.d.ts +16 -0
  7. package/DropDownMenuButton/legacy/DropDownMenuButton.js +59 -0
  8. package/DropDownMenuButton/{DropDownMenuButton.spec.js → legacy/DropDownMenuButton.spec.js} +1 -1
  9. package/RelationEditor/RelationEditor.js +7 -9
  10. package/RelationEditor/RelationEditor.module.css.js +9 -0
  11. package/VerificationButton/VerificationButton.js +3 -2
  12. package/cjs/DropDownMenuButton/DropDownMenuButton.d.ts +28 -8
  13. package/cjs/DropDownMenuButton/DropDownMenuButton.js +90 -28
  14. package/cjs/DropDownMenuButton/DropDownMenuButton.module.css.js +9 -0
  15. package/cjs/DropDownMenuButton/index.d.ts +12 -1
  16. package/cjs/DropDownMenuButton/index.js +50 -2
  17. package/cjs/DropDownMenuButton/legacy/DropDownMenuButton.d.ts +16 -0
  18. package/cjs/DropDownMenuButton/legacy/DropDownMenuButton.js +88 -0
  19. package/cjs/DropDownMenuButton/{DropDownMenuButton.spec.js → legacy/DropDownMenuButton.spec.js} +1 -1
  20. package/cjs/RelationEditor/RelationEditor.js +11 -13
  21. package/cjs/RelationEditor/RelationEditor.module.css.js +9 -0
  22. package/cjs/VerificationButton/VerificationButton.js +3 -2
  23. package/cjs/contexts/DesignMigrationContext/index.d.ts +8 -0
  24. package/cjs/contexts/DesignMigrationContext/index.js +35 -0
  25. package/cjs/features/history/ProfileBandHistory/ProfileBandHistory.js +6 -8
  26. package/cjs/features/history/ProfileBandHistory/ProfileBandHistory.module.css.js +9 -0
  27. package/cjs/features/history/ProfileBandHistory/index.d.ts +2 -1
  28. package/cjs/features/history/ProfileBandHistory/index.js +12 -2
  29. package/cjs/features/history/ProfileBandHistory/legacy/ProfileBandHistory.d.ts +2 -0
  30. package/cjs/features/history/ProfileBandHistory/legacy/ProfileBandHistory.js +24 -0
  31. package/cjs/features/history/ProfileBandHistory/{ProfileBandHistory.test.js → legacy/ProfileBandHistory.test.js} +1 -1
  32. package/cjs/features/workflow/AddWorkflowButton/AddWorkflowButton.js +4 -7
  33. package/cjs/features/workflow/AddWorkflowButton/AddWorkflowButton.module.css.js +9 -0
  34. package/cjs/helpers/errors.js +3 -0
  35. package/cjs/helpers/errors.test.js +4 -0
  36. package/cjs/hooks/useReadableSearchState/useReadableSearchState.js +6 -0
  37. package/cjs/hooks/useReadableSearchState/useReadableSearchState.test.js +30 -2
  38. package/contexts/DesignMigrationContext/index.d.ts +8 -0
  39. package/contexts/DesignMigrationContext/index.js +7 -0
  40. package/features/history/HistoryRow/styles.d.ts +1 -1
  41. package/features/history/ProfileBandHistory/ProfileBandHistory.js +4 -6
  42. package/features/history/ProfileBandHistory/ProfileBandHistory.module.css.js +9 -0
  43. package/features/history/ProfileBandHistory/index.d.ts +2 -1
  44. package/features/history/ProfileBandHistory/index.js +8 -1
  45. package/features/history/ProfileBandHistory/legacy/ProfileBandHistory.d.ts +2 -0
  46. package/features/history/ProfileBandHistory/legacy/ProfileBandHistory.js +17 -0
  47. package/features/history/ProfileBandHistory/{ProfileBandHistory.test.js → legacy/ProfileBandHistory.test.js} +1 -1
  48. package/features/workflow/AddWorkflowButton/AddWorkflowButton.js +4 -7
  49. package/features/workflow/AddWorkflowButton/AddWorkflowButton.module.css.js +9 -0
  50. package/helpers/errors.js +4 -1
  51. package/helpers/errors.test.js +4 -0
  52. package/hooks/useReadableSearchState/useReadableSearchState.js +6 -0
  53. package/hooks/useReadableSearchState/useReadableSearchState.test.js +30 -2
  54. package/package.json +3 -3
  55. package/RelationEditor/styles.d.ts +0 -1
  56. package/RelationEditor/styles.js +0 -34
  57. package/cjs/RelationEditor/styles.d.ts +0 -1
  58. package/cjs/RelationEditor/styles.js +0 -37
  59. package/cjs/features/workflow/AddWorkflowButton/styles.d.ts +0 -1
  60. package/cjs/features/workflow/AddWorkflowButton/styles.js +0 -20
  61. package/features/workflow/AddWorkflowButton/styles.d.ts +0 -1
  62. package/features/workflow/AddWorkflowButton/styles.js +0 -17
  63. /package/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/DefaultMenuItemRenderer.d.ts +0 -0
  64. /package/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/DefaultMenuItemRenderer.js +0 -0
  65. /package/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/index.d.ts +0 -0
  66. /package/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/index.js +0 -0
  67. /package/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/styles.d.ts +0 -0
  68. /package/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/styles.js +0 -0
  69. /package/DropDownMenuButton/{DropDownMenuButton.spec.d.ts → legacy/DropDownMenuButton.spec.d.ts} +0 -0
  70. /package/DropDownMenuButton/{styles.d.ts → legacy/styles.d.ts} +0 -0
  71. /package/DropDownMenuButton/{styles.js → legacy/styles.js} +0 -0
  72. /package/cjs/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/DefaultMenuItemRenderer.d.ts +0 -0
  73. /package/cjs/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/DefaultMenuItemRenderer.js +0 -0
  74. /package/cjs/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/index.d.ts +0 -0
  75. /package/cjs/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/index.js +0 -0
  76. /package/cjs/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/styles.d.ts +0 -0
  77. /package/cjs/DropDownMenuButton/{components → legacy}/DefaultMenuItemRenderer/styles.js +0 -0
  78. /package/cjs/DropDownMenuButton/{DropDownMenuButton.spec.d.ts → legacy/DropDownMenuButton.spec.d.ts} +0 -0
  79. /package/cjs/DropDownMenuButton/{styles.d.ts → legacy/styles.d.ts} +0 -0
  80. /package/cjs/DropDownMenuButton/{styles.js → legacy/styles.js} +0 -0
  81. /package/cjs/features/history/ProfileBandHistory/{ProfileBandHistory.test.d.ts → legacy/ProfileBandHistory.test.d.ts} +0 -0
  82. /package/cjs/features/history/ProfileBandHistory/{styles.d.ts → legacy/styles.d.ts} +0 -0
  83. /package/cjs/features/history/ProfileBandHistory/{styles.js → legacy/styles.js} +0 -0
  84. /package/features/history/ProfileBandHistory/{ProfileBandHistory.test.d.ts → legacy/ProfileBandHistory.test.d.ts} +0 -0
  85. /package/features/history/ProfileBandHistory/{styles.d.ts → legacy/styles.d.ts} +0 -0
  86. /package/features/history/ProfileBandHistory/{styles.js → legacy/styles.js} +0 -0
@@ -0,0 +1,9 @@
1
+ const styles = {"root":"ProfileBandHistory-root--YvxgP","message":"ProfileBandHistory-message--pXCjS","slice":"ProfileBandHistory-slice--o9Udc","cancelButton":"ProfileBandHistory-cancelButton--mPVRW"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.ProfileBandHistory-root--YvxgP{align-items:flex-start;display:flex}.ProfileBandHistory-message--pXCjS{font-size:var(--sapFontLargeSize)}.ProfileBandHistory-slice--o9Udc{font-weight:600}.ProfileBandHistory-cancelButton--mPVRW{flex-shrink:0;margin-left:15px}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -1 +1,2 @@
1
- export { ProfileBandHistory } from './ProfileBandHistory';
1
+ import React from 'react';
2
+ export declare const ProfileBandHistory: () => React.JSX.Element;
@@ -1 +1,8 @@
1
- export { ProfileBandHistory } from './ProfileBandHistory';
1
+ import React from 'react';
2
+ import { useDesignMigration } from '../../../contexts/DesignMigrationContext';
3
+ import { ProfileBandHistory as ProfileBandHistoryLegacy } from './legacy/ProfileBandHistory';
4
+ import { ProfileBandHistory as ProfileBandHistoryMigrated } from './ProfileBandHistory';
5
+ export var ProfileBandHistory = function () {
6
+ var designMigrationEnabled = useDesignMigration();
7
+ return designMigrationEnabled ? React.createElement(ProfileBandHistoryMigrated, null) : React.createElement(ProfileBandHistoryLegacy, null);
8
+ };
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const ProfileBandHistory: () => React.JSX.Element;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import i18n from 'ui-i18n';
3
+ import Button from '@mui/material/Button';
4
+ import Typography from '@mui/material/Typography';
5
+ import { useMdmAction, useMdmHistoryEvent } from '../../../../contexts/MdmModuleContext';
6
+ import { useStyles } from './styles';
7
+ export var ProfileBandHistory = function () {
8
+ var styles = useStyles();
9
+ var clearHistoryEvent = useMdmAction('clearHistoryEvent');
10
+ var historyEvent = useMdmHistoryEvent();
11
+ return historyEvent ? (React.createElement("div", { className: styles.root },
12
+ React.createElement(Typography, { component: 'div' },
13
+ i18n.text('You are viewing a historic slice:'),
14
+ ' ',
15
+ React.createElement("span", { className: styles.slice }, i18n.date(historyEvent.aStamp, 'llll'))),
16
+ React.createElement(Button, { className: styles.cancelButton, variant: "contained", color: "primary", onClick: clearHistoryEvent }, i18n.text('Cancel')))) : null;
17
+ };
@@ -49,7 +49,7 @@ import React from 'react';
49
49
  import i18n from 'ui-i18n';
50
50
  import { render, screen } from '@testing-library/react';
51
51
  import userEvent from '@testing-library/user-event';
52
- import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
52
+ import { MdmModuleProvider } from '../../../../contexts/MdmModuleContext';
53
53
  import { ProfileBandHistory } from './ProfileBandHistory';
54
54
  var defaultHistoryEvent = { aStamp: 123 };
55
55
  var clearHistoryEvent = jest.fn();
@@ -1,12 +1,11 @@
1
1
  import React, { useState } from 'react';
2
2
  import i18n from 'ui-i18n';
3
- import Button from '@mui/material/Button';
4
- import AddIcon from '@mui/icons-material/Add';
3
+ import { Button } from '@reltio/design/components';
4
+ import addIcon from '@reltio/design/icons/sap/add';
5
5
  import { useWorkflowCheckPermission } from '../hooks/useWorkflowCheckPermission';
6
6
  import { AddWorkflowDialog } from '../AddWorkflowDialog';
7
- import { useStyles } from './styles';
7
+ import styles from './AddWorkflowButton.module.css';
8
8
  export var AddWorkflowButton = function () {
9
- var styles = useStyles();
10
9
  var _a = useState(null), anchorEl = _a[0], setAnchorEl = _a[1];
11
10
  var checkWorkflowPermission = useWorkflowCheckPermission();
12
11
  var canStartProcess = checkWorkflowPermission('START_PROCESS_INSTANCE');
@@ -14,8 +13,6 @@ export var AddWorkflowButton = function () {
14
13
  var handleOpen = function (e) { return setAnchorEl(e.currentTarget); };
15
14
  var handleClose = function () { return setAnchorEl(null); };
16
15
  return canStartProcess && canViewProcessDefinitions ? (React.createElement(React.Fragment, null,
17
- React.createElement(Button, { color: "primary", className: styles.button, onClick: handleOpen },
18
- React.createElement(AddIcon, { className: styles.icon }),
19
- React.createElement("div", { className: styles.buttonLabel }, i18n.text('Add'))),
16
+ React.createElement(Button, { design: "Transparent", className: styles.button, icon: addIcon, onClick: handleOpen }, i18n.text('Add')),
20
17
  React.createElement(AddWorkflowDialog, { anchorEl: anchorEl, onClose: handleClose }))) : null;
21
18
  };
@@ -0,0 +1,9 @@
1
+ const styles = {"button":"AddWorkflowButton-button--5MCcn"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.AddWorkflowButton-button--5MCcn{margin-left:auto;margin-right:8px}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
package/helpers/errors.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import i18n from 'ui-i18n';
2
- import { getRequestErrorMessage } from '@reltio/mdm-sdk';
2
+ import { getRequestErrorMessage, isAbortError } from '@reltio/mdm-sdk';
3
3
  import { ErrorPopup } from '../ErrorPopup';
4
4
  export var showErrorMessage = function (error, params) {
5
+ if (isAbortError(error)) {
6
+ return;
7
+ }
5
8
  var _a = params || {}, _b = _a.title, title = _b === void 0 ? i18n.text('Error') : _b, message = _a.message, defaultMessage = _a.defaultMessage;
6
9
  console.warn(error);
7
10
  ErrorPopup.addError({
@@ -47,6 +47,10 @@ describe('showErrorMessage tests', function () {
47
47
  message: 'Error message'
48
48
  });
49
49
  });
50
+ it('should not show ErrorPopup for abort errors', function () {
51
+ showErrorMessage(Object.assign(new Error('The user aborted a request.'), { name: 'AbortError' }));
52
+ expect(ErrorPopup.addError).not.toHaveBeenCalled();
53
+ });
50
54
  describe('showDefaultErrorMessage tests', function () {
51
55
  it('should show default message if errorMessage is not provided', function () {
52
56
  showDefaultErrorMessage({
@@ -22,6 +22,12 @@ export var useReadableSearchState = function (searchState) {
22
22
  }), resolveLookupsList, andThen(lookupsListResolved))(unresolvedLookups);
23
23
  }
24
24
  }, [searchState]); // eslint-disable-line
25
+ if (!metadata) {
26
+ return {
27
+ readableQuery: [],
28
+ readableQueryString: ''
29
+ };
30
+ }
25
31
  return {
26
32
  readableQuery: buildReadableQuery(metadata, attributesPresentation, lookups, groups, keyword, map, formatOptions),
27
33
  readableQueryString: buildReadableQueryToString(metadata, attributesPresentation, lookups, groups, keyword, map, formatOptions)
@@ -60,10 +60,11 @@ var attributesPresentation = {
60
60
  };
61
61
  var lookups = {};
62
62
  var lookupsListResolved = jest.fn();
63
- var setUp = function (searchState) {
63
+ var setUp = function (searchState, values) {
64
+ if (values === void 0) { values = { metadata: metadata, dataTenants: dataTenants, attributesPresentation: attributesPresentation, lookups: lookups }; }
64
65
  var Providers = function (_a) {
65
66
  var children = _a.children;
66
- return (React.createElement(MdmModuleProvider, { values: { metadata: metadata, dataTenants: dataTenants, attributesPresentation: attributesPresentation, lookups: lookups }, actions: { lookupsListResolved: lookupsListResolved } }, children));
67
+ return (React.createElement(MdmModuleProvider, { values: values, actions: { lookupsListResolved: lookupsListResolved } }, children));
67
68
  };
68
69
  return renderHook(useReadableSearchState, { wrapper: Providers, initialProps: searchState });
69
70
  };
@@ -141,4 +142,31 @@ describe('useReadableSearchState tests', function () {
141
142
  }
142
143
  });
143
144
  }); });
145
+ it('should not build readable query if metadata is not loaded', function () {
146
+ var searchState = {
147
+ version: '2.0',
148
+ advanced: [
149
+ {
150
+ attributes: [
151
+ {
152
+ data: { fieldName: 'sourceSystems' },
153
+ operator: 'and',
154
+ filter: 'equals',
155
+ values: [['SupplierIntelligenceTesting']]
156
+ }
157
+ ],
158
+ operator: 'or'
159
+ }
160
+ ]
161
+ };
162
+ getGroupsFromSearchState.mockReturnValueOnce([]);
163
+ getUnresolvedLookupsListFromSearchGroups.mockReturnValueOnce([]);
164
+ var result = setUp(searchState, { dataTenants: dataTenants, attributesPresentation: attributesPresentation, lookups: lookups }).result;
165
+ expect(buildReadableQuery).not.toHaveBeenCalled();
166
+ expect(buildReadableQueryToString).not.toHaveBeenCalled();
167
+ expect(result.current).toEqual({
168
+ readableQuery: [],
169
+ readableQueryString: ''
170
+ });
171
+ });
144
172
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.2302",
3
+ "version": "1.4.2313",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -11,7 +11,7 @@
11
11
  "@fluentui/react-context-selector": "^9.1.26",
12
12
  "@googlemaps/markerclusterer": "^2.5.3",
13
13
  "@react-sigma/core": "3.4.0",
14
- "@reltio/mdm-sdk": "^1.4.2068",
14
+ "@reltio/mdm-sdk": "^1.4.2071",
15
15
  "@vis.gl/react-google-maps": "^1.3.0",
16
16
  "d3-cloud": "^1.2.5",
17
17
  "d3-geo": "^2.0.1",
@@ -35,7 +35,7 @@
35
35
  "react-virtualized": "^9.22.5",
36
36
  "react-window": "^1.8.10",
37
37
  "recharts": "^2.15.1",
38
- "sanitize-html": "^2.17.5",
38
+ "sanitize-html": "^2.17.7",
39
39
  "sigma": "^2.4.0",
40
40
  "topojson-client": "^3.1.0"
41
41
  },
@@ -1 +0,0 @@
1
- export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"dense" | "title" | "item" | "editor" | "actionButtons">;
@@ -1,34 +0,0 @@
1
- import { makeStyles } from '@mui/styles';
2
- export var useStyles = makeStyles({
3
- editor: {
4
- display: 'flex',
5
- flexDirection: 'column',
6
- padding: '0 24px 5px',
7
- overflowX: 'hidden'
8
- },
9
- title: {
10
- color: 'rgba(0, 0, 0, 0.6)',
11
- fontSize: '16px',
12
- letterSpacing: '0.15px',
13
- lineHeight: '24px',
14
- margin: '17px 0 24px'
15
- },
16
- item: {
17
- marginBottom: '20px'
18
- },
19
- dense: {
20
- marginBottom: 0
21
- },
22
- actionButtons: {
23
- display: 'flex',
24
- justifyContent: 'flex-end',
25
- margin: '0 8px 10px',
26
- '& > button': {
27
- fontSize: '14px',
28
- lineHeight: '16px',
29
- marginLeft: '8px',
30
- padding: '10px 8px',
31
- backgroundColor: 'rgba(98, 2, 238, 0)'
32
- }
33
- }
34
- });
@@ -1 +0,0 @@
1
- export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"dense" | "title" | "item" | "editor" | "actionButtons">;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useStyles = void 0;
4
- var styles_1 = require("@mui/styles");
5
- exports.useStyles = (0, styles_1.makeStyles)({
6
- editor: {
7
- display: 'flex',
8
- flexDirection: 'column',
9
- padding: '0 24px 5px',
10
- overflowX: 'hidden'
11
- },
12
- title: {
13
- color: 'rgba(0, 0, 0, 0.6)',
14
- fontSize: '16px',
15
- letterSpacing: '0.15px',
16
- lineHeight: '24px',
17
- margin: '17px 0 24px'
18
- },
19
- item: {
20
- marginBottom: '20px'
21
- },
22
- dense: {
23
- marginBottom: 0
24
- },
25
- actionButtons: {
26
- display: 'flex',
27
- justifyContent: 'flex-end',
28
- margin: '0 8px 10px',
29
- '& > button': {
30
- fontSize: '14px',
31
- lineHeight: '16px',
32
- marginLeft: '8px',
33
- padding: '10px 8px',
34
- backgroundColor: 'rgba(98, 2, 238, 0)'
35
- }
36
- }
37
- });
@@ -1 +0,0 @@
1
- export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"button" | "icon" | "buttonLabel">;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useStyles = void 0;
4
- var styles_1 = require("@mui/styles");
5
- exports.useStyles = (0, styles_1.makeStyles)({
6
- button: {
7
- padding: '9px 16px 9px 12px',
8
- marginLeft: 'auto',
9
- marginRight: '8px'
10
- },
11
- buttonLabel: {
12
- fontSize: '14px',
13
- fontWeight: 500,
14
- lineHeight: '16px'
15
- },
16
- icon: {
17
- fontSize: '18px',
18
- marginRight: '8px'
19
- }
20
- });
@@ -1 +0,0 @@
1
- export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"button" | "icon" | "buttonLabel">;
@@ -1,17 +0,0 @@
1
- import { makeStyles } from '@mui/styles';
2
- export var useStyles = makeStyles({
3
- button: {
4
- padding: '9px 16px 9px 12px',
5
- marginLeft: 'auto',
6
- marginRight: '8px'
7
- },
8
- buttonLabel: {
9
- fontSize: '14px',
10
- fontWeight: 500,
11
- lineHeight: '16px'
12
- },
13
- icon: {
14
- fontSize: '18px',
15
- marginRight: '8px'
16
- }
17
- });