@sage-bionetworks/react-datasheet-grid 4.11.5-sage.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +77 -0
- package/dist/columns/checkboxColumn.d.ts +3 -0
- package/dist/columns/checkboxColumn.d.ts.map +1 -0
- package/dist/columns/dateColumn.d.ts +3 -0
- package/dist/columns/dateColumn.d.ts.map +1 -0
- package/dist/columns/floatColumn.d.ts +9 -0
- package/dist/columns/floatColumn.d.ts.map +1 -0
- package/dist/columns/intColumn.d.ts +9 -0
- package/dist/columns/intColumn.d.ts.map +1 -0
- package/dist/columns/isoDateColumn.d.ts +3 -0
- package/dist/columns/isoDateColumn.d.ts.map +1 -0
- package/dist/columns/keyColumn.d.ts +8 -0
- package/dist/columns/keyColumn.d.ts.map +1 -0
- package/dist/columns/percentColumn.d.ts +9 -0
- package/dist/columns/percentColumn.d.ts.map +1 -0
- package/dist/columns/textColumn.d.ts +24 -0
- package/dist/columns/textColumn.d.ts.map +1 -0
- package/dist/components/AddRows.d.ts +8 -0
- package/dist/components/AddRows.d.ts.map +1 -0
- package/dist/components/Cell.d.ts +12 -0
- package/dist/components/Cell.d.ts.map +1 -0
- package/dist/components/ContextMenu.d.ts +7 -0
- package/dist/components/ContextMenu.d.ts.map +1 -0
- package/dist/components/DataSheetGrid.d.ts +6 -0
- package/dist/components/DataSheetGrid.d.ts.map +1 -0
- package/dist/components/Grid.d.ts +43 -0
- package/dist/components/Grid.d.ts.map +1 -0
- package/dist/components/SelectionRect.d.ts +4 -0
- package/dist/components/SelectionRect.d.ts.map +1 -0
- package/dist/components/StaticDataSheetGrid.d.ts +6 -0
- package/dist/components/StaticDataSheetGrid.d.ts.map +1 -0
- package/dist/hooks/useColumnWidths.d.ts +14 -0
- package/dist/hooks/useColumnWidths.d.ts.map +1 -0
- package/dist/hooks/useColumns.d.ts +8 -0
- package/dist/hooks/useColumns.d.ts.map +1 -0
- package/dist/hooks/useDebounceState.d.ts +2 -0
- package/dist/hooks/useDebounceState.d.ts.map +1 -0
- package/dist/hooks/useDeepEqualState.d.ts +3 -0
- package/dist/hooks/useDeepEqualState.d.ts.map +1 -0
- package/dist/hooks/useDocumentEventListener.d.ts +2 -0
- package/dist/hooks/useDocumentEventListener.d.ts.map +1 -0
- package/dist/hooks/useEdges.d.ts +8 -0
- package/dist/hooks/useEdges.d.ts.map +1 -0
- package/dist/hooks/useFirstRender.d.ts +2 -0
- package/dist/hooks/useFirstRender.d.ts.map +1 -0
- package/dist/hooks/useGetBoundingClientRect.d.ts +3 -0
- package/dist/hooks/useGetBoundingClientRect.d.ts.map +1 -0
- package/dist/hooks/useMemoizedIndexCallback.d.ts +2 -0
- package/dist/hooks/useMemoizedIndexCallback.d.ts.map +1 -0
- package/dist/hooks/useRowHeights.d.ts +13 -0
- package/dist/hooks/useRowHeights.d.ts.map +1 -0
- package/dist/index.cjs +10 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3145 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +198 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/copyPasting.d.ts +5 -0
- package/dist/utils/copyPasting.d.ts.map +1 -0
- package/dist/utils/domParser.d.ts +2 -0
- package/dist/utils/domParser.d.ts.map +1 -0
- package/dist/utils/tab.d.ts +2 -0
- package/dist/utils/tab.d.ts.map +1 -0
- package/dist/utils/typeCheck.d.ts +6 -0
- package/dist/utils/typeCheck.d.ts.map +1 -0
- package/package.json +87 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type Cell = {
|
|
3
|
+
col: number;
|
|
4
|
+
row: number;
|
|
5
|
+
};
|
|
6
|
+
export type Selection = {
|
|
7
|
+
min: Cell;
|
|
8
|
+
max: Cell;
|
|
9
|
+
};
|
|
10
|
+
export type CellProps<T, C> = {
|
|
11
|
+
rowData: T;
|
|
12
|
+
rowIndex: number;
|
|
13
|
+
columnIndex: number;
|
|
14
|
+
active: boolean;
|
|
15
|
+
focus: boolean;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
columnData: C;
|
|
18
|
+
setRowData: (rowData: T) => void;
|
|
19
|
+
stopEditing: (opts?: {
|
|
20
|
+
nextRow?: boolean;
|
|
21
|
+
}) => void;
|
|
22
|
+
insertRowBelow: () => void;
|
|
23
|
+
duplicateRow: () => void;
|
|
24
|
+
deleteRow: () => void;
|
|
25
|
+
getContextMenuItems: () => ContextMenuItem[];
|
|
26
|
+
};
|
|
27
|
+
export type CellComponent<T, C> = (props: CellProps<T, C>) => JSX.Element;
|
|
28
|
+
export type Column<T, C, PasteValue> = {
|
|
29
|
+
id?: string;
|
|
30
|
+
headerClassName?: string;
|
|
31
|
+
title?: React.ReactNode;
|
|
32
|
+
/** @deprecated Use `basis`, `grow`, and `shrink` instead */
|
|
33
|
+
width?: string | number;
|
|
34
|
+
basis: number;
|
|
35
|
+
grow: number;
|
|
36
|
+
shrink: number;
|
|
37
|
+
minWidth: number;
|
|
38
|
+
maxWidth?: number;
|
|
39
|
+
component: CellComponent<T, C>;
|
|
40
|
+
columnData?: C;
|
|
41
|
+
disableKeys: boolean;
|
|
42
|
+
disabled: boolean | ((opt: {
|
|
43
|
+
rowData: T;
|
|
44
|
+
rowIndex: number;
|
|
45
|
+
}) => boolean);
|
|
46
|
+
cellClassName?: string | ((opt: {
|
|
47
|
+
rowData: T;
|
|
48
|
+
rowIndex: number;
|
|
49
|
+
columnId?: string;
|
|
50
|
+
}) => string | undefined);
|
|
51
|
+
keepFocus: boolean;
|
|
52
|
+
deleteValue: (opt: {
|
|
53
|
+
rowData: T;
|
|
54
|
+
rowIndex: number;
|
|
55
|
+
}) => T;
|
|
56
|
+
copyValue: (opt: {
|
|
57
|
+
rowData: T;
|
|
58
|
+
rowIndex: number;
|
|
59
|
+
}) => number | string | null;
|
|
60
|
+
pasteValue: (opt: {
|
|
61
|
+
rowData: T;
|
|
62
|
+
value: PasteValue;
|
|
63
|
+
rowIndex: number;
|
|
64
|
+
}) => T;
|
|
65
|
+
prePasteValues: (values: string[]) => PasteValue[] | Promise<PasteValue[]>;
|
|
66
|
+
isCellEmpty: (opt: {
|
|
67
|
+
rowData: T;
|
|
68
|
+
rowIndex: number;
|
|
69
|
+
}) => boolean;
|
|
70
|
+
};
|
|
71
|
+
export type SelectionContextType = {
|
|
72
|
+
columnRights?: number[];
|
|
73
|
+
columnWidths?: number[];
|
|
74
|
+
activeCell: Cell | null;
|
|
75
|
+
selection: Selection | null;
|
|
76
|
+
dataLength: number;
|
|
77
|
+
rowHeight: (index: number) => {
|
|
78
|
+
height: number;
|
|
79
|
+
top: number;
|
|
80
|
+
};
|
|
81
|
+
hasStickyRightColumn: boolean;
|
|
82
|
+
editing: boolean;
|
|
83
|
+
isCellDisabled: (cell: Cell) => boolean;
|
|
84
|
+
headerRowHeight: number;
|
|
85
|
+
viewWidth?: number;
|
|
86
|
+
viewHeight?: number;
|
|
87
|
+
contentWidth?: number;
|
|
88
|
+
edges: {
|
|
89
|
+
top: boolean;
|
|
90
|
+
right: boolean;
|
|
91
|
+
bottom: boolean;
|
|
92
|
+
left: boolean;
|
|
93
|
+
};
|
|
94
|
+
expandSelection: number | null;
|
|
95
|
+
};
|
|
96
|
+
export type SimpleColumn<T, C> = Partial<Pick<Column<T, C, string>, 'title' | 'maxWidth' | 'minWidth' | 'basis' | 'grow' | 'shrink' | 'component' | 'columnData'>>;
|
|
97
|
+
export type AddRowsComponentProps = {
|
|
98
|
+
addRows: (count?: number) => void;
|
|
99
|
+
};
|
|
100
|
+
export type ContextMenuItem = {
|
|
101
|
+
type: 'INSERT_ROW_BELLOW' | 'DELETE_ROW' | 'DUPLICATE_ROW' | 'COPY' | 'CUT' | 'PASTE';
|
|
102
|
+
action: () => void;
|
|
103
|
+
} | {
|
|
104
|
+
type: 'DELETE_ROWS' | 'DUPLICATE_ROWS';
|
|
105
|
+
action: () => void;
|
|
106
|
+
fromRow: number;
|
|
107
|
+
toRow: number;
|
|
108
|
+
};
|
|
109
|
+
export type ContextMenuComponentProps = {
|
|
110
|
+
clientX: number;
|
|
111
|
+
clientY: number;
|
|
112
|
+
items: ContextMenuItem[];
|
|
113
|
+
cursorIndex: Cell;
|
|
114
|
+
close: () => void;
|
|
115
|
+
};
|
|
116
|
+
export type Operation = {
|
|
117
|
+
type: 'UPDATE' | 'DELETE' | 'CREATE';
|
|
118
|
+
fromRowIndex: number;
|
|
119
|
+
toRowIndex: number;
|
|
120
|
+
};
|
|
121
|
+
export type DataSheetGridProps<T> = {
|
|
122
|
+
value?: T[];
|
|
123
|
+
style?: React.CSSProperties;
|
|
124
|
+
className?: string;
|
|
125
|
+
rowClassName?: string | ((opt: {
|
|
126
|
+
rowData: T;
|
|
127
|
+
rowIndex: number;
|
|
128
|
+
}) => string | undefined);
|
|
129
|
+
cellClassName?: string | ((opt: {
|
|
130
|
+
rowData: unknown;
|
|
131
|
+
rowIndex: number;
|
|
132
|
+
columnId?: string;
|
|
133
|
+
}) => string | undefined);
|
|
134
|
+
onChange?: (value: T[], operations: Operation[]) => void;
|
|
135
|
+
columns?: Partial<Column<T, any, any>>[];
|
|
136
|
+
gutterColumn?: SimpleColumn<T, any> | false;
|
|
137
|
+
stickyRightColumn?: SimpleColumn<T, any>;
|
|
138
|
+
rowKey?: string | ((opts: {
|
|
139
|
+
rowData: T;
|
|
140
|
+
rowIndex: number;
|
|
141
|
+
}) => string);
|
|
142
|
+
height?: number;
|
|
143
|
+
rowHeight?: number | ((opt: {
|
|
144
|
+
rowData: T;
|
|
145
|
+
rowIndex: number;
|
|
146
|
+
}) => number);
|
|
147
|
+
headerRowHeight?: number;
|
|
148
|
+
addRowsComponent?: ((props: AddRowsComponentProps) => React.ReactElement | null) | false;
|
|
149
|
+
createRow?: () => T;
|
|
150
|
+
duplicateRow?: (opts: {
|
|
151
|
+
rowData: T;
|
|
152
|
+
rowIndex: number;
|
|
153
|
+
}) => T;
|
|
154
|
+
autoAddRow?: boolean;
|
|
155
|
+
lockRows?: boolean;
|
|
156
|
+
disableContextMenu?: boolean;
|
|
157
|
+
disableExpandSelection?: boolean;
|
|
158
|
+
disableSmartDelete?: boolean;
|
|
159
|
+
contextMenuComponent?: (props: ContextMenuComponentProps) => React.ReactElement | null;
|
|
160
|
+
onFocus?: (opts: {
|
|
161
|
+
cell: CellWithId;
|
|
162
|
+
}) => void;
|
|
163
|
+
onBlur?: (opts: {
|
|
164
|
+
cell: CellWithId;
|
|
165
|
+
}) => void;
|
|
166
|
+
onActiveCellChange?: (opts: {
|
|
167
|
+
cell: CellWithId | null;
|
|
168
|
+
}) => void;
|
|
169
|
+
onSelectionChange?: (opts: {
|
|
170
|
+
selection: SelectionWithId | null;
|
|
171
|
+
}) => void;
|
|
172
|
+
onScroll?: React.UIEventHandler<HTMLDivElement> | undefined;
|
|
173
|
+
};
|
|
174
|
+
type CellWithIdInput = {
|
|
175
|
+
col: number | string;
|
|
176
|
+
row: number;
|
|
177
|
+
};
|
|
178
|
+
type SelectionWithIdInput = {
|
|
179
|
+
min: CellWithIdInput;
|
|
180
|
+
max: CellWithIdInput;
|
|
181
|
+
};
|
|
182
|
+
export type CellWithId = {
|
|
183
|
+
colId?: string;
|
|
184
|
+
col: number;
|
|
185
|
+
row: number;
|
|
186
|
+
};
|
|
187
|
+
export type SelectionWithId = {
|
|
188
|
+
min: CellWithId;
|
|
189
|
+
max: CellWithId;
|
|
190
|
+
};
|
|
191
|
+
export type DataSheetGridRef = {
|
|
192
|
+
activeCell: CellWithId | null;
|
|
193
|
+
selection: SelectionWithId | null;
|
|
194
|
+
setActiveCell: (activeCell: CellWithIdInput | null) => void;
|
|
195
|
+
setSelection: (selection: SelectionWithIdInput | null) => void;
|
|
196
|
+
};
|
|
197
|
+
export {};
|
|
198
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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,IAAI,KAAK,IAAI,CAAA;IAC3D,YAAY,EAAE,CAAC,SAAS,EAAE,oBAAoB,GAAG,IAAI,KAAK,IAAI,CAAA;CAC/D,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const parseTextHtmlData: (data: string) => string[][];
|
|
2
|
+
export declare const parseTextPlainData: (data: string) => string[][];
|
|
3
|
+
export declare const encodeHtml: (str: string) => string;
|
|
4
|
+
export declare const isPrintableUnicode: (str: string) => boolean;
|
|
5
|
+
//# sourceMappingURL=copyPasting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyPasting.d.ts","sourceRoot":"","sources":["../../src/utils/copyPasting.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,SAAU,MAAM,KAAG,MAAM,EAAE,EA0BxD,CAAA;AAED,eAAO,MAAM,kBAAkB,SAAU,MAAM,KAAG,MAAM,EAAE,EAqEzD,CAAA;AAED,eAAO,MAAM,UAAU,QAAS,MAAM,WAOrC,CAAA;AAED,eAAO,MAAM,kBAAkB,QAAS,MAAM,KAAG,OAEhD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domParser.d.ts","sourceRoot":"","sources":["../../src/utils/domParser.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ,SAAU,MAAM,KAAG,QAEvC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../src/utils/tab.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,qBAYd,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Cell, CellWithId, Column, Selection, SelectionWithId } from '../types';
|
|
2
|
+
export declare const getCell: (value: any, colMax: number, rowMax: number, columns: Column<any, any, any>[]) => Cell | null;
|
|
3
|
+
export declare const getCellWithId: (cell: Cell | null, columns: Column<any, any, any>[]) => CellWithId;
|
|
4
|
+
export declare const getSelection: (value: any, colMax: number, rowMax: number, columns: Column<any, any, any>[]) => Selection | null;
|
|
5
|
+
export declare const getSelectionWithId: (selection: Selection | null, columns: Column<any, any, any>[]) => SelectionWithId | null;
|
|
6
|
+
//# sourceMappingURL=typeCheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeCheck.d.ts","sourceRoot":"","sources":["../../src/utils/typeCheck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/E,eAAO,MAAM,OAAO,UACX,GAAG,UACF,MAAM,UACN,MAAM,WACL,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,KAC/B,IAAI,GAAG,IAwBT,CAAA;AAED,eAAO,MAAM,aAAa,SAClB,IAAI,GAAG,IAAI,WACR,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,eAQb,CAAA;AAErB,eAAO,MAAM,YAAY,UAChB,GAAG,UACF,MAAM,UACN,MAAM,WACL,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,KAC/B,SAAS,GAAG,IAmBd,CAAA;AAED,eAAO,MAAM,kBAAkB,cAClB,SAAS,GAAG,IAAI,WAClB,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,KAC/B,eAAe,GAAG,IAMX,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sage-bionetworks/react-datasheet-grid",
|
|
3
|
+
"private": false,
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/sage-bionetworks/react-datasheet-grid.git"
|
|
7
|
+
},
|
|
8
|
+
"version": "4.11.5-sage.1",
|
|
9
|
+
"description": "An Excel-like React component to create beautiful spreadsheets.",
|
|
10
|
+
"main": "./dist/index.cjs",
|
|
11
|
+
"module": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"react",
|
|
15
|
+
"reactjs",
|
|
16
|
+
"spreadsheet",
|
|
17
|
+
"grid",
|
|
18
|
+
"datasheet",
|
|
19
|
+
"excel",
|
|
20
|
+
"airtable",
|
|
21
|
+
"notion",
|
|
22
|
+
"table"
|
|
23
|
+
],
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"require": "./dist/index.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./dist/style.css": "./dist/style.css"
|
|
31
|
+
},
|
|
32
|
+
"author": "Nicolas Keller (https://github.com/nick-keller)",
|
|
33
|
+
"type": "module",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"homepage": "https://react-datasheet-grid.netlify.app/",
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@jest/types": "^27.4.2",
|
|
38
|
+
"@testing-library/jest-dom": "^5.15.1",
|
|
39
|
+
"@testing-library/react": "^13.4.0",
|
|
40
|
+
"@testing-library/user-event": "^13.5.0",
|
|
41
|
+
"@types/jsdom": "^16.2.13",
|
|
42
|
+
"@types/react": "^18.0.8",
|
|
43
|
+
"@types/throttle-debounce": "^2.1.0",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^4.28.0",
|
|
45
|
+
"@typescript-eslint/parser": "^4.28.0",
|
|
46
|
+
"@vitejs/plugin-react": "^5.1.3",
|
|
47
|
+
"@vitest/ui": "^4.0.18",
|
|
48
|
+
"concurrently": "^6.2.0",
|
|
49
|
+
"cpx": "^1.5.0",
|
|
50
|
+
"eslint": "^7.29.0",
|
|
51
|
+
"eslint-config-prettier": "^8.3.0",
|
|
52
|
+
"eslint-plugin-react": "^7.29.4",
|
|
53
|
+
"eslint-plugin-react-hooks": "^4.5.0",
|
|
54
|
+
"jsdom": "^16.6.0",
|
|
55
|
+
"prettier": "^2.3.1",
|
|
56
|
+
"react": "^18.1.0",
|
|
57
|
+
"react-dom": "^18.1.0",
|
|
58
|
+
"resize-observer-polyfill": "^1.5.1",
|
|
59
|
+
"rimraf": "^3.0.2",
|
|
60
|
+
"ts-node": "^10.9.1",
|
|
61
|
+
"typescript": "^4.9.4",
|
|
62
|
+
"vite": "^7.3.1",
|
|
63
|
+
"vite-plugin-dts": "^4.5.4",
|
|
64
|
+
"vite-plugin-react": "^4.0.1",
|
|
65
|
+
"vitest": "^4.0.18"
|
|
66
|
+
},
|
|
67
|
+
"files": [
|
|
68
|
+
"dist/**/*"
|
|
69
|
+
],
|
|
70
|
+
"peerDependencies": {
|
|
71
|
+
"react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
72
|
+
},
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"@tanstack/react-virtual": "^3.0.0-beta.18",
|
|
75
|
+
"classnames": "^2.3.1",
|
|
76
|
+
"fast-deep-equal": "^3.1.3",
|
|
77
|
+
"react-resize-detector": "^10.0.1",
|
|
78
|
+
"throttle-debounce": "^3.0.1"
|
|
79
|
+
},
|
|
80
|
+
"scripts": {
|
|
81
|
+
"build": "vite build",
|
|
82
|
+
"start": "vite preview",
|
|
83
|
+
"format": "prettier --write src/. && prettier --write example/src/.",
|
|
84
|
+
"lint": "eslint src/.",
|
|
85
|
+
"test": "vitest run"
|
|
86
|
+
}
|
|
87
|
+
}
|