@azrico/webobject 1.4.164 → 1.4.166

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.
@@ -173,56 +173,80 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
173
173
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
174
174
  while (1) switch (_context2.prev = _context2.next) {
175
175
  case 0:
176
- _context2.next = 2;
176
+ _context2.prev = 0;
177
+ if (!this.manager) {
178
+ _context2.next = 6;
179
+ break;
180
+ }
181
+ _context2.next = 4;
182
+ return this.manager.setOption("saving", true);
183
+ case 4:
184
+ _context2.next = 6;
185
+ return this.manager.setOption("loading", true);
186
+ case 6:
187
+ _context2.next = 8;
177
188
  return this.get_deltaObject();
178
- case 2:
189
+ case 8:
179
190
  deltaObject = _context2.sent;
180
191
  putAction = "post";
181
- _context2.next = 6;
192
+ _context2.next = 12;
182
193
  return _WebObjectPathHelper["default"].get_path(this, this.isNew ? "new" : "save");
183
- case 6:
194
+ case 12:
184
195
  usepath = _context2.sent;
185
196
  if ((0, _object.object_isEmpty)(deltaObject)) {
186
- _context2.next = 20;
197
+ _context2.next = 26;
187
198
  break;
188
199
  }
189
200
  canSaveResult = this.canSave(deltaObject);
190
201
  if (!(canSaveResult !== true)) {
191
- _context2.next = 13;
202
+ _context2.next = 19;
192
203
  break;
193
204
  }
194
205
  WebObject.addError(this, "Save not allowed", String(canSaveResult), true);
195
206
  this.setSaveResult(false, "canceled");
196
207
  return _context2.abrupt("return", false);
197
- case 13:
198
- _context2.next = 15;
208
+ case 19:
209
+ _context2.next = 21;
199
210
  return _global.gfunc.run_action(putAction, usepath, deltaObject);
200
- case 15:
211
+ case 21:
201
212
  resultObject = _context2.sent;
202
213
  this.setSaveResult(resultObject, "auto");
203
214
  if (!this.__saveResultIsSuccess) {
204
215
  console.error("bad save result : ", resultObject);
205
216
  WebObject.addError(this, "Save result is not valid", "the response from server was not a valid saveresult object !", true);
206
217
  }
207
- _context2.next = 21;
218
+ _context2.next = 27;
208
219
  break;
209
- case 20:
220
+ case 26:
210
221
  /* nothing to save */
211
222
  this.setSaveResult(null, "nothing");
212
- case 21:
223
+ case 27:
213
224
  if (!this.isSaved) {
214
- _context2.next = 25;
225
+ _context2.next = 31;
215
226
  break;
216
227
  }
217
- _context2.next = 24;
228
+ _context2.next = 30;
218
229
  return this.onSave();
219
- case 24:
230
+ case 30:
220
231
  return _context2.abrupt("return", this.getSaveResult());
221
- case 25:
232
+ case 31:
233
+ _context2.prev = 31;
234
+ if (!this.manager) {
235
+ _context2.next = 37;
236
+ break;
237
+ }
238
+ _context2.next = 35;
239
+ return this.manager.setOption("saving", false);
240
+ case 35:
241
+ _context2.next = 37;
242
+ return this.manager.setOption("loading", false);
243
+ case 37:
244
+ return _context2.finish(31);
245
+ case 38:
222
246
  case "end":
223
247
  return _context2.stop();
224
248
  }
225
- }, _callee2, this);
249
+ }, _callee2, this, [[0,, 31, 38]]);
226
250
  }));
227
251
  function Save() {
228
252
  return _Save.apply(this, arguments);
@@ -116,6 +116,11 @@ export declare class ObjectManager<ObjType extends SimpleObject> extends RawObje
116
116
  addError(title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
117
117
  getErrors(): any[];
118
118
  clearErrors(): boolean;
119
+ /**
120
+ *
121
+ * @returns isChanged
122
+ */
123
+ useIsChanged(): any;
119
124
  static addError(o?: ObjectManager<any>, title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
120
125
  static getErrors(o: ObjectManager<any>): any[];
121
126
  static clearErrors(o: ObjectManager<any>): boolean;
@@ -700,6 +700,20 @@ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_RawObject) {
700
700
  value: function clearErrors() {
701
701
  return ObjectManager.clearErrors(this);
702
702
  }
703
+ /* -------------------------------------------------------------------------- */
704
+ /**
705
+ *
706
+ * @returns isChanged
707
+ */
708
+ }, {
709
+ key: "useIsChanged",
710
+ value: function useIsChanged() {
711
+ var _this4 = this;
712
+ return this.event_use("on_{change,save,load}", function () {
713
+ return _this4.isChanged;
714
+ });
715
+ }
716
+ /* -------------------------------------------------------------------------- */
703
717
  }], [{
704
718
  key: "events_clear",
705
719
  value: function events_clear(obj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.4.164",
3
+ "version": "1.4.166",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",