@azrico/webobject 1.4.87 → 1.4.89
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/src/WebObjects/WebObject.d.ts +2 -0
- package/dist/src/WebObjects/WebObject.js +229 -179
- package/dist/src/WebObjects/WebObjectManager.d.ts +1 -0
- package/dist/src/WebObjects/WebObjectManager.js +56 -38
- package/dist/src/structs/SimpleObject.d.ts +1 -1
- package/dist/src/structs/SimpleObject.js +5 -0
- package/package.json +1 -1
|
@@ -62,6 +62,7 @@ export declare class WebObject extends SimpleObject {
|
|
|
62
62
|
}): Promise<boolean>;
|
|
63
63
|
Save(): Promise<any>;
|
|
64
64
|
Delete(): Promise<boolean>;
|
|
65
|
+
Archive(): Promise<boolean>;
|
|
65
66
|
canSave(deltaObj?: any): true | string;
|
|
66
67
|
canDelete(): boolean;
|
|
67
68
|
canArchive(): boolean;
|
|
@@ -78,6 +79,7 @@ export declare class WebObject extends SimpleObject {
|
|
|
78
79
|
get_webname(): string;
|
|
79
80
|
static get_webname(): string;
|
|
80
81
|
onDelete(...p: any): Promise<any>;
|
|
82
|
+
onArchive(...p: any): Promise<any>;
|
|
81
83
|
onLoad(...p: any): Promise<any>;
|
|
82
84
|
onSave(...p: any): Promise<any>;
|
|
83
85
|
onAfterSave(...p: any): Promise<any>;
|
|
@@ -34,7 +34,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
34
34
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
35
35
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
36
36
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
37
|
-
var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Delete, _get_deltaObject, _onDelete, _onLoad, _onSave, _onAfterSave, _onNew, _saveList, _get_single, _get_list) {
|
|
37
|
+
var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Delete, _Archive, _get_deltaObject, _onDelete, _onArchive, _onLoad, _onSave, _onAfterSave, _onNew, _saveList, _get_single, _get_list) {
|
|
38
38
|
_inherits(WebObject, _SimpleObject);
|
|
39
39
|
var _super = _createSuper(WebObject);
|
|
40
40
|
function WebObject() {
|
|
@@ -237,6 +237,29 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
237
237
|
}
|
|
238
238
|
}, _callee3, this);
|
|
239
239
|
}))).apply(this, arguments);
|
|
240
|
+
}
|
|
241
|
+
}, {
|
|
242
|
+
key: "Archive",
|
|
243
|
+
value: function Archive() {
|
|
244
|
+
return (_Archive = _Archive || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
245
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
246
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
247
|
+
case 0:
|
|
248
|
+
if (!(this.__throw_errors !== false)) {
|
|
249
|
+
_context4.next = 2;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
throw new Error("Archive not implented");
|
|
253
|
+
case 2:
|
|
254
|
+
WebObject.addError(this, "Archive not implented", "NOSAVE", true);
|
|
255
|
+
this.setSaveResult(false, "canceled");
|
|
256
|
+
return _context4.abrupt("return", false);
|
|
257
|
+
case 5:
|
|
258
|
+
case "end":
|
|
259
|
+
return _context4.stop();
|
|
260
|
+
}
|
|
261
|
+
}, _callee4, this);
|
|
262
|
+
}))).apply(this, arguments);
|
|
240
263
|
} /* -------------------------------------------------------------------------- */
|
|
241
264
|
}, {
|
|
242
265
|
key: "canSave",
|
|
@@ -268,74 +291,74 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
268
291
|
}, {
|
|
269
292
|
key: "get_deltaObject",
|
|
270
293
|
value: function get_deltaObject(_x3) {
|
|
271
|
-
return (_get_deltaObject = _get_deltaObject || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
294
|
+
return (_get_deltaObject = _get_deltaObject || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(p) {
|
|
272
295
|
var _this2 = this,
|
|
273
296
|
_parseObj;
|
|
274
297
|
var final_object, isChild, useDelta, allProperties, needId, chkChangables, useExtraProps, dlt, allkeys, changableKeys, functionProps, index, fp, parseObj, _iterator, _step, key, tempusers;
|
|
275
|
-
return _regeneratorRuntime().wrap(function
|
|
276
|
-
while (1) switch (
|
|
298
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
299
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
277
300
|
case 0:
|
|
278
301
|
parseObj = function _parseObj2(_x4) {
|
|
279
|
-
return (_parseObj = _parseObj || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
302
|
+
return (_parseObj = _parseObj || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(obj) {
|
|
280
303
|
var _ref;
|
|
281
304
|
var newobj_dlt;
|
|
282
|
-
return _regeneratorRuntime().wrap(function
|
|
283
|
-
while (1) switch (
|
|
305
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
306
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
284
307
|
case 0:
|
|
285
308
|
if (!(obj == null)) {
|
|
286
|
-
|
|
309
|
+
_context6.next = 2;
|
|
287
310
|
break;
|
|
288
311
|
}
|
|
289
|
-
return
|
|
312
|
+
return _context6.abrupt("return", undefined);
|
|
290
313
|
case 2:
|
|
291
314
|
if (!Array.isArray(obj)) {
|
|
292
|
-
|
|
315
|
+
_context6.next = 6;
|
|
293
316
|
break;
|
|
294
317
|
}
|
|
295
|
-
|
|
318
|
+
_context6.next = 5;
|
|
296
319
|
return Promise.all(obj.map(function (_x5) {
|
|
297
|
-
return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
298
|
-
return _regeneratorRuntime().wrap(function
|
|
299
|
-
while (1) switch (
|
|
320
|
+
return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(r) {
|
|
321
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
322
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
300
323
|
case 0:
|
|
301
|
-
|
|
324
|
+
_context5.next = 2;
|
|
302
325
|
return parseObj(r);
|
|
303
326
|
case 2:
|
|
304
|
-
return
|
|
327
|
+
return _context5.abrupt("return", _context5.sent);
|
|
305
328
|
case 3:
|
|
306
329
|
case "end":
|
|
307
|
-
return
|
|
330
|
+
return _context5.stop();
|
|
308
331
|
}
|
|
309
|
-
},
|
|
332
|
+
}, _callee5);
|
|
310
333
|
}))).apply(this, arguments);
|
|
311
334
|
}));
|
|
312
335
|
case 5:
|
|
313
|
-
return
|
|
336
|
+
return _context6.abrupt("return", _context6.sent);
|
|
314
337
|
case 6:
|
|
315
338
|
if (!(obj instanceof WebObject && typeof obj.get_deltaObject === "function")) {
|
|
316
|
-
|
|
339
|
+
_context6.next = 15;
|
|
317
340
|
break;
|
|
318
341
|
}
|
|
319
|
-
|
|
342
|
+
_context6.next = 9;
|
|
320
343
|
return obj.get_deltaObject(_objectSpread(_objectSpread({}, p), {}, {
|
|
321
344
|
isChild: true
|
|
322
345
|
}));
|
|
323
346
|
case 9:
|
|
324
|
-
newobj_dlt =
|
|
347
|
+
newobj_dlt = _context6.sent;
|
|
325
348
|
if ((0, _object.object_isEmpty)(newobj_dlt)) {
|
|
326
|
-
|
|
349
|
+
_context6.next = 14;
|
|
327
350
|
break;
|
|
328
351
|
}
|
|
329
|
-
return
|
|
352
|
+
return _context6.abrupt("return", newobj_dlt);
|
|
330
353
|
case 14:
|
|
331
|
-
return
|
|
354
|
+
return _context6.abrupt("return", obj);
|
|
332
355
|
case 15:
|
|
333
|
-
return
|
|
356
|
+
return _context6.abrupt("return", obj);
|
|
334
357
|
case 16:
|
|
335
358
|
case "end":
|
|
336
|
-
return
|
|
359
|
+
return _context6.stop();
|
|
337
360
|
}
|
|
338
|
-
},
|
|
361
|
+
}, _callee6);
|
|
339
362
|
}))).apply(this, arguments);
|
|
340
363
|
};
|
|
341
364
|
if (!p) p = {};
|
|
@@ -354,7 +377,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
354
377
|
ignoreProtected: allProperties
|
|
355
378
|
});
|
|
356
379
|
}) : allkeys;
|
|
357
|
-
|
|
380
|
+
_context7.next = 14;
|
|
358
381
|
return _convert["default"].applyFormats({
|
|
359
382
|
inputobject: dlt,
|
|
360
383
|
formats: (0, _object.object_getStatic)(this, "__formatList"),
|
|
@@ -375,32 +398,32 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
375
398
|
/* parse all changableKeys */
|
|
376
399
|
/* -------------------------------------------------------------------------- */
|
|
377
400
|
_iterator = _createForOfIteratorHelper(changableKeys);
|
|
378
|
-
|
|
401
|
+
_context7.prev = 17;
|
|
379
402
|
_iterator.s();
|
|
380
403
|
case 19:
|
|
381
404
|
if ((_step = _iterator.n()).done) {
|
|
382
|
-
|
|
405
|
+
_context7.next = 26;
|
|
383
406
|
break;
|
|
384
407
|
}
|
|
385
408
|
key = _step.value;
|
|
386
|
-
|
|
409
|
+
_context7.next = 23;
|
|
387
410
|
return parseObj(dlt[key]);
|
|
388
411
|
case 23:
|
|
389
|
-
final_object[key] =
|
|
412
|
+
final_object[key] = _context7.sent;
|
|
390
413
|
case 24:
|
|
391
|
-
|
|
414
|
+
_context7.next = 19;
|
|
392
415
|
break;
|
|
393
416
|
case 26:
|
|
394
|
-
|
|
417
|
+
_context7.next = 31;
|
|
395
418
|
break;
|
|
396
419
|
case 28:
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
_iterator.e(
|
|
420
|
+
_context7.prev = 28;
|
|
421
|
+
_context7.t0 = _context7["catch"](17);
|
|
422
|
+
_iterator.e(_context7.t0);
|
|
400
423
|
case 31:
|
|
401
|
-
|
|
424
|
+
_context7.prev = 31;
|
|
402
425
|
_iterator.f();
|
|
403
|
-
return
|
|
426
|
+
return _context7.finish(31);
|
|
404
427
|
case 34:
|
|
405
428
|
/* -------------------------------------------------------------------------- */
|
|
406
429
|
/* add id properties */
|
|
@@ -423,12 +446,12 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
423
446
|
});
|
|
424
447
|
final_object["_users"] = (0, _object.wrap_array)(tempusers);
|
|
425
448
|
}
|
|
426
|
-
return
|
|
449
|
+
return _context7.abrupt("return", final_object);
|
|
427
450
|
case 38:
|
|
428
451
|
case "end":
|
|
429
|
-
return
|
|
452
|
+
return _context7.stop();
|
|
430
453
|
}
|
|
431
|
-
},
|
|
454
|
+
}, _callee7, this, [[17, 28, 31, 34]]);
|
|
432
455
|
}))).apply(this, arguments);
|
|
433
456
|
} /* --------------------------------- Getters -------------------------------- */
|
|
434
457
|
}, {
|
|
@@ -454,127 +477,154 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
454
477
|
}, {
|
|
455
478
|
key: "onDelete",
|
|
456
479
|
value: /* -------------------------------------------------------------------------- */function onDelete() {
|
|
457
|
-
return (_onDelete = _onDelete || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
480
|
+
return (_onDelete = _onDelete || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
458
481
|
var _this$manager;
|
|
459
482
|
var _len,
|
|
460
483
|
p,
|
|
461
484
|
_key,
|
|
462
|
-
|
|
463
|
-
return _regeneratorRuntime().wrap(function
|
|
464
|
-
while (1) switch (
|
|
485
|
+
_args8 = arguments;
|
|
486
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
487
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
465
488
|
case 0:
|
|
466
489
|
this.isDeleted = true;
|
|
467
|
-
for (_len =
|
|
468
|
-
p[_key] =
|
|
490
|
+
for (_len = _args8.length, p = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
491
|
+
p[_key] = _args8[_key];
|
|
469
492
|
}
|
|
470
|
-
|
|
493
|
+
_context8.next = 4;
|
|
471
494
|
return (_this$manager = this.manager) === null || _this$manager === void 0 ? void 0 : _this$manager.onDelete.apply(_this$manager, p);
|
|
472
495
|
case 4:
|
|
473
|
-
return
|
|
496
|
+
return _context8.abrupt("return", _context8.sent);
|
|
474
497
|
case 5:
|
|
475
498
|
case "end":
|
|
476
|
-
return
|
|
499
|
+
return _context8.stop();
|
|
477
500
|
}
|
|
478
|
-
},
|
|
501
|
+
}, _callee8, this);
|
|
479
502
|
}))).apply(this, arguments);
|
|
480
503
|
}
|
|
481
504
|
}, {
|
|
482
|
-
key: "
|
|
483
|
-
value: function
|
|
484
|
-
return (
|
|
505
|
+
key: "onArchive",
|
|
506
|
+
value: function onArchive() {
|
|
507
|
+
return (_onArchive = _onArchive || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
485
508
|
var _this$manager2;
|
|
486
509
|
var _len2,
|
|
487
510
|
p,
|
|
488
511
|
_key2,
|
|
489
|
-
|
|
490
|
-
return _regeneratorRuntime().wrap(function
|
|
491
|
-
while (1) switch (
|
|
512
|
+
_args9 = arguments;
|
|
513
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
514
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
515
|
+
case 0:
|
|
516
|
+
this.isArchived = true;
|
|
517
|
+
for (_len2 = _args9.length, p = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
518
|
+
p[_key2] = _args9[_key2];
|
|
519
|
+
}
|
|
520
|
+
_context9.next = 4;
|
|
521
|
+
return (_this$manager2 = this.manager) === null || _this$manager2 === void 0 ? void 0 : _this$manager2.onArchive.apply(_this$manager2, p);
|
|
522
|
+
case 4:
|
|
523
|
+
return _context9.abrupt("return", _context9.sent);
|
|
524
|
+
case 5:
|
|
525
|
+
case "end":
|
|
526
|
+
return _context9.stop();
|
|
527
|
+
}
|
|
528
|
+
}, _callee9, this);
|
|
529
|
+
}))).apply(this, arguments);
|
|
530
|
+
}
|
|
531
|
+
}, {
|
|
532
|
+
key: "onLoad",
|
|
533
|
+
value: function onLoad() {
|
|
534
|
+
return (_onLoad = _onLoad || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
535
|
+
var _this$manager3;
|
|
536
|
+
var _len3,
|
|
537
|
+
p,
|
|
538
|
+
_key3,
|
|
539
|
+
_args10 = arguments;
|
|
540
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
541
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
492
542
|
case 0:
|
|
493
543
|
this.isDeleted = false;
|
|
494
|
-
for (
|
|
495
|
-
p[
|
|
544
|
+
for (_len3 = _args10.length, p = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
545
|
+
p[_key3] = _args10[_key3];
|
|
496
546
|
}
|
|
497
|
-
|
|
498
|
-
return (_this$
|
|
547
|
+
_context10.next = 4;
|
|
548
|
+
return (_this$manager3 = this.manager) === null || _this$manager3 === void 0 ? void 0 : _this$manager3.onLoad.apply(_this$manager3, p);
|
|
499
549
|
case 4:
|
|
500
|
-
return
|
|
550
|
+
return _context10.abrupt("return", _context10.sent);
|
|
501
551
|
case 5:
|
|
502
552
|
case "end":
|
|
503
|
-
return
|
|
553
|
+
return _context10.stop();
|
|
504
554
|
}
|
|
505
|
-
},
|
|
555
|
+
}, _callee10, this);
|
|
506
556
|
}))).apply(this, arguments);
|
|
507
557
|
}
|
|
508
558
|
}, {
|
|
509
559
|
key: "onSave",
|
|
510
560
|
value: function onSave() {
|
|
511
|
-
return (_onSave = _onSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
512
|
-
var _this$
|
|
561
|
+
return (_onSave = _onSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
562
|
+
var _this$manager5;
|
|
513
563
|
var srObject,
|
|
514
|
-
_this$
|
|
515
|
-
|
|
564
|
+
_this$manager4,
|
|
565
|
+
_len4,
|
|
516
566
|
p,
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
return _regeneratorRuntime().wrap(function
|
|
520
|
-
while (1) switch (
|
|
567
|
+
_key4,
|
|
568
|
+
_args11 = arguments;
|
|
569
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
570
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
521
571
|
case 0:
|
|
522
572
|
if (!this.isSaved) {
|
|
523
|
-
|
|
573
|
+
_context11.next = 7;
|
|
524
574
|
break;
|
|
525
575
|
}
|
|
526
576
|
this.apply_changes();
|
|
527
577
|
srObject = this.getSaveResult(true);
|
|
528
578
|
if (!this.saveResultHasID(srObject)) {
|
|
529
|
-
|
|
579
|
+
_context11.next = 7;
|
|
530
580
|
break;
|
|
531
581
|
}
|
|
532
582
|
/* -------------------------------------------------------------------------- */
|
|
533
583
|
WebObject.LoadIdsFromSaveResult(this, srObject);
|
|
534
|
-
|
|
535
|
-
return (_this$
|
|
584
|
+
_context11.next = 7;
|
|
585
|
+
return (_this$manager4 = this.manager) === null || _this$manager4 === void 0 ? void 0 : _this$manager4.event_run("on_id_change");
|
|
536
586
|
case 7:
|
|
537
|
-
for (
|
|
538
|
-
p[
|
|
587
|
+
for (_len4 = _args11.length, p = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
588
|
+
p[_key4] = _args11[_key4];
|
|
539
589
|
}
|
|
540
|
-
|
|
541
|
-
return (_this$
|
|
590
|
+
_context11.next = 10;
|
|
591
|
+
return (_this$manager5 = this.manager) === null || _this$manager5 === void 0 ? void 0 : _this$manager5.onSave.apply(_this$manager5, p);
|
|
542
592
|
case 10:
|
|
543
|
-
|
|
593
|
+
_context11.next = 12;
|
|
544
594
|
return this.onAfterSave();
|
|
545
595
|
case 12:
|
|
546
|
-
return
|
|
596
|
+
return _context11.abrupt("return", true);
|
|
547
597
|
case 13:
|
|
548
598
|
case "end":
|
|
549
|
-
return
|
|
599
|
+
return _context11.stop();
|
|
550
600
|
}
|
|
551
|
-
},
|
|
601
|
+
}, _callee11, this);
|
|
552
602
|
}))).apply(this, arguments);
|
|
553
603
|
}
|
|
554
604
|
}, {
|
|
555
605
|
key: "onAfterSave",
|
|
556
606
|
value: function onAfterSave() {
|
|
557
|
-
return (_onAfterSave = _onAfterSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
558
|
-
var _this$
|
|
559
|
-
var
|
|
607
|
+
return (_onAfterSave = _onAfterSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
608
|
+
var _this$manager6;
|
|
609
|
+
var _len5,
|
|
560
610
|
p,
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
return _regeneratorRuntime().wrap(function
|
|
564
|
-
while (1) switch (
|
|
611
|
+
_key5,
|
|
612
|
+
_args12 = arguments;
|
|
613
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
614
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
565
615
|
case 0:
|
|
566
|
-
for (
|
|
567
|
-
p[
|
|
616
|
+
for (_len5 = _args12.length, p = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
617
|
+
p[_key5] = _args12[_key5];
|
|
568
618
|
}
|
|
569
|
-
|
|
570
|
-
return (_this$
|
|
619
|
+
_context12.next = 3;
|
|
620
|
+
return (_this$manager6 = this.manager) === null || _this$manager6 === void 0 ? void 0 : _this$manager6.onAfterSave.apply(_this$manager6, p);
|
|
571
621
|
case 3:
|
|
572
|
-
return
|
|
622
|
+
return _context12.abrupt("return", true);
|
|
573
623
|
case 4:
|
|
574
624
|
case "end":
|
|
575
|
-
return
|
|
625
|
+
return _context12.stop();
|
|
576
626
|
}
|
|
577
|
-
},
|
|
627
|
+
}, _callee12, this);
|
|
578
628
|
}))).apply(this, arguments);
|
|
579
629
|
}
|
|
580
630
|
}, {
|
|
@@ -595,27 +645,27 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
595
645
|
}, {
|
|
596
646
|
key: "onNew",
|
|
597
647
|
value: function onNew() {
|
|
598
|
-
return (_onNew = _onNew || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
599
|
-
var _this$
|
|
600
|
-
var
|
|
648
|
+
return (_onNew = _onNew || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
649
|
+
var _this$manager7;
|
|
650
|
+
var _len6,
|
|
601
651
|
p,
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
return _regeneratorRuntime().wrap(function
|
|
605
|
-
while (1) switch (
|
|
652
|
+
_key6,
|
|
653
|
+
_args13 = arguments;
|
|
654
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
655
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
606
656
|
case 0:
|
|
607
|
-
for (
|
|
608
|
-
p[
|
|
657
|
+
for (_len6 = _args13.length, p = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
658
|
+
p[_key6] = _args13[_key6];
|
|
609
659
|
}
|
|
610
|
-
|
|
611
|
-
return (_this$
|
|
660
|
+
_context13.next = 3;
|
|
661
|
+
return (_this$manager7 = this.manager) === null || _this$manager7 === void 0 ? void 0 : _this$manager7.onNew.apply(_this$manager7, p);
|
|
612
662
|
case 3:
|
|
613
|
-
return
|
|
663
|
+
return _context13.abrupt("return", _context13.sent);
|
|
614
664
|
case 4:
|
|
615
665
|
case "end":
|
|
616
|
-
return
|
|
666
|
+
return _context13.stop();
|
|
617
667
|
}
|
|
618
|
-
},
|
|
668
|
+
}, _callee13, this);
|
|
619
669
|
}))).apply(this, arguments);
|
|
620
670
|
} /* -------------------------------------------------------------------------- */
|
|
621
671
|
}, {
|
|
@@ -662,7 +712,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
662
712
|
}, {
|
|
663
713
|
key: "saveList",
|
|
664
714
|
value: function saveList(_x6) {
|
|
665
|
-
return (_saveList = _saveList || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
715
|
+
return (_saveList = _saveList || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(itemList) {
|
|
666
716
|
var _extraOptions$chunksi;
|
|
667
717
|
var extraOptions,
|
|
668
718
|
chunks,
|
|
@@ -679,11 +729,11 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
679
729
|
_item,
|
|
680
730
|
_index2,
|
|
681
731
|
_item2,
|
|
682
|
-
|
|
683
|
-
return _regeneratorRuntime().wrap(function
|
|
684
|
-
while (1) switch (
|
|
732
|
+
_args14 = arguments;
|
|
733
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
734
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
685
735
|
case 0:
|
|
686
|
-
extraOptions =
|
|
736
|
+
extraOptions = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {};
|
|
687
737
|
if (!extraOptions) extraOptions = {};
|
|
688
738
|
chunks = (0, _object.array_chunks)(itemList, (_extraOptions$chunksi = extraOptions.chunksize) !== null && _extraOptions$chunksi !== void 0 ? _extraOptions$chunksi : 50);
|
|
689
739
|
delete extraOptions.chunksize;
|
|
@@ -691,7 +741,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
691
741
|
index = 0;
|
|
692
742
|
case 6:
|
|
693
743
|
if (!(index < chunks.length)) {
|
|
694
|
-
|
|
744
|
+
_context14.next = 36;
|
|
695
745
|
break;
|
|
696
746
|
}
|
|
697
747
|
items_to_save = chunks[index];
|
|
@@ -699,81 +749,81 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
699
749
|
k = 0;
|
|
700
750
|
case 10:
|
|
701
751
|
if (!(k < items_to_save.length)) {
|
|
702
|
-
|
|
752
|
+
_context14.next = 19;
|
|
703
753
|
break;
|
|
704
754
|
}
|
|
705
755
|
item = items_to_save[k];
|
|
706
|
-
|
|
756
|
+
_context14.next = 14;
|
|
707
757
|
return item.get_deltaObject();
|
|
708
758
|
case 14:
|
|
709
|
-
dlt =
|
|
759
|
+
dlt = _context14.sent;
|
|
710
760
|
save_array.push(item.isNew ? _objectSpread({}, dlt) : _objectSpread({
|
|
711
761
|
_id: item.getID()
|
|
712
762
|
}, dlt));
|
|
713
763
|
case 16:
|
|
714
764
|
k++;
|
|
715
|
-
|
|
765
|
+
_context14.next = 10;
|
|
716
766
|
break;
|
|
717
767
|
case 19:
|
|
718
|
-
|
|
768
|
+
_context14.next = 21;
|
|
719
769
|
return _global.gfunc.run_action("post", putAddress, _objectSpread({
|
|
720
770
|
__save_list: WebObject.zipSaveList(save_array)
|
|
721
771
|
}, extraOptions));
|
|
722
772
|
case 21:
|
|
723
|
-
resultObject =
|
|
773
|
+
resultObject = _context14.sent;
|
|
724
774
|
if (!Array.isArray(resultObject)) {
|
|
725
|
-
|
|
775
|
+
_context14.next = 33;
|
|
726
776
|
break;
|
|
727
777
|
}
|
|
728
778
|
_index = 0;
|
|
729
779
|
case 24:
|
|
730
780
|
if (!(_index < Math.min(resultObject.length, items_to_save.length))) {
|
|
731
|
-
|
|
781
|
+
_context14.next = 33;
|
|
732
782
|
break;
|
|
733
783
|
}
|
|
734
784
|
res = resultObject[_index];
|
|
735
785
|
_item = items_to_save[_index];
|
|
736
786
|
_item.setSaveResult(res);
|
|
737
|
-
|
|
787
|
+
_context14.next = 30;
|
|
738
788
|
return _item.onSave();
|
|
739
789
|
case 30:
|
|
740
790
|
_index++;
|
|
741
|
-
|
|
791
|
+
_context14.next = 24;
|
|
742
792
|
break;
|
|
743
793
|
case 33:
|
|
744
794
|
index++;
|
|
745
|
-
|
|
795
|
+
_context14.next = 6;
|
|
746
796
|
break;
|
|
747
797
|
case 36:
|
|
748
798
|
_index2 = 0;
|
|
749
799
|
case 37:
|
|
750
800
|
if (!(_index2 < itemList.length)) {
|
|
751
|
-
|
|
801
|
+
_context14.next = 46;
|
|
752
802
|
break;
|
|
753
803
|
}
|
|
754
804
|
_item2 = itemList[_index2];
|
|
755
805
|
if (_item2.isSaved) {
|
|
756
|
-
|
|
806
|
+
_context14.next = 41;
|
|
757
807
|
break;
|
|
758
808
|
}
|
|
759
|
-
return
|
|
809
|
+
return _context14.abrupt("return", false);
|
|
760
810
|
case 41:
|
|
761
811
|
if (!(_item2.getSaveResultType() != "normal")) {
|
|
762
|
-
|
|
812
|
+
_context14.next = 43;
|
|
763
813
|
break;
|
|
764
814
|
}
|
|
765
|
-
return
|
|
815
|
+
return _context14.abrupt("return", false);
|
|
766
816
|
case 43:
|
|
767
817
|
_index2++;
|
|
768
|
-
|
|
818
|
+
_context14.next = 37;
|
|
769
819
|
break;
|
|
770
820
|
case 46:
|
|
771
|
-
return
|
|
821
|
+
return _context14.abrupt("return", true);
|
|
772
822
|
case 47:
|
|
773
823
|
case "end":
|
|
774
|
-
return
|
|
824
|
+
return _context14.stop();
|
|
775
825
|
}
|
|
776
|
-
},
|
|
826
|
+
}, _callee14, this);
|
|
777
827
|
}))).apply(this, arguments);
|
|
778
828
|
}
|
|
779
829
|
}, {
|
|
@@ -819,64 +869,64 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
819
869
|
}, {
|
|
820
870
|
key: "get_single",
|
|
821
871
|
value: function get_single() {
|
|
822
|
-
return (_get_single = _get_single || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
823
|
-
var
|
|
872
|
+
return (_get_single = _get_single || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
873
|
+
var _len7,
|
|
824
874
|
p,
|
|
825
|
-
|
|
875
|
+
_key7,
|
|
826
876
|
search,
|
|
827
877
|
readonly,
|
|
828
878
|
fetchID,
|
|
829
879
|
res,
|
|
830
880
|
params,
|
|
831
|
-
|
|
832
|
-
return _regeneratorRuntime().wrap(function
|
|
833
|
-
while (1) switch (
|
|
881
|
+
_args15 = arguments;
|
|
882
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
883
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
834
884
|
case 0:
|
|
835
|
-
for (
|
|
836
|
-
p[
|
|
885
|
+
for (_len7 = _args15.length, p = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
886
|
+
p[_key7] = _args15[_key7];
|
|
837
887
|
}
|
|
838
888
|
search = p.shift();
|
|
839
889
|
readonly = p.shift();
|
|
840
890
|
fetchID = p.shift();
|
|
841
891
|
if (!(0, _object.object_isEmpty)(search)) {
|
|
842
|
-
|
|
892
|
+
_context15.next = 6;
|
|
843
893
|
break;
|
|
844
894
|
}
|
|
845
|
-
return
|
|
895
|
+
return _context15.abrupt("return", undefined);
|
|
846
896
|
case 6:
|
|
847
897
|
params = {};
|
|
848
898
|
params.context = readonly ? "view" : "edit";
|
|
849
|
-
|
|
850
|
-
|
|
899
|
+
_context15.t0 = _typeof(search);
|
|
900
|
+
_context15.next = _context15.t0 === "string" ? 11 : _context15.t0 === "number" ? 11 : _context15.t0 === "object" ? 19 : 19;
|
|
851
901
|
break;
|
|
852
902
|
case 11:
|
|
853
903
|
search = String(search);
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
904
|
+
_context15.t1 = this;
|
|
905
|
+
_context15.t2 = this;
|
|
906
|
+
_context15.next = 16;
|
|
857
907
|
return _global.gfunc.run_action("get", this.__web_path + "/" + search, params, {
|
|
858
908
|
fetchID: fetchID
|
|
859
909
|
});
|
|
860
910
|
case 16:
|
|
861
|
-
|
|
862
|
-
res =
|
|
863
|
-
return
|
|
911
|
+
_context15.t3 = _context15.sent;
|
|
912
|
+
res = _context15.t1.ensure.call(_context15.t1, _context15.t2, _context15.t3);
|
|
913
|
+
return _context15.abrupt("break", 25);
|
|
864
914
|
case 19:
|
|
865
|
-
|
|
866
|
-
|
|
915
|
+
_context15.t4 = _object.object_first;
|
|
916
|
+
_context15.next = 22;
|
|
867
917
|
return this.get_list(search, readonly, fetchID);
|
|
868
918
|
case 22:
|
|
869
|
-
|
|
870
|
-
res = (0,
|
|
871
|
-
return
|
|
919
|
+
_context15.t5 = _context15.sent;
|
|
920
|
+
res = (0, _context15.t4)(_context15.t5);
|
|
921
|
+
return _context15.abrupt("break", 25);
|
|
872
922
|
case 25:
|
|
873
923
|
WebObject.setReadonly(res, readonly);
|
|
874
|
-
return
|
|
924
|
+
return _context15.abrupt("return", res);
|
|
875
925
|
case 27:
|
|
876
926
|
case "end":
|
|
877
|
-
return
|
|
927
|
+
return _context15.stop();
|
|
878
928
|
}
|
|
879
|
-
},
|
|
929
|
+
}, _callee15, this);
|
|
880
930
|
}))).apply(this, arguments);
|
|
881
931
|
}
|
|
882
932
|
/**
|
|
@@ -886,42 +936,42 @@ var WebObject = /*#__PURE__*/function (_SimpleObject, _setMetaValue, _Save, _Del
|
|
|
886
936
|
}, {
|
|
887
937
|
key: "get_list",
|
|
888
938
|
value: function get_list() {
|
|
889
|
-
return (_get_list = _get_list || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
890
|
-
var
|
|
939
|
+
return (_get_list = _get_list || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
940
|
+
var _len8,
|
|
891
941
|
p,
|
|
892
|
-
|
|
942
|
+
_key8,
|
|
893
943
|
search,
|
|
894
944
|
readonly,
|
|
895
945
|
fetchID,
|
|
896
946
|
result_items,
|
|
897
947
|
selftype,
|
|
898
948
|
res,
|
|
899
|
-
|
|
900
|
-
return _regeneratorRuntime().wrap(function
|
|
901
|
-
while (1) switch (
|
|
949
|
+
_args16 = arguments;
|
|
950
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
951
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
902
952
|
case 0:
|
|
903
|
-
for (
|
|
904
|
-
p[
|
|
953
|
+
for (_len8 = _args16.length, p = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
954
|
+
p[_key8] = _args16[_key8];
|
|
905
955
|
}
|
|
906
956
|
search = p.shift();
|
|
907
957
|
readonly = p.shift();
|
|
908
958
|
fetchID = p.shift();
|
|
909
959
|
if (!search) search = {};
|
|
910
|
-
|
|
960
|
+
_context16.next = 7;
|
|
911
961
|
return _global.gfunc.run_action("get", this.__web_path, search, {
|
|
912
962
|
fetchID: fetchID
|
|
913
963
|
});
|
|
914
964
|
case 7:
|
|
915
|
-
result_items =
|
|
965
|
+
result_items = _context16.sent;
|
|
916
966
|
selftype = this.prototype;
|
|
917
967
|
res = WebObject.map_rowindex(WebObject.mapto(selftype, result_items, readonly));
|
|
918
968
|
WebObject.setReadonly(res, readonly);
|
|
919
|
-
return
|
|
969
|
+
return _context16.abrupt("return", res);
|
|
920
970
|
case 12:
|
|
921
971
|
case "end":
|
|
922
|
-
return
|
|
972
|
+
return _context16.stop();
|
|
923
973
|
}
|
|
924
|
-
},
|
|
974
|
+
}, _callee16, this);
|
|
925
975
|
}))).apply(this, arguments);
|
|
926
976
|
}
|
|
927
977
|
}]);
|
|
@@ -30,7 +30,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
30
30
|
/**
|
|
31
31
|
* This class manages the events of an Simple Object
|
|
32
32
|
*/
|
|
33
|
-
var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _setMetaValue, _get_deltaObject, _Save, _Load, _onNew, _onDelete, _onLoad, _onSave, _onAfterSave) {
|
|
33
|
+
var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _setMetaValue, _get_deltaObject, _Save, _Load, _onNew, _onDelete, _onArchive, _onLoad, _onSave, _onAfterSave) {
|
|
34
34
|
_inherits(WebObjectManager, _ObjectManager);
|
|
35
35
|
var _super = _createSuper(WebObjectManager);
|
|
36
36
|
/* -------------------------------------------------------------------------- */
|
|
@@ -282,17 +282,38 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _setMetaValue, _ge
|
|
|
282
282
|
_context7.next = 5;
|
|
283
283
|
return this.event_run("on_after_delete");
|
|
284
284
|
case 5:
|
|
285
|
-
_context7.
|
|
286
|
-
|
|
287
|
-
case 7:
|
|
288
|
-
return _context7.abrupt("return", _context7.sent);
|
|
289
|
-
case 8:
|
|
285
|
+
return _context7.abrupt("return", true);
|
|
286
|
+
case 6:
|
|
290
287
|
case "end":
|
|
291
288
|
return _context7.stop();
|
|
292
289
|
}
|
|
293
290
|
}, _callee7, this);
|
|
294
291
|
}))).apply(this, arguments);
|
|
295
292
|
}
|
|
293
|
+
}, {
|
|
294
|
+
key: "onArchive",
|
|
295
|
+
value: function onArchive() {
|
|
296
|
+
return (_onArchive = _onArchive || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
297
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
298
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
299
|
+
case 0:
|
|
300
|
+
if (this.obj) {
|
|
301
|
+
this.obj.isDeleted = true;
|
|
302
|
+
}
|
|
303
|
+
_context8.next = 3;
|
|
304
|
+
return this.event_run("on_archive");
|
|
305
|
+
case 3:
|
|
306
|
+
_context8.next = 5;
|
|
307
|
+
return this.event_run("on_after_archive");
|
|
308
|
+
case 5:
|
|
309
|
+
return _context8.abrupt("return", true);
|
|
310
|
+
case 6:
|
|
311
|
+
case "end":
|
|
312
|
+
return _context8.stop();
|
|
313
|
+
}
|
|
314
|
+
}, _callee8, this);
|
|
315
|
+
}))).apply(this, arguments);
|
|
316
|
+
}
|
|
296
317
|
/**
|
|
297
318
|
* Use this when you load data to the object
|
|
298
319
|
* @param p
|
|
@@ -301,35 +322,32 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _setMetaValue, _ge
|
|
|
301
322
|
}, {
|
|
302
323
|
key: "onLoad",
|
|
303
324
|
value: function onLoad() {
|
|
304
|
-
return (_onLoad = _onLoad || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
305
|
-
return _regeneratorRuntime().wrap(function
|
|
306
|
-
while (1) switch (
|
|
325
|
+
return (_onLoad = _onLoad || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
326
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
327
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
307
328
|
case 0:
|
|
308
329
|
if (this.canModify && this.obj) {
|
|
309
330
|
this.obj.isDeleted = false;
|
|
310
331
|
this.obj.setOriginal();
|
|
311
332
|
}
|
|
312
|
-
|
|
333
|
+
_context9.next = 3;
|
|
313
334
|
return this.event_run("on_load");
|
|
314
335
|
case 3:
|
|
315
|
-
|
|
336
|
+
_context9.next = 5;
|
|
316
337
|
return this.event_run("on_change", true);
|
|
317
338
|
case 5:
|
|
318
|
-
|
|
339
|
+
_context9.next = 7;
|
|
319
340
|
return this.event_run("on_after_load");
|
|
320
341
|
case 7:
|
|
321
|
-
|
|
342
|
+
_context9.next = 9;
|
|
322
343
|
return this.event_run("on_load_finished");
|
|
323
344
|
case 9:
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
case 11:
|
|
327
|
-
return _context8.abrupt("return", _context8.sent);
|
|
328
|
-
case 12:
|
|
345
|
+
return _context9.abrupt("return", true);
|
|
346
|
+
case 10:
|
|
329
347
|
case "end":
|
|
330
|
-
return
|
|
348
|
+
return _context9.stop();
|
|
331
349
|
}
|
|
332
|
-
},
|
|
350
|
+
}, _callee9, this);
|
|
333
351
|
}))).apply(this, arguments);
|
|
334
352
|
}
|
|
335
353
|
/**
|
|
@@ -340,49 +358,49 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _setMetaValue, _ge
|
|
|
340
358
|
}, {
|
|
341
359
|
key: "onSave",
|
|
342
360
|
value: function onSave() {
|
|
343
|
-
return (_onSave = _onSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
344
|
-
return _regeneratorRuntime().wrap(function
|
|
345
|
-
while (1) switch (
|
|
361
|
+
return (_onSave = _onSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
362
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
363
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
346
364
|
case 0:
|
|
347
|
-
|
|
365
|
+
_context10.next = 2;
|
|
348
366
|
return this.event_run("on_save");
|
|
349
367
|
case 2:
|
|
350
|
-
|
|
368
|
+
_context10.next = 4;
|
|
351
369
|
return this.event_run("on_change", true);
|
|
352
370
|
case 4:
|
|
353
|
-
|
|
371
|
+
_context10.next = 6;
|
|
354
372
|
return Promise.resolve(true);
|
|
355
373
|
case 6:
|
|
356
|
-
return
|
|
374
|
+
return _context10.abrupt("return", _context10.sent);
|
|
357
375
|
case 7:
|
|
358
376
|
case "end":
|
|
359
|
-
return
|
|
377
|
+
return _context10.stop();
|
|
360
378
|
}
|
|
361
|
-
},
|
|
379
|
+
}, _callee10, this);
|
|
362
380
|
}))).apply(this, arguments);
|
|
363
381
|
}
|
|
364
382
|
}, {
|
|
365
383
|
key: "onAfterSave",
|
|
366
384
|
value: function onAfterSave() {
|
|
367
|
-
return (_onAfterSave = _onAfterSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
368
|
-
return _regeneratorRuntime().wrap(function
|
|
369
|
-
while (1) switch (
|
|
385
|
+
return (_onAfterSave = _onAfterSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
386
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
387
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
370
388
|
case 0:
|
|
371
|
-
|
|
389
|
+
_context11.next = 2;
|
|
372
390
|
return this.event_run("on_after_save");
|
|
373
391
|
case 2:
|
|
374
|
-
|
|
392
|
+
_context11.next = 4;
|
|
375
393
|
return this.event_run("on_save_finished");
|
|
376
394
|
case 4:
|
|
377
|
-
|
|
395
|
+
_context11.next = 6;
|
|
378
396
|
return Promise.resolve(true);
|
|
379
397
|
case 6:
|
|
380
|
-
return
|
|
398
|
+
return _context11.abrupt("return", _context11.sent);
|
|
381
399
|
case 7:
|
|
382
400
|
case "end":
|
|
383
|
-
return
|
|
401
|
+
return _context11.stop();
|
|
384
402
|
}
|
|
385
|
-
},
|
|
403
|
+
}, _callee11, this);
|
|
386
404
|
}))).apply(this, arguments);
|
|
387
405
|
}
|
|
388
406
|
}]);
|
|
@@ -191,7 +191,7 @@ export declare class SimpleObject extends MapableObject {
|
|
|
191
191
|
* and its type
|
|
192
192
|
* @param toObj
|
|
193
193
|
*/
|
|
194
|
-
setSaveResult(toObj: any, type?: saveResultType | "auto"): void;
|
|
194
|
+
setSaveResult(toObj: any, type?: saveResultType | "auto", registerErrors?: boolean): void;
|
|
195
195
|
getSaveResult(original?: boolean): any;
|
|
196
196
|
getSaveResultType(): saveResultType;
|
|
197
197
|
static setTemp(obj: SimpleObject | any, key: string, value: any, sendChanges?: sendChangesType): Promise<void>;
|
|
@@ -865,12 +865,17 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
|
|
|
865
865
|
*/
|
|
866
866
|
function setSaveResult(toObj) {
|
|
867
867
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "auto";
|
|
868
|
+
var registerErrors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
868
869
|
_classPrivateMethodGet(this, _setSaveResultObject, _setSaveResultObject2).call(this, toObj);
|
|
869
870
|
//check if the given object is a valid save result
|
|
870
871
|
if (type === "error") this.__saveResultIsSuccess = false;else this.__saveResultIsSuccess = Boolean(type === "nothing" || this.constructor["isResultValid"](toObj));
|
|
871
872
|
if (type === "auto") {
|
|
872
873
|
type = this.__saveResultIsSuccess ? "normal" : "error";
|
|
873
874
|
}
|
|
875
|
+
if (registerErrors && !this.__saveResultIsSuccess) {
|
|
876
|
+
console.error("bad save result : ", this.__saveResultObject);
|
|
877
|
+
SimpleObject.addError(this, "save result is not valid", "the response from server was not valid", true);
|
|
878
|
+
}
|
|
874
879
|
this.__saveResultType = type;
|
|
875
880
|
}
|
|
876
881
|
}, {
|