@azrico/webobject 1.4.123 → 1.4.125

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.
@@ -59,9 +59,14 @@ export declare class SimpleObject extends MapableObject {
59
59
  setRefreshFunction(new_fnc: any): Promise<any>;
60
60
  addRefreshFunction(new_fnc: any): any;
61
61
  runRefreshFunction(...params: any): Promise<void>;
62
- setAll<K extends WriteablePropOf<this>>(setObj: {
62
+ /**
63
+ * calls `setValue` function for all props of `setObj`
64
+ * @param setObj
65
+ * @returns
66
+ */
67
+ setAll<K extends WriteablePropOf<this>>(setObj: Partial<{
63
68
  [key in K]: any;
64
- }): Promise<boolean>;
69
+ }>): Promise<boolean>;
65
70
  /**
66
71
  * set value of a key only if the value is empty (null,undef,"")
67
72
  * @param key
@@ -69,6 +74,13 @@ export declare class SimpleObject extends MapableObject {
69
74
  * @returns
70
75
  */
71
76
  setDefaultValue(key: WriteablePropOf<this>, value: any): boolean;
77
+ /**
78
+ * set value of a key to now date time
79
+ * @param key
80
+ * @param value
81
+ * @returns
82
+ */
83
+ setDefaultValueNow: (key: PropOf<this>) => boolean;
72
84
  /**
73
85
  * set value of a key only if the value is empty (null,undef,"")
74
86
  * @param key
@@ -38,6 +38,7 @@ var _setSubProperty = /*#__PURE__*/new WeakSet();
38
38
  var _getSubProperty = /*#__PURE__*/new WeakSet();
39
39
  var _setProperty = /*#__PURE__*/new WeakSet();
40
40
  var _setDefaultProperty = /*#__PURE__*/new WeakSet();
41
+ var _setDefaultPropertyNow = /*#__PURE__*/new WeakSet();
41
42
  var _getProperty = /*#__PURE__*/new WeakSet();
42
43
  var _setSaveResultObject = /*#__PURE__*/new WeakSet();
43
44
  var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _clearRefreshFunction, _setRefreshFunction, _addRefreshFunction, _runRefreshFunction, _setAll, _setSubValue, _pushValue, _pushValues, _notifyChanged, _reset, _resetAll, _event_run, _event_add, _setTemp2, _delete_cache) {
@@ -54,6 +55,7 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
54
55
  */
55
56
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setSaveResultObject);
56
57
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getProperty);
58
+ _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setDefaultPropertyNow);
57
59
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setDefaultProperty);
58
60
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _setProperty);
59
61
  _classPrivateMethodInitSpec(_assertThisInitialized(_this), _getSubProperty);
@@ -90,6 +92,13 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
90
92
  _defineProperty(_assertThisInitialized(_this), "getValue", _classPrivateMethodGet(_assertThisInitialized(_this), _getProperty, _getProperty2));
91
93
  _defineProperty(_assertThisInitialized(_this), "get", _classPrivateMethodGet(_assertThisInitialized(_this), _getProperty, _getProperty2));
92
94
  _defineProperty(_assertThisInitialized(_this), "set", _this.setValue);
95
+ /**
96
+ * set value of a key to now date time
97
+ * @param key
98
+ * @param value
99
+ * @returns
100
+ */
101
+ _defineProperty(_assertThisInitialized(_this), "setDefaultValueNow", _classPrivateMethodGet(_assertThisInitialized(_this), _setDefaultPropertyNow, _setDefaultPropertyNow2));
93
102
  /**
94
103
  * set value of a key only if the value is empty (null,undef,"")
95
104
  * @param key
@@ -312,7 +321,13 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
312
321
  }
313
322
  }, _callee6, this);
314
323
  }))).apply(this, arguments);
315
- } /* -------------------------------------------------------------------------- */
324
+ }
325
+ /* -------------------------------------------------------------------------- */
326
+ /**
327
+ * calls `setValue` function for all props of `setObj`
328
+ * @param setObj
329
+ * @returns
330
+ */
316
331
  }, {
317
332
  key: "setAll",
318
333
  value: function setAll(_x8) {
@@ -1392,6 +1407,14 @@ function _setDefaultProperty2(key, value) {
1392
1407
  }
1393
1408
  return false;
1394
1409
  }
1410
+ function _setDefaultPropertyNow2(key) {
1411
+ //@ts-ignore
1412
+ if (this[key] == undefined || this[key] === "" || this[key] === 0) {
1413
+ this[key] = new Date();
1414
+ return true;
1415
+ }
1416
+ return false;
1417
+ }
1395
1418
  function _getProperty2(key) {
1396
1419
  var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1397
1420
  //check if we should treat the prop as a function
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.123",
3
+ "version": "1.4.125",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",