Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.
Open
1 change: 1 addition & 0 deletions lib/Table.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface ZebraProps {
export interface TableProps extends ZebraProps {
data?: any[];
isNested?: boolean;
children?: React.ReactNode;
}
export declare class Table extends React.PureComponent<TableProps> {
render(): JSX.Element;
Expand Down
1 change: 1 addition & 0 deletions lib/TableBody.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ZebraProps } from "./Table";
export interface TableBodyProps extends TableRowProps, Pick<ZebraProps, "zebra"> {
data?: any[];
renderTopBorder?: boolean;
children?: React.ReactNode;
}
export declare class TableBody extends React.PureComponent<TableBodyProps> {
render(): JSX.Element[];
Expand Down
1 change: 1 addition & 0 deletions lib/TableCell.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface TableCellProps extends TableBorder {
textAlign?: "left" | "center" | "right";
isHeader?: boolean;
fontSize?: number | string;
children?: React.ReactNode
}
export declare class TableCell extends React.PureComponent<TableCellProps> {
render(): JSX.Element;
Expand Down
1 change: 1 addition & 0 deletions lib/TableRow.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface TableRowProps extends TableBorder {
even?: boolean;
evenRowColor?: string;
oddRowColor?: string;
children?: React.ReactNode
}
export declare class TableRow extends React.PureComponent<Partial<TableBodyProps>> {
render(): JSX.Element;
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./lib/index.js",
"scripts": {
"generate-barrels": "barrelsby -d src --delete -e TableRow.tsx",
"build": "rm -rf ./lib/* && npm run generate-barrels && tsc && npm run build-storybook && npm run build-doco",
"build": "rm -rf ./lib/* && npm run generate-barrels && tsc",
"recompile": "tsc",
"prepublish": "npm run build",
"storybook": "start-storybook -p 6006",
Expand All @@ -15,12 +15,12 @@
"author": "David Kucsai",
"license": "MIT",
"peerDependencies": {
"@react-pdf/renderer": "^1.6.8",
"react": "^16.8.6",
"react-dom": "^16.8.6"
"@react-pdf/renderer": "^3.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@react-pdf/renderer": "^1.6.8",
"@react-pdf/renderer": "^3.3.1",
"@storybook/addon-actions": "^6.4.19",
"@storybook/addon-info": "^5.3.21",
"@storybook/addon-knobs": "^5.3.7",
Expand Down Expand Up @@ -48,9 +48,9 @@
"html-webpack-plugin": "^3.2.0",
"jsdom": "^15.1.1",
"mini-css-extract-plugin": "^0.7.0",
"react": "^16.8.6",
"react": "^18.2.0",
"@storybook-addons/react-docgen-typescript-loader": "^3.8.0",
"react-dom": "^16.8.6",
"react-dom": "^18.2.0",
"regenerator-runtime": "^0.13.2",
"sinon": "^7.3.2",
"storybook": "^6.4.19",
Expand Down
2 changes: 2 additions & 0 deletions src/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export interface TableProps extends ZebraProps {
* Otherwise assumed to be false.
*/
isNested?: boolean;

children?: React.ReactNode
}

export class Table extends React.PureComponent<TableProps> {
Expand Down
4 changes: 3 additions & 1 deletion src/TableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export interface TableBodyProps extends TableRowProps, Pick<ZebraProps, "zebra">
* Allows control of the very top border of the TableBody to be toggled on and off
* if there is no header.
*/
renderTopBorder?: boolean
renderTopBorder?: boolean;

children?: React.ReactNode;
}

/**
Expand Down
9 changes: 6 additions & 3 deletions src/TableCell.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from "react";
import ReactPDF, {Text, View} from "@react-pdf/renderer";
import {getDefaultBorderIncludes, transformToArray} from "./Utils";
import { Style } from '@react-pdf/types';

/**
* Whether to include borders or not.
Expand Down Expand Up @@ -38,7 +39,7 @@ export interface TableCellProps extends TableBorder {
/**
* Extra styling to apply. These will override existing style with the same key.
*/
style?: ReactPDF.Style | ReactPDF.Style[];
style?: Style | Style[];

/**
* How to align the text
Expand All @@ -54,6 +55,8 @@ export interface TableCellProps extends TableBorder {
* The font-size to apply to the cell.
*/
fontSize?: number | string;

children?: React.ReactNode;
}

/**
Expand All @@ -76,7 +79,7 @@ export class TableCell extends React.PureComponent<TableCellProps> {
}

const {includeRightBorder} = getDefaultBorderIncludes(this.props);
const defaultStyle: ReactPDF.Style = {
const defaultStyle: Style = {
flex: this.props.weighting ?? 1,
// @ts-ignore
justifyContent: "stretch",
Expand All @@ -87,7 +90,7 @@ export class TableCell extends React.PureComponent<TableCellProps> {
whiteSpace: "pre-wrap"
};

const mergedStyles: ReactPDF.Style[] = [
const mergedStyles: Style[] = [
defaultStyle,
...transformToArray(this.props.style)
];
Expand Down
2 changes: 2 additions & 0 deletions src/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export interface TableRowProps extends TableBorder {
* Specify the color of odd rows
*/
oddRowColor?: string;

children?: React.ReactNode;
}

/**
Expand Down