Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/react-dates/src/utils/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import { OPEN_UP, ANCHOR_RIGHT } from '../constants';
/**
* Calculate and return a CSS transform style to position a detached element
* next to a reference element. The open and anchor direction indicate wether
* it should be positioned above/below and/or to the left/right of the
* reference element.
*
* Assuming r(0,0), r(1,1), d(0,0), d(1,1) for the bottom-left and top-right
* corners of the reference and detached elements, respectively:
* - openDirection = DOWN, anchorDirection = LEFT => d(0,1) == r(0,1)
* - openDirection = UP, anchorDirection = LEFT => d(0,0) == r(0,0)
* - openDirection = DOWN, anchorDirection = RIGHT => d(1,1) == r(1,1)
* - openDirection = UP, anchorDirection = RIGHT => d(1,0) == r(1,0)
*
* By using a CSS transform, we allow to further position it using
* top/bottom CSS properties for the anchor gutter.
*
* @param {string} openDirection The vertical positioning of the popup
* @param {string} anchorDirection The horizontal position of the popup
* @param {HTMLElement} referenceEl The reference element
*/
export default function getDetachedContainerStyles(openDirection, anchorDirection, referenceEl) {
const referenceRect = referenceEl.getBoundingClientRect();
let offsetX = referenceRect.left;
let offsetY = referenceRect.top;
if (openDirection === OPEN_UP) {
offsetY = -(window.innerHeight - referenceRect.bottom);
}
if (anchorDirection === ANCHOR_RIGHT) {
offsetX = -(window.innerWidth - referenceRect.right);
}
return {
transform: `translate3d(${Math.round(offsetX)}px, ${Math.round(offsetY)}px, 0)`,
};
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0048 ]-- |