Skip to content

Commit

Permalink
feat: log error on dataIndex repeated
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Sep 2, 2024
1 parent 0e9256b commit 555ffab
Show file tree
Hide file tree
Showing 15 changed files with 499 additions and 511 deletions.
8 changes: 1 addition & 7 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@ import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)

const { defineConfig } = require('@minko-fe/eslint-config')
export default defineConfig([
{
rules: {
'no-empty-pattern': 'off',
},
},
])
export default defineConfig([])
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,27 @@
"react-resizable": "^3.0.5"
},
"devDependencies": {
"@minko-fe/commitlint-config": "^2.1.1",
"@minko-fe/eslint-config": "^3.3.4",
"@minko-fe/commitlint-config": "^2.1.2",
"@minko-fe/eslint-config": "^4.0.0",
"@minko-fe/prettier-config": "^2.2.3",
"@minko-fe/tsconfig": "^2.1.1",
"@testing-library/dom": "^8.20.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.5.2",
"@types/lodash.debounce": "^4.0.9",
"@types/node": "^22.5.1",
"@types/react": "^18.3.4",
"@types/node": "^22.5.2",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@types/react-resizable": "^3.0.8",
"@vitest/ui": "^2.0.5",
"antd": "^5.20.3",
"antd": "^5.20.4",
"autoprefixer": "^10.4.20",
"bumpp": "^9.5.2",
"conventional-changelog-cli": "^5.0.0",
"eslint": "^9.9.1",
"jsdom": "^21.1.2",
"postcss": "^8.4.41",
"postcss": "^8.4.43",
"postcss-import": "^16.1.0",
"postcss-nested": "^6.2.0",
"postcss-simple-vars": "^7.0.1",
Expand Down
11 changes: 11 additions & 0 deletions playground/app/routes/_layout+/$.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useIsomorphicLayoutEffect } from 'ahooks'
import { useNavigate } from 'react-router-dom'

export default function NotFound() {
const navigate = useNavigate()
useIsomorphicLayoutEffect(() => {
navigate(`/`, { replace: true })
}, [])

return null
}
File renamed without changes.
File renamed without changes.
96 changes: 96 additions & 0 deletions playground/app/routes/_layout+/fixed/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import type { TableColumnsType } from 'antd'
import { Table } from 'antd'
import React from 'react'
import { type ResizableColumnsType, useAntdResizableHeader } from 'use-antd-resizable-header'
import styles from './index.module.css'

interface DataType {
'key': React.Key
'name': string
'age': number
'address-1': string
'address-2': string
'address-3': string
'address-4': string
'address-5': string
'address-6': string
'address-7': string
'address-8': string
}

const columns: ResizableColumnsType<TableColumnsType<DataType>> = [
{
title: 'Full Name',
width: 100,
dataIndex: 'name',
key: 'name',
fixed: 'left',
},
{
title: 'Age',
width: 100,
dataIndex: 'age',
key: 'age',
fixed: 'left',
sorter: true,
},
{ title: 'Column 1', dataIndex: 'address-1', key: '1', width: 100 },
{ title: 'Column 2', dataIndex: 'address-2', key: '2', width: 50 },
{ title: 'Column 3', dataIndex: 'address-3', key: '3', width: 200 },
{ title: 'Column 4', dataIndex: 'address-4', key: '4', width: 100 },
{ title: 'Column 5', dataIndex: 'address-5', key: '5', width: 100 },
{ title: 'Column 6', dataIndex: 'address-6', key: '6', width: 100 },
{ title: 'Column 7', dataIndex: 'address-7', key: '7', width: 100 },
{ title: 'Column 8', dataIndex: 'address-8', key: '8', width: 100 },
{
title: 'Action',
key: 'operation',
fixed: 'right',
render: () => <a>action</a>,
},
]

const data: DataType[] = [
{
'key': '1',
'name': 'John Brown',
'age': 32,
'address-1': 'New York Park',
'address-2': 'New York Park',
'address-3': 'New York Park',
'address-4': 'New York Park',
'address-5': 'New York Park',
'address-6': 'New York Park',
'address-7': 'New York Park',
'address-8': 'New York Park',
},
{
'key': '2',
'name': 'Jim Green',
'age': 40,
'address-1': 'London Park',
'address-2': 'London Park',
'address-3': 'London Park',
'address-4': 'London Park',
'address-5': 'London Park',
'address-6': 'London Park',
'address-7': 'London Park',
'address-8': 'London Park',
},
]

export const Component: React.FC = () => {
const { components, resizableColumns, tableWidth } = useAntdResizableHeader({
columns,
})

return (
<Table
className={styles.table}
columns={resizableColumns}
components={components}
dataSource={data}
scroll={{ x: tableWidth }}
/>
)
}
76 changes: 0 additions & 76 deletions playground/app/routes/_layout/fixed/index.tsx

This file was deleted.

Loading

0 comments on commit 555ffab

Please sign in to comment.