react-data-griddex
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -1140,4 +1140,4 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime'; | ||
selectRow, | ||
'aria-rowindex': ariaRowIndex, | ||
'aria-selected': ariaSelected, | ||
"aria-rowindex": ariaRowIndex, | ||
"aria-selected": ariaSelected, | ||
...props | ||
@@ -1149,3 +1149,3 @@ }, ref) { | ||
className = clsx(`rdg-row rdg-row-${rowIdx % 2 === 0 ? 'even' : 'odd'}`, rowClass == null ? void 0 : rowClass(row), className, isRowSelected && 'rdg-row-selected', (selectedCellProps == null ? void 0 : selectedCellProps.idx) === -1 && 'rdg-group-row-selected'); | ||
className = clsx(`rdg-row rdg-row-${rowIdx % 2 === 0 ? "even" : "odd"}`, rowClass == null ? void 0 : rowClass(row), className, isRowSelected && "rdg-row-selected", (selectedCellProps == null ? void 0 : selectedCellProps.idx) === -1 && "rdg-group-row-selected"); | ||
return /*#__PURE__*/jsx("div", { | ||
@@ -1165,3 +1165,3 @@ role: "row", | ||
if ((selectedCellProps == null ? void 0 : selectedCellProps.mode) === 'EDIT' && isCellSelected) { | ||
if ((selectedCellProps == null ? void 0 : selectedCellProps.mode) === "EDIT" && isCellSelected) { | ||
return /*#__PURE__*/jsx(EditCell, { | ||
@@ -1386,3 +1386,3 @@ rowIdx: rowIdx, | ||
enableFilterRow = false, | ||
cellNavigationMode = 'NONE', | ||
cellNavigationMode = "NONE", | ||
editorPortalTarget = body, | ||
@@ -1392,5 +1392,5 @@ className, | ||
rowClass, | ||
'aria-label': ariaLabel, | ||
'aria-labelledby': ariaLabelledBy, | ||
'aria-describedby': ariaDescribedBy | ||
"aria-label": ariaLabel, | ||
"aria-labelledby": ariaLabelledBy, | ||
"aria-describedby": ariaDescribedBy | ||
}, ref) { | ||
@@ -1405,3 +1405,3 @@ var _summaryRows$length; | ||
rowIdx: -1, | ||
mode: 'SELECT' | ||
mode: "SELECT" | ||
}); | ||
@@ -1460,3 +1460,3 @@ const [copiedCell, setCopiedCell] = useState(null); | ||
useLayoutEffect(() => { | ||
if (selectedPosition === prevSelectedPosition.current || selectedPosition.mode === 'EDIT' || !isCellWithinBounds(selectedPosition)) return; | ||
if (selectedPosition === prevSelectedPosition.current || selectedPosition.mode === "EDIT" || !isCellWithinBounds(selectedPosition)) return; | ||
prevSelectedPosition.current = selectedPosition; | ||
@@ -1488,3 +1488,3 @@ scrollToCell(selectedPosition); | ||
top: rowIdx * rowHeight, | ||
behavior: 'smooth' | ||
behavior: "smooth" | ||
}); | ||
@@ -1575,3 +1575,3 @@ }, | ||
if (onPaste && isCtrlKeyHeldDown(event) && isCellWithinBounds(selectedPosition) && !isGroupRow(row) && selectedPosition.idx !== -1 && selectedPosition.mode === 'SELECT') { | ||
if (onPaste && isCtrlKeyHeldDown(event) && isCellWithinBounds(selectedPosition) && !isGroupRow(row) && selectedPosition.idx !== -1 && selectedPosition.mode === "SELECT") { | ||
const cKey = 67; | ||
@@ -1591,3 +1591,3 @@ const vKey = 86; | ||
if (isCellWithinBounds(selectedPosition) && isGroupRow(row) && selectedPosition.idx === -1 && (key === 'ArrowLeft' && row.isExpanded || key === 'ArrowRight' && !row.isExpanded)) { | ||
if (isCellWithinBounds(selectedPosition) && isGroupRow(row) && selectedPosition.idx === -1 && (key === "ArrowLeft" && row.isExpanded || key === "ArrowRight" && !row.isExpanded)) { | ||
event.preventDefault(); | ||
@@ -1599,3 +1599,3 @@ toggleGroup(row.id); | ||
switch (event.key) { | ||
case 'Escape': | ||
case "Escape": | ||
setCopiedCell(null); | ||
@@ -1605,11 +1605,11 @@ closeEditor(); | ||
case 'ArrowUp': | ||
case 'ArrowDown': | ||
case 'ArrowLeft': | ||
case 'ArrowRight': | ||
case 'Tab': | ||
case 'Home': | ||
case 'End': | ||
case 'PageUp': | ||
case 'PageDown': | ||
case "ArrowUp": | ||
case "ArrowDown": | ||
case "ArrowLeft": | ||
case "ArrowRight": | ||
case "Tab": | ||
case "Home": | ||
case "End": | ||
case "PageUp": | ||
case "PageDown": | ||
navigate(event); | ||
@@ -1645,3 +1645,3 @@ break; | ||
if (((_columns$selectedPosi = columns[selectedPosition.idx]) == null ? void 0 : _columns$selectedPosi.editor) === undefined || selectedPosition.mode === 'SELECT' || selectedPosition.row === selectedPosition.originalRow) { | ||
if (((_columns$selectedPosi = columns[selectedPosition.idx]) == null ? void 0 : _columns$selectedPosi.editor) === undefined || selectedPosition.mode === "SELECT" || selectedPosition.row === selectedPosition.originalRow) { | ||
return; | ||
@@ -1699,4 +1699,4 @@ } | ||
if (selectedPosition.mode === 'EDIT') { | ||
if (key === 'Enter') { | ||
if (selectedPosition.mode === "EDIT") { | ||
if (key === "Enter") { | ||
commitEditorChanges(); | ||
@@ -1720,3 +1720,3 @@ closeEditor(); | ||
key, | ||
mode: 'EDIT', | ||
mode: "EDIT", | ||
row, | ||
@@ -1757,4 +1757,4 @@ originalRow: row | ||
setDragging(true); | ||
window.addEventListener('mouseover', onMouseOver); | ||
window.addEventListener('mouseup', onMouseUp); | ||
window.addEventListener("mouseover", onMouseOver); | ||
window.addEventListener("mouseup", onMouseUp); | ||
@@ -1766,4 +1766,4 @@ function onMouseOver(event) { | ||
function onMouseUp() { | ||
window.removeEventListener('mouseover', onMouseOver); | ||
window.removeEventListener('mouseup', onMouseUp); | ||
window.removeEventListener("mouseover", onMouseOver); | ||
window.removeEventListener("mouseup", onMouseUp); | ||
setDragging(false); | ||
@@ -1804,3 +1804,3 @@ handleDragEnd(); | ||
function handleEditorRowChange(row, commitChanges) { | ||
if (selectedPosition.mode === 'SELECT') return; | ||
if (selectedPosition.mode === "SELECT") return; | ||
@@ -1843,3 +1843,3 @@ if (commitChanges) { | ||
function selectCell(position, enableEditor = false) { | ||
function selectCell(position, enableEditor = true) { | ||
if (!isCellWithinBounds(position)) return; | ||
@@ -1851,3 +1851,3 @@ commitEditorChanges(); | ||
setSelectedPosition({ ...position, | ||
mode: 'EDIT', | ||
mode: "EDIT", | ||
key: null, | ||
@@ -1859,3 +1859,3 @@ row, | ||
setSelectedPosition({ ...position, | ||
mode: 'SELECT' | ||
mode: "SELECT" | ||
}); | ||
@@ -1869,3 +1869,3 @@ } | ||
function closeEditor() { | ||
if (selectedPosition.mode === 'SELECT') return; | ||
if (selectedPosition.mode === "SELECT") return; | ||
setSelectedPosition(({ | ||
@@ -1877,3 +1877,3 @@ idx, | ||
rowIdx, | ||
mode: 'SELECT' | ||
mode: "SELECT" | ||
})); | ||
@@ -1891,3 +1891,3 @@ } | ||
if (typeof idx === 'number' && idx > lastFrozenColumnIndex) { | ||
if (typeof idx === "number" && idx > lastFrozenColumnIndex) { | ||
const { | ||
@@ -1909,3 +1909,3 @@ clientWidth | ||
if (typeof rowIdx === 'number') { | ||
if (typeof rowIdx === "number") { | ||
if (rowIdx * rowHeight < scrollTop) { | ||
@@ -1927,3 +1927,3 @@ current.scrollTop = rowIdx * rowHeight; | ||
if (key === 'ArrowLeft' && isRowSelected && isGroupRow(row) && !row.isExpanded && row.level !== 0) { | ||
if (key === "ArrowLeft" && isRowSelected && isGroupRow(row) && !row.isExpanded && row.level !== 0) { | ||
let parentRowIdx = -1; | ||
@@ -1949,3 +1949,3 @@ | ||
switch (key) { | ||
case 'ArrowUp': | ||
case "ArrowUp": | ||
return { | ||
@@ -1956,3 +1956,3 @@ idx, | ||
case 'ArrowDown': | ||
case "ArrowDown": | ||
return { | ||
@@ -1963,3 +1963,3 @@ idx, | ||
case 'ArrowLeft': | ||
case "ArrowLeft": | ||
return { | ||
@@ -1970,3 +1970,3 @@ idx: idx - 1, | ||
case 'ArrowRight': | ||
case "ArrowRight": | ||
return { | ||
@@ -1977,3 +1977,3 @@ idx: idx + 1, | ||
case 'Tab': | ||
case "Tab": | ||
if (selectedPosition.idx === -1 && selectedPosition.rowIdx === -1) { | ||
@@ -1994,3 +1994,3 @@ return shiftKey ? { | ||
case 'Home': | ||
case "Home": | ||
if (isRowSelected) return { | ||
@@ -2008,3 +2008,3 @@ idx, | ||
case 'End': | ||
case "End": | ||
if (isRowSelected) return { | ||
@@ -2022,3 +2022,3 @@ idx, | ||
case 'PageUp': | ||
case "PageUp": | ||
return { | ||
@@ -2029,3 +2029,3 @@ idx, | ||
case 'PageDown': | ||
case "PageDown": | ||
return { | ||
@@ -2042,3 +2042,3 @@ idx, | ||
function navigate(event) { | ||
if (selectedPosition.mode === 'EDIT') { | ||
if (selectedPosition.mode === "EDIT") { | ||
var _columns$selectedPosi2, _columns$selectedPosi3; | ||
@@ -2058,3 +2058,3 @@ | ||
if (key === 'Tab') { | ||
if (key === "Tab") { | ||
if (canExitGrid({ | ||
@@ -2071,3 +2071,3 @@ shiftKey, | ||
mode = cellNavigationMode === 'NONE' ? 'CHANGE_ROW' : cellNavigationMode; | ||
mode = cellNavigationMode === "NONE" ? "CHANGE_ROW" : cellNavigationMode; | ||
} | ||
@@ -2097,5 +2097,5 @@ | ||
if (selectedPosition.mode === 'EDIT') { | ||
if (selectedPosition.mode === "EDIT") { | ||
return { | ||
mode: 'EDIT', | ||
mode: "EDIT", | ||
idx: selectedPosition.idx, | ||
@@ -2114,3 +2114,3 @@ onKeyDown: handleKeyDown, | ||
return { | ||
mode: 'SELECT', | ||
mode: "SELECT", | ||
idx: selectedPosition.idx, | ||
@@ -2166,3 +2166,3 @@ onFocus: handleFocus, | ||
if (typeof rowKeyGetter === 'function') { | ||
if (typeof rowKeyGetter === "function") { | ||
var _selectedRows$has; | ||
@@ -2201,3 +2201,3 @@ | ||
rowIdx: -1, | ||
mode: 'SELECT' | ||
mode: "SELECT" | ||
}); | ||
@@ -2207,3 +2207,3 @@ setDraggedOverRowIdx(undefined); | ||
if (selectedPosition.mode === 'EDIT' && rows[selectedPosition.rowIdx] !== selectedPosition.originalRow) { | ||
if (selectedPosition.mode === "EDIT" && rows[selectedPosition.rowIdx] !== selectedPosition.originalRow) { | ||
closeEditor(); | ||
@@ -2213,3 +2213,3 @@ } | ||
return /*#__PURE__*/jsxs("div", { | ||
role: hasGroups ? 'treegrid' : 'grid', | ||
role: hasGroups ? "treegrid" : "grid", | ||
"aria-label": ariaLabel, | ||
@@ -2221,8 +2221,8 @@ "aria-labelledby": ariaLabelledBy, | ||
"aria-rowcount": headerRowsCount + rowsCount + summaryRowsCount, | ||
className: clsx('rdg', className, isDragging && 'rdg-viewport-dragging'), | ||
className: clsx("rdg", className, isDragging && "rdg-viewport-dragging"), | ||
style: { ...style, | ||
'--header-row-height': `${headerRowHeight}px`, | ||
'--filter-row-height': `${headerFiltersHeight}px`, | ||
'--row-width': `${totalColumnWidth}px`, | ||
'--row-height': `${rowHeight}px` | ||
"--header-row-height": `${headerRowHeight}px`, | ||
"--filter-row-height": `${headerFiltersHeight}px`, | ||
"--row-width": `${totalColumnWidth}px`, | ||
"--row-height": `${rowHeight}px` | ||
}, | ||
@@ -2229,0 +2229,0 @@ ref: gridRef, |
@@ -1,4 +0,4 @@ | ||
import type { CalculatedColumn, Column, Filters, Position, RowRendererProps, FillEvent, PasteEvent } from './types'; | ||
import type { CellNavigationMode, SortDirection } from './enums'; | ||
declare type DefaultColumnOptions<R, SR> = Pick<Column<R, SR>, 'formatter' | 'minWidth' | 'resizable' | 'sortable'>; | ||
import type { CalculatedColumn, Column, Filters, Position, RowRendererProps, FillEvent, PasteEvent } from "./types"; | ||
import type { CellNavigationMode, SortDirection } from "./enums"; | ||
declare type DefaultColumnOptions<R, SR> = Pick<Column<R, SR>, "formatter" | "minWidth" | "resizable" | "sortable">; | ||
export interface DataGridHandle { | ||
@@ -9,3 +9,3 @@ scrollToColumn: (colIdx: number) => void; | ||
} | ||
declare type SharedDivProps = Pick<React.HTMLAttributes<HTMLDivElement>, 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'className' | 'style'>; | ||
declare type SharedDivProps = Pick<React.HTMLAttributes<HTMLDivElement>, "aria-label" | "aria-labelledby" | "aria-describedby" | "className" | "style">; | ||
export interface DataGridProps<R, SR = unknown> extends SharedDivProps { | ||
@@ -12,0 +12,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
import type { RowRendererProps } from './types'; | ||
import type { RowRendererProps } from "./types"; | ||
declare const _default: <R, SR = unknown>(props: RowRendererProps<R, SR> & import("react").RefAttributes<HTMLDivElement>) => JSX.Element; | ||
export default _default; |
{ | ||
"name": "react-data-griddex", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"license": "MIT", | ||
@@ -49,3 +49,5 @@ "description": "Excel-like grid component built with React, with editors, keyboard navigation, copy & paste, and the like", | ||
"dependencies": { | ||
"clsx": "^1.1.1" | ||
"clsx": "^1.1.1", | ||
"react-data-grid": "^7.0.0-canary.33", | ||
"react-data-grid-addons": "^7.0.0-alpha.24" | ||
}, | ||
@@ -52,0 +54,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
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
480355
44
4828
5
+ Addedasap@2.0.6(transitive)
+ Addedclassnames@2.5.1(transitive)
+ Addeddisposables@1.0.2(transitive)
+ Addeddnd-core@2.6.0(transitive)
+ Addedhoist-non-react-statics@2.5.5(transitive)
+ Addedinvariant@2.2.4(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlodash-es@4.17.21(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedreact@16.14.0(transitive)
+ Addedreact-contextmenu@2.14.0(transitive)
+ Addedreact-data-grid@7.0.0-canary.49(transitive)
+ Addedreact-data-grid-addons@7.0.0-canary.9(transitive)
+ Addedreact-dnd@2.6.0(transitive)
+ Addedreact-dnd-html5-backend@2.6.0(transitive)
+ Addedreact-dom@16.14.0(transitive)
+ Addedreact-input-autosize@2.2.2(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedreact-select@1.3.0(transitive)
+ Addedredux@3.7.2(transitive)
+ Addedreselect@4.1.8(transitive)
+ Addedscheduler@0.19.1(transitive)
+ Addedsymbol-observable@1.2.0(transitive)
+ Addedtslib@1.14.1(transitive)