@azrico/webobject 1.5.4 → 1.5.6

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.
@@ -125,10 +125,10 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
125
125
  return _context.abrupt("return", false);
126
126
  case 16:
127
127
  //same value, no changes
128
- new_metalist = _objectSpread({}, this.getValue("meta_data"));
128
+ new_metalist = _objectSpread({}, this.get("meta_data"));
129
129
  new_metalist[key] = value;
130
130
  _context.next = 20;
131
- return this.setValue("meta_data", new_metalist);
131
+ return this.set("meta_data", new_metalist);
132
132
  case 20:
133
133
  if (!(sendChange !== false)) {
134
134
  _context.next = 23;
@@ -1105,7 +1105,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
1105
1105
  if (!key || typeof key != "string") return undefined;
1106
1106
  var metalist = {};
1107
1107
  if (_typeof(o) === "object") {
1108
- metalist = typeof o.getValue === "function" ? o.getValue("meta_data") : o.meta_data;
1108
+ metalist = typeof o.get === "function" ? o.get("meta_data") : o.meta_data;
1109
1109
  }
1110
1110
  return metalist[key];
1111
1111
  }
@@ -47,15 +47,14 @@ export declare class ObjectManager<ObjType extends SimpleObject> extends RawObje
47
47
  getSaveResultType(): saveResultType | null;
48
48
  setSaveResult(toObj: any, type: saveResultType): saveResultType | undefined;
49
49
  apply_changes(): boolean;
50
- getValue(key: PropOf<ObjType>, original?: boolean): import("@azrico/types").PropType<ObjType, any> | null;
51
- get: (key: PropOf<ObjType>, original?: boolean) => import("@azrico/types").PropType<ObjType, any> | null;
50
+ get(key: PropOf<ObjType>, original?: boolean): import("@azrico/types").PropType<ObjType, any> | null;
52
51
  /**
53
52
  * set value
54
53
  * @param key
55
54
  * @param value
56
55
  * @return true if changed , false otherwise
57
56
  */
58
- setValue(key: WriteablePropOf<ObjType>, value: any): Promise<boolean>;
57
+ set(key: WriteablePropOf<ObjType>, value: any): Promise<boolean>;
59
58
  /**
60
59
  * set key of subObject
61
60
  * @param key
@@ -46,7 +46,6 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
46
46
  _defineProperty(_this, "__options", void 0);
47
47
  //can the current object be set to null safely?
48
48
  _defineProperty(_this, "__object_nullable", false);
49
- _defineProperty(_this, "get", _this.getValue);
50
49
  _this.setObject(defaultObject);
51
50
  return _this;
52
51
  }
@@ -66,7 +65,7 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
66
65
  }
67
66
  return _context.abrupt("return", false);
68
67
  case 3:
69
- if (value === undefined && type != "meta") value = obj.getValue(key);
68
+ if (value === undefined && type != "meta") value = obj.get(key);
70
69
  typestr = (type ? "$".concat(type, "$") : "") + String(key);
71
70
  _context.next = 7;
72
71
  return this.event_run("on_change", typestr, value);
@@ -196,41 +195,40 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
196
195
  return ((_this$obj7 = this.obj) === null || _this$obj7 === void 0 ? void 0 : _this$obj7.apply_changes()) || false;
197
196
  }
198
197
  }, {
199
- key: "getValue",
200
- value: function getValue(key) {
198
+ key: "get",
199
+ value: function get(key) {
201
200
  var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
202
201
  var thisobj = this.obj;
203
- if (thisobj == null || typeof thisobj.getValue != "function") {
204
- if (!this.__object_nullable) console.error("cant use getValue when object is not defined. maybe you have to use New() ?");
202
+ if (thisobj == null || typeof thisobj.get != "function") {
203
+ if (!this.__object_nullable) console.error("cant use get when object is not defined. maybe you have to use New() ?");
205
204
  return null;
206
205
  }
207
- return thisobj.getValue(key, original);
206
+ return thisobj.get(key, original);
208
207
  }
209
- }, {
210
- key: "setValue",
211
- value: (
212
208
  /**
213
209
  * set value
214
210
  * @param key
215
211
  * @param value
216
212
  * @return true if changed , false otherwise
217
213
  */
218
- function () {
219
- var _setValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, value) {
214
+ }, {
215
+ key: "set",
216
+ value: (function () {
217
+ var _set = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, value) {
220
218
  var thisobj;
221
219
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
222
220
  while (1) switch (_context2.prev = _context2.next) {
223
221
  case 0:
224
222
  thisobj = this.obj;
225
- if (!(thisobj == null || typeof thisobj.setValue != "function")) {
223
+ if (!(thisobj == null || typeof thisobj.set != "function")) {
226
224
  _context2.next = 4;
227
225
  break;
228
226
  }
229
- if (!this.__object_nullable) console.error("cant use setValue when object is not defined. maybe you have to use New() ?");
227
+ if (!this.__object_nullable) console.error("cant use set when object is not defined. maybe you have to use New() ?");
230
228
  return _context2.abrupt("return", false);
231
229
  case 4:
232
230
  _context2.next = 6;
233
- return thisobj.setValue(key, value);
231
+ return thisobj.set(key, value);
234
232
  case 6:
235
233
  _context2.t0 = _context2.sent;
236
234
  if (_context2.t0) {
@@ -246,10 +244,10 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
246
244
  }
247
245
  }, _callee2, this);
248
246
  }));
249
- function setValue(_x5, _x6) {
250
- return _setValue.apply(this, arguments);
247
+ function set(_x5, _x6) {
248
+ return _set.apply(this, arguments);
251
249
  }
252
- return setValue;
250
+ return set;
253
251
  }()
254
252
  /**
255
253
  * set key of subObject
@@ -1,4 +1,4 @@
1
- import { PropType, WriteablePropOf, PropOf, Ensure } from "@azrico/types";
1
+ import { PropType, WriteablePropOf, PropOf, Ensure, PropOnlyPrefixedOf } from "@azrico/types";
2
2
  import { formatObject } from "@azrico/convert";
3
3
  import { MapableObject } from "./MapableObject";
4
4
  import ObjectManager from "./ObjectManager";
@@ -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;
@@ -48,9 +47,9 @@ export declare class SimpleObject extends MapableObject {
48
47
  _index_key: string;
49
48
  _index_value: number;
50
49
  constructor(is_readonly?: boolean);
51
- getValue: <MKey extends keyof this>(key: MKey, original?: boolean) => PropType<this, MKey>;
52
- get: <MKey extends keyof this>(key: MKey, original?: boolean) => PropType<this, MKey>;
53
- static getValue<T extends SimpleObject, MKey extends PropOf<T>>(o: T, key: MKey, original?: boolean): PropType<T, MKey> | undefined;
50
+ get<MKey extends PropOf<this>>(key: MKey, original?: boolean): PropType<this, MKey>;
51
+ get<MKey extends PropOnlyPrefixedOf<this>>(key: MKey, original?: boolean): any;
52
+ static get<T extends SimpleObject, MKey extends PropOf<T>>(o: T, key: MKey, original?: boolean): PropType<T, MKey> | undefined;
54
53
  /**
55
54
  * set value and run the event handlers if needed
56
55
  * @param key
@@ -59,7 +58,7 @@ export declare class SimpleObject extends MapableObject {
59
58
  * @param autoApply if the field is not in delta, instantly calls the `apply` function to remove from delta
60
59
  * @returns
61
60
  */
62
- setValue(key: WriteablePropOf<this>, value: any, shouldNotify?: sendChangesType, autoApply?: boolean): Promise<boolean>;
61
+ set(key: WriteablePropOf<this>, value: any, shouldNotify?: sendChangesType, autoApply?: boolean): Promise<boolean>;
63
62
  /**
64
63
  * set value and run the event handlers if needed
65
64
  *
@@ -72,7 +71,7 @@ export declare class SimpleObject extends MapableObject {
72
71
  * set value and run the event handlers if needed
73
72
  * @return true if changed , false otherwise
74
73
  */
75
- set: (key: WriteablePropOf<this>, value: any, shouldNotify?: sendChangesType, autoApply?: boolean) => Promise<boolean>;
74
+ setValue: (key: WriteablePropOf<this>, value: any, shouldNotify?: sendChangesType, autoApply?: boolean) => Promise<boolean>;
76
75
  /**
77
76
  * load all properties in `initObject` into the current object
78
77
  * @param initObject
@@ -87,7 +86,7 @@ export declare class SimpleObject extends MapableObject {
87
86
  addRefreshFunction(new_fnc: any): any;
88
87
  runRefreshFunction(...params: any): Promise<void>;
89
88
  /**
90
- * calls `setValue` function for all props of `setObj`
89
+ * calls `set` function for all props of `setObj`
91
90
  * @param setObj
92
91
  * @param changeablesOnly only updates the `__changeables` fields
93
92
  * @returns
@@ -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
- _defineProperty(_this, "__has_delta", false);
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
@@ -81,13 +81,11 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
81
81
  _defineProperty(_this, "_index_key", "");
82
82
  //sequence value , used to index the object with increasing numbers
83
83
  _defineProperty(_this, "_index_value", -1);
84
- _defineProperty(_this, "getValue", _assertClassBrand(_SimpleObject_brand, _this, _getProperty));
85
- _defineProperty(_this, "get", _assertClassBrand(_SimpleObject_brand, _this, _getProperty));
86
84
  /**
87
85
  * set value and run the event handlers if needed
88
86
  * @return true if changed , false otherwise
89
87
  */
90
- _defineProperty(_this, "set", _this.setValue);
88
+ _defineProperty(_this, "setValue", _this.set);
91
89
  /**
92
90
  * set value of a key to now date time
93
91
  * @param key
@@ -118,7 +116,29 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
118
116
  return this.constructor;
119
117
  }
120
118
  }, {
121
- key: "setValue",
119
+ key: "get",
120
+ value: function get(key) {
121
+ var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
122
+ //check if we should treat the prop as a function
123
+ var is_fnc = this.constructor["__functionProperties"] != null && this.constructor["__functionProperties"].includes(key);
124
+ //check if we should use delta version or normal version for this property
125
+ var used_value;
126
+ if (typeof key === "string" && key.includes(".")) {
127
+ /* ----------------------------- using sub value ---------------------------- */
128
+ var keysp = key.split(".");
129
+ var subkey_part = keysp.pop();
130
+ var key_part = keysp.join(".");
131
+ used_value = _assertClassBrand(_SimpleObject_brand, this, _getSubProperty).call(this, key_part, subkey_part);
132
+ } else {
133
+ /* --------------------------- using this or delta -------------------------- */
134
+ var self_key = key;
135
+ var use_orig = original || !this.__use_delta || !(self_key in this.__delta);
136
+ used_value = use_orig ? this[self_key] : this.__delta[self_key];
137
+ }
138
+ return is_fnc ? (0, _object.fn_eval_this)(this, used_value) : used_value;
139
+ }
140
+ }, {
141
+ key: "set",
122
142
  value: (
123
143
  /**
124
144
  * set value and run the event handlers if needed
@@ -129,14 +149,13 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
129
149
  * @returns
130
150
  */
131
151
  function () {
132
- var _setValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, value) {
152
+ var _set = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, value) {
133
153
  var shouldNotify,
134
154
  autoApply,
135
155
  keyExists,
136
156
  old_value,
137
157
  needsChange,
138
158
  _this$manager,
139
- __has_delta_isChanged,
140
159
  _args = arguments;
141
160
  return _regeneratorRuntime().wrap(function _callee$(_context) {
142
161
  while (1) switch (_context.prev = _context.next) {
@@ -151,27 +170,24 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
151
170
  _context.next = 7;
152
171
  break;
153
172
  }
154
- throw Error("Cant use setValue (".concat(String(key), ") when on readonly mode"));
173
+ throw Error("Cant use set (".concat(String(key), ") when on readonly mode"));
155
174
  case 7:
156
175
  return _context.abrupt("return", false);
157
176
  case 8:
158
177
  /* --------------------------- set if not changed --------------------------- */
159
178
  keyExists = key in this.__delta;
160
- old_value = this.getValue(key);
179
+ old_value = this.get(key);
161
180
  needsChange = !(0, _object.object_equals)(old_value, value, {
162
181
  strictArrayCheck: true,
163
182
  ignoredStartingWords: "_"
164
183
  });
165
184
  if (needsChange) {
166
- __has_delta_isChanged = _assertClassBrand(_SimpleObject_brand, this, _setProperty).call(this, key, value);
185
+ _assertClassBrand(_SimpleObject_brand, this, _setProperty).call(this, key, value);
167
186
  /**
168
187
  * notify the manager when the state of `__has_delta` is changed
169
188
  * managers can use this to detect if they need to save
170
189
  */
171
190
  (_this$manager = this.manager) === null || _this$manager === void 0 || _this$manager.checkIsChanged();
172
- ////if (__has_delta_isChanged && this.manager) {
173
- //// this.manager.setOption("hasDelta", this.__has_delta);
174
- ////}
175
191
  }
176
192
  /**
177
193
  * if the field is not in delta
@@ -196,10 +212,10 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
196
212
  }
197
213
  }, _callee, this);
198
214
  }));
199
- function setValue(_x, _x2) {
200
- return _setValue.apply(this, arguments);
215
+ function set(_x, _x2) {
216
+ return _set.apply(this, arguments);
201
217
  }
202
- return setValue;
218
+ return set;
203
219
  }()
204
220
  /**
205
221
  * set value and run the event handlers if needed
@@ -404,7 +420,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
404
420
  }()
405
421
  /* -------------------------------------------------------------------------- */
406
422
  /**
407
- * calls `setValue` function for all props of `setObj`
423
+ * calls `set` function for all props of `setObj`
408
424
  * @param setObj
409
425
  * @param changeablesOnly only updates the `__changeables` fields
410
426
  * @returns
@@ -433,7 +449,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
433
449
  }
434
450
  key = checkKeys[index];
435
451
  _context8.next = 8;
436
- return this.setValue(key, setObj[key]);
452
+ return this.set(key, setObj[key]);
437
453
  case 8:
438
454
  if (_context8.sent) {
439
455
  _context8.next = 10;
@@ -605,8 +621,8 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
605
621
  case 8:
606
622
  return _context11.abrupt("return", false);
607
623
  case 9:
608
- if (_assertClassBrand(_SimpleObject_brand, this, _getProperty).call(this, key) == null) _assertClassBrand(_SimpleObject_brand, this, _setProperty).call(this, key, []);
609
- tempArray = _assertClassBrand(_SimpleObject_brand, this, _getProperty).call(this, key);
624
+ if (this.get(key) == null) _assertClassBrand(_SimpleObject_brand, this, _setProperty).call(this, key, []);
625
+ tempArray = this.get(key);
610
626
  if (Array.isArray(tempArray)) {
611
627
  _context11.next = 17;
612
628
  break;
@@ -656,7 +672,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
656
672
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
657
673
  while (1) switch (_context12.prev = _context12.next) {
658
674
  case 0:
659
- if (value === undefined && type == "") value = this.getValue(key);
675
+ if (value === undefined && type == "") value = this.get(key);
660
676
  lc = "";
661
677
  if (type) lc += "$".concat(String(type), "$");
662
678
  if (subvalue) {
@@ -755,7 +771,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
755
771
  case 0:
756
772
  shouldNotify = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : "auto";
757
773
  _context13.next = 3;
758
- return this.setValue(key, this[key], shouldNotify);
774
+ return this.set(key, this[key], shouldNotify);
759
775
  case 3:
760
776
  return _context13.abrupt("return", _context13.sent);
761
777
  case 4:
@@ -831,7 +847,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
831
847
  key: "clear_changes",
832
848
  value: function clear_changes() {
833
849
  this.__delta = {};
834
- this.__has_delta = false;
850
+ ////this.__has_delta = false;
835
851
  return true;
836
852
  }
837
853
  /**
@@ -871,11 +887,11 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
871
887
  ////if (!deltaIsBlank) return true; //delta is not blank, definitely changed
872
888
  ////if (this.__use_delta) return !deltaIsBlank; //trust the delta.
873
889
  if (this.__use_delta) {
874
- return this.__has_delta;
875
- ////for (const key in this.__delta) {
876
- //// return true;
877
- ////}
878
- ////return false;
890
+ ////return this.__has_delta;
891
+ for (var key in this.__delta) {
892
+ return true;
893
+ }
894
+ return false;
879
895
  }
880
896
  /* --------------------- check the properties one by one -------------------- */
881
897
  var orig = this.getOriginal();
@@ -890,9 +906,9 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
890
906
  }) != undefined;
891
907
  } else {
892
908
  /* check all fields */
893
- for (var key in this) {
894
- if (key.startsWith("__")) continue;
895
- if (!(0, _object.object_equals)(this[key], orig[key])) return true;
909
+ for (var _key2 in this) {
910
+ if (_key2.startsWith("__")) continue;
911
+ if (!(0, _object.object_equals)(this[_key2], orig[_key2])) return true;
896
912
  }
897
913
  return false;
898
914
  }
@@ -1029,7 +1045,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
1029
1045
  var _this$manager2;
1030
1046
  var _len2,
1031
1047
  params,
1032
- _key2,
1048
+ _key3,
1033
1049
  _args15 = arguments;
1034
1050
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1035
1051
  while (1) switch (_context15.prev = _context15.next) {
@@ -1041,8 +1057,8 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
1041
1057
  if (this.__showErrors === true) console.error("you cant use events (".concat(eventName, ") if your object has no manager"));
1042
1058
  return _context15.abrupt("return");
1043
1059
  case 3:
1044
- for (_len2 = _args15.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1045
- params[_key2 - 1] = _args15[_key2];
1060
+ for (_len2 = _args15.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
1061
+ params[_key3 - 1] = _args15[_key3];
1046
1062
  }
1047
1063
  _context15.next = 6;
1048
1064
  return (_this$manager2 = this.manager).event_run.apply(_this$manager2, [eventName].concat(params));
@@ -1209,11 +1225,12 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
1209
1225
  /* statics */
1210
1226
  /* -------------------------------------------------------------------------- */
1211
1227
  }], [{
1212
- key: "getValue",
1213
- value: function getValue(o, key) {
1228
+ key: "get",
1229
+ value: function get(o, key) {
1214
1230
  var original = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1215
1231
  if (o == null) return undefined;
1216
- if (o instanceof SimpleObject && typeof o.getValue === "function") return o.getValue(key, original);
1232
+ if (o instanceof SimpleObject && typeof o.get === "function") return o.get(key, original);
1233
+ /* ------------------------------- manual get ------------------------------- */
1217
1234
  if (!original && o.__use_delta != false && _typeof(o.__delta) === "object" && key in o.__delta) {
1218
1235
  //@ts-ignore
1219
1236
  return o.__delta[key];
@@ -1221,7 +1238,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
1221
1238
  return o[key];
1222
1239
  }
1223
1240
  /* -------------------------------------------------------------------------- */
1224
- /* setValue */
1241
+ /* set */
1225
1242
  /* -------------------------------------------------------------------------- */
1226
1243
  }, {
1227
1244
  key: "loadValues",
@@ -1240,10 +1257,10 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
1240
1257
  delete obj[key];
1241
1258
  }
1242
1259
  } else if (_typeof(initObject) == "object") {
1243
- for (var _key3 in initObject) {
1244
- if (_key3.startsWith("__")) continue;
1245
- if (fullUpdate || Object.prototype.hasOwnProperty.call(obj, _key3)) {
1246
- obj[_key3] = initObject[_key3];
1260
+ for (var _key4 in initObject) {
1261
+ if (_key4.startsWith("__")) continue;
1262
+ if (fullUpdate || Object.prototype.hasOwnProperty.call(obj, _key4)) {
1263
+ obj[_key4] = initObject[_key4];
1247
1264
  }
1248
1265
  }
1249
1266
  }
@@ -1622,24 +1639,8 @@ function _setDefaultPropertyNow(key) {
1622
1639
  }
1623
1640
  return false;
1624
1641
  }
1625
- /* -------------------------------------------------------------------------- */
1626
- /* getProperty */
1627
- /* -------------------------------------------------------------------------- */
1628
- function _getProperty(key) {
1629
- var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1630
- //check if we should treat the prop as a function
1631
- var is_fnc = this.constructor["__functionProperties"] != null && this.constructor["__functionProperties"].includes(key);
1632
- //check if we should use delta version or normal version for this property
1633
- var use_orig = original || !this.__use_delta || !(key in this.__delta);
1634
- if (is_fnc) {
1635
- if (use_orig) return (0, _object.fn_eval_this)(this, this[key]);
1636
- return (0, _object.fn_eval_this)(this, this.__delta[key]);
1637
- }
1638
- if (use_orig) return this[key];
1639
- return this.__delta[key];
1640
- }
1641
1642
  function _setSubProperty(key, subkey, value) {
1642
- var subobj = _assertClassBrand(_SimpleObject_brand, this, _getProperty).call(this, key);
1643
+ var subobj = this.get(key);
1643
1644
  //@ts-ignore
1644
1645
  if (subobj == null || _typeof(subobj) !== "object") subobj = {};else subobj = _objectSpread({}, subobj); //make a clone so we dont update the original
1645
1646
  subobj[subkey] = value;
@@ -1647,17 +1648,16 @@ function _setSubProperty(key, subkey, value) {
1647
1648
  }
1648
1649
  function _getSubProperty(key, subkey) {
1649
1650
  var original = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1650
- var subobj = _assertClassBrand(_SimpleObject_brand, this, _getProperty).call(this, key, original);
1651
+ var subobj = this.get(key, original);
1651
1652
  if (subobj == null || _typeof(subobj) !== "object") return undefined;
1652
1653
  return subobj[subkey];
1653
1654
  }
1654
1655
  /**
1655
1656
  * update a property on this object by updating the `__delta`
1656
- * or updating the object property directly depending on `__use_delta` setting
1657
+ * or update the object property directly depending on `__use_delta` setting
1657
1658
  *
1658
1659
  * @param key
1659
1660
  * @param value
1660
- * @returns true if state of `__has_delta` is changed, false otherwise
1661
1661
  */
1662
1662
  function _setProperty(key, value) {
1663
1663
  var checkIsChanged = false;
@@ -1668,7 +1668,7 @@ function _setProperty(key, value) {
1668
1668
  * no need to save it as delta
1669
1669
  */
1670
1670
  delete this.__delta[key];
1671
- checkIsChanged = true; //check if we should set __has_delta to false
1671
+ ////checkIsChanged = true; //check if we should set __has_delta to false
1672
1672
  } else {
1673
1673
  this.__delta[key] = value; //always update delta to keep track of changes
1674
1674
  }
@@ -1676,24 +1676,25 @@ function _setProperty(key, value) {
1676
1676
  this[key] = value; //on noDelta mode update the object itself
1677
1677
  this.__delta[key] = value; //always update delta to keep track of changes
1678
1678
  }
1679
- if (checkIsChanged || this.__has_delta === false) {
1680
- /**
1681
- * if any key exists in the `__delta` then the object is changed
1682
- */
1683
- var next__has_delta = false;
1684
- for (var _key4 in this.__delta) {
1685
- next__has_delta = true;
1686
- break;
1687
- }
1688
- var previous__has_delta = this.__has_delta;
1689
- this.__has_delta = next__has_delta;
1690
- /**
1691
- * if the state of __has_delta is changed we return true
1692
- * so we can run the needed events
1693
- */
1694
- return previous__has_delta != this.__has_delta;
1695
- }
1696
- return false;
1679
+ return true;
1680
+ //// if (checkIsChanged || this.__has_delta === false) {
1681
+ //// /**
1682
+ //// * if any key exists in the `__delta` then the object is changed
1683
+ //// */
1684
+ //// let next__has_delta = false;
1685
+ //// for (const key in this.__delta) {
1686
+ //// next__has_delta = true;
1687
+ //// break;
1688
+ //// }
1689
+ //// let previous__has_delta = this.__has_delta;
1690
+ //// this.__has_delta = next__has_delta;
1691
+ //// /**
1692
+ //// * if the state of __has_delta is changed we return true
1693
+ //// * so we can run the needed events
1694
+ //// */
1695
+ //// return previous__has_delta != this.__has_delta;
1696
+ //// }
1697
+ //// return false;
1697
1698
  }
1698
1699
  function _setSaveResultObject(toObj) {
1699
1700
  if (toObj == null) toObj = null; //null or undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",
@@ -69,13 +69,13 @@
69
69
  "@azrico/uid": "*"
70
70
  },
71
71
  "dependencies": {
72
- "@azrico/convert": "^1.0.9",
73
- "@azrico/event": "^1.2.44",
74
- "@azrico/global": "^1.3.79",
72
+ "@azrico/convert": "^1.0.13",
73
+ "@azrico/event": "^1.2.52",
74
+ "@azrico/global": "^1.3.85",
75
75
  "@azrico/math": "^1.0.5",
76
- "@azrico/object": "^1.4.107",
77
- "@azrico/string": "^1.2.102",
78
- "@azrico/types": "^1.0.9",
76
+ "@azrico/object": "^1.4.112",
77
+ "@azrico/string": "^1.2.115",
78
+ "@azrico/types": "^1.0.11",
79
79
  "@azrico/uid": "^1.0.8"
80
80
  },
81
81
  "packageManager": "yarn@3.5.0"