@azrico/webobject 1.1.18 → 1.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -52
- package/dist/index.js +1 -1
- package/dist/src/WebObjects/ParentWebObject.js +1 -15
- package/dist/src/WebObjects/WebObject.d.ts +2 -1
- package/dist/src/WebObjects/WebObject.js +3 -138
- package/dist/src/WebObjects/WebObjectManager.js +6 -71
- package/dist/src/index.js +1 -8
- package/dist/src/structs/DummyObject.js +1 -8
- package/dist/src/structs/MapableObject.js +2 -72
- package/dist/src/structs/MetaObject.js +1 -35
- package/dist/src/structs/ObjectArray.js +1 -43
- package/dist/src/structs/ObjectManager.js +7 -198
- package/dist/src/structs/SimpleObject.js +13 -489
- package/package.json +1 -1
|
@@ -1,35 +1 @@
|
|
|
1
|
-
import { object_isExactlyEmpty } from "@azrico/object";
|
|
2
|
-
import SimpleObject from "./SimpleObject";
|
|
3
|
-
export class MetaObject extends SimpleObject {
|
|
4
|
-
id;
|
|
5
|
-
key = "";
|
|
6
|
-
value;
|
|
7
|
-
constructor(initObject, value) {
|
|
8
|
-
super(true, false);
|
|
9
|
-
if (typeof initObject === "object") {
|
|
10
|
-
this.id = initObject.id;
|
|
11
|
-
this.key = initObject.key;
|
|
12
|
-
this.value = initObject.value;
|
|
13
|
-
}
|
|
14
|
-
else if (typeof initObject === "string") {
|
|
15
|
-
this.key = initObject;
|
|
16
|
-
this.value = value;
|
|
17
|
-
}
|
|
18
|
-
this.setOriginal();
|
|
19
|
-
}
|
|
20
|
-
async get_saveObject() {
|
|
21
|
-
return await MetaObject.get_saveObject(this);
|
|
22
|
-
}
|
|
23
|
-
static async get_saveObject(obj) { }
|
|
24
|
-
async Prepare() {
|
|
25
|
-
this.key = String(this.key);
|
|
26
|
-
return await Promise.resolve(true);
|
|
27
|
-
}
|
|
28
|
-
get isNew() {
|
|
29
|
-
return this.id == null || Number(this.id) <= 0;
|
|
30
|
-
}
|
|
31
|
-
get isDeleted() {
|
|
32
|
-
return object_isExactlyEmpty(this.value);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export default MetaObject;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=exports.MetaObject=void 0;var _object=require("@azrico/object"),_SimpleObject2=_interopRequireDefault(require("./SimpleObject"));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 _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)}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 _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),b&&_setPrototypeOf(a,b)}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _possibleConstructorReturn(a,b){if(b&&("object"===_typeof(b)||"function"==typeof b))return b;if(void 0!==b)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(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}var MetaObject=/*#__PURE__*/function(a){function b(a,d){var e;return _classCallCheck(this,b),e=c.call(this,!0,!1),_defineProperty(_assertThisInitialized(e),"id",void 0),_defineProperty(_assertThisInitialized(e),"key",""),_defineProperty(_assertThisInitialized(e),"value",void 0),"object"===_typeof(a)?(e.id=a.id,e.key=a.key,e.value=a.value):"string"==typeof a&&(e.key=a,e.value=d),e.setOriginal(),e}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"get_saveObject",value:function(){function a(){return c.apply(this,arguments)}var c=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){return _regeneratorRuntime().wrap(function c(a){for(;1;)switch(a.prev=a.next){case 0:return a.next=2,b.get_saveObject(this);case 2:return a.abrupt("return",a.sent);case 3:case"end":return a.stop();}},a,this)}));return a}()},{key:"Prepare",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){return _regeneratorRuntime().wrap(function b(a){for(;1;)switch(a.prev=a.next){case 0:return this.key+="",a.next=3,Promise.resolve(!0);case 3:return a.abrupt("return",a.sent);case 4:case"end":return a.stop();}},a,this)}));return a}()},{key:"isNew",get:function get(){return null==this.id||0>=+this.id}},{key:"isDeleted",get:function get(){return(0,_object.object_isExactlyEmpty)(this.value)}}],[{key:"get_saveObject",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){return _regeneratorRuntime().wrap(function b(a){for(;1;)switch(a.prev=a.next){case 0:case"end":return a.stop();}},b)}));return a}()}]),b}(_SimpleObject2["default"]);exports.MetaObject=MetaObject;var _default=MetaObject;exports["default"]=_default;
|
|
@@ -1,43 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/* -------------------------------------------------------------------------- */
|
|
3
|
-
/* Values */
|
|
4
|
-
/* -------------------------------------------------------------------------- */
|
|
5
|
-
objArray = [];
|
|
6
|
-
/* -------------------------------------------------------------------------- */
|
|
7
|
-
/* Base */
|
|
8
|
-
/* -------------------------------------------------------------------------- */
|
|
9
|
-
constructor(initObject, mapto_type) {
|
|
10
|
-
this.setObjects(initObject, mapto_type);
|
|
11
|
-
}
|
|
12
|
-
addObjects(initObject, mapto_type) {
|
|
13
|
-
if (initObject == null)
|
|
14
|
-
return false;
|
|
15
|
-
let resultObjects = ObjectArray.flattenWebObjects(initObject);
|
|
16
|
-
if (mapto_type)
|
|
17
|
-
resultObjects = resultObjects.map((r) => r instanceof mapto_type ? r : new mapto_type(r));
|
|
18
|
-
resultObjects.map((s) => this.objArray.push(s));
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
setObjects(initObject, mapto_type) {
|
|
22
|
-
this.objArray = [];
|
|
23
|
-
this.addObjects(initObject, mapto_type);
|
|
24
|
-
}
|
|
25
|
-
getObjects() {
|
|
26
|
-
return this.objArray;
|
|
27
|
-
}
|
|
28
|
-
static flattenWebObjects(inputData) {
|
|
29
|
-
if (inputData instanceof ObjectArray) {
|
|
30
|
-
return ObjectArray.flattenWebObjects(inputData.objArray);
|
|
31
|
-
}
|
|
32
|
-
else if (Array.isArray(inputData)) {
|
|
33
|
-
let final_result = [];
|
|
34
|
-
inputData.map((ind) => {
|
|
35
|
-
ObjectArray.flattenWebObjects(ind).map((s) => final_result.push(s));
|
|
36
|
-
});
|
|
37
|
-
return final_result;
|
|
38
|
-
}
|
|
39
|
-
else
|
|
40
|
-
return [inputData];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
export default ObjectArray;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=exports.ObjectArray=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}var ObjectArray=/*#__PURE__*/function(){/* -------------------------------------------------------------------------- */ /* Values */ /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ /* Base */ /* -------------------------------------------------------------------------- */function a(b,c){_classCallCheck(this,a),_defineProperty(this,"objArray",[]),this.setObjects(b,c)}return _createClass(a,[{key:"addObjects",value:function addObjects(b,c){var d=this;if(null==b)return!1;var e=a.flattenWebObjects(b);return c&&(e=e.map(function(a){return a instanceof c?a:new c(a)})),e.map(function(a){return d.objArray.push(a)}),!0}},{key:"setObjects",value:function setObjects(a,b){this.objArray=[],this.addObjects(a,b)}},{key:"getObjects",value:function getObjects(){return this.objArray}}],[{key:"flattenWebObjects",value:function flattenWebObjects(b){if(b instanceof a)return a.flattenWebObjects(b.objArray);if(Array.isArray(b)){var c=[];return b.map(function(b){a.flattenWebObjects(b).map(function(a){return c.push(a)})}),c}return[b]}}]),a}();exports.ObjectArray=ObjectArray;var _default=ObjectArray;exports["default"]=_default;
|
|
@@ -1,218 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
import { object_equals_loose, } from "@azrico/object";
|
|
3
|
-
import { EventManager } from "@azrico/event";
|
|
4
|
-
import SimpleObject from "./SimpleObject";
|
|
5
|
-
import { combine_if_not_blank } from "@azrico/string";
|
|
6
|
-
/**
|
|
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 _global=require("@azrico/global"),_object=require("@azrico/object"),_event=require("@azrico/event"),_SimpleObject=_interopRequireDefault(require("./SimpleObject")),_string=require("@azrico/string");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}/**
|
|
7
2
|
* This class manages the events of an Simple Object
|
|
8
|
-
*/
|
|
9
|
-
export class ObjectManager {
|
|
10
|
-
__eventList;
|
|
11
|
-
__eventPrefix;
|
|
12
|
-
__sendEvents = true;
|
|
13
|
-
__currentObject;
|
|
14
|
-
__options;
|
|
15
|
-
async notifyChanged(type, key, value, subvalue) {
|
|
16
|
-
const obj = this.getObject();
|
|
17
|
-
if (!obj)
|
|
18
|
-
return false;
|
|
19
|
-
if (value === undefined)
|
|
20
|
-
value = obj.getValue(key);
|
|
21
|
-
const typestr = (type ? `$${type}$` : "") + key;
|
|
22
|
-
return await this.event_run("on_change", typestr, value);
|
|
23
|
-
}
|
|
24
|
-
/* -------------------------------------------------------------------------- */
|
|
25
|
-
get obj() {
|
|
26
|
-
return this.getObject();
|
|
27
|
-
}
|
|
28
|
-
getObject() {
|
|
29
|
-
return this.__currentObject ?? undefined;
|
|
30
|
-
}
|
|
31
|
-
setObject(toObj) {
|
|
32
|
-
this.__currentObject = toObj;
|
|
33
|
-
if (this.__currentObject) {
|
|
34
|
-
this.__currentObject.get_managerClass = () => {
|
|
35
|
-
return this;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
/* -------------------------------------------------------------------------- */
|
|
41
|
-
/* Child functions */
|
|
42
|
-
/* -------------------------------------------------------------------------- */
|
|
43
|
-
get isChanged() {
|
|
44
|
-
return this.obj != null && this.obj.isChanged;
|
|
45
|
-
}
|
|
46
|
-
get isDeleted() {
|
|
47
|
-
return this.obj == null || this.obj.isDeleted;
|
|
48
|
-
}
|
|
49
|
-
get d() {
|
|
50
|
-
return this.obj?.d;
|
|
51
|
-
}
|
|
52
|
-
get canModify() {
|
|
53
|
-
return !this.obj?.canModify;
|
|
54
|
-
}
|
|
55
|
-
get isEditMode() {
|
|
56
|
-
return this.obj?.isEditMode;
|
|
57
|
-
}
|
|
58
|
-
get isNew() {
|
|
59
|
-
return this.obj == null || this.obj.isNew;
|
|
60
|
-
}
|
|
61
|
-
get isSaved() {
|
|
62
|
-
return this.obj?.isSaved || false;
|
|
63
|
-
}
|
|
64
|
-
get __cache_name() {
|
|
65
|
-
return this.constructor["__cache_name"];
|
|
66
|
-
}
|
|
67
|
-
apply_changes() {
|
|
68
|
-
return this.obj?.apply_changes();
|
|
69
|
-
}
|
|
70
|
-
getValue(key, original = false) {
|
|
71
|
-
return this.obj?.getValue(key, original);
|
|
72
|
-
}
|
|
73
|
-
get(key, original = false) {
|
|
74
|
-
return this.obj?.get(key, original);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
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)}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&&(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()}},{key:"getObject",value:function getObject(){var a;return null!==(a=this.__currentObject)&&void 0!==a?a:void 0}},{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:"isEditMode",get:function get(){var a;return null===(a=this.obj)||void 0===a?void 0:a.isEditMode}},{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:"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:"get",value:function get(a){var b,c=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1];return null===(b=this.obj)||void 0===b?void 0:b.get(a,c)}/**
|
|
77
4
|
* set value
|
|
78
5
|
* @param key
|
|
79
6
|
* @param value
|
|
80
7
|
* @return true if changed , false otherwise
|
|
81
|
-
*/
|
|
82
|
-
setValue(key, value) {
|
|
83
|
-
return this.obj?.setValue(key, value) || false;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
8
|
+
*/},{key:"setValue",value:function setValue(a,b){var c;return(null===(c=this.obj)||void 0===c?void 0:c.setValue(a,b))||!1}/**
|
|
86
9
|
* set key of subObject
|
|
87
10
|
* @param key
|
|
88
11
|
* @param value
|
|
89
12
|
* @param subvalue
|
|
90
13
|
* @return true if changed , false otherwise
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
return this.obj?.setSubValue(key, objKey, subvalue) || false;
|
|
94
|
-
}
|
|
95
|
-
//Push value on array
|
|
96
|
-
pushValue(key, value) {
|
|
97
|
-
return this.obj?.pushValue(key, value) || false;
|
|
98
|
-
}
|
|
99
|
-
/* -------------------------------------------------------------------------- */
|
|
100
|
-
getIndexOrID() {
|
|
101
|
-
return this.obj?.getIndexOrID() || -1;
|
|
102
|
-
}
|
|
103
|
-
getIndex() {
|
|
104
|
-
return this.obj?.getIndex() || -1;
|
|
105
|
-
}
|
|
106
|
-
getID() {
|
|
107
|
-
return this.obj?.getID() || "";
|
|
108
|
-
}
|
|
109
|
-
/* -------------------------------------------------------------------------- */
|
|
110
|
-
/* Getters */
|
|
111
|
-
/* -------------------------------------------------------------------------- */
|
|
112
|
-
/* -------------------------------------------------------------------------- */
|
|
113
|
-
/* Events */
|
|
114
|
-
/* -------------------------------------------------------------------------- */
|
|
115
|
-
async event_run(eventName, ...params) {
|
|
116
|
-
if (!this.__sendEvents)
|
|
117
|
-
return;
|
|
118
|
-
await EventManager.run(this, eventName, ...params);
|
|
119
|
-
}
|
|
120
|
-
event_use(name, runEvent, onlyOn = null, runOnce = false) {
|
|
121
|
-
return EventManager.use(this, name, runEvent, onlyOn, runOnce);
|
|
122
|
-
}
|
|
123
|
-
async event_add(name, uname, runEvent, onlyOn = null, runOnce = false) {
|
|
124
|
-
await EventManager.add(this, name, uname, runEvent, onlyOn, runOnce);
|
|
125
|
-
}
|
|
126
|
-
events_stop() {
|
|
127
|
-
this.__sendEvents = false;
|
|
128
|
-
}
|
|
129
|
-
events_clear() {
|
|
130
|
-
ObjectManager.events_clear(this);
|
|
131
|
-
}
|
|
132
|
-
static events_clear(obj) {
|
|
133
|
-
EventManager.removeAll(obj);
|
|
134
|
-
}
|
|
135
|
-
/* -------------------------------------------------------------------------- */
|
|
136
|
-
/* Options */
|
|
137
|
-
/* -------------------------------------------------------------------------- */
|
|
138
|
-
/**
|
|
14
|
+
*/},{key:"setSubValue",value:function setSubValue(a,b,c){var d;return(null===(d=this.obj)||void 0===d?void 0:d.setSubValue(a,b,c))||!1}//Push value on array
|
|
15
|
+
},{key:"pushValue",value:function pushValue(a,b){var c;return(null===(c=this.obj)||void 0===c?void 0:c.pushValue(a,b))||!1}/* -------------------------------------------------------------------------- */},{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 */ /* -------------------------------------------------------------------------- */ /**
|
|
139
16
|
* Set an option to some value, if its already equal to the value it will be deleted instead
|
|
140
17
|
* @param key
|
|
141
18
|
* @param value
|
|
142
19
|
* @returns
|
|
143
|
-
*/
|
|
144
|
-
async toggleOption(key, value) {
|
|
145
|
-
var oldval = this.getOption(key);
|
|
146
|
-
if (object_equals_loose(oldval, value)) {
|
|
147
|
-
await this.setOption(key, null);
|
|
148
|
-
}
|
|
149
|
-
else
|
|
150
|
-
await this.setOption(key, value);
|
|
151
|
-
}
|
|
152
|
-
async setOption(key, value) {
|
|
153
|
-
if (this.__options == null)
|
|
154
|
-
this.__options = {};
|
|
155
|
-
if (value == null) {
|
|
156
|
-
delete this.__options[key];
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
this.__options[key] = value;
|
|
160
|
-
}
|
|
161
|
-
return await this.event_run("on_option_change", key, value);
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
20
|
+
*/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}()/**
|
|
164
21
|
* Sets an option then does an action,
|
|
165
22
|
* after the action is run, updates the option again
|
|
166
23
|
* @param key
|
|
167
24
|
* @param value
|
|
168
25
|
* @param nextvalue
|
|
169
26
|
* @param action
|
|
170
|
-
*/
|
|
171
|
-
async holdOption(key, value, nextvalue, action) {
|
|
172
|
-
try {
|
|
173
|
-
this.setOption(key, value);
|
|
174
|
-
if (typeof action === "function")
|
|
175
|
-
await action();
|
|
176
|
-
}
|
|
177
|
-
finally {
|
|
178
|
-
this.setOption(key, nextvalue);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
getOption(key) {
|
|
182
|
-
if (this.__options == null)
|
|
183
|
-
return undefined;
|
|
184
|
-
return this.__options[key];
|
|
185
|
-
}
|
|
186
|
-
/* -------------------------------------------------------------------------- */
|
|
187
|
-
/* Errors */
|
|
188
|
-
/* -------------------------------------------------------------------------- */
|
|
189
|
-
addError(title, message, sendToRegister = "auto") {
|
|
190
|
-
return ObjectManager.addError(this, title, message, sendToRegister);
|
|
191
|
-
}
|
|
192
|
-
getErrors() {
|
|
193
|
-
return ObjectManager.getErrors(this);
|
|
194
|
-
}
|
|
195
|
-
clearErrors() {
|
|
196
|
-
return ObjectManager.clearErrors(this);
|
|
197
|
-
}
|
|
198
|
-
static addError(o, title, message, sendToRegister = "auto") {
|
|
199
|
-
if (o && o.obj) {
|
|
200
|
-
return SimpleObject.addError(o.obj, title, message, sendToRegister);
|
|
201
|
-
}
|
|
202
|
-
const errStr = combine_if_not_blank(title, " : ", message);
|
|
203
|
-
console.error("[REGISTER-ERROR]", errStr);
|
|
204
|
-
gfunc.run_action("add_error", {
|
|
205
|
-
title: title,
|
|
206
|
-
message: message,
|
|
207
|
-
type: "error",
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
static getErrors(o) {
|
|
211
|
-
const obj = o.obj;
|
|
212
|
-
return obj != null ? SimpleObject.getErrors(o.obj) : [];
|
|
213
|
-
}
|
|
214
|
-
static clearErrors(o) {
|
|
215
|
-
return SimpleObject.clearErrors(o.obj);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
export default ObjectManager;
|
|
27
|
+
*/},{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;
|