@configuratorware/configurator-frontendgui 1.32.1-beta.1 → 1.32.1-beta.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.
@@ -11,8 +11,6 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _lodash = _interopRequireDefault(require("lodash"));
13
13
 
14
- var _reactSwipeable = require("react-swipeable");
15
-
16
14
  var _clsx2 = _interopRequireDefault(require("clsx"));
17
15
 
18
16
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
@@ -45,6 +43,8 @@ var _Markdown = _interopRequireDefault(require("../../../../../Framework/Compone
45
43
 
46
44
  var _ZoomImage = _interopRequireDefault(require("./ZoomImage"));
47
45
 
46
+ var _Swipeable = require("../../../../../Shared/Components/Swipeable");
47
+
48
48
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
49
49
 
50
50
  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; }
@@ -214,14 +214,11 @@ var Optiondetail = /*#__PURE__*/function (_React$Component) {
214
214
  }
215
215
  });
216
216
 
217
- _defineProperty(_assertThisInitialized(_this), "swiped", function (e, deltaX, deltaY) {
218
- // use only horizontal swiping
219
- if (Math.abs(deltaX) >= Math.abs(deltaY)) {
220
- if (deltaX > 0) {
221
- _this.next();
222
- } else {
223
- _this.prev();
224
- }
217
+ _defineProperty(_assertThisInitialized(_this), "swiped", function (e) {
218
+ if (e.dir === _Swipeable.LEFT) {
219
+ _this.next();
220
+ } else if (e.dir === _Swipeable.RIGHT) {
221
+ _this.prev();
225
222
  }
226
223
  });
227
224
 
@@ -428,12 +425,12 @@ var Optiondetail = /*#__PURE__*/function (_React$Component) {
428
425
  }
429
426
  }, /*#__PURE__*/_react["default"].createElement(LoadingComponent, {
430
427
  show: loading
431
- })) : /*#__PURE__*/_react["default"].createElement(_reactSwipeable.Swipeable, {
432
- disabled: !showNav,
433
- trackMouse: true,
434
- onSwiped: this.swiped,
435
- delta: Optiondetail.swipeDelta
436
- }, /*#__PURE__*/_react["default"].createElement("div", {
428
+ })) : /*#__PURE__*/_react["default"].createElement(_Swipeable.Swipeable, {
429
+ options: {
430
+ trackMouse: true,
431
+ onSwiped: showNav && this.swiped,
432
+ delta: Optiondetail.swipeDelta
433
+ },
437
434
  ref: this.setDetailsContainerRef,
438
435
  className: showNav ? classes.detailContainerWithNav : classes.detailContainer
439
436
  }, showNav && /*#__PURE__*/_react["default"].createElement("div", {
@@ -453,7 +450,7 @@ var Optiondetail = /*#__PURE__*/function (_React$Component) {
453
450
  })), detailsContent) : detailsContent, showNav && /*#__PURE__*/_react["default"].createElement("div", {
454
451
  className: (0, _clsx2["default"])(classes.detailNav, 'next'),
455
452
  onClick: this.next
456
- })))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement("div", {
453
+ }))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement("div", {
457
454
  className: classes.detailFooter
458
455
  }, this.renderControls())), /*#__PURE__*/_react["default"].createElement(_ZoomImage["default"], {
459
456
  onClose: this.toggleZoomImage,
@@ -634,6 +634,6 @@ function configuratorReducer() {
634
634
 
635
635
  function filterOptionsWithDetails(options) {
636
636
  return _lodash["default"].filter(options, function (option) {
637
- return !!(option["abstract"] || option.description || option.detailImageExists === true);
637
+ return !!(option["abstract"] || option.description || option.detailImage);
638
638
  });
639
639
  }
@@ -9,8 +9,6 @@ exports["default"] = void 0;
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
12
- var _reactSwipeable = require("react-swipeable");
13
-
14
12
  var _lodash = _interopRequireDefault(require("lodash"));
15
13
 
16
14
  require("./Styles.scss");
@@ -21,6 +19,8 @@ var _clsx = _interopRequireDefault(require("clsx"));
21
19
 
22
20
  var _styles = require("@material-ui/core/styles");
23
21
 
22
+ var _Swipeable = require("../../../Shared/Components/Swipeable");
23
+
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
25
 
26
26
  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; }
@@ -186,18 +186,16 @@ var Carousel = /*#__PURE__*/function (_React$Component) {
186
186
  });
187
187
 
188
188
  _defineProperty(_assertThisInitialized(_this), "swiped", function (e) {
189
- // if it's vertical deltaY should be the bigger
190
- if (_this.props.vertical && Math.abs(e.deltaY) >= Math.abs(e.deltaX)) {
191
- if (e.deltaY > 0) {
189
+ if (_this.props.vertical) {
190
+ if (e.dir === _Swipeable.UP) {
192
191
  _this.next();
193
- } else {
192
+ } else if (e.dir === _Swipeable.DOWN) {
194
193
  _this.prev();
195
194
  }
196
- } // if it's not vertical deltaX should be the bigger
197
- else if (!_this.props.vertical && Math.abs(e.deltaX) >= Math.abs(e.deltaY)) {
198
- if (e.deltaX > 0) {
195
+ } else {
196
+ if (e.dir === _Swipeable.LEFT) {
199
197
  _this.next();
200
- } else {
198
+ } else if (e.dir === _Swipeable.RIGHT) {
201
199
  _this.prev();
202
200
  }
203
201
  }
@@ -231,10 +229,13 @@ var Carousel = /*#__PURE__*/function (_React$Component) {
231
229
  _createClass(Carousel, [{
232
230
  key: "componentDidMount",
233
231
  value: function componentDidMount() {
234
- this.init();
235
232
  var carousel = this.refs.carousel;
236
- var wheelEventName = 'onwheel' in carousel ? 'wheel' : 'mousewheel';
237
- carousel.addEventListener(wheelEventName, this.scrolled);
233
+
234
+ if (carousel) {
235
+ this.init();
236
+ var wheelEventName = 'onwheel' in carousel ? 'wheel' : 'mousewheel';
237
+ carousel.addEventListener(wheelEventName, this.scrolled);
238
+ }
238
239
  }
239
240
  }, {
240
241
  key: "componentDidUpdate",
@@ -278,11 +279,13 @@ var Carousel = /*#__PURE__*/function (_React$Component) {
278
279
  className: (0, _clsx["default"])(classes.carousel, prevClassName),
279
280
  ref: "prev",
280
281
  onClick: this.prev
281
- }), /*#__PURE__*/_react["default"].createElement(_reactSwipeable.Swipeable, {
282
+ }), /*#__PURE__*/_react["default"].createElement(_Swipeable.Swipeable, {
282
283
  className: 'carousel-frame',
283
- trackMouse: true,
284
- onSwiping: this.swiping,
285
- onSwiped: this.swiped
284
+ options: {
285
+ trackMouse: true,
286
+ onSwiping: this.swiping,
287
+ onSwiped: this.swiped
288
+ }
286
289
  }, /*#__PURE__*/_react["default"].createElement("div", {
287
290
  className: "carousel-slider",
288
291
  style: {
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "UP", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _reactSwipeable.UP;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "DOWN", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _reactSwipeable.DOWN;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "LEFT", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _reactSwipeable.LEFT;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "RIGHT", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _reactSwipeable.RIGHT;
28
+ }
29
+ });
30
+ exports.Swipeable = void 0;
31
+
32
+ var _react = _interopRequireDefault(require("react"));
33
+
34
+ var _reactSwipeable = require("react-swipeable");
35
+
36
+ var _excluded = ["options"];
37
+
38
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
39
+
40
+ 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); }
41
+
42
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
43
+
44
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
45
+
46
+ var Swipeable = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
47
+ var options = _ref.options,
48
+ props = _objectWithoutProperties(_ref, _excluded);
49
+
50
+ var handlers = (0, _reactSwipeable.useSwipeable)(options);
51
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({}, handlers, props, {
52
+ ref: ref
53
+ }));
54
+ });
55
+
56
+ exports.Swipeable = Swipeable;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-frontendgui",
3
- "version": "1.32.1-beta.1",
3
+ "version": "1.32.1-beta.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.32.1-beta.1",
10
- "@hot-loader/react-dom": "^17.0.1",
9
+ "@configuratorware/scripts": "1.32.1-beta.2",
10
+ "@hot-loader/react-dom": "^17.0.2",
11
11
  "@material-ui/core": "^4.12.2",
12
12
  "@material-ui/icons": "^4.11.2",
13
13
  "@material-ui/lab": "^4.0.0-alpha.60",
@@ -37,10 +37,10 @@
37
37
  "react-redux-i18n": "^1.9.3",
38
38
  "react-router": "^5.2.0",
39
39
  "react-router-dom": "^5.2.0",
40
- "react-swipeable": "^5.5.1",
40
+ "react-swipeable": "^6.2.2",
41
41
  "react-zoom-pan-pinch": "^2.1.3",
42
- "redhotmagma-graphics-editor": "1.32.1-beta.1",
43
- "redhotmagma-visualization": "1.32.1-beta.1",
42
+ "redhotmagma-graphics-editor": "1.32.1-beta.2",
43
+ "redhotmagma-visualization": "1.32.1-beta.2",
44
44
  "redux": "^4.1.0",
45
45
  "redux-logger": "^3.0.6",
46
46
  "redux-persist": "^5.10.0",
@@ -52,25 +52,18 @@
52
52
  "uuid": "^3.4.0"
53
53
  },
54
54
  "peerDependencies": {
55
- "@babel/plugin-proposal-class-properties": "^7.13.0",
56
- "@babel/plugin-proposal-decorators": "^7.13.5",
57
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
58
- "@babel/preset-env": "^7.13.12",
59
- "@babel/preset-react": "^7.13.13",
60
- "@babel/preset-typescript": "^7.13.0",
61
55
  "babel-loader": "^8.2.2",
62
- "babel-plugin-module-resolver": "^4.1.0",
63
- "css-loader": "^5.2.0",
56
+ "css-loader": "^5.2.7",
64
57
  "file-loader": "^6.2.0",
65
- "mini-css-extract-plugin": "^1.4.0",
66
- "node-sass": "^5.0.0",
67
- "optimize-css-assets-webpack-plugin": "^5.0.4",
68
- "resolve-url-loader": "^3.1.2",
69
- "sass-loader": "^11.0.1",
58
+ "mini-css-extract-plugin": "^2.1.0",
59
+ "resolve-url-loader": "^3.1.4",
60
+ "sass": "^1.53.0",
61
+ "sass-loader": "^13.0.2",
70
62
  "style-loader": "^2.0.0",
63
+ "terser-webpack-plugin": "^5.1.4",
71
64
  "url-loader": "^4.1.1",
72
- "webpack": "^5.28.0",
73
- "webpack-cli": "^4.6.0",
65
+ "webpack": "^5.46.0",
66
+ "webpack-cli": "^4.7.2",
74
67
  "webpack-dev-server": "^3.11.2"
75
68
  },
76
69
  "scripts": {
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import _ from 'lodash';
3
- import { Swipeable } from 'react-swipeable';
4
3
  import clsx from 'clsx';
5
4
  import Button from '@material-ui/core/Button';
6
5
  import DialogContent from '@material-ui/core/DialogContent';
@@ -17,6 +16,7 @@ import OptionlistitemAmount from '../OptionAmount';
17
16
  import getImageUrl from '../../../../Utils/getImageUrl';
18
17
  import Markdown from '../../../../../Framework/Components/Markdown';
19
18
  import ZoomImage from './ZoomImage';
19
+ import { LEFT, RIGHT, Swipeable } from '../../../../../Shared/Components/Swipeable';
20
20
 
21
21
  const styles = theme => ({
22
22
  detailNav: {
@@ -189,14 +189,11 @@ class Optiondetail extends React.Component {
189
189
  }
190
190
  };
191
191
 
192
- swiped = (e, deltaX, deltaY) => {
193
- // use only horizontal swiping
194
- if (Math.abs(deltaX) >= Math.abs(deltaY)) {
195
- if (deltaX > 0) {
196
- this.next();
197
- } else {
198
- this.prev();
199
- }
192
+ swiped = (e) => {
193
+ if (e.dir === LEFT) {
194
+ this.next();
195
+ } else if (e.dir === RIGHT) {
196
+ this.prev();
200
197
  }
201
198
  };
202
199
 
@@ -351,15 +348,14 @@ class Optiondetail extends React.Component {
351
348
  </div>
352
349
  ) : (
353
350
  <Swipeable
354
- disabled={!showNav}
355
- trackMouse={true}
356
- onSwiped={this.swiped}
357
- delta={Optiondetail.swipeDelta}
351
+ options={{
352
+ trackMouse: true,
353
+ onSwiped: showNav && this.swiped,
354
+ delta: Optiondetail.swipeDelta,
355
+ }}
356
+ ref={this.setDetailsContainerRef}
357
+ className={showNav ? classes.detailContainerWithNav : classes.detailContainer}
358
358
  >
359
- <div
360
- ref={this.setDetailsContainerRef}
361
- className={showNav ? classes.detailContainerWithNav : classes.detailContainer}
362
- >
363
359
  {showNav && (
364
360
  <div className={clsx(classes.detailNav, 'prev')} onClick={this.prev} />
365
361
  )}
@@ -399,7 +395,6 @@ class Optiondetail extends React.Component {
399
395
  {showNav && (
400
396
  <div className={clsx(classes.detailNav, 'next')} onClick={this.next} />
401
397
  )}
402
- </div>
403
398
  </Swipeable>
404
399
  )}
405
400
  </DialogContent>
@@ -599,6 +599,6 @@ export default function configuratorReducer(prevState = initialState, action = {
599
599
  function filterOptionsWithDetails(options) {
600
600
  return _.filter(
601
601
  options,
602
- option => !!(option.abstract || option.description || option.detailImageExists === true)
602
+ option => !!(option.abstract || option.description || option.detailImage)
603
603
  );
604
604
  }
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { Swipeable } from 'react-swipeable';
3
2
  import _ from 'lodash';
4
3
 
5
4
  import './Styles.scss';
6
5
  import PropTypes from 'prop-types';
7
6
  import clsx from 'clsx';
8
7
  import { withStyles } from '@material-ui/core/styles';
8
+ import { DOWN, LEFT, RIGHT, Swipeable, UP } from '../../../Shared/Components/Swipeable';
9
9
 
10
10
  const styles = theme => ({
11
11
  carousel: {
@@ -37,10 +37,12 @@ class Carousel extends React.Component {
37
37
  }
38
38
 
39
39
  componentDidMount() {
40
- this.init();
41
40
  const { carousel } = this.refs;
42
- const wheelEventName = 'onwheel' in carousel ? 'wheel' : 'mousewheel';
43
- carousel.addEventListener(wheelEventName, this.scrolled);
41
+ if (carousel) {
42
+ this.init();
43
+ const wheelEventName = 'onwheel' in carousel ? 'wheel' : 'mousewheel';
44
+ carousel.addEventListener(wheelEventName, this.scrolled);
45
+ }
44
46
  }
45
47
 
46
48
  componentDidUpdate() {
@@ -140,19 +142,16 @@ class Carousel extends React.Component {
140
142
  };
141
143
 
142
144
  swiped = e => {
143
- // if it's vertical deltaY should be the bigger
144
- if (this.props.vertical && Math.abs(e.deltaY) >= Math.abs(e.deltaX)) {
145
- if (e.deltaY > 0) {
145
+ if (this.props.vertical) {
146
+ if (e.dir === UP) {
146
147
  this.next();
147
- } else {
148
+ } else if (e.dir === DOWN) {
148
149
  this.prev();
149
150
  }
150
- }
151
- // if it's not vertical deltaX should be the bigger
152
- else if (!this.props.vertical && Math.abs(e.deltaX) >= Math.abs(e.deltaY)) {
153
- if (e.deltaX > 0) {
151
+ } else {
152
+ if (e.dir === LEFT) {
154
153
  this.next();
155
- } else {
154
+ } else if (e.dir === RIGHT) {
156
155
  this.prev();
157
156
  }
158
157
  }
@@ -199,9 +198,11 @@ class Carousel extends React.Component {
199
198
  )}
200
199
  <Swipeable
201
200
  className={'carousel-frame'}
202
- trackMouse={true}
203
- onSwiping={this.swiping}
204
- onSwiped={this.swiped}
201
+ options={{
202
+ trackMouse: true,
203
+ onSwiping: this.swiping,
204
+ onSwiped: this.swiped,
205
+ }}
205
206
  >
206
207
  <div
207
208
  className="carousel-slider"
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { useSwipeable, UP, DOWN, LEFT, RIGHT } from 'react-swipeable';
3
+
4
+ export { UP, DOWN, LEFT, RIGHT };
5
+
6
+ export const Swipeable = React.forwardRef(({ options, ...props }, ref) => {
7
+ const handlers = useSwipeable(options);
8
+ return <div {...handlers} {...props} ref={ref} />;
9
+ });