@bigbinary/neeto-atoms 1.0.5 → 1.0.6
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/cjs/index.js +15 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +1 -1
- package/dist/components/DataTable/types.d.ts +0 -5
- package/dist/components/Table.d.ts +2 -2
- package/dist/index.js +15 -20
- package/dist/index.js.map +1 -1
- package/package.json +38 -33
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DataTableProps } from "./types";
|
|
2
|
-
export declare const DataTable: <TData>({ columns, data, getRowId: getRowIdProp, sorting: sortingProp, onSortingChange: onSortingChangeProp, enableSorting, enableURLSort, totalCount, pageSize, currentPage: currentPageProp, onPageChange: onPageChangeProp, enableURLPagination, enableRowSelection: enableRowSelectionProp, selectedRowKeys, onRowSelect, bulkSelectAllRowsProps, enableColumnResize, enableColumnFreeze, columnPinning: columnPinningProp, onColumnPinningChange: onColumnPinningChangeProp, localStorageKeyPrefix, columnVisibility: columnVisibilityProp, onColumnVisibilityChange: onColumnVisibilityChangeProp, onColumnHide: onColumnHideProp, enableColumnReorder, columnOrder: columnOrderProp, onColumnOrderChange: onColumnOrderChangeProp, enableAddColumn, onColumnAdd, onColumnDelete, onColumnUpdate, onMoreActionClick, enableHeaderMenu, loading,
|
|
2
|
+
export declare const DataTable: <TData>({ columns, data, getRowId: getRowIdProp, sorting: sortingProp, onSortingChange: onSortingChangeProp, enableSorting, enableURLSort, totalCount, pageSize, currentPage: currentPageProp, onPageChange: onPageChangeProp, enableURLPagination, enableRowSelection: enableRowSelectionProp, selectedRowKeys, onRowSelect, bulkSelectAllRowsProps, enableColumnResize, enableColumnFreeze, columnPinning: columnPinningProp, onColumnPinningChange: onColumnPinningChangeProp, localStorageKeyPrefix, columnVisibility: columnVisibilityProp, onColumnVisibilityChange: onColumnVisibilityChangeProp, onColumnHide: onColumnHideProp, enableColumnReorder, columnOrder: columnOrderProp, onColumnOrderChange: onColumnOrderChangeProp, enableAddColumn, onColumnAdd, onColumnDelete, onColumnUpdate, onMoreActionClick, enableHeaderMenu, loading, bordered, className, emptyMessage, onRowClick, allowRowClick, }: DataTableProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -56,13 +56,8 @@ export interface DataTableProps<TData> {
|
|
|
56
56
|
onMoreActionClick?: (actionType: string, columnId: string) => void;
|
|
57
57
|
enableHeaderMenu?: boolean;
|
|
58
58
|
loading?: boolean;
|
|
59
|
-
fixedHeight?: boolean;
|
|
60
59
|
bordered?: boolean;
|
|
61
60
|
className?: string;
|
|
62
|
-
scroll?: {
|
|
63
|
-
x?: number | string;
|
|
64
|
-
y?: number | string;
|
|
65
|
-
};
|
|
66
61
|
emptyMessage?: string | React.ReactNode;
|
|
67
62
|
onRowClick?: (event: React.MouseEvent, row: TData, index: number) => void;
|
|
68
63
|
allowRowClick?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
import {
|
|
3
|
-
declare const Table: (props: React.ComponentProps<
|
|
2
|
+
import { TableHeader as ShadcnTableHeader, TableBody as ShadcnTableBody, TableFooter as ShadcnTableFooter, TableHead as ShadcnTableHead, TableRow as ShadcnTableRow, TableCell as ShadcnTableCell, TableCaption as ShadcnTableCaption } from "src/shadcn/components/table";
|
|
3
|
+
declare const Table: ({ className, ...props }: React.ComponentProps<"table">) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const TableHeader: (props: React.ComponentProps<typeof ShadcnTableHeader>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
declare const TableBody: (props: React.ComponentProps<typeof ShadcnTableBody>) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
declare const TableFooter: (props: React.ComponentProps<typeof ShadcnTableFooter>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -59697,9 +59697,6 @@ function useReactTable(options) {
|
|
|
59697
59697
|
return tableRef.current;
|
|
59698
59698
|
}
|
|
59699
59699
|
|
|
59700
|
-
function Table$1({ className, ...props }) {
|
|
59701
|
-
return (jsx("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto", children: jsx("table", { "data-slot": "table", className: cn$1("w-full caption-bottom text-sm", className), ...props }) }));
|
|
59702
|
-
}
|
|
59703
59700
|
function TableHeader$1({ className, ...props }) {
|
|
59704
59701
|
return (jsx("thead", { "data-slot": "table-header", className: cn$1("[&_tr]:border-b", className), ...props }));
|
|
59705
59702
|
}
|
|
@@ -59722,10 +59719,10 @@ function TableCaption$1({ className, ...props }) {
|
|
|
59722
59719
|
return (jsx("caption", { "data-slot": "table-caption", className: cn$1("mt-4 text-sm text-muted-foreground", className), ...props }));
|
|
59723
59720
|
}
|
|
59724
59721
|
|
|
59725
|
-
const Table = (props) => (jsx(
|
|
59726
|
-
const TableHeader = (props) => jsx(TableHeader$1, { ...props });
|
|
59722
|
+
const Table = ({ className, ...props }) => (jsx("div", { "data-slot": "table-container", className: "relative w-full", children: jsx("table", { "data-slot": "table", className: cn$1("w-full caption-bottom text-sm", className), ...props }) }));
|
|
59723
|
+
const TableHeader = (props) => (jsx(TableHeader$1, { ...props }));
|
|
59727
59724
|
const TableBody = (props) => (jsx(TableBody$1, { ...props }));
|
|
59728
|
-
const TableFooter = (props) => jsx(TableFooter$1, { ...props });
|
|
59725
|
+
const TableFooter = (props) => (jsx(TableFooter$1, { ...props }));
|
|
59729
59726
|
const TableHead = (props) => (jsx(TableHead$1, { ...props }));
|
|
59730
59727
|
const TableRow = (props) => (jsx(TableRow$1, { ...props }));
|
|
59731
59728
|
const TableCell = (props) => (jsx(TableCell$1, { ...props }));
|
|
@@ -60126,7 +60123,7 @@ const BulkSelectCallout = ({ bulkSelectAllRowsProps, isAllPageRowsSelected, isBu
|
|
|
60126
60123
|
if (!isAllPageRowsSelected)
|
|
60127
60124
|
return null;
|
|
60128
60125
|
const { selectAllRowMessage, selectAllRowButtonLabel, setBulkSelectedAllRows, allRowsSelectedMessage, clearSelectionButtonLabel, } = bulkSelectAllRowsProps;
|
|
60129
|
-
return (jsx("div", { className: "flex items-center justify-center gap-
|
|
60126
|
+
return (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 ? (jsxs(Fragment, { children: [jsx("span", { children: allRowsSelectedMessage ?? selectAllRowMessage }), clearSelectionButtonLabel && (jsx(Button$1, { variant: "link", onClick: () => setBulkSelectedAllRows(false), children: clearSelectionButtonLabel }))] })) : (jsxs(Fragment, { children: [jsx("span", { children: selectAllRowMessage }), jsx(Button$1, { variant: "link", onClick: () => setBulkSelectedAllRows(true), children: selectAllRowButtonLabel })] })) }));
|
|
60130
60127
|
};
|
|
60131
60128
|
|
|
60132
60129
|
function Pagination$1({ className, ...props }) {
|
|
@@ -60266,7 +60263,7 @@ const HeaderCellMenu = ({ column, enableAddColumn, enableColumnFreeze, isColumnP
|
|
|
60266
60263
|
}) }))] })] }) }));
|
|
60267
60264
|
};
|
|
60268
60265
|
|
|
60269
|
-
const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp, onSortingChange: onSortingChangeProp, enableSorting = true, 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,
|
|
60266
|
+
const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp, onSortingChange: onSortingChangeProp, enableSorting = true, 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, }) => {
|
|
60270
60267
|
const getRowId = useMemo(() => getRowIdProp ??
|
|
60271
60268
|
((row) => row.id), [getRowIdProp]);
|
|
60272
60269
|
const { sorting, onSortingChange } = useTableSort({
|
|
@@ -60325,6 +60322,14 @@ const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp
|
|
|
60325
60322
|
}
|
|
60326
60323
|
return columnOrder;
|
|
60327
60324
|
}, [columnOrder, selectionColumn]);
|
|
60325
|
+
const resolvedColumnPinning = useMemo(() => {
|
|
60326
|
+
if (!selectionColumn || !enableColumnFreeze)
|
|
60327
|
+
return columnPinning;
|
|
60328
|
+
const left = columnPinning.left ?? [];
|
|
60329
|
+
if (left.includes("_selection"))
|
|
60330
|
+
return columnPinning;
|
|
60331
|
+
return { ...columnPinning, left: ["_selection", ...left] };
|
|
60332
|
+
}, [columnPinning, selectionColumn, enableColumnFreeze]);
|
|
60328
60333
|
const table = useReactTable({
|
|
60329
60334
|
data,
|
|
60330
60335
|
columns: allColumns,
|
|
@@ -60336,7 +60341,7 @@ const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp
|
|
|
60336
60341
|
sorting,
|
|
60337
60342
|
pagination: paginationState,
|
|
60338
60343
|
rowSelection,
|
|
60339
|
-
columnPinning,
|
|
60344
|
+
columnPinning: resolvedColumnPinning,
|
|
60340
60345
|
columnVisibility,
|
|
60341
60346
|
columnOrder: resolvedColumnOrder,
|
|
60342
60347
|
},
|
|
@@ -60364,17 +60369,7 @@ const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp
|
|
|
60364
60369
|
onSortingChange([{ id: columnId, desc }]);
|
|
60365
60370
|
}
|
|
60366
60371
|
};
|
|
60367
|
-
|
|
60368
|
-
if (scroll?.x) {
|
|
60369
|
-
scrollStyle.minWidth =
|
|
60370
|
-
typeof scroll.x === "number" ? `${scroll.x}px` : scroll.x;
|
|
60371
|
-
}
|
|
60372
|
-
if (scroll?.y) {
|
|
60373
|
-
scrollStyle.maxHeight =
|
|
60374
|
-
typeof scroll.y === "number" ? `${scroll.y}px` : scroll.y;
|
|
60375
|
-
scrollStyle.overflowY = "auto";
|
|
60376
|
-
}
|
|
60377
|
-
return (jsxs("div", { className: cn$1("relative w-full", fixedHeight && "flex flex-1 flex-col overflow-hidden", className), children: [loading && jsx(LoadingOverlay, {}), bulkSelectAllRowsProps && (jsx(BulkSelectCallout, { bulkSelectAllRowsProps: bulkSelectAllRowsProps, isAllPageRowsSelected: table.getIsAllPageRowsSelected(), isBulkAllSelected: isBulkAllSelected })), jsx("div", { className: cn$1("overflow-auto", fixedHeight && "flex-1", bordered && "overflow-hidden rounded-lg border"), style: scrollStyle, children: jsxs(Table, { style: scroll?.x ? { minWidth: scrollStyle.minWidth } : undefined, children: [jsx(TableHeader, { className: "bg-muted", children: table.getHeaderGroups().map(headerGroup => (jsx(TableRow, { className: "hover:bg-muted", children: headerGroup.headers.map((header, headerIndex) => {
|
|
60372
|
+
return (jsxs("div", { className: cn$1("relative flex min-h-0 w-full flex-col", className), children: [loading && jsx(LoadingOverlay, {}), bulkSelectAllRowsProps && (jsx(BulkSelectCallout, { bulkSelectAllRowsProps: bulkSelectAllRowsProps, isAllPageRowsSelected: table.getIsAllPageRowsSelected(), isBulkAllSelected: isBulkAllSelected })), jsx("div", { className: cn$1("min-h-0 flex-1 overflow-auto", bordered && "rounded-lg border"), children: jsxs(Table, { children: [jsx(TableHeader, { className: "sticky top-0 z-20 bg-muted", children: table.getHeaderGroups().map(headerGroup => (jsx(TableRow, { className: "hover:bg-muted", children: headerGroup.headers.map((header, headerIndex) => {
|
|
60378
60373
|
const isPinned = header.column.getIsPinned();
|
|
60379
60374
|
const isSelectionCol = header.column.id === "_selection";
|
|
60380
60375
|
const visibleHeaders = headerGroup.headers.filter(h => h.column.id !== "_selection");
|