composer update

This commit is contained in:
Oliver Davies 2019-01-24 08:00:03 +00:00
parent f6abc3dce2
commit 71dfaca858
1753 changed files with 45274 additions and 14619 deletions

View file

@ -0,0 +1,33 @@
/**
* @file
* JavaScript behaviors for announcing changes.
*/
(function ($, Drupal) {
'use strict';
/**
* Provide Webform announce attribute behavior.
*
* Announces changes using [data-webform-announce] attribute.
*
* The announce attributes allows FAPI Ajax callbacks to easily
* trigger announcements.
*
* @see \Drupal\webform\Element\WebformComputedBase::ajaxWebformComputedCallback
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the behavior to [data-webform-announce] attribute.
*/
Drupal.behaviors.webformAnnounce = {
attach: function (context) {
$('[data-webform-announce]', context).once('data-webform-announce').each(function () {
Drupal.announce($(this).data('webform-announce'));
});
}
};
})(jQuery, Drupal);

View file

@ -38,7 +38,7 @@
var options = $.extend({
mode: $(this).attr('data-webform-codemirror-mode'),
lineNumbers: true,
lineWrapping: true,
c: ($(this).attr('wrap') === 'off') ? false : true,
viewportMargin: Infinity,
readOnly: ($(this).prop('readonly') || $(this).prop('disabled')) ? true : false,
extraKeys: {

View file

@ -29,26 +29,36 @@
return;
}
// Add event handler to elements that are used by the computed element.
// Get computed element triggers.
var inputs = [];
$.each(elementKeys, function (i, key) {
$form.find(':input[name^="' + key + '"]')
.on('keyup change', debounce(triggerUpdate, Drupal.webform.computed.delay));
// Exact input match.
inputs.push(':input[name="' + key + '"]');
// Sub inputs. (aka #tree)
inputs.push(':input[name^="' + key + '["]');
});
var $triggers = $form.find(inputs.join(','));
// Add event handler to computed element triggers.
$triggers.on('keyup change',
debounce(triggerUpdate, Drupal.webform.computed.delay));
// Initialize computed element update which refreshes the displayed
// value and accounts for any changes to the #default_value for a
// computed element.
triggerUpdate();
triggerUpdate(true);
function triggerUpdate() {
function triggerUpdate(initialize) {
// Prevent duplicate computations.
// @see Drupal.behaviors.formSingleSubmit
var formValues = $form.find('input[name!=form_build_id]').serialize();
var previousValues = $element.attr('data-webform-computed-last');
if (previousValues === formValues) {
return;
if (initialize !== true) {
var formValues = $triggers.serialize();
var previousValues = $element.attr('data-webform-computed-last');
if (previousValues === formValues) {
return;
}
$element.attr('data-webform-computed-last', formValues);
}
$element.attr('data-webform-computed-last', formValues);
// Add loading class to computed wrapper.
$element.find('.js-webform-computed-wrapper')

View file

@ -41,6 +41,16 @@
changeYear: true
}, Drupal.webform.datePicker.options);
// Add datepicker button.
if ($input.hasData('datepicker-button')) {
options = $.extend({
showOn: 'both',
buttonImage: settings.webform.datePicker.buttonImage,
buttonImageOnly: true,
buttonText: Drupal.t('Select date')
}, Drupal.webform.datePicker.options);
}
var dateFormat = $input.data('drupalDateFormat');
// The date format is saved in PHP style, we need to convert to jQuery
@ -78,6 +88,11 @@
// First day of the week.
options.firstDay = settings.webform.dateFirstDay;
// Disable autocomplete.
// @see https://gist.github.com/niksumeiko/360164708c3b326bd1c8
var isChrome = /Chrome/.test(window.navigator.userAgent) && /Google Inc/.test(window.navigator.vendor);
$input.attr('autocomplete', (isChrome) ? 'off' : 'false');
$input.datepicker(options);
});
}

View file

@ -56,7 +56,7 @@
// Set the saved states for all the details elements.
// @see webform.element.details.save.js
if (!Drupal.webformDetailsSaveGetName) {
if (Drupal.webformDetailsSaveGetName) {
$form.find('details').each(function () {
var name = Drupal.webformDetailsSaveGetName($(this));
if (name) {
@ -70,7 +70,7 @@
if ($tabs.length) {
// Add toggle state before the tabs.
$tabs.find('.item-list:first-child').before($toggle);
$tabs.find('.item-list:first-child').eq(0).before($toggle);
}
else {
// Add toggle state link to first details element.

View file

@ -66,7 +66,7 @@
// Disable autocomplete.
// @see https://gist.github.com/niksumeiko/360164708c3b326bd1c8
var isChrome = /Chrome/.test(window.navigator.userAgent) && /Google Inc/.test(window.navigator.vendor);
$input.attr('autocomplete', (isChrome) ? 'disabled' : 'false');
$input.attr('autocomplete', (isChrome) ? 'off' : 'false');
// Sync values on change and clear events.
placesAutocomplete.on('change', function (e) {

View 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);

View file

@ -123,10 +123,10 @@
// @see Issue #2977569: Hidden fieldsets that become visible with conditional logic cannot be made required.
if ($target.is('.js-webform-type-radios, .js-webform-type-checkboxes, fieldset')) {
if (e.value) {
$target.find('legend span:not(.visually-hidden)').addClass('js-form-required form-required');
$target.find('legend span.fieldset-legend:not(.visually-hidden)').addClass('js-form-required form-required');
}
else {
$target.find('legend span:not(.visually-hidden)').removeClass('js-form-required form-required');
$target.find('legend span.fieldset-legend:not(.visually-hidden)').removeClass('js-form-required form-required');
}
}

View file

@ -19,12 +19,21 @@
attach: function (context) {
// Make sure on page load or Ajax refresh the location ?page is correct
// since conditional logic can skip pages.
// Note: window.history is only supported by IE 10+ and all other browsers.
if (window.history && history.replaceState) {
$('form[data-webform-wizard-current-page]', context).once('webform-wizard-current-page').each(function () {
var page = $(this).attr('data-webform-wizard-current-page');
history.replaceState(null, null, window.location.toString().replace(/\?.+$/, '') + '?page=' + page);
});
// Note: window.history is only supported by IE 10+.
if (window.history && window.history.replaceState) {
// Track the form's current page for 8.5.x and below.
// @todo Remove the below code once only 8.6.x is supported.
// @see https://www.drupal.org/project/drupal/issues/2508796
$('form[data-webform-wizard-current-page]', context)
.once('webform-wizard-current-page')
.each(function () {
trackPage(this);
});
// Track the form's current page for 8.6.x and above.
if ($(context).hasData('webform-wizard-current-page')) {
trackPage(context);
}
}
// When paging next and back update the URL so that Drupal knows what
@ -35,6 +44,23 @@
var page = $(this).attr('data-webform-wizard-page');
this.form.action = this.form.action.replace(/\?.+$/, '') + '?page=' + page;
});
/**
* Append the form's current page data attribute to the browser's URL.
*
* @param {HTMLElement} form
* The form element.
*/
function trackPage(form) {
var $form = $(form);
// Make sure the form is visible before updating the URL.
if ($form.is(':visible')) {
var page = $form.attr('data-webform-wizard-current-page');
var url = window.location.toString().replace(/\?.+$/, '') +
'?page=' + page;
window.history.replaceState(null, null, url);
}
}
}
};