trotl-table 1.0.29 → 1.0.30
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/index.cjs.js +8 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +9 -20
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -9802,30 +9802,19 @@ function TableInner({
|
|
|
9802
9802
|
const editCallbackRef = React.useRef(editCallback);
|
|
9803
9803
|
const deleteCallbackRef = React.useRef(deleteCallback);
|
|
9804
9804
|
|
|
9805
|
-
// Update refs when callbacks change
|
|
9806
|
-
React.
|
|
9805
|
+
// Update refs when callbacks change (using useLayoutEffect to update before render)
|
|
9806
|
+
React.useLayoutEffect(() => {
|
|
9807
9807
|
selectedRowsCallbackRef.current = selectedRowsCallback;
|
|
9808
|
-
}, [selectedRowsCallback]);
|
|
9809
|
-
React.useEffect(() => {
|
|
9810
9808
|
refreshTriggerRef.current = refreshTrigger;
|
|
9811
|
-
}, [refreshTrigger]);
|
|
9812
|
-
React.useEffect(() => {
|
|
9813
9809
|
viewCallbackRef.current = viewCallback;
|
|
9814
|
-
}, [viewCallback]);
|
|
9815
|
-
React.useEffect(() => {
|
|
9816
9810
|
editCallbackRef.current = editCallback;
|
|
9817
|
-
}, [editCallback]);
|
|
9818
|
-
React.useEffect(() => {
|
|
9819
9811
|
deleteCallbackRef.current = deleteCallback;
|
|
9820
|
-
}
|
|
9812
|
+
});
|
|
9821
9813
|
|
|
9822
9814
|
// Local selection & sorting state (removed TableContext dependency)
|
|
9823
9815
|
const [selectedRows, setSelectedRows] = React.useState([]);
|
|
9824
9816
|
const [sorting, setSorting] = React.useState(null);
|
|
9825
9817
|
|
|
9826
|
-
// Memoize columns to prevent filter dependency issues
|
|
9827
|
-
const memoizedColumns = React.useMemo(() => columns, [JSON.stringify(columns)]);
|
|
9828
|
-
|
|
9829
9818
|
// Option to read search param from URL
|
|
9830
9819
|
const [searchTerm, setSearchTerm] = React.useState(extraSearchTerm);
|
|
9831
9820
|
// Track current URL search so date filters rerun when params change
|
|
@@ -9936,9 +9925,9 @@ function TableInner({
|
|
|
9936
9925
|
const filterRows = React.useCallback(rows => {
|
|
9937
9926
|
// Check for date-related URL params first
|
|
9938
9927
|
const urlParams = new URLSearchParams(urlSearchString);
|
|
9939
|
-
const
|
|
9928
|
+
const _dateParams = ['startDate', 'endDate', 'date'];
|
|
9940
9929
|
let dateFiltered = rows;
|
|
9941
|
-
for (const paramKey of
|
|
9930
|
+
for (const paramKey of _dateParams) {
|
|
9942
9931
|
const paramValue = urlParams.get(paramKey);
|
|
9943
9932
|
if (!paramValue) continue;
|
|
9944
9933
|
|
|
@@ -9977,12 +9966,12 @@ function TableInner({
|
|
|
9977
9966
|
// Then apply text search filter
|
|
9978
9967
|
if (!searchTerm) return dateFiltered;
|
|
9979
9968
|
const query = searchTerm.toLowerCase();
|
|
9980
|
-
return dateFiltered.filter(row =>
|
|
9969
|
+
return dateFiltered.filter(row => columns.some(col => {
|
|
9981
9970
|
const val = row[col.accessor];
|
|
9982
9971
|
if (val == null) return false;
|
|
9983
9972
|
return String(val).toLowerCase().includes(query);
|
|
9984
9973
|
}));
|
|
9985
|
-
}, [searchTerm,
|
|
9974
|
+
}, [searchTerm, columns, urlSearchString]);
|
|
9986
9975
|
|
|
9987
9976
|
// Natural-ish comparator: handles nulls, numbers, strings, ISO dates
|
|
9988
9977
|
const compare = (x, y, dir = "asc") => {
|
|
@@ -10519,7 +10508,7 @@ function TableInner({
|
|
|
10519
10508
|
}, content);
|
|
10520
10509
|
}
|
|
10521
10510
|
return content;
|
|
10522
|
-
}, [tableDataFlat,
|
|
10511
|
+
}, [tableDataFlat, columns, selectedRows, toggleRowSelection, groupRowsById, renderCell, showActions, showDelete, showEdit, showKey, showView, translate, enableDragRow, moveRow, enableMultiSelect, rowHeight, tableId, customColumns]);
|
|
10523
10512
|
const rowHeightGetter = ({
|
|
10524
10513
|
index
|
|
10525
10514
|
}) => tableDataFlat[index]?.type === "group" ? groupHeaderHeight : rowHeight;
|