@azrico/webobject 1.5.68 → 1.5.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.
@@ -1,273 +1,669 @@
1
- import EventContext, { EventManager, useProperty } from "@azrico/event";
2
- import SimpleObject from "./SimpleObject";
3
- import { combine_if_not_blank } from "@azrico/string";
4
- import { gfunc } from "@azrico/global";
5
- import { fn_eval, object_equals_loose, } from "@azrico/object";
6
- import RawObject from "./MapableObject";
7
- import useGetter from "@azrico/event/dist/src/hooks/useGetter";
8
- import { useEvent } from "@azrico/event";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.ObjectManager = void 0;
7
+ var _event = _interopRequireWildcard(require("@azrico/event"));
8
+ var _SimpleObject = _interopRequireDefault(require("./SimpleObject"));
9
+ var _string = require("@azrico/string");
10
+ var _global = require("@azrico/global");
11
+ var _object = require("@azrico/object");
12
+ var _MapableObject2 = _interopRequireDefault(require("./MapableObject"));
13
+ var _useGetter = _interopRequireDefault(require("@azrico/event/dist/src/hooks/useGetter"));
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
15
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
16
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
17
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
18
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
19
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
20
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
21
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
22
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
23
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
24
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
25
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
26
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
27
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
28
+ function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
29
+ function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
30
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
31
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
32
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
33
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
34
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
35
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
36
  /**
10
37
  * This class manages the events of an Simple Object
11
- */
12
- export class ObjectManager extends RawObject {
13
- __eventContext = {};
14
- static __object_type;
15
- __last_object_data = {};
16
- __currentObject;
17
- __options;
18
- //can the current object be set to null safely?
19
- __object_nullable = false;
20
- constructor(defaultObject) {
21
- super();
22
- this.setObject(defaultObject);
23
- }
24
- async notifyChanged(type, key, value, subvalue) {
25
- const obj = this.getObject();
26
- if (!obj)
27
- return false;
28
- if (value === undefined && type != "meta")
29
- value = obj.get(key);
30
- const typestr = (type ? `$${type}$` : "") + String(key);
31
- return await this.event_run("on_change", typestr, value);
32
- }
33
- /* -------------------------------------------------------------------------- */
38
+ */
39
+ var ObjectManager = exports.ObjectManager = /*#__PURE__*/function (_MapableObject) {
40
+ function ObjectManager(defaultObject) {
41
+ var _this;
42
+ _classCallCheck(this, ObjectManager);
43
+ _this = _callSuper(this, ObjectManager);
44
+ _defineProperty(_this, "__eventContext", {});
45
+ _defineProperty(_this, "__last_object_data", {});
46
+ _defineProperty(_this, "__currentObject", void 0);
47
+ _defineProperty(_this, "__options", void 0);
48
+ //can the current object be set to null safely?
49
+ _defineProperty(_this, "__object_nullable", false);
50
+ _defineProperty(_this, "setTemp", _this.set_temp);
51
+ _this.setObject(defaultObject);
52
+ return _this;
53
+ }
54
+ _inherits(ObjectManager, _MapableObject);
55
+ return _createClass(ObjectManager, [{
56
+ key: "notifyChanged",
57
+ value: function () {
58
+ var _notifyChanged = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(type, key, value, subvalue) {
59
+ var obj, typestr;
60
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
61
+ while (1) switch (_context.prev = _context.next) {
62
+ case 0:
63
+ obj = this.getObject();
64
+ if (obj) {
65
+ _context.next = 3;
66
+ break;
67
+ }
68
+ return _context.abrupt("return", false);
69
+ case 3:
70
+ if (value === undefined && type != "meta") value = obj.get(key);
71
+ typestr = (type ? "$".concat(type, "$") : "") + String(key);
72
+ _context.next = 7;
73
+ return this.event_run("on_change", typestr, value);
74
+ case 7:
75
+ return _context.abrupt("return", _context.sent);
76
+ case 8:
77
+ case "end":
78
+ return _context.stop();
79
+ }
80
+ }, _callee, this);
81
+ }));
82
+ function notifyChanged(_x, _x2, _x3, _x4) {
83
+ return _notifyChanged.apply(this, arguments);
84
+ }
85
+ return notifyChanged;
86
+ }()
87
+ /* -------------------------------------------------------------------------- */
34
88
  /**
35
89
  * Get the object this manager is managing
36
90
  * @returns the object
37
- */
38
- get obj() {
39
- return this.__currentObject ?? undefined;
40
- }
91
+ */
92
+ }, {
93
+ key: "obj",
94
+ get: function get() {
95
+ var _this$__currentObject;
96
+ return (_this$__currentObject = this.__currentObject) !== null && _this$__currentObject !== void 0 ? _this$__currentObject : undefined;
97
+ }
41
98
  /**
42
99
  * Get the object this manager is managing
43
100
  * @returns the object
44
- */
45
- getObject() {
46
- return this.__currentObject ?? undefined;
47
- }
101
+ */
102
+ }, {
103
+ key: "getObject",
104
+ value: function getObject() {
105
+ var _this$__currentObject2;
106
+ return (_this$__currentObject2 = this.__currentObject) !== null && _this$__currentObject2 !== void 0 ? _this$__currentObject2 : undefined;
107
+ }
48
108
  /**
49
109
  * Set the object this manager is managing
50
110
  * @param toObj
51
111
  * @returns
52
- */
53
- setObject(toObj) {
54
- this.__currentObject = toObj;
55
- if (this.obj) {
56
- this.obj.get_managerClass = () => this;
57
- // this.obj.set_managerClass(this);
58
- }
59
- if (toObj == null && !this.__object_nullable) {
60
- console.warn("setObject was used to set null. try to use empty objects instead of null");
61
- }
62
- return true;
63
- }
64
- /* -------------------------------------------------------------------------- */
65
- /* Child functions */
66
- /* -------------------------------------------------------------------------- */
67
- get d() {
68
- return this.obj?.d || {};
69
- }
70
- get isChanged() {
71
- return this.obj != null && this.obj.isChanged;
72
- }
73
- get isDeleted() {
74
- return this.obj == null || this.obj.isDeleted;
75
- }
76
- get isArchived() {
77
- return this.obj == null || this.obj.isArchived;
78
- }
79
- get isLocked() {
80
- return this.obj == null || this.obj.isLocked;
81
- }
82
- get canModify() {
83
- return !this.obj?.canModify;
84
- }
85
- get isNew() {
86
- return this.obj == null || this.obj.isNew;
87
- }
88
- get isSaved() {
89
- return this.obj?.isSaved || false;
90
- }
91
- getSaveResult() {
92
- return this.obj?.getSaveResult() || null;
93
- }
94
- getSaveResultType() {
95
- return this.obj?.getSaveResultType() || null;
96
- }
97
- setSaveResult(toObj, type) {
98
- return this.obj?.setSaveResult(toObj, type);
99
- }
100
- apply_changes() {
101
- return this.obj?.apply_changes() || false;
102
- }
103
- get(key, original = false) {
104
- const thisobj = this.obj;
105
- if (thisobj == null || typeof thisobj.get != "function") {
106
- if (!this.__object_nullable)
107
- console.error("cant use get when object is not defined. maybe you have to use New() ?");
108
- return null;
109
- }
110
- return thisobj.get(key, original);
111
- }
112
+ */
113
+ }, {
114
+ key: "setObject",
115
+ value: function setObject(toObj) {
116
+ var _this2 = this;
117
+ this.__currentObject = toObj;
118
+ if (this.obj) {
119
+ this.obj.get_managerClass = function () {
120
+ return _this2;
121
+ };
122
+ // this.obj.set_managerClass(this);
123
+ }
124
+ if (toObj == null && !this.__object_nullable) {
125
+ console.warn("setObject was used to set null. try to use empty objects instead of null");
126
+ }
127
+ return true;
128
+ }
129
+ /* -------------------------------------------------------------------------- */
130
+ /* Child functions */
131
+ /* -------------------------------------------------------------------------- */
132
+ }, {
133
+ key: "d",
134
+ get: function get() {
135
+ var _this$obj;
136
+ return ((_this$obj = this.obj) === null || _this$obj === void 0 ? void 0 : _this$obj.d) || {};
137
+ }
138
+ }, {
139
+ key: "isChanged",
140
+ get: function get() {
141
+ return this.obj != null && this.obj.isChanged;
142
+ }
143
+ }, {
144
+ key: "isDeleted",
145
+ get: function get() {
146
+ return this.obj == null || this.obj.isDeleted;
147
+ }
148
+ }, {
149
+ key: "isArchived",
150
+ get: function get() {
151
+ return this.obj == null || this.obj.isArchived;
152
+ }
153
+ }, {
154
+ key: "isLocked",
155
+ get: function get() {
156
+ return this.obj == null || this.obj.isLocked;
157
+ }
158
+ }, {
159
+ key: "canModify",
160
+ get: function get() {
161
+ var _this$obj2;
162
+ return !((_this$obj2 = this.obj) !== null && _this$obj2 !== void 0 && _this$obj2.canModify);
163
+ }
164
+ }, {
165
+ key: "isNew",
166
+ get: function get() {
167
+ return this.obj == null || this.obj.isNew;
168
+ }
169
+ }, {
170
+ key: "isSaved",
171
+ get: function get() {
172
+ var _this$obj3;
173
+ return ((_this$obj3 = this.obj) === null || _this$obj3 === void 0 ? void 0 : _this$obj3.isSaved) || false;
174
+ }
175
+ }, {
176
+ key: "getSaveResult",
177
+ value: function getSaveResult() {
178
+ var _this$obj4;
179
+ return ((_this$obj4 = this.obj) === null || _this$obj4 === void 0 ? void 0 : _this$obj4.getSaveResult()) || null;
180
+ }
181
+ }, {
182
+ key: "getSaveResultType",
183
+ value: function getSaveResultType() {
184
+ var _this$obj5;
185
+ return ((_this$obj5 = this.obj) === null || _this$obj5 === void 0 ? void 0 : _this$obj5.getSaveResultType()) || null;
186
+ }
187
+ }, {
188
+ key: "setSaveResult",
189
+ value: function setSaveResult(toObj, type) {
190
+ var _this$obj6;
191
+ return (_this$obj6 = this.obj) === null || _this$obj6 === void 0 ? void 0 : _this$obj6.setSaveResult(toObj, type);
192
+ }
193
+ }, {
194
+ key: "apply_changes",
195
+ value: function apply_changes() {
196
+ var _this$obj7;
197
+ return ((_this$obj7 = this.obj) === null || _this$obj7 === void 0 ? void 0 : _this$obj7.apply_changes()) || false;
198
+ }
199
+ }, {
200
+ key: "get",
201
+ value: function get(key) {
202
+ var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
203
+ var thisobj = this.obj;
204
+ if (thisobj == null || typeof thisobj.get != "function") {
205
+ if (!this.__object_nullable) console.error("cant use get when object is not defined. maybe you have to use New() ?");
206
+ return null;
207
+ }
208
+ return thisobj.get(key, original);
209
+ }
112
210
  /**
113
211
  * use a property from the object, this will return latest value of the property
114
212
  * uses `EventManager` to detect changes
115
- */
116
- use(key) {
117
- return useProperty(this, key);
118
- }
213
+ */
214
+ }, {
215
+ key: "use",
216
+ value: function use(key) {
217
+ return (0, _event.useProperty)(this, key);
218
+ }
119
219
  /**
120
220
  * set value
121
221
  * @param key
122
222
  * @param value
123
223
  * @return true if changed , false otherwise
124
- */
125
- async set(key, value) {
126
- const thisobj = this.obj;
127
- if (thisobj == null || typeof thisobj.set != "function") {
128
- if (!this.__object_nullable)
129
- console.error("cant use set when object is not defined. maybe you have to use New() ?");
130
- return false;
131
- }
132
- return (await thisobj.set(key, value)) || false;
133
- }
224
+ */
225
+ }, {
226
+ key: "set",
227
+ value: (function () {
228
+ var _set = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, value) {
229
+ var thisobj;
230
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
231
+ while (1) switch (_context2.prev = _context2.next) {
232
+ case 0:
233
+ thisobj = this.obj;
234
+ if (!(thisobj == null || typeof thisobj.set != "function")) {
235
+ _context2.next = 4;
236
+ break;
237
+ }
238
+ if (!this.__object_nullable) console.error("cant use set when object is not defined. maybe you have to use New() ?");
239
+ return _context2.abrupt("return", false);
240
+ case 4:
241
+ _context2.next = 6;
242
+ return thisobj.set(key, value);
243
+ case 6:
244
+ _context2.t0 = _context2.sent;
245
+ if (_context2.t0) {
246
+ _context2.next = 9;
247
+ break;
248
+ }
249
+ _context2.t0 = false;
250
+ case 9:
251
+ return _context2.abrupt("return", _context2.t0);
252
+ case 10:
253
+ case "end":
254
+ return _context2.stop();
255
+ }
256
+ }, _callee2, this);
257
+ }));
258
+ function set(_x5, _x6) {
259
+ return _set.apply(this, arguments);
260
+ }
261
+ return set;
262
+ }()
134
263
  /**
135
264
  * set key of subObject
136
265
  * @param key
137
266
  * @param value
138
267
  * @param subvalue
139
268
  * @return true if changed , false otherwise
140
- */
141
- async setSubValue(key, objKey, subvalue) {
142
- return ((await this.obj?.setSubValue(key, objKey, subvalue)) ?? false);
143
- }
144
- //Push value on array
145
- async pushValue(key, value) {
146
- return (await this.obj?.pushValue(key, value)) ?? false;
147
- }
148
- //set temp value of object
149
- async setTemp(key, value, sendChanges = false) {
150
- await this.setObjectTemp(key, value, sendChanges);
151
- return await super.setTemp(key, value);
152
- }
153
- //set temp value of object
154
- async setObjectTemp(key, value, sendChanges = false) {
155
- return (await this.obj?.setTemp(key, value, sendChanges)) ?? false;
156
- }
157
- //get temp value of object
158
- getObjectTemp(key) {
159
- return this.obj?.getTemp(key) ?? undefined;
160
- }
161
- /* -------------------------------------------------------------------------- */
162
- getIndexOrID() {
163
- return this.obj?.getIndexOrID() || -1;
164
- }
165
- getIndex() {
166
- return this.obj?.getIndex() || -1;
167
- }
168
- getID() {
169
- return this.obj?.getID() || "";
170
- }
171
- /* -------------------------------------------------------------------------- */
172
- /* Events */
173
- /* -------------------------------------------------------------------------- */
174
- async event_run(eventName, ...params) {
175
- return await EventContext.run(this, eventName, ...params);
176
- }
177
- event_use(name, runEvent, onlyOn = null, runOnce = false) {
178
- return useEvent(this, name, runEvent, onlyOn, runOnce);
179
- }
269
+ */
270
+ )
271
+ }, {
272
+ key: "setSubValue",
273
+ value: (function () {
274
+ var _setSubValue = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, objKey, subvalue) {
275
+ var _yield$this$obj$setSu, _this$obj8;
276
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
277
+ while (1) switch (_context3.prev = _context3.next) {
278
+ case 0:
279
+ _context3.next = 2;
280
+ return (_this$obj8 = this.obj) === null || _this$obj8 === void 0 ? void 0 : _this$obj8.setSubValue(key, objKey, subvalue);
281
+ case 2:
282
+ _context3.t1 = _yield$this$obj$setSu = _context3.sent;
283
+ _context3.t0 = _context3.t1 !== null;
284
+ if (!_context3.t0) {
285
+ _context3.next = 6;
286
+ break;
287
+ }
288
+ _context3.t0 = _yield$this$obj$setSu !== void 0;
289
+ case 6:
290
+ if (!_context3.t0) {
291
+ _context3.next = 10;
292
+ break;
293
+ }
294
+ _context3.t2 = _yield$this$obj$setSu;
295
+ _context3.next = 11;
296
+ break;
297
+ case 10:
298
+ _context3.t2 = false;
299
+ case 11:
300
+ return _context3.abrupt("return", _context3.t2);
301
+ case 12:
302
+ case "end":
303
+ return _context3.stop();
304
+ }
305
+ }, _callee3, this);
306
+ }));
307
+ function setSubValue(_x7, _x8, _x9) {
308
+ return _setSubValue.apply(this, arguments);
309
+ }
310
+ return setSubValue;
311
+ }() //Push value on array
312
+ )
313
+ }, {
314
+ key: "pushValue",
315
+ value: function () {
316
+ var _pushValue = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(key, value) {
317
+ var _yield$this$obj$pushV, _this$obj9;
318
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
319
+ while (1) switch (_context4.prev = _context4.next) {
320
+ case 0:
321
+ _context4.next = 2;
322
+ return (_this$obj9 = this.obj) === null || _this$obj9 === void 0 ? void 0 : _this$obj9.pushValue(key, value);
323
+ case 2:
324
+ _context4.t1 = _yield$this$obj$pushV = _context4.sent;
325
+ _context4.t0 = _context4.t1 !== null;
326
+ if (!_context4.t0) {
327
+ _context4.next = 6;
328
+ break;
329
+ }
330
+ _context4.t0 = _yield$this$obj$pushV !== void 0;
331
+ case 6:
332
+ if (!_context4.t0) {
333
+ _context4.next = 10;
334
+ break;
335
+ }
336
+ _context4.t2 = _yield$this$obj$pushV;
337
+ _context4.next = 11;
338
+ break;
339
+ case 10:
340
+ _context4.t2 = false;
341
+ case 11:
342
+ return _context4.abrupt("return", _context4.t2);
343
+ case 12:
344
+ case "end":
345
+ return _context4.stop();
346
+ }
347
+ }, _callee4, this);
348
+ }));
349
+ function pushValue(_x0, _x1) {
350
+ return _pushValue.apply(this, arguments);
351
+ }
352
+ return pushValue;
353
+ }() //set temp value of object
354
+ }, {
355
+ key: "set_temp",
356
+ value: function () {
357
+ var _set_temp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(key, value) {
358
+ var sendChanges,
359
+ _args5 = arguments;
360
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
361
+ while (1) switch (_context5.prev = _context5.next) {
362
+ case 0:
363
+ sendChanges = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : false;
364
+ _context5.next = 3;
365
+ return this.setObjectTemp(key, value, sendChanges);
366
+ case 3:
367
+ _context5.next = 5;
368
+ return _superPropGet(ObjectManager, "set_temp", this, 3)([key, value]);
369
+ case 5:
370
+ return _context5.abrupt("return", _context5.sent);
371
+ case 6:
372
+ case "end":
373
+ return _context5.stop();
374
+ }
375
+ }, _callee5, this);
376
+ }));
377
+ function set_temp(_x10, _x11) {
378
+ return _set_temp.apply(this, arguments);
379
+ }
380
+ return set_temp;
381
+ }()
382
+ }, {
383
+ key: "setObjectTemp",
384
+ value: //set temp value of object
385
+ function () {
386
+ var _setObjectTemp = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(key, value) {
387
+ var _yield$this$obj$set_t, _this$obj0;
388
+ var sendChanges,
389
+ _args6 = arguments;
390
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
391
+ while (1) switch (_context6.prev = _context6.next) {
392
+ case 0:
393
+ sendChanges = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : false;
394
+ _context6.next = 3;
395
+ return (_this$obj0 = this.obj) === null || _this$obj0 === void 0 ? void 0 : _this$obj0.set_temp(key, value, sendChanges);
396
+ case 3:
397
+ _context6.t1 = _yield$this$obj$set_t = _context6.sent;
398
+ _context6.t0 = _context6.t1 !== null;
399
+ if (!_context6.t0) {
400
+ _context6.next = 7;
401
+ break;
402
+ }
403
+ _context6.t0 = _yield$this$obj$set_t !== void 0;
404
+ case 7:
405
+ if (!_context6.t0) {
406
+ _context6.next = 11;
407
+ break;
408
+ }
409
+ _context6.t2 = _yield$this$obj$set_t;
410
+ _context6.next = 12;
411
+ break;
412
+ case 11:
413
+ _context6.t2 = false;
414
+ case 12:
415
+ return _context6.abrupt("return", _context6.t2);
416
+ case 13:
417
+ case "end":
418
+ return _context6.stop();
419
+ }
420
+ }, _callee6, this);
421
+ }));
422
+ function setObjectTemp(_x12, _x13) {
423
+ return _setObjectTemp.apply(this, arguments);
424
+ }
425
+ return setObjectTemp;
426
+ }() //get temp value of object
427
+ }, {
428
+ key: "getObjectTemp",
429
+ value: function getObjectTemp(key) {
430
+ var _this$obj$getTemp, _this$obj1;
431
+ return (_this$obj$getTemp = (_this$obj1 = this.obj) === null || _this$obj1 === void 0 ? void 0 : _this$obj1.getTemp(key)) !== null && _this$obj$getTemp !== void 0 ? _this$obj$getTemp : undefined;
432
+ }
433
+ /* -------------------------------------------------------------------------- */
434
+ }, {
435
+ key: "getIndexOrID",
436
+ value: function getIndexOrID() {
437
+ var _this$obj10;
438
+ return ((_this$obj10 = this.obj) === null || _this$obj10 === void 0 ? void 0 : _this$obj10.getIndexOrID()) || -1;
439
+ }
440
+ }, {
441
+ key: "getIndex",
442
+ value: function getIndex() {
443
+ var _this$obj11;
444
+ return ((_this$obj11 = this.obj) === null || _this$obj11 === void 0 ? void 0 : _this$obj11.getIndex()) || -1;
445
+ }
446
+ }, {
447
+ key: "getID",
448
+ value: function getID() {
449
+ var _this$obj12;
450
+ return ((_this$obj12 = this.obj) === null || _this$obj12 === void 0 ? void 0 : _this$obj12.getID()) || "";
451
+ }
452
+ /* -------------------------------------------------------------------------- */
453
+ /* Events */
454
+ /* -------------------------------------------------------------------------- */
455
+ }, {
456
+ key: "event_run",
457
+ value: (function () {
458
+ var _event_run = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(eventName) {
459
+ var _len,
460
+ params,
461
+ _key,
462
+ _args7 = arguments;
463
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
464
+ while (1) switch (_context7.prev = _context7.next) {
465
+ case 0:
466
+ for (_len = _args7.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
467
+ params[_key - 1] = _args7[_key];
468
+ }
469
+ _context7.next = 3;
470
+ return _event["default"].run.apply(_event["default"], [this, eventName].concat(params));
471
+ case 3:
472
+ return _context7.abrupt("return", _context7.sent);
473
+ case 4:
474
+ case "end":
475
+ return _context7.stop();
476
+ }
477
+ }, _callee7, this);
478
+ }));
479
+ function event_run(_x14) {
480
+ return _event_run.apply(this, arguments);
481
+ }
482
+ return event_run;
483
+ }())
484
+ }, {
485
+ key: "event_use",
486
+ value: function event_use(name, runEvent) {
487
+ var onlyOn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
488
+ var runOnce = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
489
+ return (0, _event.useEvent)(this, name, runEvent, onlyOn, runOnce);
490
+ }
180
491
  /**
181
492
  * only useful for getter functions that dont rely on states
182
493
  * @param name
183
494
  * @param runEvent
184
495
  * @param onlyOn
185
496
  * @returns
186
- */
187
- event_use_getter(name, runEvent, onlyOn = null) {
188
- return useGetter(this, name, runEvent, onlyOn);
189
- }
190
- event_remove(name, uname) {
191
- return EventContext.remove(this, name, uname);
192
- }
193
- async event_add(eventName, uniqueName, eventFunction, eventChecker = null, runOnRegister = false) {
194
- await EventManager.add(this, {
195
- eventName,
196
- uniqueName,
197
- eventFunction,
198
- eventChecker,
199
- runOnRegister,
200
- });
201
- }
202
- events_start() {
203
- // delete this.__stopEvents;
204
- }
205
- events_stop() {
206
- // this.__setopEvents = true;
207
- }
208
- events_clear() {
209
- ObjectManager.events_clear(this);
210
- }
211
- clear_changes() {
212
- return this.obj?.clear_changes() ?? false;
213
- }
214
- clear_cache() {
215
- return this.obj?.clear_cache() ?? false;
216
- }
217
- static events_clear(obj) {
218
- EventContext.removeAll(obj);
219
- }
220
- /* -------------------------------------------------------------------------- */
221
- /* Options */
222
- /* -------------------------------------------------------------------------- */
497
+ */
498
+ }, {
499
+ key: "event_use_getter",
500
+ value: function event_use_getter(name, runEvent) {
501
+ var onlyOn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
502
+ return (0, _useGetter["default"])(this, name, runEvent, onlyOn);
503
+ }
504
+ }, {
505
+ key: "event_remove",
506
+ value: function event_remove(name, uname) {
507
+ return _event["default"].remove(this, name, uname);
508
+ }
509
+ }, {
510
+ key: "event_add",
511
+ value: function () {
512
+ var _event_add = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(eventName, uniqueName, eventFunction) {
513
+ var eventChecker,
514
+ runOnRegister,
515
+ _args8 = arguments;
516
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
517
+ while (1) switch (_context8.prev = _context8.next) {
518
+ case 0:
519
+ eventChecker = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : null;
520
+ runOnRegister = _args8.length > 4 && _args8[4] !== undefined ? _args8[4] : false;
521
+ _context8.next = 4;
522
+ return _event.EventManager.add(this, {
523
+ eventName: eventName,
524
+ uniqueName: uniqueName,
525
+ eventFunction: eventFunction,
526
+ eventChecker: eventChecker,
527
+ runOnRegister: runOnRegister
528
+ });
529
+ case 4:
530
+ case "end":
531
+ return _context8.stop();
532
+ }
533
+ }, _callee8, this);
534
+ }));
535
+ function event_add(_x15, _x16, _x17) {
536
+ return _event_add.apply(this, arguments);
537
+ }
538
+ return event_add;
539
+ }()
540
+ }, {
541
+ key: "events_start",
542
+ value: function events_start() {
543
+ // delete this.__stopEvents;
544
+ }
545
+ }, {
546
+ key: "events_stop",
547
+ value: function events_stop() {
548
+ // this.__setopEvents = true;
549
+ }
550
+ }, {
551
+ key: "events_clear",
552
+ value: function events_clear() {
553
+ ObjectManager.events_clear(this);
554
+ }
555
+ }, {
556
+ key: "clear_changes",
557
+ value: function clear_changes() {
558
+ var _this$obj$clear_chang, _this$obj13;
559
+ return (_this$obj$clear_chang = (_this$obj13 = this.obj) === null || _this$obj13 === void 0 ? void 0 : _this$obj13.clear_changes()) !== null && _this$obj$clear_chang !== void 0 ? _this$obj$clear_chang : false;
560
+ }
561
+ }, {
562
+ key: "clear_cache",
563
+ value: function clear_cache() {
564
+ var _this$obj$clear_cache, _this$obj14;
565
+ return (_this$obj$clear_cache = (_this$obj14 = this.obj) === null || _this$obj14 === void 0 ? void 0 : _this$obj14.clear_cache()) !== null && _this$obj$clear_cache !== void 0 ? _this$obj$clear_cache : false;
566
+ }
567
+ }, {
568
+ key: "toggleOption",
569
+ value: (
570
+ /* -------------------------------------------------------------------------- */
571
+ /* Options */
572
+ /* -------------------------------------------------------------------------- */
223
573
  /**
224
574
  * Set an option to some value, if its already equal to the value it will be deleted instead
225
575
  * @param key
226
576
  * @param value
227
577
  * @returns
228
- */
229
- async toggleOption(key, value) {
230
- var oldval = this.getOption(key);
231
- if (object_equals_loose(oldval, value)) {
232
- await this.setOption(key, null);
233
- }
234
- else
235
- await this.setOption(key, value);
236
- }
237
- getOption(key) {
238
- if (this.__options == null)
239
- return undefined;
240
- key = key.toLowerCase();
241
- return this.__options[key];
242
- }
578
+ */
579
+ function () {
580
+ var _toggleOption = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value) {
581
+ var oldval;
582
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
583
+ while (1) switch (_context9.prev = _context9.next) {
584
+ case 0:
585
+ oldval = this.getOption(key);
586
+ if (!(0, _object.object_equals_loose)(oldval, value)) {
587
+ _context9.next = 6;
588
+ break;
589
+ }
590
+ _context9.next = 4;
591
+ return this.setOption(key, null);
592
+ case 4:
593
+ _context9.next = 8;
594
+ break;
595
+ case 6:
596
+ _context9.next = 8;
597
+ return this.setOption(key, value);
598
+ case 8:
599
+ case "end":
600
+ return _context9.stop();
601
+ }
602
+ }, _callee9, this);
603
+ }));
604
+ function toggleOption(_x18, _x19) {
605
+ return _toggleOption.apply(this, arguments);
606
+ }
607
+ return toggleOption;
608
+ }())
609
+ }, {
610
+ key: "getOption",
611
+ value: function getOption(key) {
612
+ if (this.__options == null) return undefined;
613
+ key = key.toLowerCase();
614
+ return this.__options[key];
615
+ }
243
616
  /**
244
617
  * updates `__options` and runs the `event_run`
245
618
  * @param key
246
619
  * @param value
247
620
  * @returns true if changed, false otherwise
248
- */
249
- async setOption(key, value) {
250
- if (this.__options == null)
251
- this.__options = {};
252
- key = key.toLowerCase();
253
- const isChanged = this.__options[key] !== value;
254
- if (value == null) {
255
- delete this.__options[key];
256
- }
257
- else {
258
- this.__options[key] = value;
259
- }
260
- await this.event_run("on_option_change", key, value);
261
- return isChanged;
262
- }
621
+ */
622
+ }, {
623
+ key: "setOption",
624
+ value: (function () {
625
+ var _setOption = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(key, value) {
626
+ var isChanged;
627
+ return _regeneratorRuntime().wrap(function _callee0$(_context0) {
628
+ while (1) switch (_context0.prev = _context0.next) {
629
+ case 0:
630
+ if (this.__options == null) this.__options = {};
631
+ key = key.toLowerCase();
632
+ isChanged = this.__options[key] !== value;
633
+ if (value == null) {
634
+ delete this.__options[key];
635
+ } else {
636
+ this.__options[key] = value;
637
+ }
638
+ _context0.next = 6;
639
+ return this.event_run("on_option_change", key, value);
640
+ case 6:
641
+ return _context0.abrupt("return", isChanged);
642
+ case 7:
643
+ case "end":
644
+ return _context0.stop();
645
+ }
646
+ }, _callee0, this);
647
+ }));
648
+ function setOption(_x20, _x21) {
649
+ return _setOption.apply(this, arguments);
650
+ }
651
+ return setOption;
652
+ }()
263
653
  /**
264
654
  * use an option and detect its changes in real time. similar to React state
265
655
  * @param key name of the option
266
656
  * @returns value of the option
267
- */
268
- useOption(key) {
269
- return this.event_use_getter("on_option_change", () => this.getOption(key), [key]);
270
- }
657
+ */
658
+ )
659
+ }, {
660
+ key: "useOption",
661
+ value: function useOption(key) {
662
+ var _this3 = this;
663
+ return this.event_use_getter("on_option_change", function () {
664
+ return _this3.getOption(key);
665
+ }, [key]);
666
+ }
271
667
  /**
272
668
  * Sets an option then does an action,
273
669
  * after the action is run, updates the option again
@@ -275,66 +671,131 @@ export class ObjectManager extends RawObject {
275
671
  * @param value
276
672
  * @param nextvalue
277
673
  * @param action
278
- */
279
- async holdOption(key, value, nextvalue, action) {
280
- try {
281
- this.setOption(key, value);
282
- if (typeof action === "function")
283
- await action();
284
- }
285
- finally {
286
- this.setOption(key, nextvalue);
287
- }
288
- }
289
- /* ------------------------------ useIsChanged; ----------------------------- */
674
+ */
675
+ }, {
676
+ key: "holdOption",
677
+ value: (function () {
678
+ var _holdOption = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(key, value, nextvalue, action) {
679
+ return _regeneratorRuntime().wrap(function _callee1$(_context1) {
680
+ while (1) switch (_context1.prev = _context1.next) {
681
+ case 0:
682
+ _context1.prev = 0;
683
+ this.setOption(key, value);
684
+ if (!(typeof action === "function")) {
685
+ _context1.next = 5;
686
+ break;
687
+ }
688
+ _context1.next = 5;
689
+ return action();
690
+ case 5:
691
+ _context1.prev = 5;
692
+ this.setOption(key, nextvalue);
693
+ return _context1.finish(5);
694
+ case 8:
695
+ case "end":
696
+ return _context1.stop();
697
+ }
698
+ }, _callee1, this, [[0,, 5, 8]]);
699
+ }));
700
+ function holdOption(_x22, _x23, _x24, _x25) {
701
+ return _holdOption.apply(this, arguments);
702
+ }
703
+ return holdOption;
704
+ }()
705
+ /* ------------------------------ useIsChanged; ----------------------------- */
290
706
  /**
291
707
  * @returns isChanged
292
- */
293
- useIsChanged() {
294
- return this.useOption("ischanged");
295
- }
296
- async checkIsChanged() {
297
- await this.setOption("ischanged", this.isChanged);
298
- }
299
- /* -------------------------------------------------------------------------- */
300
- /* Errors */
301
- /* -------------------------------------------------------------------------- */
302
- addError(title, message, sendToRegister = "auto") {
303
- return ObjectManager.addError(this, title, message, sendToRegister);
304
- }
305
- getErrors() {
306
- return ObjectManager.getErrors(this);
307
- }
308
- clearErrors() {
309
- return ObjectManager.clearErrors(this);
310
- }
311
- static addError(o, title, message, sendToRegister = "auto") {
312
- if (o && o.obj) {
313
- return SimpleObject.addError(o.obj, title, message, sendToRegister);
314
- }
315
- const errStr = combine_if_not_blank(title, " : ", message);
316
- console.error("[REGISTER-ERROR]", errStr);
317
- gfunc.run_action("add_error", {
318
- title: title,
319
- message: message,
320
- type: "error",
321
- });
322
- }
323
- static getErrors(o) {
324
- const obj = o.obj;
325
- return obj != null ? SimpleObject.getErrors(o.obj) : [];
326
- }
327
- static clearErrors(o) {
328
- return SimpleObject.clearErrors(o.obj);
329
- }
330
- /* -------------------------------------------------------------------------- */
331
- /* get __object_type */
332
- /* -------------------------------------------------------------------------- */
333
- getObjectType() {
334
- return this.constructor["getObjectType"]();
335
- }
336
- static getObjectType() {
337
- return fn_eval(this.__object_type);
338
- }
339
- }
340
- export default ObjectManager;
708
+ */
709
+ )
710
+ }, {
711
+ key: "useIsChanged",
712
+ value: function useIsChanged() {
713
+ return this.useOption("ischanged");
714
+ }
715
+ }, {
716
+ key: "checkIsChanged",
717
+ value: function () {
718
+ var _checkIsChanged = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
719
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
720
+ while (1) switch (_context10.prev = _context10.next) {
721
+ case 0:
722
+ _context10.next = 2;
723
+ return this.setOption("ischanged", this.isChanged);
724
+ case 2:
725
+ case "end":
726
+ return _context10.stop();
727
+ }
728
+ }, _callee10, this);
729
+ }));
730
+ function checkIsChanged() {
731
+ return _checkIsChanged.apply(this, arguments);
732
+ }
733
+ return checkIsChanged;
734
+ }()
735
+ /* -------------------------------------------------------------------------- */
736
+ /* Errors */
737
+ /* -------------------------------------------------------------------------- */
738
+ }, {
739
+ key: "addError",
740
+ value: function addError(title, message) {
741
+ var sendToRegister = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "auto";
742
+ return ObjectManager.addError(this, title, message, sendToRegister);
743
+ }
744
+ }, {
745
+ key: "getErrors",
746
+ value: function getErrors() {
747
+ return ObjectManager.getErrors(this);
748
+ }
749
+ }, {
750
+ key: "clearErrors",
751
+ value: function clearErrors() {
752
+ return ObjectManager.clearErrors(this);
753
+ }
754
+ }, {
755
+ key: "getObjectType",
756
+ value: /* -------------------------------------------------------------------------- */
757
+ /* get __object_type */
758
+ /* -------------------------------------------------------------------------- */
759
+ function getObjectType() {
760
+ return this.constructor["getObjectType"]();
761
+ }
762
+ }], [{
763
+ key: "events_clear",
764
+ value: function events_clear(obj) {
765
+ _event["default"].removeAll(obj);
766
+ }
767
+ }, {
768
+ key: "addError",
769
+ value: function addError(o, title, message) {
770
+ var sendToRegister = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
771
+ if (o && o.obj) {
772
+ return _SimpleObject["default"].addError(o.obj, title, message, sendToRegister);
773
+ }
774
+ var errStr = (0, _string.combine_if_not_blank)(title, " : ", message);
775
+ console.error("[REGISTER-ERROR]", errStr);
776
+ _global.gfunc.run_action("add_error", {
777
+ title: title,
778
+ message: message,
779
+ type: "error"
780
+ });
781
+ }
782
+ }, {
783
+ key: "getErrors",
784
+ value: function getErrors(o) {
785
+ var obj = o.obj;
786
+ return obj != null ? _SimpleObject["default"].getErrors(o.obj) : [];
787
+ }
788
+ }, {
789
+ key: "clearErrors",
790
+ value: function clearErrors(o) {
791
+ return _SimpleObject["default"].clearErrors(o.obj);
792
+ }
793
+ }, {
794
+ key: "getObjectType",
795
+ value: function getObjectType() {
796
+ return (0, _object.fn_eval)(this.__object_type);
797
+ }
798
+ }]);
799
+ }(_MapableObject2["default"]);
800
+ _defineProperty(ObjectManager, "__object_type", void 0);
801
+ var _default = exports["default"] = ObjectManager;