hi-tm 0.11.8 → 0.11.9
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.
|
@@ -385,54 +385,50 @@ pageIndex = 0, // Default to first page (0-indexed)
|
|
|
385
385
|
// setSelectedRows(updatedSelection);
|
|
386
386
|
// }
|
|
387
387
|
// };
|
|
388
|
-
const [isProcessingSelection, setIsProcessingSelection] = (0, react_2.useState)(false);
|
|
389
388
|
const handleCheckboxChange = (id) => {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
for (const row of rows) {
|
|
395
|
-
if (row.id === targetId)
|
|
396
|
-
return row;
|
|
397
|
-
if (row.hasChildren && row.childRows) {
|
|
398
|
-
const found = findRowById(row.childRows, targetId);
|
|
399
|
-
if (found)
|
|
400
|
-
return found;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
return null;
|
|
404
|
-
};
|
|
405
|
-
const getAllDescendantIds = (row) => {
|
|
406
|
-
let ids = [];
|
|
389
|
+
const findRowById = (rows, targetId) => {
|
|
390
|
+
for (const row of rows) {
|
|
391
|
+
if (row.id === targetId)
|
|
392
|
+
return row;
|
|
407
393
|
if (row.hasChildren && row.childRows) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
394
|
+
const found = findRowById(row.childRows, targetId);
|
|
395
|
+
if (found)
|
|
396
|
+
return found;
|
|
412
397
|
}
|
|
413
|
-
return ids;
|
|
414
|
-
};
|
|
415
|
-
const updatedSelection = [...selectedRows];
|
|
416
|
-
const row = findRowById(rows, id);
|
|
417
|
-
if (!row)
|
|
418
|
-
return;
|
|
419
|
-
const descendantIds = getAllDescendantIds(row);
|
|
420
|
-
if (selectedRows.includes(id)) {
|
|
421
|
-
const idsToRemove = [id, ...descendantIds];
|
|
422
|
-
setSelectedRows(updatedSelection.filter((itemId) => !idsToRemove.includes(itemId)));
|
|
423
398
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
399
|
+
return null;
|
|
400
|
+
};
|
|
401
|
+
const getAllDescendantIds = (row) => {
|
|
402
|
+
let ids = [];
|
|
403
|
+
if (row.hasChildren && row.childRows) {
|
|
404
|
+
for (const child of row.childRows) {
|
|
405
|
+
ids.push(child.id);
|
|
406
|
+
ids = [...ids, ...getAllDescendantIds(child)];
|
|
407
|
+
}
|
|
433
408
|
}
|
|
434
|
-
|
|
435
|
-
}
|
|
409
|
+
return ids;
|
|
410
|
+
};
|
|
411
|
+
const updatedSelection = [...selectedRows];
|
|
412
|
+
const row = findRowById(rows, id);
|
|
413
|
+
if (!row)
|
|
414
|
+
return;
|
|
415
|
+
const descendantIds = getAllDescendantIds(row);
|
|
416
|
+
if (selectedRows.includes(id)) {
|
|
417
|
+
// Remove parent + all descendants
|
|
418
|
+
const idsToRemove = [id, ...descendantIds];
|
|
419
|
+
setSelectedRows(updatedSelection.filter((itemId) => !idsToRemove.includes(itemId)));
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
// Add parent + all descendants
|
|
423
|
+
const idsToAdd = [id, ...descendantIds];
|
|
424
|
+
setSelectedRows([
|
|
425
|
+
...updatedSelection,
|
|
426
|
+
...idsToAdd.filter((i) => !updatedSelection.includes(i)),
|
|
427
|
+
]);
|
|
428
|
+
}
|
|
429
|
+
if (onSelectionChange) {
|
|
430
|
+
onSelectionChange(id);
|
|
431
|
+
}
|
|
436
432
|
};
|
|
437
433
|
// Extract title and subtitle from row data
|
|
438
434
|
const extractCardData = (row) => {
|
|
@@ -546,8 +542,6 @@ pageIndex = 0, // Default to first page (0-indexed)
|
|
|
546
542
|
el.indeterminate = isIndeterminate(row.id);
|
|
547
543
|
}
|
|
548
544
|
} })))),
|
|
549
|
-
isProcessingSelection && (react_1.default.createElement("div", { className: "absolute inset-0 flex items-center justify-center bg-white/50 z-50" },
|
|
550
|
-
react_1.default.createElement(Loader, null))),
|
|
551
545
|
react_1.default.createElement("div", { className: "flex-1 min-w-0" },
|
|
552
546
|
react_1.default.createElement("div", { className: "flex items-start justify-between" },
|
|
553
547
|
react_1.default.createElement("div", { className: "overflow-hidden" },
|