Security update for Core, with self-updated composer
[yaffs-website] / web / core / misc / dialog / dialog.js
1 /**
2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
5 * @preserve
6 **/
7
8 (function ($, Drupal, drupalSettings) {
9   drupalSettings.dialog = {
10     autoOpen: true,
11     dialogClass: '',
12
13     buttonClass: 'button',
14     buttonPrimaryClass: 'button--primary',
15     close: function close(event) {
16       Drupal.dialog(event.target).close();
17       Drupal.detachBehaviors(event.target, null, 'unload');
18     }
19   };
20
21   Drupal.dialog = function (element, options) {
22     var undef = void 0;
23     var $element = $(element);
24     var dialog = {
25       open: false,
26       returnValue: undef,
27       show: function show() {
28         openDialog({ modal: false });
29       },
30       showModal: function showModal() {
31         openDialog({ modal: true });
32       },
33
34       close: closeDialog
35     };
36
37     function openDialog(settings) {
38       settings = $.extend({}, drupalSettings.dialog, options, settings);
39
40       $(window).trigger('dialog:beforecreate', [dialog, $element, settings]);
41       $element.dialog(settings);
42       dialog.open = true;
43       $(window).trigger('dialog:aftercreate', [dialog, $element, settings]);
44     }
45
46     function closeDialog(value) {
47       $(window).trigger('dialog:beforeclose', [dialog, $element]);
48       $element.dialog('close');
49       dialog.returnValue = value;
50       dialog.open = false;
51       $(window).trigger('dialog:afterclose', [dialog, $element]);
52     }
53
54     return dialog;
55   };
56 })(jQuery, Drupal, drupalSettings);