@azrico/webobject 1.2.17 → 1.2.18
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.
- package/dist/index.js +1 -18
- package/dist/src/WebObjects/ParentWebObject.js +13 -94
- package/dist/src/WebObjects/WebObject.js +220 -740
- package/dist/src/WebObjects/WebObjectManager.js +74 -351
- package/dist/src/index.js +8 -109
- package/dist/src/structs/DummyObject.js +8 -54
- package/dist/src/structs/MapableObject.js +72 -141
- package/dist/src/structs/MetaObject.js +35 -171
- package/dist/src/structs/ObjectArray.js +43 -84
- package/dist/src/structs/ObjectManager.js +202 -657
- package/dist/src/structs/SimpleObject.d.ts +2 -0
- package/dist/src/structs/SimpleObject.js +580 -989
- package/package.json +1 -1
|
@@ -1,1007 +1,598 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
_defineProperty(_assertThisInitialized(_this), "get", _classPrivateMethodGet(_assertThisInitialized(_this), _getProperty, _getProperty2));
|
|
123
|
-
|
|
124
|
-
_defineProperty(_assertThisInitialized(_this), "set", _this.setValue);
|
|
125
|
-
|
|
126
|
-
_defineProperty(_assertThisInitialized(_this), "get_managerClass", function () {
|
|
127
|
-
return null;
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
_this.__delta = {};
|
|
131
|
-
_this.__is_readonly = is_readonly;
|
|
132
|
-
_this.__throw_errors = true;
|
|
133
|
-
|
|
134
|
-
_this.clear_changes();
|
|
135
|
-
|
|
136
|
-
return _this;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
_createClass(SimpleObject, [{
|
|
140
|
-
key: "_static",
|
|
141
|
-
value: function _static() {
|
|
142
|
-
return this.constructor;
|
|
143
|
-
}
|
|
144
|
-
}, {
|
|
145
|
-
key: "loadValues",
|
|
146
|
-
value:
|
|
147
|
-
/* -------------------------------------------------------------------------- */
|
|
148
|
-
|
|
149
|
-
/* Load */
|
|
150
|
-
|
|
151
|
-
/* -------------------------------------------------------------------------- */
|
|
152
|
-
function loadValues(initObject) {
|
|
153
|
-
var fullUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
154
|
-
return SimpleObject.loadValues(this, initObject, fullUpdate);
|
|
155
|
-
}
|
|
156
|
-
}, {
|
|
157
|
-
key: "setValue",
|
|
158
|
-
value:
|
|
1
|
+
import { gcache, gfunc } from "@azrico/global";
|
|
2
|
+
import { object_clone, object_equals, object_isEmpty, object_isTrue, object_removeKeys, } from "@azrico/object";
|
|
3
|
+
import { MapableObject } from "./MapableObject";
|
|
4
|
+
import ObjectManager from "./ObjectManager";
|
|
5
|
+
import { combine_if_not_blank } from "@azrico/string";
|
|
6
|
+
export class SimpleObject extends MapableObject {
|
|
7
|
+
static __cache_name;
|
|
8
|
+
static __unchangeables;
|
|
9
|
+
static __changeables;
|
|
10
|
+
static __extraProperties;
|
|
11
|
+
static __use_delta = true;
|
|
12
|
+
_static() {
|
|
13
|
+
return this.constructor;
|
|
14
|
+
}
|
|
15
|
+
__originalobject;
|
|
16
|
+
//changes
|
|
17
|
+
__delta;
|
|
18
|
+
__changed = false;
|
|
19
|
+
__lastChanged = "";
|
|
20
|
+
__is_readonly;
|
|
21
|
+
__throw_errors;
|
|
22
|
+
//errors
|
|
23
|
+
__errors;
|
|
24
|
+
__showErrors;
|
|
25
|
+
//save results
|
|
26
|
+
__saveResultObject;
|
|
27
|
+
__saveResultIsSuccess;
|
|
28
|
+
__saveResultType = null;
|
|
29
|
+
//sequence key
|
|
30
|
+
_index_key = "";
|
|
31
|
+
//sequence value , used to index the object with increasing numbers
|
|
32
|
+
_index_value = -1;
|
|
33
|
+
constructor(is_readonly = false) {
|
|
34
|
+
super();
|
|
35
|
+
this.__delta = {};
|
|
36
|
+
this.__is_readonly = is_readonly;
|
|
37
|
+
this.__throw_errors = true;
|
|
38
|
+
this.clear_changes();
|
|
39
|
+
}
|
|
40
|
+
#setSubProperty(key, subkey, value) {
|
|
41
|
+
let subobj = this.#getProperty(key);
|
|
42
|
+
//@ts-ignore
|
|
43
|
+
if (subobj == null || typeof subobj !== "object")
|
|
44
|
+
subobj = {};
|
|
45
|
+
subobj[subkey] = value;
|
|
46
|
+
this.#setProperty(key, subobj);
|
|
47
|
+
}
|
|
48
|
+
#getSubProperty(key, subkey, original = false) {
|
|
49
|
+
let subobj = this.#getProperty(key, original);
|
|
50
|
+
if (subobj == null || typeof subobj !== "object")
|
|
51
|
+
return undefined;
|
|
52
|
+
return subobj[subkey];
|
|
53
|
+
}
|
|
54
|
+
#setProperty(key, value) {
|
|
55
|
+
if (this.__use_delta)
|
|
56
|
+
this.__delta[key] = value;
|
|
57
|
+
else
|
|
58
|
+
this[key] = value;
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
#setDefaultProperty(key, value) {
|
|
62
|
+
if (this[key] == undefined || this[key] === "" || this[key] === 0) {
|
|
63
|
+
this[key] = value;
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
#getProperty(key, original = false) {
|
|
69
|
+
//check if we should use delta version or normal version for this property
|
|
70
|
+
if (this.__use_delta && !original && key in this.__delta) {
|
|
71
|
+
//@ts-ignore
|
|
72
|
+
return this.__delta[key];
|
|
73
|
+
}
|
|
74
|
+
return this[key];
|
|
75
|
+
}
|
|
76
|
+
/* -------------------------------------------------------------------------- */
|
|
77
|
+
/* Load */
|
|
78
|
+
/* -------------------------------------------------------------------------- */
|
|
79
|
+
loadValues(initObject, fullUpdate = false) {
|
|
80
|
+
return SimpleObject.loadValues(this, initObject, fullUpdate);
|
|
81
|
+
}
|
|
82
|
+
static loadValues(obj, initObject, fullUpdate = false) {
|
|
83
|
+
SimpleObject.factoryClear(obj);
|
|
84
|
+
if (initObject == null) {
|
|
85
|
+
for (const key in obj) {
|
|
86
|
+
if (typeof obj[key] === "function")
|
|
87
|
+
continue;
|
|
88
|
+
if (key.startsWith("__"))
|
|
89
|
+
continue;
|
|
90
|
+
delete obj[key];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (typeof initObject == "object") {
|
|
94
|
+
for (const key in initObject) {
|
|
95
|
+
if (key.startsWith("__"))
|
|
96
|
+
continue;
|
|
97
|
+
if (fullUpdate ||
|
|
98
|
+
Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
99
|
+
obj[key] = initObject[key];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
/* -------------------------------------------------------------------------- */
|
|
106
|
+
static getValue(o, key, original = false) {
|
|
107
|
+
if (o == null)
|
|
108
|
+
return undefined;
|
|
109
|
+
if (o instanceof SimpleObject && typeof o.getValue === "function")
|
|
110
|
+
return o.getValue(key, original);
|
|
111
|
+
if (!original &&
|
|
112
|
+
o.__use_delta != false &&
|
|
113
|
+
typeof o.__delta === "object" &&
|
|
114
|
+
key in o.__delta) {
|
|
115
|
+
//@ts-ignore
|
|
116
|
+
return o.__delta[key];
|
|
117
|
+
}
|
|
118
|
+
return o[key];
|
|
119
|
+
}
|
|
120
|
+
getValue = this.#getProperty;
|
|
121
|
+
get = this.#getProperty;
|
|
159
122
|
/**
|
|
160
123
|
* set value
|
|
161
124
|
* @param key
|
|
162
125
|
* @param value
|
|
163
126
|
* @return true if changed , false otherwise
|
|
164
|
-
*/
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (!(0, _object.object_equals)(oldval, value, {
|
|
198
|
-
ignoredStartingWords: "_"
|
|
199
|
-
})) {
|
|
200
|
-
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, value);
|
|
201
|
-
|
|
202
|
-
isValueChanged = true;
|
|
203
|
-
} else isValueChanged = false; //console.log("SV:", isValueChanged, oldval, key, value);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
case 11:
|
|
207
|
-
_context.prev = 11;
|
|
208
|
-
|
|
209
|
-
if (!(sendChanges === true || sendChanges === "auto" && isValueChanged)) {
|
|
210
|
-
_context.next = 15;
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
_context.next = 15;
|
|
215
|
-
return this.notifyChanged("", String(key), value);
|
|
216
|
-
|
|
217
|
-
case 15:
|
|
218
|
-
return _context.finish(11);
|
|
219
|
-
|
|
220
|
-
case 16:
|
|
221
|
-
return _context.abrupt("return", isValueChanged);
|
|
222
|
-
|
|
223
|
-
case 17:
|
|
224
|
-
case "end":
|
|
225
|
-
return _context.stop();
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}, _callee, this, [[8,, 11, 16]]);
|
|
229
|
-
}));
|
|
230
|
-
|
|
231
|
-
function setValue(_x, _x2) {
|
|
232
|
-
return _setValue.apply(this, arguments);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return setValue;
|
|
236
|
-
}()
|
|
237
|
-
}, {
|
|
238
|
-
key: "setSubValue",
|
|
239
|
-
value:
|
|
127
|
+
*/
|
|
128
|
+
async setValue(key, value, sendChanges = "auto") {
|
|
129
|
+
if (!this.canModify) {
|
|
130
|
+
if (this.__throw_errors)
|
|
131
|
+
throw Error("Cant use setValue when on readonly mode");
|
|
132
|
+
else
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
let isValueChanged = false;
|
|
136
|
+
try {
|
|
137
|
+
const oldval = this.getValue(key);
|
|
138
|
+
if (!object_equals(oldval, value, { ignoredStartingWords: "_" })) {
|
|
139
|
+
this.#setProperty(key, value);
|
|
140
|
+
isValueChanged = true;
|
|
141
|
+
}
|
|
142
|
+
else
|
|
143
|
+
isValueChanged = false;
|
|
144
|
+
//console.log("SV:", isValueChanged, oldval, key, value);
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
if (sendChanges === true ||
|
|
148
|
+
(sendChanges === "auto" && isValueChanged)) {
|
|
149
|
+
await this.notifyChanged("", String(key), value);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return isValueChanged;
|
|
153
|
+
}
|
|
154
|
+
set = this.setValue;
|
|
155
|
+
setDefaultValue(key, value) {
|
|
156
|
+
return this.#setDefaultProperty(key, value);
|
|
157
|
+
}
|
|
158
|
+
setDefault = this.setDefaultValue;
|
|
240
159
|
/**
|
|
241
160
|
* set key of subObject
|
|
242
161
|
* @param key
|
|
243
162
|
* @param value
|
|
244
163
|
* @param subvalue
|
|
245
164
|
* @return true if changed , false otherwise
|
|
246
|
-
*/
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
if (this.canModify) {
|
|
342
|
-
_context3.next = 9;
|
|
343
|
-
break;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
if (!this.__throw_errors) {
|
|
347
|
-
_context3.next = 8;
|
|
348
|
-
break;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
throw Error("Cant use pushValue when on readonly mode");
|
|
352
|
-
|
|
353
|
-
case 8:
|
|
354
|
-
return _context3.abrupt("return", false);
|
|
355
|
-
|
|
356
|
-
case 9:
|
|
357
|
-
if (_classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key) == null) {
|
|
358
|
-
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, this.getValue(key));
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
tempArray = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key);
|
|
362
|
-
|
|
363
|
-
if (Array.isArray(tempArray)) {
|
|
364
|
-
_context3.next = 17;
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
if (!this.__throw_errors) {
|
|
369
|
-
_context3.next = 16;
|
|
370
|
-
break;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
throw Error("Cant use pushValue on non Array keys");
|
|
374
|
-
|
|
375
|
-
case 16:
|
|
376
|
-
return _context3.abrupt("return", false);
|
|
377
|
-
|
|
378
|
-
case 17:
|
|
379
|
-
tempArray.push(value);
|
|
380
|
-
|
|
381
|
-
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, tempArray);
|
|
382
|
-
|
|
383
|
-
if (!(sendChanges === true || sendChanges === "auto")) {
|
|
384
|
-
_context3.next = 22;
|
|
385
|
-
break;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
_context3.next = 22;
|
|
389
|
-
return this.notifyChanged("", String(key), value);
|
|
390
|
-
|
|
391
|
-
case 22:
|
|
392
|
-
return _context3.abrupt("return", tempArray);
|
|
393
|
-
|
|
394
|
-
case 23:
|
|
395
|
-
case "end":
|
|
396
|
-
return _context3.stop();
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}, _callee3, this);
|
|
400
|
-
}));
|
|
401
|
-
|
|
402
|
-
function pushValue(_x6, _x7) {
|
|
403
|
-
return _pushValue.apply(this, arguments);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
return pushValue;
|
|
407
|
-
}()
|
|
408
|
-
}, {
|
|
409
|
-
key: "notifyChanged",
|
|
410
|
-
value: function () {
|
|
411
|
-
var _notifyChanged = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(type, key, value, subvalue) {
|
|
412
|
-
var lc, manager_class;
|
|
413
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
414
|
-
while (1) {
|
|
415
|
-
switch (_context4.prev = _context4.next) {
|
|
416
|
-
case 0:
|
|
417
|
-
if (value === undefined && type != "meta") value = this.getValue(key);
|
|
418
|
-
this.__changed = true;
|
|
419
|
-
lc = "";
|
|
420
|
-
if (type) lc += "[".concat(String(type), "] ");
|
|
421
|
-
|
|
422
|
-
if (subvalue) {
|
|
423
|
-
lc += "".concat(String(key), "->").concat(value, " = ").concat(subvalue);
|
|
424
|
-
} else {
|
|
425
|
-
lc += "".concat(String(key), " = ").concat(value);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
this.__lastChanged = lc;
|
|
429
|
-
/* --------------------------- notify the manager --------------------------- */
|
|
430
|
-
|
|
431
|
-
manager_class = this.get_managerClass();
|
|
432
|
-
|
|
433
|
-
if (!(manager_class instanceof _ObjectManager["default"])) {
|
|
434
|
-
_context4.next = 10;
|
|
435
|
-
break;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
_context4.next = 10;
|
|
439
|
-
return manager_class.notifyChanged(type, key, value, subvalue);
|
|
440
|
-
|
|
441
|
-
case 10:
|
|
442
|
-
case "end":
|
|
443
|
-
return _context4.stop();
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}, _callee4, this);
|
|
447
|
-
}));
|
|
448
|
-
|
|
449
|
-
function notifyChanged(_x8, _x9, _x10, _x11) {
|
|
450
|
-
return _notifyChanged.apply(this, arguments);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
return notifyChanged;
|
|
454
|
-
}()
|
|
455
|
-
}, {
|
|
456
|
-
key: "apply_changes",
|
|
457
|
-
value:
|
|
458
|
-
/* -------------------------------------------------------------------------- */
|
|
459
|
-
|
|
460
|
-
/* Changes */
|
|
461
|
-
|
|
462
|
-
/* -------------------------------------------------------------------------- */
|
|
463
|
-
|
|
165
|
+
*/
|
|
166
|
+
async setSubValue(key, objKey, subvalue, sendChanges = "auto") {
|
|
167
|
+
if (!this.canModify) {
|
|
168
|
+
if (this.__throw_errors)
|
|
169
|
+
throw Error("Cant use setValue when on readonly mode");
|
|
170
|
+
else
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
let isValueChanged = false;
|
|
174
|
+
try {
|
|
175
|
+
//if accessing subval of an object, make sure the object is not null
|
|
176
|
+
const subval = this.#getSubProperty(key, objKey);
|
|
177
|
+
if (!object_equals(subval, subvalue, {
|
|
178
|
+
ignoredStartingWords: "_",
|
|
179
|
+
})) {
|
|
180
|
+
this.#setSubProperty(key, objKey, subvalue);
|
|
181
|
+
isValueChanged = true;
|
|
182
|
+
}
|
|
183
|
+
else
|
|
184
|
+
isValueChanged = false;
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
if (sendChanges === true ||
|
|
188
|
+
(sendChanges === "auto" && isValueChanged)) {
|
|
189
|
+
await this.notifyChanged("", String(key), objKey, subvalue);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return isValueChanged;
|
|
193
|
+
}
|
|
194
|
+
//Push value on array
|
|
195
|
+
async pushValue(key, value, sendChanges = "auto") {
|
|
196
|
+
if (value == null)
|
|
197
|
+
return false;
|
|
198
|
+
if (!this.canModify) {
|
|
199
|
+
if (this.__throw_errors)
|
|
200
|
+
throw Error("Cant use pushValue when on readonly mode");
|
|
201
|
+
else
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
if (this.#getProperty(key) == null) {
|
|
205
|
+
this.#setProperty(key, this.getValue(key));
|
|
206
|
+
}
|
|
207
|
+
let tempArray = this.#getProperty(key);
|
|
208
|
+
if (!Array.isArray(tempArray)) {
|
|
209
|
+
if (this.__throw_errors)
|
|
210
|
+
throw Error("Cant use pushValue on non Array keys");
|
|
211
|
+
else
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
tempArray.push(value);
|
|
215
|
+
this.#setProperty(key, tempArray);
|
|
216
|
+
if (sendChanges === true || sendChanges === "auto") {
|
|
217
|
+
await this.notifyChanged("", String(key), value);
|
|
218
|
+
}
|
|
219
|
+
return tempArray;
|
|
220
|
+
}
|
|
221
|
+
async notifyChanged(type, key, value, subvalue) {
|
|
222
|
+
if (value === undefined && type != "meta")
|
|
223
|
+
value = this.getValue(key);
|
|
224
|
+
this.__changed = true;
|
|
225
|
+
let lc = "";
|
|
226
|
+
if (type)
|
|
227
|
+
lc += `[${String(type)}] `;
|
|
228
|
+
if (subvalue) {
|
|
229
|
+
lc += `${String(key)}->${value} = ${subvalue}`;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
lc += `${String(key)} = ${value}`;
|
|
233
|
+
}
|
|
234
|
+
this.__lastChanged = lc;
|
|
235
|
+
/* --------------------------- notify the manager --------------------------- */
|
|
236
|
+
const manager_class = this.get_managerClass();
|
|
237
|
+
if (manager_class instanceof ObjectManager) {
|
|
238
|
+
await manager_class.notifyChanged(type, key, value, subvalue);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
static canChangeKey(object, key, useExtraProps) {
|
|
242
|
+
if (!object || !key)
|
|
243
|
+
return false;
|
|
244
|
+
if (useExtraProps) {
|
|
245
|
+
const __extraProperties = object.constructor["__extraProperties"];
|
|
246
|
+
if (__extraProperties != null && __extraProperties.includes(key))
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
const __changeables = object.constructor["__changeables"];
|
|
250
|
+
const __unchangeables = object.constructor["__unchangeables"];
|
|
251
|
+
if (__changeables != null && !__changeables.includes(key))
|
|
252
|
+
return false;
|
|
253
|
+
if (__unchangeables != null && __unchangeables.includes(key))
|
|
254
|
+
return false;
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
/* -------------------------------------------------------------------------- */
|
|
258
|
+
/* Changes */
|
|
259
|
+
/* -------------------------------------------------------------------------- */
|
|
464
260
|
/**
|
|
465
261
|
* Apply the changes and empty the delta object
|
|
466
|
-
*/
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
this
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
key: "clear_changes",
|
|
486
|
-
value: function clear_changes() {
|
|
487
|
-
this.__delta = {};
|
|
488
|
-
this.__changed = false;
|
|
489
|
-
}
|
|
262
|
+
*/
|
|
263
|
+
apply_changes() {
|
|
264
|
+
if (!this.__use_delta) {
|
|
265
|
+
console.warn("you cant use apply_changes if you are not using Delta mode");
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
if (!this.isChanged) {
|
|
269
|
+
console.warn("No changes to apply");
|
|
270
|
+
}
|
|
271
|
+
for (const key in this.__delta) {
|
|
272
|
+
const nv = this.__delta[key];
|
|
273
|
+
this[key] = nv;
|
|
274
|
+
}
|
|
275
|
+
this.clear_changes();
|
|
276
|
+
}
|
|
277
|
+
clear_changes() {
|
|
278
|
+
this.__delta = {};
|
|
279
|
+
this.__changed = false;
|
|
280
|
+
}
|
|
490
281
|
/**
|
|
491
282
|
* Sets readonly property on given objects
|
|
492
283
|
* @param objs array of given objects or a single object
|
|
493
284
|
* @param readonlyval readonly
|
|
494
285
|
* @param clearChanges should we clean the changes after setting readonly
|
|
495
|
-
*/
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
get
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
return;
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
key: "getID",
|
|
809
|
-
value: function getID(o) {
|
|
810
|
-
if (o == null || o == undefined) return "";
|
|
811
|
-
|
|
812
|
-
switch (_typeof(o)) {
|
|
813
|
-
case "object":
|
|
814
|
-
return o.__data_id || o._id || o.id || o.ID || "";
|
|
815
|
-
|
|
816
|
-
case "string":
|
|
817
|
-
case "number":
|
|
818
|
-
return String(o);
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
return "";
|
|
822
|
-
}
|
|
823
|
-
}, {
|
|
824
|
-
key: "setOriginal",
|
|
825
|
-
value: function setOriginal(obj) {
|
|
826
|
-
var toObj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
827
|
-
if (!(obj instanceof SimpleObject)) return undefined;
|
|
828
|
-
return obj.setOriginal(toObj);
|
|
829
|
-
}
|
|
830
|
-
}, {
|
|
831
|
-
key: "getOriginal",
|
|
832
|
-
value: function getOriginal(obj) {
|
|
833
|
-
if (obj instanceof SimpleObject) return obj.getOriginal();
|
|
834
|
-
return obj === null || obj === void 0 ? void 0 : obj.__originalobject;
|
|
835
|
-
}
|
|
836
|
-
/* -------------------------------------------------------------------------- */
|
|
837
|
-
|
|
838
|
-
/* Errors */
|
|
839
|
-
|
|
840
|
-
/* -------------------------------------------------------------------------- */
|
|
841
|
-
|
|
842
|
-
}, {
|
|
843
|
-
key: "addError",
|
|
844
|
-
value: function addError(o, title, message) {
|
|
845
|
-
var sendToRegister = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
846
|
-
var errStr = (0, _string.combine_if_not_blank)(title, " : ", message);
|
|
847
|
-
|
|
848
|
-
if (o) {
|
|
849
|
-
if (!Array.isArray(o.__errors)) o.__errors = [];
|
|
850
|
-
|
|
851
|
-
o.__errors.push(errStr);
|
|
852
|
-
|
|
853
|
-
if (o.__showErrors === false) return;
|
|
854
|
-
} else if (sendToRegister === "auto") sendToRegister = true;
|
|
855
|
-
|
|
856
|
-
if (sendToRegister === true) {
|
|
857
|
-
console.error("[REGISTER-ERROR]", errStr);
|
|
858
|
-
|
|
859
|
-
_global.gfunc.run_action("add_error", {
|
|
860
|
-
title: title,
|
|
861
|
-
message: message,
|
|
862
|
-
type: "error"
|
|
863
|
-
});
|
|
864
|
-
} else {
|
|
865
|
-
console.error("[ERROR]", errStr);
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
return (o === null || o === void 0 ? void 0 : o.__errors) || [];
|
|
869
|
-
}
|
|
870
|
-
}, {
|
|
871
|
-
key: "getErrors",
|
|
872
|
-
value: function getErrors(o) {
|
|
873
|
-
return (o === null || o === void 0 ? void 0 : o.__errors) || [];
|
|
874
|
-
}
|
|
875
|
-
}, {
|
|
876
|
-
key: "clearErrors",
|
|
877
|
-
value: function clearErrors(o) {
|
|
878
|
-
if (o) o.__errors = [];
|
|
879
|
-
return true;
|
|
880
|
-
}
|
|
881
|
-
/* -------------------------------------------------------------------------- */
|
|
882
|
-
|
|
883
|
-
/* Save Results */
|
|
884
|
-
|
|
885
|
-
/* -------------------------------------------------------------------------- */
|
|
886
|
-
|
|
887
|
-
}, {
|
|
888
|
-
key: "isResultValid",
|
|
889
|
-
value: function isResultValid(result_object) {
|
|
890
|
-
if ((0, _object.object_isEmpty)(result_object)) return false;
|
|
891
|
-
|
|
892
|
-
switch (_typeof(result_object)) {
|
|
893
|
-
case "string":
|
|
894
|
-
try {
|
|
895
|
-
result_object = JSON.parse(result_object);
|
|
896
|
-
return this.isResultValid(result_object);
|
|
897
|
-
} catch (_unused) {
|
|
898
|
-
return false;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
case "object":
|
|
902
|
-
if ((0, _object.object_isTrue)(result_object.acknowledged)) {
|
|
903
|
-
return true;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
if (result_object.expected && result_object.result) {
|
|
907
|
-
return (0, _object.object_equals)(result_object.expected, result_object.result);
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
return Number(this.getID(result_object)) >= 0;
|
|
911
|
-
|
|
912
|
-
case "number":
|
|
913
|
-
return result_object > 0;
|
|
914
|
-
|
|
915
|
-
case "boolean":
|
|
916
|
-
return result_object === true;
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
return false;
|
|
920
|
-
}
|
|
921
|
-
}, {
|
|
922
|
-
key: "factoryClear",
|
|
923
|
-
value: function factoryClear(obj) {
|
|
924
|
-
obj.clear_changes();
|
|
925
|
-
SimpleObject.clearErrors(obj);
|
|
926
|
-
}
|
|
927
|
-
}, {
|
|
928
|
-
key: "delete_cache",
|
|
929
|
-
value: function delete_cache() {
|
|
930
|
-
if (!this.__cache_name) return;
|
|
931
|
-
|
|
932
|
-
_global.gcache.delete_cache(this.__cache_name);
|
|
933
|
-
}
|
|
934
|
-
}, {
|
|
935
|
-
key: "get_canModify",
|
|
936
|
-
value: function get_canModify(o) {
|
|
937
|
-
if (o instanceof SimpleObject) return o.canModify;
|
|
938
|
-
return false;
|
|
939
|
-
}
|
|
940
|
-
/* -------------------------------------------------------------------------- */
|
|
941
|
-
|
|
942
|
-
}, {
|
|
943
|
-
key: "equals",
|
|
944
|
-
value: function equals(a, b) {
|
|
945
|
-
console.warn("Dont use the default equals method !");
|
|
946
|
-
if (a == undefined || b == undefined) return false;
|
|
947
|
-
return a === b;
|
|
948
|
-
}
|
|
949
|
-
}]);
|
|
950
|
-
|
|
951
|
-
return SimpleObject;
|
|
952
|
-
}(_MapableObject2.MapableObject);
|
|
953
|
-
|
|
954
|
-
exports.SimpleObject = SimpleObject;
|
|
955
|
-
|
|
956
|
-
function _setSubProperty2(key, subkey, value) {
|
|
957
|
-
var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key); //@ts-ignore
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
if (subobj == null || _typeof(subobj) !== "object") subobj = {};
|
|
961
|
-
subobj[subkey] = value;
|
|
962
|
-
|
|
963
|
-
_classPrivateMethodGet(this, _setProperty, _setProperty2).call(this, key, subobj);
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
function _getSubProperty2(key, subkey) {
|
|
967
|
-
var original = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
968
|
-
|
|
969
|
-
var subobj = _classPrivateMethodGet(this, _getProperty, _getProperty2).call(this, key, original);
|
|
970
|
-
|
|
971
|
-
if (subobj == null || _typeof(subobj) !== "object") return undefined;
|
|
972
|
-
return subobj[subkey];
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
function _setProperty2(key, value) {
|
|
976
|
-
if (this.__use_delta) this.__delta[key] = value;else this[key] = value;
|
|
977
|
-
return true;
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
function _getProperty2(key) {
|
|
981
|
-
var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
982
|
-
|
|
983
|
-
//check if we should use delta version or normal version for this property
|
|
984
|
-
if (this.__use_delta && !original && key in this.__delta) {
|
|
985
|
-
//@ts-ignore
|
|
986
|
-
return this.__delta[key];
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
return this[key];
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
function _setSaveResultObject2(toObj) {
|
|
993
|
-
this.__saveResultObject = toObj;
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
_defineProperty(SimpleObject, "__cache_name", void 0);
|
|
997
|
-
|
|
998
|
-
_defineProperty(SimpleObject, "__unchangeables", void 0);
|
|
999
|
-
|
|
1000
|
-
_defineProperty(SimpleObject, "__changeables", void 0);
|
|
1001
|
-
|
|
1002
|
-
_defineProperty(SimpleObject, "__extraProperties", void 0);
|
|
1003
|
-
|
|
1004
|
-
_defineProperty(SimpleObject, "__use_delta", true);
|
|
1005
|
-
|
|
1006
|
-
var _default = SimpleObject;
|
|
1007
|
-
exports["default"] = _default;
|
|
286
|
+
*/
|
|
287
|
+
static setReadonly(objs, readonlyval = true, clearChanges = false) {
|
|
288
|
+
let checkObjs = [];
|
|
289
|
+
if (!objs)
|
|
290
|
+
objs = [];
|
|
291
|
+
if (!Array.isArray(objs))
|
|
292
|
+
checkObjs = [objs];
|
|
293
|
+
else
|
|
294
|
+
checkObjs = objs;
|
|
295
|
+
for (let index = 0; index < checkObjs.length; index++) {
|
|
296
|
+
const obj = checkObjs[index];
|
|
297
|
+
obj.__is_readonly = readonlyval;
|
|
298
|
+
if (obj instanceof SimpleObject) {
|
|
299
|
+
if (obj.canModify) {
|
|
300
|
+
if (!obj.getOriginal())
|
|
301
|
+
obj.setOriginal();
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
if (clearChanges)
|
|
305
|
+
obj.clear_changes();
|
|
306
|
+
//we dont need the original object in readonly mode
|
|
307
|
+
obj.setOriginal(null);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
static setThrowErrors(objs, throwErr = true) {
|
|
313
|
+
let checkObjs = [];
|
|
314
|
+
if (!objs)
|
|
315
|
+
objs = [];
|
|
316
|
+
if (!Array.isArray(objs))
|
|
317
|
+
checkObjs = [objs];
|
|
318
|
+
else
|
|
319
|
+
checkObjs = objs;
|
|
320
|
+
for (let index = 0; index < checkObjs.length; index++) {
|
|
321
|
+
const element = checkObjs[index];
|
|
322
|
+
element.__throw_errors = throwErr;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/* -------------------------------------------------------------------------- */
|
|
326
|
+
/* Get/Check */
|
|
327
|
+
/* -------------------------------------------------------------------------- */
|
|
328
|
+
get isChanged() {
|
|
329
|
+
if (this.__use_delta)
|
|
330
|
+
return !object_isEmpty(this.__delta);
|
|
331
|
+
else {
|
|
332
|
+
const orig = this.getOriginal();
|
|
333
|
+
if (!orig)
|
|
334
|
+
return false; //we dont know if anything has changed
|
|
335
|
+
/* if object is not using delta mode, check changes by comparing changable fields with original object */
|
|
336
|
+
if (Array.isArray(this.__changeables)) {
|
|
337
|
+
//console.log("chk", this.__changeables, "for changes");
|
|
338
|
+
return (this.__changeables.find((c) => {
|
|
339
|
+
return !object_equals(this[c], orig[c]);
|
|
340
|
+
}) != undefined);
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
/* check all fields */
|
|
344
|
+
for (const key in this) {
|
|
345
|
+
if (key.startsWith("__"))
|
|
346
|
+
continue;
|
|
347
|
+
if (!object_equals(this[key], orig[key]))
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
get isDeleted() {
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
get d() {
|
|
359
|
+
return this.__use_delta ? this.__delta : this;
|
|
360
|
+
}
|
|
361
|
+
/* all updated properties */
|
|
362
|
+
get allproperties() {
|
|
363
|
+
const result = { ...this, ...this.__delta };
|
|
364
|
+
result.__delta = {};
|
|
365
|
+
return result;
|
|
366
|
+
}
|
|
367
|
+
get canModify() {
|
|
368
|
+
return !Boolean(this.__is_readonly);
|
|
369
|
+
}
|
|
370
|
+
get __cache_name() {
|
|
371
|
+
return this.constructor["__cache_name"];
|
|
372
|
+
}
|
|
373
|
+
get __changeables() {
|
|
374
|
+
return this.constructor["__changeables"];
|
|
375
|
+
}
|
|
376
|
+
get __unchangeables() {
|
|
377
|
+
return this.constructor["__unchangeables"];
|
|
378
|
+
}
|
|
379
|
+
get __use_delta() {
|
|
380
|
+
return this.constructor["__use_delta"];
|
|
381
|
+
}
|
|
382
|
+
get isSaved() {
|
|
383
|
+
return Boolean(this.__saveResultIsSuccess ?? false);
|
|
384
|
+
}
|
|
385
|
+
get isNew() {
|
|
386
|
+
const mid = this.getID();
|
|
387
|
+
if (!mid)
|
|
388
|
+
return true;
|
|
389
|
+
if (typeof mid === "string")
|
|
390
|
+
return mid === "" || mid === "-1";
|
|
391
|
+
if (typeof mid === "number")
|
|
392
|
+
return mid === -1;
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
get_lastChanged() {
|
|
396
|
+
return !this.__lastChanged;
|
|
397
|
+
}
|
|
398
|
+
get manager() {
|
|
399
|
+
return this.get_managerClass();
|
|
400
|
+
}
|
|
401
|
+
get_managerClass = () => null;
|
|
402
|
+
static isDeleted(obj) {
|
|
403
|
+
if (obj instanceof SimpleObject)
|
|
404
|
+
return obj.isDeleted === true;
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
getIndexOrID() {
|
|
408
|
+
return SimpleObject.getIndexOrID(this);
|
|
409
|
+
}
|
|
410
|
+
getIndex() {
|
|
411
|
+
return SimpleObject.getIndex(this);
|
|
412
|
+
}
|
|
413
|
+
getID() {
|
|
414
|
+
return SimpleObject.getID(this);
|
|
415
|
+
}
|
|
416
|
+
static getIndexOrID(o) {
|
|
417
|
+
let res = SimpleObject.getIndex(o);
|
|
418
|
+
if (!res || res == -1)
|
|
419
|
+
res = SimpleObject.getID(o);
|
|
420
|
+
return res || -1;
|
|
421
|
+
}
|
|
422
|
+
static getIndex(o) {
|
|
423
|
+
if (o == null || o == undefined)
|
|
424
|
+
return -1;
|
|
425
|
+
switch (typeof o) {
|
|
426
|
+
case "object":
|
|
427
|
+
return o._index_value || -1;
|
|
428
|
+
case "number":
|
|
429
|
+
case "string":
|
|
430
|
+
return Number(o);
|
|
431
|
+
}
|
|
432
|
+
return -1;
|
|
433
|
+
}
|
|
434
|
+
static getID(o) {
|
|
435
|
+
if (o == null || o == undefined)
|
|
436
|
+
return "";
|
|
437
|
+
switch (typeof o) {
|
|
438
|
+
case "object":
|
|
439
|
+
return o.__data_id || o._id || o.id || o.ID || "";
|
|
440
|
+
case "string":
|
|
441
|
+
case "number":
|
|
442
|
+
return String(o);
|
|
443
|
+
}
|
|
444
|
+
return "";
|
|
445
|
+
}
|
|
446
|
+
/* -------------------------------------------------------------------------- */
|
|
447
|
+
/* Original */
|
|
448
|
+
/* -------------------------------------------------------------------------- */
|
|
449
|
+
getOriginal() {
|
|
450
|
+
return this.__originalobject || undefined;
|
|
451
|
+
}
|
|
452
|
+
setOriginal(toObj = 0) {
|
|
453
|
+
if (toObj === null) {
|
|
454
|
+
delete this.__originalobject;
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
if (!this.canModify) {
|
|
458
|
+
console.warn("Cant use setOriginal on non original OR readonly objects ! this will create an infinite loop");
|
|
459
|
+
delete this.__originalobject;
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
if (toObj === 0) {
|
|
463
|
+
toObj = this;
|
|
464
|
+
}
|
|
465
|
+
const cloneObject = object_clone(toObj);
|
|
466
|
+
SimpleObject.setReadonly(cloneObject, true);
|
|
467
|
+
this.__originalobject = object_removeKeys(cloneObject, ["__"]);
|
|
468
|
+
return this;
|
|
469
|
+
}
|
|
470
|
+
static setOriginal(obj, toObj = 0) {
|
|
471
|
+
if (!(obj instanceof SimpleObject))
|
|
472
|
+
return undefined;
|
|
473
|
+
return obj.setOriginal(toObj);
|
|
474
|
+
}
|
|
475
|
+
static getOriginal(obj) {
|
|
476
|
+
if (obj instanceof SimpleObject)
|
|
477
|
+
return obj.getOriginal();
|
|
478
|
+
return obj?.__originalobject;
|
|
479
|
+
}
|
|
480
|
+
/* -------------------------------------------------------------------------- */
|
|
481
|
+
/* Errors */
|
|
482
|
+
/* -------------------------------------------------------------------------- */
|
|
483
|
+
static addError(o, title, message, sendToRegister = "auto") {
|
|
484
|
+
const errStr = combine_if_not_blank(title, " : ", message);
|
|
485
|
+
if (o) {
|
|
486
|
+
if (!Array.isArray(o.__errors))
|
|
487
|
+
o.__errors = [];
|
|
488
|
+
o.__errors.push(errStr);
|
|
489
|
+
if (o.__showErrors === false)
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
else if (sendToRegister === "auto")
|
|
493
|
+
sendToRegister = true;
|
|
494
|
+
if (sendToRegister === true) {
|
|
495
|
+
console.error("[REGISTER-ERROR]", errStr);
|
|
496
|
+
gfunc.run_action("add_error", {
|
|
497
|
+
title: title,
|
|
498
|
+
message: message,
|
|
499
|
+
type: "error",
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
console.error("[ERROR]", errStr);
|
|
504
|
+
}
|
|
505
|
+
return o?.__errors || [];
|
|
506
|
+
}
|
|
507
|
+
static getErrors(o) {
|
|
508
|
+
return o?.__errors || [];
|
|
509
|
+
}
|
|
510
|
+
static clearErrors(o) {
|
|
511
|
+
if (o)
|
|
512
|
+
o.__errors = [];
|
|
513
|
+
return true;
|
|
514
|
+
}
|
|
515
|
+
/* -------------------------------------------------------------------------- */
|
|
516
|
+
/* Save Results */
|
|
517
|
+
/* -------------------------------------------------------------------------- */
|
|
518
|
+
static isResultValid(result_object) {
|
|
519
|
+
if (object_isEmpty(result_object))
|
|
520
|
+
return false;
|
|
521
|
+
switch (typeof result_object) {
|
|
522
|
+
case "string":
|
|
523
|
+
try {
|
|
524
|
+
result_object = JSON.parse(result_object);
|
|
525
|
+
return this.isResultValid(result_object);
|
|
526
|
+
}
|
|
527
|
+
catch {
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
case "object":
|
|
531
|
+
if (object_isTrue(result_object.acknowledged)) {
|
|
532
|
+
return true;
|
|
533
|
+
}
|
|
534
|
+
if (result_object.expected && result_object.result) {
|
|
535
|
+
return object_equals(result_object.expected, result_object.result);
|
|
536
|
+
}
|
|
537
|
+
return Number(this.getID(result_object)) >= 0;
|
|
538
|
+
case "number":
|
|
539
|
+
return result_object > 0;
|
|
540
|
+
case "boolean":
|
|
541
|
+
return result_object === true;
|
|
542
|
+
}
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
setSaveResult(toObj, type) {
|
|
546
|
+
this.__saveResultType = type;
|
|
547
|
+
if (toObj === true) {
|
|
548
|
+
}
|
|
549
|
+
else if (toObj === false) {
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
if (toObj) {
|
|
553
|
+
this.#setSaveResultObject(toObj);
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
this.#setSaveResultObject(null);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
this.__saveResultIsSuccess =
|
|
560
|
+
(type === "normal" || type === "nothing") && toObj != null;
|
|
561
|
+
}
|
|
562
|
+
#setSaveResultObject(toObj) {
|
|
563
|
+
this.__saveResultObject = toObj;
|
|
564
|
+
}
|
|
565
|
+
getSaveResult() {
|
|
566
|
+
if (this.isSaved)
|
|
567
|
+
return this.__saveResultObject;
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
getSaveResultType() {
|
|
571
|
+
return this.__saveResultType || null;
|
|
572
|
+
}
|
|
573
|
+
/* -------------------------------------------------------------------------- */
|
|
574
|
+
/* statics */
|
|
575
|
+
/* -------------------------------------------------------------------------- */
|
|
576
|
+
static factoryClear(obj) {
|
|
577
|
+
obj.clear_changes();
|
|
578
|
+
SimpleObject.clearErrors(obj);
|
|
579
|
+
}
|
|
580
|
+
static delete_cache() {
|
|
581
|
+
if (!this.__cache_name)
|
|
582
|
+
return;
|
|
583
|
+
gcache.delete_cache(this.__cache_name);
|
|
584
|
+
}
|
|
585
|
+
static get_canModify(o) {
|
|
586
|
+
if (o instanceof SimpleObject)
|
|
587
|
+
return o.canModify;
|
|
588
|
+
return false;
|
|
589
|
+
}
|
|
590
|
+
/* -------------------------------------------------------------------------- */
|
|
591
|
+
static equals(a, b) {
|
|
592
|
+
console.warn("Dont use the default equals method !");
|
|
593
|
+
if (a == undefined || b == undefined)
|
|
594
|
+
return false;
|
|
595
|
+
return a === b;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
export default SimpleObject;
|