fomantic-ui 2.10.0-beta.2 → 2.10.0-beta.21
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/.all-contributorsrc +9 -0
- package/.eslintrc.js +0 -10
- package/CHANGELOG.md +5289 -2325
- package/CONTRIBUTING.md +4 -1
- package/CONTRIBUTORS.md +1 -0
- package/FAQ.md +7 -2
- package/README.md +5 -9
- package/ROADMAP.md +4 -4
- package/SECURITY.md +8 -7
- package/changelog-setup.js +85 -69
- package/changelog-template.hbs +256 -251
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +103 -142
- 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 +157 -210
- 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 -2
- package/dist/components/button.min.css +2 -2
- package/dist/components/calendar.css +1 -2
- package/dist/components/calendar.js +314 -352
- package/dist/components/calendar.min.css +2 -2
- 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 -2
- package/dist/components/checkbox.js +85 -135
- package/dist/components/checkbox.min.css +2 -2
- 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 +2 -4
- package/dist/components/container.min.css +2 -2
- package/dist/components/dimmer.css +1 -11
- package/dist/components/dimmer.js +61 -94
- package/dist/components/dimmer.min.css +2 -2
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -2
- package/dist/components/divider.min.css +2 -2
- package/dist/components/dropdown.css +30 -51
- package/dist/components/dropdown.js +754 -1096
- package/dist/components/dropdown.min.css +2 -2
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +84 -114
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +3809 -7617
- package/dist/components/emoji.min.css +2 -2
- 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 +2 -3
- package/dist/components/flyout.js +225 -355
- package/dist/components/flyout.min.css +2 -2
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +5 -95
- package/dist/components/form.js +335 -444
- package/dist/components/form.min.css +2 -2
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +2 -58
- package/dist/components/grid.min.css +2 -2
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +4 -4
- package/dist/components/icon.min.css +2 -2
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -536
- package/dist/components/input.min.css +2 -2
- 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 -3
- package/dist/components/list.min.css +2 -2
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +40 -48
- package/dist/components/menu.min.css +2 -2
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +5 -9
- package/dist/components/modal.js +260 -384
- package/dist/components/modal.min.css +2 -2
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +68 -98
- 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 -2
- package/dist/components/popup.js +197 -271
- package/dist/components/popup.min.css +2 -2
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +109 -144
- 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 +90 -123
- 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 +2 -9
- package/dist/components/search.js +276 -379
- package/dist/components/search.min.css +2 -2
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +2 -7
- package/dist/components/segment.min.css +2 -2
- package/dist/components/shape.css +1 -2
- package/dist/components/shape.js +158 -224
- package/dist/components/shape.min.css +2 -2
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +2 -3
- package/dist/components/sidebar.js +124 -206
- package/dist/components/sidebar.min.css +2 -2
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +9 -25
- package/dist/components/site.js +38 -57
- package/dist/components/site.min.css +2 -2
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +246 -329
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +70 -100
- 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 +135 -180
- 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 +176 -241
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +3 -37
- package/dist/components/table.min.css +2 -2
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -3
- package/dist/components/toast.js +108 -147
- 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 +91 -146
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +146 -224
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +3945 -8759
- package/dist/semantic.js +4408 -6193
- package/dist/semantic.min.css +2 -2
- package/dist/semantic.min.js +2 -2
- package/examples/assets/show-examples.js +2 -4
- package/examples/attached.html +1 -1
- package/examples/components/menu.html +1 -1
- package/gulpfile.js +5 -7
- package/package.json +3 -6
- package/scripts/nightly-version.js +7 -10
- package/src/README.md +3 -3
- package/src/definitions/behaviors/api.js +156 -209
- package/src/definitions/behaviors/form.js +334 -443
- package/src/definitions/behaviors/state.js +69 -99
- package/src/definitions/behaviors/visibility.js +145 -223
- package/src/definitions/collections/form.less +1 -13
- package/src/definitions/collections/grid.less +1 -61
- package/src/definitions/collections/menu.less +101 -107
- package/src/definitions/collections/table.less +1 -35
- package/src/definitions/elements/input.less +1 -61
- package/src/definitions/elements/segment.less +0 -6
- package/src/definitions/globals/site.js +37 -56
- package/src/definitions/globals/site.less +2 -18
- package/src/definitions/modules/accordion.js +102 -141
- package/src/definitions/modules/calendar.js +313 -351
- package/src/definitions/modules/checkbox.js +84 -134
- package/src/definitions/modules/dimmer.js +60 -93
- package/src/definitions/modules/dimmer.less +0 -9
- package/src/definitions/modules/dropdown.js +753 -1095
- package/src/definitions/modules/dropdown.less +31 -47
- package/src/definitions/modules/embed.js +83 -113
- package/src/definitions/modules/flyout.js +224 -354
- package/src/definitions/modules/modal.js +259 -383
- package/src/definitions/modules/modal.less +1 -1
- package/src/definitions/modules/nag.js +67 -97
- package/src/definitions/modules/popup.js +196 -270
- package/src/definitions/modules/progress.js +108 -143
- package/src/definitions/modules/rating.js +89 -122
- package/src/definitions/modules/search.js +275 -378
- package/src/definitions/modules/search.less +0 -3
- package/src/definitions/modules/shape.js +157 -223
- package/src/definitions/modules/sidebar.js +123 -205
- package/src/definitions/modules/slider.js +245 -328
- package/src/definitions/modules/slider.less +1 -1
- package/src/definitions/modules/sticky.js +134 -179
- package/src/definitions/modules/tab.js +175 -240
- package/src/definitions/modules/toast.js +107 -146
- package/src/definitions/modules/toast.less +1 -1
- package/src/definitions/modules/transition.js +90 -145
- package/src/theme.less +0 -13
- package/src/themes/basic/elements/icon.variables +1 -1
- package/src/themes/chubby/collections/menu.variables +1 -1
- package/src/themes/default/collections/grid.variables +0 -30
- package/src/themes/default/collections/menu.variables +23 -23
- package/src/themes/default/collections/table.variables +1 -5
- package/src/themes/default/elements/icon.variables +3 -3
- package/src/themes/default/globals/site.variables +8 -15
- package/src/themes/default/globals/variation.variables +3 -3
- package/src/themes/default/modules/dropdown.variables +1 -0
- package/src/themes/default/modules/slider.variables +1 -1
- package/src/themes/github/elements/icon.variables +1 -1
- package/src/themes/material/elements/icon.variables +1 -1
- package/tasks/README.md +1 -1
- package/tasks/admin/components/create.js +89 -122
- package/tasks/admin/components/init.js +34 -65
- package/tasks/admin/components/update.js +50 -61
- package/tasks/admin/distributions/create.js +71 -111
- package/tasks/admin/distributions/init.js +32 -63
- package/tasks/admin/distributions/update.js +49 -57
- package/tasks/admin/publish.js +1 -1
- package/tasks/admin/register.js +14 -19
- package/tasks/admin/release.js +2 -2
- package/tasks/build/assets.js +14 -18
- package/tasks/build/css.js +59 -68
- package/tasks/build/javascript.js +48 -56
- package/tasks/build.js +4 -6
- package/tasks/check-install.js +5 -8
- package/tasks/clean.js +5 -7
- package/tasks/collections/admin.js +14 -16
- package/tasks/collections/build.js +6 -8
- package/tasks/collections/docs.js +4 -6
- package/tasks/collections/install.js +2 -4
- package/tasks/collections/rtl.js +2 -4
- package/tasks/collections/various.js +2 -4
- package/tasks/config/admin/github.js +9 -19
- package/tasks/config/admin/templates/README.md +2 -2
- package/tasks/config/admin/templates/bower.json +2 -4
- package/tasks/config/admin/templates/composer.json +1 -1
- package/tasks/config/admin/templates/css-package.js +1 -4
- package/tasks/config/admin/templates/less-package.js +1 -3
- package/tasks/config/defaults.js +0 -1
- package/tasks/config/npm/gulpfile.js +4 -6
- package/tasks/config/project/config.js +27 -35
- package/tasks/config/project/install.js +64 -82
- package/tasks/config/project/release.js +7 -9
- package/tasks/config/tasks.js +10 -21
- package/tasks/config/user.js +14 -20
- package/tasks/docs/build.js +26 -31
- package/tasks/docs/metadata.js +30 -39
- package/tasks/docs/serve.js +23 -27
- package/tasks/install.js +94 -128
- package/tasks/rtl/build.js +2 -4
- package/tasks/rtl/watch.js +3 -5
- package/tasks/watch.js +13 -13
- package/test/meteor/fonts.js +1 -2
- package/test/modules/module.spec.js +16 -18
- package/types/fomantic-ui-calendar.d.ts +1 -1
- package/types/fomantic-ui-dropdown.d.ts +45 -1
- package/types/fomantic-ui-embed.d.ts +1 -1
- package/types/fomantic-ui-flyout.d.ts +1 -1
- package/types/fomantic-ui-form.d.ts +0 -7
- package/types/fomantic-ui-modal.d.ts +1 -1
- package/types/fomantic-ui-search.d.ts +12 -6
- package/types/fomantic-ui-toast.d.ts +1 -1
- package/src/themes/basic/assets/fonts/icons.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-Bold.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-Italic.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-Regular.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
- package/src/themes/default/assets/fonts/brand-icons.woff +0 -0
- package/src/themes/default/assets/fonts/icons.woff +0 -0
- package/src/themes/default/assets/fonts/outline-icons.woff +0 -0
- package/src/themes/github/assets/fonts/octicons.woff +0 -0
- package/src/themes/material/assets/fonts/icons.woff +0 -0
@@ -20,82 +20,78 @@
|
|
20
20
|
: globalThis;
|
21
21
|
|
22
22
|
$.fn.modal = function (parameters) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
43
|
-
}
|
23
|
+
let $allModules = $(this);
|
24
|
+
let $window = $(window);
|
25
|
+
let $document = $(document);
|
26
|
+
let $body = $('body');
|
27
|
+
|
28
|
+
let time = Date.now();
|
29
|
+
let performance = [];
|
30
|
+
|
31
|
+
let query = arguments[0];
|
32
|
+
let methodInvoked = typeof query === 'string';
|
33
|
+
let queryArguments = [].slice.call(arguments, 1);
|
34
|
+
let contextCheck = function (context, win) {
|
35
|
+
let $context;
|
36
|
+
if ([window, document].indexOf(context) >= 0) {
|
37
|
+
$context = $body;
|
38
|
+
} else {
|
39
|
+
$context = $(win.document).find(context);
|
40
|
+
if ($context.length === 0) {
|
41
|
+
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
44
42
|
}
|
43
|
+
}
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
;
|
45
|
+
return $context;
|
46
|
+
};
|
47
|
+
let returnedValue;
|
50
48
|
|
51
49
|
$allModules.each(function () {
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
module
|
98
|
-
;
|
50
|
+
let settings = $.isPlainObject(parameters)
|
51
|
+
? $.extend(true, {}, $.fn.modal.settings, parameters)
|
52
|
+
: $.extend({}, $.fn.modal.settings);
|
53
|
+
|
54
|
+
let selector = settings.selector;
|
55
|
+
let className = settings.className;
|
56
|
+
let namespace = settings.namespace;
|
57
|
+
let fields = settings.fields;
|
58
|
+
let error = settings.error;
|
59
|
+
|
60
|
+
let eventNamespace = '.' + namespace;
|
61
|
+
let moduleNamespace = 'module-' + namespace;
|
62
|
+
|
63
|
+
let $module = $(this);
|
64
|
+
let $context = contextCheck(settings.context, window);
|
65
|
+
let isBody = $context[0] === $body[0];
|
66
|
+
let $closeIcon = $module.find(selector.closeIcon);
|
67
|
+
let $inputs;
|
68
|
+
|
69
|
+
let $allModals;
|
70
|
+
let $otherModals;
|
71
|
+
let $focusedElement;
|
72
|
+
let $dimmable;
|
73
|
+
let $dimmer;
|
74
|
+
|
75
|
+
let isModalComponent = $module.hasClass('modal');
|
76
|
+
|
77
|
+
let element = this;
|
78
|
+
let instance = isModalComponent ? $module.data(moduleNamespace) : undefined;
|
79
|
+
|
80
|
+
let ignoreRepeatedEvents = false;
|
81
|
+
|
82
|
+
let initialMouseDownInModal;
|
83
|
+
let initialMouseDownInScrollbar;
|
84
|
+
let initialBodyMargin = '';
|
85
|
+
let tempBodyMargin = '';
|
86
|
+
let keepScrollingClass = false;
|
87
|
+
let hadScrollbar = false;
|
88
|
+
let windowRefocused = false;
|
89
|
+
|
90
|
+
let elementEventNamespace;
|
91
|
+
let id;
|
92
|
+
let observer;
|
93
|
+
let observeAttributes = false;
|
94
|
+
let module;
|
99
95
|
module = {
|
100
96
|
|
101
97
|
initialize: function () {
|
@@ -111,36 +107,34 @@
|
|
111
107
|
}
|
112
108
|
$module.addClass(settings.class);
|
113
109
|
if (settings.title !== '') {
|
114
|
-
$module.find(selector.title).html(module.helpers.escape(settings.title, settings
|
110
|
+
$module.find(selector.title).html(module.helpers.escape(settings.title, settings)).addClass(settings.classTitle);
|
115
111
|
}
|
116
112
|
if (settings.content !== '') {
|
117
|
-
$module.find(selector.content).html(module.helpers.escape(settings.content, settings
|
113
|
+
$module.find(selector.content).html(module.helpers.escape(settings.content, settings)).addClass(settings.classContent);
|
118
114
|
}
|
119
115
|
if (module.has.configActions()) {
|
120
|
-
|
116
|
+
let $actions = $module.find(selector.actions).addClass(settings.classActions);
|
121
117
|
if ($actions.length === 0) {
|
122
118
|
$actions = $('<div/>', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($module);
|
123
119
|
} else {
|
124
120
|
$actions.empty();
|
125
121
|
}
|
126
122
|
settings.actions.forEach(function (el) {
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
: function () {}
|
136
|
-
;
|
123
|
+
let icon = el[fields.icon]
|
124
|
+
? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.escape(el[fields.icon]) + ' icon"></i>'
|
125
|
+
: '';
|
126
|
+
let text = module.helpers.escape(el[fields.text] || '', settings);
|
127
|
+
let cls = module.helpers.escape(el[fields.class] || '');
|
128
|
+
let click = el[fields.click] && isFunction(el[fields.click])
|
129
|
+
? el[fields.click]
|
130
|
+
: function () {};
|
137
131
|
$actions.append($('<button/>', {
|
138
132
|
html: icon + text,
|
139
133
|
'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g, ''),
|
140
134
|
class: className.button + ' ' + cls,
|
141
135
|
on: {
|
142
136
|
click: function () {
|
143
|
-
|
137
|
+
let button = $(this);
|
144
138
|
if (button.is(selector.approve) || button.is(selector.deny) || click.call(element, $module) === false) {
|
145
139
|
return;
|
146
140
|
}
|
@@ -174,8 +168,7 @@
|
|
174
168
|
module.verbose('Storing instance of modal');
|
175
169
|
instance = module;
|
176
170
|
$module
|
177
|
-
.data(moduleNamespace, instance)
|
178
|
-
;
|
171
|
+
.data(moduleNamespace, instance);
|
179
172
|
},
|
180
173
|
|
181
174
|
create: {
|
@@ -191,12 +184,12 @@
|
|
191
184
|
$module.append($closeIcon);
|
192
185
|
}
|
193
186
|
if (settings.title !== '') {
|
194
|
-
|
187
|
+
let titleId = '_' + module.get.id() + 'title';
|
195
188
|
$module.attr('aria-labelledby', titleId);
|
196
189
|
$('<div/>', { class: className.title, id: titleId }).appendTo($module);
|
197
190
|
}
|
198
191
|
if (settings.content !== '') {
|
199
|
-
|
192
|
+
let descId = '_' + module.get.id() + 'desc';
|
200
193
|
$module.attr('aria-describedby', descId);
|
201
194
|
$('<div/>', { class: className.content, id: descId }).appendTo($module);
|
202
195
|
}
|
@@ -207,13 +200,11 @@
|
|
207
200
|
element = $module[0];
|
208
201
|
},
|
209
202
|
dimmer: function () {
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
|
216
|
-
;
|
203
|
+
let defaultSettings = {
|
204
|
+
debug: settings.debug,
|
205
|
+
dimmerName: 'modals',
|
206
|
+
};
|
207
|
+
let dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
|
217
208
|
if ($.fn.dimmer === undefined) {
|
218
209
|
module.error(error.dimmer);
|
219
210
|
|
@@ -249,8 +240,7 @@
|
|
249
240
|
module.verbose('Destroying previous modal');
|
250
241
|
$module
|
251
242
|
.removeData(moduleNamespace)
|
252
|
-
.off(eventNamespace)
|
253
|
-
;
|
243
|
+
.off(eventNamespace);
|
254
244
|
$window.off(elementEventNamespace);
|
255
245
|
$context.off(elementEventNamespace);
|
256
246
|
$dimmer.off(elementEventNamespace);
|
@@ -262,59 +252,56 @@
|
|
262
252
|
},
|
263
253
|
|
264
254
|
observeChanges: function () {
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
}
|
255
|
+
observer = new MutationObserver(function (mutations) {
|
256
|
+
let collectNodes = function (parent) {
|
257
|
+
let nodes = [];
|
258
|
+
for (let c = 0, cl = parent.length; c < cl; c++) {
|
259
|
+
Array.prototype.push.apply(nodes, collectNodes(parent[c].childNodes));
|
260
|
+
nodes.push(parent[c]);
|
261
|
+
}
|
273
262
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
if (mutation.
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
ignoreAutofocus = false;
|
295
|
-
}
|
263
|
+
return nodes;
|
264
|
+
};
|
265
|
+
let shouldRefresh = false;
|
266
|
+
let shouldRefreshInputs = false;
|
267
|
+
let ignoreAutofocus = true;
|
268
|
+
mutations.every(function (mutation) {
|
269
|
+
if (mutation.type === 'attributes') {
|
270
|
+
if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
|
271
|
+
shouldRefreshInputs = true;
|
272
|
+
}
|
273
|
+
} else {
|
274
|
+
shouldRefresh = true;
|
275
|
+
// mutationobserver only provides the parent nodes,
|
276
|
+
// so let's collect all childs as well to find nested inputs
|
277
|
+
let $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible');
|
278
|
+
let $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
|
279
|
+
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
|
280
|
+
shouldRefreshInputs = true;
|
281
|
+
if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
|
282
|
+
ignoreAutofocus = false;
|
296
283
|
}
|
297
284
|
}
|
298
|
-
|
299
|
-
return !shouldRefreshInputs;
|
300
|
-
});
|
301
|
-
|
302
|
-
if (shouldRefresh && settings.observeChanges) {
|
303
|
-
module.debug('DOM tree modified, refreshing');
|
304
|
-
module.refresh();
|
305
|
-
}
|
306
|
-
if (shouldRefreshInputs) {
|
307
|
-
module.refreshInputs(ignoreAutofocus);
|
308
285
|
}
|
286
|
+
|
287
|
+
return !shouldRefreshInputs;
|
309
288
|
});
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
289
|
+
|
290
|
+
if (shouldRefresh && settings.observeChanges) {
|
291
|
+
module.debug('DOM tree modified, refreshing');
|
292
|
+
module.refresh();
|
293
|
+
}
|
294
|
+
if (shouldRefreshInputs) {
|
295
|
+
module.refreshInputs(ignoreAutofocus);
|
296
|
+
}
|
297
|
+
});
|
298
|
+
observer.observe(element, {
|
299
|
+
attributeFilter: ['class', 'disabled'],
|
300
|
+
attributes: true,
|
301
|
+
childList: true,
|
302
|
+
subtree: true,
|
303
|
+
});
|
304
|
+
module.debug('Setting up mutation observer', observer);
|
318
305
|
},
|
319
306
|
|
320
307
|
refresh: function () {
|
@@ -335,8 +322,7 @@
|
|
335
322
|
refreshInputs: function (ignoreAutofocus) {
|
336
323
|
if ($inputs) {
|
337
324
|
$inputs
|
338
|
-
.off('keydown' + elementEventNamespace)
|
339
|
-
;
|
325
|
+
.off('keydown' + elementEventNamespace);
|
340
326
|
}
|
341
327
|
$inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
|
342
328
|
return $(this).closest('.disabled').length === 0;
|
@@ -348,20 +334,16 @@
|
|
348
334
|
$module.removeAttr('tabindex');
|
349
335
|
}
|
350
336
|
$inputs.first()
|
351
|
-
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.first)
|
352
|
-
;
|
337
|
+
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.first);
|
353
338
|
$inputs.last()
|
354
|
-
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
|
355
|
-
;
|
339
|
+
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.last);
|
356
340
|
if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
|
357
341
|
module.set.autofocus();
|
358
342
|
}
|
359
343
|
},
|
360
344
|
|
361
345
|
attachEvents: function (selector, event) {
|
362
|
-
|
363
|
-
$toggle = $(selector)
|
364
|
-
;
|
346
|
+
let $toggle = $(selector);
|
365
347
|
event = isFunction(module[event])
|
366
348
|
? module[event]
|
367
349
|
: module.toggle;
|
@@ -369,8 +351,7 @@
|
|
369
351
|
module.debug('Attaching modal events to element', selector, event);
|
370
352
|
$toggle
|
371
353
|
.off(eventNamespace)
|
372
|
-
.on('click' + eventNamespace, event)
|
373
|
-
;
|
354
|
+
.on('click' + eventNamespace, event);
|
374
355
|
} else {
|
375
356
|
module.error(error.notFound, selector);
|
376
357
|
}
|
@@ -382,18 +363,14 @@
|
|
382
363
|
$module
|
383
364
|
.on('click' + eventNamespace, selector.close, module.event.close)
|
384
365
|
.on('click' + eventNamespace, selector.approve, module.event.approve)
|
385
|
-
.on('click' + eventNamespace, selector.deny, module.event.deny)
|
386
|
-
;
|
366
|
+
.on('click' + eventNamespace, selector.deny, module.event.deny);
|
387
367
|
$closeIcon
|
388
|
-
.on('keyup' + elementEventNamespace, module.event.closeKeyUp)
|
389
|
-
;
|
368
|
+
.on('keyup' + elementEventNamespace, module.event.closeKeyUp);
|
390
369
|
$window
|
391
370
|
.on('resize' + elementEventNamespace, module.event.resize)
|
392
|
-
.on('focus' + elementEventNamespace, module.event.focus)
|
393
|
-
;
|
371
|
+
.on('focus' + elementEventNamespace, module.event.focus);
|
394
372
|
$context
|
395
|
-
.on('click' + elementEventNamespace, module.event.click)
|
396
|
-
;
|
373
|
+
.on('click' + elementEventNamespace, module.event.click);
|
397
374
|
},
|
398
375
|
scrollLock: function () {
|
399
376
|
// touch events default to passive, due to changes in chrome to optimize mobile perf
|
@@ -451,27 +428,21 @@
|
|
451
428
|
module.hide();
|
452
429
|
},
|
453
430
|
closeKeyUp: function (event) {
|
454
|
-
|
455
|
-
keyCode = event.which
|
456
|
-
;
|
431
|
+
let keyCode = event.which;
|
457
432
|
if ((keyCode === settings.keys.enter || keyCode === settings.keys.space) && $module.hasClass(className.front)) {
|
458
433
|
module.hide();
|
459
434
|
}
|
460
435
|
},
|
461
436
|
inputKeyDown: {
|
462
437
|
first: function (event) {
|
463
|
-
|
464
|
-
keyCode = event.which
|
465
|
-
;
|
438
|
+
let keyCode = event.which;
|
466
439
|
if (keyCode === settings.keys.tab && event.shiftKey) {
|
467
440
|
$inputs.last().trigger('focus');
|
468
441
|
event.preventDefault();
|
469
442
|
}
|
470
443
|
},
|
471
444
|
last: function (event) {
|
472
|
-
|
473
|
-
keyCode = event.which
|
474
|
-
;
|
445
|
+
let keyCode = event.which;
|
475
446
|
if (keyCode === settings.keys.tab && !event.shiftKey) {
|
476
447
|
$inputs.first().trigger('focus');
|
477
448
|
event.preventDefault();
|
@@ -479,10 +450,8 @@
|
|
479
450
|
},
|
480
451
|
},
|
481
452
|
mousedown: function (event) {
|
482
|
-
|
483
|
-
|
484
|
-
isRtl = module.is.rtl()
|
485
|
-
;
|
453
|
+
let $target = $(event.target);
|
454
|
+
let isRtl = module.is.rtl();
|
486
455
|
initialMouseDownInModal = $target.closest(selector.modal).length > 0;
|
487
456
|
if (initialMouseDownInModal) {
|
488
457
|
module.verbose('Mouse down event registered inside the modal');
|
@@ -508,11 +477,9 @@
|
|
508
477
|
|
509
478
|
return;
|
510
479
|
}
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
isInDOM = $.contains(document.documentElement, event.target)
|
515
|
-
;
|
480
|
+
let $target = $(event.target);
|
481
|
+
let isInModal = $target.closest(selector.modal).length > 0;
|
482
|
+
let isInDOM = $.contains(document.documentElement, event.target);
|
516
483
|
if (!isInModal && isInDOM && module.is.active() && $module.hasClass(className.front)) {
|
517
484
|
module.debug('Dimmer clicked, hiding all modals');
|
518
485
|
if (settings.allowMultiple) {
|
@@ -532,9 +499,7 @@
|
|
532
499
|
}, delay);
|
533
500
|
},
|
534
501
|
keyboard: function (event) {
|
535
|
-
|
536
|
-
keyCode = event.which
|
537
|
-
;
|
502
|
+
let keyCode = event.which;
|
538
503
|
if (keyCode === settings.keys.escape) {
|
539
504
|
if (settings.closable) {
|
540
505
|
module.debug('Escape key pressed hiding modal');
|
@@ -654,8 +619,7 @@
|
|
654
619
|
requestAnimationFrame(module.set.observeAttributes);
|
655
620
|
callback();
|
656
621
|
},
|
657
|
-
})
|
658
|
-
;
|
622
|
+
});
|
659
623
|
} else {
|
660
624
|
module.error(error.noTransition);
|
661
625
|
}
|
@@ -666,9 +630,7 @@
|
|
666
630
|
},
|
667
631
|
|
668
632
|
hideModal: function (callback, keepDimmed, hideOthersToo) {
|
669
|
-
|
670
|
-
$previousModal = $otherModals.filter('.' + className.active).last()
|
671
|
-
;
|
633
|
+
let $previousModal = $otherModals.filter('.' + className.active).last();
|
672
634
|
callback = isFunction(callback)
|
673
635
|
? callback
|
674
636
|
: function () {};
|
@@ -719,8 +681,7 @@
|
|
719
681
|
module.restore.focus();
|
720
682
|
callback();
|
721
683
|
},
|
722
|
-
})
|
723
|
-
;
|
684
|
+
});
|
724
685
|
} else {
|
725
686
|
module.error(error.noTransition);
|
726
687
|
}
|
@@ -758,15 +719,13 @@
|
|
758
719
|
},
|
759
720
|
|
760
721
|
hideAll: function (callback) {
|
761
|
-
|
762
|
-
$visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating)
|
763
|
-
;
|
722
|
+
let $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating);
|
764
723
|
callback = isFunction(callback)
|
765
724
|
? callback
|
766
725
|
: function () {};
|
767
726
|
if ($visibleModals.length > 0) {
|
768
727
|
module.debug('Hiding all visible modals');
|
769
|
-
|
728
|
+
let hideOk = true;
|
770
729
|
// check in reverse order trying to hide most top displayed modal first
|
771
730
|
$($visibleModals.get().reverse()).each(function (index, element) {
|
772
731
|
if (hideOk) {
|
@@ -782,17 +741,14 @@
|
|
782
741
|
},
|
783
742
|
|
784
743
|
hideOthers: function (callback) {
|
785
|
-
|
786
|
-
$visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating)
|
787
|
-
;
|
744
|
+
let $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating);
|
788
745
|
callback = isFunction(callback)
|
789
746
|
? callback
|
790
747
|
: function () {};
|
791
748
|
if ($visibleModals.length > 0) {
|
792
749
|
module.debug('Hiding other modals', $otherModals);
|
793
750
|
$visibleModals
|
794
|
-
.modal('hide modal', callback, true)
|
795
|
-
;
|
751
|
+
.modal('hide modal', callback, true);
|
796
752
|
}
|
797
753
|
},
|
798
754
|
|
@@ -809,27 +765,22 @@
|
|
809
765
|
keyboardShortcuts: function () {
|
810
766
|
module.verbose('Adding keyboard shortcuts');
|
811
767
|
$document
|
812
|
-
.on('keydown' + eventNamespace, module.event.keyboard)
|
813
|
-
;
|
768
|
+
.on('keydown' + eventNamespace, module.event.keyboard);
|
814
769
|
},
|
815
770
|
},
|
816
771
|
|
817
772
|
save: {
|
818
773
|
focus: function () {
|
819
|
-
|
820
|
-
|
821
|
-
inCurrentModal = $activeElement.closest($module).length > 0
|
822
|
-
;
|
774
|
+
let $activeElement = $(document.activeElement);
|
775
|
+
let inCurrentModal = $activeElement.closest($module).length > 0;
|
823
776
|
if (!inCurrentModal) {
|
824
777
|
$focusedElement = $(document.activeElement).trigger('blur');
|
825
778
|
}
|
826
779
|
},
|
827
780
|
bodyMargin: function () {
|
828
781
|
initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
|
829
|
-
|
830
|
-
|
831
|
-
bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth
|
832
|
-
;
|
782
|
+
let bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10);
|
783
|
+
let bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
|
833
784
|
tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
|
834
785
|
},
|
835
786
|
},
|
@@ -841,13 +792,11 @@
|
|
841
792
|
}
|
842
793
|
},
|
843
794
|
bodyMargin: function () {
|
844
|
-
|
795
|
+
let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
845
796
|
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
|
846
797
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
847
|
-
|
848
|
-
|
849
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
850
|
-
;
|
798
|
+
let el = $(this);
|
799
|
+
let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
851
800
|
el.css(attribute, '');
|
852
801
|
});
|
853
802
|
},
|
@@ -863,15 +812,12 @@
|
|
863
812
|
clickaway: function () {
|
864
813
|
if (!settings.detachable) {
|
865
814
|
$module
|
866
|
-
.off('mousedown' + elementEventNamespace)
|
867
|
-
;
|
815
|
+
.off('mousedown' + elementEventNamespace);
|
868
816
|
}
|
869
817
|
$dimmer
|
870
|
-
.off('mousedown' + elementEventNamespace)
|
871
|
-
;
|
818
|
+
.off('mousedown' + elementEventNamespace);
|
872
819
|
$dimmer
|
873
|
-
.off('mouseup' + elementEventNamespace)
|
874
|
-
;
|
820
|
+
.off('mouseup' + elementEventNamespace);
|
875
821
|
},
|
876
822
|
dimmerStyles: function () {
|
877
823
|
$dimmer.removeClass(className.inverted);
|
@@ -886,15 +832,13 @@
|
|
886
832
|
screenHeight: function () {
|
887
833
|
module.debug('Removing page height');
|
888
834
|
$context
|
889
|
-
.css('height', '')
|
890
|
-
;
|
835
|
+
.css('height', '');
|
891
836
|
module.remove.bodyStyle();
|
892
837
|
},
|
893
838
|
keyboardShortcuts: function () {
|
894
839
|
module.verbose('Removing keyboard shortcuts');
|
895
840
|
$document
|
896
|
-
.off('keydown' + eventNamespace)
|
897
|
-
;
|
841
|
+
.off('keydown' + eventNamespace);
|
898
842
|
},
|
899
843
|
scrolling: function () {
|
900
844
|
if (!keepScrollingClass) {
|
@@ -906,11 +850,9 @@
|
|
906
850
|
|
907
851
|
cacheSizes: function () {
|
908
852
|
$module.addClass(className.loading);
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
modalHeight = $module.outerHeight()
|
913
|
-
;
|
853
|
+
let scrollHeight = $module.prop('scrollHeight');
|
854
|
+
let modalWidth = $module.outerWidth();
|
855
|
+
let modalHeight = $module.outerHeight();
|
914
856
|
if (module.cache.pageHeight === undefined || modalHeight !== 0) {
|
915
857
|
$.extend(module.cache, {
|
916
858
|
pageHeight: $document.outerHeight(),
|
@@ -927,66 +869,48 @@
|
|
927
869
|
module.debug('Caching modal and container sizes', module.cache);
|
928
870
|
},
|
929
871
|
helpers: {
|
930
|
-
|
931
|
-
|
932
|
-
},
|
933
|
-
escape: function (string, preserveHTML) {
|
934
|
-
if (preserveHTML) {
|
872
|
+
escape: function (string, settings) {
|
873
|
+
if (settings !== undefined && settings.preserveHTML) {
|
935
874
|
return string;
|
936
875
|
}
|
937
|
-
var
|
938
|
-
badChars = /["'<>`]/g,
|
939
|
-
shouldEscape = /["&'<>`]/,
|
940
|
-
escape = {
|
941
|
-
'<': '<',
|
942
|
-
'>': '>',
|
943
|
-
'"': '"',
|
944
|
-
"'": ''',
|
945
|
-
'`': '`',
|
946
|
-
},
|
947
|
-
escapedChar = function (chr) {
|
948
|
-
return escape[chr];
|
949
|
-
}
|
950
|
-
;
|
951
|
-
if (shouldEscape.test(string)) {
|
952
|
-
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');
|
953
876
|
|
954
|
-
|
955
|
-
|
877
|
+
const escapeMap = {
|
878
|
+
'"': '"',
|
879
|
+
'&': '&',
|
880
|
+
"'": ''',
|
881
|
+
'<': '<',
|
882
|
+
'>': '>',
|
883
|
+
};
|
956
884
|
|
957
|
-
return string;
|
885
|
+
return String(string).replace(/["&'<>]/g, (chr) => escapeMap[chr]);
|
958
886
|
},
|
959
887
|
},
|
960
888
|
can: {
|
961
889
|
leftBodyScrollbar: function () {
|
962
890
|
if (module.cache.leftBodyScrollbar === undefined) {
|
963
|
-
module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari()
|
891
|
+
module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari());
|
964
892
|
}
|
965
893
|
|
966
894
|
return module.cache.leftBodyScrollbar;
|
967
895
|
},
|
968
896
|
useFlex: function () {
|
969
897
|
if (settings.useFlex === 'auto') {
|
970
|
-
return settings.detachable
|
898
|
+
return settings.detachable;
|
971
899
|
}
|
972
|
-
if (settings.useFlex &&
|
973
|
-
module.debug('useFlex true is not supported in IE');
|
974
|
-
} else if (settings.useFlex && !settings.detachable) {
|
900
|
+
if (settings.useFlex && !settings.detachable) {
|
975
901
|
module.debug('useFlex true in combination with detachable false is not supported');
|
976
902
|
}
|
977
903
|
|
978
904
|
return settings.useFlex;
|
979
905
|
},
|
980
906
|
fit: function () {
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
startPosition = verticalCenter + topOffset
|
989
|
-
;
|
907
|
+
let contextHeight = module.cache.contextHeight;
|
908
|
+
let verticalCenter = module.cache.contextHeight / 2;
|
909
|
+
let topOffset = module.cache.topOffset;
|
910
|
+
let scrollHeight = module.cache.scrollHeight;
|
911
|
+
let height = module.cache.height;
|
912
|
+
let paddingHeight = settings.padding;
|
913
|
+
let startPosition = verticalCenter + topOffset;
|
990
914
|
|
991
915
|
return scrollHeight > height
|
992
916
|
? startPosition + scrollHeight + paddingHeight < contextHeight
|
@@ -1005,27 +929,12 @@
|
|
1005
929
|
active: function () {
|
1006
930
|
return $module.hasClass(className.active);
|
1007
931
|
},
|
1008
|
-
ie: function () {
|
1009
|
-
if (module.cache.isIE === undefined) {
|
1010
|
-
var
|
1011
|
-
isIE11 = !window.ActiveXObject && 'ActiveXObject' in window,
|
1012
|
-
isIE = 'ActiveXObject' in window
|
1013
|
-
;
|
1014
|
-
module.cache.isIE = isIE11 || isIE;
|
1015
|
-
}
|
1016
|
-
|
1017
|
-
return module.cache.isIE;
|
1018
|
-
},
|
1019
932
|
animating: function () {
|
1020
933
|
return $module.transition('is animating');
|
1021
934
|
},
|
1022
935
|
scrolling: function () {
|
1023
936
|
return $dimmable.hasClass(className.scrolling);
|
1024
937
|
},
|
1025
|
-
modernBrowser: function () {
|
1026
|
-
// appName for IE11 reports 'Netscape' can no longer use
|
1027
|
-
return !(window.ActiveXObject || 'ActiveXObject' in window);
|
1028
|
-
},
|
1029
938
|
rtl: function () {
|
1030
939
|
if (module.cache.isRTL === undefined) {
|
1031
940
|
module.cache.isRTL = $module.attr('dir') === 'rtl' || $module.css('direction') === 'rtl' || $body.attr('dir') === 'rtl' || $body.css('direction') === 'rtl' || $context.attr('dir') === 'rtl' || $context.css('direction') === 'rtl';
|
@@ -1040,13 +949,6 @@
|
|
1040
949
|
|
1041
950
|
return module.cache.isSafari;
|
1042
951
|
},
|
1043
|
-
edge: function () {
|
1044
|
-
if (module.cache.isEdge === undefined) {
|
1045
|
-
module.cache.isEdge = !!window.setImmediate && !module.is.ie();
|
1046
|
-
}
|
1047
|
-
|
1048
|
-
return module.cache.isEdge;
|
1049
|
-
},
|
1050
952
|
firefox: function () {
|
1051
953
|
if (module.cache.isFirefox === undefined) {
|
1052
954
|
module.cache.isFirefox = !!window.InstallTrigger;
|
@@ -1064,43 +966,36 @@
|
|
1064
966
|
observeAttributes = state !== false;
|
1065
967
|
},
|
1066
968
|
autofocus: function () {
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
).first()
|
1076
|
-
;
|
969
|
+
let $autofocus = $inputs.filter('[autofocus]');
|
970
|
+
let $rawInputs = $inputs.filter(':input');
|
971
|
+
let $input = ($autofocus.length > 0
|
972
|
+
? $autofocus
|
973
|
+
: ($rawInputs.length > 0
|
974
|
+
? $rawInputs
|
975
|
+
: $module)
|
976
|
+
).first();
|
1077
977
|
$input.trigger('focus');
|
1078
978
|
},
|
1079
979
|
bodyMargin: function () {
|
1080
|
-
|
980
|
+
let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
1081
981
|
if (settings.detachable || module.can.fit()) {
|
1082
982
|
$context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
|
1083
983
|
}
|
1084
984
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
1085
|
-
|
1086
|
-
|
1087
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
1088
|
-
;
|
985
|
+
let el = $(this);
|
986
|
+
let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
1089
987
|
el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
|
1090
988
|
});
|
1091
989
|
},
|
1092
990
|
clickaway: function () {
|
1093
991
|
if (!settings.detachable) {
|
1094
992
|
$module
|
1095
|
-
.on('mousedown' + elementEventNamespace, module.event.mousedown)
|
1096
|
-
;
|
993
|
+
.on('mousedown' + elementEventNamespace, module.event.mousedown);
|
1097
994
|
}
|
1098
995
|
$dimmer
|
1099
|
-
.on('mousedown' + elementEventNamespace, module.event.mousedown)
|
1100
|
-
;
|
996
|
+
.on('mousedown' + elementEventNamespace, module.event.mousedown);
|
1101
997
|
$dimmer
|
1102
|
-
.on('mouseup' + elementEventNamespace, module.event.mouseup)
|
1103
|
-
;
|
998
|
+
.on('mouseup' + elementEventNamespace, module.event.mouseup);
|
1104
999
|
},
|
1105
1000
|
dimmerSettings: function () {
|
1106
1001
|
if ($.fn.dimmer === undefined) {
|
@@ -1108,19 +1003,17 @@
|
|
1108
1003
|
|
1109
1004
|
return;
|
1110
1005
|
}
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
hide: settings.transition.hideDuration || settings.duration,
|
1120
|
-
},
|
1006
|
+
let defaultSettings = {
|
1007
|
+
debug: settings.debug,
|
1008
|
+
dimmerName: 'modals',
|
1009
|
+
closable: 'auto',
|
1010
|
+
useFlex: module.can.useFlex(),
|
1011
|
+
duration: {
|
1012
|
+
show: settings.transition.showDuration || settings.duration,
|
1013
|
+
hide: settings.transition.hideDuration || settings.duration,
|
1121
1014
|
},
|
1122
|
-
|
1123
|
-
;
|
1015
|
+
};
|
1016
|
+
let dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
|
1124
1017
|
if (settings.inverted) {
|
1125
1018
|
dimmerSettings.variation = dimmerSettings.variation !== undefined
|
1126
1019
|
? dimmerSettings.variation + ' inverted'
|
@@ -1142,7 +1035,7 @@
|
|
1142
1035
|
},
|
1143
1036
|
modalOffset: function () {
|
1144
1037
|
if (!settings.detachable) {
|
1145
|
-
|
1038
|
+
let canFit = module.can.fit();
|
1146
1039
|
$module
|
1147
1040
|
.css({
|
1148
1041
|
top: !$module.hasClass('aligned') && canFit
|
@@ -1151,8 +1044,7 @@
|
|
1151
1044
|
? $document.scrollTop() + settings.padding
|
1152
1045
|
: $document.scrollTop() + (module.cache.contextHeight - module.cache.height - settings.padding)),
|
1153
1046
|
marginLeft: -(module.cache.width / 2),
|
1154
|
-
})
|
1155
|
-
;
|
1047
|
+
});
|
1156
1048
|
} else {
|
1157
1049
|
$module
|
1158
1050
|
.css({
|
@@ -1160,8 +1052,7 @@
|
|
1160
1052
|
? -(module.cache.height / 2)
|
1161
1053
|
: settings.padding / 2,
|
1162
1054
|
marginLeft: -(module.cache.width / 2),
|
1163
|
-
})
|
1164
|
-
;
|
1055
|
+
});
|
1165
1056
|
}
|
1166
1057
|
module.verbose('Setting modal offset for legacy mode');
|
1167
1058
|
},
|
@@ -1171,8 +1062,7 @@
|
|
1171
1062
|
} else if (!$module.hasClass('bottom')) {
|
1172
1063
|
module.debug('Modal is taller than page content, resizing page height');
|
1173
1064
|
$context
|
1174
|
-
.css('height', module.cache.height + (settings.padding * 2) + 'px')
|
1175
|
-
;
|
1065
|
+
.css('height', module.cache.height + (settings.padding * 2) + 'px');
|
1176
1066
|
}
|
1177
1067
|
},
|
1178
1068
|
active: function () {
|
@@ -1257,11 +1147,9 @@
|
|
1257
1147
|
},
|
1258
1148
|
performance: {
|
1259
1149
|
log: function (message) {
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
previousTime
|
1264
|
-
;
|
1150
|
+
let currentTime;
|
1151
|
+
let executionTime;
|
1152
|
+
let previousTime;
|
1265
1153
|
if (settings.performance) {
|
1266
1154
|
currentTime = Date.now();
|
1267
1155
|
previousTime = time || currentTime;
|
@@ -1280,10 +1168,8 @@
|
|
1280
1168
|
}, 500);
|
1281
1169
|
},
|
1282
1170
|
display: function () {
|
1283
|
-
|
1284
|
-
|
1285
|
-
totalTime = 0
|
1286
|
-
;
|
1171
|
+
let title = settings.name + ':';
|
1172
|
+
let totalTime = 0;
|
1287
1173
|
time = false;
|
1288
1174
|
clearTimeout(module.performance.timer);
|
1289
1175
|
$.each(performance, function (index, data) {
|
@@ -1305,19 +1191,17 @@
|
|
1305
1191
|
},
|
1306
1192
|
},
|
1307
1193
|
invoke: function (query, passedArguments, context) {
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
response
|
1313
|
-
;
|
1194
|
+
let object = instance;
|
1195
|
+
let maxDepth;
|
1196
|
+
let found;
|
1197
|
+
let response;
|
1314
1198
|
passedArguments = passedArguments || queryArguments;
|
1315
1199
|
context = context || element;
|
1316
1200
|
if (typeof query === 'string' && object !== undefined) {
|
1317
1201
|
query = query.split(/[ .]/);
|
1318
1202
|
maxDepth = query.length - 1;
|
1319
1203
|
$.each(query, function (depth, value) {
|
1320
|
-
|
1204
|
+
let camelCaseValue = depth !== maxDepth
|
1321
1205
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
1322
1206
|
: query;
|
1323
1207
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
@@ -1443,7 +1327,7 @@
|
|
1443
1327
|
classActions: '',
|
1444
1328
|
closeIcon: false,
|
1445
1329
|
actions: false,
|
1446
|
-
preserveHTML:
|
1330
|
+
preserveHTML: false,
|
1447
1331
|
|
1448
1332
|
fields: {
|
1449
1333
|
class: 'class',
|
@@ -1532,7 +1416,7 @@
|
|
1532
1416
|
|
1533
1417
|
$.fn.modal.settings.templates = {
|
1534
1418
|
getArguments: function (args) {
|
1535
|
-
|
1419
|
+
let queryArguments = [].slice.call(args);
|
1536
1420
|
if ($.isPlainObject(queryArguments[0])) {
|
1537
1421
|
return $.extend({
|
1538
1422
|
handler: function () {},
|
@@ -1551,11 +1435,9 @@
|
|
1551
1435
|
};
|
1552
1436
|
},
|
1553
1437
|
alert: function () {
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
approveFn = args.handler
|
1558
|
-
;
|
1438
|
+
let settings = this.get.settings();
|
1439
|
+
let args = settings.templates.getArguments(arguments);
|
1440
|
+
let approveFn = args.handler;
|
1559
1441
|
|
1560
1442
|
return {
|
1561
1443
|
title: args.title,
|
@@ -1569,16 +1451,14 @@
|
|
1569
1451
|
};
|
1570
1452
|
},
|
1571
1453
|
confirm: function () {
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
}
|
1581
|
-
;
|
1454
|
+
let settings = this.get.settings();
|
1455
|
+
let args = settings.templates.getArguments(arguments);
|
1456
|
+
let approveFn = function () {
|
1457
|
+
args.handler(true);
|
1458
|
+
};
|
1459
|
+
let denyFn = function () {
|
1460
|
+
args.handler(false);
|
1461
|
+
};
|
1582
1462
|
|
1583
1463
|
return {
|
1584
1464
|
title: args.title,
|
@@ -1597,24 +1477,20 @@
|
|
1597
1477
|
};
|
1598
1478
|
},
|
1599
1479
|
prompt: function () {
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
denyFn = function () {
|
1613
|
-
args.handler(null);
|
1614
|
-
}
|
1615
|
-
;
|
1480
|
+
let $this = this;
|
1481
|
+
let settings = this.get.settings();
|
1482
|
+
let args = settings.templates.getArguments(arguments);
|
1483
|
+
let input = $($.parseHTML(args.content)).filter('.ui.input');
|
1484
|
+
let approveFn = function () {
|
1485
|
+
let settings = $this.get.settings();
|
1486
|
+
let inputField = $this.get.element().find(settings.selector.prompt)[0];
|
1487
|
+
args.handler($(inputField).val());
|
1488
|
+
};
|
1489
|
+
let denyFn = function () {
|
1490
|
+
args.handler(null);
|
1491
|
+
};
|
1616
1492
|
if (input.length === 0) {
|
1617
|
-
args.content += '<p><div class="' + this.helpers.
|
1493
|
+
args.content += '<p><div class="' + this.helpers.escape(settings.className.prompt) + '"><input placeholder="' + this.helpers.escape(args.placeholder || '') + '" type="text" value="' + this.helpers.escape(args.defaultValue || '') + '"></div></p>';
|
1618
1494
|
}
|
1619
1495
|
|
1620
1496
|
return {
|