@ishibashi0112/spreadsheet-grid 0.54.0 → 0.56.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 +57 -7
- package/README.md +16 -2
- package/dist/{ColumnFilterPopover-Bca4dkRt.js → ColumnFilterPopover-9Qa2eHLS.js} +1 -1
- package/dist/{ColumnFilterPopover-B7RIBAz5.cjs → ColumnFilterPopover-VqJkz_De.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1096 -1085
- package/dist/lite/{ColumnFilterPopover-Bca4dkRt.js → ColumnFilterPopover-9Qa2eHLS.js} +1 -1
- package/dist/lite/{ColumnFilterPopover-B7RIBAz5.cjs → ColumnFilterPopover-VqJkz_De.cjs} +1 -1
- package/dist/lite/{createSpreadsheetGrid-Bp_9cAiW.js → createSpreadsheetGrid-BA_LQkGk.js} +620 -609
- package/dist/lite/createSpreadsheetGrid-Mn-3dffd.cjs +1 -0
- package/dist/lite/createSpreadsheetGrid.cjs +1 -1
- package/dist/lite/createSpreadsheetGrid.js +1 -1
- package/dist/lite/features/filtering.cjs +1 -1
- package/dist/lite/features/filtering.js +1 -1
- package/dist/lite/features/standard.cjs +1 -1
- package/dist/lite/features/standard.js +2 -2
- package/dist/lite/features/toolPanel.cjs +1 -1
- package/dist/lite/features/toolPanel.js +1 -1
- package/dist/lite/{filtering-Dvpw-F2d.js → filtering-TKvYWXFp.js} +1 -1
- package/dist/lite/{filtering-D1lO0219.cjs → filtering-uKrMU8q5.cjs} +1 -1
- package/dist/lite/{lazyPopups-NUE-rcif.js → lazyPopups-CyC101Ge.js} +1 -1
- package/dist/lite/{lazyPopups-6rxQTpNn.cjs → lazyPopups-T9eKWzY1.cjs} +1 -1
- package/dist/lite/{toolPanel-ocs4Ji7i.cjs → toolPanel-DWc162Ut.cjs} +1 -1
- package/dist/lite/{toolPanel-lFsykjDn.js → toolPanel-OMh7x16V.js} +1 -1
- package/dist/lite/useVirtualizerCore-BFcqP3Eh.js +35 -0
- package/dist/lite/useVirtualizerCore-CrusdCD3.cjs +1 -0
- package/dist/lite.cjs +1 -1
- package/dist/lite.js +4 -4
- 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/package.json +30 -4
- package/dist/lite/createSpreadsheetGrid-C_PdPMWw.cjs +0 -1
- package/dist/lite/useVirtualizerCore-CzoP0AUm.cjs +0 -1
- package/dist/lite/useVirtualizerCore-q794NurB.js +0 -21
- package/dist/useVirtualizerCore-CzoP0AUm.cjs +0 -1
- package/dist/useVirtualizerCore-q794NurB.js +0 -21
package/API_REFERENCE.md
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
| `undoHistoryLimit` | `number` | `100` | 保持する undo ステップ数の上限。超過分は古い順に破棄。 |
|
|
54
54
|
| `enableClearOnDelete` | `boolean` | `true` | `Delete` / `Backspace` キーによる選択セル(なければアクティブセル)の値クリア。`false` でキーは何もしない(素通し)。ペースト・エディタでの上書き・undo/redo には影響しない(クリアのキーボード操作だけの opt-out)。 |
|
|
55
55
|
| `editorEnterMove` | `EditorEnterMove` | `'down'` | 組み込みエディタ(text / number / select / date)の `Enter` 確定後にアクティブセルをどこへ移すか(`'down'` \| `'up'` \| `'right'` \| `'left'` \| `'none'`。Excel の「Enter キーを押したら、セルを移動する(方向)」相当)。`'none'` は移動せずその場に留まる。`Tab` / `Shift+Tab`(右 / 左)と `Escape` には影響しない。custom エディタはキーバインドが consumer 責務のため対象外(`ctx.commit(value, direction)` の direction で指定)。 |
|
|
56
|
-
| `imeDirectInput` | `boolean` | `false` | **IME オンのままの直接入力**(Excel / SPREAD と同じ)。`true` で、編集していないあいだグリッドのフォーカスをアクティブセル上の透明な入力欄(入力受け)に置き、IME の変換をそこで始める。text エディタ(`editor` 未指定 / `type: 'text'`)の編集可能セルでは変換中の文字をセルの上に表示し、変換を確定すると確定した文字列を初期値に編集を始める(もう一度 `Enter` でセルを確定して移動)。number エディタの列では確定した全角の数字・符号・小数点・3 桁区切りを半角に直して編集を始め(「12.5」→ `12.5`)
|
|
56
|
+
| `imeDirectInput` | `boolean` | `false` | **IME オンのままの直接入力**(Excel / SPREAD と同じ)。`true` で、編集していないあいだグリッドのフォーカスをアクティブセル上の透明な入力欄(入力受け)に置き、IME の変換をそこで始める。text エディタ(`editor` 未指定 / `type: 'text'`)の編集可能セルでは変換中の文字をセルの上に表示し、変換を確定すると確定した文字列を初期値に編集を始める(もう一度 `Enter` でセルを確定して移動)。number エディタの列では確定した全角の数字・符号・小数点・3 桁区切りを半角に直して編集を始め(「12.5」→ `12.5`)、数値として読めない変換は捨てる(「ー」「。」だけの変換は `-` / `.` の打ち始めとして編集を始める)。それ以外の列(select / date / checkbox / custom)と読み取り専用セルでは変換を捨てる(従来どおり何も入らない)。キー操作 / コピー・貼り付け / `Tab` は従来どおり。既定 OFF の理由: 有効中はグリッドにフォーカスがあるあいだ `document.activeElement` が入力欄になり、入力欄では反応しないアプリのショートカット(例: Mantine の `useHotkeys` の既定)が効かなくなるため。詳細は「IME オンのままの直接入力」節。 |
|
|
57
57
|
| `onUndoRedoStateChange` | `(state: UndoRedoState) => void` | — | undo / redo 可能状態が**変化したとき**に呼ばれる(ツールバーの undo/redo ボタンの disabled 表示などリアクティブな UI 用)。初回マウントでは発火せず、同値では再発火しない。毎レンダーのインライン関数でも問題ない。引数の型 `UndoRedoState`(`{ canUndo, canRedo }`)はパッケージから import できる。 |
|
|
58
58
|
| `enableRangeSelection` | `boolean` | `true` | 複数セル範囲選択。 |
|
|
59
59
|
| `enableRowSelection` | `boolean` | `false` | チェックボックス行選択の有効化(マスタースイッチ)。`true` で行ヘッダ(行NO)ガターが行選択のヒット領域になり、Excel 風のガター起点セル範囲選択は off(ボディ側セルのドラッグ範囲選択は不変)。判定は O(1)・全選択は除外集合でキーを列挙しない(1M 行でも一定コスト)。 |
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
| `enableColumnResize` | `boolean` | `true` | 列幅の手動リサイズ可否のグリッド既定。各列 `resizable` 未指定時に継承(`column.resizable ?? enableColumnResize`)。 |
|
|
73
73
|
| `autoSizeColumns` | `'onMount' \| 'onDataChange' \| false` | `false` | データ投入時に全列幅を内容へ自動フィット。`'onMount'`=初回にデータが載った一度きり / `'onDataChange'`=`rows`(参照)が変わるたび(= データ差し替えのたび。手動リサイズは上書き) / `false`=無効。計測は列メニュー「すべての列の幅を自動調整」と同一エンジン(`suppressAutoSize` / `autoHeight` 列は除外)。フィルター / ソート / 列並べ替えでは再フィットしません。serverSide(`dataSource`)では無効。詳細は「flex と autoSize」節。 |
|
|
74
74
|
| `showCellOverflowTooltip` | `boolean` | `false` | セル内容が省略(…)される列で、ホバー時に全文ツールチップを表示。対象は既定テキストセルのみ(`renderCell` 列 / `autoHeight` 折り返し列は対象外)。表示はホバー時に `scrollWidth > clientWidth` を判定し、実際にクリップされているセルのみ。既存のカスタムツールチップ(`data-ssg-tooltip`)を共有。詳細は「ツールチップ」節。 |
|
|
75
|
-
| `showValidationMarks` | `boolean` | `true` | invalid マーク(背景 + 右上マーカー + ホバーツールチップ)の表示可否。`false` で非表示 +
|
|
75
|
+
| `showValidationMarks` | `boolean` | `true` | invalid マーク(背景 + 右上マーカー + ホバーツールチップ)の表示可否。`false` で非表示 + 可視セルの検査(`validate` と number の `min` / `max` / `integer`)の評価スキップ。`getInvalidCells()` と `validationMode: 'reject'` の書き込み拒否には影響しない(独立経路)。「送信時にだけマークを出す」UX は利用側 state で本 prop を切り替えて実現(「バリデーション」節のレシピ参照)。 |
|
|
76
76
|
| `enableColumnMenu` | `boolean` | `true` | 列メニュー(⋮ + ヘッダー右クリック)。 |
|
|
77
77
|
| `enableRowHover` | `boolean` | `true` | 行ホバー時に行全体を薄くハイライト。 |
|
|
78
78
|
| `hoveredRowIndex` | `number \| null` | — | 行ホバーの controlled 値(ビュー行 index / `null` = ホバーなし)。指定時は内部 state を使わずこの値でハイライトし、pointer 由来の変化は `onHoveredRowChange` で通知のみ(optionally controlled)。`enableRowHover: false` のときは無視(ハイライトも通知もしない)。一時的な UI 状態のため `GridState` / ハンドルには載らない。 |
|
|
@@ -414,7 +414,7 @@ const gridRef = useRef<SpreadsheetGridHandle<Row>>(null);
|
|
|
414
414
|
|
|
415
415
|
- **動き**: 編集していないあいだ、グリッドのフォーカスはアクティブセルの上の透明な入力欄(入力受け)にあります。日本語を打ち始めると変換中の文字がセルの上にエディタと同じ見た目で表示され、変換を確定(`Enter` / 候補の確定)すると確定した文字列を初期値に編集が始まります。そのまま続けて入力でき、もう一度 `Enter` でセルを確定して移動します(移動先は `editorEnterMove`)。変換を取り消した(`Escape` で空にした)ときは編集を始めません。
|
|
416
416
|
- **対象**: text エディタ(`editor` 未指定 / `type: 'text'`)と number エディタの編集可能なデータセル。select / date / checkbox / custom の列、読み取り専用セル、グループ行 / ラベル行、SSRM の未ロード行では変換を捨てます(従来どおり何も入りません)。
|
|
417
|
-
- **number 列**: 変換を確定すると、全角の数字・符号・小数点・3 桁区切りを半角に直した値で編集が始まります(「12.5」→ `12.5`、「ー5」→ `-5`、「1,234」→ `1234`。句読点の設定が「、。」の IME で入る「12。5」も `12.5`)。かなや漢字など数値として読めない変換は捨てます。IME そのものはオフにしません(ブラウザからは IME をオンへ戻せないため。Chrome / Edge は CSS の `ime-mode` にも対応していません)。
|
|
417
|
+
- **number 列**: 変換を確定すると、全角の数字・符号・小数点・3 桁区切りを半角に直した値で編集が始まります(「12.5」→ `12.5`、「ー5」→ `-5`、「1,234」→ `1234`。句読点の設定が「、。」の IME で入る「12。5」も `12.5`)。符号や小数点だけの変換(「ー」「。」)は `-` / `.` の打ち始めとして編集を始めます(続けて数字を打てる)。かなや漢字など数値として読めない変換は捨てます。IME そのものはオフにしません(ブラウザからは IME をオンへ戻せないため。Chrome / Edge は CSS の `ime-mode` にも対応していません)。
|
|
418
418
|
- **変わらないもの**: 矢印 / `Tab` / `Enter` / `F2` / `Delete` / `Ctrl+C` / 貼り付け / undo などのキー操作、IME を使わない文字キーでの編集開始(その 1 文字が初期値)、端の列の `Tab` でグリッド外へ出る動き。変換中のキー(候補の選択など)はグリッドでは扱いません。
|
|
419
419
|
- **変換中にクリックしたとき**: 変換中に別のセルやグリッド外をクリックすると、変換中の文字は入力されません(確定してから移動してください)。クリックした先のフォーカスは奪いません。
|
|
420
420
|
- **フォーカス**: 有効中は `document.activeElement` が入力受け(`input[data-ssg-ime-input]`)になります。グリッドにフォーカスがあるかを `gridElement.contains(document.activeElement)` で判定している場合は従来どおり動きますが、「入力欄にフォーカスがあるときは無効」になるショートカット(Mantine の `useHotkeys` の既定など)はグリッド上で効かなくなります。これが既定 OFF の理由です。
|
|
@@ -552,7 +552,7 @@ WAI-ARIA の grid パターンに沿って、表・行・セルに役割と状
|
|
|
552
552
|
| `dateFilterPresets` | `false \| DateFilterPresetOption[]` | ビルトイン 3 種 | dateSet の相対プリセットチップの構成。`false` / `[]` でチップ行を非表示(オプトアウト)。配列はビルトイン ID(`'today'` / `'thisMonth'` / `'last30days'`)の再利用とカスタム定義 `{ id, label, resolve }` を表示順のまま混在可。詳細は下記「dateSet の相対プリセット(dateFilterPresets)」節。 |
|
|
553
553
|
| `filterFn` | `(row: T, filterValue: unknown) => boolean` | — | カスタムフィルター述語。 |
|
|
554
554
|
| `editor` | `GridColumnEditor<T>` | text 相当 | セルエディタ種別(判別共用体)。`{ type: 'text' \| 'number' \| 'select' \| 'date' \| 'checkbox' \| 'custom', ... }`。詳細は「セルエディタ」節。 |
|
|
555
|
-
| `validate` | `(ctx: CellValidationContext<T>) => CellValidationResult` | — | セル値の検証。`true`=有効 / `false`=無効(既定メッセージ)/ `string`・`{ message }`=無効+メッセージ。**純粋・軽量であること**(描画中の可視セルごとに毎レンダー評価。`cellClassName` 関数と同コスト階級)。詳細は「バリデーション」節。 |
|
|
555
|
+
| `validate` | `(ctx: CellValidationContext<T>) => CellValidationResult` | — | セル値の検証。`true`=有効 / `false`=無効(既定メッセージ)/ `string`・`{ message }`=無効+メッセージ。**純粋・軽量であること**(描画中の可視セルごとに毎レンダー評価。`cellClassName` 関数と同コスト階級)。number エディタの `min` / `max` / `integer` の検査は `validate` の後(`validate` の NG はそのメッセージ、通した値だけ組み込みの検査)。詳細は「バリデーション」節。 |
|
|
556
556
|
| `validationMode` | `'mark' \| 'reject'` | `'mark'` | 検証 NG 時の動作。`'mark'`=値は入るがセルに invalid 表示 / `'reject'`=書き込み自体を拒否。 |
|
|
557
557
|
| `parseClipboardValue` | `(raw: string, row: T) => unknown` | editor 既定パーサ | 「文字列 → セル値」のパーサ(貼り付け / クリア / エディタ commit で共通)。**明示指定が常に優先**。未指定で `editor` が number / date / checkbox のときは種別の既定パーサが自動供給されます(「セルエディタ」節の表参照)。 |
|
|
558
558
|
| `formatClipboardValue` | `(value: unknown, row: T) => string` | — | コピー時のフォーマッタ。 |
|
|
@@ -709,7 +709,7 @@ const columns = [
|
|
|
709
709
|
| type | UI / 操作 | オプション | 既定パーサ(`parseClipboardValue` 未指定時) |
|
|
710
710
|
| --- | --- | --- | --- |
|
|
711
711
|
| `'text'` | 従来のテキスト input(既定) | — | パススルー(生文字列のまま) |
|
|
712
|
-
| `'number'` | `<input type="number">`(スピナー / ↑↓ステップ / 不正文字抑止) | `min` / `max` / `step` | `''`・空白だけ→`null` / 有限数値文字列→`number`(全角の数字・符号・小数点と 3 桁区切りも読む: `'1,234'`→`1234`、`'ー5'`→`-5`)/ 非数値→生文字列のまま(mark が拾う) |
|
|
712
|
+
| `'number'` | `<input type="number">`(スピナー / ↑↓ステップ / 不正文字抑止)。セルを選んで `-` / `+` / `.` から打ち始めたときは、その文字を消さないよう文字の入力欄(`inputmode="decimal"`)で開き、確定した文字列を列のパーサで数値に直す(`-5`→`-5`、`.5`→`0.5`、`-` だけなら空。数値として読めない文字列は貼り付けと同じくそのまま) | `min` / `max` / `step` / `integer`(`min` / `max` / `integer` は値の検査にも使う。「バリデーション」節) | `''`・空白だけ→`null` / 有限数値文字列→`number`(全角の数字・符号・小数点と 3 桁区切りも読む: `'1,234'`→`1234`、`'ー5'`→`-5`)/ 非数値→生文字列のまま(mark が拾う) |
|
|
713
713
|
| `'select'` | 候補ドロップダウン(body 直下ポータル)。↑↓=ハイライト移動 / Enter=確定(下へ)/ Tab=確定(左右へ)/ クリック=確定 / 印字キー=label 前方一致のタイプアヘッド(約 700ms でリセット) | `options: GridSelectEditorOption[] \| (row) => GridSelectEditorOption[]`(静的 or 行依存。関数はレンダー中に呼ばれるため純粋であること) | パススルー(`option.value` は string。型変換したい場合は `parseClipboardValue` を併用) |
|
|
714
714
|
| `'date'` | ネイティブ `<input type="date">`。ドラフトは `'YYYY-MM-DD' \| ''` | — | `''`→`null` / 解釈可能→`'YYYY-MM-DD'` へ正規化 / 解釈不可→生文字列のまま |
|
|
715
715
|
| `'checkbox'` | **直接トグル**(編集セッションなし)。クリック / Space で即トグル。Enter / F2 / ダブルクリックではエディタが開かない | `checkedValue`(既定 `true`)/ `uncheckedValue`(既定 `false`)。checked 判定は `Object.is(value, checkedValue)` のみ | `''`→unchecked / checked・unchecked の文字列表現→対応値 / `'true'`・`'1'`→checked / その他→unchecked |
|
|
@@ -718,6 +718,7 @@ const columns = [
|
|
|
718
718
|
注意点:
|
|
719
719
|
|
|
720
720
|
- **既定パーサはエディタ commit / 貼り付け / Delete クリアで共通**に効きます(例: number 列は Delete クリアで `null` になる)。明示の `parseClipboardValue` が常に優先です。
|
|
721
|
+
- **number の `min` / `max` / `integer`(`true` で整数だけ)は値の検査にも使います**(`validate` を書かなくても、範囲外や小数のセルに印が付く / `'reject'` なら書き込まない)。`step` は ↑↓ キーとスピナーの刻みだけで、検査には使いません。詳細は「バリデーション」節の「数値の組み込みの検査」。
|
|
721
722
|
- **select の blur は cancel**(値不変)です。text / number / date の blur = 確定と非対称ですが、select は「選択 = 即確定」でドラフト概念がないためです。
|
|
722
723
|
- **date の Tab はグリッド流(確定 + 移動)**です。ピッカー内のセグメント移動は ← → 矢印で行えます。
|
|
723
724
|
- **checkbox のダブルクリックは click 2 回**(トグル往復)として扱われます(Excel / AG Grid と同様)。`renderCell` 指定時はそちらが優先され、組み込みチェックボックスセルは描画されません。
|
|
@@ -727,6 +728,19 @@ const columns = [
|
|
|
727
728
|
|
|
728
729
|
`column.validate` でセル値を検証します。返り値は `true`(有効)/ `false`(無効・既定メッセージ)/ `string` または `{ message }`(無効 + メッセージ)。
|
|
729
730
|
|
|
731
|
+
**数値の組み込みの検査**: number エディタの `min` / `max` / `integer: true` は値の検査にもなります(`validate` を書かなくても効きます)。
|
|
732
|
+
|
|
733
|
+
```tsx
|
|
734
|
+
{ key: 'qty', title: '数量', width: 120, editable: true,
|
|
735
|
+
editor: { type: 'number', min: 0, integer: true } } // 0 以上の整数
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
- 検査の順番は「数値か → 整数か → 範囲内か」で、最初に引っかかったものをメッセージにします(「数値で入力してください」「整数で入力してください」「0 以上で入力してください」「100 以下で入力してください」「1〜5 で入力してください」)。
|
|
739
|
+
- 数値として数えるのは数値と、列の既定パーサが数値として読む文字列(初期データの `'12'` / `'1,234'` / `'12'` など)です。空(`null` / `undefined` / 空白だけの文字列)は通します(必須にしたいときは `validate` で)。
|
|
740
|
+
- `validate` と併用したときは `validate` が先です。`validate` の NG はそのメッセージ(組み込みのメッセージで上書きしない)で、`validate` が通した値だけを組み込みの検査にかけます(セルのメッセージは 1 つ。`validate` が受け取る値と動きは従来どおり)。
|
|
741
|
+
- `validationMode`(mark / reject)・`showValidationMarks`・`getInvalidCells()` は組み込みの検査にも同じように効きます。
|
|
742
|
+
- メッセージを変えたいときは、同じ条件を `validate` に書いて自分のメッセージを返します(`validate` が先なので、そちらが出ます)。
|
|
743
|
+
|
|
730
744
|
動作モード(`validationMode`、既定 `'mark'`):
|
|
731
745
|
|
|
732
746
|
- **`'mark'`(既定)** — 値は書き込み、セルに invalid 表示(背景 + 右上マーカー)+ ホバーでメッセージのツールチップを出します。invalid 判定は**表示時導出**(state 非保持)のため、貼り付け・クリア・初期データ・undo/redo・外部からの `rows` 差し替え後も常に `rows` と整合します。
|
|
@@ -741,7 +755,7 @@ const columns = [
|
|
|
741
755
|
- `validate` は**純粋・軽量**であること。mark 表示のため、描画中の可視セル(validate 指定列のみ)ごとに毎レンダー評価されます(`cellClassName` 関数と同じコスト階級)。
|
|
742
756
|
- 検証コンテキストは `{ value, row, column }` です(`row` は書き込み前の行。ビュー index はソート / フィルターで不安定なため渡しません)。
|
|
743
757
|
- 保存前の一括チェックはハンドルの `getInvalidCells()` を使います(「命令的 API」節参照)。
|
|
744
|
-
- invalid 表示の配色はトークン `--ssg-invalid` / `--ssg-invalid-bg` で調整できます(light / dark 両対応)
|
|
758
|
+
- invalid 表示の配色はトークン `--ssg-invalid` / `--ssg-invalid-bg` で調整できます(light / dark 両対応)。エラーの吹き出しの文字色は `--ssg-invalid-contrast`(既定 `#ffffff`)です。
|
|
745
759
|
- 同じセルにメモ(`cellNote`)がある場合は、メモの 10px の三角の上にエラーの 6px の三角が重なります(「セルのメモ(`cellNote`)」節)。
|
|
746
760
|
|
|
747
761
|
#### 表示タイミングの制御(showValidationMarks)
|
|
@@ -1266,7 +1280,7 @@ const gridRef = useRef<SpreadsheetGridHandle<Row>>(null);
|
|
|
1266
1280
|
|
|
1267
1281
|
| メソッド | 説明 |
|
|
1268
1282
|
| --- | --- |
|
|
1269
|
-
| `getInvalidCells()` | `validate`
|
|
1283
|
+
| `getInvalidCells()` | 検査のある列(`validate` か、number エディタの `min` / `max` / `integer`)× 全ソース行をオンデマンドで全走査し、invalid セルの一覧(`GridInvalidCell[]` = `{ rowKey, sourceRowIndex, columnKey, message }`)を返す。保存前チェック用。invalid 表示は表示時導出のため状態を持たず、**呼ばれた時だけ計算**する(明示的な呼び出し = 明示的なコスト)。**`showValidationMarks` の表示状態と無関係に常に動作する**(マーク非表示中の送信前チェックに使える)。非表示列も対象(見えない列の不正値も検出)。clientSide 専用で、serverSide は全行を保持しないため空配列 + `console.warn`。 |
|
|
1270
1284
|
|
|
1271
1285
|
### serverSide(SSRM)
|
|
1272
1286
|
|
|
@@ -1724,6 +1738,42 @@ const s = stylex.create({
|
|
|
1724
1738
|
- StyleX は子孫セレクタを書けない(要素自身のクラスでしか装飾できない)ため、上記スロットに無い内部要素(ポップオーバー内のボタン / 入力欄等)はデザイントークン(`--ssg-*`)で調整する。
|
|
1725
1739
|
- StyleX の atomic クラスとグリッドの基底クラスは同じ特異度 (0,1,0)。同じプロパティは後に読み込まれた方が勝つため、グリッド CSS を先に・StyleX の出力 CSS を後に読み込むか、`style.layer.css`(`@layer ssg-base`)を使う。StyleX 側で `useLayers` を有効にしている場合は、未レイヤーのグリッド CSS がレイヤー内に常に勝つため `style.layer.css` が必須。
|
|
1726
1740
|
|
|
1741
|
+
### Astryx との併用
|
|
1742
|
+
|
|
1743
|
+
[Astryx](https://astryx.atmeta.com)(Meta のデザインシステム。StyleX 製)の中でもそのまま使える。グリッドの CSS はレイヤーに入れていないため、Astryx のリセット(`@layer reset`)や部品の CSS(`@layer astryx-base`)に崩されず、セルの中に置いた Astryx の部品(`renderCell` で返す `Button` / `Badge` など)も外に置いたときと同じ見た目になる。配色を揃えるときは下の `themes/astryx.css` を使う。
|
|
1744
|
+
|
|
1745
|
+
### デザインシステムのテーマ(`themes/*.css`)
|
|
1746
|
+
|
|
1747
|
+
デザインシステムの配色の変数をグリッドのトークン(`--ssg-*`)へつなぐ CSS。`style.css` の後に 1 つ読み込むと、グリッドの配色がそのデザインシステムのテーマ(独自テーマを含む)とライト / ダークの切り替えに付いてくる(JS は増えない)。ライト / ダークはグリッドの `theme` にも渡す。
|
|
1748
|
+
|
|
1749
|
+
| ファイル | 対象(確認した版) | 効く範囲 | `theme` に渡すもの |
|
|
1750
|
+
| --- | --- | --- | --- |
|
|
1751
|
+
| `themes/astryx.css` | Astryx(`@astryxdesign/core` 0.7) | `<Theme>` があるページのすべてのグリッド(最上位の `<Theme>` が `<html>` へ同期する `data-astryx-theme` で判定。ポータルにも当たる) | `useTheme().mode`(必須。Astryx の色は `light-dark()` で、ビルドによってはグリッドの `color-scheme` の側で明暗が選ばれる) |
|
|
1752
|
+
| `themes/mantine.css` | Mantine(`@mantine/core` 9.7) | `MantineProvider` があるページのすべてのグリッド(`MantineProvider` が `<html>` に付ける `data-mantine-color-scheme` で判定) | `useComputedColorScheme('light')` |
|
|
1753
|
+
| `themes/heroui.css` | HeroUI v3(`@heroui/react` 3.2) | 読み込んだページのすべてのグリッド | `<html>` の `dark` クラスに合わせた `'light'` / `'dark'` |
|
|
1754
|
+
| `themes/shadcn.css` | shadcn/ui(`shadcn` 4.22。Tailwind CSS v4 向けの配色の変数) | 読み込んだページのすべてのグリッド | 同上 |
|
|
1755
|
+
|
|
1756
|
+
```tsx
|
|
1757
|
+
import '@ishibashi0112/spreadsheet-grid/style.css';
|
|
1758
|
+
import '@ishibashi0112/spreadsheet-grid/themes/astryx.css'; // style.css の後に読み込む
|
|
1759
|
+
import { useTheme } from '@astryxdesign/core/theme';
|
|
1760
|
+
|
|
1761
|
+
// <Theme theme={...}> の内側で使う
|
|
1762
|
+
function Grid(props: SpreadsheetGridProps<Row>) {
|
|
1763
|
+
const { mode } = useTheme(); // 'light' | 'dark'(mode="system" も解決済みの値)
|
|
1764
|
+
return <SpreadsheetGrid {...props} theme={mode} />;
|
|
1765
|
+
}
|
|
1766
|
+
```
|
|
1767
|
+
|
|
1768
|
+
- どのテーマも、デザインシステムの変数を同じ 16 の入力(面 / 文字 / 罫線 / アクセント / 危険・成功・注意の色とその上の文字色 / 角の丸み)に読み替え、そこからグリッドのトークンを同じ配分(行のホバーの濃さ、選択範囲の混ぜ方など)で決める。ツールチップ / ドラッグ中のゴースト / 条件付き書式の色など、デザインシステムに対応する変数が無い部分は `theme` に渡したプリセットのまま。
|
|
1769
|
+
- セレクタは `:where`(特異度 0)。`style.css` より後に読み込めば既定値とダークのプリセットに勝つ(前に読み込むと効かない)。利用側の `.ssg-root { --ssg-cell-bg: ... }` などの上書き(レイヤーに入れていない CSS)は読み込み順に関係なくテーマに勝つ。選択範囲などの色はデザインシステムのアクセントから決めるので、アクセントをまとめて変えるときはデザインシステムの側で変える。
|
|
1770
|
+
- `style.css` をレイヤーに入れているとき(`layer(components)` / `style.layer.css`)は、テーマも同じレイヤーの `style.css` の後に入れる(例: `@import '@ishibashi0112/spreadsheet-grid/themes/shadcn.css' layer(components);`)。レイヤーに入れたトークンの上書きは、レイヤーに入っていないテーマに負けるため。
|
|
1771
|
+
- HeroUI と shadcn/ui の変数には目印の属性が無いため、そのテーマは読み込んだページのすべてのグリッドに効く。それぞれの変数が無いページで読み込むと色が抜ける。HeroUI v2(`--heroui-*` に HSL の成分を入れる形)と、shadcn/ui の Tailwind CSS v3 向けの書き方(値が `222.2 84% 4.9%` のような HSL の成分)は対象外。
|
|
1772
|
+
- shadcn/ui には成功 / 注意の色の変数が無いため、保存できた印とメモの印は Tailwind の green-600 / amber-500。
|
|
1773
|
+
- Tailwind CSS だけのときは配色の変数が無いので、トークン(`--ssg-*`)を直接書く([テーマビルダー](https://datasheet-grid.vercel.app/theme-builder)で生成できる)。
|
|
1774
|
+
- 自分の StyleX の出力をレイヤーに入れていて(`useLayers`)、そのクラスでグリッドの基底を上書きしたいときは、上の StyleX の注意と同じく `style.layer.css` を使う。
|
|
1775
|
+
- デザインシステムの変数名が変わったときはテーマの側で追従する。
|
|
1776
|
+
|
|
1727
1777
|
## スタイリング用の状態クラス(公開契約)
|
|
1728
1778
|
|
|
1729
1779
|
`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) · [Try on StackBlitz](https://stackblitz.com/fork/github/ishibashi0112/datasheet-grid/tree/main/examples/basic?file=src/App.tsx&terminal=dev) · [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,8 @@ export function App() {
|
|
|
41
45
|
}
|
|
42
46
|
```
|
|
43
47
|
|
|
48
|
+
More runnable examples (server-side row model, Astryx) are in [`examples/`](https://github.com/ishibashi0112/datasheet-grid/tree/main/examples); each opens in StackBlitz.
|
|
49
|
+
|
|
44
50
|
## Smaller bundles: `/lite` (0.54.0+)
|
|
45
51
|
|
|
46
52
|
`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).
|
|
@@ -63,7 +69,8 @@ Everything below ships inside the npm package, so it is available offline (for e
|
|
|
63
69
|
| --- | --- |
|
|
64
70
|
| Full API reference — props, column options, imperative handle (`ref`), recipes (Japanese) | `API_REFERENCE.md` in this package |
|
|
65
71
|
| 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` |
|
|
66
|
-
| Guides
|
|
72
|
+
| Guides with live demos (Japanese), playground, theme builder | [datasheet-grid.vercel.app](https://datasheet-grid.vercel.app) |
|
|
73
|
+
| Design notes, changelog | [GitHub README](https://github.com/ishibashi0112/datasheet-grid#readme) / [CHANGELOG.md](https://github.com/ishibashi0112/datasheet-grid/blob/main/CHANGELOG.md) |
|
|
67
74
|
|
|
68
75
|
## Rules that are easy to get wrong
|
|
69
76
|
|
|
@@ -85,6 +92,12 @@ MIT
|
|
|
85
92
|
|
|
86
93
|
React 19 向けの仮想化スプレッドシート / データグリッドです(約 100 万行・列固定・Excel ライクな編集 / 選択 / クリップボード・フィルター / ソート・クライアントサイド / サーバーサイド行モデル)。
|
|
87
94
|
|
|
95
|
+
**[ドキュメントとライブデモ](https://datasheet-grid.vercel.app)** · [プレイグラウンド](https://datasheet-grid.vercel.app/playground) · [StackBlitz で試す](https://stackblitz.com/fork/github/ishibashi0112/datasheet-grid/tree/main/examples/basic?file=src/App.tsx&terminal=dev) · [GitHub](https://github.com/ishibashi0112/datasheet-grid) · [変更履歴](https://github.com/ishibashi0112/datasheet-grid/blob/main/CHANGELOG.md)
|
|
96
|
+
|
|
97
|
+
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))。
|
|
98
|
+
|
|
99
|
+
ブラウザで動かせるサンプル(編集できる在庫表 / サーバーサイド行モデル / Astryx)は [`examples/`](https://github.com/ishibashi0112/datasheet-grid/tree/main/examples) にあり、どれも StackBlitz で開けます。
|
|
100
|
+
|
|
88
101
|
### バンドルを小さくする: `/lite`(0.54.0 から)
|
|
89
102
|
|
|
90
103
|
`SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約 112KB gzip)。`/lite` の入口では、渡した機能だけを入れたグリッドを作れます。渡さなかった機能はバンドルに入りません(機能なしで約 60KB、プリセット `standardFeatures` で約 78KB)。
|
|
@@ -107,7 +120,8 @@ npm パッケージに同梱されているため、オフライン(`node_module
|
|
|
107
120
|
| --- | --- |
|
|
108
121
|
| API リファレンス全体(props / 列定義 / 命令的 API(`ref`)/ レシピ) | 本パッケージ直下の `API_REFERENCE.md` |
|
|
109
122
|
| フィールドごとの説明(ホバーで表示) | 型定義の JSDoc。各フィールドの説明は `@ishibashi0112/spreadsheet-grid-core/dist/model/gridTypes.core.d.ts` にあり、`API_REFERENCE.md` の表と同じ内容 |
|
|
110
|
-
|
|
|
123
|
+
| ライブデモ付きのガイド / プレイグラウンド / テーマビルダー | [datasheet-grid.vercel.app](https://datasheet-grid.vercel.app) |
|
|
124
|
+
| 設計メモ / 変更履歴 | [GitHub の README](https://github.com/ishibashi0112/datasheet-grid#readme) / [CHANGELOG.md](https://github.com/ishibashi0112/datasheet-grid/blob/main/CHANGELOG.md) |
|
|
111
125
|
|
|
112
126
|
### 間違えやすいルール
|
|
113
127
|
|
|
@@ -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;
|