forked from kendo-labs/angular-kendo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-kendo.min.js
2 lines (2 loc) · 1.61 KB
/
angular-kendo.min.js
1
2
/*! angular-kendo 2013-03-24 */
(function(e,n,t,r){"use strict";e.module("kendo",["kendo.directives","kendo.services"]);var o=e.module("kendo.directives",[]),a=e.module("kendo.services",[]),c=n.filter(n.keys(t.fn),function(e){return!!e.match(/^kendo(?:(?!Mobile))/)});a.value("kendoWidgets",c),e.forEach(c,function(t){o.directive(t,["$parse","$timeout",function(r,o){function a(t,o,a){var c=n.reduce(n.keys(a),function(e,n){var t=n.match(/^on(.+)/);if(t){var c=t[1].charAt(0).toLowerCase()+t[1].slice(1),u=r(a[n]);e[c]=function(e){o.$apply(function(){u(o,{kendoEvent:e})})}}return e},{});e.extend(t,c)}var c;return{restrict:"ACE",transclude:!0,require:["?ngModel","?kendoSource"],controller:["$scope","$attrs","$element","$transclude",function(n,r,o,a){c=e.copy(n.$eval(r[t]))||{},a(function(e){o.append(e)})}],link:function(n,r,u,i){var d,s=i[0],f=i[1];o(function(){if(e.extend(c,r.data()),f&&(c.dataSource=f.getDataSource()),a(c,n,u),d=r[t](c).data(t),s){if(!d.value)throw Error("ng-model used but "+t+" does not define a value accessor");s.$render=function(){d.value(s.$viewValue)},d.bind("change",function(){n.$apply(function(){s.$setViewValue(d.value())})})}})}}}])}),o.directive("kendoSource",[function(){function n(n){if(n instanceof r.data.DataSource)return n;if(e.isObject(n))return new r.data.DataSource(n);if(e.isArray(n))return new r.data.DataSource({data:n});throw Error("kendo-source must be a kendo datasource object")}return{restrict:"A",controller:["$scope","$attrs",function(e,t){var r=n(e.$eval(t.kendoSource));e.$watch(t.kendoSource,function(e){r=n(e)}),this.getDataSource=function(){return r}}]}}])})(angular,_,jQuery,kendo);