@azrico/webobject 1.5.36 → 1.5.38
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.
|
@@ -197,16 +197,18 @@ export declare class SimpleObject extends MapableObject {
|
|
|
197
197
|
* set the value to its original
|
|
198
198
|
* @param key
|
|
199
199
|
*/
|
|
200
|
-
|
|
200
|
+
discard(key: WriteablePropOf<this>, shouldNotify?: sendChangesType): Promise<boolean>;
|
|
201
201
|
/**
|
|
202
202
|
* reset all values back to their original
|
|
203
|
-
*
|
|
203
|
+
*
|
|
204
|
+
* this function also calls `on_change` and then `clear_changes`
|
|
204
205
|
* @param key
|
|
205
206
|
*/
|
|
206
|
-
|
|
207
|
+
discardAll(shouldNotify?: sendChangesType): Promise<boolean>;
|
|
207
208
|
/**
|
|
208
209
|
* clear and discard all changes
|
|
209
|
-
*
|
|
210
|
+
*
|
|
211
|
+
* does not call `on_change` functions
|
|
210
212
|
* @returns
|
|
211
213
|
*/
|
|
212
214
|
clear_changes(): boolean;
|
|
@@ -772,49 +772,54 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
772
772
|
* @param key
|
|
773
773
|
*/
|
|
774
774
|
}, {
|
|
775
|
-
key: "
|
|
775
|
+
key: "discard",
|
|
776
776
|
value: (function () {
|
|
777
|
-
var
|
|
777
|
+
var _discard = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(key) {
|
|
778
778
|
var shouldNotify,
|
|
779
|
+
originalValue,
|
|
779
780
|
_args13 = arguments;
|
|
780
781
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
781
782
|
while (1) switch (_context13.prev = _context13.next) {
|
|
782
783
|
case 0:
|
|
783
784
|
shouldNotify = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : "auto";
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
785
|
+
if (this.__use_delta) {
|
|
786
|
+
originalValue = this[key];
|
|
787
|
+
} else if (this.__originalobject) originalValue = this.__originalobject[key];else originalValue = this[key];
|
|
788
|
+
_context13.next = 4;
|
|
789
|
+
return this.set(key, originalValue, shouldNotify);
|
|
788
790
|
case 4:
|
|
791
|
+
return _context13.abrupt("return", _context13.sent);
|
|
792
|
+
case 5:
|
|
789
793
|
case "end":
|
|
790
794
|
return _context13.stop();
|
|
791
795
|
}
|
|
792
796
|
}, _callee13, this);
|
|
793
797
|
}));
|
|
794
|
-
function
|
|
795
|
-
return
|
|
798
|
+
function discard(_x22) {
|
|
799
|
+
return _discard.apply(this, arguments);
|
|
796
800
|
}
|
|
797
|
-
return
|
|
801
|
+
return discard;
|
|
798
802
|
}()
|
|
799
803
|
/**
|
|
800
804
|
* reset all values back to their original
|
|
801
|
-
*
|
|
805
|
+
*
|
|
806
|
+
* this function also calls `on_change` and then `clear_changes`
|
|
802
807
|
* @param key
|
|
803
808
|
*/
|
|
804
809
|
)
|
|
805
810
|
}, {
|
|
806
|
-
key: "
|
|
811
|
+
key: "discardAll",
|
|
807
812
|
value: (function () {
|
|
808
|
-
var
|
|
813
|
+
var _discardAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
809
814
|
var shouldNotify,
|
|
810
|
-
|
|
815
|
+
final_result,
|
|
811
816
|
key,
|
|
812
817
|
_args14 = arguments;
|
|
813
818
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
814
819
|
while (1) switch (_context14.prev = _context14.next) {
|
|
815
820
|
case 0:
|
|
816
821
|
shouldNotify = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : "auto";
|
|
817
|
-
|
|
822
|
+
final_result = true;
|
|
818
823
|
_context14.t0 = _regeneratorRuntime().keys(this.__delta);
|
|
819
824
|
case 3:
|
|
820
825
|
if ((_context14.t1 = _context14.t0()).done) {
|
|
@@ -822,35 +827,37 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
822
827
|
break;
|
|
823
828
|
}
|
|
824
829
|
key = _context14.t1.value;
|
|
825
|
-
_context14.t2 =
|
|
830
|
+
_context14.t2 = final_result;
|
|
826
831
|
if (!_context14.t2) {
|
|
827
832
|
_context14.next = 10;
|
|
828
833
|
break;
|
|
829
834
|
}
|
|
830
835
|
_context14.next = 9;
|
|
831
|
-
return this.
|
|
836
|
+
return this.discard(key, shouldNotify);
|
|
832
837
|
case 9:
|
|
833
838
|
_context14.t2 = _context14.sent;
|
|
834
839
|
case 10:
|
|
835
|
-
|
|
840
|
+
final_result = _context14.t2;
|
|
836
841
|
_context14.next = 3;
|
|
837
842
|
break;
|
|
838
843
|
case 13:
|
|
839
|
-
|
|
840
|
-
|
|
844
|
+
if (final_result) this.clear_changes();
|
|
845
|
+
return _context14.abrupt("return", final_result);
|
|
846
|
+
case 15:
|
|
841
847
|
case "end":
|
|
842
848
|
return _context14.stop();
|
|
843
849
|
}
|
|
844
850
|
}, _callee14, this);
|
|
845
851
|
}));
|
|
846
|
-
function
|
|
847
|
-
return
|
|
852
|
+
function discardAll() {
|
|
853
|
+
return _discardAll.apply(this, arguments);
|
|
848
854
|
}
|
|
849
|
-
return
|
|
855
|
+
return discardAll;
|
|
850
856
|
}()
|
|
851
857
|
/**
|
|
852
858
|
* clear and discard all changes
|
|
853
|
-
*
|
|
859
|
+
*
|
|
860
|
+
* does not call `on_change` functions
|
|
854
861
|
* @returns
|
|
855
862
|
*/
|
|
856
863
|
)
|
|
@@ -1206,7 +1213,6 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
1206
1213
|
if (registerErrors && !this.__saveResultIsSuccess) {
|
|
1207
1214
|
var sr = this.__saveResultObject;
|
|
1208
1215
|
var errorString = sr == null ? "" : sr instanceof Error ? sr.message : JSON.stringify(sr);
|
|
1209
|
-
console.error("bad save result : ", sr);
|
|
1210
1216
|
SimpleObject.addError(this, "save result is not valid", errorString, true);
|
|
1211
1217
|
}
|
|
1212
1218
|
this.__saveResultType = type;
|