@azrico/webobject 1.2.10 → 1.2.12

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,34 +1,684 @@
1
- "use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=exports.ObjectManager=void 0;var _event=require("@azrico/event"),_SimpleObject=_interopRequireDefault(require("./SimpleObject")),_string=require("@azrico/string"),_global=require("@azrico/global"),_object=require("@azrico/object");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,e,f){var g=b&&b.prototype instanceof d?b:d,h=Object.create(g.prototype),j=new l(f||[]);return h._invoke=function(a,b,d){var e="suspendedStart";return function(f,g){if("executing"===e)throw new Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return n()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var j=i(h,d);if(j){if(j===v)continue;return j}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===v)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}(a,e,j),h}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&q.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;this._invoke=function(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}}function i(a,b){var d=a.iterator[b.method];if(void 0===d){if(b.delegate=null,"throw"===b.method){if(a.iterator["return"]&&(b.method="return",b.arg=void 0,i(a,b),"throw"===b.method))return v;b.method="throw",b.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var e=c(d,a.iterator,b.arg);if("throw"===e.type)return b.method="throw",b.arg=e.arg,b.delegate=null,v;var f=e.arg;return f?f.done?(b[a.resultName]=f.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,v):f:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,v)}function j(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function k(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function l(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(j,this),this.reset(!0)}function m(a){if(a){var b=a[s];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(q.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:n}}function n(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return o};var o={},p=Object.prototype,q=p.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",t=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}o.wrap=b;var v={},w={};a(w,s,function(){return this});var x=Object.getPrototypeOf,y=x&&x(x(m([])));y&&y!==p&&q.call(y,s)&&(w=y);var z=f.prototype=d.prototype=Object.create(w);return e.prototype=f,a(z,"constructor",f),a(f,"constructor",e),e.displayName=a(f,u,"GeneratorFunction"),o.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},o.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,u,"GeneratorFunction")),b.prototype=Object.create(z),b},o.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,t,function(){return this}),o.AsyncIterator=h,o.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return o.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(z),a(z,u,"Generator"),a(z,s,function(){return this}),a(z,"toString",function(){return"[object Generator]"}),o.keys=function(a){var b=[];for(var c in a)b.push(c);return b.reverse(),function c(){for(;b.length;){var d=b.pop();if(d in a)return c.value=d,c.done=!1,c}return c.done=!0,c}},o.values=m,l.prototype={constructor:l,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!a)for(var b in this)"t"===b.charAt(0)&&q.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=q.call(e,"catchLoc"),h=q.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&q.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,v):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),v},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),k(b),v},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;k(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:m(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),v}},o}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}/**
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = exports.ObjectManager = void 0;
9
+
10
+ var _event = require("@azrico/event");
11
+
12
+ var _SimpleObject = _interopRequireDefault(require("./SimpleObject"));
13
+
14
+ var _string = require("@azrico/string");
15
+
16
+ var _global = require("@azrico/global");
17
+
18
+ var _object = require("@azrico/object");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
+
22
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
23
+
24
+ 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); } }
25
+
26
+ 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); }); }; }
27
+
28
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
29
+
30
+ 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, descriptor.key, descriptor); } }
31
+
32
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
33
+
34
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
35
+
36
+ /**
2
37
  * This class manages the events of an Simple Object
3
- */var ObjectManager=/*#__PURE__*/function(){function a(){_classCallCheck(this,a),_defineProperty(this,"__eventList",void 0),_defineProperty(this,"__eventPrefix",void 0),_defineProperty(this,"__sendEvents",!0),_defineProperty(this,"__currentObject",void 0),_defineProperty(this,"__options",void 0),_defineProperty(this,"get",this.getValue)}return _createClass(a,[{key:"notifyChanged",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e,f;return _regeneratorRuntime().wrap(function g(d){for(;1;)switch(d.prev=d.next){case 0:if(e=this.getObject(),e){d.next=3;break}return d.abrupt("return",!1);case 3:return void 0===c&&"meta"!=a&&(c=e.getValue(b)),f=(a?"$".concat(a,"$"):"")+(b+""),d.next=7,this.event_run("on_change",f,c);case 7:return d.abrupt("return",d.sent);case 8:case"end":return d.stop();}},d,this)}));return a}()/* -------------------------------------------------------------------------- */},{key:"obj",get:function get(){return this.getObject()}/**
38
+ */
39
+ var ObjectManager = /*#__PURE__*/function () {
40
+ function ObjectManager() {
41
+ _classCallCheck(this, ObjectManager);
42
+
43
+ _defineProperty(this, "__eventList", void 0);
44
+
45
+ _defineProperty(this, "__eventPrefix", void 0);
46
+
47
+ _defineProperty(this, "__sendEvents", true);
48
+
49
+ _defineProperty(this, "__currentObject", void 0);
50
+
51
+ _defineProperty(this, "__options", void 0);
52
+
53
+ _defineProperty(this, "get", this.getValue);
54
+ }
55
+
56
+ _createClass(ObjectManager, [{
57
+ key: "notifyChanged",
58
+ value: function () {
59
+ var _notifyChanged = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(type, key, value, subvalue) {
60
+ var obj, typestr;
61
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
62
+ while (1) {
63
+ switch (_context.prev = _context.next) {
64
+ case 0:
65
+ obj = this.getObject();
66
+
67
+ if (obj) {
68
+ _context.next = 3;
69
+ break;
70
+ }
71
+
72
+ return _context.abrupt("return", false);
73
+
74
+ case 3:
75
+ if (value === undefined && type != "meta") value = obj.getValue(key);
76
+ typestr = (type ? "$".concat(type, "$") : "") + String(key);
77
+ _context.next = 7;
78
+ return this.event_run("on_change", typestr, value);
79
+
80
+ case 7:
81
+ return _context.abrupt("return", _context.sent);
82
+
83
+ case 8:
84
+ case "end":
85
+ return _context.stop();
86
+ }
87
+ }
88
+ }, _callee, this);
89
+ }));
90
+
91
+ function notifyChanged(_x, _x2, _x3, _x4) {
92
+ return _notifyChanged.apply(this, arguments);
93
+ }
94
+
95
+ return notifyChanged;
96
+ }()
97
+ /* -------------------------------------------------------------------------- */
98
+
99
+ }, {
100
+ key: "obj",
101
+ get: function get() {
102
+ return this.getObject();
103
+ }
104
+ /**
4
105
  * Get the object this manager is managing
5
106
  * @returns the object
6
- */},{key:"getObject",value:function getObject(){var a;return null!==(a=this.__currentObject)&&void 0!==a?a:void 0}/**
107
+ */
108
+
109
+ }, {
110
+ key: "getObject",
111
+ value: function getObject() {
112
+ var _this$__currentObject;
113
+
114
+ return (_this$__currentObject = this.__currentObject) !== null && _this$__currentObject !== void 0 ? _this$__currentObject : undefined;
115
+ }
116
+ /**
7
117
  * Set the object this manager is managing
8
118
  * @param toObj
9
119
  * @returns
10
- */},{key:"setObject",value:function setObject(a){var b=this;return this.__currentObject=a,this.__currentObject&&(this.__currentObject.get_managerClass=function(){return b}),!0}/* -------------------------------------------------------------------------- */ /* Child functions */ /* -------------------------------------------------------------------------- */},{key:"isChanged",get:function get(){return null!=this.obj&&this.obj.isChanged}},{key:"isDeleted",get:function get(){return null==this.obj||this.obj.isDeleted}},{key:"d",get:function get(){var a;return null===(a=this.obj)||void 0===a?void 0:a.d}},{key:"canModify",get:function get(){var a;return!(null!==(a=this.obj)&&void 0!==a&&a.canModify)}},{key:"isNew",get:function get(){return null==this.obj||this.obj.isNew}},{key:"isSaved",get:function get(){var a;return(null===(a=this.obj)||void 0===a?void 0:a.isSaved)||!1}},{key:"__cache_name",get:function get(){return this.constructor.__cache_name}},{key:"getSaveResult",value:function getSaveResult(){var a;return(null===(a=this.getObject())||void 0===a?void 0:a.getSaveResult())||void 0}},{key:"getSaveResultType",value:function getSaveResultType(){var a;return(null===(a=this.getObject())||void 0===a?void 0:a.getSaveResultType())||null}},{key:"setSaveResult",value:function setSaveResult(a,b){return this.setSaveResult(a,b)}},{key:"apply_changes",value:function apply_changes(){var a;return null===(a=this.obj)||void 0===a?void 0:a.apply_changes()}},{key:"getValue",value:function getValue(a){var b,c=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1];return null===(b=this.obj)||void 0===b?void 0:b.getValue(a,c)}},{key:"setValue",value:/**
120
+ */
121
+
122
+ }, {
123
+ key: "setObject",
124
+ value: function setObject(toObj) {
125
+ var _this = this;
126
+
127
+ this.__currentObject = toObj;
128
+
129
+ if (this.__currentObject) {
130
+ this.__currentObject.get_managerClass = function () {
131
+ return _this;
132
+ };
133
+ }
134
+
135
+ return true;
136
+ }
137
+ /* -------------------------------------------------------------------------- */
138
+
139
+ /* Child functions */
140
+
141
+ /* -------------------------------------------------------------------------- */
142
+
143
+ }, {
144
+ key: "isChanged",
145
+ get: function get() {
146
+ return this.obj != null && this.obj.isChanged;
147
+ }
148
+ }, {
149
+ key: "isDeleted",
150
+ get: function get() {
151
+ return this.obj == null || this.obj.isDeleted;
152
+ }
153
+ }, {
154
+ key: "d",
155
+ get: function get() {
156
+ var _this$obj;
157
+
158
+ return (_this$obj = this.obj) === null || _this$obj === void 0 ? void 0 : _this$obj.d;
159
+ }
160
+ }, {
161
+ key: "canModify",
162
+ get: function get() {
163
+ var _this$obj2;
164
+
165
+ return !((_this$obj2 = this.obj) !== null && _this$obj2 !== void 0 && _this$obj2.canModify);
166
+ }
167
+ }, {
168
+ key: "isNew",
169
+ get: function get() {
170
+ return this.obj == null || this.obj.isNew;
171
+ }
172
+ }, {
173
+ key: "isSaved",
174
+ get: function get() {
175
+ var _this$obj3;
176
+
177
+ return ((_this$obj3 = this.obj) === null || _this$obj3 === void 0 ? void 0 : _this$obj3.isSaved) || false;
178
+ }
179
+ }, {
180
+ key: "__cache_name",
181
+ get: function get() {
182
+ return this.constructor["__cache_name"];
183
+ }
184
+ }, {
185
+ key: "getSaveResult",
186
+ value: function getSaveResult() {
187
+ var _this$getObject;
188
+
189
+ return ((_this$getObject = this.getObject()) === null || _this$getObject === void 0 ? void 0 : _this$getObject.getSaveResult()) || undefined;
190
+ }
191
+ }, {
192
+ key: "getSaveResultType",
193
+ value: function getSaveResultType() {
194
+ var _this$getObject2;
195
+
196
+ return ((_this$getObject2 = this.getObject()) === null || _this$getObject2 === void 0 ? void 0 : _this$getObject2.getSaveResultType()) || null;
197
+ }
198
+ }, {
199
+ key: "setSaveResult",
200
+ value: function setSaveResult(toObj, type) {
201
+ return this.setSaveResult(toObj, type);
202
+ }
203
+ }, {
204
+ key: "apply_changes",
205
+ value: function apply_changes() {
206
+ var _this$obj4;
207
+
208
+ return (_this$obj4 = this.obj) === null || _this$obj4 === void 0 ? void 0 : _this$obj4.apply_changes();
209
+ }
210
+ }, {
211
+ key: "getValue",
212
+ value: function getValue(key) {
213
+ var _this$obj5;
214
+
215
+ var original = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
216
+ return (_this$obj5 = this.obj) === null || _this$obj5 === void 0 ? void 0 : _this$obj5.getValue(key, original);
217
+ }
218
+ }, {
219
+ key: "setValue",
220
+ value:
221
+ /**
11
222
  * set value
12
223
  * @param key
13
224
  * @param value
14
225
  * @return true if changed , false otherwise
15
- */function(){function a(a,c){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){var d;return _regeneratorRuntime().wrap(function e(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,null===(d=this.obj)||void 0===d?void 0:d.setValue(a,b);case 2:if(c.t0=c.sent,c.t0){c.next=5;break}c.t0=!1;case 5:return c.abrupt("return",c.t0);case 6:case"end":return c.stop();}},c,this)}));return a}()/**
226
+ */
227
+ function () {
228
+ var _setValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(key, value) {
229
+ var _this$obj6;
230
+
231
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
232
+ while (1) {
233
+ switch (_context2.prev = _context2.next) {
234
+ case 0:
235
+ _context2.next = 2;
236
+ return (_this$obj6 = this.obj) === null || _this$obj6 === void 0 ? void 0 : _this$obj6.setValue(key, value);
237
+
238
+ case 2:
239
+ _context2.t0 = _context2.sent;
240
+
241
+ if (_context2.t0) {
242
+ _context2.next = 5;
243
+ break;
244
+ }
245
+
246
+ _context2.t0 = false;
247
+
248
+ case 5:
249
+ return _context2.abrupt("return", _context2.t0);
250
+
251
+ case 6:
252
+ case "end":
253
+ return _context2.stop();
254
+ }
255
+ }
256
+ }, _callee2, this);
257
+ }));
258
+
259
+ function setValue(_x5, _x6) {
260
+ return _setValue.apply(this, arguments);
261
+ }
262
+
263
+ return setValue;
264
+ }()
265
+ /**
16
266
  * set key of subObject
17
267
  * @param key
18
268
  * @param value
19
269
  * @param subvalue
20
270
  * @return true if changed , false otherwise
21
- */},{key:"setSubValue",value:function(){function a(a,c,d){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e;return _regeneratorRuntime().wrap(function f(d){for(;1;)switch(d.prev=d.next){case 0:return d.next=2,null===(e=this.obj)||void 0===e?void 0:e.setSubValue(a,b,c);case 2:if(d.t0=d.sent,d.t0){d.next=5;break}d.t0=!1;case 5:return d.abrupt("return",d.t0);case 6:case"end":return d.stop();}},d,this)}));return a}()//Push value on array
22
- },{key:"pushValue",value:function(){function a(a,c){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){var d;return _regeneratorRuntime().wrap(function e(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,null===(d=this.obj)||void 0===d?void 0:d.pushValue(a,b);case 2:if(c.t0=c.sent,c.t0){c.next=5;break}c.t0=!1;case 5:return c.abrupt("return",c.t0);case 6:case"end":return c.stop();}},c,this)}));return a}()/* -------------------------------------------------------------------------- */},{key:"getIndexOrID",value:function getIndexOrID(){var a;return(null===(a=this.obj)||void 0===a?void 0:a.getIndexOrID())||-1}},{key:"getIndex",value:function getIndex(){var a;return(null===(a=this.obj)||void 0===a?void 0:a.getIndex())||-1}},{key:"getID",value:function getID(){var a;return(null===(a=this.obj)||void 0===a?void 0:a.getID())||""}/* -------------------------------------------------------------------------- */ /* Getters */ /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ /* Events */ /* -------------------------------------------------------------------------- */},{key:"event_run",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f=arguments;return _regeneratorRuntime().wrap(function g(b){for(;1;)switch(b.prev=b.next){case 0:if(this.__sendEvents){b.next=2;break}return b.abrupt("return");case 2:for(c=f.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=f[e];return b.next=5,_event.EventManager.run.apply(_event.EventManager,[this,a].concat(d));case 5:case"end":return b.stop();}},b,this)}));return a}()},{key:"event_use",value:function event_use(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,d=!!(3<arguments.length&&void 0!==arguments[3])&&arguments[3];return _event.EventManager.use(this,a,b,c,d)}},{key:"event_add",value:function(){function a(a,c,d){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e,f,g=arguments;return _regeneratorRuntime().wrap(function h(d){for(;1;)switch(d.prev=d.next){case 0:return e=3<g.length&&void 0!==g[3]?g[3]:null,f=!!(4<g.length&&void 0!==g[4])&&g[4],d.next=4,_event.EventManager.add(this,a,b,c,e,f);case 4:case"end":return d.stop();}},d,this)}));return a}()},{key:"events_stop",value:function events_stop(){this.__sendEvents=!1}},{key:"events_clear",value:function events_clear(){a.events_clear(this)}},{key:"toggleOption",value:/* -------------------------------------------------------------------------- */ /* Options */ /* -------------------------------------------------------------------------- */ /**
271
+ */
272
+
273
+ }, {
274
+ key: "setSubValue",
275
+ value: function () {
276
+ var _setSubValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, objKey, subvalue) {
277
+ var _this$obj7;
278
+
279
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
280
+ while (1) {
281
+ switch (_context3.prev = _context3.next) {
282
+ case 0:
283
+ _context3.next = 2;
284
+ return (_this$obj7 = this.obj) === null || _this$obj7 === void 0 ? void 0 : _this$obj7.setSubValue(key, objKey, subvalue);
285
+
286
+ case 2:
287
+ _context3.t0 = _context3.sent;
288
+
289
+ if (_context3.t0) {
290
+ _context3.next = 5;
291
+ break;
292
+ }
293
+
294
+ _context3.t0 = false;
295
+
296
+ case 5:
297
+ return _context3.abrupt("return", _context3.t0);
298
+
299
+ case 6:
300
+ case "end":
301
+ return _context3.stop();
302
+ }
303
+ }
304
+ }, _callee3, this);
305
+ }));
306
+
307
+ function setSubValue(_x7, _x8, _x9) {
308
+ return _setSubValue.apply(this, arguments);
309
+ }
310
+
311
+ return setSubValue;
312
+ }() //Push value on array
313
+
314
+ }, {
315
+ key: "pushValue",
316
+ value: function () {
317
+ var _pushValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(key, value) {
318
+ var _this$obj8;
319
+
320
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
321
+ while (1) {
322
+ switch (_context4.prev = _context4.next) {
323
+ case 0:
324
+ _context4.next = 2;
325
+ return (_this$obj8 = this.obj) === null || _this$obj8 === void 0 ? void 0 : _this$obj8.pushValue(key, value);
326
+
327
+ case 2:
328
+ _context4.t0 = _context4.sent;
329
+
330
+ if (_context4.t0) {
331
+ _context4.next = 5;
332
+ break;
333
+ }
334
+
335
+ _context4.t0 = false;
336
+
337
+ case 5:
338
+ return _context4.abrupt("return", _context4.t0);
339
+
340
+ case 6:
341
+ case "end":
342
+ return _context4.stop();
343
+ }
344
+ }
345
+ }, _callee4, this);
346
+ }));
347
+
348
+ function pushValue(_x10, _x11) {
349
+ return _pushValue.apply(this, arguments);
350
+ }
351
+
352
+ return pushValue;
353
+ }()
354
+ /* -------------------------------------------------------------------------- */
355
+
356
+ }, {
357
+ key: "getIndexOrID",
358
+ value: function getIndexOrID() {
359
+ var _this$obj9;
360
+
361
+ return ((_this$obj9 = this.obj) === null || _this$obj9 === void 0 ? void 0 : _this$obj9.getIndexOrID()) || -1;
362
+ }
363
+ }, {
364
+ key: "getIndex",
365
+ value: function getIndex() {
366
+ var _this$obj10;
367
+
368
+ return ((_this$obj10 = this.obj) === null || _this$obj10 === void 0 ? void 0 : _this$obj10.getIndex()) || -1;
369
+ }
370
+ }, {
371
+ key: "getID",
372
+ value: function getID() {
373
+ var _this$obj11;
374
+
375
+ return ((_this$obj11 = this.obj) === null || _this$obj11 === void 0 ? void 0 : _this$obj11.getID()) || "";
376
+ }
377
+ /* -------------------------------------------------------------------------- */
378
+
379
+ /* Getters */
380
+
381
+ /* -------------------------------------------------------------------------- */
382
+
383
+ /* -------------------------------------------------------------------------- */
384
+
385
+ /* Events */
386
+
387
+ /* -------------------------------------------------------------------------- */
388
+
389
+ }, {
390
+ key: "event_run",
391
+ value: function () {
392
+ var _event_run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(eventName) {
393
+ var _len,
394
+ params,
395
+ _key,
396
+ _args5 = arguments;
397
+
398
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
399
+ while (1) {
400
+ switch (_context5.prev = _context5.next) {
401
+ case 0:
402
+ if (this.__sendEvents) {
403
+ _context5.next = 2;
404
+ break;
405
+ }
406
+
407
+ return _context5.abrupt("return");
408
+
409
+ case 2:
410
+ for (_len = _args5.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
411
+ params[_key - 1] = _args5[_key];
412
+ }
413
+
414
+ _context5.next = 5;
415
+ return _event.EventManager.run.apply(_event.EventManager, [this, eventName].concat(params));
416
+
417
+ case 5:
418
+ case "end":
419
+ return _context5.stop();
420
+ }
421
+ }
422
+ }, _callee5, this);
423
+ }));
424
+
425
+ function event_run(_x12) {
426
+ return _event_run.apply(this, arguments);
427
+ }
428
+
429
+ return event_run;
430
+ }()
431
+ }, {
432
+ key: "event_use",
433
+ value: function event_use(name, runEvent) {
434
+ var onlyOn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
435
+ var runOnce = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
436
+ return _event.EventManager.use(this, name, runEvent, onlyOn, runOnce);
437
+ }
438
+ }, {
439
+ key: "event_add",
440
+ value: function () {
441
+ var _event_add = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(name, uname, runEvent) {
442
+ var onlyOn,
443
+ runOnce,
444
+ _args6 = arguments;
445
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
446
+ while (1) {
447
+ switch (_context6.prev = _context6.next) {
448
+ case 0:
449
+ onlyOn = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : null;
450
+ runOnce = _args6.length > 4 && _args6[4] !== undefined ? _args6[4] : false;
451
+ _context6.next = 4;
452
+ return _event.EventManager.add(this, name, uname, runEvent, onlyOn, runOnce);
453
+
454
+ case 4:
455
+ case "end":
456
+ return _context6.stop();
457
+ }
458
+ }
459
+ }, _callee6, this);
460
+ }));
461
+
462
+ function event_add(_x13, _x14, _x15) {
463
+ return _event_add.apply(this, arguments);
464
+ }
465
+
466
+ return event_add;
467
+ }()
468
+ }, {
469
+ key: "events_stop",
470
+ value: function events_stop() {
471
+ this.__sendEvents = false;
472
+ }
473
+ }, {
474
+ key: "events_clear",
475
+ value: function events_clear() {
476
+ ObjectManager.events_clear(this);
477
+ }
478
+ }, {
479
+ key: "toggleOption",
480
+ value:
481
+ /* -------------------------------------------------------------------------- */
482
+
483
+ /* Options */
484
+
485
+ /* -------------------------------------------------------------------------- */
486
+
487
+ /**
23
488
  * Set an option to some value, if its already equal to the value it will be deleted instead
24
489
  * @param key
25
490
  * @param value
26
491
  * @returns
27
- */function(){function a(a,c){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){var d;return _regeneratorRuntime().wrap(function e(c){for(;1;)switch(c.prev=c.next){case 0:if(d=this.getOption(a),!(0,_object.object_equals_loose)(d,b)){c.next=6;break}return c.next=4,this.setOption(a,null);case 4:c.next=8;break;case 6:return c.next=8,this.setOption(a,b);case 8:case"end":return c.stop();}},c,this)}));return a}()},{key:"setOption",value:function(){function a(a,c){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){return _regeneratorRuntime().wrap(function d(c){for(;1;)switch(c.prev=c.next){case 0:return null==this.__options&&(this.__options={}),null==b?delete this.__options[a]:this.__options[a]=b,c.next=4,this.event_run("on_option_change",a,b);case 4:return c.abrupt("return",c.sent);case 5:case"end":return c.stop();}},c,this)}));return a}()/**
492
+ */
493
+ function () {
494
+ var _toggleOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(key, value) {
495
+ var oldval;
496
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
497
+ while (1) {
498
+ switch (_context7.prev = _context7.next) {
499
+ case 0:
500
+ oldval = this.getOption(key);
501
+
502
+ if (!(0, _object.object_equals_loose)(oldval, value)) {
503
+ _context7.next = 6;
504
+ break;
505
+ }
506
+
507
+ _context7.next = 4;
508
+ return this.setOption(key, null);
509
+
510
+ case 4:
511
+ _context7.next = 8;
512
+ break;
513
+
514
+ case 6:
515
+ _context7.next = 8;
516
+ return this.setOption(key, value);
517
+
518
+ case 8:
519
+ case "end":
520
+ return _context7.stop();
521
+ }
522
+ }
523
+ }, _callee7, this);
524
+ }));
525
+
526
+ function toggleOption(_x16, _x17) {
527
+ return _toggleOption.apply(this, arguments);
528
+ }
529
+
530
+ return toggleOption;
531
+ }()
532
+ }, {
533
+ key: "setOption",
534
+ value: function () {
535
+ var _setOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(key, value) {
536
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
537
+ while (1) {
538
+ switch (_context8.prev = _context8.next) {
539
+ case 0:
540
+ if (this.__options == null) this.__options = {};
541
+
542
+ if (value == null) {
543
+ delete this.__options[key];
544
+ } else {
545
+ this.__options[key] = value;
546
+ }
547
+
548
+ _context8.next = 4;
549
+ return this.event_run("on_option_change", key, value);
550
+
551
+ case 4:
552
+ return _context8.abrupt("return", _context8.sent);
553
+
554
+ case 5:
555
+ case "end":
556
+ return _context8.stop();
557
+ }
558
+ }
559
+ }, _callee8, this);
560
+ }));
561
+
562
+ function setOption(_x18, _x19) {
563
+ return _setOption.apply(this, arguments);
564
+ }
565
+
566
+ return setOption;
567
+ }()
568
+ /**
28
569
  * Sets an option then does an action,
29
570
  * after the action is run, updates the option again
30
571
  * @param key
31
572
  * @param value
32
573
  * @param nextvalue
33
574
  * @param action
34
- */},{key:"holdOption",value:function(){function a(a,c,d,e){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function e(a,b,c,d){return _regeneratorRuntime().wrap(function f(e){for(;1;)switch(e.prev=e.next){case 0:if(e.prev=0,this.setOption(a,b),"function"!=typeof d){e.next=5;break}return e.next=5,d();case 5:return e.prev=5,this.setOption(a,c),e.finish(5);case 8:case"end":return e.stop();}},e,this,[[0,,5,8]])}));return a}()},{key:"getOption",value:function getOption(a){return null==this.__options?void 0:this.__options[a]}/* -------------------------------------------------------------------------- */ /* Errors */ /* -------------------------------------------------------------------------- */},{key:"addError",value:function addError(b,c){var d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"auto";return a.addError(this,b,c,d)}},{key:"getErrors",value:function getErrors(){return a.getErrors(this)}},{key:"clearErrors",value:function clearErrors(){return a.clearErrors(this)}}],[{key:"events_clear",value:function events_clear(a){_event.EventManager.removeAll(a)}},{key:"addError",value:function addError(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"auto";if(a&&a.obj)return _SimpleObject["default"].addError(a.obj,b,c,d);var e=(0,_string.combine_if_not_blank)(b," : ",c);console.error("[REGISTER-ERROR]",e),_global.gfunc.run_action("add_error",{title:b,message:c,type:"error"})}},{key:"getErrors",value:function getErrors(a){var b=a.obj;return null==b?[]:_SimpleObject["default"].getErrors(a.obj)}},{key:"clearErrors",value:function clearErrors(a){return _SimpleObject["default"].clearErrors(a.obj)}}]),a}();exports.ObjectManager=ObjectManager;var _default=ObjectManager;exports["default"]=_default;
575
+ */
576
+
577
+ }, {
578
+ key: "holdOption",
579
+ value: function () {
580
+ var _holdOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, value, nextvalue, action) {
581
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
582
+ while (1) {
583
+ switch (_context9.prev = _context9.next) {
584
+ case 0:
585
+ _context9.prev = 0;
586
+ this.setOption(key, value);
587
+
588
+ if (!(typeof action === "function")) {
589
+ _context9.next = 5;
590
+ break;
591
+ }
592
+
593
+ _context9.next = 5;
594
+ return action();
595
+
596
+ case 5:
597
+ _context9.prev = 5;
598
+ this.setOption(key, nextvalue);
599
+ return _context9.finish(5);
600
+
601
+ case 8:
602
+ case "end":
603
+ return _context9.stop();
604
+ }
605
+ }
606
+ }, _callee9, this, [[0,, 5, 8]]);
607
+ }));
608
+
609
+ function holdOption(_x20, _x21, _x22, _x23) {
610
+ return _holdOption.apply(this, arguments);
611
+ }
612
+
613
+ return holdOption;
614
+ }()
615
+ }, {
616
+ key: "getOption",
617
+ value: function getOption(key) {
618
+ if (this.__options == null) return undefined;
619
+ return this.__options[key];
620
+ }
621
+ /* -------------------------------------------------------------------------- */
622
+
623
+ /* Errors */
624
+
625
+ /* -------------------------------------------------------------------------- */
626
+
627
+ }, {
628
+ key: "addError",
629
+ value: function addError(title, message) {
630
+ var sendToRegister = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "auto";
631
+ return ObjectManager.addError(this, title, message, sendToRegister);
632
+ }
633
+ }, {
634
+ key: "getErrors",
635
+ value: function getErrors() {
636
+ return ObjectManager.getErrors(this);
637
+ }
638
+ }, {
639
+ key: "clearErrors",
640
+ value: function clearErrors() {
641
+ return ObjectManager.clearErrors(this);
642
+ }
643
+ }], [{
644
+ key: "events_clear",
645
+ value: function events_clear(obj) {
646
+ _event.EventManager.removeAll(obj);
647
+ }
648
+ }, {
649
+ key: "addError",
650
+ value: function addError(o, title, message) {
651
+ var sendToRegister = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
652
+
653
+ if (o && o.obj) {
654
+ return _SimpleObject["default"].addError(o.obj, title, message, sendToRegister);
655
+ }
656
+
657
+ var errStr = (0, _string.combine_if_not_blank)(title, " : ", message);
658
+ console.error("[REGISTER-ERROR]", errStr);
659
+
660
+ _global.gfunc.run_action("add_error", {
661
+ title: title,
662
+ message: message,
663
+ type: "error"
664
+ });
665
+ }
666
+ }, {
667
+ key: "getErrors",
668
+ value: function getErrors(o) {
669
+ var obj = o.obj;
670
+ return obj != null ? _SimpleObject["default"].getErrors(o.obj) : [];
671
+ }
672
+ }, {
673
+ key: "clearErrors",
674
+ value: function clearErrors(o) {
675
+ return _SimpleObject["default"].clearErrors(o.obj);
676
+ }
677
+ }]);
678
+
679
+ return ObjectManager;
680
+ }();
681
+
682
+ exports.ObjectManager = ObjectManager;
683
+ var _default = ObjectManager;
684
+ exports["default"] = _default;