Skip to content

Commit 2d198b2

Browse files
authored
Merge pull request #638 from icflorescu/next
Fix #627, #614
2 parents 098d257 + 2b14bba commit 2d198b2

File tree

6 files changed

+19
-15
lines changed

6 files changed

+19
-15
lines changed

.github/workflows/publish-and-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Setup Node.js
3030
uses: actions/setup-node@v4
3131
with:
32-
node-version: '22.8'
32+
node-version: '22.6'
3333
cache: yarn
3434
- name: Restore cache
3535
uses: actions/cache@v4

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
The following is a list of notable changes to the Mantine DataTable component.
44
Minor versions that are not listed in the changelog are bug fixes and small improvements.
55

6+
## 7.12.4 (2024-09-04)
7+
8+
- Fix [#627](https://github.com/icflorescu/mantine-datatable/issues/627)
9+
- Fix [#614](https://github.com/icflorescu/mantine-datatable/issues/614)
10+
611
## 7.12.3 (2024-09-04)
712

813
- Fix [#625](https://github.com/icflorescu/mantine-datatable/issues/625) - after implementing row dragging support, inputs inside columns were losing focus

app/examples/column-dragging-and-toggling/DynamicColumnExample.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
import { Button, Group, Stack, Text } from '@mantine/core';
44
import { IconBuildingCommunity, IconBuildingSkyscraper, IconMap, IconRoadSign } from '@tabler/icons-react';
5-
import { DataTable, useDataTableColumns } from '__PACKAGE__';
5+
import { DataTable, DataTableColumn, useDataTableColumns } from '__PACKAGE__';
66
import { useState } from 'react';
77
import { companies } from '~/data';
8-
import { DataTableColumn } from '~/dist';
98

109
export default function DynamicColumnExample() {
1110
const key = 'dynamic-column-example';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mantine-datatable",
3-
"version": "7.12.3",
3+
"version": "7.12.4",
44
"description": "The lightweight, dependency-free, dark-theme aware table component for your Mantine UI data-rich applications, featuring asynchronous data loading support, pagination, intuitive Gmail-style additive batch rows selection, column sorting, custom cell data rendering, row expansion, nesting, context menus, and much more",
55
"keywords": [
66
"mantine",

package/DataTablePagination.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,12 @@ export const DataTablePagination = forwardRef(function DataTablePagination(
5050
ref: ForwardedRef<HTMLDivElement>
5151
) {
5252
let paginationTextValue: React.ReactNode;
53-
if (fetching) {
54-
paginationTextValue = loadingText;
55-
} else if (!totalRecords) {
56-
paginationTextValue = noRecordsText;
57-
} else {
58-
const from = (page! - 1) * recordsPerPage! + 1;
59-
const to = from + recordsLength! - 1;
53+
if (totalRecords) {
54+
const from = (page - 1) * recordsPerPage + 1;
55+
const to = from + (recordsLength || 0) - 1;
6056
paginationTextValue = paginationText!({ from, to, totalRecords });
57+
} else {
58+
paginationTextValue = fetching ? loadingText : noRecordsText;
6159
}
6260

6361
const isAbovePaginationWrapBreakpoint = useMediaQueryStringOrFunction(

package/hooks/useDataTableColumns.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,11 @@ export const useDataTableColumns = <T>({
232232
.map((column) => {
233233
return {
234234
...column,
235-
hidden: !columnsToggle.find((toggle) => {
236-
return toggle.accessor === column?.accessor;
237-
})?.toggled,
235+
hidden:
236+
column?.hidden ||
237+
!columnsToggle.find((toggle) => {
238+
return toggle.accessor === column?.accessor;
239+
})?.toggled,
238240
};
239241
}) as DataTableColumn<T>[];
240242

@@ -282,4 +284,4 @@ export const useDataTableColumns = <T>({
282284
setColumnWidth,
283285
resetColumnsWidth,
284286
} as const;
285-
};
287+
};

0 commit comments

Comments
 (0)