@reltio/components 1.4.2208 → 1.4.2209
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/AttributesErrorsPanel/components/Error/Error.js +2 -2
- package/cjs/AttributesErrorsPanel/components/Error/Error.js +2 -2
- package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
- package/cjs/contexts/MdmModuleContext/hooks.d.ts +1 -0
- package/cjs/contexts/MdmModuleContext/hooks.js +3 -1
- package/cjs/contexts/MdmModuleContext/index.d.ts +1 -1
- package/cjs/contexts/MdmModuleContext/index.js +2 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +8 -3
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +45 -4
- package/cjs/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditor/DCRValueEditor.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +1 -1
- package/cjs/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +1 -1
- package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.d.ts +2 -0
- package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.js +44 -0
- package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.module.css.js +9 -0
- package/cjs/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +2 -0
- package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +3 -1
- package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +19 -10
- package/cjs/features/workflow/contexts/ChangeRequestEditorContext/index.js +28 -2
- package/cjs/features/workflow/helpers/dcr.d.ts +1 -1
- package/cjs/features/workflow/helpers/merge.js +3 -3
- package/cjs/features/workflow/helpers/validation.d.ts +17 -0
- package/cjs/features/workflow/helpers/validation.js +333 -0
- package/cjs/features/workflow/hooks/useApplyDcrChanges.js +34 -24
- package/cjs/features/workflow/hooks/useDCRValidation.d.ts +5 -0
- package/cjs/features/workflow/hooks/useDCRValidation.js +153 -0
- package/cjs/features/workflow/types.d.ts +8 -1
- package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +2 -1
- package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.js +2 -2
- package/contexts/MdmModuleContext/context.d.ts +2 -0
- package/contexts/MdmModuleContext/hooks.d.ts +1 -0
- package/contexts/MdmModuleContext/hooks.js +1 -0
- package/contexts/MdmModuleContext/index.d.ts +1 -1
- package/contexts/MdmModuleContext/index.js +1 -1
- package/features/workflow/ChangeRequestEditor/components/ChangeItemLabel/ChangeItemLabel.js +8 -3
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.js +22 -4
- package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js +2 -2
- package/features/workflow/ChangeRequestEditor/components/DCRValueEditor/DCRValueEditor.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/components/DCRValueEditorFactory/DCRValueEditorFactory.d.ts +1 -1
- package/features/workflow/ChangeRequestEditor/hooks/useChangeRequestEditor.d.ts +1 -1
- package/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.d.ts +2 -0
- package/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.js +14 -0
- package/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.module.css.js +9 -0
- package/features/workflow/ReviewDCRDialog/ReviewDCRDialog.js +2 -0
- package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +3 -1
- package/features/workflow/contexts/ChangeRequestEditorContext/index.d.ts +19 -10
- package/features/workflow/contexts/ChangeRequestEditorContext/index.js +28 -2
- package/features/workflow/helpers/dcr.d.ts +1 -1
- package/features/workflow/helpers/merge.js +3 -3
- package/features/workflow/helpers/validation.d.ts +17 -0
- package/features/workflow/helpers/validation.js +326 -0
- package/features/workflow/hooks/useApplyDcrChanges.js +34 -24
- package/features/workflow/hooks/useDCRValidation.d.ts +5 -0
- package/features/workflow/hooks/useDCRValidation.js +149 -0
- package/features/workflow/types.d.ts +8 -1
- package/hooks/useScrollToAttributeError/useScrollToAttributeError.d.ts +2 -1
- package/hooks/useScrollToAttributeError/useScrollToAttributeError.js +2 -2
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
|
11
11
|
var styles_1 = require("./styles");
|
|
12
12
|
var useScrollToAttributeError = function (_a) {
|
|
13
13
|
var _b;
|
|
14
|
-
var context = _a.highlightedError, _c = _a.isSimple, isSimple = _c === void 0 ? false : _c;
|
|
14
|
+
var context = _a.highlightedError, _c = _a.isSimple, isSimple = _c === void 0 ? false : _c, className = _a.className;
|
|
15
15
|
var styles = (0, styles_1.useStyles)();
|
|
16
16
|
var ref = (0, react_1.useRef)(null);
|
|
17
17
|
var severity = (0, ramda_1.pathOr)(mdm_sdk_1.ErrorSeverity.ERROR, ['element', 'severity'])(context);
|
|
@@ -19,7 +19,7 @@ var useScrollToAttributeError = function (_a) {
|
|
|
19
19
|
_b[styles.highlightError] = severity === mdm_sdk_1.ErrorSeverity.ERROR,
|
|
20
20
|
_b[styles.highlightWarning] = severity === mdm_sdk_1.ErrorSeverity.WARNING,
|
|
21
21
|
_b[styles.simpleAttribute] = isSimple,
|
|
22
|
-
_b));
|
|
22
|
+
_b), className);
|
|
23
23
|
(0, react_1.useEffect)(function () {
|
|
24
24
|
if (context) {
|
|
25
25
|
context.scrollIntoRef(ref);
|
|
@@ -58,6 +58,7 @@ export type MdmModuleValuesContextProps = Partial<{
|
|
|
58
58
|
uiConfigProfile: Profile;
|
|
59
59
|
showMasking: boolean;
|
|
60
60
|
reviewDCREnabled: boolean;
|
|
61
|
+
dcrReviewValidation: boolean;
|
|
61
62
|
}>;
|
|
62
63
|
export type MdmModuleActionsContextProps = Partial<{
|
|
63
64
|
openSearch: (payload: SearchState) => void;
|
|
@@ -264,6 +265,7 @@ export declare const MdmModuleValuesContext: import("@fluentui/react-context-sel
|
|
|
264
265
|
uiConfigProfile: Profile;
|
|
265
266
|
showMasking: boolean;
|
|
266
267
|
reviewDCREnabled: boolean;
|
|
268
|
+
dcrReviewValidation: boolean;
|
|
267
269
|
}>>;
|
|
268
270
|
export declare const MdmModuleListenersContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
269
271
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
@@ -153,3 +153,4 @@ export declare const useMdmHiddenAttributes: () => Record<string, string[]>;
|
|
|
153
153
|
export declare const useMdmControlAttributes: () => string[];
|
|
154
154
|
export declare const useMdmShowMasking: () => boolean;
|
|
155
155
|
export declare const useMdmReviewDCREnabled: () => boolean;
|
|
156
|
+
export declare const useMdmDcrReviewValidation: () => boolean;
|
|
@@ -162,3 +162,4 @@ export var useMdmControlAttributes = function () {
|
|
|
162
162
|
};
|
|
163
163
|
export var useMdmShowMasking = function () { return useMdmModuleValuesContext(function (context) { return context.showMasking; }); };
|
|
164
164
|
export var useMdmReviewDCREnabled = function () { return useMdmModuleValuesContext(function (context) { return context.reviewDCREnabled; }); };
|
|
165
|
+
export var useMdmDcrReviewValidation = function () { return useMdmModuleValuesContext(function (context) { return context.dcrReviewValidation; }); };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { MdmModuleProvider } from './provider';
|
|
2
|
-
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled, useMdmImagePath } from './hooks';
|
|
2
|
+
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled, useMdmDcrReviewValidation, useMdmImagePath } from './hooks';
|
|
3
3
|
export type { MdmModuleActionsContextProps, MdmModuleValuesContextProps, MdmModuleListenersContextProps } from './context';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { MdmModuleProvider } from './provider';
|
|
2
|
-
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled, useMdmImagePath } from './hooks';
|
|
2
|
+
export { useMdmAutoCloseInterval, useMdmUiError, useMdmWorkflowEnvironmentUrl, useMdmExportPath, useMdmAbsoluteImagePath, useMdmUiPath, useMdmDtssPath, useMdmServicesPath, useMdmWorkflowPath, useMdmImageServicePath, useMdmReltioPath, useMdmApiPath, useMdmCollaborationPath, useMdmImageAttributesFieldsOrder, useMdmShowEntityId, useMdmPivotingAttributes, useMdmDateMask, useMdmDateTimeMask, useMdmAttributesPresentation, useMdmMaxValuesInResponse, useMdmAttributesSortingStrategy, useMdmLookupAutocomplete, useMdmModifiedEntities, useMdmEntity, useMdmEntityUri, useMdmEntityWithDiff, useMdmEntityUriWithDataTenant, useMdmMode, useMdmIsViewMode, useMdmIsEditableMode, useMdmHistoryDiff, useMdmHistoryMode, useMdmHistorySlice, useMdmHistoryEvent, useMdmProfileLastLoadedTime, useMdmLookups, useMdmDependentLookups, useMdmMetadata, useMdmUser, useMdmUsername, useMdmUserRoles, useMdmTenantObject, useMdmTenant, useMdmTenantName, useMdmEnvironment, useMdmDataTenants, useMdmSearchNavigationData, useMdmSearchProviderData, useMdmIsCollaborationEnabled, useMdmIsWorkflowEnabled, useMdmProfileErrors, useMdmRelationsDrafts, useMdmModifiedEntityDefaultProfilePic, useMdmModifiedEntity, useMdmInitialConnectionTempEntity, useMdmInitialConnection, useMdmDependentLookupEditorState, useMdmActiveErrorsForAttributesPager, useMdmDependentLookupsStructureNode, useMdmAllRelationsToAddAndEdit, useMdmDependentLookupEditorContext, useMdmGlobalSearchRequestOptions, useMdmAuthoringItemsByEntityType, useMdmAction, useMdmListener, useMdmIsSourcesScreenEnabled, useMdmHiddenAttributes, useMdmControlAttributes, useMdmShowMasking, useMdmReviewDCREnabled, useMdmDcrReviewValidation, useMdmImagePath } from './hooks';
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { useCssVariableStyles } from '../../../../../hooks/useCssVariableStyles';
|
|
4
|
+
import { RequiredMark } from '../../../../../RequiredMark';
|
|
4
5
|
import styles from './ChangeItemLabel.module.css';
|
|
5
6
|
export var ChangeItemLabel = function (_a) {
|
|
6
|
-
var
|
|
7
|
-
var
|
|
7
|
+
var _b;
|
|
8
|
+
var change = _a.change, className = _a.className, _c = _a.showLabel, showLabel = _c === void 0 ? true : _c;
|
|
9
|
+
var _d = change.level, level = _d === void 0 ? 0 : _d, label = change.label;
|
|
10
|
+
var isRequired = (_b = change === null || change === void 0 ? void 0 : change.attributeType) === null || _b === void 0 ? void 0 : _b.required;
|
|
8
11
|
var variableStyles = useCssVariableStyles({
|
|
9
12
|
'--level': level
|
|
10
13
|
});
|
|
11
|
-
return (React.createElement("div", { className: classnames(styles.changeLabel, className), style: variableStyles }, showLabel &&
|
|
14
|
+
return (React.createElement("div", { className: classnames(styles.changeLabel, className), style: variableStyles }, showLabel && (React.createElement(React.Fragment, null,
|
|
15
|
+
label,
|
|
16
|
+
isRequired && React.createElement(RequiredMark, null)))));
|
|
12
17
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import classnames from 'classnames';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
3
|
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
4
4
|
import { DCROperationTypes } from '@reltio/mdm-sdk';
|
|
5
5
|
import { isEditableChange } from '../../helpers/helpers';
|
|
6
6
|
import { ChangeRequestEditorContext } from '../../../contexts/ChangeRequestEditorContext';
|
|
7
7
|
import { ChangeItemEditor, ChangeItemOldValue } from '../ChangeItemEditor';
|
|
8
8
|
import { extractLineIds } from '../../../helpers/merge';
|
|
9
|
+
import { ErrorWrapper } from '../../../../../ErrorWrapper';
|
|
10
|
+
import { ScrollToElementContext, isHighlightedErrorType } from '../../../../../contexts/ScrollToElementContext';
|
|
11
|
+
import { useScrollToAttributeError } from '../../../../../hooks/useScrollToAttributeError';
|
|
9
12
|
import styles from './ChangeItemRow.module.css';
|
|
10
13
|
export var ChangeItemRow = function (_a) {
|
|
11
14
|
var _b;
|
|
@@ -20,13 +23,28 @@ export var ChangeItemRow = function (_a) {
|
|
|
20
23
|
var isUpdated = useContextSelector(ChangeRequestEditorContext, function (context) {
|
|
21
24
|
return context.getIsLineUpdated(lineIds === null || lineIds === void 0 ? void 0 : lineIds[0]);
|
|
22
25
|
});
|
|
26
|
+
var errorByLineId = useContextSelector(ChangeRequestEditorContext, function (context) {
|
|
27
|
+
return context.getErrorByLineId(lineIds === null || lineIds === void 0 ? void 0 : lineIds[0]);
|
|
28
|
+
});
|
|
29
|
+
var error = errorByLineId === null || errorByLineId === void 0 ? void 0 : errorByLineId.error;
|
|
30
|
+
var errorLineIds = (errorByLineId === null || errorByLineId === void 0 ? void 0 : errorByLineId.lineIds) || [];
|
|
31
|
+
var scrollToElementContext = useContext(ScrollToElementContext);
|
|
32
|
+
var highlightedError = scrollToElementContext === null || scrollToElementContext === void 0 ? void 0 : scrollToElementContext.element;
|
|
33
|
+
var isHighlighted = isHighlightedErrorType(scrollToElementContext === null || scrollToElementContext === void 0 ? void 0 : scrollToElementContext.type) &&
|
|
34
|
+
highlightedError &&
|
|
35
|
+
errorLineIds.includes(highlightedError.uri);
|
|
36
|
+
var _c = useScrollToAttributeError({
|
|
37
|
+
highlightedError: isHighlighted ? scrollToElementContext : null,
|
|
38
|
+
className: styles.changeItemRowWithError
|
|
39
|
+
}), ref = _c.ref, errorClassName = _c.errorClassName;
|
|
23
40
|
var isEditedOperation = change.operation === DCROperationTypes.EDITED;
|
|
24
41
|
var editable = isEditableChange(change, entityInfo);
|
|
25
|
-
return (React.createElement("div", { className: classnames(styles.changeItemRow, (_b = {},
|
|
42
|
+
return (React.createElement("div", { ref: ref, className: classnames(styles.changeItemRow, errorClassName, (_b = {},
|
|
26
43
|
_b[styles.editableRow] = editable,
|
|
27
44
|
_b[styles.changedRow] = isUpdated,
|
|
28
45
|
_b[styles.rejectedRow] = isLineRejected || isParentLineRejected,
|
|
29
46
|
_b)) },
|
|
30
|
-
|
|
31
|
-
|
|
47
|
+
React.createElement(ErrorWrapper, { errorMessage: error === null || error === void 0 ? void 0 : error.message, classes: { helperText: styles.errorText } },
|
|
48
|
+
isEditedOperation && React.createElement(ChangeItemOldValue, { change: change }),
|
|
49
|
+
React.createElement(ChangeItemEditor, { change: change, editable: editable, classes: { rejectButton: styles.rejectButton } }))));
|
|
32
50
|
};
|
package/features/workflow/ChangeRequestEditor/components/ChangeItemRow/ChangeItemRow.module.css.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const styles = {"changeItemRow":"ChangeItemRow-changeItemRow--oF9hn","rejectButton":"ChangeItemRow-rejectButton--iNbfM","changedRow":"ChangeItemRow-changedRow--32zBa","rejectedRow":"ChangeItemRow-rejectedRow--RqKQc"};
|
|
1
|
+
const styles = {"changeItemRow":"ChangeItemRow-changeItemRow--oF9hn","changeItemRowWithError":"ChangeItemRow-changeItemRowWithError--oS1li","rejectButton":"ChangeItemRow-rejectButton--iNbfM","changedRow":"ChangeItemRow-changedRow--32zBa","rejectedRow":"ChangeItemRow-rejectedRow--RqKQc","errorText":"ChangeItemRow-errorText--EybHm"};
|
|
2
2
|
if (typeof document !== 'undefined') {
|
|
3
3
|
const head = document.head || document.getElementsByTagName('head')[0]
|
|
4
4
|
const style = document.createElement('style');
|
|
5
5
|
style.type = 'text/css'
|
|
6
|
-
style.innerHTML = `.ChangeItemRow-changeItemRow--oF9hn{display:flex;flex-direction:column;gap:8px;transition:background-color .2s ease}.ChangeItemRow-rejectButton--iNbfM{opacity:0}.ChangeItemRow-changeItemRow--oF9hn:hover{background:var(--mui-palette-action-hover)}.ChangeItemRow-changeItemRow--oF9hn:hover .ChangeItemRow-rejectButton--iNbfM{opacity:1}.ChangeItemRow-changedRow--32zBa{background-color:#e5eff7}.ChangeItemRow-changedRow--32zBa:hover{background-color:rgba(229,239,247,.8)}.ChangeItemRow-rejectedRow--RqKQc{background-color:#f6e7e7}.ChangeItemRow-rejectedRow--RqKQc:hover{background-color:hsla(0,45%,94%,.8)}`;
|
|
6
|
+
style.innerHTML = `.ChangeItemRow-changeItemRow--oF9hn{display:flex;flex-direction:column;gap:8px;position:relative;transition:background-color .2s ease}.ChangeItemRow-changeItemRow--oF9hn.ChangeItemRow-changeItemRowWithError--oS1li:before{bottom:-4px;height:auto;left:-8px;right:-8px;top:-4px;width:auto}.ChangeItemRow-rejectButton--iNbfM{opacity:0}.ChangeItemRow-changeItemRow--oF9hn:hover{background:var(--mui-palette-action-hover)}.ChangeItemRow-changeItemRow--oF9hn:hover .ChangeItemRow-rejectButton--iNbfM{opacity:1}.ChangeItemRow-changedRow--32zBa{background-color:#e5eff7}.ChangeItemRow-changedRow--32zBa:hover{background-color:rgba(229,239,247,.8)}.ChangeItemRow-rejectedRow--RqKQc{background-color:#f6e7e7}.ChangeItemRow-rejectedRow--RqKQc:hover{background-color:hsla(0,45%,94%,.8)}.ChangeItemRow-errorText--EybHm{padding:0 0 4px 180px}`;
|
|
7
7
|
head.appendChild(style);
|
|
8
8
|
}
|
|
9
9
|
export default styles;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AttributeType, ChangeValue, PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
-
import { LineDataValue } from '../../../
|
|
3
|
+
import { LineDataValue } from '../../../types';
|
|
4
4
|
type Props = {
|
|
5
5
|
attributeType: AttributeType;
|
|
6
6
|
value: LineDataValue | ChangeValue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AttributeType, ChangeValue, DataTypeDefinition, PrimitiveValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
-
import { LineDataValue } from '../../../
|
|
3
|
+
import { LineDataValue } from '../../../types';
|
|
4
4
|
type Props = {
|
|
5
5
|
attributeType: AttributeType;
|
|
6
6
|
value: LineDataValue | ChangeValue;
|
|
@@ -7,7 +7,7 @@ export declare const useChangeRequestEditor: ({ change }: Props) => {
|
|
|
7
7
|
handleChange: (newValue: SimpleAttributeValue | string[] | PrimitiveValue) => void;
|
|
8
8
|
handleReject: () => void;
|
|
9
9
|
handleRevert: () => void;
|
|
10
|
-
lineData: import("../../
|
|
10
|
+
lineData: import("../../types").LineData;
|
|
11
11
|
isLineRejected: boolean;
|
|
12
12
|
isParentLineRejected: boolean;
|
|
13
13
|
isUpdated: boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useContextSelector } from '@fluentui/react-context-selector';
|
|
3
|
+
import { ChangeRequestEditorContext } from '../../contexts/ChangeRequestEditorContext';
|
|
4
|
+
import { AttributesErrorsPanel } from '../../../../AttributesErrorsPanel';
|
|
5
|
+
import styles from './DCRErrorsPanel.module.css';
|
|
6
|
+
export var DCRErrorsPanel = function () {
|
|
7
|
+
var errors = useContextSelector(ChangeRequestEditorContext, function (context) { return context.getErrors(); });
|
|
8
|
+
var validationErrors = useMemo(function () { return errors.map(function (error) { return error.error; }); }, [errors]);
|
|
9
|
+
if (validationErrors.length === 0) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return (React.createElement("div", { className: styles.DCRErrorsPanel },
|
|
13
|
+
React.createElement(AttributesErrorsPanel, { attributesWithErrors: validationErrors })));
|
|
14
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const styles = {"DCRErrorsPanel":"DCRErrorsPanel-DCRErrorsPanel--7zw3p"};
|
|
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 = `.DCRErrorsPanel-DCRErrorsPanel--7zw3p{margin-bottom:16px}`;
|
|
7
|
+
head.appendChild(style);
|
|
8
|
+
}
|
|
9
|
+
export default styles;
|
|
@@ -18,6 +18,7 @@ import { WorkflowActionButtons } from '../WorkflowActionButtons';
|
|
|
18
18
|
import { DCRSummaryInfo } from './components/DCRSummaryInfo/DCRSummaryInfo';
|
|
19
19
|
import { ChangeRequestEditor } from '../ChangeRequestEditor';
|
|
20
20
|
import { useApplyDcrChanges } from '../hooks/useApplyDcrChanges';
|
|
21
|
+
import { DCRErrorsPanel } from './DCRErrorsPanel/DCRErrorsPanel';
|
|
21
22
|
import styles from './ReviewDCRDialog.module.css';
|
|
22
23
|
export var ReviewDCRDialog = function (_a) {
|
|
23
24
|
var open = _a.open, onClose = _a.onClose, dcr = _a.dcr, task = _a.task, groupedObjects = _a.groupedObjects;
|
|
@@ -43,6 +44,7 @@ export var ReviewDCRDialog = function (_a) {
|
|
|
43
44
|
React.createElement(DialogContent, { classes: { root: styles.content } },
|
|
44
45
|
React.createElement("div", { className: styles.leftSection },
|
|
45
46
|
React.createElement(ProfileBand, { entity: entity, className: styles.profileBandRoot, classes: { profileBand: styles.profileBand } }),
|
|
47
|
+
React.createElement(DCRErrorsPanel, null),
|
|
46
48
|
React.createElement(DCRSummaryInfo, { dcr: dcr, task: task, groupedObjects: groupedObjects }),
|
|
47
49
|
React.createElement("div", { className: styles.editableSection },
|
|
48
50
|
React.createElement("div", { className: styles.editableGrid },
|
|
@@ -12,6 +12,7 @@ import { ReviewDCRDialog } from '../../../ReviewDCRDialog';
|
|
|
12
12
|
import { ReviewDCRButton } from '../../../ReviewDCRButton';
|
|
13
13
|
import { ChangeRequestEditorProvider } from '../../../contexts/ChangeRequestEditorContext';
|
|
14
14
|
import { WorkflowTasksContext } from '../../../../../contexts/WorkflowTasksContext';
|
|
15
|
+
import { ScrollToElementProvider } from '../../../../../contexts/ScrollToElementContext';
|
|
15
16
|
export var DataChangeRequestTaskCard = function (_a) {
|
|
16
17
|
var task = _a.task;
|
|
17
18
|
var reviewDCREnabledByEntityType = (useContext(WorkflowTasksContext) || {}).reviewDCR;
|
|
@@ -38,5 +39,6 @@ export var DataChangeRequestTaskCard = function (_a) {
|
|
|
38
39
|
groupedObjects.map(function (object, index) { return (React.createElement(LineDecorator, { key: index, last: index === groupedObjects.length - 1, divider: true },
|
|
39
40
|
React.createElement(AttributesChanges, { entityInfo: object.entity, relationsInfo: object.relations, changes: dcr.changes, objectsInfo: dcr.objectsInfo, dcrUri: dcrUri }))); })),
|
|
40
41
|
showReviewDialog && (React.createElement(ChangeRequestEditorProvider, null,
|
|
41
|
-
React.createElement(
|
|
42
|
+
React.createElement(ScrollToElementProvider, null,
|
|
43
|
+
React.createElement(ReviewDCRDialog, { open: isReviewDCRDialogOpen, onClose: handleCloseReviewDCRDialog, dcr: dcr, groupedObjects: groupedObjects, task: task }))))));
|
|
42
44
|
};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
export type LineData = {
|
|
7
|
-
value?: LineDataValue;
|
|
8
|
-
isRejected?: boolean;
|
|
9
|
-
};
|
|
10
|
-
type ChangeRequestEditorContextType = {
|
|
2
|
+
import { AttributeError } from '@reltio/mdm-sdk';
|
|
3
|
+
import { LineData, LineDataValue } from '../../types';
|
|
4
|
+
export type ChangeRequestEditorContextType = {
|
|
11
5
|
updateChange: (lineIds: string[], data: LineDataValue) => void;
|
|
12
6
|
getLineData: (lineId: string) => LineData | undefined;
|
|
13
7
|
getLinesByChangeId: (changeId: string) => Array<[string, LineData]>;
|
|
@@ -16,9 +10,24 @@ type ChangeRequestEditorContextType = {
|
|
|
16
10
|
getIsParentLineRejected: (lineId: string) => boolean;
|
|
17
11
|
getIsLineRejected: (lineId: string) => boolean;
|
|
18
12
|
getIsLineUpdated: (lineId: string) => boolean;
|
|
13
|
+
getAllChanges: () => {
|
|
14
|
+
lineId: string;
|
|
15
|
+
data: LineData;
|
|
16
|
+
}[];
|
|
17
|
+
setErrors: (errors: {
|
|
18
|
+
error: AttributeError;
|
|
19
|
+
lineIds: string[];
|
|
20
|
+
}[]) => void;
|
|
21
|
+
getErrorByLineId: (lineId: string) => {
|
|
22
|
+
error: AttributeError;
|
|
23
|
+
lineIds: string[];
|
|
24
|
+
} | undefined;
|
|
25
|
+
getErrors: () => {
|
|
26
|
+
error: AttributeError;
|
|
27
|
+
lineIds: string[];
|
|
28
|
+
}[];
|
|
19
29
|
};
|
|
20
30
|
export declare const ChangeRequestEditorContext: import("@fluentui/react-context-selector").Context<ChangeRequestEditorContextType>;
|
|
21
31
|
export declare const ChangeRequestEditorProvider: ({ children }: {
|
|
22
32
|
children: React.ReactNode;
|
|
23
33
|
}) => React.JSX.Element;
|
|
24
|
-
export {};
|
|
@@ -9,12 +9,18 @@ export var ChangeRequestEditorContext = createContext({
|
|
|
9
9
|
revertChangeUpdateOrReject: undefined,
|
|
10
10
|
getIsParentLineRejected: undefined,
|
|
11
11
|
getIsLineRejected: undefined,
|
|
12
|
-
getIsLineUpdated: undefined
|
|
12
|
+
getIsLineUpdated: undefined,
|
|
13
|
+
getAllChanges: undefined,
|
|
14
|
+
setErrors: undefined,
|
|
15
|
+
getErrorByLineId: undefined,
|
|
16
|
+
getErrors: undefined
|
|
13
17
|
});
|
|
18
|
+
var emptyArray = [];
|
|
14
19
|
export var ChangeRequestEditorProvider = function (_a) {
|
|
15
20
|
var children = _a.children;
|
|
16
21
|
var _b = useState(new Map()), lineDataMap = _b[0], setLineDataMap = _b[1];
|
|
17
22
|
var lineDataMapRef = useRef(lineDataMap);
|
|
23
|
+
var _c = useState([]), errors = _c[0], setErrors = _c[1];
|
|
18
24
|
var updateChange = useCallback(function (lineIds, data) {
|
|
19
25
|
setLineDataMap(function (prevMap) {
|
|
20
26
|
var newMap = new Map(prevMap);
|
|
@@ -70,9 +76,25 @@ export var ChangeRequestEditorProvider = function (_a) {
|
|
|
70
76
|
return key.split('/')[1] === changeId;
|
|
71
77
|
});
|
|
72
78
|
}, []);
|
|
79
|
+
var getAllChanges = useCallback(function () {
|
|
80
|
+
var changes = Array.from(lineDataMapRef.current).map(function (_a) {
|
|
81
|
+
var lineId = _a[0], data = _a[1];
|
|
82
|
+
return ({ lineId: lineId, data: data });
|
|
83
|
+
});
|
|
84
|
+
return changes.length > 0 ? changes : emptyArray;
|
|
85
|
+
}, []);
|
|
73
86
|
useEffect(function () {
|
|
74
87
|
lineDataMapRef.current = lineDataMap;
|
|
75
88
|
}, [lineDataMap]);
|
|
89
|
+
var getErrorByLineId = useCallback(function (lineId) {
|
|
90
|
+
return errors.find(function (_a) {
|
|
91
|
+
var lineIds = _a.lineIds;
|
|
92
|
+
return lineIds.includes(lineId);
|
|
93
|
+
});
|
|
94
|
+
}, [errors]);
|
|
95
|
+
var getErrors = useCallback(function () {
|
|
96
|
+
return errors;
|
|
97
|
+
}, [errors]);
|
|
76
98
|
var contextValue = {
|
|
77
99
|
updateChange: updateChange,
|
|
78
100
|
getLineData: getLineData,
|
|
@@ -81,7 +103,11 @@ export var ChangeRequestEditorProvider = function (_a) {
|
|
|
81
103
|
revertChangeUpdateOrReject: revertChangeUpdateOrReject,
|
|
82
104
|
getIsParentLineRejected: getIsParentLineRejected,
|
|
83
105
|
getIsLineRejected: getIsLineRejected,
|
|
84
|
-
getIsLineUpdated: getIsLineUpdated
|
|
106
|
+
getIsLineUpdated: getIsLineUpdated,
|
|
107
|
+
getAllChanges: getAllChanges,
|
|
108
|
+
setErrors: setErrors,
|
|
109
|
+
getErrorByLineId: getErrorByLineId,
|
|
110
|
+
getErrors: getErrors
|
|
85
111
|
};
|
|
86
112
|
return React.createElement(ChangeRequestEditorContext.Provider, { value: contextValue }, children);
|
|
87
113
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AttributeDelete, ChangeRequest, DCRChange, DCRChanges, DCRObjectInfo, DCRObjectsInfo, GroupedObjectsInfo, Metadata } from '@reltio/mdm-sdk';
|
|
2
|
-
import { LineData } from '../
|
|
2
|
+
import { LineData } from '../types';
|
|
3
3
|
export declare const getEntitiesObjects: any;
|
|
4
4
|
export declare const getRelationsObjects: any;
|
|
5
5
|
export declare const extractObjectsFromChangeRequest: (changes: DCRChanges, objectsInfo: DCRObjectsInfo) => DCRObjectInfo[];
|
|
@@ -69,7 +69,7 @@ var prepareStartOrEndDate = function (_a) {
|
|
|
69
69
|
];
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
var prepareRolesOrTags = function (
|
|
72
|
+
var prepareRolesOrTags = function (change) {
|
|
73
73
|
var _a = change.newValue, newValue = _a === void 0 ? [] : _a, _b = change.oldValue, oldValue = _b === void 0 ? [] : _b;
|
|
74
74
|
var preparedNewValue = 'value' in newValue ? newValue.value : newValue;
|
|
75
75
|
var preparedOldValue = 'value' in oldValue ? oldValue.value : oldValue;
|
|
@@ -197,10 +197,10 @@ var mergeAttributesInChange = function (metadata, objectInfo, change, container)
|
|
|
197
197
|
container['defaultProfilePicValue'] = [change.newValue];
|
|
198
198
|
break;
|
|
199
199
|
case DCRTypes.UPDATE_TAGS:
|
|
200
|
-
container[EntityAttrTypes.tags.name] = prepareRolesOrTags(
|
|
200
|
+
container[EntityAttrTypes.tags.name] = prepareRolesOrTags(change);
|
|
201
201
|
break;
|
|
202
202
|
case DCRTypes.UPDATE_ROLES: {
|
|
203
|
-
container[EntityAttrTypes.roles.name] = prepareRolesOrTags(
|
|
203
|
+
container[EntityAttrTypes.roles.name] = prepareRolesOrTags(change);
|
|
204
204
|
break;
|
|
205
205
|
}
|
|
206
206
|
case DCRTypes.UPDATE_START_DATE:
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AttributeError, DCRChanges, Entity, Metadata, Relation } from '@reltio/mdm-sdk';
|
|
2
|
+
import { LineData } from '../types';
|
|
3
|
+
type UserChange = {
|
|
4
|
+
lineId: string;
|
|
5
|
+
data: LineData;
|
|
6
|
+
};
|
|
7
|
+
type ValidationError = {
|
|
8
|
+
error: AttributeError;
|
|
9
|
+
lineIds: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare const getValidationErrors: ({ changes, userChanges, entitiesOrRelations, metadata }: {
|
|
12
|
+
changes: DCRChanges;
|
|
13
|
+
userChanges: UserChange[];
|
|
14
|
+
entitiesOrRelations: Record<string, Entity | Relation>;
|
|
15
|
+
metadata: Metadata;
|
|
16
|
+
}) => ValidationError[];
|
|
17
|
+
export {};
|