/* * Kendo UI Beta v2013.2.716 (http://kendoui.com) * Copyright 2013 Telerik AD. All rights reserved. * * Kendo UI Beta license terms available at * http://www.kendoui.com/purchase/license-agreement/kendo-ui-beta.aspx */ ("function"==typeof define&&define.amd?define:function(e,t){return t()})(["./kendo.core.min","./kendo.data.min"],function(){!function(e,t){function n(e){var t,i,s=[];for(t=0,i=e.length;i>t;t++)s=e[t].hasSubgroups?s.concat(n(e[t].items)):s.concat(e[t].items);return s}function i(e,n,i){var s=i[e];return s?new y(x.initWidget(n,s.options,i)):t}function s(e){var t,n,i,a,r,o,h,d={};for(h=e.match(_),t=0,n=h.length;n>t;t++)i=h[t],a=i.indexOf(":"),r=i.substring(0,a),o=i.substring(a+1),"{"==o.charAt(0)&&(o=s(o)),d[r]=o;return d}function a(e,t,n){var i,s={};for(i in e)s[i]=new n(t,e[i]);return s}function r(e,t,n,o){var d,c,l,u=e.getAttribute("data-"+x.ns+"role"),g=e.getAttribute("data-"+x.ns+"bind"),p=e.children,y=[],_=!0,B={};if(o=o||[t],(u||g)&&h(e),u&&(l=i(u,e,n)),g&&(g=s(g.replace(w,"")),l||(B=x.parseOptions(e,{textField:"",valueField:"",template:"",valueUpdate:j,valuePrimitive:!1}),B.roles=n,l=new m(e,B)),l.source=t,c=a(g,o,f),B.template&&(c.template=new v(o,"",B.template)),c.click&&(g.events=g.events||{},g.events.click=g.click,delete c.click),c.source&&(_=!1),g.attr&&(c.attr=a(g.attr,o,f)),g.style&&(c.style=a(g.style,o,f)),g.events&&(c.events=a(g.events,o,b)),l.bind(c)),l&&(e.kendoBindingTarget=l),_&&p){for(d=0;di;i++)a=t[i],1===a.nodeType&&r(a,n,o)}function h(t){var n=t.kendoBindingTarget;n&&(n.destroy(),e.support.deleteExpando?delete t.kendoBindingTarget:t.removeAttribute?t.removeAttribute("kendoBindingTarget"):t.kendoBindingTarget=null)}function d(e){h(e),c(e)}function c(e){var t,n,i=e.children;if(i)for(t=0,n=i.length;n>t;t++)d(i[t])}function l(t){var n,i;for(t=e(t),n=0,i=t.length;i>n;n++)d(t[n])}function u(e,t){var n=e.element,i=n[0].kendoBindingTarget;i&&o(n,i.source,t)}var g,f,b,v,p,m,y,_,w,x=window.kendo,B=x.Observable,C=x.data.ObservableObject,k=x.data.ObservableArray,A={}.toString,F={},S=x.Class,O=e.proxy,T="value",N="source",D="events",I="checked",j="change";!function(){var e=document.createElement("a");e.innerText!==t?g="innerText":e.textContent!==t&&(g="textContent")}(),f=B.extend({init:function(e,t){var n=this;B.fn.init.call(n),n.source=e[0],n.parents=e,n.path=t,n.dependencies={},n.dependencies[t]=!0,n.observable=n.source instanceof B,n._access=function(e){n.dependencies[e.field]=!0},n.observable&&(n._change=function(e){n.change(e)},n.source.bind(j,n._change))},_parents:function(){var t,n=this.parents,i=this.get();return i&&"function"==typeof i.parent&&(t=i.parent(),e.inArray(t,n)<0&&(n=[t].concat(n))),n},change:function(e){var t,n,i=e.field,s=this;if("this"===s.path)s.trigger(j,e);else for(t in s.dependencies)if(0===t.indexOf(i)&&(n=t.charAt(i.length),!n||"."===n||"["===n)){s.trigger(j,e);break}},start:function(e){e.bind("get",this._access)},stop:function(e){e.unbind("get",this._access)},get:function(){var e=this,n=e.source,i=0,s=e.path,a=n;if(!e.observable)return a;for(e.start(e.source),a=n.get(s);a===t&&n;)n=e.parents[++i],n instanceof C&&(a=n.get(s));if(a===t)for(n=e.source;a===t&&n;)n=n.parent(),n instanceof C&&(a=n.get(s));return"function"==typeof a&&(i=s.lastIndexOf("."),i>0&&(n=n.get(s.substring(0,i))),e.start(n),a=a.call(n,e.source),e.stop(n)),n&&n!==e.source&&(e.currentSource=n,n.unbind(j,e._change).bind(j,e._change)),e.stop(e.source),a},set:function(e){var t=this,n=t.currentSource||t.source;n.set(t.path,e)},destroy:function(){this.observable&&this.source.unbind(j,this._change)}}),b=f.extend({get:function(){var e,t=this.source,n=this.path,i=0;for(e=t.get(n);!e&&t;)t=this.parents[++i],t instanceof C&&(e=t.get(n));return O(e,t)}}),v=f.extend({init:function(e,t,n){var i=this;f.fn.init.call(i,e,t),i.template=n},render:function(e){var t;return this.start(this.source),t=x.render(this.template,e),this.stop(this.source),t}}),p=S.extend({init:function(e,t,n){this.element=e,this.bindings=t,this.options=n},bind:function(e,t){var n=this;e=t?e[t]:e,e.bind(j,function(e){n.refresh(t||e)}),n.refresh(t)},destroy:function(){}}),F.attr=p.extend({refresh:function(e){this.element.setAttribute(e,this.bindings.attr[e].get())}}),F.style=p.extend({refresh:function(e){this.element.style[e]=this.bindings.style[e].get()||""}}),F.enabled=p.extend({refresh:function(){this.bindings.enabled.get()?this.element.removeAttribute("disabled"):this.element.setAttribute("disabled","disabled")}}),F.readonly=p.extend({refresh:function(){this.bindings.readonly.get()?this.element.setAttribute("readonly","readonly"):this.element.removeAttribute("readonly")}}),F.disabled=p.extend({refresh:function(){this.bindings.disabled.get()?this.element.setAttribute("disabled","disabled"):this.element.removeAttribute("disabled")}}),F.events=p.extend({init:function(e,t,n){p.fn.init.call(this,e,t,n),this.handlers={}},refresh:function(t){var n=e(this.element),i=this.bindings.events[t],s=this.handlers[t];s&&n.off(t,s),s=this.handlers[t]=i.get(),n.on(t,i.source,s)},destroy:function(){var t,n=e(this.element);for(t in this.handlers)n.off(t,this.handlers[t])}}),F.text=p.extend({refresh:function(){var e=this.bindings.text.get();null==e&&(e=""),this.element[g]=e}}),F.visible=p.extend({refresh:function(){this.element.style.display=this.bindings.visible.get()?"":"none"}}),F.invisible=p.extend({refresh:function(){this.element.style.display=this.bindings.invisible.get()?"none":""}}),F.html=p.extend({refresh:function(){this.element.innerHTML=this.bindings.html.get()}}),F.value=p.extend({init:function(t,n,i){p.fn.init.call(this,t,n,i),this._change=O(this.change,this),this.eventName=i.valueUpdate||j,e(this.element).on(this.eventName,this._change),this._initChange=!1},change:function(){this._initChange=this.eventName!=j,this.bindings[T].set(this.element.value),this._initChange=!1},refresh:function(){if(!this._initChange){var e=this.bindings[T].get();null==e&&(e=""),this.element.value=e}this._initChange=!1},destroy:function(){e(this.element).off(this.eventName,this._change)}}),F.source=p.extend({init:function(e,t,n){p.fn.init.call(this,e,t,n)},refresh:function(e){var t=this,n=t.bindings.source.get();n instanceof k?(e=e||{},"add"==e.action?t.add(e.index,e.items):"remove"==e.action?t.remove(e.index,e.items):"itemchange"!=e.action&&t.render()):t.render()},container:function(){var e=this.element;return"table"==e.nodeName.toLowerCase()&&(e.tBodies[0]||e.appendChild(document.createElement("tbody")),e=e.tBodies[0]),e},template:function(){var e=this.options,t=e.template,n=this.container().nodeName.toLowerCase();return t||(t="select"==n?e.valueField||e.textField?x.format('',e.valueField||e.textField,e.textField||e.valueField):"":"tbody"==n?"#:data#":"ul"==n||"ol"==n?"
  • #:data#
  • ":"#:data#",t=x.template(t)),t},destroy:function(){var e=this.bindings.source.get();e.unbind(j,this._change)},add:function(t,n){var i,s,a,o,h=this.container(),d=h.cloneNode(!1),c=h.children[t];if(e(d).html(x.render(this.template(),n)),d.children.length)for(i=this.bindings.source._parents(),s=0,a=n.length;a>s;s++)o=d.children[0],h.insertBefore(o,c||null),r(o,n[s],this.options.roles,[n[s]].concat(i))},remove:function(e,t){var n,i,s=this.container();for(n=0;nn;n++)r(o.children[n],a[n],this.options.roles,[a[n]].concat(t))}else e(o).html(x.render(h,a))}}),F.input={checked:p.extend({init:function(t,n,i){p.fn.init.call(this,t,n,i),this._change=O(this.change,this),e(this.element).change(this._change)},change:function(){var e,t,n=this.element,i=this.value();"radio"==n.type?this.bindings[I].set(i):"checkbox"==n.type&&(e=this.bindings[I].get(),e instanceof k?(i=this.element.value,"on"!==i&&"off"!==i&&(t=e.indexOf(i),t>-1?e.splice(t,1):e.push(i))):this.bindings[I].set(i))},refresh:function(){var e=this.bindings[I].get(),t=e,n=this.element;"checkbox"==n.type?(t instanceof k&&(e=this.element.value,t.indexOf(e)>=0&&(e=!0)),n.checked=e===!0):"radio"==n.type&&null!=e&&n.value===""+e&&(n.checked=!0)},value:function(){var e=this.element,t=e.value;return"checkbox"==e.type&&(t=e.checked),t},destroy:function(){e(this.element).off(j,this._change)}})},F.select={value:p.extend({init:function(t,n,i){p.fn.init.call(this,t,n,i),this._change=O(this.change,this),e(this.element).change(this._change)},change:function(){var e,t,n,i,s,a,r=[],o=this.element,h=this.options.valueField||this.options.textField,d=this.options.valuePrimitive;for(s=0,a=o.options.length;a>s;s++)t=o.options[s],t.selected&&(i=t.attributes.value,i=i&&i.specified?t.value:t.text,r.push(i));if(h)for(e=this.bindings.source.get(),n=0;ns;s++)if(e[s].get(h)==r[n]){r[n]=e[s];break}i=this.bindings[T].get(),i instanceof k?i.splice.apply(i,[0,i.length].concat(r)):d||!(i instanceof C)&&h?this.bindings[T].set(r[0].get(h)):this.bindings[T].set(r[0])},refresh:function(){var e,t,n,i=this.element,s=i.options,a=this.bindings[T].get(),r=a,o=this.options.valueField||this.options.textField,h=!1;for(r instanceof k||(r=new k([a])),i.selectedIndex=-1,n=0;ne;e++)d(i[e])},_ns:function(t){t=t||x.ui;var n=[x.ui,x.dataviz.ui,x.mobile.ui];return n.splice(e.inArray(t,n),1),n.unshift(t),x.rolesFromNamespaces(n)},dataBound:function(e){var t,i,s,a=this.widget,o=a.items(),h=a.dataSource,d=h.view(),c=h.group()||[];if(o.length)for(c.length&&(d=n(d)),s=this.bindings.source._parents(),t=0,i=d.length;i>t;t++)r(o[t],d[t],this._ns(e.ns),[d[t]].concat(s))},refresh:function(e){var t,n=this,i=n.widget;e=e||{},e.action||(n.destroy(),i.bind("dataBinding",n._dataBinding),i.bind("dataBound",n._dataBound),i.bind("itemChange",n._itemChange),t=n.bindings.source.get(),i.dataSource instanceof x.data.DataSource&&i.dataSource!=t&&(t instanceof x.data.DataSource?i.setDataSource(t):t&&t._dataSource?i.setDataSource(t._dataSource):i.dataSource.data(t)))},destroy:function(){var e=this.widget;e.unbind("dataBinding",this._dataBinding),e.unbind("dataBound",this._dataBound),e.unbind("itemChange",this._itemChange)}}),value:p.extend({init:function(t,n,i){p.fn.init.call(this,t.element[0],n,i),this.widget=t,this._change=e.proxy(this.change,this),this.widget.first(j,this._change);var s=this.bindings.value.get();this._valueIsObservableObject=!i.valuePrimitive&&(null==s||s instanceof C),this._valueIsObservableArray=s instanceof k,this._initChange=!1},change:function(){var e,t,n,i,s,a,r,o=this.widget.value(),h=this.options.dataValueField||this.options.dataTextField,d="[object Array]"===A.call(o),c=this._valueIsObservableObject,l=[];if(this._initChange=!0,h)if(this.bindings.source&&(r=this.bindings.source.get()),""===o&&(c||this.options.valuePrimitive))o=null;else{for((!r||r instanceof x.data.DataSource)&&(r=this.widget.dataSource.view()),d&&(t=o.length,l=o.slice(0)),s=0,a=r.length;a>s;s++)if(n=r[s],i=n.get(h),d){for(e=0;t>e;e++)if(i==l[e]){l[e]=n;break}}else if(i==o){o=c?n:i;break}l[0]&&(o=this._valueIsObservableArray?l:c||!h?l[0]:l[0].get(h))}this.bindings.value.set(o),this._initChange=!1},refresh:function(){if(!this._initChange){var e,t=this.options.dataValueField||this.options.dataTextField,n=this.bindings.value.get(),i=0,s=[];if(t)if(n instanceof k){for(e=n.length;e>i;i++)s[i]=n[i].get(t);n=s}else n instanceof C&&(n=n.get(t));this.widget.value(n)}this._initChange=!1},destroy:function(){this.widget.unbind(j,this._change)}}),multiselect:{value:p.extend({init:function(t,n,i){p.fn.init.call(this,t.element[0],n,i),this.widget=t,this._change=e.proxy(this.change,this),this.widget.first(j,this._change),this._initChange=!1},change:function(){var e=this,t=e.bindings[T].get(),n=e.options.valuePrimitive,i=n?e.widget.value():e.widget.dataItems();e._initChange=!0,t instanceof k?t.splice.apply(t,[0,t.length].concat(i)):e.bindings[T].set(i),e._initChange=!1},refresh:function(){if(!this._initChange){var e,t,n=this.options.dataValueField||this.options.dataTextField,i=this.bindings.value.get(),s=0,a=[];if(n)if(i instanceof k){for(e=i.length;e>s;s++)t=i[s],a[s]=t.get?t.get(n):t;i=a}else i instanceof C&&(i=i.get(n));this.widget.value(i)}},destroy:function(){this.widget.unbind(j,this._change)}})}},m=S.extend({init:function(e,t){this.target=e,this.options=t,this.toDestroy=[]},bind:function(e){var t,n,i,s,a=this.target.nodeName.toLowerCase(),r=F[a]||{};for(t in e)t==T?n=!0:t==N?i=!0:t==D?s=!0:this.applyBinding(t,e,r);i&&this.applyBinding(N,e,r),n&&this.applyBinding(T,e,r),s&&this.applyBinding(D,e,r)},applyBinding:function(e,t,n){var i,s=n[e]||F[e],a=this.toDestroy,r=t[e];if(s)if(s=new s(this.target,t,this.options),a.push(s),r instanceof f)s.bind(r),a.push(r);else for(i in r)s.bind(r,i),a.push(r[i]);else if("template"!==e)throw Error("The "+e+" binding is not supported by the "+this.target.nodeName.toLowerCase()+" element")},destroy:function(){var e,t,n=this.toDestroy;for(e=0,t=n.length;t>e;e++)n[e].destroy()}}),y=m.extend({bind:function(e){var t,n=this,i=!1,s=!1,a=F.widget[n.target.options.name.toLowerCase()]||{};for(t in e)t==T?i=!0:t==N?s=!0:n.applyBinding(t,e);s&&n.applyBinding(N,e),i&&n.applyBinding(T,e,a[T])},applyBinding:function(e,t,n){var i,s=n||F.widget[e],a=this.toDestroy,r=t[e];if(!s)throw Error("The "+e+" binding is not supported by the "+this.target.options.name+" widget");if(s=new s(this.target,t,this.target.options),a.push(s),r instanceof f)s.bind(r),a.push(r);else for(i in r)s.bind(r,i),a.push(r[i])}}),_=/[A-Za-z0-9_\-]+:(\{([^}]*)\}|[^,}]+)/g,w=/\s/g,x.unbind=l,x.bind=o,x.data.binders=F,x.data.Binder=p,x.notify=u,x.observable=function(e){return e instanceof C||(e=new C(e)),e},x.observableHierarchy=function(e){function t(e){var n,i;for(n=0;n