fomantic-ui 2.10.0-beta.7 → 2.10.0-beta.70
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 +6 -33
- package/.github/workflows/ci.yml +9 -9
- package/.github/workflows/depsreview.yml +1 -1
- package/.github/workflows/nightly.yml +7 -5
- package/.github/workflows/release.yml +2 -2
- package/.stylelintrc.js +1 -15
- package/CHANGELOG.md +5289 -2325
- package/README.md +11 -8
- package/changelog-setup.js +88 -72
- package/changelog-template.hbs +256 -251
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +116 -164
- 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 +190 -303
- 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 +5 -6
- package/dist/components/button.min.css +2 -2
- package/dist/components/calendar.css +3 -3
- package/dist/components/calendar.js +397 -482
- package/dist/components/calendar.min.css +2 -2
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +105 -166
- 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 +2 -2
- package/dist/components/dimmer.js +75 -121
- package/dist/components/dimmer.min.css +2 -2
- 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 +21 -35
- package/dist/components/dropdown.js +775 -1161
- 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 +95 -146
- 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 +242 -336
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +3 -5
- package/dist/components/form.js +425 -554
- package/dist/components/form.min.css +2 -2
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +2 -2
- package/dist/components/grid.min.css +2 -2
- package/dist/components/header.css +6 -6
- package/dist/components/header.min.css +2 -2
- package/dist/components/icon.css +10 -37
- package/dist/components/icon.min.css +2 -2
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +284 -12
- package/dist/components/input.min.css +2 -2
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +6 -14
- package/dist/components/label.min.css +2 -2
- package/dist/components/list.css +3 -3
- package/dist/components/list.min.css +2 -2
- package/dist/components/loader.css +53 -53
- package/dist/components/loader.min.css +2 -2
- package/dist/components/menu.css +45 -60
- package/dist/components/menu.min.css +2 -2
- package/dist/components/message.css +2 -2
- package/dist/components/message.min.css +2 -2
- package/dist/components/modal.css +5 -5
- package/dist/components/modal.js +274 -369
- 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 +109 -153
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +2 -2
- package/dist/components/placeholder.min.css +2 -2
- package/dist/components/popup.css +19 -73
- package/dist/components/popup.js +210 -303
- package/dist/components/popup.min.css +2 -2
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +4 -13
- package/dist/components/progress.js +128 -185
- package/dist/components/progress.min.css +2 -2
- 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 +92 -145
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +48 -208
- package/dist/components/reset.min.css +2 -2
- package/dist/components/reveal.css +2 -5
- package/dist/components/reveal.min.css +2 -2
- package/dist/components/search.css +2 -3
- package/dist/components/search.js +311 -425
- package/dist/components/search.min.css +2 -2
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +6 -6
- package/dist/components/segment.min.css +2 -2
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +173 -249
- 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 +138 -199
- 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 +59 -99
- 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 +267 -364
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +88 -132
- 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 +4 -4
- package/dist/components/step.min.css +2 -2
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +163 -228
- 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 +192 -287
- 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 +118 -155
- 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 +114 -193
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +175 -271
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +4479 -8221
- package/dist/semantic.js +5023 -7182
- 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 +4 -5
- package/scripts/nightly-version.js +11 -14
- package/src/definitions/behaviors/api.js +189 -302
- package/src/definitions/behaviors/form.js +426 -555
- package/src/definitions/behaviors/state.js +87 -131
- package/src/definitions/behaviors/visibility.js +174 -270
- package/src/definitions/collections/breadcrumb.less +0 -1
- package/src/definitions/collections/form.less +3 -9
- package/src/definitions/collections/grid.less +1 -2
- package/src/definitions/collections/menu.less +106 -117
- package/src/definitions/collections/message.less +1 -2
- package/src/definitions/collections/table.less +7 -8
- package/src/definitions/elements/button.less +4 -6
- package/src/definitions/elements/container.less +0 -1
- package/src/definitions/elements/divider.less +1 -2
- package/src/definitions/elements/emoji.less +1 -1
- package/src/definitions/elements/flag.less +1 -1
- package/src/definitions/elements/header.less +4 -5
- package/src/definitions/elements/icon.less +10 -37
- package/src/definitions/elements/image.less +0 -1
- package/src/definitions/elements/input.less +4 -7
- package/src/definitions/elements/label.less +5 -14
- package/src/definitions/elements/list.less +2 -3
- package/src/definitions/elements/loader.less +10 -11
- package/src/definitions/elements/placeholder.less +1 -2
- package/src/definitions/elements/rail.less +0 -1
- package/src/definitions/elements/reveal.less +1 -5
- package/src/definitions/elements/segment.less +5 -6
- package/src/definitions/elements/step.less +3 -4
- package/src/definitions/elements/text.less +0 -1
- package/src/definitions/globals/reset.less +0 -1
- package/src/definitions/globals/site.js +58 -98
- package/src/definitions/globals/site.less +0 -1
- package/src/definitions/modules/accordion.js +115 -163
- package/src/definitions/modules/accordion.less +0 -1
- package/src/definitions/modules/calendar.js +396 -481
- package/src/definitions/modules/calendar.less +2 -3
- package/src/definitions/modules/checkbox.js +104 -165
- package/src/definitions/modules/checkbox.less +0 -1
- package/src/definitions/modules/dimmer.js +74 -120
- package/src/definitions/modules/dimmer.less +1 -2
- package/src/definitions/modules/dropdown.js +774 -1160
- package/src/definitions/modules/dropdown.less +27 -38
- package/src/definitions/modules/embed.js +94 -145
- package/src/definitions/modules/embed.less +0 -1
- package/src/definitions/modules/flyout.js +241 -335
- package/src/definitions/modules/flyout.less +0 -1
- package/src/definitions/modules/modal.js +273 -368
- package/src/definitions/modules/modal.less +3 -4
- package/src/definitions/modules/nag.js +108 -152
- package/src/definitions/modules/nag.less +0 -1
- package/src/definitions/modules/popup.js +209 -302
- package/src/definitions/modules/popup.less +18 -73
- package/src/definitions/modules/progress.js +127 -184
- package/src/definitions/modules/progress.less +3 -13
- package/src/definitions/modules/rating.js +93 -146
- package/src/definitions/modules/rating.less +0 -1
- package/src/definitions/modules/search.js +312 -426
- package/src/definitions/modules/search.less +2 -4
- package/src/definitions/modules/shape.js +172 -248
- package/src/definitions/modules/shape.less +0 -1
- package/src/definitions/modules/sidebar.js +137 -198
- package/src/definitions/modules/sidebar.less +0 -1
- package/src/definitions/modules/slider.js +266 -363
- package/src/definitions/modules/slider.less +0 -1
- package/src/definitions/modules/sticky.js +162 -227
- package/src/definitions/modules/sticky.less +0 -1
- package/src/definitions/modules/tab.js +191 -286
- package/src/definitions/modules/tab.less +0 -1
- package/src/definitions/modules/toast.js +117 -154
- package/src/definitions/modules/toast.less +0 -1
- package/src/definitions/modules/transition.js +113 -192
- package/src/definitions/modules/transition.less +1 -2
- package/src/definitions/views/ad.less +0 -1
- package/src/definitions/views/card.less +0 -1
- package/src/definitions/views/comment.less +0 -1
- package/src/definitions/views/feed.less +0 -1
- package/src/definitions/views/item.less +0 -1
- package/src/definitions/views/statistic.less +0 -1
- package/src/semantic.less +1 -1
- package/src/themes/amazon/elements/button.overrides +1 -1
- package/src/themes/amazon/elements/button.variables +5 -6
- package/src/themes/amazon/globals/site.variables +2 -3
- package/src/themes/bookish/elements/header.variables +2 -2
- package/src/themes/bootstrap3/elements/button.variables +4 -5
- package/src/themes/chubby/collections/menu.variables +1 -1
- package/src/themes/chubby/elements/button.overrides +4 -4
- package/src/themes/chubby/modules/accordion.overrides +1 -1
- package/src/themes/chubby/views/comment.overrides +2 -2
- package/src/themes/chubby/views/comment.variables +2 -2
- package/src/themes/classic/collections/table.variables +2 -2
- package/src/themes/classic/elements/button.variables +11 -11
- package/src/themes/classic/modules/progress.variables +2 -2
- package/src/themes/classic/views/card.variables +2 -2
- package/src/themes/default/collections/form.variables +2 -3
- package/src/themes/default/collections/menu.variables +28 -28
- package/src/themes/default/collections/message.variables +1 -1
- package/src/themes/default/collections/table.variables +4 -4
- package/src/themes/default/elements/button.variables +9 -10
- package/src/themes/default/elements/divider.variables +1 -1
- package/src/themes/default/elements/icon.variables +2 -2
- package/src/themes/default/elements/image.variables +1 -1
- package/src/themes/default/elements/input.variables +2 -2
- package/src/themes/default/elements/label.variables +4 -4
- package/src/themes/default/elements/list.variables +1 -1
- package/src/themes/default/elements/placeholder.variables +6 -6
- package/src/themes/default/elements/segment.variables +8 -8
- package/src/themes/default/globals/reset.overrides +45 -201
- package/src/themes/default/globals/site.variables +50 -50
- package/src/themes/default/globals/variation.variables +3 -2
- package/src/themes/default/modules/accordion.variables +0 -1
- package/src/themes/default/modules/checkbox.variables +1 -1
- package/src/themes/default/modules/dimmer.variables +12 -12
- package/src/themes/default/modules/dropdown.variables +17 -16
- package/src/themes/default/modules/embed.variables +2 -2
- package/src/themes/default/modules/flyout.variables +3 -3
- package/src/themes/default/modules/modal.variables +14 -14
- package/src/themes/default/modules/nag.variables +1 -1
- package/src/themes/default/modules/rating.variables +1 -1
- package/src/themes/default/modules/search.variables +1 -1
- package/src/themes/default/modules/shape.variables +1 -1
- package/src/themes/default/modules/sidebar.variables +2 -2
- package/src/themes/default/modules/toast.variables +4 -4
- package/src/themes/default/views/card.variables +6 -7
- package/src/themes/default/views/feed.variables +4 -4
- package/src/themes/default/views/item.variables +2 -3
- package/src/themes/flat/collections/form.variables +1 -1
- package/src/themes/flat/globals/site.variables +9 -9
- package/src/themes/github/collections/form.overrides +3 -3
- package/src/themes/github/collections/form.variables +3 -3
- package/src/themes/github/collections/menu.overrides +1 -1
- package/src/themes/github/collections/menu.variables +10 -10
- package/src/themes/github/collections/message.variables +6 -6
- package/src/themes/github/elements/button.variables +17 -17
- package/src/themes/github/elements/input.variables +3 -3
- package/src/themes/github/elements/segment.variables +2 -2
- package/src/themes/github/elements/step.overrides +4 -4
- package/src/themes/github/elements/step.variables +3 -3
- package/src/themes/github/globals/site.variables +2 -2
- package/src/themes/github/modules/dropdown.variables +1 -3
- package/src/themes/gmail/collections/message.variables +2 -2
- package/src/themes/material/collections/menu.variables +1 -1
- package/src/themes/material/elements/button.overrides +4 -4
- package/src/themes/material/elements/button.variables +5 -5
- package/src/themes/material/modules/dropdown.variables +1 -1
- package/src/themes/material/modules/modal.variables +1 -1
- package/src/themes/raised/elements/button.variables +1 -1
- package/src/themes/round/elements/button.variables +12 -12
- package/src/themes/striped/modules/progress.overrides +3 -3
- package/src/themes/timeline/views/feed.variables +2 -2
- package/src/themes/twitter/elements/button.overrides +1 -1
- package/src/themes/twitter/elements/button.variables +4 -5
- package/tasks/admin/components/create.js +87 -110
- package/tasks/admin/components/init.js +26 -33
- package/tasks/admin/components/update.js +46 -54
- package/tasks/admin/distributions/create.js +74 -125
- package/tasks/admin/distributions/init.js +27 -34
- package/tasks/admin/distributions/update.js +45 -53
- package/tasks/admin/register.js +11 -15
- package/tasks/build/assets.js +14 -18
- package/tasks/build/css.js +59 -68
- package/tasks/build/javascript.js +46 -54
- 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 +8 -10
- 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 +26 -34
- package/tasks/config/project/install.js +58 -72
- package/tasks/config/project/release.js +7 -15
- package/tasks/config/tasks.js +23 -24
- package/tasks/config/user.js +9 -16
- package/tasks/docs/build.js +26 -31
- package/tasks/docs/metadata.js +35 -43
- package/tasks/docs/serve.js +20 -26
- package/tasks/install.js +77 -102
- package/tasks/rtl/build.js +2 -4
- package/tasks/rtl/watch.js +2 -4
- package/tasks/watch.js +9 -11
- package/test/meteor/assets.js +4 -4
- package/test/meteor/fonts.js +11 -13
- package/test/modules/module.spec.js +25 -27
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
|
2
|
+
* # Fomantic-UI 2.10.0-beta.70+88a499a - Flyout
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
|
4
4
|
*
|
|
5
5
|
*
|
|
@@ -19,85 +19,80 @@
|
|
|
19
19
|
? window
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
|
-
$.fn.flyout = function (
|
|
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
|
-
}
|
|
22
|
+
$.fn.flyout = function (...args) {
|
|
23
|
+
const $allModules = $(this);
|
|
24
|
+
const $window = $(window);
|
|
25
|
+
const $document = $(document);
|
|
26
|
+
const $html = $('html');
|
|
27
|
+
const $head = $('head');
|
|
28
|
+
const $body = $('body');
|
|
29
|
+
|
|
30
|
+
let time = Date.now();
|
|
31
|
+
let performance = [];
|
|
32
|
+
|
|
33
|
+
const parameters = args[0];
|
|
34
|
+
const methodInvoked = typeof parameters === 'string';
|
|
35
|
+
const queryArguments = args.slice(1);
|
|
36
|
+
const contextCheck = function (context, win) {
|
|
37
|
+
let $context;
|
|
38
|
+
if ([window, document].includes(context)) {
|
|
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
|
-
;
|
|
99
|
-
|
|
100
|
-
module = {
|
|
52
|
+
let settings = $.isPlainObject(parameters)
|
|
53
|
+
? $.extend(true, {}, $.fn.flyout.settings, parameters)
|
|
54
|
+
: $.extend({}, $.fn.flyout.settings);
|
|
55
|
+
|
|
56
|
+
const selector = settings.selector;
|
|
57
|
+
let className = settings.className;
|
|
58
|
+
let namespace = settings.namespace;
|
|
59
|
+
let fields = settings.fields;
|
|
60
|
+
const regExp = settings.regExp;
|
|
61
|
+
let error = settings.error;
|
|
62
|
+
|
|
63
|
+
const eventNamespace = '.' + namespace;
|
|
64
|
+
const 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
|
+
const isFlyoutComponent = $module.hasClass('flyout');
|
|
77
|
+
|
|
78
|
+
let element = this;
|
|
79
|
+
let instance = isFlyoutComponent ? $module.data(moduleNamespace) : undefined;
|
|
80
|
+
|
|
81
|
+
let ignoreRepeatedEvents = false;
|
|
82
|
+
const 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
|
+
const module = {
|
|
101
96
|
|
|
102
97
|
initialize: function () {
|
|
103
98
|
module.debug('Initializing flyout', parameters);
|
|
@@ -123,37 +118,37 @@
|
|
|
123
118
|
$module.find(selector.content).html(module.helpers.escape(settings.content, settings)).addClass(settings.classContent);
|
|
124
119
|
}
|
|
125
120
|
if (module.has.configActions()) {
|
|
126
|
-
|
|
121
|
+
let $actions = $module.find(selector.actions).addClass(settings.classActions);
|
|
127
122
|
if ($actions.length === 0) {
|
|
128
123
|
$actions = $('<div/>', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($module);
|
|
129
124
|
} else {
|
|
130
125
|
$actions.empty();
|
|
131
126
|
}
|
|
132
|
-
settings.actions
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
;
|
|
127
|
+
for (const el of settings.actions) {
|
|
128
|
+
const icon = el[fields.icon]
|
|
129
|
+
? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.escape(el[fields.icon]) + ' icon"></i>'
|
|
130
|
+
: '';
|
|
131
|
+
const text = module.helpers.escape(el[fields.text] || '', settings);
|
|
132
|
+
const cls = module.helpers.escape(el[fields.class] || '');
|
|
133
|
+
const click = el[fields.click] && isFunction(el[fields.click])
|
|
134
|
+
? el[fields.click]
|
|
135
|
+
: function () {};
|
|
136
|
+
const elementRef = element;
|
|
137
|
+
const $moduleRef = $module;
|
|
143
138
|
$actions.append($('<button/>', {
|
|
144
139
|
html: icon + text,
|
|
145
140
|
'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g, ''),
|
|
146
141
|
class: className.button + ' ' + cls,
|
|
147
142
|
on: {
|
|
148
143
|
click: function () {
|
|
149
|
-
if (click.call(
|
|
144
|
+
if (click.call(elementRef, $moduleRef) === false) {
|
|
150
145
|
return;
|
|
151
146
|
}
|
|
152
147
|
module.hide();
|
|
153
148
|
},
|
|
154
149
|
},
|
|
155
150
|
}));
|
|
156
|
-
}
|
|
151
|
+
}
|
|
157
152
|
}
|
|
158
153
|
|
|
159
154
|
// avoids locking rendering if initialized in onReady
|
|
@@ -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
|
+
const 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
|
+
const 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
|
+
const 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
|
+
const clickedInPusher = $pusher.find(event.target).length > 0 || $pusher.is(event.target);
|
|
267
|
+
const 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
|
+
const 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
|
+
const 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
|
+
const 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
|
+
const width = module.cache.width || $module.outerWidth();
|
|
403
|
+
const height = module.cache.height || $module.outerHeight();
|
|
404
|
+
const isRTL = module.is.rtl();
|
|
405
|
+
const direction = module.get.direction();
|
|
406
|
+
const 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,59 @@
|
|
|
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
|
-
nodes.push(parent[c]);
|
|
484
|
-
}
|
|
449
|
+
observer = new MutationObserver(function (mutations) {
|
|
450
|
+
const collectNodes = function (parent) {
|
|
451
|
+
const nodes = [];
|
|
452
|
+
for (const c of parent) {
|
|
453
|
+
nodes.push(...collectNodes(c.childNodes), c);
|
|
454
|
+
}
|
|
485
455
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
if (mutation.
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
ignoreAutofocus = false;
|
|
505
|
-
}
|
|
456
|
+
return nodes;
|
|
457
|
+
};
|
|
458
|
+
let shouldRefreshInputs = false;
|
|
459
|
+
let ignoreAutofocus = true;
|
|
460
|
+
mutations.every(function (mutation) {
|
|
461
|
+
if (mutation.type === 'attributes') {
|
|
462
|
+
if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
|
|
463
|
+
shouldRefreshInputs = true;
|
|
464
|
+
}
|
|
465
|
+
} else {
|
|
466
|
+
// mutationobserver only provides the parent nodes,
|
|
467
|
+
// so let's collect all childs as well to find nested inputs
|
|
468
|
+
const $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible');
|
|
469
|
+
const $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
|
|
470
|
+
if ($addedInputs.length > 0 || $removedInputs.length > 0) {
|
|
471
|
+
shouldRefreshInputs = true;
|
|
472
|
+
if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
|
|
473
|
+
ignoreAutofocus = false;
|
|
506
474
|
}
|
|
507
475
|
}
|
|
508
|
-
|
|
509
|
-
return !shouldRefreshInputs;
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
if (shouldRefreshInputs) {
|
|
513
|
-
module.refreshInputs(ignoreAutofocus);
|
|
514
476
|
}
|
|
477
|
+
|
|
478
|
+
return !shouldRefreshInputs;
|
|
515
479
|
});
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
480
|
+
|
|
481
|
+
if (shouldRefreshInputs) {
|
|
482
|
+
module.refreshInputs(ignoreAutofocus);
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
observer.observe(element, {
|
|
486
|
+
attributeFilter: ['class', 'disabled'],
|
|
487
|
+
attributes: true,
|
|
488
|
+
childList: true,
|
|
489
|
+
subtree: true,
|
|
490
|
+
});
|
|
491
|
+
module.debug('Setting up mutation observer', observer);
|
|
524
492
|
},
|
|
525
493
|
refresh: function () {
|
|
526
494
|
module.verbose('Refreshing selector cache');
|
|
@@ -538,8 +506,7 @@
|
|
|
538
506
|
refreshInputs: function (ignoreAutofocus) {
|
|
539
507
|
if ($inputs) {
|
|
540
508
|
$inputs
|
|
541
|
-
.off('keydown' + elementNamespace)
|
|
542
|
-
;
|
|
509
|
+
.off('keydown' + elementNamespace);
|
|
543
510
|
}
|
|
544
511
|
if (!settings.dimPage) {
|
|
545
512
|
return;
|
|
@@ -554,11 +521,9 @@
|
|
|
554
521
|
$module.removeAttr('tabindex');
|
|
555
522
|
}
|
|
556
523
|
$inputs.first()
|
|
557
|
-
.on('keydown' + elementNamespace, module.event.inputKeyDown.first)
|
|
558
|
-
;
|
|
524
|
+
.on('keydown' + elementNamespace, module.event.inputKeyDown.first);
|
|
559
525
|
$inputs.last()
|
|
560
|
-
.on('keydown' + elementNamespace, module.event.inputKeyDown.last)
|
|
561
|
-
;
|
|
526
|
+
.on('keydown' + elementNamespace, module.event.inputKeyDown.last);
|
|
562
527
|
if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
|
|
563
528
|
module.set.autofocus();
|
|
564
529
|
}
|
|
@@ -580,8 +545,7 @@
|
|
|
580
545
|
.children()
|
|
581
546
|
.not(selector.omitted)
|
|
582
547
|
.not($flyouts)
|
|
583
|
-
.wrapAll($pusher)
|
|
584
|
-
;
|
|
548
|
+
.wrapAll($pusher);
|
|
585
549
|
module.refresh();
|
|
586
550
|
}
|
|
587
551
|
if ($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
|
|
@@ -599,12 +563,10 @@
|
|
|
599
563
|
},
|
|
600
564
|
heights: function () {
|
|
601
565
|
module.debug('Setting up heights', $module);
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
newContentHeight = ($context.height() || 0) - ($header.outerHeight() || 0) - ($actions.outerHeight() || 0)
|
|
607
|
-
;
|
|
566
|
+
const $header = $module.children(selector.header);
|
|
567
|
+
const $content = $module.children(selector.content);
|
|
568
|
+
const $actions = $module.children(selector.actions);
|
|
569
|
+
const newContentHeight = ($context.height() || 0) - ($header.outerHeight() || 0) - ($actions.outerHeight() || 0);
|
|
608
570
|
if (newContentHeight > 0) {
|
|
609
571
|
$content.css('min-height', String(newContentHeight) + 'px');
|
|
610
572
|
}
|
|
@@ -612,17 +574,14 @@
|
|
|
612
574
|
},
|
|
613
575
|
|
|
614
576
|
attachEvents: function (selector, event) {
|
|
615
|
-
|
|
616
|
-
$toggle = $(selector)
|
|
617
|
-
;
|
|
577
|
+
const $toggle = $(selector);
|
|
618
578
|
event = isFunction(module[event])
|
|
619
579
|
? module[event]
|
|
620
580
|
: module.toggle;
|
|
621
581
|
if ($toggle.length > 0) {
|
|
622
582
|
module.debug('Attaching flyout events to element', selector, event);
|
|
623
583
|
$toggle
|
|
624
|
-
.on('click' + eventNamespace, event)
|
|
625
|
-
;
|
|
584
|
+
.on('click' + eventNamespace, event);
|
|
626
585
|
} else {
|
|
627
586
|
module.error(error.notFound, selector);
|
|
628
587
|
}
|
|
@@ -700,21 +659,17 @@
|
|
|
700
659
|
return module.othersVisible() || module.othersAnimating();
|
|
701
660
|
},
|
|
702
661
|
|
|
703
|
-
hideOthers: function (callback) {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
callbackCount = 0
|
|
708
|
-
;
|
|
709
|
-
callback = callback || function () {};
|
|
662
|
+
hideOthers: function (callback = function () {}) {
|
|
663
|
+
const $otherFlyouts = $flyouts.not($module).filter('.' + className.visible);
|
|
664
|
+
const flyoutCount = $otherFlyouts.length;
|
|
665
|
+
let callbackCount = 0;
|
|
710
666
|
$otherFlyouts
|
|
711
667
|
.flyout('hide', function () {
|
|
712
668
|
callbackCount++;
|
|
713
|
-
if (callbackCount === flyoutCount) {
|
|
669
|
+
if (callbackCount === flyoutCount && isFunction(callback)) {
|
|
714
670
|
callback();
|
|
715
671
|
}
|
|
716
|
-
})
|
|
717
|
-
;
|
|
672
|
+
});
|
|
718
673
|
},
|
|
719
674
|
|
|
720
675
|
toggle: function () {
|
|
@@ -727,11 +682,6 @@
|
|
|
727
682
|
},
|
|
728
683
|
|
|
729
684
|
pushPage: function (callback) {
|
|
730
|
-
var
|
|
731
|
-
animate,
|
|
732
|
-
dim,
|
|
733
|
-
transitionEnd
|
|
734
|
-
;
|
|
735
685
|
callback = isFunction(callback)
|
|
736
686
|
? callback
|
|
737
687
|
: function () {};
|
|
@@ -740,16 +690,16 @@
|
|
|
740
690
|
currentScroll = (isBody ? $window : $context).scrollTop();
|
|
741
691
|
}
|
|
742
692
|
module.bind.scrollLock();
|
|
743
|
-
animate = function () {
|
|
693
|
+
const animate = function () {
|
|
744
694
|
module.bind.clickaway();
|
|
745
695
|
module.add.inlineCSS();
|
|
746
696
|
module.set.animating();
|
|
747
697
|
module.set.visible();
|
|
748
698
|
};
|
|
749
|
-
dim = function () {
|
|
699
|
+
const dim = function () {
|
|
750
700
|
module.set.dimmed();
|
|
751
701
|
};
|
|
752
|
-
transitionEnd = function (event) {
|
|
702
|
+
const transitionEnd = function (event) {
|
|
753
703
|
if (event.target === $module[0]) {
|
|
754
704
|
$module.off('transitionend' + elementNamespace, transitionEnd);
|
|
755
705
|
module.remove.animating();
|
|
@@ -765,10 +715,6 @@
|
|
|
765
715
|
},
|
|
766
716
|
|
|
767
717
|
pullPage: function (callback) {
|
|
768
|
-
var
|
|
769
|
-
animate,
|
|
770
|
-
transitionEnd
|
|
771
|
-
;
|
|
772
718
|
callback = isFunction(callback)
|
|
773
719
|
? callback
|
|
774
720
|
: function () {};
|
|
@@ -782,7 +728,7 @@
|
|
|
782
728
|
}
|
|
783
729
|
}
|
|
784
730
|
|
|
785
|
-
animate = function () {
|
|
731
|
+
const animate = function () {
|
|
786
732
|
module.set.overlay();
|
|
787
733
|
module.set.animating();
|
|
788
734
|
if (settings.dimPage && !module.othersVisible()) {
|
|
@@ -790,7 +736,7 @@
|
|
|
790
736
|
}
|
|
791
737
|
module.remove.visible();
|
|
792
738
|
};
|
|
793
|
-
transitionEnd = function (event) {
|
|
739
|
+
const transitionEnd = function (event) {
|
|
794
740
|
if (event.target === $module[0]) {
|
|
795
741
|
$module.off('transitionend' + elementNamespace, transitionEnd);
|
|
796
742
|
module.remove.animating();
|
|
@@ -834,16 +780,14 @@
|
|
|
834
780
|
observeAttributes = state !== false;
|
|
835
781
|
},
|
|
836
782
|
autofocus: function () {
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
).first()
|
|
846
|
-
;
|
|
783
|
+
const $autofocus = $inputs.filter('[autofocus]');
|
|
784
|
+
const $rawInputs = $inputs.filter(':input');
|
|
785
|
+
const $input = ($autofocus.length > 0
|
|
786
|
+
? $autofocus
|
|
787
|
+
: ($rawInputs.length > 0
|
|
788
|
+
? $rawInputs
|
|
789
|
+
: $module)
|
|
790
|
+
).first();
|
|
847
791
|
$input.trigger('focus');
|
|
848
792
|
},
|
|
849
793
|
dimmerStyles: function () {
|
|
@@ -854,13 +798,11 @@
|
|
|
854
798
|
}
|
|
855
799
|
},
|
|
856
800
|
bodyMargin: function () {
|
|
857
|
-
|
|
801
|
+
const position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
|
858
802
|
$context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
|
|
859
803
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
|
863
|
-
;
|
|
804
|
+
const el = $(this);
|
|
805
|
+
const attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
|
864
806
|
el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
|
|
865
807
|
});
|
|
866
808
|
},
|
|
@@ -888,8 +830,7 @@
|
|
|
888
830
|
closing: function () {
|
|
889
831
|
$pusher.addClass(className.closing);
|
|
890
832
|
},
|
|
891
|
-
direction: function (direction) {
|
|
892
|
-
direction = direction || module.get.direction();
|
|
833
|
+
direction: function (direction = module.get.direction()) {
|
|
893
834
|
$module.addClass(className[direction]);
|
|
894
835
|
},
|
|
895
836
|
visible: function () {
|
|
@@ -910,8 +851,7 @@
|
|
|
910
851
|
keyboardShortcuts: function () {
|
|
911
852
|
module.verbose('Removing keyboard shortcuts');
|
|
912
853
|
$document
|
|
913
|
-
.off('keydown' + eventNamespace)
|
|
914
|
-
;
|
|
854
|
+
.off('keydown' + eventNamespace);
|
|
915
855
|
},
|
|
916
856
|
|
|
917
857
|
// context
|
|
@@ -932,8 +872,7 @@
|
|
|
932
872
|
closing: function () {
|
|
933
873
|
$pusher.removeClass(className.closing);
|
|
934
874
|
},
|
|
935
|
-
direction: function (direction) {
|
|
936
|
-
direction = direction || module.get.direction();
|
|
875
|
+
direction: function (direction = module.get.direction()) {
|
|
937
876
|
$module.removeClass(className[direction]);
|
|
938
877
|
},
|
|
939
878
|
visible: function () {
|
|
@@ -981,21 +920,17 @@
|
|
|
981
920
|
|
|
982
921
|
save: {
|
|
983
922
|
focus: function () {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
inCurrentFlyout = $activeElement.closest($module).length > 0
|
|
987
|
-
;
|
|
923
|
+
const $activeElement = $(document.activeElement);
|
|
924
|
+
const inCurrentFlyout = $activeElement.closest($module).length > 0;
|
|
988
925
|
if (!inCurrentFlyout) {
|
|
989
926
|
$focusedElement = $(document.activeElement).trigger('blur');
|
|
990
927
|
}
|
|
991
928
|
},
|
|
992
929
|
bodyMargin: function () {
|
|
993
930
|
initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
;
|
|
998
|
-
tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
|
|
931
|
+
initialBodyMarginInt = Number.parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10);
|
|
932
|
+
const bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
|
|
933
|
+
tempBodyMargin = initialBodyMarginInt + bodyScrollbarWidth;
|
|
999
934
|
},
|
|
1000
935
|
},
|
|
1001
936
|
|
|
@@ -1015,13 +950,11 @@
|
|
|
1015
950
|
return module.cache.isFirefox;
|
|
1016
951
|
},
|
|
1017
952
|
iframe: function () {
|
|
1018
|
-
return !(self === top);
|
|
953
|
+
return !(window.self === window.top);
|
|
1019
954
|
},
|
|
1020
955
|
mobile: function () {
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
isMobile = userAgent.match(regExp.mobile)
|
|
1024
|
-
;
|
|
956
|
+
const userAgent = navigator.userAgent;
|
|
957
|
+
const isMobile = userAgent.match(regExp.mobile);
|
|
1025
958
|
if (isMobile) {
|
|
1026
959
|
module.verbose('Browser was found to be mobile', userAgent);
|
|
1027
960
|
|
|
@@ -1066,13 +999,11 @@
|
|
|
1066
999
|
}
|
|
1067
1000
|
},
|
|
1068
1001
|
bodyMargin: function () {
|
|
1069
|
-
|
|
1070
|
-
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
|
|
1002
|
+
const position = module.can.leftBodyScrollbar() ? 'left' : 'right';
|
|
1003
|
+
$context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMarginInt === 0 ? '' : initialBodyMargin);
|
|
1071
1004
|
$context.find(selector.bodyFixed.replace('right', position)).each(function () {
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
|
|
1075
|
-
;
|
|
1005
|
+
const el = $(this);
|
|
1006
|
+
const attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
|
|
1076
1007
|
el.css(attribute, '');
|
|
1077
1008
|
});
|
|
1078
1009
|
},
|
|
@@ -1084,8 +1015,7 @@
|
|
|
1084
1015
|
return string;
|
|
1085
1016
|
}
|
|
1086
1017
|
|
|
1087
|
-
const
|
|
1088
|
-
const escape = {
|
|
1018
|
+
const escapeMap = {
|
|
1089
1019
|
'"': '"',
|
|
1090
1020
|
'&': '&',
|
|
1091
1021
|
"'": ''',
|
|
@@ -1093,7 +1023,7 @@
|
|
|
1093
1023
|
'>': '>',
|
|
1094
1024
|
};
|
|
1095
1025
|
|
|
1096
|
-
return string.replace(
|
|
1026
|
+
return String(string).replace(/["&'<>]/g, (chr) => escapeMap[chr]);
|
|
1097
1027
|
},
|
|
1098
1028
|
},
|
|
1099
1029
|
|
|
@@ -1120,39 +1050,37 @@
|
|
|
1120
1050
|
return module[name];
|
|
1121
1051
|
}
|
|
1122
1052
|
},
|
|
1123
|
-
debug: function () {
|
|
1053
|
+
debug: function (...args) {
|
|
1124
1054
|
if (!settings.silent && settings.debug) {
|
|
1125
1055
|
if (settings.performance) {
|
|
1126
|
-
module.performance.log(
|
|
1056
|
+
module.performance.log(args);
|
|
1127
1057
|
} else {
|
|
1128
1058
|
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
1129
|
-
module.debug.apply(console,
|
|
1059
|
+
module.debug.apply(console, args);
|
|
1130
1060
|
}
|
|
1131
1061
|
}
|
|
1132
1062
|
},
|
|
1133
|
-
verbose: function () {
|
|
1063
|
+
verbose: function (...args) {
|
|
1134
1064
|
if (!settings.silent && settings.verbose && settings.debug) {
|
|
1135
1065
|
if (settings.performance) {
|
|
1136
|
-
module.performance.log(
|
|
1066
|
+
module.performance.log(args);
|
|
1137
1067
|
} else {
|
|
1138
1068
|
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
1139
|
-
module.verbose.apply(console,
|
|
1069
|
+
module.verbose.apply(console, args);
|
|
1140
1070
|
}
|
|
1141
1071
|
}
|
|
1142
1072
|
},
|
|
1143
|
-
error: function () {
|
|
1073
|
+
error: function (...args) {
|
|
1144
1074
|
if (!settings.silent) {
|
|
1145
1075
|
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
|
1146
|
-
module.error.apply(console,
|
|
1076
|
+
module.error.apply(console, args);
|
|
1147
1077
|
}
|
|
1148
1078
|
},
|
|
1149
1079
|
performance: {
|
|
1150
1080
|
log: function (message) {
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
previousTime
|
|
1155
|
-
;
|
|
1081
|
+
let currentTime;
|
|
1082
|
+
let executionTime;
|
|
1083
|
+
let previousTime;
|
|
1156
1084
|
if (settings.performance) {
|
|
1157
1085
|
currentTime = Date.now();
|
|
1158
1086
|
previousTime = time || currentTime;
|
|
@@ -1160,7 +1088,7 @@
|
|
|
1160
1088
|
time = currentTime;
|
|
1161
1089
|
performance.push({
|
|
1162
1090
|
Name: message[0],
|
|
1163
|
-
Arguments:
|
|
1091
|
+
Arguments: message.slice(1),
|
|
1164
1092
|
Element: element,
|
|
1165
1093
|
'Execution Time': executionTime,
|
|
1166
1094
|
});
|
|
@@ -1171,10 +1099,8 @@
|
|
|
1171
1099
|
}, 500);
|
|
1172
1100
|
},
|
|
1173
1101
|
display: function () {
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
totalTime = 0
|
|
1177
|
-
;
|
|
1102
|
+
let title = settings.name + ':';
|
|
1103
|
+
let totalTime = 0;
|
|
1178
1104
|
time = false;
|
|
1179
1105
|
clearTimeout(module.performance.timer);
|
|
1180
1106
|
$.each(performance, function (index, data) {
|
|
@@ -1183,35 +1109,24 @@
|
|
|
1183
1109
|
title += ' ' + totalTime + 'ms';
|
|
1184
1110
|
if (performance.length > 0) {
|
|
1185
1111
|
console.groupCollapsed(title);
|
|
1186
|
-
|
|
1187
|
-
console.table(performance);
|
|
1188
|
-
} else {
|
|
1189
|
-
$.each(performance, function (index, data) {
|
|
1190
|
-
console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
|
|
1191
|
-
});
|
|
1192
|
-
}
|
|
1112
|
+
console.table(performance);
|
|
1193
1113
|
console.groupEnd();
|
|
1194
1114
|
}
|
|
1195
1115
|
performance = [];
|
|
1196
1116
|
},
|
|
1197
1117
|
},
|
|
1198
|
-
invoke: function (query, passedArguments, context) {
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
response
|
|
1204
|
-
;
|
|
1205
|
-
passedArguments = passedArguments || queryArguments;
|
|
1206
|
-
context = element || context;
|
|
1118
|
+
invoke: function (query, passedArguments = queryArguments, context = element) {
|
|
1119
|
+
let object = instance;
|
|
1120
|
+
let maxDepth;
|
|
1121
|
+
let found;
|
|
1122
|
+
let response;
|
|
1207
1123
|
if (typeof query === 'string' && object !== undefined) {
|
|
1208
1124
|
query = query.split(/[ .]/);
|
|
1209
1125
|
maxDepth = query.length - 1;
|
|
1210
1126
|
$.each(query, function (depth, value) {
|
|
1211
|
-
|
|
1127
|
+
const camelCaseValue = depth !== maxDepth
|
|
1212
1128
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
1213
|
-
: query
|
|
1214
|
-
;
|
|
1129
|
+
: query;
|
|
1215
1130
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
1216
1131
|
object = object[camelCaseValue];
|
|
1217
1132
|
} else if (object[camelCaseValue] !== undefined) {
|
|
@@ -1250,10 +1165,10 @@
|
|
|
1250
1165
|
|
|
1251
1166
|
if (methodInvoked) {
|
|
1252
1167
|
if (instance === undefined) {
|
|
1253
|
-
if (isFunction(settings.templates[
|
|
1168
|
+
if (isFunction(settings.templates[parameters])) {
|
|
1254
1169
|
settings.autoShow = true;
|
|
1255
1170
|
settings.className.flyout = settings.className.template;
|
|
1256
|
-
settings = $.extend(true, {}, settings, settings.templates[
|
|
1171
|
+
settings = $.extend(true, {}, settings, settings.templates[parameters].apply(module, queryArguments));
|
|
1257
1172
|
|
|
1258
1173
|
// reassign shortcuts
|
|
1259
1174
|
className = settings.className;
|
|
@@ -1263,8 +1178,8 @@
|
|
|
1263
1178
|
}
|
|
1264
1179
|
module.initialize();
|
|
1265
1180
|
}
|
|
1266
|
-
if (!isFunction(settings.templates[
|
|
1267
|
-
module.invoke(
|
|
1181
|
+
if (!isFunction(settings.templates[parameters])) {
|
|
1182
|
+
module.invoke(parameters);
|
|
1268
1183
|
}
|
|
1269
1184
|
} else {
|
|
1270
1185
|
if (instance !== undefined) {
|
|
@@ -1402,8 +1317,7 @@
|
|
|
1402
1317
|
};
|
|
1403
1318
|
|
|
1404
1319
|
$.fn.flyout.settings.templates = {
|
|
1405
|
-
getArguments: function (
|
|
1406
|
-
var queryArguments = [].slice.call(args);
|
|
1320
|
+
getArguments: function (queryArguments) {
|
|
1407
1321
|
if ($.isPlainObject(queryArguments[0])) {
|
|
1408
1322
|
return $.extend({
|
|
1409
1323
|
handler: function () {},
|
|
@@ -1421,11 +1335,9 @@
|
|
|
1421
1335
|
title: queryArguments.pop() || '',
|
|
1422
1336
|
};
|
|
1423
1337
|
},
|
|
1424
|
-
alert: function () {
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
args = settings.templates.getArguments(arguments)
|
|
1428
|
-
;
|
|
1338
|
+
alert: function (...args) {
|
|
1339
|
+
const settings = this.get.settings();
|
|
1340
|
+
args = settings.templates.getArguments(args);
|
|
1429
1341
|
|
|
1430
1342
|
return {
|
|
1431
1343
|
title: args.title,
|
|
@@ -1437,11 +1349,9 @@
|
|
|
1437
1349
|
}],
|
|
1438
1350
|
};
|
|
1439
1351
|
},
|
|
1440
|
-
confirm: function () {
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
args = settings.templates.getArguments(arguments)
|
|
1444
|
-
;
|
|
1352
|
+
confirm: function (...args) {
|
|
1353
|
+
const settings = this.get.settings();
|
|
1354
|
+
args = settings.templates.getArguments(args);
|
|
1445
1355
|
|
|
1446
1356
|
return {
|
|
1447
1357
|
title: args.title,
|
|
@@ -1461,13 +1371,11 @@
|
|
|
1461
1371
|
}],
|
|
1462
1372
|
};
|
|
1463
1373
|
},
|
|
1464
|
-
prompt: function () {
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
input = $($.parseHTML(args.content)).filter('.ui.input')
|
|
1470
|
-
;
|
|
1374
|
+
prompt: function (...args) {
|
|
1375
|
+
const $this = this;
|
|
1376
|
+
const settings = this.get.settings();
|
|
1377
|
+
args = settings.templates.getArguments(args);
|
|
1378
|
+
const input = $($.parseHTML(args.content)).filter('.ui.input');
|
|
1471
1379
|
if (input.length === 0) {
|
|
1472
1380
|
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
1381
|
}
|
|
@@ -1479,10 +1387,8 @@
|
|
|
1479
1387
|
text: settings.text.ok,
|
|
1480
1388
|
class: settings.className.ok,
|
|
1481
1389
|
click: function () {
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
inputField = $this.get.element().find(settings.selector.prompt)[0]
|
|
1485
|
-
;
|
|
1390
|
+
const settings = $this.get.settings();
|
|
1391
|
+
const inputField = $this.get.element().find(settings.selector.prompt)[0];
|
|
1486
1392
|
args.handler($(inputField).val());
|
|
1487
1393
|
},
|
|
1488
1394
|
}, {
|