@ui5/webcomponents-base 2.14.0-rc.3 → 2.14.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  const VersionInfo = {
2
- version: "2.14.0-rc.3",
2
+ version: "2.14.0-rc.5",
3
3
  major: 2,
4
4
  minor: 14,
5
5
  patch: 0,
6
- suffix: "-rc.3",
6
+ suffix: "-rc.5",
7
7
  isNext: false,
8
- buildTime: 1755871219,
8
+ buildTime: 1756368580,
9
9
  };
10
10
  export default VersionInfo;
11
11
  //# sourceMappingURL=VersionInfo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["const VersionInfo = {\n\tversion: \"2.14.0-rc.3\",\n\tmajor: 2,\n\tminor: 14,\n\tpatch: 0,\n\tsuffix: \"-rc.3\",\n\tisNext: false,\n\tbuildTime: 1755871219,\n};\nexport default VersionInfo;"]}
1
+ {"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["const VersionInfo = {\n\tversion: \"2.14.0-rc.5\",\n\tmajor: 2,\n\tminor: 14,\n\tpatch: 0,\n\tsuffix: \"-rc.5\",\n\tisNext: false,\n\tbuildTime: 1756368580,\n};\nexport default VersionInfo;"]}
@@ -1,2 +1,2 @@
1
- "use strict";const e={version:"2.14.0-rc.3",major:2,minor:14,patch:0,suffix:"-rc.3",isNext:!1,buildTime:1755871219};export default e;
1
+ "use strict";const e={version:"2.14.0-rc.5",major:2,minor:14,patch:0,suffix:"-rc.5",isNext:!1,buildTime:1756368580};export default e;
2
2
  //# sourceMappingURL=VersionInfo.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/generated/VersionInfo.ts"],
4
- "sourcesContent": ["const VersionInfo = {\n\tversion: \"2.14.0-rc.3\",\n\tmajor: 2,\n\tminor: 14,\n\tpatch: 0,\n\tsuffix: \"-rc.3\",\n\tisNext: false,\n\tbuildTime: 1755871219,\n};\nexport default VersionInfo;"],
4
+ "sourcesContent": ["const VersionInfo = {\n\tversion: \"2.14.0-rc.5\",\n\tmajor: 2,\n\tminor: 14,\n\tpatch: 0,\n\tsuffix: \"-rc.5\",\n\tisNext: false,\n\tbuildTime: 1756368580,\n};\nexport default VersionInfo;"],
5
5
  "mappings": "aAAA,MAAMA,EAAc,CACnB,QAAS,cACT,MAAO,EACP,MAAO,GACP,MAAO,EACP,OAAQ,QACR,OAAQ,GACR,UAAW,UACZ,EACA,eAAeA",
6
6
  "names": ["VersionInfo"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";import p from"../../generated/css/MultipleDragGhost.css.js";import{getI18nBundle as D}from"../../i18nBundle.js";import{DRAG_DROP_MULTIPLE_TEXT as v}from"../../generated/i18n/i18n-defaults.js";const m=2;let n=null,a=null,r=!1;const o=new Set,l=new Set,i=e=>{!e.dataTransfer||!(e.target instanceof HTMLElement)||(l.has(e.target)||(a=e.target),M(e))},M=async e=>{if(!n||!e.dataTransfer)return;const t=await n;document.body.appendChild(t),e.dataTransfer.setDragImage(t,0,0),requestAnimationFrame(()=>{t.remove()})},c=()=>{a=null,n=null},g=()=>{a=null,n=null},f=e=>{a=e},b=()=>a,y=async e=>{const t=document.createElement("div"),E=await D("@ui5/webcomponents-base"),s=t.attachShadow({mode:"open"}),d=new CSSStyleSheet;return d.replaceSync(p),s.adoptedStyleSheets=[d],s.textContent=E.getText(v,e),t},u=(e,t)=>{if(e<m){console.warn(`Cannot start multiple drag with count ${e}. Minimum is ${m}.`);return}n=y(e)},S=()=>{r||(document.body.addEventListener("dragstart",i),document.body.addEventListener("dragend",c),document.body.addEventListener("drop",g),r=!0)},L=()=>{document.body.removeEventListener("dragstart",i),document.body.removeEventListener("dragend",c),document.body.removeEventListener("drop",g),r=!1},T=e=>{o.add(e),r||S()},h=e=>{o.delete(e),o.size===0&&r&&L()},w=e=>(l.add(e),f),H=e=>{l.delete(e)},I={subscribe:T,unsubscribe:h,addSelfManagedArea:w,removeSelfManagedArea:H,getDraggedElement:b,startMultipleDrag:u};export default I;export{u as startMultipleDrag};
1
+ "use strict";import s from"../../generated/css/MultipleDragGhost.css.js";import{getI18nBundle as i}from"../../i18nBundle.js";import{DRAG_DROP_MULTIPLE_TEXT as c}from"../../generated/i18n/i18n-defaults.js";const l=2;let a=null;const g=e=>{a=e},d=()=>{a=null},p=()=>a,u=async e=>{const t=document.createElement("div"),n=await i("@ui5/webcomponents-base"),r=t.attachShadow({mode:"open"}),o=new CSSStyleSheet;return o.replaceSync(s),r.adoptedStyleSheets=[o],r.textContent=n.getText(c,e),t},m=async(e,t)=>{if(e<l){console.warn(`Cannot start multiple drag with count ${e}. Minimum is ${l}.`);return}if(!t.dataTransfer)return;const n=await u(e);document.body.appendChild(n),t.dataTransfer.setDragImage(n,0,0),requestAnimationFrame(()=>{n.remove()})},D={setDraggedElement:g,clearDraggedElement:d,getDraggedElement:p,startMultipleDrag:m};export default D;export{m as startMultipleDrag};
2
2
  //# sourceMappingURL=DragRegistry.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/util/dragAndDrop/DragRegistry.ts"],
4
- "sourcesContent": ["import type UI5Element from \"../../UI5Element.js\";\nimport type MovePlacement from \"../../types/MovePlacement.js\";\nimport MultipleDragGhostCss from \"../../generated/css/MultipleDragGhost.css.js\";\n\nimport { getI18nBundle } from \"../../i18nBundle.js\";\n\nimport {\n\tDRAG_DROP_MULTIPLE_TEXT,\n} from \"../../generated/i18n/i18n-defaults.js\";\n\nconst MIN_MULTI_DRAG_COUNT = 2;\n\nlet customDragElementPromise: Promise<HTMLElement> | null = null;\nlet draggedElement: HTMLElement | null = null;\nlet globalHandlersAttached = false;\nconst subscribers = new Set<UI5Element>();\nconst selfManagedDragAreas = new Set<HTMLElement | ShadowRoot>();\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\thandleMultipleDrag(e);\n};\n\nconst handleMultipleDrag = async (e: DragEvent) => {\n\tif (!customDragElementPromise || !e.dataTransfer) {\n\t\treturn;\n\t}\n\tconst dragElement = await customDragElementPromise;\n\t// Add to document body temporarily\n\tdocument.body.appendChild(dragElement);\n\n\te.dataTransfer.setDragImage(dragElement, 0, 0);\n\n\t// Clean up the temporary element after the drag operation starts\n\trequestAnimationFrame(() => {\n\t\tdragElement.remove();\n\t});\n};\n\nconst ondragend = () => {\n\tdraggedElement = null;\n\tcustomDragElementPromise = null;\n};\n\nconst ondrop = () => {\n\tdraggedElement = null;\n\tcustomDragElementPromise = 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 createDefaultMultiDragElement = async (count: number): Promise<HTMLElement> => {\n\tconst dragElement = document.createElement(\"div\");\n\tconst i18nBundle = await getI18nBundle(\"@ui5/webcomponents-base\");\n\n\tconst dragElementShadow = dragElement.attachShadow({ mode: \"open\" });\n\n\tconst styles = new CSSStyleSheet();\n\tstyles.replaceSync(MultipleDragGhostCss);\n\n\tdragElementShadow.adoptedStyleSheets = [styles];\n\tdragElementShadow.textContent = i18nBundle.getText(DRAG_DROP_MULTIPLE_TEXT, count);\n\n\treturn dragElement;\n};\n\n/**\n * Starts a multiple drag operation by creating a drag ghost element.\n * The drag ghost will be displayed when dragging multiple items.\n *\n * @param {number} count - The number of items being dragged.\n * @param {DragEvent} e - The drag event that triggered the operation.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst startMultipleDrag = (count: number, e: DragEvent): void => {\n\tif (count < MIN_MULTI_DRAG_COUNT) {\n\t\tconsole.warn(`Cannot start multiple drag with count ${count}. Minimum is ${MIN_MULTI_DRAG_COUNT}.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\tcustomDragElementPromise = createDefaultMultiDragElement(count);\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\tglobalHandlersAttached = true;\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\ntype DragAndDropSettings = {\n\t/**\n\t * Allow cross-browser and file drag and drop.\n\t */\n\tcrossDnD?: boolean;\n\t/**\n\t * Pass the original event in the event parameters.\n\t */\n\toriginalEvent?: boolean;\n};\n\ntype MoveEventDetail = {\n\toriginalEvent: Event,\n\tsource: {\n\t\telement: HTMLElement,\n\t},\n\tdestination: {\n\t\telement: HTMLElement,\n\t\tplacement: `${MovePlacement}`,\n\t}\n};\n\nconst DragRegistry = {\n\tsubscribe,\n\tunsubscribe,\n\taddSelfManagedArea,\n\tremoveSelfManagedArea,\n\tgetDraggedElement,\n\tstartMultipleDrag,\n};\n\nexport default DragRegistry;\nexport {\n\tstartMultipleDrag,\n};\nexport type {\n\tSetDraggedElementFunction,\n\tDragAndDropSettings,\n\tMoveEventDetail,\n};\n"],
5
- "mappings": "aAEA,OAAOA,MAA0B,+CAEjC,OAAS,iBAAAC,MAAqB,sBAE9B,OACC,2BAAAC,MACM,wCAEP,MAAMC,EAAuB,EAE7B,IAAIC,EAAwD,KACxDC,EAAqC,KACrCC,EAAyB,GAC7B,MAAMC,EAAc,IAAI,IAClBC,EAAuB,IAAI,IAE3BC,EAAe,GAAiB,CACjC,CAAC,EAAE,cAAgB,EAAE,EAAE,kBAAkB,eAIxCD,EAAqB,IAAI,EAAE,MAAM,IACrCH,EAAiB,EAAE,QAGpBK,EAAmB,CAAC,EACrB,EAEMA,EAAqB,MAAO,GAAiB,CAClD,GAAI,CAACN,GAA4B,CAAC,EAAE,aACnC,OAED,MAAMO,EAAc,MAAMP,EAE1B,SAAS,KAAK,YAAYO,CAAW,EAErC,EAAE,aAAa,aAAaA,EAAa,EAAG,CAAC,EAG7C,sBAAsB,IAAM,CAC3BA,EAAY,OAAO,CACpB,CAAC,CACF,EAEMC,EAAY,IAAM,CACvBP,EAAiB,KACjBD,EAA2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B,EAAqB,OAAOsB,CAAI,CACjC,EAwBME,EAAe,CACpB,UAAAN,EACA,YAAAE,EACA,mBAAAC,EACA,sBAAAE,EACA,kBAAAf,EACA,kBAAAM,CACD,EAEA,eAAeU,EACf,OACCV,KAAA",
6
- "names": ["MultipleDragGhostCss", "getI18nBundle", "DRAG_DROP_MULTIPLE_TEXT", "MIN_MULTI_DRAG_COUNT", "customDragElementPromise", "draggedElement", "globalHandlersAttached", "subscribers", "selfManagedDragAreas", "ondragstart", "handleMultipleDrag", "dragElement", "ondragend", "ondrop", "setDraggedElement", "element", "getDraggedElement", "createDefaultMultiDragElement", "count", "i18nBundle", "dragElementShadow", "styles", "startMultipleDrag", "e", "attachGlobalHandlers", "detachGlobalHandlers", "subscribe", "subscriber", "unsubscribe", "addSelfManagedArea", "area", "removeSelfManagedArea", "DragRegistry"]
4
+ "sourcesContent": ["import type MovePlacement from \"../../types/MovePlacement.js\";\nimport MultipleDragGhostCss from \"../../generated/css/MultipleDragGhost.css.js\";\n\nimport { getI18nBundle } from \"../../i18nBundle.js\";\n\nimport {\n\tDRAG_DROP_MULTIPLE_TEXT,\n} from \"../../generated/i18n/i18n-defaults.js\";\n\nconst MIN_MULTI_DRAG_COUNT = 2;\n\nlet draggedElement: HTMLElement | null = null;\n\nconst setDraggedElement = (element: HTMLElement | null) => {\n\tdraggedElement = element;\n};\n\nconst clearDraggedElement = () => {\n\tdraggedElement = null;\n};\n\nconst getDraggedElement = () => {\n\treturn draggedElement;\n};\n\nconst createDefaultMultiDragElement = async (count: number): Promise<HTMLElement> => {\n\tconst dragElement = document.createElement(\"div\");\n\tconst i18nBundle = await getI18nBundle(\"@ui5/webcomponents-base\");\n\n\tconst dragElementShadow = dragElement.attachShadow({ mode: \"open\" });\n\n\tconst styles = new CSSStyleSheet();\n\tstyles.replaceSync(MultipleDragGhostCss);\n\n\tdragElementShadow.adoptedStyleSheets = [styles];\n\tdragElementShadow.textContent = i18nBundle.getText(DRAG_DROP_MULTIPLE_TEXT, count);\n\n\treturn dragElement;\n};\n\n/**\n * Starts a multiple drag operation by creating a drag ghost element.\n * The drag ghost will be displayed when dragging multiple items.\n *\n * @param {number} count - The number of items being dragged.\n * @param {DragEvent} e - The drag event that triggered the operation.\n * @public\n */\nconst startMultipleDrag = async (count: number, e: DragEvent) => {\n\tif (count < MIN_MULTI_DRAG_COUNT) {\n\t\tconsole.warn(`Cannot start multiple drag with count ${count}. Minimum is ${MIN_MULTI_DRAG_COUNT}.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\tif (!e.dataTransfer) {\n\t\treturn;\n\t}\n\n\tconst customDragElement = await createDefaultMultiDragElement(count);\n\n\t// Add to document body temporarily\n\tdocument.body.appendChild(customDragElement);\n\n\te.dataTransfer.setDragImage(customDragElement, 0, 0);\n\n\t// Clean up the temporary element after the drag operation starts\n\trequestAnimationFrame(() => {\n\t\tcustomDragElement.remove();\n\t});\n};\n\ntype DragAndDropSettings = {\n\t/**\n\t * Allow cross-browser and file drag and drop.\n\t */\n\tcrossDnD?: boolean;\n\t/**\n\t * Pass the original event in the event parameters.\n\t */\n\toriginalEvent?: boolean;\n};\n\ntype MoveEventDetail = {\n\toriginalEvent: Event,\n\tsource: {\n\t\telement: HTMLElement,\n\t},\n\tdestination: {\n\t\telement: HTMLElement,\n\t\tplacement: `${MovePlacement}`,\n\t}\n};\n\nconst DragRegistry = {\n\tsetDraggedElement,\n\tclearDraggedElement,\n\tgetDraggedElement,\n\tstartMultipleDrag,\n};\n\nexport default DragRegistry;\nexport {\n\tstartMultipleDrag,\n};\n\nexport type {\n\tDragAndDropSettings,\n\tMoveEventDetail,\n};\n"],
5
+ "mappings": "aACA,OAAOA,MAA0B,+CAEjC,OAAS,iBAAAC,MAAqB,sBAE9B,OACC,2BAAAC,MACM,wCAEP,MAAMC,EAAuB,EAE7B,IAAIC,EAAqC,KAEzC,MAAMC,EAAqBC,GAAgC,CAC1DF,EAAiBE,CAClB,EAEMC,EAAsB,IAAM,CACjCH,EAAiB,IAClB,EAEMI,EAAoB,IAClBJ,EAGFK,EAAgC,MAAOC,GAAwC,CACpF,MAAMC,EAAc,SAAS,cAAc,KAAK,EAC1CC,EAAa,MAAMX,EAAc,yBAAyB,EAE1DY,EAAoBF,EAAY,aAAa,CAAE,KAAM,MAAO,CAAC,EAE7DG,EAAS,IAAI,cACnB,OAAAA,EAAO,YAAYd,CAAoB,EAEvCa,EAAkB,mBAAqB,CAACC,CAAM,EAC9CD,EAAkB,YAAcD,EAAW,QAAQV,EAAyBQ,CAAK,EAE1EC,CACR,EAUMI,EAAoB,MAAOL,EAAeM,IAAiB,CAChE,GAAIN,EAAQP,EAAsB,CACjC,QAAQ,KAAK,yCAAyCO,CAAK,gBAAgBP,CAAoB,GAAG,EAClG,MACD,CAEA,GAAI,CAACa,EAAE,aACN,OAGD,MAAMC,EAAoB,MAAMR,EAA8BC,CAAK,EAGnE,SAAS,KAAK,YAAYO,CAAiB,EAE3CD,EAAE,aAAa,aAAaC,EAAmB,EAAG,CAAC,EAGnD,sBAAsB,IAAM,CAC3BA,EAAkB,OAAO,CAC1B,CAAC,CACF,EAwBMC,EAAe,CACpB,kBAAAb,EACA,oBAAAE,EACA,kBAAAC,EACA,kBAAAO,CACD,EAEA,eAAeG,EACf,OACCH,KAAA",
6
+ "names": ["MultipleDragGhostCss", "getI18nBundle", "DRAG_DROP_MULTIPLE_TEXT", "MIN_MULTI_DRAG_COUNT", "draggedElement", "setDraggedElement", "element", "clearDraggedElement", "getDraggedElement", "createDefaultMultiDragElement", "count", "dragElement", "i18nBundle", "dragElementShadow", "styles", "startMultipleDrag", "e", "customDragElement", "DragRegistry"]
7
7
  }
@@ -1,7 +1,4 @@
1
- import type UI5Element from "../../UI5Element.js";
2
1
  import type MovePlacement from "../../types/MovePlacement.js";
3
- declare const setDraggedElement: (element: HTMLElement | null) => void;
4
- type SetDraggedElementFunction = typeof setDraggedElement;
5
2
  /**
6
3
  * Starts a multiple drag operation by creating a drag ghost element.
7
4
  * The drag ghost will be displayed when dragging multiple items.
@@ -10,7 +7,7 @@ type SetDraggedElementFunction = typeof setDraggedElement;
10
7
  * @param {DragEvent} e - The drag event that triggered the operation.
11
8
  * @public
12
9
  */
13
- declare const startMultipleDrag: (count: number, e: DragEvent) => void;
10
+ declare const startMultipleDrag: (count: number, e: DragEvent) => Promise<void>;
14
11
  type DragAndDropSettings = {
15
12
  /**
16
13
  * Allow cross-browser and file drag and drop.
@@ -32,13 +29,11 @@ type MoveEventDetail = {
32
29
  };
33
30
  };
34
31
  declare const DragRegistry: {
35
- subscribe: (subscriber: UI5Element) => void;
36
- unsubscribe: (subscriber: UI5Element) => void;
37
- addSelfManagedArea: (area: HTMLElement | ShadowRoot) => (element: HTMLElement | null) => void;
38
- removeSelfManagedArea: (area: HTMLElement | ShadowRoot) => void;
32
+ setDraggedElement: (element: HTMLElement | null) => void;
33
+ clearDraggedElement: () => void;
39
34
  getDraggedElement: () => HTMLElement | null;
40
- startMultipleDrag: (count: number, e: DragEvent) => void;
35
+ startMultipleDrag: (count: number, e: DragEvent) => Promise<void>;
41
36
  };
42
37
  export default DragRegistry;
43
38
  export { startMultipleDrag, };
44
- export type { SetDraggedElementFunction, DragAndDropSettings, MoveEventDetail, };
39
+ export type { DragAndDropSettings, MoveEventDetail, };
@@ -2,44 +2,13 @@ import MultipleDragGhostCss from "../../generated/css/MultipleDragGhost.css.js";
2
2
  import { getI18nBundle } from "../../i18nBundle.js";
3
3
  import { DRAG_DROP_MULTIPLE_TEXT, } from "../../generated/i18n/i18n-defaults.js";
4
4
  const MIN_MULTI_DRAG_COUNT = 2;
5
- let customDragElementPromise = null;
6
5
  let draggedElement = null;
7
- let globalHandlersAttached = false;
8
- const subscribers = new Set();
9
- const selfManagedDragAreas = new Set();
10
- const ondragstart = (e) => {
11
- if (!e.dataTransfer || !(e.target instanceof HTMLElement)) {
12
- return;
13
- }
14
- if (!selfManagedDragAreas.has(e.target)) {
15
- draggedElement = e.target;
16
- }
17
- handleMultipleDrag(e);
18
- };
19
- const handleMultipleDrag = async (e) => {
20
- if (!customDragElementPromise || !e.dataTransfer) {
21
- return;
22
- }
23
- const dragElement = await customDragElementPromise;
24
- // Add to document body temporarily
25
- document.body.appendChild(dragElement);
26
- e.dataTransfer.setDragImage(dragElement, 0, 0);
27
- // Clean up the temporary element after the drag operation starts
28
- requestAnimationFrame(() => {
29
- dragElement.remove();
30
- });
31
- };
32
- const ondragend = () => {
33
- draggedElement = null;
34
- customDragElementPromise = null;
35
- };
36
- const ondrop = () => {
37
- draggedElement = null;
38
- customDragElementPromise = null;
39
- };
40
6
  const setDraggedElement = (element) => {
41
7
  draggedElement = element;
42
8
  };
9
+ const clearDraggedElement = () => {
10
+ draggedElement = null;
11
+ };
43
12
  const getDraggedElement = () => {
44
13
  return draggedElement;
45
14
  };
@@ -61,53 +30,26 @@ const createDefaultMultiDragElement = async (count) => {
61
30
  * @param {DragEvent} e - The drag event that triggered the operation.
62
31
  * @public
63
32
  */
64
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
65
- const startMultipleDrag = (count, e) => {
33
+ const startMultipleDrag = async (count, e) => {
66
34
  if (count < MIN_MULTI_DRAG_COUNT) {
67
35
  console.warn(`Cannot start multiple drag with count ${count}. Minimum is ${MIN_MULTI_DRAG_COUNT}.`); // eslint-disable-line
68
36
  return;
69
37
  }
70
- customDragElementPromise = createDefaultMultiDragElement(count);
71
- };
72
- const attachGlobalHandlers = () => {
73
- if (globalHandlersAttached) {
38
+ if (!e.dataTransfer) {
74
39
  return;
75
40
  }
76
- document.body.addEventListener("dragstart", ondragstart);
77
- document.body.addEventListener("dragend", ondragend);
78
- document.body.addEventListener("drop", ondrop);
79
- globalHandlersAttached = true;
80
- };
81
- const detachGlobalHandlers = () => {
82
- document.body.removeEventListener("dragstart", ondragstart);
83
- document.body.removeEventListener("dragend", ondragend);
84
- document.body.removeEventListener("drop", ondrop);
85
- globalHandlersAttached = false;
86
- };
87
- const subscribe = (subscriber) => {
88
- subscribers.add(subscriber);
89
- if (!globalHandlersAttached) {
90
- attachGlobalHandlers();
91
- }
92
- };
93
- const unsubscribe = (subscriber) => {
94
- subscribers.delete(subscriber);
95
- if (subscribers.size === 0 && globalHandlersAttached) {
96
- detachGlobalHandlers();
97
- }
98
- };
99
- const addSelfManagedArea = (area) => {
100
- selfManagedDragAreas.add(area);
101
- return setDraggedElement;
102
- };
103
- const removeSelfManagedArea = (area) => {
104
- selfManagedDragAreas.delete(area);
41
+ const customDragElement = await createDefaultMultiDragElement(count);
42
+ // Add to document body temporarily
43
+ document.body.appendChild(customDragElement);
44
+ e.dataTransfer.setDragImage(customDragElement, 0, 0);
45
+ // Clean up the temporary element after the drag operation starts
46
+ requestAnimationFrame(() => {
47
+ customDragElement.remove();
48
+ });
105
49
  };
106
50
  const DragRegistry = {
107
- subscribe,
108
- unsubscribe,
109
- addSelfManagedArea,
110
- removeSelfManagedArea,
51
+ setDraggedElement,
52
+ clearDraggedElement,
111
53
  getDraggedElement,
112
54
  startMultipleDrag,
113
55
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DragRegistry.js","sourceRoot":"","sources":["../../../src/util/dragAndDrop/DragRegistry.ts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,MAAM,8CAA8C,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EACN,uBAAuB,GACvB,MAAM,uCAAuC,CAAC;AAE/C,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,IAAI,wBAAwB,GAAgC,IAAI,CAAC;AACjE,IAAI,cAAc,GAAuB,IAAI,CAAC;AAC9C,IAAI,sBAAsB,GAAG,KAAK,CAAC;AACnC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAc,CAAC;AAC1C,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAA4B,CAAC;AAEjE,MAAM,WAAW,GAAG,CAAC,CAAY,EAAE,EAAE;IACpC,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,CA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,EAAE;IACjC,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC5D,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACxD,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,sBAAsB,GAAG,KAAK,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,UAAsB,EAAE,EAAE;IAC5C,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAE5B,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC7B,oBAAoB,EAAE,CAAC;IACxB,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,UAAsB,EAAE,EAAE;IAC9C,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAE/B,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC,IAAI,sBAAsB,EAAE,CAAC;QACtD,oBAAoB,EAAE,CAAC;IACxB,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,IAA8B,EAAE,EAAE;IAC7D,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAE/B,OAAO,iBAAiB,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,IAA8B,EAAE,EAAE;IAChE,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;AAwBF,MAAM,YAAY,GAAG;IACpB,SAAS;IACT,WAAW;IACX,kBAAkB;IAClB,qBAAqB;IACrB,iBAAiB;IACjB,iBAAiB;CACjB,CAAC;AAEF,eAAe,YAAY,CAAC;AAC5B,OAAO,EACN,iBAAiB,GACjB,CAAC","sourcesContent":["import type UI5Element from \"../../UI5Element.js\";\nimport type MovePlacement from \"../../types/MovePlacement.js\";\nimport MultipleDragGhostCss from \"../../generated/css/MultipleDragGhost.css.js\";\n\nimport { getI18nBundle } from \"../../i18nBundle.js\";\n\nimport {\n\tDRAG_DROP_MULTIPLE_TEXT,\n} from \"../../generated/i18n/i18n-defaults.js\";\n\nconst MIN_MULTI_DRAG_COUNT = 2;\n\nlet customDragElementPromise: Promise<HTMLElement> | null = null;\nlet draggedElement: HTMLElement | null = null;\nlet globalHandlersAttached = false;\nconst subscribers = new Set<UI5Element>();\nconst selfManagedDragAreas = new Set<HTMLElement | ShadowRoot>();\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\thandleMultipleDrag(e);\n};\n\nconst handleMultipleDrag = async (e: DragEvent) => {\n\tif (!customDragElementPromise || !e.dataTransfer) {\n\t\treturn;\n\t}\n\tconst dragElement = await customDragElementPromise;\n\t// Add to document body temporarily\n\tdocument.body.appendChild(dragElement);\n\n\te.dataTransfer.setDragImage(dragElement, 0, 0);\n\n\t// Clean up the temporary element after the drag operation starts\n\trequestAnimationFrame(() => {\n\t\tdragElement.remove();\n\t});\n};\n\nconst ondragend = () => {\n\tdraggedElement = null;\n\tcustomDragElementPromise = null;\n};\n\nconst ondrop = () => {\n\tdraggedElement = null;\n\tcustomDragElementPromise = 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 createDefaultMultiDragElement = async (count: number): Promise<HTMLElement> => {\n\tconst dragElement = document.createElement(\"div\");\n\tconst i18nBundle = await getI18nBundle(\"@ui5/webcomponents-base\");\n\n\tconst dragElementShadow = dragElement.attachShadow({ mode: \"open\" });\n\n\tconst styles = new CSSStyleSheet();\n\tstyles.replaceSync(MultipleDragGhostCss);\n\n\tdragElementShadow.adoptedStyleSheets = [styles];\n\tdragElementShadow.textContent = i18nBundle.getText(DRAG_DROP_MULTIPLE_TEXT, count);\n\n\treturn dragElement;\n};\n\n/**\n * Starts a multiple drag operation by creating a drag ghost element.\n * The drag ghost will be displayed when dragging multiple items.\n *\n * @param {number} count - The number of items being dragged.\n * @param {DragEvent} e - The drag event that triggered the operation.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst startMultipleDrag = (count: number, e: DragEvent): void => {\n\tif (count < MIN_MULTI_DRAG_COUNT) {\n\t\tconsole.warn(`Cannot start multiple drag with count ${count}. Minimum is ${MIN_MULTI_DRAG_COUNT}.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\tcustomDragElementPromise = createDefaultMultiDragElement(count);\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\tglobalHandlersAttached = true;\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\ntype DragAndDropSettings = {\n\t/**\n\t * Allow cross-browser and file drag and drop.\n\t */\n\tcrossDnD?: boolean;\n\t/**\n\t * Pass the original event in the event parameters.\n\t */\n\toriginalEvent?: boolean;\n};\n\ntype MoveEventDetail = {\n\toriginalEvent: Event,\n\tsource: {\n\t\telement: HTMLElement,\n\t},\n\tdestination: {\n\t\telement: HTMLElement,\n\t\tplacement: `${MovePlacement}`,\n\t}\n};\n\nconst DragRegistry = {\n\tsubscribe,\n\tunsubscribe,\n\taddSelfManagedArea,\n\tremoveSelfManagedArea,\n\tgetDraggedElement,\n\tstartMultipleDrag,\n};\n\nexport default DragRegistry;\nexport {\n\tstartMultipleDrag,\n};\nexport type {\n\tSetDraggedElementFunction,\n\tDragAndDropSettings,\n\tMoveEventDetail,\n};\n"]}
1
+ {"version":3,"file":"DragRegistry.js","sourceRoot":"","sources":["../../../src/util/dragAndDrop/DragRegistry.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,MAAM,8CAA8C,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EACN,uBAAuB,GACvB,MAAM,uCAAuC,CAAC;AAE/C,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,IAAI,cAAc,GAAuB,IAAI,CAAC;AAE9C,MAAM,iBAAiB,GAAG,CAAC,OAA2B,EAAE,EAAE;IACzD,cAAc,GAAG,OAAO,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,GAAG,EAAE;IAChC,cAAc,GAAG,IAAI,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC9B,OAAO,cAAc,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,6BAA6B,GAAG,KAAK,EAAE,KAAa,EAAwB,EAAE;IACnF,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,yBAAyB,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","sourcesContent":["import type MovePlacement from \"../../types/MovePlacement.js\";\nimport MultipleDragGhostCss from \"../../generated/css/MultipleDragGhost.css.js\";\n\nimport { getI18nBundle } from \"../../i18nBundle.js\";\n\nimport {\n\tDRAG_DROP_MULTIPLE_TEXT,\n} from \"../../generated/i18n/i18n-defaults.js\";\n\nconst MIN_MULTI_DRAG_COUNT = 2;\n\nlet draggedElement: HTMLElement | null = null;\n\nconst setDraggedElement = (element: HTMLElement | null) => {\n\tdraggedElement = element;\n};\n\nconst clearDraggedElement = () => {\n\tdraggedElement = null;\n};\n\nconst getDraggedElement = () => {\n\treturn draggedElement;\n};\n\nconst createDefaultMultiDragElement = async (count: number): Promise<HTMLElement> => {\n\tconst dragElement = document.createElement(\"div\");\n\tconst i18nBundle = await getI18nBundle(\"@ui5/webcomponents-base\");\n\n\tconst dragElementShadow = dragElement.attachShadow({ mode: \"open\" });\n\n\tconst styles = new CSSStyleSheet();\n\tstyles.replaceSync(MultipleDragGhostCss);\n\n\tdragElementShadow.adoptedStyleSheets = [styles];\n\tdragElementShadow.textContent = i18nBundle.getText(DRAG_DROP_MULTIPLE_TEXT, count);\n\n\treturn dragElement;\n};\n\n/**\n * Starts a multiple drag operation by creating a drag ghost element.\n * The drag ghost will be displayed when dragging multiple items.\n *\n * @param {number} count - The number of items being dragged.\n * @param {DragEvent} e - The drag event that triggered the operation.\n * @public\n */\nconst startMultipleDrag = async (count: number, e: DragEvent) => {\n\tif (count < MIN_MULTI_DRAG_COUNT) {\n\t\tconsole.warn(`Cannot start multiple drag with count ${count}. Minimum is ${MIN_MULTI_DRAG_COUNT}.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\tif (!e.dataTransfer) {\n\t\treturn;\n\t}\n\n\tconst customDragElement = await createDefaultMultiDragElement(count);\n\n\t// Add to document body temporarily\n\tdocument.body.appendChild(customDragElement);\n\n\te.dataTransfer.setDragImage(customDragElement, 0, 0);\n\n\t// Clean up the temporary element after the drag operation starts\n\trequestAnimationFrame(() => {\n\t\tcustomDragElement.remove();\n\t});\n};\n\ntype DragAndDropSettings = {\n\t/**\n\t * Allow cross-browser and file drag and drop.\n\t */\n\tcrossDnD?: boolean;\n\t/**\n\t * Pass the original event in the event parameters.\n\t */\n\toriginalEvent?: boolean;\n};\n\ntype MoveEventDetail = {\n\toriginalEvent: Event,\n\tsource: {\n\t\telement: HTMLElement,\n\t},\n\tdestination: {\n\t\telement: HTMLElement,\n\t\tplacement: `${MovePlacement}`,\n\t}\n};\n\nconst DragRegistry = {\n\tsetDraggedElement,\n\tclearDraggedElement,\n\tgetDraggedElement,\n\tstartMultipleDrag,\n};\n\nexport default DragRegistry;\nexport {\n\tstartMultipleDrag,\n};\n\nexport type {\n\tDragAndDropSettings,\n\tMoveEventDetail,\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-base",
3
- "version": "2.14.0-rc.3",
3
+ "version": "2.14.0-rc.5",
4
4
  "description": "UI5 Web Components: webcomponents.base",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -63,7 +63,7 @@
63
63
  "@openui5/sap.ui.core": "1.120.17",
64
64
  "@sap-theming/theming-base-content": "11.29.3",
65
65
  "@ui5/cypress-internal": "0.0.0",
66
- "@ui5/webcomponents-tools": "2.14.0-rc.3",
66
+ "@ui5/webcomponents-tools": "2.14.0-rc.5",
67
67
  "chromedriver": "^138.0.5",
68
68
  "clean-css": "^5.2.2",
69
69
  "copy-and-watch": "^0.1.5",
@@ -74,5 +74,5 @@
74
74
  "resolve": "^1.20.0",
75
75
  "touch": "^3.1.0"
76
76
  },
77
- "gitHead": "c1c74f2bd283434a0610b3b9bf9ab0bc9eb682b7"
77
+ "gitHead": "e08117399dafdca92042b9b0f79dc231ce0d78ad"
78
78
  }