trotl-table 1.0.74 → 1.0.76
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.
- package/dist/Table.cjs.js +32 -2
- package/dist/Table.cjs.js.map +1 -1
- package/dist/Table.esm.js +32 -2
- package/dist/Table.esm.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
package/dist/Table.esm.js
CHANGED
|
@@ -10226,6 +10226,36 @@ function TableInner({
|
|
|
10226
10226
|
}
|
|
10227
10227
|
return map;
|
|
10228
10228
|
}, [sortedGroupedData, groupKey]);
|
|
10229
|
+
const selectedRowsDetails = useMemo(() => {
|
|
10230
|
+
const selectedIdSet = new Set(selectedRows);
|
|
10231
|
+
const items = [];
|
|
10232
|
+
if (isGrouped) {
|
|
10233
|
+
for (const g of normalizedGroups) {
|
|
10234
|
+
const groupMeta = {
|
|
10235
|
+
groupId: g.groupId ?? null,
|
|
10236
|
+
groupName: g.groupName ?? null
|
|
10237
|
+
};
|
|
10238
|
+
for (const row of g.rows || []) {
|
|
10239
|
+
if (row && selectedIdSet.has(row.id)) {
|
|
10240
|
+
items.push({
|
|
10241
|
+
row,
|
|
10242
|
+
group: groupMeta
|
|
10243
|
+
});
|
|
10244
|
+
}
|
|
10245
|
+
}
|
|
10246
|
+
}
|
|
10247
|
+
} else {
|
|
10248
|
+
for (const row of Array.isArray(localData) ? localData : []) {
|
|
10249
|
+
if (row && selectedIdSet.has(row.id)) {
|
|
10250
|
+
items.push({
|
|
10251
|
+
row,
|
|
10252
|
+
group: null
|
|
10253
|
+
});
|
|
10254
|
+
}
|
|
10255
|
+
}
|
|
10256
|
+
}
|
|
10257
|
+
return items;
|
|
10258
|
+
}, [selectedRows, isGrouped, normalizedGroups, localData]);
|
|
10229
10259
|
const [tableDataFlat, setTableDataFlat] = useState([]);
|
|
10230
10260
|
const flattened = useMemo(() => {
|
|
10231
10261
|
const items = [];
|
|
@@ -10306,8 +10336,8 @@ function TableInner({
|
|
|
10306
10336
|
useEffect(() => {
|
|
10307
10337
|
// Only call the callback if selectedRows actually changed
|
|
10308
10338
|
// Use the ref to avoid infinite loops from callback changing on every render
|
|
10309
|
-
selectedRowsCallbackRef.current?.(selectedRows);
|
|
10310
|
-
}, [selectedRows]);
|
|
10339
|
+
selectedRowsCallbackRef.current?.(selectedRows, selectedRowsDetails);
|
|
10340
|
+
}, [selectedRows, selectedRowsDetails]);
|
|
10311
10341
|
|
|
10312
10342
|
// DELETE
|
|
10313
10343
|
const [showConfirm, setShowConfirm] = useState(false);
|