@azrico/webobject 1.4.68 → 1.4.70
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.
|
@@ -17,8 +17,7 @@ export declare class WebObjectManager<T extends WebObject> extends ObjectManager
|
|
|
17
17
|
* @param sendChange
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
|
-
setMetaValue(key: string, value: any,
|
|
21
|
-
getMeta(key: string): any;
|
|
20
|
+
setMetaValue(key: string, value: any, sendChange?: sendChangesType): Promise<boolean | undefined>;
|
|
22
21
|
getMetaValue(key: string): any;
|
|
23
22
|
get_deltaObject(): Promise<any>;
|
|
24
23
|
Save(): Promise<boolean>;
|
|
@@ -27,7 +27,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
27
27
|
/**
|
|
28
28
|
* This class manages the events of an Simple Object
|
|
29
29
|
*/
|
|
30
|
-
var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _get_deltaObject, _Save, _Load, _onNew, _onDelete, _onLoad, _onSave, _onAfterSave) {
|
|
30
|
+
var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _setMetaValue, _get_deltaObject, _Save, _Load, _onNew, _onDelete, _onLoad, _onSave, _onAfterSave) {
|
|
31
31
|
_inherits(WebObjectManager, _ObjectManager);
|
|
32
32
|
var _super = _createSuper(WebObjectManager);
|
|
33
33
|
/* -------------------------------------------------------------------------- */
|
|
@@ -90,90 +90,98 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _get_deltaObject,
|
|
|
90
90
|
*/
|
|
91
91
|
_createClass(WebObjectManager, [{
|
|
92
92
|
key: "setMetaValue",
|
|
93
|
-
value: function setMetaValue(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
value: function setMetaValue(_x, _x2) {
|
|
94
|
+
return (_setMetaValue = _setMetaValue || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, value) {
|
|
95
|
+
var _this$obj;
|
|
96
|
+
var sendChange,
|
|
97
|
+
_args2 = arguments;
|
|
98
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
99
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
100
|
+
case 0:
|
|
101
|
+
sendChange = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : "auto";
|
|
102
|
+
_context2.next = 3;
|
|
103
|
+
return (_this$obj = this.obj) === null || _this$obj === void 0 ? void 0 : _this$obj.setMetaValue(key, value, sendChange);
|
|
104
|
+
case 3:
|
|
105
|
+
return _context2.abrupt("return", _context2.sent);
|
|
106
|
+
case 4:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context2.stop();
|
|
109
|
+
}
|
|
110
|
+
}, _callee2, this);
|
|
111
|
+
}))).apply(this, arguments);
|
|
104
112
|
}
|
|
105
113
|
}, {
|
|
106
114
|
key: "getMetaValue",
|
|
107
115
|
value: function getMetaValue(key) {
|
|
108
|
-
var _this$
|
|
109
|
-
return (_this$
|
|
116
|
+
var _this$obj2;
|
|
117
|
+
return (_this$obj2 = this.obj) === null || _this$obj2 === void 0 ? void 0 : _this$obj2.getMetaValue(key);
|
|
110
118
|
}
|
|
111
119
|
/* -------------------------------------------------------------------------- */
|
|
112
120
|
}, {
|
|
113
121
|
key: "get_deltaObject",
|
|
114
122
|
value: function get_deltaObject() {
|
|
115
|
-
return (_get_deltaObject = _get_deltaObject || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
116
|
-
var _this$
|
|
117
|
-
return _regeneratorRuntime().wrap(function
|
|
118
|
-
while (1) switch (
|
|
123
|
+
return (_get_deltaObject = _get_deltaObject || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
124
|
+
var _this$obj3;
|
|
125
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
126
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
119
127
|
case 0:
|
|
120
|
-
|
|
121
|
-
return (_this$
|
|
128
|
+
_context3.next = 2;
|
|
129
|
+
return (_this$obj3 = this.obj) === null || _this$obj3 === void 0 ? void 0 : _this$obj3.get_deltaObject();
|
|
122
130
|
case 2:
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
|
|
131
|
+
_context3.t0 = _context3.sent;
|
|
132
|
+
if (_context3.t0) {
|
|
133
|
+
_context3.next = 5;
|
|
126
134
|
break;
|
|
127
135
|
}
|
|
128
|
-
|
|
136
|
+
_context3.t0 = {};
|
|
129
137
|
case 5:
|
|
130
|
-
return
|
|
138
|
+
return _context3.abrupt("return", _context3.t0);
|
|
131
139
|
case 6:
|
|
132
140
|
case "end":
|
|
133
|
-
return
|
|
141
|
+
return _context3.stop();
|
|
134
142
|
}
|
|
135
|
-
},
|
|
143
|
+
}, _callee3, this);
|
|
136
144
|
}))).apply(this, arguments);
|
|
137
145
|
} /* ------------------------------ save and load ----------------------------- */
|
|
138
146
|
}, {
|
|
139
147
|
key: "Save",
|
|
140
148
|
value: function Save() {
|
|
141
|
-
return (_Save = _Save || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
142
|
-
var _this$
|
|
143
|
-
return _regeneratorRuntime().wrap(function
|
|
144
|
-
while (1) switch (
|
|
149
|
+
return (_Save = _Save || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
150
|
+
var _this$obj4;
|
|
151
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
152
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
145
153
|
case 0:
|
|
146
|
-
|
|
147
|
-
return (_this$
|
|
154
|
+
_context4.next = 2;
|
|
155
|
+
return (_this$obj4 = this.obj) === null || _this$obj4 === void 0 ? void 0 : _this$obj4.Save();
|
|
148
156
|
case 2:
|
|
149
|
-
|
|
150
|
-
if (
|
|
151
|
-
|
|
157
|
+
_context4.t0 = _context4.sent;
|
|
158
|
+
if (_context4.t0) {
|
|
159
|
+
_context4.next = 5;
|
|
152
160
|
break;
|
|
153
161
|
}
|
|
154
|
-
|
|
162
|
+
_context4.t0 = false;
|
|
155
163
|
case 5:
|
|
156
|
-
return
|
|
164
|
+
return _context4.abrupt("return", _context4.t0);
|
|
157
165
|
case 6:
|
|
158
166
|
case "end":
|
|
159
|
-
return
|
|
167
|
+
return _context4.stop();
|
|
160
168
|
}
|
|
161
|
-
},
|
|
169
|
+
}, _callee4, this);
|
|
162
170
|
}))).apply(this, arguments);
|
|
163
171
|
}
|
|
164
172
|
}, {
|
|
165
173
|
key: "Load",
|
|
166
|
-
value: function Load(
|
|
167
|
-
return (_Load = _Load || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
168
|
-
return _regeneratorRuntime().wrap(function
|
|
169
|
-
while (1) switch (
|
|
174
|
+
value: function Load(_x3) {
|
|
175
|
+
return (_Load = _Load || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(search) {
|
|
176
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
177
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
170
178
|
case 0:
|
|
171
179
|
throw Error("load not implented");
|
|
172
180
|
case 1:
|
|
173
181
|
case "end":
|
|
174
|
-
return
|
|
182
|
+
return _context5.stop();
|
|
175
183
|
}
|
|
176
|
-
},
|
|
184
|
+
}, _callee5);
|
|
177
185
|
}))).apply(this, arguments);
|
|
178
186
|
}
|
|
179
187
|
/* -------------------------------------------------------------------------- */
|
|
@@ -182,14 +190,14 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _get_deltaObject,
|
|
|
182
190
|
}, {
|
|
183
191
|
key: "__web_path",
|
|
184
192
|
get: function get() {
|
|
185
|
-
var _this$
|
|
186
|
-
return ((_this$
|
|
193
|
+
var _this$obj5;
|
|
194
|
+
return ((_this$obj5 = this.obj) === null || _this$obj5 === void 0 ? void 0 : _this$obj5.__web_path) || this.constructor["__web_path"] || "";
|
|
187
195
|
}
|
|
188
196
|
}, {
|
|
189
197
|
key: "__web_type",
|
|
190
198
|
get: function get() {
|
|
191
|
-
var _this$
|
|
192
|
-
return ((_this$
|
|
199
|
+
var _this$obj6;
|
|
200
|
+
return ((_this$obj6 = this.obj) === null || _this$obj6 === void 0 ? void 0 : _this$obj6.__web_type) || this.constructor["__web_type"] || "";
|
|
193
201
|
}
|
|
194
202
|
}, {
|
|
195
203
|
key: "get_webname",
|
|
@@ -207,32 +215,32 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _get_deltaObject,
|
|
|
207
215
|
}, {
|
|
208
216
|
key: "onNew",
|
|
209
217
|
value: function onNew() {
|
|
210
|
-
return (_onNew = _onNew || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
211
|
-
var _this$
|
|
212
|
-
return _regeneratorRuntime().wrap(function
|
|
213
|
-
while (1) switch (
|
|
218
|
+
return (_onNew = _onNew || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
219
|
+
var _this$obj7;
|
|
220
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
221
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
214
222
|
case 0:
|
|
215
223
|
if (this.canModify) {
|
|
216
|
-
(_this$
|
|
224
|
+
(_this$obj7 = this.obj) === null || _this$obj7 === void 0 || _this$obj7.setOriginal();
|
|
217
225
|
}
|
|
218
|
-
|
|
226
|
+
_context6.next = 3;
|
|
219
227
|
return this.event_run("on_new");
|
|
220
228
|
case 3:
|
|
221
|
-
|
|
229
|
+
_context6.next = 5;
|
|
222
230
|
return this.event_run("on_change", true);
|
|
223
231
|
case 5:
|
|
224
|
-
|
|
232
|
+
_context6.next = 7;
|
|
225
233
|
return this.event_run("on_after_new");
|
|
226
234
|
case 7:
|
|
227
|
-
|
|
235
|
+
_context6.next = 9;
|
|
228
236
|
return Promise.resolve(true);
|
|
229
237
|
case 9:
|
|
230
|
-
return
|
|
238
|
+
return _context6.abrupt("return", _context6.sent);
|
|
231
239
|
case 10:
|
|
232
240
|
case "end":
|
|
233
|
-
return
|
|
241
|
+
return _context6.stop();
|
|
234
242
|
}
|
|
235
|
-
},
|
|
243
|
+
}, _callee6, this);
|
|
236
244
|
}))).apply(this, arguments);
|
|
237
245
|
}
|
|
238
246
|
/**
|
|
@@ -243,28 +251,28 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _get_deltaObject,
|
|
|
243
251
|
}, {
|
|
244
252
|
key: "onDelete",
|
|
245
253
|
value: function onDelete() {
|
|
246
|
-
return (_onDelete = _onDelete || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
247
|
-
return _regeneratorRuntime().wrap(function
|
|
248
|
-
while (1) switch (
|
|
254
|
+
return (_onDelete = _onDelete || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
255
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
256
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
249
257
|
case 0:
|
|
250
258
|
if (this.obj) {
|
|
251
259
|
this.obj.isDeleted = true;
|
|
252
260
|
}
|
|
253
|
-
|
|
261
|
+
_context7.next = 3;
|
|
254
262
|
return this.event_run("on_delete");
|
|
255
263
|
case 3:
|
|
256
|
-
|
|
264
|
+
_context7.next = 5;
|
|
257
265
|
return this.event_run("on_after_delete");
|
|
258
266
|
case 5:
|
|
259
|
-
|
|
267
|
+
_context7.next = 7;
|
|
260
268
|
return Promise.resolve(true);
|
|
261
269
|
case 7:
|
|
262
|
-
return
|
|
270
|
+
return _context7.abrupt("return", _context7.sent);
|
|
263
271
|
case 8:
|
|
264
272
|
case "end":
|
|
265
|
-
return
|
|
273
|
+
return _context7.stop();
|
|
266
274
|
}
|
|
267
|
-
},
|
|
275
|
+
}, _callee7, this);
|
|
268
276
|
}))).apply(this, arguments);
|
|
269
277
|
}
|
|
270
278
|
/**
|
|
@@ -275,35 +283,35 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _get_deltaObject,
|
|
|
275
283
|
}, {
|
|
276
284
|
key: "onLoad",
|
|
277
285
|
value: function onLoad() {
|
|
278
|
-
return (_onLoad = _onLoad || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
279
|
-
return _regeneratorRuntime().wrap(function
|
|
280
|
-
while (1) switch (
|
|
286
|
+
return (_onLoad = _onLoad || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
287
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
288
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
281
289
|
case 0:
|
|
282
290
|
if (this.canModify && this.obj) {
|
|
283
291
|
this.obj.isDeleted = false;
|
|
284
292
|
this.obj.setOriginal();
|
|
285
293
|
}
|
|
286
|
-
|
|
294
|
+
_context8.next = 3;
|
|
287
295
|
return this.event_run("on_load");
|
|
288
296
|
case 3:
|
|
289
|
-
|
|
297
|
+
_context8.next = 5;
|
|
290
298
|
return this.event_run("on_change", true);
|
|
291
299
|
case 5:
|
|
292
|
-
|
|
300
|
+
_context8.next = 7;
|
|
293
301
|
return this.event_run("on_after_load");
|
|
294
302
|
case 7:
|
|
295
|
-
|
|
303
|
+
_context8.next = 9;
|
|
296
304
|
return this.event_run("on_load_finished");
|
|
297
305
|
case 9:
|
|
298
|
-
|
|
306
|
+
_context8.next = 11;
|
|
299
307
|
return Promise.resolve(true);
|
|
300
308
|
case 11:
|
|
301
|
-
return
|
|
309
|
+
return _context8.abrupt("return", _context8.sent);
|
|
302
310
|
case 12:
|
|
303
311
|
case "end":
|
|
304
|
-
return
|
|
312
|
+
return _context8.stop();
|
|
305
313
|
}
|
|
306
|
-
},
|
|
314
|
+
}, _callee8, this);
|
|
307
315
|
}))).apply(this, arguments);
|
|
308
316
|
}
|
|
309
317
|
/**
|
|
@@ -314,49 +322,49 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager, _get_deltaObject,
|
|
|
314
322
|
}, {
|
|
315
323
|
key: "onSave",
|
|
316
324
|
value: function onSave() {
|
|
317
|
-
return (_onSave = _onSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
318
|
-
return _regeneratorRuntime().wrap(function
|
|
319
|
-
while (1) switch (
|
|
325
|
+
return (_onSave = _onSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
326
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
327
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
320
328
|
case 0:
|
|
321
|
-
|
|
329
|
+
_context9.next = 2;
|
|
322
330
|
return this.event_run("on_save");
|
|
323
331
|
case 2:
|
|
324
|
-
|
|
332
|
+
_context9.next = 4;
|
|
325
333
|
return this.event_run("on_change", true);
|
|
326
334
|
case 4:
|
|
327
|
-
|
|
335
|
+
_context9.next = 6;
|
|
328
336
|
return Promise.resolve(true);
|
|
329
337
|
case 6:
|
|
330
|
-
return
|
|
338
|
+
return _context9.abrupt("return", _context9.sent);
|
|
331
339
|
case 7:
|
|
332
340
|
case "end":
|
|
333
|
-
return
|
|
341
|
+
return _context9.stop();
|
|
334
342
|
}
|
|
335
|
-
},
|
|
343
|
+
}, _callee9, this);
|
|
336
344
|
}))).apply(this, arguments);
|
|
337
345
|
}
|
|
338
346
|
}, {
|
|
339
347
|
key: "onAfterSave",
|
|
340
348
|
value: function onAfterSave() {
|
|
341
|
-
return (_onAfterSave = _onAfterSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
342
|
-
return _regeneratorRuntime().wrap(function
|
|
343
|
-
while (1) switch (
|
|
349
|
+
return (_onAfterSave = _onAfterSave || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
350
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
351
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
344
352
|
case 0:
|
|
345
|
-
|
|
353
|
+
_context10.next = 2;
|
|
346
354
|
return this.event_run("on_after_save");
|
|
347
355
|
case 2:
|
|
348
|
-
|
|
356
|
+
_context10.next = 4;
|
|
349
357
|
return this.event_run("on_save_finished");
|
|
350
358
|
case 4:
|
|
351
|
-
|
|
359
|
+
_context10.next = 6;
|
|
352
360
|
return Promise.resolve(true);
|
|
353
361
|
case 6:
|
|
354
|
-
return
|
|
362
|
+
return _context10.abrupt("return", _context10.sent);
|
|
355
363
|
case 7:
|
|
356
364
|
case "end":
|
|
357
|
-
return
|
|
365
|
+
return _context10.stop();
|
|
358
366
|
}
|
|
359
|
-
},
|
|
367
|
+
}, _callee10, this);
|
|
360
368
|
}))).apply(this, arguments);
|
|
361
369
|
}
|
|
362
370
|
}]);
|