@reltio/components 1.4.820 → 1.4.821
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/components/attributes/inline/ComplexAttribute/ComplexAttribute.js +2 -2
- package/components/attributes/inline/SimpleAttribute/SimpleAttribute.js +2 -2
- package/components/attributes/inline/SimpleAttribute/styles.js +4 -2
- package/components/attributes/inline/common/IgnoreButton.d.ts +2 -1
- package/components/attributes/inline/common/IgnoreButton.js +2 -2
- package/components/attributes/inline/common/PinButton.d.ts +2 -1
- package/components/attributes/inline/common/PinButton.js +2 -2
- package/components/attributes/inline/common/__test__/IgnoreButton.spec.js +9 -5
- package/components/attributes/inline/common/__test__/PinButton.spec.js +9 -5
- package/package.json +3 -3
|
@@ -61,8 +61,8 @@ var ComplexAttribute = function (_a) {
|
|
|
61
61
|
crosswalks.map(function (crosswalk) { return (react_1.default.createElement(CrosswalkIcon_1.default, { key: mdm_sdk_1.getCrosswalkId(crosswalk), crosswalk: crosswalk, className: styles.crosswalkIcon })); })),
|
|
62
62
|
react_1.default.createElement(index_1.Spacer, null),
|
|
63
63
|
react_1.default.createElement("div", { className: styles.actions },
|
|
64
|
-
showPin && react_1.default.createElement(PinButton_1.default, { isPinned: attributeValue.pin, onClick: function () { return onPin({ attributeValue: attributeValue }); } }),
|
|
65
|
-
showIgnore && (react_1.default.createElement(IgnoreButton_1.default, { isIgnored: attributeValue.ignored, onClick: function () { return onIgnore({ attributeValue: attributeValue }); } })),
|
|
64
|
+
showPin && (react_1.default.createElement(PinButton_1.default, { disabled: !canEdit, isPinned: attributeValue.pin, onClick: function () { return onPin({ attributeValue: attributeValue }); } })),
|
|
65
|
+
showIgnore && (react_1.default.createElement(IgnoreButton_1.default, { disabled: !canEdit, isIgnored: attributeValue.ignored, onClick: function () { return onIgnore({ attributeValue: attributeValue }); } })),
|
|
66
66
|
showDelete && (react_1.default.createElement(DeleteButton_1.default, { onClick: function () {
|
|
67
67
|
return onDelete({
|
|
68
68
|
attributeType: attributeType,
|
|
@@ -95,8 +95,8 @@ var SimpleAttribute = function (_a) {
|
|
|
95
95
|
react_1.default.createElement("div", { className: styles.attributeValue },
|
|
96
96
|
react_1.default.createElement(DataTypeValue_1.default, { value: mdm_sdk_1.getAttributeValue(attributeValue), dataTypeDefinition: mdm_sdk_1.getAttrDataTypeDefinition(attributeType) })),
|
|
97
97
|
react_1.default.createElement("div", { className: styles.actions },
|
|
98
|
-
showPin && react_1.default.createElement(PinButton_1.default, { isPinned: attributeValue.pin, onClick: function () { return onPin({ attributeValue: attributeValue }); } }),
|
|
99
|
-
showIgnore && (react_1.default.createElement(IgnoreButton_1.default, { isIgnored: attributeValue.ignored, onClick: function () { return onIgnore({ attributeValue: attributeValue }); } })),
|
|
98
|
+
showPin && (react_1.default.createElement(PinButton_1.default, { isPinned: attributeValue.pin, onClick: function () { return onPin({ attributeValue: attributeValue }); }, disabled: !canEdit })),
|
|
99
|
+
showIgnore && (react_1.default.createElement(IgnoreButton_1.default, { isIgnored: attributeValue.ignored, onClick: function () { return onIgnore({ attributeValue: attributeValue }); }, disabled: !canEdit })),
|
|
100
100
|
isHovered && (react_1.default.createElement(DropDownMenuButton_1.default, { MenuItemRenderer: CrosswalkMenuItem_1.default, menuId: "simple-attribute-additional-actions-" + id, buttonComponent: SmallIconButton_1.SmallIconButtonWithTooltip, buttonProps: {
|
|
101
101
|
icon: MoreVert_1.default,
|
|
102
102
|
size: 'XS',
|
|
@@ -26,7 +26,8 @@ exports.useStyles = styles_1.makeStyles(function () { return ({
|
|
|
26
26
|
background: color,
|
|
27
27
|
borderRadius: '4px 0px 0px 4px',
|
|
28
28
|
width: '8px',
|
|
29
|
-
height: '100%'
|
|
29
|
+
height: '100%',
|
|
30
|
+
pointerEvents: 'none'
|
|
30
31
|
},
|
|
31
32
|
'&::before': {
|
|
32
33
|
content: '""',
|
|
@@ -35,7 +36,8 @@ exports.useStyles = styles_1.makeStyles(function () { return ({
|
|
|
35
36
|
borderRadius: '4px',
|
|
36
37
|
border: fullyColored ? color + " solid 2px" : 'rgba(0,0,0,0.12) solid 1px',
|
|
37
38
|
width: '100%',
|
|
38
|
-
height: '100%'
|
|
39
|
+
height: '100%',
|
|
40
|
+
pointerEvents: 'none'
|
|
39
41
|
}
|
|
40
42
|
})), { display: 'flex', alignItems: 'center', maxWidth: '230px', opacity: opaque ? 1 : 0.38, transition: 'opacity 0.3s', position: 'relative' }));
|
|
41
43
|
},
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
declare type Props = {
|
|
3
3
|
isIgnored: boolean;
|
|
4
4
|
onClick: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
};
|
|
6
|
-
declare const IgnoreButton: ({ isIgnored, onClick }: Props) => JSX.Element;
|
|
7
|
+
declare const IgnoreButton: ({ isIgnored, onClick, disabled }: Props) => JSX.Element;
|
|
7
8
|
export default IgnoreButton;
|
|
@@ -9,7 +9,7 @@ var Ignored_1 = __importDefault(require("../../../../icons/Ignored"));
|
|
|
9
9
|
var IgnoredOutlined_1 = __importDefault(require("../../../../icons/IgnoredOutlined"));
|
|
10
10
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
11
11
|
var IgnoreButton = function (_a) {
|
|
12
|
-
var isIgnored = _a.isIgnored, onClick = _a.onClick;
|
|
13
|
-
return (react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, { icon: isIgnored ? Ignored_1.default : IgnoredOutlined_1.default, tooltipTitle: ui_i18n_1.default.text('Ignore'), onClick: onClick, size: "XS", disableRipple: true }));
|
|
12
|
+
var isIgnored = _a.isIgnored, onClick = _a.onClick, disabled = _a.disabled;
|
|
13
|
+
return (react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, { disabled: disabled, showForDisabled: true, icon: isIgnored ? Ignored_1.default : IgnoredOutlined_1.default, tooltipTitle: disabled ? ui_i18n_1.default.text("You don't have permissions to ignore") : ui_i18n_1.default.text('Ignore'), onClick: onClick, size: "XS", disableRipple: true }));
|
|
14
14
|
};
|
|
15
15
|
exports.default = IgnoreButton;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
declare type Props = {
|
|
3
3
|
isPinned: boolean;
|
|
4
4
|
onClick: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
};
|
|
6
|
-
declare const PinButton: ({ isPinned, onClick }: Props) => JSX.Element;
|
|
7
|
+
declare const PinButton: ({ isPinned, onClick, disabled }: Props) => JSX.Element;
|
|
7
8
|
export default PinButton;
|
|
@@ -9,7 +9,7 @@ var Pin_1 = __importDefault(require("../../../../icons/Pin"));
|
|
|
9
9
|
var PinOutlined_1 = __importDefault(require("../../../../icons/PinOutlined"));
|
|
10
10
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
11
11
|
var PinButton = function (_a) {
|
|
12
|
-
var isPinned = _a.isPinned, onClick = _a.onClick;
|
|
13
|
-
return (react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, { onClick: onClick, icon: isPinned ? Pin_1.default : PinOutlined_1.default, tooltipTitle: ui_i18n_1.default.text('Pin'), size: "XS", disableRipple: true }));
|
|
12
|
+
var isPinned = _a.isPinned, onClick = _a.onClick, disabled = _a.disabled;
|
|
13
|
+
return (react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, { disabled: disabled, showForDisabled: true, onClick: onClick, icon: isPinned ? Pin_1.default : PinOutlined_1.default, tooltipTitle: disabled ? "You don't have permissions to pin" : ui_i18n_1.default.text('Pin'), size: "XS", disableRipple: true }));
|
|
14
14
|
};
|
|
15
15
|
exports.default = PinButton;
|
|
@@ -16,15 +16,19 @@ describe('Ignore button test', function () {
|
|
|
16
16
|
onClickFn = jest.fn();
|
|
17
17
|
component = enzyme_1.mount(react_1.default.createElement(IgnoreButton_1.default, { isIgnored: false, onClick: onClickFn }));
|
|
18
18
|
});
|
|
19
|
-
it('should
|
|
20
|
-
expect(getButton(component).
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
19
|
+
it('should pass button props correctly', function () {
|
|
20
|
+
expect(getButton(component).prop('onClick')).toBe(onClickFn);
|
|
21
|
+
component.setProps({ disabled: true });
|
|
22
|
+
expect(getButton(component).prop('disabled')).toBe(true);
|
|
24
23
|
});
|
|
25
24
|
it('should show correct icon', function () {
|
|
26
25
|
expect(getButton(component).prop('icon')).toBe(IgnoredOutlined_1.default);
|
|
27
26
|
component.setProps({ isIgnored: true });
|
|
28
27
|
expect(getButton(component).prop('icon')).toBe(Ignored_1.default);
|
|
29
28
|
});
|
|
29
|
+
it('should show correct tooltip', function () {
|
|
30
|
+
expect(getButton(component).prop('tooltipTitle')).toBe('Ignore');
|
|
31
|
+
component.setProps({ disabled: true });
|
|
32
|
+
expect(getButton(component).prop('tooltipTitle')).toBe("You don't have permissions to ignore");
|
|
33
|
+
});
|
|
30
34
|
});
|
|
@@ -16,15 +16,19 @@ describe('Pin button test', function () {
|
|
|
16
16
|
onClickFn = jest.fn();
|
|
17
17
|
component = enzyme_1.mount(react_1.default.createElement(PinButton_1.default, { isPinned: false, onClick: onClickFn }));
|
|
18
18
|
});
|
|
19
|
-
it('should
|
|
20
|
-
expect(getButton(component).
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
19
|
+
it('should pass button props correctly', function () {
|
|
20
|
+
expect(getButton(component).prop('onClick')).toBe(onClickFn);
|
|
21
|
+
component.setProps({ disabled: true });
|
|
22
|
+
expect(getButton(component).prop('disabled')).toBe(true);
|
|
24
23
|
});
|
|
25
24
|
it('should show correct icon', function () {
|
|
26
25
|
expect(getButton(component).prop('icon')).toBe(PinOutlined_1.default);
|
|
27
26
|
component.setProps({ isPinned: true });
|
|
28
27
|
expect(getButton(component).prop('icon')).toBe(Pin_1.default);
|
|
29
28
|
});
|
|
29
|
+
it('should show correct tooltip', function () {
|
|
30
|
+
expect(getButton(component).prop('tooltipTitle')).toBe('Pin');
|
|
31
|
+
component.setProps({ disabled: true });
|
|
32
|
+
expect(getButton(component).prop('tooltipTitle')).toBe("You don't have permissions to pin");
|
|
33
|
+
});
|
|
30
34
|
});
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.821",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@date-io/moment": "^1.3.5",
|
|
8
8
|
"@react-google-maps/api": "^2.7.0",
|
|
9
|
-
"@reltio/mdm-module": "^1.4.
|
|
10
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
9
|
+
"@reltio/mdm-module": "^1.4.821",
|
|
10
|
+
"@reltio/mdm-sdk": "^1.4.821",
|
|
11
11
|
"classnames": "^2.2.5",
|
|
12
12
|
"frontend-collective-react-dnd-scrollzone": "^1.0.2",
|
|
13
13
|
"nanoid": "^2.0.0",
|