fomantic-ui 2.10.0-beta.4 → 2.10.0-beta.41
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 -10
- package/CHANGELOG.md +5289 -2325
- package/README.md +4 -5
- 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 +152 -205
- 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 -1
- package/dist/components/calendar.js +308 -346
- 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 +85 -127
- 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 +58 -91
- 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 +7 -5
- package/dist/components/dropdown.js +744 -1071
- 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 +83 -113
- 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 +1 -1
- package/dist/components/flyout.js +225 -314
- 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 +325 -429
- 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 +2 -1
- package/dist/components/label.min.css +2 -2
- 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 +40 -40
- 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 +3 -3
- package/dist/components/modal.js +259 -358
- 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 +67 -97
- 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 +190 -264
- 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 +103 -138
- 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 +1 -1
- package/dist/components/search.js +270 -373
- 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 +157 -223
- 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 +125 -165
- 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 +38 -57
- 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 +242 -325
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +68 -98
- 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 +131 -176
- 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 +168 -233
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +8 -8
- 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 -1
- package/dist/components/toast.js +104 -143
- 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 +86 -141
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +145 -223
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +3916 -7722
- package/dist/semantic.js +4324 -5973
- 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 +1 -3
- package/scripts/nightly-version.js +7 -10
- package/src/definitions/behaviors/api.js +151 -204
- package/src/definitions/behaviors/form.js +324 -428
- package/src/definitions/behaviors/state.js +67 -97
- package/src/definitions/behaviors/visibility.js +144 -222
- package/src/definitions/collections/menu.less +101 -96
- package/src/definitions/collections/table.less +7 -7
- package/src/definitions/elements/button.less +0 -1
- package/src/definitions/elements/label.less +1 -0
- package/src/definitions/globals/site.js +37 -56
- package/src/definitions/modules/accordion.js +102 -141
- package/src/definitions/modules/calendar.js +307 -345
- package/src/definitions/modules/checkbox.js +84 -126
- package/src/definitions/modules/dimmer.js +57 -90
- package/src/definitions/modules/dropdown.js +743 -1070
- package/src/definitions/modules/dropdown.less +11 -5
- package/src/definitions/modules/embed.js +82 -112
- package/src/definitions/modules/flyout.js +224 -313
- package/src/definitions/modules/modal.js +258 -357
- package/src/definitions/modules/modal.less +1 -1
- package/src/definitions/modules/nag.js +66 -96
- package/src/definitions/modules/popup.js +189 -263
- package/src/definitions/modules/progress.js +102 -137
- package/src/definitions/modules/rating.js +89 -122
- package/src/definitions/modules/search.js +269 -372
- package/src/definitions/modules/shape.js +156 -222
- package/src/definitions/modules/sidebar.js +124 -164
- package/src/definitions/modules/slider.js +241 -324
- package/src/definitions/modules/sticky.js +130 -175
- package/src/definitions/modules/tab.js +167 -232
- package/src/definitions/modules/toast.js +103 -142
- package/src/definitions/modules/transition.js +85 -140
- package/src/themes/chubby/collections/menu.variables +1 -1
- package/src/themes/default/collections/menu.variables +23 -23
- package/src/themes/default/globals/variation.variables +3 -2
- package/src/themes/default/modules/dropdown.variables +1 -0
- package/src/themes/default/modules/modal.variables +1 -1
- package/tasks/admin/components/create.js +88 -108
- package/tasks/admin/components/init.js +26 -32
- package/tasks/admin/components/update.js +46 -53
- package/tasks/admin/distributions/create.js +71 -101
- package/tasks/admin/distributions/init.js +27 -33
- package/tasks/admin/distributions/update.js +45 -52
- package/tasks/admin/register.js +11 -15
- package/tasks/build/assets.js +14 -18
- package/tasks/build/css.js +54 -63
- package/tasks/build/javascript.js +45 -53
- package/tasks/build.js +4 -6
- package/tasks/check-install.js +5 -7
- package/tasks/clean.js +2 -4
- package/tasks/collections/admin.js +13 -15
- package/tasks/collections/build.js +6 -8
- package/tasks/collections/docs.js +2 -4
- 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 +7 -9
- package/tasks/config/admin/templates/css-package.js +1 -3
- 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 +22 -30
- package/tasks/config/project/install.js +61 -78
- package/tasks/config/project/release.js +6 -8
- package/tasks/config/tasks.js +8 -12
- package/tasks/config/user.js +13 -17
- package/tasks/docs/build.js +26 -31
- package/tasks/docs/metadata.js +24 -30
- package/tasks/docs/serve.js +20 -26
- package/tasks/install.js +81 -109
- package/tasks/rtl/build.js +2 -4
- package/tasks/rtl/watch.js +2 -4
- package/tasks/watch.js +9 -11
- package/test/meteor/fonts.js +1 -2
- package/test/modules/module.spec.js +16 -18
- package/types/fomantic-ui-dropdown.d.ts +44 -0
- package/types/fomantic-ui-embed.d.ts +1 -1
- package/types/fomantic-ui-search.d.ts +6 -6
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.41+1ceee9c - Modal
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -20,82 +20,79 @@
|
|
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
|
-
|
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 initialBodyMarginInt = 0;
|
86
|
+
let tempBodyMargin = 0;
|
87
|
+
let keepScrollingClass = false;
|
88
|
+
let hadScrollbar = false;
|
89
|
+
let windowRefocused = false;
|
90
|
+
|
91
|
+
let elementEventNamespace;
|
92
|
+
let id;
|
93
|
+
let observer;
|
94
|
+
let observeAttributes = false;
|
95
|
+
let module;
|
99
96
|
module = {
|
100
97
|
|
101
98
|
initialize: function () {
|
@@ -111,36 +108,34 @@
|
|
111
108
|
}
|
112
109
|
$module.addClass(settings.class);
|
113
110
|
if (settings.title !== '') {
|
114
|
-
$module.find(selector.title).html(module.helpers.escape(settings.title, settings
|
111
|
+
$module.find(selector.title).html(module.helpers.escape(settings.title, settings)).addClass(settings.classTitle);
|
115
112
|
}
|
116
113
|
if (settings.content !== '') {
|
117
|
-
$module.find(selector.content).html(module.helpers.escape(settings.content, settings
|
114
|
+
$module.find(selector.content).html(module.helpers.escape(settings.content, settings)).addClass(settings.classContent);
|
118
115
|
}
|
119
116
|
if (module.has.configActions()) {
|
120
|
-
|
117
|
+
let $actions = $module.find(selector.actions).addClass(settings.classActions);
|
121
118
|
if ($actions.length === 0) {
|
122
119
|
$actions = $('<div/>', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($module);
|
123
120
|
} else {
|
124
121
|
$actions.empty();
|
125
122
|
}
|
126
123
|
settings.actions.forEach(function (el) {
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
: function () {}
|
136
|
-
;
|
124
|
+
let icon = el[fields.icon]
|
125
|
+
? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.escape(el[fields.icon]) + ' icon"></i>'
|
126
|
+
: '';
|
127
|
+
let text = module.helpers.escape(el[fields.text] || '', settings);
|
128
|
+
let cls = module.helpers.escape(el[fields.class] || '');
|
129
|
+
let click = el[fields.click] && isFunction(el[fields.click])
|
130
|
+
? el[fields.click]
|
131
|
+
: function () {};
|
137
132
|
$actions.append($('<button/>', {
|
138
133
|
html: icon + text,
|
139
134
|
'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g, ''),
|
140
135
|
class: className.button + ' ' + cls,
|
141
136
|
on: {
|
142
137
|
click: function () {
|
143
|
-
|
138
|
+
let button = $(this);
|
144
139
|
if (button.is(selector.approve) || button.is(selector.deny) || click.call(element, $module) === false) {
|
145
140
|
return;
|
146
141
|
}
|
@@ -174,8 +169,7 @@
|
|
174
169
|
module.verbose('Storing instance of modal');
|
175
170
|
instance = module;
|
176
171
|
$module
|
177
|
-
.data(moduleNamespace, instance)
|
178
|
-
;
|
172
|
+
.data(moduleNamespace, instance);
|
179
173
|
},
|
180
174
|
|
181
175
|
create: {
|
@@ -191,12 +185,12 @@
|
|
191
185
|
$module.append($closeIcon);
|
192
186
|
}
|
193
187
|
if (settings.title !== '') {
|
194
|
-
|
188
|
+
let titleId = '_' + module.get.id() + 'title';
|
195
189
|
$module.attr('aria-labelledby', titleId);
|
196
190
|
$('<div/>', { class: className.title, id: titleId }).appendTo($module);
|
197
191
|
}
|
198
192
|
if (settings.content !== '') {
|
199
|
-
|
193
|
+
let descId = '_' + module.get.id() + 'desc';
|
200
194
|
$module.attr('aria-describedby', descId);
|
201
195
|
$('<div/>', { class: className.content, id: descId }).appendTo($module);
|
202
196
|
}
|
@@ -207,13 +201,11 @@
|
|
207
201
|
element = $module[0];
|
208
202
|
},
|
209
203
|
dimmer: function () {
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
|
216
|
-
;
|
204
|
+
let defaultSettings = {
|
205
|
+
debug: settings.debug,
|
206
|
+
dimmerName: 'modals',
|
207
|
+
};
|
208
|
+
let dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
|
217
209
|
if ($.fn.dimmer === undefined) {
|
218
210
|
module.error(error.dimmer);
|
219
211
|
|
@@ -249,8 +241,7 @@
|
|
249
241
|
module.verbose('Destroying previous modal');
|
250
242
|
$module
|
251
243
|
.removeData(moduleNamespace)
|
252
|
-
.off(eventNamespace)
|
253
|
-
;
|
244
|
+
.off(eventNamespace);
|
254
245
|
$window.off(elementEventNamespace);
|
255
246
|
$context.off(elementEventNamespace);
|
256
247
|
$dimmer.off(elementEventNamespace);
|
@@ -262,59 +253,56 @@
|
|
262
253
|
},
|
263
254
|
|
264
255
|
observeChanges: function () {
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
}
|
256
|
+
observer = new MutationObserver(function (mutations) {
|
257
|
+
let collectNodes = function (parent) {
|
258
|
+
let nodes = [];
|
259
|
+
for (let c = 0, cl = parent.length; c < cl; c++) {
|
260
|
+
Array.prototype.push.apply(nodes, collectNodes(parent[c].childNodes));
|
261
|
+
nodes.push(parent[c]);
|
262
|
+
}
|
273
263
|
|
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
|
-
}
|
264
|
+
return nodes;
|
265
|
+
};
|
266
|
+
let shouldRefresh = false;
|
267
|
+
let shouldRefreshInputs = false;
|
268
|
+
let ignoreAutofocus = true;
|
269
|
+
mutations.every(function (mutation) {
|
270
|
+
if (mutation.type === 'attributes') {
|
271
|
+
if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
|
272
|
+
shouldRefreshInputs = true;
|
273
|
+
}
|
274
|
+
} else {
|
275
|
+
shouldRefresh = true;
|
276
|
+
// mutationobserver only provides the parent nodes,
|
277
|
+
// so let's collect all childs as well to find nested inputs
|
278
|
+
let $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible');
|
279
|
+
let $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
|
280
|
+
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
|
281
|
+
shouldRefreshInputs = true;
|
282
|
+
if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
|
283
|
+
ignoreAutofocus = false;
|
296
284
|
}
|
297
285
|
}
|
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
286
|
}
|
287
|
+
|
288
|
+
return !shouldRefreshInputs;
|
309
289
|
});
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
290
|
+
|
291
|
+
if (shouldRefresh && settings.observeChanges) {
|
292
|
+
module.debug('DOM tree modified, refreshing');
|
293
|
+
module.refresh();
|
294
|
+
}
|
295
|
+
if (shouldRefreshInputs) {
|
296
|
+
module.refreshInputs(ignoreAutofocus);
|
297
|
+
}
|
298
|
+
});
|
299
|
+
observer.observe(element, {
|
300
|
+
attributeFilter: ['class', 'disabled'],
|
301
|
+
attributes: true,
|
302
|
+
childList: true,
|
303
|
+
subtree: true,
|
304
|
+
});
|
305
|
+
module.debug('Setting up mutation observer', observer);
|
318
306
|
},
|
319
307
|
|
320
308
|
refresh: function () {
|
@@ -335,8 +323,7 @@
|
|
335
323
|
refreshInputs: function (ignoreAutofocus) {
|
336
324
|
if ($inputs) {
|
337
325
|
$inputs
|
338
|
-
.off('keydown' + elementEventNamespace)
|
339
|
-
;
|
326
|
+
.off('keydown' + elementEventNamespace);
|
340
327
|
}
|
341
328
|
$inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
|
342
329
|
return $(this).closest('.disabled').length === 0;
|
@@ -348,20 +335,16 @@
|
|
348
335
|
$module.removeAttr('tabindex');
|
349
336
|
}
|
350
337
|
$inputs.first()
|
351
|
-
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.first)
|
352
|
-
;
|
338
|
+
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.first);
|
353
339
|
$inputs.last()
|
354
|
-
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
|
355
|
-
;
|
340
|
+
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.last);
|
356
341
|
if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
|
357
342
|
module.set.autofocus();
|
358
343
|
}
|
359
344
|
},
|
360
345
|
|
361
346
|
attachEvents: function (selector, event) {
|
362
|
-
|
363
|
-
$toggle = $(selector)
|
364
|
-
;
|
347
|
+
let $toggle = $(selector);
|
365
348
|
event = isFunction(module[event])
|
366
349
|
? module[event]
|
367
350
|
: module.toggle;
|
@@ -369,8 +352,7 @@
|
|
369
352
|
module.debug('Attaching modal events to element', selector, event);
|
370
353
|
$toggle
|
371
354
|
.off(eventNamespace)
|
372
|
-
.on('click' + eventNamespace, event)
|
373
|
-
;
|
355
|
+
.on('click' + eventNamespace, event);
|
374
356
|
} else {
|
375
357
|
module.error(error.notFound, selector);
|
376
358
|
}
|
@@ -382,18 +364,14 @@
|
|
382
364
|
$module
|
383
365
|
.on('click' + eventNamespace, selector.close, module.event.close)
|
384
366
|
.on('click' + eventNamespace, selector.approve, module.event.approve)
|
385
|
-
.on('click' + eventNamespace, selector.deny, module.event.deny)
|
386
|
-
;
|
367
|
+
.on('click' + eventNamespace, selector.deny, module.event.deny);
|
387
368
|
$closeIcon
|
388
|
-
.on('keyup' + elementEventNamespace, module.event.closeKeyUp)
|
389
|
-
;
|
369
|
+
.on('keyup' + elementEventNamespace, module.event.closeKeyUp);
|
390
370
|
$window
|
391
371
|
.on('resize' + elementEventNamespace, module.event.resize)
|
392
|
-
.on('focus' + elementEventNamespace, module.event.focus)
|
393
|
-
;
|
372
|
+
.on('focus' + elementEventNamespace, module.event.focus);
|
394
373
|
$context
|
395
|
-
.on('click' + elementEventNamespace, module.event.click)
|
396
|
-
;
|
374
|
+
.on('click' + elementEventNamespace, module.event.click);
|
397
375
|
},
|
398
376
|
scrollLock: function () {
|
399
377
|
// touch events default to passive, due to changes in chrome to optimize mobile perf
|
@@ -451,27 +429,21 @@
|
|
451
429
|
module.hide();
|
452
430
|
},
|
453
431
|
closeKeyUp: function (event) {
|
454
|
-
|
455
|
-
keyCode = event.which
|
456
|
-
;
|
432
|
+
let keyCode = event.which;
|
457
433
|
if ((keyCode === settings.keys.enter || keyCode === settings.keys.space) && $module.hasClass(className.front)) {
|
458
434
|
module.hide();
|
459
435
|
}
|
460
436
|
},
|
461
437
|
inputKeyDown: {
|
462
438
|
first: function (event) {
|
463
|
-
|
464
|
-
keyCode = event.which
|
465
|
-
;
|
439
|
+
let keyCode = event.which;
|
466
440
|
if (keyCode === settings.keys.tab && event.shiftKey) {
|
467
441
|
$inputs.last().trigger('focus');
|
468
442
|
event.preventDefault();
|
469
443
|
}
|
470
444
|
},
|
471
445
|
last: function (event) {
|
472
|
-
|
473
|
-
keyCode = event.which
|
474
|
-
;
|
446
|
+
let keyCode = event.which;
|
475
447
|
if (keyCode === settings.keys.tab && !event.shiftKey) {
|
476
448
|
$inputs.first().trigger('focus');
|
477
449
|
event.preventDefault();
|
@@ -479,10 +451,8 @@
|
|
479
451
|
},
|
480
452
|
},
|
481
453
|
mousedown: function (event) {
|
482
|
-
|
483
|
-
|
484
|
-
isRtl = module.is.rtl()
|
485
|
-
;
|
454
|
+
let $target = $(event.target);
|
455
|
+
let isRtl = module.is.rtl();
|
486
456
|
initialMouseDownInModal = $target.closest(selector.modal).length > 0;
|
487
457
|
if (initialMouseDownInModal) {
|
488
458
|
module.verbose('Mouse down event registered inside the modal');
|
@@ -508,11 +478,9 @@
|
|
508
478
|
|
509
479
|
return;
|
510
480
|
}
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
isInDOM = $.contains(document.documentElement, event.target)
|
515
|
-
;
|
481
|
+
let $target = $(event.target);
|
482
|
+
let isInModal = $target.closest(selector.modal).length > 0;
|
483
|
+
let isInDOM = $.contains(document.documentElement, event.target);
|
516
484
|
if (!isInModal && isInDOM && module.is.active() && $module.hasClass(className.front)) {
|
517
485
|
module.debug('Dimmer clicked, hiding all modals');
|
518
486
|
if (settings.allowMultiple) {
|
@@ -532,9 +500,7 @@
|
|
532
500
|
}, delay);
|
533
501
|
},
|
534
502
|
keyboard: function (event) {
|
535
|
-
|
536
|
-
keyCode = event.which
|
537
|
-
;
|
503
|
+
let keyCode = event.which;
|
538
504
|
if (keyCode === settings.keys.escape) {
|
539
505
|
if (settings.closable) {
|
540
506
|
module.debug('Escape key pressed hiding modal');
|
@@ -654,8 +620,7 @@
|
|
654
620
|
requestAnimationFrame(module.set.observeAttributes);
|
655
621
|
callback();
|
656
622
|
},
|
657
|
-
})
|
658
|
-
;
|
623
|
+
});
|
659
624
|
} else {
|
660
625
|
module.error(error.noTransition);
|
661
626
|
}
|
@@ -666,9 +631,7 @@
|
|
666
631
|
},
|
667
632
|
|
668
633
|
hideModal: function (callback, keepDimmed, hideOthersToo) {
|
669
|
-
|
670
|
-
$previousModal = $otherModals.filter('.' + className.active).last()
|
671
|
-
;
|
634
|
+
let $previousModal = $otherModals.filter('.' + className.active).last();
|
672
635
|
callback = isFunction(callback)
|
673
636
|
? callback
|
674
637
|
: function () {};
|
@@ -719,8 +682,7 @@
|
|
719
682
|
module.restore.focus();
|
720
683
|
callback();
|
721
684
|
},
|
722
|
-
})
|
723
|
-
;
|
685
|
+
});
|
724
686
|
} else {
|
725
687
|
module.error(error.noTransition);
|
726
688
|
}
|
@@ -758,15 +720,13 @@
|
|
758
720
|
},
|
759
721
|
|
760
722
|
hideAll: function (callback) {
|
761
|
-
|
762
|
-
$visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating)
|
763
|
-
;
|
723
|
+
let $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating);
|
764
724
|
callback = isFunction(callback)
|
765
725
|
? callback
|
766
726
|
: function () {};
|
767
727
|
if ($visibleModals.length > 0) {
|
768
728
|
module.debug('Hiding all visible modals');
|
769
|
-
|
729
|
+
let hideOk = true;
|
770
730
|
// check in reverse order trying to hide most top displayed modal first
|
771
731
|
$($visibleModals.get().reverse()).each(function (index, element) {
|
772
732
|
if (hideOk) {
|
@@ -782,17 +742,14 @@
|
|
782
742
|
},
|
783
743
|
|
784
744
|
hideOthers: function (callback) {
|
785
|
-
|
786
|
-
$visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating)
|
787
|
-
;
|
745
|
+
let $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating);
|
788
746
|
callback = isFunction(callback)
|
789
747
|
? callback
|
790
748
|
: function () {};
|
791
749
|
if ($visibleModals.length > 0) {
|
792
750
|
module.debug('Hiding other modals', $otherModals);
|
793
751
|
$visibleModals
|
794
|
-
.modal('hide modal', callback, true)
|
795
|
-
;
|
752
|
+
.modal('hide modal', callback, true);
|
796
753
|
}
|
797
754
|
},
|
798
755
|
|
@@ -809,28 +766,23 @@
|
|
809
766
|
keyboardShortcuts: function () {
|
810
767
|
module.verbose('Adding keyboard shortcuts');
|
811
768
|
$document
|
812
|
-
.on('keydown' + eventNamespace, module.event.keyboard)
|
813
|
-
;
|
769
|
+
.on('keydown' + eventNamespace, module.event.keyboard);
|
814
770
|
},
|
815
771
|
},
|
816
772
|
|
817
773
|
save: {
|
818
774
|
focus: function () {
|
819
|
-
|
820
|
-
|
821
|
-
inCurrentModal = $activeElement.closest($module).length > 0
|
822
|
-
;
|
775
|
+
let $activeElement = $(document.activeElement);
|
776
|
+
let inCurrentModal = $activeElement.closest($module).length > 0;
|
823
777
|
if (!inCurrentModal) {
|
824
778
|
$focusedElement = $(document.activeElement).trigger('blur');
|
825
779
|
}
|
826
780
|
},
|
827
781
|
bodyMargin: function () {
|
828
782
|
initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
;
|
833
|
-
tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
|
783
|
+
initialBodyMarginInt = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10);
|
784
|
+
let bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
|
785
|
+
tempBodyMargin = initialBodyMarginInt + bodyScrollbarWidth;
|
834
786
|
},
|
835
787
|
},
|
836
788
|
|
@@ -841,13 +793,11 @@
|
|
841
793
|
}
|
842
794
|
},
|
843
795
|
bodyMargin: function () {
|
844
|
-
|
845
|
-
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
|
796
|
+
let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
797
|
+
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMarginInt === 0 ? '' : initialBodyMargin);
|
846
798
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
847
|
-
|
848
|
-
|
849
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
850
|
-
;
|
799
|
+
let el = $(this);
|
800
|
+
let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
851
801
|
el.css(attribute, '');
|
852
802
|
});
|
853
803
|
},
|
@@ -863,15 +813,12 @@
|
|
863
813
|
clickaway: function () {
|
864
814
|
if (!settings.detachable) {
|
865
815
|
$module
|
866
|
-
.off('mousedown' + elementEventNamespace)
|
867
|
-
;
|
816
|
+
.off('mousedown' + elementEventNamespace);
|
868
817
|
}
|
869
818
|
$dimmer
|
870
|
-
.off('mousedown' + elementEventNamespace)
|
871
|
-
;
|
819
|
+
.off('mousedown' + elementEventNamespace);
|
872
820
|
$dimmer
|
873
|
-
.off('mouseup' + elementEventNamespace)
|
874
|
-
;
|
821
|
+
.off('mouseup' + elementEventNamespace);
|
875
822
|
},
|
876
823
|
dimmerStyles: function () {
|
877
824
|
$dimmer.removeClass(className.inverted);
|
@@ -886,15 +833,13 @@
|
|
886
833
|
screenHeight: function () {
|
887
834
|
module.debug('Removing page height');
|
888
835
|
$context
|
889
|
-
.css('height', '')
|
890
|
-
;
|
836
|
+
.css('height', '');
|
891
837
|
module.remove.bodyStyle();
|
892
838
|
},
|
893
839
|
keyboardShortcuts: function () {
|
894
840
|
module.verbose('Removing keyboard shortcuts');
|
895
841
|
$document
|
896
|
-
.off('keydown' + eventNamespace)
|
897
|
-
;
|
842
|
+
.off('keydown' + eventNamespace);
|
898
843
|
},
|
899
844
|
scrolling: function () {
|
900
845
|
if (!keepScrollingClass) {
|
@@ -906,11 +851,9 @@
|
|
906
851
|
|
907
852
|
cacheSizes: function () {
|
908
853
|
$module.addClass(className.loading);
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
modalHeight = $module.outerHeight()
|
913
|
-
;
|
854
|
+
let scrollHeight = $module.prop('scrollHeight');
|
855
|
+
let modalWidth = $module.outerWidth();
|
856
|
+
let modalHeight = $module.outerHeight();
|
914
857
|
if (module.cache.pageHeight === undefined || modalHeight !== 0) {
|
915
858
|
$.extend(module.cache, {
|
916
859
|
pageHeight: $document.outerHeight(),
|
@@ -927,34 +870,20 @@
|
|
927
870
|
module.debug('Caching modal and container sizes', module.cache);
|
928
871
|
},
|
929
872
|
helpers: {
|
930
|
-
|
931
|
-
|
932
|
-
},
|
933
|
-
escape: function (string, preserveHTML) {
|
934
|
-
if (preserveHTML) {
|
873
|
+
escape: function (string, settings) {
|
874
|
+
if (settings !== undefined && settings.preserveHTML) {
|
935
875
|
return string;
|
936
876
|
}
|
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
877
|
|
954
|
-
|
955
|
-
|
878
|
+
const escapeMap = {
|
879
|
+
'"': '"',
|
880
|
+
'&': '&',
|
881
|
+
"'": ''',
|
882
|
+
'<': '<',
|
883
|
+
'>': '>',
|
884
|
+
};
|
956
885
|
|
957
|
-
return string;
|
886
|
+
return String(string).replace(/["&'<>]/g, (chr) => escapeMap[chr]);
|
958
887
|
},
|
959
888
|
},
|
960
889
|
can: {
|
@@ -976,15 +905,13 @@
|
|
976
905
|
return settings.useFlex;
|
977
906
|
},
|
978
907
|
fit: function () {
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
startPosition = verticalCenter + topOffset
|
987
|
-
;
|
908
|
+
let contextHeight = module.cache.contextHeight;
|
909
|
+
let verticalCenter = module.cache.contextHeight / 2;
|
910
|
+
let topOffset = module.cache.topOffset;
|
911
|
+
let scrollHeight = module.cache.scrollHeight;
|
912
|
+
let height = module.cache.height;
|
913
|
+
let paddingHeight = settings.padding;
|
914
|
+
let startPosition = verticalCenter + topOffset;
|
988
915
|
|
989
916
|
return scrollHeight > height
|
990
917
|
? startPosition + scrollHeight + paddingHeight < contextHeight
|
@@ -1040,43 +967,36 @@
|
|
1040
967
|
observeAttributes = state !== false;
|
1041
968
|
},
|
1042
969
|
autofocus: function () {
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
).first()
|
1052
|
-
;
|
970
|
+
let $autofocus = $inputs.filter('[autofocus]');
|
971
|
+
let $rawInputs = $inputs.filter(':input');
|
972
|
+
let $input = ($autofocus.length > 0
|
973
|
+
? $autofocus
|
974
|
+
: ($rawInputs.length > 0
|
975
|
+
? $rawInputs
|
976
|
+
: $module)
|
977
|
+
).first();
|
1053
978
|
$input.trigger('focus');
|
1054
979
|
},
|
1055
980
|
bodyMargin: function () {
|
1056
|
-
|
981
|
+
let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
1057
982
|
if (settings.detachable || module.can.fit()) {
|
1058
983
|
$context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
|
1059
984
|
}
|
1060
985
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
1061
|
-
|
1062
|
-
|
1063
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
1064
|
-
;
|
986
|
+
let el = $(this);
|
987
|
+
let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
1065
988
|
el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
|
1066
989
|
});
|
1067
990
|
},
|
1068
991
|
clickaway: function () {
|
1069
992
|
if (!settings.detachable) {
|
1070
993
|
$module
|
1071
|
-
.on('mousedown' + elementEventNamespace, module.event.mousedown)
|
1072
|
-
;
|
994
|
+
.on('mousedown' + elementEventNamespace, module.event.mousedown);
|
1073
995
|
}
|
1074
996
|
$dimmer
|
1075
|
-
.on('mousedown' + elementEventNamespace, module.event.mousedown)
|
1076
|
-
;
|
997
|
+
.on('mousedown' + elementEventNamespace, module.event.mousedown);
|
1077
998
|
$dimmer
|
1078
|
-
.on('mouseup' + elementEventNamespace, module.event.mouseup)
|
1079
|
-
;
|
999
|
+
.on('mouseup' + elementEventNamespace, module.event.mouseup);
|
1080
1000
|
},
|
1081
1001
|
dimmerSettings: function () {
|
1082
1002
|
if ($.fn.dimmer === undefined) {
|
@@ -1084,19 +1004,17 @@
|
|
1084
1004
|
|
1085
1005
|
return;
|
1086
1006
|
}
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
hide: settings.transition.hideDuration || settings.duration,
|
1096
|
-
},
|
1007
|
+
let defaultSettings = {
|
1008
|
+
debug: settings.debug,
|
1009
|
+
dimmerName: 'modals',
|
1010
|
+
closable: 'auto',
|
1011
|
+
useFlex: module.can.useFlex(),
|
1012
|
+
duration: {
|
1013
|
+
show: settings.transition.showDuration || settings.duration,
|
1014
|
+
hide: settings.transition.hideDuration || settings.duration,
|
1097
1015
|
},
|
1098
|
-
|
1099
|
-
;
|
1016
|
+
};
|
1017
|
+
let dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
|
1100
1018
|
if (settings.inverted) {
|
1101
1019
|
dimmerSettings.variation = dimmerSettings.variation !== undefined
|
1102
1020
|
? dimmerSettings.variation + ' inverted'
|
@@ -1118,7 +1036,7 @@
|
|
1118
1036
|
},
|
1119
1037
|
modalOffset: function () {
|
1120
1038
|
if (!settings.detachable) {
|
1121
|
-
|
1039
|
+
let canFit = module.can.fit();
|
1122
1040
|
$module
|
1123
1041
|
.css({
|
1124
1042
|
top: !$module.hasClass('aligned') && canFit
|
@@ -1127,8 +1045,7 @@
|
|
1127
1045
|
? $document.scrollTop() + settings.padding
|
1128
1046
|
: $document.scrollTop() + (module.cache.contextHeight - module.cache.height - settings.padding)),
|
1129
1047
|
marginLeft: -(module.cache.width / 2),
|
1130
|
-
})
|
1131
|
-
;
|
1048
|
+
});
|
1132
1049
|
} else {
|
1133
1050
|
$module
|
1134
1051
|
.css({
|
@@ -1136,8 +1053,7 @@
|
|
1136
1053
|
? -(module.cache.height / 2)
|
1137
1054
|
: settings.padding / 2,
|
1138
1055
|
marginLeft: -(module.cache.width / 2),
|
1139
|
-
})
|
1140
|
-
;
|
1056
|
+
});
|
1141
1057
|
}
|
1142
1058
|
module.verbose('Setting modal offset for legacy mode');
|
1143
1059
|
},
|
@@ -1147,8 +1063,7 @@
|
|
1147
1063
|
} else if (!$module.hasClass('bottom')) {
|
1148
1064
|
module.debug('Modal is taller than page content, resizing page height');
|
1149
1065
|
$context
|
1150
|
-
.css('height', module.cache.height + (settings.padding * 2) + 'px')
|
1151
|
-
;
|
1066
|
+
.css('height', module.cache.height + (settings.padding * 2) + 'px');
|
1152
1067
|
}
|
1153
1068
|
},
|
1154
1069
|
active: function () {
|
@@ -1233,11 +1148,9 @@
|
|
1233
1148
|
},
|
1234
1149
|
performance: {
|
1235
1150
|
log: function (message) {
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
previousTime
|
1240
|
-
;
|
1151
|
+
let currentTime;
|
1152
|
+
let executionTime;
|
1153
|
+
let previousTime;
|
1241
1154
|
if (settings.performance) {
|
1242
1155
|
currentTime = Date.now();
|
1243
1156
|
previousTime = time || currentTime;
|
@@ -1256,10 +1169,8 @@
|
|
1256
1169
|
}, 500);
|
1257
1170
|
},
|
1258
1171
|
display: function () {
|
1259
|
-
|
1260
|
-
|
1261
|
-
totalTime = 0
|
1262
|
-
;
|
1172
|
+
let title = settings.name + ':';
|
1173
|
+
let totalTime = 0;
|
1263
1174
|
time = false;
|
1264
1175
|
clearTimeout(module.performance.timer);
|
1265
1176
|
$.each(performance, function (index, data) {
|
@@ -1281,19 +1192,17 @@
|
|
1281
1192
|
},
|
1282
1193
|
},
|
1283
1194
|
invoke: function (query, passedArguments, context) {
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
response
|
1289
|
-
;
|
1195
|
+
let object = instance;
|
1196
|
+
let maxDepth;
|
1197
|
+
let found;
|
1198
|
+
let response;
|
1290
1199
|
passedArguments = passedArguments || queryArguments;
|
1291
1200
|
context = context || element;
|
1292
1201
|
if (typeof query === 'string' && object !== undefined) {
|
1293
1202
|
query = query.split(/[ .]/);
|
1294
1203
|
maxDepth = query.length - 1;
|
1295
1204
|
$.each(query, function (depth, value) {
|
1296
|
-
|
1205
|
+
let camelCaseValue = depth !== maxDepth
|
1297
1206
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
1298
1207
|
: query;
|
1299
1208
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
@@ -1508,7 +1417,7 @@
|
|
1508
1417
|
|
1509
1418
|
$.fn.modal.settings.templates = {
|
1510
1419
|
getArguments: function (args) {
|
1511
|
-
|
1420
|
+
let queryArguments = [].slice.call(args);
|
1512
1421
|
if ($.isPlainObject(queryArguments[0])) {
|
1513
1422
|
return $.extend({
|
1514
1423
|
handler: function () {},
|
@@ -1527,11 +1436,9 @@
|
|
1527
1436
|
};
|
1528
1437
|
},
|
1529
1438
|
alert: function () {
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
approveFn = args.handler
|
1534
|
-
;
|
1439
|
+
let settings = this.get.settings();
|
1440
|
+
let args = settings.templates.getArguments(arguments);
|
1441
|
+
let approveFn = args.handler;
|
1535
1442
|
|
1536
1443
|
return {
|
1537
1444
|
title: args.title,
|
@@ -1545,16 +1452,14 @@
|
|
1545
1452
|
};
|
1546
1453
|
},
|
1547
1454
|
confirm: function () {
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
}
|
1557
|
-
;
|
1455
|
+
let settings = this.get.settings();
|
1456
|
+
let args = settings.templates.getArguments(arguments);
|
1457
|
+
let approveFn = function () {
|
1458
|
+
args.handler(true);
|
1459
|
+
};
|
1460
|
+
let denyFn = function () {
|
1461
|
+
args.handler(false);
|
1462
|
+
};
|
1558
1463
|
|
1559
1464
|
return {
|
1560
1465
|
title: args.title,
|
@@ -1573,24 +1478,20 @@
|
|
1573
1478
|
};
|
1574
1479
|
},
|
1575
1480
|
prompt: function () {
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
denyFn = function () {
|
1589
|
-
args.handler(null);
|
1590
|
-
}
|
1591
|
-
;
|
1481
|
+
let $this = this;
|
1482
|
+
let settings = this.get.settings();
|
1483
|
+
let args = settings.templates.getArguments(arguments);
|
1484
|
+
let input = $($.parseHTML(args.content)).filter('.ui.input');
|
1485
|
+
let approveFn = function () {
|
1486
|
+
let settings = $this.get.settings();
|
1487
|
+
let inputField = $this.get.element().find(settings.selector.prompt)[0];
|
1488
|
+
args.handler($(inputField).val());
|
1489
|
+
};
|
1490
|
+
let denyFn = function () {
|
1491
|
+
args.handler(null);
|
1492
|
+
};
|
1592
1493
|
if (input.length === 0) {
|
1593
|
-
args.content += '<p><div class="' + this.helpers.
|
1494
|
+
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>';
|
1594
1495
|
}
|
1595
1496
|
|
1596
1497
|
return {
|