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.util.PopupUtils.js.map Maven / Gradle / Ivy
{"version":3,"file":"PopupUtils.js","sourceRoot":"","sources":["../../src/util/PopupUtils.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAErD,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC9B,MAAM,OAAO,GAAG,gBAAgB,EAAiB,CAAC;IAClD,OAAO,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1E,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAAC,IAAiB,EAAE,EAAE;IACxD,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAE/B,IAAI,EAAE,EAAE;QACP,OAAO,qBAAqB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;KACvC;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,MAAmB,EAAE,KAAkB,EAAW,EAAE;IAClF,IAAI,WAAW,GAA4B,MAAM,CAAC;IAElD,IAAI,WAAW,CAAC,UAAU,EAAE;QAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAuB,CAAC;QACnF,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC;QAE1D,IAAI,CAAC,WAAW,EAAE;YACjB,OAAO,KAAK,CAAC;SACb;KACD;IAED,IAAI,WAAW,KAAK,KAAK,EAAE;QAC1B,OAAO,IAAI,CAAC;KACZ;IAED,MAAM,UAAU,GAAG,WAAW,CAAC,SAAS,KAAK,MAAM,CAAC,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CAAC,WAAW,IAAK,EAAE,CAAC,WAAW,EAAiB,CAAC,IAAI,CAAC,CAAC;IAE7F,IAAI,MAAM,IAAI,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,EAAE;QACjF,OAAO,MAAqB,CAAC;KAC7B;IAED,OAAO,oBAAoB,CAAC,MAAqB,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,0BAA0B,GAC1B,CAAC","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"]}