@azrico/webobject 1.5.13 → 1.5.15

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