Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rniemeyer/knockout-kendo
base: 120a8b8fa6
...
head fork: rniemeyer/knockout-kendo
compare: edadabc49c
  • 4 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
Commits on Aug 09, 2012
@bgrohman bgrohman Updated to support loading Knockout using AMD 52ebaa2
Commits on Aug 13, 2012
@bgrohman bgrohman CommonJS and AMD support
Added intro and outro wrappers for loading dependencies with CommonJS
and AMD.
95e7fcb
Commits on Aug 15, 2012
@bgrohman bgrohman Added Kendo to the required modules 948373a
Commits on Aug 17, 2012
@rniemeyer #24 - AMD Support. Move intro/outro to knockout-kendo file, so they w…
…ere not invalid js files. Update version.
edadabc
View
9 build.json
@@ -6,15 +6,12 @@
"lint": {},
"uglify": {},
"gzip": false,
- "wrap": {
- "prefix": "(function(ko, $, undefined) {",
- "suffix": "})(ko, jQuery);"
- },
+ "wrap": {},
"finalize": {
- "header": "//knockout-kendo v0.3.0 | (c) 2012 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license\n"
+ "header": "//knockout-kendo v0.3.5 | (c) 2012 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license\n"
},
"hosts": {
"/examples": "./examples",
"/build": "./build"
}
-}
+}
View
18 build/knockout-kendo.js
@@ -1,5 +1,17 @@
-//knockout-kendo v0.3.0 | (c) 2012 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
-(function(ko, $, undefined) {ko.kendo = ko.kendo || {};
+//knockout-kendo v0.3.5 | (c) 2012 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
+(function(factory) {
+ // CommonJS
+ if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
+ factory(require('knockout'), require('jquery'), require('kendo'));
+ // AMD
+ } else if (typeof define === 'function' && define.amd) {
+ define(['knockout', 'jquery', 'kendo'], factory);
+ // Normal script tag
+ } else {
+ factory(window.ko, window.jQuery, window.kendo);
+ }
+}(function(ko, $, kendo, undefined) {
+ko.kendo = ko.kendo || {};
ko.kendo.BindingFactory = function() {
var self = this;
@@ -577,4 +589,4 @@ createBinding({
scale: extendAndRedraw("scale")
}
});
-})(ko, jQuery);
+}));
View
4 build/knockout-kendo.min.js
@@ -1,2 +1,2 @@
-//knockout-kendo v0.3.0 | (c) 2012 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
-(function(ko,$,undefined){ko.kendo=ko.kendo||{},ko.kendo.BindingFactory=function(){var self=this;this.createBinding=function(widgetConfig){if(!$()[widgetConfig.parent||widgetConfig.name])return;var binding={};binding.init=function(element,valueAccessor){var options=self.buildOptions(widgetConfig,valueAccessor);if(options.async===!0||widgetConfig.async===!0&&options.async!==!1){setTimeout(function(){binding.setup(element,options)},0);return}binding.setup(element,options)},binding.setup=function(element,options){var widget,$element=$(element);widget=self.getWidget(widgetConfig,options,$element),self.handleEvents(options,widgetConfig,element,widget),self.watchValues(widget,options,widgetConfig,element),widget.destroy&&ko.utils.domNodeDisposal.addDisposeCallback(element,function(){widget.destroy()})},binding.options={},binding.widgetConfig=widgetConfig,ko.bindingHandlers[widgetConfig.bindingName||widgetConfig.name]=binding},this.buildOptions=function(widgetConfig,valueAccessor){var defaultOption=widgetConfig.defaultOption,options=ko.utils.extend({},ko.bindingHandlers[widgetConfig.name].options),valueOrOptions=ko.utils.unwrapObservable(valueAccessor());return typeof valueOrOptions!="object"||defaultOption&&!(defaultOption in valueOrOptions)?options[defaultOption]=valueAccessor():ko.utils.extend(options,valueOrOptions),options},this.getWidget=function(widgetConfig,options,$element){var widget;if(widgetConfig.parent){var parent=$element.closest("[data-bind*='"+widgetConfig.parent+":']");widget=parent.length?parent.data(widgetConfig.parent):null}else widget=$element[widgetConfig.name](ko.toJS(options)).data(widgetConfig.name);return ko.isObservable(options.widget)&&options.widget(widget),widget},this.watchValues=function(widget,options,widgetConfig,element){var watchProp,watchValues=widgetConfig.watch;if(watchValues)for(watchProp in watchValues)watchValues.hasOwnProperty(watchProp)&&self.watchOneValue(watchProp,widget,options,widgetConfig,element)},this.watchOneValue=function(prop,widget,options,widgetConfig,element){var computed=ko.computed({read:function(){var action=widgetConfig.watch[prop],value=ko.utils.unwrapObservable(options[prop]),params=widgetConfig.parent?[element]:[],existing;$.isArray(action)?action=widget[value?action[0]:action[1]]:typeof action=="string"&&(action=widget[action]),action&&(existing=action.apply(widget,params),existing!==value&&(params.push(value),action.apply(widget,params)))},disposeWhenNodeIsRemoved:element});ko.isObservable(options[prop])||computed.dispose()},this.handleEvents=function(options,widgetConfig,element,widget){var prop,event,events=widgetConfig.events;if(events)for(prop in events)events.hasOwnProperty(prop)&&(event=events[prop],typeof event=="string"&&(event={value:event,writeTo:event}),ko.isObservable(options[event.writeTo])&&self.handleOneEvent(prop,event,options,element,widget,widgetConfig.childProp))},this.handleOneEvent=function(eventName,eventConfig,options,element,widget,childProp){widget.bind(eventName,function(e){var propOrValue,value;if(!childProp||!e[childProp]||e[childProp]===element)propOrValue=eventConfig.value,value=typeof propOrValue=="string"&&this[propOrValue]?this[propOrValue](childProp&&element):propOrValue,options[eventConfig.writeTo](value)})}},ko.kendo.bindingFactory=new ko.kendo.BindingFactory,ko.kendo.setDataSource=function(widget,data){widget.dataSource.data(ko.mapping?ko.mapping.toJS(data||{}):ko.toJS(data))};var extendAndRedraw=function(prop){return function(value){value&&(ko.utils.extend(this.options[prop],value),this.redraw(),this.value(.001+this.value()))}},createBinding=ko.kendo.bindingFactory.createBinding.bind(ko.kendo.bindingFactory),CLOSE="close",COLLAPSE="collapse",CONTENT="content",DATA="data",DISABLE="disable",ENABLE="enable",EXPAND="expand",ENABLED="enabled",EXPANDED="expanded",ISOPEN="isOpen",MAX="max",MIN="min",OPEN="open",RESIZE="resize",SEARCH="search",SELECT="select",SELECTED="selected",SIZE="size",TITLE="title",VALUE="value",VALUES="values";createBinding({name:"kendoAutoComplete",events:{change:VALUE,open:{writeTo:ISOPEN,value:!0},close:{writeTo:ISOPEN,value:!1}},watch:{enabled:ENABLE,search:[SEARCH,CLOSE],data:function(value){ko.kendo.setDataSource(this,value)},value:VALUE}}),createBinding({name:"kendoCalendar",defaultOption:VALUE,events:{change:VALUE},watch:{max:MAX,min:MIN,value:VALUE}}),createBinding({name:"kendoComboBox",events:{change:VALUE,open:{writeTo:ISOPEN,value:!0},close:{writeTo:ISOPEN,value:!1}},watch:{enabled:ENABLE,isOpen:[OPEN,CLOSE],data:function(value){ko.kendo.setDataSource(this,value)},value:VALUE}}),createBinding({name:"kendoDatePicker",defaultOption:VALUE,events:{change:VALUE,open:{writeTo:ISOPEN,value:!0},close:{writeTo:ISOPEN,value:!1}},watch:{enabled:ENABLE,max:MAX,min:MIN,value:VALUE,isOpen:[OPEN,VALUE]}}),createBinding({name:"kendoDropDownList",events:{change:VALUE,open:{writeTo:ISOPEN,value:!0},close:{writeTo:ISOPEN,value:!1}},watch:{enabled:ENABLE,isOpen:[OPEN,CLOSE],data:function(value){ko.kendo.setDataSource(this,value)},value:VALUE}}),createBinding({name:"kendoEditor",defaultOption:VALUE,events:{change:VALUE},watch:{enabled:ENABLE,value:VALUE}}),createBinding({name:"kendoGrid",defaultOption:DATA,watch:{data:function(value){ko.kendo.setDataSource(this,value)}}}),createBinding({name:"kendoListView",defaultOption:DATA,watch:{data:function(value){ko.kendo.setDataSource(this,value)}}}),createBinding({name:"kendoMenu",async:!0}),createBinding({name:"kendoMenuItem",parent:"kendoMenu",watch:{enabled:ENABLE,isOpen:[OPEN,CLOSE]},async:!0}),createBinding({name:"kendoNumericTextBox",defaultOption:VALUE,events:{change:VALUE},watch:{enabled:ENABLE,value:VALUE,max:function(newMax){this.options.max=newMax,this.value()>newMax&&this.value(newMax)},min:function(newMin){this.options.min=newMin,this.value()<newMin&&this.value(newMin)}}}),createBinding({name:"kendoPanelBar",async:!0}),createBinding({name:"kendoPanelItem",parent:"kendoPanelBar",watch:{enabled:ENABLE,expanded:[EXPAND,COLLAPSE]},childProp:"item",events:{expand:{writeTo:EXPANDED,value:!0},collapse:{writeTo:EXPANDED,value:!1}},async:!0}),createBinding({name:"kendoRangeSlider",defaultOption:VALUES,events:{change:VALUES},watch:{values:VALUES,enabled:[ENABLE,DISABLE]}}),createBinding({name:"kendoSlider",defaultOption:VALUE,events:{change:VALUE},watch:{value:VALUE,enabled:[ENABLE,DISABLE]}}),createBinding({name:"kendoSplitter",async:!0}),createBinding({name:"kendoSplitterPane",parent:"kendoSplitter",watch:{max:MAX,min:MIN,size:SIZE,expanded:[EXPAND,COLLAPSE]},childProp:"pane",events:{collapse:{writeTo:EXPANDED,value:!1},expand:{writeTo:EXPANDED,value:!0},resize:SIZE},async:!0}),createBinding({name:"kendoTabStrip",async:!0}),createBinding({name:"kendoTab",parent:"kendoTabStrip",watch:{selected:function(element,value){this.select(value?element:null)},enabled:ENABLE},childProp:"item",events:{selected:{writeTo:SELECTED,value:!0}},async:!0}),createBinding({name:"kendoTimePicker",defaultOption:VALUE,events:{change:VALUE},watch:{max:MAX,min:MIN,value:VALUE,enabled:ENABLE,isOpen:[OPEN,CLOSE]}}),createBinding({name:"kendoTreeView",async:!0}),createBinding({name:"kendoTreeItem",parent:"kendoTreeView",watch:{enabled:ENABLE,expanded:[EXPAND,COLLAPSE],selected:function(element,value){this.select(value?element:null)}},childProp:"node",events:{collapse:{writeTo:EXPANDED,value:!1},expand:{writeTo:EXPANDED,value:!0},select:{writeTo:SELECTED,value:!0}},async:!0}),createBinding({name:"kendoUpload",watch:{enabled:[ENABLE,DISABLE]}}),createBinding({async:!0,name:"kendoWindow",events:{open:{writeTo:ISOPEN,value:!0},close:{writeTo:ISOPEN,value:!1}},watch:{content:CONTENT,title:TITLE,isOpen:[OPEN,CLOSE]}}),createBinding({name:"kendoChart",watch:{data:function(value){ko.kendo.setDataSource(this,value)}}}),createBinding({name:"kendoLinearGauge",defaultOption:VALUE,watch:{value:VALUE,gaugeArea:extendAndRedraw("gaugeArea"),pointer:extendAndRedraw("pointer"),scale:extendAndRedraw("scale")}}),createBinding({name:"kendoRadialGauge",defaultOption:VALUE,watch:{value:VALUE,gaugeArea:extendAndRedraw("gaugeArea"),pointer:extendAndRedraw("pointer"),scale:extendAndRedraw("scale")}})})(ko,jQuery)
+//knockout-kendo v0.3.5 | (c) 2012 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
+(function(e){typeof require=="function"&&typeof exports=="object"&&typeof module=="object"?e(require("knockout"),require("jquery"),require("kendo")):typeof define=="function"&&define.amd?define(["knockout","jquery","kendo"],e):e(window.ko,window.jQuery,window.kendo)})(function(e,t,n,r){e.kendo=e.kendo||{},e.kendo.BindingFactory=function(){var n=this;this.createBinding=function(r){if(!t()[r.parent||r.name])return;var i={};i.init=function(e,t){var s=n.buildOptions(r,t);if(s.async===!0||r.async===!0&&s.async!==!1){setTimeout(function(){i.setup(e,s)},0);return}i.setup(e,s)},i.setup=function(i,s){var o,u=t(i);o=n.getWidget(r,s,u),n.handleEvents(s,r,i,o),n.watchValues(o,s,r,i),o.destroy&&e.utils.domNodeDisposal.addDisposeCallback(i,function(){o.destroy()})},i.options={},i.widgetConfig=r,e.bindingHandlers[r.bindingName||r.name]=i},this.buildOptions=function(t,n){var r=t.defaultOption,i=e.utils.extend({},e.bindingHandlers[t.name].options),s=e.utils.unwrapObservable(n());return typeof s!="object"||r&&!(r in s)?i[r]=n():e.utils.extend(i,s),i},this.getWidget=function(t,n,r){var i;if(t.parent){var s=r.closest("[data-bind*='"+t.parent+":']");i=s.length?s.data(t.parent):null}else i=r[t.name](e.toJS(n)).data(t.name);return e.isObservable(n.widget)&&n.widget(i),i},this.watchValues=function(e,t,r,i){var s,o=r.watch;if(o)for(s in o)o.hasOwnProperty(s)&&n.watchOneValue(s,e,t,r,i)},this.watchOneValue=function(n,r,i,s,o){var u=e.computed({read:function(){var u=s.watch[n],a=e.utils.unwrapObservable(i[n]),f=s.parent?[o]:[],l;t.isArray(u)?u=r[a?u[0]:u[1]]:typeof u=="string"&&(u=r[u]),u&&(l=u.apply(r,f),l!==a&&(f.push(a),u.apply(r,f)))},disposeWhenNodeIsRemoved:o});e.isObservable(i[n])||u.dispose()},this.handleEvents=function(t,r,i,s){var o,u,a=r.events;if(a)for(o in a)a.hasOwnProperty(o)&&(u=a[o],typeof u=="string"&&(u={value:u,writeTo:u}),e.isObservable(t[u.writeTo])&&n.handleOneEvent(o,u,t,i,s,r.childProp))},this.handleOneEvent=function(e,t,n,r,i,s){i.bind(e,function(e){var i,o;if(!s||!e[s]||e[s]===r)i=t.value,o=typeof i=="string"&&this[i]?this[i](s&&r):i,n[t.writeTo](o)})}},e.kendo.bindingFactory=new e.kendo.BindingFactory,e.kendo.setDataSource=function(t,n){t.dataSource.data(e.mapping?e.mapping.toJS(n||{}):e.toJS(n))};var i=function(t){return function(n){n&&(e.utils.extend(this.options[t],n),this.redraw(),this.value(.001+this.value()))}},s=e.kendo.bindingFactory.createBinding.bind(e.kendo.bindingFactory),o="close",u="collapse",a="content",f="data",l="disable",c="enable",h="expand",p="enabled",d="expanded",v="isOpen",m="max",g="min",y="open",b="resize",w="search",E="select",S="selected",x="size",T="title",N="value",C="values";s({name:"kendoAutoComplete",events:{change:N,open:{writeTo:v,value:!0},close:{writeTo:v,value:!1}},watch:{enabled:c,search:[w,o],data:function(t){e.kendo.setDataSource(this,t)},value:N}}),s({name:"kendoCalendar",defaultOption:N,events:{change:N},watch:{max:m,min:g,value:N}}),s({name:"kendoComboBox",events:{change:N,open:{writeTo:v,value:!0},close:{writeTo:v,value:!1}},watch:{enabled:c,isOpen:[y,o],data:function(t){e.kendo.setDataSource(this,t)},value:N}}),s({name:"kendoDatePicker",defaultOption:N,events:{change:N,open:{writeTo:v,value:!0},close:{writeTo:v,value:!1}},watch:{enabled:c,max:m,min:g,value:N,isOpen:[y,N]}}),s({name:"kendoDropDownList",events:{change:N,open:{writeTo:v,value:!0},close:{writeTo:v,value:!1}},watch:{enabled:c,isOpen:[y,o],data:function(t){e.kendo.setDataSource(this,t)},value:N}}),s({name:"kendoEditor",defaultOption:N,events:{change:N},watch:{enabled:c,value:N}}),s({name:"kendoGrid",defaultOption:f,watch:{data:function(t){e.kendo.setDataSource(this,t)}}}),s({name:"kendoListView",defaultOption:f,watch:{data:function(t){e.kendo.setDataSource(this,t)}}}),s({name:"kendoMenu",async:!0}),s({name:"kendoMenuItem",parent:"kendoMenu",watch:{enabled:c,isOpen:[y,o]},async:!0}),s({name:"kendoNumericTextBox",defaultOption:N,events:{change:N},watch:{enabled:c,value:N,max:function(e){this.options.max=e,this.value()>e&&this.value(e)},min:function(e){this.options.min=e,this.value()<e&&this.value(e)}}}),s({name:"kendoPanelBar",async:!0}),s({name:"kendoPanelItem",parent:"kendoPanelBar",watch:{enabled:c,expanded:[h,u]},childProp:"item",events:{expand:{writeTo:d,value:!0},collapse:{writeTo:d,value:!1}},async:!0}),s({name:"kendoRangeSlider",defaultOption:C,events:{change:C},watch:{values:C,enabled:[c,l]}}),s({name:"kendoSlider",defaultOption:N,events:{change:N},watch:{value:N,enabled:[c,l]}}),s({name:"kendoSplitter",async:!0}),s({name:"kendoSplitterPane",parent:"kendoSplitter",watch:{max:m,min:g,size:x,expanded:[h,u]},childProp:"pane",events:{collapse:{writeTo:d,value:!1},expand:{writeTo:d,value:!0},resize:x},async:!0}),s({name:"kendoTabStrip",async:!0}),s({name:"kendoTab",parent:"kendoTabStrip",watch:{selected:function(e,t){this.select(t?e:null)},enabled:c},childProp:"item",events:{selected:{writeTo:S,value:!0}},async:!0}),s({name:"kendoTimePicker",defaultOption:N,events:{change:N},watch:{max:m,min:g,value:N,enabled:c,isOpen:[y,o]}}),s({name:"kendoTreeView",async:!0}),s({name:"kendoTreeItem",parent:"kendoTreeView",watch:{enabled:c,expanded:[h,u],selected:function(e,t){this.select(t?e:null)}},childProp:"node",events:{collapse:{writeTo:d,value:!1},expand:{writeTo:d,value:!0},select:{writeTo:S,value:!0}},async:!0}),s({name:"kendoUpload",watch:{enabled:[c,l]}}),s({async:!0,name:"kendoWindow",events:{open:{writeTo:v,value:!0},close:{writeTo:v,value:!1}},watch:{content:a,title:T,isOpen:[y,o]}}),s({name:"kendoChart",watch:{data:function(t){e.kendo.setDataSource(this,t)}}}),s({name:"kendoLinearGauge",defaultOption:N,watch:{value:N,gaugeArea:i("gaugeArea"),pointer:i("pointer"),scale:i("scale")}}),s({name:"kendoRadialGauge",defaultOption:N,watch:{value:N,gaugeArea:i("gaugeArea"),pointer:i("pointer"),scale:i("scale")}})})
View
13 src/knockout-kendo.js
@@ -1,3 +1,15 @@
+(function(factory) {
+ // CommonJS
+ if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
+ factory(require('knockout'), require('jquery'), require('kendo'));
+ // AMD
+ } else if (typeof define === 'function' && define.amd) {
+ define(['knockout', 'jquery', 'kendo'], factory);
+ // Normal script tag
+ } else {
+ factory(window.ko, window.jQuery, window.kendo);
+ }
+}(function(ko, $, kendo, undefined) {
//import("knockout-kendo-core.js");
//import("knockout-kendo-constants.js");
//import("knockout-kendoAutoComplete.js");
@@ -22,3 +34,4 @@
//import("knockout-kendoChart.js");
//import("knockout-kendoLinearGauge.js");
//import("knockout-kendoRadialGauge.js");
+}));

No commit comments for this range

Something went wrong with that request. Please try again.