@hkdigital/lib-sveltekit 0.1.87 → 0.1.89
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.
@@ -154,7 +154,7 @@
|
|
154
154
|
// Check if this is a file drop
|
155
155
|
if (event.dataTransfer.types.includes('Files')) {
|
156
156
|
// Handle file drop - you can extend this based on your needs
|
157
|
-
console.log('File drop detected:', event.dataTransfer.files);
|
157
|
+
// console.log('File drop detected:', event.dataTransfer.files);
|
158
158
|
return null; // Return null to indicate this is not an internal drag
|
159
159
|
}
|
160
160
|
|
@@ -280,7 +280,7 @@
|
|
280
280
|
if (event.dataTransfer.types.includes('Files')) {
|
281
281
|
// Handle file drops
|
282
282
|
const files = Array.from(event.dataTransfer.files);
|
283
|
-
console.log('Files dropped:', files);
|
283
|
+
// console.log('Files dropped:', files);
|
284
284
|
|
285
285
|
// You can add custom file handling here
|
286
286
|
// For now, just reset state and return
|
@@ -306,25 +306,31 @@
|
|
306
306
|
const dropzoneRect = dropzoneElement.getBoundingClientRect();
|
307
307
|
|
308
308
|
// Calculate position with both dragData.offsetX/Y adjustment and border adjustment
|
309
|
-
const
|
309
|
+
const dropOffsetX =
|
310
310
|
event.clientX -
|
311
311
|
dropzoneRect.left -
|
312
|
-
borderLeftWidth
|
313
|
-
(dragData.offsetX ?? 0);
|
312
|
+
borderLeftWidth;
|
314
313
|
|
315
|
-
const
|
314
|
+
const dropOffsetY =
|
316
315
|
event.clientY -
|
317
316
|
dropzoneRect.top -
|
318
|
-
borderTopWidth
|
319
|
-
|
317
|
+
borderTopWidth;
|
318
|
+
|
319
|
+
const x = dropOffsetX - (dragData.offsetX ?? 0);
|
320
|
+
const y = dropOffsetY - (dragData.offsetY ?? 0);
|
320
321
|
|
321
322
|
const dropResult = onDrop?.({
|
322
|
-
event,
|
323
|
-
offsetX,
|
324
|
-
offsetY,
|
325
323
|
zone,
|
324
|
+
source: dragData.source,
|
326
325
|
item: dragData.item,
|
327
|
-
|
326
|
+
x,
|
327
|
+
y,
|
328
|
+
drag: dragData,
|
329
|
+
drop: {
|
330
|
+
offsetX: dropOffsetX,
|
331
|
+
offsetY: dropOffsetY,
|
332
|
+
event
|
333
|
+
}
|
328
334
|
});
|
329
335
|
|
330
336
|
// Handle async or sync results
|
package/dist/typedef/drop.d.ts
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
declare const _default: {};
|
2
2
|
export default _default;
|
3
3
|
export type DropData = {
|
4
|
-
|
5
|
-
|
6
|
-
offsetY: number;
|
4
|
+
x: number;
|
5
|
+
y: number;
|
7
6
|
zone: string;
|
8
|
-
item: any;
|
9
7
|
source: string;
|
10
|
-
|
8
|
+
item: any;
|
9
|
+
drag: import("./drag").DragData;
|
10
|
+
drop: {
|
11
|
+
offsetX: number;
|
12
|
+
offsetY: number;
|
13
|
+
event: DragEvent;
|
14
|
+
};
|
11
15
|
};
|
package/dist/typedef/drop.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
/**
|
2
2
|
* @typedef {Object} DropData
|
3
|
-
* @property {
|
4
|
-
* @property {number}
|
5
|
-
* @property {number} offsetY
|
3
|
+
* @property {number} x
|
4
|
+
* @property {number} y
|
6
5
|
* @property {string} zone
|
7
|
-
* @property {any} item
|
8
6
|
* @property {string} source
|
9
|
-
* @property {any}
|
7
|
+
* @property {any} item
|
8
|
+
* @property {import('./drag').DragData} drag
|
9
|
+
* @property {{offsetX: number, offsetY: number, event: DragEvent}} drop
|
10
10
|
*/
|
11
11
|
|
12
12
|
export default {};
|