trotl-table 1.0.74 → 1.0.75
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/package.json +1 -1
package/dist/Table.cjs.js
CHANGED
|
@@ -10248,6 +10248,36 @@ function TableInner({
|
|
|
10248
10248
|
}
|
|
10249
10249
|
return map;
|
|
10250
10250
|
}, [sortedGroupedData, groupKey]);
|
|
10251
|
+
const selectedRowsDetails = React.useMemo(() => {
|
|
10252
|
+
const selectedIdSet = new Set(selectedRows);
|
|
10253
|
+
const items = [];
|
|
10254
|
+
if (isGrouped) {
|
|
10255
|
+
for (const g of normalizedGroups) {
|
|
10256
|
+
const groupMeta = {
|
|
10257
|
+
groupId: g.groupId ?? null,
|
|
10258
|
+
groupName: g.groupName ?? null
|
|
10259
|
+
};
|
|
10260
|
+
for (const row of g.rows || []) {
|
|
10261
|
+
if (row && selectedIdSet.has(row.id)) {
|
|
10262
|
+
items.push({
|
|
10263
|
+
row,
|
|
10264
|
+
group: groupMeta
|
|
10265
|
+
});
|
|
10266
|
+
}
|
|
10267
|
+
}
|
|
10268
|
+
}
|
|
10269
|
+
} else {
|
|
10270
|
+
for (const row of Array.isArray(localData) ? localData : []) {
|
|
10271
|
+
if (row && selectedIdSet.has(row.id)) {
|
|
10272
|
+
items.push({
|
|
10273
|
+
row,
|
|
10274
|
+
group: null
|
|
10275
|
+
});
|
|
10276
|
+
}
|
|
10277
|
+
}
|
|
10278
|
+
}
|
|
10279
|
+
return items;
|
|
10280
|
+
}, [selectedRows, isGrouped, normalizedGroups, localData]);
|
|
10251
10281
|
const [tableDataFlat, setTableDataFlat] = React.useState([]);
|
|
10252
10282
|
const flattened = React.useMemo(() => {
|
|
10253
10283
|
const items = [];
|
|
@@ -10328,8 +10358,8 @@ function TableInner({
|
|
|
10328
10358
|
React.useEffect(() => {
|
|
10329
10359
|
// Only call the callback if selectedRows actually changed
|
|
10330
10360
|
// Use the ref to avoid infinite loops from callback changing on every render
|
|
10331
|
-
selectedRowsCallbackRef.current?.(selectedRows);
|
|
10332
|
-
}, [selectedRows]);
|
|
10361
|
+
selectedRowsCallbackRef.current?.(selectedRows, selectedRowsDetails);
|
|
10362
|
+
}, [selectedRows, selectedRowsDetails]);
|
|
10333
10363
|
|
|
10334
10364
|
// DELETE
|
|
10335
10365
|
const [showConfirm, setShowConfirm] = React.useState(false);
|