myems/admin/js/jcui/angular.integralui.min.js

41 lines
14 KiB
Python

/*
filename: angular.integralui.min.js
version : 4.1.377
Copyright © 2014-2018 Lidor Systems. All rights reserved.
This file is part of the "IntegralUI" Library.
The contents of this file are subject to the IntegralUI Studio for Web License, and may not be used except in compliance with the License.
A copy of the License should have been installed in the product's root installation directory or it can be found at
http://www.lidorsystems.com/products/web/studio/license-agreement.aspx.
This SOFTWARE is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language
governing rights and limitations under the License. Any infringement will be prosecuted under applicable laws.
*/
angular.module("integralui",[]).directive("iuiDragScroll",["$window","$interval",function(g,d){return{restrict:"A",link:function(b,a,e){var c=!1,h=0,m=null,f=.5;a.bind("dragover",function(f){if(a[0].scrollHeight>a[0].clientHeight){var b=f.pageY?f.pageY:f.originalEvent?f.originalEvent.pageY:0,c=a[0].getBoundingClientRect();angular.element(g);b-=angular.element(g)[0].pageYOffset;b<c.top+40?n(f,!1):b>c.bottom-40?n(f,!0):k()}else k()});var n=function(b,n,e,g){c||(h=0,c=!0,m=d(function(){if(1!=b.which)k();
else{var c=e,d=a[0].scrollTop;c||(0===h&&(h=5),h+=5,f+=.5,c=h+=Math.floor(f));d=n?d+c:d-c;a[0].scrollTop=d;(0>=d||a[0].scrollTop.y<d)&&k()}},g?g:100))},k=function(){c&&(m&&(d.cancel(m),m=null),c=!1,h=0,f=.5)}}}}]).directive("iuiTransclude",["$timeout","IntegralUIInternalService",function(g,d){return{link:function(b,a,e){var c=null,h=g(function(){for(var b=a.parent();"body"!==b[0].tagName.toLowerCase();){if(b[0].attributes.name){c=d.getCtrl(b[0].attributes.name.value);break}b=b.parent()}g.cancel(h)},
1);b.$watch(function(){return c?c[e.iuiTransclude]:null},function(b){a.empty();a.append(b)})}}}]).directive("iuiFocus",["$timeout","IntegralUIInternalService",function(g,d){return{restrict:"A",link:function(b,a,e){var c={active:!1};b.$watch(e.iuiFocus,function(a,b){a!=b&&h(a)},!0);var h=function(a){c=a?{active:d.isFieldAvailable(a.active,!1)}:{active:!1};m()},m=function(){if(c&&0!=c.active)var f=g(function(){a[0].focus();g.cancel(f)},1)};h(b.$eval(e.iuiFocus))}}}]).directive("iuiResize",["$window",
"$timeout","$interval","IntegralUIInternalService",function(g,d,b,a){return{restrict:"A",link:function(e,c,h,m){var f=c.parent(),n=angular.element(g),k=getComputedStyle(c[0]).opacity;k=k&&""!=k?k:1;c.css("opacity","0");var t=f[0].offsetWidth,q=f[0].offsetHeight,w=parseInt(getComputedStyle(c[0]).height,10),x=parseInt(getComputedStyle(c[0]).width,10),l=e.$eval(h.iuiResize),u=void 0!=l.delay?l.delay:100,p=function(){if(l=e.$eval(h.iuiResize)){var b=a.isFieldAvailable(l.ref,"window"),k=x,g=w,t=parseInt(a.isFieldAvailable(l.minWidth,
0),10),q=parseInt(a.isFieldAvailable(l.minHeight,0),10),m=parseInt(a.isFieldAvailable(l.maxWidth,9999999),10),p=parseInt(a.isFieldAvailable(l.maxHeight,9999999),10);switch(b){case "parent":var r=a.getPadding(f[0]);b=f[0].clientWidth-(r.left+r.right);r=f[0].clientHeight-(r.top+r.bottom);f&&(l.width&&(k=Math.floor(l.width*b)),l.height&&(g=Math.floor(l.height*r)));break;case "page":l.width&&(k=Math.floor(l.width*n[0].innerWidth));l.height&&(g=Math.floor(l.height*n[0].innerHeight));break;default:l.width&&
(k=Math.floor(l.width*n[0].outerWidth)),l.height&&(g=Math.floor(l.height*n[0].outerHeight))}k<t&&(k=t);k>m&&(k=m);g<q&&(g=q);g>p&&(g=p);c.css("width",k+"px");c.css("height",g+"px");var u=d(function(){e.$apply();d.cancel(u)},1)}},y=d(function(){p();if(0==u)c.css("opacity",k);else var a=k/3,f=b(function(){a>k?(c.css("opacity",k),b.cancel(f)):(c.css("opacity",a/k),a+=k/3)},10);d.cancel(y)},u),v=b(function(){l=e.$eval(h.iuiResize);if("parent"==a.isFieldAvailable(l.ref,"window")&&f[0].offsetWidth!=t||
f[0].offsetHeight!=q)p(),t=f[0].offsetWidth,q=f[0].offsetHeight},u);e.$watch(h.iuiResize,function(a,f){a!=f&&p()},!0);n.bind("resize",function(f){l=e.$eval(h.iuiResize);"parent"!=a.isFieldAvailable(l.ref,"window")&&p()});e.$on("$destroy",function(a){v&&b.cancel(v);n&&n.unbind("resize")})}}}]).directive("iuiClass",function(){return{restrict:"A",link:function(g,d,b){b.$observe("iuiClass",function(a,b){a!=b&&(d.removeAttr("class"),""!=a&&d.addClass(a))})}}}).directive("iuiStyle",function(){return{restrict:"A",
link:function(g,d,b){b.$observe("iuiStyle",function(a,b){if(a!=b){a=a.replace(/\s+/g,"");for(var c=a.split(";"),e=0;e<c.length;e++){var g=c[e].split(":");2==g.length&&d.css(g[0],g[1])}}})}}}).directive("iuiRefreshStyle",function(){return{restrict:"A",link:function(g,d,b){b.$observe("iuiRefreshStyle",function(a,b){if(a!=b){var c=a.split(";");if(0<c.length)if(""!=c[0])for(var e=0;e<c.length;e++){var g=c[e].split(":");2==g.length&&d.css(g[0],g[1])}else d.removeAttr("style")}})}}}).directive("iuiShow",
function(){return{restrict:"A",link:function(g,d,b){b.$observe("iuiShow",function(a,e){a!=e&&("false"!=a?"true"==b.showInline?d.css("display","inline-block"):"true"==b.showDefault?d.css("display","inline"):d.css("display","block"):d.css("display","none"))})}}}).factory("IntegralUIPublicService",function(){var g=null;return{clearTempData:function(){g=null},getTempData:function(){return g},setTempData:function(d){g=d}}}).factory("IntegralUIDataService",function(){return function(g){if(!g)return null;
var d=g,b="id",a="pid",e="items",c="text";this.updateDataFields=function(f){f&&(b=f.id?f.id:"id",a=f.pid?f.pid:"pid",e=f.objects?f.objects:"items",c=f.text?f.text:"text")};this.updateDataFields(d.fields);this.update=function(a){a&&(d=a,this.updateDataFields(d.fields))};var h=angular.isDefined(d.objects);this.clear=function(a,b){var f=this.getList(a);0<f.length&&d.events&&d.events.clear({e:{parent:a}});f.length=0;b&&b(a)};this.insertAt=function(a,b,c,e){this.insert(a,b,c,null,!1,e)};this.insert=function(f,
c,e,g,q,m){h&&!1!==(d.events?d.events.objAdding({e:{obj:f}}):!0)&&f&&(f[a]=e?e[b]:"",g=this.getList(e),0>c||null===c||void 0===c?g.push(f):(c=Math.max(Math.min(c,g.length),0),g.splice(c,0,f)),f[b]||(f[b]=this.getUniqueId()),d.events&&d.events.objAdded({e:{obj:f}}),m&&m(f,c,e))};this.insertByRef=function(a,b,c,e){if(h&&a&&b){var f=this.getParent(b),d=this.getList(f);d=this.getIndexOf(b,d);c&&(d+=1);this.insert(a,d,f,b,c,e);return d}};this.removeAt=function(b,c,e,g){if(h){if(b){e=this.getParent(b);
var f=this.getList(e);c=this.getIndexOf(b,f)}if(null===c||void 0===c)return!1;f=this.getList(e);if(0<=c&&c<f.length&&(b=f[c],!1!==(d.events?d.events.objRemoving({e:{obj:b}}):!0)))return b[a]="",f.splice(c,1),d.events&&d.events.objRemoved({e:{obj:b}}),g&&g(b,f,c,e),!0}return!1};this.isIndexinRange=function(a){return h&&0<=a&&a<d.objects.length?!0:!1};this.moveObject=function(a,b){h&&this.isIndexinRange(a)&&this.isIndexinRange(b)&&d.objects.splice(b,0,d.objects.splice(a,1)[0])};this.getNewIndex=function(a,
b,c){if(h&&a&&b)return a=this.getParent(b),a=this.getList(a),b=this.getIndexOf(b,a),c&&(b+=1),b};this.getObjectByIndex=function(a){return h&&this.isIndexinRange(a)?d.objects[a]:null};this.findObjectById=function(a){return a?m(d.objects,a):null};this.findObjectByText=function(a){return a?m(d.objects,a,"text"):null};var m=function(a,d,g){var f=null;if(a&&d)for(var h=0,n=!1;!f&&h<a.length;){switch(g){case "text":a[h][c]&&(n=a[h][c].toString()===d.toString());break;default:a[h][b]&&(n=a[h][b].toString()===
d.toString())}f=n?a[h]:m(a[h][e],d,g);h++}return f};this.getIndexOf=function(a,c){var f=-1;c||(c=this.getList());if(a&&c)for(var e=0;e<c.length;e++)if(c[e][b]&&a[b]&&c[e][b].toString()===a[b].toString()){f=e;break}return f};this.getList=function(a){return a?(a[e]||(a[e]=[]),a[e]):d.objects};this.findParent=function(c,d){var f=null;if(c&&d)for(var g=0;!f&&g<d.length;)f=d[g][b]&&c[a]&&d[g][b].toString()===c[a].toString()?d[g]:this.findParent(c,d[g][e]),g++;return f};this.getParent=function(a){return a?
this.findParent(a,d.objects):null};this.getUniqueId=function(a){function b(){return(65536*(1+Math.random())|0).toString(16).substring(1)}a=a||"-";return b()+b()+a+b()+a+b()+a+b()+a+b()+b()+b()}}}).factory("IntegralUIDragDrop",function(){var g={dropPos:-1,source:null,sourceCtrl:null,sourceCollection:null,sourceIndex:-1,target:null,type:""},d=function(b,a,e){return b>=e.left&&b<=e.right&&a>=e.top&&a<=e.bottom?!0:!1};return{clearData:function(){g={dropPos:-1,source:null,sourceCtrl:null,sourceCollection:null,
sourceIndex:-1,target:null,type:""}},getData:function(){return g},setData:function(b){b&&(isNaN(b.dropPos)||(g.dropPos=b.dropPos),b.source&&(g.source=b.source),b.sourceCtrl&&(g.sourceCtrl=b.sourceCtrl),b.sourceCollection&&(g.sourceCollection=b.sourceCollection),isNaN(b.sourceIndex)||(g.sourceIndex=b.sourceIndex),b.target&&(g.target=b.target),b.type&&(g.type=b.type))},hitTest:function(b,a,e){return d(b,a,e)},getDropPos:function(b,a,e,c){if(e)a:{e={left:a.x,top:a.y,right:a.x+a.width,bottom:a.y+a.height};
if("horizontal"===c){e.right=a.x+a.width/2;if(d(b.x,b.y,e)){b=1;break a}e.left=e.right;e.right=a.x+a.width}else{e.bottom=a.y+a.height/2;if(d(b.x,b.y,e)){b=1;break a}e.top=e.bottom;e.bottom=a.y+a.height}b=d(b.x,b.y,e)?2:-1}else"horizontal"===c?(c={left:a.x+a.width/4,top:a.y,right:a.x+3*a.width/4,bottom:a.y+a.height},d(b.x,b.y,c)?b=0:(c.right=c.left,c.left=a.x,d(b.x,b.y,c)?b=1:(c.left=a.x+3*a.width/4,c.right=a.x+a.width,b=d(b.x,b.y,c)?2:-1))):(c={left:a.x,top:a.y+a.height/4,right:a.x+a.width,bottom:a.y+
3*a.height/4},d(b.x,b.y,c)?b=0:(c.bottom=c.top,c.top=a.y,d(b.x,b.y,c)?b=1:(c.top=a.y+3*a.height/4,c.bottom=a.y+a.height,b=d(b.x,b.y,c)?2:-1)));return b}}}).factory("IntegralUIInternalService",["$rootScope","$window",function(g,d){var b=null;return{getCtrl:function(a){g.$broadcast(a+"-get-ctrl");a=this.getTempData();this.clearTempData();return a?a:null},getUniqueId:function(a,b){function c(){return(65536*(1+Math.random())|0).toString(16).substring(1)}var e=b||"-";e=c()+c()+e+c()+e+c()+e+c()+e+c()+
c()+c();a&&(e=e.substring(0,a));return e},isBoolean:function(a){return a?"boolean"==typeof a:!1},isEnabled:function(a){return a||void 0===a?!0:!1},isEqual:function(a,b){return a&&b?a.toString()===b.toString():!1},isFieldAvailable:function(a,b){return void 0!=a?a:b},isImage:function(a){return a?a instanceof HTMLImageElement:!1},isNumber:function(a){return a?"number"==typeof a:!1},isObject:function(a){return a?"object"==typeof a&&null!=a&&!Array.isArray(a):!1},isPercent:function(a){return a&&(a=a.toString(),
"%"==a.substring(a.length-1))?!0:!1},isSelected:function(a){return a&&a.selected?!0:!1},isString:function(a){return a?"string"==typeof a||a instanceof String:!1},isVisible:function(a){return a||void 0===a?!0:!1},clearTempData:function(){b=null},getTempData:function(){return b},setTempData:function(a){b=a},getBodyElem:function(a){for(var b=null,c=document.getElementsByTagName("body")[0];a;){if(a===c){b=a;break}a=a.offsetParent}return!a&&c?c:b},checkHit:function(a,b,c){return a>=c.left&&a<=c.right&&
b>=c.top&&b<=c.bottom?!0:!1},getBorderWidth:function(a){return a?{top:getComputedStyle(a)["border-top-width"]?parseInt(getComputedStyle(a)["border-top-width"],10):getComputedStyle(a).borderTopWidth?parseInt(getComputedStyle(a).borderTopWidth,10):0,right:getComputedStyle(a)["border-right-width"]?parseInt(getComputedStyle(a)["border-right-width"],10):getComputedStyle(a).borderRightWidth?parseInt(getComputedStyle(a).borderRightWidth,10):0,bottom:getComputedStyle(a)["border-bottom-width"]?parseInt(getComputedStyle(a)["border-bottom-width"],
10):getComputedStyle(a).borderTopWidth?parseInt(getComputedStyle(a).borderTopWidth,10):0,left:getComputedStyle(a)["border-left-width"]?parseInt(getComputedStyle(a)["border-left-width"],10):getComputedStyle(a).borderLeftWidth?parseInt(getComputedStyle(a).borderLeftWidth,10):0}:{top:0,right:0,bottom:0,left:0}},getMargin:function(a){return a?{top:getComputedStyle(a)["margin-top"]?parseInt(getComputedStyle(a)["margin-top"],10):getComputedStyle(a).marginTop?parseInt(getComputedStyle(a).marginTop,10):0,
right:getComputedStyle(a)["margin-right"]?parseInt(getComputedStyle(a)["margin-right"],10):getComputedStyle(a).marginRight?parseInt(getComputedStyle(a).marginRight,10):0,bottom:getComputedStyle(a)["margin-bottom"]?parseInt(getComputedStyle(a)["margin-bottom"],10):getComputedStyle(a).marginBottom?parseInt(getComputedStyle(a).marginBottom,10):0,left:getComputedStyle(a)["margin-left"]?parseInt(getComputedStyle(a)["margin-left"],10):getComputedStyle(a).marginLeft?parseInt(getComputedStyle(a).marginLeft,
10):0}:{top:0,right:0,bottom:0,left:0}},getPadding:function(a){return a?{top:getComputedStyle(a)["padding-top"]?parseInt(getComputedStyle(a)["padding-top"],10):getComputedStyle(a).paddingTop?parseInt(getComputedStyle(a).paddingTop,10):0,right:getComputedStyle(a)["padding-right"]?parseInt(getComputedStyle(a)["padding-right"],10):getComputedStyle(a).paddingRight?parseInt(getComputedStyle(a).paddingRight,10):0,bottom:getComputedStyle(a)["padding-bottom"]?parseInt(getComputedStyle(a)["padding-bottom"],
10):getComputedStyle(a).paddingBottom?parseInt(getComputedStyle(a).paddingBottom,10):0,left:getComputedStyle(a)["padding-left"]?parseInt(getComputedStyle(a)["padding-left"],10):getComputedStyle(a).paddingLeft?parseInt(getComputedStyle(a).paddingLeft,10):0}:{top:0,right:0,bottom:0,left:0}},getMousePos:function(a){return{x:a.pageX?a.pageX:a.originalEvent?a.originalEvent.pageX:0,y:a.pageY?a.pageY:a.originalEvent?a.originalEvent.pageY:0}},getClientMousePos:function(a,b){if(a&&b){b=angular.element(b);
var c=b[0].getBoundingClientRect(),e=angular.element(d)[0].pageXOffset,g=angular.element(d)[0].pageYOffset,f=this.getMousePos(a);f.x-=c.left+e;f.y-=c.top+g;return f}return{x:0,y:0}},getPageRect:function(a){if(a){a=angular.element(a);a=a[0].getBoundingClientRect();var b=angular.element(d)[0].pageXOffset,c=angular.element(d)[0].pageYOffset;a.left-=b;a.top-=c;a.right=a.left+a.width;a.bottom=a.top+a.height;return a}return{x:0,y:0,left:0,top:0,right:0,bottom:0,width:0,height:0}},getTouchData:function(a){return a.changedTouches?
a.changedTouches:a.originalEvent?a.originalEvent.changedTouches:null}}}]);