@mcurros2/microm 1.1.91-0 → 1.1.92-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 +65 -37
- 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
|
|
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);
|
|
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,40 +457,6 @@ 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) yield entity.API.editData();
|
|
465
|
-
} catch (ex) {
|
|
466
|
-
console.error("SaveBeforeRemoteNavigation", ex);
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
470
|
-
return ()=>{
|
|
471
|
-
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
472
|
-
};
|
|
473
|
-
}, [
|
|
474
|
-
entity.API,
|
|
475
|
-
saveBeforeRemoteNavigation
|
|
476
|
-
]);
|
|
477
|
-
const prevLocationRef = (0, $b4te3$react.useRef)(window.location.hash);
|
|
478
|
-
(0, $b4te3$react.useEffect)(()=>{
|
|
479
|
-
const handleLocalNavigation = ()=>$8b0c683387a5432f$var$__awaiter(this, void 0, void 0, function*() {
|
|
480
|
-
try {
|
|
481
|
-
if (saveBeforeLocalNavigation && prevLocationRef.current !== window.location.hash) yield entity.API.editData();
|
|
482
|
-
} catch (ex) {
|
|
483
|
-
console.error("SaveBeforeRemoteNavigation", ex);
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
window.addEventListener("hashchange", handleLocalNavigation);
|
|
487
|
-
return ()=>{
|
|
488
|
-
window.removeEventListener("hashchange", handleLocalNavigation);
|
|
489
|
-
};
|
|
490
|
-
}, [
|
|
491
|
-
entity.API,
|
|
492
|
-
saveBeforeLocalNavigation
|
|
493
|
-
]);
|
|
494
460
|
const result = (0, $b4te3$react.useMemo)(()=>({
|
|
495
461
|
form: form,
|
|
496
462
|
formMode: formMode,
|
|
@@ -47865,6 +47831,33 @@ $parcel$export(module.exports, "EntityFormPage", function () { return $637861954
|
|
|
47865
47831
|
|
|
47866
47832
|
parcelRequire("7xGLy");
|
|
47867
47833
|
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
|
+
};
|
|
47868
47861
|
var $637861954d3d6876$var$__rest = undefined && undefined.__rest || function(s, e) {
|
|
47869
47862
|
var t = {};
|
|
47870
47863
|
for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -47878,13 +47871,16 @@ const $637861954d3d6876$export$e73f1d9fe021a92b = {
|
|
|
47878
47871
|
defaultLoadingComponent: (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Skeleton), {})
|
|
47879
47872
|
};
|
|
47880
47873
|
function $637861954d3d6876$export$bf63b1212bff1393(props) {
|
|
47881
|
-
const _a = (0, $b4te3$mantinecore.useComponentDefaultProps)("EntityFormPage", $637861954d3d6876$export$e73f1d9fe021a92b, props), { entityConstructor: entityConstructor, client: client, defaultLoadingComponent: defaultLoadingComponent } = _a, rest = $637861954d3d6876$var$__rest(_a, [
|
|
47874
|
+
const _a = (0, $b4te3$mantinecore.useComponentDefaultProps)("EntityFormPage", $637861954d3d6876$export$e73f1d9fe021a92b, props), { entityConstructor: entityConstructor, client: client, defaultLoadingComponent: defaultLoadingComponent, saveBeforeLocalNavigation: saveBeforeLocalNavigation, saveBeforeRemoteNavigation: saveBeforeRemoteNavigation } = _a, rest = $637861954d3d6876$var$__rest(_a, [
|
|
47882
47875
|
"entityConstructor",
|
|
47883
47876
|
"client",
|
|
47884
|
-
"defaultLoadingComponent"
|
|
47877
|
+
"defaultLoadingComponent",
|
|
47878
|
+
"saveBeforeLocalNavigation",
|
|
47879
|
+
"saveBeforeRemoteNavigation"
|
|
47885
47880
|
]);
|
|
47886
47881
|
const [entityForm, setEntityForm] = (0, $b4te3$react.useState)(null);
|
|
47887
47882
|
const entityRef = (0, $b4te3$react.useRef)(null);
|
|
47883
|
+
const entity = entityRef.current;
|
|
47888
47884
|
// MMC: note that rest properties are not used in the useEffect dependency array as using ...rest will create a new object on every render
|
|
47889
47885
|
(0, $b4te3$react.useEffect)(()=>{
|
|
47890
47886
|
if (!entityRef.current) entityRef.current = entityConstructor(client);
|
|
@@ -47902,6 +47898,38 @@ function $637861954d3d6876$export$bf63b1212bff1393(props) {
|
|
|
47902
47898
|
client,
|
|
47903
47899
|
entityConstructor
|
|
47904
47900
|
]);
|
|
47901
|
+
// save before navigation
|
|
47902
|
+
(0, $b4te3$react.useEffect)(()=>{
|
|
47903
|
+
const handleBeforeUnload = ()=>$637861954d3d6876$var$__awaiter(this, void 0, void 0, function*() {
|
|
47904
|
+
try {
|
|
47905
|
+
if (saveBeforeRemoteNavigation && entity) yield entity.API.editData();
|
|
47906
|
+
} catch (ex) {
|
|
47907
|
+
console.error("SaveBeforeRemoteNavigation", ex);
|
|
47908
|
+
}
|
|
47909
|
+
});
|
|
47910
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
47911
|
+
return ()=>{
|
|
47912
|
+
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
47913
|
+
};
|
|
47914
|
+
}, [
|
|
47915
|
+
saveBeforeRemoteNavigation
|
|
47916
|
+
]);
|
|
47917
|
+
const prevLocationRef = (0, $b4te3$react.useRef)(window.location.hash);
|
|
47918
|
+
(0, $b4te3$react.useEffect)(()=>{
|
|
47919
|
+
const handleLocalNavigation = ()=>$637861954d3d6876$var$__awaiter(this, void 0, void 0, function*() {
|
|
47920
|
+
try {
|
|
47921
|
+
if (saveBeforeLocalNavigation && entity && prevLocationRef.current !== window.location.hash) yield entity.API.editData();
|
|
47922
|
+
} catch (ex) {
|
|
47923
|
+
console.error("SaveBeforeLocalNavigation", ex);
|
|
47924
|
+
}
|
|
47925
|
+
});
|
|
47926
|
+
window.addEventListener("hashchange", handleLocalNavigation);
|
|
47927
|
+
return ()=>{
|
|
47928
|
+
window.removeEventListener("hashchange", handleLocalNavigation);
|
|
47929
|
+
};
|
|
47930
|
+
}, [
|
|
47931
|
+
saveBeforeLocalNavigation
|
|
47932
|
+
]);
|
|
47905
47933
|
return (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$reactjsxruntime.Fragment), {
|
|
47906
47934
|
children: entityForm || defaultLoadingComponent
|
|
47907
47935
|
});
|