@makolabs/ripple 0.0.6 → 0.0.8
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.
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
const fileItem = files.find((f) => f.key === fileKey);
|
|
119
119
|
if (fileItem && !selected.some((s) => s.key === fileKey)) {
|
|
120
120
|
selected = [...selected, fileItem];
|
|
121
|
+
console.log('selected [SETTIMEOUT, FILEITEM]', selected);
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
}, 100);
|
|
@@ -250,6 +251,7 @@
|
|
|
250
251
|
if (filesToSelect.length > 0) {
|
|
251
252
|
selectedFiles = filesToSelect;
|
|
252
253
|
selected = displayFiles.filter((file) => filesToSelect.includes(file.key));
|
|
254
|
+
console.log('selected [NAVIGATETOFOLDER]', selected);
|
|
253
255
|
}
|
|
254
256
|
|
|
255
257
|
// Restore fileQueue to ensure we keep track of all selected files
|
|
@@ -278,15 +280,20 @@
|
|
|
278
280
|
|
|
279
281
|
// Toggle selection for files
|
|
280
282
|
const isCurrentlySelected = selectedFiles.includes(file.key);
|
|
281
|
-
|
|
283
|
+
console.log('isCurrentlySelected [HANDLEROWCLICK]', isCurrentlySelected);
|
|
284
|
+
console.log('selectedFiles [HANDLEROWCLICK]', selectedFiles);
|
|
285
|
+
console.log('selected [HANDLEROWCLICK]', selected);
|
|
286
|
+
|
|
282
287
|
if (isCurrentlySelected) {
|
|
283
288
|
// Remove from selection
|
|
284
|
-
selectedFiles = selectedFiles.filter(key => key !== file.key);
|
|
285
|
-
selected = selected.filter(item => item.key !== file.key);
|
|
289
|
+
selectedFiles = selectedFiles.filter((key) => key !== file.key);
|
|
290
|
+
selected = selected.filter((item) => item.key !== file.key);
|
|
291
|
+
console.log('selected [HANDLEROWCLICK, REMOVE]', selected);
|
|
286
292
|
} else {
|
|
287
293
|
// Add to selection
|
|
288
294
|
selectedFiles = [...selectedFiles, file.key];
|
|
289
295
|
selected = [...selected, file];
|
|
296
|
+
console.log('selected [HANDLEROWCLICK, ADD]', selected);
|
|
290
297
|
}
|
|
291
298
|
}
|
|
292
299
|
}
|
|
@@ -379,22 +386,22 @@
|
|
|
379
386
|
}
|
|
380
387
|
|
|
381
388
|
// Effect to update the Table component's selection state when selectedFiles changes
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
389
|
+
$effect(() => {
|
|
390
|
+
if (displayFiles.length === 0) return;
|
|
391
|
+
|
|
392
|
+
// Get all files that should be selected based on our current selection state
|
|
393
|
+
const filesToSelect = displayFiles.filter((file) => isRowSelected(file));
|
|
394
|
+
|
|
395
|
+
// We need to update the Table's internal selection state without triggering additional updates
|
|
396
|
+
// This ensures the UI is properly updated
|
|
397
|
+
if (
|
|
398
|
+
JSON.stringify(selected.map((f) => f.key).sort()) !==
|
|
399
|
+
JSON.stringify(filesToSelect.map((f) => f.key).sort())
|
|
400
|
+
) {
|
|
401
|
+
// Only update if the selection has actually changed
|
|
402
|
+
selected = filesToSelect;
|
|
403
|
+
}
|
|
404
|
+
});
|
|
398
405
|
|
|
399
406
|
// Track the selected items for the Table component's internal state
|
|
400
407
|
let selected = $state<FileItem[]>([]);
|
|
@@ -430,7 +437,7 @@
|
|
|
430
437
|
}
|
|
431
438
|
return false;
|
|
432
439
|
});
|
|
433
|
-
|
|
440
|
+
|
|
434
441
|
// Always allow folders to be selected (for recursive selection)
|
|
435
442
|
return item.isFolder || hasAllowedAction;
|
|
436
443
|
});
|
|
@@ -641,7 +648,14 @@
|
|
|
641
648
|
<div class="flex items-center gap-2">
|
|
642
649
|
{#each singularActions(file) as action (action.label)}
|
|
643
650
|
{#if action.isAllowed(file)}
|
|
644
|
-
<Button
|
|
651
|
+
<Button
|
|
652
|
+
size={Size.XS}
|
|
653
|
+
onclick={(e) => {
|
|
654
|
+
e.stopPropagation();
|
|
655
|
+
e.preventDefault();
|
|
656
|
+
action.action?.(file);
|
|
657
|
+
}}>{action.label(file)}</Button
|
|
658
|
+
>
|
|
645
659
|
{/if}
|
|
646
660
|
{/each}
|
|
647
661
|
</div>
|