jsuites 6.1.3 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/jsuites.css CHANGED
@@ -3977,7 +3977,8 @@ body.lm-dark-mode {
3977
3977
  }
3978
3978
 
3979
3979
  .lm-menu-submenu > div.lm-menu-item:hover,
3980
- .lm-menu-submenu > div.lm-menu-item[data-cursor="true"] {
3980
+ .lm-menu-submenu > div.lm-menu-item[data-cursor="true"],
3981
+ .lm-menu-submenu > div.lm-menu-item[aria-expanded="true"] {
3981
3982
  background-color: var(--lm-background-color-highlight, #ebebeb);
3982
3983
  }
3983
3984
 
@@ -4007,7 +4008,8 @@ body.lm-dark-mode {
4007
4008
  }
4008
4009
 
4009
4010
  .lm-dark-mode .lm-menu-submenu > div.lm-menu-item:hover,
4010
- .lm-dark-mode .lm-menu-submenu > div.lm-menu-item[data-cursor="true"] {
4011
+ .lm-dark-mode .lm-menu-submenu > div.lm-menu-item[data-cursor="true"],
4012
+ .lm-dark-mode .lm-menu-submenu > div.lm-menu-item[aria-expanded="true"] {
4011
4013
  background-color: var(--lm-background-color-highlight, #2d2d2d);
4012
4014
  }
4013
4015
 
package/dist/jsuites.js CHANGED
@@ -5734,7 +5734,7 @@ if (! Modal && "function" === 'function') {
5734
5734
  // Initialize expanded state
5735
5735
  self.expanded = false;
5736
5736
 
5737
- if (self.type === 'line') {
5737
+ if (self.type === 'line' || self.type === 'divisor') {
5738
5738
  return `<hr role="separator" />`;
5739
5739
  } else if (self.type === 'inline') {
5740
5740
  return `<div></div>`;
@@ -5809,9 +5809,69 @@ if (! Modal && "function" === 'function') {
5809
5809
  let rect = parent.modal.el.getBoundingClientRect();
5810
5810
  // Update modal
5811
5811
  current.modal.open();
5812
- // Aria indication
5813
- current.modal.top = rect.y + s.el.offsetTop + 2;
5814
- current.modal.left = rect.x + 248;
5812
+
5813
+ // Calculate initial position using item's actual screen position (accounts for scroll)
5814
+ let itemRect = s.el.getBoundingClientRect();
5815
+ let submenuWidth = 250;
5816
+ let submenuTop = itemRect.y;
5817
+ let submenuLeft = rect.x + rect.width - 2; // Position to the right of parent
5818
+
5819
+ // Check if parent was positioned to the left (has negative margin or is on left side)
5820
+ let parentOpenedLeft = parent.openedLeft || false;
5821
+
5822
+ // Check horizontal space
5823
+ let spaceOnRight = window.innerWidth - (rect.x + rect.width);
5824
+ let spaceOnLeft = rect.x;
5825
+
5826
+ // Determine which side to open the submenu
5827
+ let openLeft = parentOpenedLeft; // Follow parent's direction by default
5828
+
5829
+ // If parent opened to right, check if we still have space
5830
+ if (!parentOpenedLeft && spaceOnRight < submenuWidth + 10) {
5831
+ // Not enough space on right, switch to left
5832
+ openLeft = true;
5833
+ }
5834
+ // If parent opened to left, check if we still have space on left
5835
+ if (parentOpenedLeft && spaceOnLeft < submenuWidth + 10) {
5836
+ // Not enough space on left, switch to right if possible
5837
+ if (spaceOnRight >= submenuWidth + 10) {
5838
+ openLeft = false;
5839
+ }
5840
+ }
5841
+
5842
+ if (openLeft) {
5843
+ // Position to the left of parent menu
5844
+ submenuLeft = rect.x - submenuWidth + 2;
5845
+ // Ensure it doesn't go off the left edge
5846
+ if (submenuLeft < 10) {
5847
+ submenuLeft = 10;
5848
+ }
5849
+ current.openedLeft = true;
5850
+ } else {
5851
+ current.openedLeft = false;
5852
+ }
5853
+
5854
+ // Set position
5855
+ current.modal.top = submenuTop;
5856
+ current.modal.left = submenuLeft;
5857
+
5858
+ // Adjust vertical position after render
5859
+ queueMicrotask(() => {
5860
+ let submenuEl = current.modal.el;
5861
+ let submenuRect = submenuEl.getBoundingClientRect();
5862
+
5863
+ // Check if submenu goes off the bottom
5864
+ if (submenuRect.bottom > window.innerHeight - 10) {
5865
+ let overflow = submenuRect.bottom - (window.innerHeight - 10);
5866
+ let newTop = submenuTop - overflow;
5867
+ // Don't go above the top of the screen
5868
+ if (newTop < 10) {
5869
+ newTop = 10;
5870
+ }
5871
+ current.modal.top = newTop;
5872
+ }
5873
+ });
5874
+
5815
5875
  // Keep current item for each modal
5816
5876
  current.item = s;
5817
5877
  s.expanded = true;
@@ -6072,6 +6132,7 @@ if (! Modal && "function" === 'function') {
6072
6132
  menu.item.expanded = false;
6073
6133
  menu.item = null;
6074
6134
  }
6135
+ menu.openedLeft = false;
6075
6136
  menu.modal.close();
6076
6137
  }
6077
6138
  });
@@ -12429,7 +12490,7 @@ function Path(pathString, value, remove) {
12429
12490
  if (
12430
12491
  currentObject != null &&
12431
12492
  isValidPathObj(currentObject) &&
12432
- Object.prototype.hasOwnProperty.call(currentObject, key)
12493
+ key in currentObject
12433
12494
  ) {
12434
12495
  currentObject = currentObject[key];
12435
12496
  } else {
@@ -12454,11 +12515,11 @@ function Path(pathString, value, remove) {
12454
12515
 
12455
12516
  // If the key exists but is null/undefined or a non-object, replace it with an empty object
12456
12517
  if (
12457
- Object.prototype.hasOwnProperty.call(currentObject, key) &&
12518
+ key in currentObject &&
12458
12519
  (currentObject[key] == null || ! isValidPathObj(currentObject[key]))
12459
12520
  ) {
12460
12521
  currentObject[key] = {};
12461
- } else if (!Object.prototype.hasOwnProperty.call(currentObject, key)) {
12522
+ } else if (!(key in currentObject)) {
12462
12523
  // If the key doesn't exist, create an empty object
12463
12524
  currentObject[key] = {};
12464
12525
  }
@@ -12477,7 +12538,7 @@ function Path(pathString, value, remove) {
12477
12538
 
12478
12539
  // Delete the property if remove is true
12479
12540
  if (remove === true) {
12480
- if (Object.prototype.hasOwnProperty.call(currentObject, finalKey)) {
12541
+ if (finalKey in currentObject) {
12481
12542
  delete currentObject[finalKey];
12482
12543
  return true;
12483
12544
  }
@@ -23085,7 +23146,7 @@ var jSuites = {
23085
23146
  ...dictionary,
23086
23147
  ...helpers,
23087
23148
  /** Current version */
23088
- version: '6.1.2',
23149
+ version: '6.2.0',
23089
23150
  /** Bind new extensions to Jsuites */
23090
23151
  setExtensions: function(o) {
23091
23152
  if (typeof(o) == 'object') {
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "main": "dist/jsuites.js",
28
28
  "types": "dist/jsuites.d.ts",
29
- "version": "6.1.3",
29
+ "version": "6.2.0",
30
30
  "bugs": "https://github.com/jsuites/jsuites/issues",
31
31
  "homepage": "https://github.com/jsuites/jsuites",
32
32
  "docs": "https://jsuites.net",
@@ -35,7 +35,7 @@
35
35
  "@jsuites/utils": "^6.0.4",
36
36
  "@lemonadejs/calendar": "^5.8.3",
37
37
  "@lemonadejs/color": "^5.8.0",
38
- "@lemonadejs/contextmenu": "^5.8.1",
38
+ "@lemonadejs/contextmenu": "^5.8.3",
39
39
  "@lemonadejs/dropdown": "^5.8.2",
40
40
  "@lemonadejs/modal": "^5.8.2",
41
41
  "@lemonadejs/rating": "^5.8.1",