@configuratorware/configurator-frontendgui 1.29.1 → 1.29.4

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.
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = exports.decorateOptionlistitem = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _isArray = _interopRequireDefault(require("lodash/isArray"));
13
+
14
+ var _get = _interopRequireDefault(require("lodash/get"));
15
+
16
+ var _i18n = require("../../../../../../Framework/i18n");
17
+
18
+ var _Typography = _interopRequireDefault(require("@material-ui/core/Typography/Typography"));
19
+
20
+ var _withStyles = _interopRequireDefault(require("@material-ui/core/styles/withStyles"));
21
+
22
+ var _RuleComponent2 = require("../RuleComponent");
23
+
24
+ var _memoize = _interopRequireDefault(require("../../../../../../Utils/Function/memoize"));
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
+
28
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
29
+
30
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
31
+
32
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
33
+
34
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
35
+
36
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
37
+
38
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
39
+
40
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
41
+
42
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
43
+
44
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
45
+
46
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
47
+
48
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
49
+
50
+ var optionlistitemStyles = function optionlistitemStyles() {
51
+ return {
52
+ root: {
53
+ cursor: 'auto'
54
+ },
55
+ details: {
56
+ display: 'none'
57
+ }
58
+ };
59
+ };
60
+
61
+ var decorateOptionlistitem = (0, _memoize["default"])(function (OptionlistitemComponent) {
62
+ return (0, _withStyles["default"])(optionlistitemStyles, {
63
+ name: 'OptionRuleOptionlistitem'
64
+ })(function (props) {
65
+ if (!OptionlistitemComponent) {
66
+ return null;
67
+ }
68
+
69
+ return /*#__PURE__*/_react["default"].createElement(OptionlistitemComponent, _extends({}, props, {
70
+ OptionAmountComponent: null
71
+ }));
72
+ });
73
+ });
74
+ exports.decorateOptionlistitem = decorateOptionlistitem;
75
+
76
+ var styles = function styles() {
77
+ return {
78
+ root: {},
79
+ resolveText: {
80
+ fontWeight: 'bold',
81
+ paddingTop: 10
82
+ }
83
+ };
84
+ };
85
+
86
+ var OptionExclusionRule = /*#__PURE__*/function (_RuleComponent) {
87
+ _inherits(OptionExclusionRule, _RuleComponent);
88
+
89
+ var _super = _createSuper(OptionExclusionRule);
90
+
91
+ function OptionExclusionRule(props) {
92
+ var _this;
93
+
94
+ _classCallCheck(this, OptionExclusionRule);
95
+
96
+ _this = _super.call(this, props);
97
+ _this.state = {
98
+ result: {}
99
+ };
100
+ return _this;
101
+ }
102
+
103
+ _createClass(OptionExclusionRule, [{
104
+ key: "initState",
105
+ value: function initState(props) {
106
+ var result = props.result;
107
+
108
+ if (result) {
109
+ this.setState({
110
+ result: result
111
+ });
112
+ }
113
+ }
114
+ }, {
115
+ key: "componentDidMount",
116
+ value: function componentDidMount() {
117
+ this.initState(this.props);
118
+ }
119
+ }, {
120
+ key: "componentWillReceiveProps",
121
+ value: function componentWillReceiveProps(props) {
122
+ this.initState(props);
123
+ }
124
+ }, {
125
+ key: "renderInfoText",
126
+ value: function renderInfoText() {
127
+ var isReverseCheck = (0, _get["default"])(this.state.result, 'data.reverseCheck', false);
128
+ var ruleType = isReverseCheck ? 'optionexclusionreverse' : 'optionexclusion';
129
+ return (0, _i18n.T)("incompatibility.rules.".concat(ruleType, ".text"), {
130
+ tag: _Typography["default"]
131
+ });
132
+ }
133
+ }, {
134
+ key: "renderResolveText",
135
+ value: function renderResolveText() {
136
+ var ruleType = this.ruleType,
137
+ classes = this.props.classes;
138
+ return (0, _i18n.T)("incompatibility.rules.".concat(ruleType, ".resolveText"), {
139
+ tag: _Typography["default"],
140
+ className: classes.resolveText
141
+ });
142
+ }
143
+ }, {
144
+ key: "renderRules",
145
+ value: function renderRules() {
146
+ var _this$props = this.props,
147
+ Optionlistitem = _this$props.Optionlistitem,
148
+ viewDetails = _this$props.viewDetails,
149
+ checkedOptionIndex = _this$props.checkedOptionIndex,
150
+ ruleTypeIndex = _this$props.ruleTypeIndex,
151
+ classes = _this$props.classes;
152
+ var _this$state$result = this.state.result,
153
+ checked_option = _this$state$result.checked_option,
154
+ conflicting_options = _this$state$result.conflicting_options;
155
+ var OptionComponent = OptionExclusionRule.OptionComponent || decorateOptionlistitem(Optionlistitem);
156
+ var isReverseCheck = (0, _get["default"])(this.state.result, 'data.reverseCheck', false);
157
+
158
+ if (!OptionComponent) {
159
+ return null;
160
+ }
161
+
162
+ return /*#__PURE__*/_react["default"].createElement("div", {
163
+ className: classes.root
164
+ }, checkedOptionIndex === 0 && isReverseCheck === false && /*#__PURE__*/_react["default"].createElement(OptionComponent, {
165
+ option: checked_option,
166
+ viewDetails: viewDetails,
167
+ className: "checkedOption"
168
+ }), ruleTypeIndex === 0 && this.renderInfoText(), ruleTypeIndex === 0 && this.renderResolveText(), (0, _isArray["default"])(conflicting_options) && conflicting_options.map(function (option, key) {
169
+ return /*#__PURE__*/_react["default"].createElement(OptionComponent, {
170
+ key: key,
171
+ option: option,
172
+ viewDetails: viewDetails,
173
+ className: "conflictingOption"
174
+ });
175
+ }));
176
+ }
177
+ }]);
178
+
179
+ return OptionExclusionRule;
180
+ }(_RuleComponent2.RuleComponent);
181
+
182
+ var _default = (0, _withStyles["default"])(styles, {
183
+ name: 'OptionExclusionRule'
184
+ })(OptionExclusionRule);
185
+
186
+ exports["default"] = _default;
@@ -27,6 +27,8 @@ var _OptionRule = _interopRequireDefault(require("./OptionRule"));
27
27
 
28
28
  var _RuleComponent = _interopRequireDefault(require("./RuleComponent"));
29
29
 
30
+ var _OptionExclusionRule = _interopRequireDefault(require("./OptionExclusionRule"));
31
+
30
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
33
 
32
34
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
@@ -143,7 +145,7 @@ var Incompatibility = /*#__PURE__*/function (_React$Component) {
143
145
  _this2 = _super.call.apply(_super, [this].concat(args));
144
146
 
145
147
  _defineProperty(_assertThisInitialized(_this2), "ruleTypeComponents", {
146
- optionexclusion: _OptionRule["default"],
148
+ optionexclusion: _OptionExclusionRule["default"],
147
149
  optiondependency: _OptionRule["default"],
148
150
  itemattributematch: _OptionRule["default"]
149
151
  });
@@ -149,6 +149,9 @@ var styles = function styles(theme) {
149
149
  },
150
150
  dialogContentRootWithZoom: {
151
151
  overflow: 'hidden'
152
+ },
153
+ detailDialogContentRoot: {
154
+ overflowY: 'auto'
152
155
  }
153
156
  };
154
157
  };
@@ -359,8 +362,7 @@ var Optiondetail = /*#__PURE__*/function (_React$Component) {
359
362
  onClose = _this$props5.onClose,
360
363
  details = _this$props5.details,
361
364
  classes = _this$props5.classes,
362
- width = _this$props5.width,
363
- isTabletDevice = _this$props5.isTabletDevice;
365
+ width = _this$props5.width;
364
366
  var _this$state = this.state,
365
367
  loading = _this$state.loading,
366
368
  loadingContainerHeight = _this$state.loadingContainerHeight;
@@ -385,7 +387,7 @@ var Optiondetail = /*#__PURE__*/function (_React$Component) {
385
387
  className: classes.detailsTypography
386
388
  }, details.description));
387
389
 
388
- var showFullScreenModal = ['xs', 'sm'].includes(width) && !isTabletDevice;
390
+ var showFullScreenModal = ['xs', 'sm'].includes(width);
389
391
  var maxZoomedWidth = this.getMaxZoomedWidth(width);
390
392
  var isLandscapeFormat = false;
391
393
 
@@ -415,8 +417,10 @@ var Optiondetail = /*#__PURE__*/function (_React$Component) {
415
417
  fullScreen: showFullScreenModal
416
418
  }, /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], {
417
419
  classes: this.state.hasZoom ? {
418
- root: classes.dialogContentRootWithZoom
419
- } : null
420
+ root: (0, _clsx2["default"])(classes.detailDialogContentRoot, classes.dialogContentRootWithZoom)
421
+ } : {
422
+ root: classes.detailDialogContentRoot
423
+ }
420
424
  }, loading ? /*#__PURE__*/_react["default"].createElement("div", {
421
425
  style: {
422
426
  height: loadingContainerHeight,
@@ -479,7 +483,6 @@ _defineProperty(Optiondetail, "propTypes", {
479
483
  onClose: _propTypes["default"].func,
480
484
  LoadingComponent: _propTypes["default"].elementType,
481
485
  width: _propTypes["default"].string,
482
- isTabletDevice: _propTypes["default"].bool,
483
486
  isLoading: _propTypes["default"].bool
484
487
  });
485
488
 
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-frontendgui",
3
- "version": "1.29.1",
3
+ "version": "1.29.4",
4
4
  "license": "UNLICENSED",
5
5
  "private": false,
6
6
  "main": "./index.js",
7
7
  "dependencies": {
8
8
  "@babel/polyfill": "^7.12.1",
9
- "@configuratorware/scripts": "1.29.1",
9
+ "@configuratorware/scripts": "1.29.4",
10
10
  "@hot-loader/react-dom": "^17.0.1",
11
11
  "@material-ui/core": "^4.12.2",
12
12
  "@material-ui/icons": "^4.11.2",
@@ -39,8 +39,8 @@
39
39
  "react-router-dom": "^5.2.0",
40
40
  "react-swipeable": "^5.5.1",
41
41
  "react-zoom-pan-pinch": "^2.1.3",
42
- "redhotmagma-graphics-editor": "1.29.1",
43
- "redhotmagma-visualization": "1.29.1",
42
+ "redhotmagma-graphics-editor": "1.29.4",
43
+ "redhotmagma-visualization": "1.29.4",
44
44
  "redux": "^4.1.0",
45
45
  "redux-logger": "^3.0.6",
46
46
  "redux-persist": "^5.10.0",
@@ -418,6 +418,9 @@
418
418
  "text": "Die Auswahl passt nicht zu folgenden Teilen in der Konfiguration.",
419
419
  "resolveText": "Diese Teile werden entfernt:"
420
420
  },
421
+ "optionexclusionreverse": {
422
+ "text": "Das abgewählte Teil ist Voraussetzung für andere gewählte Teile."
423
+ },
421
424
  "optiondependency": {
422
425
  "text": "Die Auswahl setzt andere Teile voraus.",
423
426
  "resolveText": "Folgende Teile werden eingetauscht:"
@@ -416,6 +416,9 @@
416
416
  "text": "The selection does not match the following parts in the configuration.",
417
417
  "resolveText": "These options will be removed:"
418
418
  },
419
+ "optionexclusionreverse": {
420
+ "text": "The removed part is a requirement for other parts."
421
+ },
419
422
  "optiondependency": {
420
423
  "text": "The selection requires other parts.",
421
424
  "resolveText": "The following parts are added:"
@@ -0,0 +1,116 @@
1
+ import React from 'react';
2
+ import isArray from 'lodash/isArray';
3
+ import get from 'lodash/get';
4
+ import { T } from 'Framework/i18n';
5
+ import Typography from '@material-ui/core/Typography/Typography';
6
+ import withStyles from '@material-ui/core/styles/withStyles';
7
+ import { RuleComponent } from '../RuleComponent';
8
+ import memoize from 'Utils/Function/memoize';
9
+
10
+ const optionlistitemStyles = () => ({
11
+ root: {
12
+ cursor: 'auto',
13
+ },
14
+ details: {
15
+ display: 'none',
16
+ },
17
+ });
18
+
19
+ export const decorateOptionlistitem = memoize(OptionlistitemComponent =>
20
+ withStyles(optionlistitemStyles, { name: 'OptionRuleOptionlistitem' })(props => {
21
+ if (!OptionlistitemComponent) {
22
+ return null;
23
+ }
24
+
25
+ return <OptionlistitemComponent {...props} OptionAmountComponent={null} />;
26
+ })
27
+ );
28
+
29
+ const styles = () => ({
30
+ root: {},
31
+ resolveText: {
32
+ fontWeight: 'bold',
33
+ paddingTop: 10,
34
+ },
35
+ });
36
+
37
+ class OptionExclusionRule extends RuleComponent {
38
+ constructor(props) {
39
+ super(props);
40
+ this.state = {
41
+ result: {},
42
+ };
43
+ }
44
+
45
+ initState(props) {
46
+ const { result } = props;
47
+ if (result) {
48
+ this.setState({ result });
49
+ }
50
+ }
51
+
52
+ componentDidMount() {
53
+ this.initState(this.props);
54
+ }
55
+
56
+ componentWillReceiveProps(props) {
57
+ this.initState(props);
58
+ }
59
+
60
+ renderInfoText() {
61
+ const isReverseCheck = get(this.state.result, 'data.reverseCheck', false);
62
+ const ruleType = isReverseCheck ? 'optionexclusionreverse' : 'optionexclusion';
63
+ return T(`incompatibility.rules.${ruleType}.text`, { tag: Typography });
64
+ }
65
+
66
+ renderResolveText() {
67
+ const {
68
+ ruleType,
69
+ props: { classes },
70
+ } = this;
71
+ return T(`incompatibility.rules.${ruleType}.resolveText`, {
72
+ tag: Typography,
73
+ className: classes.resolveText,
74
+ });
75
+ }
76
+
77
+ renderRules() {
78
+ const { Optionlistitem, viewDetails, checkedOptionIndex, ruleTypeIndex, classes } = this.props;
79
+ const { checked_option, conflicting_options } = this.state.result;
80
+ const OptionComponent = OptionExclusionRule.OptionComponent || decorateOptionlistitem(Optionlistitem);
81
+ const isReverseCheck = get(this.state.result, 'data.reverseCheck', false);
82
+
83
+ if (!OptionComponent) {
84
+ return null;
85
+ }
86
+
87
+ return (
88
+ <div className={classes.root}>
89
+ {checkedOptionIndex === 0 && isReverseCheck === false && (
90
+ <OptionComponent
91
+ option={checked_option}
92
+ viewDetails={viewDetails}
93
+ className="checkedOption"
94
+ />
95
+ )}
96
+
97
+ {ruleTypeIndex === 0 && this.renderInfoText()}
98
+ {ruleTypeIndex === 0 && this.renderResolveText()}
99
+
100
+ {isArray(conflicting_options) &&
101
+ conflicting_options.map((option, key) => {
102
+ return (
103
+ <OptionComponent
104
+ key={key}
105
+ option={option}
106
+ viewDetails={viewDetails}
107
+ className="conflictingOption"
108
+ />
109
+ );
110
+ })}
111
+ </div>
112
+ );
113
+ }
114
+ }
115
+
116
+ export default withStyles(styles, { name: 'OptionExclusionRule' })(OptionExclusionRule);
@@ -10,6 +10,7 @@ import CustomDialog from 'Shared/Components/CustomDialog';
10
10
 
11
11
  import OptionRule from './OptionRule';
12
12
  import RuleComponent from './RuleComponent';
13
+ import OptionExclusionRule from './OptionExclusionRule';
13
14
 
14
15
  const styles = theme => ({
15
16
  incompatibilityDialog: {
@@ -80,7 +81,7 @@ export class RuleCounter {
80
81
 
81
82
  class Incompatibility extends React.Component {
82
83
  ruleTypeComponents = {
83
- optionexclusion: OptionRule,
84
+ optionexclusion: OptionExclusionRule,
84
85
  optiondependency: OptionRule,
85
86
  itemattributematch: OptionRule,
86
87
  };
@@ -3,7 +3,7 @@
3
3
  exports[`Screens/Components/ImageEditDialog/MessageBox renders as a modal screen on larger screens 1`] = `
4
4
  <div>
5
5
  <div
6
- class="MuiDialogContent-root"
6
+ class="MuiDialogContent-root Optiondetail-detailDialogContentRoot-14"
7
7
  >
8
8
  <div>
9
9
  <div
@@ -60,7 +60,7 @@ exports[`Screens/Components/ImageEditDialog/MessageBox renders as a modal screen
60
60
  exports[`Screens/Components/ImageEditDialog/MessageBox renders as full screen on smaller screens 1`] = `
61
61
  <div>
62
62
  <div
63
- class="MuiDialogContent-root"
63
+ class="MuiDialogContent-root Optiondetail-detailDialogContentRoot-14"
64
64
  >
65
65
  <div>
66
66
  <div
@@ -117,7 +117,7 @@ exports[`Screens/Components/ImageEditDialog/MessageBox renders as full screen on
117
117
  exports[`Screens/Components/ImageEditDialog/MessageBox renders with previous and next navigation buttons 1`] = `
118
118
  <div>
119
119
  <div
120
- class="MuiDialogContent-root"
120
+ class="MuiDialogContent-root Optiondetail-detailDialogContentRoot-14"
121
121
  >
122
122
  <div>
123
123
  <div
@@ -96,6 +96,9 @@ const styles = theme => ({
96
96
  dialogContentRootWithZoom: {
97
97
  overflow: 'hidden',
98
98
  },
99
+ detailDialogContentRoot: {
100
+ overflowY: 'auto',
101
+ },
99
102
  });
100
103
 
101
104
  class Optiondetail extends React.Component {
@@ -112,7 +115,6 @@ class Optiondetail extends React.Component {
112
115
  onClose: PropTypes.func,
113
116
  LoadingComponent: PropTypes.elementType,
114
117
  width: PropTypes.string,
115
- isTabletDevice: PropTypes.bool,
116
118
  isLoading: PropTypes.bool,
117
119
  };
118
120
 
@@ -261,16 +263,7 @@ class Optiondetail extends React.Component {
261
263
  };
262
264
 
263
265
  render() {
264
- const {
265
- LoadingComponent,
266
- options,
267
- show,
268
- onClose,
269
- details,
270
- classes,
271
- width,
272
- isTabletDevice,
273
- } = this.props;
266
+ const { LoadingComponent, options, show, onClose, details, classes, width } = this.props;
274
267
  const { loading, loadingContainerHeight } = this.state;
275
268
  const showNav = _.isArray(options) && options.length > 1;
276
269
  const detailImage = details.detailImage;
@@ -307,7 +300,7 @@ class Optiondetail extends React.Component {
307
300
  </div>
308
301
  );
309
302
 
310
- const showFullScreenModal = ['xs', 'sm'].includes(width) && !isTabletDevice;
303
+ const showFullScreenModal = ['xs', 'sm'].includes(width);
311
304
  let maxZoomedWidth = this.getMaxZoomedWidth(width);
312
305
  let isLandscapeFormat = false;
313
306
  if (
@@ -341,7 +334,16 @@ class Optiondetail extends React.Component {
341
334
  fullScreen={showFullScreenModal}
342
335
  >
343
336
  <DialogContent
344
- classes={this.state.hasZoom ? { root: classes.dialogContentRootWithZoom } : null}
337
+ classes={
338
+ this.state.hasZoom
339
+ ? {
340
+ root: clsx(
341
+ classes.detailDialogContentRoot,
342
+ classes.dialogContentRootWithZoom
343
+ ),
344
+ }
345
+ : { root: classes.detailDialogContentRoot }
346
+ }
345
347
  >
346
348
  {loading ? (
347
349
  <div style={{ height: loadingContainerHeight, boxSizing: 'border-box' }}>