Files
SBPanel-Backend/frontend/admin/node_modules/element-plus/es/utils/dom/position.mjs.map
CN-JS-HuiBai db7f1ba82f
Some checks failed
build / build (api, amd64, linux) (push) Failing after -51s
build / build (api, arm64, linux) (push) Failing after -52s
build / build (api.exe, amd64, windows) (push) Failing after -51s
使用VUE重构项目
2026-04-20 00:19:11 +08:00

1 line
2.6 KiB
Plaintext

{"version":3,"file":"position.mjs","names":[],"sources":["../../../../../packages/utils/dom/position.ts"],"sourcesContent":["import { isClient } from '../browser'\n\nexport const isInContainer = (\n el?: Element,\n container?: Element | Window\n): boolean => {\n if (!isClient || !el || !container) return false\n\n const elRect = el.getBoundingClientRect()\n\n let containerRect: Pick<DOMRect, 'top' | 'bottom' | 'left' | 'right'>\n if (container instanceof Element) {\n containerRect = container.getBoundingClientRect()\n } else {\n containerRect = {\n top: 0,\n right: window.innerWidth,\n bottom: window.innerHeight,\n left: 0,\n }\n }\n return (\n elRect.top < containerRect.bottom &&\n elRect.bottom > containerRect.top &&\n elRect.right > containerRect.left &&\n elRect.left < containerRect.right\n )\n}\n\nexport const getOffsetTop = (el: HTMLElement) => {\n let offset = 0\n let parent = el\n\n while (parent) {\n offset += parent.offsetTop\n parent = parent.offsetParent as HTMLElement\n }\n\n return offset\n}\n\nexport const getOffsetTopDistance = (\n el: HTMLElement,\n containerEl: HTMLElement\n) => {\n return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl))\n}\n\nexport const getClientXY = (event: MouseEvent | TouchEvent) => {\n let clientX: number\n let clientY: number\n if (event.type === 'touchend') {\n clientY = (event as TouchEvent).changedTouches[0].clientY\n clientX = (event as TouchEvent).changedTouches[0].clientX\n } else if (event.type.startsWith('touch')) {\n clientY = (event as TouchEvent).touches[0].clientY\n clientX = (event as TouchEvent).touches[0].clientX\n } else {\n clientY = (event as MouseEvent).clientY\n clientX = (event as MouseEvent).clientX\n }\n return {\n clientX,\n clientY,\n }\n}\n"],"mappings":";;;AAEA,MAAa,iBACX,IACA,cACY;AACZ,KAAI,CAAC,YAAY,CAAC,MAAM,CAAC,UAAW,QAAO;CAE3C,MAAM,SAAS,GAAG,uBAAuB;CAEzC,IAAI;AACJ,KAAI,qBAAqB,QACvB,iBAAgB,UAAU,uBAAuB;KAEjD,iBAAgB;EACd,KAAK;EACL,OAAO,OAAO;EACd,QAAQ,OAAO;EACf,MAAM;EACP;AAEH,QACE,OAAO,MAAM,cAAc,UAC3B,OAAO,SAAS,cAAc,OAC9B,OAAO,QAAQ,cAAc,QAC7B,OAAO,OAAO,cAAc;;AAIhC,MAAa,gBAAgB,OAAoB;CAC/C,IAAI,SAAS;CACb,IAAI,SAAS;AAEb,QAAO,QAAQ;AACb,YAAU,OAAO;AACjB,WAAS,OAAO;;AAGlB,QAAO;;AAGT,MAAa,wBACX,IACA,gBACG;AACH,QAAO,KAAK,IAAI,aAAa,GAAG,GAAG,aAAa,YAAY,CAAC;;AAG/D,MAAa,eAAe,UAAmC;CAC7D,IAAI;CACJ,IAAI;AACJ,KAAI,MAAM,SAAS,YAAY;AAC7B,YAAW,MAAqB,eAAe,GAAG;AAClD,YAAW,MAAqB,eAAe,GAAG;YACzC,MAAM,KAAK,WAAW,QAAQ,EAAE;AACzC,YAAW,MAAqB,QAAQ,GAAG;AAC3C,YAAW,MAAqB,QAAQ,GAAG;QACtC;AACL,YAAW,MAAqB;AAChC,YAAW,MAAqB;;AAElC,QAAO;EACL;EACA;EACD"}