@reltio/components 1.4.949 → 1.4.953
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/AvatarWithFallback/AvatarWithFallback.d.ts +5 -1
- package/cjs/components/AvatarWithFallback/AvatarWithFallback.js +4 -3
- package/cjs/components/ImageAttributesGallery/HeaderRight/styles.d.ts +1 -1
- package/cjs/components/RelationEditor/index.d.ts +16 -4
- package/cjs/components/SourceIcon/SourceIcon.d.ts +5 -1
- package/cjs/components/SourceIcon/SourceIcon.js +2 -2
- package/cjs/components/attributes/editMode/AttributesList/helpers.js +1 -1
- package/cjs/components/attributes/editMode/AttributesPager/SpecialRenderer.d.ts +2 -1
- package/cjs/components/attributes/editMode/AttributesPager/SpecialRenderer.js +6 -6
- package/cjs/components/attributes/editMode/EntityCreator/EntityCreator.js +1 -1
- package/cjs/components/attributes/editMode/Roles/Roles.d.ts +4 -1
- package/cjs/components/attributes/editMode/Roles/Roles.js +16 -10
- package/cjs/components/attributes/editMode/Roles/styles.d.ts +1 -1
- package/cjs/components/attributes/editMode/Roles/styles.js +12 -0
- package/cjs/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +2 -2
- package/cjs/components/attributes/editMode/Tags/Tags.d.ts +5 -2
- package/cjs/components/attributes/editMode/Tags/Tags.js +16 -8
- package/cjs/components/attributes/editMode/Tags/styles.d.ts +1 -0
- package/cjs/components/attributes/editMode/Tags/styles.js +15 -0
- package/cjs/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +1 -1
- package/cjs/components/workflow/hooks/useWorkflowAssignee.js +5 -1
- package/esm/components/AvatarWithFallback/AvatarWithFallback.d.ts +5 -1
- package/esm/components/AvatarWithFallback/AvatarWithFallback.js +4 -3
- package/esm/components/ImageAttributesGallery/HeaderRight/styles.d.ts +1 -1
- package/esm/components/RelationEditor/index.d.ts +16 -4
- package/esm/components/SourceIcon/SourceIcon.d.ts +5 -1
- package/esm/components/SourceIcon/SourceIcon.js +2 -2
- package/esm/components/attributes/editMode/AttributesList/helpers.js +2 -2
- package/esm/components/attributes/editMode/AttributesPager/SpecialRenderer.d.ts +2 -1
- package/esm/components/attributes/editMode/AttributesPager/SpecialRenderer.js +6 -6
- package/esm/components/attributes/editMode/EntityCreator/EntityCreator.js +1 -1
- package/esm/components/attributes/editMode/Roles/Roles.d.ts +4 -1
- package/esm/components/attributes/editMode/Roles/Roles.js +17 -11
- package/esm/components/attributes/editMode/Roles/styles.d.ts +1 -1
- package/esm/components/attributes/editMode/Roles/styles.js +12 -0
- package/esm/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +2 -2
- package/esm/components/attributes/editMode/Tags/Tags.d.ts +5 -2
- package/esm/components/attributes/editMode/Tags/Tags.js +17 -9
- package/esm/components/attributes/editMode/Tags/styles.d.ts +1 -0
- package/esm/components/attributes/editMode/Tags/styles.js +12 -0
- package/esm/components/workflow/components/AttributesChanges/helpers/mergeHelpers.js +1 -1
- package/esm/components/workflow/hooks/useWorkflowAssignee.js +6 -2
- package/package.json +3 -3
|
@@ -4,6 +4,10 @@ declare type Props = {
|
|
|
4
4
|
icon?: string;
|
|
5
5
|
avatarText?: string;
|
|
6
6
|
variant?: 'circle' | 'circular' | 'rounded' | 'square';
|
|
7
|
+
rootClasses?: {
|
|
8
|
+
iconRoot?: string;
|
|
9
|
+
textRoot?: string;
|
|
10
|
+
};
|
|
7
11
|
};
|
|
8
|
-
declare const AvatarWithFallback: ({ className, icon, avatarText, ...otherProps }: Props) => JSX.Element;
|
|
12
|
+
declare const AvatarWithFallback: ({ className, icon, avatarText, rootClasses, ...otherProps }: Props) => JSX.Element;
|
|
9
13
|
export default AvatarWithFallback;
|
|
@@ -45,6 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
};
|
|
46
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
47
|
var Avatar_1 = __importDefault(require("@material-ui/core/Avatar"));
|
|
48
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
48
49
|
var react_1 = __importStar(require("react"));
|
|
49
50
|
var AvatarStates;
|
|
50
51
|
(function (AvatarStates) {
|
|
@@ -53,7 +54,7 @@ var AvatarStates;
|
|
|
53
54
|
AvatarStates[AvatarStates["ERROR_MODE"] = 2] = "ERROR_MODE";
|
|
54
55
|
})(AvatarStates || (AvatarStates = {}));
|
|
55
56
|
var AvatarWithFallback = function (_a) {
|
|
56
|
-
var className = _a.className, icon = _a.icon, avatarText = _a.avatarText, otherProps = __rest(_a, ["className", "icon", "avatarText"]);
|
|
57
|
+
var className = _a.className, icon = _a.icon, avatarText = _a.avatarText, rootClasses = _a.rootClasses, otherProps = __rest(_a, ["className", "icon", "avatarText", "rootClasses"]);
|
|
57
58
|
var _b = react_1.useState(null), state = _b[0], setState = _b[1];
|
|
58
59
|
react_1.useEffect(function () {
|
|
59
60
|
if (icon) {
|
|
@@ -68,10 +69,10 @@ var AvatarWithFallback = function (_a) {
|
|
|
68
69
|
};
|
|
69
70
|
switch (state) {
|
|
70
71
|
case AvatarStates.ICON_MODE:
|
|
71
|
-
return react_1.default.createElement(Avatar_1.default, __assign({ className: className, src: icon, onError: onImageLoadFail }, otherProps));
|
|
72
|
+
return (react_1.default.createElement(Avatar_1.default, __assign({ className: classnames_1.default(className, rootClasses === null || rootClasses === void 0 ? void 0 : rootClasses.iconRoot), src: icon, onError: onImageLoadFail }, otherProps)));
|
|
72
73
|
case AvatarStates.TEXT_MODE:
|
|
73
74
|
case AvatarStates.ERROR_MODE:
|
|
74
|
-
return (react_1.default.createElement(Avatar_1.default, __assign({ className: className }, otherProps), avatarText));
|
|
75
|
+
return (react_1.default.createElement(Avatar_1.default, __assign({ className: classnames_1.default(className, rootClasses === null || rootClasses === void 0 ? void 0 : rootClasses.textRoot) }, otherProps), avatarText));
|
|
75
76
|
default:
|
|
76
77
|
return null;
|
|
77
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"divider" | "
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"divider" | "deleteButton" | "downloadButton" | "shareButton">;
|
|
@@ -55,10 +55,22 @@ declare var _default: import("react-redux").ConnectedComponent<{
|
|
|
55
55
|
max: import("prop-types").Requireable<number>;
|
|
56
56
|
icon: import("prop-types").Requireable<string>;
|
|
57
57
|
caption: import("prop-types").Requireable<string>;
|
|
58
|
-
canCreate: import("prop-types").Requireable<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
canCreate: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
59
|
+
deviceTypes: import("prop-types").Requireable<string | string[]>;
|
|
60
|
+
roles: import("prop-types").Requireable<string[]>;
|
|
61
|
+
}>>;
|
|
62
|
+
canRead: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
63
|
+
deviceTypes: import("prop-types").Requireable<string | string[]>;
|
|
64
|
+
roles: import("prop-types").Requireable<string[]>;
|
|
65
|
+
}>>;
|
|
66
|
+
canUpdate: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
67
|
+
deviceTypes: import("prop-types").Requireable<string | string[]>;
|
|
68
|
+
roles: import("prop-types").Requireable<string[]>;
|
|
69
|
+
}>>;
|
|
70
|
+
canDelete: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
71
|
+
deviceTypes: import("prop-types").Requireable<string | string[]>;
|
|
72
|
+
roles: import("prop-types").Requireable<string[]>;
|
|
73
|
+
}>>;
|
|
62
74
|
editingEnabled: import("prop-types").Requireable<boolean>;
|
|
63
75
|
}>>;
|
|
64
76
|
mode: import("prop-types").Requireable<string>;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
declare type Props = {
|
|
3
3
|
sourceType: string;
|
|
4
4
|
className?: string;
|
|
5
|
+
classes?: {
|
|
6
|
+
iconRoot?: string;
|
|
7
|
+
textRoot?: string;
|
|
8
|
+
};
|
|
5
9
|
};
|
|
6
|
-
declare const SourceIcon: ({ sourceType, className }: Props) => JSX.Element;
|
|
10
|
+
declare const SourceIcon: ({ sourceType, className, classes }: Props) => JSX.Element;
|
|
7
11
|
export default SourceIcon;
|
|
@@ -10,9 +10,9 @@ var react_redux_1 = require("react-redux");
|
|
|
10
10
|
var AvatarWithFallback_1 = __importDefault(require("../AvatarWithFallback/AvatarWithFallback"));
|
|
11
11
|
var SOURCE_URL = 'https://s3.amazonaws.com/reltio.images/api';
|
|
12
12
|
var SourceIcon = function (_a) {
|
|
13
|
-
var sourceType = _a.sourceType, className = _a.className;
|
|
13
|
+
var sourceType = _a.sourceType, className = _a.className, classes = _a.classes;
|
|
14
14
|
var metadata = react_redux_1.useSelector(mdm_module_1.default.selectors.getMetadata);
|
|
15
15
|
var _b = mdm_sdk_1.findSourceSystemByUri(metadata, sourceType), label = _b.label, icon = _b.icon;
|
|
16
|
-
return (react_1.default.createElement(AvatarWithFallback_1.default, { className: className, avatarText: label[0], icon: icon ? mdm_sdk_1.getAbsoluteImageUrl(SOURCE_URL, icon) : null, variant: "square" }));
|
|
16
|
+
return (react_1.default.createElement(AvatarWithFallback_1.default, { className: className, avatarText: label[0], icon: icon ? mdm_sdk_1.getAbsoluteImageUrl(SOURCE_URL, icon) : null, variant: "square", rootClasses: classes }));
|
|
17
17
|
};
|
|
18
18
|
exports.default = SourceIcon;
|
|
@@ -18,7 +18,7 @@ var getMoreAttrTypes = function (attrTypes, entity) {
|
|
|
18
18
|
return attrTypes.filter(function (attrType) {
|
|
19
19
|
var source = getSource(attrType, entity);
|
|
20
20
|
var nameProp = getNameProp(attrType);
|
|
21
|
-
return !(attrType.singleValue && ramda_1.has(attrType[nameProp])(source));
|
|
21
|
+
return !((attrType.singleValue || mdm_sdk_1.isRoleAttrType(attrType) || mdm_sdk_1.isTagAttrType(attrType)) && ramda_1.has(attrType[nameProp])(source));
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
24
|
exports.getMoreAttrTypes = getMoreAttrTypes;
|
|
@@ -8,7 +8,8 @@ declare type Props = {
|
|
|
8
8
|
mode: Mode;
|
|
9
9
|
errorMessage?: string;
|
|
10
10
|
onDeleteAttribute: (param: AttributeItem) => void;
|
|
11
|
+
onChangeAttribute: (param: AttributeItem) => void;
|
|
11
12
|
showEmptyEditors?: boolean;
|
|
12
13
|
};
|
|
13
|
-
declare const SpecialRenderer: ({ values, attributeType, parentUri, mode, errorMessage, onDeleteAttribute, showEmptyEditors, ...otherProps }: Props) => JSX.Element;
|
|
14
|
+
declare const SpecialRenderer: ({ values, attributeType, parentUri, mode, errorMessage, onDeleteAttribute, onChangeAttribute, showEmptyEditors, ...otherProps }: Props) => JSX.Element;
|
|
14
15
|
export default SpecialRenderer;
|
|
@@ -56,11 +56,12 @@ var Roles_1 = require("../Roles/Roles");
|
|
|
56
56
|
var Tags_1 = __importDefault(require("../Tags"));
|
|
57
57
|
var styles_1 = require("./styles");
|
|
58
58
|
var SpecialRenderer = function (_a) {
|
|
59
|
-
var values = _a.values, attributeType = _a.attributeType, parentUri = _a.parentUri, mode = _a.mode, errorMessage = _a.errorMessage, onDeleteAttribute = _a.onDeleteAttribute, showEmptyEditors = _a.showEmptyEditors, otherProps = __rest(_a, ["values", "attributeType", "parentUri", "mode", "errorMessage", "onDeleteAttribute", "showEmptyEditors"]);
|
|
59
|
+
var values = _a.values, attributeType = _a.attributeType, parentUri = _a.parentUri, mode = _a.mode, errorMessage = _a.errorMessage, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, showEmptyEditors = _a.showEmptyEditors, otherProps = __rest(_a, ["values", "attributeType", "parentUri", "mode", "errorMessage", "onDeleteAttribute", "onChangeAttribute", "showEmptyEditors"]);
|
|
60
60
|
var styles = styles_1.useStyles();
|
|
61
61
|
var label = attributeType.label, isRequired = attributeType.required, cardinality = attributeType.cardinality;
|
|
62
62
|
var isEditableMode = mdm_sdk_1.isEditableMode(mode);
|
|
63
63
|
var _b = react_1.useState(false), hadDeletions = _b[0], setHadDeletions = _b[1];
|
|
64
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
65
|
var onDelete = react_1.useCallback(ramda_1.pipe(onDeleteAttribute, ramda_1.T, setHadDeletions), [onDeleteAttribute, setHadDeletions]);
|
|
65
66
|
var isEmptyValues = mdm_sdk_1.isEmptyValue(values);
|
|
66
67
|
var showEmpty = !hadDeletions && showEmptyEditors && isEmptyValues;
|
|
@@ -71,14 +72,13 @@ var SpecialRenderer = function (_a) {
|
|
|
71
72
|
var renderValue = function () {
|
|
72
73
|
switch (attributeType.uri) {
|
|
73
74
|
case mdm_sdk_1.EntityAttrTypes.tags.uri:
|
|
74
|
-
return react_1.default.createElement(Tags_1.default, { values: values });
|
|
75
|
-
case mdm_sdk_1.EntityAttrTypes.roles.uri:
|
|
76
|
-
return react_1.default.createElement(Roles_1.Roles, { values: values });
|
|
77
|
-
}
|
|
75
|
+
return react_1.default.createElement(Tags_1.default, { values: values, onDelete: onDelete, onChange: onChangeAttribute });
|
|
76
|
+
case mdm_sdk_1.EntityAttrTypes.roles.uri:
|
|
77
|
+
return react_1.default.createElement(Roles_1.Roles, { values: values, onDelete: onDelete, onChange: onChangeAttribute });
|
|
78
78
|
default: {
|
|
79
79
|
//startDate, endDate
|
|
80
80
|
var value = __assign(__assign({}, emptyEditorValue.current), { value: values[0] || '' });
|
|
81
|
-
return (react_1.default.createElement(Attribute_1.default, __assign({ attributeValue: value, attributeType: attributeType, mode: mode, onDeleteAttribute: onDelete }, otherProps)));
|
|
81
|
+
return (react_1.default.createElement(Attribute_1.default, __assign({ attributeValue: value, attributeType: attributeType, mode: mode, onDeleteAttribute: onDelete, onChangeAttribute: onChangeAttribute }, otherProps)));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
};
|
|
@@ -33,7 +33,7 @@ var EntityCreator = function (_a) {
|
|
|
33
33
|
attributeTypesSelectionStrategy,
|
|
34
34
|
entityType
|
|
35
35
|
]);
|
|
36
|
-
return entity ? (react_1.default.createElement(AttributesList_1.default, { attrTypes: attributeTypes, entity: entity, showEmptyEditors: true, drawLines: true, parentUri: entity.uri, mode: mode, crosswalks: entity.crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute })) : null;
|
|
36
|
+
return entity ? (react_1.default.createElement(AttributesList_1.default, { key: entity.uri, attrTypes: attributeTypes, entity: entity, showEmptyEditors: true, drawLines: true, parentUri: entity.uri, mode: mode, crosswalks: entity.crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute })) : null;
|
|
37
37
|
};
|
|
38
38
|
EntityCreator.propTypes = {
|
|
39
39
|
entityUri: prop_types_1.default.string,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { AttributeItem } from '../../..';
|
|
2
3
|
declare type Props = {
|
|
3
4
|
values: string[];
|
|
5
|
+
onChange: (param: AttributeItem) => void;
|
|
6
|
+
onDelete?: (param: AttributeItem) => void;
|
|
4
7
|
};
|
|
5
|
-
export declare const Roles: ({ values }: Props) => JSX.Element;
|
|
8
|
+
export declare const Roles: ({ values, onChange, onDelete }: Props) => JSX.Element;
|
|
6
9
|
export {};
|
|
@@ -23,19 +23,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.Roles = void 0;
|
|
26
|
-
var react_1 =
|
|
26
|
+
var react_1 = __importStar(require("react"));
|
|
27
27
|
var ramda_1 = require("ramda");
|
|
28
28
|
var react_redux_1 = require("react-redux");
|
|
29
29
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
30
|
-
var mdm_module_1 =
|
|
30
|
+
var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
|
|
31
31
|
var SimpleDropDownSelector_1 = __importDefault(require("../../../SimpleDropDownSelector/SimpleDropDownSelector"));
|
|
32
32
|
var __1 = require("../../..");
|
|
33
33
|
var styles_1 = require("./styles");
|
|
34
|
+
var SmallIconButton_1 = __importDefault(require("../../../SmallIconButton/SmallIconButton"));
|
|
35
|
+
var Delete_1 = __importDefault(require("@material-ui/icons/Delete"));
|
|
34
36
|
var components = { MultiValue: __1.MultiValueChip };
|
|
35
37
|
var Roles = function (_a) {
|
|
36
|
-
var values = _a.values;
|
|
38
|
+
var values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete;
|
|
37
39
|
var styles = styles_1.useStyles();
|
|
38
|
-
var dispatch = react_redux_1.useDispatch();
|
|
39
40
|
var metadata = react_redux_1.useSelector(mdm_module_1.default.selectors.getMetadata);
|
|
40
41
|
var entity = react_redux_1.useSelector(mdm_module_1.default.selectors.getEntity);
|
|
41
42
|
var entityUri = entity.uri;
|
|
@@ -43,7 +44,7 @@ var Roles = function (_a) {
|
|
|
43
44
|
value: role.uri,
|
|
44
45
|
label: role.label
|
|
45
46
|
}); });
|
|
46
|
-
var formattedValues = values.map(function (value) {
|
|
47
|
+
var formattedValues = (values || []).map(function (value) {
|
|
47
48
|
var _a;
|
|
48
49
|
var label = (_a = options.find(ramda_1.propEq('value', value))) === null || _a === void 0 ? void 0 : _a.label;
|
|
49
50
|
return {
|
|
@@ -51,14 +52,19 @@ var Roles = function (_a) {
|
|
|
51
52
|
label: label || mdm_sdk_1.getLastUriPart(value)
|
|
52
53
|
};
|
|
53
54
|
});
|
|
54
|
-
var handleChange = function (values) {
|
|
55
|
+
var handleChange = react_1.useCallback(function (values) {
|
|
55
56
|
var roles = (values === null || values === void 0 ? void 0 : values.map(ramda_1.prop('value'))) || [];
|
|
56
|
-
|
|
57
|
+
onChange({
|
|
57
58
|
value: roles,
|
|
58
59
|
attributeType: mdm_sdk_1.EntityAttrTypes.roles,
|
|
59
60
|
uri: entityUri
|
|
60
|
-
})
|
|
61
|
-
};
|
|
62
|
-
|
|
61
|
+
});
|
|
62
|
+
}, [entityUri, onChange]);
|
|
63
|
+
var handleDelete = react_1.useCallback(function () {
|
|
64
|
+
onDelete({ uri: entityUri, attributeType: mdm_sdk_1.EntityAttrTypes.roles });
|
|
65
|
+
}, [entityUri, onDelete]);
|
|
66
|
+
return (react_1.default.createElement("div", { className: styles.container },
|
|
67
|
+
react_1.default.createElement(SimpleDropDownSelector_1.default, { label: '', height: 40, isMulti: true, options: options, value: formattedValues, onChange: handleChange, components: components, classes: styles, className: styles.roleContainer }),
|
|
68
|
+
!!onDelete && (react_1.default.createElement(SmallIconButton_1.default, { className: styles.deleteButton, icon: Delete_1.default, onClick: handleDelete, size: "L" }))));
|
|
63
69
|
};
|
|
64
70
|
exports.Roles = Roles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"valueContainer">;
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"container" | "valueContainer" | "roleContainer" | "deleteButton">;
|
|
@@ -3,8 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useStyles = void 0;
|
|
4
4
|
var styles_1 = require("@material-ui/core/styles");
|
|
5
5
|
exports.useStyles = styles_1.makeStyles({
|
|
6
|
+
container: {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flex: 1,
|
|
9
|
+
alignItems: 'flex-start',
|
|
10
|
+
marginBottom: '10px'
|
|
11
|
+
},
|
|
12
|
+
roleContainer: {
|
|
13
|
+
width: '100%'
|
|
14
|
+
},
|
|
6
15
|
valueContainer: {
|
|
7
16
|
marginLeft: '8px',
|
|
8
17
|
width: 0
|
|
18
|
+
},
|
|
19
|
+
deleteButton: {
|
|
20
|
+
marginLeft: '8px'
|
|
9
21
|
}
|
|
10
22
|
});
|
|
@@ -53,15 +53,15 @@ var Add_1 = __importDefault(require("@material-ui/icons/Add"));
|
|
|
53
53
|
var Delete_1 = __importDefault(require("@material-ui/icons/Delete"));
|
|
54
54
|
var Typography_1 = __importDefault(require("@material-ui/core/Typography"));
|
|
55
55
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
56
|
-
var styles_1 = require("./styles");
|
|
57
56
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
58
57
|
var DataTypeValue_1 = __importDefault(require("../../../DataTypeValue/DataTypeValue"));
|
|
59
58
|
var DataTypeValueEditor_1 = __importDefault(require("../../../editors/DataTypeValueEditor/DataTypeValueEditor"));
|
|
60
59
|
var ErrorWrapper_1 = __importDefault(require("../../../ErrorWrapper/ErrorWrapper"));
|
|
61
|
-
var SmallIconButton_1 = __importDefault(require("
|
|
60
|
+
var SmallIconButton_1 = __importDefault(require("../../../SmallIconButton/SmallIconButton"));
|
|
62
61
|
var utils_1 = require("./utils");
|
|
63
62
|
var withAsyncMount_1 = __importDefault(require("../../../../HOCs/withAsyncMount/withAsyncMount"));
|
|
64
63
|
var getDependentLookupEditorContext_1 = require("./selectors/getDependentLookupEditorContext");
|
|
64
|
+
var styles_1 = require("./styles");
|
|
65
65
|
var AsyncMountPlaceholder = function () {
|
|
66
66
|
var styles = styles_1.useStyles();
|
|
67
67
|
return react_1.default.createElement("div", { className: styles.placeholder });
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { AttributeItem } from '../AttributesPager';
|
|
3
|
+
export declare type Props = {
|
|
3
4
|
className?: string;
|
|
4
5
|
values: string[];
|
|
6
|
+
onChange: (param: AttributeItem) => void;
|
|
7
|
+
onDelete?: (param: AttributeItem) => void;
|
|
5
8
|
};
|
|
6
|
-
declare const Tags: ({ className, values }: Props) => JSX.Element;
|
|
9
|
+
declare const Tags: ({ className, values, onChange, onDelete }: Props) => JSX.Element;
|
|
7
10
|
export default Tags;
|
|
@@ -24,9 +24,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
var react_1 = __importStar(require("react"));
|
|
26
26
|
var react_redux_1 = require("react-redux");
|
|
27
|
-
var mdm_module_1 =
|
|
27
|
+
var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
|
|
28
28
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
29
|
+
var Delete_1 = __importDefault(require("@material-ui/icons/Delete"));
|
|
29
30
|
var TypeaheadEditor_1 = __importDefault(require("../../../editors/TypeaheadEditor/TypeaheadEditor"));
|
|
31
|
+
var SmallIconButton_1 = __importDefault(require("../../../SmallIconButton/SmallIconButton"));
|
|
32
|
+
var styles_1 = require("./styles");
|
|
30
33
|
var filtersWithSearch = function (searchQuery) { return [
|
|
31
34
|
{
|
|
32
35
|
filter: 'containsWordStartingWith',
|
|
@@ -47,16 +50,21 @@ var getSuggestions = function (searchQuery) {
|
|
|
47
50
|
return mdm_sdk_1.getFacets({ query: getQuery(searchQuery), body: body }).then(function (response) { return Object.keys(response.tags); });
|
|
48
51
|
};
|
|
49
52
|
var Tags = function (_a) {
|
|
50
|
-
var className = _a.className, values = _a.values;
|
|
51
|
-
var
|
|
53
|
+
var className = _a.className, values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete;
|
|
54
|
+
var styles = styles_1.useStyles();
|
|
52
55
|
var entityUri = react_redux_1.useSelector(mdm_module_1.default.selectors.getEntityUri);
|
|
53
|
-
var
|
|
54
|
-
|
|
56
|
+
var handleChange = react_1.useCallback(function (tags) {
|
|
57
|
+
onChange({
|
|
55
58
|
value: tags,
|
|
56
59
|
attributeType: mdm_sdk_1.EntityAttrTypes.tags,
|
|
57
60
|
uri: entityUri
|
|
58
|
-
})
|
|
59
|
-
}, [
|
|
60
|
-
|
|
61
|
+
});
|
|
62
|
+
}, [onChange, entityUri]);
|
|
63
|
+
var handleDelete = react_1.useCallback(function () {
|
|
64
|
+
onDelete({ uri: entityUri, attributeType: mdm_sdk_1.EntityAttrTypes.tags });
|
|
65
|
+
}, [entityUri, onDelete]);
|
|
66
|
+
return (react_1.default.createElement("div", { className: styles.container },
|
|
67
|
+
react_1.default.createElement(TypeaheadEditor_1.default, { fullWidth: true, multiple: true, variant: "filled", className: className, value: values || [], onChange: handleChange, getSuggestions: getSuggestions }),
|
|
68
|
+
!!onDelete && (react_1.default.createElement(SmallIconButton_1.default, { className: styles.deleteButton, icon: Delete_1.default, onClick: handleDelete, size: "L" }))));
|
|
61
69
|
};
|
|
62
70
|
exports.default = Tags;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"container" | "deleteButton">;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@material-ui/core/styles");
|
|
5
|
+
exports.useStyles = styles_1.makeStyles({
|
|
6
|
+
container: {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flex: 1,
|
|
9
|
+
alignItems: 'flex-start',
|
|
10
|
+
marginBottom: '10px'
|
|
11
|
+
},
|
|
12
|
+
deleteButton: {
|
|
13
|
+
marginLeft: '8px'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -27,7 +27,7 @@ var SPECIAL_ATTRIBUTES_NAMES = [
|
|
|
27
27
|
var prepareStartOrEndDate = function (_a) {
|
|
28
28
|
var newValue = _a.newValue, oldValue = _a.oldValue;
|
|
29
29
|
var parseValue = function (value) { return (isNaN(value) || mdm_sdk_1.isEmptyValue(value) ? value : parseInt(value)); };
|
|
30
|
-
var isExistedValue = function (value) { return (value === null || value === void 0 ? void 0 : value.length) && !mdm_sdk_1.isEmptyValue(value); };
|
|
30
|
+
var isExistedValue = function (value) { return (value === null || value === void 0 ? void 0 : value.length) && !mdm_sdk_1.isEmptyValue(value) && !mdm_sdk_1.isEmptyValue(value[0]); };
|
|
31
31
|
var isExistNewValue = isExistedValue(newValue);
|
|
32
32
|
var isExistOldValue = isExistedValue(oldValue);
|
|
33
33
|
if (isExistNewValue && isExistOldValue) {
|
|
@@ -48,7 +48,11 @@ var useWorkflowAssignee = function (_a) {
|
|
|
48
48
|
}))
|
|
49
49
|
.then(function (result) {
|
|
50
50
|
var data = result.data;
|
|
51
|
-
var assignees = data
|
|
51
|
+
var assignees = data
|
|
52
|
+
.sort(function (a, b) {
|
|
53
|
+
return mdm_sdk_1.utils.strings.sort('asc', a, b);
|
|
54
|
+
})
|
|
55
|
+
.map(assigneeToValue);
|
|
52
56
|
setAssignees(assignees);
|
|
53
57
|
return filterOutRest_1(assignees);
|
|
54
58
|
})
|
|
@@ -4,6 +4,10 @@ declare type Props = {
|
|
|
4
4
|
icon?: string;
|
|
5
5
|
avatarText?: string;
|
|
6
6
|
variant?: 'circle' | 'circular' | 'rounded' | 'square';
|
|
7
|
+
rootClasses?: {
|
|
8
|
+
iconRoot?: string;
|
|
9
|
+
textRoot?: string;
|
|
10
|
+
};
|
|
7
11
|
};
|
|
8
|
-
declare const AvatarWithFallback: ({ className, icon, avatarText, ...otherProps }: Props) => JSX.Element;
|
|
12
|
+
declare const AvatarWithFallback: ({ className, icon, avatarText, rootClasses, ...otherProps }: Props) => JSX.Element;
|
|
9
13
|
export default AvatarWithFallback;
|
|
@@ -21,6 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import Avatar from '@material-ui/core/Avatar';
|
|
24
|
+
import classnames from 'classnames';
|
|
24
25
|
import React, { useEffect, useState } from 'react';
|
|
25
26
|
var AvatarStates;
|
|
26
27
|
(function (AvatarStates) {
|
|
@@ -29,7 +30,7 @@ var AvatarStates;
|
|
|
29
30
|
AvatarStates[AvatarStates["ERROR_MODE"] = 2] = "ERROR_MODE";
|
|
30
31
|
})(AvatarStates || (AvatarStates = {}));
|
|
31
32
|
var AvatarWithFallback = function (_a) {
|
|
32
|
-
var className = _a.className, icon = _a.icon, avatarText = _a.avatarText, otherProps = __rest(_a, ["className", "icon", "avatarText"]);
|
|
33
|
+
var className = _a.className, icon = _a.icon, avatarText = _a.avatarText, rootClasses = _a.rootClasses, otherProps = __rest(_a, ["className", "icon", "avatarText", "rootClasses"]);
|
|
33
34
|
var _b = useState(null), state = _b[0], setState = _b[1];
|
|
34
35
|
useEffect(function () {
|
|
35
36
|
if (icon) {
|
|
@@ -44,10 +45,10 @@ var AvatarWithFallback = function (_a) {
|
|
|
44
45
|
};
|
|
45
46
|
switch (state) {
|
|
46
47
|
case AvatarStates.ICON_MODE:
|
|
47
|
-
return React.createElement(Avatar, __assign({ className: className, src: icon, onError: onImageLoadFail }, otherProps));
|
|
48
|
+
return (React.createElement(Avatar, __assign({ className: classnames(className, rootClasses === null || rootClasses === void 0 ? void 0 : rootClasses.iconRoot), src: icon, onError: onImageLoadFail }, otherProps)));
|
|
48
49
|
case AvatarStates.TEXT_MODE:
|
|
49
50
|
case AvatarStates.ERROR_MODE:
|
|
50
|
-
return (React.createElement(Avatar, __assign({ className: className }, otherProps), avatarText));
|
|
51
|
+
return (React.createElement(Avatar, __assign({ className: classnames(className, rootClasses === null || rootClasses === void 0 ? void 0 : rootClasses.textRoot) }, otherProps), avatarText));
|
|
51
52
|
default:
|
|
52
53
|
return null;
|
|
53
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"divider" | "
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"divider" | "deleteButton" | "downloadButton" | "shareButton">;
|
|
@@ -55,10 +55,22 @@ declare var _default: import("react-redux").ConnectedComponent<{
|
|
|
55
55
|
max: import("prop-types").Requireable<number>;
|
|
56
56
|
icon: import("prop-types").Requireable<string>;
|
|
57
57
|
caption: import("prop-types").Requireable<string>;
|
|
58
|
-
canCreate: import("prop-types").Requireable<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
canCreate: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
59
|
+
deviceTypes: import("prop-types").Requireable<string | string[]>;
|
|
60
|
+
roles: import("prop-types").Requireable<string[]>;
|
|
61
|
+
}>>;
|
|
62
|
+
canRead: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
63
|
+
deviceTypes: import("prop-types").Requireable<string | string[]>;
|
|
64
|
+
roles: import("prop-types").Requireable<string[]>;
|
|
65
|
+
}>>;
|
|
66
|
+
canUpdate: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
67
|
+
deviceTypes: import("prop-types").Requireable<string | string[]>;
|
|
68
|
+
roles: import("prop-types").Requireable<string[]>;
|
|
69
|
+
}>>;
|
|
70
|
+
canDelete: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
71
|
+
deviceTypes: import("prop-types").Requireable<string | string[]>;
|
|
72
|
+
roles: import("prop-types").Requireable<string[]>;
|
|
73
|
+
}>>;
|
|
62
74
|
editingEnabled: import("prop-types").Requireable<boolean>;
|
|
63
75
|
}>>;
|
|
64
76
|
mode: import("prop-types").Requireable<string>;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
declare type Props = {
|
|
3
3
|
sourceType: string;
|
|
4
4
|
className?: string;
|
|
5
|
+
classes?: {
|
|
6
|
+
iconRoot?: string;
|
|
7
|
+
textRoot?: string;
|
|
8
|
+
};
|
|
5
9
|
};
|
|
6
|
-
declare const SourceIcon: ({ sourceType, className }: Props) => JSX.Element;
|
|
10
|
+
declare const SourceIcon: ({ sourceType, className, classes }: Props) => JSX.Element;
|
|
7
11
|
export default SourceIcon;
|
|
@@ -5,9 +5,9 @@ import { useSelector } from 'react-redux';
|
|
|
5
5
|
import AvatarWithFallback from '../AvatarWithFallback/AvatarWithFallback';
|
|
6
6
|
var SOURCE_URL = 'https://s3.amazonaws.com/reltio.images/api';
|
|
7
7
|
var SourceIcon = function (_a) {
|
|
8
|
-
var sourceType = _a.sourceType, className = _a.className;
|
|
8
|
+
var sourceType = _a.sourceType, className = _a.className, classes = _a.classes;
|
|
9
9
|
var metadata = useSelector(mdmModule.selectors.getMetadata);
|
|
10
10
|
var _b = findSourceSystemByUri(metadata, sourceType), label = _b.label, icon = _b.icon;
|
|
11
|
-
return (React.createElement(AvatarWithFallback, { className: className, avatarText: label[0], icon: icon ? getAbsoluteImageUrl(SOURCE_URL, icon) : null, variant: "square" }));
|
|
11
|
+
return (React.createElement(AvatarWithFallback, { className: className, avatarText: label[0], icon: icon ? getAbsoluteImageUrl(SOURCE_URL, icon) : null, variant: "square", rootClasses: classes }));
|
|
12
12
|
};
|
|
13
13
|
export default SourceIcon;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { always, both, cond, has, T } from 'ramda';
|
|
2
|
-
import { isAnalyticAttribute, isSpecialAttribute } from '@reltio/mdm-sdk';
|
|
2
|
+
import { isAnalyticAttribute, isRoleAttrType, isSpecialAttribute, isTagAttrType } from '@reltio/mdm-sdk';
|
|
3
3
|
var getSource = function (attrType, entity) {
|
|
4
4
|
var _a = entity.attributes, attributes = _a === void 0 ? {} : _a, _b = entity.analyticsAttributes, analyticsAttributes = _b === void 0 ? {} : _b;
|
|
5
5
|
return cond([
|
|
@@ -15,6 +15,6 @@ export var getMoreAttrTypes = function (attrTypes, entity) {
|
|
|
15
15
|
return attrTypes.filter(function (attrType) {
|
|
16
16
|
var source = getSource(attrType, entity);
|
|
17
17
|
var nameProp = getNameProp(attrType);
|
|
18
|
-
return !(attrType.singleValue && has(attrType[nameProp])(source));
|
|
18
|
+
return !((attrType.singleValue || isRoleAttrType(attrType) || isTagAttrType(attrType)) && has(attrType[nameProp])(source));
|
|
19
19
|
});
|
|
20
20
|
};
|
|
@@ -8,7 +8,8 @@ declare type Props = {
|
|
|
8
8
|
mode: Mode;
|
|
9
9
|
errorMessage?: string;
|
|
10
10
|
onDeleteAttribute: (param: AttributeItem) => void;
|
|
11
|
+
onChangeAttribute: (param: AttributeItem) => void;
|
|
11
12
|
showEmptyEditors?: boolean;
|
|
12
13
|
};
|
|
13
|
-
declare const SpecialRenderer: ({ values, attributeType, parentUri, mode, errorMessage, onDeleteAttribute, showEmptyEditors, ...otherProps }: Props) => JSX.Element;
|
|
14
|
+
declare const SpecialRenderer: ({ values, attributeType, parentUri, mode, errorMessage, onDeleteAttribute, onChangeAttribute, showEmptyEditors, ...otherProps }: Props) => JSX.Element;
|
|
14
15
|
export default SpecialRenderer;
|
|
@@ -32,11 +32,12 @@ import { Roles } from '../Roles/Roles';
|
|
|
32
32
|
import Tags from '../Tags';
|
|
33
33
|
import { useStyles } from './styles';
|
|
34
34
|
var SpecialRenderer = function (_a) {
|
|
35
|
-
var values = _a.values, attributeType = _a.attributeType, parentUri = _a.parentUri, mode = _a.mode, errorMessage = _a.errorMessage, onDeleteAttribute = _a.onDeleteAttribute, showEmptyEditors = _a.showEmptyEditors, otherProps = __rest(_a, ["values", "attributeType", "parentUri", "mode", "errorMessage", "onDeleteAttribute", "showEmptyEditors"]);
|
|
35
|
+
var values = _a.values, attributeType = _a.attributeType, parentUri = _a.parentUri, mode = _a.mode, errorMessage = _a.errorMessage, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, showEmptyEditors = _a.showEmptyEditors, otherProps = __rest(_a, ["values", "attributeType", "parentUri", "mode", "errorMessage", "onDeleteAttribute", "onChangeAttribute", "showEmptyEditors"]);
|
|
36
36
|
var styles = useStyles();
|
|
37
37
|
var label = attributeType.label, isRequired = attributeType.required, cardinality = attributeType.cardinality;
|
|
38
38
|
var isEditableMode = checkIsEditableMode(mode);
|
|
39
39
|
var _b = useState(false), hadDeletions = _b[0], setHadDeletions = _b[1];
|
|
40
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
41
|
var onDelete = useCallback(pipe(onDeleteAttribute, T, setHadDeletions), [onDeleteAttribute, setHadDeletions]);
|
|
41
42
|
var isEmptyValues = isEmptyValue(values);
|
|
42
43
|
var showEmpty = !hadDeletions && showEmptyEditors && isEmptyValues;
|
|
@@ -47,14 +48,13 @@ var SpecialRenderer = function (_a) {
|
|
|
47
48
|
var renderValue = function () {
|
|
48
49
|
switch (attributeType.uri) {
|
|
49
50
|
case EntityAttrTypes.tags.uri:
|
|
50
|
-
return React.createElement(Tags, { values: values });
|
|
51
|
-
case EntityAttrTypes.roles.uri:
|
|
52
|
-
return React.createElement(Roles, { values: values });
|
|
53
|
-
}
|
|
51
|
+
return React.createElement(Tags, { values: values, onDelete: onDelete, onChange: onChangeAttribute });
|
|
52
|
+
case EntityAttrTypes.roles.uri:
|
|
53
|
+
return React.createElement(Roles, { values: values, onDelete: onDelete, onChange: onChangeAttribute });
|
|
54
54
|
default: {
|
|
55
55
|
//startDate, endDate
|
|
56
56
|
var value = __assign(__assign({}, emptyEditorValue.current), { value: values[0] || '' });
|
|
57
|
-
return (React.createElement(Attribute, __assign({ attributeValue: value, attributeType: attributeType, mode: mode, onDeleteAttribute: onDelete }, otherProps)));
|
|
57
|
+
return (React.createElement(Attribute, __assign({ attributeValue: value, attributeType: attributeType, mode: mode, onDeleteAttribute: onDelete, onChangeAttribute: onChangeAttribute }, otherProps)));
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
};
|
|
@@ -9,7 +9,7 @@ var EntityCreator = function (_a) {
|
|
|
9
9
|
attributeTypesSelectionStrategy,
|
|
10
10
|
entityType
|
|
11
11
|
]);
|
|
12
|
-
return entity ? (React.createElement(AttributesList, { attrTypes: attributeTypes, entity: entity, showEmptyEditors: true, drawLines: true, parentUri: entity.uri, mode: mode, crosswalks: entity.crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute })) : null;
|
|
12
|
+
return entity ? (React.createElement(AttributesList, { key: entity.uri, attrTypes: attributeTypes, entity: entity, showEmptyEditors: true, drawLines: true, parentUri: entity.uri, mode: mode, crosswalks: entity.crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute })) : null;
|
|
13
13
|
};
|
|
14
14
|
EntityCreator.propTypes = {
|
|
15
15
|
entityUri: PropTypes.string,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { AttributeItem } from '../../..';
|
|
2
3
|
declare type Props = {
|
|
3
4
|
values: string[];
|
|
5
|
+
onChange: (param: AttributeItem) => void;
|
|
6
|
+
onDelete?: (param: AttributeItem) => void;
|
|
4
7
|
};
|
|
5
|
-
export declare const Roles: ({ values }: Props) => JSX.Element;
|
|
8
|
+
export declare const Roles: ({ values, onChange, onDelete }: Props) => JSX.Element;
|
|
6
9
|
export {};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { prop, propEq } from 'ramda';
|
|
3
|
-
import { useSelector
|
|
3
|
+
import { useSelector } from 'react-redux';
|
|
4
4
|
import { EntityAttrTypes, getRolesForEntityType, getLastUriPart } from '@reltio/mdm-sdk';
|
|
5
|
-
import mdmModule
|
|
5
|
+
import mdmModule from '@reltio/mdm-module';
|
|
6
6
|
import SimpleDropDownSelector from '../../../SimpleDropDownSelector/SimpleDropDownSelector';
|
|
7
7
|
import { MultiValueChip } from '../../..';
|
|
8
8
|
import { useStyles } from './styles';
|
|
9
|
+
import SmallIconButton from '../../../SmallIconButton/SmallIconButton';
|
|
10
|
+
import DeleteIcon from '@material-ui/icons/Delete';
|
|
9
11
|
var components = { MultiValue: MultiValueChip };
|
|
10
12
|
export var Roles = function (_a) {
|
|
11
|
-
var values = _a.values;
|
|
13
|
+
var values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete;
|
|
12
14
|
var styles = useStyles();
|
|
13
|
-
var dispatch = useDispatch();
|
|
14
15
|
var metadata = useSelector(mdmModule.selectors.getMetadata);
|
|
15
16
|
var entity = useSelector(mdmModule.selectors.getEntity);
|
|
16
17
|
var entityUri = entity.uri;
|
|
@@ -18,7 +19,7 @@ export var Roles = function (_a) {
|
|
|
18
19
|
value: role.uri,
|
|
19
20
|
label: role.label
|
|
20
21
|
}); });
|
|
21
|
-
var formattedValues = values.map(function (value) {
|
|
22
|
+
var formattedValues = (values || []).map(function (value) {
|
|
22
23
|
var _a;
|
|
23
24
|
var label = (_a = options.find(propEq('value', value))) === null || _a === void 0 ? void 0 : _a.label;
|
|
24
25
|
return {
|
|
@@ -26,13 +27,18 @@ export var Roles = function (_a) {
|
|
|
26
27
|
label: label || getLastUriPart(value)
|
|
27
28
|
};
|
|
28
29
|
});
|
|
29
|
-
var handleChange = function (values) {
|
|
30
|
+
var handleChange = useCallback(function (values) {
|
|
30
31
|
var roles = (values === null || values === void 0 ? void 0 : values.map(prop('value'))) || [];
|
|
31
|
-
|
|
32
|
+
onChange({
|
|
32
33
|
value: roles,
|
|
33
34
|
attributeType: EntityAttrTypes.roles,
|
|
34
35
|
uri: entityUri
|
|
35
|
-
})
|
|
36
|
-
};
|
|
37
|
-
|
|
36
|
+
});
|
|
37
|
+
}, [entityUri, onChange]);
|
|
38
|
+
var handleDelete = useCallback(function () {
|
|
39
|
+
onDelete({ uri: entityUri, attributeType: EntityAttrTypes.roles });
|
|
40
|
+
}, [entityUri, onDelete]);
|
|
41
|
+
return (React.createElement("div", { className: styles.container },
|
|
42
|
+
React.createElement(SimpleDropDownSelector, { label: '', height: 40, isMulti: true, options: options, value: formattedValues, onChange: handleChange, components: components, classes: styles, className: styles.roleContainer }),
|
|
43
|
+
!!onDelete && (React.createElement(SmallIconButton, { className: styles.deleteButton, icon: DeleteIcon, onClick: handleDelete, size: "L" }))));
|
|
38
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"valueContainer">;
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"container" | "valueContainer" | "roleContainer" | "deleteButton">;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { makeStyles } from '@material-ui/core/styles';
|
|
2
2
|
export var useStyles = makeStyles({
|
|
3
|
+
container: {
|
|
4
|
+
display: 'flex',
|
|
5
|
+
flex: 1,
|
|
6
|
+
alignItems: 'flex-start',
|
|
7
|
+
marginBottom: '10px'
|
|
8
|
+
},
|
|
9
|
+
roleContainer: {
|
|
10
|
+
width: '100%'
|
|
11
|
+
},
|
|
3
12
|
valueContainer: {
|
|
4
13
|
marginLeft: '8px',
|
|
5
14
|
width: 0
|
|
15
|
+
},
|
|
16
|
+
deleteButton: {
|
|
17
|
+
marginLeft: '8px'
|
|
6
18
|
}
|
|
7
19
|
});
|
|
@@ -29,15 +29,15 @@ import AddIcon from '@material-ui/icons/Add';
|
|
|
29
29
|
import DeleteIcon from '@material-ui/icons/Delete';
|
|
30
30
|
import Typography from '@material-ui/core/Typography';
|
|
31
31
|
import i18n from 'ui-i18n';
|
|
32
|
-
import { useStyles } from './styles';
|
|
33
32
|
import { AttributeErrorType, AttributeTypeType, attributeUriToSearchUri, checkCanCreateAttribute, checkCanDeleteAttribute, checkCanEditAttribute, ErrorType, getAttributeValue, getAttrDataTypeDefinition, getErrorId, getErrorMessage, getErrorType, isDependentLookupAttrType, isEditableMode as checkIsEditableMode, ModeType, SimpleAttributeValueType } from '@reltio/mdm-sdk';
|
|
34
33
|
import DataTypeValue from '../../../DataTypeValue/DataTypeValue';
|
|
35
34
|
import DataTypeValueEditor from '../../../editors/DataTypeValueEditor/DataTypeValueEditor';
|
|
36
35
|
import ErrorWrapper from '../../../ErrorWrapper/ErrorWrapper';
|
|
37
|
-
import SmallIconButton from '
|
|
36
|
+
import SmallIconButton from '../../../SmallIconButton/SmallIconButton';
|
|
38
37
|
import { attributeValueToEditorValue, prepareChangeData } from './utils';
|
|
39
38
|
import withAsyncMount from '../../../../HOCs/withAsyncMount/withAsyncMount';
|
|
40
39
|
import { getDependentLookupEditorContext } from './selectors/getDependentLookupEditorContext';
|
|
40
|
+
import { useStyles } from './styles';
|
|
41
41
|
var AsyncMountPlaceholder = function () {
|
|
42
42
|
var styles = useStyles();
|
|
43
43
|
return React.createElement("div", { className: styles.placeholder });
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { AttributeItem } from '../AttributesPager';
|
|
3
|
+
export declare type Props = {
|
|
3
4
|
className?: string;
|
|
4
5
|
values: string[];
|
|
6
|
+
onChange: (param: AttributeItem) => void;
|
|
7
|
+
onDelete?: (param: AttributeItem) => void;
|
|
5
8
|
};
|
|
6
|
-
declare const Tags: ({ className, values }: Props) => JSX.Element;
|
|
9
|
+
declare const Tags: ({ className, values, onChange, onDelete }: Props) => JSX.Element;
|
|
7
10
|
export default Tags;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import mdmModule
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
|
+
import mdmModule from '@reltio/mdm-module';
|
|
4
4
|
import { getFacets, EntityAttrTypes, buildFilterQueryString } from '@reltio/mdm-sdk';
|
|
5
|
+
import DeleteIcon from '@material-ui/icons/Delete';
|
|
5
6
|
import TypeaheadEditor from '../../../editors/TypeaheadEditor/TypeaheadEditor';
|
|
7
|
+
import SmallIconButton from '../../../SmallIconButton/SmallIconButton';
|
|
8
|
+
import { useStyles } from './styles';
|
|
6
9
|
var filtersWithSearch = function (searchQuery) { return [
|
|
7
10
|
{
|
|
8
11
|
filter: 'containsWordStartingWith',
|
|
@@ -23,16 +26,21 @@ var getSuggestions = function (searchQuery) {
|
|
|
23
26
|
return getFacets({ query: getQuery(searchQuery), body: body }).then(function (response) { return Object.keys(response.tags); });
|
|
24
27
|
};
|
|
25
28
|
var Tags = function (_a) {
|
|
26
|
-
var className = _a.className, values = _a.values;
|
|
27
|
-
var
|
|
29
|
+
var className = _a.className, values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete;
|
|
30
|
+
var styles = useStyles();
|
|
28
31
|
var entityUri = useSelector(mdmModule.selectors.getEntityUri);
|
|
29
|
-
var
|
|
30
|
-
|
|
32
|
+
var handleChange = useCallback(function (tags) {
|
|
33
|
+
onChange({
|
|
31
34
|
value: tags,
|
|
32
35
|
attributeType: EntityAttrTypes.tags,
|
|
33
36
|
uri: entityUri
|
|
34
|
-
})
|
|
35
|
-
}, [
|
|
36
|
-
|
|
37
|
+
});
|
|
38
|
+
}, [onChange, entityUri]);
|
|
39
|
+
var handleDelete = useCallback(function () {
|
|
40
|
+
onDelete({ uri: entityUri, attributeType: EntityAttrTypes.tags });
|
|
41
|
+
}, [entityUri, onDelete]);
|
|
42
|
+
return (React.createElement("div", { className: styles.container },
|
|
43
|
+
React.createElement(TypeaheadEditor, { fullWidth: true, multiple: true, variant: "filled", className: className, value: values || [], onChange: handleChange, getSuggestions: getSuggestions }),
|
|
44
|
+
!!onDelete && (React.createElement(SmallIconButton, { className: styles.deleteButton, icon: DeleteIcon, onClick: handleDelete, size: "L" }))));
|
|
37
45
|
};
|
|
38
46
|
export default Tags;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"container" | "deleteButton">;
|
|
@@ -24,7 +24,7 @@ var SPECIAL_ATTRIBUTES_NAMES = [
|
|
|
24
24
|
var prepareStartOrEndDate = function (_a) {
|
|
25
25
|
var newValue = _a.newValue, oldValue = _a.oldValue;
|
|
26
26
|
var parseValue = function (value) { return (isNaN(value) || isEmptyValue(value) ? value : parseInt(value)); };
|
|
27
|
-
var isExistedValue = function (value) { return (value === null || value === void 0 ? void 0 : value.length) && !isEmptyValue(value); };
|
|
27
|
+
var isExistedValue = function (value) { return (value === null || value === void 0 ? void 0 : value.length) && !isEmptyValue(value) && !isEmptyValue(value[0]); };
|
|
28
28
|
var isExistNewValue = isExistedValue(newValue);
|
|
29
29
|
var isExistOldValue = isExistedValue(oldValue);
|
|
30
30
|
if (isExistNewValue && isExistOldValue) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback, useContext } from 'react';
|
|
2
2
|
import { filter } from 'ramda';
|
|
3
3
|
import { useSelector } from 'react-redux';
|
|
4
|
-
import { getAssigneeForTask, updateAssigneeForTask } from '@reltio/mdm-sdk';
|
|
4
|
+
import { getAssigneeForTask, updateAssigneeForTask, utils } from '@reltio/mdm-sdk';
|
|
5
5
|
import mdmModule from '@reltio/mdm-module';
|
|
6
6
|
import { useSafePromise } from '../../../hooks';
|
|
7
7
|
import { WorkflowTasksContext } from '../../../contexts/WorkflowTasksContext';
|
|
@@ -42,7 +42,11 @@ export var useWorkflowAssignee = function (_a) {
|
|
|
42
42
|
}))
|
|
43
43
|
.then(function (result) {
|
|
44
44
|
var data = result.data;
|
|
45
|
-
var assignees = data
|
|
45
|
+
var assignees = data
|
|
46
|
+
.sort(function (a, b) {
|
|
47
|
+
return utils.strings.sort('asc', a, b);
|
|
48
|
+
})
|
|
49
|
+
.map(assigneeToValue);
|
|
46
50
|
setAssignees(assignees);
|
|
47
51
|
return filterOutRest_1(assignees);
|
|
48
52
|
})
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.953",
|
|
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.953",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.953",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|