grav-svelte 0.0.37 → 0.0.38

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.
@@ -54,7 +54,10 @@ import ImageModal from "./ImageModal.svelte";
54
54
 
55
55
  // Drag and drop functions
56
56
  function handleDragStart(event: DragEvent, index: number) {
57
- if (!dragEnabled) return;
57
+ if (!dragEnabled || !todosLosRegistros || todosLosRegistros.length === 0 || loading) {
58
+ event.preventDefault();
59
+ return;
60
+ }
58
61
 
59
62
  draggedIndex = index;
60
63
  isDragging = true;
@@ -86,6 +89,12 @@ import ImageModal from "./ImageModal.svelte";
86
89
  return;
87
90
  }
88
91
 
92
+ // Prevent reordering if there's no data or data is still loading
93
+ if (!todosLosRegistros || todosLosRegistros.length === 0 || loading) {
94
+ resetDragState();
95
+ return;
96
+ }
97
+
89
98
  event.preventDefault();
90
99
 
91
100
  // Create a new array with reordered items
@@ -238,12 +247,12 @@ import ImageModal from "./ImageModal.svelte";
238
247
  <tr
239
248
  class="table-row {selectedRowId === index
240
249
  ? 'selected'
241
- : ''} {dragEnabled ? 'draggable-row' : ''} {draggedIndex === index
250
+ : ''} {dragEnabled && !loading && todosLosRegistros.length > 0 ? 'draggable-row' : ''} {draggedIndex === index
242
251
  ? 'dragging'
243
252
  : ''} {dragOverIndex === index
244
253
  ? 'drag-over'
245
254
  : ''}"
246
- draggable={dragEnabled}
255
+ draggable={dragEnabled && !loading && todosLosRegistros.length > 0}
247
256
  on:click={() => handleRowClick(index)}
248
257
  on:dragstart={(e) => handleDragStart(e, index)}
249
258
  on:dragover={(e) => handleDragOver(e, index)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grav-svelte",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "description": "A collection of Svelte components",
5
5
  "license": "MIT",
6
6
  "scripts": {