@ishibashi0112/spreadsheet-grid-core 1.0.2 → 1.1.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 (90) hide show
  1. package/dist/controllers/clipboardController.cjs +1 -1
  2. package/dist/controllers/clipboardController.d.ts +3 -0
  3. package/dist/controllers/clipboardController.js +69 -50
  4. package/dist/controllers/columnAutosizeRunner.cjs +1 -1
  5. package/dist/controllers/columnAutosizeRunner.d.ts +1 -0
  6. package/dist/controllers/columnAutosizeRunner.js +10 -9
  7. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  8. package/dist/controllers/columnHeaderDragController.js +169 -168
  9. package/dist/controllers/columnMenuController.cjs +1 -1
  10. package/dist/controllers/columnMenuController.js +71 -69
  11. package/dist/controllers/contextMenuController.cjs +1 -1
  12. package/dist/controllers/contextMenuController.d.ts +4 -1
  13. package/dist/controllers/contextMenuController.js +55 -38
  14. package/dist/controllers/fillHandleController.cjs +1 -1
  15. package/dist/controllers/fillHandleController.d.ts +1 -0
  16. package/dist/controllers/fillHandleController.js +135 -135
  17. package/dist/controllers/historyController.cjs +1 -1
  18. package/dist/controllers/historyController.d.ts +6 -0
  19. package/dist/controllers/historyController.js +79 -37
  20. package/dist/controllers/keyboardController.cjs +1 -1
  21. package/dist/controllers/keyboardController.d.ts +1 -0
  22. package/dist/controllers/keyboardController.js +4 -0
  23. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  24. package/dist/controllers/pointerInteractionsController.d.ts +1 -0
  25. package/dist/controllers/pointerInteractionsController.js +142 -142
  26. package/dist/controllers/popoverSupport.cjs +1 -1
  27. package/dist/controllers/popoverSupport.d.ts +1 -0
  28. package/dist/controllers/popoverSupport.js +9 -4
  29. package/dist/controllers/rowDragController.cjs +1 -1
  30. package/dist/controllers/rowDragController.d.ts +1 -0
  31. package/dist/controllers/rowDragController.js +145 -144
  32. package/dist/controllers/toolPanelController.cjs +1 -1
  33. package/dist/controllers/toolPanelController.js +26 -14
  34. package/dist/controllers/tooltipController.cjs +1 -1
  35. package/dist/controllers/tooltipController.js +74 -72
  36. package/dist/controllers/viewportSyncController.cjs +1 -1
  37. package/dist/controllers/viewportSyncController.d.ts +3 -1
  38. package/dist/controllers/viewportSyncController.js +66 -28
  39. package/dist/engine/exportCommands.cjs +1 -1
  40. package/dist/engine/exportCommands.js +16 -9
  41. package/dist/engine/gridApi.cjs +2 -2
  42. package/dist/engine/gridApi.d.ts +6 -2
  43. package/dist/engine/gridApi.js +5 -5
  44. package/dist/index.cjs +1 -1
  45. package/dist/index.d.ts +3 -1
  46. package/dist/index.js +7 -6
  47. package/dist/locales/en.cjs +1 -1
  48. package/dist/locales/en.js +3 -0
  49. package/dist/logic/autoScrollGeometry.cjs +1 -1
  50. package/dist/logic/autoScrollGeometry.d.ts +2 -0
  51. package/dist/logic/autoScrollGeometry.js +3 -3
  52. package/dist/logic/editorValues.cjs +1 -1
  53. package/dist/logic/editorValues.js +37 -34
  54. package/dist/logic/exportCsv.cjs +3 -3
  55. package/dist/logic/exportCsv.d.ts +3 -1
  56. package/dist/logic/exportCsv.js +22 -20
  57. package/dist/logic/exportData.cjs +1 -1
  58. package/dist/logic/exportData.d.ts +3 -1
  59. package/dist/logic/exportData.js +40 -36
  60. package/dist/logic/filtering.cjs +1 -1
  61. package/dist/logic/filtering.d.ts +2 -1
  62. package/dist/logic/filtering.js +16 -3
  63. package/dist/logic/groupExport.cjs +1 -1
  64. package/dist/logic/groupExport.js +28 -27
  65. package/dist/logic/grouping.cjs +1 -1
  66. package/dist/logic/grouping.d.ts +1 -0
  67. package/dist/logic/grouping.js +52 -41
  68. package/dist/logic/historyRebase.cjs +1 -0
  69. package/dist/logic/historyRebase.d.ts +5 -0
  70. package/dist/logic/historyRebase.js +36 -0
  71. package/dist/logic/localeTextFeatures.cjs +1 -1
  72. package/dist/logic/localeTextFeatures.d.ts +4 -0
  73. package/dist/logic/localeTextFeatures.js +8 -5
  74. package/dist/logic/localeTextPopups.cjs +1 -1
  75. package/dist/logic/localeTextPopups.d.ts +1 -0
  76. package/dist/logic/localeTextPopups.js +1 -0
  77. package/dist/logic/selectLabels.cjs +1 -0
  78. package/dist/logic/selectLabels.d.ts +3 -0
  79. package/dist/logic/selectLabels.js +41 -0
  80. package/dist/logic/valueParsers.cjs +1 -0
  81. package/dist/logic/valueParsers.d.ts +14 -0
  82. package/dist/logic/valueParsers.js +23 -0
  83. package/dist/model/gridTypes.core.d.ts +174 -18
  84. package/dist/utils/clipboard.cjs +4 -4
  85. package/dist/utils/clipboard.d.ts +14 -2
  86. package/dist/utils/clipboard.js +101 -49
  87. package/dist/utils/popupContainer.cjs +1 -0
  88. package/dist/utils/popupContainer.d.ts +8 -0
  89. package/dist/utils/popupContainer.js +60 -0
  90. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { createValueStore as e } from "../logic/valueStore.js";
2
+ import "./escapeClaimController.js";
2
3
  import { blurForPopover as t, createPopoverWindowBindings as n, isInsideGridRoot as r, restoreGridFocus as i } from "./popoverSupport.js";
3
4
  import { clampPanelDragPosition as a } from "../logic/panelDragGeometry.js";
4
5
  //#region src/controllers/toolPanelController.ts
@@ -67,34 +68,41 @@ var o = 360, s = 420, c = 336, l = 8, u = 12, d = [
67
68
  width: o,
68
69
  maxHeight: i.maxHeight
69
70
  });
70
- }, x = () => s !== null && m(c.getSnapshot().requestedTab, p(s)) !== null, S = (e) => {
71
- g({
71
+ }, x = () => s !== null && m(c.getSnapshot().requestedTab, p(s)) !== null, S = null, C = (e, t = !1) => {
72
+ let n = S;
73
+ if (S = null, g({
72
74
  requestedTab: null,
73
75
  layout: null
74
- }), T(), s !== null && e && i(s.gridRootRef);
75
- }, C = () => S(!0), w = n({
76
+ }), E(), !(s === null || !e)) {
77
+ if (t && n !== null && n.isConnected && n !== s.gridRootRef.current) {
78
+ let e = document.activeElement;
79
+ if (e === n || (e === null || e === document.body || d.current?.contains(e) === !0) && (n.focus({ preventScroll: !0 }), document.activeElement === n)) return;
80
+ }
81
+ i(s.gridRootRef);
82
+ }
83
+ }, w = () => C(!0, !0), T = n({
76
84
  onResize: b,
77
85
  onScroll: b,
78
86
  isInside: (e) => d.current?.contains(e) === !0 || s?.alliedRef?.current?.contains(e) === !0,
79
- onOutsidePointerDown: (e) => S(s !== null && r(s.gridRootRef, e)),
87
+ onOutsidePointerDown: (e) => C(s !== null && r(s.gridRootRef, e)),
80
88
  getGridRoot: () => s?.gridRootRef.current ?? null,
81
- onGridHidden: () => S(!1),
89
+ onGridHidden: () => C(!1),
82
90
  onKeyDown: (e) => {
83
91
  if (e.key === "Escape") {
84
92
  if (s?.suppressEscape) {
85
93
  s.onSuppressedEscape?.();
86
94
  return;
87
95
  }
88
- e.preventDefault(), C();
96
+ e.preventDefault(), w();
89
97
  }
90
98
  }
91
- }), T = () => {
99
+ }), E = () => {
92
100
  let e = x();
93
- e && !w.isAttached() ? (b(), w.attach()) : !e && w.isAttached() && w.detach();
101
+ e && !T.isAttached() ? (b(), T.attach()) : !e && T.isAttached() && T.detach();
94
102
  };
95
103
  return {
96
104
  update: (e) => {
97
- s = e, T();
105
+ s = e, E();
98
106
  },
99
107
  subscribe: c.subscribe,
100
108
  getSnapshot: c.getSnapshot,
@@ -102,12 +110,16 @@ var o = 360, s = 420, c = 336, l = 8, u = 12, d = [
102
110
  open: (e) => {
103
111
  if (s === null || !p(s).includes(e)) return;
104
112
  let n = c.getSnapshot();
105
- t(s.gridRootRef.current), g({
113
+ if (n.requestedTab === null) {
114
+ let e = document.activeElement;
115
+ S = e instanceof HTMLElement && e !== document.body && e.closest(".ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover") === null ? e : null;
116
+ }
117
+ d.current?.contains(document.activeElement) !== !0 && t(s.gridRootRef.current), g({
106
118
  requestedTab: e,
107
119
  flashTick: n.requestedTab === null ? n.flashTick : n.flashTick + 1
108
- }), T();
120
+ }), E();
109
121
  },
110
- close: C,
122
+ close: w,
111
123
  move: (e, t) => {
112
124
  let n = v({
113
125
  top: e,
@@ -116,7 +128,7 @@ var o = 360, s = 420, c = 336, l = 8, u = 12, d = [
116
128
  h = n, g({ layout: y(n) });
117
129
  },
118
130
  dispose: () => {
119
- w.detach();
131
+ T.detach();
120
132
  }
121
133
  };
122
134
  };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/slotDom.cjs"),t=require("../utils/portalTokens.cjs"),n=require("../logic/tooltipGeometry.cjs");var r=`data-ssg-tooltip`,i=`data-ssg-tooltip-overflow`,a=`[${r}], [${i}]`,o=350,s=800,c=0,l=null,u=null,d=0,f=null,p,m,h=null,g=null,_=new WeakMap;function v(t){m=e.applySlotToElement(t,p,m)}function y(){if(l!==null)return l;let e=document.createElement(`div`);return e.className=`ssg-tooltip`,e.setAttribute(`aria-hidden`,`true`),m=void 0,v(e),document.body.appendChild(e),l=e,e}function b(){u!==null&&(window.clearTimeout(u),u=null)}var x=null;function S(){x!==null&&(cancelAnimationFrame(x),x=null)}function C(){if(S(),typeof requestAnimationFrame!=`function`)return;let e=()=>{if(x=null,f!==null){if(!f.isConnected){w();return}x=requestAnimationFrame(e)}};x=requestAnimationFrame(e)}function w(){b(),S(),f!==null&&(d=Date.now()+s),f=null,h=null,g=null,l!==null&&l.classList.remove(`ssg-tooltip--visible`)}function T(e){if(!e.isConnected)return;let a=e.getAttribute(r),o=e.getAttribute(i),s=a!==null&&a!==``?a:o!==null&&o!==``?o:(e.textContent??``).trim();if(s===``)return;let c=y();c.classList.toggle(`ssg-theme-dark`,e.closest(`.ssg-theme-dark`)!==null),c.classList.toggle(`ssg-theme-class`,e.closest(`.ssg-theme-class`)!==null),c.classList.toggle(`ssg-motion-off`,e.closest(`.ssg-motion-off`)!==null),t.syncPortalTokens(e,c),c.textContent=s,c.style.left=`0px`,c.style.top=`0px`;let l=n.computeTooltipPlacement({targetRect:e.getBoundingClientRect(),tipWidth:c.offsetWidth,tipHeight:c.offsetHeight,viewportWidth:window.innerWidth});c.style.left=`${l.left}px`,c.style.top=`${l.top}px`,c.classList.add(`ssg-tooltip--visible`),f=e,C()}function E(e){if(e.scrollWidth>e.clientWidth+1)return!0;for(let t of Array.from(e.children))if(t.scrollWidth>t.clientWidth+1)return!0;return!1}function D(e){let t=e.target;if(!(t instanceof Element)||typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.buttons!==0)return;let n=t.closest(a);if(n===null||n===f||!n.hasAttribute(r)&&!E(n))return;let i=f!==null;w(),i||Date.now()<d?T(n):u=window.setTimeout(()=>{u=null,T(n)},o)}function O(e){let t=e.target;if(!(t instanceof Element))return;if(e.type===`focusout`&&g!==null&&g.contains(t)){let t=e.relatedTarget;if(!(t instanceof Node&&g.contains(t))){w();return}}let n=t.closest(a);if(n===null||n===h&&typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.pointerType!==`mouse`)return;let r=e.relatedTarget;r instanceof Node&&n.contains(r)||w()}function k(){w()}function A(e){h!==null&&f===h&&typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.pointerType!==`mouse`&&e.target instanceof Node&&h.contains(e.target)||w()}function j(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`.ssg-shell`),r=n===null?void 0:_.get(n);if(n===null||r===void 0)return;let i=document.getElementById(r);i===null||f===i||!i.contains(t)||F(r,n)}function M(e){e.key===`Escape`&&w()}function N(){window.addEventListener(`pointerover`,D,!0),window.addEventListener(`pointerout`,O,!0),window.addEventListener(`focusin`,D,!0),window.addEventListener(`focusout`,O,!0),window.addEventListener(`pointerdown`,A,!0),window.addEventListener(`pointerup`,j,!0),window.addEventListener(`scroll`,k,!0),window.addEventListener(`keydown`,M,!0)}function P(){window.removeEventListener(`pointerover`,D,!0),window.removeEventListener(`pointerout`,O,!0),window.removeEventListener(`focusin`,D,!0),window.removeEventListener(`focusout`,O,!0),window.removeEventListener(`pointerdown`,A,!0),window.removeEventListener(`pointerup`,j,!0),window.removeEventListener(`scroll`,k,!0),window.removeEventListener(`keydown`,M,!0)}function F(e,t){if(typeof requestAnimationFrame!=`function`||c===0)return()=>{};t!==null&&_.set(t,e);let n=requestAnimationFrame(()=>{n=requestAnimationFrame(()=>{if(n=0,t!==null&&_.get(t)!==e)return;let i=document.getElementById(e);if(!(i!==null&&t!==null&&t.contains(document.activeElement)&&i.classList.contains(`ssg-body-cell--invalid`)&&(i.getAttribute(r)??``)!==``)){L(t);return}f!==i&&(w(),T(i)),f===i&&(h=i,g=t)})});return()=>{n!==0&&cancelAnimationFrame(n)}}function I(e){e&&_.delete(e),L(e)}function L(e){h===null||e!==void 0&&e!==g||(f===h&&w(),h=null,g=null)}function R(e){c+=1,c===1&&N();let t=!1,n=e=>{p=e,l!==null&&v(l)};return n(e),{setSlot:n,dispose:()=>{t||(t=!0,--c,c===0&&(P(),b(),S(),f=null,h=null,g=null,l!==null&&(l.remove(),l=null)))}}}exports.acquireTooltipController=R,exports.hideActiveCellTooltip=I,exports.scheduleActiveCellTooltip=F;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/slotDom.cjs"),t=require("../utils/portalTokens.cjs"),n=require("../utils/popupContainer.cjs"),r=require("../logic/tooltipGeometry.cjs");var i=`data-ssg-tooltip`,a=`data-ssg-tooltip-overflow`,o=`[${i}], [${a}]`,s=350,c=800,l=0,u=null,d=null,f=0,p=null,m,h,g=null,_=null,v=new WeakMap;function y(t){h=e.applySlotToElement(t,m,h)}function b(e){let t=n.getPopupContainerFor(e);if(u!==null)return n.appendToPopupContainer(u,t),u;let r=document.createElement(`div`);return r.className=`ssg-tooltip`,r.setAttribute(`aria-hidden`,`true`),h=void 0,y(r),n.appendToPopupContainer(r,t),u=r,r}function x(){d!==null&&(window.clearTimeout(d),d=null)}var S=null;function C(){S!==null&&(cancelAnimationFrame(S),S=null)}function w(){if(C(),typeof requestAnimationFrame!=`function`)return;let e=()=>{if(S=null,p!==null){if(!p.isConnected){T();return}S=requestAnimationFrame(e)}};S=requestAnimationFrame(e)}function T(){x(),C(),p!==null&&(f=Date.now()+c),p=null,g=null,_=null,u!==null&&u.classList.remove(`ssg-tooltip--visible`)}function E(e){if(!e.isConnected)return;let n=e.getAttribute(i),o=e.getAttribute(a),s=n!==null&&n!==``?n:o!==null&&o!==``?o:(e.textContent??``).trim();if(s===``)return;let c=b(e);c.classList.toggle(`ssg-theme-dark`,e.closest(`.ssg-theme-dark`)!==null),c.classList.toggle(`ssg-theme-class`,e.closest(`.ssg-theme-class`)!==null),c.classList.toggle(`ssg-motion-off`,e.closest(`.ssg-motion-off`)!==null),t.syncPortalTokens(e,c),c.textContent=s,c.style.left=`0px`,c.style.top=`0px`;let l=r.computeTooltipPlacement({targetRect:e.getBoundingClientRect(),tipWidth:c.offsetWidth,tipHeight:c.offsetHeight,viewportWidth:window.innerWidth});c.style.left=`${l.left}px`,c.style.top=`${l.top}px`,c.classList.add(`ssg-tooltip--visible`),p=e,w()}function D(e){if(e.scrollWidth>e.clientWidth+1)return!0;for(let t of Array.from(e.children))if(t.scrollWidth>t.clientWidth+1)return!0;return!1}function O(e){let t=e.target;if(!(t instanceof Element)||typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.buttons!==0)return;let n=t.closest(o);if(n===null||n===p||!n.hasAttribute(i)&&!D(n))return;let r=p!==null;T(),r||Date.now()<f?E(n):d=window.setTimeout(()=>{d=null,E(n)},s)}function k(e){let t=e.target;if(!(t instanceof Element))return;if(e.type===`focusout`&&_!==null&&_.contains(t)){let t=e.relatedTarget;if(!(t instanceof Node&&_.contains(t))){T();return}}let n=t.closest(o);if(n===null||n===g&&typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.pointerType!==`mouse`)return;let r=e.relatedTarget;r instanceof Node&&n.contains(r)||T()}function A(){T()}function j(e){g!==null&&p===g&&typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.pointerType!==`mouse`&&e.target instanceof Node&&g.contains(e.target)||T()}function M(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`.ssg-shell`),r=n===null?void 0:v.get(n);if(n===null||r===void 0)return;let i=document.getElementById(r);i===null||p===i||!i.contains(t)||I(r,n)}function N(e){e.key===`Escape`&&T()}function P(){window.addEventListener(`pointerover`,O,!0),window.addEventListener(`pointerout`,k,!0),window.addEventListener(`focusin`,O,!0),window.addEventListener(`focusout`,k,!0),window.addEventListener(`pointerdown`,j,!0),window.addEventListener(`pointerup`,M,!0),window.addEventListener(`scroll`,A,!0),window.addEventListener(`keydown`,N,!0)}function F(){window.removeEventListener(`pointerover`,O,!0),window.removeEventListener(`pointerout`,k,!0),window.removeEventListener(`focusin`,O,!0),window.removeEventListener(`focusout`,k,!0),window.removeEventListener(`pointerdown`,j,!0),window.removeEventListener(`pointerup`,M,!0),window.removeEventListener(`scroll`,A,!0),window.removeEventListener(`keydown`,N,!0)}function I(e,t){if(typeof requestAnimationFrame!=`function`||l===0)return()=>{};t!==null&&v.set(t,e);let n=requestAnimationFrame(()=>{n=requestAnimationFrame(()=>{if(n=0,t!==null&&v.get(t)!==e)return;let r=document.getElementById(e);if(!(r!==null&&t!==null&&t.contains(document.activeElement)&&r.classList.contains(`ssg-body-cell--invalid`)&&(r.getAttribute(i)??``)!==``)){R(t);return}p!==r&&(T(),E(r)),p===r&&(g=r,_=t)})});return()=>{n!==0&&cancelAnimationFrame(n)}}function L(e){e&&v.delete(e),R(e)}function R(e){g===null||e!==void 0&&e!==_||(p===g&&T(),g=null,_=null)}function z(e){l+=1,l===1&&P();let t=!1,n=e=>{m=e,u!==null&&y(u)};return n(e),{setSlot:n,dispose:()=>{t||(t=!0,--l,l===0&&(F(),x(),C(),p=null,g=null,_=null,u!==null&&(u.remove(),u=null)))}}}exports.acquireTooltipController=z,exports.hideActiveCellTooltip=L,exports.scheduleActiveCellTooltip=I;
@@ -1,141 +1,143 @@
1
1
  import { applySlotToElement as e } from "../logic/slotDom.js";
2
2
  import { syncPortalTokens as t } from "../utils/portalTokens.js";
3
- import { computeTooltipPlacement as n } from "../logic/tooltipGeometry.js";
3
+ import { appendToPopupContainer as n, getPopupContainerFor as r } from "../utils/popupContainer.js";
4
+ import { computeTooltipPlacement as i } from "../logic/tooltipGeometry.js";
4
5
  //#region src/controllers/tooltipController.ts
5
- var r = "data-ssg-tooltip", i = "data-ssg-tooltip-overflow", a = `[${r}], [${i}]`, o = 350, s = 800, c = 0, l = null, u = null, d = 0, f = null, p, m, h = null, g = null, _ = /* @__PURE__ */ new WeakMap();
6
- function v(t) {
7
- m = e(t, p, m);
6
+ var a = "data-ssg-tooltip", o = "data-ssg-tooltip-overflow", s = `[${a}], [${o}]`, c = 350, l = 800, u = 0, d = null, f = null, p = 0, m = null, h, g, _ = null, v = null, y = /* @__PURE__ */ new WeakMap();
7
+ function b(t) {
8
+ g = e(t, h, g);
8
9
  }
9
- function y() {
10
- if (l !== null) return l;
11
- let e = document.createElement("div");
12
- return e.className = "ssg-tooltip", e.setAttribute("aria-hidden", "true"), m = void 0, v(e), document.body.appendChild(e), l = e, e;
10
+ function x(e) {
11
+ let t = r(e);
12
+ if (d !== null) return n(d, t), d;
13
+ let i = document.createElement("div");
14
+ return i.className = "ssg-tooltip", i.setAttribute("aria-hidden", "true"), g = void 0, b(i), n(i, t), d = i, i;
13
15
  }
14
- function b() {
15
- u !== null && (window.clearTimeout(u), u = null);
16
- }
17
- var x = null;
18
16
  function S() {
19
- x !== null && (cancelAnimationFrame(x), x = null);
17
+ f !== null && (window.clearTimeout(f), f = null);
18
+ }
19
+ var C = null;
20
+ function w() {
21
+ C !== null && (cancelAnimationFrame(C), C = null);
20
22
  }
21
- function C() {
22
- if (S(), typeof requestAnimationFrame != "function") return;
23
+ function T() {
24
+ if (w(), typeof requestAnimationFrame != "function") return;
23
25
  let e = () => {
24
- if (x = null, f !== null) {
25
- if (!f.isConnected) {
26
- w();
26
+ if (C = null, m !== null) {
27
+ if (!m.isConnected) {
28
+ E();
27
29
  return;
28
30
  }
29
- x = requestAnimationFrame(e);
31
+ C = requestAnimationFrame(e);
30
32
  }
31
33
  };
32
- x = requestAnimationFrame(e);
34
+ C = requestAnimationFrame(e);
33
35
  }
34
- function w() {
35
- b(), S(), f !== null && (d = Date.now() + s), f = null, h = null, g = null, l !== null && l.classList.remove("ssg-tooltip--visible");
36
+ function E() {
37
+ S(), w(), m !== null && (p = Date.now() + l), m = null, _ = null, v = null, d !== null && d.classList.remove("ssg-tooltip--visible");
36
38
  }
37
- function T(e) {
39
+ function D(e) {
38
40
  if (!e.isConnected) return;
39
- let a = e.getAttribute(r), o = e.getAttribute(i), s = a !== null && a !== "" ? a : o !== null && o !== "" ? o : (e.textContent ?? "").trim();
41
+ let n = e.getAttribute(a), r = e.getAttribute(o), s = n !== null && n !== "" ? n : r !== null && r !== "" ? r : (e.textContent ?? "").trim();
40
42
  if (s === "") return;
41
- let c = y();
43
+ let c = x(e);
42
44
  c.classList.toggle("ssg-theme-dark", e.closest(".ssg-theme-dark") !== null), c.classList.toggle("ssg-theme-class", e.closest(".ssg-theme-class") !== null), c.classList.toggle("ssg-motion-off", e.closest(".ssg-motion-off") !== null), t(e, c), c.textContent = s, c.style.left = "0px", c.style.top = "0px";
43
- let l = n({
45
+ let l = i({
44
46
  targetRect: e.getBoundingClientRect(),
45
47
  tipWidth: c.offsetWidth,
46
48
  tipHeight: c.offsetHeight,
47
49
  viewportWidth: window.innerWidth
48
50
  });
49
- c.style.left = `${l.left}px`, c.style.top = `${l.top}px`, c.classList.add("ssg-tooltip--visible"), f = e, C();
51
+ c.style.left = `${l.left}px`, c.style.top = `${l.top}px`, c.classList.add("ssg-tooltip--visible"), m = e, T();
50
52
  }
51
- function E(e) {
53
+ function O(e) {
52
54
  if (e.scrollWidth > e.clientWidth + 1) return !0;
53
55
  for (let t of Array.from(e.children)) if (t.scrollWidth > t.clientWidth + 1) return !0;
54
56
  return !1;
55
57
  }
56
- function D(e) {
58
+ function k(e) {
57
59
  let t = e.target;
58
60
  if (!(t instanceof Element) || typeof PointerEvent < "u" && e instanceof PointerEvent && e.buttons !== 0) return;
59
- let n = t.closest(a);
60
- if (n === null || n === f || !n.hasAttribute(r) && !E(n)) return;
61
- let i = f !== null;
62
- w(), i || Date.now() < d ? T(n) : u = window.setTimeout(() => {
63
- u = null, T(n);
64
- }, o);
61
+ let n = t.closest(s);
62
+ if (n === null || n === m || !n.hasAttribute(a) && !O(n)) return;
63
+ let r = m !== null;
64
+ E(), r || Date.now() < p ? D(n) : f = window.setTimeout(() => {
65
+ f = null, D(n);
66
+ }, c);
65
67
  }
66
- function O(e) {
68
+ function A(e) {
67
69
  let t = e.target;
68
70
  if (!(t instanceof Element)) return;
69
- if (e.type === "focusout" && g !== null && g.contains(t)) {
71
+ if (e.type === "focusout" && v !== null && v.contains(t)) {
70
72
  let t = e.relatedTarget;
71
- if (!(t instanceof Node && g.contains(t))) {
72
- w();
73
+ if (!(t instanceof Node && v.contains(t))) {
74
+ E();
73
75
  return;
74
76
  }
75
77
  }
76
- let n = t.closest(a);
77
- if (n === null || n === h && typeof PointerEvent < "u" && e instanceof PointerEvent && e.pointerType !== "mouse") return;
78
+ let n = t.closest(s);
79
+ if (n === null || n === _ && typeof PointerEvent < "u" && e instanceof PointerEvent && e.pointerType !== "mouse") return;
78
80
  let r = e.relatedTarget;
79
- r instanceof Node && n.contains(r) || w();
81
+ r instanceof Node && n.contains(r) || E();
80
82
  }
81
- function k() {
82
- w();
83
+ function j() {
84
+ E();
83
85
  }
84
- function A(e) {
85
- h !== null && f === h && typeof PointerEvent < "u" && e instanceof PointerEvent && e.pointerType !== "mouse" && e.target instanceof Node && h.contains(e.target) || w();
86
+ function M(e) {
87
+ _ !== null && m === _ && typeof PointerEvent < "u" && e instanceof PointerEvent && e.pointerType !== "mouse" && e.target instanceof Node && _.contains(e.target) || E();
86
88
  }
87
- function j(e) {
89
+ function N(e) {
88
90
  let t = e.target;
89
91
  if (!(t instanceof Element)) return;
90
- let n = t.closest(".ssg-shell"), r = n === null ? void 0 : _.get(n);
92
+ let n = t.closest(".ssg-shell"), r = n === null ? void 0 : y.get(n);
91
93
  if (n === null || r === void 0) return;
92
94
  let i = document.getElementById(r);
93
- i === null || f === i || !i.contains(t) || F(r, n);
95
+ i === null || m === i || !i.contains(t) || L(r, n);
94
96
  }
95
- function M(e) {
96
- e.key === "Escape" && w();
97
+ function P(e) {
98
+ e.key === "Escape" && E();
97
99
  }
98
- function N() {
99
- window.addEventListener("pointerover", D, !0), window.addEventListener("pointerout", O, !0), window.addEventListener("focusin", D, !0), window.addEventListener("focusout", O, !0), window.addEventListener("pointerdown", A, !0), window.addEventListener("pointerup", j, !0), window.addEventListener("scroll", k, !0), window.addEventListener("keydown", M, !0);
100
+ function F() {
101
+ window.addEventListener("pointerover", k, !0), window.addEventListener("pointerout", A, !0), window.addEventListener("focusin", k, !0), window.addEventListener("focusout", A, !0), window.addEventListener("pointerdown", M, !0), window.addEventListener("pointerup", N, !0), window.addEventListener("scroll", j, !0), window.addEventListener("keydown", P, !0);
100
102
  }
101
- function P() {
102
- window.removeEventListener("pointerover", D, !0), window.removeEventListener("pointerout", O, !0), window.removeEventListener("focusin", D, !0), window.removeEventListener("focusout", O, !0), window.removeEventListener("pointerdown", A, !0), window.removeEventListener("pointerup", j, !0), window.removeEventListener("scroll", k, !0), window.removeEventListener("keydown", M, !0);
103
+ function I() {
104
+ window.removeEventListener("pointerover", k, !0), window.removeEventListener("pointerout", A, !0), window.removeEventListener("focusin", k, !0), window.removeEventListener("focusout", A, !0), window.removeEventListener("pointerdown", M, !0), window.removeEventListener("pointerup", N, !0), window.removeEventListener("scroll", j, !0), window.removeEventListener("keydown", P, !0);
103
105
  }
104
- function F(e, t) {
105
- if (typeof requestAnimationFrame != "function" || c === 0) return () => {};
106
- t !== null && _.set(t, e);
106
+ function L(e, t) {
107
+ if (typeof requestAnimationFrame != "function" || u === 0) return () => {};
108
+ t !== null && y.set(t, e);
107
109
  let n = requestAnimationFrame(() => {
108
110
  n = requestAnimationFrame(() => {
109
- if (n = 0, t !== null && _.get(t) !== e) return;
110
- let i = document.getElementById(e);
111
- if (!(i !== null && t !== null && t.contains(document.activeElement) && i.classList.contains("ssg-body-cell--invalid") && (i.getAttribute(r) ?? "") !== "")) {
112
- L(t);
111
+ if (n = 0, t !== null && y.get(t) !== e) return;
112
+ let r = document.getElementById(e);
113
+ if (!(r !== null && t !== null && t.contains(document.activeElement) && r.classList.contains("ssg-body-cell--invalid") && (r.getAttribute(a) ?? "") !== "")) {
114
+ z(t);
113
115
  return;
114
116
  }
115
- f !== i && (w(), T(i)), f === i && (h = i, g = t);
117
+ m !== r && (E(), D(r)), m === r && (_ = r, v = t);
116
118
  });
117
119
  });
118
120
  return () => {
119
121
  n !== 0 && cancelAnimationFrame(n);
120
122
  };
121
123
  }
122
- function I(e) {
123
- e && _.delete(e), L(e);
124
+ function R(e) {
125
+ e && y.delete(e), z(e);
124
126
  }
125
- function L(e) {
126
- h === null || e !== void 0 && e !== g || (f === h && w(), h = null, g = null);
127
+ function z(e) {
128
+ _ === null || e !== void 0 && e !== v || (m === _ && E(), _ = null, v = null);
127
129
  }
128
- function R(e) {
129
- c += 1, c === 1 && N();
130
+ function B(e) {
131
+ u += 1, u === 1 && F();
130
132
  let t = !1, n = (e) => {
131
- p = e, l !== null && v(l);
133
+ h = e, d !== null && b(d);
132
134
  };
133
135
  return n(e), {
134
136
  setSlot: n,
135
137
  dispose: () => {
136
- t || (t = !0, --c, c === 0 && (P(), b(), S(), f = null, h = null, g = null, l !== null && (l.remove(), l = null)));
138
+ t || (t = !0, --u, u === 0 && (I(), S(), w(), m = null, _ = null, v = null, d !== null && (d.remove(), d = null)));
137
139
  }
138
140
  };
139
141
  }
140
142
  //#endregion
141
- export { R as acquireTooltipController, I as hideActiveCellTooltip, F as scheduleActiveCellTooltip };
143
+ export { B as acquireTooltipController, R as hideActiveCellTooltip, L as scheduleActiveCellTooltip };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/verticalGeometry.cjs");var t=(e,t)=>{let n=Math.max(t.totalScrollWidth-e.clientWidth,0),r=Math.max(t.headerHeight+t.physicalBodyHeight+(t.footerHeight??0)-e.clientHeight,0);e.scrollLeft>n&&(e.scrollLeft=n),e.scrollTop>r&&(e.scrollTop=r)},n=(t,n,r)=>{let i=r.headerHeight+n.top,a=i+n.height,o=r.leftPaneWidth+r.centerLeadingWidth+n.left,s=o+n.width,c=e.physicalToLogicalScrollTop(t.scrollTop,r.verticalScaleFactor),l=t.scrollLeft,u=t.clientHeight-(r.footerHeight??0),d=t.clientWidth,f=c,p=l,m=c+r.headerHeight+(r.stickyTopInset?.visibleAt(c)??0),h=c+u,g=()=>Math.max(i-r.headerHeight-(r.stickyTopInset?.coveringRowAt(n.top)??0),0);i<m?f=g():a>h&&(f=n.height>h-m?g():Math.max(a-u,0));let _=l+r.leftPaneWidth,v=l+d-r.rightPaneWidth,y=r.activeCellPinned===!0;if(!y&&o<_||!y&&s>v&&n.width>v-_?p=Math.max(o-r.leftPaneWidth,0):!y&&s>v&&(p=Math.max(s-d+r.rightPaneWidth,0)),f!==c||p!==l){let n=e.logicalToPhysicalScrollTop(f,r.verticalScaleFactor);t.scrollTo({top:f>c?Math.ceil(n):n,left:p,behavior:`auto`})}},r=(e,t,n,r)=>e<n?e-n:t>r?Math.min(t-r,e-n):0,i=(t,n,i)=>{let a=t.ownerDocument,o=a.defaultView,s=t.closest(`.ssg-shell`),c=a.activeElement;if(!o||!s||!c||c!==s&&!(c.classList.contains(`ssg-ime-input`)&&s.contains(c))||s.hasAttribute(`data-ssg-pointer`))return;let l=t.getBoundingClientRect();if(l.height===0)return;let u=e.physicalToLogicalScrollTop(t.scrollTop,i.verticalScaleFactor),d=l.top+t.clientTop+i.headerHeight+n.top-u,f=d+n.height;for(let e=t.parentElement;e&&e!==a.body&&e!==a.documentElement;e=e.parentElement){let t=e.scrollHeight-e.clientHeight;if(t<=0)continue;let n=o.getComputedStyle(e).overflowY;if(n!==`auto`&&n!==`scroll`&&n!==`overlay`)continue;let i=e.getBoundingClientRect().top+e.clientTop,a=r(d,f,i,i+e.clientHeight);if(a===0)continue;let s=e.scrollTop,c=Math.min(Math.max(s+a,0),t);e.scrollTop=c,d-=c-s,f-=c-s}let p=r(d,f,0,o.innerHeight);p!==0&&o.scrollBy({top:p,behavior:`auto`})},a=()=>{let t=null,n=1,r=0;return{update:(i,a,o)=>{let s=t,c=n,l=r;if(t=i,n=a,r=i!==null&&a!==1?Math.max(i.scrollHeight-i.clientHeight,0):0,i===null||i!==s||c===a)return;let u=i.scrollTop;if(l>0&&u>=l-1)return;let d=e.logicalToPhysicalScrollTop(e.physicalToLogicalScrollTop(u,c),a);Math.abs(d-u)<1||(i.scrollTop=d,i.scrollTop!==u&&o(i.scrollTop))}}},o=(e,t,n)=>e===null||n.some(n=>!Object.is(e[n],t[n])),s=()=>{let e=null,r=null;return{update:a=>{if(o(e,a,[`columnVirtualizer`,`columnMeasurements`])&&a.columnVirtualizer.measure(),o(e,a,[`scrollElement`,`totalScrollWidth`,`physicalBodyHeight`,`headerHeight`,`footerHeight`])&&a.scrollElement&&t(a.scrollElement,a),o(e,a,[`scrollElement`,`activeCellRect`,`activeCellPinned`,`activeCell`,`headerHeight`,`leftPaneWidth`,`rightPaneWidth`,`centerLeadingWidth`,`verticalScaleFactor`,`footerHeight`])){let e=r,{activeCell:t}=a,o=e!==null&&t!==null&&e.row===t.row&&e.col===t.col;r=t,!o&&a.scrollElement&&a.activeCellRect&&(n(a.scrollElement,a.activeCellRect,a),i(a.scrollElement,a.activeCellRect,a))}e=a}}};exports.clampScrollToContent=t,exports.createScrollScaleAnchor=a,exports.createViewportSyncController=s,exports.revealActiveCellInPage=i,exports.scrollCellIntoView=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/verticalGeometry.cjs");var t=(e,t)=>{let n=Math.max(t.totalScrollWidth-e.clientWidth,0),r=Math.max(t.headerHeight+t.physicalBodyHeight+(t.footerHeight??0)-e.clientHeight,0);e.scrollLeft>n&&(e.scrollLeft=n),e.scrollTop>r&&(e.scrollTop=r)},n=(t,n,r)=>{let i=r.headerHeight+n.top,a=i+n.height,o=r.leftPaneWidth+r.centerLeadingWidth+n.left,s=o+n.width,c=e.physicalToLogicalScrollTop(t.scrollTop,r.verticalScaleFactor),l=t.scrollLeft,u=t.clientHeight-(r.footerHeight??0),d=t.clientWidth,f=c,p=l,m=c+r.headerHeight+(r.stickyTopInset?.visibleAt(c)??0),h=c+u,g=()=>Math.max(i-r.headerHeight-(r.stickyTopInset?.coveringRowAt(n.top)??0),0);i<m?f=g():a>h&&(f=n.height>h-m?g():Math.max(a-u,0));let _=l+r.leftPaneWidth,v=l+d-r.rightPaneWidth,y=r.activeCellPinned===!0;if(!y&&o<_||!y&&s>v&&n.width>v-_?p=Math.max(o-r.leftPaneWidth,0):!y&&s>v&&(p=Math.max(s-d+r.rightPaneWidth,0)),f!==c||p!==l){let n=e.logicalToPhysicalScrollTop(f,r.verticalScaleFactor);return t.scrollTo({top:f>c?Math.ceil(n):n,left:p,behavior:`auto`}),!0}return!1},r=(e,t,n,r)=>e<n?e-n:t>r?Math.min(t-r,e-n):0,i=(t,n,i)=>{let a=t.ownerDocument,o=a.defaultView,s=t.closest(`.ssg-shell`),c=a.activeElement;if(!o||!s||!c||c!==s&&!(c.classList.contains(`ssg-ime-input`)&&s.contains(c))||s.hasAttribute(`data-ssg-pointer`))return;let l=t.getBoundingClientRect();if(l.height===0)return;let u=e.physicalToLogicalScrollTop(t.scrollTop,i.verticalScaleFactor),d=l.top+t.clientTop+i.headerHeight+n.top-u,f=d+n.height;for(let e=t.parentElement;e&&e!==a.body&&e!==a.documentElement;e=e.parentElement){let t=e.scrollHeight-e.clientHeight;if(t<=0)continue;let n=o.getComputedStyle(e).overflowY;if(n!==`auto`&&n!==`scroll`&&n!==`overlay`)continue;let i=e.getBoundingClientRect().top+e.clientTop,a=r(d,f,i,i+e.clientHeight);if(a===0)continue;let s=e.scrollTop,c=Math.min(Math.max(s+a,0),t);e.scrollTop=c,d-=c-s,f-=c-s}let p=r(d,f,0,o.innerHeight);p!==0&&o.scrollBy({top:p,behavior:`auto`})},a=()=>{let t=null,n=1,r=0;return{update:(i,a,o)=>{let s=t,c=n,l=r;if(t=i,n=a,r=i!==null&&a!==1?Math.max(i.scrollHeight-i.clientHeight,0):0,i===null||i!==s||c===a)return;let u=i.scrollTop;if(l>0&&u>=l-1)return;let d=e.logicalToPhysicalScrollTop(e.physicalToLogicalScrollTop(u,c),a);Math.abs(d-u)<1||(i.scrollTop=d,i.scrollTop!==u&&o(i.scrollTop))}}},o=1e3,s=[`wheel`,`touchstart`,`pointerdown`,`pointerup`,`pointermove`,`keydown`],c=(e,t)=>e!==null&&e.top===t.top&&e.height===t.height&&e.left===t.left&&e.width===t.width,l=(e,t,n)=>e===null||n.some(n=>!Object.is(e[n],t[n])),u=()=>{let e=null,r=null,a=null,u=null,d=()=>{a=null,u?.(),u=null},f=e=>{e.type===`pointermove`&&!(e.buttons>0)||d()},p=(e,t)=>{d(),a={cell:t,until:Date.now()+o,left:e.scrollLeft};let n=e.ownerDocument,r=setTimeout(d,o);if(typeof n?.addEventListener!=`function`){u=()=>clearTimeout(r);return}for(let e of s)n.addEventListener(e,f,{capture:!0,passive:!0});u=()=>{clearTimeout(r);for(let e of s)n.removeEventListener(e,f,{capture:!0})}};return{update:o=>{if(l(e,o,[`columnVirtualizer`,`columnMeasurements`])&&o.columnVirtualizer.measure(),l(e,o,[`scrollElement`,`totalScrollWidth`,`physicalBodyHeight`,`headerHeight`,`footerHeight`])&&o.scrollElement&&t(o.scrollElement,o),l(e,o,[`scrollElement`,`activeCellRect`,`activeCellPinned`,`activeCell`,`headerHeight`,`leftPaneWidth`,`rightPaneWidth`,`centerLeadingWidth`,`verticalScaleFactor`,`footerHeight`])){let t=r,{activeCell:s}=o,l=t!==null&&s!==null&&t.row===s.row&&t.col===s.col;r=s,!l&&o.scrollElement&&o.activeCellRect&&s?(n(o.scrollElement,o.activeCellRect,o),i(o.scrollElement,o.activeCellRect,o),p(o.scrollElement,s)):l&&a!==null&&s!==null&&o.scrollElement&&o.activeCellRect&&a.cell.row===s.row&&a.cell.col===s.col&&!c(e?.activeCellRect??null,o.activeCellRect)&&(Date.now()>a.until||Math.abs(o.scrollElement.scrollLeft-a.left)>1?d():(n(o.scrollElement,o.activeCellRect,o),a={...a,left:o.scrollElement.scrollLeft}))}e=o},cancelFollow:d,dispose:d}};exports.clampScrollToContent=t,exports.createScrollScaleAnchor=a,exports.createViewportSyncController=u,exports.revealActiveCellInPage=i,exports.scrollCellIntoView=n;
@@ -28,9 +28,11 @@ export type ViewportSyncArgs<T> = {
28
28
  };
29
29
  export type ViewportSyncController<T> = {
30
30
  update: (args: ViewportSyncArgs<T>) => void;
31
+ cancelFollow: () => void;
32
+ dispose: () => void;
31
33
  };
32
34
  export declare const clampScrollToContent: (scrollElement: HTMLElement, args: Pick<ViewportSyncArgs<unknown>, "totalScrollWidth" | "physicalBodyHeight" | "headerHeight" | "footerHeight">) => void;
33
- export declare const scrollCellIntoView: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "leftPaneWidth" | "rightPaneWidth" | "centerLeadingWidth" | "verticalScaleFactor" | "footerHeight" | "activeCellPinned" | "stickyTopInset">) => void;
35
+ export declare const scrollCellIntoView: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "leftPaneWidth" | "rightPaneWidth" | "centerLeadingWidth" | "verticalScaleFactor" | "footerHeight" | "activeCellPinned" | "stickyTopInset">) => boolean;
34
36
  export declare const revealActiveCellInPage: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "verticalScaleFactor">) => void;
35
37
  export type ScrollScaleAnchor = {
36
38
  update: (scrollElement: HTMLElement | null, verticalScaleFactor: number, onAnchored: (scrollTop: number) => void) => void;
@@ -9,12 +9,13 @@ var n = (e, t) => {
9
9
  let v = u + i.leftPaneWidth, y = u + f - i.rightPaneWidth, b = i.activeCellPinned === !0;
10
10
  if (!b && s < v || !b && c > y && r.width > y - v ? m = Math.max(s - i.leftPaneWidth, 0) : !b && c > y && (m = Math.max(c - f + i.rightPaneWidth, 0)), p !== l || m !== u) {
11
11
  let t = e(p, i.verticalScaleFactor);
12
- n.scrollTo({
12
+ return n.scrollTo({
13
13
  top: p > l ? Math.ceil(t) : t,
14
14
  left: m,
15
15
  behavior: "auto"
16
- });
16
+ }), !0;
17
17
  }
18
+ return !1;
18
19
  }, i = (e, t, n, r) => e < n ? e - n : t > r ? Math.min(t - r, e - n) : 0, a = (e, n, r) => {
19
20
  let a = e.ownerDocument, o = a.defaultView, s = e.closest(".ssg-shell"), c = a.activeElement;
20
21
  if (!o || !s || !c || c !== s && !(c.classList.contains("ssg-ime-input") && s.contains(c)) || s.hasAttribute("data-ssg-pointer")) return;
@@ -46,32 +47,69 @@ var n = (e, t) => {
46
47
  let f = e(t(d, l), o);
47
48
  Math.abs(f - d) < 1 || (a.scrollTop = f, a.scrollTop !== d && s(a.scrollTop));
48
49
  } };
49
- }, s = (e, t, n) => e === null || n.some((n) => !Object.is(e[n], t[n])), c = () => {
50
- let e = null, t = null;
51
- return { update: (i) => {
52
- if (s(e, i, ["columnVirtualizer", "columnMeasurements"]) && i.columnVirtualizer.measure(), s(e, i, [
53
- "scrollElement",
54
- "totalScrollWidth",
55
- "physicalBodyHeight",
56
- "headerHeight",
57
- "footerHeight"
58
- ]) && i.scrollElement && n(i.scrollElement, i), s(e, i, [
59
- "scrollElement",
60
- "activeCellRect",
61
- "activeCellPinned",
62
- "activeCell",
63
- "headerHeight",
64
- "leftPaneWidth",
65
- "rightPaneWidth",
66
- "centerLeadingWidth",
67
- "verticalScaleFactor",
68
- "footerHeight"
69
- ])) {
70
- let e = t, { activeCell: n } = i, o = e !== null && n !== null && e.row === n.row && e.col === n.col;
71
- t = n, !o && i.scrollElement && i.activeCellRect && (r(i.scrollElement, i.activeCellRect, i), a(i.scrollElement, i.activeCellRect, i));
50
+ }, s = 1e3, c = [
51
+ "wheel",
52
+ "touchstart",
53
+ "pointerdown",
54
+ "pointerup",
55
+ "pointermove",
56
+ "keydown"
57
+ ], l = (e, t) => e !== null && e.top === t.top && e.height === t.height && e.left === t.left && e.width === t.width, u = (e, t, n) => e === null || n.some((n) => !Object.is(e[n], t[n])), d = () => {
58
+ let e = null, t = null, i = null, o = null, d = () => {
59
+ i = null, o?.(), o = null;
60
+ }, f = (e) => {
61
+ e.type === "pointermove" && !(e.buttons > 0) || d();
62
+ }, p = (e, t) => {
63
+ d(), i = {
64
+ cell: t,
65
+ until: Date.now() + s,
66
+ left: e.scrollLeft
67
+ };
68
+ let n = e.ownerDocument, r = setTimeout(d, s);
69
+ if (typeof n?.addEventListener != "function") {
70
+ o = () => clearTimeout(r);
71
+ return;
72
72
  }
73
- e = i;
74
- } };
73
+ for (let e of c) n.addEventListener(e, f, {
74
+ capture: !0,
75
+ passive: !0
76
+ });
77
+ o = () => {
78
+ clearTimeout(r);
79
+ for (let e of c) n.removeEventListener(e, f, { capture: !0 });
80
+ };
81
+ };
82
+ return {
83
+ update: (o) => {
84
+ if (u(e, o, ["columnVirtualizer", "columnMeasurements"]) && o.columnVirtualizer.measure(), u(e, o, [
85
+ "scrollElement",
86
+ "totalScrollWidth",
87
+ "physicalBodyHeight",
88
+ "headerHeight",
89
+ "footerHeight"
90
+ ]) && o.scrollElement && n(o.scrollElement, o), u(e, o, [
91
+ "scrollElement",
92
+ "activeCellRect",
93
+ "activeCellPinned",
94
+ "activeCell",
95
+ "headerHeight",
96
+ "leftPaneWidth",
97
+ "rightPaneWidth",
98
+ "centerLeadingWidth",
99
+ "verticalScaleFactor",
100
+ "footerHeight"
101
+ ])) {
102
+ let n = t, { activeCell: s } = o, c = n !== null && s !== null && n.row === s.row && n.col === s.col;
103
+ t = s, !c && o.scrollElement && o.activeCellRect && s ? (r(o.scrollElement, o.activeCellRect, o), a(o.scrollElement, o.activeCellRect, o), p(o.scrollElement, s)) : c && i !== null && s !== null && o.scrollElement && o.activeCellRect && i.cell.row === s.row && i.cell.col === s.col && !l(e?.activeCellRect ?? null, o.activeCellRect) && (Date.now() > i.until || Math.abs(o.scrollElement.scrollLeft - i.left) > 1 ? d() : (r(o.scrollElement, o.activeCellRect, o), i = {
104
+ ...i,
105
+ left: o.scrollElement.scrollLeft
106
+ }));
107
+ }
108
+ e = o;
109
+ },
110
+ cancelFollow: d,
111
+ dispose: d
112
+ };
75
113
  };
76
114
  //#endregion
77
- export { n as clampScrollToContent, o as createScrollScaleAnchor, c as createViewportSyncController, a as revealActiveCellInPage, r as scrollCellIntoView };
115
+ export { n as clampScrollToContent, o as createScrollScaleAnchor, d as createViewportSyncController, a as revealActiveCellInPage, r as scrollCellIntoView };
@@ -1,2 +1,2 @@
1
1
  Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/grouping.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridSelectors.cjs"),r=require("../logic/groupExport.cjs"),i=require("../logic/exportCsv.cjs"),a=require("../logic/exportData.cjs"),o=require("../logic/totalRow.cjs");var s=1e3,c=new Set,l=e=>e===void 0||e===`view`||e===`raw`||e===`rendered`||e===`selection`?e??`view`:(process.env.NODE_ENV!==`production`&&console.warn(`SpreadsheetGrid: エクスポートの scope '${String(e)}' はありません。'view' として扱います('all' / 'visible' は 1.0.0 で消しました。'view' / 'rendered' を使ってください)。\nSpreadsheetGrid: The export scope '${String(e)}' does not exist, so it is treated as 'view' ('all' / 'visible' were removed in 1.0.0; use 'view' / 'rendered').`),`view`),u=(u,d)=>{let f=(t,r=!1,i=!1)=>{let a=u();if(!a)return null;let o=e=>a.rowModel.getRow(e),s=a.labelRowExport,l=e=>{if(!s)return[];let t=s.exportText?s.exportText(e):s.getLabel(e);return typeof t==`string`?[t]:t},f=r&&s&&a.rowModel.getLabelRow?e=>{let t=a.rowModel.getLabelRow?.(e);return t?l(t.row):void 0}:void 0,p=a.isRowExportable,m=p?(e,t)=>p(e,{viewRowIndex:t,rowKey:a.rowModel.getRowKey(t)??t}):void 0,h=p?(e,t)=>p(e,{viewRowIndex:t,rowKey:a.resolvedRowKeyGetter(e,t)}):void 0,g=a.groupTree?e.collectGroupingColumns(a.columns).groupColumns:[],_=e=>g.length>0?[...g,...e.filter(e=>!g.includes(e))]:e;if(t===`raw`){if(a.isServerSide)return process.env.NODE_ENV!==`production`&&console.warn(`SpreadsheetGrid: scope 'raw' は serverSide では未ロード行を取得できないため、'view'(ロード済みビュー行)として扱います。全件エクスポートはサーバ側での実施を推奨します。
2
- SpreadsheetGrid: scope 'raw' cannot read rows that are not loaded with serverSide, so it is treated as 'view' (the loaded rows). Export all rows on the server instead.`),{getRow:o,startRow:0,endRow:a.viewRowCount,columns:a.orderedColumns,isRowIncluded:m};let e=e=>s!==void 0&&a.rows[e]!==void 0&&s.isLabelRow(a.rows[e],e);return{getRow:t=>e(t)?void 0:a.rows[t],startRow:0,endRow:a.rows.length,columns:_(a.orderedColumns),isRowIncluded:h,getLabelLine:r&&s?t=>e(t)?l(a.rows[t]):void 0:void 0}}if(t===`rendered`)return{getRow:o,startRow:a.windowFirstRow,endRow:a.windowLastRow>=a.windowFirstRow?a.windowLastRow+1:a.windowFirstRow,columns:_(a.orderedColumns),isRowIncluded:m,getLabelLine:f};if(t===`selection`){let e=a.uiState.selection;if(!e)return null;if(e.type===`cell`){let t=n.normalizeCellRange(e.range);return{getRow:o,startRow:t.start.row,endRow:t.end.row+1,columns:a.orderedColumns.slice(t.start.col,t.end.col+1),isRowIncluded:m,getLabelLine:f}}if(e.type===`row`){let t=n.normalizeRowRange(e.startRow,e.endRow);return{getRow:o,startRow:t.startRow,endRow:t.endRow+1,columns:_(a.orderedColumns),isRowIncluded:m,getLabelLine:f}}let t=n.normalizeColumnRange(e.startCol,e.endCol);return{getRow:o,startRow:0,endRow:a.viewRowCount,columns:a.orderedColumns.slice(t.startCol,t.endCol+1),isRowIncluded:m,getLabelLine:f}}if(a.groupTree){let t=e.flattenGroupTree(a.groupTree,c),n=t.displayOrder,r=t.groups,o=p?(e,t)=>p(e,{viewRowIndex:t,rowKey:a.resolvedRowKeyGetter(e,n[t]??t)}):void 0,s=o;if(i&&o&&d){let t=[],i=!1;for(let r=0;r<n.length;r+=1){let s=n[r];s===void 0||e.isGroupOrderValue(s)||(o(a.rows[s],r)?t.push(s):i=!0)}if(i){let{aggColumns:i}=e.collectGroupingColumns(a.columns),o=e.flattenGroupTree(d.buildGroupTree(a.rows,Int32Array.from(t),g,i),c);n=o.displayOrder,r=o.groups}s=void 0}let l=n;return{getRow:t=>{let n=l[t];return n===void 0||e.isGroupOrderValue(n)?void 0:a.rows[n]},startRow:0,endRow:l.length,columns:_(a.orderedColumns),groupDisplay:{order:l,groups:r,groupColumnKeys:g.map(e=>e.key),getSourceRow:e=>a.rows[e]},isRowIncluded:s}}return{getRow:o,startRow:0,endRow:a.viewRowCount,columns:a.orderedColumns,isRowIncluded:m,getLabelLine:f}},p=e=>e.filter(e=>!t.isSyntheticColumnKey(e.key)),m=(e,t,n)=>{let r=u()?.totalRowExport;if(!(t!==!0||!r||e!==`view`))return o.buildTotalRowExportLine(n,r.cells,r.label)},h=(e,t,n)=>t===!0&&e.groupDisplay?r.createGroupSubtotalLineGetter({...e.groupDisplay,columns:n,texts:u()?.localeTexts}):void 0,g=e=>{let t=l(e?.scope),n=f(t,e?.includeLabelRows===!0,e?.includeGroupRows===!0);if(!n)return e?.bom?``:``;let r=p(n.columns);return i.serializeRowsToCsv({getRow:n.getRow,startRow:n.startRow,endRow:n.endRow,columns:r,delimiter:e?.delimiter,includeHeaders:e?.includeHeaders,bom:e?.bom,escapeFormulas:e?.escapeFormulas,isRowIncluded:n.isRowIncluded,getLabelLine:n.getLabelLine,totalLine:m(t,e?.includeTotalRow,r),getGroupLine:h(n,e?.includeGroupRows,r)})},_=e=>{let t=l(e?.scope),n=f(t,e?.includeLabelRows===!0,e?.includeGroupRows===!0);if(!n)return{columns:[],rows:[]};let r=p(n.columns);return a.buildGridExportData({getRow:n.getRow,startRow:n.startRow,endRow:n.endRow,columns:r,isRowIncluded:n.isRowIncluded,getLabelLine:n.getLabelLine,totalLine:m(t,e?.includeTotalRow,r),getGroupLine:h(n,e?.includeGroupRows,r)})};return{exportCsv:e=>g(e),downloadCsv:(e,t)=>{if(typeof document>`u`)return;let n=g({...t,bom:t?.bom??!0}),r=new Blob([n],{type:`text/csv;charset=utf-8;`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e??`export.csv`,document.body.appendChild(a),a.click(),document.body.removeChild(a),setTimeout(()=>{URL.revokeObjectURL(i)},s)},getExportData:e=>_(e)}};exports.createExportCommands=u;
2
+ SpreadsheetGrid: scope 'raw' cannot read rows that are not loaded with serverSide, so it is treated as 'view' (the loaded rows). Export all rows on the server instead.`),{getRow:o,startRow:0,endRow:a.viewRowCount,columns:a.orderedColumns,isRowIncluded:m};let e=e=>s!==void 0&&a.rows[e]!==void 0&&s.isLabelRow(a.rows[e],e);return{getRow:t=>e(t)?void 0:a.rows[t],startRow:0,endRow:a.rows.length,columns:_(a.orderedColumns),isRowIncluded:h,getLabelLine:r&&s?t=>e(t)?l(a.rows[t]):void 0:void 0}}if(t===`rendered`)return{getRow:o,startRow:a.windowFirstRow,endRow:a.windowLastRow>=a.windowFirstRow?a.windowLastRow+1:a.windowFirstRow,columns:_(a.orderedColumns),isRowIncluded:m,getLabelLine:f};if(t===`selection`){let e=a.uiState.selection;if(!e)return null;if(e.type===`cell`){let t=n.normalizeCellRange(e.range);return{getRow:o,startRow:t.start.row,endRow:t.end.row+1,columns:a.orderedColumns.slice(t.start.col,t.end.col+1),isRowIncluded:m,getLabelLine:f}}if(e.type===`row`){let t=n.normalizeRowRange(e.startRow,e.endRow);return{getRow:o,startRow:t.startRow,endRow:t.endRow+1,columns:_(a.orderedColumns),isRowIncluded:m,getLabelLine:f}}let t=n.normalizeColumnRange(e.startCol,e.endCol);return{getRow:o,startRow:0,endRow:a.viewRowCount,columns:a.orderedColumns.slice(t.startCol,t.endCol+1),isRowIncluded:m,getLabelLine:f}}if(a.groupTree){let t=e.flattenGroupTree(a.groupTree,c),n=t.displayOrder,r=t.groups,o=p?(e,t)=>p(e,{viewRowIndex:t,rowKey:a.resolvedRowKeyGetter(e,n[t]??t)}):void 0,s=o;if(i&&o&&d){let t=[],i=!1;for(let r=0;r<n.length;r+=1){let s=n[r];s===void 0||e.isGroupOrderValue(s)||(o(a.rows[s],r)?t.push(s):i=!0)}if(i){let{aggColumns:i}=e.collectGroupingColumns(a.columns),o=e.flattenGroupTree(d.buildGroupTree(a.rows,Int32Array.from(t),g,i),c);n=o.displayOrder,r=o.groups}s=void 0}let l=n;return{getRow:t=>{let n=l[t];return n===void 0||e.isGroupOrderValue(n)?void 0:a.rows[n]},startRow:0,endRow:l.length,columns:_(a.orderedColumns),groupDisplay:{order:l,groups:r,groupColumnKeys:g.map(e=>e.key),getSourceRow:e=>a.rows[e]},isRowIncluded:s}}return{getRow:o,startRow:0,endRow:a.viewRowCount,columns:a.orderedColumns,isRowIncluded:m,getLabelLine:f}},p=e=>e.filter(e=>!t.isSyntheticColumnKey(e.key)),m=(e,t,n)=>{let r=u()?.totalRowExport;if(!(t!==!0||!r||e!==`view`))return o.buildTotalRowExportLine(n,r.cells,r.label)},h=(e,t,n)=>t===!0&&e.groupDisplay?r.createGroupSubtotalLineGetter({...e.groupDisplay,columns:n,texts:u()?.localeTexts}):void 0,g=(e,t)=>{let n=u()?.pinnedRowsExport;return t===!0&&n&&e!==`selection`?n:void 0},_=e=>{let t=l(e?.scope),n=f(t,e?.includeLabelRows===!0,e?.includeGroupRows===!0);if(!n)return e?.bom?``:``;let r=p(n.columns),a=g(t,e?.includePinnedRows);return i.serializeRowsToCsv({getRow:n.getRow,startRow:n.startRow,endRow:n.endRow,columns:r,delimiter:e?.delimiter,includeHeaders:e?.includeHeaders,bom:e?.bom,escapeFormulas:e?.escapeFormulas,isRowIncluded:n.isRowIncluded,getLabelLine:n.getLabelLine,totalLine:m(t,e?.includeTotalRow,r),getGroupLine:h(n,e?.includeGroupRows,r),pinnedTop:a?.top,pinnedBottom:a?.bottom})},v=e=>{let t=l(e?.scope),n=f(t,e?.includeLabelRows===!0,e?.includeGroupRows===!0);if(!n)return{columns:[],rows:[]};let r=p(n.columns),i=g(t,e?.includePinnedRows);return a.buildGridExportData({getRow:n.getRow,startRow:n.startRow,endRow:n.endRow,columns:r,isRowIncluded:n.isRowIncluded,getLabelLine:n.getLabelLine,totalLine:m(t,e?.includeTotalRow,r),getGroupLine:h(n,e?.includeGroupRows,r),pinnedTop:i?.top,pinnedBottom:i?.bottom})};return{exportCsv:e=>_(e),downloadCsv:(e,t)=>{if(typeof document>`u`)return;let n=_({...t,bom:t?.bom??!0}),r=new Blob([n],{type:`text/csv;charset=utf-8;`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e??`export.csv`,document.body.appendChild(a),a.click(),document.body.removeChild(a),setTimeout(()=>{URL.revokeObjectURL(i)},s)},getExportData:e=>v(e)}};exports.createExportCommands=u;
@@ -135,10 +135,13 @@ var d = 1e3, f = /* @__PURE__ */ new Set(), p = (e) => e === void 0 || e === "vi
135
135
  ...e.groupDisplay,
136
136
  columns: n,
137
137
  texts: m()?.localeTexts
138
- }) : void 0, b = (e) => {
138
+ }) : void 0, b = (e, t) => {
139
+ let n = m()?.pinnedRowsExport;
140
+ return t === !0 && n && e !== "selection" ? n : void 0;
141
+ }, x = (e) => {
139
142
  let t = p(e?.scope), n = g(t, e?.includeLabelRows === !0, e?.includeGroupRows === !0);
140
143
  if (!n) return e?.bom ? "" : "";
141
- let r = _(n.columns);
144
+ let r = _(n.columns), i = b(t, e?.includePinnedRows);
142
145
  return c({
143
146
  getRow: n.getRow,
144
147
  startRow: n.startRow,
@@ -151,15 +154,17 @@ var d = 1e3, f = /* @__PURE__ */ new Set(), p = (e) => e === void 0 || e === "vi
151
154
  isRowIncluded: n.isRowIncluded,
152
155
  getLabelLine: n.getLabelLine,
153
156
  totalLine: v(t, e?.includeTotalRow, r),
154
- getGroupLine: y(n, e?.includeGroupRows, r)
157
+ getGroupLine: y(n, e?.includeGroupRows, r),
158
+ pinnedTop: i?.top,
159
+ pinnedBottom: i?.bottom
155
160
  });
156
- }, x = (e) => {
161
+ }, S = (e) => {
157
162
  let t = p(e?.scope), n = g(t, e?.includeLabelRows === !0, e?.includeGroupRows === !0);
158
163
  if (!n) return {
159
164
  columns: [],
160
165
  rows: []
161
166
  };
162
- let r = _(n.columns);
167
+ let r = _(n.columns), i = b(t, e?.includePinnedRows);
163
168
  return l({
164
169
  getRow: n.getRow,
165
170
  startRow: n.startRow,
@@ -168,14 +173,16 @@ var d = 1e3, f = /* @__PURE__ */ new Set(), p = (e) => e === void 0 || e === "vi
168
173
  isRowIncluded: n.isRowIncluded,
169
174
  getLabelLine: n.getLabelLine,
170
175
  totalLine: v(t, e?.includeTotalRow, r),
171
- getGroupLine: y(n, e?.includeGroupRows, r)
176
+ getGroupLine: y(n, e?.includeGroupRows, r),
177
+ pinnedTop: i?.top,
178
+ pinnedBottom: i?.bottom
172
179
  });
173
180
  };
174
181
  return {
175
- exportCsv: (e) => b(e),
182
+ exportCsv: (e) => x(e),
176
183
  downloadCsv: (e, t) => {
177
184
  if (typeof document > "u") return;
178
- let n = b({
185
+ let n = x({
179
186
  ...t,
180
187
  bom: t?.bom ?? !0
181
188
  }), r = new Blob([n], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
@@ -183,7 +190,7 @@ var d = 1e3, f = /* @__PURE__ */ new Set(), p = (e) => e === void 0 || e === "vi
183
190
  URL.revokeObjectURL(i);
184
191
  }, d);
185
192
  },
186
- getExportData: (e) => x(e)
193
+ getExportData: (e) => S(e)
187
194
  };
188
195
  };
189
196
  //#endregion