@mcurros2/microm 1.1.107-0 → 1.1.109-0

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.js CHANGED
@@ -430,6 +430,17 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
430
430
  const removeValidation = (0, $b4te3$react.useCallback)((column)=>{
431
431
  delete validationObject.current[column.name];
432
432
  }, []);
433
+ const silentSave = (0, $b4te3$react.useCallback)(()=>$8b0c683387a5432f$var$__awaiter(this, void 0, void 0, function*() {
434
+ try {
435
+ form.validate();
436
+ if (!(0, $iKzSR.areValuesObjectsEqual)(form.values, lastGetValues.current)) yield saveAndGet();
437
+ } catch (ex) {
438
+ console.error("SilentSave", ex);
439
+ }
440
+ }), [
441
+ form,
442
+ saveAndGet
443
+ ]);
433
444
  // getDataOnInit
434
445
  (0, $b4te3$react.useEffect)(()=>{
435
446
  const cancellation = getAbortController.current;
@@ -466,35 +477,21 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
466
477
  // save before navigation
467
478
  (0, $b4te3$react.useEffect)(()=>{
468
479
  const handleBeforeUnload = ()=>$8b0c683387a5432f$var$__awaiter(this, void 0, void 0, function*() {
469
- try {
470
- if (saveBeforeRemoteNavigation) {
471
- form.validate();
472
- if (!(0, $iKzSR.areValuesObjectsEqual)(form.values, lastGetValues.current)) yield saveAndGet();
473
- }
474
- } catch (ex) {
475
- console.error("SaveBeforeRemoteNavigation", ex);
476
- }
480
+ if (saveBeforeRemoteNavigation) yield silentSave();
477
481
  });
478
482
  window.addEventListener("beforeunload", handleBeforeUnload);
479
483
  return ()=>{
480
484
  window.removeEventListener("beforeunload", handleBeforeUnload);
481
485
  };
482
486
  }, [
483
- form,
484
- saveAndGet,
485
- saveBeforeRemoteNavigation
487
+ saveBeforeRemoteNavigation,
488
+ silentSave
486
489
  ]);
487
490
  const prevLocationRef = (0, $b4te3$react.useRef)(window.location.hash);
491
+ // savew before local navigation
488
492
  (0, $b4te3$react.useEffect)(()=>{
489
493
  const handleLocalNavigation = ()=>$8b0c683387a5432f$var$__awaiter(this, void 0, void 0, function*() {
490
- try {
491
- if (saveBeforeLocalNavigation && form.isDirty() && prevLocationRef.current !== window.location.hash) {
492
- form.validate();
493
- if (!(0, $iKzSR.areValuesObjectsEqual)(form.values, lastGetValues.current)) yield saveAndGet();
494
- }
495
- } catch (ex) {
496
- console.error("SaveBeforeLocalNavigation", ex);
497
- }
494
+ if (saveBeforeLocalNavigation && form.isDirty() && prevLocationRef.current !== window.location.hash) yield silentSave();
498
495
  });
499
496
  window.addEventListener("hashchange", handleLocalNavigation);
500
497
  return ()=>{
@@ -502,8 +499,8 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
502
499
  };
503
500
  }, [
504
501
  form,
505
- saveAndGet,
506
- saveBeforeLocalNavigation
502
+ saveBeforeLocalNavigation,
503
+ silentSave
507
504
  ]);
508
505
  const result = (0, $b4te3$react.useMemo)(()=>({
509
506
  form: form,
@@ -523,7 +520,8 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
523
520
  clearAsyncError: clearAsyncError,
524
521
  clearAllAsyncErrors: clearAllAsyncErrors,
525
522
  isFormValid: isFormValid,
526
- isFormFieldValid: isFormFieldValid
523
+ isFormFieldValid: isFormFieldValid,
524
+ silentSave: silentSave
527
525
  }), [
528
526
  addValidation,
529
527
  clearAllAsyncErrors,
@@ -542,7 +540,8 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
542
540
  saveAndGetOverride,
543
541
  setAsyncError,
544
542
  showDescriptionState,
545
- status
543
+ status,
544
+ silentSave
546
545
  ]);
547
546
  return result;
548
547
  }
@@ -3493,6 +3492,8 @@ var $8tnwL = parcelRequire("8tnwL");
3493
3492
  var $8SZSR = parcelRequire("8SZSR");
3494
3493
 
3495
3494
  var $lwxCY = parcelRequire("lwxCY");
3495
+
3496
+ var $4Hta3 = parcelRequire("4Hta3");
3496
3497
  $parcel$exportWildcard(module.exports, $d50o9);
3497
3498
  $parcel$exportWildcard(module.exports, $i6yJ4);
3498
3499
  $parcel$exportWildcard(module.exports, $gLcPf);
@@ -3562,6 +3563,7 @@ $parcel$exportWildcard(module.exports, $jNUqj);
3562
3563
  $parcel$exportWildcard(module.exports, $8tnwL);
3563
3564
  $parcel$exportWildcard(module.exports, $8SZSR);
3564
3565
  $parcel$exportWildcard(module.exports, $lwxCY);
3566
+ $parcel$exportWildcard(module.exports, $4Hta3);
3565
3567
 
3566
3568
  });
3567
3569
  parcelRegister("d50o9", function(module, exports) {
@@ -47941,6 +47943,31 @@ function $fab6abe4da65ff17$export$d994cf386c6f1d98(minSize = {
47941
47943
 
47942
47944
  });
47943
47945
 
47946
+ parcelRegister("4Hta3", function(module, exports) {
47947
+
47948
+ $parcel$export(module.exports, "useResponsiveWidth", function () { return $36c1cc5fa1af387c$export$7dfb35d99dc3ea4e; });
47949
+
47950
+
47951
+
47952
+ function $36c1cc5fa1af387c$export$7dfb35d99dc3ea4e(maxWidthRem, padding) {
47953
+ const viewportSize = (0, $b4te3$mantinehooks.useViewportSize)();
47954
+ const [width, setWidth] = (0, $b4te3$react.useState)(maxWidthRem);
47955
+ (0, $b4te3$react.useEffect)(()=>{
47956
+ const desiredWidth = (0, $b4te3$mantinecore.px)(maxWidthRem);
47957
+ const totalPadding = (0, $b4te3$mantinecore.px)(padding) * 2;
47958
+ const availableWidth = viewportSize.width - totalPadding;
47959
+ if (availableWidth < desiredWidth) setWidth((0, $b4te3$mantinecore.rem)(availableWidth));
47960
+ else setWidth(maxWidthRem);
47961
+ }, [
47962
+ maxWidthRem,
47963
+ padding,
47964
+ viewportSize.width
47965
+ ]);
47966
+ return width;
47967
+ }
47968
+
47969
+ });
47970
+
47944
47971
 
47945
47972
 
47946
47973
  parcelRegister("8xtCs", function(module, exports) {