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
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
2
|
+
* # Fomantic-UI 2.10.0-beta.41+1ceee9c - Flyout
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -20,82 +20,79 @@
|
|
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
|
-
|
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 initialBodyMarginInt = 0;
|
85
|
+
let tempBodyMargin = 0;
|
86
|
+
let hadScrollbar = false;
|
87
|
+
let windowRefocused = false;
|
88
|
+
|
89
|
+
let elementNamespace;
|
90
|
+
let id;
|
91
|
+
let observer;
|
92
|
+
let observeAttributes = false;
|
93
|
+
let currentScroll;
|
94
|
+
|
95
|
+
let module;
|
99
96
|
|
100
97
|
module = {
|
101
98
|
|
@@ -117,29 +114,27 @@
|
|
117
114
|
}
|
118
115
|
$module.addClass(settings.class);
|
119
116
|
if (settings.title !== '') {
|
120
|
-
$module.find(selector.header).html(module.helpers.escape(settings.title, settings
|
117
|
+
$module.find(selector.header).html(module.helpers.escape(settings.title, settings)).addClass(settings.classTitle);
|
121
118
|
}
|
122
119
|
if (settings.content !== '') {
|
123
|
-
$module.find(selector.content).html(module.helpers.escape(settings.content, settings
|
120
|
+
$module.find(selector.content).html(module.helpers.escape(settings.content, settings)).addClass(settings.classContent);
|
124
121
|
}
|
125
122
|
if (module.has.configActions()) {
|
126
|
-
|
123
|
+
let $actions = $module.find(selector.actions).addClass(settings.classActions);
|
127
124
|
if ($actions.length === 0) {
|
128
125
|
$actions = $('<div/>', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($module);
|
129
126
|
} else {
|
130
127
|
$actions.empty();
|
131
128
|
}
|
132
129
|
settings.actions.forEach(function (el) {
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
: function () {}
|
142
|
-
;
|
130
|
+
let icon = el[fields.icon]
|
131
|
+
? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.escape(el[fields.icon]) + ' icon"></i>'
|
132
|
+
: '';
|
133
|
+
let text = module.helpers.escape(el[fields.text] || '', settings);
|
134
|
+
let cls = module.helpers.escape(el[fields.class] || '');
|
135
|
+
let click = el[fields.click] && isFunction(el[fields.click])
|
136
|
+
? el[fields.click]
|
137
|
+
: function () {};
|
143
138
|
$actions.append($('<button/>', {
|
144
139
|
html: icon + text,
|
145
140
|
'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g, ''),
|
@@ -184,8 +179,7 @@
|
|
184
179
|
module.verbose('Storing instance of module', module);
|
185
180
|
instance = module;
|
186
181
|
$module
|
187
|
-
.data(moduleNamespace, instance)
|
188
|
-
;
|
182
|
+
.data(moduleNamespace, instance);
|
189
183
|
},
|
190
184
|
|
191
185
|
create: {
|
@@ -202,12 +196,12 @@
|
|
202
196
|
$module.append($closeIcon);
|
203
197
|
}
|
204
198
|
if (settings.title !== '') {
|
205
|
-
|
199
|
+
let titleId = '_' + module.get.id() + 'title';
|
206
200
|
$module.attr('aria-labelledby', titleId);
|
207
201
|
$('<div/>', { class: className.header, id: titleId }).appendTo($module);
|
208
202
|
}
|
209
203
|
if (settings.content !== '') {
|
210
|
-
|
204
|
+
let descId = '_' + module.get.id() + 'desc';
|
211
205
|
$module.attr('aria-describedby', descId);
|
212
206
|
$('<div/>', { class: className.content, id: descId }).appendTo($module);
|
213
207
|
}
|
@@ -231,8 +225,7 @@
|
|
231
225
|
module.verbose('Destroying previous module for', $module);
|
232
226
|
$module
|
233
227
|
.off(eventNamespace)
|
234
|
-
.removeData(moduleNamespace)
|
235
|
-
;
|
228
|
+
.removeData(moduleNamespace);
|
236
229
|
$closeIcon.off(elementNamespace);
|
237
230
|
if ($inputs) {
|
238
231
|
$inputs.off(elementNamespace);
|
@@ -245,9 +238,7 @@
|
|
245
238
|
|
246
239
|
event: {
|
247
240
|
keyboard: function (event) {
|
248
|
-
|
249
|
-
keyCode = event.which
|
250
|
-
;
|
241
|
+
let keyCode = event.which;
|
251
242
|
if (keyCode === settings.keys.escape) {
|
252
243
|
if (settings.closable) {
|
253
244
|
module.debug('Escape key pressed hiding flyout');
|
@@ -272,10 +263,8 @@
|
|
272
263
|
},
|
273
264
|
clickaway: function (event) {
|
274
265
|
if (settings.closable) {
|
275
|
-
|
276
|
-
|
277
|
-
clickedContext = $context.is(event.target)
|
278
|
-
;
|
266
|
+
let clickedInPusher = $pusher.find(event.target).length > 0 || $pusher.is(event.target);
|
267
|
+
let clickedContext = $context.is(event.target);
|
279
268
|
if (clickedInPusher) {
|
280
269
|
module.verbose('User clicked on dimmed page');
|
281
270
|
module.hide();
|
@@ -290,27 +279,21 @@
|
|
290
279
|
module.hide();
|
291
280
|
},
|
292
281
|
closeKeyUp: function (event) {
|
293
|
-
|
294
|
-
keyCode = event.which
|
295
|
-
;
|
282
|
+
let keyCode = event.which;
|
296
283
|
if (keyCode === settings.keys.enter || keyCode === settings.keys.space) {
|
297
284
|
module.hide();
|
298
285
|
}
|
299
286
|
},
|
300
287
|
inputKeyDown: {
|
301
288
|
first: function (event) {
|
302
|
-
|
303
|
-
keyCode = event.which
|
304
|
-
;
|
289
|
+
let keyCode = event.which;
|
305
290
|
if (keyCode === settings.keys.tab && event.shiftKey) {
|
306
291
|
$inputs.last().trigger('focus');
|
307
292
|
event.preventDefault();
|
308
293
|
}
|
309
294
|
},
|
310
295
|
last: function (event) {
|
311
|
-
|
312
|
-
keyCode = event.which
|
313
|
-
;
|
296
|
+
let keyCode = event.which;
|
314
297
|
if (keyCode === settings.keys.tab && !event.shiftKey) {
|
315
298
|
$inputs.first().trigger('focus');
|
316
299
|
event.preventDefault();
|
@@ -367,24 +350,19 @@
|
|
367
350
|
$module
|
368
351
|
.on('click' + eventNamespace, selector.close, module.event.close)
|
369
352
|
.on('click' + eventNamespace, selector.approve, module.event.approve)
|
370
|
-
.on('click' + eventNamespace, selector.deny, module.event.deny)
|
371
|
-
;
|
353
|
+
.on('click' + eventNamespace, selector.deny, module.event.deny);
|
372
354
|
$closeIcon
|
373
|
-
.on('keyup' + elementNamespace, module.event.closeKeyUp)
|
374
|
-
;
|
355
|
+
.on('keyup' + elementNamespace, module.event.closeKeyUp);
|
375
356
|
$window
|
376
|
-
.on('focus' + elementNamespace, module.event.focus)
|
377
|
-
;
|
357
|
+
.on('focus' + elementNamespace, module.event.focus);
|
378
358
|
$context
|
379
|
-
.on('click' + elementNamespace, module.event.click)
|
380
|
-
;
|
359
|
+
.on('click' + elementNamespace, module.event.click);
|
381
360
|
},
|
382
361
|
clickaway: function () {
|
383
362
|
module.verbose('Adding clickaway events to context', $context);
|
384
363
|
$context
|
385
364
|
.on('click' + elementNamespace, module.event.clickaway)
|
386
|
-
.on('touchend' + elementNamespace, module.event.clickaway)
|
387
|
-
;
|
365
|
+
.on('touchend' + elementNamespace, module.event.clickaway);
|
388
366
|
},
|
389
367
|
scrollLock: function () {
|
390
368
|
if (settings.scrollLock) {
|
@@ -398,11 +376,9 @@
|
|
398
376
|
}
|
399
377
|
module.verbose('Adding events to contain flyout scroll');
|
400
378
|
$document
|
401
|
-
.on('touchmove' + elementNamespace, module.event.touch)
|
402
|
-
;
|
379
|
+
.on('touchmove' + elementNamespace, module.event.touch);
|
403
380
|
$module
|
404
|
-
.on('scroll' + eventNamespace, module.event.containScroll)
|
405
|
-
;
|
381
|
+
.on('scroll' + eventNamespace, module.event.containScroll);
|
406
382
|
},
|
407
383
|
},
|
408
384
|
unbind: {
|
@@ -423,19 +399,17 @@
|
|
423
399
|
|
424
400
|
add: {
|
425
401
|
inlineCSS: function () {
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
style
|
438
|
-
;
|
402
|
+
let width = module.cache.width || $module.outerWidth();
|
403
|
+
let height = module.cache.height || $module.outerHeight();
|
404
|
+
let isRTL = module.is.rtl();
|
405
|
+
let direction = module.get.direction();
|
406
|
+
let distance = {
|
407
|
+
left: width,
|
408
|
+
right: -width,
|
409
|
+
top: height,
|
410
|
+
bottom: -height,
|
411
|
+
};
|
412
|
+
let style;
|
439
413
|
|
440
414
|
if (isRTL) {
|
441
415
|
module.verbose('RTL detected, flipping widths');
|
@@ -462,65 +436,60 @@
|
|
462
436
|
|
463
437
|
style += '</style>';
|
464
438
|
$style = $(style)
|
465
|
-
.appendTo($head)
|
466
|
-
;
|
439
|
+
.appendTo($head);
|
467
440
|
module.debug('Adding sizing css to head', $style);
|
468
441
|
},
|
469
442
|
keyboardShortcuts: function () {
|
470
443
|
module.verbose('Adding keyboard shortcuts');
|
471
444
|
$document
|
472
|
-
.on('keydown' + eventNamespace, module.event.keyboard)
|
473
|
-
;
|
445
|
+
.on('keydown' + eventNamespace, module.event.keyboard);
|
474
446
|
},
|
475
447
|
},
|
476
448
|
observeChanges: function () {
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
}
|
449
|
+
observer = new MutationObserver(function (mutations) {
|
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
|
-
|
491
|
-
|
492
|
-
if (mutation.
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
ignoreAutofocus = false;
|
505
|
-
}
|
457
|
+
return nodes;
|
458
|
+
};
|
459
|
+
let shouldRefreshInputs = false;
|
460
|
+
let ignoreAutofocus = true;
|
461
|
+
mutations.every(function (mutation) {
|
462
|
+
if (mutation.type === 'attributes') {
|
463
|
+
if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
|
464
|
+
shouldRefreshInputs = true;
|
465
|
+
}
|
466
|
+
} else {
|
467
|
+
// mutationobserver only provides the parent nodes,
|
468
|
+
// so let's collect all childs as well to find nested inputs
|
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');
|
471
|
+
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
|
472
|
+
shouldRefreshInputs = true;
|
473
|
+
if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
|
474
|
+
ignoreAutofocus = false;
|
506
475
|
}
|
507
476
|
}
|
508
|
-
|
509
|
-
return !shouldRefreshInputs;
|
510
|
-
});
|
511
|
-
|
512
|
-
if (shouldRefreshInputs) {
|
513
|
-
module.refreshInputs(ignoreAutofocus);
|
514
477
|
}
|
478
|
+
|
479
|
+
return !shouldRefreshInputs;
|
515
480
|
});
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
481
|
+
|
482
|
+
if (shouldRefreshInputs) {
|
483
|
+
module.refreshInputs(ignoreAutofocus);
|
484
|
+
}
|
485
|
+
});
|
486
|
+
observer.observe(element, {
|
487
|
+
attributeFilter: ['class', 'disabled'],
|
488
|
+
attributes: true,
|
489
|
+
childList: true,
|
490
|
+
subtree: true,
|
491
|
+
});
|
492
|
+
module.debug('Setting up mutation observer', observer);
|
524
493
|
},
|
525
494
|
refresh: function () {
|
526
495
|
module.verbose('Refreshing selector cache');
|
@@ -538,8 +507,7 @@
|
|
538
507
|
refreshInputs: function (ignoreAutofocus) {
|
539
508
|
if ($inputs) {
|
540
509
|
$inputs
|
541
|
-
.off('keydown' + elementNamespace)
|
542
|
-
;
|
510
|
+
.off('keydown' + elementNamespace);
|
543
511
|
}
|
544
512
|
if (!settings.dimPage) {
|
545
513
|
return;
|
@@ -554,11 +522,9 @@
|
|
554
522
|
$module.removeAttr('tabindex');
|
555
523
|
}
|
556
524
|
$inputs.first()
|
557
|
-
.on('keydown' + elementNamespace, module.event.inputKeyDown.first)
|
558
|
-
;
|
525
|
+
.on('keydown' + elementNamespace, module.event.inputKeyDown.first);
|
559
526
|
$inputs.last()
|
560
|
-
.on('keydown' + elementNamespace, module.event.inputKeyDown.last)
|
561
|
-
;
|
527
|
+
.on('keydown' + elementNamespace, module.event.inputKeyDown.last);
|
562
528
|
if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
|
563
529
|
module.set.autofocus();
|
564
530
|
}
|
@@ -580,8 +546,7 @@
|
|
580
546
|
.children()
|
581
547
|
.not(selector.omitted)
|
582
548
|
.not($flyouts)
|
583
|
-
.wrapAll($pusher)
|
584
|
-
;
|
549
|
+
.wrapAll($pusher);
|
585
550
|
module.refresh();
|
586
551
|
}
|
587
552
|
if ($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
|
@@ -599,12 +564,10 @@
|
|
599
564
|
},
|
600
565
|
heights: function () {
|
601
566
|
module.debug('Setting up heights', $module);
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
newContentHeight = ($context.height() || 0) - ($header.outerHeight() || 0) - ($actions.outerHeight() || 0)
|
607
|
-
;
|
567
|
+
let $header = $module.children(selector.header);
|
568
|
+
let $content = $module.children(selector.content);
|
569
|
+
let $actions = $module.children(selector.actions);
|
570
|
+
let newContentHeight = ($context.height() || 0) - ($header.outerHeight() || 0) - ($actions.outerHeight() || 0);
|
608
571
|
if (newContentHeight > 0) {
|
609
572
|
$content.css('min-height', String(newContentHeight) + 'px');
|
610
573
|
}
|
@@ -612,17 +575,14 @@
|
|
612
575
|
},
|
613
576
|
|
614
577
|
attachEvents: function (selector, event) {
|
615
|
-
|
616
|
-
$toggle = $(selector)
|
617
|
-
;
|
578
|
+
let $toggle = $(selector);
|
618
579
|
event = isFunction(module[event])
|
619
580
|
? module[event]
|
620
581
|
: module.toggle;
|
621
582
|
if ($toggle.length > 0) {
|
622
583
|
module.debug('Attaching flyout events to element', selector, event);
|
623
584
|
$toggle
|
624
|
-
.on('click' + eventNamespace, event)
|
625
|
-
;
|
585
|
+
.on('click' + eventNamespace, event);
|
626
586
|
} else {
|
627
587
|
module.error(error.notFound, selector);
|
628
588
|
}
|
@@ -701,11 +661,9 @@
|
|
701
661
|
},
|
702
662
|
|
703
663
|
hideOthers: function (callback) {
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
callbackCount = 0
|
708
|
-
;
|
664
|
+
let $otherFlyouts = $flyouts.not($module).filter('.' + className.visible);
|
665
|
+
let flyoutCount = $otherFlyouts.length;
|
666
|
+
let callbackCount = 0;
|
709
667
|
callback = callback || function () {};
|
710
668
|
$otherFlyouts
|
711
669
|
.flyout('hide', function () {
|
@@ -713,8 +671,7 @@
|
|
713
671
|
if (callbackCount === flyoutCount) {
|
714
672
|
callback();
|
715
673
|
}
|
716
|
-
})
|
717
|
-
;
|
674
|
+
});
|
718
675
|
},
|
719
676
|
|
720
677
|
toggle: function () {
|
@@ -727,11 +684,9 @@
|
|
727
684
|
},
|
728
685
|
|
729
686
|
pushPage: function (callback) {
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
transitionEnd
|
734
|
-
;
|
687
|
+
let animate;
|
688
|
+
let dim;
|
689
|
+
let transitionEnd;
|
735
690
|
callback = isFunction(callback)
|
736
691
|
? callback
|
737
692
|
: function () {};
|
@@ -765,10 +720,8 @@
|
|
765
720
|
},
|
766
721
|
|
767
722
|
pullPage: function (callback) {
|
768
|
-
|
769
|
-
|
770
|
-
transitionEnd
|
771
|
-
;
|
723
|
+
let animate;
|
724
|
+
let transitionEnd;
|
772
725
|
callback = isFunction(callback)
|
773
726
|
? callback
|
774
727
|
: function () {};
|
@@ -834,16 +787,14 @@
|
|
834
787
|
observeAttributes = state !== false;
|
835
788
|
},
|
836
789
|
autofocus: function () {
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
).first()
|
846
|
-
;
|
790
|
+
let $autofocus = $inputs.filter('[autofocus]');
|
791
|
+
let $rawInputs = $inputs.filter(':input');
|
792
|
+
let $input = ($autofocus.length > 0
|
793
|
+
? $autofocus
|
794
|
+
: ($rawInputs.length > 0
|
795
|
+
? $rawInputs
|
796
|
+
: $module)
|
797
|
+
).first();
|
847
798
|
$input.trigger('focus');
|
848
799
|
},
|
849
800
|
dimmerStyles: function () {
|
@@ -854,13 +805,11 @@
|
|
854
805
|
}
|
855
806
|
},
|
856
807
|
bodyMargin: function () {
|
857
|
-
|
808
|
+
let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
858
809
|
$context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
|
859
810
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
860
|
-
|
861
|
-
|
862
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
863
|
-
;
|
811
|
+
let el = $(this);
|
812
|
+
let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
864
813
|
el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
|
865
814
|
});
|
866
815
|
},
|
@@ -910,8 +859,7 @@
|
|
910
859
|
keyboardShortcuts: function () {
|
911
860
|
module.verbose('Removing keyboard shortcuts');
|
912
861
|
$document
|
913
|
-
.off('keydown' + eventNamespace)
|
914
|
-
;
|
862
|
+
.off('keydown' + eventNamespace);
|
915
863
|
},
|
916
864
|
|
917
865
|
// context
|
@@ -981,21 +929,17 @@
|
|
981
929
|
|
982
930
|
save: {
|
983
931
|
focus: function () {
|
984
|
-
|
985
|
-
|
986
|
-
inCurrentFlyout = $activeElement.closest($module).length > 0
|
987
|
-
;
|
932
|
+
let $activeElement = $(document.activeElement);
|
933
|
+
let inCurrentFlyout = $activeElement.closest($module).length > 0;
|
988
934
|
if (!inCurrentFlyout) {
|
989
935
|
$focusedElement = $(document.activeElement).trigger('blur');
|
990
936
|
}
|
991
937
|
},
|
992
938
|
bodyMargin: function () {
|
993
939
|
initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
;
|
998
|
-
tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
|
940
|
+
initialBodyMarginInt = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10);
|
941
|
+
let bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
|
942
|
+
tempBodyMargin = initialBodyMarginInt + bodyScrollbarWidth;
|
999
943
|
},
|
1000
944
|
},
|
1001
945
|
|
@@ -1018,10 +962,8 @@
|
|
1018
962
|
return !(self === top);
|
1019
963
|
},
|
1020
964
|
mobile: function () {
|
1021
|
-
|
1022
|
-
|
1023
|
-
isMobile = userAgent.match(regExp.mobile)
|
1024
|
-
;
|
965
|
+
let userAgent = navigator.userAgent;
|
966
|
+
let isMobile = userAgent.match(regExp.mobile);
|
1025
967
|
if (isMobile) {
|
1026
968
|
module.verbose('Browser was found to be mobile', userAgent);
|
1027
969
|
|
@@ -1066,47 +1008,31 @@
|
|
1066
1008
|
}
|
1067
1009
|
},
|
1068
1010
|
bodyMargin: function () {
|
1069
|
-
|
1070
|
-
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
|
1011
|
+
let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
1012
|
+
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMarginInt === 0 ? '' : initialBodyMargin);
|
1071
1013
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
1072
|
-
|
1073
|
-
|
1074
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
1075
|
-
;
|
1014
|
+
let el = $(this);
|
1015
|
+
let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
1076
1016
|
el.css(attribute, '');
|
1077
1017
|
});
|
1078
1018
|
},
|
1079
1019
|
},
|
1080
1020
|
|
1081
1021
|
helpers: {
|
1082
|
-
|
1083
|
-
|
1084
|
-
},
|
1085
|
-
escape: function (string, preserveHTML) {
|
1086
|
-
if (preserveHTML) {
|
1022
|
+
escape: function (string, settings) {
|
1023
|
+
if (settings !== undefined && settings.preserveHTML) {
|
1087
1024
|
return string;
|
1088
1025
|
}
|
1089
|
-
var
|
1090
|
-
badChars = /["'<>`]/g,
|
1091
|
-
shouldEscape = /["&'<>`]/,
|
1092
|
-
escape = {
|
1093
|
-
'<': '<',
|
1094
|
-
'>': '>',
|
1095
|
-
'"': '"',
|
1096
|
-
"'": ''',
|
1097
|
-
'`': '`',
|
1098
|
-
},
|
1099
|
-
escapedChar = function (chr) {
|
1100
|
-
return escape[chr];
|
1101
|
-
}
|
1102
|
-
;
|
1103
|
-
if (shouldEscape.test(string)) {
|
1104
|
-
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');
|
1105
1026
|
|
1106
|
-
|
1107
|
-
|
1027
|
+
const escapeMap = {
|
1028
|
+
'"': '"',
|
1029
|
+
'&': '&',
|
1030
|
+
"'": ''',
|
1031
|
+
'<': '<',
|
1032
|
+
'>': '>',
|
1033
|
+
};
|
1108
1034
|
|
1109
|
-
return string;
|
1035
|
+
return String(string).replace(/["&'<>]/g, (chr) => escapeMap[chr]);
|
1110
1036
|
},
|
1111
1037
|
},
|
1112
1038
|
|
@@ -1161,11 +1087,9 @@
|
|
1161
1087
|
},
|
1162
1088
|
performance: {
|
1163
1089
|
log: function (message) {
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
previousTime
|
1168
|
-
;
|
1090
|
+
let currentTime;
|
1091
|
+
let executionTime;
|
1092
|
+
let previousTime;
|
1169
1093
|
if (settings.performance) {
|
1170
1094
|
currentTime = Date.now();
|
1171
1095
|
previousTime = time || currentTime;
|
@@ -1184,10 +1108,8 @@
|
|
1184
1108
|
}, 500);
|
1185
1109
|
},
|
1186
1110
|
display: function () {
|
1187
|
-
|
1188
|
-
|
1189
|
-
totalTime = 0
|
1190
|
-
;
|
1111
|
+
let title = settings.name + ':';
|
1112
|
+
let totalTime = 0;
|
1191
1113
|
time = false;
|
1192
1114
|
clearTimeout(module.performance.timer);
|
1193
1115
|
$.each(performance, function (index, data) {
|
@@ -1209,22 +1131,19 @@
|
|
1209
1131
|
},
|
1210
1132
|
},
|
1211
1133
|
invoke: function (query, passedArguments, context) {
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
response
|
1217
|
-
;
|
1134
|
+
let object = instance;
|
1135
|
+
let maxDepth;
|
1136
|
+
let found;
|
1137
|
+
let response;
|
1218
1138
|
passedArguments = passedArguments || queryArguments;
|
1219
1139
|
context = element || context;
|
1220
1140
|
if (typeof query === 'string' && object !== undefined) {
|
1221
1141
|
query = query.split(/[ .]/);
|
1222
1142
|
maxDepth = query.length - 1;
|
1223
1143
|
$.each(query, function (depth, value) {
|
1224
|
-
|
1144
|
+
let camelCaseValue = depth !== maxDepth
|
1225
1145
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
1226
|
-
: query
|
1227
|
-
;
|
1146
|
+
: query;
|
1228
1147
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
1229
1148
|
object = object[camelCaseValue];
|
1230
1149
|
} else if (object[camelCaseValue] !== undefined) {
|
@@ -1416,7 +1335,7 @@
|
|
1416
1335
|
|
1417
1336
|
$.fn.flyout.settings.templates = {
|
1418
1337
|
getArguments: function (args) {
|
1419
|
-
|
1338
|
+
let queryArguments = [].slice.call(args);
|
1420
1339
|
if ($.isPlainObject(queryArguments[0])) {
|
1421
1340
|
return $.extend({
|
1422
1341
|
handler: function () {},
|
@@ -1435,10 +1354,8 @@
|
|
1435
1354
|
};
|
1436
1355
|
},
|
1437
1356
|
alert: function () {
|
1438
|
-
|
1439
|
-
|
1440
|
-
args = settings.templates.getArguments(arguments)
|
1441
|
-
;
|
1357
|
+
let settings = this.get.settings();
|
1358
|
+
let args = settings.templates.getArguments(arguments);
|
1442
1359
|
|
1443
1360
|
return {
|
1444
1361
|
title: args.title,
|
@@ -1451,10 +1368,8 @@
|
|
1451
1368
|
};
|
1452
1369
|
},
|
1453
1370
|
confirm: function () {
|
1454
|
-
|
1455
|
-
|
1456
|
-
args = settings.templates.getArguments(arguments)
|
1457
|
-
;
|
1371
|
+
let settings = this.get.settings();
|
1372
|
+
let args = settings.templates.getArguments(arguments);
|
1458
1373
|
|
1459
1374
|
return {
|
1460
1375
|
title: args.title,
|
@@ -1475,14 +1390,12 @@
|
|
1475
1390
|
};
|
1476
1391
|
},
|
1477
1392
|
prompt: function () {
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
input = $($.parseHTML(args.content)).filter('.ui.input')
|
1483
|
-
;
|
1393
|
+
let $this = this;
|
1394
|
+
let settings = this.get.settings();
|
1395
|
+
let args = settings.templates.getArguments(arguments);
|
1396
|
+
let input = $($.parseHTML(args.content)).filter('.ui.input');
|
1484
1397
|
if (input.length === 0) {
|
1485
|
-
args.content += '<p><div class="' + settings.className.prompt + '"><input placeholder="' + this.helpers.
|
1398
|
+
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>';
|
1486
1399
|
}
|
1487
1400
|
|
1488
1401
|
return {
|
@@ -1492,10 +1405,8 @@
|
|
1492
1405
|
text: settings.text.ok,
|
1493
1406
|
class: settings.className.ok,
|
1494
1407
|
click: function () {
|
1495
|
-
|
1496
|
-
|
1497
|
-
inputField = $this.get.element().find(settings.selector.prompt)[0]
|
1498
|
-
;
|
1408
|
+
let settings = $this.get.settings();
|
1409
|
+
let inputField = $this.get.element().find(settings.selector.prompt)[0];
|
1499
1410
|
args.handler($(inputField).val());
|
1500
1411
|
},
|
1501
1412
|
}, {
|