demo20230512/Scripts/kendo/2014.2.716/kendo.draganddrop.min.js

16 lines
11 KiB
JavaScript
Raw Permalink Normal View History

2023-05-12 10:20:28 +08:00
/**
* Copyright 2014 Telerik AD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
!function(e,define){define(["./kendo.core.min","./kendo.userevents.min"],e)}(function(){return function(e,t){function n(t,n){try{return e.contains(t,n)||t==n}catch(i){return!1}}function i(e,t){return parseInt(e.css(t),10)||0}function r(e,t){return Math.min(Math.max(e,t.min),t.max)}function o(e,t){var n=x(e),r=n.left+i(e,"borderLeftWidth")+i(e,"paddingLeft"),o=n.top+i(e,"borderTopWidth")+i(e,"paddingTop"),a=r+e.width()-t.outerWidth(!0),s=o+e.height()-t.outerHeight(!0);return{x:{min:r,max:a},y:{min:o,max:s}}}function a(e,n,i){for(var r,o,a=0,s=n&&n.length,u=i&&i.length;e&&e.parentNode;){for(a=0;s>a;a++)if(r=n[a],r.element[0]===e)return{target:r,targetElement:e};for(a=0;u>a;a++)if(o=i[a],p.matchesSelector.call(e,o.options.filter))return{target:o,targetElement:e};e=e.parentNode}return t}var s,u,l,c,d,f,h=window.kendo,p=h.support,g=window.document,m=h.Class,v=h.ui.Widget,y=h.Observable,_=h.UserEvents,b=e.proxy,w=e.extend,x=h.getOffset,F={},k={},S={},T=h.elementUnderCursor,M="keyup",C="change",D="dragstart",E="hold",z="drag",O="dragend",A="dragcancel",P="dragenter",N="dragleave",H="drop",R=y.extend({init:function(t,n){var i=this,r=t[0];i.capture=!1,r.addEventListener?(e.each(h.eventMap.down.split(" "),function(){r.addEventListener(this,b(i._press,i),!0)}),e.each(h.eventMap.up.split(" "),function(){r.addEventListener(this,b(i._release,i),!0)})):(e.each(h.eventMap.down.split(" "),function(){r.attachEvent(this,b(i._press,i))}),e.each(h.eventMap.up.split(" "),function(){r.attachEvent(this,b(i._release,i))})),y.fn.init.call(i),i.bind(["press","release"],n||{})},captureNext:function(){this.capture=!0},cancelCapture:function(){this.capture=!1},_press:function(e){var t=this;t.trigger("press"),t.capture&&e.preventDefault()},_release:function(e){var t=this;t.trigger("release"),t.capture&&(e.preventDefault(),t.cancelCapture())}}),I=y.extend({init:function(t){var n=this;y.fn.init.call(n),n.forcedEnabled=!1,e.extend(n,t),n.scale=1,n.horizontal?(n.measure="offsetWidth",n.scrollSize="scrollWidth",n.axis="x"):(n.measure="offsetHeight",n.scrollSize="scrollHeight",n.axis="y")},makeVirtual:function(){e.extend(this,{virtual:!0,forcedEnabled:!0,_virtualMin:0,_virtualMax:0})},virtualSize:function(e,t){(this._virtualMin!==e||this._virtualMax!==t)&&(this._virtualMin=e,this._virtualMax=t,this.update())},outOfBounds:function(e){return e>this.max||this.min>e},forceEnabled:function(){this.forcedEnabled=!0},getSize:function(){return this.container[0][this.measure]},getTotal:function(){return this.element[0][this.scrollSize]},rescale:function(e){this.scale=e},update:function(e){var t=this,n=t.virtual?t._virtualMax:t.getTotal(),i=n*t.scale,r=t.getSize();0!==n&&(t.max=t.virtual?-t._virtualMin:0,t.size=r,t.total=i,t.min=Math.min(t.max,r-i),t.minScale=r/n,t.centerOffset=(i-r)/2,t.enabled=t.forcedEnabled||i>r,e||t.trigger(C,t))}}),B=y.extend({init:function(e){var t=this;y.fn.init.call(t),t.x=new I(w({horizontal:!0},e)),t.y=new I(w({horizontal:!1},e)),t.container=e.container,t.forcedMinScale=e.minScale,t.maxScale=e.maxScale||100,t.bind(C,e)},rescale:function(e){this.x.rescale(e),this.y.rescale(e),this.refresh()},centerCoordinates:function(){return{x:Math.min(0,-this.x.centerOffset),y:Math.min(0,-this.y.centerOffset)}},refresh:function(){var e=this;e.x.update(),e.y.update(),e.enabled=e.x.enabled||e.y.enabled,e.minScale=e.forcedMinScale||Math.min(e.x.minScale,e.y.minScale),e.fitScale=Math.max(e.x.minScale,e.y.minScale),e.trigger(C)}}),q=y.extend({init:function(e){var t=this;w(t,e),y.fn.init.call(t)},outOfBounds:function(){return this.dimension.outOfBounds(this.movable[this.axis])},dragMove:function(e){var t=this,n=t.dimension,i=t.axis,r=t.movable,o=r[i]+e;n.enabled&&((n.min>o&&0>e||o>n.max&&e>0)&&(e*=t.resistance),r.translateAxis(i,e),t.trigger(C,t))}}),L=m.extend({init:function(e){var t,n,i,r,o=this;w(o,{elastic:!0},e),i=o.elastic?.5:0,r=o.movable,o.x=t=new q({axis:"x",dimension:o.dimensions.x,resistance:i,movable:r}),o.y=n=new q({axis:"y",dimension:o.dimensions.y,resistance:i,movable:r}),o.userEvents.bind(["move","end","gesturestart","gesturechange"],{gesturest