@onehat/ui 0.4.112 → 0.4.113
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/package.json
CHANGED
|
@@ -38,6 +38,7 @@ export default function withSecondaryEditor(WrappedComponent, isTree = false) {
|
|
|
38
38
|
secondaryDisableDelete = false,
|
|
39
39
|
secondaryDisableDuplicate = false,
|
|
40
40
|
secondaryDisableView = false,
|
|
41
|
+
secondaryWaitWhileSaving = false, // when true, show global wait modal while doEditorSave is in-flight
|
|
41
42
|
secondaryUseRemoteDuplicate = false, // call specific copyToNew function on server, rather than simple duplicate on client
|
|
42
43
|
secondaryGetRecordIdentifier = (secondarySelection) => {
|
|
43
44
|
if (secondarySelection.length > 1) {
|
|
@@ -558,16 +559,24 @@ export default function withSecondaryEditor(WrappedComponent, isTree = false) {
|
|
|
558
559
|
}
|
|
559
560
|
|
|
560
561
|
setIsSaving(true);
|
|
562
|
+
if (secondaryWaitWhileSaving) {
|
|
563
|
+
setIsWaitModalShown(true);
|
|
564
|
+
}
|
|
561
565
|
let success = true;
|
|
562
566
|
const tempListener = (msg, data) => {
|
|
563
567
|
success = { msg, data };
|
|
564
568
|
};
|
|
565
569
|
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
570
|
+
try {
|
|
571
|
+
SecondaryRepository.on('error', tempListener); // add a temporary listener for the error event
|
|
572
|
+
await SecondaryRepository.save(null, useStaged);
|
|
573
|
+
} finally {
|
|
574
|
+
SecondaryRepository.off('error', tempListener); // remove the temporary listener
|
|
575
|
+
setIsSaving(false);
|
|
576
|
+
if (secondaryWaitWhileSaving) {
|
|
577
|
+
setIsWaitModalShown(false);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
571
580
|
|
|
572
581
|
if (_.isBoolean(success) && success) {
|
|
573
582
|
if (secondaryOnChange) {
|
|
@@ -39,6 +39,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
|
|
|
39
39
|
enableMultiDelete = false, // deleting multiple records at once is opt-in only
|
|
40
40
|
disableDuplicate = false,
|
|
41
41
|
disableView = false,
|
|
42
|
+
waitWhileSaving = false, // when true, show global wait modal while doEditorSave is in-flight
|
|
42
43
|
useRemoteDuplicate = false, // call specific copyToNew function on server, rather than simple duplicate on client
|
|
43
44
|
getDuplicateValues, // fn(entity) to get default values for duplication
|
|
44
45
|
getRecordIdentifier = (selection) => {
|
|
@@ -716,16 +717,24 @@ export default function withEditor(WrappedComponent, isTree = false) {
|
|
|
716
717
|
}
|
|
717
718
|
|
|
718
719
|
setIsSaving(true);
|
|
720
|
+
if (waitWhileSaving) {
|
|
721
|
+
setIsWaitModalShown(true);
|
|
722
|
+
}
|
|
719
723
|
let success = true;
|
|
720
724
|
const tempListener = (msg, data) => {
|
|
721
725
|
success = false;
|
|
722
726
|
};
|
|
723
727
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
728
|
+
try {
|
|
729
|
+
Repository.on('error', tempListener); // add a temporary listener for the error event
|
|
730
|
+
await Repository.save(null, useStaged);
|
|
731
|
+
} finally {
|
|
732
|
+
Repository.off('error', tempListener); // remove the temporary listener
|
|
733
|
+
setIsSaving(false);
|
|
734
|
+
if (waitWhileSaving) {
|
|
735
|
+
setIsWaitModalShown(false);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
729
738
|
|
|
730
739
|
if (_.isBoolean(success) && success) {
|
|
731
740
|
if (onChange) {
|