demo20230512/Scripts/kendo/2014.2.716/kendo.angular.min.js
2023-05-12 10:20:28 +08:00

16 lines
8.8 KiB
JavaScript

/**
* 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"],e)}(function(){return function(e,t,n){"use strict";function i(i,a,o,s,l){var d,c,u=s.replace(/^kendo/,""),p=t.extend({},i.$eval(o.kOptions));return e.each(o,function(e,r){var a,o;k[e]||(a=e.match(/^k(On)?([A-Z].*)/),a&&(o=a[2].charAt(0).toLowerCase()+a[2].slice(1),a[1]&&"kOnLabel"!=e?p[o]=r:("kOnLabel"==e&&(o="onLabel"),p[o]=t.copy(i.$eval(r)),p[o]===n&&r.match(/^\w*$/)&&g.warn(s+"'s "+e+" attribute resolved to undefined. Maybe you meant to use a string literal like: '"+r+"'?"))))}),o.kDataSource&&(p.dataSource=_(i,a,o,u)),p.$angular=[i],(d=e(a)[s])?(c=d.call(a,v=p).data(s),r(c,i,o,s,l),i.$emit("kendoWidgetCreated",c),c):(window.console.error("Could not find: "+s),null)}function r(e,t,n,i,r){if(n[r]){var a=h(n[r]).assign;if(!a)throw Error(r+" attribute used but expression in it is not assignable: "+n[i]);a(t,e)}}function a(e){return/^kendo/i.test(e.prop("tagName"))}function o(e,t){function n(e,t){p.directive(e,["directiveFactory",function(n){return n.create(t,e)}])}var i,r=t?"Mobile":"";r+=e.fn.options.name,i="kendo"+r.charAt(0)+r.substr(1).toLowerCase(),r="kendo"+r,n(r,r),i!=r&&n(i,r)}function s(t){return t=e(t),kendo.widgetInstance(t,kendo.ui)||kendo.widgetInstance(t,kendo.mobile.ui)||kendo.widgetInstance(t,kendo.dataviz.ui)}function l(e,t,n,i){e.bind.call(e,t,n,i);var r=e._events[t];r.unshift(r.pop())}function d(e){/^\$(digest|apply)$/.test(e.$root.$$phase)||e.$digest()}function c(t,n){t.$destroy(),n&&e(n).removeData("$scope").removeData("$isolateScope").removeData("$isolateScopeNoTemplate").removeClass("ng-scope")}function u(n,i,r){var a,o,s;if(e.isArray(n))return t.forEach(n,function(e){u(e,i,r)});if("string"==typeof n){for(a=n.split("."),o=kendo;o&&a.length>0;)o=o[a.shift()];if(!o)return b.push([n,i,r]),!1;n=o.prototype}return s=n[i],n[i]=function(){var e=this,t=arguments;return r.apply({self:e,next:function(){return s.apply(e,arguments.length>0?arguments:t)}},t)},!0}var p,h,f,m,g,v,_,k,b;t&&(p=t.module("kendo.directives",[]),_=function(){var e={TreeView:"HierarchicalDataSource",Scheduler:"SchedulerDataSource",PanelBar:"$PLAIN",Menu:"$PLAIN"},t=function(e,t){return"$PLAIN"==t?e:kendo.data[t].create(e)};return function(n,i,r,a){var o=e[a]||"DataSource",l=t(n.$eval(r.kDataSource),o);return n.$watch(r.kDataSource,function(e,n){var r,a;e!==n&&(r=t(e,o),a=s(i),a&&"function"==typeof a.setDataSource&&a.setDataSource(r))}),l}}(),k={kDataSource:!0,kOptions:!0,kRebind:!0,kNgModel:!0,kNgDelay:!0},p.factory("directiveFactory",["$timeout","$parse","$compile","$log",function(t,r,o,s){var c,u;return f=t,h=r,m=o,g=s,c=0,u=function(t,r){return{restrict:"ACE",require:["?ngModel","^?form"],scope:!1,transclude:!0,controller:["$scope","$attrs","$element","$transclude",function(e,t,n,i){a(n)&&!function(){var e,i,r,a,o=n[0];for(t.$kendoOrigElement=o.cloneNode(!0),e=Array.prototype.slice.call(o.attributes),i=0;e.length>i;++i)r=e[i].nodeName,/^(k|ng)-/.test(r)||/^(style|class|id)$/.test(r)||(a=("k-"+r).replace(/-(.)/g,function(e,t){return t.toUpperCase()}),a in t||(t[a]=e[i].nodeValue),o.removeAttribute(r))}(),i(e,function(e){n.append(e)})}],link:function(a,o,s,u){var p,v=u[0],_=u[1];e(o)[0].removeAttribute("data-"+t.replace(/([A-Z])/g,"-$1")),++c,p=s.kNgDelay,f(function k(){function u(){function e(e){return/checkbox|radio/i.test(e.attr("type"))?e.prop("checked"):e.val()}function t(){return w?e(o):y.value()}var i,r,c,u,p,m,k,b,w=/^(input|select|textarea)$/i.test(o[0].tagName);x&&x(),x=a.$on("$destroy",function(){y&&(y.element&&y.destroy(),y=null)});e:if(v){if(!y.value)break e;if(v.$render=function(){var e=v.$viewValue;e===n&&(e=v.$modelValue),setTimeout(function(){y.value(e)},0)},w&&o.on("change",function(){i=!0}),r=function(e){return function(){i=!1,f(function(){var n;i||(e&&_&&(n=_.$pristine),v.$setViewValue(t()),e&&(v.$setPristine(),n&&_.$setPristine()))})}},l(y,"change",r(!1)),l(y,"dataBound",r(!0)),c=t(),c!=v.$viewValue&&(v.$isEmpty(v.$viewValue)?null!=c&&""!==c&&c!=v.$viewValue&&v.$setViewValue(c):y.value(v.$viewValue)),v.$setPristine(),_){for(u=o;u.controller("form");)p=u.controller("form"),u=u.parent();p.$setPristine()}}e:if(s.kNgModel){if("function"!=typeof y.value){g.warn("k-ng-model specified on a widget that does not have the value() method: "+y.options.name);break e}m=h(s.kNgModel),k=m.assign,b=!1,y.value(m(a)),a.$watch(s.kNgModel,function(e,t){b||e!==t&&y.value(e)}),l(y,"change",function(){b=!0,k(a,y.value()),d(a),b=!1})}}var b,w,y,x;return p?function(){var e=a.$watch(p,function(t,n){t!==n&&(e(),p=null,f(k))},!0)}():(s.kRebind&&(b=s.$kendoOrigElement||e(o)[0].cloneNode(!0),w=a.$watch(s.kRebind,function(t,n){var i,r,s;t!==n&&(w(),i=e(y.wrapper)[0],r=e(y.element)[0],y.destroy(),y=null,i&&r&&(i.parentNode.replaceChild(r,i),s=b.cloneNode(!0),e(o).replaceWith(s),o=e(s)),m(o)(a))},!0)),y=i(a,o,s,t,r),u(),x=null,function(){function t(){r.disconnect()}function n(){r.observe(e(o)[0],{attributes:!0})}var i,r;window.MutationObserver&&y.wrapper&&(i=[].slice.call(e(o)[0].classList),r=new MutationObserver(function(r){t(),y&&(r.forEach(function(t){var n,r=e(y.wrapper)[0];switch(t.attributeName){case"class":n=[].slice.call(t.target.classList),n.forEach(function(e){i.indexOf(e)<0&&(r.classList.add(e),y instanceof kendo.ui.ComboBox&&y.input[0].classList.add(e))}),i.forEach(function(e){n.indexOf(e)<0&&(r.classList.remove(e),y instanceof kendo.ui.ComboBox&&y.input[0].classList.remove(e))}),i=n;break;case"disabled":"function"==typeof y.enable&&y.enable(!e(t.target).attr("disabled"));break;case"readonly":"function"==typeof y.readonly&&y.readonly(!!e(t.target).attr("readonly"))}}),n())}),n(),l(y,"destroy",t))}(),--c,0===c&&a.$emit("kendoRendered"),n)})}}},{create:u}}]),function(){function e(e){return function(n){t.forEach(n,function(t){t.fn&&t.fn.options&&t.fn.options.name&&/^[A-Z]/.test(t.fn.options.name)&&o(t,e)})}}t.forEach([kendo.ui,kendo.dataviz&&kendo.dataviz.ui],e(!1)),t.forEach([kendo.mobile&&kendo.mobile.ui],e(!0))}(),b=[],u(kendo.ui,"plugin",function(t,n,i){this.next(),b=e.grep(b,function(e){return!u.apply(null,e)}),o(t,"Mobile"==i)}),u(["ui.Widget","mobile.ui.Widget"],"angular",function(i,r){var a,o,s,l,u=this.self;if("init"==i)return!r&&v&&(r=v),v=null,r&&r.$angular&&(u.$angular_scope=r.$angular[0],u.$angular_init(u.element,r)),n;if(a=u.$angular_scope||t.element(u.element).scope(),a&&(o=r(),s=o.elements,l=o.data,s.length>0))switch(i){case"cleanup":t.forEach(s,function(e){var n=t.element(e).scope();n&&n!==a&&c(n)});break;case"compile":t.forEach(s,function(i,r){var s,d;o.scopeFrom?s=t.element(o.scopeFrom).scope():(d=l&&l[r],d!==n&&(s=e.extend(a.$new(),d))),m(i)(s||a)}),d(a)}}),u("ui.Widget","$angular_init",function(t,n){var i,r,a,o,s=this.self;if(n&&!e.isArray(n))for(i=s.$angular_scope,r=s.events.length;--r>=0;)a=s.events[r],o=n[a],o&&"string"==typeof o&&(n[a]=s.$angular_makeEventHandler(a,i,o))}),u("ui.Widget","$angular_makeEventHandler",function(e,t,n){return n=h(n),function(e){/^\$(apply|digest)$/.test(t.$root.$$phase)?n(t,{kendoEvent:e}):t.$apply(function(){n(t,{kendoEvent:e})})}}),u(["ui.Grid","ui.ListView","ui.TreeView"],"$angular_makeEventHandler",function(e,n,i){return"change"!=e?this.next():(i=h(i),function(e){var r,a,o,s,l,d,c,u,p,h=e.sender,f=h.options,m={kendoEvent:e};for(t.isString(f.selectable)&&(r=-1!==f.selectable.indexOf("cell"),a=-1!==f.selectable.indexOf("multiple")),o=m.selected=this.select(),s=m.data=[],l=m.columns=[],c=0;o.length>c;c++)u=r?o[c].parentNode:o[c],p=h.dataItem(u),r?(t.element.inArray(p,s)<0&&s.push(p),d=t.element(o[c]).index(),t.element.inArray(d,l)<0&&l.push(d)):s.push(p);a||(m.dataItem=m.data=s[0],m.selected=o[0]),n.$apply(function(){i(n,m)})})}),u("ui.Grid","$angular_init",function(n,i){if(this.next(),i.columns){var r=e.extend({},kendo.Template,i.templateSettings);t.forEach(i.columns,function(e){!e.field||e.template||e.format||e.values||(e.template="<span ng-bind='"+kendo.expr(e.field,"dataItem")+"'>#: "+kendo.expr(e.field,r.paramName)+"#</span>")})}}),u("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}),u("mobile.ui.ButtonGroup","_select",function(){this.next(),this.self.trigger("change")}))}(window.kendo.jQuery,window.angular),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()});