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.features.patchPopup.js.map Maven / Gradle / Ivy
{"version":3,"file":"patchPopup.js","sourceRoot":"","sources":["../../src/features/patchPopup.ts"],"names":[],"mappings":"AAgBA,MAAM,iBAAiB,GAAG,CAAC,MAAmB,EAAE,EAAE;IACjD,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACzC,MAAM,CAAC,WAAW,EAAE,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,MAAmB,EAAE,EAAE;IAClD,IAAI,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;QACnC,MAAM,CAAC,WAAW,EAAE,CAAC;QACrB,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;KAClC;AACF,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAmB,EAAE,EAAE;IACzC,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;IACtC,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,IAAI,CAAC,GAAG,IAAW;QAClD,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,sCAAsC;QAClE,MAAM,oBAAoB,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC,uDAAuD;QACpI,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAC3E,IAAI,gBAAgB,IAAI,oBAAoB,EAAE;YAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAClC,IAAI,OAAO,EAAE;gBACZ,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,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+C,CAAC,CAAC;IACxE,QAAQ,CAAC,kBAAkB,GAAG,CAAC,GAAG,QAAQ,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;AAC5E,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC1C,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,uBAAuB;IACzC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,0BAA0B;IAC9C,kBAAkB,EAAE,CAAC,CAAC,6FAA6F;IACnH,eAAe,CAAC,KAAK,CAAC,CAAC,CAAA,+BAA+B;AACvD,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["// OpenUI5's Element.js subset\ntype Element = {\n\tgetDomRef: () => HTMLElement | null,\n}\n\n// The lifecycle of Popup.js is open -> _opened -> close -> _closed, we're interested in the first (open) and last (_closed)\ntype OpenUI5Popup = {\n\tprototype: {\n\t\topen: (...args: any[]) => void,\n\t\t_closed: (...args: any[]) => void,\n\t\tgetOpenState: () => \"CLOSED\" | \"CLOSING\" | \"OPEN\" | \"OPENING\",\n\t\tgetContent: () => Element, // this is the OpenUI5 Element/Control instance that opens the Popup (usually sap.m.Popover/sap.m.Dialog)\n\t\tonFocusEvent: (e: FocusEvent) => void,\n\t}\n};\n\nconst openNativePopover = (domRef: HTMLElement) => {\n\tdomRef.setAttribute(\"popover\", \"manual\");\n\tdomRef.showPopover();\n};\n\nconst closeNativePopover = (domRef: HTMLElement) => {\n\tif (domRef.hasAttribute(\"popover\")) {\n\t\tdomRef.hidePopover();\n\t\tdomRef.removeAttribute(\"popover\");\n\t}\n};\n\nconst patchOpen = (Popup: OpenUI5Popup) => {\n\tconst origOpen = Popup.prototype.open;\n\tPopup.prototype.open = function open(...args: any[]) {\n\t\torigOpen.apply(this, args); // call open first to initiate opening\n\t\tconst topLayerAlreadyInUse = !!document.body.querySelector(\":popover-open\"); // check if there is already something in the top layer\n\t\tconst openingInitiated = [\"OPENING\", \"OPEN\"].includes(this.getOpenState());\n\t\tif (openingInitiated && topLayerAlreadyInUse) {\n\t\t\tconst element = this.getContent();\n\t\t\tif (element) {\n\t\t\t\tconst domRef = element.getDomRef();\n\t\t\t\tif (domRef) {\n\t\t\t\t\topenNativePopover(domRef);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n};\n\nconst patchClosed = (Popup: OpenUI5Popup) => {\n\tconst _origClosed = Popup.prototype._closed;\n\tPopup.prototype._closed = function _closed(...args: any[]) {\n\t\tconst element = this.getContent();\n\t\tconst domRef = element.getDomRef();\n\t\t_origClosed.apply(this, args); // only then call _close\n\t\tif (domRef) {\n\t\t\tcloseNativePopover(domRef); // unset the popover attribute and close the native popover, but only if still in DOM\n\t\t}\n\t};\n};\n\nconst patchFocusEvent = (Popup: OpenUI5Popup) => {\n\tconst origFocusEvent = Popup.prototype.onFocusEvent;\n\tPopup.prototype.onFocusEvent = function onFocusEvent(e: FocusEvent) {\n\t\tconst isTypeFocus = e.type === \"focus\" || e.type === \"activate\";\n\t\tconst target = e.target as HTMLElement;\n\t\tif (!isTypeFocus || !target.closest(\"[ui5-popover],[ui5-responsive-popover],[ui5-dialog]\")) {\n\t\t\torigFocusEvent.call(this, e);\n\t\t}\n\t};\n};\n\nconst createGlobalStyles = () => {\n\tconst stylesheet = new CSSStyleSheet();\n\tstylesheet.replaceSync(`.sapMPopup-CTX:popover-open { inset: unset; }`);\n\tdocument.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];\n};\n\nconst patchPopup = (Popup: OpenUI5Popup) => {\n\tpatchOpen(Popup); // Popup.prototype.open\n\tpatchClosed(Popup); // Popup.prototype._closed\n\tcreateGlobalStyles(); // Ensures correct popover positioning by OpenUI5 (otherwise 0,0 is the center of the screen)\n\tpatchFocusEvent(Popup);// Popup.prototype.onFocusEvent\n};\n\nexport default patchPopup;\nexport type { OpenUI5Popup };\n"]}