mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove getCoreRowModel from the required TableList prop
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
6406ffabfd
commit
442884c5b8
@ -9,7 +9,6 @@ import themeStyles from "./table-theme.module.scss";
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { SearchInput } from "../input";
|
import { SearchInput } from "../input";
|
||||||
import type { TableOptions } from '@tanstack/react-table'
|
import type { TableOptions } from '@tanstack/react-table'
|
||||||
import { getCoreRowModel } from '@tanstack/react-table'
|
|
||||||
|
|
||||||
import { TableList } from "../table-list/table-list";
|
import { TableList } from "../table-list/table-list";
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ export function List<T>({ columns, data, title, filters }: ListProps<T>) {
|
|||||||
<TableList
|
<TableList
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={filteredData}
|
data={filteredData}
|
||||||
getCoreRowModel={getCoreRowModel()}
|
|
||||||
className={themeStyles.tableTheme}
|
className={themeStyles.tableTheme}
|
||||||
/>
|
/>
|
||||||
{filteredData.length == 0 && (
|
{filteredData.length == 0 && (
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { TableOptions, SortingState, Table as TableType } from "@tanstack/react-table";
|
import type { TableOptions, SortingState, Table as TableType, ColumnDef } from "@tanstack/react-table";
|
||||||
import { useReactTable, getCoreRowModel, getSortedRowModel } from "@tanstack/react-table";
|
import { useReactTable, getCoreRowModel, getSortedRowModel } from "@tanstack/react-table";
|
||||||
import React, { HTMLProps, useMemo } from "react";
|
import React, { HTMLProps, useMemo } from "react";
|
||||||
import { createColumnHelper } from "@tanstack/react-table";
|
import { createColumnHelper } from "@tanstack/react-table";
|
||||||
@ -8,10 +8,13 @@ import { withInjectables } from "@ogre-tools/injectable-react";
|
|||||||
import getRandomIdInjectable from "../../../common/utils/get-random-id.injectable";
|
import getRandomIdInjectable from "../../../common/utils/get-random-id.injectable";
|
||||||
import { VirtualTable } from "../table/virtual-table";
|
import { VirtualTable } from "../table/virtual-table";
|
||||||
|
|
||||||
interface TableProps<T> extends TableOptions<T> {
|
interface TableProps<T> {
|
||||||
|
columns: ColumnDef<T, any>[];
|
||||||
|
data: T[];
|
||||||
className?: string;
|
className?: string;
|
||||||
selectable?: boolean;
|
selectable?: boolean;
|
||||||
configurable?: boolean;
|
configurable?: boolean;
|
||||||
|
columnsResizable?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TableList<Data>({
|
export function TableList<Data>({
|
||||||
@ -20,6 +23,7 @@ export function TableList<Data>({
|
|||||||
className,
|
className,
|
||||||
selectable = true,
|
selectable = true,
|
||||||
configurable = true,
|
configurable = true,
|
||||||
|
columnsResizable = true,
|
||||||
}: TableProps<Data>) {
|
}: TableProps<Data>) {
|
||||||
const [sorting, setSorting] = React.useState<SortingState>([])
|
const [sorting, setSorting] = React.useState<SortingState>([])
|
||||||
const tableColumns = useMemo(() => {
|
const tableColumns = useMemo(() => {
|
||||||
@ -77,7 +81,7 @@ export function TableList<Data>({
|
|||||||
},
|
},
|
||||||
onSortingChange: setSorting,
|
onSortingChange: setSorting,
|
||||||
getSortedRowModel: getSortedRowModel(),
|
getSortedRowModel: getSortedRowModel(),
|
||||||
enableColumnResizing: true,
|
enableColumnResizing: columnsResizable,
|
||||||
columnResizeMode: 'onChange',
|
columnResizeMode: 'onChange',
|
||||||
defaultColumn: {
|
defaultColumn: {
|
||||||
size: 100,
|
size: 100,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user