fomantic-ui 2.10.0-beta.7 → 2.10.0-beta.9
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 +7 -5
- package/dist/components/dropdown.js +653 -943
- 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 +71 -109
- 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 +183 -257
- 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 +212 -296
- 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 +176 -236
- 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 +80 -121
- 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 +240 -334
- 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 +90 -115
- 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 +59 -57
- package/dist/semantic.js +4015 -5567
- package/dist/semantic.min.css +2 -2
- 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 +652 -942
- package/src/definitions/modules/dropdown.less +11 -5
- package/src/definitions/modules/embed.js +70 -108
- package/src/definitions/modules/flyout.js +182 -256
- package/src/definitions/modules/modal.js +211 -295
- package/src/definitions/modules/nag.js +66 -96
- package/src/definitions/modules/popup.js +175 -235
- package/src/definitions/modules/progress.js +102 -137
- package/src/definitions/modules/rating.js +79 -120
- package/src/definitions/modules/search.js +239 -333
- 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 +89 -114
- package/src/definitions/modules/transition.js +85 -140
- package/src/themes/default/modules/dropdown.variables +1 -0
- 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
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
2
|
+
* # Fomantic-UI 2.10.0-beta.9+45ac3fe - Flyout
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -20,82 +20,78 @@
|
|
20
20
|
: globalThis;
|
21
21
|
|
22
22
|
$.fn.flyout = function (parameters) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
45
|
-
}
|
23
|
+
let $allModules = $(this);
|
24
|
+
let $window = $(window);
|
25
|
+
let $document = $(document);
|
26
|
+
let $html = $('html');
|
27
|
+
let $head = $('head');
|
28
|
+
let $body = $('body');
|
29
|
+
|
30
|
+
let time = Date.now();
|
31
|
+
let performance = [];
|
32
|
+
|
33
|
+
let query = arguments[0];
|
34
|
+
let methodInvoked = typeof query === 'string';
|
35
|
+
let queryArguments = [].slice.call(arguments, 1);
|
36
|
+
let contextCheck = function (context, win) {
|
37
|
+
let $context;
|
38
|
+
if ([window, document].indexOf(context) >= 0) {
|
39
|
+
$context = $body;
|
40
|
+
} else {
|
41
|
+
$context = $(win.document).find(context);
|
42
|
+
if ($context.length === 0) {
|
43
|
+
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
46
44
|
}
|
45
|
+
}
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
;
|
47
|
+
return $context;
|
48
|
+
};
|
49
|
+
let returnedValue;
|
52
50
|
|
53
51
|
$allModules.each(function () {
|
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
|
-
;
|
52
|
+
let settings = $.isPlainObject(parameters)
|
53
|
+
? $.extend(true, {}, $.fn.flyout.settings, parameters)
|
54
|
+
: $.extend({}, $.fn.flyout.settings);
|
55
|
+
|
56
|
+
let selector = settings.selector;
|
57
|
+
let className = settings.className;
|
58
|
+
let namespace = settings.namespace;
|
59
|
+
let fields = settings.fields;
|
60
|
+
let regExp = settings.regExp;
|
61
|
+
let error = settings.error;
|
62
|
+
|
63
|
+
let eventNamespace = '.' + namespace;
|
64
|
+
let moduleNamespace = 'module-' + namespace;
|
65
|
+
|
66
|
+
let $module = $(this);
|
67
|
+
let $context = contextCheck(settings.context, window);
|
68
|
+
let $closeIcon = $module.find(selector.close);
|
69
|
+
let $inputs;
|
70
|
+
let $focusedElement;
|
71
|
+
|
72
|
+
let $flyouts = $module.children(selector.flyout);
|
73
|
+
let $pusher = $context.children(selector.pusher);
|
74
|
+
let $style;
|
75
|
+
|
76
|
+
let isFlyoutComponent = $module.hasClass('flyout');
|
77
|
+
|
78
|
+
let element = this;
|
79
|
+
let instance = isFlyoutComponent ? $module.data(moduleNamespace) : undefined;
|
80
|
+
|
81
|
+
let ignoreRepeatedEvents = false;
|
82
|
+
let isBody = $context[0] === $body[0];
|
83
|
+
let initialBodyMargin = '';
|
84
|
+
let tempBodyMargin = '';
|
85
|
+
let hadScrollbar = false;
|
86
|
+
let windowRefocused = false;
|
87
|
+
|
88
|
+
let elementNamespace;
|
89
|
+
let id;
|
90
|
+
let observer;
|
91
|
+
let observeAttributes = false;
|
92
|
+
let currentScroll;
|
93
|
+
|
94
|
+
let module;
|
99
95
|
|
100
96
|
module = {
|
101
97
|
|
@@ -123,23 +119,21 @@
|
|
123
119
|
$module.find(selector.content).html(module.helpers.escape(settings.content, settings)).addClass(settings.classContent);
|
124
120
|
}
|
125
121
|
if (module.has.configActions()) {
|
126
|
-
|
122
|
+
let $actions = $module.find(selector.actions).addClass(settings.classActions);
|
127
123
|
if ($actions.length === 0) {
|
128
124
|
$actions = $('<div/>', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($module);
|
129
125
|
} else {
|
130
126
|
$actions.empty();
|
131
127
|
}
|
132
128
|
settings.actions.forEach(function (el) {
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
: function () {}
|
142
|
-
;
|
129
|
+
let icon = el[fields.icon]
|
130
|
+
? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.escape(el[fields.icon]) + ' icon"></i>'
|
131
|
+
: '';
|
132
|
+
let text = module.helpers.escape(el[fields.text] || '', settings);
|
133
|
+
let cls = module.helpers.escape(el[fields.class] || '');
|
134
|
+
let click = el[fields.click] && isFunction(el[fields.click])
|
135
|
+
? el[fields.click]
|
136
|
+
: function () {};
|
143
137
|
$actions.append($('<button/>', {
|
144
138
|
html: icon + text,
|
145
139
|
'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g, ''),
|
@@ -184,8 +178,7 @@
|
|
184
178
|
module.verbose('Storing instance of module', module);
|
185
179
|
instance = module;
|
186
180
|
$module
|
187
|
-
.data(moduleNamespace, instance)
|
188
|
-
;
|
181
|
+
.data(moduleNamespace, instance);
|
189
182
|
},
|
190
183
|
|
191
184
|
create: {
|
@@ -202,12 +195,12 @@
|
|
202
195
|
$module.append($closeIcon);
|
203
196
|
}
|
204
197
|
if (settings.title !== '') {
|
205
|
-
|
198
|
+
let titleId = '_' + module.get.id() + 'title';
|
206
199
|
$module.attr('aria-labelledby', titleId);
|
207
200
|
$('<div/>', { class: className.header, id: titleId }).appendTo($module);
|
208
201
|
}
|
209
202
|
if (settings.content !== '') {
|
210
|
-
|
203
|
+
let descId = '_' + module.get.id() + 'desc';
|
211
204
|
$module.attr('aria-describedby', descId);
|
212
205
|
$('<div/>', { class: className.content, id: descId }).appendTo($module);
|
213
206
|
}
|
@@ -231,8 +224,7 @@
|
|
231
224
|
module.verbose('Destroying previous module for', $module);
|
232
225
|
$module
|
233
226
|
.off(eventNamespace)
|
234
|
-
.removeData(moduleNamespace)
|
235
|
-
;
|
227
|
+
.removeData(moduleNamespace);
|
236
228
|
$closeIcon.off(elementNamespace);
|
237
229
|
if ($inputs) {
|
238
230
|
$inputs.off(elementNamespace);
|
@@ -245,9 +237,7 @@
|
|
245
237
|
|
246
238
|
event: {
|
247
239
|
keyboard: function (event) {
|
248
|
-
|
249
|
-
keyCode = event.which
|
250
|
-
;
|
240
|
+
let keyCode = event.which;
|
251
241
|
if (keyCode === settings.keys.escape) {
|
252
242
|
if (settings.closable) {
|
253
243
|
module.debug('Escape key pressed hiding flyout');
|
@@ -272,10 +262,8 @@
|
|
272
262
|
},
|
273
263
|
clickaway: function (event) {
|
274
264
|
if (settings.closable) {
|
275
|
-
|
276
|
-
|
277
|
-
clickedContext = $context.is(event.target)
|
278
|
-
;
|
265
|
+
let clickedInPusher = $pusher.find(event.target).length > 0 || $pusher.is(event.target);
|
266
|
+
let clickedContext = $context.is(event.target);
|
279
267
|
if (clickedInPusher) {
|
280
268
|
module.verbose('User clicked on dimmed page');
|
281
269
|
module.hide();
|
@@ -290,27 +278,21 @@
|
|
290
278
|
module.hide();
|
291
279
|
},
|
292
280
|
closeKeyUp: function (event) {
|
293
|
-
|
294
|
-
keyCode = event.which
|
295
|
-
;
|
281
|
+
let keyCode = event.which;
|
296
282
|
if (keyCode === settings.keys.enter || keyCode === settings.keys.space) {
|
297
283
|
module.hide();
|
298
284
|
}
|
299
285
|
},
|
300
286
|
inputKeyDown: {
|
301
287
|
first: function (event) {
|
302
|
-
|
303
|
-
keyCode = event.which
|
304
|
-
;
|
288
|
+
let keyCode = event.which;
|
305
289
|
if (keyCode === settings.keys.tab && event.shiftKey) {
|
306
290
|
$inputs.last().trigger('focus');
|
307
291
|
event.preventDefault();
|
308
292
|
}
|
309
293
|
},
|
310
294
|
last: function (event) {
|
311
|
-
|
312
|
-
keyCode = event.which
|
313
|
-
;
|
295
|
+
let keyCode = event.which;
|
314
296
|
if (keyCode === settings.keys.tab && !event.shiftKey) {
|
315
297
|
$inputs.first().trigger('focus');
|
316
298
|
event.preventDefault();
|
@@ -367,24 +349,19 @@
|
|
367
349
|
$module
|
368
350
|
.on('click' + eventNamespace, selector.close, module.event.close)
|
369
351
|
.on('click' + eventNamespace, selector.approve, module.event.approve)
|
370
|
-
.on('click' + eventNamespace, selector.deny, module.event.deny)
|
371
|
-
;
|
352
|
+
.on('click' + eventNamespace, selector.deny, module.event.deny);
|
372
353
|
$closeIcon
|
373
|
-
.on('keyup' + elementNamespace, module.event.closeKeyUp)
|
374
|
-
;
|
354
|
+
.on('keyup' + elementNamespace, module.event.closeKeyUp);
|
375
355
|
$window
|
376
|
-
.on('focus' + elementNamespace, module.event.focus)
|
377
|
-
;
|
356
|
+
.on('focus' + elementNamespace, module.event.focus);
|
378
357
|
$context
|
379
|
-
.on('click' + elementNamespace, module.event.click)
|
380
|
-
;
|
358
|
+
.on('click' + elementNamespace, module.event.click);
|
381
359
|
},
|
382
360
|
clickaway: function () {
|
383
361
|
module.verbose('Adding clickaway events to context', $context);
|
384
362
|
$context
|
385
363
|
.on('click' + elementNamespace, module.event.clickaway)
|
386
|
-
.on('touchend' + elementNamespace, module.event.clickaway)
|
387
|
-
;
|
364
|
+
.on('touchend' + elementNamespace, module.event.clickaway);
|
388
365
|
},
|
389
366
|
scrollLock: function () {
|
390
367
|
if (settings.scrollLock) {
|
@@ -398,11 +375,9 @@
|
|
398
375
|
}
|
399
376
|
module.verbose('Adding events to contain flyout scroll');
|
400
377
|
$document
|
401
|
-
.on('touchmove' + elementNamespace, module.event.touch)
|
402
|
-
;
|
378
|
+
.on('touchmove' + elementNamespace, module.event.touch);
|
403
379
|
$module
|
404
|
-
.on('scroll' + eventNamespace, module.event.containScroll)
|
405
|
-
;
|
380
|
+
.on('scroll' + eventNamespace, module.event.containScroll);
|
406
381
|
},
|
407
382
|
},
|
408
383
|
unbind: {
|
@@ -423,19 +398,17 @@
|
|
423
398
|
|
424
399
|
add: {
|
425
400
|
inlineCSS: function () {
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
style
|
438
|
-
;
|
401
|
+
let width = module.cache.width || $module.outerWidth();
|
402
|
+
let height = module.cache.height || $module.outerHeight();
|
403
|
+
let isRTL = module.is.rtl();
|
404
|
+
let direction = module.get.direction();
|
405
|
+
let distance = {
|
406
|
+
left: width,
|
407
|
+
right: -width,
|
408
|
+
top: height,
|
409
|
+
bottom: -height,
|
410
|
+
};
|
411
|
+
let style;
|
439
412
|
|
440
413
|
if (isRTL) {
|
441
414
|
module.verbose('RTL detected, flipping widths');
|
@@ -462,32 +435,29 @@
|
|
462
435
|
|
463
436
|
style += '</style>';
|
464
437
|
$style = $(style)
|
465
|
-
.appendTo($head)
|
466
|
-
;
|
438
|
+
.appendTo($head);
|
467
439
|
module.debug('Adding sizing css to head', $style);
|
468
440
|
},
|
469
441
|
keyboardShortcuts: function () {
|
470
442
|
module.verbose('Adding keyboard shortcuts');
|
471
443
|
$document
|
472
|
-
.on('keydown' + eventNamespace, module.event.keyboard)
|
473
|
-
;
|
444
|
+
.on('keydown' + eventNamespace, module.event.keyboard);
|
474
445
|
},
|
475
446
|
},
|
476
447
|
observeChanges: function () {
|
477
448
|
if ('MutationObserver' in window) {
|
478
449
|
observer = new MutationObserver(function (mutations) {
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
450
|
+
let collectNodes = function (parent) {
|
451
|
+
let nodes = [];
|
452
|
+
for (let c = 0, cl = parent.length; c < cl; c++) {
|
453
|
+
Array.prototype.push.apply(nodes, collectNodes(parent[c].childNodes));
|
454
|
+
nodes.push(parent[c]);
|
455
|
+
}
|
485
456
|
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
;
|
457
|
+
return nodes;
|
458
|
+
};
|
459
|
+
let shouldRefreshInputs = false;
|
460
|
+
let ignoreAutofocus = true;
|
491
461
|
mutations.every(function (mutation) {
|
492
462
|
if (mutation.type === 'attributes') {
|
493
463
|
if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
|
@@ -496,8 +466,8 @@
|
|
496
466
|
} else {
|
497
467
|
// mutationobserver only provides the parent nodes,
|
498
468
|
// so let's collect all childs as well to find nested inputs
|
499
|
-
|
500
|
-
|
469
|
+
let $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible');
|
470
|
+
let $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
|
501
471
|
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
|
502
472
|
shouldRefreshInputs = true;
|
503
473
|
if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
|
@@ -538,8 +508,7 @@
|
|
538
508
|
refreshInputs: function (ignoreAutofocus) {
|
539
509
|
if ($inputs) {
|
540
510
|
$inputs
|
541
|
-
.off('keydown' + elementNamespace)
|
542
|
-
;
|
511
|
+
.off('keydown' + elementNamespace);
|
543
512
|
}
|
544
513
|
if (!settings.dimPage) {
|
545
514
|
return;
|
@@ -554,11 +523,9 @@
|
|
554
523
|
$module.removeAttr('tabindex');
|
555
524
|
}
|
556
525
|
$inputs.first()
|
557
|
-
.on('keydown' + elementNamespace, module.event.inputKeyDown.first)
|
558
|
-
;
|
526
|
+
.on('keydown' + elementNamespace, module.event.inputKeyDown.first);
|
559
527
|
$inputs.last()
|
560
|
-
.on('keydown' + elementNamespace, module.event.inputKeyDown.last)
|
561
|
-
;
|
528
|
+
.on('keydown' + elementNamespace, module.event.inputKeyDown.last);
|
562
529
|
if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
|
563
530
|
module.set.autofocus();
|
564
531
|
}
|
@@ -580,8 +547,7 @@
|
|
580
547
|
.children()
|
581
548
|
.not(selector.omitted)
|
582
549
|
.not($flyouts)
|
583
|
-
.wrapAll($pusher)
|
584
|
-
;
|
550
|
+
.wrapAll($pusher);
|
585
551
|
module.refresh();
|
586
552
|
}
|
587
553
|
if ($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
|
@@ -599,12 +565,10 @@
|
|
599
565
|
},
|
600
566
|
heights: function () {
|
601
567
|
module.debug('Setting up heights', $module);
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
newContentHeight = ($context.height() || 0) - ($header.outerHeight() || 0) - ($actions.outerHeight() || 0)
|
607
|
-
;
|
568
|
+
let $header = $module.children(selector.header);
|
569
|
+
let $content = $module.children(selector.content);
|
570
|
+
let $actions = $module.children(selector.actions);
|
571
|
+
let newContentHeight = ($context.height() || 0) - ($header.outerHeight() || 0) - ($actions.outerHeight() || 0);
|
608
572
|
if (newContentHeight > 0) {
|
609
573
|
$content.css('min-height', String(newContentHeight) + 'px');
|
610
574
|
}
|
@@ -612,17 +576,14 @@
|
|
612
576
|
},
|
613
577
|
|
614
578
|
attachEvents: function (selector, event) {
|
615
|
-
|
616
|
-
$toggle = $(selector)
|
617
|
-
;
|
579
|
+
let $toggle = $(selector);
|
618
580
|
event = isFunction(module[event])
|
619
581
|
? module[event]
|
620
582
|
: module.toggle;
|
621
583
|
if ($toggle.length > 0) {
|
622
584
|
module.debug('Attaching flyout events to element', selector, event);
|
623
585
|
$toggle
|
624
|
-
.on('click' + eventNamespace, event)
|
625
|
-
;
|
586
|
+
.on('click' + eventNamespace, event);
|
626
587
|
} else {
|
627
588
|
module.error(error.notFound, selector);
|
628
589
|
}
|
@@ -701,11 +662,9 @@
|
|
701
662
|
},
|
702
663
|
|
703
664
|
hideOthers: function (callback) {
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
callbackCount = 0
|
708
|
-
;
|
665
|
+
let $otherFlyouts = $flyouts.not($module).filter('.' + className.visible);
|
666
|
+
let flyoutCount = $otherFlyouts.length;
|
667
|
+
let callbackCount = 0;
|
709
668
|
callback = callback || function () {};
|
710
669
|
$otherFlyouts
|
711
670
|
.flyout('hide', function () {
|
@@ -713,8 +672,7 @@
|
|
713
672
|
if (callbackCount === flyoutCount) {
|
714
673
|
callback();
|
715
674
|
}
|
716
|
-
})
|
717
|
-
;
|
675
|
+
});
|
718
676
|
},
|
719
677
|
|
720
678
|
toggle: function () {
|
@@ -727,11 +685,9 @@
|
|
727
685
|
},
|
728
686
|
|
729
687
|
pushPage: function (callback) {
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
transitionEnd
|
734
|
-
;
|
688
|
+
let animate;
|
689
|
+
let dim;
|
690
|
+
let transitionEnd;
|
735
691
|
callback = isFunction(callback)
|
736
692
|
? callback
|
737
693
|
: function () {};
|
@@ -765,10 +721,8 @@
|
|
765
721
|
},
|
766
722
|
|
767
723
|
pullPage: function (callback) {
|
768
|
-
|
769
|
-
|
770
|
-
transitionEnd
|
771
|
-
;
|
724
|
+
let animate;
|
725
|
+
let transitionEnd;
|
772
726
|
callback = isFunction(callback)
|
773
727
|
? callback
|
774
728
|
: function () {};
|
@@ -834,16 +788,14 @@
|
|
834
788
|
observeAttributes = state !== false;
|
835
789
|
},
|
836
790
|
autofocus: function () {
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
).first()
|
846
|
-
;
|
791
|
+
let $autofocus = $inputs.filter('[autofocus]');
|
792
|
+
let $rawInputs = $inputs.filter(':input');
|
793
|
+
let $input = ($autofocus.length > 0
|
794
|
+
? $autofocus
|
795
|
+
: ($rawInputs.length > 0
|
796
|
+
? $rawInputs
|
797
|
+
: $module)
|
798
|
+
).first();
|
847
799
|
$input.trigger('focus');
|
848
800
|
},
|
849
801
|
dimmerStyles: function () {
|
@@ -854,13 +806,11 @@
|
|
854
806
|
}
|
855
807
|
},
|
856
808
|
bodyMargin: function () {
|
857
|
-
|
809
|
+
let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
858
810
|
$context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
|
859
811
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
860
|
-
|
861
|
-
|
862
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
863
|
-
;
|
812
|
+
let el = $(this);
|
813
|
+
let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
864
814
|
el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
|
865
815
|
});
|
866
816
|
},
|
@@ -910,8 +860,7 @@
|
|
910
860
|
keyboardShortcuts: function () {
|
911
861
|
module.verbose('Removing keyboard shortcuts');
|
912
862
|
$document
|
913
|
-
.off('keydown' + eventNamespace)
|
914
|
-
;
|
863
|
+
.off('keydown' + eventNamespace);
|
915
864
|
},
|
916
865
|
|
917
866
|
// context
|
@@ -981,20 +930,16 @@
|
|
981
930
|
|
982
931
|
save: {
|
983
932
|
focus: function () {
|
984
|
-
|
985
|
-
|
986
|
-
inCurrentFlyout = $activeElement.closest($module).length > 0
|
987
|
-
;
|
933
|
+
let $activeElement = $(document.activeElement);
|
934
|
+
let inCurrentFlyout = $activeElement.closest($module).length > 0;
|
988
935
|
if (!inCurrentFlyout) {
|
989
936
|
$focusedElement = $(document.activeElement).trigger('blur');
|
990
937
|
}
|
991
938
|
},
|
992
939
|
bodyMargin: function () {
|
993
940
|
initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
|
994
|
-
|
995
|
-
|
996
|
-
bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth
|
997
|
-
;
|
941
|
+
let bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10);
|
942
|
+
let bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
|
998
943
|
tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
|
999
944
|
},
|
1000
945
|
},
|
@@ -1018,10 +963,8 @@
|
|
1018
963
|
return !(self === top);
|
1019
964
|
},
|
1020
965
|
mobile: function () {
|
1021
|
-
|
1022
|
-
|
1023
|
-
isMobile = userAgent.match(regExp.mobile)
|
1024
|
-
;
|
966
|
+
let userAgent = navigator.userAgent;
|
967
|
+
let isMobile = userAgent.match(regExp.mobile);
|
1025
968
|
if (isMobile) {
|
1026
969
|
module.verbose('Browser was found to be mobile', userAgent);
|
1027
970
|
|
@@ -1066,13 +1009,11 @@
|
|
1066
1009
|
}
|
1067
1010
|
},
|
1068
1011
|
bodyMargin: function () {
|
1069
|
-
|
1012
|
+
let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
1070
1013
|
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
|
1071
1014
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
1072
|
-
|
1073
|
-
|
1074
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
1075
|
-
;
|
1015
|
+
let el = $(this);
|
1016
|
+
let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
1076
1017
|
el.css(attribute, '');
|
1077
1018
|
});
|
1078
1019
|
},
|
@@ -1093,7 +1034,7 @@
|
|
1093
1034
|
'>': '>',
|
1094
1035
|
};
|
1095
1036
|
|
1096
|
-
return string.replace(badChars, (chr) => escape[chr]);
|
1037
|
+
return String(string).replace(badChars, (chr) => escape[chr]);
|
1097
1038
|
},
|
1098
1039
|
},
|
1099
1040
|
|
@@ -1148,11 +1089,9 @@
|
|
1148
1089
|
},
|
1149
1090
|
performance: {
|
1150
1091
|
log: function (message) {
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
previousTime
|
1155
|
-
;
|
1092
|
+
let currentTime;
|
1093
|
+
let executionTime;
|
1094
|
+
let previousTime;
|
1156
1095
|
if (settings.performance) {
|
1157
1096
|
currentTime = Date.now();
|
1158
1097
|
previousTime = time || currentTime;
|
@@ -1171,10 +1110,8 @@
|
|
1171
1110
|
}, 500);
|
1172
1111
|
},
|
1173
1112
|
display: function () {
|
1174
|
-
|
1175
|
-
|
1176
|
-
totalTime = 0
|
1177
|
-
;
|
1113
|
+
let title = settings.name + ':';
|
1114
|
+
let totalTime = 0;
|
1178
1115
|
time = false;
|
1179
1116
|
clearTimeout(module.performance.timer);
|
1180
1117
|
$.each(performance, function (index, data) {
|
@@ -1196,22 +1133,19 @@
|
|
1196
1133
|
},
|
1197
1134
|
},
|
1198
1135
|
invoke: function (query, passedArguments, context) {
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
response
|
1204
|
-
;
|
1136
|
+
let object = instance;
|
1137
|
+
let maxDepth;
|
1138
|
+
let found;
|
1139
|
+
let response;
|
1205
1140
|
passedArguments = passedArguments || queryArguments;
|
1206
1141
|
context = element || context;
|
1207
1142
|
if (typeof query === 'string' && object !== undefined) {
|
1208
1143
|
query = query.split(/[ .]/);
|
1209
1144
|
maxDepth = query.length - 1;
|
1210
1145
|
$.each(query, function (depth, value) {
|
1211
|
-
|
1146
|
+
let camelCaseValue = depth !== maxDepth
|
1212
1147
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
1213
|
-
: query
|
1214
|
-
;
|
1148
|
+
: query;
|
1215
1149
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
1216
1150
|
object = object[camelCaseValue];
|
1217
1151
|
} else if (object[camelCaseValue] !== undefined) {
|
@@ -1403,7 +1337,7 @@
|
|
1403
1337
|
|
1404
1338
|
$.fn.flyout.settings.templates = {
|
1405
1339
|
getArguments: function (args) {
|
1406
|
-
|
1340
|
+
let queryArguments = [].slice.call(args);
|
1407
1341
|
if ($.isPlainObject(queryArguments[0])) {
|
1408
1342
|
return $.extend({
|
1409
1343
|
handler: function () {},
|
@@ -1422,10 +1356,8 @@
|
|
1422
1356
|
};
|
1423
1357
|
},
|
1424
1358
|
alert: function () {
|
1425
|
-
|
1426
|
-
|
1427
|
-
args = settings.templates.getArguments(arguments)
|
1428
|
-
;
|
1359
|
+
let settings = this.get.settings();
|
1360
|
+
let args = settings.templates.getArguments(arguments);
|
1429
1361
|
|
1430
1362
|
return {
|
1431
1363
|
title: args.title,
|
@@ -1438,10 +1370,8 @@
|
|
1438
1370
|
};
|
1439
1371
|
},
|
1440
1372
|
confirm: function () {
|
1441
|
-
|
1442
|
-
|
1443
|
-
args = settings.templates.getArguments(arguments)
|
1444
|
-
;
|
1373
|
+
let settings = this.get.settings();
|
1374
|
+
let args = settings.templates.getArguments(arguments);
|
1445
1375
|
|
1446
1376
|
return {
|
1447
1377
|
title: args.title,
|
@@ -1462,12 +1392,10 @@
|
|
1462
1392
|
};
|
1463
1393
|
},
|
1464
1394
|
prompt: function () {
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
input = $($.parseHTML(args.content)).filter('.ui.input')
|
1470
|
-
;
|
1395
|
+
let $this = this;
|
1396
|
+
let settings = this.get.settings();
|
1397
|
+
let args = settings.templates.getArguments(arguments);
|
1398
|
+
let input = $($.parseHTML(args.content)).filter('.ui.input');
|
1471
1399
|
if (input.length === 0) {
|
1472
1400
|
args.content += '<p><div class="' + settings.className.prompt + '"><input placeholder="' + this.helpers.escape(args.placeholder || '') + '" type="text" value="' + this.helpers.escape(args.defaultValue || '') + '"></div></p>';
|
1473
1401
|
}
|
@@ -1479,10 +1407,8 @@
|
|
1479
1407
|
text: settings.text.ok,
|
1480
1408
|
class: settings.className.ok,
|
1481
1409
|
click: function () {
|
1482
|
-
|
1483
|
-
|
1484
|
-
inputField = $this.get.element().find(settings.selector.prompt)[0]
|
1485
|
-
;
|
1410
|
+
let settings = $this.get.settings();
|
1411
|
+
let inputField = $this.get.element().find(settings.selector.prompt)[0];
|
1486
1412
|
args.handler($(inputField).val());
|
1487
1413
|
},
|
1488
1414
|
}, {
|