fit-ui 3.2.5 → 3.2.7

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/Fit.UI.js CHANGED
@@ -682,7 +682,7 @@ Fit._internal =
682
682
  {
683
683
  Core:
684
684
  {
685
- VersionInfo: { Major: 3, Minor: 2, Patch: 5 } // Do NOT modify format - version numbers are programmatically changed when releasing new versions - MUST be on a separate line!
685
+ VersionInfo: { Major: 3, Minor: 2, Patch: 7 } // Do NOT modify format - version numbers are programmatically changed when releasing new versions - MUST be on a separate line!
686
686
  }
687
687
  };
688
688
 
@@ -17956,8 +17956,7 @@ Fit.Controls.DropDown = function(ctlId)
17956
17956
  return; // Do not close DropDown if target no longer exists - this may happen if something is removed within DropDown (e.g. an item in the WSDropDown's action menu)
17957
17957
  }
17958
17958
 
17959
- // Notice that dropdownMenu might be rooted in <body> if it is constrained by CSS properties preventing reliable use of position:fixed - see optimizeDropDownPosition(..) for details
17960
- if (me.IsDropDownOpen() === true && target !== me.GetDomElement() && Fit.Dom.Contained(me.GetDomElement(), target) === false && target !== dropDownMenu && Fit.Dom.Contained(dropDownMenu, target) === false)
17959
+ if (me.IsDropDownOpen() === true && target !== me.GetDomElement() && Fit.Dom.Contained(me.GetDomElement(), target) === false)
17961
17960
  {
17962
17961
  me.CloseDropDown();
17963
17962
  }
@@ -17982,8 +17981,7 @@ Fit.Controls.DropDown = function(ctlId)
17982
17981
  return; // Do not close DropDown if target no longer exists - this may happen if something is removed within DropDown (e.g. an item in the WSDropDown's action menu)
17983
17982
  }
17984
17983
 
17985
- // Notice that dropdownMenu might be rooted in <body> if it is constrained by CSS properties preventing reliable use of position:fixed - see optimizeDropDownPosition(..) for details
17986
- if (me.IsDropDownOpen() === true && target !== me.GetDomElement() && Fit.Dom.Contained(me.GetDomElement(), target) === false && target !== dropDownMenu && Fit.Dom.Contained(dropDownMenu, target) === false)
17984
+ if (me.IsDropDownOpen() === true && target !== me.GetDomElement() && Fit.Dom.Contained(me.GetDomElement(), target) === false)
17987
17985
  {
17988
17986
  coords = Fit.Events.GetPointerState().Coordinates.Document;
17989
17987
  }
@@ -18371,10 +18369,6 @@ Fit.Controls.DropDown = function(ctlId)
18371
18369
  {
18372
18370
  // This will destroy control - it will no longer work!
18373
18371
 
18374
- // Make sure globally mounted dropdown menu is returned to control's container in case
18375
- // control is disposed while open - otherwise it will not be removed from the document.
18376
- resetDropDownPosition();
18377
-
18378
18372
  if (picker !== null)
18379
18373
  picker.Destroy();
18380
18374
 
@@ -20251,11 +20245,29 @@ Fit.Controls.DropDown = function(ctlId)
20251
20245
  // Allow DropDown to reposition when items are added/remove which might affect height of control
20252
20246
  resetDropDownPosition();
20253
20247
 
20248
+ // Allow external code to do custom positioning. This is not public API
20249
+ // and the behaviour might change at any time - use functionality with caution!
20250
+ if (typeof(me._customDropDownPositioning) === "function")
20251
+ {
20252
+ me._customDropDownPositioning(me, dropDownMenu, getDropDownMaxWidthPixelValue());
20253
+ return;
20254
+ }
20255
+
20254
20256
  var spaceRequiredBelowControl = 100; // Opens upwards if this amount of pixels is not available below control, and more space is available above control
20255
20257
  var spaceRequiredRightSide = getDropDownMaxWidthPixelValue(); // DropDownMaxWidth as px value - DropDown menu opens to the side that best accommodates the needed space - opening to the right is preferred
20256
20258
  var spacingToEdge = 10; // Makes sure that DropDown menu has this amount of spacing (in pixels) to the edge of the viewport or scroll parent
20257
20259
 
20258
- if (detectBoundariesRelToViewPort === false) // Detecting collisions against scroll parent
20260
+ // Some styles, e.g. transform:translate(..), will make position:fixed become relative
20261
+ // to the element with transform, rather than the viewport. Issue a warning in this case
20262
+ // and revert to positioning dropdown menu relative to its scroll container instead.
20263
+ var positionFixedConstrained = false;
20264
+ if (detectBoundariesRelToViewPort === true && Fit.Dom.PositionFixedConstrained(dropDownMenu) === true)
20265
+ {
20266
+ console.warn("Unable to position dropdown menu relative to viewport due to CSS constraint");
20267
+ positionFixedConstrained = true;
20268
+ }
20269
+
20270
+ if (detectBoundariesRelToViewPort === false || positionFixedConstrained === true) // Detecting collisions against scroll parent
20259
20271
  {
20260
20272
  var posFromTopWithinContainer = -1; // DropDown control's position from top within scrollable parent
20261
20273
  var posFromLeftWithinContainer = -1; // DropDown control's position from left within scrollable parent
@@ -20369,18 +20381,6 @@ Fit.Controls.DropDown = function(ctlId)
20369
20381
  // as this creates a new stacking context to which position:fixed
20370
20382
  // becomes relative.
20371
20383
 
20372
- // Move dropdown to document root if position:fixed won't work
20373
- // due to e.g. animation or transform in CSS (see note above).
20374
- if (Fit.Dom.PositionFixedConstrained(dropDownMenu) === true)
20375
- {
20376
- // Copy styles to ensure that dropdown menu assume styles identical to control itself
20377
- dropDownMenu.style.fontSize = Fit.Dom.GetComputedStyle(dropDownMenu, "font-size");
20378
- dropDownMenu.style.color = Fit.Dom.GetComputedStyle(dropDownMenu, "color");
20379
- dropDownMenu.style.fontFamily = Fit.Dom.GetComputedStyle(dropDownMenu, "font-family");
20380
-
20381
- Fit.Dom.Add(document.body, dropDownMenu); // Moved back in resetDropDownPosition() when dropdown is closed
20382
- }
20383
-
20384
20384
  var viewPortDimensions = Fit.Browser.GetViewPortDimensions(); // Returns { Width, Height } - actual space available (scrollbars are not included in these dimensions)
20385
20385
  var controlPositionY = Fit.Dom.GetBoundingPosition(itemContainer).Y; // Position from top
20386
20386
  var controlPositionX = Fit.Dom.GetBoundingPosition(itemContainer).X; // Position from left
@@ -20508,18 +20508,6 @@ Fit.Controls.DropDown = function(ctlId)
20508
20508
 
20509
20509
  function resetDropDownPosition()
20510
20510
  {
20511
- // Move dropdown menu back if it was moved to document
20512
- // root due to position:fixed being constrained by CSS
20513
- // animation, transform or similar. See optimizeDropDownPosition(..)
20514
- if (dropDownMenu.parentElement === document.body)
20515
- {
20516
- dropDownMenu.style.fontSize = "";
20517
- dropDownMenu.style.color = "";
20518
- dropDownMenu.style.fontFamily = "";
20519
-
20520
- me._internal.AddDomElement(dropDownMenu);
20521
- }
20522
-
20523
20511
  // Reset changes made by optimizeDropDownPosition()
20524
20512
  dropDownMenu.style.position = "";
20525
20513
  dropDownMenu.style.width = (maxWidth.Value > -1 ? dropDownMenu.style.width : ""); // Preserve width if DropDownMaxWidth is enabled since it also modifies this property