@azrico/webobject 1.4.130 → 1.4.132
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.
|
@@ -70,6 +70,11 @@ export declare class WebObject extends SimpleObject {
|
|
|
70
70
|
canDelete(): boolean;
|
|
71
71
|
canArchive(): boolean;
|
|
72
72
|
deltaIsValid(d: any): true | string;
|
|
73
|
+
/**
|
|
74
|
+
* calls the `get_deltaObject` with `allProperties=true` `extraProperties=true`
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
get_fullDeltaObject(p?: deltaParams): Promise<any>;
|
|
73
78
|
/**
|
|
74
79
|
* You will post this to the server for saving
|
|
75
80
|
* automatically removes unchangable fields
|
|
@@ -349,87 +349,117 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
349
349
|
value: function deltaIsValid(d) {
|
|
350
350
|
return true;
|
|
351
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* calls the `get_deltaObject` with `allProperties=true` `extraProperties=true`
|
|
354
|
+
* @returns
|
|
355
|
+
*/
|
|
356
|
+
}, {
|
|
357
|
+
key: "get_fullDeltaObject",
|
|
358
|
+
value: (function () {
|
|
359
|
+
var _get_fullDeltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(p) {
|
|
360
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
361
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
362
|
+
case 0:
|
|
363
|
+
_context6.next = 2;
|
|
364
|
+
return this.get_deltaObject({
|
|
365
|
+
allProperties: true,
|
|
366
|
+
extraProperties: true
|
|
367
|
+
});
|
|
368
|
+
case 2:
|
|
369
|
+
return _context6.abrupt("return", _context6.sent);
|
|
370
|
+
case 3:
|
|
371
|
+
case "end":
|
|
372
|
+
return _context6.stop();
|
|
373
|
+
}
|
|
374
|
+
}, _callee6, this);
|
|
375
|
+
}));
|
|
376
|
+
function get_fullDeltaObject(_x3) {
|
|
377
|
+
return _get_fullDeltaObject.apply(this, arguments);
|
|
378
|
+
}
|
|
379
|
+
return get_fullDeltaObject;
|
|
380
|
+
}()
|
|
352
381
|
/**
|
|
353
382
|
* You will post this to the server for saving
|
|
354
383
|
* automatically removes unchangable fields
|
|
355
384
|
* @returns
|
|
356
385
|
*/
|
|
386
|
+
)
|
|
357
387
|
}, {
|
|
358
388
|
key: "get_deltaObject",
|
|
359
389
|
value: (function () {
|
|
360
|
-
var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
390
|
+
var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(p) {
|
|
361
391
|
var _this2 = this;
|
|
362
392
|
var final_object, isChild, useDelta, allProperties, needId, chkChangables, useExtraProps, dlt, allkeys, changableKeys, functionProps, index, fp, parseObj, _parseObj, _iterator, _step, key, tempusers;
|
|
363
|
-
return _regeneratorRuntime().wrap(function
|
|
364
|
-
while (1) switch (
|
|
393
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
394
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
365
395
|
case 0:
|
|
366
396
|
_parseObj = function _parseObj3() {
|
|
367
|
-
_parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
397
|
+
_parseObj = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(obj) {
|
|
368
398
|
var newobj_dlt;
|
|
369
|
-
return _regeneratorRuntime().wrap(function
|
|
370
|
-
while (1) switch (
|
|
399
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
400
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
371
401
|
case 0:
|
|
372
402
|
if (!(obj == null)) {
|
|
373
|
-
|
|
403
|
+
_context8.next = 2;
|
|
374
404
|
break;
|
|
375
405
|
}
|
|
376
|
-
return
|
|
406
|
+
return _context8.abrupt("return", undefined);
|
|
377
407
|
case 2:
|
|
378
408
|
if (!Array.isArray(obj)) {
|
|
379
|
-
|
|
409
|
+
_context8.next = 6;
|
|
380
410
|
break;
|
|
381
411
|
}
|
|
382
|
-
|
|
412
|
+
_context8.next = 5;
|
|
383
413
|
return Promise.all(obj.map( /*#__PURE__*/function () {
|
|
384
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
385
|
-
return _regeneratorRuntime().wrap(function
|
|
386
|
-
while (1) switch (
|
|
414
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(r) {
|
|
415
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
416
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
387
417
|
case 0:
|
|
388
|
-
|
|
418
|
+
_context7.next = 2;
|
|
389
419
|
return parseObj(r);
|
|
390
420
|
case 2:
|
|
391
|
-
return
|
|
421
|
+
return _context7.abrupt("return", _context7.sent);
|
|
392
422
|
case 3:
|
|
393
423
|
case "end":
|
|
394
|
-
return
|
|
424
|
+
return _context7.stop();
|
|
395
425
|
}
|
|
396
|
-
},
|
|
426
|
+
}, _callee7);
|
|
397
427
|
}));
|
|
398
|
-
return function (
|
|
428
|
+
return function (_x6) {
|
|
399
429
|
return _ref.apply(this, arguments);
|
|
400
430
|
};
|
|
401
431
|
}()));
|
|
402
432
|
case 5:
|
|
403
|
-
return
|
|
433
|
+
return _context8.abrupt("return", _context8.sent);
|
|
404
434
|
case 6:
|
|
405
435
|
if (!(obj instanceof WebObject && typeof obj.get_deltaObject === "function")) {
|
|
406
|
-
|
|
436
|
+
_context8.next = 15;
|
|
407
437
|
break;
|
|
408
438
|
}
|
|
409
|
-
|
|
439
|
+
_context8.next = 9;
|
|
410
440
|
return obj.get_deltaObject(_objectSpread(_objectSpread({}, p), {}, {
|
|
411
441
|
isChild: true
|
|
412
442
|
}));
|
|
413
443
|
case 9:
|
|
414
|
-
newobj_dlt =
|
|
444
|
+
newobj_dlt = _context8.sent;
|
|
415
445
|
if ((0, _object.object_isEmpty)(newobj_dlt)) {
|
|
416
|
-
|
|
446
|
+
_context8.next = 14;
|
|
417
447
|
break;
|
|
418
448
|
}
|
|
419
|
-
return
|
|
449
|
+
return _context8.abrupt("return", newobj_dlt);
|
|
420
450
|
case 14:
|
|
421
|
-
return
|
|
451
|
+
return _context8.abrupt("return", obj);
|
|
422
452
|
case 15:
|
|
423
|
-
return
|
|
453
|
+
return _context8.abrupt("return", obj);
|
|
424
454
|
case 16:
|
|
425
455
|
case "end":
|
|
426
|
-
return
|
|
456
|
+
return _context8.stop();
|
|
427
457
|
}
|
|
428
|
-
},
|
|
458
|
+
}, _callee8);
|
|
429
459
|
}));
|
|
430
460
|
return _parseObj.apply(this, arguments);
|
|
431
461
|
};
|
|
432
|
-
parseObj = function _parseObj2(
|
|
462
|
+
parseObj = function _parseObj2(_x5) {
|
|
433
463
|
return _parseObj.apply(this, arguments);
|
|
434
464
|
};
|
|
435
465
|
if (!p) p = {};
|
|
@@ -448,7 +478,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
448
478
|
ignoreProtected: allProperties
|
|
449
479
|
});
|
|
450
480
|
}) : allkeys;
|
|
451
|
-
|
|
481
|
+
_context9.next = 15;
|
|
452
482
|
return _convert["default"].applyFormats({
|
|
453
483
|
inputobject: dlt,
|
|
454
484
|
formats: (0, _object.object_getStatic)(this, "__formatList"),
|
|
@@ -469,32 +499,32 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
469
499
|
/* parse all changableKeys */
|
|
470
500
|
/* -------------------------------------------------------------------------- */
|
|
471
501
|
_iterator = _createForOfIteratorHelper(changableKeys);
|
|
472
|
-
|
|
502
|
+
_context9.prev = 18;
|
|
473
503
|
_iterator.s();
|
|
474
504
|
case 20:
|
|
475
505
|
if ((_step = _iterator.n()).done) {
|
|
476
|
-
|
|
506
|
+
_context9.next = 27;
|
|
477
507
|
break;
|
|
478
508
|
}
|
|
479
509
|
key = _step.value;
|
|
480
|
-
|
|
510
|
+
_context9.next = 24;
|
|
481
511
|
return parseObj(dlt[key]);
|
|
482
512
|
case 24:
|
|
483
|
-
final_object[key] =
|
|
513
|
+
final_object[key] = _context9.sent;
|
|
484
514
|
case 25:
|
|
485
|
-
|
|
515
|
+
_context9.next = 20;
|
|
486
516
|
break;
|
|
487
517
|
case 27:
|
|
488
|
-
|
|
518
|
+
_context9.next = 32;
|
|
489
519
|
break;
|
|
490
520
|
case 29:
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
_iterator.e(
|
|
521
|
+
_context9.prev = 29;
|
|
522
|
+
_context9.t0 = _context9["catch"](18);
|
|
523
|
+
_iterator.e(_context9.t0);
|
|
494
524
|
case 32:
|
|
495
|
-
|
|
525
|
+
_context9.prev = 32;
|
|
496
526
|
_iterator.f();
|
|
497
|
-
return
|
|
527
|
+
return _context9.finish(32);
|
|
498
528
|
case 35:
|
|
499
529
|
/* -------------------------------------------------------------------------- */
|
|
500
530
|
/* add id properties */
|
|
@@ -519,14 +549,14 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
519
549
|
});
|
|
520
550
|
final_object["_users"] = (0, _object.wrap_array)(tempusers);
|
|
521
551
|
}
|
|
522
|
-
return
|
|
552
|
+
return _context9.abrupt("return", final_object);
|
|
523
553
|
case 39:
|
|
524
554
|
case "end":
|
|
525
|
-
return
|
|
555
|
+
return _context9.stop();
|
|
526
556
|
}
|
|
527
|
-
},
|
|
557
|
+
}, _callee9, this, [[18, 29, 32, 35]]);
|
|
528
558
|
}));
|
|
529
|
-
function get_deltaObject(
|
|
559
|
+
function get_deltaObject(_x4) {
|
|
530
560
|
return _get_deltaObject.apply(this, arguments);
|
|
531
561
|
}
|
|
532
562
|
return get_deltaObject;
|
|
@@ -554,28 +584,28 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
554
584
|
}, {
|
|
555
585
|
key: "onDelete",
|
|
556
586
|
value: ( /* -------------------------------------------------------------------------- */function () {
|
|
557
|
-
var _onDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
587
|
+
var _onDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
558
588
|
var _this$manager;
|
|
559
589
|
var _len,
|
|
560
590
|
p,
|
|
561
591
|
_key,
|
|
562
|
-
|
|
563
|
-
return _regeneratorRuntime().wrap(function
|
|
564
|
-
while (1) switch (
|
|
592
|
+
_args10 = arguments;
|
|
593
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
594
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
565
595
|
case 0:
|
|
566
596
|
if (this.isSaved) this.isDeleted = true;
|
|
567
|
-
for (_len =
|
|
568
|
-
p[_key] =
|
|
597
|
+
for (_len = _args10.length, p = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
598
|
+
p[_key] = _args10[_key];
|
|
569
599
|
}
|
|
570
|
-
|
|
600
|
+
_context10.next = 4;
|
|
571
601
|
return (_this$manager = this.manager) === null || _this$manager === void 0 ? void 0 : _this$manager.onDelete.apply(_this$manager, p);
|
|
572
602
|
case 4:
|
|
573
|
-
return
|
|
603
|
+
return _context10.abrupt("return", _context10.sent);
|
|
574
604
|
case 5:
|
|
575
605
|
case "end":
|
|
576
|
-
return
|
|
606
|
+
return _context10.stop();
|
|
577
607
|
}
|
|
578
|
-
},
|
|
608
|
+
}, _callee10, this);
|
|
579
609
|
}));
|
|
580
610
|
function onDelete() {
|
|
581
611
|
return _onDelete.apply(this, arguments);
|
|
@@ -585,28 +615,28 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
585
615
|
}, {
|
|
586
616
|
key: "onArchive",
|
|
587
617
|
value: function () {
|
|
588
|
-
var _onArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
618
|
+
var _onArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
589
619
|
var _this$manager2;
|
|
590
620
|
var _len2,
|
|
591
621
|
p,
|
|
592
622
|
_key2,
|
|
593
|
-
|
|
594
|
-
return _regeneratorRuntime().wrap(function
|
|
595
|
-
while (1) switch (
|
|
623
|
+
_args11 = arguments;
|
|
624
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
625
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
596
626
|
case 0:
|
|
597
627
|
if (this.isSaved) this.isArchived = true;
|
|
598
|
-
for (_len2 =
|
|
599
|
-
p[_key2] =
|
|
628
|
+
for (_len2 = _args11.length, p = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
629
|
+
p[_key2] = _args11[_key2];
|
|
600
630
|
}
|
|
601
|
-
|
|
631
|
+
_context11.next = 4;
|
|
602
632
|
return (_this$manager2 = this.manager) === null || _this$manager2 === void 0 ? void 0 : _this$manager2.onArchive.apply(_this$manager2, p);
|
|
603
633
|
case 4:
|
|
604
|
-
return
|
|
634
|
+
return _context11.abrupt("return", _context11.sent);
|
|
605
635
|
case 5:
|
|
606
636
|
case "end":
|
|
607
|
-
return
|
|
637
|
+
return _context11.stop();
|
|
608
638
|
}
|
|
609
|
-
},
|
|
639
|
+
}, _callee11, this);
|
|
610
640
|
}));
|
|
611
641
|
function onArchive() {
|
|
612
642
|
return _onArchive.apply(this, arguments);
|
|
@@ -616,28 +646,28 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
616
646
|
}, {
|
|
617
647
|
key: "onUnArchive",
|
|
618
648
|
value: function () {
|
|
619
|
-
var _onUnArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
649
|
+
var _onUnArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
620
650
|
var _this$manager3;
|
|
621
651
|
var _len3,
|
|
622
652
|
p,
|
|
623
653
|
_key3,
|
|
624
|
-
|
|
625
|
-
return _regeneratorRuntime().wrap(function
|
|
626
|
-
while (1) switch (
|
|
654
|
+
_args12 = arguments;
|
|
655
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
656
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
627
657
|
case 0:
|
|
628
658
|
if (this.isSaved) this.isArchived = false;
|
|
629
|
-
for (_len3 =
|
|
630
|
-
p[_key3] =
|
|
659
|
+
for (_len3 = _args12.length, p = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
660
|
+
p[_key3] = _args12[_key3];
|
|
631
661
|
}
|
|
632
|
-
|
|
662
|
+
_context12.next = 4;
|
|
633
663
|
return (_this$manager3 = this.manager) === null || _this$manager3 === void 0 ? void 0 : _this$manager3.onUnArchive.apply(_this$manager3, p);
|
|
634
664
|
case 4:
|
|
635
|
-
return
|
|
665
|
+
return _context12.abrupt("return", _context12.sent);
|
|
636
666
|
case 5:
|
|
637
667
|
case "end":
|
|
638
|
-
return
|
|
668
|
+
return _context12.stop();
|
|
639
669
|
}
|
|
640
|
-
},
|
|
670
|
+
}, _callee12, this);
|
|
641
671
|
}));
|
|
642
672
|
function onUnArchive() {
|
|
643
673
|
return _onUnArchive.apply(this, arguments);
|
|
@@ -647,28 +677,28 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
647
677
|
}, {
|
|
648
678
|
key: "onLoad",
|
|
649
679
|
value: function () {
|
|
650
|
-
var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
680
|
+
var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
651
681
|
var _this$manager4;
|
|
652
682
|
var _len4,
|
|
653
683
|
p,
|
|
654
684
|
_key4,
|
|
655
|
-
|
|
656
|
-
return _regeneratorRuntime().wrap(function
|
|
657
|
-
while (1) switch (
|
|
685
|
+
_args13 = arguments;
|
|
686
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
687
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
658
688
|
case 0:
|
|
659
689
|
this.isDeleted = false;
|
|
660
|
-
for (_len4 =
|
|
661
|
-
p[_key4] =
|
|
690
|
+
for (_len4 = _args13.length, p = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
691
|
+
p[_key4] = _args13[_key4];
|
|
662
692
|
}
|
|
663
|
-
|
|
693
|
+
_context13.next = 4;
|
|
664
694
|
return (_this$manager4 = this.manager) === null || _this$manager4 === void 0 ? void 0 : _this$manager4.onLoad.apply(_this$manager4, p);
|
|
665
695
|
case 4:
|
|
666
|
-
return
|
|
696
|
+
return _context13.abrupt("return", _context13.sent);
|
|
667
697
|
case 5:
|
|
668
698
|
case "end":
|
|
669
|
-
return
|
|
699
|
+
return _context13.stop();
|
|
670
700
|
}
|
|
671
|
-
},
|
|
701
|
+
}, _callee13, this);
|
|
672
702
|
}));
|
|
673
703
|
function onLoad() {
|
|
674
704
|
return _onLoad.apply(this, arguments);
|
|
@@ -678,47 +708,47 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
678
708
|
}, {
|
|
679
709
|
key: "onSave",
|
|
680
710
|
value: function () {
|
|
681
|
-
var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
711
|
+
var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
682
712
|
var _this$manager6;
|
|
683
713
|
var srObject,
|
|
684
714
|
_this$manager5,
|
|
685
715
|
_len5,
|
|
686
716
|
p,
|
|
687
717
|
_key5,
|
|
688
|
-
|
|
689
|
-
return _regeneratorRuntime().wrap(function
|
|
690
|
-
while (1) switch (
|
|
718
|
+
_args14 = arguments;
|
|
719
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
720
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
691
721
|
case 0:
|
|
692
722
|
if (!this.isSaved) {
|
|
693
|
-
|
|
723
|
+
_context14.next = 7;
|
|
694
724
|
break;
|
|
695
725
|
}
|
|
696
726
|
this.apply_changes();
|
|
697
727
|
srObject = this.getSaveResult(true);
|
|
698
728
|
if (!this.saveResultHasID(srObject)) {
|
|
699
|
-
|
|
729
|
+
_context14.next = 7;
|
|
700
730
|
break;
|
|
701
731
|
}
|
|
702
732
|
/* -------------------------------------------------------------------------- */
|
|
703
733
|
WebObject.LoadIdsFromSaveResult(this, srObject);
|
|
704
|
-
|
|
734
|
+
_context14.next = 7;
|
|
705
735
|
return (_this$manager5 = this.manager) === null || _this$manager5 === void 0 ? void 0 : _this$manager5.event_run("on_id_change");
|
|
706
736
|
case 7:
|
|
707
|
-
for (_len5 =
|
|
708
|
-
p[_key5] =
|
|
737
|
+
for (_len5 = _args14.length, p = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
738
|
+
p[_key5] = _args14[_key5];
|
|
709
739
|
}
|
|
710
|
-
|
|
740
|
+
_context14.next = 10;
|
|
711
741
|
return (_this$manager6 = this.manager) === null || _this$manager6 === void 0 ? void 0 : _this$manager6.onSave.apply(_this$manager6, p);
|
|
712
742
|
case 10:
|
|
713
|
-
|
|
743
|
+
_context14.next = 12;
|
|
714
744
|
return this.onAfterSave();
|
|
715
745
|
case 12:
|
|
716
|
-
return
|
|
746
|
+
return _context14.abrupt("return", true);
|
|
717
747
|
case 13:
|
|
718
748
|
case "end":
|
|
719
|
-
return
|
|
749
|
+
return _context14.stop();
|
|
720
750
|
}
|
|
721
|
-
},
|
|
751
|
+
}, _callee14, this);
|
|
722
752
|
}));
|
|
723
753
|
function onSave() {
|
|
724
754
|
return _onSave.apply(this, arguments);
|
|
@@ -728,27 +758,27 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
728
758
|
}, {
|
|
729
759
|
key: "onAfterSave",
|
|
730
760
|
value: function () {
|
|
731
|
-
var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
761
|
+
var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
732
762
|
var _this$manager7;
|
|
733
763
|
var _len6,
|
|
734
764
|
p,
|
|
735
765
|
_key6,
|
|
736
|
-
|
|
737
|
-
return _regeneratorRuntime().wrap(function
|
|
738
|
-
while (1) switch (
|
|
766
|
+
_args15 = arguments;
|
|
767
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
768
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
739
769
|
case 0:
|
|
740
|
-
for (_len6 =
|
|
741
|
-
p[_key6] =
|
|
770
|
+
for (_len6 = _args15.length, p = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
771
|
+
p[_key6] = _args15[_key6];
|
|
742
772
|
}
|
|
743
|
-
|
|
773
|
+
_context15.next = 3;
|
|
744
774
|
return (_this$manager7 = this.manager) === null || _this$manager7 === void 0 ? void 0 : _this$manager7.onAfterSave.apply(_this$manager7, p);
|
|
745
775
|
case 3:
|
|
746
|
-
return
|
|
776
|
+
return _context15.abrupt("return", true);
|
|
747
777
|
case 4:
|
|
748
778
|
case "end":
|
|
749
|
-
return
|
|
779
|
+
return _context15.stop();
|
|
750
780
|
}
|
|
751
|
-
},
|
|
781
|
+
}, _callee15, this);
|
|
752
782
|
}));
|
|
753
783
|
function onAfterSave() {
|
|
754
784
|
return _onAfterSave.apply(this, arguments);
|
|
@@ -773,27 +803,27 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
773
803
|
}, {
|
|
774
804
|
key: "onNew",
|
|
775
805
|
value: function () {
|
|
776
|
-
var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
806
|
+
var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
777
807
|
var _this$manager8;
|
|
778
808
|
var _len7,
|
|
779
809
|
p,
|
|
780
810
|
_key7,
|
|
781
|
-
|
|
782
|
-
return _regeneratorRuntime().wrap(function
|
|
783
|
-
while (1) switch (
|
|
811
|
+
_args16 = arguments;
|
|
812
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
813
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
784
814
|
case 0:
|
|
785
|
-
for (_len7 =
|
|
786
|
-
p[_key7] =
|
|
815
|
+
for (_len7 = _args16.length, p = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
816
|
+
p[_key7] = _args16[_key7];
|
|
787
817
|
}
|
|
788
|
-
|
|
818
|
+
_context16.next = 3;
|
|
789
819
|
return (_this$manager8 = this.manager) === null || _this$manager8 === void 0 ? void 0 : _this$manager8.onNew.apply(_this$manager8, p);
|
|
790
820
|
case 3:
|
|
791
|
-
return
|
|
821
|
+
return _context16.abrupt("return", _context16.sent);
|
|
792
822
|
case 4:
|
|
793
823
|
case "end":
|
|
794
|
-
return
|
|
824
|
+
return _context16.stop();
|
|
795
825
|
}
|
|
796
|
-
},
|
|
826
|
+
}, _callee16, this);
|
|
797
827
|
}));
|
|
798
828
|
function onNew() {
|
|
799
829
|
return _onNew.apply(this, arguments);
|
|
@@ -849,7 +879,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
849
879
|
}, {
|
|
850
880
|
key: "saveList",
|
|
851
881
|
value: function () {
|
|
852
|
-
var _saveList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
882
|
+
var _saveList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(itemList) {
|
|
853
883
|
var _extraOptions$chunksi;
|
|
854
884
|
var extraOptions,
|
|
855
885
|
chunks,
|
|
@@ -866,11 +896,11 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
866
896
|
_item,
|
|
867
897
|
_index2,
|
|
868
898
|
_item2,
|
|
869
|
-
|
|
870
|
-
return _regeneratorRuntime().wrap(function
|
|
871
|
-
while (1) switch (
|
|
899
|
+
_args17 = arguments;
|
|
900
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
901
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
872
902
|
case 0:
|
|
873
|
-
extraOptions =
|
|
903
|
+
extraOptions = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
|
|
874
904
|
if (!extraOptions) extraOptions = {};
|
|
875
905
|
chunks = (0, _object.array_chunks)(itemList, (_extraOptions$chunksi = extraOptions.chunksize) !== null && _extraOptions$chunksi !== void 0 ? _extraOptions$chunksi : 50);
|
|
876
906
|
delete extraOptions.chunksize;
|
|
@@ -878,7 +908,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
878
908
|
index = 0;
|
|
879
909
|
case 6:
|
|
880
910
|
if (!(index < chunks.length)) {
|
|
881
|
-
|
|
911
|
+
_context17.next = 36;
|
|
882
912
|
break;
|
|
883
913
|
}
|
|
884
914
|
items_to_save = chunks[index];
|
|
@@ -886,83 +916,83 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
886
916
|
k = 0;
|
|
887
917
|
case 10:
|
|
888
918
|
if (!(k < items_to_save.length)) {
|
|
889
|
-
|
|
919
|
+
_context17.next = 19;
|
|
890
920
|
break;
|
|
891
921
|
}
|
|
892
922
|
item = items_to_save[k];
|
|
893
|
-
|
|
923
|
+
_context17.next = 14;
|
|
894
924
|
return item.get_deltaObject();
|
|
895
925
|
case 14:
|
|
896
|
-
dlt =
|
|
926
|
+
dlt = _context17.sent;
|
|
897
927
|
save_array.push(item.isNew ? _objectSpread({}, dlt) : _objectSpread({
|
|
898
928
|
_id: item.getID()
|
|
899
929
|
}, dlt));
|
|
900
930
|
case 16:
|
|
901
931
|
k++;
|
|
902
|
-
|
|
932
|
+
_context17.next = 10;
|
|
903
933
|
break;
|
|
904
934
|
case 19:
|
|
905
|
-
|
|
935
|
+
_context17.next = 21;
|
|
906
936
|
return _global.gfunc.run_action("post", putAddress, _objectSpread({
|
|
907
937
|
__save_list: WebObject.zipSaveList(save_array)
|
|
908
938
|
}, extraOptions));
|
|
909
939
|
case 21:
|
|
910
|
-
resultObject =
|
|
940
|
+
resultObject = _context17.sent;
|
|
911
941
|
if (!Array.isArray(resultObject)) {
|
|
912
|
-
|
|
942
|
+
_context17.next = 33;
|
|
913
943
|
break;
|
|
914
944
|
}
|
|
915
945
|
_index = 0;
|
|
916
946
|
case 24:
|
|
917
947
|
if (!(_index < Math.min(resultObject.length, items_to_save.length))) {
|
|
918
|
-
|
|
948
|
+
_context17.next = 33;
|
|
919
949
|
break;
|
|
920
950
|
}
|
|
921
951
|
res = resultObject[_index];
|
|
922
952
|
_item = items_to_save[_index];
|
|
923
953
|
_item.setSaveResult(res);
|
|
924
|
-
|
|
954
|
+
_context17.next = 30;
|
|
925
955
|
return _item.onSave();
|
|
926
956
|
case 30:
|
|
927
957
|
_index++;
|
|
928
|
-
|
|
958
|
+
_context17.next = 24;
|
|
929
959
|
break;
|
|
930
960
|
case 33:
|
|
931
961
|
index++;
|
|
932
|
-
|
|
962
|
+
_context17.next = 6;
|
|
933
963
|
break;
|
|
934
964
|
case 36:
|
|
935
965
|
_index2 = 0;
|
|
936
966
|
case 37:
|
|
937
967
|
if (!(_index2 < itemList.length)) {
|
|
938
|
-
|
|
968
|
+
_context17.next = 46;
|
|
939
969
|
break;
|
|
940
970
|
}
|
|
941
971
|
_item2 = itemList[_index2];
|
|
942
972
|
if (_item2.isSaved) {
|
|
943
|
-
|
|
973
|
+
_context17.next = 41;
|
|
944
974
|
break;
|
|
945
975
|
}
|
|
946
|
-
return
|
|
976
|
+
return _context17.abrupt("return", false);
|
|
947
977
|
case 41:
|
|
948
978
|
if (!(_item2.getSaveResultType() != "normal")) {
|
|
949
|
-
|
|
979
|
+
_context17.next = 43;
|
|
950
980
|
break;
|
|
951
981
|
}
|
|
952
|
-
return
|
|
982
|
+
return _context17.abrupt("return", false);
|
|
953
983
|
case 43:
|
|
954
984
|
_index2++;
|
|
955
|
-
|
|
985
|
+
_context17.next = 37;
|
|
956
986
|
break;
|
|
957
987
|
case 46:
|
|
958
|
-
return
|
|
988
|
+
return _context17.abrupt("return", true);
|
|
959
989
|
case 47:
|
|
960
990
|
case "end":
|
|
961
|
-
return
|
|
991
|
+
return _context17.stop();
|
|
962
992
|
}
|
|
963
|
-
},
|
|
993
|
+
}, _callee17, this);
|
|
964
994
|
}));
|
|
965
|
-
function saveList(
|
|
995
|
+
function saveList(_x7) {
|
|
966
996
|
return _saveList.apply(this, arguments);
|
|
967
997
|
}
|
|
968
998
|
return saveList;
|
|
@@ -1010,7 +1040,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1010
1040
|
}, {
|
|
1011
1041
|
key: "get_single",
|
|
1012
1042
|
value: (function () {
|
|
1013
|
-
var _get_single = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1043
|
+
var _get_single = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1014
1044
|
var _len8,
|
|
1015
1045
|
p,
|
|
1016
1046
|
_key8,
|
|
@@ -1019,55 +1049,55 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1019
1049
|
fetchID,
|
|
1020
1050
|
res,
|
|
1021
1051
|
params,
|
|
1022
|
-
|
|
1023
|
-
return _regeneratorRuntime().wrap(function
|
|
1024
|
-
while (1) switch (
|
|
1052
|
+
_args18 = arguments;
|
|
1053
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1054
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1025
1055
|
case 0:
|
|
1026
|
-
for (_len8 =
|
|
1027
|
-
p[_key8] =
|
|
1056
|
+
for (_len8 = _args18.length, p = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
1057
|
+
p[_key8] = _args18[_key8];
|
|
1028
1058
|
}
|
|
1029
1059
|
search = p.shift();
|
|
1030
1060
|
readonly = p.shift();
|
|
1031
1061
|
fetchID = p.shift();
|
|
1032
1062
|
if (!(0, _object.object_isEmpty)(search)) {
|
|
1033
|
-
|
|
1063
|
+
_context18.next = 6;
|
|
1034
1064
|
break;
|
|
1035
1065
|
}
|
|
1036
|
-
return
|
|
1066
|
+
return _context18.abrupt("return", undefined);
|
|
1037
1067
|
case 6:
|
|
1038
1068
|
params = {};
|
|
1039
1069
|
params.context = readonly ? "view" : "edit";
|
|
1040
|
-
|
|
1041
|
-
|
|
1070
|
+
_context18.t0 = _typeof(search);
|
|
1071
|
+
_context18.next = _context18.t0 === "string" ? 11 : _context18.t0 === "number" ? 11 : _context18.t0 === "object" ? 19 : 19;
|
|
1042
1072
|
break;
|
|
1043
1073
|
case 11:
|
|
1044
1074
|
search = String(search);
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1075
|
+
_context18.t1 = this;
|
|
1076
|
+
_context18.t2 = this;
|
|
1077
|
+
_context18.next = 16;
|
|
1048
1078
|
return _global.gfunc.run_action("get", this.__web_path + "/" + search, params, {
|
|
1049
1079
|
fetchID: fetchID
|
|
1050
1080
|
});
|
|
1051
1081
|
case 16:
|
|
1052
|
-
|
|
1053
|
-
res =
|
|
1054
|
-
return
|
|
1082
|
+
_context18.t3 = _context18.sent;
|
|
1083
|
+
res = _context18.t1.ensure.call(_context18.t1, _context18.t2, _context18.t3);
|
|
1084
|
+
return _context18.abrupt("break", 25);
|
|
1055
1085
|
case 19:
|
|
1056
|
-
|
|
1057
|
-
|
|
1086
|
+
_context18.t4 = _object.object_first;
|
|
1087
|
+
_context18.next = 22;
|
|
1058
1088
|
return this.get_list(search, readonly, fetchID);
|
|
1059
1089
|
case 22:
|
|
1060
|
-
|
|
1061
|
-
res = (0,
|
|
1062
|
-
return
|
|
1090
|
+
_context18.t5 = _context18.sent;
|
|
1091
|
+
res = (0, _context18.t4)(_context18.t5);
|
|
1092
|
+
return _context18.abrupt("break", 25);
|
|
1063
1093
|
case 25:
|
|
1064
1094
|
WebObject.setReadonly(res, readonly);
|
|
1065
|
-
return
|
|
1095
|
+
return _context18.abrupt("return", res);
|
|
1066
1096
|
case 27:
|
|
1067
1097
|
case "end":
|
|
1068
|
-
return
|
|
1098
|
+
return _context18.stop();
|
|
1069
1099
|
}
|
|
1070
|
-
},
|
|
1100
|
+
}, _callee18, this);
|
|
1071
1101
|
}));
|
|
1072
1102
|
function get_single() {
|
|
1073
1103
|
return _get_single.apply(this, arguments);
|
|
@@ -1082,7 +1112,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1082
1112
|
}, {
|
|
1083
1113
|
key: "get_list",
|
|
1084
1114
|
value: (function () {
|
|
1085
|
-
var _get_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1115
|
+
var _get_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1086
1116
|
var _len9,
|
|
1087
1117
|
p,
|
|
1088
1118
|
_key9,
|
|
@@ -1091,33 +1121,33 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1091
1121
|
fetchID,
|
|
1092
1122
|
result_items,
|
|
1093
1123
|
res,
|
|
1094
|
-
|
|
1095
|
-
return _regeneratorRuntime().wrap(function
|
|
1096
|
-
while (1) switch (
|
|
1124
|
+
_args19 = arguments;
|
|
1125
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1126
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1097
1127
|
case 0:
|
|
1098
|
-
for (_len9 =
|
|
1099
|
-
p[_key9] =
|
|
1128
|
+
for (_len9 = _args19.length, p = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
|
1129
|
+
p[_key9] = _args19[_key9];
|
|
1100
1130
|
}
|
|
1101
1131
|
search = p.shift();
|
|
1102
1132
|
readonly = p.shift();
|
|
1103
1133
|
fetchID = p.shift();
|
|
1104
1134
|
if (!search) search = {};
|
|
1105
|
-
|
|
1135
|
+
_context19.next = 7;
|
|
1106
1136
|
return _global.gfunc.run_action("get", this.get_webname(), search, {
|
|
1107
1137
|
fetchID: fetchID
|
|
1108
1138
|
});
|
|
1109
1139
|
case 7:
|
|
1110
|
-
result_items =
|
|
1140
|
+
result_items = _context19.sent;
|
|
1111
1141
|
// const selftype = (this.constructor ||
|
|
1112
1142
|
// Object.getPrototypeOf(this)) as any;
|
|
1113
1143
|
res = WebObject.map_rowindex(WebObject.mapto(this, result_items, readonly));
|
|
1114
1144
|
WebObject.setReadonly(res, readonly);
|
|
1115
|
-
return
|
|
1145
|
+
return _context19.abrupt("return", res);
|
|
1116
1146
|
case 11:
|
|
1117
1147
|
case "end":
|
|
1118
|
-
return
|
|
1148
|
+
return _context19.stop();
|
|
1119
1149
|
}
|
|
1120
|
-
},
|
|
1150
|
+
}, _callee19, this);
|
|
1121
1151
|
}));
|
|
1122
1152
|
function get_list() {
|
|
1123
1153
|
return _get_list.apply(this, arguments);
|
|
@@ -42,7 +42,7 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
|
|
|
42
42
|
args[_key] = arguments[_key];
|
|
43
43
|
}
|
|
44
44
|
_this = _callSuper(this, ObjectManager, [].concat(args));
|
|
45
|
-
_defineProperty(_assertThisInitialized(_this), "__eventList",
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "__eventList", {});
|
|
46
46
|
_defineProperty(_assertThisInitialized(_this), "__eventPrefix", void 0);
|
|
47
47
|
_defineProperty(_assertThisInitialized(_this), "__stopEvents", void 0);
|
|
48
48
|
_defineProperty(_assertThisInitialized(_this), "__currentObject", void 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azrico/webobject",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.132",
|
|
4
4
|
"description": "Stateful object",
|
|
5
5
|
"author": "Azrideus",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,9 +46,7 @@
|
|
|
46
46
|
"eslint-plugin-standard": "^4.0.1",
|
|
47
47
|
"gh-pages": "^2.2.0",
|
|
48
48
|
"husky": "^8.0.1",
|
|
49
|
-
"jest": "^27.0.5",
|
|
50
|
-
"microbundle-crl": "^0.13.10",
|
|
51
|
-
"npm-run-all": "^4.1.5",
|
|
49
|
+
"jest": "^27.0.5",
|
|
52
50
|
"prettier": "^2.0.4",
|
|
53
51
|
"prop-types": "^15.7.2",
|
|
54
52
|
"react": "^16.13.1",
|
|
@@ -72,7 +70,7 @@
|
|
|
72
70
|
},
|
|
73
71
|
"dependencies": {
|
|
74
72
|
"@azrico/convert": "^1.0.5",
|
|
75
|
-
"@azrico/event": "^1.2.
|
|
73
|
+
"@azrico/event": "^1.2.27",
|
|
76
74
|
"@azrico/global": "^1.3.69",
|
|
77
75
|
"@azrico/math": "^1.0.5",
|
|
78
76
|
"@azrico/object": "^1.4.101",
|