diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/i18n/jquery.ui.datepicker-pt-BR.js | 6 | ||||
-rw-r--r-- | ui/jquery.ui.accordion.js | 4 | ||||
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 45 | ||||
-rw-r--r-- | ui/jquery.ui.button.js | 2 | ||||
-rw-r--r-- | ui/jquery.ui.dialog.js | 28 | ||||
-rw-r--r-- | ui/jquery.ui.sortable.js | 4 | ||||
-rw-r--r-- | ui/jquery.ui.tabs.js | 30 | ||||
-rw-r--r-- | ui/jquery.ui.widget.js | 2 |
8 files changed, 75 insertions, 46 deletions
diff --git a/ui/i18n/jquery.ui.datepicker-pt-BR.js b/ui/i18n/jquery.ui.datepicker-pt-BR.js index 38818637d..3cc8c796c 100644 --- a/ui/i18n/jquery.ui.datepicker-pt-BR.js +++ b/ui/i18n/jquery.ui.datepicker-pt-BR.js @@ -10,9 +10,9 @@ jQuery(function($){ 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'], monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun', 'Jul','Ago','Set','Out','Nov','Dez'], - dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sabado'], - dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'], - dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'], + dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado'], + dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], + dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], weekHeader: 'Sm', dateFormat: 'dd/mm/yy', firstDay: 0, diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index fd6331026..1d13e9566 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -79,7 +79,9 @@ $.widget("ui.accordion", { } } - this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"); + this.active = this._findActive(this.active || o.active) + .addClass("ui-state-default ui-state-active") + .toggleClass("ui-corner-all ui-corner-top"); this.active.next().addClass('ui-accordion-content-active'); //Append icon elements diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 1a51baa8d..27bfe941c 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -16,8 +16,14 @@ $.widget( "ui.autocomplete", { options: { + delay: 300, minLength: 1, - delay: 300 + position: { + my: "left top", + at: "left bottom", + collision: "none" + }, + source: null }, _create: function() { var self = this, @@ -126,9 +132,12 @@ $.widget( "ui.autocomplete", { } }, selected: function( event, ui ) { - var item = ui.item.data( "item.autocomplete" ); + var item = ui.item.data( "item.autocomplete" ), + setValue = false; if ( false !== self._trigger( "select", event, { item: item } ) ) { - self.element.val( item.value ); + // #5639 - if we set the value before setting focus + // the cursor will move to the beginning of the field in IE + setValue = true; } self.close( event ); // only trigger when focus was lost (click on menu) @@ -138,6 +147,9 @@ $.widget( "ui.autocomplete", { self.previous = previous; } self.selectedItem = item; + if ( setValue ) { + self.element.val( item.value ); + } }, blur: function( event, ui ) { if ( self.menu.element.is(":visible") ) { @@ -269,16 +281,17 @@ $.widget( "ui.autocomplete", { // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate this.menu.deactivate(); this.menu.refresh(); - this.menu.element.show().position({ - my: "left top", - at: "left bottom", - of: this.element, - collision: "none" - }); - - menuWidth = ul.width( "" ).width(); - textWidth = this.element.width(); - ul.width( Math.max( menuWidth, textWidth ) ); + this.menu.element.show().position( $.extend({ + of: this.element + }, this.options.position )); + + menuWidth = ul.width( "" ).outerWidth(); + textWidth = this.element.outerWidth(); + ul.width( Math.max( menuWidth, textWidth ) + - ( parseFloat( ul.css("paddingLeft") ) || 0 ) + - ( parseFloat( ul.css("paddingRight") ) || 0 ) + - ( parseFloat( ul.css("borderLeftWidth") ) || 0 ) + - ( parseFloat( ul.css("borderRightWidth") ) || 0 ) ); }, _renderMenu: function( ul, items ) { @@ -291,7 +304,7 @@ $.widget( "ui.autocomplete", { _renderItem: function( ul, item) { return $( "<li></li>" ) .data( "item.autocomplete", item ) - .append( "<a>" + item.label + "</a>" ) + .append( $( "<a></a>" ).text( item.label ) ) .appendTo( ul ); }, @@ -426,11 +439,11 @@ $.widget("ui.menu", { }, first: function() { - return this.active && !this.active.prev().length; + return this.active && !this.active.prevAll(".ui-menu-item").length; }, last: function() { - return this.active && !this.active.next().length; + return this.active && !this.active.nextAll(".ui-menu-item").length; }, move: function(direction, edge, event) { diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index db8c8b27b..b2fab4d24 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -196,7 +196,7 @@ $.widget( "ui.button", { // we don't search against the document in case the element // is disconnected from the DOM this.buttonElement = this.element.parents().last() - .find( "[for=" + this.element.attr("id") + "]" ); + .find( "label[for=" + this.element.attr("id") + "]" ); this.element.addClass( "ui-helper-hidden-accessible" ); var checked = this.element.is( ":checked" ); diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index dc2559e9d..ae96b2d8b 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -59,6 +59,7 @@ $.widget("ui.dialog", { width: 300, zIndex: 1000 }, + _create: function() { this.originalTitle = this.element.attr('title'); // #5742 - .attr() might return a DOMElement @@ -177,6 +178,7 @@ $.widget("ui.dialog", { uiDialog.bgiframe(); } }, + _init: function() { if ( this.options.autoOpen ) { this.open(); @@ -203,7 +205,7 @@ $.widget("ui.dialog", { return self; }, - + widget: function() { return this.uiDialog; }, @@ -258,12 +260,12 @@ $.widget("ui.dialog", { var self = this, options = self.options, saveScroll; - + if ((options.modal && !force) || (!options.stack && !options.modal)) { return self._trigger('focus', event); } - + if (options.zIndex > $.ui.dialog.maxZ) { $.ui.dialog.maxZ = options.zIndex; } @@ -305,11 +307,11 @@ $.widget("ui.dialog", { if (event.keyCode !== $.ui.keyCode.TAB) { return; } - + var tabbables = $(':tabbable', this), first = tabbables.filter(':first'), last = tabbables.filter(':last'); - + if (event.target === last[0] && !event.shiftKey) { first.focus(1); return false; @@ -322,12 +324,9 @@ $.widget("ui.dialog", { // set focus to the first tabbable element in the content area or the first button // if there are no tabbable elements, set focus on the dialog itself - $([]) - .add(uiDialog.find('.ui-dialog-content :tabbable:first')) - .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')) - .add(uiDialog) - .filter(':first') - .focus(); + $(self.element.find(':tabbable').get().concat( + uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat( + uiDialog.get()))).eq(0).focus(); self._trigger('open'); self._isOpen = true; @@ -461,7 +460,6 @@ $.widget("ui.dialog", { } }, - _position: function(position) { var myAt = [], offset = [0, 0], @@ -484,14 +482,14 @@ $.widget("ui.dialog", { myAt[i] = offsetPosition; } }); - + position = { my: myAt.join(" "), at: myAt.join(" "), offset: offset.join(" ") }; } - + position = $.extend({}, $.ui.dialog.prototype.options.position, position); } else { position = $.ui.dialog.prototype.options.position; @@ -516,7 +514,7 @@ $.widget("ui.dialog", { uiDialog = self.uiDialog, isResizable = uiDialog.is(':data(resizable)'), resize = false; - + switch (key) { //handling of deprecated beforeclose (vs beforeClose) option //Ticket #4669 http://dev.jqueryui.com/ticket/4669 diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index a51f543c5..6cc2434e8 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -409,6 +409,10 @@ $.widget("ui.sortable", $.ui.mouse, { if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); }); + if(!str.length && o.key) { + str.push(o.key + '='); + } + return str.join('&'); }, diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 2d258d1d2..5555b95f5 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -413,6 +413,16 @@ $.widget("ui.tabs", { }, + _getIndex: function(index) { + // meta-function to give users option to provide a href string instead of a numerical index. + // also sanitizes numerical indexes to valid values. + if (typeof index == 'string') { + index = this.anchors.index(this.anchors.filter('[href$=' + index + ']')); + } + + return index; + }, + destroy: function() { var o = this.options; @@ -512,6 +522,7 @@ $.widget("ui.tabs", { }, remove: function(index) { + index = this._getIndex(index); var o = this.options, $li = this.lis.eq(index).remove(), $panel = this.panels.eq(index).remove(); @@ -532,6 +543,7 @@ $.widget("ui.tabs", { }, enable: function(index) { + index = this._getIndex(index); var o = this.options; if ($.inArray(index, o.disabled) == -1) { return; @@ -546,6 +558,7 @@ $.widget("ui.tabs", { }, disable: function(index) { + index = this._getIndex(index); var self = this, o = this.options; if (index != o.selected) { // cannot disable already selected tab this.lis.eq(index).addClass('ui-state-disabled'); @@ -561,21 +574,20 @@ $.widget("ui.tabs", { }, select: function(index) { - if (typeof index == 'string') { - index = this.anchors.index(this.anchors.filter('[href$=' + index + ']')); - } - else if (index === null) { // usage of null is deprecated, TODO remove in next release - index = -1; - } - if (index == -1 && this.options.collapsible) { - index = this.options.selected; + index = this._getIndex(index); + if (index == -1) { + if (this.options.collapsible && this.options.selected != -1) { + index = this.options.selected; + } else { + return this; + } } - this.anchors.eq(index).trigger(this.options.event + '.tabs'); return this; }, load: function(index) { + index = this._getIndex(index); var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs'); this.abort(); diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 1014c607a..265489866 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -57,7 +57,7 @@ $.widget = function( name, base, prototype ) { // basePrototype[ key ] = $.extend( {}, val ); // } // }); - basePrototype.options = $.extend( {}, basePrototype.options ); + basePrototype.options = $.extend( true, {}, basePrototype.options ); $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { namespace: namespace, widgetName: name, |