@azrico/webobject 1.3.10 → 1.3.13

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.
@@ -21,7 +21,8 @@ export declare class SimpleObject extends MapableObject {
21
21
  __lastChanged: string;
22
22
  __is_readonly: boolean;
23
23
  __throw_errors: boolean;
24
- __deleted: boolean;
24
+ _deleted: boolean;
25
+ _deletedBy?: string;
25
26
  __errors?: any[];
26
27
  __showErrors?: boolean;
27
28
  __saveResultObject?: any;
@@ -47,6 +48,8 @@ export declare class SimpleObject extends MapableObject {
47
48
  setTemp: (key: string, value: any) => any;
48
49
  setDefaultValue(key: WriteablePropOf<this>, value: any): boolean;
49
50
  setDefault: (key: WriteablePropOf<this>, value: any) => boolean;
51
+ clearDeltaValue(key: WriteablePropOf<this>): boolean;
52
+ clear: (key: WriteablePropOf<this>) => boolean;
50
53
  /**
51
54
  * set key of subObject
52
55
  * @param key
@@ -41,6 +41,7 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
41
41
  var _setSubProperty = /*#__PURE__*/new WeakSet();
42
42
  var _getSubProperty = /*#__PURE__*/new WeakSet();
43
43
  var _setProperty = /*#__PURE__*/new WeakSet();
44
+ var _clearDeltaProperty = /*#__PURE__*/new WeakSet();
44
45
  var _setDefaultProperty = /*#__PURE__*/new WeakSet();
45
46
  var _getProperty = /*#__PURE__*/new WeakSet();
46
47
  var _getTempProperty = /*#__PURE__*/new WeakSet();
@@ -63,18 +64,21 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
63
64
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getTempProperty);
64
65
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getProperty);
65
66
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setDefaultProperty);
67
+ _classPrivateMethodInitSpec(_assertThisInitialized(_this), _clearDeltaProperty);
66
68
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setProperty);
67
69
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getSubProperty);
68
70
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setSubProperty);
69
71
  _defineProperty(_assertThisInitialized(_this), "__originalobject", void 0);
70
72
  //changes
71
- _defineProperty(_assertThisInitialized(_this), "__delta", void 0);
72
- _defineProperty(_assertThisInitialized(_this), "__temp", void 0);
73
+ _defineProperty(_assertThisInitialized(_this), "__delta", {});
74
+ _defineProperty(_assertThisInitialized(_this), "__temp", undefined);
73
75
  _defineProperty(_assertThisInitialized(_this), "__changed", false);
74
76
  _defineProperty(_assertThisInitialized(_this), "__lastChanged", "");
75
77
  _defineProperty(_assertThisInitialized(_this), "__is_readonly", void 0);
76
78
  _defineProperty(_assertThisInitialized(_this), "__throw_errors", void 0);
77
- _defineProperty(_assertThisInitialized(_this), "__deleted", void 0);
79
+ //is this object marked as deleted?
80
+ _defineProperty(_assertThisInitialized(_this), "_deleted", false);
81
+ _defineProperty(_assertThisInitialized(_this), "_deletedBy", void 0);
78
82
  //errors
79
83
  _defineProperty(_assertThisInitialized(_this), "__errors", void 0);
80
84
  _defineProperty(_assertThisInitialized(_this), "__showErrors", void 0);
@@ -92,12 +96,11 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
92
96
  _defineProperty(_assertThisInitialized(_this), "set", _this.setValue);
93
97
  _defineProperty(_assertThisInitialized(_this), "setTemp", _classPrivateMethodGet(_assertThisInitialized(_this), _setTempProperty, _setTempProperty2));
94
98
  _defineProperty(_assertThisInitialized(_this), "setDefault", _this.setDefaultValue);
99
+ _defineProperty(_assertThisInitialized(_this), "clear", _this.clearDeltaValue);
95
100
  _defineProperty(_assertThisInitialized(_this), "get_managerClass", function () {
96
101
  return null;
97
102
  });
98
- _this.__deleted = false;
99
- _this.__delta = {};
100
- _this.__temp = {};
103
+ if (_this._deleted == null) _this._deleted = false;
101
104
  _this.__is_readonly = is_readonly;
102
105
  _this.__throw_errors = true;
103
106
  _this.clear_changes();
@@ -193,6 +196,11 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
193
196
  value: function setDefaultValue(key, value) {
194
197
  return _classPrivateMethodGet(this, _setDefaultProperty, _setDefaultProperty2).call(this, key, value);
195
198
  }
199
+ }, {
200
+ key: "clearDeltaValue",
201
+ value: function clearDeltaValue(key) {
202
+ return _classPrivateMethodGet(this, _clearDeltaProperty, _clearDeltaProperty2).call(this, key);
203
+ }
196
204
  }, {
197
205
  key: "setSubValue",
198
206
  value:
@@ -398,7 +406,7 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
398
406
  }, {
399
407
  key: "clear_cache",
400
408
  value: function clear_cache() {
401
- this.__temp = {};
409
+ this.__temp = undefined;
402
410
  return true;
403
411
  }
404
412
  /**
@@ -442,10 +450,10 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject) {
442
450
  }, {
443
451
  key: "isDeleted",
444
452
  get: function get() {
445
- return this.__deleted || false;
453
+ return this._deleted || false;
446
454
  },
447
455
  set: function set(v) {
448
- this.__deleted = v;
456
+ this._deleted = v;
449
457
  }
450
458
  }, {
451
459
  key: "d",
@@ -847,6 +855,13 @@ function _setProperty2(key, value) {
847
855
  if (!this.__use_delta) this[key] = value; //on noDelta mode, also update the obj
848
856
  return true;
849
857
  }
858
+ function _clearDeltaProperty2(key) {
859
+ if (this.__use_delta) {
860
+ delete this.__delta[key];
861
+ return true;
862
+ }
863
+ return false;
864
+ }
850
865
  function _setDefaultProperty2(key, value) {
851
866
  //@ts-ignore
852
867
  if (this[key] == undefined || this[key] === "" || this[key] === 0) {
@@ -865,11 +880,11 @@ function _getProperty2(key) {
865
880
  return this[key];
866
881
  }
867
882
  function _getTempProperty2(key) {
868
- if (!this.__temp) return undefined;
883
+ if (this.__temp == null) return undefined;
869
884
  return this.__temp[key];
870
885
  }
871
886
  function _setTempProperty2(key, value) {
872
- if (!this.__temp) this.__temp = {};
887
+ if (this.__temp == null) this.__temp = {};
873
888
  this.__temp[key] = value;
874
889
  }
875
890
  function _setSaveResultObject2(toObj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.3.10",
3
+ "version": "1.3.13",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",