@ishibashi0112/spreadsheet-grid 0.2.0 → 0.4.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 CHANGED
@@ -18,6 +18,7 @@ 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.
23
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.
@@ -76,6 +77,18 @@ export function Example() {
76
77
 
77
78
  `rows` and `onRowsChange` make the grid a controlled component. A column needs at least `key` and `width`.
78
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
+
79
92
  ## Server-side mode (SSRM)
80
93
 
81
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:
@@ -131,6 +144,7 @@ The full prop and type reference lives in [`src/components/spreadsheet-grid/API_
131
144
  - ソート、列ごとのフィルター(`text` / `number` / `date` / `select` / `set` / `custom`)、グローバルフィルター。
132
145
  - セル内編集とクリップボードのコピー/貼り付け、範囲選択、キーボード操作。
133
146
  - 折り返し・可変行高に対応する auto-height 行(任意)。
147
+ - `height` / `maxHeight` によるスクロールコンテナ高さの外部制御(`height="100%"` で親要素の高さに追従)。
134
148
  - **クライアントサイド**(`rows`)と**サーバーサイド**(`dataSource`、SSRM)の両行モデル。
135
149
  - CSS カスタムプロパティ(`--ssg-*`)と優先度の低い `@layer ssg-base` によるテーマ設定。利用側の通常 CSS や Tailwind ユーティリティが特異度の競合なしに既定を上書きできます。`className` / `classNames` スロットも用意。
136
150
  - トップ / ボトムバーとその構成要素(バー全体〔`showTopBar` / `showBottomBar`〕、既定トップバーの summary chips・グローバルフィルター入力、各バーの Rows/Columns 件数)を props で表示制御。
@@ -189,6 +203,18 @@ export function Example() {
189
203
 
190
204
  `rows` と `onRowsChange` でグリッドは controlled になります。列には最低限 `key` と `width` が必要です。
191
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
+
192
218
  ### サーバーサイドモード(SSRM)
193
219
 
194
220
  `rows` の代わりに `dataSource` を渡すとサーバーサイドモードになります。総行数ぶんのスクロール高さを保ったまま、可視窓に近いブロックだけを取得します:
@@ -13,6 +13,7 @@ type CellEditorLayerProps = {
13
13
  initialValue: string;
14
14
  onCommit: (value: string, direction?: EditorCommitDirection) => void;
15
15
  onCancel: () => void;
16
+ align?: 'left' | 'center' | 'right';
16
17
  };
17
- export declare function CellEditorLayer({ rect, headerHeight, leadingWidth, baseOffset, initialValue, onCommit, onCancel, }: CellEditorLayerProps): import("react").JSX.Element | null;
18
+ export declare function CellEditorLayer({ rect, headerHeight, leadingWidth, baseOffset, initialValue, onCommit, onCancel, align, }: CellEditorLayerProps): import("react").JSX.Element | null;
18
19
  export default CellEditorLayer;
@@ -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, showTopBar, showBottomBar, showTopBarSummary, showTopBarFilter, showTopBarCounts, showBottomBarCounts, 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, enableColumnResize, enableRowHover, enableColumnHeaderHover, enableColumnMenu, noMatchingRowsText, noRowsText, showTopBar, showBottomBar, showTopBarSummary, showTopBarFilter, showTopBarCounts, showBottomBarCounts, renderTopBar, renderBottomBar, className, classNames, getRowClassName, }: SpreadsheetGridProps<T>): import("react").JSX.Element;