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
|
@@ -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) {
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
22
|
$.fn.nag = function (...args) {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const $allModules = $(this);
|
|
24
|
+
const $body = $('body');
|
|
25
25
|
|
|
26
26
|
let time = Date.now();
|
|
27
27
|
let performance = [];
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const parameters = args[0];
|
|
30
|
+
const methodInvoked = typeof parameters === 'string';
|
|
31
|
+
const queryArguments = args.slice(1);
|
|
32
|
+
const contextCheck = function (context, win) {
|
|
33
33
|
let $context;
|
|
34
34
|
if ([window, document].includes(context)) {
|
|
35
35
|
$context = $(context);
|
|
@@ -44,26 +44,25 @@
|
|
|
44
44
|
};
|
|
45
45
|
let returnedValue;
|
|
46
46
|
$allModules.each(function () {
|
|
47
|
-
|
|
47
|
+
const settings = $.isPlainObject(parameters)
|
|
48
48
|
? $.extend(true, {}, $.fn.nag.settings, parameters)
|
|
49
49
|
: $.extend({}, $.fn.nag.settings);
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const selector = settings.selector;
|
|
52
|
+
const error = settings.error;
|
|
53
|
+
const namespace = settings.namespace;
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const eventNamespace = '.' + namespace;
|
|
56
|
+
const moduleNamespace = namespace + '-module';
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
const $module = $(this);
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
const $context = settings.context ? contextCheck(settings.context, window) : $body;
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
const element = this;
|
|
63
|
+
const instance = $module.data(moduleNamespace);
|
|
64
64
|
let storage;
|
|
65
|
-
|
|
66
|
-
module = {
|
|
65
|
+
const module = {
|
|
67
66
|
|
|
68
67
|
initialize: function () {
|
|
69
68
|
module.verbose('Initializing element');
|
|
@@ -193,7 +192,7 @@
|
|
|
193
192
|
.replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[B-D])/g, decodeURIComponent);
|
|
194
193
|
|
|
195
194
|
let cookieOptions = '';
|
|
196
|
-
for (
|
|
195
|
+
for (const option in options) {
|
|
197
196
|
if (Object.prototype.hasOwnProperty.call(options, option)) {
|
|
198
197
|
cookieOptions += '; ' + option;
|
|
199
198
|
if (typeof options[option] === 'string') {
|
|
@@ -204,10 +203,10 @@
|
|
|
204
203
|
document.cookie = key + '=' + value + cookieOptions;
|
|
205
204
|
},
|
|
206
205
|
getItem: function (key) {
|
|
207
|
-
|
|
206
|
+
const cookies = document.cookie.split('; ');
|
|
208
207
|
for (const c of cookies) {
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
const parts = c.split('=');
|
|
209
|
+
const foundKey = parts[0].replace(/(%[\da-f]{2})+/gi, decodeURIComponent);
|
|
211
210
|
if (key === foundKey) {
|
|
212
211
|
return parts[1] || '';
|
|
213
212
|
}
|
|
@@ -219,7 +218,7 @@
|
|
|
219
218
|
};
|
|
220
219
|
},
|
|
221
220
|
storageOptions: function () {
|
|
222
|
-
|
|
221
|
+
const options = {};
|
|
223
222
|
if (settings.expires) {
|
|
224
223
|
options.expires = module.get.expirationDate(settings.expires);
|
|
225
224
|
}
|
|
@@ -246,7 +245,7 @@
|
|
|
246
245
|
|
|
247
246
|
storage: {
|
|
248
247
|
set: function (key, value) {
|
|
249
|
-
|
|
248
|
+
const options = module.get.storageOptions();
|
|
250
249
|
if (storage === window.localStorage && options.expires) {
|
|
251
250
|
module.debug('Storing expiration value in localStorage', key, options.expires);
|
|
252
251
|
storage.setItem(key + settings.expirationKey, options.expires);
|
|
@@ -262,7 +261,7 @@
|
|
|
262
261
|
let storedValue;
|
|
263
262
|
storedValue = storage.getItem(key);
|
|
264
263
|
if (storage === window.localStorage) {
|
|
265
|
-
|
|
264
|
+
const expiration = storage.getItem(key + settings.expirationKey);
|
|
266
265
|
if (expiration !== null && expiration !== undefined && new Date(expiration) < new Date()) {
|
|
267
266
|
module.debug('Value in localStorage has expired. Deleting key', key);
|
|
268
267
|
module.storage.remove(key);
|
|
@@ -276,7 +275,7 @@
|
|
|
276
275
|
return storedValue;
|
|
277
276
|
},
|
|
278
277
|
remove: function (key) {
|
|
279
|
-
|
|
278
|
+
const options = module.get.storageOptions();
|
|
280
279
|
options.expires = module.get.expirationDate(-1);
|
|
281
280
|
if (storage === window.localStorage) {
|
|
282
281
|
storage.removeItem(key + settings.expirationKey);
|
|
@@ -382,7 +381,7 @@
|
|
|
382
381
|
query = query.split(/[ .]/);
|
|
383
382
|
maxDepth = query.length - 1;
|
|
384
383
|
$.each(query, function (depth, value) {
|
|
385
|
-
|
|
384
|
+
const camelCaseValue = depth !== maxDepth
|
|
386
385
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
387
386
|
: query;
|
|
388
387
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|