@ishibashi0112/spreadsheet-grid 0.12.0 → 0.13.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 +28 -0
- package/dist/SpreadsheetGrid.d.ts +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.js +1194 -1179
- package/dist/logic/cellOverflowTooltip.d.ts +5 -0
- package/dist/model/gridTypes.d.ts +3 -0
- package/dist/view/GridBodyLayer.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@ A high-performance, virtualized spreadsheet / data grid for **React 19**, writte
|
|
|
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
21
|
- Auto-fit column widths to content on data load — `autoSizeColumns="onMount"` (once, on first data) or `"onDataChange"` (every time `rows` changes, e.g. after a form submit). Same engine as the column menu's "Autosize All Columns"; opt individual columns out with `suppressAutoSize`.
|
|
22
|
+
- Full-text tooltip on truncated cells — `showCellOverflowTooltip` shows the full value on hover, but only when the cell is actually clipped (…).
|
|
23
|
+
- Japanese-aware line wrapping — per-column `wordBreak` / `lineBreak`, including `wordBreak: 'auto-phrase'` for phrase-based breaks on Chromium (BudouX). Cross-browser BudouX recipe in the API reference.
|
|
22
24
|
- External height control via `height` / `maxHeight` (e.g. `height="100%"` to follow the parent's height).
|
|
23
25
|
- Both **client-side** (`rows`) and **server-side** (`dataSource`, SSRM) row models.
|
|
24
26
|
- Themeable with CSS custom properties (`--ssg-*`, defined at zero specificity so your overrides always win). Base styles are plain unlayered CSS with single-class specificity, so they survive CSS resets such as Tailwind Preflight; a cascade-layers variant (`style.layer.css`) is also shipped. `className` / `classNames` slots are provided.
|
|
@@ -123,6 +125,18 @@ By default the grid caps its height at `480px` (`max-height`) and scrolls when t
|
|
|
123
125
|
|
|
124
126
|
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`).
|
|
125
127
|
|
|
128
|
+
### Auto-height rows
|
|
129
|
+
|
|
130
|
+
Variable row height needs **two switches, both required**: the grid prop `autoHeight` (the master switch, default `false`) **and** at least one column with `autoHeight: true` (that column wraps and drives the row height). A cell grows only when `grid autoHeight && column.autoHeight` are both true. Auto-height is active only up to **50,000 rows**; beyond that it falls back to uniform `rowHeight`. `estimateRowHeight` is the placeholder for off-screen (not-yet-measured) rows — not a cap. See [`API_REFERENCE.md`](./src/components/spreadsheet-grid/API_REFERENCE.md) for details.
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
<SpreadsheetGrid
|
|
134
|
+
rows={rows}
|
|
135
|
+
columns={[{ key: 'note', title: 'Note', width: 320, autoHeight: true }]}
|
|
136
|
+
autoHeight // master switch — without it, the column's autoHeight is ignored
|
|
137
|
+
/>
|
|
138
|
+
```
|
|
139
|
+
|
|
126
140
|
### Auto-sizing columns
|
|
127
141
|
|
|
128
142
|
Set `autoSizeColumns` to fit column widths to their content when data arrives — no imperative calls or effects needed on your side:
|
|
@@ -237,6 +251,8 @@ The full prop and type reference lives in [`src/components/spreadsheet-grid/API_
|
|
|
237
251
|
- セル内編集とクリップボードのコピー/貼り付け、範囲選択、キーボード操作。
|
|
238
252
|
- 折り返し・可変行高に対応する auto-height 行(任意)。
|
|
239
253
|
- データ投入時に列幅を内容へ自動フィット — `autoSizeColumns="onMount"`(初回にデータが載った一度きり)/ `"onDataChange"`(`rows` が変わるたび。フォーム送信結果の差し替え等)。列メニュー「すべての列の幅を自動調整」と同一エンジンで、列個別の除外は `suppressAutoSize`。
|
|
254
|
+
- 省略(…)セルの全文ツールチップ — `showCellOverflowTooltip` でホバー時に全文表示(実際にクリップされているセルのみ)。
|
|
255
|
+
- 日本語対応の折り返し — 列ごとの `wordBreak` / `lineBreak`。`wordBreak: 'auto-phrase'` で Chromium(Chrome / Edge)の文節折り返し(BudouX)。クロスブラウザの BudouX レシピは API リファレンス参照。
|
|
240
256
|
- `height` / `maxHeight` によるスクロールコンテナ高さの外部制御(`height="100%"` で親要素の高さに追従)。
|
|
241
257
|
- **クライアントサイド**(`rows`)と**サーバーサイド**(`dataSource`、SSRM)の両行モデル。
|
|
242
258
|
- CSS カスタムプロパティ(`--ssg-*`。特異度 0 で定義され、利用側の上書きが常に勝ちます)によるテーマ設定。基底スタイルは未レイヤーの単一クラス特異度で、Tailwind Preflight などの CSS リセットに壊されません。カスケードレイヤー版(`style.layer.css`)も同梱。`className` / `classNames` スロットも用意。
|
|
@@ -341,6 +357,18 @@ export function Example() {
|
|
|
341
357
|
|
|
342
358
|
`height="100%"` を効かせるには、**親要素が確定高さを持つ**必要があります(祖先まで高さが確定している/flex 子なら `min-height: 0` が必要)。これは CSS の一般則のため本ライブラリ側では解決できません。`maxHeight` は高さの上限で、`height` と併用できます(明示高さ+上限)。
|
|
343
359
|
|
|
360
|
+
#### 可変行高(auto-height)
|
|
361
|
+
|
|
362
|
+
行高を可変にするには**2つのスイッチが両方必要**です。グリッド props の `autoHeight`(大本のスイッチ・既定 `false`)と、**少なくとも1列に `column.autoHeight: true`**(その列が折り返して行高を駆動)。セルが可変になるのは「グリッド `autoHeight` && 列 `autoHeight`」が両方 true のときだけです。有効なのは **50,000 行以内**で、超えると uniform 行高(`rowHeight`)へフォールバックします。`estimateRowHeight` は画面外(未測定)行の推定値で、上限ではありません。詳細は [`API_REFERENCE.md`](./src/components/spreadsheet-grid/API_REFERENCE.md)。
|
|
363
|
+
|
|
364
|
+
```tsx
|
|
365
|
+
<SpreadsheetGrid
|
|
366
|
+
rows={rows}
|
|
367
|
+
columns={[{ key: 'note', title: '備考', width: 320, autoHeight: true }]}
|
|
368
|
+
autoHeight // 大本のスイッチ(これが無いと列側 autoHeight は無視される)
|
|
369
|
+
/>
|
|
370
|
+
```
|
|
371
|
+
|
|
344
372
|
#### 列幅の自動調整(autoSizeColumns)
|
|
345
373
|
|
|
346
374
|
`autoSizeColumns` を渡すと、データ投入時に列幅を内容へ自動フィットします(利用側でトークンや effect は不要):
|
|
@@ -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: rowHeightProp, autoHeight, estimateRowHeight, headerHeight: headerHeightProp, density, theme, rowHeaderWidth, height, maxHeight, readOnly, dimReadOnlyCells, canEditCell, enableRangeSelection, enableRowSelection, rowSelectionMode, enableSelectAllRows: enableSelectAllRowsProp, rowSelection: rowSelectionProp, selectedRowKeys: selectedRowKeysProp, onRowSelectionChange, enableGlobalFilter, enableColumnFilter, enableSorting, enableColumnResize, autoSizeColumns, enableRowHover, enableColumnHeaderHover, enableColumnMenu, noMatchingRowsText, noRowsText, showTopBar, showBottomBar, showTopBarSummary, showTopBarFilter, globalFilterPlaceholder, globalFilterIcon, showTopBarCounts, showBottomBarCounts, showFilterChipBar, renderTopBar, renderBottomBar, className, classNames, getRowClassName, enableContextMenu, getContextMenuItems, onContextMenuOpen, ref, onStateChange, }: SpreadsheetGridProps<T>): import("react").JSX.Element;
|
|
3
|
+
export declare function SpreadsheetGrid<T extends object>({ rows, dataSource, serverSideRefreshToken, columns, onRowsChange, onColumnsChange, rowKeyGetter, createRow, createOverflowColumn, rowHeight: rowHeightProp, autoHeight, estimateRowHeight, headerHeight: headerHeightProp, density, theme, rowHeaderWidth, height, maxHeight, readOnly, dimReadOnlyCells, canEditCell, enableRangeSelection, enableRowSelection, rowSelectionMode, enableSelectAllRows: enableSelectAllRowsProp, rowSelection: rowSelectionProp, selectedRowKeys: selectedRowKeysProp, onRowSelectionChange, enableGlobalFilter, enableColumnFilter, enableSorting, enableColumnResize, autoSizeColumns, showCellOverflowTooltip, enableRowHover, enableColumnHeaderHover, enableColumnMenu, noMatchingRowsText, noRowsText, showTopBar, showBottomBar, showTopBarSummary, showTopBarFilter, globalFilterPlaceholder, globalFilterIcon, showTopBarCounts, showBottomBarCounts, showFilterChipBar, renderTopBar, renderBottomBar, className, classNames, getRowClassName, enableContextMenu, getContextMenuItems, onContextMenuOpen, ref, onStateChange, }: SpreadsheetGridProps<T>): import("react").JSX.Element;
|