UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

58 lines (57 loc) 2.27 kB
/** * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import { type ColumnDef, type Header as HeaderType, type RowData, type Table } from '@tanstack/react-table'; /** * Modified from here: https://gist.github.com/kottenator/9d936eb3e4e3c3e02598 * * @param current Current Index * @param max Max Index * @returns */ export declare const userFriendlyPagination: (current: number, max: number) => (string | number)[]; /** * Simple helper to generate inline grid style * to be responsive. * * Secret sauce: * The last element takes an "auto" width, so it will * fill the available space, and the result till be for 4 columns: * minmax(min column1Sizepx,column1Sizepx) minmax(min column2Sizepx,column2Sizepx) ... minmax(columnNSizepx, auto) */ export declare const gridGenerator: <T extends RowData>(table: Table<T>) => string; /** * Check if the column is size constrained, * so we can let the column's width grow with `flex-grow: 1` * @param columnDef */ export declare const isSizeConstrained: <T extends RowData>(columnDef: ColumnDef<T>) => boolean; export declare enum ResizeDirection { LEFT = "left", RIGHT = "right" } /** * Function to resize the column * @param direction direction to resize * @param header the header cell that is being resized */ export declare const resizeColumn: <T extends RowData>(direction: ResizeDirection, header: HeaderType<T, unknown>) => void; export declare const ACTION_CELL_SIZE = 40; export declare const updateColumnWidths: <T extends RowData>(table: Table<T>, totalWidth: number) => void;