UNPKG

@progress/kendo-ui

Version:

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

1 lines 18.6 kB
module.exports=function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}({0:function(e,t,n){e.exports=n(1004)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},1004:function(e,t,n){var i,o,a;(function(r){!function(r,define){o=[n(1006)],i=r,a="function"==typeof i?i.apply(t,o):i,!(void 0!==a&&(e.exports=a))}(function(){return function(e,t,n){"use strict";function i(e){var t=T;try{return T=function(e){return e()},e()}finally{T=t}}function o(t,i,o,s,d,h){function g(){var n,r,h,g,b,w,S;return o.kRebind&&(n=e(e(i)[0].cloneNode(!0))),V=a(t,i,o,s,y).options,i.is("select")&&!function(t){var n,i;if(t.length>0)for(n=e(t[0]),!/\S/.test(n.text())&&/^\?/.test(n.val())&&n.remove(),i=0;i<t.length;i++)e(t[i]).off("$destroy")}(i[0].options),r=y.call(i,D=V).data(s),c(r,t,o,s,d),t.$emit("kendoWidgetCreated",r),h=v(t,r),o.kRebind&&k(r,t,i,n,o.kRebind,h,o),o.kNgDisabled&&(g=o.kNgDisabled,b=t.$eval(g),b&&r.enable(!b),l(r,t,i,g)),o.kNgReadonly&&(w=o.kNgReadonly,S=t.$eval(w),S&&r.readonly(S),u(r,t,i,w)),o.kNgModel&&f(r,t,o.kNgModel),$&&p(r,t,i,$,M),r&&m(r,i),r}var b,w,$,M,y,S,V,x,_,P,A,L,E,O;if(!(i instanceof r))throw Error("The Kendo UI directives require jQuery to be available before AngularJS. Please include jquery before angular in the document.");if(b=o.kNgDelay,w=t.$eval(b),h=h||[],$=h[0],M=h[1],y=e(i)[s],!y)return window.console.error("Could not find: "+s),null;if(S=a(t,i,o,s,y),V=S.options,S.unresolved.length){for(x=[],_=0,P=S.unresolved.length;_<P;_++)A=S.unresolved[_],L=e.Deferred(function(e){var i=t.$watch(A.path,function(t){t!==n&&(i(),e.resolve())})}).promise(),x.push(L);return e.when.apply(null,x).then(g),n}return b&&!w?(E=t.$root||t,O=function(){var e=t.$watch(b,function(t){t!==n&&(e(),i.removeAttr(o.$attr.kNgDelay),b=null,T(g))})},/^\$(digest|apply)$/.test(E.$$phase)?O():t.$apply(O),n):g()}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,p,f=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)&&!E[e]?u(e,t):L[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)))))}),p=a.kDataSource||a.source,p&&(c.dataSource=A(i,o,f,p)),c.$angular=[i],{options:c,unresolved:v}}function l(e,t,i,o){return kendo.ui.PanelBar&&e instanceof kendo.ui.PanelBar||kendo.ui.Menu&&e instanceof kendo.ui.Menu?(P.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 u(e,t,i,o){return"function"!=typeof e.readonly?(P.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 c(e,t,n,i,o){if(n[o]){var a=x(n[o]).assign;if(!a)throw Error(o+" attribute used but expression in it is not assignable: "+n[i]);a(t,e)}}function s(e){return/checkbox|radio/i.test(e.attr("type"))?e.prop("checked"):e.val()}function d(e){return O.test(e[0].tagName)}function p(e,t,i,o,a){var r,l,u,c,p;e.value&&(l=!1,r=d(i)?function(){return s(i)}:function(){return e.value()},u=function(){var i=o.$viewValue;i===n&&(i=o.$modelValue),i===n&&(i=null),l=!0,setTimeout(function(){if(l=!1,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)},o.$render=u,setTimeout(function(){o.$render!==u&&(o.$render=u)()}),d(i)&&i.on("change",function(){l=!0}),c=function(e){return function(){var n;l&&!i.is("select")||(e&&a&&(n=a.$pristine),o.$setViewValue(r()),e&&(o.$setPristine(),n&&a.$setPristine()),$(t))}},e.first("change",c(!1)),e.first("spin",c(!1)),kendo.ui.AutoComplete&&e instanceof kendo.ui.AutoComplete||e.first("dataBound",c(!0)),p=r(),isNaN(o.$viewValue)||p==o.$viewValue||(o.$isEmpty(o.$viewValue)?null!=p&&""!==p&&p!=o.$viewValue&&o.$setViewValue(p):e.value(o.$viewValue)),o.$setPristine())}function f(t,i,o){var a,r,l,u,c,s,d,p,v,m,k,h,g;return kendo.ui.DateRangePicker&&t instanceof kendo.ui.DateRangePicker?(a=o.split(","),r=a[0].trim(),f(t._startDateInput,i,r),a[1]?(l=a[1].trim(),f(t._endDateInput,i,l),t.range({start:i[r],end:i[l]})):t.range({start:i[r],end:null}),n):"function"!=typeof t.value?(P.warn("k-ng-model specified on a widget that does not have the value() method: "+t.options.name),n):(u=e(t.element).parents("ng-form, form").first(),c=kendo.getter(u.attr("name"),!0)(i),s=x(o),d=s.assign,p=!1,v=kendo.ui.MultiSelect&&t instanceof kendo.ui.MultiSelect||kendo.ui.RangeSlider&&t instanceof kendo.ui.RangeSlider,m=function(e){return e&&v?e.length:0},k=m(s(i)),t.$angular_setLogicValue(s(i)),h=function(e,i){e===n&&(e=null),p||e==i&&m(e)==k||(k=m(e),t.$angular_setLogicValue(e))},v?i.$watchCollection(o,h):i.$watch(o,h),g=function(){p=!0,c&&c.$pristine&&c.$setDirty(),$(i,function(){d(i,t.$angular_getLogicValue()),k=m(s(i))}),p=!1},t.first("change",g),t.first("spin",g),n)}function v(e,t){var n=e.$on("$destroy",function(){n(),t&&(kendo.destroy(t.element),t=null)});return n}function m(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 k(t,n,i,o,a,r,l){var u=n.$watch(a,function(a,c){var s,d,p,f,v;t._muteRebind||a===c||(u(),l._cleanUp&&l._cleanUp(),s=W[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],p=e(t.element)[0],f="Upload"===t.options.name,f&&(i=e(p)),v=i.injector().get("$compile"),t._destroy(),r&&r(),t=null,p&&(d&&d.parentNode.replaceChild(p,d),e(i).replaceWith(o)),v(o)(n))},!0);$(n)}function h(e,t){return function(n,i){return e.call(t,n,i)}}function g(e,t){this[e]=kendo.stringify(t)}function b(e,n){function i(e,t){S.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"),C.indexOf(u.replace("kendo",""))==-1&&(l=u===a?[u]:[u,a],t.forEach(l,function(e){S.directive(e,function(){return{restrict:"E",replace:!0,template:function(e,t){var n=B[o]||"div",i=t.kScopeField||t.scopeField;return"<"+n+" "+r+(i?'="'+i+'"':"")+">"+e.html()+"</"+n+">"}}})})),N.indexOf(u.replace("kendo",""))>-1||(i(u,u),a!=u&&i(a,u))}function w(t){return t=e(t),kendo.widgetInstance(t,kendo.ui)||kendo.widgetInstance(t,kendo.mobile.ui)||kendo.widgetInstance(t,kendo.dataviz.ui)}function $(e,t){var n=e.$root||e,i=/^\$(digest|apply)$/.test(n.$$phase);t?i?t():n.$apply(t):i||n.$digest()}function M(t,n){t.$destroy(),n&&e(n).removeData("$scope").removeData("$$kendoScope").removeData("$isolateScope").removeData("$isolateScopeNoTemplate").removeClass("ng-scope")}function y(n,i,o){var a,r,l;if(e.isArray(n))return t.forEach(n,function(e){y(e,i,o)});if("string"==typeof n){for(a=n.split("."),r=kendo;r&&a.length>0;)r=r[a.shift()];if(!r)return U.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 S,V,x,T,_,P,D,A,L,E,O,B,C,N,I,H,R,F,j,U,W;t&&t.injector&&(S=t.module("kendo.directives",[]),V=t.injector(["ng"]),x=V.get("$parse"),T=V.get("$timeout"),P=V.get("$log"),A=function(){var e={TreeList:"TreeListDataSource",TreeView:"HierarchicalDataSource",Scheduler:"SchedulerDataSource",PivotGrid:"PivotDataSource",PivotConfigurator:"PivotDataSource",PanelBar:"HierarchicalDataSource",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=w(i);o&&"function"==typeof o.setDataSource&&e!==l&&e!==o.dataSource&&(n=t(e,r),o.setDataSource(n),l=e)}),u}}(),L={kDataSource:!0,kOptions:!0,kRebind:!0,kNgModel:!0,kNgDelay:!0},E={name:!0,title:!0,style:!0},O=/^(input|select|textarea)$/i,S.factory("directiveFactory",["$compile",function(t){var n,i,a=!1;return _=t,i=function(t,i){return{restrict:"AC",require:["?ngModel","^?form"],scope:!1,controller:["$scope","$attrs","$element",function(e,t){this.template=h(g,t),t._cleanUp=h(function(){this.template=null,t._cleanUp=null},this)}],link:function(r,l,u,c){var s,d=e(l),p=t.replace(/([A-Z])/g,"-$1");d.attr(p,d.attr("data-"+p)),d[0].removeAttribute("data-"+p),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}}]),B={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",ScrollView:"div",PanelBar:"ul",TreeView:"ul",Menu:"ul",ContextMenu:"ul",ActionSheet:"ul",Switch:"input"},C=["MobileView","MobileDrawer","MobileLayout","MobileSplitView","MobilePane","MobileModalView"],N=["MobileApplication","MobileView","MobileModalView","MobileLayout","MobileActionSheet","MobileDrawer","MobileSplitView","MobilePane","MobileScrollView","MobilePopOver"],t.forEach(["MobileNavBar","MobileButton","MobileBackButton","MobileDetailButton","MobileTabStrip","MobileScrollView","MobileScroller"],function(e){N.push(e),e="kendo"+e,S.directive(e,function(){return{restrict:"A",link:function(t,n,i){o(t,n,i,e,e)}}})}),I=kendo.htmlEncode,H=/{{/g,R=/}}/g,F="{&#8203;{",j="}&#8203;}",kendo.htmlEncode=function(e){return I(e).replace(H,F).replace(R,j)},U=[],kendo.onWidgetRegistered(function(t){U=e.grep(U,function(e){return!y.apply(null,e)}),b(t.widget,"Mobile"==t.prefix)}),y(["ui.Widget","mobile.ui.Widget"],"angular",function(o,a){var r,l=this.self;return"init"==o?(!a&&D&&(a=D),D=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&&M(n,t)});break;case"compile":i=l.element.injector(),u=i?i.get("$compile"):_,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)}),$(r)}}),n)}),y("ui.Widget","$angular_getLogicValue",function(){return this.self.value()}),y("ui.Widget","$angular_setLogicValue",function(e){this.self.value(e)}),y("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}),y("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)}),y("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}),y("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)}),y("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))}),y("ui.Widget","$angular_makeEventHandler",function(e,t,n){return n=x(n),function(e){$(t,function(){n(t,{kendoEvent:e})})}}),y(["ui.Grid","ui.ListView","ui.TreeView","ui.PanelBar"],"$angular_makeEventHandler",function(e,n,i){return"change"!=e?this.next():(i=x(i),function(e){var o,a,r,l,u,c,s,d,p,f=e.sender,v=f.options,m={kendoEvent:e};for(t.isString(v.selectable)&&(o=v.selectable.indexOf("cell")!==-1,a=v.selectable.indexOf("multiple")!==-1),f._checkBoxSelection&&(a=!0),r=m.selected=this.select(),l=m.data=[],u=m.columns=[],s=0;s<r.length;s++)d=o?r[s].parentNode:r[s],p=f.dataItem(d),o?(t.element.inArray(p,l)<0&&l.push(p),c=t.element(r[s]).index(),t.element.inArray(c,u)<0&&u.push(c)):l.push(p);a||(m.dataItem=m.data=l[0],m.angularDataItem=kendo.proxyModelSetters(m.dataItem),m.selected=r[0]),$(n,function(){i(n,m)})})}),y("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>")})}}),y("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}),y("mobile.ui.ButtonGroup","_select",function(){this.next(),this.self.trigger("change")}),S.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);S.directive(t,function(){return{restrict:"A",priority:2,link:function(n,i,o){i.attr(kendo.attr(kendo.toHyphens(e)),n.$eval(o[t]))}}})}),W={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"],ScrollView:["Template"],PanelBar:["Template"],TreeView:["Template"],Validator:["ErrorTemplate"]},function(){var e={};t.forEach(W,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);S.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(t,o,r,l){for(var u;!u&&l.length;)u=l.shift();u?(u.template(n,a),o.remove()):P.warn(i+" without a matching parent widget found. It can be one of the following: "+e.join(", "))}}}}})})}())}(window.kendo.jQuery,window.angular),window.kendo},n(3))}).call(t,n(1005))},1005:function(e,t){e.exports=require("jquery")},1006:function(e,t){e.exports=require("./kendo.core")}});