@ishibashi0112/spreadsheet-grid 0.53.0 → 0.55.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 +103 -2
- package/README.md +40 -2
- package/dist/{ColumnFilterPopover-Bca4dkRt.js → ColumnFilterPopover-9Qa2eHLS.js} +1 -1
- package/dist/{ColumnFilterPopover-B7RIBAz5.cjs → ColumnFilterPopover-VqJkz_De.cjs} +1 -1
- package/dist/common.d.ts +4 -0
- package/dist/createSpreadsheetGrid.d.ts +18 -1
- package/dist/features/autoHeight.d.ts +2 -0
- package/dist/features/columnMenu.d.ts +2 -0
- package/dist/features/filtering.d.ts +2 -0
- package/dist/features/grouping.d.ts +2 -0
- package/dist/features/labelRow.d.ts +2 -0
- package/dist/features/serverSide.d.ts +2 -0
- package/dist/features/standard.d.ts +26 -0
- package/dist/features/toolPanel.d.ts +2 -0
- package/dist/features/types.d.ts +115 -2
- package/dist/hooks/useColumnMenuController.d.ts +2 -1
- package/dist/hooks/useToolPanelController.d.ts +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.js +2993 -2866
- package/dist/lite/ColumnFilterPopover-9Qa2eHLS.js +1021 -0
- package/dist/lite/ColumnFilterPopover-VqJkz_De.cjs +1 -0
- package/dist/lite/columnAutosize-CqS98sR2.js +20 -0
- package/dist/lite/columnAutosize-pK0WyU51.cjs +1 -0
- package/dist/lite/columnMenu-CTdcpE3H.js +297 -0
- package/dist/lite/columnMenu-cffuDQLj.cjs +1 -0
- package/dist/lite/columnReorder-ApwKqJlQ.js +34 -0
- package/dist/lite/columnReorder-D_gnec1E.cjs +1 -0
- package/dist/lite/conditionalFormat-CsII_XSg.js +52 -0
- package/dist/lite/conditionalFormat-tsR38Cp5.cjs +1 -0
- package/dist/lite/contextMenu-BHuEmKrU.cjs +1 -0
- package/dist/lite/contextMenu-DNNeDQ8_.js +136 -0
- package/dist/lite/createSpreadsheetGrid-CF1TLFDT.cjs +1 -0
- package/dist/lite/createSpreadsheetGrid-DYacDtAY.js +3817 -0
- package/dist/lite/createSpreadsheetGrid.cjs +1 -0
- package/dist/lite/createSpreadsheetGrid.js +2 -0
- package/dist/lite/features/autoHeight.cjs +1 -0
- package/dist/lite/features/autoHeight.js +10 -0
- package/dist/lite/features/columnAutosize.cjs +1 -0
- package/dist/lite/features/columnAutosize.js +2 -0
- package/dist/lite/features/columnMenu.cjs +1 -0
- package/dist/lite/features/columnMenu.js +2 -0
- package/dist/lite/features/columnReorder.cjs +1 -0
- package/dist/lite/features/columnReorder.js +2 -0
- package/dist/lite/features/conditionalFormat.cjs +1 -0
- package/dist/lite/features/conditionalFormat.js +2 -0
- package/dist/lite/features/contextMenu.cjs +1 -0
- package/dist/lite/features/contextMenu.js +2 -0
- package/dist/lite/features/export.cjs +1 -0
- package/dist/lite/features/export.js +5 -0
- package/dist/lite/features/fillHandle.cjs +1 -0
- package/dist/lite/features/fillHandle.js +2 -0
- package/dist/lite/features/filtering.cjs +1 -0
- package/dist/lite/features/filtering.js +2 -0
- package/dist/lite/features/find.cjs +1 -0
- package/dist/lite/features/find.js +2 -0
- package/dist/lite/features/grouping.cjs +1 -0
- package/dist/lite/features/grouping.js +2 -0
- package/dist/lite/features/imeDirectInput.cjs +1 -0
- package/dist/lite/features/imeDirectInput.js +10 -0
- package/dist/lite/features/labelRow.cjs +1 -0
- package/dist/lite/features/labelRow.js +2 -0
- package/dist/lite/features/motionExtras.cjs +1 -0
- package/dist/lite/features/motionExtras.js +2 -0
- package/dist/lite/features/rowDrag.cjs +1 -0
- package/dist/lite/features/rowDrag.js +2 -0
- package/dist/lite/features/scrollHint.cjs +1 -0
- package/dist/lite/features/scrollHint.js +2 -0
- package/dist/lite/features/selectionAggregates.cjs +1 -0
- package/dist/lite/features/selectionAggregates.js +2 -0
- package/dist/lite/features/serverSide.cjs +1 -0
- package/dist/lite/features/serverSide.js +2 -0
- package/dist/lite/features/standard.cjs +1 -0
- package/dist/lite/features/standard.js +14 -0
- package/dist/lite/features/toolPanel.cjs +1 -0
- package/dist/lite/features/toolPanel.js +2 -0
- package/dist/lite/features/totalRow.cjs +1 -0
- package/dist/lite/features/totalRow.js +2 -0
- package/dist/lite/fillHandle-DSHef449.cjs +1 -0
- package/dist/lite/fillHandle-DZIPwQTf.js +310 -0
- package/dist/lite/filtering-TKvYWXFp.js +354 -0
- package/dist/lite/filtering-uKrMU8q5.cjs +1 -0
- package/dist/lite/find-CQL5I7RC.js +101 -0
- package/dist/lite/find-Dmvy7o9s.cjs +1 -0
- package/dist/lite/grouping-DRnlKwHu.cjs +1 -0
- package/dist/lite/grouping-Dqqvegg2.js +95 -0
- package/dist/lite/labelRow-BMa3vn1V.cjs +1 -0
- package/dist/lite/labelRow-DIoO7hmP.js +121 -0
- package/dist/lite/lazyPopups-CyC101Ge.js +33 -0
- package/dist/lite/lazyPopups-T9eKWzY1.cjs +1 -0
- package/dist/lite/motionExtras-97YYs0VU.js +46 -0
- package/dist/lite/motionExtras-Bb84RQmj.cjs +1 -0
- package/dist/lite/rowDrag-CxUI0JF9.js +112 -0
- package/dist/lite/rowDrag-tHcs83aP.cjs +1 -0
- package/dist/lite/scrollHint-CpIyikQv.cjs +1 -0
- package/dist/lite/scrollHint-CwU2eRY6.js +203 -0
- package/dist/lite/selectionAggregates-BE_bVelb.cjs +1 -0
- package/dist/lite/selectionAggregates-hrobLf1y.js +99 -0
- package/dist/lite/serverSide-CcvvoCY_.cjs +1 -0
- package/dist/lite/serverSide-gzIWGcOB.js +93 -0
- package/dist/lite/toolPanel-DWc162Ut.cjs +1 -0
- package/dist/lite/toolPanel-OMh7x16V.js +34 -0
- package/dist/lite/toolPanelViews-B6D8xn1e.js +657 -0
- package/dist/lite/toolPanelViews-DQ4E0PbH.cjs +1 -0
- package/dist/lite/totalRow-CU9qyUw9.cjs +1 -0
- package/dist/lite/totalRow-DXDEVTwz.js +83 -0
- package/dist/lite/useController-BlvPmjiN.js +16 -0
- package/dist/lite/useController-DV5on8Qp.cjs +1 -0
- package/dist/lite/useVirtualizerCore-BFcqP3Eh.js +35 -0
- package/dist/lite/useVirtualizerCore-CrusdCD3.cjs +1 -0
- package/dist/lite.cjs +1 -0
- package/dist/lite.d.ts +25 -0
- package/dist/lite.js +25 -0
- package/dist/style.css +1 -1
- package/dist/themes/astryx.css +120 -0
- package/dist/themes/astryx.css.d.ts +2 -0
- package/dist/themes/heroui.css +121 -0
- package/dist/themes/heroui.css.d.ts +2 -0
- package/dist/themes/mantine.css +120 -0
- package/dist/themes/mantine.css.d.ts +2 -0
- package/dist/themes/shadcn.css +121 -0
- package/dist/themes/shadcn.css.d.ts +2 -0
- package/dist/useVirtualizerCore-BFcqP3Eh.js +35 -0
- package/dist/useVirtualizerCore-CrusdCD3.cjs +1 -0
- package/dist/view/ColumnMenuPopover.d.ts +3 -3
- package/dist/view/GridBodyGroupRow.d.ts +25 -0
- package/dist/view/GridBodyLayer.d.ts +5 -2
- package/dist/view/lazyPopups.d.ts +1 -0
- package/package.json +36 -5
- package/dist/useVirtualizerCore-CzoP0AUm.cjs +0 -1
- package/dist/useVirtualizerCore-q794NurB.js +0 -21
package/API_REFERENCE.md
CHANGED
|
@@ -741,7 +741,7 @@ const columns = [
|
|
|
741
741
|
- `validate` は**純粋・軽量**であること。mark 表示のため、描画中の可視セル(validate 指定列のみ)ごとに毎レンダー評価されます(`cellClassName` 関数と同じコスト階級)。
|
|
742
742
|
- 検証コンテキストは `{ value, row, column }` です(`row` は書き込み前の行。ビュー index はソート / フィルターで不安定なため渡しません)。
|
|
743
743
|
- 保存前の一括チェックはハンドルの `getInvalidCells()` を使います(「命令的 API」節参照)。
|
|
744
|
-
- invalid 表示の配色はトークン `--ssg-invalid` / `--ssg-invalid-bg` で調整できます(light / dark 両対応)
|
|
744
|
+
- invalid 表示の配色はトークン `--ssg-invalid` / `--ssg-invalid-bg` で調整できます(light / dark 両対応)。エラーの吹き出しの文字色は `--ssg-invalid-contrast`(既定 `#ffffff`)です。
|
|
745
745
|
- 同じセルにメモ(`cellNote`)がある場合は、メモの 10px の三角の上にエラーの 6px の三角が重なります(「セルのメモ(`cellNote`)」節)。
|
|
746
746
|
|
|
747
747
|
#### 表示タイミングの制御(showValidationMarks)
|
|
@@ -1561,6 +1561,71 @@ const dataSource: ServerSideDataSource<Row> = {
|
|
|
1561
1561
|
|
|
1562
1562
|
`initialRowCount` と内部の行数 state は mount 時に確定する。そのため **実行時にモードを切り替える場合は `key` を変えてグリッドを再マウントすること**(clientSide で mount 後に `dataSource` を後付けしても件数が初期化されない)。serverSide で直接 mount する通常利用ではこの限りではない。
|
|
1563
1563
|
|
|
1564
|
+
## 機能を選んで組み込む(`/lite` サブパス)
|
|
1565
|
+
|
|
1566
|
+
`@ishibashi0112/spreadsheet-grid/lite` の `createSpreadsheetGrid` で、使う機能だけを差し込んだグリッドを作れる(0.54.0 で追加)。差し込まなかった機能のコードはバンドルに入らない。全機能を使うなら今までどおり `SpreadsheetGrid`(全部入り)を使う。
|
|
1567
|
+
|
|
1568
|
+
```tsx
|
|
1569
|
+
import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid/lite';
|
|
1570
|
+
import '@ishibashi0112/spreadsheet-grid/style.css';
|
|
1571
|
+
|
|
1572
|
+
// モジュールの先頭で 1 回だけ作る(コンポーネントの中では作らない)
|
|
1573
|
+
const Grid = createSpreadsheetGrid({ features: { ...standardFeatures, serverSide: serverSideFeature } });
|
|
1574
|
+
|
|
1575
|
+
export const OrdersTable = () => <Grid columns={columns} dataSource={dataSource} />;
|
|
1576
|
+
```
|
|
1577
|
+
|
|
1578
|
+
| 公開物 | 説明 |
|
|
1579
|
+
| --- | --- |
|
|
1580
|
+
| `createSpreadsheetGrid({ features }): <T extends object>(props: SpreadsheetGridProps<T>) => JSX.Element` | 機能セットを差し込んだグリッドのコンポーネントを作る。`features` は `{ キー: 機能の部品 }`(下の表)。機能の組み合わせは作ったときに固定される(描画のたびに作り直すとグリッドの状態が消える)。 |
|
|
1581
|
+
| `standardFeatures` | よく使う組み合わせ(プリセット): `filtering` / `columnMenu` / `toolPanel` / `columnAutosize` / `export`。ほかの機能は `{ ...standardFeatures, find: findFeature }` のように広げて足す。 |
|
|
1582
|
+
| `xxxFeature`(20 個) | 機能の部品。名前は「キー + `Feature`」(下の表)。中身は内部の部品なので、そのまま `features` に渡す(自分で作ったり書き換えたりしない)。 |
|
|
1583
|
+
| 型 `GridFeatures` / `CreateSpreadsheetGridOptions` | `features` の型と、`createSpreadsheetGrid` の引数の型。 |
|
|
1584
|
+
| `numberFormatter` / `preloadGridPopups` と公開型すべて | 全部入りの入口と同じ名前・使い方。`preloadGridPopups` は同じ入口のグリッドの部品を読み込むので、`/lite` のグリッドには `/lite` から import したものを使う。 |
|
|
1585
|
+
|
|
1586
|
+
- **props・ref ハンドル・型は全部入りと共通**。差し込んでいない機能の prop を渡したり、その機能のメソッドを呼んだりしても何もしない(落ちない)。開発ビルドでだけ、prop ごとに 1 回 `console.warn` で「`features` に `fillHandle: fillHandleFeature` を入れてください」のように足すべき機能を知らせる(本番ビルドでは出さない)。prop を持たない機能のメソッド(`exportCsv` / `downloadCsv` / `getExportData` と、`toolPanel` か `filtering` が無いときの `openFilterManager`)は、呼ばれた時点で同じように知らせる。ほかの機能のメソッド(`openFind` など)は全部入りでもその機能の prop が無いと動かないので、prop の警告で知らせる。
|
|
1587
|
+
- **全部入りで既定オンの機能は、差し込んだときだけ既定オン**: 列フィルター / グローバルフィルター(`filtering`)、列メニュー(`columnMenu`)、列のドラッグ並べ替え(`columnReorder`。`onColumnsChange` 指定時)、列境界のダブルクリックでの幅の自動調整(`columnAutosize`)、選択範囲の集計(`selectionAggregates`)、コピー範囲の点線(`motionExtras`)。
|
|
1588
|
+
- **機能なしで残るもの(本体)**: 表示(縦横の仮想スクロール・固定列)、セル / 範囲選択、キー操作、編集(6 種のエディタと検証)、コピー / 貼り付け / 削除、元に戻す / やり直し、列幅の変更、ソート、行選択(チェックボックス)、展開行(`detailRow`)、セルのメモ(`cellNote`)、`getState` / `applyState`、テーマ / 密度 / モーション、ツールチップ、上部 / 下部バー、ARIA。ソートを画面から操作する入口は列メニューにあるため、`columnMenu` が無い構成のソートは `applyState` 等の API からになる。
|
|
1589
|
+
- **画面の入口は機能の組み合わせで決まる**: 列フィルターを画面から掛ける入口は列メニューの「フィルター…」と、適用中フィルターのチップ(ツールパネル)なので、`filtering` だけでは列フィルターを追加できない(グローバル検索欄は使える)。ツールパネルを開く入口は列メニューの項目、適用中フィルターのチップ、`openFilterManager` なので、`toolPanel` は `columnMenu` か `filtering` と一緒に使う(どちらも無いと代役になり、部品も読み込まない)。列メニューの「幅の自動調整」は `columnAutosize` があるときだけ出る。
|
|
1590
|
+
- **機能が無いときの扱い(注意が要るもの)**: `filtering` が無いとグローバル / 列フィルターは無効(`enableGlobalFilter` / `enableColumnFilter` を false として扱う)で、`applyState` で渡したフィルターは状態には残るが行には効かない(開発時に警告)。`serverSide` が無いと `dataSource` を無視して clientSide で動く。`labelRow` が無いとラベル行の述語に当たる行もデータ行として並ぶ。`rowGroup` の列は `grouping` が無ければグループ化せずそのまま表示。`autoHeight` が無いと行の高さは一定(`rowHeight`)。`toolPanel` があっても `filtering` が無ければフィルタータブは出ず、`openFilterManager` は何もしない(全部入りで `enableColumnFilter={false}` にしたときと同じ。開発時に警告)。
|
|
1591
|
+
- Next.js(App Router)では、`createSpreadsheetGrid` を呼ぶファイルに `'use client'` を付ける。作ったコンポーネントや `standardFeatures` は関数なので、サーバーコンポーネントから props で渡せない(クライアントコンポーネントの中で import して使う)。
|
|
1592
|
+
- 全部入りの `SpreadsheetGrid` と同じアプリで混ぜることはできるが、共通部分が二重に入る(`/lite` は機能ごとのファイルに分けた別のビルドのため)。どちらかの入口に揃える。
|
|
1593
|
+
|
|
1594
|
+
| キー | 部品 | 中身(関係する prop) | 目安(gzip) |
|
|
1595
|
+
| --- | --- | --- | --- |
|
|
1596
|
+
| `filtering` | `filteringFeature` | グローバル / 列フィルター、フィルターのポップオーバー(遅延読み込み)、チップバー、非同期の候補(`enableGlobalFilter` / `enableColumnFilter` / `columns[].filterType` / `getFilterOptions` / `showFilterChipBar` / `onFiltersChange` / `manualFiltering` ほか) | +11.8KB(+ 遅延 6.1KB) |
|
|
1597
|
+
| `fillHandle` | `fillHandleFeature` | フィルハンドル(`fillHandle`) | +8.6KB |
|
|
1598
|
+
| `columnReorder` | `columnReorderFeature` | 列ヘッダーのドラッグ並べ替え(`onColumnsChange` 指定時 / `columnDragMotion`) | +5.8KB |
|
|
1599
|
+
| `rowDrag` | `rowDragFeature` | 行のドラッグ並べ替え(`enableRowDrag` / `isRowDraggable` / `onRowMove` / `rowDragMotion`。ハンドルの `moveRow()` は本体にあるので無くても使える) | +3.4KB |
|
|
1600
|
+
| `serverSide` | `serverSideFeature` | サーバーサイド行モデル(SSRM)の読み取りと書き戻し、保存状態の表示(`dataSource` / `serverSideRefreshToken` / `showSaveStatus` ほか) | +3.2KB |
|
|
1601
|
+
| `columnMenu` | `columnMenuFeature` | 列メニュー(ソート・固定。幅の自動調整は `columnAutosize`、フィルターの入口は `filtering`、パネルの入口は `toolPanel` があるとき。`enableColumnMenu`) | +2.4KB |
|
|
1602
|
+
| `columnAutosize` | `columnAutosizeFeature` | 列幅の自動調整(境界のダブルクリック・列メニューの項目・`autoSizeColumns`) | +2.2KB |
|
|
1603
|
+
| `find` | `findFeature` | セル内検索(`find` / `onFindChange`) | +2.0KB |
|
|
1604
|
+
| `scrollHint` | `scrollHintFeature` | スクロール位置インジケーター(`scrollHint`) | +2.0KB |
|
|
1605
|
+
| `export` | `exportFeature` | CSV / TSV / `getExportData`(ハンドルの `exportCsv` / `downloadCsv` / `getExportData`) | +1.9KB |
|
|
1606
|
+
| `labelRow` | `labelRowFeature` | ラベル行(`labelRow`) | +1.9KB |
|
|
1607
|
+
| `selectionAggregates` | `selectionAggregatesFeature` | 選択範囲の集計(`showSelectionAggregates`) | +1.9KB |
|
|
1608
|
+
| `grouping` | `groupingFeature` | 行グルーピングと集計(`columns[].rowGroup` / `aggFunc`) | +1.8KB |
|
|
1609
|
+
| `totalRow` | `totalRowFeature` | 合計行(`totalRow`) | +1.7KB |
|
|
1610
|
+
| `contextMenu` | `contextMenuFeature` | セル / 行の右クリックメニュー(`enableContextMenu` / `getContextMenuItems`) | +1.6KB |
|
|
1611
|
+
| `toolPanel` | `toolPanelFeature` | ツールパネル(フィルター管理 / 列の表示 / 並び替え。部品は遅延読み込み) | +1.6KB(+ 遅延 5.3KB) |
|
|
1612
|
+
| `conditionalFormat` | `conditionalFormatFeature` | 条件付き書式とチップ(`columns[].conditionalFormat`) | +1.4KB |
|
|
1613
|
+
| `imeDirectInput` | `imeDirectInputFeature` | IME オンのままの直接入力(`imeDirectInput`) | +1.3KB |
|
|
1614
|
+
| `motionExtras` | `motionExtrasFeature` | 変更のハイライト、コピー範囲の点線、十字ホバー(`highlightChanges` / `showCopyRange` / `hoverHighlight`) | +1.2KB |
|
|
1615
|
+
| `autoHeight` | `autoHeightFeature` | 行の高さの実測(`autoHeight` / `columns[].autoHeight`) | +1.0KB |
|
|
1616
|
+
|
|
1617
|
+
サイズ(初期読み込みの JS の gzip。esbuild で minify・React は外部化・`@tanstack/virtual-core` 込み。2026-10-25 の公開 dist で計測):
|
|
1618
|
+
|
|
1619
|
+
| 構成 | 初期 JS(gzip) |
|
|
1620
|
+
| --- | --- |
|
|
1621
|
+
| 全部入り(`SpreadsheetGrid`) | 約 112KB |
|
|
1622
|
+
| `/lite` 機能なし | 約 60KB |
|
|
1623
|
+
| `/lite` + `standardFeatures` | 約 78KB |
|
|
1624
|
+
| `/lite` + `standardFeatures` + `serverSideFeature` | 約 82KB |
|
|
1625
|
+
|
|
1626
|
+
- 各機能の目安は「機能なし」に 1 つだけ足したときの増え方で、組み合わせると共通部分のぶん合計より少し小さくなる。Vite(Rolldown)と webpack で束ねると全体に数 KB 小さく出る(例: Vite で全部入り 約 108KB / 機能なし 約 56KB)。
|
|
1627
|
+
- 使わない機能がバンドルから落ちることは、Vite 8・webpack 5・Next.js 16(既定の Turbopack)・esbuild で確かめている(バンドラーが `package.json` の `sideEffects` と `/* @__PURE__ */` を解釈する必要がある)。
|
|
1628
|
+
|
|
1564
1629
|
## ポップオーバー部品の遅延読み込み(`preloadGridPopups`)
|
|
1565
1630
|
|
|
1566
1631
|
列フィルターのポップオーバーと、ツールパネル(フィルター管理 / 列の表示 / 並び替え)の部品は本体と別のチャンクに分かれていて、初期の読み込みに含まれない(lazy-popups。初期の JS が約 1 割小さくなる。props / ハンドルは不変)。
|
|
@@ -1595,7 +1660,7 @@ beforeAll(() => {
|
|
|
1595
1660
|
- 返り値はインストール前へ戻す restore 関数(`afterAll(restore)` 用・任意)。
|
|
1596
1661
|
- React 非依存の小さなモジュールで、本体バンドルとは独立(`dist/testing.js`)。
|
|
1597
1662
|
- これで `.ssg-body-row` / `.ssg-body-cell` の描画・付与クラス・セル文字列を DOM で検証できる(本体の `SpreadsheetGrid.jsdomLayoutStubs.integration.test.tsx` が動作保証)。
|
|
1598
|
-
- 列フィルターのポップオーバー / ツールパネルを開いた直後に**同期で**中身を確かめるテストでは、部品の遅延読み込みが終わっていないと出ていない。`beforeAll(() => preloadGridPopups())`(本体から import)で先に読み込むか、`findBy*` / `waitFor` で待つ([ポップオーバー部品の遅延読み込み](#ポップオーバー部品の遅延読み込みpreloadgridpopups))。
|
|
1663
|
+
- 列フィルターのポップオーバー / ツールパネルを開いた直後に**同期で**中身を確かめるテストでは、部品の遅延読み込みが終わっていないと出ていない。`beforeAll(() => preloadGridPopups())`(本体から import。`/lite` のグリッドなら `/lite` から)で先に読み込むか、`findBy*` / `waitFor` で待つ([ポップオーバー部品の遅延読み込み](#ポップオーバー部品の遅延読み込みpreloadgridpopups))。
|
|
1599
1664
|
|
|
1600
1665
|
## パーツ別スロット(`classNames` / `GridSlotProps`)
|
|
1601
1666
|
|
|
@@ -1659,6 +1724,42 @@ const s = stylex.create({
|
|
|
1659
1724
|
- StyleX は子孫セレクタを書けない(要素自身のクラスでしか装飾できない)ため、上記スロットに無い内部要素(ポップオーバー内のボタン / 入力欄等)はデザイントークン(`--ssg-*`)で調整する。
|
|
1660
1725
|
- StyleX の atomic クラスとグリッドの基底クラスは同じ特異度 (0,1,0)。同じプロパティは後に読み込まれた方が勝つため、グリッド CSS を先に・StyleX の出力 CSS を後に読み込むか、`style.layer.css`(`@layer ssg-base`)を使う。StyleX 側で `useLayers` を有効にしている場合は、未レイヤーのグリッド CSS がレイヤー内に常に勝つため `style.layer.css` が必須。
|
|
1661
1726
|
|
|
1727
|
+
### Astryx との併用
|
|
1728
|
+
|
|
1729
|
+
[Astryx](https://astryx.atmeta.com)(Meta のデザインシステム。StyleX 製)の中でもそのまま使える。グリッドの CSS はレイヤーに入れていないため、Astryx のリセット(`@layer reset`)や部品の CSS(`@layer astryx-base`)に崩されず、セルの中に置いた Astryx の部品(`renderCell` で返す `Button` / `Badge` など)も外に置いたときと同じ見た目になる。配色を揃えるときは下の `themes/astryx.css` を使う。
|
|
1730
|
+
|
|
1731
|
+
### デザインシステムのテーマ(`themes/*.css`)
|
|
1732
|
+
|
|
1733
|
+
デザインシステムの配色の変数をグリッドのトークン(`--ssg-*`)へつなぐ CSS。`style.css` の後に 1 つ読み込むと、グリッドの配色がそのデザインシステムのテーマ(独自テーマを含む)とライト / ダークの切り替えに付いてくる(JS は増えない)。ライト / ダークはグリッドの `theme` にも渡す。
|
|
1734
|
+
|
|
1735
|
+
| ファイル | 対象(確認した版) | 効く範囲 | `theme` に渡すもの |
|
|
1736
|
+
| --- | --- | --- | --- |
|
|
1737
|
+
| `themes/astryx.css` | Astryx(`@astryxdesign/core` 0.7) | `<Theme>` があるページのすべてのグリッド(最上位の `<Theme>` が `<html>` へ同期する `data-astryx-theme` で判定。ポータルにも当たる) | `useTheme().mode`(必須。Astryx の色は `light-dark()` で、ビルドによってはグリッドの `color-scheme` の側で明暗が選ばれる) |
|
|
1738
|
+
| `themes/mantine.css` | Mantine(`@mantine/core` 9.7) | `MantineProvider` があるページのすべてのグリッド(`MantineProvider` が `<html>` に付ける `data-mantine-color-scheme` で判定) | `useComputedColorScheme('light')` |
|
|
1739
|
+
| `themes/heroui.css` | HeroUI v3(`@heroui/react` 3.2) | 読み込んだページのすべてのグリッド | `<html>` の `dark` クラスに合わせた `'light'` / `'dark'` |
|
|
1740
|
+
| `themes/shadcn.css` | shadcn/ui(`shadcn` 4.22。Tailwind CSS v4 向けの配色の変数) | 読み込んだページのすべてのグリッド | 同上 |
|
|
1741
|
+
|
|
1742
|
+
```tsx
|
|
1743
|
+
import '@ishibashi0112/spreadsheet-grid/style.css';
|
|
1744
|
+
import '@ishibashi0112/spreadsheet-grid/themes/astryx.css'; // style.css の後に読み込む
|
|
1745
|
+
import { useTheme } from '@astryxdesign/core/theme';
|
|
1746
|
+
|
|
1747
|
+
// <Theme theme={...}> の内側で使う
|
|
1748
|
+
function Grid(props: SpreadsheetGridProps<Row>) {
|
|
1749
|
+
const { mode } = useTheme(); // 'light' | 'dark'(mode="system" も解決済みの値)
|
|
1750
|
+
return <SpreadsheetGrid {...props} theme={mode} />;
|
|
1751
|
+
}
|
|
1752
|
+
```
|
|
1753
|
+
|
|
1754
|
+
- どのテーマも、デザインシステムの変数を同じ 16 の入力(面 / 文字 / 罫線 / アクセント / 危険・成功・注意の色とその上の文字色 / 角の丸み)に読み替え、そこからグリッドのトークンを同じ配分(行のホバーの濃さ、選択範囲の混ぜ方など)で決める。ツールチップ / ドラッグ中のゴースト / 条件付き書式の色など、デザインシステムに対応する変数が無い部分は `theme` に渡したプリセットのまま。
|
|
1755
|
+
- セレクタは `:where`(特異度 0)。`style.css` より後に読み込めば既定値とダークのプリセットに勝つ(前に読み込むと効かない)。利用側の `.ssg-root { --ssg-cell-bg: ... }` などの上書き(レイヤーに入れていない CSS)は読み込み順に関係なくテーマに勝つ。選択範囲などの色はデザインシステムのアクセントから決めるので、アクセントをまとめて変えるときはデザインシステムの側で変える。
|
|
1756
|
+
- `style.css` をレイヤーに入れているとき(`layer(components)` / `style.layer.css`)は、テーマも同じレイヤーの `style.css` の後に入れる(例: `@import '@ishibashi0112/spreadsheet-grid/themes/shadcn.css' layer(components);`)。レイヤーに入れたトークンの上書きは、レイヤーに入っていないテーマに負けるため。
|
|
1757
|
+
- HeroUI と shadcn/ui の変数には目印の属性が無いため、そのテーマは読み込んだページのすべてのグリッドに効く。それぞれの変数が無いページで読み込むと色が抜ける。HeroUI v2(`--heroui-*` に HSL の成分を入れる形)と、shadcn/ui の Tailwind CSS v3 向けの書き方(値が `222.2 84% 4.9%` のような HSL の成分)は対象外。
|
|
1758
|
+
- shadcn/ui には成功 / 注意の色の変数が無いため、保存できた印とメモの印は Tailwind の green-600 / amber-500。
|
|
1759
|
+
- Tailwind CSS だけのときは配色の変数が無いので、トークン(`--ssg-*`)を直接書く([テーマビルダー](https://datasheet-grid.vercel.app/theme-builder)で生成できる)。
|
|
1760
|
+
- 自分の StyleX の出力をレイヤーに入れていて(`useLayers`)、そのクラスでグリッドの基底を上書きしたいときは、上の StyleX の注意と同じく `style.layer.css` を使う。
|
|
1761
|
+
- デザインシステムの変数名が変わったときはテーマの側で追従する。
|
|
1762
|
+
|
|
1662
1763
|
## スタイリング用の状態クラス(公開契約)
|
|
1663
1764
|
|
|
1664
1765
|
`cellClassName` / `getRowClassName` の返すクラスは、下記の内部付与クラスと連結セレクタで組み合わせて使える(例: `.ssg-body-cell.my-diff` で基底に勝たせ、`.ssg-body-cell.my-diff.ssg-body-cell--row-hovered` でホバー時色を切替)。以下は**公開契約**とし、変更時は breaking 扱いにする(proposals ⑥)。
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A virtualized spreadsheet / data grid for React 19 (~1M rows, pinned columns, Excel-like editing / selection / clipboard, filters & sorting, client-side and server-side row models). 日本語は下にあります。
|
|
4
4
|
|
|
5
|
+
**[Docs & live demo](https://datasheet-grid.vercel.app)** · [Playground](https://datasheet-grid.vercel.app/playground) · [GitHub](https://github.com/ishibashi0112/datasheet-grid) · [Changelog](https://github.com/ishibashi0112/datasheet-grid/blob/main/CHANGELOG.md)
|
|
6
|
+
|
|
5
7
|
## Install
|
|
6
8
|
|
|
7
9
|
```sh
|
|
@@ -15,6 +17,8 @@ import '@ishibashi0112/spreadsheet-grid/style.css'
|
|
|
15
17
|
// or, if you use CSS cascade layers (e.g. Tailwind v4): '@ishibashi0112/spreadsheet-grid/style.layer.css'
|
|
16
18
|
```
|
|
17
19
|
|
|
20
|
+
Using Astryx, Mantine, HeroUI v3 or shadcn/ui? Also import its theme after `style.css` (`themes/astryx.css` / `themes/mantine.css` / `themes/heroui.css` / `themes/shadcn.css`) so the grid follows your design system's colors and light / dark ([guide](https://datasheet-grid.vercel.app/docs/guides/design-systems)).
|
|
21
|
+
|
|
18
22
|
## Quick start
|
|
19
23
|
|
|
20
24
|
```tsx
|
|
@@ -41,6 +45,20 @@ export function App() {
|
|
|
41
45
|
}
|
|
42
46
|
```
|
|
43
47
|
|
|
48
|
+
## Smaller bundles: `/lite` (0.54.0+)
|
|
49
|
+
|
|
50
|
+
`SpreadsheetGrid` includes every feature (about 112KB gzip of initial JS). The `/lite` entry builds a grid with only the features you pass; the rest is left out of your bundle (about 60KB with no features, about 78KB with the `standardFeatures` preset).
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid/lite'
|
|
54
|
+
import '@ishibashi0112/spreadsheet-grid/style.css'
|
|
55
|
+
|
|
56
|
+
// Create it once at module level, not inside a component.
|
|
57
|
+
const Grid = createSpreadsheetGrid({ features: { ...standardFeatures, serverSide: serverSideFeature } })
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Props, the `ref` handle and types are the same as `SpreadsheetGrid`. Props of features you did not pass do nothing; in development a `console.warn` names the feature to add. The feature list and sizes are in `API_REFERENCE.md` (「機能を選んで組み込む」).
|
|
61
|
+
|
|
44
62
|
## Documentation in this package
|
|
45
63
|
|
|
46
64
|
Everything below ships inside the npm package, so it is available offline (for example to coding agents reading `node_modules`).
|
|
@@ -49,7 +67,8 @@ Everything below ships inside the npm package, so it is available offline (for e
|
|
|
49
67
|
| --- | --- |
|
|
50
68
|
| Full API reference — props, column options, imperative handle (`ref`), recipes (Japanese) | `API_REFERENCE.md` in this package |
|
|
51
69
|
| Per-field docs (shown on hover) | JSDoc in the type definitions. Field docs live in `@ishibashi0112/spreadsheet-grid-core/dist/model/gridTypes.core.d.ts` and match the tables in `API_REFERENCE.md` |
|
|
52
|
-
| Guides
|
|
70
|
+
| Guides with live demos (Japanese), playground, theme builder | [datasheet-grid.vercel.app](https://datasheet-grid.vercel.app) |
|
|
71
|
+
| Design notes, changelog | [GitHub README](https://github.com/ishibashi0112/datasheet-grid#readme) / [CHANGELOG.md](https://github.com/ishibashi0112/datasheet-grid/blob/main/CHANGELOG.md) |
|
|
53
72
|
|
|
54
73
|
## Rules that are easy to get wrong
|
|
55
74
|
|
|
@@ -71,6 +90,24 @@ MIT
|
|
|
71
90
|
|
|
72
91
|
React 19 向けの仮想化スプレッドシート / データグリッドです(約 100 万行・列固定・Excel ライクな編集 / 選択 / クリップボード・フィルター / ソート・クライアントサイド / サーバーサイド行モデル)。
|
|
73
92
|
|
|
93
|
+
**[ドキュメントとライブデモ](https://datasheet-grid.vercel.app)** · [プレイグラウンド](https://datasheet-grid.vercel.app/playground) · [GitHub](https://github.com/ishibashi0112/datasheet-grid) · [変更履歴](https://github.com/ishibashi0112/datasheet-grid/blob/main/CHANGELOG.md)
|
|
94
|
+
|
|
95
|
+
Astryx / Mantine / HeroUI v3 / shadcn/ui の中で使うときは、`style.css` の後にそれぞれのテーマ(`themes/astryx.css` / `themes/mantine.css` / `themes/heroui.css` / `themes/shadcn.css`)を読み込むと、配色がデザインシステムのテーマとライト / ダークに揃います([ガイド](https://datasheet-grid.vercel.app/docs/guides/design-systems))。
|
|
96
|
+
|
|
97
|
+
### バンドルを小さくする: `/lite`(0.54.0 から)
|
|
98
|
+
|
|
99
|
+
`SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約 112KB gzip)。`/lite` の入口では、渡した機能だけを入れたグリッドを作れます。渡さなかった機能はバンドルに入りません(機能なしで約 60KB、プリセット `standardFeatures` で約 78KB)。
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid/lite'
|
|
103
|
+
import '@ishibashi0112/spreadsheet-grid/style.css'
|
|
104
|
+
|
|
105
|
+
// コンポーネントの中ではなく、モジュールの先頭で 1 回だけ作る
|
|
106
|
+
const Grid = createSpreadsheetGrid({ features: { ...standardFeatures, serverSide: serverSideFeature } })
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
props・`ref` ハンドル・型は `SpreadsheetGrid` と同じです。渡していない機能の prop は何もせず、開発時は足すべき機能を `console.warn` で知らせます。機能の一覧とサイズは `API_REFERENCE.md` の「機能を選んで組み込む」にあります。
|
|
110
|
+
|
|
74
111
|
### このパッケージに同梱のドキュメント
|
|
75
112
|
|
|
76
113
|
npm パッケージに同梱されているため、オフライン(`node_modules` を読むコーディングエージェント等)でも参照できます。
|
|
@@ -79,7 +116,8 @@ npm パッケージに同梱されているため、オフライン(`node_module
|
|
|
79
116
|
| --- | --- |
|
|
80
117
|
| API リファレンス全体(props / 列定義 / 命令的 API(`ref`)/ レシピ) | 本パッケージ直下の `API_REFERENCE.md` |
|
|
81
118
|
| フィールドごとの説明(ホバーで表示) | 型定義の JSDoc。各フィールドの説明は `@ishibashi0112/spreadsheet-grid-core/dist/model/gridTypes.core.d.ts` にあり、`API_REFERENCE.md` の表と同じ内容 |
|
|
82
|
-
|
|
|
119
|
+
| ライブデモ付きのガイド / プレイグラウンド / テーマビルダー | [datasheet-grid.vercel.app](https://datasheet-grid.vercel.app) |
|
|
120
|
+
| 設計メモ / 変更履歴 | [GitHub の README](https://github.com/ishibashi0112/datasheet-grid#readme) / [CHANGELOG.md](https://github.com/ishibashi0112/datasheet-grid/blob/main/CHANGELOG.md) |
|
|
83
121
|
|
|
84
122
|
### 間違えやすいルール
|
|
85
123
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./useVirtualizerCore-
|
|
1
|
+
import { t as e } from "./useVirtualizerCore-BFcqP3Eh.js";
|
|
2
2
|
import { useDeferredValue as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
3
3
|
import { cx as o } from "@ishibashi0112/spreadsheet-grid-core/logic/cx";
|
|
4
4
|
import { createPortal as s } from "react-dom";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./useVirtualizerCore-CzoP0AUm.cjs");let t=require("react"),n=require("@ishibashi0112/spreadsheet-grid-core/logic/cx"),r=require("react-dom"),i=require("react/jsx-runtime"),a=require("@ishibashi0112/spreadsheet-grid-core/logic/filtering"),o=require("@ishibashi0112/spreadsheet-grid-core/logic/dateFilterPresets"),s=require("@ishibashi0112/spreadsheet-grid-core/logic/setFilterSearch"),c=require("@ishibashi0112/spreadsheet-grid-core/logic/setFilterSelection"),l=require("@ishibashi0112/spreadsheet-grid-core/logic/numberFilterCondition"),u=require("@ishibashi0112/spreadsheet-grid-core/logic/textFilterCondition"),d=require("@ishibashi0112/spreadsheet-grid-core/logic/dateFilterCondition"),f=require("@ishibashi0112/spreadsheet-grid-core/logic/datePickerCalendar"),p=require("@ishibashi0112/spreadsheet-grid-core/logic/dateFilterTree");function m({value:e,onCommit:r,ariaLabel:o,inputRef:s,onRequestClose:c,align:l=`left`}){let[u,d]=(0,t.useState)(null),[p,m]=(0,t.useState)(!1),[h,g]=(0,t.useState)(!1),[_,v]=(0,t.useState)(`days`),[y,b]=(0,t.useState)(()=>new Date().getFullYear()),[x,S]=(0,t.useState)(()=>new Date().getMonth()),C=(0,t.useRef)(null),w=u??(0,f.formatFilterDateDisplay)(e),T=(0,a.toDateKey)(new Date)??``,E=()=>{if(u===null)return;let e=u.trim();if(e===``){r(``),d(null),m(!1);return}let t=(0,a.toDateKey)(e);if(t===null){m(!0);return}r(t),d(null),m(!1)},D=()=>{let[t,n]=(e===``?T:e).split(`-`);b(Number(t)),S(Number(n)-1),v(`days`),g(!0)},O=()=>{g(!1)},k=e=>{r(e),d(null),m(!1),O()};(0,t.useEffect)(()=>{if(!h)return;let e=e=>{let t=e.target;t&&C.current?.contains(t)||g(!1)};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[h]);let A=e=>{if(e.stopPropagation(),e.key===`Enter`){if(e.nativeEvent.isComposing)return;e.preventDefault(),E(),O();return}if(e.key===`Escape`){if(e.preventDefault(),h){O();return}c()}},j=e=>({onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),e()},onKeyDown:t=>{t.stopPropagation(),(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())}}),M=e=>{if(_===`days`){let t=new Date(y,x+e,1);b(t.getFullYear()),S(t.getMonth());return}if(_===`months`){b(t=>t+e);return}b(t=>t+e*12)},N=()=>{v(e=>e===`days`?`months`:`years`)},P=()=>{v(e=>e===`years`?`months`:`days`)},F=_===`days`?(0,f.formatCalendarTitle)(y,x):_===`months`?`${y}年`:`${(0,f.yearGridStart)(y)} – ${(0,f.yearGridStart)(y)+11}`;return(0,i.jsxs)(`div`,{ref:C,className:`ssg-dp-root`,children:[(0,i.jsxs)(`div`,{className:(0,n.cx)(`ssg-dp-field`,h&&`ssg-dp-field--open`,p&&`ssg-dp-field--invalid`),children:[(0,i.jsx)(`input`,{ref:s,type:`text`,inputMode:`numeric`,value:w,placeholder:`yyyy/mm/dd`,"aria-label":o,"aria-invalid":p||void 0,className:`ssg-dp-input`,onChange:e=>{d(e.target.value),m(!1)},onKeyDown:A,onBlur:E}),(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-cal-btn`,"aria-label":h?`カレンダーを閉じる`:`カレンダーを開く`,...j(()=>{h?O():D()}),children:(0,i.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,i.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`12`,rx:`1.5`,fill:`none`,stroke:`currentColor`}),(0,i.jsx)(`line`,{x1:`1.5`,y1:`6`,x2:`14.5`,y2:`6`,stroke:`currentColor`}),(0,i.jsx)(`line`,{x1:`5`,y1:`1`,x2:`5`,y2:`4`,stroke:`currentColor`}),(0,i.jsx)(`line`,{x1:`11`,y1:`1`,x2:`11`,y2:`4`,stroke:`currentColor`})]})})]}),h&&(0,i.jsxs)(`div`,{className:(0,n.cx)(`ssg-dp-panel`,l===`right`&&`ssg-dp-panel--right`),children:[(0,i.jsxs)(`div`,{className:`ssg-dp-nav`,children:[(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-nav-btn`,"aria-label":`前へ`,...j(()=>M(-1)),children:`‹`}),(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-nav-title`,disabled:_===`years`,"aria-label":`表示単位を切り替える`,...j(N),children:F}),(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-nav-btn`,"aria-label":`次へ`,...j(()=>M(1)),children:`›`})]}),_===`days`&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`ssg-dp-dow`,children:f.CALENDAR_DOW_LABELS.map((e,t)=>(0,i.jsx)(`span`,{className:(0,n.cx)(t===0&&`ssg-dp-dow--sun`,t===6&&`ssg-dp-dow--sat`),children:e},e))}),(0,i.jsx)(`div`,{className:`ssg-dp-days`,children:(0,f.buildCalendarDayCells)(y,x).map(t=>(0,i.jsx)(`button`,{type:`button`,className:(0,n.cx)(`ssg-dp-day`,!t.inCurrentMonth&&`ssg-dp-day--out`,t.key===T&&`ssg-dp-day--today`,t.key===e&&`ssg-dp-day--selected`),"aria-label":t.key,...j(()=>k(t.key)),children:t.day},t.key))})]}),_===`months`&&(0,i.jsx)(`div`,{className:`ssg-dp-grid`,children:f.CALENDAR_MONTH_LABELS.map((e,t)=>(0,i.jsx)(`button`,{type:`button`,className:(0,n.cx)(`ssg-dp-cell`,t===x&&`ssg-dp-cell--selected`),...j(()=>{S(t),v(`days`)}),children:e},e))}),_===`years`&&(0,i.jsx)(`div`,{className:`ssg-dp-grid`,children:(0,f.buildYearGrid)(y).map(e=>(0,i.jsx)(`button`,{type:`button`,className:(0,n.cx)(`ssg-dp-cell`,e===y&&`ssg-dp-cell--selected`),...j(()=>{b(e),v(`months`)}),children:e},e))}),(0,i.jsxs)(`div`,{className:`ssg-dp-foot`,children:[_!==`days`&&(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-foot-btn`,...j(P),children:`← 戻る`}),(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-foot-btn`,...j(()=>k(T)),children:`今日`}),(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-foot-btn ssg-dp-foot-btn--muted`,...j(()=>k(``)),children:`クリア`})]})]})]})}var h=24;function g({options:n,setSelection:r,searchInputRef:a,onValueToggle:o,onSelectAllChange:l,onReplaceSelection:u,onRequestClose:d,isServerSide:f,selectAllUsesExplicitScope:p=!1,truncated:m=!1}){let[g,_]=(0,t.useState)(``),v=(0,t.useDeferredValue)(g),y=(0,t.useMemo)(()=>(0,s.filterSetOptionsBySearch)(n,v),[n,v]),b=v.trim().length>0,x=(0,t.useRef)(null),S=e.t({count:y.length,getScrollElement:()=>x.current,estimateSize:()=>h,overscan:10}),C=(0,t.useMemo)(()=>{if(r===null)return y.length;let e=0;for(let t of y)(0,c.isSetValueSelected)(r,t.value)&&(e+=1);return e},[r,y]),T=y.length>0&&C===y.length,E=C>0&&!T,D=(0,t.useMemo)(()=>new Set(n.map(e=>e.value)),[n]),O=(0,t.useMemo)(()=>{if(r===null)return n.length;let e=0;for(let t of r.values)D.has(t)&&(e+=1);return r.mode===`include`?e:n.length-e},[r,D,n.length]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`input`,{ref:a,type:`text`,value:g,onChange:e=>_(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),d()),e.key===`Enter`){if(e.nativeEvent.isComposing)return;e.preventDefault();let t=(0,s.resolveSetFilterEnterAction)(n,g);if(t.kind===`none`)return;t.kind===`replace`&&u(t.values),d()}},placeholder:`検索(Enter で確定)`,className:`ssg-filter-input`}),(0,i.jsxs)(`label`,{className:`ssg-filter-selectall`,children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:T,ref:e=>{e&&(e.indeterminate=E)},onChange:()=>{l(b||p?y.map(e=>e.value):`all`,!T)}}),(0,i.jsx)(`span`,{className:`ssg-filter-selectall-label`,children:b?`(検索結果をすべて選択)`:`(すべて選択)`})]}),(0,i.jsx)(`div`,{ref:x,className:`ssg-filter-list`,children:y.length===0?(0,i.jsx)(`div`,{className:`ssg-filter-empty`,children:n.length===0?f?`候補が未指定です(serverSide では列に filterOptions などの候補供給が必要)`:`候補がありません`:`一致する候補がありません`}):(0,i.jsx)(`div`,{className:`ssg-filter-virt`,style:{height:S.getTotalSize()},children:S.getVirtualItems().map(e=>{let t=y[e.index];if(!t)return null;let n=(0,c.isSetValueSelected)(r,t.value);return(0,i.jsxs)(`label`,{className:`ssg-filter-option`,style:{transform:`translateY(${e.start}px)`,height:e.size},children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>o(t.value)}),(0,i.jsx)(`span`,{className:`ssg-filter-option-label`,children:t.label})]},t.value)})})}),(0,i.jsxs)(`div`,{className:`ssg-filter-meta`,children:[`選択中: `,O,` / `,n.length,` 件`,b?`(表示中 ${y.length} 件)`:``,m&&(0,i.jsx)(w,{})]})]})}var _=e=>e.nativeEvent.isComposing===!0,v=(e,t,n)=>{if(_(n)){e(t,{commit:!1});return}e(t)};function y({draft:e,valueInputRef:t,onDraftChange:n,onKeyDown:r}){let a=(0,l.numberFilterOperandCount)(e.operator);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`select`,{value:e.operator,onChange:t=>n({...e,operator:t.target.value}),onKeyDown:r,className:`ssg-filter-select`,"aria-label":`条件の演算子`,children:l.NUMBER_FILTER_OPERATOR_OPTIONS.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},e.value))}),a>0?(0,i.jsxs)(`div`,{className:`ssg-filter-cond-values`,children:[(0,i.jsx)(`input`,{ref:t,type:`text`,inputMode:`decimal`,value:e.value1,onChange:t=>v(n,{...e,value1:t.target.value},t),onCompositionEnd:t=>n({...e,value1:t.currentTarget.value}),onKeyDown:r,placeholder:a===2?`下限`:`値`,className:`ssg-filter-input`,"aria-label":a===2?`下限`:`条件の値`}),a===2&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`ssg-filter-cond-tilde`,children:`〜`}),(0,i.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:e.value2,onChange:t=>v(n,{...e,value2:t.target.value},t),onCompositionEnd:t=>n({...e,value2:t.currentTarget.value}),onKeyDown:r,placeholder:`上限`,className:`ssg-filter-input`,"aria-label":`上限`})]})]}):(0,i.jsx)(`div`,{className:`ssg-filter-meta`,children:`この演算子は値入力を使いません`})]})}function b({draft:e,valueInputRef:t,onDraftChange:n,onKeyDown:r}){let a=(0,u.textFilterOperandCount)(e.operator);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`select`,{value:e.operator,onChange:t=>n({...e,operator:t.target.value}),onKeyDown:r,className:`ssg-filter-select`,"aria-label":`条件の演算子`,children:u.TEXT_FILTER_OPERATOR_OPTIONS.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},e.value))}),a>0?(0,i.jsx)(`div`,{className:`ssg-filter-cond-values`,children:(0,i.jsx)(`input`,{ref:t,type:`text`,value:e.value,onChange:t=>v(n,{...e,value:t.target.value},t),onCompositionEnd:t=>n({...e,value:t.currentTarget.value}),onKeyDown:r,placeholder:`値`,className:`ssg-filter-input`,"aria-label":`条件の値`})}):(0,i.jsx)(`div`,{className:`ssg-filter-meta`,children:`この演算子は値入力を使いません`})]})}function x({draft:e,valueInputRef:t,onDraftChange:r,onKeyDown:a,presets:o,renderDateInput:s,onRequestClose:c}){let l=e.preset===null?(0,d.dateFilterOperandCount)(e.operator):0,u=(t,n)=>{r({...e,[t]:(0,d.normalizeFilterDateInputValue)(n),preset:null})};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`select`,{value:e.operator,onChange:t=>r({...e,operator:t.target.value,preset:null}),onKeyDown:a,className:`ssg-filter-select`,"aria-label":`条件の演算子`,children:d.DATE_FILTER_OPERATOR_OPTIONS.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},e.value))}),l>0?(0,i.jsxs)(`div`,{className:`ssg-filter-cond-values`,children:[s?s({value:e.value1,onChange:e=>u(`value1`,e),ariaLabel:l===2?`開始日`:`条件の日付`,slot:l===2?`from`:`single`}):(0,i.jsx)(m,{value:e.value1,onCommit:t=>r({...e,value1:t,preset:null}),ariaLabel:l===2?`開始日`:`条件の日付`,inputRef:t,onRequestClose:c}),l===2&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`ssg-filter-cond-tilde`,children:`〜`}),s?s({value:e.value2,onChange:e=>u(`value2`,e),ariaLabel:`終了日`,slot:`to`}):(0,i.jsx)(m,{value:e.value2,onCommit:t=>r({...e,value2:t,preset:null}),ariaLabel:`終了日`,onRequestClose:c,align:`right`})]})]}):e.preset===null?(0,i.jsx)(`div`,{className:`ssg-filter-meta`,children:`この演算子は値入力を使いません`}):null,o.length>0&&(0,i.jsx)(`div`,{className:`ssg-filter-presets`,children:o.map(t=>(0,i.jsx)(`button`,{type:`button`,onPointerDown:n=>{n.preventDefault(),n.stopPropagation(),r({...e,preset:e.preset===t.id?null:t.id})},onKeyDown:n=>{n.stopPropagation(),(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),r({...e,preset:e.preset===t.id?null:t.id}))},className:(0,n.cx)(`ssg-filter-preset-chip`,e.preset===t.id&&`ssg-filter-preset-chip--active`),children:t.label},t.id))})]})}function S({options:n,setSelection:r,searchInputRef:a,onValueToggle:o,onSelectAllChange:l,onReplaceSelection:u,onRequestClose:d,isServerSide:f,truncated:m=!1}){let[g,_]=(0,t.useState)(``),v=(0,t.useDeferredValue)(g),[y,b]=(0,t.useState)(()=>new Set),x=v.trim().length>0,S=(0,t.useMemo)(()=>(0,s.filterSetOptionsBySearch)(n,v),[n,v]),C=(0,t.useMemo)(()=>(0,p.buildDateTreeRows)(n,y),[n,y]),T=(0,t.useRef)(null),E=x?S.length:C.length,D=e.t({count:E,getScrollElement:()=>T.current,estimateSize:()=>h,overscan:10}),O=(0,t.useMemo)(()=>(x?S:n).map(e=>e.value),[x,S,n]),k=(0,t.useMemo)(()=>{let e=0;for(let t of O)(0,c.isSetValueSelected)(r,t)&&(e+=1);return e},[O,r]),A=O.length>0&&k===O.length,j=k>0&&!A,M=(0,t.useMemo)(()=>new Set(n.map(e=>e.value)),[n]),N=(0,t.useMemo)(()=>{if(r===null)return n.length;let e=0;for(let t of r.values)M.has(t)&&(e+=1);return r.mode===`include`?e:n.length-e},[r,M,n.length]),P=e=>{b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},F=e=>{let t=0;for(let n of e)(0,c.isSetValueSelected)(r,n)&&(t+=1);return t},I=e=>{let t=F(e.leafKeys),n=e.leafKeys.length>0&&t===e.leafKeys.length,r=t>0&&!n;return(0,i.jsxs)(i.Fragment,{children:[e.type===`group`?(0,i.jsx)(`button`,{type:`button`,onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),P(e.key)},onKeyDown:t=>{t.stopPropagation(),(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),P(e.key))},className:`ssg-filter-tree-toggle`,"aria-label":e.expanded?`折りたたむ`:`展開する`,children:e.expanded?`▾`:`▸`}):(0,i.jsx)(`span`,{className:`ssg-filter-tree-toggle ssg-filter-tree-toggle--placeholder`}),(0,i.jsx)(`input`,{type:`checkbox`,checked:n,ref:e=>{e&&(e.indeterminate=r)},onChange:()=>{if(e.type===`leaf`){o(e.key);return}l(e.leafKeys,!n)}}),(0,i.jsx)(`span`,{className:`ssg-filter-option-label`,children:e.label})]})};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`input`,{ref:a,type:`text`,value:g,onChange:e=>_(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),d()),e.key===`Enter`){if(e.nativeEvent.isComposing)return;e.preventDefault();let t=(0,s.resolveSetFilterEnterAction)(n,g);if(t.kind===`none`)return;t.kind===`replace`&&u(t.values),d()}},placeholder:`検索(Enter で確定)`,className:`ssg-filter-input`}),(0,i.jsxs)(`label`,{className:`ssg-filter-selectall`,children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:A,ref:e=>{e&&(e.indeterminate=j)},onChange:()=>l(O,!A)}),(0,i.jsx)(`span`,{className:`ssg-filter-selectall-label`,children:x?`(検索結果をすべて選択)`:`(すべて選択)`})]}),(0,i.jsx)(`div`,{ref:T,className:`ssg-filter-list`,children:E===0?(0,i.jsx)(`div`,{className:`ssg-filter-empty`,children:n.length===0?f?`候補が未指定です(serverSide では列に filterOptions などの候補供給が必要)`:`候補がありません`:`一致する候補がありません`}):(0,i.jsx)(`div`,{className:`ssg-filter-virt`,style:{height:D.getTotalSize()},children:D.getVirtualItems().map(e=>{if(x){let t=S[e.index];return t?(0,i.jsxs)(`label`,{className:`ssg-filter-option`,style:{transform:`translateY(${e.start}px)`,height:e.size},children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:(0,c.isSetValueSelected)(r,t.value),onChange:()=>o(t.value)}),(0,i.jsx)(`span`,{className:`ssg-filter-option-label`,children:t.label})]},t.value):null}let t=C[e.index];return t?(0,i.jsx)(`div`,{className:`ssg-filter-option`,style:{transform:`translateY(${e.start}px)`,height:e.size,paddingLeft:8+t.depth*16},children:I(t)},t.key):null})})}),(0,i.jsxs)(`div`,{className:`ssg-filter-meta`,children:[`選択中: `,N,` / `,n.length,` 件`,x?`(表示中 ${S.length} 件)`:``,m&&(0,i.jsx)(w,{})]})]})}function C({status:e,errorMessage:t,onRetry:n}){return e===`loading`?(0,i.jsx)(`div`,{className:`ssg-filter-collecting`,children:`候補を取得中…`}):(0,i.jsxs)(`div`,{className:`ssg-filter-error`,role:`alert`,children:[(0,i.jsx)(`div`,{children:`候補の取得に失敗しました`}),t?(0,i.jsx)(`div`,{className:`ssg-filter-error-detail`,title:t,children:t}):null,n?(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),n()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:`ssg-filter-btn-secondary`,children:`再試行`}):null]})}function w(){return(0,i.jsx)(`span`,{className:`ssg-filter-truncated`,children:`(先頭のみ・打ち切り)`})}function T({conditionEditor:e,conditionActive:t,onConditionClear:n,options:r,setSelection:a,onSelectionClear:o,summaryText:s,children:c,optionsMeta:l}){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`div`,{className:`ssg-filter-sec-head`,children:[(0,i.jsx)(`span`,{className:`ssg-filter-sec-label`,children:`条件`}),(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),n()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:`ssg-filter-sec-clear`,disabled:!t,children:`クリア`})]}),e,(0,i.jsx)(`div`,{className:`ssg-filter-sep`}),(0,i.jsxs)(`div`,{className:`ssg-filter-sec-head`,children:[(0,i.jsx)(`span`,{className:`ssg-filter-sec-label`,children:`値`}),(0,i.jsx)(`span`,{className:`ssg-filter-sec-meta`,children:l??(t?`一致 ${r.length} 件`:`全 ${r.length} 件`)}),(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),o()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},className:`ssg-filter-sec-clear`,disabled:a===null,children:`クリア`})]}),c,(0,i.jsxs)(`div`,{className:`ssg-filter-summary`,children:[`🔽 `,s]})]})}function E({isOpen:e,themeClassName:a,popoverSlot:s,title:c,filterType:f,draftValue:p,numberConditionDraft:m,onNumberConditionDraftChange:h,textConditionDraft:_,onTextConditionDraftChange:v,dateConditionDraft:E,onDateConditionDraftChange:D,datePresets:O,renderDateInput:k,onComboConditionClear:A,onComboSelectionClear:j,comboSummaryText:M,currentValueText:N,layout:P,selectOptions:F,optionsStatus:I,optionsProgress:ee,optionsTruncated:L=!1,optionsErrorMessage:te,onOptionsRetry:ne,setSelection:R,popoverRef:re,textInputRef:z,selectRef:ie,onRequestClose:B,onDraftChange:ae,onApply:V,onClear:oe,onSetValueToggle:H,onSetSelectAllChange:U,onSetClear:se,onSetReplaceSelection:W,isServerSide:G=!1}){let ce=(0,t.useRef)(null),[le]=(0,t.useState)(()=>new Date);if(typeof document>`u`||!e||!P)return null;let ue={top:P.top,left:P.left,width:P.width,maxHeight:P.maxHeight},de=e=>{e.stopPropagation()},fe=e=>{e.stopPropagation()},pe=f===`set`,K=f===`numberSet`,q=f===`textSet`,J=f===`dateSet`,Y=K||q||J,X=pe||Y,me=I===`loading`||I===`error`,Z=m??l.DEFAULT_NUMBER_FILTER_DRAFT,he=_??u.DEFAULT_TEXT_FILTER_DRAFT,ge=E??d.DEFAULT_DATE_FILTER_DRAFT,_e=O??(0,o.normalizeDateFilterPresets)(void 0),ve=K?(0,l.buildParsedNumberFilterFromDraft)(Z):null,ye=q?(0,u.buildParsedTextFilterFromDraft)(he):null,be=J?(0,d.buildParsedDateFilterFromDraft)(ge):null,xe=ve!==null||ye!==null||be!==null,Q=K?(0,l.filterOptionsByNumberCondition)(F,ve):q?(0,u.filterOptionsByTextCondition)(F,ye):J?(0,d.filterOptionsByDateCondition)(F,be,le,_e):F,$=e=>{if(e.stopPropagation(),!e.nativeEvent.isComposing){if(e.key===`Enter`){e.preventDefault(),V();return}e.key===`Escape`&&(e.preventDefault(),B())}},Se=K?(0,i.jsx)(y,{draft:Z,valueInputRef:z,onDraftChange:h,onKeyDown:$}):q?(0,i.jsx)(b,{draft:he,valueInputRef:z,onDraftChange:v,onKeyDown:$}):(0,i.jsx)(x,{draft:ge,valueInputRef:z,onDraftChange:D,onKeyDown:$,presets:_e,renderDateInput:k,onRequestClose:B});return(0,r.createPortal)((0,i.jsxs)(`div`,{ref:re,onPointerDown:fe,onKeyDown:de,onPasteCapture:e=>{e.stopPropagation()},className:(0,n.cx)(`ssg-filter-popover`,a,s?.className),style:{...s?.style,...ue},children:[(0,i.jsxs)(`div`,{className:`ssg-filter-title`,children:[`列フィルター: `,c]}),(X||f===`select`)&&I===`collecting`?(0,i.jsxs)(`div`,{className:`ssg-filter-collecting`,children:[`候補を収集中… `,Math.round(ee*100),`%`]}):(X||f===`select`)&&me?Y?(0,i.jsx)(T,{conditionEditor:Se,conditionActive:xe,onConditionClear:A,options:Q,setSelection:R,onSelectionClear:j,summaryText:M,optionsMeta:I===`loading`?`取得中…`:`取得失敗`,children:(0,i.jsx)(C,{status:I===`loading`?`loading`:`error`,errorMessage:te,onRetry:ne})}):(0,i.jsx)(C,{status:I===`loading`?`loading`:`error`,errorMessage:te,onRetry:ne}):Y?(0,i.jsx)(T,{conditionEditor:Se,conditionActive:xe,onConditionClear:A,options:Q,setSelection:R,onSelectionClear:j,summaryText:M,children:J?(0,i.jsx)(S,{options:Q,setSelection:R,searchInputRef:ce,onValueToggle:H,onSelectAllChange:U,onReplaceSelection:W,onRequestClose:B,isServerSide:G,truncated:L}):(0,i.jsx)(g,{options:Q,setSelection:R,searchInputRef:ce,onValueToggle:H,onSelectAllChange:U,onReplaceSelection:W,onRequestClose:B,isServerSide:G,selectAllUsesExplicitScope:!0,truncated:L})}):pe?(0,i.jsx)(g,{options:F,setSelection:R,searchInputRef:z,onValueToggle:H,onSelectAllChange:U,onReplaceSelection:W,onRequestClose:B,isServerSide:G,truncated:L}):f===`number`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`ssg-filter-hint`,children:`フィルター種別: number`}),(0,i.jsx)(y,{draft:Z,valueInputRef:z,onDraftChange:h,onKeyDown:$})]}):f===`select`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`ssg-filter-hint`,children:`フィルター種別: select`}),(0,i.jsxs)(`select`,{ref:ie,value:p,onChange:e=>ae(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Enter`){e.preventDefault(),V();return}e.key===`Escape`&&(e.preventDefault(),B())},className:`ssg-filter-select`,children:[(0,i.jsx)(`option`,{value:``,children:`(すべて)`}),F.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},`${c}-${e.value}`))]}),(0,i.jsxs)(`div`,{className:`ssg-filter-meta`,children:[`候補数: `,F.length,L&&(0,i.jsx)(w,{})]})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`div`,{className:`ssg-filter-hint`,children:[`フィルター種別: `,f]}),(0,i.jsx)(`input`,{ref:z,type:`text`,value:p,onChange:e=>ae(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),!e.nativeEvent.isComposing){if(e.key===`Enter`){e.preventDefault(),V();return}e.key===`Escape`&&(e.preventDefault(),B())}},placeholder:`部分一致で絞り込み`,className:`ssg-filter-input`}),(0,i.jsx)(`div`,{className:`ssg-filter-meta ssg-filter-meta--ellipsis`,children:`部分一致検索です`})]}),!X&&(0,i.jsxs)(`div`,{className:`ssg-filter-meta ssg-filter-meta--ellipsis`,children:[`現在値: `,N]}),(0,i.jsx)(`div`,{className:`ssg-filter-footer`,children:X?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),se()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),se())},className:`ssg-filter-btn-secondary`,children:`クリア`}),(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),B()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),B())},className:`ssg-filter-btn-primary`,children:`閉じる`})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),oe()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),oe())},className:`ssg-filter-btn-secondary`,children:`クリア`}),(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),V()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),V())},className:`ssg-filter-btn-primary`,children:`適用`})]})})]}),document.body)}exports.ColumnFilterPopover=E,exports.default=E;
|
|
1
|
+
const e=require("./useVirtualizerCore-CrusdCD3.cjs");let t=require("react"),n=require("@ishibashi0112/spreadsheet-grid-core/logic/cx"),r=require("react-dom"),i=require("react/jsx-runtime"),a=require("@ishibashi0112/spreadsheet-grid-core/logic/filtering"),o=require("@ishibashi0112/spreadsheet-grid-core/logic/dateFilterPresets"),s=require("@ishibashi0112/spreadsheet-grid-core/logic/setFilterSearch"),c=require("@ishibashi0112/spreadsheet-grid-core/logic/setFilterSelection"),l=require("@ishibashi0112/spreadsheet-grid-core/logic/numberFilterCondition"),u=require("@ishibashi0112/spreadsheet-grid-core/logic/textFilterCondition"),d=require("@ishibashi0112/spreadsheet-grid-core/logic/dateFilterCondition"),f=require("@ishibashi0112/spreadsheet-grid-core/logic/datePickerCalendar"),p=require("@ishibashi0112/spreadsheet-grid-core/logic/dateFilterTree");function m({value:e,onCommit:r,ariaLabel:o,inputRef:s,onRequestClose:c,align:l=`left`}){let[u,d]=(0,t.useState)(null),[p,m]=(0,t.useState)(!1),[h,g]=(0,t.useState)(!1),[_,v]=(0,t.useState)(`days`),[y,b]=(0,t.useState)(()=>new Date().getFullYear()),[x,S]=(0,t.useState)(()=>new Date().getMonth()),C=(0,t.useRef)(null),w=u??(0,f.formatFilterDateDisplay)(e),T=(0,a.toDateKey)(new Date)??``,E=()=>{if(u===null)return;let e=u.trim();if(e===``){r(``),d(null),m(!1);return}let t=(0,a.toDateKey)(e);if(t===null){m(!0);return}r(t),d(null),m(!1)},D=()=>{let[t,n]=(e===``?T:e).split(`-`);b(Number(t)),S(Number(n)-1),v(`days`),g(!0)},O=()=>{g(!1)},k=e=>{r(e),d(null),m(!1),O()};(0,t.useEffect)(()=>{if(!h)return;let e=e=>{let t=e.target;t&&C.current?.contains(t)||g(!1)};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[h]);let A=e=>{if(e.stopPropagation(),e.key===`Enter`){if(e.nativeEvent.isComposing)return;e.preventDefault(),E(),O();return}if(e.key===`Escape`){if(e.preventDefault(),h){O();return}c()}},j=e=>({onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),e()},onKeyDown:t=>{t.stopPropagation(),(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())}}),M=e=>{if(_===`days`){let t=new Date(y,x+e,1);b(t.getFullYear()),S(t.getMonth());return}if(_===`months`){b(t=>t+e);return}b(t=>t+e*12)},N=()=>{v(e=>e===`days`?`months`:`years`)},P=()=>{v(e=>e===`years`?`months`:`days`)},F=_===`days`?(0,f.formatCalendarTitle)(y,x):_===`months`?`${y}年`:`${(0,f.yearGridStart)(y)} – ${(0,f.yearGridStart)(y)+11}`;return(0,i.jsxs)(`div`,{ref:C,className:`ssg-dp-root`,children:[(0,i.jsxs)(`div`,{className:(0,n.cx)(`ssg-dp-field`,h&&`ssg-dp-field--open`,p&&`ssg-dp-field--invalid`),children:[(0,i.jsx)(`input`,{ref:s,type:`text`,inputMode:`numeric`,value:w,placeholder:`yyyy/mm/dd`,"aria-label":o,"aria-invalid":p||void 0,className:`ssg-dp-input`,onChange:e=>{d(e.target.value),m(!1)},onKeyDown:A,onBlur:E}),(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-cal-btn`,"aria-label":h?`カレンダーを閉じる`:`カレンダーを開く`,...j(()=>{h?O():D()}),children:(0,i.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,i.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`12`,rx:`1.5`,fill:`none`,stroke:`currentColor`}),(0,i.jsx)(`line`,{x1:`1.5`,y1:`6`,x2:`14.5`,y2:`6`,stroke:`currentColor`}),(0,i.jsx)(`line`,{x1:`5`,y1:`1`,x2:`5`,y2:`4`,stroke:`currentColor`}),(0,i.jsx)(`line`,{x1:`11`,y1:`1`,x2:`11`,y2:`4`,stroke:`currentColor`})]})})]}),h&&(0,i.jsxs)(`div`,{className:(0,n.cx)(`ssg-dp-panel`,l===`right`&&`ssg-dp-panel--right`),children:[(0,i.jsxs)(`div`,{className:`ssg-dp-nav`,children:[(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-nav-btn`,"aria-label":`前へ`,...j(()=>M(-1)),children:`‹`}),(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-nav-title`,disabled:_===`years`,"aria-label":`表示単位を切り替える`,...j(N),children:F}),(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-nav-btn`,"aria-label":`次へ`,...j(()=>M(1)),children:`›`})]}),_===`days`&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`ssg-dp-dow`,children:f.CALENDAR_DOW_LABELS.map((e,t)=>(0,i.jsx)(`span`,{className:(0,n.cx)(t===0&&`ssg-dp-dow--sun`,t===6&&`ssg-dp-dow--sat`),children:e},e))}),(0,i.jsx)(`div`,{className:`ssg-dp-days`,children:(0,f.buildCalendarDayCells)(y,x).map(t=>(0,i.jsx)(`button`,{type:`button`,className:(0,n.cx)(`ssg-dp-day`,!t.inCurrentMonth&&`ssg-dp-day--out`,t.key===T&&`ssg-dp-day--today`,t.key===e&&`ssg-dp-day--selected`),"aria-label":t.key,...j(()=>k(t.key)),children:t.day},t.key))})]}),_===`months`&&(0,i.jsx)(`div`,{className:`ssg-dp-grid`,children:f.CALENDAR_MONTH_LABELS.map((e,t)=>(0,i.jsx)(`button`,{type:`button`,className:(0,n.cx)(`ssg-dp-cell`,t===x&&`ssg-dp-cell--selected`),...j(()=>{S(t),v(`days`)}),children:e},e))}),_===`years`&&(0,i.jsx)(`div`,{className:`ssg-dp-grid`,children:(0,f.buildYearGrid)(y).map(e=>(0,i.jsx)(`button`,{type:`button`,className:(0,n.cx)(`ssg-dp-cell`,e===y&&`ssg-dp-cell--selected`),...j(()=>{b(e),v(`months`)}),children:e},e))}),(0,i.jsxs)(`div`,{className:`ssg-dp-foot`,children:[_!==`days`&&(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-foot-btn`,...j(P),children:`← 戻る`}),(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-foot-btn`,...j(()=>k(T)),children:`今日`}),(0,i.jsx)(`button`,{type:`button`,className:`ssg-dp-foot-btn ssg-dp-foot-btn--muted`,...j(()=>k(``)),children:`クリア`})]})]})]})}var h=24;function g({options:n,setSelection:r,searchInputRef:a,onValueToggle:o,onSelectAllChange:l,onReplaceSelection:u,onRequestClose:d,isServerSide:f,selectAllUsesExplicitScope:p=!1,truncated:m=!1}){let[g,_]=(0,t.useState)(``),v=(0,t.useDeferredValue)(g),y=(0,t.useMemo)(()=>(0,s.filterSetOptionsBySearch)(n,v),[n,v]),b=v.trim().length>0,x=(0,t.useRef)(null),S=e.t({count:y.length,getScrollElement:()=>x.current,estimateSize:()=>h,overscan:10}),C=(0,t.useMemo)(()=>{if(r===null)return y.length;let e=0;for(let t of y)(0,c.isSetValueSelected)(r,t.value)&&(e+=1);return e},[r,y]),T=y.length>0&&C===y.length,E=C>0&&!T,D=(0,t.useMemo)(()=>new Set(n.map(e=>e.value)),[n]),O=(0,t.useMemo)(()=>{if(r===null)return n.length;let e=0;for(let t of r.values)D.has(t)&&(e+=1);return r.mode===`include`?e:n.length-e},[r,D,n.length]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`input`,{ref:a,type:`text`,value:g,onChange:e=>_(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),d()),e.key===`Enter`){if(e.nativeEvent.isComposing)return;e.preventDefault();let t=(0,s.resolveSetFilterEnterAction)(n,g);if(t.kind===`none`)return;t.kind===`replace`&&u(t.values),d()}},placeholder:`検索(Enter で確定)`,className:`ssg-filter-input`}),(0,i.jsxs)(`label`,{className:`ssg-filter-selectall`,children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:T,ref:e=>{e&&(e.indeterminate=E)},onChange:()=>{l(b||p?y.map(e=>e.value):`all`,!T)}}),(0,i.jsx)(`span`,{className:`ssg-filter-selectall-label`,children:b?`(検索結果をすべて選択)`:`(すべて選択)`})]}),(0,i.jsx)(`div`,{ref:x,className:`ssg-filter-list`,children:y.length===0?(0,i.jsx)(`div`,{className:`ssg-filter-empty`,children:n.length===0?f?`候補が未指定です(serverSide では列に filterOptions などの候補供給が必要)`:`候補がありません`:`一致する候補がありません`}):(0,i.jsx)(`div`,{className:`ssg-filter-virt`,style:{height:S.getTotalSize()},children:S.getVirtualItems().map(e=>{let t=y[e.index];if(!t)return null;let n=(0,c.isSetValueSelected)(r,t.value);return(0,i.jsxs)(`label`,{className:`ssg-filter-option`,style:{transform:`translateY(${e.start}px)`,height:e.size},children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>o(t.value)}),(0,i.jsx)(`span`,{className:`ssg-filter-option-label`,children:t.label})]},t.value)})})}),(0,i.jsxs)(`div`,{className:`ssg-filter-meta`,children:[`選択中: `,O,` / `,n.length,` 件`,b?`(表示中 ${y.length} 件)`:``,m&&(0,i.jsx)(w,{})]})]})}var _=e=>e.nativeEvent.isComposing===!0,v=(e,t,n)=>{if(_(n)){e(t,{commit:!1});return}e(t)};function y({draft:e,valueInputRef:t,onDraftChange:n,onKeyDown:r}){let a=(0,l.numberFilterOperandCount)(e.operator);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`select`,{value:e.operator,onChange:t=>n({...e,operator:t.target.value}),onKeyDown:r,className:`ssg-filter-select`,"aria-label":`条件の演算子`,children:l.NUMBER_FILTER_OPERATOR_OPTIONS.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},e.value))}),a>0?(0,i.jsxs)(`div`,{className:`ssg-filter-cond-values`,children:[(0,i.jsx)(`input`,{ref:t,type:`text`,inputMode:`decimal`,value:e.value1,onChange:t=>v(n,{...e,value1:t.target.value},t),onCompositionEnd:t=>n({...e,value1:t.currentTarget.value}),onKeyDown:r,placeholder:a===2?`下限`:`値`,className:`ssg-filter-input`,"aria-label":a===2?`下限`:`条件の値`}),a===2&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`ssg-filter-cond-tilde`,children:`〜`}),(0,i.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:e.value2,onChange:t=>v(n,{...e,value2:t.target.value},t),onCompositionEnd:t=>n({...e,value2:t.currentTarget.value}),onKeyDown:r,placeholder:`上限`,className:`ssg-filter-input`,"aria-label":`上限`})]})]}):(0,i.jsx)(`div`,{className:`ssg-filter-meta`,children:`この演算子は値入力を使いません`})]})}function b({draft:e,valueInputRef:t,onDraftChange:n,onKeyDown:r}){let a=(0,u.textFilterOperandCount)(e.operator);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`select`,{value:e.operator,onChange:t=>n({...e,operator:t.target.value}),onKeyDown:r,className:`ssg-filter-select`,"aria-label":`条件の演算子`,children:u.TEXT_FILTER_OPERATOR_OPTIONS.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},e.value))}),a>0?(0,i.jsx)(`div`,{className:`ssg-filter-cond-values`,children:(0,i.jsx)(`input`,{ref:t,type:`text`,value:e.value,onChange:t=>v(n,{...e,value:t.target.value},t),onCompositionEnd:t=>n({...e,value:t.currentTarget.value}),onKeyDown:r,placeholder:`値`,className:`ssg-filter-input`,"aria-label":`条件の値`})}):(0,i.jsx)(`div`,{className:`ssg-filter-meta`,children:`この演算子は値入力を使いません`})]})}function x({draft:e,valueInputRef:t,onDraftChange:r,onKeyDown:a,presets:o,renderDateInput:s,onRequestClose:c}){let l=e.preset===null?(0,d.dateFilterOperandCount)(e.operator):0,u=(t,n)=>{r({...e,[t]:(0,d.normalizeFilterDateInputValue)(n),preset:null})};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`select`,{value:e.operator,onChange:t=>r({...e,operator:t.target.value,preset:null}),onKeyDown:a,className:`ssg-filter-select`,"aria-label":`条件の演算子`,children:d.DATE_FILTER_OPERATOR_OPTIONS.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},e.value))}),l>0?(0,i.jsxs)(`div`,{className:`ssg-filter-cond-values`,children:[s?s({value:e.value1,onChange:e=>u(`value1`,e),ariaLabel:l===2?`開始日`:`条件の日付`,slot:l===2?`from`:`single`}):(0,i.jsx)(m,{value:e.value1,onCommit:t=>r({...e,value1:t,preset:null}),ariaLabel:l===2?`開始日`:`条件の日付`,inputRef:t,onRequestClose:c}),l===2&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`ssg-filter-cond-tilde`,children:`〜`}),s?s({value:e.value2,onChange:e=>u(`value2`,e),ariaLabel:`終了日`,slot:`to`}):(0,i.jsx)(m,{value:e.value2,onCommit:t=>r({...e,value2:t,preset:null}),ariaLabel:`終了日`,onRequestClose:c,align:`right`})]})]}):e.preset===null?(0,i.jsx)(`div`,{className:`ssg-filter-meta`,children:`この演算子は値入力を使いません`}):null,o.length>0&&(0,i.jsx)(`div`,{className:`ssg-filter-presets`,children:o.map(t=>(0,i.jsx)(`button`,{type:`button`,onPointerDown:n=>{n.preventDefault(),n.stopPropagation(),r({...e,preset:e.preset===t.id?null:t.id})},onKeyDown:n=>{n.stopPropagation(),(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),r({...e,preset:e.preset===t.id?null:t.id}))},className:(0,n.cx)(`ssg-filter-preset-chip`,e.preset===t.id&&`ssg-filter-preset-chip--active`),children:t.label},t.id))})]})}function S({options:n,setSelection:r,searchInputRef:a,onValueToggle:o,onSelectAllChange:l,onReplaceSelection:u,onRequestClose:d,isServerSide:f,truncated:m=!1}){let[g,_]=(0,t.useState)(``),v=(0,t.useDeferredValue)(g),[y,b]=(0,t.useState)(()=>new Set),x=v.trim().length>0,S=(0,t.useMemo)(()=>(0,s.filterSetOptionsBySearch)(n,v),[n,v]),C=(0,t.useMemo)(()=>(0,p.buildDateTreeRows)(n,y),[n,y]),T=(0,t.useRef)(null),E=x?S.length:C.length,D=e.t({count:E,getScrollElement:()=>T.current,estimateSize:()=>h,overscan:10}),O=(0,t.useMemo)(()=>(x?S:n).map(e=>e.value),[x,S,n]),k=(0,t.useMemo)(()=>{let e=0;for(let t of O)(0,c.isSetValueSelected)(r,t)&&(e+=1);return e},[O,r]),A=O.length>0&&k===O.length,j=k>0&&!A,M=(0,t.useMemo)(()=>new Set(n.map(e=>e.value)),[n]),N=(0,t.useMemo)(()=>{if(r===null)return n.length;let e=0;for(let t of r.values)M.has(t)&&(e+=1);return r.mode===`include`?e:n.length-e},[r,M,n.length]),P=e=>{b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},F=e=>{let t=0;for(let n of e)(0,c.isSetValueSelected)(r,n)&&(t+=1);return t},I=e=>{let t=F(e.leafKeys),n=e.leafKeys.length>0&&t===e.leafKeys.length,r=t>0&&!n;return(0,i.jsxs)(i.Fragment,{children:[e.type===`group`?(0,i.jsx)(`button`,{type:`button`,onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),P(e.key)},onKeyDown:t=>{t.stopPropagation(),(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),P(e.key))},className:`ssg-filter-tree-toggle`,"aria-label":e.expanded?`折りたたむ`:`展開する`,children:e.expanded?`▾`:`▸`}):(0,i.jsx)(`span`,{className:`ssg-filter-tree-toggle ssg-filter-tree-toggle--placeholder`}),(0,i.jsx)(`input`,{type:`checkbox`,checked:n,ref:e=>{e&&(e.indeterminate=r)},onChange:()=>{if(e.type===`leaf`){o(e.key);return}l(e.leafKeys,!n)}}),(0,i.jsx)(`span`,{className:`ssg-filter-option-label`,children:e.label})]})};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`input`,{ref:a,type:`text`,value:g,onChange:e=>_(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),d()),e.key===`Enter`){if(e.nativeEvent.isComposing)return;e.preventDefault();let t=(0,s.resolveSetFilterEnterAction)(n,g);if(t.kind===`none`)return;t.kind===`replace`&&u(t.values),d()}},placeholder:`検索(Enter で確定)`,className:`ssg-filter-input`}),(0,i.jsxs)(`label`,{className:`ssg-filter-selectall`,children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:A,ref:e=>{e&&(e.indeterminate=j)},onChange:()=>l(O,!A)}),(0,i.jsx)(`span`,{className:`ssg-filter-selectall-label`,children:x?`(検索結果をすべて選択)`:`(すべて選択)`})]}),(0,i.jsx)(`div`,{ref:T,className:`ssg-filter-list`,children:E===0?(0,i.jsx)(`div`,{className:`ssg-filter-empty`,children:n.length===0?f?`候補が未指定です(serverSide では列に filterOptions などの候補供給が必要)`:`候補がありません`:`一致する候補がありません`}):(0,i.jsx)(`div`,{className:`ssg-filter-virt`,style:{height:D.getTotalSize()},children:D.getVirtualItems().map(e=>{if(x){let t=S[e.index];return t?(0,i.jsxs)(`label`,{className:`ssg-filter-option`,style:{transform:`translateY(${e.start}px)`,height:e.size},children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:(0,c.isSetValueSelected)(r,t.value),onChange:()=>o(t.value)}),(0,i.jsx)(`span`,{className:`ssg-filter-option-label`,children:t.label})]},t.value):null}let t=C[e.index];return t?(0,i.jsx)(`div`,{className:`ssg-filter-option`,style:{transform:`translateY(${e.start}px)`,height:e.size,paddingLeft:8+t.depth*16},children:I(t)},t.key):null})})}),(0,i.jsxs)(`div`,{className:`ssg-filter-meta`,children:[`選択中: `,N,` / `,n.length,` 件`,x?`(表示中 ${S.length} 件)`:``,m&&(0,i.jsx)(w,{})]})]})}function C({status:e,errorMessage:t,onRetry:n}){return e===`loading`?(0,i.jsx)(`div`,{className:`ssg-filter-collecting`,children:`候補を取得中…`}):(0,i.jsxs)(`div`,{className:`ssg-filter-error`,role:`alert`,children:[(0,i.jsx)(`div`,{children:`候補の取得に失敗しました`}),t?(0,i.jsx)(`div`,{className:`ssg-filter-error-detail`,title:t,children:t}):null,n?(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),n()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:`ssg-filter-btn-secondary`,children:`再試行`}):null]})}function w(){return(0,i.jsx)(`span`,{className:`ssg-filter-truncated`,children:`(先頭のみ・打ち切り)`})}function T({conditionEditor:e,conditionActive:t,onConditionClear:n,options:r,setSelection:a,onSelectionClear:o,summaryText:s,children:c,optionsMeta:l}){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`div`,{className:`ssg-filter-sec-head`,children:[(0,i.jsx)(`span`,{className:`ssg-filter-sec-label`,children:`条件`}),(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),n()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:`ssg-filter-sec-clear`,disabled:!t,children:`クリア`})]}),e,(0,i.jsx)(`div`,{className:`ssg-filter-sep`}),(0,i.jsxs)(`div`,{className:`ssg-filter-sec-head`,children:[(0,i.jsx)(`span`,{className:`ssg-filter-sec-label`,children:`値`}),(0,i.jsx)(`span`,{className:`ssg-filter-sec-meta`,children:l??(t?`一致 ${r.length} 件`:`全 ${r.length} 件`)}),(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),o()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},className:`ssg-filter-sec-clear`,disabled:a===null,children:`クリア`})]}),c,(0,i.jsxs)(`div`,{className:`ssg-filter-summary`,children:[`🔽 `,s]})]})}function E({isOpen:e,themeClassName:a,popoverSlot:s,title:c,filterType:f,draftValue:p,numberConditionDraft:m,onNumberConditionDraftChange:h,textConditionDraft:_,onTextConditionDraftChange:v,dateConditionDraft:E,onDateConditionDraftChange:D,datePresets:O,renderDateInput:k,onComboConditionClear:A,onComboSelectionClear:j,comboSummaryText:M,currentValueText:N,layout:P,selectOptions:F,optionsStatus:I,optionsProgress:ee,optionsTruncated:L=!1,optionsErrorMessage:te,onOptionsRetry:ne,setSelection:R,popoverRef:re,textInputRef:z,selectRef:ie,onRequestClose:B,onDraftChange:ae,onApply:V,onClear:oe,onSetValueToggle:H,onSetSelectAllChange:U,onSetClear:se,onSetReplaceSelection:W,isServerSide:G=!1}){let ce=(0,t.useRef)(null),[le]=(0,t.useState)(()=>new Date);if(typeof document>`u`||!e||!P)return null;let ue={top:P.top,left:P.left,width:P.width,maxHeight:P.maxHeight},de=e=>{e.stopPropagation()},fe=e=>{e.stopPropagation()},pe=f===`set`,K=f===`numberSet`,q=f===`textSet`,J=f===`dateSet`,Y=K||q||J,X=pe||Y,me=I===`loading`||I===`error`,Z=m??l.DEFAULT_NUMBER_FILTER_DRAFT,he=_??u.DEFAULT_TEXT_FILTER_DRAFT,ge=E??d.DEFAULT_DATE_FILTER_DRAFT,_e=O??(0,o.normalizeDateFilterPresets)(void 0),ve=K?(0,l.buildParsedNumberFilterFromDraft)(Z):null,ye=q?(0,u.buildParsedTextFilterFromDraft)(he):null,be=J?(0,d.buildParsedDateFilterFromDraft)(ge):null,xe=ve!==null||ye!==null||be!==null,Q=K?(0,l.filterOptionsByNumberCondition)(F,ve):q?(0,u.filterOptionsByTextCondition)(F,ye):J?(0,d.filterOptionsByDateCondition)(F,be,le,_e):F,$=e=>{if(e.stopPropagation(),!e.nativeEvent.isComposing){if(e.key===`Enter`){e.preventDefault(),V();return}e.key===`Escape`&&(e.preventDefault(),B())}},Se=K?(0,i.jsx)(y,{draft:Z,valueInputRef:z,onDraftChange:h,onKeyDown:$}):q?(0,i.jsx)(b,{draft:he,valueInputRef:z,onDraftChange:v,onKeyDown:$}):(0,i.jsx)(x,{draft:ge,valueInputRef:z,onDraftChange:D,onKeyDown:$,presets:_e,renderDateInput:k,onRequestClose:B});return(0,r.createPortal)((0,i.jsxs)(`div`,{ref:re,onPointerDown:fe,onKeyDown:de,onPasteCapture:e=>{e.stopPropagation()},className:(0,n.cx)(`ssg-filter-popover`,a,s?.className),style:{...s?.style,...ue},children:[(0,i.jsxs)(`div`,{className:`ssg-filter-title`,children:[`列フィルター: `,c]}),(X||f===`select`)&&I===`collecting`?(0,i.jsxs)(`div`,{className:`ssg-filter-collecting`,children:[`候補を収集中… `,Math.round(ee*100),`%`]}):(X||f===`select`)&&me?Y?(0,i.jsx)(T,{conditionEditor:Se,conditionActive:xe,onConditionClear:A,options:Q,setSelection:R,onSelectionClear:j,summaryText:M,optionsMeta:I===`loading`?`取得中…`:`取得失敗`,children:(0,i.jsx)(C,{status:I===`loading`?`loading`:`error`,errorMessage:te,onRetry:ne})}):(0,i.jsx)(C,{status:I===`loading`?`loading`:`error`,errorMessage:te,onRetry:ne}):Y?(0,i.jsx)(T,{conditionEditor:Se,conditionActive:xe,onConditionClear:A,options:Q,setSelection:R,onSelectionClear:j,summaryText:M,children:J?(0,i.jsx)(S,{options:Q,setSelection:R,searchInputRef:ce,onValueToggle:H,onSelectAllChange:U,onReplaceSelection:W,onRequestClose:B,isServerSide:G,truncated:L}):(0,i.jsx)(g,{options:Q,setSelection:R,searchInputRef:ce,onValueToggle:H,onSelectAllChange:U,onReplaceSelection:W,onRequestClose:B,isServerSide:G,selectAllUsesExplicitScope:!0,truncated:L})}):pe?(0,i.jsx)(g,{options:F,setSelection:R,searchInputRef:z,onValueToggle:H,onSelectAllChange:U,onReplaceSelection:W,onRequestClose:B,isServerSide:G,truncated:L}):f===`number`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`ssg-filter-hint`,children:`フィルター種別: number`}),(0,i.jsx)(y,{draft:Z,valueInputRef:z,onDraftChange:h,onKeyDown:$})]}):f===`select`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`ssg-filter-hint`,children:`フィルター種別: select`}),(0,i.jsxs)(`select`,{ref:ie,value:p,onChange:e=>ae(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Enter`){e.preventDefault(),V();return}e.key===`Escape`&&(e.preventDefault(),B())},className:`ssg-filter-select`,children:[(0,i.jsx)(`option`,{value:``,children:`(すべて)`}),F.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},`${c}-${e.value}`))]}),(0,i.jsxs)(`div`,{className:`ssg-filter-meta`,children:[`候補数: `,F.length,L&&(0,i.jsx)(w,{})]})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`div`,{className:`ssg-filter-hint`,children:[`フィルター種別: `,f]}),(0,i.jsx)(`input`,{ref:z,type:`text`,value:p,onChange:e=>ae(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),!e.nativeEvent.isComposing){if(e.key===`Enter`){e.preventDefault(),V();return}e.key===`Escape`&&(e.preventDefault(),B())}},placeholder:`部分一致で絞り込み`,className:`ssg-filter-input`}),(0,i.jsx)(`div`,{className:`ssg-filter-meta ssg-filter-meta--ellipsis`,children:`部分一致検索です`})]}),!X&&(0,i.jsxs)(`div`,{className:`ssg-filter-meta ssg-filter-meta--ellipsis`,children:[`現在値: `,N]}),(0,i.jsx)(`div`,{className:`ssg-filter-footer`,children:X?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),se()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),se())},className:`ssg-filter-btn-secondary`,children:`クリア`}),(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),B()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),B())},className:`ssg-filter-btn-primary`,children:`閉じる`})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),oe()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),oe())},className:`ssg-filter-btn-secondary`,children:`クリア`}),(0,i.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),V()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),V())},className:`ssg-filter-btn-primary`,children:`適用`})]})})]}),document.body)}exports.ColumnFilterPopover=E,exports.default=E;
|
package/dist/common.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { numberFormatter } from '@ishibashi0112/spreadsheet-grid-core/logic/valueFormatters';
|
|
2
|
+
export { preloadGridPopups } from './view/lazyPopups.js';
|
|
3
|
+
export type { SpreadsheetGridProps, GridColumn, GridColumnPinned, GridColumnEditor, EditorCommitDirection, EditorEnterMove, CellEditorContext, GridSelectEditorOption, GridValidationMode, CellValidationContext, CellValidationResult, GridInvalidCell, EditorCommitResult, GridRowKey, GridAggFuncName, GridAggFuncParams, GridAggFunc, GridGroupRow, GridSelectFilterOption, GetFilterOptionsParams, GetFilterOptionsResult, ColumnFilterTypeOption, ColumnFilterUiType, CellRenderContext, HeaderRenderContext, CellStyleContext, CanEditCellContext, GridConditionalFormat, RowStyleContext, DetailRowOptions, GridClassNames, GridSlotProps, GridFrameworkTypes, ReactGridTypes, DetailRowRenderContext, CellDetailContext, LabelRowOptions, LabelRowRenderContext, GridLabelRow, LabelRowSortMode, TotalRowOptions, TotalRowCellContext, TotalRowCellKind, FillHandleOptions, GridFillValueParams, GridFillDirection, GridFillKind, RowDragContext, RowMoveParams, GridCellRef, GridCellEventParams, GridCellDoubleClickParams, CellValueFormatter, CellValueFormatterParams, SpreadsheetGridSlotContext, SpreadsheetGridDerivedSummary, SpreadsheetGridSelectionStats, 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, DeprecatedCsvExportScope, CsvExportOptions, GridExportOptions, GridExportCell, GridExportData, GridState, GridColumnState, GridDensity, GridTheme, UndoRedoState, GridMotion, FindOptions, FindChangeParams, GridDataBarFormat, GridColorScaleFormat, GridChipTone, GridChipSpec, GridChipMap, AutoSizeColumnsMode, GridContextMenuTarget, GridContextMenuParams, GridContextMenuItem, GridContextMenuActionItem, GridContextMenuLabelItem, GridContextMenuSeparatorItem, GridContextMenuCustomItem, ScrollHintOptions, ScrollHintTrigger, ScrollHintRenderArgs, } from './model/gridTypes.js';
|
|
4
|
+
export type { NumberFormatterOptions } from '@ishibashi0112/spreadsheet-grid-core/logic/valueFormatters';
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import type { ReactGridFeatures } from './features/types.js';
|
|
2
2
|
import type { SpreadsheetGridProps } from './model/gridTypes.js';
|
|
3
3
|
export type CreateSpreadsheetGridOptions = {
|
|
4
|
+
/** 差し込む機能(`{ filtering: filteringFeature, ... }`)。キーは機能の名前、値は `/lite` が公開する機能の部品です。 */
|
|
4
5
|
features: ReactGridFeatures;
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* 使う機能だけを差し込んだグリッドのコンポーネントを作ります(`@ishibashi0112/spreadsheet-grid/lite`)。
|
|
9
|
+
* 差し込まなかった機能のコードはバンドルに入りません。props・ref ハンドル・型は `SpreadsheetGrid` と共通で、
|
|
10
|
+
* 差し込んでいない機能の prop やメソッドは何もしません(開発時だけ、prop と、prop を持たない機能のメソッド
|
|
11
|
+
* (`exportCsv` / `openFilterManager` など)を console.warn で知らせます)。
|
|
12
|
+
* モジュールの先頭で 1 回だけ呼んでください(コンポーネントの中で呼ばない)。機能の組み合わせは作ったときに固定されます。
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid/lite';
|
|
16
|
+
* import '@ishibashi0112/spreadsheet-grid/style.css';
|
|
17
|
+
*
|
|
18
|
+
* const Grid = createSpreadsheetGrid({ features: { ...standardFeatures, serverSide: serverSideFeature } });
|
|
19
|
+
*/
|
|
20
|
+
export declare function createSpreadsheetGrid({ features }: CreateSpreadsheetGridOptions): {
|
|
21
|
+
<T extends object>(props: SpreadsheetGridProps<T>): import("react").JSX.Element;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const standardFeatures: {
|
|
2
|
+
filtering: import("@ishibashi0112/spreadsheet-grid-core/engine/features").ColumnFilteringFeature & {
|
|
3
|
+
createDateRolloverStore: () => import("@ishibashi0112/spreadsheet-grid-core/controllers/dateRolloverStore").DateRolloverStore;
|
|
4
|
+
} & {
|
|
5
|
+
useFilterOrder: <T>(args: import("./types.js").FilterOrderFeatureArgs<T>) => import("./types.js").FilterOrderFeatureResult;
|
|
6
|
+
useFilterPopover: <T>(args: import("./types.js").FilterPopoverFeatureArgs<T>) => import("./types.js").FilterPopoverFeatureResult<T>;
|
|
7
|
+
useFilterPopoverViews: (options: import("../view/lazyPopups.js").UseLazyModuleOptions) => import("../view/lazyPopups.js").FilterPopoverViews | null;
|
|
8
|
+
useFilterPopoverContent: <T>(args: import("./types.js").FilterPopoverContentFeatureArgs<T>) => import("react").ReactNode;
|
|
9
|
+
useFilterManagement: <T>(args: import("./types.js").FilterManagementFeatureArgs<T>) => import("./types.js").FilterManagementFeatureResult;
|
|
10
|
+
FilterChipBar: typeof import("../view/GridFilterChipBar.js").GridFilterChipBar;
|
|
11
|
+
};
|
|
12
|
+
columnMenu: {
|
|
13
|
+
useColumnMenu: <T>(args: import("./types.js").ColumnMenuFeatureArgs<T>) => import("./types.js").ColumnMenuFeatureResult<T>;
|
|
14
|
+
ColumnMenuPopover: typeof import("../view/ColumnMenuPopover.js").ColumnMenuPopover;
|
|
15
|
+
};
|
|
16
|
+
toolPanel: {
|
|
17
|
+
useToolPanel: (args: import("./types.js").ToolPanelFeatureArgs) => import("./types.js").ToolPanelFeatureResult;
|
|
18
|
+
useToolPanelViews: (options: import("../view/lazyPopups.js").UseLazyModuleOptions) => import("../view/lazyPopups.js").ToolPanelViews | null;
|
|
19
|
+
};
|
|
20
|
+
columnAutosize: {
|
|
21
|
+
useColumnAutosize: <T>(args: import("./types.js").ColumnAutosizeFeatureArgs<T>) => import("./types.js").ColumnAutosizeFeatureResult<T>;
|
|
22
|
+
};
|
|
23
|
+
export: {
|
|
24
|
+
createExportCommands: <T>(getArgs: () => import("@ishibashi0112/spreadsheet-grid-core/engine/gridApi").GridApiArgs<T> | null) => import("@ishibashi0112/spreadsheet-grid-core/engine/exportCommands").ExportCommands<T>;
|
|
25
|
+
};
|
|
26
|
+
};
|