react-datasheet-grid
Advanced tools
Comparing version 1.1.3 to 1.1.4
/// <reference types="react" /> | ||
import { DataSheetGridProps } from '../typings'; | ||
export declare function DataSheetGrid<TRow = any>({ data, onChange, columns: rawColumns, height, rowHeight, headerRowHeight, gutterColumnWidth, createRow, duplicateRow, isRowEmpty, counterComponent, contextMenuComponent, autoAddRow, lockRows, disableContextMenu: disableContextMenuRaw, }: DataSheetGridProps<TRow>): JSX.Element; | ||
export declare function DataSheetGrid<TRow = any>({ data, onChange, columns: rawColumns, height, rowHeight, headerRowHeight, gutterColumnWidth, createRow, duplicateRow, isRowEmpty, counterComponent, contextMenuComponent, autoAddRow, lockRows, disableContextMenu: disableContextMenuRaw, renderGutterColumn, }: DataSheetGridProps<TRow>): JSX.Element; |
@@ -1016,2 +1016,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var DEFAULT_RENDER_GUTTER_COLUMN = function DEFAULT_RENDER_GUTTER_COLUMN(_ref3) { | ||
var rowIndex = _ref3.rowIndex; | ||
return rowIndex + 1; | ||
}; | ||
function setStateDeepEqual(newValue) { | ||
@@ -1024,33 +1029,35 @@ return function (oldValue) { | ||
function DataSheetGrid(_ref3) { | ||
var _ref3$data = _ref3.data, | ||
data = _ref3$data === void 0 ? DEFAULT_DATA : _ref3$data, | ||
_ref3$onChange = _ref3.onChange, | ||
onChange = _ref3$onChange === void 0 ? DEFAULT_ON_CHANGE : _ref3$onChange, | ||
_ref3$columns = _ref3.columns, | ||
rawColumns = _ref3$columns === void 0 ? DEFAULT_COLUMNS : _ref3$columns, | ||
_ref3$height = _ref3.height, | ||
height = _ref3$height === void 0 ? 400 : _ref3$height, | ||
_ref3$rowHeight = _ref3.rowHeight, | ||
rowHeight = _ref3$rowHeight === void 0 ? 40 : _ref3$rowHeight, | ||
_ref3$headerRowHeight = _ref3.headerRowHeight, | ||
headerRowHeight = _ref3$headerRowHeight === void 0 ? rowHeight : _ref3$headerRowHeight, | ||
_ref3$gutterColumnWid = _ref3.gutterColumnWidth, | ||
gutterColumnWidth = _ref3$gutterColumnWid === void 0 ? '0 0 40px' : _ref3$gutterColumnWid, | ||
_ref3$createRow = _ref3.createRow, | ||
createRow = _ref3$createRow === void 0 ? DEFAULT_CREATE_ROW : _ref3$createRow, | ||
_ref3$duplicateRow = _ref3.duplicateRow, | ||
duplicateRow = _ref3$duplicateRow === void 0 ? DEFAULT_DUPLICATE_ROW : _ref3$duplicateRow, | ||
_ref3$isRowEmpty = _ref3.isRowEmpty, | ||
isRowEmpty = _ref3$isRowEmpty === void 0 ? DEFAULT_IS_ROW_EMPTY : _ref3$isRowEmpty, | ||
_ref3$counterComponen = _ref3.counterComponent, | ||
counterComponent = _ref3$counterComponen === void 0 ? AddRowsCounter : _ref3$counterComponen, | ||
_ref3$contextMenuComp = _ref3.contextMenuComponent, | ||
contextMenuComponent = _ref3$contextMenuComp === void 0 ? ContextMenu : _ref3$contextMenuComp, | ||
_ref3$autoAddRow = _ref3.autoAddRow, | ||
autoAddRow = _ref3$autoAddRow === void 0 ? false : _ref3$autoAddRow, | ||
_ref3$lockRows = _ref3.lockRows, | ||
lockRows = _ref3$lockRows === void 0 ? false : _ref3$lockRows, | ||
_ref3$disableContextM = _ref3.disableContextMenu, | ||
disableContextMenuRaw = _ref3$disableContextM === void 0 ? false : _ref3$disableContextM; | ||
function DataSheetGrid(_ref4) { | ||
var _ref4$data = _ref4.data, | ||
data = _ref4$data === void 0 ? DEFAULT_DATA : _ref4$data, | ||
_ref4$onChange = _ref4.onChange, | ||
onChange = _ref4$onChange === void 0 ? DEFAULT_ON_CHANGE : _ref4$onChange, | ||
_ref4$columns = _ref4.columns, | ||
rawColumns = _ref4$columns === void 0 ? DEFAULT_COLUMNS : _ref4$columns, | ||
_ref4$height = _ref4.height, | ||
height = _ref4$height === void 0 ? 400 : _ref4$height, | ||
_ref4$rowHeight = _ref4.rowHeight, | ||
rowHeight = _ref4$rowHeight === void 0 ? 40 : _ref4$rowHeight, | ||
_ref4$headerRowHeight = _ref4.headerRowHeight, | ||
headerRowHeight = _ref4$headerRowHeight === void 0 ? rowHeight : _ref4$headerRowHeight, | ||
_ref4$gutterColumnWid = _ref4.gutterColumnWidth, | ||
gutterColumnWidth = _ref4$gutterColumnWid === void 0 ? '0 0 40px' : _ref4$gutterColumnWid, | ||
_ref4$createRow = _ref4.createRow, | ||
createRow = _ref4$createRow === void 0 ? DEFAULT_CREATE_ROW : _ref4$createRow, | ||
_ref4$duplicateRow = _ref4.duplicateRow, | ||
duplicateRow = _ref4$duplicateRow === void 0 ? DEFAULT_DUPLICATE_ROW : _ref4$duplicateRow, | ||
_ref4$isRowEmpty = _ref4.isRowEmpty, | ||
isRowEmpty = _ref4$isRowEmpty === void 0 ? DEFAULT_IS_ROW_EMPTY : _ref4$isRowEmpty, | ||
_ref4$counterComponen = _ref4.counterComponent, | ||
counterComponent = _ref4$counterComponen === void 0 ? AddRowsCounter : _ref4$counterComponen, | ||
_ref4$contextMenuComp = _ref4.contextMenuComponent, | ||
contextMenuComponent = _ref4$contextMenuComp === void 0 ? ContextMenu : _ref4$contextMenuComp, | ||
_ref4$autoAddRow = _ref4.autoAddRow, | ||
autoAddRow = _ref4$autoAddRow === void 0 ? false : _ref4$autoAddRow, | ||
_ref4$lockRows = _ref4.lockRows, | ||
lockRows = _ref4$lockRows === void 0 ? false : _ref4$lockRows, | ||
_ref4$disableContextM = _ref4.disableContextMenu, | ||
disableContextMenuRaw = _ref4$disableContextM === void 0 ? false : _ref4$disableContextM, | ||
_ref4$renderGutterCol = _ref4.renderGutterColumn, | ||
renderGutterColumn = _ref4$renderGutterCol === void 0 ? DEFAULT_RENDER_GUTTER_COLUMN : _ref4$renderGutterCol; | ||
var disableContextMenu = disableContextMenuRaw || lockRows; | ||
@@ -1064,6 +1071,3 @@ var columns = React.useMemo(function () { | ||
}), | ||
render: function render(_ref4) { | ||
var rowIndex = _ref4.rowIndex; | ||
return rowIndex + 1; | ||
} | ||
render: renderGutterColumn | ||
}].concat(rawColumns).map(function (column) { | ||
@@ -1092,3 +1096,3 @@ return _extends({ | ||
}); | ||
}, [gutterColumnWidth, rawColumns]); | ||
}, [gutterColumnWidth, rawColumns, renderGutterColumn]); | ||
@@ -1095,0 +1099,0 @@ var _useState = React.useState(0), |
@@ -1014,2 +1014,7 @@ import { createElement, useRef, useLayoutEffect, useState, useEffect, Fragment, createContext, memo, useContext, useMemo, forwardRef, useCallback } from 'react'; | ||
var DEFAULT_RENDER_GUTTER_COLUMN = function DEFAULT_RENDER_GUTTER_COLUMN(_ref3) { | ||
var rowIndex = _ref3.rowIndex; | ||
return rowIndex + 1; | ||
}; | ||
function setStateDeepEqual(newValue) { | ||
@@ -1022,33 +1027,35 @@ return function (oldValue) { | ||
function DataSheetGrid(_ref3) { | ||
var _ref3$data = _ref3.data, | ||
data = _ref3$data === void 0 ? DEFAULT_DATA : _ref3$data, | ||
_ref3$onChange = _ref3.onChange, | ||
onChange = _ref3$onChange === void 0 ? DEFAULT_ON_CHANGE : _ref3$onChange, | ||
_ref3$columns = _ref3.columns, | ||
rawColumns = _ref3$columns === void 0 ? DEFAULT_COLUMNS : _ref3$columns, | ||
_ref3$height = _ref3.height, | ||
height = _ref3$height === void 0 ? 400 : _ref3$height, | ||
_ref3$rowHeight = _ref3.rowHeight, | ||
rowHeight = _ref3$rowHeight === void 0 ? 40 : _ref3$rowHeight, | ||
_ref3$headerRowHeight = _ref3.headerRowHeight, | ||
headerRowHeight = _ref3$headerRowHeight === void 0 ? rowHeight : _ref3$headerRowHeight, | ||
_ref3$gutterColumnWid = _ref3.gutterColumnWidth, | ||
gutterColumnWidth = _ref3$gutterColumnWid === void 0 ? '0 0 40px' : _ref3$gutterColumnWid, | ||
_ref3$createRow = _ref3.createRow, | ||
createRow = _ref3$createRow === void 0 ? DEFAULT_CREATE_ROW : _ref3$createRow, | ||
_ref3$duplicateRow = _ref3.duplicateRow, | ||
duplicateRow = _ref3$duplicateRow === void 0 ? DEFAULT_DUPLICATE_ROW : _ref3$duplicateRow, | ||
_ref3$isRowEmpty = _ref3.isRowEmpty, | ||
isRowEmpty = _ref3$isRowEmpty === void 0 ? DEFAULT_IS_ROW_EMPTY : _ref3$isRowEmpty, | ||
_ref3$counterComponen = _ref3.counterComponent, | ||
counterComponent = _ref3$counterComponen === void 0 ? AddRowsCounter : _ref3$counterComponen, | ||
_ref3$contextMenuComp = _ref3.contextMenuComponent, | ||
contextMenuComponent = _ref3$contextMenuComp === void 0 ? ContextMenu : _ref3$contextMenuComp, | ||
_ref3$autoAddRow = _ref3.autoAddRow, | ||
autoAddRow = _ref3$autoAddRow === void 0 ? false : _ref3$autoAddRow, | ||
_ref3$lockRows = _ref3.lockRows, | ||
lockRows = _ref3$lockRows === void 0 ? false : _ref3$lockRows, | ||
_ref3$disableContextM = _ref3.disableContextMenu, | ||
disableContextMenuRaw = _ref3$disableContextM === void 0 ? false : _ref3$disableContextM; | ||
function DataSheetGrid(_ref4) { | ||
var _ref4$data = _ref4.data, | ||
data = _ref4$data === void 0 ? DEFAULT_DATA : _ref4$data, | ||
_ref4$onChange = _ref4.onChange, | ||
onChange = _ref4$onChange === void 0 ? DEFAULT_ON_CHANGE : _ref4$onChange, | ||
_ref4$columns = _ref4.columns, | ||
rawColumns = _ref4$columns === void 0 ? DEFAULT_COLUMNS : _ref4$columns, | ||
_ref4$height = _ref4.height, | ||
height = _ref4$height === void 0 ? 400 : _ref4$height, | ||
_ref4$rowHeight = _ref4.rowHeight, | ||
rowHeight = _ref4$rowHeight === void 0 ? 40 : _ref4$rowHeight, | ||
_ref4$headerRowHeight = _ref4.headerRowHeight, | ||
headerRowHeight = _ref4$headerRowHeight === void 0 ? rowHeight : _ref4$headerRowHeight, | ||
_ref4$gutterColumnWid = _ref4.gutterColumnWidth, | ||
gutterColumnWidth = _ref4$gutterColumnWid === void 0 ? '0 0 40px' : _ref4$gutterColumnWid, | ||
_ref4$createRow = _ref4.createRow, | ||
createRow = _ref4$createRow === void 0 ? DEFAULT_CREATE_ROW : _ref4$createRow, | ||
_ref4$duplicateRow = _ref4.duplicateRow, | ||
duplicateRow = _ref4$duplicateRow === void 0 ? DEFAULT_DUPLICATE_ROW : _ref4$duplicateRow, | ||
_ref4$isRowEmpty = _ref4.isRowEmpty, | ||
isRowEmpty = _ref4$isRowEmpty === void 0 ? DEFAULT_IS_ROW_EMPTY : _ref4$isRowEmpty, | ||
_ref4$counterComponen = _ref4.counterComponent, | ||
counterComponent = _ref4$counterComponen === void 0 ? AddRowsCounter : _ref4$counterComponen, | ||
_ref4$contextMenuComp = _ref4.contextMenuComponent, | ||
contextMenuComponent = _ref4$contextMenuComp === void 0 ? ContextMenu : _ref4$contextMenuComp, | ||
_ref4$autoAddRow = _ref4.autoAddRow, | ||
autoAddRow = _ref4$autoAddRow === void 0 ? false : _ref4$autoAddRow, | ||
_ref4$lockRows = _ref4.lockRows, | ||
lockRows = _ref4$lockRows === void 0 ? false : _ref4$lockRows, | ||
_ref4$disableContextM = _ref4.disableContextMenu, | ||
disableContextMenuRaw = _ref4$disableContextM === void 0 ? false : _ref4$disableContextM, | ||
_ref4$renderGutterCol = _ref4.renderGutterColumn, | ||
renderGutterColumn = _ref4$renderGutterCol === void 0 ? DEFAULT_RENDER_GUTTER_COLUMN : _ref4$renderGutterCol; | ||
var disableContextMenu = disableContextMenuRaw || lockRows; | ||
@@ -1062,6 +1069,3 @@ var columns = useMemo(function () { | ||
}), | ||
render: function render(_ref4) { | ||
var rowIndex = _ref4.rowIndex; | ||
return rowIndex + 1; | ||
} | ||
render: renderGutterColumn | ||
}].concat(rawColumns).map(function (column) { | ||
@@ -1090,3 +1094,3 @@ return _extends({ | ||
}); | ||
}, [gutterColumnWidth, rawColumns]); | ||
}, [gutterColumnWidth, rawColumns, renderGutterColumn]); | ||
@@ -1093,0 +1097,0 @@ var _useState = useState(0), |
{ | ||
"name": "react-datasheet-grid", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Made with create-react-library", | ||
@@ -5,0 +5,0 @@ "author": "nick-keller", |
@@ -113,2 +113,3 @@ # react-datasheet-grid | ||
| contextMenuComponent | A React component | | Used to customize the context menu when right clicking. View [default implementation](./src/components/ContextMenu.tsx). | | ||
renderGutterColumn | ({ rowData, rowIndex, ... }) => ReactNode | ({ rowIndex }) => rowIndex + 1 | The render function of the column on the left of the datasheet. | ||
@@ -115,0 +116,0 @@ ### Columns definition |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
447406
3903
155