@azrico/webobject 1.3.15 → 1.3.16
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.
|
@@ -410,9 +410,10 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
410
410
|
value: function () {
|
|
411
411
|
var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
412
412
|
var _this3 = this,
|
|
413
|
-
_this$
|
|
413
|
+
_this$manager4;
|
|
414
414
|
var srObject,
|
|
415
415
|
actual_sr,
|
|
416
|
+
_this$manager3,
|
|
416
417
|
_len3,
|
|
417
418
|
p,
|
|
418
419
|
_key3,
|
|
@@ -420,36 +421,45 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
420
421
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
421
422
|
while (1) switch (_context8.prev = _context8.next) {
|
|
422
423
|
case 0:
|
|
423
|
-
if (this.isSaved) {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
this._index_value = Number(srObject._index_value);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
424
|
+
if (!this.isSaved) {
|
|
425
|
+
_context8.next = 10;
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
this.apply_changes();
|
|
429
|
+
srObject = this.getSaveResult(true);
|
|
430
|
+
if (!(srObject != null)) {
|
|
431
|
+
_context8.next = 10;
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
//we may have some extra data in the save result.
|
|
435
|
+
//try to find the main data
|
|
436
|
+
if (Array.isArray(srObject)) {
|
|
437
|
+
actual_sr = srObject.find(function (s) {
|
|
438
|
+
return _classPrivateMethodGet(_this3, _isValidSR, _isValidSR2).call(_this3, s);
|
|
439
|
+
});
|
|
440
|
+
if (actual_sr) srObject = actual_sr;
|
|
444
441
|
}
|
|
442
|
+
if (!_classPrivateMethodGet(this, _isValidSR, _isValidSR2).call(this, srObject)) {
|
|
443
|
+
_context8.next = 10;
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
if (srObject.insertedId || srObject._id) {
|
|
447
|
+
this._id = srObject.insertedId || srObject._id;
|
|
448
|
+
}
|
|
449
|
+
if (srObject._index_value && !Number.isNaN(srObject._index_value)) {
|
|
450
|
+
this._index_value = Number(srObject._index_value);
|
|
451
|
+
}
|
|
452
|
+
_context8.next = 10;
|
|
453
|
+
return (_this$manager3 = this.manager) === null || _this$manager3 === void 0 ? void 0 : _this$manager3.event_run("on_id_change");
|
|
454
|
+
case 10:
|
|
445
455
|
for (_len3 = _args8.length, p = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
446
456
|
p[_key3] = _args8[_key3];
|
|
447
457
|
}
|
|
448
|
-
_context8.next =
|
|
449
|
-
return (_this$
|
|
450
|
-
case
|
|
458
|
+
_context8.next = 13;
|
|
459
|
+
return (_this$manager4 = this.manager) === null || _this$manager4 === void 0 ? void 0 : _this$manager4.onSave.apply(_this$manager4, p);
|
|
460
|
+
case 13:
|
|
451
461
|
return _context8.abrupt("return", _context8.sent);
|
|
452
|
-
case
|
|
462
|
+
case 14:
|
|
453
463
|
case "end":
|
|
454
464
|
return _context8.stop();
|
|
455
465
|
}
|
|
@@ -464,7 +474,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
464
474
|
key: "onNew",
|
|
465
475
|
value: function () {
|
|
466
476
|
var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
467
|
-
var _this$
|
|
477
|
+
var _this$manager5;
|
|
468
478
|
var _len4,
|
|
469
479
|
p,
|
|
470
480
|
_key4,
|
|
@@ -476,7 +486,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
476
486
|
p[_key4] = _args9[_key4];
|
|
477
487
|
}
|
|
478
488
|
_context9.next = 3;
|
|
479
|
-
return (_this$
|
|
489
|
+
return (_this$manager5 = this.manager) === null || _this$manager5 === void 0 ? void 0 : _this$manager5.onNew.apply(_this$manager5, p);
|
|
480
490
|
case 3:
|
|
481
491
|
return _context9.abrupt("return", _context9.sent);
|
|
482
492
|
case 4:
|
|
@@ -315,10 +315,13 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
|
|
|
315
315
|
return this.event_run("on_after_load");
|
|
316
316
|
case 7:
|
|
317
317
|
_context7.next = 9;
|
|
318
|
-
return
|
|
318
|
+
return this.event_run("on_load_finished");
|
|
319
319
|
case 9:
|
|
320
|
+
_context7.next = 11;
|
|
321
|
+
return Promise.resolve(true);
|
|
322
|
+
case 11:
|
|
320
323
|
return _context7.abrupt("return", _context7.sent);
|
|
321
|
-
case
|
|
324
|
+
case 12:
|
|
322
325
|
case "end":
|
|
323
326
|
return _context7.stop();
|
|
324
327
|
}
|
|
@@ -351,10 +354,13 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
|
|
|
351
354
|
return this.event_run("on_after_save");
|
|
352
355
|
case 6:
|
|
353
356
|
_context8.next = 8;
|
|
354
|
-
return
|
|
357
|
+
return this.event_run("on_save_finished");
|
|
355
358
|
case 8:
|
|
359
|
+
_context8.next = 10;
|
|
360
|
+
return Promise.resolve(true);
|
|
361
|
+
case 10:
|
|
356
362
|
return _context8.abrupt("return", _context8.sent);
|
|
357
|
-
case
|
|
363
|
+
case 11:
|
|
358
364
|
case "end":
|
|
359
365
|
return _context8.stop();
|
|
360
366
|
}
|