Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.dist.prod.util.PopupUtils.js.map Maven / Gradle / Ivy
{
"version": 3,
"sources": ["../../../src/util/PopupUtils.ts"],
"sourcesContent": ["import getActiveElement from \"./getActiveElement.js\";\n\nconst getFocusedElement = () => {\n\tconst element = getActiveElement() as HTMLElement;\n\treturn (element && typeof element.focus === \"function\") ? element : null;\n};\n\nconst isFocusedElementWithinNode = (node: HTMLElement) => {\n\tconst fe = getFocusedElement();\n\n\tif (fe) {\n\t\treturn isNodeContainedWithin(node, fe);\n\t}\n\n\treturn false;\n};\n\nconst isNodeContainedWithin = (parent: HTMLElement, child: HTMLElement): boolean => {\n\tlet currentNode: HTMLElement | undefined = parent;\n\n\tif (currentNode.shadowRoot) {\n\t\tconst children = Array.from(currentNode.shadowRoot.children) as Array;\n\t\tcurrentNode = children.find(n => n.localName !== \"style\");\n\n\t\tif (!currentNode) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tif (currentNode === child) {\n\t\treturn true;\n\t}\n\n\tconst childNodes = currentNode.localName === \"slot\" ? (currentNode as HTMLSlotElement).assignedNodes() : currentNode.children;\n\n\tif (childNodes) {\n\t\treturn Array.from(childNodes).some(n => isNodeContainedWithin(n as HTMLElement, child));\n\t}\n\n\treturn false;\n};\n\nconst isPointInRect = (x: number, y: number, rect: DOMRect) => {\n\treturn x >= rect.left && x <= rect.right\n\t\t&& y >= rect.top && y <= rect.bottom;\n};\n\nconst isClickInRect = (e: MouseEvent | TouchEvent, rect: DOMRect) => {\n\tlet x;\n\tlet y;\n\n\tif (e instanceof MouseEvent) {\n\t\tx = e.clientX;\n\t\ty = e.clientY;\n\t} else {\n\t\tconst touch = e.touches[0];\n\t\tx = touch.clientX;\n\t\ty = touch.clientY;\n\t}\n\n\treturn isPointInRect(x, y, rect);\n};\n\ninterface PopupInterface { // Refactor: replace with Popup.js\n\t_show: () => void,\n\topen: boolean,\n}\nfunction instanceOfPopup(object: any): object is PopupInterface {\n\treturn \"isUI5Element\" in object && \"_show\" in object;\n}\n\nconst getClosedPopupParent = (el: HTMLElement): HTMLElement => {\n\tconst parent = el.parentElement || (el.getRootNode && (el.getRootNode() as ShadowRoot).host);\n\n\tif (parent && ((instanceOfPopup(parent) || parent === document.documentElement))) {\n\t\treturn parent as HTMLElement;\n\t}\n\n\treturn getClosedPopupParent(parent as HTMLElement);\n};\n\nexport {\n\tgetFocusedElement,\n\tisClickInRect,\n\tgetClosedPopupParent,\n\tisFocusedElementWithinNode,\n};\n"],
"mappings": "aAAA,OAAOA,MAAsB,wBAE7B,MAAMC,EAAoB,IAAM,CAC/B,MAAMC,EAAUF,EAAiB,EACjC,OAAQE,GAAW,OAAOA,EAAQ,OAAU,WAAcA,EAAU,IACrE,EAEMC,EAA8BC,GAAsB,CACzD,MAAMC,EAAKJ,EAAkB,EAE7B,OAAII,EACIC,EAAsBF,EAAMC,CAAE,EAG/B,EACR,EAEMC,EAAwB,CAACC,EAAqBC,IAAgC,CACnF,IAAIC,EAAuCF,EAE3C,GAAIE,EAAY,aAEfA,EADiB,MAAM,KAAKA,EAAY,WAAW,QAAQ,EACpC,KAAKC,GAAKA,EAAE,YAAc,OAAO,EAEpD,CAACD,GACJ,MAAO,GAIT,GAAIA,IAAgBD,EACnB,MAAO,GAGR,MAAMG,EAAaF,EAAY,YAAc,OAAUA,EAAgC,cAAc,EAAIA,EAAY,SAErH,OAAIE,EACI,MAAM,KAAKA,CAAU,EAAE,KAAKD,GAAKJ,EAAsBI,EAAkBF,CAAK,CAAC,EAGhF,EACR,EAEMI,EAAgB,CAACC,EAAWC,EAAWC,IACrCF,GAAKE,EAAK,MAAQF,GAAKE,EAAK,OAC/BD,GAAKC,EAAK,KAAOD,GAAKC,EAAK,OAG1BC,EAAgB,CAAC,EAA4BD,IAAkB,CACpE,IAAIF,EACAC,EAEJ,GAAI,aAAa,WAChBD,EAAI,EAAE,QACNC,EAAI,EAAE,YACA,CACN,MAAMG,EAAQ,EAAE,QAAQ,CAAC,EACzBJ,EAAII,EAAM,QACVH,EAAIG,EAAM,OACX,CAEA,OAAOL,EAAcC,EAAGC,EAAGC,CAAI,CAChC,EAMA,SAASG,EAAgBC,EAAuC,CAC/D,MAAO,iBAAkBA,GAAU,UAAWA,CAC/C,CAEA,MAAMC,EAAwBC,GAAiC,CAC9D,MAAMd,EAASc,EAAG,eAAkBA,EAAG,aAAgBA,EAAG,YAAY,EAAiB,KAEvF,OAAId,IAAYW,EAAgBX,CAAM,GAAKA,IAAW,SAAS,iBACvDA,EAGDa,EAAqBb,CAAqB,CAClD,EAEA,OACCN,KAAA,kBACAe,KAAA,cACAI,KAAA,qBACAjB,KAAA",
"names": ["getActiveElement", "getFocusedElement", "element", "isFocusedElementWithinNode", "node", "fe", "isNodeContainedWithin", "parent", "child", "currentNode", "n", "childNodes", "isPointInRect", "x", "y", "rect", "isClickInRect", "touch", "instanceOfPopup", "object", "getClosedPopupParent", "el"]
}