@reltio/components 1.4.910 → 1.4.914
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/cjs/components/MergeButton/MergeButton.d.ts +1 -0
- package/cjs/components/MergeButton/MergeButton.js +3 -2
- package/cjs/components/attributes/ImageAttributesLine/ImageAttributesLine.d.ts +7 -2
- package/cjs/components/attributes/ImageAttributesLine/ImageAttributesLine.js +15 -1
- package/cjs/components/attributes/editMode/AttributesPager/AttributesPager.js +1 -1
- package/cjs/components/attributes/editMode/ImageAttributesLine/ImageAttributesLine.d.ts +8 -2
- package/cjs/components/attributes/editMode/ImageAttributesLine/ImageAttributesLine.js +5 -5
- package/cjs/components/attributes/readMode/AttributesPager/AttributesPager.js +1 -1
- package/cjs/components/attributes/readMode/ImageAttributesLine/ImageAttributesLine.d.ts +7 -2
- package/cjs/components/attributes/readMode/ImageAttributesLine/ImageAttributesLine.js +2 -2
- package/cjs/components/history/HistoryMenuButton/HistoryMenuButton.js +46 -1
- package/cjs/components/history/HistoryMenuButton/MenuItemRenderer.d.ts +12 -0
- package/cjs/components/history/HistoryMenuButton/MenuItemRenderer.js +44 -0
- package/cjs/components/history/HistoryMenuButton/styles.d.ts +1 -1
- package/cjs/components/history/HistoryMenuButton/styles.js +13 -0
- package/cjs/components/index.d.ts +1 -0
- package/cjs/components/index.js +5 -3
- package/cjs/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -30
- package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
- package/cjs/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
- package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
- package/cjs/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
- package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
- package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
- package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
- package/cjs/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +13 -0
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +25 -9
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
- package/cjs/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
- package/cjs/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
- package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
- package/cjs/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -6
- package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
- package/cjs/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -26
- package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
- package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +109 -28
- package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
- package/cjs/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
- package/cjs/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
- package/cjs/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
- package/cjs/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
- package/cjs/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
- package/cjs/components/workflow/components/LineDecorator/styles.d.ts +1 -1
- package/cjs/components/workflow/components/LineDecorator/styles.js +4 -1
- package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
- package/cjs/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
- package/cjs/components/workflow/helpers/dcrHelpers.d.ts +7 -0
- package/cjs/components/workflow/helpers/dcrHelpers.js +48 -0
- package/cjs/components/workflow/hooks/useChangeRequest.d.ts +5 -0
- package/cjs/components/workflow/hooks/useChangeRequest.js +58 -0
- package/{esm/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → cjs/components/workflow/types/dcrTypes.d.ts} +22 -16
- package/cjs/components/workflow/types/dcrTypes.js +2 -0
- package/cjs/hooks/useMergeAllRequest.d.ts +2 -1
- package/cjs/hooks/useMergeAllRequest.js +6 -3
- package/esm/components/MergeButton/MergeButton.d.ts +1 -0
- package/esm/components/MergeButton/MergeButton.js +3 -2
- package/esm/components/attributes/ImageAttributesLine/ImageAttributesLine.d.ts +7 -2
- package/esm/components/attributes/ImageAttributesLine/ImageAttributesLine.js +15 -1
- package/esm/components/attributes/editMode/AttributesPager/AttributesPager.js +1 -1
- package/esm/components/attributes/editMode/ImageAttributesLine/ImageAttributesLine.d.ts +8 -2
- package/esm/components/attributes/editMode/ImageAttributesLine/ImageAttributesLine.js +6 -6
- package/esm/components/attributes/readMode/AttributesPager/AttributesPager.js +1 -1
- package/esm/components/attributes/readMode/ImageAttributesLine/ImageAttributesLine.d.ts +7 -2
- package/esm/components/attributes/readMode/ImageAttributesLine/ImageAttributesLine.js +2 -2
- package/esm/components/history/HistoryMenuButton/HistoryMenuButton.js +27 -1
- package/esm/components/history/HistoryMenuButton/MenuItemRenderer.d.ts +12 -0
- package/esm/components/history/HistoryMenuButton/MenuItemRenderer.js +20 -0
- package/esm/components/history/HistoryMenuButton/styles.d.ts +1 -1
- package/esm/components/history/HistoryMenuButton/styles.js +13 -0
- package/esm/components/index.d.ts +1 -0
- package/esm/components/index.js +1 -0
- package/esm/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js +6 -11
- package/esm/components/workflow/components/AttributesChanges/AttributesChanges.d.ts +7 -4
- package/esm/components/workflow/components/AttributesChanges/AttributesChanges.js +19 -9
- package/esm/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts +4 -4
- package/esm/components/workflow/components/AttributesChanges/components/ChangeView/styles.js +3 -9
- package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.d.ts +2 -2
- package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/DCRChangesList.js +4 -1
- package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.d.ts +1 -0
- package/esm/components/workflow/components/AttributesChanges/components/DCRChangesList/styles.js +10 -0
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.d.ts +2 -13
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/DiffRenderer.js +26 -10
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.d.ts +1 -1
- package/esm/components/workflow/components/AttributesChanges/components/DiffRenderer/styles.js +14 -2
- package/esm/components/workflow/components/AttributesChanges/contexts/AttributesChangesContext.d.ts +1 -1
- package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.d.ts +3 -2
- package/esm/components/workflow/components/AttributesChanges/helpers/attributesHelpers.js +35 -7
- package/esm/components/workflow/components/AttributesChanges/helpers/helpers.d.ts +4 -6
- package/esm/components/workflow/components/AttributesChanges/helpers/helpers.js +4 -25
- package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.d.ts +3 -2
- package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +112 -31
- package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.d.ts +3 -2
- package/esm/components/workflow/components/AttributesChanges/hooks/useCollapsibleList.js +4 -4
- package/esm/components/workflow/components/AttributesChanges/types/diffTypes.d.ts +16 -0
- package/esm/components/workflow/components/AttributesChanges/types/{DCRTypes.js → diffTypes.js} +0 -0
- package/esm/components/workflow/components/LineDecorator/LineDecorator.d.ts +2 -1
- package/esm/components/workflow/components/LineDecorator/LineDecorator.js +5 -2
- package/esm/components/workflow/components/LineDecorator/styles.d.ts +1 -1
- package/esm/components/workflow/components/LineDecorator/styles.js +4 -1
- package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.d.ts +0 -0
- package/esm/components/workflow/{components/AttributesChanges/constants → constants}/operations.js +0 -0
- package/esm/components/workflow/helpers/dcrHelpers.d.ts +7 -0
- package/esm/components/workflow/helpers/dcrHelpers.js +43 -0
- package/esm/components/workflow/hooks/useChangeRequest.d.ts +5 -0
- package/esm/components/workflow/hooks/useChangeRequest.js +54 -0
- package/{cjs/components/workflow/components/AttributesChanges/types/DCRTypes.d.ts → esm/components/workflow/types/dcrTypes.d.ts} +22 -16
- package/esm/components/workflow/types/dcrTypes.js +1 -0
- package/esm/hooks/useMergeAllRequest.d.ts +2 -1
- package/esm/hooks/useMergeAllRequest.js +6 -3
- package/package.json +3 -3
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.useChangeRequest = void 0;
|
|
15
|
+
var react_1 = require("react");
|
|
16
|
+
var ramda_1 = require("ramda");
|
|
17
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
18
|
+
var hooks_1 = require("../../../hooks");
|
|
19
|
+
var dcrHelpers_1 = require("../helpers/dcrHelpers");
|
|
20
|
+
var errors_1 = require("../helpers/errors");
|
|
21
|
+
var useChangeRequest = function (dcrUri) {
|
|
22
|
+
var _a = react_1.useState([]), groupedObjects = _a[0], setGroupedObjects = _a[1];
|
|
23
|
+
var _b = react_1.useState(null), dcr = _b[0], setDcr = _b[1];
|
|
24
|
+
var safePromise = hooks_1.useSafePromise();
|
|
25
|
+
var requestEntities = react_1.useCallback(function (entityUris) {
|
|
26
|
+
if (ramda_1.isEmpty(entityUris)) {
|
|
27
|
+
return Promise.resolve([]);
|
|
28
|
+
}
|
|
29
|
+
return safePromise(mdm_sdk_1.getEntitiesByUris(entityUris, { searchOptions: 'ovOnly', defaultMaxValues: 1 }));
|
|
30
|
+
}, []); // eslint-disable-line
|
|
31
|
+
react_1.useEffect(function () {
|
|
32
|
+
mdm_sdk_1.getDataChangeRequest(dcrUri)
|
|
33
|
+
.then(function (dcr) {
|
|
34
|
+
var changes = dcr.changes, objectsInfo = dcr.objectsInfo;
|
|
35
|
+
var objectsWithChanges = dcrHelpers_1.extractObjectsFromChangeRequest(changes, objectsInfo);
|
|
36
|
+
var entityObjectsWithRelations = ramda_1.pipe(dcrHelpers_1.getEntitiesObjects, ramda_1.map(dcrHelpers_1.createEntityRelationsObjectByEntity(objectsWithChanges)))(objectsWithChanges);
|
|
37
|
+
var relationsObjects = ramda_1.pipe(dcrHelpers_1.getRelationsObjects, ramda_1.map(dcrHelpers_1.createEntityRelationsObjectByRelation(objectsInfo)))(objectsWithChanges);
|
|
38
|
+
var _a = ramda_1.partition(ramda_1.has('entity'), relationsObjects), relationsObjectsWithEntity = _a[0], relationsObjectsWithoutEntity = _a[1];
|
|
39
|
+
var entityUris = relationsObjectsWithoutEntity.map(ramda_1.path(['relations', 0, 'startObjectUri']));
|
|
40
|
+
requestEntities(entityUris)
|
|
41
|
+
.then(function (entities) {
|
|
42
|
+
var relationsObjectsWithRequestedEntities = relationsObjectsWithoutEntity.map(function (relationsObject, index) {
|
|
43
|
+
return __assign(__assign({}, relationsObject), { entity: entities[index] });
|
|
44
|
+
});
|
|
45
|
+
ramda_1.pipe(ramda_1.flatten, ramda_1.reduce(dcrHelpers_1.concatEntityRelationsObjects, {}), ramda_1.values, setGroupedObjects)([
|
|
46
|
+
entityObjectsWithRelations,
|
|
47
|
+
relationsObjectsWithEntity,
|
|
48
|
+
relationsObjectsWithRequestedEntities
|
|
49
|
+
]);
|
|
50
|
+
})
|
|
51
|
+
.catch(errors_1.showWorkflowError);
|
|
52
|
+
setDcr(dcr);
|
|
53
|
+
})
|
|
54
|
+
.catch(errors_1.showWorkflowError);
|
|
55
|
+
}, [dcrUri, requestEntities]);
|
|
56
|
+
return { dcr: dcr, groupedObjects: groupedObjects };
|
|
57
|
+
};
|
|
58
|
+
exports.useChangeRequest = useChangeRequest;
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
import { Crosswalk, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
1
|
+
import { Crosswalk, Entity, NestedAttributeValue, ReferenceAttributeValue, Relation, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
2
2
|
import { DCRTypes } from '../constants/operations';
|
|
3
|
+
export declare type ChangeRequest = {
|
|
4
|
+
changes: DCRChanges;
|
|
5
|
+
createdBy: string;
|
|
6
|
+
createdTime: number;
|
|
7
|
+
objectsInfo: DCRObjectsInfo;
|
|
8
|
+
state: string;
|
|
9
|
+
type: string;
|
|
10
|
+
updatedBy: string;
|
|
11
|
+
updatedTime: number;
|
|
12
|
+
uri: string;
|
|
13
|
+
};
|
|
14
|
+
export declare type GroupedObjectsInfo = {
|
|
15
|
+
entity: EntityInfo;
|
|
16
|
+
relations: RelationInfo[];
|
|
17
|
+
};
|
|
3
18
|
export declare type EntityInfo = {
|
|
4
19
|
isExist: boolean;
|
|
5
20
|
label: string;
|
|
6
21
|
secondaryLabel: string;
|
|
7
22
|
type: string;
|
|
23
|
+
uri?: string;
|
|
8
24
|
};
|
|
9
25
|
export declare type RelationInfo = {
|
|
10
26
|
type: string;
|
|
@@ -13,11 +29,15 @@ export declare type RelationInfo = {
|
|
|
13
29
|
endObjectLabel: string;
|
|
14
30
|
endObjectUri: string;
|
|
15
31
|
isExist: boolean;
|
|
32
|
+
uri?: string;
|
|
16
33
|
};
|
|
17
34
|
export declare type DCRObjectInfo = EntityInfo | RelationInfo;
|
|
18
35
|
export declare type DCRObjectsInfo = {
|
|
19
36
|
[key: string]: DCRObjectInfo;
|
|
20
37
|
};
|
|
38
|
+
export declare type DCRAttributes = {
|
|
39
|
+
[attributeName: string]: (ChangeValue | DCRChange)[];
|
|
40
|
+
};
|
|
21
41
|
export declare type Value = DCRAttributes | DCRChange | string | boolean | number;
|
|
22
42
|
export declare type DCRAttributeValue = Omit<SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue, 'uri' | 'value'> & {
|
|
23
43
|
value: Value;
|
|
@@ -27,10 +47,7 @@ export declare type DCRAttributeValue = Omit<SimpleAttributeValue | NestedAttrib
|
|
|
27
47
|
};
|
|
28
48
|
uri?: string;
|
|
29
49
|
};
|
|
30
|
-
export declare type
|
|
31
|
-
[attributeName: string]: DCRAttributeValue[];
|
|
32
|
-
};
|
|
33
|
-
export declare type ChangeValue = DCRAttributeValue | string[];
|
|
50
|
+
export declare type ChangeValue = DCRAttributeValue | string[] | Entity | Relation;
|
|
34
51
|
export declare type DCRChange = {
|
|
35
52
|
attributePath?: string;
|
|
36
53
|
attributeType?: string;
|
|
@@ -50,14 +67,3 @@ export declare type DCRChange = {
|
|
|
50
67
|
export declare type DCRChanges = {
|
|
51
68
|
[key: string]: DCRChange[];
|
|
52
69
|
};
|
|
53
|
-
export declare type ChangeRequest = {
|
|
54
|
-
changes: DCRChanges;
|
|
55
|
-
createdBy: string;
|
|
56
|
-
createdTime: number;
|
|
57
|
-
objectsInfo: DCRObjectsInfo;
|
|
58
|
-
state: string;
|
|
59
|
-
type: string;
|
|
60
|
-
updatedBy: string;
|
|
61
|
-
updatedTime: number;
|
|
62
|
-
uri: string;
|
|
63
|
-
};
|
|
@@ -4,8 +4,9 @@ declare type Props = {
|
|
|
4
4
|
entity: Entity;
|
|
5
5
|
onFinishRequest?: () => void;
|
|
6
6
|
onStartRequest?: () => void;
|
|
7
|
+
onError?: () => void;
|
|
7
8
|
};
|
|
8
|
-
export declare const useMergeAllRequest: ({ entities, entity, onFinishRequest, onStartRequest }: Props) => {
|
|
9
|
+
export declare const useMergeAllRequest: ({ entities, entity, onFinishRequest, onStartRequest, onError }: Props) => {
|
|
9
10
|
isPending: boolean;
|
|
10
11
|
sendMergeAllRequest: () => void;
|
|
11
12
|
};
|
|
@@ -8,18 +8,21 @@ var react_1 = require("react");
|
|
|
8
8
|
var react_redux_1 = require("react-redux");
|
|
9
9
|
var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
|
|
10
10
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
11
|
+
var core_1 = require("../core");
|
|
11
12
|
var useMergeAllRequest = function (_a) {
|
|
12
|
-
var entities = _a.entities, entity = _a.entity, onFinishRequest = _a.onFinishRequest, onStartRequest = _a.onStartRequest;
|
|
13
|
+
var entities = _a.entities, entity = _a.entity, onFinishRequest = _a.onFinishRequest, onStartRequest = _a.onStartRequest, _b = _a.onError, onError = _b === void 0 ? core_1.noop : _b;
|
|
13
14
|
var tenant = react_redux_1.useSelector(mdm_module_1.default.selectors.getTenant);
|
|
14
15
|
var dtssPath = react_redux_1.useSelector(mdm_module_1.default.selectors.getDtssPath);
|
|
15
|
-
var
|
|
16
|
+
var _c = react_1.useState(false), isPending = _c[0], setIsPending = _c[1];
|
|
16
17
|
var sendMergeAllRequest = react_1.useCallback(function () {
|
|
17
18
|
onStartRequest === null || onStartRequest === void 0 ? void 0 : onStartRequest();
|
|
18
19
|
setIsPending(true);
|
|
19
20
|
var params = { dtssPath: dtssPath, customerTenant: tenant, entity: entity, entities: entities };
|
|
20
21
|
(mdm_sdk_1.isDataTenantEntity(entity)
|
|
21
22
|
? mdm_sdk_1.mergeDataTenantEntity(params)
|
|
22
|
-
: mdm_sdk_1.mergeCustomerTenantEntityWithMixedEntities(params))
|
|
23
|
+
: mdm_sdk_1.mergeCustomerTenantEntityWithMixedEntities(params))
|
|
24
|
+
.catch(onError)
|
|
25
|
+
.finally(function () {
|
|
23
26
|
onFinishRequest === null || onFinishRequest === void 0 ? void 0 : onFinishRequest();
|
|
24
27
|
setIsPending(false);
|
|
25
28
|
});
|
|
@@ -10,6 +10,7 @@ declare type Props = {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
onStartRequest?: () => void;
|
|
12
12
|
onFinishRequest?: () => void;
|
|
13
|
+
onError?: () => void;
|
|
13
14
|
};
|
|
14
15
|
export declare const MergeButton: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLLIElement>>;
|
|
15
16
|
export {};
|
|
@@ -27,12 +27,13 @@ import { noop } from '../../core';
|
|
|
27
27
|
import { ActionButton, ActionButtonMode } from '../ActionButton/ActionButton';
|
|
28
28
|
import { useMergeAllRequest } from '../../hooks';
|
|
29
29
|
export var MergeButton = forwardRef(function (_a, ref) {
|
|
30
|
-
var className = _a.className, _b = _a.mode, mode = _b === void 0 ? ActionButtonMode.iconButton : _b, _c = _a.onMenuClose, onMenuClose = _c === void 0 ? noop : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, entity = _a.entity, entities = _a.entities, onStartRequest = _a.onStartRequest, onFinishRequest = _a.onFinishRequest, otherProps = __rest(_a, ["className", "mode", "onMenuClose", "disabled", "entity", "entities", "onStartRequest", "onFinishRequest"]);
|
|
30
|
+
var className = _a.className, _b = _a.mode, mode = _b === void 0 ? ActionButtonMode.iconButton : _b, _c = _a.onMenuClose, onMenuClose = _c === void 0 ? noop : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, entity = _a.entity, entities = _a.entities, onStartRequest = _a.onStartRequest, onFinishRequest = _a.onFinishRequest, onError = _a.onError, otherProps = __rest(_a, ["className", "mode", "onMenuClose", "disabled", "entity", "entities", "onStartRequest", "onFinishRequest", "onError"]);
|
|
31
31
|
var sendMergeAllRequest = useMergeAllRequest({
|
|
32
32
|
entity: entity,
|
|
33
33
|
entities: entities,
|
|
34
34
|
onStartRequest: onStartRequest,
|
|
35
|
-
onFinishRequest: onFinishRequest
|
|
35
|
+
onFinishRequest: onFinishRequest,
|
|
36
|
+
onError: onError
|
|
36
37
|
}).sendMergeAllRequest;
|
|
37
38
|
return (React.createElement(ActionButton, __assign({ className: className, disabled: disabled, mode: mode, label: i18n.text('Merge'), icon: MergeIcon, onClick: sendMergeAllRequest, onMenuClose: onMenuClose, ref: ref }, otherProps)));
|
|
38
39
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { RequestNextPageOfAttributeValuesPayload } from '@reltio/mdm-module';
|
|
3
|
+
import { AttributeType, ImageAttributeValue, Paging } from '@reltio/mdm-sdk';
|
|
3
4
|
import { AttributeItem } from '../editMode/AttributesPager';
|
|
4
5
|
import { SIZES_TYPE } from './styles';
|
|
5
6
|
export declare type ImageRenderProps = {
|
|
@@ -19,6 +20,10 @@ declare type Props = {
|
|
|
19
20
|
onUpload?: () => void;
|
|
20
21
|
onDeleteAttribute?: (param: AttributeItem) => void;
|
|
21
22
|
imageSize?: SIZES_TYPE;
|
|
23
|
+
paging?: Paging;
|
|
24
|
+
requestNextPageOfAttributeValues?: (payload: RequestNextPageOfAttributeValuesPayload) => void;
|
|
25
|
+
parentUri?: string;
|
|
26
|
+
showNonOv?: boolean;
|
|
22
27
|
};
|
|
23
|
-
declare const ImageAttributesLine: ({ attributeType, attributeValues, renderImage, overlay, countFixedItems, children, onUpload, onDeleteAttribute, imageSize }: Props) => JSX.Element;
|
|
28
|
+
declare const ImageAttributesLine: ({ attributeType, attributeValues, renderImage, overlay, countFixedItems, children, onUpload, onDeleteAttribute, imageSize, paging, parentUri, showNonOv, requestNextPageOfAttributeValues }: Props) => JSX.Element;
|
|
24
29
|
export default ImageAttributesLine;
|
|
@@ -21,11 +21,25 @@ import { downloadImagesByURLs } from '../helpers/imageAttributes';
|
|
|
21
21
|
import { DEFAULT_IMAGE_SIZE, IMAGE_MIN_VISIBLE_WIDTH } from './constants';
|
|
22
22
|
import { useStyles } from './styles';
|
|
23
23
|
var ImageAttributesLine = function (_a) {
|
|
24
|
-
var attributeType = _a.attributeType, _b = _a.attributeValues, attributeValues = _b === void 0 ? [] : _b, renderImage = _a.renderImage, _c = _a.overlay, overlay = _c === void 0 ? false : _c, _d = _a.countFixedItems, countFixedItems = _d === void 0 ? 0 : _d, children = _a.children, onUpload = _a.onUpload, onDeleteAttribute = _a.onDeleteAttribute, _e = _a.imageSize, imageSize = _e === void 0 ? DEFAULT_IMAGE_SIZE : _e;
|
|
24
|
+
var attributeType = _a.attributeType, _b = _a.attributeValues, attributeValues = _b === void 0 ? [] : _b, renderImage = _a.renderImage, _c = _a.overlay, overlay = _c === void 0 ? false : _c, _d = _a.countFixedItems, countFixedItems = _d === void 0 ? 0 : _d, children = _a.children, onUpload = _a.onUpload, onDeleteAttribute = _a.onDeleteAttribute, _e = _a.imageSize, imageSize = _e === void 0 ? DEFAULT_IMAGE_SIZE : _e, paging = _a.paging, parentUri = _a.parentUri, showNonOv = _a.showNonOv, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
|
|
25
25
|
var entity = useSelector(mdm.selectors.getEntity) || {};
|
|
26
26
|
var isViewMode = useSelector(mdm.selectors.getIsViewMode);
|
|
27
27
|
var dispatch = useDispatch();
|
|
28
28
|
var styles = useStyles(imageSize);
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
if (paging && requestNextPageOfAttributeValues) {
|
|
31
|
+
var totalVisibleValues = showNonOv ? paging.totalOvValues : paging.totalValues;
|
|
32
|
+
if (totalVisibleValues > attributeValues.length) {
|
|
33
|
+
requestNextPageOfAttributeValues({
|
|
34
|
+
parentUri: parentUri,
|
|
35
|
+
attributeTypeUri: attributeType.uri,
|
|
36
|
+
attributeTypeName: attributeType.name,
|
|
37
|
+
values: [],
|
|
38
|
+
defaultMaxValues: totalVisibleValues
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, [paging, requestNextPageOfAttributeValues, attributeType, parentUri, attributeValues.length, showNonOv]);
|
|
29
43
|
var lastWidth = useRef();
|
|
30
44
|
var _f = useState(0), maxItems = _f[0], setMaxItems = _f[1];
|
|
31
45
|
var _g = useState(0), hiddenItemsLength = _g[0], setHiddenItemsLength = _g[1];
|
|
@@ -56,7 +56,7 @@ var AttributesPager = function (_a) {
|
|
|
56
56
|
return (React.createElement(BranchDecorator, { enabled: drawLines },
|
|
57
57
|
React.createElement("div", { className: styles.wrapper },
|
|
58
58
|
React.createElement(Title, { label: attributeType === null || attributeType === void 0 ? void 0 : attributeType.label, attributeType: attributeType }),
|
|
59
|
-
React.createElement(ImageAttributesLine, { attributeValues: visibleValues, attributeType: attributeType, onDeleteAttribute: onDeleteAttribute, parentUri: parentUri, onChangeAttribute: onChangeAttribute }))));
|
|
59
|
+
React.createElement(ImageAttributesLine, { attributeValues: visibleValues, attributeType: attributeType, paging: paging, onDeleteAttribute: onDeleteAttribute, parentUri: parentUri, onChangeAttribute: onChangeAttribute, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv }))));
|
|
60
60
|
default:
|
|
61
61
|
return (React.createElement(AttributeRenderer, __assign({ values: visibleValues, attributeType: attributeType, max: max, paging: paging, crosswalks: crosswalks, showEmptyEditors: showEmptyEditors, drawLines: drawLines, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv }, commonProps)));
|
|
62
62
|
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { RequestNextPageOfAttributeValuesPayload } from '@reltio/mdm-module';
|
|
3
|
+
import { AttributeType, ImageAttributeValue, Paging } from '@reltio/mdm-sdk';
|
|
3
4
|
import { AttributeItem } from '../AttributesPager';
|
|
5
|
+
import { SIZES_TYPE } from '../../ImageAttributesLine/styles';
|
|
4
6
|
declare type Props = {
|
|
5
7
|
attributeType: AttributeType;
|
|
6
8
|
attributeValues: ImageAttributeValue[];
|
|
7
9
|
onDeleteAttribute: (param: AttributeItem) => void;
|
|
8
10
|
onChangeAttribute: (param: AttributeItem) => void;
|
|
9
11
|
parentUri: string;
|
|
12
|
+
imageSize?: SIZES_TYPE;
|
|
13
|
+
paging?: Paging;
|
|
14
|
+
requestNextPageOfAttributeValues?: (payload: RequestNextPageOfAttributeValuesPayload) => void;
|
|
15
|
+
showNonOv?: boolean;
|
|
10
16
|
};
|
|
11
|
-
declare const ImageAttributesLine: ({ attributeType, attributeValues, onDeleteAttribute, onChangeAttribute, parentUri }: Props) => JSX.Element;
|
|
17
|
+
declare const ImageAttributesLine: ({ attributeType, attributeValues, onDeleteAttribute, onChangeAttribute, requestNextPageOfAttributeValues, parentUri, paging, showNonOv, imageSize }: Props) => JSX.Element;
|
|
12
18
|
export default ImageAttributesLine;
|
|
@@ -8,17 +8,17 @@ import ImageActionsOverlay from '../../../Image/ImageActionsOverlay/ImageActions
|
|
|
8
8
|
import { SmallIconButton } from '../../../SmallIconButton';
|
|
9
9
|
import { UploadImageDialog } from '../../../UploadImageDialog/UploadImageDialog';
|
|
10
10
|
import ImageAttributesLineCommon from '../../ImageAttributesLine';
|
|
11
|
-
import {
|
|
11
|
+
import { DEFAULT_IMAGE_SIZE } from '../../ImageAttributesLine/constants';
|
|
12
12
|
import { useStyles } from './styles';
|
|
13
13
|
var ImageAttributesLine = function (_a) {
|
|
14
|
-
var _b = _a.attributeType, attributeType = _b === void 0 ? {} : _b, _c = _a.attributeValues, attributeValues = _c === void 0 ? [] : _c, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, parentUri = _a.parentUri;
|
|
15
|
-
var styles = useStyles(
|
|
14
|
+
var _b = _a.attributeType, attributeType = _b === void 0 ? {} : _b, _c = _a.attributeValues, attributeValues = _c === void 0 ? [] : _c, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues, parentUri = _a.parentUri, paging = _a.paging, showNonOv = _a.showNonOv, _d = _a.imageSize, imageSize = _d === void 0 ? DEFAULT_IMAGE_SIZE : _d;
|
|
15
|
+
var styles = useStyles(imageSize);
|
|
16
16
|
var entity = useSelector(mdmModule.selectors.getEntity) || {};
|
|
17
17
|
var defaultProfilePic = useSelector(function (state) {
|
|
18
18
|
return mdmModule.selectors.getModifiedEntityDefaultProfilePic(state, entity.uri);
|
|
19
19
|
});
|
|
20
20
|
var dispatch = useDispatch();
|
|
21
|
-
var
|
|
21
|
+
var _e = useState(false), isVisibleUploadDialog = _e[0], setIsVisibleUploadDialog = _e[1];
|
|
22
22
|
var toggleVisibilityUploadDialog = useCallback(function () {
|
|
23
23
|
setIsVisibleUploadDialog(function (visible) { return !visible; });
|
|
24
24
|
}, []);
|
|
@@ -70,12 +70,12 @@ var ImageAttributesLine = function (_a) {
|
|
|
70
70
|
var uri = attribute.uri;
|
|
71
71
|
var onOpenImageGalleryDialog = methods.onOpenImageGalleryDialog;
|
|
72
72
|
return (React.createElement("div", { className: styles.image, key: uri },
|
|
73
|
-
React.createElement(Image, { src: src, overlay: renderImageActionsOverlay(methods, attribute), onClick: function () { return onOpenImageGalleryDialog(uri); } })));
|
|
73
|
+
React.createElement(Image, { src: src, overlay: renderImageActionsOverlay(methods, attribute), onClick: function () { return onOpenImageGalleryDialog(uri); }, size: { imageWidth: imageSize.imageWidth, imageHeight: imageSize.imageHeight } })));
|
|
74
74
|
};
|
|
75
75
|
return renderImage;
|
|
76
76
|
};
|
|
77
77
|
return (React.createElement("div", { className: styles.root },
|
|
78
|
-
React.createElement(ImageAttributesLineCommon, { attributeValues: attributeValues, attributeType: attributeType, renderImage: renderImage, overlay: true, countFixedItems: 1, onUpload: toggleVisibilityUploadDialog, onDeleteAttribute: handleDeleteAttribute },
|
|
78
|
+
React.createElement(ImageAttributesLineCommon, { attributeValues: attributeValues, attributeType: attributeType, renderImage: renderImage, overlay: true, countFixedItems: 1, onUpload: toggleVisibilityUploadDialog, onDeleteAttribute: handleDeleteAttribute, imageSize: imageSize, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, paging: paging, parentUri: parentUri, showNonOv: showNonOv },
|
|
79
79
|
React.createElement("div", { className: styles.uploadContainer, onClick: toggleVisibilityUploadDialog },
|
|
80
80
|
React.createElement(SmallIconButton, { className: styles.uploadButton, iconClassName: styles.uploadIcon, icon: CloudUploadIcon }))),
|
|
81
81
|
React.createElement(UploadImageDialog, { open: isVisibleUploadDialog, onUpload: handleAddAttributes, onClose: toggleVisibilityUploadDialog })));
|
|
@@ -47,7 +47,7 @@ var AttributesPager = function (_a) {
|
|
|
47
47
|
case RENDERER_TYPES.imageLine:
|
|
48
48
|
return (React.createElement(React.Fragment, null,
|
|
49
49
|
showTitle && React.createElement(Title, { label: attributeType === null || attributeType === void 0 ? void 0 : attributeType.label, attributeType: attributeType }),
|
|
50
|
-
React.createElement(ImageAttributesLine, { attributeValues: visibleValues, attributeType: attributeType })));
|
|
50
|
+
React.createElement(ImageAttributesLine, { attributeValues: visibleValues, attributeType: attributeType, paging: paging, parentUri: parentUri, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv })));
|
|
51
51
|
case RENDERER_TYPES.special:
|
|
52
52
|
return React.createElement(SpecialRenderer, { values: visibleValues, attributeType: attributeType, showTitle: showTitle });
|
|
53
53
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AttributeType, ImageAttributeValue } from '@reltio/mdm-sdk';
|
|
2
|
+
import { AttributeType, ImageAttributeValue, Paging } from '@reltio/mdm-sdk';
|
|
3
|
+
import { RequestNextPageOfAttributeValuesPayload } from '@reltio/mdm-module';
|
|
3
4
|
import { SIZES_TYPE } from '../../ImageAttributesLine/styles';
|
|
4
5
|
declare type Props = {
|
|
5
6
|
attributeValues: ImageAttributeValue[];
|
|
6
7
|
attributeType: AttributeType;
|
|
7
8
|
imageSize?: SIZES_TYPE;
|
|
9
|
+
paging?: Paging;
|
|
10
|
+
parentUri?: string;
|
|
11
|
+
showNonOv?: boolean;
|
|
12
|
+
requestNextPageOfAttributeValues?: (payload: RequestNextPageOfAttributeValuesPayload) => void;
|
|
8
13
|
};
|
|
9
|
-
declare const ImageAttributesLine: ({ attributeType, attributeValues, imageSize }: Props) => JSX.Element;
|
|
14
|
+
declare const ImageAttributesLine: ({ attributeType, attributeValues, paging, parentUri, requestNextPageOfAttributeValues, showNonOv, imageSize }: Props) => JSX.Element;
|
|
10
15
|
export default ImageAttributesLine;
|
|
@@ -8,7 +8,7 @@ import { DEFAULT_IMAGE_SIZE } from '../../ImageAttributesLine/constants';
|
|
|
8
8
|
import { getHistoryAppearanceByUri, getHistoryAttributeClassName } from '../helpers/historyAppearance';
|
|
9
9
|
import { useStyles } from './styles';
|
|
10
10
|
var ImageAttributesLine = function (_a) {
|
|
11
|
-
var attributeType = _a.attributeType, _b = _a.attributeValues, attributeValues = _b === void 0 ? [] : _b, _c = _a.imageSize, imageSize = _c === void 0 ? DEFAULT_IMAGE_SIZE : _c;
|
|
11
|
+
var attributeType = _a.attributeType, _b = _a.attributeValues, attributeValues = _b === void 0 ? [] : _b, paging = _a.paging, parentUri = _a.parentUri, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues, showNonOv = _a.showNonOv, _c = _a.imageSize, imageSize = _c === void 0 ? DEFAULT_IMAGE_SIZE : _c;
|
|
12
12
|
var styles = useStyles(imageSize);
|
|
13
13
|
var appearance = useContext(HistoryDiffContext).appearance;
|
|
14
14
|
var renderImage = function (_a) {
|
|
@@ -26,6 +26,6 @@ var ImageAttributesLine = function (_a) {
|
|
|
26
26
|
};
|
|
27
27
|
return renderImage;
|
|
28
28
|
};
|
|
29
|
-
return (React.createElement(ImageAttributesLineCommon, { attributeValues: attributeValues, attributeType: attributeType, renderImage: renderImage, imageSize: imageSize }));
|
|
29
|
+
return (React.createElement(ImageAttributesLineCommon, { attributeValues: attributeValues, attributeType: attributeType, renderImage: renderImage, imageSize: imageSize, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, paging: paging, parentUri: parentUri, showNonOv: showNonOv }));
|
|
30
30
|
};
|
|
31
31
|
export default ImageAttributesLine;
|
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
+
import i18n from 'ui-i18n';
|
|
2
4
|
import MoreVertIcon from '@material-ui/icons/MoreVert';
|
|
5
|
+
import mdmModule, { HistoryMode, profile } from '@reltio/mdm-module';
|
|
3
6
|
import { SmallIconButton } from '../../SmallIconButton';
|
|
7
|
+
import DropDownMenuButton from '../../DropDownMenuButton/DropDownMenuButton';
|
|
8
|
+
import MenuItemRenderer from './MenuItemRenderer';
|
|
4
9
|
import { useStyles } from './styles';
|
|
5
10
|
var HistoryMenuButton = function () {
|
|
6
11
|
var styles = useStyles();
|
|
7
|
-
|
|
12
|
+
var mode = useSelector(mdmModule.selectors.getHistoryMode);
|
|
13
|
+
var dispatch = useDispatch();
|
|
14
|
+
var handleModeChange = function (selectedMode) {
|
|
15
|
+
dispatch(profile.history.actions.setHistoryMode(selectedMode));
|
|
16
|
+
};
|
|
17
|
+
var menuItems = [
|
|
18
|
+
{
|
|
19
|
+
text: i18n.text('Compare to Current view'),
|
|
20
|
+
selected: mode === HistoryMode.Current,
|
|
21
|
+
onClick: function () { return handleModeChange(HistoryMode.Current); }
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
text: i18n.text('Compare to Previous view'),
|
|
25
|
+
selected: mode === HistoryMode.Previous,
|
|
26
|
+
onClick: function () { return handleModeChange(HistoryMode.Previous); }
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
return (React.createElement(DropDownMenuButton, { MenuItemRenderer: MenuItemRenderer, buttonComponent: SmallIconButton, buttonProps: {
|
|
30
|
+
icon: MoreVertIcon,
|
|
31
|
+
size: 'L',
|
|
32
|
+
className: styles.icon
|
|
33
|
+
}, menuId: 'history-menu', menuItems: menuItems }));
|
|
8
34
|
};
|
|
9
35
|
export default HistoryMenuButton;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Item = {
|
|
3
|
+
text: string;
|
|
4
|
+
selected: boolean;
|
|
5
|
+
onClick: (e: any) => void;
|
|
6
|
+
};
|
|
7
|
+
declare type Props = {
|
|
8
|
+
item: Item;
|
|
9
|
+
onMenuClose?: () => void;
|
|
10
|
+
};
|
|
11
|
+
declare const MenuItemRenderer: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLLIElement>>;
|
|
12
|
+
export default MenuItemRenderer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import MenuItem from '@material-ui/core/MenuItem';
|
|
3
|
+
import Typography from '@material-ui/core/Typography';
|
|
4
|
+
import CheckIcon from '@material-ui/icons/Check';
|
|
5
|
+
import { noop } from '../../../core';
|
|
6
|
+
import { useStyles } from './styles';
|
|
7
|
+
var MenuItemRenderer = forwardRef(function (_a, ref) {
|
|
8
|
+
var item = _a.item, _b = _a.onMenuClose, onMenuClose = _b === void 0 ? noop : _b;
|
|
9
|
+
var styles = useStyles();
|
|
10
|
+
var text = item.text, selected = item.selected, onClick = item.onClick;
|
|
11
|
+
var handleClick = function (e) {
|
|
12
|
+
onMenuClose();
|
|
13
|
+
onClick(e);
|
|
14
|
+
};
|
|
15
|
+
return (React.createElement(MenuItem, { classes: { root: styles.menuItem }, onClick: handleClick, ref: ref },
|
|
16
|
+
selected && React.createElement(CheckIcon, { className: styles.checkIcon }),
|
|
17
|
+
React.createElement(Typography, { classes: { root: styles.menuText } }, text)));
|
|
18
|
+
});
|
|
19
|
+
MenuItemRenderer.displayName = 'MenuItemRenderer';
|
|
20
|
+
export default MenuItemRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"icon">;
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"icon" | "menuItem" | "menuText" | "checkIcon">;
|
|
@@ -2,5 +2,18 @@ import { makeStyles } from '@material-ui/core/styles';
|
|
|
2
2
|
export var useStyles = makeStyles({
|
|
3
3
|
icon: {
|
|
4
4
|
margin: 5
|
|
5
|
+
},
|
|
6
|
+
menuItem: {
|
|
7
|
+
minHeight: '32px'
|
|
8
|
+
},
|
|
9
|
+
menuText: {
|
|
10
|
+
fontSize: '13px',
|
|
11
|
+
lineHeight: '15px',
|
|
12
|
+
letterSpacing: 0,
|
|
13
|
+
marginLeft: '30px'
|
|
14
|
+
},
|
|
15
|
+
checkIcon: {
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
color: 'rgba(0, 0, 0, 0.54)'
|
|
5
18
|
}
|
|
6
19
|
});
|
|
@@ -17,6 +17,7 @@ export { default as EditableAttribute } from './attributes/editMode/AttributesFa
|
|
|
17
17
|
export { default as ReadOnlyAttributeValuesBlock } from './attributes/readMode/AttributeValuesBlock/AttributeValuesBlock';
|
|
18
18
|
export { default as ReadOnlyAttributesList } from './attributes/readMode/AttributesList';
|
|
19
19
|
export { default as ImageAttributesLine } from './attributes/readMode/ImageAttributesLine';
|
|
20
|
+
export { default as EditableImageAttributesLine } from './attributes/editMode/ImageAttributesLine';
|
|
20
21
|
export { default as NestedAttribute } from './attributes/readMode/NestedAttribute';
|
|
21
22
|
export { default as ReferenceAttribute } from './attributes/readMode/ReferenceAttribute';
|
|
22
23
|
export { default as SimpleAttribute } from './attributes/readMode/SimpleAttribute';
|
package/esm/components/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { default as EditableAttribute } from './attributes/editMode/AttributesFa
|
|
|
16
16
|
export { default as ReadOnlyAttributeValuesBlock } from './attributes/readMode/AttributeValuesBlock/AttributeValuesBlock';
|
|
17
17
|
export { default as ReadOnlyAttributesList } from './attributes/readMode/AttributesList';
|
|
18
18
|
export { default as ImageAttributesLine } from './attributes/readMode/ImageAttributesLine';
|
|
19
|
+
export { default as EditableImageAttributesLine } from './attributes/editMode/ImageAttributesLine';
|
|
19
20
|
export { default as NestedAttribute } from './attributes/readMode/NestedAttribute';
|
|
20
21
|
export { default as ReferenceAttribute } from './attributes/readMode/ReferenceAttribute';
|
|
21
22
|
export { default as SimpleAttribute } from './attributes/readMode/SimpleAttribute';
|
package/esm/components/workflow/cards/DataChangeRequestTaskCard/DataChangeRequestTaskCard.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { getDataChangeRequest } from '@reltio/mdm-sdk';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import GenericWorkflowTaskCard from '../GenericWorkflowTaskCard/GenericWorkflowTaskCard';
|
|
4
3
|
import LineDecorator from '../../components/LineDecorator/LineDecorator';
|
|
5
4
|
import { getDCRUri } from '../../helpers';
|
|
6
5
|
import DcrTaskIcon from '../../../../icons/DcrTaskIcon';
|
|
7
|
-
import { AttributesChangesContext } from '../../components/AttributesChanges/contexts/AttributesChangesContext';
|
|
8
|
-
import { extractObjectsFromChangeRequest } from '../../components/AttributesChanges/helpers/helpers';
|
|
9
6
|
import AttributesChanges from '../../components/AttributesChanges/AttributesChanges';
|
|
7
|
+
import { useChangeRequest } from '../../hooks/useChangeRequest';
|
|
10
8
|
var DataChangeRequestTaskCard = function (_a) {
|
|
11
9
|
var task = _a.task;
|
|
12
10
|
var objectURIs = task.objectURIs;
|
|
13
11
|
var dcrUri = getDCRUri(objectURIs);
|
|
14
|
-
var _b =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var objectsWithChanges = useMemo(function () { return (dcr ? extractObjectsFromChangeRequest(dcr) : []); }, [dcr]);
|
|
19
|
-
return (React.createElement(GenericWorkflowTaskCard, { task: task, Icon: DcrTaskIcon }, dcr && (React.createElement(AttributesChangesContext.Provider, { value: dcr.objectsInfo },
|
|
20
|
-
React.createElement(LineDecorator, { last: true }, objectsWithChanges.map(function (object) { return (React.createElement(AttributesChanges, { key: object.uri, changes: dcr.changes[object.uri], objectInfo: object })); }))))));
|
|
12
|
+
var _b = useChangeRequest(dcrUri), dcr = _b.dcr, groupedObjects = _b.groupedObjects;
|
|
13
|
+
return (React.createElement(GenericWorkflowTaskCard, { task: task, Icon: DcrTaskIcon }, dcr &&
|
|
14
|
+
groupedObjects.map(function (object, index) { return (React.createElement(LineDecorator, { key: index, last: index === groupedObjects.length - 1, divider: true },
|
|
15
|
+
React.createElement(AttributesChanges, { entityInfo: object.entity, relationsInfo: object.relations, changes: dcr.changes, objectsInfo: dcr.objectsInfo }))); })));
|
|
21
16
|
};
|
|
22
17
|
export default DataChangeRequestTaskCard;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { DCRChanges, DCRObjectsInfo, EntityInfo, RelationInfo } from '../../types/dcrTypes';
|
|
3
3
|
declare type Props = {
|
|
4
|
-
changes:
|
|
5
|
-
|
|
4
|
+
changes: DCRChanges;
|
|
5
|
+
objectsInfo: DCRObjectsInfo;
|
|
6
|
+
entityInfo: EntityInfo;
|
|
7
|
+
relationsInfo?: RelationInfo[];
|
|
8
|
+
max?: number;
|
|
6
9
|
};
|
|
7
|
-
declare const AttributesChanges: ({ changes,
|
|
10
|
+
declare const AttributesChanges: ({ changes, objectsInfo, entityInfo, relationsInfo, max }: Props) => JSX.Element;
|
|
8
11
|
export default AttributesChanges;
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { useSelector } from 'react-redux';
|
|
3
|
+
import i18n from 'ui-i18n';
|
|
4
|
+
import { flatten } from 'ramda';
|
|
3
5
|
import mdmModule from '@reltio/mdm-module';
|
|
4
6
|
import { getEntityUriForLink, getLabel } from '@reltio/mdm-sdk';
|
|
5
7
|
import { mergeChanges } from './helpers/mergeHelpers';
|
|
6
|
-
import EntityUriLink from '../../../EntityUriLink/EntityUriLink';
|
|
7
8
|
import ShowMoreLink from './components/ShowMoreLink/ShowMoreLink';
|
|
8
9
|
import DCRChangesList from './components/DCRChangesList/DCRChangesList';
|
|
10
|
+
import { AttributesChangesContext } from './contexts/AttributesChangesContext';
|
|
9
11
|
import { useCollapsibleList } from './hooks/useCollapsibleList';
|
|
12
|
+
import EntityUriLink from '../../../EntityUriLink/EntityUriLink';
|
|
10
13
|
import { useStyles } from './styles';
|
|
11
14
|
var AttributesChanges = function (_a) {
|
|
12
|
-
var changes = _a.changes,
|
|
15
|
+
var changes = _a.changes, objectsInfo = _a.objectsInfo, entityInfo = _a.entityInfo, relationsInfo = _a.relationsInfo, max = _a.max;
|
|
13
16
|
var styles = useStyles();
|
|
14
17
|
var metadata = useSelector(mdmModule.selectors.getMetadata);
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
var _b = useMemo(function () { return mergeChanges(metadata, changes, entityInfo, relationsInfo); }, [metadata, changes, entityInfo, relationsInfo]), mergedEntityChanges = _b[0], mergedRelationsChanges = _b[1];
|
|
19
|
+
var changesList = useMemo(function () {
|
|
20
|
+
var relationshipTitle = { label: i18n.text('Relationships') };
|
|
21
|
+
return mergedRelationsChanges.length > 0
|
|
22
|
+
? flatten([mergedEntityChanges, relationshipTitle, mergedRelationsChanges])
|
|
23
|
+
: mergedEntityChanges;
|
|
24
|
+
}, [mergedEntityChanges, mergedRelationsChanges]);
|
|
25
|
+
var _c = useCollapsibleList(changesList, max), isExpanded = _c.isExpanded, onToggle = _c.onToggle, itemsToShow = _c.itemsToShow, collapsedSuggestionsCount = _c.collapsedSuggestionsCount;
|
|
26
|
+
return (React.createElement(AttributesChangesContext.Provider, { value: objectsInfo },
|
|
27
|
+
React.createElement("div", { className: styles.container },
|
|
28
|
+
React.createElement(EntityUriLink, { className: styles.uri, value: getEntityUriForLink(entityInfo) },
|
|
29
|
+
React.createElement("div", { className: styles.label }, getLabel(entityInfo.label))),
|
|
30
|
+
React.createElement(DCRChangesList, { changes: itemsToShow }),
|
|
31
|
+
collapsedSuggestionsCount > 0 && (React.createElement(ShowMoreLink, { onClick: onToggle, suggestionsCount: collapsedSuggestionsCount, isExpanded: isExpanded, className: styles.showMoreLink })))));
|
|
22
32
|
};
|
|
23
33
|
export default AttributesChanges;
|
package/esm/components/workflow/components/AttributesChanges/components/ChangeView/ChangeView.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OperationTypes } from '
|
|
2
|
+
import { OperationTypes } from '../../../../constants/operations';
|
|
3
3
|
declare type Props = {
|
|
4
|
-
label: React.
|
|
5
|
-
oldValue?: React.
|
|
6
|
-
newValue?: React.
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
oldValue?: React.ReactNode;
|
|
6
|
+
newValue?: React.ReactNode;
|
|
7
7
|
operation?: OperationTypes;
|
|
8
8
|
className?: string;
|
|
9
9
|
};
|
package/esm/components/workflow/components/AttributesChanges/components/ChangeView/styles.js
CHANGED
|
@@ -5,20 +5,15 @@ export var useStyles = makeStyles(function (theme) { return ({
|
|
|
5
5
|
lineHeight: '20px',
|
|
6
6
|
color: theme.palette.text.primary,
|
|
7
7
|
marginTop: '6px',
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
overflow: 'hidden'
|
|
8
|
+
overflow: 'hidden',
|
|
9
|
+
wordBreak: 'break-word'
|
|
11
10
|
},
|
|
12
11
|
fieldName: {
|
|
13
|
-
display: 'flex',
|
|
14
|
-
alignItems: 'center',
|
|
15
12
|
color: theme.palette.text.secondary,
|
|
16
13
|
marginRight: '8px'
|
|
17
14
|
},
|
|
18
15
|
difference: {
|
|
19
|
-
|
|
20
|
-
alignItems: 'center',
|
|
21
|
-
flexDirection: 'row'
|
|
16
|
+
marginRight: '8px'
|
|
22
17
|
},
|
|
23
18
|
arrow: {
|
|
24
19
|
margin: '0 4px',
|
|
@@ -31,7 +26,6 @@ export var useStyles = makeStyles(function (theme) { return ({
|
|
|
31
26
|
fontWeight: 500,
|
|
32
27
|
lineHeight: '16px',
|
|
33
28
|
letterSpacing: 0,
|
|
34
|
-
marginLeft: '8px',
|
|
35
29
|
flexShrink: 0,
|
|
36
30
|
textTransform: 'capitalize',
|
|
37
31
|
color: theme.palette.primary.main,
|