diff --git a/build/web/kendo.backbone.js b/build/web/kendo.backbone.js index 5acefd5..b38d7f2 100644 --- a/build/web/kendo.backbone.js +++ b/build/web/kendo.backbone.js @@ -1,6 +1,6 @@ // Kendo-Backbone // -------------- -// v0.0.5 +// v0.0.6 // // Copyright (c)2013 Telerik. All Rights Reserved. // Distributed under Apache 2.0 license @@ -312,29 +312,45 @@ kendo.Backbone.DataSource = (function($, kendo, _) { kendo.Backbone.ViewEvents = (function($, kendo, Backbone, _) { var eventSplitter = /^(\S+)\s*(.*)$/; + var eventConfigName = "kendoUIEvents"; + + var m; var ViewEvents = { delegate: function(view) { - var webEvents = _.result(view, 'kendoUIWeb'); - if (webEvents){ - this._delegateEvents(view, webEvents, kendo.ui); - } + this._processEvents(view, function(widget, eventName, method){ + m = method; + widget.bind(eventName, method); + }); + }, + + undelegate: function(view){ + this._processEvents(view, function(widget, eventName, method){ + widget.unbind(eventName); + }); }, - _delegateEvents: function(view, events, namespace){ + _processEvents: function(view, cb){ + var events = _.result(view, eventConfigName); + if (!events){ return; } + for (var key in events) { var method = events[key]; - if (!_.isFunction(method)) { method = view[events[key]]; } + if (!_.isFunction(method)) { method = view[method]; } if (!method) { continue; } var match = key.match(eventSplitter); var eventName = match[1], selector = match[2]; method = _.bind(method, view); - var widget = kendo.widgetInstance(view.$(selector), kendo.ui); - widget.bind(eventName, method); + var element = view.$(selector); + var widget = kendo.widgetInstance(element, kendo.ui) || + kendo.widgetInstance(element, kendo.mobile.ui) || + kendo.widgetInstance(element, kendo.dataviz.ui); + + cb.call(this, widget, eventName, method); } } }; diff --git a/build/web/kendo.backbone.map b/build/web/kendo.backbone.map index ffca73f..a67db7b 100644 --- a/build/web/kendo.backbone.map +++ b/build/web/kendo.backbone.map @@ -1 +1 @@ -{"version":3,"file":"build/web/kendo.backbone.min.js","sources":["kendo.backbone.js"],"names":["global","kendo","Backbone","wrapBackboneModel","BackboneModel","fields","Model","define","init","model","fn","call","this","toJSON","backbone","set","field","value","data","backboneModel","wrapBackboneCollection","ObservableArray","extend","collection","models","splice","itemsToInsert","idx","length","Array","prototype","slice","arguments","removedItems","apply","remove","unshift","backboneCollection","BackboneTransport","Transport","colWrap","_","create","options","success","read","update","get","id","destroy","CollectionAdapter","Adapter","dataSource","listenTo","_addToDataSource","_removeFromDataSource","_resetDataSource","Events","cb","addFromCol","addFromDS","wait","add","dsModel","DataSource","$","setupDefaultSchema","target","defaults","schema","getPrototypeOf","idAttribute","Object","__proto__","constructor","bbtrans","transport","ViewEvents","eventSplitter","delegate","view","webEvents","result","_delegateEvents","ui","events","key","method","isFunction","match","eventName","selector","bind","widget","widgetInstance","jQuery"],"mappings":"CASA,SAAUA,EAAQC,GAChB,YAIAA,GAAMC,SAAWD,EAAMC,aAMzB,WAGE,QAASC,GAAkBC,EAAeC,GACxC,MAAOC,GAAMC,QACXF,OAAQA,EACRG,KAAM,SAASC,GACPA,YAAiBL,KACrBK,EAAQ,GAAIL,GAAcK,IAG5BH,EAAMI,GAAGF,KAAKG,KAAKC,KAAMH,EAAMI,UAC/BD,KAAKE,SAAWL,GAElBM,IAAK,SAASC,EAAOC,GACnBX,EAAMI,GAAGK,IAAIJ,KAAKC,KAAMI,EAAOC,GAE/BL,KAAKE,SAASC,IAAIC,EAAOC,MAhB/B,GAAIX,GAAQL,EAAMiB,KAAKZ,KAqBvBL,GAAMkB,cAAgBhB,KAOxB,WAKE,QAASiB,GAAuBX,GAC9B,MAAOY,GAAgBC,QACrBd,KAAM,SAASe,GACbF,EAAgBX,GAAGF,KAAKG,KAAKC,KAAMW,EAAWC,OAAQf,GAEtDG,KAAKW,WAAaA,GAGpBE,OAAQ,WACN,GAAIC,GAA6BC,EAAKC,CAEtCF,GAAgBG,MAAMC,UAAUC,MAAMpB,KAAKqB,UAAW,EAEtD,IAAIC,GAAehC,EAAMiB,KAAKG,gBAAgBX,GAAGe,OAAOS,MAAMtB,KAAMoB,UAEpE,IAAIC,EAAaL,OACf,IAAKD,EAAM,EAAGC,EAASK,EAAaL,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uB,EAAmBvB,EAASpB,GACtCtB,EAAMiB,KAAK8C,WAAWlC,UAAUtB,KAAKG,KAAKC,KAAM+B,KAgCpD,OAAOqB,IACNC,EAAGhE,EAAOwC,GAkBbxC,EAAMC,SAAS2E,WAAa,SAAUZ,EAAGhE,EAAOC,EAAUuC,GACxD,GAAIqC,GAAgB,iBAEhBD,GAEFE,SAAU,SAASC,GACjB,GAAIC,GAAYxC,EAAEyC,OAAOF,EAAM,aAC3BC,IACFrE,KAAKuE,gBAAgBH,EAAMC,EAAWhF,EAAMmF,KAIhDD,gBAAiB,SAASH,EAAMK,GAC9B,IAAK,GAAIC,KAAOD,GAAQ,CACtB,GAAIE,GAASF,EAAOC,EAGpB,IADK7C,EAAE+C,WAAWD,KAAWA,EAASP,EAAKK,EAAOC,KAC7CC,EAAL,CAEA,GAAIE,GAAQH,EAAIG,MAAMX,GAClBY,EAAYD,EAAM,GAAIE,EAAWF,EAAM,EAC3CF,GAAS9C,EAAEmD,KAAKL,EAAQP,EAExB,IAAIa,GAAS5F,EAAM6F,eAAed,EAAKf,EAAE0B,GAAW1F,EAAMmF,GAC1DS,GAAOD,KAAKF,EAAWH,MAK7B,OAAOV,IACNkB,OAAQ9F,EAAOC,SAAUuC,KAGzB7B,KAAMX"} \ No newline at end of file +{"version":3,"file":"build/web/kendo.backbone.min.js","sources":["kendo.backbone.js"],"names":["global","kendo","Backbone","wrapBackboneModel","BackboneModel","fields","Model","define","init","model","fn","call","this","toJSON","backbone","set","field","value","data","backboneModel","wrapBackboneCollection","ObservableArray","extend","collection","models","splice","itemsToInsert","idx","length","Array","prototype","slice","arguments","removedItems","apply","remove","unshift","backboneCollection","BackboneTransport","Transport","colWrap","_","create","options","success","read","update","get","id","destroy","CollectionAdapter","Adapter","dataSource","listenTo","_addToDataSource","_removeFromDataSource","_resetDataSource","Events","cb","addFromCol","addFromDS","wait","add","dsModel","DataSource","$","setupDefaultSchema","target","defaults","schema","getPrototypeOf","idAttribute","Object","__proto__","constructor","bbtrans","transport","ViewEvents","m","eventSplitter","eventConfigName","delegate","view","_processEvents","widget","eventName","method","bind","undelegate","unbind","events","result","key","isFunction","match","selector","element","widgetInstance","ui","mobile","dataviz","jQuery"],"mappings":"CASA,SAAUA,EAAQC,GAChB,YAIAA,GAAMC,SAAWD,EAAMC,aAMzB,WAGE,QAASC,GAAkBC,EAAeC,GACxC,MAAOC,GAAMC,QACXF,OAAQA,EACRG,KAAM,SAASC,GACPA,YAAiBL,KACrBK,EAAQ,GAAIL,GAAcK,IAG5BH,EAAMI,GAAGF,KAAKG,KAAKC,KAAMH,EAAMI,UAC/BD,KAAKE,SAAWL,GAElBM,IAAK,SAASC,EAAOC,GACnBX,EAAMI,GAAGK,IAAIJ,KAAKC,KAAMI,EAAOC,GAE/BL,KAAKE,SAASC,IAAIC,EAAOC,MAhB/B,GAAIX,GAAQL,EAAMiB,KAAKZ,KAqBvBL,GAAMkB,cAAgBhB,KAOxB,WAKE,QAASiB,GAAuBX,GAC9B,MAAOY,GAAgBC,QACrBd,KAAM,SAASe,GACbF,EAAgBX,GAAGF,KAAKG,KAAKC,KAAMW,EAAWC,OAAQf,GAEtDG,KAAKW,WAAaA,GAGpBE,OAAQ,WACN,GAAIC,GAA6BC,EAAKC,CAEtCF,GAAgBG,MAAMC,UAAUC,MAAMpB,KAAKqB,UAAW,EAEtD,IAAIC,GAAehC,EAAMiB,KAAKG,gBAAgBX,GAAGe,OAAOS,MAAMtB,KAAMoB,UAEpE,IAAIC,EAAaL,OACf,IAAKD,EAAM,EAAGC,EAASK,EAAaL,OAAcA,EAAND,EAAcA,IACxDf,KAAKW,WAAWY,OAAOF,EAAaN,GAAKb,SAI7C,IAAIY,EAAcE,OAChB,IAAKD,EAAM,EAAGC,EAASF,EAAcE,OAAcA,EAAND,EAAcA,IACzDf,KAAKW,WAAWa,QAAQV,EAAcC,GAAKb,SAI/C,OAAOmB,MA9Bb,GACAZ,IADYpB,EAAMiB,KAAKZ,MACLL,EAAMiB,KAAKG,gBA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,KAAKuE,eAAeD,EAAM,SAASE,EAAQC,EAAWC,GACpDR,EAAIQ,EACJF,EAAOG,KAAKF,EAAWC,MAI3BE,WAAY,SAASN,GACnBtE,KAAKuE,eAAeD,EAAM,SAASE,EAAQC,GACzCD,EAAOK,OAAOJ,MAIlBF,eAAgB,SAASD,EAAMxB,GAC7B,GAAIgC,GAASjD,EAAEkD,OAAOT,EAAMF,EAC5B,IAAKU,EAEL,IAAK,GAAIE,KAAOF,GAAQ,CACtB,GAAIJ,GAASI,EAAOE,EAGpB,IADKnD,EAAEoD,WAAWP,KAAWA,EAASJ,EAAKI,IACtCA,EAAL,CAEA,GAAIQ,GAAQF,EAAIE,MAAMf,GAClBM,EAAYS,EAAM,GAAIC,EAAWD,EAAM,EAC3CR,GAAS7C,EAAE8C,KAAKD,EAAQJ,EAExB,IAAIc,GAAUd,EAAKjB,EAAE8B,GACjBX,EAASnF,EAAMgG,eAAeD,EAAS/F,EAAMiG,KACpCjG,EAAMgG,eAAeD,EAAS/F,EAAMkG,OAAOD,KAC3CjG,EAAMgG,eAAeD,EAAS/F,EAAMmG,QAAQF,GAEzDxC,GAAG/C,KAAKC,KAAMwE,EAAQC,EAAWC,MAKvC,OAAOT,IACNwB,OAAQpG,EAAOC,SAAUuC,KAGzB7B,KAAMX"} \ No newline at end of file diff --git a/build/web/kendo.backbone.min.js b/build/web/kendo.backbone.min.js index 15ef860..62f7d63 100644 --- a/build/web/kendo.backbone.min.js +++ b/build/web/kendo.backbone.min.js @@ -1,11 +1,11 @@ // Kendo-Backbone // -------------- -// v0.0.5 +// v0.0.6 // // Copyright (c)2013 Telerik. All Rights Reserved. // Distributed under Apache 2.0 license // // http://kendoui.com -(function(t,e){"use strict";e.Backbone=e.Backbone||{},function(){function t(t,e){return o.define({fields:e,init:function(e){e instanceof t||(e=new t(e)),o.fn.init.call(this,e.toJSON()),this.backbone=e},set:function(t,e){o.fn.set.call(this,t,e),this.backbone.set(t,e)}})}var o=e.data.Model;e.backboneModel=t}(),function(){function t(t){return o.extend({init:function(e){o.fn.init.call(this,e.models,t),this.collection=e},splice:function(){var t,o,n;t=Array.prototype.slice.call(arguments,2);var a=e.data.ObservableArray.fn.splice.apply(this,arguments);if(a.length)for(o=0,n=a.length;n>o;o++)this.collection.remove(a[o].backbone);if(t.length)for(o=0,n=t.length;n>o;o++)this.collection.unshift(t[o].backbone);return a}})}var o=(e.data.Model,e.data.ObservableArray);e.backboneCollection=t}(),e.Backbone.BackboneTransport=function(){function t(t){this.colWrap=t}return _.extend(t.prototype,{create:function(t){var e=t.data;this.colWrap.create(e,function(e){t.success(e)})},read:function(t){t.success(this.colWrap.collection.toJSON())},update:function(t){var e=this.colWrap.collection.get(t.data.id);e.set(t.data),t.success(t.data)},destroy:function(t){var e=this.colWrap.collection.get(t.data.id);this.colWrap.collection.remove(e),t.success(t.data)}}),t}(),e.Backbone.CollectionAdapter=function(){function t(t,e){this.collection=t,this.dataSource=e,this.listenTo(this.collection,"add",this._addToDataSource),this.listenTo(this.collection,"remove",this._removeFromDataSource),this.listenTo(this.collection,"reset",this._resetDataSource)}return _.extend(t.prototype,Backbone.Events,{create:function(t,e){this.addFromCol?e(t):(this.addFromDS=!0,t.id||(t.id=null),this.collection.create(t,{wait:!0,success:function(t){e(t.toJSON())}}),this.addFromDS=!1)},_addToDataSource:function(t){if(!this.addFromDS){this.addFromCol=!0;var e=t.toJSON();this.dataSource.add(e),this.addFromCol=!1}},_removeFromDataSource:function(t){var e=this.dataSource.get(t.id);e&&this.dataSource.remove(e)},_resetDataSource:function(){this.dataSource.read()}}),t}(),e.Backbone.DataSource=function(t,e,o){function n(t,e){return o.defaults(t,{schema:{}}),o.defaults(t.schema,{model:{}}),o.defaults(t.schema.model,{id:a(e).model.prototype.idAttribute||"id"}),t}function a(t){return Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__||t.constructor.prototype}var i=e.data.DataSource.extend({init:function(t){var a=t.collection,i=new e.Backbone.CollectionAdapter(a,this),c=new e.Backbone.BackboneTransport(i);o.defaults(t,{transport:c}),t=n(t,a),e.data.DataSource.prototype.init.call(this,t)}});return i}($,e,_),e.Backbone.ViewEvents=function(t,e,o,n){var a=/^(\S+)\s*(.*)$/,i={delegate:function(t){var o=n.result(t,"kendoUIWeb");o&&this._delegateEvents(t,o,e.ui)},_delegateEvents:function(t,o){for(var i in o){var c=o[i];if(n.isFunction(c)||(c=t[o[i]]),c){var r=i.match(a),s=r[1],l=r[2];c=n.bind(c,t);var d=e.widgetInstance(t.$(l),e.ui);d.bind(s,c)}}}};return i}(jQuery,e,Backbone,_)})(this,kendo); +(function(t,e){"use strict";e.Backbone=e.Backbone||{},function(){function t(t,e){return o.define({fields:e,init:function(e){e instanceof t||(e=new t(e)),o.fn.init.call(this,e.toJSON()),this.backbone=e},set:function(t,e){o.fn.set.call(this,t,e),this.backbone.set(t,e)}})}var o=e.data.Model;e.backboneModel=t}(),function(){function t(t){return o.extend({init:function(e){o.fn.init.call(this,e.models,t),this.collection=e},splice:function(){var t,o,n;t=Array.prototype.slice.call(arguments,2);var a=e.data.ObservableArray.fn.splice.apply(this,arguments);if(a.length)for(o=0,n=a.length;n>o;o++)this.collection.remove(a[o].backbone);if(t.length)for(o=0,n=t.length;n>o;o++)this.collection.unshift(t[o].backbone);return a}})}var o=(e.data.Model,e.data.ObservableArray);e.backboneCollection=t}(),e.Backbone.BackboneTransport=function(){function t(t){this.colWrap=t}return _.extend(t.prototype,{create:function(t){var e=t.data;this.colWrap.create(e,function(e){t.success(e)})},read:function(t){t.success(this.colWrap.collection.toJSON())},update:function(t){var e=this.colWrap.collection.get(t.data.id);e.set(t.data),t.success(t.data)},destroy:function(t){var e=this.colWrap.collection.get(t.data.id);this.colWrap.collection.remove(e),t.success(t.data)}}),t}(),e.Backbone.CollectionAdapter=function(){function t(t,e){this.collection=t,this.dataSource=e,this.listenTo(this.collection,"add",this._addToDataSource),this.listenTo(this.collection,"remove",this._removeFromDataSource),this.listenTo(this.collection,"reset",this._resetDataSource)}return _.extend(t.prototype,Backbone.Events,{create:function(t,e){this.addFromCol?e(t):(this.addFromDS=!0,t.id||(t.id=null),this.collection.create(t,{wait:!0,success:function(t){e(t.toJSON())}}),this.addFromDS=!1)},_addToDataSource:function(t){if(!this.addFromDS){this.addFromCol=!0;var e=t.toJSON();this.dataSource.add(e),this.addFromCol=!1}},_removeFromDataSource:function(t){var e=this.dataSource.get(t.id);e&&this.dataSource.remove(e)},_resetDataSource:function(){this.dataSource.read()}}),t}(),e.Backbone.DataSource=function(t,e,o){function n(t,e){return o.defaults(t,{schema:{}}),o.defaults(t.schema,{model:{}}),o.defaults(t.schema.model,{id:a(e).model.prototype.idAttribute||"id"}),t}function a(t){return Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__||t.constructor.prototype}var i=e.data.DataSource.extend({init:function(t){var a=t.collection,i=new e.Backbone.CollectionAdapter(a,this),c=new e.Backbone.BackboneTransport(i);o.defaults(t,{transport:c}),t=n(t,a),e.data.DataSource.prototype.init.call(this,t)}});return i}($,e,_),e.Backbone.ViewEvents=function(t,e,o,n){var a,i=/^(\S+)\s*(.*)$/,c="kendoUIEvents",r={delegate:function(t){this._processEvents(t,function(t,e,o){a=o,t.bind(e,o)})},undelegate:function(t){this._processEvents(t,function(t,e){t.unbind(e)})},_processEvents:function(t,o){var a=n.result(t,c);if(a)for(var r in a){var s=a[r];if(n.isFunction(s)||(s=t[s]),s){var l=r.match(i),u=l[1],d=l[2];s=n.bind(s,t);var f=t.$(d),h=e.widgetInstance(f,e.ui)||e.widgetInstance(f,e.mobile.ui)||e.widgetInstance(f,e.dataviz.ui);o.call(this,h,u,s)}}}};return r}(jQuery,e,Backbone,_)})(this,kendo); //@ sourceMappingURL=kendo.backbone.map \ No newline at end of file