UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

3 lines (2 loc) 17.1 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("kendo.core.js")):"function"==typeof define&&define.amd?define(["exports","kendo.core.min"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Fx={}))}(this,(function(e){!function(e){let t=window.kendo,i=t.effects,n=e.each,r=e.extend,s=t.support,o=/matrix3?d?\s*\(.*,\s*([\d\.\-]+)\w*?,\s*([\d\.\-]+)\w*?,\s*([\d\.\-]+)\w*?,\s*([\d\.\-]+)\w*?/i,a=/translatex?$/i,c=/(zoom|fade|expand)(\w+)/,l=/(zoom|fade|expand)/,d=["perspective","rotate","rotatex","rotatey","rotatez","rotate3d","scale","scalex","scaley","scalez","scale3d","skew","skewx","skewy","translate","translatex","translatey","translatez","translate3d","matrix","matrix3d"],u=["rotate","scale","scalex","scaley","skew","skewx","skewy","translate","translatex","translatey","matrix"],f=Math.round,h="px",p="auto",v="width",m="height",_="hidden",x="origin",g="abortId",y="overflow",k="position",b="completeCallback",w="transitionend",C="transition",P="transform",z="perspective",E="1500px",T="perspective("+E+")",R={left:{reverse:"right",property:"left",transition:"translatex",vertical:!1,modifier:-1},right:{reverse:"left",property:"left",transition:"translatex",vertical:!1,modifier:1},down:{reverse:"up",property:"top",transition:"translatey",vertical:!0,modifier:1},up:{reverse:"down",property:"top",transition:"translatey",vertical:!0,modifier:-1},top:{reverse:"bottom"},bottom:{reverse:"top"},in:{reverse:"out",modifier:-1},out:{reverse:"in",modifier:1},vertical:{reverse:"vertical"},horizontal:{reverse:"horizontal"}};function H(e){return parseInt(e,10)}function D(e,t){var i,n,r,o,a=[],c={};for(n in t)i=n.toLowerCase(),o=-1!=d.indexOf(i),!s.hasHW3D&&o&&-1==u.indexOf(i)?delete t[n]:(r=t[n],o?a.push(n+"("+r+")"):c[n]=r);return a.length&&(c[P]=a.join(" ")),c}t.directions=R,r(e.fn,{kendoStop:function(e,t){return i.stopQueue(this,e||!1,t||!1)}}),t.toggleClass=function(e,t,i,s){return t&&(t=t.split(" "),i=r({exclusive:"all",duration:400,ease:"ease-out"},i),e.css(C,i.exclusive+" "+i.duration+"ms "+i.ease),setTimeout((function(){e.css(C,"").css(m)}),i.duration),n(t,(function(t,i){e.toggleClass(i,s)}))),e},t.parseEffects=function(e,t){var i={};return"string"==typeof e?n(e.split(" "),(function(e,n){var r=!l.test(n),s=n.replace(c,(function(e,t,i){return t+":"+i.toLowerCase()})).split(":"),o=s[1],a={};s.length>1&&(a.direction=t&&r?R[o].reverse:o),i[s[0]]=a})):n(e,(function(e){var n=this.direction;n&&t&&!l.test(e)&&(this.direction=R[n].reverse),i[e]=this})),i},r(i,{transition:function(t,i,n){let s,o,a=0,c=t.data("keys")||[];n=r({duration:200,ease:"ease-out",complete:null,exclusive:"all"},n);let l=!1,d=function(){l||(l=!0,o&&(clearTimeout(o),o=null),t.removeData(g).dequeue().css(C,"").css(C),n.complete.call(t))};n.duration=e.fx&&e.fx.speeds[n.duration]||n.duration,s=D(0,i),e.merge(c,function(e){var t=[];for(var i in e)t.push(i);return t}(s)),e.hasOwnProperty("uniqueSort")?t.data("keys",e.uniqueSort(c)).height():t.data("keys",e.unique(c)).height(),t.css(C,n.exclusive+" "+n.duration+"ms "+n.ease).css(C),t.css(s).css(P),t.one(w,d),0!==n.duration&&(a=500),o=setTimeout(d,n.duration+a),t.data(g,o),t.data(b,d)},stopQueue:function(e,i,n){var r,s=e.data("keys"),o=!n&&s,a=e.data(b);return o&&(r=t.getComputedStyles(e[0],s)),a&&a(),o&&e.css(r),e.removeData("keys").stop(i)}});var O=t.Class.extend({init:function(e,t){var i=this;i.element=e,i.effects=[],i.options=t,i.restore=[]},run:function(t){let n,s,o,a,c,l,d=this,u=t.length,f=d.element,h=d.options,p=e.Deferred(),v={},m={};for(d.effects=t,p.done(d.complete.bind(d)),f.data("animating",!0),s=0;s<u;s++)for(n=t[s],n.setReverse(h.reverse),n.setOptions(h),d.addRestoreProperties(n.restore),n.prepare(v,m),c=n.children(),o=0,l=c.length;o<l;o++)c[o].duration(h.duration).run();for(var _ in h.effects)r(m,h.effects[_].properties);for(f.is(":visible")||r(v,{display:f.data("olddisplay")||"block"}),h.reset||(a=f.data("targetTransform"),a&&(v=r(a,v))),v=D(0,v),f.css(v).css(P),s=0;s<u;s++)t[s].setup();return h.init&&h.init(),f.data("targetTransform",m),i.animate(f,m,r({},h,{complete:p.resolve})),p.promise()},stop:function(){e(this.element).kendoStop(!0,!0)},addRestoreProperties:function(e){for(var t,i=this.element,n=0,r=e.length;n<r;n++)t=e[n],this.restore.push(t),i.data(t)||i.data(t,i.css(t))},restoreCallback:function(){for(var e=this.element,t=0,i=this.restore.length;t<i;t++){var n=this.restore[t];e.css(n,e.data(n))}},complete:function(){let e=this,t=0,i=e.element,n=e.options,r=e.effects,s=r.length;for(i.removeData("animating").dequeue(),n.hide&&i.data("olddisplay",i.css("display")).hide(),this.restoreCallback();t<s;t++)r[t].teardown();n.completeCallback&&n.completeCallback(i)}});i.promise=function(e,n){var r,s,o=[],a=new O(e,n),c=t.parseEffects(n.effects);for(var l in n.effects=c,c)(r=i[S(l)])&&(s=new r(e,c[l].direction),o.push(s));o[0]?a.run(o):(e.is(":visible")||e.css({display:e.data("olddisplay")||"block"}).css("display"),n.init&&n.init(),e.dequeue(),a.complete())},r(i,{animate:function(e,t,n){let r=!1!==n.transition;delete n.transition,"transition"in i&&r?i.transition(e,t,n):e.animate(function(e){for(var t in e)-1!=d.indexOf(t)&&-1==u.indexOf(t)&&delete e[t];return e}(t),{queue:!1,show:!1,hide:!1,duration:n.duration,complete:n.complete})}}),i.animatedPromise=i.promise;var I=t.Class.extend({init:function(e,t){var i=this;i.element=e,i._direction=t,i.options={},i._additionalEffects=[],i.restore||(i.restore=[])},reverse:function(){return this._reverse=!0,this.run()},play:function(){return this._reverse=!1,this.run()},add:function(e){return this._additionalEffects.push(e),this},direction:function(e){return this._direction=e,this},duration:function(e){return this._duration=e,this},compositeRun:function(){var e=this,t=new O(e.element,{reverse:e._reverse,duration:e._duration}),i=e._additionalEffects.concat([e]);return t.run(i)},run:function(){if(this._additionalEffects&&this._additionalEffects[0])return this.compositeRun();let t,n,s=this,o=s.element,a=0,c=s.restore,l=c.length,d=e.Deferred(),u={},f={},h=s.children(),p=h.length;for(d.done(s._complete.bind(s)),o.data("animating",!0),a=0;a<l;a++)t=c[a],o.data(t)||o.data(t,o.css(t));for(a=0;a<p;a++)h[a].duration(s._duration).run();return s.prepare(u,f),o.is(":visible")||r(u,{display:o.data("olddisplay")||"block"}),n=o.data("targetTransform"),n&&(u=r(n,u)),u=D(0,u),o.css(u).css(P),s.setup(),o.data("targetTransform",f),i.animate(o,f,{duration:s._duration,complete:d.resolve}),d.promise()},stop:function(){var t=0,i=this.children(),n=i.length;for(t=0;t<n;t++)i[t].stop();return e(this.element).kendoStop(!0,!0),this},restoreCallback:function(){for(var e=this.element,t=0,i=this.restore.length;t<i;t++){var n=this.restore[t];e.css(n,e.data(n))}},_complete:function(){let e=this,t=e.element;t.removeData("animating").dequeue(),e.restoreCallback(),e.shouldHide()&&t.data("olddisplay",t.css("display")).hide(),e.teardown()},setOptions:function(e){r(!0,this.options,e)},children:function(){return[]},shouldHide:e.noop,setup:e.noop,prepare:e.noop,teardown:e.noop,directions:[],setReverse:function(e){return this._reverse=e,this}});function S(e){return e.charAt(0).toUpperCase()+e.substring(1)}function F(e,t){var r=I.extend(t),s=r.prototype.directions;i[S(e)]=r,i.Element.prototype[e]=function(e,t,i,n){return new r(this.element,e,t,i,n)},n(s,(function(t,n){i.Element.prototype[e+S(n)]=function(e,t,i){return new r(this.element,n,e,t,i)}}))}var q=["left","right","up","down"],A=["in","out"];function M(e,t,i,n){F(e,{directions:A,startValue:function(e){return this._startValue=e,this},endValue:function(e){return this._endValue=e,this},shouldHide:function(){return this._shouldHide},prepare:function(e,r){var s,o,a="out"===this._direction,c=this.element.data(t);s=!(isNaN(c)||c==i)?c:void 0!==this._startValue?this._startValue:a?i:n,o=void 0!==this._endValue?this._endValue:a?n:i,this._reverse?(e[t]=o,r[t]=s):(e[t]=s,r[t]=o),this._shouldHide=r[t]===n}})}F("slideIn",{directions:q,divisor:function(e){return this.options.divisor=e,this},prepare:function(e,i){let n,r=this,s=r.element,o=t._outerWidth,a=t._outerHeight,c=R[r._direction],l=-c.modifier*(c.vertical?a(s):o(s))/(r.options&&r.options.divisor||1)+h;r._reverse&&(n=e,e=i,i=n),e[c.transition]=l,i[c.transition]="0px"}}),F("tile",{directions:q,init:function(e,t,i){I.prototype.init.call(this,e,t),this.options={previous:i}},previousDivisor:function(e){return this.options.previousDivisor=e,this},children:function(){var e=this,i=e._reverse,n=e.options.previous,r=e.options.previousDivisor||1,s=e._direction,o=[t.fx(e.element).slideIn(s).setReverse(i)];return n&&o.push(t.fx(n).slideIn(R[s].reverse).divisor(r).setReverse(!i)),o}}),M("fade","opacity",1,0),M("zoom","scale",1,.01),F("slideMargin",{prepare:function(e,t){var i,n=this,r=n.element,s=n.options,o=r.data(x),a=s.offset,c=n._reverse;c||null!==o||r.data(x,parseFloat(r.css("margin-"+s.axis))),i=r.data(x)||0,t["margin-"+s.axis]=c?i:i+a}}),F("slideTo",{prepare:function(e,t){let i=this,n=i.element,r=i.options.offset.split(","),s=i._reverse;t.translatex=s?0:r[0],t.translatey=s?0:r[1],n.css("left")}}),F("expand",{directions:["horizontal","vertical"],restore:[y],prepare:function(e,t){var i=this,n=i.element,r=i.options,s=i._reverse,o="vertical"===i._direction?m:v,a=n[0].style[o],c=n.data(o),l=parseFloat(c||a),d=f(n.css(o,p)[o]());e.overflow=_,l=r&&r.reset?d||l:l||d,t[o]=(s?0:l)+h,e[o]=(s?l:0)+h,undefined===c&&n.data(o,a)},shouldHide:function(){return this._reverse},teardown:function(){var e=this.element,t="vertical"===this._direction?m:v,i=e.data(t);i!=p&&""!==i||setTimeout((function(){e.css(t,p).css(t)}),0)}});var V={position:"absolute",marginLeft:0,marginTop:0,scale:1};F("transfer",{init:function(e,t){this.element=e,this.options={target:t},this.restore=[]},setup:function(){this.element.appendTo(document.body)},prepare:function(e,t){var n=this,s=n.element,c=i.box(s),l=i.box(n.options.target),d=function(e,t){let i=e.css(P);if("none"==i)return"scale"==t?1:0;let n=i.match(new RegExp(t+"\\s*\\(([\\d\\w\\.]+)")),r=0;return n?r=H(n[1]):(n=i.match(o)||[0,0,0,0,0],t=t.toLowerCase(),a.test(t)?r=parseFloat(n[3]/n[2]):"translatey"==t?r=parseFloat(n[4]/n[2]):"scale"==t?r=parseFloat(n[2]):"rotate"==t&&(r=parseFloat(Math.atan2(n[2],n[1])))),r}(s,"scale"),u=i.fillScale(l,c),f=i.transformOrigin(l,c);r(e,V),t.scale=1,s.css(P,"scale(1)").css(P),s.css(P,"scale("+d+")"),e.top=c.top,e.left=c.left,e.transformOrigin=f.x+h+" "+f.y+h,n._reverse?e.scale=u:t.scale=u}});var N={top:"rect(auto auto $size auto)",bottom:"rect($size auto auto auto)",left:"rect(auto $size auto auto)",right:"rect(auto auto auto $size)"},$={top:{start:"rotatex(0deg)",end:"rotatex(180deg)"},bottom:{start:"rotatex(-180deg)",end:"rotatex(0deg)"},left:{start:"rotatey(0deg)",end:"rotatey(-180deg)"},right:{start:"rotatey(180deg)",end:"rotatey(0deg)"}};function j(e,i){var n=e[t.directions[i].vertical?m:v]()/2+"px";return N[i].replace("$size",n)}F("turningPage",{directions:q,init:function(e,t,i){I.prototype.init.call(this,e,t),this._container=i},prepare:function(e,i){var n=this,r=n._reverse,s=r?R[n._direction].reverse:n._direction,o=$[s];e.zIndex=1,n._clipInHalf&&(e.clip=j(n._container,t.directions[s].reverse)),e["backface-visibility"]=_,i[P]=T+(r?o.start:o.end),e[P]=T+(r?o.end:o.start)},setup:function(){this._container.append(this.element)},face:function(e){return this._face=e,this},shouldHide:function(){var e=this._reverse,t=this._face;return e&&!t||!e&&t},clipInHalf:function(e){return this._clipInHalf=e,this},temporary:function(){return this.element.addClass("temp-page"),this}}),F("staticPage",{directions:q,init:function(e,t,i){I.prototype.init.call(this,e,t),this._container=i},restore:["clip"],prepare:function(e,t){var i=this,n=i._reverse?R[i._direction].reverse:i._direction;e.clip=j(i._container,n),e.opacity=.999,t.opacity=1},shouldHide:function(){var e=this._reverse,t=this._face;return e&&!t||!e&&t},face:function(e){return this._face=e,this}}),F("pageturn",{directions:["horizontal","vertical"],init:function(e,t,i,n){I.prototype.init.call(this,e,t),this.options={},this.options.face=i,this.options.back=n},children:function(){var e,i=this,n=i.options,r="horizontal"===i._direction?"left":"top",s=t.directions[r].reverse,o=i._reverse,a=n.face.clone(!0).removeAttr("id"),c=n.back.clone(!0).removeAttr("id"),l=i.element;return o&&(e=r,r=s,s=e),[t.fx(n.face).staticPage(r,l).face(!0).setReverse(o),t.fx(n.back).staticPage(s,l).setReverse(o),t.fx(a).turningPage(r,l).face(!0).clipInHalf(!0).temporary().setReverse(o),t.fx(c).turningPage(s,l).clipInHalf(!0).temporary().setReverse(o)]},prepare:function(e,t){e[z]=E,e.transformStyle="preserve-3d",e.opacity=.999,t.opacity=1},teardown:function(){this.element.find(".temp-page").remove()}}),F("flip",{directions:["horizontal","vertical"],init:function(e,t,i,n){I.prototype.init.call(this,e,t),this.options={},this.options.face=i,this.options.back=n},children:function(){var e,i=this,n=i.options,r="horizontal"===i._direction?"left":"top",s=t.directions[r].reverse,o=i._reverse,a=i.element;return o&&(e=r,r=s,s=e),[t.fx(n.face).turningPage(r,a).face(!0).setReverse(o),t.fx(n.back).turningPage(s,a).setReverse(o)]},prepare:function(e){e[z]=E,e.transformStyle="preserve-3d"}});var L=!s.mobileOS.android;F("replace",{_before:e.noop,_after:e.noop,init:function(t,i,n){I.prototype.init.call(this,t),this._previous=e(i),this._transitionClass=n},duration:function(){throw new Error("The replace effect does not support duration setting; the effect duration may be customized through the transition class rule")},beforeTransition:function(e){return this._before=e,this},afterTransition:function(e){return this._after=e,this},_both:function(){return e().add(this._element).add(this._previous)},_containerClass:function(){var e=this._direction,t="k-fx k-fx-start k-fx-"+this._transitionClass;return e&&(t+=" k-fx-"+e),this._reverse&&(t+=" k-fx-reverse"),t},complete:function(t){if(!(!this.deferred||t&&e(t.target).is(".km-touch-scrollbar, .km-actionsheet-wrapper"))){var i=this.container;i.removeClass("k-fx-end").removeClass(this._containerClass()).off(w,this.completeProxy),this._previous.hide().removeClass("k-fx-current"),this.element.removeClass("k-fx-next"),L&&i.css(y,""),this.isAbsolute||this._both().css(k,""),this.deferred.resolve(),delete this.deferred}},run:function(){if(this._additionalEffects&&this._additionalEffects[0])return this.compositeRun();let i,n=this,r=n.element,s=n._previous,o=r.parents().filter(s.parents()).first(),a=n._both(),c=e.Deferred(),l=r.css(k);return o.length||(o=r.parent()),this.container=o,this.deferred=c,this.isAbsolute="absolute"==l,this.isAbsolute||a.css(k,"absolute"),L&&(i=o.css(y),o.css(y,"hidden")),r.addClass("k-fx-hidden"),o.addClass(this._containerClass()),this.completeProxy=this.complete.bind(this),o.on(w,this.completeProxy),t.animationFrame((function(){r.removeClass("k-fx-hidden").addClass("k-fx-next"),s.css("display","").addClass("k-fx-current"),n._before(s,r),t.animationFrame((function(){o.removeClass("k-fx-start").addClass("k-fx-end"),n._after(s,r)}))})),c.promise()},stop:function(){this.complete()}});var Q=t.Class.extend({init:function(){var e=this;e._tickProxy=e._tick.bind(e),e._started=!1},tick:e.noop,done:e.noop,onEnd:e.noop,onCancel:e.noop,start:function(){this.enabled()&&(this.done()?this.onEnd():(this._started=!0,t.animationFrame(this._tickProxy)))},enabled:function(){return!0},cancel:function(){this._started=!1,this.onCancel()},_tick:function(){var e=this;e._started&&(e.tick(),e.done()?(e._started=!1,e.onEnd()):t.animationFrame(e._tickProxy))}}),W=Q.extend({init:function(e){r(this,e),Q.fn.init.call(this)},done:function(){return this.timePassed()>=this.duration},timePassed:function(){return Math.min(this.duration,new Date-this.startDate)},moveTo:function(e){var t=this,i=t.movable;t.initial=i[t.axis],t.delta=e.location-t.initial,t.duration="number"==typeof e.duration?e.duration:300,t.tick=t._easeProxy(e.ease),t.startDate=new Date,t.start()},_easeProxy:function(e){var t=this;return function(){t.movable.moveAxis(t.axis,e(t.timePassed(),t.initial,t.delta,t.duration))}}});r(W,{easeOutExpo:function(e,t,i,n){return e==n?t+i:i*(1-Math.pow(2,-10*e/n))+t},easeOutBack:function(e,t,i,n,r){return i*((e=e/n-1)*e*(((r=1.70158)+1)*e+r)+1)+t}}),i.Animation=Q,i.Transition=W,i.createEffect=F,i.box=function(i){var n=(i=e(i)).offset();return n.width=t._outerWidth(i),n.height=t._outerHeight(i),n},i.transformOrigin=function(e,t){var i=(e.left-t.left)*t.width/(t.width-e.width),n=(e.top-t.top)*t.height/(t.height-e.height);return{x:isNaN(i)?0:i,y:isNaN(n)?0:n}},i.fillScale=function(e,t){return Math.min(e.width/t.width,e.height/t.height)},i.fitScale=function(e,t){return Math.max(e.width/t.width,e.height/t.height)}}(window.kendo.jQuery);var t=kendo;e.__meta__={id:"fx",name:"Effects",category:"framework",description:"Required for animation effects in all Kendo UI widgets.",depends:["core"]},e.default=t,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=kendo.fx.min.js.map