@configuratorware/configurator-admingui 1.57.1 → 1.57.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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.reportUnsavedEntity = exports.reportDeleteEntities = exports.releaseUnsavedEntity = exports.initUnsavedEntity = exports.generateListActions = exports.generateDeleteAction = exports.generateDefaultActions = exports.dataIsModified = exports.cancelUnsavedEntityDialog = exports.cancelDeleteEntitiesDialog = exports.UNMOUNT_ENTITY = exports.SHOW_DETAILS = exports.SET_VALIDATION_ERRORS = exports.SET_VALIDATED_DATA = exports.SET_DATA_SOURCE = exports.SET_DATA = exports.REPORT_UNSAVED_ENTITY = exports.REPORT_DELETE_ENTITIES = exports.RELEASE_UNSAVED_ENTITY = exports.MOUNT_NEXT = exports.MOUNT_ENTITY = exports.MODIFIED_UNSAVED_ENTITY = exports.INIT_UNSAVED_ENTITY = exports.HIDE_DETAILS = exports.ENTITY_WILL_UNMOUNT = exports.ENTITY_WILL_MOUNT = exports.CANCEL_UNSAVED_ENTITY_DIALOG = exports.CANCEL_DELETE_ENTITIES_DIALOG = void 0;
6
+ exports.reportUnsavedEntity = exports.reportDeleteEntities = exports.releaseUnsavedEntityBypassed = exports.releaseUnsavedEntity = exports.initUnsavedEntity = exports.generateListActions = exports.generateDeleteAction = exports.generateDefaultActions = exports.dataIsModified = exports.cancelUnsavedEntityDialog = exports.cancelDeleteEntitiesDialog = exports.UNMOUNT_ENTITY = exports.SHOW_DETAILS = exports.SET_VALIDATION_ERRORS = exports.SET_VALIDATED_DATA = exports.SET_DATA_SOURCE = exports.SET_DATA = exports.REPORT_UNSAVED_ENTITY = exports.REPORT_DELETE_ENTITIES = exports.RELEASE_UNSAVED_ENTITY = exports.MOUNT_NEXT = exports.MOUNT_ENTITY = exports.MODIFIED_UNSAVED_ENTITY = exports.INIT_UNSAVED_ENTITY = exports.HIDE_DETAILS = exports.ENTITY_WILL_UNMOUNT = exports.ENTITY_WILL_MOUNT = exports.CANCEL_UNSAVED_ENTITY_DIALOG = exports.CANCEL_DELETE_ENTITIES_DIALOG = void 0;
7
7
  var _Helpers = require("../Api/Helpers");
8
8
  var _get = _interopRequireDefault(require("lodash/get"));
9
9
  var _Actions = require("../Api/Actions");
@@ -55,6 +55,11 @@ var releaseUnsavedEntity = exports.releaseUnsavedEntity = function releaseUnsave
55
55
  });
56
56
  };
57
57
  };
58
+ var releaseUnsavedEntityBypassed = exports.releaseUnsavedEntityBypassed = function releaseUnsavedEntityBypassed() {
59
+ return {
60
+ type: RELEASE_UNSAVED_ENTITY
61
+ };
62
+ };
58
63
  var cancelUnsavedEntityDialog = exports.cancelUnsavedEntityDialog = function cancelUnsavedEntityDialog() {
59
64
  return {
60
65
  type: CANCEL_UNSAVED_ENTITY_DIALOG
@@ -358,8 +363,12 @@ var generateDefaultActions = exports.generateDefaultActions = function generateD
358
363
  };
359
364
  var detailsAction = function detailsAction(params) {
360
365
  return function (dispatch) {
366
+ var _keepMounted$params = _objectSpread({
367
+ keepMounted: false
368
+ }, params),
369
+ keepMounted = _keepMounted$params.keepMounted;
361
370
  return dispatch(triggerUnsavedEntity()).then(function () {
362
- dispatch(unmountEntity());
371
+ !keepMounted && dispatch(unmountEntity());
363
372
  dispatch(initUnsavedEntity(reducerName));
364
373
  dispatch((0, _Helpers.invalidateSource)(dataKey));
365
374
  return dispatch(loadEntity(params));
@@ -76,11 +76,12 @@ var createEntity = function createEntity() {
76
76
  };
77
77
  };
78
78
  var postData = function postData() {
79
+ var hideDetails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
79
80
  return function (dispatch, getState) {
80
81
  var _getState4 = getState(),
81
82
  designAreasData = _getState4.designAreasData;
82
83
  // to save uploaded images
83
- return dispatch(DesignAreaActions.postData(true)).then(function (res) {
84
+ return dispatch(DesignAreaActions.postData(hideDetails)).then(function (res) {
84
85
  var designAreaId = res.data.id;
85
86
  var files = designAreasData.data.designProductionMethods.value.map(function (dp) {
86
87
  return {
@@ -69,7 +69,11 @@ var applyLinks = exports.applyLinks = function applyLinks(prevData, nextData) {
69
69
  _options$baseShapePad = options.baseShapePadding,
70
70
  baseShapePadding = _options$baseShapePad === void 0 ? _Constants.DEFAULT_BASE_SHAPE_PADDING : _options$baseShapePad,
71
71
  _options$recalculateP = options.recalculatePosition,
72
- recalculatePosition = _options$recalculateP === void 0 ? true : _options$recalculateP;
72
+ recalculatePosition = _options$recalculateP === void 0 ? true : _options$recalculateP,
73
+ _options$heightRatio = options.heightRatio,
74
+ heightRatio = _options$heightRatio === void 0 ? 1 : _options$heightRatio,
75
+ _options$widthRatio = options.widthRatio,
76
+ widthRatio = _options$widthRatio === void 0 ? 1 : _options$widthRatio;
73
77
 
74
78
  // set min value for area size
75
79
  if ((0, _get["default"])(nextData, 'position.width') <= sizeMin) {
@@ -85,8 +89,12 @@ var applyLinks = exports.applyLinks = function applyLinks(prevData, nextData) {
85
89
  });
86
90
  }
87
91
  });
88
- if (positionRatio > 0 && Math.abs(nextData.baseShape.width / nextData.baseShape.height - positionRatio) > 0.01) {
89
- calcPathValue(nextData, 'baseShape.width', multiplyToPixel(positionRatio));
92
+ if (positionRatio > 0 && Math.abs(nextData.position.width / nextData.position.height - positionRatio) > 0.01) {
93
+ if (Math.abs(heightRatio - 1) > Math.abs(widthRatio - 1)) {
94
+ (0, _set["default"])(nextData, 'position.height', Math.ceil(nextData.position.width / positionRatio));
95
+ } else {
96
+ (0, _set["default"])(nextData, 'position.width', Math.ceil(nextData.position.height * positionRatio));
97
+ }
90
98
  }
91
99
  withRatio(prevData, nextData, 'baseShape.width', function (r) {
92
100
  calcPathValue(nextData, 'position.width', multiplyToPixel(r));
@@ -48,6 +48,7 @@ var _AreaEditorForm = _interopRequireDefault(require("../../Components/AreaEdito
48
48
  var _DesignAreaDimensionsEditor = _interopRequireDefault(require("../../Components/DesignAreaDimensionsEditor"));
49
49
  var _Actions2 = _interopRequireWildcard(require("../../../DesignAreas/Reducers/Actions"));
50
50
  var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
51
+ var _Actions3 = require("../../../../../../App/Reducers/Entity/Actions");
51
52
  var _excluded = ["classes", "onChange", "value"];
52
53
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
53
54
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
@@ -395,7 +396,9 @@ var VisualizationSettingsEdit = exports.VisualizationSettingsEdit = /*#__PURE__*
395
396
  height = _this$props$designAre.height;
396
397
  (0, _DataLinks.applyLinks)(previousData, nextData, {
397
398
  positionRatio: (width || 1) / (height || 1),
398
- recalculatePosition: isKindOf2D(_this.props.mode)
399
+ recalculatePosition: isKindOf2D(_this.props.mode),
400
+ heightRatio: customData.heightRatio,
401
+ widthRatio: customData.widthRatio
399
402
  });
400
403
  data.updateValues(nextData);
401
404
  if (data.validate()) {
@@ -473,6 +476,20 @@ var VisualizationSettingsEdit = exports.VisualizationSettingsEdit = /*#__PURE__*
473
476
  if (this.state.advancedMode !== prevState.advancedMode && this.baseShapeEditor) {
474
477
  this.baseShapeEditor.setAdvancedMode(this.state.advancedMode);
475
478
  }
479
+ if (prevProps.designArea && this.props.designArea !== prevProps.designArea) {
480
+ var _prevProps$designArea = prevProps.designArea,
481
+ prevWidth = _prevProps$designArea.width,
482
+ prevHeight = _prevProps$designArea.height;
483
+ var _this$props$designAre2 = this.props.designArea,
484
+ width = _this$props$designAre2.width,
485
+ height = _this$props$designAre2.height;
486
+ if (width !== prevWidth || height !== prevHeight) {
487
+ this.updateData({
488
+ heightRatio: height / prevHeight,
489
+ widthRatio: width / prevWidth
490
+ });
491
+ }
492
+ }
476
493
  }
477
494
  }, {
478
495
  key: "updateVisualization",
@@ -1104,12 +1121,14 @@ var StyledVisualizationSettingsEdit = exports.StyledVisualizationSettingsEdit =
1104
1121
  var ConnectedEdit = (0, _DefaultConnectedForm.connectDefault)(StyledVisualizationSettingsEdit, _Actions.REDUCER_NAME, _Actions["default"].setFieldData, _Actions["default"].postData, _Actions["default"].hideDetails);
1105
1122
  var _saveDesignAreaDimensions = function saveDesignAreaDimensions(designAreaId, width, height) {
1106
1123
  return function (dispatch, getState) {
1124
+ dispatch((0, _Actions3.releaseUnsavedEntityBypassed)());
1107
1125
  return dispatch(_Actions2["default"].detailsAction({
1108
- id: designAreaId
1126
+ id: designAreaId,
1127
+ showDetailsWhenLoaded: false
1109
1128
  })).then(function () {
1110
1129
  dispatch(_Actions2["default"].setFieldData('width', width));
1111
1130
  dispatch(_Actions2["default"].setFieldData('height', height));
1112
- return dispatch(_Actions2["default"].postData(true));
1131
+ return dispatch(_Actions2["default"].postData(false));
1113
1132
  }).then(function () {
1114
1133
  var savedDesignArea = (0, _get["default"])(getState(), "dataBySource.".concat(_Actions2.DATA_KEY, ".data"));
1115
1134
  if (!savedDesignArea) {
@@ -1133,8 +1152,10 @@ var _default = exports["default"] = (0, _reactRedux.connect)(function (state) {
1133
1152
  dispatch(function (dispatch, getState) {
1134
1153
  var designViewId = getState()[_Actions.REDUCER_NAME].data.id.value;
1135
1154
  dispatch(_Actions["default"].detailsAction({
1136
- id: designViewId
1155
+ id: designViewId,
1156
+ keepMounted: true
1137
1157
  }));
1158
+ dispatch((0, _Actions3.releaseUnsavedEntityBypassed)());
1138
1159
  });
1139
1160
  return savedDesignArea;
1140
1161
  });
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@configuratorware/configurator-admingui",
3
- "version": "1.57.1",
3
+ "version": "1.57.2",
4
4
  "license": "UNLICENSED",
5
5
  "private": false,
6
6
  "dependencies": {
7
7
  "@babel/polyfill": "^7.12.1",
8
- "@configuratorware/scripts": "1.57.1",
8
+ "@configuratorware/scripts": "1.57.2",
9
9
  "@material-ui/core": "^3.9.4",
10
10
  "@material-ui/icons": "^3.0.2",
11
11
  "@tweenjs/tween.js": "^17.6.0",
@@ -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.57.1",
32
+ "redhotmagma-visualization": "1.57.2",
33
33
  "redux": "^4.1.0",
34
34
  "redux-logger": "^3.0.6",
35
35
  "redux-persist": "^5.10.0",