Skip to content

Commit

Permalink
Fix gvas#61 - Add support for jQuery UI 1.12.
Browse files Browse the repository at this point in the history
Add custom.combobox widget from jquery-ui.com Autocomplete example.
Add CommonJS support.

Signed-off-by: Jonathan Horowitz <jhorowitz@firedrum.com>
  • Loading branch information
Invader444 committed Apr 4, 2017
1 parent bd3b410 commit 9455d9f
Show file tree
Hide file tree
Showing 42 changed files with 437 additions and 173 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ before_script:
- git submodule update --init --recursive
env:
global:
- secure: QTvKCG0uFhtuMtw4IBKq3b6z5S5betgHfEN+qEI9h6BV5fzSF1t1zgkno7JOrfwzxYqYWBJoPd6xKAt3vs06gFuE6AyFak5OZUVyPsgok5MBzsBBPX7yGChifk+X0NWvUj+arfP/PCRGSZiYS1TTxV153snXr6yGm+Lv7tlj3no=
- secure: YZbGKF6O3k7S/QuTBGrv4hf+Vasz7fNs3ZHAQz5ysrWS1RSN68x44paNnj/NoGc7NDv7zGAEuhi7x6J/ge0JWjAOPe58Ps72Ii4xc/dTjO75uWkF4roC3hGOYDLBHHO9e5QMoifCZQfUg1FDr7oSyz1zDccniSXC/OeD0+Sv9Tg=
- secure: udEP6dxsuGkDDJI4ZExsHhRVCvrVIb6atDyllIaoiIk93Uv+1IgQZ+pLnYpQsHE9MU+XWgfODsgpfBCk7aVO7BoJ5VGTUB9q7/JbjmA9vcDfi1IXJBcPlalvtyboOCRIs4G7YJncHrwykWeHNw66pwJikaDClVX3KK2VO2KmYdWDLsQ9+OYFsQTFxcafqxb2U4tGDADBabgXIANJ6qyuzftrGFi8D1LcXSzMviKaflH8bW23X97zTJOL91fj+w9EEk1+C30Qz9MR7UZHI9zmykr0fC3XYgBKAn/IkwX2omBGOUP2DYagx6EIliVXl/7XxQiBJw1CTsvyaky+7LvlXm+HouFpJOYgR0acJWzqLzQEJ6ak1sIMf4ssyd8CESTcyVd2/srhd9/jpHSz1ivgNfDpBLKGDeSLBsBilZLVV+nY953PrMYIj0qKQ5hhP3plG9NYb+/VwpINY9hPWRdIIxiXPlFUNeA3nItRsL2uNgD9JIRtMom5WVnDu20nUcY4MZ+5ddetIQszCPK7yODnj/qRhUiII6fZwvlORjI2gLcCC88XCdVzKgKsXkXUCDWYheB0xCsmA1V4A5FJ5RafDLxmaW1jXoHfhuH87Y+PorZAeJpIM2atPYxt8Q4mKxZPu/SpwyLhP9SSf9nuwrChUBuoawIbuGyplvDfj9+Ey0E=
- secure: LMU2IgUfpfhQ3qJufV7GUvELyRpAfELTxvpXRxd5ClMqYc+eTXA1uGxe7lOQcp8zY4yn6wWD3IcVqY96egDStXhsMRji9arlM9gTWyqyQv9RIpFNmO0QiB3qatrHuy/1u3qpuHXGQzMw5c/PBX/wxaV8WH48vOsX7QL+jAhgKtmsl/Fr4x52F7IE+YpAc/gMH1f+O4E+QuxfQ7nA8yy6SvFGfht/3GwgRUEJMqvg2VOjEMMiWhELKKiff9bORGu5nCO+YLCaT9TUzQuTKa95k3cVGrzPjRTy3iOk6VJzJt/eh/Y9Nwzqxxivghj83Z8bq2bFH7ByB279pPZ8Pn1TelEgFPXsoA5Twff5t6Hun7Dvhxvu1vRtZXbHVY9f7CNj7hhAdF2YbczSv7FxDZYU5QbfogoI1bJ/f2U/WIvMF6gG8lwBlW2llxQTQNwzT2yQlGsn+VXIlUEbOahgcErlssXiQCVR4TgbFEEK2lD/KBXTYwwf+ukcWBV1LTg1qkkWUnOR0XPeMYTUuGl3rUiKVbWNIHD/zCRPzZFh5DfzJn9/hXYfYN7da0viyC+RALi7WOs05tcr+1YsGoB+sccn5+LKYsaOodi6eUk/h5BXiVkzzSEz0YUcaoELNVOS3GbNmcVfz8Do8DxKE7miKivDpLJDUeiFeDALCApQxHWnFzU=
6 changes: 3 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ module.exports = function (grunt) {
tunnelId: Math.floor((new Date()).getTime() / 1000 - 1230768000).toString(),
coreFiles: ['src/utils.js', 'src/bindingHandler.js'],
widgets: ['src/accordion.js', 'src/autocomplete.js', 'src/button.js',
'src/buttonset.js', 'src/datepicker.js', 'src/dialog.js', 'src/menu.js',
'src/progressbar.js', 'src/selectmenu.js', 'src/slider.js',
'src/spinner.js', 'src/tabs.js', 'src/tooltip.js']
'src/buttonset.js', 'src/checkboxradio.js', 'src/controlgroup.js', 'src/custom.combobox.js',
'src/datepicker.js', 'src/dialog.js', 'src/menu.js', 'src/progressbar.js', 'src/selectmenu.js',
'src/slider.js', 'src/spinner.js', 'src/tabs.js', 'src/tooltip.js']
}
});
};
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build Status](https://travis-ci.org/jhorowitz-firedrum/knockout-jqueryui.png)](https://travis-ci.org/jhorowitz-firedrum/knockout-jqueryui) [![devDependency Status](https://david-dm.org/jhorowitz-firedrum/knockout-jqueryui/dev-status.svg)](https://david-dm.org/jhorowitz-firedrum/knockout-jqueryui#info=devDependencies) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)
[![Sauce Test Status](https://saucelabs.com/browser-matrix/gvas.svg)](https://saucelabs.com/u/gvas)
[![Build Status](https://saucelabs.com/browser-matrix/jhorowitz-firedrum.svg)](https://saucelabs.com/beta/builds/1f65373a4f0247779a6e37c07f816a9f)


[Knockout](http://knockoutjs.com/) bindings for the [jQuery UI](http://jqueryui.com/) widgets.
Expand Down
11 changes: 8 additions & 3 deletions dist/amd/accordion.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint strict: false */
/*global define*/
define(

Expand All @@ -11,8 +12,6 @@ define(

function ($, ko, utils, BindingHandler) {

'use strict';

var Accordion = function () {
/// <summary>Constructor.</summary>

Expand All @@ -25,12 +24,18 @@ define(
this.events = ['change', 'changestart', 'create'];
this.hasRefresh = false;
this.eventToWatch = 'change';
} else {
} else if (utils.uiVersion.major === 1 && (utils.uiVersion.minor >= 9 && utils.uiVersion.minor <= 11)) {
this.options = ['active', 'animate', 'collapsible', 'disabled', 'event',
'header', 'heightStyle', 'icons'];
this.events = ['activate', 'beforeActivate', 'create'];
this.hasRefresh = true;
this.eventToWatch = 'activate';
} else {
this.options = ['active', 'animate', 'classes', 'collapsible', 'disabled',
'event', 'header', 'heightStyle', 'icons'];
this.events = ['activate', 'beforeActivate', 'create'];
this.hasRefresh = true;
this.eventToWatch = 'activate';
}
};

Expand Down
16 changes: 9 additions & 7 deletions dist/amd/autocomplete.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint strict: false */
/*global define*/
define(

Expand All @@ -9,23 +10,24 @@ define(

function (BindingHandler, utils) {

'use strict';

var Autocomplete = function () {
/// <summary>Constructor.</summary>

BindingHandler.call(this, 'autocomplete');

this.options = ['appendTo', 'autoFocus', 'delay', 'disabled', 'minLength',
'position', 'source'];
this.events = ['change', 'close', 'create', 'focus', 'open', 'search',
'select'];

if (utils.uiVersion.major === 1 && utils.uiVersion.minor === 8) {
this.events = ['change', 'close', 'create', 'focus', 'open', 'search',
'select'];
if (utils.uiVersion.major === 1 && (utils.uiVersion.minor >= 9 && utils.uiVersion.minor <= 11)) {
this.events.push('response');
this.options.push('messages');
} else {
this.events.push('response');
this.options.push('messages');
this.events = ['change', 'close', 'create', 'focus', 'open', 'response',
'search', 'select'];
this.options.push('classes');

}
};

Expand Down
3 changes: 1 addition & 2 deletions dist/amd/bindingHandler.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint strict: false */
/*global define*/
define(

Expand All @@ -10,8 +11,6 @@ define(

function ($, ko, utils) {

'use strict';

var domDataKey, filterAndUnwrapProperties, subscribeToRefreshOn, BindingHandler;

domDataKey = '__kojqui_options';
Expand Down
14 changes: 11 additions & 3 deletions dist/amd/button.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint strict: false */
/*global define*/
define(

Expand All @@ -9,15 +10,22 @@ define(

function (BindingHandler, utils) {

'use strict';

var Button = function () {
/// <summary>Constructor.</summary>

BindingHandler.call(this, 'button');

this.options = ['disabled', 'icons', 'label', 'text'];
this.options = ['disabled', 'label'];
this.events = ['create'];
if (utils.uiVersion.major === 1 && (utils.uiVersion.minor >= 8 && utils.uiVersion.minor <= 11)) {
this.options.push('icons');
this.options.push('text');
} else {
this.options.push('classes');
this.options.push('icon');
this.options.push('iconPosition');
this.options.push('showLabel');
}
this.hasRefresh = true;
};

Expand Down
3 changes: 1 addition & 2 deletions dist/amd/buttonset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint strict: false */
/*global define*/
define(

Expand All @@ -9,8 +10,6 @@ define(

function (BindingHandler, utils) {

'use strict';

var Buttonset = function () {
/// <summary>Constructor.</summary>

Expand Down
39 changes: 39 additions & 0 deletions dist/amd/checkboxradio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*jshint strict: false */
/*global define*/
define(

[
'./bindingHandler',
'./utils',
'jquery-ui/checkboxradio'
],

function (BindingHandler, utils) {

var Checkboxradio = function () {
/// <summary>Constructor.</summary>

BindingHandler.call(this, 'checkboxradio');

this.options = ['classes', 'disabled', 'icon', 'label'];
this.events = ['create'];
if (utils.uiVersion.major === 1 && (utils.uiVersion.minor >= 8 && utils.uiVersion.minor <= 11)) {
this.options.push('icons');
this.options.push('text');
} else {
this.options.push('classes');
this.options.push('icon');
this.options.push('iconPosition');
this.options.push('showLabel');
}
this.hasRefresh = true;
};

Checkboxradio.prototype = utils.createObject(BindingHandler.prototype);
Checkboxradio.prototype.constructor = Checkboxradio;

utils.register(Checkboxradio);

return Checkboxradio;
}
);
30 changes: 30 additions & 0 deletions dist/amd/controlgroup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*jshint strict: false */
/*global define*/
define(

[
'./bindingHandler',
'./utils',
'jquery-ui/controlgroup'
],

function (BindingHandler, utils) {

var Controlgroup = function () {
/// <summary>Constructor.</summary>

BindingHandler.call(this, 'controlgroup');

this.options = ['classes', 'direction', 'disabled', 'items', 'onlyVisible'];
this.events = ['create'];
this.hasRefresh = true;
};

Controlgroup.prototype = utils.createObject(BindingHandler.prototype);
Controlgroup.prototype.constructor = Controlgroup;

utils.register(Controlgroup);

return Controlgroup;
}
);
31 changes: 31 additions & 0 deletions dist/amd/custom.combobox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*jshint strict: false */
/*global define*/
define(

[
'./bindingHandler',
'./utils',
'jquery-ui/autocomplete',
'jquery-ui/button',
'jquery-ui/tooltip'
],

function (BindingHandler, utils) {

var CustomCombobox = function () {
/// <summary>Constructor.</summary>

BindingHandler.call(this, 'combobox');

this.options = ['removeIfInvalid', 'buttonTooltip'];
this.events = [];
};

CustomCombobox.prototype = utils.createObject(BindingHandler.prototype);
CustomCombobox.prototype.constructor = CustomCombobox;

utils.register(CustomCombobox);

return CustomCombobox;
}
);
3 changes: 1 addition & 2 deletions dist/amd/datepicker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint strict: false */
/*global define*/
define(

Expand All @@ -11,8 +12,6 @@ define(

function ($, ko, BindingHandler, utils) {

'use strict';

var Datepicker = function () {
/// <summary>Constructor.</summary>

Expand Down
40 changes: 20 additions & 20 deletions dist/amd/dialog.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint strict: false */
/*global define*/
/*jslint browser:true*/
define(
Expand All @@ -12,34 +13,33 @@ define(

function ($, ko, BindingHandler, utils) {

'use strict';

var Dialog = function () {
/// <summary>Constructor.</summary>

BindingHandler.call(this, 'dialog');

this.events = ['beforeClose', 'create', 'open', 'focus', 'dragStart',
'drag', 'dragStop', 'resizeStart', 'resize', 'resizeStop', 'close'];
this.options = ['autoOpen', 'buttons', 'closeOnEscape',
'closeText', 'dialogClass', 'draggable', 'height',
'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'modal', 'position',
'resizable', 'show', 'title', 'width'];

if (utils.uiVersion.major === 1 && utils.uiVersion.minor === 8) {
this.options = ['autoOpen', 'buttons', 'closeOnEscape', 'closeText',
'dialogClass', 'disabled', 'draggable', 'height', 'maxHeight',
'maxWidth', 'minHeight', 'minWidth', 'modal', 'position', 'resizable',
'show', 'stack', 'title', 'width', 'zIndex'];
this.events = ['beforeClose', 'create', 'open', 'focus', 'dragStart',
'drag', 'dragStop', 'resizeStart', 'resize', 'resizeStop', 'close'];
this.options.push('disabled');
this.options.push('stack');
this.options.push('zIndex');
} else if (utils.uiVersion.major === 1 && utils.uiVersion.minor === 9) {
this.options = ['autoOpen', 'buttons', 'closeOnEscape', 'closeText',
'dialogClass', 'draggable', 'height', 'hide', 'maxHeight', 'maxWidth',
'minHeight', 'minWidth', 'modal', 'position', 'resizable', 'show',
'stack', 'title', 'width', 'zIndex'];
this.events = ['beforeClose', 'create', 'open', 'focus', 'dragStart',
'drag', 'dragStop', 'resizeStart', 'resize', 'resizeStop', 'close'];
this.options.push('stack');
this.options.push('zIndex');
this.options.push('hide');
} else if (utils.uiVersion.major === 1 && (utils.uiVersion.minor === 10 || utils.uiVersion.minor === 11)) {
this.options.push('appendTo');
this.options.push('hide');
} else {
this.options = ['appendTo', 'autoOpen', 'buttons', 'closeOnEscape',
'closeText', 'dialogClass', 'draggable', 'height', 'hide',
'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'modal', 'position',
'resizable', 'show', 'title', 'width'];
this.events = ['beforeClose', 'create', 'open', 'focus', 'dragStart',
'drag', 'dragStop', 'resizeStart', 'resize', 'resizeStop', 'close'];
this.options.push('appendTo');
this.options.push('hide');
this.options.push('classes');
}
};

Expand Down
12 changes: 6 additions & 6 deletions dist/amd/menu.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint strict: false */
/*global define*/
define(

Expand All @@ -9,18 +10,17 @@ define(

function (BindingHandler, utils) {

'use strict';

var Menu = function () {
/// <summary>Constructor.</summary>

BindingHandler.call(this, 'menu');

if (utils.uiVersion.major === 1 && utils.uiVersion.minor < 11) {
this.options = ['disabled', 'icons', 'menus', 'position', 'role'];
this.options = ['disabled', 'icons', 'menus', 'position', 'role'];
if (utils.uiVersion.major === 1 && utils.uiVersion.minor === 11) {
this.options.push('items');
} else {
this.options = ['disabled', 'icons', 'items', 'menus', 'position',
'role'];
this.options.push('items');
this.options.push('classes');
}

this.events = ['blur', 'create', 'focus', 'select'];
Expand Down
11 changes: 6 additions & 5 deletions dist/amd/progressbar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint strict: false */
/*global define*/
define(

Expand All @@ -9,20 +10,20 @@ define(

function (BindingHandler, utils) {

'use strict';

var Progressbar = function () {
/// <summary>Constructor.</summary>

BindingHandler.call(this, 'progressbar');

this.options = ['disabled', 'value'];
this.events = ['change', 'create', 'complete'];
this.hasRefresh = true;

if (utils.uiVersion.major === 1 && utils.uiVersion.minor === 8) {
this.options = ['disabled', 'value'];
if (utils.uiVersion.major === 1 && (utils.uiVersion.minor >= 9 && utils.uiVersion.minor <= 11)) {
this.options.push('max');
} else {
this.options = ['disabled', 'max', 'value'];
this.options.push('max');
this.options.push('classes');
}
};

Expand Down
Loading

0 comments on commit 9455d9f

Please sign in to comment.