@azrico/webobject 1.4.124 → 1.4.126

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,15 @@ 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
+ * @param changeablesOnly only updates the `__changeables` fields
66
+ * @returns
67
+ */
68
+ setAll<K extends WriteablePropOf<this>>(setObj: Partial<{
63
69
  [key in K]: any;
64
- }): Promise<boolean>;
70
+ }>, changeablesOnly?: boolean): Promise<boolean>;
65
71
  /**
66
72
  * set value of a key only if the value is empty (null,undef,"")
67
73
  * @param key
@@ -321,37 +321,52 @@ var SimpleObject = /*#__PURE__*/function (_MapableObject, _setValue, _setTemp, _
321
321
  }
322
322
  }, _callee6, this);
323
323
  }))).apply(this, arguments);
324
- } /* -------------------------------------------------------------------------- */
324
+ }
325
+ /* -------------------------------------------------------------------------- */
326
+ /**
327
+ * calls `setValue` function for all props of `setObj`
328
+ * @param setObj
329
+ * @param changeablesOnly only updates the `__changeables` fields
330
+ * @returns
331
+ */
325
332
  }, {
326
333
  key: "setAll",
327
334
  value: function setAll(_x8) {
328
335
  return (_setAll = _setAll || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(setObj) {
329
- var finalRes, key;
336
+ var changeablesOnly,
337
+ finalRes,
338
+ checkKeys,
339
+ index,
340
+ key,
341
+ _args7 = arguments;
330
342
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
331
343
  while (1) switch (_context7.prev = _context7.next) {
332
344
  case 0:
345
+ changeablesOnly = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : true;
333
346
  finalRes = true;
334
- _context7.t0 = _regeneratorRuntime().keys(setObj);
335
- case 2:
336
- if ((_context7.t1 = _context7.t0()).done) {
337
- _context7.next = 10;
347
+ checkKeys = changeablesOnly ? (0, _object.array_intersection)(this.__changeables, Object.keys(setObj)) : Object.keys(setObj);
348
+ index = 0;
349
+ case 4:
350
+ if (!(index < checkKeys.length)) {
351
+ _context7.next = 13;
338
352
  break;
339
353
  }
340
- key = _context7.t1.value;
341
- _context7.next = 6;
354
+ key = checkKeys[index];
355
+ _context7.next = 8;
342
356
  return this.setValue(key, setObj[key]);
343
- case 6:
357
+ case 8:
344
358
  if (_context7.sent) {
345
- _context7.next = 8;
359
+ _context7.next = 10;
346
360
  break;
347
361
  }
348
362
  finalRes = false;
349
- case 8:
350
- _context7.next = 2;
351
- break;
352
363
  case 10:
364
+ index++;
365
+ _context7.next = 4;
366
+ break;
367
+ case 13:
353
368
  return _context7.abrupt("return", finalRes);
354
- case 11:
369
+ case 14:
355
370
  case "end":
356
371
  return _context7.stop();
357
372
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.124",
3
+ "version": "1.4.126",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",