@ishibashi0112/spreadsheet-grid 0.61.0 → 0.62.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 +121 -57
- package/README.md +8 -3
- package/dist/{ColumnFilterPopover-F20TkD0c.js → ColumnFilterPopover-BA-7nDsj.js} +114 -119
- package/dist/ColumnFilterPopover-DxqheJXu.cjs +1 -0
- package/dist/ai/useGridAsk.d.ts +10 -4
- package/dist/ai.cjs +1 -1
- package/dist/ai.d.ts +1 -1
- package/dist/ai.js +124 -96
- package/dist/common.d.ts +1 -1
- package/dist/editors/editorKeyBindings.d.ts +3 -1
- package/dist/features/types.d.ts +3 -0
- package/dist/hooks/useColumnMenuController.d.ts +1 -0
- package/dist/hooks/useGlobalFilteredOrder.d.ts +2 -1
- package/dist/hooks/useGridBarContext.d.ts +3 -1
- package/dist/hooks/useGridStore.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2078 -1947
- package/dist/lite/ColumnFilterPopover-BJ850WSB.cjs +1 -0
- package/dist/lite/{ColumnFilterPopover-CLTZ_4W5.js → ColumnFilterPopover-u9jUtyeA.js} +114 -119
- package/dist/lite/{columnMenu-Bljdw8BI.js → columnMenu-De-Pe1zW.js} +1 -0
- package/dist/lite/columnMenu-c7LUVw5e.cjs +1 -0
- package/dist/lite/createSpreadsheetGrid--UUIzl_-.cjs +1 -0
- package/dist/lite/createSpreadsheetGrid-CLXKPyht.js +3993 -0
- package/dist/lite/createSpreadsheetGrid.cjs +1 -1
- package/dist/lite/createSpreadsheetGrid.js +1 -1
- package/dist/lite/features/columnMenu.cjs +1 -1
- package/dist/lite/features/columnMenu.js +1 -1
- package/dist/lite/features/filtering.cjs +1 -1
- package/dist/lite/features/filtering.js +1 -1
- package/dist/lite/features/grouping.cjs +1 -1
- package/dist/lite/features/grouping.js +1 -1
- package/dist/lite/features/scrollHint.cjs +1 -1
- package/dist/lite/features/scrollHint.js +1 -1
- package/dist/lite/features/standard.cjs +1 -1
- package/dist/lite/features/standard.js +3 -3
- package/dist/lite/features/toolPanel.cjs +1 -1
- package/dist/lite/features/toolPanel.js +1 -1
- package/dist/lite/{filtering-vBqqBYAG.js → filtering--G2a3C52.js} +128 -123
- package/dist/lite/filtering-BiBzpwOt.cjs +1 -0
- package/dist/lite/{grouping-DpzyuoPc.js → grouping-DmEsb0fK.js} +26 -17
- package/dist/lite/grouping-DrzDODsr.cjs +1 -0
- package/dist/lite/{lazyPopups-OkLDimTH.cjs → lazyPopups-Bv7socba.cjs} +1 -1
- package/dist/lite/{lazyPopups-BXNfrY9S.js → lazyPopups-Iz7RhJT2.js} +1 -1
- package/dist/lite/{scrollHint-DNBSef2V.cjs → scrollHint-C9zWN8Is.cjs} +1 -1
- package/dist/lite/{scrollHint-DgNH5I5X.js → scrollHint-DrbQbfHq.js} +5 -5
- package/dist/lite/{toolPanel-ArCSqFon.cjs → toolPanel-CDUbIRGC.cjs} +1 -1
- package/dist/lite/{toolPanel-PNltNyJU.js → toolPanel-Co2Oa1Hn.js} +1 -1
- package/dist/{toolPanelViews-icRtdlYb.js → lite/toolPanelViews-B4z-zxN0.js} +58 -57
- package/dist/lite/toolPanelViews-lXyeaMNX.cjs +1 -0
- package/dist/lite.cjs +1 -1
- package/dist/lite.js +7 -7
- package/dist/style.css +1 -1
- package/dist/style.layer.css +4 -1
- package/dist/{lite/toolPanelViews-icRtdlYb.js → toolPanelViews-B4z-zxN0.js} +58 -57
- package/dist/toolPanelViews-lXyeaMNX.cjs +1 -0
- package/dist/view/ColumnChooserPanel.d.ts +1 -0
- package/dist/view/GridBodyGroupRow.d.ts +4 -2
- package/dist/view/gridBarHelpers.d.ts +11 -5
- package/package.json +2 -2
- package/skills/spreadsheet-grid/SKILL.md +4 -3
- package/dist/ColumnFilterPopover-I_O_eSLR.cjs +0 -1
- package/dist/lite/ColumnFilterPopover-yp9Xbs_1.cjs +0 -1
- package/dist/lite/columnMenu-DIcUt0iz.cjs +0 -1
- package/dist/lite/createSpreadsheetGrid-Cy_owplJ.cjs +0 -1
- package/dist/lite/createSpreadsheetGrid-D70ggVFk.js +0 -3875
- package/dist/lite/filtering-DCZvidEf.cjs +0 -1
- package/dist/lite/grouping-Bw4RGsGm.cjs +0 -1
- package/dist/lite/toolPanelViews-BZIU6pNY.cjs +0 -1
- package/dist/toolPanelViews-BZIU6pNY.cjs +0 -1
package/README.md
CHANGED
|
@@ -14,9 +14,10 @@ Peer dependencies: `react` / `react-dom` `^18.3.0 || ^19.0.0` (React 18 is suppo
|
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import '@ishibashi0112/spreadsheet-grid/style.css'
|
|
17
|
-
// or, if you use CSS cascade layers (e.g. Tailwind v4): '@ishibashi0112/spreadsheet-grid/style.layer.css'
|
|
18
17
|
```
|
|
19
18
|
|
|
19
|
+
`style.css` also works as is with Tailwind CSS v4. The cascade-layer variant `style.layer.css` (everything inside `@layer ssg-base`) is only for when you want the grid inside your layer order, and then you must declare that order in your CSS before Tailwind — `@layer theme, base, ssg-base, components, utilities;` — otherwise `ssg-base` becomes the weakest layer and Tailwind's preflight breaks the borders, buttons and popovers ([details](https://datasheet-grid.vercel.app/docs/installation)). The declaration must load before `style.layer.css`: import `style.layer.css` from that CSS file (`@import`), or, from JS, after it. The same goes for StyleX with `useLayers`.
|
|
20
|
+
|
|
20
21
|
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
22
|
|
|
22
23
|
## Quick start
|
|
@@ -49,7 +50,7 @@ More runnable examples (server-side row model, Astryx) are in [`examples/`](http
|
|
|
49
50
|
|
|
50
51
|
## Smaller bundles: `/lite` (0.54.0+)
|
|
51
52
|
|
|
52
|
-
`SpreadsheetGrid` includes every feature (about
|
|
53
|
+
`SpreadsheetGrid` includes every feature (about 120KB 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 65KB with no features, about 84KB with the `standardFeatures` preset).
|
|
53
54
|
|
|
54
55
|
```tsx
|
|
55
56
|
import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid/lite'
|
|
@@ -98,6 +99,7 @@ This library is new, so AI coding assistants rarely know its API and tend to gue
|
|
|
98
99
|
- **`rows` or `dataSource`.** `rows` is the client-side row model; `dataSource` switches to the server-side row model. They are mutually exclusive.
|
|
99
100
|
- **Height.** Use the `height` prop, not `style.height` on the root. A value containing `%` (`'100%'`) sizes the **whole grid including its bars** and needs a parent with a definite height; a number sizes the **scroll area only**. Without `height`, the scroll area is capped at `480px` (`maxHeight`).
|
|
100
101
|
- **Imperative API.** Pass `ref` to get a `SpreadsheetGridHandle<T>` (no `forwardRef` needed on your side; works the same on React 18.3 and 19).
|
|
102
|
+
- **Positions are view positions.** `viewRowIndex` / `colIndex` (in `selectCell` and the like) are positions after sorting and filtering, and `colIndex` also counts the columns the grid adds (row drag handle, detail toggle, auto group column). Look them up with `getViewRowIndex(rowKey)` / `getColIndex(columnKey)` instead of `rows.findIndex`.
|
|
101
103
|
- **Next.js App Router.** Render the grid from a Client Component (a file with `'use client'`); the package does not add the directive.
|
|
102
104
|
|
|
103
105
|
## Versioning
|
|
@@ -116,6 +118,8 @@ React 18.3 / 19 向けの仮想化スプレッドシート / データグリッ
|
|
|
116
118
|
|
|
117
119
|
**[ドキュメントとライブデモ](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)
|
|
118
120
|
|
|
121
|
+
CSS は `import '@ishibashi0112/spreadsheet-grid/style.css'` を 1 回読み込みます。Tailwind CSS v4 でも `style.css` でそのまま動きます。カスケードレイヤー版の `style.layer.css`(全体が `@layer ssg-base`)は、グリッドを自分のレイヤー順に入れたいときだけ使い、そのときは CSS で Tailwind より前に `@layer theme, base, ssg-base, components, utilities;` とレイヤー順を宣言してください(宣言しないと `ssg-base` が一番弱いレイヤーになり、Tailwind の Preflight に罫線・ボタン・ポップオーバーが崩されます。[詳しく](https://datasheet-grid.vercel.app/docs/installation))。宣言は `style.layer.css` より先に読まれる必要があるので、`style.layer.css` は宣言した CSS の中で `@import` するか、JS ならその CSS の後に `import` します。StyleX の `useLayers` を使うときも同じです。
|
|
122
|
+
|
|
119
123
|
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))。
|
|
120
124
|
|
|
121
125
|
ブラウザで動かせるサンプル(編集できる在庫表 / サーバーサイド行モデル / Astryx)は [`examples/`](https://github.com/ishibashi0112/datasheet-grid/tree/main/examples) にあり、どれも StackBlitz で開けます。
|
|
@@ -124,7 +128,7 @@ Astryx / Mantine / HeroUI v3 / shadcn/ui の中で使うときは、`style.css`
|
|
|
124
128
|
|
|
125
129
|
### バンドルを小さくする: `/lite`(0.54.0 から)
|
|
126
130
|
|
|
127
|
-
`SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約
|
|
131
|
+
`SpreadsheetGrid` は全機能入りです(初期読み込みの JS が約 120KB gzip)。`/lite` の入口では、渡した機能だけを入れたグリッドを作れます。渡さなかった機能はバンドルに入りません(機能なしで約 65KB、プリセット `standardFeatures` で約 84KB)。
|
|
128
132
|
|
|
129
133
|
```tsx
|
|
130
134
|
import { createSpreadsheetGrid, standardFeatures, serverSideFeature } from '@ishibashi0112/spreadsheet-grid/lite'
|
|
@@ -173,6 +177,7 @@ npm パッケージに同梱されているため、オフライン(`node_module
|
|
|
173
177
|
- **`rows` か `dataSource`。** `rows` はクライアントサイド行モデル、`dataSource` を渡すとサーバーサイド行モデルです。両者は排他です。
|
|
174
178
|
- **高さ。** ルートの `style.height` ではなく `height` prop で指定します。`%` を含む値(`'100%'`)は**バーを含むグリッド全体**の高さで、親要素に確定高さが必要です。数値は**スクロール領域だけ**の高さです。`height` 未指定時のスクロール領域は `480px`(`maxHeight`)が上限です。
|
|
175
179
|
- **命令的 API。** `ref` を渡すと `SpreadsheetGridHandle<T>` を受け取れます(利用側で `forwardRef` は不要。React 18.3 / 19 のどちらでも同じ)。
|
|
180
|
+
- **位置は表示の位置。** `selectCell` などの `viewRowIndex` / `colIndex` は並べ替え・絞り込みの後の表示の位置で、`colIndex` は行ドラッグのハンドル列・展開トグル列・自動グループ列(ライブラリが足す列)も数えます。`rows.findIndex` ではなく `getViewRowIndex(rowKey)` / `getColIndex(columnKey)` で引いてください。
|
|
176
181
|
- **Next.js App Router。** クライアントコンポーネント(`'use client'` のファイル)から描画してください。パッケージ側はディレクティブを付けていません。
|
|
177
182
|
|
|
178
183
|
### バージョンの方針
|
|
@@ -64,7 +64,17 @@ function B({ value: e, onCommit: t, ariaLabel: r, inputRef: s, onRequestClose: p
|
|
|
64
64
|
t.preventDefault(), t.stopPropagation(), e();
|
|
65
65
|
},
|
|
66
66
|
onKeyDown: (t) => {
|
|
67
|
-
t.stopPropagation(),
|
|
67
|
+
if (t.stopPropagation(), t.key === "Enter" || t.key === " ") {
|
|
68
|
+
t.preventDefault(), e();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (t.key === "Escape") {
|
|
72
|
+
if (t.preventDefault(), y) {
|
|
73
|
+
M(), t.currentTarget.closest(".ssg-dp-root")?.querySelector(".ssg-dp-input")?.focus();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
p();
|
|
77
|
+
}
|
|
68
78
|
}
|
|
69
79
|
}), H = (e) => {
|
|
70
80
|
if (x === "days") {
|
|
@@ -81,7 +91,7 @@ function B({ value: e, onCommit: t, ariaLabel: r, inputRef: s, onRequestClose: p
|
|
|
81
91
|
S((e) => e === "days" ? "months" : "years");
|
|
82
92
|
}, W = () => {
|
|
83
93
|
S((e) => e === "years" ? "months" : "days");
|
|
84
|
-
},
|
|
94
|
+
}, G = x === "days" ? I(C, T) : x === "months" ? `${C}年` : `${R(C)} – ${R(C) + 11}`;
|
|
85
95
|
return /* @__PURE__ */ d("div", {
|
|
86
96
|
ref: D,
|
|
87
97
|
className: "ssg-dp-root",
|
|
@@ -166,7 +176,7 @@ function B({ value: e, onCommit: t, ariaLabel: r, inputRef: s, onRequestClose: p
|
|
|
166
176
|
disabled: x === "years",
|
|
167
177
|
"aria-label": "表示単位を切り替える",
|
|
168
178
|
...V(U),
|
|
169
|
-
children:
|
|
179
|
+
children: G
|
|
170
180
|
}),
|
|
171
181
|
/* @__PURE__ */ u("button", {
|
|
172
182
|
type: "button",
|
|
@@ -345,8 +355,10 @@ function H({ options: n, setSelection: o, searchInputRef: s, onValueToggle: f, o
|
|
|
345
355
|
})
|
|
346
356
|
] });
|
|
347
357
|
}
|
|
348
|
-
var U = (e) =>
|
|
349
|
-
|
|
358
|
+
var U = (e) => {
|
|
359
|
+
e.key !== "Escape" && e.stopPropagation();
|
|
360
|
+
}, W = (e) => e.nativeEvent.isComposing === !0, G = (e, t, n) => {
|
|
361
|
+
if (W(n)) {
|
|
350
362
|
e(t, { commit: !1 });
|
|
351
363
|
return;
|
|
352
364
|
}
|
|
@@ -374,7 +386,7 @@ function te({ draft: e, valueInputRef: t, onDraftChange: n, onKeyDown: r }) {
|
|
|
374
386
|
type: "text",
|
|
375
387
|
inputMode: "decimal",
|
|
376
388
|
value: e.value1,
|
|
377
|
-
onChange: (t) =>
|
|
389
|
+
onChange: (t) => G(n, {
|
|
378
390
|
...e,
|
|
379
391
|
value1: t.target.value
|
|
380
392
|
}, t),
|
|
@@ -393,7 +405,7 @@ function te({ draft: e, valueInputRef: t, onDraftChange: n, onKeyDown: r }) {
|
|
|
393
405
|
type: "text",
|
|
394
406
|
inputMode: "decimal",
|
|
395
407
|
value: e.value2,
|
|
396
|
-
onChange: (t) =>
|
|
408
|
+
onChange: (t) => G(n, {
|
|
397
409
|
...e,
|
|
398
410
|
value2: t.target.value
|
|
399
411
|
}, t),
|
|
@@ -432,7 +444,7 @@ function ne({ draft: e, valueInputRef: t, onDraftChange: n, onKeyDown: r }) {
|
|
|
432
444
|
ref: t,
|
|
433
445
|
type: "text",
|
|
434
446
|
value: e.value,
|
|
435
|
-
onChange: (t) =>
|
|
447
|
+
onChange: (t) => G(n, {
|
|
436
448
|
...e,
|
|
437
449
|
value: t.target.value
|
|
438
450
|
}, t),
|
|
@@ -525,7 +537,7 @@ function re({ draft: e, valueInputRef: t, onDraftChange: n, onKeyDown: r, preset
|
|
|
525
537
|
});
|
|
526
538
|
},
|
|
527
539
|
onKeyDown: (r) => {
|
|
528
|
-
r
|
|
540
|
+
U(r), (r.key === "Enter" || r.key === " ") && (r.preventDefault(), n({
|
|
529
541
|
...e,
|
|
530
542
|
preset: e.preset === t.id ? null : t.id
|
|
531
543
|
}));
|
|
@@ -577,7 +589,7 @@ function ie({ options: n, setSelection: o, searchInputRef: s, onValueToggle: f,
|
|
|
577
589
|
t.preventDefault(), t.stopPropagation(), L(e.key);
|
|
578
590
|
},
|
|
579
591
|
onKeyDown: (t) => {
|
|
580
|
-
t
|
|
592
|
+
U(t), (t.key === "Enter" || t.key === " ") && (t.preventDefault(), L(e.key));
|
|
581
593
|
},
|
|
582
594
|
className: "ssg-filter-tree-toggle",
|
|
583
595
|
"aria-label": e.expanded ? "折りたたむ" : "展開する",
|
|
@@ -710,7 +722,7 @@ function ae({ status: e, errorMessage: t, onRetry: n }) {
|
|
|
710
722
|
e.preventDefault(), e.stopPropagation(), n();
|
|
711
723
|
},
|
|
712
724
|
onKeyDown: (e) => {
|
|
713
|
-
e
|
|
725
|
+
U(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), n());
|
|
714
726
|
},
|
|
715
727
|
className: "ssg-filter-btn-secondary",
|
|
716
728
|
children: "再試行"
|
|
@@ -737,7 +749,7 @@ function se({ conditionEditor: e, conditionActive: t, onConditionClear: n, optio
|
|
|
737
749
|
e.preventDefault(), e.stopPropagation(), n();
|
|
738
750
|
},
|
|
739
751
|
onKeyDown: (e) => {
|
|
740
|
-
e
|
|
752
|
+
U(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), n());
|
|
741
753
|
},
|
|
742
754
|
className: "ssg-filter-sec-clear",
|
|
743
755
|
disabled: !t,
|
|
@@ -763,7 +775,7 @@ function se({ conditionEditor: e, conditionActive: t, onConditionClear: n, optio
|
|
|
763
775
|
e.preventDefault(), e.stopPropagation(), a();
|
|
764
776
|
},
|
|
765
777
|
onKeyDown: (e) => {
|
|
766
|
-
e
|
|
778
|
+
U(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), a());
|
|
767
779
|
},
|
|
768
780
|
className: "ssg-filter-sec-clear",
|
|
769
781
|
disabled: i === null,
|
|
@@ -778,7 +790,7 @@ function se({ conditionEditor: e, conditionActive: t, onConditionClear: n, optio
|
|
|
778
790
|
})
|
|
779
791
|
] });
|
|
780
792
|
}
|
|
781
|
-
function
|
|
793
|
+
function K({ isOpen: e, themeClassName: t, popoverSlot: n, title: r, filterType: f, draftValue: m, numberConditionDraft: h, onNumberConditionDraftChange: g, textConditionDraft: v, onTextConditionDraftChange: x, dateConditionDraft: C, onDateConditionDraftChange: E, datePresets: D, renderDateInput: A, onComboConditionClear: M, onComboSelectionClear: N, comboSummaryText: P, currentValueText: ee, layout: F, selectOptions: I, optionsStatus: L, optionsProgress: R, optionsTruncated: z = !1, optionsErrorMessage: B, onOptionsRetry: V, setSelection: W, popoverRef: G, textInputRef: K, selectRef: ce, onRequestClose: q, onDraftChange: le, onApply: J, onClear: ue, onSetValueToggle: de, onSetSelectAllChange: fe, onSetClear: pe, onSetReplaceSelection: me, isServerSide: he = !1 }) {
|
|
782
794
|
let ge = i(null), [_e] = a(() => /* @__PURE__ */ new Date());
|
|
783
795
|
if (typeof document > "u" || !e || !F) return null;
|
|
784
796
|
let ve = {
|
|
@@ -787,38 +799,38 @@ function G({ isOpen: e, themeClassName: t, popoverSlot: n, title: r, filterType:
|
|
|
787
799
|
width: F.width,
|
|
788
800
|
maxHeight: F.maxHeight
|
|
789
801
|
}, ye = (e) => {
|
|
790
|
-
e.stopPropagation();
|
|
802
|
+
e.stopPropagation(), e.key === "Escape" && !e.defaultPrevented && !c(e.nativeEvent) && (e.preventDefault(), q());
|
|
791
803
|
}, be = (e) => {
|
|
792
804
|
e.stopPropagation();
|
|
793
|
-
}, xe = f === "set",
|
|
805
|
+
}, xe = f === "set", Y = f === "numberSet", X = f === "textSet", Z = f === "dateSet", Se = Y || X || Z, Q = xe || Se, Ce = L === "loading" || L === "error", we = h ?? _, Te = v ?? S, Ee = C ?? O, De = D ?? p(void 0), Oe = Y ? y(we) : null, ke = X ? w(Te) : null, Ae = Z ? k(Ee) : null, je = Oe !== null || ke !== null || Ae !== null, $ = Y ? b(I, Oe) : X ? T(I, ke) : Z ? j(I, Ae, _e, De) : I, Me = (e) => {
|
|
794
806
|
if (e.stopPropagation(), !c(e.nativeEvent)) {
|
|
795
807
|
if (e.key === "Enter") {
|
|
796
|
-
e.preventDefault(),
|
|
808
|
+
e.preventDefault(), J();
|
|
797
809
|
return;
|
|
798
810
|
}
|
|
799
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
811
|
+
e.key === "Escape" && (e.preventDefault(), q());
|
|
800
812
|
}
|
|
801
|
-
},
|
|
813
|
+
}, Ne = Y ? /* @__PURE__ */ u(te, {
|
|
802
814
|
draft: we,
|
|
803
|
-
valueInputRef:
|
|
815
|
+
valueInputRef: K,
|
|
804
816
|
onDraftChange: g,
|
|
805
|
-
onKeyDown:
|
|
806
|
-
}) :
|
|
817
|
+
onKeyDown: Me
|
|
818
|
+
}) : X ? /* @__PURE__ */ u(ne, {
|
|
807
819
|
draft: Te,
|
|
808
|
-
valueInputRef:
|
|
820
|
+
valueInputRef: K,
|
|
809
821
|
onDraftChange: x,
|
|
810
|
-
onKeyDown:
|
|
822
|
+
onKeyDown: Me
|
|
811
823
|
}) : /* @__PURE__ */ u(re, {
|
|
812
824
|
draft: Ee,
|
|
813
|
-
valueInputRef:
|
|
825
|
+
valueInputRef: K,
|
|
814
826
|
onDraftChange: E,
|
|
815
|
-
onKeyDown:
|
|
827
|
+
onKeyDown: Me,
|
|
816
828
|
presets: De,
|
|
817
829
|
renderDateInput: A,
|
|
818
|
-
onRequestClose:
|
|
830
|
+
onRequestClose: q
|
|
819
831
|
});
|
|
820
832
|
return s(/* @__PURE__ */ d("div", {
|
|
821
|
-
ref:
|
|
833
|
+
ref: G,
|
|
822
834
|
onPointerDown: be,
|
|
823
835
|
onKeyDown: ye,
|
|
824
836
|
onPasteCapture: (e) => {
|
|
@@ -834,19 +846,19 @@ function G({ isOpen: e, themeClassName: t, popoverSlot: n, title: r, filterType:
|
|
|
834
846
|
className: "ssg-filter-title",
|
|
835
847
|
children: ["列フィルター: ", r]
|
|
836
848
|
}),
|
|
837
|
-
(
|
|
849
|
+
(Q || f === "select") && L === "collecting" ? /* @__PURE__ */ d("div", {
|
|
838
850
|
className: "ssg-filter-collecting",
|
|
839
851
|
children: [
|
|
840
852
|
"候補を収集中… ",
|
|
841
853
|
Math.round(R * 100),
|
|
842
854
|
"%"
|
|
843
855
|
]
|
|
844
|
-
}) : (
|
|
845
|
-
conditionEditor:
|
|
856
|
+
}) : (Q || f === "select") && Ce ? Se ? /* @__PURE__ */ u(se, {
|
|
857
|
+
conditionEditor: Ne,
|
|
846
858
|
conditionActive: je,
|
|
847
859
|
onConditionClear: M,
|
|
848
|
-
options:
|
|
849
|
-
setSelection:
|
|
860
|
+
options: $,
|
|
861
|
+
setSelection: W,
|
|
850
862
|
onSelectionClear: N,
|
|
851
863
|
summaryText: P,
|
|
852
864
|
optionsMeta: L === "loading" ? "取得中…" : "取得失敗",
|
|
@@ -860,136 +872,119 @@ function G({ isOpen: e, themeClassName: t, popoverSlot: n, title: r, filterType:
|
|
|
860
872
|
errorMessage: B,
|
|
861
873
|
onRetry: V
|
|
862
874
|
}) : Se ? /* @__PURE__ */ u(se, {
|
|
863
|
-
conditionEditor:
|
|
875
|
+
conditionEditor: Ne,
|
|
864
876
|
conditionActive: je,
|
|
865
877
|
onConditionClear: M,
|
|
866
|
-
options:
|
|
867
|
-
setSelection:
|
|
878
|
+
options: $,
|
|
879
|
+
setSelection: W,
|
|
868
880
|
onSelectionClear: N,
|
|
869
881
|
summaryText: P,
|
|
870
|
-
children:
|
|
871
|
-
options:
|
|
872
|
-
setSelection:
|
|
882
|
+
children: Z ? /* @__PURE__ */ u(ie, {
|
|
883
|
+
options: $,
|
|
884
|
+
setSelection: W,
|
|
873
885
|
searchInputRef: ge,
|
|
874
886
|
onValueToggle: de,
|
|
875
887
|
onSelectAllChange: fe,
|
|
876
888
|
onReplaceSelection: me,
|
|
877
|
-
onRequestClose:
|
|
889
|
+
onRequestClose: q,
|
|
878
890
|
isServerSide: he,
|
|
879
891
|
truncated: z
|
|
880
892
|
}) : /* @__PURE__ */ u(H, {
|
|
881
|
-
options:
|
|
882
|
-
setSelection:
|
|
893
|
+
options: $,
|
|
894
|
+
setSelection: W,
|
|
883
895
|
searchInputRef: ge,
|
|
884
896
|
onValueToggle: de,
|
|
885
897
|
onSelectAllChange: fe,
|
|
886
898
|
onReplaceSelection: me,
|
|
887
|
-
onRequestClose:
|
|
899
|
+
onRequestClose: q,
|
|
888
900
|
isServerSide: he,
|
|
889
901
|
selectAllUsesExplicitScope: !0,
|
|
890
902
|
truncated: z
|
|
891
903
|
})
|
|
892
904
|
}) : xe ? /* @__PURE__ */ u(H, {
|
|
893
905
|
options: I,
|
|
894
|
-
setSelection:
|
|
895
|
-
searchInputRef:
|
|
906
|
+
setSelection: W,
|
|
907
|
+
searchInputRef: K,
|
|
896
908
|
onValueToggle: de,
|
|
897
909
|
onSelectAllChange: fe,
|
|
898
910
|
onReplaceSelection: me,
|
|
899
|
-
onRequestClose:
|
|
911
|
+
onRequestClose: q,
|
|
900
912
|
isServerSide: he,
|
|
901
913
|
truncated: z
|
|
902
|
-
}) : f === "number" ? /* @__PURE__ */
|
|
903
|
-
className: "ssg-filter-hint",
|
|
904
|
-
children: "フィルター種別: number"
|
|
905
|
-
}), /* @__PURE__ */ u(te, {
|
|
914
|
+
}) : f === "number" ? /* @__PURE__ */ u(l, { children: /* @__PURE__ */ u(te, {
|
|
906
915
|
draft: we,
|
|
907
|
-
valueInputRef:
|
|
916
|
+
valueInputRef: K,
|
|
908
917
|
onDraftChange: g,
|
|
909
|
-
onKeyDown:
|
|
910
|
-
})
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
918
|
+
onKeyDown: Me
|
|
919
|
+
}) }) : f === "select" ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ d("select", {
|
|
920
|
+
ref: ce,
|
|
921
|
+
value: m,
|
|
922
|
+
onChange: (e) => le(e.target.value),
|
|
923
|
+
onKeyDown: (e) => {
|
|
924
|
+
if (e.stopPropagation(), e.key === "Enter") {
|
|
925
|
+
e.preventDefault(), J();
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
e.key === "Escape" && (e.preventDefault(), q());
|
|
929
|
+
},
|
|
930
|
+
className: "ssg-filter-select",
|
|
931
|
+
children: [/* @__PURE__ */ u("option", {
|
|
932
|
+
value: "",
|
|
933
|
+
children: "(すべて)"
|
|
934
|
+
}), I.map((e) => /* @__PURE__ */ u("option", {
|
|
935
|
+
value: e.value,
|
|
936
|
+
children: e.label
|
|
937
|
+
}, `${r}-${e.value}`))]
|
|
938
|
+
}), /* @__PURE__ */ d("div", {
|
|
939
|
+
className: "ssg-filter-meta",
|
|
940
|
+
children: [
|
|
941
|
+
"候補数: ",
|
|
942
|
+
I.length,
|
|
943
|
+
z && /* @__PURE__ */ u(oe, {})
|
|
944
|
+
]
|
|
945
|
+
})] }) : /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("input", {
|
|
946
|
+
ref: K,
|
|
947
|
+
type: "text",
|
|
948
|
+
value: m,
|
|
949
|
+
onChange: (e) => le(e.target.value),
|
|
950
|
+
onKeyDown: (e) => {
|
|
951
|
+
if (e.stopPropagation(), !c(e.nativeEvent)) {
|
|
952
|
+
if (e.key === "Enter") {
|
|
953
|
+
e.preventDefault(), J();
|
|
922
954
|
return;
|
|
923
955
|
}
|
|
924
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
}),
|
|
935
|
-
/* @__PURE__ */ d("div", {
|
|
936
|
-
className: "ssg-filter-meta",
|
|
937
|
-
children: [
|
|
938
|
-
"候補数: ",
|
|
939
|
-
I.length,
|
|
940
|
-
z && /* @__PURE__ */ u(oe, {})
|
|
941
|
-
]
|
|
942
|
-
})
|
|
943
|
-
] }) : /* @__PURE__ */ d(l, { children: [
|
|
944
|
-
/* @__PURE__ */ d("div", {
|
|
945
|
-
className: "ssg-filter-hint",
|
|
946
|
-
children: ["フィルター種別: ", f]
|
|
947
|
-
}),
|
|
948
|
-
/* @__PURE__ */ u("input", {
|
|
949
|
-
ref: G,
|
|
950
|
-
type: "text",
|
|
951
|
-
value: m,
|
|
952
|
-
onChange: (e) => le(e.target.value),
|
|
953
|
-
onKeyDown: (e) => {
|
|
954
|
-
if (e.stopPropagation(), !c(e.nativeEvent)) {
|
|
955
|
-
if (e.key === "Enter") {
|
|
956
|
-
e.preventDefault(), q();
|
|
957
|
-
return;
|
|
958
|
-
}
|
|
959
|
-
e.key === "Escape" && (e.preventDefault(), K());
|
|
960
|
-
}
|
|
961
|
-
},
|
|
962
|
-
placeholder: "部分一致で絞り込み",
|
|
963
|
-
className: "ssg-filter-input"
|
|
964
|
-
}),
|
|
965
|
-
/* @__PURE__ */ u("div", {
|
|
966
|
-
className: "ssg-filter-meta ssg-filter-meta--ellipsis",
|
|
967
|
-
children: "部分一致検索です"
|
|
968
|
-
})
|
|
969
|
-
] }),
|
|
970
|
-
!Z && /* @__PURE__ */ d("div", {
|
|
956
|
+
e.key === "Escape" && (e.preventDefault(), q());
|
|
957
|
+
}
|
|
958
|
+
},
|
|
959
|
+
placeholder: "部分一致で絞り込み",
|
|
960
|
+
className: "ssg-filter-input"
|
|
961
|
+
}), /* @__PURE__ */ u("div", {
|
|
962
|
+
className: "ssg-filter-meta ssg-filter-meta--ellipsis",
|
|
963
|
+
children: "部分一致検索です"
|
|
964
|
+
})] }),
|
|
965
|
+
!Q && /* @__PURE__ */ d("div", {
|
|
971
966
|
className: "ssg-filter-meta ssg-filter-meta--ellipsis",
|
|
972
967
|
children: ["現在値: ", ee]
|
|
973
968
|
}),
|
|
974
969
|
/* @__PURE__ */ u("div", {
|
|
975
970
|
className: "ssg-filter-footer",
|
|
976
|
-
children:
|
|
971
|
+
children: Q ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("button", {
|
|
977
972
|
type: "button",
|
|
978
973
|
onPointerDown: (e) => {
|
|
979
974
|
e.preventDefault(), e.stopPropagation(), pe();
|
|
980
975
|
},
|
|
981
976
|
onKeyDown: (e) => {
|
|
982
|
-
e
|
|
977
|
+
U(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), pe());
|
|
983
978
|
},
|
|
984
979
|
className: "ssg-filter-btn-secondary",
|
|
985
980
|
children: "クリア"
|
|
986
981
|
}), /* @__PURE__ */ u("button", {
|
|
987
982
|
type: "button",
|
|
988
983
|
onPointerDown: (e) => {
|
|
989
|
-
e.preventDefault(), e.stopPropagation(),
|
|
984
|
+
e.preventDefault(), e.stopPropagation(), q();
|
|
990
985
|
},
|
|
991
986
|
onKeyDown: (e) => {
|
|
992
|
-
e
|
|
987
|
+
U(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), q());
|
|
993
988
|
},
|
|
994
989
|
className: "ssg-filter-btn-primary",
|
|
995
990
|
children: "閉じる"
|
|
@@ -999,17 +994,17 @@ function G({ isOpen: e, themeClassName: t, popoverSlot: n, title: r, filterType:
|
|
|
999
994
|
e.preventDefault(), e.stopPropagation(), ue();
|
|
1000
995
|
},
|
|
1001
996
|
onKeyDown: (e) => {
|
|
1002
|
-
e
|
|
997
|
+
U(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), ue());
|
|
1003
998
|
},
|
|
1004
999
|
className: "ssg-filter-btn-secondary",
|
|
1005
1000
|
children: "クリア"
|
|
1006
1001
|
}), /* @__PURE__ */ u("button", {
|
|
1007
1002
|
type: "button",
|
|
1008
1003
|
onPointerDown: (e) => {
|
|
1009
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1004
|
+
e.preventDefault(), e.stopPropagation(), J();
|
|
1010
1005
|
},
|
|
1011
1006
|
onKeyDown: (e) => {
|
|
1012
|
-
e
|
|
1007
|
+
U(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), J());
|
|
1013
1008
|
},
|
|
1014
1009
|
className: "ssg-filter-btn-primary",
|
|
1015
1010
|
children: "適用"
|
|
@@ -1019,4 +1014,4 @@ function G({ isOpen: e, themeClassName: t, popoverSlot: n, title: r, filterType:
|
|
|
1019
1014
|
}), document.body);
|
|
1020
1015
|
}
|
|
1021
1016
|
//#endregion
|
|
1022
|
-
export {
|
|
1017
|
+
export { K as ColumnFilterPopover, K as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./useVirtualizerCore-DSo33-5T.cjs");let t=require("react"),n=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/cx"),r=require("react-dom"),i=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards"),a=require("react/jsx-runtime"),o=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/filtering"),s=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/dateFilterPresets"),c=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/setFilterSearch"),l=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/setFilterSelection"),u=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/numberFilterCondition"),d=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/textFilterCondition"),f=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/dateFilterCondition"),p=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/datePickerCalendar"),m=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/dateFilterTree");function h({value:e,onCommit:r,ariaLabel:s,inputRef:c,onRequestClose:l,align:u=`left`}){let[d,f]=(0,t.useState)(null),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(!1),[v,y]=(0,t.useState)(`days`),[b,x]=(0,t.useState)(()=>new Date().getFullYear()),[S,C]=(0,t.useState)(()=>new Date().getMonth()),w=(0,t.useRef)(null),T=d??(0,p.formatFilterDateDisplay)(e),E=(0,o.toDateKey)(new Date)??``,D=()=>{if(d===null)return;let e=d.trim();if(e===``){r(``),f(null),h(!1);return}let t=(0,o.toDateKey)(e);if(t===null){h(!0);return}r(t),f(null),h(!1)},O=()=>{let[t,n]=(e===``?E:e).split(`-`);x(Number(t)),C(Number(n)-1),y(`days`),_(!0)},k=()=>{_(!1)},A=e=>{r(e),f(null),h(!1),k()};(0,t.useEffect)(()=>{if(!g)return;let e=e=>{let t=e.target;t&&w.current?.contains(t)||_(!1)};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[g]);let j=e=>{if(e.stopPropagation(),e.key===`Enter`){if((0,i.isImeComposingKeyEvent)(e.nativeEvent))return;e.preventDefault(),D(),k();return}if(e.key===`Escape`){if(e.preventDefault(),g){k();return}l()}},M=e=>({onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),e()},onKeyDown:t=>{if(t.stopPropagation(),t.key===`Enter`||t.key===` `){t.preventDefault(),e();return}if(t.key===`Escape`){if(t.preventDefault(),g){k(),t.currentTarget.closest(`.ssg-dp-root`)?.querySelector(`.ssg-dp-input`)?.focus();return}l()}}}),N=e=>{if(v===`days`){let t=new Date(b,S+e,1);x(t.getFullYear()),C(t.getMonth());return}if(v===`months`){x(t=>t+e);return}x(t=>t+e*12)},P=()=>{y(e=>e===`days`?`months`:`years`)},F=()=>{y(e=>e===`years`?`months`:`days`)},I=v===`days`?(0,p.formatCalendarTitle)(b,S):v===`months`?`${b}年`:`${(0,p.yearGridStart)(b)} – ${(0,p.yearGridStart)(b)+11}`;return(0,a.jsxs)(`div`,{ref:w,className:`ssg-dp-root`,children:[(0,a.jsxs)(`div`,{className:(0,n.cx)(`ssg-dp-field`,g&&`ssg-dp-field--open`,m&&`ssg-dp-field--invalid`),children:[(0,a.jsx)(`input`,{ref:c,type:`text`,inputMode:`numeric`,value:T,placeholder:`yyyy/mm/dd`,"aria-label":s,"aria-invalid":m||void 0,className:`ssg-dp-input`,onChange:e=>{f(e.target.value),h(!1)},onKeyDown:j,onBlur:D}),(0,a.jsx)(`button`,{type:`button`,className:`ssg-dp-cal-btn`,"aria-label":g?`カレンダーを閉じる`:`カレンダーを開く`,...M(()=>{g?k():O()}),children:(0,a.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,a.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`12`,rx:`1.5`,fill:`none`,stroke:`currentColor`}),(0,a.jsx)(`line`,{x1:`1.5`,y1:`6`,x2:`14.5`,y2:`6`,stroke:`currentColor`}),(0,a.jsx)(`line`,{x1:`5`,y1:`1`,x2:`5`,y2:`4`,stroke:`currentColor`}),(0,a.jsx)(`line`,{x1:`11`,y1:`1`,x2:`11`,y2:`4`,stroke:`currentColor`})]})})]}),g&&(0,a.jsxs)(`div`,{className:(0,n.cx)(`ssg-dp-panel`,u===`right`&&`ssg-dp-panel--right`),children:[(0,a.jsxs)(`div`,{className:`ssg-dp-nav`,children:[(0,a.jsx)(`button`,{type:`button`,className:`ssg-dp-nav-btn`,"aria-label":`前へ`,...M(()=>N(-1)),children:`‹`}),(0,a.jsx)(`button`,{type:`button`,className:`ssg-dp-nav-title`,disabled:v===`years`,"aria-label":`表示単位を切り替える`,...M(P),children:I}),(0,a.jsx)(`button`,{type:`button`,className:`ssg-dp-nav-btn`,"aria-label":`次へ`,...M(()=>N(1)),children:`›`})]}),v===`days`&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`ssg-dp-dow`,children:p.CALENDAR_DOW_LABELS.map((e,t)=>(0,a.jsx)(`span`,{className:(0,n.cx)(t===0&&`ssg-dp-dow--sun`,t===6&&`ssg-dp-dow--sat`),children:e},e))}),(0,a.jsx)(`div`,{className:`ssg-dp-days`,children:(0,p.buildCalendarDayCells)(b,S).map(t=>(0,a.jsx)(`button`,{type:`button`,className:(0,n.cx)(`ssg-dp-day`,!t.inCurrentMonth&&`ssg-dp-day--out`,t.key===E&&`ssg-dp-day--today`,t.key===e&&`ssg-dp-day--selected`),"aria-label":t.key,...M(()=>A(t.key)),children:t.day},t.key))})]}),v===`months`&&(0,a.jsx)(`div`,{className:`ssg-dp-grid`,children:p.CALENDAR_MONTH_LABELS.map((e,t)=>(0,a.jsx)(`button`,{type:`button`,className:(0,n.cx)(`ssg-dp-cell`,t===S&&`ssg-dp-cell--selected`),...M(()=>{C(t),y(`days`)}),children:e},e))}),v===`years`&&(0,a.jsx)(`div`,{className:`ssg-dp-grid`,children:(0,p.buildYearGrid)(b).map(e=>(0,a.jsx)(`button`,{type:`button`,className:(0,n.cx)(`ssg-dp-cell`,e===b&&`ssg-dp-cell--selected`),...M(()=>{x(e),y(`months`)}),children:e},e))}),(0,a.jsxs)(`div`,{className:`ssg-dp-foot`,children:[v!==`days`&&(0,a.jsx)(`button`,{type:`button`,className:`ssg-dp-foot-btn`,...M(F),children:`← 戻る`}),(0,a.jsx)(`button`,{type:`button`,className:`ssg-dp-foot-btn`,...M(()=>A(E)),children:`今日`}),(0,a.jsx)(`button`,{type:`button`,className:`ssg-dp-foot-btn ssg-dp-foot-btn--muted`,...M(()=>A(``)),children:`クリア`})]})]})]})}var g=24;function _({options:n,setSelection:r,searchInputRef:o,onValueToggle:s,onSelectAllChange:u,onReplaceSelection:d,onRequestClose:f,isServerSide:p,selectAllUsesExplicitScope:m=!1,truncated:h=!1}){let[_,v]=(0,t.useState)(``),y=(0,t.useDeferredValue)(_),b=(0,t.useMemo)(()=>(0,c.filterSetOptionsBySearch)(n,y),[n,y]),x=y.trim().length>0,S=(0,t.useRef)(null),C=e.t({count:b.length,getScrollElement:()=>S.current,estimateSize:()=>g,overscan:10}),w=(0,t.useMemo)(()=>{if(r===null)return b.length;let e=0;for(let t of b)(0,l.isSetValueSelected)(r,t.value)&&(e+=1);return e},[r,b]),T=b.length>0&&w===b.length,D=w>0&&!T,O=(0,t.useMemo)(()=>new Set(n.map(e=>e.value)),[n]),k=(0,t.useMemo)(()=>{if(r===null)return n.length;let e=0;for(let t of r.values)O.has(t)&&(e+=1);return r.mode===`include`?e:n.length-e},[r,O,n.length]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`input`,{ref:o,type:`text`,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),f()),e.key===`Enter`){if((0,i.isImeComposingKeyEvent)(e.nativeEvent))return;e.preventDefault();let t=(0,c.resolveSetFilterEnterAction)(n,_);if(t.kind===`none`)return;t.kind===`replace`&&d(t.values),f()}},placeholder:`検索(Enter で確定)`,className:`ssg-filter-input`}),(0,a.jsxs)(`label`,{className:`ssg-filter-selectall`,children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:T,ref:e=>{e&&(e.indeterminate=D)},onChange:()=>{u(x||m?b.map(e=>e.value):`all`,!T)}}),(0,a.jsx)(`span`,{className:`ssg-filter-selectall-label`,children:x?`(検索結果をすべて選択)`:`(すべて選択)`})]}),(0,a.jsx)(`div`,{ref:S,className:`ssg-filter-list`,children:b.length===0?(0,a.jsx)(`div`,{className:`ssg-filter-empty`,children:n.length===0?p?`候補が未指定です(serverSide では列に filterOptions などの候補供給が必要)`:`候補がありません`:`一致する候補がありません`}):(0,a.jsx)(`div`,{className:`ssg-filter-virt`,style:{height:C.getTotalSize()},children:C.getVirtualItems().map(e=>{let t=b[e.index];if(!t)return null;let n=(0,l.isSetValueSelected)(r,t.value);return(0,a.jsxs)(`label`,{className:`ssg-filter-option`,style:{transform:`translateY(${e.start}px)`,height:e.size},children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>s(t.value)}),(0,a.jsx)(`span`,{className:`ssg-filter-option-label`,children:t.label})]},t.value)})})}),(0,a.jsxs)(`div`,{className:`ssg-filter-meta`,children:[`選択中: `,k,` / `,n.length,` 件`,x?`(表示中 ${b.length} 件)`:``,h&&(0,a.jsx)(E,{})]})]})}var v=e=>{e.key!==`Escape`&&e.stopPropagation()},y=e=>e.nativeEvent.isComposing===!0,b=(e,t,n)=>{if(y(n)){e(t,{commit:!1});return}e(t)};function x({draft:e,valueInputRef:t,onDraftChange:n,onKeyDown:r}){let i=(0,u.numberFilterOperandCount)(e.operator);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`select`,{value:e.operator,onChange:t=>n({...e,operator:t.target.value}),onKeyDown:r,className:`ssg-filter-select`,"aria-label":`条件の演算子`,children:u.NUMBER_FILTER_OPERATOR_OPTIONS.map(e=>(0,a.jsx)(`option`,{value:e.value,children:e.label},e.value))}),i>0?(0,a.jsxs)(`div`,{className:`ssg-filter-cond-values`,children:[(0,a.jsx)(`input`,{ref:t,type:`text`,inputMode:`decimal`,value:e.value1,onChange:t=>b(n,{...e,value1:t.target.value},t),onCompositionEnd:t=>n({...e,value1:t.currentTarget.value}),onKeyDown:r,placeholder:i===2?`下限`:`値`,className:`ssg-filter-input`,"aria-label":i===2?`下限`:`条件の値`}),i===2&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{className:`ssg-filter-cond-tilde`,children:`〜`}),(0,a.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:e.value2,onChange:t=>b(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,a.jsx)(`div`,{className:`ssg-filter-meta`,children:`この演算子は値入力を使いません`})]})}function S({draft:e,valueInputRef:t,onDraftChange:n,onKeyDown:r}){let i=(0,d.textFilterOperandCount)(e.operator);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`select`,{value:e.operator,onChange:t=>n({...e,operator:t.target.value}),onKeyDown:r,className:`ssg-filter-select`,"aria-label":`条件の演算子`,children:d.TEXT_FILTER_OPERATOR_OPTIONS.map(e=>(0,a.jsx)(`option`,{value:e.value,children:e.label},e.value))}),i>0?(0,a.jsx)(`div`,{className:`ssg-filter-cond-values`,children:(0,a.jsx)(`input`,{ref:t,type:`text`,value:e.value,onChange:t=>b(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,a.jsx)(`div`,{className:`ssg-filter-meta`,children:`この演算子は値入力を使いません`})]})}function C({draft:e,valueInputRef:t,onDraftChange:r,onKeyDown:i,presets:o,renderDateInput:s,onRequestClose:c}){let l=e.preset===null?(0,f.dateFilterOperandCount)(e.operator):0,u=(t,n)=>{r({...e,[t]:(0,f.normalizeFilterDateInputValue)(n),preset:null})};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`select`,{value:e.operator,onChange:t=>r({...e,operator:t.target.value,preset:null}),onKeyDown:i,className:`ssg-filter-select`,"aria-label":`条件の演算子`,children:f.DATE_FILTER_OPERATOR_OPTIONS.map(e=>(0,a.jsx)(`option`,{value:e.value,children:e.label},e.value))}),l>0?(0,a.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,a.jsx)(h,{value:e.value1,onCommit:t=>r({...e,value1:t,preset:null}),ariaLabel:l===2?`開始日`:`条件の日付`,inputRef:t,onRequestClose:c}),l===2&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{className:`ssg-filter-cond-tilde`,children:`〜`}),s?s({value:e.value2,onChange:e=>u(`value2`,e),ariaLabel:`終了日`,slot:`to`}):(0,a.jsx)(h,{value:e.value2,onCommit:t=>r({...e,value2:t,preset:null}),ariaLabel:`終了日`,onRequestClose:c,align:`right`})]})]}):e.preset===null?(0,a.jsx)(`div`,{className:`ssg-filter-meta`,children:`この演算子は値入力を使いません`}):null,o.length>0&&(0,a.jsx)(`div`,{className:`ssg-filter-presets`,children:o.map(t=>(0,a.jsx)(`button`,{type:`button`,onPointerDown:n=>{n.preventDefault(),n.stopPropagation(),r({...e,preset:e.preset===t.id?null:t.id})},onKeyDown:n=>{v(n),(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 w({options:n,setSelection:r,searchInputRef:o,onValueToggle:s,onSelectAllChange:u,onReplaceSelection:d,onRequestClose:f,isServerSide:p,truncated:h=!1}){let[_,y]=(0,t.useState)(``),b=(0,t.useDeferredValue)(_),[x,S]=(0,t.useState)(()=>new Set),C=b.trim().length>0,w=(0,t.useMemo)(()=>(0,c.filterSetOptionsBySearch)(n,b),[n,b]),T=(0,t.useMemo)(()=>(0,m.buildDateTreeRows)(n,x),[n,x]),D=(0,t.useRef)(null),O=C?w.length:T.length,k=e.t({count:O,getScrollElement:()=>D.current,estimateSize:()=>g,overscan:10}),A=(0,t.useMemo)(()=>(C?w:n).map(e=>e.value),[C,w,n]),j=(0,t.useMemo)(()=>{let e=0;for(let t of A)(0,l.isSetValueSelected)(r,t)&&(e+=1);return e},[A,r]),M=A.length>0&&j===A.length,N=j>0&&!M,P=(0,t.useMemo)(()=>new Set(n.map(e=>e.value)),[n]),F=(0,t.useMemo)(()=>{if(r===null)return n.length;let e=0;for(let t of r.values)P.has(t)&&(e+=1);return r.mode===`include`?e:n.length-e},[r,P,n.length]),I=e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},L=e=>{let t=0;for(let n of e)(0,l.isSetValueSelected)(r,n)&&(t+=1);return t},R=e=>{let t=L(e.leafKeys),n=e.leafKeys.length>0&&t===e.leafKeys.length,r=t>0&&!n;return(0,a.jsxs)(a.Fragment,{children:[e.type===`group`?(0,a.jsx)(`button`,{type:`button`,onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),I(e.key)},onKeyDown:t=>{v(t),(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),I(e.key))},className:`ssg-filter-tree-toggle`,"aria-label":e.expanded?`折りたたむ`:`展開する`,children:e.expanded?`▾`:`▸`}):(0,a.jsx)(`span`,{className:`ssg-filter-tree-toggle ssg-filter-tree-toggle--placeholder`}),(0,a.jsx)(`input`,{type:`checkbox`,checked:n,ref:e=>{e&&(e.indeterminate=r)},onChange:()=>{if(e.type===`leaf`){s(e.key);return}u(e.leafKeys,!n)}}),(0,a.jsx)(`span`,{className:`ssg-filter-option-label`,children:e.label})]})};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`input`,{ref:o,type:`text`,value:_,onChange:e=>y(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),f()),e.key===`Enter`){if((0,i.isImeComposingKeyEvent)(e.nativeEvent))return;e.preventDefault();let t=(0,c.resolveSetFilterEnterAction)(n,_);if(t.kind===`none`)return;t.kind===`replace`&&d(t.values),f()}},placeholder:`検索(Enter で確定)`,className:`ssg-filter-input`}),(0,a.jsxs)(`label`,{className:`ssg-filter-selectall`,children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:M,ref:e=>{e&&(e.indeterminate=N)},onChange:()=>u(A,!M)}),(0,a.jsx)(`span`,{className:`ssg-filter-selectall-label`,children:C?`(検索結果をすべて選択)`:`(すべて選択)`})]}),(0,a.jsx)(`div`,{ref:D,className:`ssg-filter-list`,children:O===0?(0,a.jsx)(`div`,{className:`ssg-filter-empty`,children:n.length===0?p?`候補が未指定です(serverSide では列に filterOptions などの候補供給が必要)`:`候補がありません`:`一致する候補がありません`}):(0,a.jsx)(`div`,{className:`ssg-filter-virt`,style:{height:k.getTotalSize()},children:k.getVirtualItems().map(e=>{if(C){let t=w[e.index];return t?(0,a.jsxs)(`label`,{className:`ssg-filter-option`,style:{transform:`translateY(${e.start}px)`,height:e.size},children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:(0,l.isSetValueSelected)(r,t.value),onChange:()=>s(t.value)}),(0,a.jsx)(`span`,{className:`ssg-filter-option-label`,children:t.label})]},t.value):null}let t=T[e.index];return t?(0,a.jsx)(`div`,{className:`ssg-filter-option`,style:{transform:`translateY(${e.start}px)`,height:e.size,paddingLeft:8+t.depth*16},children:R(t)},t.key):null})})}),(0,a.jsxs)(`div`,{className:`ssg-filter-meta`,children:[`選択中: `,F,` / `,n.length,` 件`,C?`(表示中 ${w.length} 件)`:``,h&&(0,a.jsx)(E,{})]})]})}function T({status:e,errorMessage:t,onRetry:n}){return e===`loading`?(0,a.jsx)(`div`,{className:`ssg-filter-collecting`,children:`候補を取得中…`}):(0,a.jsxs)(`div`,{className:`ssg-filter-error`,role:`alert`,children:[(0,a.jsx)(`div`,{children:`候補の取得に失敗しました`}),t?(0,a.jsx)(`div`,{className:`ssg-filter-error-detail`,title:t,children:t}):null,n?(0,a.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),n()},onKeyDown:e=>{v(e),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:`ssg-filter-btn-secondary`,children:`再試行`}):null]})}function E(){return(0,a.jsx)(`span`,{className:`ssg-filter-truncated`,children:`(先頭のみ・打ち切り)`})}function D({conditionEditor:e,conditionActive:t,onConditionClear:n,options:r,setSelection:i,onSelectionClear:o,summaryText:s,children:c,optionsMeta:l}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`div`,{className:`ssg-filter-sec-head`,children:[(0,a.jsx)(`span`,{className:`ssg-filter-sec-label`,children:`条件`}),(0,a.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),n()},onKeyDown:e=>{v(e),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:`ssg-filter-sec-clear`,disabled:!t,children:`クリア`})]}),e,(0,a.jsx)(`div`,{className:`ssg-filter-sep`}),(0,a.jsxs)(`div`,{className:`ssg-filter-sec-head`,children:[(0,a.jsx)(`span`,{className:`ssg-filter-sec-label`,children:`値`}),(0,a.jsx)(`span`,{className:`ssg-filter-sec-meta`,children:l??(t?`一致 ${r.length} 件`:`全 ${r.length} 件`)}),(0,a.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),o()},onKeyDown:e=>{v(e),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},className:`ssg-filter-sec-clear`,disabled:i===null,children:`クリア`})]}),c,(0,a.jsxs)(`div`,{className:`ssg-filter-summary`,children:[`🔽 `,s]})]})}function O({isOpen:e,themeClassName:o,popoverSlot:c,title:l,filterType:p,draftValue:m,numberConditionDraft:h,onNumberConditionDraftChange:g,textConditionDraft:y,onTextConditionDraftChange:b,dateConditionDraft:O,onDateConditionDraftChange:k,datePresets:A,renderDateInput:j,onComboConditionClear:M,onComboSelectionClear:N,comboSummaryText:P,currentValueText:F,layout:I,selectOptions:L,optionsStatus:R,optionsProgress:ee,optionsTruncated:z=!1,optionsErrorMessage:te,onOptionsRetry:ne,setSelection:B,popoverRef:re,textInputRef:V,selectRef:ie,onRequestClose:H,onDraftChange:ae,onApply:U,onClear:oe,onSetValueToggle:W,onSetSelectAllChange:G,onSetClear:se,onSetReplaceSelection:K,isServerSide:q=!1}){let ce=(0,t.useRef)(null),[le]=(0,t.useState)(()=>new Date);if(typeof document>`u`||!e||!I)return null;let ue={top:I.top,left:I.left,width:I.width,maxHeight:I.maxHeight},de=e=>{e.stopPropagation(),e.key===`Escape`&&!e.defaultPrevented&&!(0,i.isImeComposingKeyEvent)(e.nativeEvent)&&(e.preventDefault(),H())},fe=e=>{e.stopPropagation()},pe=p===`set`,J=p===`numberSet`,Y=p===`textSet`,X=p===`dateSet`,me=J||Y||X,Z=pe||me,he=R===`loading`||R===`error`,ge=h??u.DEFAULT_NUMBER_FILTER_DRAFT,_e=y??d.DEFAULT_TEXT_FILTER_DRAFT,ve=O??f.DEFAULT_DATE_FILTER_DRAFT,ye=A??(0,s.normalizeDateFilterPresets)(void 0),be=J?(0,u.buildParsedNumberFilterFromDraft)(ge):null,xe=Y?(0,d.buildParsedTextFilterFromDraft)(_e):null,Se=X?(0,f.buildParsedDateFilterFromDraft)(ve):null,Ce=be!==null||xe!==null||Se!==null,Q=J?(0,u.filterOptionsByNumberCondition)(L,be):Y?(0,d.filterOptionsByTextCondition)(L,xe):X?(0,f.filterOptionsByDateCondition)(L,Se,le,ye):L,$=e=>{if(e.stopPropagation(),!(0,i.isImeComposingKeyEvent)(e.nativeEvent)){if(e.key===`Enter`){e.preventDefault(),U();return}e.key===`Escape`&&(e.preventDefault(),H())}},we=J?(0,a.jsx)(x,{draft:ge,valueInputRef:V,onDraftChange:g,onKeyDown:$}):Y?(0,a.jsx)(S,{draft:_e,valueInputRef:V,onDraftChange:b,onKeyDown:$}):(0,a.jsx)(C,{draft:ve,valueInputRef:V,onDraftChange:k,onKeyDown:$,presets:ye,renderDateInput:j,onRequestClose:H});return(0,r.createPortal)((0,a.jsxs)(`div`,{ref:re,onPointerDown:fe,onKeyDown:de,onPasteCapture:e=>{e.stopPropagation()},className:(0,n.cx)(`ssg-filter-popover`,o,c?.className),style:{...c?.style,...ue},children:[(0,a.jsxs)(`div`,{className:`ssg-filter-title`,children:[`列フィルター: `,l]}),(Z||p===`select`)&&R===`collecting`?(0,a.jsxs)(`div`,{className:`ssg-filter-collecting`,children:[`候補を収集中… `,Math.round(ee*100),`%`]}):(Z||p===`select`)&&he?me?(0,a.jsx)(D,{conditionEditor:we,conditionActive:Ce,onConditionClear:M,options:Q,setSelection:B,onSelectionClear:N,summaryText:P,optionsMeta:R===`loading`?`取得中…`:`取得失敗`,children:(0,a.jsx)(T,{status:R===`loading`?`loading`:`error`,errorMessage:te,onRetry:ne})}):(0,a.jsx)(T,{status:R===`loading`?`loading`:`error`,errorMessage:te,onRetry:ne}):me?(0,a.jsx)(D,{conditionEditor:we,conditionActive:Ce,onConditionClear:M,options:Q,setSelection:B,onSelectionClear:N,summaryText:P,children:X?(0,a.jsx)(w,{options:Q,setSelection:B,searchInputRef:ce,onValueToggle:W,onSelectAllChange:G,onReplaceSelection:K,onRequestClose:H,isServerSide:q,truncated:z}):(0,a.jsx)(_,{options:Q,setSelection:B,searchInputRef:ce,onValueToggle:W,onSelectAllChange:G,onReplaceSelection:K,onRequestClose:H,isServerSide:q,selectAllUsesExplicitScope:!0,truncated:z})}):pe?(0,a.jsx)(_,{options:L,setSelection:B,searchInputRef:V,onValueToggle:W,onSelectAllChange:G,onReplaceSelection:K,onRequestClose:H,isServerSide:q,truncated:z}):p===`number`?(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(x,{draft:ge,valueInputRef:V,onDraftChange:g,onKeyDown:$})}):p===`select`?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`select`,{ref:ie,value:m,onChange:e=>ae(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Enter`){e.preventDefault(),U();return}e.key===`Escape`&&(e.preventDefault(),H())},className:`ssg-filter-select`,children:[(0,a.jsx)(`option`,{value:``,children:`(すべて)`}),L.map(e=>(0,a.jsx)(`option`,{value:e.value,children:e.label},`${l}-${e.value}`))]}),(0,a.jsxs)(`div`,{className:`ssg-filter-meta`,children:[`候補数: `,L.length,z&&(0,a.jsx)(E,{})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`input`,{ref:V,type:`text`,value:m,onChange:e=>ae(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),!(0,i.isImeComposingKeyEvent)(e.nativeEvent)){if(e.key===`Enter`){e.preventDefault(),U();return}e.key===`Escape`&&(e.preventDefault(),H())}},placeholder:`部分一致で絞り込み`,className:`ssg-filter-input`}),(0,a.jsx)(`div`,{className:`ssg-filter-meta ssg-filter-meta--ellipsis`,children:`部分一致検索です`})]}),!Z&&(0,a.jsxs)(`div`,{className:`ssg-filter-meta ssg-filter-meta--ellipsis`,children:[`現在値: `,F]}),(0,a.jsx)(`div`,{className:`ssg-filter-footer`,children:Z?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),se()},onKeyDown:e=>{v(e),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),se())},className:`ssg-filter-btn-secondary`,children:`クリア`}),(0,a.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),H()},onKeyDown:e=>{v(e),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),H())},className:`ssg-filter-btn-primary`,children:`閉じる`})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),oe()},onKeyDown:e=>{v(e),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),oe())},className:`ssg-filter-btn-secondary`,children:`クリア`}),(0,a.jsx)(`button`,{type:`button`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),U()},onKeyDown:e=>{v(e),(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),U())},className:`ssg-filter-btn-primary`,children:`適用`})]})})]}),document.body)}exports.ColumnFilterPopover=O,exports.default=O;
|
package/dist/ai/useGridAsk.d.ts
CHANGED
|
@@ -45,8 +45,11 @@ export type UseGridAskOptions<T> = {
|
|
|
45
45
|
};
|
|
46
46
|
/** 最後の頼みの結果です。 */
|
|
47
47
|
export type GridAskSession = {
|
|
48
|
-
/**
|
|
49
|
-
|
|
48
|
+
/**
|
|
49
|
+
* applied = 反映した / unchanged = 変える条件が無かった / undone = 元に戻した /
|
|
50
|
+
* changed = 反映したあと表が手で変わった(チップは古いので、外す・元に戻すはできない。notice にも知らせが入る)。
|
|
51
|
+
*/
|
|
52
|
+
phase: 'applied' | 'unchanged' | 'undone' | 'changed';
|
|
50
53
|
text: string;
|
|
51
54
|
/** 反映した状態の見え方(チップ)。 */
|
|
52
55
|
items: GridAskItem[];
|
|
@@ -62,8 +65,11 @@ export type UseGridAskResult = {
|
|
|
62
65
|
/** 元に戻せなかったときなどの知らせ。 */
|
|
63
66
|
notice: string | null;
|
|
64
67
|
session: GridAskSession | null;
|
|
65
|
-
/**
|
|
66
|
-
|
|
68
|
+
/**
|
|
69
|
+
* 文を AI に聞いて反映する。聞いている間は何もしない。答えを読めたら(反映した / 変える条件が無かった)true、
|
|
70
|
+
* 失敗・止めた・聞かなかったときは false で終わる(送ったあとに入力欄を空にするかの判断に使える)。
|
|
71
|
+
*/
|
|
72
|
+
submit: (text: string) => Promise<boolean>;
|
|
67
73
|
/** 聞いているのを止める。 */
|
|
68
74
|
cancel: () => void;
|
|
69
75
|
/** 反映した条件を元に戻す(表を手で変えたあとは戻さず notice を出す)。 */
|
package/dist/ai.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react/jsx-runtime"),n=require("@ishibashi0112/spreadsheet-grid-core/internal/controllers/systemColorSchemeStore"),r=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/theme"),i=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/gridAsk");var a=`AI に聞けませんでした。もう一度試してください。`,o=`表が見つかりませんでした。表が出てから、もう一度試してください。`,s=`表の条件が変わったので、ここからは変えられません。表のフィルターや並びで直してください。`,c=e=>({columns:e.columns,columnHints:e.columnHints,allowFilter:e.allowFilter,allowSort:e.allowSort,allowSearch:e.allowSearch,allowColumnVisibility:e.allowColumnVisibility}),l=(e,t)=>(0,i.isGridAskColumnsChanged)(e,t)?t:{...t,columns:void 0},u=(e,t,n)=>{if(!n)return{...e,filters:t.filters,sort:t.sort};let r=new Set((t.columns??[]).filter(e=>e.visible===!1).map(e=>e.key));return{...e,filters:t.filters,sort:t.sort,columns:e.columns?.map(e=>{if(r.has(e.key))return{...e,visible:!1};let t={...e};return delete t.visible,t})}};function d(t){let[n,r]=(0,e.useState)(`idle`),[d,f]=(0,e.useState)(null),[p,m]=(0,e.useState)(null),[h,g]=(0,e.useState)(null),_=(0,e.useRef)(null),v=(0,e.useRef)(t);(0,e.useEffect)(()=>{v.current=t}),(0,e.useEffect)(()=>()=>{let e=_.current;e!==null&&(_.current=null,e.abort(),r(`idle`))},[]);let y=c(t),b=e=>(0,i.describeGridAskView)(e,y),x=async e=>{let n=e.trim();if(n===``||_.current!==null)return;let s=t.grid.current;if(s===null){f(o);return}let u=new AbortController;_.current=u,r(`asking`),f(null),m(null);let d;try{d=await t.ask((0,i.createGridAskRequest)(n,s.getState(),y),{signal:u.signal})}catch(e){if(u.signal.aborted)return;_.current=null,r(`idle`),v.current.onError?.(e),f(a);return}if(u.signal.aborted)return;_.current=null,r(`idle`);let p=v.current,h=c(p),b=p.grid.current;if(b===null){f(o);return}let x=b.getState(),S=(0,i.readGridAskAnswer)(d,x,h);if(!S.ok){f(S.message);return}let C={text:n,dropped:S.dropped,unsupported:S.unsupported};if(!S.changed){g({view:{...C,phase:`unchanged`,items:(0,i.describeGridAskView)(x,h)},before:x,applied:x});return}b.applyState(l(x,S.state)),g({view:{...C,phase:`applied`,items:(0,i.describeGridAskView)(S.state,h)},before:x,applied:S.state}),p.onApply?.({text:n,state:S.state,dropped:S.dropped,unsupported:S.unsupported})},S=()=>{let e=_.current;e!==null&&(_.current=null,e.abort(),r(`idle`))},C=t.allowColumnVisibility??!1,w=e=>{let n=t.grid.current;if(n===null||e.view.phase!==`applied`)return null;let r=n.getState();return(C?(0,i.isSameGridAskView)(r,e.applied):(0,i.isSameGridAskView)({...r,columns:void 0},{...e.applied,columns:void 0}))?{target:n,now:r}:(m(s),null)};return{status:n,error:d,notice:p,session:h?.view??null,submit:x,cancel:S,undo:()=>{if(h===null)return;let e=w(h);if(e===null)return;let t=u(e.now,h.before,C);e.target.applyState(l(e.now,t)),m(null),g({...h,view:{...h.view,phase:`undone`}})},remove:e=>{if(h===null)return;let t=w(h);if(t===null)return;let n=(0,i.removeGridAskItem)(t.now,e);t.target.applyState(l(t.now,n)),g({...h,applied:n,view:{...h.view,items:b(n)}})},dismiss:()=>{g(null),m(null),f(null)}}}var f=(...e)=>e.filter(Boolean).join(` `);function p({examples:i,placeholder:a=`ことばで絞り込み・並べ替え(例: 今月の分を金額の高い順に)`,label:o=`ことばで絞り込み`,className:s,theme:c=`light`,...l}){let u=d(l),[p,m]=(0,e.useState)(``),h=(0,r.resolveGridTheme)(c,(0,e.useSyncExternalStore)(n.systemColorSchemeStore.subscribe,n.systemColorSchemeStore.getSnapshot,n.systemColorSchemeStore.getServerSnapshot))===`dark`,g=u.status===`asking`,_=u.session,v=u.cancel,[y,b]=(0,e.useState)(``),x=(0,e.useRef)(null),S=(0,e.useRef)(null),C=(0,e.useRef)(null),w=(0,e.useRef)(null);(0,e.useEffect)(()=>{let e=w.current;if(w.current=null,e===null||performance.now()-e.at>1e3)return;let t=document.activeElement;if(t!==null&&t!==document.body)return;let n=C.current?.querySelectorAll(`.ssg-ask-chip-remove`);(e.chip!==null&&n&&n.length>0?n[Math.min(e.chip,n.length-1)]:S.current)?.focus()}),(0,e.useEffect)(()=>{if(!g)return;let e=x.current,t=e?.ownerDocument??document,n=n=>{if(n.key!==`Escape`||n.defaultPrevented||n.isComposing||n.keyCode===229)return;let r=e!==null&&n.composedPath().includes(e),i=t.activeElement;!r&&i!==null&&i!==t.body||(n.preventDefault(),v())};return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[g,v]);let T=(e=null)=>{w.current={chip:e,at:performance.now()}},E=e=>{g||e.trim()===``||(b(e.trim()),u.submit(e))};return(0,t.jsxs)(`div`,{ref:x,className:f(`ssg-ask`,h&&`ssg-theme-dark`,s),"data-ssg-ask":``,children:[(0,t.jsxs)(`form`,{className:`ssg-ask-form`,onSubmit:e=>{e.preventDefault(),E(p)},children:[(0,t.jsx)(`svg`,{className:`ssg-ask-icon`,viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,children:(0,t.jsx)(`path`,{d:`M6 1.5l1.1 3.4L10.5 6 7.1 7.1 6 10.5 4.9 7.1 1.5 6l3.4-1.1L6 1.5zm6 7l.6 1.9 1.9.6-1.9.6-.6 1.9-.6-1.9-1.9-.6 1.9-.6.6-1.9z`,fill:`currentColor`})}),(0,t.jsx)(`input`,{ref:S,className:`ssg-ask-input`,type:`text`,value:p,placeholder:a,"aria-label":o,enterKeyHint:`send`,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.nativeEvent.isComposing||e.keyCode===229)&&e.preventDefault()}}),g?(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-button`,onClick:e=>{e.preventDefault(),!(e.detail>1)&&v()},children:`止める`}):(0,t.jsx)(`button`,{type:`submit`,className:`ssg-ask-button ssg-ask-button--primary`,disabled:p.trim()===``,onClick:e=>{e.detail>1&&e.preventDefault()},children:`聞く`})]}),i&&i.length>0&&(0,t.jsxs)(`div`,{className:`ssg-ask-examples`,children:[(0,t.jsx)(`span`,{className:`ssg-ask-examples-label`,children:`例:`}),i.map((e,n)=>(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-example`,"aria-disabled":g||void 0,title:e,onClick:()=>{g||(m(e),E(e))},children:e},n))]}),(0,t.jsxs)(`div`,{className:`ssg-ask-output`,"aria-live":`polite`,children:[g&&(0,t.jsxs)(`div`,{className:`ssg-ask-status`,children:[(0,t.jsx)(`span`,{className:`ssg-ask-spinner`,"aria-hidden":`true`}),`考えています…`,(0,t.jsx)(`span`,{className:`ssg-ask-hint`,children:`Esc でも止まります`})]}),!g&&u.error!==null&&(0,t.jsxs)(`div`,{className:`ssg-ask-note ssg-ask-note--error`,children:[(0,t.jsx)(`span`,{children:u.error}),y!==``&&(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-link`,onClick:()=>{T(),E(y)},children:`もう一度`})]}),!g&&_!==null&&(0,t.jsxs)(t.Fragment,{children:[_.phase===`applied`&&(0,t.jsxs)(`div`,{className:`ssg-ask-result`,children:[(0,t.jsxs)(`div`,{className:`ssg-ask-result-head`,children:[(0,t.jsx)(`span`,{className:`ssg-ask-result-title`,children:`反映した条件`}),(0,t.jsxs)(`span`,{className:`ssg-ask-result-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-link`,onClick:()=>{T(),u.undo()},children:`元に戻す`}),(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-link`,onClick:()=>{T(),u.dismiss()},children:`閉じる`})]})]}),_.items.length>0?(0,t.jsx)(`ul`,{ref:C,className:`ssg-ask-chips`,children:_.items.map((e,n)=>(0,t.jsxs)(`li`,{className:`ssg-ask-chip`,title:`${e.label}: ${e.text}`,children:[(0,t.jsx)(`span`,{className:`ssg-ask-chip-label`,children:e.label}),(0,t.jsx)(`span`,{className:`ssg-ask-chip-text`,children:e.text}),(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-chip-remove`,"aria-label":`${e.label} ${e.text} を外す`,onClick:()=>{T(n),u.remove(e.id)},children:`×`})]},e.id))}):(0,t.jsx)(`div`,{className:`ssg-ask-empty`,children:`条件はすべて外れています。`})]}),_.phase===`unchanged`&&(0,t.jsxs)(`div`,{className:`ssg-ask-note`,children:[(0,t.jsx)(`span`,{children:`変える条件はありませんでした。`}),(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-link`,onClick:()=>{T(),u.dismiss()},children:`閉じる`})]}),_.phase===`undone`&&(0,t.jsxs)(`div`,{className:`ssg-ask-note`,children:[(0,t.jsx)(`span`,{children:`元に戻しました。`}),(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-link`,onClick:()=>{T(),u.dismiss()},children:`閉じる`})]}),_.phase!==`undone`&&_.dropped.length>0&&(0,t.jsxs)(`div`,{className:`ssg-ask-note ssg-ask-note--warn`,children:[(0,t.jsx)(`span`,{className:`ssg-ask-note-title`,children:`使えなかった部分`}),(0,t.jsx)(`ul`,{className:`ssg-ask-dropped`,children:_.dropped.map((e,n)=>(0,t.jsx)(`li`,{children:e},n))})]}),_.phase!==`undone`&&_.unsupported!==null&&(0,t.jsx)(`div`,{className:`ssg-ask-note`,children:(0,t.jsxs)(`span`,{children:[`AI から: `,_.unsupported]})})]}),u.notice!==null&&(0,t.jsx)(`div`,{className:`ssg-ask-note ssg-ask-note--warn`,children:(0,t.jsx)(`span`,{children:u.notice})})]})]})}exports.GridAskBar=p,Object.defineProperty(exports,"createGridAskRequest",{enumerable:!0,get:function(){return i.createGridAskRequest}}),Object.defineProperty(exports,"describeGridAskView",{enumerable:!0,get:function(){return i.describeGridAskView}}),Object.defineProperty(exports,"gridAskSystemPrompt",{enumerable:!0,get:function(){return i.gridAskSystemPrompt}}),Object.defineProperty(exports,"readGridAskAnswer",{enumerable:!0,get:function(){return i.readGridAskAnswer}}),Object.defineProperty(exports,"removeGridAskItem",{enumerable:!0,get:function(){return i.removeGridAskItem}}),exports.useGridAsk=d;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react/jsx-runtime"),n=require("@ishibashi0112/spreadsheet-grid-core/internal/controllers/systemColorSchemeStore"),r=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/theme"),i=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/gridAsk");var a=`AI に聞けませんでした。もう一度試してください。`,o=`表が見つかりませんでした。表が出てから、もう一度試してください。`,s=`表の条件が変わったので、ここからは変えられません。表のフィルターや並びで直してください。`,c=1e3,l=400,u=(e,t,n)=>n?(0,i.isSameGridAskView)(e,t):(0,i.isSameGridAskView)({...e,columns:void 0},{...t,columns:void 0}),d=e=>({columns:e.columns,columnHints:e.columnHints,allowFilter:e.allowFilter,allowSort:e.allowSort,allowSearch:e.allowSearch,allowColumnVisibility:e.allowColumnVisibility}),f=(e,t)=>(0,i.isGridAskColumnsChanged)(e,t)?t:{...t,columns:void 0},p=(e,t,n)=>{if(!n)return{...e,filters:t.filters,sort:t.sort};let r=new Set((t.columns??[]).filter(e=>e.visible===!1).map(e=>e.key));return{...e,filters:t.filters,sort:t.sort,columns:e.columns?.map(e=>{if(r.has(e.key))return{...e,visible:!1};let t={...e};return delete t.visible,t})}};function m(t){let[n,r]=(0,e.useState)(`idle`),[m,h]=(0,e.useState)(null),[g,_]=(0,e.useState)(null),[v,y]=(0,e.useState)(null),b=(0,e.useRef)(null),x=(0,e.useRef)(t);(0,e.useEffect)(()=>{x.current=t}),(0,e.useEffect)(()=>()=>{let e=b.current;e!==null&&(b.current=null,e.abort(),r(`idle`))},[]);let S=d(t),C=e=>(0,i.describeGridAskView)(e,S),w=t.allowColumnVisibility??!1,T=process.env.NODE_ENV===`production`||!t.columnHints?``:Object.keys(t.columnHints).filter(e=>!t.columns.some(t=>t.key===e)).join(`, `);(0,e.useEffect)(()=>{T!==``&&console.warn(`[spreadsheet-grid] GridAskBar / useGridAsk の columnHints に列に無いキーがあります: ${T}。列の key と同じ名前にしてください(この補足や \`false\` は効いていません)。`)},[T]);let E=v!==null&&v.view.phase===`applied`?v:null;(0,e.useEffect)(()=>{if(E===null)return;let e=null,t=()=>{if(b.current!==null)return;let e=x.current.grid.current;e===null||u(e.getState(),E.applied,w)||(y(e=>e===E?{...e,view:{...e.view,phase:`changed`}}:e),_(s))},n=()=>{e===null&&(e=setTimeout(()=>{e=null,t()},l))},r=setInterval(t,c);return document.addEventListener(`click`,n,!0),document.addEventListener(`keyup`,n,!0),()=>{clearInterval(r),e!==null&&clearTimeout(e),document.removeEventListener(`click`,n,!0),document.removeEventListener(`keyup`,n,!0)}},[E,w]);let D=async e=>{let n=e.trim();if(n===``||b.current!==null)return!1;let s=t.grid.current;if(s===null)return h(o),!1;let c=new AbortController;b.current=c,r(`asking`),h(null),_(null);let l;try{l=await t.ask((0,i.createGridAskRequest)(n,s.getState(),S),{signal:c.signal})}catch(e){return c.signal.aborted?!1:(b.current=null,r(`idle`),x.current.onError?.(e),h(a),!1)}if(c.signal.aborted)return!1;b.current=null,r(`idle`);let u=x.current,p=d(u),m=u.grid.current;if(m===null)return h(o),!1;let g=m.getState(),v=(0,i.readGridAskAnswer)(l,g,p);if(!v.ok)return h(v.message),!1;let C={text:n,dropped:v.dropped,unsupported:v.unsupported};return _(null),v.changed?(m.applyState(f(g,v.state)),y({view:{...C,phase:`applied`,items:(0,i.describeGridAskView)(v.state,p)},before:g,applied:v.state}),u.onApply?.({text:n,state:v.state,dropped:v.dropped,unsupported:v.unsupported}),!0):(y({view:{...C,phase:`unchanged`,items:(0,i.describeGridAskView)(g,p)},before:g,applied:g}),!0)},O=()=>{let e=b.current;e!==null&&(b.current=null,e.abort(),r(`idle`))},k=e=>{let n=t.grid.current;if(n===null||e.view.phase!==`applied`)return null;let r=n.getState();return u(r,e.applied,w)?{target:n,now:r}:(_(s),y({...e,view:{...e.view,phase:`changed`}}),null)};return{status:n,error:m,notice:g,session:v?.view??null,submit:D,cancel:O,undo:()=>{if(v===null)return;let e=k(v);if(e===null)return;let t=p(e.now,v.before,w);e.target.applyState(f(e.now,t)),_(null),y({...v,view:{...v.view,phase:`undone`}})},remove:e=>{if(v===null)return;let t=k(v);if(t===null)return;let n=(0,i.removeGridAskItem)(t.now,e);t.target.applyState(f(t.now,n)),y({...v,applied:n,view:{...v.view,items:C(n)}})},dismiss:()=>{y(null),_(null),h(null)}}}var h=(...e)=>e.filter(Boolean).join(` `);function g({examples:i,placeholder:a=`ことばで絞り込み・並べ替え(例: 今月の分を金額の高い順に)`,label:o=`ことばで絞り込み`,className:s,theme:c=`light`,...l}){let u=m(l),[d,f]=(0,e.useState)(``),p=(0,r.resolveGridTheme)(c,(0,e.useSyncExternalStore)(n.systemColorSchemeStore.subscribe,n.systemColorSchemeStore.getSnapshot,n.systemColorSchemeStore.getServerSnapshot))===`dark`,g=u.status===`asking`,_=u.session,v=u.cancel,[y,b]=(0,e.useState)(``),x=(0,e.useRef)(null),S=(0,e.useRef)(null),C=(0,e.useRef)(null),w=(0,e.useRef)(null);(0,e.useEffect)(()=>{let e=w.current;if(w.current=null,e===null||performance.now()-e.at>1e3)return;let t=document.activeElement;if(t!==null&&t!==document.body)return;let n=C.current?.querySelectorAll(`.ssg-ask-chip-remove`);(e.chip!==null&&n&&n.length>0?n[Math.min(e.chip,n.length-1)]:S.current)?.focus()}),(0,e.useEffect)(()=>{if(!g)return;let e=x.current,t=e?.ownerDocument??document,n=n=>{if(n.key!==`Escape`||n.defaultPrevented||n.isComposing||n.keyCode===229)return;let r=e!==null&&n.composedPath().includes(e),i=t.activeElement;!r&&i!==null&&i!==t.body||(n.preventDefault(),v())};return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[g,v]);let T=(e=null)=>{w.current={chip:e,at:performance.now()}},E=e=>{if(g||e.trim()===``)return;let t=e.trim();b(t),u.submit(e).then(e=>{e&&f(e=>e.trim()===t?``:e)})};return(0,t.jsxs)(`div`,{ref:x,className:h(`ssg-ask`,p&&`ssg-theme-dark`,s),"data-ssg-ask":``,children:[(0,t.jsxs)(`form`,{className:`ssg-ask-form`,onSubmit:e=>{e.preventDefault(),E(d)},children:[(0,t.jsx)(`svg`,{className:`ssg-ask-icon`,viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,children:(0,t.jsx)(`path`,{d:`M6 1.5l1.1 3.4L10.5 6 7.1 7.1 6 10.5 4.9 7.1 1.5 6l3.4-1.1L6 1.5zm6 7l.6 1.9 1.9.6-1.9.6-.6 1.9-.6-1.9-1.9-.6 1.9-.6.6-1.9z`,fill:`currentColor`})}),(0,t.jsx)(`input`,{ref:S,className:`ssg-ask-input`,type:`text`,value:d,placeholder:a,"aria-label":o,enterKeyHint:`send`,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.nativeEvent.isComposing||e.keyCode===229)&&e.preventDefault()}}),g?(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-button`,onClick:e=>{e.preventDefault(),!(e.detail>1)&&v()},children:`止める`}):(0,t.jsx)(`button`,{type:`submit`,className:`ssg-ask-button ssg-ask-button--primary`,disabled:d.trim()===``,onClick:e=>{e.detail>1&&e.preventDefault()},children:`聞く`})]}),i&&i.length>0&&(0,t.jsxs)(`div`,{className:`ssg-ask-examples`,children:[(0,t.jsx)(`span`,{className:`ssg-ask-examples-label`,children:`例:`}),i.map((e,n)=>(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-example`,"aria-disabled":g||void 0,title:e,onClick:()=>{g||(f(e),E(e))},children:e},n))]}),(0,t.jsxs)(`div`,{className:`ssg-ask-output`,"aria-live":`polite`,children:[g&&(0,t.jsxs)(`div`,{className:`ssg-ask-status`,children:[(0,t.jsx)(`span`,{className:`ssg-ask-spinner`,"aria-hidden":`true`}),`考えています…`,(0,t.jsx)(`span`,{className:`ssg-ask-hint`,children:`Esc でも止まります`})]}),!g&&u.error!==null&&(0,t.jsxs)(`div`,{className:`ssg-ask-note ssg-ask-note--error`,children:[(0,t.jsx)(`span`,{children:u.error}),y!==``&&(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-link`,onClick:()=>{T(),E(y)},children:`もう一度`})]}),!g&&_!==null&&(0,t.jsxs)(t.Fragment,{children:[_.phase===`applied`&&(0,t.jsxs)(`div`,{className:`ssg-ask-result`,children:[(0,t.jsxs)(`div`,{className:`ssg-ask-result-head`,children:[(0,t.jsx)(`span`,{className:`ssg-ask-result-title`,children:`反映した条件`}),(0,t.jsxs)(`span`,{className:`ssg-ask-result-actions`,children:[(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-link`,onClick:()=>{T(),u.undo()},children:`元に戻す`}),(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-link`,onClick:()=>{T(),u.dismiss()},children:`閉じる`})]})]}),_.items.length>0?(0,t.jsx)(`ul`,{ref:C,className:`ssg-ask-chips`,children:_.items.map((e,n)=>(0,t.jsxs)(`li`,{className:`ssg-ask-chip`,title:`${e.label}: ${e.text}`,children:[(0,t.jsx)(`span`,{className:`ssg-ask-chip-label`,children:e.label}),(0,t.jsx)(`span`,{className:`ssg-ask-chip-text`,children:e.text}),(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-chip-remove`,"aria-label":`${e.label} ${e.text} を外す`,onClick:()=>{T(n),u.remove(e.id)},children:`×`})]},e.id))}):(0,t.jsx)(`div`,{className:`ssg-ask-empty`,children:`条件はすべて外れています。`})]}),_.phase===`unchanged`&&(0,t.jsxs)(`div`,{className:`ssg-ask-note`,children:[(0,t.jsx)(`span`,{children:`変える条件はありませんでした。`}),(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-link`,onClick:()=>{T(),u.dismiss()},children:`閉じる`})]}),_.phase===`undone`&&(0,t.jsxs)(`div`,{className:`ssg-ask-note`,children:[(0,t.jsx)(`span`,{children:`元に戻しました。`}),(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-link`,onClick:()=>{T(),u.dismiss()},children:`閉じる`})]}),_.phase!==`undone`&&_.phase!==`changed`&&_.dropped.length>0&&(0,t.jsxs)(`div`,{className:`ssg-ask-note ssg-ask-note--warn`,children:[(0,t.jsx)(`span`,{className:`ssg-ask-note-title`,children:`使えなかった部分`}),(0,t.jsx)(`ul`,{className:`ssg-ask-dropped`,children:_.dropped.map((e,n)=>(0,t.jsx)(`li`,{children:e},n))})]}),_.phase!==`undone`&&_.phase!==`changed`&&_.unsupported!==null&&(0,t.jsx)(`div`,{className:`ssg-ask-note`,children:(0,t.jsxs)(`span`,{children:[`AI から: `,_.unsupported]})})]}),u.notice!==null&&(0,t.jsxs)(`div`,{className:`ssg-ask-note ssg-ask-note--warn`,children:[(0,t.jsx)(`span`,{children:u.notice}),_?.phase===`changed`&&(0,t.jsx)(`button`,{type:`button`,className:`ssg-ask-link`,onClick:()=>{T(),u.dismiss()},children:`閉じる`})]})]})]})}exports.GridAskBar=g,Object.defineProperty(exports,"createGridAskRequest",{enumerable:!0,get:function(){return i.createGridAskRequest}}),Object.defineProperty(exports,"describeGridAskView",{enumerable:!0,get:function(){return i.describeGridAskView}}),Object.defineProperty(exports,"gridAskSystemPrompt",{enumerable:!0,get:function(){return i.gridAskSystemPrompt}}),Object.defineProperty(exports,"isGridAskColumnsChanged",{enumerable:!0,get:function(){return i.isGridAskColumnsChanged}}),Object.defineProperty(exports,"isSameGridAskView",{enumerable:!0,get:function(){return i.isSameGridAskView}}),Object.defineProperty(exports,"readGridAskAnswer",{enumerable:!0,get:function(){return i.readGridAskAnswer}}),Object.defineProperty(exports,"removeGridAskItem",{enumerable:!0,get:function(){return i.removeGridAskItem}}),exports.useGridAsk=m;
|
package/dist/ai.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export { GridAskBar } from './ai/GridAskBar.js';
|
|
|
2
2
|
export type { GridAskBarProps } from './ai/GridAskBar.js';
|
|
3
3
|
export { useGridAsk } from './ai/useGridAsk.js';
|
|
4
4
|
export type { GridAsk, GridAskApplyEvent, GridAskSession, GridAskTarget, UseGridAskOptions, UseGridAskResult, } from './ai/useGridAsk.js';
|
|
5
|
-
export { createGridAskRequest, describeGridAskView, gridAskSystemPrompt, readGridAskAnswer, removeGridAskItem, } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/gridAsk';
|
|
5
|
+
export { createGridAskRequest, describeGridAskView, gridAskSystemPrompt, isGridAskColumnsChanged, isSameGridAskView, readGridAskAnswer, removeGridAskItem, } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/gridAsk';
|
|
6
6
|
export type { GridAskAnswer, GridAskFilter, GridAskItem, GridAskOp, GridAskOptions, GridAskRequest, GridAskResult, GridAskSort, } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/gridAsk';
|