@configuratorware/configurator-frontendgui 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.
@@ -41,6 +41,8 @@ var _ServiceLocator = require("../../../../ServiceLocator");
41
41
 
42
42
  var _withWidth = _interopRequireWildcard(require("@material-ui/core/withWidth/withWidth"));
43
43
 
44
+ var _configuration = require("../../../../configuration");
45
+
44
46
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
45
47
 
46
48
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -240,7 +242,7 @@ var ImageEditDialog = /*#__PURE__*/function (_React$Component) {
240
242
  }
241
243
 
242
244
  var extension = file.name.toLowerCase().match(/\.([0-9a-z]+)$/i)[1];
243
- var allowedFormats = ['jpg', 'jpeg', 'svg', 'png', 'pdf', 'bmp', 'tif', 'eps', 'ai', 'gif'];
245
+ var allowedFormats = (0, _configuration.getConf)('designer.allowedImageUploadFormats');
244
246
 
245
247
  if (allowedFormats.indexOf(extension) === -1) {
246
248
  error = (0, _i18n.t)('fileUpload.uploadFormatError', {
@@ -260,8 +262,8 @@ var ImageEditDialog = /*#__PURE__*/function (_React$Component) {
260
262
  imageData: null
261
263
  });
262
264
 
263
- var renderabelFormats = ['jpg', 'jpeg', 'svg', 'png', 'bmp', 'tif', 'gif'];
264
- var isRenderable = renderabelFormats.indexOf(extension) !== -1;
265
+ var renderableFormats = ['jpg', 'jpeg', 'svg', 'png', 'bmp', 'gif'];
266
+ var isRenderable = renderableFormats.indexOf(extension) !== -1;
265
267
 
266
268
  if (isRenderable && file.type && file.type.match('image.*')) {
267
269
  var reader = new FileReader();
@@ -186,7 +186,9 @@ function imageGalleryReducer() {
186
186
  selectedImage: currentImage
187
187
  });
188
188
  } else {
189
- Object.assign(currentImage, selectedImage);
189
+ var idx = _userImages.indexOf(currentImage);
190
+
191
+ _userImages[idx] = _objectSpread(_objectSpread({}, currentImage), selectedImage);
190
192
  return _objectSpread(_objectSpread({}, state), {}, {
191
193
  userImages: _userImages
192
194
  });
@@ -266,12 +268,13 @@ function imageGalleryReducer() {
266
268
 
267
269
  if (action.immediateCommit) {
268
270
  result.userImages = _toConsumableArray(_userImages2);
269
- var idx = (0, _findIndex["default"])(_userImages2, {
271
+
272
+ var _idx = (0, _findIndex["default"])(_userImages2, {
270
273
  identifier: image.identifier
271
274
  });
272
275
 
273
- if (idx !== -1) {
274
- result.userImages[idx] = image;
276
+ if (_idx !== -1) {
277
+ result.userImages[_idx] = image;
275
278
  } else {
276
279
  result.userImages.push(image);
277
280
  }
@@ -55,10 +55,17 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
55
55
 
56
56
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
57
57
 
58
+ function getCanvasImageScalingWithImageData(canvasImage, imageData) {
59
+ var currentPreview = canvasImage.imageData.preview;
60
+ var nextPreview = imageData.preview;
61
+ return canvasImage.scaling * (currentPreview.width / nextPreview.width);
62
+ }
63
+
58
64
  function updateCanvasImageWithImageData(canvasImage, imageData) {
59
65
  return canvasImage.updateOptions((0, _Transformers.prepareImageObjectData)({
60
66
  imageData: imageData,
61
- src: "".concat((0, _configuration.getConf)('network.host')).concat(imageData.preview.url)
67
+ src: "".concat((0, _configuration.getConf)('network.host')).concat(imageData.preview.url),
68
+ scaling: getCanvasImageScalingWithImageData(canvasImage, imageData)
62
69
  }));
63
70
  }
64
71
 
@@ -31,7 +31,7 @@ var DEVELOPMENT_HOST_INT = 'http://int.configuratorware.local'; // eslint-disabl
31
31
  var DEVELOPMENT_HOST_LOCAL = 'http://localhost:10030';
32
32
  var hostsByNodeEnv = {
33
33
  production: '',
34
- development: DEVELOPMENT_HOST_INT,
34
+ development: DEVELOPMENT_HOST_LOCAL,
35
35
  test: ''
36
36
  };
37
37
  var resourceUrlsByNodeEnv = {
@@ -169,8 +169,10 @@ var applicationConfiguration = {
169
169
  designer: {
170
170
  dpi: 300,
171
171
  // the default canvas dpi as project specific option
172
- maxColorAmount: 10 // the default max number of colors in the colorizing feature
173
-
172
+ maxColorAmount: 10,
173
+ // the default max number of colors in the colorizing feature
174
+ allowedImageUploadFormats: [// the image formats users can upload to designareas / designer items
175
+ 'jpg', 'jpeg', 'svg', 'png', 'pdf', 'bmp', 'tif', 'tiff', 'eps', 'ai', 'gif']
174
176
  },
175
177
  vectorizeImageQuality: 45000,
176
178
  renderPreviewImagesForCheckout: true,
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-frontendgui",
3
- "version": "1.31.0",
3
+ "version": "1.31.3",
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.31.0",
9
+ "@configuratorware/scripts": "1.31.3",
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.31.0",
43
- "redhotmagma-visualization": "1.31.0",
42
+ "redhotmagma-graphics-editor": "1.31.3",
43
+ "redhotmagma-visualization": "1.31.3",
44
44
  "redux": "^4.1.0",
45
45
  "redux-logger": "^3.0.6",
46
46
  "redux-persist": "^5.10.0",
@@ -63,9 +63,8 @@
63
63
  },
64
64
  "productVariant": {
65
65
  "amountChosen": "chosen: ",
66
- "addColor": "Add color",
67
- "adaptAmount": "Adapt amount",
68
- "editDesign": "Edit design",
66
+ "chooseSize": "Choose size",
67
+ "adaptSizes": "Adapt sizes",
69
68
  "confirmSelection": "Confirm selection",
70
69
  "amountLabel": "Amount"
71
70
  },
@@ -186,7 +185,6 @@
186
185
  "missingVariantError": "The selected item %{selectedVariant} is no longer available.",
187
186
  "errorDialogTitle": "Notice",
188
187
  "clientValidationError": "No valid channel/client combination found!",
189
- "alertDialogTitle": "Alert",
190
188
  "okButtonLabel": "Ok",
191
189
  "cancelButtonLabel": "Cancel",
192
190
  "designAreaControlBox": {
@@ -415,6 +413,10 @@
415
413
  "okButton": "Ok",
416
414
  "cancelButton": "Cancel",
417
415
  "rules": {
416
+ "itemattributematch": {
417
+ "text": "The selection does not match the following parts in the configuration.",
418
+ "resolveText": "These options will be removed:"
419
+ },
418
420
  "optionexclusion": {
419
421
  "text": "The selection does not match the following parts in the configuration.",
420
422
  "resolveText": "These options will be removed:"
@@ -15,6 +15,7 @@ import Button from '@material-ui/core/Button';
15
15
  import MainButton from 'Shared/Components/MainButton';
16
16
  import { Services } from 'App/ServiceLocator';
17
17
  import withWidth, { isWidthDown } from '@material-ui/core/withWidth/withWidth';
18
+ import { getConf } from '../../../../configuration';
18
19
 
19
20
  const styles = theme => ({
20
21
  imagePreview: {
@@ -208,7 +209,7 @@ class ImageEditDialog extends React.Component {
208
209
 
209
210
  const extension = file.name.toLowerCase().match(/\.([0-9a-z]+)$/i)[1];
210
211
 
211
- const allowedFormats = ['jpg', 'jpeg', 'svg', 'png', 'pdf', 'bmp', 'tif', 'eps', 'ai', 'gif'];
212
+ const allowedFormats = getConf('designer.allowedImageUploadFormats');
212
213
 
213
214
  if (allowedFormats.indexOf(extension) === -1) {
214
215
  error = t('fileUpload.uploadFormatError', { formats: allowedFormats.join(', ').toUpperCase() });
@@ -221,8 +222,8 @@ class ImageEditDialog extends React.Component {
221
222
  error,
222
223
  imageData: null,
223
224
  });
224
- const renderabelFormats = ['jpg', 'jpeg', 'svg', 'png', 'bmp', 'tif', 'gif'];
225
- const isRenderable = renderabelFormats.indexOf(extension) !== -1;
225
+ const renderableFormats = ['jpg', 'jpeg', 'svg', 'png', 'bmp', 'gif'];
226
+ const isRenderable = renderableFormats.indexOf(extension) !== -1;
226
227
  if (isRenderable && file.type && file.type.match('image.*')) {
227
228
  const reader = new FileReader();
228
229
  reader.onload = e => {
@@ -133,7 +133,11 @@ export function imageGalleryReducer(state = initialState, action = {}) {
133
133
  selectedImage: currentImage,
134
134
  };
135
135
  } else {
136
- Object.assign(currentImage, selectedImage);
136
+ const idx = userImages.indexOf(currentImage);
137
+ userImages[idx] = {
138
+ ...currentImage,
139
+ ...selectedImage,
140
+ };
137
141
  return {
138
142
  ...state,
139
143
  userImages,
@@ -36,11 +36,18 @@ import { createTextPlaceholder } from '../Reducers/ImageGallery/Modifiers';
36
36
  import { updateLinkedImagesWithImageData } from '../Reducers/DesignData/Actions';
37
37
  import { checkDesignElementRestrictions } from '../Reducers/DesignArea/DesignElementSelectors';
38
38
 
39
+ function getCanvasImageScalingWithImageData(canvasImage, imageData) {
40
+ const currentPreview = canvasImage.imageData.preview;
41
+ const nextPreview = imageData.preview;
42
+ return canvasImage.scaling * (currentPreview.width / nextPreview.width);
43
+ }
44
+
39
45
  function updateCanvasImageWithImageData(canvasImage, imageData) {
40
46
  return canvasImage.updateOptions(
41
47
  prepareImageObjectData({
42
48
  imageData,
43
49
  src: `${getConf('network.host')}${imageData.preview.url}`,
50
+ scaling: getCanvasImageScalingWithImageData(canvasImage, imageData),
44
51
  })
45
52
  );
46
53
  }
@@ -13,7 +13,7 @@ const DEVELOPMENT_HOST_LOCAL = 'http://localhost:10030';
13
13
 
14
14
  const hostsByNodeEnv = {
15
15
  production: '',
16
- development: DEVELOPMENT_HOST_INT,
16
+ development: DEVELOPMENT_HOST_LOCAL,
17
17
  test: '',
18
18
  };
19
19
 
@@ -186,6 +186,20 @@ let applicationConfiguration = {
186
186
  designer: {
187
187
  dpi: 300, // the default canvas dpi as project specific option
188
188
  maxColorAmount: 10, // the default max number of colors in the colorizing feature
189
+ allowedImageUploadFormats: [
190
+ // the image formats users can upload to designareas / designer items
191
+ 'jpg',
192
+ 'jpeg',
193
+ 'svg',
194
+ 'png',
195
+ 'pdf',
196
+ 'bmp',
197
+ 'tif',
198
+ 'tiff',
199
+ 'eps',
200
+ 'ai',
201
+ 'gif',
202
+ ],
189
203
  },
190
204
 
191
205
  vectorizeImageQuality: 45000,