Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

streaksheet

Package Overview
Dependencies
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

streaksheet - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

6

build/src/CellContainer.d.ts
import React from 'react';
import type { ItemData } from './internalTypes';
export interface Props {
export interface Props<T> {
columnIndex: number;
rowIndex: number;
style: React.CSSProperties;
data: ItemData;
data: ItemData<T>;
}
declare const _default: React.NamedExoticComponent<Props>;
declare const _default: React.MemoExoticComponent<(<T>({ columnIndex, data, rowIndex, style }: Props<T>) => JSX.Element | null)>;
export default _default;
import React, { ComponentType, CSSProperties } from 'react';
import { VariableSizeGrid } from 'react-window';
import useSheetData from './useSheetData';
import type { UnsupportedOperation } from './internalTypes';
import type { CellIndexes, RowsBySection, SelectionState, UnsupportedOperation } from './internalTypes';
import type { ColumnAndOverviewData, ColumnInfo, Row, RowId, RowsResult, Section, SheetData, SheetDataOptions } from './useSheetData';

@@ -12,11 +13,11 @@ export { useSheetData };

}
export interface SearchContext {
export interface SearchContext<T> {
sectionKey: string;
startIndex: number;
rows: Row[];
rows: Row<T>[];
}
export declare type SearchDirection = 'UP' | 'DOWN';
export interface SearchResult {
export interface SearchResult<T> {
positions: CellPosition[];
contexts: SearchContext[];
contexts: SearchContext<T>[];
reachedEnd: boolean;

@@ -35,6 +36,19 @@ }

}
export interface CellProps {
export interface InnerElementCtx<T> {
copiedRegion?: [CellIndexes, CellIndexes];
handleGridDoubleClick: React.MouseEventHandler;
handleGridKeyDown: React.KeyboardEventHandler;
handleGridMouseDown: React.MouseEventHandler;
handleGridMouseMove: React.MouseEventHandler;
handleGridMouseUp: React.MouseEventHandler;
resetAfterColumnIndex: VariableSizeGrid['resetAfterColumnIndex'];
rowsBySection: RowsBySection<T>;
selection: SelectionState;
sheetProps: Props<T>;
styles: Styles;
}
export interface CellProps<T> {
columnKey: string;
isEditing: boolean;
rowData: any;
rowData: T;
rowKey: string;

@@ -87,10 +101,10 @@ }

}
export interface Props {
export interface Props<T> {
width: number;
height: number;
minimumColumnWidth?: number;
Cell: ComponentType<CellProps>;
Cell: ComponentType<CellProps<T>>;
SectionHeaderCell: ComponentType<SectionHeaderCellProps>;
ColumnHeaderCell: ComponentType<ColumnHeaderCellProps>;
search?(query: string, direction: SearchDirection, startPosition: CellPosition, includeContext: boolean): Promise<SearchResult>;
search?(query: string, direction: SearchDirection, startPosition: CellPosition, includeContext: boolean): Promise<SearchResult<T>>;
defaultRowHeight: number;

@@ -100,3 +114,3 @@ frozenColumns?: number;

renderOverscanRowCount?: number;
sheetData: SheetData;
sheetData: SheetData<T>;
onOpenSearch?: () => void;

@@ -115,3 +129,5 @@ onUnsupportedOperation?: (unsupportedOperation: UnsupportedOperation) => void;

}
declare const StreakSheet: React.MemoExoticComponent<React.ForwardRefExoticComponent<Props & React.RefAttributes<StreakSheetRef>>>;
declare const StreakSheet: <T>(props: Props<T> & {
ref?: React.Ref<StreakSheetRef>;
}) => React.ReactElement;
export default StreakSheet;

@@ -186,4 +186,3 @@ "use strict";

*/
// eslint-disable-next-line react/display-name
var StreakSheet = _react["default"].memo((0, _react.forwardRef)(function StreakSheet(props, ref) {
var _StreakSheet = function StreakSheet(props, ref) {
var _props$styles, _props$styles2, _props$styles3, _props$styles4, _props$styles5, _props$styles6, _props$styles7, _props$styles8, _props$styles9, _props$styles10, _props$styles11, _props$styles12, _props$styles13, _props$styles14, _props$styles15, _props$styles16, _props$styles17, _props$styles18;

@@ -364,7 +363,10 @@

var _cellIndexes = (0, _slicedToArray2["default"])(cellIndexes, 2),
rowIndex = _cellIndexes[0],
columnIndex = _cellIndexes[1];
setCellBeingEdited(function (cellBeingEdited) {
// If the active cell was double-clicked, keep the old value's identity.
if (cellBeingEdited && cellBeingEdited[0] === cellIndexes[0] && cellBeingEdited[1] === cellIndexes[1]) {
return cellBeingEdited;
}
setCellBeingEdited([rowIndex, columnIndex]);
return cellIndexes;
});
event.preventDefault();

@@ -452,5 +454,5 @@ event.stopPropagation();

var _cellIndexes2 = cellKeysToIndexes(_jumpPointSectionKey, _jumpPointRowKey, _jumpPointColumnKey);
var _cellIndexes = cellKeysToIndexes(_jumpPointSectionKey, _jumpPointRowKey, _jumpPointColumnKey);
if (!_cellIndexes2) {
if (!_cellIndexes) {
return;

@@ -461,3 +463,3 @@ }

type: shiftKey ? 'EXPAND_TO_CELL' : 'MOVE_TO_CELL',
cellIndexes: _cellIndexes2
cellIndexes: _cellIndexes
});

@@ -502,5 +504,5 @@ } else if (shiftKey) {

var _cellIndexes3 = cellKeysToIndexes(_jumpPointSectionKey2, _jumpPointRowKey2, _jumpPointColumnKey2);
var _cellIndexes2 = cellKeysToIndexes(_jumpPointSectionKey2, _jumpPointRowKey2, _jumpPointColumnKey2);
if (!_cellIndexes3) {
if (!_cellIndexes2) {
return;

@@ -511,3 +513,3 @@ }

type: shiftKey ? 'EXPAND_TO_CELL' : 'MOVE_TO_CELL',
cellIndexes: _cellIndexes3
cellIndexes: _cellIndexes2
});

@@ -552,5 +554,5 @@ } else if (shiftKey) {

var _cellIndexes4 = cellKeysToIndexes(_jumpPointSectionKey3, _jumpPointRowKey3, _jumpPointColumnKey3);
var _cellIndexes3 = cellKeysToIndexes(_jumpPointSectionKey3, _jumpPointRowKey3, _jumpPointColumnKey3);
if (!_cellIndexes4) {
if (!_cellIndexes3) {
return;

@@ -561,3 +563,3 @@ }

type: shiftKey ? 'EXPAND_TO_CELL' : 'MOVE_TO_CELL',
cellIndexes: _cellIndexes4
cellIndexes: _cellIndexes3
});

@@ -706,3 +708,10 @@ } else if (shiftKey) {

setCellBeingEdited(null);
setCellBeingEdited(function (cellBeingEdited) {
// if they clicked on the current cell, leave it in edit mode
if (cellBeingEdited && cellBeingEdited[0] === cellIndexes[0] && cellBeingEdited[1] === cellIndexes[1]) {
return cellIndexes;
}
return null;
});
setIsDragging(true);

@@ -911,4 +920,7 @@ }, []);

}, _CellContainer["default"]));
}));
}; // eslint-disable-next-line react/display-name
var StreakSheet = _react["default"].memo((0, _react.forwardRef)(_StreakSheet));
function searchForRowsChunk(sectionRows, rowIndex) {

@@ -915,0 +927,0 @@ // TODO binary search instead

@@ -12,15 +12,15 @@ import type { ComponentType } from 'react';

}
export interface RowsChunk {
export interface RowsChunk<T> {
startIndex: number;
rowsResult: RowsResult;
rowsResult: RowsResult<T>;
}
export interface RowsBySection {
[sectionKey: string]: undefined | Array<RowsChunk>;
export interface RowsBySection<T> {
[sectionKey: string]: undefined | Array<RowsChunk<T>>;
}
export interface ItemData {
Cell: ComponentType<CellProps>;
export interface ItemData<T> {
Cell: ComponentType<CellProps<T>>;
cellBeingEdited: CellIndexes | null;
cellIndexesToKeysAndData: (rowIndex: number, columnIndex: number) => CellIndexesToKeysAndDataResult | null;
columnAndOverviewData: ColumnAndOverviewData;
rowsBySection: RowsBySection;
rowsBySection: RowsBySection<T>;
sectionRowMatcher: SectionRowMatcher;

@@ -27,0 +27,0 @@ styles: Styles;

@@ -20,8 +20,8 @@ import SectionRowMatcher from './SectionRowMatcher';

}
export interface Row {
export interface Row<T> {
key: string;
data: any;
data: T;
}
export interface RowsResult {
rows: Row[];
export interface RowsResult<T> {
rows: Row<T>[];
reachedEnd: boolean;

@@ -33,3 +33,3 @@ }

}
export interface SheetDataOptions {
export interface SheetDataOptions<T> {
columnAndOverviewData: ColumnAndOverviewData;

@@ -41,3 +41,3 @@ dataHandlers: Array<{

dropTriggerDistance?: number;
getRows(sectionKey: string, startingIndex: number, countHint: number, abortSignal: AbortSignal): Promise<RowsResult>;
getRows(sectionKey: string, startingIndex: number, countHint: number, abortSignal: AbortSignal): Promise<RowsResult<T>>;
unloadRows?(sectionKey: string, keys: string[]): void;

@@ -56,3 +56,3 @@ }>;

}
export interface SheetData {
export interface SheetData<T> {
addRow(after: RowId): void;

@@ -67,5 +67,5 @@ columnAndOverviewData: ColumnAndOverviewData;

refreshColumnAndOverviewData(): void;
rowsBySection: RowsBySection;
rowsBySection: RowsBySection<T>;
sectionRowMatcher: SectionRowMatcher;
setRowData(rowKey: string, rowData: any): void;
setRowData(rowKey: string, rowData: T): void;
totalRowCount: number;

@@ -77,2 +77,2 @@ useByStreakSheet(): SheetDataForStreakSheet;

}
export default function useSheetData(options: SheetDataOptions): SheetData;
export default function useSheetData<T>(options: SheetDataOptions<T>): SheetData<T>;
{
"name": "streaksheet",
"version": "0.7.1",
"version": "0.7.2",
"author": "Chris Cowan <agentme49@gmail.com>",

@@ -5,0 +5,0 @@ "license": "MIT",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc