Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
|
@ -1,12 +1,17 @@
|
|||
/**
|
||||
* @file
|
||||
* Javascript behaviors for Select2 integration.
|
||||
* JavaScript behaviors for Select2 integration.
|
||||
*/
|
||||
|
||||
(function ($, Drupal) {
|
||||
|
||||
'use strict';
|
||||
|
||||
// @see https://select2.github.io/options.html
|
||||
Drupal.webform = Drupal.webform || {};
|
||||
Drupal.webform.select2 = Drupal.webform.select2 || {};
|
||||
Drupal.webform.select2.options = Drupal.webform.select2.options || {};
|
||||
|
||||
/**
|
||||
* Initialize Select2 support.
|
||||
*
|
||||
|
@ -14,13 +19,55 @@
|
|||
*/
|
||||
Drupal.behaviors.webformSelect2 = {
|
||||
attach: function (context) {
|
||||
if (!$.fn.select2) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(context)
|
||||
.find('select.js-webform-select2, .js-webform-select2 select')
|
||||
.once('webform-select2')
|
||||
// http://stackoverflow.com/questions/14313001/select2-not-calculating-resolved-width-correctly-if-select-is-hidden
|
||||
.css('width', '100%')
|
||||
.select2();
|
||||
.each(function () {
|
||||
var $select = $(this);
|
||||
|
||||
var options = $.extend({}, Drupal.webform.select2.options);
|
||||
if ($select.data('placeholder')) {
|
||||
options.placeholder = $select.data('placeholder');
|
||||
if (!$select.prop('multiple')) {
|
||||
// Allow single option to be deselected.
|
||||
options.allowClear = true;
|
||||
}
|
||||
}
|
||||
|
||||
$select.select2(options);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ISSUE:
|
||||
* Hiding/showing element via #states API cause select2 dropdown to appear in the wrong position.
|
||||
*
|
||||
* WORKAROUND:
|
||||
* Close (aka hide) select2 dropdown when #states API hides or shows an element.
|
||||
*
|
||||
* Steps to reproduce:
|
||||
* - Add custom 'Submit button(s)'
|
||||
* - Hide submit button
|
||||
* - Save
|
||||
* - Open 'Submit button(s)' dialog
|
||||
*
|
||||
* Dropdown body is positioned incorrectly when dropdownParent isn't statically positioned.
|
||||
* @see https://github.com/select2/select2/issues/3303
|
||||
*/
|
||||
$(function () {
|
||||
if ($.fn.select2) {
|
||||
$(document).on('state:visible state:visible-slide', function (e) {
|
||||
$('select.select2-hidden-accessible').select2('close');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery, Drupal);
|
||||
|
|
Reference in a new issue