@azrico/webobject 1.4.22 → 1.4.25
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.
|
@@ -15,7 +15,7 @@ export declare class WebObject extends SimpleObject {
|
|
|
15
15
|
meta_data: MetaObject[];
|
|
16
16
|
_id: string;
|
|
17
17
|
_creator?: string;
|
|
18
|
-
_created_date
|
|
18
|
+
_created_date?: string | Date;
|
|
19
19
|
constructor(is_readonly?: boolean);
|
|
20
20
|
/**
|
|
21
21
|
* Update meta value of this object , meta data is stored in meta_data variable
|
|
@@ -75,6 +75,7 @@ export declare class WebObject extends SimpleObject {
|
|
|
75
75
|
onDelete(...p: any): Promise<any>;
|
|
76
76
|
onLoad(...p: any): Promise<any>;
|
|
77
77
|
onSave(...p: any): Promise<any>;
|
|
78
|
+
onAfterSave(...p: any): Promise<any>;
|
|
78
79
|
getSaveResult(original?: boolean): any;
|
|
79
80
|
onNew(...p: any): Promise<any>;
|
|
80
81
|
/**
|
|
@@ -48,7 +48,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
48
48
|
_defineProperty(_assertThisInitialized(_this), "meta_data", void 0);
|
|
49
49
|
_defineProperty(_assertThisInitialized(_this), "_id", "");
|
|
50
50
|
_defineProperty(_assertThisInitialized(_this), "_creator", void 0);
|
|
51
|
-
_defineProperty(_assertThisInitialized(_this), "_created_date",
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "_created_date", void 0);
|
|
52
52
|
_defineProperty(_assertThisInitialized(_this), "get_webtype", function () {
|
|
53
53
|
return _this.__web_type || _this.get_webpath();
|
|
54
54
|
});
|
|
@@ -459,8 +459,11 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
459
459
|
_context8.next = 13;
|
|
460
460
|
return (_this$manager4 = this.manager) === null || _this$manager4 === void 0 ? void 0 : _this$manager4.onSave.apply(_this$manager4, p);
|
|
461
461
|
case 13:
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
_context8.next = 15;
|
|
463
|
+
return this.onAfterSave();
|
|
464
|
+
case 15:
|
|
465
|
+
return _context8.abrupt("return", true);
|
|
466
|
+
case 16:
|
|
464
467
|
case "end":
|
|
465
468
|
return _context8.stop();
|
|
466
469
|
}
|
|
@@ -471,6 +474,36 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
471
474
|
}
|
|
472
475
|
return onSave;
|
|
473
476
|
}()
|
|
477
|
+
}, {
|
|
478
|
+
key: "onAfterSave",
|
|
479
|
+
value: function () {
|
|
480
|
+
var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
481
|
+
var _this$manager5;
|
|
482
|
+
var _len4,
|
|
483
|
+
p,
|
|
484
|
+
_key4,
|
|
485
|
+
_args9 = arguments;
|
|
486
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
487
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
488
|
+
case 0:
|
|
489
|
+
for (_len4 = _args9.length, p = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
490
|
+
p[_key4] = _args9[_key4];
|
|
491
|
+
}
|
|
492
|
+
_context9.next = 3;
|
|
493
|
+
return (_this$manager5 = this.manager) === null || _this$manager5 === void 0 ? void 0 : _this$manager5.onAfterSave.apply(_this$manager5, p);
|
|
494
|
+
case 3:
|
|
495
|
+
return _context9.abrupt("return", true);
|
|
496
|
+
case 4:
|
|
497
|
+
case "end":
|
|
498
|
+
return _context9.stop();
|
|
499
|
+
}
|
|
500
|
+
}, _callee9, this);
|
|
501
|
+
}));
|
|
502
|
+
function onAfterSave() {
|
|
503
|
+
return _onAfterSave.apply(this, arguments);
|
|
504
|
+
}
|
|
505
|
+
return onAfterSave;
|
|
506
|
+
}()
|
|
474
507
|
}, {
|
|
475
508
|
key: "getSaveResult",
|
|
476
509
|
value: function getSaveResult() {
|
|
@@ -489,27 +522,27 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
489
522
|
}, {
|
|
490
523
|
key: "onNew",
|
|
491
524
|
value: function () {
|
|
492
|
-
var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
493
|
-
var _this$
|
|
494
|
-
var
|
|
525
|
+
var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
526
|
+
var _this$manager6;
|
|
527
|
+
var _len5,
|
|
495
528
|
p,
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
return _regeneratorRuntime().wrap(function
|
|
499
|
-
while (1) switch (
|
|
529
|
+
_key5,
|
|
530
|
+
_args10 = arguments;
|
|
531
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
532
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
500
533
|
case 0:
|
|
501
|
-
for (
|
|
502
|
-
p[
|
|
534
|
+
for (_len5 = _args10.length, p = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
535
|
+
p[_key5] = _args10[_key5];
|
|
503
536
|
}
|
|
504
|
-
|
|
505
|
-
return (_this$
|
|
537
|
+
_context10.next = 3;
|
|
538
|
+
return (_this$manager6 = this.manager) === null || _this$manager6 === void 0 ? void 0 : _this$manager6.onNew.apply(_this$manager6, p);
|
|
506
539
|
case 3:
|
|
507
|
-
return
|
|
540
|
+
return _context10.abrupt("return", _context10.sent);
|
|
508
541
|
case 4:
|
|
509
542
|
case "end":
|
|
510
|
-
return
|
|
543
|
+
return _context10.stop();
|
|
511
544
|
}
|
|
512
|
-
},
|
|
545
|
+
}, _callee10, this);
|
|
513
546
|
}));
|
|
514
547
|
function onNew() {
|
|
515
548
|
return _onNew.apply(this, arguments);
|
|
@@ -550,7 +583,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
550
583
|
}, {
|
|
551
584
|
key: "saveList",
|
|
552
585
|
value: function () {
|
|
553
|
-
var _saveList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
586
|
+
var _saveList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(itemList) {
|
|
554
587
|
var _extraOptions$chunksi;
|
|
555
588
|
var extraOptions,
|
|
556
589
|
chunks,
|
|
@@ -567,11 +600,11 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
567
600
|
_item,
|
|
568
601
|
_index2,
|
|
569
602
|
_item2,
|
|
570
|
-
|
|
571
|
-
return _regeneratorRuntime().wrap(function
|
|
572
|
-
while (1) switch (
|
|
603
|
+
_args11 = arguments;
|
|
604
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
605
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
573
606
|
case 0:
|
|
574
|
-
extraOptions =
|
|
607
|
+
extraOptions = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
|
|
575
608
|
if (!extraOptions) extraOptions = {};
|
|
576
609
|
chunks = (0, _object.array_chunks)(itemList, (_extraOptions$chunksi = extraOptions.chunksize) !== null && _extraOptions$chunksi !== void 0 ? _extraOptions$chunksi : 50);
|
|
577
610
|
delete extraOptions.chunksize;
|
|
@@ -579,7 +612,7 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
579
612
|
index = 0;
|
|
580
613
|
case 6:
|
|
581
614
|
if (!(index < chunks.length)) {
|
|
582
|
-
|
|
615
|
+
_context11.next = 36;
|
|
583
616
|
break;
|
|
584
617
|
}
|
|
585
618
|
items_to_save = chunks[index];
|
|
@@ -587,81 +620,81 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
587
620
|
k = 0;
|
|
588
621
|
case 10:
|
|
589
622
|
if (!(k < items_to_save.length)) {
|
|
590
|
-
|
|
623
|
+
_context11.next = 19;
|
|
591
624
|
break;
|
|
592
625
|
}
|
|
593
626
|
item = items_to_save[k];
|
|
594
|
-
|
|
627
|
+
_context11.next = 14;
|
|
595
628
|
return item.get_deltaObject();
|
|
596
629
|
case 14:
|
|
597
|
-
dlt =
|
|
630
|
+
dlt = _context11.sent;
|
|
598
631
|
save_array.push(item.isNew ? _objectSpread({}, dlt) : _objectSpread({
|
|
599
632
|
_id: item.getID()
|
|
600
633
|
}, dlt));
|
|
601
634
|
case 16:
|
|
602
635
|
k++;
|
|
603
|
-
|
|
636
|
+
_context11.next = 10;
|
|
604
637
|
break;
|
|
605
638
|
case 19:
|
|
606
|
-
|
|
639
|
+
_context11.next = 21;
|
|
607
640
|
return _global.gfunc.run_action("post", putAddress, _objectSpread({
|
|
608
641
|
__save_list: save_array
|
|
609
642
|
}, extraOptions));
|
|
610
643
|
case 21:
|
|
611
|
-
resultObject =
|
|
644
|
+
resultObject = _context11.sent;
|
|
612
645
|
if (!Array.isArray(resultObject)) {
|
|
613
|
-
|
|
646
|
+
_context11.next = 33;
|
|
614
647
|
break;
|
|
615
648
|
}
|
|
616
649
|
_index = 0;
|
|
617
650
|
case 24:
|
|
618
651
|
if (!(_index < Math.min(resultObject.length, items_to_save.length))) {
|
|
619
|
-
|
|
652
|
+
_context11.next = 33;
|
|
620
653
|
break;
|
|
621
654
|
}
|
|
622
655
|
res = resultObject[_index];
|
|
623
656
|
_item = items_to_save[_index];
|
|
624
657
|
_item.setSaveResult(res);
|
|
625
|
-
|
|
658
|
+
_context11.next = 30;
|
|
626
659
|
return _item.onSave();
|
|
627
660
|
case 30:
|
|
628
661
|
_index++;
|
|
629
|
-
|
|
662
|
+
_context11.next = 24;
|
|
630
663
|
break;
|
|
631
664
|
case 33:
|
|
632
665
|
index++;
|
|
633
|
-
|
|
666
|
+
_context11.next = 6;
|
|
634
667
|
break;
|
|
635
668
|
case 36:
|
|
636
669
|
_index2 = 0;
|
|
637
670
|
case 37:
|
|
638
671
|
if (!(_index2 < itemList.length)) {
|
|
639
|
-
|
|
672
|
+
_context11.next = 46;
|
|
640
673
|
break;
|
|
641
674
|
}
|
|
642
675
|
_item2 = itemList[_index2];
|
|
643
676
|
if (_item2.isSaved) {
|
|
644
|
-
|
|
677
|
+
_context11.next = 41;
|
|
645
678
|
break;
|
|
646
679
|
}
|
|
647
|
-
return
|
|
680
|
+
return _context11.abrupt("return", false);
|
|
648
681
|
case 41:
|
|
649
682
|
if (!(_item2.getSaveResultType() != "normal")) {
|
|
650
|
-
|
|
683
|
+
_context11.next = 43;
|
|
651
684
|
break;
|
|
652
685
|
}
|
|
653
|
-
return
|
|
686
|
+
return _context11.abrupt("return", false);
|
|
654
687
|
case 43:
|
|
655
688
|
_index2++;
|
|
656
|
-
|
|
689
|
+
_context11.next = 37;
|
|
657
690
|
break;
|
|
658
691
|
case 46:
|
|
659
|
-
return
|
|
692
|
+
return _context11.abrupt("return", true);
|
|
660
693
|
case 47:
|
|
661
694
|
case "end":
|
|
662
|
-
return
|
|
695
|
+
return _context11.stop();
|
|
663
696
|
}
|
|
664
|
-
},
|
|
697
|
+
}, _callee11, this);
|
|
665
698
|
}));
|
|
666
699
|
function saveList(_x4) {
|
|
667
700
|
return _saveList.apply(this, arguments);
|
|
@@ -685,64 +718,64 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
685
718
|
}, {
|
|
686
719
|
key: "get_single",
|
|
687
720
|
value: function () {
|
|
688
|
-
var _get_single = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
689
|
-
var
|
|
721
|
+
var _get_single = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
722
|
+
var _len6,
|
|
690
723
|
p,
|
|
691
|
-
|
|
724
|
+
_key6,
|
|
692
725
|
search,
|
|
693
726
|
readonly,
|
|
694
727
|
fetchID,
|
|
695
728
|
res,
|
|
696
729
|
params,
|
|
697
|
-
|
|
698
|
-
return _regeneratorRuntime().wrap(function
|
|
699
|
-
while (1) switch (
|
|
730
|
+
_args12 = arguments;
|
|
731
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
732
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
700
733
|
case 0:
|
|
701
|
-
for (
|
|
702
|
-
p[
|
|
734
|
+
for (_len6 = _args12.length, p = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
735
|
+
p[_key6] = _args12[_key6];
|
|
703
736
|
}
|
|
704
737
|
search = p.shift();
|
|
705
738
|
readonly = p.shift();
|
|
706
739
|
fetchID = p.shift();
|
|
707
740
|
if (!(0, _object.object_isEmpty)(search)) {
|
|
708
|
-
|
|
741
|
+
_context12.next = 6;
|
|
709
742
|
break;
|
|
710
743
|
}
|
|
711
|
-
return
|
|
744
|
+
return _context12.abrupt("return", undefined);
|
|
712
745
|
case 6:
|
|
713
746
|
params = {};
|
|
714
747
|
params.context = readonly ? "view" : "edit";
|
|
715
|
-
|
|
716
|
-
|
|
748
|
+
_context12.t0 = _typeof(search);
|
|
749
|
+
_context12.next = _context12.t0 === "string" ? 11 : _context12.t0 === "number" ? 11 : _context12.t0 === "object" ? 19 : 19;
|
|
717
750
|
break;
|
|
718
751
|
case 11:
|
|
719
752
|
search = String(search);
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
753
|
+
_context12.t1 = this;
|
|
754
|
+
_context12.t2 = this;
|
|
755
|
+
_context12.next = 16;
|
|
723
756
|
return _global.gfunc.run_action("get", this.__web_path + "/" + search, params, {
|
|
724
757
|
fetchID: fetchID
|
|
725
758
|
});
|
|
726
759
|
case 16:
|
|
727
|
-
|
|
728
|
-
res =
|
|
729
|
-
return
|
|
760
|
+
_context12.t3 = _context12.sent;
|
|
761
|
+
res = _context12.t1.ensure.call(_context12.t1, _context12.t2, _context12.t3);
|
|
762
|
+
return _context12.abrupt("break", 25);
|
|
730
763
|
case 19:
|
|
731
|
-
|
|
732
|
-
|
|
764
|
+
_context12.t4 = _object.object_first;
|
|
765
|
+
_context12.next = 22;
|
|
733
766
|
return this.get_list(search, readonly, fetchID);
|
|
734
767
|
case 22:
|
|
735
|
-
|
|
736
|
-
res = (0,
|
|
737
|
-
return
|
|
768
|
+
_context12.t5 = _context12.sent;
|
|
769
|
+
res = (0, _context12.t4)(_context12.t5);
|
|
770
|
+
return _context12.abrupt("break", 25);
|
|
738
771
|
case 25:
|
|
739
772
|
WebObject.setReadonly(res, readonly);
|
|
740
|
-
return
|
|
773
|
+
return _context12.abrupt("return", res);
|
|
741
774
|
case 27:
|
|
742
775
|
case "end":
|
|
743
|
-
return
|
|
776
|
+
return _context12.stop();
|
|
744
777
|
}
|
|
745
|
-
},
|
|
778
|
+
}, _callee12, this);
|
|
746
779
|
}));
|
|
747
780
|
function get_single() {
|
|
748
781
|
return _get_single.apply(this, arguments);
|
|
@@ -756,42 +789,42 @@ var WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
756
789
|
}, {
|
|
757
790
|
key: "get_list",
|
|
758
791
|
value: function () {
|
|
759
|
-
var _get_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
760
|
-
var
|
|
792
|
+
var _get_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
793
|
+
var _len7,
|
|
761
794
|
p,
|
|
762
|
-
|
|
795
|
+
_key7,
|
|
763
796
|
search,
|
|
764
797
|
readonly,
|
|
765
798
|
fetchID,
|
|
766
799
|
result_items,
|
|
767
800
|
selftype,
|
|
768
801
|
res,
|
|
769
|
-
|
|
770
|
-
return _regeneratorRuntime().wrap(function
|
|
771
|
-
while (1) switch (
|
|
802
|
+
_args13 = arguments;
|
|
803
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
804
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
772
805
|
case 0:
|
|
773
|
-
for (
|
|
774
|
-
p[
|
|
806
|
+
for (_len7 = _args13.length, p = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
807
|
+
p[_key7] = _args13[_key7];
|
|
775
808
|
}
|
|
776
809
|
search = p.shift();
|
|
777
810
|
readonly = p.shift();
|
|
778
811
|
fetchID = p.shift();
|
|
779
812
|
if (!search) search = {};
|
|
780
|
-
|
|
813
|
+
_context13.next = 7;
|
|
781
814
|
return _global.gfunc.run_action("get", this.__web_path, search, {
|
|
782
815
|
fetchID: fetchID
|
|
783
816
|
});
|
|
784
817
|
case 7:
|
|
785
|
-
result_items =
|
|
818
|
+
result_items = _context13.sent;
|
|
786
819
|
selftype = this.prototype;
|
|
787
820
|
res = WebObject.map_rowindex(WebObject.mapto(selftype, result_items, readonly));
|
|
788
821
|
WebObject.setReadonly(res, readonly);
|
|
789
|
-
return
|
|
822
|
+
return _context13.abrupt("return", res);
|
|
790
823
|
case 12:
|
|
791
824
|
case "end":
|
|
792
|
-
return
|
|
825
|
+
return _context13.stop();
|
|
793
826
|
}
|
|
794
|
-
},
|
|
827
|
+
}, _callee13, this);
|
|
795
828
|
}));
|
|
796
829
|
function get_list() {
|
|
797
830
|
return _get_list.apply(this, arguments);
|
|
@@ -349,16 +349,10 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
|
|
|
349
349
|
return this.event_run("on_change", true);
|
|
350
350
|
case 4:
|
|
351
351
|
_context8.next = 6;
|
|
352
|
-
return this.event_run("on_after_save");
|
|
353
|
-
case 6:
|
|
354
|
-
_context8.next = 8;
|
|
355
|
-
return this.event_run("on_save_finished");
|
|
356
|
-
case 8:
|
|
357
|
-
_context8.next = 10;
|
|
358
352
|
return Promise.resolve(true);
|
|
359
|
-
case
|
|
353
|
+
case 6:
|
|
360
354
|
return _context8.abrupt("return", _context8.sent);
|
|
361
|
-
case
|
|
355
|
+
case 7:
|
|
362
356
|
case "end":
|
|
363
357
|
return _context8.stop();
|
|
364
358
|
}
|
|
@@ -369,6 +363,34 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
|
|
|
369
363
|
}
|
|
370
364
|
return onSave;
|
|
371
365
|
}()
|
|
366
|
+
}, {
|
|
367
|
+
key: "onAfterSave",
|
|
368
|
+
value: function () {
|
|
369
|
+
var _onAfterSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
370
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
371
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
372
|
+
case 0:
|
|
373
|
+
_context9.next = 2;
|
|
374
|
+
return this.event_run("on_after_save");
|
|
375
|
+
case 2:
|
|
376
|
+
_context9.next = 4;
|
|
377
|
+
return this.event_run("on_save_finished");
|
|
378
|
+
case 4:
|
|
379
|
+
_context9.next = 6;
|
|
380
|
+
return Promise.resolve(true);
|
|
381
|
+
case 6:
|
|
382
|
+
return _context9.abrupt("return", _context9.sent);
|
|
383
|
+
case 7:
|
|
384
|
+
case "end":
|
|
385
|
+
return _context9.stop();
|
|
386
|
+
}
|
|
387
|
+
}, _callee9, this);
|
|
388
|
+
}));
|
|
389
|
+
function onAfterSave() {
|
|
390
|
+
return _onAfterSave.apply(this, arguments);
|
|
391
|
+
}
|
|
392
|
+
return onAfterSave;
|
|
393
|
+
}()
|
|
372
394
|
}]);
|
|
373
395
|
return WebObjectManager;
|
|
374
396
|
}(_ObjectManager2["default"]);
|