composer update
This commit is contained in:
parent
f6abc3dce2
commit
71dfaca858
1753 changed files with 45274 additions and 14619 deletions
53
web/modules/contrib/webform/js/webform.element.states.js
Normal file
53
web/modules/contrib/webform/js/webform.element.states.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* @file
|
||||
* JavaScript behaviors for element #states.
|
||||
*/
|
||||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Element #states builder.
|
||||
*
|
||||
* @type {Drupal~behavior}
|
||||
*/
|
||||
Drupal.behaviors.webformElementStates = {
|
||||
attach: function (context) {
|
||||
$(context).find('.webform-states-table--condition').once('webform-element-states').each(function () {
|
||||
var $condition = $(this);
|
||||
var $selector = $condition.find('.webform-states-table--selector select');
|
||||
var $value = $condition.find('.webform-states-table--value input');
|
||||
var $trigger = $condition.find('.webform-states-table--trigger select');
|
||||
|
||||
// Initialize autocompletion.
|
||||
$value.autocomplete({minLength: 0}).on('focus', function () {
|
||||
$value.autocomplete('search', '');
|
||||
});
|
||||
|
||||
// Initialize trigger and selector.
|
||||
$trigger.on('change', function () {$selector.change();});
|
||||
|
||||
$selector.on('change', function () {
|
||||
var selector = $selector.val();
|
||||
var sourceKey = drupalSettings.webformElementStates.selectors[selector];
|
||||
var source = drupalSettings.webformElementStates.sources[sourceKey];
|
||||
var notPattern = ($trigger.val().indexOf('pattern') === -1);
|
||||
if (source && notPattern) {
|
||||
// Enable autocompletion.
|
||||
$value
|
||||
.autocomplete('option', 'source', source)
|
||||
.addClass('form-autocomplete');
|
||||
}
|
||||
else {
|
||||
// Disable autocompletion.
|
||||
$value
|
||||
.autocomplete('option', 'source', [])
|
||||
.removeClass('form-autocomplete');
|
||||
}
|
||||
}).change();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery, Drupal, drupalSettings);
|
Reference in a new issue