jsuites 6.1.3 → 6.2.1

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
@@ -4618,7 +4618,7 @@ const Mask = utils.Mask;
4618
4618
  } else {
4619
4619
  setCursor(s);
4620
4620
 
4621
- update();
4621
+ update(e);
4622
4622
  }
4623
4623
  }
4624
4624
  }
@@ -4626,7 +4626,10 @@ const Mask = utils.Mask;
4626
4626
  // Update Calendar
4627
4627
  const update = function(e) {
4628
4628
  self.setValue(getValue());
4629
- self.close({ origin: 'button' });
4629
+
4630
+ if (! (e && e.type === 'click' && e.target.tagName === 'DIV' && self.time === true)) {
4631
+ self.close({ origin: 'button' });
4632
+ }
4630
4633
  }
4631
4634
 
4632
4635
  const reset = function() {
@@ -4906,7 +4909,7 @@ const Mask = utils.Mask;
4906
4909
  }
4907
4910
  } else if (e.code === 'Enter') {
4908
4911
  if (! self.isClosed()) {
4909
- update();
4912
+ update(e);
4910
4913
  } else {
4911
4914
  self.open();
4912
4915
  }
@@ -5734,7 +5737,7 @@ if (! Modal && "function" === 'function') {
5734
5737
  // Initialize expanded state
5735
5738
  self.expanded = false;
5736
5739
 
5737
- if (self.type === 'line') {
5740
+ if (self.type === 'line' || self.type === 'divisor') {
5738
5741
  return `<hr role="separator" />`;
5739
5742
  } else if (self.type === 'inline') {
5740
5743
  return `<div></div>`;
@@ -5809,9 +5812,69 @@ if (! Modal && "function" === 'function') {
5809
5812
  let rect = parent.modal.el.getBoundingClientRect();
5810
5813
  // Update modal
5811
5814
  current.modal.open();
5812
- // Aria indication
5813
- current.modal.top = rect.y + s.el.offsetTop + 2;
5814
- current.modal.left = rect.x + 248;
5815
+
5816
+ // Calculate initial position using item's actual screen position (accounts for scroll)
5817
+ let itemRect = s.el.getBoundingClientRect();
5818
+ let submenuWidth = 250;
5819
+ let submenuTop = itemRect.y;
5820
+ let submenuLeft = rect.x + rect.width - 2; // Position to the right of parent
5821
+
5822
+ // Check if parent was positioned to the left (has negative margin or is on left side)
5823
+ let parentOpenedLeft = parent.openedLeft || false;
5824
+
5825
+ // Check horizontal space
5826
+ let spaceOnRight = window.innerWidth - (rect.x + rect.width);
5827
+ let spaceOnLeft = rect.x;
5828
+
5829
+ // Determine which side to open the submenu
5830
+ let openLeft = parentOpenedLeft; // Follow parent's direction by default
5831
+
5832
+ // If parent opened to right, check if we still have space
5833
+ if (!parentOpenedLeft && spaceOnRight < submenuWidth + 10) {
5834
+ // Not enough space on right, switch to left
5835
+ openLeft = true;
5836
+ }
5837
+ // If parent opened to left, check if we still have space on left
5838
+ if (parentOpenedLeft && spaceOnLeft < submenuWidth + 10) {
5839
+ // Not enough space on left, switch to right if possible
5840
+ if (spaceOnRight >= submenuWidth + 10) {
5841
+ openLeft = false;
5842
+ }
5843
+ }
5844
+
5845
+ if (openLeft) {
5846
+ // Position to the left of parent menu
5847
+ submenuLeft = rect.x - submenuWidth + 2;
5848
+ // Ensure it doesn't go off the left edge
5849
+ if (submenuLeft < 10) {
5850
+ submenuLeft = 10;
5851
+ }
5852
+ current.openedLeft = true;
5853
+ } else {
5854
+ current.openedLeft = false;
5855
+ }
5856
+
5857
+ // Set position
5858
+ current.modal.top = submenuTop;
5859
+ current.modal.left = submenuLeft;
5860
+
5861
+ // Adjust vertical position after render
5862
+ queueMicrotask(() => {
5863
+ let submenuEl = current.modal.el;
5864
+ let submenuRect = submenuEl.getBoundingClientRect();
5865
+
5866
+ // Check if submenu goes off the bottom
5867
+ if (submenuRect.bottom > window.innerHeight - 10) {
5868
+ let overflow = submenuRect.bottom - (window.innerHeight - 10);
5869
+ let newTop = submenuTop - overflow;
5870
+ // Don't go above the top of the screen
5871
+ if (newTop < 10) {
5872
+ newTop = 10;
5873
+ }
5874
+ current.modal.top = newTop;
5875
+ }
5876
+ });
5877
+
5815
5878
  // Keep current item for each modal
5816
5879
  current.item = s;
5817
5880
  s.expanded = true;
@@ -6072,6 +6135,7 @@ if (! Modal && "function" === 'function') {
6072
6135
  menu.item.expanded = false;
6073
6136
  menu.item = null;
6074
6137
  }
6138
+ menu.openedLeft = false;
6075
6139
  menu.modal.close();
6076
6140
  }
6077
6141
  });
@@ -12429,7 +12493,7 @@ function Path(pathString, value, remove) {
12429
12493
  if (
12430
12494
  currentObject != null &&
12431
12495
  isValidPathObj(currentObject) &&
12432
- Object.prototype.hasOwnProperty.call(currentObject, key)
12496
+ key in currentObject
12433
12497
  ) {
12434
12498
  currentObject = currentObject[key];
12435
12499
  } else {
@@ -12454,11 +12518,11 @@ function Path(pathString, value, remove) {
12454
12518
 
12455
12519
  // If the key exists but is null/undefined or a non-object, replace it with an empty object
12456
12520
  if (
12457
- Object.prototype.hasOwnProperty.call(currentObject, key) &&
12521
+ key in currentObject &&
12458
12522
  (currentObject[key] == null || ! isValidPathObj(currentObject[key]))
12459
12523
  ) {
12460
12524
  currentObject[key] = {};
12461
- } else if (!Object.prototype.hasOwnProperty.call(currentObject, key)) {
12525
+ } else if (!(key in currentObject)) {
12462
12526
  // If the key doesn't exist, create an empty object
12463
12527
  currentObject[key] = {};
12464
12528
  }
@@ -12477,7 +12541,7 @@ function Path(pathString, value, remove) {
12477
12541
 
12478
12542
  // Delete the property if remove is true
12479
12543
  if (remove === true) {
12480
- if (Object.prototype.hasOwnProperty.call(currentObject, finalKey)) {
12544
+ if (finalKey in currentObject) {
12481
12545
  delete currentObject[finalKey];
12482
12546
  return true;
12483
12547
  }
@@ -23085,7 +23149,7 @@ var jSuites = {
23085
23149
  ...dictionary,
23086
23150
  ...helpers,
23087
23151
  /** Current version */
23088
- version: '6.1.2',
23152
+ version: '6.2.1',
23089
23153
  /** Bind new extensions to Jsuites */
23090
23154
  setExtensions: function(o) {
23091
23155
  if (typeof(o) == 'object') {
package/package.json CHANGED
@@ -26,16 +26,16 @@
26
26
  },
27
27
  "main": "dist/jsuites.js",
28
28
  "types": "dist/jsuites.d.ts",
29
- "version": "6.1.3",
29
+ "version": "6.2.1",
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
35
  "@jsuites/utils": "^6.0.4",
36
- "@lemonadejs/calendar": "^5.8.3",
36
+ "@lemonadejs/calendar": "^5.8.4",
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",