@ishibashi0112/spreadsheet-grid-solid 1.15.0 → 1.16.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/API_REFERENCE.md +58 -5
- package/README.md +2 -2
- package/dist/devWarnings.d.ts +4 -0
- package/dist/features/cellSpan.d.ts +2 -0
- package/dist/features/types.d.ts +7 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3930 -3738
- package/dist/model/gridTypes.d.ts +4 -0
- package/dist/source/index.jsx +570 -281
- package/dist/style.css +1 -1
- package/dist/style.layer.css +1 -1
- package/dist/view/GridBodyLayer.d.ts +4 -0
- package/package.json +3 -3
- package/skills/spreadsheet-grid-solid/SKILL.md +1 -0
package/API_REFERENCE.md
CHANGED
|
@@ -1383,6 +1383,8 @@ class InventoryGrid extends HTMLElement {
|
|
|
1383
1383
|
| `groupLabel` | `'value' \| 'formatted' \| CellValueFormatter<T>` | `'value'` | 行グルーピングのグループ行の見出しの文字(1.1.0 から)。`'value'` は値の文字(1.0 までと同じ)、`'formatted'` は列の `valueFormatter`(セルと同じ表示名。無ければ値の文字)、関数はその返り値(`row` はそのグループの最初の行)。空白のグループは「(空白)」のまま。エクスポートの小計の行の見出しはコピーと同じ規則(`formatClipboardValue`)。詳細は「値と表示名が別の列」節。 |
|
|
1384
1384
|
| `exportable` | `boolean` | `true` | `false` で、この列を CSV / TSV の書き出し(`exportCsv` / `downloadCsv`。scope `'selection'` も)と `getExportData` から外す(1.3.0 から)。操作のボタンの列や社内だけの ID の列に使う。範囲を選んだコピー(`Ctrl/Cmd+C`)には今までどおり出す(選んだとおりに写す)。行を外すのは props の `isRowExportable`。 |
|
|
1385
1385
|
| `selectionAggregate` | `boolean` | `true` | `false` で、この列のセルを選択範囲の集計(`showSelectionAggregates`)の合計 / 平均(と `slotContext.selectionAggregates` の最小 / 最大)に数えない。データの個数には数える(1.2.0 から)。JAN・郵便番号・社員番号のように数字の文字列でも数ではない列に使う。グループ集計と合計行(`aggFunc`)には効かない。 |
|
|
1386
|
+
| `spanRows` | `boolean \| ((params: GridSpanRowsParams<T>) => boolean)` | — | `true` で、今の並び(並べ替え・絞り込み・開閉の後)で値が同じ隣り合う行を縦に 1 つのセルにする(1.16.0 から。`/lite` では `cellSpanFeature` が要る)。値は `Object.is` で比べ(`Date` は時刻、配列は中身)、空の値(`null` / `undefined` / `''` / 空の配列)は結ばない。関数なら `{ valueA, valueB, rowA, rowB, column }`(上の行が A)を受けて、その答えで結ぶ。行のデータは変えず見え方だけを変える。詳細は「セルの結合」節。 |
|
|
1387
|
+
| `colSpan` | `(ctx: GridColSpanContext<T>) => number` | — | このセルが使う列の数(自分を含む。1 以下は結ばない)を返す(1.16.0 から)。`ctx` は `{ row, rowIndex, rowKey, column, value }`。見えている列で数え、固定の境(左固定 / 中央 / 右固定)と合成列は越えない。縦の結合(`spanRows`)と重なったら縦が勝つ。行ごとに呼ぶので純粋で軽いこと。答えは行のオブジェクトごとに覚える(同じ行のオブジェクトなら、並べ替えで `rowIndex` が変わっても呼び直さない)ので、答えは `row` と `value` から決める。詳細は「セルの結合」節。 |
|
|
1386
1388
|
| `getValue` | `(row: T) => unknown` | `row[key]` | 値アクセサ。`setValue` の無い列へ書き込むと値は `row[key]` へ入り、表示(`getValue`)は変わらない。計算列は `editable: false` にするか `setValue` を渡す(開発時は、行に無いプロパティを足した列ごとに 1 回 console.warn)。 |
|
|
1387
1389
|
| `setValue` | `(row: T, value: unknown) => T` | — | 値ライター(新しい行を返す)。 |
|
|
1388
1390
|
| `renderCell` | `(ctx: CellRenderContext<T>) => ReactNode` | プレーン `<span>` | カスタムセル描画。`detailRow` prop 有効時は `ctx.detail`(`{ expanded, expandable, toggle, setExpanded }`)で[展開行](https://datasheet-grid.vercel.app/docs/guides/detail-row)のトグルを自前配置できる。 |
|
|
@@ -2207,6 +2209,37 @@ const columnGroups: GridColumnGroup[] = [
|
|
|
2207
2209
|
- **ツールパネル**: 「列」タブはグループごとにまとめて(入れ子のグループは一段ずつ右へ)並べます。グループのチェックは中の列が全部表示のときにチェック、一部のときに「−」で、押すと中の列をまとめて隠す(全部表示のとき。表示の列が無くなるときは先頭の列を残す)か、まとめて表示します(検索で絞っているときは見えている中の列だけ)。検索はグループの名前でも当たり、列のつまみで動かせるのは同じグループの中だけです(列見出しのドラッグと同じ)。
|
|
2208
2210
|
- **読み上げ**: 段ごとに `role="row"`、グループの見出しは `role="columnheader"` + `aria-colspan`(「アクセシビリティ」節)。
|
|
2209
2211
|
|
|
2212
|
+
### セルの結合(`spanRows` / `colSpan`)
|
|
2213
|
+
|
|
2214
|
+
列の `spanRows: true` で、今の並び(並べ替え・絞り込み・開閉の後)で値が同じ隣り合う行を縦に 1 つのセルにします。`colSpan` は行ごとに、セルが右の列も使う数を返します(1.16.0 から)。行のデータ(`rows`)は変えず、見え方だけを変えます。`/lite` では `cellSpanFeature` を足します(`standardFeatures` には入っていない)。
|
|
2215
|
+
|
|
2216
|
+
```tsx
|
|
2217
|
+
const columns: GridColumn<Member>[] = [
|
|
2218
|
+
{ key: 'dept', title: '部署', width: 120, spanRows: true },
|
|
2219
|
+
// 部署が同じときだけチームを結ぶ(別の部署の同じ名前のチームはつなげない)
|
|
2220
|
+
{ key: 'team', title: 'チーム', width: 120, spanRows: ({ rowA, rowB }) => rowA.dept === rowB.dept && rowA.team === rowB.team },
|
|
2221
|
+
{ key: 'name', title: '名前', width: 160 },
|
|
2222
|
+
// 小計の行はメモを右の列まで広げる
|
|
2223
|
+
{ key: 'memo', title: 'メモ', width: 240, colSpan: ({ row }) => (row.kind === 'subtotal' ? 2 : 1) },
|
|
2224
|
+
{ key: 'amount', title: '金額', width: 120 },
|
|
2225
|
+
];
|
|
2226
|
+
```
|
|
2227
|
+
|
|
2228
|
+
| 場面 | 動き |
|
|
2229
|
+
| --- | --- |
|
|
2230
|
+
| 結ぶ条件 | `true` は値を `Object.is` で比べる(`Date` は時刻、配列は中身)。空の値(`null` / `undefined` / `''` / 空の配列)は結ばない。関数は `{ valueA, valueB, rowA, rowB, column }`(上の行が A)を受けて結ぶかを返す |
|
|
2231
|
+
| 切れる所 | グループ行・ラベル行・入力行の前後、展開行を開いた行の下、ツリーデータで深さが変わる所、ページの境(ページ送り)。ツリーデータの木の列(`treeData.column`。`spanRows` / `colSpan` を書くと開発時に 1 回警告)と、子を持つ行の集計のセルは結ばない |
|
|
2232
|
+
| 横の結合 | `colSpan` は見えている列で数え(列を隠すと、その右の見えている列を使う)、固定の境(左固定 / 中央 / 右固定)と合成列(展開のトグル・行ドラッグの掴み手)は越えない。縦の結合と重なったら縦が勝つ。隠れた右の列の値は行のデータに残り(ふつうのコピー・CSV・エクスポートには出る)、`Delete`・貼り付け・置換では書かない |
|
|
2233
|
+
| 文字 | 結合の上に寄せ、縦にスクロールしても結合の見えている所の一番上に留まる。マウスを重ねた行の色は結合のセルに塗らない |
|
|
2234
|
+
| 選択とキー | 結合のどこを押しても左上のセルがアクティブ。範囲の選択は結合をすべて含むように広がる。キーで結合に入ると入った行(列)を覚え、結合を出るときはそこから動く(Excel と同じ)。`Home` / `End` / `Ctrl+←` / `Ctrl+→` も入った行から動く。`Shift`+矢印・`Shift`+クリックで広げた範囲は、縮める・選び直すと広げる前の起点と終わりから求め直す。1 画面より高い結合を押してもスクロールしない(キーで移ったときは、左上の行が見えていなければ左上へスクロールする)。`PageDown` / `PageUp` は結合の端から 1 画面動く。値が変わって結合が伸び、アクティブセルや範囲の端が結合に隠れたら左上へ寄せる。`startEditing` に隠れたセルを渡すと結合の左上を編集する |
|
|
2235
|
+
| 編集 | エディタは結合の見えている一番上の 1 行に開く(`multiline` は結合の高さ)。確定・チェックボックス・貼り付け・切り取り・`Delete`・置換は、結合したすべての行へ同じ値を書く(`onRowsChange` は 1 回、元に戻すも 1 回)。ただし `canEditCell` が `false` の行と `validate` で拒んだ行には写さない(その行で結合が切れる)。`select` の `fillRow` のほかの項目もすべての行へ書く。貼り付けで結合の隠れた行(縦の結合の 2 行目から・横の結合の右の列)へ来た値は書かず、左上の値(横の結合ではそのセルの値)と違えば `onPasteSkipped` に `'readOnly'` で知らせる(切り取りの元も空にしない)。1 つの結合のコピー(と切り取り)は 1 つの値として貼る(貼った先が結合ならその結合を埋め、ほかの結合へははみ出さない)。貼った範囲が下の結合の途中までなら、範囲の外の行は書き換えず、結合はそこで分かれる。何も変わらない書き込みでは `onRowsChange` を呼ばない |
|
|
2236
|
+
| コピーと書き出し | ふつうのコピー・CSV / TSV・`getExportData` の `rows` は行ごとに同じ値を出す(横の結合で隠れた列は、その行の自分の値)。書式つきのコピー(`copyFormat: 'rich'`)は `rowspan` / `colspan` で書く。`getExportData({ includeCellSpans: true })` の `cellSpans` に結合の位置(出す行の中で求め、ページの境と、展開行を開いた行の下では切らない。Excel の結合セルに渡せる。「Excel / スプレッドシート エクスポート」節。`/lite` では `exportFeature` も要る) |
|
|
2237
|
+
| 検索 | 結合のセルは 1 つと数える(置換の数も。ページ送りではページごと) |
|
|
2238
|
+
| 集計と変更の追跡 | 選択範囲の集計(合計・平均・データの個数)は行ごとに数える(3 行の結合は 3 つ)。右クリックメニューの「このセルの変更を取り消す」(`trackChanges`)は結合のすべての行のそのセルを取り消す |
|
|
2239
|
+
| 効かないとき | serverSide(`dataSource`。開発時に 1 回警告)・行のドラッグの間(離すと戻る)・読み込み中の骨組みの行。結合がある間は `animateRows` が止まり、`autoHeight` の行の高さは結合のセルの中身では決めない |
|
|
2240
|
+
|
|
2241
|
+
公開の CSS は結合のセルの `.ssg-body-cell--spanned`(`aria-rowspan` / `aria-colspan` と `data-ssg-row-span` / `data-ssg-col-span` が付く)と、その中で文字を留める `.ssg-cell-span-content`。
|
|
2242
|
+
|
|
2210
2243
|
### ツリーデータ(`treeData`)
|
|
2211
2244
|
|
|
2212
2245
|
`rows` は平らな配列のまま、`treeData.getParentKey(row)` が親の行のキー(`rowKeyGetter` の値)を返すと、開閉できる階層の表になります(1.9.0 から)。
|
|
@@ -2637,7 +2670,7 @@ serverSide(SSRM)の注意: `'view'` は未ロード行をスキップ(= ロー
|
|
|
2637
2670
|
| --- | --- |
|
|
2638
2671
|
| `getExportData(options?)` | 列メタ + 2 次元セルの、シリアライズ非依存な整形済みデータを返す(純粋・副作用なし)。 |
|
|
2639
2672
|
|
|
2640
|
-
`GridExportOptions`: `scope`(既定 `'view'`。上記 **scope 対応表**と同一規則を共有)、`includeLabelRows`(既定 `false`。ラベル行を含める。含めたときは `rowKinds` で行種を判別できる)、`includeTotalRow`(既定 `false`。合計行を末尾に含める。scope `'view'` のときだけで、`rowKinds` の `'total'` で判別できる)、`includePinnedRows`(既定 `false`。固定行を含める。`exportCsv` と同じ位置で、`rowKinds` の `'pinned'` で判別できる)、`includeGroupRows`(既定 `false`。行グルーピング中の小計の行。`exportCsv` と同じで、`rowKinds` の `'group'` で判別できる)、`includeColumnGroups`(既定 `false`。列のグループの段を `columnGroups` に入れる。1.6.0 から)、`rows`(`{ start, count }`。scope が出すデータの行のうち `start` 番目(0 始まり)から `count` 行だけを出す。指定したときはデータの行だけで、ラベル行・小計の行・合計行・固定行は数えず出さない。100 万行の表から 50 行だけを読むときなど。1.14.0 から)、`includeRowKeys`(既定 `false`。`rowKeys` に各行の行キーを入れる。1.14.0 から)。
|
|
2673
|
+
`GridExportOptions`: `scope`(既定 `'view'`。上記 **scope 対応表**と同一規則を共有)、`includeLabelRows`(既定 `false`。ラベル行を含める。含めたときは `rowKinds` で行種を判別できる)、`includeTotalRow`(既定 `false`。合計行を末尾に含める。scope `'view'` のときだけで、`rowKinds` の `'total'` で判別できる)、`includePinnedRows`(既定 `false`。固定行を含める。`exportCsv` と同じ位置で、`rowKinds` の `'pinned'` で判別できる)、`includeGroupRows`(既定 `false`。行グルーピング中の小計の行。`exportCsv` と同じで、`rowKinds` の `'group'` で判別できる)、`includeColumnGroups`(既定 `false`。列のグループの段を `columnGroups` に入れる。1.6.0 から)、`rows`(`{ start, count }`。scope が出すデータの行のうち `start` 番目(0 始まり)から `count` 行だけを出す。指定したときはデータの行だけで、ラベル行・小計の行・合計行・固定行は数えず出さない。100 万行の表から 50 行だけを読むときなど。1.14.0 から)、`includeRowKeys`(既定 `false`。`rowKeys` に各行の行キーを入れる。1.14.0 から)、`includeCellSpans`(既定 `false`。セルの結合(`spanRows` / `colSpan`)の位置を `cellSpans` に入れる。1.16.0 から)。
|
|
2641
2674
|
|
|
2642
2675
|
戻り値 `GridExportData`:
|
|
2643
2676
|
|
|
@@ -2653,6 +2686,8 @@ type GridExportData = {
|
|
|
2653
2686
|
rowKeys?: (GridRowKey | null)[]; // includeRowKeys のときだけ(1.14.0 から)。rows と同じ長さで、行キー(データの行でない行は null)
|
|
2654
2687
|
unloadedRows?: number; // serverSide で読み込んでいないために出さなかった行の数(1 以上のときだけ。1.14.0 から)。rows を
|
|
2655
2688
|
// 指定したときは、範囲の中の最初の読み込んでいない行で止める(その先は出さない)
|
|
2689
|
+
cellSpans?: { row: number; col: number; rowSpan: number; colSpan: number }[]; // includeCellSpans のときだけ(1.16.0 から)。
|
|
2690
|
+
// セルの結合の左上の位置(rows と columns の中)と大きさ。データの行どうしの結合だけで、表の外へ出る所は切る
|
|
2656
2691
|
};
|
|
2657
2692
|
```
|
|
2658
2693
|
|
|
@@ -2712,6 +2747,21 @@ rows.forEach((r, i) => {
|
|
|
2712
2747
|
});
|
|
2713
2748
|
```
|
|
2714
2749
|
|
|
2750
|
+
#### レシピ: 結合したセルを Excel の結合セルにする(ExcelJS)
|
|
2751
|
+
|
|
2752
|
+
`spanRows` / `colSpan` の列があるグリッドでは `includeCellSpans: true` で結合の位置も受け取り、`mergeCells` に渡します(`rows` には結合した行にも同じ値が入っているので、どの行の値が残っても同じ)。
|
|
2753
|
+
|
|
2754
|
+
```ts
|
|
2755
|
+
const { columns, rows, cellSpans } = gridRef.current!.getExportData({ includeCellSpans: true });
|
|
2756
|
+
const ws = wb.addWorksheet('Sheet1');
|
|
2757
|
+
ws.addRow(columns.map((c) => c.title)); // 1 行目は見出し
|
|
2758
|
+
for (const r of rows) ws.addRow(r.map((cell) => cell.value));
|
|
2759
|
+
for (const span of cellSpans ?? []) {
|
|
2760
|
+
// ExcelJS の行と列は 1 から。見出しの 1 行のぶん、データの行は + 2
|
|
2761
|
+
ws.mergeCells(span.row + 2, span.col + 1, span.row + span.rowSpan + 1, span.col + span.colSpan);
|
|
2762
|
+
}
|
|
2763
|
+
```
|
|
2764
|
+
|
|
2715
2765
|
#### レシピ: マルチシート
|
|
2716
2766
|
|
|
2717
2767
|
scope 違い(または複数グリッド)を複数シートに:
|
|
@@ -3029,6 +3079,7 @@ export const OrdersTable = () => <Grid columns={columns} dataSource={dataSource}
|
|
|
3029
3079
|
| `excelShortcuts` | `excelShortcutsFeature` | Excel のキー(`excelShortcuts` の `Ctrl+D` / `Ctrl+R` / エディタの `Ctrl+Enter` / `Ctrl+;` / `Shift+Space` / `Ctrl+Space`。`Ctrl+X` の切り取りは本体にある) | +2.1KB |
|
|
3030
3080
|
| `treeData` | `treeDataFeature` | ツリーデータ(`treeData` / `onTreeRowOpenChange`、ハンドルの `setTreeRowOpen` / `expandAllTreeRows` / `collapseAllTreeRows`。`revealRow` は本体にあり、ツリーデータでない表でもスクロールする) | +6.7KB |
|
|
3031
3081
|
| `pagination` | `paginationFeature` | ページ送り(`pagination` / `onPageChange`、ハンドルの `setPage` / `setPageSize` / `getPageInfo`。`loading` は本体にある) | +3.4KB |
|
|
3082
|
+
| `cellSpan` | `cellSpanFeature` | セルの結合(列の `spanRows` / `colSpan`、`getExportData` の `includeCellSpans`) | +5.9KB |
|
|
3032
3083
|
| `conditionalFormat` | `conditionalFormatFeature` | 条件付き書式とチップ(`columns[].conditionalFormat`) | +1.4KB |
|
|
3033
3084
|
| `autoHeight` | `autoHeightFeature` | 行の高さの実測(`autoHeight` / `columns[].autoHeight`) | +1.2KB |
|
|
3034
3085
|
|
|
@@ -3036,10 +3087,10 @@ export const OrdersTable = () => <Grid columns={columns} dataSource={dataSource}
|
|
|
3036
3087
|
|
|
3037
3088
|
| 構成 | 初期 JS(gzip) |
|
|
3038
3089
|
| --- | --- |
|
|
3039
|
-
| 全部入り(`SpreadsheetGrid`) | 約
|
|
3040
|
-
| `/lite` 機能なし | 約
|
|
3041
|
-
| `/lite` + `standardFeatures` | 約
|
|
3042
|
-
| `/lite` + `standardFeatures` + `serverSideFeature` | 約
|
|
3090
|
+
| 全部入り(`SpreadsheetGrid`) | 約 246KB |
|
|
3091
|
+
| `/lite` 機能なし | 約 122KB |
|
|
3092
|
+
| `/lite` + `standardFeatures` | 約 149KB |
|
|
3093
|
+
| `/lite` + `standardFeatures` + `serverSideFeature` | 約 154KB |
|
|
3043
3094
|
|
|
3044
3095
|
- 各機能の目安は「機能なし」に 1 つだけ足したときの増え方で、組み合わせると共通部分のぶん合計より少し小さくなる。バンドラーによって数 KB 前後する(0.61.0 の全部入りの実測で、Vite 8(Rolldown)は esbuild より約 1.5KB 小さく、Vite 7(Rollup)はほぼ同じ。Next.js 16 では webpack が Turbopack より約 4KB 大きい)。
|
|
3045
3096
|
- 使わない機能がバンドルから落ちることは、Vite 8・webpack 5・Next.js 16(既定の Turbopack)・esbuild で確かめている(バンドラーが `package.json` の `sideEffects` と `/* @__PURE__ */` を解釈する必要がある)。
|
|
@@ -3646,6 +3697,7 @@ function Grid(props: SpreadsheetGridProps<Row>) {
|
|
|
3646
3697
|
| `.ssg-tree-toggle` | ツリーデータの開閉の印(見えている子がある行のボタン。開いているときは `aria-expanded="true"`)。 |
|
|
3647
3698
|
| `.ssg-body-row--tree-unmatched` | ツリーデータの絞り込みで当たっていない親の行(当たった行までの親。文字は `--ssg-tree-unmatched-text`)。 |
|
|
3648
3699
|
| `.ssg-body-cell--tree-aggregate` | ツリーデータの子を持つ行の集計のセル(集計のある列 = `aggFunc`。値は下の行の集計で、編集できない。見た目は変えない目印)。 |
|
|
3700
|
+
| `.ssg-body-cell--spanned` / `.ssg-cell-span-content` | セルの結合(列の `spanRows` / `colSpan`)の結合したセル(`.ssg-body-cell` にも付き、`aria-rowspan` / `aria-colspan` を持つ)/ その中の文字の器(縦にスクロールしても結合の見えている所の一番上に留まる。1.16.0 から)。 |
|
|
3649
3701
|
| `.ssg-body-row--new` | 入力行(`newRow`)の行要素(`.ssg-body-row`。状態は属性 `data-ssg-new-row`。中のセルはアクセント色を薄く混ぜた背景。1.10.0 から)。 |
|
|
3650
3702
|
| `.ssg-row-header-cell--new` | 入力行の行番号(空は「*」、下書きは「✎」。印はアクセント色。1.10.0 から)。 |
|
|
3651
3703
|
| `.ssg-new-row-placeholder` | 空の入力行のセルの文字(「ここに入力して行を追加」。色は `--ssg-readonly-text`。1.10.0 から)。 |
|
|
@@ -3667,6 +3719,7 @@ function Grid(props: SpreadsheetGridProps<Row>) {
|
|
|
3667
3719
|
| `[data-ssg-label-row]` | ラベル行の行要素(`.ssg-body-row`)。 |
|
|
3668
3720
|
| `[data-ssg-new-row="empty" \| "draft"]` | 入力行(`newRow`)の行要素(`.ssg-body-row--new`)。値を書いていない / 下書き(1.10.0 から)。 |
|
|
3669
3721
|
| `[data-ssg-tree-level]` | ツリーデータ(`treeData`)の行要素(`.ssg-body-row`)。値は深さ(一番上 = 0。1.9.0 から)。 |
|
|
3722
|
+
| `[data-ssg-row-span]` / `[data-ssg-col-span]` | 結合したセル(`.ssg-body-cell--spanned`)。値は使う行 / 列の数(縦の結合は `data-ssg-row-span`、横の結合は `data-ssg-col-span`。1.16.0 から)。 |
|
|
3670
3723
|
| `[data-ssg-pinned="top" \| "bottom"]` | 固定行の行要素(`.ssg-pinned-row`)。上 / 下。 |
|
|
3671
3724
|
| `[data-ssg-col-group]` | 列のグループの見出しのセル(`.ssg-col-group-cell`)。値はグループの `key`(1.6.0 から)。 |
|
|
3672
3725
|
| `[data-ssg-range-decoration]` | 範囲の飾りの枠(`.ssg-range-decoration`)。値は飾りの `id`(1.13.0 から)。 |
|
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ A runnable example (an editable inventory table with 10,000 rows) is in [`exampl
|
|
|
52
52
|
|
|
53
53
|
## Picking features
|
|
54
54
|
|
|
55
|
-
`SpreadsheetGrid` includes every feature (about
|
|
55
|
+
`SpreadsheetGrid` includes every feature (about 267KB gzip of initial JS; the column filter popover, the tool panel and the calendar, about 18KB, load later). `createSpreadsheetGrid` builds a grid with only the features you pass, and the rest is left out of your bundle (about 131KB with no features, about 161KB with the `standardFeatures` preset). Unlike the React version, the parts come from the main entry (there is no `/lite`).
|
|
56
56
|
|
|
57
57
|
```tsx
|
|
58
58
|
import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid-solid'
|
|
@@ -129,7 +129,7 @@ Solid 2.0 向けの仮想化スプレッドシート / データグリッドで
|
|
|
129
129
|
|
|
130
130
|
### 機能を選んで組み込む
|
|
131
131
|
|
|
132
|
-
`SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約
|
|
132
|
+
`SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約 267KB gzip。列フィルターのポップオーバーとツールパネル・カレンダーの約 18KB は後から読みます)。`createSpreadsheetGrid` では渡した機能だけを入れたグリッドを作れ、渡さなかった機能はバンドルに入りません(機能なしで約 131KB、プリセット `standardFeatures` で約 161KB)。React 版と違い、機能の部品も同じ入口から import します(`/lite` はありません)。機能の名前と中身は同梱の `API_REFERENCE.md` の「機能を選んで組み込む」のとおりです(部品の名前も React 版と同じ)。グリッドはコンポーネントの中ではなく、モジュールの先頭で 1 回だけ作ってください。
|
|
133
133
|
|
|
134
134
|
### React 版との違い
|
|
135
135
|
|
package/dist/devWarnings.d.ts
CHANGED
package/dist/features/types.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import type { resolveNewRowPlaceholder } from '@ishibashi0112/spreadsheet-grid-c
|
|
|
7
7
|
import type { createRangeDecorationResolver } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/rangeDecorations';
|
|
8
8
|
import type { resolveAutoPageSize, resolvePaginationOptions } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/pagination';
|
|
9
9
|
import type { describeChangeNavTarget, describeDiffCell, formatDiffOriginalText, formatDiffSummaryParts, nextChangeNavAnnouncement } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/diffView';
|
|
10
|
+
import type { createCellSpanLayoutResolver, resolveCellSpanPlacement } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/cellSpanLayout';
|
|
11
|
+
import type { hasCellSpanColumns } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/cellSpans';
|
|
10
12
|
import type { GridRangeDecorationFrames } from '../view/GridRangeDecorations.js';
|
|
11
13
|
import type { GridPager } from '../view/GridPager.js';
|
|
12
14
|
import type { GridDiffBarChip } from '../view/GridDiffBar.js';
|
|
@@ -115,6 +117,11 @@ export type SolidGridFeatures = {
|
|
|
115
117
|
Pager: typeof GridPager;
|
|
116
118
|
}) | undefined;
|
|
117
119
|
excelShortcuts?: NonNullable<GridCoreFeatures['excelShortcuts']> | undefined;
|
|
120
|
+
cellSpan?: (NonNullable<GridCoreFeatures['cellSpan']> & {
|
|
121
|
+
createCellSpanLayoutResolver: typeof createCellSpanLayoutResolver;
|
|
122
|
+
resolveCellSpanPlacement: typeof resolveCellSpanPlacement;
|
|
123
|
+
hasCellSpanColumns: typeof hasCellSpanColumns;
|
|
124
|
+
}) | undefined;
|
|
118
125
|
treeData?: (NonNullable<GridCoreFeatures['treeData']> & FeatureLocaleDefaults & {
|
|
119
126
|
TreeCellPrefix: typeof GridTreeCellPrefix;
|
|
120
127
|
TreeAggregateValue: typeof GridTreeAggregateValue;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export { changeTrackingFeature } from './features/changeTracking.js';
|
|
|
22
22
|
export { diffViewFeature } from './features/diffView.js';
|
|
23
23
|
export { rangeDecorationsFeature } from './features/rangeDecorations.js';
|
|
24
24
|
export { paginationFeature } from './features/pagination.js';
|
|
25
|
+
export { cellSpanFeature } from './features/cellSpan.js';
|
|
25
26
|
export { excelShortcutsFeature } from './features/excelShortcuts.js';
|
|
26
27
|
export { newRowFeature } from './features/newRow.js';
|
|
27
28
|
export { treeDataFeature } from './features/treeData.js';
|
|
@@ -41,6 +42,6 @@ export { numberFormatter } from '@ishibashi0112/spreadsheet-grid-core/internal/l
|
|
|
41
42
|
export { numberParser } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/valueParsers';
|
|
42
43
|
export { restoreColumnsFromState } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/gridState';
|
|
43
44
|
export { preloadGridPopups } from './view/lazyPopups.js';
|
|
44
|
-
export type { SpreadsheetGridProps, GridColumn, GridColumnPinned, GridColumnEditor, EditorCommitDirection, EditorEnterMove, CellEditorContext, GridSelectEditorOption, GridSelectLoadOptionsParams, GridSelectFillRowContext, GridValidationMode, CellValidationContext, CellValidationResult, GridInvalidCell, EditorCommitResult, GridChanges, GridChangedRow, GridChangesSummary, GridChangesSavedTarget, GridAddedRow, GridRemovedRow, GridTrackChangesOptions, GridRangeDecoration, GridTreeDataOptions, GridTreeRow, CellTreeContext, CellTreeState, TreeRowOpenChangeParams, GridRevealRowOptions, GridRowKey, GridAggFuncName, GridAggFuncParams, GridAggFunc, GridGroupRow, GridSelectFilterOption, GetFilterOptionsParams, GetFilterOptionsResult, ColumnFilterTypeOption, ColumnFilterUiType, CellRenderContext, HeaderRenderContext, GridColumnGroup, GridColumnGroupCollapsible, ColumnGroupHeaderRenderContext, ColumnGroupOpenChangeParams, GridExportColumnGroup, CellStyleContext, CanEditCellContext, GridConditionalFormat, RowStyleContext, DetailRowOptions, GridClassNames, GridSlotProps, GridFrameworkTypes, SolidGridTypes, DetailRowRenderContext, CellDetailContext, LabelRowOptions, LabelRowRenderContext, GridLabelRow, LabelRowSortMode, TotalRowOptions, TotalRowCellContext, TotalRowCellKind, FillHandleOptions, GridFillValueParams, GridFillDirection, GridFillKind, RowDragContext, RowMoveParams, RowDropParams, GridCellRef, GridCellEventParams, GridCellDoubleClickParams, CellValueFormatter, CellValueFormatterParams, SpreadsheetGridSlotContext, SpreadsheetGridDerivedSummary, SpreadsheetGridSelectionStats, GridLocaleText, GridLocaleTextTemplate, GridVerticalAlign, GridTextEditorEnterKey, GlobalFilterStatus, GridSelectionAggregates, CellCoord, CellRange, GridSelection, GridSortState, GridSortEntry, GridSortDirection, ColumnFilterValue, GridFilterState, SetColumnFilterValue, NumberColumnFilterValue, NumberSetColumnFilterValue, ParsedNumberFilter, TextSetColumnFilterValue, ParsedTextFilter, DateSetColumnFilterValue, ParsedDateFilter, DateFilterPreset, DateFilterPresetOption, CustomDateFilterPreset, DateFilterPresetRange, FilterDateInputContext, TextColumnFilterValue, DateColumnFilterValue, SelectColumnFilterValue, CustomColumnFilterValue, ServerSideDataSource, ServerSideQuery, ServerSideGetRowsParams, ServerSideGetRowsResult, ServerSideLoadErrorParams, ServerSideCellChange, ServerSideRowUpdate, ServerSideUpdateRowsParams, ServerSideUpdateRowsResult, ServerSideWriteErrorParams, RowModel, SpreadsheetGridHandle, RowSelectionModel, RowSelectionMode, ScrollAlign, GridScrollPosition, GridScrollEventParams, CsvExportScope, CsvExportOptions, GridExportOptions, GridExportCell, GridExportData, GridState, GridStatePatch, GridColumnState, GridDensity, GridTheme, UndoRedoState, GridMotion, GridPopupContainer, GridGlobalFilterMatch, GridPasteSkippedCell, GridPasteSkippedParams, GridExcelShortcutsOptions, GridNewRowOptions, GridApplyRowsOptions, GridCellValueEdit, GridCellValueSkip, GridCellValueSkipReason, GridCellValueMarked, GridSetCellValuesOptions, GridSetCellValuesResult, GridRowCounts, GridPaginationOptions, GridPageInfo, GridPaginationContext, GridPinnedRowPosition, FindOptions, FindChangeParams, GridFindOpenOptions, GridFindReplaceResult, GridDataBarFormat, GridColorScaleFormat, GridChipTone, GridChipSpec, GridChipMap, AutoSizeColumnsMode, GridContextMenuTarget, GridContextMenuParams, GridContextMenuItem, GridContextMenuActionItem, GridContextMenuLabelItem, GridContextMenuSeparatorItem, GridContextMenuCustomItem, ScrollHintOptions, ScrollHintTrigger, ScrollHintRenderArgs, } from './model/gridTypes.js';
|
|
45
|
+
export type { SpreadsheetGridProps, GridColumn, GridColumnPinned, GridColumnEditor, EditorCommitDirection, EditorEnterMove, CellEditorContext, GridSelectEditorOption, GridSelectLoadOptionsParams, GridSelectFillRowContext, GridSpanRowsParams, GridColSpanContext, GridValidationMode, CellValidationContext, CellValidationResult, GridInvalidCell, EditorCommitResult, GridChanges, GridChangedRow, GridChangesSummary, GridChangesSavedTarget, GridAddedRow, GridRemovedRow, GridTrackChangesOptions, GridRangeDecoration, GridTreeDataOptions, GridTreeRow, CellTreeContext, CellTreeState, TreeRowOpenChangeParams, GridRevealRowOptions, GridRowKey, GridAggFuncName, GridAggFuncParams, GridAggFunc, GridGroupRow, GridSelectFilterOption, GetFilterOptionsParams, GetFilterOptionsResult, ColumnFilterTypeOption, ColumnFilterUiType, CellRenderContext, HeaderRenderContext, GridColumnGroup, GridColumnGroupCollapsible, ColumnGroupHeaderRenderContext, ColumnGroupOpenChangeParams, GridExportColumnGroup, GridExportCellSpan, CellStyleContext, CanEditCellContext, GridConditionalFormat, RowStyleContext, DetailRowOptions, GridClassNames, GridSlotProps, GridFrameworkTypes, SolidGridTypes, DetailRowRenderContext, CellDetailContext, LabelRowOptions, LabelRowRenderContext, GridLabelRow, LabelRowSortMode, TotalRowOptions, TotalRowCellContext, TotalRowCellKind, FillHandleOptions, GridFillValueParams, GridFillDirection, GridFillKind, RowDragContext, RowMoveParams, RowDropParams, GridCellRef, GridCellEventParams, GridCellDoubleClickParams, CellValueFormatter, CellValueFormatterParams, SpreadsheetGridSlotContext, SpreadsheetGridDerivedSummary, SpreadsheetGridSelectionStats, GridLocaleText, GridLocaleTextTemplate, GridVerticalAlign, GridTextEditorEnterKey, GlobalFilterStatus, GridSelectionAggregates, CellCoord, CellRange, GridSelection, GridSortState, GridSortEntry, GridSortDirection, ColumnFilterValue, GridFilterState, SetColumnFilterValue, NumberColumnFilterValue, NumberSetColumnFilterValue, ParsedNumberFilter, TextSetColumnFilterValue, ParsedTextFilter, DateSetColumnFilterValue, ParsedDateFilter, DateFilterPreset, DateFilterPresetOption, CustomDateFilterPreset, DateFilterPresetRange, FilterDateInputContext, TextColumnFilterValue, DateColumnFilterValue, SelectColumnFilterValue, CustomColumnFilterValue, ServerSideDataSource, ServerSideQuery, ServerSideGetRowsParams, ServerSideGetRowsResult, ServerSideLoadErrorParams, ServerSideCellChange, ServerSideRowUpdate, ServerSideUpdateRowsParams, ServerSideUpdateRowsResult, ServerSideWriteErrorParams, RowModel, SpreadsheetGridHandle, RowSelectionModel, RowSelectionMode, ScrollAlign, GridScrollPosition, GridScrollEventParams, CsvExportScope, CsvExportOptions, GridExportOptions, GridExportCell, GridExportData, GridState, GridStatePatch, GridColumnState, GridDensity, GridTheme, UndoRedoState, GridMotion, GridPopupContainer, GridGlobalFilterMatch, GridPasteSkippedCell, GridPasteSkippedParams, GridExcelShortcutsOptions, GridNewRowOptions, GridApplyRowsOptions, GridCellValueEdit, GridCellValueSkip, GridCellValueSkipReason, GridCellValueMarked, GridSetCellValuesOptions, GridSetCellValuesResult, GridRowCounts, GridPaginationOptions, GridPageInfo, GridPaginationContext, GridPinnedRowPosition, FindOptions, FindChangeParams, GridFindOpenOptions, GridFindReplaceResult, GridDataBarFormat, GridColorScaleFormat, GridChipTone, GridChipSpec, GridChipMap, AutoSizeColumnsMode, GridContextMenuTarget, GridContextMenuParams, GridContextMenuItem, GridContextMenuActionItem, GridContextMenuLabelItem, GridContextMenuSeparatorItem, GridContextMenuCustomItem, ScrollHintOptions, ScrollHintTrigger, ScrollHintRenderArgs, } from './model/gridTypes.js';
|
|
45
46
|
export type { NumberFormatterOptions } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/valueFormatters';
|
|
46
47
|
export type { NumberParserOptions } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/valueParsers';
|