libre-jqgrid 4.17.2 → 4.17.4

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 (211) hide show
  1. package/.tscache/all/hashes/free-jqgrid.d.ts-74303c8b076937117540c0cb798f2053 +1 -0
  2. package/.tscache/all/hashes/test.ts-0d81877a31bc5d7ac52dd35a66602f01 +1 -0
  3. package/.tscache/all/timestamp +0 -0
  4. package/dist/css/ui.jqgrid.css +1618 -0
  5. package/dist/css/ui.jqgrid.min.css +4 -0
  6. package/dist/css/ui.jqgrid.min.css.map +1 -0
  7. package/dist/i18n/grid.locale-ar.js +198 -0
  8. package/dist/i18n/grid.locale-bg.js +201 -0
  9. package/dist/i18n/grid.locale-bs.js +230 -0
  10. package/dist/i18n/grid.locale-ca.js +204 -0
  11. package/dist/i18n/grid.locale-cn.js +237 -0
  12. package/dist/i18n/grid.locale-cs.js +197 -0
  13. package/dist/i18n/grid.locale-da.js +196 -0
  14. package/dist/i18n/grid.locale-de.js +240 -0
  15. package/dist/i18n/grid.locale-el.js +195 -0
  16. package/dist/i18n/grid.locale-en.js +256 -0
  17. package/dist/i18n/grid.locale-es.js +202 -0
  18. package/dist/i18n/grid.locale-fa.js +211 -0
  19. package/dist/i18n/grid.locale-fi.js +201 -0
  20. package/dist/i18n/grid.locale-fr.js +197 -0
  21. package/dist/i18n/grid.locale-gl.js +197 -0
  22. package/dist/i18n/grid.locale-he.js +198 -0
  23. package/dist/i18n/grid.locale-hr.js +231 -0
  24. package/dist/i18n/grid.locale-hu.js +196 -0
  25. package/dist/i18n/grid.locale-id.js +238 -0
  26. package/dist/i18n/grid.locale-is.js +197 -0
  27. package/dist/i18n/grid.locale-it.js +189 -0
  28. package/dist/i18n/grid.locale-ja.js +203 -0
  29. package/dist/i18n/grid.locale-kr.js +194 -0
  30. package/dist/i18n/grid.locale-lt.js +199 -0
  31. package/dist/i18n/grid.locale-me.js +198 -0
  32. package/dist/i18n/grid.locale-nl.js +208 -0
  33. package/dist/i18n/grid.locale-no.js +180 -0
  34. package/dist/i18n/grid.locale-pl.js +204 -0
  35. package/dist/i18n/grid.locale-pt-br.js +210 -0
  36. package/dist/i18n/grid.locale-pt.js +196 -0
  37. package/dist/i18n/grid.locale-ro.js +210 -0
  38. package/dist/i18n/grid.locale-ru.js +196 -0
  39. package/dist/i18n/grid.locale-sk.js +198 -0
  40. package/dist/i18n/grid.locale-sl.js +230 -0
  41. package/dist/i18n/grid.locale-sr.js +199 -0
  42. package/dist/i18n/grid.locale-sv.js +198 -0
  43. package/dist/i18n/grid.locale-th.js +195 -0
  44. package/dist/i18n/grid.locale-tr.js +197 -0
  45. package/dist/i18n/grid.locale-tw.js +199 -0
  46. package/dist/i18n/grid.locale-ua.js +199 -0
  47. package/dist/i18n/grid.locale-vi.js +238 -0
  48. package/dist/i18n/min/grid.locale-ar.js +10 -0
  49. package/dist/i18n/min/grid.locale-ar.js.map +1 -0
  50. package/dist/i18n/min/grid.locale-bg.js +10 -0
  51. package/dist/i18n/min/grid.locale-bg.js.map +1 -0
  52. package/dist/i18n/min/grid.locale-ca.js +15 -0
  53. package/dist/i18n/min/grid.locale-ca.js.map +1 -0
  54. package/dist/i18n/min/grid.locale-cn.js +10 -0
  55. package/dist/i18n/min/grid.locale-cn.js.map +1 -0
  56. package/dist/i18n/min/grid.locale-cs.js +11 -0
  57. package/dist/i18n/min/grid.locale-cs.js.map +1 -0
  58. package/dist/i18n/min/grid.locale-da.js +10 -0
  59. package/dist/i18n/min/grid.locale-da.js.map +1 -0
  60. package/dist/i18n/min/grid.locale-de.js +21 -0
  61. package/dist/i18n/min/grid.locale-de.js.map +1 -0
  62. package/dist/i18n/min/grid.locale-el.js +10 -0
  63. package/dist/i18n/min/grid.locale-el.js.map +1 -0
  64. package/dist/i18n/min/grid.locale-en.js +11 -0
  65. package/dist/i18n/min/grid.locale-en.js.map +1 -0
  66. package/dist/i18n/min/grid.locale-es.js +16 -0
  67. package/dist/i18n/min/grid.locale-es.js.map +1 -0
  68. package/dist/i18n/min/grid.locale-fa.js +8 -0
  69. package/dist/i18n/min/grid.locale-fa.js.map +1 -0
  70. package/dist/i18n/min/grid.locale-fi.js +11 -0
  71. package/dist/i18n/min/grid.locale-fi.js.map +1 -0
  72. package/dist/i18n/min/grid.locale-fr.js +10 -0
  73. package/dist/i18n/min/grid.locale-fr.js.map +1 -0
  74. package/dist/i18n/min/grid.locale-gl.js +9 -0
  75. package/dist/i18n/min/grid.locale-gl.js.map +1 -0
  76. package/dist/i18n/min/grid.locale-he.js +10 -0
  77. package/dist/i18n/min/grid.locale-he.js.map +1 -0
  78. package/dist/i18n/min/grid.locale-hr.js +11 -0
  79. package/dist/i18n/min/grid.locale-hr.js.map +1 -0
  80. package/dist/i18n/min/grid.locale-hu.js +10 -0
  81. package/dist/i18n/min/grid.locale-hu.js.map +1 -0
  82. package/dist/i18n/min/grid.locale-id.js +10 -0
  83. package/dist/i18n/min/grid.locale-id.js.map +1 -0
  84. package/dist/i18n/min/grid.locale-is.js +9 -0
  85. package/dist/i18n/min/grid.locale-is.js.map +1 -0
  86. package/dist/i18n/min/grid.locale-it.js +2 -0
  87. package/dist/i18n/min/grid.locale-it.js.map +1 -0
  88. package/dist/i18n/min/grid.locale-ja.js +10 -0
  89. package/dist/i18n/min/grid.locale-ja.js.map +1 -0
  90. package/dist/i18n/min/grid.locale-kr.js +2 -0
  91. package/dist/i18n/min/grid.locale-kr.js.map +1 -0
  92. package/dist/i18n/min/grid.locale-lt.js +10 -0
  93. package/dist/i18n/min/grid.locale-lt.js.map +1 -0
  94. package/dist/i18n/min/grid.locale-me.js +10 -0
  95. package/dist/i18n/min/grid.locale-me.js.map +1 -0
  96. package/dist/i18n/min/grid.locale-nl.js +2 -0
  97. package/dist/i18n/min/grid.locale-nl.js.map +1 -0
  98. package/dist/i18n/min/grid.locale-no.js +2 -0
  99. package/dist/i18n/min/grid.locale-no.js.map +1 -0
  100. package/dist/i18n/min/grid.locale-pl.js +18 -0
  101. package/dist/i18n/min/grid.locale-pl.js.map +1 -0
  102. package/dist/i18n/min/grid.locale-pt-br.js +21 -0
  103. package/dist/i18n/min/grid.locale-pt-br.js.map +1 -0
  104. package/dist/i18n/min/grid.locale-pt.js +9 -0
  105. package/dist/i18n/min/grid.locale-pt.js.map +1 -0
  106. package/dist/i18n/min/grid.locale-ro.js +10 -0
  107. package/dist/i18n/min/grid.locale-ro.js.map +1 -0
  108. package/dist/i18n/min/grid.locale-ru.js +10 -0
  109. package/dist/i18n/min/grid.locale-ru.js.map +1 -0
  110. package/dist/i18n/min/grid.locale-sk.js +10 -0
  111. package/dist/i18n/min/grid.locale-sk.js.map +1 -0
  112. package/dist/i18n/min/grid.locale-sr.js +10 -0
  113. package/dist/i18n/min/grid.locale-sr.js.map +1 -0
  114. package/dist/i18n/min/grid.locale-sv.js +10 -0
  115. package/dist/i18n/min/grid.locale-sv.js.map +1 -0
  116. package/dist/i18n/min/grid.locale-th.js +10 -0
  117. package/dist/i18n/min/grid.locale-th.js.map +1 -0
  118. package/dist/i18n/min/grid.locale-tr.js +10 -0
  119. package/dist/i18n/min/grid.locale-tr.js.map +1 -0
  120. package/dist/i18n/min/grid.locale-tw.js +11 -0
  121. package/dist/i18n/min/grid.locale-tw.js.map +1 -0
  122. package/dist/i18n/min/grid.locale-ua.js +10 -0
  123. package/dist/i18n/min/grid.locale-ua.js.map +1 -0
  124. package/dist/i18n/min/grid.locale-vi.js +10 -0
  125. package/dist/i18n/min/grid.locale-vi.js.map +1 -0
  126. package/dist/jquery.jqgrid.min.js +11 -0
  127. package/dist/jquery.jqgrid.min.js.map +1 -0
  128. package/{js/jquery.jqgrid.src.js.1 → dist/jquery.jqgrid.src.js} +1 -1
  129. package/dist/modules/grid.base.js +8518 -0
  130. package/dist/modules/grid.celledit.js +673 -0
  131. package/dist/modules/grid.common.js +844 -0
  132. package/dist/modules/grid.custom.js +1795 -0
  133. package/dist/modules/grid.filter.js +897 -0
  134. package/dist/modules/grid.formedit.js +2537 -0
  135. package/dist/modules/grid.grouping.js +737 -0
  136. package/dist/modules/grid.import.js +251 -0
  137. package/dist/modules/grid.inlinedit.js +784 -0
  138. package/dist/modules/grid.jqueryui.js +965 -0
  139. package/dist/modules/grid.pivot.js +862 -0
  140. package/dist/modules/grid.subgrid.js +379 -0
  141. package/dist/modules/grid.tbltogrid.js +141 -0
  142. package/dist/modules/grid.treegrid.js +683 -0
  143. package/dist/modules/jqdnr.js +188 -0
  144. package/dist/modules/jqmodal.js +292 -0
  145. package/dist/modules/jquery.fmatter.js +1061 -0
  146. package/dist/modules/jsonxml.js +343 -0
  147. package/dist/modules/min/grid.base.js +11 -0
  148. package/dist/modules/min/grid.base.js.map +1 -0
  149. package/dist/modules/min/grid.celledit.js +2 -0
  150. package/dist/modules/min/grid.celledit.js.map +1 -0
  151. package/dist/modules/min/grid.common.js +2 -0
  152. package/dist/modules/min/grid.common.js.map +1 -0
  153. package/dist/modules/min/grid.custom.js +2 -0
  154. package/dist/modules/min/grid.custom.js.map +1 -0
  155. package/dist/modules/min/grid.filter.js +2 -0
  156. package/dist/modules/min/grid.filter.js.map +1 -0
  157. package/dist/modules/min/grid.formedit.js +2 -0
  158. package/dist/modules/min/grid.formedit.js.map +1 -0
  159. package/dist/modules/min/grid.grouping.js +2 -0
  160. package/dist/modules/min/grid.grouping.js.map +1 -0
  161. package/dist/modules/min/grid.import.js +2 -0
  162. package/dist/modules/min/grid.import.js.map +1 -0
  163. package/dist/modules/min/grid.inlinedit.js +2 -0
  164. package/dist/modules/min/grid.inlinedit.js.map +1 -0
  165. package/dist/modules/min/grid.jqueryui.js +2 -0
  166. package/dist/modules/min/grid.jqueryui.js.map +1 -0
  167. package/dist/modules/min/grid.pivot.js +2 -0
  168. package/dist/modules/min/grid.pivot.js.map +1 -0
  169. package/dist/modules/min/grid.subgrid.js +2 -0
  170. package/dist/modules/min/grid.subgrid.js.map +1 -0
  171. package/dist/modules/min/grid.tbltogrid.js +2 -0
  172. package/dist/modules/min/grid.tbltogrid.js.map +1 -0
  173. package/dist/modules/min/grid.treegrid.js +2 -0
  174. package/dist/modules/min/grid.treegrid.js.map +1 -0
  175. package/dist/modules/min/jqdnr.js +2 -0
  176. package/dist/modules/min/jqdnr.js.map +1 -0
  177. package/dist/modules/min/jqmodal.js +2 -0
  178. package/dist/modules/min/jqmodal.js.map +1 -0
  179. package/dist/modules/min/jquery.fmatter.js +2 -0
  180. package/dist/modules/min/jquery.fmatter.js.map +1 -0
  181. package/dist/modules/min/jsonxml.js +2 -0
  182. package/dist/modules/min/jsonxml.js.map +1 -0
  183. package/dist/plugins/css/ui.multiselect.css +30 -0
  184. package/dist/plugins/css/ui.multiselect.min.css +2 -0
  185. package/dist/plugins/css/ui.multiselect.min.css.map +1 -0
  186. package/dist/plugins/grid.odata.js +1313 -0
  187. package/dist/plugins/jqgrid_download.js +109 -0
  188. package/dist/plugins/jquery.contextmenu-ui.js +304 -0
  189. package/dist/plugins/jquery.contextmenu.js +174 -0
  190. package/dist/plugins/jquery.createcontexmenufromnavigatorbuttons.js +172 -0
  191. package/dist/plugins/jquery.jqgrid.showhidecolumnmenu.js +201 -0
  192. package/dist/plugins/min/grid.odata.js +11 -0
  193. package/dist/plugins/min/grid.odata.js.map +1 -0
  194. package/dist/plugins/min/jquery.contextmenu-ui.js +26 -0
  195. package/dist/plugins/min/jquery.contextmenu-ui.js.map +1 -0
  196. package/dist/plugins/min/jquery.contextmenu.js +19 -0
  197. package/dist/plugins/min/jquery.contextmenu.js.map +1 -0
  198. package/dist/plugins/min/jquery.createcontexmenufromnavigatorbuttons.js +12 -0
  199. package/dist/plugins/min/jquery.createcontexmenufromnavigatorbuttons.js.map +1 -0
  200. package/dist/plugins/min/jquery.jqgrid.showhidecolumnmenu.js +10 -0
  201. package/dist/plugins/min/jquery.jqgrid.showhidecolumnmenu.js.map +1 -0
  202. package/dist/plugins/min/ui.multiselect.js +30 -0
  203. package/dist/plugins/min/ui.multiselect.js.map +1 -0
  204. package/dist/plugins/ui.multiselect.js +389 -0
  205. package/dist/ts/free-jqgrid.d.ts +2132 -0
  206. package/js/jquery.jqgrid.min.js +1 -1
  207. package/js/jquery.jqgrid.min.js.map +1 -1
  208. package/js/jquery.jqgrid.src.js +8 -3
  209. package/libre-jqgrid-4.17.4.tgz +0 -0
  210. package/package.json +1 -1
  211. package/.github/workflows/npm.yml +0 -47
@@ -0,0 +1,188 @@
1
+ /**
2
+ * jqDnR - Minimalistic Drag'n'Resize for jQuery.
3
+ *
4
+ * Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
5
+ * Licensed under the MIT License:
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ *
8
+ * $Version: 2007.08.19 +r2
9
+ * Updated by Oleg Kiriljuk to support touch devices
10
+ * Copyright (c) 2014-2019, Oleg Kiriljuk, oleg.kiriljuk@ok-soft-gmbh.com
11
+ */
12
+ /*jslint browser: true, white: true */
13
+ /*global jQuery, define, exports, module, require */
14
+ (function (global, factory) {
15
+ "use strict";
16
+ if (typeof define === "function" && define.amd) {
17
+ // AMD. Register as an anonymous module.
18
+ define([
19
+ "jquery"
20
+ ], function ($) {
21
+ return factory($, global, global.document);
22
+ });
23
+ } else if (typeof module === "object" && module.exports) {
24
+ // Node/CommonJS
25
+ module.exports = function (root, $) {
26
+ if (!root) {
27
+ root = window;
28
+ }
29
+ if ($ === undefined) {
30
+ // require("jquery") returns a factory that requires window to
31
+ // build a jQuery instance, we normalize how we use modules
32
+ // that require this pattern but the window provided is a noop
33
+ // if it's defined (how jquery works)
34
+ $ = typeof window !== "undefined" ?
35
+ require("jquery") :
36
+ require("jquery")(root);
37
+ }
38
+ factory($, root, root.document);
39
+ return $;
40
+ };
41
+ } else {
42
+ // Browser globals
43
+ factory(jQuery, global, global.document);
44
+ }
45
+ }(typeof window !== "undefined" ? window : this, function ($, window, document) {
46
+ "use strict";
47
+ // begin module jqdnr
48
+ var namespace = ".jqGrid", mouseDown = "mousedown", mouseMove = "mousemove", mouseUp = "mouseup",
49
+ getMouseCoordinates = function (e) {
50
+ var orgEvent = e.originalEvent, touches = orgEvent.targetTouches;
51
+ if (touches) {
52
+ touches = touches[0];
53
+ return { x: touches.pageX, y: touches.pageY };
54
+ }
55
+ return { x: e.pageX, y: e.pageY };
56
+ },
57
+ jqDnR = {
58
+ drag: function (e) {
59
+ var d = e.data, $mainDialog = d.e, dnrMainDialog = d.dnr, $alsoResize = d.ar, dnrAlsoResize = d.dnrAr,
60
+ xy = getMouseCoordinates(e);
61
+ if (dnrMainDialog.k === "move") {
62
+ $mainDialog.css({
63
+ left: dnrMainDialog.X + xy.x - dnrMainDialog.pX,
64
+ top: dnrMainDialog.Y + xy.y - dnrMainDialog.pY
65
+ });
66
+ } else {
67
+ $mainDialog.css({
68
+ width: Math.max(xy.x - dnrMainDialog.pX + dnrMainDialog.W, 0),
69
+ height: Math.max(xy.y - dnrMainDialog.pY + dnrMainDialog.H, 0)
70
+ });
71
+ if (dnrAlsoResize) {
72
+ $alsoResize.css({
73
+ width: Math.max(xy.x - dnrAlsoResize.pX + dnrAlsoResize.W, 0),
74
+ height: Math.max(xy.y - dnrAlsoResize.pY + dnrAlsoResize.H, 0)
75
+ });
76
+ }
77
+ }
78
+ return false;
79
+ },
80
+ stop: function () {
81
+ //$mainDialog.css("opacity", dnr.o);
82
+ $(document).off(mouseMove, jqDnR.drag).off(mouseUp, jqDnR.stop);
83
+ }
84
+ },
85
+ init = function ($this, handle, actionName, alsoResize) {
86
+ return $this.each(function () {
87
+ handle = handle ? $(handle, $this) : $this;
88
+ handle.on(mouseDown, { e: $this, k: actionName }, function (e) {
89
+ var d = e.data, p = {}, $inputDatePicker, $mainDialog, dnrMainDialog, $alsoResize, dnrAlsoResize,
90
+ getCssProp = function ($elem, propertyName) {
91
+ return parseInt($elem.css(propertyName), 10) || false;
92
+ },
93
+ getMainCssProp = function (propertyName) {
94
+ return getCssProp($mainDialog, propertyName);
95
+ },
96
+ getAlsoResizeCssProp = function (propertyName) {
97
+ return getCssProp($alsoResize, propertyName);
98
+ },
99
+ xy = getMouseCoordinates(e),
100
+ eventData;
101
+
102
+ if ($(e.target).hasClass("ui-jqdialog-titlebar-close") || $(e.target).parent().hasClass("ui-jqdialog-titlebar-close")) {
103
+ //$(e.target).click();
104
+ return;
105
+ }
106
+
107
+ $mainDialog = d.e;
108
+ $alsoResize = alsoResize ? $(alsoResize) : false;
109
+ // attempt utilization of dimensions plugin to fix IE issues
110
+ if ($mainDialog.css("position") !== "relative") {
111
+ try {
112
+ // ???? probably one want to GET position and save it in p ?
113
+ // the current implementation use always p = {}
114
+ // probably one mean some additional work together with Dimensions Plugin (dimensions.js)
115
+ $mainDialog.position(p);
116
+ } catch (ignore) { }
117
+ }
118
+ dnrMainDialog = {
119
+ X: p.left || getMainCssProp("left") || 0,
120
+ Y: p.top || getMainCssProp("top") || 0,
121
+ W: getMainCssProp("width") || $mainDialog[0].scrollWidth || 0,
122
+ H: getMainCssProp("height") || $mainDialog[0].scrollHeight || 0,
123
+ pX: xy.x,
124
+ pY: xy.y,
125
+ k: d.k
126
+ //o:$mainDialog.css("opacity")
127
+ };
128
+ // also resize
129
+ if ($alsoResize && d.k !== "move") {
130
+ dnrAlsoResize = {
131
+ X: p.left || getAlsoResizeCssProp("left") || 0,
132
+ Y: p.top || getAlsoResizeCssProp("top") || 0,
133
+ W: $alsoResize[0].offsetWidth || getAlsoResizeCssProp("width") || 0,
134
+ H: $alsoResize[0].offsetHeight || getAlsoResizeCssProp("height") || 0,
135
+ pX: xy.x,
136
+ pY: xy.y,
137
+ k: d.k
138
+ };
139
+ } else {
140
+ dnrAlsoResize = false;
141
+ }
142
+ //E.css({opacity:0.8});
143
+ $inputDatePicker = $mainDialog.find("input.hasDatepicker");
144
+ if ($inputDatePicker.length > 0) {
145
+ try {
146
+ $inputDatePicker.datepicker("hide");
147
+ } catch (ignore) { }
148
+ }
149
+ eventData = {
150
+ e: $mainDialog,
151
+ dnr: dnrMainDialog,
152
+ ar: $alsoResize,
153
+ dnrAr: dnrAlsoResize
154
+ };
155
+ $(document).on(mouseMove, eventData, jqDnR.drag);
156
+ $(document).on(mouseUp, eventData, jqDnR.stop);
157
+ return false;
158
+ });
159
+ });
160
+ };
161
+
162
+ // navigator.maxTouchPoints == 2, navigator.msMaxTouchPoints
163
+ // https://msdn.microsoft.com/en-us/library/ie/dn304886(v=vs.85).aspx
164
+ if (window.PointerEvent) {
165
+ mouseDown += namespace + " pointerdown" + namespace;
166
+ mouseMove += namespace + " pointermove" + namespace;
167
+ mouseUp += namespace + " pointerup" + namespace;
168
+ } else if (window.MSPointerEvent) {
169
+ mouseDown += namespace + " mspointerdown" + namespace;
170
+ mouseMove += namespace + " mspointermove" + namespace;
171
+ mouseUp += namespace + " mspointerup";
172
+ } else { //if (Object.prototype.hasOwnProperty.call(document, "ontouchend")) { or "ontouchstart" in document.documentElement or "ontouchstart" in window
173
+ mouseDown += namespace + " touchstart" + namespace;
174
+ mouseMove += namespace + " touchmove" + namespace;
175
+ mouseUp += namespace + " touchend" + namespace;
176
+ }
177
+
178
+ $.jqDnR = jqDnR;
179
+
180
+ $.fn.jqDrag = function (handle) {
181
+ return init(this, handle, "move");
182
+ };
183
+
184
+ $.fn.jqResize = function (handle, alsoResize) {
185
+ return init(this, handle, "resize", alsoResize);
186
+ };
187
+ // end module jqdnr
188
+ }));
@@ -0,0 +1,292 @@
1
+ /**
2
+ * jqModal - Minimalist Modaling with jQuery
3
+ * (http://dev.iceburg.net/jquery/jqmodal/)
4
+ *
5
+ * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl.html
9
+ *
10
+ * $Version: 07/06/2008 +r13
11
+ * Changed by Oleg Kiriljuk, oleg.kiriljuk@ok-soft-gmbh.com
12
+ * Copyright (c) 2014-2019, Oleg Kiriljuk, oleg.kiriljuk@ok-soft-gmbh.com
13
+ */
14
+ /*jslint browser: true, nomen: true, plusplus: true, white: true */
15
+ /*global jQuery, define, exports, module, require */
16
+ (function (global, factory) {
17
+ "use strict";
18
+ if (typeof define === "function" && define.amd) {
19
+ // AMD. Register as an anonymous module.
20
+ define([
21
+ "jquery"
22
+ ], function ($) {
23
+ return factory($, global.document);
24
+ });
25
+ } else if (typeof module === "object" && module.exports) {
26
+ // Node/CommonJS
27
+ module.exports = function (root, $) {
28
+ if (!root) {
29
+ root = window;
30
+ }
31
+ if ($ === undefined) {
32
+ // require("jquery") returns a factory that requires window to
33
+ // build a jQuery instance, we normalize how we use modules
34
+ // that require this pattern but the window provided is a noop
35
+ // if it's defined (how jquery works)
36
+ $ = typeof window !== "undefined" ?
37
+ require("jquery") :
38
+ require("jquery")(root);
39
+ }
40
+ factory($, root.document);
41
+ return $;
42
+ };
43
+ } else {
44
+ // Browser globals
45
+ factory(jQuery, global.document);
46
+ }
47
+ }(typeof window !== "undefined" ? window : this, function ($, document) {
48
+ "use strict";
49
+ // begin module jqmodal
50
+ var jqmHashLength = 0,
51
+ jqmHash,
52
+ createdModals = [],
53
+ setFocusOnFirstVisibleInput = function (h) {
54
+ try {
55
+ $(":input:visible", h.w).first().focus();
56
+ } catch (ignore) {}
57
+ },
58
+ setFocus = function (h) {
59
+ setFocusOnFirstVisibleInput(h);
60
+ },
61
+ keyOrMouseEventHandler = function (e) {
62
+ var activeModal = jqmHash[createdModals[createdModals.length - 1]],
63
+ modal = !$(e.target).parents(".jqmID" + activeModal.s)[0],
64
+ targetOffset = $(e.target).offset(),
65
+ eX = e.pageX !== undefined ? e.pageX : targetOffset.left,
66
+ eY = e.pageY !== undefined ? e.pageY : targetOffset.top,
67
+ isEventInsideOfModal = function () {
68
+ var isInside = false;
69
+ $(".jqmID" + activeModal.s).each(function () {
70
+ var $self = $(this), offset = $self.offset();
71
+ // mouse event have e.pageX and e.pageY
72
+ // keyboard event have e.type == "keydown" or "keypress",
73
+ // e.pageX and e.pageY are undefined and one can use
74
+ // $(e.target).offset()
75
+ if (offset.top <= eY && eY <= offset.top + $self.height() &&
76
+ offset.left <= eX && eX <= offset.left + $self.width()) {
77
+ isInside = true;
78
+ return false; // stop enumeration
79
+ }
80
+ });
81
+ return isInside;
82
+ };
83
+ if (e.type !== "mousedown" && isEventInsideOfModal()) {
84
+ // allows keyboard events inside of the modal
85
+ return true;
86
+ }
87
+ if (e.type === "mousedown" && modal) {
88
+ if (isEventInsideOfModal()) {
89
+ modal = false;
90
+ }
91
+ if (modal && !$(e.target).is(":input")) {
92
+ setFocusOnFirstVisibleInput(activeModal);
93
+ }
94
+ }
95
+ return !modal;
96
+ },
97
+ bindOrUnbindEvents = function (bindOrUnbind) {
98
+ // bindOrUnbind is either "bind" or "unbind" string
99
+ $(document)[bindOrUnbind]("keypress keydown mousedown", keyOrMouseEventHandler);
100
+ },
101
+ registerHideOrShow = function (w, trigger, key) {
102
+ return w.each(function () {
103
+ var jqm = this._jqm;
104
+ $(trigger).each(function () {
105
+ if (!this[key]) {
106
+ this[key] = [];
107
+ $(this).click(function () {
108
+ var i, method, propertyName, methods = ["jqmShow", "jqmHide"];
109
+ for (i = 0; i < methods.length; i++) {
110
+ method = methods[i];
111
+ for (propertyName in this[method]) {
112
+ if (this[method].hasOwnProperty(propertyName) && jqmHash[this[method][propertyName]]) {
113
+ jqmHash[this[method][propertyName]].w[method](this);
114
+ }
115
+ }
116
+ }
117
+ return false;
118
+ });
119
+ }
120
+ this[key].push(jqm);
121
+ });
122
+ });
123
+ };
124
+
125
+ $.fn.jqm = function (o) {
126
+ var p = {
127
+ overlay: 50,
128
+ closeoverlay: false,
129
+ overlayClass: "jqmOverlay",
130
+ closeClass: "jqmClose",
131
+ trigger: ".jqModal",
132
+ ajax: false,
133
+ ajaxText: "",
134
+ target: false,
135
+ modal: false,
136
+ toTop: false,
137
+ onShow: false,
138
+ onHide: false,
139
+ onLoad: false
140
+ };
141
+ return this.each(function () {
142
+ if (this._jqm) {
143
+ jqmHash[this._jqm].c = $.extend({}, jqmHash[this._jqm].c, o);
144
+ return jqmHash[this._jqm].c;
145
+ }
146
+ jqmHashLength++;
147
+ this._jqm = jqmHashLength;
148
+ jqmHash[jqmHashLength] = {
149
+ // comment from https://github.com/briceburg/jqModal/blob/master/jqModal.js
150
+ // hash object;
151
+ // w: (jQuery object) The modal element
152
+ // c: (object) The modal's options object
153
+ // o: (jQuery object) The overlay element
154
+ // t: (DOM object) The triggering element
155
+ c: $.extend(p, $.jqm.params, o),
156
+ a: false,
157
+ w: $(this).addClass("jqmID" + jqmHashLength),
158
+ s: jqmHashLength // used as id too
159
+ };
160
+ if (p.trigger) {
161
+ $(this).jqmAddTrigger(p.trigger);
162
+ }
163
+ });
164
+ };
165
+
166
+ $.fn.jqmAddClose = function (trigger) {
167
+ return registerHideOrShow(this, trigger, "jqmHide");
168
+ };
169
+ $.fn.jqmAddTrigger = function (trigger) {
170
+ return registerHideOrShow(this, trigger, "jqmShow");
171
+ };
172
+ $.fn.jqmShow = function (trigger) {
173
+ return this.each(function () {
174
+ $.jqm.open(this._jqm, trigger);
175
+ });
176
+ };
177
+ $.fn.jqmHide = function (trigger) {
178
+ return this.each(function () {
179
+ $.jqm.close(this._jqm, trigger);
180
+ });
181
+ };
182
+
183
+ $.jqm = {
184
+ hash: {},
185
+ open: function (s, trigger) {
186
+ var h = jqmHash[s], $overlay, target, url,
187
+ options = h.c, parentOffset = h.w.parent().offset(), left, top,
188
+ cc = "." + options.closeClass,
189
+ z = (parseInt(h.w.css("z-index"), 10));
190
+ z = (z > 0) ? z : 3000;
191
+ $overlay = $("<div></div>").css({
192
+ height: "100%",
193
+ width: "100%",
194
+ position: "fixed",
195
+ left: 0,
196
+ top: 0,
197
+ "z-index": z - 1,
198
+ opacity: options.overlay / 100
199
+ });
200
+ if (h.a) {
201
+ return false;
202
+ }
203
+ h.t = trigger;
204
+ h.a = true;
205
+ h.w.css("z-index", z);
206
+ if ($(h.w[0].ownerDocument).data("ui-dialog-overlays")) {
207
+ h.w.addClass("ui-dialog"); // hack to allow input inside of jQuery UI modal
208
+ }
209
+ if (options.modal) {
210
+ if (!createdModals[0]) {
211
+ setTimeout(function () {
212
+ bindOrUnbindEvents("bind");
213
+ }, 1);
214
+ }
215
+ createdModals.push(s);
216
+ } else if (options.overlay > 0) {
217
+ if (options.closeoverlay) {
218
+ h.w.jqmAddClose($overlay);
219
+ }
220
+ } else {
221
+ $overlay = false;
222
+ }
223
+
224
+ h.o = $overlay ? $overlay.addClass(options.overlayClass).prependTo("body") : false;
225
+
226
+ if (options.ajax) {
227
+ target = options.target || h.w;
228
+ url = options.ajax;
229
+ target = (typeof target === "string") ? $(target, h.w) : $(target);
230
+ url = (url.substr(0, 1) === "@") ? $(trigger).attr(url.substring(1)) : url;
231
+ target.html(options.ajaxText)
232
+ .load(url, function () {
233
+ if (options.onLoad) {
234
+ options.onLoad.call(this, h);
235
+ }
236
+ if (cc) {
237
+ h.w.jqmAddClose($(cc, h.w));
238
+ }
239
+ setFocus(h);
240
+ });
241
+ } else if (cc) {
242
+ h.w.jqmAddClose($(cc, h.w));
243
+ }
244
+
245
+ if (options.toTop && h.o) {
246
+ parentOffset = h.w.parent().offset();
247
+ left = parseFloat(h.w.css("left") || 0);
248
+ top = parseFloat(h.w.css("top") || 0);
249
+ h.w.before('<span id="jqmP' + h.w[0]._jqm + '"></span>')
250
+ .insertAfter(h.o);
251
+ h.w.css({ top: parentOffset.top + top, left: parentOffset.left + left });
252
+ }
253
+ if (options.onShow) {
254
+ options.onShow(h);
255
+ } else {
256
+ h.w.show();
257
+ }
258
+ setFocus(h);
259
+ return false;
260
+ },
261
+ close: function (s) {
262
+ var h = jqmHash[s];
263
+ if (!h.a) {
264
+ return false;
265
+ }
266
+ h.a = false;
267
+ if (createdModals[0]) {
268
+ createdModals.pop();
269
+ if (!createdModals[0]) {
270
+ bindOrUnbindEvents("unbind");
271
+ }
272
+ }
273
+ if (h.c.toTop && h.o) {
274
+ $("#jqmP" + h.w[0]._jqm)
275
+ .after(h.w)
276
+ .remove();
277
+ }
278
+ if (h.c.onHide) {
279
+ h.c.onHide(h);
280
+ } else {
281
+ h.w.hide();
282
+ if (h.o) {
283
+ h.o.remove();
284
+ }
285
+ }
286
+ return false;
287
+ },
288
+ params: {}
289
+ };
290
+ jqmHash = $.jqm.hash;
291
+ // end module jqmodal
292
+ }));