@ishibashi0112/spreadsheet-grid 0.54.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 +37 -1
- package/README.md +12 -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 +2 -2
- 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-C_PdPMWw.cjs → createSpreadsheetGrid-CF1TLFDT.cjs} +1 -1
- package/dist/lite/{createSpreadsheetGrid-Bp_9cAiW.js → createSpreadsheetGrid-DYacDtAY.js} +1 -1
- 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/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
|
@@ -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)
|
|
@@ -1724,6 +1724,42 @@ const s = stylex.create({
|
|
|
1724
1724
|
- StyleX は子孫セレクタを書けない(要素自身のクラスでしか装飾できない)ため、上記スロットに無い内部要素(ポップオーバー内のボタン / 入力欄等)はデザイントークン(`--ssg-*`)で調整する。
|
|
1725
1725
|
- StyleX の atomic クラスとグリッドの基底クラスは同じ特異度 (0,1,0)。同じプロパティは後に読み込まれた方が勝つため、グリッド CSS を先に・StyleX の出力 CSS を後に読み込むか、`style.layer.css`(`@layer ssg-base`)を使う。StyleX 側で `useLayers` を有効にしている場合は、未レイヤーのグリッド CSS がレイヤー内に常に勝つため `style.layer.css` が必須。
|
|
1726
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
|
+
|
|
1727
1763
|
## スタイリング用の状態クラス(公開契約)
|
|
1728
1764
|
|
|
1729
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
|
|
@@ -63,7 +67,8 @@ Everything below ships inside the npm package, so it is available offline (for e
|
|
|
63
67
|
| --- | --- |
|
|
64
68
|
| Full API reference — props, column options, imperative handle (`ref`), recipes (Japanese) | `API_REFERENCE.md` in this package |
|
|
65
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` |
|
|
66
|
-
| 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) |
|
|
67
72
|
|
|
68
73
|
## Rules that are easy to get wrong
|
|
69
74
|
|
|
@@ -85,6 +90,10 @@ MIT
|
|
|
85
90
|
|
|
86
91
|
React 19 向けの仮想化スプレッドシート / データグリッドです(約 100 万行・列固定・Excel ライクな編集 / 選択 / クリップボード・フィルター / ソート・クライアントサイド / サーバーサイド行モデル)。
|
|
87
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
|
+
|
|
88
97
|
### バンドルを小さくする: `/lite`(0.54.0 から)
|
|
89
98
|
|
|
90
99
|
`SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約 112KB gzip)。`/lite` の入口では、渡した機能だけを入れたグリッドを作れます。渡さなかった機能はバンドルに入りません(機能なしで約 60KB、プリセット `standardFeatures` で約 78KB)。
|
|
@@ -107,7 +116,8 @@ npm パッケージに同梱されているため、オフライン(`node_module
|
|
|
107
116
|
| --- | --- |
|
|
108
117
|
| API リファレンス全体(props / 列定義 / 命令的 API(`ref`)/ レシピ) | 本パッケージ直下の `API_REFERENCE.md` |
|
|
109
118
|
| フィールドごとの説明(ホバーで表示) | 型定義の JSDoc。各フィールドの説明は `@ishibashi0112/spreadsheet-grid-core/dist/model/gridTypes.core.d.ts` にあり、`API_REFERENCE.md` の表と同じ内容 |
|
|
110
|
-
|
|
|
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) |
|
|
111
121
|
|
|
112
122
|
### 間違えやすいルール
|
|
113
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;
|