Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #61 and #25 #62

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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']
}
});
};
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ Tests
Compatibility
-----

From jQuery UI 1.8 to jQuery UI 1.11.x.
jQuery UI 1.12 deprecated some API and the "compatibility layer" is broken.
From jQuery UI 1.8 to jQuery UI 1.12.x.

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
7 changes: 4 additions & 3 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 Expand Up @@ -115,7 +114,9 @@ define(

// handle disposal
ko.utils.domNodeDisposal.addDisposeCallback(element, function () {
$(element)[widgetName]('destroy');
if ($.data(element, 'ui' + widgetName.substr(0,1).toUpperCase() + widgetName.substr(1))) {
$(element)[widgetName]('destroy');
}
});

return { controlsDescendantBindings: shouldApplyBindingsToDescendants };
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