@makolabs/ripple 0.0.4 → 0.0.6
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.
|
@@ -378,6 +378,27 @@
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
+
// Effect to update the Table component's selection state when selectedFiles changes
|
|
382
|
+
// $effect(() => {
|
|
383
|
+
// if (displayFiles.length === 0) return;
|
|
384
|
+
|
|
385
|
+
// // Get all files that should be selected based on our current selection state
|
|
386
|
+
// const filesToSelect = displayFiles.filter((file) => isRowSelected(file));
|
|
387
|
+
|
|
388
|
+
// // We need to update the Table's internal selection state without triggering additional updates
|
|
389
|
+
// // This ensures the UI is properly updated
|
|
390
|
+
// if (
|
|
391
|
+
// JSON.stringify(selected.map((f) => f.key).sort()) !==
|
|
392
|
+
// JSON.stringify(filesToSelect.map((f) => f.key).sort())
|
|
393
|
+
// ) {
|
|
394
|
+
// // Only update if the selection has actually changed
|
|
395
|
+
// selected = filesToSelect;
|
|
396
|
+
// }
|
|
397
|
+
// });
|
|
398
|
+
|
|
399
|
+
// Track the selected items for the Table component's internal state
|
|
400
|
+
let selected = $state<FileItem[]>([]);
|
|
401
|
+
|
|
381
402
|
// Derived: all files to import (not folders), including recursively fetched
|
|
382
403
|
const allFilesAcquired = $derived.by(() => {
|
|
383
404
|
const selectedFileKeys = new Set(selectedFiles);
|
|
@@ -417,51 +438,17 @@
|
|
|
417
438
|
// Get keys from allowed selected items
|
|
418
439
|
const newSelectedKeys = allowedItems.map((item) => item.key);
|
|
419
440
|
|
|
420
|
-
//
|
|
421
|
-
|
|
422
|
-
const sortedNewKeys = [...newSelectedKeys].sort();
|
|
423
|
-
|
|
424
|
-
if (JSON.stringify(currentKeys) !== JSON.stringify(sortedNewKeys)) {
|
|
425
|
-
// Update the global selection state with only allowed items
|
|
426
|
-
handleSelectByKeys(newSelectedKeys, allowedItems);
|
|
427
|
-
}
|
|
441
|
+
// Update the global selection state with only allowed items
|
|
442
|
+
handleSelectByKeys(newSelectedKeys, allowedItems);
|
|
428
443
|
}
|
|
429
444
|
|
|
430
|
-
// Track the selected items for the Table component's internal state
|
|
431
|
-
let selected = $state<FileItem[]>([]);
|
|
432
|
-
|
|
433
|
-
// Effect to update the Table component's selection state when selectedFiles changes
|
|
434
|
-
$effect(() => {
|
|
435
|
-
if (displayFiles.length === 0) return;
|
|
436
|
-
|
|
437
|
-
// Get all files that should be selected based on our current selection state
|
|
438
|
-
const filesToSelect = displayFiles.filter((file) => isRowSelected(file));
|
|
439
|
-
|
|
440
|
-
// We need to update the Table's internal selection state without triggering additional updates
|
|
441
|
-
// This ensures the UI is properly updated
|
|
442
|
-
if (
|
|
443
|
-
JSON.stringify(selected.map((f) => f.key).sort()) !==
|
|
444
|
-
JSON.stringify(filesToSelect.map((f) => f.key).sort())
|
|
445
|
-
) {
|
|
446
|
-
// Only update if the selection has actually changed
|
|
447
|
-
selected = filesToSelect;
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
|
|
451
445
|
// Handle selection based on keys to avoid redundant code
|
|
452
446
|
function handleSelectByKeys(keys: string[], items: FileItem[] = []) {
|
|
453
447
|
// Get folder items from the selection
|
|
454
448
|
const folderItems = items.filter((item) => item.isFolder);
|
|
455
449
|
|
|
456
|
-
//
|
|
457
|
-
|
|
458
|
-
const currentKeys = [...selectedFiles].sort();
|
|
459
|
-
const newKeys = [...keys].sort();
|
|
460
|
-
|
|
461
|
-
if (JSON.stringify(currentKeys) !== JSON.stringify(newKeys)) {
|
|
462
|
-
// Update the selectedFiles array only if there's a real change
|
|
463
|
-
selectedFiles = keys;
|
|
464
|
-
}
|
|
450
|
+
// Update the selectedFiles array
|
|
451
|
+
selectedFiles = keys;
|
|
465
452
|
|
|
466
453
|
// Process any newly selected folders recursively to get their contents
|
|
467
454
|
const newFolders = folderItems.filter((folder) => !processedFolders.has(folder.key));
|