@onehat/ui 0.3.219 → 0.3.221
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
|
@@ -298,7 +298,7 @@ export default function withSecondaryEditor(WrappedComponent, isTree = false) {
|
|
|
298
298
|
const
|
|
299
299
|
entity = secondarySelection[0],
|
|
300
300
|
idProperty = SecondaryRepository.getSchema().model.idProperty,
|
|
301
|
-
rawValues = _.omit(entity.
|
|
301
|
+
rawValues = _.omit(entity.getOriginalData(), idProperty),
|
|
302
302
|
duplicate = await SecondaryRepository.add(rawValues, false, true);
|
|
303
303
|
setSecondaryIsIgnoreNextSelectionChange(true);
|
|
304
304
|
secondarySetSelection([duplicate]);
|
|
@@ -302,7 +302,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
|
|
|
302
302
|
const
|
|
303
303
|
entity = selection[0],
|
|
304
304
|
idProperty = Repository.getSchema().model.idProperty,
|
|
305
|
-
rawValues = _.omit(entity.
|
|
305
|
+
rawValues = _.omit(entity.getOriginalData(), idProperty),
|
|
306
306
|
duplicate = await Repository.add(rawValues, false, true);
|
|
307
307
|
setIsIgnoreNextSelectionChange(true);
|
|
308
308
|
setSelection([duplicate]);
|
|
@@ -321,10 +321,17 @@ export default function withEditor(WrappedComponent, isTree = false) {
|
|
|
321
321
|
doEditorSave = async (data, e) => {
|
|
322
322
|
// NOTE: The Form submits onSave for both adds (when not isAutoSsave) and edits.
|
|
323
323
|
const isSingle = selection.length === 1;
|
|
324
|
+
let useStaged = false;
|
|
324
325
|
if (isSingle) {
|
|
325
326
|
// just update this one entity
|
|
326
327
|
selection[0].setValues(data);
|
|
327
328
|
|
|
329
|
+
// If this is a remote phantom, and nothing is dirty, stage it so it actually gets saved to server and solidified
|
|
330
|
+
if (selection[0].isRemotePhantom && !selection[0].isDirty) {
|
|
331
|
+
selection[0].markStaged();
|
|
332
|
+
useStaged = true;
|
|
333
|
+
}
|
|
334
|
+
|
|
328
335
|
} else if (selection.length > 1) {
|
|
329
336
|
// Edit multiple entities
|
|
330
337
|
|
|
@@ -349,7 +356,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
|
|
|
349
356
|
setIsSaving(true);
|
|
350
357
|
let success;
|
|
351
358
|
try {
|
|
352
|
-
await Repository.save();
|
|
359
|
+
await Repository.save(null, useStaged);
|
|
353
360
|
success = true;
|
|
354
361
|
} catch (e) {
|
|
355
362
|
// alert(e.context);
|