@antscorp/antsomi-ui 1.3.5-beta.433 → 1.3.5-beta.434
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.
|
@@ -24,7 +24,7 @@ interface TUseDataTableListing<TTableType = any> {
|
|
|
24
24
|
getFilterMetricList: ReturnType<typeof useGetFilterMetricList>;
|
|
25
25
|
getSearchListing: ReturnType<typeof useGetSearchListing>;
|
|
26
26
|
};
|
|
27
|
-
onChangeSelectedRow: (selectedRowKeys: React.Key[], selectedRows
|
|
27
|
+
onChangeSelectedRow: (selectedRowKeys: React.Key[], selectedRows?: TTableType[]) => void;
|
|
28
28
|
setDatTableListingState: React.Dispatch<React.SetStateAction<TState<TTableType>>>;
|
|
29
29
|
}
|
|
30
30
|
type TState<TTableType = any> = {
|
|
@@ -75,7 +75,7 @@ export function useDataTableListing(props) {
|
|
|
75
75
|
const _f = apiSearch || {}, { url: searchUrl = '', enabled: enabledApiSearch = true } = _f, restOfApiSearchRequest = __rest(_f, ["url", "enabled"]);
|
|
76
76
|
const { filters, selectedFilterId, pagination, selectedRowKeys, searchValue, table, sorter, selectedRow, } = state;
|
|
77
77
|
const { externalFilters, includeDataType = false } = filterProps || {};
|
|
78
|
-
const { sortDirectionKey = 'az' } = tableProps || {};
|
|
78
|
+
const { sortDirectionKey = 'az', mainColumnKey } = tableProps || {};
|
|
79
79
|
const modifyColumnAuth = Object.assign(Object.assign({}, auth), { url: columnUrl });
|
|
80
80
|
const filterAuth = Object.assign(Object.assign({}, auth), { url: filterUrl });
|
|
81
81
|
const listingAuth = Object.assign(Object.assign({}, auth), { url: listingUrl });
|
|
@@ -472,8 +472,13 @@ export function useDataTableListing(props) {
|
|
|
472
472
|
});
|
|
473
473
|
}, [handleUpdatePagination]);
|
|
474
474
|
const onChangeSelectedRow = useCallback((selectedRowKeys, selectedRows) => {
|
|
475
|
-
setState(prev => (Object.assign(Object.assign({}, prev), { selectedRowKeys, selectedRow: {
|
|
476
|
-
|
|
475
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { selectedRowKeys, selectedRow: {
|
|
476
|
+
keys: selectedRowKeys,
|
|
477
|
+
rows: selectedRows ||
|
|
478
|
+
(selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.map(key => tableData === null || tableData === void 0 ? void 0 : tableData.find(row => { var _a; return ((_a = row[mainColumnKey]) === null || _a === void 0 ? void 0 : _a.toString()) === key.toString(); })).filter(Boolean)) ||
|
|
479
|
+
[],
|
|
480
|
+
} })));
|
|
481
|
+
}, [mainColumnKey, tableData]);
|
|
477
482
|
return {
|
|
478
483
|
/* Modify Column */
|
|
479
484
|
modifyColumn: {
|