template.js.base.selectable.min.js Maven / Gradle / Ivy
'use strict';(function(e){"function"===typeof define&&define.amd?define(["jquery","./mouse","../version","../widget"],e):e(jQuery)})(function(e){return e.widget("ui.selectable",e.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var b=this;this._addClass("ui-selectable");this.dragged=!1;this.refresh=function(){b.elementPos=e(b.element[0]).offset();
b.selectees=e(b.options.filter,b.element[0]);b._addClass(b.selectees,"ui-selectee");b.selectees.each(function(){var d=e(this),a=d.offset(),l=a.left-b.elementPos.left,a=a.top-b.elementPos.top;e.data(this,"selectable-item",{element:this,$element:d,left:l,top:a,right:l+d.outerWidth(),bottom:a+d.outerHeight(),startselected:!1,selected:d.hasClass("ui-selected"),selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this._mouseInit();this.helper=e("\x3cdiv\x3e");
this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item");this._mouseDestroy()},_mouseStart:function(b){var d=this,a=this.options;this.opos=[b.pageX,b.pageY];this.elementPos=e(this.element[0]).offset();this.options.disabled||(this.selectees=e(a.filter,this.element[0]),this._trigger("start",b),e(a.appendTo).append(this.helper),this.helper.css({left:b.pageX,top:b.pageY,width:0,height:0}),a.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var a=
e.data(this,"selectable-item");a.startselected=!0;b.metaKey||b.ctrlKey||(d._removeClass(a.$element,"ui-selected"),a.selected=!1,d._addClass(a.$element,"ui-unselecting"),a.unselecting=!0,d._trigger("unselecting",b,{unselecting:a.element}))}),e(b.target).parents().addBack().each(function(){var a,f=e.data(this,"selectable-item");if(f)return a=!b.metaKey&&!b.ctrlKey||!f.$element.hasClass("ui-selected"),d._removeClass(f.$element,a?"ui-unselecting":"ui-selected")._addClass(f.$element,a?"ui-selecting":"ui-unselecting"),
f.unselecting=!a,f.selecting=a,(f.selected=a)?d._trigger("selecting",b,{selecting:f.element}):d._trigger("unselecting",b,{unselecting:f.element}),!1}))},_mouseDrag:function(b){this.dragged=!0;if(!this.options.disabled){var d,a=this,l=this.options,f=this.opos[0],g=this.opos[1],h=b.pageX,k=b.pageY;f>h&&(d=h,h=f,f=d);g>k&&(d=k,k=g,g=d);this.helper.css({left:f,top:g,width:h-f,height:k-g});this.selectees.each(function(){var c=e.data(this,"selectable-item"),d=!1,m,n,p,q;c&&c.element!==a.element[0]&&(m=
c.left+a.elementPos.left,n=c.right+a.elementPos.left,p=c.top+a.elementPos.top,q=c.bottom+a.elementPos.top,"touch"===l.tolerance?d=!(m>h||nk||qf&&ng&&q
© 2015 - 2024 Weber Informatics LLC | Privacy Policy