@bigbinary/neeto-atoms 1.0.35 → 1.0.36
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/{DataTable-ZLvVywpD.js → DataTable-BpMBsz5i.js} +13 -4
- package/dist/DataTable-BpMBsz5i.js.map +1 -0
- package/dist/cjs/{DataTable-Dg0pX7Ng.js → DataTable-BynOh4Bs.js} +13 -4
- package/dist/cjs/DataTable-BynOh4Bs.js.map +1 -0
- package/dist/cjs/components/DataTable.js +1 -1
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/components/DataTable/DataTable.d.ts +1 -1
- package/dist/components/DataTable/hooks/useTableSort.d.ts +6 -1
- package/dist/components/DataTable/index.d.ts +1 -0
- package/dist/components/DataTable/types.d.ts +2 -0
- package/dist/components/DataTable.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/DataTable-ZLvVywpD.js.map +0 -1
- package/dist/cjs/DataTable-Dg0pX7Ng.js.map +0 -1
|
@@ -3265,7 +3265,7 @@ const getPageNumbers = (current, total) => {
|
|
|
3265
3265
|
return pages;
|
|
3266
3266
|
};
|
|
3267
3267
|
|
|
3268
|
-
const useTableSort = ({ sorting: controlledSorting, onSortingChange: controlledOnSortingChange, enableURLSort = true, }) => {
|
|
3268
|
+
const useTableSort = ({ sorting: controlledSorting, onSortingChange: controlledOnSortingChange, onSort, enableURLSort = true, }) => {
|
|
3269
3269
|
const isControlled = controlledSorting !== undefined;
|
|
3270
3270
|
const [internalSorting, setInternalSorting] = React.useState(() => enableURLSort ? readSortFromURL() : []);
|
|
3271
3271
|
const sorting = isControlled ? controlledSorting : internalSorting;
|
|
@@ -3277,10 +3277,18 @@ const useTableSort = ({ sorting: controlledSorting, onSortingChange: controlledO
|
|
|
3277
3277
|
setInternalSorting(newSorting);
|
|
3278
3278
|
}
|
|
3279
3279
|
controlledOnSortingChange?.(updaterOrValue);
|
|
3280
|
+
if (onSort) {
|
|
3281
|
+
onSort(newSorting.length > 0
|
|
3282
|
+
? {
|
|
3283
|
+
field: newSorting[0].id,
|
|
3284
|
+
order: newSorting[0].desc ? "descend" : "ascend",
|
|
3285
|
+
}
|
|
3286
|
+
: null);
|
|
3287
|
+
}
|
|
3280
3288
|
if (enableURLSort) {
|
|
3281
3289
|
writeSortToURL(newSorting);
|
|
3282
3290
|
}
|
|
3283
|
-
}, [sorting, isControlled, controlledOnSortingChange, enableURLSort]);
|
|
3291
|
+
}, [sorting, isControlled, controlledOnSortingChange, onSort, enableURLSort]);
|
|
3284
3292
|
React.useEffect(() => {
|
|
3285
3293
|
if (enableURLSort && !isControlled) {
|
|
3286
3294
|
const urlSorting = readSortFromURL();
|
|
@@ -3612,12 +3620,13 @@ const HeaderCellMenu = ({ column, enableAddColumn, enableColumnFreeze, isColumnP
|
|
|
3612
3620
|
}) }))] })] }) }));
|
|
3613
3621
|
};
|
|
3614
3622
|
|
|
3615
|
-
const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp, onSortingChange: onSortingChangeProp, enableSorting = false, enableURLSort = true, totalCount, pageSize = DEFAULT_PAGE_SIZE, currentPage: currentPageProp, onPageChange: onPageChangeProp, enableURLPagination = true, enableRowSelection: enableRowSelectionProp, selectedRowKeys, onRowSelect, bulkSelectAllRowsProps, enableColumnResize = true, enableColumnFreeze = true, columnPinning: columnPinningProp, onColumnPinningChange: onColumnPinningChangeProp, localStorageKeyPrefix, columnVisibility: columnVisibilityProp, onColumnVisibilityChange: onColumnVisibilityChangeProp, onColumnHide: onColumnHideProp, enableColumnReorder = false, columnOrder: columnOrderProp, onColumnOrderChange: onColumnOrderChangeProp, enableAddColumn = false, onColumnAdd, onColumnDelete, onColumnUpdate, onMoreActionClick, enableHeaderMenu, loading = false, bordered = true, className, emptyMessage, onRowClick, allowRowClick = true, }) => {
|
|
3623
|
+
const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp, onSortingChange: onSortingChangeProp, onSort: onSortProp, enableSorting = false, enableURLSort = true, totalCount, pageSize = DEFAULT_PAGE_SIZE, currentPage: currentPageProp, onPageChange: onPageChangeProp, enableURLPagination = true, enableRowSelection: enableRowSelectionProp, selectedRowKeys, onRowSelect, bulkSelectAllRowsProps, enableColumnResize = true, enableColumnFreeze = true, columnPinning: columnPinningProp, onColumnPinningChange: onColumnPinningChangeProp, localStorageKeyPrefix, columnVisibility: columnVisibilityProp, onColumnVisibilityChange: onColumnVisibilityChangeProp, onColumnHide: onColumnHideProp, enableColumnReorder = false, columnOrder: columnOrderProp, onColumnOrderChange: onColumnOrderChangeProp, enableAddColumn = false, onColumnAdd, onColumnDelete, onColumnUpdate, onMoreActionClick, enableHeaderMenu, loading = false, bordered = true, className, emptyMessage, onRowClick, allowRowClick = true, }) => {
|
|
3616
3624
|
const getRowId = React.useMemo(() => getRowIdProp ??
|
|
3617
3625
|
((row) => row.id), [getRowIdProp]);
|
|
3618
3626
|
const { sorting, onSortingChange } = useTableSort({
|
|
3619
3627
|
sorting: sortingProp,
|
|
3620
3628
|
onSortingChange: onSortingChangeProp,
|
|
3629
|
+
onSort: onSortProp,
|
|
3621
3630
|
enableURLSort,
|
|
3622
3631
|
});
|
|
3623
3632
|
const { currentPage, pageCount, paginationState, onPageChange } = useTablePagination({
|
|
@@ -3853,4 +3862,4 @@ exports.useColumnVisibility = useColumnVisibility;
|
|
|
3853
3862
|
exports.useTablePagination = useTablePagination;
|
|
3854
3863
|
exports.useTableSelection = useTableSelection;
|
|
3855
3864
|
exports.useTableSort = useTableSort;
|
|
3856
|
-
//# sourceMappingURL=DataTable-
|
|
3865
|
+
//# sourceMappingURL=DataTable-BynOh4Bs.js.map
|