@ishibashi0112/spreadsheet-grid 1.2.0 → 1.3.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.
Files changed (75) hide show
  1. package/API_REFERENCE.md +69 -23
  2. package/README.md +2 -2
  3. package/dist/CellEditorLayer.d.ts +2 -1
  4. package/dist/ColumnFilterPopover-BkvL8LdP.js +1062 -0
  5. package/dist/ColumnFilterPopover-cNVxOkoI.cjs +1 -0
  6. package/dist/editors/CustomCellEditor.d.ts +3 -2
  7. package/dist/editors/DateCellEditor.d.ts +2 -1
  8. package/dist/editors/NumberCellEditor.d.ts +2 -1
  9. package/dist/editors/SelectCellEditor.d.ts +5 -2
  10. package/dist/editors/TextCellEditor.d.ts +2 -1
  11. package/dist/editors/editorKeyBindings.d.ts +3 -20
  12. package/dist/hooks/useGridEditController.d.ts +1 -0
  13. package/dist/hooks/useGridTooltip.d.ts +3 -1
  14. package/dist/index.cjs +6 -7
  15. package/dist/index.js +2490 -2998
  16. package/dist/lite/ColumnFilterPopover-BXsxUZ-l.cjs +1 -0
  17. package/dist/lite/ColumnFilterPopover-DGBKLT_x.js +1063 -0
  18. package/dist/lite/contextMenu-C_EUynb4.cjs +1 -0
  19. package/dist/lite/contextMenu-Cb9KT0FS.js +109 -0
  20. package/dist/lite/createSpreadsheetGrid-CJinhQgY.js +4353 -0
  21. package/dist/lite/createSpreadsheetGrid-CQDpzjaZ.cjs +6 -0
  22. package/dist/lite/createSpreadsheetGrid.cjs +1 -1
  23. package/dist/lite/createSpreadsheetGrid.js +1 -1
  24. package/dist/lite/features/contextMenu.cjs +1 -1
  25. package/dist/lite/features/contextMenu.js +1 -1
  26. package/dist/lite/features/fillHandle.cjs +1 -1
  27. package/dist/lite/features/fillHandle.js +1 -1
  28. package/dist/lite/features/filtering.cjs +1 -1
  29. package/dist/lite/features/filtering.js +1 -1
  30. package/dist/lite/features/rowDrag.cjs +1 -1
  31. package/dist/lite/features/rowDrag.js +1 -1
  32. package/dist/lite/features/scrollHint.cjs +1 -1
  33. package/dist/lite/features/scrollHint.js +1 -1
  34. package/dist/lite/features/standard.cjs +1 -1
  35. package/dist/lite/features/standard.js +2 -2
  36. package/dist/lite/features/toolPanel.cjs +1 -1
  37. package/dist/lite/features/toolPanel.js +1 -1
  38. package/dist/lite/fillHandle-4pow6QTn.cjs +1 -0
  39. package/dist/lite/{fillHandle-CzA_uxgV.js → fillHandle-pS7c7vQ2.js} +30 -29
  40. package/dist/lite/{filtering-CC_aBJ_K.js → filtering-BGPDN-wq.js} +139 -139
  41. package/dist/lite/{filtering-CGAgUfF0.cjs → filtering-BKaFSWIN.cjs} +1 -1
  42. package/dist/lite/{lazyPopups-C7Y7Kx8w.js → lazyPopups-CeNdPYJh.js} +1 -1
  43. package/dist/lite/{lazyPopups-B0DhlAYW.cjs → lazyPopups-Czv43vuQ.cjs} +1 -1
  44. package/dist/lite/rowDrag-Bb1xlVXa.cjs +1 -0
  45. package/dist/lite/rowDrag-Dvg4JlGR.js +115 -0
  46. package/dist/lite/scrollHint-Bt8fuU7l.cjs +1 -0
  47. package/dist/lite/{scrollHint-ENNefJ2y.js → scrollHint-Dr4TOFNn.js} +57 -57
  48. package/dist/lite/{toolPanel-H94h6g2U.cjs → toolPanel-BVq7WR1O.cjs} +1 -1
  49. package/dist/lite/{toolPanel-DXG3w8Zp.js → toolPanel-CsBenuFQ.js} +1 -1
  50. package/dist/lite/toolPanelViews-8HccPGgN.cjs +1 -0
  51. package/dist/lite/{toolPanelViews-DwUa6rm1.js → toolPanelViews-uCxtFwWO.js} +139 -138
  52. package/dist/lite.cjs +1 -1
  53. package/dist/lite.js +8 -8
  54. package/dist/style.css +1 -1
  55. package/dist/style.layer.css +1 -1
  56. package/dist/toolPanelViews-BJi7W0Tz.cjs +1 -0
  57. package/dist/{toolPanelViews-DCpqVIEd.js → toolPanelViews-Dsp5WVVa.js} +139 -138
  58. package/dist/view/DetailToggleButton.d.ts +2 -1
  59. package/dist/view/gridBarHelpers.d.ts +1 -27
  60. package/package.json +2 -2
  61. package/dist/ColumnFilterPopover-BEZ0T7Qo.cjs +0 -1
  62. package/dist/ColumnFilterPopover-CnocXZZn.js +0 -1056
  63. package/dist/editors/editorVisibleBounds.d.ts +0 -10
  64. package/dist/lite/ColumnFilterPopover-BUCdIETo.cjs +0 -1
  65. package/dist/lite/ColumnFilterPopover-ulqfKfmD.js +0 -1056
  66. package/dist/lite/contextMenu-B6cpSlFr.js +0 -168
  67. package/dist/lite/contextMenu-VLz_wVlY.cjs +0 -1
  68. package/dist/lite/createSpreadsheetGrid-BrOy7MJY.cjs +0 -7
  69. package/dist/lite/createSpreadsheetGrid-D-A1zUTb.js +0 -4766
  70. package/dist/lite/fillHandle-CHJESnrk.cjs +0 -1
  71. package/dist/lite/rowDrag-D17wXvSj.cjs +0 -1
  72. package/dist/lite/rowDrag-WVJUKKL8.js +0 -157
  73. package/dist/lite/scrollHint-DFr8vI15.cjs +0 -1
  74. package/dist/lite/toolPanelViews-C4qswcP_.cjs +0 -1
  75. package/dist/toolPanelViews-CKKThiAQ.cjs +0 -1
@@ -6,11 +6,12 @@ import { createPortal as u } from "react-dom";
6
6
  import { isImeComposingKeyEvent as d } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
7
7
  import { formatLocaleText as f } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
8
8
  import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
9
- import { resolveFocusWrapTarget as g } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/focusCycle";
10
- import { createPanelHeaderDragController as _ } from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/panelHeaderDragController";
9
+ import { getActiveElement as g, getDeepActiveElement as _ } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/shadowDom";
10
+ import { resolveFocusWrapTarget as v } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/focusCycle";
11
+ import { createPanelHeaderDragController as y } from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/panelHeaderDragController";
11
12
  //#region src/hooks/usePanelHeaderDrag.ts
12
- var v = ({ layout: e, onPanelMove: t }) => {
13
- let [n] = c(_);
13
+ var b = ({ layout: e, onPanelMove: t }) => {
14
+ let [n] = c(y);
14
15
  return i(() => () => {
15
16
  n.dispose();
16
17
  }, [n]), { handleHeaderPointerDown: r((r) => {
@@ -26,19 +27,19 @@ var v = ({ layout: e, onPanelMove: t }) => {
26
27
  };
27
28
  //#endregion
28
29
  //#region src/view/ToolPanel.tsx
29
- function y({ themeClassName: r, popoverSlot: o, activeTab: c, flashTick: f, tabs: p, layout: _, panelRef: y, onSelectTab: b, onRequestClose: x, onPanelMove: S, children: C }) {
30
- let w = n(), { handleHeaderPointerDown: T } = v({
30
+ function x({ themeClassName: r, popoverSlot: o, activeTab: c, flashTick: f, tabs: p, layout: _, panelRef: y, onSelectTab: x, onRequestClose: S, onPanelMove: C, children: w }) {
31
+ let T = n(), { handleHeaderPointerDown: E } = b({
31
32
  layout: _,
32
- onPanelMove: S
33
- }), E = a();
33
+ onPanelMove: C
34
+ }), D = a();
34
35
  e(y, c !== null && _ !== null, r, { layout: _ });
35
- let D = t(c !== null && _ !== null), O = c !== null && _ !== null, k = s(!1);
36
+ let O = t(c !== null && _ !== null), k = c !== null && _ !== null, A = s(!1);
36
37
  if (i(() => {
37
- let e = O && !k.current;
38
- if (k.current = O, !e) return;
38
+ let e = k && !A.current;
39
+ if (A.current = k, !e) return;
39
40
  let t = y.current;
40
- t === null || t.contains(t.ownerDocument.activeElement) || (t.querySelector("[role=\"tab\"][aria-selected=\"true\"]") ?? t).focus({ preventScroll: !0 });
41
- }, [O, y]), i(() => {
41
+ t === null || t.contains(g(t)) || (t.querySelector("[role=\"tab\"][aria-selected=\"true\"]") ?? t).focus({ preventScroll: !0 });
42
+ }, [k, y]), i(() => {
42
43
  let e = y.current;
43
44
  if (!e || f === 0) return;
44
45
  e.classList.remove("ssg-toolpanel--flash"), e.offsetWidth, e.classList.add("ssg-toolpanel--flash");
@@ -48,47 +49,47 @@ function y({ themeClassName: r, popoverSlot: o, activeTab: c, flashTick: f, tabs
48
49
  return e.addEventListener("animationend", t), () => {
49
50
  e.removeEventListener("animationend", t);
50
51
  };
51
- }, [f, y]), c === null || !_ || !D) return null;
52
- let A = Math.max(0, p.findIndex((e) => e.tab === c)), j = {
52
+ }, [f, y]), c === null || !_ || !O) return null;
53
+ let j = Math.max(0, p.findIndex((e) => e.tab === c)), M = {
53
54
  top: _.top,
54
55
  left: _.left,
55
56
  width: _.width,
56
57
  "--ssg-toolpanel-max-height": `${_.maxHeight}px`
57
- }, M = (e) => {
58
- e.stopPropagation();
59
58
  }, N = (e) => {
60
59
  e.stopPropagation();
61
60
  }, P = (e) => {
61
+ e.stopPropagation();
62
+ }, F = (e) => {
62
63
  if (e.key !== "Tab" || e.altKey || e.ctrlKey || e.metaKey || d(e.nativeEvent)) return;
63
- let t = g(e.currentTarget, e.target instanceof Element ? e.target : null, e.shiftKey);
64
+ let t = v(e.currentTarget, e.target instanceof Element ? e.target : null, e.shiftKey);
64
65
  t !== null && (e.preventDefault(), t.focus());
65
- }, F = {
66
+ }, I = {
66
67
  "--ssg-seg-count": p.length,
67
- "--ssg-seg-index": A
68
+ "--ssg-seg-index": j
68
69
  };
69
70
  return u(/* @__PURE__ */ h("div", {
70
71
  ref: y,
71
- onPointerDown: M,
72
- onKeyDown: N,
73
- onKeyDownCapture: P,
72
+ onPointerDown: N,
73
+ onKeyDown: P,
74
+ onKeyDownCapture: F,
74
75
  onContextMenu: (e) => {
75
76
  e.preventDefault();
76
77
  },
77
78
  role: "dialog",
78
- "aria-label": w.toolPanelLabel,
79
+ "aria-label": T.toolPanelLabel,
79
80
  tabIndex: -1,
80
81
  className: l("ssg-popover", "ssg-toolpanel", r, o?.className),
81
82
  style: {
82
83
  ...o?.style,
83
- ...j
84
+ ...M
84
85
  },
85
86
  children: [/* @__PURE__ */ h("div", {
86
87
  className: "ssg-toolpanel-header ssg-popover-header--draggable",
87
- onPointerDown: T,
88
+ onPointerDown: E,
88
89
  children: [/* @__PURE__ */ h("div", {
89
90
  className: "ssg-toolpanel-seg",
90
91
  role: "tablist",
91
- style: F,
92
+ style: I,
92
93
  children: [/* @__PURE__ */ m("span", {
93
94
  className: "ssg-toolpanel-seg-indicator",
94
95
  "aria-hidden": !0
@@ -97,11 +98,11 @@ function y({ themeClassName: r, popoverSlot: o, activeTab: c, flashTick: f, tabs
97
98
  return /* @__PURE__ */ h("button", {
98
99
  type: "button",
99
100
  role: "tab",
100
- id: `${E}-tab-${e.tab}`,
101
- "aria-controls": t ? `${E}-panel` : void 0,
101
+ id: `${D}-tab-${e.tab}`,
102
+ "aria-controls": t ? `${D}-panel` : void 0,
102
103
  "aria-selected": t,
103
104
  onClick: () => {
104
- t || b(e.tab);
105
+ t || x(e.tab);
105
106
  },
106
107
  className: l("ssg-toolpanel-seg-btn", t && "ssg-toolpanel-seg-btn--active"),
107
108
  children: [e.label, e.badge ? /* @__PURE__ */ m("span", {
@@ -112,23 +113,23 @@ function y({ themeClassName: r, popoverSlot: o, activeTab: c, flashTick: f, tabs
112
113
  })]
113
114
  }), /* @__PURE__ */ m("button", {
114
115
  type: "button",
115
- onClick: x,
116
- "aria-label": w.close,
116
+ onClick: S,
117
+ "aria-label": T.close,
117
118
  className: "ssg-popover-close",
118
119
  children: "×"
119
120
  })]
120
121
  }), /* @__PURE__ */ m("div", {
121
122
  className: "ssg-toolpanel-body",
122
123
  role: "tabpanel",
123
- id: `${E}-panel`,
124
- "aria-labelledby": `${E}-tab-${c}`,
125
- children: C
124
+ id: `${D}-panel`,
125
+ "aria-labelledby": `${D}-tab-${c}`,
126
+ children: w
126
127
  })]
127
- }), D);
128
+ }), O);
128
129
  }
129
130
  //#endregion
130
131
  //#region src/view/FilterManagementPanel.tsx
131
- function b() {
132
+ function S() {
132
133
  return /* @__PURE__ */ m("svg", {
133
134
  width: "11",
134
135
  height: "11",
@@ -139,7 +140,7 @@ function b() {
139
140
  children: /* @__PURE__ */ m("path", { d: "M2 4 L14 4 L9.2 9.2 L9.2 13 L6.8 13 L6.8 9.2 Z" })
140
141
  });
141
142
  }
142
- function x() {
143
+ function C() {
143
144
  return /* @__PURE__ */ h("svg", {
144
145
  width: "11",
145
146
  height: "11",
@@ -156,7 +157,7 @@ function x() {
156
157
  }), /* @__PURE__ */ m("path", { d: "m20 20-3.5-3.5" })]
157
158
  });
158
159
  }
159
- function S({ entries: e, addableColumns: t, showGlobalFilterRow: r, globalFilterText: i, canFilter: a, onEditFilter: o, onAddFilter: s, onClearFilter: c, onClearAllFilters: l, onClearGlobalFilter: u }) {
160
+ function w({ entries: e, addableColumns: t, showGlobalFilterRow: r, globalFilterText: i, canFilter: a, onEditFilter: o, onAddFilter: s, onClearFilter: c, onClearAllFilters: l, onClearGlobalFilter: u }) {
160
161
  let d = n(), g = a && e.length > 0, _ = a && t.length > 0;
161
162
  return /* @__PURE__ */ h(p, { children: [
162
163
  r && /* @__PURE__ */ h("div", {
@@ -165,7 +166,7 @@ function S({ entries: e, addableColumns: t, showGlobalFilterRow: r, globalFilter
165
166
  /* @__PURE__ */ m("span", {
166
167
  className: "ssg-filter-manage-glyph ssg-filter-manage-glyph--global",
167
168
  "aria-hidden": "true",
168
- children: /* @__PURE__ */ m(x, {})
169
+ children: /* @__PURE__ */ m(C, {})
169
170
  }),
170
171
  /* @__PURE__ */ h("span", {
171
172
  className: "ssg-filter-manage-main",
@@ -203,7 +204,7 @@ function S({ entries: e, addableColumns: t, showGlobalFilterRow: r, globalFilter
203
204
  /* @__PURE__ */ m("span", {
204
205
  className: "ssg-filter-manage-glyph",
205
206
  "aria-hidden": "true",
206
- children: /* @__PURE__ */ m(b, {})
207
+ children: /* @__PURE__ */ m(S, {})
207
208
  }),
208
209
  /* @__PURE__ */ h("span", {
209
210
  className: "ssg-filter-manage-main",
@@ -283,16 +284,16 @@ function S({ entries: e, addableColumns: t, showGlobalFilterRow: r, globalFilter
283
284
  }
284
285
  //#endregion
285
286
  //#region src/view/ColumnChooserPanel.tsx
286
- var C = 28, w = 12, T = [
287
+ var T = 28, E = 12, D = [
287
288
  "left",
288
289
  "center",
289
290
  "right"
290
- ], E = {
291
+ ], O = {
291
292
  left: "columnsPinnedLeft",
292
293
  center: "columnsUnpinned",
293
294
  right: "columnsPinnedRight"
294
295
  };
295
- function D(e, t, n) {
296
+ function k(e, t, n) {
296
297
  let r = e.find((e) => e.key === t);
297
298
  if (!r) return null;
298
299
  let i = r.pane, a = {
@@ -312,7 +313,7 @@ function D(e, t, n) {
312
313
  ...a.right
313
314
  ];
314
315
  }
315
- function O({ state: e, disabled: t }) {
316
+ function A({ state: e, disabled: t }) {
316
317
  return /* @__PURE__ */ h("span", {
317
318
  className: l("ssg-checkbox", (e === "checked" || e === "indeterminate") && "ssg-checkbox--filled", t && "ssg-checkbox--disabled"),
318
319
  "aria-hidden": !0,
@@ -331,7 +332,7 @@ function O({ state: e, disabled: t }) {
331
332
  }), e === "indeterminate" && /* @__PURE__ */ m("span", { className: "ssg-checkbox-dash" })]
332
333
  });
333
334
  }
334
- function k({ disabled: e }) {
335
+ function j({ disabled: e }) {
335
336
  return /* @__PURE__ */ m("svg", {
336
337
  width: "10",
337
338
  height: "16",
@@ -349,34 +350,34 @@ function k({ disabled: e }) {
349
350
  }, `${t}-${e}`)))
350
351
  });
351
352
  }
352
- function A({ items: e, canToggle: t, onToggleColumnVisibility: a, onShowAllColumns: u, onHideAllColumns: d, onResetColumns: g, onReorderColumns: _ }) {
353
- let v = n(), [y, b] = c(""), x = s(null), [S] = c(() => typeof document < "u" && document.activeElement?.closest(".ssg-toolpanel") != null);
353
+ function M({ items: e, canToggle: t, onToggleColumnVisibility: a, onShowAllColumns: u, onHideAllColumns: d, onResetColumns: g, onReorderColumns: v }) {
354
+ let y = n(), [b, x] = c(""), S = s(null), [C] = c(() => typeof document < "u" && _()?.closest(".ssg-toolpanel") != null);
354
355
  i(() => {
355
- let e = x.current;
356
- if (!e || !S || typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches) return;
356
+ let e = S.current;
357
+ if (!e || !C || typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches) return;
357
358
  let t = requestAnimationFrame(() => {
358
359
  e.focus();
359
360
  });
360
361
  return () => cancelAnimationFrame(t);
361
- }, [S]);
362
- let A = o(() => e.filter((e) => e.grouped !== !0).length, [e]), j = o(() => e.filter((e) => e.visible && e.grouped !== !0).length, [e]), M = j === A && A > 0, N = M ? "checked" : "indeterminate", P = M ? v.columnsHideAll : v.columnsShowAll, F = o(() => {
363
- let t = y.trim().toLowerCase();
362
+ }, [C]);
363
+ let w = o(() => e.filter((e) => e.grouped !== !0).length, [e]), M = o(() => e.filter((e) => e.visible && e.grouped !== !0).length, [e]), N = M === w && w > 0, P = N ? "checked" : "indeterminate", F = N ? y.columnsHideAll : y.columnsShowAll, I = o(() => {
364
+ let t = b.trim().toLowerCase();
364
365
  return t ? e.filter((e) => e.title.toLowerCase().includes(t)) : e;
365
- }, [e, y]), I = o(() => {
366
+ }, [e, b]), L = o(() => {
366
367
  let e = {
367
368
  left: [],
368
369
  center: [],
369
370
  right: []
370
371
  };
371
- for (let t of F) e[t.pane].push(t);
372
- return T.map((t) => ({
372
+ for (let t of I) e[t.pane].push(t);
373
+ return D.map((t) => ({
373
374
  pane: t,
374
375
  items: e[t]
375
376
  })).filter((e) => e.items.length > 0);
376
- }, [F]), L = I.length >= 2, R = t && y.trim() === "", z = s(null), [B, V] = c(null), H = s(!1), U = s(null), [W, G] = c(null), K = s(0), q = s(null), J = r(() => {
377
- let e = z.current, t = U.current;
377
+ }, [I]), R = L.length >= 2, z = t && b.trim() === "", B = s(null), [V, H] = c(null), U = s(!1), W = s(null), [G, K] = c(null), q = s(0), J = s(null), Y = r(() => {
378
+ let e = B.current, t = W.current;
378
379
  if (!e || !t) return;
379
- let n = e.querySelectorAll(`[data-chooser-row][data-chooser-pane="${t}"]`), r = K.current, i = n.length;
380
+ let n = e.querySelectorAll(`[data-chooser-row][data-chooser-pane="${t}"]`), r = q.current, i = n.length;
380
381
  for (let e = 0; e < n.length; e += 1) {
381
382
  let t = n[e].getBoundingClientRect();
382
383
  if (r < t.top + t.height / 2) {
@@ -384,80 +385,80 @@ function A({ items: e, canToggle: t, onToggleColumnVisibility: a, onShowAllColum
384
385
  break;
385
386
  }
386
387
  }
387
- G(i);
388
- }, []), Y = r(function e() {
389
- let t = z.current;
390
- if (!t || !H.current) {
391
- q.current = null;
388
+ K(i);
389
+ }, []), X = r(function e() {
390
+ let t = B.current;
391
+ if (!t || !U.current) {
392
+ J.current = null;
392
393
  return;
393
394
  }
394
- let n = t.getBoundingClientRect(), r = K.current, i = 0;
395
- if (r < n.top + C ? i = -12 : r > n.bottom - C && (i = w), i !== 0) {
395
+ let n = t.getBoundingClientRect(), r = q.current, i = 0;
396
+ if (r < n.top + T ? i = -12 : r > n.bottom - T && (i = E), i !== 0) {
396
397
  let e = t.scrollTop;
397
- t.scrollTop += i, t.scrollTop !== e && J();
398
+ t.scrollTop += i, t.scrollTop !== e && Y();
398
399
  }
399
- q.current = requestAnimationFrame(e);
400
- }, [J]), X = r((t) => {
401
- q.current !== null && (cancelAnimationFrame(q.current), q.current = null);
402
- let n = B, r = W;
403
- if (H.current = !1, U.current = null, V(null), G(null), t && n !== null && r !== null) {
404
- let t = D(e, n, r);
405
- t && _(t);
400
+ J.current = requestAnimationFrame(e);
401
+ }, [Y]), Z = r((t) => {
402
+ J.current !== null && (cancelAnimationFrame(J.current), J.current = null);
403
+ let n = V, r = G;
404
+ if (U.current = !1, W.current = null, H(null), K(null), t && n !== null && r !== null) {
405
+ let t = k(e, n, r);
406
+ t && v(t);
406
407
  }
407
408
  }, [
408
- B,
409
- W,
409
+ V,
410
+ G,
410
411
  e,
411
- _
412
- ]), Z = r((e, t, n) => {
413
- R && (n.preventDefault(), n.stopPropagation(), n.currentTarget.setPointerCapture(n.pointerId), H.current = !0, U.current = t, K.current = n.clientY, V(e), J(), q.current === null && (q.current = requestAnimationFrame(Y)));
412
+ v
413
+ ]), Q = r((e, t, n) => {
414
+ z && (n.preventDefault(), n.stopPropagation(), n.currentTarget.setPointerCapture(n.pointerId), U.current = !0, W.current = t, q.current = n.clientY, H(e), Y(), J.current === null && (J.current = requestAnimationFrame(X)));
414
415
  }, [
415
- R,
416
- J,
417
- Y
418
- ]), Q = r((e) => {
419
- H.current && (K.current = e.clientY, J());
420
- }, [J]), ee = r(() => {
421
- H.current && X(!0);
422
- }, [X]), te = r(() => {
423
- H.current && X(!1);
424
- }, [X]);
416
+ z,
417
+ Y,
418
+ X
419
+ ]), ee = r((e) => {
420
+ U.current && (q.current = e.clientY, Y());
421
+ }, [Y]), te = r(() => {
422
+ U.current && Z(!0);
423
+ }, [Z]), ne = r(() => {
424
+ U.current && Z(!1);
425
+ }, [Z]);
425
426
  i(() => () => {
426
- q.current !== null && (cancelAnimationFrame(q.current), q.current = null);
427
+ J.current !== null && (cancelAnimationFrame(J.current), J.current = null);
427
428
  }, []);
428
- let ne = () => {
429
- t && (M ? d() : u());
430
- }, $ = B === null ? null : e.find((e) => e.key === B)?.pane ?? null, re = (e, n, r) => {
431
- let i = e.visible && j === 1, o = !t || i || e.grouped === !0, s = B === e.key;
429
+ let re = () => {
430
+ t && (N ? d() : u());
431
+ }, $ = V === null ? null : e.find((e) => e.key === V)?.pane ?? null, ie = (e, n, r) => {
432
+ let i = e.visible && M === 1, o = !t || i || e.grouped === !0, s = V === e.key;
432
433
  return /* @__PURE__ */ h("div", {
433
434
  "data-chooser-row": "",
434
435
  "data-chooser-pane": r,
435
- className: l("ssg-chooser-row", B !== null && $ === r && W === n && "ssg-chooser-row--drop-before", s && "ssg-chooser-row--dragging"),
436
+ className: l("ssg-chooser-row", V !== null && $ === r && G === n && "ssg-chooser-row--drop-before", s && "ssg-chooser-row--dragging"),
436
437
  children: [/* @__PURE__ */ m("span", {
437
438
  role: "button",
438
- "aria-label": v.columnsDragToReorder,
439
- "data-ssg-tooltip": t ? y.trim() === "" ? v.columnsDragWithinSection : v.columnsReorderWhileSearching : v.columnsReorderUnavailable,
440
- onPointerDown: (t) => Z(e.key, r, t),
441
- onPointerMove: Q,
442
- onPointerUp: ee,
443
- onPointerCancel: te,
444
- className: l("ssg-chooser-handle", !R && "ssg-chooser-handle--disabled", s && "ssg-chooser-handle--dragging"),
445
- children: /* @__PURE__ */ m(k, { disabled: !R })
439
+ "aria-label": y.columnsDragToReorder,
440
+ "data-ssg-tooltip": t ? b.trim() === "" ? y.columnsDragWithinSection : y.columnsReorderWhileSearching : y.columnsReorderUnavailable,
441
+ onPointerDown: (t) => Q(e.key, r, t),
442
+ onPointerMove: ee,
443
+ onPointerUp: te,
444
+ onPointerCancel: ne,
445
+ className: l("ssg-chooser-handle", !z && "ssg-chooser-handle--disabled", s && "ssg-chooser-handle--dragging"),
446
+ children: /* @__PURE__ */ m(j, { disabled: !z })
446
447
  }), /* @__PURE__ */ h("button", {
447
448
  type: "button",
448
449
  disabled: o,
449
450
  "aria-pressed": e.visible && !e.grouped,
450
- "data-ssg-tooltip": e.grouped ? v.columnsGroupedHint : void 0,
451
+ "data-ssg-tooltip": e.grouped ? y.columnsGroupedHint : void 0,
451
452
  onClick: () => {
452
453
  o || a(e.key, !e.visible);
453
454
  },
454
455
  className: "ssg-chooser-toggle",
455
- children: [/* @__PURE__ */ m(O, {
456
+ children: [/* @__PURE__ */ m(A, {
456
457
  state: e.visible && !e.grouped ? "checked" : "unchecked",
457
458
  disabled: o
458
459
  }), /* @__PURE__ */ m("span", {
459
460
  className: l("ssg-chooser-label", o && (!e.visible || e.grouped) && "ssg-chooser-label--muted"),
460
- children: e.grouped ? f(v.groupedColumnTitle, { column: e.title }) : e.title
461
+ children: e.grouped ? f(y.groupedColumnTitle, { column: e.title }) : e.title
461
462
  })]
462
463
  })]
463
464
  }, e.key);
@@ -468,12 +469,12 @@ function A({ items: e, canToggle: t, onToggleColumnVisibility: a, onShowAllColum
468
469
  children: [/* @__PURE__ */ m("button", {
469
470
  type: "button",
470
471
  disabled: !t,
471
- onClick: ne,
472
- "aria-label": P,
473
- "data-ssg-tooltip": P,
472
+ onClick: re,
473
+ "aria-label": F,
474
+ "data-ssg-tooltip": F,
474
475
  className: "ssg-chooser-master-btn",
475
- children: /* @__PURE__ */ m(O, {
476
- state: N,
476
+ children: /* @__PURE__ */ m(A, {
477
+ state: P,
477
478
  disabled: !t
478
479
  })
479
480
  }), /* @__PURE__ */ h("div", {
@@ -483,32 +484,32 @@ function A({ items: e, canToggle: t, onToggleColumnVisibility: a, onShowAllColum
483
484
  className: "ssg-chooser-search-icon",
484
485
  children: "⌕"
485
486
  }), /* @__PURE__ */ m("input", {
486
- ref: x,
487
+ ref: S,
487
488
  type: "text",
488
- value: y,
489
- onChange: (e) => b(e.target.value),
490
- placeholder: v.columnsSearchPlaceholder,
491
- "aria-label": v.columnsSearchPlaceholder,
489
+ value: b,
490
+ onChange: (e) => x(e.target.value),
491
+ placeholder: y.columnsSearchPlaceholder,
492
+ "aria-label": y.columnsSearchPlaceholder,
492
493
  className: "ssg-chooser-search-input"
493
494
  })]
494
495
  })]
495
496
  }),
496
497
  /* @__PURE__ */ m("div", {
497
- ref: z,
498
+ ref: B,
498
499
  className: "ssg-chooser-list",
499
500
  tabIndex: t ? void 0 : 0,
500
- children: F.length === 0 ? /* @__PURE__ */ m("div", {
501
+ children: I.length === 0 ? /* @__PURE__ */ m("div", {
501
502
  className: "ssg-chooser-empty",
502
- children: v.columnsNoMatches
503
- }) : I.map((e) => /* @__PURE__ */ h("div", {
503
+ children: y.columnsNoMatches
504
+ }) : L.map((e) => /* @__PURE__ */ h("div", {
504
505
  "data-chooser-section": e.pane,
505
506
  children: [
506
- L && /* @__PURE__ */ m("div", {
507
+ R && /* @__PURE__ */ m("div", {
507
508
  className: "ssg-chooser-section-heading",
508
- children: v[E[e.pane]]
509
+ children: y[O[e.pane]]
509
510
  }),
510
- e.items.map((t, n) => re(t, n, e.pane)),
511
- B !== null && $ === e.pane && W === e.items.length && /* @__PURE__ */ m("div", { className: "ssg-chooser-drop-end" })
511
+ e.items.map((t, n) => ie(t, n, e.pane)),
512
+ V !== null && $ === e.pane && G === e.items.length && /* @__PURE__ */ m("div", { className: "ssg-chooser-drop-end" })
512
513
  ]
513
514
  }, e.pane))
514
515
  }),
@@ -520,19 +521,19 @@ function A({ items: e, canToggle: t, onToggleColumnVisibility: a, onShowAllColum
520
521
  onClick: () => {
521
522
  t && g();
522
523
  },
523
- "data-ssg-tooltip": v.resetColumnsHint,
524
+ "data-ssg-tooltip": y.resetColumnsHint,
524
525
  className: "ssg-chooser-reset-btn",
525
- children: v.columnsReset
526
+ children: y.columnsReset
526
527
  }), !t && /* @__PURE__ */ m("div", {
527
528
  className: "ssg-chooser-note",
528
- children: v.columnsUnavailable
529
+ children: y.columnsUnavailable
529
530
  })]
530
531
  })
531
532
  ] });
532
533
  }
533
534
  //#endregion
534
535
  //#region src/view/SortManagementPanel.tsx
535
- function j({ disabled: e }) {
536
+ function N({ disabled: e }) {
536
537
  return /* @__PURE__ */ m("svg", {
537
538
  width: "10",
538
539
  height: "16",
@@ -550,7 +551,7 @@ function j({ disabled: e }) {
550
551
  }, `${t}-${e}`)))
551
552
  });
552
553
  }
553
- function M({ entries: e, columns: t, canSort: i, onAddLevel: a, onChangeDirection: u, onChangeColumn: d, onRemoveLevel: f, onClearAll: g, onMove: _ }) {
554
+ function P({ entries: e, columns: t, canSort: i, onAddLevel: a, onChangeDirection: u, onChangeColumn: d, onRemoveLevel: f, onClearAll: g, onMove: _ }) {
554
555
  let v = n(), y = o(() => new Set(e.map((e) => e.columnKey)), [e]), b = o(() => t.find((e) => !y.has(e.key)) ?? null, [t, y]), x = (e) => t.find((t) => t.key === e)?.title || e, S = i && e.length >= 2, C = s(null), [w, T] = c(null), E = s(!1), [D, O] = c(null), k = s(0), A = r(() => {
555
556
  let e = C.current;
556
557
  if (!e) return;
@@ -563,7 +564,7 @@ function M({ entries: e, columns: t, canSort: i, onAddLevel: a, onChangeDirectio
563
564
  }
564
565
  }
565
566
  O(r);
566
- }, []), M = r((e) => {
567
+ }, []), j = r((e) => {
567
568
  let t = w, n = D;
568
569
  if (E.current = !1, T(null), O(null), e && t !== null && n !== null) {
569
570
  let e = n;
@@ -573,15 +574,15 @@ function M({ entries: e, columns: t, canSort: i, onAddLevel: a, onChangeDirectio
573
574
  w,
574
575
  D,
575
576
  _
576
- ]), N = r((e, t) => {
577
+ ]), M = r((e, t) => {
577
578
  S && (t.preventDefault(), t.stopPropagation(), t.currentTarget.setPointerCapture(t.pointerId), E.current = !0, k.current = t.clientY, T(e), A());
578
579
  }, [S, A]), P = r((e) => {
579
580
  E.current && (k.current = e.clientY, A());
580
581
  }, [A]), F = r(() => {
581
- E.current && M(!0);
582
- }, [M]), I = r(() => {
583
- E.current && M(!1);
584
- }, [M]), L = i && b !== null;
582
+ E.current && j(!0);
583
+ }, [j]), I = r(() => {
584
+ E.current && j(!1);
585
+ }, [j]), L = i && b !== null;
585
586
  return /* @__PURE__ */ h(p, { children: [
586
587
  /* @__PURE__ */ h("div", {
587
588
  ref: C,
@@ -602,12 +603,12 @@ function M({ entries: e, columns: t, canSort: i, onAddLevel: a, onChangeDirectio
602
603
  role: "button",
603
604
  "aria-label": v.sortPanelDrag,
604
605
  "data-ssg-tooltip": i ? e.length < 2 ? v.sortPanelNeedsTwo : v.sortPanelDrag : v.sortPanelDisabled,
605
- onPointerDown: (e) => N(r, e),
606
+ onPointerDown: (e) => M(r, e),
606
607
  onPointerMove: P,
607
608
  onPointerUp: F,
608
609
  onPointerCancel: I,
609
610
  className: l("ssg-sort-handle", !S && "ssg-sort-handle--disabled", s && "ssg-sort-handle--dragging"),
610
- children: /* @__PURE__ */ m(j, { disabled: !S })
611
+ children: /* @__PURE__ */ m(N, { disabled: !S })
611
612
  }),
612
613
  /* @__PURE__ */ m("span", {
613
614
  "aria-hidden": !0,
@@ -686,4 +687,4 @@ function M({ entries: e, columns: t, canSort: i, onAddLevel: a, onChangeDirectio
686
687
  ] });
687
688
  }
688
689
  //#endregion
689
- export { A as ColumnChooserPanel, S as FilterManagementPanel, M as SortManagementPanel, y as ToolPanel };
690
+ export { M as ColumnChooserPanel, w as FilterManagementPanel, P as SortManagementPanel, x as ToolPanel };
@@ -1,4 +1,5 @@
1
1
  import type { CellRenderContext } from '../model/gridTypes.js';
2
- export declare function DetailToggleButton({ detail }: {
2
+ export declare function DetailToggleButton({ detail, rowNumber, }: {
3
3
  detail: NonNullable<CellRenderContext<unknown>['detail']>;
4
+ rowNumber: number;
4
5
  }): import("react").JSX.Element;
@@ -1,29 +1,3 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { CellCoord, GridSelection, SpreadsheetGridSlotContext, SpreadsheetGridDerivedSummary, SpreadsheetGridSelectionStats } from '../model/gridTypes.js';
3
- import { type ResolvedGridLocaleText } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText';
2
+ import type { SpreadsheetGridSlotContext } from '../model/gridTypes.js';
4
3
  export declare const resolveGridSlot: <T>(slotRenderer: ((context: SpreadsheetGridSlotContext<T>) => ReactNode) | undefined, context: SpreadsheetGridSlotContext<T>, fallback: ReactNode) => ReactNode;
5
- export type GridColumnNamer = ((columnIndex: number) => string) & {
6
- readonly cellNameOf?: (columnIndex: number) => string | undefined;
7
- };
8
- export declare const createDataColumnNamer: (orderedColumns: ReadonlyArray<{
9
- key: string;
10
- title?: string;
11
- }>, names?: {
12
- detail: string;
13
- rowDrag: string;
14
- }) => GridColumnNamer;
15
- export type GridRowNumberer = {
16
- numberOf: (viewRowIndex: number) => number;
17
- lastNumberOf: (viewRowIndex: number) => number;
18
- countRows: (startRow: number, endRow: number) => number;
19
- };
20
- export declare const createDataRowNumberer: (labelViewIndexes: ArrayLike<number> | undefined) => GridRowNumberer;
21
- export declare const formatGridCellLabel: (cell: CellCoord | null, toColumnName?: GridColumnNamer, rowNumberer?: GridRowNumberer, texts?: ResolvedGridLocaleText) => string;
22
- export declare const formatGridSelectionLabel: (selection: GridSelection, toColumnName?: GridColumnNamer, rowNumberer?: GridRowNumberer, texts?: ResolvedGridLocaleText) => string;
23
- export declare const formatGridRowSummary: <T>(context: Pick<SpreadsheetGridSlotContext<T>, "rows">, filteredRowCount: number, totalRowCount?: number, texts?: ResolvedGridLocaleText) => string;
24
- export declare const formatGridColumnSummary: <T>(context: Pick<SpreadsheetGridSlotContext<T>, "columns" | "visibleColumns">, texts?: ResolvedGridLocaleText) => string;
25
- export declare const getGridSelectionStats: <T>(context: Pick<SpreadsheetGridSlotContext<T>, "selection" | "visibleColumns">, filteredRowCount: number, rowNumberer?: GridRowNumberer) => SpreadsheetGridSelectionStats;
26
- export declare const formatGridSelectionStatsLabel: <T>(context: Pick<SpreadsheetGridSlotContext<T>, "selection" | "visibleColumns">, filteredRowCount: number, rowNumberer?: GridRowNumberer, texts?: ResolvedGridLocaleText) => string;
27
- export declare const formatGridFilterSummary: <T>(context: Pick<SpreadsheetGridSlotContext<T>, "globalFilterText" | "columnFilterValues">, texts?: ResolvedGridLocaleText) => string;
28
- export declare const formatGridSortSummary: <T>(context: Pick<SpreadsheetGridSlotContext<T>, "columns" | "sortState">, texts?: ResolvedGridLocaleText) => string;
29
- export declare const buildGridDerivedSummary: <T>(context: Pick<SpreadsheetGridSlotContext<T>, "rows" | "columns" | "visibleColumns" | "globalFilterText" | "columnFilterValues" | "sortState" | "activeCell" | "selection">, filteredRowCount: number, totalRowCount?: number, toColumnName?: GridColumnNamer, rowNumberer?: GridRowNumberer, texts?: ResolvedGridLocaleText) => SpreadsheetGridDerivedSummary;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ishibashi0112/spreadsheet-grid",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "React 18.3 / 19 向けの仮想化データグリッド。SSRM(書き戻し付き)/ 行グルーピング + 集計 / Master/Detail / 範囲選択 + クリップボードを MIT で。IME に強い編集、100 万行の仮想化、Tailwind / Mantine / HeroUI と共存。コアは @ishibashi0112/spreadsheet-grid-core。",
5
5
  "keywords": [
6
6
  "react",
@@ -111,7 +111,7 @@
111
111
  },
112
112
  "dependencies": {
113
113
  "@tanstack/virtual-core": "^3.19.11",
114
- "@ishibashi0112/spreadsheet-grid-core": "1.2.0"
114
+ "@ishibashi0112/spreadsheet-grid-core": "1.3.0"
115
115
  },
116
116
  "devDependencies": {
117
117
  "@types/react": "^19.3.0",