@reltio/components 1.4.1896 → 1.4.1897

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 (27) hide show
  1. package/cjs/ModeSwitcherSelect/ModeSwitcherSelect.d.ts +2 -1
  2. package/cjs/ModeSwitcherSelect/ModeSwitcherSelect.js +4 -3
  3. package/cjs/ModeSwitcherSelect/ModeSwitcherSelect.test.js +232 -89
  4. package/cjs/ModeSwitcherSelect/styles.d.ts +1 -1
  5. package/cjs/ModeSwitcherSelect/styles.js +18 -0
  6. package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
  7. package/cjs/contexts/MdmModuleContext/hooks.d.ts +2 -1
  8. package/cjs/features/history/HistoryGraph/components/HistoryCircle/HistoryCircle.js +1 -1
  9. package/cjs/features/history/HistoryRow/HistoryRow.js +3 -1
  10. package/cjs/features/history/HistoryTree/HistoryTree.js +2 -7
  11. package/cjs/features/history/HistoryTree/HistoryTree.specs.js +141 -223
  12. package/cjs/features/workflow/WorkflowComments/WorkflowComments.js +1 -1
  13. package/cjs/features/workflow/WorkflowComments/WorkflowCommments.spec.js +6 -0
  14. package/esm/ModeSwitcherSelect/ModeSwitcherSelect.d.ts +2 -1
  15. package/esm/ModeSwitcherSelect/ModeSwitcherSelect.js +4 -3
  16. package/esm/ModeSwitcherSelect/ModeSwitcherSelect.test.js +232 -89
  17. package/esm/ModeSwitcherSelect/styles.d.ts +1 -1
  18. package/esm/ModeSwitcherSelect/styles.js +18 -0
  19. package/esm/contexts/MdmModuleContext/context.d.ts +2 -0
  20. package/esm/contexts/MdmModuleContext/hooks.d.ts +2 -1
  21. package/esm/features/history/HistoryGraph/components/HistoryCircle/HistoryCircle.js +1 -1
  22. package/esm/features/history/HistoryRow/HistoryRow.js +3 -1
  23. package/esm/features/history/HistoryTree/HistoryTree.js +2 -7
  24. package/esm/features/history/HistoryTree/HistoryTree.specs.js +141 -223
  25. package/esm/features/workflow/WorkflowComments/WorkflowComments.js +1 -1
  26. package/esm/features/workflow/WorkflowComments/WorkflowCommments.spec.js +6 -0
  27. package/package.json +2 -2
@@ -1,3 +1,50 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
1
48
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
49
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
50
  if (ar || !(i in from)) {
@@ -8,105 +55,201 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
8
55
  return to.concat(ar || Array.prototype.slice.call(from));
9
56
  };
10
57
  import React from 'react';
11
- import { shallow } from 'enzyme';
12
- import Select from '@mui/material/Select';
58
+ import { render, screen, within } from '@testing-library/react';
59
+ import userEvent from '@testing-library/user-event';
60
+ import AddIcon from '@mui/icons-material/Add';
13
61
  import CreateIcon from '@mui/icons-material/Create';
14
62
  import VisibilityIcon from '@mui/icons-material/Visibility';
15
63
  import DeleteIcon from '@mui/icons-material/Delete';
64
+ import { getMuiIconByName } from '../test-utils';
16
65
  import { ModeSwitcherSelect } from './ModeSwitcherSelect';
66
+ var optionsGroup = [
67
+ {
68
+ label: 'Editing label',
69
+ value: 'Editing',
70
+ description: 'Edit profile directly',
71
+ icon: CreateIcon
72
+ },
73
+ {
74
+ label: 'Suggesting label',
75
+ value: 'Suggesting',
76
+ description: 'Suggest changes and initiate a workflow review',
77
+ icon: AddIcon
78
+ },
79
+ {
80
+ label: 'Viewing label',
81
+ value: 'Viewing',
82
+ description: 'Read or print profile',
83
+ icon: VisibilityIcon
84
+ }
85
+ ];
86
+ var buttonsGroup = [
87
+ {
88
+ label: 'Delete label',
89
+ value: 'Delete',
90
+ description: 'Permanently delete profile',
91
+ icon: DeleteIcon,
92
+ onClick: jest.fn()
93
+ },
94
+ {
95
+ label: 'Clone label',
96
+ value: 'Clone',
97
+ description: 'Clone profile',
98
+ icon: CreateIcon,
99
+ onClick: jest.fn()
100
+ }
101
+ ];
102
+ var defaultProps = {
103
+ optionsGroup: optionsGroup,
104
+ buttonsGroup: buttonsGroup,
105
+ value: 'Viewing',
106
+ onChange: jest.fn()
107
+ };
108
+ var setUp = function (props) {
109
+ if (props === void 0) { props = {}; }
110
+ var user = userEvent.setup();
111
+ return __assign({ user: user }, render(React.createElement(ModeSwitcherSelect, __assign({}, defaultProps, props))));
112
+ };
17
113
  describe('ModeSwitcherSelect tests', function () {
18
- var onClick = jest.fn();
19
- var optionsGroup = [
20
- {
21
- label: 'Editing label',
22
- value: 'Editing',
23
- description: 'Edit profile directly',
24
- icon: CreateIcon
25
- },
26
- {
27
- label: 'Suggesting label',
28
- value: 'Suggesting',
29
- description: 'Suggest changes and initiate a workflow review',
30
- icon: CreateIcon
31
- },
32
- {
33
- label: 'Viewing label',
34
- value: 'Viewing',
35
- description: 'Read or print profile',
36
- icon: VisibilityIcon
37
- }
38
- ];
39
- var buttonsGroup = [
40
- {
41
- label: 'Delete label',
42
- value: 'Delete',
43
- description: 'Permanently delete profile',
44
- icon: DeleteIcon,
45
- onClick: onClick
46
- }
47
- ];
48
- it('should render optionsGroups', function () {
49
- var component = shallow(React.createElement(ModeSwitcherSelect, { optionsGroup: optionsGroup, buttonsGroup: [], value: "Viewing" }));
50
- var menuItems = component.find('.menuItem');
51
- expect(menuItems.length).toBe(3);
52
- menuItems.forEach(function (node, idx) {
53
- expect(node.find(optionsGroup[idx].icon)).toHaveLength(1);
54
- expect(node.find('.menuItemLabel').text()).toBe(optionsGroup[idx].label);
55
- expect(node.find('.menuItemDescription').text()).toBe(optionsGroup[idx].description);
56
- });
114
+ beforeEach(function () {
115
+ jest.clearAllMocks();
57
116
  });
58
- it('should render optionsGroup and buttonsGroup', function () {
59
- var component = shallow(React.createElement(ModeSwitcherSelect, { optionsGroup: optionsGroup, buttonsGroup: buttonsGroup, value: "Viewing" }));
60
- var menuItems = component.find('.menuItem');
61
- expect(menuItems.length).toBe(4);
62
- var optionsAndButtonsGroup = __spreadArray(__spreadArray([], optionsGroup, true), buttonsGroup, true);
63
- menuItems.forEach(function (node, idx) {
64
- expect(node.find(optionsAndButtonsGroup[idx].icon)).toHaveLength(1);
65
- expect(node.find('.menuItemLabel').text()).toBe(optionsAndButtonsGroup[idx].label);
66
- expect(node.find('.menuItemDescription').text()).toBe(optionsAndButtonsGroup[idx].description);
117
+ it('should render optionsGroups', function () { return __awaiter(void 0, void 0, void 0, function () {
118
+ var user, button, options;
119
+ return __generator(this, function (_a) {
120
+ switch (_a.label) {
121
+ case 0:
122
+ user = setUp({ buttonsGroup: [] }).user;
123
+ button = screen.getByText('Viewing label');
124
+ return [4 /*yield*/, user.click(button)];
125
+ case 1:
126
+ _a.sent();
127
+ options = screen.getAllByRole('option');
128
+ expect(options.length).toBe(3);
129
+ expect(getMuiIconByName('Create', options[0])).toBeInTheDocument();
130
+ expect(getMuiIconByName('Add', options[1])).toBeInTheDocument();
131
+ expect(getMuiIconByName('Visibility', options[2])).toBeInTheDocument();
132
+ options.forEach(function (item, i) {
133
+ within(item).getByText(optionsGroup[i].label);
134
+ within(item).getByText(optionsGroup[i].description);
135
+ });
136
+ return [2 /*return*/];
137
+ }
67
138
  });
68
- });
69
- it('should get current value on ModeSwitcherSelect change', function () {
70
- var onChange = jest.fn();
71
- var component = shallow(React.createElement(ModeSwitcherSelect, { optionsGroup: optionsGroup, buttonsGroup: buttonsGroup, value: "Editing", onChange: onChange }));
72
- var select = component.find(Select);
73
- select.simulate('change', { target: { value: 'Viewing' } });
74
- expect(onChange.mock.calls.length).toBe(1);
75
- expect(onChange).toHaveBeenCalledWith('Viewing');
76
- });
77
- it('button onClick event should work correctly', function () {
78
- var component = shallow(React.createElement(ModeSwitcherSelect, { optionsGroup: optionsGroup, buttonsGroup: buttonsGroup, value: "Editing" }));
79
- var button = component.find('.menuItem').findWhere(function (n) { return n.prop('value') === 'Delete'; });
80
- button.simulate('click');
81
- expect(onClick.mock.calls.length).toBe(1);
82
- expect(onClick).toHaveBeenCalledWith('Delete');
83
- });
84
- it('should first button has .firstMenuItemButton className and options hasn`t', function () {
85
- var component = shallow(React.createElement(ModeSwitcherSelect, { optionsGroup: optionsGroup, buttonsGroup: buttonsGroup, value: "Viewing" }));
86
- var menuItems = component.find('.menuItem');
87
- menuItems.forEach(function (node, idx) {
88
- var isFirstButton = idx === 3;
89
- if (isFirstButton) {
90
- expect(node.hasClass('firstMenuItemButton')).toBe(true);
139
+ }); });
140
+ it('should render optionsGroup and buttonsGroup', function () { return __awaiter(void 0, void 0, void 0, function () {
141
+ var user, button, options, allOptions;
142
+ return __generator(this, function (_a) {
143
+ switch (_a.label) {
144
+ case 0:
145
+ user = setUp().user;
146
+ button = screen.getByText('Viewing label');
147
+ return [4 /*yield*/, user.click(button)];
148
+ case 1:
149
+ _a.sent();
150
+ options = screen.getAllByRole('option');
151
+ expect(options.length).toBe(5);
152
+ expect(getMuiIconByName('Create', options[0])).toBeInTheDocument();
153
+ expect(getMuiIconByName('Add', options[1])).toBeInTheDocument();
154
+ expect(getMuiIconByName('Visibility', options[2])).toBeInTheDocument();
155
+ expect(getMuiIconByName('Delete', options[3])).toBeInTheDocument();
156
+ expect(getMuiIconByName('Create', options[4])).toBeInTheDocument();
157
+ allOptions = __spreadArray(__spreadArray([], optionsGroup, true), buttonsGroup, true);
158
+ options.forEach(function (item, i) {
159
+ within(item).getByText(allOptions[i].label);
160
+ within(item).getByText(allOptions[i].description);
161
+ });
162
+ return [2 /*return*/];
91
163
  }
92
- else {
93
- expect(node.hasClass('firstMenuItemButton')).toBe(false);
164
+ });
165
+ }); });
166
+ it('should call onChange with correct value', function () { return __awaiter(void 0, void 0, void 0, function () {
167
+ var user, button;
168
+ return __generator(this, function (_a) {
169
+ switch (_a.label) {
170
+ case 0:
171
+ user = setUp().user;
172
+ button = screen.getByText('Viewing label');
173
+ return [4 /*yield*/, user.click(button)];
174
+ case 1:
175
+ _a.sent();
176
+ return [4 /*yield*/, user.click(screen.getByText('Suggesting label'))];
177
+ case 2:
178
+ _a.sent();
179
+ expect(defaultProps.onChange).toHaveBeenCalledWith('Suggesting');
180
+ return [2 /*return*/];
94
181
  }
95
182
  });
183
+ }); });
184
+ it('button onClick event should work correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
185
+ var user, button;
186
+ return __generator(this, function (_a) {
187
+ switch (_a.label) {
188
+ case 0:
189
+ user = setUp().user;
190
+ button = screen.getByText('Viewing label');
191
+ return [4 /*yield*/, user.click(button)];
192
+ case 1:
193
+ _a.sent();
194
+ return [4 /*yield*/, user.click(screen.getByText('Delete label'))];
195
+ case 2:
196
+ _a.sent();
197
+ expect(defaultProps.onChange).not.toHaveBeenCalled();
198
+ expect(buttonsGroup[0].onClick).toHaveBeenCalled();
199
+ return [2 /*return*/];
200
+ }
201
+ });
202
+ }); });
203
+ it('should first button has .firstMenuItemButton className and options hasn`t', function () { return __awaiter(void 0, void 0, void 0, function () {
204
+ var user, button, options;
205
+ return __generator(this, function (_a) {
206
+ switch (_a.label) {
207
+ case 0:
208
+ user = setUp().user;
209
+ button = screen.getByText('Viewing label');
210
+ return [4 /*yield*/, user.click(button)];
211
+ case 1:
212
+ _a.sent();
213
+ options = screen.getAllByRole('option');
214
+ expect(options[2]).not.toHaveClass('firstMenuItemButton');
215
+ expect(options[3]).toHaveClass('firstMenuItemButton');
216
+ expect(options[4]).not.toHaveClass('firstMenuItemButton');
217
+ return [2 /*return*/];
218
+ }
219
+ });
220
+ }); });
221
+ it('should render current value correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
222
+ var user;
223
+ return __generator(this, function (_a) {
224
+ switch (_a.label) {
225
+ case 0:
226
+ user = setUp({ value: 'Suggesting' }).user;
227
+ return [4 /*yield*/, user.click(screen.getByText('Suggesting label'))];
228
+ case 1:
229
+ _a.sent();
230
+ screen.getByRole('option', {
231
+ name: 'Suggesting label Suggest changes and initiate a workflow review',
232
+ selected: true
233
+ });
234
+ screen.getByRole('option', { name: 'Viewing label Read or print profile', selected: false });
235
+ return [2 /*return*/];
236
+ }
237
+ });
238
+ }); });
239
+ it('should not crash when current value is not from options/buttons', function () { return __awaiter(void 0, void 0, void 0, function () {
240
+ return __generator(this, function (_a) {
241
+ setUp({ value: 'NonExisting' });
242
+ expect(screen.getByRole('button')).toHaveTextContent('NonExisting');
243
+ return [2 /*return*/];
244
+ });
245
+ }); });
246
+ it('should disable button', function () {
247
+ setUp({ disabled: true });
248
+ expect(screen.getByRole('button')).toHaveClass('Mui-disabled');
96
249
  });
97
- it('should render current value correctly', function () {
98
- var component = shallow(React.createElement(ModeSwitcherSelect, { optionsGroup: optionsGroup, buttonsGroup: buttonsGroup, value: "Viewing" }));
99
- var select = component.find(Select);
100
- var renderValue = function () { return select.renderProp('renderValue')(select.prop('value')); };
101
- expect(renderValue().find('.currentValue')).toHaveLength(1);
102
- expect(renderValue().find(VisibilityIcon)).toHaveLength(1);
103
- expect(renderValue().find('.currentValueText').text()).toBe('Viewing label');
104
- });
105
- it('should not crash when current value is not from options/buttons', function () {
106
- var component = shallow(React.createElement(ModeSwitcherSelect, { optionsGroup: optionsGroup, buttonsGroup: buttonsGroup, value: "Viewing1" }));
107
- var select = component.find(Select);
108
- var renderValue = function () { return select.renderProp('renderValue')(select.prop('value')); };
109
- expect(renderValue().find('.currentValue')).toHaveLength(1);
110
- expect(renderValue().find('.currentValueText').text()).toBe('Viewing1');
250
+ it('should show loader instead of icon', function () {
251
+ setUp({ loading: true });
252
+ screen.getByTestId('mode-loading-spinner');
253
+ expect(getMuiIconByName('Visibility', screen.getByRole('button'))).not.toBeInTheDocument();
111
254
  });
112
255
  });
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"normal" | "thin" | "root" | "menuItem" | "outlined" | "currentValue" | "arrowIcon" | "currentValueIcon" | "currentValueText" | "firstMenuItemButton" | "menuItemInner" | "menuItemIcon" | "menuItemLabel" | "menuItemDescription">;
1
+ export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"normal" | "thin" | "select" | "root" | "menuItem" | "outlined" | "currentValue" | "arrowIcon" | "currentValueIcon" | "currentValueText" | "firstMenuItemButton" | "menuItemInner" | "menuItemIcon" | "menuItemLabel" | "menuItemDescription">;
@@ -7,6 +7,8 @@ export var useStyles = makeStyles(function (theme) { return ({
7
7
  normal: {},
8
8
  thin: {},
9
9
  root: {
10
+ display: 'inline-flex',
11
+ alignItems: 'center',
10
12
  maxWidth: CALCULATED_MAX_WIDTH_SELECT,
11
13
  '&$outlined': {
12
14
  minHeight: '1.1876em'
@@ -20,6 +22,16 @@ export var useStyles = makeStyles(function (theme) { return ({
20
22
  paddingBottom: '6px'
21
23
  }
22
24
  },
25
+ select: {
26
+ '&.Mui-disabled': {
27
+ '& .MuiOutlinedInput-notchedOutline': {
28
+ borderColor: theme.palette.text.disabled
29
+ },
30
+ '& $currentValueIcon, & $currentValueText': {
31
+ color: theme.palette.text.disabled
32
+ }
33
+ }
34
+ },
23
35
  outlined: {
24
36
  paddingRight: SELECT_PADDING_RIGHT,
25
37
  paddingLeft: SELECT_PADDING_LEFT
@@ -38,6 +50,9 @@ export var useStyles = makeStyles(function (theme) { return ({
38
50
  alignItems: 'center'
39
51
  },
40
52
  currentValueIcon: {
53
+ width: '1em',
54
+ height: '1em',
55
+ display: 'inline-block',
41
56
  fontSize: '18px',
42
57
  marginRight: '8px',
43
58
  color: theme.palette.text.secondary
@@ -63,6 +78,9 @@ export var useStyles = makeStyles(function (theme) { return ({
63
78
  alignItems: 'flex-start'
64
79
  },
65
80
  menuItemIcon: {
81
+ width: '1em',
82
+ height: '1em',
83
+ display: 'inline-block',
66
84
  fontSize: '18px',
67
85
  color: theme.palette.text.secondary,
68
86
  marginRight: '9px'
@@ -93,6 +93,7 @@ export type MdmModuleActionsContextProps = Partial<{
93
93
  errorSet: (payload: string) => void;
94
94
  setHistoryMode: (payload: HistoryMode) => void;
95
95
  modeUpdated: (payload: Mode) => void;
96
+ modeUpdateRequested: (payload: Mode) => void;
96
97
  setHistoryEvent: (payload: HistoryEvent) => void;
97
98
  clearHistoryEvent: () => void;
98
99
  clearHistoryDiff: () => void;
@@ -162,6 +163,7 @@ export declare const MdmModuleActionsContext: import("@fluentui/react-context-se
162
163
  errorSet: (payload: string) => void;
163
164
  setHistoryMode: (payload: HistoryMode) => void;
164
165
  modeUpdated: (payload: Mode) => void;
166
+ modeUpdateRequested: (payload: Mode) => void;
165
167
  setHistoryEvent: (payload: HistoryEvent) => void;
166
168
  clearHistoryEvent: () => void;
167
169
  clearHistoryDiff: () => void;
@@ -71,7 +71,7 @@ export declare const useMdmDependentLookupEditorContext: (attributeValue: Simple
71
71
  };
72
72
  export declare const useMdmGlobalSearchRequestOptions: (omittingFields?: string[]) => import("@reltio/mdm-sdk").GlobalSearchRequestOptions;
73
73
  export declare const useMdmAuthoringItemsByEntityType: (entityTypeUri: string) => import("@reltio/mdm-sdk").AuthoringItem[];
74
- export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent" | "openConsoleApp" | "addAttributes" | "modifyAttribute" | "removeAttribute" | "entityDeleted" | "entityCreated" | "errorDeactivated" | "requestNextPageOfAttributeValues" | "openEntity" | "setDefaultProfilePicForModifiedEntity" | "setDefaultProfilePicForEntity" | "dependentLookupsEditorTouched" | "openPivotingPerspective" | "lookupsLoaded" | "lookupsForTypeResolved" | "errorSet" | "setHistoryMode" | "modeUpdated" | "setHistoryEvent" | "clearHistoryEvent" | "clearHistoryDiff" | "setHistoryDiff" | "setHistorySlice" | "updateSearchNavigationDataFields" | "openPerspective" | "entityDeletionFinished" | "loadEntity" | "updateSearchNavigationDataOnMerge" | "lookupsListResolved" | "relationsLoaded" | "setInitialInfo" | "setRelationType" | "closeRelationEditor" | "openRelationEditor" | "setRelationEntity" | "errorsSet" | "addRelation" | "editRelation" | "updateHiddenAttributes" | "resetHiddenAttributes" | "updateControlAttributes">(action: T) => Partial<{
74
+ export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent" | "openConsoleApp" | "addAttributes" | "modifyAttribute" | "removeAttribute" | "entityDeleted" | "entityCreated" | "errorDeactivated" | "requestNextPageOfAttributeValues" | "openEntity" | "setDefaultProfilePicForModifiedEntity" | "setDefaultProfilePicForEntity" | "dependentLookupsEditorTouched" | "openPivotingPerspective" | "lookupsLoaded" | "lookupsForTypeResolved" | "errorSet" | "setHistoryMode" | "modeUpdated" | "modeUpdateRequested" | "setHistoryEvent" | "clearHistoryEvent" | "clearHistoryDiff" | "setHistoryDiff" | "setHistorySlice" | "updateSearchNavigationDataFields" | "openPerspective" | "entityDeletionFinished" | "loadEntity" | "updateSearchNavigationDataOnMerge" | "lookupsListResolved" | "relationsLoaded" | "setInitialInfo" | "setRelationType" | "closeRelationEditor" | "openRelationEditor" | "setRelationEntity" | "errorsSet" | "addRelation" | "editRelation" | "updateHiddenAttributes" | "resetHiddenAttributes" | "updateControlAttributes">(action: T) => Partial<{
75
75
  openSearch: (payload: import("@reltio/mdm-sdk").SearchState) => void;
76
76
  openHistoryEvent: (payload: {
77
77
  entityUri: string;
@@ -108,6 +108,7 @@ export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent"
108
108
  errorSet: (payload: string) => void;
109
109
  setHistoryMode: (payload: import("@reltio/mdm-sdk").HistoryMode) => void;
110
110
  modeUpdated: (payload: import("@reltio/mdm-sdk").Mode) => void;
111
+ modeUpdateRequested: (payload: import("@reltio/mdm-sdk").Mode) => void;
111
112
  setHistoryEvent: (payload: import("@reltio/mdm-sdk").HistoryEvent) => void;
112
113
  clearHistoryEvent: () => void;
113
114
  clearHistoryDiff: () => void;
@@ -25,7 +25,7 @@ import { BUMP_RADIUS, LINE_MARGIN } from './constants';
25
25
  export var HistoryCircle = forwardRef(function (_a, ref) {
26
26
  var x = _a.x, y = _a.y, color = _a.color, isDashed = _a.isDashed, isCollapsed = _a.isCollapsed, showCollapseIcon = _a.showCollapseIcon, showLine = _a.showLine, otherProps = __rest(_a, ["x", "y", "color", "isDashed", "isCollapsed", "showCollapseIcon", "showLine"]);
27
27
  var radius = showCollapseIcon ? BUMP_RADIUS * 2 : BUMP_RADIUS;
28
- return (React.createElement("g", __assign({}, otherProps, { ref: ref }),
28
+ return (React.createElement("g", __assign({ "data-reltio-id": "history-circle" }, otherProps, { ref: ref }),
29
29
  showLine && (React.createElement("rect", { id: "line", x: x - radius - LINE_MARGIN, y: y - radius - LINE_MARGIN, width: radius * 2 + LINE_MARGIN * 2, height: 2, fill: color })),
30
30
  React.createElement("circle", { cx: x, cy: y, r: radius, fill: isDashed ? '#fff' : color, stroke: color, strokeDasharray: isDashed ? '1,1' : undefined, strokeWidth: 2 }),
31
31
  showCollapseIcon && (React.createElement("g", { id: "icon" },
@@ -12,7 +12,9 @@ export var HistoryRow = function (_a) {
12
12
  var colorUri = fakeType && uris ? uris[0] : uri;
13
13
  var color = getContributorColor(colorUri);
14
14
  var styles = useStyles({ color: color });
15
- return (React.createElement("div", { className: classnames(styles.historyRow, (_b = {}, _b[styles.selected] = isSelected, _b)), onClick: onClick },
15
+ return (React.createElement("div", { "data-reltio-id": "history-row", className: classnames(styles.historyRow, (_b = {},
16
+ _b[styles.selected] = isSelected,
17
+ _b)), onClick: onClick },
16
18
  React.createElement("div", { className: styles.rowHeader },
17
19
  React.createElement("div", { className: styles.badge }),
18
20
  React.createElement(Typography, { className: classnames(styles.title, { bold: isCurrent }) }, isCurrent ? i18n.text('Current view') : getActivityLabel(type)),
@@ -30,7 +30,7 @@ export var HistoryTree = function (_a) {
30
30
  var _e = useState(-1), selectedIndex = _e[0], setSelectedIndex = _e[1];
31
31
  var setHistoryEvent = useMdmAction('setHistoryEvent');
32
32
  var clearHistoryEvent = useMdmAction('clearHistoryEvent');
33
- var modeUpdated = useMdmAction('modeUpdated');
33
+ var modeUpdateRequested = useMdmAction('modeUpdateRequested');
34
34
  var metadata = useMdmMetadata();
35
35
  var isEditableMode = useMdmIsEditableMode();
36
36
  useEffect(function () {
@@ -77,12 +77,7 @@ export var HistoryTree = function (_a) {
77
77
  };
78
78
  var handleHistoryRowClick = function (index, change, isSelected, isCurrent) {
79
79
  if (isEditableMode) {
80
- if (window.confirm(i18n.text('Are you sure you want to go in history mode? All your changes will be lost.'))) {
81
- modeUpdated(Mode.Viewing);
82
- }
83
- else {
84
- return;
85
- }
80
+ modeUpdateRequested(Mode.Viewing);
86
81
  }
87
82
  if ((isCurrent && !isSelected) || (!isCurrent && isSelected)) {
88
83
  clearHistoryEvent();