@ishibashi0112/spreadsheet-grid 0.1.0 → 0.3.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 +29 -1
- package/dist/SpreadsheetGrid.d.ts +1 -1
- package/dist/hooks/useFilterPopoverController.d.ts +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.js +1113 -1087
- package/dist/model/gridTypes.d.ts +8 -0
- package/dist/style.css +1 -1
- package/dist/view/ColumnMenuPopover.d.ts +3 -1
- package/dist/view/DefaultGridBottomBar.d.ts +2 -1
- package/dist/view/DefaultGridTopBar.d.ts +4 -1
- package/dist/view/GridHeaderRow.d.ts +1 -2
- package/package.json +90 -89
package/README.md
CHANGED
|
@@ -18,8 +18,10 @@ A high-performance, virtualized spreadsheet / data grid for **React 19**, writte
|
|
|
18
18
|
- Sorting, per-column filters (`text` / `number` / `date` / `select` / `set` / `custom`), and a global filter.
|
|
19
19
|
- In-cell editing and clipboard copy / paste, with range selection and keyboard navigation.
|
|
20
20
|
- Optional auto-height rows for wrapped, variable-height content.
|
|
21
|
+
- External height control via `height` / `maxHeight` (e.g. `height="100%"` to follow the parent's height).
|
|
21
22
|
- Both **client-side** (`rows`) and **server-side** (`dataSource`, SSRM) row models.
|
|
22
23
|
- Themeable with CSS custom properties (`--ssg-*`) and a low-priority `@layer ssg-base`, so your own CSS or Tailwind utilities override the defaults without specificity battles. `className` / `classNames` slots are also provided.
|
|
24
|
+
- Toggle the top / bottom bars and their parts via props — whole bars (`showTopBar` / `showBottomBar`), the default top bar's summary chips and global-filter input, and the Rows/Columns counts in each bar.
|
|
23
25
|
- TypeScript-first, fully controlled API.
|
|
24
26
|
|
|
25
27
|
## Installation
|
|
@@ -75,6 +77,18 @@ export function Example() {
|
|
|
75
77
|
|
|
76
78
|
`rows` and `onRowsChange` make the grid a controlled component. A column needs at least `key` and `width`.
|
|
77
79
|
|
|
80
|
+
## Sizing
|
|
81
|
+
|
|
82
|
+
By default the grid caps its height at `480px` (`max-height`) and scrolls when the content is taller. Pass `height` to take explicit control — use `height="100%"` to follow the parent's height, or a pixel value:
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
<div style={{ height: 600, minHeight: 0 }}>
|
|
86
|
+
<SpreadsheetGrid rows={rows} columns={columns} height="100%" />
|
|
87
|
+
</div>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
For `height="100%"` to work, the parent must have a resolved height (its ancestors are sized, and a flex child needs `min-height: 0`). This is standard CSS the library can't resolve for you. `maxHeight` sets an upper bound and can be combined with `height` (explicit height, capped at `maxHeight`).
|
|
91
|
+
|
|
78
92
|
## Server-side mode (SSRM)
|
|
79
93
|
|
|
80
94
|
Pass a `dataSource` instead of `rows` to switch to server-side mode. The grid keeps the full scroll height for the total row count and fetches only the blocks near the viewport:
|
|
@@ -130,8 +144,10 @@ The full prop and type reference lives in [`src/components/spreadsheet-grid/API_
|
|
|
130
144
|
- ソート、列ごとのフィルター(`text` / `number` / `date` / `select` / `set` / `custom`)、グローバルフィルター。
|
|
131
145
|
- セル内編集とクリップボードのコピー/貼り付け、範囲選択、キーボード操作。
|
|
132
146
|
- 折り返し・可変行高に対応する auto-height 行(任意)。
|
|
147
|
+
- `height` / `maxHeight` によるスクロールコンテナ高さの外部制御(`height="100%"` で親要素の高さに追従)。
|
|
133
148
|
- **クライアントサイド**(`rows`)と**サーバーサイド**(`dataSource`、SSRM)の両行モデル。
|
|
134
149
|
- CSS カスタムプロパティ(`--ssg-*`)と優先度の低い `@layer ssg-base` によるテーマ設定。利用側の通常 CSS や Tailwind ユーティリティが特異度の競合なしに既定を上書きできます。`className` / `classNames` スロットも用意。
|
|
150
|
+
- トップ / ボトムバーとその構成要素(バー全体〔`showTopBar` / `showBottomBar`〕、既定トップバーの summary chips・グローバルフィルター入力、各バーの Rows/Columns 件数)を props で表示制御。
|
|
135
151
|
- TypeScript ファースト、完全 controlled な API。
|
|
136
152
|
|
|
137
153
|
### インストール
|
|
@@ -187,6 +203,18 @@ export function Example() {
|
|
|
187
203
|
|
|
188
204
|
`rows` と `onRowsChange` でグリッドは controlled になります。列には最低限 `key` と `width` が必要です。
|
|
189
205
|
|
|
206
|
+
### サイズ(高さ)
|
|
207
|
+
|
|
208
|
+
既定ではグリッドの高さは `480px`(`max-height`)で頭打ちになり、中身がそれより高いとスクロールします。`height` を渡すと高さを明示制御できます。`height="100%"` で親要素の高さに追従、`number` で px 指定です:
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
<div style={{ height: 600, minHeight: 0 }}>
|
|
212
|
+
<SpreadsheetGrid rows={rows} columns={columns} height="100%" />
|
|
213
|
+
</div>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
`height="100%"` を効かせるには、**親要素が確定高さを持つ**必要があります(祖先まで高さが確定している/flex 子なら `min-height: 0` が必要)。これは CSS の一般則のため本ライブラリ側では解決できません。`maxHeight` は高さの上限で、`height` と併用できます(明示高さ+上限)。
|
|
217
|
+
|
|
190
218
|
### サーバーサイドモード(SSRM)
|
|
191
219
|
|
|
192
220
|
`rows` の代わりに `dataSource` を渡すとサーバーサイドモードになります。総行数ぶんのスクロール高さを保ったまま、可視窓に近いブロックだけを取得します:
|
|
@@ -225,4 +253,4 @@ prop と型の完全なリファレンスは [`src/components/spreadsheet-grid/A
|
|
|
225
253
|
|
|
226
254
|
### ライセンス
|
|
227
255
|
|
|
228
|
-
[MIT](./LICENSE) © 2026 Yuki Sakakibara
|
|
256
|
+
[MIT](./LICENSE) © 2026 Yuki Sakakibara
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import './styles.css';
|
|
2
2
|
import type { SpreadsheetGridProps } from './model/gridTypes';
|
|
3
|
-
export declare function SpreadsheetGrid<T extends object>({ rows, dataSource, serverSideRefreshToken, columns, onRowsChange, onColumnsChange, rowKeyGetter, createRow, createOverflowColumn, rowHeight, autoHeight, estimateRowHeight, headerHeight, rowHeaderWidth, readOnly, canEditCell, enableRangeSelection, enableGlobalFilter, enableColumnFilter, enableSorting, enableRowHover, enableColumnHeaderHover, enableColumnMenu, noMatchingRowsText, noRowsText, renderTopBar, renderBottomBar, className, classNames, getRowClassName, }: SpreadsheetGridProps<T>): import("react").JSX.Element;
|
|
3
|
+
export declare function SpreadsheetGrid<T extends object>({ rows, dataSource, serverSideRefreshToken, columns, onRowsChange, onColumnsChange, rowKeyGetter, createRow, createOverflowColumn, rowHeight, autoHeight, estimateRowHeight, headerHeight, rowHeaderWidth, height, maxHeight, readOnly, canEditCell, enableRangeSelection, enableGlobalFilter, enableColumnFilter, enableSorting, enableRowHover, enableColumnHeaderHover, enableColumnMenu, noMatchingRowsText, noRowsText, showTopBar, showBottomBar, showTopBarSummary, showTopBarFilter, showTopBarCounts, showBottomBarCounts, renderTopBar, renderBottomBar, className, classNames, getRowClassName, }: SpreadsheetGridProps<T>): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
2
|
import type { ColumnFilterValue, GridColumn } from '../model/gridTypes';
|
|
3
3
|
type HeaderFilterPopoverState = {
|
|
4
4
|
columnKey: string;
|
|
@@ -23,7 +23,7 @@ export declare const useFilterPopoverController: <T>({ visibleColumns, columnFil
|
|
|
23
23
|
filterSelectRef: RefObject<HTMLSelectElement | null>;
|
|
24
24
|
isFilterPopoverOpen: boolean;
|
|
25
25
|
openedFilterColumn: GridColumn<T> | null;
|
|
26
|
-
openColumnFilterPopover: (column: GridColumn<T
|
|
26
|
+
openColumnFilterPopover: (column: GridColumn<T>) => void;
|
|
27
27
|
closeColumnFilterPopover: () => void;
|
|
28
28
|
updateFilterPopoverDraft: (value: string) => void;
|
|
29
29
|
};
|