@reltio/components 1.4.2243 → 1.4.2244
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.
- package/ActivenessDateControl/ActivenessDateControl.d.ts +9 -0
- package/ActivenessDateControl/ActivenessDateControl.js +11 -0
- package/ActivenessDateControl/index.d.ts +1 -0
- package/ActivenessDateControl/index.js +1 -0
- package/EntitySelector/EntitySelector.d.ts +2 -1
- package/EntitySelector/EntitySelector.js +2 -2
- package/EntitySelector/index.d.ts +1 -0
- package/MoreAttributesButton/MoreAttributesButton.d.ts +3 -2
- package/MoreAttributesButton/MoreAttributesButton.js +8 -8
- package/MoreAttributesButton/useMoreAttributesItems.d.ts +4 -4
- package/cjs/ActivenessDateControl/ActivenessDateControl.d.ts +9 -0
- package/cjs/ActivenessDateControl/ActivenessDateControl.js +18 -0
- package/cjs/ActivenessDateControl/index.d.ts +1 -0
- package/cjs/ActivenessDateControl/index.js +5 -0
- package/cjs/EntitySelector/EntitySelector.d.ts +2 -1
- package/cjs/EntitySelector/EntitySelector.js +2 -2
- package/cjs/EntitySelector/index.d.ts +1 -0
- package/cjs/MoreAttributesButton/MoreAttributesButton.d.ts +3 -2
- package/cjs/MoreAttributesButton/MoreAttributesButton.js +8 -8
- package/cjs/MoreAttributesButton/useMoreAttributesItems.d.ts +4 -4
- package/cjs/features/activity-log/ActivityLog/ActivityLog.test.js +28 -0
- package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.js +22 -11
- package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.module.css.js +9 -0
- package/cjs/features/activity-log/ActivityLog/constants.d.ts +17 -0
- package/cjs/features/activity-log/ActivityLog/constants.js +20 -0
- package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +20 -9
- package/cjs/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.d.ts +7 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.js +67 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +3 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.module.css.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +25 -6
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.d.ts +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.js +79 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.js +5 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.d.ts +11 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.js +41 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.module.css.js +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.js +6 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +134 -5
- package/cjs/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/SkeletonEntityChangesGroupLoader.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/ChangeItemEditor.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.js +110 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.module.css.js +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.js +6 -5
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.d.ts +0 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.js +1 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.d.ts +8 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.js +89 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.js +5 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.js +12 -11
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/ChangeItemOldValue.module.css.js +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.js +5 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.d.ts +11 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.js +34 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.module.css.js +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.js +5 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/editors.module.css.js +9 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/index.d.ts +4 -0
- package/cjs/features/workflow/ChangeRequestEditor/components/editors/index.js +12 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/addedAttributes.d.ts +11 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +74 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.d.ts +2 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.js +157 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +203 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +6 -3
- package/cjs/features/workflow/ChangeRequestEditor/helpers/helpers.js +22 -3
- package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.d.ts +3 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.js +190 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.d.ts +1 -0
- package/cjs/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.js +768 -0
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +4 -3
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +9 -1
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.d.ts +18 -0
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.js +65 -0
- package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +7 -3
- package/cjs/features/workflow/contexts/AddedAttributesContext/index.d.ts +39 -0
- package/cjs/features/workflow/contexts/AddedAttributesContext/index.js +152 -0
- package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +3 -2
- package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.js +47 -7
- package/cjs/features/workflow/contexts/ScrollToAddedAttributeContext/index.d.ts +11 -0
- package/cjs/features/workflow/contexts/ScrollToAddedAttributeContext/index.js +78 -0
- package/cjs/features/workflow/helpers/attributes.js +16 -13
- package/cjs/features/workflow/helpers/attributes.test.js +6 -3
- package/cjs/features/workflow/helpers/dcr.d.ts +6 -1
- package/cjs/features/workflow/helpers/dcr.js +113 -18
- package/cjs/features/workflow/helpers/dcr.test.js +122 -0
- package/cjs/features/workflow/helpers/merge.d.ts +3 -0
- package/cjs/features/workflow/helpers/merge.js +32 -20
- package/cjs/features/workflow/helpers/merge.test.js +2 -1
- package/cjs/features/workflow/helpers/moreAttributesScope.d.ts +4 -0
- package/cjs/features/workflow/helpers/moreAttributesScope.js +20 -0
- package/cjs/features/workflow/helpers/validation.js +31 -6
- package/cjs/features/workflow/hooks/useApplyDcrChanges.d.ts +2 -2
- package/cjs/features/workflow/hooks/useApplyDcrChanges.js +80 -63
- package/cjs/features/workflow/types.d.ts +12 -2
- package/features/activity-log/ActivityLog/ActivityLog.test.js +28 -0
- package/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.js +15 -4
- package/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.module.css.js +9 -0
- package/features/activity-log/ActivityLog/constants.d.ts +17 -0
- package/features/activity-log/ActivityLog/constants.js +17 -0
- package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/ChangeRequestEditor.js +20 -9
- package/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.d.ts +7 -0
- package/features/workflow/ChangeRequestEditor/components/AddSameAttributeButton/AddSameAttributeButton.js +37 -0
- package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +3 -1
- package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.module.css.js +2 -2
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.d.ts +2 -2
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +26 -7
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
- package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.d.ts +9 -0
- package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/DCRImageEditor.js +49 -0
- package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/components/DCRImageEditor/index.js +1 -0
- package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +2 -2
- package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.js +2 -2
- package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.d.ts +11 -0
- package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.js +34 -0
- package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.module.css.js +9 -0
- package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/index.js +1 -0
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js +112 -6
- package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/SkeletonEntityChangesGroupLoader.js +1 -1
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/ChangeItemEditor.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.js +80 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditor/ChangeItemEditor.module.css.js +9 -0
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.js +6 -5
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.d.ts +0 -1
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/index.js +0 -1
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.d.ts +8 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/ChangeItemEditorRecentlyAdded.js +59 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemEditorRecentlyAdded/index.js +1 -0
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemOldValue}/ChangeItemOldValue.js +10 -9
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/ChangeItemOldValue.module.css.js +9 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.js +1 -0
- package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.d.ts +11 -0
- package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.js +27 -0
- package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/MoreAttributesEditor.module.css.js +9 -0
- package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/components/editors/MoreAttributesEditor/index.js +1 -0
- package/features/workflow/ChangeRequestEditor/components/editors/editors.module.css.js +9 -0
- package/features/workflow/ChangeRequestEditor/components/editors/index.d.ts +4 -0
- package/features/workflow/ChangeRequestEditor/components/editors/index.js +4 -0
- package/features/workflow/ChangeRequestEditor/helpers/addedAttributes.d.ts +11 -0
- package/features/workflow/ChangeRequestEditor/helpers/addedAttributes.js +62 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.d.ts +2 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.js +153 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.test.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/helpers/changesList.test.js +201 -0
- package/features/workflow/ChangeRequestEditor/helpers/helpers.d.ts +6 -3
- package/features/workflow/ChangeRequestEditor/helpers/helpers.js +19 -3
- package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.d.ts +3 -0
- package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.js +186 -0
- package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.d.ts +1 -0
- package/features/workflow/ChangeRequestEditor/helpers/mergeAddedAttributesWithDCRChanges.test.js +766 -0
- package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +4 -3
- package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.js +9 -1
- package/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.d.ts +18 -0
- package/features/workflow/ChangeRequestEditor/hooks/useNewAttributesEditor.js +61 -0
- package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +7 -3
- package/features/workflow/contexts/AddedAttributesContext/index.d.ts +39 -0
- package/features/workflow/contexts/AddedAttributesContext/index.js +125 -0
- package/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +3 -2
- package/features/workflow/contexts/ChangeRequestEditorContext/index.js +47 -7
- package/features/workflow/contexts/ScrollToAddedAttributeContext/index.d.ts +11 -0
- package/features/workflow/contexts/ScrollToAddedAttributeContext/index.js +51 -0
- package/features/workflow/helpers/attributes.js +16 -13
- package/features/workflow/helpers/attributes.test.js +6 -3
- package/features/workflow/helpers/dcr.d.ts +6 -1
- package/features/workflow/helpers/dcr.js +112 -18
- package/features/workflow/helpers/dcr.test.js +123 -1
- package/features/workflow/helpers/merge.d.ts +3 -0
- package/features/workflow/helpers/merge.js +30 -19
- package/features/workflow/helpers/merge.test.js +2 -1
- package/features/workflow/helpers/moreAttributesScope.d.ts +4 -0
- package/features/workflow/helpers/moreAttributesScope.js +14 -0
- package/features/workflow/helpers/validation.js +31 -6
- package/features/workflow/hooks/useApplyDcrChanges.d.ts +2 -2
- package/features/workflow/hooks/useApplyDcrChanges.js +83 -66
- package/features/workflow/types.d.ts +12 -2
- package/package.json +2 -2
- package/cjs/features/activity-log/ActivityLog/components/ActivityItem/styles.d.ts +0 -1
- package/cjs/features/activity-log/ActivityLog/components/ActivityItem/styles.js +0 -57
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +0 -95
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.module.css.js +0 -9
- package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.d.ts +0 -7
- package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.js +0 -21
- package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.module.css.js +0 -9
- package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/index.d.ts +0 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/StatusChips/index.js +0 -5
- package/features/activity-log/ActivityLog/components/ActivityItem/styles.d.ts +0 -1
- package/features/activity-log/ActivityLog/components/ActivityItem/styles.js +0 -54
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.js +0 -65
- package/features/workflow/ChangeRequestEditor/components/ChangeItemEditor/ChangeItemEditor.module.css.js +0 -9
- package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.d.ts +0 -7
- package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.js +0 -14
- package/features/workflow/ChangeRequestEditor/components/StatusChips/StatusChips.module.css.js +0 -9
- package/features/workflow/ChangeRequestEditor/components/StatusChips/index.d.ts +0 -1
- package/features/workflow/ChangeRequestEditor/components/StatusChips/index.js +0 -1
- /package/cjs/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.d.ts +0 -0
- /package/features/workflow/ChangeRequestEditor/components/{ChangeItemEditor → editors/ChangeItemEditor}/SkeletonChangeItemEditorLoader.d.ts +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import i18n from 'ui-i18n';
|
|
3
|
+
import CloudUploadIcon from '@mui/icons-material/CloudUpload';
|
|
4
|
+
import { DCROperationTypes, getImageAttributeThumbnailUrl } from '@reltio/mdm-sdk';
|
|
5
|
+
import { SmallIconButton } from '../../../../../SmallIconButton';
|
|
6
|
+
import { UploadImageDialog } from '../../../../../UploadImageDialog';
|
|
7
|
+
export var DCRImageEditor = function (_a) {
|
|
8
|
+
var change = _a.change, onUpload = _a.onUpload, disabled = _a.disabled;
|
|
9
|
+
var attributeType = change.attributeType;
|
|
10
|
+
var isDeleted = change.operation === DCROperationTypes.DELETED;
|
|
11
|
+
var thumbnailUrl = useMemo(function () {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
var innerChange = (_a = change.attributeValue) === null || _a === void 0 ? void 0 : _a.value;
|
|
14
|
+
var imageSource = (_b = innerChange === null || innerChange === void 0 ? void 0 : innerChange.newValue) !== null && _b !== void 0 ? _b : change.attributeValue;
|
|
15
|
+
return getImageAttributeThumbnailUrl((imageSource !== null && imageSource !== void 0 ? imageSource : {}));
|
|
16
|
+
}, [change.attributeValue]);
|
|
17
|
+
var _b = useState(false), isDialogOpen = _b[0], setIsDialogOpen = _b[1];
|
|
18
|
+
var _c = useState(null), uploadedThumbnailUrl = _c[0], setUploadedThumbnailUrl = _c[1];
|
|
19
|
+
var toggleDialog = useCallback(function () {
|
|
20
|
+
setIsDialogOpen(function (prev) { return !prev; });
|
|
21
|
+
}, []);
|
|
22
|
+
var handleUpload = useCallback(function (image) {
|
|
23
|
+
var imageValue = {};
|
|
24
|
+
var subAttributes = (attributeType === null || attributeType === void 0 ? void 0 : attributeType.attributes) || [];
|
|
25
|
+
var _loop_1 = function (key) {
|
|
26
|
+
if (subAttributes.some(function (_a) {
|
|
27
|
+
var name = _a.name;
|
|
28
|
+
return name === key;
|
|
29
|
+
})) {
|
|
30
|
+
imageValue[key] = [{ value: image[key] }];
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
for (var key in image) {
|
|
34
|
+
_loop_1(key);
|
|
35
|
+
}
|
|
36
|
+
onUpload({ value: imageValue });
|
|
37
|
+
setUploadedThumbnailUrl(image.CdnUrlThumbnail || image.CdnUrl || null);
|
|
38
|
+
}, [attributeType, onUpload]);
|
|
39
|
+
var isDisabled = disabled || isDeleted;
|
|
40
|
+
var displayUrl = uploadedThumbnailUrl || thumbnailUrl;
|
|
41
|
+
return (React.createElement(React.Fragment, null,
|
|
42
|
+
displayUrl ? (React.createElement("img", { src: displayUrl, alt: "", style: {
|
|
43
|
+
maxWidth: 80,
|
|
44
|
+
maxHeight: 80,
|
|
45
|
+
objectFit: 'cover',
|
|
46
|
+
cursor: isDisabled ? 'default' : 'pointer'
|
|
47
|
+
}, onClick: isDisabled ? undefined : toggleDialog })) : (React.createElement(SmallIconButton, { icon: CloudUploadIcon, onClick: toggleDialog, title: i18n.text('Upload image'), disabled: isDisabled })),
|
|
48
|
+
React.createElement(UploadImageDialog, { open: isDialogOpen, onUpload: handleUpload, onClose: toggleDialog })));
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DCRImageEditor } from './DCRImageEditor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DCRImageEditor } from './DCRImageEditor';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AttributeType, ChangeValue, DataTypeDefinition, PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
-
import { LineDataValue } from '../../../types';
|
|
2
|
+
import { type AttributeType, type ChangeValue, type DataTypeDefinition, type PrimitiveValue, type SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
+
import type { LineDataValue } from '../../../types';
|
|
4
4
|
type Props = {
|
|
5
5
|
attributeType: AttributeType;
|
|
6
6
|
value: LineDataValue | ChangeValue;
|
|
@@ -17,10 +17,10 @@ var DCRValueEditorFactory = /** @class */ (function () {
|
|
|
17
17
|
var handleChange = function (values) {
|
|
18
18
|
onChange((values === null || values === void 0 ? void 0 : values.map(prop('value'))) || []);
|
|
19
19
|
};
|
|
20
|
-
return (React.createElement(RolesInput, { value: wrapInArrayIfNeeded(dcrValue), onChange: handleChange, disabled: disabled }));
|
|
20
|
+
return (React.createElement(RolesInput, { value: dcrValue ? wrapInArrayIfNeeded(dcrValue) : [], onChange: handleChange, disabled: disabled }));
|
|
21
21
|
}
|
|
22
22
|
case EntityAttrTypes.tags.uri: {
|
|
23
|
-
return (React.createElement(TagsInput, { value: wrapInArrayIfNeeded(dcrValue), onChange: onChange, disabled: disabled }));
|
|
23
|
+
return (React.createElement(TagsInput, { value: dcrValue ? wrapInArrayIfNeeded(dcrValue) : [], onChange: onChange, disabled: disabled }));
|
|
24
24
|
}
|
|
25
25
|
default: {
|
|
26
26
|
var dataTypeDefinition = getDataTypeDefinition(attributeType, dcrValue);
|
package/features/workflow/ChangeRequestEditor/components/EditorStatusChip/EditorStatusChip.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum EditorStatus {
|
|
3
|
+
UPDATED = "updated",
|
|
4
|
+
REJECTED = "rejected",
|
|
5
|
+
RECENTLY_ADDED = "recentlyAdded"
|
|
6
|
+
}
|
|
7
|
+
type Props = {
|
|
8
|
+
status?: EditorStatus;
|
|
9
|
+
};
|
|
10
|
+
export declare const EditorStatusChip: ({ status }: Props) => React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import i18n from 'ui-i18n';
|
|
5
|
+
import Chip from '@mui/material/Chip';
|
|
6
|
+
import styles from './EditorStatusChip.module.css';
|
|
7
|
+
export var EditorStatus;
|
|
8
|
+
(function (EditorStatus) {
|
|
9
|
+
EditorStatus["UPDATED"] = "updated";
|
|
10
|
+
EditorStatus["REJECTED"] = "rejected";
|
|
11
|
+
EditorStatus["RECENTLY_ADDED"] = "recentlyAdded";
|
|
12
|
+
})(EditorStatus || (EditorStatus = {}));
|
|
13
|
+
var STATUS_CLASS = (_a = {},
|
|
14
|
+
_a[EditorStatus.UPDATED] = styles.updatedChip,
|
|
15
|
+
_a[EditorStatus.REJECTED] = styles.rejectedChip,
|
|
16
|
+
_a[EditorStatus.RECENTLY_ADDED] = styles.recentlyAddedChip,
|
|
17
|
+
_a);
|
|
18
|
+
var getStatusLabel = function (status) {
|
|
19
|
+
switch (status) {
|
|
20
|
+
case EditorStatus.UPDATED:
|
|
21
|
+
return i18n.text('Updated');
|
|
22
|
+
case EditorStatus.REJECTED:
|
|
23
|
+
return i18n.text('Rejected');
|
|
24
|
+
case EditorStatus.RECENTLY_ADDED:
|
|
25
|
+
return i18n.text('Recently Added');
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export var EditorStatusChip = function (_a) {
|
|
29
|
+
var status = _a.status;
|
|
30
|
+
if (!status) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return (React.createElement(Chip, { label: getStatusLabel(status), size: "small", className: classnames(styles.statusChip, STATUS_CLASS[status]), "data-testid": "editor-status-chip" }));
|
|
34
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const styles = {"statusChip":"EditorStatusChip-statusChip--gL4BB","updatedChip":"EditorStatusChip-updatedChip--vjpcZ","rejectedChip":"EditorStatusChip-rejectedChip--LuLLX","recentlyAddedChip":"EditorStatusChip-recentlyAddedChip--n4tHj"};
|
|
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 = `.EditorStatusChip-statusChip--gL4BB{color:#fff;font-size:10px;height:20px}.EditorStatusChip-updatedChip--vjpcZ{background:#2f80ed;border:1px solid rgba(0,114,206,.3)}.EditorStatusChip-rejectedChip--LuLLX{background:#eb5757;border:1px solid rgba(235,87,87,.3)}.EditorStatusChip-recentlyAddedChip--n4tHj{background:#f2994a;border:1px solid rgba(242,153,74,.3)}`;
|
|
7
|
+
head.appendChild(style);
|
|
8
|
+
}
|
|
9
|
+
export default styles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EditorStatusChip, EditorStatus } from './EditorStatusChip';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EditorStatusChip, EditorStatus } from './EditorStatusChip';
|
package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { GroupedObjectsInfo, WorkflowTaskData, EnrichedChangeRequest } from '@reltio/mdm-sdk';
|
|
2
|
+
import { type GroupedObjectsInfo, type WorkflowTaskData, type EnrichedChangeRequest } from '@reltio/mdm-sdk';
|
|
3
3
|
type Props = {
|
|
4
4
|
task: WorkflowTaskData;
|
|
5
5
|
dcr: EnrichedChangeRequest;
|
package/features/workflow/ChangeRequestEditor/components/EntityChangesGroup/EntityChangesGroup.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo, useCallback, useContext } from 'react';
|
|
2
|
+
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
3
|
+
import { isNil } from 'ramda';
|
|
2
4
|
import Accordion from '@mui/material/Accordion';
|
|
3
5
|
import AccordionSummary from '@mui/material/AccordionSummary';
|
|
4
6
|
import AccordionDetails from '@mui/material/AccordionDetails';
|
|
@@ -6,26 +8,130 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
|
6
8
|
import { useChangesList } from '../../../hooks/useChangesList';
|
|
7
9
|
import { DCREntityUriLink } from '../../../DCREntityUriLink/DCREntityUriLink';
|
|
8
10
|
import { ChangeItemRow } from '../ChangeItemRow/ChangeItemRow';
|
|
11
|
+
import { useMdmMetadata } from '../../../../../contexts/MdmModuleContext';
|
|
12
|
+
import { AddedAttributesContext } from '../../../contexts/AddedAttributesContext';
|
|
13
|
+
import { ScrollToAddedAttributeContext } from '../../../contexts/ScrollToAddedAttributeContext';
|
|
9
14
|
import { AttributesChangesContext } from '../../../AttributesChanges/AttributesChangesContext';
|
|
10
15
|
import { getDCRUri } from '../../../helpers/common';
|
|
11
|
-
import {
|
|
16
|
+
import { getAvailableAttributeTypesForEntity, getAvailableAttributeTypesForRelation, getAvailableSubAttributesForNestedOrReference } from '../../../helpers/moreAttributesScope';
|
|
17
|
+
import { isDiffChange, isRelationRow, isNestedOrReferenceParent } from '../../helpers/helpers';
|
|
18
|
+
import { prepareChangesList } from '../../helpers/changesList';
|
|
19
|
+
import { extractChangeOverrides, getAddedId, getObjectIdFromLineId, getParentAddedId, getParentChangeOverrides, getParentLineId, isRootAddedAttribute } from '../../helpers/addedAttributes';
|
|
20
|
+
import { extractLineIds } from '../../../helpers/merge';
|
|
21
|
+
import { MoreAttributesEditor } from '../editors';
|
|
12
22
|
import styles from './EntityChangesGroup.module.css';
|
|
13
23
|
export var EntityChangesGroup = function (_a) {
|
|
14
24
|
var task = _a.task, dcr = _a.dcr, entityInfo = _a.entityInfo, relationsInfo = _a.relationsInfo;
|
|
25
|
+
var metadata = useMdmMetadata();
|
|
15
26
|
var dcrUri = getDCRUri(task.objectURIs);
|
|
16
27
|
var _b = dcr || {}, changes = _b.changes, objectsInfo = _b.objectsInfo;
|
|
17
|
-
var
|
|
28
|
+
var addAddedAttributes = useContextSelector(AddedAttributesContext, function (ctx) { return ctx.addAddedAttributes; });
|
|
29
|
+
var highlight = useContext(ScrollToAddedAttributeContext).highlight;
|
|
30
|
+
var rawChangesList = useChangesList({
|
|
18
31
|
changes: changes,
|
|
19
32
|
entityInfo: entityInfo,
|
|
20
33
|
relationsInfo: relationsInfo
|
|
21
34
|
});
|
|
35
|
+
var changesList = useMemo(function () { return prepareChangesList(rawChangesList); }, [rawChangesList]);
|
|
36
|
+
var entityAttributeTypes = useMemo(function () {
|
|
37
|
+
if (!isNil(entityInfo.isExist)) {
|
|
38
|
+
return getAvailableAttributeTypesForEntity(metadata, entityInfo.type);
|
|
39
|
+
}
|
|
40
|
+
return [];
|
|
41
|
+
}, [metadata, entityInfo.type, entityInfo.isExist]);
|
|
42
|
+
var relationAttributeTypesMap = useMemo(function () {
|
|
43
|
+
var map = new Map();
|
|
44
|
+
for (var _i = 0, relationsInfo_1 = relationsInfo; _i < relationsInfo_1.length; _i++) {
|
|
45
|
+
var relationInfo = relationsInfo_1[_i];
|
|
46
|
+
if (!map.has(relationInfo.type)) {
|
|
47
|
+
map.set(relationInfo.type, getAvailableAttributeTypesForRelation(metadata, relationInfo.type));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return map;
|
|
51
|
+
}, [metadata, relationsInfo]);
|
|
52
|
+
var handleAddAttributes = useCallback(function (_a) {
|
|
53
|
+
var objectUri = _a.objectUri, parentLineId = _a.parentLineId, parentId = _a.parentId, changeOverrides = _a.changeOverrides;
|
|
54
|
+
return function (attributeTypes) {
|
|
55
|
+
var addedIds = addAddedAttributes({
|
|
56
|
+
attributeTypes: attributeTypes,
|
|
57
|
+
objectUri: objectUri,
|
|
58
|
+
parentLineId: parentLineId,
|
|
59
|
+
parentId: parentId,
|
|
60
|
+
changeOverrides: changeOverrides
|
|
61
|
+
});
|
|
62
|
+
highlight(addedIds);
|
|
63
|
+
};
|
|
64
|
+
}, [addAddedAttributes, highlight]);
|
|
65
|
+
var handleAddNestedAttributes = useCallback(function (change) { return function (attributeTypes) {
|
|
66
|
+
var _a, _b, _c, _d, _e;
|
|
67
|
+
var parentUri = (_a = change.attributeType) === null || _a === void 0 ? void 0 : _a.uri;
|
|
68
|
+
var parentAttrs = attributeTypes.filter(function (attr) { return attr.uri === parentUri; });
|
|
69
|
+
var subAttrs = attributeTypes.filter(function (attr) { return attr.uri !== parentUri; });
|
|
70
|
+
var childOverrides = extractChangeOverrides(change);
|
|
71
|
+
var siblingOverrides = getParentChangeOverrides(change);
|
|
72
|
+
if (parentAttrs.length > 0) {
|
|
73
|
+
var lineId = (_c = (_b = change.lineIds) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : (_d = extractLineIds(change.newValue)) === null || _d === void 0 ? void 0 : _d[0];
|
|
74
|
+
var addedId = getAddedId(change);
|
|
75
|
+
if (lineId && isRootAddedAttribute(lineId)) {
|
|
76
|
+
handleAddAttributes({
|
|
77
|
+
objectUri: getObjectIdFromLineId(lineId),
|
|
78
|
+
changeOverrides: siblingOverrides
|
|
79
|
+
})(parentAttrs);
|
|
80
|
+
}
|
|
81
|
+
else if (lineId) {
|
|
82
|
+
handleAddAttributes({
|
|
83
|
+
parentLineId: getParentLineId(lineId),
|
|
84
|
+
parentId: addedId ? getParentAddedId(addedId) : undefined,
|
|
85
|
+
changeOverrides: siblingOverrides
|
|
86
|
+
})(parentAttrs);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
handleAddAttributes({
|
|
90
|
+
objectUri: entityInfo.uri,
|
|
91
|
+
changeOverrides: siblingOverrides
|
|
92
|
+
})(parentAttrs);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (subAttrs.length > 0) {
|
|
96
|
+
var parentLineId = (_e = change.lineIds) === null || _e === void 0 ? void 0 : _e[0];
|
|
97
|
+
var parentId = change.addedId;
|
|
98
|
+
if (parentLineId || parentId) {
|
|
99
|
+
handleAddAttributes({ parentLineId: parentLineId, parentId: parentId, changeOverrides: childOverrides })(subAttrs);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
handleAddAttributes({
|
|
103
|
+
objectUri: entityInfo.uri,
|
|
104
|
+
changeOverrides: childOverrides
|
|
105
|
+
})(subAttrs);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}; }, [handleAddAttributes, entityInfo.uri]);
|
|
22
109
|
return (React.createElement(AttributesChangesContext.Provider, { value: objectsInfo },
|
|
23
110
|
React.createElement(Accordion, { className: styles.entityGroup, defaultExpanded: true, "data-reltio-id": "entity-changes-group" },
|
|
24
111
|
React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, null), className: styles.entityHeader, classes: {
|
|
25
112
|
content: styles.accordionContent
|
|
26
113
|
} },
|
|
27
114
|
React.createElement(DCREntityUriLink, { entityInfo: entityInfo, changes: changes, dcrUri: dcrUri, className: styles.entityTitle })),
|
|
28
|
-
React.createElement(AccordionDetails, { className: styles.attributesList },
|
|
29
|
-
|
|
30
|
-
|
|
115
|
+
React.createElement(AccordionDetails, { className: styles.attributesList },
|
|
116
|
+
entityAttributeTypes.length > 0 && (React.createElement(MoreAttributesEditor, { data: entityAttributeTypes, onApply: handleAddAttributes({ objectUri: entityInfo.uri }) })),
|
|
117
|
+
changesList.map(function (item, index) {
|
|
118
|
+
var _a, _b, _c, _d, _e, _f;
|
|
119
|
+
if (!isDiffChange(item)) {
|
|
120
|
+
return (React.createElement("div", { key: "title-".concat(index), className: styles.titleChangeItem }, item.label));
|
|
121
|
+
}
|
|
122
|
+
var relationAttrs = item.relationType
|
|
123
|
+
? ((_a = relationAttributeTypesMap.get(item.relationType.uri)) !== null && _a !== void 0 ? _a : [])
|
|
124
|
+
: [];
|
|
125
|
+
var nestedAttrs = isNestedOrReferenceParent(item)
|
|
126
|
+
? getAvailableSubAttributesForNestedOrReference(metadata, item.attributeType)
|
|
127
|
+
: [];
|
|
128
|
+
var changeKey = (_d = (_b = item.addedId) !== null && _b !== void 0 ? _b : (_c = item.attributeValue) === null || _c === void 0 ? void 0 : _c.uri) !== null && _d !== void 0 ? _d : "change-".concat(index);
|
|
129
|
+
return (React.createElement(React.Fragment, { key: changeKey },
|
|
130
|
+
React.createElement(ChangeItemRow, { change: item, entityInfo: entityInfo }),
|
|
131
|
+
isRelationRow(item) && (React.createElement(MoreAttributesEditor, { data: relationAttrs, change: item, onApply: handleAddAttributes({
|
|
132
|
+
objectUri: (_e = item === null || item === void 0 ? void 0 : item.attributeValue) === null || _e === void 0 ? void 0 : _e.uri,
|
|
133
|
+
parentLineId: (_f = item.lineIds) === null || _f === void 0 ? void 0 : _f[0]
|
|
134
|
+
}) })),
|
|
135
|
+
isNestedOrReferenceParent(item) && (React.createElement(MoreAttributesEditor, { data: nestedAttrs, change: item, parent: item.attributeType, onApply: handleAddNestedAttributes(item) }))));
|
|
136
|
+
})))));
|
|
31
137
|
};
|
|
@@ -4,7 +4,7 @@ import AccordionSummary from '@mui/material/AccordionSummary';
|
|
|
4
4
|
import AccordionDetails from '@mui/material/AccordionDetails';
|
|
5
5
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
6
6
|
import Skeleton from '@mui/material/Skeleton';
|
|
7
|
-
import { SkeletonChangeItemEditorLoader } from '../
|
|
7
|
+
import { SkeletonChangeItemEditorLoader } from '../editors';
|
|
8
8
|
import styles from './EntityChangesGroup.module.css';
|
|
9
9
|
export var SkeletonEntityChangesGroupLoader = function () {
|
|
10
10
|
return (React.createElement(Accordion, { className: styles.entityGroup, classes: { disabled: styles.skeletonEntityGroupDisabled }, defaultExpanded: true, disabled: true },
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { isNil } from 'ramda';
|
|
4
|
+
import i18n from 'ui-i18n';
|
|
5
|
+
import ReplayIcon from '@mui/icons-material/Replay';
|
|
6
|
+
import Button from '@mui/material/Button';
|
|
7
|
+
import { DCROperationTypes, EntityAttrTypes, getAttributeValue, getEntityType, isImage } from '@reltio/mdm-sdk';
|
|
8
|
+
import { useMdmEntity, useMdmMetadata } from '../../../../../../contexts/MdmModuleContext';
|
|
9
|
+
import { DataTypeValue } from '../../../../../../DataTypeValue';
|
|
10
|
+
import { SmallIconButton } from '../../../../../../SmallIconButton';
|
|
11
|
+
import { getDataTypeDefinition, prepareRolesOrTagsValue } from '../../../../helpers/common';
|
|
12
|
+
import { checkCanInitiateChangeRequest } from '../../../helpers/helpers';
|
|
13
|
+
import { OperationChip } from '../../../../OperationChip';
|
|
14
|
+
import { RelationEntityLink } from '../../../../RelationEntityLink';
|
|
15
|
+
import { useChangeRequestEditor } from '../../../hooks/useChangeRequestEditor';
|
|
16
|
+
import { ChangeItemLabel } from '../../ChangeItemLabel';
|
|
17
|
+
import { DCRValueEditor } from '../../DCRValueEditor';
|
|
18
|
+
import { EditorStatus, EditorStatusChip } from '../../EditorStatusChip';
|
|
19
|
+
import { AddSameAttributeButton } from '../../AddSameAttributeButton/AddSameAttributeButton';
|
|
20
|
+
import { DCRImageEditor } from '../../DCRImageEditor';
|
|
21
|
+
import editorStyles from '../editors.module.css';
|
|
22
|
+
import styles from './ChangeItemEditor.module.css';
|
|
23
|
+
export var ChangeItemEditor = function (_a) {
|
|
24
|
+
var _b, _c, _d, _e, _f;
|
|
25
|
+
var change = _a.change, _g = _a.editable, editable = _g === void 0 ? true : _g, classes = _a.classes;
|
|
26
|
+
var metadata = useMdmMetadata();
|
|
27
|
+
var _h = useChangeRequestEditor({ change: change }), handleChange = _h.handleChange, handleReject = _h.handleReject, handleRevert = _h.handleRevert, handleImageUpload = _h.handleImageUpload, lineData = _h.lineData, isLineRejected = _h.isLineRejected, isParentLineRejected = _h.isParentLineRejected, isUpdated = _h.isUpdated, hasChangeId = _h.hasChangeId, isSubAttributeOfDeletedAttribute = _h.isSubAttributeOfDeletedAttribute;
|
|
28
|
+
var entity = useMdmEntity();
|
|
29
|
+
var entityType = getEntityType(metadata, entity === null || entity === void 0 ? void 0 : entity.type);
|
|
30
|
+
var isUpdateOperation = change.operation === DCROperationTypes.EDITED;
|
|
31
|
+
var isAddOperation = change.operation === DCROperationTypes.ADDED;
|
|
32
|
+
var isDeletedOperation = change.operation === DCROperationTypes.DELETED;
|
|
33
|
+
var oldValue = getAttributeValue(change.oldValue);
|
|
34
|
+
var currentNewValue = !isNil(lineData === null || lineData === void 0 ? void 0 : lineData.value) && !isParentLineRejected ? lineData.value : change.newValue;
|
|
35
|
+
var newValue = getAttributeValue(currentNewValue);
|
|
36
|
+
var hasNewValue = !isNil(newValue);
|
|
37
|
+
var dataTypeDefinition = useMemo(function () {
|
|
38
|
+
return change.attributeType && getDataTypeDefinition(change.attributeType, newValue || oldValue);
|
|
39
|
+
}, [change.attributeType, newValue, oldValue]);
|
|
40
|
+
var isImageType = isImage(change === null || change === void 0 ? void 0 : change.attributeType);
|
|
41
|
+
var isRolesOrTags = ((_b = change === null || change === void 0 ? void 0 : change.attributeType) === null || _b === void 0 ? void 0 : _b.uri) === EntityAttrTypes.roles.uri ||
|
|
42
|
+
((_c = change === null || change === void 0 ? void 0 : change.attributeType) === null || _c === void 0 ? void 0 : _c.uri) === EntityAttrTypes.tags.uri;
|
|
43
|
+
var canEdit = checkCanInitiateChangeRequest(metadata, entityType, change);
|
|
44
|
+
var shouldShowValueEditor = (isUpdateOperation || isAddOperation) && editable && canEdit;
|
|
45
|
+
var isRejected = isLineRejected || isParentLineRejected;
|
|
46
|
+
var shouldShowAddButton = shouldShowValueEditor && ((_d = change.displayOptions) === null || _d === void 0 ? void 0 : _d.showAddButton) && !isRejected;
|
|
47
|
+
var preparedValue = useMemo(function () {
|
|
48
|
+
return isRolesOrTags
|
|
49
|
+
? prepareRolesOrTagsValue(metadata, newValue, change.attributeType.uri)
|
|
50
|
+
: newValue;
|
|
51
|
+
}, [isRolesOrTags, metadata, newValue, (_e = change.attributeType) === null || _e === void 0 ? void 0 : _e.uri]);
|
|
52
|
+
var showUndoButton = (isUpdated || isLineRejected) && !isParentLineRejected;
|
|
53
|
+
var showRejectButton = canEdit &&
|
|
54
|
+
!isLineRejected &&
|
|
55
|
+
!isUpdated &&
|
|
56
|
+
!isParentLineRejected &&
|
|
57
|
+
hasChangeId &&
|
|
58
|
+
!isSubAttributeOfDeletedAttribute &&
|
|
59
|
+
!(change.isReferenceSubAttribute && !editable);
|
|
60
|
+
var showStatusChips = !isParentLineRejected;
|
|
61
|
+
var isImageEditorDisabled = isRejected || isDeletedOperation;
|
|
62
|
+
var getEditorStatus = function () {
|
|
63
|
+
if (isLineRejected)
|
|
64
|
+
return EditorStatus.REJECTED;
|
|
65
|
+
if (isUpdated)
|
|
66
|
+
return EditorStatus.UPDATED;
|
|
67
|
+
return undefined;
|
|
68
|
+
};
|
|
69
|
+
return (React.createElement("div", { className: editorStyles.attributeRow, "data-reltio-id": "change-item-editor" },
|
|
70
|
+
React.createElement(ChangeItemLabel, { change: change, className: editorStyles.labelColumn, showLabel: (_f = change.displayOptions) === null || _f === void 0 ? void 0 : _f.showLabel }),
|
|
71
|
+
React.createElement("div", { className: editorStyles.valueColumn },
|
|
72
|
+
React.createElement(RelationEntityLink, { attributeOrRelationType: change.attributeType || change.relationType, attributeValue: change.attributeValue, className: styles.relationEntityLink }),
|
|
73
|
+
isImageType ? (React.createElement(DCRImageEditor, { change: change, onUpload: handleImageUpload, disabled: isImageEditorDisabled })) : shouldShowValueEditor ? (React.createElement(DCRValueEditor, { attributeType: change.attributeType, value: currentNewValue, onChange: handleChange, disabled: !editable || isRejected })) : (hasNewValue && (React.createElement("div", { className: styles.value },
|
|
74
|
+
React.createElement(DataTypeValue, { value: preparedValue, dataTypeDefinition: dataTypeDefinition }))))),
|
|
75
|
+
React.createElement("div", { className: editorStyles.addSameAttributeColumn }, shouldShowAddButton && React.createElement(AddSameAttributeButton, { change: change })),
|
|
76
|
+
React.createElement("div", { className: editorStyles.revertColumn }, showUndoButton && (React.createElement(SmallIconButton, { icon: ReplayIcon, onClick: handleRevert, className: styles.revertButton, title: i18n.text('Undo'), size: "S" }))),
|
|
77
|
+
React.createElement("div", { className: editorStyles.operationColumn }, change.operation && React.createElement(OperationChip, { operation: change.operation, size: "small", variant: "outlined" })),
|
|
78
|
+
React.createElement("div", { className: editorStyles.statusColumn }, showStatusChips && React.createElement(EditorStatusChip, { status: getEditorStatus() })),
|
|
79
|
+
React.createElement("div", { className: editorStyles.rejectColumn }, showRejectButton && (React.createElement(Button, { onClick: handleReject, className: classnames(styles.rejectButton, classes === null || classes === void 0 ? void 0 : classes.rejectButton), title: i18n.text('Reject'), size: "medium" }, i18n.text('Reject'))))));
|
|
80
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const styles = {"value":"ChangeItemEditor-value--x6RmR","columnSkeleton":"ChangeItemEditor-columnSkeleton--d4Sxa","relationEntityLink":"ChangeItemEditor-relationEntityLink--a9i3v","rejectButton":"ChangeItemEditor-rejectButton--z-3SA","revertButton":"ChangeItemEditor-revertButton--fkWOD"};
|
|
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 = `.ChangeItemEditor-value--x6RmR{font-size:16px;padding:8px}.ChangeItemEditor-columnSkeleton--d4Sxa{transform:none}.ChangeItemEditor-relationEntityLink--a9i3v{font-size:16px}.ChangeItemEditor-rejectButton--z-3SA{background-color:#eb5757;border-radius:8px;color:#fff}.ChangeItemEditor-rejectButton--z-3SA:hover{background-color:rgba(235,87,87,.8)}.ChangeItemEditor-revertButton--fkWOD{color:var(--mui-palette-text-secondary)}`;
|
|
7
|
+
head.appendChild(style);
|
|
8
|
+
}
|
|
9
|
+
export default styles;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Skeleton from '@mui/material/Skeleton';
|
|
3
|
+
import editorStyles from '../editors.module.css';
|
|
3
4
|
import styles from './ChangeItemEditor.module.css';
|
|
4
5
|
export var SkeletonChangeItemEditorLoader = function () {
|
|
5
|
-
return (React.createElement("div", { className:
|
|
6
|
-
React.createElement("div", { className:
|
|
6
|
+
return (React.createElement("div", { className: editorStyles.attributeRow },
|
|
7
|
+
React.createElement("div", { className: editorStyles.labelColumn },
|
|
7
8
|
React.createElement(Skeleton, { variant: "text", width: "90%", height: 18, className: styles.columnSkeleton })),
|
|
8
|
-
React.createElement("div", { className:
|
|
9
|
+
React.createElement("div", { className: editorStyles.valueColumn },
|
|
9
10
|
React.createElement(Skeleton, { variant: "text", height: 40, className: styles.columnSkeleton })),
|
|
10
|
-
React.createElement("div", { className:
|
|
11
|
-
React.createElement("div", { className:
|
|
11
|
+
React.createElement("div", { className: editorStyles.revertColumn }),
|
|
12
|
+
React.createElement("div", { className: editorStyles.operationColumn },
|
|
12
13
|
React.createElement(Skeleton, { variant: "rectangular", width: 60, height: 20, className: styles.columnSkeleton }))));
|
|
13
14
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import i18n from 'ui-i18n';
|
|
3
|
+
import { checkHasMasking, getAttributeValue, getReferencedEntityTypeUriFromAttrType, isComplexAttribute, isImage, isReference, Mode } from '@reltio/mdm-sdk';
|
|
4
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
5
|
+
import { useMdmGlobalSearchRequestOptions, useMdmMetadata, useMdmShowMasking } from '../../../../../../contexts/MdmModuleContext';
|
|
6
|
+
import { EntitySelector } from '../../../../../../EntitySelector';
|
|
7
|
+
import { SmallIconButton } from '../../../../../../SmallIconButton';
|
|
8
|
+
import { ChangeItemLabel } from '../../ChangeItemLabel';
|
|
9
|
+
import { DCRValueEditor } from '../../DCRValueEditor';
|
|
10
|
+
import { AddSameAttributeButton } from '../../AddSameAttributeButton/AddSameAttributeButton';
|
|
11
|
+
import { DCRImageEditor } from '../../DCRImageEditor';
|
|
12
|
+
import { useNewAttributesEditor } from '../../../hooks/useNewAttributesEditor';
|
|
13
|
+
import { EditorStatus, EditorStatusChip } from '../../EditorStatusChip';
|
|
14
|
+
import editorStyles from '../editors.module.css';
|
|
15
|
+
export var ChangeItemEditorRecentlyAdded = function (_a) {
|
|
16
|
+
var _b, _c, _d, _e;
|
|
17
|
+
var change = _a.change, _f = _a.editable, editable = _f === void 0 ? true : _f;
|
|
18
|
+
var metadata = useMdmMetadata();
|
|
19
|
+
var globalSearchRequestOptions = useMdmGlobalSearchRequestOptions(['ovOnly']);
|
|
20
|
+
var showMasking = useMdmShowMasking();
|
|
21
|
+
var _g = useNewAttributesEditor({ change: change }), lineData = _g.lineData, handleDelete = _g.handleDelete, handleChange = _g.handleChange, handleEntityChange = _g.handleEntityChange, handleImageUpload = _g.handleImageUpload, selectedEntity = _g.selectedEntity, isRejected = _g.isRejected, hasAddedParent = _g.hasAddedParent;
|
|
22
|
+
var attributeType = change.attributeType;
|
|
23
|
+
var currentValue = (_b = lineData === null || lineData === void 0 ? void 0 : lineData.value) !== null && _b !== void 0 ? _b : change.newValue;
|
|
24
|
+
var hasValue = !!getAttributeValue(currentValue);
|
|
25
|
+
var isReferenceType = isReference(attributeType);
|
|
26
|
+
var isImageType = isImage(attributeType);
|
|
27
|
+
var isComplex = isComplexAttribute(attributeType);
|
|
28
|
+
var isMasked = showMasking && checkHasMasking(metadata, attributeType);
|
|
29
|
+
var entityTypesUris = useMemo(function () {
|
|
30
|
+
if (!isReferenceType || !attributeType)
|
|
31
|
+
return [];
|
|
32
|
+
return [getReferencedEntityTypeUriFromAttrType(attributeType)];
|
|
33
|
+
}, [isReferenceType, attributeType]);
|
|
34
|
+
var renderEditor = function () {
|
|
35
|
+
if (isReferenceType) {
|
|
36
|
+
return (React.createElement(EntitySelector, { entity: selectedEntity, entityTypesUris: entityTypesUris, mode: Mode.Suggesting, onChange: handleEntityChange, metadata: metadata, globalSearchRequestOptions: globalSearchRequestOptions, isMasked: isMasked }));
|
|
37
|
+
}
|
|
38
|
+
if (isImageType) {
|
|
39
|
+
return React.createElement(DCRImageEditor, { change: change, onUpload: handleImageUpload, disabled: isRejected });
|
|
40
|
+
}
|
|
41
|
+
if (!editable)
|
|
42
|
+
return null;
|
|
43
|
+
if (!isComplex) {
|
|
44
|
+
return (React.createElement(DCRValueEditor, { attributeType: attributeType, value: currentValue, onChange: handleChange, disabled: isRejected }));
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
};
|
|
48
|
+
var showAddButton = editable && ((_c = change.displayOptions) === null || _c === void 0 ? void 0 : _c.showAddButton) && !isRejected;
|
|
49
|
+
var showDeleteButton = ((_d = change.displayOptions) === null || _d === void 0 ? void 0 : _d.hasSameAttributeSiblings) || !((attributeType === null || attributeType === void 0 ? void 0 : attributeType.required) && hasAddedParent);
|
|
50
|
+
return (React.createElement("div", { className: editorStyles.attributeRow, "data-reltio-id": "change-item-editor-recently-added" },
|
|
51
|
+
React.createElement(ChangeItemLabel, { change: change, className: editorStyles.labelColumn, showLabel: (_e = change.displayOptions) === null || _e === void 0 ? void 0 : _e.showLabel }),
|
|
52
|
+
React.createElement("div", { className: editorStyles.valueColumn }, renderEditor()),
|
|
53
|
+
React.createElement("div", { className: editorStyles.addSameAttributeColumn }, showAddButton && React.createElement(AddSameAttributeButton, { change: change })),
|
|
54
|
+
React.createElement("div", { className: editorStyles.revertColumn }, showDeleteButton && (React.createElement(SmallIconButton, { icon: DeleteIcon, onClick: handleDelete, title: i18n.text('Delete'), size: "S" }))),
|
|
55
|
+
React.createElement("div", { className: editorStyles.operationColumn }),
|
|
56
|
+
React.createElement("div", { className: editorStyles.statusColumn },
|
|
57
|
+
React.createElement(EditorStatusChip, { status: !isComplex && hasValue ? EditorStatus.RECENTLY_ADDED : undefined })),
|
|
58
|
+
React.createElement("div", { className: editorStyles.rejectColumn })));
|
|
59
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChangeItemEditorRecentlyAdded } from './ChangeItemEditorRecentlyAdded';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChangeItemEditorRecentlyAdded } from './ChangeItemEditorRecentlyAdded';
|
|
@@ -2,10 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { isNil } from 'ramda';
|
|
3
3
|
import EastIcon from '@mui/icons-material/East';
|
|
4
4
|
import { DCROperationTypes, getAttributeValue } from '@reltio/mdm-sdk';
|
|
5
|
-
import { getDataTypeDefinition } from '
|
|
6
|
-
import { DataTypeValue } from '
|
|
7
|
-
import { ChangeItemLabel } from '
|
|
8
|
-
import
|
|
5
|
+
import { getDataTypeDefinition } from '../../../../helpers/common';
|
|
6
|
+
import { DataTypeValue } from '../../../../../../DataTypeValue';
|
|
7
|
+
import { ChangeItemLabel } from '../../ChangeItemLabel';
|
|
8
|
+
import editorStyles from '../editors.module.css';
|
|
9
|
+
import styles from './ChangeItemOldValue.module.css';
|
|
9
10
|
export var ChangeItemOldValue = function (_a) {
|
|
10
11
|
var change = _a.change;
|
|
11
12
|
var isUpdateOperation = change.operation === DCROperationTypes.EDITED;
|
|
@@ -13,13 +14,13 @@ export var ChangeItemOldValue = function (_a) {
|
|
|
13
14
|
var newValue = getAttributeValue(change.newValue);
|
|
14
15
|
var dataTypeDefinition = change.attributeType && getDataTypeDefinition(change.attributeType, newValue !== null && newValue !== void 0 ? newValue : oldValue);
|
|
15
16
|
var hasOldValue = !isNil(oldValue);
|
|
16
|
-
return (React.createElement("div", { className:
|
|
17
|
-
React.createElement(ChangeItemLabel, { change: change, className:
|
|
18
|
-
React.createElement("div", { className:
|
|
17
|
+
return (React.createElement("div", { className: editorStyles.attributeRow },
|
|
18
|
+
React.createElement(ChangeItemLabel, { change: change, className: editorStyles.labelColumn }),
|
|
19
|
+
React.createElement("div", { className: editorStyles.valueColumn }, isUpdateOperation && hasOldValue && (React.createElement("div", { className: styles.previousValue },
|
|
19
20
|
React.createElement("span", { className: styles.previousValueText },
|
|
20
21
|
React.createElement(DataTypeValue, { value: oldValue, dataTypeDefinition: dataTypeDefinition })),
|
|
21
22
|
React.createElement("span", { className: styles.arrow },
|
|
22
23
|
React.createElement(EastIcon, null))))),
|
|
23
|
-
React.createElement("div", { className:
|
|
24
|
-
React.createElement("div", { className:
|
|
24
|
+
React.createElement("div", { className: editorStyles.revertColumn }),
|
|
25
|
+
React.createElement("div", { className: editorStyles.operationColumn })));
|
|
25
26
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const styles = {"previousValue":"ChangeItemOldValue-previousValue--wjU38","previousValueText":"ChangeItemOldValue-previousValueText--3YlY8","arrow":"ChangeItemOldValue-arrow--uP40C"};
|
|
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 = `.ChangeItemOldValue-previousValue--wjU38{align-items:center;display:flex;line-height:16px;padding:6px 12px 7px}.ChangeItemOldValue-previousValueText--3YlY8{color:var(--mui-palette-text-primary);letter-spacing:.24px}.ChangeItemOldValue-arrow--uP40C{color:var(--mui-palette-text-secondary);font-weight:700;margin:0 5px}`;
|
|
7
|
+
head.appendChild(style);
|
|
8
|
+
}
|
|
9
|
+
export default styles;
|
package/features/workflow/ChangeRequestEditor/components/editors/ChangeItemOldValue/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChangeItemOldValue } from './ChangeItemOldValue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChangeItemOldValue } from './ChangeItemOldValue';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AttributeType } from '@reltio/mdm-sdk';
|
|
3
|
+
import type { Diff } from '../../../../types';
|
|
4
|
+
type Props = {
|
|
5
|
+
data: AttributeType[];
|
|
6
|
+
onApply: (attributeTypes: AttributeType[]) => void;
|
|
7
|
+
change?: Diff;
|
|
8
|
+
parent?: AttributeType;
|
|
9
|
+
};
|
|
10
|
+
export declare const MoreAttributesEditor: ({ data, onApply, change, parent }: Props) => React.JSX.Element;
|
|
11
|
+
export {};
|