kendo.angular.min.js
21.4 KB
/**
* Kendo UI v2016.1.112 (http://www.telerik.com/kendo-ui)
* Copyright 2016 Telerik AD. All rights reserved.
*
* Kendo UI commercial licenses may be obtained at
* http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
!function(e,define){define("kendo.angular.min",["kendo.core.min"],e)}(function(){return function(e,t,n){"use strict";function i(e){var t=V;try{return V=function(e){return e()},e()}finally{V=t}}function o(t,i,o,c,s,k){function h(){var n,k,h,g,b,y,V;return o.kRebind&&(n=e(e(i)[0].cloneNode(!0))),S=a(t,i,o,c,M).options,i.is("select")&&!function(t){if(t.length>0){var n=e(t[0]);!/\S/.test(n.text())&&/^\?/.test(n.val())&&n.remove()}}(i[0].options),k=M.call(i,x=S).data(c),u(k,t,o,c,s),t.$emit("kendoWidgetCreated",k),h=p(t,k),o.kRebind&&m(k,t,i,n,o.kRebind,h,o),o.kNgDisabled&&(g=o.kNgDisabled,b=t.$eval(g),b&&k.enable(!b),r(k,t,i,g)),o.kNgReadonly&&(y=o.kNgReadonly,V=t.$eval(y),V&&k.readonly(V),l(k,t,i,y)),o.kNgModel&&f(k,t,o.kNgModel),$&&d(k,t,i,$,w),k&&v(k,i),k}var g,b,$,w,M,y,S,T,_,A,L,P,O,D;if(!(i instanceof jQuery))throw Error("The Kendo UI directives require jQuery to be available before AngularJS. Please include jquery before angular in the document.");if(g=o.kNgDelay,b=t.$eval(g),k=k||[],$=k[0],w=k[1],M=e(i)[c],!M)return window.console.error("Could not find: "+c),null;if(y=a(t,i,o,c,M),S=y.options,y.unresolved.length){for(T=[],_=0,A=y.unresolved.length;A>_;_++)L=y.unresolved[_],P=e.Deferred(function(e){var i=t.$watch(L.path,function(t){t!==n&&(i(),e.resolve())})}).promise(),T.push(P);return e.when.apply(null,T).then(h),n}return g&&!b?(O=t.$root||t,D=function(){var e=t.$watch(g,function(t){t!==n&&(e(),i.removeAttr(o.$attr.kNgDelay),g=null,V(h))})},/^\$(digest|apply)$/.test(O.$$phase)?D():t.$apply(D),n):h()}function a(i,o,a,r,l){function u(e,o){var a=t.copy(i.$eval(o));a===n?v.push({option:e,path:o}):c[e]=a}var c,s,d,f,p=r.replace(/^kendo/,""),v=[],m=a.kOptions||a.options,k=i.$eval(m);return m&&k===n&&v.push({option:"options",path:m}),c=t.extend({},a.defaultOptions,k),s=l.widget.prototype.options,d=l.widget.prototype.events,e.each(a,function(e,t){var n,i,o,a;"source"!==e&&"kDataSource"!==e&&"kScopeField"!==e&&"scopeField"!==e&&(n="data"+e.charAt(0).toUpperCase()+e.slice(1),0===e.indexOf("on")&&(i=e.replace(/^on./,function(e){return e.charAt(2).toLowerCase()}),d.indexOf(i)>-1&&(c[i]=t)),s.hasOwnProperty(n)?u(n,t):s.hasOwnProperty(e)&&!L[e]?u(e,t):A[e]||(o=e.match(/^k(On)?([A-Z].*)/),o&&(a=o[2].charAt(0).toLowerCase()+o[2].slice(1),o[1]&&"kOnLabel"!=e?c[a]=t:("kOnLabel"==e&&(a="onLabel"),u(a,t)))))}),f=a.kDataSource||a.source,f&&(c.dataSource=_(i,o,p,f)),c.$angular=[i],{options:c,unresolved:v}}function r(e,t,i,o){return kendo.ui.PanelBar&&e instanceof kendo.ui.PanelBar||kendo.ui.Menu&&e instanceof kendo.ui.Menu?(T.warn("k-ng-disabled specified on a widget that does not have the enable() method: "+e.options.name),n):(t.$watch(o,function(t,n){t!=n&&e.enable(!t)}),n)}function l(e,t,i,o){return"function"!=typeof e.readonly?(T.warn("k-ng-readonly specified on a widget that does not have the readonly() method: "+e.options.name),n):(t.$watch(o,function(t,n){t!=n&&e.readonly(t)}),n)}function u(e,t,n,i,o){if(n[o]){var a=y(n[o]).assign;if(!a)throw Error(o+" attribute used but expression in it is not assignable: "+n[i]);a(t,e)}}function c(e){return/checkbox|radio/i.test(e.attr("type"))?e.prop("checked"):e.val()}function s(e){return P.test(e[0].tagName)}function d(e,t,i,o,a){var r,l,u,d;e.value&&(r=s(i)?function(){return c(i)}:function(){return e.value()},o.$render=function(){var i=o.$viewValue;i===n&&(i=o.$modelValue),i===n&&(i=null),setTimeout(function(){if(e){var n=t[e.element.attr("k-ng-model")];n&&(i=n),e.options.autoBind!==!1||e.listView.bound()?e.value(i):i&&e.value(i)}},0)},l=!1,s(i)&&i.on("change",function(){l=!0}),u=function(e){return function(){var n;l||(e&&a&&(n=a.$pristine),o.$setViewValue(r()),e&&(o.$setPristine(),n&&a.$setPristine()),g(t))}},e.first("change",u(!1)),kendo.ui.AutoComplete&&e instanceof kendo.ui.AutoComplete||e.first("dataBound",u(!0)),d=r(),isNaN(o.$viewValue)||d==o.$viewValue||(o.$isEmpty(o.$viewValue)?null!=d&&""!==d&&d!=o.$viewValue&&o.$setViewValue(d):e.value(o.$viewValue)),o.$setPristine())}function f(t,i,o){var a,r,l,u,c,s,d,f,p;return"function"!=typeof t.value?(T.warn("k-ng-model specified on a widget that does not have the value() method: "+t.options.name),n):(a=e(t.element).parents("form"),r=i[a.attr("name")],l=y(o),u=l.assign,c=!1,s=kendo.ui.MultiSelect&&t instanceof kendo.ui.MultiSelect,d=function(e){return s?e.length:0},f=d(l(i)),t.$angular_setLogicValue(l(i)),p=function(e,i){e===n&&(e=null),c||e==i&&d(e)==f||(f=d(e),t.$angular_setLogicValue(e))},s?i.$watchCollection(o,p):i.$watch(o,p),t.first("change",function(){c=!0,r&&r.$pristine&&r.$setDirty(),g(i,function(){u(i,t.$angular_getLogicValue()),f=d(l(i))}),c=!1}),n)}function p(e,t){var n=e.$on("$destroy",function(){n(),t&&(t.element&&(t=h(t.element),t&&t.destroy()),t=null)});return n}function v(t,n){function i(){r.disconnect()}function o(){r.observe(e(n)[0],{attributes:!0})}var a,r;window.MutationObserver&&t.wrapper&&(a=[].slice.call(e(n)[0].classList),r=new MutationObserver(function(n){i(),t&&(n.forEach(function(n){var i,o=e(t.wrapper)[0];switch(n.attributeName){case"class":i=[].slice.call(n.target.classList),i.forEach(function(e){a.indexOf(e)<0&&(o.classList.add(e),kendo.ui.ComboBox&&t instanceof kendo.ui.ComboBox&&t.input[0].classList.add(e))}),a.forEach(function(e){i.indexOf(e)<0&&(o.classList.remove(e),kendo.ui.ComboBox&&t instanceof kendo.ui.ComboBox&&t.input[0].classList.remove(e))}),a=i;break;case"disabled":"function"!=typeof t.enable||t.element.attr("readonly")||t.enable(!e(n.target).attr("disabled"));break;case"readonly":"function"!=typeof t.readonly||t.element.attr("disabled")||t.readonly(!!e(n.target).attr("readonly"))}}),o())}),o(),t.first("destroy",i))}function m(t,n,i,o,a,r,l){var u=n.$watch(a,function(a,c){var s,d,f,p,v;t._muteRebind||a===c||(u(),s=N[t.options.name],s&&s.forEach(function(t){var i=n.$eval(l["k"+t]);i&&o.append(e(i).attr(kendo.toHyphens("k"+t),""))}),d=e(t.wrapper)[0],f=e(t.element)[0],p="Upload"===t.options.name,p&&(i=e(f)),v=i.injector().get("$compile"),t._destroy(),r&&r(),t=null,f&&(d&&d.parentNode.replaceChild(f,d),e(i).replaceWith(o)),v(o)(n))},!0);g(n)}function k(e,n){function i(e,t){w.directive(e,["directiveFactory",function(n){return n.create(t,e)}])}var o,a,r,l,u=n?"Mobile":"";u+=e.fn.options.name,o=u,a="kendo"+u.charAt(0)+u.substr(1).toLowerCase(),u="kendo"+u,r=u.replace(/([A-Z])/g,"-$1"),-1==D.indexOf(u.replace("kendo",""))&&(l=u===a?[u]:[u,a],t.forEach(l,function(e){w.directive(e,function(){return{restrict:"E",replace:!0,template:function(e,t){var n=O[o]||"div",i=t.kScopeField||t.scopeField;return"<"+n+" "+r+(i?'="'+i+'"':"")+">"+e.html()+"</"+n+">"}}})})),E.indexOf(u.replace("kendo",""))>-1||(i(u,u),a!=u&&i(a,u))}function h(t){return t=e(t),kendo.widgetInstance(t,kendo.ui)||kendo.widgetInstance(t,kendo.mobile.ui)||kendo.widgetInstance(t,kendo.dataviz.ui)}function g(e,t){var n=e.$root||e,i=/^\$(digest|apply)$/.test(n.$$phase);t?i?t():n.$apply(t):i||n.$digest()}function b(t,n){t.$destroy(),n&&e(n).removeData("$scope").removeData("$$kendoScope").removeData("$isolateScope").removeData("$isolateScopeNoTemplate").removeClass("ng-scope")}function $(n,i,o){var a,r,l;if(e.isArray(n))return t.forEach(n,function(e){$(e,i,o)});if("string"==typeof n){for(a=n.split("."),r=kendo;r&&a.length>0;)r=r[a.shift()];if(!r)return C.push([n,i,o]),!1;n=r.prototype}return l=n[i],n[i]=function(){var e=this,t=arguments;return o.apply({self:e,next:function(){return l.apply(e,arguments.length>0?arguments:t)}},t)},!0}var w,M,y,V,S,T,x,_,A,L,P,O,D,E,C,N;t&&t.injector&&(w=t.module("kendo.directives",[]),M=t.injector(["ng"]),y=M.get("$parse"),V=M.get("$timeout"),T=M.get("$log"),_=function(){var e={TreeList:"TreeListDataSource",TreeView:"HierarchicalDataSource",Scheduler:"SchedulerDataSource",PanelBar:"$PLAIN",Menu:"$PLAIN",ContextMenu:"$PLAIN"},t=function(e,t){return"$PLAIN"==t?e:kendo.data[t].create(e)};return function(n,i,o,a){var r=e[o]||"DataSource",l=n.$eval(a),u=t(l,r);return n.$watch(a,function(e){var n,o=h(i);o&&"function"==typeof o.setDataSource&&e!==l&&(n=t(e,r),o.setDataSource(n),l=e)}),u}}(),A={kDataSource:!0,kOptions:!0,kRebind:!0,kNgModel:!0,kNgDelay:!0},L={name:!0,title:!0,style:!0},P=/^(input|select|textarea)$/i,w.factory("directiveFactory",["$compile",function(t){var n,i,a=!1;return S=t,i=function(t,i){return{restrict:"AC",require:["?ngModel","^?form"],scope:!1,controller:["$scope","$attrs","$element",function(e,t){var n=this;n.template=function(e,n){t[e]=kendo.stringify(n)},e.$on("$destroy",function(){n.template=null,n=null})}],link:function(r,l,u,c){var s,d=e(l),f=t.replace(/([A-Z])/g,"-$1");d.attr(f,d.attr("data-"+f)),d[0].removeAttribute("data-"+f),s=o(r,l,u,t,i,c),s&&(n&&clearTimeout(n),n=setTimeout(function(){r.$emit("kendoRendered"),a||(a=!0,e("form").each(function(){var t=e(this).controller("form");t&&t.$setPristine()}))}))}}},{create:i}}]),O={Editor:"textarea",NumericTextBox:"input",DatePicker:"input",DateTimePicker:"input",TimePicker:"input",AutoComplete:"input",ColorPicker:"input",MaskedTextBox:"input",MultiSelect:"input",Upload:"input",Validator:"form",Button:"button",MobileButton:"a",MobileBackButton:"a",MobileDetailButton:"a",ListView:"ul",MobileListView:"ul",TreeView:"ul",Menu:"ul",ContextMenu:"ul",ActionSheet:"ul"},D=["MobileView","MobileDrawer","MobileLayout","MobileSplitView","MobilePane","MobileModalView"],E=["MobileApplication","MobileView","MobileModalView","MobileLayout","MobileActionSheet","MobileDrawer","MobileSplitView","MobilePane","MobileScrollView","MobilePopOver"],t.forEach(["MobileNavBar","MobileButton","MobileBackButton","MobileDetailButton","MobileTabStrip","MobileScrollView","MobileScroller"],function(e){E.push(e),e="kendo"+e,w.directive(e,function(){return{restrict:"A",link:function(t,n,i){o(t,n,i,e,e)}}})}),C=[],kendo.onWidgetRegistered(function(t){C=e.grep(C,function(e){return!$.apply(null,e)}),k(t.widget,"Mobile"==t.prefix)}),$(["ui.Widget","mobile.ui.Widget"],"angular",function(o,a){var r,l=this.self;return"init"==o?(!a&&x&&(a=x),x=null,a&&a.$angular&&(l.$angular_scope=a.$angular[0],l.$angular_init(l.element,a)),n):(r=l.$angular_scope,r&&i(function(){var i,u,c=a(),s=c.elements,d=c.data;if(s.length>0)switch(o){case"cleanup":t.forEach(s,function(t){var n=e(t).data("$$kendoScope");n&&n!==r&&n.$$kendoScope&&b(n,t)});break;case"compile":i=l.element.injector(),u=i?i.get("$compile"):S,t.forEach(s,function(t,i){var o,a;c.scopeFrom?o=c.scopeFrom:(a=d&&d[i],a!==n?(o=e.extend(r.$new(),a),o.$$kendoScope=!0):o=r),e(t).data("$$kendoScope",o),u(t)(o)}),g(r)}}),n)}),$("ui.Widget","$angular_getLogicValue",function(){return this.self.value()}),$("ui.Widget","$angular_setLogicValue",function(e){this.self.value(e)}),$("ui.Select","$angular_getLogicValue",function(){var e=this.self.dataItem(),t=this.self.options.dataValueField;return e?this.self.options.valuePrimitive?t?e[t]:e:e.toJSON():null}),$("ui.Select","$angular_setLogicValue",function(e){var t=this.self,i=t.options,o=i.dataValueField,a=i.text||"";e===n&&(e=""),o&&!i.valuePrimitive&&e&&(a=e[i.dataTextField]||"",e=e[o||i.dataTextField]),t.options.autoBind!==!1||t.listView.bound()?t.value(e):!a&&e&&i.valuePrimitive?t.value(e):t._preselect(e,a)}),$("ui.MultiSelect","$angular_getLogicValue",function(){var t=this.self.dataItems().slice(0),n=this.self.options.dataValueField;return n&&this.self.options.valuePrimitive&&(t=e.map(t,function(e){return e[n]})),t}),$("ui.MultiSelect","$angular_setLogicValue",function(t){var n,i,o,a;null==t&&(t=[]),n=this.self,i=n.options,o=i.dataValueField,a=t,o&&!i.valuePrimitive&&(t=e.map(t,function(e){return e[o]})),i.autoBind!==!1||i.valuePrimitive||n.listView.bound()?n.value(t):n._preselect(a,t)}),$("ui.AutoComplete","$angular_getLogicValue",function(){var e,t,n,i,o,a=this.self.options,r=this.self.value().split(a.separator),l=a.valuePrimitive,u=this.self.dataSource.data(),c=[];for(e=0,t=u.length;t>e;e++)for(n=u[e],i=a.dataTextField?n[a.dataTextField]:n,o=0;r.length>o;o++)if(i===r[o]){c.push(l?i:n.toJSON());break}return c}),$("ui.AutoComplete","$angular_setLogicValue",function(t){null==t&&(t=[]);var i=this.self,o=i.options.dataTextField;o&&!i.options.valuePrimitive&&(t=t.length!==n?e.map(t,function(e){return e[o]}):t[o]),i.value(t)}),$("ui.Widget","$angular_init",function(t,n){var i,o,a,r,l=this.self;if(n&&!e.isArray(n))for(i=l.$angular_scope,o=l.events.length;--o>=0;)a=l.events[o],r=n[a],r&&"string"==typeof r&&(n[a]=l.$angular_makeEventHandler(a,i,r))}),$("ui.Widget","$angular_makeEventHandler",function(e,t,n){return n=y(n),function(e){g(t,function(){n(t,{kendoEvent:e})})}}),$(["ui.Grid","ui.ListView","ui.TreeView"],"$angular_makeEventHandler",function(e,n,i){return"change"!=e?this.next():(i=y(i),function(e){var o,a,r,l,u,c,s,d,f,p=e.sender,v=p.options,m={kendoEvent:e};for(t.isString(v.selectable)&&(o=-1!==v.selectable.indexOf("cell"),a=-1!==v.selectable.indexOf("multiple")),r=m.selected=this.select(),l=m.data=[],u=m.columns=[],s=0;r.length>s;s++)d=o?r[s].parentNode:r[s],f=p.dataItem(d),o?(t.element.inArray(f,l)<0&&l.push(f),c=t.element(r[s]).index(),t.element.inArray(c,u)<0&&u.push(c)):l.push(f);a||(m.dataItem=m.data=l[0],m.angularDataItem=kendo.proxyModelSetters(m.dataItem),m.selected=r[0]),g(n,function(){i(n,m)})})}),$("ui.Grid","$angular_init",function(i,o){if(this.next(),o.columns){var a=e.extend({},kendo.Template,o.templateSettings);t.forEach(o.columns,function(e){!e.field||e.template||e.format||e.values||e.encoded!==n&&!e.encoded||(e.template="<span ng-bind='"+kendo.expr(e.field,"dataItem")+"'>#: "+kendo.expr(e.field,a.paramName)+"#</span>")})}}),$("mobile.ui.ButtonGroup","value",function(e){var t=this.self;return null!=e&&(t.select(t.element.children("li.km-button").eq(e)),t.trigger("change"),t.trigger("select",{index:t.selectedIndex})),t.selectedIndex}),$("mobile.ui.ButtonGroup","_select",function(){this.next(),this.self.trigger("change")}),w.directive("kendoMobileApplication",function(){return{terminal:!0,link:function(e,t,n){o(e,t,n,"kendoMobileApplication","kendoMobileApplication")}}}).directive("kendoMobileView",function(){return{scope:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,n._instance=o(e,t,n,"kendoMobileView","kendoMobileView")},post:function(e,t,n){n._instance._layout(),n._instance._scroller()}}}}).directive("kendoMobileDrawer",function(){return{scope:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,n._instance=o(e,t,n,"kendoMobileDrawer","kendoMobileDrawer")},post:function(e,t,n){n._instance._layout(),n._instance._scroller()}}}}).directive("kendoMobileModalView",function(){return{scope:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,n._instance=o(e,t,n,"kendoMobileModalView","kendoMobileModalView")},post:function(e,t,n){n._instance._layout(),n._instance._scroller()}}}}).directive("kendoMobileSplitView",function(){return{terminal:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,n._instance=o(e,t,n,"kendoMobileSplitView","kendoMobileSplitView")},post:function(e,t,n){n._instance._layout()}}}}).directive("kendoMobilePane",function(){return{terminal:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,o(e,t,n,"kendoMobilePane","kendoMobilePane")}}}}).directive("kendoMobileLayout",function(){return{link:{pre:function(e,t,n){o(e,t,n,"kendoMobileLayout","kendoMobileLayout")}}}}).directive("kendoMobileActionSheet",function(){return{restrict:"A",link:function(t,n,i){n.find("a[k-action]").each(function(){e(this).attr("data-"+kendo.ns+"action",e(this).attr("k-action"))}),o(t,n,i,"kendoMobileActionSheet","kendoMobileActionSheet")}}}).directive("kendoMobilePopOver",function(){return{terminal:!0,link:{pre:function(e,t,n){n.defaultOptions=e.viewOptions,o(e,t,n,"kendoMobilePopOver","kendoMobilePopOver")}}}}).directive("kendoViewTitle",function(){return{restrict:"E",replace:!0,template:function(e){return"<span data-"+kendo.ns+"role='view-title'>"+e.html()+"</span>"}}}).directive("kendoMobileHeader",function(){return{restrict:"E",link:function(e,t){t.addClass("km-header").attr("data-role","header")}}}).directive("kendoMobileFooter",function(){return{restrict:"E",link:function(e,t){t.addClass("km-footer").attr("data-role","footer")}}}).directive("kendoMobileScrollViewPage",function(){return{restrict:"E",replace:!0,template:function(e){return"<div data-"+kendo.ns+"role='page'>"+e.html()+"</div>"}}}),t.forEach(["align","icon","rel","transition","actionsheetContext"],function(e){var t="k"+e.slice(0,1).toUpperCase()+e.slice(1);w.directive(t,function(){return{restrict:"A",priority:2,link:function(n,i,o){i.attr(kendo.attr(kendo.toHyphens(e)),n.$eval(o[t]))}}})}),N={TreeMap:["Template"],MobileListView:["HeaderTemplate","Template"],MobileScrollView:["EmptyTemplate","Template"],Grid:["AltRowTemplate","DetailTemplate","RowTemplate"],ListView:["EditTemplate","Template","AltTemplate"],Pager:["SelectTemplate","LinkTemplate"],PivotGrid:["ColumnHeaderTemplate","DataCellTemplate","RowHeaderTemplate"],Scheduler:["AllDayEventTemplate","DateHeaderTemplate","EventTemplate","MajorTimeHeaderTemplate","MinorTimeHeaderTemplate"],TreeView:["Template"],Validator:["ErrorTemplate"]},function(){var e={};t.forEach(N,function(n,i){t.forEach(n,function(t){e[t]||(e[t]=[]),e[t].push("?^^kendo"+i)})}),t.forEach(e,function(e,t){var n="k"+t,i=kendo.toHyphens(n);w.directive(n,function(){return{restrict:"A",require:e,terminal:!0,compile:function(t,o){if(""===o[n]){t.removeAttr(i);var a=t[0].outerHTML;return function(o,r,l,u){for(var c;!c&&u.length;)c=u.shift();c?(c.template(n,a),t.remove()):T.warn(i+" without a matching parent widget found. It can be one of the following: "+e.join(", "))}}}}})})}())}(window.kendo.jQuery,window.angular),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,n){(n||t)()});
//# sourceMappingURL=kendo.angular.min.js.map