@abidibo/react-cam-roi 0.7.0 → 0.8.1

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/dist/index.esm.js CHANGED
@@ -1689,7 +1689,7 @@ var TopBar = function () {
1689
1689
  // https://github.com/n-mazaheri/image-editor
1690
1690
  var RoiEditor = function (_a) {
1691
1691
  var _b, _c, _d, _e, _f;
1692
- var imageUrl = _a.imageUrl, configuration = _a.configuration, onSubmit = _a.onSubmit, onUpdate = _a.onUpdate, initialData = _a.initialData, editorId = _a.editorId;
1692
+ var imageUrl = _a.imageUrl, configuration = _a.configuration, onSubmit = _a.onSubmit, onUpdate = _a.onUpdate, initialData = _a.initialData, editorId = _a.editorId, allowPartialSave = _a.allowPartialSave;
1693
1693
  log('info', true, 'react-cam-roi', 'React', React);
1694
1694
  var firstUpdate = useRef(0);
1695
1695
  var canvasRef = useRef(null);
@@ -1763,14 +1763,16 @@ var RoiEditor = function (_a) {
1763
1763
  }, [metadata, shapes, onUpdate, prepareOutput]);
1764
1764
  var handleSubmit = useCallback(function () {
1765
1765
  var _a = validate(configuration, presetName, shapes, metadata, strings), isValid = _a[0], errors = _a[1];
1766
- console.log('CAZZ', errors, presetName);
1767
1766
  if (isValid) {
1768
1767
  onSubmit(prepareOutput(metadata, shapes, presetName, presetDescription));
1769
1768
  }
1769
+ else if (allowPartialSave) {
1770
+ onSubmit(__assign(__assign({}, prepareOutput(metadata, shapes, presetName, presetDescription)), { errors: errors }));
1771
+ }
1770
1772
  else {
1771
1773
  notify.error(strings.invalidSubmission + '\n' + errors.map(function (e) { return "- ".concat(e); }).join('\n'));
1772
1774
  }
1773
- }, [onSubmit, configuration, shapes, metadata, prepareOutput, strings, notify, presetName]);
1775
+ }, [onSubmit, configuration, shapes, metadata, prepareOutput, strings, notify, presetName, presetDescription]);
1774
1776
  log('info', enableLogs, 'react-cam-roi', 'active tool', activeTool);
1775
1777
  log('info', enableLogs, 'react-cam-roi', 'canvas size', canvasSize);
1776
1778
  log('info', enableLogs, 'react-cam-roi', 'metadata', metadata);