All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.popup-utils.OpenedPopupsRegistry.js.map Maven / Gradle / Ivy

The newest version!
{"version":3,"file":"OpenedPopupsRegistry.js","sourceRoot":"","sources":["../../src/popup-utils/OpenedPopupsRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,mDAAmD,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAQhE,MAAM,oBAAoB,GAAG,iBAAiB,CAA6C,sBAAsB,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC;AAE3I,MAAM,cAAc,GAAG,CAAC,QAAe,EAAE,iBAA+B,EAAE,EAAE,EAAE;IAC7E,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,EAAE;QACpF,oBAAoB,CAAC,cAAc,CAAC,IAAI,CAAC;YACxC,QAAQ;YACR,cAAc;SACd,CAAC,CAAC;KACH;IAED,oBAAoB,EAAE,CAAC;IAEvB,IAAI,oBAAoB,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;QACrD,oBAAoB,EAAE,CAAC;KACvB;AACF,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,QAAe,EAAE,EAAE;IAC7C,oBAAoB,CAAC,cAAc,GAAG,oBAAoB,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;QACrF,OAAO,EAAE,CAAC,QAAQ,KAAK,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,oBAAoB,EAAE,CAAC;IAEvB,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,MAAM,EAAE;QAChD,oBAAoB,EAAE,CAAC;KACvB;AACF,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,GAAG,EAAE;IAC5B,OAAO,CAAC,GAAG,oBAAoB,CAAC,cAAc,C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ui5/webcomponents-base/dist/getSharedResource.js\";\nimport { isEscape } from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport type Popup from \"../Popup.js\";\n\ntype RegisteredPopup = {\n\tinstance: Popup;\n\tparentPopovers: Array;\n}\n\nconst OpenedPopupsRegistry = getSharedResource<{ openedRegistry: Array }>(\"OpenedPopupsRegistry\", { openedRegistry: [] });\n\nconst addOpenedPopup = (instance: Popup, parentPopovers: Array = []) => {\n\tif (!OpenedPopupsRegistry.openedRegistry.some(popup => popup.instance === instance)) {\n\t\tOpenedPopupsRegistry.openedRegistry.push({\n\t\t\tinstance,\n\t\t\tparentPopovers,\n\t\t});\n\t}\n\n\t_updateTopModalPopup();\n\n\tif (OpenedPopupsRegistry.openedRegistry.length === 1) {\n\t\tattachGlobalListener();\n\t}\n};\n\nconst removeOpenedPopup = (instance: Popup) => {\n\tOpenedPopupsRegistry.openedRegistry = OpenedPopupsRegistry.openedRegistry.filter(el => {\n\t\treturn el.instance !== instance;\n\t});\n\n\t_updateTopModalPopup();\n\n\tif (!OpenedPopupsRegistry.openedRegistry.length) {\n\t\tdetachGlobalListener();\n\t}\n};\n\nconst getOpenedPopups = () => {\n\treturn [...OpenedPopupsRegistry.openedRegistry];\n};\n\nconst _keydownListener = (event: KeyboardEvent) => {\n\tif (!OpenedPopupsRegistry.openedRegistry.length) {\n\t\treturn;\n\t}\n\n\tif (isEscape(event)) {\n\t\tevent.stopPropagation();\n\t\tOpenedPopupsRegistry.openedRegistry[OpenedPopupsRegistry.openedRegistry.length - 1].instance.closePopup(true);\n\t}\n};\n\nconst attachGlobalListener = () => {\n\tdocument.addEventListener(\"keydown\", _keydownListener);\n};\n\nconst detachGlobalListener = () => {\n\tdocument.removeEventListener(\"keydown\", _keydownListener);\n};\n\nconst _updateTopModalPopup = () => {\n\tlet popup;\n\tlet hasModal = false;\n\n\tfor (let i = OpenedPopupsRegistry.openedRegistry.length - 1; i >= 0; i--) {\n\t\tpopup = OpenedPopupsRegistry.openedRegistry[i].instance;\n\n\t\tif (!hasModal && popup.isModal) {\n\t\t\tpopup.isTopModalPopup = true;\n\t\t\thasModal = true;\n\t\t} else {\n\t\t\tpopup.isTopModalPopup = false;\n\t\t}\n\t}\n};\n\nexport { addOpenedPopup, removeOpenedPopup, getOpenedPopups };\n"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy