@bigbinary/neeto-atoms 1.0.25 → 1.0.26
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-Dre7vc3w.js → DataTable-DYam_kUE.js} +48 -11
- package/dist/{DataTable-Dre7vc3w.js.map → DataTable-DYam_kUE.js.map} +1 -1
- package/dist/cjs/{DataTable-Cw0ly-hT.js → DataTable-BBxgDBnO.js} +48 -11
- package/dist/cjs/{DataTable-Cw0ly-hT.js.map → DataTable-BBxgDBnO.js.map} +1 -1
- 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/components/BulkSelectCallout.d.ts +3 -1
- 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
|
@@ -3555,11 +3555,11 @@ const ResizeHandle = ({ header }) => {
|
|
|
3555
3555
|
: "bg-border opacity-0 group-hover/head:opacity-100") }));
|
|
3556
3556
|
};
|
|
3557
3557
|
|
|
3558
|
-
const BulkSelectCallout = ({ bulkSelectAllRowsProps, isAllPageRowsSelected, isBulkAllSelected, }) => {
|
|
3559
|
-
if (!isAllPageRowsSelected)
|
|
3558
|
+
const BulkSelectCallout = ({ bulkSelectAllRowsProps, isAllPageRowsSelected, isBulkAllSelected, onBulkSelectAll, onClearBulkSelection, }) => {
|
|
3559
|
+
if (!isAllPageRowsSelected && !isBulkAllSelected)
|
|
3560
3560
|
return null;
|
|
3561
|
-
const { selectAllRowMessage, selectAllRowButtonLabel,
|
|
3562
|
-
return (jsxRuntime.jsx("div", { className: "mb-2 flex items-center justify-center gap-1 rounded-lg bg-primary/10 px-4 py-1.5 text-sm text-primary", children: isBulkAllSelected ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { children: allRowsSelectedMessage ?? selectAllRowMessage }),
|
|
3561
|
+
const { selectAllRowMessage, selectAllRowButtonLabel, allRowsSelectedMessage, clearSelectionButtonLabel, } = bulkSelectAllRowsProps;
|
|
3562
|
+
return (jsxRuntime.jsx("div", { className: "mb-2 flex items-center justify-center gap-1 rounded-lg bg-primary/10 px-4 py-1.5 text-sm text-primary", children: isBulkAllSelected ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { children: allRowsSelectedMessage ?? selectAllRowMessage }), jsxRuntime.jsx(primitives_Button.Button, { variant: "link", onClick: onClearBulkSelection, children: clearSelectionButtonLabel ?? "Clear selection" })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { children: selectAllRowMessage }), jsxRuntime.jsx(primitives_Button.Button, { variant: "link", onClick: onBulkSelectAll, children: selectAllRowButtonLabel })] })) }));
|
|
3563
3563
|
};
|
|
3564
3564
|
|
|
3565
3565
|
const DataTablePagination = ({ currentPage, pageCount, onPageChange, }) => {
|
|
@@ -3607,7 +3607,7 @@ const HeaderCellMenu = ({ column, enableAddColumn, enableColumnFreeze, isColumnP
|
|
|
3607
3607
|
}) }))] })] }) }));
|
|
3608
3608
|
};
|
|
3609
3609
|
|
|
3610
|
-
const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp, onSortingChange: onSortingChangeProp, enableSorting =
|
|
3610
|
+
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, }) => {
|
|
3611
3611
|
const getRowId = React.useMemo(() => getRowIdProp ??
|
|
3612
3612
|
((row) => row.id), [getRowIdProp]);
|
|
3613
3613
|
const { sorting, onSortingChange } = useTableSort({
|
|
@@ -3622,13 +3622,21 @@ const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp
|
|
|
3622
3622
|
onPageChange: onPageChangeProp,
|
|
3623
3623
|
enableURLPagination,
|
|
3624
3624
|
});
|
|
3625
|
-
const { rowSelection, onRowSelectionChange, selectionColumn, enableRowSelection, } = useTableSelection({
|
|
3625
|
+
const { rowSelection, onRowSelectionChange: originalOnRowSelectionChange, selectionColumn, enableRowSelection, } = useTableSelection({
|
|
3626
3626
|
enableRowSelection: enableRowSelectionProp,
|
|
3627
3627
|
selectedRowKeys,
|
|
3628
3628
|
onRowSelect,
|
|
3629
3629
|
data,
|
|
3630
3630
|
getRowId,
|
|
3631
3631
|
});
|
|
3632
|
+
// Wrap selection change to detect manual deselection while in bulk mode
|
|
3633
|
+
const onRowSelectionChange = React.useCallback((updaterOrValue) => {
|
|
3634
|
+
if (bulkSelectedRef.current && !isAutoSelectingRef.current) {
|
|
3635
|
+
setBulkSelectedAllRowsInternal(false);
|
|
3636
|
+
bulkSelectAllRowsProps?.setBulkSelectedAllRows(false);
|
|
3637
|
+
}
|
|
3638
|
+
originalOnRowSelectionChange(updaterOrValue);
|
|
3639
|
+
}, [originalOnRowSelectionChange, bulkSelectAllRowsProps]);
|
|
3632
3640
|
const { columnPinning, onColumnPinningChange, toggleColumnPin, isColumnPinned, } = useColumnPinning({
|
|
3633
3641
|
enabled: enableColumnFreeze,
|
|
3634
3642
|
columnPinning: columnPinningProp,
|
|
@@ -3701,7 +3709,37 @@ const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp
|
|
|
3701
3709
|
onColumnVisibilityChange,
|
|
3702
3710
|
onColumnOrderChange,
|
|
3703
3711
|
});
|
|
3704
|
-
const
|
|
3712
|
+
const [bulkSelectedAllRows, setBulkSelectedAllRowsInternal] = React.useState(false);
|
|
3713
|
+
const isAutoSelectingRef = React.useRef(false);
|
|
3714
|
+
const bulkSelectedRef = React.useRef(false);
|
|
3715
|
+
bulkSelectedRef.current = bulkSelectedAllRows;
|
|
3716
|
+
// Auto-select all page rows when in bulk mode (handles page navigation)
|
|
3717
|
+
React.useEffect(() => {
|
|
3718
|
+
if (bulkSelectedAllRows) {
|
|
3719
|
+
isAutoSelectingRef.current = true;
|
|
3720
|
+
table.toggleAllPageRowsSelected(true);
|
|
3721
|
+
// Reset flag after React processes the state update
|
|
3722
|
+
requestAnimationFrame(() => {
|
|
3723
|
+
isAutoSelectingRef.current = false;
|
|
3724
|
+
});
|
|
3725
|
+
}
|
|
3726
|
+
}, [bulkSelectedAllRows, data]);
|
|
3727
|
+
const isAllPageRowsSelected = table.getIsAllPageRowsSelected();
|
|
3728
|
+
const showSelectAllCallout = !!bulkSelectAllRowsProps &&
|
|
3729
|
+
isAllPageRowsSelected &&
|
|
3730
|
+
pageCount > 1 &&
|
|
3731
|
+
!bulkSelectedAllRows;
|
|
3732
|
+
const showAllSelectedCallout = !!bulkSelectAllRowsProps && bulkSelectedAllRows;
|
|
3733
|
+
const handleBulkSelectAll = () => {
|
|
3734
|
+
setBulkSelectedAllRowsInternal(true);
|
|
3735
|
+
bulkSelectAllRowsProps?.setBulkSelectedAllRows(true);
|
|
3736
|
+
};
|
|
3737
|
+
const handleClearBulkSelection = () => {
|
|
3738
|
+
setBulkSelectedAllRowsInternal(false);
|
|
3739
|
+
bulkSelectAllRowsProps?.setBulkSelectedAllRows(false);
|
|
3740
|
+
table.toggleAllPageRowsSelected(false);
|
|
3741
|
+
onRowSelect?.([], []);
|
|
3742
|
+
};
|
|
3705
3743
|
const handleSort = (columnId, desc) => {
|
|
3706
3744
|
const isSameSort = sorting.length > 0 &&
|
|
3707
3745
|
sorting[0].id === columnId &&
|
|
@@ -3713,8 +3751,7 @@ const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp
|
|
|
3713
3751
|
onSortingChange([{ id: columnId, desc }]);
|
|
3714
3752
|
}
|
|
3715
3753
|
};
|
|
3716
|
-
return (jsxRuntime.jsxs("div", { className: utils.cn("relative flex min-h-0 w-full flex-col", className), children: [loading && jsxRuntime.jsx(LoadingOverlay, {}), bulkSelectAllRowsProps &&
|
|
3717
|
-
(data.length !== totalCount || isBulkAllSelected) && (jsxRuntime.jsx(BulkSelectCallout, { bulkSelectAllRowsProps: bulkSelectAllRowsProps, isAllPageRowsSelected: table.getIsAllPageRowsSelected(), isBulkAllSelected: isBulkAllSelected })), jsxRuntime.jsx("div", { className: utils.cn("min-h-0 flex-1 overflow-auto", bordered && "rounded-lg border"), children: jsxRuntime.jsxs(primitives_Table.Table, { children: [jsxRuntime.jsx(primitives_Table.TableHeader, { className: "sticky top-0 z-20 bg-muted", children: table.getHeaderGroups().map(headerGroup => {
|
|
3754
|
+
return (jsxRuntime.jsxs("div", { className: utils.cn("relative flex min-h-0 w-full flex-col", className), children: [loading && jsxRuntime.jsx(LoadingOverlay, {}), (showSelectAllCallout || showAllSelectedCallout) && (jsxRuntime.jsx(BulkSelectCallout, { bulkSelectAllRowsProps: bulkSelectAllRowsProps, isAllPageRowsSelected: isAllPageRowsSelected, isBulkAllSelected: bulkSelectedAllRows, onBulkSelectAll: handleBulkSelectAll, onClearBulkSelection: handleClearBulkSelection })), jsxRuntime.jsx("div", { className: utils.cn("min-h-0 flex-1 overflow-auto", bordered && "rounded-lg border"), children: jsxRuntime.jsxs(primitives_Table.Table, { children: [jsxRuntime.jsx(primitives_Table.TableHeader, { className: "sticky top-0 z-20 bg-muted", children: table.getHeaderGroups().map(headerGroup => {
|
|
3718
3755
|
const dataHeaders = headerGroup.headers.filter(h => h.column.id !== "_selection");
|
|
3719
3756
|
const totalDataSize = dataHeaders.reduce((sum, h) => sum + h.getSize(), 0);
|
|
3720
3757
|
return (jsxRuntime.jsx(primitives_Table.TableRow, { className: "hover:bg-muted", children: headerGroup.headers.map((header, headerIndex) => {
|
|
@@ -3753,7 +3790,7 @@ const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp
|
|
|
3753
3790
|
const isPinned = cell.column.getIsPinned();
|
|
3754
3791
|
const isSelCell = cell.column.id === "_selection";
|
|
3755
3792
|
return (jsxRuntime.jsx(primitives_Table.TableCell, { className: utils.cn(isPinned &&
|
|
3756
|
-
"sticky z-10 bg-background group-data-[state=selected]:bg-muted"), style: {
|
|
3793
|
+
"sticky z-10 bg-background group-hover:bg-muted/50 group-data-[state=selected]:bg-muted"), style: {
|
|
3757
3794
|
width: selectionColumn && isSelCell
|
|
3758
3795
|
? 0
|
|
3759
3796
|
: cell.column.getSize(),
|
|
@@ -3781,4 +3818,4 @@ exports.useColumnVisibility = useColumnVisibility;
|
|
|
3781
3818
|
exports.useTablePagination = useTablePagination;
|
|
3782
3819
|
exports.useTableSelection = useTableSelection;
|
|
3783
3820
|
exports.useTableSort = useTableSort;
|
|
3784
|
-
//# sourceMappingURL=DataTable-
|
|
3821
|
+
//# sourceMappingURL=DataTable-BBxgDBnO.js.map
|