demo20230512/Scripts/kendo/2014.2.716/kendo.binder.min.js

16 lines
18 KiB
JavaScript
Raw Permalink Normal View History

2023-05-12 10:20:28 +08:00
/**
* 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","./kendo.data.min"],e)}(function(){return function(e,t){function n(t,n,i){return v.extend({init:function(e,t,n){var i=this;v.fn.init.call(i,e.element[0],t,n),i.widget=e,i._dataBinding=z(i.dataBinding,i),i._dataBound=z(i.dataBound,i),i._itemChange=z(i.itemChange,i)},itemChange:function(e){a(e.item[0],e.data,this._ns(e.ns),[e.data].concat(this.bindings[t]._parents()))},dataBinding:function(e){var t,n,i=this.widget,r=e.removedItems||i.items();for(t=0,n=r.length;n>t;t++)l(r[t])},_ns:function(t){t=t||S.ui;var n=[S.ui,S.dataviz.ui,S.mobile.ui];return n.splice(e.inArray(t,n),1),n.unshift(t),S.rolesFromNamespaces(n)},dataBound:function(e){{var i,r,o,s,u=this.widget,l=e.addedItems||u.items(),d=u[n];d.group()||[]}if(l.length)for(o=e.addedDataItems||d.flatView(),s=this.bindings[t]._parents(),i=0,r=o.length;r>i;i++)a(l[i],o[i],this._ns(e.ns),[o[i]].concat(s))},refresh:function(e){var r,o=this,a=o.widget;e=e||{},e.action||(o.destroy(),a.bind("dataBinding",o._dataBinding),a.bind("dataBound",o._dataBound),a.bind("itemChange",o._itemChange),r=o.bindings[t].get(),a[n]instanceof S.data.DataSource&&a[n]!=r&&(r instanceof S.data.DataSource?a[i](r):r&&r._dataSource?a[i](r._dataSource):a[n].data(r)))},destroy:function(){var e=this.widget;e.unbind("dataBinding",this._dataBinding),e.unbind("dataBound",this._dataBound),e.unbind("itemChange",this._itemChange)}})}function i(e,n){var i=S.initWidget(e,{},n);return i?new b(i):t}function r(e){var t,n,i,o,a,s,u,l={};for(u=e.match(w),t=0,n=u.length;n>t;t++)i=u[t],o=i.indexOf(":"),a=i.substring(0,o),s=i.substring(o+1),"{"==s.charAt(0)&&(s=r(s)),l[a]=s;return l}function o(e,t,n){var i,r={};for(i in e)r[i]=new n(t,e[i]);return r}function a(e,t,n,s){var l,d,c,f=e.getAttribute("data-"+S.ns+"role"),h=e.getAttribute("data-"+S.ns+"bind"),v=e.children,y=[],b=!0,w={};if(s=s||[t],(f||h)&&u(e),f&&(c=i(e,n)),h&&(h=r(h.replace(x,"")),c||(w=S.parseOptions(e,{textField:"",valueField:"",template:"",valueUpdate:E,valuePrimitive:!1,autoBind:!0}),w.roles=n,c=new _(e,w)),c.source=t,d=o(h,s,g),w.template&&(d.template=new m(s,"",w.template)),d.click&&(h.events=h.events||{},h.events.click=h.click,d.click.destroy(),delete d.click),d.source&&(b=!1),h.attr&&(d.attr=o(h.attr,s,g)),h.style&&(d.style=o(h.style,s,g)),h.events&&(d.events=o(h.events,s,p)),c.bind(d)),c&&(e.kendoBindingTarget=c),b&&v){for(l=0;v.length>l;l++)y[l]=v[l];for(l=0;y.length>l;l++)a(y[l],t,n,s)}}function s(t,n){var i,r,o,s=S.rolesFromNamespaces([].slice.call(arguments,2));for(n=S.observable(n),t=e(t),i=0,r=t.length;r>i;i++)o=t[i],1===o.nodeType&&a(o,n,s)}function u(e){var t=e.kendoBindingTarget;t&&(t.destroy(),H?delete e.kendoBindingTarget:e.removeAttribute?e.removeAttribute("kendoBindingTarget"):e.kendoBindingTarget=null)}function l(e){u(e),d(e)}function d(e){var t,n,i=e.children;if(i)for(t=0,n=i.length;n>t;t++)l(i[t])}function c(t){var n,i;for(t=e(t),n=0,i=t.length;i>n;n++)l(t[n])}function f(e,t){var n=e.element,i=n[0].kendoBindingTarget;i&&s(n,i.source,t)}var h,g,p,m,v,y,_,b,w,x,S=window.kendo,M=S.Observable,k=S.data.ObservableObject,T=S.data.ObservableArray,C={}.toString,O={},D=S.Class,z=e.proxy,A="value",P="source",F="events",N="checked",H=!0,E="change";!function(){var e=document.createElement("a");e.innerText!==t?h="innerText":e.textContent!==t&&(h="textContent");try{delete e.test}catch(n){H=!1}}(),g=M.extend({init:function(e,t){var n=this;M.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 M,n._access=function(e){n.dependencies[e.field]=!0},n.observable&&(n._change=function(e){n.change(e)},n.source.bind(E,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,r=this;if("this"===r.path)r.trigger(E,e);else for(t in r.dependencies)if(0===t.indexOf(i)&&(n=t.charAt(i.length),!n||"."===n||"["===n)){r.trigger(E,e);break}},start:function(e){e.bind("get",this._access)},stop:function(e){e.unbind("get",this.