jsuites 6.5.1 → 6.5.2

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 (2) hide show
  1. package/dist/jsuites.js +19 -17
  2. package/package.json +5 -5
package/dist/jsuites.js CHANGED
@@ -6094,6 +6094,18 @@ if (! Modal && "function" === 'function') {
6094
6094
  return s;
6095
6095
  }
6096
6096
 
6097
+ // Any scroll outside the menu closes it (matches the OS context menu:
6098
+ // the menu refers to the spot that was right-clicked, and scrolling
6099
+ // moves that content away). Capture phase: scroll does not bubble.
6100
+ // Scrolling INSIDE a long menu list keeps it open. Listening only
6101
+ // while the menu is open: a window listener kept for good would also
6102
+ // keep the menu, and what holds it, alive after it is gone
6103
+ const scroll = function(e) {
6104
+ if (! self.isClosed() && ! (e.target instanceof Node && self.el.contains(e.target))) {
6105
+ self.close(0);
6106
+ }
6107
+ }
6108
+
6097
6109
  self.isClosed = function() {
6098
6110
  return self.modals[0].modal.closed === true;
6099
6111
  }
@@ -6171,6 +6183,7 @@ if (! Modal && "function" === 'function') {
6171
6183
  }
6172
6184
  });
6173
6185
  }
6186
+ window.addEventListener("scroll", scroll, true);
6174
6187
  // Focus
6175
6188
  self.el.classList.add('lm-menu-focus');
6176
6189
  // Focus on the contextmenu. preventScroll stops the browser from
@@ -6195,6 +6208,7 @@ if (! Modal && "function" === 'function') {
6195
6208
 
6196
6209
  // Close event
6197
6210
  if (level === 0) {
6211
+ window.removeEventListener("scroll", scroll, true);
6198
6212
  self.el.classList.remove('lm-menu-focus');
6199
6213
 
6200
6214
  Dispatch.call(self, self.onclose, 'close', {
@@ -6214,16 +6228,6 @@ if (! Modal && "function" === 'function') {
6214
6228
  }
6215
6229
  });
6216
6230
 
6217
- // Any scroll outside the menu closes it (matches the OS context menu:
6218
- // the menu refers to the spot that was right-clicked, and scrolling
6219
- // moves that content away). Capture phase: scroll does not bubble.
6220
- // Scrolling INSIDE a long menu list keeps it open
6221
- window.addEventListener("scroll", function(e) {
6222
- if (! self.isClosed() && ! (e.target instanceof Node && self.el.contains(e.target))) {
6223
- self.close(0);
6224
- }
6225
- }, true);
6226
-
6227
6231
  // Keyboard event
6228
6232
  self.el.addEventListener("keydown", function(e) {
6229
6233
  // Menu object
@@ -7627,8 +7631,6 @@ if (!lemonade && "function" === 'function') {
7627
7631
  }
7628
7632
  }
7629
7633
 
7630
- // References
7631
- const modals = [];
7632
7634
  // State of the resize and move modal
7633
7635
  let state = {};
7634
7636
  // Internal controls of the action of resize and move
@@ -7646,8 +7648,11 @@ if (!lemonade && "function" === 'function') {
7646
7648
  */
7647
7649
  const sendToFront = function (container) {
7648
7650
  let highestXIndex = defaultZIndex;
7651
+ // The modals on the page. A registry of the instances would keep
7652
+ // every modal ever created alive, the ones of destroyed components too
7653
+ const modals = document.querySelectorAll('.lm-modal');
7649
7654
  for (let i = 0; i < modals.length; i++) {
7650
- const zIndex = parseInt(modals[i].el.style.zIndex);
7655
+ const zIndex = parseInt(modals[i].style.zIndex);
7651
7656
  if (zIndex > highestXIndex) {
7652
7657
  highestXIndex = zIndex;
7653
7658
  }
@@ -8032,9 +8037,6 @@ if (!lemonade && "function" === 'function') {
8032
8037
  // Make sure keep the state as boolean
8033
8038
  self.closed = !!self.closed;
8034
8039
 
8035
- // Keep all modals references
8036
- modals.push(self);
8037
-
8038
8040
  // External onload remove from the lifecycle
8039
8041
  let change = self.onchange;
8040
8042
  self.onchange = null;
@@ -23549,7 +23551,7 @@ var jSuites = {
23549
23551
  ...dictionary,
23550
23552
  ...helpers,
23551
23553
  /** Current version */
23552
- version: '6.5.1',
23554
+ version: '6.5.2',
23553
23555
  /** Bind new extensions to Jsuites */
23554
23556
  setExtensions: function(o) {
23555
23557
  if (typeof(o) == 'object') {
package/package.json CHANGED
@@ -26,22 +26,22 @@
26
26
  },
27
27
  "main": "dist/jsuites.js",
28
28
  "types": "dist/jsuites.d.ts",
29
- "version": "6.5.1",
29
+ "version": "6.5.2",
30
30
  "bugs": "https://github.com/jsuites/jsuites/issues",
31
31
  "homepage": "https://github.com/jsuites/jsuites",
32
32
  "docs": "https://jsuites.net",
33
33
  "download": "https://github.com/jsuites/jsuites/archive/master.zip",
34
34
  "dependencies": {
35
- "@jsuites/utils": "^6.1.0",
35
+ "@jsuites/utils": "^6.1.1",
36
36
  "@lemonadejs/calendar": "^5.9.3",
37
37
  "@lemonadejs/color": "^5.8.0",
38
- "@lemonadejs/contextmenu": "^5.8.4",
39
- "@lemonadejs/dropdown": "^5.8.3",
38
+ "@lemonadejs/contextmenu": "^5.8.6",
39
+ "@lemonadejs/dropdown": "^5.8.4",
40
40
  "@lemonadejs/modal": "^5.8.3",
41
41
  "@lemonadejs/rating": "^5.8.1",
42
42
  "@lemonadejs/switch": "^5.8.0",
43
43
  "@lemonadejs/tabs": "^5.8.0",
44
- "@lemonadejs/topmenu": "^5.8.0"
44
+ "@lemonadejs/topmenu": "^5.8.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@babel/preset-env": "^7.28.5",