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,109 @@
1
+ /**
2
+ * GPL licenses
3
+ * Author: veto@myridia.com
4
+ *
5
+ *
6
+ * Usage example:
7
+ * ,onClickButton: function(err,res)
8
+ * {
9
+ * jQuery(this).jqGrid("jqgrid_download",'csv');
10
+ * }
11
+ *
12
+ */
13
+
14
+ /*global jQuery, define, module, require */
15
+ (function (global, factory) {
16
+ "use strict";
17
+ if (typeof define === "function" && define.amd) {
18
+ // AMD. Register as an anonymous module.
19
+ define([
20
+ "jquery",
21
+ "./jquery.contextmenu-ui",
22
+ "free-jqgrid/grid.base"
23
+ ], function ($) {
24
+ return factory($, global, global.document);
25
+ });
26
+ } else if (typeof module === "object" && module.exports) {
27
+ // Node/CommonJS
28
+ module.exports = function (root, $) {
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 || window);
37
+ }
38
+ require("./jquery.contextmenu-ui");
39
+ require("free-jqgrid/grid.base");
40
+ factory($, root, root.document);
41
+ return $;
42
+ };
43
+ } else {
44
+ // Browser globals
45
+ factory(jQuery, global, global.document);
46
+ }
47
+ }(typeof window !== "undefined" ? window : this, function ($, window, document){
48
+ "use strict";
49
+ $.jgrid.extend({
50
+ jqgrid_download: function (format = 'csv', separator = ',', endline = '\n' )
51
+ {
52
+ format = format.toLowerCase();
53
+ switch(format)
54
+ {
55
+ case 'csv':
56
+ this._csv(separator, endline);
57
+ break;
58
+ default:
59
+ alert('Format ' + format + ' is not yet supported \n Please use: csv');
60
+ }
61
+ },
62
+ _csv: function(separator, endline)
63
+ {
64
+ let data = jQuery(this).jqGrid("getGridParam", "lastSelectedData");
65
+ let col = jQuery(this).jqGrid("getGridParam", "colModel");
66
+ let rows = [];
67
+ let header = [];
68
+
69
+ for(let c in col)
70
+ {
71
+ header.push(col[c]['name']);
72
+ }
73
+ rows.push(header);
74
+ for(let d in data)
75
+ {
76
+ let row = [];
77
+ for(let c in col)
78
+ {
79
+ let name = col[c]['name'];
80
+ let col_val = data[d][name];
81
+ if(typeof col_val === 'string')
82
+ {
83
+ if(col_val.indexOf(',') > -1)
84
+ {
85
+ col_val = '"' + col_val + '"';
86
+ }
87
+ row.push(col_val);
88
+ }
89
+ else
90
+ {
91
+ row.push(col_val);
92
+ }
93
+ }
94
+ rows.push(row);
95
+ }
96
+
97
+ let csv = rows.map(e => e.join(separator)).join(endline);
98
+ let blob = new Blob([csv],{type: 'text/csv;charset=utf-8;'});
99
+ let uri = URL.createObjectURL(blob);
100
+ let link = document.createElement("a");
101
+ link.download = jQuery(this).jqGrid("getGridParam", "caption") + '.csv';
102
+ link.href = uri;
103
+ document.body.appendChild(link);
104
+ link.click();
105
+ document.body.removeChild(link);
106
+ }
107
+
108
+ });
109
+ }));
@@ -0,0 +1,304 @@
1
+ /**
2
+ * @license ContextMenu - jQuery plugin for right-click context menus
3
+ *
4
+ * Author: Chris Domigan
5
+ * Contributors: Dan G. Switzer, II
6
+ * Parts of this plugin are inspired by Joern Zaefferer's Tooltip plugin
7
+ *
8
+ * Dual licensed under the MIT and GPL licenses:
9
+ * http://www.opensource.org/licenses/mit-license.php
10
+ * http://www.gnu.org/licenses/gpl.html
11
+ *
12
+ * Version: r2
13
+ * Date: 16 July 2007
14
+ *
15
+ * For documentation visit http://www.trendskitchens.co.nz/jquery/contextmenu/
16
+ *
17
+ * Updated: include support jQuery UI CSS classes existing starting with version 1.8
18
+ * and the currents modified CSS classes of version jQuery UI 1.9
19
+ * by Oleg Kiriljuk, oleg.kiriljuk@ok-soft.gmbh.com
20
+ * Date: 24 December 2011
21
+ *
22
+ * Updated by Oleg Kiriljuk to support jQuery UI 1.10 and 1.11
23
+ * Date: 17 March 2015
24
+ */
25
+
26
+ /*global jQuery, define, module, require */
27
+ /*jslint devel: true, browser: true, plusplus: true, eqeq: true */
28
+ (function (global, factory) {
29
+ "use strict";
30
+ if (typeof define === "function" && define.amd) {
31
+ // AMD. Register as an anonymous module.
32
+ define(["jquery"], function ($) {
33
+ return factory($, global.document);
34
+ });
35
+ } else if (typeof module === "object" && module.exports) {
36
+ // Node/CommonJS
37
+ module.exports = function (root, $) {
38
+ if ($ === undefined) {
39
+ // require("jquery") returns a factory that requires window to
40
+ // build a jQuery instance, we normalize how we use modules
41
+ // that require this pattern but the window provided is a noop
42
+ // if it's defined (how jquery works)
43
+ $ = typeof window !== "undefined" ?
44
+ require("jquery") :
45
+ require("jquery")(root || window);
46
+ }
47
+ factory($, root.document);
48
+ return $;
49
+ };
50
+ } else {
51
+ // Browser globals
52
+ factory(jQuery, global.document);
53
+ }
54
+ }(typeof window !== "undefined" ? window : this, function ($, document) {
55
+ "use strict";
56
+ var menu, shadow, content, hash, currentTarget,
57
+ versionParts = $.ui != null && typeof $.ui.version === "string" ? /^([0-9]+)\.([0-9]+)\.([0-9]+)$/.exec($.ui.version) : [],
58
+ isAncorRequired = versionParts != null && versionParts.length === 4 && versionParts[1] === "1" && versionParts[2] < 11,
59
+ defaults = {
60
+ menuClasses: "ui-menu ui-widget ui-widget-content ui-corner-all",
61
+ menuIconClasses: "ui-menu-icons ui-menu ui-widget ui-widget-content ui-corner-all",
62
+ menuDivStyle: {
63
+ position: "absolute",
64
+ zIndex: "500"
65
+ },
66
+ menuStyle: {
67
+ width: "100%"
68
+ },
69
+ itemClasses: "ui-menu-item",
70
+ itemStyle: {},
71
+ itemHoverStyle: {},
72
+ itemAnchorClasses: "ui-corner-all",
73
+ itemAnchorStyle: {
74
+ position: "relative",
75
+ paddingRight: "0"
76
+ },
77
+ itemIconAnchorStyle: {
78
+ paddingLeft: "2em"
79
+ },
80
+ itemIconSpanStyle: {
81
+ left: ".2em",
82
+ top: ".3em",
83
+ marginRight: ".5em",
84
+ position: "absolute",
85
+ "float": "left"
86
+ },
87
+ itemHoverAnchorClasses: "ui-state-hover",
88
+ eventPosX: "pageX",
89
+ eventPosY: "pageY",
90
+ shadow: true,
91
+ menuShadowClasses: "ui-widget-shadow",
92
+ menuShadowStyle: {
93
+ position: "absolute",
94
+ zIndex: "499",
95
+ margin: "0",
96
+ padding: "1px 0 0 6px"
97
+ },
98
+ onContextMenu: null,
99
+ onShowMenu: null
100
+ };
101
+
102
+ $.fn.contextMenu = function (id, options) {
103
+ hash = hash || [];
104
+ hash.push({
105
+ id: id,
106
+ menuDivStyle: $.extend({}, defaults.menuDivStyle, options.menuDivStyle || {}),
107
+ menuStyle: $.extend({}, defaults.menuStyle, options.menuStyle || {}),
108
+ menuShadowStyle: $.extend({}, defaults.menuShadowStyle, options.menuShadowStyle || {}),
109
+ itemStyle: $.extend({}, defaults.itemStyle, options.itemStyle || {}),
110
+ itemHoverStyle: $.extend({}, defaults.itemHoverStyle, options.itemHoverStyle || {}),
111
+ menuClasses: options.menuClasses || defaults.menuClasses,
112
+ menuIconClasses: options.menuIconClasses || defaults.menuIconClasses,
113
+ menuShadowClasses: options.menuShadowClasses || defaults.menuShadowClasses,
114
+ itemClasses: options.itemClasses || defaults.itemClasses,
115
+ itemAnchorClasses: options.itemAnchorClasses || defaults.itemAnchorClasses,
116
+ itemAnchorStyle: $.extend({}, defaults.itemAnchorStyle, options.itemAnchorStyle || {}),
117
+ itemIconSpanStyle: $.extend({}, defaults.itemIconSpanStyle, options.itemIconSpanStyle || {}),
118
+ itemIconAnchorStyle: $.extend({}, defaults.itemIconAnchorStyle, options.itemIconAnchorStyle || {}),
119
+ itemHoverAnchorClasses: options.itemHoverAnchorClasses || defaults.itemHoverAnchorClasses,
120
+ bindings: options.bindings || {},
121
+ shadow: options.shadow || options.shadow === false ? options.shadow : defaults.shadow,
122
+ onContextMenu: options.onContextMenu || defaults.onContextMenu,
123
+ onShowMenu: options.onShowMenu || defaults.onShowMenu,
124
+ eventPosX: options.eventPosX || defaults.eventPosX,
125
+ eventPosY: options.eventPosY || defaults.eventPosY
126
+ });
127
+
128
+ function hide() {
129
+ menu.hide().attr("aria-hidden", "true");
130
+ shadow.hide().attr("aria-hidden", "true");
131
+ }
132
+ function display(i, trigger, e) {
133
+ var cur = hash[i], items;
134
+ content = $("#" + cur.id).find("ul:first").clone(true);
135
+
136
+ // Send the content to the menu
137
+ menu.html(content);
138
+
139
+ // if there's an onShowMenu, run it now -- must run after content has been added
140
+ // if you try to alter the content variable before the menu.html(), IE6 has issues
141
+ // updating the content
142
+ if (!!cur.onShowMenu) { menu = cur.onShowMenu(e, menu); }
143
+
144
+ if (cur.menuClasses) {
145
+ if (cur.menuIconClasses && content.find(".ui-icon").length > 0) {
146
+ content.addClass(cur.menuIconClasses);
147
+ } else {
148
+ content.addClass(cur.menuClasses);
149
+ }
150
+ }
151
+ if (!$.isEmptyObject(cur.menuStyle)) {
152
+ content.css(cur.menuStyle);
153
+ }
154
+ items = content.attr("role", "menu").find("li");
155
+
156
+ if (cur.itemClasses) {
157
+ items.addClass(cur.itemClasses).attr("role", isAncorRequired ? "presentation" : "menuitem");
158
+ }
159
+ if (!$.isEmptyObject(cur.itemStyle)) {
160
+ items.css(cur.itemStyle);
161
+ }
162
+
163
+ if (cur.itemAnchorClasses) {
164
+ if (isAncorRequired) {
165
+ items.children("a").addClass(cur.itemAnchorClasses).filter(":not([role])").attr("role", "menuitem");
166
+ } else {
167
+ items.addClass(cur.itemAnchorClasses);
168
+ }
169
+ }
170
+ if (!$.isEmptyObject(cur.itemAnchorStyle)) {
171
+ if (isAncorRequired) {
172
+ items.children("a").css(cur.itemAnchorStyle);
173
+ } else {
174
+ items.css(cur.itemAnchorStyle);
175
+ }
176
+ }
177
+ if (!$.isEmptyObject(cur.itemIconSpanStyle)) {
178
+ if (isAncorRequired) {
179
+ items.children("a").children("span.ui-icon").css(cur.itemIconSpanStyle).parent("a").css(cur.itemIconAnchorStyle);
180
+ } else {
181
+ items.children("span.ui-icon").css(cur.itemIconSpanStyle);
182
+ }
183
+ }
184
+
185
+ if ($.isEmptyObject(cur.itemHoverStyle)) {
186
+ items.hover(
187
+ function () {
188
+ //$(this).siblings().children(".ui-state-active").removeClass("ui-state-active");
189
+ var menuItem = isAncorRequired ? $(this).children("a") : $(this);
190
+ menuItem.addClass(cur.itemHoverAnchorClasses);
191
+
192
+ },
193
+ function () {
194
+ var menuItem = isAncorRequired ? $(this).children("a") : $(this);
195
+ menuItem.removeClass(cur.itemHoverAnchorClasses);
196
+ }
197
+ );
198
+ } else if (!$.isEmptyObject(cur.itemHoverStyle)) {
199
+ items.hover(
200
+ function () {
201
+ $(this).css(cur.itemHoverStyle);
202
+ },
203
+ function () {
204
+ $(this).css(cur.itemStyle);
205
+ }
206
+ );
207
+ }
208
+ items.find("img").css({ verticalAlign: "middle", paddingRight: "2px" });
209
+
210
+ $.each(cur.bindings, function (menuItemId, func) {
211
+ $("#" + menuItemId, menu).bind("click", function () {
212
+ hide();
213
+ func(trigger, currentTarget);
214
+ });
215
+ });
216
+
217
+ menu.css({
218
+ left: e[cur.eventPosX],
219
+ top: e[cur.eventPosY],
220
+ "white-space": "pre"
221
+ }).show().removeAttr("aria-hidden");
222
+ if (cur.shadow) {
223
+ shadow.css({
224
+ width: menu.width(),
225
+ height: menu.height(),
226
+ left: e.pageX + 2,
227
+ top: e.pageY + 2
228
+ }).show().removeAttr("aria-hidden");
229
+ }
230
+ var of = menu.offset(), topDelta = 0;
231
+ if (of.top + menu.height() > $(window).scrollTop() + window.innerHeight) {
232
+ topDelta = $(window).scrollTop() - of.top - menu.height() + window.innerHeight;
233
+ of.top += topDelta;
234
+ menu.offset(of);
235
+ of = shadow.offset();
236
+ of.top += topDelta;
237
+ shadow.offset(of);
238
+ }
239
+ /*of = menu.offset(), topDelta = 0;
240
+ if (of.left + menu.width() > $(window).scrollLeft() + window.innerWidth) {
241
+ topDelta = $(window).scrollLeft() - of.top - menu.width() + window.innerWidth;
242
+ of.left += topDelta;
243
+ menu.offset(of);
244
+ of = shadow.offset();
245
+ of.left += topDelta;
246
+ shadow.offset(of);
247
+ }*/
248
+ $(document).one("click", hide);
249
+ }
250
+
251
+ var index = hash.length - 1;
252
+ if (!menu) { // Create singleton menu
253
+ menu = $("<div class=\"jqContextMenu\"></div>")
254
+ .hide()
255
+ .attr("aria-hidden", "true")
256
+ .css(hash[index].menuDivStyle)
257
+ .appendTo("body")
258
+ .bind("click", function (e) {
259
+ e.stopPropagation();
260
+ }).mouseleave(function (e) {
261
+ if (e.pageX === -1 && e.pageY === -1) {
262
+ return; // over tooltip
263
+ }
264
+ hide();
265
+ });
266
+ }
267
+ if (!shadow) {
268
+ shadow = $("<div></div>")
269
+ .addClass(hash[index].menuShadowClasses)
270
+ .css(hash[index].menuShadowStyle)
271
+ .appendTo("body")
272
+ .hide().attr("aria-hidden", "true");
273
+ }
274
+ $(this).bind("contextmenu", function (e) {
275
+ // Check if onContextMenu() defined
276
+ var bShowContext = (!!hash[index].onContextMenu) ? hash[index].onContextMenu(e) : true;
277
+ currentTarget = e.target;
278
+ if (bShowContext) {
279
+ display(index, this, e, options);
280
+ return false;
281
+ }
282
+ hide();
283
+ return true;
284
+ });
285
+ return this;
286
+ };
287
+
288
+ // Apply defaults
289
+ $.contextMenu = {
290
+ defaults: function (userDefaults) {
291
+ $.each(userDefaults, function (i, val) {
292
+ if (typeof val === "object" && defaults[i]) {
293
+ $.extend(defaults[i], val);
294
+ } else {
295
+ defaults[i] = val;
296
+ }
297
+ });
298
+ }
299
+ };
300
+
301
+ $(function () {
302
+ $("div.contextMenu").hide().attr("aria-hidden", "true");
303
+ });
304
+ }));
@@ -0,0 +1,174 @@
1
+ /**
2
+ * @license ContextMenu - jQuery plugin for right-click context menus
3
+ *
4
+ * Author: Chris Domigan
5
+ * Contributors: Dan G. Switzer, II
6
+ * Parts of this plugin are inspired by Joern Zaefferer's Tooltip plugin
7
+ *
8
+ * Dual licensed under the MIT and GPL licenses:
9
+ * http://www.opensource.org/licenses/mit-license.php
10
+ * http://www.gnu.org/licenses/gpl.html
11
+ *
12
+ * Version: r2
13
+ * Date: 16 July 2007
14
+ *
15
+ * For documentation visit http://www.trendskitchens.co.nz/jquery/contextmenu/
16
+ *
17
+ */
18
+
19
+ /*global jQuery, define, module, require */
20
+ (function (global, factory) {
21
+ "use strict";
22
+ if (typeof define === "function" && define.amd) {
23
+ // AMD. Register as an anonymous module.
24
+ define(["jquery"], function ($) {
25
+ return factory($, global.document);
26
+ });
27
+ } else if (typeof module === "object" && module.exports) {
28
+ // Node/CommonJS
29
+ module.exports = function (root, $) {
30
+ if ($ === undefined) {
31
+ // require("jquery") returns a factory that requires window to
32
+ // build a jQuery instance, we normalize how we use modules
33
+ // that require this pattern but the window provided is a noop
34
+ // if it's defined (how jquery works)
35
+ $ = typeof window !== "undefined" ?
36
+ require("jquery") :
37
+ require("jquery")(root || window);
38
+ }
39
+ factory($, root.document);
40
+ return $;
41
+ };
42
+ } else {
43
+ // Browser globals
44
+ factory(jQuery, global.document);
45
+ }
46
+ }(typeof window !== "undefined" ? window : this, function($, document) {
47
+
48
+ var menu, shadow, content, hash, currentTarget;
49
+ var defaults = {
50
+ menuStyle: {
51
+ listStyle: 'none',
52
+ padding: '1px',
53
+ margin: '0px',
54
+ backgroundColor: '#fff',
55
+ border: '1px solid #999',
56
+ width: '100px'
57
+ },
58
+ itemStyle: {
59
+ margin: '0px',
60
+ color: '#000',
61
+ display: 'block',
62
+ cursor: 'default',
63
+ padding: '3px',
64
+ border: '1px solid #fff',
65
+ backgroundColor: 'transparent'
66
+ },
67
+ itemHoverStyle: {
68
+ border: '1px solid #0a246a',
69
+ backgroundColor: '#b6bdd2'
70
+ },
71
+ eventPosX: 'pageX',
72
+ eventPosY: 'pageY',
73
+ shadow : true,
74
+ onContextMenu: null,
75
+ onShowMenu: null
76
+ };
77
+
78
+ $.fn.contextMenu = function(id, options) {
79
+ if (!menu) { // Create singleton menu
80
+ menu = $('<div id="jqContextMenu"></div>')
81
+ .hide()
82
+ .css({position:'absolute', zIndex:'500'})
83
+ .appendTo('body')
84
+ .bind('click', function(e) {
85
+ e.stopPropagation();
86
+ });
87
+ }
88
+ if (!shadow) {
89
+ shadow = $('<div></div>')
90
+ .css({backgroundColor:'#000',position:'absolute',opacity:0.2,zIndex:499})
91
+ .appendTo('body')
92
+ .hide();
93
+ }
94
+ hash = hash || [];
95
+ hash.push({
96
+ id : id,
97
+ menuStyle: $.extend({}, defaults.menuStyle, options.menuStyle || {}),
98
+ itemStyle: $.extend({}, defaults.itemStyle, options.itemStyle || {}),
99
+ itemHoverStyle: $.extend({}, defaults.itemHoverStyle, options.itemHoverStyle || {}),
100
+ bindings: options.bindings || {},
101
+ shadow: options.shadow || options.shadow === false ? options.shadow : defaults.shadow,
102
+ onContextMenu: options.onContextMenu || defaults.onContextMenu,
103
+ onShowMenu: options.onShowMenu || defaults.onShowMenu,
104
+ eventPosX: options.eventPosX || defaults.eventPosX,
105
+ eventPosY: options.eventPosY || defaults.eventPosY
106
+ });
107
+
108
+ var index = hash.length - 1;
109
+ $(this).bind('contextmenu', function(e) {
110
+ // Check if onContextMenu() defined
111
+ var bShowContext = (!!hash[index].onContextMenu) ? hash[index].onContextMenu(e) : true;
112
+ currentTarget = e.target;
113
+ if (bShowContext) {
114
+ display(index, this, e );
115
+ return false;
116
+ }
117
+ });
118
+ return this;
119
+ };
120
+
121
+ function display(index, trigger, e ) {
122
+ var cur = hash[index];
123
+ content = $('#'+cur.id).find('ul:first').clone(true);
124
+ content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover(
125
+ function() {
126
+ $(this).css(cur.itemHoverStyle);
127
+ },
128
+ function(){
129
+ $(this).css(cur.itemStyle);
130
+ }
131
+ ).find('img').css({verticalAlign:'middle',paddingRight:'2px'});
132
+
133
+ // Send the content to the menu
134
+ menu.html(content);
135
+
136
+ // if there's an onShowMenu, run it now -- must run after content has been added
137
+ // if you try to alter the content variable before the menu.html(), IE6 has issues
138
+ // updating the content
139
+ if (!!cur.onShowMenu) menu = cur.onShowMenu(e, menu);
140
+
141
+ $.each(cur.bindings, function(id, func) {
142
+ $('#'+id, menu).bind('click', function() {
143
+ hide();
144
+ func(trigger, currentTarget);
145
+ });
146
+ });
147
+
148
+ menu.css({'left':e[cur.eventPosX],'top':e[cur.eventPosY]}).show();
149
+ if (cur.shadow) shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show();
150
+ $(document).one('click', hide);
151
+ }
152
+
153
+ function hide() {
154
+ menu.hide();
155
+ shadow.hide();
156
+ }
157
+
158
+ // Apply defaults
159
+ $.contextMenu = {
160
+ defaults : function(userDefaults) {
161
+ $.each(userDefaults, function(i, val) {
162
+ if (typeof val == 'object' && defaults[i]) {
163
+ $.extend(defaults[i], val);
164
+ }
165
+ else defaults[i] = val;
166
+ });
167
+ }
168
+ };
169
+
170
+ }));
171
+
172
+ $(function() {
173
+ $('div.contextMenu').hide();
174
+ });