@c8y/ng1-modules 1022.3.2 → 1022.4.3

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 +1 @@
1
- function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},e=Object.prototype,s=e.hasOwnProperty,l=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function i(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},"")}catch(u){i=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o,i,a,c,t=t&&t.prototype instanceof m?t:m,t=Object.create(t.prototype),n=new j(n||[]);return l(t,"_invoke",{value:(o=e,i=r,a=n,c=p,function(e,t){if(c===g)throw Error("Generator is already running");if(c===h){if("throw"===e)throw t;return{value:u,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r){r=function e(t,r){var n=r.method,o=t.iterator[n];if(o===u)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=u,e(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;n=f(o,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,d;o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}(r,a);if(r){if(r===d)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===p)throw c=h,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=g;r=f(o,i,a);if("normal"===r.type){if(c=a.done?h:y,r.arg===d)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c=h,a.method="throw",a.arg=r.arg)}})}),t}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}a.wrap=c;var p="suspendedStart",y="suspendedYield",g="executing",h="completed",d={};function m(){}function v(){}function b(){}var t={},_=(i(t,n,function(){return this}),Object.getPrototypeOf),_=_&&_(_(x([]))),w=(_&&_!==e&&s.call(_,n)&&(t=_),b.prototype=m.prototype=Object.create(t));function E(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function T(a,c){var t;l(this,"_invoke",{value:function(r,n){function e(){return new c(function(e,t){!function t(e,r,n,o){var i,e=f(a[e],a,r);if("throw"!==e.type)return(r=(i=e.arg).value)&&"object"==_typeof(r)&&s.call(r,"__await")?c.resolve(r.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):c.resolve(r).then(function(e){i.value=e,n(i)},function(e){return t("throw",e,n,o)});o(e.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function x(t){if(t||""===t){var r,e=t[n];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return r=-1,(e=function e(){for(;++r<t.length;)if(s.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=u,e.done=!0,e}).next=e}throw new TypeError(_typeof(t)+" is not iterable")}return l(w,"constructor",{value:v.prototype=b,configurable:!0}),l(b,"constructor",{value:v,configurable:!0}),v.displayName=i(b,o,"GeneratorFunction"),a.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,i(e,o,"GeneratorFunction")),e.prototype=Object.create(w),e},a.awrap=function(e){return{__await:e}},E(T.prototype),i(T.prototype,r,function(){return this}),a.AsyncIterator=T,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new T(c(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},E(w),i(w,o,"Generator"),i(w,n,function(){return this}),i(w,"toString",function(){return"[object Generator]"}),a.keys=function(e){var t,r=Object(e),n=[];for(t in r)n.push(t);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in r)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=x,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=u)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function e(e,t){return i.type="throw",i.arg=r,n.next=e,t&&(n.method="next",n.arg=u),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),c=s.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,o=this.tryEntries[t];if(o.tryLoc===e)return"throw"===(r=o.completion).type&&(n=r.arg,S(o)),n}throw Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:x(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=u),d}},a}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,r){var n=c.apply(e,a);function o(e){asyncGeneratorStep(n,t,r,o,i,"next",e)}function i(e){asyncGeneratorStep(n,t,r,o,i,"throw",e)}o(void 0)})}}(()=>{function e(c,e,t,u,s,l){var r=e.MODBUS_DEVICE_FRAGMENT,n=e.PROFIBUS_DEVICE_FRAGMENT;return{getConfigModel:function(e){return o.apply(this,arguments)},updateConfigModel:function(e,t){_.set(e,"categoriesConfig",_.map(t,function(e){return{name:e.name,label:e.label,elements:_.compact(_.map(e.elements,function(e){return e.show?_.pick(e,["refId","label","type"]):void 0}))}})),_.unset(e,"coils"),_.unset(e,"registers")},getWidgetModel:function(e){return h.apply(this,arguments)},isAtLeastOneElementSelected:function(e){return _.some(e,function(e){return _.some(e.elements,"show")})},isDiscreteIOSelectedInConfig:window.c8y_testing&&g,isRegisterSelectedInConfig:window.c8y_testing&&y};function o(){return(o=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=_.get(t,"device"))return e.next=4,b(r);e.next=6;break;case 4:return r=e.sent,e.abrupt("return",function(){return i.apply(this,arguments)}({fieldbusDevice:r,widgetConfig:t}));case 6:return e.abrupt("return",c.resolve([]));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function i(){return(i=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n,o,i,a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.fieldbusDevice,n=t.widgetConfig,e.next=3,w(r);case 3:if(o=e.sent,i=m({fieldbusDevice:r,deviceType:o}),_.isEmpty(i))return e.abrupt("return",[]);e.next=7;break;case 7:return a=_.groupBy(i,E),e.abrupt("return",_(n).chain().get("categoriesConfig",[]).map(function(e){var t=_.get(a,e.name);_.defaults(e,{label:e.name||l("Uncategorized")});t=_.flow([f,p])({categoryConfigElements:e.elements,deviceType:o,elements:i,categoryElements:t,widgetConfig:n}).categoryConfigElements;return e.elements=t,e}).thru(function(e){return T({categoriesConfig:e,categories:a,deviceType:o,widgetConfig:n})}).value());case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function f(e){var t=e.categoryConfigElements,r=e.deviceType,n=e.elements,o=e.categoryElements,e=e.widgetConfig;return{categoryConfigElements:_.map(t,function(e){var t=e.refId,t=s.findElementBestMatchingRefId(n,t,e.type);if(t)return _.defaults(e,{name:t.name,type:t.meta.type.value,typeLabel:s.getElementTypeLabel(t,r),show:!0,label:t.name})}),deviceType:r,elements:n,categoryElements:o,widgetConfig:e}}function p(e){var t=e.categoryConfigElements,r=e.deviceType,n=e.elements,o=e.categoryElements,i=e.widgetConfig;return{categoryConfigElements:[].concat(_toConsumableArray(t),_toConsumableArray(_(o).filter(function(e){return!_.find(t,{refId:s.getElementRefId(e)})}).map(function(e){return{refId:s.getElementRefId(e),label:e.name,show:a(e,i),name:e.name,type:e.meta.type.value,typeLabel:s.getElementTypeLabel(e,r)}}).value())),deviceType:r,elements:n,categoryElements:o,widgetConfig:i}}function a(e,t){return(e.meta.type===s.ElementType.REGISTER?y:g)(e,t)}function y(e,t){var r=e.id,n=e.input,o=e.number,e=e.startBit,t=t.registers;return _.includes(t,r)||_.includes(t,[n,o,e].join(","))||_.includes(t,o)||!!_.find(t,{number:o,startBit:e})}function g(e,t){var r=e.id,n=e.input,e=e.number,t=t.coils;return _.includes(t,r)||_.includes(t,[n,e].join(","))||_.includes(t,e)}function h(){return(h=_asyncToGenerator(_regeneratorRuntime().mark(function e(t){var r,n,o,i,a;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=_.get(t,"device.id"),r=u.detailRealtime(o),n=r.then(w),o=function(){return d.apply(this,arguments)}(o,t).then(function(e){return _.get(t,"categoriesConfig",e)}),e.next=6,c.all({fieldbusDevice:r,deviceType:n,categoriesConfig:o});case 6:return r=e.sent,n=r.fieldbusDevice,o=r.categoriesConfig,i=m({fieldbusDevice:n,deviceType:r.deviceType}),a=_.map(o,function(e){return _.defaults(_objectSpread(_objectSpread({},e),{},{elements:_(e.elements).map(function(e){var t=s.findElementBestMatchingRefId(i,e.refId,e.type);return t?_.defaults(_objectSpread(_objectSpread({},e),t),{label:t.name,show:!0}):e}).filter("show").value()}),{label:e.name})}),e.abrupt("return",{device:n,categories:a});case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function d(){return(d=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r){var n,o,i;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,b(t);case 2:return n=e.sent,e.next=5,w(n);case 5:return o=e.sent,i=m({fieldbusDevice:n,deviceType:o}),i=_.groupBy(i,E),e.abrupt("return",T({categoriesConfig:[],categories:i,deviceType:o,widgetConfig:r}));case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function m(e){var t=e.fieldbusDevice,e=s.getElementsWithMeta(e.deviceType);return _.has(t,r)||_.has(t,n)?e:_.filter(e,v)}function v(e){return e.meta.type===s.ElementType.REGISTER&&!e.input}function b(e){return s.isFieldbusDevice(e)?c.resolve(e):u.detail(t.getId(e)).then(t.getResData)}function w(e){return s.getDeviceTypeFromDevice(e)}function E(e){return _.get(e,"category","")}function T(e){var r=e.categoriesConfig,t=e.categories,n=e.deviceType,o=e.widgetConfig;return[].concat(_toConsumableArray(r),_toConsumableArray(_(t).pickBy(function(e,t){return!_.find(r,{name:t})}).map(function(e,t){return{name:t,label:t||l("Uncategorized"),elements:_.map(e,function(e){return{refId:s.getElementRefId(e),label:e.name,show:a(e,o),name:e.name,type:e.meta.type.value,typeLabel:s.getElementTypeLabel(e,n)}})}}).value()))}}e.$inject=["$q","fieldbusConstants","c8yBase","c8yDevices","c8yDeviceDatabase","gettext"],angular.module("c8y.modbusWidget4").factory("modbusWidgetSvc",e)})();
1
+ function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){_defineProperty(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}function _regenerator(){var g,e="function"==typeof Symbol?Symbol:{},t=e.iterator||"@@iterator",r=e.toStringTag||"@@toStringTag";function n(e,t,r,n){var o,i,a,c,u,f,l,s,y,t=t&&t.prototype instanceof d?t:d,t=Object.create(t.prototype);return _regeneratorDefine2(t,"_invoke",(o=e,i=r,l=n||[],s=!1,y={p:f=0,n:0,v:g,a:p,f:p.bind(g,4),d:function(e,t){return a=e,c=0,u=g,y.n=t,m}},function(e,t,r){if(1<f)throw TypeError("Generator is already running");for(s&&1===t&&p(t,r),c=t,u=r;(_=c<2?g:u)||!s;){a||(c?c<3?(1<c&&(y.n=-1),p(c,u)):y.n=u:y.v=u);try{if(f=2,a){if(_=a[e=c?e:"next"]){if(!(_=_.call(a,u)))throw TypeError("iterator result is not an object");if(!_.done)return _;u=_.value,c<2&&(c=0)}else 1===c&&(_=a.return)&&_.call(a),c<2&&(u=TypeError("The iterator does not provide a '"+e+"' method"),c=1);a=g}else if((_=(s=y.n<0)?u:o.call(i,y))!==m)break}catch(e){a=g,c=1,u=e}finally{f=1}}return{value:_,done:s}}),!0),t;function p(e,t){for(c=e,u=t,_=0;!s&&f&&!r&&_<l.length;_++){var r,n=l[_],o=y.p,i=n[2];3<e?(r=i===t)&&(u=n[(c=n[4])?5:c=3],n[4]=n[5]=g):n[0]<=o&&((r=e<2&&o<n[1])?(c=0,y.v=t,y.n=n[1]):o<i&&(r=e<3||n[0]>t||i<t)&&(n[4]=e,n[5]=t,y.n=i,c=0))}if(r||1<e)return m;throw s=!0,t}}var m={};function d(){}function o(){}function i(){}var _=Object.getPrototypeOf,e=[][t]?_(_([][t]())):(_regeneratorDefine2(_={},t,function(){return this}),_),a=i.prototype=d.prototype=Object.create(e);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_regeneratorDefine2(e,r,"GeneratorFunction")),e.prototype=Object.create(a),e}return _regeneratorDefine2(a,"constructor",o.prototype=i),_regeneratorDefine2(i,"constructor",o),_regeneratorDefine2(i,r,o.displayName="GeneratorFunction"),_regeneratorDefine2(a),_regeneratorDefine2(a,r,"Generator"),_regeneratorDefine2(a,t,function(){return this}),_regeneratorDefine2(a,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:n,m:c}})()}function _regeneratorDefine2(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}(_regeneratorDefine2=function(e,t,r,n){t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:((n=function(t,r){_regeneratorDefine2(e,t,function(e){return this._invoke(t,r,e)})})("next",0),n("throw",1),n("return",2))})(e,t,r,n)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,r){var n=c.apply(e,a);function o(e){asyncGeneratorStep(n,t,r,o,i,"next",e)}function i(e){asyncGeneratorStep(n,t,r,o,i,"throw",e)}o(void 0)})}}(()=>{function e(c,e,t,u,f,l){var r=e.MODBUS_DEVICE_FRAGMENT,n=e.PROFIBUS_DEVICE_FRAGMENT;return{getConfigModel:function(e){return o.apply(this,arguments)},updateConfigModel:function(e,t){_.set(e,"categoriesConfig",_.map(t,function(e){return{name:e.name,label:e.label,elements:_.compact(_.map(e.elements,function(e){return e.show?_.pick(e,["refId","label","type"]):void 0}))}})),_.unset(e,"coils"),_.unset(e,"registers")},getWidgetModel:function(e){return m.apply(this,arguments)},isAtLeastOneElementSelected:function(e){return _.some(e,function(e){return _.some(e.elements,"show")})},isDiscreteIOSelectedInConfig:window.c8y_testing&&g,isRegisterSelectedInConfig:window.c8y_testing&&p};function o(){return(o=_asyncToGenerator(_regenerator().m(function e(t){var r;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(r=_.get(t,"device"))return e.n=1,h(r);e.n=2;break;case 1:return r=e.v,e.a(2,function(){return i.apply(this,arguments)}({fieldbusDevice:r,widgetConfig:t}));case 2:return e.a(2,c.resolve([]))}},e)}))).apply(this,arguments)}function i(){return(i=_asyncToGenerator(_regenerator().m(function e(t){var r,n,o,i,a;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return r=t.fieldbusDevice,n=t.widgetConfig,e.n=1,w(r);case 1:if(o=e.v,i=b({fieldbusDevice:r,deviceType:o}),_.isEmpty(i))return e.a(2,[]);e.n=2;break;case 2:return a=_.groupBy(i,T),e.a(2,_(n).chain().get("categoriesConfig",[]).map(function(e){var t=_.get(a,e.name);_.defaults(e,{label:e.name||l("Uncategorized")});t=_.flow([s,y])({categoryConfigElements:e.elements,deviceType:o,elements:i,categoryElements:t,widgetConfig:n}).categoryConfigElements;return e.elements=t,e}).thru(function(e){return E({categoriesConfig:e,categories:a,deviceType:o,widgetConfig:n})}).value())}},e)}))).apply(this,arguments)}function s(e){var t=e.categoryConfigElements,r=e.deviceType,n=e.elements,o=e.categoryElements,e=e.widgetConfig;return{categoryConfigElements:_.map(t,function(e){var t=e.refId,t=f.findElementBestMatchingRefId(n,t,e.type);if(t)return _.defaults(e,{name:t.name,type:t.meta.type.value,typeLabel:f.getElementTypeLabel(t,r),show:!0,label:t.name})}),deviceType:r,elements:n,categoryElements:o,widgetConfig:e}}function y(e){var t=e.categoryConfigElements,r=e.deviceType,n=e.elements,o=e.categoryElements,i=e.widgetConfig;return{categoryConfigElements:[].concat(_toConsumableArray(t),_toConsumableArray(_(o).filter(function(e){return!_.find(t,{refId:f.getElementRefId(e)})}).map(function(e){return{refId:f.getElementRefId(e),label:e.name,show:a(e,i),name:e.name,type:e.meta.type.value,typeLabel:f.getElementTypeLabel(e,r)}}).value())),deviceType:r,elements:n,categoryElements:o,widgetConfig:i}}function a(e,t){return(e.meta.type===f.ElementType.REGISTER?p:g)(e,t)}function p(e,t){var r=e.id,n=e.input,o=e.number,e=e.startBit,t=t.registers;return _.includes(t,r)||_.includes(t,[n,o,e].join(","))||_.includes(t,o)||!!_.find(t,{number:o,startBit:e})}function g(e,t){var r=e.id,n=e.input,e=e.number,t=t.coils;return _.includes(t,r)||_.includes(t,[n,e].join(","))||_.includes(t,e)}function m(){return(m=_asyncToGenerator(_regenerator().m(function e(t){var r,n,o,i,a;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return o=_.get(t,"device.id"),r=u.detailRealtime(o),n=r.then(w),o=function(){return d.apply(this,arguments)}(o,t).then(function(e){return _.get(t,"categoriesConfig",e)}),e.n=1,c.all({fieldbusDevice:r,deviceType:n,categoriesConfig:o});case 1:return r=e.v,n=r.fieldbusDevice,o=r.categoriesConfig,i=b({fieldbusDevice:n,deviceType:r.deviceType}),a=_.map(o,function(e){return _.defaults(_objectSpread(_objectSpread({},e),{},{elements:_(e.elements).map(function(e){var t=f.findElementBestMatchingRefId(i,e.refId,e.type);return t?_.defaults(_objectSpread(_objectSpread({},e),t),{label:t.name,show:!0}):e}).filter("show").value()}),{label:e.name})}),e.a(2,{device:n,categories:a})}},e)}))).apply(this,arguments)}function d(){return(d=_asyncToGenerator(_regenerator().m(function e(t,r){var n,o,i;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,h(t);case 1:return n=e.v,e.n=2,w(n);case 2:return o=e.v,i=b({fieldbusDevice:n,deviceType:o}),i=_.groupBy(i,T),e.a(2,E({categoriesConfig:[],categories:i,deviceType:o,widgetConfig:r}))}},e)}))).apply(this,arguments)}function b(e){var t=e.fieldbusDevice,e=f.getElementsWithMeta(e.deviceType);return _.has(t,r)||_.has(t,n)?e:_.filter(e,v)}function v(e){return e.meta.type===f.ElementType.REGISTER&&!e.input}function h(e){return f.isFieldbusDevice(e)?c.resolve(e):u.detail(t.getId(e)).then(t.getResData)}function w(e){return f.getDeviceTypeFromDevice(e)}function T(e){return _.get(e,"category","")}function E(e){var r=e.categoriesConfig,t=e.categories,n=e.deviceType,o=e.widgetConfig;return[].concat(_toConsumableArray(r),_toConsumableArray(_(t).pickBy(function(e,t){return!_.find(r,{name:t})}).map(function(e,t){return{name:t,label:t||l("Uncategorized"),elements:_.map(e,function(e){return{refId:f.getElementRefId(e),label:e.name,show:a(e,o),name:e.name,type:e.meta.type.value,typeLabel:f.getElementTypeLabel(e,n)}})}}).value()))}}e.$inject=["$q","fieldbusConstants","c8yBase","c8yDevices","c8yDeviceDatabase","gettext"],angular.module("c8y.modbusWidget4").factory("modbusWidgetSvc",e)})();
@@ -1 +1 @@
1
- function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var u,a={},t=Object.prototype,f=t.hasOwnProperty,l=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(u){i=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o,i,a,c,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),n=new O(n||[]);return l(e,"_invoke",{value:(o=t,i=r,a=n,c=h,function(t,e){if(c===y)throw Error("Generator is already running");if(c===g){if("throw"===t)throw e;return{value:u,done:!0}}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(o===u)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=u,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;n=s(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,d;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=u),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}(r,a);if(r){if(r===d)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(c===h)throw c=g,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);c=y;r=s(o,i,a);if("normal"===r.type){if(c=a.done?g:p,r.arg===d)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(c=g,a.method="throw",a.arg=r.arg)}})}),e}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=c;var h="suspendedStart",p="suspendedYield",y="executing",g="completed",d={};function v(){}function m(){}function w(){}var e={},b=(i(e,n,function(){return this}),Object.getPrototypeOf),b=b&&b(b(j([]))),L=(b&&b!==t&&f.call(b,n)&&(e=b),w.prototype=v.prototype=Object.create(e));function _(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function x(a,c){var e;l(this,"_invoke",{value:function(r,n){function t(){return new c(function(t,e){!function e(t,r,n,o){var i,t=s(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==_typeof(r)&&f.call(r,"__await")?c.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):c.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(e){if(e||""===e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(f.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=u,t.done=!0,t}).next=t}throw new TypeError(_typeof(e)+" is not iterable")}return l(L,"constructor",{value:m.prototype=w,configurable:!0}),l(w,"constructor",{value:m,configurable:!0}),m.displayName=i(w,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,i(t,o,"GeneratorFunction")),t.prototype=Object.create(L),t},a.awrap=function(t){return{__await:t}},_(x.prototype),i(x.prototype,r,function(){return this}),a.AsyncIterator=x,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new x(c(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},_(L),i(L,o,"Generator"),i(L,n,function(){return this}),i(L,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=j,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&f.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=f.call(o,"catchLoc"),c=f.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&f.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,S(o)),n}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=u),d}},a}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(c){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=c.apply(t,a);function o(t){asyncGeneratorStep(n,e,r,o,i,"next",t)}function i(t){asyncGeneratorStep(n,e,r,o,i,"throw",t)}o(void 0)})}}(()=>{function t(e,r){var t,n,o=this;function i(){return(i=_asyncToGenerator(_regeneratorRuntime().mark(function t(){return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.getConfigModel(o.config);case 2:o.categoriesConfig=t.sent,e.$apply();case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}_.assign(o,{$doCheck:function(){_.isEqual(t,o.config.device)||(t=o.config.device,function(){i.apply(this,arguments)}());_.isEqual(n,o.categoriesConfig)||(n=_.cloneDeep(o.categoriesConfig),(()=>{var t;if(n)return t=r.isAtLeastOneElementSelected(n),o.modbusWidgetConfigForm.modbusWidgetValidation.$setValidity("at-least-one-field-selected",t),o.atLeastOneElementSelected=t})()&&r.updateConfigModel(o.config,n))}})}t.$inject=["$rootScope","modbusWidgetSvc"],angular.module("c8y.modbusWidget4").component("c8yModbusWidgetConfig",{templateUrl:":::PLUGIN_PATH:::/widget-config.html",bindings:{config:"<"},controllerAs:"vm",controller:t})})();
1
+ function _regenerator(){var d,e="function"==typeof Symbol?Symbol:{},t=e.iterator||"@@iterator",n=e.toStringTag||"@@toStringTag";function r(e,t,n,r){var o,i,a,c,f,u,g,l,s,t=t&&t.prototype instanceof _?t:_,t=Object.create(t.prototype);return _regeneratorDefine2(t,"_invoke",(o=e,i=n,g=r||[],l=!1,s={p:u=0,n:0,v:d,a:p,f:p.bind(d,4),d:function(e,t){return a=e,c=0,f=d,s.n=t,y}},function(e,t,n){if(1<u)throw TypeError("Generator is already running");for(l&&1===t&&p(t,n),c=t,f=n;(v=c<2?d:f)||!l;){a||(c?c<3?(1<c&&(s.n=-1),p(c,f)):s.n=f:s.v=f);try{if(u=2,a){if(v=a[e=c?e:"next"]){if(!(v=v.call(a,f)))throw TypeError("iterator result is not an object");if(!v.done)return v;f=v.value,c<2&&(c=0)}else 1===c&&(v=a.return)&&v.call(a),c<2&&(f=TypeError("The iterator does not provide a '"+e+"' method"),c=1);a=d}else if((v=(l=s.n<0)?f:o.call(i,s))!==y)break}catch(e){a=d,c=1,f=e}finally{u=1}}return{value:v,done:l}}),!0),t;function p(e,t){for(c=e,f=t,v=0;!l&&u&&!n&&v<g.length;v++){var n,r=g[v],o=s.p,i=r[2];3<e?(n=i===t)&&(f=r[(c=r[4])?5:c=3],r[4]=r[5]=d):r[0]<=o&&((n=e<2&&o<r[1])?(c=0,s.v=t,s.n=r[1]):o<i&&(n=e<3||r[0]>t||i<t)&&(r[4]=e,r[5]=t,s.n=i,c=0))}if(n||1<e)return y;throw l=!0,t}}var y={};function _(){}function o(){}function i(){}var v=Object.getPrototypeOf,e=[][t]?v(v([][t]())):(_regeneratorDefine2(v={},t,function(){return this}),v),a=i.prototype=_.prototype=Object.create(e);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,_regeneratorDefine2(e,n,"GeneratorFunction")),e.prototype=Object.create(a),e}return _regeneratorDefine2(a,"constructor",o.prototype=i),_regeneratorDefine2(i,"constructor",o),_regeneratorDefine2(i,n,o.displayName="GeneratorFunction"),_regeneratorDefine2(a),_regeneratorDefine2(a,n,"Generator"),_regeneratorDefine2(a,t,function(){return this}),_regeneratorDefine2(a,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:r,m:c}})()}function _regeneratorDefine2(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}(_regeneratorDefine2=function(e,t,n,r){t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:((r=function(t,n){_regeneratorDefine2(e,t,function(e){return this._invoke(t,n,e)})})("next",0),r("throw",1),r("return",2))})(e,t,n,r)}function asyncGeneratorStep(e,t,n,r,o,i,a){try{var c=e[i](a),f=c.value}catch(e){return void n(e)}c.done?t(f):Promise.resolve(f).then(r,o)}function _asyncToGenerator(c){return function(){var e=this,a=arguments;return new Promise(function(t,n){var r=c.apply(e,a);function o(e){asyncGeneratorStep(r,t,n,o,i,"next",e)}function i(e){asyncGeneratorStep(r,t,n,o,i,"throw",e)}o(void 0)})}}(()=>{function e(t,n){var e,r,o=this;function i(){return(i=_asyncToGenerator(_regenerator().m(function e(){return _regenerator().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,n.getConfigModel(o.config);case 1:o.categoriesConfig=e.v,t.$apply();case 2:return e.a(2)}},e)}))).apply(this,arguments)}_.assign(o,{$doCheck:function(){_.isEqual(e,o.config.device)||(e=o.config.device,function(){i.apply(this,arguments)}());_.isEqual(r,o.categoriesConfig)||(r=_.cloneDeep(o.categoriesConfig),(()=>{var e;if(r)return e=n.isAtLeastOneElementSelected(r),o.modbusWidgetConfigForm.modbusWidgetValidation.$setValidity("at-least-one-field-selected",e),o.atLeastOneElementSelected=e})()&&n.updateConfigModel(o.config,r))}})}e.$inject=["$rootScope","modbusWidgetSvc"],angular.module("c8y.modbusWidget4").component("c8yModbusWidgetConfig",{templateUrl:":::PLUGIN_PATH:::/widget-config.html",bindings:{config:"<"},controllerAs:"vm",controller:e})})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1022.3.2",
3
+ "version": "1022.4.3",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",