From: Alexander Schmitz Date: Wed, 15 Jul 2015 01:56:36 +0000 (-0400) Subject: Autocomplete: Move autocomplete into widgets folder X-Git-Tag: 1.12.0-beta.1~212 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4c6b1463ea2be3e44f85bd13ef9780229ec0f2d4;p=jquery-ui.git Autocomplete: Move autocomplete into widgets folder Ref #13885 --- diff --git a/demos/bootstrap.js b/demos/bootstrap.js index af9aee130..71d2e4ef3 100644 --- a/demos/bootstrap.js +++ b/demos/bootstrap.js @@ -25,7 +25,8 @@ var effectsAll = [ "effect-slide" ]; var widgets = [ - "accordion" + "accordion", + "autocomplete" ]; function getPath( module ) { diff --git a/tests/unit/autocomplete/common.js b/tests/unit/autocomplete/common.js index 5ee7cdda0..94e98048d 100644 --- a/tests/unit/autocomplete/common.js +++ b/tests/unit/autocomplete/common.js @@ -1,6 +1,6 @@ define( [ "lib/common", - "ui/autocomplete" + "ui/widgets/autocomplete" ], function( common ) { common.testWidget( "autocomplete", { diff --git a/tests/unit/autocomplete/core.js b/tests/unit/autocomplete/core.js index 184bcdbf4..d57f2a980 100644 --- a/tests/unit/autocomplete/core.js +++ b/tests/unit/autocomplete/core.js @@ -1,6 +1,6 @@ define( [ "jquery", - "ui/autocomplete" + "ui/widgets/autocomplete" ], function( $ ) { module( "autocomplete: core" ); diff --git a/tests/unit/autocomplete/events.js b/tests/unit/autocomplete/events.js index 8f96fb77f..59d5dd540 100644 --- a/tests/unit/autocomplete/events.js +++ b/tests/unit/autocomplete/events.js @@ -1,6 +1,6 @@ define( [ "jquery", - "ui/autocomplete" + "ui/widgets/autocomplete" ], function( $ ) { module( "autocomplete: events" ); diff --git a/tests/unit/autocomplete/methods.js b/tests/unit/autocomplete/methods.js index 32080207a..f614c13cd 100644 --- a/tests/unit/autocomplete/methods.js +++ b/tests/unit/autocomplete/methods.js @@ -1,6 +1,6 @@ define( [ "jquery", - "ui/autocomplete" + "ui/widgets/autocomplete" ], function( $ ) { module( "autocomplete: methods" ); diff --git a/tests/unit/autocomplete/options.js b/tests/unit/autocomplete/options.js index 06c75722b..7d281fb31 100644 --- a/tests/unit/autocomplete/options.js +++ b/tests/unit/autocomplete/options.js @@ -1,6 +1,6 @@ define( [ "jquery", - "ui/autocomplete" + "ui/widgets/autocomplete" ], function( $ ) { module( "autocomplete: options" ); diff --git a/ui/autocomplete.js b/ui/autocomplete.js deleted file mode 100644 index cf95b233a..000000000 --- a/ui/autocomplete.js +++ /dev/null @@ -1,646 +0,0 @@ -/*! - * jQuery UI Autocomplete @VERSION - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - -//>>label: Autocomplete -//>>group: Widgets -//>>description: Lists suggested words as the user is typing. -//>>docs: http://api.jqueryui.com/autocomplete/ -//>>demos: http://jqueryui.com/autocomplete/ -//>>css.structure: ../themes/base/core.css -//>>css.structure: ../themes/base/autocomplete.css -//>>css.theme: ../themes/base/theme.css - -( function( factory ) { - if ( typeof define === "function" && define.amd ) { - - // AMD. Register as an anonymous module. - define( [ - "jquery", - "./core", - "./version", - "./keycode", - "./widget", - "./position", - "./menu", - "./safe-active-element" - ], factory ); - } else { - - // Browser globals - factory( jQuery ); - } -}( function( $ ) { - -$.widget( "ui.autocomplete", { - version: "@VERSION", - defaultElement: "", - options: { - appendTo: null, - autoFocus: false, - delay: 300, - minLength: 1, - position: { - my: "left top", - at: "left bottom", - collision: "none" - }, - source: null, - - // callbacks - change: null, - close: null, - focus: null, - open: null, - response: null, - search: null, - select: null - }, - - requestIndex: 0, - pending: 0, - - _create: function() { - // Some browsers only repeat keydown events, not keypress events, - // so we use the suppressKeyPress flag to determine if we've already - // handled the keydown event. #7269 - // Unfortunately the code for & in keypress is the same as the up arrow, - // so we use the suppressKeyPressRepeat flag to avoid handling keypress - // events when we know the keydown event was used to modify the - // search term. #7799 - var suppressKeyPress, suppressKeyPressRepeat, suppressInput, - nodeName = this.element[ 0 ].nodeName.toLowerCase(), - isTextarea = nodeName === "textarea", - isInput = nodeName === "input"; - - // Textareas are always multi-line - // Inputs are always single-line, even if inside a contentEditable element - // IE also treats inputs as contentEditable - // All other element types are determined by whether or not they're contentEditable - this.isMultiLine = isTextarea || !isInput && this.element.prop( "isContentEditable" ); - - this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; - this.isNewMenu = true; - - this._addClass( "ui-autocomplete-input" ); - this.element.attr( "autocomplete", "off" ); - - this._on( this.element, { - keydown: function( event ) { - if ( this.element.prop( "readOnly" ) ) { - suppressKeyPress = true; - suppressInput = true; - suppressKeyPressRepeat = true; - return; - } - - suppressKeyPress = false; - suppressInput = false; - suppressKeyPressRepeat = false; - var keyCode = $.ui.keyCode; - switch ( event.keyCode ) { - case keyCode.PAGE_UP: - suppressKeyPress = true; - this._move( "previousPage", event ); - break; - case keyCode.PAGE_DOWN: - suppressKeyPress = true; - this._move( "nextPage", event ); - break; - case keyCode.UP: - suppressKeyPress = true; - this._keyEvent( "previous", event ); - break; - case keyCode.DOWN: - suppressKeyPress = true; - this._keyEvent( "next", event ); - break; - case keyCode.ENTER: - // when menu is open and has focus - if ( this.menu.active ) { - // #6055 - Opera still allows the keypress to occur - // which causes forms to submit - suppressKeyPress = true; - event.preventDefault(); - this.menu.select( event ); - } - break; - case keyCode.TAB: - if ( this.menu.active ) { - this.menu.select( event ); - } - break; - case keyCode.ESCAPE: - if ( this.menu.element.is( ":visible" ) ) { - if ( !this.isMultiLine ) { - this._value( this.term ); - } - this.close( event ); - // Different browsers have different default behavior for escape - // Single press can mean undo or clear - // Double press in IE means clear the whole form - event.preventDefault(); - } - break; - default: - suppressKeyPressRepeat = true; - // search timeout should be triggered before the input value is changed - this._searchTimeout( event ); - break; - } - }, - keypress: function( event ) { - if ( suppressKeyPress ) { - suppressKeyPress = false; - if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { - event.preventDefault(); - } - return; - } - if ( suppressKeyPressRepeat ) { - return; - } - - // replicate some key handlers to allow them to repeat in Firefox and Opera - var keyCode = $.ui.keyCode; - switch ( event.keyCode ) { - case keyCode.PAGE_UP: - this._move( "previousPage", event ); - break; - case keyCode.PAGE_DOWN: - this._move( "nextPage", event ); - break; - case keyCode.UP: - this._keyEvent( "previous", event ); - break; - case keyCode.DOWN: - this._keyEvent( "next", event ); - break; - } - }, - input: function( event ) { - if ( suppressInput ) { - suppressInput = false; - event.preventDefault(); - return; - } - this._searchTimeout( event ); - }, - focus: function() { - this.selectedItem = null; - this.previous = this._value(); - }, - blur: function( event ) { - if ( this.cancelBlur ) { - delete this.cancelBlur; - return; - } - - clearTimeout( this.searching ); - this.close( event ); - this._change( event ); - } - } ); - - this._initSource(); - this.menu = $( "