@ishibashi0112/spreadsheet-grid 0.13.0 → 0.14.0
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/README.md +469 -467
- package/dist/SpreadsheetGrid.d.ts +1 -1
- package/dist/hooks/useGridHistoryController.d.ts +23 -0
- package/dist/hooks/useGridKeyboardInteractions.d.ts +4 -1
- package/dist/index.cjs +8 -8
- package/dist/index.js +1741 -1462
- package/dist/logic/clearCells.d.ts +22 -0
- package/dist/logic/history.d.ts +16 -0
- package/dist/logic/setFilterSelection.d.ts +5 -0
- package/dist/model/gridTypes.d.ts +12 -0
- package/dist/view/ColumnFilterPopover.d.ts +1 -5
- package/package.json +13 -5
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CellCoord, GridColumn, GridSelection } from '../model/gridTypes';
|
|
2
|
+
type ClearTarget = {
|
|
3
|
+
startRow: number;
|
|
4
|
+
endRow: number;
|
|
5
|
+
startCol: number;
|
|
6
|
+
endCol: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const resolveClearTarget: (selection: GridSelection, activeCell: CellCoord | null, viewRowCount: number, columnCount: number) => ClearTarget | null;
|
|
9
|
+
type ClearCellsArgs<T extends object> = {
|
|
10
|
+
rows: T[];
|
|
11
|
+
resolveSourceIndex: (viewIndex: number) => number | undefined;
|
|
12
|
+
columns: GridColumn<T>[];
|
|
13
|
+
selection: GridSelection;
|
|
14
|
+
activeCell: CellCoord | null;
|
|
15
|
+
viewRowCount: number;
|
|
16
|
+
canWriteCell: (originalRowIndex: number, colIndex: number, row: T, column: GridColumn<T>) => boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare const clearCellsInSelection: <T extends object>({ rows, resolveSourceIndex, columns, selection, activeCell, viewRowCount, canWriteCell, }: ClearCellsArgs<T>) => {
|
|
19
|
+
nextRows: T[];
|
|
20
|
+
changed: boolean;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type HistoryStack<S> = {
|
|
2
|
+
past: S[];
|
|
3
|
+
future: S[];
|
|
4
|
+
};
|
|
5
|
+
export declare const createHistoryStack: <S>() => HistoryStack<S>;
|
|
6
|
+
export declare const canUndoHistory: <S>(stack: HistoryStack<S>) => boolean;
|
|
7
|
+
export declare const canRedoHistory: <S>(stack: HistoryStack<S>) => boolean;
|
|
8
|
+
export declare const pushHistory: <S>(stack: HistoryStack<S>, snapshot: S, limit: number) => HistoryStack<S>;
|
|
9
|
+
export declare const undoHistory: <S>(stack: HistoryStack<S>, current: S) => {
|
|
10
|
+
stack: HistoryStack<S>;
|
|
11
|
+
snapshot: S;
|
|
12
|
+
} | null;
|
|
13
|
+
export declare const redoHistory: <S>(stack: HistoryStack<S>, current: S) => {
|
|
14
|
+
stack: HistoryStack<S>;
|
|
15
|
+
snapshot: S;
|
|
16
|
+
} | null;
|
|
@@ -35,6 +35,10 @@ export type CellRange = {
|
|
|
35
35
|
start: CellCoord;
|
|
36
36
|
end: CellCoord;
|
|
37
37
|
};
|
|
38
|
+
export type UndoRedoState = {
|
|
39
|
+
canUndo: boolean;
|
|
40
|
+
canRedo: boolean;
|
|
41
|
+
};
|
|
38
42
|
export type GridSelection = {
|
|
39
43
|
type: 'cell';
|
|
40
44
|
range: CellRange;
|
|
@@ -399,6 +403,11 @@ export type SpreadsheetGridHandle<T> = {
|
|
|
399
403
|
isRowSelected: (rowKey: GridRowKey) => boolean;
|
|
400
404
|
selectAllRows: () => void;
|
|
401
405
|
clearRowSelection: () => void;
|
|
406
|
+
undo: () => void;
|
|
407
|
+
redo: () => void;
|
|
408
|
+
canUndo: () => boolean;
|
|
409
|
+
canRedo: () => boolean;
|
|
410
|
+
clearUndoHistory: () => void;
|
|
402
411
|
openFilterManager: () => void;
|
|
403
412
|
closeFilterManager: () => void;
|
|
404
413
|
};
|
|
@@ -429,6 +438,9 @@ export type SpreadsheetGridProps<T> = {
|
|
|
429
438
|
readOnly?: boolean;
|
|
430
439
|
dimReadOnlyCells?: boolean;
|
|
431
440
|
canEditCell?: (rowIndex: number, colIndex: number, row: T, column: GridColumn<T>) => boolean;
|
|
441
|
+
enableUndoRedo?: boolean;
|
|
442
|
+
undoHistoryLimit?: number;
|
|
443
|
+
onUndoRedoStateChange?: (state: UndoRedoState) => void;
|
|
432
444
|
enableRangeSelection?: boolean;
|
|
433
445
|
enableRowSelection?: boolean;
|
|
434
446
|
rowSelectionMode?: RowSelectionMode;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
|
+
import { type ColumnFilterSetSelection } from '../logic/setFilterSelection';
|
|
2
3
|
export type ColumnFilterPopoverLayout = {
|
|
3
4
|
top: number;
|
|
4
5
|
left: number;
|
|
@@ -8,11 +9,6 @@ export type ColumnFilterPopoverOption = {
|
|
|
8
9
|
label: string;
|
|
9
10
|
value: string;
|
|
10
11
|
};
|
|
11
|
-
export type ColumnFilterSetSelection = {
|
|
12
|
-
mode: 'include' | 'exclude';
|
|
13
|
-
values: ReadonlySet<string>;
|
|
14
|
-
};
|
|
15
|
-
export declare const isSetValueSelected: (selection: ColumnFilterSetSelection | null, value: string) => boolean;
|
|
16
12
|
type ColumnFilterPopoverProps = {
|
|
17
13
|
isOpen: boolean;
|
|
18
14
|
themeClassName?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ishibashi0112/spreadsheet-grid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "React 19 製のカスタム仮想化データグリッド。100 万行対応の仮想化・3 ペイン固定列・ソート/フィルター・クライアント/サーバーサイド行モデル対応。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -46,6 +46,13 @@
|
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=18"
|
|
48
48
|
},
|
|
49
|
+
"devEngines": {
|
|
50
|
+
"packageManager": {
|
|
51
|
+
"name": "pnpm",
|
|
52
|
+
"version": "11.12.0",
|
|
53
|
+
"onFail": "download"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
49
56
|
"publishConfig": {
|
|
50
57
|
"access": "public"
|
|
51
58
|
},
|
|
@@ -74,15 +81,16 @@
|
|
|
74
81
|
"typescript": "~6.0.2",
|
|
75
82
|
"typescript-eslint": "^8.59.2",
|
|
76
83
|
"vite": "^8.0.12",
|
|
84
|
+
"vite-plus": "^0.2.4",
|
|
77
85
|
"vitest": "^4.1.9"
|
|
78
86
|
},
|
|
79
87
|
"scripts": {
|
|
80
|
-
"dev": "
|
|
81
|
-
"build": "tsc -b &&
|
|
82
|
-
"build:lib": "
|
|
88
|
+
"dev": "vp dev",
|
|
89
|
+
"build": "tsc -b && vp build",
|
|
90
|
+
"build:lib": "vp build --config vite.lib.config.ts && tsc -p tsconfig.lib.json && node scripts/emit-layer-css.mjs",
|
|
83
91
|
"build:types": "tsc -p tsconfig.lib.json",
|
|
84
92
|
"lint": "eslint .",
|
|
85
|
-
"preview": "
|
|
93
|
+
"preview": "vp preview",
|
|
86
94
|
"test": "vitest run",
|
|
87
95
|
"test:watch": "vitest",
|
|
88
96
|
"typecheck:test": "tsc --noEmit -p tsconfig.vitest.json"
|