@reltio/components 1.4.1248 → 1.4.1251

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 (31) hide show
  1. package/cjs/components/ProfileBand/ProfileBand.d.ts +8 -17
  2. package/cjs/components/ProfileBand/ProfileBand.js +3 -10
  3. package/cjs/components/ProfileBand/styles.d.ts +1 -1
  4. package/cjs/components/ProfileBand/styles.js +3 -2
  5. package/cjs/components/ProfilesList/styles.d.ts +1 -1
  6. package/cjs/components/activityLog/ActivityLogFilter/ActivityLogFilter.js +3 -1
  7. package/cjs/components/activityLog/ActivityLogFilter/ActivityLogFilterHeader.d.ts +2 -1
  8. package/cjs/components/activityLog/ActivityLogFilter/ActivityLogFilterHeader.js +3 -2
  9. package/cjs/components/activityLog/ActivityLogFilter/styles.js +6 -2
  10. package/cjs/components/workflow/hooks/useWorkflowAssignee.d.ts +1 -1
  11. package/cjs/hooks/useAPI/useAPI.d.ts +1 -0
  12. package/cjs/hooks/useAPI/useAPI.js +36 -6
  13. package/cjs/hooks/useCommentsEntitiesMap.js +2 -6
  14. package/cjs/hooks/useCustomScripts.js +1 -1
  15. package/cjs/hooks/useSafePromise.d.ts +4 -2
  16. package/esm/components/ProfileBand/ProfileBand.d.ts +8 -17
  17. package/esm/components/ProfileBand/ProfileBand.js +3 -10
  18. package/esm/components/ProfileBand/styles.d.ts +1 -1
  19. package/esm/components/ProfileBand/styles.js +1 -1
  20. package/esm/components/ProfilesList/styles.d.ts +1 -1
  21. package/esm/components/activityLog/ActivityLogFilter/ActivityLogFilter.js +3 -1
  22. package/esm/components/activityLog/ActivityLogFilter/ActivityLogFilterHeader.d.ts +2 -1
  23. package/esm/components/activityLog/ActivityLogFilter/ActivityLogFilterHeader.js +3 -2
  24. package/esm/components/activityLog/ActivityLogFilter/styles.js +7 -3
  25. package/esm/components/workflow/hooks/useWorkflowAssignee.d.ts +1 -1
  26. package/esm/hooks/useAPI/useAPI.d.ts +1 -0
  27. package/esm/hooks/useAPI/useAPI.js +36 -6
  28. package/esm/hooks/useCommentsEntitiesMap.js +2 -6
  29. package/esm/hooks/useCustomScripts.js +1 -1
  30. package/esm/hooks/useSafePromise.d.ts +4 -2
  31. package/package.json +3 -3
@@ -1,18 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { Entity } from '@reltio/mdm-sdk';
3
+ declare type Props = {
4
+ className?: string;
5
+ entity?: Entity;
6
+ children?: ReactNode;
7
+ };
8
+ declare const ProfileBand: ({ className, entity, children }: Props) => JSX.Element;
1
9
  export default ProfileBand;
2
- declare function ProfileBand({ className, entity, children, classes, showEntityId }: {
3
- className: any;
4
- entity: any;
5
- children: any;
6
- classes: any;
7
- showEntityId?: boolean;
8
- }): JSX.Element;
9
- declare namespace ProfileBand {
10
- namespace propTypes {
11
- const className: PropTypes.Requireable<string>;
12
- const entity: PropTypes.Requireable<object>;
13
- const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
14
- const classes: PropTypes.Requireable<object>;
15
- const showEntityId: PropTypes.Requireable<boolean>;
16
- }
17
- }
18
- import PropTypes from "prop-types";
@@ -23,7 +23,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  var react_1 = __importStar(require("react"));
26
- var prop_types_1 = __importDefault(require("prop-types"));
27
26
  var classnames_1 = __importDefault(require("classnames"));
28
27
  var react_redux_1 = require("react-redux");
29
28
  var ramda_1 = require("ramda");
@@ -37,9 +36,10 @@ var EntityTypeBadge_1 = __importDefault(require("../EntityTypeBadge/EntityTypeBa
37
36
  var styles_1 = __importDefault(require("./styles"));
38
37
  var ProfileBand = function (_a) {
39
38
  var _b;
40
- var className = _a.className, entity = _a.entity, children = _a.children, classes = _a.classes, _c = _a.showEntityId, showEntityId = _c === void 0 ? true : _c;
41
- var styles = styles_1.default({ classes: classes });
39
+ var className = _a.className, entity = _a.entity, children = _a.children;
40
+ var styles = styles_1.default();
42
41
  var metadata = react_redux_1.useSelector(mdm_module_1.default.selectors.getMetadata);
42
+ var showEntityId = react_redux_1.useSelector(mdm_module_1.default.selectors.getShowEntityId);
43
43
  var handleCopyEntityIdToClipboard = react_1.useCallback(function () {
44
44
  navigator.clipboard.writeText(mdm_sdk_1.getEntityId(entity));
45
45
  }, [entity]);
@@ -72,11 +72,4 @@ var ProfileBand = function (_a) {
72
72
  entityId)))))),
73
73
  children && react_1.default.createElement("div", null, children))));
74
74
  };
75
- ProfileBand.propTypes = {
76
- className: prop_types_1.default.string,
77
- entity: prop_types_1.default.object,
78
- children: prop_types_1.default.node,
79
- classes: prop_types_1.default.object,
80
- showEntityId: prop_types_1.default.bool
81
- };
82
75
  exports.default = ProfileBand;
@@ -1,2 +1,2 @@
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "entityType" | "profileBand" | "secondaryLabel" | "inactive" | "entityId" | "badge" | "profileIcon" | "profileBandWrapper" | "imageProfileIcon" | "profileInfo" | "businessCard" | "specialInfo">;
1
2
  export default useStyles;
2
- declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "entityType" | "profileBand" | "secondaryLabel" | "inactive" | "entityId" | "badge" | "profileIcon" | "businessCard" | "profileBandWrapper" | "imageProfileIcon" | "profileInfo" | "specialInfo">;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useStyles = void 0;
3
4
  var styles_1 = require("@material-ui/core/styles");
4
- var useStyles = styles_1.makeStyles(function (theme) { return ({
5
+ exports.useStyles = styles_1.makeStyles(function (theme) { return ({
5
6
  profileBandWrapper: {
6
7
  // especially for IE (overflow fix)
7
8
  flexShrink: 0
@@ -83,4 +84,4 @@ var useStyles = styles_1.makeStyles(function (theme) { return ({
83
84
  }
84
85
  }
85
86
  }); });
86
- exports.default = useStyles;
87
+ exports.default = exports.useStyles;
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "item" | "image" | "secondaryLabel" | "inactive" | "selected" | "avatar" | "clickable" | "info" | "@keyframes animate" | "highlighted" | "justImported" | "businessCard" | "secondRow">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "item" | "image" | "secondaryLabel" | "inactive" | "selected" | "avatar" | "clickable" | "info" | "businessCard" | "@keyframes animate" | "highlighted" | "justImported" | "secondRow">;
@@ -38,17 +38,19 @@ var react_redux_1 = require("react-redux");
38
38
  var ActivityLogFilterHeader_1 = __importDefault(require("./ActivityLogFilterHeader"));
39
39
  var ActivityFilterEditor_1 = __importDefault(require("../ActivityFilterEditor/ActivityFilterEditor"));
40
40
  var ActivityExportButton_1 = __importDefault(require("../ActivityExportButton/ActivityExportButton"));
41
+ var ramda_1 = require("ramda");
41
42
  var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
42
43
  var ActivityLogFilter = function (_a) {
43
44
  var value = _a.value, entityType = _a.entityType, entityUri = _a.entityUri, onChange = _a.onChange, exportTypes = _a.exportTypes;
44
45
  var initialValue = react_1.useRef(value);
46
+ var isApplied = !ramda_1.equals(value, initialValue.current);
45
47
  var canExport = react_redux_1.useSelector(mdm_module_1.default.selectors.getCanUserMakeActivitiesExport);
46
48
  var _b = react_1.useState(false), isEditorOpen = _b[0], setIsEditorOpen = _b[1];
47
49
  var handleClear = function () { return onChange(__assign({}, initialValue.current)); };
48
50
  var handleCancel = function () { return setIsEditorOpen(false); };
49
51
  var handleToggleFilter = function () { return setIsEditorOpen(function (isEditorOpen) { return !isEditorOpen; }); };
50
52
  return (react_1.default.createElement(react_1.default.Fragment, null,
51
- react_1.default.createElement(ActivityLogFilterHeader_1.default, { onToggle: handleToggleFilter, filters: value }, canExport && react_1.default.createElement(ActivityExportButton_1.default, { filters: __assign(__assign({}, value), { entityUri: entityUri }), exportTypes: exportTypes })),
53
+ react_1.default.createElement(ActivityLogFilterHeader_1.default, { onToggle: handleToggleFilter, filters: value, isApplied: isApplied }, canExport && react_1.default.createElement(ActivityExportButton_1.default, { filters: __assign(__assign({}, value), { entityUri: entityUri }), exportTypes: exportTypes })),
52
54
  react_1.default.createElement(ActivityFilterEditor_1.default, { value: value, open: isEditorOpen, entityType: entityType, onApply: onChange, onCancel: handleCancel, onClear: handleClear })));
53
55
  };
54
56
  exports.default = ActivityLogFilter;
@@ -4,6 +4,7 @@ declare type Props = {
4
4
  onToggle: () => void;
5
5
  filters: ActivitiesFilter;
6
6
  children?: React.ReactNode;
7
+ isApplied?: boolean;
7
8
  };
8
- declare const ActivityLogFilterHeader: ({ children, onToggle, filters }: Props) => JSX.Element;
9
+ declare const ActivityLogFilterHeader: ({ children, onToggle, filters, isApplied }: Props) => JSX.Element;
9
10
  export default ActivityLogFilterHeader;
@@ -10,9 +10,10 @@ var Typography_1 = __importDefault(require("@material-ui/core/Typography"));
10
10
  var FilterList_1 = __importDefault(require("@material-ui/icons/FilterList"));
11
11
  var helpers_1 = require("./helpers");
12
12
  var SmallIconButton_1 = require("../../SmallIconButton");
13
+ var classnames_1 = __importDefault(require("classnames"));
13
14
  var styles_1 = require("./styles");
14
15
  var ActivityLogFilterHeader = function (_a) {
15
- var children = _a.children, onToggle = _a.onToggle, filters = _a.filters;
16
+ var children = _a.children, onToggle = _a.onToggle, filters = _a.filters, _b = _a.isApplied, isApplied = _b === void 0 ? false : _b;
16
17
  var styles = styles_1.useStyles();
17
18
  var filterLabel = helpers_1.getFilterLabel(filters);
18
19
  return (react_1.default.createElement("div", { className: styles.header },
@@ -21,6 +22,6 @@ var ActivityLogFilterHeader = function (_a) {
21
22
  react_1.default.createElement(Typography_1.default, { variant: "body2", className: styles.label, color: "textSecondary", display: "block", noWrap: true }, filterLabel)),
22
23
  react_1.default.createElement("div", { className: styles.buttonsWrapper },
23
24
  children,
24
- react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, { icon: FilterList_1.default, size: "L", onClick: onToggle, tooltipTitle: ui_i18n_1.default.text('Filter'), className: styles.icon }))));
25
+ react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, { icon: FilterList_1.default, size: "L", onClick: onToggle, tooltipTitle: ui_i18n_1.default.text('Filter'), className: classnames_1.default(styles.icon, { activeIcon: isApplied }) }))));
25
26
  };
26
27
  exports.default = ActivityLogFilterHeader;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useStyles = void 0;
4
4
  var styles_1 = require("@material-ui/core/styles");
5
- exports.useStyles = styles_1.makeStyles(function () { return ({
5
+ exports.useStyles = styles_1.makeStyles(function (theme) { return ({
6
6
  header: {
7
7
  width: 'auto',
8
8
  display: 'flex',
@@ -13,7 +13,11 @@ exports.useStyles = styles_1.makeStyles(function () { return ({
13
13
  fontSize: '14px'
14
14
  },
15
15
  icon: {
16
- margin: '4px'
16
+ margin: '4px',
17
+ '&.activeIcon': {
18
+ backgroundColor: styles_1.fade(theme.palette.primary.main, 0.12),
19
+ color: '#0072CE'
20
+ }
17
21
  },
18
22
  buttonsWrapper: {
19
23
  marginLeft: 'auto',
@@ -5,7 +5,7 @@ declare type AssigneeOption = {
5
5
  };
6
6
  export declare const useWorkflowAssignee: ({ assignee, taskId, isOpen }: Partial<Pick<WorkflowTaskData, 'taskId' | 'assignee' | 'isOpen'>>) => {
7
7
  assignee: AssigneeOption;
8
- getAssignees: (text: any) => Promise<void | unknown[]>;
8
+ getAssignees: (text: any) => Promise<void | AssigneeOption[]>;
9
9
  updateAssignee: (newValue: AssigneeOption) => void;
10
10
  updateRequestIsInProgress: boolean;
11
11
  readOnly: boolean;
@@ -10,4 +10,5 @@ export declare const useAPI: (config?: CustomViewConfig) => {
10
10
  pointerEvents?: CSSProperties['pointerEvents'];
11
11
  };
12
12
  onClick: () => void;
13
+ popup: HTMLElement;
13
14
  };
@@ -45,9 +45,11 @@ var useAPI = function (config) {
45
45
  if (config === void 0) { config = {}; }
46
46
  var _c = react_1.useState(), html = _c[0], setHtml = _c[1];
47
47
  var _d = react_1.useState([]), listenersToReset = _d[0], setListenersToReset = _d[1];
48
- var _e = react_1.useState(true), visible = _e[0], setVisible = _e[1];
49
- var _f = react_1.useState(null), tooltip = _f[0], setTooltip = _f[1];
50
- var _g = react_1.useState({}), customStyles = _g[0], setCustomStyles = _g[1];
48
+ var _e = react_1.useState([]), popupListenersToReset = _e[0], setPopupListenersToReset = _e[1];
49
+ var _f = react_1.useState(true), visible = _f[0], setVisible = _f[1];
50
+ var _g = react_1.useState(), popup = _g[0], setPopup = _g[1];
51
+ var _h = react_1.useState(null), tooltip = _h[0], setTooltip = _h[1];
52
+ var _j = react_1.useState({}), customStyles = _j[0], setCustomStyles = _j[1];
51
53
  var workerRef = react_1.useRef();
52
54
  var requestListeners = react_1.useRef({});
53
55
  var responseListeners = react_1.useRef({});
@@ -68,11 +70,12 @@ var useAPI = function (config) {
68
70
  var user = react_redux_1.useSelector(mdm_module_1.default.selectors.getUser);
69
71
  var entityUri = react_redux_1.useSelector(mdm_module_1.default.selectors.getEntityUri);
70
72
  var environment = react_redux_1.useSelector(mdm_module_1.default.selectors.getWorkflowEnvironmentUrl);
71
- var _h = react_redux_1.useSelector(mdm_module_1.default.selectors.getSearchProviderData) || {}, typeSearch = _h.type, search = _h.data;
73
+ var _k = react_redux_1.useSelector(mdm_module_1.default.selectors.getSearchProviderData) || {}, typeSearch = _k.type, search = _k.data;
72
74
  var isOldUI = !helpers_1.isNewUI(servicesPath);
73
75
  var supportedInterceptHandlers = isOldUI ? qxApi.interceptors : interceptHandlers;
74
76
  var openSearch = function (search) { return dispatch(mdm_module_1.ui.actions.openSearch(search)); };
75
77
  var innerText = '';
78
+ var popupText = '';
76
79
  var process = function (_a) {
77
80
  var _b, _c;
78
81
  var task = _a.task, worker = _a.worker;
@@ -96,10 +99,33 @@ var useAPI = function (config) {
96
99
  }
97
100
  break;
98
101
  }
102
+ case mdm_sdk_1.CustomAction.SHOW_POPUP: {
103
+ popupText = task.params;
104
+ helpers_1.resetHtml({
105
+ worker: worker,
106
+ setTooltip: setTooltip,
107
+ html: task.params,
108
+ innerText: popupText,
109
+ setListenersToReset: setPopupListenersToReset,
110
+ setHtml: setPopup
111
+ });
112
+ break;
113
+ }
114
+ case mdm_sdk_1.CustomAction.HIDE_POPUP: {
115
+ popupText = '';
116
+ setPopup(null);
117
+ break;
118
+ }
99
119
  case mdm_sdk_1.CustomAction.SET_VISIBILITY: {
100
120
  if (task.params === 'visible') {
101
121
  setVisible(true);
102
- helpers_1.resetHtml({ worker: worker, setTooltip: setTooltip, innerText: innerText, setListenersToReset: setListenersToReset, setHtml: setHtml });
122
+ helpers_1.resetHtml({
123
+ worker: worker,
124
+ setTooltip: setTooltip,
125
+ innerText: innerText,
126
+ setListenersToReset: setListenersToReset,
127
+ setHtml: setHtml
128
+ });
103
129
  }
104
130
  else {
105
131
  setVisible(false);
@@ -204,6 +230,10 @@ var useAPI = function (config) {
204
230
  react_1.useEffect(function () { return function () {
205
231
  listenersToReset.forEach(function (listener) { return listener(); });
206
232
  }; }, [listenersToReset]);
233
+ //we need to have separate handlers in opposite case main window listeners will be removed on the popup appear
234
+ react_1.useEffect(function () { return function () {
235
+ popupListenersToReset.forEach(function (listener) { return listener(); });
236
+ }; }, [popupListenersToReset, listenersToReset]);
207
237
  var onClick = react_1.useCallback(function () {
208
238
  var _a;
209
239
  (_a = workerRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({
@@ -235,6 +265,6 @@ var useAPI = function (config) {
235
265
  }
236
266
  }
237
267
  }, [config]);
238
- return { html: html, visible: visible, tooltip: tooltip, customStyles: customStyles, onClick: onClick };
268
+ return { html: html, visible: visible, tooltip: tooltip, customStyles: customStyles, onClick: onClick, popup: popup };
239
269
  };
240
270
  exports.useAPI = useAPI;
@@ -43,15 +43,11 @@ var useCommentsEntitiesMap = function (comments) {
43
43
  }, [safePromise]);
44
44
  var getNotFoundEntity = function (entityUri) {
45
45
  return mdm_sdk_1.getEntity(entityUri, { options: SELECT_OPTION })
46
- .then(function (entity) { return ({
47
- uri: entityUri,
48
- label: entity.label,
49
- type: entity.type
50
- }); })
46
+ .then(function (entity) { return (__assign(__assign({}, entity), { uri: entityUri })); })
51
47
  .catch(function () { return ({}); });
52
48
  };
53
49
  var addNotFoundEntities = react_1.useCallback(function (entitiesUris, entities) {
54
- return safePromise(Promise.all((entitiesUris || []).map(getNotFoundEntity))).then(ramda_1.pipe(ramda_1.reject(ramda_1.isEmpty), ramda_1.concat(entities)));
50
+ return safePromise(Promise.all((entitiesUris || []).map(getNotFoundEntity))).then(function (notFoundEntities) { return ramda_1.pipe(ramda_1.reject(ramda_1.isEmpty), ramda_1.concat(entities))(notFoundEntities); });
55
51
  }, [safePromise]);
56
52
  react_1.useEffect(function () {
57
53
  var uniqEntitiesUris = ramda_1.pipe(ramda_1.reduce(function (entitiesUris, comment) {
@@ -185,7 +185,7 @@ var useCustomScripts = function (config) {
185
185
  url: fakeURL,
186
186
  method: options.method,
187
187
  headers: __assign(__assign({}, options.headers), { origin: 'ui', requestId: requestId, actionId: actionId }),
188
- data: options
188
+ data: options.body
189
189
  });
190
190
  }
191
191
  else {
@@ -1,4 +1,6 @@
1
- export function useSafePromise({ cancelPrevious, cancelOnUnmount }?: {
1
+ declare type Options = {
2
2
  cancelPrevious?: boolean;
3
3
  cancelOnUnmount?: boolean;
4
- }): (promise: any) => Promise<any>;
4
+ };
5
+ export declare const useSafePromise: ({ cancelPrevious, cancelOnUnmount }?: Options) => <T>(promise: Promise<T>) => Promise<T>;
6
+ export {};
@@ -1,18 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { Entity } from '@reltio/mdm-sdk';
3
+ declare type Props = {
4
+ className?: string;
5
+ entity?: Entity;
6
+ children?: ReactNode;
7
+ };
8
+ declare const ProfileBand: ({ className, entity, children }: Props) => JSX.Element;
1
9
  export default ProfileBand;
2
- declare function ProfileBand({ className, entity, children, classes, showEntityId }: {
3
- className: any;
4
- entity: any;
5
- children: any;
6
- classes: any;
7
- showEntityId?: boolean;
8
- }): JSX.Element;
9
- declare namespace ProfileBand {
10
- namespace propTypes {
11
- const className: PropTypes.Requireable<string>;
12
- const entity: PropTypes.Requireable<object>;
13
- const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
14
- const classes: PropTypes.Requireable<object>;
15
- const showEntityId: PropTypes.Requireable<boolean>;
16
- }
17
- }
18
- import PropTypes from "prop-types";
@@ -1,5 +1,4 @@
1
1
  import React, { useCallback } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import classnames from 'classnames';
4
3
  import { useSelector } from 'react-redux';
5
4
  import { isNil } from 'ramda';
@@ -13,9 +12,10 @@ import EntityTypeBadge from '../EntityTypeBadge/EntityTypeBadge';
13
12
  import useStyles from './styles';
14
13
  var ProfileBand = function (_a) {
15
14
  var _b;
16
- var className = _a.className, entity = _a.entity, children = _a.children, classes = _a.classes, _c = _a.showEntityId, showEntityId = _c === void 0 ? true : _c;
17
- var styles = useStyles({ classes: classes });
15
+ var className = _a.className, entity = _a.entity, children = _a.children;
16
+ var styles = useStyles();
18
17
  var metadata = useSelector(mdmModule.selectors.getMetadata);
18
+ var showEntityId = useSelector(mdmModule.selectors.getShowEntityId);
19
19
  var handleCopyEntityIdToClipboard = useCallback(function () {
20
20
  navigator.clipboard.writeText(getEntityId(entity));
21
21
  }, [entity]);
@@ -48,11 +48,4 @@ var ProfileBand = function (_a) {
48
48
  entityId)))))),
49
49
  children && React.createElement("div", null, children))));
50
50
  };
51
- ProfileBand.propTypes = {
52
- className: PropTypes.string,
53
- entity: PropTypes.object,
54
- children: PropTypes.node,
55
- classes: PropTypes.object,
56
- showEntityId: PropTypes.bool
57
- };
58
51
  export default ProfileBand;
@@ -1,2 +1,2 @@
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "entityType" | "profileBand" | "secondaryLabel" | "inactive" | "entityId" | "badge" | "profileIcon" | "profileBandWrapper" | "imageProfileIcon" | "profileInfo" | "businessCard" | "specialInfo">;
1
2
  export default useStyles;
2
- declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "entityType" | "profileBand" | "secondaryLabel" | "inactive" | "entityId" | "badge" | "profileIcon" | "businessCard" | "profileBandWrapper" | "imageProfileIcon" | "profileInfo" | "specialInfo">;
@@ -1,5 +1,5 @@
1
1
  import { makeStyles } from '@material-ui/core/styles';
2
- var useStyles = makeStyles(function (theme) { return ({
2
+ export var useStyles = makeStyles(function (theme) { return ({
3
3
  profileBandWrapper: {
4
4
  // especially for IE (overflow fix)
5
5
  flexShrink: 0
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "item" | "image" | "secondaryLabel" | "inactive" | "selected" | "avatar" | "clickable" | "info" | "@keyframes animate" | "highlighted" | "justImported" | "businessCard" | "secondRow">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "item" | "image" | "secondaryLabel" | "inactive" | "selected" | "avatar" | "clickable" | "info" | "businessCard" | "@keyframes animate" | "highlighted" | "justImported" | "secondRow">;
@@ -14,17 +14,19 @@ import { useSelector } from 'react-redux';
14
14
  import ActivityLogFilterHeader from './ActivityLogFilterHeader';
15
15
  import ActivityFilterEditor from '../ActivityFilterEditor/ActivityFilterEditor';
16
16
  import ActivityExportButton from '../ActivityExportButton/ActivityExportButton';
17
+ import { equals } from 'ramda';
17
18
  import mdmModule from '@reltio/mdm-module';
18
19
  var ActivityLogFilter = function (_a) {
19
20
  var value = _a.value, entityType = _a.entityType, entityUri = _a.entityUri, onChange = _a.onChange, exportTypes = _a.exportTypes;
20
21
  var initialValue = useRef(value);
22
+ var isApplied = !equals(value, initialValue.current);
21
23
  var canExport = useSelector(mdmModule.selectors.getCanUserMakeActivitiesExport);
22
24
  var _b = useState(false), isEditorOpen = _b[0], setIsEditorOpen = _b[1];
23
25
  var handleClear = function () { return onChange(__assign({}, initialValue.current)); };
24
26
  var handleCancel = function () { return setIsEditorOpen(false); };
25
27
  var handleToggleFilter = function () { return setIsEditorOpen(function (isEditorOpen) { return !isEditorOpen; }); };
26
28
  return (React.createElement(React.Fragment, null,
27
- React.createElement(ActivityLogFilterHeader, { onToggle: handleToggleFilter, filters: value }, canExport && React.createElement(ActivityExportButton, { filters: __assign(__assign({}, value), { entityUri: entityUri }), exportTypes: exportTypes })),
29
+ React.createElement(ActivityLogFilterHeader, { onToggle: handleToggleFilter, filters: value, isApplied: isApplied }, canExport && React.createElement(ActivityExportButton, { filters: __assign(__assign({}, value), { entityUri: entityUri }), exportTypes: exportTypes })),
28
30
  React.createElement(ActivityFilterEditor, { value: value, open: isEditorOpen, entityType: entityType, onApply: onChange, onCancel: handleCancel, onClear: handleClear })));
29
31
  };
30
32
  export default ActivityLogFilter;
@@ -4,6 +4,7 @@ declare type Props = {
4
4
  onToggle: () => void;
5
5
  filters: ActivitiesFilter;
6
6
  children?: React.ReactNode;
7
+ isApplied?: boolean;
7
8
  };
8
- declare const ActivityLogFilterHeader: ({ children, onToggle, filters }: Props) => JSX.Element;
9
+ declare const ActivityLogFilterHeader: ({ children, onToggle, filters, isApplied }: Props) => JSX.Element;
9
10
  export default ActivityLogFilterHeader;
@@ -5,9 +5,10 @@ import Typography from '@material-ui/core/Typography';
5
5
  import FilterListIcon from '@material-ui/icons/FilterList';
6
6
  import { getFilterLabel } from './helpers';
7
7
  import { SmallIconButtonWithTooltip } from '../../SmallIconButton';
8
+ import classnames from 'classnames';
8
9
  import { useStyles } from './styles';
9
10
  var ActivityLogFilterHeader = function (_a) {
10
- var children = _a.children, onToggle = _a.onToggle, filters = _a.filters;
11
+ var children = _a.children, onToggle = _a.onToggle, filters = _a.filters, _b = _a.isApplied, isApplied = _b === void 0 ? false : _b;
11
12
  var styles = useStyles();
12
13
  var filterLabel = getFilterLabel(filters);
13
14
  return (React.createElement("div", { className: styles.header },
@@ -16,6 +17,6 @@ var ActivityLogFilterHeader = function (_a) {
16
17
  React.createElement(Typography, { variant: "body2", className: styles.label, color: "textSecondary", display: "block", noWrap: true }, filterLabel)),
17
18
  React.createElement("div", { className: styles.buttonsWrapper },
18
19
  children,
19
- React.createElement(SmallIconButtonWithTooltip, { icon: FilterListIcon, size: "L", onClick: onToggle, tooltipTitle: i18n.text('Filter'), className: styles.icon }))));
20
+ React.createElement(SmallIconButtonWithTooltip, { icon: FilterListIcon, size: "L", onClick: onToggle, tooltipTitle: i18n.text('Filter'), className: classnames(styles.icon, { activeIcon: isApplied }) }))));
20
21
  };
21
22
  export default ActivityLogFilterHeader;
@@ -1,5 +1,5 @@
1
- import { makeStyles } from '@material-ui/core/styles';
2
- export var useStyles = makeStyles(function () { return ({
1
+ import { fade, makeStyles } from '@material-ui/core/styles';
2
+ export var useStyles = makeStyles(function (theme) { return ({
3
3
  header: {
4
4
  width: 'auto',
5
5
  display: 'flex',
@@ -10,7 +10,11 @@ export var useStyles = makeStyles(function () { return ({
10
10
  fontSize: '14px'
11
11
  },
12
12
  icon: {
13
- margin: '4px'
13
+ margin: '4px',
14
+ '&.activeIcon': {
15
+ backgroundColor: fade(theme.palette.primary.main, 0.12),
16
+ color: '#0072CE'
17
+ }
14
18
  },
15
19
  buttonsWrapper: {
16
20
  marginLeft: 'auto',
@@ -5,7 +5,7 @@ declare type AssigneeOption = {
5
5
  };
6
6
  export declare const useWorkflowAssignee: ({ assignee, taskId, isOpen }: Partial<Pick<WorkflowTaskData, 'taskId' | 'assignee' | 'isOpen'>>) => {
7
7
  assignee: AssigneeOption;
8
- getAssignees: (text: any) => Promise<void | unknown[]>;
8
+ getAssignees: (text: any) => Promise<void | AssigneeOption[]>;
9
9
  updateAssignee: (newValue: AssigneeOption) => void;
10
10
  updateRequestIsInProgress: boolean;
11
11
  readOnly: boolean;
@@ -10,4 +10,5 @@ export declare const useAPI: (config?: CustomViewConfig) => {
10
10
  pointerEvents?: CSSProperties['pointerEvents'];
11
11
  };
12
12
  onClick: () => void;
13
+ popup: HTMLElement;
13
14
  };
@@ -23,9 +23,11 @@ export var useAPI = function (config) {
23
23
  if (config === void 0) { config = {}; }
24
24
  var _c = useState(), html = _c[0], setHtml = _c[1];
25
25
  var _d = useState([]), listenersToReset = _d[0], setListenersToReset = _d[1];
26
- var _e = useState(true), visible = _e[0], setVisible = _e[1];
27
- var _f = useState(null), tooltip = _f[0], setTooltip = _f[1];
28
- var _g = useState({}), customStyles = _g[0], setCustomStyles = _g[1];
26
+ var _e = useState([]), popupListenersToReset = _e[0], setPopupListenersToReset = _e[1];
27
+ var _f = useState(true), visible = _f[0], setVisible = _f[1];
28
+ var _g = useState(), popup = _g[0], setPopup = _g[1];
29
+ var _h = useState(null), tooltip = _h[0], setTooltip = _h[1];
30
+ var _j = useState({}), customStyles = _j[0], setCustomStyles = _j[1];
29
31
  var workerRef = useRef();
30
32
  var requestListeners = useRef({});
31
33
  var responseListeners = useRef({});
@@ -46,11 +48,12 @@ export var useAPI = function (config) {
46
48
  var user = useSelector(mdmModule.selectors.getUser);
47
49
  var entityUri = useSelector(mdmModule.selectors.getEntityUri);
48
50
  var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
49
- var _h = useSelector(mdmModule.selectors.getSearchProviderData) || {}, typeSearch = _h.type, search = _h.data;
51
+ var _k = useSelector(mdmModule.selectors.getSearchProviderData) || {}, typeSearch = _k.type, search = _k.data;
50
52
  var isOldUI = !isNewUI(servicesPath);
51
53
  var supportedInterceptHandlers = isOldUI ? qxApi.interceptors : interceptHandlers;
52
54
  var openSearch = function (search) { return dispatch(ui.actions.openSearch(search)); };
53
55
  var innerText = '';
56
+ var popupText = '';
54
57
  var process = function (_a) {
55
58
  var _b, _c;
56
59
  var task = _a.task, worker = _a.worker;
@@ -74,10 +77,33 @@ export var useAPI = function (config) {
74
77
  }
75
78
  break;
76
79
  }
80
+ case CustomAction.SHOW_POPUP: {
81
+ popupText = task.params;
82
+ resetHtml({
83
+ worker: worker,
84
+ setTooltip: setTooltip,
85
+ html: task.params,
86
+ innerText: popupText,
87
+ setListenersToReset: setPopupListenersToReset,
88
+ setHtml: setPopup
89
+ });
90
+ break;
91
+ }
92
+ case CustomAction.HIDE_POPUP: {
93
+ popupText = '';
94
+ setPopup(null);
95
+ break;
96
+ }
77
97
  case CustomAction.SET_VISIBILITY: {
78
98
  if (task.params === 'visible') {
79
99
  setVisible(true);
80
- resetHtml({ worker: worker, setTooltip: setTooltip, innerText: innerText, setListenersToReset: setListenersToReset, setHtml: setHtml });
100
+ resetHtml({
101
+ worker: worker,
102
+ setTooltip: setTooltip,
103
+ innerText: innerText,
104
+ setListenersToReset: setListenersToReset,
105
+ setHtml: setHtml
106
+ });
81
107
  }
82
108
  else {
83
109
  setVisible(false);
@@ -182,6 +208,10 @@ export var useAPI = function (config) {
182
208
  useEffect(function () { return function () {
183
209
  listenersToReset.forEach(function (listener) { return listener(); });
184
210
  }; }, [listenersToReset]);
211
+ //we need to have separate handlers in opposite case main window listeners will be removed on the popup appear
212
+ useEffect(function () { return function () {
213
+ popupListenersToReset.forEach(function (listener) { return listener(); });
214
+ }; }, [popupListenersToReset, listenersToReset]);
185
215
  var onClick = useCallback(function () {
186
216
  var _a;
187
217
  (_a = workerRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({
@@ -213,5 +243,5 @@ export var useAPI = function (config) {
213
243
  }
214
244
  }
215
245
  }, [config]);
216
- return { html: html, visible: visible, tooltip: tooltip, customStyles: customStyles, onClick: onClick };
246
+ return { html: html, visible: visible, tooltip: tooltip, customStyles: customStyles, onClick: onClick, popup: popup };
217
247
  };
@@ -37,15 +37,11 @@ export var useCommentsEntitiesMap = function (comments) {
37
37
  }, [safePromise]);
38
38
  var getNotFoundEntity = function (entityUri) {
39
39
  return getEntity(entityUri, { options: SELECT_OPTION })
40
- .then(function (entity) { return ({
41
- uri: entityUri,
42
- label: entity.label,
43
- type: entity.type
44
- }); })
40
+ .then(function (entity) { return (__assign(__assign({}, entity), { uri: entityUri })); })
45
41
  .catch(function () { return ({}); });
46
42
  };
47
43
  var addNotFoundEntities = useCallback(function (entitiesUris, entities) {
48
- return safePromise(Promise.all((entitiesUris || []).map(getNotFoundEntity))).then(pipe(reject(isEmpty), concat(entities)));
44
+ return safePromise(Promise.all((entitiesUris || []).map(getNotFoundEntity))).then(function (notFoundEntities) { return pipe(reject(isEmpty), concat(entities))(notFoundEntities); });
49
45
  }, [safePromise]);
50
46
  useEffect(function () {
51
47
  var uniqEntitiesUris = pipe(reduce(function (entitiesUris, comment) {
@@ -160,7 +160,7 @@ export var useCustomScripts = function (config) {
160
160
  url: fakeURL,
161
161
  method: options.method,
162
162
  headers: __assign(__assign({}, options.headers), { origin: 'ui', requestId: requestId, actionId: actionId }),
163
- data: options
163
+ data: options.body
164
164
  });
165
165
  }
166
166
  else {
@@ -1,4 +1,6 @@
1
- export function useSafePromise({ cancelPrevious, cancelOnUnmount }?: {
1
+ declare type Options = {
2
2
  cancelPrevious?: boolean;
3
3
  cancelOnUnmount?: boolean;
4
- }): (promise: any) => Promise<any>;
4
+ };
5
+ export declare const useSafePromise: ({ cancelPrevious, cancelOnUnmount }?: Options) => <T>(promise: Promise<T>) => Promise<T>;
6
+ export {};
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1248",
3
+ "version": "1.4.1251",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
7
7
  "dependencies": {
8
8
  "@date-io/moment": "^1.3.5",
9
9
  "@react-google-maps/api": "2.7.0",
10
- "@reltio/mdm-module": "^1.4.1248",
11
- "@reltio/mdm-sdk": "^1.4.1248",
10
+ "@reltio/mdm-module": "^1.4.1251",
11
+ "@reltio/mdm-sdk": "^1.4.1251",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",