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

package.dist.prod.util.dragAndDrop.DragRegistry.js.map Maven / Gradle / Ivy

{
  "version": 3,
  "sources": ["../../../../src/util/dragAndDrop/DragRegistry.ts"],
  "sourcesContent": ["import type UI5Element from \"../../UI5Element.js\";\n\nlet draggedElement: HTMLElement | null = null;\nlet globalHandlersAttached = false;\nconst subscribers = new Set();\nconst selfManagedDragAreas = new Set();\n\nconst ondragstart = (e: DragEvent) => {\n\tif (!e.dataTransfer || !(e.target instanceof HTMLElement)) {\n\t\treturn;\n\t}\n\n\tif (!selfManagedDragAreas.has(e.target)) {\n\t\tdraggedElement = e.target;\n\t}\n};\n\nconst ondragend = () => {\n\tdraggedElement = null;\n};\n\nconst ondrop = () => {\n\tdraggedElement = null;\n};\n\nconst setDraggedElement = (element: HTMLElement | null) => {\n\tdraggedElement = element;\n};\ntype SetDraggedElementFunction = typeof setDraggedElement;\n\nconst getDraggedElement = () => {\n\treturn draggedElement;\n};\n\nconst attachGlobalHandlers = () => {\n\tif (globalHandlersAttached) {\n\t\treturn;\n\t}\n\n\tdocument.body.addEventListener(\"dragstart\", ondragstart);\n\tdocument.body.addEventListener(\"dragend\", ondragend);\n\tdocument.body.addEventListener(\"drop\", ondrop);\n};\n\nconst detachGlobalHandlers = () => {\n\tdocument.body.removeEventListener(\"dragstart\", ondragstart);\n\tdocument.body.removeEventListener(\"dragend\", ondragend);\n\tdocument.body.removeEventListener(\"drop\", ondrop);\n\tglobalHandlersAttached = false;\n};\n\nconst subscribe = (subscriber: UI5Element) => {\n\tsubscribers.add(subscriber);\n\n\tif (!globalHandlersAttached) {\n\t\tattachGlobalHandlers();\n\t}\n};\n\nconst unsubscribe = (subscriber: UI5Element) => {\n\tsubscribers.delete(subscriber);\n\n\tif (subscribers.size === 0 && globalHandlersAttached) {\n\t\tdetachGlobalHandlers();\n\t}\n};\n\nconst addSelfManagedArea = (area: HTMLElement | ShadowRoot) => {\n\tselfManagedDragAreas.add(area);\n\n\treturn setDraggedElement;\n};\n\nconst removeSelfManagedArea = (area: HTMLElement | ShadowRoot) => {\n\tselfManagedDragAreas.delete(area);\n};\n\nconst DragRegistry = {\n\tsubscribe,\n\tunsubscribe,\n\taddSelfManagedArea,\n\tremoveSelfManagedArea,\n\tgetDraggedElement,\n};\n\nexport default DragRegistry;\nexport type {\n\tSetDraggedElementFunction,\n};\n"],
  "mappings": "aAEA,IAAIA,EAAqC,KACrCC,EAAyB,GAC7B,MAAMC,EAAc,IAAI,IAClBC,EAAuB,IAAI,IAE3BC,EAAe,GAAiB,CACjC,CAAC,EAAE,cAAgB,EAAE,EAAE,kBAAkB,cAIxCD,EAAqB,IAAI,EAAE,MAAM,IACrCH,EAAiB,EAAE,OAErB,EAEMK,EAAY,IAAM,CACvBL,EAAiB,IAClB,EAEMM,EAAS,IAAM,CACpBN,EAAiB,IAClB,EAEMO,EAAqBC,GAAgC,CAC1DR,EAAiBQ,CAClB,EAGMC,EAAoB,IAClBT,EAGFU,EAAuB,IAAM,CAC9BT,IAIJ,SAAS,KAAK,iBAAiB,YAAaG,CAAW,EACvD,SAAS,KAAK,iBAAiB,UAAWC,CAAS,EACnD,SAAS,KAAK,iBAAiB,OAAQC,CAAM,EAC9C,EAEMK,EAAuB,IAAM,CAClC,SAAS,KAAK,oBAAoB,YAAaP,CAAW,EAC1D,SAAS,KAAK,oBAAoB,UAAWC,CAAS,EACtD,SAAS,KAAK,oBAAoB,OAAQC,CAAM,EAChDL,EAAyB,EAC1B,EAEMW,EAAaC,GAA2B,CAC7CX,EAAY,IAAIW,CAAU,EAErBZ,GACJS,EAAqB,CAEvB,EAEMI,EAAeD,GAA2B,CAC/CX,EAAY,OAAOW,CAAU,EAEzBX,EAAY,OAAS,GAAKD,GAC7BU,EAAqB,CAEvB,EAEMI,EAAsBC,IAC3Bb,EAAqB,IAAIa,CAAI,EAEtBT,GAGFU,EAAyBD,GAAmC,CACjEb,EAAqB,OAAOa,CAAI,CACjC,EAEME,EAAe,CACpB,UAAAN,EACA,YAAAE,EACA,mBAAAC,EACA,sBAAAE,EACA,kBAAAR,CACD,EAEA,eAAeS",
  "names": ["draggedElement", "globalHandlersAttached", "subscribers", "selfManagedDragAreas", "ondragstart", "ondragend", "ondrop", "setDraggedElement", "element", "getDraggedElement", "attachGlobalHandlers", "detachGlobalHandlers", "subscribe", "subscriber", "unsubscribe", "addSelfManagedArea", "area", "removeSelfManagedArea", "DragRegistry"]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy