@azrico/webobject 1.5.3 → 1.5.5
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/WebObjectManager.d.ts +6 -6
- package/dist/src/WebObjects/WebObjectManager.js +81 -72
- package/dist/src/structs/ObjectManager.d.ts +1 -1
- package/dist/src/structs/ObjectManager.js +21 -4
- package/dist/src/structs/SimpleObject.d.ts +0 -2
- package/dist/src/structs/SimpleObject.js +40 -45
- package/package.json +1 -1
|
@@ -32,12 +32,6 @@ export declare class WebObjectManager<ObjType extends WebObject> extends ObjectM
|
|
|
32
32
|
get __object_name(): string;
|
|
33
33
|
get_webpath(): string;
|
|
34
34
|
private __getObjectData;
|
|
35
|
-
/**
|
|
36
|
-
* Use this when you load new Object
|
|
37
|
-
* @param p
|
|
38
|
-
* @returns
|
|
39
|
-
*/
|
|
40
|
-
onNew(...p: any): Promise<any>;
|
|
41
35
|
/**
|
|
42
36
|
* Use this when you delete Object
|
|
43
37
|
* @param p
|
|
@@ -48,6 +42,12 @@ export declare class WebObjectManager<ObjType extends WebObject> extends ObjectM
|
|
|
48
42
|
onUnArchive(...p: any): Promise<any>;
|
|
49
43
|
onLock(...p: any): Promise<any>;
|
|
50
44
|
onUnLock(...p: any): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Use this when you load new Object
|
|
47
|
+
* @param p
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
onNew(...p: any): Promise<any>;
|
|
51
51
|
/**
|
|
52
52
|
* Use this when you load data to the object
|
|
53
53
|
* @param p
|
|
@@ -550,65 +550,51 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
|
|
|
550
550
|
/* Default Events */
|
|
551
551
|
/* -------------------------------------------------------------------------- */
|
|
552
552
|
/**
|
|
553
|
-
* Use this when you
|
|
553
|
+
* Use this when you delete Object
|
|
554
554
|
* @param p
|
|
555
555
|
* @returns
|
|
556
556
|
*/
|
|
557
557
|
}, {
|
|
558
|
-
key: "
|
|
558
|
+
key: "onDelete",
|
|
559
559
|
value: (function () {
|
|
560
|
-
var
|
|
561
|
-
var
|
|
560
|
+
var _onDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
561
|
+
var srt;
|
|
562
562
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
563
563
|
while (1) switch (_context14.prev = _context14.next) {
|
|
564
564
|
case 0:
|
|
565
|
-
|
|
566
|
-
(_this$obj11 = this.obj) === null || _this$obj11 === void 0 || _this$obj11.setOriginal();
|
|
567
|
-
}
|
|
565
|
+
srt = this.getSaveResultType();
|
|
568
566
|
_context14.next = 3;
|
|
569
|
-
return this.event_run("
|
|
567
|
+
return this.event_run("on_delete", srt);
|
|
570
568
|
case 3:
|
|
571
569
|
_context14.next = 5;
|
|
572
|
-
return this.event_run("
|
|
570
|
+
return this.event_run("on_after_delete", srt);
|
|
573
571
|
case 5:
|
|
574
|
-
_context14.
|
|
575
|
-
|
|
576
|
-
case 7:
|
|
577
|
-
_context14.next = 9;
|
|
578
|
-
return Promise.resolve(true);
|
|
579
|
-
case 9:
|
|
580
|
-
return _context14.abrupt("return", _context14.sent);
|
|
581
|
-
case 10:
|
|
572
|
+
return _context14.abrupt("return", true);
|
|
573
|
+
case 6:
|
|
582
574
|
case "end":
|
|
583
575
|
return _context14.stop();
|
|
584
576
|
}
|
|
585
577
|
}, _callee14, this);
|
|
586
578
|
}));
|
|
587
|
-
function
|
|
588
|
-
return
|
|
579
|
+
function onDelete() {
|
|
580
|
+
return _onDelete.apply(this, arguments);
|
|
589
581
|
}
|
|
590
|
-
return
|
|
591
|
-
}()
|
|
592
|
-
/**
|
|
593
|
-
* Use this when you delete Object
|
|
594
|
-
* @param p
|
|
595
|
-
* @returns
|
|
596
|
-
*/
|
|
597
|
-
)
|
|
582
|
+
return onDelete;
|
|
583
|
+
}())
|
|
598
584
|
}, {
|
|
599
|
-
key: "
|
|
600
|
-
value:
|
|
601
|
-
var
|
|
585
|
+
key: "onArchive",
|
|
586
|
+
value: function () {
|
|
587
|
+
var _onArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
602
588
|
var srt;
|
|
603
589
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
604
590
|
while (1) switch (_context15.prev = _context15.next) {
|
|
605
591
|
case 0:
|
|
606
592
|
srt = this.getSaveResultType();
|
|
607
593
|
_context15.next = 3;
|
|
608
|
-
return this.event_run("
|
|
594
|
+
return this.event_run("on_archive", srt);
|
|
609
595
|
case 3:
|
|
610
596
|
_context15.next = 5;
|
|
611
|
-
return this.event_run("
|
|
597
|
+
return this.event_run("on_after_archive", srt);
|
|
612
598
|
case 5:
|
|
613
599
|
return _context15.abrupt("return", true);
|
|
614
600
|
case 6:
|
|
@@ -617,25 +603,25 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
|
|
|
617
603
|
}
|
|
618
604
|
}, _callee15, this);
|
|
619
605
|
}));
|
|
620
|
-
function
|
|
621
|
-
return
|
|
606
|
+
function onArchive() {
|
|
607
|
+
return _onArchive.apply(this, arguments);
|
|
622
608
|
}
|
|
623
|
-
return
|
|
624
|
-
}()
|
|
609
|
+
return onArchive;
|
|
610
|
+
}()
|
|
625
611
|
}, {
|
|
626
|
-
key: "
|
|
612
|
+
key: "onUnArchive",
|
|
627
613
|
value: function () {
|
|
628
|
-
var
|
|
614
|
+
var _onUnArchive = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
629
615
|
var srt;
|
|
630
616
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
631
617
|
while (1) switch (_context16.prev = _context16.next) {
|
|
632
618
|
case 0:
|
|
633
619
|
srt = this.getSaveResultType();
|
|
634
620
|
_context16.next = 3;
|
|
635
|
-
return this.event_run("
|
|
621
|
+
return this.event_run("on_unarchive", srt);
|
|
636
622
|
case 3:
|
|
637
623
|
_context16.next = 5;
|
|
638
|
-
return this.event_run("
|
|
624
|
+
return this.event_run("on_after_unarchive", srt);
|
|
639
625
|
case 5:
|
|
640
626
|
return _context16.abrupt("return", true);
|
|
641
627
|
case 6:
|
|
@@ -644,25 +630,25 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
|
|
|
644
630
|
}
|
|
645
631
|
}, _callee16, this);
|
|
646
632
|
}));
|
|
647
|
-
function
|
|
648
|
-
return
|
|
633
|
+
function onUnArchive() {
|
|
634
|
+
return _onUnArchive.apply(this, arguments);
|
|
649
635
|
}
|
|
650
|
-
return
|
|
636
|
+
return onUnArchive;
|
|
651
637
|
}()
|
|
652
638
|
}, {
|
|
653
|
-
key: "
|
|
639
|
+
key: "onLock",
|
|
654
640
|
value: function () {
|
|
655
|
-
var
|
|
641
|
+
var _onLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
656
642
|
var srt;
|
|
657
643
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
658
644
|
while (1) switch (_context17.prev = _context17.next) {
|
|
659
645
|
case 0:
|
|
660
646
|
srt = this.getSaveResultType();
|
|
661
647
|
_context17.next = 3;
|
|
662
|
-
return this.event_run("
|
|
648
|
+
return this.event_run("on_lock", srt);
|
|
663
649
|
case 3:
|
|
664
650
|
_context17.next = 5;
|
|
665
|
-
return this.event_run("
|
|
651
|
+
return this.event_run("on_after_lock", srt);
|
|
666
652
|
case 5:
|
|
667
653
|
return _context17.abrupt("return", true);
|
|
668
654
|
case 6:
|
|
@@ -671,25 +657,25 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
|
|
|
671
657
|
}
|
|
672
658
|
}, _callee17, this);
|
|
673
659
|
}));
|
|
674
|
-
function
|
|
675
|
-
return
|
|
660
|
+
function onLock() {
|
|
661
|
+
return _onLock.apply(this, arguments);
|
|
676
662
|
}
|
|
677
|
-
return
|
|
663
|
+
return onLock;
|
|
678
664
|
}()
|
|
679
665
|
}, {
|
|
680
|
-
key: "
|
|
666
|
+
key: "onUnLock",
|
|
681
667
|
value: function () {
|
|
682
|
-
var
|
|
668
|
+
var _onUnLock = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
683
669
|
var srt;
|
|
684
670
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
685
671
|
while (1) switch (_context18.prev = _context18.next) {
|
|
686
672
|
case 0:
|
|
687
673
|
srt = this.getSaveResultType();
|
|
688
674
|
_context18.next = 3;
|
|
689
|
-
return this.event_run("
|
|
675
|
+
return this.event_run("on_unlock", srt);
|
|
690
676
|
case 3:
|
|
691
677
|
_context18.next = 5;
|
|
692
|
-
return this.event_run("
|
|
678
|
+
return this.event_run("on_after_unlock", srt);
|
|
693
679
|
case 5:
|
|
694
680
|
return _context18.abrupt("return", true);
|
|
695
681
|
case 6:
|
|
@@ -698,43 +684,60 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
|
|
|
698
684
|
}
|
|
699
685
|
}, _callee18, this);
|
|
700
686
|
}));
|
|
701
|
-
function
|
|
702
|
-
return
|
|
687
|
+
function onUnLock() {
|
|
688
|
+
return _onUnLock.apply(this, arguments);
|
|
703
689
|
}
|
|
704
|
-
return
|
|
690
|
+
return onUnLock;
|
|
705
691
|
}()
|
|
692
|
+
/**
|
|
693
|
+
* Use this when you load new Object
|
|
694
|
+
* @param p
|
|
695
|
+
* @returns
|
|
696
|
+
*/
|
|
706
697
|
}, {
|
|
707
|
-
key: "
|
|
708
|
-
value: function () {
|
|
709
|
-
var
|
|
710
|
-
var
|
|
698
|
+
key: "onNew",
|
|
699
|
+
value: (function () {
|
|
700
|
+
var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
701
|
+
var _this$obj11;
|
|
711
702
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
712
703
|
while (1) switch (_context19.prev = _context19.next) {
|
|
713
704
|
case 0:
|
|
714
|
-
|
|
705
|
+
if (this.canModify) {
|
|
706
|
+
(_this$obj11 = this.obj) === null || _this$obj11 === void 0 || _this$obj11.setOriginal();
|
|
707
|
+
}
|
|
715
708
|
_context19.next = 3;
|
|
716
|
-
return this.event_run("
|
|
709
|
+
return this.event_run("on_new");
|
|
717
710
|
case 3:
|
|
718
711
|
_context19.next = 5;
|
|
719
|
-
return this.event_run("
|
|
712
|
+
return this.event_run("on_change", true);
|
|
720
713
|
case 5:
|
|
721
|
-
|
|
722
|
-
|
|
714
|
+
_context19.next = 7;
|
|
715
|
+
return this.event_run("on_after_new");
|
|
716
|
+
case 7:
|
|
717
|
+
_context19.next = 9;
|
|
718
|
+
return this.checkIsChanged();
|
|
719
|
+
case 9:
|
|
720
|
+
_context19.next = 11;
|
|
721
|
+
return Promise.resolve(true);
|
|
722
|
+
case 11:
|
|
723
|
+
return _context19.abrupt("return", _context19.sent);
|
|
724
|
+
case 12:
|
|
723
725
|
case "end":
|
|
724
726
|
return _context19.stop();
|
|
725
727
|
}
|
|
726
728
|
}, _callee19, this);
|
|
727
729
|
}));
|
|
728
|
-
function
|
|
729
|
-
return
|
|
730
|
+
function onNew() {
|
|
731
|
+
return _onNew.apply(this, arguments);
|
|
730
732
|
}
|
|
731
|
-
return
|
|
733
|
+
return onNew;
|
|
732
734
|
}()
|
|
733
735
|
/**
|
|
734
736
|
* Use this when you load data to the object
|
|
735
737
|
* @param p
|
|
736
738
|
* @returns
|
|
737
739
|
*/
|
|
740
|
+
)
|
|
738
741
|
}, {
|
|
739
742
|
key: "onLoad",
|
|
740
743
|
value: (function () {
|
|
@@ -758,8 +761,11 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
|
|
|
758
761
|
_context20.next = 9;
|
|
759
762
|
return this.event_run("on_load_finished");
|
|
760
763
|
case 9:
|
|
764
|
+
_context20.next = 11;
|
|
765
|
+
return this.checkIsChanged();
|
|
766
|
+
case 11:
|
|
761
767
|
return _context20.abrupt("return", true);
|
|
762
|
-
case
|
|
768
|
+
case 12:
|
|
763
769
|
case "end":
|
|
764
770
|
return _context20.stop();
|
|
765
771
|
}
|
|
@@ -792,10 +798,13 @@ var WebObjectManager = exports.WebObjectManager = /*#__PURE__*/function (_Object
|
|
|
792
798
|
return this.event_run("on_change", true);
|
|
793
799
|
case 5:
|
|
794
800
|
_context21.next = 7;
|
|
795
|
-
return
|
|
801
|
+
return this.checkIsChanged();
|
|
796
802
|
case 7:
|
|
803
|
+
_context21.next = 9;
|
|
804
|
+
return Promise.resolve(true);
|
|
805
|
+
case 9:
|
|
797
806
|
return _context21.abrupt("return", _context21.sent);
|
|
798
|
-
case
|
|
807
|
+
case 10:
|
|
799
808
|
case "end":
|
|
800
809
|
return _context21.stop();
|
|
801
810
|
}
|
|
@@ -123,10 +123,10 @@ export declare class ObjectManager<ObjType extends SimpleObject> extends RawObje
|
|
|
123
123
|
getErrors(): any[];
|
|
124
124
|
clearErrors(): boolean;
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
127
126
|
* @returns isChanged
|
|
128
127
|
*/
|
|
129
128
|
useIsChanged(): any;
|
|
129
|
+
checkIsChanged(): Promise<void>;
|
|
130
130
|
static addError(o?: ObjectManager<any>, title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
|
|
131
131
|
static getErrors(o: ObjectManager<any>): any[];
|
|
132
132
|
static clearErrors(o: ObjectManager<any>): boolean;
|
|
@@ -712,18 +712,35 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
|
|
|
712
712
|
value: function clearErrors() {
|
|
713
713
|
return ObjectManager.clearErrors(this);
|
|
714
714
|
}
|
|
715
|
-
/*
|
|
715
|
+
/* ------------------------------ useIsChanged; ----------------------------- */
|
|
716
716
|
/**
|
|
717
|
-
*
|
|
718
717
|
* @returns isChanged
|
|
719
718
|
*/
|
|
720
719
|
}, {
|
|
721
720
|
key: "useIsChanged",
|
|
722
721
|
value: function useIsChanged() {
|
|
723
722
|
return this.useOption("ischanged");
|
|
724
|
-
//// return this.event_use("on_{change,save,load}", () => this.isChanged);
|
|
725
723
|
}
|
|
726
|
-
|
|
724
|
+
}, {
|
|
725
|
+
key: "checkIsChanged",
|
|
726
|
+
value: function () {
|
|
727
|
+
var _checkIsChanged = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
728
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
729
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
730
|
+
case 0:
|
|
731
|
+
_context12.next = 2;
|
|
732
|
+
return this.setOption("ischanged", this.isChanged);
|
|
733
|
+
case 2:
|
|
734
|
+
case "end":
|
|
735
|
+
return _context12.stop();
|
|
736
|
+
}
|
|
737
|
+
}, _callee12, this);
|
|
738
|
+
}));
|
|
739
|
+
function checkIsChanged() {
|
|
740
|
+
return _checkIsChanged.apply(this, arguments);
|
|
741
|
+
}
|
|
742
|
+
return checkIsChanged;
|
|
743
|
+
}()
|
|
727
744
|
}, {
|
|
728
745
|
key: "getObjectType",
|
|
729
746
|
value: /* -------------------------------------------------------------------------- */
|
|
@@ -28,7 +28,6 @@ export declare class SimpleObject extends MapableObject {
|
|
|
28
28
|
_static(): Function;
|
|
29
29
|
protected __originalobject?: this;
|
|
30
30
|
protected __delta: Partial<this>;
|
|
31
|
-
protected __has_delta: boolean;
|
|
32
31
|
protected __lastChanged?: string;
|
|
33
32
|
protected __is_readonly?: boolean;
|
|
34
33
|
protected __throw_errors?: boolean;
|
|
@@ -66,7 +65,6 @@ export declare class SimpleObject extends MapableObject {
|
|
|
66
65
|
* if the field is not in delta instantly calls the `apply` function to remove from delta
|
|
67
66
|
* @param key
|
|
68
67
|
* @param value
|
|
69
|
-
* @returns true if `apply` function is used
|
|
70
68
|
*/
|
|
71
69
|
setPreferApply(key: WriteablePropOf<this>, value: any, shouldNotify?: sendChangesType): Promise<boolean>;
|
|
72
70
|
/**
|
|
@@ -52,7 +52,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
52
52
|
_defineProperty(_this, "__originalobject", void 0);
|
|
53
53
|
//changes are saved here
|
|
54
54
|
_defineProperty(_this, "__delta", {});
|
|
55
|
-
|
|
55
|
+
//// protected __has_delta: boolean = false;
|
|
56
56
|
//the last thing that was changed on this object
|
|
57
57
|
_defineProperty(_this, "__lastChanged", void 0);
|
|
58
58
|
//is the object read only
|
|
@@ -136,7 +136,6 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
136
136
|
old_value,
|
|
137
137
|
needsChange,
|
|
138
138
|
_this$manager,
|
|
139
|
-
__has_delta_isChanged,
|
|
140
139
|
_args = arguments;
|
|
141
140
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
142
141
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -163,15 +162,12 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
163
162
|
ignoredStartingWords: "_"
|
|
164
163
|
});
|
|
165
164
|
if (needsChange) {
|
|
166
|
-
|
|
165
|
+
_assertClassBrand(_SimpleObject_brand, this, _setProperty).call(this, key, value);
|
|
167
166
|
/**
|
|
168
167
|
* notify the manager when the state of `__has_delta` is changed
|
|
169
168
|
* managers can use this to detect if they need to save
|
|
170
169
|
*/
|
|
171
|
-
(_this$manager = this.manager) === null || _this$manager === void 0 || _this$manager.
|
|
172
|
-
////if (__has_delta_isChanged && this.manager) {
|
|
173
|
-
//// this.manager.setOption("hasDelta", this.__has_delta);
|
|
174
|
-
////}
|
|
170
|
+
(_this$manager = this.manager) === null || _this$manager === void 0 || _this$manager.checkIsChanged();
|
|
175
171
|
}
|
|
176
172
|
/**
|
|
177
173
|
* if the field is not in delta
|
|
@@ -207,7 +203,6 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
207
203
|
* if the field is not in delta instantly calls the `apply` function to remove from delta
|
|
208
204
|
* @param key
|
|
209
205
|
* @param value
|
|
210
|
-
* @returns true if `apply` function is used
|
|
211
206
|
*/
|
|
212
207
|
)
|
|
213
208
|
}, {
|
|
@@ -832,7 +827,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
832
827
|
key: "clear_changes",
|
|
833
828
|
value: function clear_changes() {
|
|
834
829
|
this.__delta = {};
|
|
835
|
-
this.__has_delta = false;
|
|
830
|
+
////this.__has_delta = false;
|
|
836
831
|
return true;
|
|
837
832
|
}
|
|
838
833
|
/**
|
|
@@ -872,11 +867,11 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
872
867
|
////if (!deltaIsBlank) return true; //delta is not blank, definitely changed
|
|
873
868
|
////if (this.__use_delta) return !deltaIsBlank; //trust the delta.
|
|
874
869
|
if (this.__use_delta) {
|
|
875
|
-
return this.__has_delta;
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
870
|
+
////return this.__has_delta;
|
|
871
|
+
for (var key in this.__delta) {
|
|
872
|
+
return true;
|
|
873
|
+
}
|
|
874
|
+
return false;
|
|
880
875
|
}
|
|
881
876
|
/* --------------------- check the properties one by one -------------------- */
|
|
882
877
|
var orig = this.getOriginal();
|
|
@@ -891,9 +886,9 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
891
886
|
}) != undefined;
|
|
892
887
|
} else {
|
|
893
888
|
/* check all fields */
|
|
894
|
-
for (var
|
|
895
|
-
if (
|
|
896
|
-
if (!(0, _object.object_equals)(this[
|
|
889
|
+
for (var _key2 in this) {
|
|
890
|
+
if (_key2.startsWith("__")) continue;
|
|
891
|
+
if (!(0, _object.object_equals)(this[_key2], orig[_key2])) return true;
|
|
897
892
|
}
|
|
898
893
|
return false;
|
|
899
894
|
}
|
|
@@ -1030,7 +1025,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1030
1025
|
var _this$manager2;
|
|
1031
1026
|
var _len2,
|
|
1032
1027
|
params,
|
|
1033
|
-
|
|
1028
|
+
_key3,
|
|
1034
1029
|
_args15 = arguments;
|
|
1035
1030
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1036
1031
|
while (1) switch (_context15.prev = _context15.next) {
|
|
@@ -1042,8 +1037,8 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1042
1037
|
if (this.__showErrors === true) console.error("you cant use events (".concat(eventName, ") if your object has no manager"));
|
|
1043
1038
|
return _context15.abrupt("return");
|
|
1044
1039
|
case 3:
|
|
1045
|
-
for (_len2 = _args15.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0),
|
|
1046
|
-
params[
|
|
1040
|
+
for (_len2 = _args15.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
|
|
1041
|
+
params[_key3 - 1] = _args15[_key3];
|
|
1047
1042
|
}
|
|
1048
1043
|
_context15.next = 6;
|
|
1049
1044
|
return (_this$manager2 = this.manager).event_run.apply(_this$manager2, [eventName].concat(params));
|
|
@@ -1241,10 +1236,10 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1241
1236
|
delete obj[key];
|
|
1242
1237
|
}
|
|
1243
1238
|
} else if (_typeof(initObject) == "object") {
|
|
1244
|
-
for (var
|
|
1245
|
-
if (
|
|
1246
|
-
if (fullUpdate || Object.prototype.hasOwnProperty.call(obj,
|
|
1247
|
-
obj[
|
|
1239
|
+
for (var _key4 in initObject) {
|
|
1240
|
+
if (_key4.startsWith("__")) continue;
|
|
1241
|
+
if (fullUpdate || Object.prototype.hasOwnProperty.call(obj, _key4)) {
|
|
1242
|
+
obj[_key4] = initObject[_key4];
|
|
1248
1243
|
}
|
|
1249
1244
|
}
|
|
1250
1245
|
}
|
|
@@ -1654,11 +1649,10 @@ function _getSubProperty(key, subkey) {
|
|
|
1654
1649
|
}
|
|
1655
1650
|
/**
|
|
1656
1651
|
* update a property on this object by updating the `__delta`
|
|
1657
|
-
* or
|
|
1652
|
+
* or update the object property directly depending on `__use_delta` setting
|
|
1658
1653
|
*
|
|
1659
1654
|
* @param key
|
|
1660
1655
|
* @param value
|
|
1661
|
-
* @returns true if state of `__has_delta` is changed, false otherwise
|
|
1662
1656
|
*/
|
|
1663
1657
|
function _setProperty(key, value) {
|
|
1664
1658
|
var checkIsChanged = false;
|
|
@@ -1669,7 +1663,7 @@ function _setProperty(key, value) {
|
|
|
1669
1663
|
* no need to save it as delta
|
|
1670
1664
|
*/
|
|
1671
1665
|
delete this.__delta[key];
|
|
1672
|
-
checkIsChanged = true; //check if we should set __has_delta to false
|
|
1666
|
+
////checkIsChanged = true; //check if we should set __has_delta to false
|
|
1673
1667
|
} else {
|
|
1674
1668
|
this.__delta[key] = value; //always update delta to keep track of changes
|
|
1675
1669
|
}
|
|
@@ -1677,24 +1671,25 @@ function _setProperty(key, value) {
|
|
|
1677
1671
|
this[key] = value; //on noDelta mode update the object itself
|
|
1678
1672
|
this.__delta[key] = value; //always update delta to keep track of changes
|
|
1679
1673
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1674
|
+
return true;
|
|
1675
|
+
//// if (checkIsChanged || this.__has_delta === false) {
|
|
1676
|
+
//// /**
|
|
1677
|
+
//// * if any key exists in the `__delta` then the object is changed
|
|
1678
|
+
//// */
|
|
1679
|
+
//// let next__has_delta = false;
|
|
1680
|
+
//// for (const key in this.__delta) {
|
|
1681
|
+
//// next__has_delta = true;
|
|
1682
|
+
//// break;
|
|
1683
|
+
//// }
|
|
1684
|
+
//// let previous__has_delta = this.__has_delta;
|
|
1685
|
+
//// this.__has_delta = next__has_delta;
|
|
1686
|
+
//// /**
|
|
1687
|
+
//// * if the state of __has_delta is changed we return true
|
|
1688
|
+
//// * so we can run the needed events
|
|
1689
|
+
//// */
|
|
1690
|
+
//// return previous__has_delta != this.__has_delta;
|
|
1691
|
+
//// }
|
|
1692
|
+
//// return false;
|
|
1698
1693
|
}
|
|
1699
1694
|
function _setSaveResultObject(toObj) {
|
|
1700
1695
|
if (toObj == null) toObj = null; //null or undefined
|