crap
This commit is contained in:
		@@ -1,18 +1,22 @@
 | 
				
			|||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
  root: true,
 | 
					    root: true,
 | 
				
			||||||
  env: { browser: true, es2020: true },
 | 
					    env: {browser: true, es2020: true},
 | 
				
			||||||
  extends: [
 | 
					    extends: [
 | 
				
			||||||
    'eslint:recommended',
 | 
					        'eslint:recommended',
 | 
				
			||||||
    'plugin:@typescript-eslint/recommended',
 | 
					        'plugin:@typescript-eslint/recommended',
 | 
				
			||||||
    'plugin:react-hooks/recommended',
 | 
					        'plugin:react-hooks/recommended',
 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
  ignorePatterns: ['dist', '.eslintrc.cjs'],
 | 
					 | 
				
			||||||
  parser: '@typescript-eslint/parser',
 | 
					 | 
				
			||||||
  plugins: ['react-refresh'],
 | 
					 | 
				
			||||||
  rules: {
 | 
					 | 
				
			||||||
    'react-refresh/only-export-components': [
 | 
					 | 
				
			||||||
      'warn',
 | 
					 | 
				
			||||||
      { allowConstantExport: true },
 | 
					 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
  },
 | 
					    ignorePatterns: [
 | 
				
			||||||
 | 
					        'dist',
 | 
				
			||||||
 | 
					        '.eslintrc.cjs',
 | 
				
			||||||
 | 
					        'src/components/BaseTable/BaseTable.tsx'
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    parser: '@typescript-eslint/parser',
 | 
				
			||||||
 | 
					    plugins: ['react-refresh'],
 | 
				
			||||||
 | 
					    rules: {
 | 
				
			||||||
 | 
					        'react-refresh/only-export-components': [
 | 
				
			||||||
 | 
					            'warn',
 | 
				
			||||||
 | 
					            {allowConstantExport: true},
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,10 +9,10 @@ import {
 | 
				
			|||||||
import {MRT_Localization_RU} from "mantine-react-table/locales/ru/index.cjs";
 | 
					import {MRT_Localization_RU} from "mantine-react-table/locales/ru/index.cjs";
 | 
				
			||||||
import {forwardRef, useEffect, useImperativeHandle} from 'react';
 | 
					import {forwardRef, useEffect, useImperativeHandle} from 'react';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Props<T extends Record<string, any>, K extends keyof T> = {
 | 
					type Props<T extends Record<string, unknown>, K extends keyof T> = {
 | 
				
			||||||
    data: T[],
 | 
					    data: T[],
 | 
				
			||||||
    onSelectionChange?: (selectedRows: T[]) => void,
 | 
					    onSelectionChange?: (selectedRows: T[]) => void,
 | 
				
			||||||
    columns: MRT_ColumnDef<T>[],
 | 
					    columns: MRT_ColumnDef<T, K>[],
 | 
				
			||||||
    restProps?: MRT_TableOptions<T>,
 | 
					    restProps?: MRT_TableOptions<T>,
 | 
				
			||||||
    striped?: boolean
 | 
					    striped?: boolean
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -23,7 +23,9 @@ export type BaseTableRef<T extends MRT_RowData> = {
 | 
				
			|||||||
    getTable: () => MRT_TableInstance<T>;
 | 
					    getTable: () => MRT_TableInstance<T>;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const BaseTable = forwardRef<BaseTableRef<any>, Props<any>>((props, ref) => {
 | 
					// eslint-disable-next-line @typescript-eslint/ban-ts-comment
 | 
				
			||||||
 | 
					// @ts-expect-error
 | 
				
			||||||
 | 
					export const BaseTable = forwardRef<BaseTableRef<never>, Props<never>>((props, ref) => {
 | 
				
			||||||
    const {data, columns, restProps, striped, onSelectionChange} = props;
 | 
					    const {data, columns, restProps, striped, onSelectionChange} = props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const table = useMantineReactTable({
 | 
					    const table = useMantineReactTable({
 | 
				
			||||||
@@ -46,7 +48,7 @@ export const BaseTable = forwardRef<BaseTableRef<any>, Props<any>>((props, ref)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Используем useImperativeHandle для определения, что будет доступно через ref
 | 
					    // Используем useImperativeHandle для определения, что будет доступно через ref
 | 
				
			||||||
    useImperativeHandle(ref, () => ({
 | 
					    useImperativeHandle(ref, () => ({
 | 
				
			||||||
        // Предполагаем, что есть метод getTable в table, который мы хотим выставить
 | 
					        // @ts-ignore
 | 
				
			||||||
        getTable: () => table
 | 
					        getTable: () => table
 | 
				
			||||||
    }));
 | 
					    }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user