@reltio/components 1.4.1374 → 1.4.1375
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/activityLog/activities/fields/DeltaField.js +6 -2
- package/cjs/components/activityLog/types/DeltaValue.d.ts +1 -1
- package/cjs/components/activityLog/utils/activities.d.ts +2 -1
- package/cjs/components/activityLog/utils/activities.js +16 -13
- package/esm/components/activityLog/activities/fields/DeltaField.js +6 -2
- package/esm/components/activityLog/types/DeltaValue.d.ts +1 -1
- package/esm/components/activityLog/utils/activities.d.ts +2 -1
- package/esm/components/activityLog/utils/activities.js +17 -14
- package/package.json +3 -3
|
@@ -20,20 +20,24 @@ var DeltaField = function (_a) {
|
|
|
20
20
|
var styles = (0, styles_1.useStyles)();
|
|
21
21
|
var commonStyles = (0, commonStyles_1.useCommonStyles)();
|
|
22
22
|
var metadata = (0, react_redux_1.useSelector)(mdm_module_1.default.selectors.getMetadata);
|
|
23
|
+
var attributePresentations = (0, react_redux_1.useSelector)(mdm_module_1.default.selectors.getAttributePresentations);
|
|
23
24
|
var attribute = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, delta.attributeType);
|
|
24
25
|
var newValue = (_b = delta.newValue) === null || _b === void 0 ? void 0 : _b.value;
|
|
25
26
|
var oldValue = (_c = delta.oldValue) === null || _c === void 0 ? void 0 : _c.value;
|
|
26
27
|
var value = oldValue || newValue;
|
|
27
28
|
var deltaLabel = types_1.DeltaTypes[delta.type];
|
|
29
|
+
var converter = function (value) {
|
|
30
|
+
return (0, activities_1.stringifyDeltaValue)(value, delta.attributeType, metadata, attributePresentations);
|
|
31
|
+
};
|
|
28
32
|
return (react_1.default.createElement("div", { className: commonStyles.field },
|
|
29
33
|
react_1.default.createElement("span", { className: commonStyles.fieldName },
|
|
30
34
|
(attribute === null || attribute === void 0 ? void 0 : attribute.label) || (attribute === null || attribute === void 0 ? void 0 : attribute.name),
|
|
31
35
|
":"),
|
|
32
36
|
react_1.default.createElement("span", null,
|
|
33
|
-
value && (
|
|
37
|
+
value && converter(value),
|
|
34
38
|
newValue && oldValue && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
35
39
|
react_1.default.createElement(ArrowForward_1.default, { className: styles.arrow }),
|
|
36
|
-
(
|
|
40
|
+
converter(newValue)))),
|
|
37
41
|
deltaLabel && (react_1.default.createElement(Chip_1.default, { variant: "outlined", label: deltaLabel, className: (0, classnames_1.default)(styles.chip, deltaLabel) }))));
|
|
38
42
|
};
|
|
39
43
|
exports.default = DeltaField;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Metadata, AttributePresentations } from '@reltio/mdm-sdk';
|
|
1
2
|
import { ActivityData, ActivityTypes, DeltaValue } from '../types';
|
|
2
3
|
export declare const getActivityType: (activity: ActivityData) => any;
|
|
3
4
|
export declare const isValidActivityType: (type: string) => boolean;
|
|
4
5
|
export declare const removeIgnoredItems: (activity: ActivityData) => ActivityData;
|
|
5
6
|
export declare const splitActivityByType: (activity: ActivityData) => any;
|
|
6
|
-
export declare const stringifyDeltaValue: (
|
|
7
|
+
export declare const stringifyDeltaValue: (deltaValue: DeltaValue['value'], attributeTypeUri: string, metadata: Metadata, attributePresentations: AttributePresentations) => any;
|
|
7
8
|
export declare const getActivityLabel: (type: ActivityTypes) => string;
|
|
@@ -15,6 +15,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.getActivityLabel = exports.stringifyDeltaValue = exports.splitActivityByType = exports.removeIgnoredItems = exports.isValidActivityType = exports.getActivityType = void 0;
|
|
18
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
18
19
|
var ramda_1 = require("ramda");
|
|
19
20
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
20
21
|
var types_1 = require("../types");
|
|
@@ -44,22 +45,24 @@ var splitActivityByType = function (activity) {
|
|
|
44
45
|
}, (0, ramda_1.map)(function (items) { return (__assign(__assign({}, activity), { items: items, itemsTotal: items.length })); }), function () { return [activity]; }))(activity);
|
|
45
46
|
};
|
|
46
47
|
exports.splitActivityByType = splitActivityByType;
|
|
47
|
-
var stringifyDeltaValue = function (
|
|
48
|
-
|
|
48
|
+
var stringifyDeltaValue = function (deltaValue, attributeTypeUri, metadata, attributePresentations) {
|
|
49
|
+
var attributeType = (0, mdm_sdk_1.findAttributeTypeByUri)(metadata, attributeTypeUri);
|
|
50
|
+
var dataTypeDefinition = (0, mdm_sdk_1.getAttrDataTypeDefinition)(attributeType);
|
|
51
|
+
var formatValue = (0, mdm_sdk_1.formatDataTypeValue)({ attributePresentations: attributePresentations, dataTypeDefinition: dataTypeDefinition });
|
|
52
|
+
if ((0, ramda_1.isNil)(deltaValue)) {
|
|
49
53
|
return '';
|
|
50
54
|
}
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
else if (Array.isArray(delta)) {
|
|
55
|
-
return delta.map(exports.stringifyDeltaValue).join(', ');
|
|
56
|
-
}
|
|
57
|
-
else if ((0, ramda_1.is)(Object, delta)) {
|
|
58
|
-
return 'value' in delta ? (0, exports.stringifyDeltaValue)(delta.value) : (0, exports.stringifyDeltaValue)(Object.values(delta));
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
return delta.toString();
|
|
55
|
+
if (typeof deltaValue === 'string') {
|
|
56
|
+
return attributeType ? formatValue(deltaValue) : deltaValue;
|
|
62
57
|
}
|
|
58
|
+
return Object.entries(deltaValue)
|
|
59
|
+
.flatMap(function (_a) {
|
|
60
|
+
var attributeTypeName = _a[0], deltaValues = _a[1];
|
|
61
|
+
return deltaValues.map(function (deltaValue) {
|
|
62
|
+
return (0, exports.stringifyDeltaValue)(deltaValue.value, (0, mdm_sdk_1.makeAttrTypeUri)(attributeTypeUri, attributeTypeName), metadata, attributePresentations);
|
|
63
|
+
});
|
|
64
|
+
})
|
|
65
|
+
.join(', ');
|
|
63
66
|
};
|
|
64
67
|
exports.stringifyDeltaValue = stringifyDeltaValue;
|
|
65
68
|
var getActivityLabel = function (type) {
|
|
@@ -15,20 +15,24 @@ var DeltaField = function (_a) {
|
|
|
15
15
|
var styles = useStyles();
|
|
16
16
|
var commonStyles = useCommonStyles();
|
|
17
17
|
var metadata = useSelector(mdmModule.selectors.getMetadata);
|
|
18
|
+
var attributePresentations = useSelector(mdmModule.selectors.getAttributePresentations);
|
|
18
19
|
var attribute = findAttributeTypeByUri(metadata, delta.attributeType);
|
|
19
20
|
var newValue = (_b = delta.newValue) === null || _b === void 0 ? void 0 : _b.value;
|
|
20
21
|
var oldValue = (_c = delta.oldValue) === null || _c === void 0 ? void 0 : _c.value;
|
|
21
22
|
var value = oldValue || newValue;
|
|
22
23
|
var deltaLabel = DeltaTypes[delta.type];
|
|
24
|
+
var converter = function (value) {
|
|
25
|
+
return stringifyDeltaValue(value, delta.attributeType, metadata, attributePresentations);
|
|
26
|
+
};
|
|
23
27
|
return (React.createElement("div", { className: commonStyles.field },
|
|
24
28
|
React.createElement("span", { className: commonStyles.fieldName },
|
|
25
29
|
(attribute === null || attribute === void 0 ? void 0 : attribute.label) || (attribute === null || attribute === void 0 ? void 0 : attribute.name),
|
|
26
30
|
":"),
|
|
27
31
|
React.createElement("span", null,
|
|
28
|
-
value &&
|
|
32
|
+
value && converter(value),
|
|
29
33
|
newValue && oldValue && (React.createElement(React.Fragment, null,
|
|
30
34
|
React.createElement(ArrowForwardIcon, { className: styles.arrow }),
|
|
31
|
-
|
|
35
|
+
converter(newValue)))),
|
|
32
36
|
deltaLabel && (React.createElement(Chip, { variant: "outlined", label: deltaLabel, className: classnames(styles.chip, deltaLabel) }))));
|
|
33
37
|
};
|
|
34
38
|
export default DeltaField;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Metadata, AttributePresentations } from '@reltio/mdm-sdk';
|
|
1
2
|
import { ActivityData, ActivityTypes, DeltaValue } from '../types';
|
|
2
3
|
export declare const getActivityType: (activity: ActivityData) => any;
|
|
3
4
|
export declare const isValidActivityType: (type: string) => boolean;
|
|
4
5
|
export declare const removeIgnoredItems: (activity: ActivityData) => ActivityData;
|
|
5
6
|
export declare const splitActivityByType: (activity: ActivityData) => any;
|
|
6
|
-
export declare const stringifyDeltaValue: (
|
|
7
|
+
export declare const stringifyDeltaValue: (deltaValue: DeltaValue['value'], attributeTypeUri: string, metadata: Metadata, attributePresentations: AttributePresentations) => any;
|
|
7
8
|
export declare const getActivityLabel: (type: ActivityTypes) => string;
|
|
@@ -9,7 +9,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
12
|
+
import { formatDataTypeValue, findAttributeTypeByUri, makeAttrTypeUri, getAttrDataTypeDefinition } from '@reltio/mdm-sdk';
|
|
13
|
+
import { filter, groupBy, ifElse, map, path, pipe, propOr, values, isNil, includes, reject } from 'ramda';
|
|
13
14
|
import i18n from 'ui-i18n';
|
|
14
15
|
import { ActivityTypes } from '../types';
|
|
15
16
|
var getItemDataType = path(['data', 'type']);
|
|
@@ -34,22 +35,24 @@ export var splitActivityByType = function (activity) {
|
|
|
34
35
|
return length > 1;
|
|
35
36
|
}, map(function (items) { return (__assign(__assign({}, activity), { items: items, itemsTotal: items.length })); }), function () { return [activity]; }))(activity);
|
|
36
37
|
};
|
|
37
|
-
export var stringifyDeltaValue = function (
|
|
38
|
-
|
|
38
|
+
export var stringifyDeltaValue = function (deltaValue, attributeTypeUri, metadata, attributePresentations) {
|
|
39
|
+
var attributeType = findAttributeTypeByUri(metadata, attributeTypeUri);
|
|
40
|
+
var dataTypeDefinition = getAttrDataTypeDefinition(attributeType);
|
|
41
|
+
var formatValue = formatDataTypeValue({ attributePresentations: attributePresentations, dataTypeDefinition: dataTypeDefinition });
|
|
42
|
+
if (isNil(deltaValue)) {
|
|
39
43
|
return '';
|
|
40
44
|
}
|
|
41
|
-
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
else if (Array.isArray(delta)) {
|
|
45
|
-
return delta.map(stringifyDeltaValue).join(', ');
|
|
46
|
-
}
|
|
47
|
-
else if (is(Object, delta)) {
|
|
48
|
-
return 'value' in delta ? stringifyDeltaValue(delta.value) : stringifyDeltaValue(Object.values(delta));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
return delta.toString();
|
|
45
|
+
if (typeof deltaValue === 'string') {
|
|
46
|
+
return attributeType ? formatValue(deltaValue) : deltaValue;
|
|
52
47
|
}
|
|
48
|
+
return Object.entries(deltaValue)
|
|
49
|
+
.flatMap(function (_a) {
|
|
50
|
+
var attributeTypeName = _a[0], deltaValues = _a[1];
|
|
51
|
+
return deltaValues.map(function (deltaValue) {
|
|
52
|
+
return stringifyDeltaValue(deltaValue.value, makeAttrTypeUri(attributeTypeUri, attributeTypeName), metadata, attributePresentations);
|
|
53
|
+
});
|
|
54
|
+
})
|
|
55
|
+
.join(', ');
|
|
53
56
|
};
|
|
54
57
|
export var getActivityLabel = function (type) {
|
|
55
58
|
var _a;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1375",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@date-io/moment": "^1.3.5",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
|
-
"@reltio/mdm-module": "^1.4.
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
10
|
+
"@reltio/mdm-module": "^1.4.1375",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1375",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|