@reltio/components 1.4.2058 → 1.4.2059
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/EditModeAttributesPager/components/SpecialRenderer/SpecialRenderer.d.ts +2 -0
- package/EditModeAttributesPager/components/SpecialRenderer/SpecialRenderer.js +7 -7
- package/RolesEditor/RolesEditor.d.ts +2 -1
- package/RolesEditor/RolesEditor.js +9 -3
- package/RolesEditor/RolesEditor.module.css.js +9 -0
- package/TagsEditor/TagsEditor.d.ts +2 -1
- package/TagsEditor/TagsEditor.js +9 -3
- package/TagsEditor/TagsEditor.module.css.js +9 -0
- package/cjs/EditModeAttributesPager/components/SpecialRenderer/SpecialRenderer.d.ts +2 -0
- package/cjs/EditModeAttributesPager/components/SpecialRenderer/SpecialRenderer.js +7 -7
- package/cjs/RolesEditor/RolesEditor.d.ts +2 -1
- package/cjs/RolesEditor/RolesEditor.js +12 -6
- package/cjs/RolesEditor/RolesEditor.module.css.js +9 -0
- package/cjs/TagsEditor/TagsEditor.d.ts +2 -1
- package/cjs/TagsEditor/TagsEditor.js +11 -5
- package/cjs/TagsEditor/TagsEditor.module.css.js +9 -0
- package/package.json +1 -1
- package/RolesEditor/styles.d.ts +0 -1
- package/RolesEditor/styles.js +0 -19
- package/TagsEditor/styles.d.ts +0 -1
- package/TagsEditor/styles.js +0 -12
- package/cjs/RolesEditor/styles.d.ts +0 -1
- package/cjs/RolesEditor/styles.js +0 -22
- package/cjs/TagsEditor/styles.d.ts +0 -1
- package/cjs/TagsEditor/styles.js +0 -15
|
@@ -13,6 +13,8 @@ type Props = {
|
|
|
13
13
|
hasDeletions?: boolean;
|
|
14
14
|
setHasDeletions?: (attrTypeUri: string, value: boolean) => void;
|
|
15
15
|
highlightedAttribute?: React.ContextType<typeof ScrollToElementContext>;
|
|
16
|
+
state?: string;
|
|
17
|
+
showTitle?: boolean;
|
|
16
18
|
};
|
|
17
19
|
declare const _default: React.ComponentType<Props>;
|
|
18
20
|
export default _default;
|
|
@@ -36,11 +36,11 @@ import { withContext } from '../../../HOCs/withContext';
|
|
|
36
36
|
import { useScrollToAttribute } from '../../../hooks/useScrollToAttribute';
|
|
37
37
|
import { useStyles } from '../../styles';
|
|
38
38
|
var SpecialRenderer = function (_a) {
|
|
39
|
-
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, hasDeletionsProp = _a.hasDeletions, setHasDeletions = _a.setHasDeletions, highlightedAttribute = _a.highlightedAttribute, otherProps = __rest(_a, ["values", "attributeType", "parentUri", "mode", "errorMessage", "onDeleteAttribute", "onChangeAttribute", "showEmptyEditors", "hasDeletions", "setHasDeletions", "highlightedAttribute"]);
|
|
39
|
+
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, hasDeletionsProp = _a.hasDeletions, setHasDeletions = _a.setHasDeletions, highlightedAttribute = _a.highlightedAttribute, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b, otherProps = __rest(_a, ["values", "attributeType", "parentUri", "mode", "errorMessage", "onDeleteAttribute", "onChangeAttribute", "showEmptyEditors", "hasDeletions", "setHasDeletions", "highlightedAttribute", "showTitle"]);
|
|
40
40
|
var styles = useStyles();
|
|
41
41
|
var label = attributeType.label, isRequired = attributeType.required, cardinality = attributeType.cardinality;
|
|
42
42
|
var isEditableMode = checkIsEditableMode(mode);
|
|
43
|
-
var
|
|
43
|
+
var _c = useState(false), hasDeletionsState = _c[0], setHasDeletionsState = _c[1];
|
|
44
44
|
var updateHasDeletions = useCallback(function (value) {
|
|
45
45
|
setHasDeletionsState(value);
|
|
46
46
|
setHasDeletions === null || setHasDeletions === void 0 ? void 0 : setHasDeletions(attributeType.uri, value);
|
|
@@ -57,17 +57,17 @@ var SpecialRenderer = function (_a) {
|
|
|
57
57
|
parentUri: parentUri,
|
|
58
58
|
attributeType: attributeType
|
|
59
59
|
}));
|
|
60
|
-
var
|
|
60
|
+
var _d = useScrollToAttribute(highlightedAttribute), ref = _d.ref, highlightedClassName = _d.highlightedClassName;
|
|
61
61
|
var renderValue = function () {
|
|
62
62
|
switch (attributeType.uri) {
|
|
63
63
|
case EntityAttrTypes.tags.uri:
|
|
64
|
-
return React.createElement(TagsEditor, { values: values, onDelete: onDelete, onChange: onChangeAttribute });
|
|
64
|
+
return (React.createElement(TagsEditor, __assign({}, otherProps, { values: values, onDelete: onDelete, onChange: onChangeAttribute })));
|
|
65
65
|
case EntityAttrTypes.roles.uri:
|
|
66
|
-
return React.createElement(RolesEditor, { values: values, onDelete: onDelete, onChange: onChangeAttribute });
|
|
66
|
+
return (React.createElement(RolesEditor, __assign({}, otherProps, { values: values, onDelete: onDelete, onChange: onChangeAttribute })));
|
|
67
67
|
default: {
|
|
68
68
|
//startDate, endDate
|
|
69
69
|
var value = __assign(__assign({}, emptyEditorValue.current), { value: values[0] || '' });
|
|
70
|
-
return (React.createElement(EditModeAttribute, __assign({ attributeValue: value, attributeType: attributeType, mode: mode, onDeleteAttribute: onDelete, onChangeAttribute: onChangeAttribute }
|
|
70
|
+
return (React.createElement(EditModeAttribute, __assign({}, otherProps, { attributeValue: value, attributeType: attributeType, mode: mode, onDeleteAttribute: onDelete, onChangeAttribute: onChangeAttribute })));
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
};
|
|
@@ -75,7 +75,7 @@ var SpecialRenderer = function (_a) {
|
|
|
75
75
|
return null;
|
|
76
76
|
}
|
|
77
77
|
return (React.createElement("div", { ref: ref, className: classnames(highlightedClassName, styles.wrapper) },
|
|
78
|
-
React.createElement(AttributeTitle, { label: label, isRequired: isRequired, className: classnames(styles.title, styles.titleWrapper), "data-reltio-id": "reltio-attribute-label" }),
|
|
78
|
+
showTitle && (React.createElement(AttributeTitle, { label: label, isRequired: isRequired, className: classnames(styles.title, styles.titleWrapper), "data-reltio-id": "reltio-attribute-label" })),
|
|
79
79
|
isEditableMode && React.createElement(CardinalityMessage, { cardinality: cardinality }),
|
|
80
80
|
isEditableMode && React.createElement(ErrorMessage, { message: errorMessage }),
|
|
81
81
|
React.createElement(Box, { className: styles.attributesWrapper }, renderValue())));
|
|
@@ -4,6 +4,7 @@ type Props = {
|
|
|
4
4
|
values: string[];
|
|
5
5
|
onChange: (param: AttributeItem) => void;
|
|
6
6
|
onDelete?: (param: AttributeItem) => void;
|
|
7
|
+
state?: string;
|
|
7
8
|
};
|
|
8
|
-
export declare const RolesEditor: ({ values, onChange, onDelete }: Props) => React.JSX.Element;
|
|
9
|
+
export declare const RolesEditor: ({ values, onChange, onDelete, state }: Props) => React.JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { prop, propEq } from 'ramda';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import i18n from 'ui-i18n';
|
|
3
5
|
import { EntityAttrTypes, getRolesForEntityType, getLastUriPart } from '@reltio/mdm-sdk';
|
|
4
6
|
import { SimpleDropDownSelector } from '../SimpleDropDownSelector';
|
|
5
7
|
import { MultiValueChip } from '../MultiValueChip';
|
|
6
8
|
import { SmallIconButton } from '../SmallIconButton';
|
|
7
9
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
8
10
|
import { useMdmEntity, useMdmMetadata } from '../contexts/MdmModuleContext';
|
|
9
|
-
import
|
|
11
|
+
import styles from './RolesEditor.module.css';
|
|
10
12
|
var components = { MultiValue: MultiValueChip };
|
|
11
13
|
export var RolesEditor = function (_a) {
|
|
12
|
-
var values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete;
|
|
13
|
-
var styles = useStyles();
|
|
14
|
+
var values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete, state = _a.state;
|
|
14
15
|
var metadata = useMdmMetadata();
|
|
15
16
|
var entity = useMdmEntity();
|
|
16
17
|
var entityUri = entity.uri;
|
|
18
|
+
var edited = state === 'edited';
|
|
17
19
|
var options = getRolesForEntityType(metadata, entity.type).map(function (role) { return ({
|
|
18
20
|
value: role.uri,
|
|
19
21
|
label: role.label
|
|
@@ -39,5 +41,9 @@ export var RolesEditor = function (_a) {
|
|
|
39
41
|
}, [entityUri, onDelete]);
|
|
40
42
|
return (React.createElement("div", { className: styles.container, "data-reltio-id": "reltio-attribute-value" },
|
|
41
43
|
React.createElement(SimpleDropDownSelector, { label: '', height: 40, isMulti: true, options: options, value: formattedValues, onChange: handleChange, components: components, classes: styles, className: styles.roleContainer }),
|
|
44
|
+
edited && (React.createElement(Typography, { variant: "caption", className: styles.editedLabel },
|
|
45
|
+
"(",
|
|
46
|
+
i18n.text('edited'),
|
|
47
|
+
")")),
|
|
42
48
|
!!onDelete && (React.createElement(SmallIconButton, { "data-reltio-id": "reltio-roles-delete-button", className: styles.deleteButton, icon: DeleteIcon, onClick: handleDelete, size: "L" }))));
|
|
43
49
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const styles = {"container":"RolesEditor-container--D0IS8","roleContainer":"RolesEditor-roleContainer--G5mqZ","valueContainer":"RolesEditor-valueContainer--YELLe","deleteButton":"RolesEditor-deleteButton--IKQBV","editedLabel":"RolesEditor-editedLabel--VYoNO"};
|
|
2
|
+
if (typeof document !== 'undefined') {
|
|
3
|
+
const head = document.head || document.getElementsByTagName('head')[0]
|
|
4
|
+
const style = document.createElement('style');
|
|
5
|
+
style.type = 'text/css'
|
|
6
|
+
style.innerHTML = `.RolesEditor-container--D0IS8{align-items:center;display:flex;flex:1;margin-bottom:10px}.RolesEditor-roleContainer--G5mqZ{width:100%}.RolesEditor-valueContainer--YELLe{margin-left:8px;width:0}.RolesEditor-deleteButton--IKQBV{margin-left:8px}.RolesEditor-editedLabel--VYoNO{color:var(--mui-palette-text-secondary);font-style:italic;padding-left:8px}`;
|
|
7
|
+
head.appendChild(style);
|
|
8
|
+
}
|
|
9
|
+
export default styles;
|
|
@@ -5,5 +5,6 @@ export type Props = {
|
|
|
5
5
|
values: string[];
|
|
6
6
|
onChange: (param: AttributeItem) => void;
|
|
7
7
|
onDelete?: (param: AttributeItem) => void;
|
|
8
|
+
state?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare const TagsEditor: ({ className, values, onChange, onDelete }: Props) => React.JSX.Element;
|
|
10
|
+
export declare const TagsEditor: ({ className, values, onChange, onDelete, state }: Props) => React.JSX.Element;
|
package/TagsEditor/TagsEditor.js
CHANGED
|
@@ -48,15 +48,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
import React, { useCallback } from 'react';
|
|
49
49
|
import { EntityAttrTypes, getFacetedAttributeData } from '@reltio/mdm-sdk';
|
|
50
50
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
51
|
+
import Typography from '@mui/material/Typography';
|
|
52
|
+
import i18n from 'ui-i18n';
|
|
51
53
|
import { TypeaheadEditor } from '../TypeaheadEditor';
|
|
52
54
|
import { SmallIconButton } from '../SmallIconButton';
|
|
53
55
|
import { useMdmEntityUri, useMdmGlobalSearchRequestOptions } from '../contexts/MdmModuleContext';
|
|
54
|
-
import
|
|
56
|
+
import styles from './TagsEditor.module.css';
|
|
55
57
|
export var TagsEditor = function (_a) {
|
|
56
|
-
var className = _a.className, values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete;
|
|
57
|
-
var styles = useStyles();
|
|
58
|
+
var className = _a.className, values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete, state = _a.state;
|
|
58
59
|
var entityUri = useMdmEntityUri();
|
|
59
60
|
var globalSearchRequestOptions = useMdmGlobalSearchRequestOptions();
|
|
61
|
+
var edited = state === 'edited';
|
|
60
62
|
var getSuggestions = useCallback(function (searchValue, max, pageNo) { return __awaiter(void 0, void 0, void 0, function () {
|
|
61
63
|
var response;
|
|
62
64
|
return __generator(this, function (_a) {
|
|
@@ -84,5 +86,9 @@ export var TagsEditor = function (_a) {
|
|
|
84
86
|
}, [entityUri, onDelete]);
|
|
85
87
|
return (React.createElement("div", { className: styles.container, "data-reltio-id": "reltio-attribute-value" },
|
|
86
88
|
React.createElement(TypeaheadEditor, { fullWidth: true, multiple: true, variant: "filled", className: className, value: values || [], onChange: handleChange, getSuggestions: getSuggestions }),
|
|
89
|
+
edited && (React.createElement(Typography, { variant: "caption", className: styles.editedLabel },
|
|
90
|
+
"(",
|
|
91
|
+
i18n.text('edited'),
|
|
92
|
+
")")),
|
|
87
93
|
!!onDelete && (React.createElement(SmallIconButton, { "data-reltio-id": "reltio-tags-delete-button", className: styles.deleteButton, icon: DeleteIcon, onClick: handleDelete, size: "L" }))));
|
|
88
94
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const styles = {"container":"TagsEditor-container--shWZG","deleteButton":"TagsEditor-deleteButton--3wvtV","editedLabel":"TagsEditor-editedLabel--AVFub"};
|
|
2
|
+
if (typeof document !== 'undefined') {
|
|
3
|
+
const head = document.head || document.getElementsByTagName('head')[0]
|
|
4
|
+
const style = document.createElement('style');
|
|
5
|
+
style.type = 'text/css'
|
|
6
|
+
style.innerHTML = `.TagsEditor-container--shWZG{align-items:center;display:flex;flex:1;margin-bottom:10px}.TagsEditor-deleteButton--3wvtV{margin-left:8px}.TagsEditor-editedLabel--AVFub{color:var(--mui-palette-text-secondary);font-style:italic;padding-left:8px}`;
|
|
7
|
+
head.appendChild(style);
|
|
8
|
+
}
|
|
9
|
+
export default styles;
|
|
@@ -13,6 +13,8 @@ type Props = {
|
|
|
13
13
|
hasDeletions?: boolean;
|
|
14
14
|
setHasDeletions?: (attrTypeUri: string, value: boolean) => void;
|
|
15
15
|
highlightedAttribute?: React.ContextType<typeof ScrollToElementContext>;
|
|
16
|
+
state?: string;
|
|
17
|
+
showTitle?: boolean;
|
|
16
18
|
};
|
|
17
19
|
declare const _default: React.ComponentType<Props>;
|
|
18
20
|
export default _default;
|
|
@@ -64,11 +64,11 @@ var withContext_1 = require("../../../HOCs/withContext");
|
|
|
64
64
|
var useScrollToAttribute_1 = require("../../../hooks/useScrollToAttribute");
|
|
65
65
|
var styles_1 = require("../../styles");
|
|
66
66
|
var SpecialRenderer = function (_a) {
|
|
67
|
-
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, hasDeletionsProp = _a.hasDeletions, setHasDeletions = _a.setHasDeletions, highlightedAttribute = _a.highlightedAttribute, otherProps = __rest(_a, ["values", "attributeType", "parentUri", "mode", "errorMessage", "onDeleteAttribute", "onChangeAttribute", "showEmptyEditors", "hasDeletions", "setHasDeletions", "highlightedAttribute"]);
|
|
67
|
+
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, hasDeletionsProp = _a.hasDeletions, setHasDeletions = _a.setHasDeletions, highlightedAttribute = _a.highlightedAttribute, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b, otherProps = __rest(_a, ["values", "attributeType", "parentUri", "mode", "errorMessage", "onDeleteAttribute", "onChangeAttribute", "showEmptyEditors", "hasDeletions", "setHasDeletions", "highlightedAttribute", "showTitle"]);
|
|
68
68
|
var styles = (0, styles_1.useStyles)();
|
|
69
69
|
var label = attributeType.label, isRequired = attributeType.required, cardinality = attributeType.cardinality;
|
|
70
70
|
var isEditableMode = (0, mdm_sdk_1.isEditableMode)(mode);
|
|
71
|
-
var
|
|
71
|
+
var _c = (0, react_1.useState)(false), hasDeletionsState = _c[0], setHasDeletionsState = _c[1];
|
|
72
72
|
var updateHasDeletions = (0, react_1.useCallback)(function (value) {
|
|
73
73
|
setHasDeletionsState(value);
|
|
74
74
|
setHasDeletions === null || setHasDeletions === void 0 ? void 0 : setHasDeletions(attributeType.uri, value);
|
|
@@ -85,17 +85,17 @@ var SpecialRenderer = function (_a) {
|
|
|
85
85
|
parentUri: parentUri,
|
|
86
86
|
attributeType: attributeType
|
|
87
87
|
}));
|
|
88
|
-
var
|
|
88
|
+
var _d = (0, useScrollToAttribute_1.useScrollToAttribute)(highlightedAttribute), ref = _d.ref, highlightedClassName = _d.highlightedClassName;
|
|
89
89
|
var renderValue = function () {
|
|
90
90
|
switch (attributeType.uri) {
|
|
91
91
|
case mdm_sdk_1.EntityAttrTypes.tags.uri:
|
|
92
|
-
return react_1.default.createElement(TagsEditor_1.TagsEditor, { values: values, onDelete: onDelete, onChange: onChangeAttribute });
|
|
92
|
+
return (react_1.default.createElement(TagsEditor_1.TagsEditor, __assign({}, otherProps, { values: values, onDelete: onDelete, onChange: onChangeAttribute })));
|
|
93
93
|
case mdm_sdk_1.EntityAttrTypes.roles.uri:
|
|
94
|
-
return react_1.default.createElement(RolesEditor_1.RolesEditor, { values: values, onDelete: onDelete, onChange: onChangeAttribute });
|
|
94
|
+
return (react_1.default.createElement(RolesEditor_1.RolesEditor, __assign({}, otherProps, { values: values, onDelete: onDelete, onChange: onChangeAttribute })));
|
|
95
95
|
default: {
|
|
96
96
|
//startDate, endDate
|
|
97
97
|
var value = __assign(__assign({}, emptyEditorValue.current), { value: values[0] || '' });
|
|
98
|
-
return (react_1.default.createElement(EditModeAttributesFactory_1.EditModeAttribute, __assign({ attributeValue: value, attributeType: attributeType, mode: mode, onDeleteAttribute: onDelete, onChangeAttribute: onChangeAttribute }
|
|
98
|
+
return (react_1.default.createElement(EditModeAttributesFactory_1.EditModeAttribute, __assign({}, otherProps, { attributeValue: value, attributeType: attributeType, mode: mode, onDeleteAttribute: onDelete, onChangeAttribute: onChangeAttribute })));
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
};
|
|
@@ -103,7 +103,7 @@ var SpecialRenderer = function (_a) {
|
|
|
103
103
|
return null;
|
|
104
104
|
}
|
|
105
105
|
return (react_1.default.createElement("div", { ref: ref, className: (0, classnames_1.default)(highlightedClassName, styles.wrapper) },
|
|
106
|
-
react_1.default.createElement(AttributeTitle_1.AttributeTitle, { label: label, isRequired: isRequired, className: (0, classnames_1.default)(styles.title, styles.titleWrapper), "data-reltio-id": "reltio-attribute-label" }),
|
|
106
|
+
showTitle && (react_1.default.createElement(AttributeTitle_1.AttributeTitle, { label: label, isRequired: isRequired, className: (0, classnames_1.default)(styles.title, styles.titleWrapper), "data-reltio-id": "reltio-attribute-label" })),
|
|
107
107
|
isEditableMode && react_1.default.createElement(CardinalityMessage_1.CardinalityMessage, { cardinality: cardinality }),
|
|
108
108
|
isEditableMode && react_1.default.createElement(ErrorMessage_1.ErrorMessage, { message: errorMessage }),
|
|
109
109
|
react_1.default.createElement(Box_1.default, { className: styles.attributesWrapper }, renderValue())));
|
|
@@ -4,6 +4,7 @@ type Props = {
|
|
|
4
4
|
values: string[];
|
|
5
5
|
onChange: (param: AttributeItem) => void;
|
|
6
6
|
onDelete?: (param: AttributeItem) => void;
|
|
7
|
+
state?: string;
|
|
7
8
|
};
|
|
8
|
-
export declare const RolesEditor: ({ values, onChange, onDelete }: Props) => React.JSX.Element;
|
|
9
|
+
export declare const RolesEditor: ({ values, onChange, onDelete, state }: Props) => React.JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -29,20 +29,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.RolesEditor = void 0;
|
|
30
30
|
var react_1 = __importStar(require("react"));
|
|
31
31
|
var ramda_1 = require("ramda");
|
|
32
|
+
var Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
33
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
32
34
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
33
35
|
var SimpleDropDownSelector_1 = require("../SimpleDropDownSelector");
|
|
34
36
|
var MultiValueChip_1 = require("../MultiValueChip");
|
|
35
37
|
var SmallIconButton_1 = require("../SmallIconButton");
|
|
36
38
|
var Delete_1 = __importDefault(require("@mui/icons-material/Delete"));
|
|
37
39
|
var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
38
|
-
var
|
|
40
|
+
var RolesEditor_module_css_1 = __importDefault(require("./RolesEditor.module.css"));
|
|
39
41
|
var components = { MultiValue: MultiValueChip_1.MultiValueChip };
|
|
40
42
|
var RolesEditor = function (_a) {
|
|
41
|
-
var values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete;
|
|
42
|
-
var styles = (0, styles_1.useStyles)();
|
|
43
|
+
var values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete, state = _a.state;
|
|
43
44
|
var metadata = (0, MdmModuleContext_1.useMdmMetadata)();
|
|
44
45
|
var entity = (0, MdmModuleContext_1.useMdmEntity)();
|
|
45
46
|
var entityUri = entity.uri;
|
|
47
|
+
var edited = state === 'edited';
|
|
46
48
|
var options = (0, mdm_sdk_1.getRolesForEntityType)(metadata, entity.type).map(function (role) { return ({
|
|
47
49
|
value: role.uri,
|
|
48
50
|
label: role.label
|
|
@@ -66,8 +68,12 @@ var RolesEditor = function (_a) {
|
|
|
66
68
|
var handleDelete = (0, react_1.useCallback)(function () {
|
|
67
69
|
onDelete({ uri: entityUri, attributeType: mdm_sdk_1.EntityAttrTypes.roles });
|
|
68
70
|
}, [entityUri, onDelete]);
|
|
69
|
-
return (react_1.default.createElement("div", { className:
|
|
70
|
-
react_1.default.createElement(SimpleDropDownSelector_1.SimpleDropDownSelector, { label: '', height: 40, isMulti: true, options: options, value: formattedValues, onChange: handleChange, components: components, classes:
|
|
71
|
-
|
|
71
|
+
return (react_1.default.createElement("div", { className: RolesEditor_module_css_1.default.container, "data-reltio-id": "reltio-attribute-value" },
|
|
72
|
+
react_1.default.createElement(SimpleDropDownSelector_1.SimpleDropDownSelector, { label: '', height: 40, isMulti: true, options: options, value: formattedValues, onChange: handleChange, components: components, classes: RolesEditor_module_css_1.default, className: RolesEditor_module_css_1.default.roleContainer }),
|
|
73
|
+
edited && (react_1.default.createElement(Typography_1.default, { variant: "caption", className: RolesEditor_module_css_1.default.editedLabel },
|
|
74
|
+
"(",
|
|
75
|
+
ui_i18n_1.default.text('edited'),
|
|
76
|
+
")")),
|
|
77
|
+
!!onDelete && (react_1.default.createElement(SmallIconButton_1.SmallIconButton, { "data-reltio-id": "reltio-roles-delete-button", className: RolesEditor_module_css_1.default.deleteButton, icon: Delete_1.default, onClick: handleDelete, size: "L" }))));
|
|
72
78
|
};
|
|
73
79
|
exports.RolesEditor = RolesEditor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const styles = {"container":"RolesEditor-container--D0IS8","roleContainer":"RolesEditor-roleContainer--G5mqZ","valueContainer":"RolesEditor-valueContainer--YELLe","deleteButton":"RolesEditor-deleteButton--IKQBV","editedLabel":"RolesEditor-editedLabel--VYoNO"};
|
|
2
|
+
if (typeof document !== 'undefined') {
|
|
3
|
+
const head = document.head || document.getElementsByTagName('head')[0]
|
|
4
|
+
const style = document.createElement('style');
|
|
5
|
+
style.type = 'text/css'
|
|
6
|
+
style.innerHTML = `.RolesEditor-container--D0IS8{align-items:center;display:flex;flex:1;margin-bottom:10px}.RolesEditor-roleContainer--G5mqZ{width:100%}.RolesEditor-valueContainer--YELLe{margin-left:8px;width:0}.RolesEditor-deleteButton--IKQBV{margin-left:8px}.RolesEditor-editedLabel--VYoNO{color:var(--mui-palette-text-secondary);font-style:italic;padding-left:8px}`;
|
|
7
|
+
head.appendChild(style);
|
|
8
|
+
}
|
|
9
|
+
module.exports = styles;
|
|
@@ -5,5 +5,6 @@ export type Props = {
|
|
|
5
5
|
values: string[];
|
|
6
6
|
onChange: (param: AttributeItem) => void;
|
|
7
7
|
onDelete?: (param: AttributeItem) => void;
|
|
8
|
+
state?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare const TagsEditor: ({ className, values, onChange, onDelete }: Props) => React.JSX.Element;
|
|
10
|
+
export declare const TagsEditor: ({ className, values, onChange, onDelete, state }: Props) => React.JSX.Element;
|
|
@@ -77,15 +77,17 @@ exports.TagsEditor = void 0;
|
|
|
77
77
|
var react_1 = __importStar(require("react"));
|
|
78
78
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
79
79
|
var Delete_1 = __importDefault(require("@mui/icons-material/Delete"));
|
|
80
|
+
var Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
81
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
80
82
|
var TypeaheadEditor_1 = require("../TypeaheadEditor");
|
|
81
83
|
var SmallIconButton_1 = require("../SmallIconButton");
|
|
82
84
|
var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
83
|
-
var
|
|
85
|
+
var TagsEditor_module_css_1 = __importDefault(require("./TagsEditor.module.css"));
|
|
84
86
|
var TagsEditor = function (_a) {
|
|
85
|
-
var className = _a.className, values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete;
|
|
86
|
-
var styles = (0, styles_1.useStyles)();
|
|
87
|
+
var className = _a.className, values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete, state = _a.state;
|
|
87
88
|
var entityUri = (0, MdmModuleContext_1.useMdmEntityUri)();
|
|
88
89
|
var globalSearchRequestOptions = (0, MdmModuleContext_1.useMdmGlobalSearchRequestOptions)();
|
|
90
|
+
var edited = state === 'edited';
|
|
89
91
|
var getSuggestions = (0, react_1.useCallback)(function (searchValue, max, pageNo) { return __awaiter(void 0, void 0, void 0, function () {
|
|
90
92
|
var response;
|
|
91
93
|
return __generator(this, function (_a) {
|
|
@@ -111,8 +113,12 @@ var TagsEditor = function (_a) {
|
|
|
111
113
|
var handleDelete = (0, react_1.useCallback)(function () {
|
|
112
114
|
onDelete({ uri: entityUri, attributeType: mdm_sdk_1.EntityAttrTypes.tags });
|
|
113
115
|
}, [entityUri, onDelete]);
|
|
114
|
-
return (react_1.default.createElement("div", { className:
|
|
116
|
+
return (react_1.default.createElement("div", { className: TagsEditor_module_css_1.default.container, "data-reltio-id": "reltio-attribute-value" },
|
|
115
117
|
react_1.default.createElement(TypeaheadEditor_1.TypeaheadEditor, { fullWidth: true, multiple: true, variant: "filled", className: className, value: values || [], onChange: handleChange, getSuggestions: getSuggestions }),
|
|
116
|
-
|
|
118
|
+
edited && (react_1.default.createElement(Typography_1.default, { variant: "caption", className: TagsEditor_module_css_1.default.editedLabel },
|
|
119
|
+
"(",
|
|
120
|
+
ui_i18n_1.default.text('edited'),
|
|
121
|
+
")")),
|
|
122
|
+
!!onDelete && (react_1.default.createElement(SmallIconButton_1.SmallIconButton, { "data-reltio-id": "reltio-tags-delete-button", className: TagsEditor_module_css_1.default.deleteButton, icon: Delete_1.default, onClick: handleDelete, size: "L" }))));
|
|
117
123
|
};
|
|
118
124
|
exports.TagsEditor = TagsEditor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const styles = {"container":"TagsEditor-container--shWZG","deleteButton":"TagsEditor-deleteButton--3wvtV","editedLabel":"TagsEditor-editedLabel--AVFub"};
|
|
2
|
+
if (typeof document !== 'undefined') {
|
|
3
|
+
const head = document.head || document.getElementsByTagName('head')[0]
|
|
4
|
+
const style = document.createElement('style');
|
|
5
|
+
style.type = 'text/css'
|
|
6
|
+
style.innerHTML = `.TagsEditor-container--shWZG{align-items:center;display:flex;flex:1;margin-bottom:10px}.TagsEditor-deleteButton--3wvtV{margin-left:8px}.TagsEditor-editedLabel--AVFub{color:var(--mui-palette-text-secondary);font-style:italic;padding-left:8px}`;
|
|
7
|
+
head.appendChild(style);
|
|
8
|
+
}
|
|
9
|
+
module.exports = styles;
|
package/package.json
CHANGED
package/RolesEditor/styles.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"container" | "valueContainer" | "roleContainer" | "deleteButton">;
|
package/RolesEditor/styles.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { makeStyles } from '@mui/styles';
|
|
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
|
-
},
|
|
12
|
-
valueContainer: {
|
|
13
|
-
marginLeft: '8px',
|
|
14
|
-
width: 0
|
|
15
|
-
},
|
|
16
|
-
deleteButton: {
|
|
17
|
-
marginLeft: '8px'
|
|
18
|
-
}
|
|
19
|
-
});
|
package/TagsEditor/styles.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"container" | "deleteButton">;
|
package/TagsEditor/styles.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"container" | "valueContainer" | "roleContainer" | "deleteButton">;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useStyles = void 0;
|
|
4
|
-
var styles_1 = require("@mui/styles");
|
|
5
|
-
exports.useStyles = (0, 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
|
-
},
|
|
15
|
-
valueContainer: {
|
|
16
|
-
marginLeft: '8px',
|
|
17
|
-
width: 0
|
|
18
|
-
},
|
|
19
|
-
deleteButton: {
|
|
20
|
-
marginLeft: '8px'
|
|
21
|
-
}
|
|
22
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"container" | "deleteButton">;
|
package/cjs/TagsEditor/styles.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useStyles = void 0;
|
|
4
|
-
var styles_1 = require("@mui/styles");
|
|
5
|
-
exports.useStyles = (0, 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
|
-
});
|