Merge pull request #17380 from woocommerce/fix/17310

Update to latest selectWoo
This commit is contained in:
Claudio Sanches 2017-10-25 19:42:47 -02:00 committed by GitHub
commit d9ccac31b0
6 changed files with 28 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*! /*!
* SelectWoo 5.0.0 * SelectWoo 1.0.1
* https://github.com/woocommerce/selectWoo * https://github.com/woocommerce/selectWoo
* *
* Released under the MIT license * Released under the MIT license
@ -1694,6 +1694,7 @@ S2.define('select2/selection/multiple',[
}; };
MultipleSelection.prototype.update = function (data) { MultipleSelection.prototype.update = function (data) {
var self = this;
this.clear(); this.clear();
if (data.length === 0) { if (data.length === 0) {
@ -1719,6 +1720,14 @@ S2.define('select2/selection/multiple',[
var $rendered = this.$selection.find('.select2-selection__rendered'); var $rendered = this.$selection.find('.select2-selection__rendered');
Utils.appendMany($rendered, $selections); Utils.appendMany($rendered, $selections);
// Return cursor to search field after updating.
// Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
if ('undefined' !== typeof this.$search) {
setTimeout(function(){
self.$search.focus();
}, 1);
}
}; };
return MultipleSelection; return MultipleSelection;
@ -3524,6 +3533,7 @@ S2.define('select2/data/ajax',[
} }
callback(results); callback(results);
self.container.focusOnActiveElement();
}, function () { }, function () {
// Attempt to detect if a request was aborted // Attempt to detect if a request was aborted
// Only works if the transport exposes a status property // Only works if the transport exposes a status property
@ -5416,7 +5426,7 @@ S2.define('select2/core',[
// Needs 1 ms delay because of other 1 ms setTimeouts when rendering. // Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
setTimeout(function(){ setTimeout(function(){
self.focusOnActiveElement(); self.focusOnActiveElement();
},1); }, 1);
}); });
$(document).on('keydown', function (evt) { $(document).on('keydown', function (evt) {

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* SelectWoo 5.0.0 * SelectWoo 1.0.1
* https://github.com/woocommerce/selectWoo * https://github.com/woocommerce/selectWoo
* *
* Released under the MIT license * Released under the MIT license
@ -1694,6 +1694,7 @@ S2.define('select2/selection/multiple',[
}; };
MultipleSelection.prototype.update = function (data) { MultipleSelection.prototype.update = function (data) {
var self = this;
this.clear(); this.clear();
if (data.length === 0) { if (data.length === 0) {
@ -1719,6 +1720,14 @@ S2.define('select2/selection/multiple',[
var $rendered = this.$selection.find('.select2-selection__rendered'); var $rendered = this.$selection.find('.select2-selection__rendered');
Utils.appendMany($rendered, $selections); Utils.appendMany($rendered, $selections);
// Return cursor to search field after updating.
// Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
if ('undefined' !== typeof this.$search) {
setTimeout(function(){
self.$search.focus();
}, 1);
}
}; };
return MultipleSelection; return MultipleSelection;
@ -3524,6 +3533,7 @@ S2.define('select2/data/ajax',[
} }
callback(results); callback(results);
self.container.focusOnActiveElement();
}, function () { }, function () {
// Attempt to detect if a request was aborted // Attempt to detect if a request was aborted
// Only works if the transport exposes a status property // Only works if the transport exposes a status property
@ -5416,7 +5426,7 @@ S2.define('select2/core',[
// Needs 1 ms delay because of other 1 ms setTimeouts when rendering. // Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
setTimeout(function(){ setTimeout(function(){
self.focusOnActiveElement(); self.focusOnActiveElement();
},1); }, 1);
}); });
$(document).on('keydown', function (evt) { $(document).on('keydown', function (evt) {

File diff suppressed because one or more lines are too long

View File

@ -112,7 +112,7 @@ class WC_Admin_Assets {
wp_register_script( 'wc-shipping-classes', WC()->plugin_url() . '/assets/js/admin/wc-shipping-classes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone' ), WC_VERSION ); wp_register_script( 'wc-shipping-classes', WC()->plugin_url() . '/assets/js/admin/wc-shipping-classes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone' ), WC_VERSION );
wp_register_script( 'wc-clipboard', WC()->plugin_url() . '/assets/js/admin/wc-clipboard' . $suffix . '.js', array( 'jquery' ), WC_VERSION ); wp_register_script( 'wc-clipboard', WC()->plugin_url() . '/assets/js/admin/wc-clipboard' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.3' ); wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.0' ); wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.1' );
wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWoo' ), WC_VERSION ); wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWoo' ), WC_VERSION );
wp_localize_script( 'wc-enhanced-select', 'wc_enhanced_select_params', array( wp_localize_script( 'wc-enhanced-select', 'wc_enhanced_select_params', array(
'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'woocommerce' ), 'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'woocommerce' ),

View File

@ -234,7 +234,7 @@ class WC_Frontend_Scripts {
'selectWoo' => array( 'selectWoo' => array(
'src' => self::get_asset_url( 'assets/js/selectWoo/selectWoo.full' . $suffix . '.js' ), 'src' => self::get_asset_url( 'assets/js/selectWoo/selectWoo.full' . $suffix . '.js' ),
'deps' => array( 'jquery' ), 'deps' => array( 'jquery' ),
'version' => '1.0.0', 'version' => '1.0.1',
), ),
'wc-address-i18n' => array( 'wc-address-i18n' => array(
'src' => self::get_asset_url( 'assets/js/frontend/address-i18n' . $suffix . '.js' ), 'src' => self::get_asset_url( 'assets/js/frontend/address-i18n' . $suffix . '.js' ),