@configuratorware/configurator-frontendgui 1.29.1 → 1.29.2
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/App/Modules/Creator/Components/Incompatibility/OptionExclusionRule/index.js +186 -0
- package/App/Modules/Creator/Components/Incompatibility/index.js +3 -1
- package/package.json +4 -4
- package/public/translations/de_DE.json +3 -0
- package/public/translations/en_GB.json +3 -0
- package/src/App/Modules/Creator/Components/Incompatibility/OptionExclusionRule/index.js +116 -0
- package/src/App/Modules/Creator/Components/Incompatibility/index.js +2 -1
|
@@ -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:
|
|
148
|
+
optionexclusion: _OptionExclusionRule["default"],
|
|
147
149
|
optiondependency: _OptionRule["default"],
|
|
148
150
|
itemattributematch: _OptionRule["default"]
|
|
149
151
|
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configuratorware/configurator-frontendgui",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.2",
|
|
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.
|
|
9
|
+
"@configuratorware/scripts": "1.29.2",
|
|
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.
|
|
43
|
-
"redhotmagma-visualization": "1.29.
|
|
42
|
+
"redhotmagma-graphics-editor": "1.29.2",
|
|
43
|
+
"redhotmagma-visualization": "1.29.2",
|
|
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:
|
|
84
|
+
optionexclusion: OptionExclusionRule,
|
|
84
85
|
optiondependency: OptionRule,
|
|
85
86
|
itemattributematch: OptionRule,
|
|
86
87
|
};
|