fit-ui 3.2.2 → 3.2.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.
- package/dist/Documentation.html +1 -1
- package/dist/Fit.UI.js +61 -3
- package/dist/Fit.UI.min.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +10 -0
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:
|
|
685
|
+
VersionInfo: { Major: 3, Minor: 2, Patch: 4 } // 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
|
|
|
@@ -6713,6 +6713,38 @@ Fit.Dom.GetBoundingPosition = function(elm)
|
|
|
6713
6713
|
return { X: Math.round(bcr.x || bcr.left), Y: Math.round(bcr.y || bcr.top) }; // Several legacy browsers use top/left instead of x/y
|
|
6714
6714
|
}
|
|
6715
6715
|
|
|
6716
|
+
/// <function container="Fit.Dom" name="PositionFixedConstrained" access="public" static="true" returns="boolean">
|
|
6717
|
+
/// <description>
|
|
6718
|
+
/// Determines whether position:fixed is constrained by CSS properties
|
|
6719
|
+
/// such as animation or transform which will cause positioning to become
|
|
6720
|
+
/// relative to animated/transformed parent, rather than relative to viewport.
|
|
6721
|
+
/// </description>
|
|
6722
|
+
/// <param name="elm" type="DOMElement"> Element to check for constraint </param>
|
|
6723
|
+
/// </function>
|
|
6724
|
+
Fit.Dom.PositionFixedConstrained = function(elm)
|
|
6725
|
+
{
|
|
6726
|
+
Fit.Validation.ExpectDomElement(elm);
|
|
6727
|
+
|
|
6728
|
+
if (Fit.Dom.IsRooted(elm) === false)
|
|
6729
|
+
{
|
|
6730
|
+
return true; // Report constrained as position:fixed will not work unless element is rooted
|
|
6731
|
+
}
|
|
6732
|
+
|
|
6733
|
+
var d = document.createElement("div");
|
|
6734
|
+
d.style.cssText = "position:fixed; top: -10px; left: -10px;";
|
|
6735
|
+
|
|
6736
|
+
var p = elm.parentElement;
|
|
6737
|
+
p.appendChild(d);
|
|
6738
|
+
|
|
6739
|
+
var rect = d.getBoundingClientRect();
|
|
6740
|
+
p.removeChild(d);
|
|
6741
|
+
|
|
6742
|
+
var positionedRelativeToViewport = ((rect.x || rect.left) === -10 && (rect.y || rect.top) === -10);
|
|
6743
|
+
var positionFixedConstrained = positionedRelativeToViewport === false;
|
|
6744
|
+
|
|
6745
|
+
return positionFixedConstrained;
|
|
6746
|
+
}
|
|
6747
|
+
|
|
6716
6748
|
/// <function container="Fit.Dom" name="GetPosition" access="public" static="true" returns="Fit.TypeDefs.Position | null">
|
|
6717
6749
|
/// <description>
|
|
6718
6750
|
/// Get position for visible element.
|
|
@@ -17924,7 +17956,8 @@ Fit.Controls.DropDown = function(ctlId)
|
|
|
17924
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)
|
|
17925
17957
|
}
|
|
17926
17958
|
|
|
17927
|
-
if
|
|
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)
|
|
17928
17961
|
{
|
|
17929
17962
|
me.CloseDropDown();
|
|
17930
17963
|
}
|
|
@@ -17949,7 +17982,8 @@ Fit.Controls.DropDown = function(ctlId)
|
|
|
17949
17982
|
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)
|
|
17950
17983
|
}
|
|
17951
17984
|
|
|
17952
|
-
if
|
|
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)
|
|
17953
17987
|
{
|
|
17954
17988
|
coords = Fit.Events.GetPointerState().Coordinates.Document;
|
|
17955
17989
|
}
|
|
@@ -20331,6 +20365,18 @@ Fit.Controls.DropDown = function(ctlId)
|
|
|
20331
20365
|
// as this creates a new stacking context to which position:fixed
|
|
20332
20366
|
// becomes relative.
|
|
20333
20367
|
|
|
20368
|
+
// Move dropdown to document root if position:fixed won't work
|
|
20369
|
+
// due to e.g. animation or transform in CSS (see note above).
|
|
20370
|
+
if (Fit.Dom.PositionFixedConstrained(dropDownMenu) === true)
|
|
20371
|
+
{
|
|
20372
|
+
// Copy styles to ensure that dropdown menu assume styles identical to control itself
|
|
20373
|
+
dropDownMenu.style.fontSize = Fit.Dom.GetComputedStyle(dropDownMenu, "font-size");
|
|
20374
|
+
dropDownMenu.style.color = Fit.Dom.GetComputedStyle(dropDownMenu, "color");
|
|
20375
|
+
dropDownMenu.style.fontFamily = Fit.Dom.GetComputedStyle(dropDownMenu, "font-family");
|
|
20376
|
+
|
|
20377
|
+
Fit.Dom.Add(document.body, dropDownMenu); // Moved back in resetDropDownPosition() when dropdown is closed
|
|
20378
|
+
}
|
|
20379
|
+
|
|
20334
20380
|
var viewPortDimensions = Fit.Browser.GetViewPortDimensions(); // Returns { Width, Height } - actual space available (scrollbars are not included in these dimensions)
|
|
20335
20381
|
var controlPositionY = Fit.Dom.GetBoundingPosition(itemContainer).Y; // Position from top
|
|
20336
20382
|
var controlPositionX = Fit.Dom.GetBoundingPosition(itemContainer).X; // Position from left
|
|
@@ -20458,6 +20504,18 @@ Fit.Controls.DropDown = function(ctlId)
|
|
|
20458
20504
|
|
|
20459
20505
|
function resetDropDownPosition()
|
|
20460
20506
|
{
|
|
20507
|
+
// Move dropdown menu back if it was moved to document
|
|
20508
|
+
// root due to position:fixed being constrained by CSS
|
|
20509
|
+
// animation, transform or similar. See optimizeDropDownPosition(..)
|
|
20510
|
+
if (dropDownMenu.parentElement === document.body)
|
|
20511
|
+
{
|
|
20512
|
+
dropDownMenu.style.fontSize = "";
|
|
20513
|
+
dropDownMenu.style.color = "";
|
|
20514
|
+
dropDownMenu.style.fontFamily = "";
|
|
20515
|
+
|
|
20516
|
+
me._internal.AddDomElement(dropDownMenu);
|
|
20517
|
+
}
|
|
20518
|
+
|
|
20461
20519
|
// Reset changes made by optimizeDropDownPosition()
|
|
20462
20520
|
dropDownMenu.style.position = "";
|
|
20463
20521
|
dropDownMenu.style.width = (maxWidth.Value > -1 ? dropDownMenu.style.width : ""); // Preserve width if DropDownMaxWidth is enabled since it also modifies this property
|