fomantic-ui 2.10.0-beta.6 → 2.10.0-beta.8
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/README.md +4 -5
- package/changelog-setup.js +64 -70
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +94 -131
- 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 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +305 -341
- 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 +76 -116
- 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 +1 -1
- package/dist/components/dropdown.js +674 -977
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +80 -127
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +192 -274
- 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 +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -1
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +221 -313
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +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 +185 -254
- 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 +89 -139
- 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 +253 -352
- 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 +122 -163
- 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 +116 -159
- 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 +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +99 -132
- 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 +134 -210
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +4100 -5721
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/examples/assets/show-examples.js +2 -4
- package/gulpfile.js +5 -7
- package/package.json +1 -1
- 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 +133 -209
- package/src/definitions/globals/site.js +37 -56
- package/src/definitions/modules/accordion.js +93 -130
- package/src/definitions/modules/calendar.js +304 -340
- package/src/definitions/modules/checkbox.js +75 -115
- package/src/definitions/modules/dimmer.js +57 -90
- package/src/definitions/modules/dropdown.js +673 -976
- package/src/definitions/modules/embed.js +79 -126
- package/src/definitions/modules/flyout.js +191 -273
- package/src/definitions/modules/modal.js +220 -312
- package/src/definitions/modules/nag.js +66 -96
- package/src/definitions/modules/popup.js +184 -253
- package/src/definitions/modules/progress.js +102 -137
- package/src/definitions/modules/rating.js +88 -138
- package/src/definitions/modules/search.js +252 -351
- package/src/definitions/modules/shape.js +156 -222
- package/src/definitions/modules/sidebar.js +121 -162
- package/src/definitions/modules/slider.js +241 -324
- package/src/definitions/modules/sticky.js +115 -158
- package/src/definitions/modules/tab.js +167 -232
- package/src/definitions/modules/toast.js +98 -131
- package/src/definitions/modules/transition.js +85 -140
- 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/npm/gulpfile.js +4 -6
- package/tasks/config/project/config.js +22 -30
- package/tasks/config/project/install.js +56 -70
- 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 +71 -98
- 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/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.8+62e258f - Modal
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -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 () {
|
@@ -117,30 +113,28 @@
|
|
117
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);
|
@@ -264,19 +254,18 @@
|
|
264
254
|
observeChanges: function () {
|
265
255
|
if ('MutationObserver' in window) {
|
266
256
|
observer = new MutationObserver(function (mutations) {
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
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
|
-
;
|
264
|
+
return nodes;
|
265
|
+
};
|
266
|
+
let shouldRefresh = false;
|
267
|
+
let shouldRefreshInputs = false;
|
268
|
+
let ignoreAutofocus = true;
|
280
269
|
mutations.every(function (mutation) {
|
281
270
|
if (mutation.type === 'attributes') {
|
282
271
|
if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
|
@@ -286,8 +275,8 @@
|
|
286
275
|
shouldRefresh = true;
|
287
276
|
// mutationobserver only provides the parent nodes,
|
288
277
|
// so let's collect all childs as well to find nested inputs
|
289
|
-
|
290
|
-
|
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');
|
291
280
|
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
|
292
281
|
shouldRefreshInputs = true;
|
293
282
|
if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
|
@@ -335,8 +324,7 @@
|
|
335
324
|
refreshInputs: function (ignoreAutofocus) {
|
336
325
|
if ($inputs) {
|
337
326
|
$inputs
|
338
|
-
.off('keydown' + elementEventNamespace)
|
339
|
-
;
|
327
|
+
.off('keydown' + elementEventNamespace);
|
340
328
|
}
|
341
329
|
$inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
|
342
330
|
return $(this).closest('.disabled').length === 0;
|
@@ -348,20 +336,16 @@
|
|
348
336
|
$module.removeAttr('tabindex');
|
349
337
|
}
|
350
338
|
$inputs.first()
|
351
|
-
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.first)
|
352
|
-
;
|
339
|
+
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.first);
|
353
340
|
$inputs.last()
|
354
|
-
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
|
355
|
-
;
|
341
|
+
.on('keydown' + elementEventNamespace, module.event.inputKeyDown.last);
|
356
342
|
if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
|
357
343
|
module.set.autofocus();
|
358
344
|
}
|
359
345
|
},
|
360
346
|
|
361
347
|
attachEvents: function (selector, event) {
|
362
|
-
|
363
|
-
$toggle = $(selector)
|
364
|
-
;
|
348
|
+
let $toggle = $(selector);
|
365
349
|
event = isFunction(module[event])
|
366
350
|
? module[event]
|
367
351
|
: module.toggle;
|
@@ -369,8 +353,7 @@
|
|
369
353
|
module.debug('Attaching modal events to element', selector, event);
|
370
354
|
$toggle
|
371
355
|
.off(eventNamespace)
|
372
|
-
.on('click' + eventNamespace, event)
|
373
|
-
;
|
356
|
+
.on('click' + eventNamespace, event);
|
374
357
|
} else {
|
375
358
|
module.error(error.notFound, selector);
|
376
359
|
}
|
@@ -382,18 +365,14 @@
|
|
382
365
|
$module
|
383
366
|
.on('click' + eventNamespace, selector.close, module.event.close)
|
384
367
|
.on('click' + eventNamespace, selector.approve, module.event.approve)
|
385
|
-
.on('click' + eventNamespace, selector.deny, module.event.deny)
|
386
|
-
;
|
368
|
+
.on('click' + eventNamespace, selector.deny, module.event.deny);
|
387
369
|
$closeIcon
|
388
|
-
.on('keyup' + elementEventNamespace, module.event.closeKeyUp)
|
389
|
-
;
|
370
|
+
.on('keyup' + elementEventNamespace, module.event.closeKeyUp);
|
390
371
|
$window
|
391
372
|
.on('resize' + elementEventNamespace, module.event.resize)
|
392
|
-
.on('focus' + elementEventNamespace, module.event.focus)
|
393
|
-
;
|
373
|
+
.on('focus' + elementEventNamespace, module.event.focus);
|
394
374
|
$context
|
395
|
-
.on('click' + elementEventNamespace, module.event.click)
|
396
|
-
;
|
375
|
+
.on('click' + elementEventNamespace, module.event.click);
|
397
376
|
},
|
398
377
|
scrollLock: function () {
|
399
378
|
// touch events default to passive, due to changes in chrome to optimize mobile perf
|
@@ -451,27 +430,21 @@
|
|
451
430
|
module.hide();
|
452
431
|
},
|
453
432
|
closeKeyUp: function (event) {
|
454
|
-
|
455
|
-
keyCode = event.which
|
456
|
-
;
|
433
|
+
let keyCode = event.which;
|
457
434
|
if ((keyCode === settings.keys.enter || keyCode === settings.keys.space) && $module.hasClass(className.front)) {
|
458
435
|
module.hide();
|
459
436
|
}
|
460
437
|
},
|
461
438
|
inputKeyDown: {
|
462
439
|
first: function (event) {
|
463
|
-
|
464
|
-
keyCode = event.which
|
465
|
-
;
|
440
|
+
let keyCode = event.which;
|
466
441
|
if (keyCode === settings.keys.tab && event.shiftKey) {
|
467
442
|
$inputs.last().trigger('focus');
|
468
443
|
event.preventDefault();
|
469
444
|
}
|
470
445
|
},
|
471
446
|
last: function (event) {
|
472
|
-
|
473
|
-
keyCode = event.which
|
474
|
-
;
|
447
|
+
let keyCode = event.which;
|
475
448
|
if (keyCode === settings.keys.tab && !event.shiftKey) {
|
476
449
|
$inputs.first().trigger('focus');
|
477
450
|
event.preventDefault();
|
@@ -479,10 +452,8 @@
|
|
479
452
|
},
|
480
453
|
},
|
481
454
|
mousedown: function (event) {
|
482
|
-
|
483
|
-
|
484
|
-
isRtl = module.is.rtl()
|
485
|
-
;
|
455
|
+
let $target = $(event.target);
|
456
|
+
let isRtl = module.is.rtl();
|
486
457
|
initialMouseDownInModal = $target.closest(selector.modal).length > 0;
|
487
458
|
if (initialMouseDownInModal) {
|
488
459
|
module.verbose('Mouse down event registered inside the modal');
|
@@ -508,11 +479,9 @@
|
|
508
479
|
|
509
480
|
return;
|
510
481
|
}
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
isInDOM = $.contains(document.documentElement, event.target)
|
515
|
-
;
|
482
|
+
let $target = $(event.target);
|
483
|
+
let isInModal = $target.closest(selector.modal).length > 0;
|
484
|
+
let isInDOM = $.contains(document.documentElement, event.target);
|
516
485
|
if (!isInModal && isInDOM && module.is.active() && $module.hasClass(className.front)) {
|
517
486
|
module.debug('Dimmer clicked, hiding all modals');
|
518
487
|
if (settings.allowMultiple) {
|
@@ -532,9 +501,7 @@
|
|
532
501
|
}, delay);
|
533
502
|
},
|
534
503
|
keyboard: function (event) {
|
535
|
-
|
536
|
-
keyCode = event.which
|
537
|
-
;
|
504
|
+
let keyCode = event.which;
|
538
505
|
if (keyCode === settings.keys.escape) {
|
539
506
|
if (settings.closable) {
|
540
507
|
module.debug('Escape key pressed hiding modal');
|
@@ -654,8 +621,7 @@
|
|
654
621
|
requestAnimationFrame(module.set.observeAttributes);
|
655
622
|
callback();
|
656
623
|
},
|
657
|
-
})
|
658
|
-
;
|
624
|
+
});
|
659
625
|
} else {
|
660
626
|
module.error(error.noTransition);
|
661
627
|
}
|
@@ -666,9 +632,7 @@
|
|
666
632
|
},
|
667
633
|
|
668
634
|
hideModal: function (callback, keepDimmed, hideOthersToo) {
|
669
|
-
|
670
|
-
$previousModal = $otherModals.filter('.' + className.active).last()
|
671
|
-
;
|
635
|
+
let $previousModal = $otherModals.filter('.' + className.active).last();
|
672
636
|
callback = isFunction(callback)
|
673
637
|
? callback
|
674
638
|
: function () {};
|
@@ -719,8 +683,7 @@
|
|
719
683
|
module.restore.focus();
|
720
684
|
callback();
|
721
685
|
},
|
722
|
-
})
|
723
|
-
;
|
686
|
+
});
|
724
687
|
} else {
|
725
688
|
module.error(error.noTransition);
|
726
689
|
}
|
@@ -758,15 +721,13 @@
|
|
758
721
|
},
|
759
722
|
|
760
723
|
hideAll: function (callback) {
|
761
|
-
|
762
|
-
$visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating)
|
763
|
-
;
|
724
|
+
let $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating);
|
764
725
|
callback = isFunction(callback)
|
765
726
|
? callback
|
766
727
|
: function () {};
|
767
728
|
if ($visibleModals.length > 0) {
|
768
729
|
module.debug('Hiding all visible modals');
|
769
|
-
|
730
|
+
let hideOk = true;
|
770
731
|
// check in reverse order trying to hide most top displayed modal first
|
771
732
|
$($visibleModals.get().reverse()).each(function (index, element) {
|
772
733
|
if (hideOk) {
|
@@ -782,17 +743,14 @@
|
|
782
743
|
},
|
783
744
|
|
784
745
|
hideOthers: function (callback) {
|
785
|
-
|
786
|
-
$visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating)
|
787
|
-
;
|
746
|
+
let $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating);
|
788
747
|
callback = isFunction(callback)
|
789
748
|
? callback
|
790
749
|
: function () {};
|
791
750
|
if ($visibleModals.length > 0) {
|
792
751
|
module.debug('Hiding other modals', $otherModals);
|
793
752
|
$visibleModals
|
794
|
-
.modal('hide modal', callback, true)
|
795
|
-
;
|
753
|
+
.modal('hide modal', callback, true);
|
796
754
|
}
|
797
755
|
},
|
798
756
|
|
@@ -809,27 +767,22 @@
|
|
809
767
|
keyboardShortcuts: function () {
|
810
768
|
module.verbose('Adding keyboard shortcuts');
|
811
769
|
$document
|
812
|
-
.on('keydown' + eventNamespace, module.event.keyboard)
|
813
|
-
;
|
770
|
+
.on('keydown' + eventNamespace, module.event.keyboard);
|
814
771
|
},
|
815
772
|
},
|
816
773
|
|
817
774
|
save: {
|
818
775
|
focus: function () {
|
819
|
-
|
820
|
-
|
821
|
-
inCurrentModal = $activeElement.closest($module).length > 0
|
822
|
-
;
|
776
|
+
let $activeElement = $(document.activeElement);
|
777
|
+
let inCurrentModal = $activeElement.closest($module).length > 0;
|
823
778
|
if (!inCurrentModal) {
|
824
779
|
$focusedElement = $(document.activeElement).trigger('blur');
|
825
780
|
}
|
826
781
|
},
|
827
782
|
bodyMargin: function () {
|
828
783
|
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
|
-
;
|
784
|
+
let bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10);
|
785
|
+
let bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
|
833
786
|
tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
|
834
787
|
},
|
835
788
|
},
|
@@ -841,13 +794,11 @@
|
|
841
794
|
}
|
842
795
|
},
|
843
796
|
bodyMargin: function () {
|
844
|
-
|
797
|
+
let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
845
798
|
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
|
846
799
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
847
|
-
|
848
|
-
|
849
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
850
|
-
;
|
800
|
+
let el = $(this);
|
801
|
+
let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
851
802
|
el.css(attribute, '');
|
852
803
|
});
|
853
804
|
},
|
@@ -863,15 +814,12 @@
|
|
863
814
|
clickaway: function () {
|
864
815
|
if (!settings.detachable) {
|
865
816
|
$module
|
866
|
-
.off('mousedown' + elementEventNamespace)
|
867
|
-
;
|
817
|
+
.off('mousedown' + elementEventNamespace);
|
868
818
|
}
|
869
819
|
$dimmer
|
870
|
-
.off('mousedown' + elementEventNamespace)
|
871
|
-
;
|
820
|
+
.off('mousedown' + elementEventNamespace);
|
872
821
|
$dimmer
|
873
|
-
.off('mouseup' + elementEventNamespace)
|
874
|
-
;
|
822
|
+
.off('mouseup' + elementEventNamespace);
|
875
823
|
},
|
876
824
|
dimmerStyles: function () {
|
877
825
|
$dimmer.removeClass(className.inverted);
|
@@ -886,15 +834,13 @@
|
|
886
834
|
screenHeight: function () {
|
887
835
|
module.debug('Removing page height');
|
888
836
|
$context
|
889
|
-
.css('height', '')
|
890
|
-
;
|
837
|
+
.css('height', '');
|
891
838
|
module.remove.bodyStyle();
|
892
839
|
},
|
893
840
|
keyboardShortcuts: function () {
|
894
841
|
module.verbose('Removing keyboard shortcuts');
|
895
842
|
$document
|
896
|
-
.off('keydown' + eventNamespace)
|
897
|
-
;
|
843
|
+
.off('keydown' + eventNamespace);
|
898
844
|
},
|
899
845
|
scrolling: function () {
|
900
846
|
if (!keepScrollingClass) {
|
@@ -906,11 +852,9 @@
|
|
906
852
|
|
907
853
|
cacheSizes: function () {
|
908
854
|
$module.addClass(className.loading);
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
modalHeight = $module.outerHeight()
|
913
|
-
;
|
855
|
+
let scrollHeight = $module.prop('scrollHeight');
|
856
|
+
let modalWidth = $module.outerWidth();
|
857
|
+
let modalHeight = $module.outerHeight();
|
914
858
|
if (module.cache.pageHeight === undefined || modalHeight !== 0) {
|
915
859
|
$.extend(module.cache, {
|
916
860
|
pageHeight: $document.outerHeight(),
|
@@ -931,25 +875,17 @@
|
|
931
875
|
if (settings !== undefined && settings.preserveHTML) {
|
932
876
|
return string;
|
933
877
|
}
|
934
|
-
var
|
935
|
-
badChars = /["'<>]/g,
|
936
|
-
shouldEscape = /["&'<>]/,
|
937
|
-
escape = {
|
938
|
-
'<': '<',
|
939
|
-
'>': '>',
|
940
|
-
'"': '"',
|
941
|
-
"'": ''',
|
942
|
-
},
|
943
|
-
escapedChar = function (chr) {
|
944
|
-
return escape[chr];
|
945
|
-
}
|
946
|
-
;
|
947
|
-
if (shouldEscape.test(string)) {
|
948
|
-
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');
|
949
|
-
string = string.replace(badChars, escapedChar);
|
950
|
-
}
|
951
878
|
|
952
|
-
|
879
|
+
const badChars = /["'<>]|&(?![\d#A-Za-z]{1,12};)/g;
|
880
|
+
const escape = {
|
881
|
+
'"': '"',
|
882
|
+
'&': '&',
|
883
|
+
"'": ''',
|
884
|
+
'<': '<',
|
885
|
+
'>': '>',
|
886
|
+
};
|
887
|
+
|
888
|
+
return string.replace(badChars, (chr) => escape[chr]);
|
953
889
|
},
|
954
890
|
},
|
955
891
|
can: {
|
@@ -971,15 +907,13 @@
|
|
971
907
|
return settings.useFlex;
|
972
908
|
},
|
973
909
|
fit: function () {
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
startPosition = verticalCenter + topOffset
|
982
|
-
;
|
910
|
+
let contextHeight = module.cache.contextHeight;
|
911
|
+
let verticalCenter = module.cache.contextHeight / 2;
|
912
|
+
let topOffset = module.cache.topOffset;
|
913
|
+
let scrollHeight = module.cache.scrollHeight;
|
914
|
+
let height = module.cache.height;
|
915
|
+
let paddingHeight = settings.padding;
|
916
|
+
let startPosition = verticalCenter + topOffset;
|
983
917
|
|
984
918
|
return scrollHeight > height
|
985
919
|
? startPosition + scrollHeight + paddingHeight < contextHeight
|
@@ -1035,43 +969,36 @@
|
|
1035
969
|
observeAttributes = state !== false;
|
1036
970
|
},
|
1037
971
|
autofocus: function () {
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
).first()
|
1047
|
-
;
|
972
|
+
let $autofocus = $inputs.filter('[autofocus]');
|
973
|
+
let $rawInputs = $inputs.filter(':input');
|
974
|
+
let $input = ($autofocus.length > 0
|
975
|
+
? $autofocus
|
976
|
+
: ($rawInputs.length > 0
|
977
|
+
? $rawInputs
|
978
|
+
: $module)
|
979
|
+
).first();
|
1048
980
|
$input.trigger('focus');
|
1049
981
|
},
|
1050
982
|
bodyMargin: function () {
|
1051
|
-
|
983
|
+
let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
1052
984
|
if (settings.detachable || module.can.fit()) {
|
1053
985
|
$context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
|
1054
986
|
}
|
1055
987
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
1056
|
-
|
1057
|
-
|
1058
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
1059
|
-
;
|
988
|
+
let el = $(this);
|
989
|
+
let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
1060
990
|
el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
|
1061
991
|
});
|
1062
992
|
},
|
1063
993
|
clickaway: function () {
|
1064
994
|
if (!settings.detachable) {
|
1065
995
|
$module
|
1066
|
-
.on('mousedown' + elementEventNamespace, module.event.mousedown)
|
1067
|
-
;
|
996
|
+
.on('mousedown' + elementEventNamespace, module.event.mousedown);
|
1068
997
|
}
|
1069
998
|
$dimmer
|
1070
|
-
.on('mousedown' + elementEventNamespace, module.event.mousedown)
|
1071
|
-
;
|
999
|
+
.on('mousedown' + elementEventNamespace, module.event.mousedown);
|
1072
1000
|
$dimmer
|
1073
|
-
.on('mouseup' + elementEventNamespace, module.event.mouseup)
|
1074
|
-
;
|
1001
|
+
.on('mouseup' + elementEventNamespace, module.event.mouseup);
|
1075
1002
|
},
|
1076
1003
|
dimmerSettings: function () {
|
1077
1004
|
if ($.fn.dimmer === undefined) {
|
@@ -1079,19 +1006,17 @@
|
|
1079
1006
|
|
1080
1007
|
return;
|
1081
1008
|
}
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
hide: settings.transition.hideDuration || settings.duration,
|
1091
|
-
},
|
1009
|
+
let defaultSettings = {
|
1010
|
+
debug: settings.debug,
|
1011
|
+
dimmerName: 'modals',
|
1012
|
+
closable: 'auto',
|
1013
|
+
useFlex: module.can.useFlex(),
|
1014
|
+
duration: {
|
1015
|
+
show: settings.transition.showDuration || settings.duration,
|
1016
|
+
hide: settings.transition.hideDuration || settings.duration,
|
1092
1017
|
},
|
1093
|
-
|
1094
|
-
;
|
1018
|
+
};
|
1019
|
+
let dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
|
1095
1020
|
if (settings.inverted) {
|
1096
1021
|
dimmerSettings.variation = dimmerSettings.variation !== undefined
|
1097
1022
|
? dimmerSettings.variation + ' inverted'
|
@@ -1113,7 +1038,7 @@
|
|
1113
1038
|
},
|
1114
1039
|
modalOffset: function () {
|
1115
1040
|
if (!settings.detachable) {
|
1116
|
-
|
1041
|
+
let canFit = module.can.fit();
|
1117
1042
|
$module
|
1118
1043
|
.css({
|
1119
1044
|
top: !$module.hasClass('aligned') && canFit
|
@@ -1122,8 +1047,7 @@
|
|
1122
1047
|
? $document.scrollTop() + settings.padding
|
1123
1048
|
: $document.scrollTop() + (module.cache.contextHeight - module.cache.height - settings.padding)),
|
1124
1049
|
marginLeft: -(module.cache.width / 2),
|
1125
|
-
})
|
1126
|
-
;
|
1050
|
+
});
|
1127
1051
|
} else {
|
1128
1052
|
$module
|
1129
1053
|
.css({
|
@@ -1131,8 +1055,7 @@
|
|
1131
1055
|
? -(module.cache.height / 2)
|
1132
1056
|
: settings.padding / 2,
|
1133
1057
|
marginLeft: -(module.cache.width / 2),
|
1134
|
-
})
|
1135
|
-
;
|
1058
|
+
});
|
1136
1059
|
}
|
1137
1060
|
module.verbose('Setting modal offset for legacy mode');
|
1138
1061
|
},
|
@@ -1142,8 +1065,7 @@
|
|
1142
1065
|
} else if (!$module.hasClass('bottom')) {
|
1143
1066
|
module.debug('Modal is taller than page content, resizing page height');
|
1144
1067
|
$context
|
1145
|
-
.css('height', module.cache.height + (settings.padding * 2) + 'px')
|
1146
|
-
;
|
1068
|
+
.css('height', module.cache.height + (settings.padding * 2) + 'px');
|
1147
1069
|
}
|
1148
1070
|
},
|
1149
1071
|
active: function () {
|
@@ -1228,11 +1150,9 @@
|
|
1228
1150
|
},
|
1229
1151
|
performance: {
|
1230
1152
|
log: function (message) {
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
previousTime
|
1235
|
-
;
|
1153
|
+
let currentTime;
|
1154
|
+
let executionTime;
|
1155
|
+
let previousTime;
|
1236
1156
|
if (settings.performance) {
|
1237
1157
|
currentTime = Date.now();
|
1238
1158
|
previousTime = time || currentTime;
|
@@ -1251,10 +1171,8 @@
|
|
1251
1171
|
}, 500);
|
1252
1172
|
},
|
1253
1173
|
display: function () {
|
1254
|
-
|
1255
|
-
|
1256
|
-
totalTime = 0
|
1257
|
-
;
|
1174
|
+
let title = settings.name + ':';
|
1175
|
+
let totalTime = 0;
|
1258
1176
|
time = false;
|
1259
1177
|
clearTimeout(module.performance.timer);
|
1260
1178
|
$.each(performance, function (index, data) {
|
@@ -1276,19 +1194,17 @@
|
|
1276
1194
|
},
|
1277
1195
|
},
|
1278
1196
|
invoke: function (query, passedArguments, context) {
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
response
|
1284
|
-
;
|
1197
|
+
let object = instance;
|
1198
|
+
let maxDepth;
|
1199
|
+
let found;
|
1200
|
+
let response;
|
1285
1201
|
passedArguments = passedArguments || queryArguments;
|
1286
1202
|
context = context || element;
|
1287
1203
|
if (typeof query === 'string' && object !== undefined) {
|
1288
1204
|
query = query.split(/[ .]/);
|
1289
1205
|
maxDepth = query.length - 1;
|
1290
1206
|
$.each(query, function (depth, value) {
|
1291
|
-
|
1207
|
+
let camelCaseValue = depth !== maxDepth
|
1292
1208
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
1293
1209
|
: query;
|
1294
1210
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
@@ -1503,7 +1419,7 @@
|
|
1503
1419
|
|
1504
1420
|
$.fn.modal.settings.templates = {
|
1505
1421
|
getArguments: function (args) {
|
1506
|
-
|
1422
|
+
let queryArguments = [].slice.call(args);
|
1507
1423
|
if ($.isPlainObject(queryArguments[0])) {
|
1508
1424
|
return $.extend({
|
1509
1425
|
handler: function () {},
|
@@ -1522,11 +1438,9 @@
|
|
1522
1438
|
};
|
1523
1439
|
},
|
1524
1440
|
alert: function () {
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
approveFn = args.handler
|
1529
|
-
;
|
1441
|
+
let settings = this.get.settings();
|
1442
|
+
let args = settings.templates.getArguments(arguments);
|
1443
|
+
let approveFn = args.handler;
|
1530
1444
|
|
1531
1445
|
return {
|
1532
1446
|
title: args.title,
|
@@ -1540,16 +1454,14 @@
|
|
1540
1454
|
};
|
1541
1455
|
},
|
1542
1456
|
confirm: function () {
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
}
|
1552
|
-
;
|
1457
|
+
let settings = this.get.settings();
|
1458
|
+
let args = settings.templates.getArguments(arguments);
|
1459
|
+
let approveFn = function () {
|
1460
|
+
args.handler(true);
|
1461
|
+
};
|
1462
|
+
let denyFn = function () {
|
1463
|
+
args.handler(false);
|
1464
|
+
};
|
1553
1465
|
|
1554
1466
|
return {
|
1555
1467
|
title: args.title,
|
@@ -1568,22 +1480,18 @@
|
|
1568
1480
|
};
|
1569
1481
|
},
|
1570
1482
|
prompt: function () {
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
denyFn = function () {
|
1584
|
-
args.handler(null);
|
1585
|
-
}
|
1586
|
-
;
|
1483
|
+
let $this = this;
|
1484
|
+
let settings = this.get.settings();
|
1485
|
+
let args = settings.templates.getArguments(arguments);
|
1486
|
+
let input = $($.parseHTML(args.content)).filter('.ui.input');
|
1487
|
+
let approveFn = function () {
|
1488
|
+
let settings = $this.get.settings();
|
1489
|
+
let inputField = $this.get.element().find(settings.selector.prompt)[0];
|
1490
|
+
args.handler($(inputField).val());
|
1491
|
+
};
|
1492
|
+
let denyFn = function () {
|
1493
|
+
args.handler(null);
|
1494
|
+
};
|
1587
1495
|
if (input.length === 0) {
|
1588
1496
|
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>';
|
1589
1497
|
}
|