Skip to content

Commit

Permalink
release v2.0.0-alpha.10
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinVandy committed Jan 9, 2024
1 parent 8a0438c commit d59f3d1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion apps/mantine-react-table-docs/styles/ThemeContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const ThemeContextProvider = ({ children }) => {

useEffect(() => {
if (typeof window !== 'undefined') {
localStorage.setItem('isLightTheme', darkDark.toString());
localStorage.setItem('darkDark', darkDark.toString());
}
}, [darkDark]);

Expand Down
2 changes: 1 addition & 1 deletion packages/mantine-react-table/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.0.0-alpha.9",
"version": "2.0.0-alpha.10",
"license": "MIT",
"name": "mantine-react-table",
"description": "A fully featured Mantine implementation of TanStack React Table V8, written from the ground up in TypeScript.",
Expand Down
40 changes: 21 additions & 19 deletions packages/mantine-react-table/src/head/MRT_TableHeadCell.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { type ReactNode, useMemo, type CSSProperties } from 'react';
import { Box, Flex } from '@mantine/core';
import {
type ReactNode,
useMemo,
type CSSProperties,
type DragEventHandler,
} from 'react';
import { Flex, TableTh } from '@mantine/core';
import { MRT_ColumnActionMenu } from '../menus/MRT_ColumnActionMenu';
import { MRT_TableHeadCellFilterContainer } from './MRT_TableHeadCellFilterContainer';
import { MRT_TableHeadCellFilterLabel } from './MRT_TableHeadCellFilterLabel';
Expand Down Expand Up @@ -94,6 +99,17 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
return pl;
}, [showColumnActions, showDragHandle]);

const handleDragEnter: DragEventHandler<HTMLTableCellElement> = (_e) => {
if (enableGrouping && hoveredColumn?.id === 'drop-zone') {
setHoveredColumn(null);
}
if (enableColumnOrdering && draggingColumn && columnDefType !== 'group') {
setHoveredColumn(
columnDef.enableColumnOrdering !== false ? column : null,
);
}
};

const headerElement =
columnDef?.Header instanceof Function
? columnDef?.Header?.({
Expand All @@ -104,25 +120,11 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
: columnDef?.Header ?? (columnDef.header as ReactNode);

return (
<Box
<TableTh
{...tableCellProps}
component="th"
align={columnDefType === 'group' ? 'center' : 'left'}
colSpan={header.colSpan}
onDragEnter={() => {
if (enableGrouping && hoveredColumn?.id === 'drop-zone') {
setHoveredColumn(null);
}
if (
enableColumnOrdering &&
draggingColumn &&
columnDefType !== 'group'
) {
setHoveredColumn(
columnDef.enableColumnOrdering !== false ? column : null,
);
}
}}
onDragEnter={handleDragEnter}
ref={(node: HTMLTableCellElement) => {
if (node) {
tableHeadCellRefs.current[column.id] = node;
Expand Down Expand Up @@ -248,6 +250,6 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
{columnFilterDisplayMode === 'subheader' && column.getCanFilter() && (
<MRT_TableHeadCellFilterContainer header={header} table={table} />
)}
</Box>
</TableTh>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
&.layout-mode-grid {
display: flex;
}
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

.sticky {
Expand Down

0 comments on commit d59f3d1

Please sign in to comment.