fomantic-ui 2.10.0-beta.62 → 2.10.0-beta.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +0 -1
- package/changelog-setup.js +10 -10
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +40 -41
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +57 -61
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +186 -187
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +29 -30
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +22 -23
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +293 -337
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +33 -35
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +74 -81
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +141 -146
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -1
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +80 -81
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +27 -28
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +62 -72
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +51 -55
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +33 -34
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +96 -109
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +44 -45
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +56 -64
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +16 -17
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +143 -148
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +24 -25
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +42 -43
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +57 -66
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +32 -33
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +38 -45
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +76 -77
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +1753 -1884
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/package.json +1 -1
- package/scripts/nightly-version.js +3 -3
- package/src/definitions/behaviors/api.js +56 -60
- package/src/definitions/behaviors/form.js +140 -145
- package/src/definitions/behaviors/state.js +23 -24
- package/src/definitions/behaviors/visibility.js +75 -76
- package/src/definitions/globals/site.js +15 -16
- package/src/definitions/modules/accordion.js +39 -40
- package/src/definitions/modules/calendar.js +185 -186
- package/src/definitions/modules/checkbox.js +28 -29
- package/src/definitions/modules/dimmer.js +21 -22
- package/src/definitions/modules/dropdown.js +292 -336
- package/src/definitions/modules/embed.js +32 -34
- package/src/definitions/modules/flyout.js +73 -80
- package/src/definitions/modules/modal.js +79 -80
- package/src/definitions/modules/nag.js +26 -27
- package/src/definitions/modules/popup.js +61 -71
- package/src/definitions/modules/progress.js +50 -54
- package/src/definitions/modules/rating.js +32 -33
- package/src/definitions/modules/search.js +95 -108
- package/src/definitions/modules/shape.js +43 -44
- package/src/definitions/modules/sidebar.js +55 -63
- package/src/definitions/modules/slider.js +142 -147
- package/src/definitions/modules/sticky.js +41 -42
- package/src/definitions/modules/tab.js +56 -65
- package/src/definitions/modules/toast.js +31 -32
- package/src/definitions/modules/transition.js +37 -44
- package/tasks/admin/components/create.js +11 -11
- package/tasks/admin/components/init.js +11 -12
- package/tasks/admin/components/update.js +19 -20
- package/tasks/admin/distributions/create.js +24 -36
- package/tasks/admin/distributions/init.js +11 -12
- package/tasks/admin/distributions/update.js +18 -19
- package/tasks/admin/register.js +7 -7
- package/tasks/build/assets.js +1 -1
- package/tasks/build/css.js +1 -1
- package/tasks/build/javascript.js +1 -1
- package/tasks/config/admin/github.js +1 -1
- package/tasks/config/admin/templates/css-package.js +1 -1
- package/tasks/config/admin/templates/less-package.js +1 -1
- package/tasks/config/project/config.js +6 -6
- package/tasks/config/project/install.js +12 -12
- package/tasks/config/project/release.js +5 -11
- package/tasks/config/tasks.js +5 -5
- package/tasks/config/user.js +1 -4
- package/tasks/docs/metadata.js +11 -12
- package/tasks/install.js +9 -9
- package/test/meteor/assets.js +1 -1
- package/test/modules/module.spec.js +18 -18
package/dist/components/modal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
|
2
|
+
* # Fomantic-UI 2.10.0-beta.64+bcb9c73 - Modal
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
|
4
4
|
*
|
|
5
5
|
*
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
22
|
$.fn.modal = function (...args) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const $allModules = $(this);
|
|
24
|
+
const $window = $(window);
|
|
25
|
+
const $document = $(document);
|
|
26
|
+
const $body = $('body');
|
|
27
27
|
|
|
28
28
|
let time = Date.now();
|
|
29
29
|
let performance = [];
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const parameters = args[0];
|
|
32
|
+
const methodInvoked = typeof parameters === 'string';
|
|
33
|
+
const queryArguments = args.slice(1);
|
|
34
|
+
const contextCheck = function (context, win) {
|
|
35
35
|
let $context;
|
|
36
36
|
if ([window, document].includes(context)) {
|
|
37
37
|
$context = $body;
|
|
@@ -51,18 +51,18 @@
|
|
|
51
51
|
? $.extend(true, {}, $.fn.modal.settings, parameters)
|
|
52
52
|
: $.extend({}, $.fn.modal.settings);
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
const selector = settings.selector;
|
|
55
55
|
let className = settings.className;
|
|
56
56
|
let namespace = settings.namespace;
|
|
57
57
|
let fields = settings.fields;
|
|
58
58
|
let error = settings.error;
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
const eventNamespace = '.' + namespace;
|
|
61
|
+
const moduleNamespace = 'module-' + namespace;
|
|
62
62
|
|
|
63
63
|
let $module = $(this);
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const $context = contextCheck(settings.context, window);
|
|
65
|
+
const isBody = $context[0] === $body[0];
|
|
66
66
|
let $closeIcon = $module.find(selector.closeIcon);
|
|
67
67
|
let $inputs;
|
|
68
68
|
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
let $dimmable;
|
|
73
73
|
let $dimmer;
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
const isModalComponent = $module.hasClass('modal');
|
|
76
76
|
|
|
77
77
|
let element = this;
|
|
78
78
|
let instance = isModalComponent ? $module.data(moduleNamespace) : undefined;
|
|
@@ -92,8 +92,7 @@
|
|
|
92
92
|
let id;
|
|
93
93
|
let observer;
|
|
94
94
|
let observeAttributes = false;
|
|
95
|
-
|
|
96
|
-
module = {
|
|
95
|
+
const module = {
|
|
97
96
|
|
|
98
97
|
initialize: function () {
|
|
99
98
|
module.create.id();
|
|
@@ -121,12 +120,12 @@
|
|
|
121
120
|
$actions.empty();
|
|
122
121
|
}
|
|
123
122
|
settings.actions.forEach(function (el) {
|
|
124
|
-
|
|
123
|
+
const icon = el[fields.icon]
|
|
125
124
|
? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.escape(el[fields.icon]) + ' icon"></i>'
|
|
126
125
|
: '';
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
const text = module.helpers.escape(el[fields.text] || '', settings);
|
|
127
|
+
const cls = module.helpers.escape(el[fields.class] || '');
|
|
128
|
+
const click = el[fields.click] && isFunction(el[fields.click])
|
|
130
129
|
? el[fields.click]
|
|
131
130
|
: function () {};
|
|
132
131
|
$actions.append($('<button/>', {
|
|
@@ -135,7 +134,7 @@
|
|
|
135
134
|
class: className.button + ' ' + cls,
|
|
136
135
|
on: {
|
|
137
136
|
click: function () {
|
|
138
|
-
|
|
137
|
+
const button = $(this);
|
|
139
138
|
if (button.is(selector.approve) || button.is(selector.deny) || click.call(element, $module) === false) {
|
|
140
139
|
return;
|
|
141
140
|
}
|
|
@@ -185,12 +184,12 @@
|
|
|
185
184
|
$module.append($closeIcon);
|
|
186
185
|
}
|
|
187
186
|
if (settings.title !== '') {
|
|
188
|
-
|
|
187
|
+
const titleId = '_' + module.get.id() + 'title';
|
|
189
188
|
$module.attr('aria-labelledby', titleId);
|
|
190
189
|
$('<div/>', { class: className.title, id: titleId }).appendTo($module);
|
|
191
190
|
}
|
|
192
191
|
if (settings.content !== '') {
|
|
193
|
-
|
|
192
|
+
const descId = '_' + module.get.id() + 'desc';
|
|
194
193
|
$module.attr('aria-describedby', descId);
|
|
195
194
|
$('<div/>', { class: className.content, id: descId }).appendTo($module);
|
|
196
195
|
}
|
|
@@ -201,11 +200,11 @@
|
|
|
201
200
|
element = $module[0];
|
|
202
201
|
},
|
|
203
202
|
dimmer: function () {
|
|
204
|
-
|
|
203
|
+
const defaultSettings = {
|
|
205
204
|
debug: settings.debug,
|
|
206
205
|
dimmerName: 'modals',
|
|
207
206
|
};
|
|
208
|
-
|
|
207
|
+
const dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
|
|
209
208
|
if ($.fn.dimmer === undefined) {
|
|
210
209
|
module.error(error.dimmer);
|
|
211
210
|
|
|
@@ -254,8 +253,8 @@
|
|
|
254
253
|
|
|
255
254
|
observeChanges: function () {
|
|
256
255
|
observer = new MutationObserver(function (mutations) {
|
|
257
|
-
|
|
258
|
-
|
|
256
|
+
const collectNodes = function (parent) {
|
|
257
|
+
const nodes = [];
|
|
259
258
|
for (const c of parent) {
|
|
260
259
|
nodes.push(...collectNodes(c.childNodes), c);
|
|
261
260
|
}
|
|
@@ -274,8 +273,8 @@
|
|
|
274
273
|
shouldRefresh = true;
|
|
275
274
|
// mutationobserver only provides the parent nodes,
|
|
276
275
|
// so let's collect all childs as well to find nested inputs
|
|
277
|
-
|
|
278
|
-
|
|
276
|
+
const $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible');
|
|
277
|
+
const $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
|
|
279
278
|
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
|
|
280
279
|
shouldRefreshInputs = true;
|
|
281
280
|
if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
|
|
@@ -343,7 +342,7 @@
|
|
|
343
342
|
},
|
|
344
343
|
|
|
345
344
|
attachEvents: function (selector, event) {
|
|
346
|
-
|
|
345
|
+
const $toggle = $(selector);
|
|
347
346
|
event = isFunction(module[event])
|
|
348
347
|
? module[event]
|
|
349
348
|
: module.toggle;
|
|
@@ -428,21 +427,21 @@
|
|
|
428
427
|
module.hide();
|
|
429
428
|
},
|
|
430
429
|
closeKeyUp: function (event) {
|
|
431
|
-
|
|
430
|
+
const keyCode = event.which;
|
|
432
431
|
if ((keyCode === settings.keys.enter || keyCode === settings.keys.space) && $module.hasClass(className.front)) {
|
|
433
432
|
module.hide();
|
|
434
433
|
}
|
|
435
434
|
},
|
|
436
435
|
inputKeyDown: {
|
|
437
436
|
first: function (event) {
|
|
438
|
-
|
|
437
|
+
const keyCode = event.which;
|
|
439
438
|
if (keyCode === settings.keys.tab && event.shiftKey) {
|
|
440
439
|
$inputs.last().trigger('focus');
|
|
441
440
|
event.preventDefault();
|
|
442
441
|
}
|
|
443
442
|
},
|
|
444
443
|
last: function (event) {
|
|
445
|
-
|
|
444
|
+
const keyCode = event.which;
|
|
446
445
|
if (keyCode === settings.keys.tab && !event.shiftKey) {
|
|
447
446
|
$inputs.first().trigger('focus');
|
|
448
447
|
event.preventDefault();
|
|
@@ -450,8 +449,8 @@
|
|
|
450
449
|
},
|
|
451
450
|
},
|
|
452
451
|
mousedown: function (event) {
|
|
453
|
-
|
|
454
|
-
|
|
452
|
+
const $target = $(event.target);
|
|
453
|
+
const isRtl = module.is.rtl();
|
|
455
454
|
initialMouseDownInModal = $target.closest(selector.modal).length > 0;
|
|
456
455
|
if (initialMouseDownInModal) {
|
|
457
456
|
module.verbose('Mouse down event registered inside the modal');
|
|
@@ -477,9 +476,9 @@
|
|
|
477
476
|
|
|
478
477
|
return;
|
|
479
478
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
479
|
+
const $target = $(event.target);
|
|
480
|
+
const isInModal = $target.closest(selector.modal).length > 0;
|
|
481
|
+
const isInDOM = document.documentElement.contains(event.target);
|
|
483
482
|
if (!isInModal && isInDOM && module.is.active() && $module.hasClass(className.front)) {
|
|
484
483
|
module.debug('Dimmer clicked, hiding all modals');
|
|
485
484
|
if (settings.allowMultiple) {
|
|
@@ -499,7 +498,7 @@
|
|
|
499
498
|
}, delay);
|
|
500
499
|
},
|
|
501
500
|
keyboard: function (event) {
|
|
502
|
-
|
|
501
|
+
const keyCode = event.which;
|
|
503
502
|
if (keyCode === settings.keys.escape) {
|
|
504
503
|
if (settings.closable) {
|
|
505
504
|
module.debug('Escape key pressed hiding modal');
|
|
@@ -630,7 +629,7 @@
|
|
|
630
629
|
},
|
|
631
630
|
|
|
632
631
|
hideModal: function (callback, keepDimmed, hideOthersToo) {
|
|
633
|
-
|
|
632
|
+
const $previousModal = $otherModals.filter('.' + className.active).last();
|
|
634
633
|
callback = isFunction(callback)
|
|
635
634
|
? callback
|
|
636
635
|
: function () {};
|
|
@@ -719,7 +718,7 @@
|
|
|
719
718
|
},
|
|
720
719
|
|
|
721
720
|
hideAll: function (callback) {
|
|
722
|
-
|
|
721
|
+
const $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating);
|
|
723
722
|
callback = isFunction(callback)
|
|
724
723
|
? callback
|
|
725
724
|
: function () {};
|
|
@@ -741,7 +740,7 @@
|
|
|
741
740
|
},
|
|
742
741
|
|
|
743
742
|
hideOthers: function (callback) {
|
|
744
|
-
|
|
743
|
+
const $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating);
|
|
745
744
|
callback = isFunction(callback)
|
|
746
745
|
? callback
|
|
747
746
|
: function () {};
|
|
@@ -771,8 +770,8 @@
|
|
|
771
770
|
|
|
772
771
|
save: {
|
|
773
772
|
focus: function () {
|
|
774
|
-
|
|
775
|
-
|
|
773
|
+
const $activeElement = $(document.activeElement);
|
|
774
|
+
const inCurrentModal = $activeElement.closest($module).length > 0;
|
|
776
775
|
if (!inCurrentModal) {
|
|
777
776
|
$focusedElement = $(document.activeElement).trigger('blur');
|
|
778
777
|
}
|
|
@@ -780,7 +779,7 @@
|
|
|
780
779
|
bodyMargin: function () {
|
|
781
780
|
initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
|
|
782
781
|
initialBodyMarginInt = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10);
|
|
783
|
-
|
|
782
|
+
const bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
|
|
784
783
|
tempBodyMargin = initialBodyMarginInt + bodyScrollbarWidth;
|
|
785
784
|
},
|
|
786
785
|
},
|
|
@@ -792,11 +791,11 @@
|
|
|
792
791
|
}
|
|
793
792
|
},
|
|
794
793
|
bodyMargin: function () {
|
|
795
|
-
|
|
794
|
+
const position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
|
796
795
|
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMarginInt === 0 ? '' : initialBodyMargin);
|
|
797
796
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
|
798
|
-
|
|
799
|
-
|
|
797
|
+
const el = $(this);
|
|
798
|
+
const attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
|
800
799
|
el.css(attribute, '');
|
|
801
800
|
});
|
|
802
801
|
},
|
|
@@ -850,9 +849,9 @@
|
|
|
850
849
|
|
|
851
850
|
cacheSizes: function () {
|
|
852
851
|
$module.addClass(className.loading);
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
852
|
+
const scrollHeight = $module.prop('scrollHeight');
|
|
853
|
+
const modalWidth = $module.outerWidth();
|
|
854
|
+
const modalHeight = $module.outerHeight();
|
|
856
855
|
if (module.cache.pageHeight === undefined || modalHeight !== 0) {
|
|
857
856
|
$.extend(module.cache, {
|
|
858
857
|
pageHeight: $document.outerHeight(),
|
|
@@ -904,13 +903,13 @@
|
|
|
904
903
|
return settings.useFlex;
|
|
905
904
|
},
|
|
906
905
|
fit: function () {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
906
|
+
const contextHeight = module.cache.contextHeight;
|
|
907
|
+
const verticalCenter = module.cache.contextHeight / 2;
|
|
908
|
+
const topOffset = module.cache.topOffset;
|
|
909
|
+
const scrollHeight = module.cache.scrollHeight;
|
|
910
|
+
const height = module.cache.height;
|
|
911
|
+
const paddingHeight = settings.padding;
|
|
912
|
+
const startPosition = verticalCenter + topOffset;
|
|
914
913
|
|
|
915
914
|
return scrollHeight > height
|
|
916
915
|
? startPosition + scrollHeight + paddingHeight < contextHeight
|
|
@@ -966,9 +965,9 @@
|
|
|
966
965
|
observeAttributes = state !== false;
|
|
967
966
|
},
|
|
968
967
|
autofocus: function () {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
968
|
+
const $autofocus = $inputs.filter('[autofocus]');
|
|
969
|
+
const $rawInputs = $inputs.filter(':input');
|
|
970
|
+
const $input = ($autofocus.length > 0
|
|
972
971
|
? $autofocus
|
|
973
972
|
: ($rawInputs.length > 0
|
|
974
973
|
? $rawInputs
|
|
@@ -977,13 +976,13 @@
|
|
|
977
976
|
$input.trigger('focus');
|
|
978
977
|
},
|
|
979
978
|
bodyMargin: function () {
|
|
980
|
-
|
|
979
|
+
const position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
|
981
980
|
if (settings.detachable || module.can.fit()) {
|
|
982
981
|
$context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
|
|
983
982
|
}
|
|
984
983
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
|
985
|
-
|
|
986
|
-
|
|
984
|
+
const el = $(this);
|
|
985
|
+
const attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
|
987
986
|
el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
|
|
988
987
|
});
|
|
989
988
|
},
|
|
@@ -1003,7 +1002,7 @@
|
|
|
1003
1002
|
|
|
1004
1003
|
return;
|
|
1005
1004
|
}
|
|
1006
|
-
|
|
1005
|
+
const defaultSettings = {
|
|
1007
1006
|
debug: settings.debug,
|
|
1008
1007
|
dimmerName: 'modals',
|
|
1009
1008
|
closable: 'auto',
|
|
@@ -1013,7 +1012,7 @@
|
|
|
1013
1012
|
hide: settings.transition.hideDuration || settings.duration,
|
|
1014
1013
|
},
|
|
1015
1014
|
};
|
|
1016
|
-
|
|
1015
|
+
const dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
|
|
1017
1016
|
if (settings.inverted) {
|
|
1018
1017
|
dimmerSettings.variation = dimmerSettings.variation !== undefined
|
|
1019
1018
|
? dimmerSettings.variation + ' inverted'
|
|
@@ -1035,7 +1034,7 @@
|
|
|
1035
1034
|
},
|
|
1036
1035
|
modalOffset: function () {
|
|
1037
1036
|
if (!settings.detachable) {
|
|
1038
|
-
|
|
1037
|
+
const canFit = module.can.fit();
|
|
1039
1038
|
$module
|
|
1040
1039
|
.css({
|
|
1041
1040
|
top: !$module.hasClass('aligned') && canFit
|
|
@@ -1193,7 +1192,7 @@
|
|
|
1193
1192
|
query = query.split(/[ .]/);
|
|
1194
1193
|
maxDepth = query.length - 1;
|
|
1195
1194
|
$.each(query, function (depth, value) {
|
|
1196
|
-
|
|
1195
|
+
const camelCaseValue = depth !== maxDepth
|
|
1197
1196
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
1198
1197
|
: query;
|
|
1199
1198
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
@@ -1426,9 +1425,9 @@
|
|
|
1426
1425
|
};
|
|
1427
1426
|
},
|
|
1428
1427
|
alert: function (...args) {
|
|
1429
|
-
|
|
1428
|
+
const settings = this.get.settings();
|
|
1430
1429
|
args = settings.templates.getArguments(args);
|
|
1431
|
-
|
|
1430
|
+
const approveFn = args.handler;
|
|
1432
1431
|
|
|
1433
1432
|
return {
|
|
1434
1433
|
title: args.title,
|
|
@@ -1442,12 +1441,12 @@
|
|
|
1442
1441
|
};
|
|
1443
1442
|
},
|
|
1444
1443
|
confirm: function (...args) {
|
|
1445
|
-
|
|
1444
|
+
const settings = this.get.settings();
|
|
1446
1445
|
args = settings.templates.getArguments(args);
|
|
1447
|
-
|
|
1446
|
+
const approveFn = function () {
|
|
1448
1447
|
args.handler(true);
|
|
1449
1448
|
};
|
|
1450
|
-
|
|
1449
|
+
const denyFn = function () {
|
|
1451
1450
|
args.handler(false);
|
|
1452
1451
|
};
|
|
1453
1452
|
|
|
@@ -1468,16 +1467,16 @@
|
|
|
1468
1467
|
};
|
|
1469
1468
|
},
|
|
1470
1469
|
prompt: function (...args) {
|
|
1471
|
-
|
|
1472
|
-
|
|
1470
|
+
const $this = this;
|
|
1471
|
+
const settings = this.get.settings();
|
|
1473
1472
|
args = settings.templates.getArguments(args);
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1473
|
+
const input = $($.parseHTML(args.content)).filter('.ui.input');
|
|
1474
|
+
const approveFn = function () {
|
|
1475
|
+
const settings = $this.get.settings();
|
|
1476
|
+
const inputField = $this.get.element().find(settings.selector.prompt)[0];
|
|
1478
1477
|
args.handler($(inputField).val());
|
|
1479
1478
|
};
|
|
1480
|
-
|
|
1479
|
+
const denyFn = function () {
|
|
1481
1480
|
args.handler(null);
|
|
1482
1481
|
};
|
|
1483
1482
|
if (input.length === 0) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
|
2
|
+
* # Fomantic UI - 2.10.0-beta.64+bcb9c73
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
|
4
4
|
* https://fomantic-ui.com/
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
|
-
!function(V,X,_){"use strict";function Q(e){return"function"==typeof e&&"number"!=typeof e.nodeType}X=void 0!==X&&X.Math===Math?X:globalThis,V.fn.modal=function(...e){let t=V(this),z=V(X),q=V(_),I=V("body"),B=Date.now(),W=[],j=e[0],P="string"==typeof j,K=e.slice(1),R=function(e,t){let n;return[X,_].includes(e)?n=I:0===(n=V(t.document).find(e)).length&&(n=t.frameElement?R(e,t.parent):I),n},U;return t.each(function(){let r=V.isPlainObject(j)?V.extend(!0,{},V.fn.modal.settings,j):V.extend({},V.fn.modal.settings),a=r.selector,c=r.className;var e=r.namespace;let l=r.fields,d=r.error,i="."+e,t="module-"+e,u=V(this),o=R(r.context,X),s=o[0]===I[0],n=u.find(a.closeIcon),f,m,h,g,p,v,b=u.hasClass("modal"),y=this,k=b?u.data(t):void 0,w=!1,x,C,S="",M=0,A=0,D=!1,T=!1,H=!1,F,N,E,L=!1,O;O={initialize:function(){if(O.create.id(),b||(O.create.modal(),Q(r.onHidden)||(r.onHidden=function(){O.destroy(),u.remove()})),u.addClass(r.class),""!==r.title&&u.find(a.title).html(O.helpers.escape(r.title,r)).addClass(r.classTitle),""!==r.content&&u.find(a.content).html(O.helpers.escape(r.content,r)).addClass(r.classContent),O.has.configActions()){let s=u.find(a.actions).addClass(r.classActions);0===s.length?s=V("<div/>",{class:c.actions+" "+(r.classActions||"")}).appendTo(u):s.empty(),r.actions.forEach(function(e){var t=e[l.icon]?"<i "+(e[l.text]?'aria-hidden="true"':"")+' class="'+O.helpers.escape(e[l.icon])+' icon"></i>':"",n=O.helpers.escape(e[l.text]||"",r),i=O.helpers.escape(e[l.class]||"");let o=e[l.click]&&Q(e[l.click])?e[l.click]:function(){};s.append(V("<button/>",{html:t+n,"aria-label":(e[l.text]||e[l.icon]||"").replace(/<[^>]+(>|$)/g,""),class:c.button+" "+i,on:{click:function(){let e=V(this);e.is(a.approve)||e.is(a.deny)||!1===o.call(y,u)||O.hide()}}}))})}O.cache={},O.verbose("Initializing dimmer",o),O.create.dimmer(),r.allowMultiple&&O.create.innerDimmer(),r.centered||u.addClass("top aligned"),O.refreshModals(),O.bind.events(),O.observeChanges(),O.instantiate(),r.autoShow&&O.show()},instantiate:function(){O.verbose("Storing instance of modal"),k=O,u.data(t,k)},create:{modal:function(){var e;u=V("<div/>",{class:c.modal,role:"dialog","aria-modal":!0}),r.closeIcon&&(n=V("<i/>",{class:c.close,role:"button",tabindex:0,"aria-label":r.text.close}),u.append(n)),""!==r.title&&(e="_"+O.get.id()+"title",u.attr("aria-labelledby",e),V("<div/>",{class:c.title,id:e}).appendTo(u)),""!==r.content&&(e="_"+O.get.id()+"desc",u.attr("aria-describedby",e),V("<div/>",{class:c.content,id:e}).appendTo(u)),O.has.configActions()&&V("<div/>",{class:c.actions}).appendTo(u),o.append(u),y=u[0]},dimmer:function(){var e={debug:r.debug,dimmerName:"modals"},e=V.extend(!0,e,r.dimmerSettings);void 0===V.fn.dimmer?O.error(d.dimmer):(O.debug("Creating dimmer"),p=o.dimmer(e),D=O.is.scrolling(),r.detachable?(O.verbose("Modal is detachable, moving content into dimmer"),p.dimmer("add content",u)):O.set.undetached(),v=p.dimmer("get dimmer"))},id:function(){N=(Math.random().toString(16)+"000000000").slice(2,10),F="."+N,O.verbose("Creating unique id for element",N)},innerDimmer:function(){0===u.find(a.dimmer).length&&V("<div/>",{class:c.innerDimmer}).prependTo(u)}},destroy:function(){E&&E.disconnect(),O.verbose("Destroying previous modal"),u.removeData(t).off(i),z.off(F),o.off(F),v.off(F),n.off(F),f&&f.off(F),o.dimmer("destroy")},observeChanges:function(){(E=new MutationObserver(function(e){function i(e){let t=[];for(const n of e)t.push(...i(n.childNodes),n);return t}let o=!1,s=!1,a=!0;e.every(function(n){if("attributes"===n.type)L&&("disabled"===n.attributeName||0<V(n.target).find(":input").addBack(":input").filter(":visible").length)&&(s=!0);else{o=!0;let e=V(i(n.addedNodes)).filter("a[href], [tabindex], :input:enabled").filter(":visible"),t=V(i(n.removedNodes)).filter("a[href], [tabindex], :input");(0<e.length||0<t.length)&&(s=!0,(0<e.filter(":input").length||0<t.filter(":input").length)&&(a=!1))}return!s}),o&&r.observeChanges&&(O.debug("DOM tree modified, refreshing"),O.refresh()),s&&O.refreshInputs(a)})).observe(y,{attributeFilter:["class","disabled"],attributes:!0,childList:!0,subtree:!0}),O.debug("Setting up mutation observer",E)},refresh:function(){O.remove.scrolling(),O.cacheSizes(),O.can.useFlex()||O.set.modalOffset(),O.set.screenHeight(),O.set.type()},refreshModals:function(){h=u.siblings(a.modal),m=h.add(u)},refreshInputs:function(e){f&&f.off("keydown"+F),0===(f=u.find("a[href], [tabindex], :input:enabled").filter(":visible").filter(function(){return 0===V(this).closest(".disabled").length})).filter(":input").length?(f=u.add(f),u.attr("tabindex",-1)):u.removeAttr("tabindex"),f.first().on("keydown"+F,O.event.inputKeyDown.first),f.last().on("keydown"+F,O.event.inputKeyDown.last),!e&&r.autofocus&&0===f.filter(":focus").length&&O.set.autofocus()},attachEvents:function(e,t){let n=V(e);t=Q(O[t])?O[t]:O.toggle,0<n.length?(O.debug("Attaching modal events to element",e,t),n.off(i).on("click"+i,t)):O.error(d.notFound,e)},bind:{events:function(){O.verbose("Attaching events"),u.on("click"+i,a.close,O.event.close).on("click"+i,a.approve,O.event.approve).on("click"+i,a.deny,O.event.deny),n.on("keyup"+F,O.event.closeKeyUp),z.on("resize"+F,O.event.resize).on("focus"+F,O.event.focus),o.on("click"+F,O.event.click)},scrollLock:function(){p[0].addEventListener("touchmove",O.event.preventScroll,{passive:!1})}},unbind:{scrollLock:function(){p[0].removeEventListener("touchmove",O.event.preventScroll,{passive:!1})}},get:{id:function(){return N},element:function(){return u},settings:function(){return r}},event:{approve:function(){w||!1===r.onApprove.call(y,V(this))?O.verbose("Approve callback returned false cancelling hide"):(w=!0,O.hide(function(){w=!1}))},preventScroll:function(e){e.target.className.includes("dimmer")&&e.preventDefault()},deny:function(){w||!1===r.onDeny.call(y,V(this))?O.verbose("Deny callback returned false cancelling hide"):(w=!0,O.hide(function(){w=!1}))},close:function(){O.hide()},closeKeyUp:function(e){e=e.which;e!==r.keys.enter&&e!==r.keys.space||!u.hasClass(c.front)||O.hide()},inputKeyDown:{first:function(e){e.which===r.keys.tab&&e.shiftKey&&(f.last().trigger("focus"),e.preventDefault())},last:function(e){e.which!==r.keys.tab||e.shiftKey||(f.first().trigger("focus"),e.preventDefault())}},mousedown:function(e){let t=V(e.target);var n=O.is.rtl();(x=0<t.closest(a.modal).length)&&O.verbose("Mouse down event registered inside the modal"),(C=O.is.scrolling()&&(!n&&z.outerWidth()-r.scrollbarWidth<=e.clientX||n&&r.scrollbarWidth>=e.clientX))&&O.verbose("Mouse down event registered inside the scrollbar")},mouseup:function(t){if(r.closable)if(x)O.debug("Dimmer clicked but mouse down was initially registered inside the modal");else if(C)O.debug("Dimmer clicked but mouse down was initially registered inside the scrollbar");else{let e=V(t.target);var n=0<e.closest(a.modal).length,t=_.documentElement.contains(t.target);if(!n&&t&&O.is.active()&&u.hasClass(c.front)){if(O.debug("Dimmer clicked, hiding all modals"),r.allowMultiple){if(!O.hideAll())return}else if(!O.hide())return;O.remove.clickaway()}}else O.verbose("Dimmer clicked but closable setting is disabled")},debounce:function(e,t){clearTimeout(O.timer),O.timer=setTimeout(function(){e()},t)},keyboard:function(e){e.which===r.keys.escape&&(r.closable?(O.debug("Escape key pressed hiding modal"),u.hasClass(c.front)&&O.hide()):O.debug("Escape key pressed, but closable is set to false"),e.preventDefault())},resize:function(){p.dimmer("is active")&&(O.is.animating()||O.is.active())&&requestAnimationFrame(O.refresh)},focus:function(){H=!0},click:function(e){H&&_.activeElement!==e.target&&p.dimmer("is active")&&O.is.active()&&r.autofocus&&0===V(_.activeElement).closest(a.modal).length&&requestAnimationFrame(O.set.autofocus),H=!1}},toggle:function(){O.is.active()||O.is.animating()?O.hide():O.show()},show:function(e){e=Q(e)?e:function(){},O.refreshModals(),O.set.dimmerSettings(),O.set.dimmerStyles(),O.showModal(e)},hide:function(e){return e=Q(e)?e:function(){},O.refreshModals(),O.hideModal(e)},showModal:function(e){e=Q(e)?e:function(){},O.is.animating()||!O.is.active()?!1===r.onShow.call(y)?O.verbose("Show callback returned false cancelling show"):(T=O.has.scrollbar(),O.showDimmer(),O.cacheSizes(),T&&O.set.bodyMargin(),O.can.useFlex()?O.remove.legacy():(O.set.legacy(),O.set.modalOffset(),O.debug("Using non-flex legacy modal positioning.")),O.set.screenHeight(),O.set.type(),O.set.clickaway(),!r.allowMultiple&&O.others.active()?O.hideOthers(O.showModal):(w=!1,r.allowMultiple&&(O.others.active()&&h.filter("."+c.active).find(a.dimmer).removeClass("out").addClass("transition fade in active"),r.detachable&&u.detach().appendTo(v)),r.transition&&void 0!==V.fn.transition?(O.debug("Showing modal with css animations"),O.set.observeAttributes(!1),u.transition({debug:r.debug,verbose:r.verbose,silent:r.silent,animation:(r.transition.showMethod||r.transition)+" in",queue:r.queue,duration:r.transition.showDuration||r.duration,useFailSafe:!0,onComplete:function(){r.onVisible.call(y),r.keyboardShortcuts&&O.add.keyboardShortcuts(),O.save.focus(),O.set.active(),O.refreshInputs(),requestAnimationFrame(O.set.observeAttributes),e()}})):O.error(d.noTransition))):O.debug("Modal is already visible")},hideModal:function(e,t,n){let i=h.filter("."+c.active).last();if(e=Q(e)?e:function(){},!1===r.onHide.call(y,V(this)))return O.verbose("Hide callback returned false cancelling hide"),w=!1;(O.is.animating()||O.is.active())&&(O.debug("Hiding modal"),r.transition&&void 0!==V.fn.transition?(O.remove.active(),O.set.observeAttributes(!1),u.transition({debug:r.debug,verbose:r.verbose,silent:r.silent,animation:(r.transition.hideMethod||r.transition)+" out",queue:r.queue,duration:r.transition.hideDuration||r.duration,useFailSafe:!0,onStart:function(){O.others.active()||O.others.animating()||t?r.allowMultiple&&(n?m:i).find(a.dimmer).removeClass("in").addClass("out"):O.hideDimmer(),r.keyboardShortcuts&&!O.others.active()&&O.remove.keyboardShortcuts()},onComplete:function(){O.unbind.scrollLock(),O.remove.active(),r.allowMultiple&&(i.addClass(c.front),u.removeClass(c.front),(n?m:i).find(a.dimmer).removeClass("active")),Q(r.onHidden)&&r.onHidden.call(y),O.remove.dimmerStyles(),O.restore.focus(),e()}})):O.error(d.noTransition))},showDimmer:function(){p.dimmer("is animating")||!p.dimmer("is active")?(T&&(s||v.css("top",p.scrollTop()),O.save.bodyMargin()),O.debug("Showing dimmer"),p.dimmer("show")):O.debug("Dimmer already visible")},hideDimmer:function(){p.dimmer("is animating")||p.dimmer("is active")?(O.unbind.scrollLock(),p.dimmer("hide",function(){T&&O.restore.bodyMargin(),O.remove.clickaway(),O.remove.screenHeight()})):O.debug("Dimmer is not visible cannot hide")},hideAll:function(i){let e=m.filter("."+c.active+", ."+c.animating);if(i=Q(i)?i:function(){},0<e.length){O.debug("Hiding all visible modals");let n=!0;return V(e.get().reverse()).each(function(e,t){n=n&&V(t).modal("hide modal",i,!1,!0)}),n&&O.hideDimmer(),n}},hideOthers:function(e){let t=h.filter("."+c.active+", ."+c.animating);e=Q(e)?e:function(){},0<t.length&&(O.debug("Hiding other modals",h),t.modal("hide modal",e,!0))},others:{active:function(){return 0<h.filter("."+c.active).length},animating:function(){return 0<h.filter("."+c.animating).length}},add:{keyboardShortcuts:function(){O.verbose("Adding keyboard shortcuts"),q.on("keydown"+i,O.event.keyboard)}},save:{focus:function(){let e=V(_.activeElement);0<e.closest(u).length||(g=V(_.activeElement).trigger("blur"))},bodyMargin:function(){S=o.css((s?"margin-":"padding-")+(O.can.leftBodyScrollbar()?"left":"right")),M=parseInt(S.replace(/[^\d.]/g,""),10);var e=s?X.innerWidth-_.documentElement.clientWidth:o[0].offsetWidth-o[0].clientWidth;A=M+e}},restore:{focus:function(){g&&0<g.length&&r.restoreFocus&&g.trigger("focus")},bodyMargin:function(){let n=O.can.leftBodyScrollbar()?"left":"right";o.css((s?"margin-":"padding-")+n,0===M?"":S),o.find(a.bodyFixed.replace("right",n)).each(function(){let e=V(this);var t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"")})}},remove:{active:function(){u.removeClass(c.active)},legacy:function(){u.removeClass(c.legacy)},clickaway:function(){r.detachable||u.off("mousedown"+F),v.off("mousedown"+F),v.off("mouseup"+F)},dimmerStyles:function(){v.removeClass(c.inverted),p.removeClass(c.blurring)},bodyStyle:function(){""===o.attr("style")&&(O.verbose("Removing style attribute"),o.removeAttr("style"))},screenHeight:function(){O.debug("Removing page height"),o.css("height",""),O.remove.bodyStyle()},keyboardShortcuts:function(){O.verbose("Removing keyboard shortcuts"),q.off("keydown"+i)},scrolling:function(){D||p.removeClass(c.scrolling),u.removeClass(c.scrolling)}},cacheSizes:function(){u.addClass(c.loading);var e=u.prop("scrollHeight"),t=u.outerWidth(),n=u.outerHeight();void 0!==O.cache.pageHeight&&0===n||(V.extend(O.cache,{pageHeight:q.outerHeight(),width:t,height:n+r.offset,scrollHeight:e+r.offset,contextHeight:(s?z:p).height()}),O.cache.topOffset=-O.cache.height/2),u.removeClass(c.loading),O.debug("Caching modal and container sizes",O.cache)},helpers:{escape:function(e,t){if(void 0!==t&&t.preserveHTML)return e;const n={'"':""","&":"&","'":"'","<":"<",">":">"};return String(e).replace(/["&'<>]/g,e=>n[e])}},can:{leftBodyScrollbar:function(){return void 0===O.cache.leftBodyScrollbar&&(O.cache.leftBodyScrollbar=O.is.rtl()&&(O.is.iframe&&!O.is.firefox()||O.is.safari())),O.cache.leftBodyScrollbar},useFlex:function(){return"auto"===r.useFlex?r.detachable:(r.useFlex&&!r.detachable&&O.debug("useFlex true in combination with detachable false is not supported"),r.useFlex)},fit:function(){var e=O.cache.contextHeight,t=O.cache.contextHeight/2,n=O.cache.topOffset,i=O.cache.scrollHeight,o=O.cache.height,s=r.padding;return o<i?t+n+i+s<e:o+2*s<e}},has:{configActions:function(){return Array.isArray(r.actions)&&0<r.actions.length},scrollbar:function(){return s||"hidden"!==o.css("overflow-y")}},is:{active:function(){return u.hasClass(c.active)},animating:function(){return u.transition("is animating")},scrolling:function(){return p.hasClass(c.scrolling)},rtl:function(){return void 0===O.cache.isRTL&&(O.cache.isRTL="rtl"===u.attr("dir")||"rtl"===u.css("direction")||"rtl"===I.attr("dir")||"rtl"===I.css("direction")||"rtl"===o.attr("dir")||"rtl"===o.css("direction")),O.cache.isRTL},safari:function(){return void 0===O.cache.isSafari&&(O.cache.isSafari=/constructor/i.test(X.HTMLElement)||!!X.ApplePaySession),O.cache.isSafari},firefox:function(){return void 0===O.cache.isFirefox&&(O.cache.isFirefox=!!X.InstallTrigger),O.cache.isFirefox},iframe:function(){return!(self===top)}},set:{observeAttributes:function(e){L=!1!==e},autofocus:function(){let e=f.filter("[autofocus]"),t=f.filter(":input"),n=(0<e.length?e:0<t.length?t:u).first();n.trigger("focus")},bodyMargin:function(){let n=O.can.leftBodyScrollbar()?"left":"right";(r.detachable||O.can.fit())&&o.css((s?"margin-":"padding-")+n,A+"px"),o.find(a.bodyFixed.replace("right",n)).each(function(){let e=V(this);var t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"calc("+e.css(t)+" + "+A+"px)")})},clickaway:function(){r.detachable||u.on("mousedown"+F,O.event.mousedown),v.on("mousedown"+F,O.event.mousedown),v.on("mouseup"+F,O.event.mouseup)},dimmerSettings:function(){if(void 0===V.fn.dimmer)O.error(d.dimmer);else{var t={debug:r.debug,dimmerName:"modals",closable:"auto",useFlex:O.can.useFlex(),duration:{show:r.transition.showDuration||r.duration,hide:r.transition.hideDuration||r.duration}};let e=V.extend(!0,t,r.dimmerSettings);r.inverted&&(e.variation=void 0!==e.variation?e.variation+" inverted":"inverted"),o.dimmer("setting",e)}},dimmerStyles:function(){r.inverted?v.addClass(c.inverted):v.removeClass(c.inverted),r.blurring?p.addClass(c.blurring):p.removeClass(c.blurring)},modalOffset:function(){var e;r.detachable?u.css({marginTop:!u.hasClass("aligned")&&O.can.fit()?-O.cache.height/2:r.padding/2,marginLeft:-O.cache.width/2}):(e=O.can.fit(),u.css({top:!u.hasClass("aligned")&&e?q.scrollTop()+(O.cache.contextHeight-O.cache.height)/2:!e||u.hasClass("top")?q.scrollTop()+r.padding:q.scrollTop()+(O.cache.contextHeight-O.cache.height-r.padding),marginLeft:-O.cache.width/2})),O.verbose("Setting modal offset for legacy mode")},screenHeight:function(){O.can.fit()?o.css("height",""):u.hasClass("bottom")||(O.debug("Modal is taller than page content, resizing page height"),o.css("height",O.cache.height+2*r.padding+"px"))},active:function(){u.addClass(c.active+" "+c.front),h.filter("."+c.active).removeClass(c.front)},scrolling:function(){p.addClass(c.scrolling),u.addClass(c.scrolling),O.unbind.scrollLock()},legacy:function(){u.addClass(c.legacy)},type:function(){O.can.fit()?(O.verbose("Modal fits on screen"),O.others.active()||O.others.animating()||(O.remove.scrolling(),O.bind.scrollLock())):u.hasClass("bottom")?O.verbose("Bottom aligned modal not fitting on screen is unsupported for scrolling"):(O.verbose("Modal cannot fit on screen setting to scrolling"),O.set.scrolling())},undetached:function(){p.addClass(c.undetached)}},setting:function(e,t){if(O.debug("Changing setting",e,t),V.isPlainObject(e))V.extend(!0,r,e);else{if(void 0===t)return r[e];V.isPlainObject(r[e])?V.extend(!0,r[e],t):r[e]=t}},internal:function(e,t){if(V.isPlainObject(e))V.extend(!0,O,e);else{if(void 0===t)return O[e];O[e]=t}},debug:function(...e){!r.silent&&r.debug&&(r.performance?O.performance.log(e):(O.debug=Function.prototype.bind.call(console.info,console,r.name+":"),O.debug.apply(console,e)))},verbose:function(...e){!r.silent&&r.verbose&&r.debug&&(r.performance?O.performance.log(e):(O.verbose=Function.prototype.bind.call(console.info,console,r.name+":"),O.verbose.apply(console,e)))},error:function(...e){r.silent||(O.error=Function.prototype.bind.call(console.error,console,r.name+":"),O.error.apply(console,e))},performance:{log:function(e){var t,n;r.performance&&(n=(t=Date.now())-(B||t),B=t,W.push({Name:e[0],Arguments:e.slice(1),Element:y,"Execution Time":n})),clearTimeout(O.performance.timer),O.performance.timer=setTimeout(function(){O.performance.display()},500)},display:function(){var e=r.name+":";let n=0;B=!1,clearTimeout(O.performance.timer),V.each(W,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",0<W.length&&(console.groupCollapsed(e),console.table(W),console.groupEnd()),W=[]}},invoke:function(i,e=K,t=y){let o=k,s,a,n;return"string"==typeof i&&void 0!==o&&(i=i.split(/[ .]/),s=i.length-1,V.each(i,function(e,t){var n=e!==s?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(V.isPlainObject(o[n])&&e!==s)o=o[n];else{if(void 0!==o[n])return a=o[n],!1;{if(!V.isPlainObject(o[t])||e===s)return void 0!==o[t]?a=o[t]:O.error(d.method,i),!1;o=o[t]}}})),Q(a)?n=a.apply(t,e):void 0!==a&&(n=a),Array.isArray(U)?U.push(n):void 0!==U?U=[U,n]:void 0!==n&&(U=n),a}},P?(void 0===k&&(Q(r.templates[j])&&(r.autoShow=!0,r.className.modal=r.className.template,r=V.extend(!0,{},r,r.templates[j].apply(O,K)),c=r.className,r.namespace,l=r.fields,d=r.error),O.initialize()),Q(r.templates[j])||O.invoke(j)):(void 0!==k&&k.invoke("destroy"),O.initialize(),U=u)}),void 0!==U?U:this},V.modal=V.fn.modal,V.fn.modal.settings={name:"Modal",namespace:"modal",useFlex:"auto",offset:0,silent:!1,debug:!1,verbose:!1,performance:!0,observeChanges:!1,allowMultiple:!1,detachable:!0,closable:!0,autofocus:!0,restoreFocus:!0,autoShow:!1,inverted:!1,blurring:!1,centered:!0,dimmerSettings:{closable:!1,useCSS:!0},keyboardShortcuts:!0,context:"body",queue:!1,duration:500,transition:"scale",padding:50,scrollbarWidth:10,title:"",content:"",class:"",classTitle:"",classContent:"",classActions:"",closeIcon:!1,actions:!1,preserveHTML:!1,fields:{class:"class",text:"text",icon:"icon",click:"click"},onShow:function(){},onVisible:function(){},onHide:function(){return!0},onHidden:!1,onApprove:function(){return!0},onDeny:function(){return!0},keys:{space:32,enter:13,escape:27,tab:9},selector:{title:"> .header",content:"> .content",actions:"> .actions",close:"> .close",closeIcon:"> .close",approve:".actions .positive, .actions .approve, .actions .ok",deny:".actions .negative, .actions .deny, .actions .cancel",modal:".ui.modal",dimmer:"> .ui.dimmer",bodyFixed:"> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close",prompt:".ui.input > input"},error:{dimmer:"UI Dimmer, a required component is not included in this page",method:"The method you called is not defined.",notFound:"The element you specified could not be found"},className:{active:"active",animating:"animating",blurring:"blurring",inverted:"inverted",legacy:"legacy",loading:"loading",scrolling:"scrolling",undetached:"undetached",front:"front",close:"close icon",button:"ui button",modal:"ui modal",title:"header",content:"content",actions:"actions",template:"ui tiny modal",ok:"positive",cancel:"negative",prompt:"ui fluid input",innerDimmer:"ui inverted dimmer"},text:{ok:"Ok",cancel:"Cancel",close:"Close"}},V.fn.modal.settings.templates={getArguments:function(e){return V.isPlainObject(e[0])?V.extend({handler:function(){},content:"",title:""},e[0]):(Q(e[e.length-1])||e.push(function(){}),{handler:e.pop(),content:e.pop()||"",title:e.pop()||""})},alert:function(...e){let t=this.get.settings();var n=(e=t.templates.getArguments(e)).handler;return{title:e.title,content:e.content,onApprove:n,actions:[{text:t.text.ok,class:t.className.ok,click:n}]}},confirm:function(...e){let t=this.get.settings();function n(){e.handler(!0)}function i(){e.handler(!1)}return{title:(e=t.templates.getArguments(e)).title,content:e.content,onApprove:n,onDeny:i,actions:[{text:t.text.ok,class:t.className.ok,click:n},{text:t.text.cancel,class:t.className.cancel,click:i}]}},prompt:function(...t){let n=this,e=this.get.settings();t=e.templates.getArguments(t);function i(){var e=n.get.settings(),e=n.get.element().find(e.selector.prompt)[0];t.handler(V(e).val())}function o(){t.handler(null)}return 0===V(V.parseHTML(t.content)).filter(".ui.input").length&&(t.content+='<p><div class="'+this.helpers.escape(e.className.prompt)+'"><input placeholder="'+this.helpers.escape(t.placeholder||"")+'" type="text" value="'+this.helpers.escape(t.defaultValue||"")+'"></div></p>'),{title:t.title,content:t.content,onApprove:i,onDeny:o,actions:[{text:e.text.ok,class:e.className.ok,click:i},{text:e.text.cancel,class:e.className.cancel,click:o}]}}}}(jQuery,window,document);
|
|
11
|
+
!function(V,X,_){"use strict";function Q(e){return"function"==typeof e&&"number"!=typeof e.nodeType}X=void 0!==X&&X.Math===Math?X:globalThis,V.fn.modal=function(...e){const t=V(this),z=V(X),q=V(_),I=V("body");let B=Date.now(),W=[];const j=e[0],P="string"==typeof j,K=e.slice(1),R=function(e,t){let n;return[X,_].includes(e)?n=I:0===(n=V(t.document).find(e)).length&&(n=t.frameElement?R(e,t.parent):I),n};let U;return t.each(function(){let r=V.isPlainObject(j)?V.extend(!0,{},V.fn.modal.settings,j):V.extend({},V.fn.modal.settings);const a=r.selector;let c=r.className;var e=r.namespace;let l=r.fields,d=r.error;const i="."+e,t="module-"+e;let u=V(this);const o=R(r.context,X),s=o[0]===I[0];let n=u.find(a.closeIcon),f,m,h,g,p,v;const b=u.hasClass("modal");let y=this,k=b?u.data(t):void 0,w=!1,x,C,S="",M=0,A=0,D=!1,T=!1,H=!1,F,N,E,L=!1;const O={initialize:function(){if(O.create.id(),b||(O.create.modal(),Q(r.onHidden)||(r.onHidden=function(){O.destroy(),u.remove()})),u.addClass(r.class),""!==r.title&&u.find(a.title).html(O.helpers.escape(r.title,r)).addClass(r.classTitle),""!==r.content&&u.find(a.content).html(O.helpers.escape(r.content,r)).addClass(r.classContent),O.has.configActions()){let s=u.find(a.actions).addClass(r.classActions);0===s.length?s=V("<div/>",{class:c.actions+" "+(r.classActions||"")}).appendTo(u):s.empty(),r.actions.forEach(function(e){var t=e[l.icon]?"<i "+(e[l.text]?'aria-hidden="true"':"")+' class="'+O.helpers.escape(e[l.icon])+' icon"></i>':"",n=O.helpers.escape(e[l.text]||"",r),i=O.helpers.escape(e[l.class]||"");const o=e[l.click]&&Q(e[l.click])?e[l.click]:function(){};s.append(V("<button/>",{html:t+n,"aria-label":(e[l.text]||e[l.icon]||"").replace(/<[^>]+(>|$)/g,""),class:c.button+" "+i,on:{click:function(){const e=V(this);e.is(a.approve)||e.is(a.deny)||!1===o.call(y,u)||O.hide()}}}))})}O.cache={},O.verbose("Initializing dimmer",o),O.create.dimmer(),r.allowMultiple&&O.create.innerDimmer(),r.centered||u.addClass("top aligned"),O.refreshModals(),O.bind.events(),O.observeChanges(),O.instantiate(),r.autoShow&&O.show()},instantiate:function(){O.verbose("Storing instance of modal"),k=O,u.data(t,k)},create:{modal:function(){var e;u=V("<div/>",{class:c.modal,role:"dialog","aria-modal":!0}),r.closeIcon&&(n=V("<i/>",{class:c.close,role:"button",tabindex:0,"aria-label":r.text.close}),u.append(n)),""!==r.title&&(e="_"+O.get.id()+"title",u.attr("aria-labelledby",e),V("<div/>",{class:c.title,id:e}).appendTo(u)),""!==r.content&&(e="_"+O.get.id()+"desc",u.attr("aria-describedby",e),V("<div/>",{class:c.content,id:e}).appendTo(u)),O.has.configActions()&&V("<div/>",{class:c.actions}).appendTo(u),o.append(u),y=u[0]},dimmer:function(){var e={debug:r.debug,dimmerName:"modals"},e=V.extend(!0,e,r.dimmerSettings);void 0===V.fn.dimmer?O.error(d.dimmer):(O.debug("Creating dimmer"),p=o.dimmer(e),D=O.is.scrolling(),r.detachable?(O.verbose("Modal is detachable, moving content into dimmer"),p.dimmer("add content",u)):O.set.undetached(),v=p.dimmer("get dimmer"))},id:function(){N=(Math.random().toString(16)+"000000000").slice(2,10),F="."+N,O.verbose("Creating unique id for element",N)},innerDimmer:function(){0===u.find(a.dimmer).length&&V("<div/>",{class:c.innerDimmer}).prependTo(u)}},destroy:function(){E&&E.disconnect(),O.verbose("Destroying previous modal"),u.removeData(t).off(i),z.off(F),o.off(F),v.off(F),n.off(F),f&&f.off(F),o.dimmer("destroy")},observeChanges:function(){(E=new MutationObserver(function(e){function i(e){const t=[];for(const n of e)t.push(...i(n.childNodes),n);return t}let o=!1,s=!1,a=!0;e.every(function(e){if("attributes"===e.type)L&&("disabled"===e.attributeName||0<V(e.target).find(":input").addBack(":input").filter(":visible").length)&&(s=!0);else{o=!0;const t=V(i(e.addedNodes)).filter("a[href], [tabindex], :input:enabled").filter(":visible"),n=V(i(e.removedNodes)).filter("a[href], [tabindex], :input");(0<t.length||0<n.length)&&(s=!0,(0<t.filter(":input").length||0<n.filter(":input").length)&&(a=!1))}return!s}),o&&r.observeChanges&&(O.debug("DOM tree modified, refreshing"),O.refresh()),s&&O.refreshInputs(a)})).observe(y,{attributeFilter:["class","disabled"],attributes:!0,childList:!0,subtree:!0}),O.debug("Setting up mutation observer",E)},refresh:function(){O.remove.scrolling(),O.cacheSizes(),O.can.useFlex()||O.set.modalOffset(),O.set.screenHeight(),O.set.type()},refreshModals:function(){h=u.siblings(a.modal),m=h.add(u)},refreshInputs:function(e){f&&f.off("keydown"+F),0===(f=u.find("a[href], [tabindex], :input:enabled").filter(":visible").filter(function(){return 0===V(this).closest(".disabled").length})).filter(":input").length?(f=u.add(f),u.attr("tabindex",-1)):u.removeAttr("tabindex"),f.first().on("keydown"+F,O.event.inputKeyDown.first),f.last().on("keydown"+F,O.event.inputKeyDown.last),!e&&r.autofocus&&0===f.filter(":focus").length&&O.set.autofocus()},attachEvents:function(e,t){const n=V(e);t=Q(O[t])?O[t]:O.toggle,0<n.length?(O.debug("Attaching modal events to element",e,t),n.off(i).on("click"+i,t)):O.error(d.notFound,e)},bind:{events:function(){O.verbose("Attaching events"),u.on("click"+i,a.close,O.event.close).on("click"+i,a.approve,O.event.approve).on("click"+i,a.deny,O.event.deny),n.on("keyup"+F,O.event.closeKeyUp),z.on("resize"+F,O.event.resize).on("focus"+F,O.event.focus),o.on("click"+F,O.event.click)},scrollLock:function(){p[0].addEventListener("touchmove",O.event.preventScroll,{passive:!1})}},unbind:{scrollLock:function(){p[0].removeEventListener("touchmove",O.event.preventScroll,{passive:!1})}},get:{id:function(){return N},element:function(){return u},settings:function(){return r}},event:{approve:function(){w||!1===r.onApprove.call(y,V(this))?O.verbose("Approve callback returned false cancelling hide"):(w=!0,O.hide(function(){w=!1}))},preventScroll:function(e){e.target.className.includes("dimmer")&&e.preventDefault()},deny:function(){w||!1===r.onDeny.call(y,V(this))?O.verbose("Deny callback returned false cancelling hide"):(w=!0,O.hide(function(){w=!1}))},close:function(){O.hide()},closeKeyUp:function(e){e=e.which;e!==r.keys.enter&&e!==r.keys.space||!u.hasClass(c.front)||O.hide()},inputKeyDown:{first:function(e){e.which===r.keys.tab&&e.shiftKey&&(f.last().trigger("focus"),e.preventDefault())},last:function(e){e.which!==r.keys.tab||e.shiftKey||(f.first().trigger("focus"),e.preventDefault())}},mousedown:function(e){const t=V(e.target);var n=O.is.rtl();(x=0<t.closest(a.modal).length)&&O.verbose("Mouse down event registered inside the modal"),(C=O.is.scrolling()&&(!n&&z.outerWidth()-r.scrollbarWidth<=e.clientX||n&&r.scrollbarWidth>=e.clientX))&&O.verbose("Mouse down event registered inside the scrollbar")},mouseup:function(e){if(r.closable)if(x)O.debug("Dimmer clicked but mouse down was initially registered inside the modal");else if(C)O.debug("Dimmer clicked but mouse down was initially registered inside the scrollbar");else{const n=V(e.target);var t=0<n.closest(a.modal).length,e=_.documentElement.contains(e.target);if(!t&&e&&O.is.active()&&u.hasClass(c.front)){if(O.debug("Dimmer clicked, hiding all modals"),r.allowMultiple){if(!O.hideAll())return}else if(!O.hide())return;O.remove.clickaway()}}else O.verbose("Dimmer clicked but closable setting is disabled")},debounce:function(e,t){clearTimeout(O.timer),O.timer=setTimeout(function(){e()},t)},keyboard:function(e){e.which===r.keys.escape&&(r.closable?(O.debug("Escape key pressed hiding modal"),u.hasClass(c.front)&&O.hide()):O.debug("Escape key pressed, but closable is set to false"),e.preventDefault())},resize:function(){p.dimmer("is active")&&(O.is.animating()||O.is.active())&&requestAnimationFrame(O.refresh)},focus:function(){H=!0},click:function(e){H&&_.activeElement!==e.target&&p.dimmer("is active")&&O.is.active()&&r.autofocus&&0===V(_.activeElement).closest(a.modal).length&&requestAnimationFrame(O.set.autofocus),H=!1}},toggle:function(){O.is.active()||O.is.animating()?O.hide():O.show()},show:function(e){e=Q(e)?e:function(){},O.refreshModals(),O.set.dimmerSettings(),O.set.dimmerStyles(),O.showModal(e)},hide:function(e){return e=Q(e)?e:function(){},O.refreshModals(),O.hideModal(e)},showModal:function(e){e=Q(e)?e:function(){},O.is.animating()||!O.is.active()?!1===r.onShow.call(y)?O.verbose("Show callback returned false cancelling show"):(T=O.has.scrollbar(),O.showDimmer(),O.cacheSizes(),T&&O.set.bodyMargin(),O.can.useFlex()?O.remove.legacy():(O.set.legacy(),O.set.modalOffset(),O.debug("Using non-flex legacy modal positioning.")),O.set.screenHeight(),O.set.type(),O.set.clickaway(),!r.allowMultiple&&O.others.active()?O.hideOthers(O.showModal):(w=!1,r.allowMultiple&&(O.others.active()&&h.filter("."+c.active).find(a.dimmer).removeClass("out").addClass("transition fade in active"),r.detachable&&u.detach().appendTo(v)),r.transition&&void 0!==V.fn.transition?(O.debug("Showing modal with css animations"),O.set.observeAttributes(!1),u.transition({debug:r.debug,verbose:r.verbose,silent:r.silent,animation:(r.transition.showMethod||r.transition)+" in",queue:r.queue,duration:r.transition.showDuration||r.duration,useFailSafe:!0,onComplete:function(){r.onVisible.call(y),r.keyboardShortcuts&&O.add.keyboardShortcuts(),O.save.focus(),O.set.active(),O.refreshInputs(),requestAnimationFrame(O.set.observeAttributes),e()}})):O.error(d.noTransition))):O.debug("Modal is already visible")},hideModal:function(e,t,n){const i=h.filter("."+c.active).last();if(e=Q(e)?e:function(){},!1===r.onHide.call(y,V(this)))return O.verbose("Hide callback returned false cancelling hide"),w=!1;(O.is.animating()||O.is.active())&&(O.debug("Hiding modal"),r.transition&&void 0!==V.fn.transition?(O.remove.active(),O.set.observeAttributes(!1),u.transition({debug:r.debug,verbose:r.verbose,silent:r.silent,animation:(r.transition.hideMethod||r.transition)+" out",queue:r.queue,duration:r.transition.hideDuration||r.duration,useFailSafe:!0,onStart:function(){O.others.active()||O.others.animating()||t?r.allowMultiple&&(n?m:i).find(a.dimmer).removeClass("in").addClass("out"):O.hideDimmer(),r.keyboardShortcuts&&!O.others.active()&&O.remove.keyboardShortcuts()},onComplete:function(){O.unbind.scrollLock(),O.remove.active(),r.allowMultiple&&(i.addClass(c.front),u.removeClass(c.front),(n?m:i).find(a.dimmer).removeClass("active")),Q(r.onHidden)&&r.onHidden.call(y),O.remove.dimmerStyles(),O.restore.focus(),e()}})):O.error(d.noTransition))},showDimmer:function(){p.dimmer("is animating")||!p.dimmer("is active")?(T&&(s||v.css("top",p.scrollTop()),O.save.bodyMargin()),O.debug("Showing dimmer"),p.dimmer("show")):O.debug("Dimmer already visible")},hideDimmer:function(){p.dimmer("is animating")||p.dimmer("is active")?(O.unbind.scrollLock(),p.dimmer("hide",function(){T&&O.restore.bodyMargin(),O.remove.clickaway(),O.remove.screenHeight()})):O.debug("Dimmer is not visible cannot hide")},hideAll:function(i){const e=m.filter("."+c.active+", ."+c.animating);if(i=Q(i)?i:function(){},0<e.length){O.debug("Hiding all visible modals");let n=!0;return V(e.get().reverse()).each(function(e,t){n=n&&V(t).modal("hide modal",i,!1,!0)}),n&&O.hideDimmer(),n}},hideOthers:function(e){const t=h.filter("."+c.active+", ."+c.animating);e=Q(e)?e:function(){},0<t.length&&(O.debug("Hiding other modals",h),t.modal("hide modal",e,!0))},others:{active:function(){return 0<h.filter("."+c.active).length},animating:function(){return 0<h.filter("."+c.animating).length}},add:{keyboardShortcuts:function(){O.verbose("Adding keyboard shortcuts"),q.on("keydown"+i,O.event.keyboard)}},save:{focus:function(){const e=V(_.activeElement);0<e.closest(u).length||(g=V(_.activeElement).trigger("blur"))},bodyMargin:function(){S=o.css((s?"margin-":"padding-")+(O.can.leftBodyScrollbar()?"left":"right")),M=parseInt(S.replace(/[^\d.]/g,""),10);var e=s?X.innerWidth-_.documentElement.clientWidth:o[0].offsetWidth-o[0].clientWidth;A=M+e}},restore:{focus:function(){g&&0<g.length&&r.restoreFocus&&g.trigger("focus")},bodyMargin:function(){const n=O.can.leftBodyScrollbar()?"left":"right";o.css((s?"margin-":"padding-")+n,0===M?"":S),o.find(a.bodyFixed.replace("right",n)).each(function(){const e=V(this);var t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"")})}},remove:{active:function(){u.removeClass(c.active)},legacy:function(){u.removeClass(c.legacy)},clickaway:function(){r.detachable||u.off("mousedown"+F),v.off("mousedown"+F),v.off("mouseup"+F)},dimmerStyles:function(){v.removeClass(c.inverted),p.removeClass(c.blurring)},bodyStyle:function(){""===o.attr("style")&&(O.verbose("Removing style attribute"),o.removeAttr("style"))},screenHeight:function(){O.debug("Removing page height"),o.css("height",""),O.remove.bodyStyle()},keyboardShortcuts:function(){O.verbose("Removing keyboard shortcuts"),q.off("keydown"+i)},scrolling:function(){D||p.removeClass(c.scrolling),u.removeClass(c.scrolling)}},cacheSizes:function(){u.addClass(c.loading);var e=u.prop("scrollHeight"),t=u.outerWidth(),n=u.outerHeight();void 0!==O.cache.pageHeight&&0===n||(V.extend(O.cache,{pageHeight:q.outerHeight(),width:t,height:n+r.offset,scrollHeight:e+r.offset,contextHeight:(s?z:p).height()}),O.cache.topOffset=-O.cache.height/2),u.removeClass(c.loading),O.debug("Caching modal and container sizes",O.cache)},helpers:{escape:function(e,t){if(void 0!==t&&t.preserveHTML)return e;const n={'"':""","&":"&","'":"'","<":"<",">":">"};return String(e).replace(/["&'<>]/g,e=>n[e])}},can:{leftBodyScrollbar:function(){return void 0===O.cache.leftBodyScrollbar&&(O.cache.leftBodyScrollbar=O.is.rtl()&&(O.is.iframe&&!O.is.firefox()||O.is.safari())),O.cache.leftBodyScrollbar},useFlex:function(){return"auto"===r.useFlex?r.detachable:(r.useFlex&&!r.detachable&&O.debug("useFlex true in combination with detachable false is not supported"),r.useFlex)},fit:function(){var e=O.cache.contextHeight,t=O.cache.contextHeight/2,n=O.cache.topOffset,i=O.cache.scrollHeight,o=O.cache.height,s=r.padding;return o<i?t+n+i+s<e:o+2*s<e}},has:{configActions:function(){return Array.isArray(r.actions)&&0<r.actions.length},scrollbar:function(){return s||"hidden"!==o.css("overflow-y")}},is:{active:function(){return u.hasClass(c.active)},animating:function(){return u.transition("is animating")},scrolling:function(){return p.hasClass(c.scrolling)},rtl:function(){return void 0===O.cache.isRTL&&(O.cache.isRTL="rtl"===u.attr("dir")||"rtl"===u.css("direction")||"rtl"===I.attr("dir")||"rtl"===I.css("direction")||"rtl"===o.attr("dir")||"rtl"===o.css("direction")),O.cache.isRTL},safari:function(){return void 0===O.cache.isSafari&&(O.cache.isSafari=/constructor/i.test(X.HTMLElement)||!!X.ApplePaySession),O.cache.isSafari},firefox:function(){return void 0===O.cache.isFirefox&&(O.cache.isFirefox=!!X.InstallTrigger),O.cache.isFirefox},iframe:function(){return!(self===top)}},set:{observeAttributes:function(e){L=!1!==e},autofocus:function(){const e=f.filter("[autofocus]"),t=f.filter(":input"),n=(0<e.length?e:0<t.length?t:u).first();n.trigger("focus")},bodyMargin:function(){const n=O.can.leftBodyScrollbar()?"left":"right";(r.detachable||O.can.fit())&&o.css((s?"margin-":"padding-")+n,A+"px"),o.find(a.bodyFixed.replace("right",n)).each(function(){const e=V(this);var t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"calc("+e.css(t)+" + "+A+"px)")})},clickaway:function(){r.detachable||u.on("mousedown"+F,O.event.mousedown),v.on("mousedown"+F,O.event.mousedown),v.on("mouseup"+F,O.event.mouseup)},dimmerSettings:function(){if(void 0===V.fn.dimmer)O.error(d.dimmer);else{var e={debug:r.debug,dimmerName:"modals",closable:"auto",useFlex:O.can.useFlex(),duration:{show:r.transition.showDuration||r.duration,hide:r.transition.hideDuration||r.duration}};const t=V.extend(!0,e,r.dimmerSettings);r.inverted&&(t.variation=void 0!==t.variation?t.variation+" inverted":"inverted"),o.dimmer("setting",t)}},dimmerStyles:function(){r.inverted?v.addClass(c.inverted):v.removeClass(c.inverted),r.blurring?p.addClass(c.blurring):p.removeClass(c.blurring)},modalOffset:function(){var e;r.detachable?u.css({marginTop:!u.hasClass("aligned")&&O.can.fit()?-O.cache.height/2:r.padding/2,marginLeft:-O.cache.width/2}):(e=O.can.fit(),u.css({top:!u.hasClass("aligned")&&e?q.scrollTop()+(O.cache.contextHeight-O.cache.height)/2:!e||u.hasClass("top")?q.scrollTop()+r.padding:q.scrollTop()+(O.cache.contextHeight-O.cache.height-r.padding),marginLeft:-O.cache.width/2})),O.verbose("Setting modal offset for legacy mode")},screenHeight:function(){O.can.fit()?o.css("height",""):u.hasClass("bottom")||(O.debug("Modal is taller than page content, resizing page height"),o.css("height",O.cache.height+2*r.padding+"px"))},active:function(){u.addClass(c.active+" "+c.front),h.filter("."+c.active).removeClass(c.front)},scrolling:function(){p.addClass(c.scrolling),u.addClass(c.scrolling),O.unbind.scrollLock()},legacy:function(){u.addClass(c.legacy)},type:function(){O.can.fit()?(O.verbose("Modal fits on screen"),O.others.active()||O.others.animating()||(O.remove.scrolling(),O.bind.scrollLock())):u.hasClass("bottom")?O.verbose("Bottom aligned modal not fitting on screen is unsupported for scrolling"):(O.verbose("Modal cannot fit on screen setting to scrolling"),O.set.scrolling())},undetached:function(){p.addClass(c.undetached)}},setting:function(e,t){if(O.debug("Changing setting",e,t),V.isPlainObject(e))V.extend(!0,r,e);else{if(void 0===t)return r[e];V.isPlainObject(r[e])?V.extend(!0,r[e],t):r[e]=t}},internal:function(e,t){if(V.isPlainObject(e))V.extend(!0,O,e);else{if(void 0===t)return O[e];O[e]=t}},debug:function(...e){!r.silent&&r.debug&&(r.performance?O.performance.log(e):(O.debug=Function.prototype.bind.call(console.info,console,r.name+":"),O.debug.apply(console,e)))},verbose:function(...e){!r.silent&&r.verbose&&r.debug&&(r.performance?O.performance.log(e):(O.verbose=Function.prototype.bind.call(console.info,console,r.name+":"),O.verbose.apply(console,e)))},error:function(...e){r.silent||(O.error=Function.prototype.bind.call(console.error,console,r.name+":"),O.error.apply(console,e))},performance:{log:function(e){var t,n;r.performance&&(n=(t=Date.now())-(B||t),B=t,W.push({Name:e[0],Arguments:e.slice(1),Element:y,"Execution Time":n})),clearTimeout(O.performance.timer),O.performance.timer=setTimeout(function(){O.performance.display()},500)},display:function(){var e=r.name+":";let n=0;B=!1,clearTimeout(O.performance.timer),V.each(W,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",0<W.length&&(console.groupCollapsed(e),console.table(W),console.groupEnd()),W=[]}},invoke:function(i,e=K,t=y){let o=k,s,a,n;return"string"==typeof i&&void 0!==o&&(i=i.split(/[ .]/),s=i.length-1,V.each(i,function(e,t){var n=e!==s?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(V.isPlainObject(o[n])&&e!==s)o=o[n];else{if(void 0!==o[n])return a=o[n],!1;{if(!V.isPlainObject(o[t])||e===s)return void 0!==o[t]?a=o[t]:O.error(d.method,i),!1;o=o[t]}}})),Q(a)?n=a.apply(t,e):void 0!==a&&(n=a),Array.isArray(U)?U.push(n):void 0!==U?U=[U,n]:void 0!==n&&(U=n),a}};P?(void 0===k&&(Q(r.templates[j])&&(r.autoShow=!0,r.className.modal=r.className.template,r=V.extend(!0,{},r,r.templates[j].apply(O,K)),c=r.className,r.namespace,l=r.fields,d=r.error),O.initialize()),Q(r.templates[j])||O.invoke(j)):(void 0!==k&&k.invoke("destroy"),O.initialize(),U=u)}),void 0!==U?U:this},V.modal=V.fn.modal,V.fn.modal.settings={name:"Modal",namespace:"modal",useFlex:"auto",offset:0,silent:!1,debug:!1,verbose:!1,performance:!0,observeChanges:!1,allowMultiple:!1,detachable:!0,closable:!0,autofocus:!0,restoreFocus:!0,autoShow:!1,inverted:!1,blurring:!1,centered:!0,dimmerSettings:{closable:!1,useCSS:!0},keyboardShortcuts:!0,context:"body",queue:!1,duration:500,transition:"scale",padding:50,scrollbarWidth:10,title:"",content:"",class:"",classTitle:"",classContent:"",classActions:"",closeIcon:!1,actions:!1,preserveHTML:!1,fields:{class:"class",text:"text",icon:"icon",click:"click"},onShow:function(){},onVisible:function(){},onHide:function(){return!0},onHidden:!1,onApprove:function(){return!0},onDeny:function(){return!0},keys:{space:32,enter:13,escape:27,tab:9},selector:{title:"> .header",content:"> .content",actions:"> .actions",close:"> .close",closeIcon:"> .close",approve:".actions .positive, .actions .approve, .actions .ok",deny:".actions .negative, .actions .deny, .actions .cancel",modal:".ui.modal",dimmer:"> .ui.dimmer",bodyFixed:"> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close",prompt:".ui.input > input"},error:{dimmer:"UI Dimmer, a required component is not included in this page",method:"The method you called is not defined.",notFound:"The element you specified could not be found"},className:{active:"active",animating:"animating",blurring:"blurring",inverted:"inverted",legacy:"legacy",loading:"loading",scrolling:"scrolling",undetached:"undetached",front:"front",close:"close icon",button:"ui button",modal:"ui modal",title:"header",content:"content",actions:"actions",template:"ui tiny modal",ok:"positive",cancel:"negative",prompt:"ui fluid input",innerDimmer:"ui inverted dimmer"},text:{ok:"Ok",cancel:"Cancel",close:"Close"}},V.fn.modal.settings.templates={getArguments:function(e){return V.isPlainObject(e[0])?V.extend({handler:function(){},content:"",title:""},e[0]):(Q(e[e.length-1])||e.push(function(){}),{handler:e.pop(),content:e.pop()||"",title:e.pop()||""})},alert:function(...e){const t=this.get.settings();var n=(e=t.templates.getArguments(e)).handler;return{title:e.title,content:e.content,onApprove:n,actions:[{text:t.text.ok,class:t.className.ok,click:n}]}},confirm:function(...e){const t=this.get.settings();function n(){e.handler(!0)}function i(){e.handler(!1)}return{title:(e=t.templates.getArguments(e)).title,content:e.content,onApprove:n,onDeny:i,actions:[{text:t.text.ok,class:t.className.ok,click:n},{text:t.text.cancel,class:t.className.cancel,click:i}]}},prompt:function(...t){const n=this,e=this.get.settings();t=e.templates.getArguments(t);function i(){var e=n.get.settings(),e=n.get.element().find(e.selector.prompt)[0];t.handler(V(e).val())}function o(){t.handler(null)}return 0===V(V.parseHTML(t.content)).filter(".ui.input").length&&(t.content+='<p><div class="'+this.helpers.escape(e.className.prompt)+'"><input placeholder="'+this.helpers.escape(t.placeholder||"")+'" type="text" value="'+this.helpers.escape(t.defaultValue||"")+'"></div></p>'),{title:t.title,content:t.content,onApprove:i,onDeny:o,actions:[{text:e.text.ok,class:e.className.ok,click:i},{text:e.text.cancel,class:e.className.cancel,click:o}]}}}}(jQuery,window,document);
|
package/dist/components/nag.css
CHANGED