@configuratorware/configurator-admingui 1.31.0 → 1.31.3

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.
@@ -72,7 +72,11 @@ var DefaultColorSwitch = /*#__PURE__*/function (_Component) {
72
72
  _this = _super.call.apply(_super, [this].concat(args));
73
73
 
74
74
  _defineProperty(_assertThisInitialized(_this), "onToggle", function (e) {
75
- _this.props.setDefaultColor(_this.props.isDefaultColor ? null : _this.props.color);
75
+ var colorId = (0, _get["default"])(_this.props.color, 'id', null);
76
+
77
+ if (colorId) {
78
+ _this.props.setDefaultColor(_this.props.isDefaultColor ? null : _this.props.color);
79
+ }
76
80
  });
77
81
 
78
82
  return _this;
@@ -82,15 +86,21 @@ var DefaultColorSwitch = /*#__PURE__*/function (_Component) {
82
86
  key: "render",
83
87
  value: function render() {
84
88
  var classes = this.props.classes;
85
- return /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
86
- classes: {
87
- switchBase: classes.switchBase
88
- },
89
- checked: this.props.isDefaultColor,
90
- onClick: this.onToggle,
91
- name: "isDefaultColor",
92
- color: "primary"
93
- });
89
+ var colorId = (0, _get["default"])(this.props.color, 'id', null);
90
+
91
+ if (colorId) {
92
+ return /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
93
+ classes: {
94
+ switchBase: classes.switchBase
95
+ },
96
+ checked: this.props.isDefaultColor,
97
+ onClick: this.onToggle,
98
+ name: "isDefaultColor",
99
+ color: "primary"
100
+ });
101
+ }
102
+
103
+ return null;
94
104
  }
95
105
  }]);
96
106
 
@@ -109,7 +119,7 @@ var mapStateToProps = function mapStateToProps(state, ownProps) {
109
119
  var colorId = (0, _get["default"])(ownProps.color, 'id', null);
110
120
  var defaultColorId = (0, _get["default"])(state, "".concat(_Actions.COLORPALETTES_REDUCER_NAME, ".data.defaultColor.value.id"), null);
111
121
  return {
112
- isDefaultColor: colorId === defaultColorId
122
+ isDefaultColor: colorId === defaultColorId && colorId !== null && defaultColorId !== null
113
123
  };
114
124
  };
115
125
 
@@ -164,7 +164,7 @@ var VisualizationSettings = /*#__PURE__*/function (_React$Component) {
164
164
 
165
165
  _defineProperty(VisualizationSettings, "propTypes", {
166
166
  loadDetails: _propTypes["default"].func.isRequired,
167
- steState: _propTypes["default"].func.isRequired,
167
+ setState: _propTypes["default"].func.isRequired,
168
168
  onDeleteItems: _propTypes["default"].func.isRequired
169
169
  });
170
170
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-admingui",
3
- "version": "1.31.0",
3
+ "version": "1.31.3",
4
4
  "license": "UNLICENSED",
5
5
  "private": false,
6
6
  "dependencies": {
@@ -29,7 +29,7 @@
29
29
  "react-redux-i18n": "^1.9.3",
30
30
  "react-router": "^3.2.6",
31
31
  "react-sortable-hoc": "^1.11.0",
32
- "redhotmagma-visualization": "1.31.0",
32
+ "redhotmagma-visualization": "1.31.3",
33
33
  "redux": "^4.1.0",
34
34
  "redux-logger": "^3.0.6",
35
35
  "redux-persist": "^5.10.0",
@@ -20,20 +20,27 @@ export class DefaultColorSwitch extends Component {
20
20
  };
21
21
 
22
22
  onToggle = e => {
23
- this.props.setDefaultColor(this.props.isDefaultColor ? null : this.props.color);
23
+ const colorId = get(this.props.color, 'id', null);
24
+ if (colorId) {
25
+ this.props.setDefaultColor(this.props.isDefaultColor ? null : this.props.color);
26
+ }
24
27
  };
25
28
 
26
29
  render() {
27
30
  const { classes } = this.props;
28
- return (
29
- <Switch
30
- classes={{ switchBase: classes.switchBase }}
31
- checked={this.props.isDefaultColor}
32
- onClick={this.onToggle}
33
- name="isDefaultColor"
34
- color="primary"
35
- />
36
- );
31
+ const colorId = get(this.props.color, 'id', null);
32
+ if (colorId) {
33
+ return (
34
+ <Switch
35
+ classes={{ switchBase: classes.switchBase }}
36
+ checked={this.props.isDefaultColor}
37
+ onClick={this.onToggle}
38
+ name="isDefaultColor"
39
+ color="primary"
40
+ />
41
+ );
42
+ }
43
+ return null;
37
44
  }
38
45
  }
39
46
 
@@ -42,7 +49,7 @@ const mapStateToProps = (state, ownProps) => {
42
49
  const defaultColorId = get(state, `${COLORPALETTES_REDUCER_NAME}.data.defaultColor.value.id`, null);
43
50
 
44
51
  return {
45
- isDefaultColor: colorId === defaultColorId,
52
+ isDefaultColor: colorId === defaultColorId && colorId !== null && defaultColorId !== null,
46
53
  };
47
54
  };
48
55
 
@@ -16,7 +16,7 @@ import { DESIGNER_REDUCER_NAME } from '../../../Reducers/Actions';
16
16
  class VisualizationSettings extends React.Component {
17
17
  static propTypes = {
18
18
  loadDetails: PropTypes.func.isRequired,
19
- steState: PropTypes.func.isRequired,
19
+ setState: PropTypes.func.isRequired,
20
20
  onDeleteItems: PropTypes.func.isRequired,
21
21
  };
22
22