Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 361, update deps, changelog, etc. #363

Merged
merged 11 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

# 2.8.0 (2023-07-05)

- Make records selection feature optional for generic usage (see [#361](https://github.com/icflorescu/mantine-datatable/issues/361))

## 2.7.1 (2023-06-29)

- Fix row context menu not showing properly when used on tables inside modals (see [#354](https://github.com/icflorescu/mantine-datatable/issues/354))
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![Downloads][downloads-image]][npm-url]
[![Language][language-image]][repo-url]

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 context menu, row expansion, nesting, and more.
The lightweight, dependency-free, "dark-theme aware" [**table component**](https://icflorescu.github.io/mantine-datatable/) 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 context menu, row expansion, nesting, and more.

[![Mantine DataTable](https://user-images.githubusercontent.com/581999/189911698-369ba48e-65f0-4772-aad3-cb5e6d4cb59d.png)](https://icflorescu.github.io/mantine-datatable/)

Expand All @@ -32,9 +32,11 @@ The lightweight, dependency-free, "dark-theme aware" **table component** for you

## Trusted by the community

[![Who's using Mantine DataTable](https://github.com/icflorescu/mantine-datatable/assets/581999/ae327a7f-4444-4c83-8333-39b024c9810e)](https://icflorescu.github.io/mantine-datatable/)

[Mantine DataTable](https://icflorescu.github.io/mantine-datatable/) is used by developers and startups around the world, including: [exdatis.ai](https://exdatis.ai/), [teachfloor](https://www.teachfloor.com/), [MARKUP](https://www.getmarkup.com/), [BookieBase](https://bookiebase.ie/), [zipline](https://zipline.diced.tech/), [Pachtop](https://github.com/pacholoamit/pachtop), [Ganymede](https://github.com/Zibbp/ganymede), [COH3 Stats](https://coh3stats.com/), [Culver City Rental Registry](https://www.ccrentals.org/) and many more.

If you're using Mantine DataTable in your project, please drop me a line at the email address listed in my [GitHub profile](https://github.com/icflorescu) and I'll be happy to add your project to the list and on the [documentation website](https://icflorescu.github.io/mantine-datatable/).
If you're using [Mantine DataTable](https://icflorescu.github.io/mantine-datatable/) in your project, please drop me a line at the email address listed in my [GitHub profile](https://github.com/icflorescu) and I'll be happy to add your project to the list and on the [documentation website](https://icflorescu.github.io/mantine-datatable/).

## Full documentation and examples

Expand Down
2 changes: 0 additions & 2 deletions docs/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import {
} from '@tabler/icons-react';
import { FC } from 'react';

export const MIXPANEL_PROJECT_TOKEN = '97d21d6a91975d52c246d8a4f0fa18f3';

export const SEO_DEFAULT_TITLE = 'Mantine DataTable';
export const SEO_DEFAULT_DESCRIPTION =
'A fully-featured data-table/data-grid React component for building data-rich applications with Mantine UI';
Expand Down
8 changes: 0 additions & 8 deletions docs/lib/analytics.ts

This file was deleted.

22 changes: 10 additions & 12 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mantine-datatable-docs",
"version": "2.7.2",
"version": "2.8.0",
"description": "Docs website for mantine-datatable; see ../package/package.json for more info",
"private": true,
"scripts": {
Expand All @@ -13,31 +13,29 @@
"@emotion/react": "^11.11.1",
"@emotion/server": "^11.11.0",
"@faker-js/faker": "^8.0.2",
"@formkit/auto-animate": "^1.0.0-beta.6",
"@mantine/core": "^6.0.15",
"@mantine/dates": "^6.0.15",
"@mantine/hooks": "^6.0.15",
"@mantine/modals": "^6.0.15",
"@mantine/next": "^6.0.15",
"@mantine/notifications": "^6.0.15",
"@mantine/prism": "^6.0.15",
"@formkit/auto-animate": "^0.7.0",
"@mantine/core": "^6.0.16",
"@mantine/dates": "^6.0.16",
"@mantine/hooks": "^6.0.16",
"@mantine/modals": "^6.0.16",
"@mantine/next": "^6.0.16",
"@mantine/notifications": "^6.0.16",
"@mantine/prism": "^6.0.16",
"@tabler/icons-react": "^2.23.0",
"@tanstack/react-query": "^4.29.19",
"dayjs": "^1.11.9",
"lodash": "^4.17.21",
"mantine-datatable": "*",
"next": "^13.4.7",
"next": "^13.4.8",
"next-pwa": "^5.6.0",
"next-sitemap": "^4.1.8",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/lodash": "^4.14.195",
"@types/mixpanel-browser": "^2.47.0",
"@types/node": "^20.3.3",
"@types/react": "^18.2.14",
"mixpanel-browser": "^2.47.0",
"typescript": "^5.1.6"
}
}
10 changes: 0 additions & 10 deletions docs/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,13 @@ import { ModalsProvider } from '@mantine/modals';
import { Notifications } from '@mantine/notifications';
import { AppProps } from 'next/app';
import Head from 'next/head';
import { Router } from 'next/router';
import { useEffect } from 'react';
import AppWrapper from '~/components/AppWrapper';
import { SEO_DEFAULT_DESCRIPTION, SEO_DEFAULT_TITLE } from '~/config';
import { logPageView } from '~/lib/analytics';

export default function _App(props: AppProps) {
const { Component, pageProps } = props;

useEffect(() => {
logPageView();
Router.events.on('routeChangeComplete', logPageView);
return () => {
Router.events.off('routeChangeComplete', logPageView);
};
}, []);

const [colorScheme, setColorScheme] = useLocalStorage<ColorScheme>({
key: 'mantine-color-scheme',
defaultValue: 'light',
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mantine-datatable-turborepo",
"version": "2.7.2",
"version": "2.8.0",
"description": "This is a monorepo; see package/package.json for more info",
"private": true,
"workspaces": [
Expand All @@ -27,14 +27,14 @@
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^29.5.2",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"babel-jest": "^29.5.0",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"babel-jest": "^29.6.0",
"eslint": "^8.44.0",
"eslint-config-next": "^13.4.7",
"eslint-config-next": "^13.4.8",
"eslint-config-prettier": "^8.8.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest": "^29.6.0",
"jest-environment-jsdom": "^29.6.0",
"prettier": "^2.8.8",
"turbo": "^1.10.7",
"typescript": "^5.1.6"
Expand Down
14 changes: 8 additions & 6 deletions package/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,13 @@ export default function DataTable<T>({
hasRecordsAndSelectedRecords && selectableRecordIds!.some((id) => selectedRecordIds.includes(id));

const handleHeaderSelectionChange = useCallback(() => {
onSelectedRecordsChange?.(
allSelectableRecordsSelected
? selectedRecords.filter((record) => !selectableRecordIds!.includes(getRecordId(record, idAccessor)))
: uniqBy([...selectedRecords, ...selectableRecords!], (record) => getRecordId(record, idAccessor))
);
if (selectedRecords && onSelectedRecordsChange) {
onSelectedRecordsChange(
allSelectableRecordsSelected
? selectedRecords.filter((record) => !selectableRecordIds!.includes(getRecordId(record, idAccessor)))
: uniqBy([...selectedRecords, ...selectableRecords!], (record) => getRecordId(record, idAccessor))
);
}
}, [
allSelectableRecordsSelected,
idAccessor,
Expand Down Expand Up @@ -390,7 +392,7 @@ export default function DataTable<T>({
}

let handleSelectionChange: ChangeEventHandler<HTMLInputElement> | undefined;
if (onSelectedRecordsChange) {
if (onSelectedRecordsChange && selectedRecords) {
handleSelectionChange = (e) => {
if ((e.nativeEvent as PointerEvent).shiftKey && lastSelectionChangeIndex !== null) {
const targetRecords = records.filter(
Expand Down
22 changes: 9 additions & 13 deletions package/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@ module.exports = {
'\\.tsx$': ['babel-jest', { configFile: './config/babel.config.js' }],
},
setupFilesAfterEnv: ['<rootDir>/config/setupJest.ts'],
modulePathIgnorePatterns: [
'<rootDir>/node_modules/',
],
modulePathIgnorePatterns: ['<rootDir>/node_modules/'],
collectCoverage: true,
collectCoverageFrom: [
'**/*.ts',
'**/*.tsx'
],
collectCoverageFrom: ['**/*.ts', '**/*.tsx'],
coverageThreshold: {
global: { // Always increase, never decrease
branches: 7,
functions: 13,
lines: 14,
statements: 13,
global: {
// Always increase, never decrease
branches: 6,
functions: 10,
lines: 11,
statements: 10,
},
},
coverageReporters: ['json-summary', 'text', 'lcov'],
}
};
6 changes: 3 additions & 3 deletions package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mantine-datatable",
"version": "2.7.2",
"version": "2.8.0",
"description": "The dependency-free datatable component for Mantine UI, featuring asynchronous data loading support, pagination, multple rows selection, column sorting, custom cell data rendering, row context menu, row expansion and more",
"keywords": [
"mantine",
Expand Down Expand Up @@ -56,8 +56,8 @@
"test:watch": "jest --watch"
},
"devDependencies": {
"@mantine/core": "^6.0.15",
"@mantine/hooks": "^6.0.15",
"@mantine/core": "^6.0.16",
"@mantine/hooks": "^6.0.16",
"@tabler/icons-react": "^2.23.0",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
Expand Down
2 changes: 1 addition & 1 deletion package/types/DataTableSelectionProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type DataTableSelectionProps<T> =
/**
* Currently-selected records
*/
selectedRecords: T[];
selectedRecords?: T[];

/**
* Callback fired when selected records change
Expand Down
Loading