@c8y/ng1-modules 1021.22.157 → 1021.22.158

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 _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a,o,l=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=a.call(n)).done)&&(l.push(i.value),l.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(s)throw r}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}(()=>{function e(v,A,w,T,I,N,$){return{link:function(n){var o=[],i="c8y_Position",r=g,a=b,l=[];function e(){l.length=0,o.length=0,n.deviceId?c(n.deviceId):d()}function c(e){A.detail(e).then(I.getResData).then(t)}function t(e){l.push(e),n.multipleDevices?(e=n.deviceId,v.all([A.childDevices(e),A.childAssets(e)]).then(_.flattenDeep).then(s)):d(u(l))}function s(e){d(u(_.union(l,e)))}function u(e){return _.map(_.filter(e,function(e){return!N.isGroup(e)}),"id")}function d(e){var t={},e=e&&e.length?(t.ids=e.join(","),A.list(t)):A.list({fragmentType:i});e.then(f).then(g)}function f(e){return n.withPosition=_.filter(e,p),_.filter(_.map(n.withPosition,b),_.identity)}function m(){n.realtimeAnimation=!1}function h(e,t){w.addListener(n.$id,n.realtimeChannel,e,t)}function y(e,t){p(t)&&(a(t),r())}function p(e){return e[i]}function g(e){e&&e.length&&_.forEach(e,function(e){o.push(e)}),n.withPosition.length&&T.getMap("c8y-map-".concat(n.$id)).then(function(e){e.fitBounds(o,{padding:[50,50]})})}function b(e){var t,n=p(e),i=_.cloneDeep(n||{}),r=null,a=_.find(o,{id:e.id});return a?(n.lat=Number(n.lat),a.lat=n.lat,n.lng=Number(n.lng),a.lng=n.lng):(n.lat=Number(n.lat),i.lat=n.lat,n.lng=Number(n.lng),i.lng=n.lng,n&&_.isNumber(n.lat)&&_.isNumber(n.lng)&&!_.isNaN(_.toNumber(n.lat))&&!_.isNaN(_.toNumber(n.lng))&&(i.id=e.id,i.message='\n <a\n class="btn btn-link"\n style="width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"\n href="#/device/'.concat((a=e).id,'"\n title="').concat(a.name,'"\n >\n ').concat(a.name,"\n </a>\n "),i.icon={className:"".concat((t=e.c8y_ActiveAlarmsStatus||{},_.find(["critical","major","minor","warning"],function(e){return t[e]})||"normal"),"-marker-icon"),iconSize:[25,41],iconAnchor:[12,41],type:"div"},r=i)),r}n.$watch("deviceId",function(e,t){e&&e!==t&&(l=[],o.length=0,c(e))}),n.markers=o,n.mapDefault={scrollWheelZoom:!1},n.cssToHide=function(){return n.withPosition&&n.withPosition.length?{}:{visibility:"hidden"}},n.paging={refresh:!0},n.realtime||(n.refresh=e),v.all([$.listByUser(),T.getMap("c8y-map-".concat(n.$id))]).then(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1];_.some(t,{contextPath:"openseamap"})&&(t=L.tileLayer("/apps/openseamap/{z}/{x}/{y}.png"),L.control.layers({},{openseamap:t}).addTo(e))}),n.realtimeChannel="/managedobjects/*",h("".concat(n.$id,"-subscribed"),m),h("UPDATE",y),n.realtime&&(n.$on("$destroy",function(){w.stop(n.$id,n.realtimeChannel)}),w.start(n.$id,n.realtimeChannel)),e()},restrict:"E",scope:{deviceId:"=?",multipleDevices:"=",cssClass:"@",width:"=?",height:"=?",config:"=",realtime:"="},templateUrl:":::PLUGIN_PATH:::/ui/views/map.html"}}e.$inject=["$q","c8yInventory","c8yRealtime","leafletData","c8yBase","c8yGroups","c8yApplication"],angular.module("c8y.ui").directive("c8yMap",e)})();
1
+ function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a,o,l=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=a.call(n)).done)&&(l.push(i.value),l.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(s)throw r}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}(()=>{function e(v,A,w,T,I,N,$){return{link:function(n){var o=[],i="c8y_Position",r=g,a=b,l=[];function e(){l.length=0,o.length=0,n.deviceId?c(n.deviceId):d()}function c(e){A.detail(e).then(I.getResData).then(t)}function t(e){l.push(e),n.multipleDevices?(e=n.deviceId,v.all([A.childDevices(e),A.childAssets(e)]).then(_.flattenDeep).then(s)):d(u(l))}function s(e){d(u(_.union(l,e)))}function u(e){return _.map(_.filter(e,function(e){return!N.isGroup(e)}),"id")}function d(e){var t={},e=e&&e.length?(t.ids=e.join(","),A.list(t)):A.list({fragmentType:i});e.then(f).then(g)}function f(e){return n.withPosition=_.filter(e,p),_.filter(_.map(n.withPosition,b),_.identity)}function m(){n.realtimeAnimation=!1}function h(e,t){w.addListener(n.$id,n.realtimeChannel,e,t)}function y(e,t){p(t)&&(a(t),r())}function p(e){return e[i]}function g(e){e&&e.length&&_.forEach(e,function(e){o.push(e)}),n.withPosition.length&&T.getMap("c8y-map-".concat(n.$id)).then(function(e){e.fitBounds(o,{padding:[50,50]})})}function b(e){var t,n=p(e),i=_.cloneDeep(n||{}),r=null,a=_.find(o,{id:e.id});return a?(n.lat=Number(n.lat),a.lat=n.lat,n.lng=Number(n.lng),a.lng=n.lng):(n.lat=Number(n.lat),i.lat=n.lat,n.lng=Number(n.lng),i.lng=n.lng,n&&_.isNumber(n.lat)&&_.isNumber(n.lng)&&!_.isNaN(_.toNumber(n.lat))&&!_.isNaN(_.toNumber(n.lng))&&(i.id=e.id,i.message='\n <a\n class="btn btn-link"\n style="width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"\n href="#/device/'.concat((a=e).id,'"\n title="').concat(a.name,'"\n >\n ').concat(a.name,"\n </a>\n "),i.icon={className:"".concat((t=e.c8y_ActiveAlarmsStatus||{},_.find(["critical","major","minor","warning"],function(e){return t[e]})||"normal"),"-marker-icon"),iconSize:[25,41],iconAnchor:[12,41],type:"div"},r=i)),r}n.$watch("deviceId",function(e,t){e&&e!==t&&(l=[],o.length=0,c(e))}),n.markers=o,n.mapDefault={scrollWheelZoom:!1,tileLayerOptions:{referrerPolicy:"strict-origin-when-cross-origin"}},n.cssToHide=function(){return n.withPosition&&n.withPosition.length?{}:{visibility:"hidden"}},n.paging={refresh:!0},n.realtime||(n.refresh=e),v.all([$.listByUser(),T.getMap("c8y-map-".concat(n.$id))]).then(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1];_.some(t,{contextPath:"openseamap"})&&(t=L.tileLayer("/apps/openseamap/{z}/{x}/{y}.png"),L.control.layers({},{openseamap:t}).addTo(e))}),n.realtimeChannel="/managedobjects/*",h("".concat(n.$id,"-subscribed"),m),h("UPDATE",y),n.realtime&&(n.$on("$destroy",function(){w.stop(n.$id,n.realtimeChannel)}),w.start(n.$id,n.realtimeChannel)),e()},restrict:"E",scope:{deviceId:"=?",multipleDevices:"=",cssClass:"@",width:"=?",height:"=?",config:"=",realtime:"="},templateUrl:":::PLUGIN_PATH:::/ui/views/map.html"}}e.$inject=["$q","c8yInventory","c8yRealtime","leafletData","c8yBase","c8yGroups","c8yApplication"],angular.module("c8y.ui").directive("c8yMap",e)})();
@@ -15,7 +15,7 @@
15
15
  id="c8y-map-{{ $id }}"
16
16
  markers="markers"
17
17
  center="config.centerPoint"
18
- defaults="mapDefaults"
18
+ defaults="mapDefault"
19
19
  ng-class="cssClass"
20
20
  ></leaflet>
21
21
  </div>
@@ -1 +1 @@
1
- (()=>{function e(e,n,l,t,a,o,c){var r,g=new t.Bounds,s=[],i={type:"polygon",stroke:!0,weight:1,color:"#2e3974",fillColor:"#2e3974",latlngs:[]},d={center:{},events:{},defaults:{doubleClickZoom:!1},bounds:g.get(),markers:s,paths:{geofencePath:i}};function f(e){e&&(d.center=_.assign(d.center,{lat:Number(e.lat),lng:Number(e.lng),zoom:17}))}function u(){0<i.latlngs.length&&(g.reset(),_.forEach(i.latlngs,function(e){g.add(e)}),d.bounds=g.get())}function h(){i.latlngs.length=0,s.length=0}function m(e,n){switch(e.name){case"leafletDirectiveMarker.dragstart":r={lat:n.model.lat,lng:n.model.lng,draggable:!0};break;case"leafletDirectiveMarker.dragend":i.latlngs[_.findIndex(i.latlngs,r)]={lat:n.model.lat,lng:n.model.lng,draggable:!0}}}e.gotoAddress=function(e){t.geoCode(e).then(function(e){e=_.get(e,"data[0]");return e?(e.lng=e.lon,e):(o.warning(c("Address could not be found.")),null)}).then(f)},e.centerMap=u,e.clearGeofence=h,e.chooseGeofence=function(){var e;n.close((e=i.latlngs,_.map(e,function(e){return{lat:e.lat,lng:e.lng}})))},e.cancel=n.dismiss,e.map=d,e.$on("leafletDirectiveMap.click",function(e,n){n={lat:n.leafletEvent.latlng.lat,lng:n.leafletEvent.latlng.lng,draggable:!0,icon:{type:"div",className:"normal-marker-icon",iconSize:[25,41],iconAnchor:[12.5,41]}},d.markers.push(n),i.latlngs.push(n),1===i.latlngs.length&&(d.paths={geofencePath:i})}),e.$on("leafletDirectiveMarker.dragend",m),e.$on("leafletDirectiveMarker.dragstart",m),h(),_.forEach(a,function(e){e.draggable=!0,e.icon={type:"div",className:"normal-marker-icon",iconSize:[25,41],iconAnchor:[12.5,41]},s.push(e),i.latlngs.push(e)}),0<i.latlngs.length?d.paths={geofencePath:i}:d.paths={},l(u,0)}e.$inject=["$scope","$uibModalInstance","$timeout","c8yGeo","geofenceLatLngs","c8yAlert","gettext"],angular.module("c8y.cockpit.map").controller("GeofenceEditCtrl",e)})();
1
+ (()=>{function e(e,n,t,l,a,o,r){var c,g=new l.Bounds,i=[],s={type:"polygon",stroke:!0,weight:1,color:"#2e3974",fillColor:"#2e3974",latlngs:[]},d={center:{},events:{},defaults:{tileLayerOptions:{referrerPolicy:"strict-origin-when-cross-origin"},doubleClickZoom:!1},bounds:g.get(),markers:i,paths:{geofencePath:s}};function f(e){e&&(d.center=_.assign(d.center,{lat:Number(e.lat),lng:Number(e.lng),zoom:17}))}function u(){0<s.latlngs.length&&(g.reset(),_.forEach(s.latlngs,function(e){g.add(e)}),d.bounds=g.get())}function h(){s.latlngs.length=0,i.length=0}function m(e,n){switch(e.name){case"leafletDirectiveMarker.dragstart":c={lat:n.model.lat,lng:n.model.lng,draggable:!0};break;case"leafletDirectiveMarker.dragend":s.latlngs[_.findIndex(s.latlngs,c)]={lat:n.model.lat,lng:n.model.lng,draggable:!0}}}e.gotoAddress=function(e){l.geoCode(e).then(function(e){e=_.get(e,"data[0]");return e?(e.lng=e.lon,e):(o.warning(r("Address could not be found.")),null)}).then(f)},e.centerMap=u,e.clearGeofence=h,e.chooseGeofence=function(){var e;n.close((e=s.latlngs,_.map(e,function(e){return{lat:e.lat,lng:e.lng}})))},e.cancel=n.dismiss,e.map=d,e.$on("leafletDirectiveMap.click",function(e,n){n={lat:n.leafletEvent.latlng.lat,lng:n.leafletEvent.latlng.lng,draggable:!0,icon:{type:"div",className:"normal-marker-icon",iconSize:[25,41],iconAnchor:[12.5,41]}},d.markers.push(n),s.latlngs.push(n),1===s.latlngs.length&&(d.paths={geofencePath:s})}),e.$on("leafletDirectiveMarker.dragend",m),e.$on("leafletDirectiveMarker.dragstart",m),h(),_.forEach(a,function(e){e.draggable=!0,e.icon={type:"div",className:"normal-marker-icon",iconSize:[25,41],iconAnchor:[12.5,41]},i.push(e),s.latlngs.push(e)}),0<s.latlngs.length?d.paths={geofencePath:s}:d.paths={},t(u,0)}e.$inject=["$scope","$uibModalInstance","$timeout","c8yGeo","geofenceLatLngs","c8yAlert","gettext"],angular.module("c8y.cockpit.map").controller("GeofenceEditCtrl",e)})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1021.22.157",
3
+ "version": "1021.22.158",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",
@@ -1 +1 @@
1
- angular.module("c8y.smartRules").directive("smartRuleParamInputGeofence",function(){return{require:"smartRuleParamInput",scope:{rule:"=",param:"="},restrict:"E",templateUrl:":::PLUGIN_PATH:::/views/paramInputGeofence.html",controller:["$scope","c8yGeo","geofenceSvc",function(t,e,n){var o={type:"polygon",stroke:!0,weight:1,color:"#2e3974",fillColor:"#2e3974",latlngs:[]},r=new e.Bounds,a={center:{},bounds:r.get(),paths:{geofence:o}};function l(e){t.rule.config[t.param.property]=e,o.latlngs.length=0,_.forEach(e,function(e){o.latlngs.push(e),r.add(e)}),a.bounds=r.get(),0<o.latlngs.length?a.paths={geofence:o}:a.paths={}}t.map=a,t.editGeofence=function(){n.showEditUI(o.latlngs).then(function(e){l(e)})},l(t.rule.config[t.param.property])}]}});
1
+ angular.module("c8y.smartRules").directive("smartRuleParamInputGeofence",function(){return{require:"smartRuleParamInput",scope:{rule:"=",param:"="},restrict:"E",templateUrl:":::PLUGIN_PATH:::/views/paramInputGeofence.html",controller:["$scope","c8yGeo","geofenceSvc",function(t,e,o){var n={type:"polygon",stroke:!0,weight:1,color:"#2e3974",fillColor:"#2e3974",latlngs:[]},r=new e.Bounds,l={center:{},bounds:r.get(),paths:{geofence:n},defaults:{zoomControl:!1,scrollWheelZoom:!1,tileLayerOptions:{referrerPolicy:"strict-origin-when-cross-origin"}}};function a(e){t.rule.config[t.param.property]=e,n.latlngs.length=0,_.forEach(e,function(e){n.latlngs.push(e),r.add(e)}),l.bounds=r.get(),0<n.latlngs.length?l.paths={geofence:n}:l.paths={}}t.map=l,t.editGeofence=function(){o.showEditUI(n.latlngs).then(function(e){a(e)})},a(t.rule.config[t.param.property])}]}});
@@ -5,7 +5,7 @@
5
5
  paths="map.paths"
6
6
  width="100%"
7
7
  height="260"
8
- defaults="{zoomControl:false, scrollWheelZoom:false}"
8
+ defaults="map.defaults"
9
9
  ></leaflet>
10
10
  <button
11
11
  class="p-relative btn btn-default btn-block property-{{ param.property }}"