Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -0,0 +1,286 @@
/**
* @file
* Handles AJAX submission and response in Views UI.
*/
(function($, Drupal, drupalSettings) {
/**
* Ajax command for highlighting elements.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} response
* The Ajax response.
* @param {string} response.selector
* The selector in question.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsHighlight = function(
ajax,
response,
status,
) {
$('.hilited').removeClass('hilited');
$(response.selector).addClass('hilited');
};
/**
* Ajax command to set the form submit action in the views modal edit form.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} response
* The Ajax response. Contains .url
* @param {string} [status]
* The XHR status code?
*/
Drupal.AjaxCommands.prototype.viewsSetForm = function(
ajax,
response,
status,
) {
const $form = $('.js-views-ui-dialog form');
// Identify the button that was clicked so that .ajaxSubmit() can use it.
// We need to do this for both .click() and .mousedown() since JavaScript
// code might trigger either behavior.
const $submitButtons = $form
.find('input[type=submit].js-form-submit, button.js-form-submit')
.once('views-ajax-submit');
$submitButtons.on('click mousedown', function() {
this.form.clk = this;
});
$form.once('views-ajax-submit').each(function() {
const $form = $(this);
const elementSettings = {
url: response.url,
event: 'submit',
base: $form.attr('id'),
element: this,
};
const ajaxForm = Drupal.ajax(elementSettings);
ajaxForm.$form = $form;
});
};
/**
* Ajax command to show certain buttons in the views edit form.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} response
* The Ajax response.
* @param {bool} response.changed
* Whether the state changed for the buttons or not.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsShowButtons = function(
ajax,
response,
status,
) {
$('div.views-edit-view div.form-actions').removeClass('js-hide');
if (response.changed) {
$('div.views-edit-view div.view-changed.messages').removeClass('js-hide');
}
};
/**
* Ajax command for triggering preview.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} [response]
* The Ajax response.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsTriggerPreview = function(
ajax,
response,
status,
) {
if ($('input#edit-displays-live-preview').is(':checked')) {
$('#preview-submit').trigger('click');
}
};
/**
* Ajax command to replace the title of a page.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} response
* The Ajax response.
* @param {string} response.siteName
* The site name.
* @param {string} response.title
* The new page title.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsReplaceTitle = function(
ajax,
response,
status,
) {
const doc = document;
// For the <title> element, make a best-effort attempt to replace the page
// title and leave the site name alone. If the theme doesn't use the site
// name in the <title> element, this will fail.
const oldTitle = doc.title;
// Escape the site name, in case it has special characters in it, so we can
// use it in our regex.
const escapedSiteName = response.siteName.replace(
/[-[\]{}()*+?.,\\^$|#\s]/g,
'\\$&',
);
const re = new RegExp(`.+ (.) ${escapedSiteName}`);
doc.title = oldTitle.replace(
re,
`${response.title} $1 ${response.siteName}`,
);
$('h1.page-title').text(response.title);
};
/**
* Get rid of irritating tabledrag messages.
*
* @return {Array}
* An array of messages. Always empty array, to get rid of the messages.
*/
Drupal.theme.tableDragChangedWarning = function() {
return [];
};
/**
* Trigger preview when the "live preview" checkbox is checked.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior to trigger live preview if the live preview option is
* checked.
*/
Drupal.behaviors.livePreview = {
attach(context) {
$('input#edit-displays-live-preview', context)
.once('views-ajax')
.on('click', function() {
if ($(this).is(':checked')) {
$('#preview-submit').trigger('click');
}
});
},
};
/**
* Sync preview display.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior to sync the preview display when needed.
*/
Drupal.behaviors.syncPreviewDisplay = {
attach(context) {
$('#views-tabset a')
.once('views-ajax')
.on('click', function() {
const href = $(this).attr('href');
// Cut of #views-tabset.
const displayId = href.substr(11);
// Set the form element.
$('#views-live-preview #preview-display-id').val(displayId);
});
},
};
/**
* Ajax behaviors for the views_ui module.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches ajax behaviors to the elements with the classes in question.
*/
Drupal.behaviors.viewsAjax = {
collapseReplaced: false,
attach(context, settings) {
const baseElementSettings = {
event: 'click',
progress: { type: 'fullscreen' },
};
// Bind AJAX behaviors to all items showing the class.
$('a.views-ajax-link', context)
.once('views-ajax')
.each(function() {
const elementSettings = baseElementSettings;
elementSettings.base = $(this).attr('id');
elementSettings.element = this;
// Set the URL to go to the anchor.
if ($(this).attr('href')) {
elementSettings.url = $(this).attr('href');
}
Drupal.ajax(elementSettings);
});
$('div#views-live-preview a')
.once('views-ajax')
.each(function() {
// We don't bind to links without a URL.
if (!$(this).attr('href')) {
return true;
}
const elementSettings = baseElementSettings;
// Set the URL to go to the anchor.
elementSettings.url = $(this).attr('href');
if (
Drupal.Views.getPath(elementSettings.url).substring(0, 21) !==
'admin/structure/views'
) {
return true;
}
elementSettings.wrapper = 'views-preview-wrapper';
elementSettings.method = 'replaceWith';
elementSettings.base = $(this).attr('id');
elementSettings.element = this;
Drupal.ajax(elementSettings);
});
// Within a live preview, make exposed widget form buttons re-trigger the
// Preview button.
// @todo Revisit this after fixing Views UI to display a Preview outside
// of the main Edit form.
$('div#views-live-preview input[type=submit]')
.once('views-ajax')
.each(function(event) {
$(this).on('click', function() {
this.form.clk = this;
return true;
});
const elementSettings = baseElementSettings;
// Set the URL to go to the anchor.
elementSettings.url = $(this.form).attr('action');
if (
Drupal.Views.getPath(elementSettings.url).substring(0, 21) !==
'admin/structure/views'
) {
return true;
}
elementSettings.wrapper = 'views-preview-wrapper';
elementSettings.method = 'replaceWith';
elementSettings.event = 'click';
elementSettings.base = $(this).attr('id');
elementSettings.element = this;
Drupal.ajax(elementSettings);
});
},
};
})(jQuery, Drupal, drupalSettings);

View file

@ -1,73 +1,36 @@
/**
* @file
* Handles AJAX submission and response in Views UI.
*/
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal, drupalSettings) {
'use strict';
/**
* Ajax command for highlighting elements.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} response
* The Ajax response.
* @param {string} response.selector
* The selector in question.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsHighlight = function (ajax, response, status) {
$('.hilited').removeClass('hilited');
$(response.selector).addClass('hilited');
};
/**
* Ajax command to set the form submit action in the views modal edit form.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} response
* The Ajax response. Contains .url
* @param {string} [status]
* The XHR status code?
*/
Drupal.AjaxCommands.prototype.viewsSetForm = function (ajax, response, status) {
var $form = $('.js-views-ui-dialog form');
// Identify the button that was clicked so that .ajaxSubmit() can use it.
// We need to do this for both .click() and .mousedown() since JavaScript
// code might trigger either behavior.
var $submit_buttons = $form.find('input[type=submit].js-form-submit, button.js-form-submit').once('views-ajax-submit');
$submit_buttons.on('click mousedown', function () {
var $submitButtons = $form.find('input[type=submit].js-form-submit, button.js-form-submit').once('views-ajax-submit');
$submitButtons.on('click mousedown', function () {
this.form.clk = this;
});
$form.once('views-ajax-submit').each(function () {
var $form = $(this);
var element_settings = {
var elementSettings = {
url: response.url,
event: 'submit',
base: $form.attr('id'),
element: this
};
var ajaxForm = Drupal.ajax(element_settings);
var ajaxForm = Drupal.ajax(elementSettings);
ajaxForm.$form = $form;
});
};
/**
* Ajax command to show certain buttons in the views edit form.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} response
* The Ajax response.
* @param {bool} response.changed
* Whether the state changed for the buttons or not.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsShowButtons = function (ajax, response, status) {
$('div.views-edit-view div.form-actions').removeClass('js-hide');
if (response.changed) {
@ -75,44 +38,17 @@
}
};
/**
* Ajax command for triggering preview.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} [response]
* The Ajax response.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsTriggerPreview = function (ajax, response, status) {
if ($('input#edit-displays-live-preview').is(':checked')) {
$('#preview-submit').trigger('click');
}
};
/**
* Ajax command to replace the title of a page.
*
* @param {Drupal.Ajax} [ajax]
* An Ajax object.
* @param {object} response
* The Ajax response.
* @param {string} response.siteName
* The site name.
* @param {string} response.title
* The new page title.
* @param {number} [status]
* The HTTP status code.
*/
Drupal.AjaxCommands.prototype.viewsReplaceTitle = function (ajax, response, status) {
var doc = document;
// For the <title> element, make a best-effort attempt to replace the page
// title and leave the site name alone. If the theme doesn't use the site
// name in the <title> element, this will fail.
var oldTitle = doc.title;
// Escape the site name, in case it has special characters in it, so we can
// use it in our regex.
var escapedSiteName = response.siteName.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
var re = new RegExp('.+ (.) ' + escapedSiteName);
doc.title = oldTitle.replace(re, response.title + ' $1 ' + response.siteName);
@ -120,27 +56,12 @@
$('h1.page-title').text(response.title);
};
/**
* Get rid of irritating tabledrag messages.
*
* @return {Array}
* An array of messages. Always empty array, to get rid of the messages.
*/
Drupal.theme.tableDragChangedWarning = function () {
return [];
};
/**
* Trigger preview when the "live preview" checkbox is checked.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior to trigger live preview if the live preview option is
* checked.
*/
Drupal.behaviors.livePreview = {
attach: function (context) {
attach: function attach(context) {
$('input#edit-displays-live-preview', context).once('views-ajax').on('click', function () {
if ($(this).is(':checked')) {
$('#preview-submit').trigger('click');
@ -149,101 +70,76 @@
}
};
/**
* Sync preview display.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior to sync the preview display when needed.
*/
Drupal.behaviors.syncPreviewDisplay = {
attach: function (context) {
attach: function attach(context) {
$('#views-tabset a').once('views-ajax').on('click', function () {
var href = $(this).attr('href');
// Cut of #views-tabset.
var display_id = href.substr(11);
// Set the form element.
$('#views-live-preview #preview-display-id').val(display_id);
var displayId = href.substr(11);
$('#views-live-preview #preview-display-id').val(displayId);
});
}
};
/**
* Ajax behaviors for the views_ui module.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches ajax behaviors to the elements with the classes in question.
*/
Drupal.behaviors.viewsAjax = {
collapseReplaced: false,
attach: function (context, settings) {
var base_element_settings = {
attach: function attach(context, settings) {
var baseElementSettings = {
event: 'click',
progress: {type: 'fullscreen'}
progress: { type: 'fullscreen' }
};
// Bind AJAX behaviors to all items showing the class.
$('a.views-ajax-link', context).once('views-ajax').each(function () {
var element_settings = base_element_settings;
element_settings.base = $(this).attr('id');
element_settings.element = this;
// Set the URL to go to the anchor.
var elementSettings = baseElementSettings;
elementSettings.base = $(this).attr('id');
elementSettings.element = this;
if ($(this).attr('href')) {
element_settings.url = $(this).attr('href');
elementSettings.url = $(this).attr('href');
}
Drupal.ajax(element_settings);
Drupal.ajax(elementSettings);
});
$('div#views-live-preview a')
.once('views-ajax').each(function () {
// We don't bind to links without a URL.
if (!$(this).attr('href')) {
return true;
}
$('div#views-live-preview a').once('views-ajax').each(function () {
if (!$(this).attr('href')) {
return true;
}
var element_settings = base_element_settings;
// Set the URL to go to the anchor.
element_settings.url = $(this).attr('href');
if (Drupal.Views.getPath(element_settings.url).substring(0, 21) !== 'admin/structure/views') {
return true;
}
var elementSettings = baseElementSettings;
element_settings.wrapper = 'views-preview-wrapper';
element_settings.method = 'replaceWith';
element_settings.base = $(this).attr('id');
element_settings.element = this;
Drupal.ajax(element_settings);
elementSettings.url = $(this).attr('href');
if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') {
return true;
}
elementSettings.wrapper = 'views-preview-wrapper';
elementSettings.method = 'replaceWith';
elementSettings.base = $(this).attr('id');
elementSettings.element = this;
Drupal.ajax(elementSettings);
});
$('div#views-live-preview input[type=submit]').once('views-ajax').each(function (event) {
$(this).on('click', function () {
this.form.clk = this;
return true;
});
var elementSettings = baseElementSettings;
// Within a live preview, make exposed widget form buttons re-trigger the
// Preview button.
// @todo Revisit this after fixing Views UI to display a Preview outside
// of the main Edit form.
$('div#views-live-preview input[type=submit]')
.once('views-ajax').each(function (event) {
$(this).on('click', function () {
this.form.clk = this;
return true;
});
var element_settings = base_element_settings;
// Set the URL to go to the anchor.
element_settings.url = $(this.form).attr('action');
if (Drupal.Views.getPath(element_settings.url).substring(0, 21) !== 'admin/structure/views') {
return true;
}
elementSettings.url = $(this.form).attr('action');
if (Drupal.Views.getPath(elementSettings.url).substring(0, 21) !== 'admin/structure/views') {
return true;
}
element_settings.wrapper = 'views-preview-wrapper';
element_settings.method = 'replaceWith';
element_settings.event = 'click';
element_settings.base = $(this).attr('id');
element_settings.element = this;
Drupal.ajax(element_settings);
});
elementSettings.wrapper = 'views-preview-wrapper';
elementSettings.method = 'replaceWith';
elementSettings.event = 'click';
elementSettings.base = $(this).attr('id');
elementSettings.element = this;
Drupal.ajax(elementSettings);
});
}
};
})(jQuery, Drupal, drupalSettings);
})(jQuery, Drupal, drupalSettings);

View file

@ -0,0 +1,67 @@
/**
* @file
* Views dialog behaviors.
*/
(function($, Drupal, drupalSettings) {
function handleDialogResize(e) {
const $modal = $(e.currentTarget);
const $viewsOverride = $modal.find('[data-drupal-views-offset]');
const $scroll = $modal.find('[data-drupal-views-scroll]');
let offset = 0;
let modalHeight;
if ($scroll.length) {
// Add a class to do some styles adjustments.
$modal.closest('.views-ui-dialog').addClass('views-ui-dialog-scroll');
// Let scroll element take all the height available.
$scroll.css({ overflow: 'visible', height: 'auto' });
modalHeight = $modal.height();
$viewsOverride.each(function() {
offset += $(this).outerHeight();
});
// Take internal padding into account.
const scrollOffset = $scroll.outerHeight() - $scroll.height();
$scroll.height(modalHeight - offset - scrollOffset);
// Reset scrolling properties.
$modal.css('overflow', 'hidden');
$scroll.css('overflow', 'auto');
}
}
/**
* Functionality for views modals.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches modal functionality for views.
* @prop {Drupal~behaviorDetach} detach
* Detaches the modal functionality.
*/
Drupal.behaviors.viewsModalContent = {
attach(context) {
$('body')
.once('viewsDialog')
.on(
'dialogContentResize.viewsDialog',
'.ui-dialog-content',
handleDialogResize,
);
// When expanding details, make sure the modal is resized.
$(context)
.find('.scroll')
.once('detailsUpdate')
.on('click', 'summary', e => {
$(e.currentTarget).trigger('dialogContentResize');
});
},
detach(context, settings, trigger) {
if (trigger === 'unload') {
$('body')
.removeOnce('viewsDialog')
.off('.viewsDialog');
}
},
};
})(jQuery, Drupal, drupalSettings);

View file

@ -1,58 +1,46 @@
/**
* @file
* Views dialog behaviors.
*/
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal, drupalSettings) {
'use strict';
function handleDialogResize(e) {
var $modal = $(e.currentTarget);
var $viewsOverride = $modal.find('[data-drupal-views-offset]');
var $scroll = $modal.find('[data-drupal-views-scroll]');
var offset = 0;
var modalHeight;
var modalHeight = void 0;
if ($scroll.length) {
// Add a class to do some styles adjustments.
$modal.closest('.views-ui-dialog').addClass('views-ui-dialog-scroll');
// Let scroll element take all the height available.
$scroll.css({overflow: 'visible', height: 'auto'});
modalHeight = $modal.height();
$viewsOverride.each(function () { offset += $(this).outerHeight(); });
// Take internal padding into account.
$scroll.css({ overflow: 'visible', height: 'auto' });
modalHeight = $modal.height();
$viewsOverride.each(function () {
offset += $(this).outerHeight();
});
var scrollOffset = $scroll.outerHeight() - $scroll.height();
$scroll.height(modalHeight - offset - scrollOffset);
// Reset scrolling properties.
$modal.css('overflow', 'hidden');
$scroll.css('overflow', 'auto');
}
}
/**
* Functionality for views modals.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches modal functionality for views.
* @prop {Drupal~behaviorDetach} detach
* Detaches the modal functionality.
*/
Drupal.behaviors.viewsModalContent = {
attach: function (context) {
attach: function attach(context) {
$('body').once('viewsDialog').on('dialogContentResize.viewsDialog', '.ui-dialog-content', handleDialogResize);
// When expanding details, make sure the modal is resized.
$(context).find('.scroll').once('detailsUpdate').on('click', 'summary', function (e) {
$(e.currentTarget).trigger('dialogContentResize');
});
},
detach: function (context, settings, trigger) {
detach: function detach(context, settings, trigger) {
if (trigger === 'unload') {
$('body').removeOnce('viewsDialog').off('.viewsDialog');
}
}
};
})(jQuery, Drupal, drupalSettings);
})(jQuery, Drupal, drupalSettings);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,57 @@
/**
* @file
* Views listing behaviors.
*/
(function($, Drupal) {
/**
* Filters the view listing tables by a text input search string.
*
* Text search input: input.views-filter-text
* Target table: input.views-filter-text[data-table]
* Source text: [data-drupal-selector="views-table-filter-text-source"]
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the filter functionality to the views admin text search field.
*/
Drupal.behaviors.viewTableFilterByText = {
attach(context, settings) {
const $input = $('input.views-filter-text').once('views-filter-text');
const $table = $($input.attr('data-table'));
let $rows;
function filterViewList(e) {
const query = $(e.target)
.val()
.toLowerCase();
function showViewRow(index, row) {
const $row = $(row);
const $sources = $row.find(
'[data-drupal-selector="views-table-filter-text-source"]',
);
const textMatch =
$sources
.text()
.toLowerCase()
.indexOf(query) !== -1;
$row.closest('tr').toggle(textMatch);
}
// Filter if the length of the query is at least 2 characters.
if (query.length >= 2) {
$rows.each(showViewRow);
} else {
$rows.show();
}
}
if ($table.length) {
$rows = $table.find('tbody tr');
$input.on('keyup', filterViewList);
}
},
};
})(jQuery, Drupal);

View file

@ -1,29 +1,16 @@
/**
* @file
* Views listing behaviors.
*/
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal) {
'use strict';
/**
* Filters the view listing tables by a text input search string.
*
* Text search input: input.views-filter-text
* Target table: input.views-filter-text[data-table]
* Source text: [data-drupal-selector="views-table-filter-text-source"]
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the filter functionality to the views admin text search field.
*/
Drupal.behaviors.viewTableFilterByText = {
attach: function (context, settings) {
attach: function attach(context, settings) {
var $input = $('input.views-filter-text').once('views-filter-text');
var $table = $($input.attr('data-table'));
var $rows;
var $rows = void 0;
function filterViewList(e) {
var query = $(e.target).val().toLowerCase();
@ -35,11 +22,9 @@
$row.closest('tr').toggle(textMatch);
}
// Filter if the length of the query is at least 2 characters.
if (query.length >= 2) {
$rows.each(showViewRow);
}
else {
} else {
$rows.show();
}
}
@ -50,5 +35,4 @@
}
}
};
}(jQuery, Drupal));
})(jQuery, Drupal);