From 44dd145b85f3de010bf9564da3a92decc2043d51 Mon Sep 17 00:00:00 2001 From: Neo Nie Date: Mon, 17 Aug 2020 23:39:07 +0800 Subject: [PATCH] chore: make Column.key as required (#217) --- CHANGELOG.md | 3 +++ package.json | 2 +- src/Column.js | 4 ++++ types/index.d.ts | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38c3e220..3d871b19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## NEXT VERSION +- fix: add types folder into packages +- chore: mark `Column.key` as required + ## v1.11.0 (2020-08-17) - feat: add `ignoreFunctionInColumnCompare` to solve closure problem in renderers diff --git a/package.json b/package.json index 922080f6..2679e6c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-base-table", - "version": "1.11.1", + "version": "1.11.0", "description": "a react table component to display large data set with high performance and flexibility", "main": "lib/index.js", "module": "es/index.js", diff --git a/src/Column.js b/src/Column.js index 362ad617..539210d0 100644 --- a/src/Column.js +++ b/src/Column.js @@ -20,6 +20,10 @@ export const FrozenDirection = { class Column extends React.Component {} Column.propTypes = { + /** + * Unique key for each column + */ + key: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, /** * Class name for the column cell, could be a callback to return the class name * The callback is of the shape of `({ cellData, columns, column, columnIndex, rowData, rowIndex }) => string` diff --git a/types/index.d.ts b/types/index.d.ts index c6fe3fde..d2b0a2f5 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -12,6 +12,9 @@ declare module 'react-base-table' { export type CallOrReturn = T | (P extends any[] ? (...p: P) => T : (p: P) => T); export interface ColumnShape { + /** + * Unique key for each column + */ key: React.Key; /** * Class name for the column cell