@erplora/outfitkit
Advanced tools
@@ -134,2 +134,3 @@ import { LitElement } from 'lit'; | ||
| private dropTarget; | ||
| private dragSource; | ||
| private seeded; | ||
@@ -159,2 +160,3 @@ private static readonly MOVE_MIME; | ||
| private onItemDragStart; | ||
| private onItemDragEnd; | ||
| private onDragOver; | ||
@@ -166,4 +168,4 @@ private onDragLeave; | ||
| private onFolderDrop; | ||
| /** Decodifica el payload de movimiento del evento y emite `ok-move` hacia `to`. */ | ||
| private emitMoveIfAny; | ||
| /** Emite `ok-move` con el origen del drag interno hacia `to`. */ | ||
| private emitMove; | ||
| private extOf; | ||
@@ -170,0 +172,0 @@ private variant; |
+22
-15
@@ -46,2 +46,3 @@ import { LitElement, css, html } from "lit"; | ||
| this.dropTarget = null; | ||
| this.dragSource = null; | ||
| this.seeded = false; | ||
@@ -752,2 +753,3 @@ } | ||
| isMoveDrag(e) { | ||
| if (this.dragSource != null) return true; | ||
| return !!e.dataTransfer?.types.includes(_OkFileManager2.MOVE_MIME); | ||
@@ -758,6 +760,13 @@ } | ||
| onItemDragStart(e, id, kind) { | ||
| if (!e.dataTransfer) return; | ||
| e.dataTransfer.setData(_OkFileManager2.MOVE_MIME, JSON.stringify({ id, kind })); | ||
| e.dataTransfer.effectAllowed = "move"; | ||
| this.dragSource = { id, kind }; | ||
| if (e.dataTransfer) { | ||
| e.dataTransfer.setData(_OkFileManager2.MOVE_MIME, JSON.stringify({ id, kind })); | ||
| e.dataTransfer.effectAllowed = "move"; | ||
| } | ||
| } | ||
| onItemDragEnd() { | ||
| this.dragSource = null; | ||
| this.dragging = false; | ||
| this.dropTarget = null; | ||
| } | ||
| // Soltar sobre el área main equivale a soltar en la raíz (`''`). | ||
@@ -790,3 +799,3 @@ onDragOver(e) { | ||
| } | ||
| this.emitMoveIfAny(e, ""); | ||
| this.emitMove(""); | ||
| } | ||
@@ -799,3 +808,3 @@ // ---- Drag & drop sobre filas de carpeta del árbol ---- | ||
| this.dropTarget = folder.id; | ||
| e.dataTransfer.dropEffect = "move"; | ||
| if (e.dataTransfer) e.dataTransfer.dropEffect = "move"; | ||
| } | ||
@@ -810,13 +819,8 @@ onFolderDragLeave(folder) { | ||
| this.dropTarget = null; | ||
| this.emitMoveIfAny(e, folder.id); | ||
| this.emitMove(folder.id); | ||
| } | ||
| /** Decodifica el payload de movimiento del evento y emite `ok-move` hacia `to`. */ | ||
| emitMoveIfAny(e, to) { | ||
| const raw = e.dataTransfer?.getData(_OkFileManager2.MOVE_MIME); | ||
| if (!raw) return; | ||
| try { | ||
| const { id } = JSON.parse(raw); | ||
| if (id) this.emit("ok-move", { from: id, to }); | ||
| } catch { | ||
| } | ||
| /** Emite `ok-move` con el origen del drag interno hacia `to`. */ | ||
| emitMove(to) { | ||
| if (!this.dragSource) return; | ||
| this.emit("ok-move", { from: this.dragSource.id, to }); | ||
| } | ||
@@ -865,2 +869,3 @@ // Deriva la extensión: usa `ext` o la cola del nombre. | ||
| @dragstart=${(e) => this.onItemDragStart(e, folder.id, "folder")} | ||
| @dragend=${() => this.onItemDragEnd()} | ||
| @dragover=${(e) => this.onFolderDragOver(e, folder)} | ||
@@ -1149,2 +1154,3 @@ @dragleave=${() => this.onFolderDragLeave(folder)} | ||
| @dragstart=${(e) => this.onItemDragStart(e, file.id, "file")} | ||
| @dragend=${() => this.onItemDragEnd()} | ||
| > | ||
@@ -1174,2 +1180,3 @@ <div class="card-actions">${this.fileActions(file)}</div> | ||
| @dragstart=${(e) => this.onItemDragStart(e, file.id, "file")} | ||
| @dragend=${() => this.onItemDragEnd()} | ||
| > | ||
@@ -1176,0 +1183,0 @@ ${this.renderBadge(file)} |
+1
-1
| { | ||
| "name": "@erplora/outfitkit", | ||
| "version": "0.1.34", | ||
| "version": "0.1.35", | ||
| "description": "OutfitKit — librería de Web Components (Lit) que CONSTRUYE lo que Ionic no tiene (tree, data-table rica, inline-feedback, kpi/stat, stepper/wizard, calendar, kanban…) sobre primitivos de Ionic. Ionic es la base; OutfitKit cubre los huecos. npm + CDN, imports individuales, CSP-safe. Tema vía tokens --ok-* (fallback a --ion-*).", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is too big to display
2113347
0.02%61057
0.01%