@ntlab/ntjs-assets 2.0.2 → 2.0.3

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.
Files changed (235) hide show
  1. package/assets/js/bootstrap-icons/bootstrap-icons.svg +1 -1
  2. package/assets/js/bootstrap-icons/folder-plus.svg +2 -2
  3. package/assets/js/bootstrap-icons/font/bootstrap-icons.css +1981 -0
  4. package/assets/js/bootstrap-icons/font/bootstrap-icons.json +1955 -0
  5. package/assets/js/bootstrap-icons/font/bootstrap-icons.min.css +5 -0
  6. package/assets/js/bootstrap-icons/font/bootstrap-icons.scss +1993 -0
  7. package/assets/js/bootstrap-icons/font/fonts/bootstrap-icons.woff +0 -0
  8. package/assets/js/bootstrap-icons/font/fonts/bootstrap-icons.woff2 +0 -0
  9. package/assets/js/bootstrap-icons/postcard-heart-fill.svg +1 -1
  10. package/assets/js/bootstrap-icons/trash.svg +2 -2
  11. package/assets/js/jquery/jquery.js +840 -1045
  12. package/assets/js/jquery/jquery.min.js +2 -2
  13. package/assets/js/jquery/jquery.min.map +1 -1
  14. package/assets/js/jquery/jquery.slim.js +834 -1039
  15. package/assets/js/jquery/jquery.slim.min.js +2 -2
  16. package/assets/js/jquery/jquery.slim.min.map +1 -1
  17. package/assets/js/popper.js/cjs/enums.js +1 -1
  18. package/assets/js/popper.js/cjs/popper-base.js +12 -170
  19. package/assets/js/popper.js/cjs/popper-base.js.map +1 -1
  20. package/assets/js/popper.js/cjs/popper-lite.js +14 -184
  21. package/assets/js/popper.js/cjs/popper-lite.js.map +1 -1
  22. package/assets/js/popper.js/cjs/popper.js +14 -197
  23. package/assets/js/popper.js/cjs/popper.js.map +1 -1
  24. package/assets/js/popper.js/esm/createPopper.js +6 -66
  25. package/assets/js/popper.js/esm/modifiers/arrow.js +1 -12
  26. package/assets/js/popper.js/esm/modifiers/computeStyles.js +2 -14
  27. package/assets/js/popper.js/esm/utils/computeAutoPlacement.js +0 -4
  28. package/assets/js/popper.js/esm/utils/userAgent.js +1 -1
  29. package/assets/js/popper.js/umd/enums.js +1 -1
  30. package/assets/js/popper.js/umd/enums.min.js +1 -1
  31. package/assets/js/popper.js/umd/popper-base.js +12 -170
  32. package/assets/js/popper.js/umd/popper-base.js.map +1 -1
  33. package/assets/js/popper.js/umd/popper-base.min.js +2 -2
  34. package/assets/js/popper.js/umd/popper-base.min.js.map +1 -1
  35. package/assets/js/popper.js/umd/popper-lite.js +14 -184
  36. package/assets/js/popper.js/umd/popper-lite.js.map +1 -1
  37. package/assets/js/popper.js/umd/popper-lite.min.js +2 -2
  38. package/assets/js/popper.js/umd/popper-lite.min.js.map +1 -1
  39. package/assets/js/popper.js/umd/popper.js +14 -197
  40. package/assets/js/popper.js/umd/popper.js.map +1 -1
  41. package/assets/js/popper.js/umd/popper.min.js +2 -2
  42. package/assets/js/popper.js/umd/popper.min.js.map +1 -1
  43. package/assets/js/semantic-ui/components/accordion.css +196 -74
  44. package/assets/js/semantic-ui/components/accordion.js +570 -591
  45. package/assets/js/semantic-ui/components/accordion.min.css +4 -4
  46. package/assets/js/semantic-ui/components/accordion.min.js +6 -6
  47. package/assets/js/semantic-ui/components/ad.css +40 -51
  48. package/assets/js/semantic-ui/components/ad.min.css +4 -4
  49. package/assets/js/semantic-ui/components/api.js +1154 -1117
  50. package/assets/js/semantic-ui/components/api.min.js +6 -6
  51. package/assets/js/semantic-ui/components/breadcrumb.css +7 -7
  52. package/assets/js/semantic-ui/components/breadcrumb.min.css +4 -4
  53. package/assets/js/semantic-ui/components/button.css +895 -1227
  54. package/assets/js/semantic-ui/components/button.min.css +4 -4
  55. package/assets/js/semantic-ui/components/calendar.css +60 -33
  56. package/assets/js/semantic-ui/components/calendar.js +1952 -1575
  57. package/assets/js/semantic-ui/components/calendar.min.css +4 -4
  58. package/assets/js/semantic-ui/components/calendar.min.js +6 -6
  59. package/assets/js/semantic-ui/components/card.css +1004 -441
  60. package/assets/js/semantic-ui/components/card.min.css +4 -4
  61. package/assets/js/semantic-ui/components/checkbox.css +275 -303
  62. package/assets/js/semantic-ui/components/checkbox.js +863 -855
  63. package/assets/js/semantic-ui/components/checkbox.min.css +4 -4
  64. package/assets/js/semantic-ui/components/checkbox.min.js +6 -6
  65. package/assets/js/semantic-ui/components/comment.css +45 -63
  66. package/assets/js/semantic-ui/components/comment.min.css +4 -4
  67. package/assets/js/semantic-ui/components/container.css +98 -4
  68. package/assets/js/semantic-ui/components/container.min.css +4 -4
  69. package/assets/js/semantic-ui/components/dimmer.css +95 -196
  70. package/assets/js/semantic-ui/components/dimmer.js +698 -717
  71. package/assets/js/semantic-ui/components/dimmer.min.css +4 -4
  72. package/assets/js/semantic-ui/components/dimmer.min.js +6 -6
  73. package/assets/js/semantic-ui/components/divider.css +75 -93
  74. package/assets/js/semantic-ui/components/divider.min.css +4 -4
  75. package/assets/js/semantic-ui/components/dropdown.css +490 -413
  76. package/assets/js/semantic-ui/components/dropdown.js +4203 -4068
  77. package/assets/js/semantic-ui/components/dropdown.min.css +4 -4
  78. package/assets/js/semantic-ui/components/dropdown.min.js +6 -6
  79. package/assets/js/semantic-ui/components/embed.css +27 -38
  80. package/assets/js/semantic-ui/components/embed.js +647 -673
  81. package/assets/js/semantic-ui/components/embed.min.css +4 -4
  82. package/assets/js/semantic-ui/components/embed.min.js +6 -6
  83. package/assets/js/semantic-ui/components/emoji.css +11156 -9192
  84. package/assets/js/semantic-ui/components/emoji.min.css +3 -3
  85. package/assets/js/semantic-ui/components/feed.css +56 -78
  86. package/assets/js/semantic-ui/components/feed.min.css +4 -4
  87. package/assets/js/semantic-ui/components/flag.css +1037 -929
  88. package/assets/js/semantic-ui/components/flag.min.css +4 -4
  89. package/assets/js/semantic-ui/components/flyout.css +552 -0
  90. package/assets/js/semantic-ui/components/flyout.js +1567 -0
  91. package/assets/js/semantic-ui/components/flyout.min.css +9 -0
  92. package/assets/js/semantic-ui/components/flyout.min.js +11 -0
  93. package/assets/js/semantic-ui/components/form.css +536 -530
  94. package/assets/js/semantic-ui/components/form.js +2037 -1945
  95. package/assets/js/semantic-ui/components/form.min.css +4 -4
  96. package/assets/js/semantic-ui/components/form.min.js +6 -6
  97. package/assets/js/semantic-ui/components/grid.css +218 -345
  98. package/assets/js/semantic-ui/components/grid.min.css +4 -4
  99. package/assets/js/semantic-ui/components/header.css +137 -154
  100. package/assets/js/semantic-ui/components/header.min.css +4 -4
  101. package/assets/js/semantic-ui/components/icon.css +3000 -2750
  102. package/assets/js/semantic-ui/components/icon.min.css +4 -4
  103. package/assets/js/semantic-ui/components/image.css +54 -49
  104. package/assets/js/semantic-ui/components/image.min.css +4 -4
  105. package/assets/js/semantic-ui/components/input.css +1081 -227
  106. package/assets/js/semantic-ui/components/input.min.css +4 -4
  107. package/assets/js/semantic-ui/components/item.css +91 -138
  108. package/assets/js/semantic-ui/components/item.min.css +4 -4
  109. package/assets/js/semantic-ui/components/label.css +470 -481
  110. package/assets/js/semantic-ui/components/label.min.css +4 -4
  111. package/assets/js/semantic-ui/components/list.css +93 -114
  112. package/assets/js/semantic-ui/components/list.min.css +4 -4
  113. package/assets/js/semantic-ui/components/loader.css +452 -536
  114. package/assets/js/semantic-ui/components/loader.min.css +4 -4
  115. package/assets/js/semantic-ui/components/menu.css +408 -510
  116. package/assets/js/semantic-ui/components/menu.min.css +9 -1
  117. package/assets/js/semantic-ui/components/message.css +188 -213
  118. package/assets/js/semantic-ui/components/message.min.css +4 -4
  119. package/assets/js/semantic-ui/components/modal.css +174 -166
  120. package/assets/js/semantic-ui/components/modal.js +1558 -1146
  121. package/assets/js/semantic-ui/components/modal.min.css +4 -4
  122. package/assets/js/semantic-ui/components/modal.min.js +6 -6
  123. package/assets/js/semantic-ui/components/nag.css +183 -41
  124. package/assets/js/semantic-ui/components/nag.js +527 -467
  125. package/assets/js/semantic-ui/components/nag.min.css +4 -4
  126. package/assets/js/semantic-ui/components/nag.min.js +6 -6
  127. package/assets/js/semantic-ui/components/placeholder.css +62 -76
  128. package/assets/js/semantic-ui/components/placeholder.min.css +4 -4
  129. package/assets/js/semantic-ui/components/popup.css +681 -312
  130. package/assets/js/semantic-ui/components/popup.js +1470 -1463
  131. package/assets/js/semantic-ui/components/popup.min.css +4 -4
  132. package/assets/js/semantic-ui/components/popup.min.js +6 -6
  133. package/assets/js/semantic-ui/components/progress.css +149 -217
  134. package/assets/js/semantic-ui/components/progress.js +945 -1002
  135. package/assets/js/semantic-ui/components/progress.min.css +4 -4
  136. package/assets/js/semantic-ui/components/progress.min.js +6 -6
  137. package/assets/js/semantic-ui/components/rail.css +17 -22
  138. package/assets/js/semantic-ui/components/rail.min.css +3 -3
  139. package/assets/js/semantic-ui/components/rating.css +89 -184
  140. package/assets/js/semantic-ui/components/rating.js +509 -521
  141. package/assets/js/semantic-ui/components/rating.min.css +4 -4
  142. package/assets/js/semantic-ui/components/rating.min.js +6 -6
  143. package/assets/js/semantic-ui/components/reset.css +12 -17
  144. package/assets/js/semantic-ui/components/reset.min.css +4 -4
  145. package/assets/js/semantic-ui/components/reveal.css +46 -85
  146. package/assets/js/semantic-ui/components/reveal.min.css +4 -4
  147. package/assets/js/semantic-ui/components/search.css +157 -96
  148. package/assets/js/semantic-ui/components/search.js +1522 -1479
  149. package/assets/js/semantic-ui/components/search.min.css +4 -4
  150. package/assets/js/semantic-ui/components/search.min.js +6 -6
  151. package/assets/js/semantic-ui/components/segment.css +317 -249
  152. package/assets/js/semantic-ui/components/segment.min.css +4 -4
  153. package/assets/js/semantic-ui/components/shape.css +16 -32
  154. package/assets/js/semantic-ui/components/shape.js +763 -812
  155. package/assets/js/semantic-ui/components/shape.min.css +4 -4
  156. package/assets/js/semantic-ui/components/shape.min.js +6 -6
  157. package/assets/js/semantic-ui/components/sidebar.css +128 -216
  158. package/assets/js/semantic-ui/components/sidebar.js +1042 -1003
  159. package/assets/js/semantic-ui/components/sidebar.min.css +4 -4
  160. package/assets/js/semantic-ui/components/sidebar.min.js +6 -6
  161. package/assets/js/semantic-ui/components/site.css +123 -48
  162. package/assets/js/semantic-ui/components/site.js +438 -478
  163. package/assets/js/semantic-ui/components/site.min.css +4 -4
  164. package/assets/js/semantic-ui/components/site.min.js +6 -6
  165. package/assets/js/semantic-ui/components/slider.css +133 -141
  166. package/assets/js/semantic-ui/components/slider.js +1312 -1274
  167. package/assets/js/semantic-ui/components/slider.min.css +9 -1
  168. package/assets/js/semantic-ui/components/slider.min.js +6 -6
  169. package/assets/js/semantic-ui/components/state.js +640 -659
  170. package/assets/js/semantic-ui/components/state.min.js +6 -6
  171. package/assets/js/semantic-ui/components/statistic.css +83 -124
  172. package/assets/js/semantic-ui/components/statistic.min.css +4 -4
  173. package/assets/js/semantic-ui/components/step.css +118 -184
  174. package/assets/js/semantic-ui/components/step.min.css +4 -4
  175. package/assets/js/semantic-ui/components/sticky.css +3 -8
  176. package/assets/js/semantic-ui/components/sticky.js +849 -892
  177. package/assets/js/semantic-ui/components/sticky.min.css +4 -4
  178. package/assets/js/semantic-ui/components/sticky.min.js +6 -6
  179. package/assets/js/semantic-ui/components/tab.css +16 -20
  180. package/assets/js/semantic-ui/components/tab.js +896 -941
  181. package/assets/js/semantic-ui/components/tab.min.css +4 -4
  182. package/assets/js/semantic-ui/components/tab.min.js +6 -6
  183. package/assets/js/semantic-ui/components/table.css +2073 -884
  184. package/assets/js/semantic-ui/components/table.min.css +4 -4
  185. package/assets/js/semantic-ui/components/text.css +51 -30
  186. package/assets/js/semantic-ui/components/text.min.css +4 -4
  187. package/assets/js/semantic-ui/components/toast.css +200 -137
  188. package/assets/js/semantic-ui/components/toast.js +912 -832
  189. package/assets/js/semantic-ui/components/toast.min.css +4 -4
  190. package/assets/js/semantic-ui/components/toast.min.js +6 -6
  191. package/assets/js/semantic-ui/components/transition.css +371 -1282
  192. package/assets/js/semantic-ui/components/transition.js +999 -1074
  193. package/assets/js/semantic-ui/components/transition.min.css +4 -4
  194. package/assets/js/semantic-ui/components/transition.min.js +6 -6
  195. package/assets/js/semantic-ui/components/visibility.js +1215 -1247
  196. package/assets/js/semantic-ui/components/visibility.min.js +6 -6
  197. package/assets/js/semantic-ui/semantic.css +43777 -37429
  198. package/assets/js/semantic-ui/semantic.js +29152 -26694
  199. package/assets/js/semantic-ui/semantic.min.css +6 -399
  200. package/assets/js/semantic-ui/semantic.min.js +6 -6
  201. package/assets/js/semantic-ui/themes/basic/assets/fonts/icons.woff2 +0 -0
  202. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  203. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  204. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  205. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  206. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  207. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  208. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  209. package/assets/js/semantic-ui/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  210. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  211. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  212. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  213. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  214. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  215. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  216. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  217. package/assets/js/semantic-ui/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  218. package/assets/js/semantic-ui/themes/default/assets/fonts/brand-icons.woff +0 -0
  219. package/assets/js/semantic-ui/themes/default/assets/fonts/brand-icons.woff2 +0 -0
  220. package/assets/js/semantic-ui/themes/default/assets/fonts/icons.woff +0 -0
  221. package/assets/js/semantic-ui/themes/default/assets/fonts/icons.woff2 +0 -0
  222. package/assets/js/semantic-ui/themes/default/assets/fonts/outline-icons.woff +0 -0
  223. package/assets/js/semantic-ui/themes/default/assets/fonts/outline-icons.woff2 +0 -0
  224. package/assets/js/semantic-ui/themes/famfamfam/assets/images/flags.png +0 -0
  225. package/assets/js/semantic-ui/themes/github/assets/fonts/octicons.woff2 +0 -0
  226. package/assets/js/socket.io/socket.io.esm.min.js +3 -3
  227. package/assets/js/socket.io/socket.io.esm.min.js.map +1 -1
  228. package/assets/js/socket.io/socket.io.js +841 -333
  229. package/assets/js/socket.io/socket.io.js.map +1 -1
  230. package/assets/js/socket.io/socket.io.min.js +3 -3
  231. package/assets/js/socket.io/socket.io.min.js.map +1 -1
  232. package/assets/js/socket.io/socket.io.msgpack.min.js +3 -3
  233. package/assets/js/socket.io/socket.io.msgpack.min.js.map +1 -1
  234. package/cdn.json +19 -4
  235. package/package.json +1 -1
@@ -0,0 +1,1567 @@
1
+ /*!
2
+ * # Fomantic-UI 2.9.2 - Flyout
3
+ * https://github.com/fomantic/Fomantic-UI/
4
+ *
5
+ *
6
+ * Released under the MIT license
7
+ * https://opensource.org/licenses/MIT
8
+ *
9
+ */
10
+
11
+ (function ($, window, document) {
12
+ 'use strict';
13
+
14
+ function isFunction(obj) {
15
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
+ }
17
+
18
+ window = window !== undefined && window.Math === Math
19
+ ? window
20
+ : globalThis;
21
+
22
+ $.fn.flyout = function (parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $window = $(window),
26
+ $document = $(document),
27
+ $html = $('html'),
28
+ $head = $('head'),
29
+ $body = $('body'),
30
+
31
+ moduleSelector = $allModules.selector || '',
32
+
33
+ time = Date.now(),
34
+ performance = [],
35
+
36
+ query = arguments[0],
37
+ methodInvoked = typeof query === 'string',
38
+ queryArguments = [].slice.call(arguments, 1),
39
+
40
+ returnedValue
41
+ ;
42
+
43
+ $allModules.each(function () {
44
+ var
45
+ settings = $.isPlainObject(parameters)
46
+ ? $.extend(true, {}, $.fn.flyout.settings, parameters)
47
+ : $.extend({}, $.fn.flyout.settings),
48
+
49
+ selector = settings.selector,
50
+ className = settings.className,
51
+ namespace = settings.namespace,
52
+ fields = settings.fields,
53
+ regExp = settings.regExp,
54
+ error = settings.error,
55
+
56
+ eventNamespace = '.' + namespace,
57
+ moduleNamespace = 'module-' + namespace,
58
+
59
+ $module = $(this),
60
+ $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
61
+ $closeIcon = $module.find(selector.close),
62
+ $inputs,
63
+ $focusedElement,
64
+
65
+ $flyouts = $module.children(selector.flyout),
66
+ $pusher = $context.children(selector.pusher),
67
+ $style,
68
+
69
+ isFlyoutComponent = $module.hasClass('flyout'),
70
+
71
+ element = this,
72
+ instance = isFlyoutComponent ? $module.data(moduleNamespace) : undefined,
73
+
74
+ ignoreRepeatedEvents = false,
75
+ isBody = $context[0] === $body[0],
76
+ initialBodyMargin = '',
77
+ tempBodyMargin = '',
78
+ hadScrollbar = false,
79
+
80
+ elementNamespace,
81
+ id,
82
+ observer,
83
+ observeAttributes = false,
84
+ currentScroll,
85
+
86
+ module
87
+ ;
88
+
89
+ module = {
90
+
91
+ initialize: function () {
92
+ module.debug('Initializing flyout', parameters);
93
+
94
+ module.create.id();
95
+ if (!isFlyoutComponent) {
96
+ module.create.flyout();
97
+ if (!isFunction(settings.onHidden)) {
98
+ settings.onHidden = function () {
99
+ module.destroy();
100
+ $module.remove();
101
+ };
102
+ }
103
+ if (!settings.autoShow) {
104
+ settings.autoShow = true;
105
+ }
106
+ }
107
+ $module.addClass(settings.class);
108
+ if (settings.title !== '') {
109
+ $module.find(selector.header).html(module.helpers.escape(settings.title, settings.preserveHTML)).addClass(settings.classTitle);
110
+ }
111
+ if (settings.content !== '') {
112
+ $module.find(selector.content).html(module.helpers.escape(settings.content, settings.preserveHTML)).addClass(settings.classContent);
113
+ }
114
+ if (module.has.configActions()) {
115
+ var $actions = $module.find(selector.actions).addClass(settings.classActions);
116
+ if ($actions.length === 0) {
117
+ $actions = $('<div/>', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($module);
118
+ } else {
119
+ $actions.empty();
120
+ }
121
+ settings.actions.forEach(function (el) {
122
+ var
123
+ icon = el[fields.icon]
124
+ ? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>'
125
+ : '',
126
+ text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
127
+ cls = module.helpers.deQuote(el[fields.class] || ''),
128
+ click = el[fields.click] && isFunction(el[fields.click])
129
+ ? el[fields.click]
130
+ : function () {}
131
+ ;
132
+ $actions.append($('<button/>', {
133
+ html: icon + text,
134
+ 'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g, ''),
135
+ class: className.button + ' ' + cls,
136
+ on: {
137
+ click: function () {
138
+ if (click.call(element, $module) === false) {
139
+ return;
140
+ }
141
+ module.hide();
142
+ },
143
+ },
144
+ }));
145
+ });
146
+ }
147
+
148
+ // avoids locking rendering if initialized in onReady
149
+ if (settings.delaySetup) {
150
+ requestAnimationFrame(module.setup.layout);
151
+ } else {
152
+ module.setup.layout();
153
+ }
154
+
155
+ requestAnimationFrame(function () {
156
+ module.setup.cache();
157
+ });
158
+
159
+ if (module.get.direction() === 'left' || module.get.direction() === 'right') {
160
+ module.setup.heights();
161
+ module.bind.resize();
162
+ }
163
+ module.bind.events();
164
+ module.observeChanges();
165
+ module.instantiate();
166
+
167
+ if (settings.autoShow) {
168
+ module.show();
169
+ }
170
+ },
171
+
172
+ instantiate: function () {
173
+ module.verbose('Storing instance of module', module);
174
+ instance = module;
175
+ $module
176
+ .data(moduleNamespace, instance)
177
+ ;
178
+ },
179
+
180
+ create: {
181
+ flyout: function () {
182
+ module.verbose('Programmaticaly create flyout', $context);
183
+ $module = $('<div/>', { class: className.flyout, role: 'dialog', 'aria-modal': settings.dimPage });
184
+ if (settings.closeIcon) {
185
+ $closeIcon = $('<i/>', {
186
+ class: className.close,
187
+ role: 'button',
188
+ tabindex: 0,
189
+ 'aria-label': settings.text.close,
190
+ });
191
+ $module.append($closeIcon);
192
+ }
193
+ if (settings.title !== '') {
194
+ var titleId = '_' + module.get.id() + 'title';
195
+ $module.attr('aria-labelledby', titleId);
196
+ $('<div/>', { class: className.header, id: titleId }).appendTo($module);
197
+ }
198
+ if (settings.content !== '') {
199
+ var descId = '_' + module.get.id() + 'desc';
200
+ $module.attr('aria-describedby', descId);
201
+ $('<div/>', { class: className.content, id: descId }).appendTo($module);
202
+ }
203
+ if (module.has.configActions()) {
204
+ $('<div/>', { class: className.actions }).appendTo($module);
205
+ }
206
+ $module.prependTo($context);
207
+ element = $module[0];
208
+ },
209
+ id: function () {
210
+ id = (Math.random().toString(16) + '000000000').slice(2, 10);
211
+ elementNamespace = '.' + id;
212
+ module.verbose('Creating unique id for element', id);
213
+ },
214
+ },
215
+
216
+ destroy: function () {
217
+ if (observer) {
218
+ observer.disconnect();
219
+ }
220
+ module.verbose('Destroying previous module for', $module);
221
+ $module
222
+ .off(eventNamespace)
223
+ .removeData(moduleNamespace)
224
+ ;
225
+ if (module.is.ios()) {
226
+ module.remove.ios();
227
+ }
228
+ $closeIcon.off(elementNamespace);
229
+ if ($inputs) {
230
+ $inputs.off(elementNamespace);
231
+ }
232
+ // bound by uuid
233
+ $context.off(elementNamespace);
234
+ $window.off(elementNamespace);
235
+ $document.off(elementNamespace);
236
+ },
237
+
238
+ event: {
239
+ keyboard: function (event) {
240
+ var
241
+ keyCode = event.which
242
+ ;
243
+ if (keyCode === settings.keys.escape) {
244
+ if (settings.closable) {
245
+ module.debug('Escape key pressed hiding flyout');
246
+ module.hide();
247
+ } else {
248
+ module.debug('Escape key pressed, but closable is set to false');
249
+ }
250
+ event.preventDefault();
251
+ }
252
+ },
253
+ resize: function () {
254
+ module.setup.heights();
255
+ },
256
+ focus: function () {
257
+ if (module.is.visible() && settings.autofocus && settings.dimPage) {
258
+ requestAnimationFrame(module.set.autofocus);
259
+ }
260
+ },
261
+ clickaway: function (event) {
262
+ if (settings.closable) {
263
+ var
264
+ clickedInPusher = $pusher.find(event.target).length > 0 || $pusher.is(event.target),
265
+ clickedContext = $context.is(event.target)
266
+ ;
267
+ if (clickedInPusher) {
268
+ module.verbose('User clicked on dimmed page');
269
+ module.hide();
270
+ }
271
+ if (clickedContext) {
272
+ module.verbose('User clicked on dimmable context (scaled out page)');
273
+ module.hide();
274
+ }
275
+ }
276
+ },
277
+ close: function (event) {
278
+ module.hide();
279
+ },
280
+ closeKeyUp: function (event) {
281
+ var
282
+ keyCode = event.which
283
+ ;
284
+ if (keyCode === settings.keys.enter || keyCode === settings.keys.space) {
285
+ module.hide();
286
+ }
287
+ },
288
+ inputKeyDown: {
289
+ first: function (event) {
290
+ var
291
+ keyCode = event.which
292
+ ;
293
+ if (keyCode === settings.keys.tab && event.shiftKey) {
294
+ $inputs.last().trigger('focus');
295
+ event.preventDefault();
296
+ }
297
+ },
298
+ last: function (event) {
299
+ var
300
+ keyCode = event.which
301
+ ;
302
+ if (keyCode === settings.keys.tab && !event.shiftKey) {
303
+ $inputs.first().trigger('focus');
304
+ event.preventDefault();
305
+ }
306
+ },
307
+ },
308
+ approve: function (event) {
309
+ if (ignoreRepeatedEvents || settings.onApprove.call(module.element, $(this)) === false) {
310
+ module.verbose('Approve callback returned false cancelling close');
311
+
312
+ return;
313
+ }
314
+ ignoreRepeatedEvents = true;
315
+ module.hide(function () {
316
+ ignoreRepeatedEvents = false;
317
+ });
318
+ },
319
+ deny: function (event) {
320
+ if (ignoreRepeatedEvents || settings.onDeny.call(module.element, $(this)) === false) {
321
+ module.verbose('Deny callback returned false cancelling close');
322
+
323
+ return;
324
+ }
325
+ ignoreRepeatedEvents = true;
326
+ module.hide(function () {
327
+ ignoreRepeatedEvents = false;
328
+ });
329
+ },
330
+ touch: function (event) {
331
+ // event.stopPropagation();
332
+ },
333
+ containScroll: function (event) {
334
+ if (element.scrollTop <= 0) {
335
+ element.scrollTop = 1;
336
+ }
337
+ if ((element.scrollTop + element.offsetHeight) >= element.scrollHeight) {
338
+ element.scrollTop = element.scrollHeight - element.offsetHeight - 1;
339
+ }
340
+ },
341
+ scroll: function (event) {
342
+ if ($(event.target).closest(selector.flyout).length === 0) {
343
+ event.preventDefault();
344
+ }
345
+ },
346
+ },
347
+
348
+ bind: {
349
+ resize: function () {
350
+ module.verbose('Adding resize event to window', $window);
351
+ $window.on('resize' + elementNamespace, module.event.resize);
352
+ },
353
+ events: function () {
354
+ module.verbose('Attaching events');
355
+ $module
356
+ .on('click' + eventNamespace, selector.close, module.event.close)
357
+ .on('click' + eventNamespace, selector.approve, module.event.approve)
358
+ .on('click' + eventNamespace, selector.deny, module.event.deny)
359
+ ;
360
+ $closeIcon
361
+ .on('keyup' + elementNamespace, module.event.closeKeyUp)
362
+ ;
363
+ $window
364
+ .on('focus' + elementNamespace, module.event.focus)
365
+ ;
366
+ },
367
+ clickaway: function () {
368
+ module.verbose('Adding clickaway events to context', $context);
369
+ $context
370
+ .on('click' + elementNamespace, module.event.clickaway)
371
+ .on('touchend' + elementNamespace, module.event.clickaway)
372
+ ;
373
+ },
374
+ scrollLock: function () {
375
+ if (settings.scrollLock) {
376
+ module.debug('Disabling page scroll');
377
+ hadScrollbar = module.has.scrollbar();
378
+ if (hadScrollbar) {
379
+ module.save.bodyMargin();
380
+ module.set.bodyMargin();
381
+ }
382
+ $context.addClass(className.locked);
383
+ }
384
+ module.verbose('Adding events to contain flyout scroll');
385
+ $document
386
+ .on('touchmove' + elementNamespace, module.event.touch)
387
+ ;
388
+ $module
389
+ .on('scroll' + eventNamespace, module.event.containScroll)
390
+ ;
391
+ },
392
+ },
393
+ unbind: {
394
+ clickaway: function () {
395
+ module.verbose('Removing clickaway events from context', $context);
396
+ $context.off(elementNamespace);
397
+ },
398
+ scrollLock: function () {
399
+ module.verbose('Removing scroll lock from page');
400
+ if (hadScrollbar) {
401
+ module.restore.bodyMargin();
402
+ }
403
+ $context.removeClass(className.locked);
404
+ $document.off(elementNamespace);
405
+ $module.off('scroll' + eventNamespace);
406
+ },
407
+ },
408
+
409
+ add: {
410
+ inlineCSS: function () {
411
+ var
412
+ width = module.cache.width || $module.outerWidth(),
413
+ height = module.cache.height || $module.outerHeight(),
414
+ isRTL = module.is.rtl(),
415
+ direction = module.get.direction(),
416
+ distance = {
417
+ left: width,
418
+ right: -width,
419
+ top: height,
420
+ bottom: -height,
421
+ },
422
+ style
423
+ ;
424
+
425
+ if (isRTL) {
426
+ module.verbose('RTL detected, flipping widths');
427
+ distance.left = -width;
428
+ distance.right = width;
429
+ }
430
+
431
+ style = '<style>';
432
+
433
+ if (direction === 'left' || direction === 'right') {
434
+ module.debug('Adding CSS rules for animation distance', width);
435
+ style += ''
436
+ + ' .ui.visible.' + direction + '.flyout ~ .fixed,'
437
+ + ' .ui.visible.' + direction + '.flyout ~ .pusher {'
438
+ + ' transform: translate3d(' + distance[direction] + 'px, 0, 0);'
439
+ + ' }';
440
+ } else if (direction === 'top' || direction === 'bottom') {
441
+ style += ''
442
+ + ' .ui.visible.' + direction + '.flyout ~ .fixed,'
443
+ + ' .ui.visible.' + direction + '.flyout ~ .pusher {'
444
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
445
+ + ' }';
446
+ }
447
+
448
+ /* IE is only browser not to create context with transforms */
449
+ /* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328 */
450
+ if (module.is.ie()) {
451
+ if (direction === 'left' || direction === 'right') {
452
+ module.debug('Adding CSS rules for animation distance', width);
453
+ style += ''
454
+ + ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher::after {'
455
+ + ' transform: translate3d(' + distance[direction] + 'px, 0, 0);'
456
+ + ' }';
457
+ } else if (direction === 'top' || direction === 'bottom') {
458
+ style += ''
459
+ + ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher::after {'
460
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
461
+ + ' }';
462
+ }
463
+ /* opposite sides visible forces content overlay */
464
+ style += ''
465
+ + ' body.pushable > .ui.visible.left.flyout ~ .ui.visible.right.flyout ~ .pusher::after,'
466
+ + ' body.pushable > .ui.visible.right.flyout ~ .ui.visible.left.flyout ~ .pusher::after {'
467
+ + ' transform: translate3d(0, 0, 0);'
468
+ + ' }';
469
+ }
470
+ style += '</style>';
471
+ $style = $(style)
472
+ .appendTo($head)
473
+ ;
474
+ module.debug('Adding sizing css to head', $style);
475
+ },
476
+ keyboardShortcuts: function () {
477
+ module.verbose('Adding keyboard shortcuts');
478
+ $document
479
+ .on('keydown' + eventNamespace, module.event.keyboard)
480
+ ;
481
+ },
482
+ },
483
+ observeChanges: function () {
484
+ if ('MutationObserver' in window) {
485
+ observer = new MutationObserver(function (mutations) {
486
+ var collectNodes = function (parent) {
487
+ var nodes = [];
488
+ for (var c = 0, cl = parent.length; c < cl; c++) {
489
+ Array.prototype.push.apply(nodes, collectNodes(parent[c].childNodes));
490
+ nodes.push(parent[c]);
491
+ }
492
+
493
+ return nodes;
494
+ },
495
+ shouldRefreshInputs = false
496
+ ;
497
+ mutations.every(function (mutation) {
498
+ if (mutation.type === 'attributes') {
499
+ if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').length > 0)) {
500
+ shouldRefreshInputs = true;
501
+ }
502
+ } else {
503
+ // mutationobserver only provides the parent nodes
504
+ // so let's collect all childs as well to find nested inputs
505
+ var $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible'),
506
+ $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
507
+ if ($addedInputs.length > 0 || $removedInputs.length > 0) {
508
+ shouldRefreshInputs = true;
509
+ }
510
+ }
511
+
512
+ return !shouldRefreshInputs;
513
+ });
514
+
515
+ if (shouldRefreshInputs) {
516
+ module.refreshInputs();
517
+ }
518
+ });
519
+ observer.observe(element, {
520
+ attributeFilter: ['class', 'disabled'],
521
+ attributes: true,
522
+ childList: true,
523
+ subtree: true,
524
+ });
525
+ module.debug('Setting up mutation observer', observer);
526
+ }
527
+ },
528
+ refresh: function () {
529
+ module.verbose('Refreshing selector cache');
530
+ $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body;
531
+ module.refreshFlyouts();
532
+ $pusher = $context.children(selector.pusher);
533
+ module.clear.cache();
534
+ },
535
+
536
+ refreshFlyouts: function () {
537
+ module.verbose('Refreshing other flyouts');
538
+ $flyouts = $context.children(selector.flyout);
539
+ },
540
+
541
+ refreshInputs: function () {
542
+ if ($inputs) {
543
+ $inputs
544
+ .off('keydown' + elementNamespace)
545
+ ;
546
+ }
547
+ if (!settings.dimPage) {
548
+ return;
549
+ }
550
+ $inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
551
+ return $(this).closest('.disabled').length === 0;
552
+ });
553
+ if ($inputs.length === 0) {
554
+ $inputs = $module;
555
+ $module.attr('tabindex', -1);
556
+ } else {
557
+ $module.removeAttr('tabindex');
558
+ }
559
+ $inputs.first()
560
+ .on('keydown' + elementNamespace, module.event.inputKeyDown.first)
561
+ ;
562
+ $inputs.last()
563
+ .on('keydown' + elementNamespace, module.event.inputKeyDown.last)
564
+ ;
565
+ if (settings.autofocus && $inputs.filter(':focus').length === 0) {
566
+ module.set.autofocus();
567
+ }
568
+ },
569
+
570
+ setup: {
571
+ cache: function () {
572
+ module.cache = {
573
+ width: $module.outerWidth(),
574
+ height: $module.outerHeight(),
575
+ };
576
+ },
577
+ layout: function () {
578
+ if ($context.children(selector.pusher).length === 0) {
579
+ module.debug('Adding wrapper element for flyout');
580
+ module.error(error.pusher);
581
+ $pusher = $('<div class="pusher" />');
582
+ $context
583
+ .children()
584
+ .not(selector.omitted)
585
+ .not($flyouts)
586
+ .wrapAll($pusher)
587
+ ;
588
+ module.refresh();
589
+ }
590
+ if ($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
591
+ module.debug('Moved flyout to correct parent element');
592
+ module.error(error.movedFlyout, element);
593
+ $module.detach().prependTo($context);
594
+ module.refresh();
595
+ }
596
+ if (module.is.mobile()) {
597
+ $module.addClass(className.fullscreen);
598
+ }
599
+ module.clear.cache();
600
+ module.set.pushable();
601
+ module.set.direction();
602
+ },
603
+ heights: function () {
604
+ module.debug('Setting up heights', $module);
605
+ var
606
+ $header = $module.children(selector.header),
607
+ $content = $module.children(selector.content),
608
+ $actions = $module.children(selector.actions),
609
+ newContentHeight = ($context.height() || 0) - ($header.outerHeight() || 0) - ($actions.outerHeight() || 0)
610
+ ;
611
+ if (newContentHeight > 0) {
612
+ $content.css('min-height', String(newContentHeight) + 'px');
613
+ }
614
+ },
615
+ },
616
+
617
+ attachEvents: function (selector, event) {
618
+ var
619
+ $toggle = $(selector)
620
+ ;
621
+ event = isFunction(module[event])
622
+ ? module[event]
623
+ : module.toggle;
624
+ if ($toggle.length > 0) {
625
+ module.debug('Attaching flyout events to element', selector, event);
626
+ $toggle
627
+ .on('click' + eventNamespace, event)
628
+ ;
629
+ } else {
630
+ module.error(error.notFound, selector);
631
+ }
632
+ },
633
+
634
+ show: function (callback) {
635
+ callback = isFunction(callback)
636
+ ? callback
637
+ : function () {};
638
+ if (module.is.hidden()) {
639
+ if (settings.onShow.call(element) === false) {
640
+ module.verbose('Show callback returned false cancelling show');
641
+
642
+ return;
643
+ }
644
+ module.refresh();
645
+ if (module.othersActive()) {
646
+ module.debug('Other flyouts currently visible');
647
+ if (settings.exclusive) {
648
+ module.hideOthers();
649
+ } else {
650
+ ignoreRepeatedEvents = false;
651
+ }
652
+ }
653
+ module.set.dimmerStyles();
654
+ module.set.observeAttributes(false);
655
+ module.pushPage(function () {
656
+ callback.call(element);
657
+ settings.onVisible.call(element);
658
+ if (settings.keyboardShortcuts) {
659
+ module.add.keyboardShortcuts();
660
+ }
661
+ module.save.focus();
662
+ module.refreshInputs();
663
+ requestAnimationFrame(module.set.observeAttributes);
664
+ });
665
+ settings.onChange.call(element);
666
+ } else {
667
+ module.debug('Flyout is already visible');
668
+ }
669
+ },
670
+
671
+ hide: function (callback) {
672
+ callback = isFunction(callback)
673
+ ? callback
674
+ : function () {};
675
+ if (settings.onHide.call(element, $(this)) === false) {
676
+ module.verbose('Hide callback returned false cancelling hide');
677
+ ignoreRepeatedEvents = false;
678
+
679
+ return false;
680
+ }
681
+ if (module.is.visible() || module.is.animating()) {
682
+ module.debug('Hiding flyout', callback);
683
+ module.refreshFlyouts();
684
+ module.set.observeAttributes(false);
685
+ module.pullPage(function () {
686
+ callback.call(element);
687
+ if (isFunction(settings.onHidden)) {
688
+ settings.onHidden.call(element);
689
+ }
690
+ module.restore.focus();
691
+ });
692
+ settings.onChange.call(element);
693
+ }
694
+ },
695
+
696
+ othersAnimating: function () {
697
+ return $flyouts.not($module).filter('.' + className.animating).length > 0;
698
+ },
699
+ othersVisible: function () {
700
+ return $flyouts.not($module).filter('.' + className.visible).length > 0;
701
+ },
702
+ othersActive: function () {
703
+ return module.othersVisible() || module.othersAnimating();
704
+ },
705
+
706
+ hideOthers: function (callback) {
707
+ var
708
+ $otherFlyouts = $flyouts.not($module).filter('.' + className.visible),
709
+ flyoutCount = $otherFlyouts.length,
710
+ callbackCount = 0
711
+ ;
712
+ callback = callback || function () {};
713
+ $otherFlyouts
714
+ .flyout('hide', function () {
715
+ callbackCount++;
716
+ if (callbackCount === flyoutCount) {
717
+ callback();
718
+ }
719
+ })
720
+ ;
721
+ },
722
+
723
+ toggle: function () {
724
+ module.verbose('Determining toggled direction');
725
+ if (module.is.hidden()) {
726
+ module.show();
727
+ } else {
728
+ module.hide();
729
+ }
730
+ },
731
+
732
+ pushPage: function (callback) {
733
+ var
734
+ animate,
735
+ dim,
736
+ transitionEnd
737
+ ;
738
+ callback = isFunction(callback)
739
+ ? callback
740
+ : function () {};
741
+ module.set.overlay();
742
+ if (settings.returnScroll) {
743
+ currentScroll = (isBody ? $window : $context).scrollTop();
744
+ }
745
+ module.bind.scrollLock();
746
+ animate = function () {
747
+ module.bind.clickaway();
748
+ module.add.inlineCSS();
749
+ module.set.animating();
750
+ module.set.visible();
751
+ };
752
+ dim = function () {
753
+ module.set.dimmed();
754
+ };
755
+ transitionEnd = function (event) {
756
+ if (event.target === $module[0]) {
757
+ $module.off('transitionend' + elementNamespace, transitionEnd);
758
+ module.remove.animating();
759
+ callback.call(element);
760
+ }
761
+ };
762
+ $module.off('transitionend' + elementNamespace);
763
+ $module.on('transitionend' + elementNamespace, transitionEnd);
764
+ requestAnimationFrame(animate);
765
+ if (settings.dimPage && !module.othersVisible()) {
766
+ requestAnimationFrame(dim);
767
+ }
768
+ },
769
+
770
+ pullPage: function (callback) {
771
+ var
772
+ animate,
773
+ transitionEnd
774
+ ;
775
+ callback = isFunction(callback)
776
+ ? callback
777
+ : function () {};
778
+ module.verbose('Removing context push state', module.get.direction());
779
+
780
+ module.unbind.clickaway();
781
+ if (!module.othersActive()) {
782
+ module.unbind.scrollLock();
783
+ if (settings.keyboardShortcuts) {
784
+ module.remove.keyboardShortcuts();
785
+ }
786
+ }
787
+
788
+ animate = function () {
789
+ module.set.overlay();
790
+ module.set.animating();
791
+ if (settings.dimPage && !module.othersVisible()) {
792
+ module.set.closing();
793
+ }
794
+ module.remove.visible();
795
+ };
796
+ transitionEnd = function (event) {
797
+ if (event.target === $module[0]) {
798
+ $module.off('transitionend' + elementNamespace, transitionEnd);
799
+ module.remove.animating();
800
+ module.remove.closing();
801
+ module.remove.overlay();
802
+ module.remove.inlineCSS();
803
+ if (settings.returnScroll) {
804
+ module.scrollBack();
805
+ }
806
+ if (settings.dimPage && !module.othersVisible()) {
807
+ $pusher.removeClass(className.dimmed);
808
+ }
809
+ callback.call(element);
810
+ }
811
+ };
812
+ $module.off('transitionend' + elementNamespace);
813
+ $module.on('transitionend' + elementNamespace, transitionEnd);
814
+ requestAnimationFrame(animate);
815
+ },
816
+
817
+ scrollToTop: function () {
818
+ module.verbose('Scrolling to top of page to avoid animation issues');
819
+ $module.scrollTop(0);
820
+ (isBody ? $window : $context)[0].scrollTo(0, 0);
821
+ },
822
+
823
+ scrollBack: function () {
824
+ module.verbose('Scrolling back to original page position');
825
+ (isBody ? $window : $context)[0].scrollTo(0, currentScroll);
826
+ },
827
+
828
+ clear: {
829
+ cache: function () {
830
+ module.verbose('Clearing cached dimensions');
831
+ module.cache = {};
832
+ },
833
+ },
834
+
835
+ set: {
836
+ observeAttributes: function (state) {
837
+ observeAttributes = state !== false;
838
+ },
839
+ autofocus: function () {
840
+ var
841
+ $autofocus = $inputs.filter('[autofocus]'),
842
+ $rawInputs = $inputs.filter(':input'),
843
+ $input = $autofocus.length > 0
844
+ ? $autofocus.first()
845
+ : ($rawInputs.length > 0
846
+ ? $rawInputs
847
+ : $inputs.filter(':not(i.close)')
848
+ ).first()
849
+ ;
850
+ // check if only the close icon is remaining
851
+ if ($input.length === 0 && $inputs.length > 0) {
852
+ $input = $inputs.first();
853
+ }
854
+ if ($input.length > 0) {
855
+ $input.trigger('focus');
856
+ }
857
+ },
858
+ dimmerStyles: function () {
859
+ if (settings.blurring) {
860
+ $pusher.addClass(className.blurring);
861
+ } else {
862
+ $pusher.removeClass(className.blurring);
863
+ }
864
+ },
865
+ bodyMargin: function () {
866
+ var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
867
+ $context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
868
+ $context.find(selector.bodyFixed.replace('right', position)).each(function () {
869
+ var
870
+ el = $(this),
871
+ attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
872
+ ;
873
+ el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
874
+ });
875
+ },
876
+
877
+ // ios only (scroll on html not document). This prevent auto-resize canvas/scroll in ios
878
+ // (This is no longer necessary in latest iOS)
879
+ ios: function () {
880
+ $html.addClass(className.ios);
881
+ },
882
+
883
+ // container
884
+ pushed: function () {
885
+ $context.addClass(className.pushed);
886
+ },
887
+ pushable: function () {
888
+ $context.addClass(className.pushable);
889
+ },
890
+
891
+ // pusher
892
+ dimmed: function () {
893
+ $pusher.addClass(className.dimmed);
894
+ },
895
+
896
+ // flyout
897
+ active: function () {
898
+ $module.addClass(className.active);
899
+ },
900
+ animating: function () {
901
+ $module.addClass(className.animating);
902
+ },
903
+ closing: function () {
904
+ $pusher.addClass(className.closing);
905
+ },
906
+ direction: function (direction) {
907
+ direction = direction || module.get.direction();
908
+ $module.addClass(className[direction]);
909
+ },
910
+ visible: function () {
911
+ $module.addClass(className.visible);
912
+ },
913
+ overlay: function () {
914
+ $module.addClass(className.overlay);
915
+ },
916
+ },
917
+ remove: {
918
+
919
+ inlineCSS: function () {
920
+ module.debug('Removing inline css styles', $style);
921
+ if ($style && $style.length > 0) {
922
+ $style.remove();
923
+ }
924
+ },
925
+ keyboardShortcuts: function () {
926
+ module.verbose('Removing keyboard shortcuts');
927
+ $document
928
+ .off('keydown' + eventNamespace)
929
+ ;
930
+ },
931
+
932
+ // ios scroll on html not document
933
+ ios: function () {
934
+ $html.removeClass(className.ios);
935
+ },
936
+
937
+ // context
938
+ pushed: function () {
939
+ $context.removeClass(className.pushed);
940
+ },
941
+ pushable: function () {
942
+ $context.removeClass(className.pushable);
943
+ },
944
+
945
+ // flyout
946
+ active: function () {
947
+ $module.removeClass(className.active);
948
+ },
949
+ animating: function () {
950
+ $module.removeClass(className.animating);
951
+ },
952
+ closing: function () {
953
+ $pusher.removeClass(className.closing);
954
+ },
955
+ direction: function (direction) {
956
+ direction = direction || module.get.direction();
957
+ $module.removeClass(className[direction]);
958
+ },
959
+ visible: function () {
960
+ $module.removeClass(className.visible);
961
+ },
962
+ overlay: function () {
963
+ $module.removeClass(className.overlay);
964
+ },
965
+ },
966
+
967
+ get: {
968
+ direction: function () {
969
+ if ($module.hasClass(className.top)) {
970
+ return className.top;
971
+ }
972
+ if ($module.hasClass(className.right)) {
973
+ return className.right;
974
+ }
975
+ if ($module.hasClass(className.bottom)) {
976
+ return className.bottom;
977
+ }
978
+
979
+ return className.left;
980
+ },
981
+ id: function () {
982
+ return id;
983
+ },
984
+ element: function () {
985
+ return $module;
986
+ },
987
+ settings: function () {
988
+ return settings;
989
+ },
990
+ },
991
+
992
+ can: {
993
+ leftBodyScrollbar: function () {
994
+ if (module.cache.leftBodyScrollbar === undefined) {
995
+ module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari() || module.is.edge() || module.is.ie());
996
+ }
997
+
998
+ return module.cache.leftBodyScrollbar;
999
+ },
1000
+ },
1001
+
1002
+ save: {
1003
+ focus: function () {
1004
+ var
1005
+ $activeElement = $(document.activeElement),
1006
+ inCurrentFlyout = $activeElement.closest($module).length > 0
1007
+ ;
1008
+ if (!inCurrentFlyout) {
1009
+ $focusedElement = $(document.activeElement).trigger('blur');
1010
+ }
1011
+ },
1012
+ bodyMargin: function () {
1013
+ initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
1014
+ var
1015
+ bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10),
1016
+ bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth
1017
+ ;
1018
+ tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
1019
+ },
1020
+ },
1021
+
1022
+ is: {
1023
+ safari: function () {
1024
+ if (module.cache.isSafari === undefined) {
1025
+ module.cache.isSafari = /constructor/i.test(window.HTMLElement) || !!window.ApplePaySession;
1026
+ }
1027
+
1028
+ return module.cache.isSafari;
1029
+ },
1030
+ edge: function () {
1031
+ if (module.cache.isEdge === undefined) {
1032
+ module.cache.isEdge = !!window.setImmediate && !module.is.ie();
1033
+ }
1034
+
1035
+ return module.cache.isEdge;
1036
+ },
1037
+ firefox: function () {
1038
+ if (module.cache.isFirefox === undefined) {
1039
+ module.cache.isFirefox = !!window.InstallTrigger;
1040
+ }
1041
+
1042
+ return module.cache.isFirefox;
1043
+ },
1044
+ iframe: function () {
1045
+ return !(self === top);
1046
+ },
1047
+ ie: function () {
1048
+ if (module.cache.isIE === undefined) {
1049
+ var
1050
+ isIE11 = !window.ActiveXObject && 'ActiveXObject' in window,
1051
+ isIE = 'ActiveXObject' in window
1052
+ ;
1053
+ module.cache.isIE = isIE11 || isIE;
1054
+ }
1055
+
1056
+ return module.cache.isIE;
1057
+ },
1058
+ ios: function () {
1059
+ var
1060
+ userAgent = navigator.userAgent,
1061
+ isIOS = userAgent.match(regExp.ios),
1062
+ isMobileChrome = userAgent.match(regExp.mobileChrome)
1063
+ ;
1064
+ if (isIOS && !isMobileChrome) {
1065
+ module.verbose('Browser was found to be iOS', userAgent);
1066
+
1067
+ return true;
1068
+ }
1069
+
1070
+ return false;
1071
+ },
1072
+ mobile: function () {
1073
+ var
1074
+ userAgent = navigator.userAgent,
1075
+ isMobile = userAgent.match(regExp.mobile)
1076
+ ;
1077
+ if (isMobile) {
1078
+ module.verbose('Browser was found to be mobile', userAgent);
1079
+
1080
+ return true;
1081
+ }
1082
+
1083
+ module.verbose('Browser is not mobile, using regular transition', userAgent);
1084
+
1085
+ return false;
1086
+ },
1087
+ hidden: function () {
1088
+ return !module.is.visible();
1089
+ },
1090
+ visible: function () {
1091
+ return $module.hasClass(className.visible);
1092
+ },
1093
+ animating: function () {
1094
+ return $context.hasClass(className.animating);
1095
+ },
1096
+ rtl: function () {
1097
+ if (module.cache.isRTL === undefined) {
1098
+ module.cache.isRTL = $module.attr('dir') === 'rtl' || $module.css('direction') === 'rtl' || $body.attr('dir') === 'rtl' || $body.css('direction') === 'rtl' || $context.attr('dir') === 'rtl' || $context.css('direction') === 'rtl';
1099
+ }
1100
+
1101
+ return module.cache.isRTL;
1102
+ },
1103
+ },
1104
+
1105
+ has: {
1106
+ configActions: function () {
1107
+ return Array.isArray(settings.actions) && settings.actions.length > 0;
1108
+ },
1109
+ scrollbar: function () {
1110
+ return isBody || $context.css('overflow-y') !== 'hidden';
1111
+ },
1112
+ },
1113
+
1114
+ restore: {
1115
+ focus: function () {
1116
+ if ($focusedElement && $focusedElement.length > 0 && settings.restoreFocus) {
1117
+ $focusedElement.trigger('focus');
1118
+ }
1119
+ },
1120
+ bodyMargin: function () {
1121
+ var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
1122
+ $context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
1123
+ $context.find(selector.bodyFixed.replace('right', position)).each(function () {
1124
+ var
1125
+ el = $(this),
1126
+ attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
1127
+ ;
1128
+ el.css(attribute, '');
1129
+ });
1130
+ },
1131
+ },
1132
+
1133
+ helpers: {
1134
+ deQuote: function (string) {
1135
+ return String(string).replace(/"/g, '');
1136
+ },
1137
+ escape: function (string, preserveHTML) {
1138
+ if (preserveHTML) {
1139
+ return string;
1140
+ }
1141
+ var
1142
+ badChars = /["'<>`]/g,
1143
+ shouldEscape = /["&'<>`]/,
1144
+ escape = {
1145
+ '<': '&lt;',
1146
+ '>': '&gt;',
1147
+ '"': '&quot;',
1148
+ "'": '&#x27;',
1149
+ '`': '&#x60;',
1150
+ },
1151
+ escapedChar = function (chr) {
1152
+ return escape[chr];
1153
+ }
1154
+ ;
1155
+ if (shouldEscape.test(string)) {
1156
+ string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&amp;');
1157
+
1158
+ return string.replace(badChars, escapedChar);
1159
+ }
1160
+
1161
+ return string;
1162
+ },
1163
+ },
1164
+
1165
+ setting: function (name, value) {
1166
+ module.debug('Changing setting', name, value);
1167
+ if ($.isPlainObject(name)) {
1168
+ $.extend(true, settings, name);
1169
+ } else if (value !== undefined) {
1170
+ if ($.isPlainObject(settings[name])) {
1171
+ $.extend(true, settings[name], value);
1172
+ } else {
1173
+ settings[name] = value;
1174
+ }
1175
+ } else {
1176
+ return settings[name];
1177
+ }
1178
+ },
1179
+ internal: function (name, value) {
1180
+ if ($.isPlainObject(name)) {
1181
+ $.extend(true, module, name);
1182
+ } else if (value !== undefined) {
1183
+ module[name] = value;
1184
+ } else {
1185
+ return module[name];
1186
+ }
1187
+ },
1188
+ debug: function () {
1189
+ if (!settings.silent && settings.debug) {
1190
+ if (settings.performance) {
1191
+ module.performance.log(arguments);
1192
+ } else {
1193
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
1194
+ module.debug.apply(console, arguments);
1195
+ }
1196
+ }
1197
+ },
1198
+ verbose: function () {
1199
+ if (!settings.silent && settings.verbose && settings.debug) {
1200
+ if (settings.performance) {
1201
+ module.performance.log(arguments);
1202
+ } else {
1203
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
1204
+ module.verbose.apply(console, arguments);
1205
+ }
1206
+ }
1207
+ },
1208
+ error: function () {
1209
+ if (!settings.silent) {
1210
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
1211
+ module.error.apply(console, arguments);
1212
+ }
1213
+ },
1214
+ performance: {
1215
+ log: function (message) {
1216
+ var
1217
+ currentTime,
1218
+ executionTime,
1219
+ previousTime
1220
+ ;
1221
+ if (settings.performance) {
1222
+ currentTime = Date.now();
1223
+ previousTime = time || currentTime;
1224
+ executionTime = currentTime - previousTime;
1225
+ time = currentTime;
1226
+ performance.push({
1227
+ Name: message[0],
1228
+ Arguments: [].slice.call(message, 1) || '',
1229
+ Element: element,
1230
+ 'Execution Time': executionTime,
1231
+ });
1232
+ }
1233
+ clearTimeout(module.performance.timer);
1234
+ module.performance.timer = setTimeout(module.performance.display, 500);
1235
+ },
1236
+ display: function () {
1237
+ var
1238
+ title = settings.name + ':',
1239
+ totalTime = 0
1240
+ ;
1241
+ time = false;
1242
+ clearTimeout(module.performance.timer);
1243
+ $.each(performance, function (index, data) {
1244
+ totalTime += data['Execution Time'];
1245
+ });
1246
+ title += ' ' + totalTime + 'ms';
1247
+ if (moduleSelector) {
1248
+ title += ' \'' + moduleSelector + '\'';
1249
+ }
1250
+ if (performance.length > 0) {
1251
+ console.groupCollapsed(title);
1252
+ if (console.table) {
1253
+ console.table(performance);
1254
+ } else {
1255
+ $.each(performance, function (index, data) {
1256
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
1257
+ });
1258
+ }
1259
+ console.groupEnd();
1260
+ }
1261
+ performance = [];
1262
+ },
1263
+ },
1264
+ invoke: function (query, passedArguments, context) {
1265
+ var
1266
+ object = instance,
1267
+ maxDepth,
1268
+ found,
1269
+ response
1270
+ ;
1271
+ passedArguments = passedArguments || queryArguments;
1272
+ context = element || context;
1273
+ if (typeof query === 'string' && object !== undefined) {
1274
+ query = query.split(/[ .]/);
1275
+ maxDepth = query.length - 1;
1276
+ $.each(query, function (depth, value) {
1277
+ var camelCaseValue = depth !== maxDepth
1278
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1279
+ : query
1280
+ ;
1281
+ if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
1282
+ object = object[camelCaseValue];
1283
+ } else if (object[camelCaseValue] !== undefined) {
1284
+ found = object[camelCaseValue];
1285
+
1286
+ return false;
1287
+ } else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
1288
+ object = object[value];
1289
+ } else if (object[value] !== undefined) {
1290
+ found = object[value];
1291
+
1292
+ return false;
1293
+ } else {
1294
+ module.error(error.method, query);
1295
+
1296
+ return false;
1297
+ }
1298
+ });
1299
+ }
1300
+ if (isFunction(found)) {
1301
+ response = found.apply(context, passedArguments);
1302
+ } else if (found !== undefined) {
1303
+ response = found;
1304
+ }
1305
+ if (Array.isArray(returnedValue)) {
1306
+ returnedValue.push(response);
1307
+ } else if (returnedValue !== undefined) {
1308
+ returnedValue = [returnedValue, response];
1309
+ } else if (response !== undefined) {
1310
+ returnedValue = response;
1311
+ }
1312
+
1313
+ return found;
1314
+ },
1315
+ };
1316
+
1317
+ if (methodInvoked) {
1318
+ if (instance === undefined) {
1319
+ if (isFunction(settings.templates[query])) {
1320
+ settings.autoShow = true;
1321
+ settings.className.flyout = settings.className.template;
1322
+ settings = $.extend(true, {}, settings, settings.templates[query].apply(module, queryArguments));
1323
+
1324
+ // reassign shortcuts
1325
+ className = settings.className;
1326
+ namespace = settings.namespace;
1327
+ fields = settings.fields;
1328
+ error = settings.error;
1329
+ }
1330
+ module.initialize();
1331
+ }
1332
+ if (!isFunction(settings.templates[query])) {
1333
+ module.invoke(query);
1334
+ }
1335
+ } else {
1336
+ if (instance !== undefined) {
1337
+ instance.invoke('destroy');
1338
+ }
1339
+ module.initialize();
1340
+ returnedValue = $module;
1341
+ }
1342
+ });
1343
+
1344
+ return returnedValue !== undefined
1345
+ ? returnedValue
1346
+ : this;
1347
+ };
1348
+ $.flyout = $.fn.flyout;
1349
+
1350
+ $.fn.flyout.settings = {
1351
+
1352
+ name: 'Flyout',
1353
+ namespace: 'flyout',
1354
+
1355
+ silent: false,
1356
+ debug: false,
1357
+ verbose: false,
1358
+ performance: true,
1359
+
1360
+ context: 'body',
1361
+ exclusive: false,
1362
+ closable: true,
1363
+ autofocus: true,
1364
+ restoreFocus: true,
1365
+ dimPage: true,
1366
+ scrollLock: false,
1367
+ returnScroll: false,
1368
+ delaySetup: false,
1369
+ autoShow: false,
1370
+
1371
+ keyboardShortcuts: true,
1372
+
1373
+ // dynamic content
1374
+ title: '',
1375
+ content: '',
1376
+ class: '',
1377
+ classTitle: '',
1378
+ classContent: '',
1379
+ classActions: '',
1380
+ closeIcon: false,
1381
+ actions: false,
1382
+ preserveHTML: true,
1383
+
1384
+ fields: {
1385
+ class: 'class',
1386
+ text: 'text',
1387
+ icon: 'icon',
1388
+ click: 'click',
1389
+ },
1390
+
1391
+ onChange: function () {},
1392
+ onShow: function () {},
1393
+ onHide: function () {
1394
+ return true;
1395
+ },
1396
+
1397
+ onHidden: false,
1398
+ onVisible: function () {},
1399
+
1400
+ onApprove: function () {},
1401
+ onDeny: function () {},
1402
+
1403
+ keys: {
1404
+ space: 32,
1405
+ enter: 13,
1406
+ escape: 27,
1407
+ tab: 9,
1408
+ },
1409
+
1410
+ className: {
1411
+ flyout: 'ui flyout',
1412
+ close: 'close icon',
1413
+ header: 'ui header',
1414
+ content: 'content',
1415
+ actions: 'actions',
1416
+ active: 'active',
1417
+ animating: 'animating',
1418
+ blurring: 'blurring',
1419
+ closing: 'closing',
1420
+ dimmed: 'dimmed',
1421
+ ios: 'ios',
1422
+ locked: 'locked',
1423
+ pushable: 'pushable',
1424
+ pushed: 'pushed',
1425
+ right: 'right',
1426
+ top: 'top',
1427
+ left: 'left',
1428
+ bottom: 'bottom',
1429
+ visible: 'visible',
1430
+ overlay: 'overlay',
1431
+ fullscreen: 'fullscreen',
1432
+ template: 'ui flyout',
1433
+ button: 'ui button',
1434
+ ok: 'positive',
1435
+ cancel: 'negative',
1436
+ prompt: 'ui fluid input',
1437
+ },
1438
+
1439
+ selector: {
1440
+ bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.right.flyout, > .ui.fixed.nag, > .ui.fixed.nag > .close',
1441
+ fixed: '.fixed',
1442
+ omitted: 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed',
1443
+ pusher: '.pusher',
1444
+ flyout: '.ui.flyout',
1445
+ header: '.ui.header',
1446
+ content: '.content',
1447
+ actions: '.actions',
1448
+ close: '.close',
1449
+ approve: '.actions .positive, .actions .approve, .actions .ok',
1450
+ deny: '.actions .negative, .actions .deny, .actions .cancel',
1451
+ },
1452
+
1453
+ regExp: {
1454
+ ios: /(iPad|iPhone|iPod)/g,
1455
+ mobileChrome: /(CriOS)/g,
1456
+ mobile: /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g,
1457
+ },
1458
+
1459
+ error: {
1460
+ method: 'The method you called is not defined.',
1461
+ pusher: 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element',
1462
+ movedFlyout: 'Had to move flyout. For optimal performance make sure flyout and pusher are direct children of your body tag',
1463
+ notFound: 'There were no elements that matched the specified selector',
1464
+ },
1465
+
1466
+ text: {
1467
+ ok: 'Ok',
1468
+ cancel: 'Cancel',
1469
+ close: 'Close',
1470
+ },
1471
+ };
1472
+
1473
+ $.fn.flyout.settings.templates = {
1474
+ getArguments: function (args) {
1475
+ var queryArguments = [].slice.call(args);
1476
+ if ($.isPlainObject(queryArguments[0])) {
1477
+ return $.extend({
1478
+ handler: function () {},
1479
+ content: '',
1480
+ title: '',
1481
+ }, queryArguments[0]);
1482
+ }
1483
+ if (!isFunction(queryArguments[queryArguments.length - 1])) {
1484
+ queryArguments.push(function () {});
1485
+ }
1486
+
1487
+ return {
1488
+ handler: queryArguments.pop(),
1489
+ content: queryArguments.pop() || '',
1490
+ title: queryArguments.pop() || '',
1491
+ };
1492
+ },
1493
+ alert: function () {
1494
+ var
1495
+ settings = this.get.settings(),
1496
+ args = settings.templates.getArguments(arguments)
1497
+ ;
1498
+
1499
+ return {
1500
+ title: args.title,
1501
+ content: args.content,
1502
+ actions: [{
1503
+ text: settings.text.ok,
1504
+ class: settings.className.ok,
1505
+ click: args.handler,
1506
+ }],
1507
+ };
1508
+ },
1509
+ confirm: function () {
1510
+ var
1511
+ settings = this.get.settings(),
1512
+ args = settings.templates.getArguments(arguments)
1513
+ ;
1514
+
1515
+ return {
1516
+ title: args.title,
1517
+ content: args.content,
1518
+ actions: [{
1519
+ text: settings.text.ok,
1520
+ class: settings.className.ok,
1521
+ click: function () {
1522
+ args.handler(true);
1523
+ },
1524
+ }, {
1525
+ text: settings.text.cancel,
1526
+ class: settings.className.cancel,
1527
+ click: function () {
1528
+ args.handler(false);
1529
+ },
1530
+ }],
1531
+ };
1532
+ },
1533
+ prompt: function () {
1534
+ var
1535
+ $this = this,
1536
+ settings = this.get.settings(),
1537
+ args = settings.templates.getArguments(arguments),
1538
+ input = $($.parseHTML(args.content)).filter('.ui.input')
1539
+ ;
1540
+ if (input.length === 0) {
1541
+ args.content += '<p><div class="' + settings.className.prompt + '"><input placeholder="' + this.helpers.deQuote(args.placeholder || '') + '" type="text" value="' + this.helpers.deQuote(args.defaultValue || '') + '"></div></p>';
1542
+ }
1543
+
1544
+ return {
1545
+ title: args.title,
1546
+ content: args.content,
1547
+ actions: [{
1548
+ text: settings.text.ok,
1549
+ class: settings.className.ok,
1550
+ click: function () {
1551
+ var
1552
+ settings = $this.get.settings(),
1553
+ inputField = $this.get.element().find(settings.selector.prompt)[0]
1554
+ ;
1555
+ args.handler($(inputField).val());
1556
+ },
1557
+ }, {
1558
+ text: settings.text.cancel,
1559
+ class: settings.className.cancel,
1560
+ click: function () {
1561
+ args.handler(null);
1562
+ },
1563
+ }],
1564
+ };
1565
+ },
1566
+ };
1567
+ })(jQuery, window, document);