@mcurros2/microm 1.1.93-0 → 1.1.95-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.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -64
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -194,7 +194,7 @@ const $8b0c683387a5432f$export$659b17aab7c47d60 = {
|
|
|
194
194
|
cancelSaveOnUnmount: true
|
|
195
195
|
};
|
|
196
196
|
function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
|
|
197
|
-
const { entity: entity, initialFormMode: initialFormMode, validateInputOnBlur: validateInputOnBlur, validateInputOnChange: validateInputOnChange, onSaved: onSaved, onCancel: onCancel, getDataOnInit: getDataOnInit, forceDirty: forceDirty, initialShowDescriptionInFields: initialShowDescriptionInFields, saveAndGetOverride: saveAndGetOverride, noSaveOnSubmit: noSaveOnSubmit, bindedColumnNames: bindedColumnNames, saveAndGetOnSubmit: saveAndGetOnSubmit, cancelGetOnUnmount: cancelGetOnUnmount, cancelSaveOnUnmount: cancelSaveOnUnmount } = (0, $b4te3$mantinecore.useComponentDefaultProps)("", $8b0c683387a5432f$export$659b17aab7c47d60, props);
|
|
197
|
+
const { entity: entity, initialFormMode: initialFormMode, validateInputOnBlur: validateInputOnBlur, validateInputOnChange: validateInputOnChange, onSaved: onSaved, onCancel: onCancel, getDataOnInit: getDataOnInit, forceDirty: forceDirty, initialShowDescriptionInFields: initialShowDescriptionInFields, saveAndGetOverride: saveAndGetOverride, noSaveOnSubmit: noSaveOnSubmit, bindedColumnNames: bindedColumnNames, saveAndGetOnSubmit: saveAndGetOnSubmit, cancelGetOnUnmount: cancelGetOnUnmount, cancelSaveOnUnmount: cancelSaveOnUnmount, saveBeforeLocalNavigation: saveBeforeLocalNavigation, saveBeforeRemoteNavigation: saveBeforeRemoteNavigation } = (0, $b4te3$mantinecore.useComponentDefaultProps)("", $8b0c683387a5432f$export$659b17aab7c47d60, props);
|
|
198
198
|
const [status, setStatus] = (0, $b4te3$react.useState)({}); // Initial queryStatus is empty on purpose to not disable fields before data is loaded
|
|
199
199
|
const notifyValidationErrorState = (0, $b4te3$react.useState)(false);
|
|
200
200
|
const [, setNotifyValidationError] = notifyValidationErrorState;
|
|
@@ -457,6 +457,48 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
|
|
|
457
457
|
}, [
|
|
458
458
|
initialFormMode
|
|
459
459
|
]);
|
|
460
|
+
// save before navigation
|
|
461
|
+
(0, $b4te3$react.useEffect)(()=>{
|
|
462
|
+
const handleBeforeUnload = ()=>$8b0c683387a5432f$var$__awaiter(this, void 0, void 0, function*() {
|
|
463
|
+
try {
|
|
464
|
+
if (saveBeforeRemoteNavigation) {
|
|
465
|
+
form.validate();
|
|
466
|
+
yield saveAndGet();
|
|
467
|
+
}
|
|
468
|
+
} catch (ex) {
|
|
469
|
+
console.error("SaveBeforeRemoteNavigation", ex);
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
473
|
+
return ()=>{
|
|
474
|
+
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
475
|
+
};
|
|
476
|
+
}, [
|
|
477
|
+
form,
|
|
478
|
+
saveAndGet,
|
|
479
|
+
saveBeforeRemoteNavigation
|
|
480
|
+
]);
|
|
481
|
+
const prevLocationRef = (0, $b4te3$react.useRef)(window.location.hash);
|
|
482
|
+
(0, $b4te3$react.useEffect)(()=>{
|
|
483
|
+
const handleLocalNavigation = ()=>$8b0c683387a5432f$var$__awaiter(this, void 0, void 0, function*() {
|
|
484
|
+
try {
|
|
485
|
+
if (saveBeforeLocalNavigation && prevLocationRef.current !== window.location.hash) {
|
|
486
|
+
form.validate();
|
|
487
|
+
yield saveAndGet();
|
|
488
|
+
}
|
|
489
|
+
} catch (ex) {
|
|
490
|
+
console.error("SaveBeforeLocalNavigation", ex);
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
window.addEventListener("hashchange", handleLocalNavigation);
|
|
494
|
+
return ()=>{
|
|
495
|
+
window.removeEventListener("hashchange", handleLocalNavigation);
|
|
496
|
+
};
|
|
497
|
+
}, [
|
|
498
|
+
form,
|
|
499
|
+
saveAndGet,
|
|
500
|
+
saveBeforeLocalNavigation
|
|
501
|
+
]);
|
|
460
502
|
const result = (0, $b4te3$react.useMemo)(()=>({
|
|
461
503
|
form: form,
|
|
462
504
|
formMode: formMode,
|
|
@@ -47831,33 +47873,6 @@ $parcel$export(module.exports, "EntityFormPage", function () { return $637861954
|
|
|
47831
47873
|
|
|
47832
47874
|
parcelRequire("7xGLy");
|
|
47833
47875
|
var $gYKfx = parcelRequire("gYKfx");
|
|
47834
|
-
var $637861954d3d6876$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
47835
|
-
function adopt(value) {
|
|
47836
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
47837
|
-
resolve(value);
|
|
47838
|
-
});
|
|
47839
|
-
}
|
|
47840
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
47841
|
-
function fulfilled(value) {
|
|
47842
|
-
try {
|
|
47843
|
-
step(generator.next(value));
|
|
47844
|
-
} catch (e) {
|
|
47845
|
-
reject(e);
|
|
47846
|
-
}
|
|
47847
|
-
}
|
|
47848
|
-
function rejected(value) {
|
|
47849
|
-
try {
|
|
47850
|
-
step(generator["throw"](value));
|
|
47851
|
-
} catch (e) {
|
|
47852
|
-
reject(e);
|
|
47853
|
-
}
|
|
47854
|
-
}
|
|
47855
|
-
function step(result) {
|
|
47856
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
47857
|
-
}
|
|
47858
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47859
|
-
});
|
|
47860
|
-
};
|
|
47861
47876
|
var $637861954d3d6876$var$__rest = undefined && undefined.__rest || function(s, e) {
|
|
47862
47877
|
var t = {};
|
|
47863
47878
|
for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -47871,12 +47886,10 @@ const $637861954d3d6876$export$e73f1d9fe021a92b = {
|
|
|
47871
47886
|
defaultLoadingComponent: (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Skeleton), {})
|
|
47872
47887
|
};
|
|
47873
47888
|
function $637861954d3d6876$export$bf63b1212bff1393(props) {
|
|
47874
|
-
const _a = (0, $b4te3$mantinecore.useComponentDefaultProps)("EntityFormPage", $637861954d3d6876$export$e73f1d9fe021a92b, props), { entityConstructor: entityConstructor, client: client, defaultLoadingComponent: defaultLoadingComponent
|
|
47889
|
+
const _a = (0, $b4te3$mantinecore.useComponentDefaultProps)("EntityFormPage", $637861954d3d6876$export$e73f1d9fe021a92b, props), { entityConstructor: entityConstructor, client: client, defaultLoadingComponent: defaultLoadingComponent } = _a, rest = $637861954d3d6876$var$__rest(_a, [
|
|
47875
47890
|
"entityConstructor",
|
|
47876
47891
|
"client",
|
|
47877
|
-
"defaultLoadingComponent"
|
|
47878
|
-
"saveBeforeLocalNavigation",
|
|
47879
|
-
"saveBeforeRemoteNavigation"
|
|
47892
|
+
"defaultLoadingComponent"
|
|
47880
47893
|
]);
|
|
47881
47894
|
const [entityForm, setEntityForm] = (0, $b4te3$react.useState)(null);
|
|
47882
47895
|
const entityRef = (0, $b4te3$react.useRef)(null);
|
|
@@ -47897,38 +47910,6 @@ function $637861954d3d6876$export$bf63b1212bff1393(props) {
|
|
|
47897
47910
|
client,
|
|
47898
47911
|
entityConstructor
|
|
47899
47912
|
]);
|
|
47900
|
-
// save before navigation
|
|
47901
|
-
(0, $b4te3$react.useEffect)(()=>{
|
|
47902
|
-
const handleBeforeUnload = ()=>$637861954d3d6876$var$__awaiter(this, void 0, void 0, function*() {
|
|
47903
|
-
try {
|
|
47904
|
-
if (saveBeforeRemoteNavigation && entityRef.current) yield entityRef.current.API.editData();
|
|
47905
|
-
} catch (ex) {
|
|
47906
|
-
console.error("SaveBeforeRemoteNavigation", ex);
|
|
47907
|
-
}
|
|
47908
|
-
});
|
|
47909
|
-
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
47910
|
-
return ()=>{
|
|
47911
|
-
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
47912
|
-
};
|
|
47913
|
-
}, [
|
|
47914
|
-
saveBeforeRemoteNavigation
|
|
47915
|
-
]);
|
|
47916
|
-
const prevLocationRef = (0, $b4te3$react.useRef)(window.location.hash);
|
|
47917
|
-
(0, $b4te3$react.useEffect)(()=>{
|
|
47918
|
-
const handleLocalNavigation = ()=>$637861954d3d6876$var$__awaiter(this, void 0, void 0, function*() {
|
|
47919
|
-
try {
|
|
47920
|
-
if (saveBeforeLocalNavigation && entityRef.current && prevLocationRef.current !== window.location.hash) yield entityRef.current.API.editData();
|
|
47921
|
-
} catch (ex) {
|
|
47922
|
-
console.error("SaveBeforeLocalNavigation", ex);
|
|
47923
|
-
}
|
|
47924
|
-
});
|
|
47925
|
-
window.addEventListener("hashchange", handleLocalNavigation);
|
|
47926
|
-
return ()=>{
|
|
47927
|
-
window.removeEventListener("hashchange", handleLocalNavigation);
|
|
47928
|
-
};
|
|
47929
|
-
}, [
|
|
47930
|
-
saveBeforeLocalNavigation
|
|
47931
|
-
]);
|
|
47932
47913
|
return (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$reactjsxruntime.Fragment), {
|
|
47933
47914
|
children: entityForm || defaultLoadingComponent
|
|
47934
47915
|
});
|