@makolabs/ripple 0.0.3 → 0.0.5
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.
|
@@ -192,6 +192,7 @@
|
|
|
192
192
|
// Retain selected files that are still valid
|
|
193
193
|
// We need to filter out any folder paths that might no longer exist
|
|
194
194
|
selectedFiles = previousSelectedFiles;
|
|
195
|
+
debugger;
|
|
195
196
|
fileQueue = previousFileQueue;
|
|
196
197
|
} catch (err) {
|
|
197
198
|
console.error('Error fetching files:', err);
|
|
@@ -249,6 +250,7 @@
|
|
|
249
250
|
// Update selection
|
|
250
251
|
if (filesToSelect.length > 0) {
|
|
251
252
|
selectedFiles = filesToSelect;
|
|
253
|
+
debugger;
|
|
252
254
|
selected = displayFiles.filter((file) => filesToSelect.includes(file.key));
|
|
253
255
|
}
|
|
254
256
|
|
|
@@ -378,6 +380,27 @@
|
|
|
378
380
|
}
|
|
379
381
|
}
|
|
380
382
|
|
|
383
|
+
// Effect to update the Table component's selection state when selectedFiles changes
|
|
384
|
+
$effect(() => {
|
|
385
|
+
if (displayFiles.length === 0) return;
|
|
386
|
+
|
|
387
|
+
// Get all files that should be selected based on our current selection state
|
|
388
|
+
const filesToSelect = displayFiles.filter((file) => isRowSelected(file));
|
|
389
|
+
|
|
390
|
+
// We need to update the Table's internal selection state without triggering additional updates
|
|
391
|
+
// This ensures the UI is properly updated
|
|
392
|
+
if (
|
|
393
|
+
JSON.stringify(selected.map((f) => f.key).sort()) !==
|
|
394
|
+
JSON.stringify(filesToSelect.map((f) => f.key).sort())
|
|
395
|
+
) {
|
|
396
|
+
// Only update if the selection has actually changed
|
|
397
|
+
selected = filesToSelect;
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
// Track the selected items for the Table component's internal state
|
|
402
|
+
let selected = $state<FileItem[]>([]);
|
|
403
|
+
|
|
381
404
|
// Derived: all files to import (not folders), including recursively fetched
|
|
382
405
|
const allFilesAcquired = $derived.by(() => {
|
|
383
406
|
const selectedFileKeys = new Set(selectedFiles);
|
|
@@ -417,51 +440,17 @@
|
|
|
417
440
|
// Get keys from allowed selected items
|
|
418
441
|
const newSelectedKeys = allowedItems.map((item) => item.key);
|
|
419
442
|
|
|
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
|
-
}
|
|
443
|
+
// Update the global selection state with only allowed items
|
|
444
|
+
handleSelectByKeys(newSelectedKeys, allowedItems);
|
|
428
445
|
}
|
|
429
446
|
|
|
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
447
|
// Handle selection based on keys to avoid redundant code
|
|
452
448
|
function handleSelectByKeys(keys: string[], items: FileItem[] = []) {
|
|
453
449
|
// Get folder items from the selection
|
|
454
450
|
const folderItems = items.filter((item) => item.isFolder);
|
|
455
451
|
|
|
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
|
-
}
|
|
452
|
+
// Update the selectedFiles array
|
|
453
|
+
selectedFiles = keys;
|
|
465
454
|
|
|
466
455
|
// Process any newly selected folders recursively to get their contents
|
|
467
456
|
const newFolders = folderItems.filter((folder) => !processedFolders.has(folder.key));
|